text:
#include <PiDxe.h>

#include <Library/DebugLib.h>
#include <Library/DxeServicesLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/MiscRuntimeLib.h>

// DxeAddMemorySpace
/** Adds reserved memory, system memory, or memory-mapped I/O resources to the
    global coherency domain of the processor.

  @param[in] GcdMemoryType  The type of memory resource being added.
  @param[in] BaseAddress    The physical address that is the start address of
                            the memory resource being added.
  @param[in] Length         The size, in bytes, of the memory resource that is
                            being added.
  @param[in] Capabilities   The bit mask of attributes that the memory resource
                            region supports.

  @retval EFI_SUCCESS            The memory resource was added to the global
                                 coherency domain of the processor.
  @retval EFI_INVALID_PARAMETER  GcdMemoryType is invalid.
  @retval EFI_INVALID_PARAMETER  Length is zero.
  @retval EFI_OUT_OF_RESOURCES   There are not enough system resources to add
                                 the memory resource to the global coherency
                                 domain of the processor.
  @retval EFI_UNSUPPORTED        The processor does not support one or more
                                 bytes of the memory resource range specified
                                 by BaseAddress and Length.
  @retval EFI_ACCESS_DENIED      One or more bytes of the memory resource range
                                 specified by BaseAddress and Length conflicts
                                 with a memory resource range that was
                                 previously added to the global coherency
                                 domain of the processor.
  @retval EFI_ACCESS_DENIED      One or more bytes of the memory resource range
                                 specified by BaseAddress and Length was
                                 allocated in a prior call to
                                 AllocateMemorySpace().
**/
EFI_STATUS
DxeAddMemorySpace (
  IN EFI_GCD_MEMORY_TYPE   GcdMemoryType,
  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
  IN UINT64                Length,
  IN UINT64                Capabilities
  )
{
  EFI_STATUS Status;

  ASSERT ((GcdMemoryType >= EfiGcdMemoryTypeNonExistent)
       && (GcdMemoryType < EfiGcdMemoryTypeMaximum));

  ASSERT (BaseAddress != 0);
  ASSERT (Length > 0);
  ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)BaseAddress));
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->AddMemorySpace != NULL);

  Status = gDS->AddMemorySpace (
                  GcdMemoryType,
                  BaseAddress,
                  Length,
                  Capabilities
                  );

  if ((Status != EFI_UNSUPPORTED) && (Status != EFI_ACCESS_DENIED)) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeAllocateMemorySpace
/** Allocates nonexistent memory, reserved memory, system memory, or
    memorymapped I/O resources from the global coherency domain of the
    processor.

  @param[in]      GcdAllocateType  The type of allocation to perform.
  @param[in]      GcdMemoryType    The type of memory resource being allocated.
  @param[in]      Alignment        The log base 2 of the boundary that
                                   BaseAddress must be aligned on output.
                                   Align with 2^Alignment.
  @param[in]      Length           The size in bytes of the memory resource
                                   range that is being allocated.
  @param[in, out] BaseAddress      A pointer to a physical address to allocate.
  @param[in]      ImageHandle      The image handle of the agent that is
                                   allocating the memory resource.
  @param[in]      DeviceHandle     The device handle for which the memory
                                   resource is being allocated.

  @retval EFI_INVALID_PARAMETER  GcdAllocateType is invalid.
  @retval EFI_INVALID_PARAMETER  GcdMemoryType is invalid.
  @retval EFI_INVALID_PARAMETER  Length is zero.
  @retval EFI_INVALID_PARAMETER  BaseAddress is NULL.
  @retval EFI_INVALID_PARAMETER  ImageHandle is NULL.
  @retval EFI_NOT_FOUND          The memory resource request could not be
                                 satisfied.  No descriptor contains the desired
                                 space.
  @retval EFI_OUT_OF_RESOURCES   There are not enough system resources to
                                 allocate the memory resource from the global
                                 coherency domain of the processor.
  @retval EFI_SUCCESS            The memory resource was allocated from the
                                 global coherency domain of the processor.
**/
EFI_STATUS
DxeAllocateMemorySpace (
  IN     EFI_GCD_ALLOCATE_TYPE  GcdAllocateType,
  IN     EFI_GCD_MEMORY_TYPE    GcdMemoryType,
  IN     UINTN                  Alignment,
  IN     UINT64                 Length,
  IN OUT EFI_PHYSICAL_ADDRESS   *BaseAddress,
  IN     EFI_HANDLE             ImageHandle,
  IN     EFI_HANDLE             DeviceHandle OPTIONAL
  )
{
  EFI_STATUS Status;

  ASSERT ((GcdAllocateType >= EfiGcdAllocateAnySearchBottomUp)
       && (GcdAllocateType < EfiGcdMaxAllocateType));

  ASSERT ((GcdMemoryType >= EfiGcdMemoryTypeNonExistent)
       && (GcdMemoryType < EfiGcdMemoryTypeMaximum));

  ASSERT (Length > 0);
  ASSERT (BaseAddress != NULL);
  ASSERT (ImageHandle != NULL);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->AllocateMemorySpace != NULL);

  Status = gDS->AllocateMemorySpace (
                  GcdAllocateType,
                  GcdMemoryType,
                  Alignment,
                  Length,
                  BaseAddress,
                  ImageHandle,
                  DeviceHandle
                  );

  if (Status != EFI_NOT_FOUND) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeFreeMemorySpace
/** Frees nonexistent memory, reserved memory, system memory, or memory-mapped
    I/O resources from the global coherency domain of the processor.

  @param[in] BaseAddress  The physical address that is the start address of the
                          memory resource being freed.
  @param[in] Length       The size in bytes of the memory resource range that
                          is being freed.

  @retval EFI_SUCCESS            The memory resource was freed from the global
                                 coherency domain of the processor.
  @retval EFI_INVALID_PARAMETER  Length is zero.
  @retval EFI_UNSUPPORTED        The processor does not support one or more
                                 bytes of the memory resource range specified
                                 by BaseAddress and Length.
  @retval EFI_NOT_FOUND          The memory resource range specified by
                                 BaseAddress and Length was not allocated with
                                 previous calls to AllocateMemorySpace().
  @retval EFI_OUT_OF_RESOURCES   There are not enough system resources to free
                                 the memory resource from the global
                                 coherency domain of the processor.
**/
EFI_STATUS
DxeFreeMemorySpace (
  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
  IN UINT64                Length
  )
{
  EFI_STATUS Status;

  ASSERT (BaseAddress != 0);
  ASSERT (Length > 0);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->FreeMemorySpace != NULL);

  Status = gDS->FreeMemorySpace (BaseAddress, Length);

  if ((Status != EFI_NOT_FOUND) && (Status != EFI_NOT_FOUND)) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeRemoveMemorySpace
/** Removes reserved memory, system memory, or memory-mapped I/O resources from
    the global coherency domain of the processor.

  @param[in] BaseAddress  The physical address that is the start address of the
                          memory resource being removed.
  @param[in] Length       The size in bytes of the memory resource that is
                          being removed.

  @retval EFI_SUCCESS            The memory resource was removed from the
                                 global coherency domain of the processor.
  @retval EFI_INVALID_PARAMETER  Length is zero.
  @retval EFI_UNSUPPORTED        The processor does not support one or more
                                 bytes of the memory resource range specified
                                 by BaseAddress and Length.
  @retval EFI_NOT_FOUND          One or more bytes of the memory resource range
                                 specified by BaseAddress and Length was
                                 not added with previous calls to
                                 AddMemorySpace().
  @retval EFI_ACCESS_DEFINED     One or more bytes of the memory resource range
                                 specified by BaseAddress and Length has
                                 been allocated with AllocateMemorySpace().
  @retval EFI_OUT_OF_RESOURCES   There are not enough system resources to
                                 remove the memory  resource from the global
                                 coherency domain of the processor.
**/
EFI_STATUS
DxeRemoveMemorySpace (
  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
  IN UINT64                Length
  )
{
  EFI_STATUS Status;

  ASSERT (BaseAddress != 0);
  ASSERT (Length > 0);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->RemoveMemorySpace != NULL);

  Status = gDS->RemoveMemorySpace (BaseAddress, Length);

  if ((Status != EFI_UNSUPPORTED)
   && (Status != EFI_NOT_FOUND)
   && (Status != EFI_ACCESS_DENIED)) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeGetMemorySpaceDescriptor
/** Retrieves the descriptor for a memory region containing a specified
    address.

  @param[in]  BaseAddress  The physical address that is the start address of a
                           memory region.
  @param[out] Descriptor   A pointer to a caller allocated descriptor.

  @retval EFI_SUCCESS            The descriptor for the memory resource region
                                 containing BaseAddress was returned in
                                 Descriptor.
  @retval EFI_INVALID_PARAMETER  Descriptor is NULL.
  @retval EFI_NOT_FOUND          A memory resource range containing BaseAddress
                                 was not found.
**/
EFI_STATUS
DxeGetMemorySpaceDescriptor (
  IN  EFI_PHYSICAL_ADDRESS             BaseAddress,
  OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR  *Descriptor
  )
{
  EFI_STATUS Status;

  ASSERT (BaseAddress != 0);
  ASSERT (Descriptor != NULL);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->GetMemorySpaceDescriptor != NULL);

  Status = gDS->GetMemorySpaceDescriptor (BaseAddress, Descriptor);

  if (Status != EFI_NOT_FOUND) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeSetMemorySpaceAttributes
/** Modifies the attributes for a memory region in the global coherency domain
    of the processor.

  @param[in] BaseAddress  The physical address that is the start address of a
                          memory region.
  @param[in] Length       The size in bytes of the memory region.
  @param[in] Attributes   The bit mask of attributes to set for the memory
                          region.

  @retval EFI_SUCCESS            The attributes were set for the memory region.
  @retval EFI_INVALID_PARAMETER  Length is zero.
  @retval EFI_UNSUPPORTED        The processor does not support one or more
                                 bytes of the memory resource range specified
                                 by BaseAddress and Length.
  @retval EFI_UNSUPPORTED        The bit mask of attributes is not support for
                                 the memory resource range specified by
                                 BaseAddress and Length.
  @retval EFI_ACCESS_DENIED      The attributes for the memory resource range
                                 specified by BaseAddress and Length cannot be
                                 modified.
  @retval EFI_OUT_OF_RESOURCES   There are not enough system resources to
                                 modify the attributes of the memory resource
                                 range.
  @retval EFI_NOT_AVAILABLE_YET  The attributes cannot be set because CPU
                                 architectural protocol is not available yet.
**/
EFI_STATUS
DxeSetMemorySpaceAttributes (
  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
  IN UINT64                Length,
  IN UINT64                Attributes
  )
{
  EFI_STATUS Status;

  ASSERT (BaseAddress != 0);
  ASSERT (Length > 0);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->SetMemorySpaceAttributes != NULL);

  Status = gDS->SetMemorySpaceAttributes (BaseAddress, Length, Attributes);

  if ((Status != EFI_UNSUPPORTED) && (Status != EFI_ACCESS_DENIED)) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeSetMemorySpaceCapabilities
