text:
namespace v8 {
namespace internal {
struct AssemblerOptions;

namespace compiler {
// Forward declarations for some compiler data structures.
class CallDescriptor;
class Graph;
class MachineGraph;
class Node;
class NodeOriginTable;
class Operator;
class SourcePositionTable;
class WasmDecorator;
enum class TrapId : uint32_t;
}  // namespace compiler

namespace wasm {
struct DecodeStruct;
// Expose {Node} and {Graph} opaquely as {wasm::TFNode} and {wasm::TFGraph}.
typedef compiler::Node TFNode;
typedef compiler::MachineGraph TFGraph;
class WasmCode;
struct WasmFeatures;
}  // namespace wasm

namespace compiler {

class TurbofanWasmCompilationUnit {
 public:
  explicit TurbofanWasmCompilationUnit(wasm::WasmCompilationUnit* wasm_unit);
  ~TurbofanWasmCompilationUnit();

  bool BuildGraphForWasmFunction(wasm::CompilationEnv* env,
                                 const wasm::FunctionBody& func_body,
                                 wasm::WasmFeatures* detected,
                                 double* decode_ms, MachineGraph* mcgraph,
                                 NodeOriginTable* node_origins,
                                 SourcePositionTable* source_positions);

  wasm::WasmCompilationResult ExecuteCompilation(wasm::CompilationEnv*,
                                                 const wasm::FunctionBody&,
                                                 Counters*,
                                                 wasm::WasmFeatures* detected);

 private:
  wasm::WasmCompilationUnit* const wasm_unit_;

  DISALLOW_COPY_AND_ASSIGN(TurbofanWasmCompilationUnit);
};

class InterpreterCompilationUnit final {
 public:
  explicit InterpreterCompilationUnit(wasm::WasmCompilationUnit* wasm_unit)
      : wasm_unit_(wasm_unit) {}

  wasm::WasmCompilationResult ExecuteCompilation(wasm::CompilationEnv*,
                                                 const wasm::FunctionBody&,
                                                 Counters*,
                                                 wasm::WasmFeatures* detected);

 private:
  wasm::WasmCompilationUnit* const wasm_unit_;

  DISALLOW_COPY_AND_ASSIGN(InterpreterCompilationUnit);
};

// Calls to WASM imports are handled in several different ways, depending on the
// type of the target function/callable and whether the signature matches the
// argument arity.
enum class WasmImportCallKind : uint8_t {
  kLinkError,                      // static WASM->WASM type error
  kRuntimeTypeError,               // runtime WASM->JS type error
  kWasmToWasm,                     // fast WASM->WASM call
  kJSFunctionArityMatch,           // fast WASM->JS call
  kJSFunctionArityMatchSloppy,     // fast WASM->JS call, sloppy receiver
  kJSFunctionArityMismatch,        // WASM->JS, needs adapter frame
  kJSFunctionArityMismatchSloppy,  // WASM->JS, needs adapter frame, sloppy
  // Math functions imported from JavaScript that are intrinsified
  kFirstMathIntrinsic,
  kF64Acos = kFirstMathIntrinsic,
  kF64Asin,
  kF64Atan,
  kF64Cos,
  kF64Sin,
  kF64Tan,
  kF64Exp,
  kF64Log,
  kF64Atan2,
  kF64Pow,
  kF64Ceil,
  kF64Floor,
  kF64Sqrt,
  kF64Min,
  kF64Max,
  kF64Abs,
  kF32Min,
  kF32Max,
  kF32Abs,
  kF32Ceil,
  kF32Floor,
  kF32Sqrt,
  kF32ConvertF64,
  kLastMathIntrinsic = kF32ConvertF64,
  // For everything else, there's the call builtin.
  kUseCallBuiltin
};

WasmImportCallKind GetWasmImportCallKind(Handle<JSReceiver> callable,
                                         wasm::FunctionSig* sig,
                                         bool has_bigint_feature);

// Compiles an import call wrapper, which allows WASM to call imports.
wasm::WasmCode* CompileWasmImportCallWrapper(wasm::WasmEngine*,
                                             wasm::NativeModule*,
                                             WasmImportCallKind,
                                             wasm::FunctionSig*,
                                             bool source_positions);

// Creates a code object calling a wasm function with the given signature,
// callable from JS.
V8_EXPORT_PRIVATE MaybeHandle<Code> CompileJSToWasmWrapper(Isolate*,
                                                           wasm::FunctionSig*,
                                                           bool is_import);

// Compiles a stub that redirects a call to a wasm function to the wasm
// interpreter. It's ABI compatible with the compiled wasm function.
wasm::WasmCompilationResult CompileWasmInterpreterEntry(
    wasm::WasmEngine*, const wasm::WasmFeatures& enabled_features,
    uint32_t func_index, wasm::FunctionSig*);

enum CWasmEntryParameters {
  kCodeEntry,
  kObjectRef,
  kArgumentsBuffer,
  // marker:
  kNumParameters
};

// Compiles a stub with JS linkage, taking parameters as described by
// {CWasmEntryParameters}. It loads the wasm parameters from the argument
// buffer and calls the wasm function given as first parameter.
MaybeHandle<Code> CompileCWasmEntry(Isolate* isolate, wasm::FunctionSig* sig);

// Values from the instance object are cached between WASM-level function calls.
// This struct allows the SSA environment handling this cache to be defined
// and manipulated in wasm-compiler.{h,cc} instead of inside the WASM decoder.
// (Note that currently, the globals base is immutable, so not cached here.)
struct WasmInstanceCacheNodes {
  Node* mem_start;
  Node* mem_size;
  Node* mem_mask;
};

// Abstracts details of building TurboFan graph nodes for wasm to separate
// the wasm decoder from the internal details of TurboFan.
class WasmGraphBuilder {
 public:
  enum EnforceBoundsCheck : bool {  // --
    kNeedsBoundsCheck = true,
    kCanOmitBoundsCheck = false
  };
  enum UseRetpoline : bool {  // --
    kRetpoline = true,
    kNoRetpoline = false
  };
  enum ExtraCallableParam : bool {  // --
    kExtraCallableParam = true,
    kNoExtraCallableParam = false
  };

  WasmGraphBuilder(wasm::CompilationEnv* env, Zone* zone, MachineGraph* mcgraph,
                   wasm::FunctionSig* sig,
                   compiler::SourcePositionTable* spt = nullptr);

  Node** Buffer(size_t count) {
    if (count > cur_bufsize_) {
      size_t new_size = count + cur_bufsize_ + 5;
      cur_buffer_ =
          reinterpret_cast<Node**>(zone_->New(new_size * sizeof(Node*)));
      cur_bufsize_ = new_size;
    }
    return cur_buffer_;
  }

  //-----------------------------------------------------------------------
  // Operations independent of {control} or {effect}.
  //-----------------------------------------------------------------------
  Node* Error();
  Node* Start(unsigned params);
  Node* Param(unsigned index);
  Node* Loop(Node* entry);
  Node* TerminateLoop(Node* effect, Node* control);
  Node* TerminateThrow(Node* effect, Node* control);
  Node* Merge(unsigned count, Node** controls);
  Node* Phi(wasm::ValueType type, unsigned count, Node** vals, Node* control);
  Node* CreateOrMergeIntoPhi(MachineRepresentation rep, Node* merge,
                             Node* tnode, Node* fnode);
  Node* CreateOrMergeIntoEffectPhi(Node* merge, Node* tnode, Node* fnode);
  Node* EffectPhi(unsigned count, Node** effects, Node* control);
  Node* RefNull();
  Node* Uint32Constant(uint32_t value);
  Node* Int32Constant(int32_t value);
  Node* Int64Constant(int64_t value);
  Node* IntPtrConstant(intptr_t value);
  Node* Float32Constant(float value);
  Node* Float64Constant(double value);
  Node* Binop(wasm::WasmOpcode opcode, Node* left, Node* right,
              wasm::WasmCodePosition position = wasm::kNoCodePosition);
  Node* Unop(wasm::WasmOpcode opcode, Node* input,
             wasm::WasmCodePosition position = wasm::kNoCodePosition);
  Node* MemoryGrow(Node* input);
  Node* Throw(uint32_t exception_index, const wasm::WasmException* exception,
              const Vector<Node*> values);
  Node* Rethrow(Node* except_obj);
  Node* ExceptionTagEqual(Node* caught_tag, Node* expected_tag);
  Node* LoadExceptionTagFromTable(uint32_t exception_index);
  Node* GetExceptionTag(Node* except_obj);
  Node** GetExceptionValues(Node* except_obj,
                            const wasm::WasmException* exception);
  bool IsPhiWithMerge(Node* phi, Node* merge);
  bool ThrowsException(Node* node, Node** if_success, Node** if_exception);
  void AppendToMerge(Node* merge, Node* from);
  void AppendToPhi(Node* phi, Node* from);

  void StackCheck(wasm::WasmCodePosition position, Node** effect = nullptr,
                  Node** control = nullptr);

  void PatchInStackCheckIfNeeded();

  //-----------------------------------------------------------------------
  // Operations that read and/or write {control} and {effect}.
  //-----------------------------------------------------------------------
  Node* BranchNoHint(Node* cond, Node** true_node, Node** false_node);
  Node* BranchExpectTrue(Node* cond, Node** true_node, Node** false_node);
  Node* BranchExpectFalse(Node* cond, Node** true_node, Node** false_node);

  Node* TrapIfTrue(wasm::TrapReason reason, Node* cond,
                   wasm::WasmCodePosition position);
  Node* TrapIfFalse(wasm::TrapReason reason, Node* cond,
                    wasm::WasmCodePosition position);
  Node* TrapIfEq32(wasm::TrapReason reason, Node* node, int32_t val,
                   wasm::WasmCodePosition position);
  Node* ZeroCheck32(wasm::TrapReason reason, Node* node,
                    wasm::WasmCodePosition position);
  Node* TrapIfEq64(wasm::TrapReason reason, Node* node, int64_t val,
                   wasm::WasmCodePosition position);
  Node* ZeroCheck64(wasm::TrapReason reason, Node* node,
                    wasm::WasmCodePosition position);

  Node* Switch(unsigned count, Node* key);
  Node* IfValue(int32_t value, Node* sw);
  Node* IfDefault(Node* sw);
  Node* Return(unsigned count, Node** nodes);
  template <typename... Nodes>
  Node* Return(Node* fst, Nodes*... more) {
    Node* arr[] = {fst, more...};
    return Return(arraysize(arr), arr);
  }
  Node* ReturnVoid();
  Node* Unreachable(wasm::WasmCodePosition position);

  Node* CallDirect(uint32_t index, Node** args, Node*** rets,
                   wasm::WasmCodePosition position);
  Node* CallIndirect(uint32_t table_index, uint32_t sig_index, Node** args,
                     Node*** rets, wasm::WasmCodePosition position);

