text
stringlengths
2
100k
meta
dict
build := -f $(srctree)/tools/build/Makefile.build dir=. obj fixdep: $(Q)$(MAKE) -C $(srctree)/tools/build CFLAGS= LDFLAGS= $(OUTPUT)fixdep fixdep-clean: $(Q)$(MAKE) -C $(srctree)/tools/build clean .PHONY: fixdep
{ "pile_set_name": "Github" }
/* ============================================================= * flatui-checkbox v0.0.3 * ============================================================ */ !function ($) { /* CHECKBOX PUBLIC CLASS DEFINITION * ============================== */ var Checkbox = function (element, options) { this.init(element, options); } Checkbox.prototype = { constructor: Checkbox , init: function (element, options) { var $el = this.$element = $(element) this.options = $.extend({}, $.fn.checkbox.defaults, options); $el.before(this.options.template); this.setState(); } , setState: function () { var $el = this.$element , $parent = $el.closest('.checkbox'); $el.prop('disabled') && $parent.addClass('disabled'); $el.prop('checked') && $parent.addClass('checked'); } , toggle: function () { var ch = 'checked' , $el = this.$element , $parent = $el.closest('.checkbox') , checked = $el.prop(ch) , e = $.Event('toggle') if ($el.prop('disabled') == false) { $parent.toggleClass(ch) && checked ? $el.removeAttr(ch) : $el.prop(ch, ch); $el.trigger(e).trigger('change'); } } , setCheck: function (option) { var d = 'disabled' , ch = 'checked' , $el = this.$element , $parent = $el.closest('.checkbox') , checkAction = option == 'check' ? true : false , e = $.Event(option) $parent[checkAction ? 'addClass' : 'removeClass' ](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch); $el.trigger(e).trigger('change'); } } /* CHECKBOX PLUGIN DEFINITION * ======================== */ var old = $.fn.checkbox $.fn.checkbox = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('checkbox') , options = $.extend({}, $.fn.checkbox.defaults, $this.data(), typeof option == 'object' && option); if (!data) $this.data('checkbox', (data = new Checkbox(this, options))); if (option == 'toggle') data.toggle() if (option == 'check' || option == 'uncheck') data.setCheck(option) else if (option) data.setState(); }); } $.fn.checkbox.defaults = { template: '<span class="icons"><span class="first-icon fui-checkbox-unchecked"></span><span class="second-icon fui-checkbox-checked"></span></span>' } /* CHECKBOX NO CONFLICT * ================== */ $.fn.checkbox.noConflict = function () { $.fn.checkbox = old; return this; } /* CHECKBOX DATA-API * =============== */ $(document).on('click.checkbox.data-api', '[data-toggle^=checkbox], .checkbox', function (e) { var $checkbox = $(e.target); if (e.target.tagName != "A") { e && e.preventDefault() && e.stopPropagation(); if (!$checkbox.hasClass('checkbox')) $checkbox = $checkbox.closest('.checkbox'); $checkbox.find(':checkbox').checkbox('toggle'); } }); $(function () { $('[data-toggle="checkbox"]').each(function () { var $checkbox = $(this); $checkbox.checkbox(); }); }); }(window.jQuery);
{ "pile_set_name": "Github" }
/* Copyright The Kubernetes Authors. 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. */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 import ( v1beta1 "k8s.io/api/extensions/v1beta1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" ) // ReplicaSetLister helps list ReplicaSets. type ReplicaSetLister interface { // List lists all ReplicaSets in the indexer. List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) // ReplicaSets returns an object that can list and get ReplicaSets. ReplicaSets(namespace string) ReplicaSetNamespaceLister ReplicaSetListerExpansion } // replicaSetLister implements the ReplicaSetLister interface. type replicaSetLister struct { indexer cache.Indexer } // NewReplicaSetLister returns a new ReplicaSetLister. func NewReplicaSetLister(indexer cache.Indexer) ReplicaSetLister { return &replicaSetLister{indexer: indexer} } // List lists all ReplicaSets in the indexer. func (s *replicaSetLister) List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { ret = append(ret, m.(*v1beta1.ReplicaSet)) }) return ret, err } // ReplicaSets returns an object that can list and get ReplicaSets. func (s *replicaSetLister) ReplicaSets(namespace string) ReplicaSetNamespaceLister { return replicaSetNamespaceLister{indexer: s.indexer, namespace: namespace} } // ReplicaSetNamespaceLister helps list and get ReplicaSets. type ReplicaSetNamespaceLister interface { // List lists all ReplicaSets in the indexer for a given namespace. List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) // Get retrieves the ReplicaSet from the indexer for a given namespace and name. Get(name string) (*v1beta1.ReplicaSet, error) ReplicaSetNamespaceListerExpansion } // replicaSetNamespaceLister implements the ReplicaSetNamespaceLister // interface. type replicaSetNamespaceLister struct { indexer cache.Indexer namespace string } // List lists all ReplicaSets in the indexer for a given namespace. func (s replicaSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { ret = append(ret, m.(*v1beta1.ReplicaSet)) }) return ret, err } // Get retrieves the ReplicaSet from the indexer for a given namespace and name. func (s replicaSetNamespaceLister) Get(name string) (*v1beta1.ReplicaSet, error) { obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) if err != nil { return nil, err } if !exists { return nil, errors.NewNotFound(v1beta1.Resource("replicaset"), name) } return obj.(*v1beta1.ReplicaSet), nil }
{ "pile_set_name": "Github" }
#!/usr/bin/env python class BytesIO: def __init__(self, buffer): self._data = buffer if not self._data: self._data = str() self._pos = 0 def getvalue(self): return self._data def close(self): pass def readline(self): return self.read(self._data[self._pos:].find('\n') + 1) def read(self, n=None): if n == None: n = -1 if not isinstance(n, (int, long)): raise TypeError("Argument must be an integer") if n < 0: n = len(self._data) if len(self._data) <= self._pos: return '' newpos = min(len(self._data), self._pos + n) b = self._data[self._pos : newpos] self._pos = newpos return b def readable(self): return True def writable(self): return True def seekable(self): return False
{ "pile_set_name": "Github" }
\include{preamble} \include{commands} \title{ Руководство пользователя Mongrel2\\ \textit{Установка, развёртывание, эксплуатация} } \author{Зед А. Шоу\\ \small{Гилермо О. "Tordek" Фреши}} \date{Август 2010} \begin{document} \frontmatter \maketitle \tableofcontents \include{preface} \mainmatter \include{introduction} \include{installing} \include{managing} \include{deploying} \include{hacking} \include{contributing} \appendix \end{document}
{ "pile_set_name": "Github" }
'' FreeBASIC binding for gsl-1.16 '' '' based on the C header files: '' gsl_nan.h '' '' Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, Brian Gough '' '' This program is free software; you can redistribute it and/or modify '' it under the terms of the GNU General Public License as published by '' the Free Software Foundation; either version 3 of the License, or (at '' your option) any later version. '' '' This program is distributed in the hope that it will be useful, but '' WITHOUT ANY WARRANTY; without even the implied warranty of '' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU '' General Public License for more details. '' '' You should have received a copy of the GNU General Public License '' along with this program; if not, write to the Free Software '' Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. '' '' translated to FreeBASIC by: '' Copyright © 2015 FreeBASIC development team #pragma once #define __GSL_NAN_H__ #define GSL_POSZERO (+0.0) const GSL_NEGZERO = -0.0
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait"> <head> <script> customElements.define("custom-element", class extends HTMLElement { constructor() { super(); const template = document.getElementById("template"); const shadowRoot = this.attachShadow({mode: "open"}) .appendChild(template.content.cloneNode(true)); } }); function doTest() { var l = document.getElementById("l"); l.parentNode.insertBefore(document.createTextNode("x"), l); document.documentElement.removeAttribute("class"); } </script> </head> <body onload="doTest()"> <template id="template"> <style> #hasAfter::after { content: "y"; } #l { display: none; } </style> <span id="hasAfter"><slot/></span> </template> <custom-element style="font-size: 300%; display:block;"><span id="l"></span></custom-element> </body> </html>
{ "pile_set_name": "Github" }
/* libFLAC - Free Lossless Audio Codec * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of the Xiph.org Foundation nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #if HAVE_CONFIG_H # include <config.h> #endif #include <string.h> /* for memcpy() */ #include "FLAC/assert.h" #include "private/ogg_decoder_aspect.h" #include "private/ogg_mapping.h" #ifdef max #undef max #endif #define max(x,y) ((x)>(y)?(x):(y)) /*********************************************************************** * * Public class methods * ***********************************************************************/ FLAC__bool FLAC__ogg_decoder_aspect_init(FLAC__OggDecoderAspect *aspect) { /* we will determine the serial number later if necessary */ if(ogg_stream_init(&aspect->stream_state, aspect->serial_number) != 0) return false; if(ogg_sync_init(&aspect->sync_state) != 0) return false; aspect->version_major = ~(0u); aspect->version_minor = ~(0u); aspect->need_serial_number = aspect->use_first_serial_number; aspect->end_of_stream = false; aspect->have_working_page = false; return true; } void FLAC__ogg_decoder_aspect_finish(FLAC__OggDecoderAspect *aspect) { (void)ogg_sync_clear(&aspect->sync_state); (void)ogg_stream_clear(&aspect->stream_state); } void FLAC__ogg_decoder_aspect_set_serial_number(FLAC__OggDecoderAspect *aspect, long value) { aspect->use_first_serial_number = false; aspect->serial_number = value; } void FLAC__ogg_decoder_aspect_set_defaults(FLAC__OggDecoderAspect *aspect) { aspect->use_first_serial_number = true; } void FLAC__ogg_decoder_aspect_flush(FLAC__OggDecoderAspect *aspect) { (void)ogg_stream_reset(&aspect->stream_state); (void)ogg_sync_reset(&aspect->sync_state); aspect->end_of_stream = false; aspect->have_working_page = false; } void FLAC__ogg_decoder_aspect_reset(FLAC__OggDecoderAspect *aspect) { FLAC__ogg_decoder_aspect_flush(aspect); if(aspect->use_first_serial_number) aspect->need_serial_number = true; } FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper(FLAC__OggDecoderAspect *aspect, FLAC__byte buffer[], size_t *bytes, FLAC__OggDecoderAspectReadCallbackProxy read_callback, const FLAC__StreamDecoder *decoder, void *client_data) { static const size_t OGG_BYTES_CHUNK = 8192; const size_t bytes_requested = *bytes; /* * The FLAC decoding API uses pull-based reads, whereas Ogg decoding * is push-based. In libFLAC, when you ask to decode a frame, the * decoder will eventually call the read callback to supply some data, * but how much it asks for depends on how much free space it has in * its internal buffer. It does not try to grow its internal buffer * to accomodate a whole frame because then the internal buffer size * could not be limited, which is necessary in embedded applications. * * Ogg however grows its internal buffer until a whole page is present; * only then can you get decoded data out. So we can't just ask for * the same number of bytes from Ogg, then pass what's decoded down to * libFLAC. If what libFLAC is asking for will not contain a whole * page, then we will get no data from ogg_sync_pageout(), and at the * same time cannot just read more data from the client for the purpose * of getting a whole decoded page because the decoded size might be * larger than libFLAC's internal buffer. * * Instead, whenever this read callback wrapper is called, we will * continually request data from the client until we have at least one * page, and manage pages internally so that we can send pieces of * pages down to libFLAC in such a way that we obey its size * requirement. To limit the amount of callbacks, we will always try * to read in enough pages to return the full number of bytes * requested. */ *bytes = 0; while (*bytes < bytes_requested && !aspect->end_of_stream) { if (aspect->have_working_page) { if (aspect->have_working_packet) { size_t n = bytes_requested - *bytes; if ((size_t)aspect->working_packet.bytes <= n) { /* the rest of the packet will fit in the buffer */ n = aspect->working_packet.bytes; memcpy(buffer, aspect->working_packet.packet, n); *bytes += n; buffer += n; aspect->have_working_packet = false; } else { /* only n bytes of the packet will fit in the buffer */ memcpy(buffer, aspect->working_packet.packet, n); *bytes += n; buffer += n; aspect->working_packet.packet += n; aspect->working_packet.bytes -= n; } } else { /* try and get another packet */ const int ret = ogg_stream_packetout(&aspect->stream_state, &aspect->working_packet); if (ret > 0) { aspect->have_working_packet = true; /* if it is the first header packet, check for magic and a supported Ogg FLAC mapping version */ if (aspect->working_packet.bytes > 0 && aspect->working_packet.packet[0] == FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE) { const FLAC__byte *b = aspect->working_packet.packet; const unsigned header_length = FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH + FLAC__OGG_MAPPING_MAGIC_LENGTH + FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH + FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH + FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH; if (aspect->working_packet.bytes < (long)header_length) return FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC; b += FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH; if (memcmp(b, FLAC__OGG_MAPPING_MAGIC, FLAC__OGG_MAPPING_MAGIC_LENGTH)) return FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC; b += FLAC__OGG_MAPPING_MAGIC_LENGTH; aspect->version_major = (unsigned)(*b); b += FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH; aspect->version_minor = (unsigned)(*b); if (aspect->version_major != 1) return FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION; aspect->working_packet.packet += header_length; aspect->working_packet.bytes -= header_length; } } else if (ret == 0) { aspect->have_working_page = false; } else { /* ret < 0 */ /* lost sync, we'll leave the working page for the next call */ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC; } } } else { /* try and get another page */ const int ret = ogg_sync_pageout(&aspect->sync_state, &aspect->working_page); if (ret > 0) { /* got a page, grab the serial number if necessary */ if(aspect->need_serial_number) { aspect->stream_state.serialno = aspect->serial_number = ogg_page_serialno(&aspect->working_page); aspect->need_serial_number = false; } if(ogg_stream_pagein(&aspect->stream_state, &aspect->working_page) == 0) { aspect->have_working_page = true; aspect->have_working_packet = false; } /* else do nothing, could be a page from another stream */ } else if (ret == 0) { /* need more data */ const size_t ogg_bytes_to_read = max(bytes_requested - *bytes, OGG_BYTES_CHUNK); char *oggbuf = ogg_sync_buffer(&aspect->sync_state, ogg_bytes_to_read); if(0 == oggbuf) { return FLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR; } else { size_t ogg_bytes_read = ogg_bytes_to_read; switch(read_callback(decoder, (FLAC__byte*)oggbuf, &ogg_bytes_read, client_data)) { case FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK: break; case FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM: aspect->end_of_stream = true; break; case FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT: return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT; default: FLAC__ASSERT(0); } if(ogg_sync_wrote(&aspect->sync_state, ogg_bytes_read) < 0) { /* double protection; this will happen if the read callback returns more bytes than the max requested, which would overflow Ogg's internal buffer */ FLAC__ASSERT(0); return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR; } } } else { /* ret < 0 */ /* lost sync, bail out */ return FLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC; } } } if (aspect->end_of_stream && *bytes == 0) { return FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM; } return FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK; }
{ "pile_set_name": "Github" }
#ifndef _DEVO7E_TARGET_H_ #define _DEVO7E_TARGET_H_ #define TXID 0x7e #define VECTOR_TABLE_LOCATION 0x3000 #define SPIFLASH_SECTOR_OFFSET 0 #define SPIFLASH_SECTORS 512 #if defined BUILDTYPE_DEV && ! defined EMULATOR //No room for debug and standard gui #define HAS_STANDARD_GUI 0 #else #define HAS_STANDARD_GUI 1 #endif #define HAS_ADVANCED_GUI 1 #define HAS_PERMANENT_TIMER 0 #define HAS_TELEMETRY 1 #define HAS_EXTENDED_TELEMETRY 0 #define HAS_TOUCH 0 #define HAS_RTC 0 #define HAS_VIBRATINGMOTOR 1 #define HAS_DATALOG 0 #define SUPPORT_SCANNER 0 #define HAS_LAYOUT_EDITOR 0 #define HAS_EXTRA_SWITCHES OPTIONAL #define HAS_EXTRA_BUTTONS 0 #define HAS_BUTTON_MATRIX_PULLUP 1 #define HAS_MULTIMOD_SUPPORT 1 #define HAS_VIDEO 0 #define HAS_4IN1_FLASH 0 #define HAS_EXTENDED_AUDIO 0 #define HAS_AUDIO_UART 0 #define HAS_MUSIC_CONFIG 0 #define SUPPORT_DYNAMIC_LOCSTR 1 #define SUPPORT_MULTI_LANGUAGE 1 #define SUPPORT_XN297DUMP 0 #define DEBUG_WINDOW_SIZE 0 #define MIN_BRIGHTNESS 0 #define DEFAULT_BATTERY_ALARM 4100 #define DEFAULT_BATTERY_CRITICAL 3900 #define MAX_BATTERY_ALARM 9000 #define MIN_BATTERY_ALARM 3300 #define MAX_POWER_ALARM 60 #define NUM_OUT_CHANNELS 16 #define NUM_VIRT_CHANNELS 10 #define NUM_TRIMS 6 #define MAX_POINTS 13 #define NUM_MIXERS ((NUM_OUT_CHANNELS + NUM_VIRT_CHANNELS) * 4) #define INP_HAS_CALIBRATION 4 /* Compute voltage from y = 2.1592x + 0.2493 */ #define VOLTAGE_NUMERATOR 216 #define VOLTAGE_OFFSET 249 #include "hardware.h" #include "../common/common_devo.h" #endif //_DEVO7E_TARGET_H_
{ "pile_set_name": "Github" }
<?php namespace Runalyze\Dataset\Keys; use Runalyze\Dataset\Context; use Runalyze\Dataset\SummaryMode; class AverageImpactGs extends AbstractKey { public function id() { return \Runalyze\Dataset\Keys::AVG_IMPACT_GS; } public function column() { return ['avg_impact_gs_left', 'avg_impact_gs_right']; } public function label() { return __('Impact Gs'); } public function stringFor(Context $context) { return $context->dataview()->impactGs(); } public function summaryMode() { return SummaryMode::AVG; } public function cssClass() { return 'small'; } }
{ "pile_set_name": "Github" }
'use strict'; function posix(path) { return path.charAt(0) === '/'; }; function win32(path) { // https://github.com/joyent/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; var result = splitDeviceRe.exec(path); var device = result[1] || ''; var isUnc = !!device && device.charAt(1) !== ':'; // UNC paths are always absolute return !!result[2] || isUnc; }; module.exports = process.platform === 'win32' ? win32 : posix; module.exports.posix = posix; module.exports.win32 = win32;
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Visibly.js shim demo</title> <script src="visibly.js"></script> </head> <body> <script type="text/javascript"> visibly.onVisible(function () { console.log('page is visible'); }); visibly.onHidden(function () { console.log('page is hidden'); }); visibly.onVisible(function (){ document.title = 'visible'; }); visibly.onHidden(function (){ document.title = 'hidden'; }); visibly.visibilitychange(function(state){ console.log('Page visibility state is:' + state); }); visibly.visibilitychange(function(state){ console.log('My visibility is:' + state); }); </script> <p> This is a very basic test page demonstrating <strong>visibly</strong> in action. If you create a new tab or click outside the main browser application window, you should see the title of the document change. </p> </body> </html>
{ "pile_set_name": "Github" }
simulateModel("Buildings.Controls.OBC.UnitConversions.Validation.From_gal", method="dassl", stopTime=10, tolerance=1e-06, resultFile="From_gal"); createPlot(id=1, position={20, 10, 900, 650}, subPlot=1, y={"add.y"}, range={0.0, 1800.0, -0.2, 0.12}, grid=true, colors={{0,0,0}}); createPlot(id=1, position={20, 10, 900, 650}, subPlot=2, y={"add1.y"}, range={0.0, 1800.0, -0.2, 0.12}, grid=true, colors={{0,0,0}});
{ "pile_set_name": "Github" }
/* * Copyright (C) 2007 Michael Niedermayer <[email protected]> * Copyright (C) 2013 James Almer <[email protected]> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * @ingroup lavu_ripemd * Public header for RIPEMD hash function implementation. */ #ifndef AVUTIL_RIPEMD_H #define AVUTIL_RIPEMD_H #include <stdint.h> #include "attributes.h" #include "version.h" /** * @defgroup lavu_ripemd RIPEMD * @ingroup lavu_hash * RIPEMD hash function implementation. * * @{ */ extern const int av_ripemd_size; struct AVRIPEMD; /** * Allocate an AVRIPEMD context. */ struct AVRIPEMD *av_ripemd_alloc(void); /** * Initialize RIPEMD hashing. * * @param context pointer to the function context (of size av_ripemd_size) * @param bits number of bits in digest (128, 160, 256 or 320 bits) * @return zero if initialization succeeded, -1 otherwise */ int av_ripemd_init(struct AVRIPEMD* context, int bits); /** * Update hash value. * * @param context hash function context * @param data input data to update hash with * @param len input data length */ void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); /** * Finish hashing and output digest value. * * @param context hash function context * @param digest buffer where output digest value is stored */ void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest); /** * @} */ #endif /* AVUTIL_RIPEMD_H */
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <style xmlns="http://purl.org/net/xbiblio/csl" class="note" version="1.0" et-al-min="3" et-al-use-first="1" et-al-subsequent-min="3" et-al-subsequent-use-first="1" initialize="false" page-range-format="expanded" demote-non-dropping-particle="never" default-locale="fr-FR"> <info> <title>Université Catholique de Louvain - Histoire (French)</title> <title-short>UCL</title-short> <id>http://www.zotero.org/styles/universite-catholique-de-louvain-histoire</id> <link href="http://www.zotero.org/styles/universite-catholique-de-louvain-histoire" rel="self"/> <link href="https://lesvoyagesdebalnibarbi.wordpress.com/2018/02/17/zotero-csl-ucl/ " rel="documentation"/> <author> <name>Pierre Bieswal</name> <email>[email protected]</email> </author> <category citation-format="note"/> <category field="history"/> <updated>2018-02-21T17:34:36+00:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> <locale xml:lang="fr"> <terms> <term name="ordinal-01">ère</term> <term name="ordinal-02">e</term> <term name="ordinal-03">e</term> <term name="ordinal-04">e</term> <term name="cited">op.&#160;cit.</term> <term name="page" form="short">p.</term> <term name="editor" form="short">éd.</term> <term name="in">dans</term> <term name="translator">traduit par </term> <term name="director">dirigée par </term> </terms> </locale> <macro name="Author"> <names variable="author" delimiter=", "> <name and="text" delimiter-precedes-last="never" initialize="false" initialize-with="." name-as-sort-order="all" sort-separator=" "> <name-part name="family" font-variant="small-caps"/> </name> <substitute> <text macro="editor"/> </substitute> </names> </macro> <macro name="editor"> <names variable="editor" delimiter=", "> <name and="text" delimiter-precedes-last="never" initialize="false" initialize-with="." name-as-sort-order="all" sort-separator=" "> <name-part name="family" font-variant="small-caps"/> </name> </names> <text term="editor" form="short" prefix="&#160;(" suffix=")"/> </macro> <macro name="translator"> <text term="translator"/> <names variable="translator" delimiter=", "> <name and="text" delimiter-precedes-last="never" initialize-with="." name-as-sort-order="all" sort-separator=" "> <name-part name="family" font-variant="small-caps"/> </name> </names> </macro> <macro name="Title"> <group delimiter=", "> <choose> <if type="article-journal article-magazine article-newspaper entry-dictionary entry-encyclopedia chapter" match="any"> <text macro="Title-in-title"/> </if> <else> <text variable="title" text-case="capitalize-first" font-style="italic"/> </else> </choose> <choose> <if type="thesis" match="any"> <group delimiter=", "> <text variable="genre" text-case="capitalize-first"/> <choose> <if match="any" variable="director"> <group delimiter=" "> <text term="director"/> <names variable="director" delimiter=","> <name and="text" initialize="false" name-as-sort-order="all"> <name-part name="family" text-case="capitalize-first" font-variant="small-caps"/> </name> </names> </group> </if> </choose> </group> </if> </choose> </group> </macro> <macro name="Edition-Publisher-Issued"> <group delimiter=", "> <choose> <if match="any" is-numeric="edition"> <group delimiter=" "> <number variable="edition" form="ordinal"/> <text term="edition" vertical-align="baseline"/> </group> </if> <else> <text variable="edition" text-case="capitalize-first"/> </else> </choose> <text variable="publisher-place"/> <text variable="publisher"/> <choose> <if type="webpage post-weblog article-journal article-magazine article-newspaper" match="none"> <choose> <if match="any" variable="issued"> <choose> <if match="any" is-numeric="issued"> <date date-parts="year" form="text" variable="issued"/> </if> <else> <date form="text" date-parts="year-month-day" variable="issued"/> </else> </choose> </if> <else> <text value="s.d."/> </else> </choose> </if> </choose> </group> </macro> <macro name="Volume-Issue"> <choose> <if match="none" variable="volume"> <choose> <if match="any" is-numeric="number-of-volumes"> <group> <text variable="number-of-volumes" suffix=" "/> <text term="volume" form="short"/> </group> </if> </choose> </if> </choose> <group delimiter=", "> <group delimiter=", "> <choose> <if match="any" is-numeric="issue"> <group> <text term="issue" form="short" suffix="&#160;"/> <number variable="issue"/> </group> </if> <else> <text variable="issue" suffix="hello"/> </else> </choose> </group> <group> <choose> <if type="article-journal article-magazine article-newspaper" match="any"> <date form="text" variable="issued"/> </if> </choose> </group> </group> </macro> <macro name="Page-URL"> <group delimiter=", "> <text macro="Locator-or-Page"/> <group> <choose> <if match="any" variable="URL"> <text term="online" text-case="capitalize-first" prefix="[" suffix="], &lt;"/> <text variable="URL" suffix="&gt;"/> <group delimiter=" " prefix=", (" suffix=")"> <text term="accessed" text-case="capitalize-first"/> <date form="text" variable="accessed"/> </group> </if> </choose> </group> </group> </macro> <macro name="Locator-or-Page"> <choose> <if match="any" variable="locator"> <text macro="Locator"/> </if> <else> <group delimiter=" "> <label plural="never" variable="page" form="short"/> <text variable="page"/> </group> </else> </choose> </macro> <macro name="Locator"> <group delimiter=" "> <label variable="locator" form="short"/> <text variable="locator"/> </group> </macro> <macro name="Archive"> <group delimiter=", "> <text variable="publisher-place" font-variant="small-caps"/> <text variable="archive"/> <text variable="archive_location" font-style="italic"/> <text variable="source"/> <text variable="call-number"/> <text macro="Locator"/> </group> </macro> <macro name="Title-in-title"> <group delimiter=", "> <text variable="title" text-case="capitalize-first" quotes="true"/> <choose> <if match="any" variable="container-author editor"> <group delimiter=", "> <text term="in"/> <choose> <if type="chapter" match="all" variable="container-author"> <names variable="container-author" delimiter=", "> <name and="text" delimiter-precedes-last="never" initialize="false" initialize-with="." name-as-sort-order="all" sort-separator=" "> <name-part name="family" font-variant="small-caps"/> </name> </names> </if> <else-if match="any" variable="editor"> <text macro="editor"/> </else-if> </choose> <text variable="container-title" text-case="capitalize-first" font-style="italic"/> </group> </if> <else> <group delimiter=" "> <text term="in"/> <text variable="container-title" font-style="italic"/> </group> </else> </choose> </group> </macro> <macro name="Title-subsequent"> <group delimiter=", "> <choose> <if match="all" variable="title-short"> <choose> <if type="article-journal article-magazine article-newspaper chapter entry-dictionary entry-encyclopedia" match="any"> <text variable="title-short" quotes="true"/> <text value="art. cit." font-style="italic" text-decoration="none"/> </if> <else> <text variable="title-short" font-style="italic"/> <text term="cited" font-style="italic"/> </else> </choose> </if> <else> <choose> <if type="article-journal article-magazine article-newspaper chapter entry-dictionary entry-encyclopedia" match="any"> <text variable="title" quotes="true"/> <text value="art. cit." font-style="italic"/> </if> <else> <text variable="title" font-style="italic"/> <text term="cited" font-style="italic"/> </else> </choose> </else> </choose> </group> </macro> <macro name="Volume-alpha"> <choose> <if match="all" variable="volume"> <group delimiter=", "> <choose> <if match="any" variable="number-of-volumes"> <group> <text term="volume" form="short" suffix=" "/> <number suffix=" : " variable="number-of-volumes"/> <text variable="volume" font-style="italic"/> </group> </if> <else> <group delimiter=" "> <text term="volume" form="short"/> <number variable="volume"/> </group> </else> </choose> </group> </if> </choose> </macro> <macro name="Bibliography-Sort"> <choose> <if type="manuscript" match="any"> <text value="1"/> </if> <else-if match="any" variable="note"> <text value="2"/> </else-if> <else-if type="article-newspaper" match="any"> <text value="3"/> </else-if> <else> <text value="9"/> </else> </choose> </macro> <macro name="Collection"> <group delimiter=", " prefix="(" suffix=")"> <text variable="collection-title"/> <number prefix=" " variable="collection-number"/> </group> </macro> <citation et-al-min="4" et-al-use-first="1"> <layout delimiter=" "> <choose> <if position="ibid-with-locator"> <group delimiter=", " suffix="."> <text term="ibid" text-case="capitalize-first" font-style="italic" suffix="."/> <text macro="Locator"/> </group> </if> <else-if position="ibid"> <text term="ibid" text-case="capitalize-first" font-style="italic"/> </else-if> <else-if position="subsequent"> <group delimiter=", " suffix="."> <text macro="Author"/> <text macro="Title-subsequent"/> <text macro="Locator"/> </group> </else-if> <else> <choose> <if type="manuscript" match="any"> <text macro="Archive"/> </if> <else> <group delimiter=", "> <text macro="Author"/> <text macro="Title"/> <text macro="translator"/> <text macro="Volume-alpha"/> <text macro="Edition-Publisher-Issued"/> <text macro="Volume-Issue"/> <text macro="Collection"/> <text macro="Page-URL"/> </group> </else> </choose> <text value="."/> </else> </choose> </layout> </citation> <bibliography et-al-min="4" et-al-use-first="1"> <sort> <key macro="Bibliography-Sort"/> <key macro="Author"/> <key variable="issued" sort="descending"/> <key macro="Archive"/> </sort> <layout suffix="."> <choose> <if type="manuscript" match="any"> <text macro="Archive"/> </if> <else> <group delimiter=", "> <text macro="Author"/> <text macro="Title"/> <text macro="translator"/> <text macro="Volume-alpha"/> <text macro="Edition-Publisher-Issued"/> <text macro="Volume-Issue"/> <text macro="Collection"/> <text macro="Page-URL"/> </group> </else> </choose> </layout> </bibliography> </style>
{ "pile_set_name": "Github" }
PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX dbp: <http://dbpedia.property/> PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> PREFIX georss: <http://www.georss.org/georss/> SELECT COUNT(?c) { ?s dbo:spouse ?c. FILTER NOT EXISTS {?c a dbo:Person} }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <Workspace version = "1.0"> <FileRef location = "self:Lottie.xcodeproj"> </FileRef> </Workspace>
{ "pile_set_name": "Github" }
/* This file is part of Openrouteservice. * * Openrouteservice is free software; you can redistribute it and/or modify it under the terms of the * GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License along with this library; * if not, see <https://www.gnu.org/licenses/>. */ package org.heigit.ors.routing; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import com.graphhopper.storage.GraphExtension; import org.heigit.ors.common.DistanceUnit; import org.heigit.ors.exceptions.StatusCodeException; import org.heigit.ors.routing.graphhopper.extensions.storages.WarningGraphExtension; import org.heigit.ors.util.DistanceUnitUtil; import org.heigit.ors.util.FormatUtility; public class RouteExtraInfo { private String name; private List<RouteSegmentItem> segments; private double factor = 1.0; private boolean usedForWarnings = false; private WarningGraphExtension warningGraphExtension; public RouteExtraInfo(String name) { this(name, null); } /** * Constructor that can mark the RouteExtraInfo as being able to generate warnings or not * * @param name name of the extra info * @param extension The GraphExtension that is used to generate the extra info. A check is made against this to * see if it is of type {@Link org.heigit.ors.routing.graphhopper.extensions.storages.WarningGraphExtension}. * */ public RouteExtraInfo(String name, GraphExtension extension) { this.name = name; segments = new ArrayList<>(); if(extension instanceof WarningGraphExtension) { warningGraphExtension = (WarningGraphExtension) extension; usedForWarnings = true; } } public String getName() { return name; } public boolean isEmpty() { return segments.isEmpty(); } public void add(RouteSegmentItem item) { segments.add(item); } public List<RouteSegmentItem> getSegments() { return segments; } public List<ExtraSummaryItem> getSummary(DistanceUnit units, double routeDistance, boolean sort) throws StatusCodeException { List<ExtraSummaryItem> summary = new ArrayList<>(); if (!segments.isEmpty()) { Comparator<ExtraSummaryItem> comp = (ExtraSummaryItem a, ExtraSummaryItem b) -> Double.compare(b.getAmount(), a.getAmount()); double totalDist = 0.0; Map<Double, Double> stats = new HashMap<>(); for (RouteSegmentItem seg : segments) { Double scaledValue = seg.getValue()/ factor; Double value = stats.get(scaledValue); if (value == null) stats.put(scaledValue, seg.getDistance()); else { value += seg.getDistance(); stats.put(scaledValue, value); } totalDist += seg.getDistance(); } if (totalDist != 0.0) { int unitDecimals = FormatUtility.getUnitDecimals(units); // Some extras such as steepness might provide inconsistent distance values caused by multiple rounding. // Therefore, we try to scale distance so that their sum equals to the whole distance of a route double distScale = totalDist/routeDistance; for (Map.Entry<Double, Double> entry : stats.entrySet()) { double scaledValue = entry.getValue()/distScale; ExtraSummaryItem esi = new ExtraSummaryItem(entry.getKey(), FormatUtility.roundToDecimals(DistanceUnitUtil.convert(scaledValue, DistanceUnit.METERS, units), unitDecimals), FormatUtility.roundToDecimals(scaledValue * 100.0 / routeDistance, 2) ); summary.add(esi); } if (sort) summary.sort(comp); } } return summary; } public double getFactor() { return factor; } public void setFactor(double factor) { this.factor = factor; } public boolean isUsedForWarnings() { return usedForWarnings; } public WarningGraphExtension getWarningGraphExtension() { return warningGraphExtension; } }
{ "pile_set_name": "Github" }
% Meridian 59, Copyright 1994-2012 Andrew Kirmse and Chris Kirmse. % All rights reserved. % % This software is distributed under a license that is described in % the LICENSE file that accompanies it. % % Meridian is a registered trademark. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Assess is Skill constants: include blakston.khd resources: assess_name_rsc = "assess" assess_icon_rsc = light.bgf assess_desc_rsc = \ "This is a crude and often inaccurate technique used to gauge how good an opponent is in the art of hand-to-hand combat." assess_below_20 = "%s%s is a twig, waiting to be broken." assess_20_30 = "%s%s is an infant of the battlefield." assess_30_40 = "%s%s fights hardly better than a lowly squire." assess_40_50 = "%s%s possesses not talent, but great potential." assess_50_60 = "%s%s has a good sense in the ways of combat." assess_60_70 = "%s%s is firmly competent on the battlefield." assess_70_80 = "%s%s shows the scars of many battles." assess_80_90 = "%s%s is certainly no one to be trifled with." assess_90_100 = "%s%s wins many conflicts without so much as shrugging." assess_100_150 = "%s%s possesses near super-human abilities on the battlefield." assess_150_up = "%s%s could crush you like a bug!" assess_self = "Who? This person? A cinch!" classvars: vrName = assess_name_rsc vrIcon = assess_icon_rsc vrDesc = assess_desc_rsc viSkill_num = SKID_assess vischool = SKS_BRAWLING viSkill_level = 50 properties: piSkillExertion = 5 messages: CanPayCosts(who = $, oTarget = $) { %debug("CanPayCosts in Assess"); if oTarget=who { send(who,@msgsenduser,#message_rsc=assess_self); return FALSE; } if not IsClass(oTarget, &battler) { Send(who, @MsgSendUser, #message_rsc=skill_bad_target, #parm1=vrName,#parm2=Send(otarget,@GetCapDef),#parm3=Send(otarget,@GetName)); return False; } propagate; % Check other things higher up } DoSkill(who = $, oTarget = $) { local dodge, health, slash, strength,agility,totalpower, message; %debug("got to DoSkill in Assess."); if isclass(oTarget,&user) { dodge=send(otarget,@getskillability,#skill_num=SKID_DODGE); health=send(otarget,@getmaxhealth); slash=send(otarget,@getskillability,#skill_num=SKID_SLASH); strength=send(otarget,@getmight); agility=(send(oTarget,@getagility)); totalpower=(dodge+health+slash+strength+agility)/4; } else { totalpower=send(oTarget,@getlevel); } message = $; if totalpower < 20 { message = assess_below_20; } if totalpower > 19 and totalpower < 30 { message = assess_20_30 ; } if totalpower > 29 and totalpower < 40 { message = assess_30_40 ; } if totalpower > 39 and totalpower < 50 { message = assess_40_50 ; } if totalpower > 49 and totalpower < 60 { message = assess_50_60 ; } if totalpower > 59 and totalpower < 70 { message = assess_60_70 ; } if totalpower > 69 and totalpower < 80 { message = assess_70_80 ; } if totalpower > 79 and totalpower < 90 { message = assess_80_90 ; } if totalpower > 89 and totalpower < 100 { message = assess_90_100 ; } if totalpower > 99 and totalpower < 150 { message = assess_100_150 ; } if message = $ { message = assess_150_up ; } Send(who, @MsgSendUser, #message_rsc=message, #parm1=send(oTarget,@getdef),#parm2=send(oTarget,@getname)); propagate; } end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{ "pile_set_name": "Github" }
--- title: "mapatei" date: "2019-09-22" series: conlangs tags: - mapatei - protolang --- # mapatei I've been working on a project in the [Conlang Critic][conlangcritic] Discord with some friends for a while now, and I'd like to summarize what we've been doing and why here. We've been working on creating a constructed language (conlang) with the end goal of each of us going off and evolving it in our own separate ways. Our goal in this project is really to create a microcosm of the natural process of language development. ## Why One of the questions you, as the reader, might be asking is "why?" To which I say "why not?" This is a tool I use to define, explore and challenge my fundamental understanding of reality. I don't expect anything I do with this tool to be useful to anyone other than myself. I just want to create something by throwing things at the wall and seeing what makes sense for _me_. If other people like it or end up benefitting from it I consider that icing on the cake. A language is a surprisingly complicated thing. There's lots of nuance and culture encoded into it, not even counting things like metaphors and double-meanings. Creating my own languages lets me break that complicated thing into its component parts, then use that understanding to help increase my knowledge of natural languages. So, like I mentioned earlier, I've been working on a conlang with some friends, and here's what we've been creating. ## mapatei grammar mapatei is the language spoken by a primitive culture of people we call maparaja (people of the language). It is designed to be very simple to understand, speak and learn. ### Phonology The phonology of mapltapei is simple. It has 5 vowels and 17 consonants. The sounds are written mainly in [International Phonetic Alphabet](https://en.wikipedia.org/wiki/International_Phonetic_Alphabet). #### Vowels The vowels are: | International Phonetic Alphabet | Written as | Description / Bad Transcription for English speakers | | :--- | :--- | :--- | | a | a | unstressed "ah" | | aː | ā | stressed "AH" | | e | e | unstressed "ayy" | | eː | ē | stressed "AYY" | | i | i | unstressed "ee" | | iː | ī | stressed "EE" | | o | o | unstressed "oh" | | oː | ō | stressed "OH" | | u | u | unstressed "ooh" | | uː | ū | stressed "OOH" | The long vowels (anything with the funny looking bar/macron on top of them) also mark for stress, or how "intensely" they are spoken. #### Consonants The consonants are: | International Phonetic Alphabet | Written as | Description / Bad Transcription for English speakers | | :--- | :--- | :--- | | m | m | the m in mother | | n | n | the n in money | | ᵐb | mb | a combination of the m in mother and the b in baker | | ⁿd | nd | as in handle | | ᵑg | ng | as in finger | | p | p | the p in spool | | t | t | the t in stool | | k | k | the k in school | | pʰ | ph | the ph in pool | | tʰ | th | the th in tool | | kʰ | kh | the kh in cool | | ɸ~f | f | the f in father | | s | s | the s in sock | | w | w | the w in water | | l | l | the l in lie | | j | j or y | the y in young | | r~ɾ | r | the r in rhombus | ### Word Structure The structure of words is based on syllables. Syllables are formed of a pair of maybe a consonant and always a vowel. There can be up to two consecutive vowels in a word, but each vowel gets its own syllable. If a word is stressed, it can only ever be stressed on the first syllable. Here are some examples of words and their meanings (the periods in the words mark the barriers between syllables): | mapatei word | Intentional Phonetic Alphabet | Meaning | | :--- | :--- | :--- | | ondoko | o.ⁿdo.ko | pig | | māo | maː.o | cat | | ameme | a.me.me | to kill/murder | | ero | e.ro | can, to be able to | | ngōe | ᵑgoː.e | I/me | | ke | ke | cold | | ku | ku | fast | There are only a few parts of speech: nouns, pronouns, verbs, determiners, numerals, prepositions and interjections. ### Nouns Nouns describe things, people, animals, animate objects (such as plants or body parts) and abstract concepts (such as days). Nouns in mapatei are divided into four classes (this is similar to how languages like French handle the concept of grammatical gender): human, animal, animate and inanimate. Here are some examples of a few nouns, their meaning and their noun class: | mapatei word | International Phonetic Alphabet | Class | Meaning | | :--- | :--- | :--- | :--- | | okha | o.kʰa | human | female human, woman | | awu | a.wu | animal | dog | | fōmbu | (ɸ~f)oː.ᵐbu | animate | name | | ipai | i.pa.i | inanimate | salt | Nouns can also be singular or plural. Plural nouns are marked with the -ja suffix. See some examples: | singular mapatei word | plural mapatei word | International Phonetic Alphabet | Meaning | | :--- | :--- | :--- | :--- | | ra | raja | ra.ja | person / people | | meko | mekoja | me.ko.ja | ant / ants | | kindu | kinduja | kiː.ⁿdu.ja | liver / livers | | fīfo | fīfoja | (ɸ~f)iː.(ɸ~f)o.ja | moon / moons | ### Pronouns Pronouns are nouns that replaces a noun or noun phrase with a special meaning. Examples of pronouns in English are words like I, me, or you. This is to avoid duplication of people's names or the identity of the speaker vs the listener. | Pronouns | singular | plural | Rough English equivalent | | :--- | :--- | :--- | :--- | | 1st person | ngōe | tha | I/me, we | | 2nd person | sīto | khē | you, y'all | | 3rd person human | rā | foli | he/she, they | | 3rd person animal | mi | wāto | they | | 3rd person animate | sa | wāto | they | | 3rd person inanimate | li | wāto | they | ### Verbs Verbs describe actions, existence or occurrence. Verbs in mapatei are conjugated in terms of tense (or when the thing being described has/will happen/ed in relation to saying the sentence) and the number of the subject of the sentence. Verb endings: | Verbs | singular | plural | | :--- | :--- | :--- | | past | -fu | -phi | | present | | -ja | | future | māu $verb | māu $verb-ja | For example, consider the verb ōwo (oː.wo) for to love: | ōwo - to love | singular | plural | | :--- | :--- | :--- | | past | ōwofu | ōwophi | | present | ōwo | ōwoja | | future | māu ōwo | māu ōwoja | ### Determiners Determiners are words that can function both as adjectives and adverbs in English do. A determiner gives more detail or context about a noun/verb. Determiners follow the things they describe, like French or Toki Pona. Determiners must agree with the noun they are describing in class and number. | Determiners | singular | plural | | :--- | :--- | :--- | | human | -ra | -fo | | animal | -mi | -wa | | animate | -sa | -to | | inanimate | -li | -wato | See these examples: a big human: ra sura moving cats: māoja wuwa a short name: fōmbu uwiisa long days: lundoseja khāngandiwato Also consider the declensions for uri (u.ri), or dull | uri | singular | plural | | :--- | :--- | :--- | | human | urira | urifo | | animal | urimi | uriwa | | animate | urisa | urito | | inanimate | urili | uriwato | ### Numerals There are two kinds of numerals in mapltatei, cardinal (counting) and ordinal (ordering) numbers. Numerals are always in [seximal](<https://www.seximal.net>). | cardinal (base 6) | mapatei | | :--- | :--- | | 0 | fangu | | 1 | āre | | 2 | mawo | | 3 | piru | | 4 | kīfe | | 5 | tamu | | 10 | rupe | | 11 | rupe jo āre | | 12 | rupe jo mawo | | 13 | rupe jo piru | | 14 | rupe jo kīfe | | 15 | rupe jo tamu | | 20 | mawo rupe | | 30 | piru rupe | | 40 | kīfe rupe | | 50 | tamu rupe | | 100 | theli | Ordinal numbers are formed by reduplicating (or copying) the first syllable of cardinal numbers and decline similarly for case. Remember that only the first syllable can be stressed, so any reduplicated syllable must become unstressed. | ordinal (base 6) | mapatei | | :--- | :--- | | 0th | fangufa | | 1st | ārea | | 2nd | mawoma | | 3rd | pirupi | | 4th | kīfeki | | 5th | tamuta | | 10th | ruperu | | 11th | ruperu jo ārea | | 12th | ruperu jo mawoma | | 13th | ruperu jo pirupi | | 14th | ruperu jo kīfeki | | 15th | ruperu jo tamuki | | 20th | mawoma ruperu | | 30th | pirupi ruperu | | 40th | kīfeki ruperu | | 50th | tamuta ruperu | | 100th | thelithe | Cardinal numbers are optionally declined for case when used as determiners with the following rules: | Numeral Class | suffix | | :--- | :--- | | human | -ra | | animal | -mi | | animate | -sa | | inanimate | -li | Numeral declension always happens last, so the inanimate nifth (seximal 100 or decimal 36) is thelitheli. Here's a few examples: three pigs: ondoko pirumi the second person: ra mawomara one tree: kho āremi the nifth day: lundose thelitheli ### Prepositions Prepositions mark any other details about a sentence. In essence, they add information to verbs that would otherwise lack that information. fa: with, adds an auxiliary possession to a sentence ri: possession, sometimes indicates ownership I eat with my wife: wā ngōe fa epi ri ngōe ngi: the following phrase is on top of the thing being described ka: then (effect) ēsa: if/whether If I set this dog on the rock, then the house is good: ēsa adunga ngōe pā āwu ngi, ka iri sare eserili ### Interjections Interjections have the following meanings: Usually they act like vocatives and have free word order. As a determiner they change meta-properties about the noun/verb like negation. wo: no, not | English | mapatei | | :--- | :--- | | No! Don't eat that! | wo! wā wo ūto | | I don't eat ants | wā wo ngōe mekoja | ### Word Order mapltapei has a VSO word order for sentences. This means that the verb comes first, followed by the subject, and then the object. | English | mapatei | gloss | | :--- | :--- | :--- | | the/a child runs | kepheku rako | kepheku.VERB rako.NOUN.human | | The child gave the fish a flower | indofu rako ora āsu | indo.VERB.past rako.NOUN.human ora.NOUN.animal āsu.NOUN.animate | | I love you | ōwo ngōe sīto | ōwo.VERB ngōe.PRN sīto.PRN | | I do not want to eat right now | wā wo ngōe oko mbeli | wā.VERB wo.INTERJ ngōe.PRN oko.PREP mbeli.DET.singular.inanimate | | I have a lot of love, and I'm happy about it | urii ngōe erua fomboewato, jo iri ngōe phajera lo li | urii.VERB ngōe.PRN eruaja.NOUN.plural.inanimate fomboewato.DET.plural.inanimate, jo.CONJ iri.VERB ngōe.PRN phajera.DET.singular.human lo.PREP li.PRN | | The tree I saw yesterday is gone now | pōkhufu kho ngōe, oko iri māndosa mbe | pōkhu.VERB.past kho.NOUN.animate ngōe.PRM, oko.PREP iri.VERB māndo.DET.animate mbe.PRN | ## Code As I mentioned earlier, I've been working on some code [here](<https://github.com/Xe/mapatei/tree/master/src/mapatei>) to handle things like making sure words are valid. This includes a word validator which I am very happy with. Words are made up of syllables, which are made up of letters. In code: ``` type   Letter* = object of RootObj     case isVowel*: bool     of true:       stressed*: bool     of false: discard     value*: string   Syllable* = object of RootObj     consonant*: Option[Letter]     vowel*: Letter     stressed*: bool   Word* = ref object     syllables*: seq[Syllable] ``` Letters are parsed out of strings using [this code](<https://github.com/Xe/mapatei/blob/92a429fa9a509af5df5b55810bda03061f21475c/src/mapatei/letters.nim#L35-L89>). It's an interator, so users have to manually loop over it: ``` import unittest import mapatei/letters let words = ["pirumi", "kho", "lundose", "thelitheli", "fōmbu"] suite "Letter":   for word in words:     test word:       for l in word.letters:        discard l ``` This test loops over the given words (taken from the dictionary and enlightening test cases) and makes sure that letters can be parsed out of them. Next, syllables are made out of letters, so syllables are parsed using a [finite state machine](<https://en.wikipedia.org/wiki/Finite-state_machine>) with the following transition rules: | Present state | Next state for vowel | Next state for consonant | Next state for end of input | | :--- | :--- | :--- | :--- | | Init | Vowel/stressed | Consonant | Illegal | | Consonant | Vowel/stressed | End | Illegal | | Vowel | End | End | End | Some other hacking was done [in the code](<https://github.com/Xe/mapatei/blob/92a429fa9a509af5df5b55810bda03061f21475c/src/mapatei/syllable.nim#L36-L76>), but otherwise it is a fairly literal translation of that truth table. And finally we can check to make sure that each word only has a head-initial stressed syllable: ``` type InvalidWord* = object of Exception proc parse*(word: string): Word =   var first = true   result = Word()   for syll in word.syllables:     if not first and syll.stressed:       raise newException(InvalidWord, "cannot have a stressed syllable here")     if first:       first = false     result.syllables.add syll ``` And that's enough to validate every word in the [dictionary](<https://docs.google.com/spreadsheets/d/1HSGS8J8IsRzU0e8hyujGO5489CMzmHPZSBbNCtOJUAg>). Future extensions will include automatic conjugation/declension as well as going from a stream of words to an understanding of sentences. ## Useful Resources Used During This Creating a language from scratch is surprisingly hard work. These resources helped me a lot though. - [Polyglot](https://draquet.github.io/PolyGlot/) to help with dictionary management - [Awkwords](http://akana.conlang.org/tools/awkwords/) to help with word creation - These lists of core concepts: [list 1](https://forum.duolingo.com/comment/4571123) and [list 2](https://forum.duolingo.com/comment/4664475) - The conlang critic [discord](https://discord.gg/AxEmeDa) --- Thanks for reading this! I hope this blogpost helps to kick off mapatei development into unique and more fleshed out derivative conlangs. Have fun! Special thanks to jan Misali for encouraging this to happen. [conlangcritic]: https://www.youtube.com/user/HBMmaster8472
{ "pile_set_name": "Github" }
// generator: babel-node // xfail: generator support isn't 100% // "yield *, iterator closing" from kangax function __createIterableObject(a, b, c) { var arr = [a, b, c, ,]; var iterable = { next: function() { return { value: arr.shift(), done: arr.length <= 0 }; } }; iterable[Symbol.iterator] = function(){ return iterable; }; return iterable; } var closed = ''; var iter = __createIterableObject(1, 2, 3); iter['return'] = function(){ closed += 'a'; return {done: true}; } var gen = (function* generator(){ try { yield *iter; } finally { closed += 'b'; } })(); gen.next(); gen['return'](); console.log(closed === 'ab');
{ "pile_set_name": "Github" }
require_relative '../../spec_helper' describe "Random::DEFAULT" do it "returns a Random instance" do Random::DEFAULT.should be_an_instance_of(Random) end it "changes seed on reboot" do seed1 = ruby_exe('p Random::DEFAULT.seed', options: '--disable-gems') seed2 = ruby_exe('p Random::DEFAULT.seed', options: '--disable-gems') seed1.should != seed2 end end
{ "pile_set_name": "Github" }
package sf.week6; import java.util.ArrayList; import java.util.List; /** * Created by LynnSun on 2019/11/23. * https://leetcode-cn.com/problems/n-queens/solution/javahui-su-fa-si-lu-jian-dan-qing-xi-qing-kan-dai-/ */ public class NQueensOtherMethod { // 思路清晰借鉴一下 List<List<String>> lists = new ArrayList<>();//返回集合 List<String> ans = new ArrayList<>();//n皇后的解 public List<List<String>> solveNQueens(int n) { StringBuilder sb = new StringBuilder(); for(int i = 0; i < n; i++){//...... sb.append("."); } //列的大小为n,主对角线和次对角线的大小为2n-1 queens(n, new boolean[n], new boolean[2 * n - 1], new boolean[2 * n - 1], sb,0); return lists; } void queens(int n,boolean[] y,boolean[] w,boolean[] wc,StringBuilder sb,int i){ if(ans.size() == n){//递归结束条件,即n皇后已放置所有的行中 lists.add(new ArrayList<>(ans)); return; } for(int j = 0; j < n; j++){ //判断当前位置是否可用,即列、主对角线、次对角线是否被使用 if(y[j] || w[n - 1 - i + j] || wc[i + j]) continue; //如果可用,先标记该列、主对角线、次对角线已被使用 y[j] = true; w[n - 1 - i + j] = true; wc[i + j] = true; ans.add(new StringBuilder(sb).replace(j,j+1,"Q").toString()); //递归下一行是否可以放置皇后,直到所有皇后都放到对应的位置或者该行无法放置皇后则结束 queens(n,y,w,wc,sb,i+1); //递归完成之后,恢复现场 ans.remove(i); y[j] = false; wc[i + j] = false; w[n - 1 - i + j] = false; } } }
{ "pile_set_name": "Github" }
# Table of Contents * [Java中的锁机制及Lock类](#java中的锁机制及lock类) * [锁的释放-获取建立的happens before 关系](#锁的释放-获取建立的happens-before-关系) * [锁释放和获取的内存语义](#锁释放和获取的内存语义) * [锁内存语义的实现](#锁内存语义的实现) * [LOCK_IF_MP(mp) __asm cmp mp, 0 \](#lock_if_mpmp-__asm-cmp-mp-0--) * [concurrent包的实现](#concurrent包的实现) * [synchronized实现原理](#synchronized实现原理) * [****1、实现原理****](#1、实现原理) * [**2、Java对象头**](#2、java对象头) * [**3、Monitor**](#3、monitor) * [**4、锁优化**](#4、锁优化) * [**5、自旋锁**](#5、自旋锁) * [**6、适应自旋锁**](#6、适应自旋锁) * [**7、锁消除**](#7、锁消除) * [**8、锁粗化**](#8、锁粗化) * [**9、轻量级锁**](#9、轻量级锁) * [**10、偏向锁**](#10、偏向锁) * [**11、重量级锁**](#11、重量级锁) * [参考资料](#参考资料) **本文转载自并发编程网,侵删** 本系列文章将整理到我在GitHub上的《Java面试指南》仓库,更多精彩内容请到我的仓库里查看 > https://github.com/h2pl/Java-Tutorial 喜欢的话麻烦点下Star哈 文章同步发于我的个人博客: > www.how2playlife.com 本文是微信公众号【Java技术江湖】的《Java并发指南》其中一篇,本文大部分内容来源于网络,为了把本文主题讲得清晰透彻,也整合了很多我认为不错的技术博客内容,引用其中了一些比较好的博客文章,如有侵权,请联系作者。 该系列博文会告诉你如何全面深入地学习Java并发技术,从Java多线程基础,再到并发编程的基础知识,从Java并发包的入门和实战,再到JUC的源码剖析,一步步地学习Java并发编程,并上手进行实战,以便让你更完整地了解整个Java并发编程知识体系,形成自己的知识框架。 为了更好地总结和检验你的学习成果,本系列文章也会提供一些对应的面试题以及参考答案。 如果对本系列文章有什么建议,或者是有什么疑问的话,也可以关注公众号【Java技术江湖】联系作者,欢迎你参与本系列博文的创作和修订。 <!--more --> ## Java中的锁机制及Lock类 ### 锁的释放-获取建立的happens before 关系 锁是java并发编程中最重要的同步机制。锁除了让临界区互斥执行外,还可以让释放锁的线程向获取同一个锁的线程发送消息。 下面是锁释放-获取的示例代码: class MonitorExample { int a = 0; public synchronized void writer() { //1 a++; //2 } //3 public synchronized void reader() { //4 int i = a; //5 …… } //6 } 根据程序次序规则,1 happens before 2, 2 happens before 3; 4 happens before 5, 5 happens before 6。假设线程A执行writer()方法,随后线程B执行reader()方法。根据happens before规则,这个过程包含的happens before 关系可以分为两类: 1. 根据监视器锁规则,3 happens before 4。 2. 根据happens before 的传递性,2 happens before 5。 上述happens before 关系的图形化表现形式如下: ![](http://blog.itpub.net/ueditor/php/upload/image/20190811/1565506398748401.png) 在上图中,每一个箭头链接的两个节点,代表了一个happens before 关系。黑色箭头表示程序顺序规则;橙色箭头表示监视器锁规则;蓝色箭头表示组合这些规则后提供的happens before保证。 上图表示在线程A释放了锁之后,随后线程B获取同一个锁。在上图中,2 happens before 5。因此,线程A在释放锁之前所有可见的共享变量,在线程B获取同一个锁之后,将立刻变得对B线程可见。 ### 锁释放和获取的内存语义 当线程释放锁时,JMM会把该线程对应的本地内存中的共享变量刷新到主内存中。以上面的MonitorExample程序为例,A线程释放锁后,共享数据的状态示意图如下: ![](http://blog.itpub.net/ueditor/php/upload/image/20190811/1565506402638665.png) 当线程获取锁时,JMM会把该线程对应的本地内存置为无效。从而使得被监视器保护的临界区代码必须要从主内存中去读取共享变量。下面是锁获取的状态示意图: ![](http://blog.itpub.net/ueditor/php/upload/image/20190811/1565506405253375.png) 对比锁释放-获取的内存语义与volatile写-读的内存语义,可以看出:锁释放与volatile写有相同的内存语义;锁获取与volatile读有相同的内存语义。 下面对锁释放和锁获取的内存语义做个总结: * 线程A释放一个锁,实质上是线程A向接下来将要获取这个锁的某个线程发出了(线程A对共享变量所做修改的)消息。 * 线程B获取一个锁,实质上是线程B接收了之前某个线程发出的(在释放这个锁之前对共享变量所做修改的)消息。 * 线程A释放锁,随后线程B获取这个锁,这个过程实质上是线程A通过主内存向线程B发送消息。 ### 锁内存语义的实现 本文将借助ReentrantLock的源代码,来分析锁内存语义的具体实现机制。 请看下面的示例代码: class ReentrantLockExample { int a = 0; ReentrantLock lock = new ReentrantLock(); public void writer() { lock.lock(); //获取锁 try { a++; } finally { lock.unlock(); //释放锁 } } public void reader () { lock.lock(); //获取锁 try { int i = a; …… } finally { lock.unlock(); //释放锁 } } } 在ReentrantLock中,调用lock()方法获取锁;调用unlock()方法释放锁。 ReentrantLock的实现依赖于java同步器框架AbstractQueuedSynchronizer(本文简称之为AQS)。AQS使用一个整型的volatile变量(命名为state)来维护同步状态,马上我们会看到,这个volatile变量是ReentrantLock内存语义实现的关键。 下面是ReentrantLock的类图(仅画出与本文相关的部分): ![](http://blog.itpub.net/ueditor/php/upload/image/20190811/1565506414141304.png) ReentrantLock分为公平锁和非公平锁,我们首先分析公平锁。 使用公平锁时,加锁方法lock()的方法调用轨迹如下: 1. ReentrantLock : lock() 2. FairSync : lock() 3. AbstractQueuedSynchronizer : acquire(int arg) 4. ReentrantLock : tryAcquire(int acquires) 在第4步真正开始加锁,下面是该方法的源代码: protected final boolean tryAcquire(int acquires) { final Thread current = Thread.currentThread(); int c = getState(); //获取锁的开始,首先读volatile变量state if (c == 0) { if (isFirst(current) && compareAndSetState(0, acquires)) { setExclusiveOwnerThread(current); return true; } } else if (current == getExclusiveOwnerThread()) { int nextc = c + acquires; if (nextc < 0) throw new Error("Maximum lock count exceeded"); setState(nextc); return true; } return false; } 从上面源代码中我们可以看出,加锁方法首先读volatile变量state。 在使用公平锁时,解锁方法unlock()的方法调用轨迹如下: 1. ReentrantLock : unlock() 2. AbstractQueuedSynchronizer : release(int arg) 3. Sync : tryRelease(int releases) 在第3步真正开始释放锁,下面是该方法的源代码: protected final boolean tryRelease(int releases) { int c = getState() - releases; if (Thread.currentThread() != getExclusiveOwnerThread()) throw new IllegalMonitorStateException(); boolean free = false; if (c == 0) { free = true; setExclusiveOwnerThread(null); } setState(c); //释放锁的最后,写volatile变量state return free; } 从上面的源代码我们可以看出,在释放锁的最后写volatile变量state。 公平锁在释放锁的最后写volatile变量state;在获取锁时首先读这个volatile变量。根据volatile的happens-before规则,释放锁的线程在写volatile变量之前可见的共享变量,在获取锁的线程读取同一个volatile变量后将立即变的对获取锁的线程可见。 现在我们分析非公平锁的内存语义的实现。 非公平锁的释放和公平锁完全一样,所以这里仅仅分析非公平锁的获取。 使用公平锁时,加锁方法lock()的方法调用轨迹如下: 1. ReentrantLock : lock() 2. NonfairSync : lock() 3. AbstractQueuedSynchronizer : compareAndSetState(int expect, int update) 在第3步真正开始加锁,下面是该方法的源代码: <pre name="code">protected final boolean compareAndSetState(int expect, int update) {return unsafe.compareAndSwapInt(this, stateOffset, expect, update);}</pre> 该方法以原子操作的方式更新state变量,本文把java的compareAndSet()方法调用简称为CAS。JDK文档对该方法的说明如下:如果当前状态值等于预期值,则以原子方式将同步状态设置为给定的更新值。此操作具有 volatile 读和写的内存语义。 这里我们分别从编译器和处理器的角度来分析,CAS如何同时具有volatile读和volatile写的内存语义。 前文我们提到过,编译器不会对volatile读与volatile读后面的任意内存操作重排序;编译器不会对volatile写与volatile写前面的任意内存操作重排序。组合这两个条件,意味着为了同时实现volatile读和volatile写的内存语义,编译器不能对CAS与CAS前面和后面的任意内存操作重排序。 下面我们来分析在常见的intel x86处理器中,CAS是如何同时具有volatile读和volatile写的内存语义的。 下面是sun.misc.Unsafe类的compareAndSwapInt()方法的源代码: protected final boolean compareAndSetState(int expect, int update) { return unsafe.compareAndSwapInt(this, stateOffset, expect, update); } 可以看到这是个本地方法调用。这个本地方法在openjdk中依次调用的c++代码为:unsafe.cpp,atomic.cpp和atomicwindowsx86.inline.hpp。这个本地方法的最终实现在openjdk的如下位置:openjdk-7-fcs-src-b147-27jun2011\openjdk\hotspot\src\oscpu\windowsx86\vm\ atomicwindowsx86.inline.hpp(对应于windows操作系统,X86处理器)。下面是对应于intel x86处理器的源代码的片段: // Adding a lock prefix to an instruction on MP machine // VC++ doesn't like the lock prefix to be on a single line // so we can't insert a label after the lock prefix. // By emitting a lock prefix, we can define a label after it. #define LOCK_IF_MP(mp) __asm cmp mp, 0 \ __asm je L0 \ __asm _emit 0xF0 \ __asm L0: inline jint Atomic::cmpxchg (jint exchange_value, volatile jint* dest, jint compare_value) { // alternative for InterlockedCompareExchange int mp = os::is_MP(); __asm { mov edx, dest mov ecx, exchange_value mov eax, compare_value LOCK_IF_MP(mp) cmpxchg dword ptr [edx], ecx } } 如上面源代码所示,程序会根据当前处理器的类型来决定是否为cmpxchg指令添加lock前缀。如果程序是在多处理器上运行,就为cmpxchg指令加上lock前缀(lock cmpxchg)。反之,如果程序是在单处理器上运行,就省略lock前缀(单处理器自身会维护单处理器内的顺序一致性,不需要lock前缀提供的内存屏障效果)。 intel的手册对lock前缀的说明如下: 1. 确保对内存的读-改-写操作原子执行。在Pentium及Pentium之前的处理器中,带有lock前缀的指令在执行期间会锁住总线,使得其他处理器暂时无法通过总线访问内存。很显然,这会带来昂贵的开销。 2. 从Pentium 4,Intel Xeon及P6处理器开始,intel在原有总线锁的基础上做了一个很有意义的优化:如果要访问的内存区域(area of memory)在lock前缀指令执行期间已经在处理器内部的缓存中被锁定(即包含该内存区域的缓存行当前处于独占或以修改状态),并且该内存区域被完全包含在单个缓存行(cache line)中,那么处理器将直接执行该指令。 3. 由于在指令执行期间该缓存行会一直被锁定,其它处理器无法读/写该指令要访问的内存区域,因此能保证指令执行的原子性。这个操作过程叫做缓存锁定(cache locking),缓存锁定将大大降低lock前缀指令的执行开销,但是当多处理器之间的竞争程度很高或者指令访问的内存地址未对齐时,仍然会锁住总线。 4. 禁止该指令与之前和之后的读和写指令重排序。 5. 把写缓冲区中的所有数据刷新到内存中。 上面的第2点和第3点所具有的内存屏障效果,足以同时实现volatile读和volatile写的内存语义。 经过上面的这些分析,现在我们终于能明白为什么JDK文档说CAS同时具有volatile读和volatile写的内存语义了。 现在对公平锁和非公平锁的内存语义做个总结: * 公平锁和非公平锁释放时,最后都要写一个volatile变量state。 * 公平锁获取时,首先会去读这个volatile变量。 * 非公平锁获取时,首先会用CAS更新这个volatile变量,这个操作同时具有volatile读和volatile写的内存语义。 从本文对ReentrantLock的分析可以看出,锁释放-获取的内存语义的实现至少有下面两种方式: 1. 利用volatile变量的写-读所具有的内存语义。 2. 利用CAS所附带的volatile读和volatile写的内存语义。 ## concurrent包的实现 由于java的CAS同时具有 volatile 读和volatile写的内存语义,因此Java线程之间的通信现在有了下面四种方式: 1. A线程写volatile变量,随后B线程读这个volatile变量。 2. A线程写volatile变量,随后B线程用CAS更新这个volatile变量。 3. A线程用CAS更新一个volatile变量,随后B线程用CAS更新这个volatile变量。 4. A线程用CAS更新一个volatile变量,随后B线程读这个volatile变量。 Java的CAS会使用现代处理器上提供的高效机器级别原子指令,这些原子指令以原子方式对内存执行读-改-写操作,这是在多处理器中实现同步的关键(从本质上来说,能够支持原子性读-改-写指令的计算机器,是顺序计算图灵机的异步等价机器,因此任何现代的多处理器都会去支持某种能对内存执行原子性读-改-写操作的原子指令)。同时,volatile变量的读/写和CAS可以实现线程之间的通信。把这些特性整合在一起,就形成了整个concurrent包得以实现的基石。如果我们仔细分析concurrent包的源代码实现,会发现一个通用化的实现模式: 1. 首先,声明共享变量为volatile; 2. 然后,使用CAS的原子条件更新来实现线程之间的同步; 3. 同时,配合以volatile的读/写和CAS所具有的volatile读和写的内存语义来实现线程之间的通信。 AQS,非阻塞数据结构和原子变量类(java.util.concurrent.atomic包中的类),这些concurrent包中的基础类都是使用这种模式来实现的,而concurrent包中的高层类又是依赖于这些基础类来实现的。从整体来看,concurrent包的实现示意图如下: ![](http://blog.itpub.net/ueditor/php/upload/image/20190811/1565506416227137.png) ## synchronized实现原理 转自:https://blog.csdn.net/chenssy/article/details/54883355 记得刚刚开始学习Java的时候,一遇到多线程情况就是synchronized。对于当时的我们来说,synchronized是如此的神奇且强大。我们赋予它一个名字“同步”,也成为我们解决多线程情况的良药,百试不爽。但是,随着学习的深入,我们知道synchronized是一个重量级锁,相对于Lock,它会显得那么笨重,以至于我们认为它不是那么的高效,并慢慢抛弃它。    诚然,随着Javs SE 1.6对synchronized进行各种优化后,synchronized不会显得那么重。    下面跟随LZ一起来探索**synchronized的实现机制、Java是如何对它进行了优化、锁优化机制、锁的存储结构和升级过程。** ### ****1、实现原理****    synchronized可以保证方法或者代码块在运行时,同一时刻只有一个方法可以进入到临界区,同时它还可以保证共享变量的内存可见性。 Java中每一个对象都可以作为锁,这是synchronized实现同步的基础: 1. **普通同步方法,锁是当前实例对象;** 2. **静态同步方法,锁是当前类的class对象;** 3. **同步方法块,锁是括号里面的对象。**   当一个线程访问同步代码块时,它首先是需要得到锁才能执行同步代码,**当退出或者抛出异常时必须要释放锁,那么它是如何来实现这个机制的呢?**  我们先看一段简单的代码: <pre>public class SynchronizedTest{ public synchronized void test1(){   } public void test2(){     synchronized(this){ } } }</pre> **利用Javap工具查看生成的class文件信息来分析Synchronize的实现:** ![](https://images2018.cnblogs.com/blog/1169376/201807/1169376-20180726111452385-496687429.png)   从上面可以看出,同步代码块是使用monitorenter和monitorexit指令实现的,同步方法(在这看不出来需要看JVM底层实现)依靠的是方法修饰符上的ACCSYNCHRONIZED实现。 **同步代码块:**   monitorenter指令插入到同步代码块的开始位置,monitorexit指令插入到同步代码块的结束位置,JVM需要保证每一个monitorenter都有一个monitorexit与之相对应。任何对象都有一个monitor与之相关联,当且一个monitor被持有之后,他将处于锁定状态。线程执行到monitorenter指令时,将会尝试获取对象所对应的monitor所有权,即尝试获取对象的锁; **同步方法**   synchronized方法则会被翻译成普通的方法调用和返回指令如:invokevirtual、areturn指令,在VM字节码层面并没有任何特别的指令来实现被synchronized修饰的方法,而是在Class文件的方法表中将该方法的**accessflags字段中的synchronized标志位置1**,表示该方法是同步方法并使用调用该方法的对象或该方法所属的Class在JVM的内部对象表示Klass做为锁对象。 (摘自:http://www.cnblogs.com/javaminer/p/3889023.html) 下面我们来继续分析,但是在深入之前我们需要了解两个重要的概念:**Java对象头、Monitor。**  **Java对象头、monitor:Java对象头和monitor是实现synchronized的基础!下面就这两个概念来做详细介绍。** ### **2、Java对象头** synchronized用的锁是存在Java对象头里的,那么什么是Java对象头呢? Hotspot虚拟机的对象头主要包括两部分数据:**Mark Word(标记字段)、Klass Pointer(类型指针)**。其中**Klass Point是是对象指向它的类元数据的指针**,虚拟机通过这个指针来确定这个对象是哪个类的实例,**Mark Word用于存储对象自身的运行时数据,它是实现轻量级锁和偏向锁的关键。** 所以下面将重点阐述。 * **Mark Word** Mark Word用于存储对象自身的运行时数据,如哈希码(HashCode)、GC分代年龄、锁状态标志、线程持有的锁、偏向线程 ID、偏向时间戳等等。Java对象头一般占有两个机器码(在32位虚拟机中,1个机器码等于4字节,也就是32bit),但是如果对象是数组类型,则需要三个机器码,因为JVM虚拟机可以通过Java对象的元数据信息确定Java对象的大小,但是无法从数组的元数据来确认数组的大小,所以用一块来记录数组长度。   下图是Java对象头的存储结构(32位虚拟机):   ![](https://images2018.cnblogs.com/blog/1169376/201807/1169376-20180726111729662-408733474.png)   对象头信息是与对象自身定义的数据无关的额外存储成本,但是考虑到虚拟机的空间效率,Mark Word被设计成一个非固定的数据结构以便在极小的空间内存存储尽量多的数据,它会根据对象的状态复用自己的存储空间,也就是说,Mark Word会随着程序的运行发生变化,变化状态如下(32位虚拟机): ![](https://images2018.cnblogs.com/blog/1169376/201807/1169376-20180726111757632-1279497345.png) 简单介绍了Java对象头,我们下面再看Monitor。 ### **3、Monitor** 什么是Monitor?   我们可以把它理解为一个同步工具,也可以描述为一种同步机制,它通常被描述为一个对象。    与一切皆对象一样,所有的Java对象是天生的Monitor,**每一个Java对象都有成为Monitor的潜质**,因为在Java的设计中 ,每一个Java对象自打娘胎里出来**就带了一把看不见的锁,它叫做内部锁或者Monitor锁**。    Monitor 是线程私有的数据结构,每一个线程都有一个可用monitor record列表,同时还有一个全局的可用列表。每一个被锁住的对象都会和一个monitor关联(对象头的MarkWord中的LockWord指向monitor的起始地址),**同时monitor中有一个Owner字段存放拥有该锁的线程的唯一标识,表示该锁被这个线程占用**。   其结构如下:  ![](https://images2018.cnblogs.com/blog/1169376/201807/1169376-20180726111912718-1995783204.png) * **Owner:**初始时为NULL表示当前没有任何线程拥有该monitor record,当线程成功拥有该锁后保存线程唯一标识,当锁被释放时又设置为NULL。 * **EntryQ:**关联一个系统互斥锁(semaphore),阻塞所有试图锁住monitor record失败的线程。 * **RcThis:**表示blocked或waiting在该monitor record上的所有线程的个数。 * **Nest:**用来实现重入锁的计数。HashCode:保存从对象头拷贝过来的HashCode值(可能还包含GC age)。 * **Candidate:用来避免不必要的阻塞或等待线程唤醒**,因为每一次只有一个线程能够成功拥有锁,如果每次前一个释放锁的线程唤醒所有正在阻塞或等待的线程,会引起不必要的上下文切换(从阻塞到就绪然后因为竞争锁失败又被阻塞)从而导致性能严重下降。 Candidate只有两种可能的值0表示没有需要唤醒的线程1表示要唤醒一个继任线程来竞争锁。 我们知道synchronized是重量级锁,效率不怎么滴,同时这个观念也一直存在我们脑海里,不过在**JDK 1.6中对synchronize的实现进行了各种优化,使得它显得不是那么重了,那么JVM采用了那些优化手段呢?** ### **4、锁优化**   JDK1.6对锁的实现引入了大量的优化,如自旋锁、适应性自旋锁、锁消除、锁粗化、偏向锁、轻量级锁等技术来减少锁操作的开销。  **  锁主要存在四中状态,依次是:无锁状态、偏向锁状态、轻量级锁状态、重量级锁状态。**他们会随着竞争的激烈而逐渐升级。注意锁可以升级不可降级,这种策略是为了提高获得锁和释放锁的效率。 ### **5、自旋锁**   线程的阻塞和唤醒需要CPU从用户态转为核心态,频繁的阻塞和唤醒对CPU来说是一件负担很重的工作,势必会给系统的并发性能带来很大的压力。同时我们发现在许多应用上面,**对象锁的锁状态只会持续很短一段时间**,**为了这一段很短的时间频繁地阻塞和唤醒线程**是非常不值得的。 所以引入自旋锁。  何谓自旋锁? **  所谓自旋锁,就是让该线程等待一段时间,不会被立即挂起(就是不让前来获取该锁(已被占用)的线程立即阻塞),看持有锁的线程是否会很快释放锁。** **怎么等待呢?** 执行一段无意义的循环即可(自旋)。   自旋等待不能替代阻塞,先不说对处理器数量的要求(多核,貌似现在没有单核的处理器了),虽然它可以避免线程切换带来的开销,但是它占用了处理器的时间。如果持有锁的线程很快就释放了锁,那么自旋的效率就非常好;反之,自旋的线程就会白白消耗掉处理的资源,它不会做任何有意义的工作,典型的占着茅坑不拉屎,这样反而会带来性能上的浪费。   所以说,自旋等待的时间(自旋的次数)必须要有一个限度,如果自旋超过了定义的时间仍然没有获取到锁,则应该被挂起。自旋锁在JDK 1.4.2中引入,默认关闭,但是可以使用-XX:+UseSpinning开开启,在JDK1.6中默认开启。同时自旋的默认次数为10次,可以通过参数-XX:PreBlockSpin来调整。   如果通过参数-XX:preBlockSpin来调整自旋锁的自旋次数,会带来诸多不便。假如我将参数调整为10,但是系统很多线程都是等你刚刚退出的时候就释放了锁(假如你多自旋一两次就可以获取锁),你是不是很尴尬?于是JDK1.6引入自适应的自旋锁,让虚拟机会变得越来越聪明。 ### **6、适应自旋锁**   JDK 1.6引入了更加聪明的自旋锁,即自适应自旋锁。所谓自适应就意味着自旋的次数不再是固定的,它是由前一次在同一个锁上的自旋时间及锁的拥有者的状态来决定。   它怎么做呢?   线程如果自旋成功了,那么下次自旋的次数会更加多,因为虚拟机认为既然上次成功了,那么此次自旋也很有可能会再次成功,那么它就会允许自旋等待持续的次数更多。反之,如果对于某个锁,很少有自旋能够成功的,那么在以后要或者这个锁的时候自旋的次数会减少甚至省略掉自旋过程,以免浪费处理器资源。**有了自适应自旋锁,随着程序运行和性能监控信息的不断完善,虚拟机对程序锁的状况预测会越来越准确,虚拟机会变得越来越聪明。**  ### **7、锁消除**   为了保证数据的完整性,我们在进行操作时需要对这部分操作进行同步控制,但是在有些情况下,JVM检测到不可能存在共享数据竞争,这是JVM会对这些同步锁进行锁消除。锁消除的依据是逃逸分析的数据支持。  **  如果不存在竞争,为什么还需要加锁呢?**   所以锁消除可以节省毫无意义的请求锁的时间。变量是否逃逸,对于虚拟机来说需要使用数据流分析来确定,但是对于我们程序员来说这还不清楚么?我们会在明明知道不存在数据竞争的代码块前加上同步吗?但是有时候程序并不是我们所想的那样?   我们虽然没有显示使用锁,但是我们在使用一些JDK的内置API时,如StringBuffer、Vector、HashTable等,这个时候会存在隐形的加锁操作。 **  比如StringBuffer的append()方法,Vector的add()方法:** <pre>public void vectorTest(){ Vector<String> vector = new Vector<String>(); for(int i = 0 ; i < 10 ; i++){ vector.add(i + ""); } System.out.println(vector); }</pre> 在运行这段代码时,JVM可以明显检测到变量vector没有逃逸出方法vectorTest()之外,所以JVM可以大胆地将vector内部的加锁操作消除。 ### **8、锁粗化**   我们知道在使用同步锁的时候,需要让同步块的作用范围尽可能小,仅在共享数据的实际作用域中才进行同步。这样做的目的是为了使需要同步的操作数量尽可能缩小,如果存在锁竞争,那么等待锁的线程也能尽快拿到锁。    在大多数的情况下,上述观点是正确的,LZ也一直坚持着这个观点。但是如果一系列的连续加锁解锁操作,可能会导致不必要的性能损耗,所以引入锁粗化的概念。    **那什么是锁粗化?** **就是将多个连续的加锁、解锁操作连接在一起,扩展成一个范围更大的锁。**   **如上面实例:vector每次add的时候都需要加锁操作,JVM检测到对同一个对象(vector)连续加锁、解锁操作,会合并一个更大范围的加锁、解锁操作,即加锁解锁操作会移到for循环之外。** ### **9、轻量级锁**   引入轻量级锁的主要目的是在多没有多线程竞争的前提下,**减少传统的重量级锁使用操作系统互斥量产生的性能消耗**。 **当关闭偏向锁功能或者多个线程竞争偏向锁导致偏向锁升级为轻量级锁,则会尝试获取轻量级锁,其步骤如下:****获取锁。** 1. 判断当前对象是否处于无锁状态(hashcode、0、01),若是,则JVM首先将在当前线程的栈帧中建立一个名为锁记录(Lock Record)的空间,用于存储锁对象目前的Mark Word的拷贝(官方把这份拷贝加了一个Displaced前缀,即Displaced Mark Word);否则执行步骤(3); 2. JVM利用CAS操作尝试将对象的Mark Word更新为指向Lock Record的指正,如果成功表示竞争到锁,则将锁标志位变成00(表示此对象处于轻量级锁状态),执行同步操作;如果失败则执行步骤(3); 3. 判断当前对象的Mark Word是否指向当前线程的栈帧,如果是则表示当前线程已经持有当前对象的锁,则直接执行同步代码块;否则只能说明该锁对象已经被其他线程抢占了,这时轻量级锁需要膨胀为重量级锁,锁标志位变成10,后面等待的线程将会进入阻塞状态;  **释放锁轻量级锁的释放也是通过CAS操作来进行的,主要步骤如下:** 1. 取出在获取轻量级锁保存在Displaced Mark Word中的数据; 2. 用CAS操作将取出的数据替换当前对象的Mark Word中,如果成功,则说明释放锁成功,否则执行(3); 3. 如果CAS操作替换失败,说明有其他线程尝试获取该锁,则需要在释放锁的同时需要唤醒被挂起的线程。   轻量级锁能提升程序同步性能的依据是“对于绝大部分的锁,在整个同步周期内都是不存在竞争的”,这是一个经验数据。轻量级锁在当前线程的栈帧中建立一个名为锁记录的空间,用于存储锁对象目前的指向和状态。如果没有竞争,轻量级锁使用CAS操作避免了使用互斥量的开销,但如果存在锁竞争,除了互斥量的开销外,还额外发生了CAS操作,因此**在有竞争的情况下,轻量级锁会比传统的重量级锁更慢。** **什么是CAS操作?** compare and swap,CAS操作需要输入两个数值,一个旧值(期望操作前的值)和一个新值,在操作期间先比较旧值有没有发生变化,如果没有发生变化,才交换成新值,发生了变化则不交换。 CAS详解:https://mp.weixin.qq.com/s__biz=MzIxMjE5MTE1Nw==&mid=2653192625&idx=1&sn=cbabbd806e4874e8793332724ca9d454&chksm=8c99f36bbbee7a7d169581dedbe09658d0b0edb62d2cbc9ba4c40f706cb678c7d8c768afb666&scene=21#wechat_redirect https://blog.csdn.net/qq_35357656/article/details/78657373 下图是轻量级锁的获取和释放过程: ![](https://images2018.cnblogs.com/blog/1169376/201807/1169376-20180726104054182-532040033.png) ### **10、偏向锁**   引入偏向锁主要目的是:为了在无多线程竞争的情况下尽量减少不必要的轻量级锁执行路径。上面提到了轻量级锁的加锁解锁操作是需要依赖多次CAS原子指令的。**那么偏向锁是如何来减少不必要的CAS操作呢**?我们可以查看Mark work的结构就明白了。 **只需要检查是否为偏向锁、锁标识为以及ThreadID即可,处理流程如下:****获取锁。** 1. 检测Mark Word是否为可偏向状态,即是否为偏向锁1,锁标识位为01; 2. 若为可偏向状态,则测试线程ID是否为当前线程ID,如果是,则执行步骤(5),否则执行步骤(3); 3. 如果线程ID不为当前线程ID,则通过CAS操作竞争锁,竞争成功,则将Mark Word的线程ID替换为当前线程ID,否则执行线程(4); 4. 通过CAS竞争锁失败,证明当前存在多线程竞争情况,当到达全局安全点,获得偏向锁的线程被挂起,偏向锁升级为轻量级锁,然后被阻塞在安全点的线程继续往下执行同步代码块; 5. 执行同步代码块。  释放锁偏向锁的释放采用了一种只有竞争才会释放锁的机制,线程是不会主动去释放偏向锁,需要等待其他线程来竞争。偏向锁的撤销需要等待全局安全点(这个时间点是上没有正在执行的代码)。 其步骤如下: 1. **暂停拥有偏向锁的线程,判断锁对象石是否还处于被锁定状态;** 2. **撤销偏向苏,恢复到无锁状态(01)或者轻量级锁的状态。**  下图是偏向锁的获取和释放流程: ![](https://images2018.cnblogs.com/blog/1169376/201807/1169376-20180726110935396-89753255.png) ## **11、重量级锁**   重量级锁通过对象内部的监视器(monitor)实现,其中monitor的本质是依赖于底层操作系统的Mutex Lock实现,操作系统实现线程之间的切换需要从用户态到内核态的切换,切换成本非常高。 ## 参考资料 1. 周志明:《深入理解Java虚拟机》 2. 方腾飞:《Java并发编程的艺术》 3. Java中synchronized的实现原理与应用
{ "pile_set_name": "Github" }
// // RACIndexSetSequence.h // ReactiveCocoa // // Created by Sergey Gavrilyuk on 12/18/13. // Copyright (c) 2013 GitHub, Inc. All rights reserved. // #import "RACSequence.h" // Private class that adapts an array to the RACSequence interface. @interface RACIndexSetSequence : RACSequence + (instancetype)sequenceWithIndexSet:(NSIndexSet *)indexSet; @end
{ "pile_set_name": "Github" }
{ "_args": [ [ { "raw": "[email protected]", "scope": null, "escapedName": "fresh", "name": "fresh", "rawSpec": "0.5.0", "spec": "0.5.0", "type": "version" }, "/var/www/html/star/node_modules/send" ] ], "_from": "[email protected]", "_id": "[email protected]", "_inCache": true, "_location": "/send/fresh", "_nodeVersion": "4.7.3", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", "tmp": "tmp/fresh-0.5.0.tgz_1487738798128_0.4817247486207634" }, "_npmUser": { "name": "dougwilson", "email": "[email protected]" }, "_npmVersion": "2.15.11", "_phantomChildren": {}, "_requested": { "raw": "[email protected]", "scope": null, "escapedName": "fresh", "name": "fresh", "rawSpec": "0.5.0", "spec": "0.5.0", "type": "version" }, "_requiredBy": [ "/send" ], "_resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.0.tgz", "_shasum": "f474ca5e6a9246d6fd8e0953cfa9b9c805afa78e", "_shrinkwrap": null, "_spec": "[email protected]", "_where": "/var/www/html/star/node_modules/send", "author": { "name": "TJ Holowaychuk", "email": "[email protected]", "url": "http://tjholowaychuk.com" }, "bugs": { "url": "https://github.com/jshttp/fresh/issues" }, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "[email protected]" }, { "name": "Jonathan Ong", "email": "[email protected]", "url": "http://jongleberry.com" } ], "dependencies": {}, "description": "HTTP response freshness testing", "devDependencies": { "eslint": "3.16.0", "eslint-config-standard": "6.2.1", "eslint-plugin-promise": "3.4.2", "eslint-plugin-standard": "2.0.1", "istanbul": "0.4.5", "mocha": "1.21.5" }, "directories": {}, "dist": { "shasum": "f474ca5e6a9246d6fd8e0953cfa9b9c805afa78e", "tarball": "https://registry.npmjs.org/fresh/-/fresh-0.5.0.tgz" }, "engines": { "node": ">= 0.6" }, "files": [ "HISTORY.md", "LICENSE", "index.js" ], "gitHead": "b1d26abb390d5dd1d9b82f0a5b890ab0ef1fee5c", "homepage": "https://github.com/jshttp/fresh#readme", "keywords": [ "fresh", "http", "conditional", "cache" ], "license": "MIT", "maintainers": [ { "name": "dougwilson", "email": "[email protected]" } ], "name": "fresh", "optionalDependencies": {}, "readme": "ERROR: No README data found!", "repository": { "type": "git", "url": "git+https://github.com/jshttp/fresh.git" }, "scripts": { "lint": "eslint .", "test": "mocha --reporter spec --bail --check-leaks test/", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" }, "version": "0.5.0" }
{ "pile_set_name": "Github" }
TEMPLATE = subdirs SUBDIRS = lym unit_tests unit_tests.depends += lym
{ "pile_set_name": "Github" }
NAME : pr76 COMMENT : 76-city problem (Padberg/Rinaldi) TYPE : TSP DIMENSION : 76 EDGE_WEIGHT_TYPE : EUC_2D NODE_COORD_SECTION 1 3600 2300 2 3100 3300 3 4700 5750 4 5400 5750 5 5608 7103 6 4493 7102 7 3600 6950 8 3100 7250 9 4700 8450 10 5400 8450 11 5610 10053 12 4492 10052 13 3600 10800 14 3100 10950 15 4700 11650 16 5400 11650 17 6650 10800 18 7300 10950 19 7300 7250 20 6650 6950 21 7300 3300 22 6650 2300 23 5400 1600 24 8350 2300 25 7850 3300 26 9450 5750 27 10150 5750 28 10358 7103 29 9243 7102 30 8350 6950 31 7850 7250 32 9450 8450 33 10150 8450 34 10360 10053 35 9242 10052 36 8350 10800 37 7850 10950 38 9450 11650 39 10150 11650 40 11400 10800 41 12050 10950 42 12050 7250 43 11400 6950 44 12050 3300 45 11400 2300 46 10150 1600 47 13100 2300 48 12600 3300 49 14200 5750 50 14900 5750 51 15108 7103 52 13993 7102 53 13100 6950 54 12600 7250 55 14200 8450 56 14900 8450 57 15110 10053 58 13992 10052 59 13100 10800 60 12600 10950 61 14200 11650 62 14900 11650 63 16150 10800 64 16800 10950 65 16800 7250 66 16150 6950 67 16800 3300 68 16150 2300 69 14900 1600 70 19800 800 71 19800 10000 72 19800 11900 73 19800 12200 74 200 12200 75 200 1100 76 200 800 EOF
{ "pile_set_name": "Github" }
{ "openapi": "3.0.0", "servers": [ { "url": "http://xkcd.com/" } ], "info": { "description": "Webcomic of romance, sarcasm, math, and language.", "title": "XKCD", "version": "1.0.0", "x-apisguru-categories": [ "media" ], "x-logo": { "url": "http://imgs.xkcd.com/static/terrible_small_logo.png" }, "x-origin": [ { "format": "swagger", "url": "https://raw.githubusercontent.com/APIs-guru/unofficial_openapi_specs/master/xkcd.com/1.0.0/swagger.yaml", "version": "2.0" } ], "x-providerName": "xkcd.com", "x-tags": [ "humor", "comics" ], "x-unofficialSpec": true }, "externalDocs": { "url": "https://xkcd.com/json.html" }, "paths": { "/info.0.json": { "get": { "description": "Fetch current comic and metadata.\n", "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/comic" } } } } } } }, "/{comicId}/info.0.json": { "get": { "description": "Fetch comics and metadata by comic id.\n", "parameters": [ { "in": "path", "name": "comicId", "required": true, "schema": { "type": "number" } } ], "responses": { "200": { "description": "OK", "content": { "*/*": { "schema": { "$ref": "#/components/schemas/comic" } } } } } } } }, "components": { "schemas": { "comic": { "properties": { "alt": { "type": "string" }, "day": { "type": "string" }, "img": { "type": "string" }, "link": { "type": "string" }, "month": { "type": "string" }, "news": { "type": "string" }, "num": { "type": "number" }, "safe_title": { "type": "string" }, "title": { "type": "string" }, "transcript": { "type": "string" }, "year": { "type": "string" } }, "type": "object" } } } }
{ "pile_set_name": "Github" }
<button mat-fab (click)="toggleActions()" cdk-overlay-origin class="notadd-speed-dial-fab-trigger"> <mat-icon class="mat-18" [@fabToggle]="fabTriggerState">add</mat-icon> </button> <ng-template cdk-portal #notaddSpeedDialFabActionsTemplate="cdkPortal"> <div [@speedDialStagger] fxLayout="column nowrap" fxLayoutAlign="start center" fxLayoutGap="15px"> <ng-content></ng-content> </div> </ng-template>
{ "pile_set_name": "Github" }
/* * (C) Copyright 2017 Texas Instruments Incorporated, <www.ti.com> * Keerthy <[email protected]> * * SPDX-License-Identifier: GPL-2.0+ */ #include <common.h> #include <fdtdec.h> #include <errno.h> #include <dm.h> #include <i2c.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/lp87565.h> #include <dm/device.h> DECLARE_GLOBAL_DATA_PTR; static const struct pmic_child_info pmic_children_info[] = { { .prefix = "buck", .driver = LP87565_BUCK_DRIVER }, { }, }; static int lp87565_write(struct udevice *dev, uint reg, const uint8_t *buff, int len) { int ret; ret = dm_i2c_write(dev, reg, buff, len); if (ret) error("write error to device: %p register: %#x!", dev, reg); return ret; } static int lp87565_read(struct udevice *dev, uint reg, uint8_t *buff, int len) { int ret; ret = dm_i2c_read(dev, reg, buff, len); if (ret) error("read error from device: %p register: %#x!", dev, reg); return ret; } static int lp87565_bind(struct udevice *dev) { ofnode regulators_node; int children; regulators_node = dev_read_subnode(dev, "regulators"); if (!ofnode_valid(regulators_node)) { debug("%s: %s regulators subnode not found!", __func__, dev->name); return -ENXIO; } debug("%s: '%s' - found regulators subnode\n", __func__, dev->name); children = pmic_bind_children(dev, regulators_node, pmic_children_info); if (!children) printf("%s: %s - no child found\n", __func__, dev->name); /* Always return success for this device */ return 0; } static struct dm_pmic_ops lp87565_ops = { .read = lp87565_read, .write = lp87565_write, }; static const struct udevice_id lp87565_ids[] = { { .compatible = "ti,lp87565", .data = LP87565 }, { .compatible = "ti,lp87565-q1", .data = LP87565_Q1 }, { } }; U_BOOT_DRIVER(pmic_lp87565) = { .name = "lp87565_pmic", .id = UCLASS_PMIC, .of_match = lp87565_ids, .bind = lp87565_bind, .ops = &lp87565_ops, };
{ "pile_set_name": "Github" }
# FlatBuffers and WAMP ## WAMP payload transparency mode ### Motivation **tldr:** * performance (passthrough of app payloads, general zero copy) * support end-to-end encryption * carrying proprietory binary payloads (MQTT) * strict static typing of interfaces --- WAMP supports both positional and keyword based request arguments and returns. For example, the WAMP `CALL` message allows for the following three alternative forms: 1. `[CALL, Request|id, Options|dict, Procedure|uri]` 2. `[CALL, Request|id, Options|dict, Procedure|uri, Arguments|list]` 3. `[CALL, Request|id, Options|dict, Procedure|uri, Arguments|list, ArgumentsKw|dict]` The actual application payload hence can take **three variants of app payload (XX)**: 1. `-` 2. `Arguments|list` 3. `Arguments|list, ArgumentsKw|dict` This pattern repeats across **all** WAMP messages that can carry application payload, namely the following 7 WAMP messages: * `PUBLISH` * `EVENT` * `CALL` * `INVOCATION` * `YIELD` * `RESULT` * `ERROR` > Note: should the proposed new WAMP messages `EVENT_RECEIVED` and `SUBSCRIBER_RECEIVED` be introduced, these also carry application payload, and would follow the same approach. The approach taken (**XX**) allows for a number of useful features: 1. flexible support of popular dynamically typed serializers, namely: JSON, MsgPack, CBOR and UBJSON 2. allow arbitrary adhoc extensibility (as the router basically does not care about new app payloads) 3. transparantly translate the *application payload* between serialization formats used by different clients connected at the same time. 4. support optional router side application payload validation: both static, and dynamic (calling into user supplied payload validators) However, a number of downsides have become apparent as well: 1. resource consumption: serialization/deserialization can eat significant chunks of CPU, and produce GC pressure 2. legacy (MQTT) and proprietory payloads that should simply be transported "as is" (passthrough, without ever touching) 3. as apps and systems get larger and more complex, the dynamic typing flexibility turns into a major problem: **the internal and external interfaces and APIs in a microservices based application must be relied upon and their evolution actively managed** The latter does not mean an "either or" question. You can have important base APIs and external interfaces defined rigorously, using static, strict typing discipline, while at the same time have other parts of your system evolve more freely, basically allowing weakly and dynamically typed data exchange - for limited areas. --- ### Payload Transparency Mode **Payload Transparancy Mode (PTM)** adds a 4th application payload variant to above **XX** 4. `[CALL, Request|id, Options|dict, Procedure|uri, Payload|binary]` where the actual application payload takes this form: 4. `Payload|binary` **PTM** can be used on a *per message basis*. If PTM is used, then the following two attributes MUST be present in the `Details|dict` or `Options|dict` of the respective WAMP message: * `payload|string`: Application payload type: * `"plain"`: Plain WAMP application payload. * `"cryptobox"`: Encrypted WAMP application payload. This is using WAMP-cryptobox (Curve25519 / Cryptobox). * `"opaque"`: Raw pass-through of app payload, uninterpreted in any way. * `serializer|string`: Application payload serializer type. * `"transport"`: Use same (dynamic) serializer for the app payload as on the transport. This will be one of JSON, MSGPACK, CBOR or UBJSON. * `"json"`: Use JSON serializer (for dynamically typed app payload). * `"msgpack"`: Use MsgPack serializer (for dynamically typed app payload). * `"cbor"`: Use CBOR serializer (for dynamically typed app payload). * `"ubjson"`: Use UBJSON serializer (for dynamically typed app payload). * `"opaque"`: Raw pass-through of app payload, uninterpreted in any way. * `"flatbuffers"`: Explicit use of FlatBuffers also for (statically typed) payload. * `key|string`: When using end-to-end encryption (WAMP-cryptobox), the public key to which the payload is encrypted --- #### Payload PLAIN When PTM is in use, and `Details.payload=="plain"`, the original application payload, one of * `-` * `Arguments|list` * `Arguments|list, ArgumentsKw|dict` is serialized according to the (dynamically typed) serializer specified in `serializer`, one of * `"transport"` * `"msgpack"` * `"json"` * `"cbor"` * `"ubjson"` > Note that serializers `"opaque"` and `"flatbuffers"` are illegal for payload `"plain"`. --- #### Payload CRYPTOBOX Write me. --- #### Payload OPAQUE Write me. --- ## FlatBuffers FlatBuffers is a zero-copy serialization format open-sourced by Google in 2014 under the Apache 2 license. Supported operating systems include: * Android * Linux * MacOS X * Windows Supported programming languages include: * C++ * C# * C * Go * Java * JavaScript * PHP * Python --- ## Building 1. Get [cmake](https://cmake.org/) 2. Follow [Building with CMake](https://github.com/google/flatbuffers/blob/master/docs/source/Building.md#building-with-cmake) Essentially: ```console git clone https://github.com/google/flatbuffers.git cd flatbuffers cmake -G "Unix Makefiles" make -j4 ./flatc --version ``` --- ### flatc patches The following patches are required currently for flatc: [this PR](https://github.com/google/flatbuffers/pull/4713) adds pieces missing for reflection in the flatc compiler. --- ## Usage This folder contains a [Makefile](Makefile) that allows to compile all WAMP FlatBuffers schemata and generate binding code in various languages using ```console make clean build cloc ``` Here is example output (a total of 30k LOC generated from 500 LOC .fbs): ```console cpy2714_1) oberstet@thinkpad-t430s:~/scm/wamp-proto/wamp-proto/flatbuffers$ make clean build cloc rm -rf ./_build /home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/schema/ --binary --schema --bfbs-comments --bfbs-builtin-attrs *.fbs /home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/cpp/ --cpp *.fbs /home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/csharp/ --csharp *.fbs /home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/go/ --go *.fbs /home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/java/ --java *.fbs /home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/js/ --js *.fbs /home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/php/ --php *.fbs /home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/python/ --python *.fbs /home/oberstet/scm/xbr/flatbuffers/flatc -o ./_build/ts/ --ts *.fbs cloc --read-lang-def=cloc.def --exclude-dir=_build . 11 text files. 11 unique files. 2 files ignored. github.com/AlDanial/cloc v 1.76 T=0.01 s (774.6 files/s, 113640.1 lines/s) --------------------------------------------------------------------------------------- Language files blank comment code --------------------------------------------------------------------------------------- FlatBuffers 7 314 372 535 Markdown 1 64 0 119 make 1 20 8 30 Windows Module Definition 1 0 0 5 --------------------------------------------------------------------------------------- SUM: 10 398 380 689 --------------------------------------------------------------------------------------- cloc ./_build 331 text files. 331 unique files. 2 files ignored. github.com/AlDanial/cloc v 1.76 T=0.35 s (942.1 files/s, 132452.9 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C/C++ Header 7 405 7 5629 PHP 62 961 3206 5006 Go 62 826 62 4815 TypeScript 7 832 3430 3428 JavaScript 7 896 3493 3177 Java 62 439 62 2825 C# 62 477 186 2800 Python 62 616 454 2504 ------------------------------------------------------------------------------- SUM: 331 5452 10900 30184 ------------------------------------------------------------------------------- ``` --- ## Notes * FlatBuffers [currently lacks](https://github.com/google/flatbuffers/issues/4237) syntax highlighting on GitHub. --- ## References * [FlatBuffers Homepage](https://google.github.io/flatbuffers/) * [FlatBuffers Source](https://github.com/google/flatbuffers) * [flatcc - a FlatBuffers Compiler and Library in C for C](https://github.com/dvidelabs/flatcc) ---
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <style> body { width: 180px; font-family: sans-serif; font-size: 13px; background: #f5fff5; } a { color: #00acfc; text-decoration: underline; } a:hover { text-decoration: none; } .head { display: none; color: #666; } .head .hint { background: #fbffcb; padding: 2px; font-style: italic; color: #888; margin: 4px 0; } .head .status span { font-weight: bold; } .head#is_connected .status span { color: #090; } .head#not_connected .status span { color: #c00; } .info { height: 45px; margin: 5px 0; border-bottom: 1px solid #ddd; } .info .url { float: left; max-width: 150px; margin-right: 5px; color: #666; font-size: 13px; padding: 1px; } .info input { border: 1px solid #ddd; width: 170px; } .info .buttons { margin-top: 2px; } .btn { cursor: pointer; border: 1px solid #444; padding:0px 2px; font-size: 12px; font-weight: bold; float: left; color: #333; margin-right: 4px; } .btn.save { } .btn.cancel { border: none; color: #666; } .item { display: none; } </style> </head> <body> <div class="head" id="is_connected"> <div class="status"> Status: <span>Connected</span> </div> </div> <div class="head" id="not_connected"> <div class="status"> Status: <span>No connection</span> </div> <div class="hint"> Please check that Styler daemon is running and the URL to Styler is correct or <a href="javascript:void()" class="reconnect">try to reconnect</a> </div> </div> <div class="info view"> <div class="url"></div><div class="btn edit">Edit</div> </div> <div class="info edit"> <input type="text" id="url"><br> <div class="buttons"> <div class="btn save">Save</div> <div class="btn cancel">Cancel</div> </div> </div> <div id="items"> <a href="javascript:void(0)" class="item start">Start using Styler on this page</a> <a href="javascript:void(0)" class="item launch">Launch Styler console</a> <a href="javascript:void(0)" class="item home">Styler homepage</a> </div> </body> </html>
{ "pile_set_name": "Github" }
// // detail/object_pool.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BOOST_ASIO_DETAIL_OBJECT_POOL_HPP #define BOOST_ASIO_DETAIL_OBJECT_POOL_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/noncopyable.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename Object> class object_pool; class object_pool_access { public: template <typename Object> static Object* create() { return new Object; } template <typename Object, typename Arg> static Object* create(Arg arg) { return new Object(arg); } template <typename Object> static void destroy(Object* o) { delete o; } template <typename Object> static Object*& next(Object* o) { return o->next_; } template <typename Object> static Object*& prev(Object* o) { return o->prev_; } }; template <typename Object> class object_pool : private noncopyable { public: // Constructor. object_pool() : live_list_(0), free_list_(0) { } // Destructor destroys all objects. ~object_pool() { destroy_list(live_list_); destroy_list(free_list_); } // Get the object at the start of the live list. Object* first() { return live_list_; } // Allocate a new object. Object* alloc() { Object* o = free_list_; if (o) free_list_ = object_pool_access::next(free_list_); else o = object_pool_access::create<Object>(); object_pool_access::next(o) = live_list_; object_pool_access::prev(o) = 0; if (live_list_) object_pool_access::prev(live_list_) = o; live_list_ = o; return o; } // Allocate a new object with an argument. template <typename Arg> Object* alloc(Arg arg) { Object* o = free_list_; if (o) free_list_ = object_pool_access::next(free_list_); else o = object_pool_access::create<Object>(arg); object_pool_access::next(o) = live_list_; object_pool_access::prev(o) = 0; if (live_list_) object_pool_access::prev(live_list_) = o; live_list_ = o; return o; } // Free an object. Moves it to the free list. No destructors are run. void free(Object* o) { if (live_list_ == o) live_list_ = object_pool_access::next(o); if (object_pool_access::prev(o)) { object_pool_access::next(object_pool_access::prev(o)) = object_pool_access::next(o); } if (object_pool_access::next(o)) { object_pool_access::prev(object_pool_access::next(o)) = object_pool_access::prev(o); } object_pool_access::next(o) = free_list_; object_pool_access::prev(o) = 0; free_list_ = o; } private: // Helper function to destroy all elements in a list. void destroy_list(Object* list) { while (list) { Object* o = list; list = object_pool_access::next(o); object_pool_access::destroy(o); } } // The list of live objects. Object* live_list_; // The free list. Object* free_list_; }; } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_OBJECT_POOL_HPP
{ "pile_set_name": "Github" }
/* * interface to the SCLP-read/write driver * * Copyright IBM Corporation 1999, 2009 * * Author(s): Martin Peschke <[email protected]> * Martin Schwidefsky <[email protected]> */ #ifndef __SCLP_RW_H__ #define __SCLP_RW_H__ #include <linux/list.h> struct mto { u16 length; u16 type; u16 line_type_flags; u8 alarm_control; u8 _reserved[3]; } __attribute__((packed)); struct go { u16 length; u16 type; u32 domid; u8 hhmmss_time[8]; u8 th_time[3]; u8 reserved_0; u8 dddyyyy_date[7]; u8 _reserved_1; u16 general_msg_flags; u8 _reserved_2[10]; u8 originating_system_name[8]; u8 job_guest_name[8]; } __attribute__((packed)); struct mdb_header { u16 length; u16 type; u32 tag; u32 revision_code; } __attribute__((packed)); struct mdb { struct mdb_header header; struct go go; } __attribute__((packed)); struct msg_buf { struct evbuf_header header; struct mdb mdb; } __attribute__((packed)); struct write_sccb { struct sccb_header header; struct msg_buf msg_buf; } __attribute__((packed)); /* The number of empty mto buffers that can be contained in a single sccb. */ #define NR_EMPTY_MTO_PER_SCCB ((PAGE_SIZE - sizeof(struct sclp_buffer) - \ sizeof(struct write_sccb)) / sizeof(struct mto)) /* * data structure for information about list of SCCBs (only for writing), * will be located at the end of a SCCBs page */ struct sclp_buffer { struct list_head list; /* list_head for sccb_info chain */ struct sclp_req request; struct write_sccb *sccb; char *current_line; int current_length; int retry_count; /* output format settings */ unsigned short columns; unsigned short htab; /* statistics about this buffer */ unsigned int mto_char_sum; /* # chars in sccb */ unsigned int mto_number; /* # mtos in sccb */ /* Callback that is called after reaching final status. */ void (*callback)(struct sclp_buffer *, int); }; int sclp_rw_init(void); struct sclp_buffer *sclp_make_buffer(void *, unsigned short, unsigned short); void *sclp_unmake_buffer(struct sclp_buffer *); int sclp_buffer_space(struct sclp_buffer *); int sclp_write(struct sclp_buffer *buffer, const unsigned char *, int); int sclp_emit_buffer(struct sclp_buffer *,void (*)(struct sclp_buffer *,int)); void sclp_set_columns(struct sclp_buffer *, unsigned short); void sclp_set_htab(struct sclp_buffer *, unsigned short); int sclp_chars_in_buffer(struct sclp_buffer *); #ifdef CONFIG_SCLP_CONSOLE void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event); #else static inline void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event) { } #endif #endif /* __SCLP_RW_H__ */
{ "pile_set_name": "Github" }
-- THIS IS A GENERATED FILE, DO NOT EDIT local w = AddWaypoint local c = AddConnection local _ = { w(151, 84, 239), w(281, 84, 746), w(260, 104, 1575), w(867, 120, 1223), w(933, 85, 764), w(1381, 83, 642), w(831, 84, 318), w(1577, 83, 127), w(908, 100, 2002), w(853, 110, 2180), w(2425, 78, 1776), w(2657, 73, 1799), w(2625, 82, 1571), w(3712, 66, 314), w(3681, 108, 121), w(3449, 81, 279), w(3892, 83, 2650), w(4188, 83, 2713), w(4054, 77, 2489), w(460, 85, 12117), w(747, 79, 11550), w(1003, 80, 11229), w(353, 80, 11380), w(481, 63, 10576), w(1223, 79, 11866), w(1606, 83, 12118), w(1866, 116, 11729), w(2614, 80, 9720), w(2451, 73, 9594), w(2453, 83, 9832), w(4346, 86, 10684), w(4383, 73, 10414), w(4285, 108, 8791), w(3834, 107, 8726), w(4009, 80, 8492), w(11937, 86, 11737), w(12081, 85, 11406), w(11596, 86, 11239), w(11493, 89, 11907), w(10971, 85, 11534), w(10480, 97, 12059), w(11272, 83, 10835), w(12002, 83, 10608), w(10849, 74, 9472), w(10657, 70, 9537), w(10394, 57, 9466), w(8729, 82, 11234), w(8538, 85, 11137), w(8595, 93, 11339), w(7864, 81, 9503), w(8222, 72, 7380), w(7967, 70, 7579), w(8229, 84, 7708), w(11989, 85, 317), w(11702, 86, 660), w(11311, 85, 874), w(11104, 100, 1213), w(11897, 103, 917), w(12099, 83, 1341), w(11516, 86, 414), w(11474, 85, 114), w(10839, 83, 123), w(10146, 85, 1462), w(9788, 83, 1662), w(10207, 79, 1797), w(8236, 85, 372), w(8206, 85, 604), w(8001, 84, 382), w(8134, 77, 1534), w(7962, 71, 1376), w(7504, 83, 2976), w(7569, 83, 2523), w(5012, 84, 4296), w(5307, 85, 4293), w(5177, 101, 3971), w(1594, 113, 6569), w(1302, 84, 6740), w(1363, 81, 6247), w(2966, 80, 5587), w(2746, 100, 5772), w(3004, 81, 6017), w(7302, 101, 4406), w(7505, 78, 4174), w(7536, 88, 4604), w(11468, 69, 7280), w(11655, 97, 7135), w(11888, 81, 7247), w(10903, 106, 5874), w(10617, 96, 6005), w(1022, 83, 2193), w(8257, 84, 1122), w(7339, 89, 2646), w(7805, 88, 9792), w(9403, 69, 10246), w(8064, 83, 9734), w(4750, 67, 10483), w(11041, 86, 6115), } c(_[1], _[2]) c(_[1], _[7]) c(_[2], _[3]) c(_[2], _[4]) c(_[2], _[5]) c(_[2], _[7]) c(_[3], _[4]) c(_[3], _[9]) c(_[3], _[10]) c(_[4], _[5]) c(_[4], _[6]) c(_[4], _[9]) c(_[4], _[11]) c(_[5], _[6]) c(_[5], _[7]) c(_[6], _[7]) c(_[6], _[8]) c(_[6], _[11]) c(_[6], _[13]) c(_[7], _[8]) c(_[8], _[13]) c(_[8], _[16]) c(_[9], _[10]) c(_[9], _[11]) c(_[9], _[90]) c(_[10], _[90]) c(_[11], _[12]) c(_[11], _[13]) c(_[11], _[17]) c(_[11], _[90]) c(_[12], _[13]) c(_[12], _[14]) c(_[12], _[16]) c(_[12], _[17]) c(_[12], _[19]) c(_[13], _[16]) c(_[14], _[15]) c(_[14], _[16]) c(_[14], _[18]) c(_[14], _[19]) c(_[15], _[16]) c(_[17], _[18]) c(_[17], _[19]) c(_[17], _[73]) c(_[17], _[75]) c(_[17], _[79]) c(_[17], _[90]) c(_[18], _[19]) c(_[18], _[75]) c(_[18], _[92]) c(_[20], _[21]) c(_[20], _[23]) c(_[20], _[25]) c(_[20], _[26]) c(_[21], _[22]) c(_[21], _[23]) c(_[21], _[25]) c(_[22], _[23]) c(_[22], _[24]) c(_[22], _[25]) c(_[22], _[27]) c(_[22], _[29]) c(_[22], _[30]) c(_[22], _[32]) c(_[23], _[24]) c(_[24], _[29]) c(_[25], _[26]) c(_[25], _[27]) c(_[26], _[27]) c(_[26], _[31]) c(_[27], _[31]) c(_[27], _[32]) c(_[28], _[29]) c(_[28], _[30]) c(_[28], _[32]) c(_[28], _[33]) c(_[28], _[34]) c(_[29], _[30]) c(_[29], _[34]) c(_[29], _[35]) c(_[29], _[76]) c(_[30], _[32]) c(_[31], _[32]) c(_[31], _[96]) c(_[32], _[33]) c(_[32], _[96]) c(_[33], _[34]) c(_[33], _[35]) c(_[33], _[52]) c(_[33], _[82]) c(_[33], _[84]) c(_[33], _[96]) c(_[34], _[35]) c(_[35], _[74]) c(_[35], _[76]) c(_[35], _[81]) c(_[36], _[37]) c(_[36], _[38]) c(_[36], _[39]) c(_[37], _[38]) c(_[37], _[43]) c(_[38], _[39]) c(_[38], _[40]) c(_[38], _[42]) c(_[38], _[43]) c(_[39], _[40]) c(_[39], _[41]) c(_[40], _[41]) c(_[40], _[42]) c(_[40], _[47]) c(_[41], _[47]) c(_[41], _[49]) c(_[42], _[43]) c(_[42], _[46]) c(_[42], _[47]) c(_[42], _[48]) c(_[42], _[94]) c(_[43], _[44]) c(_[43], _[45]) c(_[43], _[46]) c(_[44], _[45]) c(_[44], _[46]) c(_[45], _[46]) c(_[46], _[50]) c(_[46], _[51]) c(_[46], _[53]) c(_[46], _[94]) c(_[46], _[95]) c(_[47], _[49]) c(_[48], _[49]) c(_[48], _[93]) c(_[48], _[94]) c(_[48], _[95]) c(_[50], _[52]) c(_[50], _[53]) c(_[50], _[93]) c(_[50], _[95]) c(_[51], _[52]) c(_[51], _[53]) c(_[51], _[85]) c(_[51], _[89]) c(_[52], _[53]) c(_[52], _[84]) c(_[52], _[96]) c(_[54], _[55]) c(_[54], _[58]) c(_[54], _[59]) c(_[54], _[60]) c(_[54], _[61]) c(_[55], _[56]) c(_[55], _[58]) c(_[55], _[60]) c(_[56], _[57]) c(_[56], _[58]) c(_[56], _[59]) c(_[56], _[60]) c(_[56], _[62]) c(_[57], _[59]) c(_[57], _[62]) c(_[57], _[63]) c(_[57], _[65]) c(_[57], _[67]) c(_[57], _[69]) c(_[57], _[91]) c(_[58], _[59]) c(_[59], _[65]) c(_[60], _[61]) c(_[60], _[62]) c(_[61], _[62]) c(_[62], _[66]) c(_[62], _[67]) c(_[63], _[64]) c(_[63], _[65]) c(_[63], _[69]) c(_[64], _[65]) c(_[64], _[69]) c(_[64], _[72]) c(_[65], _[71]) c(_[65], _[72]) c(_[65], _[83]) c(_[65], _[88]) c(_[65], _[89]) c(_[66], _[67]) c(_[66], _[68]) c(_[67], _[68]) c(_[67], _[91]) c(_[68], _[70]) c(_[68], _[91]) c(_[69], _[70]) c(_[69], _[72]) c(_[69], _[91]) c(_[70], _[72]) c(_[70], _[91]) c(_[70], _[92]) c(_[71], _[72]) c(_[71], _[74]) c(_[71], _[82]) c(_[71], _[83]) c(_[71], _[92]) c(_[72], _[92]) c(_[73], _[74]) c(_[73], _[75]) c(_[73], _[79]) c(_[73], _[81]) c(_[74], _[75]) c(_[74], _[81]) c(_[74], _[82]) c(_[74], _[92]) c(_[75], _[92]) c(_[76], _[77]) c(_[76], _[78]) c(_[76], _[80]) c(_[76], _[81]) c(_[77], _[78]) c(_[78], _[80]) c(_[79], _[80]) c(_[79], _[81]) c(_[80], _[81]) c(_[82], _[83]) c(_[82], _[84]) c(_[83], _[84]) c(_[83], _[89]) c(_[84], _[89]) c(_[85], _[86]) c(_[85], _[87]) c(_[85], _[89]) c(_[85], _[97]) c(_[86], _[87]) c(_[86], _[97]) c(_[88], _[89]) c(_[88], _[97]) c(_[89], _[97]) c(_[93], _[95]) c(_[94], _[95])
{ "pile_set_name": "Github" }
// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2 2>&1 < %s| FileCheck %s // ------------------------------------------------------------------------- // // Invalid element width usubwt z0.b, z0.b, z0.b // CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width // CHECK-NEXT: usubwt z0.b, z0.b, z0.b // CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: usubwt z0.h, z0.h, z0.h // CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width // CHECK-NEXT: usubwt z0.h, z0.h, z0.h // CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: usubwt z0.s, z0.s, z0.s // CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width // CHECK-NEXT: usubwt z0.s, z0.s, z0.s // CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: usubwt z0.d, z0.d, z0.d // CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid element width // CHECK-NEXT: usubwt z0.d, z0.d, z0.d // CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: // --------------------------------------------------------------------------// // Negative tests for instructions that are incompatible with movprfx movprfx z31.d, p0/z, z6.d usubwt z0.d, z1.d, z2.s // CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx, suggest replacing movprfx with mov // CHECK-NEXT: usubwt z0.d, z1.d, z2.s // CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}: movprfx z31, z6 usubwt z0.d, z1.d, z2.s // CHECK: [[@LINE-1]]:{{[0-9]+}}: error: instruction is unpredictable when following a movprfx, suggest replacing movprfx with mov // CHECK-NEXT: usubwt z0.d, z1.d, z2.s // CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
{ "pile_set_name": "Github" }
<?php $title = "noUiSlider - Examples and hints"; $description = "noUiSlider has a selection of examples you can use to implement a slider easily. Take a look!"; $canonical = "nouislider/examples/" ?> <section> <ul> <li><a href="#section-colorpicker">Color picker</a></li> <li><a href="#section-dates">Using dates</a></li> <li><a href="#section-merging-tooltips">Merging overlapping tooltips</a></li> <li><a href="#section-html5">Working with HTML5 input types</a></li> <li><a href="#section-non-linear">Using non linear ranges</a></li> <li><a href="#section-lock">Locking two sliders together</a></li> <li><a href="#section-click-pips">Moving the slider by clicking pips</a></li> <li><a href="#section-hiding-tooltips">Only showing tooltips when sliding handles</a></li> <li><a href="#section-colored-connect">Colored connect elements</a></li> <li><a href="#section-steps-api">Changing the slider value by keypress</a></li> <li><a href="#section-skipping">Skipping values on a slider</a></li> <li><a href="#section-huge-numbers">Working with huge numbers</a></li> <li><a href="#section-toggle">Create a toggle</a></li> <li><a href="#section-soft-limits">Block the edges of a slider</a></li> <li><a href="#section-from-center">Connect to the center of a slider</a></li> </ul> </section> <section> <div class="notice">Can't find something? See the full <a href="/nouislider/reference/">options reference</a>.</div> </section> <?php include 'examples-content/colorpicker.php'; ?> <?php include 'examples-content/dates.php'; ?> <?php include 'examples-content/merging-tooltips.php'; ?> <?php include 'examples-content/html5.php'; ?> <?php include 'examples-content/non-linear.php'; ?> <?php include 'examples-content/lock.php'; ?> <?php include 'examples-content/click-pips.php'; ?> <?php include 'examples-content/hiding-tooltips.php'; ?> <?php include 'examples-content/colored-connect.php'; ?> <?php include 'examples-content/steps-api.php'; ?> <?php include 'examples-content/skipping.php'; ?> <?php include 'examples-content/huge-numbers.php'; ?> <?php include 'examples-content/toggle.php'; ?> <?php include 'examples-content/soft-limits.php'; ?> <?php include 'examples-content/from-center.php'; ?>
{ "pile_set_name": "Github" }
struct A { int a_member; }; inline int use_a(A a) { return a.a_member; } class B { struct Inner1 {}; public: struct Inner2; struct Inner3; template<typename T> void f(); }; struct BFriend { friend class B::Inner3; private: struct Inner3Base {}; }; // Check that lookup and access checks are performed in the right context. struct B::Inner2 : Inner1 {}; struct B::Inner3 : BFriend::Inner3Base {}; template<typename T> void B::f() {} template<> inline void B::f<int>() {} // Check that base-specifiers are correctly disambiguated. template<int N> struct C_Base { struct D { constexpr operator int() const { return 0; } }; }; const int C_Const = 0; struct C1 : C_Base<C_Base<0>::D{}> {} extern c1; struct C2 : C_Base<C_Const<0>::D{} extern c2; typedef struct { int a; void f(); struct X; } D; struct D::X { int dx; } extern dx; inline int use_dx(D::X dx) { return dx.dx; } template<typename T> int E(T t) { return t; } template<typename T> struct F { int f(); template<typename U> int g(); static int n; }; template<typename T> int F<T>::f() { return 0; } template<typename T> template<typename U> int F<T>::g() { return 0; } template<typename T> int F<T>::n = 0; template<> inline int F<char>::f() { return 0; } template<> template<typename U> int F<char>::g() { return 0; } template<> struct F<void> { int h(); }; inline int F<void>::h() { return 0; } template<typename T> struct F<T *> { int i(); }; template<typename T> int F<T*>::i() { return 0; } namespace G { enum A { a, b, c, d, e }; enum { f, g, h }; typedef enum { i, j } k; typedef enum {} l; } template<typename T = int, int N = 3, template<typename> class K = F> int H(int a = 1); template<typename T = int, int N = 3, template<typename> class K = F> using I = decltype(H<T, N, K>()); template<typename T = int, int N = 3, template<typename> class K = F> struct J {}; namespace NS { struct A {}; template<typename T> struct B : A {}; template<typename T> struct B<T*> : B<char> {}; template<> struct B<int> : B<int*> {}; inline void f() {} } namespace StaticInline { struct X {}; static inline void f(X); static inline void g(X x) { f(x); } } namespace FriendDefArg { template<typename = int> struct A; template<int = 0> struct B; template<template<typename> class = A> struct C; template<typename = int, int = 0, template<typename> class = A> struct D {}; template<typename U> struct Y { template<typename> friend struct A; template<int> friend struct B; template<template<typename> class> friend struct C; template<typename, int, template<typename> class> friend struct D; }; } namespace SeparateInline { inline void f(); void f() {} constexpr int g() { return 0; } } namespace TrailingAttributes { template<typename T> struct X {} __attribute__((aligned(8))); } namespace MergeFunctionTemplateSpecializations { template<typename T> T f(); template<typename T> struct X { template<typename U> using Q = decltype(f<T>() + U()); }; using xiq = X<int>::Q<int>; } enum ScopedEnum : int; enum ScopedEnum : int { a, b, c }; namespace RedeclDifferentDeclKind { struct X {}; typedef X X; using RedeclDifferentDeclKind::X; } namespace Anon { struct X { union { int n; }; }; } namespace ClassTemplatePartialSpec { template<typename T> struct F; template<template<int> class A, int B> struct F<A<B>> { template<typename C> F(); }; template<template<int> class A, int B> template<typename C> F<A<B>>::F() {} template<typename A, int B> struct F<A[B]> { template<typename C> F(); }; template<typename A, int B> template<typename C> F<A[B]>::F() {} } struct MemberClassTemplate { template<typename T> struct A; }; template<typename T> struct MemberClassTemplate::A {}; template<typename T> struct MemberClassTemplate::A<T*> {}; template<> struct MemberClassTemplate::A<int> {};
{ "pile_set_name": "Github" }
<events xmlns="http://xmlns.opennms.org/xsd/eventconf"> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.1.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>1</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/physicalAdapterLinkUpTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: physicalAdapterLinkUpTrap</event-label> <descr>&lt;p>Adapter has reached a linkup state.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> physicalAdapterIndex&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> physicalAdapterLinkUpTrap trap received physicalAdapterIndex=%parm[#1]%&lt;/p> </logmsg> <severity>Normal</severity> </event> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.1.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>2</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/physicalAdapterLinkDownTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: physicalAdapterLinkDownTrap</event-label> <descr>&lt;p>Adapter has reached a link down state.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> physicalAdapterIndex&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> physicalAdapterLinkDownTrap trap received physicalAdapterIndex=%parm[#1]%&lt;/p> </logmsg> <severity>Warning</severity> </event> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.1.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>3</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/physicalAdapterAddedTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: physicalAdapterAddedTrap</event-label> <descr>&lt;p>Adapter has been installed.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> physicalAdapterIndex&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> physicalAdapterAddedTrap trap received physicalAdapterIndex=%parm[#1]%&lt;/p> </logmsg> <severity>Normal</severity> </event> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.1.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>4</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/physicalAdapterRemovedTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: physicalAdapterRemovedTrap</event-label> <descr>&lt;p>Adapter has been uninstalled.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> physicalAdapterIndex&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> physicalAdapterRemovedTrap trap received physicalAdapterIndex=%parm[#1]%&lt;/p> </logmsg> <severity>Warning</severity> </event> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.1.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>5</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/physicalAdapterOnlineDiagPassedTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: physicalAdapterOnlineDiagPassedTrap</event-label> <descr>&lt;p>Adapter's online diagnostics passed.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> physicalAdapterIndex&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> physicalAdapterOnlineDiagPassedTrap trap received physicalAdapterIndex=%parm[#1]%&lt;/p> </logmsg> <severity>Normal</severity> </event> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.1.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>6</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/physicalAdapterOnlineDiagFailedTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: physicalAdapterOnlineDiagFailedTrap</event-label> <descr>&lt;p>Adapter's online diagnostics failed. Online diagnostics might fail because of link loss or other hardware issues.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> physicalAdapterIndex&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> physicalAdapterOnlineDiagFailedTrap trap received physicalAdapterIndex=%parm[#1]%&lt;/p> </logmsg> <severity>Warning</severity> </event> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.2.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>1</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/virtualAdapterAddedTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: virtualAdapterAddedTrap</event-label> <descr>&lt;p>Virtual adapter has been added to a team.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> virtualAdapterIndex&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr> &lt;tr>&lt;td>&lt;b> ansId&lt;/b>&lt;/td>&lt;td> %parm[#2]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> virtualAdapterAddedTrap trap received virtualAdapterIndex=%parm[#1]% ansId=%parm[#2]%&lt;/p> </logmsg> <severity>Normal</severity> </event> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.2.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>2</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/virtualAdapterRemovedTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: virtualAdapterRemovedTrap</event-label> <descr>&lt;p>Virtual adapter has been removed from a team.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> virtualAdapterIndex&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> virtualAdapterRemovedTrap trap received virtualAdapterIndex=%parm[#1]%&lt;/p> </logmsg> <severity>Warning</severity> </event> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.3.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>1</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/ansTeamFailoverTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: ansTeamFailoverTrap</event-label> <descr>&lt;p>The primary team member has been changed.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> ansId&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr> &lt;tr>&lt;td>&lt;b> ansTeamCurrentPrimaryIndex&lt;/b>&lt;/td>&lt;td> %parm[#2]%;&lt;/td>&lt;td>&lt;p> not-available(-1) &lt;/p>&lt;/td>&lt;/tr> &lt;tr>&lt;td>&lt;b> ansTeamPreviousPrimaryIndex&lt;/b>&lt;/td>&lt;td> %parm[#3]%;&lt;/td>&lt;td>&lt;p> not-available(-1) &lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> ansTeamFailoverTrap trap received ansId=%parm[#1]% ansTeamCurrentPrimaryIndex=%parm[#2]% ansTeamPreviousPrimaryIndex=%parm[#3]%&lt;/p> </logmsg> <severity>Warning</severity> <varbindsdecode> <parmid>parm[#2]</parmid> <decode varbindvalue="-1" varbinddecodedstring="not-available"/> </varbindsdecode> <varbindsdecode> <parmid>parm[#3]</parmid> <decode varbindvalue="-1" varbinddecodedstring="not-available"/> </varbindsdecode> </event> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.3.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>2</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/ansAddedTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: ansAddedTrap</event-label> <descr>&lt;p>Team has been added.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> ansId&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> ansAddedTrap trap received ansId=%parm[#1]%&lt;/p> </logmsg> <severity>Normal</severity> </event> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.3.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>3</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/ansRemovedTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: ansRemovedTrap</event-label> <descr>&lt;p>Team has been removed.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> ansId&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> ansRemovedTrap trap received ansId=%parm[#1]%&lt;/p> </logmsg> <severity>Warning</severity> </event> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.4.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>1</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/teamMemberAddedTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: teamMemberAddedTrap</event-label> <descr>&lt;p>Member has been added to a team.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> ansMemberIndex&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr> &lt;tr>&lt;td>&lt;b> ansId&lt;/b>&lt;/td>&lt;td> %parm[#2]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> teamMemberAddedTrap trap received ansMemberIndex=%parm[#1]% ansId=%parm[#2]%&lt;/p> </logmsg> <severity>Normal</severity> </event> <event> <mask> <maskelement> <mename>id</mename> <mevalue>.1.3.6.1.4.1.343.2.7.2.3.4.1</mevalue> </maskelement> <maskelement> <mename>generic</mename> <mevalue>6</mevalue> </maskelement> <maskelement> <mename>specific</mename> <mevalue>2</mevalue> </maskelement> </mask> <uei>uei.opennms.org/vendor/intel/traps/teamMemberRemovedTrap</uei> <event-label>INTEL-LAN-ADAPTERS-MIB defined trap event: teamMemberRemovedTrap</event-label> <descr>&lt;p>Member has been removed from a team.&lt;/p>&lt;table> &lt;tr>&lt;td>&lt;b> ansMemberIndex&lt;/b>&lt;/td>&lt;td> %parm[#1]%;&lt;/td>&lt;td>&lt;p>&lt;/p>&lt;/td>&lt;/tr>&lt;/table></descr> <logmsg dest="logndisplay">&lt;p> teamMemberRemovedTrap trap received ansMemberIndex=%parm[#1]%&lt;/p> </logmsg> <severity>Warning</severity> </event> </events>
{ "pile_set_name": "Github" }
/* eslint-disable mozilla/no-arbitrary-setTimeout */ // Test for bug 1170531 // https://bugzilla.mozilla.org/show_bug.cgi?id=1170531 add_task(async function() { // Get a bunch of DOM nodes let editMenu = document.getElementById("edit-menu"); let menuPopup = editMenu.menupopup; let closeMenu = function(aCallback) { if (OS.Constants.Sys.Name == "Darwin") { executeSoon(aCallback); return; } menuPopup.addEventListener( "popuphidden", function() { executeSoon(aCallback); }, { once: true } ); executeSoon(function() { editMenu.open = false; }); }; let openMenu = function(aCallback) { if (OS.Constants.Sys.Name == "Darwin") { goUpdateGlobalEditMenuItems(); // On OSX, we have a native menu, so it has to be updated. In single process browsers, // this happens synchronously, but in e10s, we have to wait for the main thread // to deal with it for us. 1 second should be plenty of time. setTimeout(aCallback, 1000); return; } menuPopup.addEventListener( "popupshown", function() { executeSoon(aCallback); }, { once: true } ); executeSoon(function() { editMenu.open = true; }); }; await BrowserTestUtils.withNewTab( { gBrowser, url: "about:blank" }, async function(browser) { let menu_cut_disabled, menu_copy_disabled; await BrowserTestUtils.loadURI( browser, "data:text/html,<div>hello!</div>" ); await BrowserTestUtils.browserLoaded(browser); browser.focus(); await new Promise(resolve => waitForFocus(resolve, window)); await new Promise(resolve => window.requestAnimationFrame(() => executeSoon(resolve)) ); await new Promise(openMenu); menu_cut_disabled = menuPopup.querySelector("#menu_cut").getAttribute("disabled") == "true"; is(menu_cut_disabled, false, "menu_cut should be enabled"); menu_copy_disabled = menuPopup.querySelector("#menu_copy").getAttribute("disabled") == "true"; is(menu_copy_disabled, false, "menu_copy should be enabled"); await new Promise(closeMenu); await BrowserTestUtils.loadURI( browser, "data:text/html,<div contentEditable='true'>hello!</div>" ); await BrowserTestUtils.browserLoaded(browser); browser.focus(); await new Promise(resolve => waitForFocus(resolve, window)); await new Promise(resolve => window.requestAnimationFrame(() => executeSoon(resolve)) ); await new Promise(openMenu); menu_cut_disabled = menuPopup.querySelector("#menu_cut").getAttribute("disabled") == "true"; is(menu_cut_disabled, false, "menu_cut should be enabled"); menu_copy_disabled = menuPopup.querySelector("#menu_copy").getAttribute("disabled") == "true"; is(menu_copy_disabled, false, "menu_copy should be enabled"); await new Promise(closeMenu); await BrowserTestUtils.loadURI(browser, "about:preferences"); await BrowserTestUtils.browserLoaded(browser); browser.focus(); await new Promise(resolve => waitForFocus(resolve, window)); await new Promise(resolve => window.requestAnimationFrame(() => executeSoon(resolve)) ); await new Promise(openMenu); menu_cut_disabled = menuPopup.querySelector("#menu_cut").getAttribute("disabled") == "true"; is(menu_cut_disabled, true, "menu_cut should be disabled"); menu_copy_disabled = menuPopup.querySelector("#menu_copy").getAttribute("disabled") == "true"; is(menu_copy_disabled, true, "menu_copy should be disabled"); await new Promise(closeMenu); } ); });
{ "pile_set_name": "Github" }
#include <CryEntitySystem/IEntitySystem.h> class CMyEventComponent final : public IEntityComponent { public: // Provide a virtual destructor, ensuring correct destruction of IEntityComponent members virtual ~CMyEventComponent() = default; static void ReflectType(Schematyc::CTypeDesc<CMyEventComponent>& desc) { /* Reflect the component GUID in here. */} // Override the ProcessEvent function to receive the callback whenever an event specified in GetEventMask is triggered virtual void ProcessEvent(const SEntityEvent& event) override { // Check if this is the update event if (event.event == ENTITY_EVENT_UPDATE) { // The Update event provides delta time as the first floating-point parameter const float frameTime = event.fParam[0]; /* Handle update logic here */ } } // As an optimization, components have to specify a bitmask of the events that they want to handle // This is called once at component creation, and then only if IEntity::UpdateComponentEventMask is called, to support dynamic change of desired events (useful for disabling update when you don't need it) virtual Cry::Entity::EventFlags GetEventMask() const override { return ENTITY_EVENT_UPDATE; } };
{ "pile_set_name": "Github" }
aws-sign ======== AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.
{ "pile_set_name": "Github" }
// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt // Project developers. See the top-level LICENSE file for dates and other // details. No copyright assignment is required to contribute to VisIt. // ************************************************************************* // // avtTensorGlyphMapper.h // // ************************************************************************* // #ifndef AVT_TENSOR_GLYPH_MAPPER_H #define AVT_TENSOR_GLYPH_MAPPER_H #include <plotter_exports.h> #include <avtMapper.h> class vtkVisItTensorGlyph; class vtkAlgorithmOutput; class vtkLookupTable; class vtkPolyData; // **************************************************************************** // Class: avtTensorGlyphMapper // // Purpose: // A mapper for tensor. This extends the functionality of a mapper by // glyphing tensors onto ellipsoids. // // Programmer: Hank Childs // Creation: September 23, 2003 // // Modifications: // // Hank Childs, Wed May 5 16:23:29 PDT 2004 // Add normals calculation. // // Eric Brugger, Wed Nov 24 12:58:22 PST 2004 // Added scaleByMagnitude and autoScale. // // Kathleen Bonnell, Tue Aug 30 15:11:01 PDT 2005 // Use VisIt's version of TensorGlyph so that orignal zone and node // arrays can be copied through. // // Kathleen Biagas, Wed Feb 6 19:38:27 PST 2013 // Changed signature of InsertFilters. // // Kathleen Biagas, Thu Feb 7 08:45:03 PST 2013 // Changed signature of constructor to accept vtkAlgorithmInput in order // to preserve pipeline connections with vtk-6. // // Kathleen Biagas, Thu Mar 14 13:03:50 PDT 2013 // Remove normalsFilter. // // **************************************************************************** class PLOTTER_API avtTensorGlyphMapper : public avtMapper { public: avtTensorGlyphMapper(vtkAlgorithmOutput *); virtual ~avtTensorGlyphMapper(); void ColorByMagOn(void); void ColorByMagOff(const unsigned char [3]); void SetScale(double); void SetScaleByMagnitude(bool); void SetAutoScale(bool); void SetLookupTable(vtkLookupTable *lut); // methods for setting limits for coloring void SetLimitsMode(const int); void SetMin(double); void SetMinOff(void); void SetMax(double); void SetMaxOff(void); virtual bool GetRange(double &, double &); virtual bool GetCurrentRange(double &, double &); bool GetVarRange(double &, double &); protected: vtkAlgorithmOutput *glyph; vtkLookupTable *lut; bool colorByMag; unsigned char glyphColor[3]; double scale; bool scaleByMagnitude; bool autoScale; double min, max; bool setMin, setMax; int limitsMode; vtkVisItTensorGlyph **tensorFilter; int nTensorFilters; virtual void CustomizeMappers(void); void SetMappersMinMax(void); virtual vtkAlgorithmOutput *InsertFilters(vtkDataSet *, int); virtual void SetUpFilters(int); }; #endif
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <root> <!-- Microsoft ResX Schema Version 2.0 The primary goals of this format is to allow a simple XML format that is mostly human readable. The generation and parsing of the various data types are done through the TypeConverter classes associated with the data types. Example: ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">2.0</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <value>[base64 mime encoded serialized .NET Framework object]</value> </data> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <comment>This is a comment</comment> </data> There are any number of "resheader" rows that contain simple name/value pairs. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support text/value conversion through the TypeConverter architecture. Classes that don't support this are serialized and stored with the mimetype set. The mimetype is used for serialized objects, and tells the ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="metadata"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" /> </xsd:sequence> <xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> <xsd:complexType> <xsd:attribute name="alias" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" /> </xsd:complexType> </xsd:element> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>2.0</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> </root>
{ "pile_set_name": "Github" }
/* * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ #include <X11/Xlib.h> #include <X11/Xatom.h> #include <gdk/gdk.h> #include <gdk/gdkx.h> #include <gtk/gtk.h> #include <glib.h> #include <cstdlib> #include <com_sun_glass_ui_gtk_GtkApplication.h> #include <com_sun_glass_events_WindowEvent.h> #include <com_sun_glass_events_MouseEvent.h> #include <com_sun_glass_events_ViewEvent.h> #include <com_sun_glass_events_KeyEvent.h> #include <jni.h> #include "glass_general.h" #include "glass_evloop.h" #include "glass_dnd.h" #include "glass_window.h" #include "glass_screen.h" GdkEventFunc process_events_prev; static void process_events(GdkEvent*, gpointer); JNIEnv* mainEnv; // Use only with main loop thread!!! extern gboolean disableGrab; static gboolean call_runnable (gpointer data) { RunnableContext* context = reinterpret_cast<RunnableContext*>(data); JNIEnv *env; int envStatus = javaVM->GetEnv((void **)&env, JNI_VERSION_1_6); if (envStatus == JNI_EDETACHED) { javaVM->AttachCurrentThread((void **)&env, NULL); } env->CallVoidMethod(context->runnable, jRunnableRun, NULL); LOG_EXCEPTION(env); env->DeleteGlobalRef(context->runnable); free(context); if (envStatus == JNI_EDETACHED) { javaVM->DetachCurrentThread(); } return FALSE; } extern "C" { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" static void init_threads() { gboolean is_g_thread_get_initialized = FALSE; if (glib_check_version(2, 32, 0)) { // < 2.32 if (!glib_check_version(2, 20, 0)) { is_g_thread_get_initialized = g_thread_get_initialized(); } if (!is_g_thread_get_initialized) { g_thread_init(NULL); } } gdk_threads_init(); } #pragma GCC diagnostic pop jboolean gtk_verbose = JNI_FALSE; /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: _initGTK * Signature: (IZ)I */ JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkApplication__1initGTK (JNIEnv *env, jclass clazz, jint version, jboolean verbose, jfloat uiScale) { (void) clazz; (void) version; OverrideUIScale = uiScale; gtk_verbose = verbose; env->ExceptionClear(); init_threads(); gdk_threads_enter(); gtk_init(NULL, NULL); return JNI_TRUE; } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: _queryLibrary * Signature: Signature: (IZ)I */ #ifndef STATIC_BUILD JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkApplication__1queryLibrary (JNIEnv *env, jclass clazz, jint suggestedVersion, jboolean verbose) { // If we are being called, then the launcher is // not in use, and we are in the proper glass library already. // This can be done by renaming the gtk versioned native // libraries to be libglass.so // Note: we will make no effort to complain if the suggestedVersion // is out of phase. (void)env; (void)clazz; (void)suggestedVersion; (void)verbose; Display *display = XOpenDisplay(NULL); if (display == NULL) { return com_sun_glass_ui_gtk_GtkApplication_QUERY_NO_DISPLAY; } XCloseDisplay(display); return com_sun_glass_ui_gtk_GtkApplication_QUERY_USE_CURRENT; } #endif /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: _init * Signature: ()V */ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkApplication__1init (JNIEnv * env, jobject obj, jlong handler, jboolean _disableGrab) { (void)obj; mainEnv = env; process_events_prev = (GdkEventFunc) handler; disableGrab = (gboolean) _disableGrab; glass_gdk_x11_display_set_window_scale(gdk_display_get_default(), 1); gdk_event_handler_set(process_events, NULL, NULL); GdkScreen *default_gdk_screen = gdk_screen_get_default(); if (default_gdk_screen != NULL) { g_signal_connect(G_OBJECT(default_gdk_screen), "monitors-changed", G_CALLBACK(screen_settings_changed), NULL); g_signal_connect(G_OBJECT(default_gdk_screen), "size-changed", G_CALLBACK(screen_settings_changed), NULL); } GdkWindow *root = gdk_screen_get_root_window(default_gdk_screen); gdk_window_set_events(root, static_cast<GdkEventMask>(gdk_window_get_events(root) | GDK_PROPERTY_CHANGE_MASK)); } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: _runLoop * Signature: (Ljava/lang/Runnable;Z)V */ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkApplication__1runLoop (JNIEnv * env, jobject obj, jobject launchable, jboolean noErrorTrap) { (void)obj; (void)noErrorTrap; env->CallVoidMethod(launchable, jRunnableRun); CHECK_JNI_EXCEPTION(env); // GTK installs its own X error handler that conflicts with AWT. // During drag and drop, AWT hides errors so we need to hide them // to avoid exit()'ing. It's not clear that we don't want to hide // X error all the time, otherwise FX will exit(). // // A better solution would be to coordinate with AWT and save and // restore the X handler. // Disable X error handling #ifndef VERBOSE if (!noErrorTrap) { gdk_error_trap_push(); } #endif gtk_main(); // When the last JFrame closes and DISPOSE_ON_CLOSE is specified, // Java exits with an X error. X error are hidden during the FX // event loop and should be restored when the event loop exits. Unfortunately, // this is too early. The fix is to never restore X errors. // // See RT-21408 & RT-20756 // Restore X error handling // #ifndef VERBOSE // if (!noErrorTrap) { // gdk_error_trap_pop(); // } // #endif gdk_threads_leave(); } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: _terminateLoop * Signature: ()V */ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkApplication__1terminateLoop (JNIEnv * env, jobject obj) { (void)env; (void)obj; gtk_main_quit(); } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: _submitForLaterInvocation * Signature: (Ljava/lang/Runnable;)V */ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkApplication__1submitForLaterInvocation (JNIEnv * env, jobject obj, jobject runnable) { (void)obj; RunnableContext* context = (RunnableContext*)malloc(sizeof(RunnableContext)); context->runnable = env->NewGlobalRef(runnable); gdk_threads_add_idle_full(G_PRIORITY_HIGH_IDLE + 30, call_runnable, context, NULL); } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: enterNestedEventLoopImpl * Signature: ()V */ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkApplication_enterNestedEventLoopImpl (JNIEnv * env, jobject obj) { (void)env; (void)obj; gtk_main(); } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: leaveNestedEventLoopImpl * Signature: ()V */ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkApplication_leaveNestedEventLoopImpl (JNIEnv * env, jobject obj) { (void)env; (void)obj; gtk_main_quit(); } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: staticScreen_getScreens * Signature: ()[Lcom/sun/glass/ui/Screen; */ JNIEXPORT jobjectArray JNICALL Java_com_sun_glass_ui_gtk_GtkApplication_staticScreen_1getScreens (JNIEnv * env, jobject obj) { (void)obj; try { return rebuild_screens(env); } catch (jni_exception&) { return NULL; } } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: staticTimer_getMinPeriod * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkApplication_staticTimer_1getMinPeriod (JNIEnv * env, jobject obj) { (void)env; (void)obj; return 0; // There are no restrictions on period in g_threads } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: staticTimer_getMaxPeriod * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkApplication_staticTimer_1getMaxPeriod (JNIEnv * env, jobject obj) { (void)env; (void)obj; return 10000; // There are no restrictions on period in g_threads } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: staticView_getMultiClickTime * Signature: ()J */ JNIEXPORT jlong JNICALL Java_com_sun_glass_ui_gtk_GtkApplication_staticView_1getMultiClickTime (JNIEnv * env, jobject obj) { (void)env; (void)obj; static gint multi_click_time = -1; if (multi_click_time == -1) { g_object_get(gtk_settings_get_default(), "gtk-double-click-time", &multi_click_time, NULL); } return (jlong)multi_click_time; } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: staticView_getMultiClickMaxX * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkApplication_staticView_1getMultiClickMaxX (JNIEnv * env, jobject obj) { (void)env; (void)obj; static gint multi_click_dist = -1; if (multi_click_dist == -1) { g_object_get(gtk_settings_get_default(), "gtk-double-click-distance", &multi_click_dist, NULL); } return multi_click_dist; } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: staticView_getMultiClickMaxY * Signature: ()I */ JNIEXPORT jint JNICALL Java_com_sun_glass_ui_gtk_GtkApplication_staticView_1getMultiClickMaxY (JNIEnv * env, jobject obj) { return Java_com_sun_glass_ui_gtk_GtkApplication_staticView_1getMultiClickMaxX(env, obj); } /* * Class: com_sun_glass_ui_gtk_GtkApplication * Method: _supportsTransparentWindows * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_com_sun_glass_ui_gtk_GtkApplication__1supportsTransparentWindows (JNIEnv * env, jobject obj) { (void)env; (void)obj; return gdk_display_supports_composite(gdk_display_get_default()) && gdk_screen_is_composited(gdk_screen_get_default()); } } // extern "C" bool is_window_enabled_for_event(GdkWindow * window, WindowContext *ctx, gint event_type) { if (gdk_window_is_destroyed(window)) { return FALSE; } /* * GDK_DELETE can be blocked for disabled window e.q. parent window * which prevents from closing it */ switch (event_type) { case GDK_CONFIGURE: case GDK_DESTROY: case GDK_EXPOSE: case GDK_DAMAGE: case GDK_WINDOW_STATE: case GDK_FOCUS_CHANGE: return TRUE; break; }//switch if (ctx != NULL ) { return ctx->isEnabled(); } return TRUE; } static void process_events(GdkEvent* event, gpointer data) { GdkWindow* window = event->any.window; WindowContext *ctx = window != NULL ? (WindowContext*) g_object_get_data(G_OBJECT(window), GDK_WINDOW_DATA_CONTEXT) : NULL; if ((window != NULL) && !is_window_enabled_for_event(window, ctx, event->type)) { return; } if (ctx != NULL && ctx->hasIME() && ctx->filterIME(event)) { return; } glass_evloop_call_hooks(event); if (ctx != NULL && dynamic_cast<WindowContextPlug*>(ctx) && ctx->get_gtk_window()) { WindowContextPlug* ctx_plug = dynamic_cast<WindowContextPlug*>(ctx); if (!ctx_plug->embedded_children.empty()) { // forward to child ctx = (WindowContext*) ctx_plug->embedded_children.back(); window = ctx->get_gdk_window(); } } if (ctx != NULL) { EventsCounterHelper helper(ctx); try { switch (event->type) { case GDK_PROPERTY_NOTIFY: ctx->process_property_notify(&event->property); gtk_main_do_event(event); break; case GDK_CONFIGURE: ctx->process_configure(&event->configure); gtk_main_do_event(event); break; case GDK_FOCUS_CHANGE: ctx->process_focus(&event->focus_change); gtk_main_do_event(event); break; case GDK_DESTROY: destroy_and_delete_ctx(ctx); gtk_main_do_event(event); break; case GDK_DELETE: ctx->process_delete(); break; case GDK_EXPOSE: case GDK_DAMAGE: ctx->process_expose(&event->expose); break; case GDK_WINDOW_STATE: ctx->process_state(&event->window_state); gtk_main_do_event(event); break; case GDK_BUTTON_PRESS: case GDK_BUTTON_RELEASE: ctx->process_mouse_button(&event->button); break; case GDK_MOTION_NOTIFY: ctx->process_mouse_motion(&event->motion); gdk_event_request_motions(&event->motion); break; case GDK_SCROLL: ctx->process_mouse_scroll(&event->scroll); break; case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: ctx->process_mouse_cross(&event->crossing); break; case GDK_KEY_PRESS: case GDK_KEY_RELEASE: ctx->process_key(&event->key); break; case GDK_DROP_START: case GDK_DRAG_ENTER: case GDK_DRAG_LEAVE: case GDK_DRAG_MOTION: process_dnd_target(ctx, &event->dnd); break; case GDK_MAP: ctx->process_map(); // fall-through case GDK_UNMAP: case GDK_CLIENT_EVENT: case GDK_VISIBILITY_NOTIFY: case GDK_SETTING: case GDK_OWNER_CHANGE: gtk_main_do_event(event); break; default: break; } } catch (jni_exception&) { } } else { if (window == gdk_screen_get_root_window(gdk_screen_get_default())) { if (event->any.type == GDK_PROPERTY_NOTIFY) { if (event->property.atom == gdk_atom_intern_static_string("_NET_WORKAREA") || event->property.atom == gdk_atom_intern_static_string("_NET_CURRENT_DESKTOP")) { screen_settings_changed(gdk_screen_get_default(), NULL); } } } //process only for non-FX windows if (process_events_prev != NULL) { (*process_events_prev)(event, data); } else { gtk_main_do_event(event); } } }
{ "pile_set_name": "Github" }
# Links [Internal Link](some-file.md)<br> [Internal Full Link](https://github.com/SAP/luigi/blob/master/docs/application-setup.md)<br> [External Link](https://luigi-project.io)<br> [Anchor Link](#noframework) <br> <a name="noframework"></a>
{ "pile_set_name": "Github" }
/* * Copyright (C) 2011 The Guava Authors * * 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. */ package com.google.common.util.concurrent; import com.google.common.annotations.GwtIncompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.concurrent.Callable; /** * A listening executor service which forwards all its method calls to another listening executor * service. Subclasses should override one or more methods to modify the behavior of the backing * executor service as desired per the <a * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>. * * @author Isaac Shum * @since 10.0 */ @CanIgnoreReturnValue // TODO(cpovirk): Consider being more strict. @GwtIncompatible public abstract class ForwardingListeningExecutorService extends ForwardingExecutorService implements ListeningExecutorService { /** Constructor for use by subclasses. */ protected ForwardingListeningExecutorService() {} @Override protected abstract ListeningExecutorService delegate(); @Override public <T> ListenableFuture<T> submit(Callable<T> task) { return delegate().submit(task); } @Override public ListenableFuture<?> submit(Runnable task) { return delegate().submit(task); } @Override public <T> ListenableFuture<T> submit(Runnable task, T result) { return delegate().submit(task, result); } }
{ "pile_set_name": "Github" }
UpdateTransferDeviceDetails =========================== .. currentmodule:: oci.dts.models .. autoclass:: UpdateTransferDeviceDetails :show-inheritance: :special-members: __init__ :members: :undoc-members: :inherited-members:
{ "pile_set_name": "Github" }
#include "ares-test.h" #ifdef HAVE_CONTAINER #include <sys/mount.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <iostream> #include <functional> #include <string> #include <sstream> #include <vector> namespace ares { namespace test { namespace { struct ContainerInfo { ContainerFilesystem* fs_; std::string hostname_; std::string domainname_; VoidToIntFn fn_; }; int EnterContainer(void *data) { ContainerInfo *container = (ContainerInfo*)data; if (verbose) { std::cerr << "Running function in container {chroot='" << container->fs_->root() << "', hostname='" << container->hostname_ << "', domainname='" << container->domainname_ << "'}" << std::endl; } // Ensure we are apparently root before continuing. int count = 10; while (getuid() != 0 && count > 0) { usleep(100000); count--; } if (getuid() != 0) { std::cerr << "Child in user namespace has uid " << getuid() << std::endl; return -1; } if (!container->fs_->mountpt().empty()) { // We want to bind mount this inside the specified directory. std::string innerdir = container->fs_->root() + container->fs_->mountpt(); if (verbose) std::cerr << " mount --bind " << container->fs_->mountpt() << " " << innerdir << std::endl; int rc = mount(container->fs_->mountpt().c_str(), innerdir.c_str(), "none", MS_BIND, 0); if (rc != 0) { std::cerr << "Warning: failed to bind mount " << container->fs_->mountpt() << " at " << innerdir << ", errno=" << errno << std::endl; } } // Move into the specified directory. if (chdir(container->fs_->root().c_str()) != 0) { std::cerr << "Failed to chdir('" << container->fs_->root() << "'), errno=" << errno << std::endl; return -1; } // And make it the new root directory; char buffer[PATH_MAX + 1]; if (getcwd(buffer, PATH_MAX) == NULL) { std::cerr << "failed to retrieve cwd, errno=" << errno << std::endl; return -1; } buffer[PATH_MAX] = '\0'; if (chroot(buffer) != 0) { std::cerr << "chroot('" << buffer << "') failed, errno=" << errno << std::endl; return -1; } // Set host/domainnames if specified if (!container->hostname_.empty()) { if (sethostname(container->hostname_.c_str(), container->hostname_.size()) != 0) { std::cerr << "Failed to sethostname('" << container->hostname_ << "'), errno=" << errno << std::endl; return -1; } } if (!container->domainname_.empty()) { if (setdomainname(container->domainname_.c_str(), container->domainname_.size()) != 0) { std::cerr << "Failed to setdomainname('" << container->domainname_ << "'), errno=" << errno << std::endl; return -1; } } return container->fn_(); } } // namespace // Run a function while: // - chroot()ed into a particular directory // - having a specified hostname/domainname int RunInContainer(ContainerFilesystem* fs, const std::string& hostname, const std::string& domainname, VoidToIntFn fn) { const int stack_size = 1024 * 1024; std::vector<byte> stack(stack_size, 0); ContainerInfo container = {fs, hostname, domainname, fn}; // Start a child process in a new user and UTS namespace pid_t child = clone(EnterContainer, stack.data() + stack_size, CLONE_VM|CLONE_NEWNS|CLONE_NEWUSER|CLONE_NEWUTS|SIGCHLD, (void *)&container); if (child < 0) { std::cerr << "Failed to clone(), errno=" << errno << std::endl; return -1; } // Build the UID map that makes us look like root inside the namespace. std::stringstream mapfiless; mapfiless << "/proc/" << child << "/uid_map"; std::string mapfile = mapfiless.str(); int fd = open(mapfile.c_str(), O_CREAT|O_WRONLY|O_TRUNC, 0644); if (fd < 0) { std::cerr << "Failed to create '" << mapfile << "'" << std::endl; return -1; } std::stringstream contentss; contentss << "0 " << getuid() << " 1" << std::endl; std::string content = contentss.str(); int rc = write(fd, content.c_str(), content.size()); if (rc != (int)content.size()) { std::cerr << "Failed to write uid map to '" << mapfile << "'" << std::endl; } close(fd); // Wait for the child process and retrieve its status. int status; waitpid(child, &status, 0); if (rc <= 0) { std::cerr << "Failed to waitpid(" << child << ")" << std::endl; return -1; } if (!WIFEXITED(status)) { std::cerr << "Child " << child << " did not exit normally" << std::endl; return -1; } return status; } ContainerFilesystem::ContainerFilesystem(NameContentList files, const std::string& mountpt) { rootdir_ = TempNam(nullptr, "ares-chroot"); mkdir(rootdir_.c_str(), 0755); dirs_.push_front(rootdir_); for (const auto& nc : files) { std::string fullpath = rootdir_ + nc.first; int idx = fullpath.rfind('/'); std::string dir = fullpath.substr(0, idx); EnsureDirExists(dir); files_.push_back(std::unique_ptr<TransientFile>( new TransientFile(fullpath, nc.second))); } if (!mountpt.empty()) { char buffer[PATH_MAX + 1]; if (realpath(mountpt.c_str(), buffer)) { mountpt_ = buffer; std::string fullpath = rootdir_ + mountpt_; EnsureDirExists(fullpath); } } } ContainerFilesystem::~ContainerFilesystem() { files_.clear(); for (const std::string& dir : dirs_) { rmdir(dir.c_str()); } } void ContainerFilesystem::EnsureDirExists(const std::string& dir) { if (std::find(dirs_.begin(), dirs_.end(), dir) != dirs_.end()) { return; } size_t idx = dir.rfind('/'); if (idx != std::string::npos) { std::string prevdir = dir.substr(0, idx); EnsureDirExists(prevdir); } // Ensure this directory is in the list before its ancestors. mkdir(dir.c_str(), 0755); dirs_.push_front(dir); } } // namespace test } // namespace ares #endif
{ "pile_set_name": "Github" }
// mainfrm.h : interface of the CMainFrame class // // This is a part of the Microsoft Foundation Classes C++ library. // Copyright (c) Microsoft Corporation. All rights reserved. // // This source code is only intended as a supplement to the // Microsoft Foundation Classes Reference and related // electronic documentation provided with the library. // See these sources for detailed information regarding the // Microsoft Foundation Classes product. ///////////////////////////////////////////////////////////////////////////// class CMainFrame : public CMDIFrameWnd { DECLARE_DYNAMIC(CMainFrame) public: CMainFrame(); // Attributes public: // Operations public: // Implementation public: virtual ~CMainFrame(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // control bar embedded members CStatusBar m_wndStatusBar; CToolBar m_wndToolBar; // Generated message map functions protected: //{{AFX_MSG(CMainFrame) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; /////////////////////////////////////////////////////////////////////////////
{ "pile_set_name": "Github" }
module.exports = { 'countBy': require('./countBy'), 'each': require('./each'), 'eachRight': require('./eachRight'), 'every': require('./every'), 'filter': require('./filter'), 'find': require('./find'), 'findLast': require('./findLast'), 'flatMap': require('./flatMap'), 'flatMapDeep': require('./flatMapDeep'), 'flatMapDepth': require('./flatMapDepth'), 'forEach': require('./forEach'), 'forEachRight': require('./forEachRight'), 'groupBy': require('./groupBy'), 'includes': require('./includes'), 'invokeMap': require('./invokeMap'), 'keyBy': require('./keyBy'), 'map': require('./map'), 'orderBy': require('./orderBy'), 'partition': require('./partition'), 'reduce': require('./reduce'), 'reduceRight': require('./reduceRight'), 'reject': require('./reject'), 'sample': require('./sample'), 'sampleSize': require('./sampleSize'), 'shuffle': require('./shuffle'), 'size': require('./size'), 'some': require('./some'), 'sortBy': require('./sortBy') };
{ "pile_set_name": "Github" }
define( [ "../core", "../var/document", "../var/isFunction" ], function( jQuery, document, isFunction ) { "use strict"; var readyCallbacks = [], whenReady = function( fn ) { readyCallbacks.push( fn ); }, executeReady = function( fn ) { // Prevent errors from freezing future callback execution (gh-1823) // Not backwards-compatible as this does not execute sync window.setTimeout( function() { fn.call( document, jQuery ); } ); }; jQuery.fn.ready = function( fn ) { whenReady( fn ); return this; }; jQuery.extend( { // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } whenReady = function( fn ) { readyCallbacks.push( fn ); while ( readyCallbacks.length ) { fn = readyCallbacks.shift(); if ( isFunction( fn ) ) { executeReady( fn ); } } }; whenReady(); } } ); // Make jQuery.ready Promise consumable (gh-1778) jQuery.ready.then = jQuery.fn.ready; /** * The ready event handler and self cleanup method */ function completed() { document.removeEventListener( "DOMContentLoaded", completed ); window.removeEventListener( "load", completed ); jQuery.ready(); } // Catch cases where $(document).ready() is called // after the browser event has already occurred. // Support: IE9-10 only // Older IE sometimes signals "interactive" too soon if ( document.readyState === "complete" || ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { // Handle it asynchronously to allow scripts the opportunity to delay ready window.setTimeout( jQuery.ready ); } else { // Use the handy event callback document.addEventListener( "DOMContentLoaded", completed ); // A fallback to window.onload, that will always work window.addEventListener( "load", completed ); } } );
{ "pile_set_name": "Github" }
error: rustc_outlives --> $DIR/explicit-dyn.rs:8:1 | LL | / struct Foo<'a, A> LL | | { LL | | foo: Box<dyn Trait<'a, A>> LL | | } | |_^ | = note: A: 'a error: aborting due to previous error
{ "pile_set_name": "Github" }
swig-openframeworks ------------------- a SWIG interface for openFrameworks with included Makefile Copyright (c) [Dan Wilcox](danomatika.com) 2015-2018 BSD Simplified License. For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "LICENSE.txt," in this distribution. See <https://github.com/danomatika/swig-openframeworks> for documentation Description ----------- swig-openframeworks provides a centralized OpenFrameworks API interface file for the Simple Wrapper and Interface Generator (SWIG) tool which can be used to generate C++ bindings for various scripting languages, including Lua, Python, and Javascript. [SWIG](http://www.swig.org) is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. Installation ------------ This repository is designed to be used as a submodule within OpenFrameworks addons which provide scripting access to OF. The suggested installation is to the `swig` folder in your main repo: git submodule add https://github.com/danomatika/swig-openframeworks.git swig Git users of your addon will then need to checkout this submodule when they clone your addon: git submodule init git submodule update ### Which version to use? If you are using a stable version (0.8.4, 0.9.0, ...) of OpenFrameworks then you want to use a git tag of swig-openframeworks for that version. You can select the tag in the Github "Current Branch" menu or clone and check it out using git. The master branch of swig-openframeworks will work with the current stable version. OF API Bindings --------------- Currently the swig interface file covers *most* of the api while leaving out base classes. It creates a module containing all the imported functions, classes, constants & enums. To see the main differences with the OF C++ API run the following: find . -name "*.i" -exec grep "// DIFF" {} \; To see work to be done on the bindings run: find . -name "*.i" -exec grep "// TODO" {} \; To see attributes which can be added to various classes: find . -name "*.i" -exec grep "// ATTR" {} \; Currently supported (aka tested) scripting languages are: * Lua * Python Other language bindings supported by swig can be generated. Feel free to create a PR adding required updates to the Makefile and interface file. ### Lua In Lua, all wrapped functions, classes, defines, and enums are added to an "of" module (aka table) like a Lua library. The contents of the module are renamed by default: * **function**: ofBackground -> of.background * **class**: ofColor -> of.Color * **constant**: OF_LOG_VERBOSE -> of.LOG_VERBOSE * **enum**: ofShader::POSITION_ATTRIBUTE -> of.Shader.POSITION_ATTRIBUTE ### Python In Python, the module (aka library) is called "openframeworks" and its members retain the "of" prefix: from openframeworks import * ofBackground(255) color = ofColor() ... glm Bindings ------------ As of openFrameworks 0.10.0, the glm library math types (vec3, mat3, quat, etc) have become integral to the OF API and are now wrapped via a swig interface as well. The resulting module is named "glm" and associated functions and types are accessed from within this name space. For example, in Lua: -- constructors local v1 = glm.vec3(1, 2, 3) local v2 = glm.vec3(4, 5, 6) -- operators local v3 = v1 + v2 v3 = v2 / v1 -- functions local dot = glm.dot(v1, v2) One **important point**: Most scripting languages cannot support the casting operators which allow the OF math types (ofVec3f, ofMatrix3x3, etc) to be used with functions which take glm type arguments. To get around this problem, each math type has a special member function which returns the associated glm type: * ofVec2f -> glm::vec2: vec2() * ofVec3f -> glm::vec3: vec3() * ofVec4f -> glm::vec4: vec4() * ofQuaternion -> glm::quat: quat() * ofMatrix3x3 -> glm::mat4: mat3() * ofMatrix4x4 -> glm::mat4: mat4() Essentially, the following will *not* work as it does in C++: -- error! local v = of.Vec2f(100, 100) of.drawRectangle(v, 20, 20) -- needs a glm.vec2 Either convert the OF math type to a glm type or use a glm type directly: -- convert local v = of.Vec2f(100, 100) of.drawRectangle(v.vec2(), 20, 20) -- use glm::vec2 local v = glm.vec2(100, 100) of.drawRectangle(v, 20, 20) Usage ----- A Makefile is provided to handle SWIG and platform specific details. It generates both a .cpp binding implementation as well as a .h header for SWIG helper functions. Basic usage is: make which generates Lua bindings for desktop OSs and places them in `../src/bindings/desktop`. ### Languages Available scripting languages are listed by the SWIG help: `swig -h`. The language can be set by the LANG makefile variable and is `lua` by default. Example: To generate python bindings for desktop: make LANG=python ### Platforms The Makefile current supports generating bindings for the following target platforms: * **desktop**: win, linux, & mac osx * **ios**: apple iOS using OpenGL ES * **linuxarm**: embedded linux using OpenGL ES Generated bindings are placed within platform subfolders in the destination directory. Example: To generate python bindings for iOS: make ios LANG=python ### Destination Dir The destination directory where the bindings are installed can be set by the DEST_DIR makefile variable and is `../src/bindings` by default. Example: To generate python bindings for desktop and place them in a nearby test dir: make desktop LANG=python DEST_DIR=test ### Bindings Filename The Makefile generates bindings files using the NAME makefile variable and is `openFrameworks_wrap` by default. Example: To generate python bindings for desktop with the name "ofxPythonBindings": make desktop LANG=python NAME=ofxPythonBindings ### Module Name The scripting language bindings use the "of" module by default. In the case of Lua, this refers to the parent "of" table that contains all warped functions, classes, and defines. This may not be desirable for particular scripting languages (ie. Python), so the module name can be set using the MODULE_NAME makefile variable. Example: To generate python bindings with the module name "openframeworks": make LANG=python MODULE_NAME=openframeworks ### Renaming By default, functions, classes, enums, & defines are reamed to strip the "of" prefix. This may not be desirable for particular scripting languages (ie. Python) and can be disabled by setting the MODULE_NAME makefile variable to false: make RENAME=false ### Deprecated Functions & Classes By default, functions & classes marked as deprecated in the OF api are ignored when generating bindings. If you want to allow deprecations, set the DEPRECATED makefile variable to true: make DEPRECATED=true ### Attributes Many target scripting languages support attributes using getters/setters, ie: -- lua image = of.Image("hello.png") print("width: "..image:getWidth()) print("width: "..image.width) -- same as above using a getter attribute To enable attribute bindings, set the ATTRIBUTES makefile variable to true: make ATTRIBUTES=true ### SWIG Flags SWIG has a large number of flags for customizing bindings generation, many of which are specific to each generated language. The Makefile uses the SWIG_FLAGS makefile variable for these extra options, for instance generating Python bindings uses the `-modern` option to focus on newer versions of Python. ### Scripting Generating bindings for all platform targets can be done easily using a script which calls the Makefile. See [generate_bindings.sh](https://github.com/danomatika/ofxLua/blob/swig/scripts/generate_bindings.sh) in ofxLua for an example. ### Debugging Debugging scripting language bindings can be a pain, so SWIG can output the binding symbols for the target language. The Makefile provides a target that creates a `of_LANG_symbols.txt` so you can see which classes, functions, & enums are being wrapped and how. Example: To debug python bindings: make symbols LANG=python generates a file called `of_python_symbols.txt`. Example ------- swig-openframeworks was originally developed for ofxLua which is using it as a submodule in the "swig" branch: <https://github.com/danomatika/ofxLua/tree/swig> Developing ---------- You can help develop swig-openframeworks on GitHub: <https://github.com/danomatika/swig-openframeworks> Create an account, clone or fork the repo, then request a push/merge. If you find any bugs or suggestions please log them to GitHub as well.
{ "pile_set_name": "Github" }
#import "WKInterfaceTable+TGDataDrivenTable.h" @class TGBridgeWebPageMediaAttachment; @interface TGMessageViewWebPageRowController : TGTableRowController @property (nonatomic, weak) IBOutlet WKInterfaceLabel *siteNameLabel; @property (nonatomic, weak) IBOutlet WKInterfaceLabel *titleLabel; @property (nonatomic, weak) IBOutlet WKInterfaceGroup *titleImageGroup; @property (nonatomic, weak) IBOutlet WKInterfaceLabel *textLabel; @property (nonatomic, weak) IBOutlet WKInterfaceGroup *imageGroup; @property (nonatomic, weak) IBOutlet WKInterfaceImage *activityIndicator; @property (nonatomic, weak) IBOutlet WKInterfaceGroup *durationGroup; @property (nonatomic, weak) IBOutlet WKInterfaceLabel *durationLabel; - (void)updateWithAttachment:(TGBridgeWebPageMediaAttachment *)attachment; @end
{ "pile_set_name": "Github" }
// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_GEOMETRIES_REGISTER_SEGMENT_HPP #define BOOST_GEOMETRY_GEOMETRIES_REGISTER_SEGMENT_HPP #ifndef DOXYGEN_NO_SPECIALIZATIONS #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS(Segment, Point, Index0, Index1) \ template <size_t D> \ struct indexed_access<Segment, min_corner, D> \ { \ typedef typename coordinate_type<Point>::type ct; \ static inline ct get(Segment const& b) \ { return geometry::get<D>(b. Index0); } \ static inline void set(Segment& b, ct const& value) \ { geometry::set<D>(b. Index0, value); } \ }; \ template <size_t D> \ struct indexed_access<Segment, max_corner, D> \ { \ typedef typename coordinate_type<Point>::type ct; \ static inline ct get(Segment const& b) \ { return geometry::get<D>(b. Index1); } \ static inline void set(Segment& b, ct const& value) \ { geometry::set<D>(b. Index1, value); } \ }; #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_TEMPLATIZED(Segment, Index0, Index1) \ template <typename P, size_t D> \ struct indexed_access<Segment<P>, min_corner, D> \ { \ typedef typename coordinate_type<P>::type ct; \ static inline ct get(Segment<P> const& b) \ { return geometry::get<D>(b. Index0); } \ static inline void set(Segment<P>& b, ct const& value) \ { geometry::set<D>(b. Index0, value); } \ }; \ template <typename P, size_t D> \ struct indexed_access<Segment<P>, max_corner, D> \ { \ typedef typename coordinate_type<P>::type ct; \ static inline ct get(Segment<P> const& b) \ { return geometry::get<D>(b. Index1); } \ static inline void set(Segment<P>& b, ct const& value) \ { geometry::set<D>(b. Index1, value); } \ }; #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_4VALUES(Segment, Point, Left, Bottom, Right, Top) \ template <> struct indexed_access<Segment, min_corner, 0> \ { \ typedef coordinate_type<Point>::type ct; \ static inline ct get(Segment const& b) { return b. Left; } \ static inline void set(Segment& b, ct const& value) { b. Left = value; } \ }; \ template <> struct indexed_access<Segment, min_corner, 1> \ { \ typedef coordinate_type<Point>::type ct; \ static inline ct get(Segment const& b) { return b. Bottom; } \ static inline void set(Segment& b, ct const& value) { b. Bottom = value; } \ }; \ template <> struct indexed_access<Segment, max_corner, 0> \ { \ typedef coordinate_type<Point>::type ct; \ static inline ct get(Segment const& b) { return b. Right; } \ static inline void set(Segment& b, ct const& value) { b. Right = value; } \ }; \ template <> struct indexed_access<Segment, max_corner, 1> \ { \ typedef coordinate_type<Point>::type ct; \ static inline ct get(Segment const& b) { return b. Top; } \ static inline void set(Segment& b, ct const& value) { b. Top = value; } \ }; #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \ template<> struct tag<Segment > { typedef segment_tag type; }; \ template<> struct point_type<Segment > { typedef PointType type; }; #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS_TEMPLATIZED(Segment) \ template<typename P> struct tag<Segment<P> > { typedef segment_tag type; }; \ template<typename P> struct point_type<Segment<P> > { typedef P type; }; #endif // DOXYGEN_NO_SPECIALIZATIONS #define BOOST_GEOMETRY_REGISTER_SEGMENT(Segment, PointType, Index0, Index1) \ namespace boost { namespace geometry { namespace traits { \ BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \ BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS(Segment, PointType, Index0, Index1) \ }}} #define BOOST_GEOMETRY_REGISTER_SEGMENT_TEMPLATIZED(Segment, Index0, Index1) \ namespace boost { namespace geometry { namespace traits { \ BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS_TEMPLATIZED(Segment) \ BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_TEMPLATIZED(Segment, Index0, Index1) \ }}} #define BOOST_GEOMETRY_REGISTER_SEGMENT_2D_4VALUES(Segment, PointType, Left, Bottom, Right, Top) \ namespace boost { namespace geometry { namespace traits { \ BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_TRAITS(Segment, PointType) \ BOOST_GEOMETRY_DETAIL_SPECIALIZE_SEGMENT_ACCESS_4VALUES(Segment, PointType, Left, Bottom, Right, Top) \ }}} // CONST versions are for segments probably not that common. Postponed. #endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_SEGMENT_HPP
{ "pile_set_name": "Github" }
import Vue from "vue"; import App from "./Index.vue"; import vuetifyService from "@/options/plugins/vuetify"; import { EModule, EAction } from "@/interface/enum"; import { IRequest } from "@/interface/common"; import Extension from "@/service/extension"; const extension = new Extension(); class Debugger { private vm: any; constructor() { vuetifyService.init("en"); this.vm = new Vue({ el: "#app", render: h => h(App) }); this.initEvents(); } private initEvents() { chrome.runtime.onConnect.addListener(port => { console.assert(port.name == EModule.debugger); port.onMessage.addListener((request: IRequest) => { console.log(request); if (request.action == EAction.pushDebugMsg) { this.add(request.data); } }); }); chrome.tabs.getCurrent((tab: any) => { console.log("debugTabId: %s", tab.id); extension.sendRequest(EAction.updateDebuggerTabId, null, tab.id); }); } private add(msg: any) { this.vm.$children[0].add(msg); } } new Debugger();
{ "pile_set_name": "Github" }
// Source: https://gist.github.com/niwibe/3729459 #ifndef GADGETRON_PYTHON_TUPLE_CONVERTER_H #define GADGETRON_PYTHON_TUPLE_CONVERTER_H #include <boost/python.hpp> namespace bp = boost::python; namespace Gadgetron { /// indices trick template<int ...> struct seq{}; template<int N, int ...S> struct gens : gens<N-1, N-1, S...>{}; template<int ...S> struct gens<0, S...> {typedef seq<S...> type;}; /// Used for expanding a C++ std::tuple into a boost::python::tuple template <typename ...Args> struct cpptuple2pytuple_wrapper { std::tuple<Args...> params; cpptuple2pytuple_wrapper(const std::tuple<Args...>& _params):params(_params){} bp::tuple delayed_dispatch() { return callFunc(typename gens<sizeof...(Args)>::type()); } template<int ...S> bp::tuple callFunc(seq<S...>) { return bp::make_tuple(std::get<S>(params) ...); } }; /// Used for expanding a boost::python::tuple into a C++ std::tuple template <typename ...Args> struct pytuple2cpptuple_wrapper { bp::tuple params; pytuple2cpptuple_wrapper(const bp::tuple& _params):params(_params){} std::tuple<Args...> delayed_dispatch() { return callFunc(typename gens<sizeof...(Args)>::type()); } template<int ...S> std::tuple<Args...> callFunc(seq<S...>) { return std::make_tuple((static_cast<Args>(bp::extract<Args>(params[S])))...); } }; /// Convert C++ std::tuple to boost::python::tuple as PyObject*. template<typename ... Args> PyObject* cpptuple2pytuple(const std::tuple<Args...>& t) { cpptuple2pytuple_wrapper<Args...> wrapper(t); bp::tuple bpt = wrapper.delayed_dispatch(); return bp::incref(bp::object(bpt).ptr()); } /// Convert boost::python::tuple to C++ std::tuple. template<typename ... Args> std::tuple<Args...> pytuple2cpptuple(PyObject* obj) { bp::tuple tup(bp::borrowed(obj)); pytuple2cpptuple_wrapper<Args...> wrapper(tup); std::tuple<Args...> bpt = wrapper.delayed_dispatch(); return bpt; } /// To-Python converter used by Boost template<typename ... Args> struct cpptuple_to_python_tuple { static PyObject* convert(const std::tuple<Args...>& t) { return cpptuple2pytuple<Args...>(t); } }; /// From-Python converter used by Boost template<typename ... Args> struct cpptuple_from_python_tuple { cpptuple_from_python_tuple() { // actually register this converter bp::converter::registry::push_back(&convertible, &construct, bp::type_id<std::tuple<Args...> >()); } /// Returns NULL if the bp::tuple is not convertible static void* convertible(PyObject* obj_ptr) { if (!PyTuple_CheckExact(obj_ptr)) { return NULL; } return obj_ptr; } /// Construct the std::tuple in place static void construct(PyObject* obj_ptr, bp::converter::rvalue_from_python_stage1_data* data) { void* storage = ((bp::converter::rvalue_from_python_storage<std::tuple<Args...> >*)data)->storage.bytes; // Use placement-new to make std::tuple in memory provided by Boost new (storage) std::tuple<Args...>(pytuple2cpptuple<Args...>(obj_ptr)); data->convertible = storage; } }; /// Create and register tuple converter as necessary template <typename ...TS> void create_tuple_converter() { bp::type_info info = bp::type_id<std::tuple<TS...> >(); const bp::converter::registration* reg = bp::converter::registry::query(info); // only register if not already registered! if (nullptr == reg || nullptr == (*reg).m_to_python) { bp::to_python_converter<std::tuple<TS...>, cpptuple_to_python_tuple<TS...> >(); cpptuple_from_python_tuple<TS...>(); } } /// Partial specialization of `python_converter` for std::tuple template <typename ...TS> struct python_converter<std::tuple<TS...> > { static void create() { // register tuple converter create_tuple_converter<TS...>(); // register converter for each type in the tuple register_converter<TS...>(); } }; } #endif // GADGETRON_PYTHON_TUPLE_CONVERTER_H
{ "pile_set_name": "Github" }
package com.vogella.junit.first; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) @SuiteClasses({ MyClassTest.class, MySecondClassTest.class }) public class AllTests { }
{ "pile_set_name": "Github" }
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- // BEGIN PRELUDE function echo(o) { try { document.write(o + "<br/>"); echo = function(o) { document.write(o + "<br/>"); }; } catch (ex) { try { WScript.Echo("" + o); echo = function(o) { WScript.Echo("" + o); }; } catch (ex2) { print("" + o); echo = function(o) { print("" + o); }; } } } var suppressLastIndex = false; var suppressRegExp = false; var suppressIndex = false; function safeCall(f) { var args = []; for (var a = 1; a < arguments.length; ++a) args.push(arguments[a]); try { return f.apply(this, args); } catch (ex) { echo("EXCEPTION"); } } hex = "0123456789abcdef"; function dump(o) { var sb = []; if (o === null) sb.push("null"); else if (o === undefined) sb.push("undefined"); else if (o === true) sb.push("true"); else if (o === false) sb.push("false"); else if (typeof o === "number") sb.push(o.toString()); else if (typeof o == "string") { if (o.length > 8192) sb.push("<long string>"); else { sb.push("\""); var start = -1; for (var i = 0; i < o.length; i++) { var c = o.charCodeAt(i); if (c < 32 || c > 127 || c == '"'.charCodeAt(0) || c == '\\'.charCodeAt(0)) { if (start >= 0) sb.push(o.substring(start, i)); start = -1; sb.push("\\u"); sb.push(String.fromCharCode(hex.charCodeAt((c >> 12) & 0xf))); sb.push(String.fromCharCode(hex.charCodeAt((c >> 8) & 0xf))); sb.push(String.fromCharCode(hex.charCodeAt((c >> 4) & 0xf))); sb.push(String.fromCharCode(hex.charCodeAt((c >> 0) & 0xf))); } else { if (start < 0) start = i; } } if (start >= 0) sb.push(o.substring(start, o.length)); sb.push("\""); } } else if (o instanceof RegExp) { var body = o.source; sb.push("/"); var start = -1; for (var i = 0; i < body.length; i++) { var c = body.charCodeAt(i); if (c < 32 || c > 127) { if (start >= 0) sb.push(body.substring(start, i)); start = -1; sb.push("\\u"); sb.push(String.fromCharCode(hex.charCodeAt((c >> 12) & 0xf))); sb.push(String.fromCharCode(hex.charCodeAt((c >> 8) & 0xf))); sb.push(String.fromCharCode(hex.charCodeAt((c >> 4) & 0xf))); sb.push(String.fromCharCode(hex.charCodeAt((c >> 0) & 0xf))); } else { if (start < 0) start = i; } } if (start >= 0) sb.push(body.substring(start, body.length)); sb.push("/"); if (o.global) sb.push("g"); if (o.ignoreCase) sb.push("i"); if (o.multiline) sb.push("m"); if (!suppressLastIndex && o.lastIndex !== undefined) { sb.push(" /*lastIndex="); sb.push(o.lastIndex); sb.push("*/ "); } } else if (o.length !== undefined) { sb.push("["); for (var i = 0; i < o.length; i++) { if (i > 0) sb.push(","); sb.push(dump(o[i])); } sb.push("]"); if (!suppressIndex && (o.input !== undefined || o.index !== undefined)) { sb.push(" /*input="); sb.push(dump(o.input)); sb.push(", index="); sb.push(dump(o.index)); // IE only // sb.push(", lastIndex="); // sb.push(dump(o.lastIndex)); sb.push("*/ "); } } else if (o.toString !== undefined) { sb.push("<object with toString>"); } else sb.push(o.toString()); return sb.join(""); } function pre(w, origargs, n) { var sb = [w]; sb.push("("); for (var i = 0; i < n; i++) { if (i > 0) sb.push(", "); sb.push(dump(origargs[i])); } if (origargs.length > n) { sb.push(", "); sb.push(dump(origargs[n])); origargs[0].lastIndex = origargs[n]; } sb.push(");"); echo(sb.join("")); } function post(r) { if (!suppressLastIndex) { echo("r.lastIndex=" + dump(r.lastIndex)); } if (!suppressRegExp) { // IE only // echo("RegExp.index=" + dump(RegExp.index)); // echo("RegExp.lastIndex=" + dump(RegExp.lastIndex)); var sb = []; sb.push("RegExp.${_,1,...,9}=["); sb.push(dump(RegExp.$_)); for (var i = 1; i <= 9; i++) { sb.push(","); sb.push(dump(RegExp["$" + i])); } sb.push("]"); echo(sb.join("")); } } function exec(r, s) { pre("exec", arguments, 2); echo(dump(r.exec(s))); post(r); } function test(r, s) { pre("test", arguments, 2); echo(dump(r.test(s))); post(r); } function replace(r, s, o) { pre("replace", arguments, 3); echo(dump(s.replace(r, o))); post(r); } function split(r, s) { pre("split", arguments, 2); echo(dump(s.split(r))); post(r); } function match(r, s) { pre("match", arguments, 2); echo(dump(s.match(r))); post(r); } function search(r, s) { pre("search", arguments, 2); echo(dump(s.search(r))); post(r); } function bogus(r, o) { echo("bogus(" + dump(r) + ", " + dump(o) + ");"); try { new RegExp(r, o); echo("FAILED"); } catch (e) { echo("PASSED"); } } // END PRELUDE var str = "a b\nc d\ne f"; replace(/^a/g, str, "replaced"); replace(/^a/gm, str, "replaced"); replace(/b$/g, str, "replaced"); replace(/b$/gm, str, "replaced"); replace(/^c d$/g, str, "replaced"); replace(/^c d$/gm, str, "replaced"); replace(/^e/g, str, "replaced"); replace(/^e/gm, str, "replaced"); replace(/f$/g, str, "replaced"); replace(/f$/gm, str, "replaced");
{ "pile_set_name": "Github" }
module.exports = function(hljs) { var FILTER = { className: 'filter', begin: /\|[A-Za-z]+:?/, keywords: 'truncatewords removetags linebreaksbr yesno get_digit timesince random striptags ' + 'filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands ' + 'title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode ' + 'timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort ' + 'dictsortreversed default_if_none pluralize lower join center default ' + 'truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first ' + 'escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize ' + 'localtime utc timezone', contains: [ {className: 'argument', begin: /"/, end: /"/}, {className: 'argument', begin: /'/, end: /'/} ] }; return { aliases: ['jinja'], case_insensitive: true, subLanguage: 'xml', contains: [ hljs.COMMENT(/\{%\s*comment\s*%}/, /\{%\s*endcomment\s*%}/), hljs.COMMENT(/\{#/, /#}/), { className: 'template_tag', begin: /\{%/, end: /%}/, keywords: 'comment endcomment load templatetag ifchanged endifchanged if endif firstof for ' + 'endfor in ifnotequal endifnotequal widthratio extends include spaceless ' + 'endspaceless regroup by as ifequal endifequal ssi now with cycle url filter ' + 'endfilter debug block endblock else autoescape endautoescape csrf_token empty elif ' + 'endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix ' + 'plural get_current_language language get_available_languages ' + 'get_current_language_bidi get_language_info get_language_info_list localize ' + 'endlocalize localtime endlocaltime timezone endtimezone get_current_timezone ' + 'verbatim', contains: [FILTER] }, { className: 'variable', begin: /\{\{/, end: /}}/, contains: [FILTER] } ] }; };
{ "pile_set_name": "Github" }
/dts-v1/; / { property = label: "foo" label:; };
{ "pile_set_name": "Github" }
// CodeContracts // // Copyright (c) Microsoft Corporation // // All rights reserved. // // MIT License // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using System.Collections.Generic; using System.ComponentModel.Composition; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Formatting; using Microsoft.VisualStudio.Utilities; using Adornments; namespace MetadataContracts { /// <summary> /// Provides a line transform source so that line transforms can be properly calcualted for contract adornments. /// </summary> [Export(typeof(ILineTransformSourceProvider))] [ContentType("code")] [TextViewRole(PredefinedTextViewRoles.Document)] internal sealed class LineTransformSourceProvider : ILineTransformSourceProvider { public ILineTransformSource Create(IWpfTextView textView) { var adornmentManager = AdornmentManager.GetOrCreateAdornmentManager(textView, "MetadataAdornments"); return new LineTransformSource(adornmentManager.Adornments); } } /// <summary> /// A custom line transform source that transforms lines to fit adornments as needed. /// </summary> class LineTransformSource : ILineTransformSource { readonly IEnumerable<IAdornment> adornments; public LineTransformSource(IEnumerable<IAdornment> adornments) { this.adornments = adornments; } public LineTransform GetLineTransform(ITextViewLine line, double yPosition, ViewRelativePosition placement) { foreach (IAdornment adornment in this.adornments) { if (line.ContainsBufferPosition(new SnapshotPoint(line.Snapshot, adornment.Span.GetStartPoint(line.Snapshot).Position))) { //if (adornment.Visual.IsMeasureValid) { // adornment.ShouldRedrawAdornmentLayout = false; //} return new LineTransform(adornment.Visual.DesiredSize.Height, 0.0, 1.0); } } return new LineTransform(0, 0, 1); } } }
{ "pile_set_name": "Github" }
Source: flat-remix-gtk Section: misc Priority: optional Maintainer: Daniel Ruiz de Alegría <[email protected]> Build-Depends: debhelper-compat (= 9) Homepage: https://drasite.com/flat-remix-gtk Package: flat-remix-gtk Architecture: any Description: Flat Remix gtk theme Flat Remix GTK theme is a pretty simple gtk window theme inspired on material design following a modern design using "flat" colors with high contrasts and sharp borders. . Themes: • Flat Remix GTK • Flat Remix GTK Dark • Flat Remix GTK Darker • Flat Remix GTK Darkest . Variants: • Solid: Theme without transparency • No Border: Darkest theme without white window border
{ "pile_set_name": "Github" }
/* ** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ ** Lua standard libraries ** See Copyright Notice in lua.h */ #ifndef lualib_h #define lualib_h #include "lua.h" /* Key to file-handle type */ #define LUA_FILEHANDLE "FILE*" #define LUA_COLIBNAME "coroutine" LUALIB_API int (luaopen_base) (lua_State *L); #define LUA_TABLIBNAME "table" LUALIB_API int (luaopen_table) (lua_State *L); #define LUA_IOLIBNAME "io" LUALIB_API int (luaopen_io) (lua_State *L); #define LUA_OSLIBNAME "os" LUALIB_API int (luaopen_os) (lua_State *L); #define LUA_STRLIBNAME "string" LUALIB_API int (luaopen_string) (lua_State *L); #define LUA_MATHLIBNAME "math" LUALIB_API int (luaopen_math) (lua_State *L); #define LUA_DBLIBNAME "debug" LUALIB_API int (luaopen_debug) (lua_State *L); #define LUA_LOADLIBNAME "package" LUALIB_API int (luaopen_package) (lua_State *L); /* open all previous libraries */ LUALIB_API void (luaL_openlibs) (lua_State *L); #ifndef lua_assert #define lua_assert(x) ((void)0) #endif #endif
{ "pile_set_name": "Github" }
# This file contains the main variables settings to build pgModeler on all supported platforms. # # Thanks to Lisandro Damián Nicanor Pérez Meyer, pgModeler is able to be package in most of # Linux distros. # # Original version by: Lisandro Damián Nicanor Pérez Meyer <[email protected]> # Original code: https://github.com/perezmeyer/pgmodeler/tree/shared_libs # # Refactored version by: Raphal Araújo e Silva <[email protected]> # Refactored code: https://github.com/pgmodeler/pgmodeler # General Qt settings QT += core widgets printsupport network svg CONFIG += ordered qt stl rtti exceptions warn_on c++14 TEMPLATE = subdirs MOC_DIR = moc OBJECTS_DIR = obj UI_DIR = src # Setting up the flag passed to compiler to indicate a snapshot build defined(SNAPSHOT_BUILD, var): DEFINES+=SNAPSHOT_BUILD # Setting up the flag passed to compiler to build the demo version defined(DEMO_VERSION, var): DEFINES+=DEMO_VERSION # Setting up the flag passed to compiler to disable all code related to update checking defined(NO_UPDATE_CHECK, var): DEFINES+=NO_UPDATE_CHECK # Properly defining build number constant unix { BUILDNUM=$$system("date '+%Y%m%d'") DEFINES+=BUILDNUM=\\\"$${BUILDNUM}\\\" } else { BUILDNUM=$$system('getbuildnum.bat') DEFINES+=BUILDNUM=\\\"$${BUILDNUM}\\\" } # Below, the user can specify where all generated file can be placed # through a set of variables, being them: # # PREFIX -> the root directory where the files will be placed # BINDIR -> where executables accessible by the user resides # PRIVATEBINDIR -> where executables not directly accessible by the user resides # PRIVATELIBDIR -> where libraries not directly shared through the system resides # PLUGINSDIR -> where third party plugins are installed # SHAREDIR -> where shared files and resources should be placed # CONFDIR -> where the pgModeler's configuration folder (conf) resides # DOCDIR -> where documentation related files are placed # LANGDIR -> where the UI translation folder (lang) resides # SAMPLESDIR -> where the sample models folder (samples) resides # SCHEMASDIR -> where the object's schemas folder (schema) resides # # The values of each variable changes between supported platforms and are describe as follow # Linux custom variables settings linux { CONFIG += x11 # If the AppImage generation option is set defined(APPIMAGE_BUILD, var):{ !defined(PREFIX, var): PREFIX = /usr/local/pgmodeler-appimage BINDIR = $$PREFIX PRIVATEBINDIR = $$PREFIX PRIVATELIBDIR = $$PREFIX/lib PLUGINSDIR = $$PREFIX/lib/pgmodeler/plugins SHAREDIR = $$PREFIX CONFDIR = $$SHAREDIR/conf DOCDIR = $$SHAREDIR LANGDIR = $$SHAREDIR/lang SAMPLESDIR = $$SHAREDIR/samples SCHEMASDIR = $$SHAREDIR/schemas } !defined(APPIMAGE_BUILD, var):{ # Default configuration for package pgModeler. # The default prefix is /usr/local !defined(PREFIX, var): PREFIX = /usr/local !defined(BINDIR, var): BINDIR = $$PREFIX/bin !defined(PRIVATEBINDIR, var): PRIVATEBINDIR = $$PREFIX/bin !defined(PRIVATELIBDIR, var): PRIVATELIBDIR = $$PREFIX/lib/pgmodeler !defined(PLUGINSDIR, var): PLUGINSDIR = $$PREFIX/lib/pgmodeler/plugins !defined(SHAREDIR, var): SHAREDIR = $$PREFIX/share/pgmodeler !defined(CONFDIR, var): CONFDIR = $$SHAREDIR/conf !defined(DOCDIR, var): DOCDIR = $$SHAREDIR !defined(LANGDIR, var): LANGDIR = $$SHAREDIR/lang !defined(SAMPLESDIR, var): SAMPLESDIR = $$SHAREDIR/samples !defined(SCHEMASDIR, var): SCHEMASDIR = $$SHAREDIR/schemas } # Specifies where to find the libraries at runtime RELATIVE_PRIVATELIBDIR = $$relative_path($$PRIVATELIBDIR, $$BINDIR) QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\' -Wl,-rpath,\'\$$ORIGIN/$$RELATIVE_PRIVATELIBDIR\'" # Forcing the display of some warnings CONFIG(debug, debug|release): QMAKE_CXXFLAGS += "-Wall -Wextra -Wuninitialized" } # Windows custom variables settings windows { CONFIG += windows # The default prefix is ./build !defined(PREFIX, var): PREFIX = $$PWD/build !defined(BINDIR, var): BINDIR = $$PREFIX !defined(PRIVATEBINDIR, var): PRIVATEBINDIR = $$PREFIX !defined(PRIVATELIBDIR, var): PRIVATELIBDIR = $$PREFIX !defined(PLUGINSDIR, var): PLUGINSDIR = $$PREFIX/plugins !defined(SHAREDIR, var): SHAREDIR = $$PREFIX !defined(CONFDIR, var): CONFDIR = $$PREFIX/conf !defined(DOCDIR, var): DOCDIR = $$PREFIX !defined(LANGDIR, var): LANGDIR = $$PREFIX/lang !defined(SAMPLESDIR, var): SAMPLESDIR = $$PREFIX/samples !defined(SCHEMASDIR, var): SCHEMASDIR = $$PREFIX/schemas } # MacOS X custom variables settings macx { CONFIG -= app_bundle # The default prefix is ./build/pgmodeler.app/Contents !defined(PREFIX, var): PREFIX = /Applications/pgModeler.app/Contents !defined(BINDIR, var): BINDIR = $$PREFIX/MacOS !defined(PRIVATEBINDIR, var): PRIVATEBINDIR = $$BINDIR !defined(PRIVATELIBDIR, var): PRIVATELIBDIR = $$PREFIX/Frameworks !defined(PLUGINSDIR, var): PLUGINSDIR = $$BINDIR/plugins !defined(SHAREDIR, var): SHAREDIR = $$BINDIR !defined(CONFDIR, var): CONFDIR = $$BINDIR/conf !defined(DOCDIR, var): DOCDIR = $$BINDIR !defined(LANGDIR, var): LANGDIR = $$BINDIR/lang !defined(SAMPLESDIR, var): SAMPLESDIR = $$BINDIR/samples !defined(SCHEMASDIR, var): SCHEMASDIR = $$BINDIR/schemas # Specifies where to find the libraries at runtime QMAKE_RPATHDIR += @executable_path/../Frameworks QMAKE_LFLAGS_SONAME = -Wl,-install_name,@loader_path/../Frameworks/ } # Creating constants based upon the custom paths so the GlobalAttributes # namespace can correctly configure the paths inside the code DEFINES += BINDIR=\\\"$${BINDIR}\\\" \ PLUGINSDIR=\\\"$${PLUGINSDIR}\\\" \ PRIVATEBINDIR=\\\"$${PRIVATEBINDIR}\\\" \ CONFDIR=\\\"$${CONFDIR}\\\" \ DOCDIR=\\\"$${DOCDIR}\\\" \ LANGDIR=\\\"$${LANGDIR}\\\" \ SAMPLESDIR=\\\"$${SAMPLESDIR}\\\" \ SCHEMASDIR=\\\"$${SCHEMASDIR}\\\" # pgModeler depends on libpq and libxml2 this way to variables # are define so the compiler can find the libs at link time. # # PGSQL_LIB -> Full path to libpq.(so | dll | dylib) # PGSQL_INC -> Root path where PgSQL includes can be found # # XML_LIB -> Full path to libxml2.(so | dll | dylib) # XML_INC -> Root path where XML2 includes can be found unix:!macx { CONFIG += link_pkgconfig PKGCONFIG = libpq libxml-2.0 PGSQL_LIB = -lpq XML_LIB = -lxml2 } macx { !defined(PGSQL_LIB, var): PGSQL_LIB = /Library/PostgreSQL/12/lib/libpq.dylib !defined(PGSQL_INC, var): PGSQL_INC = /Library/PostgreSQL/12/include !defined(XML_INC, var): XML_INC = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2 !defined(XML_LIB, var): XML_LIB = /usr/lib/libxml2.dylib INCLUDEPATH += $$PGSQL_INC $$XML_INC } windows { !defined(PGSQL_LIB, var): PGSQL_LIB = C:/msys64/mingw64/bin/libpq.dll !defined(PGSQL_INC, var): PGSQL_INC = C:/msys64/mingw64/include !defined(XML_INC, var): XML_INC = C:/msys64/mingw64/include/libxml2 !defined(XML_LIB, var): XML_LIB = C:/msys64/mingw64/bin/libxml2-2.dll # Workaround to solve bug of timespec struct on MingW + PostgreSQL < 9.4 QMAKE_CXXFLAGS+="-DHAVE_STRUCT_TIMESPEC" INCLUDEPATH += "$$PGSQL_INC" "$$XML_INC" } macx | windows { !exists($$PGSQL_LIB) { PKG_ERROR = "PostgreSQL libraries" VARIABLE = "PGSQL_LIB" VALUE = $$PGSQL_LIB } !exists($$PGSQL_INC/libpq-fe.h) { PKG_ERROR = "PostgreSQL headers" VARIABLE = "PGSQL_INC" VALUE = $$PGSQL_INC } !exists($$XML_LIB) { PKG_ERROR = "XML2 libraries" VARIABLE = "XML_LIB" VALUE = $$XML_LIB } !exists($$XML_INC) { PKG_ERROR = "XML2 headers" VARIABLE = "XML_INC" VALUE = $$XML_INC } !isEmpty(PKG_ERROR) { warning("$$PKG_ERROR were not found at \"$$VALUE\"!") warning("Please correct the value of $$VARIABLE and try again!") error("pgModeler compilation aborted.") } } # Define a custom function to print build details defineTest(printBuildDetails) { LB=$$escape_expand(\n) log($$LB) log("** pgModeler build details ** $$LB $$LB") log(" PREFIX = $$PREFIX $$LB") log(" BINDIR = $$BINDIR $$LB") log(" PRIVATEBINDIR = $$PRIVATEBINDIR $$LB") log(" PRIVATELIBDIR = $$PRIVATELIBDIR $$LB") log(" PLUGINSDIR = $$PLUGINSDIR $$LB") log(" SHAREDIR = $$SHAREDIR $$LB") log(" CONFDIR = $$CONFDIR $$LB") log(" DOCDIR = $$DOCDIR $$LB") log(" LANGDIR = $$LANGDIR $$LB") log(" SAMPLESDIR = $$SAMPLESDIR $$LB") log(" SCHEMASDIR = $$SCHEMASDIR $$LB $$LB") log("* To change a variable value run qmake again setting the desired value e.g.: $$LB") log(" > qmake PREFIX+=/usr/local -r pgmodeler.pro $$LB $$LB") log("* Proceed with build process by running: $$LB") log(" > make && make install $$LB") log($$LB) return(true) }
{ "pile_set_name": "Github" }
/** * External dependencies */ import { isNil, isEmpty } from 'lodash'; import classnames from 'classnames'; /** * Internal dependencies */ import BlockIframePreview from './block-iframe-preview'; const TemplateSelectorItem = ( props ) => { const { id, value, onSelect, label, useDynamicPreview = false, staticPreviewImg, staticPreviewImgAlt = '', blocks = [], isSelected, } = props; if ( isNil( id ) || isNil( label ) || isNil( value ) ) { return null; } if ( useDynamicPreview && ( isNil( blocks ) || isEmpty( blocks ) ) ) { return null; } // Define static or dynamic preview. const innerPreview = useDynamicPreview ? ( <BlockIframePreview blocks={ blocks } viewportWidth={ 960 } /> ) : ( <img className="template-selector-item__media" src={ staticPreviewImg } alt={ staticPreviewImgAlt } /> ); const labelId = `label-${ id }-${ value }`; const handleLabelClick = () => { onSelect( value ); }; return ( <button type="button" className={ classnames( 'template-selector-item__label', { 'is-selected': isSelected, } ) } value={ value } onClick={ handleLabelClick } aria-labelledby={ `${ id } ${ labelId }` } > <span className="template-selector-item__preview-wrap">{ innerPreview }</span> </button> ); }; export default TemplateSelectorItem;
{ "pile_set_name": "Github" }
package org.ektorp.support; import java.lang.annotation.*; /** * Annotation for defining multiple views embedded in repositories. * @author henrik lundgren * */ @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Views { View[] value(); }
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * 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. */ package org.apache.commons.math3.genetics; import org.apache.commons.math3.exception.MathIllegalArgumentException; /** * Algorithm used to mutate a chromosome. * * @since 2.0 * @version $Id$ */ public interface MutationPolicy { /** * Mutate the given chromosome. * @param original the original chromosome. * @return the mutated chromosome. * @throws MathIllegalArgumentException if the given chromosome is not compatible with this {@link MutationPolicy} */ Chromosome mutate(Chromosome original) throws MathIllegalArgumentException; }
{ "pile_set_name": "Github" }
/**************************************************************************** Author: Luma ([email protected]) https://github.com/stubma/cocos2dx-better Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "CCTreeFadeIn.h" #include "CCTreeFadeOut.h" #include "cocos-ext.h" USING_NS_CC_EXT; using namespace cocos2d::ui; NS_CC_BEGIN CCTreeFadeIn::CCTreeFadeIn() : m_recursivelyExclude(true) { } CCTreeFadeIn* CCTreeFadeIn::create(float d) { CCTreeFadeIn* pAction = new CCTreeFadeIn(); pAction->initWithDuration(d); pAction->autorelease(); return pAction; } void CCTreeFadeIn::update(float time) { CCFadeIn::update(time); fadeInRecursively(getTarget(), time); } void CCTreeFadeIn::fadeInRecursively(CCNode* n, float time) { CCRGBAProtocol* p = dynamic_cast<CCRGBAProtocol*>(n); if(p) { p->setOpacity((GLubyte)(255 * time)); } CCArray* children = n->getChildren(); int cc = n->getChildrenCount(); for(int i = 0; i < cc; i++) { CCNode* child = (CCNode*)children->objectAtIndex(i); if(!m_excludeList.containsObject(child)) { fadeInRecursively(child, time); } else if(!m_recursivelyExclude) { fadeInRecursively(child, time); } } // check widget Widget* w = dynamic_cast<Widget*>(n); if(w) { if(w->getVirtualRenderer()) { CCRGBAProtocol* p = dynamic_cast<CCRGBAProtocol*>(w->getVirtualRenderer()); if(p) { p->setOpacity((GLubyte)(255 * time)); } } CCArray* children = w->getNodes(); int cc = children->count(); for(int i = 0; i < cc; i++) { CCNode* child = (CCNode*)children->objectAtIndex(i); fadeInRecursively(child, time); } } } CCActionInterval* CCTreeFadeIn::reverse(void) { return CCTreeFadeOut::create(m_fDuration); } void CCTreeFadeIn::excludeNode(CCNode* n, bool recursively) { m_excludeList.addObject(n); m_recursivelyExclude = recursively; } NS_CC_END
{ "pile_set_name": "Github" }
# # Distance # # Pitch and yaw angles in radians should be multiplied by # # ANGLE_MULTIPLIER = 15 / PI # # in order to convert them to a coarse representation, because: # - Fits the maximum range of a signed 4 bit or 5 bit integer, respectively # - Exactly represents the following angles: # 0, 15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180, and negatives # # Orientation MUST be specified, and there MUST be only one sensor per orientation. # This thus serves as a kind of major sensor_id. float32 ANGLE_MULTIPLIER = 4.7746482927568605 int4 fixed_axis_pitch # -PI/2 ... +PI/2 or -6 ... 6 int5 fixed_axis_yaw # -PI ... +PI or -12 ... 12 uint4 sensor_sub_id # Allow up to 16 sensors per orientation uint3 RANGE_INVALID = 0 # Range is unknown uint3 RANGE_VALID = 1 # Range field contains valid distance uint3 RANGE_TOO_CLOSE = 2 # Range field contains min range for the sensor uint3 RANGE_TOO_FAR = 3 # Range field contains max range for the sensor uint3 range_flag float16 range # Meters uavcan.olliw.uc4h.DistanceSensorProperties[<=1] sensor_property # made an array so that it is optional
{ "pile_set_name": "Github" }
source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.properties
{ "pile_set_name": "Github" }
/* Bullet Continuous Collision Detection and Physics Library Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "btGjkPairDetector.h" #include "BulletCollision/CollisionShapes/btConvexShape.h" #include "BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h" #include "BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h" #if defined(DEBUG) || defined(_DEBUG) //#define TEST_NON_VIRTUAL 1 #include <stdio.h> //for debug printf #ifdef __SPU__ #include <spu_printf.h> #define printf spu_printf #endif //__SPU__ #endif //must be above the machine epsilon #ifdef BT_USE_DOUBLE_PRECISION #define REL_ERROR2 btScalar(1.0e-12) btScalar gGjkEpaPenetrationTolerance = 1.0e-12; #else #define REL_ERROR2 btScalar(1.0e-6) btScalar gGjkEpaPenetrationTolerance = 0.001; #endif btGjkPairDetector::btGjkPairDetector(const btConvexShape *objectA, const btConvexShape *objectB, btSimplexSolverInterface *simplexSolver, btConvexPenetrationDepthSolver *penetrationDepthSolver) : m_cachedSeparatingAxis(btScalar(0.), btScalar(1.), btScalar(0.)), m_penetrationDepthSolver(penetrationDepthSolver), m_simplexSolver(simplexSolver), m_minkowskiA(objectA), m_minkowskiB(objectB), m_shapeTypeA(objectA->getShapeType()), m_shapeTypeB(objectB->getShapeType()), m_marginA(objectA->getMargin()), m_marginB(objectB->getMargin()), m_ignoreMargin(false), m_lastUsedMethod(-1), m_catchDegeneracies(1), m_fixContactNormalDirection(1) { } btGjkPairDetector::btGjkPairDetector(const btConvexShape *objectA, const btConvexShape *objectB, int shapeTypeA, int shapeTypeB, btScalar marginA, btScalar marginB, btSimplexSolverInterface *simplexSolver, btConvexPenetrationDepthSolver *penetrationDepthSolver) : m_cachedSeparatingAxis(btScalar(0.), btScalar(1.), btScalar(0.)), m_penetrationDepthSolver(penetrationDepthSolver), m_simplexSolver(simplexSolver), m_minkowskiA(objectA), m_minkowskiB(objectB), m_shapeTypeA(shapeTypeA), m_shapeTypeB(shapeTypeB), m_marginA(marginA), m_marginB(marginB), m_ignoreMargin(false), m_lastUsedMethod(-1), m_catchDegeneracies(1), m_fixContactNormalDirection(1) { } void btGjkPairDetector::getClosestPoints(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw, bool swapResults) { (void)swapResults; getClosestPointsNonVirtual(input, output, debugDraw); } static void btComputeSupport(const btConvexShape *convexA, const btTransform &localTransA, const btConvexShape *convexB, const btTransform &localTransB, const btVector3 &dir, bool check2d, btVector3 &supAworld, btVector3 &supBworld, btVector3 &aMinb) { btVector3 separatingAxisInA = (dir)*localTransA.getBasis(); btVector3 separatingAxisInB = (-dir) * localTransB.getBasis(); btVector3 pInANoMargin = convexA->localGetSupportVertexWithoutMarginNonVirtual(separatingAxisInA); btVector3 qInBNoMargin = convexB->localGetSupportVertexWithoutMarginNonVirtual(separatingAxisInB); btVector3 pInA = pInANoMargin; btVector3 qInB = qInBNoMargin; supAworld = localTransA(pInA); supBworld = localTransB(qInB); if (check2d) { supAworld[2] = 0.f; supBworld[2] = 0.f; } aMinb = supAworld - supBworld; } struct btSupportVector { btVector3 v; //!< Support point in minkowski sum btVector3 v1; //!< Support point in obj1 btVector3 v2; //!< Support point in obj2 }; struct btSimplex { btSupportVector ps[4]; int last; //!< index of last added point }; static btVector3 ccd_vec3_origin(0, 0, 0); inline void btSimplexInit(btSimplex *s) { s->last = -1; } inline int btSimplexSize(const btSimplex *s) { return s->last + 1; } inline const btSupportVector *btSimplexPoint(const btSimplex *s, int idx) { // here is no check on boundaries return &s->ps[idx]; } inline void btSupportCopy(btSupportVector *d, const btSupportVector *s) { *d = *s; } inline void btVec3Copy(btVector3 *v, const btVector3 *w) { *v = *w; } inline void ccdVec3Add(btVector3 *v, const btVector3 *w) { v->m_floats[0] += w->m_floats[0]; v->m_floats[1] += w->m_floats[1]; v->m_floats[2] += w->m_floats[2]; } inline void ccdVec3Sub(btVector3 *v, const btVector3 *w) { *v -= *w; } inline void btVec3Sub2(btVector3 *d, const btVector3 *v, const btVector3 *w) { *d = (*v) - (*w); } inline btScalar btVec3Dot(const btVector3 *a, const btVector3 *b) { btScalar dot; dot = a->dot(*b); return dot; } inline btScalar ccdVec3Dist2(const btVector3 *a, const btVector3 *b) { btVector3 ab; btVec3Sub2(&ab, a, b); return btVec3Dot(&ab, &ab); } inline void btVec3Scale(btVector3 *d, btScalar k) { d->m_floats[0] *= k; d->m_floats[1] *= k; d->m_floats[2] *= k; } inline void btVec3Cross(btVector3 *d, const btVector3 *a, const btVector3 *b) { d->m_floats[0] = (a->m_floats[1] * b->m_floats[2]) - (a->m_floats[2] * b->m_floats[1]); d->m_floats[1] = (a->m_floats[2] * b->m_floats[0]) - (a->m_floats[0] * b->m_floats[2]); d->m_floats[2] = (a->m_floats[0] * b->m_floats[1]) - (a->m_floats[1] * b->m_floats[0]); } inline void btTripleCross(const btVector3 *a, const btVector3 *b, const btVector3 *c, btVector3 *d) { btVector3 e; btVec3Cross(&e, a, b); btVec3Cross(d, &e, c); } inline int ccdEq(btScalar _a, btScalar _b) { btScalar ab; btScalar a, b; ab = btFabs(_a - _b); if (btFabs(ab) < SIMD_EPSILON) return 1; a = btFabs(_a); b = btFabs(_b); if (b > a) { return ab < SIMD_EPSILON * b; } else { return ab < SIMD_EPSILON * a; } } btScalar ccdVec3X(const btVector3 *v) { return v->x(); } btScalar ccdVec3Y(const btVector3 *v) { return v->y(); } btScalar ccdVec3Z(const btVector3 *v) { return v->z(); } inline int btVec3Eq(const btVector3 *a, const btVector3 *b) { return ccdEq(ccdVec3X(a), ccdVec3X(b)) && ccdEq(ccdVec3Y(a), ccdVec3Y(b)) && ccdEq(ccdVec3Z(a), ccdVec3Z(b)); } inline void btSimplexAdd(btSimplex *s, const btSupportVector *v) { // here is no check on boundaries in sake of speed ++s->last; btSupportCopy(s->ps + s->last, v); } inline void btSimplexSet(btSimplex *s, size_t pos, const btSupportVector *a) { btSupportCopy(s->ps + pos, a); } inline void btSimplexSetSize(btSimplex *s, int size) { s->last = size - 1; } inline const btSupportVector *ccdSimplexLast(const btSimplex *s) { return btSimplexPoint(s, s->last); } inline int ccdSign(btScalar val) { if (btFuzzyZero(val)) { return 0; } else if (val < btScalar(0)) { return -1; } return 1; } inline btScalar btVec3PointSegmentDist2(const btVector3 *P, const btVector3 *x0, const btVector3 *b, btVector3 *witness) { // The computation comes from solving equation of segment: // S(t) = x0 + t.d // where - x0 is initial point of segment // - d is direction of segment from x0 (|d| > 0) // - t belongs to <0, 1> interval // // Than, distance from a segment to some point P can be expressed: // D(t) = |x0 + t.d - P|^2 // which is distance from any point on segment. Minimization // of this function brings distance from P to segment. // Minimization of D(t) leads to simple quadratic equation that's // solving is straightforward. // // Bonus of this method is witness point for free. btScalar dist, t; btVector3 d, a; // direction of segment btVec3Sub2(&d, b, x0); // precompute vector from P to x0 btVec3Sub2(&a, x0, P); t = -btScalar(1.) * btVec3Dot(&a, &d); t /= btVec3Dot(&d, &d); if (t < btScalar(0) || btFuzzyZero(t)) { dist = ccdVec3Dist2(x0, P); if (witness) btVec3Copy(witness, x0); } else if (t > btScalar(1) || ccdEq(t, btScalar(1))) { dist = ccdVec3Dist2(b, P); if (witness) btVec3Copy(witness, b); } else { if (witness) { btVec3Copy(witness, &d); btVec3Scale(witness, t); ccdVec3Add(witness, x0); dist = ccdVec3Dist2(witness, P); } else { // recycling variables btVec3Scale(&d, t); ccdVec3Add(&d, &a); dist = btVec3Dot(&d, &d); } } return dist; } btScalar btVec3PointTriDist2(const btVector3 *P, const btVector3 *x0, const btVector3 *B, const btVector3 *C, btVector3 *witness) { // Computation comes from analytic expression for triangle (x0, B, C) // T(s, t) = x0 + s.d1 + t.d2, where d1 = B - x0 and d2 = C - x0 and // Then equation for distance is: // D(s, t) = | T(s, t) - P |^2 // This leads to minimization of quadratic function of two variables. // The solution from is taken only if s is between 0 and 1, t is // between 0 and 1 and t + s < 1, otherwise distance from segment is // computed. btVector3 d1, d2, a; double u, v, w, p, q, r; double s, t, dist, dist2; btVector3 witness2; btVec3Sub2(&d1, B, x0); btVec3Sub2(&d2, C, x0); btVec3Sub2(&a, x0, P); u = btVec3Dot(&a, &a); v = btVec3Dot(&d1, &d1); w = btVec3Dot(&d2, &d2); p = btVec3Dot(&a, &d1); q = btVec3Dot(&a, &d2); r = btVec3Dot(&d1, &d2); s = (q * r - w * p) / (w * v - r * r); t = (-s * r - q) / w; if ((btFuzzyZero(s) || s > btScalar(0)) && (ccdEq(s, btScalar(1)) || s < btScalar(1)) && (btFuzzyZero(t) || t > btScalar(0)) && (ccdEq(t, btScalar(1)) || t < btScalar(1)) && (ccdEq(t + s, btScalar(1)) || t + s < btScalar(1))) { if (witness) { btVec3Scale(&d1, s); btVec3Scale(&d2, t); btVec3Copy(witness, x0); ccdVec3Add(witness, &d1); ccdVec3Add(witness, &d2); dist = ccdVec3Dist2(witness, P); } else { dist = s * s * v; dist += t * t * w; dist += btScalar(2.) * s * t * r; dist += btScalar(2.) * s * p; dist += btScalar(2.) * t * q; dist += u; } } else { dist = btVec3PointSegmentDist2(P, x0, B, witness); dist2 = btVec3PointSegmentDist2(P, x0, C, &witness2); if (dist2 < dist) { dist = dist2; if (witness) btVec3Copy(witness, &witness2); } dist2 = btVec3PointSegmentDist2(P, B, C, &witness2); if (dist2 < dist) { dist = dist2; if (witness) btVec3Copy(witness, &witness2); } } return dist; } static int btDoSimplex2(btSimplex *simplex, btVector3 *dir) { const btSupportVector *A, *B; btVector3 AB, AO, tmp; btScalar dot; // get last added as A A = ccdSimplexLast(simplex); // get the other point B = btSimplexPoint(simplex, 0); // compute AB oriented segment btVec3Sub2(&AB, &B->v, &A->v); // compute AO vector btVec3Copy(&AO, &A->v); btVec3Scale(&AO, -btScalar(1)); // dot product AB . AO dot = btVec3Dot(&AB, &AO); // check if origin doesn't lie on AB segment btVec3Cross(&tmp, &AB, &AO); if (btFuzzyZero(btVec3Dot(&tmp, &tmp)) && dot > btScalar(0)) { return 1; } // check if origin is in area where AB segment is if (btFuzzyZero(dot) || dot < btScalar(0)) { // origin is in outside are of A btSimplexSet(simplex, 0, A); btSimplexSetSize(simplex, 1); btVec3Copy(dir, &AO); } else { // origin is in area where AB segment is // keep simplex untouched and set direction to // AB x AO x AB btTripleCross(&AB, &AO, &AB, dir); } return 0; } static int btDoSimplex3(btSimplex *simplex, btVector3 *dir) { const btSupportVector *A, *B, *C; btVector3 AO, AB, AC, ABC, tmp; btScalar dot, dist; // get last added as A A = ccdSimplexLast(simplex); // get the other points B = btSimplexPoint(simplex, 1); C = btSimplexPoint(simplex, 0); // check touching contact dist = btVec3PointTriDist2(&ccd_vec3_origin, &A->v, &B->v, &C->v, 0); if (btFuzzyZero(dist)) { return 1; } // check if triangle is really triangle (has area > 0) // if not simplex can't be expanded and thus no itersection is found if (btVec3Eq(&A->v, &B->v) || btVec3Eq(&A->v, &C->v)) { return -1; } // compute AO vector btVec3Copy(&AO, &A->v); btVec3Scale(&AO, -btScalar(1)); // compute AB and AC segments and ABC vector (perpendircular to triangle) btVec3Sub2(&AB, &B->v, &A->v); btVec3Sub2(&AC, &C->v, &A->v); btVec3Cross(&ABC, &AB, &AC); btVec3Cross(&tmp, &ABC, &AC); dot = btVec3Dot(&tmp, &AO); if (btFuzzyZero(dot) || dot > btScalar(0)) { dot = btVec3Dot(&AC, &AO); if (btFuzzyZero(dot) || dot > btScalar(0)) { // C is already in place btSimplexSet(simplex, 1, A); btSimplexSetSize(simplex, 2); btTripleCross(&AC, &AO, &AC, dir); } else { dot = btVec3Dot(&AB, &AO); if (btFuzzyZero(dot) || dot > btScalar(0)) { btSimplexSet(simplex, 0, B); btSimplexSet(simplex, 1, A); btSimplexSetSize(simplex, 2); btTripleCross(&AB, &AO, &AB, dir); } else { btSimplexSet(simplex, 0, A); btSimplexSetSize(simplex, 1); btVec3Copy(dir, &AO); } } } else { btVec3Cross(&tmp, &AB, &ABC); dot = btVec3Dot(&tmp, &AO); if (btFuzzyZero(dot) || dot > btScalar(0)) { dot = btVec3Dot(&AB, &AO); if (btFuzzyZero(dot) || dot > btScalar(0)) { btSimplexSet(simplex, 0, B); btSimplexSet(simplex, 1, A); btSimplexSetSize(simplex, 2); btTripleCross(&AB, &AO, &AB, dir); } else { btSimplexSet(simplex, 0, A); btSimplexSetSize(simplex, 1); btVec3Copy(dir, &AO); } } else { dot = btVec3Dot(&ABC, &AO); if (btFuzzyZero(dot) || dot > btScalar(0)) { btVec3Copy(dir, &ABC); } else { btSupportVector tmp; btSupportCopy(&tmp, C); btSimplexSet(simplex, 0, B); btSimplexSet(simplex, 1, &tmp); btVec3Copy(dir, &ABC); btVec3Scale(dir, -btScalar(1)); } } } return 0; } static int btDoSimplex4(btSimplex *simplex, btVector3 *dir) { const btSupportVector *A, *B, *C, *D; btVector3 AO, AB, AC, AD, ABC, ACD, ADB; int B_on_ACD, C_on_ADB, D_on_ABC; int AB_O, AC_O, AD_O; btScalar dist; // get last added as A A = ccdSimplexLast(simplex); // get the other points B = btSimplexPoint(simplex, 2); C = btSimplexPoint(simplex, 1); D = btSimplexPoint(simplex, 0); // check if tetrahedron is really tetrahedron (has volume > 0) // if it is not simplex can't be expanded and thus no intersection is // found dist = btVec3PointTriDist2(&A->v, &B->v, &C->v, &D->v, 0); if (btFuzzyZero(dist)) { return -1; } // check if origin lies on some of tetrahedron's face - if so objects // intersect dist = btVec3PointTriDist2(&ccd_vec3_origin, &A->v, &B->v, &C->v, 0); if (btFuzzyZero(dist)) return 1; dist = btVec3PointTriDist2(&ccd_vec3_origin, &A->v, &C->v, &D->v, 0); if (btFuzzyZero(dist)) return 1; dist = btVec3PointTriDist2(&ccd_vec3_origin, &A->v, &B->v, &D->v, 0); if (btFuzzyZero(dist)) return 1; dist = btVec3PointTriDist2(&ccd_vec3_origin, &B->v, &C->v, &D->v, 0); if (btFuzzyZero(dist)) return 1; // compute AO, AB, AC, AD segments and ABC, ACD, ADB normal vectors btVec3Copy(&AO, &A->v); btVec3Scale(&AO, -btScalar(1)); btVec3Sub2(&AB, &B->v, &A->v); btVec3Sub2(&AC, &C->v, &A->v); btVec3Sub2(&AD, &D->v, &A->v); btVec3Cross(&ABC, &AB, &AC); btVec3Cross(&ACD, &AC, &AD); btVec3Cross(&ADB, &AD, &AB); // side (positive or negative) of B, C, D relative to planes ACD, ADB // and ABC respectively B_on_ACD = ccdSign(btVec3Dot(&ACD, &AB)); C_on_ADB = ccdSign(btVec3Dot(&ADB, &AC)); D_on_ABC = ccdSign(btVec3Dot(&ABC, &AD)); // whether origin is on same side of ACD, ADB, ABC as B, C, D // respectively AB_O = ccdSign(btVec3Dot(&ACD, &AO)) == B_on_ACD; AC_O = ccdSign(btVec3Dot(&ADB, &AO)) == C_on_ADB; AD_O = ccdSign(btVec3Dot(&ABC, &AO)) == D_on_ABC; if (AB_O && AC_O && AD_O) { // origin is in tetrahedron return 1; // rearrange simplex to triangle and call btDoSimplex3() } else if (!AB_O) { // B is farthest from the origin among all of the tetrahedron's // points, so remove it from the list and go on with the triangle // case // D and C are in place btSimplexSet(simplex, 2, A); btSimplexSetSize(simplex, 3); } else if (!AC_O) { // C is farthest btSimplexSet(simplex, 1, D); btSimplexSet(simplex, 0, B); btSimplexSet(simplex, 2, A); btSimplexSetSize(simplex, 3); } else { // (!AD_O) btSimplexSet(simplex, 0, C); btSimplexSet(simplex, 1, B); btSimplexSet(simplex, 2, A); btSimplexSetSize(simplex, 3); } return btDoSimplex3(simplex, dir); } static int btDoSimplex(btSimplex *simplex, btVector3 *dir) { if (btSimplexSize(simplex) == 2) { // simplex contains segment only one segment return btDoSimplex2(simplex, dir); } else if (btSimplexSize(simplex) == 3) { // simplex contains triangle return btDoSimplex3(simplex, dir); } else { // btSimplexSize(simplex) == 4 // tetrahedron - this is the only shape which can encapsule origin // so btDoSimplex4() also contains test on it return btDoSimplex4(simplex, dir); } } #ifdef __SPU__ void btGjkPairDetector::getClosestPointsNonVirtual(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw) #else void btGjkPairDetector::getClosestPointsNonVirtual(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw) #endif { m_cachedSeparatingDistance = 0.f; btScalar distance = btScalar(0.); btVector3 normalInB(btScalar(0.), btScalar(0.), btScalar(0.)); btVector3 pointOnA, pointOnB; btTransform localTransA = input.m_transformA; btTransform localTransB = input.m_transformB; btVector3 positionOffset = (localTransA.getOrigin() + localTransB.getOrigin()) * btScalar(0.5); localTransA.getOrigin() -= positionOffset; localTransB.getOrigin() -= positionOffset; bool check2d = m_minkowskiA->isConvex2d() && m_minkowskiB->isConvex2d(); btScalar marginA = m_marginA; btScalar marginB = m_marginB; //for CCD we don't use margins if (m_ignoreMargin) { marginA = btScalar(0.); marginB = btScalar(0.); } m_curIter = 0; int gGjkMaxIter = 1000; //this is to catch invalid input, perhaps check for #NaN? m_cachedSeparatingAxis.setValue(0, 1, 0); bool isValid = false; bool checkSimplex = false; bool checkPenetration = true; m_degenerateSimplex = 0; m_lastUsedMethod = -1; int status = -2; btVector3 orgNormalInB(0, 0, 0); btScalar margin = marginA + marginB; //we add a separate implementation to check if the convex shapes intersect //See also "Real-time Collision Detection with Implicit Objects" by Leif Olvang //Todo: integrate the simplex penetration check directly inside the Bullet btVoronoiSimplexSolver //and remove this temporary code from libCCD //this fixes issue https://github.com/bulletphysics/bullet3/issues/1703 //note, for large differences in shapes, use double precision build! { btScalar squaredDistance = BT_LARGE_FLOAT; btScalar delta = btScalar(0.); btSimplex simplex1; btSimplex *simplex = &simplex1; btSimplexInit(simplex); btVector3 dir(1, 0, 0); { btVector3 lastSupV; btVector3 supAworld; btVector3 supBworld; btComputeSupport(m_minkowskiA, localTransA, m_minkowskiB, localTransB, dir, check2d, supAworld, supBworld, lastSupV); btSupportVector last; last.v = lastSupV; last.v1 = supAworld; last.v2 = supBworld; btSimplexAdd(simplex, &last); dir = -lastSupV; // start iterations for (int iterations = 0; iterations < gGjkMaxIter; iterations++) { // obtain support point btComputeSupport(m_minkowskiA, localTransA, m_minkowskiB, localTransB, dir, check2d, supAworld, supBworld, lastSupV); // check if farthest point in Minkowski difference in direction dir // isn't somewhere before origin (the test on negative dot product) // - because if it is, objects are not intersecting at all. btScalar delta = lastSupV.dot(dir); if (delta < 0) { //no intersection, besides margin status = -1; break; } // add last support vector to simplex last.v = lastSupV; last.v1 = supAworld; last.v2 = supBworld; btSimplexAdd(simplex, &last); // if btDoSimplex returns 1 if objects intersect, -1 if objects don't // intersect and 0 if algorithm should continue btVector3 newDir; int do_simplex_res = btDoSimplex(simplex, &dir); if (do_simplex_res == 1) { status = 0; // intersection found break; } else if (do_simplex_res == -1) { // intersection not found status = -1; break; } if (btFuzzyZero(btVec3Dot(&dir, &dir))) { // intersection not found status = -1; } if (dir.length2() < SIMD_EPSILON) { //no intersection, besides margin status = -1; break; } if (dir.fuzzyZero()) { // intersection not found status = -1; break; } } } m_simplexSolver->reset(); if (status == 0) { //status = 0; //printf("Intersect!\n"); } if (status == -1) { //printf("not intersect\n"); } //printf("dir=%f,%f,%f\n",dir[0],dir[1],dir[2]); if (1) { for (;;) //while (true) { btVector3 separatingAxisInA = (-m_cachedSeparatingAxis) * localTransA.getBasis(); btVector3 separatingAxisInB = m_cachedSeparatingAxis * localTransB.getBasis(); btVector3 pInA = m_minkowskiA->localGetSupportVertexWithoutMarginNonVirtual(separatingAxisInA); btVector3 qInB = m_minkowskiB->localGetSupportVertexWithoutMarginNonVirtual(separatingAxisInB); btVector3 pWorld = localTransA(pInA); btVector3 qWorld = localTransB(qInB); if (check2d) { pWorld[2] = 0.f; qWorld[2] = 0.f; } btVector3 w = pWorld - qWorld; delta = m_cachedSeparatingAxis.dot(w); // potential exit, they don't overlap if ((delta > btScalar(0.0)) && (delta * delta > squaredDistance * input.m_maximumDistanceSquared)) { m_degenerateSimplex = 10; checkSimplex = true; //checkPenetration = false; break; } //exit 0: the new point is already in the simplex, or we didn't come any closer if (m_simplexSolver->inSimplex(w)) { m_degenerateSimplex = 1; checkSimplex = true; break; } // are we getting any closer ? btScalar f0 = squaredDistance - delta; btScalar f1 = squaredDistance * REL_ERROR2; if (f0 <= f1) { if (f0 <= btScalar(0.)) { m_degenerateSimplex = 2; } else { m_degenerateSimplex = 11; } checkSimplex = true; break; } //add current vertex to simplex m_simplexSolver->addVertex(w, pWorld, qWorld); btVector3 newCachedSeparatingAxis; //calculate the closest point to the origin (update vector v) if (!m_simplexSolver->closest(newCachedSeparatingAxis)) { m_degenerateSimplex = 3; checkSimplex = true; break; } if (newCachedSeparatingAxis.length2() < REL_ERROR2) { m_cachedSeparatingAxis = newCachedSeparatingAxis; m_degenerateSimplex = 6; checkSimplex = true; break; } btScalar previousSquaredDistance = squaredDistance; squaredDistance = newCachedSeparatingAxis.length2(); #if 0 ///warning: this termination condition leads to some problems in 2d test case see Bullet/Demos/Box2dDemo if (squaredDistance > previousSquaredDistance) { m_degenerateSimplex = 7; squaredDistance = previousSquaredDistance; checkSimplex = false; break; } #endif // //redundant m_simplexSolver->compute_points(pointOnA, pointOnB); //are we getting any closer ? if (previousSquaredDistance - squaredDistance <= SIMD_EPSILON * previousSquaredDistance) { // m_simplexSolver->backup_closest(m_cachedSeparatingAxis); checkSimplex = true; m_degenerateSimplex = 12; break; } m_cachedSeparatingAxis = newCachedSeparatingAxis; //degeneracy, this is typically due to invalid/uninitialized worldtransforms for a btCollisionObject if (m_curIter++ > gGjkMaxIter) { #if defined(DEBUG) || defined(_DEBUG) printf("btGjkPairDetector maxIter exceeded:%i\n", m_curIter); printf("sepAxis=(%f,%f,%f), squaredDistance = %f, shapeTypeA=%i,shapeTypeB=%i\n", m_cachedSeparatingAxis.getX(), m_cachedSeparatingAxis.getY(), m_cachedSeparatingAxis.getZ(), squaredDistance, m_minkowskiA->getShapeType(), m_minkowskiB->getShapeType()); #endif break; } bool check = (!m_simplexSolver->fullSimplex()); //bool check = (!m_simplexSolver->fullSimplex() && squaredDistance > SIMD_EPSILON * m_simplexSolver->maxVertex()); if (!check) { //do we need this backup_closest here ? // m_simplexSolver->backup_closest(m_cachedSeparatingAxis); m_degenerateSimplex = 13; break; } } if (checkSimplex) { m_simplexSolver->compute_points(pointOnA, pointOnB); normalInB = m_cachedSeparatingAxis; btScalar lenSqr = m_cachedSeparatingAxis.length2(); //valid normal if (lenSqr < REL_ERROR2) { m_degenerateSimplex = 5; } if (lenSqr > SIMD_EPSILON * SIMD_EPSILON) { btScalar rlen = btScalar(1.) / btSqrt(lenSqr); normalInB *= rlen; //normalize btScalar s = btSqrt(squaredDistance); btAssert(s > btScalar(0.0)); pointOnA -= m_cachedSeparatingAxis * (marginA / s); pointOnB += m_cachedSeparatingAxis * (marginB / s); distance = ((btScalar(1.) / rlen) - margin); isValid = true; orgNormalInB = normalInB; m_lastUsedMethod = 1; } else { m_lastUsedMethod = 2; } } } bool catchDegeneratePenetrationCase = (m_catchDegeneracies && m_penetrationDepthSolver && m_degenerateSimplex && ((distance + margin) < gGjkEpaPenetrationTolerance)); //if (checkPenetration && !isValid) if ((checkPenetration && (!isValid || catchDegeneratePenetrationCase)) || (status == 0)) { //penetration case //if there is no way to handle penetrations, bail out if (m_penetrationDepthSolver) { // Penetration depth case. btVector3 tmpPointOnA, tmpPointOnB; m_cachedSeparatingAxis.setZero(); bool isValid2 = m_penetrationDepthSolver->calcPenDepth( *m_simplexSolver, m_minkowskiA, m_minkowskiB, localTransA, localTransB, m_cachedSeparatingAxis, tmpPointOnA, tmpPointOnB, debugDraw); if (m_cachedSeparatingAxis.length2()) { if (isValid2) { btVector3 tmpNormalInB = tmpPointOnB - tmpPointOnA; btScalar lenSqr = tmpNormalInB.length2(); if (lenSqr <= (SIMD_EPSILON * SIMD_EPSILON)) { tmpNormalInB = m_cachedSeparatingAxis; lenSqr = m_cachedSeparatingAxis.length2(); } if (lenSqr > (SIMD_EPSILON * SIMD_EPSILON)) { tmpNormalInB /= btSqrt(lenSqr); btScalar distance2 = -(tmpPointOnA - tmpPointOnB).length(); m_lastUsedMethod = 3; //only replace valid penetrations when the result is deeper (check) if (!isValid || (distance2 < distance)) { distance = distance2; pointOnA = tmpPointOnA; pointOnB = tmpPointOnB; normalInB = tmpNormalInB; isValid = true; } else { m_lastUsedMethod = 8; } } else { m_lastUsedMethod = 9; } } else { ///this is another degenerate case, where the initial GJK calculation reports a degenerate case ///EPA reports no penetration, and the second GJK (using the supporting vector without margin) ///reports a valid positive distance. Use the results of the second GJK instead of failing. ///thanks to Jacob.Langford for the reproduction case ///http://code.google.com/p/bullet/issues/detail?id=250 if (m_cachedSeparatingAxis.length2() > btScalar(0.)) { btScalar distance2 = (tmpPointOnA - tmpPointOnB).length() - margin; //only replace valid distances when the distance is less if (!isValid || (distance2 < distance)) { distance = distance2; pointOnA = tmpPointOnA; pointOnB = tmpPointOnB; pointOnA -= m_cachedSeparatingAxis * marginA; pointOnB += m_cachedSeparatingAxis * marginB; normalInB = m_cachedSeparatingAxis; normalInB.normalize(); isValid = true; m_lastUsedMethod = 6; } else { m_lastUsedMethod = 5; } } } } else { //printf("EPA didn't return a valid value\n"); } } } } if (isValid && ((distance < 0) || (distance * distance < input.m_maximumDistanceSquared))) { m_cachedSeparatingAxis = normalInB; m_cachedSeparatingDistance = distance; if (1) { ///todo: need to track down this EPA penetration solver degeneracy ///the penetration solver reports penetration but the contact normal ///connecting the contact points is pointing in the opposite direction ///until then, detect the issue and revert the normal btScalar d2 = 0.f; { btVector3 separatingAxisInA = (-orgNormalInB) * localTransA.getBasis(); btVector3 separatingAxisInB = orgNormalInB * localTransB.getBasis(); btVector3 pInA = m_minkowskiA->localGetSupportVertexWithoutMarginNonVirtual(separatingAxisInA); btVector3 qInB = m_minkowskiB->localGetSupportVertexWithoutMarginNonVirtual(separatingAxisInB); btVector3 pWorld = localTransA(pInA); btVector3 qWorld = localTransB(qInB); btVector3 w = pWorld - qWorld; d2 = orgNormalInB.dot(w) - margin; } btScalar d1 = 0; { btVector3 separatingAxisInA = (normalInB)*localTransA.getBasis(); btVector3 separatingAxisInB = -normalInB * localTransB.getBasis(); btVector3 pInA = m_minkowskiA->localGetSupportVertexWithoutMarginNonVirtual(separatingAxisInA); btVector3 qInB = m_minkowskiB->localGetSupportVertexWithoutMarginNonVirtual(separatingAxisInB); btVector3 pWorld = localTransA(pInA); btVector3 qWorld = localTransB(qInB); btVector3 w = pWorld - qWorld; d1 = (-normalInB).dot(w) - margin; } btScalar d0 = 0.f; { btVector3 separatingAxisInA = (-normalInB) * input.m_transformA.getBasis(); btVector3 separatingAxisInB = normalInB * input.m_transformB.getBasis(); btVector3 pInA = m_minkowskiA->localGetSupportVertexWithoutMarginNonVirtual(separatingAxisInA); btVector3 qInB = m_minkowskiB->localGetSupportVertexWithoutMarginNonVirtual(separatingAxisInB); btVector3 pWorld = localTransA(pInA); btVector3 qWorld = localTransB(qInB); btVector3 w = pWorld - qWorld; d0 = normalInB.dot(w) - margin; } if (d1 > d0) { m_lastUsedMethod = 10; normalInB *= -1; } if (orgNormalInB.length2()) { if (d2 > d0 && d2 > d1 && d2 > distance) { normalInB = orgNormalInB; distance = d2; } } } output.addContactPoint( normalInB, pointOnB + positionOffset, distance); } else { //printf("invalid gjk query\n"); } }
{ "pile_set_name": "Github" }
.. testsetup:: * from pwn import * :mod:`pwnlib.rop.rop` --- Return Oriented Programming ========================================================== .. automodule:: pwnlib.rop.rop :members:
{ "pile_set_name": "Github" }
package p import ( . "github.com/alecthomas/chroma" // nolint "github.com/alecthomas/chroma/lexers/internal" ) // Prolog lexer. var Prolog = internal.Register(MustNewLexer( &Config{ Name: "Prolog", Aliases: []string{"prolog"}, Filenames: []string{"*.ecl", "*.prolog", "*.pro", "*.pl"}, MimeTypes: []string{"text/x-prolog"}, }, Rules{ "root": { {`/\*`, CommentMultiline, Push("nested-comment")}, {`%.*`, CommentSingle, nil}, {`0\'.`, LiteralStringChar, nil}, {`0b[01]+`, LiteralNumberBin, nil}, {`0o[0-7]+`, LiteralNumberOct, nil}, {`0x[0-9a-fA-F]+`, LiteralNumberHex, nil}, {`\d\d?\'[a-zA-Z0-9]+`, LiteralNumberInteger, nil}, {`(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?`, LiteralNumberFloat, nil}, {`\d+`, LiteralNumberInteger, nil}, {`[\[\](){}|.,;!]`, Punctuation, nil}, {`:-|-->`, Punctuation, nil}, {`"(?:\\x[0-9a-fA-F]+\\|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|\\[0-7]+\\|\\["\nabcefnrstv]|[^\\"])*"`, LiteralStringDouble, nil}, {`'(?:''|[^'])*'`, LiteralStringAtom, nil}, {`is\b`, Operator, nil}, {`(<|>|=<|>=|==|=:=|=|/|//|\*|\+|-)(?=\s|[a-zA-Z0-9\[])`, Operator, nil}, {`(mod|div|not)\b`, Operator, nil}, {`_`, Keyword, nil}, {`([a-z]+)(:)`, ByGroups(NameNamespace, Punctuation), nil}, {`([a-zÀ-῿぀-퟿-￯][\w$À-῿぀-퟿-￯]*)(\s*)(:-|-->)`, ByGroups(NameFunction, Text, Operator), nil}, {`([a-zÀ-῿぀-퟿-￯][\w$À-῿぀-퟿-￯]*)(\s*)(\()`, ByGroups(NameFunction, Text, Punctuation), nil}, {`[a-zÀ-῿぀-퟿-￯][\w$À-῿぀-퟿-￯]*`, LiteralStringAtom, nil}, {`[#&*+\-./:<=>?@\\^~¡-¿‐-〿]+`, LiteralStringAtom, nil}, {`[A-Z_]\w*`, NameVariable, nil}, {`\s+|[ -‏￰-￾￯]`, Text, nil}, }, "nested-comment": { {`\*/`, CommentMultiline, Pop(1)}, {`/\*`, CommentMultiline, Push()}, {`[^*/]+`, CommentMultiline, nil}, {`[*/]`, CommentMultiline, nil}, }, }, ))
{ "pile_set_name": "Github" }
# This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system use, # "ant.properties", and override values to adapt the script to your # project structure. # Project target. target=android-8
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <MarkupUI/MUCGPDFAnnotationAdaptor.h> __attribute__((visibility("hidden"))) @interface MUCGPDFLineAnnotationAdaptor : MUCGPDFAnnotationAdaptor { } + (id)_concreteDictionaryRepresentationOfAKAnnotation:(id)arg1 forPage:(struct CGPDFPage *)arg2; + (id)_concreteAKAnnotationWithCGPDFAnnotation:(struct CGPDFAnnotation *)arg1 ofPage:(struct CGPDFPage *)arg2; @end
{ "pile_set_name": "Github" }
<?php return [ "play" => "Ascolta Stream", "stop" => "Ferma Stream", "loading" => "Caricamento...", "options" => "Più Opzioni", "links" => [ "direct" => "Link Diretto Stream", "m3u" => "File di Stream.m3u", "pls" => "File di Stream .pls", "help" => "?" ], "dj" => "DJ", "listeners" => "Ascoltatori", "lp" => "Ultimi in onda", "queue" => "Coda", ];
{ "pile_set_name": "Github" }
// This is a generated file. Do not edit directly. module k8s.io/cloud-provider go 1.13 require ( k8s.io/api v0.18.0 k8s.io/apimachinery v0.18.0 k8s.io/client-go v0.18.0 k8s.io/klog v1.0.0 k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89 ) replace ( golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13 golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13 k8s.io/api => k8s.io/api v0.18.0 k8s.io/apimachinery => k8s.io/apimachinery v0.18.0 k8s.io/client-go => k8s.io/client-go v0.18.0 )
{ "pile_set_name": "Github" }
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Utility to run dialogs.""" from botbuilder.core import StatePropertyAccessor, TurnContext from botbuilder.dialogs import Dialog, DialogSet, DialogTurnStatus class DialogHelper: """Dialog Helper implementation.""" @staticmethod async def run_dialog( dialog: Dialog, turn_context: TurnContext, accessor: StatePropertyAccessor ): # pylint: disable=line-too-long """Run dialog.""" dialog_set = DialogSet(accessor) dialog_set.add(dialog) dialog_context = await dialog_set.create_context(turn_context) results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: await dialog_context.begin_dialog(dialog.id)
{ "pile_set_name": "Github" }
<!DOCTYPE html> <title>Sticky positioned element should be observable by offsetTop and offsetLeft</title> <link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" /> <meta name="assert" content="This test checks that a sticky positioned element should be observable by offsetTop/offsetLeft." /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <style> body { margin: 0; } .container { position: relative; /* Required for offsetTop/offsetLeft tests. */ overflow: scroll; width: 200px; height: 200px; } .spacer { width: 2000px; height: 2000px; } .box { width: 100px; height: 100px; background-color: green; } .sticky { position: sticky; top: 50px; left: 20px; } </style> <div id="scroller1" class="container"> <div class="spacer"></div> </div> <script> test(() => { var scroller = document.getElementById('scroller1'); scroller.scrollTop = 100; scroller.scrollLeft = 75; var sticky = document.createElement('div'); sticky.className = 'sticky box'; scroller.insertBefore(sticky, scroller.querySelector('.spacer')); assert_equals(sticky.offsetTop, scroller.scrollTop + 50); assert_equals(sticky.offsetLeft, scroller.scrollLeft + 20); }, 'offsetTop/offsetLeft should be correct for sticky after script insertion'); </script> <div id="scroller2" class="container"> <div id="sticky2" class="sticky box"></div> <div class="spacer"></div> </div> <script> test(function() { var scroller = document.getElementById('scroller2'); var sticky = document.getElementById('sticky2'); scroller.scrollTop = 100; scroller.scrollLeft = 75; var div = document.createElement('div'); div.style.height = '65px'; scroller.insertBefore(div, sticky); assert_equals(sticky.offsetTop, scroller.scrollTop + 50); assert_equals(sticky.offsetLeft, scroller.scrollLeft + 20); }, 'offsetTop/offsetLeft should be correct for sticky after script-caused layout'); </script>
{ "pile_set_name": "Github" }
! -*- f90 -*- ! ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_allocate_shared_f08(size, disp_unit, info, comm, & baseptr, win, ierror) USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR use :: mpi_f08_types, only : MPI_Info, MPI_Comm, MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_win_allocate_shared_f implicit none INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: size INTEGER, INTENT(IN) :: disp_unit TYPE(MPI_Info), INTENT(IN) :: info TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(C_PTR), INTENT(OUT) :: baseptr TYPE(MPI_Win), INTENT(OUT) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror call ompi_win_allocate_shared_f(size, disp_unit, info%MPI_VAL, comm%MPI_VAL, baseptr, win%MPI_VAL, c_ierror) if (present(ierror)) ierror = c_ierror end subroutine MPI_Win_allocate_shared_f08
{ "pile_set_name": "Github" }
// Copyright (C) 2018 Google Inc. // // 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. package dependencygraph2 import ( "context" "fmt" "github.com/google/gapid/core/app/benchmark" "github.com/google/gapid/core/log" "github.com/google/gapid/core/memory/arena" "github.com/google/gapid/gapis/api" "github.com/google/gapid/gapis/api/transform" "github.com/google/gapid/gapis/capture" "github.com/google/gapid/gapis/config" "github.com/google/gapid/gapis/service/path" ) var ( dCE2Counter = benchmark.Duration("DCE2") dCE2CmdDeadCounter = benchmark.Integer("DCE2.cmd.dead") dCE2CmdLiveCounter = benchmark.Integer("DCE2.cmd.live") dCE2DrawDeadCounter = benchmark.Integer("DCE2.draw.dead") dCE2DrawLiveCounter = benchmark.Integer("DCE2.draw.live") dCE2DataDeadCounter = benchmark.Integer("DCE2.data.dead") dCE2DataLiveCounter = benchmark.Integer("DCE2.data.live") ) // DCECapture returns a new capture containing only the requested commands and their dependencies. func DCECapture(ctx context.Context, name string, p *path.Capture, requestedCmds []*path.Command) (*path.Capture, error) { c, err := capture.ResolveGraphicsFromPath(ctx, p) if err != nil { return nil, err } ctx = log.Enter(ctx, "DCECapture") cfg := DependencyGraphConfig{ MergeSubCmdNodes: !config.DeadSubCmdElimination, IncludeInitialCommands: false, } graph, err := GetDependencyGraph(ctx, p, cfg) if err != nil { return nil, fmt.Errorf("Could not build dependency graph for DCE: %v", err) } builder := NewDCEBuilder(graph) for _, cmd := range requestedCmds { id := cmd.Indices[0] log.D(ctx, "Requested (%d) %v\n", id, c.Commands[id]) err := builder.Request(ctx, api.SubCmdIdx(cmd.Indices)) if err != nil { return nil, err } } builder.Build(ctx) if gc, err := capture.NewGraphicsCapture(ctx, arena.New(), name, c.Header, c.InitialState, builder.LiveCmds()); err != nil { return nil, err } else { return capture.New(ctx, gc) } } // DCEBuilder tracks the data necessary to perform dead-command-eliminition on a capture type DCEBuilder struct { graph DependencyGraph requestedNodes []NodeID isLive []bool liveCmds []api.Cmd origCmdIDs []api.CmdID liveCmdIDs map[api.CmdID]api.CmdID numLiveInitCmds int orphanObs []ObsNode numDead, numLive int deadMem, liveMem uint64 } func keepCommandAlive(builder *DCEBuilder, id api.CmdID) { nodeID := builder.graph.GetCmdNodeID(id, api.SubCmdIdx{}) if nodeID != NodeNoID && !builder.isLive[nodeID] { builder.isLive[nodeID] = true builder.requestedNodes = append(builder.requestedNodes, nodeID) } } // NewDCEBuilder creates a new DCEBuiler using the specified dependency graph func NewDCEBuilder(graph DependencyGraph) *DCEBuilder { b := &DCEBuilder{ graph: graph, isLive: make([]bool, graph.NumNodes()), liveCmds: make([]api.Cmd, 0, len(graph.Capture().Commands)), origCmdIDs: make([]api.CmdID, 0, len(graph.Capture().Commands)), liveCmdIDs: make(map[api.CmdID]api.CmdID), } for i := 0; i < b.graph.NumInitialCommands(); i++ { cmdID := api.CmdID(i).Derived() cmd := b.graph.GetCommand(cmdID) if cmd.Alive() || config.AllInitialCommandsLive { keepCommandAlive(b, cmdID) } } for i, cmd := range b.graph.Capture().Commands { if cmd.Alive() { keepCommandAlive(b, (api.CmdID)(i)) } } for _, cmdID := range b.graph.GetUnopenedForwardDependencies() { keepCommandAlive(b, cmdID) } return b } // LiveCmdID maps CmdIDs from the original capture to CmdIDs in within the live commands. // If the old CmdID refers to a dead command, the returned command will refer to the next live command; if there is no next live command, api.CmdNoID is returned. func (b *DCEBuilder) LiveCmdID(oldCmdID api.CmdID) api.CmdID { liveCmdID, ok := b.liveCmdIDs[oldCmdID] if !ok { return api.CmdNoID } return liveCmdID } // OriginalCmdIDs maps a live CmdID to the CmdID of the corresponding command in the original capture func (b *DCEBuilder) OriginalCmdID(liveCmdID api.CmdID) api.CmdID { if liveCmdID.IsReal() { liveCmdID += api.CmdID(b.numLiveInitCmds) } else { liveCmdID = liveCmdID.Real() } return b.origCmdIDs[liveCmdID] } // NumLiveInitiCmds returns the number of live commands which are initial commands. // (Initial commands are generated commands to recreate the initial state). func (b *DCEBuilder) NumLiveInitCmds() int { return b.numLiveInitCmds } // LiveCmds returns the live commands func (b *DCEBuilder) LiveCmds() []api.Cmd { return b.liveCmds } // Build runs the dead-code-elimination. // The subcommands specified in cmds are marked alive, along with their transitive dependencies. func (b *DCEBuilder) Build(ctx context.Context) error { ctx = log.Enter(ctx, "DCEBuilder.Build") t0 := dCE2Counter.Start() // Mark all the transitive dependencies of the live nodes as also being alive. b.markDependencies() dCE2Counter.Stop(t0) b.buildLiveCmds(ctx) b.LogStats(ctx) if config.DebugDeadCodeElimination { b.printAllCmds(ctx) } return nil } func (b *DCEBuilder) LogStats(ctx context.Context) { numCmd := len(b.graph.Capture().Commands) + b.graph.NumInitialCommands() dCE2CmdDeadCounter.Add(int64(b.numDead)) dCE2CmdLiveCounter.Add(int64(b.numLive)) dCE2DataDeadCounter.Add(int64(b.deadMem)) dCE2DataLiveCounter.Add(int64(b.liveMem)) log.I(ctx, "DCE2: dead: %v%% %v cmds %v MB, live: %v%% %v cmds %v MB, time: %v", 100*b.numDead/numCmd, b.numDead, b.deadMem/1024/1024, 100*b.numLive/numCmd, b.numLive, b.liveMem/1024/1024, dCE2Counter.Get()) } // Mark as alive all the transitive dependencies of live nodes. // This is just BFS. func (b *DCEBuilder) markDependencies() { // TODO: See if a more efficient queue is necessary queue := make([]NodeID, len(b.requestedNodes)) copy(queue, b.requestedNodes) for len(queue) > 0 { src := queue[0] queue = queue[1:] b.graph.ForeachDependencyFrom(src, func(tgt NodeID) error { if !b.isLive[tgt] { b.isLive[tgt] = true queue = append(queue, tgt) } return nil }) } } func (b *DCEBuilder) printAllCmds(ctx context.Context) { b.graph.ForeachNode(func(nodeID NodeID, node Node) error { alive := b.isLive[nodeID] status := "ALIVE" if !alive { status = "DEAD " } if cmdNode, ok := node.(CmdNode); ok && len(cmdNode.Index) == 1 { cmdID := api.CmdID(cmdNode.Index[0]) cmd := b.graph.GetCommand(cmdID) log.D(ctx, "[ %s ] (%v / %v) %v\n", status, cmdID, b.LiveCmdID(cmdID), cmd) } else if obsNode, ok := node.(ObsNode); ok { cmdStatus := "DEAD " if obsNode.CmdID != api.CmdNoID { ownerIdx := api.SubCmdIdx{uint64(obsNode.CmdID)} ownerNodeID := b.graph.GetCmdNodeID(api.CmdID(ownerIdx[0]), ownerIdx[1:]) if b.isLive[ownerNodeID] { cmdStatus = "ALIVE" } } liveCmdID := b.LiveCmdID(obsNode.CmdID) log.D(ctx, "[ %s ] (%v [%s] / %v) Range: %v Pool: %v ID: %v\n", status, obsNode.CmdID, cmdStatus, liveCmdID, obsNode.CmdObservation.Range, obsNode.CmdObservation.Pool, obsNode.CmdObservation.ID) } return nil }) } // Builds liveCmds, containing the commands marked alive. // These commands may be cloned and modified from the commands in the original capture. // Live memory observations associated with dead commands are moved to the next live command. func (b *DCEBuilder) buildLiveCmds(ctx context.Context) { // Process each node in chronological order // (see DependencyGraph.ForeachNode for clarification). b.graph.ForeachNode(func(nodeID NodeID, node Node) error { alive := b.isLive[nodeID] if cmdNode, ok := node.(CmdNode); ok { if len(cmdNode.Index) > 1 { return nil } cmdID := api.CmdID(cmdNode.Index[0]) cmd := b.graph.GetCommand(cmdID) if alive { b.numLive++ b.processLiveCmd(ctx, b.graph.Capture().Arena, cmdID, cmd) } else { b.numDead++ } } else if obsNode, ok := node.(ObsNode); ok { if alive { b.liveMem += obsNode.CmdObservation.Range.Size b.processLiveObs(ctx, obsNode) } else { b.deadMem += obsNode.CmdObservation.Range.Size } } return nil }) } // Process a live command. // This involves possibly cloning and modifying the command, and then adding it to liveCmds. func (b *DCEBuilder) processLiveCmd(ctx context.Context, a arena.Arena, id api.CmdID, cmd api.Cmd) { // Helper to clone the command if we need to modify it. // Cloning is necessary before any modification because this command is // still used by another capture. // This clones the command at most one time, even if we make multiple modifications. isCloned := false cloneCmd := func() { if !isCloned { isCloned = true cmd = cmd.Clone(a) } } // Attach any orphan observations to this command if len(b.orphanObs) > 0 { cloneCmd() b.attachOrphanObs(ctx, id, cmd) } // compute the cmdID within the live commands liveCmdID := api.CmdID(len(b.liveCmds)) if id.IsReal() { liveCmdID -= api.CmdID(b.numLiveInitCmds) } else { liveCmdID = liveCmdID.Derived() b.numLiveInitCmds++ } b.liveCmdIDs[id] = liveCmdID b.liveCmds = append(b.liveCmds, cmd) b.origCmdIDs = append(b.origCmdIDs, id) } // Adds the current orphan observations as read observations of the specified command. func (b *DCEBuilder) attachOrphanObs(ctx context.Context, id api.CmdID, cmd api.Cmd) { extras := make(api.CmdExtras, len(cmd.Extras().All())) copy(extras, cmd.Extras().All()) obs := extras.Observations() oldReads := []api.CmdObservation{} if obs == nil { obs = &api.CmdObservations{ Reads: make([]api.CmdObservation, 0, len(b.orphanObs)), } extras.Add(obs) } else { oldReads = obs.Reads oldObs := obs obs = &api.CmdObservations{ Reads: make([]api.CmdObservation, 0, len(b.orphanObs)+len(oldReads)), Writes: make([]api.CmdObservation, len(oldObs.Writes)), } copy(obs.Writes, oldObs.Writes) extras.Replace(oldObs, obs) } for _, o := range b.orphanObs { obs.Reads = append(obs.Reads, o.CmdObservation) if config.DebugDeadCodeElimination { cmdObservations := b.graph.GetCommand(o.CmdID).Extras().Observations() var cmdObs api.CmdObservation if o.IsWrite { cmdObs = cmdObservations.Writes[o.Index] } else { cmdObs = cmdObservations.Reads[o.Index] } log.D(ctx, "Adding orphan obs: [%v] %v\n", id, o, cmdObs) } } b.orphanObs = b.orphanObs[:0] obs.Reads = append(obs.Reads, oldReads...) *cmd.Extras() = extras } // Process a live memory observation. // If this observation is attached to a non-live command, it will be saved into // `orphanObs` to be attached to the next live command. func (b *DCEBuilder) processLiveObs(ctx context.Context, obs ObsNode) { if obs.CmdID == api.CmdNoID { return } cmdNode := b.graph.GetCmdNodeID(obs.CmdID, api.SubCmdIdx{}) if !b.isLive[cmdNode] { b.orphanObs = append(b.orphanObs, obs) } } // Request added a requsted command or subcommand, represented by its full // command index, to the DCE. func (b *DCEBuilder) Request(ctx context.Context, fci api.SubCmdIdx) error { if config.DebugDeadCodeElimination { log.D(ctx, "Requesting [%v] %v", fci[0], b.graph.GetCommand(api.CmdID(fci[0]))) } nodeID := b.graph.GetCmdNodeID((api.CmdID)(fci[0]), fci[1:]) if nodeID == NodeNoID { return fmt.Errorf("Requested dependencies of cmd not in graph: %v", fci) } if !b.isLive[nodeID] { b.isLive[nodeID] = true b.requestedNodes = append(b.requestedNodes, nodeID) } return nil } // Transform is to comform the interface of Transformer, but does not accept // any input. func (*DCEBuilder) Transform(ctx context.Context, id api.CmdID, c api.Cmd, out transform.Writer) error { panic(fmt.Errorf("This transform does not accept input commands")) } // Flush is to comform the interface of Transformer. Flush performs DCE, and // sends the live commands to the writer func (b *DCEBuilder) Flush(ctx context.Context, out transform.Writer) error { b.Build(ctx) for i, cmd := range b.LiveCmds() { liveCmdID := api.CmdID(i) if i < b.numLiveInitCmds { liveCmdID = liveCmdID.Derived() } else { liveCmdID -= api.CmdID(b.numLiveInitCmds) } cmdID := b.OriginalCmdID(liveCmdID) if config.DebugDeadCodeElimination { log.D(ctx, "Flushing [%v / %v] %v", cmdID, liveCmdID, cmd) } if err := out.MutateAndWrite(ctx, cmdID, cmd); err != nil { return err } } return nil } func (b *DCEBuilder) PreLoop(ctx context.Context, out transform.Writer) {} func (b *DCEBuilder) PostLoop(ctx context.Context, out transform.Writer) {} func (t *DCEBuilder) BuffersCommands() bool { return false }
{ "pile_set_name": "Github" }
/* This file is part of the iText (R) project. Copyright (c) 1998-2020 iText Group NV Authors: iText Software. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation with the addition of the following permission added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program; if not, see http://www.gnu.org/licenses or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, 02110-1301 USA, or download the license from the following URL: http://itextpdf.com/terms-of-use/ The interactive user interfaces in modified source and object code versions of this program must display Appropriate Legal Notices, as required under Section 5 of the GNU Affero General Public License. In accordance with Section 7(b) of the GNU Affero General Public License, a covered work must retain the producer line in every PDF that is created or manipulated using iText. You can be released from the requirements of the license by purchasing a commercial license. Buying such a license is mandatory as soon as you develop commercial activities involving the iText software without disclosing the source code of your own applications. These activities include: offering paid services to customers as an ASP, serving PDFs on the fly in a web application, shipping iText with a closed source product. For more information, please contact iText Software Corp. at this address: [email protected] */ using System; using iTextSharp.text.pdf; namespace iTextSharp.text.pdf.interfaces { /** * A PDF document can have an open action and other additional actions. */ public interface IPdfDocumentActions { /** * When the document opens it will jump to the destination with * this name. * @param name the name of the destination to jump to */ void SetOpenAction(String name); /** * When the document opens this <CODE>action</CODE> will be * invoked. * @param action the action to be invoked */ void SetOpenAction(PdfAction action); /** * Additional-actions defining the actions to be taken in * response to various trigger events affecting the document * as a whole. The actions types allowed are: <CODE>DOCUMENT_CLOSE</CODE>, * <CODE>WILL_SAVE</CODE>, <CODE>DID_SAVE</CODE>, <CODE>WILL_PRINT</CODE> * and <CODE>DID_PRINT</CODE>. * * @param actionType the action type * @param action the action to execute in response to the trigger * @throws DocumentException on invalid action type */ void SetAdditionalAction(PdfName actionType, PdfAction action); } }
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * 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. */ package org.apache.usergrid.rest.exceptions; public class UnsupportedRestOperationException extends RuntimeException{ public UnsupportedRestOperationException(String message ) { super(message); } }
{ "pile_set_name": "Github" }
package service import ( "context" "flag" "path/filepath" "strings" "testing" pb "go-common/app/service/main/sms/api" "go-common/app/service/main/sms/conf" "go-common/library/log" . "github.com/smartystreets/goconvey/convey" ) var ( s *Service ) func init() { dir, _ := filepath.Abs("../cmd/sms-service-test.toml") flag.Set("conf", dir) flag.Parse() if err := conf.Init(); err != nil { panic(err) } log.Init(conf.Conf.Xlog) defer log.Close() s = New(conf.Conf) } func Test_Send(t *testing.T) { Convey("send", t, func() { req := &pb.SendReq{ Mobile: "17621660828", Tcode: "acc_01111", } _, err := s.Send(context.Background(), req) So(err, ShouldBeNil) }) } func Test_Param(t *testing.T) { Convey("solve param", t, func() { var ( template = "test#[code].very#[code] code" strs []string param = make(map[string]string) ss []string ) strs = strings.SplitAfter(template, "#[") for i, v := range strs { if i == 0 { continue } t.Logf("%s", v) t.Logf("%d", strings.Index(v, "]")) k := v[0:strings.Index(v, "]")] param[k] = "" } for k := range param { ss = append(ss, k) } t.Logf("%v", ss) t.Logf(strings.Replace(template, "#[codes]", "888", -1)) }) }
{ "pile_set_name": "Github" }
From b11218c750ab92cfab4408a0328f1b36ceec3f33 Mon Sep 17 00:00:00 2001 From: Jonas Gorski <[email protected]> Date: Fri, 6 Jan 2012 12:24:18 +0100 Subject: [PATCH 19/63] NET: bcm63xx_enet: move phy_(dis)connect into probe/remove Only connect/disconnect the phy during probe and remove, not during any open/close. The phy seldom changes during the runtime, and disconnecting the phy during close will prevent it from keeping any configuration over a down/up cycle. Signed-off-by: Jonas Gorski <[email protected]> --- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 84 +++++++++++++------------- 1 files changed, 41 insertions(+), 43 deletions(-) --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c @@ -871,10 +871,8 @@ static int bcm_enet_open(struct net_devi struct bcm_enet_priv *priv; struct sockaddr addr; struct device *kdev; - struct phy_device *phydev; int i, ret; unsigned int size; - char phy_id[MII_BUS_ID_SIZE + 3]; void *p; u32 val; @@ -882,40 +880,10 @@ static int bcm_enet_open(struct net_devi kdev = &priv->pdev->dev; if (priv->has_phy) { - /* connect to PHY */ - snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, - priv->mii_bus->id, priv->phy_id); - - phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, - PHY_INTERFACE_MODE_MII); - - if (IS_ERR(phydev)) { - dev_err(kdev, "could not attach to PHY\n"); - return PTR_ERR(phydev); - } - - /* mask with MAC supported features */ - phydev->supported &= (SUPPORTED_10baseT_Half | - SUPPORTED_10baseT_Full | - SUPPORTED_100baseT_Half | - SUPPORTED_100baseT_Full | - SUPPORTED_Autoneg | - SUPPORTED_Pause | - SUPPORTED_MII); - phydev->advertising = phydev->supported; - - if (priv->pause_auto && priv->pause_rx && priv->pause_tx) - phydev->advertising |= SUPPORTED_Pause; - else - phydev->advertising &= ~SUPPORTED_Pause; - - dev_info(kdev, "attached PHY at address %d [%s]\n", - phydev->addr, phydev->drv->name); - + /* Reset state */ priv->old_link = 0; priv->old_duplex = -1; priv->old_pause = -1; - priv->phydev = phydev; } /* mask all interrupts and request them */ @@ -925,7 +893,7 @@ static int bcm_enet_open(struct net_devi ret = request_irq(dev->irq, bcm_enet_isr_mac, 0, dev->name, dev); if (ret) - goto out_phy_disconnect; + return ret; ret = request_irq(priv->irq_rx, bcm_enet_isr_dma, 0, dev->name, dev); @@ -1128,9 +1096,6 @@ out_freeirq_rx: out_freeirq: free_irq(dev->irq, dev); -out_phy_disconnect: - phy_disconnect(priv->phydev); - return ret; } @@ -1235,12 +1200,6 @@ static int bcm_enet_stop(struct net_devi free_irq(priv->irq_rx, dev); free_irq(dev->irq, dev); - /* release phy */ - if (priv->has_phy) { - phy_disconnect(priv->phydev); - priv->phydev = NULL; - } - return 0; } @@ -1831,6 +1790,8 @@ static int bcm_enet_probe(struct platfor /* MII bus registration */ if (priv->has_phy) { + struct phy_device *phydev; + char phy_id[MII_BUS_ID_SIZE + 3]; priv->mii_bus = mdiobus_alloc(); if (!priv->mii_bus) { @@ -1868,6 +1829,38 @@ static int bcm_enet_probe(struct platfor dev_err(&pdev->dev, "unable to register mdio bus\n"); goto out_free_mdio; } + + /* connect to PHY */ + snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, + priv->mii_bus->id, priv->phy_id); + + phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, + PHY_INTERFACE_MODE_MII); + + if (IS_ERR(phydev)) { + dev_err(&pdev->dev, "could not attach to PHY\n"); + goto out_unregister_mdio; + } + + /* mask with MAC supported features */ + phydev->supported &= (SUPPORTED_10baseT_Half | + SUPPORTED_10baseT_Full | + SUPPORTED_100baseT_Half | + SUPPORTED_100baseT_Full | + SUPPORTED_Autoneg | + SUPPORTED_Pause | + SUPPORTED_MII); + phydev->advertising = phydev->supported; + + if (priv->pause_auto && priv->pause_rx && priv->pause_tx) + phydev->advertising |= SUPPORTED_Pause; + else + phydev->advertising &= ~SUPPORTED_Pause; + + dev_info(&pdev->dev, "attached PHY at address %d [%s]\n", + phydev->addr, phydev->drv->name); + + priv->phydev = phydev; } else { /* run platform code to initialize PHY device */ @@ -1913,6 +1906,9 @@ static int bcm_enet_probe(struct platfor return 0; out_unregister_mdio: + if (priv->phydev) + phy_disconnect(priv->phydev); + if (priv->mii_bus) mdiobus_unregister(priv->mii_bus); @@ -1954,6 +1950,8 @@ static int bcm_enet_remove(struct platfo enet_writel(priv, 0, ENET_MIISC_REG); if (priv->has_phy) { + phy_disconnect(priv->phydev); + priv->phydev = NULL; mdiobus_unregister(priv->mii_bus); mdiobus_free(priv->mii_bus); } else {
{ "pile_set_name": "Github" }
/* * Copyright (C) 2019 The Android Open Source Project * * 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 */ package com.android.settings.wallpaper; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.when; import android.content.ContentResolver; import android.content.Context; import android.content.res.Resources; import android.provider.Settings; import com.android.settings.testutils.shadow.ShadowSecureSettings; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) public class StyleSuggestionActivityTest { @Mock private Context mContext; @Mock private Resources mResources; @Mock private ContentResolver mContentResolver; @Before public void setUp() { MockitoAnnotations.initMocks(this); when(mContext.getResources()).thenReturn(mResources); when(mContext.getContentResolver()).thenReturn(mContentResolver); } @Test public void wallpaperServiceEnabled_no_shouldReturnTrue() { when(mResources.getBoolean(com.android.internal.R.bool.config_enableWallpaperService)) .thenReturn(false); assertThat(StyleSuggestionActivity.isSuggestionComplete(mContext)).isTrue(); } @Test @Config(shadows = ShadowSecureSettings.class) public void hasStyleSet_yes_shouldReturnTrue() { when(mResources.getBoolean(com.android.internal.R.bool.config_enableWallpaperService)) .thenReturn(true); Settings.Secure.putString(mContentResolver, Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES, "test"); assertThat(StyleSuggestionActivity.isSuggestionComplete(mContext)).isTrue(); } @Test @Config(shadows = ShadowSecureSettings.class) public void hasStyleSet_no_shouldReturnFalse() { when(mResources.getBoolean(com.android.internal.R.bool.config_enableWallpaperService)) .thenReturn(true); Settings.Secure.putString(mContentResolver, Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES, null); assertThat(StyleSuggestionActivity.isSuggestionComplete(mContext)).isFalse(); } }
{ "pile_set_name": "Github" }
(function(){for(j=0;j<3;++j)NaN=42})(); assertEq(NaN != NaN, true);
{ "pile_set_name": "Github" }
require('../../modules/es6.regexp.flags'); var flags = require('../../modules/_flags'); module.exports = function (it) { return flags.call(it); };
{ "pile_set_name": "Github" }
# # Makefile for ALSA # Copyright (c) 2001 by Jaroslav Kysela <[email protected]> # snd-vx222-objs := vx222.o vx222_ops.o obj-$(CONFIG_SND_VX222) += snd-vx222.o
{ "pile_set_name": "Github" }
// +build integration package test import ( "os/exec" "strings" "testing" ) func TestEnvBasic(t *testing.T) { TrySuite(t, testEnvOverrides, retryCount) } func testEnvBasic(t *T) { outp, err := exec.Command("micro", "-env=platform", "env").CombinedOutput() if err != nil { t.Fatal(err) return } if !strings.Contains(string(outp), "platform") || !strings.Contains(string(outp), "server") || !strings.Contains(string(outp), "local") { t.Fatal("Env output lacks local, server, or platform") return } } func TestEnvOverrides(t *testing.T) { TrySuite(t, testEnvOverrides, retryCount) } func testEnvOverrides(t *T) { outp, err := exec.Command("micro", "-env=platform", "env").CombinedOutput() if err != nil { t.Fatal(err) return } if !strings.Contains(string(outp), "* platform") { t.Fatal("Env platform is not selected") return } outp, err = exec.Command("micro", "-e=platform", "env").CombinedOutput() if err != nil { t.Fatal(err) return } if !strings.Contains(string(outp), "* platform") { t.Fatal("Env platform is not selected") return } } func TestEnvOps(t *testing.T) { TrySuite(t, testEnvOps, retryCount) } func testEnvOps(t *T) { // add an env _, err := exec.Command("micro", "env", "add", "fooTestEnvOps", "127.0.0.1:8081").CombinedOutput() if err != nil { t.Fatalf("Error running micro env %s", err) return } outp, err := exec.Command("micro", "env").CombinedOutput() if err != nil { t.Fatalf("Error running micro env %s", err) return } if !strings.Contains(string(outp), "fooTestEnvOps") { t.Fatalf("Cannot find expected environment. Output %s", outp) return } // can we actually set it correctly _, err = exec.Command("micro", "env", "set", "fooTestEnvOps").CombinedOutput() if err != nil { t.Fatalf("Error running micro env %s", err) return } outp, err = exec.Command("micro", "env").CombinedOutput() if err != nil { t.Fatalf("Error running micro env %s", err) return } if !strings.Contains(string(outp), "* fooTestEnvOps") { t.Fatalf("Environment not set. Output %s", outp) return } _, err = exec.Command("micro", "env", "set", "local").CombinedOutput() if err != nil { t.Fatalf("Error running micro env %s", err) return } // we should be able to delete it too _, err = exec.Command("micro", "env", "del", "fooTestEnvOps").CombinedOutput() if err != nil { t.Fatalf("Error running micro env %s", err) return } outp, err = exec.Command("micro", "env").CombinedOutput() if err != nil { t.Fatalf("Error running micro env %s", err) return } if strings.Contains(string(outp), "fooTestEnvOps") { t.Fatalf("Found unexpected environment. Output %s", outp) return } }
{ "pile_set_name": "Github" }
{ "host" : "farmer.cloudmqtt.com", "locatorDisplacement" : 200, "subTopic" : "", "usepolicy" : false, "validatecertificatechain" : false, "ignoreStaleLocations" : 0, "cleanSession" : false, "locked" : false, "url" : "", "usePassword" : true, "positions" : 50, "mode" : 0, "tls" : false, "willRetain" : false, "ignoreInaccurateLocations" : 0, "extendedData" : true, "monitoring" : 2, "_type" : "configuration", "locatorInterval" : 180, "maxHistory" : 0, "waypoints" : [ ], "ws" : false, "username" : "race-write", "policymode" : 0, "willTopic" : "", "clientpkcs" : "", "ranging" : false, "keepalive" : 60, "willQos" : 1, "pubTopicBase" : "", "auth" : true, "passphrase" : "", "allowinvalidcerts" : false, "port" : 16448, "clientId" : "", "mqttProtocolLevel" : 4, "sub" : false, "allowRemoteLocation" : true, "pubQos" : 1, "password" : "Qvi2fRGFu.BM8PVy_a9Dm6iJG_NmCZ", "validatedomainname" : false, "subQos" : 1, "servercer" : "", "cmd" : false, "pubRetain" : true }
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html lang="zh-CN"> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/> <title>Long description for screen shot of Windows 95 font description GUI</title> </head> <body> <h1>Long description for screen shot of Windows 95 font description GUI</h1> <P>This image shows the Windows 95 GUI that describes the characteristics of a given font. In particular, it shows the PANOSE classification of the Georgia Italic font face. <P><a href="../../notes.html#img-panose-16">Return to image.</a> </body> </html>
{ "pile_set_name": "Github" }
# gesture_app A new Flutter application. ## Getting Started For help getting started with Flutter, view our online [documentation](https://flutter.io/).
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <div> <div class="card"> <h1>Profile 1</h1> <div> <form> <div> <label for="name">Name</label> <input type="text" name="name" id="name" value=""/> </div> </form> </div> </div> <div class="card"> <h1>Profile 2</h1> <div> <form> <div> <label for="name">Name</label> <input type="text" name="name" id="name" value=""/> </div> </form> </div> </div> </div>
{ "pile_set_name": "Github" }
Class { #name : #PMContinuedFraction, #superclass : #PMInfiniteSeries, #instVars : [ 'numerator', 'denominator' ], #category : 'Math-Series' } { #category : #operation } PMContinuedFraction >> evaluateIteration [ "Perform one iteration." | terms delta | terms := termServer termsAt: iterations. denominator := 1 / ( self limitedSmallValue: ( (terms at: 1) * denominator + (terms at: 2))). numerator := self limitedSmallValue: ( (terms at: 1) / numerator + (terms at: 2)). delta := numerator * denominator. result := result * delta. ^( delta - 1) abs ] { #category : #operation } PMContinuedFraction >> initializeIterations [ "Initialize the series." numerator := self limitedSmallValue: termServer initialTerm. denominator := 0. result := numerator ]
{ "pile_set_name": "Github" }
/* Javascript for IE. It applies the 'sfhover' class to li elements in the 'nav' id'd ul element when they are 'moused over' and removes it, using a regular expression, when 'moused out'. */ sfHover = function() { var sfEls = document.getElementById("secondary_tabs").getElementsByTagName("LI"); for (var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=" sfhover"; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); } } } if (window.attachEvent) window.attachEvent("onload", sfHover);
{ "pile_set_name": "Github" }
--- archs: [ armv7, armv7s, arm64 ] platform: ios install-name: /System/Library/PrivateFrameworks/SymptomDiagnosticReporter.framework/SymptomDiagnosticReporter current-version: 820.30.7 compatibility-version: 1 exports: - archs: [ armv7, armv7s, arm64 ] symbols: [ _kDebuggabilityPath, _kDiagnosticCaseSummaryKeyAttachments, _kDiagnosticCaseSummaryKeyCaseIdentifier, _kDiagnosticCaseSummaryKeyCaseStatus, _kDiagnosticCaseSummaryKeyCaseStatusCaseClosedTime, _kDiagnosticCaseSummaryKeyCaseStatusCaseClosedTimestamp, _kDiagnosticCaseSummaryKeyCaseStatusCaseOpenedTime, _kDiagnosticCaseSummaryKeyCaseStatusCaseOpenedTimestamp, _kDiagnosticCaseSummaryKeyCaseStatusClosureType, _kDiagnosticCaseSummaryKeyCaseStatusDampeningType, _kDiagnosticCaseSummaryKeyCaseStatusRemoteTrigger, _kDiagnosticCaseSummaryKeyEvent, _kDiagnosticCaseSummaryKeySignature, _kDiagnosticCaseSummaryKeySystemProperties, _kDiagnosticCaseSummaryKeySystemPropertiesBuildVersion, _kDiagnosticCaseSummaryKeySystemPropertiesProductName, _kDiagnosticCaseSummaryKeySystemPropertiesProductType, _kDiagnosticCaseSummaryKeySystemPropertiesProductVersion, _kExpertSystemStatusKeyActiveCases, _kExpertSystemStatusKeyArbitratorExpertSystemHandler, _kExpertSystemStatusKeyAverageCasesPerDay, _kExpertSystemStatusKeyCLIPSModules, _kExpertSystemStatusKeyFailedToLoadDefaultRules, _kExpertSystemStatusKeyHasOpenCases, _kExpertSystemStatusKeyLoadedCLIPSRulesAndFacts, _kExpertSystemStatusKeySymptomExpertSystemHandler, _kExpertSystemStatusKeyTriggeringSymptom, _kStateMachineStatusKeyAdminState, _kStateMachineStatusKeyState, _kSymptomDiagnosticActionCancel, _kSymptomDiagnosticActionCrashAndSpinLogs, _kSymptomDiagnosticActionDiagnosticExtensions, _kSymptomDiagnosticActionGetNetworkInfo, _kSymptomDiagnosticActionLogArchive, _kSymptomDiagnosticActionProbeDuration, _kSymptomDiagnosticActionProbePacketCapture, _kSymptomDiagnosticActionProbeTarget, _kSymptomDiagnosticActionSnapshot, _kSymptomDiagnosticActionStart, _kSymptomDiagnosticActionStop, _kSymptomDiagnosticCaseUsageKeyCasesAccepted, _kSymptomDiagnosticCaseUsageKeyCasesSeen, _kSymptomDiagnosticCaseUsageKeyDomain, _kSymptomDiagnosticCaseUsageKeyInterArrivalMean, _kSymptomDiagnosticCaseUsageKeyInterArrivalVar, _kSymptomDiagnosticCaseUsageKeyLastAccepted, _kSymptomDiagnosticCaseUsageKeyLastSeen, _kSymptomDiagnosticCaseUsageKeyProcess, _kSymptomDiagnosticCaseUsageKeySubType, _kSymptomDiagnosticCaseUsageKeyType, _kSymptomDiagnosticDomainEnergy, _kSymptomDiagnosticDomainNetworking, _kSymptomDiagnosticDomainResourceNotify, _kSymptomDiagnosticErrorDailyLimitExceeded, _kSymptomDiagnosticErrorHourlyLimitExceeded, _kSymptomDiagnosticErrorInvalidParameters, _kSymptomDiagnosticErrorNone, _kSymptomDiagnosticErrorNotSupported, _kSymptomDiagnosticErrorRandomizedSuppression, _kSymptomDiagnosticErrorRequestThrottled, _kSymptomDiagnosticErrorServiceInterrupted, _kSymptomDiagnosticErrorServiceNotReady, _kSymptomDiagnosticErrorServiceUnavailable, _kSymptomDiagnosticErrorSessionNotFound, _kSymptomDiagnosticEventResultFailure, _kSymptomDiagnosticEventResultSuccess, _kSymptomDiagnosticEventStatusCancelled, _kSymptomDiagnosticEventStatusFinish, _kSymptomDiagnosticEventStatusInProgress, _kSymptomDiagnosticEventStatusRequest, _kSymptomDiagnosticEventStatusStart, _kSymptomDiagnosticEventStatusTimeout, _kSymptomDiagnosticEventTypeExpertSystem, _kSymptomDiagnosticEventTypeMessage, _kSymptomDiagnosticEventTypeProbe, _kSymptomDiagnosticEventTypeRemoteTrigger, _kSymptomDiagnosticEventTypeReport, _kSymptomDiagnosticEventTypeSymptom, _kSymptomDiagnosticKeyError, _kSymptomDiagnosticKeyEventContext, _kSymptomDiagnosticKeyEventCount, _kSymptomDiagnosticKeyEventDuration, _kSymptomDiagnosticKeyEventEndpoint, _kSymptomDiagnosticKeyEventInterface, _kSymptomDiagnosticKeyEventInterfaceType, _kSymptomDiagnosticKeyEventName, _kSymptomDiagnosticKeyEventProcessName, _kSymptomDiagnosticKeyEventRatio, _kSymptomDiagnosticKeyEventResult, _kSymptomDiagnosticKeyEventStatus, _kSymptomDiagnosticKeyEventValue, _kSymptomDiagnosticKeyPayloadDEParameters, _kSymptomDiagnosticKeyPayloadPath, _kSymptomDiagnosticKeyTimestamp, _kSymptomDiagnosticKeyType, _kSymptomDiagnosticPayloadTypeFile, _kSymptomDiagnosticPayloadTypePacketCapture, _kSymptomDiagnosticPayloadTypePlist, _kSymptomDiagnosticReplyGroupID, _kSymptomDiagnosticReplyReason, _kSymptomDiagnosticReplySessionID, _kSymptomDiagnosticReplySuccess, _kSymptomDiagnosticReporterPayloadCollectionWindow, _kSymptomDiagnosticSignatureBundleIdentifier, _kSymptomDiagnosticSignatureCaseGroupID, _kSymptomDiagnosticSignatureContext, _kSymptomDiagnosticSignatureDetectedProcess, _kSymptomDiagnosticSignatureDomain, _kSymptomDiagnosticSignatureEffectiveProcess, _kSymptomDiagnosticSignatureInterfaceType, _kSymptomDiagnosticSignatureInternalFlags, _kSymptomDiagnosticSignaturePID, _kSymptomDiagnosticSignatureRelatedProcesses, _kSymptomDiagnosticSignatureSubType, _kSymptomDiagnosticSignatureSubTypeContext, _kSymptomDiagnosticSignatureThresholdValues, _kSymptomDiagnosticSignatureType, _kSymptomDiagnosticSignatureUUID, _kSymptomDiagnosticTypeEnergy, _kSymptomDiagnosticTypeFunctional, _kSymptomDiagnosticTypeOperational, _kSymptomDiagnosticTypePerformance, _logHandle ] objc-classes: [ _SDRDiagnosticReporter ] objc-ivars: [ _SDRDiagnosticReporter._connection, _SDRDiagnosticReporter._delegate, _SDRDiagnosticReporter._queue ] ...
{ "pile_set_name": "Github" }