text:
<?php

namespace Embera\Provider;

use Embera\Url;

/**
 * MediaLab Provider
 * View, distribute and store professional content with MediaLab. Specialized in Digital Media Man...
 *
 * @link https://medialab.co
 *
 */
class MediaLab extends ProviderAdapter implements ProviderInterface
{
    /** inline {@inheritdoc} */
    protected $endpoint = 'https://{subdomain}.medialab.{tld}/api/oembed/?format=json';

    /** inline {@inheritdoc} */
    protected static $hosts = [
        '*.medialab.co',
        '*.medialab.app',
    ];

    /** inline {@inheritdoc} */
    protected $httpsSupport = true;

    /** inline {@inheritdoc} */
    protected $responsiveSupport = true;

    /** inline {@inheritdoc} */
    public function validateUrl(Url $url)
    {
        return (bool) (preg_match('~medialab\.(app|co)/share/(watch|social|embed)/([^/]+)~i', (string) $url));
    }

    /** inline {@inheritdoc} */
    public function getEndpoint()
    {
        if (preg_match('~https://([^\.]+)\.medialab\.([^/]+)~', $this->url, $m)) {
            $translate = [
                '{subdomain}' => $m['1'],
                '{tld}' => $m['2'],
            ];
        }

        return (string) str_replace(array_keys($translate), array_values($translate), $this->endpoint);
    }

    /** inline {@inheritdoc} */
    public function normalizeUrl(Url $url)
    {
        $url->convertToHttps();
        $url->removeQueryString();

        return $url;
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Front\FrontBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Front\FrontBundle\Entity\User
 */
class User {

    /**
     * @var integer $id
     */
    private $id;

    /**
     * @var string $email
     */
    private $email;

    /**
     * @var string $fName
     */
    private $fName;

    /**
     * @var string $lName
     */
    private $lName;

    /**
     * @var string $pass
     */
    private $pass;

    /**
     * @var integer $hasActivatedEmail
     */
    private $hasActivatedEmail;

    /**
     * @var string $activationHash
     */
    private $activationHash;

    /**
     * @var integer $hasPayed
     */
    private $hasPayed;

    /**
     * @var integer $isDeleted
     */
    private $isDeleted;

    /**
     * @var string $secretHash
     */
    private $secretHash;

    /**
     * @var date $nextPayDate
     */
    private $nextPayDate;

    /**
     * @var integer $hasCompletedProfile
     */
    private $hasCompletedProfile;

    /**
     * @var datetime $added
     */
    private $added;

    /**
     * @var Front\FrontBundle\Entity\Package
     */
    private $package;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId() {
        return $this->id;
    }

    /**
     * Set email
     *
     * @param string $email
     */
    public function setEmail($email) {
        $this->email = $email;
    }

    /**
     * Get email
     *
     * @return string
     */
    public function getEmail() {
        return $this->email;
    }

    /**
     * Set fName
     *
     * @param string $fName
     */
    public function setFName($fName) {
        $this->fName = $fName;
    }

    /**
     * Get fName
     *
     * @return string
     */
    public function getFName() {
        return $this->fName;
    }

    /**
     * Set lName
     *
     * @param string $lName
     */
    public function setLName($lName) {
        $this->lName = $lName;
    }

    /**
     * Get lName
     *
     * @return string
     */
    public function getLName() {
        return $this->lName;
    }

    /**
     * Set pass
     *
     * @param string $pass
     */
    public function setPass($pass) {
        $this->pass = $pass;
    }

    /**
     * Get pass
     *
     * @return string
     */
    public function getPass() {
        return $this->pass;
    }

    /**
     * Set hasActivatedEmail
     *
     * @param integer $hasActivatedEmail
     */
    public function setHasActivatedEmail($hasActivatedEmail) {
        $this->hasActivatedEmail = $hasActivatedEmail;
    }

    /**
     * Get hasActivatedEmail
     *
     * @return integer
     */
    public function getHasActivatedEmail() {
        return $this->hasActivatedEmail;
    }

    /**
     * Set activationHash
     *
     * @param string $activationHash
     */
    public function setActivationHash($activationHash) {
        $this->activationHash = $activationHash;
    }

    /**
     * Get activationHash
     *
     * @return string
     */
    public function getActivationHash() {
        return $this->activationHash;
    }

    /**
     * Set hasPayed
     *
     * @param integer $hasPayed
     */
    public function setHasPayed($hasPayed) {
        $this->hasPayed = $hasPayed;
    }

    /**
     * Get hasPayed
     *
     * @return integer
     */
    public function getHasPayed() {
        return $this->hasPayed;
    }

    /**
     * Set isDeleted
     *
     * @param integer $isDeleted
     */
    public function setIsDeleted($isDeleted) {
        $this->isDeleted = $isDeleted;
    }

    /**
     * Get isDeleted
     *
     * @return integer
     */
    public function getIsDeleted() {
        return $this->isDeleted;
    }

    /**
     * Set secretHash
     *
     * @param string $secretHash
     */
    public function setSecretHash($secretHash) {
        $this->secretHash = $secretHash;
    }

    /**
     * Get secretHash
     *
     * @return string
     */
    public function getSecretHash() {
        return $this->secretHash;
    }

    /**
     * Set nextPayDate
     *
     * @param date $nextPayDate
     */
    public function setNextPayDate($nextPayDate) {
        $this->nextPayDate = $nextPayDate;
    }

    /**
     * Get nextPayDate
     *
     * @return date
     */
    public function getNextPayDate() {
        return $this->nextPayDate;
    }

    /**
     * Set hasCompletedProfile
     *
     * @param integer $hasCompletedProfile
     */
    public function setHasCompletedProfile($hasCompletedProfile) {
        $this->hasCompletedProfile = $hasCompletedProfile;
    }

    /**
     * Get hasCompletedProfile
     *
     * @return integer
     */
    public function getHasCompletedProfile() {
        return $this->hasCompletedProfile;
    }

    /**
     * Set added
     *
     * @param datetime $added
     */
    public function setAdded($added) {
        $this->added = $added;
    }

    /**
     * Get added
     *
     * @return datetime
     */
    public function getAdded() {
        return $this->added;
    }

    /**
     * Set package
     *
     * @param Front\FrontBundle\Entity\Package $package
     */
    public function setPackage(\Front\FrontBundle\Entity\Package $package) {
        $this->package = $package;
    }

    /**
     * Get package
     *
     * @return Front\FrontBundle\Entity\Package
     */
    public function getPackage() {
        return $this->package;
    }

    /**
     * @var integer $isTrial
     */
    private $isTrial;

    /**
     * Set isTrial
     *
     * @param integer $isTrial
     */
    public function setIsTrial($isTrial)
    {
        $this->isTrial = $isTrial;
    }

    /**
     * Get isTrial
     *
     * @return integer
     */
    public function getIsTrial()
    {
        return $this->isTrial;
    }
    /**
     * @var date $trialStart
     */
    private $trialStart;

    /**
     * Set trialStart
     *
     * @param date $trialStart
     */
    public function setTrialStart($trialStart)
    {
        $this->trialStart = $trialStart;
    }

    /**
     * Get trialStart
     *
     * @return date
     */
    public function getTrialStart()
    {
        return $this->trialStart;
    }
}


text:
      Looking for Bootstrap 2.3.1 docs?

    We've moved it to a new home while we push forward with Bootstrap 3.


text:
use prelude::v1::*;

use io;
use libc::consts::os::extra::INVALID_SOCKET;
use libc::{self, c_int, c_void};
use mem;
use net::SocketAddr;
use num::One;
use ops::Neg;
use rt;
use sync::{Once, ONCE_INIT};
use sys::c;
use sys_common::{AsInner, FromInner};

pub type wrlen_t = i32;

pub struct Socket(libc::SOCKET);

/// Checks whether the Windows socket interface has been started already, and
/// if not, starts it.
pub fn init() {
    static START: Once = ONCE_INIT;

    START.call_once(|| unsafe {
        let mut data: c::WSADATA = mem::zeroed();
        let ret = c::WSAStartup(0x202, // version 2.2
                                &mut data);
        assert_eq!(ret, 0);

        let _ = rt::at_exit(|| { c::WSACleanup(); });
    });
}

/// Returns the last error from the Windows socket interface.
fn last_error() -> io::Error {
    io::Error::from_raw_os_error(unsafe { c::WSAGetLastError() })
}

/// Checks if the signed integer is the Windows constant `SOCKET_ERROR` (-1)
/// and if so, returns the last error from the Windows socket interface. . This
/// function must be called before another call to the socket API is made.
pub fn cvt<T: One + Neg<Output=T> + PartialEq>(t: T) -> io::Result<T> {
    let one: T = T::one();
    if t == -one {
        Err(last_error())
    } else {
        Ok(t)
    }
}

/// Provides the functionality of `cvt` for the return values of `getaddrinfo`
/// and similar, meaning that they return an error if the return value is 0.
pub fn cvt_gai(err: c_int) -> io::Result<()> {
    if err == 0 { return Ok(()) }
    cvt(err).map(|_| ())
}

/// Provides the functionality of `cvt` for a closure.
#[allow(deprecated)]
pub fn cvt_r<T, F>(mut f: F) -> io::Result<T>
    where F: FnMut() -> T, T: One + Neg<Output=T> + PartialEq
{
    cvt(f())
}

impl Socket {
    pub fn new(addr: &SocketAddr, ty: c_int) -> io::Result<Socket> {
        let fam = match *addr {
            SocketAddr::V4(..) => libc::AF_INET,
            SocketAddr::V6(..) => libc::AF_INET6,
        };
        let socket = unsafe {
            c::WSASocketW(fam, ty, 0, 0 as *mut _, 0,
                          c::WSA_FLAG_OVERLAPPED | c::WSA_FLAG_NO_HANDLE_INHERIT)
        };
        match socket {
            INVALID_SOCKET => Err(last_error()),
            n => Ok(Socket(n)),
        }
    }

    pub fn accept(&self, storage: *mut libc::sockaddr,
                  len: *mut libc::socklen_t) -> io::Result<Socket> {
        match unsafe { libc::accept(self.0, storage, len) } {
            INVALID_SOCKET => Err(last_error()),
            n => Ok(Socket(n)),
        }
    }

    pub fn duplicate(&self) -> io::Result<Socket> {
        unsafe {
            let mut info: c::WSAPROTOCOL_INFO = mem::zeroed();
            try!(cvt(c::WSADuplicateSocketW(self.0,
                                            c::GetCurrentProcessId(),
                                            &mut info)));
            match c::WSASocketW(info.iAddressFamily,
                                info.iSocketType,
                                info.iProtocol,
                                &mut info, 0,
                                c::WSA_FLAG_OVERLAPPED |
                                    c::WSA_FLAG_NO_HANDLE_INHERIT) {
                INVALID_SOCKET => Err(last_error()),
                n => Ok(Socket(n)),
            }
        }
    }

    pub fn read(&self, buf: &mut [u8]) -> io::Result<usize> {
        // On unix when a socket is shut down all further reads return 0, so we
        // do the same on windows to map a shut down socket to returning EOF.
        unsafe {
            match libc::recv(self.0, buf.as_mut_ptr() as *mut c_void,
                             buf.len() as i32, 0) {
                -1 if c::WSAGetLastError() == c::WSAESHUTDOWN => Ok(0),
                -1 => Err(last_error()),
                n => Ok(n as usize)
            }
        }
    }
}

impl Drop for Socket {
    fn drop(&mut self) {
        let _ = unsafe { libc::closesocket(self.0) };
    }
}

impl AsInner<libc::SOCKET> for Socket {
    fn as_inner(&self) -> &libc::SOCKET { &self.0 }
}

impl FromInner<libc::SOCKET> for Socket {
    fn from_inner(sock: libc::SOCKET) -> Socket { Socket(sock) }
}


text:
#ifndef GrGLUtil_DEFINED
#  define GrGLUtil_DEFINED
#  include "include/gpu/gl/GrGLInterface.h"
#  include "include/private/GrTypesPriv.h"
#  include "src/gpu/GrDataUtils.h"
#  include "src/gpu/GrStencilSettings.h"
#  include "src/gpu/gl/GrGLDefines.h"
class SkMatrix;
////////////////////////////////////////////////////////////////////////////////
typedef uint32_t GrGLVersion;
typedef uint32_t GrGLSLVersion;
typedef uint64_t GrGLDriverVersion;
#  define GR_GL_VER(major, minor) ((static_cast<uint32_t>(major) << 16) | \
                                 static_cast<uint32_t>(minor))
#  define GR_GLSL_VER(major, minor) ((static_cast<uint32_t>(major) << 16) | \
                                    static_cast<uint32_t>(minor))
