text
stringlengths
2
100k
meta
dict
// sst.h // Copyright (c) 2014 - 2017, zhiayang // Licensed under the Apache License Version 2.0. #pragma once #include "defs.h" #include "sst_expr.h" #include "mpreal/mpreal.h" namespace fir { struct Type; struct ClassType; struct FunctionType; struct Function; struct ConstantValue; } namespace cgn { struct CodegenState; } namespace ast { struct FuncDefn; struct TypeDefn; } namespace sst { //! ACHTUNG ! //* note: this is the thing that everyone calls to check the mutability of a slice of something //* defined in typecheck/slice.cpp bool getMutabilityOfSliceOfType(fir::Type* ty); struct StateTree; struct Block; struct HasBlocks { HasBlocks() { } virtual ~HasBlocks() { } virtual std::vector<Block*> getBlocks() = 0; bool elideMergeBlock = false; }; struct TypeDefn : Defn { TypeDefn(const Location& l) : Defn(l) { this->readableName = "type definition"; } ~TypeDefn() { } ast::TypeDefn* original = 0; }; struct TypeExpr : Expr { virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; //* allows us to intern this, so we don't leak memory. static TypeExpr* make(const Location& l, fir::Type* t); TypeExpr(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "<TYPE EXPRESSION>"; } ~TypeExpr() { } }; struct RawValueExpr : Expr { RawValueExpr(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "<RAW VALUE EXPRESSION>"; } ~RawValueExpr() { } virtual CGResult _codegen(cgn::CodegenState*, fir::Type* = 0) override { return this->rawValue; } CGResult rawValue; }; struct ArgumentDefn; struct Block : Stmt { Block(const Location& l) : Stmt(l) { this->readableName = "block"; } ~Block() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Location closingBrace; bool isSingleExpr = false; std::vector<Stmt*> statements; std::vector<Stmt*> deferred; std::function<void ()> preBodyCode; std::function<void ()> postBodyCode; }; struct IfStmt : Stmt, HasBlocks { IfStmt(const Location& l) : Stmt(l) { this->readableName = "if statement"; } ~IfStmt() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; virtual std::vector<Block*> getBlocks() override; struct Case { Expr* cond = 0; Block* body = 0; std::vector<Stmt*> inits; Case(Expr* c, Block* b, const std::vector<Stmt*>& i) : cond(c), body(b), inits(i) { } }; std::vector<Case> cases; Block* elseCase = 0; }; struct ReturnStmt : Stmt { ReturnStmt(const Location& l) : Stmt(l) { this->readableName = "return statement"; } ~ReturnStmt() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* value = 0; fir::Type* expectedType = 0; }; struct WhileLoop : Stmt, HasBlocks { WhileLoop(const Location& l) : Stmt(l) { this->readableName = "while loop"; } ~WhileLoop() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; virtual std::vector<Block*> getBlocks() override; Expr* cond = 0; Block* body = 0; bool isDoVariant = false; }; struct VarDefn; struct ForeachLoop : Stmt, HasBlocks { ForeachLoop(const Location& l) : Stmt(l) { this->readableName = "for loop"; } ~ForeachLoop() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; virtual std::vector<Block*> getBlocks() override; VarDefn* indexVar = 0; DecompMapping mappings; Expr* array = 0; Block* body = 0; }; struct BreakStmt : Stmt { BreakStmt(const Location& l) : Stmt(l) { this->readableName = "break statement"; } ~BreakStmt() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; }; struct ContinueStmt : Stmt { ContinueStmt(const Location& l) : Stmt(l) { this->readableName = "continue statement"; } ~ContinueStmt() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; }; struct SizeofOp : Expr { SizeofOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "sizeof expression"; } ~SizeofOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; fir::Type* typeToSize = 0; }; struct TypeidOp : Expr { TypeidOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "sizeof expression"; } ~TypeidOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; fir::Type* typeToId = 0; }; struct FunctionDefn; struct AllocOp : Expr { AllocOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "alloc statement"; } ~AllocOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; fir::Type* elmType = 0; std::vector<Expr*> counts; std::vector<FnCallArgument> arguments; Defn* constructor = 0; VarDefn* initBlockVar = 0; VarDefn* initBlockIdx = 0; Block* initBlock = 0; bool isMutable = false; }; struct DeallocOp : Stmt { DeallocOp(const Location& l) : Stmt(l) { this->readableName = "free statement"; } ~DeallocOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* expr = 0; }; struct BinaryOp : Expr { BinaryOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "binary expression"; } ~BinaryOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* left = 0; Expr* right = 0; std::string op; FunctionDefn* overloadedOpFunction = 0; }; struct UnaryOp : Expr { UnaryOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "unary expression"; } ~UnaryOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* expr = 0; std::string op; FunctionDefn* overloadedOpFunction = 0; }; struct AssignOp : Expr { AssignOp(const Location& l); ~AssignOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::string op; Expr* left = 0; Expr* right = 0; }; //* for the case where we assign to a tuple literal, to enable (a, b) = (b, a) (or really (a, b) = anything) struct TupleAssignOp : Expr { TupleAssignOp(const Location& l); ~TupleAssignOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::vector<Expr*> lefts; Expr* right = 0; }; struct SubscriptDollarOp : Expr { SubscriptDollarOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "dollar expression"; } ~SubscriptDollarOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; }; struct SubscriptOp : Expr { SubscriptOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "subscript expression"; } ~SubscriptOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* expr = 0; Expr* inside = 0; }; struct SliceOp : Expr { SliceOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "slice expression"; } ~SliceOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* expr = 0; Expr* begin = 0; Expr* end = 0; }; struct FunctionCall : Expr { FunctionCall(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "function call"; } ~FunctionCall() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::string name; Defn* target = 0; std::vector<FnCallArgument> arguments; bool isImplicitMethodCall = false; }; struct ExprCall : Expr { ExprCall(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "function call"; } ~ExprCall() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* callee = 0; std::vector<Expr*> arguments; }; struct StructDefn; struct ClassDefn; struct StructConstructorCall : Expr { StructConstructorCall(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "struct constructor call"; } ~StructConstructorCall() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; StructDefn* target = 0; std::vector<FnCallArgument> arguments; }; struct ClassConstructorCall : Expr { ClassConstructorCall(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "class constructor call"; } ~ClassConstructorCall() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; ClassDefn* classty = 0; FunctionDefn* target = 0; std::vector<FnCallArgument> arguments; }; struct BaseClassConstructorCall : ClassConstructorCall { BaseClassConstructorCall(const Location& l, fir::Type* t) : ClassConstructorCall(l, t) { this->readableName = "base class constructor call"; } ~BaseClassConstructorCall() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; }; struct VarDefn; struct VarRef : Expr { VarRef(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "identifier"; } ~VarRef() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::string name; Defn* def = 0; bool isImplicitField = false; }; struct SelfVarRef : Expr { SelfVarRef(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "this"; } ~SelfVarRef() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; }; struct ScopeExpr : Expr { ScopeExpr(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "<SCOPE EXPRESSION>"; } ~ScopeExpr() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::vector<std::string> scope; }; struct FieldDotOp : Expr { FieldDotOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "field access"; } ~FieldDotOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* lhs = 0; std::string rhsIdent; bool isMethodRef = false; bool isTransparentField = false; size_t indexOfTransparentField = 0; }; struct MethodDotOp : Expr { MethodDotOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "method call"; } ~MethodDotOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* lhs = 0; Expr* call = 0; }; struct TupleDotOp : Expr { TupleDotOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "tuple access"; } ~TupleDotOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* lhs = 0; size_t index = 0; }; struct BuiltinDotOp : Expr { BuiltinDotOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "dot operator"; } ~BuiltinDotOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* lhs = 0; std::string name; bool isFunctionCall = false; std::vector<Expr*> args; }; struct EnumDefn; struct EnumDotOp : Expr { EnumDotOp(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "enum case access"; } ~EnumDotOp() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::string caseName; EnumDefn* enumeration = 0; }; struct LiteralNumber : Expr { LiteralNumber(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "number literal"; } ~LiteralNumber() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; mpfr::mpreal num; }; struct LiteralString : Expr { LiteralString(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "string literal"; } ~LiteralString() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::string str; bool isCString = false; }; struct LiteralNull : Expr { LiteralNull(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "null literal"; } ~LiteralNull() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; }; struct LiteralBool : Expr { LiteralBool(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "boolean literal"; } ~LiteralBool() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; bool value = false; }; struct LiteralChar : Expr { LiteralChar(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "character literal"; } ~LiteralChar() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; uint32_t value = false; }; struct LiteralTuple : Expr { LiteralTuple(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "tuple literal"; } ~LiteralTuple() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::vector<Expr*> values; }; struct LiteralArray : Expr { LiteralArray(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "array literal"; } ~LiteralArray() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::vector<Expr*> values; }; struct RangeExpr : Expr { RangeExpr(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "range expression"; } ~RangeExpr() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* start = 0; Expr* end = 0; Expr* step = 0; bool halfOpen = false; }; struct SplatExpr : Expr { SplatExpr(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "splat expression"; } ~SplatExpr() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* infer = 0) override; Expr* inside = 0; }; struct TreeDefn : Defn { TreeDefn(const Location& l) : Defn(l) { this->readableName = "<TREE DEFINITION>"; } ~TreeDefn() { } virtual std::string getKind() override { return "namespace"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; StateTree* tree = 0; }; struct NamespaceDefn : Stmt { NamespaceDefn(const Location& l) : Stmt(l) { this->readableName = "namespace"; } ~NamespaceDefn() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::string name; std::vector<Stmt*> statements; }; struct VarDefn : Defn { VarDefn(const Location& l) : Defn(l) { this->readableName = "variable definition"; } ~VarDefn() { } virtual std::string getKind() override { return "variable"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* init = 0; bool immutable = false; FunctionDefn* definingFunction = 0; }; struct ArgumentDefn : VarDefn { ArgumentDefn(const Location& l) : VarDefn(l) { this->readableName = "<ARGUMENT DEFINITION>"; this->immutable = true; } ~ArgumentDefn() { } virtual std::string getKind() override { return "argument"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; }; struct FunctionDecl : Defn { std::vector<FnParam> params; fir::Type* returnType = 0; fir::Type* parentTypeForMethod = 0; bool isVarArg = false; virtual std::string getKind() override { return "function"; } protected: FunctionDecl(const Location& l) : Defn(l) { this->readableName = "function declaration"; } ~FunctionDecl() { } }; struct FunctionDefn : FunctionDecl { FunctionDefn(const Location& l) : FunctionDecl(l) { this->readableName = "function definition"; } ~FunctionDefn() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::vector<ArgumentDefn*> arguments; // bleh, this exists so we can go *into* the scope to inspect stuff if necessary StateTree* insideTree = 0; Block* body = 0; bool needReturnVoid = false; bool isVirtual = false; bool isOverride = false; bool isMutating = false; ast::FuncDefn* original = 0; }; struct ForeignFuncDefn : FunctionDecl { ForeignFuncDefn(const Location& l) : FunctionDecl(l) { this->readableName = "foreign function definition"; } ~ForeignFuncDefn() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; bool isIntrinsic = false; std::string realName; }; struct OperatorOverloadDefn : FunctionDefn { OperatorOverloadDefn(const Location& l) : FunctionDefn(l) { this->readableName = "operator overload definition"; } ~OperatorOverloadDefn() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; }; struct DecompDefn : Stmt { DecompDefn(const Location& l) : Stmt(l) { this->readableName = "destructuring variable definition"; } ~DecompDefn() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* init = 0; bool immutable = false; DecompMapping bindings; }; struct StructFieldDefn : VarDefn { StructFieldDefn(const Location& l) : VarDefn(l) { } ~StructFieldDefn() { } virtual std::string getKind() override { return "field"; } virtual CGResult _codegen(cgn::CodegenState*, fir::Type* = 0) override { return CGResult(0); } TypeDefn* parentType = 0; bool isTransparentField = false; }; struct ClassInitialiserDefn : FunctionDefn { ClassInitialiserDefn(const Location& l) : FunctionDefn(l) { } ~ClassInitialiserDefn() { } virtual std::string getKind() override { return "initialiser"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override { return this->FunctionDefn::_codegen(cs, inferred); } }; struct BareTypeDefn : TypeDefn { BareTypeDefn(const Location& l) : TypeDefn(l) { this->readableName = "type definition"; } ~BareTypeDefn() { } virtual std::string getKind() override { return "type"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; }; struct TraitDefn : TypeDefn { TraitDefn(const Location& l) : TypeDefn(l) { this->readableName = "trait definition"; } ~TraitDefn() { } virtual std::string getKind() override { return "trait"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::vector<FunctionDecl*> methods; }; struct StructDefn : TypeDefn { StructDefn(const Location& l) : TypeDefn(l) { this->readableName = "struct definition"; } ~StructDefn() { } virtual std::string getKind() override { return "struct"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::vector<StructFieldDefn*> fields; std::vector<FunctionDefn*> methods; std::vector<TraitDefn*> traits; }; struct ClassDefn : StructDefn { ClassDefn(const Location& l) : StructDefn(l) { this->readableName = "class definition"; } ~ClassDefn() { } virtual std::string getKind() override { return "class"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; ClassDefn* baseClass = 0; std::vector<TypeDefn*> nestedTypes; std::vector<VarDefn*> staticFields; std::vector<FunctionDefn*> staticMethods; std::vector<FunctionDefn*> initialisers; FunctionDefn* deinitialiser = 0; FunctionDefn* copyInitialiser = 0; FunctionDefn* moveInitialiser = 0; }; struct EnumCaseDefn : Defn { EnumCaseDefn(const Location& l) : Defn(l) { this->readableName = "enum case definition"; } ~EnumCaseDefn() { } virtual std::string getKind() override { return "enum case"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; Expr* val = 0; size_t index = 0; EnumDefn* parentEnum = 0; fir::ConstantValue* value = 0; }; struct EnumDefn : TypeDefn { EnumDefn(const Location& l) : TypeDefn(l) { this->readableName = "enum definition"; } ~EnumDefn() { } virtual std::string getKind() override { return "enum"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; fir::Type* memberType = 0; util::hash_map<std::string, EnumCaseDefn*> cases; }; struct RawUnionDefn : TypeDefn { RawUnionDefn(const Location& l) : TypeDefn(l) { this->readableName = "raw union definition"; } ~RawUnionDefn() { } virtual std::string getKind() override { return "raw union"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; util::hash_map<std::string, StructFieldDefn*> fields; std::vector<StructFieldDefn*> transparentFields; }; struct UnionVariantDefn; struct UnionDefn : TypeDefn { UnionDefn(const Location& l) : TypeDefn(l) { this->readableName = "union definition"; } ~UnionDefn() { } virtual std::string getKind() override { return "union"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; util::hash_map<std::string, UnionVariantDefn*> variants; }; struct UnionVariantDefn : TypeDefn { UnionVariantDefn(const Location& l) : TypeDefn(l) { this->readableName = "union variant definition"; } ~UnionVariantDefn() { } virtual std::string getKind() override { return "union variant"; } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; std::string variantName; UnionDefn* parentUnion = 0; }; struct UnionVariantConstructor : Expr { UnionVariantConstructor(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "union constructor"; } ~UnionVariantConstructor() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; size_t variantId = 0; UnionDefn* parentUnion = 0; std::vector<FnCallArgument> args; }; struct RunDirective : Expr { RunDirective(const Location& l, fir::Type* t) : Expr(l, t) { this->readableName = "run directive"; } ~RunDirective() { } virtual CGResult _codegen(cgn::CodegenState* cs, fir::Type* inferred = 0) override; // mutually exclusive! Block* block = 0; Expr* insideExpr = 0; }; }
{ "pile_set_name": "Github" }
/*===------------ avx512bf16intrin.h - AVX512_BF16 intrinsics --------------=== * * 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 * *===-----------------------------------------------------------------------=== */ #ifndef __IMMINTRIN_H #error "Never use <avx512bf16intrin.h> directly; include <immintrin.h> instead." #endif #ifndef __AVX512BF16INTRIN_H #define __AVX512BF16INTRIN_H typedef short __m512bh __attribute__((__vector_size__(64), __aligned__(64))); typedef short __m256bh __attribute__((__vector_size__(32), __aligned__(32))); typedef unsigned short __bfloat16; #define __DEFAULT_FN_ATTRS512 \ __attribute__((__always_inline__, __nodebug__, __target__("avx512bf16"), \ __min_vector_width__(512))) #define __DEFAULT_FN_ATTRS \ __attribute__((__always_inline__, __nodebug__, __target__("avx512bf16"))) /// Convert One BF16 Data to One Single Float Data. /// /// \headerfile <x86intrin.h> /// /// This intrinsic does not correspond to a specific instruction. /// /// \param __A /// A bfloat data. /// \returns A float data whose sign field and exponent field keep unchanged, /// and fraction field is extended to 23 bits. static __inline__ float __DEFAULT_FN_ATTRS _mm_cvtsbh_ss(__bfloat16 __A) { return __builtin_ia32_cvtsbf162ss_32(__A); } /// Convert Two Packed Single Data to One Packed BF16 Data. /// /// \headerfile <x86intrin.h> /// /// This intrinsic corresponds to the <c> VCVTNE2PS2BF16 </c> instructions. /// /// \param __A /// A 512-bit vector of [16 x float]. /// \param __B /// A 512-bit vector of [16 x float]. /// \returns A 512-bit vector of [32 x bfloat] whose lower 256 bits come from /// conversion of __B, and higher 256 bits come from conversion of __A. static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_cvtne2ps_pbh(__m512 __A, __m512 __B) { return (__m512bh)__builtin_ia32_cvtne2ps2bf16_512((__v16sf) __A, (__v16sf) __B); } /// Convert Two Packed Single Data to One Packed BF16 Data. /// /// \headerfile <x86intrin.h> /// /// This intrinsic corresponds to the <c> VCVTNE2PS2BF16 </c> instructions. /// /// \param __A /// A 512-bit vector of [16 x float]. /// \param __B /// A 512-bit vector of [16 x float]. /// \param __W /// A 512-bit vector of [32 x bfloat]. /// \param __U /// A 32-bit mask value specifying what is chosen for each element. /// A 1 means conversion of __A or __B. A 0 means element from __W. /// \returns A 512-bit vector of [32 x bfloat] whose lower 256 bits come from /// conversion of __B, and higher 256 bits come from conversion of __A. static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_mask_cvtne2ps_pbh(__m512bh __W, __mmask32 __U, __m512 __A, __m512 __B) { return (__m512bh)__builtin_ia32_selectw_512((__mmask32)__U, (__v32hi)_mm512_cvtne2ps_pbh(__A, __B), (__v32hi)__W); } /// Convert Two Packed Single Data to One Packed BF16 Data. /// /// \headerfile <x86intrin.h> /// /// This intrinsic corresponds to the <c> VCVTNE2PS2BF16 </c> instructions. /// /// \param __A /// A 512-bit vector of [16 x float]. /// \param __B /// A 512-bit vector of [16 x float]. /// \param __U /// A 32-bit mask value specifying what is chosen for each element. /// A 1 means conversion of __A or __B. A 0 means element is zero. /// \returns A 512-bit vector of [32 x bfloat] whose lower 256 bits come from /// conversion of __B, and higher 256 bits come from conversion of __A. static __inline__ __m512bh __DEFAULT_FN_ATTRS512 _mm512_maskz_cvtne2ps_pbh(__mmask32 __U, __m512 __A, __m512 __B) { return (__m512bh)__builtin_ia32_selectw_512((__mmask32)__U, (__v32hi)_mm512_cvtne2ps_pbh(__A, __B), (__v32hi)_mm512_setzero_si512()); } /// Convert Packed Single Data to Packed BF16 Data. /// /// \headerfile <x86intrin.h> /// /// This intrinsic corresponds to the <c> VCVTNEPS2BF16 </c> instructions. /// /// \param __A /// A 512-bit vector of [16 x float]. /// \returns A 256-bit vector of [16 x bfloat] come from conversion of __A. static __inline__ __m256bh __DEFAULT_FN_ATTRS512 _mm512_cvtneps_pbh(__m512 __A) { return (__m256bh)__builtin_ia32_cvtneps2bf16_512_mask((__v16sf)__A, (__v16hi)_mm256_undefined_si256(), (__mmask16)-1); } /// Convert Packed Single Data to Packed BF16 Data. /// /// \headerfile <x86intrin.h> /// /// This intrinsic corresponds to the <c> VCVTNEPS2BF16 </c> instructions. /// /// \param __A /// A 512-bit vector of [16 x float]. /// \param __W /// A 256-bit vector of [16 x bfloat]. /// \param __U /// A 16-bit mask value specifying what is chosen for each element. /// A 1 means conversion of __A. A 0 means element from __W. /// \returns A 256-bit vector of [16 x bfloat] come from conversion of __A. static __inline__ __m256bh __DEFAULT_FN_ATTRS512 _mm512_mask_cvtneps_pbh(__m256bh __W, __mmask16 __U, __m512 __A) { return (__m256bh)__builtin_ia32_cvtneps2bf16_512_mask((__v16sf)__A, (__v16hi)__W, (__mmask16)__U); } /// Convert Packed Single Data to Packed BF16 Data. /// /// \headerfile <x86intrin.h> /// /// This intrinsic corresponds to the <c> VCVTNEPS2BF16 </c> instructions. /// /// \param __A /// A 512-bit vector of [16 x float]. /// \param __U /// A 16-bit mask value specifying what is chosen for each element. /// A 1 means conversion of __A. A 0 means element is zero. /// \returns A 256-bit vector of [16 x bfloat] come from conversion of __A. static __inline__ __m256bh __DEFAULT_FN_ATTRS512 _mm512_maskz_cvtneps_pbh(__mmask16 __U, __m512 __A) { return (__m256bh)__builtin_ia32_cvtneps2bf16_512_mask((__v16sf)__A, (__v16hi)_mm256_setzero_si256(), (__mmask16)__U); } /// Dot Product of BF16 Pairs Accumulated into Packed Single Precision. /// /// \headerfile <x86intrin.h> /// /// This intrinsic corresponds to the <c> VDPBF16PS </c> instructions. /// /// \param __A /// A 512-bit vector of [32 x bfloat]. /// \param __B /// A 512-bit vector of [32 x bfloat]. /// \param __D /// A 512-bit vector of [16 x float]. /// \returns A 512-bit vector of [16 x float] comes from Dot Product of /// __A, __B and __D static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_dpbf16_ps(__m512 __D, __m512bh __A, __m512bh __B) { return (__m512)__builtin_ia32_dpbf16ps_512((__v16sf) __D, (__v16si) __A, (__v16si) __B); } /// Dot Product of BF16 Pairs Accumulated into Packed Single Precision. /// /// \headerfile <x86intrin.h> /// /// This intrinsic corresponds to the <c> VDPBF16PS </c> instructions. /// /// \param __A /// A 512-bit vector of [32 x bfloat]. /// \param __B /// A 512-bit vector of [32 x bfloat]. /// \param __D /// A 512-bit vector of [16 x float]. /// \param __U /// A 16-bit mask value specifying what is chosen for each element. /// A 1 means __A and __B's dot product accumulated with __D. A 0 means __D. /// \returns A 512-bit vector of [16 x float] comes from Dot Product of /// __A, __B and __D static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_mask_dpbf16_ps(__m512 __D, __mmask16 __U, __m512bh __A, __m512bh __B) { return (__m512)__builtin_ia32_selectps_512((__mmask16)__U, (__v16sf)_mm512_dpbf16_ps(__D, __A, __B), (__v16sf)__D); } /// Dot Product of BF16 Pairs Accumulated into Packed Single Precision. /// /// \headerfile <x86intrin.h> /// /// This intrinsic corresponds to the <c> VDPBF16PS </c> instructions. /// /// \param __A /// A 512-bit vector of [32 x bfloat]. /// \param __B /// A 512-bit vector of [32 x bfloat]. /// \param __D /// A 512-bit vector of [16 x float]. /// \param __U /// A 16-bit mask value specifying what is chosen for each element. /// A 1 means __A and __B's dot product accumulated with __D. A 0 means 0. /// \returns A 512-bit vector of [16 x float] comes from Dot Product of /// __A, __B and __D static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_maskz_dpbf16_ps(__mmask16 __U, __m512 __D, __m512bh __A, __m512bh __B) { return (__m512)__builtin_ia32_selectps_512((__mmask16)__U, (__v16sf)_mm512_dpbf16_ps(__D, __A, __B), (__v16sf)_mm512_setzero_si512()); } /// Convert Packed BF16 Data to Packed float Data. /// /// \headerfile <x86intrin.h> /// /// \param __A /// A 256-bit vector of [16 x bfloat]. /// \returns A 512-bit vector of [16 x float] come from convertion of __A static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_cvtpbh_ps(__m256bh __A) { return _mm512_castsi512_ps((__m512i)_mm512_slli_epi32( (__m512i)_mm512_cvtepi16_epi32((__m256i)__A), 16)); } /// Convert Packed BF16 Data to Packed float Data using zeroing mask. /// /// \headerfile <x86intrin.h> /// /// \param __U /// A 16-bit mask. Elements are zeroed out when the corresponding mask /// bit is not set. /// \param __A /// A 256-bit vector of [16 x bfloat]. /// \returns A 512-bit vector of [16 x float] come from convertion of __A static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_maskz_cvtpbh_ps(__mmask16 __U, __m256bh __A) { return _mm512_castsi512_ps((__m512i)_mm512_slli_epi32( (__m512i)_mm512_maskz_cvtepi16_epi32((__mmask16)__U, (__m256i)__A), 16)); } /// Convert Packed BF16 Data to Packed float Data using merging mask. /// /// \headerfile <x86intrin.h> /// /// \param __S /// A 512-bit vector of [16 x float]. Elements are copied from __S when /// the corresponding mask bit is not set. /// \param __U /// A 16-bit mask. /// \param __A /// A 256-bit vector of [16 x bfloat]. /// \returns A 512-bit vector of [16 x float] come from convertion of __A static __inline__ __m512 __DEFAULT_FN_ATTRS512 _mm512_mask_cvtpbh_ps(__m512 __S, __mmask16 __U, __m256bh __A) { return _mm512_castsi512_ps((__m512i)_mm512_mask_slli_epi32( (__m512i)__S, (__mmask16)__U, (__m512i)_mm512_cvtepi16_epi32((__m256i)__A), 16)); } #undef __DEFAULT_FN_ATTRS #undef __DEFAULT_FN_ATTRS512 #endif
{ "pile_set_name": "Github" }
import pydoc import keyword from jedi._compatibility import is_py3 from jedi import common from jedi.evaluate import compiled try: from pydoc_data import topics as pydoc_topics except ImportError: # Python 2.6 import pydoc_topics if is_py3: keys = keyword.kwlist else: keys = keyword.kwlist + ['None', 'False', 'True'] def keywords(string='', pos=(0, 0), all=False): if all: return set([Keyword(k, pos) for k in keys]) if string in keys: return set([Keyword(string, pos)]) return set() def keyword_names(*args, **kwargs): kwds = [] for k in keywords(*args, **kwargs): start = k.start_pos kwds.append(KeywordName(k, k.name, start)) return kwds def get_operator(string, pos): return Keyword(string, pos) class KeywordName(object): def __init__(self, parent, name, start_pos): self.parent = parent self.names = [name] self.start_pos = start_pos @property def end_pos(self): return self.start_pos[0], self.start_pos[1] + len(self.name) class Keyword(object): def __init__(self, name, pos): self.name = name self.start_pos = pos self.parent = compiled.builtin def get_parent_until(self): return self.parent @property def names(self): """ For a `parsing.Name` like comparision """ return [self.name] @property def docstr(self): return imitate_pydoc(self.name) def __repr__(self): return '<%s: %s>' % (type(self).__name__, self.name) def imitate_pydoc(string): """ It's not possible to get the pydoc's without starting the annoying pager stuff. """ # str needed because of possible unicode stuff in py2k (pydoc doesn't work # with unicode strings) string = str(string) h = pydoc.help with common.ignored(KeyError): # try to access symbols string = h.symbols[string] string, _, related = string.partition(' ') get_target = lambda s: h.topics.get(s, h.keywords.get(s)) while isinstance(string, str): string = get_target(string) try: # is a tuple now label, related = string except TypeError: return '' try: return pydoc_topics.topics[label] if pydoc_topics else '' except KeyError: return ''
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>hsweb-system-workflow</artifactId> <groupId>org.hswebframework.web</groupId> <version>3.0.11</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>hsweb-system-workflow-starter</artifactId> <dependencies> <dependency> <groupId>org.hswebframework.web</groupId> <artifactId>hsweb-system-workflow-local</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <!-- test --> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.0.26</version> <scope>test</scope> </dependency> <dependency> <groupId>org.hswebframework.web</groupId> <artifactId>hsweb-spring-boot-starter</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.hswebframework.web</groupId> <artifactId>hsweb-system-authorization-starter</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.hswebframework.web</groupId> <artifactId>hsweb-system-organizational-starter</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.hswebframework.web</groupId> <artifactId>hsweb-tests</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.hswebframework.web</groupId> <artifactId>hsweb-system-dynamic-form-starter</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> </dependencies> </project>
{ "pile_set_name": "Github" }
/** * Copyright (c) 2010-2020 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 */ package org.openhab.binding.airvisualnode.internal.config; /** * Configuration for AirVisual Node. * * @author Victor Antonovich - Initial contribution */ public class AirVisualNodeConfig { public static final String ADDRESS = "address"; public String address; public String username; public String password; public String share; public long refresh; }
{ "pile_set_name": "Github" }
/* Set covering employment in Gecode. Problem from http://mathworld.wolfram.com/SetCoveringDeployment.html Compare with the following models: * MiniZinc: http://www.hakank.org/minizinc/set_covering_deployment.mzn * Comet : http://www.hakank.org/comet/set_covering_deployment.co This Gecode model was created by Hakan Kjellerstrand ([email protected]) Also, see my Gecode page: http://www.hakank.org/gecode/ */ #include <gecode/driver.hh> #include <gecode/int.hh> #include <gecode/minimodel.hh> using namespace Gecode; const std::string Countries[] = {"alexandria", "asia_minor", "britain", "byzantium", "gaul", "iberia", "rome", "tunis"}; class SetCoveringDeployment : public MinimizeScript { protected: static const int n = 8; // number of countries IntVar num_armies; // number of armies (to minimize) IntVarArray X; // the first army IntVarArray Y; // the second (reserve) army int num_armies_args; // parameter number of armies from command line public: // Search variants enum { SEARCH_DFS, // Use depth first search to find the smallest tick SEARCH_BAB, // Use branch and bound to optimize }; SetCoveringDeployment(const SizeOptions& opt) : num_armies(*this, 0, n), X(*this, n, 0, 1), Y(*this, n, 0, 1), num_armies_args(opt.size()) { // the incidence matrix // See the map at // http://mathworld.wolfram.com/SetCoveringDeployment.html int mat[] = { 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0 }; // // calculate num_armies // IntVarArray XY(*this, n, 0, n*n); for(int i = 0; i < n; i++) { rel(*this, X[i]+Y[i]==XY[i], opt.icl()); } linear(*this, XY, IRT_EQ, num_armies, opt.icl()); // // Constraint 1: There is always an army in a city (+ maybe a backup) // Or rather: Is there a backup, there must be an an army for(int i = 0; i < n; i++ ) rel(*this, X[i] >= Y[i], opt.icl()); // // Constraint 2: There should always be an backup army near every city // for(int i = 0; i < n; i++) { IntVarArray y_tmp(*this, n, 0, n); for(int j = 0; j < n; j++) { if (mat[i*n+j] == 1) { rel(*this, y_tmp[j] == Y[j], opt.icl()); } else { rel(*this, y_tmp[j] == 0, opt.icl()); } } IntVar y_sum(*this, 0, n); linear(*this, y_tmp, IRT_EQ, y_sum, opt.icl()); rel(*this, X[i] + y_sum >= 1, opt.icl()); } // Constraint 3 for full search // don't forget // -search dfs if (num_armies_args) { rel(*this, num_armies <= num_armies_args, opt.icl()); } branch(*this, X, INT_VAR_DEGREE_MAX(), INT_VAL_MIN()); branch(*this, Y, INT_VAR_DEGREE_MAX(), INT_VAL_MIN()); } // Print solution virtual void print(std::ostream& os) const { os << "num_armies: " << num_armies << std::endl; os << "X: " << X << std::endl; os << "Y: " << Y << std::endl; os << std::endl; } // Return cost virtual IntVar cost(void) const { return num_armies; } // Constructor for cloning s SetCoveringDeployment(bool share, SetCoveringDeployment& s) : MinimizeScript(share,s), num_armies_args(s.num_armies_args) { X.update(*this, share, s.X); Y.update(*this, share, s.Y); num_armies.update(*this, share, s.num_armies); } // Copy during cloning virtual Space* copy(bool share) { return new SetCoveringDeployment(share,*this); } }; int main(int argc, char* argv[]) { SizeOptions opt("SetCoveringDeployment"); opt.solutions(0); opt.search(SetCoveringDeployment::SEARCH_BAB); opt.search(SetCoveringDeployment::SEARCH_DFS, "dfs"); opt.search(SetCoveringDeployment::SEARCH_BAB, "bab"); opt.parse(argc,argv); switch (opt.search()) { case SetCoveringDeployment::SEARCH_DFS: MinimizeScript::run<SetCoveringDeployment,DFS,SizeOptions>(opt); break; case SetCoveringDeployment::SEARCH_BAB: MinimizeScript::run<SetCoveringDeployment,BAB,SizeOptions>(opt); break; } return 0; }
{ "pile_set_name": "Github" }
//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by resource.rc // #define IDI_ICON1 101 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 102 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif
{ "pile_set_name": "Github" }
#ifndef BOOST_MPL_AUX_PARTITION_OP_HPP_INCLUDED #define BOOST_MPL_AUX_PARTITION_OP_HPP_INCLUDED // Copyright Eric Friedman 2003 // Copyright Aleksey Gurtovoy 2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ #include <boost/mpl/apply.hpp> #include <boost/mpl/eval_if.hpp> #include <boost/mpl/if.hpp> #include <boost/mpl/pair.hpp> #include <boost/mpl/aux_/lambda_spec.hpp> namespace boost { namespace mpl { namespace aux { template< typename Pred, typename In1Op, typename In2Op > struct partition_op { template< typename State, typename T > struct apply { typedef typename State::first first_; typedef typename State::second second_; typedef typename apply1< Pred,T >::type pred_; typedef typename eval_if< pred_ , apply2<In1Op,first_,T> , apply2<In2Op,second_,T> >::type result_; typedef typename if_< pred_ , pair< result_,second_ > , pair< first_,result_ > >::type type; }; }; } // namespace aux BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, aux::partition_op) }} #endif // BOOST_MPL_AUX_PARTITION_OP_HPP_INCLUDED
{ "pile_set_name": "Github" }
/**CFile**************************************************************** FileName [ifLibLut.c] SystemName [ABC: Logic synthesis and verification system.] PackageName [FPGA mapping based on priority cuts.] Synopsis [LUT library.] Author [Alan Mishchenko] Affiliation [UC Berkeley] Date [Ver. 1.0. Started - November 21, 2006.] Revision [$Id: ifLibLut.c,v 1.00 2006/11/21 00:00:00 alanmi Exp $] ***********************************************************************/ #include "if.h" #include "base/main/mainInt.h" ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [Reads the description of LUTs from the LUT library file.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ If_LibLut_t * If_LibLutReadString( char * pStr ) { If_LibLut_t * p; Vec_Ptr_t * vStrs; char * pToken, * pBuffer, * pStrNew, * pStrMem; int i, k, j; if ( pStr == NULL || pStr[0] == 0 ) return NULL; vStrs = Vec_PtrAlloc( 1000 ); pStrNew = pStrMem = Abc_UtilStrsav( pStr ); while ( *pStrNew ) { Vec_PtrPush( vStrs, pStrNew ); while ( *pStrNew != '\n' ) pStrNew++; while ( *pStrNew == '\n' ) *pStrNew++ = '\0'; } p = ABC_ALLOC( If_LibLut_t, 1 ); memset( p, 0, sizeof(If_LibLut_t) ); i = 1; //while ( fgets( pBuffer, 1000, pFile ) != NULL ) Vec_PtrForEachEntry( char *, vStrs, pBuffer, j ) { if ( pBuffer[0] == 0 ) continue; pToken = strtok( pBuffer, " \t\n" ); if ( pToken == NULL ) continue; if ( pToken[0] == '#' ) continue; if ( i != atoi(pToken) ) { Abc_Print( 1, "Error in the LUT library string.\n" ); ABC_FREE( p->pName ); ABC_FREE( p ); ABC_FREE( pStrMem ); Vec_PtrFree( vStrs ); return NULL; } // read area pToken = strtok( NULL, " \t\n" ); p->pLutAreas[i] = (float)atof(pToken); // read delays k = 0; while ( (pToken = strtok( NULL, " \t\n" )) ) p->pLutDelays[i][k++] = (float)atof(pToken); // check for out-of-bound if ( k > i ) { Abc_Print( 1, "LUT %d has too many pins (%d). Max allowed is %d.\n", i, k, i ); ABC_FREE( p->pName ); ABC_FREE( p ); ABC_FREE( pStrMem ); Vec_PtrFree( vStrs ); return NULL; } // check if var delays are specified if ( k > 1 ) p->fVarPinDelays = 1; if ( i == IF_MAX_LUTSIZE ) { Abc_Print( 1, "Skipping LUTs of size more than %d.\n", i ); ABC_FREE( p->pName ); ABC_FREE( p ); ABC_FREE( pStrMem ); Vec_PtrFree( vStrs ); return NULL; } i++; } p->LutMax = i-1; // check the library if ( p->fVarPinDelays ) { for ( i = 1; i <= p->LutMax; i++ ) for ( k = 0; k < i; k++ ) { if ( p->pLutDelays[i][k] <= 0.0 ) Abc_Print( 0, "Pin %d of LUT %d has delay %f. Pin delays should be non-negative numbers. Technology mapping may not work correctly.\n", k, i, p->pLutDelays[i][k] ); if ( k && p->pLutDelays[i][k-1] > p->pLutDelays[i][k] ) Abc_Print( 0, "Pin %d of LUT %d has delay %f. Pin %d of LUT %d has delay %f. Pin delays should be in non-decreasing order. Technology mapping may not work correctly.\n", k-1, i, p->pLutDelays[i][k-1], k, i, p->pLutDelays[i][k] ); } } else { for ( i = 1; i <= p->LutMax; i++ ) { if ( p->pLutDelays[i][0] <= 0.0 ) Abc_Print( 0, "LUT %d has delay %f. Pin delays should be non-negative numbers. Technology mapping may not work correctly.\n", i, p->pLutDelays[i][0] ); } } // cleanup ABC_FREE( pStrMem ); Vec_PtrFree( vStrs ); return p; } /**Function************************************************************* Synopsis [Sets the library associated with the string.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_FrameSetLutLibrary( Abc_Frame_t * pAbc, char * pLutLibString ) { If_LibLut_t * pLib = If_LibLutReadString( pLutLibString ); if ( pLib == NULL ) { fprintf( stdout, "Reading LUT library from string has failed.\n" ); return 0; } // replace the current library If_LibLutFree( (If_LibLut_t *)Abc_FrameReadLibLut() ); Abc_FrameSetLibLut( pLib ); return 1; } int Abc_FrameSetLutLibraryTest( Abc_Frame_t * pAbc ) { char * pStr = "1 1.00 1000\n2 1.00 1000 1200\n3 1.00 1000 1200 1400\n4 1.00 1000 1200 1400 1600\n5 1.00 1000 1200 1400 1600 1800\n6 1.00 1000 1200 1400 1600 1800 2000\n\n\n"; Abc_FrameSetLutLibrary( pAbc, pStr ); return 1; } /**Function************************************************************* Synopsis [Reads the description of LUTs from the LUT library file.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ If_LibLut_t * If_LibLutRead( char * FileName ) { char pBuffer[1000], * pToken; If_LibLut_t * p; FILE * pFile; int i, k; pFile = fopen( FileName, "r" ); if ( pFile == NULL ) { Abc_Print( -1, "Cannot open LUT library file \"%s\".\n", FileName ); return NULL; } p = ABC_ALLOC( If_LibLut_t, 1 ); memset( p, 0, sizeof(If_LibLut_t) ); p->pName = Abc_UtilStrsav( FileName ); i = 1; while ( fgets( pBuffer, 1000, pFile ) != NULL ) { pToken = strtok( pBuffer, " \t\n" ); if ( pToken == NULL ) continue; if ( pToken[0] == '#' ) continue; if ( i != atoi(pToken) ) { Abc_Print( 1, "Error in the LUT library file \"%s\".\n", FileName ); ABC_FREE( p->pName ); ABC_FREE( p ); fclose( pFile ); return NULL; } // read area pToken = strtok( NULL, " \t\n" ); p->pLutAreas[i] = (float)atof(pToken); // read delays k = 0; while ( (pToken = strtok( NULL, " \t\n" )) ) p->pLutDelays[i][k++] = (float)atof(pToken); // check for out-of-bound if ( k > i ) { ABC_FREE( p->pName ); ABC_FREE( p ); Abc_Print( 1, "LUT %d has too many pins (%d). Max allowed is %d.\n", i, k, i ); fclose( pFile ); return NULL; } // check if var delays are specified if ( k > 1 ) p->fVarPinDelays = 1; if ( i == IF_MAX_LUTSIZE ) { ABC_FREE( p->pName ); ABC_FREE( p ); Abc_Print( 1, "Skipping LUTs of size more than %d.\n", i ); fclose( pFile ); return NULL; } i++; } p->LutMax = i-1; // check the library if ( p->fVarPinDelays ) { for ( i = 1; i <= p->LutMax; i++ ) for ( k = 0; k < i; k++ ) { if ( p->pLutDelays[i][k] <= 0.0 ) Abc_Print( 0, "Pin %d of LUT %d has delay %f. Pin delays should be non-negative numbers. Technology mapping may not work correctly.\n", k, i, p->pLutDelays[i][k] ); if ( k && p->pLutDelays[i][k-1] > p->pLutDelays[i][k] ) Abc_Print( 0, "Pin %d of LUT %d has delay %f. Pin %d of LUT %d has delay %f. Pin delays should be in non-decreasing order. Technology mapping may not work correctly.\n", k-1, i, p->pLutDelays[i][k-1], k, i, p->pLutDelays[i][k] ); } } else { for ( i = 1; i <= p->LutMax; i++ ) { if ( p->pLutDelays[i][0] <= 0.0 ) Abc_Print( 0, "LUT %d has delay %f. Pin delays should be non-negative numbers. Technology mapping may not work correctly.\n", i, p->pLutDelays[i][0] ); } } fclose( pFile ); return p; } /**Function************************************************************* Synopsis [Duplicates the LUT library.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ If_LibLut_t * If_LibLutDup( If_LibLut_t * p ) { If_LibLut_t * pNew; pNew = ABC_ALLOC( If_LibLut_t, 1 ); *pNew = *p; pNew->pName = Abc_UtilStrsav( pNew->pName ); return pNew; } /**Function************************************************************* Synopsis [Frees the LUT library.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void If_LibLutFree( If_LibLut_t * pLutLib ) { if ( pLutLib == NULL ) return; ABC_FREE( pLutLib->pName ); ABC_FREE( pLutLib ); } /**Function************************************************************* Synopsis [Prints the LUT library.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void If_LibLutPrint( If_LibLut_t * pLutLib ) { int i, k; Abc_Print( 1, "# The area/delay of k-variable LUTs:\n" ); Abc_Print( 1, "# k area delay\n" ); if ( pLutLib->fVarPinDelays ) { for ( i = 1; i <= pLutLib->LutMax; i++ ) { Abc_Print( 1, "%d %7.2f ", i, pLutLib->pLutAreas[i] ); for ( k = 0; k < i; k++ ) Abc_Print( 1, " %7.2f", pLutLib->pLutDelays[i][k] ); Abc_Print( 1, "\n" ); } } else for ( i = 1; i <= pLutLib->LutMax; i++ ) Abc_Print( 1, "%d %7.2f %7.2f\n", i, pLutLib->pLutAreas[i], pLutLib->pLutDelays[i][0] ); } /**Function************************************************************* Synopsis [Returns 1 if the delays are discrete.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int If_LibLutDelaysAreDiscrete( If_LibLut_t * pLutLib ) { float Delay; int i; for ( i = 1; i <= pLutLib->LutMax; i++ ) { Delay = pLutLib->pLutDelays[i][0]; if ( ((float)((int)Delay)) != Delay ) return 0; } return 1; } /**Function************************************************************* Synopsis [Returns 1 if the delays are discrete.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int If_LibLutDelaysAreDifferent( If_LibLut_t * pLutLib ) { int i, k; float Delay = pLutLib->pLutDelays[1][0]; if ( pLutLib->fVarPinDelays ) { for ( i = 2; i <= pLutLib->LutMax; i++ ) for ( k = 0; k < i; k++ ) if ( pLutLib->pLutDelays[i][k] != Delay ) return 1; } else { for ( i = 2; i <= pLutLib->LutMax; i++ ) if ( pLutLib->pLutDelays[i][0] != Delay ) return 1; } return 0; } /**Function************************************************************* Synopsis [Sets simple LUT library.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ If_LibLut_t * If_LibLutSetSimple( int nLutSize ) { If_LibLut_t s_LutLib10= { "lutlib",10, 0, {0,1,1,1,1,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1}} }; If_LibLut_t s_LutLib9 = { "lutlib", 9, 0, {0,1,1,1,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1},{1},{1},{1}} }; If_LibLut_t s_LutLib8 = { "lutlib", 8, 0, {0,1,1,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1},{1},{1}} }; If_LibLut_t s_LutLib7 = { "lutlib", 7, 0, {0,1,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1},{1}} }; If_LibLut_t s_LutLib6 = { "lutlib", 6, 0, {0,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1}} }; If_LibLut_t s_LutLib5 = { "lutlib", 5, 0, {0,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1}} }; If_LibLut_t s_LutLib4 = { "lutlib", 4, 0, {0,1,1,1,1}, {{0},{1},{1},{1},{1}} }; If_LibLut_t s_LutLib3 = { "lutlib", 3, 0, {0,1,1,1}, {{0},{1},{1},{1}} }; If_LibLut_t * pLutLib; assert( nLutSize >= 3 && nLutSize <= 10 ); switch ( nLutSize ) { case 3: pLutLib = &s_LutLib3; break; case 4: pLutLib = &s_LutLib4; break; case 5: pLutLib = &s_LutLib5; break; case 6: pLutLib = &s_LutLib6; break; case 7: pLutLib = &s_LutLib7; break; case 8: pLutLib = &s_LutLib8; break; case 9: pLutLib = &s_LutLib9; break; case 10: pLutLib = &s_LutLib10; break; default: pLutLib = NULL; break; } if ( pLutLib == NULL ) return NULL; return If_LibLutDup(pLutLib); } /**Function************************************************************* Synopsis [Gets the delay of the fastest pin.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ float If_LibLutFastestPinDelay( If_LibLut_t * p ) { return !p? 1.0 : p->pLutDelays[p->LutMax][0]; } /**Function************************************************************* Synopsis [Gets the delay of the slowest pin.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ float If_LibLutSlowestPinDelay( If_LibLut_t * p ) { return !p? 1.0 : (p->fVarPinDelays? p->pLutDelays[p->LutMax][p->LutMax-1]: p->pLutDelays[p->LutMax][0]); } //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// ABC_NAMESPACE_IMPL_END
{ "pile_set_name": "Github" }
<!DOCTYPE HTML> <html> <head> <title>Test to ensure bidi is resolved correctly</title> </head> <body> <canvas id="c" width="256" height="64" style="direction:rtl"></canvas> <script type="text/javascript"> var canvas = document.getElementById('c'); var ctx = canvas.getContext('2d'); var str = "goodbye\u202D\u05DD\u05D5\u05DC\u05E9\u202Chello"; ctx.fillStyle = 'black'; ctx.font = '10px sans-serif'; ctx.fillText(str, 128, 32); </script> </body> </html>
{ "pile_set_name": "Github" }
{tr}A new file was posted to file gallery{/tr}: {$galleryName} {tr}Posted by{/tr}: {$author} {tr}Date{/tr}: {$mail_date|tiki_short_datetime} {tr}Name{/tr}: {$fname} {tr}File Name{/tr}: {$filename} {tr}File Description{/tr}: {$fdescription} You can download the new file at: {$mail_machine}/tiki-list_file_gallery.php?galleryId={$galleryId}
{ "pile_set_name": "Github" }
--- a/Makefile +++ b/Makefile @@ -1548,14 +1548,14 @@ install -d $(INSTALL_PATH)/$$header_dir; \ done for header in `$(FIND) "include/rocksdb" -type f -name *.h`; do \ - install -C -m 644 $$header $(INSTALL_PATH)/$$header; \ + install -c -m 644 $$header $(INSTALL_PATH)/$$header; \ done install-static: install-headers $(LIBRARY) - install -C -m 755 $(LIBRARY) $(INSTALL_PATH)/lib + install -c -m 755 $(LIBRARY) $(INSTALL_PATH)/lib install-shared: install-headers $(SHARED4) - install -C -m 755 $(SHARED4) $(INSTALL_PATH)/lib && \ + install -c -m 755 $(SHARED4) $(INSTALL_PATH)/lib && \ ln -fs $(SHARED4) $(INSTALL_PATH)/lib/$(SHARED3) && \ ln -fs $(SHARED4) $(INSTALL_PATH)/lib/$(SHARED2) && \ ln -fs $(SHARED4) $(INSTALL_PATH)/lib/$(SHARED1)
{ "pile_set_name": "Github" }
/* * Copyright 2019 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.flatbuffers; import static com.google.flatbuffers.Constants.*; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.charset.Charset; /** * Helper type for accessing vector of signed or unsigned 16-bit values. */ public final class ShortVector extends BaseVector { /** * Assigns vector access object to vector data. * * @param _vector Start data of a vector. * @param _bb Table's ByteBuffer. * @return Returns current vector access object assigned to vector data whose offset is stored at * `vector`. */ public ShortVector __assign(int _vector, ByteBuffer _bb) { __reset(_vector, Constants.SIZEOF_SHORT, _bb); return this; } /** * Reads the short value at the given index. * * @param j The index from which the short value will be read. * @return the 16-bit value at the given index. */ public short get(int j) { return bb.getShort(__element(j)); } /** * Reads the short at the given index, zero-extends it to type int, and returns the result, * which is therefore in the range 0 through 65535. * * @param j The index from which the short value will be read. * @return the unsigned 16-bit at the given index. */ public int getAsUnsigned(int j) { return (int) get(j) & 0xFFFF; } }
{ "pile_set_name": "Github" }
#ifndef _RAR_LOG_ #define _RAR_LOG_ void InitLogOptions(const wchar *LogFileName,RAR_CHARSET CSet); #ifdef SILENT inline void Log(const wchar *ArcName,const wchar *fmt,...) {} #else void Log(const wchar *ArcName,const wchar *fmt,...); #endif #endif
{ "pile_set_name": "Github" }
module.exports = { preset: 'ts-jest', setupFiles: ['./jest.setup.js'], testEnvironment: 'jsdom', testPathIgnorePatterns: ['/node_modules/', '/docs/'] };
{ "pile_set_name": "Github" }
// // String+MD5.swift // Kingfisher // // Created by Wei Wang on 18//25. // // Copyright (c) 2018 Wei Wang <[email protected]> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. import Foundation import CommonCrypto extension String: KingfisherCompatible { } extension KingfisherWrapper where Base == String { var md5: String { guard let data = base.data(using: .utf8) else { return base } var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH)) _ = data.withUnsafeBytes { bytes in return CC_MD5(bytes, CC_LONG(data.count), &digest) } return digest.map { String(format: "%02x", $0) }.joined() } }
{ "pile_set_name": "Github" }
# Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in /Users/miguelvargas/Library/Android/sdk/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the proguardFiles # directive in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #}
{ "pile_set_name": "Github" }
/** * @author: aperez <[email protected]> * @version: v2.0.0 * * @update Dennis Hernández <http://djhvscf.github.io/Blog> */ !function($) { 'use strict'; var firstLoad = false; var sprintf = $.fn.bootstrapTable.utils.sprintf; var showAvdSearch = function(pColumns, searchTitle, searchText, that) { if (!$("#avdSearchModal" + "_" + that.options.idTable).hasClass("modal")) { var vModal = sprintf("<div id=\"avdSearchModal%s\" class=\"modal fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"mySmallModalLabel\" aria-hidden=\"true\">", "_" + that.options.idTable); vModal += "<div class=\"modal-dialog modal-xs\">"; vModal += " <div class=\"modal-content\">"; vModal += " <div class=\"modal-header\">"; vModal += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\" >&times;</button>"; vModal += sprintf(" <h4 class=\"modal-title\">%s</h4>", searchTitle); vModal += " </div>"; vModal += " <div class=\"modal-body modal-body-custom\">"; vModal += sprintf(" <div class=\"container-fluid\" id=\"avdSearchModalContent%s\" style=\"padding-right: 0px;padding-left: 0px;\" >", "_" + that.options.idTable); vModal += " </div>"; vModal += " </div>"; vModal += " </div>"; vModal += " </div>"; vModal += "</div>"; $("body").append($(vModal)); var vFormAvd = createFormAvd(pColumns, searchText, that), timeoutId = 0;; $('#avdSearchModalContent' + "_" + that.options.idTable).append(vFormAvd.join('')); $('#' + that.options.idForm).off('keyup blur', 'input').on('keyup blur', 'input', function (event) { clearTimeout(timeoutId); timeoutId = setTimeout(function () { that.onColumnAdvancedSearch(event); }, that.options.searchTimeOut); }); $("#btnCloseAvd" + "_" + that.options.idTable).click(function() { $("#avdSearchModal" + "_" + that.options.idTable).modal('hide'); }); $("#avdSearchModal" + "_" + that.options.idTable).modal(); } else { $("#avdSearchModal" + "_" + that.options.idTable).modal(); } }; var createFormAvd = function(pColumns, searchText, that) { var htmlForm = []; htmlForm.push(sprintf('<form class="form-horizontal" id="%s" action="%s" >', that.options.idForm, that.options.actionForm)); for (var i in pColumns) { var vObjCol = pColumns[i]; if (!vObjCol.checkbox && vObjCol.visible && vObjCol.searchable) { htmlForm.push('<div class="form-group">'); htmlForm.push(sprintf('<label class="col-sm-4 control-label">%s</label>', vObjCol.title)); htmlForm.push('<div class="col-sm-6">'); htmlForm.push(sprintf('<input type="text" class="form-control input-md" name="%s" placeholder="%s" id="%s">', vObjCol.field, vObjCol.title, vObjCol.field)); htmlForm.push('</div>'); htmlForm.push('</div>'); } } htmlForm.push('<div class="form-group">'); htmlForm.push('<div class="col-sm-offset-9 col-sm-3">'); htmlForm.push(sprintf('<button type="button" id="btnCloseAvd%s" class="btn btn-default" >%s</button>', "_" + that.options.idTable, searchText)); htmlForm.push('</div>'); htmlForm.push('</div>'); htmlForm.push('</form>'); return htmlForm; }; $.extend($.fn.bootstrapTable.defaults, { advancedSearch: false, idForm: 'advancedSearch', actionForm: '', idTable: undefined, onColumnAdvancedSearch: function (field, text) { return false; } }); $.extend($.fn.bootstrapTable.defaults.icons, { advancedSearchIcon: 'glyphicon-chevron-down' }); $.extend($.fn.bootstrapTable.Constructor.EVENTS, { 'column-advanced-search.bs.table': 'onColumnAdvancedSearch' }); $.extend($.fn.bootstrapTable.locales, { formatAdvancedSearch: function() { return 'Advanced search'; }, formatAdvancedCloseButton: function() { return "Close"; } }); $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales); var BootstrapTable = $.fn.bootstrapTable.Constructor, _initToolbar = BootstrapTable.prototype.initToolbar, _load = BootstrapTable.prototype.load, _initSearch = BootstrapTable.prototype.initSearch; BootstrapTable.prototype.initToolbar = function() { _initToolbar.apply(this, Array.prototype.slice.apply(arguments)); if (!this.options.search) { return; } if (!this.options.advancedSearch) { return; } if (!this.options.idTable) { return; } var that = this, html = []; html.push(sprintf('<div class="columns columns-%s btn-group pull-%s" role="group">', this.options.buttonsAlign, this.options.buttonsAlign)); html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="advancedSearch" aria-label="advanced search" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatAdvancedSearch())); html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.advancedSearchIcon)) html.push('</button></div>'); that.$toolbar.prepend(html.join('')); that.$toolbar.find('button[name="advancedSearch"]') .off('click').on('click', function() { showAvdSearch(that.columns, that.options.formatAdvancedSearch(), that.options.formatAdvancedCloseButton(), that); }); }; BootstrapTable.prototype.load = function(data) { _load.apply(this, Array.prototype.slice.apply(arguments)); if (!this.options.advancedSearch) { return; } if (typeof this.options.idTable === 'undefined') { return; } else { if (!firstLoad) { var height = parseInt($(".bootstrap-table").height()); height += 10; $("#" + this.options.idTable).bootstrapTable("resetView", {height: height}); firstLoad = true; } } }; BootstrapTable.prototype.initSearch = function () { _initSearch.apply(this, Array.prototype.slice.apply(arguments)); if (!this.options.advancedSearch) { return; } var that = this; var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial; this.data = fp ? $.grep(this.data, function (item, i) { for (var key in fp) { var fval = fp[key].toLowerCase(); var value = item[key]; value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header, that.header.formatters[$.inArray(key, that.header.fields)], [value, item, i], value); if (!($.inArray(key, that.header.fields) !== -1 && (typeof value === 'string' || typeof value === 'number') && (value + '').toLowerCase().indexOf(fval) !== -1)) { return false; } } return true; }) : this.data; }; BootstrapTable.prototype.onColumnAdvancedSearch = function (event) { var text = $.trim($(event.currentTarget).val()); var $field = $(event.currentTarget)[0].id; if ($.isEmptyObject(this.filterColumnsPartial)) { this.filterColumnsPartial = {}; } if (text) { this.filterColumnsPartial[$field] = text; } else { delete this.filterColumnsPartial[$field]; } this.options.pageNumber = 1; this.onSearch(event); this.updatePagination(); this.trigger('column-advanced-search', $field, text); }; }(jQuery);
{ "pile_set_name": "Github" }
/** @file Header file for BDS Platform specific code Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef _BDS_PLATFORM_H #define _BDS_PLATFORM_H #include <Library/DebugLib.h> #include <Library/UefiBootServicesTableLib.h> #include <Library/PlatformBootManagerLib.h> #include <Library/UefiLib.h> #include <Library/HobLib.h> #include <Library/PrintLib.h> #include <Library/PerformanceLib.h> #include <Library/BoardBootManagerLib.h> #endif
{ "pile_set_name": "Github" }
libgq (0.4+0m6) unstable; urgency=low * This entry has been added by BIFH queue processor version has been changed to 0.4+0m6 -- Marius Vollmer <[email protected]> Fri, 04 Jun 2010 18:28:43 +0300 libgq (0.4) unstable; urgency=low * Never release the GConf client, to avoid having to recreate it immediately. Might fix NB#164690. -- Marius Vollmer <[email protected]> Fri, 04 Jun 2010 18:10:50 +0300 libgq (0.3) unstable; urgency=low * Added autotools to Build-Depends. -- Marius Vollmer <[email protected]> Tue, 23 Feb 2010 12:04:45 +0200 libgq (0.2) unstable; urgency=low * Build fixes. -- Marius Vollmer <[email protected]> Wed, 16 Dec 2009 15:56:05 +0200 libgq (0.1) unstable; urgency=low * Initial release. -- Marius Vollmer <[email protected]> Wed, 16 Dec 2009 15:54:46 +0200
{ "pile_set_name": "Github" }
<annotation> <folder>train</folder> <filename>cam_image12.jpg</filename> <path>C:\tensorflow_cards\train\cam_image12.jpg</path> <source> <database>Unknown</database> </source> <size> <width>960</width> <height>540</height> <depth>3</depth> </size> <segmented>0</segmented> <object> <name>king</name> <pose>Unspecified</pose> <truncated>0</truncated> <difficult>0</difficult> <bndbox> <xmin>362</xmin> <ymin>149</ymin> <xmax>560</xmax> <ymax>389</ymax> </bndbox> </object> </annotation>
{ "pile_set_name": "Github" }
/* * Datapath implementation for ST-Ericsson CW1200 mac80211 drivers * * Copyright (c) 2010, ST-Ericsson * Author: Dmitry Tarnyagin <[email protected]> * * 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. */ #include <net/mac80211.h> #include <linux/etherdevice.h> #include <linux/skbuff.h> #include "cw1200.h" #include "wsm.h" #include "bh.h" #include "sta.h" #include "debug.h" #define CW1200_INVALID_RATE_ID (0xFF) static int cw1200_handle_action_rx(struct cw1200_common *priv, struct sk_buff *skb); static const struct ieee80211_rate * cw1200_get_tx_rate(const struct cw1200_common *priv, const struct ieee80211_tx_rate *rate); /* ******************************************************************** */ /* TX queue lock / unlock */ static inline void cw1200_tx_queues_lock(struct cw1200_common *priv) { int i; for (i = 0; i < 4; ++i) cw1200_queue_lock(&priv->tx_queue[i]); } static inline void cw1200_tx_queues_unlock(struct cw1200_common *priv) { int i; for (i = 0; i < 4; ++i) cw1200_queue_unlock(&priv->tx_queue[i]); } /* ******************************************************************** */ /* TX policy cache implementation */ static void tx_policy_dump(struct tx_policy *policy) { pr_debug("[TX policy] %.1X%.1X%.1X%.1X%.1X%.1X%.1X%.1X %.1X%.1X%.1X%.1X%.1X%.1X%.1X%.1X %.1X%.1X%.1X%.1X%.1X%.1X%.1X%.1X: %d\n", policy->raw[0] & 0x0F, policy->raw[0] >> 4, policy->raw[1] & 0x0F, policy->raw[1] >> 4, policy->raw[2] & 0x0F, policy->raw[2] >> 4, policy->raw[3] & 0x0F, policy->raw[3] >> 4, policy->raw[4] & 0x0F, policy->raw[4] >> 4, policy->raw[5] & 0x0F, policy->raw[5] >> 4, policy->raw[6] & 0x0F, policy->raw[6] >> 4, policy->raw[7] & 0x0F, policy->raw[7] >> 4, policy->raw[8] & 0x0F, policy->raw[8] >> 4, policy->raw[9] & 0x0F, policy->raw[9] >> 4, policy->raw[10] & 0x0F, policy->raw[10] >> 4, policy->raw[11] & 0x0F, policy->raw[11] >> 4, policy->defined); } static void tx_policy_build(const struct cw1200_common *priv, /* [out] */ struct tx_policy *policy, struct ieee80211_tx_rate *rates, size_t count) { int i, j; unsigned limit = priv->short_frame_max_tx_count; unsigned total = 0; BUG_ON(rates[0].idx < 0); memset(policy, 0, sizeof(*policy)); /* Sort rates in descending order. */ for (i = 1; i < count; ++i) { if (rates[i].idx < 0) { count = i; break; } if (rates[i].idx > rates[i - 1].idx) { struct ieee80211_tx_rate tmp = rates[i - 1]; rates[i - 1] = rates[i]; rates[i] = tmp; } } /* Eliminate duplicates. */ total = rates[0].count; for (i = 0, j = 1; j < count; ++j) { if (rates[j].idx == rates[i].idx) { rates[i].count += rates[j].count; } else if (rates[j].idx > rates[i].idx) { break; } else { ++i; if (i != j) rates[i] = rates[j]; } total += rates[j].count; } count = i + 1; /* Re-fill policy trying to keep every requested rate and with * respect to the global max tx retransmission count. */ if (limit < count) limit = count; if (total > limit) { for (i = 0; i < count; ++i) { int left = count - i - 1; if (rates[i].count > limit - left) rates[i].count = limit - left; limit -= rates[i].count; } } /* HACK!!! Device has problems (at least) switching from * 54Mbps CTS to 1Mbps. This switch takes enormous amount * of time (100-200 ms), leading to valuable throughput drop. * As a workaround, additional g-rates are injected to the * policy. */ if (count == 2 && !(rates[0].flags & IEEE80211_TX_RC_MCS) && rates[0].idx > 4 && rates[0].count > 2 && rates[1].idx < 2) { int mid_rate = (rates[0].idx + 4) >> 1; /* Decrease number of retries for the initial rate */ rates[0].count -= 2; if (mid_rate != 4) { /* Keep fallback rate at 1Mbps. */ rates[3] = rates[1]; /* Inject 1 transmission on lowest g-rate */ rates[2].idx = 4; rates[2].count = 1; rates[2].flags = rates[1].flags; /* Inject 1 transmission on mid-rate */ rates[1].idx = mid_rate; rates[1].count = 1; /* Fallback to 1 Mbps is a really bad thing, * so let's try to increase probability of * successful transmission on the lowest g rate * even more */ if (rates[0].count >= 3) { --rates[0].count; ++rates[2].count; } /* Adjust amount of rates defined */ count += 2; } else { /* Keep fallback rate at 1Mbps. */ rates[2] = rates[1]; /* Inject 2 transmissions on lowest g-rate */ rates[1].idx = 4; rates[1].count = 2; /* Adjust amount of rates defined */ count += 1; } } policy->defined = cw1200_get_tx_rate(priv, &rates[0])->hw_value + 1; for (i = 0; i < count; ++i) { register unsigned rateid, off, shift, retries; rateid = cw1200_get_tx_rate(priv, &rates[i])->hw_value; off = rateid >> 3; /* eq. rateid / 8 */ shift = (rateid & 0x07) << 2; /* eq. (rateid % 8) * 4 */ retries = rates[i].count; if (retries > 0x0F) { rates[i].count = 0x0f; retries = 0x0F; } policy->tbl[off] |= __cpu_to_le32(retries << shift); policy->retry_count += retries; } pr_debug("[TX policy] Policy (%zu): %d:%d, %d:%d, %d:%d, %d:%d\n", count, rates[0].idx, rates[0].count, rates[1].idx, rates[1].count, rates[2].idx, rates[2].count, rates[3].idx, rates[3].count); } static inline bool tx_policy_is_equal(const struct tx_policy *wanted, const struct tx_policy *cached) { size_t count = wanted->defined >> 1; if (wanted->defined > cached->defined) return false; if (count) { if (memcmp(wanted->raw, cached->raw, count)) return false; } if (wanted->defined & 1) { if ((wanted->raw[count] & 0x0F) != (cached->raw[count] & 0x0F)) return false; } return true; } static int tx_policy_find(struct tx_policy_cache *cache, const struct tx_policy *wanted) { /* O(n) complexity. Not so good, but there's only 8 entries in * the cache. * Also lru helps to reduce search time. */ struct tx_policy_cache_entry *it; /* First search for policy in "used" list */ list_for_each_entry(it, &cache->used, link) { if (tx_policy_is_equal(wanted, &it->policy)) return it - cache->cache; } /* Then - in "free list" */ list_for_each_entry(it, &cache->free, link) { if (tx_policy_is_equal(wanted, &it->policy)) return it - cache->cache; } return -1; } static inline void tx_policy_use(struct tx_policy_cache *cache, struct tx_policy_cache_entry *entry) { ++entry->policy.usage_count; list_move(&entry->link, &cache->used); } static inline int tx_policy_release(struct tx_policy_cache *cache, struct tx_policy_cache_entry *entry) { int ret = --entry->policy.usage_count; if (!ret) list_move(&entry->link, &cache->free); return ret; } void tx_policy_clean(struct cw1200_common *priv) { int idx, locked; struct tx_policy_cache *cache = &priv->tx_policy_cache; struct tx_policy_cache_entry *entry; cw1200_tx_queues_lock(priv); spin_lock_bh(&cache->lock); locked = list_empty(&cache->free); for (idx = 0; idx < TX_POLICY_CACHE_SIZE; idx++) { entry = &cache->cache[idx]; /* Policy usage count should be 0 at this time as all queues should be empty */ if (WARN_ON(entry->policy.usage_count)) { entry->policy.usage_count = 0; list_move(&entry->link, &cache->free); } memset(&entry->policy, 0, sizeof(entry->policy)); } if (locked) cw1200_tx_queues_unlock(priv); cw1200_tx_queues_unlock(priv); spin_unlock_bh(&cache->lock); } /* ******************************************************************** */ /* External TX policy cache API */ void tx_policy_init(struct cw1200_common *priv) { struct tx_policy_cache *cache = &priv->tx_policy_cache; int i; memset(cache, 0, sizeof(*cache)); spin_lock_init(&cache->lock); INIT_LIST_HEAD(&cache->used); INIT_LIST_HEAD(&cache->free); for (i = 0; i < TX_POLICY_CACHE_SIZE; ++i) list_add(&cache->cache[i].link, &cache->free); } static int tx_policy_get(struct cw1200_common *priv, struct ieee80211_tx_rate *rates, size_t count, bool *renew) { int idx; struct tx_policy_cache *cache = &priv->tx_policy_cache; struct tx_policy wanted; tx_policy_build(priv, &wanted, rates, count); spin_lock_bh(&cache->lock); if (WARN_ON_ONCE(list_empty(&cache->free))) { spin_unlock_bh(&cache->lock); return CW1200_INVALID_RATE_ID; } idx = tx_policy_find(cache, &wanted); if (idx >= 0) { pr_debug("[TX policy] Used TX policy: %d\n", idx); *renew = false; } else { struct tx_policy_cache_entry *entry; *renew = true; /* If policy is not found create a new one * using the oldest entry in "free" list */ entry = list_entry(cache->free.prev, struct tx_policy_cache_entry, link); entry->policy = wanted; idx = entry - cache->cache; pr_debug("[TX policy] New TX policy: %d\n", idx); tx_policy_dump(&entry->policy); } tx_policy_use(cache, &cache->cache[idx]); if (list_empty(&cache->free)) { /* Lock TX queues. */ cw1200_tx_queues_lock(priv); } spin_unlock_bh(&cache->lock); return idx; } static void tx_policy_put(struct cw1200_common *priv, int idx) { int usage, locked; struct tx_policy_cache *cache = &priv->tx_policy_cache; spin_lock_bh(&cache->lock); locked = list_empty(&cache->free); usage = tx_policy_release(cache, &cache->cache[idx]); if (locked && !usage) { /* Unlock TX queues. */ cw1200_tx_queues_unlock(priv); } spin_unlock_bh(&cache->lock); } static int tx_policy_upload(struct cw1200_common *priv) { struct tx_policy_cache *cache = &priv->tx_policy_cache; int i; struct wsm_set_tx_rate_retry_policy arg = { .num = 0, }; spin_lock_bh(&cache->lock); /* Upload only modified entries. */ for (i = 0; i < TX_POLICY_CACHE_SIZE; ++i) { struct tx_policy *src = &cache->cache[i].policy; if (src->retry_count && !src->uploaded) { struct wsm_tx_rate_retry_policy *dst = &arg.tbl[arg.num]; dst->index = i; dst->short_retries = priv->short_frame_max_tx_count; dst->long_retries = priv->long_frame_max_tx_count; dst->flags = WSM_TX_RATE_POLICY_FLAG_TERMINATE_WHEN_FINISHED | WSM_TX_RATE_POLICY_FLAG_COUNT_INITIAL_TRANSMIT; memcpy(dst->rate_count_indices, src->tbl, sizeof(dst->rate_count_indices)); src->uploaded = 1; ++arg.num; } } spin_unlock_bh(&cache->lock); cw1200_debug_tx_cache_miss(priv); pr_debug("[TX policy] Upload %d policies\n", arg.num); return wsm_set_tx_rate_retry_policy(priv, &arg); } void tx_policy_upload_work(struct work_struct *work) { struct cw1200_common *priv = container_of(work, struct cw1200_common, tx_policy_upload_work); pr_debug("[TX] TX policy upload.\n"); tx_policy_upload(priv); wsm_unlock_tx(priv); cw1200_tx_queues_unlock(priv); } /* ******************************************************************** */ /* cw1200 TX implementation */ struct cw1200_txinfo { struct sk_buff *skb; unsigned queue; struct ieee80211_tx_info *tx_info; const struct ieee80211_rate *rate; struct ieee80211_hdr *hdr; size_t hdrlen; const u8 *da; struct cw1200_sta_priv *sta_priv; struct ieee80211_sta *sta; struct cw1200_txpriv txpriv; }; u32 cw1200_rate_mask_to_wsm(struct cw1200_common *priv, u32 rates) { u32 ret = 0; int i; for (i = 0; i < 32; ++i) { if (rates & BIT(i)) ret |= BIT(priv->rates[i].hw_value); } return ret; } static const struct ieee80211_rate * cw1200_get_tx_rate(const struct cw1200_common *priv, const struct ieee80211_tx_rate *rate) { if (rate->idx < 0) return NULL; if (rate->flags & IEEE80211_TX_RC_MCS) return &priv->mcs_rates[rate->idx]; return &priv->hw->wiphy->bands[priv->channel->band]-> bitrates[rate->idx]; } static int cw1200_tx_h_calc_link_ids(struct cw1200_common *priv, struct cw1200_txinfo *t) { if (t->sta && t->sta_priv->link_id) t->txpriv.raw_link_id = t->txpriv.link_id = t->sta_priv->link_id; else if (priv->mode != NL80211_IFTYPE_AP) t->txpriv.raw_link_id = t->txpriv.link_id = 0; else if (is_multicast_ether_addr(t->da)) { if (priv->enable_beacon) { t->txpriv.raw_link_id = 0; t->txpriv.link_id = CW1200_LINK_ID_AFTER_DTIM; } else { t->txpriv.raw_link_id = 0; t->txpriv.link_id = 0; } } else { t->txpriv.link_id = cw1200_find_link_id(priv, t->da); if (!t->txpriv.link_id) t->txpriv.link_id = cw1200_alloc_link_id(priv, t->da); if (!t->txpriv.link_id) { wiphy_err(priv->hw->wiphy, "No more link IDs available.\n"); return -ENOENT; } t->txpriv.raw_link_id = t->txpriv.link_id; } if (t->txpriv.raw_link_id) priv->link_id_db[t->txpriv.raw_link_id - 1].timestamp = jiffies; if (t->sta && (t->sta->uapsd_queues & BIT(t->queue))) t->txpriv.link_id = CW1200_LINK_ID_UAPSD; return 0; } static void cw1200_tx_h_pm(struct cw1200_common *priv, struct cw1200_txinfo *t) { if (ieee80211_is_auth(t->hdr->frame_control)) { u32 mask = ~BIT(t->txpriv.raw_link_id); spin_lock_bh(&priv->ps_state_lock); priv->sta_asleep_mask &= mask; priv->pspoll_mask &= mask; spin_unlock_bh(&priv->ps_state_lock); } } static void cw1200_tx_h_calc_tid(struct cw1200_common *priv, struct cw1200_txinfo *t) { if (ieee80211_is_data_qos(t->hdr->frame_control)) { u8 *qos = ieee80211_get_qos_ctl(t->hdr); t->txpriv.tid = qos[0] & IEEE80211_QOS_CTL_TID_MASK; } else if (ieee80211_is_data(t->hdr->frame_control)) { t->txpriv.tid = 0; } } static int cw1200_tx_h_crypt(struct cw1200_common *priv, struct cw1200_txinfo *t) { if (!t->tx_info->control.hw_key || !ieee80211_has_protected(t->hdr->frame_control)) return 0; t->hdrlen += t->tx_info->control.hw_key->iv_len; skb_put(t->skb, t->tx_info->control.hw_key->icv_len); if (t->tx_info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) skb_put(t->skb, 8); /* MIC space */ return 0; } static int cw1200_tx_h_align(struct cw1200_common *priv, struct cw1200_txinfo *t, u8 *flags) { size_t offset = (size_t)t->skb->data & 3; if (!offset) return 0; if (offset & 1) { wiphy_err(priv->hw->wiphy, "Bug: attempt to transmit a frame with wrong alignment: %zu\n", offset); return -EINVAL; } if (skb_headroom(t->skb) < offset) { wiphy_err(priv->hw->wiphy, "Bug: no space allocated for DMA alignment. headroom: %d\n", skb_headroom(t->skb)); return -ENOMEM; } skb_push(t->skb, offset); t->hdrlen += offset; t->txpriv.offset += offset; *flags |= WSM_TX_2BYTES_SHIFT; cw1200_debug_tx_align(priv); return 0; } static int cw1200_tx_h_action(struct cw1200_common *priv, struct cw1200_txinfo *t) { struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)t->hdr; if (ieee80211_is_action(t->hdr->frame_control) && mgmt->u.action.category == WLAN_CATEGORY_BACK) return 1; else return 0; } /* Add WSM header */ static struct wsm_tx * cw1200_tx_h_wsm(struct cw1200_common *priv, struct cw1200_txinfo *t) { struct wsm_tx *wsm; if (skb_headroom(t->skb) < sizeof(struct wsm_tx)) { wiphy_err(priv->hw->wiphy, "Bug: no space allocated for WSM header. headroom: %d\n", skb_headroom(t->skb)); return NULL; } wsm = (struct wsm_tx *)skb_push(t->skb, sizeof(struct wsm_tx)); t->txpriv.offset += sizeof(struct wsm_tx); memset(wsm, 0, sizeof(*wsm)); wsm->hdr.len = __cpu_to_le16(t->skb->len); wsm->hdr.id = __cpu_to_le16(0x0004); wsm->queue_id = wsm_queue_id_to_wsm(t->queue); return wsm; } /* BT Coex specific handling */ static void cw1200_tx_h_bt(struct cw1200_common *priv, struct cw1200_txinfo *t, struct wsm_tx *wsm) { u8 priority = 0; if (!priv->bt_present) return; if (ieee80211_is_nullfunc(t->hdr->frame_control)) { priority = WSM_EPTA_PRIORITY_MGT; } else if (ieee80211_is_data(t->hdr->frame_control)) { /* Skip LLC SNAP header (+6) */ u8 *payload = &t->skb->data[t->hdrlen]; __be16 *ethertype = (__be16 *)&payload[6]; if (be16_to_cpu(*ethertype) == ETH_P_PAE) priority = WSM_EPTA_PRIORITY_EAPOL; } else if (ieee80211_is_assoc_req(t->hdr->frame_control) || ieee80211_is_reassoc_req(t->hdr->frame_control)) { struct ieee80211_mgmt *mgt_frame = (struct ieee80211_mgmt *)t->hdr; if (le16_to_cpu(mgt_frame->u.assoc_req.listen_interval) < priv->listen_interval) { pr_debug("Modified Listen Interval to %d from %d\n", priv->listen_interval, mgt_frame->u.assoc_req.listen_interval); /* Replace listen interval derieved from * the one read from SDD */ mgt_frame->u.assoc_req.listen_interval = cpu_to_le16(priv->listen_interval); } } if (!priority) { if (ieee80211_is_action(t->hdr->frame_control)) priority = WSM_EPTA_PRIORITY_ACTION; else if (ieee80211_is_mgmt(t->hdr->frame_control)) priority = WSM_EPTA_PRIORITY_MGT; else if ((wsm->queue_id == WSM_QUEUE_VOICE)) priority = WSM_EPTA_PRIORITY_VOICE; else if ((wsm->queue_id == WSM_QUEUE_VIDEO)) priority = WSM_EPTA_PRIORITY_VIDEO; else priority = WSM_EPTA_PRIORITY_DATA; } pr_debug("[TX] EPTA priority %d.\n", priority); wsm->flags |= priority << 1; } static int cw1200_tx_h_rate_policy(struct cw1200_common *priv, struct cw1200_txinfo *t, struct wsm_tx *wsm) { bool tx_policy_renew = false; t->txpriv.rate_id = tx_policy_get(priv, t->tx_info->control.rates, IEEE80211_TX_MAX_RATES, &tx_policy_renew); if (t->txpriv.rate_id == CW1200_INVALID_RATE_ID) return -EFAULT; wsm->flags |= t->txpriv.rate_id << 4; t->rate = cw1200_get_tx_rate(priv, &t->tx_info->control.rates[0]), wsm->max_tx_rate = t->rate->hw_value; if (t->rate->flags & IEEE80211_TX_RC_MCS) { if (cw1200_ht_greenfield(&priv->ht_info)) wsm->ht_tx_parameters |= __cpu_to_le32(WSM_HT_TX_GREENFIELD); else wsm->ht_tx_parameters |= __cpu_to_le32(WSM_HT_TX_MIXED); } if (tx_policy_renew) { pr_debug("[TX] TX policy renew.\n"); /* It's not so optimal to stop TX queues every now and then. * Better to reimplement task scheduling with * a counter. TODO. */ wsm_lock_tx_async(priv); cw1200_tx_queues_lock(priv); if (queue_work(priv->workqueue, &priv->tx_policy_upload_work) <= 0) { cw1200_tx_queues_unlock(priv); wsm_unlock_tx(priv); } } return 0; } static bool cw1200_tx_h_pm_state(struct cw1200_common *priv, struct cw1200_txinfo *t) { int was_buffered = 1; if (t->txpriv.link_id == CW1200_LINK_ID_AFTER_DTIM && !priv->buffered_multicasts) { priv->buffered_multicasts = true; if (priv->sta_asleep_mask) queue_work(priv->workqueue, &priv->multicast_start_work); } if (t->txpriv.raw_link_id && t->txpriv.tid < CW1200_MAX_TID) was_buffered = priv->link_id_db[t->txpriv.raw_link_id - 1].buffered[t->txpriv.tid]++; return !was_buffered; } /* ******************************************************************** */ void cw1200_tx(struct ieee80211_hw *dev, struct ieee80211_tx_control *control, struct sk_buff *skb) { struct cw1200_common *priv = dev->priv; struct cw1200_txinfo t = { .skb = skb, .queue = skb_get_queue_mapping(skb), .tx_info = IEEE80211_SKB_CB(skb), .hdr = (struct ieee80211_hdr *)skb->data, .txpriv.tid = CW1200_MAX_TID, .txpriv.rate_id = CW1200_INVALID_RATE_ID, }; struct ieee80211_sta *sta; struct wsm_tx *wsm; bool tid_update = 0; u8 flags = 0; int ret; if (priv->bh_error) goto drop; t.hdrlen = ieee80211_hdrlen(t.hdr->frame_control); t.da = ieee80211_get_DA(t.hdr); if (control) { t.sta = control->sta; t.sta_priv = (struct cw1200_sta_priv *)&t.sta->drv_priv; } if (WARN_ON(t.queue >= 4)) goto drop; ret = cw1200_tx_h_calc_link_ids(priv, &t); if (ret) goto drop; pr_debug("[TX] TX %d bytes (queue: %d, link_id: %d (%d)).\n", skb->len, t.queue, t.txpriv.link_id, t.txpriv.raw_link_id); cw1200_tx_h_pm(priv, &t); cw1200_tx_h_calc_tid(priv, &t); ret = cw1200_tx_h_crypt(priv, &t); if (ret) goto drop; ret = cw1200_tx_h_align(priv, &t, &flags); if (ret) goto drop; ret = cw1200_tx_h_action(priv, &t); if (ret) goto drop; wsm = cw1200_tx_h_wsm(priv, &t); if (!wsm) { ret = -ENOMEM; goto drop; } wsm->flags |= flags; cw1200_tx_h_bt(priv, &t, wsm); ret = cw1200_tx_h_rate_policy(priv, &t, wsm); if (ret) goto drop; rcu_read_lock(); sta = rcu_dereference(t.sta); spin_lock_bh(&priv->ps_state_lock); { tid_update = cw1200_tx_h_pm_state(priv, &t); BUG_ON(cw1200_queue_put(&priv->tx_queue[t.queue], t.skb, &t.txpriv)); } spin_unlock_bh(&priv->ps_state_lock); if (tid_update && sta) ieee80211_sta_set_buffered(sta, t.txpriv.tid, true); rcu_read_unlock(); cw1200_bh_wakeup(priv); return; drop: cw1200_skb_dtor(priv, skb, &t.txpriv); return; } /* ******************************************************************** */ static int cw1200_handle_action_rx(struct cw1200_common *priv, struct sk_buff *skb) { struct ieee80211_mgmt *mgmt = (void *)skb->data; /* Filter block ACK negotiation: fully controlled by firmware */ if (mgmt->u.action.category == WLAN_CATEGORY_BACK) return 1; return 0; } static int cw1200_handle_pspoll(struct cw1200_common *priv, struct sk_buff *skb) { struct ieee80211_sta *sta; struct ieee80211_pspoll *pspoll = (struct ieee80211_pspoll *)skb->data; int link_id = 0; u32 pspoll_mask = 0; int drop = 1; int i; if (priv->join_status != CW1200_JOIN_STATUS_AP) goto done; if (memcmp(priv->vif->addr, pspoll->bssid, ETH_ALEN)) goto done; rcu_read_lock(); sta = ieee80211_find_sta(priv->vif, pspoll->ta); if (sta) { struct cw1200_sta_priv *sta_priv; sta_priv = (struct cw1200_sta_priv *)&sta->drv_priv; link_id = sta_priv->link_id; pspoll_mask = BIT(sta_priv->link_id); } rcu_read_unlock(); if (!link_id) goto done; priv->pspoll_mask |= pspoll_mask; drop = 0; /* Do not report pspols if data for given link id is queued already. */ for (i = 0; i < 4; ++i) { if (cw1200_queue_get_num_queued(&priv->tx_queue[i], pspoll_mask)) { cw1200_bh_wakeup(priv); drop = 1; break; } } pr_debug("[RX] PSPOLL: %s\n", drop ? "local" : "fwd"); done: return drop; } /* ******************************************************************** */ void cw1200_tx_confirm_cb(struct cw1200_common *priv, int link_id, struct wsm_tx_confirm *arg) { u8 queue_id = cw1200_queue_get_queue_id(arg->packet_id); struct cw1200_queue *queue = &priv->tx_queue[queue_id]; struct sk_buff *skb; const struct cw1200_txpriv *txpriv; pr_debug("[TX] TX confirm: %d, %d.\n", arg->status, arg->ack_failures); if (priv->mode == NL80211_IFTYPE_UNSPECIFIED) { /* STA is stopped. */ return; } if (WARN_ON(queue_id >= 4)) return; if (arg->status) pr_debug("TX failed: %d.\n", arg->status); if ((arg->status == WSM_REQUEUE) && (arg->flags & WSM_TX_STATUS_REQUEUE)) { /* "Requeue" means "implicit suspend" */ struct wsm_suspend_resume suspend = { .link_id = link_id, .stop = 1, .multicast = !link_id, }; cw1200_suspend_resume(priv, &suspend); wiphy_warn(priv->hw->wiphy, "Requeue for link_id %d (try %d). STAs asleep: 0x%.8X\n", link_id, cw1200_queue_get_generation(arg->packet_id) + 1, priv->sta_asleep_mask); cw1200_queue_requeue(queue, arg->packet_id); spin_lock_bh(&priv->ps_state_lock); if (!link_id) { priv->buffered_multicasts = true; if (priv->sta_asleep_mask) { queue_work(priv->workqueue, &priv->multicast_start_work); } } spin_unlock_bh(&priv->ps_state_lock); } else if (!cw1200_queue_get_skb(queue, arg->packet_id, &skb, &txpriv)) { struct ieee80211_tx_info *tx = IEEE80211_SKB_CB(skb); int tx_count = arg->ack_failures; u8 ht_flags = 0; int i; if (cw1200_ht_greenfield(&priv->ht_info)) ht_flags |= IEEE80211_TX_RC_GREEN_FIELD; spin_lock(&priv->bss_loss_lock); if (priv->bss_loss_state && arg->packet_id == priv->bss_loss_confirm_id) { if (arg->status) { /* Recovery failed */ __cw1200_cqm_bssloss_sm(priv, 0, 0, 1); } else { /* Recovery succeeded */ __cw1200_cqm_bssloss_sm(priv, 0, 1, 0); } } spin_unlock(&priv->bss_loss_lock); if (!arg->status) { tx->flags |= IEEE80211_TX_STAT_ACK; ++tx_count; cw1200_debug_txed(priv); if (arg->flags & WSM_TX_STATUS_AGGREGATION) { /* Do not report aggregation to mac80211: * it confuses minstrel a lot. */ /* tx->flags |= IEEE80211_TX_STAT_AMPDU; */ cw1200_debug_txed_agg(priv); } } else { if (tx_count) ++tx_count; } for (i = 0; i < IEEE80211_TX_MAX_RATES; ++i) { if (tx->status.rates[i].count >= tx_count) { tx->status.rates[i].count = tx_count; break; } tx_count -= tx->status.rates[i].count; if (tx->status.rates[i].flags & IEEE80211_TX_RC_MCS) tx->status.rates[i].flags |= ht_flags; } for (++i; i < IEEE80211_TX_MAX_RATES; ++i) { tx->status.rates[i].count = 0; tx->status.rates[i].idx = -1; } /* Pull off any crypto trailers that we added on */ if (tx->control.hw_key) { skb_trim(skb, skb->len - tx->control.hw_key->icv_len); if (tx->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) skb_trim(skb, skb->len - 8); /* MIC space */ } cw1200_queue_remove(queue, arg->packet_id); } /* XXX TODO: Only wake if there are pending transmits.. */ cw1200_bh_wakeup(priv); } static void cw1200_notify_buffered_tx(struct cw1200_common *priv, struct sk_buff *skb, int link_id, int tid) { struct ieee80211_sta *sta; struct ieee80211_hdr *hdr; u8 *buffered; u8 still_buffered = 0; if (link_id && tid < CW1200_MAX_TID) { buffered = priv->link_id_db [link_id - 1].buffered; spin_lock_bh(&priv->ps_state_lock); if (!WARN_ON(!buffered[tid])) still_buffered = --buffered[tid]; spin_unlock_bh(&priv->ps_state_lock); if (!still_buffered && tid < CW1200_MAX_TID) { hdr = (struct ieee80211_hdr *)skb->data; rcu_read_lock(); sta = ieee80211_find_sta(priv->vif, hdr->addr1); if (sta) ieee80211_sta_set_buffered(sta, tid, false); rcu_read_unlock(); } } } void cw1200_skb_dtor(struct cw1200_common *priv, struct sk_buff *skb, const struct cw1200_txpriv *txpriv) { skb_pull(skb, txpriv->offset); if (txpriv->rate_id != CW1200_INVALID_RATE_ID) { cw1200_notify_buffered_tx(priv, skb, txpriv->raw_link_id, txpriv->tid); tx_policy_put(priv, txpriv->rate_id); } ieee80211_tx_status(priv->hw, skb); } void cw1200_rx_cb(struct cw1200_common *priv, struct wsm_rx *arg, int link_id, struct sk_buff **skb_p) { struct sk_buff *skb = *skb_p; struct ieee80211_rx_status *hdr = IEEE80211_SKB_RXCB(skb); struct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb->data; struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; struct cw1200_link_entry *entry = NULL; unsigned long grace_period; bool early_data = false; bool p2p = priv->vif && priv->vif->p2p; size_t hdrlen; hdr->flag = 0; if (priv->mode == NL80211_IFTYPE_UNSPECIFIED) { /* STA is stopped. */ goto drop; } if (link_id && link_id <= CW1200_MAX_STA_IN_AP_MODE) { entry = &priv->link_id_db[link_id - 1]; if (entry->status == CW1200_LINK_SOFT && ieee80211_is_data(frame->frame_control)) early_data = true; entry->timestamp = jiffies; } else if (p2p && ieee80211_is_action(frame->frame_control) && (mgmt->u.action.category == WLAN_CATEGORY_PUBLIC)) { pr_debug("[RX] Going to MAP&RESET link ID\n"); WARN_ON(work_pending(&priv->linkid_reset_work)); memcpy(&priv->action_frame_sa[0], ieee80211_get_SA(frame), ETH_ALEN); priv->action_linkid = 0; schedule_work(&priv->linkid_reset_work); } if (link_id && p2p && ieee80211_is_action(frame->frame_control) && (mgmt->u.action.category == WLAN_CATEGORY_PUBLIC)) { /* Link ID already exists for the ACTION frame. * Reset and Remap */ WARN_ON(work_pending(&priv->linkid_reset_work)); memcpy(&priv->action_frame_sa[0], ieee80211_get_SA(frame), ETH_ALEN); priv->action_linkid = link_id; schedule_work(&priv->linkid_reset_work); } if (arg->status) { if (arg->status == WSM_STATUS_MICFAILURE) { pr_debug("[RX] MIC failure.\n"); hdr->flag |= RX_FLAG_MMIC_ERROR; } else if (arg->status == WSM_STATUS_NO_KEY_FOUND) { pr_debug("[RX] No key found.\n"); goto drop; } else { pr_debug("[RX] Receive failure: %d.\n", arg->status); goto drop; } } if (skb->len < sizeof(struct ieee80211_pspoll)) { wiphy_warn(priv->hw->wiphy, "Mailformed SDU rx'ed. Size is lesser than IEEE header.\n"); goto drop; } if (ieee80211_is_pspoll(frame->frame_control)) if (cw1200_handle_pspoll(priv, skb)) goto drop; hdr->band = ((arg->channel_number & 0xff00) || (arg->channel_number > 14)) ? IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ; hdr->freq = ieee80211_channel_to_frequency( arg->channel_number, hdr->band); if (arg->rx_rate >= 14) { hdr->flag |= RX_FLAG_HT; hdr->rate_idx = arg->rx_rate - 14; } else if (arg->rx_rate >= 4) { hdr->rate_idx = arg->rx_rate - 2; } else { hdr->rate_idx = arg->rx_rate; } hdr->signal = (s8)arg->rcpi_rssi; hdr->antenna = 0; hdrlen = ieee80211_hdrlen(frame->frame_control); if (WSM_RX_STATUS_ENCRYPTION(arg->flags)) { size_t iv_len = 0, icv_len = 0; hdr->flag |= RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED; /* Oops... There is no fast way to ask mac80211 about * IV/ICV lengths. Even defineas are not exposed. */ switch (WSM_RX_STATUS_ENCRYPTION(arg->flags)) { case WSM_RX_STATUS_WEP: iv_len = 4 /* WEP_IV_LEN */; icv_len = 4 /* WEP_ICV_LEN */; break; case WSM_RX_STATUS_TKIP: iv_len = 8 /* TKIP_IV_LEN */; icv_len = 4 /* TKIP_ICV_LEN */ + 8 /*MICHAEL_MIC_LEN*/; hdr->flag |= RX_FLAG_MMIC_STRIPPED; break; case WSM_RX_STATUS_AES: iv_len = 8 /* CCMP_HDR_LEN */; icv_len = 8 /* CCMP_MIC_LEN */; break; case WSM_RX_STATUS_WAPI: iv_len = 18 /* WAPI_HDR_LEN */; icv_len = 16 /* WAPI_MIC_LEN */; break; default: pr_warn("Unknown encryption type %d\n", WSM_RX_STATUS_ENCRYPTION(arg->flags)); goto drop; } /* Firmware strips ICV in case of MIC failure. */ if (arg->status == WSM_STATUS_MICFAILURE) icv_len = 0; if (skb->len < hdrlen + iv_len + icv_len) { wiphy_warn(priv->hw->wiphy, "Malformed SDU rx'ed. Size is lesser than crypto headers.\n"); goto drop; } /* Remove IV, ICV and MIC */ skb_trim(skb, skb->len - icv_len); memmove(skb->data + iv_len, skb->data, hdrlen); skb_pull(skb, iv_len); } /* Remove TSF from the end of frame */ if (arg->flags & WSM_RX_STATUS_TSF_INCLUDED) { memcpy(&hdr->mactime, skb->data + skb->len - 8, 8); hdr->mactime = le64_to_cpu(hdr->mactime); if (skb->len >= 8) skb_trim(skb, skb->len - 8); } else { hdr->mactime = 0; } cw1200_debug_rxed(priv); if (arg->flags & WSM_RX_STATUS_AGGREGATE) cw1200_debug_rxed_agg(priv); if (ieee80211_is_action(frame->frame_control) && (arg->flags & WSM_RX_STATUS_ADDRESS1)) { if (cw1200_handle_action_rx(priv, skb)) return; } else if (ieee80211_is_beacon(frame->frame_control) && !arg->status && priv->vif && ether_addr_equal(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid)) { const u8 *tim_ie; u8 *ies = ((struct ieee80211_mgmt *) (skb->data))->u.beacon.variable; size_t ies_len = skb->len - (ies - (u8 *)(skb->data)); tim_ie = cfg80211_find_ie(WLAN_EID_TIM, ies, ies_len); if (tim_ie) { struct ieee80211_tim_ie *tim = (struct ieee80211_tim_ie *)&tim_ie[2]; if (priv->join_dtim_period != tim->dtim_period) { priv->join_dtim_period = tim->dtim_period; queue_work(priv->workqueue, &priv->set_beacon_wakeup_period_work); } } /* Disable beacon filter once we're associated... */ if (priv->disable_beacon_filter && (priv->vif->bss_conf.assoc || priv->vif->bss_conf.ibss_joined)) { priv->disable_beacon_filter = false; queue_work(priv->workqueue, &priv->update_filtering_work); } } /* Stay awake after frame is received to give * userspace chance to react and acquire appropriate * wakelock. */ if (ieee80211_is_auth(frame->frame_control)) grace_period = 5 * HZ; else if (ieee80211_is_deauth(frame->frame_control)) grace_period = 5 * HZ; else grace_period = 1 * HZ; cw1200_pm_stay_awake(&priv->pm_state, grace_period); if (early_data) { spin_lock_bh(&priv->ps_state_lock); /* Double-check status with lock held */ if (entry->status == CW1200_LINK_SOFT) skb_queue_tail(&entry->rx_queue, skb); else ieee80211_rx_irqsafe(priv->hw, skb); spin_unlock_bh(&priv->ps_state_lock); } else { ieee80211_rx_irqsafe(priv->hw, skb); } *skb_p = NULL; return; drop: /* TODO: update failure counters */ return; } /* ******************************************************************** */ /* Security */ int cw1200_alloc_key(struct cw1200_common *priv) { int idx; idx = ffs(~priv->key_map) - 1; if (idx < 0 || idx > WSM_KEY_MAX_INDEX) return -1; priv->key_map |= BIT(idx); priv->keys[idx].index = idx; return idx; } void cw1200_free_key(struct cw1200_common *priv, int idx) { BUG_ON(!(priv->key_map & BIT(idx))); memset(&priv->keys[idx], 0, sizeof(priv->keys[idx])); priv->key_map &= ~BIT(idx); } void cw1200_free_keys(struct cw1200_common *priv) { memset(&priv->keys, 0, sizeof(priv->keys)); priv->key_map = 0; } int cw1200_upload_keys(struct cw1200_common *priv) { int idx, ret = 0; for (idx = 0; idx <= WSM_KEY_MAX_INDEX; ++idx) if (priv->key_map & BIT(idx)) { ret = wsm_add_key(priv, &priv->keys[idx]); if (ret < 0) break; } return ret; } /* Workaround for WFD test case 6.1.10 */ void cw1200_link_id_reset(struct work_struct *work) { struct cw1200_common *priv = container_of(work, struct cw1200_common, linkid_reset_work); int temp_linkid; if (!priv->action_linkid) { /* In GO mode we can receive ACTION frames without a linkID */ temp_linkid = cw1200_alloc_link_id(priv, &priv->action_frame_sa[0]); WARN_ON(!temp_linkid); if (temp_linkid) { /* Make sure we execute the WQ */ flush_workqueue(priv->workqueue); /* Release the link ID */ spin_lock_bh(&priv->ps_state_lock); priv->link_id_db[temp_linkid - 1].prev_status = priv->link_id_db[temp_linkid - 1].status; priv->link_id_db[temp_linkid - 1].status = CW1200_LINK_RESET; spin_unlock_bh(&priv->ps_state_lock); wsm_lock_tx_async(priv); if (queue_work(priv->workqueue, &priv->link_id_work) <= 0) wsm_unlock_tx(priv); } } else { spin_lock_bh(&priv->ps_state_lock); priv->link_id_db[priv->action_linkid - 1].prev_status = priv->link_id_db[priv->action_linkid - 1].status; priv->link_id_db[priv->action_linkid - 1].status = CW1200_LINK_RESET_REMAP; spin_unlock_bh(&priv->ps_state_lock); wsm_lock_tx_async(priv); if (queue_work(priv->workqueue, &priv->link_id_work) <= 0) wsm_unlock_tx(priv); flush_workqueue(priv->workqueue); } } int cw1200_find_link_id(struct cw1200_common *priv, const u8 *mac) { int i, ret = 0; spin_lock_bh(&priv->ps_state_lock); for (i = 0; i < CW1200_MAX_STA_IN_AP_MODE; ++i) { if (!memcmp(mac, priv->link_id_db[i].mac, ETH_ALEN) && priv->link_id_db[i].status) { priv->link_id_db[i].timestamp = jiffies; ret = i + 1; break; } } spin_unlock_bh(&priv->ps_state_lock); return ret; } int cw1200_alloc_link_id(struct cw1200_common *priv, const u8 *mac) { int i, ret = 0; unsigned long max_inactivity = 0; unsigned long now = jiffies; spin_lock_bh(&priv->ps_state_lock); for (i = 0; i < CW1200_MAX_STA_IN_AP_MODE; ++i) { if (!priv->link_id_db[i].status) { ret = i + 1; break; } else if (priv->link_id_db[i].status != CW1200_LINK_HARD && !priv->tx_queue_stats.link_map_cache[i + 1]) { unsigned long inactivity = now - priv->link_id_db[i].timestamp; if (inactivity < max_inactivity) continue; max_inactivity = inactivity; ret = i + 1; } } if (ret) { struct cw1200_link_entry *entry = &priv->link_id_db[ret - 1]; pr_debug("[AP] STA added, link_id: %d\n", ret); entry->status = CW1200_LINK_RESERVE; memcpy(&entry->mac, mac, ETH_ALEN); memset(&entry->buffered, 0, CW1200_MAX_TID); skb_queue_head_init(&entry->rx_queue); wsm_lock_tx_async(priv); if (queue_work(priv->workqueue, &priv->link_id_work) <= 0) wsm_unlock_tx(priv); } else { wiphy_info(priv->hw->wiphy, "[AP] Early: no more link IDs available.\n"); } spin_unlock_bh(&priv->ps_state_lock); return ret; } void cw1200_link_id_work(struct work_struct *work) { struct cw1200_common *priv = container_of(work, struct cw1200_common, link_id_work); wsm_flush_tx(priv); cw1200_link_id_gc_work(&priv->link_id_gc_work.work); wsm_unlock_tx(priv); } void cw1200_link_id_gc_work(struct work_struct *work) { struct cw1200_common *priv = container_of(work, struct cw1200_common, link_id_gc_work.work); struct wsm_reset reset = { .reset_statistics = false, }; struct wsm_map_link map_link = { .link_id = 0, }; unsigned long now = jiffies; unsigned long next_gc = -1; long ttl; bool need_reset; u32 mask; int i; if (priv->join_status != CW1200_JOIN_STATUS_AP) return; wsm_lock_tx(priv); spin_lock_bh(&priv->ps_state_lock); for (i = 0; i < CW1200_MAX_STA_IN_AP_MODE; ++i) { need_reset = false; mask = BIT(i + 1); if (priv->link_id_db[i].status == CW1200_LINK_RESERVE || (priv->link_id_db[i].status == CW1200_LINK_HARD && !(priv->link_id_map & mask))) { if (priv->link_id_map & mask) { priv->sta_asleep_mask &= ~mask; priv->pspoll_mask &= ~mask; need_reset = true; } priv->link_id_map |= mask; if (priv->link_id_db[i].status != CW1200_LINK_HARD) priv->link_id_db[i].status = CW1200_LINK_SOFT; memcpy(map_link.mac_addr, priv->link_id_db[i].mac, ETH_ALEN); spin_unlock_bh(&priv->ps_state_lock); if (need_reset) { reset.link_id = i + 1; wsm_reset(priv, &reset); } map_link.link_id = i + 1; wsm_map_link(priv, &map_link); next_gc = min(next_gc, CW1200_LINK_ID_GC_TIMEOUT); spin_lock_bh(&priv->ps_state_lock); } else if (priv->link_id_db[i].status == CW1200_LINK_SOFT) { ttl = priv->link_id_db[i].timestamp - now + CW1200_LINK_ID_GC_TIMEOUT; if (ttl <= 0) { need_reset = true; priv->link_id_db[i].status = CW1200_LINK_OFF; priv->link_id_map &= ~mask; priv->sta_asleep_mask &= ~mask; priv->pspoll_mask &= ~mask; eth_zero_addr(map_link.mac_addr); spin_unlock_bh(&priv->ps_state_lock); reset.link_id = i + 1; wsm_reset(priv, &reset); spin_lock_bh(&priv->ps_state_lock); } else { next_gc = min_t(unsigned long, next_gc, ttl); } } else if (priv->link_id_db[i].status == CW1200_LINK_RESET || priv->link_id_db[i].status == CW1200_LINK_RESET_REMAP) { int status = priv->link_id_db[i].status; priv->link_id_db[i].status = priv->link_id_db[i].prev_status; priv->link_id_db[i].timestamp = now; reset.link_id = i + 1; spin_unlock_bh(&priv->ps_state_lock); wsm_reset(priv, &reset); if (status == CW1200_LINK_RESET_REMAP) { memcpy(map_link.mac_addr, priv->link_id_db[i].mac, ETH_ALEN); map_link.link_id = i + 1; wsm_map_link(priv, &map_link); next_gc = min(next_gc, CW1200_LINK_ID_GC_TIMEOUT); } spin_lock_bh(&priv->ps_state_lock); } if (need_reset) { skb_queue_purge(&priv->link_id_db[i].rx_queue); pr_debug("[AP] STA removed, link_id: %d\n", reset.link_id); } } spin_unlock_bh(&priv->ps_state_lock); if (next_gc != -1) queue_delayed_work(priv->workqueue, &priv->link_id_gc_work, next_gc); wsm_unlock_tx(priv); }
{ "pile_set_name": "Github" }
package com.funtl.myshop.plus.cloud.tests; import java.util.Date; import com.funtl.myshop.plus.cloud.dto.UmsAdminLoginLogDTO; import com.funtl.myshop.plus.commons.utils.MapperUtils; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class MessageCloudTests { @Test public void testPrintln() throws Exception { UmsAdminLoginLogDTO dto = new UmsAdminLoginLogDTO(); dto.setAdminId(1L); dto.setCreateTime(new Date()); dto.setIp("0.0.0.0"); dto.setAddress("0.0.0.0"); dto.setUserAgent("0.0.0.0"); System.out.println(MapperUtils.obj2json(dto)); } }
{ "pile_set_name": "Github" }
import { assert } from '@pollyjs/utils'; const STOP_PROPAGATION = Symbol(); export default class Event { constructor(type, props) { assert( `Invalid type provided. Expected a non-empty string, received: "${typeof type}".`, type && typeof type === 'string' ); Object.defineProperty(this, 'type', { value: type }); // eslint-disable-next-line no-restricted-properties Object.assign(this, props || {}); this[STOP_PROPAGATION] = false; } stopPropagation() { this[STOP_PROPAGATION] = true; } get shouldStopPropagating() { return this[STOP_PROPAGATION]; } }
{ "pile_set_name": "Github" }
=head1 new >> name L<Titled|/new E<gt>E<gt> name>
{ "pile_set_name": "Github" }
import PropTypes from 'prop-types'; export default PropTypes.shape({ trackEvent: PropTypes.func, getTrackingData: PropTypes.func, });
{ "pile_set_name": "Github" }
import classNames from 'classnames' import PropTypes, { InferProps } from 'prop-types' import { AtMessageProps, AtMessageState } from 'types/message' import { View } from '@tarojs/components' import Taro from '@tarojs/taro' import AtComponent from '../../common/component' export default class AtMessage extends AtComponent< AtMessageProps, AtMessageState > { public static defaultProps: AtMessageProps public static propTypes: InferProps<AtMessageProps> private _timer: NodeJS.Timeout | number | null public constructor(props: AtMessageProps) { super(props) this.state = { _isOpened: false, _message: '', _type: 'info', _duration: 3000 } this._timer = null } private bindMessageListener(): void { Taro.eventCenter.on('atMessage', (options = {}) => { const { message, type, duration } = options const newState = { _isOpened: true, _message: message, _type: type, _duration: duration || this.state._duration } this.setState(newState, () => { clearTimeout(this._timer as number) this._timer = setTimeout(() => { this.setState({ _isOpened: false }) }, this.state._duration) }) }) // 绑定函数 Taro.atMessage = Taro.eventCenter.trigger.bind( Taro.eventCenter, 'atMessage' ) } public componentDidShow(): void { this.bindMessageListener() } public componentDidMount(): void { this.bindMessageListener() } public componentDidHide(): void { Taro.eventCenter.off('atMessage') } public componentWillUnmount(): void { Taro.eventCenter.off('atMessage') } public render(): JSX.Element { const { className, customStyle } = this.props const { _message, _isOpened, _type } = this.state const rootCls = classNames( { 'at-message': true, 'at-message--show': _isOpened, 'at-message--hidden': !_isOpened }, `at-message--${_type}`, className ) return ( <View className={rootCls} style={customStyle}> {_message} </View> ) } } AtMessage.defaultProps = { customStyle: '', className: '' } AtMessage.propTypes = { customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]) }
{ "pile_set_name": "Github" }
/** * @license Highcharts JS v4.1.8 (2015-08-20) * Client side exporting module * * (c) 2015 Torstein Honsi / Oystein Moseng * * License: www.highcharts.com/license */ // JSLint options: /*global Highcharts, HighchartsAdapter, document, window, Blob, MSBlobBuilder */ (function (Highcharts) { // Dummy object so we can reuse our canvas-tools.js without errors Highcharts.CanVGRenderer = {}; /** * Add a new method to the Chart object to perform a local download */ Highcharts.Chart.prototype.exportChartLocal = function (exportingOptions, chartOptions) { var chart = this, options = Highcharts.merge(chart.options.exporting, exportingOptions), webKit = navigator.userAgent.indexOf('WebKit') > -1 && navigator.userAgent.indexOf("Chrome") < 0, // Webkit and not chrome scale = options.scale || 2, chartCopyContainer, domurl = window.URL || window.webkitURL || window, images, imagesEmbedded = 0, el, i, l, fallbackToExportServer = function () { if (options.fallbackToExportServer === false) { throw 'Fallback to export server disabled'; } chart.exportChart(options); }, // Get data:URL from image URL // Pass in callbacks to handle results. finallyCallback is always called at the end of the process. Supplying this callback is optional. // All callbacks receive two arguments: imageURL, and callbackArgs. callbackArgs is used only by callbacks and can contain whatever. imageToDataUrl = function (imageURL, callbackArgs, successCallback, taintedCallback, noCanvasSupportCallback, failedLoadCallback, finallyCallback) { var img = new Image(); if (!webKit) { img.crossOrigin = 'Anonymous'; // For some reason Safari chokes on this attribute } img.onload = function () { var canvas = document.createElement('canvas'), ctx = canvas.getContext && canvas.getContext('2d'), dataURL; if (!ctx) { noCanvasSupportCallback(imageURL, callbackArgs); } else { canvas.height = img.height * scale; canvas.width = img.width * scale; ctx.drawImage(img, 0, 0, canvas.width, canvas.height); // Now we try to get the contents of the canvas. try { dataURL = canvas.toDataURL(); successCallback(dataURL, callbackArgs); } catch (e) { // Failed - either tainted canvas or something else went horribly wrong if (e.name === 'SecurityError' || e.name === 'SECURITY_ERR' || e.message === 'SecurityError') { taintedCallback(imageURL, callbackArgs); } else { throw e; } } } if (finallyCallback) { finallyCallback(imageURL, callbackArgs); } }; img.onerror = function () { failedLoadCallback(imageURL, callbackArgs); if (finallyCallback) { finallyCallback(imageURL, callbackArgs); } }; img.src = imageURL; }, // Get blob URL from SVG code. Falls back to normal data URI. svgToDataUrl = function (svg) { try { // Safari requires data URI since it doesn't allow navigation to blob URLs if (!webKit) { return domurl.createObjectURL(new Blob([svg], { type: 'image/svg+xml;charset-utf-16'})); } } catch (e) { // Ignore } return 'data:image/svg+xml;charset=UTF-8,' + encodeURIComponent(svg); }, // Download contents by dataURL/blob download = function (dataURL, extension) { var a = document.createElement('a'), filename = (options.filename || 'chart') + '.' + extension, windowRef; // IE specific blob implementation if (navigator.msSaveOrOpenBlob) { navigator.msSaveOrOpenBlob(dataURL, filename); return; } // Try HTML5 download attr if supported if (typeof a.download !== 'undefined') { a.href = dataURL; a.download = filename; // HTML5 download attribute a.target = '_blank'; document.body.appendChild(a); a.click(); document.body.removeChild(a); } else { // No download attr, just opening data URI try { windowRef = window.open(dataURL, 'chart'); if (typeof windowRef === 'undefined' || windowRef === null) { throw 1; } } catch (e) { // window.open failed, trying location.href window.location.href = dataURL; } } }, // Get data URL to an image of the chart and call download on it initiateDownload = function () { var svgurl, blob, svg = chart.sanitizeSVG(chartCopyContainer.innerHTML); // SVG of chart copy // Initiate download depending on file type if (options && options.type === 'image/svg+xml') { // SVG download. In this case, we want to use Microsoft specific Blob if available try { if (navigator.msSaveOrOpenBlob) { blob = new MSBlobBuilder(); blob.append(svg); svgurl = blob.getBlob('image/svg+xml'); } else { svgurl = svgToDataUrl(svg); } download(svgurl, 'svg'); } catch (e) { fallbackToExportServer(); } } else { // PNG download - create bitmap from SVG // First, try to get PNG by rendering on canvas svgurl = svgToDataUrl(svg); imageToDataUrl(svgurl, { /* args */ }, function (imageURL) { // Success try { download(imageURL, 'png'); } catch (e) { fallbackToExportServer(); } }, function () { // Failed due to tainted canvas // Create new and untainted canvas var canvas = document.createElement('canvas'), ctx = canvas.getContext('2d'), imageWidth = svg.match(/^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale, imageHeight = svg.match(/^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale, downloadWithCanVG = function () { ctx.drawSvg(svg, 0, 0, imageWidth, imageHeight); try { download(navigator.msSaveOrOpenBlob ? canvas.msToBlob() : canvas.toDataURL('image/png'), 'png'); } catch (e) { fallbackToExportServer(); } }; canvas.width = imageWidth; canvas.height = imageHeight; if (window.canvg) { // Use preloaded canvg downloadWithCanVG(); } else { // Must load canVG first chart.showLoading(); HighchartsAdapter.getScript(Highcharts.getOptions().global.canvasToolsURL, function () { chart.hideLoading(); downloadWithCanVG(); }); } }, // No canvas support fallbackToExportServer, // Failed to load image fallbackToExportServer, // Finally function () { try { domurl.revokeObjectURL(svgurl); } catch (e) { // Ignore } }); } }; // Hook into getSVG to get a copy of the chart copy's container Highcharts.wrap(Highcharts.Chart.prototype, 'getChartHTML', function (proceed) { chartCopyContainer = this.container.cloneNode(true); return proceed.apply(this, Array.prototype.slice.call(arguments, 1)); }); // Trigger hook to get chart copy chart.getSVGForExport(options, chartOptions); images = chartCopyContainer.getElementsByTagName('image'); try { // If there are no images to embed, just go ahead and start the download process if (!images.length) { initiateDownload(); } // Success handler, we converted image to base64! function embeddedSuccess(imageURL, callbackArgs) { ++imagesEmbedded; // Change image href in chart copy callbackArgs.imageElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', imageURL); // Start download when done with the last image if (imagesEmbedded === images.length) { initiateDownload(); } } // Go through the images we want to embed for (i = 0, l = images.length; i < l; ++i) { el = images[i]; imageToDataUrl(el.getAttributeNS('http://www.w3.org/1999/xlink', 'href'), { imageElement: el }, embeddedSuccess, // Tainted canvas fallbackToExportServer, // No canvas support fallbackToExportServer, // Failed to load source fallbackToExportServer ); } } catch (e) { fallbackToExportServer(); } }; // Extend the default options to use the local exporter logic Highcharts.getOptions().exporting.buttons.contextButton.menuItems = [{ textKey: 'printChart', onclick: function () { this.print(); } }, { separator: true }, { textKey: 'downloadPNG', onclick: function () { this.exportChartLocal(); } }, { textKey: 'downloadSVG', onclick: function () { this.exportChartLocal({ type: 'image/svg+xml' }); } }]; }(Highcharts));
{ "pile_set_name": "Github" }
parse_cookie_value { cookies: "token1=abc123; = " cookies: "token2=abc123; " cookies: "; token3=abc123;" cookies: "=; token4=\"abc123\"" key: "token4" }
{ "pile_set_name": "Github" }
**This airport has been automatically generated** We have no information about 36AZ[*] airport other than its name, ICAO and location (US). This airport will have to be done from scratch, which includes adding runways, taxiways, parking locations, boundaries... Good luck if you decide to do this airport!
{ "pile_set_name": "Github" }
<?php /** * Auto-generated class. PERL syntax highlighting * * This highlighter is EXPERIMENTAL, so that it may work incorrectly. * Most rules were created by Mariusz Jakubowski, and extended by me. * My knowledge of Perl is poor, and Perl syntax seems too * complicated to me. * * PHP version 4 and 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to [email protected] so we can mail you a copy immediately. * * @copyright 2004-2006 Andrey Demenev * @license http://www.php.net/license/3_0.txt PHP License * @link http://pear.php.net/package/Text_Highlighter * @category Text * @package Text_Highlighter * @version generated from: : perl.xml 21 2005-02-04 07:08:05Z andrey * @author Mariusz 'kg' Jakubowski <[email protected]> * @author Andrey Demenev <[email protected]> * */ /** * @ignore */ require_once 'Text/Highlighter.php'; /** * Auto-generated class. PERL syntax highlighting * * @author Mariusz 'kg' Jakubowski <[email protected]> * @author Andrey Demenev <[email protected]> * @category Text * @package Text_Highlighter * @copyright 2004-2006 Andrey Demenev * @license http://www.php.net/license/3_0.txt PHP License * @version Release: @package_version@ * @link http://pear.php.net/package/Text_Highlighter */ class Text_Highlighter_PERL extends Text_Highlighter { var $_language = 'perl'; /** * PHP4 Compatible Constructor * * @param array $options * @access public */ function Text_Highlighter_PERL($options=array()) { $this->__construct($options); } /** * Constructor * * @param array $options * @access public */ function __construct($options=array()) { $this->_options = $options; $this->_regs = array ( -1 => '/((?m)^(#!)(.*))|((?m)^=\\w+)|(\\{)|(\\()|(\\[)|((use)\\s+([\\w:]*))|([& ](\\w{2,}::)+\\w{2,})|((?Us)\\b(q[wq]\\s*((\\{)|(\\()|(\\[)|(\\<)|([\\W\\S])))(?=(.*)((?(3)\\})(?(4)\\))(?(5)\\])(?(6)\\>)(?(7)\\7))))|((?Us)\\b(q\\s*((\\{)|(\\()|(\\[)|(\\<)|([\\W\\S])))(?=(.*)((?(3)\\})(?(4)\\))(?(5)\\])(?(6)\\>)(?(7)\\7))))|(#.*)|((?x)(s|tr) ([|#~`!@$%^&*-+=\\\\;:\'",.\\/?]) ((\\\\.|[^\\\\])*?) (\\2)((\\\\.|[^\\\\])*?)(\\2[ecgimosx]*))|((?x)(m) ([|#~`!@$%^&*-+=\\\\;:\'",.\\/?]) ((\\\\.|[^\\\\])*?) (\\2[ecgimosx]*))|( \\/)|(\\$#?[1-9\'`@!])|((?i)(\\$#?|[@%*])([a-z1-9_]+::)*([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)\\$([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)(&|\\w+)\'[\\w_\']+\\b)|((?i)(\\{)([a-z1-9]+)(\\}))|((?i)[\\$@%]#?\\{[a-z1-9]+\\})|(`)|(\')|(")|((?i)[a-z_]\\w*)|(\\d*\\.?\\d+)/', 0 => '//', 1 => '/((?m)^(#!)(.*))|((?m)^=\\w+)|(\\{)|(\\()|(\\[)|((use)\\s+([\\w:]*))|([& ](\\w{2,}::)+\\w{2,})|((?Us)\\b(q[wq]\\s*((\\{)|(\\()|(\\[)|(\\<)|([\\W\\S])))(?=(.*)((?(3)\\})(?(4)\\))(?(5)\\])(?(6)\\>)(?(7)\\7))))|((?Us)\\b(q\\s*((\\{)|(\\()|(\\[)|(\\<)|([\\W\\S])))(?=(.*)((?(3)\\})(?(4)\\))(?(5)\\])(?(6)\\>)(?(7)\\7))))|(#.*)|((?x)(s|tr) ([|#~`!@$%^&*-+=\\\\;:\'",.\\/?]) ((\\\\.|[^\\\\])*?) (\\2)((\\\\.|[^\\\\])*?)(\\2[ecgimosx]*))|((?x)(m) ([|#~`!@$%^&*-+=\\\\;:\'",.\\/?]) ((\\\\.|[^\\\\])*?) (\\2[ecgimosx]*))|( \\/)|(\\$#?[1-9\'`@!])|((?i)(\\$#?|[@%*])([a-z1-9_]+::)*([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)\\$([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)(&|\\w+)\'[\\w_\']+\\b)|((?i)(\\{)([a-z1-9]+)(\\}))|((?i)[\\$@%]#?\\{[a-z1-9]+\\})|(`)|(\')|(")|((?i)[a-z_]\\w*)|(\\d*\\.?\\d+)/', 2 => '/((?m)^(#!)(.*))|((?m)^=\\w+)|(\\{)|(\\()|(\\[)|((use)\\s+([\\w:]*))|([& ](\\w{2,}::)+\\w{2,})|((?Us)\\b(q[wq]\\s*((\\{)|(\\()|(\\[)|(\\<)|([\\W\\S])))(?=(.*)((?(3)\\})(?(4)\\))(?(5)\\])(?(6)\\>)(?(7)\\7))))|((?Us)\\b(q\\s*((\\{)|(\\()|(\\[)|(\\<)|([\\W\\S])))(?=(.*)((?(3)\\})(?(4)\\))(?(5)\\])(?(6)\\>)(?(7)\\7))))|(#.*)|((?x)(s|tr) ([|#~`!@$%^&*-+=\\\\;:\'",.\\/?]) ((\\\\.|[^\\\\])*?) (\\2)((\\\\.|[^\\\\])*?)(\\2[ecgimosx]*))|((?x)(m) ([|#~`!@$%^&*-+=\\\\;:\'",.\\/?]) ((\\\\.|[^\\\\])*?) (\\2[ecgimosx]*))|( \\/)|((?i)([a-z1-9_]+)(\\s*=>))|(\\$#?[1-9\'`@!])|((?i)(\\$#?|[@%*])([a-z1-9_]+::)*([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)\\$([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)(&|\\w+)\'[\\w_\']+\\b)|((?i)(\\{)([a-z1-9]+)(\\}))|((?i)[\\$@%]#?\\{[a-z1-9]+\\})|(`)|(\')|(")|((?i)[a-z_]\\w*)|(\\d*\\.?\\d+)/', 3 => '/((?m)^(#!)(.*))|((?m)^=\\w+)|(\\{)|(\\()|(\\[)|((use)\\s+([\\w:]*))|([& ](\\w{2,}::)+\\w{2,})|((?Us)\\b(q[wq]\\s*((\\{)|(\\()|(\\[)|(\\<)|([\\W\\S])))(?=(.*)((?(3)\\})(?(4)\\))(?(5)\\])(?(6)\\>)(?(7)\\7))))|((?Us)\\b(q\\s*((\\{)|(\\()|(\\[)|(\\<)|([\\W\\S])))(?=(.*)((?(3)\\})(?(4)\\))(?(5)\\])(?(6)\\>)(?(7)\\7))))|(#.*)|((?x)(s|tr) ([|#~`!@$%^&*-+=\\\\;:\'",.\\/?]) ((\\\\.|[^\\\\])*?) (\\2)((\\\\.|[^\\\\])*?)(\\2[ecgimosx]*))|((?x)(m) ([|#~`!@$%^&*-+=\\\\;:\'",.\\/?]) ((\\\\.|[^\\\\])*?) (\\2[ecgimosx]*))|( \\/)|(\\$#?[1-9\'`@!])|((?i)(\\$#?|[@%*])([a-z1-9_]+::)*([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)\\$([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)(&|\\w+)\'[\\w_\']+\\b)|((?i)(\\{)([a-z1-9]+)(\\}))|((?i)[\\$@%]#?\\{[a-z1-9]+\\})|(`)|(\')|(")|((?i)[a-z_]\\w*)|(\\d*\\.?\\d+)/', 4 => '/(\\$#?[1-9\'`@!])|((?i)\\$([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)[\\$@%]#?\\{[a-z1-9]+\\})|(\\\\[\\\\"\'`tnr\\$\\{@])/', 5 => '/(\\\\\\\\|\\\\"|\\\\\'|\\\\`)/', 6 => '/(\\\\\\/)/', 7 => '/(\\$#?[1-9\'`@!])|((?i)\\$([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)[\\$@%]#?\\{[a-z1-9]+\\})|(\\\\\\\\|\\\\"|\\\\\'|\\\\`)/', 8 => '/(\\\\\\\\|\\\\"|\\\\\'|\\\\`)/', 9 => '/(\\$#?[1-9\'`@!])|((?i)\\$([a-z1-9_]+|\\^(?-i)[A-Z]?(?i)))|((?i)[\\$@%]#?\\{[a-z1-9]+\\})|(\\\\[\\\\"\'`tnr\\$\\{@])/', ); $this->_counts = array ( -1 => array ( 0 => 2, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 2, 6 => 1, 7 => 9, 8 => 9, 9 => 0, 10 => 8, 11 => 5, 12 => 0, 13 => 0, 14 => 3, 15 => 1, 16 => 1, 17 => 3, 18 => 0, 19 => 0, 20 => 0, 21 => 0, 22 => 0, 23 => 0, ), 0 => array ( ), 1 => array ( 0 => 2, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 2, 6 => 1, 7 => 9, 8 => 9, 9 => 0, 10 => 8, 11 => 5, 12 => 0, 13 => 0, 14 => 3, 15 => 1, 16 => 1, 17 => 3, 18 => 0, 19 => 0, 20 => 0, 21 => 0, 22 => 0, 23 => 0, ), 2 => array ( 0 => 2, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 2, 6 => 1, 7 => 9, 8 => 9, 9 => 0, 10 => 8, 11 => 5, 12 => 0, 13 => 2, 14 => 0, 15 => 3, 16 => 1, 17 => 1, 18 => 3, 19 => 0, 20 => 0, 21 => 0, 22 => 0, 23 => 0, 24 => 0, ), 3 => array ( 0 => 2, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 2, 6 => 1, 7 => 9, 8 => 9, 9 => 0, 10 => 8, 11 => 5, 12 => 0, 13 => 0, 14 => 3, 15 => 1, 16 => 1, 17 => 3, 18 => 0, 19 => 0, 20 => 0, 21 => 0, 22 => 0, 23 => 0, ), 4 => array ( 0 => 0, 1 => 1, 2 => 0, 3 => 0, ), 5 => array ( 0 => 0, ), 6 => array ( 0 => 0, ), 7 => array ( 0 => 0, 1 => 1, 2 => 0, 3 => 0, ), 8 => array ( 0 => 0, ), 9 => array ( 0 => 0, 1 => 1, 2 => 0, 3 => 0, ), ); $this->_delim = array ( -1 => array ( 0 => '', 1 => 'comment', 2 => 'brackets', 3 => 'brackets', 4 => 'brackets', 5 => '', 6 => '', 7 => 'quotes', 8 => 'quotes', 9 => '', 10 => '', 11 => '', 12 => 'quotes', 13 => '', 14 => '', 15 => '', 16 => '', 17 => '', 18 => '', 19 => 'quotes', 20 => 'quotes', 21 => 'quotes', 22 => '', 23 => '', ), 0 => array ( ), 1 => array ( 0 => '', 1 => 'comment', 2 => 'brackets', 3 => 'brackets', 4 => 'brackets', 5 => '', 6 => '', 7 => 'quotes', 8 => 'quotes', 9 => '', 10 => '', 11 => '', 12 => 'quotes', 13 => '', 14 => '', 15 => '', 16 => '', 17 => '', 18 => '', 19 => 'quotes', 20 => 'quotes', 21 => 'quotes', 22 => '', 23 => '', ), 2 => array ( 0 => '', 1 => 'comment', 2 => 'brackets', 3 => 'brackets', 4 => 'brackets', 5 => '', 6 => '', 7 => 'quotes', 8 => 'quotes', 9 => '', 10 => '', 11 => '', 12 => 'quotes', 13 => '', 14 => '', 15 => '', 16 => '', 17 => '', 18 => '', 19 => '', 20 => 'quotes', 21 => 'quotes', 22 => 'quotes', 23 => '', 24 => '', ), 3 => array ( 0 => '', 1 => 'comment', 2 => 'brackets', 3 => 'brackets', 4 => 'brackets', 5 => '', 6 => '', 7 => 'quotes', 8 => 'quotes', 9 => '', 10 => '', 11 => '', 12 => 'quotes', 13 => '', 14 => '', 15 => '', 16 => '', 17 => '', 18 => '', 19 => 'quotes', 20 => 'quotes', 21 => 'quotes', 22 => '', 23 => '', ), 4 => array ( 0 => '', 1 => '', 2 => '', 3 => '', ), 5 => array ( 0 => '', ), 6 => array ( 0 => '', ), 7 => array ( 0 => '', 1 => '', 2 => '', 3 => '', ), 8 => array ( 0 => '', ), 9 => array ( 0 => '', 1 => '', 2 => '', 3 => '', ), ); $this->_inner = array ( -1 => array ( 0 => 'special', 1 => 'comment', 2 => 'code', 3 => 'code', 4 => 'code', 5 => 'special', 6 => 'special', 7 => 'string', 8 => 'string', 9 => 'comment', 10 => 'string', 11 => 'string', 12 => 'string', 13 => 'var', 14 => 'var', 15 => 'var', 16 => 'var', 17 => 'var', 18 => 'var', 19 => 'string', 20 => 'string', 21 => 'string', 22 => 'identifier', 23 => 'number', ), 0 => array ( ), 1 => array ( 0 => 'special', 1 => 'comment', 2 => 'code', 3 => 'code', 4 => 'code', 5 => 'special', 6 => 'special', 7 => 'string', 8 => 'string', 9 => 'comment', 10 => 'string', 11 => 'string', 12 => 'string', 13 => 'var', 14 => 'var', 15 => 'var', 16 => 'var', 17 => 'var', 18 => 'var', 19 => 'string', 20 => 'string', 21 => 'string', 22 => 'identifier', 23 => 'number', ), 2 => array ( 0 => 'special', 1 => 'comment', 2 => 'code', 3 => 'code', 4 => 'code', 5 => 'special', 6 => 'special', 7 => 'string', 8 => 'string', 9 => 'comment', 10 => 'string', 11 => 'string', 12 => 'string', 13 => 'string', 14 => 'var', 15 => 'var', 16 => 'var', 17 => 'var', 18 => 'var', 19 => 'var', 20 => 'string', 21 => 'string', 22 => 'string', 23 => 'identifier', 24 => 'number', ), 3 => array ( 0 => 'special', 1 => 'comment', 2 => 'code', 3 => 'code', 4 => 'code', 5 => 'special', 6 => 'special', 7 => 'string', 8 => 'string', 9 => 'comment', 10 => 'string', 11 => 'string', 12 => 'string', 13 => 'var', 14 => 'var', 15 => 'var', 16 => 'var', 17 => 'var', 18 => 'var', 19 => 'string', 20 => 'string', 21 => 'string', 22 => 'identifier', 23 => 'number', ), 4 => array ( 0 => 'var', 1 => 'var', 2 => 'var', 3 => 'special', ), 5 => array ( 0 => 'special', ), 6 => array ( 0 => 'string', ), 7 => array ( 0 => 'var', 1 => 'var', 2 => 'var', 3 => 'special', ), 8 => array ( 0 => 'special', ), 9 => array ( 0 => 'var', 1 => 'var', 2 => 'var', 3 => 'special', ), ); $this->_end = array ( 0 => '/(?m)^=cut[^\\n]*/', 1 => '/\\}/', 2 => '/\\)/', 3 => '/\\]/', 4 => '/%b2%/', 5 => '/%b2%/', 6 => '/\\/[cgimosx]*/', 7 => '/`/', 8 => '/\'/', 9 => '/"/', ); $this->_states = array ( -1 => array ( 0 => -1, 1 => 0, 2 => 1, 3 => 2, 4 => 3, 5 => -1, 6 => -1, 7 => 4, 8 => 5, 9 => -1, 10 => -1, 11 => -1, 12 => 6, 13 => -1, 14 => -1, 15 => -1, 16 => -1, 17 => -1, 18 => -1, 19 => 7, 20 => 8, 21 => 9, 22 => -1, 23 => -1, ), 0 => array ( ), 1 => array ( 0 => -1, 1 => 0, 2 => 1, 3 => 2, 4 => 3, 5 => -1, 6 => -1, 7 => 4, 8 => 5, 9 => -1, 10 => -1, 11 => -1, 12 => 6, 13 => -1, 14 => -1, 15 => -1, 16 => -1, 17 => -1, 18 => -1, 19 => 7, 20 => 8, 21 => 9, 22 => -1, 23 => -1, ), 2 => array ( 0 => -1, 1 => 0, 2 => 1, 3 => 2, 4 => 3, 5 => -1, 6 => -1, 7 => 4, 8 => 5, 9 => -1, 10 => -1, 11 => -1, 12 => 6, 13 => -1, 14 => -1, 15 => -1, 16 => -1, 17 => -1, 18 => -1, 19 => -1, 20 => 7, 21 => 8, 22 => 9, 23 => -1, 24 => -1, ), 3 => array ( 0 => -1, 1 => 0, 2 => 1, 3 => 2, 4 => 3, 5 => -1, 6 => -1, 7 => 4, 8 => 5, 9 => -1, 10 => -1, 11 => -1, 12 => 6, 13 => -1, 14 => -1, 15 => -1, 16 => -1, 17 => -1, 18 => -1, 19 => 7, 20 => 8, 21 => 9, 22 => -1, 23 => -1, ), 4 => array ( 0 => -1, 1 => -1, 2 => -1, 3 => -1, ), 5 => array ( 0 => -1, ), 6 => array ( 0 => -1, ), 7 => array ( 0 => -1, 1 => -1, 2 => -1, 3 => -1, ), 8 => array ( 0 => -1, ), 9 => array ( 0 => -1, 1 => -1, 2 => -1, 3 => -1, ), ); $this->_keywords = array ( -1 => array ( 0 => array ( ), 1 => -1, 2 => -1, 3 => -1, 4 => -1, 5 => array ( ), 6 => array ( ), 7 => -1, 8 => -1, 9 => array ( ), 10 => array ( ), 11 => array ( ), 12 => -1, 13 => array ( ), 14 => array ( ), 15 => array ( ), 16 => array ( ), 17 => array ( ), 18 => array ( ), 19 => -1, 20 => -1, 21 => -1, 22 => array ( 'reserved' => '/^(abs|accept|alarm|atan2|bind|binmode|bless|caller|chdir|chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|continue|cos|crypt|dbmclose|dbmopen|defined|delete|die|do|dump|each|endgrent|endhostent|endnetent|endprotoent|endpwent|endservent|eof|eval|exec|exists|exit|exp|fcntl|fileno|flock|fork|format|formline|getc|getgrent|getgrgid|getgrnam|gethostbyaddr|gethostbyname|gethostent|getlogin|getnetbyaddr|getnetbyname|getnetent|getpeername|getpgrp|getppid|getpriority|getprotobyname|getprotobynumber|getprotoent|getpwent|getpwnam|getpwuid|getservbyname|getservbyport|getservent|getsockname|getsockopt|glob|gmtime|goto|grep|hex|import|index|int|ioctl|join|keys|kill|last|lc|lcfirst|length|link|listen|local|localtime|lock|log|lstat|map|mkdir|msgctl|msgget|msgrcv|msgsnd|my|next|no|oct|open|opendir|ord|our|pack|package|pipe|pop|pos|print|printf|prototype|push|quotemeta|rand|read|readdir|readline|readlink|readpipe|recv|redo|ref|rename|require|reset|return|reverse|rewinddir|rindex|rmdir|scalar|seek|seekdir|select|semctl|semget|semop|send|setgrent|sethostent|setnetent|setpgrp|setpriority|setprotoent|setpwent|setservent|setsockopt|shift|shmctl|shmget|shmread|shmwrite|shutdown|sin|sleep|socket|socketpair|sort|splice|split|sprintf|sqrt|srand|stat|study|sub|substr|symlink|syscall|sysopen|sysread|sysseek|system|syswrite|tell|telldir|tie|tied|time|times|truncate|uc|ucfirst|umask|undef|unlink|unpack|unshift|untie|use|utime|values|vec|wait|waitpid|wantarray|warn|write|y)$/', 'missingreserved' => '/^(new)$/', 'flowcontrol' => '/^(if|else|elsif|while|unless|for|foreach|until|do|continue|not|or|and|eq|ne|gt|lt)$/', ), 23 => array ( ), ), 0 => array ( ), 1 => array ( 0 => array ( ), 1 => -1, 2 => -1, 3 => -1, 4 => -1, 5 => array ( ), 6 => array ( ), 7 => -1, 8 => -1, 9 => array ( ), 10 => array ( ), 11 => array ( ), 12 => -1, 13 => array ( ), 14 => array ( ), 15 => array ( ), 16 => array ( ), 17 => array ( ), 18 => array ( ), 19 => -1, 20 => -1, 21 => -1, 22 => array ( 'reserved' => '/^(abs|accept|alarm|atan2|bind|binmode|bless|caller|chdir|chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|continue|cos|crypt|dbmclose|dbmopen|defined|delete|die|do|dump|each|endgrent|endhostent|endnetent|endprotoent|endpwent|endservent|eof|eval|exec|exists|exit|exp|fcntl|fileno|flock|fork|format|formline|getc|getgrent|getgrgid|getgrnam|gethostbyaddr|gethostbyname|gethostent|getlogin|getnetbyaddr|getnetbyname|getnetent|getpeername|getpgrp|getppid|getpriority|getprotobyname|getprotobynumber|getprotoent|getpwent|getpwnam|getpwuid|getservbyname|getservbyport|getservent|getsockname|getsockopt|glob|gmtime|goto|grep|hex|import|index|int|ioctl|join|keys|kill|last|lc|lcfirst|length|link|listen|local|localtime|lock|log|lstat|map|mkdir|msgctl|msgget|msgrcv|msgsnd|my|next|no|oct|open|opendir|ord|our|pack|package|pipe|pop|pos|print|printf|prototype|push|quotemeta|rand|read|readdir|readline|readlink|readpipe|recv|redo|ref|rename|require|reset|return|reverse|rewinddir|rindex|rmdir|scalar|seek|seekdir|select|semctl|semget|semop|send|setgrent|sethostent|setnetent|setpgrp|setpriority|setprotoent|setpwent|setservent|setsockopt|shift|shmctl|shmget|shmread|shmwrite|shutdown|sin|sleep|socket|socketpair|sort|splice|split|sprintf|sqrt|srand|stat|study|sub|substr|symlink|syscall|sysopen|sysread|sysseek|system|syswrite|tell|telldir|tie|tied|time|times|truncate|uc|ucfirst|umask|undef|unlink|unpack|unshift|untie|use|utime|values|vec|wait|waitpid|wantarray|warn|write|y)$/', 'missingreserved' => '/^(new)$/', 'flowcontrol' => '/^(if|else|elsif|while|unless|for|foreach|until|do|continue|not|or|and|eq|ne|gt|lt)$/', ), 23 => array ( ), ), 2 => array ( 0 => array ( ), 1 => -1, 2 => -1, 3 => -1, 4 => -1, 5 => array ( ), 6 => array ( ), 7 => -1, 8 => -1, 9 => array ( ), 10 => array ( ), 11 => array ( ), 12 => -1, 13 => array ( ), 14 => array ( ), 15 => array ( ), 16 => array ( ), 17 => array ( ), 18 => array ( ), 19 => array ( ), 20 => -1, 21 => -1, 22 => -1, 23 => array ( 'reserved' => '/^(abs|accept|alarm|atan2|bind|binmode|bless|caller|chdir|chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|continue|cos|crypt|dbmclose|dbmopen|defined|delete|die|do|dump|each|endgrent|endhostent|endnetent|endprotoent|endpwent|endservent|eof|eval|exec|exists|exit|exp|fcntl|fileno|flock|fork|format|formline|getc|getgrent|getgrgid|getgrnam|gethostbyaddr|gethostbyname|gethostent|getlogin|getnetbyaddr|getnetbyname|getnetent|getpeername|getpgrp|getppid|getpriority|getprotobyname|getprotobynumber|getprotoent|getpwent|getpwnam|getpwuid|getservbyname|getservbyport|getservent|getsockname|getsockopt|glob|gmtime|goto|grep|hex|import|index|int|ioctl|join|keys|kill|last|lc|lcfirst|length|link|listen|local|localtime|lock|log|lstat|map|mkdir|msgctl|msgget|msgrcv|msgsnd|my|next|no|oct|open|opendir|ord|our|pack|package|pipe|pop|pos|print|printf|prototype|push|quotemeta|rand|read|readdir|readline|readlink|readpipe|recv|redo|ref|rename|require|reset|return|reverse|rewinddir|rindex|rmdir|scalar|seek|seekdir|select|semctl|semget|semop|send|setgrent|sethostent|setnetent|setpgrp|setpriority|setprotoent|setpwent|setservent|setsockopt|shift|shmctl|shmget|shmread|shmwrite|shutdown|sin|sleep|socket|socketpair|sort|splice|split|sprintf|sqrt|srand|stat|study|sub|substr|symlink|syscall|sysopen|sysread|sysseek|system|syswrite|tell|telldir|tie|tied|time|times|truncate|uc|ucfirst|umask|undef|unlink|unpack|unshift|untie|use|utime|values|vec|wait|waitpid|wantarray|warn|write|y)$/', 'missingreserved' => '/^(new)$/', 'flowcontrol' => '/^(if|else|elsif|while|unless|for|foreach|until|do|continue|not|or|and|eq|ne|gt|lt)$/', ), 24 => array ( ), ), 3 => array ( 0 => array ( ), 1 => -1, 2 => -1, 3 => -1, 4 => -1, 5 => array ( ), 6 => array ( ), 7 => -1, 8 => -1, 9 => array ( ), 10 => array ( ), 11 => array ( ), 12 => -1, 13 => array ( ), 14 => array ( ), 15 => array ( ), 16 => array ( ), 17 => array ( ), 18 => array ( ), 19 => -1, 20 => -1, 21 => -1, 22 => array ( 'reserved' => '/^(abs|accept|alarm|atan2|bind|binmode|bless|caller|chdir|chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|continue|cos|crypt|dbmclose|dbmopen|defined|delete|die|do|dump|each|endgrent|endhostent|endnetent|endprotoent|endpwent|endservent|eof|eval|exec|exists|exit|exp|fcntl|fileno|flock|fork|format|formline|getc|getgrent|getgrgid|getgrnam|gethostbyaddr|gethostbyname|gethostent|getlogin|getnetbyaddr|getnetbyname|getnetent|getpeername|getpgrp|getppid|getpriority|getprotobyname|getprotobynumber|getprotoent|getpwent|getpwnam|getpwuid|getservbyname|getservbyport|getservent|getsockname|getsockopt|glob|gmtime|goto|grep|hex|import|index|int|ioctl|join|keys|kill|last|lc|lcfirst|length|link|listen|local|localtime|lock|log|lstat|map|mkdir|msgctl|msgget|msgrcv|msgsnd|my|next|no|oct|open|opendir|ord|our|pack|package|pipe|pop|pos|print|printf|prototype|push|quotemeta|rand|read|readdir|readline|readlink|readpipe|recv|redo|ref|rename|require|reset|return|reverse|rewinddir|rindex|rmdir|scalar|seek|seekdir|select|semctl|semget|semop|send|setgrent|sethostent|setnetent|setpgrp|setpriority|setprotoent|setpwent|setservent|setsockopt|shift|shmctl|shmget|shmread|shmwrite|shutdown|sin|sleep|socket|socketpair|sort|splice|split|sprintf|sqrt|srand|stat|study|sub|substr|symlink|syscall|sysopen|sysread|sysseek|system|syswrite|tell|telldir|tie|tied|time|times|truncate|uc|ucfirst|umask|undef|unlink|unpack|unshift|untie|use|utime|values|vec|wait|waitpid|wantarray|warn|write|y)$/', 'missingreserved' => '/^(new)$/', 'flowcontrol' => '/^(if|else|elsif|while|unless|for|foreach|until|do|continue|not|or|and|eq|ne|gt|lt)$/', ), 23 => array ( ), ), 4 => array ( 0 => array ( ), 1 => array ( ), 2 => array ( ), 3 => array ( ), ), 5 => array ( 0 => array ( ), ), 6 => array ( 0 => array ( ), ), 7 => array ( 0 => array ( ), 1 => array ( ), 2 => array ( ), 3 => array ( ), ), 8 => array ( 0 => array ( ), ), 9 => array ( 0 => array ( ), 1 => array ( ), 2 => array ( ), 3 => array ( ), ), ); $this->_parts = array ( 0 => array ( ), 1 => array ( 0 => array ( 1 => 'special', 2 => 'string', ), 1 => NULL, 2 => NULL, 3 => NULL, 4 => NULL, 5 => array ( 1 => 'reserved', 2 => 'special', ), 6 => NULL, 7 => NULL, 8 => NULL, 9 => NULL, 10 => array ( 1 => 'quotes', 2 => 'quotes', 3 => 'string', 5 => 'quotes', 6 => 'string', 8 => 'quotes', ), 11 => array ( 1 => 'quotes', 2 => 'quotes', 3 => 'string', 5 => 'quotes', ), 12 => NULL, 13 => NULL, 14 => NULL, 15 => NULL, 16 => NULL, 17 => array ( 1 => 'brackets', 2 => 'var', 3 => 'brackets', ), 18 => NULL, 19 => NULL, 20 => NULL, 21 => NULL, 22 => NULL, 23 => NULL, ), 2 => array ( 0 => array ( 1 => 'special', 2 => 'string', ), 1 => NULL, 2 => NULL, 3 => NULL, 4 => NULL, 5 => array ( 1 => 'reserved', 2 => 'special', ), 6 => NULL, 7 => NULL, 8 => NULL, 9 => NULL, 10 => array ( 1 => 'quotes', 2 => 'quotes', 3 => 'string', 5 => 'quotes', 6 => 'string', 8 => 'quotes', ), 11 => array ( 1 => 'quotes', 2 => 'quotes', 3 => 'string', 5 => 'quotes', ), 12 => NULL, 13 => array ( 1 => 'string', 2 => 'code', ), 14 => NULL, 15 => NULL, 16 => NULL, 17 => NULL, 18 => array ( 1 => 'brackets', 2 => 'var', 3 => 'brackets', ), 19 => NULL, 20 => NULL, 21 => NULL, 22 => NULL, 23 => NULL, 24 => NULL, ), 3 => array ( 0 => array ( 1 => 'special', 2 => 'string', ), 1 => NULL, 2 => NULL, 3 => NULL, 4 => NULL, 5 => array ( 1 => 'reserved', 2 => 'special', ), 6 => NULL, 7 => NULL, 8 => NULL, 9 => NULL, 10 => array ( 1 => 'quotes', 2 => 'quotes', 3 => 'string', 5 => 'quotes', 6 => 'string', 8 => 'quotes', ), 11 => array ( 1 => 'quotes', 2 => 'quotes', 3 => 'string', 5 => 'quotes', ), 12 => NULL, 13 => NULL, 14 => NULL, 15 => NULL, 16 => NULL, 17 => array ( 1 => 'brackets', 2 => 'var', 3 => 'brackets', ), 18 => NULL, 19 => NULL, 20 => NULL, 21 => NULL, 22 => NULL, 23 => NULL, ), 4 => array ( 0 => NULL, 1 => NULL, 2 => NULL, 3 => NULL, ), 5 => array ( 0 => NULL, ), 6 => array ( 0 => NULL, ), 7 => array ( 0 => NULL, 1 => NULL, 2 => NULL, 3 => NULL, ), 8 => array ( 0 => NULL, ), 9 => array ( 0 => NULL, 1 => NULL, 2 => NULL, 3 => NULL, ), ); $this->_subst = array ( -1 => array ( 0 => false, 1 => false, 2 => false, 3 => false, 4 => false, 5 => false, 6 => false, 7 => true, 8 => true, 9 => false, 10 => false, 11 => false, 12 => false, 13 => false, 14 => false, 15 => false, 16 => false, 17 => false, 18 => false, 19 => false, 20 => false, 21 => false, 22 => false, 23 => false, ), 0 => array ( ), 1 => array ( 0 => false, 1 => false, 2 => false, 3 => false, 4 => false, 5 => false, 6 => false, 7 => true, 8 => true, 9 => false, 10 => false, 11 => false, 12 => false, 13 => false, 14 => false, 15 => false, 16 => false, 17 => false, 18 => false, 19 => false, 20 => false, 21 => false, 22 => false, 23 => false, ), 2 => array ( 0 => false, 1 => false, 2 => false, 3 => false, 4 => false, 5 => false, 6 => false, 7 => true, 8 => true, 9 => false, 10 => false, 11 => false, 12 => false, 13 => false, 14 => false, 15 => false, 16 => false, 17 => false, 18 => false, 19 => false, 20 => false, 21 => false, 22 => false, 23 => false, 24 => false, ), 3 => array ( 0 => false, 1 => false, 2 => false, 3 => false, 4 => false, 5 => false, 6 => false, 7 => true, 8 => true, 9 => false, 10 => false, 11 => false, 12 => false, 13 => false, 14 => false, 15 => false, 16 => false, 17 => false, 18 => false, 19 => false, 20 => false, 21 => false, 22 => false, 23 => false, ), 4 => array ( 0 => false, 1 => false, 2 => false, 3 => false, ), 5 => array ( 0 => false, ), 6 => array ( 0 => false, ), 7 => array ( 0 => false, 1 => false, 2 => false, 3 => false, ), 8 => array ( 0 => false, ), 9 => array ( 0 => false, 1 => false, 2 => false, 3 => false, ), ); $this->_conditions = array ( ); $this->_kwmap = array ( 'reserved' => 'reserved', 'missingreserved' => 'reserved', 'flowcontrol' => 'reserved', ); $this->_defClass = 'code'; $this->_checkDefines(); } }
{ "pile_set_name": "Github" }
/******************************************************************************************** * SIDH: an efficient supersingular isogeny cryptography library * * Abstract: internal header file for P610 *********************************************************************************************/ #ifndef P610_INTERNAL_H #define P610_INTERNAL_H #include "../config.h" #if (TARGET == TARGET_AMD64) || (TARGET == TARGET_ARM64) || (TARGET == TARGET_S390X) #define NWORDS_FIELD 10 // Number of words of a 610-bit field element #define p610_ZERO_WORDS 4 // Number of "0" digits in the least significant part of p610 + 1 #elif (TARGET == TARGET_x86) || (TARGET == TARGET_ARM) #define NWORDS_FIELD 20 #define p610_ZERO_WORDS 9 #endif // Basic constants #define NBITS_FIELD 610 #define MAXBITS_FIELD 640 #define MAXWORDS_FIELD ((MAXBITS_FIELD + RADIX - 1) / RADIX) // Max. number of words to represent field elements #define NWORDS64_FIELD ((NBITS_FIELD + 63) / 64) // Number of 64-bit words of a 610-bit field element #define NBITS_ORDER 320 #define NWORDS_ORDER ((NBITS_ORDER + RADIX - 1) / RADIX) // Number of words of oA and oB, where oA and oB are the subgroup orders of Alice and Bob, resp. #define NWORDS64_ORDER ((NBITS_ORDER + 63) / 64) // Number of 64-bit words of a 320-bit element #define MAXBITS_ORDER NBITS_ORDER #define ALICE 0 #define BOB 1 #define OALICE_BITS 305 #define OBOB_BITS 305 #define OBOB_EXPON 192 #define MASK_ALICE 0x01 #define MASK_BOB 0xFF #define PRIME p610 #define PARAM_A 6 #define PARAM_C 1 // Fixed parameters for isogeny tree computation #define MAX_INT_POINTS_ALICE 8 #define MAX_INT_POINTS_BOB 10 #define MAX_Alice 152 #define MAX_Bob 192 #define MSG_BYTES 24 #define SECRETKEY_A_BYTES ((OALICE_BITS + 7) / 8) #define SECRETKEY_B_BYTES ((OBOB_BITS - 1 + 7) / 8) #define FP2_ENCODED_BYTES 2 * ((NBITS_FIELD + 7) / 8) #ifdef COMPRESS #define MASK2_BOB 0x07 #define MASK3_BOB 0xFF #define ORDER_A_ENCODED_BYTES SECRETKEY_A_BYTES #define ORDER_B_ENCODED_BYTES (SECRETKEY_B_BYTES + 1) #define PARTIALLY_COMPRESSED_CHUNK_CT (4*ORDER_A_ENCODED_BYTES + FP2_ENCODED_BYTES + 2) #define COMPRESSED_CHUNK_CT (3 * ORDER_A_ENCODED_BYTES + FP2_ENCODED_BYTES + 2) #define UNCOMPRESSEDPK_BYTES 480 // Table sizes used by the Entangled basis generation #define TABLE_R_LEN 17 #define TABLE_V_LEN 34 #define TABLE_V3_LEN 20 // Parameters for discrete log computations // Binary Pohlig-Hellman reduced to smaller logs of order ell^W #define W_2 5 #define W_3 4 // ell^w #define ELL2_W (1 << W_2) #define ELL3_W 81 // ell^(e mod w) #define ELL2_EMODW (1 << (OALICE_BITS % W_2)) #define ELL3_EMODW 1 // # of digits in the discrete log #define DLEN_2 61 // Ceil(eA/W_2) #define DLEN_3 48 // Ceil(eB/W_3) // Length of the optimal strategy path for Pohlig-Hellman #define PLEN_2 62 #define PLEN_3 49 #endif // SIDH's basic element definitions and point representations typedef digit_t felm_t[NWORDS_FIELD]; // Datatype for representing 610-bit field elements (640-bit max.) typedef digit_t dfelm_t[2 * NWORDS_FIELD]; // Datatype for representing double-precision 2x610-bit field elements (2x640-bit max.) typedef felm_t f2elm_t[2]; // Datatype for representing quadratic extension field elements GF(p610^2) typedef struct { f2elm_t X; f2elm_t Z; } point_proj; // Point representation in projective XZ Montgomery coordinates. typedef point_proj point_proj_t[1]; #ifdef COMPRESS typedef struct { f2elm_t X; f2elm_t Y; f2elm_t Z; } point_full_proj; // Point representation in full projective XYZ Montgomery coordinates typedef point_full_proj point_full_proj_t[1]; typedef struct { f2elm_t x; f2elm_t y; } point_affine; // Point representation in affine coordinates. typedef point_affine point_t[1]; typedef f2elm_t publickey_t[3]; #endif /**************** Function prototypes ****************/ /************* Multiprecision functions **************/ // 610-bit multiprecision addition, c = a+b static void mp_add610(const digit_t *a, const digit_t *b, digit_t *c); void oqs_kem_sike_mp_add610_asm(const digit_t *a, const digit_t *b, digit_t *c); // 610-bit multiprecision subtraction, c = a-b+2p or c = a-b+4p extern void mp_sub610_p2(const digit_t* a, const digit_t* b, digit_t* c); extern void mp_sub610_p4(const digit_t* a, const digit_t* b, digit_t* c); void oqs_kem_sike_mp_sub610_p2_asm(const digit_t* a, const digit_t* b, digit_t* c); void oqs_kem_sike_mp_sub610_p4_asm(const digit_t* a, const digit_t* b, digit_t* c); // 2x610-bit multiprecision subtraction followed by addition with p610*2^640, c = a-b+(p610*2^640) if a-b < 0, otherwise c=a-b void oqs_kem_sike_mp_subaddx2_asm(const digit_t *a, const digit_t *b, digit_t *c); void oqs_kem_sike_mp_subadd610x2_asm(const digit_t *a, const digit_t *b, digit_t *c); // Double 2x610-bit multiprecision subtraction, c = c-a-b, where c > a and c > b void oqs_kem_sike_mp_dblsub610x2_asm(const digit_t *a, const digit_t *b, digit_t *c); /************ Field arithmetic functions *************/ // Copy of a field element, c = a static void fpcopy610(const digit_t *a, digit_t *c); // Zeroing a field element, a = 0 static void fpzero610(digit_t *a); // Non constant-time comparison of two field elements. If a = b return TRUE, otherwise, return FALSE static bool fpequal610_non_constant_time(const digit_t *a, const digit_t *b); // Modular addition, c = a+b mod p610 extern void fpadd610(const digit_t *a, const digit_t *b, digit_t *c); extern void oqs_kem_sike_fpadd610_asm(const digit_t *a, const digit_t *b, digit_t *c); // Modular subtraction, c = a-b mod p610 extern void fpsub610(const digit_t *a, const digit_t *b, digit_t *c); extern void oqs_kem_sike_fpsub610_asm(const digit_t *a, const digit_t *b, digit_t *c); // Modular negation, a = -a mod p610 extern void fpneg610(digit_t *a); // Modular division by two, c = a/2 mod p610. static void fpdiv2_610(const digit_t *a, digit_t *c); // Modular correction to reduce field element a in [0, 2*p610-1] to [0, p610-1]. static void fpcorrection610(digit_t *a); // 610-bit Montgomery reduction, c = a mod p void oqs_kem_sike_rdc610_asm(digit_t *a, digit_t *c); // Field multiplication using Montgomery arithmetic, c = a*b*R^-1 mod p610, where R=2^640 static void fpmul610_mont(const digit_t *a, const digit_t *b, digit_t *c); void oqs_kem_sike_mul610_asm(const digit_t *a, const digit_t *b, digit_t *c); // Field squaring using Montgomery arithmetic, c = a*b*R^-1 mod p610, where R=2^640 static void fpsqr610_mont(const digit_t *ma, digit_t *mc); // Field inversion, a = a^-1 in GF(p610) static void fpinv610_mont(digit_t *a); // Field inversion, a = a^-1 in GF(p610) using the binary GCD static void fpinv610_mont_bingcd(digit_t *a); // Chain to compute (p610-3)/4 using Montgomery arithmetic static void fpinv610_chain_mont(digit_t *a); /************ GF(p^2) arithmetic functions *************/ // Copy of a GF(p610^2) element, c = a static void fp2copy610(const f2elm_t a, f2elm_t c); // Zeroing a GF(p610^2) element, a = 0 static void fp2zero610(f2elm_t a); // GF(p610^2) negation, a = -a in GF(p610^2) static void fp2neg610(f2elm_t a); // GF(p610^2) addition, c = a+b in GF(p610^2) extern void fp2add610(const f2elm_t a, const f2elm_t b, f2elm_t c); // GF(p610^2) subtraction, c = a-b in GF(p610^2) extern void fp2sub610(const f2elm_t a, const f2elm_t b, f2elm_t c); // GF(p610^2) division by two, c = a/2 in GF(p610^2) static void fp2div2_610(const f2elm_t a, f2elm_t c); // Modular correction, a = a in GF(p610^2) static void fp2correction610(f2elm_t a); // GF(p610^2) squaring using Montgomery arithmetic, c = a^2 in GF(p610^2) static void fp2sqr610_mont(const f2elm_t a, f2elm_t c); // GF(p610^2) multiplication using Montgomery arithmetic, c = a*b in GF(p610^2) static void fp2mul610_mont(const f2elm_t a, const f2elm_t b, f2elm_t c); // GF(p610^2) inversion using Montgomery arithmetic, a = (a0-i*a1)/(a0^2+a1^2) static void fp2inv610_mont(f2elm_t a); // GF(p610^2) inversion, a = (a0-i*a1)/(a0^2+a1^2), GF(p610) inversion done using the binary GCD static void fp2inv610_mont_bingcd(f2elm_t a); #endif
{ "pile_set_name": "Github" }
/* * Copyright (C) 2014 Google 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. */ import QtQuick 2.2 import VoltAir 1.0 /** * @ingroup QQuickItem * @brief A shader effect that masks one texture with another. */ Item { id: root /** * @brief Item that is masked by #maskItem. */ property Item sourceItem /** * @brief Item that masks #sourceItem. */ property Item maskItem ShaderEffect { id: effect property variant src: ShaderEffectSource { sourceItem: root.sourceItem // Take a center clipping. sourceRect: Qt.rect(sourceItem.width / 2.0 - effect.width / 2.0, sourceItem.height / 2.0 - effect.height / 2.0, effect.width, effect.height) hideSource: true recursive: true } property variant mask: ShaderEffectSource { sourceItem: root.maskItem // Take a center clipping. sourceRect: Qt.rect(sourceItem.width / 2.0 - effect.width / 2.0, sourceItem.height / 2.0 - effect.height / 2.0, effect.width, effect.height) hideSource: true recursive: true } anchors.fill: parent fragmentShader: " varying highp vec2 qt_TexCoord0; uniform sampler2D src; uniform sampler2D mask; uniform lowp float qt_Opacity; void main() { lowp vec4 tex = texture2D(src, qt_TexCoord0); lowp float texMask = texture2D(mask, qt_TexCoord0).a; gl_FragColor = tex * qt_Opacity * texMask; }" } }
{ "pile_set_name": "Github" }
"MJRefreshHeaderIdleText" = "Pull down to refresh"; "MJRefreshHeaderPullingText" = "Release to refresh"; "MJRefreshHeaderRefreshingText" = "Loading..."; "MJRefreshAutoFooterIdleText" = "Tap or pull up to load more"; "MJRefreshAutoFooterRefreshingText" = "Loading..."; "MJRefreshAutoFooterNoMoreDataText" = "No more data"; "MJRefreshBackFooterIdleText" = "Pull up to load more"; "MJRefreshBackFooterPullingText" = "Release to load more."; "MJRefreshBackFooterRefreshingText" = "Loading..."; "MJRefreshBackFooterNoMoreDataText" = "No more data"; "MJRefreshHeaderLastTimeText" = "Last update:"; "MJRefreshHeaderDateTodayText" = "Today"; "MJRefreshHeaderNoneLastDateText" = "No record";
{ "pile_set_name": "Github" }
// // DCRoundSwitch.m // // Created by Patrick Richards on 28/06/11. // MIT License. // // http://twitter.com/patr // http://domesticcat.com.au/projects // http://github.com/domesticcatsoftware/DCRoundSwitch // #import "DCRoundSwitch.h" #import "DCRoundSwitchToggleLayer.h" #import "DCRoundSwitchOutlineLayer.h" #import "DCRoundSwitchKnobLayer.h" @interface DCRoundSwitch () <UIGestureRecognizerDelegate> @property (nonatomic, retain) DCRoundSwitchOutlineLayer *outlineLayer; @property (nonatomic, retain) DCRoundSwitchToggleLayer *toggleLayer; @property (nonatomic, retain) DCRoundSwitchKnobLayer *knobLayer; @property (nonatomic, retain) CAShapeLayer *clipLayer; @property (nonatomic, assign) BOOL ignoreTap; - (void)setup; - (void)useLayerMasking; - (void)removeLayerMask; - (void)positionLayersAndMask; @end @implementation DCRoundSwitch @synthesize outlineLayer, toggleLayer, knobLayer, clipLayer, ignoreTap; @synthesize on, onText, offText; @synthesize onTintColor; #pragma mark - #pragma mark Init & Memory Managment - (void)dealloc { [outlineLayer release]; [toggleLayer release]; [knobLayer release]; [clipLayer release]; [onTintColor release]; [onText release]; [offText release]; [super dealloc]; } - (id)init { if ((self = [super init])) { self.frame = CGRectMake(0, 0, 77, 27); [self setup]; } return self; } - (id)initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { [self setup]; } return self; } - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { [self setup]; } return self; } + (Class)knobLayerClass { return [DCRoundSwitchKnobLayer class]; } + (Class)outlineLayerClass { return [DCRoundSwitchOutlineLayer class]; } + (Class)toggleLayerClass { return [DCRoundSwitchToggleLayer class]; } - (void)setup { // this way you can set the background color to black or something similar so it can be seen in IB self.backgroundColor = [UIColor clearColor]; // remove the flexible width/height autoresizing masks if they have been set UIViewAutoresizing mask = (int)self.autoresizingMask; if (mask & UIViewAutoresizingFlexibleHeight) self.autoresizingMask ^= UIViewAutoresizingFlexibleHeight; if (mask & UIViewAutoresizingFlexibleWidth) self.autoresizingMask ^= UIViewAutoresizingFlexibleWidth; // setup default texts NSBundle *uiKitBundle = [NSBundle bundleWithIdentifier:@"com.apple.UIKit"]; self.onText = uiKitBundle ? [uiKitBundle localizedStringForKey:@"ON" value:nil table:nil] : @"ON"; self.offText = uiKitBundle ? [uiKitBundle localizedStringForKey:@"OFF" value:nil table:nil] : @"OFF"; // the switch has three layers, (ordered from bottom to top): // // * toggleLayer * (bottom of the layer stack) // this layer contains the onTintColor (blue by default), the text, and the shadown for the knob. the knob shadow is // on this layer because it needs to go under the outlineLayer so it doesn't bleed out over the edge of the control. // this layer moves when the switch moves // * outlineLayer * (middle of the layer stack) // this is the outline of the control, it's inner shadow, and the inner gloss. the inner shadow is on this layer // because it must stay still while the switch animates. the inner gloss is also here because it doesn't move, and also // because it needs to go uner the knobLayer. // this layer appears to always stay in the same spot. // * knobLayer * (top of the layer stack) // this is the knob, and sits on top of the layer stack. note that the knob shadow is NOT drawn here, it is drawn on the // toggleLayer so it doesn't bleed out over the outlineLayer. self.toggleLayer = [[[[[self class] toggleLayerClass] alloc] initWithOnString:self.onText offString:self.offText onTintColor:[UIColor colorWithRed:0.000 green:0.478 blue:0.882 alpha:1.0]] autorelease]; self.toggleLayer.drawOnTint = NO; self.toggleLayer.clip = YES; [self.layer addSublayer:self.toggleLayer]; [self.toggleLayer setNeedsDisplay]; self.outlineLayer = [[[self class] outlineLayerClass] layer]; [self.toggleLayer addSublayer:self.outlineLayer]; [self.outlineLayer setNeedsDisplay]; self.knobLayer = [[[self class] knobLayerClass] layer]; [self.layer addSublayer:self.knobLayer]; [self.knobLayer setNeedsDisplay]; self.toggleLayer.contentsScale = self.outlineLayer.contentsScale = self.knobLayer.contentsScale = [[UIScreen mainScreen] scale]; // tap gesture for toggling the switch UITapGestureRecognizer *tapGestureRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)] autorelease]; [tapGestureRecognizer setDelegate:self]; [self addGestureRecognizer:tapGestureRecognizer]; // pan gesture for moving the switch knob manually UIPanGestureRecognizer *panGestureRecognizer = [[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(toggleDragged:)] autorelease]; [panGestureRecognizer setDelegate:self]; [self addGestureRecognizer:panGestureRecognizer]; [self setNeedsLayout]; // setup the layer positions [self positionLayersAndMask]; } #pragma mark - #pragma mark Setup Frame/Layout - (void)sizeToFit { [super sizeToFit]; NSString *onString = self.toggleLayer.onString; NSString *offString = self.toggleLayer.offString; CGFloat width = [onString sizeWithFont:self.toggleLayer.labelFont].width; CGFloat offWidth = [offString sizeWithFont:self.toggleLayer.labelFont].width; if(offWidth > width) width = offWidth; width += self.toggleLayer.bounds.size.width * 2.;//add 2x the knob for padding CGRect newFrame = self.frame; CGFloat currentWidth = newFrame.size.width; newFrame.size.width = width; newFrame.origin.x += currentWidth - width; self.frame = newFrame; //old values for sizeToFit; keep these around for reference // newFrame.size.width = 77.0; // newFrame.size.height = 27.0; } - (void)useLayerMasking { // turn of the manual clipping (done in toggleLayer's drawInContext:) self.toggleLayer.clip = NO; self.toggleLayer.drawOnTint = YES; [self.toggleLayer setNeedsDisplay]; // create the layer mask and add that to the toggleLayer self.clipLayer = [CAShapeLayer layer]; UIBezierPath *clipPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:self.bounds.size.height / 2.0]; self.clipLayer.path = clipPath.CGPath; self.toggleLayer.mask = self.clipLayer; } - (void)removeLayerMask { // turn off the animations so the user doesn't see the changing of mask/clipping [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; // remove the layer mask (put on in useLayerMasking) self.toggleLayer.mask = nil; // renable manual clipping (done in toggleLayer's drawInContext:) self.toggleLayer.clip = YES; self.toggleLayer.drawOnTint = self.on; [self.toggleLayer setNeedsDisplay]; } - (void)positionLayersAndMask { // repositions the underlying toggle and the layer mask, plus the knob self.toggleLayer.mask.position = CGPointMake(-self.toggleLayer.frame.origin.x, 0.0); self.outlineLayer.frame = CGRectMake(-self.toggleLayer.frame.origin.x, 0, self.bounds.size.width, self.bounds.size.height); self.knobLayer.frame = CGRectMake(self.toggleLayer.frame.origin.x + self.toggleLayer.frame.size.width / 2.0 - self.knobLayer.frame.size.width / 2.0, -1, self.knobLayer.frame.size.width, self.knobLayer.frame.size.height); } #pragma mark - #pragma mark Interaction - (void)tapped:(UITapGestureRecognizer *)gesture { if (self.ignoreTap) return; if (gesture.state == UIGestureRecognizerStateEnded) [self setOn:!self.on animated:YES]; } - (void)toggleDragged:(UIPanGestureRecognizer *)gesture { CGFloat minToggleX = -self.toggleLayer.frame.size.width / 2.0 + self.toggleLayer.frame.size.height / 2.0; CGFloat maxToggleX = -1; if (gesture.state == UIGestureRecognizerStateBegan) { // setup by turning off the manual clipping of the toggleLayer and setting up a layer mask. [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; [self useLayerMasking]; [self positionLayersAndMask]; self.knobLayer.gripped = YES; } else if (gesture.state == UIGestureRecognizerStateChanged) { CGPoint translation = [gesture translationInView:self]; // disable the animations before moving the layers [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; // darken the knob if (!self.knobLayer.gripped) self.knobLayer.gripped = YES; // move the toggleLayer using the translation of the gesture, keeping it inside the outline. CGFloat newX = self.toggleLayer.frame.origin.x + translation.x; if (newX < minToggleX) newX = minToggleX; if (newX > maxToggleX) newX = maxToggleX; self.toggleLayer.frame = CGRectMake(newX, self.toggleLayer.frame.origin.y, self.toggleLayer.frame.size.width, self.toggleLayer.frame.size.height); // this will re-position the layer mask and knob [self positionLayersAndMask]; [gesture setTranslation:CGPointZero inView:self]; } else if (gesture.state == UIGestureRecognizerStateEnded) { // flip the switch to on or off depending on which half it ends at CGFloat toggleCenter = CGRectGetMidX(self.toggleLayer.frame); [self setOn:(toggleCenter > CGRectGetMidX(self.bounds)) animated:YES]; } // send off the appropriate actions (not fully tested yet) CGPoint locationOfTouch = [gesture locationInView:self]; if (CGRectContainsPoint(self.bounds, locationOfTouch)) [self sendActionsForControlEvents:UIControlEventTouchDragInside]; else [self sendActionsForControlEvents:UIControlEventTouchDragOutside]; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { if (self.ignoreTap) return; [super touchesBegan:touches withEvent:event]; self.knobLayer.gripped = YES; [self sendActionsForControlEvents:UIControlEventTouchDown]; } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesEnded:touches withEvent:event]; [self sendActionsForControlEvents:UIControlEventTouchUpInside]; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesCancelled:touches withEvent:event]; [self sendActionsForControlEvents:UIControlEventTouchUpOutside]; } #pragma mark UIGestureRecognizerDelegate - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer; { return !self.ignoreTap; } #pragma mark Setters/Getters - (void)setOn:(BOOL)newOn { [self setOn:newOn animated:NO]; } - (void)setOn:(BOOL)newOn animated:(BOOL)animated { [self setOn:newOn animated:animated ignoreControlEvents:NO]; } - (void)setOn:(BOOL)newOn animated:(BOOL)animated ignoreControlEvents:(BOOL)ignoreControlEvents { BOOL previousOn = self.on; on = newOn; self.ignoreTap = YES; [CATransaction setAnimationDuration:0.014]; self.knobLayer.gripped = YES; // setup by turning off the manual clipping of the toggleLayer and setting up a layer mask. [self useLayerMasking]; [self positionLayersAndMask]; // retain all our targets so they don't disappear before the actions get sent at the end of the animation [[self allTargets] makeObjectsPerformSelector:@selector(retain)]; [CATransaction setCompletionBlock:^{ [CATransaction begin]; if (!animated) [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; else [CATransaction setValue:(id)kCFBooleanFalse forKey:kCATransactionDisableActions]; CGFloat minToggleX = -self.toggleLayer.frame.size.width / 2.0 + self.toggleLayer.frame.size.height / 2.0; CGFloat maxToggleX = -1; if (self.on) { self.toggleLayer.frame = CGRectMake(maxToggleX, self.toggleLayer.frame.origin.y, self.toggleLayer.frame.size.width, self.toggleLayer.frame.size.height); } else { self.toggleLayer.frame = CGRectMake(minToggleX, self.toggleLayer.frame.origin.y, self.toggleLayer.frame.size.width, self.toggleLayer.frame.size.height); } if (!self.toggleLayer.mask) { [self useLayerMasking]; [self.toggleLayer setNeedsDisplay]; } [self positionLayersAndMask]; self.knobLayer.gripped = NO; [CATransaction setCompletionBlock:^{ [self removeLayerMask]; self.ignoreTap = NO; // send the action here so it get's sent at the end of the animations if (previousOn != on && !ignoreControlEvents) [self sendActionsForControlEvents:UIControlEventValueChanged]; [[self allTargets] makeObjectsPerformSelector:@selector(release)]; }]; [CATransaction commit]; }]; } - (void)setOnTintColor:(UIColor *)anOnTintColor { if (anOnTintColor != onTintColor) { [onTintColor release]; onTintColor = [anOnTintColor retain]; self.toggleLayer.onTintColor = anOnTintColor; [self.toggleLayer setNeedsDisplay]; } } - (void)layoutSubviews; { CGFloat knobRadius = self.bounds.size.height + 2.0; self.knobLayer.frame = CGRectMake(0, 0, knobRadius, knobRadius); CGSize toggleSize = CGSizeMake(self.bounds.size.width * 2 - (knobRadius - 4), self.bounds.size.height); CGFloat minToggleX = -toggleSize.width / 2.0 + knobRadius / 2.0 - 1; CGFloat maxToggleX = -1; if (self.on) { self.toggleLayer.frame = CGRectMake(maxToggleX, self.toggleLayer.frame.origin.y, toggleSize.width, toggleSize.height); } else { self.toggleLayer.frame = CGRectMake(minToggleX, self.toggleLayer.frame.origin.y, toggleSize.width, toggleSize.height); } [self positionLayersAndMask]; } - (void)setOnText:(NSString *)newOnText { if (newOnText != onText) { [onText release]; onText = [newOnText copy]; self.toggleLayer.onString = onText; [self.toggleLayer setNeedsDisplay]; } } - (void)setOffText:(NSString *)newOffText { if (newOffText != offText) { [offText release]; offText = [newOffText copy]; self.toggleLayer.offString = offText; [self.toggleLayer setNeedsDisplay]; } } @end
{ "pile_set_name": "Github" }
<!doctype html> <html lang="{{ site.lang | default: "en-US" }}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="chrome=1"> {% seo %} <link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}"> <meta name="viewport" content="width=device-width"> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <div class="wrapper"> <header> <a href="/"><h1><img src="/assets/images/logo.png" width="200px" title="Takeoff logo, looks like a paper plane"/></h1></a> <p>{{ site.description | default: site.github.project_tagline }}</p> <ul> <li><a href="{{ site.github.repository_url }}"><strong>View on GitHub</strong></a></li> <li><a href="https://gitter.im/takeoff-env/Lobby"><strong>Join Our Gitter</strong></a></li> <li><a href="https://www.npmjs.com/package/@takeoff/takeoff"><strong>View on NPM</strong></a></li> </ul> <ul> <li><a href="https://twitter.com/takeoffcli"><strong>Tweet our Twitter</strong></a></li> <li><a href="/docs/command-line.html"><strong>CLI Tool Docs</strong></a></li> <li><a href="https://takeoff-env.github.io/takeoff-blueprint-basic/"><strong>Basic Blueprint</strong></a></li> </ul> </header> <section> {{ content }} </section> <footer> {% if site.github.is_project_page %} <p>This project is maintained by <a href="{{ site.github.owner_url }}">Takeoff Github Org</a></p> <p><a href="/docs/documentation.html">About documentation</a></p> {% endif %} <p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p> </footer> </div> <script src="{{ '/assets/js/scale.fix.js' | relative_url }}"></script> {% if site.google_analytics %} <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', '{{ site.google_analytics }}', 'auto'); ga('send', 'pageview'); </script> {% endif %} </body> </html>
{ "pile_set_name": "Github" }
SSH Proxy Command -- connect.c ============================== `connect.c` is a simple relaying command to make network connection via SOCKS and https proxy. It is mainly intended to be used as proxy command of OpenSSH. You can make SSH session beyond the firewall with this command, Features of `connect.c` are: * Supports SOCKS (version 4/4a/5) and https CONNECT method. * Supports NO-AUTH and USERPASS authentication of SOCKS5 * You can input password from tty, `ssh-askpass` or environment variable. * Run on UNIX or Windows platform. * You can compile with various C compiler (cc, gcc, Visual C, Borland C. etc.) * Simple and general program independent from OpenSSH. * You can also relay local socket stream instead of standard I/O. You can download source code (http://bitbucket.org/gotoh/connect/raw/tip/connect.c[connect.c]) on the http://bitbucket.org/gotoh/connect/[project page]. Pre-compiled binary for MS Windows is also available on http://bitbucket.org/gotoh/connect/downloads/[download page]. What is proxy command? ---------------------- OpenSSH development team decides to stop supporting SOCKS and any other tunneling mechanism. It was aimed to separate complexity to support various mechanism of proxying from core code. And they recommends more flexible mechanism: ProxyCommand option instead. Proxy command mechanism is delegation of network stream communication. If ProxyCommand options is specified, SSH invoke specified external command and talk with standard I/O of thid command. Invoked command undertakes network communication with relaying to/from standard input/output including iniitial communication or negotiation for proxying. Thus, ssh can split out proxying code into external command. The `connect.c` program was made for this purpose. How to Use ---------- Get Source ~~~~~~~~~~ You can get source code from http://bitbucket.org/gotoh/connect/downloads/[project download page]. Pre-compiled MS Windows binary is also available there. Compile and Install ~~~~~~~~~~~~~~~~~~~ In most environment, you can compile `connect.c` simply. On UNIX environment, you can use cc or gcc. On Windows environment, you can use Microsoft Visual C, Borland C or Cygwin gcc. UNIX cc:: `cc connect.c -o connect` UNIX gcc:: `gcc connect.c -o connect` Solaris:: `gcc connect.c -o connect -lnsl -lsocket -lresolv` Microsoft Visual C/C++:: `cl connect.c wsock32.lib advapi32.lib` Borland C:: `bcc32 connect.c wsock32.lib advapi32.lib` Cygwin gcc:: `gcc connect.c -o connect` Mac OS/Darwin:: `gcc connect.c -o connect -lresolv` To install connect command, simply copy compiled binary to directory in your `PATH` (ex. `/usr/local/bin`). Like this: ---- $ cp connect /usr/local/bin ---- Modify your `~/.ssh/config` ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Modify your `~/.ssh/config` file to use connect command as proxy command. For the case of SOCKS server is running on firewall host socks.local.net with port 1080, you can add `ProxyCommand` option in `~/.ssh/config`, like this: ---- Host remote.outside.net ProxyCommand connect -S socks.local.net %h %p ---- `%h` and `%p` will be replaced on invoking proxy command with target hostname and port specified to SSH command. If you hate writing many entries of remote hosts, following example may help you. ---- ## Outside of the firewall, use connect command with SOCKS conenction. Host * ProxyCommand connect -S socks.local.net %h %p ## Inside of the firewall, use connect command with direct connection. Host *.local.net ProxyCommand connect %h %p ---- If you want to use http proxy, use `-H` option instead of `-S` option in examle above, like this: ---- ## Outside of the firewall, with HTTP proxy Host * ProxyCommand connect -H proxy.local.net:8080 %h %p ## Inside of the firewall, direct Host *.local.net ProxyCommand connect %h %p ---- Use SSH ~~~~~~~ After editing your `~/.ssh/config` file, you are ready to use ssh. You can execute ssh without any special options as if remote host is IP reachable host. Following is an example to execute hostname command on host `remote.outside.net`. ---- local$ ssh remote.outside.net hostname Hello, this is remote.outside.net remote$ ---- Have trouble? ~~~~~~~~~~~~~ If you have trouble, execute connect command from command line with `-d` option to see what is happened. Some debug message may appear and reports progress. This information may tell you what is wrong. In this example, error has occurred on authentication stage of SOCKS5 protocol. ---- $ connect -d -S socks.local.net unknown.remote.outside.net 110 DEBUG: relay_method = SOCKS (2) DEBUG: relay_host=socks.local.net DEBUG: relay_port=1080 DEBUG: relay_user=gotoh DEBUG: socks_version=5 DEBUG: socks_resolve=REMOTE (2) DEBUG: local_type=stdio DEBUG: dest_host=unknown.remote.outside.net DEBUG: dest_port=110 DEBUG: Program is $Revision: 1.20 $ DEBUG: connecting to xxx.xxx.xxx.xxx:1080 DEBUG: begin_socks_relay() DEBUG: atomic_out() [4 bytes] DEBUG: >>> 05 02 00 02 DEBUG: atomic_in() [2 bytes] DEBUG: <<< 05 02 DEBUG: auth method: USERPASS DEBUG: atomic_out() [some bytes] DEBUG: >>> xx xx xx xx ... DEBUG: atomic_in() [2 bytes] DEBUG: <<< 01 01 ERROR: Authentication faield. FATAL: failed to begin relaying via SOCKS. ---- More Detail ----------- Command line usage is here: ---- usage: connect [-dnhs45] [-R resolve] [-p local-port] [-w sec] [-H [user@]proxy-server[:port]] [-S [user@]socks-server[:port]] host port ---- host and port is target hostname and port-number to connect. `-H` [user@]server[:port]:: Specify hostname and port number of http proxy server to relay. If port is omitted, 80 is used. `-h`:: Use HTTP proxy via proxy server sepcified by environment variable `HTTP_PROXY`. `-S` \[_user_@]_server_\[:_port_]:: Specify hostname and port number of SOCKS server to relay. Like `-H` option, port number can be omit and default is 1080. `-s`:: Use SOCKS proxy via SOCKS server sepcified by environment variable `SOCKS5_SERVER`. `-4`:: Use SOCKS version 4 protocol. This option must be used with `-S`. `-5`:: Use SOCKS version 5 protocol. This option must be used with `-S`. `-R` _method_:: The method to resolve hostname. 3 keywords (`local`, `remote`, `both`) or dot-notation IP address is allowed. Keyword both means; _"Try local first, then remote"_. If dot-notation IP address is specified, use this host as nameserver (UNIX only). Default is remote for SOCKS5 or local for others. On SOCKS4 protocol, remote resolving method (remote and both) use protocol version 4a. `-p` _port_:: Accept on local TCP port and relay it instead of standard input and output. With this option, program will terminate when remote or local TCP session is closed. `-w` _timeout_:: Timeout seconds for connecting to remote host. `-a` _auth_:: option specifiys user intended authentication methods separated by comma. Currently `userpass` and `none` are supported. Default is userpass. You can also specifying this parameter by the environment variable `SOCKS5_AUTH`. `-d`: Run with debug message output. If you fail to connect, use this option to see what is done. As additional feature, you can omit port argument when program name is special format containing port number itself like "connect-25". For example: ---- $ ln -s connect connect-25 $ ./connect-25 smtphost.outside.net 220 smtphost.outside.net ESMTP Sendmail QUIT 221 2.0.0 smtphost.remote.net closing connection $ ---- This example means that the command name "connect-25" indicates port number 25 so you can omit 2nd argument (and used if specified explicitly). This is usefull for the application which invokes only with hostname argument. Specifying user name via environment variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There are 5 environemnt variables to specify user name without command line option. This mechanism is usefull for the user who using another user name different from system account. `SOCKS5_USER`:: Used for SOCKS v5 access. `SOCKS4_USER`:: Used for SOCKS v4 access. `SOCKS_USER`:: Used for SOCKS v5 or v4 access and varaibles above are not defined. `HTTP_PROXY_USER`:: Used for HTTP proxy access. `CONNECT_USER`:: Used for all type of access if all above are not defined. Following table describes how user name is determined. Left most number is order to check. If variable is not defined, check next variable, and so on. [width="50%"] |==== | | SOCKS v5 | SOCKS v4 | HTTP proxy | 1 | `SOCKS5_USER` | `SOCKS4_USER` .2+^| `HTTP_PROXY_USER` | 2 2+^| `SOCKS_USER` | 3 3+^| `CONNECT_USER` | 4 3+^| (query user name to system) |==== Specifying password via environment variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There are 5 environemnt variables to specify password. If you use this feature, please note that it is not secure way. `SOCKS5_PASSWD`:: Used for SOCKS v5 access. This variables is compatible with NEC SOCKS implementation. `SOCKS5_PASSWORD`:: Used for SOCKS v5 access if `SOCKS5_PASSWD` is not defined. `SOCKS_PASSWORD`:: Used for SOCKS v5 (or v4) access all above is not defined. `HTTP_PROXY_PASSWORD`:: Used for HTTP proxy access. `CONNECT_PASSWORD`:: Used for all type of access if all above are not defined. Following table describes how password is determined. Left most number is order to check. If variable is not defined, check next variable, and so on. Finally ask to user interactively using external program or tty input. [width="50%"] |==== | | SOCKS v5 | HTTP proxy | 1 | `SOCKS5_PASSWD` .2+^| `HTTP_PROXY_PASSWORD` | 2 | `SOCKS_PASSWORD` | 3 2+^| `CONNECT_PASSWORD` | 4 2+^| (ask to user interactively) |==== Limitations ----------- SOCKS5 authentication ~~~~~~~~~~~~~~~~~~~~~ Only NO-AUTH and USER/PASSWORD authentications are supported. GSSAPI authentication (RFC 1961) and other draft authentications (CHAP, EAP, MAF, etc.) is not supported. HTTP authentication ~~~~~~~~~~~~~~~~~~~ BASIC authentication is supported but DIGEST authentication is not. Switching proxy server on event ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There is no mechanism to switch proxy server regarding to PC environment. This limitation might be bad news for mobile user. Since I do not want to make this program complex, I do not want to support although this feature is already requested. Please advice me if there is good idea of detecting environment to swich and simple way to specify conditioned directive of servers. One tricky workaround exists. It is replacing `~/.ssh/config` file by script on ppp up/down. There's another example of wrapper script (contributed by Darren Tucker). This script costs executing ifconfig and grep to detect current environment, but it works. Note that you should modify addresses if you use it. ---- #!/bin/sh ## ~/bin/myconnect --- Proxy server switching wrapper if ifconfig eth0 |grep "inet addr:192\.168\.1" >/dev/null; then opts="-S 192.168.1.1:1080" elif ifconfig eth0 |grep "inet addr:10\." >/dev/null; then opts="-H 10.1.1.1:80" else opts="-s" fi exec /usr/local/bin/connect $opts $@ ---- Tips ---- Proxying socket connection ~~~~~~~~~~~~~~~~~~~~~~~~~~ In usual, `connect.c` relays network connection to/from standard input/output. By specifying -p option, however, `connect.c` relays local network stream instead of standard input/output. With this option, connect command waits connection from other program, then start relaying between both network stream. This feature may be useful for the program which is hard to SOCKSify. Use with ssh-askpass command ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `connect.c` ask you password when authentication is required. If you are using on tty/pty terminal, connect can input from terminal with prompt. But you can also use ssh-askpass program to input password. If you are graphical environment like X Window or MS Windows, and program does not have tty/pty, and environment variable `SSH_ASKPASS` is specified, then `connect.c` invoke command specified by environment variable SSH_ASKPASS to input password. ssh-askpass program might be installed if you are using OpenSSH on UNIX environment. On Windows environment, pre-compiled binary is available from here. This feature is limited on window system environment. And also useful on Emacs on MS Windows (NT Emacs or Meadow). It is hard to send passphrase to connect command (and also ssh) because external command is invoked on hidden terminal and do I/O with this terminal. Using ssh-askpass avoids this problem. Use for Network Stream of Emacs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Although `connect.c` is made for OpenSSH, it is generic and independent from OpenSSH. So we can use this for other purpose. For example, you can use this command in Emacs to open network connection with remote host over the firewall via SOCKS or HTTP proxy without SOCKSifying Emacs itself. There is sample code: http://bitbucket.org/gotoh/connect/src/tip/relay.el With this code, you can use `relay-open-network-stream` function instead of `open-network-stream` to make network connection. See top comments of the source for more detail. Remote resolver ~~~~~~~~~~~~~~~ If you are SOCKS4 user on UNIX environment, you might want specify nameserver to resolve remote hostname. You can do it specifying `-R` option followed by IP address of resolver. Hopping Connection via SSH ~~~~~~~~~~~~~~~~~~~~~~~~~~ Conbination of ssh and connect command have more interesting usage. Following command makes indirect connection to host2:port from your current host via host1. ---- $ ssh host1 connect host2 port ---- This method is useful for the situations like: * You are outside of organizasion now, but you want to access an internal host barriered by firewall. * You want to use some service which is allowed only from some limited hosts. For example, I want to use local NetNews service in my office from home. I cannot make NNTP session directly because NNTP host is barriered by firewall. Fortunately, I have ssh account on internal host and allowed using SOCKS5 on firewall from outside. So I use following command to connect to NNTP service. ---- $ ssh host1 connect news 119 200 news.my-office.com InterNetNews NNRP server INN 2.3.2 ready (posting ok). quit 205 . $ ---- By combinating hopping connection and relay.el, I can read NetNews using http://www.gohome.org/wl/[Wanderlust] on Emacs at home. ---- | External (internet) | Internal (office) | +------+ +----------+ +-------+ +-----------+ | HOME | | firewall | | host1 | | NNTP host | +------+ +----------+ +-------+ +-----------+ emacs <-------------- ssh ---------------> sshd <-- connect --> nntpd <-- connect --> socksd <-- SOCKS --> ---- As an advanced example, you can use SSH hopping as fetchmail's plug-in program to access via secure tunnel. This method requires that connect program is insatalled on remote host. There's example of .fetchmailrc bellow. When fetchmail access to mail-server, you will login to remote host using SSH then execute connect program on remote host to relay conversation with pop server. Thus fetchmail can retrieve mails in secure. ---- poll mail-server protocol pop3 plugin "ssh %h connect localhost %p" username "username" password "password" ---- Break The More Restricted Wall ------------------------------ If firewall does not provide SOCKS nor HTTPS other than port 443, you cannot break the wall in usual way. But if you have you own host which is accessible from internet, you can make ssh connection to your own host by configuring sshd as waiting at port 443 instead of standard 22. By this, you can login to your own host via port 443. Once you have logged-in to extenal home machine, you can execute connect as second hop to make connection from your own host to final target host, like this: ---- internal$ cat ~/.ssh/config Host home ProxyCommand connect -H firewall:8080 %h 443 Host server # internal ProxyCommand ssh home connect %h %p internal$ ssh home You are logged in to home! home# exit internal$ ssh server You are logged in to server! server# exit internal$ ---- This way is similar to "Hopping connection via SSH" except configuring outer sshd as waiting at port 443 (https). This means that you have a capability to break the strongly restricted wall if you have own host out side of the wall. ---- | Internal (office) | External (internet) | +--------+ +----------+ +------+ +--------+ | office | | firewall | | home | | server | +--------+ +----------+ +------+ +--------+ <------------------ ssh --------------------->sshd:443 <-- connect --> http-proxy <-- https:443 --> any connect <-- tcp --> port ---- NOTE: If you wanna use this, you should give up hosting https service at port 443 on you external host 'home'. F.Y.I. ------ Difference between SOCKS versions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SOCKS version 4 is first popular implementation which is documented http://www.socks.nec.com/protocol/socks4.protocol[here]. Since this protocol provide IP address based requesting, client program should resolve name of outer host by itself. Version 4a (documented http://www.socks.nec.com/protocol/socks4a.protocol[here]) is enhanced to allow request by hostname instead of IP address. SOCKS version 5 is re-designed protocol stands on experience of version 4 and 4a. There is no compativility with previous versions. Instead, there's some improvement: IPv6 support, request by hostname, UDP proxying, etc. Configuration to use HTTPS ~~~~~~~~~~~~~~~~~~~~~~~~~~ Many http proxy servers implementation supports https CONNECT method (SLL). You might add configuration to allow using https. For the example of http://www.delegate.org/delegate/[DeleGate] (DeleGate is a multi-purpose application level gateway, or a proxy server) , you should add https to REMITTABLE parameter to allow HTTP-Proxy like this: ---- delegated -Pxxxx ...... REMITTABLE='+,https' ... ---- For the case of Squid, you should allow target ports via https by ACL, and so on. SOCKS5 Servers ~~~~~~~~~~~~~~ http://www.socks.nec.com/refsoftware.html[NEC SOCKS Reference Implementation]:: Reference implementation of SOKCS server and library. http://www.inet.no/dante/index.html[Dante]:: Dante is free implementation of SOKCS server and library. Many enhancements and modulalized. http://www.delegate.org/delegate/[DeleGate]:: DeleGate is multi function proxy service provider. DeleGate 5.x.x or earlier can be SOCKS4 server, and 6.x.x can be SOCKS5 and SOCKS4 server. and 7.7.0 or later can be SOCKS5 and SOCKS4a server. Specifications ~~~~~~~~~~~~~~ http://www.socks.nec.com/protocol/socks4.protocol[socks4.protocol.txt]:: SOCKS: A protocol for TCP proxy across firewalls http://www.socks.nec.com/protocol/socks4a.protocol[socks4a.protocol.txt]:: SOCKS 4A: A Simple Extension to SOCKS 4 Protocol http://www.socks.nec.com/rfc/rfc1928.txt[RFC 1928]:: SOCKS Protocol Version 5 http://www.socks.nec.com/rfc/rfc1929.txt[RFC 1929]:: Username/Password Authentication for SOCKS V5 http://www.ietf.org/rfc/rfc2616.txt[RFC 2616]:: Hypertext Transfer Protocol -- HTTP/1.1 http://www.ietf.org/rfc/rfc2617.txt[RFC 2617]:: HTTP Authentication: Basic and Digest Access Authentication Related Links ~~~~~~~~~~~~~ * http://www.openssh.org/[OpenSSH Home] * http://www.ssh.com/[Proprietary SSH] * http://www.taiyo.co.jp/~gotoh/ssh/openssh-socks.html[Using OpenSSH through a SOCKS compatible PROXY on your LAN] (J. Grant) Similars ~~~~~~~~ http://proxytunnel.sourceforge.net/[Proxy Tunnel]:: Proxying command using https CONNECT. http://www.snurgle.org/~griffon/ssh-https-tunnel[stunnel]:: Proxy through an https tunnel (Perl script) // This document is rescured from the document // in the internet web cache. // Original date of this document is 2004-09-06.
{ "pile_set_name": "Github" }
/****************************************************************************** * * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * ******************************************************************************/
{ "pile_set_name": "Github" }
program tutorial; uses Forms, Unit1 in 'Unit1.pas' {Form1}; {$R *.RES} begin Application.Initialize; Application.Title := 'Cheat Engine Tutorial'; Application.CreateForm(TForm1, Form1); Application.Run; end.
{ "pile_set_name": "Github" }
// Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) void (function(root, factory) { if (typeof define === "function" && define.amd) { define(factory) } else if (typeof exports === "object") { module.exports = factory() } else { root.sourceMappingURL = factory() } }(this, function() { var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/ var regex = RegExp( "(?:" + "/\\*" + "(?:\\s*\r?\n(?://)?)?" + "(?:" + innerRegex.source + ")" + "\\s*" + "\\*/" + "|" + "//(?:" + innerRegex.source + ")" + ")" + "\\s*" ) return { regex: regex, _innerRegex: innerRegex, getFrom: function(code) { var match = code.match(regex) return (match ? match[1] || match[2] || "" : null) }, existsIn: function(code) { return regex.test(code) }, removeFrom: function(code) { return code.replace(regex, "") }, insertBefore: function(code, string) { var match = code.match(regex) if (match) { return code.slice(0, match.index) + string + code.slice(match.index) } else { return code + string } } } }));
{ "pile_set_name": "Github" }
// mtbounce.h : Declares the class interfaces for the Bounce // user interface thread. // // This is a part of the Microsoft Foundation Classes C++ library. // Copyright (c) Microsoft Corporation. All rights reserved. // // This source code is only intended as a supplement to the // Microsoft Foundation Classes Reference and related // electronic documentation provided with the library. // See these sources for detailed information regarding the // Microsoft Foundation Classes product. ///////////////////////////////////////////////////////////////////////////// // CBounceThread thread class CBounceThread : public CWinThread { DECLARE_DYNCREATE(CBounceThread) protected: CBounceThread(); // protected constructor used by dynamic creation public: CBounceThread(HWND hwndParent); void operator delete(void* p); // Attributes public: static HANDLE m_hEventBounceThreadKilled; protected: HWND m_hwndParent; CBounceWnd m_wndBounce; // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CBounceThread) public: virtual BOOL InitInstance(); virtual int ExitInstance(); //}}AFX_VIRTUAL // Implementation protected: virtual ~CBounceThread(); // Generated message map functions //{{AFX_MSG(CBounceThread) // NOTE - the ClassWizard will add and remove member functions here. //}}AFX_MSG DECLARE_MESSAGE_MAP() }; /////////////////////////////////////////////////////////////////////////////
{ "pile_set_name": "Github" }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Debug\Exception; @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); /** * @author Fabien Potencier <[email protected]> * * @deprecated since version 2.5, to be removed in 3.0. */ class DummyException extends \ErrorException { }
{ "pile_set_name": "Github" }
import React from 'react'; import Header from './Header'; import Container from './Container'; import Ribbon from './Ribbon'; import '../style/App.css'; const App = () => { return ( <div> <Header /> <Container /> <Ribbon /> </div> ); }; export default App;
{ "pile_set_name": "Github" }
package com.team.ijkplayer.player; import android.content.Context; import android.graphics.Point; import android.util.AttributeSet; import android.view.TextureView; /** * Created by miserydx on 17/9/25. */ public class DXTextureView extends TextureView implements IRenderView { public static final String TAG = DXTextureView.class.getSimpleName(); protected Point mVideoSize; public DXTextureView(Context context) { super(context); init(); } public DXTextureView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public DXTextureView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } private void init(){ mVideoSize = new Point(0, 0); } public void setVideoSize(Point videoSize){ if (videoSize != null && !mVideoSize.equals(videoSize)) { this.mVideoSize = videoSize; requestLayout(); } } @Override public void setRotation(float rotation) { if (rotation != getRotation()) { super.setRotation(rotation); requestLayout(); } } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int viewRotation = (int) getRotation(); //当控件旋转90°的时候,交换宽和高 if (viewRotation == 90 || viewRotation == 270) { int tempMeasureSpec = widthMeasureSpec; widthMeasureSpec = heightMeasureSpec; heightMeasureSpec = tempMeasureSpec; } //视频的宽和高 int videoWidth = mVideoSize.x; int videoHeight = mVideoSize.y; //控件的宽和高,如果是UNSPECIFIED模式,返回视频的宽和高 int width = getDefaultSize(videoWidth, widthMeasureSpec); int height = getDefaultSize(videoHeight, heightMeasureSpec); if (videoWidth > 0 && videoHeight > 0) { int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec); int widthSpecSize = MeasureSpec.getSize(widthMeasureSpec); int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec); int heightSpecSize = MeasureSpec.getSize(heightMeasureSpec); if (widthSpecMode == MeasureSpec.EXACTLY && heightSpecMode == MeasureSpec.EXACTLY) { // 尺寸是固定的 应用于match_parent或精确的数值 width = widthSpecSize; height = heightSpecSize; // 调整控件的宽高比与视频的宽高比一致 // if (videoWidth * height < width * videoHeight) { // // 如果控件的width超过了视频比例,以height为基准,通过视频的宽高比重新换算width // width = height * videoWidth / videoHeight; // } else if(videoWidth * height > width * videoHeight){ // // 如果控件的height超过了视频比例,以width为基准,通过视频的宽高比重新换算height // height = width * videoHeight / videoWidth; // } if(videoHeight > videoWidth){ width = height * videoWidth / videoHeight; } } else if(widthSpecMode == MeasureSpec.EXACTLY) { //如果只有width是精确值,height根据比率换算得出 width = widthSpecSize; height = width * videoHeight / videoWidth; if (heightSpecMode == MeasureSpec.AT_MOST && height > heightSpecSize) { // 如果height超出了控件测量得出的height,那么视频不能完整显示在控件内 // 按照控件测量的height重新换算width,让视频能够在控件内完整显示 height = heightSpecSize; width = height * videoWidth / videoHeight; } } else if(heightSpecMode == MeasureSpec.EXACTLY){ //如果只有height是精确值,width根据比率换算得出 height = heightSpecSize; width = height * videoWidth / videoHeight; if (widthSpecMode == MeasureSpec.AT_MOST && width > widthSpecSize) { // 如果width超出了控件测量得出的width,那么视频不能完整显示在控件内 // 按照控件测量的width重新换算height,让视频能够在控件内完整显示 width = widthSpecSize; height = width * videoHeight / videoWidth; } } else { // 如果width和height都不是精确值,那么先对他们赋值视频的width和height,再根据测量值和宽高比进行调整 width = videoWidth; height = videoHeight; if (heightSpecMode == MeasureSpec.AT_MOST && height > heightSpecSize) { // too tall, decrease both width and height height = heightSpecSize; width = height * videoWidth / videoHeight; } if (widthSpecMode == MeasureSpec.AT_MOST && width > widthSpecSize) { // too wide, decrease both width and height width = widthSpecSize; height = width * videoHeight / videoWidth; } } } setMeasuredDimension(width, height); } }
{ "pile_set_name": "Github" }
var plasmid = require("angularplasmid");
{ "pile_set_name": "Github" }
# YAML marshaling and unmarshaling support for Go [![Build Status](https://travis-ci.org/ghodss/yaml.svg)](https://travis-ci.org/ghodss/yaml) ## Introduction A wrapper around [go-yaml](https://github.com/go-yaml/yaml) designed to enable a better way of handling YAML when marshaling to and from structs. In short, this library first converts YAML to JSON using go-yaml and then uses `json.Marshal` and `json.Unmarshal` to convert to or from the struct. This means that it effectively reuses the JSON struct tags as well as the custom JSON methods `MarshalJSON` and `UnmarshalJSON` unlike go-yaml. For a detailed overview of the rationale behind this method, [see this blog post](http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/). ## Compatibility This package uses [go-yaml](https://github.com/go-yaml/yaml) and therefore supports [everything go-yaml supports](https://github.com/go-yaml/yaml#compatibility). ## Caveats **Caveat #1:** When using `yaml.Marshal` and `yaml.Unmarshal`, binary data should NOT be preceded with the `!!binary` YAML tag. If you do, go-yaml will convert the binary data from base64 to native binary data, which is not compatible with JSON. You can still use binary in your YAML files though - just store them without the `!!binary` tag and decode the base64 in your code (e.g. in the custom JSON methods `MarshalJSON` and `UnmarshalJSON`). This also has the benefit that your YAML and your JSON binary data will be decoded exactly the same way. As an example: ``` BAD: exampleKey: !!binary gIGC GOOD: exampleKey: gIGC ... and decode the base64 data in your code. ``` **Caveat #2:** When using `YAMLToJSON` directly, maps with keys that are maps will result in an error since this is not supported by JSON. This error will occur in `Unmarshal` as well since you can't unmarshal map keys anyways since struct fields can't be keys. ## Installation and usage To install, run: ``` $ go get github.com/ghodss/yaml ``` And import using: ``` import "github.com/ghodss/yaml" ``` Usage is very similar to the JSON library: ```go package main import ( "fmt" "github.com/ghodss/yaml" ) type Person struct { Name string `json:"name"` // Affects YAML field names too. Age int `json:"age"` } func main() { // Marshal a Person struct to YAML. p := Person{"John", 30} y, err := yaml.Marshal(p) if err != nil { fmt.Printf("err: %v\n", err) return } fmt.Println(string(y)) /* Output: age: 30 name: John */ // Unmarshal the YAML back into a Person struct. var p2 Person err = yaml.Unmarshal(y, &p2) if err != nil { fmt.Printf("err: %v\n", err) return } fmt.Println(p2) /* Output: {John 30} */ } ``` `yaml.YAMLToJSON` and `yaml.JSONToYAML` methods are also available: ```go package main import ( "fmt" "github.com/ghodss/yaml" ) func main() { j := []byte(`{"name": "John", "age": 30}`) y, err := yaml.JSONToYAML(j) if err != nil { fmt.Printf("err: %v\n", err) return } fmt.Println(string(y)) /* Output: name: John age: 30 */ j2, err := yaml.YAMLToJSON(y) if err != nil { fmt.Printf("err: %v\n", err) return } fmt.Println(string(j2)) /* Output: {"age":30,"name":"John"} */ } ```
{ "pile_set_name": "Github" }
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library 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 library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .mbcharsetprober import MultiByteCharSetProber from .codingstatemachine import CodingStateMachine from .chardistribution import EUCKRDistributionAnalysis from .mbcssm import EUCKRSMModel class EUCKRProber(MultiByteCharSetProber): def __init__(self): MultiByteCharSetProber.__init__(self) self._mCodingSM = CodingStateMachine(EUCKRSMModel) self._mDistributionAnalyzer = EUCKRDistributionAnalysis() self.reset() def get_charset_name(self): return "EUC-KR"
{ "pile_set_name": "Github" }
// // CountCellExampleViewController.h // JXCategoryView // // Created by jiaxin on 2019/7/20. // Copyright © 2019 jiaxin. All rights reserved. // #import "ContentBaseViewController.h" NS_ASSUME_NONNULL_BEGIN @interface CountCellExampleViewController : ContentBaseViewController @end NS_ASSUME_NONNULL_END
{ "pile_set_name": "Github" }
var fs = require('fs'); var path = require('path'); var projectDir = process.cwd(); var anuDir = path.join(projectDir, './dist/React.js'); var anuSource = fs.readFileSync(anuDir, 'utf-8'); fs.writeFileSync(anuDir, anuSource, { encoding: 'utf8' }); fs.writeFileSync( path.join(projectDir, '../antd-test/node_modules/qreact/dist/React.js'), anuSource, { encoding: 'utf8' }); fs.writeFileSync( path.join(projectDir, '../yo-router/node_modules/anujs/dist/React.js'), anuSource, { encoding: 'utf8' }); console.log("复制antd-test目录,可以开始对antd3进行测试"); // eslint-disable-line
{ "pile_set_name": "Github" }
using System.Runtime.Serialization; using Sledge.BspEditor.Primitives.MapObjects; namespace Sledge.BspEditor.Primitives.MapData { /// <summary> /// Base interface for generic map metadata /// </summary> public interface IMapData : ISerializable, IMapElement { bool AffectsRendering { get; } } }
{ "pile_set_name": "Github" }
#ifdef BLOG_CURRENT_CHANNEL #undef BLOG_CURRENT_CHANNEL #endif #define BLOG_CURRENT_CHANNEL BLOG_CHANNEL_FrameDecider
{ "pile_set_name": "Github" }
from __future__ import absolute_import, print_function import sys globalvars = {} lines = sys.stdin.readlines() while lines: l = lines.pop(0) if l.startswith("SALT"): print(l[:-1]) elif l.startswith(">>> "): snippet = l[4:] while lines and lines[0].startswith("... "): l = lines.pop(0) snippet += l[4:] c = compile(snippet, "<heredoc>", "single") try: exec(c, globalvars) except Exception as inst: print(repr(inst))
{ "pile_set_name": "Github" }
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.Aws.WafV2.Inputs { public sealed class RuleGroupRuleStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchMethodGetArgs : Pulumi.ResourceArgs { public RuleGroupRuleStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchMethodGetArgs() { } } }
{ "pile_set_name": "Github" }
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "errors" "fmt" "github.com/aws/aws-sdk-go-v2/aws" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" internalendpoints "github.com/aws/aws-sdk-go-v2/service/iam/internal/endpoints" "github.com/awslabs/smithy-go/middleware" smithyhttp "github.com/awslabs/smithy-go/transport/http" "net/url" ) // ResolverOptions is the service endpoint resolver options type ResolverOptions = internalendpoints.Options // EndpointResolver interface for resolving service endpoints. type EndpointResolver interface { ResolveEndpoint(region string, options ResolverOptions) (aws.Endpoint, error) } var _ EndpointResolver = &internalendpoints.Resolver{} // NewDefaultEndpointResolver constructs a new service endpoint resolver func NewDefaultEndpointResolver() *internalendpoints.Resolver { return internalendpoints.New() } // EndpointResolverFunc is a helper utility that wraps a function so it satisfies // the EndpointResolver interface. This is useful when you want to add additional // endpoint resolving logic, or stub out specific endpoints with custom values. type EndpointResolverFunc func(region string, options ResolverOptions) (aws.Endpoint, error) func (fn EndpointResolverFunc) ResolveEndpoint(region string, options ResolverOptions) (endpoint aws.Endpoint, err error) { return fn(region, options) } func resolveDefaultEndpointConfiguration(o *Options) { if o.EndpointResolver != nil { return } o.EndpointResolver = NewDefaultEndpointResolver() } type ResolveEndpoint struct { Resolver EndpointResolver Options ResolverOptions } func (*ResolveEndpoint) ID() string { return "ResolveEndpoint" } func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } if m.Resolver == nil { return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") } var endpoint aws.Endpoint endpoint, err = m.Resolver.ResolveEndpoint(awsmiddleware.GetRegion(ctx), m.Options) if err != nil { return out, metadata, fmt.Errorf("failed to resolve service endpoint") } req.URL, err = url.Parse(endpoint.URL) if err != nil { return out, metadata, fmt.Errorf("failed to parse endpoint URL: %w", err) } if len(awsmiddleware.GetSigningName(ctx)) == 0 { signingName := endpoint.SigningName if len(signingName) == 0 { signingName = "iam" } ctx = awsmiddleware.SetSigningName(ctx, signingName) } ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion) return next.HandleSerialize(ctx, in) } type ResolveEndpointMiddlewareOptions interface { GetEndpointResolver() EndpointResolver GetEndpointOptions() ResolverOptions } func AddResolveEndpointMiddleware(stack *middleware.Stack, options ResolveEndpointMiddlewareOptions) { stack.Serialize.Insert(&ResolveEndpoint{ Resolver: options.GetEndpointResolver(), Options: options.GetEndpointOptions(), }, "OperationSerializer", middleware.Before) } func RemoveResolveEndpointMiddleware(stack *middleware.Stack) error { return stack.Serialize.Remove((&ResolveEndpoint{}).ID()) } type wrappedEndpointResolver struct { awsResolver aws.EndpointResolver resolver EndpointResolver } func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options ResolverOptions) (endpoint aws.Endpoint, err error) { if w.awsResolver == nil { goto fallback } endpoint, err = w.awsResolver.ResolveEndpoint(ServiceID, region) if err == nil { return endpoint, nil } if nf := (&aws.EndpointNotFoundError{}); !errors.As(err, &nf) { return endpoint, err } fallback: if w.resolver == nil { return endpoint, fmt.Errorf("default endpoint resolver provided was nil") } return w.resolver.ResolveEndpoint(region, options) } // WithEndpointResolver returns an EndpointResolver that first delegates endpoint // resolution to the awsResolver. If awsResolver returns aws.EndpointNotFoundError // error, the resolver will use the the provided fallbackResolver for resolution. // awsResolver and fallbackResolver must not be nil func WithEndpointResolver(awsResolver aws.EndpointResolver, fallbackResolver EndpointResolver) EndpointResolver { return &wrappedEndpointResolver{ awsResolver: awsResolver, resolver: fallbackResolver, } }
{ "pile_set_name": "Github" }
#ifndef POMELO_CLIENT_H #define POMELO_CLIENT_H #ifdef __cplusplus extern "C" { #endif #ifdef _WIN32 # if defined(BUILDING_PC_SHARED) # define PC_EXTERN __declspec(dllexport) # else # define PC_EXTERN /* nothing */ # endif #elif __GNUC__ >= 4 # define PC_EXTERN __attribute__((visibility("default"))) #else # define PC_EXTERN /* nothing */ #endif #include "uv.h" #include "jansson.h" #include "pomelo-private/map.h" #include "time.h" #define PC_TYPE "c" #define PC_VERSION "0.3.4" #define PC_EVENT_DISCONNECT "disconnect" #define PC_EVENT_TIMEOUT "timeout" #define PC_EVENT_KICK "onKick" #define PC_EVENT_RECONNECT "reconnect" #define PC_PROTO_VERSION "protoVersion" #define PC_PROTO_CLIENT "clientProtos" #define PC_PROTO_SERVER "serverProtos" typedef struct pc_client_s pc_client_t; typedef struct pc_listener_s pc_listener_t; typedef struct pc_req_s pc_req_t; typedef struct pc_connect_s pc_connect_t; typedef struct pc_tcp_req_s pc_tcp_req_t; typedef struct pc_request_s pc_request_t; typedef struct pc_notify_s pc_notify_t; typedef struct pc_msg_s pc_msg_t; typedef struct pc_pkg_parser_s pc_pkg_parser_t; typedef uv_buf_t pc_buf_t; /** * State machine for Pomelo package parser */ typedef enum { PC_PKG_HEAD = 1, /* parsing header */ PC_PKG_BODY, /* parsing body */ PC_PKG_CLOSED } pc_pkg_parser_state; /** * Package type of Pomelo package */ typedef enum pc_pkg_type_e { PC_PKG_HANDSHAKE = 1, PC_PKG_HANDSHAKE_ACK, PC_PKG_HEARBEAT, PC_PKG_DATA, PC_PKG_KICK } pc_pkg_type; /** * Pomelo client states. */ typedef enum { PC_ST_INITED = 1, PC_ST_CONNECTING, PC_ST_CONNECTED, PC_ST_WORKING, PC_ST_DISCONNECTING, PC_ST_CLOSED } pc_client_state; /** * Pomelo client async request types. */ typedef enum { PC_CONNECT, PC_REQUEST, PC_NOTIFY } pc_req_type; /** * State of transport. */ typedef enum { PC_TP_ST_INITED = 1, PC_TP_ST_CONNECTING, PC_TP_ST_WORKING, PC_TP_ST_CLOSED } pc_transport_state; /** * operation for proto files. */ typedef enum { PC_PROTO_OP_READ = 1, PC_PROTO_OP_WRITE, PC_PROTO_OP_UNKONWN } pc_proto_op; /** * Callbacks */ /** * Event callback. * * @param client client instance that fire the event. * @param event event name that registered before. * @param data attach data of the event. */ typedef void (*pc_event_cb)(pc_client_t *client, const char *event, void *data); /** * Connection established callback. * * @param req connect request. * @param status connect status. 0 for ok and -1 for error. */ typedef void (*pc_connect_cb)(pc_connect_t* req, int status); /** * Request callback. * * @param req request instance. * @param status request status. 0 for ok and -1 for error. * @param resp response message from server, NULL for error. */ typedef void (*pc_request_cb)(pc_request_t *req, int status, json_t *resp); /** * Notify callback. * * @param req request instance. * @param status notify status. o for ok and -1 for error. */ typedef void (*pc_notify_cb)(pc_notify_t *req, int status); /** * Handshake callback for client which would be fired during handshake phase and * passing the customized handshake information from server. * * @param client client instance. * @param msg customized handshake information from server. * @return 0 for ok and -1 for error and terminate the connection. */ typedef int (*pc_handshake_cb)(pc_client_t *client, json_t *msg); /** * Message parse callback which would be fired when a new message arrived. * * @param client client instance. * @param data original message data in bytes. * @param len length of the data. * @return the parse result or NULL for error. */ typedef pc_msg_t *(*pc_msg_parse_cb)(pc_client_t *client, const char *data, size_t len); /** * Message parse done callback which would be fired when the the message has * processed to release the resources created in the message parsing phase. * * @param client client instance. * @param msg message instance. */ typedef void (*pc_msg_parse_done_cb)(pc_client_t *client, pc_msg_t *msg); /** * Message encode callback which would be fired when a new request or notify is * emitted. This is the place to customized the message layer encode and the * result would be delivered on the Pomelo package layer. * * @param client client instance. * @param reqId request id, positive for request and 0 for notify. * @param route route string. * @param msg message content. * @return encode result, buf.len = -1 for error. */ typedef pc_buf_t (*pc_msg_encode_cb)(pc_client_t *client, uint32_t reqId, const char* route, json_t *msg); /** * Message encode done callback which would be fired when the encode data has * been delivered or meeting some error to release the resources created during * the encode phase. * * @param client client instance. * @param buf encode result. */ typedef void (*pc_msg_encode_done_cb)(pc_client_t *client, pc_buf_t buf); typedef void (*pc_proto_cb)(pc_client_t *client, pc_proto_op op, const char* fileName, void *data); /** * Simple structure for memory block. * The pc_buf_s is cheap and could be passed by value. */ struct pc_buf_s { char *base; size_t len; }; /** * Transport structure. */ typedef struct { pc_client_t *client; uv_tcp_t *socket; pc_transport_state state; } pc_transport_t; #define PC_REQ_FIELDS \ /* private */ \ pc_client_t *client; \ pc_transport_t *transport; \ pc_req_type type; \ void *data; \ #define PC_TCP_REQ_FIELDS \ /* public */ \ const char *route; \ json_t *msg; \ /** * The abstract base class of all async request in Pomelo client. */ struct pc_req_s { PC_REQ_FIELDS }; /** * The abstract base class of all tcp async request and a subclass of pc_req_t. */ struct pc_tcp_req_s { PC_REQ_FIELDS PC_TCP_REQ_FIELDS }; /** * Pomelo client instance */ struct pc_client_s { /* public */ pc_client_state state; /* private */ uv_loop_t *uv_loop; pc_transport_t *transport; pc_map_t *listeners; pc_map_t *requests; pc_pkg_parser_t *pkg_parser; int heartbeat; int timeout; json_t *handshake_opts; pc_handshake_cb handshake_cb; pc_connect_t *conn_req; json_t *route_to_code; json_t *code_to_route; json_t *server_protos; json_t *client_protos; json_t *proto_ver; const char *proto_read_dir; const char *proto_write_dir; pc_proto_cb proto_event_cb; pc_msg_parse_cb parse_msg; pc_msg_parse_done_cb parse_msg_done; pc_msg_encode_cb encode_msg; pc_msg_encode_done_cb encode_msg_done; uv_timer_t *heartbeat_timer; uv_timer_t *timeout_timer; uv_timer_t *handshake_timer; uv_async_t *close_async; uv_mutex_t mutex; uv_cond_t cond; uv_mutex_t listener_mutex; uv_thread_t worker; uv_mutex_t state_mutex; uv_timer_t reconnect_timer; int enable_reconnect; int reconnects; int reconnecting; int max_reconnects_incr; int reconnect_delay; int reconnect_delay_max; int enable_exp_backoff; struct sockaddr_in addr; char* host; int port; }; /** * Connect request class is a subclass of pc_req_t. * Connect is the async context for a connection request to server. */ struct pc_connect_s { PC_REQ_FIELDS /* public */ struct sockaddr_in *address; pc_connect_cb cb; /* private */ uv_tcp_t *socket; }; /** * Pomelo request class is a subclass of pc_tcp_req_t. * Request is the async context for a Pomelo request to server. */ struct pc_request_s { PC_REQ_FIELDS PC_TCP_REQ_FIELDS uint32_t id; pc_request_cb cb; ngx_queue_t queue; }; /** * Pomelo notify class is a subclass of pc_tcp_req_t. * Notify is the async context for a Pomelo notify to server. */ struct pc_notify_s { PC_REQ_FIELDS PC_TCP_REQ_FIELDS pc_notify_cb cb; }; /** * Message structure. */ struct pc_msg_s { uint32_t id; const char* route; json_t *msg; }; /** * Create and initiate Pomelo client intance. * * @return Pomelo client instance */ PC_EXTERN pc_client_t *pc_client_new(); /** * Create and init Pomelo client instance with reconnect enable * * @param delay delay time in second * @param delay_max the max delay time in second * @param exp_backoff whether enable exponetial backoff * * For example, if 2 -> delay, 10 -> delay_max, then the reconnect delay will be * 2, 4, 6, 8, 10, 10, 10 seconds... * if 2 -> delay, 30 -> delay_max enable exponetial backoff, the reconnect delay will be * 2, 4, 8, 16, 30, 30 seconds... */ PC_EXTERN pc_client_t *pc_client_new_with_reconnect(int delay, int delay_max, int exp_backoff); /** * Disconnect Pomelo client and reset all status back to initialted. * * @param client Pomelo client instance. */ PC_EXTERN void pc_client_disconnect(pc_client_t *client); /** * Stop the connection of the client. It is suitable for calling in the child * thread and the main thread called the pc_client_join funtion the wait the * worker child thread return. * * @param client client instance. */ PC_EXTERN void pc_client_stop(pc_client_t *client); /** * Destroy and disconnect the connection of the client instance. * * @param client client instance. */ PC_EXTERN void pc_client_destroy(pc_client_t *client); /** * Join and wait the worker child thread return. It is suitable for the * situation that the main thread has nothing to do after the connction * established. * * @param client client instance. * @return 0 for ok or error code for error. */ PC_EXTERN int pc_client_join(pc_client_t *client); /** * Create and initiate a request instance. * * @return req request instance */ PC_EXTERN pc_request_t *pc_request_new(); /** * Destroy and release inner resource of a request instance. * * @param req request instance to be destroied. */ PC_EXTERN void pc_request_destroy(pc_request_t *req); /** * Connect the client to the server which would create a worker child thread * and connect to the server. * * @param client client instance. * @param addr server address. * @return 0 or -1. */ PC_EXTERN int pc_client_connect(pc_client_t *client, struct sockaddr_in *addr); /* * Connect the client to server just like pc_client_connect, * except that it's the asynchronous version for it. * The user should be responsible to conn_req's allocation, initialization and reclamation * * @param client client instance * @param conn_req connect request which are allocated and initialized by pc_connect_req_new * @return 0 or -1 */ PC_EXTERN int pc_client_connect2(pc_client_t *client, pc_connect_t *conn_req, pc_connect_cb cb); /* * connect asynchronously, when success to connect, * it will emit the event reconnect * * @param client client instance * @param addr server address. * @return 0 or -1 */ PC_EXTERN int pc_client_connect3(pc_client_t *client, struct sockaddr_in* addr); /** * same as pc_client_connect3, but use (host:port) * * @param client client instance * @param addr server address * @return 0 or -1 */ PC_EXTERN int pc_client_connect4(pc_client_t *client, const char* host, int port); /* * * Use for async connection * * @param addr address to which the connection is made * @return an instance of pc_connect_t, which should be released manually by user. */ PC_EXTERN pc_connect_t* pc_connect_req_new(struct sockaddr_in *addr); /* * Destroy instance of pc_connect_t * * @param conn_req pc_connect_t instance * @return none */ PC_EXTERN void pc_connect_req_destroy(pc_connect_t *conn_req); /** * Send rerquest to server. * The message object and request object must keep * until the pc_request_cb invoked. * * @param client Pomelo client instance * @param req initiated request instance * @param route route string * @param msg message object * @param cb request callback * @return 0 or -1 */ PC_EXTERN int pc_request(pc_client_t *client, pc_request_t *req, const char *route, json_t *msg, pc_request_cb cb); /** * Create and initiate notify instance. * * @return notify instance */ PC_EXTERN pc_notify_t *pc_notify_new(); /** * Destroy and release inner resource of a notify instance. * * @param req notify instance to be destroied. */ PC_EXTERN void pc_notify_destroy(pc_notify_t *req); /** * Send notify to server. * The message object and notify object must keep * until the pc_notify_cb invoked. * * @param client Pomelo client instance * @param req initiated notify instance * @param route route string * @param msg message object * @param cb notify callback * @return 0 or -1 */ PC_EXTERN int pc_notify(pc_client_t *client, pc_notify_t *req, const char *route, json_t *msg, pc_notify_cb cb); /** * Register a listener in the client. * * @param client client instance. * @param event event name. * @param event_cb event callback. * @return 0 or -1. */ PC_EXTERN int pc_add_listener(pc_client_t *client, const char *event, pc_event_cb event_cb); /** * Remove a listener in the client. * * @param client client instance. * @param event event name. * @param event_cb event callback. * @return void. */ PC_EXTERN void pc_remove_listener(pc_client_t *client, const char *event, pc_event_cb event_cb); /** * Emit a event from the client. * * @param client client instance. * @param event event name. * @param data attach data of the event. */ PC_EXTERN void pc_emit_event(pc_client_t *client, const char *event, void *data); /** * jansson memory malloc, free self-defined function. * * @param malloc_fn malloc function. * @param free_fn free function. */ PC_EXTERN void pc_json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn); /** * Init protobuf settings, set the read/write proto files directorys * * @param client client instance. * @param proto_read_dir directory of proto files to read. * @param proto_write_dir directory of proto files to write. */ PC_EXTERN void pc_proto_init(pc_client_t *client, const char *proto_read_dir, const char *proto_write_dir); /** * Init protobuf settings, set the callback for read/write proto files * * @param client client instance. * @param proto_cb callback when read or write proto files. */ PC_EXTERN void pc_proto_init2(pc_client_t *client, pc_proto_cb proto_cb); PC_EXTERN void pc_proto_copy(pc_client_t *client, json_t *proto_ver, json_t *client_protos, json_t *server_protos); PC_EXTERN extern volatile time_t pc_last_update_time; /* Don't export the private CPP symbols. */ #undef PC_TCP_REQ_FIELDS #undef PC_REQ_FIELDS #ifdef __cplusplus } #endif #endif /* POMELO_CLIENT_H */
{ "pile_set_name": "Github" }
# core-util-is The `util.is*` functions introduced in Node v0.12.
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/integration/xmpp https://www.springframework.org/schema/integration/xmpp/spring-integration-xmpp.xsd" xmlns:context="http://www.springframework.org/schema/context" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-xmpp="http://www.springframework.org/schema/integration/xmpp"> <context:property-placeholder location="classpath:test.properties"/> <int-xmpp:xmpp-connection user="${user.1.login}" password="${user.1.password}" host="${user.1.host}" service-name="${user.1.service}"/> <int:channel id="xmppInput"/> <int-xmpp:outbound-channel-adapter channel="xmppInput"/> </beans>
{ "pile_set_name": "Github" }
:man_page: mongoc_stream_tls_t mongoc_stream_tls_t =================== Synopsis -------- .. code-block:: c typedef struct _mongoc_stream_tls_t mongoc_stream_tls_t ``mongoc_stream_tls_t`` is a :symbol:`mongoc_stream_t` subclass for working with TLS streams.
{ "pile_set_name": "Github" }
#!/bin/bash export HSTNME=`hostname` if test $HSTNME = tls-ref-cp10; then ossl=/usr/bin/openssl; fi if test $HSTNME = tls-ref-cp20; then ossl=/opt/cryptopack2/bin/openssl; fi if test $HSTNME = tls-ref-cp21; then ossl=/opt/cryptopack2/bin/openssl; fi $ossl $* exit $?
{ "pile_set_name": "Github" }
/* * Copyright 2019, OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.opentelemetry.baggage; import io.grpc.Context; import io.opentelemetry.context.Scope; import io.opentelemetry.internal.Utils; import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.ThreadSafe; /** * No-op implementations of {@link BaggageManager}. * * @since 0.9.0 */ @ThreadSafe public final class DefaultBaggageManager implements BaggageManager { private static final DefaultBaggageManager INSTANCE = new DefaultBaggageManager(); /** * Returns a {@code BaggageManager} singleton that is the default implementation for {@link * BaggageManager}. * * @return a {@code BaggageManager} singleton that is the default implementation for {@link * BaggageManager}. */ public static BaggageManager getInstance() { return INSTANCE; } @Override public Baggage getCurrentBaggage() { return BaggageUtils.getCurrentBaggage(); } @Override public Baggage.Builder baggageBuilder() { return new NoopBaggageBuilder(); } @Override public Scope withContext(Baggage distContext) { return BaggageUtils.currentContextWith(distContext); } @Immutable private static final class NoopBaggageBuilder implements Baggage.Builder { @Override public Baggage.Builder setParent(Baggage parent) { Utils.checkNotNull(parent, "parent"); return this; } @Override public Baggage.Builder setParent(Context context) { Utils.checkNotNull(context, "context"); return this; } @Override public Baggage.Builder setNoParent() { return this; } @Override public Baggage.Builder put(String key, String value, EntryMetadata entryMetadata) { Utils.checkNotNull(key, "key"); Utils.checkNotNull(value, "value"); Utils.checkNotNull(entryMetadata, "entryMetadata"); return this; } @Override public Baggage.Builder remove(String key) { Utils.checkNotNull(key, "key"); return this; } @Override public Baggage build() { return EmptyBaggage.getInstance(); } } }
{ "pile_set_name": "Github" }
<html> <head><style type="text/css">body { padding: 50px; } </style> </head> <body></body> </html>
{ "pile_set_name": "Github" }
{ "name": "accesso, LLC", "displayName": "accesso", "properties": [ "accesso.com" ], "prevalence": { "tracking": 0.000103, "nonTracking": 0, "total": 0.000103 } }
{ "pile_set_name": "Github" }
// Automatically generated by the Fast Binary Encoding compiler, do not modify! // https://github.com/chronoxor/FastBinaryEncoding // Source: test.fbe // Version: 1.4.0.0 import Foundation import ChronoxorFbe import ChronoxorProto // Fast Binary Encoding optional UInt64 final model class FinalModelOptionalUInt64: FinalModel { var _buffer: Buffer var _offset: Int // Base field model value let value: ChronoxorFbe.FinalModelUInt64 required init() { let buffer = Buffer() let offset = 0 _buffer = buffer _offset = offset value = ChronoxorFbe.FinalModelUInt64(buffer: buffer, offset: offset) } required init(buffer: Buffer, offset: Int) { _buffer = buffer _offset = offset value = ChronoxorFbe.FinalModelUInt64(buffer: buffer, offset: offset) } func fbeAllocationSize(value optional: UInt64?) -> Int { return 1 + (optional != nil ? value.fbeAllocationSize(value: optional!) : 0) } func hasValue() -> Bool { if _buffer.offset + fbeOffset + 1 > _buffer.size { return false } let fbeHasValue = Int32(readInt8(offset: fbeOffset)) return fbeHasValue != 0 } public func verify() -> Int { if _buffer.offset + fbeOffset + 1 > _buffer.size { return Int.max } let fbeHasValue = Int(readInt8(offset: fbeOffset)) if fbeHasValue == 0 { return 1 } _buffer.shift(offset: fbeOffset + 1) let fbeResult = value.verify() _buffer.unshift(offset: fbeOffset + 1) return 1 + fbeResult } public func get(size: inout Size) -> UInt64? { if _buffer.offset + fbeOffset + 1 > _buffer.size { assertionFailure("Model is broken!") size.value = 0 return nil } if !hasValue() { size.value = 1 return nil } _buffer.shift(offset: fbeOffset + 1) let optional = value.get(size: &size) _buffer.unshift(offset: fbeOffset + 1) size.value += 1 return optional } // Set the optional value public func set(value optional: UInt64?) throws -> Int { if _buffer.offset + fbeOffset + 1 > _buffer.size { assertionFailure("Model is broken!") return 0 } let fbeHasValue = optional != nil ? 1 : 0 write(offset: fbeOffset, value: Int8(fbeHasValue)) if fbeHasValue == 0 { return 1 } _buffer.shift(offset: fbeOffset + 1) let size = try value.set(value: optional!) _buffer.unshift(offset: fbeOffset + 1) return 1 + size } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2013-07-20 Bernard first version */ #ifndef __GIC_H__ #define __GIC_H__ int arm_gic_dist_init(rt_uint32_t index, rt_uint32_t dist_base, int irq_start); int arm_gic_cpu_init(rt_uint32_t index, rt_uint32_t cpu_base); void arm_gic_mask(rt_uint32_t index, int irq); void arm_gic_umask(rt_uint32_t index, int irq); void arm_gic_set_cpu(rt_uint32_t index, int irq, unsigned int cpumask); void arm_gic_set_group(rt_uint32_t index, int vector, int group); int arm_gic_get_active_irq(rt_uint32_t index); void arm_gic_ack(rt_uint32_t index, int irq); void arm_gic_trigger(rt_uint32_t index, int target_cpu, int irq); void arm_gic_clear_sgi(rt_uint32_t index, int target_cpu, int irq); void arm_gic_dump_type(rt_uint32_t index); #endif
{ "pile_set_name": "Github" }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>atanh</title> <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.74.0"> <link rel="home" href="../../index.html" title="Complex Number TR1 Algorithms"> <link rel="up" href="../inverse_complex.html" title="Complex Number Inverse Trigonometric Functions"> <link rel="prev" href="acosh.html" title="acosh"> <link rel="next" href="history.html" title="History"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td> <td align="center"><a href="../../../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="acosh.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../inverse_complex.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="history.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section" lang="en"> <div class="titlepage"><div><div><h3 class="title"> <a name="complex_number_tr1_algorithms.inverse_complex.atanh"></a><a class="link" href="atanh.html" title="atanh">atanh</a> </h3></div></div></div> <a name="complex_number_tr1_algorithms.inverse_complex.atanh.header_"></a><h5> <a name="id997756"></a> <a class="link" href="atanh.html#complex_number_tr1_algorithms.inverse_complex.atanh.header_">Header:</a> </h5> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">complex</span><span class="special">/</span><span class="identifier">atanh</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span> </pre> <a name="complex_number_tr1_algorithms.inverse_complex.atanh.synopsis_"></a><h5> <a name="id997824"></a> <a class="link" href="atanh.html#complex_number_tr1_algorithms.inverse_complex.atanh.synopsis_">Synopsis:</a> </h5> <pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;</span> <span class="identifier">atanh</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;&amp;</span> <span class="identifier">z</span><span class="special">);</span> </pre> <p> <span class="bold"><strong>Effects: </strong></span> returns the inverse hyperbolic tangent of the complex number z. </p> <p> <span class="bold"><strong>Formula: </strong></span> <span class="inlinemediaobject"><img src="../../../../images/atanh.png" alt="atanh"></span> </p> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2005 John Maddock<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="acosh.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../inverse_complex.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="history.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
{ "pile_set_name": "Github" }
HTML.CoreModules TYPE: lookup VERSION: 2.0.0 --DEFAULT-- array ( 'Structure' => true, 'Text' => true, 'Hypertext' => true, 'List' => true, 'NonXMLCommonAttributes' => true, 'XMLCommonAttributes' => true, 'CommonAttributes' => true, ) --DESCRIPTION-- <p> Certain modularized doctypes (XHTML, namely), have certain modules that must be included for the doctype to be an conforming document type: put those modules here. By default, XHTML's core modules are used. You can set this to a blank array to disable core module protection, but this is not recommended. </p> --# vim: et sw=4 sts=4
{ "pile_set_name": "Github" }
(ns ^{:no-doc true} clj-kondo.impl.rewrite-clj.node.coerce (:require [clj-kondo.impl.rewrite-clj.potemkin :refer [defprotocol+]] [clj-kondo.impl.rewrite-clj.node comment forms integer keyword quote string uneval [meta :refer [meta-node]] [protocols :as node :refer [NodeCoerceable coerce]] [reader-macro :refer [reader-macro-node var-node]] [seq :refer [vector-node list-node set-node map-node]] [token :refer [token-node]] [whitespace :as ws]]) (:import [clj_kondo.impl.rewrite_clj.node.comment CommentNode] [clj_kondo.impl.rewrite_clj.node.forms FormsNode] [clj_kondo.impl.rewrite_clj.node.integer IntNode] [clj_kondo.impl.rewrite_clj.node.keyword KeywordNode] [clj_kondo.impl.rewrite_clj.node.meta MetaNode] [clj_kondo.impl.rewrite_clj.node.quote QuoteNode] [clj_kondo.impl.rewrite_clj.node.reader_macro ReaderNode ReaderMacroNode DerefNode] [clj_kondo.impl.rewrite_clj.node.seq SeqNode] [clj_kondo.impl.rewrite_clj.node.string StringNode] [clj_kondo.impl.rewrite_clj.node.token TokenNode] [clj_kondo.impl.rewrite_clj.node.uneval UnevalNode] [clj_kondo.impl.rewrite_clj.node.whitespace WhitespaceNode NewlineNode])) ;; ## Helpers (defn- node-with-meta [node value] (if (instance? clojure.lang.IMeta value) (let [mta (meta value)] (if (empty? mta) node (meta-node (coerce mta) node))) node)) ;; ## Tokens (extend-protocol NodeCoerceable Object (coerce [v] (node-with-meta (token-node v) v))) (extend-protocol NodeCoerceable nil (coerce [v] (token-node nil))) ;; ## Seqs (defn- seq-node [f sq] (node-with-meta (->> (map coerce sq) (ws/space-separated) (vec) (f)) sq)) (extend-protocol NodeCoerceable clojure.lang.IPersistentVector (coerce [sq] (seq-node vector-node sq)) clojure.lang.IPersistentList (coerce [sq] (seq-node list-node sq)) clojure.lang.IPersistentSet (coerce [sq] (seq-node set-node sq))) ;; ## Maps (let [comma (ws/whitespace-nodes ", ") space (ws/whitespace-node " ")] (defn- map->children [m] (->> (mapcat (fn [[k v]] (list* (coerce k) space (coerce v) comma)) m) (drop-last (count comma)) (vec)))) (defn- record-node [m] (reader-macro-node [(token-node (symbol (.getName ^Class (class m)))) (map-node (map->children m))])) (defn- is-record? [v] (instance? clojure.lang.IRecord v)) (extend-protocol NodeCoerceable clojure.lang.IPersistentMap (coerce [m] (node-with-meta (if (is-record? m) (record-node m) (map-node (map->children m))) m))) ;; ## Vars (extend-protocol NodeCoerceable clojure.lang.Var (coerce [v] (-> (str v) (subs 2) (symbol) (token-node) (vector) (var-node)))) ;; ## Existing Nodes (extend-protocol NodeCoerceable CommentNode (coerce [v] v) FormsNode (coerce [v] v) IntNode (coerce [v] v) KeywordNode (coerce [v] v) MetaNode (coerce [v] v) QuoteNode (coerce [v] v) ReaderNode (coerce [v] v) ReaderMacroNode (coerce [v] v) DerefNode (coerce [v] v) StringNode (coerce [v] v) UnevalNode (coerce [v] v) NewlineNode (coerce [v] v) SeqNode (coerce [v] v) TokenNode (coerce [v] v) WhitespaceNode (coerce [v] v))
{ "pile_set_name": "Github" }
// Copyright 2011 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 packet implements parsing and serialization of OpenPGP packets, as // specified in RFC 4880. package packet // import "golang.org/x/crypto/openpgp/packet" import ( "bufio" "crypto/aes" "crypto/cipher" "crypto/des" "crypto/rsa" "io" "math/big" "golang.org/x/crypto/cast5" "golang.org/x/crypto/openpgp/errors" ) // readFull is the same as io.ReadFull except that reading zero bytes returns // ErrUnexpectedEOF rather than EOF. func readFull(r io.Reader, buf []byte) (n int, err error) { n, err = io.ReadFull(r, buf) if err == io.EOF { err = io.ErrUnexpectedEOF } return } // readLength reads an OpenPGP length from r. See RFC 4880, section 4.2.2. func readLength(r io.Reader) (length int64, isPartial bool, err error) { var buf [4]byte _, err = readFull(r, buf[:1]) if err != nil { return } switch { case buf[0] < 192: length = int64(buf[0]) case buf[0] < 224: length = int64(buf[0]-192) << 8 _, err = readFull(r, buf[0:1]) if err != nil { return } length += int64(buf[0]) + 192 case buf[0] < 255: length = int64(1) << (buf[0] & 0x1f) isPartial = true default: _, err = readFull(r, buf[0:4]) if err != nil { return } length = int64(buf[0])<<24 | int64(buf[1])<<16 | int64(buf[2])<<8 | int64(buf[3]) } return } // partialLengthReader wraps an io.Reader and handles OpenPGP partial lengths. // The continuation lengths are parsed and removed from the stream and EOF is // returned at the end of the packet. See RFC 4880, section 4.2.2.4. type partialLengthReader struct { r io.Reader remaining int64 isPartial bool } func (r *partialLengthReader) Read(p []byte) (n int, err error) { for r.remaining == 0 { if !r.isPartial { return 0, io.EOF } r.remaining, r.isPartial, err = readLength(r.r) if err != nil { return 0, err } } toRead := int64(len(p)) if toRead > r.remaining { toRead = r.remaining } n, err = r.r.Read(p[:int(toRead)]) r.remaining -= int64(n) if n < int(toRead) && err == io.EOF { err = io.ErrUnexpectedEOF } return } // partialLengthWriter writes a stream of data using OpenPGP partial lengths. // See RFC 4880, section 4.2.2.4. type partialLengthWriter struct { w io.WriteCloser lengthByte [1]byte } func (w *partialLengthWriter) Write(p []byte) (n int, err error) { for len(p) > 0 { for power := uint(14); power < 32; power-- { l := 1 << power if len(p) >= l { w.lengthByte[0] = 224 + uint8(power) _, err = w.w.Write(w.lengthByte[:]) if err != nil { return } var m int m, err = w.w.Write(p[:l]) n += m if err != nil { return } p = p[l:] break } } } return } func (w *partialLengthWriter) Close() error { w.lengthByte[0] = 0 _, err := w.w.Write(w.lengthByte[:]) if err != nil { return err } return w.w.Close() } // A spanReader is an io.LimitReader, but it returns ErrUnexpectedEOF if the // underlying Reader returns EOF before the limit has been reached. type spanReader struct { r io.Reader n int64 } func (l *spanReader) Read(p []byte) (n int, err error) { if l.n <= 0 { return 0, io.EOF } if int64(len(p)) > l.n { p = p[0:l.n] } n, err = l.r.Read(p) l.n -= int64(n) if l.n > 0 && err == io.EOF { err = io.ErrUnexpectedEOF } return } // readHeader parses a packet header and returns an io.Reader which will return // the contents of the packet. See RFC 4880, section 4.2. func readHeader(r io.Reader) (tag packetType, length int64, contents io.Reader, err error) { var buf [4]byte _, err = io.ReadFull(r, buf[:1]) if err != nil { return } if buf[0]&0x80 == 0 { err = errors.StructuralError("tag byte does not have MSB set") return } if buf[0]&0x40 == 0 { // Old format packet tag = packetType((buf[0] & 0x3f) >> 2) lengthType := buf[0] & 3 if lengthType == 3 { length = -1 contents = r return } lengthBytes := 1 << lengthType _, err = readFull(r, buf[0:lengthBytes]) if err != nil { return } for i := 0; i < lengthBytes; i++ { length <<= 8 length |= int64(buf[i]) } contents = &spanReader{r, length} return } // New format packet tag = packetType(buf[0] & 0x3f) length, isPartial, err := readLength(r) if err != nil { return } if isPartial { contents = &partialLengthReader{ remaining: length, isPartial: true, r: r, } length = -1 } else { contents = &spanReader{r, length} } return } // serializeHeader writes an OpenPGP packet header to w. See RFC 4880, section // 4.2. func serializeHeader(w io.Writer, ptype packetType, length int) (err error) { var buf [6]byte var n int buf[0] = 0x80 | 0x40 | byte(ptype) if length < 192 { buf[1] = byte(length) n = 2 } else if length < 8384 { length -= 192 buf[1] = 192 + byte(length>>8) buf[2] = byte(length) n = 3 } else { buf[1] = 255 buf[2] = byte(length >> 24) buf[3] = byte(length >> 16) buf[4] = byte(length >> 8) buf[5] = byte(length) n = 6 } _, err = w.Write(buf[:n]) return } // serializeStreamHeader writes an OpenPGP packet header to w where the // length of the packet is unknown. It returns a io.WriteCloser which can be // used to write the contents of the packet. See RFC 4880, section 4.2. func serializeStreamHeader(w io.WriteCloser, ptype packetType) (out io.WriteCloser, err error) { var buf [1]byte buf[0] = 0x80 | 0x40 | byte(ptype) _, err = w.Write(buf[:]) if err != nil { return } out = &partialLengthWriter{w: w} return } // Packet represents an OpenPGP packet. Users are expected to try casting // instances of this interface to specific packet types. type Packet interface { parse(io.Reader) error } // consumeAll reads from the given Reader until error, returning the number of // bytes read. func consumeAll(r io.Reader) (n int64, err error) { var m int var buf [1024]byte for { m, err = r.Read(buf[:]) n += int64(m) if err == io.EOF { err = nil return } if err != nil { return } } } // packetType represents the numeric ids of the different OpenPGP packet types. See // http://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-parameters-2 type packetType uint8 const ( packetTypeEncryptedKey packetType = 1 packetTypeSignature packetType = 2 packetTypeSymmetricKeyEncrypted packetType = 3 packetTypeOnePassSignature packetType = 4 packetTypePrivateKey packetType = 5 packetTypePublicKey packetType = 6 packetTypePrivateSubkey packetType = 7 packetTypeCompressed packetType = 8 packetTypeSymmetricallyEncrypted packetType = 9 packetTypeLiteralData packetType = 11 packetTypeUserId packetType = 13 packetTypePublicSubkey packetType = 14 packetTypeUserAttribute packetType = 17 packetTypeSymmetricallyEncryptedMDC packetType = 18 ) // peekVersion detects the version of a public key packet about to // be read. A bufio.Reader at the original position of the io.Reader // is returned. func peekVersion(r io.Reader) (bufr *bufio.Reader, ver byte, err error) { bufr = bufio.NewReader(r) var verBuf []byte if verBuf, err = bufr.Peek(1); err != nil { return } ver = verBuf[0] return } // Read reads a single OpenPGP packet from the given io.Reader. If there is an // error parsing a packet, the whole packet is consumed from the input. func Read(r io.Reader) (p Packet, err error) { tag, _, contents, err := readHeader(r) if err != nil { return } switch tag { case packetTypeEncryptedKey: p = new(EncryptedKey) case packetTypeSignature: var version byte // Detect signature version if contents, version, err = peekVersion(contents); err != nil { return } if version < 4 { p = new(SignatureV3) } else { p = new(Signature) } case packetTypeSymmetricKeyEncrypted: p = new(SymmetricKeyEncrypted) case packetTypeOnePassSignature: p = new(OnePassSignature) case packetTypePrivateKey, packetTypePrivateSubkey: pk := new(PrivateKey) if tag == packetTypePrivateSubkey { pk.IsSubkey = true } p = pk case packetTypePublicKey, packetTypePublicSubkey: var version byte if contents, version, err = peekVersion(contents); err != nil { return } isSubkey := tag == packetTypePublicSubkey if version < 4 { p = &PublicKeyV3{IsSubkey: isSubkey} } else { p = &PublicKey{IsSubkey: isSubkey} } case packetTypeCompressed: p = new(Compressed) case packetTypeSymmetricallyEncrypted: p = new(SymmetricallyEncrypted) case packetTypeLiteralData: p = new(LiteralData) case packetTypeUserId: p = new(UserId) case packetTypeUserAttribute: p = new(UserAttribute) case packetTypeSymmetricallyEncryptedMDC: se := new(SymmetricallyEncrypted) se.MDC = true p = se default: err = errors.UnknownPacketTypeError(tag) } if p != nil { err = p.parse(contents) } if err != nil { consumeAll(contents) } return } // SignatureType represents the different semantic meanings of an OpenPGP // signature. See RFC 4880, section 5.2.1. type SignatureType uint8 const ( SigTypeBinary SignatureType = 0 SigTypeText = 1 SigTypeGenericCert = 0x10 SigTypePersonaCert = 0x11 SigTypeCasualCert = 0x12 SigTypePositiveCert = 0x13 SigTypeSubkeyBinding = 0x18 SigTypePrimaryKeyBinding = 0x19 SigTypeDirectSignature = 0x1F SigTypeKeyRevocation = 0x20 SigTypeSubkeyRevocation = 0x28 ) // PublicKeyAlgorithm represents the different public key system specified for // OpenPGP. See // http://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-parameters-12 type PublicKeyAlgorithm uint8 const ( PubKeyAlgoRSA PublicKeyAlgorithm = 1 PubKeyAlgoRSAEncryptOnly PublicKeyAlgorithm = 2 PubKeyAlgoRSASignOnly PublicKeyAlgorithm = 3 PubKeyAlgoElGamal PublicKeyAlgorithm = 16 PubKeyAlgoDSA PublicKeyAlgorithm = 17 // RFC 6637, Section 5. PubKeyAlgoECDH PublicKeyAlgorithm = 18 PubKeyAlgoECDSA PublicKeyAlgorithm = 19 ) // CanEncrypt returns true if it's possible to encrypt a message to a public // key of the given type. func (pka PublicKeyAlgorithm) CanEncrypt() bool { switch pka { case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoElGamal: return true } return false } // CanSign returns true if it's possible for a public key of the given type to // sign a message. func (pka PublicKeyAlgorithm) CanSign() bool { switch pka { case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly, PubKeyAlgoDSA, PubKeyAlgoECDSA: return true } return false } // CipherFunction represents the different block ciphers specified for OpenPGP. See // http://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-parameters-13 type CipherFunction uint8 const ( Cipher3DES CipherFunction = 2 CipherCAST5 CipherFunction = 3 CipherAES128 CipherFunction = 7 CipherAES192 CipherFunction = 8 CipherAES256 CipherFunction = 9 ) // KeySize returns the key size, in bytes, of cipher. func (cipher CipherFunction) KeySize() int { switch cipher { case Cipher3DES: return 24 case CipherCAST5: return cast5.KeySize case CipherAES128: return 16 case CipherAES192: return 24 case CipherAES256: return 32 } return 0 } // blockSize returns the block size, in bytes, of cipher. func (cipher CipherFunction) blockSize() int { switch cipher { case Cipher3DES: return des.BlockSize case CipherCAST5: return 8 case CipherAES128, CipherAES192, CipherAES256: return 16 } return 0 } // new returns a fresh instance of the given cipher. func (cipher CipherFunction) new(key []byte) (block cipher.Block) { switch cipher { case Cipher3DES: block, _ = des.NewTripleDESCipher(key) case CipherCAST5: block, _ = cast5.NewCipher(key) case CipherAES128, CipherAES192, CipherAES256: block, _ = aes.NewCipher(key) } return } // readMPI reads a big integer from r. The bit length returned is the bit // length that was specified in r. This is preserved so that the integer can be // reserialized exactly. func readMPI(r io.Reader) (mpi []byte, bitLength uint16, err error) { var buf [2]byte _, err = readFull(r, buf[0:]) if err != nil { return } bitLength = uint16(buf[0])<<8 | uint16(buf[1]) numBytes := (int(bitLength) + 7) / 8 mpi = make([]byte, numBytes) _, err = readFull(r, mpi) // According to RFC 4880 3.2. we should check that the MPI has no leading // zeroes (at least when not an encrypted MPI?), but this implementation // does generate leading zeroes, so we keep accepting them. return } // writeMPI serializes a big integer to w. func writeMPI(w io.Writer, bitLength uint16, mpiBytes []byte) (err error) { // Note that we can produce leading zeroes, in violation of RFC 4880 3.2. // Implementations seem to be tolerant of them, and stripping them would // make it complex to guarantee matching re-serialization. _, err = w.Write([]byte{byte(bitLength >> 8), byte(bitLength)}) if err == nil { _, err = w.Write(mpiBytes) } return } // writeBig serializes a *big.Int to w. func writeBig(w io.Writer, i *big.Int) error { return writeMPI(w, uint16(i.BitLen()), i.Bytes()) } // padToKeySize left-pads a MPI with zeroes to match the length of the // specified RSA public. func padToKeySize(pub *rsa.PublicKey, b []byte) []byte { k := (pub.N.BitLen() + 7) / 8 if len(b) >= k { return b } bb := make([]byte, k) copy(bb[len(bb)-len(b):], b) return bb } // CompressionAlgo Represents the different compression algorithms // supported by OpenPGP (except for BZIP2, which is not currently // supported). See Section 9.3 of RFC 4880. type CompressionAlgo uint8 const ( CompressionNone CompressionAlgo = 0 CompressionZIP CompressionAlgo = 1 CompressionZLIB CompressionAlgo = 2 )
{ "pile_set_name": "Github" }
// // Generated by Bluespec Compiler, version 2019.05.beta2 (build a88bf40db, 2019-05-24) // // // // // Ports: // Name I/O size props // result_valid O 1 // result_value O 128 reg // CLK I 1 clock // RST_N I 1 reset // put_args_x_is_signed I 1 // put_args_x I 64 // put_args_y_is_signed I 1 // put_args_y I 64 // EN_put_args I 1 // // No combinational paths from inputs to outputs // // `ifdef BSV_ASSIGNMENT_DELAY `else `define BSV_ASSIGNMENT_DELAY `endif `ifdef BSV_POSITIVE_RESET `define BSV_RESET_VALUE 1'b1 `define BSV_RESET_EDGE posedge `else `define BSV_RESET_VALUE 1'b0 `define BSV_RESET_EDGE negedge `endif module mkIntMul_64(CLK, RST_N, put_args_x_is_signed, put_args_x, put_args_y_is_signed, put_args_y, EN_put_args, result_valid, result_value); input CLK; input RST_N; // action method put_args input put_args_x_is_signed; input [63 : 0] put_args_x; input put_args_y_is_signed; input [63 : 0] put_args_y; input EN_put_args; // value method result_valid output result_valid; // value method result_value output [127 : 0] result_value; // signals for module outputs wire [127 : 0] result_value; wire result_valid; // register m_rg_isNeg reg m_rg_isNeg; wire m_rg_isNeg$D_IN, m_rg_isNeg$EN; // register m_rg_signed reg m_rg_signed; wire m_rg_signed$D_IN, m_rg_signed$EN; // register m_rg_state reg [1 : 0] m_rg_state; wire [1 : 0] m_rg_state$D_IN; wire m_rg_state$EN; // register m_rg_x reg [127 : 0] m_rg_x; wire [127 : 0] m_rg_x$D_IN; wire m_rg_x$EN; // register m_rg_xy reg [127 : 0] m_rg_xy; wire [127 : 0] m_rg_xy$D_IN; wire m_rg_xy$EN; // register m_rg_y reg [63 : 0] m_rg_y; wire [63 : 0] m_rg_y$D_IN; wire m_rg_y$EN; // rule scheduling signals wire CAN_FIRE_RL_m_compute, CAN_FIRE_put_args, WILL_FIRE_RL_m_compute, WILL_FIRE_put_args; // inputs to muxes for submodule ports wire [127 : 0] MUX_m_rg_x$write_1__VAL_1, MUX_m_rg_x$write_1__VAL_2, MUX_m_rg_xy$write_1__VAL_2; wire [63 : 0] MUX_m_rg_y$write_1__VAL_1, MUX_m_rg_y$write_1__VAL_2; // remaining internal signals wire [127 : 0] x__h271, x__h364, xy___1__h288; wire [63 : 0] _theResult___fst__h525, _theResult___fst__h528, _theResult___fst__h570, _theResult___fst__h573, _theResult___snd_fst__h565; wire IF_put_args_x_is_signed_THEN_put_args_x_BIT_63_ETC___d34; // action method put_args assign CAN_FIRE_put_args = 1'd1 ; assign WILL_FIRE_put_args = EN_put_args ; // value method result_valid assign result_valid = m_rg_state == 2'd2 ; // value method result_value assign result_value = m_rg_xy ; // rule RL_m_compute assign CAN_FIRE_RL_m_compute = m_rg_state == 2'd1 ; assign WILL_FIRE_RL_m_compute = CAN_FIRE_RL_m_compute ; // inputs to muxes for submodule ports assign MUX_m_rg_x$write_1__VAL_1 = { 64'd0, _theResult___fst__h525 } ; assign MUX_m_rg_x$write_1__VAL_2 = { m_rg_x[126:0], 1'd0 } ; assign MUX_m_rg_xy$write_1__VAL_2 = (m_rg_y == 64'd0) ? x__h271 : x__h364 ; assign MUX_m_rg_y$write_1__VAL_1 = (put_args_x_is_signed && put_args_y_is_signed) ? _theResult___fst__h573 : _theResult___snd_fst__h565 ; assign MUX_m_rg_y$write_1__VAL_2 = { 1'd0, m_rg_y[63:1] } ; // register m_rg_isNeg assign m_rg_isNeg$D_IN = (put_args_x_is_signed && put_args_y_is_signed) ? put_args_x[63] != put_args_y[63] : IF_put_args_x_is_signed_THEN_put_args_x_BIT_63_ETC___d34 ; assign m_rg_isNeg$EN = EN_put_args ; // register m_rg_signed assign m_rg_signed$D_IN = 1'b0 ; assign m_rg_signed$EN = 1'b0 ; // register m_rg_state assign m_rg_state$D_IN = EN_put_args ? 2'd1 : 2'd2 ; assign m_rg_state$EN = WILL_FIRE_RL_m_compute && m_rg_y == 64'd0 || EN_put_args ; // register m_rg_x assign m_rg_x$D_IN = EN_put_args ? MUX_m_rg_x$write_1__VAL_1 : MUX_m_rg_x$write_1__VAL_2 ; assign m_rg_x$EN = WILL_FIRE_RL_m_compute && m_rg_y != 64'd0 || EN_put_args ; // register m_rg_xy assign m_rg_xy$D_IN = EN_put_args ? 128'd0 : MUX_m_rg_xy$write_1__VAL_2 ; assign m_rg_xy$EN = WILL_FIRE_RL_m_compute && (m_rg_y == 64'd0 || m_rg_y[0]) || EN_put_args ; // register m_rg_y assign m_rg_y$D_IN = EN_put_args ? MUX_m_rg_y$write_1__VAL_1 : MUX_m_rg_y$write_1__VAL_2 ; assign m_rg_y$EN = WILL_FIRE_RL_m_compute && m_rg_y != 64'd0 || EN_put_args ; // remaining internal signals assign IF_put_args_x_is_signed_THEN_put_args_x_BIT_63_ETC___d34 = put_args_x_is_signed ? put_args_x[63] : put_args_y_is_signed && put_args_y[63] ; assign _theResult___fst__h525 = put_args_x_is_signed ? _theResult___fst__h528 : put_args_x ; assign _theResult___fst__h528 = put_args_x[63] ? -put_args_x : put_args_x ; assign _theResult___fst__h570 = put_args_y_is_signed ? _theResult___fst__h573 : put_args_y ; assign _theResult___fst__h573 = put_args_y[63] ? -put_args_y : put_args_y ; assign _theResult___snd_fst__h565 = put_args_x_is_signed ? put_args_y : _theResult___fst__h570 ; assign x__h271 = m_rg_isNeg ? xy___1__h288 : m_rg_xy ; assign x__h364 = m_rg_xy + m_rg_x ; assign xy___1__h288 = -m_rg_xy ; // handling of inlined registers always@(posedge CLK) begin if (RST_N == `BSV_RESET_VALUE) begin m_rg_state <= `BSV_ASSIGNMENT_DELAY 2'd0; end else begin if (m_rg_state$EN) m_rg_state <= `BSV_ASSIGNMENT_DELAY m_rg_state$D_IN; end if (m_rg_isNeg$EN) m_rg_isNeg <= `BSV_ASSIGNMENT_DELAY m_rg_isNeg$D_IN; if (m_rg_signed$EN) m_rg_signed <= `BSV_ASSIGNMENT_DELAY m_rg_signed$D_IN; if (m_rg_x$EN) m_rg_x <= `BSV_ASSIGNMENT_DELAY m_rg_x$D_IN; if (m_rg_xy$EN) m_rg_xy <= `BSV_ASSIGNMENT_DELAY m_rg_xy$D_IN; if (m_rg_y$EN) m_rg_y <= `BSV_ASSIGNMENT_DELAY m_rg_y$D_IN; end // synopsys translate_off `ifdef BSV_NO_INITIAL_BLOCKS `else // not BSV_NO_INITIAL_BLOCKS initial begin m_rg_isNeg = 1'h0; m_rg_signed = 1'h0; m_rg_state = 2'h2; m_rg_x = 128'hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; m_rg_xy = 128'hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; m_rg_y = 64'hAAAAAAAAAAAAAAAA; end `endif // BSV_NO_INITIAL_BLOCKS // synopsys translate_on endmodule // mkIntMul_64
{ "pile_set_name": "Github" }
COMMONMODULES = unixatomic.o uadeipc.o amifilemagic.o \ eagleplayer.o unixwalkdir.o effects.o \ uadecontrol.o uadeconf.o uadestate.o uadeutils.o md5.o \ ossupport.o rmc.o songdb.o songinfo.o vparray.o support.o fifo.o PLAYERHEADERS = ../include/uade/eagleplayer.h ../include/uade/uadeconf.h ../include/uade/uadeconfstructure.h ../include/uade/uadestate.h ../common/support.h ../include/uade/options.h ../include/uade/uadeutils.h ../include/uade/unixatomic.h ../include/uade/ossupport.h ../include/uade/unixsupport.h ../include/uade/uadeipc.h amifilemagic.o: ../common/amifilemagic.c ../include/uade/amifilemagic.h $(PLAYERHEADERS) $(CC) $(CFLAGS) -c $< eagleplayer.o: ../common/eagleplayer.c ../include/uade/amifilemagic.h ../include/uade/songdb.h $(PLAYERHEADERS) $(CC) $(CFLAGS) -c $< effects.o: ../common/effects.c ../include/uade/effects.h $(CC) $(CFLAGS) -c $< md5.o: ../common/md5.c ../common/md5.h $(CC) $(CFLAGS) -c $< ossupport.o: ../common/ossupport.c ../include/uade/ossupport.h ../include/uade/unixsupport.h ../include/uade/uadeipc.h $(CC) $(CFLAGS) -c $< rmc.o: ../common/rmc.c ../include/uade/rmc.h $(CC) $(CFLAGS) -c $< songdb.o: ../common/songdb.c ../include/uade/songdb.h ../common/md5.h $(PLAYERHEADERS) $(CC) $(CFLAGS) -c $< songinfo.o: ../common/songinfo.c ../include/uade/amifilemagic.h $(PLAYERHEADERS) $(CC) $(CFLAGS) -c $< uadeconf.o: ../common/uadeconf.c $(PLAYERHEADERS) $(CC) $(CFLAGS) -c $< uadecontrol.o: ../common/uadecontrol.c ../include/uade/uadecontrol.h $(PLAYERHEADERS) $(CC) $(CFLAGS) -c $< uadestate.o: ../common/uadestate.c $(PLAYERHEADERS) $(CC) $(CFLAGS) -c $< uadeipc.o: ../common/uadeipc.c ../include/uade/uadeipc.h ../include/uade/uadeutils.h $(CC) $(CFLAGS) -c $< uadeutils.o: ../common/uadeutils.c ../include/uade/uadeutils.h $(CC) $(CFLAGS) -c $< unixatomic.o: ../common/unixatomic.c ../include/uade/unixatomic.h $(CC) $(CFLAGS) -c $< unixwalkdir.o: ../common/unixwalkdir.c ../common/unixwalkdir.h $(CC) $(CFLAGS) -c $< vparray.o: ../common/vparray.c ../include/uade/vparray.h $(CC) $(CFLAGS) -c $< support.o: ../common/support.c ../common/support.h ../include/uade/ossupport.h ../include/uade/unixsupport.h $(CC) $(CFLAGS) -c $< fifo.o: ../common/fifo.c ../common/fifo.h $(CC) $(CFLAGS) -c $<
{ "pile_set_name": "Github" }
# RUN: llvm-mc -triple powerpc-unknown-unknown -filetype=obj %s | \ # RUN: llvm-readobj -s -sd | FileCheck %s # RUN: llvm-mc -triple powerpc64-unknown-unknown -filetype=obj %s | \ # RUN: llvm-readobj -s -sd | FileCheck %s .lcomm foo, 16, 16 // CHECK: Section { // CHECK: Name: .bss // CHECK-NEXT: Type: SHT_NOBITS // CHECK-NEXT: Flags [ // CHECK-NEXT: SHF_ALLOC // CHECK-NEXT: SHF_WRITE // CHECK-NEXT: ] // CHECK-NEXT: Address: 0x0 // CHECK-NEXT: Offset: 0x40 // CHECK-NEXT: Size: 16 // CHECK-NEXT: Link: 0 // CHECK-NEXT: Info: 0 // CHECK-NEXT: AddressAlignment: 16 // CHECK-NEXT: EntrySize: 0
{ "pile_set_name": "Github" }
@echo OFF IF EXIST C:\tmp\pstore rmdir /S /Q C:\tmp\pstore IF EXIST .\tmp\pstore rmdir /S /Q .\tmp\pstore set EXAMPLE_LANG=sac echo "===== calling runDurability with sac =====" call %FUNCTIONS% :runDurabilityInit call %FUNCTIONS% :runDurability call %FUNCTIONS% :durabilityCheckResults >> run.log
{ "pile_set_name": "Github" }
/*++ Copyright (c) 2017 Microsoft Corporation Author: Lev Nachmanson (levnach) --*/ #pragma once #include "util/vector.h" #include <string> #include <utility> #include "math/lp/lp_core_solver_base.h" #include <algorithm> #include "math/lp/indexed_vector.h" #include "math/lp/binary_heap_priority_queue.h" #include "math/lp/breakpoint.h" #include "math/lp/lp_primal_core_solver.h" #include "math/lp/stacked_vector.h" #include "math/lp/lar_solution_signature.h" #include "util/stacked_value.h" namespace lp { class lar_core_solver { // m_sign_of_entering is set to 1 if the entering variable needs // to grow and is set to -1 otherwise int m_sign_of_entering_delta; vector<std::pair<mpq, unsigned>> m_infeasible_linear_combination; int m_infeasible_sum_sign; // todo: get rid of this field vector<numeric_pair<mpq>> m_right_sides_dummy; vector<mpq> m_costs_dummy; vector<double> m_d_right_sides_dummy; vector<double> m_d_costs_dummy; public: stacked_value<simplex_strategy_enum> m_stacked_simplex_strategy; stacked_vector<column_type> m_column_types; // r - solver fields, for rational numbers vector<numeric_pair<mpq>> m_r_x; // the solution stacked_vector<numeric_pair<mpq>> m_r_lower_bounds; stacked_vector<numeric_pair<mpq>> m_r_upper_bounds; static_matrix<mpq, numeric_pair<mpq>> m_r_A; stacked_vector<unsigned> m_r_pushed_basis; vector<unsigned> m_r_basis; vector<unsigned> m_r_nbasis; vector<int> m_r_heading; stacked_vector<unsigned> m_r_columns_nz; stacked_vector<unsigned> m_r_rows_nz; // d - solver fields, for doubles vector<double> m_d_x; // the solution in doubles vector<double> m_d_lower_bounds; vector<double> m_d_upper_bounds; static_matrix<double, double> m_d_A; stacked_vector<unsigned> m_d_pushed_basis; vector<unsigned> m_d_basis; vector<unsigned> m_d_nbasis; vector<int> m_d_heading; lp_primal_core_solver<mpq, numeric_pair<mpq>> m_r_solver; // solver in rational numbers lp_primal_core_solver<double, double> m_d_solver; // solver in doubles lar_core_solver( lp_settings & settings, const column_namer & column_names ); lp_settings & settings() { return m_r_solver.m_settings;} const lp_settings & settings() const { return m_r_solver.m_settings;} int get_infeasible_sum_sign() const { return m_infeasible_sum_sign; } const vector<std::pair<mpq, unsigned>> & get_infeasibility_info(int & inf_sign) const { inf_sign = m_infeasible_sum_sign; return m_infeasible_linear_combination; } void fill_not_improvable_zero_sum_from_inf_row(); column_type get_column_type(unsigned j) { return m_column_types[j];} void calculate_pivot_row(unsigned i); void print_pivot_row(std::ostream & out, unsigned row_index) const { for (unsigned j : m_r_solver.m_pivot_row.m_index) { if (numeric_traits<mpq>::is_pos(m_r_solver.m_pivot_row.m_data[j])) out << "+"; out << m_r_solver.m_pivot_row.m_data[j] << m_r_solver.column_name(j) << " "; } out << " +" << m_r_solver.column_name(m_r_solver.m_basis[row_index]) << std::endl; for (unsigned j : m_r_solver.m_pivot_row.m_index) { m_r_solver.print_column_bound_info(j, out); } m_r_solver.print_column_bound_info(m_r_solver.m_basis[row_index], out); } void advance_on_sorted_breakpoints(unsigned entering); void change_slope_on_breakpoint(unsigned entering, breakpoint<numeric_pair<mpq>> * b, mpq & slope_at_entering); bool row_is_infeasible(unsigned row); bool row_is_evidence(unsigned row); bool find_evidence_row(); void prefix_r(); void prefix_d(); unsigned m_m() const { return m_r_A.row_count(); } unsigned m_n() const { return m_r_A.column_count(); } bool is_tiny() const { return this->m_m() < 10 && this->m_n() < 20; } bool is_empty() const { return this->m_m() == 0 && this->m_n() == 0; } template <typename L> int get_sign(const L & v) { return v > zero_of_type<L>() ? 1 : (v < zero_of_type<L>() ? -1 : 0); } void fill_evidence(unsigned row); unsigned get_number_of_non_ints() const; void solve(); bool lower_bounds_are_set() const { return true; } const indexed_vector<mpq> & get_pivot_row() const { return m_r_solver.m_pivot_row; } void fill_not_improvable_zero_sum(); void pop_basis(unsigned k) { if (!settings().use_tableau()) { m_r_pushed_basis.pop(k); m_r_basis = m_r_pushed_basis(); m_r_solver.init_basis_heading_and_non_basic_columns_vector(); m_d_pushed_basis.pop(k); m_d_basis = m_d_pushed_basis(); m_d_solver.init_basis_heading_and_non_basic_columns_vector(); } else { m_d_basis = m_r_basis; m_d_nbasis = m_r_nbasis; m_d_heading = m_r_heading; } } void push() { lp_assert(m_r_solver.basis_heading_is_correct()); lp_assert(!need_to_presolve_with_double_solver() || m_d_solver.basis_heading_is_correct()); lp_assert(m_column_types.size() == m_r_A.column_count()); m_stacked_simplex_strategy = settings().simplex_strategy(); m_stacked_simplex_strategy.push(); m_column_types.push(); // rational if (!settings().use_tableau()) m_r_A.push(); m_r_lower_bounds.push(); m_r_upper_bounds.push(); if (!settings().use_tableau()) { push_vector(m_r_pushed_basis, m_r_basis); push_vector(m_r_columns_nz, m_r_solver.m_columns_nz); push_vector(m_r_rows_nz, m_r_solver.m_rows_nz); } m_d_A.push(); if (!settings().use_tableau()) push_vector(m_d_pushed_basis, m_d_basis); } template <typename K> void push_vector(stacked_vector<K> & pushed_vector, const vector<K> & vector) { lp_assert(pushed_vector.size() <= vector.size()); for (unsigned i = 0; i < vector.size();i++) { if (i == pushed_vector.size()) { pushed_vector.push_back(vector[i]); } else { pushed_vector[i] = vector[i]; } } pushed_vector.push(); } void pop_markowitz_counts(unsigned k) { m_r_columns_nz.pop(k); m_r_rows_nz.pop(k); m_r_solver.m_columns_nz.resize(m_r_columns_nz.size()); m_r_solver.m_rows_nz.resize(m_r_rows_nz.size()); for (unsigned i = 0; i < m_r_columns_nz.size(); i++) m_r_solver.m_columns_nz[i] = m_r_columns_nz[i]; for (unsigned i = 0; i < m_r_rows_nz.size(); i++) m_r_solver.m_rows_nz[i] = m_r_rows_nz[i]; } void pop(unsigned k) { // rationals if (!settings().use_tableau()) m_r_A.pop(k); m_r_lower_bounds.pop(k); m_r_upper_bounds.pop(k); m_column_types.pop(k); delete m_r_solver.m_factorization; m_r_solver.m_factorization = nullptr; m_r_x.resize(m_r_A.column_count()); m_r_solver.m_costs.resize(m_r_A.column_count()); m_r_solver.m_d.resize(m_r_A.column_count()); if(!settings().use_tableau()) pop_markowitz_counts(k); m_d_A.pop(k); // doubles delete m_d_solver.m_factorization; m_d_solver.m_factorization = nullptr; m_d_x.resize(m_d_A.column_count()); pop_basis(k); m_stacked_simplex_strategy.pop(k); settings().simplex_strategy() = m_stacked_simplex_strategy; lp_assert(m_r_solver.basis_heading_is_correct()); lp_assert(!need_to_presolve_with_double_solver() || m_d_solver.basis_heading_is_correct()); } bool need_to_presolve_with_double_solver() const { return settings().simplex_strategy() == simplex_strategy_enum::lu; } template <typename L> bool is_zero_vector(const vector<L> & b) { for (const L & m: b) if (!is_zero(m)) return false; return true; } bool update_xj_and_get_delta(unsigned j, non_basic_column_value_position pos_type, numeric_pair<mpq> & delta) { auto & x = m_r_x[j]; switch (pos_type) { case at_lower_bound: if (x == m_r_solver.m_lower_bounds[j]) return false; delta = m_r_solver.m_lower_bounds[j] - x; m_r_solver.m_x[j] = m_r_solver.m_lower_bounds[j]; break; case at_fixed: case at_upper_bound: if (x == m_r_solver.m_upper_bounds[j]) return false; delta = m_r_solver.m_upper_bounds[j] - x; x = m_r_solver.m_upper_bounds[j]; break; case free_of_bounds: { return false; } case not_at_bound: switch (m_column_types[j]) { case column_type::free_column: return false; case column_type::upper_bound: delta = m_r_solver.m_upper_bounds[j] - x; x = m_r_solver.m_upper_bounds[j]; break; case column_type::lower_bound: delta = m_r_solver.m_lower_bounds[j] - x; x = m_r_solver.m_lower_bounds[j]; break; case column_type::boxed: if (x > m_r_solver.m_upper_bounds[j]) { delta = m_r_solver.m_upper_bounds[j] - x; x += m_r_solver.m_upper_bounds[j]; } else { delta = m_r_solver.m_lower_bounds[j] - x; x = m_r_solver.m_lower_bounds[j]; } break; case column_type::fixed: delta = m_r_solver.m_lower_bounds[j] - x; x = m_r_solver.m_lower_bounds[j]; break; default: lp_assert(false); } break; default: lp_unreachable(); } m_r_solver.remove_column_from_inf_set(j); return true; } void prepare_solver_x_with_signature_tableau(const lar_solution_signature & signature) { lp_assert(m_r_solver.inf_set_is_correct()); for (auto &t : signature) { unsigned j = t.first; if (m_r_heading[j] >= 0) continue; auto pos_type = t.second; numeric_pair<mpq> delta; if (!update_xj_and_get_delta(j, pos_type, delta)) continue; for (const auto & cc : m_r_solver.m_A.m_columns[j]){ unsigned i = cc.var(); unsigned jb = m_r_solver.m_basis[i]; m_r_solver.add_delta_to_x_and_track_feasibility(jb, - delta * m_r_solver.m_A.get_val(cc)); } CASSERT("A_off", m_r_solver.A_mult_x_is_off() == false); } lp_assert(m_r_solver.inf_set_is_correct()); } template <typename L, typename K> void prepare_solver_x_with_signature(const lar_solution_signature & signature, lp_primal_core_solver<L,K> & s) { for (auto &t : signature) { unsigned j = t.first; lp_assert(m_r_heading[j] < 0); auto pos_type = t.second; switch (pos_type) { case at_lower_bound: s.m_x[j] = s.m_lower_bounds[j]; break; case at_fixed: case at_upper_bound: s.m_x[j] = s.m_upper_bounds[j]; break; case free_of_bounds: { s.m_x[j] = zero_of_type<K>(); continue; } case not_at_bound: switch (m_column_types[j]) { case column_type::free_column: lp_assert(false); // unreachable case column_type::upper_bound: s.m_x[j] = s.m_upper_bounds[j]; break; case column_type::lower_bound: s.m_x[j] = s.m_lower_bounds[j]; break; case column_type::boxed: if (settings().random_next() % 2) { s.m_x[j] = s.m_lower_bounds[j]; } else { s.m_x[j] = s.m_upper_bounds[j]; } break; case column_type::fixed: s.m_x[j] = s.m_lower_bounds[j]; break; default: lp_assert(false); } break; default: lp_unreachable(); } } lp_assert(is_zero_vector(s.m_b)); s.solve_Ax_eq_b(); } template <typename L, typename K> void catch_up_in_lu_in_reverse(const vector<unsigned> & trace_of_basis_change, lp_primal_core_solver<L,K> & cs) { // recover the previous working basis for (unsigned i = trace_of_basis_change.size(); i > 0; i-= 2) { unsigned entering = trace_of_basis_change[i-1]; unsigned leaving = trace_of_basis_change[i-2]; cs.change_basis_unconditionally(entering, leaving); } cs.init_lu(); } //basis_heading is the basis heading of the solver owning trace_of_basis_change // here we compact the trace as we go to avoid unnecessary column changes template <typename L, typename K> void catch_up_in_lu(const vector<unsigned> & trace_of_basis_change, const vector<int> & basis_heading, lp_primal_core_solver<L,K> & cs) { if (cs.m_factorization == nullptr || cs.m_factorization->m_refactor_counter + trace_of_basis_change.size()/2 >= 200) { for (unsigned i = 0; i < trace_of_basis_change.size(); i+= 2) { unsigned entering = trace_of_basis_change[i]; unsigned leaving = trace_of_basis_change[i+1]; cs.change_basis_unconditionally(entering, leaving); } if (cs.m_factorization != nullptr) { delete cs.m_factorization; cs.m_factorization = nullptr; } } else { indexed_vector<L> w(cs.m_A.row_count()); // the queues of delayed indices std::queue<unsigned> entr_q, leav_q; auto * l = cs.m_factorization; lp_assert(l->get_status() == LU_status::OK); for (unsigned i = 0; i < trace_of_basis_change.size(); i+= 2) { unsigned entering = trace_of_basis_change[i]; unsigned leaving = trace_of_basis_change[i+1]; bool good_e = basis_heading[entering] >= 0 && cs.m_basis_heading[entering] < 0; bool good_l = basis_heading[leaving] < 0 && cs.m_basis_heading[leaving] >= 0; if (!good_e && !good_l) continue; if (good_e && !good_l) { while (!leav_q.empty() && cs.m_basis_heading[leav_q.front()] < 0) leav_q.pop(); if (!leav_q.empty()) { leaving = leav_q.front(); leav_q.pop(); } else { entr_q.push(entering); continue; } } else if (!good_e && good_l) { while (!entr_q.empty() && cs.m_basis_heading[entr_q.front()] >= 0) entr_q.pop(); if (!entr_q.empty()) { entering = entr_q.front(); entr_q.pop(); } else { leav_q.push(leaving); continue; } } lp_assert(cs.m_basis_heading[entering] < 0); lp_assert(cs.m_basis_heading[leaving] >= 0); if (l->get_status() == LU_status::OK) { l->prepare_entering(entering, w); // to init vector w l->replace_column(zero_of_type<L>(), w, cs.m_basis_heading[leaving]); } cs.change_basis_unconditionally(entering, leaving); } if (l->get_status() != LU_status::OK) { delete l; cs.m_factorization = nullptr; } } if (cs.m_factorization == nullptr) { if (numeric_traits<L>::precise()) init_factorization(cs.m_factorization, cs.m_A, cs.m_basis, settings()); } } bool no_r_lu() const { return m_r_solver.m_factorization == nullptr || m_r_solver.m_factorization->get_status() == LU_status::Degenerated; } void solve_on_signature_tableau(const lar_solution_signature & signature, const vector<unsigned> & changes_of_basis) { r_basis_is_OK(); lp_assert(settings().use_tableau()); bool r = catch_up_in_lu_tableau(changes_of_basis, m_d_solver.m_basis_heading); if (!r) { // it is the case where m_d_solver gives a degenerated basis prepare_solver_x_with_signature_tableau(signature); // still are going to use the signature partially m_r_solver.find_feasible_solution(); m_d_basis = m_r_basis; m_d_heading = m_r_heading; m_d_nbasis = m_r_nbasis; delete m_d_solver.m_factorization; m_d_solver.m_factorization = nullptr; } else { prepare_solver_x_with_signature_tableau(signature); m_r_solver.start_tracing_basis_changes(); m_r_solver.find_feasible_solution(); if (settings().get_cancel_flag()) return; m_r_solver.stop_tracing_basis_changes(); // and now catch up in the double solver lp_assert(m_r_solver.total_iterations() >= m_r_solver.m_trace_of_basis_change_vector.size() /2); catch_up_in_lu(m_r_solver.m_trace_of_basis_change_vector, m_r_solver.m_basis_heading, m_d_solver); } lp_assert(r_basis_is_OK()); } bool adjust_x_of_column(unsigned j) { /* if (m_r_solver.m_basis_heading[j] >= 0) { return false; } if (m_r_solver.column_is_feasible(j)) { return false; } m_r_solver.snap_column_to_bound_tableau(j); lp_assert(m_r_solver.column_is_feasible(j)); m_r_solver.m_inf_set.erase(j); */ lp_assert(false); return true; } bool catch_up_in_lu_tableau(const vector<unsigned> & trace_of_basis_change, const vector<int> & basis_heading) { lp_assert(r_basis_is_OK()); // the queues of delayed indices std::queue<unsigned> entr_q, leav_q; for (unsigned i = 0; i < trace_of_basis_change.size(); i+= 2) { unsigned entering = trace_of_basis_change[i]; unsigned leaving = trace_of_basis_change[i+1]; bool good_e = basis_heading[entering] >= 0 && m_r_solver.m_basis_heading[entering] < 0; bool good_l = basis_heading[leaving] < 0 && m_r_solver.m_basis_heading[leaving] >= 0; if (!good_e && !good_l) continue; if (good_e && !good_l) { while (!leav_q.empty() && m_r_solver.m_basis_heading[leav_q.front()] < 0) leav_q.pop(); if (!leav_q.empty()) { leaving = leav_q.front(); leav_q.pop(); } else { entr_q.push(entering); continue; } } else if (!good_e && good_l) { while (!entr_q.empty() && m_r_solver.m_basis_heading[entr_q.front()] >= 0) entr_q.pop(); if (!entr_q.empty()) { entering = entr_q.front(); entr_q.pop(); } else { leav_q.push(leaving); continue; } } lp_assert(m_r_solver.m_basis_heading[entering] < 0); lp_assert(m_r_solver.m_basis_heading[leaving] >= 0); m_r_solver.change_basis_unconditionally(entering, leaving); if(!m_r_solver.pivot_column_tableau(entering, m_r_solver.m_basis_heading[entering])) { // unroll the last step m_r_solver.change_basis_unconditionally(leaving, entering); #ifdef Z3DEBUG bool t = #endif m_r_solver.pivot_column_tableau(leaving, m_r_solver.m_basis_heading[leaving]); #ifdef Z3DEBUG lp_assert(t); #endif return false; } } lp_assert(r_basis_is_OK()); return true; } bool r_basis_is_OK() const { #ifdef Z3DEBUG if (!m_r_solver.m_settings.use_tableau()) return true; for (unsigned j : m_r_solver.m_basis) { lp_assert(m_r_solver.m_A.m_columns[j].size() == 1); } for (unsigned j =0; j < m_r_solver.m_basis_heading.size(); j++) { if (m_r_solver.m_basis_heading[j] >= 0) continue; if (m_r_solver.m_column_types[j] == column_type::fixed) continue; lp_assert(static_cast<unsigned>(- m_r_solver.m_basis_heading[j] - 1) < m_r_solver.m_column_types.size()); lp_assert( m_r_solver.m_basis_heading[j] <= -1); } #endif return true; } void solve_on_signature(const lar_solution_signature & signature, const vector<unsigned> & changes_of_basis) { SASSERT(!settings().use_tableau()); if (m_r_solver.m_factorization == nullptr) { for (unsigned j = 0; j < changes_of_basis.size(); j+=2) { unsigned entering = changes_of_basis[j]; unsigned leaving = changes_of_basis[j + 1]; m_r_solver.change_basis_unconditionally(entering, leaving); } init_factorization(m_r_solver.m_factorization, m_r_A, m_r_basis, settings()); } else { catch_up_in_lu(changes_of_basis, m_d_solver.m_basis_heading, m_r_solver); } if (no_r_lu()) { // it is the case where m_d_solver gives a degenerated basis, we need to roll back catch_up_in_lu_in_reverse(changes_of_basis, m_r_solver); m_r_solver.find_feasible_solution(); m_d_basis = m_r_basis; m_d_heading = m_r_heading; m_d_nbasis = m_r_nbasis; delete m_d_solver.m_factorization; m_d_solver.m_factorization = nullptr; } else { prepare_solver_x_with_signature(signature, m_r_solver); m_r_solver.start_tracing_basis_changes(); m_r_solver.find_feasible_solution(); if (settings().get_cancel_flag()) return; m_r_solver.stop_tracing_basis_changes(); // and now catch up in the double solver lp_assert(m_r_solver.total_iterations() >= m_r_solver.m_trace_of_basis_change_vector.size() /2); catch_up_in_lu(m_r_solver.m_trace_of_basis_change_vector, m_r_solver.m_basis_heading, m_d_solver); } } void create_double_matrix(static_matrix<double, double> & A) { for (unsigned i = 0; i < m_r_A.row_count(); i++) { auto & row = m_r_A.m_rows[i]; for (row_cell<mpq> & c : row) { A.add_new_element(i, c.var(), c.coeff().get_double()); } } } void fill_basis_d( vector<unsigned>& basis_d, vector<int>& heading_d, vector<unsigned>& nbasis_d){ basis_d = m_r_basis; heading_d = m_r_heading; nbasis_d = m_r_nbasis; } template <typename L, typename K> void extract_signature_from_lp_core_solver(const lp_primal_core_solver<L, K> & solver, lar_solution_signature & signature) { signature.clear(); lp_assert(signature.size() == 0); for (unsigned j = 0; j < solver.m_basis_heading.size(); j++) { if (solver.m_basis_heading[j] < 0) { signature[j] = solver.get_non_basic_column_value_position(j); } } } void get_bounds_for_double_solver() { unsigned n = m_n(); m_d_lower_bounds.resize(n); m_d_upper_bounds.resize(n); double delta = find_delta_for_strict_boxed_bounds().get_double(); if (delta > 0.000001) delta = 0.000001; for (unsigned j = 0; j < n; j++) { if (lower_bound_is_set(j)) { const auto & lb = m_r_solver.m_lower_bounds[j]; m_d_lower_bounds[j] = lb.x.get_double() + delta * lb.y.get_double(); } if (upper_bound_is_set(j)) { const auto & ub = m_r_solver.m_upper_bounds[j]; m_d_upper_bounds[j] = ub.x.get_double() + delta * ub.y.get_double(); lp_assert(!lower_bound_is_set(j) || (m_d_upper_bounds[j] >= m_d_lower_bounds[j])); } } } void scale_problem_for_doubles( static_matrix<double, double>& A, vector<double> & lower_bounds, vector<double> & upper_bounds) { vector<double> column_scale_vector; vector<double> right_side_vector(A.column_count()); settings().reps_in_scaler = 5; scaler<double, double > scaler(right_side_vector, A, settings().scaling_minimum, settings().scaling_maximum, column_scale_vector, settings()); if (! scaler.scale()) { // the scale did not succeed, unscaling A.clear(); create_double_matrix(A); } else { for (unsigned j = 0; j < A.column_count(); j++) { if (m_r_solver.column_has_upper_bound(j)) { upper_bounds[j] /= column_scale_vector[j]; } if (m_r_solver.column_has_lower_bound(j)) { lower_bounds[j] /= column_scale_vector[j]; } } } } // returns the trace of basis changes vector<unsigned> find_solution_signature_with_doubles(lar_solution_signature & signature) { if (m_d_solver.m_factorization == nullptr || m_d_solver.m_factorization->get_status() != LU_status::OK) { vector<unsigned> ret; return ret; } get_bounds_for_double_solver(); extract_signature_from_lp_core_solver(m_r_solver, signature); prepare_solver_x_with_signature(signature, m_d_solver); m_d_solver.start_tracing_basis_changes(); m_d_solver.find_feasible_solution(); if (settings().get_cancel_flag()) return vector<unsigned>(); m_d_solver.stop_tracing_basis_changes(); extract_signature_from_lp_core_solver(m_d_solver, signature); return m_d_solver.m_trace_of_basis_change_vector; } bool lower_bound_is_set(unsigned j) const { switch (m_column_types[j]) { case column_type::free_column: case column_type::upper_bound: return false; case column_type::lower_bound: case column_type::boxed: case column_type::fixed: return true; default: lp_assert(false); } return false; } bool upper_bound_is_set(unsigned j) const { switch (m_column_types[j]) { case column_type::free_column: case column_type::lower_bound: return false; case column_type::upper_bound: case column_type::boxed: case column_type::fixed: return true; default: lp_assert(false); } return false; } void update_delta(mpq& delta, numeric_pair<mpq> const& l, numeric_pair<mpq> const& u) const { lp_assert(l <= u); if (l.x < u.x && l.y > u.y) { mpq delta1 = (u.x - l.x) / (l.y - u.y); if (delta1 < delta) { delta = delta1; } } lp_assert(l.x + delta * l.y <= u.x + delta * u.y); } mpq find_delta_for_strict_boxed_bounds() const{ mpq delta = numeric_traits<mpq>::one(); for (unsigned j = 0; j < m_r_A.column_count(); j++ ) { if (m_column_types()[j] != column_type::boxed) continue; update_delta(delta, m_r_lower_bounds[j], m_r_upper_bounds[j]); } return delta; } mpq find_delta_for_strict_bounds(const mpq & initial_delta) const{ mpq delta = initial_delta; for (unsigned j = 0; j < m_r_A.column_count(); j++ ) { if (lower_bound_is_set(j)) update_delta(delta, m_r_lower_bounds[j], m_r_x[j]); if (upper_bound_is_set(j)) update_delta(delta, m_r_x[j], m_r_upper_bounds[j]); } return delta; } void init_column_row_nz_for_r_solver() { m_r_solver.init_column_row_non_zeroes(); } bool column_is_fixed(unsigned j) const { return m_column_types()[j] == column_type::fixed || ( m_column_types()[j] == column_type::boxed && m_r_solver.m_lower_bounds[j] == m_r_solver.m_upper_bounds[j]); } bool column_is_free(unsigned j) const { return m_column_types()[j] == column_type::free_column; } const impq & lower_bound(unsigned j) const { lp_assert(m_column_types()[j] == column_type::fixed || m_column_types()[j] == column_type::boxed || m_column_types()[j] == column_type::lower_bound); return m_r_lower_bounds[j]; } const impq & upper_bound(unsigned j) const { lp_assert(m_column_types()[j] == column_type::fixed || m_column_types()[j] == column_type::boxed || m_column_types()[j] == column_type::upper_bound); return m_r_upper_bounds[j]; } bool column_is_bounded(unsigned j) const { switch(m_column_types()[j]) { case column_type::fixed: case column_type::boxed: return true; default: return false; } } const vector<unsigned>& r_basis() const { return m_r_basis; } const vector<unsigned>& r_nbasis() const { return m_r_nbasis; } }; }
{ "pile_set_name": "Github" }
package com.cheng.utils.security; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.util.Arrays; import java.util.zip.ZipError; /** * APK伪加密 */ public class PseudoEncryptionUtil { public static void main(String[] args) { ApkUtilTool apk = new ApkUtilTool(); try { /** * 进行伪加密 */ apk.ChangToEncryptedEntry("需要伪加密的apk地址", "伪加密后的apk地址"); /** * 进行解密 */ apk.FixEncryptedEntry("进行过伪加密的apk地址", "解密后的apk地址"); } catch (IOException e) { e.printStackTrace(); } } /* * Compression methods */ static final int METHOD_STORED = 0; static final int METHOD_DEFLATED = 8; static final int METHOD_DEFLATED64 = 9; static final int METHOD_BZIP2 = 12; static final int METHOD_LZMA = 14; static final int METHOD_LZ77 = 19; static final int METHOD_AES = 99; /* * General purpose big flag */ static final int FLAG_ENCRYPTED = 0x01; static final int FLAG_DATADESCR = 0x08; // crc, size and csize in dd static final int FLAG_EFS = 0x800; // If this bit is set the filename and // comment fields for this file must be // encoded using UTF-8. /* * Header signatures */ static long LOCSIG = 0x04034b50L; // "PK\003\004" static long EXTSIG = 0x08074b50L; // "PK\007\008" static long CENSIG = 0x02014b50L; // "PK\001\002" static long ENDSIG = 0x06054b50L; // "PK\005\006" /* * Header sizes in bytes (including signatures) */ static final int LOCHDR = 30; // LOC header size static final int EXTHDR = 16; // EXT header size static final int CENHDR = 46; // CEN header size static final int ENDHDR = 22; // END header size /* * Local file (LOC) header field offsets */ static final int LOCVER = 4; // version needed to extract static final int LOCABC = 6; // general purpose bit flag static final int LOCHOW = 8; // compression method static final int LOCTIM = 10; // modification time static final int LOCCRC = 14; // uncompressed file crc-32 value static final int LOCSIZ = 18; // compressed size static final int LOCLEN = 22; // uncompressed size static final int LOCNAM = 26; // filename length static final int LOCEXT = 28; // extra field length /* * Extra local (EXT) header field offsets */ static final int EXTCRC = 4; // uncompressed file crc-32 value static final int EXTSIZ = 8; // compressed size static final int EXTLEN = 12; // uncompressed size /* * Central directory (CEN) header field offsets */ static final int CENVEM = 4; // version made by static final int CENVER = 6; // version needed to extract static final int CENABC = 8; // encrypt, decrypt flags static final int CENHOW = 10; // compression method static final int CENTIM = 12; // modification time static final int CENCRC = 16; // uncompressed file crc-32 value static final int CENSIZ = 20; // compressed size static final int CENLEN = 24; // uncompressed size static final int CENNAM = 28; // filename length static final int CENEXT = 30; // extra field length static final int CENCOM = 32; // comment length static final int CENDSK = 34; // disk number start static final int CENATT = 36; // internal file attributes static final int CENATX = 38; // external file attributes static final int CENOFF = 42; // LOC header offset /* * End of central directory (END) header field offsets */ static final int ENDSUB = 8; // number of entries on this disk static final int ENDTOT = 10; // total number of entries static final int ENDSIZ = 12; // central directory size in bytes static final int ENDOFF = 16; // offset of first CEN header static final int ENDCOM = 20; // zip file comment length /* * ZIP64 constants */ static final long ZIP64_ENDSIG = 0x06064b50L; // "PK\006\006" static final long ZIP64_LOCSIG = 0x07064b50L; // "PK\006\007" static final int ZIP64_ENDHDR = 56; // ZIP64 end header size static final int ZIP64_LOCHDR = 20; // ZIP64 end loc header size static final int ZIP64_EXTHDR = 24; // EXT header size static final int ZIP64_EXTID = 0x0001; // Extra field Zip64 header ID static final int ZIP64_MINVAL32 = 0xFFFF; static final long ZIP64_MINVAL = 0xFFFFFFFFL; /* * Zip64 End of central directory (END) header field offsets */ static final int ZIP64_ENDLEN = 4; // size of zip64 end of central dir static final int ZIP64_ENDVEM = 12; // version made by static final int ZIP64_ENDVER = 14; // version needed to extract static final int ZIP64_ENDNMD = 16; // number of this disk static final int ZIP64_ENDDSK = 20; // disk number of start static final int ZIP64_ENDTOD = 24; // total number of entries on this disk static final int ZIP64_ENDTOT = 32; // total number of entries static final int ZIP64_ENDSIZ = 40; // central directory size in bytes static final int ZIP64_ENDOFF = 48; // offset of first CEN header static final int ZIP64_ENDEXT = 56; // zip64 extensible data sector /* * Zip64 End of central directory locator field offsets */ static final int ZIP64_LOCDSK = 4; // disk number start static final int ZIP64_LOCOFF = 8; // offset of zip64 end static final int ZIP64_LOCTOT = 16; // total number of disks /* * Zip64 Extra local (EXT) header field offsets */ static final int ZIP64_EXTCRC = 4; // uncompressed file crc-32 value static final int ZIP64_EXTSIZ = 8; // compressed size, 8-byte static final int ZIP64_EXTLEN = 16; // uncompressed size, 8-byte /* * Extra field header ID */ static final int EXTID_ZIP64 = 0x0001; // ZIP64 static final int EXTID_NTFS = 0x000a; // NTFS static final int EXTID_UNIX = 0x000d; // UNIX static final int EXTID_EFS = 0x0017; // Strong Encryption static final int EXTID_EXTT = 0x5455; // Info-ZIP Extended Timestamp /* * fields access methods */ // ///////////////////////////////////////////////////// static final int CH(byte[] b, int n) { return b[n] & 0xff; } static final int SH(byte[] b, int n) { return (b[n] & 0xff) | ((b[n + 1] & 0xff) << 8); } static final long LG(byte[] b, int n) { return ((SH(b, n)) | (SH(b, n + 2) << 16)) & 0xffffffffL; } static final long LL(byte[] b, int n) { return (LG(b, n)) | (LG(b, n + 4) << 32); } static final long GETSIG(byte[] b) { return LG(b, 0); } // local file (LOC) header fields static final long LOCSIG(byte[] b) { return LG(b, 0); } // signature static final int LOCVER(byte[] b) { return SH(b, 4); } // version needed to extract static final int LOCABC(byte[] b) { return SH(b, 6); } // general purpose bit flags static final int LOCHOW(byte[] b) { return SH(b, 8); } // compression method static final long LOCTIM(byte[] b) { return LG(b, 10); } // modification time static final long LOCCRC(byte[] b) { return LG(b, 14); } // crc of uncompressed data static final long LOCSIZ(byte[] b) { return LG(b, 18); } // compressed data size static final long LOCLEN(byte[] b) { return LG(b, 22); } // uncompressed data size static final int LOCNAM(byte[] b) { return SH(b, 26); } // filename length static final int LOCEXT(byte[] b) { return SH(b, 28); } // extra field length // extra local (EXT) header fields static final long EXTCRC(byte[] b) { return LG(b, 4); } // crc of uncompressed data static final long EXTSIZ(byte[] b) { return LG(b, 8); } // compressed size static final long EXTLEN(byte[] b) { return LG(b, 12); } // uncompressed size // end of central directory header (END) fields static final int ENDSUB(byte[] b) { return SH(b, 8); } // number of entries on this disk static final int ENDTOT(byte[] b) { return SH(b, 10); } // total number of entries static final long ENDSIZ(byte[] b) { return LG(b, 12); } // central directory size static final long ENDOFF(byte[] b) { return LG(b, 16); } // central directory offset static final int ENDCOM(byte[] b) { return SH(b, 20); } // size of zip file comment static final int ENDCOM(byte[] b, int off) { return SH(b, off + 20); } // zip64 end of central directory recoder fields static final long ZIP64_ENDTOD(byte[] b) { return LL(b, 24); } // total number of entries on disk static final long ZIP64_ENDTOT(byte[] b) { return LL(b, 32); } // total number of entries static final long ZIP64_ENDSIZ(byte[] b) { return LL(b, 40); } // central directory size static final long ZIP64_ENDOFF(byte[] b) { return LL(b, 48); } // central directory offset static final long ZIP64_LOCOFF(byte[] b) { return LL(b, 8); } // zip64 end offset // central directory header (CEN) fields static final long CENSIG(byte[] b, int pos) { return LG(b, pos + 0); } static final int CENVEM(byte[] b, int pos) { return SH(b, pos + 4); } static final int CENVER(byte[] b, int pos) { return SH(b, pos + 6); } static final int CENABC(byte[] b, int pos) { return SH(b, pos + 8); } static final int CENHOW(byte[] b, int pos) { return SH(b, pos + 10); } static final long CENTIM(byte[] b, int pos) { return LG(b, pos + 12); } static final long CENCRC(byte[] b, int pos) { return LG(b, pos + 16); } static final long CENSIZ(byte[] b, int pos) { return LG(b, pos + 20); } static final long CENLEN(byte[] b, int pos) { return LG(b, pos + 24); } static final int CENNAM(byte[] b, int pos) { return SH(b, pos + 28); } static final int CENEXT(byte[] b, int pos) { return SH(b, pos + 30); } static final int CENCOM(byte[] b, int pos) { return SH(b, pos + 32); } static final int CENDSK(byte[] b, int pos) { return SH(b, pos + 34); } static final int CENATT(byte[] b, int pos) { return SH(b, pos + 36); } static final long CENATX(byte[] b, int pos) { return LG(b, pos + 38); } static final long CENOFF(byte[] b, int pos) { return LG(b, pos + 42); } /* The END header is followed by a variable length comment of size < 64k. */ static final long END_MAXLEN = 0xFFFF + ENDHDR; static final int READBLOCKSZ = 128; public static class ApkUtilTool { private FileChannel ch; // channel to the zipfile private FileChannel fc; /** * 修复zip伪加密状态的Entry * * @param inZip * @param fixZip * @throws IOException */ public void FixEncryptedEntry(File inZip, File fixZip) throws IOException { changEntry(inZip, fixZip, true); } /** * 修复zip伪加密状态的Entry * * @param inZip * @param fixZip * @throws IOException */ public void FixEncryptedEntry(String inZip, String fixZip) throws IOException { FixEncryptedEntry(new File(inZip), new File(fixZip)); } /** * 修改zip的Entry为伪加密状态 * * @param inZip * @param storeZip * @throws IOException */ public void ChangToEncryptedEntry(File inZip, File storeZip) throws IOException { changEntry(inZip, storeZip, false); } /** * 修改zip的Entry为伪加密状态 * * @param inZip * @param storeZip * @throws IOException */ public void ChangToEncryptedEntry(String inZip, String storeZip) throws IOException { ChangToEncryptedEntry(new File(inZip), new File(storeZip)); } /** * 更改zip的Entry为伪加密状态 * * @param inZip * @param storeZip * @param fix ture:修复伪加密 false:更改到伪加密 * @throws IOException */ private void changEntry(File inZip, File storeZip, boolean fix) throws IOException { FileInputStream fis = new FileInputStream(inZip); FileOutputStream fos = new FileOutputStream(storeZip); byte[] buf = new byte[10240]; int len; while ((len = fis.read(buf)) != -1) { fos.write(buf, 0, len); } ch = fis.getChannel(); fc = fos.getChannel(); changEntry(fix); ch.close(); fc.close(); fis.close(); fos.close(); } // Reads zip file central directory. Returns the file position of first // CEN header, otherwise returns -1 if an error occured. If zip->msg != // NULL // then the error was a zip format error and zip->msg has the error // text. // Always pass in -1 for knownTotal; it's used for a recursive call. private void changEntry(boolean fix) throws IOException { END end = findEND(); if (end.cenlen > end.endpos) zerror("invalid END header (bad central directory size)"); long cenpos = end.endpos - end.cenlen; // position of CEN table // Get position of first local file (LOC) header, taking into // account that there may be a stub prefixed to the zip file. long locpos = cenpos - end.cenoff; if (locpos < 0) zerror("invalid END header (bad central directory offset)"); // read in the CEN and END byte[] cen = new byte[(int) (end.cenlen + ENDHDR)]; if (readFullyAt(cen, 0, cen.length, cenpos) != end.cenlen + ENDHDR) { zerror("read CEN tables failed"); } int pos = 0; int limit = cen.length - ENDHDR; while (pos < limit) { if (CENSIG(cen, pos) != CENSIG) zerror("invalid CEN header (bad signature)"); int method = CENHOW(cen, pos); int nlen = CENNAM(cen, pos); int elen = CENEXT(cen, pos); int clen = CENCOM(cen, pos); if (fix) { if ((CENABC(cen, pos) & 1) != 0) { byte[] name = Arrays.copyOfRange(cen, pos + CENHDR, pos + CENHDR + nlen); // System.out.println("Found the encrypted entry : " // + new String(name) + ", fix..."); // b[n] & 0xff) | ((b[n + 1] & 0xff) << 8 cen[pos + 8] &= 0xFE; // cen[pos+8] ^= CEN***(cen, pos) % 2; // cen[pos+8] ^= cen[pos+8] % 2; // zerror("invalid CEN header (encrypted entry)"); } } else { if ((CENABC(cen, pos) & 1) == 0) { byte[] name = Arrays.copyOfRange(cen, pos + CENHDR, pos + CENHDR + nlen); // System.out.println("Chang the entry : " // + new String(name) + ", Encrypted..."); // b[n] & 0xff) | ((b[n + 1] & 0xff) << 8 cen[pos + 8] |= 0x1; // zerror("invalid CEN header (encrypted entry)"); } } if (method != METHOD_STORED && method != METHOD_DEFLATED) zerror("invalid CEN header (unsupported compression method: " + method + ")"); if (pos + CENHDR + nlen > limit) zerror("invalid CEN header (bad header size)"); // skip ext and comment pos += (CENHDR + nlen + elen + clen); } writeFullyAt(cen, 0, cen.length, cenpos); if (pos + ENDHDR != cen.length) { zerror("invalid CEN header (bad header size)"); } } // Reads len bytes of data from the specified offset into buf. // Returns the total number of bytes read. // Each/every byte read from here (except the cen, which is mapped). final long readFullyAt(byte[] buf, int off, long len, long pos) throws IOException { ByteBuffer bb = ByteBuffer.wrap(buf); bb.position(off); bb.limit((int) (off + len)); return readFullyAt(bb, pos); } private final long readFullyAt(ByteBuffer bb, long pos) throws IOException { synchronized (ch) { return ch.position(pos).read(bb); } } final long writeFullyAt(byte[] buf, int off, long len, long pos) throws IOException { ByteBuffer bb = ByteBuffer.wrap(buf); bb.position(off); bb.limit((int) (off + len)); return writeFullyAt(bb, pos); } private final long writeFullyAt(ByteBuffer bb, long pos) throws IOException { synchronized (fc) { return fc.position(pos).write(bb); } } // Searches for end of central directory (END) header. The contents of // the END header will be read and placed in endbuf. Returns the file // position of the END header, otherwise returns -1 if the END header // was not found or an error occurred. private END findEND() throws IOException { byte[] buf = new byte[READBLOCKSZ]; long ziplen = ch.size(); long minHDR = (ziplen - END_MAXLEN) > 0 ? ziplen - END_MAXLEN : 0; long minPos = minHDR - (buf.length - ENDHDR); for (long pos = ziplen - buf.length; pos >= minPos; pos -= (buf.length - ENDHDR)) { int off = 0; if (pos < 0) { // Pretend there are some NUL bytes before start of file off = (int) -pos; Arrays.fill(buf, 0, off, (byte) 0); } int len = buf.length - off; if (readFullyAt(buf, off, len, pos + off) != len) zerror("zip END header not found"); // Now scan the block backwards for END header signature for (int i = buf.length - ENDHDR; i >= 0; i--) { if (buf[i + 0] == (byte) 'P' && buf[i + 1] == (byte) 'K' && buf[i + 2] == (byte) '\005' && buf[i + 3] == (byte) '\006' && (pos + i + ENDHDR + ENDCOM(buf, i) == ziplen)) { // Found END header buf = Arrays.copyOfRange(buf, i, i + ENDHDR); END end = new END(); end.endsub = ENDSUB(buf); end.centot = ENDTOT(buf); end.cenlen = ENDSIZ(buf); end.cenoff = ENDOFF(buf); end.comlen = ENDCOM(buf); end.endpos = pos + i; if (end.cenlen == ZIP64_MINVAL || end.cenoff == ZIP64_MINVAL || end.centot == ZIP64_MINVAL32) { // need to find the zip64 end; byte[] loc64 = new byte[ZIP64_LOCHDR]; if (readFullyAt(loc64, 0, loc64.length, end.endpos - ZIP64_LOCHDR) != loc64.length) { return end; } long end64pos = ZIP64_LOCOFF(loc64); byte[] end64buf = new byte[ZIP64_ENDHDR]; if (readFullyAt(end64buf, 0, end64buf.length, end64pos) != end64buf.length) { return end; } // end64 found, re-calcualte everything. end.cenlen = ZIP64_ENDSIZ(end64buf); end.cenoff = ZIP64_ENDOFF(end64buf); end.centot = (int) ZIP64_ENDTOT(end64buf); // assume // total // < 2g end.endpos = end64pos; } return end; } } } zerror("zip END header not found"); return null; // make compiler happy } static void zerror(String msg) { throw new ZipError(msg); } // End of central directory record static class END { int disknum; int sdisknum; int endsub; // endsub int centot; // 4 bytes long cenlen; // 4 bytes long cenoff; // 4 bytes int comlen; // comment length byte[] comment; /* members of Zip64 end of central directory locator */ int diskNum; long endpos; int disktot; @Override public String toString() { return "disknum : " + disknum + "\n" + "sdisknum : " + sdisknum + "\n" + "endsub : " + endsub + "\n" + "centot : " + centot + "\n" + "cenlen : " + cenlen + "\n" + "cenoff : " + cenoff + "\n" + "comlen : " + comlen + "\n" + "diskNum : " + diskNum + "\n" + "endpos : " + endpos + "\n" + "disktot : " + disktot; } } } }
{ "pile_set_name": "Github" }
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("test.window.client")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("test.window.client")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 会使此程序集中的类型 //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 //请将此类型的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("71178d39-6556-4e10-a4e3-79173f3e0d1b")] // 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 // 生成号 // 修订号 // // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 // 方法是按如下所示使用“*”: : // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
{ "pile_set_name": "Github" }
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"> <command> <renew> <domain:renew xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> <domain:name>example.com</domain:name> <domain:curExpDate>2000-04-03</domain:curExpDate> <domain:period unit="y">5</domain:period> </domain:renew> </renew> <clTRID>ABC-12345</clTRID> </command> </epp>
{ "pile_set_name": "Github" }
/* * Copyright 2016 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package me.saket.dank.widgets; import android.content.Context; import android.graphics.Path; import android.transition.ArcMotion; import android.util.AttributeSet; /** * Copied from plaid. * * A tweak to {@link ArcMotion} which slightly alters the path calculation. In the real world * gravity slows upward motion and accelerates downward motion. This class emulates this behavior * to make motion paths appear more natural. * <p> * See https://www.google.com/design/spec/motion/movement.html#movement-movement-within-screen-bounds */ public class GravityArcMotion extends ArcMotion { private static final float DEFAULT_MIN_ANGLE_DEGREES = 0; private static final float DEFAULT_MAX_ANGLE_DEGREES = 70; private static final float DEFAULT_MAX_TANGENT = (float) Math.tan(Math.toRadians(DEFAULT_MAX_ANGLE_DEGREES/2)); private float mMinimumHorizontalAngle = 0; private float mMinimumVerticalAngle = 0; private float mMaximumAngle = DEFAULT_MAX_ANGLE_DEGREES; private float mMinimumHorizontalTangent = 0; private float mMinimumVerticalTangent = 0; private float mMaximumTangent = DEFAULT_MAX_TANGENT; public GravityArcMotion() {} public GravityArcMotion(Context context, AttributeSet attrs) { super(context, attrs); } /** * @inheritDoc */ @Override public void setMinimumHorizontalAngle(float angleInDegrees) { mMinimumHorizontalAngle = angleInDegrees; mMinimumHorizontalTangent = toTangent(angleInDegrees); } /** * @inheritDoc */ @Override public float getMinimumHorizontalAngle() { return mMinimumHorizontalAngle; } /** * @inheritDoc */ @Override public void setMinimumVerticalAngle(float angleInDegrees) { mMinimumVerticalAngle = angleInDegrees; mMinimumVerticalTangent = toTangent(angleInDegrees); } /** * @inheritDoc */ @Override public float getMinimumVerticalAngle() { return mMinimumVerticalAngle; } /** * @inheritDoc */ @Override public void setMaximumAngle(float angleInDegrees) { mMaximumAngle = angleInDegrees; mMaximumTangent = toTangent(angleInDegrees); } /** * @inheritDoc */ @Override public float getMaximumAngle() { return mMaximumAngle; } private static float toTangent(float arcInDegrees) { if (arcInDegrees < 0 || arcInDegrees > 90) { throw new IllegalArgumentException("Arc must be between 0 and 90 degrees"); } return (float) Math.tan(Math.toRadians(arcInDegrees / 2)); } @Override public Path getPath(float startX, float startY, float endX, float endY) { // Here's a little ascii art to show how this is calculated: // c---------- b // \ / | // \ d | // \ / e // a----f // This diagram assumes that the horizontal distance is less than the vertical // distance between The start point (a) and end point (b). // d is the midpoint between a and b. c is the center point of the circle with // This path is formed by assuming that start and end points are in // an arc on a circle. The end point is centered in the circle vertically // and start is a point on the circle. // Triangles bfa and bde form similar right triangles. The control points // for the cubic Bezier arc path are the midpoints between a and e and e and b. Path path = new Path(); path.moveTo(startX, startY); float ex; float ey; if (startY == endY) { ex = (startX + endX) / 2; ey = startY + mMinimumHorizontalTangent * Math.abs(endX - startX) / 2; } else if (startX == endX) { ex = startX + mMinimumVerticalTangent * Math.abs(endY - startY) / 2; ey = (startY + endY) / 2; } else { float deltaX = endX - startX; /** * This is the only change to ArcMotion */ float deltaY; if (endY < startY) { deltaY = startY - endY; // Y is inverted compared to diagram above. } else { deltaY = endY - startY; } /** * End changes */ // hypotenuse squared. float h2 = deltaX * deltaX + deltaY * deltaY; // Midpoint between start and end float dx = (startX + endX) / 2; float dy = (startY + endY) / 2; // Distance squared between end point and mid point is (1/2 hypotenuse)^2 float midDist2 = h2 * 0.25f; float minimumArcDist2; if (Math.abs(deltaX) < Math.abs(deltaY)) { // Similar triangles bfa and bde mean that (ab/fb = eb/bd) // Therefore, eb = ab * bd / fb // ab = hypotenuse // bd = hypotenuse/2 // fb = deltaY float eDistY = h2 / (2 * deltaY); ey = endY + eDistY; ex = endX; minimumArcDist2 = midDist2 * mMinimumVerticalTangent * mMinimumVerticalTangent; } else { // Same as above, but flip X & Y float eDistX = h2 / (2 * deltaX); ex = endX + eDistX; ey = endY; minimumArcDist2 = midDist2 * mMinimumHorizontalTangent * mMinimumHorizontalTangent; } float arcDistX = dx - ex; float arcDistY = dy - ey; float arcDist2 = arcDistX * arcDistX + arcDistY * arcDistY; float maximumArcDist2 = midDist2 * mMaximumTangent * mMaximumTangent; float newArcDistance2 = 0; if (arcDist2 < minimumArcDist2) { newArcDistance2 = minimumArcDist2; } else if (arcDist2 > maximumArcDist2) { newArcDistance2 = maximumArcDist2; } if (newArcDistance2 != 0) { float ratio2 = newArcDistance2 / arcDist2; float ratio = (float) Math.sqrt(ratio2); ex = dx + (ratio * (ex - dx)); ey = dy + (ratio * (ey - dy)); } } float controlX1 = (startX + ex) / 2; float controlY1 = (startY + ey) / 2; float controlX2 = (ex + endX) / 2; float controlY2 = (ey + endY) / 2; path.cubicTo(controlX1, controlY1, controlX2, controlY2, endX, endY); return path; } }
{ "pile_set_name": "Github" }
<?php /** * Copyright since 2007 PrestaShop SA and Contributors * PrestaShop is an International Registered Trademark & Property of PrestaShop SA * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.md. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to https://devdocs.prestashop.com/ for more information. * * @author PrestaShop SA and Contributors <[email protected]> * @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShopBundle\Form\Admin\Configure\AdvancedParameters\Import; use PrestaShop\PrestaShop\Core\Import\Configuration\ImportConfigInterface; /** * Interface ImportFormDataProviderInterface describes a data provider for import forms. */ interface ImportFormDataProviderInterface { /** * Get form's data. * * @param ImportConfigInterface $importConfig * * @return array */ public function getData(ImportConfigInterface $importConfig); /** * Save the form's data. * * @param array $data * * @return array of errors, if occurred */ public function setData(array $data); }
{ "pile_set_name": "Github" }
package modern.challenge; public class Fruit<T, Q> { }
{ "pile_set_name": "Github" }
ALTER TABLE import_source ADD COLUMN description TEXT DEFAULT NULL; ALTER TABLE sync_rule ADD COLUMN description TEXT DEFAULT NULL; INSERT INTO director_schema_migration (schema_version, migration_time) VALUES (137, NOW());
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <objc/NSObject.h> @interface PKSubcredentialProvisioningConfiguration : NSObject { long long _configurationType; } @property(readonly, nonatomic) long long configurationType; // @synthesize configurationType=_configurationType; - (long long)startingState; - (id)transitionTable; - (id)remoteDeviceInvitation; - (id)acceptInvitationConfiguration; - (id)remoteDeviceConfiguration; - (id)ownerConfiguration; - (id)localDeviceConfiguration; - (id)initWithConfigurationType:(long long)arg1; @end
{ "pile_set_name": "Github" }
# # This is a copy of innodb-alter.test except using remote tablespaces # and showing those files. # SET default_storage_engine=InnoDB; SET GLOBAL innodb_file_per_table=ON; SET NAMES utf8; Warnings: Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. CREATE TABLE t1 ( c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, INDEX(c2)) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; INSERT INTO t1 SET c1=1; CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME LIKE 'test/t%'; CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_INDEXES i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; CREATE TABLE t1p LIKE t1; CREATE TABLE t1c (c1 INT PRIMARY KEY, c2 INT, c3 INT, INDEX(c2), INDEX(c3), CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES t1(c2), CONSTRAINT t1c3 FOREIGN KEY (c3) REFERENCES t1p(c2)) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; CREATE TABLE sys_foreign SELECT i.* FROM INFORMATION_SCHEMA.INNODB_FOREIGN i WHERE FOR_NAME LIKE 'test/t%'; SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS c2 c2 1 c3 c2 1 SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c1 0 6 1283 4 c2 1 6 1027 4 ct 2 5 16711932 10 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME c2 0 c2 PRIMARY 0 c1 SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS c2 c2 1 c3 c2 1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int NOT NULL, `c2` int DEFAULT '1', `ct` text, PRIMARY KEY (`c1`), KEY `c2` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' ALTER TABLE t1 ALTER c2 DROP DEFAULT; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c1` int NOT NULL, `c2` int, `ct` text, PRIMARY KEY (`c1`), KEY `c2` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1p.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1.ibd t1c.ibd SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c1 0 6 1283 4 c2 1 6 1027 4 ct 2 5 16711932 10 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME c2 0 c2 PRIMARY 0 c1 SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS c2 c2 1 c3 c2 1 ALTER TABLE t1 CHANGE c2 c2 INT AFTER c1; ALTER TABLE t1 CHANGE c1 c1 INT FIRST; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1p.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1.ibd t1c.ibd SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c1 0 6 1283 4 c2 1 6 1027 4 ct 2 5 16711932 10 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME c2 0 c2 PRIMARY 0 c1 SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS c2 c2 1 c3 c2 1 ALTER TABLE t1 CHANGE C2 c3 INT; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1p.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1.ibd t1c.ibd SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c1 0 6 1283 4 c3 1 6 1027 4 ct 2 5 16711932 10 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME c2 0 c3 PRIMARY 0 c1 SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS c2 c3 1 c3 c2 1 ALTER TABLE t1 CHANGE c3 C INT; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1p.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1.ibd t1c.ibd SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN C 1 6 1027 4 c1 0 6 1283 4 ct 2 5 16711932 10 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME c2 0 C PRIMARY 0 c1 SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS c2 C 1 c3 c2 1 ALTER TABLE t1 CHANGE C Cöŀumň_TWO INT; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1p.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1.ibd t1c.ibd SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS c2 Cöŀumň_TWO 1 c3 c2 1 SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c1 0 6 1283 4 Cöŀumň_TWO 1 6 1027 4 ct 2 5 16711932 10 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME c2 0 Cöŀumň_TWO PRIMARY 0 c1 SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS c2 Cöŀumň_TWO 1 c3 c2 1 ALTER TABLE t1 CHANGE cöĿǖmň_two c3 INT; ERROR 42S22: Unknown column 'cöĿǖmň_two' in 't1' ALTER TABLE t1 CHANGE cÖĿUMŇ_two c3 INT, RENAME TO t3; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1p.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1c.ibd t3.ibd SELECT st.NAME, i.NAME FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_TABLES i ON i.TABLE_ID=st.TABLE_ID; NAME NAME test/t1 test/t3 SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `c1` int NOT NULL, `c3` int DEFAULT NULL, `ct` text, PRIMARY KEY (`c1`), KEY `c2` (`c3`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SHOW CREATE TABLE t1c; Table Create Table t1c CREATE TABLE `t1c` ( `c1` int NOT NULL, `c2` int DEFAULT NULL, `c3` int DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c2`), KEY `c3` (`c3`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t3` (`c3`), CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' ALTER TABLE t3 CHANGE c3 `12345678901234567890123456789012345678901234567890123456789012345` INT; ERROR 42000: Identifier name '12345678901234567890123456789012345678901234567890123456789012345' is too long ALTER TABLE t3 CHANGE c3 `1234567890123456789012345678901234567890123456789012345678901234` INT; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1p.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1c.ibd t3.ibd SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( `c1` int NOT NULL, `1234567890123456789012345678901234567890123456789012345678901234` int DEFAULT NULL, `ct` text, PRIMARY KEY (`c1`), KEY `c2` (`1234567890123456789012345678901234567890123456789012345678901234`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' ALTER TABLE t3 CHANGE `1234567890123456789012345678901234567890123456789012345678901234` `倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿偀` INT; ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠?' is too long ALTER TABLE t3 CHANGE `1234567890123456789012345678901234567890123456789012345678901234` `倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿ä` INT; ERROR 42000: Identifier name '倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠?' is too long ALTER TABLE t3 CHANGE `1234567890123456789012345678901234567890123456789012345678901234` `倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾ä` INT; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1p.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1c.ibd t3.ibd ALTER TABLE t3 CHANGE `倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾Ä` c3 INT; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1p.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1c.ibd t3.ibd ALTER TABLE t3 CHANGE c3 𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌈𐌉𐌊𐌋𐌌𐌍𐌎𐌏𐌐𐌑𐌒𐌓𐌔𐌕𐌖𐌗𐌘𐌙𐌚𐌛𐌜 INT; ERROR HY000: Invalid utf8 character string: '\xF0\x90\x8C\x80\xF0\x90\x8C\x81\xF0\x90\x8C\x82\xF0\x90\x8C\x83' ALTER TABLE t3 CHANGE c3 😲 INT; ERROR HY000: Invalid utf8 character string: '\xF0\x9F\x98\xB2' ALTER TABLE t3 RENAME TO t2; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1p.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1c.ibd t2.ibd SELECT st.NAME, i.NAME FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_TABLES i ON i.TABLE_ID=st.TABLE_ID; NAME NAME test/t1 test/t2 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `c1` int NOT NULL, `c3` int DEFAULT NULL, `ct` text, PRIMARY KEY (`c1`), KEY `c2` (`c3`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' RENAME TABLE t2 TO t1; SELECT st.NAME, i.NAME FROM sys_tables st INNER JOIN INFORMATION_SCHEMA.INNODB_TABLES i ON i.TABLE_ID=st.TABLE_ID; NAME NAME test/t1 test/t1 ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1p.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1.ibd t1c.ibd SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c1 0 6 1283 4 c3 1 6 1027 4 ct 2 5 16711932 10 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME c2 0 c3 PRIMARY 0 c1 SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS c2 c3 1 c3 c2 1 ALTER TABLE t1 DROP INDEX c2; ERROR HY000: Cannot drop index 'c2': needed in a foreign key constraint ALTER TABLE t1 DROP INDEX c4; ERROR 42000: Can't DROP 'c4'; check that column/key exists ALTER TABLE t1c DROP FOREIGN KEY c2; ERROR 42000: Can't DROP 'c2'; check that column/key exists ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2; ERROR 42000: Can't DROP 'c2'; check that column/key exists ALTER TABLE t1c DROP FOREIGN KEY t1c2, DROP FOREIGN KEY c2, DROP INDEX c2; ERROR 42000: Can't DROP 'c2'; check that column/key exists ALTER TABLE t1c DROP INDEX c2; ERROR HY000: Cannot drop index 'c2': needed in a foreign key constraint ALTER TABLE t1c DROP FOREIGN KEY ẗ1C2; ERROR 42000: Can't DROP 'ẗ1C2'; check that column/key exists SHOW CREATE TABLE t1c; Table Create Table t1c CREATE TABLE `t1c` ( `c1` int NOT NULL, `c2` int DEFAULT NULL, `c3` int DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c2`), KEY `c3` (`c3`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SET foreign_key_checks=0; DROP TABLE t1p; SET foreign_key_checks=1; SHOW CREATE TABLE t1c; Table Create Table t1c CREATE TABLE `t1c` ( `c1` int NOT NULL, `c2` int DEFAULT NULL, `c3` int DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c2`), KEY `c3` (`c3`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1.ibd t1c.ibd SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c1 0 6 1283 4 c3 1 6 1027 4 ct 2 5 16711932 10 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME c2 0 c3 PRIMARY 0 c1 SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS c2 c3 1 c3 c2 1 CREATE TABLE t1p (c1 INT PRIMARY KEY, c2 INT, INDEX(c2)) ENGINE=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; ALTER TABLE t1c DROP INDEX C2, DROP INDEX C3; ERROR HY000: Cannot drop index 'c2': needed in a foreign key constraint ALTER TABLE t1c DROP INDEX C3; ERROR HY000: Cannot drop index 'c3': needed in a foreign key constraint SET foreign_key_checks=0; ALTER TABLE t1c DROP INDEX C3; ERROR HY000: Cannot drop index 'c3': needed in a foreign key constraint ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1.ibd t1c.ibd t1p.ibd SET foreign_key_checks=1; SHOW CREATE TABLE t1c; Table Create Table t1c CREATE TABLE `t1c` ( `c1` int NOT NULL, `c2` int DEFAULT NULL, `c3` int DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c2`), KEY `c3` (`c3`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`), CONSTRAINT `t1c3` FOREIGN KEY (`c3`) REFERENCES `t1p` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c1 0 6 1283 4 c3 1 6 1027 4 ct 2 5 16711932 10 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME c2 0 c3 PRIMARY 0 c1 SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS c2 c3 1 c3 c2 1 ALTER TABLE t1c DROP FOREIGN KEY t1C3; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1.ibd t1c.ibd t1p.ibd SHOW CREATE TABLE t1c; Table Create Table t1c CREATE TABLE `t1c` ( `c1` int NOT NULL, `c2` int DEFAULT NULL, `c3` int DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c2` (`c2`), KEY `c3` (`c3`), CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `t1` (`c3`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c1 0 6 1283 4 c3 1 6 1027 4 ct 2 5 16711932 10 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME c2 0 c3 PRIMARY 0 c1 SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS c2 c3 1 ALTER TABLE t1c DROP INDEX c2, DROP FOREIGN KEY t1C2; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1.ibd t1c.ibd t1p.ibd SHOW CREATE TABLE t1c; Table Create Table t1c CREATE TABLE `t1c` ( `c1` int NOT NULL, `c2` int DEFAULT NULL, `c3` int DEFAULT NULL, PRIMARY KEY (`c1`), KEY `c3` (`c3`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c1 0 6 1283 4 c3 1 6 1027 4 ct 2 5 16711932 10 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME c2 0 c3 PRIMARY 0 c1 SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS ALTER TABLE t1 DROP INDEX c2, CHANGE c3 c2 INT; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd ### files in MYSQL_TMP_DIR/alt_dir/test t1.ibd t1c.ibd t1p.ibd SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c1 0 6 1283 4 c2 1 6 1027 4 ct 2 5 16711932 10 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME PRIMARY 0 c1 SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS CREATE TABLE t1o LIKE t1; ALTER TABLE t1 ADD FULLTEXT INDEX (ct), CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt, ALGORITHM=INPLACE, LOCK=NONE; ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED. ALTER TABLE t1 ADD FULLTEXT INDEX (ct), CHANGE c1 pk INT, ALTER c2 SET DEFAULT 42, RENAME TO tt, ALGORITHM=INPLACE, LOCK=SHARED; Warnings: Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd t1c.ibd t1p.ibd tt.ibd SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS SHOW CREATE TABLE tt; Table Create Table tt CREATE TABLE `tt` ( `pk` int NOT NULL, `c2` int DEFAULT '42', `ct` text, PRIMARY KEY (`pk`), FULLTEXT KEY `ct` (`ct`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/' ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=COPY; ERROR 42000: Incorrect column name 'dB_row_Id' ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=INPLACE; ERROR 42000: Incorrect column name 'DB_ROW_ID' ALTER TABLE t1o CHANGE c1 DB_TRX_ID INT; ERROR 42000: Incorrect column name 'DB_TRX_ID' ALTER TABLE t1o CHANGE c1 db_roll_ptr INT; ERROR 42000: Incorrect column name 'db_roll_ptr' ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT, ALGORITHM=COPY; ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID INT, ALGORITHM=INPLACE; ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_Doc_ID INT, ALGORITHM=INPLACE; ERROR HY000: Column 'FTS_Doc_ID' is of wrong type for an InnoDB FULLTEXT index ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY. CREATE TABLE t1n LIKE t1o; ALTER TABLE t1n ADD FULLTEXT INDEX(ct); Warnings: Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID ### files in MYSQL_DATA_DIR/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1n.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd t1c.ibd t1p.ibd tt.ibd ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=INPLACE; ERROR HY000: Column 'Fts_DOC_ID' is of wrong type for an InnoDB FULLTEXT index ALTER TABLE t1n CHANGE c1 Fts_DOC_ID INT, ALGORITHM=COPY; ERROR HY000: Column 'Fts_DOC_ID' is of wrong type for an InnoDB FULLTEXT index ALTER TABLE t1n CHANGE FTS_DOC_ID c11 INT, ALGORITHM=INPLACE; ERROR 42S22: Unknown column 'FTS_DOC_ID' in 't1n' ALTER TABLE t1n CHANGE c1 FTS_DOC_ïD INT, ALGORITHM=INPLACE; ### files in MYSQL_DATA_DIR/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1n.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd t1c.ibd t1p.ibd tt.ibd ALTER TABLE t1n CHANGE FTS_DOC_ÏD c1 INT, ALGORITHM=INPLACE; ### files in MYSQL_DATA_DIR/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1n.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd t1c.ibd t1p.ibd tt.ibd ALTER TABLE t1n CHANGE c1 c2 INT, CHANGE c2 ct INT, CHANGE ct c1 TEXT, ALGORITHM=INPLACE; ### files in MYSQL_DATA_DIR/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1n.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd t1c.ibd t1p.ibd tt.ibd SHOW CREATE TABLE t1n; Table Create Table t1n CREATE TABLE `t1n` ( `c2` int NOT NULL, `ct` int DEFAULT NULL, `c1` text, PRIMARY KEY (`c2`), FULLTEXT KEY `ct` (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ALTER TABLE t1n CHANGE c2 c1 INT, CHANGE ct c2 INT, CHANGE c1 ct TEXT, ALGORITHM=COPY; ### files in MYSQL_DATA_DIR/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1n.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd t1c.ibd t1p.ibd tt.ibd SHOW CREATE TABLE t1n; Table Create Table t1n CREATE TABLE `t1n` ( `c1` int NOT NULL, `c2` int DEFAULT NULL, `ct` text, PRIMARY KEY (`c1`), FULLTEXT KEY `ct` (`ct`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE; ERROR 42000: Key column 'c2' doesn't exist in table ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY; ERROR 42000: Key column 'c2' doesn't exist in table ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE; ### files in MYSQL_DATA_DIR/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1n.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd t1c.ibd t1p.ibd tt.ibd SHOW CREATE TABLE t1n; Table Create Table t1n CREATE TABLE `t1n` ( `c1` int NOT NULL, `c4` int DEFAULT NULL, `ct` text, PRIMARY KEY (`c1`), KEY `c4` (`c4`), FULLTEXT KEY `ct` (`ct`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ALTER TABLE t1n DROP INDEX c4; ### files in MYSQL_DATA_DIR/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1n.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd t1c.ibd t1p.ibd tt.ibd ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE; ERROR 42S21: Duplicate column name 'c1' ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE; ### files in MYSQL_DATA_DIR/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1n.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd t1c.ibd t1p.ibd tt.ibd SHOW CREATE TABLE t1n; Table Create Table t1n CREATE TABLE `t1n` ( `c1` int NOT NULL, `c11` int DEFAULT NULL, `ct` text, PRIMARY KEY (`c1`), KEY `c11` (`c11`), FULLTEXT KEY `ct` (`ct`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DROP TABLE t1n; ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd t1c.ibd t1p.ibd tt.ibd ALTER TABLE t1o ADD FULLTEXT INDEX(ct), CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; ### files in MYSQL_DATA_DIR/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd t1c.ibd t1p.ibd tt.ibd ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, LOCK=NONE; ERROR 0A000: LOCK=NONE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try LOCK=SHARED. SELECT sc.pos FROM information_schema.innodb_columns sc INNER JOIN information_schema.innodb_tables st ON sc.TABLE_ID=st.TABLE_ID WHERE st.NAME='test/t1o' AND sc.NAME='FTS_DOC_ID'; pos 0 SHOW CREATE TABLE t1o; Table Create Table t1o CREATE TABLE `t1o` ( `FTS_DOC_ID` bigint unsigned NOT NULL, `c2` int DEFAULT NULL, `ct` text, PRIMARY KEY (`FTS_DOC_ID`), FULLTEXT KEY `ct` (`ct`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, DROP INDEX ct, LOCK=NONE; ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd t1c.ibd t1p.ibd tt.ibd SHOW CREATE TABLE t1o; Table Create Table t1o CREATE TABLE `t1o` ( `foo_id` bigint unsigned NOT NULL, `c2` int DEFAULT NULL, `ct` text, PRIMARY KEY (`foo_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci DROP TABLE t1c, t1p, sys_tables, sys_indexes, sys_foreign; CREATE TABLE sys_tables SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME='test/t1o'; CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_INDEXES i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; CREATE TABLE sys_foreign SELECT i.* FROM INFORMATION_SCHEMA.INNODB_FOREIGN i WHERE FOR_NAME='test/t1o'; SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c2 1 6 1027 4 ct 2 5 16711932 10 foo_id 0 6 1800 8 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME PRIMARY 0 foo_id SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id); ### files in MYSQL_DATA_DIR/test sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd tt.ibd ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ADD FULLTEXT INDEX(ct); ### files in MYSQL_DATA_DIR/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd sys_foreign.ibd sys_indexes.ibd sys_tables.ibd t1o.ibd ### files in MYSQL_TMP_DIR/alt_dir/test fts_aux_index_1.ibd fts_aux_index_2.ibd fts_aux_index_3.ibd fts_aux_index_4.ibd fts_aux_index_5.ibd fts_aux_index_6.ibd fts_aux_being_deleted.ibd fts_aux_being_deleted_cache.ibd fts_aux_config.ibd fts_aux_deleted.ibd fts_aux_deleted_cache.ibd tt.ibd ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL; ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index DROP TABLE sys_indexes; CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_INDEXES i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN FROM INFORMATION_SCHEMA.INNODB_COLUMNS i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID ORDER BY i.NAME,i.POS; NAME POS MTYPE PRTYPE LEN c2 1 6 1027 4 ct 2 5 16711932 10 FTS_DOC_ID 0 6 1800 8 SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_FIELDS i INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID ORDER BY si.NAME, i.POS; NAME POS NAME ct 0 ct FTS_DOC_ID_INDEX 0 FTS_DOC_ID PRIMARY 0 FTS_DOC_ID SELECT i.FOR_COL_NAME, i.REF_COL_NAME, i.POS FROM INFORMATION_SCHEMA.INNODB_FOREIGN_COLS i INNER JOIN sys_foreign sf ON i.ID = sf.ID; FOR_COL_NAME REF_COL_NAME POS # # Cleanup # DROP TABLE tt, t1o, sys_tables, sys_indexes, sys_foreign; ### files in MYSQL_DATA_DIR/test ### files in MYSQL_TMP_DIR/alt_dir/test
{ "pile_set_name": "Github" }
SOURCE=FloatingPointRangeExp01.fs # FloatingPointRangeExp01.fs SOURCE=CustomType01.fs # CustomType01.fs SOURCE=CustomType02.fs # CustomType02.fs
{ "pile_set_name": "Github" }
/* Vertical Tabs Default theme */ TabTreeCloseButton { qproperty-showOnNormal: 0; qproperty-showOnHovered: 1; qproperty-showOnSelected: 1; } TabTreeView { qproperty-backgroundIndentation: 0; }
{ "pile_set_name": "Github" }
package info.xiaohei.www.mr.kpi.source; import info.xiaohei.www.mr.kpi.Kpi; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import java.io.IOException; /** * Created by xiaohei on 16/2/21. */ public class Mapper extends org.apache.hadoop.mapreduce.Mapper<LongWritable, Text, Text, IntWritable> { Text source = new Text(); IntWritable one = new IntWritable(1); Kpi kpi = new Kpi(); @Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { kpi = Kpi.parse(value.toString()); if (kpi.getIs_validate()) { source.set(kpi.getHttp_referrer()); context.write(source, one); } } }
{ "pile_set_name": "Github" }
app.service('reportModel' , function (queryModel,bsLoadingOverlayService,connection,uuid2) { this.report = {}; this.getTheReport = function() { return this.report; } this.getReportDefinition = function(id,isLinked,mode,done) { connection.get('/api/v3/reports/view/'+id, {id: id, mode: mode, linked:isLinked}, function(data) { if (data.item) { //report = data.item; done(data.item); } else { done(null); } }); } this.setReport = function(report,parentDiv,mode,done) { setReport(report,parentDiv,mode,done); } function setReport(report,parentDiv,mode,done) { this.report = report; queryModel.selectedReport = report; showOverlay(parentDiv); var isLinked = false; //queryModel.loadQuery(report.query); //queryModel.detectLayerJoins(); queryModel.getQueryData2(report.query, function(data,sql,query,fromCache, executionTime){ report.query.data = data; report.query.sql = sql; report.query.fromCache = (fromCache); report.query.executionTime = (executionTime) ? executionTime : 0; report.parentDiv = parentDiv; repaintReport(report,mode); done(sql); hideOverlay(parentDiv); }, report); } this.prepareReport = function(report,parentDiv,mode) { prepareReport(report,parentDiv,mode); } function prepareReport(report,parentDiv,mode) { this.report = report; queryModel.selectedReport = report; var isLinked = false; report.parentDiv = parentDiv; if (report && report.query && report.query.columns && report.query.columns.length > 0) { //var el = document.getElementById('reportLayout'); //angular.element(el).empty(); //$scope.gettingData == true; //$scope.showOverlay('OVERLAY_reportLayout'); if (report.reportType == 'grid' || report.reportType == 'vertical-grid' || report.reportType == 'dxPivot' || report.reportType == 'dxGrid') { repaintReport(report,mode); } if (report.reportType == 'chart-line' || report.reportType == 'chart-donut' || report.reportType == 'chart-pie' || report.reportType == 'gauge') { var xKeys = []; var yKeys = []; for (var c in report.query.columns) { if (report.query.columns[c].elementRole == 'dimension' && !report.query.columns[c].hidden) xKeys.push(report.query.columns[c]); if (report.query.columns[c].elementRole == 'measure' && !report.query.columns[c].hidden) yKeys.push(report.query.columns[c]); } if (xKeys.length > 0 && yKeys.length > 0 ) { if(!report.properties) report.properties = {}; if(!report.properties.chart) report.properties.chart = {}; if (report.reportType == 'chart-line') report.properties.chart.type = 'bar'; report.properties.chart.dataColumns = yKeys; var customObjectData = xKeys[0]; report.properties.chart.dataAxis = {elementName:customObjectData.elementName, queryName:'query1', elementLabel:customObjectData.objectLabel, id:customObjectData.id, type:'bar', color:'#000000'} repaintReport(report,mode); } } if ( report.reportType == 'indicator') { //reportModel.prepareReport(report,'reportLayout',$scope.mode); repaintReport(report,mode); } } } this.getReportDataNextPage = function(report,page) { getReportDataNextPage(report,page); } function getReportDataNextPage(report,page) { queryModel.getQueryDataNextPage(report.query,page, function(data,sql,query, fromCache, executionTime){ report.query.data.push.apply(report.query.data, data); report.query.fromCache = (fromCache); report.query.executionTime = (executionTime) ? executionTime : 0; }); } this.repaintReport = function(report,mode) { this.report = report; repaintReport(report,mode); } function repaintReport(report,mode) { var data = report.query.data; if (data.length != 0) { switch(report.reportType) { case "grid": { //generateGrid(report,mode); if (report.properties.grid && report.properties.grid.refresh) report.properties.grid.refresh(); } break; case "vertical-grid": { if (report.properties.verticalGrid && report.properties.verticalGrid.refresh) report.properties.verticalGrid.refresh(); } break; case 'chart-line': case 'chart-donut': case 'chart-pie': case 'gauge': { if (report.reportType == 'chart-donut') report.properties.chart.type = 'donut'; if (report.reportType == 'chart-pie') report.properties.chart.type = 'pie'; if (report.reportType == 'gauge') report.properties.chart.type = 'gauge'; //generatec3Chart(report,mode); if (report.properties.chart && report.properties.chart.refresh) { report.properties.chart.refresh(); } } break; case 'indicator':{ //generateIndicator(report); if (report.properties.indicator && report.properties.indicator.refresh) report.properties.indicator.refresh(); } break; case "dxPivot": { var htmlCode = dxPivot.getDxPivot(report,mode); var el = document.getElementById(report.parentDiv); if (el) { angular.element(el).empty(); var $div = $(htmlCode); angular.element(el).append($div); angular.element(document).injector().invoke(function($compile) { var scope = angular.element($div).scope(); $compile($div)(scope); hideOverlay(report.parentDiv); }); } } break; case "dxGrid": { var htmlCode = dxGrid.getDxGrid(report,mode); var el = document.getElementById(report.parentDiv); if (el) { angular.element(el).empty(); var $div = $(htmlCode); angular.element(el).append($div); angular.element(document).injector().invoke(function($compile) { var scope = angular.element($div).scope(); $compile($div)(scope); hideOverlay(report.parentDiv); }); } } break; } } else { generateNoDataHTML(report); } } function generateNoDataHTML(report) { var htmlCode = '<span ng-if="report.reportName" style="font-size: small;color: darkgrey;padding: 5px;">'+report.reportName+'</span><div style="width: 100%;height: 100%;display: flex;align-items: center;"><span style="color: darkgray; font-size: initial; width:100%;text-align: center";><img src="/themes/xwst/assets/images/empty.png">Sorry, we have not found any data for this report with those search criteria</span></div>'; var el = document.getElementById(report.parentDiv); if (el) { angular.element(el).empty(); var $div = $(htmlCode); angular.element(el).append($div); angular.element(document).injector().invoke(function($compile) { var scope = angular.element($div).scope(); $compile($div)(scope); //hideOverlay('OVERLAY_'+report.parentDiv); hideOverlay(report.parentDiv); }); } } this.generateIndicator = function(report) { generateIndicator(report); } function showOverlay(referenceId) { bsLoadingOverlayService.start({ referenceId: referenceId }); }; function hideOverlay(referenceId) { bsLoadingOverlayService.stop({ referenceId: referenceId }); }; /* var selectedColumn = undefined; this.selectedColumn = function() { return selectedColumn; } var selectedColumnHashedID = undefined; this.selectedColumnHashedID = function() { return selectedColumnHashedID; } var selectedColumnIndex = undefined; this.selectedColumnIndex = function() { return selectedColumnIndex; } this.changeColumnStyle = function(report,columnIndex ,hashedID) { selectedColumn = report.properties.columns[columnIndex]; selectedColumnHashedID = hashedID; selectedColumnIndex = columnIndex; if (!selectedColumn.columnStyle) selectedColumn.columnStyle = {color:'#000','background-color':'#EEEEEE','text-align':'left','font-size':"12px",'font-weight':"normal",'font-style':"normal"}; $('#columnFormatModal').modal('show'); } this.changeColumnSignals = function(report,columnIndex ,hashedID) { selectedColumn = report.properties.columns[columnIndex]; selectedColumnHashedID = hashedID; selectedColumnIndex = columnIndex; if (!selectedColumn.signals) selectedColumn.signals = []; $('#columnSignalsModal').modal('show'); } this.orderColumn = function(report,columnIndex, desc,hashedID) { var theColumn = report.query.columns[columnIndex]; if (desc == true) theColumn.sortType = 1; else theColumn.sortType = -1; report.query.order = []; report.query.order.push(theColumn); showOverlay('OVERLAY_'+hashedID); queryModel.getQueryData(report.query, function(data,sql,query){ report.query.data = data; hideOverlay('OVERLAY_'+hashedID); }); //get the column index, identify the report.query.column by index, then add to query.order taking care about the sortType -1 / 1 }; */ function clone(obj) { if (null == obj || "object" != typeof obj) return obj; var copy = obj.constructor(); for (var attr in obj) { if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr]; } return copy; } this.saveAsReport = function(report,mode,done) { //Cleaning up the report object var clonedReport = clone(report); if (clonedReport.properties.chart) { clonedReport.properties.chart.chartCanvas = undefined; clonedReport.properties.chart.data = undefined; //clonedReport.properties.chart.query = undefined; } if (clonedReport.query.data) clonedReport.query.data = undefined; clonedReport.parentDiv = undefined; if (mode == 'new') { connection.post('/api/v3/reports', clonedReport, function(data) { if (data.result == 1) { setTimeout(function () { done(data); }, 400); } }); } else { connection.post('/api/v3/reports/'+report._id, clonedReport, function(result) { if (result.result == 1) { setTimeout(function () { done(); }, 400); } }); } }; this.saveToExcel = function($scope,reportHash) { var wopts = { bookType:'xlsx', bookSST:false, type:'binary' }; var ws_name = $scope.selectedReport.reportName; var wb = new Workbook(), ws = sheet_from_array_of_arrays($scope,reportHash); wb.SheetNames.push(ws_name); wb.Sheets[ws_name] = ws; var wbout = XLSX.write(wb,wopts); function s2ab(s) { var buf = new ArrayBuffer(s.length); var view = new Uint8Array(buf); for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; return buf; } saveAs(new Blob([s2ab(wbout)],{type:""}), ws_name+".xlsx") } function Workbook() { if(!(this instanceof Workbook)) return new Workbook(); this.SheetNames = []; this.Sheets = {}; } function sheet_from_array_of_arrays($scope,reportHash) { var data = $scope.selectedReport.query.data; var report = $scope.selectedReport; var ws = {}; var range = {s: {c:10000000, r:10000000}, e: {c:0, r:0 }}; for(var i = 0; i < report.properties.columns.length; i++) { if(range.s.r > 0) range.s.r = 0; if(range.s.c > i) range.s.c = i; if(range.e.r < 0) range.e.r = 0; if(range.e.c < i) range.e.c = i; var cell = {v: report.properties.columns[i].objectLabel }; var cell_ref = XLSX.utils.encode_cell({c:i,r:0}); if(typeof cell.v === 'number') cell.t = 'n'; else if(typeof cell.v === 'boolean') cell.t = 'b'; else if(cell.v instanceof Date) { cell.t = 'n'; cell.z = XLSX.SSF._table[14]; cell.v = datenum(cell.v); } else cell.t = 's'; ws[cell_ref] = cell; } for(var R = 0; R != data.length; ++R) { for(var i = 0; i < report.properties.columns.length; i++) { //var elementName = report.properties.columns[i].collectionID.toLowerCase()+'_'+report.properties.columns[i].elementName; var elementID = 'wst'+report.properties.columns[i].elementID.toLowerCase(); var elementName = elementID.replace(/[^a-zA-Z ]/g,''); if (report.properties.columns[i].aggregation) { //elementName = report.properties.columns[i].collectionID.toLowerCase()+'_'+report.properties.columns[i].elementName+report.properties.columns[i].aggregation; var elementID = 'wst'+report.properties.columns[i].elementID.toLowerCase()+report.properties.columns[i].aggregation; var elementName = elementID.replace(/[^a-zA-Z ]/g,''); } if(range.s.r > R+1) range.s.r = R+1; if(range.s.c > i) range.s.c = i; if(range.e.r < R+1) range.e.r = R+1; if(range.e.c < i) range.e.c = i; if ((report.properties.columns[i].elementType == 'DECIMAL' || report.properties.columns[i].elementType == 'INTEGER' || report.properties.columns[i].elementType == 'FLOAT' )&& data[R][elementName]) { var cell = {v: Number(data[R][elementName]) }; } else { var cell = {v: data[R][elementName] }; } var cell_ref = XLSX.utils.encode_cell({c:i,r:R+1}); if(typeof cell.v === 'number') cell.t = 'n'; else if(typeof cell.v === 'boolean') cell.t = 'b'; else if(cell.v instanceof Date) { cell.t = 'n'; cell.z = XLSX.SSF._table[14]; cell.v = datenum(cell.v); } else cell.t = 's'; cell.s = {fill: { fgColor: { rgb: "FFFF0000"}}}; ws[cell_ref] = cell; } } if(range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range); return ws; } this.getReportContainerHTML = function(reportID,reportType) { var containerID = 'REPORT_CONTAINER_'+reportID; var html = '<div class="container-fluid featurette ndContainer" ndType="container" style="height:100%;padding:0px;">'+ '<div class="col-md-12 ndContainer" ndType="column" style="height:100%;padding:0px;">'+ '<div page-block class="container-fluid" id="'+containerID+'" ndType="'+reportType+'" ng-init="getRuntimeReport('+"'"+reportID+"'"+')" bs-loading-overlay bs-loading-overlay-reference-id="REPORT_'+reportID+'" style="padding:0px;position: relative;height: 100%;"></div>'; '</div>'+ '</div>'; return html; } this.getPromptHTML = function(prompt) { var html = '<div id="PROMPT_'+prompt.elementID+'" page-block class="ndContainer" ndType="ndPrompt"><nd-prompt filter="getFilter('+"'"+prompt.elementID+"'"+')" element-id="'+prompt.elementID+'" label="'+prompt.objectLabel+'" value-field="'+prompt.name+'" show-field="'+prompt.name+'" prompts="prompts" after-get-values="afterPromptGetValues" on-change="promptChanged" ng-model="lastPromptSelectedValue"></nd-prompt></div>'; return html; } });
{ "pile_set_name": "Github" }
<?php /** * PHPExcel * * Copyright (c) 2006 - 2014 PHPExcel * * This library 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 library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel * @package PHPExcel_Writer_OpenDocument * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ /** * PHPExcel_Writer_OpenDocument_MetaInf * * @category PHPExcel * @package PHPExcel_Writer_OpenDocument * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) * @author Alexander Pervakov <[email protected]> */ class PHPExcel_Writer_OpenDocument_MetaInf extends PHPExcel_Writer_OpenDocument_WriterPart { /** * Write META-INF/manifest.xml to XML format * * @param PHPExcel $pPHPExcel * @return string XML Output * @throws PHPExcel_Writer_Exception */ public function writeManifest(PHPExcel $pPHPExcel = null) { if (!$pPHPExcel) { $pPHPExcel = $this->getParentWriter()->getPHPExcel(); } $objWriter = null; if ($this->getParentWriter()->getUseDiskCaching()) { $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); } else { $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); } // XML header $objWriter->startDocument('1.0', 'UTF-8'); // Manifest $objWriter->startElement('manifest:manifest'); $objWriter->writeAttribute('xmlns:manifest', 'urn:oasis:names:tc:opendocument:xmlns:manifest:1.0'); $objWriter->writeAttribute('manifest:version', '1.2'); $objWriter->startElement('manifest:file-entry'); $objWriter->writeAttribute('manifest:full-path', '/'); $objWriter->writeAttribute('manifest:version', '1.2'); $objWriter->writeAttribute('manifest:media-type', 'application/vnd.oasis.opendocument.spreadsheet'); $objWriter->endElement(); $objWriter->startElement('manifest:file-entry'); $objWriter->writeAttribute('manifest:full-path', 'meta.xml'); $objWriter->writeAttribute('manifest:media-type', 'text/xml'); $objWriter->endElement(); $objWriter->startElement('manifest:file-entry'); $objWriter->writeAttribute('manifest:full-path', 'settings.xml'); $objWriter->writeAttribute('manifest:media-type', 'text/xml'); $objWriter->endElement(); $objWriter->startElement('manifest:file-entry'); $objWriter->writeAttribute('manifest:full-path', 'content.xml'); $objWriter->writeAttribute('manifest:media-type', 'text/xml'); $objWriter->endElement(); $objWriter->startElement('manifest:file-entry'); $objWriter->writeAttribute('manifest:full-path', 'Thumbnails/thumbnail.png'); $objWriter->writeAttribute('manifest:media-type', 'image/png'); $objWriter->endElement(); $objWriter->startElement('manifest:file-entry'); $objWriter->writeAttribute('manifest:full-path', 'styles.xml'); $objWriter->writeAttribute('manifest:media-type', 'text/xml'); $objWriter->endElement(); $objWriter->endElement(); return $objWriter->getData(); } }
{ "pile_set_name": "Github" }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE789_Uncontrolled_Mem_Alloc__new_char_connect_socket_34.cpp Label Definition File: CWE789_Uncontrolled_Mem_Alloc__new.label.xml Template File: sources-sinks-34.tmpl.cpp */ /* * @description * CWE: 789 Uncontrolled Memory Allocation * BadSource: connect_socket Read data using a connect socket (client side) * GoodSource: Small number greater than zero * Sinks: * GoodSink: Allocate memory with new [] and check the size of the memory to be allocated * BadSink : Allocate memory with new [], but incorrectly check the size of the memory to be allocated * Flow Variant: 34 Data flow: use of a union containing two methods of accessing the same data (within the same function) * * */ #include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else /* NOT _WIN32 */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define IP_ADDRESS "127.0.0.1" #define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2) #define HELLO_STRING "hello" namespace CWE789_Uncontrolled_Mem_Alloc__new_char_connect_socket_34 { typedef union { size_t unionFirst; size_t unionSecond; } unionType; #ifndef OMITBAD void bad() { size_t data; unionType myUnion; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a connect socket */ connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } myUnion.unionFirst = data; { size_t data = myUnion.unionSecond; { char * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the strcpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > strlen(HELLO_STRING)) { myString = new char[data]; /* Copy a small string into myString */ strcpy(myString, HELLO_STRING); printLine(myString); delete [] myString; } else { printLine("Input is less than the length of the source string"); } } } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B() uses the GoodSource with the BadSink */ static void goodG2B() { size_t data; unionType myUnion; /* Initialize data */ data = 0; /* FIX: Use a relatively small number for memory allocation */ data = 20; myUnion.unionFirst = data; { size_t data = myUnion.unionSecond; { char * myString; /* POTENTIAL FLAW: No MAXIMUM limitation for memory allocation, but ensure data is large enough * for the strcpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > strlen(HELLO_STRING)) { myString = new char[data]; /* Copy a small string into myString */ strcpy(myString, HELLO_STRING); printLine(myString); delete [] myString; } else { printLine("Input is less than the length of the source string"); } } } } /* goodB2G() uses the BadSource with the GoodSink */ static void goodB2G() { size_t data; unionType myUnion; /* Initialize data */ data = 0; { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; SOCKET connectSocket = INVALID_SOCKET; char inputBuffer[CHAR_ARRAY_SIZE]; do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a connect socket */ connectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (connectSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(IP_ADDRESS); service.sin_port = htons(TCP_PORT); if (connect(connectSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed, make sure to recv one * less char than is in the recv_buf in order to append a terminator */ recvResult = recv(connectSocket, inputBuffer, CHAR_ARRAY_SIZE - 1, 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* NUL-terminate the string */ inputBuffer[recvResult] = '\0'; /* Convert to unsigned int */ data = strtoul(inputBuffer, NULL, 0); } while (0); if (connectSocket != INVALID_SOCKET) { CLOSE_SOCKET(connectSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } myUnion.unionFirst = data; { size_t data = myUnion.unionSecond; { char * myString; /* FIX: Include a MAXIMUM limitation for memory allocation and a check to ensure data is large enough * for the strcpy() function to not cause a buffer overflow */ /* INCIDENTAL FLAW: The source could cause a type overrun in data or in the memory allocation */ if (data > strlen(HELLO_STRING) && data < 100) { myString = new char[data]; /* Copy a small string into myString */ strcpy(myString, HELLO_STRING); printLine(myString); delete [] myString; } else { printLine("Input is less than the length of the source string or too large"); } } } } void good() { goodG2B(); goodB2G(); } #endif /* OMITGOOD */ } /* close namespace */ /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN using namespace CWE789_Uncontrolled_Mem_Alloc__new_char_connect_socket_34; /* so that we can use good and bad easily */ int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
{ "pile_set_name": "Github" }
import json import os import re import sys from datetime import date from subprocess import Popen, PIPE def read_version(manifest_path, ref=None): """ Reads the package version from the manifest file, and optionally validates it against the given tag reference. """ p = Popen( ['cargo', 'read-manifest', '--manifest-path', manifest_path], stdout=PIPE ) d = json.load(p.stdout) version = d['version'] if ref is not None and ref != 'refs/tags/v' + version: print( '::error file={path}::version {0} does not match release tag {1}' .format(version, ref, path=manifest_path) ) sys.exit(1) return version event_name = sys.argv[1] date = date.today().strftime('%Y%m%d') ref = None if event_name == 'push': ref = os.getenv('GITHUB_REF') if ref.startswith('refs/tags/'): release_type = 'tagged' elif ref == 'refs/heads/ci/test/nightly': # emulate the nightly workflow release_type = 'nightly' ref = None else: raise ValueError('unexpected ref ' + ref) elif event_name == 'schedule': release_type = 'nightly' else: raise ValueError('unexpected event name ' + event_name) version = read_version('jormungandr/Cargo.toml', ref) release_flags = '' if release_type == 'tagged': read_version('jcli/Cargo.toml', ref) tag = 'v' + version elif release_type == 'nightly': version = re.sub( r'^(\d+\.\d+\.\d+)(-.*)?$', r'\1-nightly.' + date, version, ) tag = 'nightly.' + date release_flags = '--prerelease' for name in 'version', 'date', 'tag', 'release_type', 'release_flags': print('::set-output name={0}::{1}'.format(name, globals()[name]))
{ "pile_set_name": "Github" }
#!/bin/sh # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # # Copyright (c) 1997-2018 Oracle and/or its affiliates. All rights reserved. # # The contents of this file are subject to the terms of either the GNU # General Public License Version 2 only ("GPL") or the Common Development # and Distribution License("CDDL") (collectively, the "License"). You # may not use this file except in compliance with the License. You can # obtain a copy of the License at # https://oss.oracle.com/licenses/CDDL+GPL-1.1 # or LICENSE.txt. See the License for the specific # language governing permissions and limitations under the License. # # When distributing the software, include this License Header Notice in each # file and include the License file at LICENSE.txt. # # GPL Classpath Exception: # Oracle designates this particular file as subject to the "Classpath" # exception as provided by Oracle in the GPL Version 2 section of the License # file that accompanied this code. # # Modifications: # If applicable, add the following below the License Header, with the fields # enclosed by brackets [] replaced by your own identifying information: # "Portions Copyright [year] [name of copyright owner]" # # Contributor(s): # If you wish your version of this file to be governed by only the CDDL or # only the GPL Version 2, indicate your decision by adding "[Contributor] # elects to include this software in this distribution under the [CDDL or GPL # Version 2] license." If you don't indicate a single choice of license, a # recipient has the option to distribute your version of this file under # either the CDDL, the GPL Version 2 or to extend the choice of license to # its licensees as provided above. However, if you add GPL Version 2 code # and therefore, elected the GPL Version 2 license, then the option applies # only if the new code is made subject to such option by the copyright # holder. # AS_INSTALL=`dirname "$0"`/.. AS_INSTALL_LIB="$AS_INSTALL/modules" exec java -jar "$AS_INSTALL_LIB/admin-cli.jar" stop-domain "$@"
{ "pile_set_name": "Github" }
/*Domain class of table s_live_instances*/ package com.mycollab.common.domain; import com.mycollab.core.arguments.ValuedBean; import com.mycollab.db.metadata.Column; import com.mycollab.db.metadata.Table; import java.time.LocalDate; import java.time.LocalDateTime; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.ibatis.type.Alias; import org.hibernate.validator.constraints.Length; @SuppressWarnings("ucd") @Table("s_live_instances") @Alias("LiveInstance") public class LiveInstance extends ValuedBean { /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column s_live_instances.id * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ @Column("id") private Integer id; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column s_live_instances.appVersion * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ @NotEmpty @Length(max=45, message="Field value is too long") @Column("appVersion") private String appversion; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column s_live_instances.javaVersion * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ @NotEmpty @Length(max=45, message="Field value is too long") @Column("javaVersion") private String javaversion; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column s_live_instances.installedDate * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ @NotNull @Column("installedDate") private LocalDate installeddate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column s_live_instances.sysId * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ @NotEmpty @Length(max=100, message="Field value is too long") @Column("sysId") private String sysid; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column s_live_instances.sysProperties * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ @NotEmpty @Length(max=100, message="Field value is too long") @Column("sysProperties") private String sysproperties; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column s_live_instances.lastUpdatedDate * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ @NotNull @Column("lastUpdatedDate") private LocalDateTime lastupdateddate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column s_live_instances.numProjects * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ @Column("numProjects") private Integer numprojects; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column s_live_instances.numUsers * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ @Column("numUsers") private Integer numusers; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column s_live_instances.edition * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ @Length(max=45, message="Field value is too long") @Column("edition") private String edition; private static final long serialVersionUID = 1; public final boolean equals(Object obj) { if (obj == null) { return false;} if (obj == this) { return true;} if (!obj.getClass().isAssignableFrom(getClass())) { return false;} LiveInstance item = (LiveInstance)obj; return new EqualsBuilder().append(id, item.id).build(); } public final int hashCode() { return new HashCodeBuilder(703, 1861).append(id).build(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column s_live_instances.id * * @return the value of s_live_instances.id * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public Integer getId() { return id; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table s_live_instances * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public LiveInstance withId(Integer id) { this.setId(id); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column s_live_instances.id * * @param id the value for s_live_instances.id * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public void setId(Integer id) { this.id = id; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column s_live_instances.appVersion * * @return the value of s_live_instances.appVersion * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public String getAppversion() { return appversion; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table s_live_instances * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public LiveInstance withAppversion(String appversion) { this.setAppversion(appversion); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column s_live_instances.appVersion * * @param appversion the value for s_live_instances.appVersion * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public void setAppversion(String appversion) { this.appversion = appversion; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column s_live_instances.javaVersion * * @return the value of s_live_instances.javaVersion * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public String getJavaversion() { return javaversion; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table s_live_instances * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public LiveInstance withJavaversion(String javaversion) { this.setJavaversion(javaversion); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column s_live_instances.javaVersion * * @param javaversion the value for s_live_instances.javaVersion * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public void setJavaversion(String javaversion) { this.javaversion = javaversion; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column s_live_instances.installedDate * * @return the value of s_live_instances.installedDate * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public LocalDate getInstalleddate() { return installeddate; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table s_live_instances * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public LiveInstance withInstalleddate(LocalDate installeddate) { this.setInstalleddate(installeddate); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column s_live_instances.installedDate * * @param installeddate the value for s_live_instances.installedDate * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public void setInstalleddate(LocalDate installeddate) { this.installeddate = installeddate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column s_live_instances.sysId * * @return the value of s_live_instances.sysId * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public String getSysid() { return sysid; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table s_live_instances * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public LiveInstance withSysid(String sysid) { this.setSysid(sysid); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column s_live_instances.sysId * * @param sysid the value for s_live_instances.sysId * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public void setSysid(String sysid) { this.sysid = sysid; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column s_live_instances.sysProperties * * @return the value of s_live_instances.sysProperties * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public String getSysproperties() { return sysproperties; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table s_live_instances * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public LiveInstance withSysproperties(String sysproperties) { this.setSysproperties(sysproperties); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column s_live_instances.sysProperties * * @param sysproperties the value for s_live_instances.sysProperties * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public void setSysproperties(String sysproperties) { this.sysproperties = sysproperties; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column s_live_instances.lastUpdatedDate * * @return the value of s_live_instances.lastUpdatedDate * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public LocalDateTime getLastupdateddate() { return lastupdateddate; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table s_live_instances * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public LiveInstance withLastupdateddate(LocalDateTime lastupdateddate) { this.setLastupdateddate(lastupdateddate); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column s_live_instances.lastUpdatedDate * * @param lastupdateddate the value for s_live_instances.lastUpdatedDate * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public void setLastupdateddate(LocalDateTime lastupdateddate) { this.lastupdateddate = lastupdateddate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column s_live_instances.numProjects * * @return the value of s_live_instances.numProjects * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public Integer getNumprojects() { return numprojects; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table s_live_instances * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public LiveInstance withNumprojects(Integer numprojects) { this.setNumprojects(numprojects); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column s_live_instances.numProjects * * @param numprojects the value for s_live_instances.numProjects * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public void setNumprojects(Integer numprojects) { this.numprojects = numprojects; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column s_live_instances.numUsers * * @return the value of s_live_instances.numUsers * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public Integer getNumusers() { return numusers; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table s_live_instances * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public LiveInstance withNumusers(Integer numusers) { this.setNumusers(numusers); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column s_live_instances.numUsers * * @param numusers the value for s_live_instances.numUsers * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public void setNumusers(Integer numusers) { this.numusers = numusers; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column s_live_instances.edition * * @return the value of s_live_instances.edition * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public String getEdition() { return edition; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table s_live_instances * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public LiveInstance withEdition(String edition) { this.setEdition(edition); return this; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column s_live_instances.edition * * @param edition the value for s_live_instances.edition * * @mbg.generated Sat Feb 23 06:34:50 CST 2019 */ public void setEdition(String edition) { this.edition = edition; } public enum Field { id, appversion, javaversion, installeddate, sysid, sysproperties, lastupdateddate, numprojects, numusers, edition; public boolean equalTo(Object value) { return name().equals(value); } } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2008-2020, Hazelcast, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hazelcast.client.splitbrainprotection.multimap; import com.hazelcast.client.splitbrainprotection.PartitionedClusterClients; import com.hazelcast.client.test.TestHazelcastFactory; import com.hazelcast.splitbrainprotection.multimap.TransactionalMultiMapSplitBrainProtectionReadTest; import com.hazelcast.test.HazelcastSerialParametersRunnerFactory; import com.hazelcast.test.annotation.ParallelJVMTest; import com.hazelcast.test.annotation.QuickTest; import com.hazelcast.transaction.TransactionContext; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.UseParametersRunnerFactory; @RunWith(Parameterized.class) @UseParametersRunnerFactory(HazelcastSerialParametersRunnerFactory.class) @Category({QuickTest.class, ParallelJVMTest.class}) public class ClientTransactionalMultiMapSplitBrainProtectionReadTest extends TransactionalMultiMapSplitBrainProtectionReadTest { private static PartitionedClusterClients clients; @BeforeClass public static void setUp() { TestHazelcastFactory factory = new TestHazelcastFactory(); initTestEnvironment(smallInstanceConfig(), factory); clients = new PartitionedClusterClients(cluster, factory); } @AfterClass public static void tearDown() { if (clients != null) { clients.terminateAll(); } shutdownTestEnvironment(); } @Override public TransactionContext newTransactionContext(int index) { return clients.client(index).newTransactionContext(options); } }
{ "pile_set_name": "Github" }
/* Flot plugin for plotting images. Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. The data syntax is [ [ image, x1, y1, x2, y2 ], ... ] where (x1, y1) and (x2, y2) are where you intend the two opposite corners of the image to end up in the plot. Image must be a fully loaded Javascript image (you can make one with new Image()). If the image is not complete, it's skipped when plotting. There are two helpers included for retrieving images. The easiest work the way that you put in URLs instead of images in the data, like this: [ "myimage.png", 0, 0, 10, 10 ] Then call $.plot.image.loadData( data, options, callback ) where data and options are the same as you pass in to $.plot. This loads the images, replaces the URLs in the data with the corresponding images and calls "callback" when all images are loaded (or failed loading). In the callback, you can then call $.plot with the data set. See the included example. A more low-level helper, $.plot.image.load(urls, callback) is also included. Given a list of URLs, it calls callback with an object mapping from URL to Image object when all images are loaded or have failed loading. The plugin supports these options: series: { images: { show: boolean anchor: "corner" or "center" alpha: [ 0, 1 ] } } They can be specified for a specific series: $.plot( $("#placeholder"), [{ data: [ ... ], images: { ... } ]) Note that because the data format is different from usual data points, you can't use images with anything else in a specific data series. Setting "anchor" to "center" causes the pixels in the image to be anchored at the corner pixel centers inside of at the pixel corners, effectively letting half a pixel stick out to each side in the plot. A possible future direction could be support for tiling for large images (like Google Maps). */ (function ($) { var options = { series: { images: { show: false, alpha: 1, anchor: "corner" // or "center" } } }; $.plot.image = {}; $.plot.image.loadDataImages = function (series, options, callback) { var urls = [], points = []; var defaultShow = options.series.images.show; $.each(series, function (i, s) { if (!(defaultShow || s.images.show)) return; if (s.data) s = s.data; $.each(s, function (i, p) { if (typeof p[0] == "string") { urls.push(p[0]); points.push(p); } }); }); $.plot.image.load(urls, function (loadedImages) { $.each(points, function (i, p) { var url = p[0]; if (loadedImages[url]) p[0] = loadedImages[url]; }); callback(); }); } $.plot.image.load = function (urls, callback) { var missing = urls.length, loaded = {}; if (missing == 0) callback({}); $.each(urls, function (i, url) { var handler = function () { --missing; loaded[url] = this; if (missing == 0) callback(loaded); }; $('<img />').load(handler).error(handler).attr('src', url); }); }; function drawSeries(plot, ctx, series) { var plotOffset = plot.getPlotOffset(); if (!series.images || !series.images.show) return; var points = series.datapoints.points, ps = series.datapoints.pointsize; for (var i = 0; i < points.length; i += ps) { var img = points[i], x1 = points[i + 1], y1 = points[i + 2], x2 = points[i + 3], y2 = points[i + 4], xaxis = series.xaxis, yaxis = series.yaxis, tmp; // actually we should check img.complete, but it // appears to be a somewhat unreliable indicator in // IE6 (false even after load event) if (!img || img.width <= 0 || img.height <= 0) continue; if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; } if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; } // if the anchor is at the center of the pixel, expand the // image by 1/2 pixel in each direction if (series.images.anchor == "center") { tmp = 0.5 * (x2-x1) / (img.width - 1); x1 -= tmp; x2 += tmp; tmp = 0.5 * (y2-y1) / (img.height - 1); y1 -= tmp; y2 += tmp; } // clip if (x1 == x2 || y1 == y2 || x1 >= xaxis.max || x2 <= xaxis.min || y1 >= yaxis.max || y2 <= yaxis.min) continue; var sx1 = 0, sy1 = 0, sx2 = img.width, sy2 = img.height; if (x1 < xaxis.min) { sx1 += (sx2 - sx1) * (xaxis.min - x1) / (x2 - x1); x1 = xaxis.min; } if (x2 > xaxis.max) { sx2 += (sx2 - sx1) * (xaxis.max - x2) / (x2 - x1); x2 = xaxis.max; } if (y1 < yaxis.min) { sy2 += (sy1 - sy2) * (yaxis.min - y1) / (y2 - y1); y1 = yaxis.min; } if (y2 > yaxis.max) { sy1 += (sy1 - sy2) * (yaxis.max - y2) / (y2 - y1); y2 = yaxis.max; } x1 = xaxis.p2c(x1); x2 = xaxis.p2c(x2); y1 = yaxis.p2c(y1); y2 = yaxis.p2c(y2); // the transformation may have swapped us if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; } if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; } tmp = ctx.globalAlpha; ctx.globalAlpha *= series.images.alpha; ctx.drawImage(img, sx1, sy1, sx2 - sx1, sy2 - sy1, x1 + plotOffset.left, y1 + plotOffset.top, x2 - x1, y2 - y1); ctx.globalAlpha = tmp; } } function processRawData(plot, series, data, datapoints) { if (!series.images.show) return; // format is Image, x1, y1, x2, y2 (opposite corners) datapoints.format = [ { required: true }, { x: true, number: true, required: true }, { y: true, number: true, required: true }, { x: true, number: true, required: true }, { y: true, number: true, required: true } ]; } function init(plot) { plot.hooks.processRawData.push(processRawData); plot.hooks.drawSeries.push(drawSeries); } $.plot.plugins.push({ init: init, options: options, name: 'image', version: '1.1' }); })(jQuery);
{ "pile_set_name": "Github" }
-- Copyright (C) 2001 Bill Billowitch. -- Some of the work to develop this test suite was done with Air Force -- support. The Air Force and Bill Billowitch assume no -- responsibilities for this software. -- This file is part of VESTs (Vhdl tESTs). -- VESTs 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. -- VESTs 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 VESTs; if not, write to the Free Software Foundation, -- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- --------------------------------------------------------------------- -- -- $Id: tc2860.vhd,v 1.2 2001-10-26 16:29:49 paw Exp $ -- $Revision: 1.2 $ -- -- --------------------------------------------------------------------- ENTITY c13s10b00x00p04n02i02860ent IS END c13s10b00x00p04n02i02860ent; ARCHITECTURE c13s10b00x00p04n02i02860arch OF c13s10b00x00p04n02i02860ent IS constant a : string := %%%%; BEGIN TESTING: PROCESS BEGIN assert NOT( a'length=1 and a="%" ) report "***PASSED TEST: c13s10b00x00p04n02i02860" severity NOTE; assert ( a'length=1 and a="%" ) report "***FAILED TEST: c13s10b00x00p04n02i02860 - Double percent will be treated as single character." severity ERROR; wait; END PROCESS TESTING; END c13s10b00x00p04n02i02860arch;
{ "pile_set_name": "Github" }
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifdef ENABLE_EOB #include "kyra/engine/eob.h" #include "kyra/graphics/screen_eob.h" #include "kyra/graphics/screen_eob_segacd.h" #include "kyra/text/text_eob_segacd.h" namespace Kyra { TextDisplayer_SegaCD::TextDisplayer_SegaCD(EoBEngine *engine, Screen_EoB *scr) : TextDisplayer_rpg(engine, scr), _engine(engine), _screen(scr), _renderer(scr->sega_getRenderer()), _curDim(0), _textColor(0xFF), _curPosY(0), _curPosX(0) { assert(_renderer); _msgRenderBufferSize = 320 * 48; _msgRenderBuffer = new uint8[_msgRenderBufferSize]; memset(_msgRenderBuffer, 0, _msgRenderBufferSize); } TextDisplayer_SegaCD::~TextDisplayer_SegaCD() { delete[] _msgRenderBuffer; } void TextDisplayer_SegaCD::printDialogueText(int id, const char *string1, const char *string2) { if (string1 && string2) { _engine->runDialogue(id, 2, 2, string1, string2); } else { _screen->hideMouse(); _engine->seq_segaPlaySequence(id); _screen->showMouse(); } } void TextDisplayer_SegaCD::printDialogueText(const char *str, bool wait) { int cs = _screen->setFontStyles(Screen::FID_8_FNT, _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleFat | Font::kStyleForceTwoByte); clearDim(_curDim); if (wait) { printShadedText(str, 32, 12); _engine->resetSkipFlag(); _renderer->render(0); _screen->updateScreen(); _engine->delay(500); } else { printShadedText(str, 0, 0); _renderer->render(0); _screen->updateScreen(); } _screen->setFontStyles(Screen::FID_8_FNT, cs); } void TextDisplayer_SegaCD::printShadedText(const char *str, int x, int y, int textColor, int shadowColor, int pitchW, int pitchH, int marginRight, bool screenUpdate) { const ScreenDim *s = &_dimTable[_curDim]; if (x == -1) x = s->sx; if (y == -1) y = s->sy; if (textColor == -1) textColor = s->unk8; if (shadowColor == -1) shadowColor = 0; if (pitchW == -1) pitchW = s->w; if (pitchH == -1) pitchH = s->h; _screen->setTextMarginRight(pitchW - marginRight); _screen->printShadedText(str, x, y, textColor, 0, shadowColor, pitchW >> 3); if (!screenUpdate) return; if (s->unkE) { for (int i = 0; i < (pitchH >> 3); ++i) _screen->sega_loadTextBufferToVRAM(i * (pitchW << 2), ((s->unkC & 0x7FF) + i * s->unkE) << 5, pitchW << 2); } else { _screen->sega_loadTextBufferToVRAM(0, (s->unkC & 0x7FF) << 5, (pitchW * pitchH) >> 1); } } int TextDisplayer_SegaCD::clearDim(int dim) { int res = _curDim; _curDim = dim; _curPosY = _curPosX = 0; const ScreenDim *s = &_dimTable[dim]; _renderer->memsetVRAM((s->unkC & 0x7FF) << 5, s->unkA, (s->w * s->h) >> 1); _screen->sega_clearTextBuffer(s->unkA); memset(_msgRenderBuffer, 0, _msgRenderBufferSize); return res; } void TextDisplayer_SegaCD::displayText(char *str, ...) { _screen->sega_setTextBuffer(_msgRenderBuffer, _msgRenderBufferSize); int cs = _screen->setFontStyles(Screen::FID_8_FNT, _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleFat | Font::kStyleForceTwoByte); char tmp[3] = " "; int posX = _curPosX; bool updated = false; va_list args; va_start(args, str); int tc = va_arg(args, int); va_end(args); if (tc != -1) SWAP(_textColor, tc); for (const char *pos = str; *pos; updated = false) { uint8 cmd = fetchCharacter(tmp, pos); if (_dimTable[_curDim].h < _curPosY + _screen->getFontHeight()) { _curPosY -= _screen->getFontHeight(); linefeed(); } if (cmd == 6) { _textColor = (uint8)*pos++; } else if (cmd == 2) { pos++; } else if (cmd == 13) { _curPosX = 0; _curPosY += _screen->getFontHeight(); } else if (cmd == 9) { _curPosX = posX; _curPosY += _screen->getFontHeight(); } else { if (((tmp[0] == ' ' || (tmp[0] == '\x81' && tmp[1] == '\x40')) && (_curPosX + _screen->getTextWidth(tmp) + _screen->getTextWidth((const char*)(pos), true) >= _dimTable[_curDim].w)) || (_curPosX + _screen->getTextWidth(tmp) >= _dimTable[_curDim].w)) { // Skip space at the beginning of the new line if (tmp[0] == ' ' || (tmp[0] == '\x81' && tmp[1] == '\x40')) fetchCharacter(tmp, pos); _curPosX = 0; _curPosY += _screen->getFontHeight(); if (_dimTable[_curDim].h < _curPosY + _screen->getFontHeight()) { _curPosY -= _screen->getFontHeight(); linefeed(); } } printShadedText(tmp, _curPosX, _curPosY, _textColor); _curPosX += _screen->getTextWidth(tmp); updated = true; } } if (!updated) printShadedText("", _curPosX, _curPosY, _textColor); if (tc != -1) SWAP(_textColor, tc); _renderer->render(Screen_EoB::kSegaRenderPage); _screen->setFontStyles(Screen::FID_8_FNT, cs); _screen->copyRegion(8, 176, 8, 176, 280, 24, Screen_EoB::kSegaRenderPage, 0, Screen::CR_NO_P_CHECK); _screen->sega_setTextBuffer(0, 0); } uint8 TextDisplayer_SegaCD::fetchCharacter(char *dest, const char *&src) { uint8 c = (uint8)*src++; if (c <= (uint8)'\r') { dest[0] = '\0'; return c; } dest[0] = (char)c; dest[1] = (c <= 0x7F || (c >= 0xA1 && c <= 0xDF)) ? '\0' : *src++; return 0; } void TextDisplayer_SegaCD::linefeed() { copyTextBufferLine(_screen->getFontHeight(), 0, (_dimTable[_curDim].h & ~7) - _screen->getFontHeight(), _dimTable[_curDim].w >> 3); clearTextBufferLine(_screen->getFontHeight(), _screen->getFontHeight(), _dimTable[_curDim].w >> 3, _dimTable[_curDim].unkA); } void TextDisplayer_SegaCD::clearTextBufferLine(uint16 y, uint16 lineHeight, uint16 pitch, uint8 col) { uint32 *dst = (uint32*)(_msgRenderBuffer + (((y >> 3) * pitch) << 5) + ((y & 7) << 2)); int ln = y; uint32 c = col | (col << 8) | (col << 16) | (col << 24); while (lineHeight--) { uint32 *dst2 = dst; for (uint16 w = pitch; w; --w) { *dst = c; dst += 8; } dst = dst2 + 1; if (((++ln) & 7) == 0) dst += ((pitch - 1) << 3); } } void TextDisplayer_SegaCD::copyTextBufferLine(uint16 srcY, uint16 dstY, uint16 lineHeight, uint16 pitch) { uint32 *src = (uint32*)(_msgRenderBuffer + (((srcY >> 3) * pitch) << 5) + ((srcY & 7) << 2)); uint32 *dst = (uint32*)(_msgRenderBuffer + (((dstY >> 3) * pitch) << 5) + ((dstY & 7) << 2)); int src_ln = srcY; int dst_ln = dstY; while (lineHeight--) { uint32 *src2 = src; uint32 *dst2 = dst; for (uint16 w = pitch; w; --w) { *dst = *src; src += 8; dst += 8; } src = src2 + 1; dst = dst2 + 1; if (((++dst_ln) & 7) == 0) dst += ((pitch - 1) << 3); if (((++src_ln) & 7) == 0) src += ((pitch - 1) << 3); } } const ScreenDim TextDisplayer_SegaCD::_dimTable[6] = { { 0x0001, 0x0017, 0x0118, 0x0018, 0xff, 0x44, 0x2597, 0x0000 }, { 0x0012, 0x0009, 0x00a0, 0x0080, 0xff, 0x99, 0x0153, 0x0028 }, { 0x0001, 0x0014, 0x0130, 0x0030, 0xff, 0xee, 0xe51c, 0x0000 }, { 0x0001, 0x0017, 0x00D0, 0x0030, 0xff, 0x00, 0x0461, 0x0000 }, { 0x0000, 0x0000, 0x00F0, 0x0100, 0xff, 0x00, 0x600A, 0x0000 }, { 0x0000, 0x0000, 0x0140, 0x00B0, 0xff, 0x11, 0x4001, 0x0000 } }; } // End of namespace Kyra #endif // ENABLE_EOB
{ "pile_set_name": "Github" }
# Time: O(nlogn) # Space: O(n) import bisect class Solution(object): def findRightInterval(self, intervals): """ :type intervals: List[Interval] :rtype: List[int] """ sorted_intervals = sorted((interval.start, i) for i, interval in enumerate(intervals)) result = [] for interval in intervals: idx = bisect.bisect_left(sorted_intervals, (interval.end,)) result.append(sorted_intervals[idx][1] if idx < len(sorted_intervals) else -1) return result
{ "pile_set_name": "Github" }
owner = USA controller = USA add_core = USA infra = 8 infra = 8 infra = 8 infra = 8
{ "pile_set_name": "Github" }
/* * Simple Test program for libtcc * * libtcc can be useful to use tcc as a "backend" for a code generator. */ #include <stdlib.h> #include <stdio.h> #include "libtcc.h" /* this function is called by the generated code */ int add(int a, int b) { return a + b; } char my_program[] = "int fib(int n)\n" "{\n" " if (n <= 2)\n" " return 1;\n" " else\n" " return fib(n-1) + fib(n-2);\n" "}\n" "\n" "int foo(int n)\n" "{\n" " printf(\"Hello World!\\n\");\n" " printf(\"fib(%d) = %d\\n\", n, fib(n));\n" " printf(\"add(%d, %d) = %d\\n\", n, 2 * n, add(n, 2 * n));\n" " return 0;\n" "}\n"; int main(int argc, char **argv) { TCCState *s; int (*func)(int); unsigned long val; s = tcc_new(); if (!s) { fprintf(stderr, "Could not create tcc state\n"); exit(1); } /* MUST BE CALLED before any compilation or file loading */ tcc_set_output_type(s, TCC_OUTPUT_MEMORY); tcc_compile_string(s, my_program); /* as a test, we add a symbol that the compiled program can be linked with. You can have a similar result by opening a dll with tcc_add_dll(() and using its symbols directly. */ tcc_add_symbol(s, "add", (unsigned long)&add); tcc_relocate(s); tcc_get_symbol(s, &val, "foo"); func = (void *)val; func(32); tcc_delete(s); return 0; }
{ "pile_set_name": "Github" }
.. ************************************************** * * * Automatically generated file, do not edit! * * * ************************************************** .. _amdgpu_synid9_base_smem_addr: sbase =========================== A 64-bit base address for scalar memory operations. *Size:* 2 dwords. *Operands:* :ref:`s<amdgpu_synid_s>`, :ref:`flat_scratch<amdgpu_synid_flat_scratch>`, :ref:`xnack<amdgpu_synid_xnack>`, :ref:`vcc<amdgpu_synid_vcc>`, :ref:`ttmp<amdgpu_synid_ttmp>`
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using System.Linq; using Foundation; using UIKit; namespace AppLifecycleTutorial.iOS { public class Application { // This is the main entry point of the application. static void Main(string[] args) { // if you want to use a different Application Delegate class from "AppDelegate" // you can specify it here. UIApplication.Main(args, null, "AppDelegate"); } } }
{ "pile_set_name": "Github" }