text:
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_OBJECTS_SHARED_FUNCTION_INFO_H_
#define V8_OBJECTS_SHARED_FUNCTION_INFO_H_

#include "src/codegen/bailout-reason.h"
#include "src/objects/compressed-slots.h"
#include "src/objects/function-kind.h"
#include "src/objects/function-syntax-kind.h"
#include "src/objects/objects.h"
#include "src/objects/script.h"
#include "src/objects/slots.h"
#include "src/objects/smi.h"
#include "src/objects/struct.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
#include "torque-generated/field-offsets-tq.h"

// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"

namespace v8 {

namespace tracing {
class TracedValue;
}

namespace internal {

class AsmWasmData;
class BytecodeArray;
class CoverageInfo;
class DebugInfo;
class IsCompiledScope;
class WasmCapiFunctionData;
class WasmExportedFunctionData;
class WasmJSFunctionData;

// Data collected by the pre-parser storing information about scopes and inner
// functions.
//
// PreparseData Layout:
// +-------------------------------+
// | data_length | children_length |
// +-------------------------------+
// | Scope Byte Data ...           |
// | ...                           |
// +-------------------------------+
// | [Padding]                     |
// +-------------------------------+
// | Inner PreparseData 1          |
// +-------------------------------+
// | ...                           |
// +-------------------------------+
// | Inner PreparseData N          |
// +-------------------------------+
class PreparseData : public HeapObject {
 public:
  DECL_INT_ACCESSORS(data_length)
  DECL_INT_ACCESSORS(children_length)

  inline int inner_start_offset() const;
  inline ObjectSlot inner_data_start() const;

  inline byte get(int index) const;
  inline void set(int index, byte value);
  inline void copy_in(int index, const byte* buffer, int length);

  inline PreparseData get_child(int index) const;
  inline void set_child(int index, PreparseData value,
                        WriteBarrierMode mode = UPDATE_WRITE_BARRIER);

  // Clear uninitialized padding space.
  inline void clear_padding();

  DECL_CAST(PreparseData)
  DECL_PRINTER(PreparseData)
  DECL_VERIFIER(PreparseData)

  DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
                                TORQUE_GENERATED_PREPARSE_DATA_FIELDS)
  static const int kDataStartOffset = kSize;

  class BodyDescriptor;

  static int InnerOffset(int data_length) {
    return RoundUp(kDataStartOffset + data_length * kByteSize, kTaggedSize);
  }

  static int SizeFor(int data_length, int children_length) {
    return InnerOffset(data_length) + children_length * kTaggedSize;
  }

  OBJECT_CONSTRUCTORS(PreparseData, HeapObject);

 private:
  inline Object get_child_raw(int index) const;
};

// Abstract class representing extra data for an uncompiled function, which is
// not stored in the SharedFunctionInfo.
class UncompiledData : public HeapObject {
 public:
  DECL_ACCESSORS(inferred_name, String)
  DECL_INT32_ACCESSORS(start_position)
  DECL_INT32_ACCESSORS(end_position)

  DECL_CAST(UncompiledData)

  inline static void Initialize(
      UncompiledData data, String inferred_name, int start_position,
      int end_position,
      std::function<void(HeapObject object, ObjectSlot slot, HeapObject target)>
          gc_notify_updated_slot =
              [](HeapObject object, ObjectSlot slot, HeapObject target) {});

  // Layout description.
#define UNCOMPILED_DATA_FIELDS(V)                                         \
  V(kStartOfStrongFieldsOffset, 0)                                        \
  V(kInferredNameOffset, kTaggedSize)                                     \
  V(kEndOfStrongFieldsOffset, 0)                                          \
  /* Raw data fields. */                                                  \
  V(kStartPositionOffset, kInt32Size)                                     \
  V(kEndPositionOffset, kInt32Size)                                       \
  V(kOptionalPaddingOffset, POINTER_SIZE_PADDING(kOptionalPaddingOffset)) \
  /* Header size. */                                                      \
  V(kSize, 0)

  DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, UNCOMPILED_DATA_FIELDS)
#undef UNCOMPILED_DATA_FIELDS

  using BodyDescriptor = FixedBodyDescriptor<kStartOfStrongFieldsOffset,
                                             kEndOfStrongFieldsOffset, kSize>;

  // Clear uninitialized padding space.
  inline void clear_padding();

  OBJECT_CONSTRUCTORS(UncompiledData, HeapObject);
};

// Class representing data for an uncompiled function that does not have any
// data from the pre-parser, either because it's a leaf function or because the
// pre-parser bailed out.
class UncompiledDataWithoutPreparseData : public UncompiledData {
 public:
  DECL_CAST(UncompiledDataWithoutPreparseData)
  DECL_PRINTER(UncompiledDataWithoutPreparseData)
  DECL_VERIFIER(UncompiledDataWithoutPreparseData)

  static const int kSize = UncompiledData::kSize;

  // No extra fields compared to UncompiledData.
  using BodyDescriptor = UncompiledData::BodyDescriptor;

  OBJECT_CONSTRUCTORS(UncompiledDataWithoutPreparseData, UncompiledData);
};

// Class representing data for an uncompiled function that has pre-parsed scope
// data.
class UncompiledDataWithPreparseData : public UncompiledData {
 public:
  DECL_ACCESSORS(preparse_data, PreparseData)

  DECL_CAST(UncompiledDataWithPreparseData)
  DECL_PRINTER(UncompiledDataWithPreparseData)
  DECL_VERIFIER(UncompiledDataWithPreparseData)

  inline static void Initialize(
      UncompiledDataWithPreparseData data, String inferred_name,
      int start_position, int end_position, PreparseData scope_data,
      std::function<void(HeapObject object, ObjectSlot slot, HeapObject target)>
          gc_notify_updated_slot =
              [](HeapObject object, ObjectSlot slot, HeapObject target) {});

  // Layout description.

#define UNCOMPILED_DATA_WITH_PREPARSE_DATA_FIELDS(V) \
  V(kStartOfStrongFieldsOffset, 0)                   \
  V(kPreparseDataOffset, kTaggedSize)                \
  V(kEndOfStrongFieldsOffset, 0)                     \
  /* Total size. */                                  \
  V(kSize, 0)

  DEFINE_FIELD_OFFSET_CONSTANTS(UncompiledData::kSize,
                                UNCOMPILED_DATA_WITH_PREPARSE_DATA_FIELDS)
#undef UNCOMPILED_DATA_WITH_PREPARSE_DATA_FIELDS

  // Make sure the size is aligned
  STATIC_ASSERT(IsAligned(kSize, kTaggedSize));

  using BodyDescriptor = SubclassBodyDescriptor<
      UncompiledData::BodyDescriptor,
      FixedBodyDescriptor<kStartOfStrongFieldsOffset, kEndOfStrongFieldsOffset,
                          kSize>>;

  OBJECT_CONSTRUCTORS(UncompiledDataWithPreparseData, UncompiledData);
};

class InterpreterData : public Struct {
 public:
  DECL_ACCESSORS(bytecode_array, BytecodeArray)
  DECL_ACCESSORS(interpreter_trampoline, Code)

  DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
                                TORQUE_GENERATED_INTERPRETER_DATA_FIELDS)

  DECL_CAST(InterpreterData)
  DECL_PRINTER(InterpreterData)
  DECL_VERIFIER(InterpreterData)

  OBJECT_CONSTRUCTORS(InterpreterData, Struct);
};

// SharedFunctionInfo describes the JSFunction information that can be
// shared by multiple instances of the function.
class SharedFunctionInfo : public HeapObject {
 public:
  NEVER_READ_ONLY_SPACE

  V8_EXPORT_PRIVATE static constexpr Object const kNoSharedNameSentinel =
      Smi::kZero;

  // [name]: Returns shared name if it exists or an empty string otherwise.
  inline String Name() const;
  inline void SetName(String name);

  // Get the code object which represents the execution of this function.
  V8_EXPORT_PRIVATE Code GetCode() const;

  // Get the abstract code associated with the function, which will either be
  // a Code object or a BytecodeArray.
  inline AbstractCode abstract_code();

  // Tells whether or not this shared function info is interpreted.
  //
  // Note: function->IsInterpreted() does not necessarily return the same value
  // as function->shared()->IsInterpreted() because the closure might have been
  // optimized.
  inline bool IsInterpreted() const;

  // Set up the link between shared function info and the script. The shared
  // function info is added to the list on the script.
  V8_EXPORT_PRIVATE static void SetScript(
      Handle<SharedFunctionInfo> shared, Handle<Object> script_object,
      int function_literal_id, bool reset_preparsed_scope_data = true);

  // Layout description of the optimized code map.
  static const int kEntriesStart = 0;
  static const int kContextOffset = 0;
  static const int kCachedCodeOffset = 1;
  static const int kEntryLength = 2;
  static const int kInitialLength = kEntriesStart + kEntryLength;

  static const int kNotFound = -1;

  // [scope_info]: Scope info.
  DECL_ACCESSORS(scope_info, ScopeInfo)

  // Set scope_info without moving the existing name onto the ScopeInfo.
  inline void set_raw_scope_info(ScopeInfo scope_info,
                                 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);

  // End position of this function in the script source.
  V8_EXPORT_PRIVATE int EndPosition() const;

  // Start position of this function in the script source.
  V8_EXPORT_PRIVATE int StartPosition() const;

  // Set the start and end position of this function in the script source.
  // Updates the scope info if available.
  V8_EXPORT_PRIVATE void SetPosition(int start_position, int end_position);

  // [outer scope info | feedback metadata] Shared storage for outer scope info
  // (on uncompiled functions) and feedback metadata (on compiled functions).
  DECL_ACCESSORS(raw_outer_scope_info_or_feedback_metadata, HeapObject)

  // Get the outer scope info whether this function is compiled or not.
  inline bool HasOuterScopeInfo() const;
  inline ScopeInfo GetOuterScopeInfo() const;

  // [feedback metadata] Metadata template for feedback vectors of instances of
  // this function.
  inline bool HasFeedbackMetadata() const;
  DECL_ACCESSORS(feedback_metadata, FeedbackMetadata)

  // Returns if this function has been compiled yet. Note: with bytecode
  // flushing, any GC after this call is made could cause the function
  // to become uncompiled. If you need to ensure the function remains compiled
  // for some period of time, use IsCompiledScope instead.
  inline bool is_compiled() const;

  // Returns an IsCompiledScope which reports whether the function is compiled,
  // and if compiled, will avoid the function becoming uncompiled while it is
  // held.
  inline IsCompiledScope is_compiled_scope() const;

  // [length]: The function length - usually the number of declared parameters.
  // Use up to 2^16-2 parameters (16 bits of values, where one is reserved for
  // kDontAdaptArgumentsSentinel). The value is only reliable when the function
  // has been compiled.
  inline uint16_t length() const;
  inline void set_length(int value);

  // [internal formal parameter count]: The declared number of parameters.
  // For subclass constructors, also includes new.target.
  // The size of function's frame is internal_formal_parameter_count + 1.
  DECL_UINT16_ACCESSORS(internal_formal_parameter_count)

  // Set the formal parameter count so the function code will be
  // called without using argument adaptor frames.
  inline void DontAdaptArguments();

  // [expected_nof_properties]: Expected number of properties for the
  // function. The value is only reliable when the function has been compiled.
  DECL_UINT16_ACCESSORS(expected_nof_properties)

  // [function_literal_id] - uniquely identifies the FunctionLiteral this
  // SharedFunctionInfo represents within its script, or -1 if this
  // SharedFunctionInfo object doesn't correspond to a parsed FunctionLiteral.
  DECL_INT32_ACCESSORS(function_literal_id)

#if V8_SFI_HAS_UNIQUE_ID
  // [unique_id] - For --trace-maps purposes, an identifier that's persistent
  // even if the GC moves this SharedFunctionInfo.
  DECL_INT_ACCESSORS(unique_id)
#endif