#  define GR_GL_DRIVER_VER(major, minor, point) ((static_cast<uint64_t>(major) << 32) | \
                                               (static_cast<uint64_t>(minor) << 16) | \
                                                static_cast<uint64_t>(point))
#  define GR_GL_MAJOR_VER(version) (static_cast<uint32_t>(version) >> 16)
#  define GR_GL_MINOR_VER(version) (static_cast<uint32_t>(version) & 0xFFFF)
#  define GR_GL_INVALID_VER	GR_GL_VER(0, 0)
#  define GR_GLSL_INVALID_VER	GR_GLSL_VER(0, 0)
#  define GR_GL_DRIVER_UNKNOWN_VER	GR_GL_DRIVER_VER(0, 0, 0)
/**
 * The Vendor and Renderer enum values are lazily updated as required.
 */
enum GrGLVendor {
    kARM_GrGLVendor,
    kGoogle_GrGLVendor,
    kImagination_GrGLVendor,
    kIntel_GrGLVendor,
    kQualcomm_GrGLVendor,
    kNVIDIA_GrGLVendor,
    kATI_GrGLVendor,

    kOther_GrGLVendor
};
enum GrGLRenderer {
    kTegra_PreK1_GrGLRenderer,  // Legacy Tegra architecture (pre-K1).
    kTegra_GrGLRenderer,  // Tegra with the same architecture as NVIDIA desktop GPUs (K1+).
    kPowerVR54x_GrGLRenderer,
    kPowerVRRogue_GrGLRenderer,
    kAdreno3xx_GrGLRenderer,
    kAdreno430_GrGLRenderer,
    kAdreno4xx_other_GrGLRenderer,
    kAdreno5xx_GrGLRenderer,
    kGoogleSwiftShader_GrGLRenderer,

    /** Intel GPU families, ordered by generation **/
    // 6th gen
    kIntelSandyBridge_GrGLRenderer,

    // 7th gen
    kIntelIvyBridge_GrGLRenderer,
    kIntelValleyView_GrGLRenderer, // aka BayTrail
    kIntelHaswell_GrGLRenderer,

    // 8th gen
    kIntelCherryView_GrGLRenderer, // aka Braswell
    kIntelBroadwell_GrGLRenderer,

    // 9th gen
    kIntelApolloLake_GrGLRenderer,
    kIntelSkyLake_GrGLRenderer,
    kIntelGeminiLake_GrGLRenderer,
    kIntelKabyLake_GrGLRenderer,
    kIntelCoffeeLake_GrGLRenderer,

    // 11th gen
    kIntelIceLake_GrGLRenderer,

    kGalliumLLVM_GrGLRenderer,
    kMali4xx_GrGLRenderer,
    /** T-6xx, T-7xx, or T-8xx */
    kMaliT_GrGLRenderer,
    kANGLE_GrGLRenderer,

    kAMDRadeonHD7xxx_GrGLRenderer,  // AMD Radeon HD 7000 Series
    kAMDRadeonR9M4xx_GrGLRenderer,  // AMD Radeon R9 M400 Series

    kOther_GrGLRenderer
};
enum GrGLDriver {
    kMesa_GrGLDriver,
    kChromium_GrGLDriver,
    kNVIDIA_GrGLDriver,
    kIntel_GrGLDriver,
    kANGLE_GrGLDriver,
    kSwiftShader_GrGLDriver,
    kQualcomm_GrGLDriver,
    kAndroidEmulator_GrGLDriver,
    kUnknown_GrGLDriver
};
enum class GrGLANGLEBackend {
    kUnknown,
    kD3D9,
    kD3D11,
    kOpenGL
};
enum class GrGLANGLEVendor {
    kUnknown,
    kIntel
};
enum class GrGLANGLERenderer {
    kUnknown,
    kSandyBridge,
    kIvyBridge,
    kSkylake
};
////////////////////////////////////////////////////////////////////////////////

/**
 *  Some drivers want the var-int arg to be zero-initialized on input.
 */
#  define GR_GL_INIT_ZERO	0
#  define GR_GL_GetIntegerv(gl, e, p)	                                            \
    do {                                                                       \
        *(p) = GR_GL_INIT_ZERO;                                                \
        GR_GL_CALL(gl, GetIntegerv(e, p));                                     \
    } while (0)
#  define GR_GL_GetFramebufferAttachmentParameteriv(gl, t, a, pname, p)	          \
    do {                                                                       \
        *(p) = GR_GL_INIT_ZERO;                                                \
        GR_GL_CALL(gl, GetFramebufferAttachmentParameteriv(t, a, pname, p));   \
    } while (0)
#  define GR_GL_GetInternalformativ(gl, t, f, n, s, p)	                           \
    do {                                                                       \
        *(p) = GR_GL_INIT_ZERO;                                                \
        GR_GL_CALL(gl, GetInternalformativ(t, f, n, s, p));                    \
    } while (0)
#  define GR_GL_GetNamedFramebufferAttachmentParameteriv(gl, fb, a, pname, p)	          \
    do {                                                                             \
        *(p) = GR_GL_INIT_ZERO;                                                      \
        GR_GL_CALL(gl, GetNamedFramebufferAttachmentParameteriv(fb, a, pname, p));   \
    } while (0)
#  define GR_GL_GetRenderbufferParameteriv(gl, t, pname, p)	                      \
    do {                                                                       \
        *(p) = GR_GL_INIT_ZERO;                                                \
        GR_GL_CALL(gl, GetRenderbufferParameteriv(t, pname, p));               \
    } while (0)
#  define GR_GL_GetTexLevelParameteriv(gl, t, l, pname, p)	                       \
    do {                                                                       \
        *(p) = GR_GL_INIT_ZERO;                                                \
        GR_GL_CALL(gl, GetTexLevelParameteriv(t, l, pname, p));                \
    } while (0)
#  define GR_GL_GetShaderPrecisionFormat(gl, st, pt, range, precision)	           \
    do {                                                                       \
        (range)[0] = GR_GL_INIT_ZERO;                                          \
        (range)[1] = GR_GL_INIT_ZERO;                                          \
        (*precision) = GR_GL_INIT_ZERO;                                        \
        GR_GL_CALL(gl, GetShaderPrecisionFormat(st, pt, range, precision));    \
    } while (0)
////////////////////////////////////////////////////////////////////////////////

/**
 * Helpers for glGetString()
 */

// these variants assume caller already has a string from glGetString()
GrGLVersion GrGLGetVersionFromString(const char* versionString);
GrGLStandard GrGLGetStandardInUseFromString(const char* versionString);
GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString);
GrGLVendor GrGLGetVendorFromString(const char* vendorString);
GrGLRenderer GrGLGetRendererFromStrings(const char* rendererString, const GrGLExtensions&);
void GrGLGetANGLEInfoFromString(const char* rendererString, GrGLANGLEBackend*, GrGLANGLEVendor*, GrGLANGLERenderer*);
void GrGLGetDriverInfo(GrGLStandard standard, GrGLVendor vendor, const char* rendererString, const char* versionString, GrGLDriver* outDriver, GrGLDriverVersion* outVersion);
// these variants call glGetString()
GrGLVersion GrGLGetVersion(const GrGLInterface*);
GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface*);
GrGLVendor GrGLGetVendor(const GrGLInterface*);
GrGLRenderer GrGLGetRenderer(const GrGLInterface*);
/**
 * Helpers for glGetError()
 */
void GrGLCheckErr(const GrGLInterface* gl, const char* location, const char* call);
void GrGLClearErr(const GrGLInterface* gl);
////////////////////////////////////////////////////////////////////////////////

/**
 * Macros for using GrGLInterface to make GL calls
 */