/** Modifies the capabilities for a memory region in the global coherency
    domain of the processor.

  @param[in] BaseAddress   The physical address that is the start address of a
                           memory region.
  @param[in] Length        The size in bytes of the memory region.
  @param[in] Capabilities  The bit mask of capabilities that the memory region
                           supports.

  @retval EFI_SUCCESS            The capabilities were set for the memory
                                 region.
  @retval EFI_INVALID_PARAMETER  Length is zero.
  @retval EFI_UNSUPPORTED        The capabilities specified by Capabilities do
                                 not include the memory region attributes
                                 currently in use.
  @retval EFI_ACCESS_DENIED      The capabilities for the memory resource range
                                 specified by BaseAddress and Length cannot be
                                 modified.
  @retval EFI_OUT_OF_RESOURCES   There are not enough system resources to
                                 modify the capabilities of the memory resource
                                 range.
**/
EFI_STATUS
DxeSetMemorySpaceCapabilities (
  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
  IN UINT64                Length,
  IN UINT64                Capabilities
  )
{
  EFI_STATUS Status;

  ASSERT (BaseAddress != 0);
  ASSERT (Length > 0);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->SetMemorySpaceCapabilities != NULL);

  Status = gDS->SetMemorySpaceCapabilities (BaseAddress, Length, Capabilities);

  if ((Status != EFI_UNSUPPORTED) && (Status != EFI_ACCESS_DENIED)) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeGetMemorySpaceMap
/** Returns a map of the memory resources in the global coherency domain of the
    processor.

  @param[out] NumberOfDescriptors  A pointer to number of descriptors returned
                                   in the MemorySpaceMap buffer.
  @param[out] MemorySpaceMap       A pointer to the array of
                                   EFI_GCD_MEMORY_SPACE_DESCRIPTORs.

  @retval EFI_SUCCESS            The memory space map was returned in the
                                 MemorySpaceMap buffer, and the number of
                                 descriptors in MemorySpaceMap was returned in
                                 NumberOfDescriptors.
  @retval EFI_INVALID_PARAMETER  NumberOfDescriptors is NULL.
  @retval EFI_INVALID_PARAMETER  MemorySpaceMap is NULL.
  @retval EFI_OUT_OF_RESOURCES   There are not enough resources to allocate
                                 MemorySpaceMap.
**/
EFI_STATUS
DxeGetMemorySpaceMap (
  OUT UINTN                            *NumberOfDescriptors,
  OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR  **MemorySpaceMap
  )
{
  EFI_STATUS Status;

  ASSERT (NumberOfDescriptors != NULL);
  ASSERT (MemorySpaceMap != NULL);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->GetMemorySpaceMap != NULL);

  Status = gDS->GetMemorySpaceMap (NumberOfDescriptors, MemorySpaceMap);

  ASSERT_EFI_ERROR (Status);

  return Status;
}

// DxeAddIoSpace
/** Adds reserved I/O or I/O resources to the global coherency domain of the
    processor.

  @param[in] GcdIoType    The type of I/O resource being added.
  @param[in] BaseAddress  The physical address that is the start address of the
                          I/O resource being added.
  @param[in] Length       The size in bytes of the I/O resource that is being
                          added.

  @retval EFI_SUCCESS            The I/O resource was added to the global
                                 coherency domain of the processor.
  @retval EFI_INVALID_PARAMETER  GcdIoType is invalid.
  @retval EFI_INVALID_PARAMETER  Length is zero.
  @retval EFI_OUT_OF_RESOURCES   There are not enough system resources to add
                                 the I/O resource to the global coherency domain
                                 of the processor.
  @retval EFI_UNSUPPORTED        The processor does not support one or more
                                 bytes of the I/O resource range specified by
                                 BaseAddress and Length.
  @retval EFI_ACCESS_DENIED      One or more bytes of the I/O resource range
                                 specified by BaseAddress and Length conflicts
                                 with an I/O resource range that was previously
                                 added to the global coherency domain of the
                                 processor.
  @retval EFI_ACCESS_DENIED      One or more bytes of the I/O resource range
                                 specified by BaseAddress and Length was
                                 allocated in a prior call to
                                 AllocateIoSpace().

**/
EFI_STATUS
DxeAddIoSpace (
  IN EFI_GCD_IO_TYPE       GcdIoType,
  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
  IN UINT64                Length
  )
{
  EFI_STATUS Status;

  ASSERT ((GcdIoType >= EfiGcdIoTypeNonExistent)
       && (GcdIoType < EfiGcdIoTypeMaximum));

  ASSERT (BaseAddress != 0);
  ASSERT (Length > 0);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->AddIoSpace != NULL);

  Status = gDS->AddIoSpace (GcdIoType, BaseAddress, Length);

  if ((Status != EFI_UNSUPPORTED) && (Status != EFI_ACCESS_DENIED)) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeAllocateIoSpace
/** Allocates nonexistent I/O, reserved I/O, or I/O resources from the global
    coherency domain of the processor.

  @param[in]      GcdAllocateType  The type of allocation to perform.
  @param[in]      GcdIoType        The type of I/O resource being allocated.
  @param[in]      Alignment        The log base 2 of the boundary that
                                   BaseAddress must be aligned on output.
  @param[in]      Length           The size in bytes of the I/O resource range
                                   that is being allocated.
  @param[in, out] BaseAddress      A pointer to a physical address.
  @param[in]      ImageHandle      The image handle of the agent that is
                                   allocating the I/O resource.
  @param[in]      DeviceHandle     The device handle for which the I/O resource
                                   is being allocated.

  @retval EFI_SUCCESS            The I/O resource was allocated from the global
                                 coherency domain of the processor.
  @retval EFI_INVALID_PARAMETER  GcdAllocateType is invalid.
  @retval EFI_INVALID_PARAMETER  GcdIoType is invalid.
  @retval EFI_INVALID_PARAMETER  Length is zero.
  @retval EFI_INVALID_PARAMETER  BaseAddress is NULL.
  @retval EFI_INVALID_PARAMETER  ImageHandle is NULL.
  @retval EFI_OUT_OF_RESOURCES   There are not enough system resources to
                                 allocate the I/O resource from the global
                                 coherency domain of the processor.
  @retval EFI_NOT_FOUND          The I/O resource request could not be
                                 satisfied.
**/
EFI_STATUS
DxeAllocateIoSpace (
  IN     EFI_GCD_ALLOCATE_TYPE  GcdAllocateType,
  IN     EFI_GCD_IO_TYPE        GcdIoType,
  IN     UINTN                  Alignment,
  IN     UINT64                 Length,
  IN OUT EFI_PHYSICAL_ADDRESS   *BaseAddress,
  IN     EFI_HANDLE             ImageHandle,
  IN     EFI_HANDLE             DeviceHandle OPTIONAL
  )
{
  EFI_STATUS Status;

  ASSERT ((GcdAllocateType >= EfiGcdAllocateAnySearchBottomUp)
       && (GcdAllocateType < EfiGcdMaxAllocateType));

  ASSERT ((GcdIoType >= EfiGcdIoTypeNonExistent)
       && (GcdIoType < EfiGcdIoTypeMaximum));

  ASSERT (Length > 0);
  ASSERT (BaseAddress != NULL);
  ASSERT (ImageHandle != NULL);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->AllocateIoSpace != NULL);

  Status = gDS->AllocateIoSpace (
                  GcdAllocateType,
                  GcdIoType,
                  Alignment,
                  Length,
                  BaseAddress,
                  ImageHandle,
                  DeviceHandle
                  );

  if (Status != EFI_NOT_FOUND) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeFreeIoSpace
/** Frees nonexistent I/O, reserved I/O, or I/O resources from the global
    coherency domain of the processor.

  @param[in] BaseAddress  The physical address that is the start address of the
                          I/O resource being freed.
  @param[in] Length       The size in bytes of the I/O resource range that is
                          being freed.

  @retval EFI_SUCCESS            The I/O resource was freed from the global
                                 coherency domain of the processor.
  @retval EFI_INVALID_PARAMETER  Length is zero.
  @retval EFI_UNSUPPORTED        The processor does not support one or more
                                 bytes of the I/O resource range specified
                                 by BaseAddress and Length.
  @retval EFI_NOT_FOUND          The I/O resource range specified by
                                 BaseAddress and Length was not allocated with
                                 previous calls to AllocateIoSpace().
  @retval EFI_OUT_OF_RESOURCES   There are not enough system resources to free
                                 the I/O resource from the global coherency
                                 domain of the processor.
**/
EFI_STATUS
DxeFreeIoSpace (
  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
  IN UINT64                Length
  )
{
  EFI_STATUS Status;

  ASSERT (BaseAddress != 0);
  ASSERT (Length > 0);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->FreeIoSpace != NULL);

  Status = gDS->FreeIoSpace (BaseAddress, Length);

  if ((Status != EFI_UNSUPPORTED) && (Status != EFI_NOT_FOUND)) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeRemoveIoSpace
/** Removes reserved I/O or I/O resources from the global coherency domain of
    the processor.

  @param[in] BaseAddress  A pointer to a physical address that is the start
                          address of the I/O resource being removed.
  @param[in] Length       The size in bytes of the I/O resource that is being
                          removed.

  @retval EFI_SUCCESS            The I/O resource was removed from the global
                                 coherency domain of the processor.
  @retval EFI_INVALID_PARAMETER  Length is zero.
  @retval EFI_UNSUPPORTED        The processor does not support one or more
                                 bytes of the I/O resource range specified by
                                 BaseAddress and Length.
  @retval EFI_NOT_FOUND          One or more bytes of the I/O resource range
                                 specified by BaseAddress and Length was
                                 not added with previous calls to AddIoSpace().
  @retval EFI_ACCESS_DENIED      One or more bytes of the I/O resource range
                                 specified by BaseAddress and Length has been
                                 allocated with AllocateIoSpace().
  @retval EFI_OUT_OF_RESOURCES   There are not enough system resources to
                                 remove the I/O resource from the global
                                 coherency domain of the processor.
**/
EFI_STATUS
DxeRemoveIoSpace (
  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
  IN UINT64                Length
  )
{
  EFI_STATUS Status;

  ASSERT (BaseAddress != 0);
  ASSERT (Length > 0);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->RemoveIoSpace != NULL);

  Status = gDS->RemoveIoSpace (BaseAddress, Length);

  if ((Status != EFI_UNSUPPORTED) && (Status != EFI_NOT_FOUND)) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeGetIoSpaceDescriptor
/** Retrieves the descriptor for an I/O region containing a specified address.

  @param[in]  BaseAddress  The physical address that is the start address of an
                           I/O region.
  @param[out] Descriptor   A pointer to a caller allocated descriptor.

  @retval EFI_SUCCESS            The descriptor for the I/O resource region
                                 containing BaseAddress was returned in
                                 Descriptor.
  @retval EFI_INVALID_PARAMETER  Descriptor is NULL.
  @retval EFI_NOT_FOUND          An I/O resource range containing BaseAddress
                                 was not found.
**/
EFI_STATUS
DxeGetIoSpaceDescriptor (
  IN  EFI_PHYSICAL_ADDRESS         BaseAddress,
  OUT EFI_GCD_IO_SPACE_DESCRIPTOR  *Descriptor
  )
{
  EFI_STATUS Status;

  ASSERT (BaseAddress != 0);
  ASSERT (Descriptor != NULL);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->GetIoSpaceDescriptor != NULL);

  Status = gDS->GetIoSpaceDescriptor (BaseAddress, Descriptor);

  if (Status != EFI_NOT_FOUND) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeGetIoSpaceMap
/** Returns a map of the I/O resources in the global coherency domain of the
    processor.

  @param[out] NumberOfDescriptors  A pointer to number of descriptors returned
                                   in the IoSpaceMap buffer.
  @param[out] IoSpaceMap           A pointer to the array of
                                   EFI_GCD_IO_SPACE_DESCRIPTORs.

  @retval EFI_SUCCESS            The I/O space map was returned in the
                                 IoSpaceMap buffer, and the number of
                                 descriptors in IoSpaceMap was returned in
                                 NumberOfDescriptors.
  @retval EFI_INVALID_PARAMETER  NumberOfDescriptors is NULL.
  @retval EFI_INVALID_PARAMETER  IoSpaceMap is NULL.
  @retval EFI_OUT_OF_RESOURCES   There are not enough resources to allocate
                                 IoSpaceMap.
**/
EFI_STATUS
DxeGetIoSpaceMap (
  OUT UINTN                        *NumberOfDescriptors,
  OUT EFI_GCD_IO_SPACE_DESCRIPTOR  **IoSpaceMap
  )
{
  EFI_STATUS Status;

  ASSERT (NumberOfDescriptors != NULL);
  ASSERT (IoSpaceMap != NULL);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->GetIoSpaceMap != NULL);

  Status = gDS->GetIoSpaceMap (NumberOfDescriptors, IoSpaceMap);

  ASSERT_EFI_ERROR (Status);

  return Status;
}

// DxeDispatch
/** Loads and executed DXE drivers from firmware volumes.

  The Dispatch() function searches for DXE drivers in firmware volumes that
  have been installed since the last time the Dispatch() service was called.
  It then evaluates the dependency expressions of all the DXE drivers and loads
  and executes those DXE drivers whose dependency expression evaluate to TRUE.
  This service must interact with the Security Architectural Protocol to
  authenticate DXE drivers before they are executed.  This process is continued
  until no more DXE drivers can be executed.

  @retval EFI_SUCCESS          One or more DXE driver were dispatched.
  @retval EFI_NOT_FOUND        No DXE drivers were dispatched.
  @retval EFI_ALREADY_STARTED  An attempt is being made to start the DXE
                               Dispatcher recursively. Thus, no action was
                               taken.
**/
EFI_STATUS
DxeDispatch (
  VOID
  )
{
  EFI_STATUS Status;

  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->Dispatch != NULL);

  Status = gDS->Dispatch ();

  if (Status != EFI_NOT_FOUND) {
    ASSERT_EFI_ERROR (Status);
  }

  return Status;
}

// DxeSchedule
/** Clears the Schedule on Request (SOR) flag for a component that is stored in
    a firmware volume.

  @param[in] FirmwareVolumeHandle  The handle of the firmware volume that
                                   contains the file specified by FileName.
  @param[in] FileName              A pointer to the name of the file in a
                                   firmware volume.

  @retval EFI_SUCCESS    The DXE driver was found and its SOR bit was cleared.
  @retval EFI_NOT_FOUND  The DXE driver does not exist, or the DXE driver
                         exists and its SOR bit is not set.
**/
EFI_STATUS
DxeSchedule (
  IN EFI_HANDLE      FirmwareVolumeHandle,
  IN CONST EFI_GUID  *FileName
  )
{
  EFI_STATUS Status;

  ASSERT (FirmwareVolumeHandle != NULL);
  ASSERT (FileName != NULL);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->Schedule != NULL);

  Status = gDS->Schedule (FirmwareVolumeHandle, FileName);

  ASSERT_EFI_ERROR (Status);

  return Status;
}

// DxeTrust
/** Promotes a file stored in a firmware volume from the untrusted to the
    trusted state.

  @param[in] FirmwareVolumeHandle  The handle of the firmware volume that
                                   contains the file specified by FileName.
  @param[in] FileName              A pointer to the name of the file in a
                                   firmware volume.

  @return                Status of promoting FFS from untrusted to trusted
                         state.
  @retval EFI_NOT_FOUND  The file was not found in the untrusted state.
**/
EFI_STATUS
DxeTrust (
  IN EFI_HANDLE      FirmwareVolumeHandle,
  IN CONST EFI_GUID  *FileName
  )
{
  EFI_STATUS Status;

  ASSERT (FirmwareVolumeHandle != NULL);
  ASSERT (FileName != NULL);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->Trust != NULL);

  Status = gDS->Trust (FirmwareVolumeHandle, FileName);

  ASSERT_EFI_ERROR (Status);

  return Status;
}

// DxeProcessFirmwareVolume
/** Creates a firmware volume handle for a firmware volume that is present in
    system memory.

  @param[in]  FirmwareVolumeHeader  A pointer to the header of the firmware
                                    volume.
  @param[in]  Size                  The size, in bytes, of the firmware volume.
  @param[out] FirmwareVolumeHandle  On output, a pointer to the created handle.

  @retval EFI_SUCCESS           The EFI_FIRMWARE_VOLUME_PROTOCOL and
                                EFI_DEVICE_PATH_PROTOCOL were installed onto
                                FirmwareVolumeHandle for the firmware volume
                                described by FirmwareVolumeHeader and Size.
  @retval EFI_VOLUME_CORRUPTED  The firmware volume described by
                                FirmwareVolumeHeader and Size is corrupted.
  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources available
                                to produce the EFI_FIRMWARE_VOLUME_PROTOCOL and
                                EFI_DEVICE_PATH_PROTOCOL for the firmware
                                volume described by FirmwareVolumeHeader and
                                Size.
**/
EFI_STATUS
DxeProcessFirmwareVolume (
  IN  CONST VOID  *FirmwareVolumeHeader,
  IN  UINTN       Size,
  OUT EFI_HANDLE  *FirmwareVolumeHandle
  )
{
  EFI_STATUS Status;

  ASSERT (FirmwareVolumeHeader != NULL);
  ASSERT (Size > 0);
  ASSERT (FirmwareVolumeHandle != NULL);
  ASSERT (!EfiAtRuntime ());
  ASSERT (gDS->ProcessFirmwareVolume != NULL);

  Status = gDS->ProcessFirmwareVolume (
                  FirmwareVolumeHeader,
                  Size,
                  FirmwareVolumeHandle
                  );

  ASSERT_EFI_ERROR (Status);

  return Status;
}


text:
var Element = require('./element.js');