  // [function data]: This field holds some additional data for function.
  // Currently it has one of:
  //  - a FunctionTemplateInfo to make benefit the API [IsApiFunction()].
  //  - a BytecodeArray for the interpreter [HasBytecodeArray()].
  //  - a InterpreterData with the BytecodeArray and a copy of the
  //    interpreter trampoline [HasInterpreterData()]
  //  - an AsmWasmData with Asm->Wasm conversion [HasAsmWasmData()].
  //  - a Smi containing the builtin id [HasBuiltinId()]
  //  - a UncompiledDataWithoutPreparseData for lazy compilation
  //    [HasUncompiledDataWithoutPreparseData()]
  //  - a UncompiledDataWithPreparseData for lazy compilation
  //    [HasUncompiledDataWithPreparseData()]
  //  - a WasmExportedFunctionData for Wasm [HasWasmExportedFunctionData()]
  DECL_ACCESSORS(function_data, Object)

  inline bool IsApiFunction() const;
  inline bool is_class_constructor() const;
  inline FunctionTemplateInfo get_api_func_data();
  inline void set_api_func_data(FunctionTemplateInfo data);
  inline bool HasBytecodeArray() const;
  inline BytecodeArray GetBytecodeArray() const;
  inline void set_bytecode_array(BytecodeArray bytecode);
  inline Code InterpreterTrampoline() const;
  inline bool HasInterpreterData() const;
  inline InterpreterData interpreter_data() const;
  inline void set_interpreter_data(InterpreterData interpreter_data);
  inline BytecodeArray GetDebugBytecodeArray() const;
  inline void SetDebugBytecodeArray(BytecodeArray bytecode);
  inline bool HasAsmWasmData() const;
  inline AsmWasmData asm_wasm_data() const;
  inline void set_asm_wasm_data(AsmWasmData data);

  // builtin_id corresponds to the auto-generated Builtins::Name id.
  inline bool HasBuiltinId() const;
  inline int builtin_id() const;
  inline void set_builtin_id(int builtin_id);
  inline bool HasUncompiledData() const;
  inline UncompiledData uncompiled_data() const;
  inline void set_uncompiled_data(UncompiledData data);
  inline bool HasUncompiledDataWithPreparseData() const;
  inline UncompiledDataWithPreparseData uncompiled_data_with_preparse_data()
      const;
  inline void set_uncompiled_data_with_preparse_data(
      UncompiledDataWithPreparseData data);
  inline bool HasUncompiledDataWithoutPreparseData() const;
  inline bool HasWasmExportedFunctionData() const;
  WasmExportedFunctionData wasm_exported_function_data() const;
  inline bool HasWasmJSFunctionData() const;
  WasmJSFunctionData wasm_js_function_data() const;
  inline bool HasWasmCapiFunctionData() const;
  WasmCapiFunctionData wasm_capi_function_data() const;

  // Clear out pre-parsed scope data from UncompiledDataWithPreparseData,
  // turning it into UncompiledDataWithoutPreparseData.
  inline void ClearPreparseData();

  // The inferred_name is inferred from variable or property assignment of this
  // function. It is used to facilitate debugging and profiling of JavaScript
  // code written in OO style, where almost all functions are anonymous but are
  // assigned to object properties.
  inline bool HasInferredName();
  inline String inferred_name();

  // Break infos are contained in DebugInfo, this is a convenience method
  // to simplify access.
  V8_EXPORT_PRIVATE bool HasBreakInfo() const;
  bool BreakAtEntry() const;

  // Coverage infos are contained in DebugInfo, this is a convenience method
  // to simplify access.
  bool HasCoverageInfo() const;
  CoverageInfo GetCoverageInfo() const;

  // The function's name if it is non-empty, otherwise the inferred name.
  String DebugName();

  // Used for flags such as --turbo-filter.
  bool PassesFilter(const char* raw_filter);

  // [script_or_debug_info]: One of:
  //  - Script from which the function originates.
  //  - a DebugInfo which holds the actual script [HasDebugInfo()].
  DECL_ACCESSORS(script_or_debug_info, Object)

  inline Object script() const;
  inline void set_script(Object script);

  // The function is subject to debugging if a debug info is attached.
  inline bool HasDebugInfo() const;
  inline DebugInfo GetDebugInfo() const;
  inline void SetDebugInfo(DebugInfo debug_info);

  // The offset of the 'function' token in the script source relative to the
  // start position. Can return kFunctionTokenOutOfRange if offset doesn't
  // fit in 16 bits.
  DECL_UINT16_ACCESSORS(raw_function_token_offset)

  // The position of the 'function' token in the script source. Can return
  // kNoSourcePosition if raw_function_token_offset() returns
  // kFunctionTokenOutOfRange.
  inline int function_token_position() const;

  // Returns true if the function has shared name.
  inline bool HasSharedName() const;

  // [flags] Bit field containing various flags about the function.
  DECL_INT32_ACCESSORS(flags)

  // Is this function a top-level function (scripts, evals).
  DECL_BOOLEAN_ACCESSORS(is_toplevel)

  // Indicates if this function can be lazy compiled.
  DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation)

  // Indicates the language mode.
  inline LanguageMode language_mode() const;
  inline void set_language_mode(LanguageMode language_mode);

  // How the function appears in source text.
  DECL_PRIMITIVE_ACCESSORS(syntax_kind, FunctionSyntaxKind)

  // Indicates whether the source is implicitly wrapped in a function.
  inline bool is_wrapped() const;

  // True if the function has any duplicated parameter names.
  DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters)

  // Indicates whether the function is a native function.
  // These needs special treatment in .call and .apply since
  // null passed as the receiver should not be translated to the
  // global object.
  DECL_BOOLEAN_ACCESSORS(native)

  // Indicates that asm->wasm conversion failed and should not be re-attempted.
  DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken)

  // Indicates that the function was created by the Function function.
  // Though it's anonymous, toString should treat it as if it had the name
  // "anonymous".  We don't set the name itself so that the system does not
  // see a binding for it.
  DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous)

  // Indicates that the function represented by the shared function info was
  // classed as an immediately invoked function execution (IIFE) function and
  // is only executed once.
  DECL_BOOLEAN_ACCESSORS(is_oneshot_iife)

  // Whether or not the number of expected properties may change.
  DECL_BOOLEAN_ACCESSORS(are_properties_final)

  // Indicates that the function represented by the shared function info
  // cannot observe the actual parameters passed at a call site, which
  // means the function doesn't use the arguments object, doesn't use
  // rest parameters, and is also in strict mode (meaning that there's
  // no way to get to the actual arguments via the non-standard "arguments"
  // accessor on sloppy mode functions). This can be used to speed up calls
  // to this function even in the presence of arguments mismatch.
  // See http://bit.ly/v8-faster-calls-with-arguments-mismatch for more
  // information on this.
  DECL_BOOLEAN_ACCESSORS(is_safe_to_skip_arguments_adaptor)

  // Indicates that the function has been reported for binary code coverage.
  DECL_BOOLEAN_ACCESSORS(has_reported_binary_coverage)

  inline FunctionKind kind() const;

  // Defines the index in a native context of closure's map instantiated using
  // this shared function info.
  DECL_INT_ACCESSORS(function_map_index)

  // Clear uninitialized padding space. This ensures that the snapshot content
  // is deterministic.
  inline void clear_padding();

  // Recalculates the |map_index| value after modifications of this shared info.
  inline void UpdateFunctionMapIndex();

  // Indicates whether optimizations have been disabled for this shared function
  // info. If we cannot optimize the function we disable optimization to avoid
  // spending time attempting to optimize it again.
  inline bool optimization_disabled() const;

  // The reason why optimization was disabled.
  inline BailoutReason disable_optimization_reason() const;

  // Disable (further) attempted optimization of all functions sharing this
  // shared function info.
  void DisableOptimization(BailoutReason reason);

  // This class constructor needs to call out to an instance fields
  // initializer. This flag is set when creating the
  // SharedFunctionInfo as a reminder to emit the initializer call
  // when generating code later.
  DECL_BOOLEAN_ACCESSORS(requires_instance_members_initializer)

  // [source code]: Source code for the function.
  bool HasSourceCode() const;
  static Handle<Object> GetSourceCode(Handle<SharedFunctionInfo> shared);
  static Handle<Object> GetSourceCodeHarmony(Handle<SharedFunctionInfo> shared);

  // Tells whether this function should be subject to debugging, e.g. for
  // - scope inspection
  // - internal break points
  // - coverage and type profile
  // - error stack trace
  inline bool IsSubjectToDebugging();

  // Whether this function is defined in user-provided JavaScript code.
  inline bool IsUserJavaScript();

  // True if one can flush compiled code from this function, in such a way that
  // it can later be re-compiled.
  inline bool CanDiscardCompiled() const;

  // Flush compiled data from this function, setting it back to CompileLazy and
  // clearing any compiled metadata.
  V8_EXPORT_PRIVATE static void DiscardCompiled(
      Isolate* isolate, Handle<SharedFunctionInfo> shared_info);

  // Discard the compiled metadata. If called during GC then
  // |gc_notify_updated_slot| should be used to record any slot updates.
  void DiscardCompiledMetadata(
      Isolate* isolate,
      std::function<void(HeapObject object, ObjectSlot slot, HeapObject target)>
          gc_notify_updated_slot =
              [](HeapObject object, ObjectSlot slot, HeapObject target) {});

  // Returns true if the function has old bytecode that could be flushed. This
  // function shouldn't access any flags as it is used by concurrent marker.
  // Hence it takes the mode as an argument.
  inline bool ShouldFlushBytecode(BytecodeFlushMode mode);

  // Check whether or not this function is inlineable.
  bool IsInlineable();

  // Source size of this function.
  int SourceSize();

  // Returns `false` if formal parameters include rest parameters, optional
  // parameters, or destructuring parameters.
  // TODO(caitp): make this a flag set during parsing
  inline bool has_simple_parameters();

  // Initialize a SharedFunctionInfo from a parsed function literal.
  static void InitFromFunctionLiteral(Handle<SharedFunctionInfo> shared_info,
                                      FunctionLiteral* lit, bool is_toplevel);

  // Updates the expected number of properties based on estimate from parser.
  void UpdateExpectedNofPropertiesFromEstimate(FunctionLiteral* literal);
  void UpdateAndFinalizeExpectedNofPropertiesFromEstimate(
      FunctionLiteral* literal);

  // Sets the FunctionTokenOffset field based on the given token position and
  // start position.
  void SetFunctionTokenPosition(int function_token_position,
                                int start_position);

  static void EnsureSourcePositionsAvailable(
      Isolate* isolate, Handle<SharedFunctionInfo> shared_info);

  bool AreSourcePositionsAvailable() const;

  // Hash based on function literal id and script id.
  V8_EXPORT_PRIVATE uint32_t Hash();

  inline bool construct_as_builtin() const;

  // Determines and sets the ConstructAsBuiltinBit in |flags|, based on the
  // |function_data|. Must be called when creating the SFI after other fields
  // are initialized. The ConstructAsBuiltinBit determines whether
  // JSBuiltinsConstructStub or JSConstructStubGeneric should be called to
  // construct this function.
  inline void CalculateConstructAsBuiltin();

  // Dispatched behavior.
  DECL_PRINTER(SharedFunctionInfo)
  DECL_VERIFIER(SharedFunctionInfo)
#ifdef OBJECT_PRINT
  void PrintSourceCode(std::ostream& os);