// internal macro to conditionally call glGetError based on compile-time and
// run-time flags.
#  if  GR_GL_CHECK_ERROR
extern bool gCheckErrorGL;
#    define GR_GL_CHECK_ERROR_IMPL(IFACE, X)	                    \
        if (gCheckErrorGL)                                      \
            GrGLCheckErr(IFACE, GR_FILE_AND_LINE_STR, #X)
#  else
#    define GR_GL_CHECK_ERROR_IMPL(IFACE, X)
#  endif
// internal macro to conditionally log the gl call using SkDebugf based on
// compile-time and run-time flags.
#  if  GR_GL_LOG_CALLS
extern bool gLogCallsGL;
#    define GR_GL_LOG_CALLS_IMPL(X)	                             \
        if (gLogCallsGL)                                        \
            SkDebugf(GR_FILE_AND_LINE_STR "GL: " #X "\n")
#  else
#    define GR_GL_LOG_CALLS_IMPL(X)
#  endif
// makes a GL call on the interface and does any error checking and logging
#  define GR_GL_CALL(IFACE, X)	                                    \
    do {                                                        \
        GR_GL_CALL_NOERRCHECK(IFACE, X);                        \
        GR_GL_CHECK_ERROR_IMPL(IFACE, X);                       \
    } while (false)
// Variant of above that always skips the error check. This is useful when
// the caller wants to do its own glGetError() call and examine the error value.
#  define GR_GL_CALL_NOERRCHECK(IFACE, X)	                         \
    do {                                                        \
        (IFACE)->fFunctions.f##X;                               \
        GR_GL_LOG_CALLS_IMPL(X);                                \
    } while (false)
// same as GR_GL_CALL but stores the return value of the gl call in RET
#  define GR_GL_CALL_RET(IFACE, RET, X)	                           \
    do {                                                        \
        GR_GL_CALL_RET_NOERRCHECK(IFACE, RET, X);               \
        GR_GL_CHECK_ERROR_IMPL(IFACE, X);                       \
    } while (false)
// same as GR_GL_CALL_RET but always skips the error check.
#  define GR_GL_CALL_RET_NOERRCHECK(IFACE, RET, X)	                \
    do {                                                        \
        (RET) = (IFACE)->fFunctions.f##X;                       \
        GR_GL_LOG_CALLS_IMPL(X);                                \
    } while (false)
// call glGetError without doing a redundant error check or logging.
#  define GR_GL_GET_ERROR(IFACE) (IFACE)->fFunctions.fGetError()
static constexpr GrGLFormat GrGLFormatFromGLEnum(GrGLenum glFormat)
{
  switch(glFormat)
  {
    case GR_GL_RGBA8:
      return GrGLFormat::kRGBA8;
    case GR_GL_R8:
      return GrGLFormat::kR8;
    case GR_GL_ALPHA8:
      return GrGLFormat::kALPHA8;
    case GR_GL_LUMINANCE8:
      return GrGLFormat::kLUMINANCE8;
    case GR_GL_BGRA8:
      return GrGLFormat::kBGRA8;
    case GR_GL_RGB565:
      return GrGLFormat::kRGB565;
    case GR_GL_RGBA16F:
      return GrGLFormat::kRGBA16F;
    case GR_GL_LUMINANCE16F:
      return GrGLFormat::kLUMINANCE16F;
    case GR_GL_R16F:
      return GrGLFormat::kR16F;
    case GR_GL_RGB8:
      return GrGLFormat::kRGB8;
    case GR_GL_RG8:
      return GrGLFormat::kRG8;
    case GR_GL_RGB10_A2:
      return GrGLFormat::kRGB10_A2;
    case GR_GL_RGBA4:
      return GrGLFormat::kRGBA4;
    case GR_GL_SRGB8_ALPHA8:
      return GrGLFormat::kSRGB8_ALPHA8;
    case GR_GL_COMPRESSED_RGB8_ETC2:
      return GrGLFormat::kCOMPRESSED_RGB8_ETC2;
    case GR_GL_COMPRESSED_ETC1_RGB8:
      return GrGLFormat::kCOMPRESSED_ETC1_RGB8;
    case GR_GL_R16:
      return GrGLFormat::kR16;
    case GR_GL_RG16:
      return GrGLFormat::kRG16;
    case GR_GL_RGBA16:
      return GrGLFormat::kRGBA16;
    case GR_GL_RG16F:
      return GrGLFormat::kRG16F;
default:
    return GrGLFormat::kUnknown;
}
}
/** Returns either the sized internal format or compressed internal format of the GrGLFormat. */
static constexpr GrGLenum GrGLFormatToEnum(GrGLFormat format)
{
  switch(format)
  {
    case GrGLFormat::kRGBA8:
      return GR_GL_RGBA8;
    case GrGLFormat::kR8:
      return GR_GL_R8;
    case GrGLFormat::kALPHA8:
      return GR_GL_ALPHA8;
    case GrGLFormat::kLUMINANCE8:
      return GR_GL_LUMINANCE8;
    case GrGLFormat::kBGRA8:
      return GR_GL_BGRA8;
    case GrGLFormat::kRGB565:
      return GR_GL_RGB565;
    case GrGLFormat::kRGBA16F:
      return GR_GL_RGBA16F;
    case GrGLFormat::kLUMINANCE16F:
      return GR_GL_LUMINANCE16F;
    case GrGLFormat::kR16F:
      return GR_GL_R16F;
    case GrGLFormat::kRGB8:
      return GR_GL_RGB8;
    case GrGLFormat::kRG8:
      return GR_GL_RG8;
    case GrGLFormat::kRGB10_A2:
      return GR_GL_RGB10_A2;
    case GrGLFormat::kRGBA4:
      return GR_GL_RGBA4;
    case GrGLFormat::kSRGB8_ALPHA8:
      return GR_GL_SRGB8_ALPHA8;
    case GrGLFormat::kCOMPRESSED_RGB8_ETC2:
      return GR_GL_COMPRESSED_RGB8_ETC2;
    case GrGLFormat::kCOMPRESSED_ETC1_RGB8:
      return GR_GL_COMPRESSED_ETC1_RGB8;
    case GrGLFormat::kR16:
      return GR_GL_R16;
    case GrGLFormat::kRG16:
      return GR_GL_RG16;
    case GrGLFormat::kRGBA16:
      return GR_GL_RGBA16;
    case GrGLFormat::kRG16F:
      return GR_GL_RG16F;
    case GrGLFormat::kUnknown:
      return 0;
  }
  SkUNREACHABLE;
}
#  if  GR_TEST_UTILS
static constexpr const char* GrGLFormatToStr(GrGLenum glFormat)
{
  switch(glFormat)
  {
    case GR_GL_RGBA8:
      return "RGBA8";
    case GR_GL_R8:
      return "R8";
    case GR_GL_ALPHA8:
      return "ALPHA8";
    case GR_GL_LUMINANCE8:
      return "LUMINANCE8";
    case GR_GL_BGRA8:
      return "BGRA8";
    case GR_GL_RGB565:
      return "RGB565";
    case GR_GL_RGBA16F:
      return "RGBA16F";
    case GR_GL_LUMINANCE16F:
      return "LUMINANCE16F";
    case GR_GL_R16F:
      return "R16F";
    case GR_GL_RGB8:
      return "RGB8";
    case GR_GL_RG8:
      return "RG8";
    case GR_GL_RGB10_A2:
      return "RGB10_A2";
    case GR_GL_RGBA4:
      return "RGBA4";
    case GR_GL_RGBA32F:
      return "RGBA32F";
    case GR_GL_SRGB8_ALPHA8:
      return "SRGB8_ALPHA8";
    case GR_GL_COMPRESSED_RGB8_ETC2:
      return "ETC2";
    case GR_GL_COMPRESSED_ETC1_RGB8:
      return "ETC1";
    case GR_GL_R16:
      return "R16";
    case GR_GL_RG16:
      return "RG16";
    case GR_GL_RGBA16:
      return "RGBA16";
    case GR_GL_RG16F:
      return "RG16F";
default:
    return "Unknown";
}
}
#  endif
GrGLenum GrToGLStencilFunc(GrStencilTest test);
/**
 * Returns true if the format is compressed.
 */
bool GrGLFormatIsCompressed(GrGLFormat);
/**
 * Maps a GrGLFormat into the CompressionType enum if appropriate.
 */
bool GrGLFormatToCompressionType(GrGLFormat, SkImage::CompressionType*);
size_t GrGLBytesPerFormat(GrGLFormat);
#endif


text:
package org.ow2.chameleon.rose;

import org.osgi.service.remoteserviceadmin.EndpointDescription;
import org.osgi.service.remoteserviceadmin.ImportReference;
import org.osgi.service.remoteserviceadmin.ImportRegistration;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * The component providing this service are capable of creating a proxy thanks
 * to an {@link EndpointDescription}.
 *
 * @author barjo
 */
public interface ImporterService {

	/**
	 * Reify the endpoint of given description as a local service.
	 *
	 * @param description The {@link EndpointDescription} of the endpoint to be imported.
	 * @param properties optional properties (must be crushed by the description properties if conflict).
	 * @return An {@link ImportRegistration}.
	 */
	ImportRegistration importService(EndpointDescription description,Map<String, Object> properties);

	/**
	 * @return The configuration prefix used or defined by this {@link ImporterService}. (i.e json-rpc,org.jabsorb,jax-rs.
	 */
	List<String> getConfigPrefix();

	/**
     * @return All {@link ImportReference} of services imported through this
     *         service.
     */
    Collection<ImportReference> getAllImportReference();

    /**
     * @return The {@code RoseMachine} linked to this {@code ImporterService}
     */
    RoseMachine getRoseMachine();
}


text:
#pragma once
#ifndef CPU_HPP
#define CPU_HPP

#include <array>
#include <cstdint>

/**
 * @brief The CPU class
 */
class CPU
{

public:
    CPU();

    static const int memorySize = 0x1000;
    static const int startAdress = 0x200;

private:

    // memory
    std::array<std::uint8_t, memorySize> memory;
    std::uint16_t pc; //< Programme Counter

    //register
    std::array<std::uint8_t, 16> V; //< V0 to VF
    std::uint16_t I;

    //stack
    std::array<std::uint16_t, 16> stack;
    std::uint8_t stackPosition;

    // Timer
    std::uint8_t sysTimer;
    std::uint8_t soundTimer;

};

#endif // CPU_H


text: {{ col.getAggregationValue() }}


text:
using BeardedManStudios;
using System;
using System.Collections.Generic;

namespace MasterServer
{
	class Program
	{
		private static void Main(string[] args)
		{
			string host = "0.0.0.0";
			ushort port = 15940;
			string read = string.Empty;
			int eloRange = 0;

			Dictionary<string, string> arguments = ArgumentParser.Parse(args);

			if (args.Length > 0)
			{
				if (arguments.ContainsKey("host"))
					host = arguments["host"];

				if (arguments.ContainsKey("port"))
					ushort.TryParse(arguments["port"], out port);

				if (arguments.ContainsKey("elorange"))
					int.TryParse(arguments["elorange"], out eloRange);
			}
			else
			{
				Console.WriteLine("Entering nothing will choose defaults.");
				Console.WriteLine("Enter Host IP (Default: 0.0.0.0):");
				read = Console.ReadLine();
				if (string.IsNullOrEmpty(read))
					host = "0.0.0.0";
				else
					host = read;

				Console.WriteLine("Enter Port (Default: 15940):");
				read = Console.ReadLine();
				if (string.IsNullOrEmpty(read))
					port = 15940;
				else
				{
					ushort.TryParse(read, out port);
				}
			}

			Console.WriteLine(string.Format("Hosting ip [{0}] on port [{1}]", host, port));
			PrintHelp();
			MasterServer server = new MasterServer(host, port);
			server.EloRange = eloRange;
			server.ToggleLogging();

			while (true)
			{
				read = Console.ReadLine().ToLower();
				if (read == "s" || read == "stop")
				{
					lock (server)
					{
						Console.WriteLine("Server stopped.");
						server.Dispose();
					}
				}
				else if (read == "l" || read == "log")
				{
					if (server.ToggleLogging())
						Console.WriteLine("Logging has been enabled");
					else
						Console.WriteLine("Logging has been disabled");
				}
				else if (read == "r" || read == "restart")
				{
					lock (server)
					{
						if (server.IsRunning)
						{
							Console.WriteLine("Server stopped.");
							server.Dispose();
						}
					}

					Console.WriteLine("Restarting...");
					Console.WriteLine(string.Format("Hosting ip [{0}] on port [{1}]", host, port));
					server = new MasterServer(host, port);
				}
				else if (read == "q" || read == "quit")
				{
					lock (server)
					{
						Console.WriteLine("Quitting...");
						server.Dispose();
					}
					break;
				}
				else if (read == "h" || read == "help")
					PrintHelp();
				else if (read.StartsWith("elo"))
				{
					int index = read.IndexOf("=");
					string val = read.Substring(index + 1, read.Length - (index + 1));
					if (int.TryParse(val.Replace(" ", string.Empty), out index))
					{
						Console.WriteLine(string.Format("Elo range set to {0}", index));
						if (index == 0)
							Console.WriteLine("Elo turned off");
						server.EloRange = index;
					}
					else
						Console.WriteLine("Invalid elo range provided (Must be an integer)\n");
				}
				else
					Console.WriteLine("Command not recognized, please try again");
			}
		}

		private static void PrintHelp()
		{
			Console.WriteLine(@"Commands Available
(s)top - Stops hosting
(r)estart - Restarts the hosting service even when stopped
(l)og - Toggles logging (starts off)
(q)uit - Quits the application
(h)elp - Get a full list of comands");
		}
	}
}


text:
package org.testng;

import java.io.File;

import java.util.HashMap;
import java.util.Map;

import org.testng.internal.AnnotationDirectoryConverter;

/**
 * Converts between javadoc annotations and java 5 annotations.
 *
 * @author micheb10 12-Sep-2006
 * @since 5.3
 */
public class AnnotationConverter {
  private static final String SRC_DIR_OPT= "-srcdir";
  private static final String OUT_DIR_OPT= "-d";
  private static final String OVERWRITE_OPT= "-overwrite";
  private static final String QUIET= "-quiet";

  private static int m_logLevel= 1;

  /**
   * @param args
   */
  public static void main(String[] args) {
    if(args.length == 0) {
      usage();

      return;
    }

    Map<String, Object> params= extractOptions(args);

    if(null != params.get(QUIET)) {
      m_logLevel= 0;
    }
    if(null == params.get(SRC_DIR_OPT)) {
      TestNG.exitWithError("The source directory cannot be null");
    }

    String srcPath= (String) params.get(SRC_DIR_OPT);
    File src= new File(srcPath);

    if(!src.exists() || !src.isDirectory()) {
      TestNG.exitWithError("Invalid source directory: " + src.getAbsolutePath());
    }

    boolean overwrite= null != params.get(OVERWRITE_OPT);

    if((null != params.get(OUT_DIR_OPT)) && overwrite) {
      TestNG.exitWithError("Cannot use both -d and --overwrite options");
    }

    if((null == params.get(OUT_DIR_OPT)) && !overwrite) {
      TestNG.exitWithError("One of -d and --overwrite options is required");
    }

    File outFile= overwrite ? null : new File((String) params.get(OUT_DIR_OPT));
    AnnotationDirectoryConverter convertor= new AnnotationDirectoryConverter(new File(srcPath), outFile);
    int result= convertor.convert();

    switch(result) {
      case -1: {
        log("Generation failed. Consult messages.");

        break;
      }
      case 0: {
        log("No tests were generated");
      }
      default:
      {
        log(result + " tests were generated");
      }
    }
  }

  /**
   * Prints usage info to console.
   */
  private static void usage() {
    System.out.println("Converts Javadoc annotated test cases to Java 5 annotated cases");
    System.out.println("Usage: java -cp <> org.testng.AnnotationConverter "
                       + "-srcdir <source_dir> (-d <output_dir> | -overwrite)"
                       + " [-quiet]");
    System.out.println("");
    System.out.println("-srcdir\t Source directory containing original tests");
    System.out.println("-d\t\t Output directory for resulting TestNG tests");
    System.out.println("-overwrite\t Overwrite the original files with the new ones"
                       + "\n\t\t The flag cannot be used when -d is used.");
    System.out.println("-quiet\t Don't display any output");
  }

  /**
   * Extract command line options.
   */
  private static Map<String, Object> extractOptions(String[] args) {
    Map<String, Object> options= new HashMap<String, Object>();

    for(int i= 0; i < args.length; i++) {
      if(SRC_DIR_OPT.equals(args[i])) {
        if((i + 1) < args.length) {
          options.put(SRC_DIR_OPT, args[i + 1]);
          i++;
        }
      }
      else if(OUT_DIR_OPT.equals(args[i])) {
        if((i + 1) < args.length) {
          options.put(OUT_DIR_OPT, args[i + 1]);
          i++;
        }
      }
      else if(OVERWRITE_OPT.equals(args[i])) {
        options.put(OVERWRITE_OPT, Boolean.TRUE);
      }
      else if(QUIET.equals(args[i])) {
        options.put(QUIET, Boolean.TRUE);
      }
    }

    return options;
  }

  public static void log(String s) {
    if(getLogLevel() > 0) {
      System.out.println("[AnnotationConverter] " + s);
    }
  }

  public static int getLogLevel() {
    return m_logLevel;
  }

  public static void ppp(String s) {
    System.out.println("[AnnotationConverter] " + s);
  }

}


text:
$: << '../lib'

require 'ubiquity'
require 'pp'

my_dir=File.dirname(__FILE__)
fname = 'Mirasol-Can Rabella'

in_file = File.join(my_dir, 'tmp', fname + '.gpx')
out_file = File.join(my_dir, 'tmp', fname + '_out.gpx')

track_segment_in = Ubiquity::TrackSegment.new

# READ GPX
File.open(in_file,'r') { |f| track_segment_in.parse_gpx f.read }
puts "Total: #{track_segment_in.points.count} points"

# PROCESS TRACKSEGMENT
#elevs_in = Ubiquity::Helpers::Enumerable.extract(track_segment_in.points) {|p| p.elems['ele']}
elevs_in = track_segment_in.elevations
elevs_out = Ubiquity::Filters.moving_average(elevs_in,7)

pp Ubiquity::Helpers::Enumerable.compose(elevs_in,elevs_out)


text:
/**
 * entry module
 *
 * @author victor li
 * @date 2015/06/22
 */

'use strict';

window.React = require('react');
window.$ = window.jQuery = require('jquery');
require('bootstrap');

var Reflux = require('reflux');

var ReactRouter = require('react-router');
var Route = ReactRouter.Route;
var RouteHandler = ReactRouter.RouteHandler;
var DefaultRoute = ReactRouter.DefaultRoute;
var Link = ReactRouter.Link;
var UserAction = require('./actions/UserAction');
var Header = require('./components/Header');
var Work = require('./views/Work');
var Signup = require('./views/Signup');
var Login = require('./views/Login');
var Update = require('./views/Update');
var Profile = require('./views/Profile');
var Publish = require('./views/Publish.js');
var UserStore = require('./stores/UserStore');
var Search = require('./components/Search');
var Footer = require('./components/Footer');

var WorksOfArt = React.createClass({

    mixins: [
        require('react-router').Navigation
    ],

    getInitialState: function() {
        return null;
    },

    render: function() {
        return (

                    <RouteHandler />

        );
    }
});

var routes = (
    <Route handler={WorksOfArt}>
        <Route name='login' path='/user/login/' handler={Login}></Route>
        <Route name='signup' path='/user/signup/' handler={Signup}></Route>
        <Route name='update' path='/user/update/' handler={Update}></Route>
        <Route name='profile' path='/user/profile/:uid' handler={Profile}></Route>
        <Route name='publish' path='/work/publish' handler={Publish}></Route>
        <DefaultRoute name='home' handler={Work}></DefaultRoute>
    </Route>
);

ReactRouter.run(routes, function(Handler, state) {
    React.render(<Handler params={ state.params } />, document.getElementById('app'));
});


text:
<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>com.micmiu.mvc</groupId>
    <artifactId>ferriswheel</artifactId>
    <version>1.3.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>${project.artifactId}</name>

    <description>a simple mvc framework</description>
    <url>http://www.micmiu.com</url>
    <developers>
        <developer>
            <id>Michael</id>
            <name>Michael Sun</name>
            <email>sjsky007@gmail.com</email>
            <url>http://www.micmiu.com</url>
            <timezone>+8</timezone>
            <roles>
                <role>architect</role>
                <role>developer</role>
            </roles>
        </developer>
    </developers>
    <contributors>
    </contributors>
    <organization>
        <name>Michael Sun</name>
        <url>http://www.micmiu.com</url>
    </organization>

    <prerequisites>
        <maven>3.0.0</maven>
    </prerequisites>

    <modules>
        <module>ferriswheel-parent</module>
        <module>ferriswheel-common</module>
        <module>ferriswheel-utils</module>
        <module>ferriswheel-core</module>
        <module>ferriswheel-spring</module>
        <module>ferriswheel-orm</module>
        <module>ferriswheel-support</module>
        <module>ferriswheel-demos</module>
    </modules>

    <licenses>
        <license>
            <name>Apache 2.0 License</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/micmiu/ferriswheel</url>
        <connection>scm:git:git://github.com/micmiu/ferriswheel.git</connection>
        <developerConnection>scm:git:ssh://git@github.com:micmiu/ferriswheel.git</developerConnection>
    </scm>

    <distributionManagement>
        <repository>
            <id>edata-releases</id>
            <name>Nexus Release Repository</name>
            <url>http://192.168.1.123:1984/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>edata-snapshots</id>
            <name>Nexus snapshots Repository</name>
            <url>http://192.168.1.123:1984/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
</project>


text:
//  ------------------------------------------------------------------------------------
//  Copyright (c) Microsoft Corporation
//  All rights reserved.
//
//  Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this
//  file except in compliance with the License. You may obtain a copy of the License at
//  http://www.apache.org/licenses/LICENSE-2.0
//
//  THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
//  EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
//  CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR
//  NON-INFRINGEMENT.
//
//  See the Apache Version 2.0 License for specific language governing permissions and
//  limitations under the License.
//  ------------------------------------------------------------------------------------

namespace Amqp.Serialization
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Reflection;
    using Amqp.Types;

    static class SerializationCallback
    {
        public const int OnSerializing = 0;
        public const int OnSerialized = 1;
        public const int OnDeserializing = 2;
        public const int OnDeserialized = 3;
    }

    abstract class SerializableType
    {
        readonly AmqpSerializer serializer;
        readonly Type type;
        readonly bool hasDefaultCtor;

        protected SerializableType(AmqpSerializer serializer, Type type)
        {
            this.serializer = serializer;
            this.type = type;
            this.hasDefaultCtor = type.GetConstructor(Type.EmptyTypes) != null;
        }

        public virtual EncodingType Encoding
        {
            get
            {
                throw new InvalidOperationException();
            }
        }

        public virtual SerializableMember[] Members
        {
            get
            {
                throw new InvalidOperationException();
            }
        }

        public static SerializableType CreatePrimitiveType(Type type, Encode encoder, Decode decoder)
        {
            return new AmqpPrimitiveType(type, encoder, decoder);
        }

        public static SerializableType CreateObjectType(Type type)
        {
            return new AmqpObjectType(type);
        }

        public static SerializableType CreateEnumType(Type type, SerializableType underlyingType)
        {
            return new EnumType(type, underlyingType);
        }

        public static SerializableType CreateAmqpSerializableType(AmqpSerializer serializer, Type type)
        {
            return new AmqpSerializableType(serializer, type);
        }

        public static SerializableType CreateArrayType(AmqpSerializer serializer, Type type, Type itemType)
        {
            return new ArrayType(serializer, type, itemType);
        }

        public static SerializableType CreateGenericListType(
            AmqpSerializer serializer,
            Type type,
            Type itemType,
            MethodAccessor addAccessor)
        {
            return new GenericListType(serializer, type, itemType, addAccessor);
        }

        public static SerializableType CreateGenericMapType(
            AmqpSerializer serializer,
            Type type,
            MemberAccessor keyAccessor,
            MemberAccessor valueAccessor,
            MethodAccessor addAccessor)
        {
            return new GenericMapType(serializer, type, keyAccessor, valueAccessor, addAccessor);
        }

        public static SerializableType CreateDescribedListType(
            AmqpSerializer serializer,
            Type type,
            SerializableType baseType,
            string descriptorName,
            ulong? descriptorCode,
            SerializableMember[] members,
            Dictionary<Type, SerializableType> knownTypes,
            MethodAccessor[] serializationCallbacks)
        {
            return new DescribedListType(serializer, type, baseType, descriptorName,
                descriptorCode, members, knownTypes, serializationCallbacks);
        }

        public static SerializableType CreateDescribedMapType(
            AmqpSerializer serializer,
            Type type,
            SerializableType baseType,
            string descriptorName,
            ulong? descriptorCode,
            SerializableMember[] members,
            Dictionary<Type, SerializableType> knownTypes,
            MethodAccessor[] serializationCallbacks)
        {
            return new DescribedMapType(serializer, type, baseType, descriptorName, descriptorCode,
                members, knownTypes, serializationCallbacks);
        }

        public static SerializableType CreateDescribedSimpleMapType(
            AmqpSerializer serializer,
            Type type,
            SerializableType baseType,
            SerializableMember[] members,
            MethodAccessor[] serializationCallbacks)
        {
            return new DescribedSimpleMapType(serializer, type, baseType, members, serializationCallbacks);
        }

        public static SerializableType CreateDescribedSimpleListType(
            AmqpSerializer serializer,
            Type type,
            SerializableType baseType,
            SerializableMember[] members,
            MethodAccessor[] serializationCallbacks)
        {
            return new DescribedSimpleListType(serializer, type, baseType, members, serializationCallbacks);
        }

        public virtual void ValidateType(SerializableType otherType)
        {
        }

        public abstract void WriteObject(ByteBuffer buffer, object graph);

        public abstract object ReadObject(ByteBuffer buffer);

        sealed class AmqpPrimitiveType : SerializableType
        {
            readonly Encode encoder;
            readonly Decode decoder;

            public AmqpPrimitiveType(Type type, Encode encoder, Decode decoder)
                : base(null, type)
            {
                this.encoder = encoder;
                this.decoder = decoder;
            }

            public override void WriteObject(ByteBuffer buffer, object value)
            {
                this.encoder(buffer, value, true);
            }

            public override object ReadObject(ByteBuffer buffer)
            {
                byte formatCode = Encoder.ReadFormatCode(buffer);
                return this.decoder(buffer, formatCode);
            }
        }

        sealed class AmqpObjectType : SerializableType
        {
            public AmqpObjectType(Type type)
                : base(null, type)
            {
            }

            public override void WriteObject(ByteBuffer buffer, object value)
            {
                Encoder.WriteObject(buffer, value);
            }

            public override object ReadObject(ByteBuffer buffer)
            {
                return Encoder.ReadObject(buffer);
            }
        }

        sealed class EnumType : SerializableType
        {
            readonly SerializableType underlyingType;

            public EnumType(Type type, SerializableType underlyingType)
                : base(null, type)
            {
                this.underlyingType = underlyingType;
            }

            public override void WriteObject(ByteBuffer buffer, object value)
            {
                if (value == null)
                {
                    Encoder.WriteObject(buffer, value);
                }
                else
                {
                    value = Convert.ChangeType(value, this.underlyingType.type);
                    this.underlyingType.WriteObject(buffer, value);
                }
            }

            public override object ReadObject(ByteBuffer buffer)
            {
                object value = this.underlyingType.ReadObject(buffer);
                if (value != null)
                {
                    value = Enum.ToObject(this.type, value);
                }

                return value;
            }
        }

        sealed class AmqpSerializableType : SerializableType
        {
            public AmqpSerializableType(AmqpSerializer serializer, Type type)
                : base(serializer, type)
            {
            }

            public override void WriteObject(ByteBuffer buffer, object value)
            {
                if (value == null)
                {
                    Encoder.WriteObject(buffer, value);
                }
                else
                {
                    ((IAmqpSerializable)value).Encode(buffer);
                }
            }

            public override object ReadObject(ByteBuffer buffer)
            {
                buffer.Validate(false, FixedWidth.FormatCode);
                byte formatCode = buffer.Buffer[buffer.Offset];
                if (formatCode == FormatCode.Null)
                {
                    buffer.Complete(FixedWidth.FormatCode);
                    return null;
                }
                else
                {
                    object value = this.type.CreateInstance(this.hasDefaultCtor);
                    ((IAmqpSerializable)value).Decode(buffer);
                    return value;
                }
            }
        }

        abstract class CollectionType : SerializableType
        {
            protected CollectionType(AmqpSerializer serializer, Type type)
                : base(serializer, type)
            {
            }

            protected abstract int WriteMembers(ByteBuffer buffer, object container);

            protected abstract void ReadMembers(ByteBuffer buffer, object container, ref int count);

            protected abstract bool WriteFormatCode(ByteBuffer buffer);

            protected abstract void Initialize(ByteBuffer buffer, byte formatCode,
                out int size, out int count, out int encodeWidth, out CollectionType effectiveType);

            public override void WriteObject(ByteBuffer buffer, object graph)
            {
                if (graph == null)
                {
                    Encoder.WriteObject(buffer, null);
                    return;
                }

                if (!this.WriteFormatCode(buffer))
                {
                    return;
                }

                int pos = buffer.WritePos;                  // remember the current position
                AmqpBitConverter.WriteULong(buffer, 0);     // reserve space for size and count

                int count = this.WriteMembers(buffer, graph);

                AmqpBitConverter.WriteInt(buffer.Buffer, pos, buffer.WritePos - pos - FixedWidth.UInt);
                AmqpBitConverter.WriteInt(buffer.Buffer, pos + FixedWidth.UInt, count);
            }

            public override object ReadObject(ByteBuffer buffer)
            {
                byte formatCode = Encoder.ReadFormatCode(buffer);
                if (formatCode == FormatCode.Null)
                {
                    return null;
                }

                int size;
                int count;
                int encodeWidth;
                CollectionType effectiveType;
                this.Initialize(buffer, formatCode, out size, out count, out encodeWidth, out effectiveType);
                int offset = buffer.Offset;

                object container = effectiveType.type.CreateInstance(effectiveType.hasDefaultCtor);

                if (count > 0)
                {
                    effectiveType.ReadMembers(buffer, container, ref count);

                    if (count > 0)
                    {
                        // skip unknown members
                        buffer.Complete(size - (buffer.Offset - offset) - encodeWidth);
                    }
                }

                return container;
            }

            protected static void ReadSizeAndCount(ByteBuffer buffer, byte formatCode, out int size, out int count, out int width)
            {
                if (formatCode == FormatCode.List0)
                {
                    size = count = width = 0;
                }
                else if (formatCode == FormatCode.List8 || formatCode == FormatCode.Map8)
                {
                    width = FixedWidth.UByte;
                    size = AmqpBitConverter.ReadUByte(buffer);
                    count = AmqpBitConverter.ReadUByte(buffer);
                }
                else if (formatCode == FormatCode.List32 || formatCode == FormatCode.Map32)
                {
                    width = FixedWidth.UInt;
                    size = (int)AmqpBitConverter.ReadUInt(buffer);
                    count = (int)AmqpBitConverter.ReadUInt(buffer);
                }
                else
                {
                    throw new AmqpException(ErrorCode.InvalidField, Fx.Format(SRAmqp.AmqpInvalidFormatCode, formatCode, buffer.Offset));
                }
            }
        }

        sealed class ArrayType : SerializableType
        {
            readonly Type itemType;
            readonly SerializableType listType;

            public ArrayType(AmqpSerializer serializer, Type type, Type itemType)
                : base(serializer, type)
            {
                this.itemType = itemType;
                this.listType = serializer.GetType(typeof(List<>).MakeGenericType(itemType));
            }

            public override void WriteObject(ByteBuffer buffer, object graph)
            {
                this.listType.WriteObject(buffer, graph);
            }

            public override object ReadObject(ByteBuffer buffer)
            {
                object value = this.listType.ReadObject(buffer);
                if (value != null)
                {
                    ICollection list = (ICollection)value;
                    Array array = Array.CreateInstance(this.itemType, list.Count);
                    list.CopyTo(array, 0);
                    value = array;
                }

                return value;
            }
        }

        sealed class GenericListType : CollectionType
        {
            readonly SerializableType itemType;
            readonly MethodAccessor addMethodAccessor;

            public GenericListType(AmqpSerializer serializer, Type type, Type itemType, MethodAccessor addAccessor)
                : base(serializer, type)
            {
                this.itemType = serializer.GetType(itemType);
                this.addMethodAccessor = addAccessor;
            }

            protected override bool WriteFormatCode(ByteBuffer buffer)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.List32);
                return true;
            }

            protected override int WriteMembers(ByteBuffer buffer, object container)
            {
                int count = 0;
                foreach (object item in (IEnumerable)container)
                {
                    if (item == null)
                    {
                        Encoder.WriteObject(buffer, null);
                    }
                    else
                    {
                        SerializableType effectiveType = this.itemType;
                        if (item.GetType() != effectiveType.type)
                        {
                            effectiveType = this.serializer.GetType(item.GetType());
                        }

                        effectiveType.WriteObject(buffer, item);
                    }

                    count++;
                }

                return count;
            }

            protected override void Initialize(ByteBuffer buffer, byte formatCode,
                out int size, out int count, out int encodeWidth, out CollectionType effectiveType)
            {
                effectiveType = this;
                ReadSizeAndCount(buffer, formatCode, out size, out count, out encodeWidth);
            }

            protected override void ReadMembers(ByteBuffer buffer, object container, ref int count)
            {
                for (; count > 0; count--)
                {
                    object value = this.itemType.ReadObject(buffer);
                    this.addMethodAccessor.Invoke(container, new object[] { value });
                }
            }
        }

        sealed class GenericMapType : CollectionType
        {
            readonly SerializableType keyType;
            readonly SerializableType valueType;
            readonly MemberAccessor keyAccessor;
            readonly MemberAccessor valueAccessor;
            readonly MethodAccessor addMethodAccessor;

            public GenericMapType(AmqpSerializer serializer, Type type, MemberAccessor keyAccessor,
                MemberAccessor valueAccessor, MethodAccessor addAccessor)
                : base(serializer, type)
            {
                this.keyType = this.serializer.GetType(keyAccessor.Type);
                this.valueType = this.serializer.GetType(valueAccessor.Type);
                this.keyAccessor = keyAccessor;
                this.valueAccessor = valueAccessor;
                this.addMethodAccessor = addAccessor;
            }

            protected override bool WriteFormatCode(ByteBuffer buffer)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.Map32);
                return true;
            }

            protected override int WriteMembers(ByteBuffer buffer, object container)
            {
                int count = 0;
                foreach (object item in (IEnumerable)container)
                {
                    object key = this.keyAccessor.Get(item);
                    object value = this.valueAccessor.Get(item);
                    if (value != null)
                    {
                        this.keyType.WriteObject(buffer, key);

                        SerializableType effectiveType = this.valueType;
                        if (value.GetType() != effectiveType.type)
                        {
                            effectiveType = this.serializer.GetType(value.GetType());
                        }

                        effectiveType.WriteObject(buffer, value);

                        count += 2;
                    }
                }
                return count;
            }

            protected override void Initialize(ByteBuffer buffer, byte formatCode,
                out int size, out int count, out int encodeWidth, out CollectionType effectiveType)
            {
                effectiveType = this;
                ReadSizeAndCount(buffer, formatCode, out size, out count, out encodeWidth);
            }

            protected override void ReadMembers(ByteBuffer buffer, object container, ref int count)
            {
                for (; count > 0; count -= 2)
                {
                    object key = this.keyType.ReadObject(buffer);
                    object value = this.valueType.ReadObject(buffer);
                    this.addMethodAccessor.Invoke(container, new object[] { key, value });
                }
            }
        }

        abstract class DescribedCompoundType : CollectionType
        {
            readonly DescribedCompoundType baseType;
            readonly Symbol descriptorName;
            readonly ulong? descriptorCode;
            readonly SerializableMember[] members;
            readonly MethodAccessor[] serializationCallbacks;
            readonly KeyValuePair<Type, SerializableType>[] knownTypes;

            protected DescribedCompoundType(
                AmqpSerializer serializer,
                Type type,
                SerializableType baseType,
                string descriptorName,
                ulong? descriptorCode,
                SerializableMember[] members,
                Dictionary<Type, SerializableType> knownTypes,
                MethodAccessor[] serializationCallbacks)
                : base(serializer, type)
            {
                this.baseType = (DescribedCompoundType)baseType;
                this.descriptorName = descriptorName;
                this.descriptorCode = descriptorCode;
                this.members = members;
                this.serializationCallbacks = serializationCallbacks;
                this.knownTypes = GetKnownTypes(knownTypes);
            }

            public override SerializableMember[] Members
            {
                get { return this.members; }
            }

            protected abstract byte Code
            {
                get;
            }

            protected DescribedCompoundType BaseType
            {
                get { return this.baseType; }
            }

            protected override int WriteMembers(ByteBuffer buffer, object container)
            {
                this.InvokeSerializationCallback(SerializationCallback.OnSerializing, container);

                int count = 0;
                foreach (SerializableMember member in this.members)
                {
                    object memberValue = member.Accessor.Get(container);
                    SerializableType effectiveType = member.Type;
                    if (memberValue != null && memberValue.GetType() != effectiveType.type)
                    {
                        effectiveType = this.serializer.GetType(memberValue.GetType());
                    }

                    count += this.WriteMemberValue(buffer, member.Name, memberValue, effectiveType);
                }

                this.InvokeSerializationCallback(SerializationCallback.OnSerialized, container);

                return count;
            }

            protected override void ReadMembers(ByteBuffer buffer, object container, ref int count)
            {
                this.InvokeSerializationCallback(SerializationCallback.OnDeserializing, container);

                for (int i = 0; i < this.members.Length && count > 0; ++i)
                {
                    count -= this.ReadMemberValue(buffer, this.members[i], container);
                }

                this.InvokeSerializationCallback(SerializationCallback.OnDeserialized, container);
            }

            protected abstract int WriteMemberValue(ByteBuffer buffer, string memberName, object memberValue, SerializableType effectiveType);

            protected abstract int ReadMemberValue(ByteBuffer buffer, SerializableMember serialiableMember, object container);

            protected override bool WriteFormatCode(ByteBuffer buffer)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.Described);
                if (this.descriptorCode != null)
                {
                    Encoder.WriteULong(buffer, this.descriptorCode.Value, true);
                }
                else
                {
                    Encoder.WriteSymbol(buffer, this.descriptorName, true);
                }

                AmqpBitConverter.WriteUByte(buffer, this.Code);
                return true;
            }

            protected override void Initialize(ByteBuffer buffer, byte formatCode,
                out int size, out int count, out int encodeWidth, out CollectionType effectiveType)
            {
                if (formatCode != FormatCode.Described)
                {
                    throw new AmqpException(ErrorCode.InvalidField, Fx.Format(SRAmqp.AmqpInvalidFormatCode, formatCode, buffer.Offset));
                }

                effectiveType = null;
                formatCode = Encoder.ReadFormatCode(buffer);
                ulong? code = null;
                Symbol symbol = default(Symbol);
                if (formatCode == FormatCode.ULong0)
                {
                    code = 0;
                }
                else if (formatCode == FormatCode.ULong || formatCode == FormatCode.SmallULong)
                {
                    code = Encoder.ReadULong(buffer, formatCode);
                }
                else if (formatCode == FormatCode.Symbol8 || formatCode == FormatCode.Symbol32)
                {
                    symbol = Encoder.ReadSymbol(buffer, formatCode);
                }

                if (this.AreEqual(this.descriptorCode, this.descriptorName, code, symbol))
                {
                    effectiveType = this;
                }
                else if (this.knownTypes != null)
                {
                    for (int i = 0; i < this.knownTypes.Length; ++i)
                    {
                        var kvp = this.knownTypes[i];
                        if (kvp.Value == null)
                        {
                            SerializableType knownType = this.serializer.GetType(kvp.Key);
                            this.knownTypes[i] = kvp = new KeyValuePair<Type, SerializableType>(kvp.Key, knownType);
                        }

                        DescribedCompoundType describedKnownType = (DescribedCompoundType)kvp.Value;
                        if (this.AreEqual(describedKnownType.descriptorCode, describedKnownType.descriptorName, code, symbol))
                        {
                            effectiveType = describedKnownType;
                            break;
                        }
                    }
                }

                if (effectiveType == null)
                {
                    throw new AmqpException(ErrorCode.DecodeError,
                        Fx.Format(SRAmqp.AmqpUnknownDescriptor, code != null ? code.ToString() : symbol.ToString(), this.type.Name));
                }

                formatCode = Encoder.ReadFormatCode(buffer);
                ReadSizeAndCount(buffer, formatCode, out size, out count, out encodeWidth);
            }

            void InvokeSerializationCallback(int callbackIndex, object container)
            {
                if (this.baseType != null)
                {
                    this.baseType.InvokeSerializationCallback(callbackIndex, container);
                }

                var callback = this.serializationCallbacks[callbackIndex];
                if (callback != null)
                {
                    callback.Invoke(container, new object[0] );
                }
            }

            static KeyValuePair<Type, SerializableType>[] GetKnownTypes(Dictionary<Type, SerializableType> types)
            {
                if (types == null || types.Count == 0)
                {
                    return null;
                }

                var kt = new KeyValuePair<Type, SerializableType>[types.Count];
                int i = 0;
                foreach (var kvp in types)
                {
                    kt[i++] = kvp;
                }

                return kt;
            }

            bool AreEqual(ulong? code1, Symbol symbol1, ulong? code2, Symbol symbol2)
            {
                if (code1 != null && code2 != null)
                {
                    return code1.Value == code2.Value;
                }

                if (symbol1 != null && symbol2 != null)
                {
                    return string.Equals((string)symbol1, (string)symbol2, StringComparison.Ordinal);
                }

                return false;
            }
        }

        sealed class DescribedListType : DescribedCompoundType
        {
            public DescribedListType(
                AmqpSerializer serializer,
                Type type,
                SerializableType baseType,
                string descriptorName,
                ulong? descriptorCode,
                SerializableMember[] members,
                Dictionary<Type, SerializableType> knownTypes,
                MethodAccessor[] serializationCallbacks)
                : base(serializer, type, baseType, descriptorName, descriptorCode, members, knownTypes, serializationCallbacks)
            {
            }

            public override EncodingType Encoding
            {
                get
                {
                    return EncodingType.List;
                }
            }

            protected override byte Code
            {
                get { return FormatCode.List32; }
            }

            protected override int WriteMemberValue(ByteBuffer buffer, string memberName, object memberValue, SerializableType effectiveType)
            {
                if (memberValue == null)
                {
                    Encoder.WriteObject(buffer, null);
                }
                else
                {
                    effectiveType.WriteObject(buffer, memberValue);
                }

                return 1;
            }

            protected override int ReadMemberValue(ByteBuffer buffer, SerializableMember serialiableMember, object container)
            {
                object value = serialiableMember.Type.ReadObject(buffer);
                serialiableMember.Accessor.Set(container, value);
                return 1;
            }
        }

        sealed class DescribedMapType : DescribedCompoundType
        {
            readonly Dictionary<string, SerializableMember> membersMap;

            public DescribedMapType(
                AmqpSerializer serializer,
                Type type,
                SerializableType baseType,
                string descriptorName,
                ulong? descriptorCode,
                SerializableMember[] members,
                Dictionary<Type, SerializableType> knownTypes,
                MethodAccessor[] serializationCallbacks)
                : base(serializer, type, baseType, descriptorName, descriptorCode, members, knownTypes, serializationCallbacks)
            {
                this.membersMap = new Dictionary<string, SerializableMember>();
                foreach (SerializableMember member in members)
                {
                    this.membersMap.Add(member.Name, member);
                }
            }

            public override EncodingType Encoding
            {
                get
                {
                    return EncodingType.Map;
                }
            }

            protected override byte Code
            {
                get { return FormatCode.Map32; }
            }

            protected override int WriteMemberValue(ByteBuffer buffer, string memberName, object memberValue, SerializableType effectiveType)
            {
                if (memberValue != null)
                {
                    Encoder.WriteSymbol(buffer, (Symbol)memberName, true);
                    effectiveType.WriteObject(buffer, memberValue);
                    return 2;
                }

                return 0;
            }

            protected override int ReadMemberValue(ByteBuffer buffer, SerializableMember serialiableMember, object container)
            {
                string key = this.ReadKey(buffer);
                SerializableMember member = null;
                if (!this.membersMap.TryGetValue(key, out member))
                {
                    throw new AmqpException(ErrorCode.DecodeError, "Unknown key name " + key);
                }

                object value = member.Type.ReadObject(buffer);
                member.Accessor.Set(container, value);
                return 2;
            }

            private string ReadKey(ByteBuffer buffer)
            {
                var formatCode = Encoder.ReadFormatCode(buffer);
                switch (formatCode)
                {
                    case FormatCode.String32Utf8:
                    case FormatCode.String8Utf8:
                        return Encoder.ReadString(buffer, formatCode);

                    case FormatCode.Symbol8:
                    case FormatCode.Symbol32:
                        return Encoder.ReadSymbol(buffer, formatCode);

                    default:
                        throw new AmqpException(ErrorCode.DecodeError, "Format code " + formatCode + " not supported for map key");
                }
            }
        }

        sealed class DescribedSimpleMapType : DescribedCompoundType
        {
            readonly Dictionary<string, SerializableMember> membersMap;

            public DescribedSimpleMapType(
                AmqpSerializer serializer,
                Type type,
                SerializableType baseType,
                SerializableMember[] members,
                MethodAccessor[] serializationCallbacks)
                : base(serializer, type, baseType, null, null, members, null, serializationCallbacks)
            {
                this.membersMap = new Dictionary<string, SerializableMember>();
                foreach (SerializableMember member in members)
                {
                    this.membersMap.Add(member.Name, member);
                }
            }

            public override EncodingType Encoding
            {
                get
                {
                    return EncodingType.SimpleMap;
                }
            }

            protected override byte Code
            {
                get { return FormatCode.Map32; }
            }

            protected override bool WriteFormatCode(ByteBuffer buffer)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.Map32);
                return true;
            }

            protected override void Initialize(ByteBuffer buffer, byte formatCode, out int size, out int count, out int encodeWidth, out CollectionType effectiveType)
            {
                effectiveType = this;
                ReadSizeAndCount(buffer, formatCode, out size, out count, out encodeWidth);
            }

            protected override int WriteMemberValue(ByteBuffer buffer, string memberName, object memberValue, SerializableType effectiveType)
            {
                if (memberValue != null)
                {
                    Encoder.WriteString(buffer, memberName, true);
                    effectiveType.WriteObject(buffer, memberValue);
                    return 2;
                }

                return 0;
            }

            protected override int ReadMemberValue(ByteBuffer buffer, SerializableMember serialiableMember, object container)
            {
                string key = Encoder.ReadString(buffer, Encoder.ReadFormatCode(buffer));
                SerializableMember member = null;
                if (!this.membersMap.TryGetValue(key, out member))
                {
                    throw new AmqpException(ErrorCode.DecodeError, "Unknown key name " + key);
                }

                object value = member.Type.ReadObject(buffer);
                member.Accessor.Set(container, value);
                return 2;
            }
        }

        sealed class DescribedSimpleListType : DescribedCompoundType
        {
            public DescribedSimpleListType(
                AmqpSerializer serializer,
                Type type,
                SerializableType baseType,
                SerializableMember[] members,
                MethodAccessor[] serializationCallbacks)
                : base(serializer, type, baseType, null, null, members, null, serializationCallbacks)
            {
            }

            public override EncodingType Encoding
            {
                get
                {
                    return EncodingType.SimpleList;
                }
            }

            protected override byte Code
            {
                get { return FormatCode.List32; }
            }

            protected override bool WriteFormatCode(ByteBuffer buffer)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.List32);
                return true;
            }

            protected override void Initialize(ByteBuffer buffer, byte formatCode, out int size, out int count, out int encodeWidth, out CollectionType effectiveType)
            {
                effectiveType = this;
                ReadSizeAndCount(buffer, formatCode, out size, out count, out encodeWidth);
            }

            protected override int WriteMemberValue(ByteBuffer buffer, string memberName, object memberValue, SerializableType effectiveType)
            {
                if (memberValue != null)
                {
                    effectiveType.WriteObject(buffer, memberValue);
                }
                else
                {
                    Encoder.WriteObject(buffer, null);
                }

                return 1;
            }

            protected override int ReadMemberValue(ByteBuffer buffer, SerializableMember serialiableMember, object container)
            {
                object value = serialiableMember.Type.ReadObject(buffer);
                serialiableMember.Accessor.Set(container, value);
                return 1;
            }
        }
    }
}


