#include <iostream>
#include "vgui_qt_adaptor.h"
#include "vgui_qt_menu.h"

#include "vgui/vgui_popup_params.h"
#ifdef _MSC_VER
#  include "vcl_msvc_warnings.h"
#endif

#include <QMenu>

using namespace QGL;
using namespace Qt;

vgui_qt_adaptor::vgui_qt_adaptor(QWidget * parent)
  // Note: enabling overlays with "HasOverlay" causes a seg fault on Mac OS X 10.4
  : QGLWidget(QGLFormat(DoubleBuffer | DepthBuffer | Rgba | AlphaChannel | AccumBuffer | StencilBuffer |
                        NoStereoBuffers | DirectRendering),
              parent)
  , ovl_helper(nullptr)
  , use_overlay_helper(true)
  , idle_request_posted_(false)
{
  this->setMouseTracking(true);
  this->setFocusPolicy(Qt::StrongFocus);
  this->setAutoBufferSwap(false);

  // Check the requested GL format
  QGLFormat format = this->format();

  if (!format.doubleBuffer())
    std::cerr << "vgui_qt_adaptor: got single buffer\n";

  if (!format.depth())
    std::cerr << "vgui_qt_adaptor: no depth buffer\n";

  if (!format.rgba())
    std::cerr << "vgui_qt_adaptor: index color\n";

  if (!format.directRendering())
    std::cerr << "vgui_qt_adaptor: no direct rendering\n";

  // Set up idle time
  idle_timer_ = new QTimer(this);
  idle_timer_->start(0);
  connect(idle_timer_, SIGNAL(timeout()), this, SLOT(idle_slot()));
}

//------------------------------------------------------------------------------
vgui_qt_adaptor::~vgui_qt_adaptor()
{
  if (ovl_helper)
    delete ovl_helper;
  ovl_helper = nullptr;
  dispatch_to_tableau(vgui_DESTROY);

  for (std::map<int, vgui_qt_internal_timer *>::iterator it = timers_.begin(); it != timers_.end(); ++it)
  {
    delete it->second;
  }
}

//------------------------------------------------------------------------------
bool
vgui_qt_adaptor::dispatch_to_tableau(const vgui_event & event)
{
  if (ovl_helper)
    return ovl_helper->dispatch(event);
  else
    return vgui_adaptor::dispatch_to_tableau(event);
}

//------------------------------------------------------------------------------
void
vgui_qt_adaptor::paintGL()
{
  if (this->doubleBuffer())
    glDrawBuffer(GL_BACK);
  else
    glDrawBuffer(GL_FRONT);
  dispatch_to_tableau(vgui_DRAW);
  swap_buffers();
}

void
vgui_qt_adaptor::post_overlay_redraw()
{
  if (use_overlay_helper)
  {
    if (!ovl_helper)
      ovl_helper = new vgui_overlay_helper(this);
    ovl_helper->post_overlay_redraw();
  }
  else
  {
    updateOverlayGL();
  }
}

void
vgui_qt_adaptor::idle_slot()
{
  if (idle_request_posted_)
    idle_request_posted_ = dispatch_to_tableau(vgui_event(vgui_IDLE));
}

//------------------------------------------------------------------------------
void
vgui_qt_adaptor::post_idle_request()
{
  idle_request_posted_ = true;
}

//------------------------------------------------------------------------------
void
vgui_qt_adaptor::post_timer(float timeout, int name)
{
  std::map<int, vgui_qt_internal_timer *>::iterator it = timers_.find(name);
  if (it == timers_.end())
    timers_[name] = new vgui_qt_internal_timer(this, name);
  QTimer::singleShot(static_cast<int>(timeout), timers_[name], SLOT(activate()));
}

//------------------------------------------------------------------------------
void
vgui_qt_adaptor::kill_timer(int name)
{
  std::map<int, vgui_qt_internal_timer *>::iterator it = timers_.find(name);
  if (it != timers_.end())
  {
    delete it->second;
    timers_.erase(it);
  }
}

//------------------------------------------------------------------------------
void
vgui_qt_adaptor::paintOverlayGL()
{
  if (this->doubleBuffer())
    glDrawBuffer(GL_BACK);
  else
    glDrawBuffer(GL_FRONT);
  dispatch_to_tableau(vgui_DRAW_OVERLAY);
  swap_buffers();
}

//------------------------------------------------------------------------------
void
vgui_qt_adaptor::resizeGL(int w, int h)
{
  make_current();
  vgui_adaptor_mixin::width = QGLWidget::width();
  vgui_adaptor_mixin::height = QGLWidget::height();

  dispatch_to_tableau(vgui_RESHAPE);
}

//------------------------------------------------------------------------------
void
vgui_qt_adaptor::mouseMoveEvent(QMouseEvent * e)
{
  vgui_event ev = translate(e);
  ev.type = vgui_MOTION;
  dispatch_to_tableau(ev);
}

//------------------------------------------------------------------------------
void
vgui_qt_adaptor::mousePressEvent(QMouseEvent * e)
{
  vgui_event ev = translate(e);
  ev.type = vgui_BUTTON_DOWN;

  // popup
  if (ev.button == this->popup_button && ev.modifier == this->popup_modifier)
  {
    vgui_popup_params params;
    params.x = ev.wx;
    params.y = ev.wy;
    QMenu * pm = new vgui_qt_menu(this->get_total_popup(params), this);

    pm->popup(QWidget::mapToGlobal(QPoint(e->x(), e->y())));

    return;
  }

  dispatch_to_tableau(ev);
}

//------------------------------------------------------------------------------
void
vgui_qt_adaptor::mouseReleaseEvent(QMouseEvent * e)
{
  vgui_event ev = translate(e);
  ev.type = vgui_BUTTON_UP;
  dispatch_to_tableau(ev);
}

//------------------------------------------------------------------------------
void
vgui_qt_adaptor::keyPressEvent(QKeyEvent * e)
{
  vgui_event ev = translate(e);
  ev.type = vgui_KEY_PRESS;
  dispatch_to_tableau(ev);
}

void
vgui_qt_adaptor::keyReleaseEvent(QKeyEvent * e)
{
  vgui_event ev = translate(e);
  ev.type = vgui_KEY_RELEASE;
  dispatch_to_tableau(ev);
}

//------------------------------------------------------------------------------
void
vgui_qt_adaptor::wheelEvent(QWheelEvent * e)
{
  vgui_event ev = translate(e);

  if (e->delta() > 0)
    ev.type = vgui_WHEEL_UP;
  else
    ev.type = vgui_WHEEL_DOWN;

  dispatch_to_tableau(ev);
}