  Node* ReturnCall(uint32_t index, Node** args,
                   wasm::WasmCodePosition position);
  Node* ReturnCallIndirect(uint32_t table_index, uint32_t sig_index,
                           Node** args, wasm::WasmCodePosition position);

  Node* Invert(Node* node);

  Node* GetGlobal(uint32_t index);
  Node* SetGlobal(uint32_t index, Node* val);
  Node* GetTable(uint32_t table_index, Node* index,
                 wasm::WasmCodePosition position);
  Node* SetTable(uint32_t table_index, Node* index, Node* val,
                 wasm::WasmCodePosition position);
  //-----------------------------------------------------------------------
  // Operations that concern the linear memory.
  //-----------------------------------------------------------------------
  Node* CurrentMemoryPages();
  Node* TraceMemoryOperation(bool is_store, MachineRepresentation, Node* index,
                             uint32_t offset, wasm::WasmCodePosition);
  Node* LoadMem(wasm::ValueType type, MachineType memtype, Node* index,
                uint32_t offset, uint32_t alignment,
                wasm::WasmCodePosition position);
  Node* StoreMem(MachineRepresentation mem_rep, Node* index, uint32_t offset,
                 uint32_t alignment, Node* val, wasm::WasmCodePosition position,
                 wasm::ValueType type);
  static void PrintDebugName(Node* node);

  void set_instance_node(Node* instance_node) {
    this->instance_node_ = instance_node;
  }

  Node* Control() {
    DCHECK_NOT_NULL(*control_);
    return *control_;
  }
  Node* Effect() {
    DCHECK_NOT_NULL(*effect_);
    return *effect_;
  }
  Node* SetControl(Node* node) {
    *control_ = node;
    return node;
  }
  Node* SetEffect(Node* node) {
    *effect_ = node;
    return node;
  }

  void set_control_ptr(Node** control) { this->control_ = control; }

  void set_effect_ptr(Node** effect) { this->effect_ = effect; }

  Node* GetImportedMutableGlobals();

  void GetGlobalBaseAndOffset(MachineType mem_type, const wasm::WasmGlobal&,
                              Node** base_node, Node** offset_node);

  void GetBaseAndOffsetForImportedMutableAnyRefGlobal(
      const wasm::WasmGlobal& global, Node** base, Node** offset);

  void BoundsCheckTable(uint32_t table_index, Node* index,
                        wasm::WasmCodePosition position,
                        wasm::TrapReason trap_reason, Node** base_node);

  void GetTableBaseAndOffset(uint32_t table_index, Node* index,
                             wasm::WasmCodePosition position, Node** base_node,
                             Node** offset_node);

  // Utilities to manipulate sets of instance cache nodes.
  void InitInstanceCache(WasmInstanceCacheNodes* instance_cache);
  void PrepareInstanceCacheForLoop(WasmInstanceCacheNodes* instance_cache,
                                   Node* control);
  void NewInstanceCacheMerge(WasmInstanceCacheNodes* to,
                             WasmInstanceCacheNodes* from, Node* merge);
  void MergeInstanceCacheInto(WasmInstanceCacheNodes* to,
                              WasmInstanceCacheNodes* from, Node* merge);

  void set_instance_cache(WasmInstanceCacheNodes* instance_cache) {
    this->instance_cache_ = instance_cache;
  }

  wasm::FunctionSig* GetFunctionSignature() { return sig_; }

  void LowerInt64();

  void SimdScalarLoweringForTesting();

  void SetSourcePosition(Node* node, wasm::WasmCodePosition position);

  Node* S128Zero();
  Node* S1x4Zero();
  Node* S1x8Zero();
  Node* S1x16Zero();

  Node* SimdOp(wasm::WasmOpcode opcode, Node* const* inputs);

  Node* SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane, Node* const* inputs);

  Node* SimdShiftOp(wasm::WasmOpcode opcode, uint8_t shift,
                    Node* const* inputs);

  Node* Simd8x16ShuffleOp(const uint8_t shuffle[16], Node* const* inputs);

  Node* AtomicOp(wasm::WasmOpcode opcode, Node* const* inputs,
                 uint32_t alignment, uint32_t offset,
                 wasm::WasmCodePosition position);

  // Returns a pointer to the dropped_data_segments array. Traps if the data
  // segment is active or has been dropped.
  Node* CheckDataSegmentIsPassiveAndNotDropped(uint32_t data_segment_index,
                                               wasm::WasmCodePosition position);
  Node* CheckElemSegmentIsPassiveAndNotDropped(uint32_t elem_segment_index,
                                               wasm::WasmCodePosition position);
  Node* MemoryInit(uint32_t data_segment_index, Node* dst, Node* src,
                   Node* size, wasm::WasmCodePosition position);
  Node* MemoryCopy(Node* dst, Node* src, Node* size,
                   wasm::WasmCodePosition position);
  Node* DataDrop(uint32_t data_segment_index, wasm::WasmCodePosition position);
  Node* MemoryFill(Node* dst, Node* fill, Node* size,
                   wasm::WasmCodePosition position);

  Node* TableInit(uint32_t table_index, uint32_t elem_segment_index, Node* dst,
                  Node* src, Node* size, wasm::WasmCodePosition position);
  Node* ElemDrop(uint32_t elem_segment_index, wasm::WasmCodePosition position);
  Node* TableCopy(uint32_t table_src_index, uint32_t table_dst_index, Node* dst,
                  Node* src, Node* size, wasm::WasmCodePosition position);

  bool has_simd() const { return has_simd_; }

  const wasm::WasmModule* module() { return env_ ? env_->module : nullptr; }

  wasm::UseTrapHandler use_trap_handler() const {
    return env_ ? env_->use_trap_handler : wasm::kNoTrapHandler;
  }

  MachineGraph* mcgraph() { return mcgraph_; }
  Graph* graph();

  void AddBytecodePositionDecorator(NodeOriginTable* node_origins,
                                    wasm::Decoder* decoder);

  void RemoveBytecodePositionDecorator();

 protected:
  static const int kDefaultBufferSize = 16;

  Zone* const zone_;
  MachineGraph* const mcgraph_;
  wasm::CompilationEnv* const env_;

  Node** control_ = nullptr;
  Node** effect_ = nullptr;
  WasmInstanceCacheNodes* instance_cache_ = nullptr;

  SetOncePointer<Node> instance_node_;
  SetOncePointer<Node> globals_start_;
  SetOncePointer<Node> imported_mutable_globals_;
  SetOncePointer<Node> stack_check_code_node_;
  SetOncePointer<const Operator> stack_check_call_operator_;

  Node** cur_buffer_;
  size_t cur_bufsize_;
  Node* def_buffer_[kDefaultBufferSize];
  bool has_simd_ = false;
  bool needs_stack_check_ = false;
  const bool untrusted_code_mitigations_ = true;

  wasm::FunctionSig* const sig_;

  compiler::WasmDecorator* decorator_ = nullptr;

  compiler::SourcePositionTable* const source_position_table_ = nullptr;

  Node* NoContextConstant();

  Node* MemBuffer(uint32_t offset);
  // BoundsCheckMem receives a uint32 {index} node and returns a ptrsize index.
  Node* BoundsCheckMem(uint8_t access_size, Node* index, uint32_t offset,
                       wasm::WasmCodePosition, EnforceBoundsCheck);
  // Check that the range [start, start + size) is in the range [0, max).
  // Also updates *size with the valid range. Returns true if the range is
  // partially out-of-bounds, traps if it is completely out-of-bounds.
  Node* BoundsCheckRange(Node* start, Node** size, Node* max,
                         wasm::WasmCodePosition);
  // BoundsCheckMemRange receives a uint32 {start} and {size}, and checks if it
  // is in bounds. Also updates *size with the valid range, and converts *start
  // to a pointer into memory at that index. Returns true if the range is
  // partially out-of-bounds, traps if it is completely out-of-bounds.
  Node* BoundsCheckMemRange(Node** start, Node** size, wasm::WasmCodePosition);

  Node* CheckBoundsAndAlignment(uint8_t access_size, Node* index,
                                uint32_t offset, wasm::WasmCodePosition);

  Node* Uint32ToUintptr(Node*);
  const Operator* GetSafeLoadOperator(int offset, wasm::ValueType type);
  const Operator* GetSafeStoreOperator(int offset, wasm::ValueType type);
  Node* BuildChangeEndiannessStore(Node* node, MachineRepresentation rep,
                                   wasm::ValueType wasmtype = wasm::kWasmStmt);
  Node* BuildChangeEndiannessLoad(Node* node, MachineType type,
                                  wasm::ValueType wasmtype = wasm::kWasmStmt);

  Node* MaskShiftCount32(Node* node);
  Node* MaskShiftCount64(Node* node);

  enum IsReturnCall : bool { kReturnCall = true, kCallContinues = false };

  template <typename... Args>
  Node* BuildCCall(MachineSignature* sig, Node* function, Args... args);
  Node* BuildCallNode(wasm::FunctionSig* sig, Node** args,
                      wasm::WasmCodePosition position, Node* instance_node,
                      const Operator* op);
  // Special implementation for CallIndirect for table 0.
  Node* BuildIndirectCall(uint32_t sig_index, Node** args, Node*** rets,
                          wasm::WasmCodePosition position,
                          IsReturnCall continuation);
  Node* BuildIndirectCall(uint32_t table_index, uint32_t sig_index, Node** args,
                          Node*** rets, wasm::WasmCodePosition position,
                          IsReturnCall continuation);
  Node* BuildWasmCall(wasm::FunctionSig* sig, Node** args, Node*** rets,
                      wasm::WasmCodePosition position, Node* instance_node,
                      UseRetpoline use_retpoline);
  Node* BuildWasmReturnCall(wasm::FunctionSig* sig, Node** args,
                            wasm::WasmCodePosition position,
                            Node* instance_node, UseRetpoline use_retpoline);
  Node* BuildImportCall(wasm::FunctionSig* sig, Node** args, Node*** rets,
                        wasm::WasmCodePosition position, int func_index,
                        IsReturnCall continuation);
  Node* BuildImportCall(wasm::FunctionSig* sig, Node** args, Node*** rets,
                        wasm::WasmCodePosition position, Node* func_index,
                        IsReturnCall continuation);

  Node* BuildF32CopySign(Node* left, Node* right);
  Node* BuildF64CopySign(Node* left, Node* right);

  Node* BuildIntConvertFloat(Node* input, wasm::WasmCodePosition position,
                             wasm::WasmOpcode);
  Node* BuildI32Ctz(Node* input);
  Node* BuildI32Popcnt(Node* input);
  Node* BuildI64Ctz(Node* input);
  Node* BuildI64Popcnt(Node* input);
  Node* BuildBitCountingCall(Node* input, ExternalReference ref,
                             MachineRepresentation input_type);