#endif

  // Returns the SharedFunctionInfo in a format tracing can support.
  std::unique_ptr<v8::tracing::TracedValue> ToTracedValue(
      FunctionLiteral* literal);

  // The tracing scope for SharedFunctionInfo objects.
  static const char* kTraceScope;

  // Returns the unique TraceID for this SharedFunctionInfo (within the
  // kTraceScope, works only for functions that have a Script and start/end
  // position).
  uint64_t TraceID(FunctionLiteral* literal = nullptr) const;

  // Returns the unique trace ID reference for this SharedFunctionInfo
  // (based on the |TraceID()| above).
  std::unique_ptr<v8::tracing::TracedValue> TraceIDRef() const;

  // Iterate over all shared function infos in a given script.
  class ScriptIterator {
   public:
    V8_EXPORT_PRIVATE ScriptIterator(Isolate* isolate, Script script);
    explicit ScriptIterator(Handle<WeakFixedArray> shared_function_infos);
    V8_EXPORT_PRIVATE SharedFunctionInfo Next();
    int CurrentIndex() const { return index_ - 1; }

    // Reset the iterator to run on |script|.
    void Reset(Isolate* isolate, Script script);

   private:
    Handle<WeakFixedArray> shared_function_infos_;
    int index_;
    DISALLOW_COPY_AND_ASSIGN(ScriptIterator);
  };

  DECL_CAST(SharedFunctionInfo)

  // Constants.
  static const uint16_t kDontAdaptArgumentsSentinel = static_cast<uint16_t>(-1);

  static const int kMaximumFunctionTokenOffset = kMaxUInt16 - 1;
  static const uint16_t kFunctionTokenOutOfRange = static_cast<uint16_t>(-1);
  STATIC_ASSERT(kMaximumFunctionTokenOffset + 1 == kFunctionTokenOutOfRange);

  DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
                                TORQUE_GENERATED_SHARED_FUNCTION_INFO_FIELDS)

  static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize);

  class BodyDescriptor;

// Bit positions in |flags|.
#define FLAGS_BIT_FIELDS(V, _)                               \
  /* Have FunctionKind first to make it cheaper to access */ \
  V(FunctionKindBits, FunctionKind, 5, _)                    \
  V(IsNativeBit, bool, 1, _)                                 \
  V(IsStrictBit, bool, 1, _)                                 \
  V(FunctionSyntaxKindBits, FunctionSyntaxKind, 3, _)        \
  V(IsClassConstructorBit, bool, 1, _)                       \
  V(HasDuplicateParametersBit, bool, 1, _)                   \
  V(AllowLazyCompilationBit, bool, 1, _)                     \
  V(NeedsHomeObjectBit, bool, 1, _)                          \
  V(IsAsmWasmBrokenBit, bool, 1, _)                          \
  V(FunctionMapIndexBits, int, 5, _)                         \
  V(DisabledOptimizationReasonBits, BailoutReason, 4, _)     \
  V(RequiresInstanceMembersInitializer, bool, 1, _)          \
  V(ConstructAsBuiltinBit, bool, 1, _)                       \
  V(NameShouldPrintAsAnonymousBit, bool, 1, _)               \
  V(HasReportedBinaryCoverageBit, bool, 1, _)                \
  V(IsTopLevelBit, bool, 1, _)                               \
  V(IsOneshotIIFEOrPropertiesAreFinalBit, bool, 1, _)        \
  V(IsSafeToSkipArgumentsAdaptorBit, bool, 1, _)
  DEFINE_BIT_FIELDS(FLAGS_BIT_FIELDS)
#undef FLAGS_BIT_FIELDS

  // Bailout reasons must fit in the DisabledOptimizationReason bitfield.
  STATIC_ASSERT(BailoutReason::kLastErrorMessage <=
                DisabledOptimizationReasonBits::kMax);

  STATIC_ASSERT(kLastFunctionKind <= FunctionKindBits::kMax);
  STATIC_ASSERT(FunctionSyntaxKind::kLastFunctionSyntaxKind <=
                FunctionSyntaxKindBits::kMax);

  // Indicates that this function uses a super property (or an eval that may
  // use a super property).
  // This is needed to set up the [[HomeObject]] on the function instance.
  inline bool needs_home_object() const;

 private:
  // [name_or_scope_info]: Function name string, kNoSharedNameSentinel or
  // ScopeInfo.
  DECL_ACCESSORS(name_or_scope_info, Object)

  // [outer scope info] The outer scope info, needed to lazily parse this
  // function.
  DECL_ACCESSORS(outer_scope_info, HeapObject)

  // [is_oneshot_iife_or_properties_are_final]: This bit is used to track
  // two mutually exclusive cases. Either this SharedFunctionInfo is
  // a oneshot_iife or we have finished parsing its properties. These cases
  // are mutually exclusive because the properties final bit is only used by
  // class constructors to handle lazily parsed properties and class
  // constructors can never be oneshot iifes.
  DECL_BOOLEAN_ACCESSORS(is_oneshot_iife_or_properties_are_final)

  inline void set_kind(FunctionKind kind);

  inline void set_needs_home_object(bool value);

  inline uint16_t get_property_estimate_from_literal(FunctionLiteral* literal);

  friend class Factory;
  friend class V8HeapExplorer;
  FRIEND_TEST(PreParserTest, LazyFunctionLength);

  OBJECT_CONSTRUCTORS(SharedFunctionInfo, HeapObject);
};

// Printing support.
struct SourceCodeOf {
  explicit SourceCodeOf(SharedFunctionInfo v, int max = -1)
      : value(v), max_length(max) {}
  const SharedFunctionInfo value;
  int max_length;
};

// IsCompiledScope enables a caller to check if a function is compiled, and
// ensure it remains compiled (i.e., doesn't have it's bytecode flushed) while
// the scope is retained.
class IsCompiledScope {
 public:
  inline IsCompiledScope(const SharedFunctionInfo shared, Isolate* isolate);
  inline IsCompiledScope() : retain_bytecode_(), is_compiled_(false) {}

  inline bool is_compiled() const { return is_compiled_; }

 private:
  MaybeHandle<BytecodeArray> retain_bytecode_;
  bool is_compiled_;
};

std::ostream& operator<<(std::ostream& os, const SourceCodeOf& v);

}  // namespace internal
}  // namespace v8

#include "src/objects/object-macros-undef.h"

#endif  // V8_OBJECTS_SHARED_FUNCTION_INFO_H_


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:background="#ffffff"
    android:orientation="vertical">

    <org.ayo.view.widget.WheelView
        android:id="@+id/main_wv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <Button
        android:id="@+id/main_show_dialog_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="8dp"
        android:text="show WheelView in Dialog!" />

</LinearLayout>

redpajama_set_name: RedPajamaGithub


text:
package net.zsygfddsd.qujing.base.module.base;

import com.trello.rxlifecycle.components.support.RxFragment;

/**
 * Created by mac on 16/6/11.
 */
public class BaseContract {

    public interface IBaseView<T extends IBasePresenter> {

        void setPresenter(T presenter);

        RxFragment getRxView();

    }

    public interface IBasePresenter {

        void start();

        void destroy();

    }

}


text:
layout: post
title: "A program : Lattice points in a circle"
date: 2015-01-20 15:11:46 +0530
comments: true
categories:
---

We now give a program (i.e., a function) that, given a natural number $n$, lists all points in the plane with co-ordinates natural numbers, which are contained in the circle of radius $n$. This illustrates how we can implement a combination of nested loops and conditions using _map_, _flatMap_ and _filter_.

We first define a function $leq$, denoting less than or equal to, for natural number. We have reserved $\leq$ for something nicer. This is a recursive definition.

```haskell
_leq_ : ℕ → ℕ → Bool
zero leq _ = true
(succ n) leq zero = false
(succ n) leq (succ m) = n leq m
```

We can now construct the function we promised. For each $a \in \mathbb{N}$, we can define a function associating to it a list by filtering $b\in \mathbb{N}$ by requiring the pair $(a , b)$ to lie in the circle, and then map to the pair $(a, b)$. We flatMap using this list-valued function.

```haskell
points : ℕ → List (ℕ × ℕ)
points n = (upto (succ n)) flatMap (λ a → ((upto (succ n)) filter (λ b → ((a * a) + (b * b)) leq (n * n)points )) map (λ b → [ a , b ]))
```

We have used _map_, _flatMap_ and _filter_ to replace nested loops and control statements (_if_ in this case) in older programming languages. In imperative code we would have started with an empty list, used a loop for $a$, an inner one for $b$ and added to the list pairs that satisfy the condition of lying in the circle.


text:
'use strict';

module.exports = {
	'githubAuth': {
		'clientID': process.env.GITHUB_KEY,
		'clientSecret': process.env.GITHUB_SECRET,
		'callbackURL': process.env.APP_URL + 'auth/github/callback'
	},
	'facebookAuth' : {
        'clientID'      : '246983182331445', // your App ID
        'clientSecret'  : 'dfae31ddd89b5c2f68196999b686d94a', // your App Secret
        'callbackURL'   : 'https://restaurant-reservation.herokuapp.com/auth/facebook/callback'
    }
};


text:
             {{ site.name }}

            {% for nav in site.navs %}

                {{ nav.label }}

            {% endfor %}


text:
var fs = require("fs");
var path = require("path");
var rootDirectorys = require("./root");
var checkPermission = require("./checkPermission");
function infos({ files = rootDirectorys, folder = "." }) {
    return new Promise(function (ok, oh) {
        if (!files.length) return ok([]);
        var results = [];
        var result_count = 0;
        function resolve(fileInfo, cx) {
            results[cx] = fileInfo;
            result_count++;
            if (result_count >= files.length) {
                ok(results);
            }
        }
        files.map(function (pathname, cx) {
            var name = pathname;
            pathname = path.join(folder, pathname);
            if (!checkPermission(pathname)) {
                return resolve({
                    name,
                    pathname,
                    access: false
                }, cx);
            }
            fs.exists(pathname, function (exists) {
                if (!exists) {
                    return resolve({
                        name,
                        pathname,
                        exists
                    }, cx);
                }
                fs.stat(pathname, function (error, stats) {
                    if (error) {
                        resolve({
                            name,
                            pathname,
                            error
                        }, cx);
                    } else {
                        var result = {
                            name,
                            pathname,
                            atimeMs: stats.atimeMs,
                            ctimeMs: stats.ctimeMs,
                            mtimeMs: stats.ctimeMs,
                            birthtimeMs: stats.birthtimeMs,
                            isFolder: stats.isDirectory(),
                            isFile: stats.isFile(),
                            size: stats.size
                        };
                        if (result.isFolder) {
                            fs.readdir(pathname, function (error, children) {
                                result.children = error || children;
                                resolve(result, cx);
                            });
                        } else {
                            resolve(result, cx);
                        }
                    }
                })
            });
        });
    });
}
module.exports = infos;


text:
name: "\U0001F389 Feature request"
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

If you have new ideas about sbt or an open-ended discussion, please use https://github.com/sbt/sbt/discussions instead of posting them to the issue tracker, which we use to track bugs and (internal) todo list.

Please note that sbt is mostly maintained by community effort, so one of the questions that we'd ask might be "would like to contribute it if we help you where the relevant code is".


text:
<?php
/** @noinspection PhpDocSignatureInspection */

namespace App\Tests\Functional\Controller\Action\SignUp\User;

use App\Services\Mailer;
use App\Services\UserService;
use App\Tests\Factory\PostmarkExceptionFactory;
use Mockery\MockInterface;
use Postmark\Models\PostmarkException;
use App\Controller\Action\SignUp\User\ConfirmController;
use App\Tests\Factory\HttpResponseFactory;
use App\Tests\Factory\PostmarkHttpResponseFactory;
use Symfony\Component\HttpFoundation\RedirectResponse;
use App\Tests\Functional\Controller\AbstractControllerTest;
use App\Tests\Services\HttpMockHandler;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\Routing\RouterInterface;