text:
<?php

namespace Cosaco\GesenBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class HorarioReservaType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {

        $builder
            ->add('tipoReserva', 'choice', array(
                'choices' => array('Curricular'=>'Curricular', 'Taller'=>'Taller', 'Otro'=>'Otro')
            ))
            ->add('asignatura', 'entity', array(
                'class' => 'CosacoGesenBundle:Asignatura',
                'required'=>true,
                'empty_value'=>'Seleccione'
            ))
            ->add('taller')
            ->add('curso')
            ->add('dias', 'collection', array(
                'type' => new HorarioReservaDiaType(),
                'by_reference' => false,
                'allow_add' => true,
                'allow_delete' => true,

                ))
        ;

    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Cosaco\GesenBundle\Entity\Reserva'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'cosaco_gesenbundle_horarioreserva';
    }
}


text:
/**
cordovaDeviceSettings
  line 11 Utility.locale(function(results) {}) no error possible, should return null if it did happen
  line 16 Utility.locale(function(results) {}) no error possible, should return null if it did happen
  line 25 Utility.platform(function(platform) {}) no error possible, should return null if it did happen
  line 28 Utility.modelName(function(model) {}) no error possible, should return null if it did happen

SearchView
  line 86 Utility.hideKeyboard(function(hidden) {}) if error, returns false
*/
function testUtility() {
	var e = document.getElementById("locale");
	e.innerHTML = "inside testUtility";
	callNative('Utility', 'locale', [], "S", function(locale) {
		if (assert((locale.length == 4), 'Utility', 'locale', 'should be 4 element')) {
			if (assert((locale[0] == "en_US"), 'Utility', 'locale', 'first part should be en_USx')) {
				testPlatform();
			}
		}
	});
}
function testPlatform() {
	callNative('Utility', 'platform', [], "S", function(platform) {
		if (assert((platform == "iOS" || platform == "Android"), 'Utility', 'platform', 'should be iOS and Android')) {
	    	testModelName();
		}
	});
}
function testModelName() {
	callNative('Utility', 'modelName', [], "S", function(model) {
		var parts = model.split(' ');
		if (assert((parts[0] == "iPhone" || parts[0] == "Android"), 'Utility', 'modelName', model)) {
			testHideKeyboard();
		}
	});
}
function testHideKeyboard() {
  	callNative('Utility', 'hideKeyboard', [], "S", function(hidden) {
		if (assert((hidden === true), 'Utility', 'hideKeyboard', 'should be true')) {
			testModelType();
		}
  	});
}
function testModelType() {
	callNative('Utility', 'modelType', [], "S", function(model) {
		log('Done with utility test');
	});
}