  Node* BuildCFuncInstruction(ExternalReference ref, MachineType type,
                              Node* input0, Node* input1 = nullptr);
  Node* BuildF32Trunc(Node* input);
  Node* BuildF32Floor(Node* input);
  Node* BuildF32Ceil(Node* input);
  Node* BuildF32NearestInt(Node* input);
  Node* BuildF64Trunc(Node* input);
  Node* BuildF64Floor(Node* input);
  Node* BuildF64Ceil(Node* input);
  Node* BuildF64NearestInt(Node* input);
  Node* BuildI32Rol(Node* left, Node* right);
  Node* BuildI64Rol(Node* left, Node* right);

  Node* BuildF64Acos(Node* input);
  Node* BuildF64Asin(Node* input);
  Node* BuildF64Pow(Node* left, Node* right);
  Node* BuildF64Mod(Node* left, Node* right);

  Node* BuildIntToFloatConversionInstruction(
      Node* input, ExternalReference ref,
      MachineRepresentation parameter_representation,
      const MachineType result_type);
  Node* BuildF32SConvertI64(Node* input);
  Node* BuildF32UConvertI64(Node* input);
  Node* BuildF64SConvertI64(Node* input);
  Node* BuildF64UConvertI64(Node* input);

  Node* BuildCcallConvertFloat(Node* input, wasm::WasmCodePosition position,
                               wasm::WasmOpcode opcode);

  Node* BuildI32DivS(Node* left, Node* right, wasm::WasmCodePosition position);
  Node* BuildI32RemS(Node* left, Node* right, wasm::WasmCodePosition position);
  Node* BuildI32DivU(Node* left, Node* right, wasm::WasmCodePosition position);
  Node* BuildI32RemU(Node* left, Node* right, wasm::WasmCodePosition position);

  Node* BuildI64DivS(Node* left, Node* right, wasm::WasmCodePosition position);
  Node* BuildI64RemS(Node* left, Node* right, wasm::WasmCodePosition position);
  Node* BuildI64DivU(Node* left, Node* right, wasm::WasmCodePosition position);
  Node* BuildI64RemU(Node* left, Node* right, wasm::WasmCodePosition position);
  Node* BuildDiv64Call(Node* left, Node* right, ExternalReference ref,
                       MachineType result_type, wasm::TrapReason trap_zero,
                       wasm::WasmCodePosition position);

  Node* BuildChangeInt32ToIntPtr(Node* value);
  Node* BuildChangeInt32ToSmi(Node* value);
  Node* BuildChangeUint31ToSmi(Node* value);
  Node* BuildSmiShiftBitsConstant();
  Node* BuildChangeSmiToInt32(Node* value);
  // generates {index > max ? Smi(max) : Smi(index)}
  Node* BuildConvertUint32ToSmiWithSaturation(Node* index, uint32_t maxval);

  // Asm.js specific functionality.
  Node* BuildI32AsmjsSConvertF32(Node* input);
  Node* BuildI32AsmjsSConvertF64(Node* input);
  Node* BuildI32AsmjsUConvertF32(Node* input);
  Node* BuildI32AsmjsUConvertF64(Node* input);
  Node* BuildI32AsmjsDivS(Node* left, Node* right);
  Node* BuildI32AsmjsRemS(Node* left, Node* right);
  Node* BuildI32AsmjsDivU(Node* left, Node* right);
  Node* BuildI32AsmjsRemU(Node* left, Node* right);
  Node* BuildAsmjsLoadMem(MachineType type, Node* index);
  Node* BuildAsmjsStoreMem(MachineType type, Node* index, Node* val);

  void BuildEncodeException32BitValue(Node* values_array, uint32_t* index,
                                      Node* value);
  Node* BuildDecodeException32BitValue(Node* values_array, uint32_t* index);
  Node* BuildDecodeException64BitValue(Node* values_array, uint32_t* index);

  Node** Realloc(Node* const* buffer, size_t old_count, size_t new_count) {
    Node** buf = Buffer(new_count);
    if (buf != buffer) memcpy(buf, buffer, old_count * sizeof(Node*));
    return buf;
  }

  Node* BuildLoadBuiltinFromInstance(int builtin_index);

  //-----------------------------------------------------------------------
  // Operations involving the CEntry, a dependency we want to remove
  // to get off the GC heap.
  //-----------------------------------------------------------------------
  Node* BuildCallToRuntime(Runtime::FunctionId f, Node** parameters,
                           int parameter_count);

  Node* BuildCallToRuntimeWithContext(Runtime::FunctionId f, Node* js_context,
                                      Node** parameters, int parameter_count,
                                      Node** effect, Node* control);
  TrapId GetTrapIdForTrap(wasm::TrapReason reason);
};

V8_EXPORT_PRIVATE CallDescriptor* GetWasmCallDescriptor(
    Zone* zone, wasm::FunctionSig* signature,
    WasmGraphBuilder::UseRetpoline use_retpoline =
        WasmGraphBuilder::kNoRetpoline,
    WasmGraphBuilder::ExtraCallableParam callable_param =
        WasmGraphBuilder::kNoExtraCallableParam);

V8_EXPORT_PRIVATE CallDescriptor* GetI32WasmCallDescriptor(
    Zone* zone, CallDescriptor* call_descriptor);

V8_EXPORT_PRIVATE CallDescriptor* GetI32WasmCallDescriptorForSimd(
    Zone* zone, CallDescriptor* call_descriptor);

AssemblerOptions WasmAssemblerOptions();
AssemblerOptions WasmStubAssemblerOptions();

}  // namespace compiler
}  // namespace internal
}  // namespace v8

#endif  // V8_COMPILER_WASM_COMPILER_H_


text:
package org.projectfloodlight.openflow.protocol.ver11;

import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Set;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.common.hash.PrimitiveSink;
import com.google.common.hash.Funnel;

class OFQueueGetConfigRequestVer11 implements OFQueueGetConfigRequest {
    private static final Logger logger = LoggerFactory.getLogger(OFQueueGetConfigRequestVer11.class);
    // version: 1.1
    final static byte WIRE_VERSION = 2;
    final static int LENGTH = 16;

        private final static long DEFAULT_XID = 0x0L;
        private final static OFPort DEFAULT_PORT = OFPort.ANY;

    // OF message fields
    private final long xid;
    private final OFPort port;
//
    // Immutable default instance
    final static OFQueueGetConfigRequestVer11 DEFAULT = new OFQueueGetConfigRequestVer11(
        DEFAULT_XID, DEFAULT_PORT
    );

    // package private constructor - used by readers, builders, and factory
    OFQueueGetConfigRequestVer11(long xid, OFPort port) {
        if(port == null) {
            throw new NullPointerException("OFQueueGetConfigRequestVer11: property port cannot be null");
        }
        this.xid = xid;
        this.port = port;
    }

    // Accessors for OF message fields
    @Override
    public OFVersion getVersion() {
        return OFVersion.OF_11;
    }

    @Override
    public OFType getType() {
        return OFType.QUEUE_GET_CONFIG_REQUEST;
    }

    @Override
    public long getXid() {
        return xid;
    }

    @Override
    public OFPort getPort() {
        return port;
    }

    public OFQueueGetConfigRequest.Builder createBuilder() {
        return new BuilderWithParent(this);
    }

    static class BuilderWithParent implements OFQueueGetConfigRequest.Builder {
        final OFQueueGetConfigRequestVer11 parentMessage;

        // OF message fields
        private boolean xidSet;
        private long xid;
        private boolean portSet;
        private OFPort port;

        BuilderWithParent(OFQueueGetConfigRequestVer11 parentMessage) {
            this.parentMessage = parentMessage;
        }

    @Override
    public OFVersion getVersion() {
        return OFVersion.OF_11;
    }

    @Override
    public OFType getType() {
        return OFType.QUEUE_GET_CONFIG_REQUEST;
    }

    @Override
    public long getXid() {
        return xid;
    }

    @Override
    public OFQueueGetConfigRequest.Builder setXid(long xid) {
        this.xid = xid;
        this.xidSet = true;
        return this;
    }
    @Override
    public OFPort getPort() {
        return port;
    }

    @Override
    public OFQueueGetConfigRequest.Builder setPort(OFPort port) {
        this.port = port;
        this.portSet = true;
        return this;
    }

        @Override
        public OFQueueGetConfigRequest build() {
                long xid = this.xidSet ? this.xid : parentMessage.xid;
                OFPort port = this.portSet ? this.port : parentMessage.port;
                if(port == null)
                    throw new NullPointerException("Property port must not be null");

                //
                return new OFQueueGetConfigRequestVer11(
                    xid,
                    port
                );
        }

    }

    static class Builder implements OFQueueGetConfigRequest.Builder {
        // OF message fields
        private boolean xidSet;
        private long xid;
        private boolean portSet;
        private OFPort port;

    @Override
    public OFVersion getVersion() {
        return OFVersion.OF_11;
    }

    @Override
    public OFType getType() {
        return OFType.QUEUE_GET_CONFIG_REQUEST;
    }

    @Override
    public long getXid() {
        return xid;
    }

    @Override
    public OFQueueGetConfigRequest.Builder setXid(long xid) {
        this.xid = xid;
        this.xidSet = true;
        return this;
    }
    @Override
    public OFPort getPort() {
        return port;
    }

    @Override
    public OFQueueGetConfigRequest.Builder setPort(OFPort port) {
        this.port = port;
        this.portSet = true;
        return this;
    }
//
        @Override
        public OFQueueGetConfigRequest build() {
            long xid = this.xidSet ? this.xid : DEFAULT_XID;
            OFPort port = this.portSet ? this.port : DEFAULT_PORT;
            if(port == null)
                throw new NullPointerException("Property port must not be null");

            return new OFQueueGetConfigRequestVer11(
                    xid,
                    port
                );
        }

    }

    final static Reader READER = new Reader();
    static class Reader implements OFMessageReader<OFQueueGetConfigRequest> {
        @Override
        public OFQueueGetConfigRequest readFrom(ChannelBuffer bb) throws OFParseError {
            int start = bb.readerIndex();
            // fixed value property version == 2
            byte version = bb.readByte();
            if(version != (byte) 0x2)
                throw new OFParseError("Wrong version: Expected=OFVersion.OF_11(2), got="+version);
            // fixed value property type == 22
            byte type = bb.readByte();
            if(type != (byte) 0x16)
                throw new OFParseError("Wrong type: Expected=OFType.QUEUE_GET_CONFIG_REQUEST(22), got="+type);
            int length = U16.f(bb.readShort());
            if(length != 16)
                throw new OFParseError("Wrong length: Expected=16(16), got="+length);
            if(bb.readableBytes() + (bb.readerIndex() - start) < length) {
                // Buffer does not have all data yet
                bb.readerIndex(start);
                return null;
            }
            if(logger.isTraceEnabled())
                logger.trace("readFrom - length={}", length);
            long xid = U32.f(bb.readInt());
            OFPort port = OFPort.read4Bytes(bb);
            // pad: 4 bytes
            bb.skipBytes(4);

            OFQueueGetConfigRequestVer11 queueGetConfigRequestVer11 = new OFQueueGetConfigRequestVer11(
                    xid,
                      port
                    );
            if(logger.isTraceEnabled())
                logger.trace("readFrom - read={}", queueGetConfigRequestVer11);
            return queueGetConfigRequestVer11;
        }
    }