//------------------------------------------------------------------------------
void
vgui_qt_adaptor::windowActivationChange(bool oldActive)
{
  vgui_event ev;

  if (!oldActive)
    ev.type = vgui_FOCUSGAINED;
  else
    ev.type = vgui_FOCUSLOST;
  dispatch_to_tableau(ev);
}

//------------------------------------------------------------------------------
void
vgui_qt_internal_timer::activate()
{
  if (adaptor)
  {
    vgui_event e(vgui_TIMER);
    e.timer_id = id;
    adaptor->dispatch_to_tableau(e);
  }
}

//------------------------------------------------------------------------------
vgui_event
vgui_qt_adaptor::translate(QMouseEvent * e)
{
  vgui_event ev;
  ev.modifier = translate(e->modifiers());
  ev.button = vgui_BUTTON_NULL;
  if (e->button() & Qt::LeftButton)
    ev.button = vgui_LEFT;
  if (e->button() & Qt::RightButton)
    ev.button = vgui_RIGHT;
  if (e->button() & Qt::MidButton)
    ev.button = vgui_MIDDLE;

  ev.wx = e->x();
  ev.wy = QGLWidget::height() - e->y();
  return ev;
}

vgui_event
vgui_qt_adaptor::translate(QKeyEvent * e)
{
  vgui_event ev;
  ev.modifier = translate(e->modifiers());
  ev.set_key(translate(Qt::Key(e->key())));

  return ev;
}

vgui_event
vgui_qt_adaptor::translate(QWheelEvent * e)
{
  vgui_event ev;
  ev.modifier = translate(e->modifiers());
  ev.wx = e->x();
  ev.wy = QGLWidget::height() - e->y();
  return ev;
}

vgui_key
vgui_qt_adaptor::translate(Qt::Key k)
{
  switch (k)
  {
    case Qt::Key_Escape:
      return vgui_ESCAPE;
    case Qt::Key_Tab:
      return vgui_TAB;
    case Qt::Key_Return:
      return vgui_RETURN;
    case Qt::Key_Enter:
      return vgui_NEWLINE;
    case Qt::Key_F1:
      return vgui_F1;
    case Qt::Key_F2:
      return vgui_F2;
    case Qt::Key_F3:
      return vgui_F3;
    case Qt::Key_F4:
      return vgui_F4;
    case Qt::Key_F5:
      return vgui_F5;
    case Qt::Key_F6:
      return vgui_F6;
    case Qt::Key_F7:
      return vgui_F7;
    case Qt::Key_F8:
      return vgui_F8;
    case Qt::Key_F9:
      return vgui_F9;
    case Qt::Key_F10:
      return vgui_F10;
    case Qt::Key_F11:
      return vgui_F11;
    case Qt::Key_F12:
      return vgui_F12;
    case Qt::Key_Left:
      return vgui_CURSOR_LEFT;
    case Qt::Key_Up:
      return vgui_CURSOR_UP;
    case Qt::Key_Right:
      return vgui_CURSOR_RIGHT;
    case Qt::Key_Down:
      return vgui_CURSOR_DOWN;
    case Qt::Key_PageUp:
      return vgui_PAGE_UP;
    case Qt::Key_PageDown:
      return vgui_PAGE_DOWN;
    case Qt::Key_Home:
      return vgui_HOME;
    case Qt::Key_End:
      return vgui_END;
    case Qt::Key_Delete:
      return vgui_DELETE;
    case Qt::Key_Insert:
      return vgui_INSERT;
    default:
      return vgui_key(static_cast<unsigned char>(k));
  }

  return vgui_KEY_NULL;
}

vgui_modifier
vgui_qt_adaptor::translate(Qt::KeyboardModifiers m)
{
  int mod = vgui_MODIFIER_NULL;
  if (m & Qt::CTRL)
    mod |= vgui_CTRL;
  if (m & Qt::SHIFT)
    mod |= vgui_SHIFT;
  if (m & Qt::META)
    mod |= vgui_META;
  if (m & Qt::ALT)
    mod |= vgui_ALT;

  return vgui_modifier(mod);
}

Qt::Key
vgui_qt_adaptor::translate(vgui_key k)
{
  switch (k)
  {
    case vgui_ESCAPE:
      return Qt::Key_Escape;
    case vgui_TAB:
      return Qt::Key_Tab;
    case vgui_RETURN:
      return Qt::Key_Return;
    case vgui_NEWLINE:
      return Qt::Key_Enter;
    case vgui_F1:
      return Qt::Key_F1;
    case vgui_F2:
      return Qt::Key_F2;
    case vgui_F3:
      return Qt::Key_F3;
    case vgui_F4:
      return Qt::Key_F4;
    case vgui_F5:
      return Qt::Key_F5;
    case vgui_F6:
      return Qt::Key_F6;
    case vgui_F7:
      return Qt::Key_F7;
    case vgui_F8:
      return Qt::Key_F8;
    case vgui_F9:
      return Qt::Key_F9;
    case vgui_F10:
      return Qt::Key_F10;
    case vgui_F11:
      return Qt::Key_F11;
    case vgui_F12:
      return Qt::Key_F12;
    case vgui_CURSOR_LEFT:
      return Qt::Key_Left;
    case vgui_CURSOR_UP:
      return Qt::Key_Up;
    case vgui_CURSOR_RIGHT:
      return Qt::Key_Right;
    case vgui_CURSOR_DOWN:
      return Qt::Key_Down;
    case vgui_PAGE_UP:
      return Qt::Key_PageUp;
    case vgui_PAGE_DOWN:
      return Qt::Key_PageDown;
    case vgui_HOME:
      return Qt::Key_Home;
    case vgui_END:
      return Qt::Key_End;
    case vgui_DELETE:
      return Qt::Key_Delete;
    case vgui_INSERT:
      return Qt::Key_Insert;
    default:
      return Qt::Key(k);
  }

  return Qt::Key_unknown;
}

Qt::KeyboardModifiers
vgui_qt_adaptor::translate(vgui_modifier m)
{
  Qt::KeyboardModifiers mod = Qt::NoModifier;
  if (m & vgui_CTRL)
    mod |= Qt::ControlModifier;
  if (m & vgui_SHIFT)
    mod |= Qt::ShiftModifier;
  if (m & vgui_META)
    mod |= Qt::MetaModifier;
  if (m & vgui_ALT)
    mod |= Qt::AltModifier;

  return mod;
}

{'repo_name': 'vxl/vxl', 'stars': '170', 'repo_language': 'C++', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 7158207652253951916, 'source_dataset': 'data'}