text:
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/lib/sync.C $                                              */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2011,2014              */
/*                                                                        */
/* 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.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#include <arch/ppc.H>
#include <sys/sync.h>
#include <sys/syscall.h>
#include <assert.h>
#include <errno.h>
#include <kernel/console.H>

using namespace Systemcalls;

//-----------------------------------------------------------------------------

int futex_wait(uint64_t * i_addr, uint64_t i_val)
{
    return (int64_t) _syscall5(SYS_FUTEX,
                               (void *)FUTEX_WAIT,
                               i_addr,
                               (void *)i_val,
                               NULL,
                               NULL);
}

//-----------------------------------------------------------------------------

int futex_wake(uint64_t * i_addr, uint64_t i_count)
{
    return (int64_t) _syscall5(SYS_FUTEX,
                               (void *)FUTEX_WAKE,
                               i_addr,
                               (void *)i_count,
                               NULL,
                               NULL);
}

//-----------------------------------------------------------------------------

int64_t futex_requeue(uint64_t * i_addr,
                      uint64_t i_count1,
                      uint64_t i_count2,
                      uint64_t * i_futex2)
{
    return (int64_t) _syscall5(SYS_FUTEX,
                               (void *)FUTEX_REQUEUE,
                               i_addr,
                               (void *)i_count1,
                               (void *)i_count2,
                               i_futex2);
}

//-----------------------------------------------------------------------------

void barrier_init (barrier_t * o_barrier, uint64_t i_count)
{
    mutex_init(&(o_barrier->iv_mutex));
    o_barrier->iv_event = 0;
    o_barrier->iv_count = i_count;
    o_barrier->iv_missing = i_count;
    return;
}

//-----------------------------------------------------------------------------

void barrier_destroy (barrier_t * i_barrier)
{
    crit_assert(i_barrier->iv_missing == i_barrier->iv_count);
    return;
}

//-----------------------------------------------------------------------------

void barrier_wait (barrier_t * i_barrier)
{
    mutex_lock(&(i_barrier->iv_mutex));
    --(i_barrier->iv_missing);
    if(i_barrier->iv_missing > 0)
    {
        uint64_t l_event = i_barrier->iv_event;
        mutex_unlock(&(i_barrier->iv_mutex));
        do
        {
            futex_wait(&(i_barrier->iv_event), l_event);
        } while (i_barrier->iv_event == l_event);
    }
    else
    {
        ++(i_barrier->iv_event);
        i_barrier->iv_missing = i_barrier->iv_count;

        // Wake em all up
        futex_wake(&(i_barrier->iv_event), UINT64_MAX);
        mutex_unlock(&(i_barrier->iv_mutex));
    }
    return;
}

//-----------------------------------------------------------------------------

void mutex_init(mutex_t * o_mutex)
{
    o_mutex->iv_val = 0;
    return;
}

//-----------------------------------------------------------------------------

void mutex_destroy(mutex_t * i_mutex)
{
    i_mutex->iv_val = ~0;
    return;
}

//-----------------------------------------------------------------------------

void mutex_lock(mutex_t * i_mutex)
{
    // Weak consistency notes:
    //     Since this is a lock, we do not need to ensure that all writes
    //     are globally visible prior to execution (lwsync) but we do need
    //     to ensure that all instructions finish completion prior to
    //     leaving (isync).  Both __sync_val_compare_and_swap and
    //     __sync_lock_test_and_set have an implied isync.

    uint64_t l_count = __sync_val_compare_and_swap(&(i_mutex->iv_val),0,1);

    if(unlikely(l_count != 0))
    {
        if (likely(l_count != 2))
        {
            l_count = __sync_lock_test_and_set(&(i_mutex->iv_val), 2);
        }

        while( l_count != 0 )
        {
            futex_wait( &(i_mutex->iv_val), 2);
            l_count = __sync_lock_test_and_set(&(i_mutex->iv_val),2);
            // if more than one task gets out - one continues while
            // the rest get blocked again.
        }
    }

    return;
}

//-----------------------------------------------------------------------------

void mutex_unlock(mutex_t * i_mutex)
{
    // Weak consistency notes:
    //     Since this is an unlock we need to ensure that all writes are
    //     globally visible prior to execution (lwsync).  The
    //     __sync_fetch_and_sub has an implied lwsync.  If we need to
    //     release a task, due to a contended mutex, the write to iv_val
    //     and futex_wake pair will appear globally ordered due to the
    //     context synchronizing nature of the 'sc' instruction.

    uint64_t l_count = __sync_fetch_and_sub(&(i_mutex->iv_val),1);
    if(unlikely(2 <= l_count))
    {
        i_mutex->iv_val = 0;
        futex_wake(&(i_mutex->iv_val), 1); // wake one task
    }

    return;
}

void sync_cond_init(sync_cond_t * i_cond)
{
    i_cond->mutex = NULL;
    i_cond->sequence = 0;
}

void sync_cond_destroy(sync_cond_t * i_cond)
{
    // don't need to do anything
}

int sync_cond_wait(sync_cond_t * i_cond, mutex_t * i_mutex)
{
    uint64_t seq = i_cond->sequence;
    if(i_cond->mutex != i_mutex)
    {
        if(i_cond->mutex) return EINVAL;

        // Atomically set mutex
        __sync_bool_compare_and_swap(&i_cond->mutex, NULL, i_mutex);
        if(i_cond->mutex != i_mutex) return EINVAL;
    }

    mutex_unlock(i_mutex);

    futex_wait( &(i_cond->sequence), seq);

    // Can't continue until i_mutex lock is obtained.
    // Note:
    //     mutex_lock(i_mutex);  <--- This does not work
    // We have to mark the mutex as contended '2' because there is a race
    // condition between this thread (eventually) calling mutex_unlock and
    // the kernel moving tasks from the condition futex to the mutex futex
    // during a sync_condition_broadcast.  By marking contended, we force the
    // subsequent mutex_unlock to call to the kernel which will obtain a
    // spinlock to ensure all tasks have been moved to the mutex_futex.
    while(0 != __sync_lock_test_and_set(&(i_mutex->iv_val), 2))
    {
        futex_wait(&(i_mutex->iv_val),2);
    }

    return 0;
}

void sync_cond_signal(sync_cond_t * i_cond)
{
    __sync_fetch_and_add(&(i_cond->sequence),1);
    // Wake up one
    futex_wake(&(i_cond->sequence), 1);
}

void sync_cond_broadcast(sync_cond_t * i_cond)
{
    mutex_t * m = i_cond->mutex;

    // no mutex means no waiters
    if(!m) return;

    // wake up all
    __sync_fetch_and_add(&(i_cond->sequence),1);

    // need to wake up one on the sequence and
    // re-queue the rest onto the mutex m;
    futex_requeue(&(i_cond->sequence),1,UINT64_MAX,&(m->iv_val));
}


text:
<?php

namespace CoffeeScript;

class yy_Extends extends yy_Base
{
  public $children = array('child', 'parent');

  function constructor($child, $parent)
  {
    $this->child = $child;
    $this->parent = $parent;

    return $this;
  }

  function compile($options, $level = NULL)
  {
    $tmp = yy('Call', yy('Value', yy('Literal', utility('extends'))),
      array($this->child, $this->parent));

    return $tmp->compile($options);
  }
}

?>


text:
#ifndef JKMAINWIN_H
#define JKMAINWIN_H

#include <QMainWindow>
#include "ui_JKMainWin.h"
#include <QSystemTrayIcon>
#include <JKFramework/SmartPtr/JKRef_Ptr.h>
#include "BLL/JKProjectBLL.h"
#include "BLL/JKStockCodeBLL.h"
#include "BLL/JKStockCodeTradeBLL.h"
#include "Utils/JKCrawlPrice.h"

class QLabel;
class QSystemTrayIcon;
class JKBuyStockTableAdapter;
class JKSellStockTableAdapter;
class JKTreeModel;

class JKMainWin : public QMainWindow
{
	Q_OBJECT
public:
	JKMainWin(/*JKProjectBLL* _projectBLL, */QWidget *parent = 0);
	~JKMainWin();

	void updateStatusBar(JKRef_Ptr<JKStockCodeBLL> _refStockCode);

	/** ¼¤»îwindows´°¿Ú */
	void setActivateWindow();

	/** ÉèÖÿª»ú×Ô¶¯Æô¶¯ */
	void setAutoStartExe(bool is_auto_start);

	void showAbout();
	JKRef_Ptr<JKProjectBLL> getProjectBLL();