    public void putTo(PrimitiveSink sink) {
        FUNNEL.funnel(this, sink);
    }

    final static OFQueueGetConfigRequestVer11Funnel FUNNEL = new OFQueueGetConfigRequestVer11Funnel();
    static class OFQueueGetConfigRequestVer11Funnel implements Funnel<OFQueueGetConfigRequestVer11> {
        private static final long serialVersionUID = 1L;
        @Override
        public void funnel(OFQueueGetConfigRequestVer11 message, PrimitiveSink sink) {
            // fixed value property version = 2
            sink.putByte((byte) 0x2);
            // fixed value property type = 22
            sink.putByte((byte) 0x16);
            // fixed value property length = 16
            sink.putShort((short) 0x10);
            sink.putLong(message.xid);
            message.port.putTo(sink);
            // skip pad (4 bytes)
        }
    }

    public void writeTo(ChannelBuffer bb) {
        WRITER.write(bb, this);
    }

    final static Writer WRITER = new Writer();
    static class Writer implements OFMessageWriter<OFQueueGetConfigRequestVer11> {
        @Override
        public void write(ChannelBuffer bb, OFQueueGetConfigRequestVer11 message) {
            // fixed value property version = 2
            bb.writeByte((byte) 0x2);
            // fixed value property type = 22
            bb.writeByte((byte) 0x16);
            // fixed value property length = 16
            bb.writeShort((short) 0x10);
            bb.writeInt(U32.t(message.xid));
            message.port.write4Bytes(bb);
            // pad: 4 bytes
            bb.writeZero(4);

        }
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder("OFQueueGetConfigRequestVer11(");
        b.append("xid=").append(xid);
        b.append(", ");
        b.append("port=").append(port);
        b.append(")");
        return b.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        OFQueueGetConfigRequestVer11 other = (OFQueueGetConfigRequestVer11) obj;

        if( xid != other.xid)
            return false;
        if (port == null) {
            if (other.port != null)
                return false;
        } else if (!port.equals(other.port))
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;

        result = prime *  (int) (xid ^ (xid >>> 32));
        result = prime * result + ((port == null) ? 0 : port.hashCode());
        return result;
    }

}

redpajama_set_name: RedPajamaGithub


text:
package com.hpe.caf.worker.tracking.report;

public final class TrackingReportConstants
{
    /**
     * Identifies the sort of task this message is.
     */
    public static final String TRACKING_REPORT_TASK_NAME = "TrackingReportTask";

    /**
     * The numeric API version of the message task.
     */
    public static final int TRACKING_REPORT_TASK_API_VER = 1;

    private TrackingReportConstants() { }
}


text:
var chai       = require('chai');
var express    = require('express');
var sinon      = require('sinon');
var proxyquire = require('proxyquire');
var request    = require('supertest');
var fixtures   = require('./fixtures');
var should     = chai.should();

// Sinon stubs
var requestStub = sinon.stub();
requestStub.returns({
  write: sinon.stub(),
  end: sinon.stub()
});

var httpStub = {
  request: requestStub
};

var webhook = proxyquire('../lib/webhook', {
  'http': httpStub
});

describe('webhook', function() {

  it('should exist', function() {
    webhook.should.exist();
    webhook.should.be.a('function');
  });

  describe('middleware', function() {
    beforeEach(function() {
      var app = express();

      app.use(webhook());

      this.app = app;
    });

    it('should not affect other routes', function(done) {
      this.app.get('/', function(req, res) {
        return res.send('Hello World!');
      });

      var agent = request.agent(this.app);

      agent
        .get('/')
        .expect(200)
        .expect('Hello World!', done)
      ;
    });

    it('should expose /xmlrpc.php endpoint', function(done) {
      var agent = request.agent(this.app);

      agent
        .get('/xmlrpc.php')
        .expect(404)
        .expect('content-type', /text\/xml/, done)
      ;
    });

    it('should expose /wp-admin/profile.php endpoint', function(done) {
      var agent = request.agent(this.app);

      agent
        .get('/wp-admin/profile.php')
        .expect(200, done)
      ;
    });

    it('should expose /wp-admin/options-discussion.php endpoint', function(done) {
      var agent = request.agent(this.app);

      agent
        .get('/wp-admin/options-discussion.php')
        .expect(200, done)
      ;
    });

    it('should expose /wp-admin/options-general.php endpoint', function(done) {
      var agent = request.agent(this.app);

      agent
        .get('/wp-admin/options-general.php')
        .expect(200, done)
      ;
    });

    it('should return XML response for "mt.supportedMethods" XML-RPC request', function(done) {
      var agent = request.agent(this.app);

      var xmlPayload = fixtures.genericRequest('mt.supportedMethods');

      agent
        .post('/xmlrpc.php')
        .set({
          'Content-Type'   : 'text/xml',
          'Accept'         : 'text/xml',
          'Accept-Charset' : 'UTF8'
        })
        .send(xmlPayload)
        .expect(200)
        .expect('content-type', /text\/xml/, done)
      ;
    });

    it('should return XML response for "metaWeblog.getRecentPosts" XML-RPC request', function(done) {
      var agent = request.agent(this.app);

      var xmlPayload = fixtures.genericRequest('metaWeblog.getRecentPosts');

      agent
        .post('/xmlrpc.php')
        .set({
          'Content-Type'   : 'text/xml',
          'Accept'         : 'text/xml',
          'Accept-Charset' : 'UTF8'
        })
        .send(xmlPayload)
        .expect(200)
        .expect('content-type', /text\/xml/, done)
      ;
    });

    describe('IFTTT request', function() {
      describe('with default middleware', function() {
        beforeEach(function() {
          this.app = express();
          this.app.use(webhook());
        });

        it('should make HTTP POST request to a given URL in categories array', function(done) {
          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', 'A body', ['http://example.org'], ['one', 'two', 'three']);

          var postData = 'username=johndoe&password=s3cr3t&title=A%20title&description=A%20body&tags=one&tags=two&tags=three';

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(200)
            .expect('content-type', /text\/xml/, function() {
              requestStub.calledOnce.should.be.true();
              requestStub
                .calledWith({
                  hostname: 'example.org',
                  port: null,
                  path: '/',
                  method: 'POST',
                  headers: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                    'Content-Length': postData.length
                  }
                })
                .should.be.true()
              ;
              requestStub().write.calledOnce.should.be.true();
              requestStub().write.calledWith(postData).should.be.true();

              done();
            })
          ;
        });
      });

      describe('with middleware callback', function() {
        beforeEach(function() {
          this.app = express();
        });

        it('should call the callback', function(done) {
          this.app.use(webhook(function(json, done) {
            json.should.eql({
              username    : 'johndoe',
              password    : 's3cr3t',
              title       : 'A title',
              description : 'A body',
              categories  : [ 'one', 'two', 'three' ],
              tags        : [ 'four', 'five', 'six' ]
            });

            done();
          }));

          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', 'A body', ['one', 'two', 'three'], ['four', 'five', 'six']);

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(200)
            .expect('content-type', /text\/xml/, done)
          ;
        });

        it('should try to parse JSON object from body', function(done) {
          this.app.use(webhook(function(json, done) {
            json.should.eql({
              username    : 'johndoe',
              password    : 's3cr3t',
              title       : 'A title',
              description : { foo: 123, bar: 234 },
              categories  : [ 'one', 'two', 'three' ],
              tags        : [ 'four', 'five', 'six' ]
            });

            done();
          }));

          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', '{"foo": 123, "bar": 234}', ['one', 'two', 'three'], ['four', 'five', 'six']);

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(200)
            .expect('content-type', /text\/xml/, done)
          ;
        });
      });

      describe('with middleware auth', function() {
        beforeEach(function() {
          this.app = express();
        });

        it('should receive username and password in auth callback', function(done) {
          this.app.use(webhook(function(username, password, done) {
            username.should.eql('johndoe');
            password.should.eql('s3cr3t');

            done(null, true);
          }, function(json, done) {
            json.should.eql({
              title       : 'A title',
              description : { foo: 123, bar: 234 },
              categories  : [ 'one', 'two', 'three' ],
              tags        : [ 'four', 'five', 'six' ]
            });

            done();
          }));

          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', '{"foo": 123, "bar": 234}', ['one', 'two', 'three'], ['four', 'five', 'six']);

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(200)
            .expect('content-type', /text\/xml/, done)
          ;
        });

        it('should pass a validated user to the callback', function(done) {
          this.app.use(webhook(function(username, password, done) {
            username.should.eql('johndoe');
            password.should.eql('s3cr3t');

            done(null, { id: 123, username: 'johndoe', email: 'johndoe@example.org' });
          }, function(json, done) {
            json.should.eql({
              user        : { id: 123, username: 'johndoe', email: 'johndoe@example.org' },
              title       : 'A title',
              description : { foo: 123, bar: 234 },
              categories  : [ 'one', 'two', 'three' ],
              tags        : [ 'four', 'five', 'six' ]
            });

            done();
          }));

          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', '{"foo": 123, "bar": 234}', ['one', 'two', 'three'], ['four', 'five', 'six']);

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(200)
            .expect('content-type', /text\/xml/, done)
          ;
        });

        it('should return error response if it fails authentication', function(done) {
          this.app.use(webhook(function(username, password, done) {
            username.should.eql('johndoe');
            password.should.eql('s3cr3t');

            done(null, false);
          }, function(json, done) {
            // This callback should not be called
            (true).should.be.false();

            done();
          }));

          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', '{"foo": 123, "bar": 234}', ['one', 'two', 'three'], ['four', 'five', 'six']);

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(404)
            .expect('content-type', /text\/xml/, done)
          ;
        });

        it('should return error response if there was an error during authentication', function(done) {
          this.app.use(webhook(function(username, password, done) {
            username.should.eql('johndoe');
            password.should.eql('s3cr3t');

            done(new Error('KABOOM!'));
          }, function(json, done) {
            // This callback should not be called
            (true).should.be.false();

            done();
          }));

          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', '{"foo": 123, "bar": 234}', ['one', 'two', 'three'], ['four', 'five', 'six']);

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(404)
            .expect('content-type', /text\/xml/, done)
          ;
        });
      });

      describe('with middleware categories', function() {
        beforeEach(function() {
          this.app = express();
        });

        it('should call callbacks for all categories', function(done) {
          this.app.use(webhook({
            foo: function(json, done) {
              json.should.eql({
                username    : 'johndoe',
                password    : 's3cr3t',
                title       : 'A title',
                description : { foo: 123, bar: 234 },
                tags        : [ 'four', 'five', 'six' ]
              });

              done();
            },

            bar: function(json, done) {
              json.should.eql({
                username    : 'johndoe',
                password    : 's3cr3t',
                title       : 'A title',
                description : { foo: 123, bar: 234 },
                tags        : [ 'four', 'five', 'six' ]
              });

              done();
            }
          }));

          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', '{"foo": 123, "bar": 234}', ['cat:foo', 'cat:bar'], ['four', 'five', 'six']);

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(200)
            .expect('content-type', /text\/xml/, done)
          ;
        });

        it('should ignore unknown categories', function(done) {
          this.app.use(webhook({
            foo: function(json, done) {
              json.should.eql({
                username    : 'johndoe',
                password    : 's3cr3t',
                title       : 'A title',
                description : { foo: 123, bar: 234 },
                tags        : [ 'four', 'five', 'six' ]
              });

              done();
            },

            bar: function(json, done) {
              json.should.eql({
                username    : 'johndoe',
                password    : 's3cr3t',
                title       : 'A title',
                description : { foo: 123, bar: 234 },
                tags        : [ 'four', 'five', 'six' ]
              });

              done();
            },

            baz: function(json, done) {
              // This callback should not be called
              (true).should.be.false();

              done();
            }
          }));

          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', '{"foo": 123, "bar": 234}', ['cat:foo', 'cat:bar'], ['four', 'five', 'six']);

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(200)
            .expect('content-type', /text\/xml/, done)
          ;
        });

        it('should do nothing if there is no known category', function(done) {
          this.app.use(webhook({
            foo: function(json, done) {
              // This callback should not be called
              (true).should.be.false();

              done();
            }
          }));

          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', '{"foo": 123, "bar": 234}', ['cat:bar'], ['four', 'five', 'six']);

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(200)
            .expect('content-type', /text\/xml/, done)
          ;
        });
      });

      describe('with middleware auth and categories', function() {
        beforeEach(function() {
          this.app = express();
        });

        it('should pass a validated user to the callback categories', function(done) {
          this.app.use(webhook({
            auth: function(username, password, done) {
              username.should.eql('johndoe');
              password.should.eql('s3cr3t');

              done(null, { id: 123, username: 'johndoe', email: 'johndoe@example.org' });
            },

            foo: function(json, done) {
              json.should.eql({
                user        : { id: 123, username: 'johndoe', email: 'johndoe@example.org' },
                title       : 'A title',
                description : { foo: 123, bar: 234 },
                tags        : [ 'four', 'five', 'six' ]
              });

              done();
            },

            bar: function(json, done) {
              json.should.eql({
                user        : { id: 123, username: 'johndoe', email: 'johndoe@example.org' },
                title       : 'A title',
                description : { foo: 123, bar: 234 },
                tags        : [ 'four', 'five', 'six' ]
              });

              done();
            }
          }));

          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', '{"foo": 123, "bar": 234}', ['cat:foo', 'cat:bar'], ['four', 'five', 'six']);

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(200)
            .expect('content-type', /text\/xml/, done)
          ;
        });

        it('should return error response if it fails authentication', function(done) {
          this.app.use(webhook({
            auth: function(username, password, done) {
              username.should.eql('johndoe');
              password.should.eql('s3cr3t');

              done(null, false);
            },

            foo: function(json, done) {
              // This callback should not be called
              (true).should.be.false();

              done();
            },

            bar: function(json, done) {
              // This callback should not be called
              (true).should.be.false();

              done();
            }
          }));

          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', '{"foo": 123, "bar": 234}', ['cat:foo', 'cat:bar'], ['four', 'five', 'six']);

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(404)
            .expect('content-type', /text\/xml/, done)
          ;
        });

        it('should return error response if there was an error during authentication', function(done) {
          this.app.use(webhook({
            auth: function(username, password, done) {
              username.should.eql('johndoe');
              password.should.eql('s3cr3t');

              done(new Error('KABOOM!'));
            },

            foo: function(json, done) {
              // This callback should not be called
              (true).should.be.false();

              done();
            },

            bar: function(json, done) {
              // This callback should not be called
              (true).should.be.false();

              done();
            }
          }));

          var agent = request.agent(this.app);

          var xmlPayload = fixtures.newPostRequest('A title', '{"foo": 123, "bar": 234}', ['cat:foo', 'cat:bar'], ['four', 'five', 'six']);

          agent
            .post('/xmlrpc.php')
            .set({
              'Content-Type'   : 'text/xml',
              'Accept'         : 'text/xml',
              'Accept-Charset' : 'UTF8'
            })
            .send(xmlPayload)
            .expect(404)
            .expect('content-type', /text\/xml/, done)
          ;
        });
      });
    });
  });

});