import test from 'ava';
import Server from '../../src/server';
import WebSocket from '../../src/websocket';

test.cb('reassigning websocket onopen listener should replace previous listeners', t => {
  const socketUrl = 'ws://localhost:8080';
  const mockServer = new Server(socketUrl);
  const mockSocket = new WebSocket(socketUrl);

  let firstListenerCalled = false;
  let secondListenerCalled = false;

  mockSocket.onopen = () => {
    firstListenerCalled = true;
  };
  mockSocket.onopen = () => {
    secondListenerCalled = true;
  };

  setTimeout(() => {
    t.false(firstListenerCalled, 'The first listener should not be called');
    t.true(secondListenerCalled, 'Only the second listener should be called');
    mockServer.close();
    t.end();
  }, 500);
});

test.cb('reassigning websocket onmessage listener should replace previous listeners', t => {
  const socketUrl = 'ws://localhost:8080';
  const mockServer = new Server(socketUrl);
  const mockSocket = new WebSocket(socketUrl);

  let firstListenerCalled = false;
  let secondListenerCalled = false;

  mockSocket.onmessage = () => {
    firstListenerCalled = true;
  };
  mockSocket.onmessage = () => {
    secondListenerCalled = true;
  };

  mockServer.on('connection', socket => {
    socket.send('test message');
    t.false(firstListenerCalled, 'The first listener should not be called');
    t.true(secondListenerCalled, 'Only the second listener should be called');
    mockServer.close();
    t.end();
  });
});

test.cb('reassigning websocket onclose listener should replace previous listeners', t => {
  const socketUrl = 'ws://localhost:8080';
  const mockServer = new Server(socketUrl);
  const mockSocket = new WebSocket(socketUrl);

  let firstListenerCalled = false;
  let secondListenerCalled = false;

  mockSocket.onclose = () => {
    firstListenerCalled = true;
  };
  mockSocket.onclose = () => {
    secondListenerCalled = true;
  };

  mockServer.close();

  t.false(firstListenerCalled, 'The first listener should not be called');
  t.true(secondListenerCalled, 'Only the second listener should be called');
  t.end();
});

test.cb('reassigning websocket onerror listener should replace previous listeners', t => {
  const socketUrl = 'ws://localhost:8080';
  const mockServer = new Server(socketUrl);
  const mockSocket = new WebSocket(socketUrl);

  let firstListenerCalled = false;
  let secondListenerCalled = false;

  mockSocket.onerror = () => {
    firstListenerCalled = true;
  };
  mockSocket.onerror = () => {
    secondListenerCalled = true;
  };

  mockServer.simulate('error');

  t.false(firstListenerCalled, 'The first listener should not be called');
  t.true(secondListenerCalled, 'Only the second listener should be called');
  mockServer.close();
  t.end();
});

test.cb('reassigning websocket null listener should clear previous listeners', t => {
  const socketUrl = 'ws://localhost:8080';
  const mockServer = new Server(socketUrl);
  const mockSocket = new WebSocket(socketUrl);

  let listenerCalled = false;

  mockSocket.onerror = () => {
    listenerCalled = true;
  };
  mockSocket.onerror = null;

  mockServer.simulate('error');

  t.false(listenerCalled, 'The first listener should not be called');
  t.end();
});

{'repo_name': 'thoov/mock-socket', 'stars': '540', 'repo_language': 'JavaScript', 'file_name': 'socket-io.test.js', 'mime_type': 'text/x-java', 'hash': 5570305783764727976, 'source_dataset': 'data'}


<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <global name="Category" module="erp5.portal_type"/>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>_count</string> </key>
            <value>
              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
            </value>
        </item>
        <item>
            <key> <string>_mt_index</string> </key>
            <value>
              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
            </value>
        </item>
        <item>
            <key> <string>_tree</string> </key>
            <value>
              <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
            </value>
        </item>
        <item>
            <key> <string>categories</string> </key>
            <value>
              <tuple>
                <string>gap/fr/m14/2/21/217/2175/21757</string>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>21757</string> </value>
        </item>
        <item>
            <key> <string>portal_type</string> </key>
            <value> <string>Category</string> </value>
        </item>
        <item>
            <key> <string>title</string> </key>
            <value> <string>Matériel et outillage de voirie</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
  <record id="2" aka="AAAAAAAAAAI=">
    <pickle>
      <global name="Length" module="BTrees.Length"/>
    </pickle>
    <pickle> <int>0</int> </pickle>
  </record>
  <record id="3" aka="AAAAAAAAAAM=">
    <pickle>
      <global name="OOBTree" module="BTrees.OOBTree"/>
    </pickle>
    <pickle>
      <none/>
    </pickle>
  </record>
  <record id="4" aka="AAAAAAAAAAQ=">
    <pickle>
      <global name="OOBTree" module="BTrees.OOBTree"/>
    </pickle>
    <pickle>
      <none/>
    </pickle>
  </record>
</ZopeData>

{'repo_name': 'Nexedi/erp5', 'stars': '116', 'repo_language': 'JavaScript', 'file_name': 'base_category_list.xml', 'mime_type': 'text/plain', 'hash': 7763911624637507005, 'source_dataset': 'data'}


---
method: POST
headers:
  Authorization:         AWS4-HMAC-SHA256 Credential=access/20091028/us-east-1/secretsmanager/aws4_request, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=?
  Host:                  secretsmanager.us-east-1.amazonaws.com
  Content-Type:          application/x-www-form-urlencoded; charset=utf-8
  X-Amz-Content-SHA256:  abcdef
  X-Amz-Date:            20091028T223200Z
body:
  ''

{'repo_name': 'brendanhay/amazonka', 'stars': '436', 'repo_language': 'Haskell', 'file_name': 'Sum.hs', 'mime_type': 'text/plain', 'hash': 9028264263455279948, 'source_dataset': 'data'}


# ==================================================================================================
# Copyright 2014 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the License.
# You may obtain a copy of the License in the LICENSE file, or 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.
# ==================================================================================================

jar_library(name='hamcrest-core',
  jars=[
    jar(org='org.hamcrest', name='hamcrest-core', rev='1.3')
  ]
)

{'repo_name': 'twitter-archive/commons', 'stars': '1916', 'repo_language': 'Java', 'file_name': 'BUILD', 'mime_type': 'text/plain', 'hash': 1972123834788236248, 'source_dataset': 'data'}


# Copyright (c) 2017-present, Status Research and Development GmbH.
# All rights reserved.

# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.

set(TEST_NAME test-activityindicator-props)

set(REACT_TESTCASE_JS
  TestActivityIndicatorProps.js
)