signals:
	void beforeProjectChanged();
	void afterProjectChanged(JKRef_Ptr<JKProjectBLL>);
	void beforeStockCodeChanged();
	void afterStockCodeChanged(JKRef_Ptr<JKStockCodeBLL>);

	private slots:
	void newProject();
	void openRecentProject();
	void openProject();
	void newStockCode();
	void save();
	void deleteCurrentStock();
	void buyStockCode();
	void sellStockCode();
	void onSwitchCode();
	void onShowBuyOnly(bool checked);
	void onShowSellOnly(bool checked);
	void onShowAll(bool checked);
	void projectTaxSetting();
	void setTradeProperty();
	void crawlerOptChanged(bool);
	void alertChanged(bool);
	void about();

	void onSystemTrayIconActive(QSystemTrayIcon::ActivationReason);
	void onExitApp();
	void onShowApp();

	void onTableWgtPopMenu(QPoint pos);
	void onDeleteTrade();
	void onSellTrade();
	void onShowTradeInfo();

	void onBeforeProjectChanged();
	void onAfterProjectChanged(JKRef_Ptr<JKProjectBLL>);

	void onAfterStockChanged(JKRef_Ptr<JKStockCodeBLL>);
	void stockCodePriceChanged(JKString);

	void refreshCrawler(JKRef_Ptr<JKProjectBLL>);