text:
package de.rwth.setups;

import gl.GL1Renderer;
import gl.GLFactory;
import gui.InfoScreenSettings;
import system.DefaultARSetup;
import system.ErrorHandler;
import util.Vec;
import worldData.AbstractObj;
import worldData.RenderQuadList;
import worldData.World;

public class LargeWorldsSetup extends DefaultARSetup {

	private static final int NUMBER_OF_OBJECTS = 1000;

	@Override
	public void _a_initFieldsIfNecessary() {
		super._a_initFieldsIfNecessary();
		// allow the user to send error reports to the developer:
		ErrorHandler.enableEmailReports("droidar.rwth@gmail.com",
				"Error in LargeWorldsSetup");
	}

	@Override
	public void _f_addInfoScreen(InfoScreenSettings infoScreenData) {
		infoScreenData
				.addText("This setup will demonstrate a possible culling-strategy for very large virtual worlds.");
		infoScreenData
				.addText((NUMBER_OF_OBJECTS)
						+ " textured individual objects will be added to the virtual world.");
	}

	@Override
	public void addObjectsTo(GL1Renderer renderer, World world,
			GLFactory objectFactory) {
		RenderQuadList list = new RenderQuadList(getCamera(), 100, 10);
		for (int x = (int) Math.sqrt(NUMBER_OF_OBJECTS); x >= 0; x--) {
			for (int y = (int) Math.sqrt(NUMBER_OF_OBJECTS); y >= 0; y--) {
				list.add(newObj(x * 5, y * 5));
			}
		}
		// when the quad-list is created, add it to the world:
		world.add(list);
	}

	private AbstractObj newObj(int x, int y) {
		String name = "x=" + x + ",y=" + y;
		return GLFactory.getInstance().newTextObject(name, new Vec(x, y, 0),
				getActivity(), camera);

	}
}


text:
extern const char FILE_standard__hash_collection[];
#define COLOR_standard__kernel__Object___61d_61d 2
#define COLOR_standard__kernel__Object__hash 4
#define COLOR_standard__hash_collection__HashCollection___capacity 1
extern const struct type type_standard__Int;
extern const char FILE_standard__kernel[];
#define COLOR_standard__hash_collection__HashCollection___last_accessed_key 5
#define COLOR_standard__hash_collection__HashCollection___last_accessed_node 6
long standard__hash_collection___standard__hash_collection__HashCollection___index_at(val* self, val* p0);
val* standard__hash_collection___standard__hash_collection__HashCollection___node_at_idx(val* self, long p0, val* p1);
#define COLOR_standard__hash_collection__HashCollection___array 0
#define COLOR_standard__hash_collection__HashNode___key 0
#define COLOR_standard__hash_collection__HashNode___next_in_bucklet 4
#define COLOR_nullable__standard__hash_collection__HashCollection__N 14
#define COLOR_standard__hash_collection__HashCollection__N 15
#define COLOR_standard__hash_collection__HashCollection___first_item 3
#define COLOR_standard__hash_collection__HashCollection___last_item 4
#define COLOR_standard__hash_collection__HashNode___next_item 1
#define COLOR_standard__hash_collection__HashNode___prev_item 2
#define COLOR_standard__NativeArray___35dE 0
extern const char FILE_standard__array[];
#define COLOR_standard__hash_collection__HashNode___prev_in_bucklet 3
#define COLOR_standard__hash_collection__HashCollection___the_length 2
void standard__hash_collection___standard__hash_collection__HashCollection___enlarge(val* self, long p0);
val* NEW_standard__NativeArray(int length, const struct type* type);
#define COLOR_standard__NativeArray__nullable__standard__hash_collection__HashCollection__N 16
#define COLOR_standard__hash_collection__HashNode___35dK 1
#define COLOR_standard__hash_collection___standard__hash_collection__HashNode___standard__kernel__Object__init 33
#define COLOR_standard__HashMap___35dK 5
val* standard__hash_collection___standard__hash_collection__HashCollection___node_at(val* self, val* p0);
#define COLOR_standard__abstract_collection__MapRead__provide_default_value 40
#define COLOR_standard__hash_collection__HashMapNode___value 5
val* NEW_standard__HashMapIterator(const struct type* type);
#define COLOR_standard__HashMapIterator__standard__HashMap___35dK__standard__HashMap___35dV 6
#define COLOR_standard__hash_collection__HashMapIterator__map_61d 38
#define COLOR_standard__kernel__Object__init 7
#define COLOR_standard__HashMap___35dV 7
val* NEW_standard__hash_collection__HashMapNode(const struct type* type);
#define COLOR_standard__hash_collection__HashMapNode__standard__HashMap___35dK__standard__HashMap___35dV 8
#define COLOR_standard__hash_collection__HashNode__key_61d 32
#define COLOR_standard__hash_collection__HashMapNode__value_61d 34
void standard__hash_collection___standard__hash_collection__HashCollection___store(val* self, long p0, val* p1);
void standard__hash_collection___standard__hash_collection__HashCollection___raz(val* self);
#define COLOR_standard___standard__HashMap___standard__kernel__Object__init 52
#define COLOR_standard__hash_collection__HashMap___keys 7
#define COLOR_standard__hash_collection__HashMap___values 8
#define COLOR_standard__hash_collection__HashMapKeys___map 0
#define COLOR_standard__HashMap__standard__hash_collection__HashMapKeys___35dK__standard__hash_collection__HashMapKeys___35dV 0
#define COLOR_standard__hash_collection__HashMapKeys___35dK 1
short int standard___standard__HashMap___standard__abstract_collection__MapRead__is_empty(val* self);
long standard___standard__HashMap___standard__abstract_collection__MapRead__length(val* self);
val* NEW_standard__MapKeysIterator(const struct type* type);
#define COLOR_standard__MapKeysIterator__standard__hash_collection__HashMapKeys___35dK__standard__hash_collection__HashMapKeys___35dV 2
val* standard___standard__HashMap___standard__abstract_collection__MapRead__iterator(val* self);
#define COLOR_standard__abstract_collection__MapKeysIterator__original_iterator_61d 39
void standard___standard__HashMap___standard__abstract_collection__Map__clear(val* self);
void standard__hash_collection___standard__hash_collection__HashCollection___remove_node(val* self, val* p0);
#define COLOR_standard__hash_collection___standard__hash_collection__HashMapKeys___standard__kernel__Object__init 56
#define COLOR_standard__hash_collection__HashMapValues___map 0
#define COLOR_standard__HashMap__standard__hash_collection__HashMapValues___35dK__standard__hash_collection__HashMapValues___35dV 0
#define COLOR_standard__hash_collection__HashMapValues___35dV 1
val* NEW_standard__MapValuesIterator(const struct type* type);
#define COLOR_standard__MapValuesIterator__standard__hash_collection__HashMapValues___35dK__standard__hash_collection__HashMapValues___35dV 2
#define COLOR_standard__abstract_collection__MapValuesIterator__original_iterator_61d 39
#define COLOR_standard__hash_collection___standard__hash_collection__HashMapValues___standard__kernel__Object__init 56
#define COLOR_standard__hash_collection__HashMapNode___35dV 0
#define COLOR_standard__hash_collection___standard__hash_collection__HashMapNode___standard__kernel__Object__init 35
#define COLOR_standard__hash_collection__HashMapIterator___node 1
short int standard___standard__HashMapIterator___standard__abstract_collection__MapIterator__is_ok(val* self);
#define COLOR_standard__hash_collection__HashMapIterator___map 0
#define COLOR_standard__HashMap__standard__HashMapIterator___35dK__standard__HashMapIterator___35dV 0
#define COLOR_standard__HashSet___35dE 0
val* NEW_standard__hash_collection__HashSetNode(const struct type* type);
#define COLOR_standard__hash_collection__HashSetNode__standard__HashSet___35dE 1
val* NEW_standard__hash_collection__HashSetIterator(const struct type* type);
#define COLOR_standard__hash_collection__HashSetIterator__standard__HashSet___35dE 2
#define COLOR_standard__hash_collection__HashSetIterator__set_61d 38
#define COLOR_standard___standard__HashSet___standard__kernel__Object__init 60
#define COLOR_standard__Collection__standard__HashSet___35dE 3
void standard___standard__HashSet___standard__kernel__Object__init(val* self);
void standard___standard__SimpleCollection___add_all(val* self, val* p0);
#define COLOR_standard__hash_collection__HashSetIterator___node 1
short int standard__hash_collection___standard__hash_collection__HashSetIterator___standard__abstract_collection__Iterator__is_ok(val* self);
#define COLOR_standard__HashSet__standard__hash_collection__HashSetIterator___35dE 1
#define COLOR_standard__hash_collection__HashSetIterator___set 0