add_executable(${TEST_NAME} ${TEST_NAME}.cpp resources.qrc ${REACT_TEST_SOURCES} ${REACT_TESTCASE_JS})
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
target_link_libraries(${TEST_NAME} ${REACT_TESTCASE_LIBRARIES})

{'repo_name': 'status-im/react-native-desktop-qt', 'stars': '1025', 'repo_language': 'JavaScript', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -2193416427117221436, 'source_dataset': 'data'}


// -*- C++ -*-
//===--------------------------- __config ---------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG

#if defined(_MSC_VER) && !defined(__clang__)
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#endif

#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#pragma GCC system_header
#endif

#ifdef __cplusplus

#ifdef __GNUC__
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
#else
#define _GNUC_VER 0
#endif

/* XXX this can go away once ports have learned to pick up unistd.h themselves */
#if !_WIN32
#include <unistd.h>
#endif

#define _LIBCPP_VERSION 3800

#ifndef _LIBCPP_ABI_VERSION
#define _LIBCPP_ABI_VERSION 1
#endif

#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
// Change short string represention so that string data starts at offset 0,
// improving its alignment in some cases.
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
// Fix deque iterator type in order to support incomplete types.
#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
// Fix undefined behavior in how std::list stores it's linked nodes.
#define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
#endif

#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)

#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)

#ifndef __has_attribute
#define __has_attribute(__x) 0
#endif
#ifndef __has_builtin
#define __has_builtin(__x) 0
#endif
#ifndef __has_extension
#define __has_extension(__x) 0
#endif
#ifndef __has_feature
#define __has_feature(__x) 0
#endif
// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
// the compiler and '1' otherwise.
#ifndef __is_identifier
#define __is_identifier(__x) 1
#endif

#ifdef __LITTLE_ENDIAN__
#if __LITTLE_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 1
#define _LIBCPP_BIG_ENDIAN    0
#endif  // __LITTLE_ENDIAN__
#endif  // __LITTLE_ENDIAN__

#ifdef __BIG_ENDIAN__
#if __BIG_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 0
#define _LIBCPP_BIG_ENDIAN    1
#endif  // __BIG_ENDIAN__
#endif  // __BIG_ENDIAN__

#ifdef __BYTE_ORDER__
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 1
#define _LIBCPP_BIG_ENDIAN 0
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 0
#define _LIBCPP_BIG_ENDIAN 1
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#endif // __BYTE_ORDER__

#ifdef __FreeBSD__
# include <sys/endian.h>
#  if _BYTE_ORDER == _LITTLE_ENDIAN
#   define _LIBCPP_LITTLE_ENDIAN 1
#   define _LIBCPP_BIG_ENDIAN    0
# else  // _BYTE_ORDER == _LITTLE_ENDIAN
#   define _LIBCPP_LITTLE_ENDIAN 0
#   define _LIBCPP_BIG_ENDIAN    1
# endif  // _BYTE_ORDER == _LITTLE_ENDIAN
# ifndef __LONG_LONG_SUPPORTED
#  define _LIBCPP_HAS_NO_LONG_LONG
# endif  // __LONG_LONG_SUPPORTED
#endif  // __FreeBSD__

#ifdef __Bitrig__
# include <sys/endian.h>
#  if _BYTE_ORDER == _LITTLE_ENDIAN
#   define _LIBCPP_LITTLE_ENDIAN 1
#   define _LIBCPP_BIG_ENDIAN    0
# else  // _BYTE_ORDER == _LITTLE_ENDIAN
#   define _LIBCPP_LITTLE_ENDIAN 0
#   define _LIBCPP_BIG_ENDIAN    1
# endif  // _BYTE_ORDER == _LITTLE_ENDIAN
#endif  // __Bitrig__

#ifdef __NetBSD__
# include <sys/endian.h>
#  if _BYTE_ORDER == _LITTLE_ENDIAN
#   define _LIBCPP_LITTLE_ENDIAN 1
#   define _LIBCPP_BIG_ENDIAN    0
# else  // _BYTE_ORDER == _LITTLE_ENDIAN
#   define _LIBCPP_LITTLE_ENDIAN 0
#   define _LIBCPP_BIG_ENDIAN    1
# endif  // _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_HAS_QUICK_EXIT
#endif  // __NetBSD__

#ifdef _WIN32
#  define _LIBCPP_LITTLE_ENDIAN 1
#  define _LIBCPP_BIG_ENDIAN    0
// Compiler intrinsics (MSVC)
#if defined(_MSC_VER) && _MSC_VER >= 1400
#    define _LIBCPP_HAS_IS_BASE_OF
#  endif
#  if defined(_MSC_VER) && !defined(__clang__)
#    define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
#    define _LIBCPP_TOSTRING2(x) #x
#    define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
#    define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
#  endif
#  // If mingw not explicitly detected, assume using MS C runtime only.
#  ifndef __MINGW32__
#    define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
#  endif
#endif  // _WIN32

#ifdef __sun__
# include <sys/isa_defs.h>
# ifdef _LITTLE_ENDIAN
#   define _LIBCPP_LITTLE_ENDIAN 1
#   define _LIBCPP_BIG_ENDIAN    0
# else
#   define _LIBCPP_LITTLE_ENDIAN 0
#   define _LIBCPP_BIG_ENDIAN    1
# endif
#endif // __sun__

#if defined(__CloudABI__)
  // Certain architectures provide arc4random(). Prefer using
  // arc4random() over /dev/{u,}random to make it possible to obtain
  // random data even when using sandboxing mechanisms such as chroots,
  // Capsicum, etc.
# define _LIBCPP_USING_ARC4_RANDOM
#elif defined(__native_client__)
  // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
  // including accesses to the special files under /dev. C++11's
  // std::random_device is instead exposed through a NaCl syscall.
# define _LIBCPP_USING_NACL_RANDOM
#elif defined(_WIN32)
# define _LIBCPP_USING_WIN32_RANDOM
#else
# define _LIBCPP_USING_DEV_RANDOM
#endif

#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN
#  define _LIBCPP_LITTLE_ENDIAN 1
#  define _LIBCPP_BIG_ENDIAN    0
# elif __BYTE_ORDER == __BIG_ENDIAN
#  define _LIBCPP_LITTLE_ENDIAN 0
#  define _LIBCPP_BIG_ENDIAN    1
# else  // __BYTE_ORDER == __BIG_ENDIAN
#  error unable to determine endian
# endif
#endif  // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)

#ifdef _WIN32