protected:
	virtual void resizeEvent(QResizeEvent*event) override;

	virtual void moveEvent(QMoveEvent *event) override;

	virtual void closeEvent(QCloseEvent *event) override;

private:
	void initUI();
	void updateInfoWgt(JKRef_Ptr<JKStockCodeBLL>);
	void updateInputUIEnable(JKRef_Ptr<JKStockCodeBLL>);
	void updateUIEnable(JKRef_Ptr<JKProjectBLL>);
	void updateCmbBoxSwitch(JKRef_Ptr<JKProjectBLL>);
	void updateTableWidget();

	void addedCmbBoxSwitch(JKRef_Ptr<JKStockCodeBLL>);
	void addedNewStockCode(JKRef_Ptr<JKStockCodeBLL>);

	void setCurrentStockPrice();

private:
	Ui::JKMainWin ui;
	QSystemTrayIcon* systemTrayIcon = nullptr;
	/** ´°¿Ú×ø±ê */
	QRect curGemRect;
	QMenu* tableWgtPopMenu;
	QLabel* lblShowCurStock;
	QLabel* lblLatestPrice;

	JKRef_Ptr<JKProjectBLL> project;

	JKCrawlPrice* crawlPrice = nullptr;

	JKTreeModel* stockTableModel;
	//JKVirtualTreeModel* stockTableModel;

	std::shared_ptr<JKBuyStockTableAdapter> buyStockTableAdapter;
	std::shared_ptr<JKSellStockTableAdapter> sellStockTableAdapter;
	//std::shared_ptr<JKVirtualModelAdapter> curStockTableAdapter;

};