module.exports = new (function() {

  /**
   * Given an element name, returns that element object
   *
   * @param {Object} parent The parent page or section
   * @param {string} elementName Name of element
   * @returns {Object} The element object
   */
  function getElement(parent, elementName) {
    elementName = elementName.substring(1);
    if (!(elementName in parent.elements)) {
      throw new Error(elementName + ' was not found in "' + parent.name +
        '". Available elements: ' + Object.keys(parent.elements));
    }
    return parent.elements[elementName];
  }

  /**
   * Given a section name, returns that section object
   *
   * @param {Object} parent The parent page or section
   * @param {string} sectionName Name of section
   * @returns {Object} The section object
   */
  function getSection(parent, sectionName) {
    sectionName = sectionName.substring(1);
    if (!(sectionName in parent.section)) {
      throw new Error(sectionName + ' was not found in "' + parent.name +
        '". Available sections: ' + Object.keys(parent.sections));
    }
    return parent.section[sectionName];
  }

  /**
   * Creates a closure that enables calling commands and assertions on the page or section.
   * For all element commands and assertions, it fetches element's selector and locate strategy
   *  For elements nested under sections, it sets 'recursion' as the locate strategy and passes as its first argument to the command an array of its ancestors + self
   *  If the command or assertion is not on an element, it calls it with the untouched passed arguments
   *
   * @param {Object} parent The parent page or section
   * @param {function} commandFn The actual command function
   * @param {string} commandName The name of the command ("click", "containsText", etc)
   * @param {Boolean} [isChaiAssertion]
   * @returns {function}
   */
  function makeWrappedCommand(parent, commandFn, commandName, isChaiAssertion) {

    var isSectionSelector = isChaiAssertion && commandName === 'section';

    return function() {
      var args = Array.prototype.slice.call(arguments);
      parseElementSelector(args, parent, isSectionSelector);
      var result = commandFn.apply(parent.client, args);
      return isChaiAssertion ? result : parent;
    };
  }

  /**
   * Identifies element references (@-prefixed selectors) within an argument
   * list and converts it into an element object with the appropriate
   * selector or recursion chain of selectors.
   *
   * @param {Array} args The argument list to check for an element selector.
   * @param {Object} parent The parent page or section.
   * @param {boolean} isSectionSelector When true, indicates that the selector references
   *    a selector within a section rather than an elements definition.
   */
  function parseElementSelector (args, parent, isSectionSelector) {

    // currently only support first argument for @-elements
    var possibleElementSelector = args[0];
    var inputElement = possibleElementSelector && Element.fromSelector(possibleElementSelector);
    if (inputElement && inputElement.hasElementSelector()) {

      var getter = isSectionSelector ? getSection : getElement;
      var elementOrSection = getter(parent, inputElement.selector);

      Element.copyDefaults(inputElement, elementOrSection);
      inputElement.selector = elementOrSection.selector; // force replacement of @-selector

      inputElement = inputElement.getRecursiveLookupElement() || inputElement;
      args[0] = inputElement;
    }
  }

  /**
   * Adds commands (elements commands, assertions, etc) to the page or section
   *
   * @param {Object} parent The parent page or section
   * @param {Object} target What the command is added to (parent|section or assertion object on parent|section)
   * @param {Object} commands
   * @returns {null}
   */
  function applyCommandsToTarget(parent, target, commands) {

    Object.keys(commands).forEach(function(commandName) {
      if (isValidAssertion(commandName)) {
        target[commandName] = target[commandName] || {};

        var isChaiAssertion = commandName === 'expect';
        var assertions = commands[commandName];

        Object.keys(assertions).forEach(function(assertionName) {
          target[commandName][assertionName] = addCommand(target[commandName], assertions[assertionName], assertionName, parent, isChaiAssertion);
        });
      } else {
        target[commandName] = addCommand(target, commands[commandName], commandName, parent, false);
      }
    });
  }

  function addCommand(target, commandFn, commandName, parent, isChaiAssertion) {
    if (target[commandName]) {
      parent.client.results.errors++;
      var error = new Error('The command "' + commandName + '" is already defined!');
      parent.client.errors.push(error.stack);
      throw error;
    }

    return makeWrappedCommand(parent, commandFn, commandName, isChaiAssertion);
  }

  function isValidAssertion(commandName) {
    return ['assert', 'verify', 'expect'].indexOf(commandName) > -1;
  }

  /**
   * Entrypoint to add commands (elements commands, assertions, etc) to the page or section
   *
   * @param {Object} parent The parent page or section
   * @param {function} commandLoader function that retrieves commands
   * @returns {null}
   */
  this.addWrappedCommands = function (parent, commandLoader) {
    var commands = {};
    commands = commandLoader(commands);
    applyCommandsToTarget(parent, parent, commands);
  };

})();

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2015 adesso Schweiz AG (www.adesso.ch)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.wte4j</groupId>
	<artifactId>wte4j-parent</artifactId>
	<version>0.1.4-SNAPSHOT</version>
	<packaging>pom</packaging>

	<name>wte4j</name>
	<inceptionYear>2015</inceptionYear>
	<url>https://github.com/wte4j/wte4j</url>
	<description>
		A Engine to generate docx documents form templates and manage these templates
	</description>

	<scm>
		<connection>scm:git:git@github.com:wte4j/wte4j.git</connection>
		<url>scm:git:git@github.com:wte4j/wte4j.git</url>
		<developerConnection>scm:git:git@github.com:wte4j/wte4j.git</developerConnection>
		<tag>HEAD</tag>
	</scm>

	<distributionManagement>
		<snapshotRepository>
			<id>ossrh</id>
			<name>Sonatype Nexus snapshot repository</name>
			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
		</snapshotRepository>

		<repository>
			<id>ossrh</id>
			<name>Sonatype Nexus release repository</name>
			<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
		</repository>
	</distributionManagement>

	<licenses>
		<license>
			<name>The Apache Software License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
			<comments>A business-friendly OSS license</comments>
		</license>
	</licenses>

	<developers>
		<developer>
			<name>Oliver Freivogel</name>
			<email>oliver.freivogel@born.ch</email>
		</developer>

		<developer>
			<name>Thomas Selber</name>
			<email>thomas.selber@born.ch</email>
		</developer>

		<developer>
			<name>Thomas Stettler</name>
			<email>thomas.stettler@born.ch</email>
		</developer>

	</developers>

	<modules>
		<module>wte4j-core</module>
		<module>wte4j-admin</module>
		<module>wte4j-admin-auth</module>
		<module>wte4j-admin-war</module>
		<module>wte4j-showcase</module>
		<module>wte4j-distribution</module>
	</modules>
	<properties>
		<maven.compiler.source>1.7</maven.compiler.source>
		<maven.compiler.target>1.7</maven.compiler.target>

		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

		<!-- Framework Versions -->
		<spring.version>4.1.3.RELEASE</spring.version>
		<openJPA.version>2.3.0</openJPA.version>
		<slf4j.version>1.7.7</slf4j.version>
		<gwtVersion>2.7.0</gwtVersion>

		<argLine>-XX:MaxPermSize=96m</argLine>
	</properties>

	<build>
		<plugins>

			<plugin>
				<groupId>com.mycila</groupId>
				<artifactId>license-maven-plugin</artifactId>
				<version>2.8</version>
				<configuration>
					<header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</header>
					<properties>
						<owner>adesso Schweiz AG</owner>
						<email>www.adesso.ch</email>
					</properties>
					<excludes>
						<exclude>**/NOTICE</exclude>
						<exclude>**/LICENSE</exclude>
						<exclude>**/.coveralls.yml</exclude>
						<exclude>**/*.docx</exclude>
					</excludes>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>check</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-release-plugin</artifactId>
				<version>2.5.2</version>
				<configuration>
					<autoVersionSubmodules>true</autoVersionSubmodules>
					<useReleaseProfile>false</useReleaseProfile>
					<releaseProfiles>release</releaseProfiles>
					<goals>deploy</goals>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.eluder.coveralls</groupId>
				<artifactId>coveralls-maven-plugin</artifactId>
				<version>3.1.0</version>
			</plugin>
			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>0.7.5.201505241946</version>
				<executions>
					<execution>
						<id>prepare-agent</id>
						<goals>
							<goal>prepare-agent</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>

		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>3.1</version>
					<configuration>
						<source>1.7</source>
						<target>1.7</target>
					</configuration>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-deploy-plugin</artifactId>
					<version>2.8.2</version>
				</plugin>

				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>license-maven-plugin</artifactId>
					<version>1.8</version>
					<configuration>
						<excludedGroups>${project.groupId}</excludedGroups>
						<includedScopes>compile,runtime</includedScopes>
						<licenseMerges>
							<licenseMerge>The Apache Software License, Version 2.0|Apache 2|Apache Software License 2.0|Apache License, Version 2.0|
								http://www.apache.org/licenses/LICENSE-2.0.txt|Apache License Version
								2|GWT Terms
							</licenseMerge>
							<licenseMerge>Apache Software Licenses|Apache Software License</licenseMerge>
							<licenseMerge>BSD Style License|BSD|BSD style|BSD style License</licenseMerge>
							<licenseMerge>MIT License|MIT license|The MIT License</licenseMerge>
							<licenseMerge>Common Development and Distribution License (CDDL), version 1.0|COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0|Common Public License Version 1.0</licenseMerge>
						</licenseMerges>
						<includedLicenses>
							<includedLicense>The Apache Software License, Version 2.0</includedLicense>
							<includedLicense>Apache Software Licenses</includedLicense>
							<includedLicense>MIT License</includedLicense>
							<includedLicense>BSD Style License</includedLicense>
							<includedLicense>New BSD License</includedLicense>
							<includedLicense>Public Domain</includedLicense>
							<includedLicense>Common Development and Distribution License (CDDL), version 1.0</includedLicense>
							<includedLicense>HSQLDB License, a BSD open source license</includedLicense>
							<includedLicense>Mozilla Public License version 1.1</includedLicense>
						</includedLicenses>
					</configuration>
				</plugin>

						<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.apache.openjpa</groupId>
										<artifactId>openjpa-maven-plugin</artifactId>
										<versionRange>[2.3.0,)</versionRange>
										<goals>
											<goal>enhance</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.apache.openjpa</groupId>
										<artifactId>openjpa-maven-plugin</artifactId>
										<versionRange>[2.3.0,)</versionRange>
										<goals>
											<goal>test-enhance</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.apache.openjpa</groupId>
										<artifactId>openjpa-maven-plugin</artifactId>
										<versionRange>[2.3.0,)</versionRange>
										<goals>
											<goal>sql</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.apache.maven.plugins</groupId>
										<artifactId>maven-dependency-plugin</artifactId>
										<versionRange>[2.10,)</versionRange>
										<goals>
											<goal>unpack-dependencies</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.codehaus.mojo</groupId>
										<artifactId>gwt-maven-plugin</artifactId>
										<versionRange>[2.7.0,)</versionRange>
										<goals>
											<goal>resources</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>

		</pluginManagement>
	</build>

	<dependencyManagement>
		<dependencies>

			<!-- standards -->
			<dependency>
				<groupId>javax.servlet</groupId>
				<artifactId>javax.servlet-api</artifactId>
				<version>3.0.1</version>
				<scope>provided</scope>
			</dependency>
			<dependency>
				<groupId>javax.servlet.jsp</groupId>
				<artifactId>jsp-api</artifactId>
				<version>2.2</version>
				<scope>provided</scope>
			</dependency>

			<dependency>
				<groupId>org.apache.taglibs</groupId>
				<artifactId>taglibs-standard-spec</artifactId>
				<version>1.2.5</version>
			</dependency>

			<dependency>
				<groupId>org.apache.taglibs</groupId>
				<artifactId>taglibs-standard-impl</artifactId>
				<version>1.2.5</version>
			</dependency>

			<dependency>
				<groupId>org.apache.geronimo.specs</groupId>
				<artifactId>geronimo-jpa_2.0_spec</artifactId>
				<version>1.1</version>
			</dependency>

			<dependency>
				<groupId>javax.validation</groupId>
				<artifactId>validation-api</artifactId>
				<version>1.1.0.Final</version>
			</dependency>

			<dependency>
				<groupId>org.apache.commons</groupId>
				<artifactId>commons-lang3</artifactId>
				<version>3.3.2</version>
			</dependency>

			<dependency>
				<groupId>commons-beanutils</groupId>
				<artifactId>commons-beanutils</artifactId>
				<version>1.9.2</version>
				<exclusions>
					<exclusion>
						<groupId>commons-logging</groupId>
						<artifactId>commons-logging</artifactId>
					</exclusion>
				</exclusions>
			</dependency>

			<dependency>
				<groupId>org.apache.commons</groupId>
				<artifactId>commons-collections4</artifactId>
				<version>4.0</version>
			</dependency>

			<dependency>
				<groupId>org.apache.commons</groupId>
				<artifactId>commons-dbcp2</artifactId>
				<version>2.1</version>
				<exclusions>
					<exclusion>
						<groupId>commons-logging</groupId>
						<artifactId>commons-logging</artifactId>
					</exclusion>
				</exclusions>
			</dependency>

			<dependency>
				<groupId>commons-io</groupId>
				<artifactId>commons-io</artifactId>
				<version>2.4</version>
			</dependency>			<!-- ===== Springframework ====== -->

			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-framework-bom</artifactId>
				<version>${spring.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-core</artifactId>
				<version>${spring.version}</version>
				<exclusions>
					<exclusion>
						<artifactId>commons-logging</artifactId>
						<groupId>commons-logging</groupId>
					</exclusion>
				</exclusions>
			</dependency>

			<!-- JPA Provider -->

			<dependency>
				<groupId>org.apache.openjpa</groupId>
				<artifactId>openjpa</artifactId>
				<version>${openJPA.version}</version>
				<exclusions>
					<exclusion>
						<artifactId>commons-pool</artifactId>
						<groupId>commons-pool</groupId>
					</exclusion>
				</exclusions>
			</dependency>

			<!-- database -->
			<dependency>
				<groupId>org.hsqldb</groupId>
				<artifactId>hsqldb</artifactId>
				<version>2.3.2</version>
			</dependency>

			<!-- logging -->

			<dependency>
				<groupId>log4j</groupId>
				<artifactId>log4j</artifactId>
				<version>1.2.17</version>
			</dependency>

			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>slf4j-log4j12</artifactId>
				<version>${slf4j.version}</version>
			</dependency>

			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>slf4j-jdk14</artifactId>
				<version>${slf4j.version}</version>
				<scope>runtime</scope>
			</dependency>

			<!-- GWT -->

			<dependency>
				<groupId>com.google.gwt</groupId>
				<artifactId>gwt</artifactId>
				<version>${gwtVersion}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<dependency>
				<groupId>org.gwtbootstrap3</groupId>
				<artifactId>gwtbootstrap3</artifactId>
				<version>0.9</version>
				<scope>provided</scope>
			</dependency>

			<dependency>
				<groupId>org.gwtbootstrap3</groupId>
				<artifactId>gwtbootstrap3-extras</artifactId>
				<version>0.9</version>
				<scope>provided</scope>
			</dependency>

		</dependencies>
	</dependencyManagement>

	<dependencies>

		<!-- Logging api -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${slf4j.version}</version>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>${slf4j.version}</version>
			<scope>runtime</scope>
		</dependency>

		<!-- ===== Testing ===== -->
		<!-- testing jsf components -->
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-all</artifactId>
			<version>1.9.5</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<id>release</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<version>2.4</version>
						<executions>
							<execution>
								<id>attach-sources</id>
								<phase>verify</phase>
								<goals>
									<goal>jar-no-fork</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<version>2.10.3</version>
						<executions>
							<execution>
								<id>attach-javadocs</id>
								<goals>
									<goal>jar</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>1.6</version>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.sonatype.plugins</groupId>
						<artifactId>nexus-staging-maven-plugin</artifactId>
						<version>1.6.5</version>
						<extensions>true</extensions>
						<configuration>
							<serverId>ossrh</serverId>
							<nexusUrl>https://oss.sonatype.org/</nexusUrl>
							<autoReleaseAfterClose>true</autoReleaseAfterClose>
						</configuration>
					</plugin>
				</plugins>

			</build>

		</profile>

	</profiles>

</project>


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">

<TITLE>
XML Standard API: javax.xml.datatype Class Hierarchy
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

Hierarchy For Package javax.xml.datatype

Package Hierarchies:
All Packages

Class Hierarchy

class java.lang.Object

class javax.xml.datatype.DatatypeConstants
class javax.xml.datatype.DatatypeConstants.Field
class javax.xml.datatype.DatatypeFactory
class javax.xml.datatype.Duration
class java.lang.Throwable (implements java.io.Serializable)

class java.lang.Exception

class javax.xml.datatype.DatatypeConfigurationException

class javax.xml.datatype.XMLGregorianCalendar (implements java.lang.Cloneable)

      Overview
      Package
      Class
    Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

Copyright © 1999-2007 The Apache Software Foundation. All Rights Reserved.


text:
namespace XPlat.ApplicationModel.DataTransfer
{
    using System.Threading.Tasks;

    /// A read-only version of a DataPackage. Apps that receive shared content get this object when acquiring content.
    public class DataPackageView : DataPackage, IDataPackageView
    {
        ///
        /// Initializes a new instance of the <see cref="DataPackageView"/> class.
        ///
        internal DataPackageView()
        {
        }

        /// Gets the text in the DataPackageView object.
        /// <returns>The text.</returns>
        public Task<string> GetTextAsync()
        {
            return Task.FromResult(this.Text);
        }
    }
}
#endif


text:
/*
 * Author      Andrew Pieniezny <andrew.pieniezny@neric.org>
 * Version     1.1
 * Since       2015-07-20
 * Filename    XTelephoneType.cs
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RicOneApi.Models.XPress
{
    /// <summary>
    /// XTelephoneType
    /// </summary>
    public class XTelephoneType
    {
        public XTelephoneType()
        {
            phoneNumberType = null;
            number = null;
            primaryIndicator = null;
        }
        public string phoneNumberType { get; set; }
        public string number { get; set; }
        public string primaryIndicator { get; set; }
    }
}


text:
#region License

#endregion

using VulkaNetGenerator.Dummies;

namespace VulkaNetGenerator.GenStructs
{
    public unsafe struct GenPhysicalDeviceFeatures
    {
        public VkBool32 robustBufferAccess;
        public VkBool32 fullDrawIndexUint32;
        public VkBool32 imageCubeArray;
        public VkBool32 independentBlend;
        public VkBool32 geometryShader;
        public VkBool32 tessellationShader;
        public VkBool32 sampleRateShading;
        public VkBool32 dualSrcBlend;
        public VkBool32 logicOp;
        public VkBool32 multiDrawIndirect;
        public VkBool32 drawIndirectFirstInstance;
        public VkBool32 depthClamp;
        public VkBool32 depthBiasClamp;
        public VkBool32 fillModeNonSolid;
        public VkBool32 depthBounds;
        public VkBool32 wideLines;
        public VkBool32 largePoints;
        public VkBool32 alphaToOne;
        public VkBool32 multiViewport;
        public VkBool32 samplerAnisotropy;
        public VkBool32 textureCompressionETC2;
        public VkBool32 textureCompressionASTC_LDR;
        public VkBool32 textureCompressionBC;
        public VkBool32 occlusionQueryPrecise;
        public VkBool32 pipelineStatisticsQuery;
        public VkBool32 vertexPipelineStoresAndAtomics;
        public VkBool32 fragmentStoresAndAtomics;
        public VkBool32 shaderTessellationAndGeometryPointSize;
        public VkBool32 shaderImageGatherExtended;
        public VkBool32 shaderStorageImageExtendedFormats;
        public VkBool32 shaderStorageImageMultisample;
        public VkBool32 shaderStorageImageReadWithoutFormat;
        public VkBool32 shaderStorageImageWriteWithoutFormat;
        public VkBool32 shaderUniformBufferArrayDynamicIndexing;
        public VkBool32 shaderSampledImageArrayDynamicIndexing;
        public VkBool32 shaderStorageBufferArrayDynamicIndexing;
        public VkBool32 shaderStorageImageArrayDynamicIndexing;
        public VkBool32 shaderClipDistance;
        public VkBool32 shaderCullDistance;
        public VkBool32 shaderFloat64;
        public VkBool32 shaderInt64;
        public VkBool32 shaderInt16;
        public VkBool32 shaderResourceResidency;
        public VkBool32 shaderResourceMinLod;
        public VkBool32 sparseBinding;
        public VkBool32 sparseResidencyBuffer;
        public VkBool32 sparseResidencyImage2D;
        public VkBool32 sparseResidencyImage3D;
        public VkBool32 sparseResidency2Samples;
        public VkBool32 sparseResidency4Samples;
        public VkBool32 sparseResidency8Samples;
        public VkBool32 sparseResidency16Samples;
        public VkBool32 sparseResidencyAliased;
        public VkBool32 variableMultisampleRate;
        public VkBool32 inheritedQueries;
    }
}


text:
    <uib-progressbar class="progress-striped active" max="100" value="50">
      Creating hunt...
    </uib-progressbar>

Can't create hunt:

{$ response.data $}

        Created Hunt:
        <grr-semantic-value value="response.data.value.urn"></grr-semantic-value>

        Hunt arguments:

        <grr-semantic-value value="response.data.value.hunt_args"></grr-semantic-value>

        Runner arguments:

        <grr-semantic-value value="response.data.value.hunt_runner_args"></grr-semantic-value>


text:
WalletModel::WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent) :
    QObject(parent), wallet(wallet), optionsModel(optionsModel), addressTableModel(0),
    transactionTableModel(0),
    cachedBalance(0), cachedUnconfirmedBalance(0), cachedImmatureBalance(0),
    cachedNumTransactions(0),
    cachedEncryptionStatus(Unencrypted),
    cachedNumBlocks(0)
{
    addressTableModel = new AddressTableModel(wallet, this);
    transactionTableModel = new TransactionTableModel(wallet, this);

    // This timer will be fired repeatedly to update the balance
    pollTimer = new QTimer(this);
    connect(pollTimer, SIGNAL(timeout()), this, SLOT(pollBalanceChanged()));
    pollTimer->start(MODEL_UPDATE_DELAY);

    subscribeToCoreSignals();
}

WalletModel::~WalletModel()
{
    unsubscribeFromCoreSignals();
}

qint64 WalletModel::getBalance(const CCoinControl *coinControl) const
{
    if (coinControl)
    {
        int64 nBalance = 0;
        std::vector<COutput> vCoins;
        wallet->AvailableCoins(vCoins, true, coinControl);
        BOOST_FOREACH(const COutput& out, vCoins)
            nBalance += out.tx->vout[out.i].nValue;

        return nBalance;
    }

    return wallet->GetBalance();
}

qint64 WalletModel::getUnconfirmedBalance() const
{
    return wallet->GetUnconfirmedBalance();
}

qint64 WalletModel::getImmatureBalance() const
{
    return wallet->GetImmatureBalance();
}

int WalletModel::getNumTransactions() const
{
    int numTransactions = 0;
    {
        LOCK(wallet->cs_wallet);
        // the size of mapWallet contains the number of unique transaction IDs
        // (e.g. payments to yourself generate 2 transactions, but both share the same transaction ID)
        numTransactions = wallet->mapWallet.size();
    }
    return numTransactions;
}

void WalletModel::updateStatus()
{
    EncryptionStatus newEncryptionStatus = getEncryptionStatus();

    if(cachedEncryptionStatus != newEncryptionStatus)
        emit encryptionStatusChanged(newEncryptionStatus);
}

void WalletModel::pollBalanceChanged()
{
    if(nBestHeight != cachedNumBlocks)
    {
        // Balance and number of transactions might have changed
        cachedNumBlocks = nBestHeight;
        checkBalanceChanged();
    }
}

void WalletModel::checkBalanceChanged()
{
    qint64 newBalance = getBalance();
    qint64 newUnconfirmedBalance = getUnconfirmedBalance();
    qint64 newImmatureBalance = getImmatureBalance();

    if(cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance || cachedImmatureBalance != newImmatureBalance)
    {
        cachedBalance = newBalance;
        cachedUnconfirmedBalance = newUnconfirmedBalance;
        cachedImmatureBalance = newImmatureBalance;
        emit balanceChanged(newBalance, newUnconfirmedBalance, newImmatureBalance);
    }
}

void WalletModel::updateTransaction(const QString &hash, int status)
{
    if(transactionTableModel)
        transactionTableModel->updateTransaction(hash, status);

    // Balance and number of transactions might have changed
    checkBalanceChanged();

    int newNumTransactions = getNumTransactions();
    if(cachedNumTransactions != newNumTransactions)
    {
        cachedNumTransactions = newNumTransactions;
        emit numTransactionsChanged(newNumTransactions);
    }
}

void WalletModel::updateAddressBook(const QString &address, const QString &label, bool isMine, int status)
{
    if(addressTableModel)
        addressTableModel->updateEntry(address, label, isMine, status);
}

bool WalletModel::validateAddress(const QString &address)
{
    CBitcoinAddress addressParsed(address.toStdString());
    return addressParsed.IsValid();
}

WalletModel::SendCoinsReturn WalletModel::sendCoins(const QList<SendCoinsRecipient> &recipients, const CCoinControl *coinControl)
{
    qint64 total = 0;
    QSet<QString> setAddress;
    QString hex;

    if(recipients.empty())
    {
        return OK;
    }

    // Pre-check input data for validity
    foreach(const SendCoinsRecipient &rcp, recipients)
    {
        if(!validateAddress(rcp.address))
        {
            return InvalidAddress;
        }
        setAddress.insert(rcp.address);

        if(rcp.amount <= 0)
        {
            return InvalidAmount;
        }
        total += rcp.amount;
    }

    if(recipients.size() > setAddress.size())
    {
        return DuplicateAddress;
    }

    int64 nBalance = getBalance(coinControl);

    if(total > nBalance)
    {
        return AmountExceedsBalance;
    }

    if((total + nTransactionFee) > nBalance)
    {
        return SendCoinsReturn(AmountWithFeeExceedsBalance, nTransactionFee);
    }

    {
        LOCK2(cs_main, wallet->cs_wallet);

        // Sendmany
        std::vector<std::pair<CScript, int64> > vecSend;
        foreach(const SendCoinsRecipient &rcp, recipients)
        {
            CScript scriptPubKey;
            scriptPubKey.SetDestination(CBitcoinAddress(rcp.address.toStdString()).Get());
            vecSend.push_back(make_pair(scriptPubKey, rcp.amount));
        }

        CWalletTx wtx;
        CReserveKey keyChange(wallet);
        int64 nFeeRequired = 0;
        std::string strFailReason;
        bool fCreated = wallet->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, strFailReason, coinControl);

        if(!fCreated)
        {
            if((total + nFeeRequired) > nBalance)
            {
                return SendCoinsReturn(AmountWithFeeExceedsBalance, nFeeRequired);
            }
            emit message(tr("Send Coins"), QString::fromStdString(strFailReason),
                         CClientUIInterface::MSG_ERROR);
            return TransactionCreationFailed;
        }
        if(!uiInterface.ThreadSafeAskFee(nFeeRequired))
        {
            return Aborted;
        }
        if(!wallet->CommitTransaction(wtx, keyChange))
        {
            return TransactionCommitFailed;
        }
        hex = QString::fromStdString(wtx.GetHash().GetHex());
    }

    // Add addresses / update labels that we've sent to to the address book
    foreach(const SendCoinsRecipient &rcp, recipients)
    {
        std::string strAddress = rcp.address.toStdString();
        CTxDestination dest = CBitcoinAddress(strAddress).Get();
        std::string strLabel = rcp.label.toStdString();
        {
            LOCK(wallet->cs_wallet);

            std::map<CTxDestination, std::string>::iterator mi = wallet->mapAddressBook.find(dest);

            // Check if we have a new address or an updated label
            if (mi == wallet->mapAddressBook.end() || mi->second != strLabel)
            {
                wallet->SetAddressBookName(dest, strLabel);
            }
        }
    }

    return SendCoinsReturn(OK, 0, hex);
}

OptionsModel *WalletModel::getOptionsModel()
{
    return optionsModel;
}

AddressTableModel *WalletModel::getAddressTableModel()
{
    return addressTableModel;
}

TransactionTableModel *WalletModel::getTransactionTableModel()
{
    return transactionTableModel;
}

WalletModel::EncryptionStatus WalletModel::getEncryptionStatus() const
{
    if(!wallet->IsCrypted())
    {
        return Unencrypted;
    }
    else if(wallet->IsLocked())
    {
        return Locked;
    }
    else
    {
        return Unlocked;
    }
}

bool WalletModel::setWalletEncrypted(bool encrypted, const SecureString &passphrase)
{
    if(encrypted)
    {
        // Encrypt
        return wallet->EncryptWallet(passphrase);
    }
    else
    {
        // Decrypt -- TODO; not supported yet
        return false;
    }
}

bool WalletModel::setWalletLocked(bool locked, const SecureString &passPhrase)
{
    if(locked)
    {
        // Lock
        return wallet->Lock();
    }
    else
    {
        // Unlock
        return wallet->Unlock(passPhrase);
    }
}
bool WalletModel::setWalletLockedIndefinite(bool locked, const SecureString &passPhrase)
{
    if(locked)
    {
        // Lock
        return wallet->Lock();
    }
    else
    {
        // Unlock
        VanityGenPassphrase = QString(passPhrase.c_str());
        return wallet->Unlock(passPhrase);
    }
}

bool WalletModel::changePassphrase(const SecureString &oldPass, const SecureString &newPass)
{
    bool retval;
    {
        LOCK(wallet->cs_wallet);
        wallet->Lock(); // Make sure wallet is locked before attempting pass change
        retval = wallet->ChangeWalletPassphrase(oldPass, newPass);
    }
    return retval;
}

bool WalletModel::backupWallet(const QString &filename)
{
    return BackupWallet(*wallet, filename.toLocal8Bit().data());
}

// Handlers for core signals
static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel, CCryptoKeyStore *wallet)
{
    OutputDebugStringF("NotifyKeyStoreStatusChanged\n");
    QMetaObject::invokeMethod(walletmodel, "updateStatus", Qt::QueuedConnection);
}

static void NotifyAddressBookChanged(WalletModel *walletmodel, CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, ChangeType status)
{
    OutputDebugStringF("NotifyAddressBookChanged %s %s isMine=%i status=%i\n", CBitcoinAddress(address).ToString().c_str(), label.c_str(), isMine, status);
    QMetaObject::invokeMethod(walletmodel, "updateAddressBook", Qt::QueuedConnection,
                              Q_ARG(QString, QString::fromStdString(CBitcoinAddress(address).ToString())),
                              Q_ARG(QString, QString::fromStdString(label)),
                              Q_ARG(bool, isMine),
                              Q_ARG(int, status));
}

static void NotifyTransactionChanged(WalletModel *walletmodel, CWallet *wallet, const uint256 &hash, ChangeType status)
{
    OutputDebugStringF("NotifyTransactionChanged %s status=%i\n", hash.GetHex().c_str(), status);
    QMetaObject::invokeMethod(walletmodel, "updateTransaction", Qt::QueuedConnection,
                              Q_ARG(QString, QString::fromStdString(hash.GetHex())),
                              Q_ARG(int, status));
}

void WalletModel::subscribeToCoreSignals()
{
    // Connect signals to wallet
    wallet->NotifyStatusChanged.connect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1));
    wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5));
    wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
}

void WalletModel::unsubscribeFromCoreSignals()
{
    // Disconnect signals from wallet
    wallet->NotifyStatusChanged.disconnect(boost::bind(&NotifyKeyStoreStatusChanged, this, _1));
    wallet->NotifyAddressBookChanged.disconnect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5));
    wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
}

// WalletModel::UnlockContext implementation
WalletModel::UnlockContext WalletModel::requestUnlock()
{
    bool was_locked = getEncryptionStatus() == Locked;
    if(was_locked)
    {
        // Request UI to unlock wallet
        emit requireUnlock();
    }
    // If wallet is still locked, unlock was failed or cancelled, mark context as invalid
    bool valid = getEncryptionStatus() != Locked;

    return UnlockContext(this, valid, was_locked);
}
WalletModel::UnlockContext WalletModel::requestUnlockIndefinite()
{
    bool was_locked = getEncryptionStatus() == Locked;
    if(was_locked)
    {
        // Request UI to unlock wallet
        emit requireUnlockIndefinite();
    }
    // If wallet is still locked, unlock was failed or cancelled, mark context as invalid
    bool valid = getEncryptionStatus() != Locked;

    return UnlockContext(this, valid, was_locked);
}

WalletModel::UnlockContext::UnlockContext(WalletModel *wallet, bool valid, bool relock):
        wallet(wallet),
        valid(valid),
        relock(relock)
{
}

WalletModel::UnlockContext::~UnlockContext()
{
    if(valid && relock)
    {
        wallet->setWalletLocked(true);
    }
}

void WalletModel::UnlockContext::CopyFrom(const UnlockContext& rhs)
{
    // Transfer context; old object no longer relocks wallet
    *this = rhs;
    rhs.relock = false;
}

bool WalletModel::getPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const
{
    return wallet->GetPubKey(address, vchPubKeyOut);
}

// returns a list of COutputs from COutPoints
void WalletModel::getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs)
{
    BOOST_FOREACH(const COutPoint& outpoint, vOutpoints)
    {
        if (!wallet->mapWallet.count(outpoint.hash)) continue;
        COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, wallet->mapWallet[outpoint.hash].GetDepthInMainChain());
        vOutputs.push_back(out);
    }
}

// AvailableCoins + LockedCoins grouped by wallet address (put change in one group with wallet address)
void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins) const
{
    std::vector<COutput> vCoins;
    wallet->AvailableCoins(vCoins);

    std::vector<COutPoint> vLockedCoins;
    wallet->ListLockedCoins(vLockedCoins);

    // add locked coins
    BOOST_FOREACH(const COutPoint& outpoint, vLockedCoins)
    {
        if (!wallet->mapWallet.count(outpoint.hash)) continue;
        COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, wallet->mapWallet[outpoint.hash].GetDepthInMainChain());
        vCoins.push_back(out);
    }

    BOOST_FOREACH(const COutput& out, vCoins)
    {
        COutput cout = out;

        while (wallet->IsChange(cout.tx->vout[cout.i]) && cout.tx->vin.size() > 0 && wallet->IsMine(cout.tx->vin[0]))
        {
            if (!wallet->mapWallet.count(cout.tx->vin[0].prevout.hash)) break;
            cout = COutput(&wallet->mapWallet[cout.tx->vin[0].prevout.hash], cout.tx->vin[0].prevout.n, 0);
        }

        CTxDestination address;
        if(!ExtractDestination(cout.tx->vout[cout.i].scriptPubKey, address)) continue;
        mapCoins[CBitcoinAddress(address).ToString().c_str()].push_back(out);
    }
}

bool WalletModel::isLockedCoin(uint256 hash, unsigned int n) const
{
    return wallet->IsLockedCoin(hash, n);
}

void WalletModel::lockCoin(COutPoint& output)
{
    wallet->LockCoin(output);
}

void WalletModel::unlockCoin(COutPoint& output)
{
    wallet->UnlockCoin(output);
}

void WalletModel::listLockedCoins(std::vector<COutPoint>& vOutpts)
{
    wallet->ListLockedCoins(vOutpts);
}


text:
namespace BarbaTunnel.Service
{
    partial class BarbaService
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            //
            // BarbaService
            //
            this.ServiceName = "BarbaService";

        }

        #endregion
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed to Apereo under one or more contributor license
    agreements. See the NOTICE file distributed with this work
    for additional information regarding copyright ownership.
    Apereo licenses this file to you under the Apache License,
    Version 2.0 (the "License"); you may not use this file
    except in compliance with the License.  You may obtain a
    copy of the License at the following location:

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.

-->
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:c="http://www.springframework.org/schema/c"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:util="http://www.springframework.org/schema/util"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns="http://www.springframework.org/schema/beans"
       xsi:schemaLocation="
              http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
              http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
    <description>
        Configuration for the default TicketRegistry which stores the tickets in-memory and cleans them out as specified
        intervals.
    </description>

    <!-- Ticket Registry -->
    <bean id="ticketRegistry" class="org.jasig.cas.ticket.registry.DefaultTicketRegistry"/>

    <!--Quartz -->
    <!-- TICKET REGISTRY CLEANER -->
    <bean id="ticketRegistryCleaner" class="org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner"
          c:centralAuthenticationService-ref="centralAuthenticationService"
          c:ticketRegistry-ref="ticketRegistry"/>

    <bean id="jobDetailTicketRegistryCleaner"
          class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"
          p:targetObject-ref="ticketRegistryCleaner"
          p:targetMethod="clean"/>

    <bean id="triggerJobDetailTicketRegistryCleaner"
          class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean"
          p:jobDetail-ref="jobDetailTicketRegistryCleaner"
          p:startDelay="20000"
          p:repeatInterval="5000000"/>
</beans>


text:
import re
import string
import sys
sys.path.append('/Users/exu/PlayGround/readinglists/')

from key.keys import *
from amazon.api import AmazonAPI
from html2text import html2text

pattern = re.compile("https?://.*amazon.com/gp/product/([0-9]+)/.*")
amazon = AmazonAPI(AMAZON_ACCESS_KEY_ID, AMAZON_SECRET_ACCESS_KEY, AMAZON_ASSOC_TAG, MaxQPS=0.9)

def uprint(s):
    print s.encode('utf-8')

def get_asin(url):
    global pattern
    m = pattern.match(url)
    if m and len(m.groups()) > 0:
        return m.groups()[0]

def read_file():
    if (len(sys.argv) < 1):
        print "Please provide a file that includes a list of Amazon links."
        sys.exit(-1)
    fname = sys.argv[1]
    f = open(fname, 'r')
    products = []
    for l in f.readlines():
        product = amazon.lookup(ItemId=get_asin(l))
        products.append([product.title, product.editorial_review, product.large_image_url, product.offer_url])
        print "Got product", product.title
    return products

rtitle = re.compile('(.*)(\(.*\))')
def normalize_title(title):
    """ Book titles are long. We crop out the last part that is in (part)"""
    splits =  re.findall(rtitle, title)
    if splits:
        new_title = splits[0][0]
    else:
        new_title = title
    return new_title

def sanitize_text(t):
    s = html2text(t)
    s = string.replace(s, "'", "’")
    s = string.replace(s, "**", "*")
    return s

if __name__ == '__main__':
    import os.path
    import cPickle
    pickle_file = 'products.pickle'
    products = None
    if os.path.isfile(pickle_file):
        products = cPickle.load(open(pickle_file, 'r'))
    else:
        products = read_file()
        f = open(pickle_file, "wb")
        cPickle.dump(products, f)
    for product in products:
        title = normalize_title(product[0])
        uprint(title)
        print '=' * len(title)
        review = sanitize_text(product[1])
        uprint(review)
        print


text:
The internet of things. Sometimes, it all starts with a simple button.

## Methods & Materials

### Spark Core

- Spark Core or Spark Photon
- momentary switch
- adafruit neopixel ring

### Pro Trinket

- Adafruit Pro Triket (3v? or 5v?)
- CC3300


text:
package io.codis.nedis.codis;

import static org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent.Type.CHILD_ADDED;
import static org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent.Type.CHILD_REMOVED;
import static org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent.Type.CHILD_UPDATED;
import static org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent.Type.INITIALIZED;

import io.codis.nedis.NedisClient;
import io.codis.nedis.NedisClientPool;
import io.codis.nedis.NedisClientPoolBuilder;
import io.netty.channel.EventLoop;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.FutureListener;
import io.netty.util.concurrent.Promise;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.recipes.cache.ChildData;
import org.apache.curator.framework.recipes.cache.PathChildrenCache;
import org.apache.curator.framework.recipes.cache.PathChildrenCache.StartMode;
import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent;
import org.apache.curator.framework.recipes.cache.PathChildrenCacheListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author Apache9
 */