// only really useful for a DLL
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
# ifdef cxx_EXPORTS
#  define _LIBCPP_HIDDEN
#  define _LIBCPP_FUNC_VIS __declspec(dllexport)
#  define _LIBCPP_TYPE_VIS __declspec(dllexport)
# else
#  define _LIBCPP_HIDDEN
#  define _LIBCPP_FUNC_VIS __declspec(dllimport)
#  define _LIBCPP_TYPE_VIS __declspec(dllimport)
# endif
#else
# define _LIBCPP_HIDDEN
# define _LIBCPP_FUNC_VIS
# define _LIBCPP_TYPE_VIS
#endif

#define _LIBCPP_TYPE_VIS_ONLY
#define _LIBCPP_FUNC_VIS_ONLY

#ifndef _LIBCPP_INLINE_VISIBILITY
# ifdef _LIBCPP_MSVC
#  define _LIBCPP_INLINE_VISIBILITY __forceinline
# else // MinGW GCC and Clang
#  define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
# endif
#endif

#ifndef _LIBCPP_EXCEPTION_ABI
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
#endif

#ifndef _LIBCPP_ALWAYS_INLINE
# ifdef _LIBCPP_MSVC
#  define _LIBCPP_ALWAYS_INLINE __forceinline
# endif
#endif

#endif // _WIN32

#ifndef _LIBCPP_HIDDEN
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
#endif

#ifndef _LIBCPP_FUNC_VIS
#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
#endif

#ifndef _LIBCPP_TYPE_VIS
#  if __has_attribute(__type_visibility__)
#    define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
#  else
#    define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
#  endif
#endif

#ifndef _LIBCPP_TYPE_VIS_ONLY
# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
#endif

#ifndef _LIBCPP_FUNC_VIS_ONLY
# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
#endif

#ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif

#ifndef _LIBCPP_EXCEPTION_ABI
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
#endif

#ifndef _LIBCPP_ALWAYS_INLINE
#define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif

#if defined(__clang__)

// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) &&       \
     !defined(__arm__)) ||                                                     \
    defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
#endif

#if __has_feature(cxx_alignas)
#  define _ALIGNAS_TYPE(x) alignas(x)
#  define _ALIGNAS(x) alignas(x)
#else
#  define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
#  define _ALIGNAS(x) __attribute__((__aligned__(x)))
#endif

#if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#endif

#if __cplusplus < 201103L
typedef __char16_t char16_t;
typedef __char32_t char32_t;
#endif

#if !(__has_feature(cxx_exceptions))
#define _LIBCPP_NO_EXCEPTIONS
#endif

#if !(__has_feature(cxx_rtti))
#define _LIBCPP_NO_RTTI
#endif

#if !(__has_feature(cxx_strong_enums))
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif

#if !(__has_feature(cxx_decltype))
#define _LIBCPP_HAS_NO_DECLTYPE
#endif

#if __has_feature(cxx_attributes)
#  define _LIBCPP_NORETURN [[noreturn]]
#else
#  define _LIBCPP_NORETURN __attribute__ ((noreturn))
#endif

#define _LIBCPP_UNUSED __attribute__((__unused__))

#if !(__has_feature(cxx_default_function_template_args))
#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#endif

#if !(__has_feature(cxx_defaulted_functions))
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#endif  // !(__has_feature(cxx_defaulted_functions))

#if !(__has_feature(cxx_deleted_functions))
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif  // !(__has_feature(cxx_deleted_functions))

#if !(__has_feature(cxx_lambdas))
#define _LIBCPP_HAS_NO_LAMBDAS
#endif

#if !(__has_feature(cxx_nullptr))
#define _LIBCPP_HAS_NO_NULLPTR
#endif

#if !(__has_feature(cxx_rvalue_references))
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif

#if !(__has_feature(cxx_static_assert))
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif

#if !(__has_feature(cxx_auto_type))
#define _LIBCPP_HAS_NO_AUTO_TYPE
#endif

#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#endif

#if !(__has_feature(cxx_variadic_templates))
#define _LIBCPP_HAS_NO_VARIADICS
#endif

#if !(__has_feature(cxx_trailing_return))
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#endif

#if !(__has_feature(cxx_generalized_initializers))
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif

#if __has_feature(is_base_of)
#  define _LIBCPP_HAS_IS_BASE_OF
#endif

#if __has_feature(is_final)
#  define _LIBCPP_HAS_IS_FINAL
#endif

// Objective-C++ features (opt-in)
#if __has_feature(objc_arc)
#define _LIBCPP_HAS_OBJC_ARC
#endif

#if __has_feature(objc_arc_weak)
#define _LIBCPP_HAS_OBJC_ARC_WEAK
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif

#if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif

#if !(__has_feature(cxx_relaxed_constexpr))
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
#endif

#if !(__has_feature(cxx_variable_templates))
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
#endif

#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
#if defined(__FreeBSD__) || defined(__Bitrig__)
#define _LIBCPP_HAS_QUICK_EXIT
#define _LIBCPP_HAS_C11_FEATURES
#elif defined(__ANDROID__)
#define _LIBCPP_HAS_QUICK_EXIT
#elif defined(__linux__)
#if !defined(_LIBCPP_HAS_MUSL_LIBC)
# include <features.h>
#if __GLIBC_PREREQ(2, 15)
#define _LIBCPP_HAS_QUICK_EXIT
#endif
#if __GLIBC_PREREQ(2, 17)
#define _LIBCPP_HAS_C11_FEATURES
#endif
#else // defined(_LIBCPP_HAS_MUSL_LIBC)
#define _LIBCPP_HAS_QUICK_EXIT
#define _LIBCPP_HAS_C11_FEATURES
#endif
#endif // __linux__
#endif

#if !(__has_feature(cxx_noexcept))
#define _LIBCPP_HAS_NO_NOEXCEPT
#endif

#if __has_feature(underlying_type)
#  define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
#endif

#if __has_feature(is_literal)
#  define _LIBCPP_IS_LITERAL(T) __is_literal(T)
#endif

// Inline namespaces are available in Clang regardless of C++ dialect.
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD  } }
#define _VSTD std::_LIBCPP_NAMESPACE

namespace std {
  inline namespace _LIBCPP_NAMESPACE {
  }
}

#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
#define _LIBCPP_HAS_NO_ASAN
#endif

// Allow for build-time disabling of unsigned integer sanitization
#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute((no_sanitize("unsigned-integer-overflow")))
#endif

#elif defined(__GNUC__)

#define _ALIGNAS(x) __attribute__((__aligned__(x)))
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))

#define _LIBCPP_NORETURN __attribute__((noreturn))

#define _LIBCPP_UNUSED __attribute__((__unused__))

#if _GNUC_VER >= 407
#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
#define _LIBCPP_HAS_IS_FINAL
#endif