text:
import React, { Component, PropTypes } from 'react'

export default class Start extends Component {
    render() {
        return (
            <RaisedButton disabled={this.props.selectedGame?'':'disabled'} onClick={this.props.onStartGameClick} secondary={true} label="Start Game"/>

        )
    }

}
Start.propTypes = {
    onStartGameClick: PropTypes.func.isRequired
};


text:
declare var y: {[string]: boolean};
(y: {(number): string});


text:
var engine = require("../engine");
var manager = require("../manager");

module.exports = engine.promiseCommand(function(doc,newChild) {
    return manager.requireRelativeDoc(doc).then(function(doc) {
        if (typeof doc === "undefined") {
            throw new engine.CommandError("Not in a stew project.");
        }
        return manager.requireRelativeDoc(newChild).then(function(child) {
            if (typeof child === "undefined") {
                throw new engine.CommandError("New child is not in a stew project.");
            }
            return doc.moveDocHere(child);
        });
    });
},function(doc,newChild) {
    if (arguments.length == 1) {
        newChild = doc;
        doc = void 0;
    }

    if ((typeof doc === "undefined") ||
         ((typeof doc === "object") && (typeof doc.moveDocTo === "function")) ||
         (typeof doc === "string")) {
        if (((typeof newChild === "object") && (typeof newChild.ensurePrimary === "function")) ||
             (typeof newChild === "string")) {
            return [doc,newChild];
        }
        throw new engine.CommandError("Invalid document argument for move.");
    }
    throw new engine.CommandError("Invalid directory argument for move.");
});


text:
export interface Option {
  value: string
  label: string
}

export interface Threesome {
  from: Option[]
  to: Option[]
}

export interface Langs {
  threesome: Threesome
  selected: {
    from: string
    to: string
  }
}
// TODO resolve any
export interface Store {
  langs: Langs,
  loading: boolean
  suggestions: any
  reversoSuggestions: any
  google: any
  reverso: any
  googleEnabled: boolean
  reversoEnabled: boolean
  theme: string
  input: string
  search: string,
  payload: any
  shortcut: string
  showWelcome: boolean
  startAtLogin: boolean
  checkUpdates: boolean
  engine: string // TODO create enum
  version: string
  error: boolean
  speed: {
    from: boolean
    to: boolean
  },

  getData: (text: string, langsSelected: any) => void
  setLangs: (langs: Langs) => void
  setShortcut: (value: string) => void
  setShowWelcome: (value: boolean) => void
  setStartAtLogin: (value: boolean) => void
  setCheckUpdates: (value: boolean) => void
  restoreSettings: () => void
  setSuggestions: (data: any) => void
  setGoogle: (data: any) => void
  setError: (value: boolean) => void
  setInput: (text: string) => void
  setLoading: (loading: boolean) => void
  clearData: () => void
  setSearch: (text: string) => void
  playAudio: (text: string, lang: string, conversion: string, speed: any) => void
}


text:
using System.Collections;
using System.Collections.Generic;
using FluentAssertions;
using NUnit.Framework;

namespace SimpleMvcSitemap.Tests
{
    public class ReflectionHelperTests : TestBase
    {
        private IReflectionHelper _reflectionHelper;

        protected override void FinalizeSetUp()
        {
            _reflectionHelper = new ReflectionHelper();
        }

        private class SampleType1 { }

        [Test]
        public void GetUrlProperties_ClassHasNoProperties_DoesNotThrowException()
        {
            _reflectionHelper.GetPropertyModel(typeof(SampleType1)).Should().NotBeNull();
        }

        private class SampleType2
        {
            [Url]
            public string Url { get; set; }

            public string Title { get; set; }

            [Url]
            public string Url4 { get { return null; } }

            [Url]
            public string Url5 { set { } }

            [Url]
            public int Url2 { get; set; }

            [Url]
            public SampleType2 Url3 { get; set; }
        }

        [Test]
        public void GetUrlProperties_ClassHasUrlProperties_ReturnUrlProperty()
        {
            UrlPropertyModel urlPropertyModel = _reflectionHelper.GetPropertyModel(typeof(SampleType2));

            urlPropertyModel.UrlProperties.Should().HaveCount(1).And.ContainSingle(info => info.Name == "Url");
        }

        private class SampleType3
        {
            public List<SampleType1> List1 { get; set; }
            [Url]
            public SampleType1[] List2 { get; set; }
            public SampleType1 Item { get; set; }
            public IEnumerable List3 { get; set; }
            public IEnumerable<SampleType2> List4 { set { } }
        }

        [Test]
        public void GetUrlProperties_ClassHasEnumerableProperties_FindsEnumerableProperties()
        {
            UrlPropertyModel urlPropertyModel = _reflectionHelper.GetPropertyModel(typeof(SampleType3));

            urlPropertyModel.UrlProperties.Should().BeEmpty();
            urlPropertyModel.EnumerableProperties.Should().HaveCount(3);
        }

        private class SampleType4
        {
            public SampleType1 SampleType1 { get; set; }
            [Url]
            public SampleType2 SampleType2 { get; set; }

            public string S { get; set; }

            public SampleType3 SampleType3 { set { } }
        }

        [Test]
        public void GetUrlProperties_ClassHasClassProperties_FindsClassProperties()
        {
            UrlPropertyModel urlPropertyModel = _reflectionHelper.GetPropertyModel(typeof(SampleType4));

            urlPropertyModel.UrlProperties.Should().BeEmpty();
            urlPropertyModel.ClassProperties.Should().HaveCount(2);
        }

    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Uredo dregiae Petch

### Remarks
null


text:
<!doctype html>
<html>
<head>
    <script type="text/javascript">
        window.location = "v1.0/index.html" + window.location.hash;
    </script>
</head>
<body>
</body>
</html>


text:
define(['text!readium_js_viewer_i18n/_locales/en_US/messages.json'], function(en_US){
    var i18nObj = {};

    var baseObj = JSON.parse(en_US);

    var dynamicProp = function(propName){
        Object.defineProperty(i18nObj, prop, {get : function(){return chrome.i18n.getMessage(propName);}});
    }
    for(var prop in baseObj){
        dynamicProp(prop);
    }
    return i18nObj;
});


text:
@implementation Product

- (instancetype)initWithDictionary:(NSDictionary *)attributes {
    self = [super init];
    if (self) {
        _productId = attributes[@"id"];
        _name = attributes[@"name"];
        _price = [attributes[@"price"] unsignedIntegerValue];
        _imageURL = [NSURL URLWithString:attributes[@"image_url"]];
        _productDescription = attributes[@"description"];
    }
    return self;
}

@end


text:
module Hob
  class Application
    class Config

      ##
      # Exception which will be raised when config is invalid
      #
      InvalidConfig = Class.new(StandardError)

      ##
      # Class: recipe structure
      #
      Recipe = Struct.new(:name, :options)

      class << self

        ##
        # Static: lookup for config file
        #
        # Params:
        # - path {Pathname} path to directory which contains config file
        #
        # Returns: {Pathname} full real path to config file
        #
        def lookup(path)
          Dir[path.join('**', 'deploy.yml')].first
        end

        ##
        # Static: read configuration file
        # Read file, apply ERB tags and convert from YAML
        #
        # Params:
        # - file {Pathname} real path to configuration file
        #
        # Returns: {Hash} configuration
        #
        def read(file)
          plain   = File.read(file)
          content = ERB.new(plain).result

          YAML.load(content)
        end
      end

      ##
      # Config retrieved from the file
      #
      # Returns: {Hash}
      #
      def raw_config
        @config
      end

      ##
      # List of used recipes
      #
      # Returns: {Array(Hob::Application::Config::Recipe)}
      #
      attr_reader :recipes

      ##
      # Inline event handlers
      #
      # Returns: {Hash}
      #
      attr_reader :events

    private

      ##
      # Constructor:
      #
      # Params:
      # - path {Pathname} path to directory where config file should be placed
      #
      def initialize(path)
        @file    = self.class.lookup(path)
        @config  = self.class.read(@file)
        @recipes = []
        @events  = {}

        validate_config

        read_recipes
        read_events
      end

      ##
      # Private: validate config
      #
      # Raises: {Hob::Application::Config::InvalidConfig}
      #
      def validate_config
        if @config.has_key?('recipes')
          fail InvalidConfig, 'recipes must be an Array' unless @config['recipes'].kind_of?(Array)
        end

        if @config.has_key?('events')
          fail InvalidConfig, 'events must be a Hash' unless @config['events'].kind_of?(Hash)
        end
      end

      ##
      # Private: read and normalize recipes data and options
      #
      # It iterates over recipes array and make a Recipe structs.
      # If array member is a string – it creates recipe with only name
      # and empty hash for options. If array member is a {Hash} – it
      # iterates over keys and values, each key will be a recipe name
      # and values will be a recipe options.
      #
      def read_recipes
        return unless @config.has_key?('recipes')