#endif // JKMAINWIN_H


text:
using System.Collections.Generic;
using Newtonsoft.Json;

namespace VaultSharp.V1.SystemBackend
{
    /// <summary>
    /// Represents the Rekey backup information.
    /// </summary>
    public class RekeyBackupInfo
    {
        /// <summary>
        /// Gets or sets the nonce for the current rekey operation..
        /// </summary>
        /// <value>
        /// The nonce.
        /// </value>
        [JsonProperty("nonce")]
        public string Nonce { get; set; }

        /// <summary>
        /// Gets or sets the map of PGP key fingerprint to hex-encoded PGP-encrypted key.
        /// </summary>
        /// <value>
        /// The map of PGP key fingerprint to hex-encoded PGP-encrypted key.
        /// </value>
        [JsonProperty("keys")]
        public Dictionary<string, string> PGPFingerprintToEncryptedKeyMap { get; set; }
    }
}


text:
export colors from './colors';
export fonts from './fonts';
export metrics from './metrics';
export applicationStyles from './applicationStyles';
export images from './images';


text:
.nds
.relativeinclude on
.erroronwarning on

; Fixes the boss rush versions of certain bosses so they play the boss music when they're created.
; This is for the boss randomizer.

@Overlay41Start equ 0x02308920
@FreeSpace equ @Overlay41Start + 0x1F4

.open "ftc/overlay9_41", @Overlay41Start

.org @FreeSpace
@InitializeEnemyAndOverridePlayBossMusic:
  push r14
  push r1 ; Preserve the music ID

  bl 021C34A8h ; InitializeEnemy (replaces the line we overwrote to call this custom function)

  pop r0 ; Get the music ID out of the stack
  bl 0202991Ch ; PlaySong

  ; Set bit to make the song that was set override the BGM.
  ldr r0, =020F6DFCh
  ldr r1, [r0]
  orr r1, r1, 00040000h
  str r1, [r0]

  pop r15

@InitializeEnemyAndOverridePlayBossMusicForFlyingArmor:
  push r14
  ldr r1, =1002h ; Music ID for Evil Invitation
  bl @InitializeEnemyAndOverridePlayBossMusic
  pop r15

@InitializeEnemyAndOverridePlayBossMusic2ForDmitriiAndDario:
  push r14
  ldr r1, =1005h ; Music ID for Scarlet Battle Soul
  bl @InitializeEnemyAndOverridePlayBossMusic
  pop r15

@InitializeEnemyAndOverridePlayBossMusicForZephyr:
  push r14

  add r1, r10, 200h
  ldr r1, [r1, 6Eh] ; Read Zephyr's Var A
  cmp r1, 1h ; Normal Zephyr
  beq @ZephyrOnlyInitializeEnemy

  ; For boss rush Zephyr, we want to play the music immediately.
  ldr r1, =1003h ; Music ID for Into The Dark Night
  bl @InitializeEnemyAndOverridePlayBossMusic
  b @ZephyrInitializeEnemyEnd

  @ZephyrOnlyInitializeEnemy:
  ; For normal Zephyr, we don't want to play music on initialization, or it will bug out because of how he starts the music later.
  bl 021C34A8h ; InitializeEnemy

  @ZephyrInitializeEnemyEnd:
  pop r15

@InitializeEnemyAndOverridePlayBossMusicForAguni:
  push r14
  ldr r1, =101Ah ; Music ID for Portal To Dark Bravery
  bl @InitializeEnemyAndOverridePlayBossMusic
  pop r15

.pool

.close

.open "ftc/overlay9_30", 022FF9C0h

; Flying Armor
.org 0x022FFA50
  bl @InitializeEnemyAndOverridePlayBossMusicForFlyingArmor

.close

.open "ftc/overlay9_40", 022FF9C0h

; Dmitrii
.org 0x022FFA54
  bl @InitializeEnemyAndOverridePlayBossMusic2ForDmitriiAndDario

.close

.open "ftc/overlay9_1", 02230A00h

; Dario
.org 0x0225A714
  bl @InitializeEnemyAndOverridePlayBossMusic2ForDmitriiAndDario

.close

.open "ftc/overlay9_33", 022FF9C0h

; Zephyr
.org 0x022FFA80
  bl @InitializeEnemyAndOverridePlayBossMusicForZephyr

.close

.open "ftc/overlay9_1", 02230A00h

; Aguni
.org 0x02243C98
  bl @InitializeEnemyAndOverridePlayBossMusicForAguni

.close


text:
#ifndef INCLUDED_openfl__legacy_display_LoaderInfo
#define INCLUDED_openfl__legacy_display_LoaderInfo

#ifndef HXCPP_H
#include <hxcpp.h>
#endif

#ifndef INCLUDED_openfl__legacy_net_URLLoader
#include <openfl/_legacy/net/URLLoader.h>
#endif
HX_DECLARE_CLASS2(haxe,io,Bytes)
HX_DECLARE_CLASS3(openfl,_legacy,display,DisplayObject)
HX_DECLARE_CLASS3(openfl,_legacy,display,DisplayObjectContainer)
HX_DECLARE_CLASS3(openfl,_legacy,display,IBitmapDrawable)
HX_DECLARE_CLASS3(openfl,_legacy,display,InteractiveObject)
HX_DECLARE_CLASS3(openfl,_legacy,display,Loader)
HX_DECLARE_CLASS3(openfl,_legacy,display,LoaderInfo)
HX_DECLARE_CLASS3(openfl,_legacy,display,Sprite)
HX_DECLARE_CLASS3(openfl,_legacy,events,Event)
HX_DECLARE_CLASS3(openfl,_legacy,events,EventDispatcher)
HX_DECLARE_CLASS3(openfl,_legacy,events,IEventDispatcher)
HX_DECLARE_CLASS3(openfl,_legacy,net,URLLoader)
HX_DECLARE_CLASS3(openfl,_legacy,net,URLRequest)
HX_DECLARE_CLASS3(openfl,_legacy,utils,ByteArray)
HX_DECLARE_CLASS3(openfl,_legacy,utils,IDataInput)
HX_DECLARE_CLASS3(openfl,_legacy,utils,IDataOutput)
HX_DECLARE_CLASS3(openfl,_legacy,utils,IMemoryRange)
HX_DECLARE_CLASS2(openfl,events,UncaughtErrorEvents)
HX_DECLARE_CLASS2(openfl,_system,ApplicationDomain)
namespace openfl{
namespace _legacy{
namespace display{

class HXCPP_CLASS_ATTRIBUTES  LoaderInfo_obj : public ::openfl::_legacy::net::URLLoader_obj{
	public:
		typedef ::openfl::_legacy::net::URLLoader_obj super;
		typedef LoaderInfo_obj OBJ_;
		LoaderInfo_obj();
		Void __construct();

	public:
		inline void *operator new( size_t inSize, bool inContainer=true,const char *inName="openfl._legacy.display.LoaderInfo")
			{ return hx::Object::operator new(inSize,inContainer,inName); }
		static hx::ObjectPtr< LoaderInfo_obj > __new();
		static Dynamic __CreateEmpty();
		static Dynamic __Create(hx::DynamicArray inArgs);
		//~LoaderInfo_obj();

		HX_DO_RTTI_ALL;
		Dynamic __Field(const ::String &inString, hx::PropertyAccess inCallProp);
		static bool __GetStatic(const ::String &inString, Dynamic &outValue, hx::PropertyAccess inCallProp);
		Dynamic __SetField(const ::String &inString,const Dynamic &inValue, hx::PropertyAccess inCallProp);
		void __GetFields(Array< ::String> &outFields);
		static void __register();
		void __Mark(HX_MARK_PARAMS);
		void __Visit(HX_VISIT_PARAMS);
		::String __ToString() const { return HX_HCSTRING("LoaderInfo","\x41","\xb6","\x95","\xad"); }

		static ::openfl::_legacy::display::LoaderInfo create( ::openfl::_legacy::display::Loader loader);
		static Dynamic create_dyn();

		::openfl::_system::ApplicationDomain applicationDomain;
		::openfl::_legacy::utils::ByteArray bytes;
		bool childAllowsParent;
		::openfl::_legacy::display::DisplayObject content;
		::String contentType;
		Float frameRate;
		int height;
		::openfl::_legacy::display::Loader loader;
		::String loaderURL;
		Dynamic parameters;
		bool parentAllowsChild;
		bool sameDomain;
		::openfl::_legacy::events::EventDispatcher sharedEvents;
		::String url;
		int width;
		::openfl::events::UncaughtErrorEvents uncaughtErrorEvents;
		::String __pendingURL;
		virtual Void load( ::openfl::_legacy::net::URLRequest request);

		virtual Void this_onComplete( ::openfl::_legacy::events::Event event);
		Dynamic this_onComplete_dyn();

		virtual ::openfl::_legacy::utils::ByteArray get_bytes( );
		Dynamic get_bytes_dyn();

};

} // end namespace openfl
} // end namespace _legacy
} // end namespace display

#endif /* INCLUDED_openfl__legacy_display_LoaderInfo */