#if defined(__GNUC__) && _GNUC_VER >= 403
#  define _LIBCPP_HAS_IS_BASE_OF
#endif

#if !__EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS
#endif

#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES

// constexpr was added to GCC in 4.6.
#if _GNUC_VER < 406
#define _LIBCPP_HAS_NO_CONSTEXPR
// Can only use constexpr in c++11 mode.
#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif

// Determine if GCC supports relaxed constexpr
#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
#endif

// GCC 5 will support variable templates
#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
#endif

#ifndef __GXX_EXPERIMENTAL_CXX0X__

#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_HAS_NO_NOEXCEPT

#else  // __GXX_EXPERIMENTAL_CXX0X__

#if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif

#if _GNUC_VER < 404
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif  // _GNUC_VER < 404

#if _GNUC_VER < 406
#define _LIBCPP_HAS_NO_NOEXCEPT
#define _LIBCPP_HAS_NO_NULLPTR
#endif

#if _GNUC_VER < 407
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#endif

#endif  // __GXX_EXPERIMENTAL_CXX0X__

#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD  } }
#define _VSTD std::_LIBCPP_NAMESPACE

namespace std {
namespace _LIBCPP_NAMESPACE {
}
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
}

#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
#define _LIBCPP_HAS_NO_ASAN
#endif

#elif defined(_LIBCPP_MSVC)

#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_NOEXCEPT
#define __alignof__ __alignof
#define _LIBCPP_NORETURN __declspec(noreturn)
#define _LIBCPP_UNUSED
#define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS

#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD  }
#define _VSTD std

#  define _LIBCPP_WEAK
namespace std {
}

#define _LIBCPP_HAS_NO_ASAN

#elif defined(__IBMCPP__)

#define _ALIGNAS(x) __attribute__((__aligned__(x)))
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
#define _ATTRIBUTE(x) __attribute__((x))
#define _LIBCPP_NORETURN __attribute__((noreturn))
#define _LIBCPP_UNUSED

#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#define _LIBCPP_HAS_NO_NOEXCEPT
#define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_IS_BASE_OF
#define _LIBCPP_HAS_IS_FINAL
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES

#if defined(_AIX)
#define __MULTILOCALE_API
#endif

#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD  } }
#define _VSTD std::_LIBCPP_NAMESPACE

namespace std {
  inline namespace _LIBCPP_NAMESPACE {
  }
}

#define _LIBCPP_HAS_NO_ASAN

#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__

#ifndef _LIBCPP_HAS_NO_NOEXCEPT
#  define _NOEXCEPT noexcept
#  define _NOEXCEPT_(x) noexcept(x)
#else
#  define _NOEXCEPT throw()
#  define _NOEXCEPT_(x)
#endif

#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
typedef unsigned int   char32_t;
#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS

#ifndef __SIZEOF_INT128__
#define _LIBCPP_HAS_NO_INT128
#endif

#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT

extern "C++" {
template <bool> struct __static_assert_test;
template <> struct __static_assert_test<true> {};
template <unsigned> struct __static_assert_check {};
}
#define static_assert(__b, __m) \
    typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
    _LIBCPP_CONCAT(__t, __LINE__)

#endif  // _LIBCPP_HAS_NO_STATIC_ASSERT

#ifdef _LIBCPP_HAS_NO_DECLTYPE
// GCC 4.6 provides __decltype in all standard modes.
#if !__is_identifier(__decltype) || _GNUC_VER >= 406
#  define decltype(__x) __decltype(__x)
#else
#  define decltype(__x) __typeof__(__x)
#endif
#endif

#ifdef _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_CONSTEXPR
#else
#define _LIBCPP_CONSTEXPR constexpr
#endif

#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_DEFAULT {}
#else
#define _LIBCPP_DEFAULT = default;
#endif

#ifdef __GNUC__
#define _NOALIAS __attribute__((__malloc__))
#else
#define _NOALIAS
#endif

#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
#   define _LIBCPP_EXPLICIT explicit
#else
#   define _LIBCPP_EXPLICIT
#endif

#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
#   define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
#endif

#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
    __lx __v_; \
    _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
    _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
    _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
    };
#else  // _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
#endif  // _LIBCPP_HAS_NO_STRONG_ENUMS

#ifdef _LIBCPP_DEBUG
#   if _LIBCPP_DEBUG == 0
#       define _LIBCPP_DEBUG_LEVEL 1
#   elif _LIBCPP_DEBUG == 1
#       define _LIBCPP_DEBUG_LEVEL 2
#   else
#       error Supported values for _LIBCPP_DEBUG are 0 and 1
#   endif
#   define _LIBCPP_EXTERN_TEMPLATE(...)
#endif

#ifndef _LIBCPP_EXTERN_TEMPLATE
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
#endif

#ifndef _LIBCPP_EXTERN_TEMPLATE2
#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
#endif

#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
#endif

#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || \
    defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__) || defined(__Bitrig__)
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif

#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) && \
    !defined(__CloudABI__)
#define _LIBCPP_HAS_CATOPEN 1
#endif

#ifdef __FreeBSD__
#define _DECLARE_C99_LDBL_MATH 1
#endif

#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__Bitrig__)
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
#endif

#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) || defined(__Bitrig__)
#define _LIBCPP_WCTYPE_IS_MASK
#endif

#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
#  define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
#endif

#ifndef _LIBCPP_STD_VER
#  if  __cplusplus <= 201103L
#    define _LIBCPP_STD_VER 11
#  elif __cplusplus <= 201402L
#    define _LIBCPP_STD_VER 14
#  else
#    define _LIBCPP_STD_VER 15  // current year, or date of c++17 ratification
#  endif
#endif  // _LIBCPP_STD_VER

#if _LIBCPP_STD_VER > 11
#define _LIBCPP_DEPRECATED [[deprecated]]
#else
#define _LIBCPP_DEPRECATED
#endif

#if _LIBCPP_STD_VER <= 11
#define _LIBCPP_EXPLICIT_AFTER_CXX11
#define _LIBCPP_DEPRECATED_AFTER_CXX11
#else
#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
#endif

#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
#else
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
#endif

#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#  define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
#else
#  define _LIBCPP_EXPLICIT_MOVE(x) (x)
#endif

#ifndef _LIBCPP_HAS_NO_ASAN
extern "C" void __sanitizer_annotate_contiguous_container(
  const void *, const void *, const void *, const void *);
#endif