        @config['recipes'].each do |recipe|
          if recipe.is_a?(String)
            @recipes << Recipe.new(recipe, {})
          elsif recipe.is_a?(Hash)
            recipe.each_pair { |k, v| @recipes << Recipe.new(k, v) }
          end
        end
      end

      ##
      # Private: read and normalize events data
      #
      # Events data keys must be a symbols and values must be
      # an Arrays of strings
      #
      def read_events
        return unless @config.has_key?('events')

        @config['events'].each_pair do |event, actions|
          @events[event.to_sym] = Array(actions)
        end
      end

    end
  end
end


text:
import sys
import prlsdkapi

prlsdk = prlsdkapi.prlsdk
consts = prlsdkapi.prlsdk.consts

# Initialize the Parallels API Library
prlsdk.InitializeSDK(consts.PAM_DESKTOP_MAC)

# Obtain a server object identifying the Parallels Service.
server = prlsdkapi.Server()

# Log in. (local as we do Parallels Desktop
login_job=server.login_local()
login_job.wait()

# Logoff and deinitialize the library
server.logoff()
prlsdkapi.deinit_sdk


text:
package org.apache.jackrabbit.oak.segment.file.tar;

import static com.google.common.collect.Lists.newArrayListWithCapacity;
import static com.google.common.collect.Maps.newHashMapWithExpectedSize;
import static org.apache.jackrabbit.oak.segment.file.tar.TarConstants.GRAPH_MAGIC;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.zip.CRC32;

import org.apache.jackrabbit.oak.commons.Buffer;
import org.apache.jackrabbit.oak.segment.util.ReaderAtEnd;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class GraphLoader {

    private static final Logger log = LoggerFactory.getLogger(GraphLoader.class);

    private static final int FOOTER_SIZE = 16;

    private GraphLoader() {
    }

    /**
     * Loads the optional pre-compiled graph entry from the given tar file.
     *
     * @return the graph or {@code null} if one was not found
     * @throws IOException if the tar file could not be read
     */
    public static Buffer loadGraph(ReaderAtEnd readerAtEnd) throws IOException {
        Buffer meta = readerAtEnd.readAtEnd(FOOTER_SIZE, FOOTER_SIZE);

        int crc32 = meta.getInt();
        int count = meta.getInt();
        int bytes = meta.getInt();
        int magic = meta.getInt();

        if (magic != GRAPH_MAGIC) {
            log.warn("Invalid graph magic number");
            return null;
        }

        if (count < 0) {
            log.warn("Invalid number of entries");
            return null;
        }

        if (bytes < 4 + count * 34) {
            log.warn("Invalid entry size");
            return null;
        }

        Buffer graph = readerAtEnd.readAtEnd(bytes, bytes);

        byte[] b = new byte[bytes - FOOTER_SIZE];

        graph.mark();
        graph.get(b);
        graph.reset();

        CRC32 checksum = new CRC32();
        checksum.update(b);

        if (crc32 != (int) checksum.getValue()) {
            log.warn("Invalid graph checksum in tar file");
            return null;
        }

        return graph;
    }

    public static Map<UUID, List<UUID>> parseGraph(Buffer buffer) {
        int nEntries = buffer.getInt(buffer.limit() - 12);

        Map<UUID, List<UUID>> graph = newHashMapWithExpectedSize(nEntries);

        for (int i = 0; i < nEntries; i++) {
            long msb = buffer.getLong();
            long lsb = buffer.getLong();
            int nVertices = buffer.getInt();

            List<UUID> vertices = newArrayListWithCapacity(nVertices);

            for (int j = 0; j < nVertices; j++) {
                long vMsb = buffer.getLong();
                long vLsb = buffer.getLong();
                vertices.add(new UUID(vMsb, vLsb));
            }

            graph.put(new UUID(msb, lsb), vertices);
        }

        return graph;
    }
}


text:
<?php

namespace Openl10n\Domain\User\Model;

use Openl10n\Domain\User\Value\Email;
use Openl10n\Domain\User\Value\Username;
use Openl10n\Value\Localization\Locale;
use Openl10n\Value\String\Name;

class User
{
    /**
     * @var int
     */
    protected $id;

    protected $username;
    protected $email;
    protected $name;
    protected $preferredLocale;
    protected $credentials;

    public function __construct(Username $username)
    {
        $this->username = $username;
        $this->name = new Name($username);
        $this->preferredLocale = Locale::parse('en');
    }

    public function getUsername()
    {
        return $this->username;
    }

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail(Email $email)
    {
        $this->email = $email;

        return $this;
    }

    public function getName()
    {
        return $this->name;
    }

    public function setName(Name $name)
    {
        $this->name = $name;

        return $this;
    }

    public function getPreferredLocale()
    {
        return $this->preferredLocale;
    }

    public function setPreferredLocale(Locale $preferredLocale)
    {
        $this->preferredLocale = $preferredLocale;

        return $this;
    }