class ConfirmControllerTest extends AbstractControllerTest
{
    const EMAIL = 'user@example.com';
    const CONFIRMATION_TOKEN = 'confirmation-token-here';
    const EXPECTED_REDIRECT_URL = '/signup/confirm/'. self::EMAIL .'/';

    /**
     * @var ConfirmController
     */
    private $confirmController;

    /**
     * @var HttpMockHandler
     */
    private $httpMockHandler;

    /**
     * {@inheritdoc}
     */
    protected function setUp()
    {
        parent::setUp();

        $this->confirmController = self::$container->get(ConfirmController::class);
        $this->httpMockHandler = self::$container->get(HttpMockHandler::class);
    }

    public function testResendActionPostRequest()
    {
        $this->httpMockHandler->appendFixtures([
            HttpResponseFactory::createSuccessResponse(),
            HttpResponseFactory::createJsonResponse(self::CONFIRMATION_TOKEN),
            PostmarkHttpResponseFactory::createSuccessResponse(),
        ]);

        $this->client->request(
            'POST',
            $this->router->generate('action_sign_up_user_confirm_resend', [
                'email' => self::EMAIL,
            ])
        );

        /* @var RedirectResponse $response */
        $response = $this->client->getResponse();

        $this->assertEquals(
            self::EXPECTED_REDIRECT_URL,
            $response->getTargetUrl()
        );
    }

    public function testResendActionUserDoesNotExist()
    {
        $flashBag = self::$container->get(FlashBagInterface::class);

        $this->httpMockHandler->appendFixtures([
            HttpResponseFactory::createNotFoundResponse(),
        ]);

        /* @var RedirectResponse $response */
        $response = $this->confirmController->resendAction(self::EMAIL);

        $this->assertInstanceOf(RedirectResponse::class, $response);
        $this->assertEquals(self::EXPECTED_REDIRECT_URL, $response->getTargetUrl());
        $this->assertEquals(
            [
                ConfirmController::FLASH_BAG_TOKEN_RESEND_ERROR_KEY => [
                    ConfirmController::FLASH_BAG_TOKEN_RESEND_ERROR_MESSAGE_USER_INVALID,
                ],
            ],
            $flashBag->peekAll()
        );
    }

    public function testResendActionInvalidAdminCredentials()
    {
        $flashBag = self::$container->get(FlashBagInterface::class);

        $this->httpMockHandler->appendFixtures([
            HttpResponseFactory::createForbiddenResponse(),
        ]);

        /* @var MockInterface|Mailer $mailer */
        $mailer = \Mockery::mock(Mailer::class);
        $mailer
            ->shouldReceive('sendInvalidAdminCredentialsNotification')
            ->withArgs([[
                'call' => 'UserService::exists()',
                'args' => [
                    'email' => self::EMAIL,
                ]
            ]]);

        $confirmController = new ConfirmController(
            self::$container->get(RouterInterface::class),
            self::$container->get(UserService::class),
            self::$container->get(FlashBagInterface::class),
            $mailer
        );

        /* @var RedirectResponse $response */
        $response = $confirmController->resendAction(self::EMAIL);

        $this->assertInstanceOf(RedirectResponse::class, $response);
        $this->assertEquals(self::EXPECTED_REDIRECT_URL, $response->getTargetUrl());
        $this->assertEquals(
            [
                ConfirmController::FLASH_BAG_TOKEN_RESEND_ERROR_KEY => [
                    ConfirmController::FLASH_BAG_TOKEN_RESEND_ERROR_MESSAGE_CORE_APP_ADMIN_CREDENTIALS_INVALID,
                ],
            ],
            $flashBag->peekAll()
        );
    }

    /**
     * @dataProvider resendActionSendConfirmationTokenFailureDataProvider
     */
    public function testResendActionSendConfirmationTokenFailure(
        PostmarkException $postmarkException,
        array $expectedFlashBagValues
    ) {
        $flashBag = self::$container->get(FlashBagInterface::class);

        $this->httpMockHandler->appendFixtures([
            HttpResponseFactory::createSuccessResponse(),
            HttpResponseFactory::createJsonResponse(self::CONFIRMATION_TOKEN),
        ]);

        /* @var MockInterface|Mailer $mailer */
        $mailer = \Mockery::mock(Mailer::class);
        $mailer
            ->shouldReceive('sendSignUpConfirmationToken')
            ->withArgs([
                self::EMAIL,
                self::CONFIRMATION_TOKEN,
            ])
            ->andThrow($postmarkException);

        $confirmController = new ConfirmController(
            self::$container->get(RouterInterface::class),
            self::$container->get(UserService::class),
            self::$container->get(FlashBagInterface::class),
            $mailer
        );

        /* @var RedirectResponse $response */
        $response = $confirmController->resendAction(self::EMAIL);

        $this->assertInstanceOf(RedirectResponse::class, $response);
        $this->assertEquals(self::EXPECTED_REDIRECT_URL, $response->getTargetUrl());
        $this->assertEquals($expectedFlashBagValues, $flashBag->peekAll());
    }

    public function resendActionSendConfirmationTokenFailureDataProvider(): array
    {
        return [
            'postmark not allowed to send to user email' => [
                'postmarkException' => PostmarkExceptionFactory::create(405),
                'expectedFlashBagValues' => [
                    ConfirmController::FLASH_BAG_TOKEN_RESEND_ERROR_KEY => [
                        ConfirmController::FLASH_BAG_TOKEN_RESEND_ERROR_MESSAGE_POSTMARK_NOT_ALLOWED_TO_SEND,
                    ]
                ],
            ],
            'postmark inactive recipient' => [
                'postmarkException' => PostmarkExceptionFactory::create(406),
                'expectedFlashBagValues' => [
                    ConfirmController::FLASH_BAG_TOKEN_RESEND_ERROR_KEY => [
                        ConfirmController::FLASH_BAG_TOKEN_RESEND_ERROR_MESSAGE_POSTMARK_INACTIVE_RECIPIENT,
                    ]
                ],
            ],
            'postmark unknown error' => [
                'postmarkException' => PostmarkExceptionFactory::create(300),
                'expectedFlashBagValues' => [
                    ConfirmController::FLASH_BAG_TOKEN_RESEND_ERROR_KEY => [
                        ConfirmController::FLASH_BAG_TOKEN_RESEND_ERROR_MESSAGE_POSTMARK_UNKNOWN,
                    ]
                ],
            ],
        ];
    }