// Try to find out if RTTI is disabled.
// g++ and cl.exe have RTTI on by default and define a macro when it is.
// g++ only defines the macro in 4.3.2 and onwards.
#if !defined(_LIBCPP_NO_RTTI)
#  if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
   (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
#    define _LIBCPP_NO_RTTI
#  elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
#    define _LIBCPP_NO_RTTI
#  endif
#endif

#ifndef _LIBCPP_WEAK
#  define _LIBCPP_WEAK __attribute__((__weak__))
#endif

#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
#  error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
         _LIBCPP_HAS_NO_THREADS is defined.
#endif

// Systems that use capability-based security (FreeBSD with Capsicum,
// Nuxi CloudABI) may only provide local filesystem access (using *at()).
// Functions like open(), rename(), unlink() and stat() should not be
// used, as they attempt to access the global filesystem namespace.
#ifdef __CloudABI__
#define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
#endif

// CloudABI is intended for running networked services. Processes do not
// have standard input and output channels.
#ifdef __CloudABI__
#define _LIBCPP_HAS_NO_STDIN
#define _LIBCPP_HAS_NO_STDOUT
#endif

#if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC)
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
#endif

// Thread-unsafe functions such as strtok(), mbtowc() and localtime()
// are not available.
#ifdef __CloudABI__
#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
#endif

#if __has_feature(cxx_atomic) || __has_extension(c_atomic)
#define _LIBCPP_HAS_C_ATOMIC_IMP
#elif _GNUC_VER > 407
#define _LIBCPP_HAS_GCC_ATOMIC_IMP
#endif

#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
     || defined(_LIBCPP_HAS_NO_THREADS)
#define _LIBCPP_HAS_NO_ATOMIC_HEADER
#endif

#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
#endif

#endif // __cplusplus

#endif // _LIBCPP_CONFIG

{'repo_name': 'bitrig/bitrig', 'stars': '252', 'repo_language': 'C', 'file_name': 'LoopSimplify.cpp', 'mime_type': 'text/x-c', 'hash': -8059125036660797635, 'source_dataset': 'data'}


<%-# Fedena
#Copyright 2010 Foradian Technologies Private Limited
#
#This product includes software developed at
#Project Fedena - http://www.projectfedena.org/
#
#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. -%>

<% @dash_news = News.get_latest %>

  <% @dash_news.each do |news| %>
    <div class="news_box <%= "first-news" if news == @dash_news.first %>">

<%= link_to shorten_string(news.title, 30), { :controller => 'news', :action => 'view', :id => news.id} %>

      <%= "#{t('posted_on')}" %> <%= I18n.l(news.created_at.to_date, :format=> :date_month)  %>
      <%= link_to "#{news.comments.size} #{t('comments')}", { :controller => 'news', :action => 'view', :id => news.id, :anchor=>"comments-heading"} %>

  <% end %>

{'repo_name': 'projectfedena/fedena', 'stars': '489', 'repo_language': 'HTML', 'file_name': 'jquery.hotkeys.js', 'mime_type': 'text/plain', 'hash': 305193341530677194, 'source_dataset': 'data'}


import { isStoreOwner } from './foo';
import { getWelcomeMessage } from '@share/get-welcome-message';
import type { Foo } from '@share/typings'

describe('Test optional chaining', () => {
  test(`should work`, () => {
    expect(isStoreOwner({
      isStoreOwner: false,
    })).toEqual(false)
  })

  test(`test export *`, () => {
    expect(getWelcomeMessage('foo')).toEqual('yolo foo')
  })

  test(`test import type`, () => {
    const foo: Foo = {
      bar: 1,
    }

    expect(foo).toBeTruthy()
  })
});

{'repo_name': 'kulshekhar/ts-jest', 'stars': '3712', 'repo_language': 'TypeScript', 'file_name': 'jest-preset.js', 'mime_type': 'text/plain', 'hash': 7240819263841191325, 'source_dataset': 'data'}


/*******************************************************************************
*                                 AMetal
*                       ----------------------------
*                       innovating embedded platform
*
* Copyright (c) 2001-2018 Guangzhou ZHIYUAN Electronics Co., Ltd.
* All rights reserved.
*
* Contact information:
* web site:    http://www.zlg.cn/
*******************************************************************************/

/**
 * \file
 * \brief LPTIM1 定时器 TIMING 例程，通过标准接口实现
 *
 * - 实验现象：
 *   1. LED0 以 5Hz 的频率翻转。(计数周期是10Hz，led翻转周期为10/2=5Hz)
 *
 * \note
 *   1.在am_hwconf_hc32l17x_lptim.c文件中，__g_lptim1_timing_devinfo设备信息结构体选择
 *             AMHW_HC32_LPTIM_FUNCTION_TIMER  ----------- 定时器模式
 *             AMHW_HC32_LPTIM_MODE_RELOAD     ----------- 自动重载模式
 *             AM_FALSE                          ----------- 门控关闭
 *             AM_TRUE                           ----------- TOG、TOGN输出使能打开
 *
 * \par 源代码
 * \snippet demo_hc32l17x_std_lptim1_timing.c src_hc32l17x_std_lptim1_timing
 *
 * \internal
 * \par Modification history
 * - 1.00 19-09-29  zp, first implementation
 * \endinternal
 */

/**
 * \addtogroup demo_if_hc32l17x_std_lptim1_timing
 * \copydoc demo_hc32l17x_std_lptim1_timing.c
 */

/** [src_hc32l17x_std_lptim1_timing] */

#include "ametal.h"
#include "am_vdebug.h"
#include "demo_std_entries.h"
#include "am_hc32l17x_inst_init.h"
#include "demo_aml17x_core_entries.h"

/**
 * \brief 例程入口
 */
void demo_hc32l17x_core_std_lptim1_timing_entry (void)
{
    AM_DBG_INFO("demo aml17x_core std lptim1 timing!\r\n");

    demo_std_timer_timing_entry(am_hc32_lptim1_timing_inst_init(), 0);
}
/** [src_hc32l17x_std_lptim1_timing] */

/* end of file */

{'repo_name': 'zlgopen/ametal', 'stars': '257', 'repo_language': 'C', 'file_name': 'am_servconf_nvram.c', 'mime_type': 'text/x-c', 'hash': 38032804123375735, 'source_dataset': 'data'}


<!--
   DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

   Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved

   The contents of this file are subject to the terms
   of the Common Development and Distribution License
   (the License). You may not use this file except in
   compliance with the License.

   You can obtain a copy of the License at
   https://opensso.dev.java.net/public/CDDLv1.0.html or
   opensso/legal/CDDLv1.0.txt
   See the License for the specific language governing
   permission and limitations under the License.

   When distributing Covered Code, include this CDDL
   Header Notice in each file and include the License file
   at opensso/legal/CDDLv1.0.txt.
   If applicable, add the following below the CDDL Header,
   with the fields enclosed by brackets [] replaced by
   your own identifying information:
   "Portions Copyrighted [year] [name of copyright owner]"

   $Id: propertyPMConditionSession_Readonly.xml,v 1.2 2008/06/25 05:45:12 qcheng Exp $

-->

<!DOCTYPE propertysheet SYSTEM "propertysheet.dtd">

<propertysheet>
    <section name="dummy" defaultValue="blank.header" >
    <property>
	<label name="lblName" defaultValue="policy.condition.attribute.label.name" labelFor="tfConditionName" />
	<cc name="tfConditionName" tagclass="com.sun.web.ui.taglib.html.CCStaticTextFieldTag" />
	<cc name="conditionTypeName" tagclass="com.sun.web.ui.taglib.html.CCHiddenTag" />
	<cc name="tfConditionTypeName" tagclass="com.sun.web.ui.taglib.html.CCHiddenTag" />
	<cc name="tfRealmName" tagclass="com.sun.web.ui.taglib.html.CCHiddenTag" />
    </property>
    <property>
    <label name="lblMaxSessionTime" defaultValue="policy.condition.attribute.label.max.session.time" labelFor="MaxSessionTime" />
    <cc name="MaxSessionTime" tagclass="com.sun.web.ui.taglib.html.CCStaticTextFieldTag" />
    </property>
    <property>
    <label name="lblTerminateSession" defaultValue="policy.condition.attribute.label.terminate.session" labelFor="TerminateSession" />
    <cc name="TerminateSession" tagclass="com.sun.web.ui.taglib.html.CCStaticTextFieldTag" />
    </property>
    </section>
</propertysheet>

{'repo_name': 'OpenRock/OpenAM', 'stars': '136', 'repo_language': 'Java', 'file_name': 'FSAccountManager.java', 'mime_type': 'text/x-java', 'hash': 2566486884990998218, 'source_dataset': 'data'}


/obj/item/gun/magic/staff
	slot_flags = SLOT_BACK
	ammo_type = /obj/item/ammo_casing/magic
	flags_2 = NO_MAT_REDEMPTION_2

/obj/item/gun/magic/staff/change
	name = "staff of change"
	desc = "An artefact that spits bolts of coruscating energy which cause the target's very form to reshape itself"
	ammo_type = /obj/item/ammo_casing/magic/change
	icon_state = "staffofchange"
	item_state = "staffofchange"
	fire_sound = 'sound/magic/Staff_Change.ogg'

/obj/item/gun/magic/staff/animate
	name = "staff of animation"
	desc = "An artefact that spits bolts of life-force which causes objects which are hit by it to animate and come to life! This magic doesn't affect machines."
	ammo_type = /obj/item/ammo_casing/magic/animate
	icon_state = "staffofanimation"
	item_state = "staffofanimation"
	fire_sound = 'sound/magic/staff_animation.ogg'

/obj/item/gun/magic/staff/healing
	name = "staff of healing"
	desc = "An artefact that spits bolts of restoring magic which can remove ailments of all kinds and even raise the dead."
	ammo_type = /obj/item/ammo_casing/magic/heal
	icon_state = "staffofhealing"
	item_state = "staffofhealing"
	fire_sound = 'sound/magic/staff_healing.ogg'

/obj/item/gun/magic/staff/healing/handle_suicide() //Stops people trying to commit suicide to heal themselves
	return

/obj/item/gun/magic/staff/chaos
	name = "staff of chaos"
	desc = "An artefact that spits bolts of chaotic magic that can potentially do anything."
	ammo_type = /obj/item/ammo_casing/magic/chaos
	icon_state = "staffofchaos"
	item_state = "staffofchaos"
	max_charges = 10
	recharge_rate = 2
	no_den_usage = 1
	fire_sound = 'sound/magic/staff_chaos.ogg'

/obj/item/gun/magic/staff/door
	name = "staff of door creation"
	desc = "An artefact that spits bolts of transformative magic that can create doors in walls."
	ammo_type = /obj/item/ammo_casing/magic/door
	icon_state = "staffofdoor"
	item_state = "staffofdoor"
	max_charges = 10
	recharge_rate = 2
	no_den_usage = 1
	fire_sound = 'sound/magic/staff_door.ogg'

/obj/item/gun/magic/staff/slipping
	name = "staff of slipping"
	desc = "An artefact that spits... bananas?"
	ammo_type = /obj/item/ammo_casing/magic/slipping
	icon_state = "staffofslipping"
	item_state = "staffofslipping"
	fire_sound = 'sound/items/bikehorn.ogg'

/obj/item/gun/magic/staff/slipping/honkmother
	name = "staff of the honkmother"
	desc = "An ancient artefact, sought after by clowns everywhere."
	fire_sound = 'sound/items/airhorn.ogg'

/obj/item/gun/magic/staff/focus
	name = "mental focus"
	desc = "An artefact that channels the will of the user into destructive bolts of force. If you aren't careful with it, you might poke someone's brain out."
	icon = 'icons/obj/wizard.dmi'
	icon_state = "focus"
	item_state = "focus"
	ammo_type = /obj/item/ammo_casing/magic/forcebolt

/obj/item/gun/magic/staff/spellblade
	name = "spellblade"
	desc = "A deadly combination of laziness and boodlust, this blade allows the user to dismember their enemies without all the hard work of actually swinging the sword."
	fire_sound = 'sound/magic/fireball.ogg'
	ammo_type = /obj/item/ammo_casing/magic/spellblade
	icon_state = "spellblade"
	item_state = "spellblade"
	hitsound = 'sound/weapons/rapierhit.ogg'
	force = 20
	armour_penetration = 75
	block_chance = 50
	sharp = 1
	max_charges = 4

/obj/item/gun/magic/staff/spellblade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
	if(attack_type == PROJECTILE_ATTACK)
		final_block_chance = 0
	return ..()

{'repo_name': 'ParadiseSS13/Paradise', 'stars': '214', 'repo_language': 'DM', 'file_name': 'mode.txt', 'mime_type': 'text/plain', 'hash': 4146747405015181653, 'source_dataset': 'data'}


	@if ($company['logo'])

	@else
		{{ $company['name'] }}
	@endif

	@if (isset($company['slogan']))
		{{ $company['slogan'] }}
	@endif

{'repo_name': 'ant-vel/App', 'stars': '575', 'repo_language': 'PHP', 'file_name': 'filters.js', 'mime_type': 'text/x-pascal', 'hash': 8781002684681932952, 'source_dataset': 'data'}