public class RoundRobinNedisClientPool implements NedisClientPool {

    private static final Logger LOG = LoggerFactory.getLogger(RoundRobinNedisClientPool.class);

    private static final ObjectMapper MAPPER = new ObjectMapper();

    private static final String CODIS_PROXY_STATE_ONLINE = "online";

    private static final EnumSet<PathChildrenCacheEvent.Type> RESET_TYPES = EnumSet.of(CHILD_ADDED,
            CHILD_UPDATED, CHILD_REMOVED);

    private static final class PooledObject {
        public final String addr;

        public final NedisClientPool pool;

        public PooledObject(String addr, NedisClientPool pool) {
            this.addr = addr;
            this.pool = pool;
        }
    }

    private volatile List<PooledObject> pools = Collections.emptyList();

    private final CuratorFramework curatorClient;

    private final boolean closeCurator;

    private final PathChildrenCache watcher;

    private final NedisClientPoolBuilder poolBuilder;

    private final AtomicInteger nextIdx = new AtomicInteger(-1);

    private final Promise<Void> closePromise;

    private final Promise<RoundRobinNedisClientPool> initPromise;

    private RoundRobinNedisClientPool(CuratorFramework curatorClient, boolean closeCurator,
            String zkProxyDir, NedisClientPoolBuilder poolBuilder) throws Exception {
        this.curatorClient = curatorClient;
        this.closeCurator = closeCurator;
        this.poolBuilder = poolBuilder;
        EventLoop eventLoop = poolBuilder.group().next();
        this.closePromise = eventLoop.newPromise();
        this.initPromise = eventLoop.newPromise();
        watcher = new PathChildrenCache(curatorClient, zkProxyDir, true);
        watcher.getListenable().addListener(new PathChildrenCacheListener() {

            private boolean initialized = false;

            @Override
            public void childEvent(CuratorFramework client, PathChildrenCacheEvent event)
                    throws Exception {
                StringBuilder sb = new StringBuilder("Zookeeper event received: type=")
                        .append(event.getType());
                if (event.getData() != null) {
                    ChildData data = event.getData();
                    sb.append(", path=").append(data.getPath()).append(", stat=")
                            .append(data.getStat());
                }
                LOG.info(sb.toString());
                if (!initialized) {
                    if (event.getType() == INITIALIZED) {
                        resetPools();
                        initPromise.trySuccess(RoundRobinNedisClientPool.this);
                        initialized = true;
                    }
                } else if (RESET_TYPES.contains(event.getType())) {
                    resetPools();
                }
            }
        });
        watcher.start(StartMode.POST_INITIALIZED_EVENT);
    }