    public function testResendActionSuccess()
    {
        $flashBag = self::$container->get(FlashBagInterface::class);

        $this->httpMockHandler->appendFixtures([
            HttpResponseFactory::createSuccessResponse(),
            HttpResponseFactory::createJsonResponse(self::CONFIRMATION_TOKEN),
        ]);

        /* @var MockInterface|Mailer $mailer */
        $mailer = \Mockery::mock(Mailer::class);
        $mailer
            ->shouldReceive('sendSignUpConfirmationToken')
            ->withArgs([
                self::EMAIL,
                self::CONFIRMATION_TOKEN,
            ]);

        $confirmController = new ConfirmController(
            self::$container->get(RouterInterface::class),
            self::$container->get(UserService::class),
            self::$container->get(FlashBagInterface::class),
            $mailer
        );

        /* @var RedirectResponse $response */
        $response = $confirmController->resendAction(self::EMAIL);

        $this->assertInstanceOf(RedirectResponse::class, $response);
        $this->assertEquals(self::EXPECTED_REDIRECT_URL, $response->getTargetUrl());
        $this->assertEquals(
            [
                ConfirmController::FLASH_BAG_TOKEN_RESEND_SUCCESS_KEY => [
                    ConfirmController::FLASH_BAG_TOKEN_RESEND_SUCCESS_MESSAGE,
                ]
            ],
            $flashBag->peekAll()
        );
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

using UnityEngine;

using Picodex.Math;
using Picodex.Vxcm;

#if UNITY_EDITOR
using UnityEditor;
#endif

namespace Picodex.Unity.Vxcm
{
    /// Base class representing behaviour common to all volumes.
    /**
	 * Volumes are probably the single most fundamental concept of %Cubiquity. They essentially provide a 3D array of voxels which the user can
	 * modify at will, and they take care of synchronizing and maintaining a mesh representation of the voxels for rendering and collision detection.
	 *
	 * The Volume class itself is actually an abstract base class which cannot be instantiated by user code directly. Instead is serves as a base
	 * for the DFVolume and TerrainVolume and encapsulates some of the common behaviour which such derived classes need. It is used in
	 * conjunction with the VolumeData, VolumeRenderer and VolumeCollider to form a structure as given below:
	 *
	 * \image html VolumeComposition.png
	 *
	 * Note how this is conceptually similar to the way that Unity's mesh classes are structured, where the MeshFilter works in conjunction with
	 * the Mesh, MeshRenderer and MeshCollider classes.
	 */
    [ExecuteInEditMode]
    public abstract class Volume : MonoBehaviour
    {
        [SerializeField]
        private VolumeData mData = null;
        /// Represents the actual 3D grid of voxels describing your object or environment.
        /**
		 * You can acces the VolumeData through this property in order to get/set the voxels on an individual basis, or to assign an existing
		 * instance of VolumeData which you have created elsewhere. Modifying or assigning the volume data will cause the mesh representation
		 * to be automatically updated.
		 */
        public VolumeData data
        {
            get { return this.mData; }
            set
            {
                if (this.mData != value)
                {
                    UnregisterVolumeData();
                    this.mData = value;
                    RegisterVolumeData();

                    // Delete the octree, so that next time Update() is called a new octree is constructed to match the new volume data.
                    RequestFlushInternalData();
                }
            }
        }

        /// Indicates whether the mesh representation is currently up to date with the volume data.
        /**
		 * Note that this property may fluctuate rapidly during real-time editing as the system tries to keep up with the users
		 * modifications, and also that it may lag a few frames behind the true syncronization state.
		 *
		 * \sa OnMeshSyncComplete, OnMeshSyncLost
		 */
        public bool isMeshSyncronized
        {
            get { return mIsMeshSyncronized; }
            protected set
            {
                // Check if the state of the mesh sync variable has actually changed.
                if (mIsMeshSyncronized != value)
                {
                    // If so update it.
                    mIsMeshSyncronized = value;

                    // And fire the appropriate event. The isMeshSyncronized flag works in edit mode,
                    // but we only fire the events in play mode (unless we find an edit-mode use too?)
                    if (Application.isPlaying)
                    {
                        if (mIsMeshSyncronized)
                        {
                            if (OnMeshSyncComplete != null) { OnMeshSyncComplete(); }
                        }
                        else
                        {
                            if (OnMeshSyncLost != null) { OnMeshSyncLost(); }
                        }
                    }
                }
            }
        }
        private bool mIsMeshSyncronized = false;

        /// Delegate type used by OnMeshSyncComplete() and OnMeshSyncLost()
        public delegate void MeshSyncAction();
        /// This event is fired once the mesh representation is up-to-date with the volume data.
        /**
		 * The process of keeping the mesh data syncronized to the volume data is computationally expensive, and it is quite possible for the
		 * mesh to lag behind. This is particularly common when fresh volume data is first assigned as it can take a few seconds for the initial
		 * mesh to be generated. If you wish to wait for the mesh to be generated before (e.g.) spawning your player object then you can use
		 * this event for this purpose.
		 *
		 * The mesh can also lag beind during intensive editing operations, and this can cause a series of OnMeshSyncComplete events to occur
		 * as the system repeatedly catches up. Therefore, in the previous player-spawning example you would probably want to disconnect the
		 * event after the first one has occured.
		 *
		 * Please see MeshSyncHandler.cs in the provided examples for a demonstration of usage.
		 *
		 * \sa isMeshSyncronized, OnMeshSyncLost
		 */
        public event MeshSyncAction OnMeshSyncComplete;

        /// This event is fired if the mesh representation is no longer up-to-date with the volume data.
        /**
		 * Syncronization between the mesh and the volume data will be lost when you first assign new volume data, and also during editing
		 * operations.
		 *
		 * Please see MeshSyncHandler.cs in the provided examples for a demonstration of usage.
		 *
		 * \sa isMeshSyncronized, OnMeshSyncComplete
		 */
        public event MeshSyncAction OnMeshSyncLost;

        /// Sets an upper limit on the rate at which the mesh representation is updated to match the volume data.
        /**
		 * %Cubiquity continuously checks whether the the mesh representation (used for rendering and physics) is synchronized with the underlying
		 * volume data. Such synchronization can be lost whenever the volume data is modified, and %Cubiquity will then regenerate the mesh. This
		 * regeneration process can take some time, and so typically you want to spread the regeneration over a number of frames.
		 *
		 * Internally %Cubiquity breaks down the volume into a number regions each corresponding to an octree node, and these can be resynchronized
		 * individually. Therefore this property controls how many of the octree nodes will be resynchronized each frame. A small value will result
		 * in a better frame rate when modifications are being performed, but at the possible expense of the rendered mesh noticeably lagging behind
		 * the modifications which are being performed.
		 *
		 * NOTE: This property is currently hidden from the user until we have a better understanding of how it should behave. For example, should
		 * that same value be used in edit mode vs. play mode? What if there is/isn't a collision mesh? Or what if we want to syncronize every 'x'
		 * updates rather than 'x' times per update?
		 */
        /// \cond
        protected uint maxSyncOperationsInPlayMode = 4;
        protected uint maxSyncOperationsInEditMode = 16; // Can be higher than in play mode as we have no collision mehses
                                                         /// \endcond

        // The root node of our octree. It is protected so that derived classes can use it, but users
        // are not supposed to create derived classes themselves so we hide this property from the docs.
        /// \cond
        [System.NonSerialized]
        protected GameObject rootOctreeNodeGameObject;
        /// \endcond

        // Used to check when the game object changes layer, so we can move the children to match.
        private int previousLayer = -1;

        // Used to catch the user using the same volume data for multiple volumes (which they should not do).
        // It's not a really robust approach but it works well enough and only serves to issue a warning anyway.
        private static Dictionary<int, int> volumeDataAndVolumes = new Dictionary<int, int>();

        private bool flushRequested;

        // ------------------------------------------------------------------------------
        // These editor-only functions are used to emulate repeated calls to Update() in edit mode. Setting the '[ExecuteInEditMode]' attribute does cause
        // Update() to be called automatically in edit mode, but it only happens in response to user-driven events such as moving the mouse in the editor
        // window. We want to support background loading of our terrain and so we hook into the 'EditorApplication.update' event for this purpose.
        // ------------------------------------------------------------------------------
#if UNITY_EDITOR

        private int editModeUpdates = 0;

        // Public so that we can manually drive it from the editor as required,
        // but user code should not do this so it's hidden from the docs.
        /// \cond
        public void ForceUpdate()
        {
            Update();
        }

        /// \cond
        public void EditModeUpdateHandler() // Public so we can call it from Editor scripts
        {
            DebugUtils.Assert(Application.isPlaying == false, "EditModeUpdateHandler() should never be called in play mode!");

            if (enabled)
            {
                if (isMeshSyncronized)
                {
                    if(editModeUpdates % 20 == 0)
                    {
                        //Debug.Log("Low freq update");
                        ForceUpdate();
                        //SceneView.RepaintAll();
                    }
                }
                else
                {
                    //Debug.Log("High freq update");
                    ForceUpdate();
                    //SceneView.RepaintAll();
                }
            }

            editModeUpdates++;
        }
        /// \endcond
#endif
        // ------------------------------------------------------------------------------

        void Awake()
        {
            RegisterVolumeData();
        }

        void OnEnable()
        {
            // We have taken steps to make sure that our octree does not get saved to disk or persisted between edit/play mode,
            // but it will still survive if we just disable and then enable the volume. This is because the OnDisable() and
            // OnEnable() methods do now allow us to modify our game object hierarchy. Note that this disable/enable process
            // may also happen automatically such as during a script reload? Requesting a flush of the octree is the safest option.
            RequestFlushInternalData();
        }

        void OnDisable()
        {
            // Ideally the VolumeData would handle it's own initialization and shutdown, but it's OnEnable()/OnDisable() methods don't seems to be
            // called when switching between edit/play mode if it has been turned into an asset. Therefore we do it here as well just to be sure.
            if (data != null)
            {
                data.ShutdownCubiquityVolume();
            }
        }

        void OnDestroy()
        {
            UnregisterVolumeData();
        }

        // Public as the editor sometimes needs to flush the internal data,
        // but user code should not do this so it's hidden from the docs.
        /// \cond
        public void RequestFlushInternalData()
        {
            flushRequested = true;
        }
        /// \endcond

        private void FlushInternalData()
        {
            // It should be enough to delete the root octree node in this function but we're seeing cases
            // of octree nodes surviving the transition between edit and play modes. I'm not quite sure
            // why, but the approach below of deleting all child objects seems to solve the problem.

            // Find all the child objects
            List<GameObject> childObjects = new List<GameObject>();
            foreach (Transform childTransform in gameObject.transform)
            {
                childObjects.Add(childTransform.gameObject);
            }

            // Destroy all children
            foreach (GameObject childObject in childObjects)
            {
                //Impl.Utility.DestroyOrDestroyImmediate(childObject);
            }

            rootOctreeNodeGameObject = null;
        }

        protected abstract bool SynchronizeVolume(uint maxSyncOperations);

        private void Update()
        {
            if (flushRequested)
            {
                FlushInternalData();
                flushRequested = false;

                // It seems prudent to return at this point, and leave the actual updating to the next call of this function.
                // This is because we've just destroyed a bunch of stuff by flushing and Unity actually defers Destroy() until
                // later in the frame. It actually seems t work ok without the return, but it makes me feel a little safer.
                return;
            }

            // Check whether the gameObject has been moved to a new layer.
            if (gameObject.layer != previousLayer)
            {
                // If so we update the children to match and then clear the flag.
                gameObject.SetLayerRecursively(gameObject.layer);
                previousLayer = gameObject.layer;
            }

            // Set shader parameters.
            VolumeRenderer volumeRenderer = gameObject.GetComponent<VolumeRenderer>();
            if (volumeRenderer != null)
            {
                if (volumeRenderer.material != null)
                {
                    VolumeAddress volumeSize = (data.Region.max - data.Region.min);
                    volumeSize.x++; volumeSize.y++; volumeSize.z++;
                    volumeRenderer.material.SetVector("_VolumeSize", (Vector3)volumeSize);

                    volumeRenderer.material.SetMatrix("_World2Volume", transform.worldToLocalMatrix);
                }
            }

            if (data != null && data.volumeHandle.HasValue)
            {
                // When we are in game mode we limit the number of nodes which we update per frame, to maintain a nice.
                // framerate The Update() method is called repeatedly and so over time the whole mesh gets syncronized.
                if (Application.isPlaying)
                {
                    isMeshSyncronized = SynchronizeVolume(maxSyncOperationsInPlayMode);
                }
                else
                {
                    isMeshSyncronized = SynchronizeVolume(maxSyncOperationsInEditMode);
                }
            }
        }
        /// \endcond

        // Public so that we can manually drive it from the editor as required,
        // but user code should not do this so it's hidden from the docs.
        /// \cond
        public void OnGUI()
        {
            // This code doesn't belong in Volume? There should
            // probably be one global copy of this, not one per volume.

            /*GUILayout.BeginArea(new Rect(10, 10, 300, 300));
            GUI.skin.label.alignment = TextAnchor.MiddleLeft;
            string debugPanelMessage = "Cubiquity Debug Panel\n";
            if(isMeshSyncronized)
            {
                debugPanelMessage += "Mesh sync: Completed";
            }
            else
            {
                debugPanelMessage += "Mesh sync: In progress...";
            }
            GUILayout.Box(debugPanelMessage);
            GUILayout.EndArea();*/
        }
        /// \endcond

        private void RegisterVolumeData()
        {
            if (mData != null)
            {
                int volumeID = GetInstanceID();
                int volumeDataID = mData.GetInstanceID();

                int existingVolumeID;
                if (volumeDataAndVolumes.TryGetValue(volumeDataID, out existingVolumeID))
                {
                    if (existingVolumeID != volumeID)
                    {
                        // It's being used by a different instance, so warn the user.
                        // In play mode the best we can do is give the user the instance IDs.
                        string volumeName = "Instance ID = " + volumeID;
                        string existingVolumeName = "Instance ID = " + existingVolumeID;
                        string volumeDataName = "Instance ID = " + volumeDataID;

                        // But in the editor we can try and find names for them.
#if UNITY_EDITOR
						Object volume = EditorUtility.InstanceIDToObject(volumeID);
						if(volume) volumeName = volume.name;

						Object existingVolume = EditorUtility.InstanceIDToObject(existingVolumeID);
						if(existingVolume) existingVolumeName = existingVolume.name;

						volumeDataName = AssetDatabase.GetAssetPath(volumeDataID);
#endif

                        // Let the user know what has gone wrong.
                        string warningMessage = "Multiple use of volume data detected! Did you attempt to duplicate or clone an existing volume? " +
                            "Each volume data should only be used by a single volume - please see the Cubiquity for Unity3D user manual and API documentation for more information. " +
                            "\nBoth '" + existingVolumeName + "' and '" + volumeName + "' reference the volume data called '" + volumeDataName + "'." +
                            "\nNote: If you see this message regarding an asset which you have already deleted then you may need to close the scene and/or restart Unity.";
                        Debug.LogWarning(warningMessage);
                    }
                }
                else
                {
                    volumeDataAndVolumes.Add(volumeDataID, volumeID);
                }
            }
        }

        private void UnregisterVolumeData()
        {
            if (mData != null)
            {
                // Remove the volume data entry from our duplicate-checking dictionary.
                // This could fail, e.g. if the user does indeed create two volumes with the same volume data
                // then deleting the first will remove the entry which then won't exist when deleting the second.
                volumeDataAndVolumes.Remove(mData.GetInstanceID());
            }
        }

#if UNITY_EDITOR
        // Because our hierarchy of Octree nodes is generated at runtime (and is depenant on the camera position) we do not
        // want to serialize it with the scene. Setting the 'DontSave' flag on the root would seem like an intiative solution
        // but actually results in errors which, while harmless, will be disconcerting to the users. See this Unity Answers thread
        // for more details: http://answers.unity3d.com/questions/609621/hideflagsdontsave-causes-checkconsistency-transfor.html
        //
        // We have found two posible solutions to this problem. The first solution is to make use of a 'ghost object' which sits
        // at the root of our scene and has it's transformation updated every frame to match out current volume's transformation.
        // The octree can then be attached to this ghost object rather than the real volume. This get's rid of the harmless error
        // message because the ghost is at the root of the scene, and so there is no parent object to complain when it is not
        // found on scene load. However, this solution has some known problems:
        //
        //     - The bounding box of the real volume is no longer correct, as it has no tree/mesh data of it's own. You can't
        //       manually set the bounding box, so we'd probably have to create a fake degenerate mesh and attach it to the
        //       volume. The coresponding MeshFilter/MeshRenderer then show up in the volume inspector, I believe even with the
        //       'HideInHierarchy' flag set (they are then greyed out).
        //
        //     - The 'Show Wireframe' feature doesn't work, as you can only see the wireframe of a selected object and you can't
        //       select the hidden ghost object.
        //
        //     - I also have concerns about how well selection/gizmos will work with a ghost object. For example, clicking the
        //       ghost in the scene view should select the ral object. But this isn't really tested yet.
        //
        // The second solution is to attach the octree to the real volume game object, and then attempt to delete it before
        // serialization is performed. Unity won't allow us to modify the object hierarchy in the OnDisable() method, so we have
        // to resort to using the slightly 'hacky' functions below. The only know drawback of this approach is that it means
        // the scene is flagged as 'unsaved' immediatly after saving it (probably because the octree is then rebuilt). But
        // thinking about it now, this probably affects the 'ghost object' solution as well. This second solution is what we
        // have implemented below.
        private class OnSaveHandler : UnityEditor.AssetModificationProcessor
        {
            public static string[] OnWillSaveAssets(string[] assets)
            {
                // Flush internal data of any volumes in the scene
                Object[] volumes = Object.FindObjectsOfType(typeof(Volume));
                foreach (Object volume in volumes)
                {
                    ((Volume)volume).FlushInternalData();
                }

                // Return the list of assets to be saved (we haven't changed this).
                return assets;
            }
        }

        // I'm not sure this code is really needed. Any internal data is discarded in the OnEnable() function and this ensures
        // correct functionality. We are also using 'OnWillSaveAssets()' to ensure the octree doesn't get saved when writing to
        // disk. However, we can still have a situation where the octree is serialized (internal serialization, not saving the
        // scene) when switching between edit and play mode, and although the resulting behaviour is correct (because OnEnable()
        // will later discard the old octree) it could be wasteful.
        //
        // The following code attempts to resolve this by flushing the octree when switching between modes. But it's not clear
        // if this flushing actually happens in time, or if it really helps performance. But there's no reason to think it hurts
        // so it's left here pending further investigation.
        [InitializeOnLoad]
        private class OnPlayHandler
        {
            static OnPlayHandler()
            {
                // Catch the event which occurs when switching modes.
                EditorApplication.playmodeStateChanged += OnPlaymodeStateChanged;
            }

            static void OnPlaymodeStateChanged()
            {
                // We only need to discard the octree in edit mode, beacause when leaving play mode serialization is not
                // performed. This event occurs both when leaving the old mode and again when entering the new mode, but
                // when entering edit mode the root null should already be null and discarding it again is harmless.
                {
                    Object[] volumes = Object.FindObjectsOfType(typeof(Volume));
                    foreach (Object volume in volumes)
                    {
                        ((Volume)volume).FlushInternalData();
                    }
                }
            }
        }
#endif
    }
}


text:
/*global ActiveXObject: false*/
/*global module: false*/
/*global define: false*/

(function () {
    var store = {},
        win = window,
        doc = win.document,
        localStorageName = 'localStorage',
        globalStorageName = 'globalStorage',
        namespace = '__storejs__',
        storage;

    store.disabled = false;
    store.set = function (key, value) {};
    store.get = function (key) {};
    store.remove = function (key) {};
    store.clear = function () {};
    store.transact = function (key, defaultVal, transactionFn) {
        var val = store.get(key);
        if (transactionFn === null) {
            transactionFn = defaultVal;
            defaultVal = null;
        }
        if (typeof val === 'undefined') {
            val = defaultVal || {};
        }
        transactionFn(val);
        store.set(key, val);
    };
    store.getAll = function () {};

    store.serialize = function (value) {
        return JSON.stringify(value);
    };
    store.deserialize = function (value) {
        if (typeof value !== 'string') {
            return undefined;
        }
        return JSON.parse(value);
    };

    // Functions to encapsulate questionable FireFox 3.6.13 behavior
    // when about.config::dom.storage.enabled === false
    // See https://github.com/marcuswestin/store.js/issues#issue/13
    function isLocalStorageNameSupported() {
        try {
            return (localStorageName in win && win[localStorageName]);
        }
        catch (err) {
            return false;
        }
    }

    function isGlobalStorageNameSupported() {
        try {
            return (globalStorageName in win && win[globalStorageName] && win[globalStorageName][win.location.hostname]);
        }
        catch (err) {
            return false;
        }
    }

    if (isLocalStorageNameSupported()) {
        storage = win[localStorageName];
        store.set = function (key, val) {
            if (val === undefined) {
                return store.remove(key);
            }
            storage.setItem(key, store.serialize(val));
        };
        store.get = function (key) {
            return store.deserialize(storage.getItem(key));
        };
        store.remove = function (key) {
            storage.removeItem(key);
        };
        store.clear = function () {
            storage.clear();
        };
        store.getAll = function () {
            var ret = {};
            var i;
            for (i = 0; i < storage.length; i += 1) {
                var key = storage.key(i);
                ret[key] = store.get(key);
            }
            return ret;
        };
    } else if (isGlobalStorageNameSupported()) {
        storage = win[globalStorageName][win.location.hostname];
        store.set = function (key, val) {
            if (val === undefined) {
                return store.remove(key);
            }
            storage[key] = store.serialize(val);
        };
        store.get = function (key) {
            return store.deserialize(storage[key] && storage[key].value);
        };
        store.remove = function (key) {
            delete storage[key];
        };
        store.clear = function () {
            var key;
            for (key in storage ) {
                delete storage[key];
            }
        };
        store.getAll = function () {
            var ret = {};
            var i;
            for (i = 0; i < storage.length; i += 1) {
                var key = storage.key(i);
                ret[key] = store.get(key);
            }
            return ret;
        };

    } else if (doc.documentElement.addBehavior) {
        var storageOwner,
            storageContainer;
        // Since #userData storage applies only to specific paths, we need to
        // somehow link our data to a specific path.  We choose /favicon.ico
        // as a pretty safe option, since all browsers already make a request to
        // this URL anyway and being a 404 will not hurt us here.  We wrap an
        // iframe pointing to the favicon in an ActiveXObject(htmlfile) object
        // (see: http://msdn.microsoft.com/en-us/library/aa752574(v=VS.85).aspx)
        // since the iframe access rules appear to allow direct access and
        // manipulation of the document element, even for a 404 page.  This
        // document can be used instead of the current document (which would
        // have been limited to the current path) to perform #userData storage.
        try {
            storageContainer = new ActiveXObject('htmlfile');
            storageContainer.open();
            storageContainer.write('<s' + 'cript>document.w=window</s' + 'cript><iframe src="/favicon.ico"></frame>');
            storageContainer.close();
            storageOwner = storageContainer.w.frames[0].document;
            storage = storageOwner.createElement('div');
        } catch (e) {
            // somehow ActiveXObject instantiation failed (perhaps some special
            // security settings or otherwse), fall back to per-path storage
            storage = doc.createElement('div');
            storageOwner = doc.body;
        }
        var withIEStorage = function withIEStorageFn(storeFunction) {
            return function () {
                var args = Array.prototype.slice.call(arguments, 0);
                args.unshift(storage);
                // See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx
                // and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx
                storageOwner.appendChild(storage);
                storage.addBehavior('#default#userData');
                storage.load(localStorageName);
                var result = storeFunction.apply(store, args);
                storageOwner.removeChild(storage);
                return result;
            };
        };
        var ieKeyFix = function ieKeyFixFn(key) {
            // In IE7, keys may not begin with numbers.
            // See https://github.com/marcuswestin/store.js/issues/40#issuecomment-4617842
            return '_' + key;
        };
        store.set = withIEStorage(function (storage, key, val) {
                key = ieKeyFix(key);
                if (val === undefined) {
                    return store.remove(key);
                }
                storage.setAttribute(key, store.serialize(val));
                storage.save(localStorageName);
            });
        store.get = withIEStorage(function (storage, key) {
            key = ieKeyFix(key);
            return store.deserialize(storage.getAttribute(key));
        });
        store.remove = withIEStorage(function (storage, key) {
            key = ieKeyFix(key);
            storage.removeAttribute(key);
            storage.save(localStorageName);
        });
        store.clear = withIEStorage(function (storage) {
            var attributes = storage.XMLDocument.documentElement.attributes;
            storage.load(localStorageName);
            var i;
            var attributesLength = attributes.length;
            for (i = 0; i < attributesLength ; i += 1) {
                var attr = attributes[i];
                storage.removeAttribute(attr.name);
            }
            storage.save(localStorageName);
        });
        store.getAll = withIEStorage(function (storage) {
            var attributes = storage.XMLDocument.documentElement.attributes;
            storage.load(localStorageName);
            var ret = {};
            var i;
            var attributesLength = attributes.length;
            for (i = 0; i < attributesLength ; i += 1) {
                var attr = attributes[i];
                ret[attr] = store.get(attr);
            }
            return ret;
        });
    }

    try {
        store.set(namespace, namespace);
        if (store.get(namespace) !== namespace) {
            store.disabled = true;
        }
        store.remove(namespace);
    } catch (err) {
        store.disabled = true;
    }

    this.JsLocalStore = store;
}());


text:
				<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#admin-app-apps">
					Toggle navigation
				</button>
				Live API Documentation

		<apisdk></apisdk>


text:
namespace remoting {

class DesktopSessionProxy;

// Routes InputInjector calls though the IPC channel to the desktop session
// agent running in the desktop integration process.
class IpcInputInjector : public InputInjector {
 public:
  explicit IpcInputInjector(
      scoped_refptr<DesktopSessionProxy> desktop_session_proxy);
  ~IpcInputInjector() override;

  // ClipboardStub interface.
  void InjectClipboardEvent(const protocol::ClipboardEvent& event) override;

  // InputStub interface.
  void InjectKeyEvent(const protocol::KeyEvent& event) override;
  void InjectTextEvent(const protocol::TextEvent& event) override;
  void InjectMouseEvent(const protocol::MouseEvent& event) override;
  void InjectTouchEvent(const protocol::TouchEvent& event) override;

  // InputInjector interface.
  void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override;

 private:
  // Wraps the IPC channel to the desktop process.
  scoped_refptr<DesktopSessionProxy> desktop_session_proxy_;

  DISALLOW_COPY_AND_ASSIGN(IpcInputInjector);
};

}  // namespace remoting

#endif  // REMOTING_HOST_IPC_INPUT_INJECTOR_H_


text:
<?php
/**
 * WordPress Theme Installation Administration API
 *
 * @package WordPress
 * @subpackage Administration
 */

$themes_allowedtags = array(
	'a'       => array(
		'href'   => array(),
		'title'  => array(),
		'target' => array(),
	),
	'abbr'    => array( 'title' => array() ),
	'acronym' => array( 'title' => array() ),
	'code'    => array(),
	'pre'     => array(),
	'em'      => array(),
	'strong'  => array(),
	'div'     => array(),
	'p'       => array(),
	'ul'      => array(),
	'ol'      => array(),
	'li'      => array(),
	'h1'      => array(),
	'h2'      => array(),
	'h3'      => array(),
	'h4'      => array(),
	'h5'      => array(),
	'h6'      => array(),
	'img'     => array(
		'src'   => array(),
		'class' => array(),
		'alt'   => array(),
	),
);

$theme_field_defaults = array(
	'description'  => true,
	'sections'     => false,
	'tested'       => true,
	'requires'     => true,
	'rating'       => true,
	'downloaded'   => true,
	'downloadlink' => true,
	'last_updated' => true,
	'homepage'     => true,
	'tags'         => true,
	'num_ratings'  => true,
);

/**
 * Retrieve list of WordPress theme features (aka theme tags).
 *
 * @since 2.8.0
 *
 * @deprecated since 3.1.0 Use get_theme_feature_list() instead.
 *
 * @return array
 */
function install_themes_feature_list() {
	_deprecated_function( __FUNCTION__, '3.1.0', 'get_theme_feature_list()' );

	if ( ! $cache = get_transient( 'wporg_theme_feature_list' ) ) {
		set_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS );
	}

	if ( $cache ) {
		return $cache;
	}

	$feature_list = themes_api( 'feature_list', array() );
	if ( is_wp_error( $feature_list ) ) {
		return array();
	}

	set_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS );

	return $feature_list;
}

/**
 * Display search form for searching themes.
 *
 * @since 2.8.0
 *
 * @param bool $type_selector
 */
function install_theme_search_form( $type_selector = true ) {
	$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
	$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
	if ( ! $type_selector ) {
		echo '
' . __( 'Search for themes by keyword.' ) . '
';
	}
	?>
<form id="search-themes" method="get">
	<input type="hidden" name="tab" value="search" />
	<?php if ( $type_selector ) : ?>
	<?php _e( 'Type of search' ); ?>
	<select	name="type" id="typeselector">
	<option value="term" <?php selected( 'term', $type ); ?>><?php _e( 'Keyword' ); ?></option>
	<option value="author" <?php selected( 'author', $type ); ?>><?php _e( 'Author' ); ?></option>
	<option value="tag" <?php selected( 'tag', $type ); ?>><?php _ex( 'Tag', 'Theme Installer' ); ?></option>
	</select>

		<?php
		switch ( $type ) {
			case 'term':
				_e( 'Search by keyword' );
				break;
			case 'author':
				_e( 'Search by author' );
				break;
			case 'tag':
				_e( 'Search by tag' );
				break;
		}
		?>

	<?php else : ?>
	<?php _e( 'Search by keyword' ); ?>
	<?php endif; ?>
	<input type="search" name="s" id="s" size="30" value="<?php echo esc_attr( $term ); ?>" autofocus="autofocus" />
	<?php submit_button( __( 'Search' ), '', 'search', false ); ?>
</form>
	<?php
}