    public function getCredentials()
    {
        return $this->credentials;
    }
}


text:
sleep 1

# Get the directory where the WFM is installed
wfmdir=`dirname $0`

if [[ "${ROCOTO_TASK_GEO:-X}" != X ]] ; then
    export LSB_PJL_TASK_GEOMETRY="$ROCOTO_TASK_GEO"
fi

# Run the command passed in arguments
"$@"

# Get the status of the command
error=$?

# If we are using POE, call special exit script
if [ "${LSF_PJL_TYPE}" == "poe" ]; then
  export LSB_PJL_TASK_GEOMETRY="{(0)}"
  mpirun.lsf ${wfmdir}/lsfexit.sh ${error}
  exit ${error}
else
  exit ${error}
fi


text:
package model

//EmptyReq nothing
type EmptyReq struct {
}

//WarmUpReq warm up
type WarmUpReq struct {
	Mid    int64 `form:"mid"`
	LastID int   `form:"last_id"`
	Size   int   `form:"size"`
}

//AddStaffReq .
type AddStaffReq struct {
	StaffMid int64 `form:"staff_mid"`
	Aid      int64 `form:"aid"`
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/BottomNavigationBar.iml" filepath="$PROJECT_DIR$/BottomNavigationBar.iml" />
      <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
      <module fileurl="file://$PROJECT_DIR$/bottomnavigationlayout/bottomnavigationlayout.iml" filepath="$PROJECT_DIR$/bottomnavigationlayout/bottomnavigationlayout.iml" />
    </modules>
  </component>
</project>


text:
'use strict';

var React = require('react');
var SvgIcon = require('../../svg-icon');

var CommunicationChatBubbleOutline = React.createClass({
  displayName: 'CommunicationChatBubbleOutline',

  render: function render() {
    return React.createElement(
      SvgIcon,
      this.props,
      React.createElement('path', { d: "M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z" })
    );
  }

});

module.exports = CommunicationChatBubbleOutline;


text:
@implementation RHNTodayCell

- (void)awakeFromNib {
    self.titleLabel.highlightedTextColor = [UIColor grayColor];
    self.nameLabel.highlightedTextColor = [UIColor grayColor];
    self.scoreLabel.highlightedTextColor = [UIColor grayColor];
    self.commentLabel.highlightedTextColor = [UIColor grayColor];

    CGRect bgframe = self.bounds;
    bgframe.origin.y = 1;
    bgframe.size.height -= 2;
    self.selectedBackgroundView = [[UIView alloc] initWithFrame:bgframe];
    self.selectedBackgroundView.backgroundColor = [UIColor clearColor];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

//    if (selected) {
//        self.backgroundColor = [UIColor clearColor];
//    } else {
//        self.backgroundColor = [UIColor clearColor];
//    }
}

@end


text:
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows;

using Memento.JMS.JMSCommon;

namespace Memento.JMS.Server
{
    /// <summary>
    /// 仓库列表管理界面
    /// </summary>
    public class WarehouseList : SingleTable
    {
        #region 构造函数

        /// <summary>
        /// 仓库列表管理界面
        /// </summary>
        public WarehouseList()
            : base(TableNameHelper.BS_WAREHOUSEINFO)
        {
        }

        #endregion

        #region 重写方法

        internal override void InitFlexGridColumns()
        {
            base.InitFlexGridColumns();

            AddColumn("Code", "仓库编号");
            AddColumn("Name", "仓库名称");
        }

        internal override Window InitDataItemEditChildWindow(DataRow dataRow, Action<int, int> loadListData)
        {
            if(dataRow == null)
            {
                return new Warehouse(loadListData);
            }

            return new Warehouse(dataRow, loadListData);
        }

        internal override void AfterEdited()
        {
            base.AfterEdited();

            BaseDataCache.InitSingleBaseData(TableNameHelper.BS_WAREHOUSEINFO);
        }

        #endregion
    }
}


text:
					<form id="wizardForm" enctype="multipart/form-data" method="post" action="">

									Judul Proposal

<?php echo $data->judul; ?>

									Nama
									<input type="text" class="form-control" name="nama"  id="exampleInputName"
										value="<?php echo $user->nim.' - '.$user->nama; ?>" readonly />

									Bidang Minat
									<input type="text" class="form-control" name="kons"  id="exampleInputName"
										value="<?php echo $this->kpta_lib->sql_konsentrasi($user->id_konsentrasi); ?>" readonly />

									Latar Belakang
									<textarea class="form-control" name="latarbelakang" id='latarbelakang'><?php echo $ta->latarbelakang; ?></textarea>

									Rumusan Masalah
									<textarea class="form-control" name="masalah" id='masalah'><?php echo $ta->masalah; ?></textarea>

									Usulan Solusi
									<textarea class="form-control" name="usulan" id='usulan' ><?php echo $ta->usulan; ?></textarea>

									Batasan Pekerjaan
									<textarea class="form-control" name="batasan" id='batasan'><?php echo $ta->batasan; ?></textarea>

									Langkah Penyelesaian
									<textarea class="form-control" name="langkah" id='langkah'><?php echo $ta->langkah; ?></textarea>

									Daftar Pustaka
									<textarea class="form-control" name="pustaka" id='pustaka'><?php echo $ta->pustaka; ?></textarea>

									Jenis Tugas Akhir
									<input type="text" class="form-control" name="jenis"  id="jenis" value="Penelitian/Skripsi" readonly />
									File Proposal.doc

									Dosen Pembimbing*
									<?php echo anchor('dosen','Daftar Dosen',array('target' => '_blank', 'class' => 'new_window')) ?>
									<?php echo $this->kpta_lib->dropdown_dosen(PEMBIMBING_TA, $data->id_pembimbing) ?>

									Catatan
									<input type="text" class="form-control" name="catatan" id="exampleInputName" />

									Status*
									<?php echo $this->kpta_lib->dropdown_diterima() ?>

									<input type="hidden" name="id_kerja" value="<?php echo $this->uri->segment('3'); ?>" />
									<input type="submit" class="btn btn-primary" onclick="return confirm('Anda yakin untuk diproses?')" name="submit" value="Proses" />

					</form>


text:
module Quark
def self.builtin_codec_md; BuiltinCodecMd; end
module BuiltinCodecMd
require 'quark' # .../reflect

def self.quark_List_quark_String_; QuarkListQuarkString; end
class QuarkListQuarkString < ::Quark.quark.reflect.QuarkClass
    extend ::DatawireQuarkCore::Static

    static singleton: -> { ::Quark.builtin_codec_md.quark_List_quark_String_.new() }

    def initialize()

        super("quark.List<quark.String>")
        (self).name = "quark.List"
        (self).parameters = ::DatawireQuarkCore::List.new(["quark.String"])
        (self).fields = ::DatawireQuarkCore::List.new([])
        (self).methods = ::DatawireQuarkCore::List.new([])

        nil
    end

    def construct(args)

        return ::DatawireQuarkCore::List.new()

        nil
    end

    def _getClass()

        return nil

        nil
    end

    def _getField(name)

        return nil

        nil
    end

    def _setField(name, value)

        nil

        nil
    end

    def __init_fields__()

        super

        nil
    end

end
QuarkListQuarkString.unlazy_statics

def self.Root; Root; end
class Root < ::DatawireQuarkCore::QuarkObject

    def initialize()
        self.__init_fields__

        nil
    end

    def _getClass()

        return nil

        nil
    end

    def _getField(name)

        return nil

        nil
    end

    def _setField(name, value)

        nil

        nil
    end

    def __init_fields__()

        nil
    end

end
end # module BuiltinCodecMd
end # module Quark


text:
The main file is `test.jsx`.  Target-specific files prepend target directives.

Copy the `test.jsx` file as well as the `shim.js`, `jszip.js` and `xlsx.flow.js`
files to wherever you want the scripts to reside.  The demo shows opening a file
and converting to an array of arrays.


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/title"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="20dp"
        android:text="@string/donate"
        android:textColor="#333"
        android:textSize="22sp" />

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginRight="35dp"
            android:layout_marginLeft="35dp"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/donation_info"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:clickable="true"
                android:focusable="true"
                android:linksClickable="true"
                android:lineSpacingExtra="2dp"
                android:textSize="14sp"
                android:text="@string/donation_explanation"
                android:textColor="#333"
                android:gravity="center_horizontal"
                android:layout_marginBottom="10dp"
                android:textColorLink="@color/UIPink" />

            <Button
                android:id="@+id/button3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="3dp"
                android:background="@color/UIOrange"
                android:onClick="baseDonation"
                android:padding="10dp"
                android:text="@string/donation_button"
                android:textColor="@color/Peach"
                android:layout_marginLeft="30dp"
                android:layout_marginRight="30dp"
                android:layout_marginBottom="30dp"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/inapp_info"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#333"
                android:lineSpacingExtra="2dp"
                android:gravity="center_horizontal"
                android:layout_marginBottom="10dp"
                android:textSize="14sp"
                android:text="@string/remove_ads_explanation" />

            <Button
                android:id="@+id/button10"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="3dp"
                android:background="@color/UIBlue"
                android:onClick="removeAds"
                android:padding="10dp"
                android:text="Remove Ads"
                android:layout_marginLeft="30dp"
                android:layout_marginRight="30dp"
                android:textColor="#000000"
                android:layout_marginBottom="5dp"
                android:textSize="14sp" />
        </LinearLayout>
    </ScrollView>

</LinearLayout>


text:
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package com.intellij.uiDesigner.actions;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.uiDesigner.FormEditingUtil;
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.designSurface.GuiEditor;
import com.intellij.uiDesigner.designSurface.InsertComponentProcessor;
import com.intellij.uiDesigner.lw.LwSplitPane;
import com.intellij.uiDesigner.palette.ComponentItem;
import com.intellij.uiDesigner.palette.Palette;
import com.intellij.uiDesigner.radComponents.*;
import com.intellij.uiDesigner.shared.XYLayoutManager;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;

/**
 * @author yole
 */
public class SurroundAction extends AbstractGuiEditorAction {
  private static final Logger LOG = Logger.getInstance(SurroundAction.class);

  private final String myComponentClass;

  public SurroundAction(String componentClass) {
    final String className = componentClass.substring(componentClass.lastIndexOf('.') + 1);
    getTemplatePresentation().setText(className);
    myComponentClass = componentClass;
  }

  @Override
  public void actionPerformed(final GuiEditor editor, final List<? extends RadComponent> input, final AnActionEvent e) {
    // the action is also reused as quickfix for NoScrollPaneInspection, so this code should be kept here
    List<RadComponent> selection = FormEditingUtil.remapToActionTargets(input);
    if (!editor.ensureEditable()) {
      return;
    }
    final RadContainer selectionParent = FormEditingUtil.getSelectionParent(selection);
    assert selectionParent != null;

    final Palette palette = Palette.getInstance(editor.getProject());
    final ComponentItem cItem = palette.getItem(myComponentClass);
    assert cItem != null : myComponentClass;
    CommandProcessor.getInstance().executeCommand(
      editor.getProject(),
      () -> {
        RadContainer newContainer = (RadContainer) InsertComponentProcessor.createInsertedComponent(editor, cItem);
        if (newContainer == null) {
          return;
        }

        if (cItem == palette.getPanelItem()) {
          if (selectionParent.getLayoutManager().isGrid()) {
            try {
              newContainer.setLayoutManager(LayoutManagerRegistry.createLayoutManager(selectionParent.getLayoutManager().getName()));
            }
            catch (Exception e1) {
              LOG.error(e1);
              return;
            }
          }
          else {
            newContainer.setLayoutManager(LayoutManagerRegistry.createDefaultGridLayoutManager(editor.getProject()));
          }
        }

        Rectangle rc = new Rectangle(0, 0, 1, 1);
        int minIndex = Integer.MAX_VALUE;
        if (selectionParent.getLayoutManager().isGrid()) {
          rc = FormEditingUtil.getSelectionBounds(selection);
        }
        else if (selectionParent.getLayoutManager().isIndexed()) {
          for(RadComponent c: selection) {
            minIndex = Math.min(minIndex, selectionParent.indexOfComponent(c));
          }
        }
        for(RadComponent c: selection) {
          selectionParent.removeComponent(c);
        }

        if (selectionParent.getLayoutManager().isGrid()) {
          final GridConstraints newConstraints = newContainer.getConstraints();
          newConstraints.setRow(rc.y);
          newConstraints.setColumn(rc.x);
          newConstraints.setRowSpan(rc.height);
          newConstraints.setColSpan(rc.width);
        }
        else if (selectionParent.getLayout() instanceof XYLayoutManager && selection.size() == 1) {
          newContainer.setBounds(selection.get(0).getBounds());
        }

        if (selection.size() == 1) {
          newContainer.setCustomLayoutConstraints(selection.get(0).getCustomLayoutConstraints());
        }
        if (minIndex != Integer.MAX_VALUE) {
          selectionParent.addComponent(newContainer, minIndex);
        }
        else {
          selectionParent.addComponent(newContainer);
        }

        if (newContainer instanceof RadTabbedPane) {
          // the first tab is created by RadTabbedPane itself
          assert newContainer.getComponentCount() == 1;
          newContainer = (RadContainer) newContainer.getComponent(0);
        }
        else if (newContainer instanceof RadSplitPane) {
          if (selection.size() > 2) {
            RadContainer panel = InsertComponentProcessor.createPanelComponent(editor);
            panel.setCustomLayoutConstraints(LwSplitPane.POSITION_LEFT);
            newContainer.addComponent(panel);
            newContainer = panel;
          }
          else {
            if (selection.size() > 0) {
              selection.get(0).setCustomLayoutConstraints(LwSplitPane.POSITION_LEFT);
            }
            if (selection.size() > 1) {
              selection.get(1).setCustomLayoutConstraints(LwSplitPane.POSITION_RIGHT);
            }
          }
        }

        // if surrounding a single control with JPanel, 1x1 grid in resulting container is sufficient
        // otherwise, copy column properties and row/col spans
        if (newContainer.getComponentClass().equals(JPanel.class) && selection.size() > 1) {
          if (selectionParent.getLayoutManager().isGrid()) {
            newContainer.getGridLayoutManager().copyGridSection(selectionParent, newContainer, rc);
          }
          else {
            // TODO[yole]: correctly handle surround from indexed
            newContainer.setLayout(new GridLayoutManager(rc.height, rc.width));
          }
        }

        for(RadComponent c: selection) {
          if (selectionParent.getLayoutManager().isGrid()) {
            if (selection.size() > 1) {
              c.getConstraints().setRow(c.getConstraints().getRow() - rc.y);
              c.getConstraints().setColumn(c.getConstraints().getColumn() - rc.x);
            }
            else {
              c.getConstraints().setRow(0);
              c.getConstraints().setColumn(0);
              c.getConstraints().setRowSpan(1);
              c.getConstraints().setColSpan(1);
            }
          }
          newContainer.addComponent(c);
        }
        editor.refreshAndSave(true);
      }, null, null);
  }

  @Override
  protected void update(@NotNull final GuiEditor editor, final ArrayList<? extends RadComponent> input, final AnActionEvent e) {
    List<RadComponent> selection = FormEditingUtil.remapToActionTargets(input);
    RadContainer selectionParent = FormEditingUtil.getSelectionParent(selection);
    Palette palette = Palette.getInstance(editor.getProject());
    e.getPresentation().setEnabled(palette.getItem(myComponentClass) != null &&
                                   (selectionParent != null &&
                                   ((!selectionParent.getLayoutManager().isGrid() && selection.size() == 1) ||
                                     isSelectionContiguous(selectionParent, selection)) &&
                                   canWrapSelection(selection)));
  }

  private boolean canWrapSelection(final List<? extends RadComponent> selection) {
    if (myComponentClass.equals(JScrollPane.class.getName())) {
      if (selection.size() > 1) return false;
      JComponent liveComponent = selection.get(0).getDelegee();
      return liveComponent instanceof Scrollable || liveComponent instanceof JPanel;
    }
    return true;
  }

  private static boolean isSelectionContiguous(RadContainer selectionParent,
                                               List<? extends RadComponent> selection) {
    if (!selectionParent.getLayoutManager().isGrid()) {
      return false;
    }
    Rectangle rc = FormEditingUtil.getSelectionBounds(selection);
    for(RadComponent c: selectionParent.getComponents()) {
      if (!selection.contains(c) &&
          constraintsIntersect(true, c.getConstraints(), rc) &&
          constraintsIntersect(false, c.getConstraints(), rc)) {
        return false;
      }
    }
    return true;
  }

  private static boolean constraintsIntersect(boolean horizontal,
                                              GridConstraints constraints,
                                              Rectangle rc) {
    int start = constraints.getCell(!horizontal);
    int end = start + constraints.getSpan(!horizontal) - 1;
    int otherStart = horizontal ? rc.x : rc.y;
    int otherEnd = otherStart + (horizontal ? rc.width : rc.height) - 1;
    return start <= otherEnd && otherStart <= end;
  }
}