    private synchronized void resetPools() {
        if (closed.get()) {
            return;
        }
        List<PooledObject> oldPools = this.pools;
        Map<String, PooledObject> addr2Pool = new HashMap<>(oldPools.size());
        for (PooledObject pool: oldPools) {
            addr2Pool.put(pool.addr, pool);
        }
        List<PooledObject> newPools = new ArrayList<>();
        for (ChildData childData: watcher.getCurrentData()) {
            try {
                CodisProxyInfo proxyInfo = MAPPER.readValue(childData.getData(),
                        CodisProxyInfo.class);
                if (!CODIS_PROXY_STATE_ONLINE.equals(proxyInfo.getState())) {
                    continue;
                }
                String addr = proxyInfo.getAddr();
                PooledObject pool = addr2Pool.remove(addr);
                if (pool == null) {
                    LOG.info("Add new proxy: " + addr);
                    String[] hostAndPort = addr.split(":");
                    String host = hostAndPort[0];
                    int port = Integer.parseInt(hostAndPort[1]);
                    pool = new PooledObject(addr, poolBuilder.remoteAddress(host, port).build());
                }
                newPools.add(pool);
            } catch (Exception e) {
                LOG.warn("parse " + childData.getPath() + " failed", e);
            }
        }
        this.pools = newPools;
        for (PooledObject pool: addr2Pool.values()) {
            LOG.info("Remove proxy: " + pool.addr);
            pool.pool.close();
        }
    }