/**
 * Display tags filter for themes.
 *
 * @since 2.8.0
 */
function install_themes_dashboard() {
	install_theme_search_form( false );
	?>

<?php _e( 'Feature Filter' ); ?>

<?php _e( 'Find a theme based on specific features.' ); ?>

<form method="get">
	<input type="hidden" name="tab" value="search" />
	<?php
	$feature_list = get_theme_feature_list();
	echo '
';

	foreach ( (array) $feature_list as $feature_name => $features ) {
		$feature_name = esc_html( $feature_name );
		echo '
' . $feature_name . '
';

		echo '
';
		foreach ( $features as $feature => $feature_name ) {
			$feature_name = esc_html( $feature_name );
			$feature      = esc_attr( $feature );
			?>

	<input type="checkbox" name="features[]" id="feature-id-<?php echo $feature; ?>" value="<?php echo $feature; ?>" />
	<label for="feature-id-<?php echo $feature; ?>"><?php echo $feature_name; ?>

<?php	} ?>

		<?php
	}
	?>

	<?php submit_button( __( 'Find Themes' ), '', 'search' ); ?>
</form>
	<?php
}

/**
 * @since 2.8.0
 */
function install_themes_upload() {
	?>

<?php _e( 'If you have a theme in a .zip format, you may install it by uploading it here.' ); ?>

<form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url( 'update.php?action=upload-theme' ); ?>">
	<?php wp_nonce_field( 'theme-upload' ); ?>
	<?php _e( 'Theme zip file' ); ?>
	<input type="file" id="themezip" name="themezip" />
	<?php submit_button( __( 'Install Now' ), '', 'install-theme-submit', false ); ?>
</form>
	<?php
}

/**
 * Prints a theme on the Install Themes pages.
 *
 * @deprecated 3.4.0
 *
 * @global WP_Theme_Install_List_Table $wp_list_table
 *
 * @param object $theme
 */
function display_theme( $theme ) {
	_deprecated_function( __FUNCTION__, '3.4.0' );
	global $wp_list_table;
	if ( ! isset( $wp_list_table ) ) {
		$wp_list_table = _get_list_table( 'WP_Theme_Install_List_Table' );
	}
	$wp_list_table->prepare_items();
	$wp_list_table->single_row( $theme );
}

/**
 * Display theme content based on theme list.
 *
 * @since 2.8.0
 *
 * @global WP_Theme_Install_List_Table $wp_list_table
 */
function display_themes() {
	global $wp_list_table;

	if ( ! isset( $wp_list_table ) ) {
		$wp_list_table = _get_list_table( 'WP_Theme_Install_List_Table' );
	}
	$wp_list_table->prepare_items();
	$wp_list_table->display();

}

/**
 * Display theme information in dialog box form.
 *
 * @since 2.8.0
 *
 * @global WP_Theme_Install_List_Table $wp_list_table
 */