    public Future<RoundRobinNedisClientPool> initFuture() {
        return initPromise;
    }

    @Override
    public Future<Void> closeFuture() {
        return closePromise;
    }

    private final AtomicBoolean closed = new AtomicBoolean(false);

    @Override
    public Future<Void> close() {
        if (!closed.compareAndSet(false, true)) {
            return closePromise;
        }
        new Thread(getClass().getSimpleName() + "-Closer") {

            @Override
            public void run() {
                try {
                    watcher.close();
                } catch (IOException e) {
                    LOG.warn("IOException should not have been thrown", e);
                }
                if (closeCurator) {
                    curatorClient.close();
                }
                synchronized (RoundRobinNedisClientPool.this) {
                    List<PooledObject> toClose = pools;
                    if (toClose.isEmpty()) {
                        closePromise.trySuccess(null);
                        return;
                    }
                    final AtomicInteger remaining = new AtomicInteger(toClose.size());
                    FutureListener<Void> listener = new FutureListener<Void>() {

                        @Override
                        public void operationComplete(Future<Void> future) throws Exception {
                            if (remaining.decrementAndGet() == 0) {
                                closePromise.trySuccess(null);
                            }
                        }
                    };
                    for (PooledObject pool: toClose) {
                        pool.pool.close().addListener(listener);
                    }
                }
            }

        }.start();

        return closePromise;
    }

    @Override
    public Future<NedisClient> acquire() {
        List<PooledObject> pools = this.pools;
        if (pools.isEmpty()) {
            return poolBuilder.group().next().newFailedFuture(new IOException("Proxy list empty"));
        }
        for (;;) {
            int current = nextIdx.get();
            int next = current >= pools.size() - 1 ? 0 : current + 1;
            if (nextIdx.compareAndSet(current, next)) {
                return pools.get(next).pool.acquire();
            }
        }
    }

    @Override
    public void release(NedisClient client) {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean exclusive() {
        return poolBuilder.exclusive();
    }

    @Override
    public int numConns() {
        int numConns = 0;
        for (PooledObject pool: pools) {
            numConns += pool.pool.numConns();
        }
        return numConns;
    }

    @Override
    public int numPooledConns() {
        int numPooledConns = 0;
        for (PooledObject pool: pools) {
            numPooledConns += pool.pool.numPooledConns();
        }
        return numPooledConns;
    }

    public static class Builder {

        private static final int CURATOR_RETRY_BASE_SLEEP_MS = 100;

        private static final int CURATOR_RETRY_MAX_SLEEP_MS = 30 * 1000;

        private NedisClientPoolBuilder poolBuilder;

        private CuratorFramework curatorClient;

        private boolean closeCurator;

        private String zkProxyDir;

        private String zkAddr;

        private int zkSessionTimeoutMs;

        private Builder() {}

        public Builder poolBuilder(NedisClientPoolBuilder poolBuilder) {
            this.poolBuilder = poolBuilder;
            return this;
        }

        public Builder curatorClient(CuratorFramework curatorClient, boolean closeCurator) {
            this.curatorClient = curatorClient;
            this.closeCurator = closeCurator;
            return this;
        }

        public Builder zkProxyDir(String zkProxyDir) {
            this.zkProxyDir = zkProxyDir;
            return this;
        }

        public Builder curatorClient(String zkAddr, int zkSessionTimeoutMs) {
            this.zkAddr = zkAddr;
            this.zkSessionTimeoutMs = zkSessionTimeoutMs;
            return this;
        }

        private void validate() {
            poolBuilder.validateGroupConfig();
            if (zkProxyDir == null) {
                throw new IllegalArgumentException("zkProxyDir can not be null");
            }
            if (curatorClient == null) {
                if (zkAddr == null) {
                    throw new IllegalArgumentException("zk client can not be null");
                }
                curatorClient = CuratorFrameworkFactory
                        .builder()
                        .connectString(zkAddr)
                        .sessionTimeoutMs(zkSessionTimeoutMs)
                        .retryPolicy(
                                new BoundedExponentialBackoffRetryUntilElapsed(
                                        CURATOR_RETRY_BASE_SLEEP_MS, CURATOR_RETRY_MAX_SLEEP_MS,
                                        -1L)).build();
                curatorClient.start();
                closeCurator = true;
            }
        }

        public Future<RoundRobinNedisClientPool> build() {
            validate();
            try {
                return new RoundRobinNedisClientPool(curatorClient, closeCurator, zkProxyDir,
                        poolBuilder).initFuture();
            } catch (Exception e) {
                return poolBuilder.group().next().newFailedFuture(e);
            }
        }
    }

    public static Builder builder() {
        return new Builder();
    }
}


text:
using System;
using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection;

namespace LinFx.Application;

internal class ApplicationWithInternalServiceProvider : ApplicationBase, IApplicationWithInternalServiceProvider
{
    public IServiceScope ServiceScope { get; private set; }

    public ApplicationWithInternalServiceProvider(
        [NotNull] Type startupModuleType,
        [CanBeNull] Action<ApplicationCreationOptions> optionsAction
        ) : this(
        startupModuleType,
        new ServiceCollection(),
        optionsAction)
    {
    }

    private ApplicationWithInternalServiceProvider(
        [NotNull] Type startupModuleType,
        [NotNull] IServiceCollection services,
        [CanBeNull] Action<ApplicationCreationOptions> optionsAction
        ) : base(
            startupModuleType,
            services,
            optionsAction)
    {
        // ×¢Èë×Ô¼ºµ½ IoC µ±ÖС£
        Services.AddSingleton<IApplicationWithInternalServiceProvider>(this);
    }

    public IServiceProvider CreateServiceProvider()
    {
        if (ServiceProvider != null)
        {
            return ServiceProvider;
        }

        ServiceScope = Services.BuildServiceProviderFromFactory().CreateScope();
        SetServiceProvider(ServiceScope.ServiceProvider);

        return ServiceProvider;
    }

    // Ö´Ðпò¼Ü³õ'»¯²Ù×÷£¬Ö÷Òª¹¤×÷ÊǼÓÔØÄ£¿é²¢Ö´ÐÐÆä³õ'»¯·½·¨¡£
    public void Initialize()
    {
        CreateServiceProvider();
        InitializeModules();
    }

    public override void Dispose()
    {
        base.Dispose();
        ServiceScope.Dispose();
    }
}


text:
void fuzzDecoder(const uint8_t* data, size_t size, size_t stride, int (*decode)(void*, size_t, size_t, const unsigned char*, size_t))
{
	size_t count = 66; // must be divisible by 3 for decodeIndexBuffer; should be >=64 to cover large vertex blocks

	void* destination = malloc(count * stride);
	assert(destination);

	int rc = decode(destination, count, stride, reinterpret_cast<const unsigned char*>(data), size);
	(void)rc;

	free(destination);
}

namespace meshopt
{
extern unsigned int cpuid;
}

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
	// decodeIndexBuffer supports 2 and 4-byte indices
	fuzzDecoder(data, size, 2, meshopt_decodeIndexBuffer);
	fuzzDecoder(data, size, 4, meshopt_decodeIndexBuffer);

	// decodeIndexSequence supports 2 and 4-byte indices
	fuzzDecoder(data, size, 2, meshopt_decodeIndexSequence);
	fuzzDecoder(data, size, 4, meshopt_decodeIndexSequence);

	// decodeVertexBuffer supports any strides divisible by 4 in 4-256 interval
	// It's a waste of time to check all of them, so we'll just check a few with different alignment mod 16
	fuzzDecoder(data, size, 4, meshopt_decodeVertexBuffer);
	fuzzDecoder(data, size, 16, meshopt_decodeVertexBuffer);
	fuzzDecoder(data, size, 24, meshopt_decodeVertexBuffer);
	fuzzDecoder(data, size, 32, meshopt_decodeVertexBuffer);

	return 0;
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title>Module response</title>

  <link rel="stylesheet" href="rust.css" type="text/css" />

Module response

Struct Response - Represents an HTTP response

Implementation of ::std::to_str::ToStr for Response - Automatically derived.

Implementation for Response

Struct Response

pub struct Response {
    headers: Headers,
    body: ~[u8],
}

Represents an HTTP response

Implementation of ::std::to_str::ToStr for Response

Automatically derived.

Method to_str

fn to_str(&self) -> ~str

Implementation for Response

Method new

fn new(headers: Headers, body: ~[u8]) -> Response

Creates a new response struct

Arguments

headers - the HTTP headers from the response

body - the body of the HTTP response

Example

use std::str::from_bytes

let client = HttpClient::new();

let url = "http://api.4chan.org/pol/threads.json";

let req = Request::new(url.to_owned(),HashMap::new(),~[]);

let resp_res: Result<Response,~str> = client.exec(&req);

match resp_res {
    code::CURLE_OK => {
        for resp.headers.iter().advance | (&k, &v) | {
            println(fmt!("%s: %s",k,v));
        }
        println(from_bytes(resp.bod));
    }
    Err(msg) => { fail!("Error" + msg); }
};


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Enum. pl. (Kjbenhavn) 2: 186 (1803)

#### Original name
Sclerotium persicolor Schumach.

### Remarks
null