function install_theme_information() {
	global $wp_list_table;

	$theme = themes_api( 'theme_information', array( 'slug' => wp_unslash( $_REQUEST['theme'] ) ) );

	if ( is_wp_error( $theme ) ) {
		wp_die( $theme );
	}

	iframe_header( __( 'Theme Installation' ) );
	if ( ! isset( $wp_list_table ) ) {
		$wp_list_table = _get_list_table( 'WP_Theme_Install_List_Table' );
	}
	$wp_list_table->theme_installer_single( $theme );
	iframe_footer();
	exit;
}


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<igsSiteLog xmlns="http://sopac.ucsd.edu/ns/geodesy/doc/igsSiteLog/2004" xmlns:contact="http://sopac.ucsd.edu/ns/geodesy/doc/igsSiteLog/contact/2004" xmlns:equip="http://sopac.ucsd.edu/ns/geodesy/doc/igsSiteLog/equipment/2004" xmlns:li="http://sopac.ucsd.edu/ns/geodesy/doc/igsSiteLog/localInterferences/2004" xmlns:mi="http://sopac.ucsd.edu/ns/geodesy/doc/igsSiteLog/monumentInfo/2004" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sopac.ucsd.edu/ns/geodesy/doc/igsSiteLog/2004  http://sopac.ucsd.edu/ns/geodesy/doc/igsSiteLog/2004/igsSiteLog.xsd"><!--Alice Springs Station Log-->
<!--Version 0.01-->
<!--Geoscience Australia Geodesy-->
<!--For More Information regarding XML based Site Logs go to-->
<!--http://sopac.ucsd.edu/projects/xml-->

  <formInformation>
    <mi:preparedBy>David Maggert</mi:preparedBy>
    <mi:datePrepared>2009-01-07</mi:datePrepared>
    <mi:reportType>UPDATE</mi:reportType>
    <mi:previousLog>nssp_20080528.log</mi:previousLog>
    <mi:modifiedSections>3.5, 3.6, 8.1.1, 8.2.1, 8.3.1, 12</mi:modifiedSections>
  </formInformation>
  <siteIdentification>
    <mi:siteName>Yerevan (National Survey for Seismic Protection)</mi:siteName>
    <mi:fourCharacterID>NSSP</mi:fourCharacterID>
    <mi:monumentInscription>none</mi:monumentInscription>
    <mi:iersDOMESNumber>12312M001</mi:iersDOMESNumber>
    <mi:cdpNumber>none</mi:cdpNumber>
    <mi:monumentDescription>CONCRETE PILLAR</mi:monumentDescription>
    <mi:heightOfTheMonument>1</mi:heightOfTheMonument>
    <mi:monumentFoundation>CONCRETE</mi:monumentFoundation>
    <mi:foundationDepth></mi:foundationDepth>
    <mi:markerDescription>DIMPLE in stainless steel pin</mi:markerDescription>
    <mi:dateInstalled>1996-07-15</mi:dateInstalled>
    <mi:geologicCharacteristic>BEDROCK</mi:geologicCharacteristic>
    <mi:bedrockType>Balsaltic lava flow, ~5m thick, several km**2</mi:bedrockType>
    <mi:bedrockCondition>alternating layers of ash and basalt</mi:bedrockCondition>
    <mi:fractureSpacing>(1-10 cm/11-50 cm/51-200 cm/over 200 cm)</mi:fractureSpacing>
    <mi:faultZonesNearby>(YES/NO/Name of the zone)</mi:faultZonesNearby>
    <mi:distance-Activity>(multiple lines)</mi:distance-Activity>
    <mi:notes>5/8 " bolt set in concrete pillar UNAVCO Leveling mount used http /permanent/equipment/mounts/levelingmount.html</mi:notes>
  </siteIdentification>
  <siteLocation>
    <mi:city>Yerevan</mi:city>
    <mi:state>Armenia</mi:state>
    <mi:country>Republic of Armenia</mi:country>
    <mi:tectonicPlate>Anotolian Block</mi:tectonicPlate>
    <approximatePositionITRF>
      <mi:xCoordinateInMeters>3478646.5381</mi:xCoordinateInMeters>
      <mi:yCoordinateInMeters>3418805.8864</mi:yCoordinateInMeters>
      <mi:zCoordinateInMeters>4097987.2864</mi:zCoordinateInMeters>
      <mi:latitude-North>+401335.2403</mi:latitude-North>
      <mi:longitude-East>+0443010.5406</mi:longitude-East>
      <mi:elevation-m_ellips.>1194.7548</mi:elevation-m_ellips.>
    </approximatePositionITRF>
    <mi:notes></mi:notes>
  </siteLocation>
  <gnssReceiver>
    <equip:receiverType>ROGUE SNR-8000</equip:receiverType>
    <equip:satelliteSystem>GPS</equip:satelliteSystem>
    <equip:serialNumber>T111</equip:serialNumber>
    <equip:firmwareVersion>3.2</equip:firmwareVersion>
    <equip:elevationCutoffSetting>4</equip:elevationCutoffSetting>
    <equip:dateInstalled>1997-10-10T00:00Z</equip:dateInstalled>
    <equip:dateRemoved>1999-05-21T00:00Z</equip:dateRemoved>
    <equip:temperatureStabilization>NONE</equip:temperatureStabilization>
    <equip:notes></equip:notes>
  </gnssReceiver>
  <gnssReceiver>
    <equip:receiverType>ROGUE SNR-8000</equip:receiverType>
    <equip:satelliteSystem>GPS</equip:satelliteSystem>
    <equip:serialNumber>T111</equip:serialNumber>
    <equip:firmwareVersion>3.2.32.8</equip:firmwareVersion>
    <equip:elevationCutoffSetting>4</equip:elevationCutoffSetting>
    <equip:dateInstalled>1999-05-21T00:00Z</equip:dateInstalled>
    <equip:dateRemoved>2003-02-07T00:00Z</equip:dateRemoved>
    <equip:temperatureStabilization>NONE</equip:temperatureStabilization>
    <equip:notes></equip:notes>
  </gnssReceiver>
  <gnssReceiver>
    <equip:receiverType>ASHTECH UZ-12</equip:receiverType>
    <equip:satelliteSystem>GPS</equip:satelliteSystem>
    <equip:serialNumber>ZR220013847</equip:serialNumber>
    <equip:firmwareVersion>CJ12</equip:firmwareVersion>
    <equip:elevationCutoffSetting>4</equip:elevationCutoffSetting>
    <equip:dateInstalled>2003-02-07T00:00Z</equip:dateInstalled>
    <equip:dateRemoved>2005-12-05T23:59Z</equip:dateRemoved>
    <equip:temperatureStabilization>NONE</equip:temperatureStabilization>
    <equip:notes></equip:notes>
  </gnssReceiver>
  <gnssReceiver>
    <equip:receiverType>ASHTECH UZ-12</equip:receiverType>
    <equip:satelliteSystem>GPS</equip:satelliteSystem>
    <equip:serialNumber>ZR220014902</equip:serialNumber>
    <equip:firmwareVersion>CK00</equip:firmwareVersion>
    <equip:elevationCutoffSetting>4</equip:elevationCutoffSetting>
    <equip:dateInstalled>2006-09-05T09:00Z</equip:dateInstalled>
    <equip:dateRemoved>2008-05-23T07:00Z</equip:dateRemoved>
    <equip:temperatureStabilization>NONE</equip:temperatureStabilization>
    <equip:notes></equip:notes>
  </gnssReceiver>
  <gnssReceiver>
    <equip:receiverType>ASHTECH UZ-12</equip:receiverType>
    <equip:satelliteSystem>GPS</equip:satelliteSystem>
    <equip:serialNumber>ZR520021809</equip:serialNumber>
    <equip:firmwareVersion>CQ00</equip:firmwareVersion>
    <equip:elevationCutoffSetting>4</equip:elevationCutoffSetting>
    <equip:dateInstalled>2008-05-24T00:00Z</equip:dateInstalled>
    <equip:dateRemoved>2008-12-17T09:59Z</equip:dateRemoved>
    <equip:temperatureStabilization>NONE</equip:temperatureStabilization>
    <equip:notes></equip:notes>
  </gnssReceiver>
  <gnssReceiver>
    <equip:receiverType>ASHTECH UZ-12</equip:receiverType>
    <equip:satelliteSystem>GPS</equip:satelliteSystem>
    <equip:serialNumber>ZR520013805</equip:serialNumber>
    <equip:firmwareVersion>CQ00</equip:firmwareVersion>
    <equip:elevationCutoffSetting>4</equip:elevationCutoffSetting>
    <equip:dateInstalled>2008-12-20T00:00Z</equip:dateInstalled>
    <equip:dateRemoved></equip:dateRemoved>
    <equip:temperatureStabilization>NONE</equip:temperatureStabilization>
    <equip:notes></equip:notes>
  </gnssReceiver>
  <gnssAntenna>
    <equip:antennaType>AOAD/M_T        UNAV</equip:antennaType>
    <equip:serialNumber>232</equip:serialNumber>
    <equip:antennaReferencePoint>BPA</equip:antennaReferencePoint>
    <equip:marker-arpUpEcc.>000.0792</equip:marker-arpUpEcc.>
    <equip:marker-arpNorthEcc.>000.0000</equip:marker-arpNorthEcc.>
    <equip:marker-arpEastEcc.>000.0000</equip:marker-arpEastEcc.>
    <equip:alignmentFromTrueNorth>4 west of mag North</equip:alignmentFromTrueNorth>
    <equip:antennaRadomeType>UNAV</equip:antennaRadomeType>
    <equip:radomeSerialNumber></equip:radomeSerialNumber>
    <equip:antennaCableType>(vendor & type number)</equip:antennaCableType>
    <equip:antennaCableLength></equip:antennaCableLength>
    <equip:dateInstalled>1997-10-10T00:00Z</equip:dateInstalled>
    <equip:dateRemoved>2003-02-07T00:00Z</equip:dateRemoved>
    <equip:notes>Cable split with a grounded Huber-Shunner protector.  N-type connectors used.  UNAVCO leveling mount. Regal Plastics Chokering Raydome</equip:notes>
  </gnssAntenna>
  <gnssAntenna>
    <equip:antennaType>ASH701945C_M    UNAV</equip:antennaType>
    <equip:serialNumber>CR520003504</equip:serialNumber>
    <equip:antennaReferencePoint>BPA</equip:antennaReferencePoint>
    <equip:marker-arpUpEcc.>000.0792</equip:marker-arpUpEcc.>
    <equip:marker-arpNorthEcc.>000.0000</equip:marker-arpNorthEcc.>
    <equip:marker-arpEastEcc.>000.0000</equip:marker-arpEastEcc.>
    <equip:alignmentFromTrueNorth>4 west of mag North</equip:alignmentFromTrueNorth>
    <equip:antennaRadomeType>UNAV</equip:antennaRadomeType>
    <equip:radomeSerialNumber></equip:radomeSerialNumber>
    <equip:antennaCableType>(vendor & type number)</equip:antennaCableType>
    <equip:antennaCableLength></equip:antennaCableLength>
    <equip:dateInstalled>2003-02-07T00:00Z</equip:dateInstalled>
    <equip:dateRemoved></equip:dateRemoved>
    <equip:notes>Cable split with a grounded Huber-Shunner protector.  N-type connectors used.  UNAVCO leveling mount. Regal Plastics Chokering Raydome</equip:notes>
  </gnssAntenna>
  <surveyedLocalTies>
    <equip:tiedMarkerName></equip:tiedMarkerName>
    <equip:tiedMarkerUsage>(SLR/VLBI/LOCAL CONTROL/FOOTPRINT/etc)</equip:tiedMarkerUsage>
    <equip:tiedMarkerCDPNumber>(A4)</equip:tiedMarkerCDPNumber>
    <equip:tiedMarkerDOMESNumber></equip:tiedMarkerDOMESNumber>
    <equip:differentialComponentsGNSSMarkerToTiedMonumentsITRS>
      <equip:dX>0</equip:dX>
      <equip:dY>0</equip:dY>
      <equip:dZ>0</equip:dZ>
    </equip:differentialComponentsGNSSMarkerToTiedMonumentsITRS>
    <equip:localSiteTiesAccuracy></equip:localSiteTiesAccuracy>
    <equip:surveyMethod>(GPS CAMPAIGN/TRILATERATION/TRIANGULATION/etc)</equip:surveyMethod>
    <equip:dateMeasured>(CCYY-MM-DDThh:mmZ)</equip:dateMeasured>
    <equip:notes></equip:notes>
  </surveyedLocalTies>
  <frequencyStandard>
    <equip:standardType>INTERNAL</equip:standardType>
    <equip:inputFrequency>(if external)</equip:inputFrequency>
    <equip:effectiveDates>1997-10-10/CCYY-MM-DD</equip:effectiveDates>
    <equip:notes>(multiple lines)</equip:notes>
  </frequencyStandard>
  <humiditySensor>
    <equip:type>Capacitance Probe</equip:type>
    <equip:manufacturer>Paroscientific</equip:manufacturer>
    <equip:serialNumber></equip:serialNumber>
    <equip:heightDiffToAntenna>0.26 m (above antenna)</equip:heightDiffToAntenna>
    <equip:calibrationDate>(CCYY-MM-DD)</equip:calibrationDate>
    <equip:effectiveDates>2004-03-18/2008-05-23</equip:effectiveDates>
    <equip:dataSamplingInterval>5 minutes</equip:dataSamplingInterval>
    <equip:accuracy-percentRelativeHumidity>+/- 2</equip:accuracy-percentRelativeHumidity>
    <equip:aspiration>UNASPIRATED</equip:aspiration>
    <equip:notes>(multiple lines)</equip:notes>
  </humiditySensor>
  <pressureSensor>
    <equip:type>Digiquartz Barometric Standard</equip:type>
    <equip:manufacturer>Paroscientific</equip:manufacturer>
    <equip:serialNumber></equip:serialNumber>
    <equip:heightDiffToAntenna>0.26 m (above antenna)</equip:heightDiffToAntenna>
    <equip:calibrationDate>(CCYY-MM-DD)</equip:calibrationDate>
    <equip:effectiveDates>2004-03-18/2008-05-23</equip:effectiveDates>
    <equip:dataSamplingInterval>5 minutes</equip:dataSamplingInterval>
    <equip:accuracy-hPa>0.1 mbar</equip:accuracy-hPa>
    <equip:notes>(multiple lines)</equip:notes>
  </pressureSensor>
  <temperatureSensor>
    <equip:type>Platinum Resistance Temperature Probe</equip:type>
    <equip:manufacturer>Paroscientific</equip:manufacturer>
    <equip:serialNumber></equip:serialNumber>
    <equip:heightDiffToAntenna>0.26 m (above antenna)</equip:heightDiffToAntenna>
    <equip:calibrationDate>(CCYY-MM-DD)</equip:calibrationDate>
    <equip:effectiveDates>2004-03-18/2008-05-23</equip:effectiveDates>
    <equip:dataSamplingInterval>5 minutes</equip:dataSamplingInterval>
    <equip:accuracy-degreesCelcius>0.5</equip:accuracy-degreesCelcius>
    <equip:aspiration>UNASPIRATED</equip:aspiration>
    <equip:notes>(multiple lines)</equip:notes>
  </temperatureSensor>
  <waterVaporSensor>
    <equip:type></equip:type>
    <equip:manufacturer></equip:manufacturer>
    <equip:serialNumber></equip:serialNumber>
    <equip:heightDiffToAntenna></equip:heightDiffToAntenna>
    <equip:calibrationDate>(CCYY-MM-DD)</equip:calibrationDate>
    <equip:effectiveDates>CCYY-MM-DD/CCYY-MM-DD</equip:effectiveDates>
    <equip:distanceToAntenna></equip:distanceToAntenna>
    <equip:notes>(multiple lines)</equip:notes>
  </waterVaporSensor>
  <contactAgency>
    <contact:agency>Western Survey for Seismic Protection</contact:agency>
    <contact:preferredAbbreviation>WSSP</contact:preferredAbbreviation>
    <contact:mailingAddress>Davidashen</contact:mailingAddress>
    <contact:primaryContact>
      <contact:name>Mr.M.Davtyan</contact:name>
      <contact:telephonePrimary>374 (10) 36-62-80</contact:telephonePrimary>
      <contact:telephoneSecondary>374 (10) 28-28-11</contact:telephoneSecondary>
      <contact:fax></contact:fax>
      <contact:e-mail>office@nssp-gov.am</contact:e-mail>
    </contact:primaryContact>
    <contact:secondaryContact>
      <contact:name>Ruben Stepanyan</contact:name>
      <contact:telephonePrimary>374 (10) 36-62-80</contact:telephonePrimary>
      <contact:telephoneSecondary>374 (10) 28-28-11</contact:telephoneSecondary>
      <contact:fax></contact:fax>
      <contact:e-mail>rubstep@yahoo.com</contact:e-mail>
    </contact:secondaryContact>
    <contact:notes>Massiv IV Yerevan, Armenia 375054 (multiple lines)</contact:notes>
  </contactAgency>
  <responsibleAgency>
    <contact:agency>Jet Propulsion Laboratory</contact:agency>
    <contact:preferredAbbreviation>JPL</contact:preferredAbbreviation>
    <contact:mailingAddress>4800 Oak Grove Drive</contact:mailingAddress>
    <contact:primaryContact>
      <contact:name></contact:name>
      <contact:telephonePrimary></contact:telephonePrimary>
      <contact:telephoneSecondary></contact:telephoneSecondary>
      <contact:fax></contact:fax>
      <contact:e-mail></contact:e-mail>
    </contact:primaryContact>
    <contact:secondaryContact>
      <contact:name>Network Engineer/UNAVCO</contact:name>
      <contact:telephonePrimary>303-381-7500</contact:telephonePrimary>
      <contact:telephoneSecondary></contact:telephoneSecondary>
      <contact:fax>303-381-7451</contact:fax>
      <contact:e-mail>ggn-ops@ls.unavco.org, andreatta@unavco.org</contact:e-mail>
    </contact:secondaryContact>
    <contact:notes>Pasadena, CA USA   91109 Victoria Andreatta (303.381.7458)</contact:notes>
  </responsibleAgency>
  <moreInformation>
    <mi:primaryDataCenter></mi:primaryDataCenter>
    <mi:secondaryDataCenter></mi:secondaryDataCenter>
    <mi:urlForMoreInformation></mi:urlForMoreInformation>
    <mi:hardCopyOnFile/>
    <mi:siteMap>(Y or URL)</mi:siteMap>
    <mi:siteDiagram>(Y or URL)</mi:siteDiagram>
    <mi:horizonMask>(Y or URL)</mi:horizonMask>
    <mi:monumentDescription></mi:monumentDescription>
    <mi:sitePictures>(Y or URL)</mi:sitePictures>
    <mi:notes>(multiple lines)</mi:notes>
    <mi:antennaGraphicsWithDimensions/>
    <mi:insertTextGraphicFromAntenna/>
  </moreInformation>
</igsSiteLog>


text:
namespace Shuttle.Core.Infrastructure
{
    public interface IRegisterObserverForEventAndas
    {
        IRegisterObserverForEventAndas AndEvent(string name);
    }
}