text
stringlengths
2
99.9k
meta
dict
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 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. ==============================================================================*/ #include "tensorflow/core/common_runtime/scoped_allocator_mgr.h" #include "tensorflow/core/common_runtime/dma_helper.h" #include "tensorflow/core/common_runtime/scoped_allocator.h" #include "tensorflow/core/framework/allocator.h" #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/platform/test.h" namespace tensorflow { namespace { class ScopedAllocatorMgrTest : public ::testing::Test { public: ScopedAllocatorMgrTest() : sam_("CPU0") {} void InitTensor() { backing_tensor_ = Tensor(cpu_allocator(), DT_FLOAT, backing_tensor_shape_); } void PopulateFields() { ScopedAllocatorMgr::PopulateFields(scope_id_, fields_shapes_, DT_FLOAT, &fields_); } Status AddScopedAllocator(int expected_use_count, int scope_id) { VLOG(2) << "Adding ScopedAllocator step_id " << step_id_ << " scope_id " << scope_id_ << " #fields " << fields_.size() << " expected_use_count " << expected_use_count; return sam_.AddScopedAllocator(backing_tensor_, step_id_, scope_id, "tensor_shape_599", fields_, expected_use_count); } Status PrepScopedAllocatorMgr(int expected_use_count) { InitTensor(); PopulateFields(); return AddScopedAllocator(expected_use_count, scope_id_); } void SaveInstances(int num_instances) { sa_instances_.clear(); sa_instances_.resize(num_instances); ScopedAllocatorContainer* sac = sam_.GetContainer(step_id_); for (int i = 0; i < num_instances; i++) { sa_instances_[i] = sac->GetInstance(scope_id_ + 1 + i); } } // For the specific case when the backing tensor is of shape // {512 + 9 + 512 + 16} and the fields_shapes are {{512}, {3,3}, {2, 256}} // This method computes the padding between the second and third slice of the // backing tensor. This example is reused across multiple tests. int AlignmentPadding() { int alignment_padding = (Allocator::kAllocatorAlignment - (521 * sizeof(float)) % Allocator::kAllocatorAlignment) % Allocator::kAllocatorAlignment; return alignment_padding; } // Debug void PrintShapes() { VLOG(2) << "tensor_shape=" << backing_tensor_shape_.DebugString(); for (int i = 0; i < fields_shapes_.size(); i++) { VLOG(2) << "fields_shapes[" << i << "]=" << fields_shapes_[i].DebugString(); } } protected: TensorShape backing_tensor_shape_; Tensor backing_tensor_; std::vector<TensorShape> fields_shapes_; std::vector<ScopedAllocator::Field> fields_; ScopedAllocatorMgr sam_; const int step_id_ = 101; const int scope_id_ = 599; std::vector<ScopedAllocatorInstance*> sa_instances_; }; TEST_F(ScopedAllocatorMgrTest, ContainerAllocation) { ScopedAllocatorContainer* sac_101 = sam_.GetContainer(101); EXPECT_TRUE(sac_101 != nullptr); ScopedAllocatorContainer* sac_201 = sam_.GetContainer(201); EXPECT_TRUE(sac_201 != nullptr); EXPECT_NE(sac_101, sac_201); ScopedAllocatorContainer* also_sac_101 = sam_.GetContainer(101); EXPECT_EQ(sac_101, also_sac_101); sam_.Cleanup(101); // 201 should be cleaned up by the destructor. } TEST_F(ScopedAllocatorMgrTest, PopulateFields) { backing_tensor_shape_ = TensorShape({512 + 9 + 512 + 16}); fields_shapes_ = std::vector<TensorShape>({{512}, {3, 3}, {2, 256}}); InitTensor(); PopulateFields(); EXPECT_EQ(0, fields_[0].offset); EXPECT_EQ(512 * sizeof(float), fields_[0].bytes_requested); EXPECT_EQ(scope_id_ + 1, fields_[0].scope_id); EXPECT_EQ(512 * sizeof(float), fields_[1].offset); EXPECT_EQ(9 * sizeof(float), fields_[1].bytes_requested); EXPECT_EQ(scope_id_ + 2, fields_[1].scope_id); EXPECT_EQ(521 * sizeof(float) + AlignmentPadding(), fields_[2].offset); EXPECT_EQ(512 * sizeof(float), fields_[2].bytes_requested); EXPECT_EQ(scope_id_ + 3, fields_[2].scope_id); } TEST_F(ScopedAllocatorMgrTest, ContainerAddAllocator) { backing_tensor_shape_ = TensorShape({1024}); fields_shapes_ = std::vector<TensorShape>({{512}, {512}}); Status s = PrepScopedAllocatorMgr(2); EXPECT_TRUE(s.ok()); // Need to call Allocate and Deallocate in order to use up the expected uses // for this allocator. Save the instances for now. SaveInstances(fields_shapes_.size()); s = AddScopedAllocator(2, scope_id_); EXPECT_FALSE(s.ok()); fields_[0].scope_id = scope_id_ + 1; s = AddScopedAllocator(2, scope_id_ + 3); EXPECT_FALSE(s.ok()); // Cleanup the instances by invoking allocate and deallocate. void* ptr0 = sa_instances_[0]->AllocateRaw(0 /* alignment */, 512 * sizeof(float)); void* ptr1 = sa_instances_[1]->AllocateRaw(0 /* alignment */, 512 * sizeof(float)); sa_instances_[0]->DeallocateRaw(ptr0); sa_instances_[1]->DeallocateRaw(ptr1); } TEST_F(ScopedAllocatorMgrTest, AllocatorSuccess) { ScopedAllocatorContainer* sac = sam_.GetContainer(step_id_); ScopedAllocator* other = sac->GetAllocator(scope_id_); EXPECT_EQ(other, nullptr); backing_tensor_shape_ = TensorShape({512 + 9 + 512 + 16}); fields_shapes_ = std::vector<TensorShape>({{512}, {3, 3}, {2, 256}}); Status s = PrepScopedAllocatorMgr(3); other = sac->GetAllocator(scope_id_); ScopedAllocatorInstance* inst0 = sac->GetInstance(scope_id_ + 1); char* ptr0 = static_cast<char*>(inst0->AllocateRaw(0, 512 * sizeof(float))); const char* base = static_cast<const char*>(DMAHelper::base(&backing_tensor_)); EXPECT_EQ(ptr0, base); ScopedAllocatorInstance* inst1 = sac->GetInstance(scope_id_ + 2); char* ptr1 = static_cast<char*>(inst1->AllocateRaw(0, 9 * sizeof(float))); EXPECT_EQ(ptr1, ptr0 + (512 * sizeof(float))); ScopedAllocatorInstance* inst2 = sac->GetInstance(scope_id_ + 3); char* ptr2 = static_cast<char*>(inst2->AllocateRaw(0, 512 * sizeof(float))); EXPECT_EQ(ptr2, ptr1 + AlignmentPadding() + (9 * sizeof(float))); // At this point the scopes should be gone from the container EXPECT_EQ(nullptr, sac->GetAllocator(scope_id_)); // The ScopedAllocatorInstances automatically delete when their memory // is returned and they are out of table. inst0->DeallocateRaw(ptr0); inst1->DeallocateRaw(ptr1); inst2->DeallocateRaw(ptr2); } // ScopedAllocator initialization should fail because backing_tensor is not // large enough to hold all the fields TEST_F(ScopedAllocatorMgrTest, AllocatorInitFail) { backing_tensor_shape_ = TensorShape({8}); InitTensor(); fields_.resize(1); fields_[0].scope_id = scope_id_ + 1; fields_[0].offset = 0; fields_[0].bytes_requested = backing_tensor_shape_.num_elements() * 2 * sizeof(float); // fields[0].offset + fields[0].bytes_requested is larger than the size of the // backing tensor, so this check should fail EXPECT_DEATH(Status s = AddScopedAllocator(1, scope_id_), ""); } // ScopedAllocator allocation should fail because we called more times than // expected, or we deallocated a non-existent pointer, or we requested more // or less than the exact size of an instance buffer. TEST_F(ScopedAllocatorMgrTest, AllocatorFail) { backing_tensor_shape_ = TensorShape({1024}); fields_shapes_ = std::vector<TensorShape>({{512}, {512}}); Status s = PrepScopedAllocatorMgr(2); EXPECT_TRUE(s.ok()); // Save instances so that we can explicitly delete later on. In normal // operation the instances will be automatically deleted after single use, but // in this test we are invoking the ScopedAllocator's Alloc/Dealloc interface, // so we need to explicitly delete the instances to avoid a memleak. SaveInstances(fields_shapes_.size()); char* ptr0 = static_cast<char*>(sa_instances_[0]->AllocateRaw(0, 512 * sizeof(float))); VLOG(2) << "Should fail because we deallocate ptr=" << static_cast<void*>(ptr0 + 8) << " which we never allocated."; EXPECT_DEATH(sa_instances_[0]->DeallocateRaw(ptr0 + 8), ""); VLOG(2) << "Should fail because we allocate smaller than the size of the " << "field."; EXPECT_EQ(nullptr, sa_instances_[1]->AllocateRaw(0, 256 * sizeof(float))); VLOG(2) << "Should fail because we allocate larger than the size of the " << "field."; EXPECT_EQ(nullptr, sa_instances_[1]->AllocateRaw(0, 1024 * sizeof(float))); void* ptr1 = sa_instances_[1]->AllocateRaw(0, 512 * sizeof(float)); VLOG(2) << "Should fail because we exceed expected_use_count."; EXPECT_EQ(nullptr, sa_instances_[0]->AllocateRaw(0, 512 * sizeof(float))); sa_instances_[0]->DeallocateRaw(ptr0); sa_instances_[1]->DeallocateRaw(ptr1); } } // namespace } // namespace tensorflow
{ "pile_set_name": "Github" }
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- # vim: set filetype=python: # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. JAR_MANIFESTS += ['jar.mn']
{ "pile_set_name": "Github" }
/**************************************************************************** Copyright (c) 2013 The Chromium Authors http://www.cocos2d-x.org 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. ****************************************************************************/ #ifndef __CCAPLICATION_H__ #define __CCAPLICATION_H__ #include "platform/CCCommon.h" #include "platform/CCApplicationProtocol.h" NS_CC_BEGIN class CCRect; class CCApplication : public CCApplicationProtocol { public: CCApplication(); virtual ~CCApplication(); /** @brief Callback by CCDirector for limit FPS. @interval The time, which expressed in second in second, between current frame and next. */ void setAnimationInterval(double interval); /** @brief Run the message loop. */ int run(); /** @brief Get current applicaiton instance. @return Current application instance pointer. */ static CCApplication* sharedApplication(); /* override functions */ virtual ccLanguageType getCurrentLanguage(); /** @brief Get target platform */ virtual TargetPlatform getTargetPlatform(); static bool isRunning() { return s_running; } protected: long m_nAnimationInterval; // microseconds static bool s_running; // is the application running static CCApplication* sm_pSharedApplication; }; NS_CC_END #endif /* __CCAPLICATION_H__ */
{ "pile_set_name": "Github" }
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MEDIA_FORMATS_MP2T_TS_SECTION_PAT_H_ #define MEDIA_FORMATS_MP2T_TS_SECTION_PAT_H_ #include "base/callback.h" #include "base/compiler_specific.h" #include "base/macros.h" #include "media/formats/mp2t/ts_section_psi.h" namespace media { namespace mp2t { class TsSectionPat : public TsSectionPsi { public: // RegisterPmtCb::Run(int program_number, int pmt_pid); typedef base::Callback<void(int, int)> RegisterPmtCb; explicit TsSectionPat(const RegisterPmtCb& register_pmt_cb); ~TsSectionPat() override; // TsSectionPsi implementation. bool ParsePsiSection(BitReader* bit_reader) override; void ResetPsiSection() override; private: RegisterPmtCb register_pmt_cb_; // Parameters from the PAT. int version_number_; DISALLOW_COPY_AND_ASSIGN(TsSectionPat); }; } // namespace mp2t } // namespace media #endif // MEDIA_FORMATS_MP2T_TS_SECTION_PAT_H_
{ "pile_set_name": "Github" }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Translation; use Symfony\Component\Config\Resource\ResourceInterface; /** * MessageCatalogueInterface. * * @author Fabien Potencier <[email protected]> * * @api */ interface MessageCatalogueInterface { /** * Gets the catalogue locale. * * @return string The locale * * @api */ public function getLocale(); /** * Gets the domains. * * @return array An array of domains * * @api */ public function getDomains(); /** * Gets the messages within a given domain. * * If $domain is null, it returns all messages. * * @param string $domain The domain name * * @return array An array of messages * * @api */ public function all($domain = null); /** * Sets a message translation. * * @param string $id The message id * @param string $translation The messages translation * @param string $domain The domain name * * @api */ public function set($id, $translation, $domain = 'messages'); /** * Checks if a message has a translation. * * @param string $id The message id * @param string $domain The domain name * * @return bool true if the message has a translation, false otherwise * * @api */ public function has($id, $domain = 'messages'); /** * Checks if a message has a translation (it does not take into account the fallback mechanism). * * @param string $id The message id * @param string $domain The domain name * * @return bool true if the message has a translation, false otherwise * * @api */ public function defines($id, $domain = 'messages'); /** * Gets a message translation. * * @param string $id The message id * @param string $domain The domain name * * @return string The message translation * * @api */ public function get($id, $domain = 'messages'); /** * Sets translations for a given domain. * * @param array $messages An array of translations * @param string $domain The domain name * * @api */ public function replace($messages, $domain = 'messages'); /** * Adds translations for a given domain. * * @param array $messages An array of translations * @param string $domain The domain name * * @api */ public function add($messages, $domain = 'messages'); /** * Merges translations from the given Catalogue into the current one. * * The two catalogues must have the same locale. * * @param MessageCatalogueInterface $catalogue A MessageCatalogueInterface instance * * @api */ public function addCatalogue(MessageCatalogueInterface $catalogue); /** * Merges translations from the given Catalogue into the current one * only when the translation does not exist. * * This is used to provide default translations when they do not exist for the current locale. * * @param MessageCatalogueInterface $catalogue A MessageCatalogueInterface instance * * @api */ public function addFallbackCatalogue(MessageCatalogueInterface $catalogue); /** * Gets the fallback catalogue. * * @return MessageCatalogueInterface|null A MessageCatalogueInterface instance or null when no fallback has been set * * @api */ public function getFallbackCatalogue(); /** * Returns an array of resources loaded to build this collection. * * @return ResourceInterface[] An array of resources * * @api */ public function getResources(); /** * Adds a resource for this collection. * * @param ResourceInterface $resource A resource instance * * @api */ public function addResource(ResourceInterface $resource); }
{ "pile_set_name": "Github" }
Camerasamenvatting: Manufacturer: Canon Inc. Model: Canon PowerShot A3400 IS Version: 1-12.0.1.0 Serial Number: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Vendor Extension ID: 0xb (1.0) Capture Formats: JPEG Display Formats: Association/Directory, Script, DPOF, MS AVI, MS Wave, JPEG, Defined Type, CRW, Unknown(b103), Unknown(b105), Unknown(b104), Unknown(bf01) Device Capabilities: File Download, File Deletion, File Upload No Image Capture, No Open Capture, No vendor specific capture Storage Devices Summary: store_00010001: StorageDescription: None VolumeLabel: None Storage Type: Removable RAM (memory card) Filesystemtype: Digital Camera Layout (DCIM) Access Capability: Read-Write Maximum Capability: 1015414784 (968 MB) Free Space (Bytes): 933396480 (890 MB) Free Space (Images): -1 Device Property Summary: Event Emulate Mode(0xd045):(readwrite) (type=0x4) Enumeration [1,2,3,4,5,6,7] value: 2 Property 0xd04a:(readwrite) (type=0x2) Enumeration [0,1,2,3] value: 0 Size of Output Data from Camera(0xd02e):(read only) (type=0x6) 524288 Size of Input Data to Camera(0xd02f):(read only) (type=0x6) 524288 Battery Level(0x5001):(read only) (type=0x2) Enumeration [0,1,2,3] value: 3% (3) Battery Type(0xd002):(read only) (type=0x4) Enumeration [0,1,2,3,4,5] value: Unknown (0) Battery Mode(0xd003):(read only) (type=0x6) Enumeration [0,1,2,3] value: Normal (1) UNIX Time(0xd034):(readwrite) (type=0x6) 1397936499 Type of Slideshow(0xd047):(read only) (type=0x4) 0 DPOF Version(0xd046):(read only) (type=0x4) 257 Remote API Version(0xd030):(read only) (type=0x6) 256 Model ID(0xd049):(read only) (type=0x6) 52822016 Camera Model(0xd032):(read only) (type=0xffff) 'Canon PowerShot A3400 IS' Camera Owner(0xd033):(readwrite) (type=0x4002) a[0] Firmware Version(0xd031):(read only) (type=0x6) 16777216 Property 0xd050:(read only) (type=0x2) 0 Property 0xd051:(read only) (type=0x4004) a[2] 14337,45317 Property 0xd052:(read only) (type=0x2) 0 Property 0xd402:(read only) (type=0xffff) 'Canon PowerShot A3400 IS' Property 0xd406:(readwrite) (type=0xffff) 'Windows' Property 0xd407:(read only) (type=0x6) 1 Property 0xd303:(read only) (type=0x2) 1
{ "pile_set_name": "Github" }
##### # LONG_XOR ##### szpr: LONG_XOR(r, rlv) 13 EMIT_INSTRUCTION EMIT_Commutative(IA32_XOR, P(p), Binary.getClearResult(P(p)), Binary.getClearVal1(P(p)), Binary.getClearVal2(P(p))); ### Memory operands ### szpr: LONG_XOR(r, load64) 15 EMIT_INSTRUCTION EMIT_Commutative(IA32_XOR, P(p), Binary.getClearResult(P(p)), Binary.getClearVal1(P(p)), consumeMO()); szpr: LONG_XOR(load64, rlv) 15 EMIT_INSTRUCTION EMIT_Commutative(IA32_XOR, P(p), Binary.getClearResult(P(p)), Binary.getClearVal2(P(p)), consumeMO()); stm: LONG_STORE(LONG_XOR(LONG_LOAD(rlv,rlv),rlv),OTHER_OPERAND(rlv, rlv)) ADDRESS_EQUAL(P(p), PLL(p), 17) EMIT_INSTRUCTION EMIT_Commutative(IA32_XOR, P(p), MO_S(P(p), QW), MO_S(P(p), QW), Binary.getClearVal2(PL(p)) ); stm: LONG_STORE(LONG_XOR(r,LONG_LOAD(rlv,rlv)),OTHER_OPERAND(rlv, rlv)) ADDRESS_EQUAL(P(p), PLR(p), 17) EMIT_INSTRUCTION EMIT_Commutative(IA32_XOR, P(p), MO_S(P(p), QW), MO_S(P(p), QW), Binary.getClearVal1(PL(p)) ); stm: LONG_ASTORE(LONG_XOR(LONG_ALOAD(rlv,rlv),rlv),OTHER_OPERAND(rlv, rlv)) ARRAY_ADDRESS_EQUAL(P(p), PLL(p), 17) EMIT_INSTRUCTION EMIT_Commutative(IA32_XOR, P(p), MO_AS(P(p), QW_S, QW), MO_AS(P(p), QW_S, QW), Binary.getClearVal2(PL(p)) ); stm: LONG_ASTORE(LONG_XOR(r,LONG_ALOAD(rlv,rlv)),OTHER_OPERAND(rlv, rlv)) ARRAY_ADDRESS_EQUAL(P(p), PLR(p), 17) EMIT_INSTRUCTION EMIT_Commutative(IA32_XOR, P(p), MO_AS(P(p), QW_S, QW), MO_AS(P(p), QW_S, QW), Binary.getClearVal1(PL(p)) );
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="de"> <head> <!-- Generated by javadoc --> <title>AfterProperty (documentation 1.3.2-SNAPSHOT API)</title> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="AfterProperty (documentation 1.3.2-SNAPSHOT API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../net/jqwik/api/lifecycle/AfterExample.html" title="annotation in net.jqwik.api.lifecycle"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../net/jqwik/api/lifecycle/AfterTry.html" title="annotation in net.jqwik.api.lifecycle"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?net/jqwik/api/lifecycle/AfterProperty.html" target="_top">Frames</a></li> <li><a href="AfterProperty.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Required&nbsp;|&nbsp;</li> <li>Optional</li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Element</li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">net.jqwik.api.lifecycle</div> <h2 title="Annotation Type AfterProperty" class="title">Annotation Type AfterProperty</h2> </div> <div class="contentContainer"> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre>@Target(value={ANNOTATION_TYPE,METHOD}) @Retention(value=RUNTIME) @API(status=EXPERIMENTAL, since="1.2.4") public @interface <span class="memberNameLabel">AfterProperty</span></pre> <div class="block">Annotate methods of a container class with <code>@AfterProperty</code> to have them run once after each property (or example) including properties (or examples) of embedded containers. <p><code>@AfterProperty</code> methods are inherited from superclasses and implemented interfaces as long as they are not <em>hidden</em> or <em>overridden</em>. <p>In embedded container classes the <code>@AfterProperty</code> methods from the inner container are run before the outer container's methods. <p>The execution order of multiple <code>@AfterProperty</code> methods within the same container is not guaranteed and might change. <p>Parameters of this method will be resolved using registered instances of <a href="../../../../net/jqwik/api/lifecycle/ResolveParameterHook.html" title="interface in net.jqwik.api.lifecycle">ResolveParameterHook</a>. Parameters with annotation <a href="../../../../net/jqwik/api/ForAll.html" title="annotation in net.jqwik.api">ForAll</a> are not allowed.</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../net/jqwik/api/lifecycle/BeforeProperty.html" title="annotation in net.jqwik.api.lifecycle"><code>BeforeProperty</code></a></dd> </dl> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../net/jqwik/api/lifecycle/AfterExample.html" title="annotation in net.jqwik.api.lifecycle"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../net/jqwik/api/lifecycle/AfterTry.html" title="annotation in net.jqwik.api.lifecycle"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?net/jqwik/api/lifecycle/AfterProperty.html" target="_top">Frames</a></li> <li><a href="AfterProperty.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Required&nbsp;|&nbsp;</li> <li>Optional</li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Element</li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "pile_set_name": "Github" }
0
{ "pile_set_name": "Github" }
2006-8-8 9:55:12 晨报讯(实习生程颖)昨天上午10时30分左右,在丰台区蒲黄榆路与蒲方路的十字路口处发生一起两车相撞事故。一辆直行大公共将一辆抢行的夏利车顶翻。 据事故现场的交通协管员说,上午10点半左右,一辆红色夏利车沿蒲黄榆路由北向南行驶,到达路口想向东转弯,由于蒲黄榆路南北双向都是绿灯,一辆由南向北行驶的39路大公共正在直行通过路口,夏利车没有等待而是加速抢行,大公交刹车不及将夏利车顶起,一位目击者告诉记者:“夏利车被顶离地面大约40厘米。” 事故发生后,交警迅速赶到现场。根据夏利车转弯抢行的事实,交警认定夏利车主负全部责任。事故没有造成人员伤亡,夏利车的右侧车门受到挤压向内凹陷,事故处理完毕后两车各自开走。事故清理持续了五六分钟,由于路口交通协管员的及时疏导,没有给正常交通造成影响。
{ "pile_set_name": "Github" }
# cliui [![Build Status](https://travis-ci.org/bcoe/cliui.png)](https://travis-ci.org/bcoe/cliui) [![Coverage Status](https://coveralls.io/repos/bcoe/cliui/badge.svg?branch=)](https://coveralls.io/r/bcoe/cliui?branch=) [![NPM version](https://img.shields.io/npm/v/cliui.svg)](https://www.npmjs.com/package/cliui) easily create complex multi-column command-line-interfaces. ## Example ```js var ui = require('cliui')({ width: 80 }) ui.div('Usage: $0 [command] [options]') ui.div({ text: 'Options:', padding: [2, 0, 2, 0] }) ui.div( { text: "-f, --file", width: 40, padding: [0, 4, 0, 4] }, { text: "the file to load", width: 25 }, { text: "[required]", align: 'right' } ) console.log(ui.toString()) ``` ## Layout DSL cliui exposes a simple layout DSL: If you create a single `ui.row`, passing a string rather than an object: * `\n`: characters will be interpreted as new rows. * `\t`: characters will be interpreted as new columns. * ` `: characters will be interpreted as padding. **as an example...** ```js var ui = require('./')({ width: 60 }) ui.div( 'Usage: node ./bin/foo.js\n' + ' <regex>\t provide a regex\n' + ' <glob>\t provide a glob\t [required]' ) console.log(ui.toString()) ``` **will output:** ```shell Usage: node ./bin/foo.js <regex> provide a regex <glob> provide a glob [required] ``` ## Methods ```js cliui = require('cliui') ``` ### cliui({width: integer}) Specify the maximum width of the UI being generated. ### cliui({wrap: boolean}) Enable or disable the wrapping of text in a column. ### cliui.div(column, column, column) Create a row with any number of columns, a column can either be a string, or an object with the following options: * **width:** the width of a column. * **align:** alignment, `right` or `center`. * **padding:** `[top, right, bottom, left]`. ### cliui.span(column, column, column) Similar to `div`, except the next row will be appended without a new line being created.
{ "pile_set_name": "Github" }
/* 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 org.activiti.engine.impl; /** * Used to indicate the operator that should be used to comparing values in a query clause. * * @author Frederik Heremans */ public enum QueryOperator { EQUALS, NOT_EQUALS, GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, LIKE, EQUALS_IGNORE_CASE, NOT_EQUALS_IGNORE_CASE, LIKE_IGNORE_CASE, }
{ "pile_set_name": "Github" }
/* Copyright 2013-2019 Wix.com 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.wix.accord.spring import com.wix.accord._ import com.wix.accord.scalatest.ResultMatchers import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec trait CompanionObjectValidatorResolverBehaviors extends Matchers with ResultMatchers { this: AnyWordSpec => import CompanionObjectAccordValidatorResolverTest._ def companionObjectValidatorResolver( newResolver: => AccordValidatorResolver ) = { "successfully resolve a validator when available on a test class companion" in { val resolved = newResolver.lookupValidator[ Test1 ] resolved should not be empty // Quick sanity tests to make sure the resolved validator is functional implicit val validator = resolved.get val t1 = Test1( 10 ) val t2 = Test1( 1 ) validate( t1 ) shouldBe aSuccess validate( t2 ) shouldBe aFailure } "return None when no validator is available on the test class companion" in { val resolved = newResolver.lookupValidator[ Test2 ] resolved shouldBe empty } "return None when the test class has no companion object" in { val resolved = newResolver.lookupValidator[ Test3 ] resolved shouldBe empty } } } class CompanionObjectAccordValidatorResolverTest extends AnyWordSpec with CompanionObjectValidatorResolverBehaviors { "CompanionObjectAccordValidatorResolver" should { behave like companionObjectValidatorResolver( new CompanionObjectAccordValidatorResolver ) } "CachingCompanionObjectAccordValidatorResolver" should { behave like companionObjectValidatorResolver( new CachingCompanionObjectAccordValidatorResolver ) } } object CompanionObjectAccordValidatorResolverTest { import dsl._ case class Test1( f: Int ) case object Test1 { implicit val validatorOfTest1 = validator[ Test1 ] { t => t.f should be > 5 } } case class Test2( x: String ) case object Test2 class Test3( x: String ) }
{ "pile_set_name": "Github" }
brasil argentina mexico ukraina romania croatia portugal
{ "pile_set_name": "Github" }
;;; ;;;libstr.scm - built-in string library ;;; ;;; Copyright (c) 2000-2020 Shiro Kawai <[email protected]> ;;; ;;; Redistribution and use in source and binary forms, with or without ;;; modification, are permitted provided that the following conditions ;;; are met: ;;; ;;; 1. Redistributions of source code must retain the above copyright ;;; notice, this list of conditions and the following disclaimer. ;;; ;;; 2. 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. ;;; ;;; 3. Neither the name of the authors 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 COPYRIGHT ;;; OWNER 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. ;;; (select-module gauche.internal) (inline-stub (declcode (.include <gauche/bignum.h> <gauche/vminsn.h> <gauche/priv/stringP.h>))) ;; ;; Predicates ;; (select-module scheme) (define-cproc string? (obj) ::<boolean> :fast-flonum :constant (inliner STRINGP) SCM_STRINGP) (select-module gauche) (define-cproc string-incomplete? (obj) ::<boolean> (return (and (SCM_STRINGP obj) (SCM_STRING_INCOMPLETE_P obj)))) (define-cproc string-immutable? (obj) ::<boolean> (return (and (SCM_STRINGP obj) (SCM_STRING_IMMUTABLE_P obj)))) ;; ;; Constructors ;; (select-module scheme) (define-cproc make-string (len::<fixnum> :optional (c::<char> #\space)) Scm_MakeFillString) (define-cproc string (:rest chars) Scm_ListToString) (define-cproc string-copy (str::<string> :optional start end) (return (Scm_CopyString (SCM_STRING (Scm_MaybeSubstring str start end))))) (define-cproc string-append (:rest args) Scm_StringAppend) (select-module gauche) (define-cproc string-copy-immutable (str::<string> :optional start end) (let* ([s (Scm_MaybeSubstring str start end)]) (if (SCM_STRING_IMMUTABLE_P s) (return s) (return (Scm_CopyStringWithFlags (SCM_STRING s) SCM_STRING_IMMUTABLE SCM_STRING_IMMUTABLE))))) (define-cproc string-join (strs::<list> :optional (delim::<string> " ") (grammar infix)) (let* ([gm::int 0]) (cond [(SCM_EQ grammar 'infix) (set! gm SCM_STRING_JOIN_INFIX)] [(SCM_EQ grammar 'strict-infix) (set! gm SCM_STRING_JOIN_STRICT_INFIX)] [(SCM_EQ grammar 'suffix) (set! gm SCM_STRING_JOIN_SUFFIX)] [(SCM_EQ grammar 'prefix) (set! gm SCM_STRING_JOIN_PREFIX)] [else (SCM_TYPE_ERROR grammar "one of the symbols infix, strict-infix, \ suffix, or prefix")]) (return (Scm_StringJoin strs delim gm)))) (define-reader-ctor 'string-interpolate (^ args (apply string-interpolate args))) ;;lambda is required to delay loading ;; ;; Conversions ;; (select-module scheme) (define-cproc string->list (str::<string> :optional start end) (return (Scm_StringToList (SCM_STRING (Scm_MaybeSubstring str start end))))) (define-cproc list->string (list::<list>) Scm_ListToString) ;; ;; Accessors ;; (select-module scheme) (define-cproc string-length (str::<string>) ::<fixnum> :constant (return (SCM_STRING_BODY_LENGTH (SCM_STRING_BODY str)))) (define-cproc string-ref (str::<string> k :optional fallback) :constant (let* ([r::ScmChar (Scm_StringRefCursor str k (SCM_UNBOUNDP fallback))]) (return (?: (== r SCM_CHAR_INVALID) fallback (SCM_MAKE_CHAR r))))) (define-cproc substring (str::<string> start end) (return (Scm_SubstringCursor str start end))) (select-module gauche) (define-cproc string-size (str::<string>) ::<fixnum> :constant (return (SCM_STRING_BODY_SIZE (SCM_STRING_BODY str)))) (define-cproc %maybe-substring (str::<string> :optional start end) Scm_MaybeSubstring) ;; bound argument is for srfi-13 (define-cproc %hash-string (str::<string> :optional bound) ::<ulong> (let* ([modulo::u_long 0]) (cond [(or (SCM_UNBOUNDP bound) (SCM_UNDEFINEDP bound)) (set! modulo 0)] [(SCM_INTP bound) (set! modulo (SCM_INT_VALUE bound))] [(SCM_BIGNUMP bound) (set! modulo (Scm_BignumToUI (SCM_BIGNUM bound) SCM_CLAMP_BOTH NULL))] [else (Scm_Error "argument out of domain: %S" bound)]) (return (Scm_HashString str modulo)))) (select-module gauche) (inline-stub (define-cfn string-scan-mode (mode) ::int (let* ([rmode::int 0]) (cond [(SCM_EQ mode 'index) (set! rmode SCM_STRING_SCAN_INDEX)] [(SCM_EQ mode 'cursor) (set! rmode SCM_STRING_SCAN_CURSOR)] [(SCM_EQ mode 'before) (set! rmode SCM_STRING_SCAN_BEFORE)] [(SCM_EQ mode 'after) (set! rmode SCM_STRING_SCAN_AFTER)] [(SCM_EQ mode 'before*) (set! rmode SCM_STRING_SCAN_BEFORE2)] [(SCM_EQ mode 'after*) (set! rmode SCM_STRING_SCAN_AFTER2)] [(SCM_EQ mode 'both) (set! rmode SCM_STRING_SCAN_BOTH)] [else (Scm_Error "bad value in mode argumet: %S, must be one of \ 'index, 'before, 'after, 'before*, 'after* or 'both." mode)]) (return rmode)))) ;; primitive scanner (define-cproc string-scan (s1::<string> s2 :optional (mode index)) (let* ([rmode::int (string-scan-mode mode)]) (cond [(SCM_STRINGP s2) (return (Scm_StringScan s1 (SCM_STRING s2) rmode))] [(SCM_CHARP s2) (return (Scm_StringScanChar s1 (SCM_CHAR_VALUE s2) rmode))] [else (Scm_Error "bad type of argument for s2: %S, must be \ either string or character" s2) (return SCM_UNDEFINED)]))) (define-cproc string-scan-right (s1::<string> s2 :optional (mode index)) (let* ([rmode::int (string-scan-mode mode)]) (cond [(SCM_STRINGP s2) (return (Scm_StringScanRight s1 (SCM_STRING s2) rmode))] [(SCM_CHARP s2) (return (Scm_StringScanCharRight s1 (SCM_CHAR_VALUE s2) rmode))] [else (Scm_Error "bad type of argument for s2: %S, must be \ either string or character" s2) (return SCM_UNDEFINED)]))) ;; string-split ;; Generic string-split ;; splitter can be a character, a char-set, a string, or a regexp. ;; NB: To adapt to srfi-152, we changed the optional argument - now the ;; 'grammar' argument comes before 'limit'. For the bacward compatibility, ;; we recognize an integer argument in 'grammar' as 'limit'. (define (string-split string splitter :optional (grammar 'infix) (limit #f) start end) (if (or (not grammar) (integer? grammar)) ((with-module gauche.internal %string-split) string splitter 'infix grammar limit start) ((with-module gauche.internal %string-split) string splitter grammar limit start end))) (select-module gauche.internal) (define-cproc %string-split-by-char (s::<string> ch::<char> :optional (limit::<int> -1)) Scm_StringSplitByCharWithLimit) (define (%string-split string splitter grammar limit start end) (unless (memq grammar '(infix strict-infix prefix suffix)) (error "grammar argument must be one of (infix strict-infix prefix suffix), but got" grammar)) (unless (or (not limit) (and (integer? limit) (>= limit 0))) (error "limit argument must be a nonnegative integer or #f, but got" limit)) (let1 s ((with-module gauche.internal %maybe-substring) string start end) (if (equal? s "") (if (eq? grammar 'strict-infix) (error "string must not be empty with strict-infix grammar") '()) (let1 r (if (char? splitter) (%string-split-by-char s splitter (or limit -1)) (%string-split-by-scanner s (%string-split-scanner splitter) (or limit -1))) (case grammar [(prefix) (if (and (pair? r) (equal? (car r) "")) (cdr r) r)] [(suffix) (if (and (pair? r) (equal? (car (last-pair r)) "")) (drop-right r 1) r)] [else r]))))) ;; aux fns (define (%string-split-scanner splitter) (cond [(string? splitter) (if (string=? splitter "") (^s (if (<= (string-length s) 1) (values s #f) (values (string-copy s 0 1) (string-copy s 1)))) (^s (receive (before after) (string-scan s splitter 'both) (if before (values before after) (values s #f)))))] [(char-set? splitter) (%string-split-scanner-each-char (cut char-set-contains? splitter <>))] [(regexp? splitter) (^s (cond [(rxmatch splitter s) => (^m (let ([before (m 'before)] [after (m 'after)]) (if (string=? s after) (if (<= (string-length s) 1) (values s #f) (values (string-copy s 0 1) (string-copy s 1))) (values before after))))] [else (values s #f)]))] [else ;; assume splitter is a predicate (%string-split-scanner-each-char splitter)])) (define (%string-split-scanner-each-char pred) (define (cursor-substr s cur) (substring s (string-cursor-start s) cur)) (define (scan-in s cur end) (cond [(string-cursor=? cur end) (values (cursor-substr s cur) #f)] [(pred (string-ref s cur)) (scan-out s (string-cursor-next s cur) end (cursor-substr s cur))] [else (scan-in s (string-cursor-next s cur) end)])) (define (scan-out s cur end before) (cond [(string-cursor=? cur end) (values before "")] [(pred (string-ref s cur)) (scan-out s (string-cursor-next s cur) end before)] [else (values before (substring s cur end))])) (^s (scan-in s (string-cursor-start s) (string-cursor-end s)))) (define (%string-split-by-scanner string scanner limit) (let loop ([s string] [r '()] [limit limit]) (if (zero? limit) (reverse! (cons s r)) (receive (before after) (scanner s) (if after (loop after (cons before r) (- limit 1)) (reverse! (cons before r))))))) ;; Modifying string ;; They are just for backward compatibility, and they are expensive ;; anyway, so we don't care their performance. (select-module gauche.internal) (define-cproc %string-replace-body! (target::<string> source::<string>) (return (Scm_StringReplaceBody target (SCM_STRING_BODY source)))) (define-in-module scheme (string-set! str k ch) (check-arg string? str) (check-arg char? ch) (let1 cur (string-index->cursor str k) (%string-replace-body! str (string-append (substring str 0 cur) (string ch) (string-copy str (string-cursor-next str k)))))) (set! (setter string-ref) string-set!) (define-in-module gauche (string-byte-set! str k b) (check-arg string? str) (check-arg integer? k) (check-arg exact? k) (check-arg integer? b) (let ([siz (string-size str)] [out (open-output-string :private? #t)]) (when (or (< k 0) (<= siz k)) (error "string index out of range:" k)) (display (byte-substring str 0 k) out) (write-byte b out) (display (byte-substring str (+ k 1) siz) out) (%string-replace-body! str (get-output-byte-string out)))) (set! (setter string-byte-ref) string-byte-set!) (define-in-module scheme (string-fill! str c :optional (start 0) (end (string-length str))) (let ([start (string-index->cursor str start)] [end (string-index->cursor str end)] [istart (string-cursor->index str start)] [iend (string-cursor->index str end)] [len (string-length str)]) (when (< iend istart) (errorf "end index ~s is smaller than start index ~s" iend istart)) (if (and (= istart 0) (= iend len)) (%string-replace-body! str (make-string len c)) (%string-replace-body! str (string-append (substring str 0 start) (make-string (- iend istart) c) (string-copy str end)))))) ;; Build index. ;; Technically, string-build-index mutates StringBody, but it's an idempotent ;; operation and can be applied on immutable strings. (select-module gauche) (define-cproc string-build-index! (s::<string>) ::<string> (Scm_StringBodyBuildIndex (cast ScmStringBody* (SCM_STRING_BODY s))) (return s)) (define-cproc string-fast-indexable? (s::<string>) ::<boolean> (return (Scm_StringBodyFastIndexableP (SCM_STRING_BODY s)))) (select-module gauche.internal) (define-cproc %string-index-dump (s::<string> :optional (p::<port> (current-output-port))) ::<void> (Scm_StringBodyIndexDump (SCM_STRING_BODY s) p)) ;; ;; Comparison ;; (select-module scheme) (inline-stub (define-cise-expr strcmp [(_ op) `(,op (Scm_StringCmp s1 s2) 0)]) (define-cise-expr strcmpi [(_ op) `(,op (Scm_StringCiCmp s1 s2) 0)]) (define-cise-stmt strcmp-multiarg [(_ cmp) `(while TRUE (if ,cmp (cond [(SCM_NULLP ss) (return TRUE) break] [(not (SCM_STRINGP (SCM_CAR ss))) (SCM_TYPE_ERROR (SCM_CAR ss) "string")] [else (set! s1 s2) (set! s2 (SCM_STRING (SCM_CAR ss))) (set! ss (SCM_CDR ss))]) (begin (return FALSE) break)))]) ) (define-cproc string=? (s1::<string> s2::<string> :rest ss) ::<boolean> :constant (strcmp-multiarg (Scm_StringEqual s1 s2))) (define-cproc string<? (s1::<string> s2::<string> :rest ss) ::<boolean> :constant (strcmp-multiarg (strcmp <))) (define-cproc string>? (s1::<string> s2::<string> :rest ss) ::<boolean> :constant (strcmp-multiarg (strcmp >))) (define-cproc string<=? (s1::<string> s2::<string> :rest ss) ::<boolean> :constant (strcmp-multiarg (strcmp <=))) (define-cproc string>=? (s1::<string> s2::<string> :rest ss) ::<boolean> :constant (strcmp-multiarg (strcmp >=))) (define-cproc string-ci=? (s1::<string> s2::<string> :rest ss) ::<boolean> :constant (strcmp-multiarg (strcmpi ==))) (define-cproc string-ci<? (s1::<string> s2::<string> :rest ss) ::<boolean> :constant (strcmp-multiarg (strcmpi <))) (define-cproc string-ci>? (s1::<string> s2::<string> :rest ss) ::<boolean> :constant (strcmp-multiarg (strcmpi >))) (define-cproc string-ci<=? (s1::<string> s2::<string> :rest ss) ::<boolean> :constant (strcmp-multiarg (strcmpi <=))) (define-cproc string-ci>=? (s1::<string> s2::<string> :rest ss) ::<boolean> :constant (strcmp-multiarg (strcmpi >=))) ;; ;; Mapping ;; ;; We have two kinds of string-{map|for-each}. SRFI-13 takes one string ;; with optional start/end arguments. R7RS takes one or more string arguments. ;; In retrospect, R7RS is more consistent, but srfi-13 is very frequently ;; imported and it is bothersome to avoid name conflicts. So we have ;; single implementation that handles both. (select-module gauche.internal) (define (%string-map-dispatch name proc str rest proc-single proc-multi) (cond [(null? rest) (proc-single proc str)] [(or (integer? (car rest)) (string-cursor? (car rest))) (if (null? (cdr rest)) (proc-single proc (%maybe-substring str (car rest) (undefined))) (if (or (integer? (cadr rest)) (string-cursor? (cadr rest))) (if (null? (cddr rest)) (proc-single proc (%maybe-substring str (car rest) (cadr rest))) (errorf "Too many arguments for srfi-13 style ~a" name)) (error "Integer or string-cursor expected, but got:" (cadr rest))))] [(string? (car rest)) (if-let1 bad (find (^s (not (string? s))) (cdr rest)) (error "string expected, but got:" bad) (apply proc-multi proc str rest))] [else (error "string expected, but got:" (car rest))])) (select-module gauche) (define (string-map proc str . rest) (define (string-map-1 proc str) ;; go reverse so we don't have to reverse the final list ;; slightly slower than iterating forward, but less temp. ;; objects (let ([start (string-cursor-start str)]) (let loop ([cur (string-cursor-end str)] [lst '()]) (if (string-cursor=? cur start) (list->string lst) (let1 cur (string-cursor-prev str cur) (loop cur (cons (proc (string-ref str cur)) lst))))))) (define (string-map-n proc . strs) ;; the multi-strs version is already more complicated/less ;; efficient with lots of lists, just go from left to right (let1 ends (map string-cursor-end strs) (let loop ([curs (map string-cursor-start strs)] [lst '()]) (if (any string-cursor=? curs ends) (list->string (reverse lst)) (loop (map string-cursor-next strs curs) (cons (apply proc (map string-ref strs curs)) lst)))))) ((with-module gauche.internal %string-map-dispatch) 'string-map proc str rest string-map-1 string-map-n)) (define (string-for-each proc str . rest) (define (string-for-each-1 proc str) (let ([end (string-cursor-end str)]) (let loop ([cur (string-cursor-start str)]) (if (string-cursor=? cur end) (undefined) (begin (proc (string-ref str cur)) (loop (string-cursor-next str cur))))))) (define (string-for-each-n proc . strs) (let1 ends (map string-cursor-end strs) (let loop ([curs (map string-cursor-start strs)]) (if (any string-cursor=? curs ends) (undefined) (begin (apply proc (map string-ref strs curs)) (loop (map string-cursor-next strs curs))))))) ((with-module gauche.internal %string-map-dispatch) 'string-for-each proc str rest string-for-each-1 string-for-each-n)) ;; ;; Byte string ;; (select-module gauche) ;; DEPRECATED, only kept for backward compatibility. ;; We allocate a new string and swap the body, in order to avoid MT-hazard. ;; (So it is _not_ allocation-free, and we no longer have reason to keep ;; this procedure.) (define (string-incomplete->complete! str) (and-let1 s (string-incomplete->complete str) ((with-module gauche.internal %string-replace-body!) str s) s)) (define-cproc string-complete->incomplete (str::<string>) (return (Scm_CopyStringWithFlags str SCM_STRING_INCOMPLETE SCM_STRING_INCOMPLETE))) ;; handling : #f | :omit | :replace | :escape ;; filler : #f | <char> | <string> (define-cproc string-incomplete->complete (str::<string> :optional (handling #f) (filler #f)) ;; backward compatibility (when (SCM_CHARP handling) (set! filler handling handling ':replace)) ;; argument check (unless (or (SCM_FALSEP handling) (Scm_Memq handling '(:omit :replace :escape))) (Scm_Error "Either #f, :omit, :replace or :escape required, \ but got:" handling)) (unless (or (SCM_FALSEP filler) (SCM_CHARP filler)) (Scm_Error "Either a character or #f required, but got:" filler)) (let* ([b::(const ScmStringBody*) (SCM_STRING_BODY str)]) (unless (SCM_STRING_BODY_INCOMPLETE_P b) ;; We do simple copy (return (Scm_CopyString str))) (let* ([s::(const char*) (SCM_STRING_BODY_START b)] [siz::ScmSmallInt (SCM_STRING_BODY_SIZE b)] [len::ScmSmallInt (Scm_MBLen s (+ s siz))]) (when (>= len 0) ;; The body can be interpreted as a complete string. (return (Scm_MakeString s siz len 0))) (when (SCM_FALSEP handling) ;; Return #f for string that can't be complete (return SCM_FALSE)) (let* ([p::(const char*) s] [ds::ScmDString] [echar::ScmChar (?: (SCM_CHARP filler) (SCM_CHAR_VALUE filler) #\?)]) (Scm_DStringInit (& ds)) (while (< p (+ s siz)) (let* ([ch::ScmChar]) (if (>= (+ p (SCM_CHAR_NFOLLOWS (* p))) (+ s siz)) (set! ch SCM_CHAR_INVALID) (SCM_CHAR_GET p ch)) (cond [(and (SCM_EQ handling ':escape) ; escaping escape char (== ch echar)) (Scm_DStringPutc (& ds) ch) (Scm_DStringPutc (& ds) ch) (+= p (SCM_CHAR_NBYTES ch))] [(!= ch SCM_CHAR_INVALID) ; ok (Scm_DStringPutc (& ds) ch) (+= p (SCM_CHAR_NBYTES ch))] [(SCM_EQ handling ':omit) (inc! p)] ;skip [(SCM_EQ handling ':replace) ;subs with echar (Scm_DStringPutc (& ds) echar) (inc! p)] [(SCM_EQ handling ':escape) ;escape (let* ([octet::u_char (* p)]) (Scm_DStringPutc (& ds) echar) (Scm_DStringPutc (& ds) (Scm_IntToDigit (>> octet 4) 16 0 0)) (Scm_DStringPutc (& ds) (Scm_IntToDigit (logand octet #xf) 16 0 0)) (inc! p))]))) (return (Scm_DStringGet (& ds) 0)))))) (define-cproc make-byte-string (size::<int32> :optional (byte::<uint8> 0)) (let* ([s::char*]) (when (< size 0) (Scm_Error "size out of bound: %d" size)) (set! s (SCM_NEW_ATOMIC2 (C: char*) size)) (memset s byte size) (return (Scm_MakeString s size size SCM_STRING_INCOMPLETE)))) (define-cproc string-byte-ref (str::<string> k::<fixnum> :optional fallback) (let* ([r::int (Scm_StringByteRef str k (SCM_UNBOUNDP fallback))]) (return (?: (< r 0) fallback (SCM_MAKE_INT r))))) (define-cproc byte-substring (str::<string> start::<fixnum> end::<fixnum>) (return (Scm_Substring str start end TRUE))) ;; ;; Complete-sexp? ;; ;; Check if the given string can be parsed as a complete sexp. ;; Note that this test doesn't rule out all invalid sexprs. ;; ;; This used to be in gauche.listener, but is also used in ;; gauche.interactive.editable-reader so moved here. ;; ;; This should eventually be folded into build-in read, so that ;; any nontrivial syntax can be handled consistently. (select-module gauche) (define (complete-sexp? str) (with-input-from-string str (^[] ;; charset that delimits token (define special-chars #[\u0000-\u0020\"\'()\,\;\[\\\]\`{|}\u007f]) ;; main loop (define (rec closer) (let1 ch (read-char) (cond [(eof-object? ch) (if closer #f #t)] [(eqv? closer ch) #t] [(eqv? #\( ch) (and (rec #\) ) (rec closer))] [(eqv? #\[ ch) (and (rec #\] ) (rec closer))] [(eqv? #\{ ch) (and (rec #\} ) (rec closer))] [(eqv? #\" ch) (and (rec-escaped #\") (rec closer))] [(eqv? #\| ch) (and (rec-escaped #\|) (rec closer))] [(eqv? #\; ch) (skip-to-nl) (rec closer)] [(eqv? #\# ch) (let1 c2 (read-char) (cond [(eof-object? c2) #f] [(eqv? c2 #\\) (and (not (eof-object? (read-char))) (begin (skip-token) (rec closer)))] [(eqv? c2 #\/) (and (rec-escaped #\/) (rec closer))] [(eqv? c2 #\[) (and (rec-escaped #\]) (rec closer))] [(eqv? c2 #\,) (let1 c3 (skip-ws) (cond [(eof-object? c3) #f] [(eqv? #\( c3) (and (rec #\) ) (rec closer))] [(eqv? #\[ c3) (and (rec #\] ) (rec closer))] [(eqv? #\{ c3) (and (rec #\} ) (rec closer))] [else (skip-token) (rec closer)]))] [(eqv? c2 #\() (and (rec #\)) (rec closer))] [(eqv? c2 #\<) (errorf "unreadable sequence #<~a..." (read-block 10))] [(eqv? c2 closer) #t] [else (rec closer)]))] [else (rec closer)]))) (define (rec-escaped closer) (let1 ch (read-char) (cond [(eof-object? ch) #f] [(eqv? closer ch) #t] [(eqv? #\\ ch) (read-char) (rec-escaped closer)] [else (rec-escaped closer)]))) (define (skip-token) (let loop ([ch (peek-char)]) (unless (or (eof-object? ch) (char-set-contains? special-chars ch)) (read-char) (loop (peek-char))))) (define (skip-ws) (let loop ([ch (read-char)]) (if (or (eof-object? ch) (char-set-contains? #[\S] ch)) ch (loop (read-char))))) (define (skip-to-nl) (let loop ([ch (read-char)]) (unless (or (eof-object? ch) (eqv? ch #\newline)) (loop (read-char))))) ;; body (rec #f) ))) ;; ;; String pointers (OBSOLETED) ;; (select-module gauche) (inline-stub (.if "GAUCHE_STRING_POINTER" (begin ;; string pointer (define-type <string-pointer> "ScmStringPointer*" "string pointer" "SCM_STRING_POINTERP" "SCM_STRING_POINTER") (define-cproc make-string-pointer (str::<string> :optional (index::<fixnum> 0) (start::<fixnum> 0) (end::<fixnum> -1)) Scm_MakeStringPointer) (define-cproc string-pointer? (obj) ::<boolean> SCM_STRING_POINTERP) (define-cproc string-pointer-ref (sp::<string-pointer>) Scm_StringPointerRef) (define-cproc string-pointer-next! (sp::<string-pointer>) Scm_StringPointerNext) (define-cproc string-pointer-prev! (sp::<string-pointer>) Scm_StringPointerPrev) (define-cproc string-pointer-set! (sp::<string-pointer> index::<fixnum>) Scm_StringPointerSet) (define-cproc string-pointer-substring (sp::<string-pointer> :key (after #f)) (return (Scm_StringPointerSubstring sp (not (SCM_FALSEP after))))) (define-cproc string-pointer-index (sp::<string-pointer>) ::<int> (return (-> sp index))) (define-cproc string-pointer-copy (sp::<string-pointer>) Scm_StringPointerCopy) (define-cproc string-pointer-byte-index (sp::<string-pointer>) ::<int> (return (cast int (- (-> sp current) (-> sp start)))))))) (select-module gauche.internal) (inline-stub (.if "GAUCHE_STRING_POINTER" (define-cproc %string-pointer-dump (sp::<string-pointer>) ::<void> Scm_StringPointerDump) )) ;; ;; String cursors ;; (select-module gauche) (define-cproc string-cursor? (obj) ::<boolean> SCM_STRING_CURSOR_P) (define-cproc string-cursor-start (s::<string>) (return (Scm_MakeStringCursorFromIndex s 0))) (define-cproc string-cursor-end (s::<string>) Scm_MakeStringCursorEnd) (define-cproc string-cursor-next (s::<string> cursor) (return (Scm_StringCursorForward s cursor 1))) (define-cproc string-cursor-prev (s::<string> cursor) (return (Scm_StringCursorBack s cursor 1))) (define-cproc string-cursor-forward (s::<string> cursor nchars::<fixnum>) Scm_StringCursorForward) (define-cproc string-cursor-back (s::<string> cursor nchars::<fixnum>) Scm_StringCursorBack) (define-cproc string-index->cursor (s::<string> index) (if (SCM_STRING_CURSOR_P index) (return index) (return (Scm_MakeStringCursorFromIndex s (Scm_GetInteger index))))) (define-cproc string-cursor->index (s::<string> cursor) Scm_StringCursorIndex) (define-cproc string-cursor=? (cursor1 cursor2) ::<boolean> (return (Scm_StringCursorCompare cursor1 cursor2 Scm_NumEq))) (define-cproc string-cursor<? (cursor1 cursor2) ::<boolean> (return (Scm_StringCursorCompare cursor1 cursor2 Scm_NumLT))) (define-cproc string-cursor>? (cursor1 cursor2) ::<boolean> (return (Scm_StringCursorCompare cursor1 cursor2 Scm_NumGT))) (define-cproc string-cursor<=? (cursor1 cursor2) ::<boolean> (return (Scm_StringCursorCompare cursor1 cursor2 Scm_NumLE))) (define-cproc string-cursor>=? (cursor1 cursor2) ::<boolean> (return (Scm_StringCursorCompare cursor1 cursor2 Scm_NumGE))) (define-cproc string-cursor-diff (s::<string> start end) (return (Scm_Sub (Scm_StringCursorIndex s end) (Scm_StringCursorIndex s start))))
{ "pile_set_name": "Github" }
/* * Mesa 3-D graphics library * Version: 7.5 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * 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 * BRIAN PAUL 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. */ /** * \file compiler.h * Compiler-related stuff. */ #ifndef COMPILER_H #define COMPILER_H #include <assert.h> #include <ctype.h> #if defined(__alpha__) && defined(CCPML) #include <cpml.h> /* use Compaq's Fast Math Library on Alpha */ #else #include <math.h> #endif #include <limits.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <float.h> #include <stdarg.h> #ifdef __cplusplus extern "C" { #endif /** * Get standard integer types */ #include <stdint.h> /** * Sun compilers define __i386 instead of the gcc-style __i386__ */ #ifdef __SUNPRO_C # if !defined(__i386__) && defined(__i386) # define __i386__ # elif !defined(__amd64__) && defined(__amd64) # define __amd64__ # elif !defined(__sparc__) && defined(__sparc) # define __sparc__ # endif # if !defined(__volatile) # define __volatile volatile # endif #endif /** * finite macro. */ #if defined(_MSC_VER) # define finite _finite #elif defined(__WATCOMC__) # define finite _finite #endif /** * Disable assorted warnings */ #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP) # if !defined(__GNUC__) /* mingw environment */ # pragma warning( disable : 4068 ) /* unknown pragma */ # pragma warning( disable : 4710 ) /* function 'foo' not inlined */ # pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ # pragma warning( disable : 4127 ) /* conditional expression is constant */ # if defined(MESA_MINWARN) # pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ # pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ # pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ # pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ # pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ # endif # endif #endif #if defined(__WATCOMC__) # pragma disable_message(201) /* Disable unreachable code warnings */ #endif /** * Function inlining */ #ifndef inline # ifdef __cplusplus /* C++ supports inline keyword */ # elif defined(__GNUC__) # define inline __inline__ # elif defined(_MSC_VER) # define inline __inline # elif defined(__ICL) # define inline __inline # elif defined(__INTEL_COMPILER) /* Intel compiler supports inline keyword */ # elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) # define inline __inline # elif defined(__SUNPRO_C) && defined(__C99FEATURES__) /* C99 supports inline keyword */ # elif (__STDC_VERSION__ >= 199901L) /* C99 supports inline keyword */ # else # define inline # endif #endif #ifndef INLINE # define INLINE inline #endif /** * PUBLIC/USED macros * * If we build the library with gcc's -fvisibility=hidden flag, we'll * use the PUBLIC macro to mark functions that are to be exported. * * We also need to define a USED attribute, so the optimizer doesn't * inline a static function that we later use in an alias. - ajax */ #ifndef PUBLIC # if (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PUBLIC __attribute__((visibility("default"))) # define USED __attribute__((used)) # else # define PUBLIC # define USED # endif #endif /** * Some compilers don't like some of Mesa's const usage. In those places use * CONST instead of const. Pass -DNO_CONST to compilers where this matters. */ #ifdef NO_CONST # define CONST #else # define CONST const #endif /** * __builtin_expect macros */ #if !defined(__GNUC__) # define __builtin_expect(x, y) (x) #endif #ifndef likely # ifdef __GNUC__ # define likely(x) __builtin_expect(!!(x), 1) # define unlikely(x) __builtin_expect(!!(x), 0) # else # define likely(x) (x) # define unlikely(x) (x) # endif #endif /** * The __FUNCTION__ gcc variable is generally only used for debugging. * If we're not using gcc, define __FUNCTION__ as a cpp symbol here. * Don't define it if using a newer Windows compiler. */ #ifndef __FUNCTION__ # if defined(__VMS) # define __FUNCTION__ "VMS$NL:" # elif !defined(__GNUC__) && !defined(__xlC__) && \ (!defined(_MSC_VER) || _MSC_VER < 1300) # if (__STDC_VERSION__ >= 199901L) /* C99 */ || \ (defined(__SUNPRO_C) && defined(__C99FEATURES__)) # define __FUNCTION__ __func__ # else # define __FUNCTION__ "<unknown>" # endif # endif #endif #ifndef __func__ # if (__STDC_VERSION__ >= 199901L) || \ (defined(__SUNPRO_C) && defined(__C99FEATURES__)) /* __func__ is part of C99 */ # elif defined(_MSC_VER) # if _MSC_VER >= 1300 # define __func__ __FUNCTION__ # else # define __func__ "<unknown>" # endif # endif #endif /** * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN, and CPU_TO_LE32. * Do not use these unless absolutely necessary! * Try to use a runtime test instead. * For now, only used by some DRI hardware drivers for color/texel packing. */ #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN #if defined(__linux__) #include <byteswap.h> #define CPU_TO_LE32( x ) bswap_32( x ) #elif defined(__APPLE__) #include <CoreFoundation/CFByteOrder.h> #define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x ) #elif (defined(_AIX) || defined(__blrts)) static INLINE GLuint CPU_TO_LE32(GLuint x) { return (((x & 0x000000ff) << 24) | ((x & 0x0000ff00) << 8) | ((x & 0x00ff0000) >> 8) | ((x & 0xff000000) >> 24)); } #elif defined(__OpenBSD__) #include <sys/types.h> #define CPU_TO_LE32( x ) htole32( x ) #else /*__linux__ */ #include <sys/endian.h> #define CPU_TO_LE32( x ) bswap32( x ) #endif /*__linux__*/ #define MESA_BIG_ENDIAN 1 #else #define CPU_TO_LE32( x ) ( x ) #define MESA_LITTLE_ENDIAN 1 #endif #define LE32_TO_CPU( x ) CPU_TO_LE32( x ) #if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP) #define CAPI _cdecl #endif /** * Create a macro so that asm functions can be linked into compilers other * than GNU C */ #ifndef _ASMAPI #if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/ #define _ASMAPI __cdecl #else #define _ASMAPI #endif #ifdef PTR_DECL_IN_FRONT #define _ASMAPIP * _ASMAPI #else #define _ASMAPIP _ASMAPI * #endif #endif #ifdef USE_X86_ASM #define _NORMAPI _ASMAPI #define _NORMAPIP _ASMAPIP #else #define _NORMAPI #define _NORMAPIP * #endif /* Turn off macro checking systems used by other libraries */ #ifdef CHECK #undef CHECK #endif /** * ASSERT macro */ #if !defined(_WIN32_WCE) #if defined(BUILD_FOR_SNAP) && defined(CHECKED) # define ASSERT(X) _CHECK(X) #elif defined(DEBUG) # define ASSERT(X) assert(X) #else # define ASSERT(X) #endif #endif /** * Static (compile-time) assertion. * Basically, use COND to dimension an array. If COND is false/zero the * array size will be -1 and we'll get a compilation error. */ #define STATIC_ASSERT(COND) \ do { \ typedef int static_assertion_failed[(!!(COND))*2-1]; \ } while (0) #if (__GNUC__ >= 3) #define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a))) #else #define PRINTFLIKE(f, a) #endif #ifndef NULL #define NULL 0 #endif /** * LONGSTRING macro * gcc -pedantic warns about long string literals, LONGSTRING silences that. */ #if !defined(__GNUC__) # define LONGSTRING #else # define LONGSTRING __extension__ #endif #ifndef M_PI #define M_PI (3.14159265358979323846) #endif #ifndef M_E #define M_E (2.7182818284590452354) #endif #ifndef M_LOG2E #define M_LOG2E (1.4426950408889634074) #endif #ifndef ONE_DIV_SQRT_LN2 #define ONE_DIV_SQRT_LN2 (1.201122408786449815) #endif #ifndef FLT_MAX_EXP #define FLT_MAX_EXP 128 #endif /** * USE_IEEE: Determine if we're using IEEE floating point */ #if defined(__i386__) || defined(__386__) || defined(__sparc__) || \ defined(__s390x__) || defined(__powerpc__) || \ defined(__x86_64__) || \ defined(ia64) || defined(__ia64__) || \ defined(__hppa__) || defined(hpux) || \ defined(__mips) || defined(_MIPS_ARCH) || \ defined(__arm__) || \ defined(__sh__) || defined(__m32r__) || \ (defined(__sun) && defined(_IEEE_754)) || \ (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS))) #define USE_IEEE #define IEEE_ONE 0x3f800000 #endif /** * START/END_FAST_MATH macros: * * START_FAST_MATH: Set x86 FPU to faster, 32-bit precision mode (and save * original mode to a temporary). * END_FAST_MATH: Restore x86 FPU to original mode. */ #if defined(__GNUC__) && defined(__i386__) /* * Set the x86 FPU control word to guarentee only 32 bits of precision * are stored in registers. Allowing the FPU to store more introduces * differences between situations where numbers are pulled out of memory * vs. situations where the compiler is able to optimize register usage. * * In the worst case, we force the compiler to use a memory access to * truncate the float, by specifying the 'volatile' keyword. */ /* Hardware default: All exceptions masked, extended double precision, * round to nearest (IEEE compliant): */ #define DEFAULT_X86_FPU 0x037f /* All exceptions masked, single precision, round to nearest: */ #define FAST_X86_FPU 0x003f /* The fldcw instruction will cause any pending FP exceptions to be * raised prior to entering the block, and we clear any pending * exceptions before exiting the block. Hence, asm code has free * reign over the FPU while in the fast math block. */ #if defined(NO_FAST_MATH) #define START_FAST_MATH(x) \ do { \ static GLuint mask = DEFAULT_X86_FPU; \ __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ __asm__ ( "fldcw %0" : : "m" (mask) ); \ } while (0) #else #define START_FAST_MATH(x) \ do { \ static GLuint mask = FAST_X86_FPU; \ __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ __asm__ ( "fldcw %0" : : "m" (mask) ); \ } while (0) #endif /* Restore original FPU mode, and clear any exceptions that may have * occurred in the FAST_MATH block. */ #define END_FAST_MATH(x) \ do { \ __asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) ); \ } while (0) #elif defined(__WATCOMC__) && defined(__386__) #define DEFAULT_X86_FPU 0x037f /* See GCC comments above */ #define FAST_X86_FPU 0x003f /* See GCC comments above */ void _watcom_start_fast_math(unsigned short *x,unsigned short *mask); #pragma aux _watcom_start_fast_math = \ "fnstcw word ptr [eax]" \ "fldcw word ptr [ecx]" \ parm [eax] [ecx] \ modify exact []; void _watcom_end_fast_math(unsigned short *x); #pragma aux _watcom_end_fast_math = \ "fnclex" \ "fldcw word ptr [eax]" \ parm [eax] \ modify exact []; #if defined(NO_FAST_MATH) #define START_FAST_MATH(x) \ do { \ static GLushort mask = DEFAULT_X86_FPU; \ _watcom_start_fast_math(&x,&mask); \ } while (0) #else #define START_FAST_MATH(x) \ do { \ static GLushort mask = FAST_X86_FPU; \ _watcom_start_fast_math(&x,&mask); \ } while (0) #endif #define END_FAST_MATH(x) _watcom_end_fast_math(&x) #elif defined(_MSC_VER) && defined(_M_IX86) #define DEFAULT_X86_FPU 0x037f /* See GCC comments above */ #define FAST_X86_FPU 0x003f /* See GCC comments above */ #if defined(NO_FAST_MATH) #define START_FAST_MATH(x) do {\ static GLuint mask = DEFAULT_X86_FPU;\ __asm fnstcw word ptr [x]\ __asm fldcw word ptr [mask]\ } while(0) #else #define START_FAST_MATH(x) do {\ static GLuint mask = FAST_X86_FPU;\ __asm fnstcw word ptr [x]\ __asm fldcw word ptr [mask]\ } while(0) #endif #define END_FAST_MATH(x) do {\ __asm fnclex\ __asm fldcw word ptr [x]\ } while(0) #else #define START_FAST_MATH(x) x = 0 #define END_FAST_MATH(x) (void)(x) #endif #ifndef Elements #define Elements(x) (sizeof(x)/sizeof(*(x))) #endif #ifdef __cplusplus } #endif #endif /* COMPILER_H */
{ "pile_set_name": "Github" }
/* *************************************************************************************** * Copyright (C) 2006 EsperTech, Inc. All rights reserved. * * http://www.espertech.com/esper * * http://www.espertech.com * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the GPL license * * a copy of which has been included with this distribution in the license.txt file. * *************************************************************************************** */ package com.espertech.esper.common.internal.context.controller.keyed; import com.espertech.esper.common.client.EventBean; import com.espertech.esper.common.internal.collection.IntSeqKey; import com.espertech.esper.common.internal.context.controller.condition.*; import com.espertech.esper.common.internal.context.controller.core.ContextControllerFilterEntry; import com.espertech.esper.common.internal.context.mgr.ContextManagerRealization; import com.espertech.esper.common.internal.context.mgr.ContextPartitionInstantiationResult; import com.espertech.esper.common.internal.context.util.AgentInstance; import com.espertech.esper.common.internal.context.util.AgentInstanceTransferServices; import com.espertech.esper.common.internal.context.util.AgentInstanceUtil; import com.espertech.esper.common.internal.context.util.FilterFaultHandler; import com.espertech.esper.common.internal.event.core.EventBeanTypedEventFactory; import com.espertech.esper.common.internal.filterspec.MatchedEventMap; import com.espertech.esper.common.internal.util.CollectionUtil; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.function.BiConsumer; public class ContextControllerKeyedImpl extends ContextControllerKeyed { protected final ContextControllerKeyedSvc keyedSvc; public ContextControllerKeyedImpl(ContextControllerKeyedFactory factory, ContextManagerRealization realization) { super(realization, factory); keyedSvc = ContextControllerKeyedUtil.getService(factory, realization); } public void activate(IntSeqKey path, Object[] parentPartitionKeys, EventBean optionalTriggeringEvent, Map<String, Object> optionalTriggeringPattern) { keyedSvc.mgmtCreate(path, parentPartitionKeys); ContextControllerFilterEntry[] filterEntries = activateFilters(optionalTriggeringEvent, path, parentPartitionKeys); keyedSvc.mgmtSetFilters(path, filterEntries); } public void deactivate(IntSeqKey path, boolean terminateChildContexts) { if (path.length() != factory.getFactoryEnv().getNestingLevel() - 1) { throw new IllegalStateException("Unrecognized controller path"); } ContextControllerFilterEntry[] filters = keyedSvc.mgmtGetFilters(path); for (ContextControllerFilterEntry callback : filters) { ((ContextControllerKeyedFilterEntry) callback).destroy(); } if (factory.getKeyedSpec().getOptionalTermination() != null) { List<ContextControllerConditionNonHA> terminationConditions = keyedSvc.keyGetTermConditions(path); for (ContextControllerConditionNonHA condition : terminationConditions) { condition.deactivate(); } } Collection<Integer> subpaths = keyedSvc.deactivate(path); if (terminateChildContexts) { for (int subpathId : subpaths) { realization.contextPartitionTerminate(path, subpathId, this, null, false, null); } } } public void matchFound(ContextControllerDetailKeyedItem item, EventBean theEvent, IntSeqKey controllerPath, String optionalInitCondAsName) { if (controllerPath.length() != factory.getFactoryEnv().getNestingLevel() - 1) { throw new IllegalStateException("Unrecognized controller path"); } Object getterKey = item.getGetter().get(theEvent); boolean exists = keyedSvc.keyHasSeen(controllerPath, getterKey); if (exists || theEvent == lastTerminatingEvent) { // if all-matches is more than one, the termination has also fired return; } lastTerminatingEvent = null; Object partitionKey = getterKey; if (factory.keyedSpec.isHasAsName()) { partitionKey = new ContextControllerKeyedPartitionKeyWInit(getterKey, optionalInitCondAsName, optionalInitCondAsName == null ? null : theEvent); } Object[] parentPartitionKeys = keyedSvc.mgmtGetPartitionKeys(controllerPath); // get next subpath id int subpathId = keyedSvc.mgmtGetIncSubpath(controllerPath); // instantiate ContextPartitionInstantiationResult result = realization.contextPartitionInstantiate(controllerPath, subpathId, this, theEvent, null, parentPartitionKeys, partitionKey); int subpathIdOrCPId = result.getSubpathOrCPId(); // handle termination filter ContextControllerConditionNonHA terminationCondition = null; if (factory.getKeyedSpec().getOptionalTermination() != null) { IntSeqKey conditionPath = controllerPath.addToEnd(subpathIdOrCPId); terminationCondition = activateTermination(theEvent, parentPartitionKeys, partitionKey, conditionPath, optionalInitCondAsName); for (AgentInstance agentInstance : result.getAgentInstances()) { agentInstance.getAgentInstanceContext().getEpStatementAgentInstanceHandle().setFilterFaultHandler(ContextControllerWTerminationFilterFaultHandler.INSTANCE); } } keyedSvc.keyAdd(controllerPath, getterKey, subpathIdOrCPId, terminationCondition); // update the filter version for this handle long filterVersionAfterStart = realization.getAgentInstanceContextCreate().getFilterService().getFiltersVersion(); realization.getAgentInstanceContextCreate().getEpStatementAgentInstanceHandle().getStatementFilterVersion().setStmtFilterVersion(filterVersionAfterStart); } protected void visitPartitions(IntSeqKey controllerPath, BiConsumer<Object, Integer> keyAndSubpathOrCPId) { keyedSvc.keyVisit(controllerPath, keyAndSubpathOrCPId); } protected int getSubpathOrCPId(IntSeqKey path, Object keyForLookup) { return keyedSvc.keyGetSubpathOrCPId(path, keyForLookup); } public void destroy() { keyedSvc.destroy(); } private ContextControllerConditionNonHA activateTermination(EventBean triggeringEvent, Object[] parentPartitionKeys, Object partitionKey, IntSeqKey conditionPath, String optionalInitCondAsName) { ContextControllerConditionCallback callback = new ContextControllerConditionCallback() { public void rangeNotification(IntSeqKey conditionPath, ContextControllerConditionNonHA originEndpoint, EventBean optionalTriggeringEvent, Map<String, Object> optionalTriggeringPattern, EventBean optionalTriggeringEventPattern, Map<String, Object> optionalPatternForInclusiveEval, Map<String, Object> terminationProperties) { IntSeqKey parentPath = conditionPath.removeFromEnd(); Object getterKey = factory.getGetterKey(partitionKey); ContextControllerKeyedSvcEntry removed = keyedSvc.keyRemove(parentPath, getterKey); if (removed == null) { return; } // remember the terminating event, we don't want it to initiate a new partition ContextControllerKeyedImpl.this.lastTerminatingEvent = optionalTriggeringEvent != null ? optionalTriggeringEvent : optionalTriggeringEventPattern; realization.contextPartitionTerminate(conditionPath.removeFromEnd(), removed.getSubpathOrCPId(), ContextControllerKeyedImpl.this, terminationProperties, false, null); removed.getTerminationCondition().deactivate(); } }; Object[] partitionKeys = CollectionUtil.addValue(parentPartitionKeys, partitionKey); ContextControllerConditionNonHA terminationCondition = ContextControllerConditionFactory.getEndpoint(conditionPath, partitionKeys, factory.keyedSpec.getOptionalTermination(), callback, this, false); ContextControllerEndConditionMatchEventProvider endConditionMatchEventProvider = null; if (optionalInitCondAsName != null) { endConditionMatchEventProvider = new ContextControllerEndConditionMatchEventProvider() { public void populateEndConditionFromTrigger(MatchedEventMap map, EventBean triggeringEvent) { ContextControllerKeyedUtil.populatePriorMatch(optionalInitCondAsName, map, triggeringEvent); } public void populateEndConditionFromTrigger(MatchedEventMap map, Map<String, Object> triggeringPattern, EventBeanTypedEventFactory eventBeanTypedEventFactory) { // not required for keyed controller } }; } terminationCondition.activate(triggeringEvent, endConditionMatchEventProvider, null); return terminationCondition; } private ContextControllerFilterEntry[] activateFilters(EventBean optionalTriggeringEvent, IntSeqKey controllerPath, Object[] parentPartitionKeys) { ContextConditionDescriptor[] optionalInit = factory.getKeyedSpec().getOptionalInit(); if (optionalInit == null || optionalInit.length == 0) { return activateFiltersFromPartitionKeys(optionalTriggeringEvent, controllerPath, parentPartitionKeys); } else { return activateFiltersFromInit(optionalTriggeringEvent, controllerPath, parentPartitionKeys); } } private ContextControllerFilterEntry[] activateFiltersFromInit(EventBean optionalTriggeringEvent, IntSeqKey controllerPath, Object[] parentPartitionKeys) { ContextConditionDescriptorFilter[] inits = factory.getKeyedSpec().getOptionalInit(); ContextControllerFilterEntry[] filterEntries = new ContextControllerFilterEntry[inits.length]; for (int i = 0; i < inits.length; i++) { ContextConditionDescriptorFilter init = inits[i]; ContextControllerDetailKeyedItem found = ContextControllerKeyedUtil.findInitMatchingKey(factory.getKeyedSpec().getItems(), init); filterEntries[i] = activateFilterWithInit(init, found, optionalTriggeringEvent, controllerPath, parentPartitionKeys); } return filterEntries; } private ContextControllerFilterEntry[] activateFiltersFromPartitionKeys(EventBean optionalTriggeringEvent, IntSeqKey controllerPath, Object[] parentPartitionKeys) { ContextControllerDetailKeyedItem[] items = factory.getKeyedSpec().getItems(); ContextControllerFilterEntry[] filterEntries = new ContextControllerFilterEntry[items.length]; for (int i = 0; i < items.length; i++) { filterEntries[i] = activateFilterNoInit(items[i], optionalTriggeringEvent, controllerPath, parentPartitionKeys); } return filterEntries; } private ContextControllerFilterEntry activateFilterNoInit(ContextControllerDetailKeyedItem item, EventBean optionalTriggeringEvent, IntSeqKey controllerPath, Object[] parentPartitionKeys) { ContextControllerKeyedFilterEntryNoInit callback = new ContextControllerKeyedFilterEntryNoInit(this, controllerPath, parentPartitionKeys, item); if (optionalTriggeringEvent != null) { boolean match = AgentInstanceUtil.evaluateFilterForStatement(optionalTriggeringEvent, realization.getAgentInstanceContextCreate(), callback.getFilterHandle()); if (match) { callback.matchFound(optionalTriggeringEvent, null); } } return callback; } private ContextControllerFilterEntry activateFilterWithInit(ContextConditionDescriptorFilter filter, ContextControllerDetailKeyedItem item, EventBean optionalTriggeringEvent, IntSeqKey controllerPath, Object[] parentPartitionKeys) { return new ContextControllerKeyedFilterEntryWInit(this, controllerPath, item, parentPartitionKeys, filter); } public static class ContextControllerWTerminationFilterFaultHandler implements FilterFaultHandler { public static final FilterFaultHandler INSTANCE = new ContextControllerWTerminationFilterFaultHandler(); private ContextControllerWTerminationFilterFaultHandler() { } public boolean handleFilterFault(EventBean theEvent, long version) { return true; } } public void transfer(IntSeqKey path, boolean transferChildContexts, AgentInstanceTransferServices xfer) { ContextControllerFilterEntry[] filters = keyedSvc.mgmtGetFilters(path); for (int i = 0; i < factory.getKeyedSpec().getItems().length; i++) { ContextControllerDetailKeyedItem item = factory.getKeyedSpec().getItems()[i]; filters[i].transfer(item.getFilterSpecActivatable(), xfer); } if (factory.getKeyedSpec().getOptionalTermination() != null) { keyedSvc.keyVisitEntry(path, entry -> entry.getTerminationCondition().transfer(xfer)); } if (!transferChildContexts) { return; } keyedSvc.keyVisit(path, (partitionKey, subpathId) -> { realization.transferRecursive(path, subpathId, this, xfer); }); } }
{ "pile_set_name": "Github" }
/* Emacs style mode select -*- C++ -*- *----------------------------------------------------------------------------- * * * PrBoom: a Doom port merged with LxDoom and LSDLDoom * based on BOOM, a modified and improved DOOM engine * Copyright (C) 1999 by * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman * Copyright (C) 1999-2000 by * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze, Andrey Budko * Copyright 2005, 2006 by * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko * * 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 2 * 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., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * DESCRIPTION: * Demo stuff * *--------------------------------------------------------------------- */ #include "doomstat.h" #define SMOOTH_PLAYING_MAXFACTOR 16 extern int demo_smoothturns; extern int demo_smoothturnsfactor; void R_SmoothPlaying_Reset(player_t *player); void R_SmoothPlaying_Add(int delta); angle_t R_SmoothPlaying_Get(angle_t defangle); void R_ResetAfterTeleport(player_t *player);
{ "pile_set_name": "Github" }
<?php /* +-----------------------------------------------------------------------------+ | ILIAS open source | +-----------------------------------------------------------------------------+ | Copyright (c) 1998-2006 ILIAS open source, University of Cologne | | | | 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 2 | | 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | +-----------------------------------------------------------------------------+ */ /** * Unit tests for tree table * @group needsInstalledILIAS * * @author Stefan Meyer <[email protected]> * @version $Id$ * * * @ingroup ServicesTree */ class ilMembershipTest extends PHPUnit_Framework_TestCase { protected $backupGlobals = false; protected function setUp() { include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php"); ilUnitUtil::performInitialisation(); } /** * Waiting list tes * @group IL_Init * @param * @return */ public function testMembership() { include_once './Services/Membership/classes/class.ilWaitingList.php'; include_once './Modules/Course/classes/class.ilCourseWaitingList.php'; $wait = new ilCourseWaitingList(999999); $ret = $wait->addToList(111111); $this->assertEquals($ret, true); $wait->updateSubscriptionTime(111111, time()); $wait->removeFromList(111111); $wait->addToList(111111); $ret = $wait->isOnList(111111); $this->assertEquals($ret, true); $wait->addToList(111111); ilWaitingList::_deleteAll(999999); $wait->addToList(111111); ilWaitingList::_deleteUser(111111); } /** * @group IL_Init * @param * @return */ public function testSubscription() { include_once './Services/Membership/classes/class.ilParticipants.php'; include_once './Modules/Course/classes/class.ilCourseParticipants.php'; $part = ilCourseParticipants::_getInstanceByObjId(999999); $part->addSubscriber(111111); $part->updateSubscriptionTime(111111, time()); $part->updateSubject(111111, 'hallo'); $is = $part->isSubscriber(111111); $this->assertEquals($is, true); $is = ilParticipants::_isSubscriber(999999, 111111); $this->assertEquals($is, true); $part->deleteSubscriber(111111); $is = $part->isSubscriber(111111); $this->assertEquals($is, false); } }
{ "pile_set_name": "Github" }
// // CrissCrossQueryView.m // GGCharts // // Created by _ | Durex on 17/7/6. // Copyright © 2017年 I really is a farmer. All rights reserved. // #import "CrissCrossQueryView.h" #define Lable_Key [NSString stringWithFormat:@"%zd", tag] #pragma mark - 查价框 @interface QueryView () @property (nonatomic, strong) NSMutableDictionary * dicLable; @end @implementation QueryView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { _interval = 3; _textFont = [UIFont systemFontOfSize:9]; _width = 120; } return self; } - (UILabel *)getLableWithTag:(NSInteger)tag { UILabel * lable = [self.dicLable objectForKey:Lable_Key]; if (!lable) { lable = [[UILabel alloc] init]; [self.dicLable setObject:lable forKey:Lable_Key]; } return lable; } - (void)setQueryData:(id<QueryViewAbstract>)queryData { _queryData = queryData; NSDictionary * valueColorDictionary = [queryData queryValueForColor]; NSDictionary * keyColorDictionary = [queryData queryKeyForColor]; NSArray <NSDictionary *> * keyValueArray = queryData.valueForKeyArray; CGFloat height = [@"1" sizeWithAttributes:@{NSFontAttributeName : _textFont}].height; _size = CGSizeMake(_width, height * keyValueArray.count + _interval * (keyValueArray.count + 2)); [keyValueArray enumerateObjectsUsingBlock:^(NSDictionary * obj, NSUInteger idx, BOOL * stop) { NSInteger t_tag = idx * 2; NSInteger v_tag = idx * 2 + 1; UILabel *t_lable = [self getLableWithTag:t_tag]; t_lable.font = _textFont; t_lable.frame = CGRectMake(0, _interval * (idx + 1) + height * idx, _width, height); t_lable.text = [NSString stringWithFormat:@" %@", obj.allKeys.firstObject]; t_lable.textAlignment = NSTextAlignmentLeft; t_lable.textColor = keyColorDictionary[obj.allKeys.firstObject]; [self addSubview:t_lable]; UILabel *v_lable = [self getLableWithTag:v_tag]; v_lable.font = _textFont; v_lable.frame = CGRectMake(0, _interval * (idx + 1) + height * idx, _width - 5, height); v_lable.text = [NSString stringWithFormat:@"%@", obj.allValues.firstObject]; v_lable.textAlignment = NSTextAlignmentRight; v_lable.textColor = valueColorDictionary[obj.allValues.firstObject]; [self addSubview:v_lable]; }]; } GGLazyGetMethod(NSMutableDictionary, dicLable); @end #pragma mark - 查价视图 @interface CrissCrossQueryView () @property (nonatomic, strong) GGStringRenderer * xAxisLable; @property (nonatomic, strong) GGStringRenderer * yAxisLable; @property (nonatomic, strong) GGLineRenderer * xLine; @property (nonatomic, strong) GGLineRenderer * yLine; @property (nonatomic, assign) BOOL isNeedAnimation; @end @implementation CrissCrossQueryView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.userInteractionEnabled = NO; self.layer.masksToBounds = YES; _cirssLayer = [[GGCanvas alloc] init]; _cirssLayer.frame = CGRectMake(0, 0, frame.size.width, frame.size.height); _cirssLayer.isCloseDisableActions = YES; _lineWidth = .5f; _cirssLableColor = [UIColor blackColor]; _cirssLineColor = RGB(125, 125, 125); _cirssLableBackColor = RGB(125, 125, 125); _cirssLableFont = [UIFont systemFontOfSize:8]; _xAxisLable = [[GGStringRenderer alloc] init]; _xAxisLable.font = _cirssLableFont; _xAxisLable.color = _cirssLableColor; _xAxisLable.fillColor = RGB(235, 235, 235); _xAxisLable.offSetRatio = GGRatioBottomCenter; _xAxisLable.edgeInsets = UIEdgeInsetsMake(2, 2, 2, 2); _yAxisLable = [[GGStringRenderer alloc] init]; _yAxisLable.font = _cirssLableFont; _yAxisLable.color = _cirssLableColor; _yAxisLable.fillColor = RGB(235, 235, 235); _yAxisLable.offSetRatio = GGRatioCenterRight; _yAxisLable.edgeInsets = UIEdgeInsetsMake(2, 2, 2, 2); _xLine = [[GGLineRenderer alloc] init]; _xLine.width = _lineWidth; _xLine.color = _cirssLineColor; _yLine = [[GGLineRenderer alloc] init]; _yLine.width = _lineWidth; _yLine.color = _cirssLineColor; [self.layer addSublayer:_cirssLayer]; _queryView = [[QueryView alloc] initWithFrame:CGRectZero]; _queryView.backgroundColor = [UIColor whiteColor]; _queryView.layer.borderColor = _cirssLineColor.CGColor; _queryView.layer.borderWidth = _lineWidth / 2; [self addSubview:_queryView]; [_cirssLayer addRenderer:_xLine]; [_cirssLayer addRenderer:_yLine]; [_cirssLayer addRenderer:_xAxisLable]; [_cirssLayer addRenderer:_yAxisLable]; } return self; } - (void)setHidden:(BOOL)hidden { [super setHidden:hidden]; if (hidden) { [_cirssLayer removeAllRenderer]; [_cirssLayer setNeedsDisplay]; _isNeedAnimation = NO; } else { [_cirssLayer addRenderer:_xLine]; [_cirssLayer addRenderer:_yLine]; [_cirssLayer addRenderer:_xAxisLable]; [_cirssLayer addRenderer:_yAxisLable]; [_cirssLayer setNeedsDisplay]; } } - (void)setFrame:(CGRect)frame { [super setFrame:frame]; _cirssLayer.frame = CGRectMake(0, 0, frame.size.width, frame.size.height); } - (void)setYString:(NSString *)ystring setXString:(NSString *)xString { if (ystring.length) { _yAxisLable.string = ystring; } if (xString.length) { _xAxisLable.string = xString; } } /** 设置中心点 */ - (void)setCenterPoint:(CGPoint)center { _xLine.line = GGLineRectForX(_cirssLayer.frame, center.x); _yLine.line = GGLineRectForY(_cirssLayer.frame, center.y); [_cirssLayer setNeedsDisplay]; _yAxisLable.point = CGPointMake(_yAxisOffsetX, center.y); _xAxisLable.point = CGPointMake(center.x + _lineWidth, _xAxisOffsetY); [self updateQueryLayerWithCenter:center]; } - (void)updateQueryLayerWithCenter:(CGPoint)center { CGRect pushBeforeRect; CGRect pushAfterRect; // _yAxisLable.verticalRange = GGSizeRangeMake(CGRectGetMaxY(self.frame), CGRectGetMinY(self.frame)); _xAxisLable.horizontalRange = GGSizeRangeMake(CGRectGetMaxX(self.frame), CGRectGetMinX(self.frame)); BOOL isLeft = NO; if (center.x < CGRectGetMinX(self.frame) + self.queryView.width) { pushBeforeRect = CGRectMake(CGRectGetMaxX(self.frame), 0, self.queryView.size.width, self.queryView.size.height); pushAfterRect = CGRectMake(CGRectGetMaxX(self.frame) - self.queryView.width, 0, self.queryView.size.width, self.queryView.size.height); } else if (center.x >= CGRectGetMaxX(self.frame) - self.queryView.width) { isLeft = YES; pushBeforeRect = CGRectMake(-self.queryView.size.width, 0, self.queryView.size.width, self.queryView.size.height); pushAfterRect = CGRectMake(0, 0, self.queryView.size.width, self.queryView.size.height); } else { pushAfterRect = self.queryView.frame; pushBeforeRect = self.queryView.frame; // 初始化在左边优先 if (CGRectEqualToRect(pushAfterRect, CGRectZero)) { pushBeforeRect = CGRectMake(-self.queryView.size.width, 0, self.queryView.size.width, self.queryView.size.height); pushAfterRect = CGRectMake(0, 0, self.queryView.size.width, self.queryView.size.height); } } if (CGRectEqualToRect(self.queryView.frame, pushAfterRect)) { return; } self.queryView.frame = pushAfterRect; if (_isNeedAnimation) { @autoreleasepool { CATransition *animation = [CATransition animation]; [animation setDuration:0.35]; animation.type = kCATransitionPush; animation.subtype = isLeft ? kCATransitionFromLeft:kCATransitionFromRight; [self.queryView.layer addAnimation:animation forKey:@"frame"]; } } _isNeedAnimation = YES; } @end
{ "pile_set_name": "Github" }
#!/usr/bin/python # -*- coding: utf-8 -*- import os, sys, json from threading import Thread try: from urllib2 import urlopen from Queue import Queue except ImportError: from urllib.request import urlopen from queue import Queue ''' World road map generation script. It takes city points from omim intermediate data and calculates roads between them. After all, it stores road features OSM way ids into csv text file. ''' road_delta = 200 WORKERS = 16 def get_way_ids(point1, point2, server): url = "http://{0}/wayid?z=18&loc={1},{2}&loc={3},{4}".format(server, point1[0], point1[1], point2[0], point2[1]) request = urlopen(url) data = json.load(request) if "way_ids" in data: return data["way_ids"] return [] def each_to_each(points): result = [] for i in range(len(points)): for j in range(len(points) - i - 1): result.append((points[i], points[j + i + 1])) return result def load_towns(path): result = [] if not os.path.isfile(path): print("WARNING! File with towns not found!") return result with open(path, "r") as f: for line in f: data = line.split(";") isCapital = (data[3][0] == "t") result.append((float(data[0]), float(data[1]), isCapital)) return result def parallel_worker(tasks, capitals_list, towns_list): while True: if not tasks.qsize() % 1000: print(tasks.qsize()) task = tasks.get() ids = get_way_ids(task[0], task[1], sys.argv[2]) for id in ids: if task[0][2] and task[1][2]: capitals_list.add(id) else: towns_list.add(id) tasks.task_done() if len(sys.argv) < 3: print("road_runner.py <intermediate_dir> <osrm_addr>") exit(1) if not os.path.isdir(sys.argv[1]): print("{0} is not a directory!".format(sys.argv[1])) exit(1) towns = load_towns(os.path.join(sys.argv[1], "towns.csv")) print("Have {0} towns".format(len(towns))) tasks = each_to_each(towns) filtered = [] for p1, p2 in tasks: if p1[2] and p2[2]: filtered.append((p1,p2)) elif (p1[0]-p2[0])**2 + (p1[1]-p2[1])**2 < road_delta: filtered.append((p1,p2)) tasks = filtered if not len(tasks): print("Towns not found. No job.") exit(1) try: get_way_ids(tasks[0][0], tasks[0][1], sys.argv[2]) except: print("Can't connect to remote server: {0}".format(sys.argv[2])) exit(1) qtasks = Queue() capitals_list = set() towns_list = set() for i in range(WORKERS): t=Thread(target=parallel_worker, args=(qtasks, capitals_list, towns_list)) t.daemon = True t.start() for task in tasks: qtasks.put(task) qtasks.join() with open(os.path.join(sys.argv[1], "ways.csv"),"w") as f: for way_id in capitals_list: f.write("{0};world_level\n".format(way_id)) for way_id in towns_list: if way_id not in capitals_list: f.write("{0};world_towns_level\n".format(way_id)) print("All done.")
{ "pile_set_name": "Github" }
<?php namespace App\IdeasWorkshop\Handler; use App\IdeasWorkshop\Command\SendMailForExtendedIdeaCommand; use App\Mailer\MailerService; use App\Mailer\Message\IdeaExtendMessage; use Symfony\Component\Messenger\Handler\MessageHandlerInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class SendMailForExtendedIdeaHandler implements MessageHandlerInterface { private $mailer; private $urlGenerator; public function __construct(MailerService $mailer, UrlGeneratorInterface $urlGenerator) { $this->mailer = $mailer; $this->urlGenerator = $urlGenerator; } public function __invoke(SendMailForExtendedIdeaCommand $command): void { $idea = $command->getIdea(); $this->mailer->sendMessage(IdeaExtendMessage::create( $idea->getAuthor(), $this->urlGenerator->generate( 'react_app_ideas_workshop_proposition', ['id' => $idea->getUuidAsString()], UrlGeneratorInterface::ABSOLUTE_URL ) )); } }
{ "pile_set_name": "Github" }
/* * (C) Copyright 2008 * Stefan Roese, DENX Software Engineering, [email protected]. * * See file CREDITS for list of people who contributed to this * project. * * 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 2 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., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ #ifndef _PPC4xx_SDRAM_H_ #define _PPC4xx_SDRAM_H_ #if defined(CONFIG_SDRAM_PPC4xx_IBM_SDRAM) /* * SDRAM Controller */ #ifndef CONFIG_405EP #define SDRAM0_BESR0 0x00 /* bus error syndrome reg a */ #define SDRAM0_BESRS0 0x04 /* bus error syndrome reg set a */ #define SDRAM0_BESR1 0x08 /* bus error syndrome reg b */ #define SDRAM0_BESRS1 0x0c /* bus error syndrome reg set b */ #define SDRAM0_BEAR 0x10 /* bus error address reg */ #endif #define SDRAM0_CFG 0x20 /* memory controller options 1 */ #define SDRAM0_STATUS 0x24 /* memory status */ #define SDRAM0_RTR 0x30 /* refresh timer reg */ #define SDRAM0_PMIT 0x34 /* power management idle timer */ #define SDRAM0_B0CR 0x40 /* memory bank 0 configuration */ #define SDRAM0_B1CR 0x44 /* memory bank 1 configuration */ #ifndef CONFIG_405EP #define SDRAM0_B2CR 0x48 /* memory bank 2 configuration */ #define SDRAM0_B3CR 0x4c /* memory bank 3 configuration */ #endif #define SDRAM0_TR 0x80 /* timing reg 1 */ #ifndef CONFIG_405EP #define SDRAM0_ECCCFG 0x94 /* ECC configuration */ #define SDRAM0_ECCESR 0x98 /* ECC error status */ #endif #endif /* CONFIG_SDRAM_PPC4xx_IBM_SDRAM */ #if defined(CONFIG_SDRAM_PPC4xx_IBM_DDR) /* * Memory controller registers */ #define SDRAM_CFG0 0x20 /* memory controller options 0 */ #define SDRAM_CFG1 0x21 /* memory controller options 1 */ #define SDRAM0_BESR0 0x0000 /* bus error status reg 0 */ #define SDRAM0_BESR1 0x0008 /* bus error status reg 1 */ #define SDRAM0_BEAR 0x0010 /* bus error address reg */ #define SDRAM0_SLIO 0x0018 /* ddr sdram slave interface options */ #define SDRAM0_CFG0 0x0020 /* ddr sdram options 0 */ #define SDRAM0_CFG1 0x0021 /* ddr sdram options 1 */ #define SDRAM0_DEVOPT 0x0022 /* ddr sdram device options */ #define SDRAM0_MCSTS 0x0024 /* memory controller status */ #define SDRAM0_RTR 0x0030 /* refresh timer register */ #define SDRAM0_PMIT 0x0034 /* power management idle timer */ #define SDRAM0_UABBA 0x0038 /* plb UABus base address */ #define SDRAM0_B0CR 0x0040 /* ddr sdram bank 0 configuration */ #define SDRAM0_B1CR 0x0044 /* ddr sdram bank 1 configuration */ #define SDRAM0_B2CR 0x0048 /* ddr sdram bank 2 configuration */ #define SDRAM0_B3CR 0x004c /* ddr sdram bank 3 configuration */ #define SDRAM0_TR0 0x0080 /* sdram timing register 0 */ #define SDRAM0_TR1 0x0081 /* sdram timing register 1 */ #define SDRAM0_CLKTR 0x0082 /* ddr clock timing register */ #define SDRAM0_WDDCTR 0x0083 /* write data/dm/dqs clock timing reg */ #define SDRAM0_DLYCAL 0x0084 /* delay line calibration register */ #define SDRAM0_ECCESR 0x0098 /* ECC error status */ /* * Memory Controller Options 0 */ #define SDRAM_CFG0_DCEN 0x80000000 /* SDRAM Controller Enable */ #define SDRAM_CFG0_MCHK_MASK 0x30000000 /* Memory data errchecking mask */ #define SDRAM_CFG0_MCHK_NON 0x00000000 /* No ECC generation */ #define SDRAM_CFG0_MCHK_GEN 0x20000000 /* ECC generation */ #define SDRAM_CFG0_MCHK_CHK 0x30000000 /* ECC generation and checking */ #define SDRAM_CFG0_RDEN 0x08000000 /* Registered DIMM enable */ #define SDRAM_CFG0_PMUD 0x04000000 /* Page management unit */ #define SDRAM_CFG0_DMWD_MASK 0x02000000 /* DRAM width mask */ #define SDRAM_CFG0_DMWD_32 0x00000000 /* 32 bits */ #define SDRAM_CFG0_DMWD_64 0x02000000 /* 64 bits */ #define SDRAM_CFG0_UIOS_MASK 0x00C00000 /* Unused IO State */ #define SDRAM_CFG0_PDP 0x00200000 /* Page deallocation policy */ /* * Memory Controller Options 1 */ #define SDRAM_CFG1_SRE 0x80000000 /* Self-Refresh Entry */ #define SDRAM_CFG1_PMEN 0x40000000 /* Power Management Enable */ /* * SDRAM DEVPOT Options */ #define SDRAM_DEVOPT_DLL 0x80000000 #define SDRAM_DEVOPT_DS 0x40000000 /* * SDRAM MCSTS Options */ #define SDRAM_MCSTS_MRSC 0x80000000 #define SDRAM_MCSTS_SRMS 0x40000000 #define SDRAM_MCSTS_CIS 0x20000000 #define SDRAM_MCSTS_IDLE_NOT 0x00000000 /* Mem contr not idle */ /* * SDRAM Refresh Timer Register */ #define SDRAM_RTR_RINT_MASK 0xFFFF0000 #define SDRAM_RTR_RINT_ENCODE(n) (((n) << 16) & SDRAM_RTR_RINT_MASK) /* * SDRAM UABus Base Address Reg */ #define SDRAM_UABBA_UBBA_MASK 0x0000000F /* * Memory Bank 0-7 configuration */ #define SDRAM_BXCR_SDBA_MASK 0xff800000 /* Base address */ #define SDRAM_BXCR_SDSZ_MASK 0x000e0000 /* Size */ #define SDRAM_BXCR_SDSZ_8 0x00020000 /* 8M */ #define SDRAM_BXCR_SDSZ_16 0x00040000 /* 16M */ #define SDRAM_BXCR_SDSZ_32 0x00060000 /* 32M */ #define SDRAM_BXCR_SDSZ_64 0x00080000 /* 64M */ #define SDRAM_BXCR_SDSZ_128 0x000a0000 /* 128M */ #define SDRAM_BXCR_SDSZ_256 0x000c0000 /* 256M */ #define SDRAM_BXCR_SDSZ_512 0x000e0000 /* 512M */ #define SDRAM_BXCR_SDAM_MASK 0x0000e000 /* Addressing mode */ #define SDRAM_BXCR_SDAM_1 0x00000000 /* Mode 1 */ #define SDRAM_BXCR_SDAM_2 0x00002000 /* Mode 2 */ #define SDRAM_BXCR_SDAM_3 0x00004000 /* Mode 3 */ #define SDRAM_BXCR_SDAM_4 0x00006000 /* Mode 4 */ #define SDRAM_BXCR_SDBE 0x00000001 /* Memory Bank Enable */ /* * SDRAM TR0 Options */ #define SDRAM_TR0_SDWR_MASK 0x80000000 #define SDRAM_TR0_SDWR_2_CLK 0x00000000 #define SDRAM_TR0_SDWR_3_CLK 0x80000000 #define SDRAM_TR0_SDWD_MASK 0x40000000 #define SDRAM_TR0_SDWD_0_CLK 0x00000000 #define SDRAM_TR0_SDWD_1_CLK 0x40000000 #define SDRAM_TR0_SDCL_MASK 0x01800000 #define SDRAM_TR0_SDCL_2_0_CLK 0x00800000 #define SDRAM_TR0_SDCL_2_5_CLK 0x01000000 #define SDRAM_TR0_SDCL_3_0_CLK 0x01800000 #define SDRAM_TR0_SDPA_MASK 0x000C0000 #define SDRAM_TR0_SDPA_2_CLK 0x00040000 #define SDRAM_TR0_SDPA_3_CLK 0x00080000 #define SDRAM_TR0_SDPA_4_CLK 0x000C0000 #define SDRAM_TR0_SDCP_MASK 0x00030000 #define SDRAM_TR0_SDCP_2_CLK 0x00000000 #define SDRAM_TR0_SDCP_3_CLK 0x00010000 #define SDRAM_TR0_SDCP_4_CLK 0x00020000 #define SDRAM_TR0_SDCP_5_CLK 0x00030000 #define SDRAM_TR0_SDLD_MASK 0x0000C000 #define SDRAM_TR0_SDLD_1_CLK 0x00000000 #define SDRAM_TR0_SDLD_2_CLK 0x00004000 #define SDRAM_TR0_SDRA_MASK 0x0000001C #define SDRAM_TR0_SDRA_6_CLK 0x00000000 #define SDRAM_TR0_SDRA_7_CLK 0x00000004 #define SDRAM_TR0_SDRA_8_CLK 0x00000008 #define SDRAM_TR0_SDRA_9_CLK 0x0000000C #define SDRAM_TR0_SDRA_10_CLK 0x00000010 #define SDRAM_TR0_SDRA_11_CLK 0x00000014 #define SDRAM_TR0_SDRA_12_CLK 0x00000018 #define SDRAM_TR0_SDRA_13_CLK 0x0000001C #define SDRAM_TR0_SDRD_MASK 0x00000003 #define SDRAM_TR0_SDRD_2_CLK 0x00000001 #define SDRAM_TR0_SDRD_3_CLK 0x00000002 #define SDRAM_TR0_SDRD_4_CLK 0x00000003 /* * SDRAM TR1 Options */ #define SDRAM_TR1_RDSS_MASK 0xC0000000 #define SDRAM_TR1_RDSS_TR0 0x00000000 #define SDRAM_TR1_RDSS_TR1 0x40000000 #define SDRAM_TR1_RDSS_TR2 0x80000000 #define SDRAM_TR1_RDSS_TR3 0xC0000000 #define SDRAM_TR1_RDSL_MASK 0x00C00000 #define SDRAM_TR1_RDSL_STAGE1 0x00000000 #define SDRAM_TR1_RDSL_STAGE2 0x00400000 #define SDRAM_TR1_RDSL_STAGE3 0x00800000 #define SDRAM_TR1_RDCD_MASK 0x00000800 #define SDRAM_TR1_RDCD_RCD_0_0 0x00000000 #define SDRAM_TR1_RDCD_RCD_1_2 0x00000800 #define SDRAM_TR1_RDCT_MASK 0x000001FF #define SDRAM_TR1_RDCT_ENCODE(x) (((x) << 0) & SDRAM_TR1_RDCT_MASK) #define SDRAM_TR1_RDCT_DECODE(x) (((x) & SDRAM_TR1_RDCT_MASK) >> 0) #define SDRAM_TR1_RDCT_MIN 0x00000000 #define SDRAM_TR1_RDCT_MAX 0x000001FF /* * SDRAM WDDCTR Options */ #define SDRAM_WDDCTR_WRCP_MASK 0xC0000000 #define SDRAM_WDDCTR_WRCP_0DEG 0x00000000 #define SDRAM_WDDCTR_WRCP_90DEG 0x40000000 #define SDRAM_WDDCTR_WRCP_180DEG 0x80000000 #define SDRAM_WDDCTR_DCD_MASK 0x000001FF /* * SDRAM CLKTR Options */ #define SDRAM_CLKTR_CLKP_MASK 0xC0000000 #define SDRAM_CLKTR_CLKP_0DEG 0x00000000 #define SDRAM_CLKTR_CLKP_90DEG 0x40000000 #define SDRAM_CLKTR_CLKP_180DEG 0x80000000 #define SDRAM_CLKTR_DCDT_MASK 0x000001FF /* * SDRAM DLYCAL Options */ #define SDRAM_DLYCAL_DLCV_MASK 0x000003FC #define SDRAM_DLYCAL_DLCV_ENCODE(x) (((x)<<2) & SDRAM_DLYCAL_DLCV_MASK) #define SDRAM_DLYCAL_DLCV_DECODE(x) (((x) & SDRAM_DLYCAL_DLCV_MASK)>>2) #endif /* CONFIG_SDRAM_PPC4xx_IBM_DDR */ #if defined(CONFIG_SDRAM_PPC4xx_IBM_DDR2) #define SDRAM_DLYCAL_DLCV_MASK 0x000003FC #define SDRAM_DLYCAL_DLCV_ENCODE(x) (((x)<<2) & SDRAM_DLYCAL_DLCV_MASK) #define SDRAM_DLYCAL_DLCV_DECODE(x) (((x) & SDRAM_DLYCAL_DLCV_MASK)>>2) #if !defined(CONFIG_405EX) /* * Memory queue defines */ #define SDRAMQ_DCR_BASE 0x040 #define SDRAM_R0BAS (SDRAMQ_DCR_BASE+0x0) /* rank 0 base address & size */ #define SDRAM_R1BAS (SDRAMQ_DCR_BASE+0x1) /* rank 1 base address & size */ #define SDRAM_R2BAS (SDRAMQ_DCR_BASE+0x2) /* rank 2 base address & size */ #define SDRAM_R3BAS (SDRAMQ_DCR_BASE+0x3) /* rank 3 base address & size */ #define SDRAM_CONF1HB (SDRAMQ_DCR_BASE+0x5) /* configuration 1 HB */ #define SDRAM_CONF1HB_AAFR 0x80000000 /* Address Ack on First Request - Bit 0 */ #define SDRAM_CONF1HB_PRPD 0x00080000 /* PLB Read pipeline Disable - Bit 12 */ #define SDRAM_CONF1HB_PWPD 0x00040000 /* PLB Write pipeline Disable - Bit 13 */ #define SDRAM_CONF1HB_PRW 0x00020000 /* PLB Read Wait - Bit 14 */ #define SDRAM_CONF1HB_RPLM 0x00001000 /* Read Passing Limit 1 - Bits 16..19 */ #define SDRAM_CONF1HB_RPEN 0x00000800 /* Read Passing Enable - Bit 20 */ #define SDRAM_CONF1HB_RFTE 0x00000400 /* Read Flow Through Enable - Bit 21 */ #define SDRAM_CONF1HB_WRCL 0x00000080 /* MCIF Cycle Limit 1 - Bits 22..24 */ #define SDRAM_CONF1HB_MASK 0x0000F380 /* RPLM & WRCL mask */ #define SDRAM_ERRSTATHB (SDRAMQ_DCR_BASE+0x7) /* error status HB */ #define SDRAM_ERRADDUHB (SDRAMQ_DCR_BASE+0x8) /* error address upper 32 HB */ #define SDRAM_ERRADDLHB (SDRAMQ_DCR_BASE+0x9) /* error address lower 32 HB */ #define SDRAM_PLBADDULL (SDRAMQ_DCR_BASE+0xA) /* PLB base address upper 32 LL */ #define SDRAM_CONF1LL (SDRAMQ_DCR_BASE+0xB) /* configuration 1 LL */ #define SDRAM_CONF1LL_AAFR 0x80000000 /* Address Ack on First Request - Bit 0 */ #define SDRAM_CONF1LL_PRPD 0x00080000 /* PLB Read pipeline Disable - Bit 12 */ #define SDRAM_CONF1LL_PWPD 0x00040000 /* PLB Write pipeline Disable - Bit 13 */ #define SDRAM_CONF1LL_PRW 0x00020000 /* PLB Read Wait - Bit 14 */ #define SDRAM_CONF1LL_RPLM 0x00001000 /* Read Passing Limit 1 - Bits 16..19 */ #define SDRAM_CONF1LL_RPEN 0x00000800 /* Read Passing Enable - Bit 20 */ #define SDRAM_CONF1LL_RFTE 0x00000400 /* Read Flow Through Enable - Bit 21 */ #define SDRAM_CONF1LL_MASK 0x0000F000 /* RPLM mask */ #define SDRAM_ERRSTATLL (SDRAMQ_DCR_BASE+0xC) /* error status LL */ #define SDRAM_ERRADDULL (SDRAMQ_DCR_BASE+0xD) /* error address upper 32 LL */ #define SDRAM_ERRADDLLL (SDRAMQ_DCR_BASE+0xE) /* error address lower 32 LL */ #define SDRAM_CONFPATHB (SDRAMQ_DCR_BASE+0xF) /* configuration between paths */ #define SDRAM_CONFPATHB_TPEN 0x08000000 /* Transaction Passing Enable - Bit 4 */ #define SDRAM_PLBADDUHB (SDRAMQ_DCR_BASE+0x10) /* PLB base address upper 32 LL */ /* * Memory Bank 0-7 configuration */ #if defined(CONFIG_440SPE) || \ defined(CONFIG_460EX) || defined(CONFIG_460GT) || \ defined(CONFIG_460SX) || defined(CONFIG_APM821XX) #define SDRAM_RXBAS_SDBA_MASK 0xFFE00000 /* Base address */ #define SDRAM_RXBAS_SDBA_ENCODE(n) ((u32)(((phys_size_t)(n) >> 2) & 0xFFE00000)) #define SDRAM_RXBAS_SDBA_DECODE(n) ((((phys_size_t)(n)) & 0xFFE00000) << 2) #endif /* CONFIG_440SPE */ #if defined(CONFIG_440SP) #define SDRAM_RXBAS_SDBA_MASK 0xFF800000 /* Base address */ #define SDRAM_RXBAS_SDBA_ENCODE(n) ((((u32)(n))&0xFF800000)) #define SDRAM_RXBAS_SDBA_DECODE(n) ((((u32)(n))&0xFF800000)) #endif /* CONFIG_440SP */ #define SDRAM_RXBAS_SDSZ_MASK 0x0000FFC0 /* Size */ #define SDRAM_RXBAS_SDSZ_ENCODE(n) ((((u32)(n))&0x3FF)<<6) #define SDRAM_RXBAS_SDSZ_DECODE(n) ((((u32)(n))>>6)&0x3FF) #define SDRAM_RXBAS_SDSZ_0 0x00000000 /* 0M */ #define SDRAM_RXBAS_SDSZ_8 0x0000FFC0 /* 8M */ #define SDRAM_RXBAS_SDSZ_16 0x0000FF80 /* 16M */ #define SDRAM_RXBAS_SDSZ_32 0x0000FF00 /* 32M */ #define SDRAM_RXBAS_SDSZ_64 0x0000FE00 /* 64M */ #define SDRAM_RXBAS_SDSZ_128 0x0000FC00 /* 128M */ #define SDRAM_RXBAS_SDSZ_256 0x0000F800 /* 256M */ #define SDRAM_RXBAS_SDSZ_512 0x0000F000 /* 512M */ #define SDRAM_RXBAS_SDSZ_1024 0x0000E000 /* 1024M */ #define SDRAM_RXBAS_SDSZ_2048 0x0000C000 /* 2048M */ #define SDRAM_RXBAS_SDSZ_4096 0x00008000 /* 4096M */ #else /* CONFIG_405EX */ /* * XXX - ToDo: * Revisit this file to check if all these 405EX defines are correct and * can be used in the common 44x_spd_ddr2 code as well. sr, 2008-06-02 */ #define SDRAM_RXBAS_SDSZ_MASK PPC_REG_VAL(19, 0xF) #define SDRAM_RXBAS_SDSZ_4MB PPC_REG_VAL(19, 0x0) #define SDRAM_RXBAS_SDSZ_8MB PPC_REG_VAL(19, 0x1) #define SDRAM_RXBAS_SDSZ_16MB PPC_REG_VAL(19, 0x2) #define SDRAM_RXBAS_SDSZ_32MB PPC_REG_VAL(19, 0x3) #define SDRAM_RXBAS_SDSZ_64MB PPC_REG_VAL(19, 0x4) #define SDRAM_RXBAS_SDSZ_128MB PPC_REG_VAL(19, 0x5) #define SDRAM_RXBAS_SDSZ_256MB PPC_REG_VAL(19, 0x6) #define SDRAM_RXBAS_SDSZ_512MB PPC_REG_VAL(19, 0x7) #define SDRAM_RXBAS_SDSZ_1024MB PPC_REG_VAL(19, 0x8) #define SDRAM_RXBAS_SDSZ_2048MB PPC_REG_VAL(19, 0x9) #define SDRAM_RXBAS_SDSZ_4096MB PPC_REG_VAL(19, 0xA) #define SDRAM_RXBAS_SDSZ_8192MB PPC_REG_VAL(19, 0xB) #define SDRAM_RXBAS_SDSZ_8 SDRAM_RXBAS_SDSZ_8MB #define SDRAM_RXBAS_SDSZ_16 SDRAM_RXBAS_SDSZ_16MB #define SDRAM_RXBAS_SDSZ_32 SDRAM_RXBAS_SDSZ_32MB #define SDRAM_RXBAS_SDSZ_64 SDRAM_RXBAS_SDSZ_64MB #define SDRAM_RXBAS_SDSZ_128 SDRAM_RXBAS_SDSZ_128MB #define SDRAM_RXBAS_SDSZ_256 SDRAM_RXBAS_SDSZ_256MB #define SDRAM_RXBAS_SDSZ_512 SDRAM_RXBAS_SDSZ_512MB #define SDRAM_RXBAS_SDSZ_1024 SDRAM_RXBAS_SDSZ_1024MB #define SDRAM_RXBAS_SDSZ_2048 SDRAM_RXBAS_SDSZ_2048MB #define SDRAM_RXBAS_SDSZ_4096 SDRAM_RXBAS_SDSZ_4096MB #define SDRAM_RXBAS_SDSZ_8192 SDRAM_RXBAS_SDSZ_8192MB #endif /* CONFIG_405EX */ /* The mode definitions are the same for all PPC4xx variants */ #define SDRAM_RXBAS_SDAM_MODE0 PPC_REG_VAL(23, 0x0) #define SDRAM_RXBAS_SDAM_MODE1 PPC_REG_VAL(23, 0x1) #define SDRAM_RXBAS_SDAM_MODE2 PPC_REG_VAL(23, 0x2) #define SDRAM_RXBAS_SDAM_MODE3 PPC_REG_VAL(23, 0x3) #define SDRAM_RXBAS_SDAM_MODE4 PPC_REG_VAL(23, 0x4) #define SDRAM_RXBAS_SDAM_MODE5 PPC_REG_VAL(23, 0x5) #define SDRAM_RXBAS_SDAM_MODE6 PPC_REG_VAL(23, 0x6) #define SDRAM_RXBAS_SDAM_MODE7 PPC_REG_VAL(23, 0x7) #define SDRAM_RXBAS_SDAM_MODE8 PPC_REG_VAL(23, 0x8) #define SDRAM_RXBAS_SDAM_MODE9 PPC_REG_VAL(23, 0x9) #define SDRAM_RXBAS_SDBE_DISABLE PPC_REG_VAL(31, 0x0) #define SDRAM_RXBAS_SDBE_ENABLE PPC_REG_VAL(31, 0x1) /* * Memory controller registers */ #if defined(CONFIG_405EX) || defined(CONFIG_APM821XX) #define SDRAM_BESR 0x00 /* PLB bus error status (read/clear) */ #define SDRAM_BESRT 0x01 /* PLB bus error status (test/set) */ #define SDRAM_BEARL 0x02 /* PLB bus error address low */ #define SDRAM_BEARH 0x03 /* PLB bus error address high */ #define SDRAM_WMIRQ 0x06 /* PLB write master interrupt (read/clear) */ #define SDRAM_WMIRQT 0x07 /* PLB write master interrupt (test/set) */ #define SDRAM_PLBOPT 0x08 /* PLB slave options */ #define SDRAM_PUABA 0x09 /* PLB upper address base */ #define SDRAM_MCSTAT 0x1F /* memory controller status */ #else /* CONFIG_405EX || CONFIG_APM821XX */ #define SDRAM_MCSTAT 0x14 /* memory controller status */ #endif /* CONFIG_405EX || CONFIG_APM821XX */ #define SDRAM_MCOPT1 0x20 /* memory controller options 1 */ #define SDRAM_MCOPT2 0x21 /* memory controller options 2 */ #define SDRAM_MODT0 0x22 /* on die termination for bank 0 */ #define SDRAM_MODT1 0x23 /* on die termination for bank 1 */ #define SDRAM_MODT2 0x24 /* on die termination for bank 2 */ #define SDRAM_MODT3 0x25 /* on die termination for bank 3 */ #define SDRAM_CODT 0x26 /* on die termination for controller */ #define SDRAM_VVPR 0x27 /* variable VRef programmming */ #define SDRAM_OPARS 0x28 /* on chip driver control setup */ #define SDRAM_OPART 0x29 /* on chip driver control trigger */ #define SDRAM_RTR 0x30 /* refresh timer */ #define SDRAM_PMIT 0x34 /* power management idle timer */ #define SDRAM_MB0CF 0x40 /* memory bank 0 configuration */ #define SDRAM_MB1CF 0x44 /* memory bank 1 configuration */ #define SDRAM_MB2CF 0x48 #define SDRAM_MB3CF 0x4C #define SDRAM_INITPLR0 0x50 /* manual initialization control */ #define SDRAM_INITPLR1 0x51 /* manual initialization control */ #define SDRAM_INITPLR2 0x52 /* manual initialization control */ #define SDRAM_INITPLR3 0x53 /* manual initialization control */ #define SDRAM_INITPLR4 0x54 /* manual initialization control */ #define SDRAM_INITPLR5 0x55 /* manual initialization control */ #define SDRAM_INITPLR6 0x56 /* manual initialization control */ #define SDRAM_INITPLR7 0x57 /* manual initialization control */ #define SDRAM_INITPLR8 0x58 /* manual initialization control */ #define SDRAM_INITPLR9 0x59 /* manual initialization control */ #define SDRAM_INITPLR10 0x5a /* manual initialization control */ #define SDRAM_INITPLR11 0x5b /* manual initialization control */ #define SDRAM_INITPLR12 0x5c /* manual initialization control */ #define SDRAM_INITPLR13 0x5d /* manual initialization control */ #define SDRAM_INITPLR14 0x5e /* manual initialization control */ #define SDRAM_INITPLR15 0x5f /* manual initialization control */ #define SDRAM_RQDC 0x70 /* read DQS delay control */ #define SDRAM_RFDC 0x74 /* read feedback delay control */ #define SDRAM_RDCC 0x78 /* read data capture control */ #define SDRAM_DLCR 0x7A /* delay line calibration */ #define SDRAM_CLKTR 0x80 /* DDR clock timing */ #define SDRAM_WRDTR 0x81 /* write data, DQS, DM clock, timing */ #define SDRAM_SDTR1 0x85 /* DDR SDRAM timing 1 */ #define SDRAM_SDTR2 0x86 /* DDR SDRAM timing 2 */ #define SDRAM_SDTR3 0x87 /* DDR SDRAM timing 3 */ #define SDRAM_MMODE 0x88 /* memory mode */ #define SDRAM_MEMODE 0x89 /* memory extended mode */ #define SDRAM_ECCES 0x98 /* ECC error status */ #define SDRAM_CID 0xA4 /* core ID */ #if !defined(CONFIG_405EX) && !defined(CONFIG_APM821XX) #define SDRAM_RID 0xA8 /* revision ID */ #endif #define SDRAM_FCSR 0xB0 /* feedback calibration status */ #define SDRAM_RTSR 0xB1 /* run time status tracking */ #if defined(CONFIG_405EX) || defined(CONFIG_APM821XX) #define SDRAM_RID 0xF8 /* revision ID */ #endif /* * Memory Controller Bus Error Status */ #define SDRAM_BESR_MASK PPC_REG_VAL(7, 0xFF) #define SDRAM_BESR_M0ID_MASK PPC_REG_VAL(3, 0xF) #define SDRAM_BESR_M0ID_ICU PPC_REG_VAL(3, 0x0) #define SDRAM_BESR_M0ID_PCIE0 PPC_REG_VAL(3, 0x1) #define SDRAM_BESR_M0ID_PCIE1 PPC_REG_VAL(3, 0x2) #define SDRAM_BESR_M0ID_DMA PPC_REG_VAL(3, 0x3) #define SDRAM_BESR_M0ID_DCU PPC_REG_VAL(3, 0x4) #define SDRAM_BESR_M0ID_OPB PPC_REG_VAL(3, 0x5) #define SDRAM_BESR_M0ID_MAL PPC_REG_VAL(3, 0x6) #define SDRAM_BESR_M0ID_SEC PPC_REG_VAL(3, 0x7) #define SDRAM_BESR_M0ET_MASK PPC_REG_VAL(6, 0x7) #define SDRAM_BESR_M0ET_NONE PPC_REG_VAL(6, 0x0) #define SDRAM_BESR_M0ET_ECC PPC_REG_VAL(6, 0x1) #define SDRAM_BESR_M0RW_WRITE PPC_REG_VAL(7, 0) #define SDRAM_BESR_M0RW_READ PPC_REG_VAL(8, 1) /* * Memory Controller Status */ #define SDRAM_MCSTAT_MIC_MASK 0x80000000 /* Memory init status mask */ #define SDRAM_MCSTAT_MIC_NOTCOMP 0x00000000 /* Mem init not complete */ #define SDRAM_MCSTAT_MIC_COMP 0x80000000 /* Mem init complete */ #define SDRAM_MCSTAT_SRMS_MASK 0x40000000 /* Mem self refresh stat mask */ #define SDRAM_MCSTAT_SRMS_NOT_SF 0x00000000 /* Mem not in self refresh */ #define SDRAM_MCSTAT_SRMS_SF 0x40000000 /* Mem in self refresh */ #define SDRAM_MCSTAT_IDLE_MASK 0x20000000 /* Mem self refresh stat mask */ #define SDRAM_MCSTAT_IDLE_NOT 0x00000000 /* Mem contr not idle */ #define SDRAM_MCSTAT_IDLE 0x20000000 /* Mem contr idle */ /* * Memory Controller Options 1 */ #define SDRAM_MCOPT1_MCHK_MASK 0x30000000 /* Memory data err check mask*/ #define SDRAM_MCOPT1_MCHK_NON 0x00000000 /* No ECC generation */ #define SDRAM_MCOPT1_MCHK_GEN 0x20000000 /* ECC generation */ #define SDRAM_MCOPT1_MCHK_CHK 0x10000000 /* ECC generation and check */ #define SDRAM_MCOPT1_MCHK_CHK_REP 0x30000000 /* ECC generation, chk, report*/ #define SDRAM_MCOPT1_MCHK_CHK_DECODE(n) ((((u32)(n))>>28)&0x3) #define SDRAM_MCOPT1_RDEN_MASK 0x08000000 /* Registered DIMM mask */ #define SDRAM_MCOPT1_RDEN 0x08000000 /* Registered DIMM enable */ #define SDRAM_MCOPT1_PMU_MASK 0x06000000 /* Page management unit mask */ #define SDRAM_MCOPT1_PMU_CLOSE 0x00000000 /* PMU Close */ #define SDRAM_MCOPT1_PMU_OPEN 0x04000000 /* PMU Open */ #define SDRAM_MCOPT1_PMU_AUTOCLOSE 0x02000000 /* PMU AutoClose */ #define SDRAM_MCOPT1_DMWD_MASK 0x01000000 /* DRAM width mask */ #define SDRAM_MCOPT1_DMWD_32 0x00000000 /* 32 bits */ #define SDRAM_MCOPT1_DMWD_64 0x01000000 /* 64 bits */ #define SDRAM_MCOPT1_UIOS_MASK 0x00C00000 /* Unused IO State */ #define SDRAM_MCOPT1_BCNT_MASK 0x00200000 /* Bank count */ #define SDRAM_MCOPT1_4_BANKS 0x00000000 /* 4 Banks */ #define SDRAM_MCOPT1_8_BANKS 0x00200000 /* 8 Banks */ #define SDRAM_MCOPT1_DDR_TYPE_MASK 0x00100000 /* DDR Memory Type mask */ #define SDRAM_MCOPT1_DDR1_TYPE 0x00000000 /* DDR1 Memory Type */ #define SDRAM_MCOPT1_DDR2_TYPE 0x00100000 /* DDR2 Memory Type */ #define SDRAM_MCOPT1_QDEP 0x00020000 /* 4 commands deep */ #define SDRAM_MCOPT1_RWOO_MASK 0x00008000 /* Out of Order Read mask */ #define SDRAM_MCOPT1_RWOO_DISABLED 0x00000000 /* disabled */ #define SDRAM_MCOPT1_RWOO_ENABLED 0x00008000 /* enabled */ #define SDRAM_MCOPT1_WOOO_MASK 0x00004000 /* Out of Order Write mask */ #define SDRAM_MCOPT1_WOOO_DISABLED 0x00000000 /* disabled */ #define SDRAM_MCOPT1_WOOO_ENABLED 0x00004000 /* enabled */ #define SDRAM_MCOPT1_DCOO_MASK 0x00002000 /* All Out of Order mask */ #define SDRAM_MCOPT1_DCOO_DISABLED 0x00002000 /* disabled */ #define SDRAM_MCOPT1_DCOO_ENABLED 0x00000000 /* enabled */ #define SDRAM_MCOPT1_DREF_MASK 0x00001000 /* Deferred refresh mask */ #define SDRAM_MCOPT1_DREF_NORMAL 0x00000000 /* normal refresh */ #define SDRAM_MCOPT1_DREF_DEFER_4 0x00001000 /* defer up to 4 refresh cmd */ /* * Memory Controller Options 2 */ #define SDRAM_MCOPT2_SREN_MASK 0x80000000 /* Self Test mask */ #define SDRAM_MCOPT2_SREN_EXIT 0x00000000 /* Self Test exit */ #define SDRAM_MCOPT2_SREN_ENTER 0x80000000 /* Self Test enter */ #define SDRAM_MCOPT2_PMEN_MASK 0x40000000 /* Power Management mask */ #define SDRAM_MCOPT2_PMEN_DISABLE 0x00000000 /* disable */ #define SDRAM_MCOPT2_PMEN_ENABLE 0x40000000 /* enable */ #define SDRAM_MCOPT2_IPTR_MASK 0x20000000 /* Init Trigger Reg mask */ #define SDRAM_MCOPT2_IPTR_IDLE 0x00000000 /* idle */ #define SDRAM_MCOPT2_IPTR_EXECUTE 0x20000000 /* execute preloaded init */ #define SDRAM_MCOPT2_XSRP_MASK 0x10000000 /* Exit Self Refresh Prevent */ #define SDRAM_MCOPT2_XSRP_ALLOW 0x00000000 /* allow self refresh exit */ #define SDRAM_MCOPT2_XSRP_PREVENT 0x10000000 /* prevent self refresh exit */ #define SDRAM_MCOPT2_DCEN_MASK 0x08000000 /* SDRAM Controller Enable */ #define SDRAM_MCOPT2_DCEN_DISABLE 0x00000000 /* SDRAM Controller Enable */ #define SDRAM_MCOPT2_DCEN_ENABLE 0x08000000 /* SDRAM Controller Enable */ #define SDRAM_MCOPT2_ISIE_MASK 0x04000000 /* Init Seq Interruptable mas*/ #define SDRAM_MCOPT2_ISIE_DISABLE 0x00000000 /* disable */ #define SDRAM_MCOPT2_ISIE_ENABLE 0x04000000 /* enable */ /* * SDRAM Refresh Timer Register */ #define SDRAM_RTR_RINT_MASK 0xFFF80000 #define SDRAM_RTR_RINT_ENCODE(n) ((((u32)(n))&0xFFF8)<<16) #define SDRAM_RTR_RINT_DECODE(n) ((((u32)(n))>>16)&0xFFF8) /* * SDRAM Read DQS Delay Control Register */ #define SDRAM_RQDC_RQDE_MASK 0x80000000 #define SDRAM_RQDC_RQDE_DISABLE 0x00000000 #define SDRAM_RQDC_RQDE_ENABLE 0x80000000 #define SDRAM_RQDC_RQFD_MASK 0x000001FF #define SDRAM_RQDC_RQFD_ENCODE(n) ((((u32)(n))&0x1FF)<<0) #define SDRAM_RQDC_RQFD_MAX 0x1FF /* * SDRAM Read Data Capture Control Register */ #define SDRAM_RDCC_RDSS_MASK 0xC0000000 #define SDRAM_RDCC_RDSS_T1 0x00000000 #define SDRAM_RDCC_RDSS_T2 0x40000000 #define SDRAM_RDCC_RDSS_T3 0x80000000 #define SDRAM_RDCC_RDSS_T4 0xC0000000 #define SDRAM_RDCC_RSAE_MASK 0x00000001 #define SDRAM_RDCC_RSAE_DISABLE 0x00000001 #define SDRAM_RDCC_RSAE_ENABLE 0x00000000 #define SDRAM_RDCC_RDSS_ENCODE(n) ((((u32)(n))&0x03)<<30) #define SDRAM_RDCC_RDSS_DECODE(n) ((((u32)(n))>>30)&0x03) /* * SDRAM Read Feedback Delay Control Register */ #define SDRAM_RFDC_ARSE_MASK 0x80000000 #define SDRAM_RFDC_ARSE_DISABLE 0x80000000 #define SDRAM_RFDC_ARSE_ENABLE 0x00000000 #define SDRAM_RFDC_RFOS_MASK 0x007F0000 #define SDRAM_RFDC_RFOS_ENCODE(n) ((((u32)(n))&0x7F)<<16) #define SDRAM_RFDC_RFFD_MASK 0x000007FF #define SDRAM_RFDC_RFFD_ENCODE(n) ((((u32)(n))&0x7FF)<<0) #define SDRAM_RFDC_RFFD_MAX 0x7FF /* * SDRAM Delay Line Calibration Register */ #define SDRAM_DLCR_DCLM_MASK 0x80000000 #define SDRAM_DLCR_DCLM_MANUAL 0x80000000 #define SDRAM_DLCR_DCLM_AUTO 0x00000000 #define SDRAM_DLCR_DLCR_MASK 0x08000000 #define SDRAM_DLCR_DLCR_CALIBRATE 0x08000000 #define SDRAM_DLCR_DLCR_IDLE 0x00000000 #define SDRAM_DLCR_DLCS_MASK 0x07000000 #define SDRAM_DLCR_DLCS_NOT_RUN 0x00000000 #define SDRAM_DLCR_DLCS_IN_PROGRESS 0x01000000 #define SDRAM_DLCR_DLCS_COMPLETE 0x02000000 #define SDRAM_DLCR_DLCS_CONT_DONE 0x03000000 #define SDRAM_DLCR_DLCS_ERROR 0x04000000 #define SDRAM_DLCR_DLCV_MASK 0x000001FF #define SDRAM_DLCR_DLCV_ENCODE(n) ((((u32)(n))&0x1FF)<<0) #define SDRAM_DLCR_DLCV_DECODE(n) ((((u32)(n))>>0)&0x1FF) /* * SDRAM Memory On Die Terimination Control Register */ #define SDRAM_MODT_ODTON_DISABLE PPC_REG_VAL(0, 0) #define SDRAM_MODT_ODTON_ENABLE PPC_REG_VAL(0, 1) #define SDRAM_MODT_EB1W_DISABLE PPC_REG_VAL(1, 0) #define SDRAM_MODT_EB1W_ENABLE PPC_REG_VAL(1, 1) #define SDRAM_MODT_EB1R_DISABLE PPC_REG_VAL(2, 0) #define SDRAM_MODT_EB1R_ENABLE PPC_REG_VAL(2, 1) #define SDRAM_MODT_EB0W_DISABLE PPC_REG_VAL(7, 0) #define SDRAM_MODT_EB0W_ENABLE PPC_REG_VAL(7, 1) #define SDRAM_MODT_EB0R_DISABLE PPC_REG_VAL(8, 0) #define SDRAM_MODT_EB0R_ENABLE PPC_REG_VAL(8, 1) /* * SDRAM Controller On Die Termination Register */ #define SDRAM_CODT_ODT_ON PPC_REG_VAL(0, 1) #define SDRAM_CODT_ODT_OFF PPC_REG_VAL(0, 0) #define SDRAM_CODT_RK1W_ON PPC_REG_VAL(1, 1) #define SDRAM_CODT_RK1W_OFF PPC_REG_VAL(1, 0) #define SDRAM_CODT_RK1R_ON PPC_REG_VAL(2, 1) #define SDRAM_CODT_RK1R_OFF PPC_REG_VAL(2, 0) #define SDRAM_CODT_RK0W_ON PPC_REG_VAL(7, 1) #define SDRAM_CODT_RK0W_OFF PPC_REG_VAL(7, 0) #define SDRAM_CODT_RK0R_ON PPC_REG_VAL(8, 1) #define SDRAM_CODT_RK0R_OFF PPC_REG_VAL(8, 0) #define SDRAM_CODT_ODTSH_NORMAL PPC_REG_VAL(10, 0) #define SDRAM_CODT_ODTSH_REMOVE_ONE_AT_END PPC_REG_VAL(10, 1) #define SDRAM_CODT_ODTSH_ADD_ONE_AT_START PPC_REG_VAL(10, 2) #define SDRAM_CODT_ODTSH_SHIFT_ONE_EARLIER PPC_REG_VAL(10, 3) #define SDRAM_CODT_CODTZ_75OHM PPC_REG_VAL(11, 0) #define SDRAM_CODT_CKEG_ON PPC_REG_VAL(12, 1) #define SDRAM_CODT_CKEG_OFF PPC_REG_VAL(12, 0) #define SDRAM_CODT_CTLG_ON PPC_REG_VAL(13, 1) #define SDRAM_CODT_CTLG_OFF PPC_REG_VAL(13, 0) #define SDRAM_CODT_FBDG_ON PPC_REG_VAL(14, 1) #define SDRAM_CODT_FBDG_OFF PPC_REG_VAL(14, 0) #define SDRAM_CODT_FBRG_ON PPC_REG_VAL(15, 1) #define SDRAM_CODT_FBRG_OFF PPC_REG_VAL(15, 0) #define SDRAM_CODT_CKLZ_36OHM PPC_REG_VAL(18, 1) #define SDRAM_CODT_CKLZ_18OHM PPC_REG_VAL(18, 0) #define SDRAM_CODT_DQS_VOLTAGE_DDR_MASK PPC_REG_VAL(26, 1) #define SDRAM_CODT_DQS_2_5_V_DDR1 PPC_REG_VAL(26, 0) #define SDRAM_CODT_DQS_1_8_V_DDR2 PPC_REG_VAL(26, 1) #define SDRAM_CODT_DQS_MASK PPC_REG_VAL(27, 1) #define SDRAM_CODT_DQS_DIFFERENTIAL PPC_REG_VAL(27, 0) #define SDRAM_CODT_DQS_SINGLE_END PPC_REG_VAL(27, 1) #define SDRAM_CODT_CKSE_DIFFERENTIAL PPC_REG_VAL(28, 0) #define SDRAM_CODT_CKSE_SINGLE_END PPC_REG_VAL(28, 1) #define SDRAM_CODT_FEEBBACK_RCV_SINGLE_END PPC_REG_VAL(29, 1) #define SDRAM_CODT_FEEBBACK_DRV_SINGLE_END PPC_REG_VAL(30, 1) #define SDRAM_CODT_IO_HIZ PPC_REG_VAL(31, 0) #define SDRAM_CODT_IO_NMODE PPC_REG_VAL(31, 1) /* * SDRAM Initialization Preload Register */ #define SDRAM_INITPLR_ENABLE PPC_REG_VAL(0, 1) #define SDRAM_INITPLR_DISABLE PPC_REG_VAL(0, 0) #define SDRAM_INITPLR_IMWT_MASK PPC_REG_VAL(8, 0xFF) #define SDRAM_INITPLR_IMWT_ENCODE(n) PPC_REG_VAL(8, \ (static_cast(u32, \ n)) \ & 0xFF) #define SDRAM_INITPLR_ICMD_MASK PPC_REG_VAL(12, 0x7) #define SDRAM_INITPLR_ICMD_ENCODE(n) PPC_REG_VAL(12, \ (static_cast(u32, \ n)) \ & 0x7) #define SDRAM_INITPLR_IBA_MASK PPC_REG_VAL(15, 0x7) #define SDRAM_INITPLR_IBA_ENCODE(n) PPC_REG_VAL(15, \ (static_cast(u32, \ n)) \ & 0x7) #define SDRAM_INITPLR_IMA_MASK PPC_REG_VAL(31, 0x7FFF) #define SDRAM_INITPLR_IMA_ENCODE(n) PPC_REG_VAL(31, \ (static_cast(u32, \ n)) \ & 0x7FFF) /* * JEDEC DDR Initialization Commands */ #define JEDEC_CMD_NOP 7 #define JEDEC_CMD_PRECHARGE 2 #define JEDEC_CMD_REFRESH 1 #define JEDEC_CMD_EMR 0 #define JEDEC_CMD_READ 5 #define JEDEC_CMD_WRITE 4 /* * JEDEC Precharge Command Memory Address Arguments */ #define JEDEC_MA_PRECHARGE_ONE (0 << 10) #define JEDEC_MA_PRECHARGE_ALL (1 << 10) /* * JEDEC DDR EMR Command Bank Address Arguments */ #define JEDEC_BA_MR 0 #define JEDEC_BA_EMR 1 #define JEDEC_BA_EMR2 2 #define JEDEC_BA_EMR3 3 /* * JEDEC DDR Mode Register */ #define JEDEC_MA_MR_PDMODE_FAST_EXIT (0 << 12) #define JEDEC_MA_MR_PDMODE_SLOW_EXIT (1 << 12) #define JEDEC_MA_MR_WR_MASK (0x7 << 9) #define JEDEC_MA_MR_WR_DDR1 (0x0 << 9) #define JEDEC_MA_MR_WR_DDR2_2_CYC (0x1 << 9) #define JEDEC_MA_MR_WR_DDR2_3_CYC (0x2 << 9) #define JEDEC_MA_MR_WR_DDR2_4_CYC (0x3 << 9) #define JEDEC_MA_MR_WR_DDR2_5_CYC (0x4 << 9) #define JEDEC_MA_MR_WR_DDR2_6_CYC (0x5 << 9) #define JEDEC_MA_MR_DLL_RESET (1 << 8) #define JEDEC_MA_MR_MODE_NORMAL (0 << 8) #define JEDEC_MA_MR_MODE_TEST (1 << 8) #define JEDEC_MA_MR_CL_MASK (0x7 << 4) #define JEDEC_MA_MR_CL_DDR1_2_0_CLK (0x2 << 4) #define JEDEC_MA_MR_CL_DDR1_2_5_CLK (0x6 << 4) #define JEDEC_MA_MR_CL_DDR1_3_0_CLK (0x3 << 4) #define JEDEC_MA_MR_CL_DDR2_2_0_CLK (0x2 << 4) #define JEDEC_MA_MR_CL_DDR2_3_0_CLK (0x3 << 4) #define JEDEC_MA_MR_CL_DDR2_4_0_CLK (0x4 << 4) #define JEDEC_MA_MR_CL_DDR2_5_0_CLK (0x5 << 4) #define JEDEC_MA_MR_CL_DDR2_6_0_CLK (0x6 << 4) #define JEDEC_MA_MR_CL_DDR2_7_0_CLK (0x7 << 4) #define JEDEC_MA_MR_BTYP_SEQUENTIAL (0 << 3) #define JEDEC_MA_MR_BTYP_INTERLEAVED (1 << 3) #define JEDEC_MA_MR_BLEN_MASK (0x7 << 0) #define JEDEC_MA_MR_BLEN_4 (2 << 0) #define JEDEC_MA_MR_BLEN_8 (3 << 0) /* * JEDEC DDR Extended Mode Register */ #define JEDEC_MA_EMR_OUTPUT_MASK (1 << 12) #define JEDEC_MA_EMR_OUTPUT_ENABLE (0 << 12) #define JEDEC_MA_EMR_OUTPUT_DISABLE (1 << 12) #define JEDEC_MA_EMR_RQDS_MASK (1 << 11) #define JEDEC_MA_EMR_RDQS_DISABLE (0 << 11) #define JEDEC_MA_EMR_RDQS_ENABLE (1 << 11) #define JEDEC_MA_EMR_DQS_MASK (1 << 10) #define JEDEC_MA_EMR_DQS_DISABLE (1 << 10) #define JEDEC_MA_EMR_DQS_ENABLE (0 << 10) #define JEDEC_MA_EMR_OCD_MASK (0x7 << 7) #define JEDEC_MA_EMR_OCD_EXIT (0 << 7) #define JEDEC_MA_EMR_OCD_ENTER (7 << 7) #define JEDEC_MA_EMR_AL_DDR1_0_CYC (0 << 3) #define JEDEC_MA_EMR_AL_DDR2_1_CYC (1 << 3) #define JEDEC_MA_EMR_AL_DDR2_2_CYC (2 << 3) #define JEDEC_MA_EMR_AL_DDR2_3_CYC (3 << 3) #define JEDEC_MA_EMR_AL_DDR2_4_CYC (4 << 3) #define JEDEC_MA_EMR_RTT_MASK (0x11 << 2) #define JEDEC_MA_EMR_RTT_DISABLED (0x00 << 2) #define JEDEC_MA_EMR_RTT_75OHM (0x01 << 2) #define JEDEC_MA_EMR_RTT_150OHM (0x10 << 2) #define JEDEC_MA_EMR_RTT_50OHM (0x11 << 2) #define JEDEC_MA_EMR_ODS_MASK (1 << 1) #define JEDEC_MA_EMR_ODS_NORMAL (0 << 1) #define JEDEC_MA_EMR_ODS_WEAK (1 << 1) #define JEDEC_MA_EMR_DLL_MASK (1 << 0) #define JEDEC_MA_EMR_DLL_ENABLE (0 << 0) #define JEDEC_MA_EMR_DLL_DISABLE (1 << 0) /* * JEDEC DDR Extended Mode Register 2 */ #define JEDEC_MA_EMR2_TEMP_COMMERCIAL (0 << 7) #define JEDEC_MA_EMR2_TEMP_INDUSTRIAL (1 << 7) /* * SDRAM Mode Register (Corresponds 1:1 w/ JEDEC Mode Register) */ #define SDRAM_MMODE_WR_MASK JEDEC_MA_MR_WR_MASK #define SDRAM_MMODE_WR_DDR1 JEDEC_MA_MR_WR_DDR1 #define SDRAM_MMODE_WR_DDR2_2_CYC JEDEC_MA_MR_WR_DDR2_2_CYC #define SDRAM_MMODE_WR_DDR2_3_CYC JEDEC_MA_MR_WR_DDR2_3_CYC #define SDRAM_MMODE_WR_DDR2_4_CYC JEDEC_MA_MR_WR_DDR2_4_CYC #define SDRAM_MMODE_WR_DDR2_5_CYC JEDEC_MA_MR_WR_DDR2_5_CYC #define SDRAM_MMODE_WR_DDR2_6_CYC JEDEC_MA_MR_WR_DDR2_6_CYC #define SDRAM_MMODE_DCL_MASK JEDEC_MA_MR_CL_MASK #define SDRAM_MMODE_DCL_DDR1_2_0_CLK JEDEC_MA_MR_CL_DDR1_2_0_CLK #define SDRAM_MMODE_DCL_DDR1_2_5_CLK JEDEC_MA_MR_CL_DDR1_2_5_CLK #define SDRAM_MMODE_DCL_DDR1_3_0_CLK JEDEC_MA_MR_CL_DDR1_3_0_CLK #define SDRAM_MMODE_DCL_DDR2_2_0_CLK JEDEC_MA_MR_CL_DDR2_2_0_CLK #define SDRAM_MMODE_DCL_DDR2_3_0_CLK JEDEC_MA_MR_CL_DDR2_3_0_CLK #define SDRAM_MMODE_DCL_DDR2_4_0_CLK JEDEC_MA_MR_CL_DDR2_4_0_CLK #define SDRAM_MMODE_DCL_DDR2_5_0_CLK JEDEC_MA_MR_CL_DDR2_5_0_CLK #define SDRAM_MMODE_DCL_DDR2_6_0_CLK JEDEC_MA_MR_CL_DDR2_6_0_CLK #define SDRAM_MMODE_DCL_DDR2_7_0_CLK JEDEC_MA_MR_CL_DDR2_7_0_CLK #define SDRAM_MMODE_BTYP_SEQUENTIAL JEDEC_MA_MR_BTYP_SEQUENTIAL #define SDRAM_MMODE_BTYP_INTERLEAVED JEDEC_MA_MR_BTYP_INTERLEAVED #define SDRAM_MMODE_BLEN_MASK JEDEC_MA_MR_BLEN_MASK #define SDRAM_MMODE_BLEN_4 JEDEC_MA_MR_BLEN_4 #define SDRAM_MMODE_BLEN_8 JEDEC_MA_MR_BLEN_8 /* * SDRAM Extended Mode Register (Corresponds 1:1 w/ JEDEC Extended * Mode Register) */ #define SDRAM_MEMODE_QOFF_MASK JEDEC_MA_EMR_OUTPUT_MASK #define SDRAM_MEMODE_QOFF_DISABLE JEDEC_MA_EMR_OUTPUT_DISABLE #define SDRAM_MEMODE_QOFF_ENABLE JEDEC_MA_EMR_OUTPUT_ENABLE #define SDRAM_MEMODE_RDQS_MASK JEDEC_MA_EMR_RQDS_MASK #define SDRAM_MEMODE_RDQS_DISABLE JEDEC_MA_EMR_RDQS_DISABLE #define SDRAM_MEMODE_RDQS_ENABLE JEDEC_MA_EMR_RDQS_ENABLE #define SDRAM_MEMODE_DQS_MASK JEDEC_MA_EMR_DQS_MASK #define SDRAM_MEMODE_DQS_DISABLE JEDEC_MA_EMR_DQS_DISABLE #define SDRAM_MEMODE_DQS_ENABLE JEDEC_MA_EMR_DQS_ENABLE #define SDRAM_MEMODE_AL_DDR1_0_CYC JEDEC_MA_EMR_AL_DDR1_0_CYC #define SDRAM_MEMODE_AL_DDR2_1_CYC JEDEC_MA_EMR_AL_DDR2_1_CYC #define SDRAM_MEMODE_AL_DDR2_2_CYC JEDEC_MA_EMR_AL_DDR2_2_CYC #define SDRAM_MEMODE_AL_DDR2_3_CYC JEDEC_MA_EMR_AL_DDR2_3_CYC #define SDRAM_MEMODE_AL_DDR2_4_CYC JEDEC_MA_EMR_AL_DDR2_4_CYC #define SDRAM_MEMODE_RTT_MASK JEDEC_MA_EMR_RTT_MASK #define SDRAM_MEMODE_RTT_DISABLED JEDEC_MA_EMR_RTT_DISABLED #define SDRAM_MEMODE_RTT_75OHM JEDEC_MA_EMR_RTT_75OHM #define SDRAM_MEMODE_RTT_150OHM JEDEC_MA_EMR_RTT_150OHM #define SDRAM_MEMODE_RTT_50OHM JEDEC_MA_EMR_RTT_50OHM #define SDRAM_MEMODE_DIC_MASK JEDEC_MA_EMR_ODS_MASK #define SDRAM_MEMODE_DIC_NORMAL JEDEC_MA_EMR_ODS_NORMAL #define SDRAM_MEMODE_DIC_WEAK JEDEC_MA_EMR_ODS_WEAK #define SDRAM_MEMODE_DLL_MASK JEDEC_MA_EMR_DLL_MASK #define SDRAM_MEMODE_DLL_DISABLE JEDEC_MA_EMR_DLL_DISABLE #define SDRAM_MEMODE_DLL_ENABLE JEDEC_MA_EMR_DLL_ENABLE /* * SDRAM Clock Timing Register */ #define SDRAM_CLKTR_CLKP_MASK 0xC0000000 #define SDRAM_CLKTR_CLKP_0_DEG 0x00000000 #define SDRAM_CLKTR_CLKP_180_DEG_ADV 0x80000000 #define SDRAM_CLKTR_CLKP_90_DEG_ADV 0x40000000 #define SDRAM_CLKTR_CLKP_270_DEG_ADV 0xC0000000 /* * SDRAM Write Timing Register */ #define SDRAM_WRDTR_LLWP_MASK 0x10000000 #define SDRAM_WRDTR_LLWP_DIS 0x10000000 #define SDRAM_WRDTR_LLWP_1_CYC 0x00000000 #define SDRAM_WRDTR_WTR_MASK 0x0E000000 #define SDRAM_WRDTR_WTR_0_DEG 0x06000000 #define SDRAM_WRDTR_WTR_90_DEG_ADV 0x04000000 #define SDRAM_WRDTR_WTR_180_DEG_ADV 0x02000000 #define SDRAM_WRDTR_WTR_270_DEG_ADV 0x00000000 /* * SDRAM SDTR1 Options */ #define SDRAM_SDTR1_LDOF_MASK 0x80000000 #define SDRAM_SDTR1_LDOF_1_CLK 0x00000000 #define SDRAM_SDTR1_LDOF_2_CLK 0x80000000 #define SDRAM_SDTR1_RTW_MASK 0x00F00000 #define SDRAM_SDTR1_RTW_2_CLK 0x00200000 #define SDRAM_SDTR1_RTW_3_CLK 0x00300000 #define SDRAM_SDTR1_WTWO_MASK 0x000F0000 #define SDRAM_SDTR1_WTWO_0_CLK 0x00000000 #define SDRAM_SDTR1_WTWO_1_CLK 0x00010000 #define SDRAM_SDTR1_RTRO_MASK 0x0000F000 #define SDRAM_SDTR1_RTRO_1_CLK 0x00001000 #define SDRAM_SDTR1_RTRO_2_CLK 0x00002000 /* * SDRAM SDTR2 Options */ #define SDRAM_SDTR2_RCD_MASK 0xF0000000 #define SDRAM_SDTR2_RCD_1_CLK 0x10000000 #define SDRAM_SDTR2_RCD_2_CLK 0x20000000 #define SDRAM_SDTR2_RCD_3_CLK 0x30000000 #define SDRAM_SDTR2_RCD_4_CLK 0x40000000 #define SDRAM_SDTR2_RCD_5_CLK 0x50000000 #define SDRAM_SDTR2_WTR_MASK 0x0F000000 #define SDRAM_SDTR2_WTR_1_CLK 0x01000000 #define SDRAM_SDTR2_WTR_2_CLK 0x02000000 #define SDRAM_SDTR2_WTR_3_CLK 0x03000000 #define SDRAM_SDTR2_WTR_4_CLK 0x04000000 #define SDRAM_SDTR3_WTR_ENCODE(n) ((((u32)(n))&0xF)<<24) #define SDRAM_SDTR2_XSNR_MASK 0x00FF0000 #define SDRAM_SDTR2_XSNR_8_CLK 0x00080000 #define SDRAM_SDTR2_XSNR_16_CLK 0x00100000 #define SDRAM_SDTR2_XSNR_32_CLK 0x00200000 #define SDRAM_SDTR2_XSNR_64_CLK 0x00400000 #define SDRAM_SDTR2_WPC_MASK 0x0000F000 #define SDRAM_SDTR2_WPC_2_CLK 0x00002000 #define SDRAM_SDTR2_WPC_3_CLK 0x00003000 #define SDRAM_SDTR2_WPC_4_CLK 0x00004000 #define SDRAM_SDTR2_WPC_5_CLK 0x00005000 #define SDRAM_SDTR2_WPC_6_CLK 0x00006000 #define SDRAM_SDTR3_WPC_ENCODE(n) ((((u32)(n))&0xF)<<12) #define SDRAM_SDTR2_RPC_MASK 0x00000F00 #define SDRAM_SDTR2_RPC_2_CLK 0x00000200 #define SDRAM_SDTR2_RPC_3_CLK 0x00000300 #define SDRAM_SDTR2_RPC_4_CLK 0x00000400 #define SDRAM_SDTR2_RP_MASK 0x000000F0 #define SDRAM_SDTR2_RP_3_CLK 0x00000030 #define SDRAM_SDTR2_RP_4_CLK 0x00000040 #define SDRAM_SDTR2_RP_5_CLK 0x00000050 #define SDRAM_SDTR2_RP_6_CLK 0x00000060 #define SDRAM_SDTR2_RP_7_CLK 0x00000070 #define SDRAM_SDTR2_RRD_MASK 0x0000000F #define SDRAM_SDTR2_RRD_2_CLK 0x00000002 #define SDRAM_SDTR2_RRD_3_CLK 0x00000003 /* * SDRAM SDTR3 Options */ #define SDRAM_SDTR3_RAS_MASK 0x1F000000 #define SDRAM_SDTR3_RAS_ENCODE(n) ((((u32)(n))&0x1F)<<24) #define SDRAM_SDTR3_RC_MASK 0x001F0000 #define SDRAM_SDTR3_RC_ENCODE(n) ((((u32)(n))&0x1F)<<16) #define SDRAM_SDTR3_XCS_MASK 0x00001F00 #define SDRAM_SDTR3_XCS 0x00000D00 #define SDRAM_SDTR3_RFC_MASK 0x0000003F #define SDRAM_SDTR3_RFC_ENCODE(n) ((((u32)(n))&0x3F)<<0) /* * ECC Error Status */ #define SDRAM_ECCES_MASK PPC_REG_VAL(21, 0x3FFFFF) #define SDRAM_ECCES_BNCE_MASK PPC_REG_VAL(15, 0xFFFF) #define SDRAM_ECCES_BNCE_ENCODE(lane) PPC_REG_VAL(((lane) & 0xF), 1) #define SDRAM_ECCES_CKBER_MASK PPC_REG_VAL(17, 0x3) #define SDRAM_ECCES_CKBER_NONE PPC_REG_VAL(17, 0) #define SDRAM_ECCES_CKBER_16_ECC_0_3 PPC_REG_VAL(17, 2) #define SDRAM_ECCES_CKBER_32_ECC_0_3 PPC_REG_VAL(17, 1) #define SDRAM_ECCES_CKBER_32_ECC_4_8 PPC_REG_VAL(17, 2) #define SDRAM_ECCES_CKBER_32_ECC_0_8 PPC_REG_VAL(17, 3) #define SDRAM_ECCES_CE PPC_REG_VAL(18, 1) #define SDRAM_ECCES_UE PPC_REG_VAL(19, 1) #define SDRAM_ECCES_BKNER_MASK PPC_REG_VAL(21, 0x3) #define SDRAM_ECCES_BK0ER PPC_REG_VAL(20, 1) #define SDRAM_ECCES_BK1ER PPC_REG_VAL(21, 1) /* * Memory Bank 0-1 configuration */ #define SDRAM_BXCF_M_AM_MASK 0x00000F00 /* Addressing mode */ #define SDRAM_BXCF_M_AM_0 0x00000000 /* Mode 0 */ #define SDRAM_BXCF_M_AM_1 0x00000100 /* Mode 1 */ #define SDRAM_BXCF_M_AM_2 0x00000200 /* Mode 2 */ #define SDRAM_BXCF_M_AM_3 0x00000300 /* Mode 3 */ #define SDRAM_BXCF_M_AM_4 0x00000400 /* Mode 4 */ #define SDRAM_BXCF_M_AM_5 0x00000500 /* Mode 5 */ #define SDRAM_BXCF_M_AM_6 0x00000600 /* Mode 6 */ #define SDRAM_BXCF_M_AM_7 0x00000700 /* Mode 7 */ #define SDRAM_BXCF_M_AM_8 0x00000800 /* Mode 8 */ #define SDRAM_BXCF_M_AM_9 0x00000900 /* Mode 9 */ #define SDRAM_BXCF_M_BE_MASK 0x00000001 /* Memory Bank Enable */ #define SDRAM_BXCF_M_BE_DISABLE 0x00000000 /* Memory Bank Enable */ #define SDRAM_BXCF_M_BE_ENABLE 0x00000001 /* Memory Bank Enable */ #define SDRAM_RTSR_TRK1SM_MASK 0xC0000000 /* Tracking State Mach 1*/ #define SDRAM_RTSR_TRK1SM_ATBASE 0x00000000 /* atbase state */ #define SDRAM_RTSR_TRK1SM_MISSED 0x40000000 /* missed state */ #define SDRAM_RTSR_TRK1SM_ATPLS1 0x80000000 /* atpls1 state */ #define SDRAM_RTSR_TRK1SM_RESET 0xC0000000 /* reset state */ #endif /* CONFIG_SDRAM_PPC4xx_IBM_DDR2 */ #if defined(CONFIG_SDRAM_PPC4xx_DENALI_DDR2) /* * SDRAM Controller */ #define DDR0_00 0x00 #define DDR0_00_INT_ACK_MASK 0x7F000000 /* Write only */ #define DDR0_00_INT_ACK_ALL 0x7F000000 #define DDR0_00_INT_ACK_ENCODE(n) ((((u32)(n))&0x7F)<<24) #define DDR0_00_INT_ACK_DECODE(n) ((((u32)(n))>>24)&0x7F) /* Status */ #define DDR0_00_INT_STATUS_MASK 0x00FF0000 /* Read only */ /* Bit0. A single access outside the defined PHYSICAL memory space detected. */ #define DDR0_00_INT_STATUS_BIT0 0x00010000 /* Bit1. Multiple accesses outside the defined PHYSICAL memory space detected. */ #define DDR0_00_INT_STATUS_BIT1 0x00020000 /* Bit2. Single correctable ECC event detected */ #define DDR0_00_INT_STATUS_BIT2 0x00040000 /* Bit3. Multiple correctable ECC events detected. */ #define DDR0_00_INT_STATUS_BIT3 0x00080000 /* Bit4. Single uncorrectable ECC event detected. */ #define DDR0_00_INT_STATUS_BIT4 0x00100000 /* Bit5. Multiple uncorrectable ECC events detected. */ #define DDR0_00_INT_STATUS_BIT5 0x00200000 /* Bit6. DRAM initialization complete. */ #define DDR0_00_INT_STATUS_BIT6 0x00400000 /* Bit7. Logical OR of all lower bits. */ #define DDR0_00_INT_STATUS_BIT7 0x00800000 #define DDR0_00_INT_STATUS_ENCODE(n) ((((u32)(n))&0xFF)<<16) #define DDR0_00_INT_STATUS_DECODE(n) ((((u32)(n))>>16)&0xFF) #define DDR0_00_DLL_INCREMENT_MASK 0x00007F00 #define DDR0_00_DLL_INCREMENT_ENCODE(n) ((((u32)(n))&0x7F)<<8) #define DDR0_00_DLL_INCREMENT_DECODE(n) ((((u32)(n))>>8)&0x7F) #define DDR0_00_DLL_START_POINT_MASK 0x0000007F #define DDR0_00_DLL_START_POINT_ENCODE(n) ((((u32)(n))&0x7F)<<0) #define DDR0_00_DLL_START_POINT_DECODE(n) ((((u32)(n))>>0)&0x7F) #define DDR0_01 0x01 #define DDR0_01_PLB0_DB_CS_LOWER_MASK 0x1F000000 #define DDR0_01_PLB0_DB_CS_LOWER_ENCODE(n) ((((u32)(n))&0x1F)<<24) #define DDR0_01_PLB0_DB_CS_LOWER_DECODE(n) ((((u32)(n))>>24)&0x1F) #define DDR0_01_PLB0_DB_CS_UPPER_MASK 0x001F0000 #define DDR0_01_PLB0_DB_CS_UPPER_ENCODE(n) ((((u32)(n))&0x1F)<<16) #define DDR0_01_PLB0_DB_CS_UPPER_DECODE(n) ((((u32)(n))>>16)&0x1F) #define DDR0_01_OUT_OF_RANGE_TYPE_MASK 0x00000700 /* Read only */ #define DDR0_01_OUT_OF_RANGE_TYPE_ENCODE(n) ((((u32)(n))&0x7)<<8) #define DDR0_01_OUT_OF_RANGE_TYPE_DECODE(n) ((((u32)(n))>>8)&0x7) #define DDR0_01_INT_MASK_MASK 0x000000FF #define DDR0_01_INT_MASK_ENCODE(n) ((((u32)(n))&0xFF)<<0) #define DDR0_01_INT_MASK_DECODE(n) ((((u32)(n))>>0)&0xFF) #define DDR0_01_INT_MASK_ALL_ON 0x000000FF #define DDR0_01_INT_MASK_ALL_OFF 0x00000000 #define DDR0_02 0x02 #define DDR0_02_MAX_CS_REG_MASK 0x02000000 /* Read only */ #define DDR0_02_MAX_CS_REG_ENCODE(n) ((((u32)(n))&0x2)<<24) #define DDR0_02_MAX_CS_REG_DECODE(n) ((((u32)(n))>>24)&0x2) #define DDR0_02_MAX_COL_REG_MASK 0x000F0000 /* Read only */ #define DDR0_02_MAX_COL_REG_ENCODE(n) ((((u32)(n))&0xF)<<16) #define DDR0_02_MAX_COL_REG_DECODE(n) ((((u32)(n))>>16)&0xF) #define DDR0_02_MAX_ROW_REG_MASK 0x00000F00 /* Read only */ #define DDR0_02_MAX_ROW_REG_ENCODE(n) ((((u32)(n))&0xF)<<8) #define DDR0_02_MAX_ROW_REG_DECODE(n) ((((u32)(n))>>8)&0xF) #define DDR0_02_START_MASK 0x00000001 #define DDR0_02_START_ENCODE(n) ((((u32)(n))&0x1)<<0) #define DDR0_02_START_DECODE(n) ((((u32)(n))>>0)&0x1) #define DDR0_02_START_OFF 0x00000000 #define DDR0_02_START_ON 0x00000001 #define DDR0_03 0x03 #define DDR0_03_BSTLEN_MASK 0x07000000 #define DDR0_03_BSTLEN_ENCODE(n) ((((u32)(n))&0x7)<<24) #define DDR0_03_BSTLEN_DECODE(n) ((((u32)(n))>>24)&0x7) #define DDR0_03_CASLAT_MASK 0x00070000 #define DDR0_03_CASLAT_ENCODE(n) ((((u32)(n))&0x7)<<16) #define DDR0_03_CASLAT_DECODE(n) ((((u32)(n))>>16)&0x7) #define DDR0_03_CASLAT_LIN_MASK 0x00000F00 #define DDR0_03_CASLAT_LIN_ENCODE(n) ((((u32)(n))&0xF)<<8) #define DDR0_03_CASLAT_LIN_DECODE(n) ((((u32)(n))>>8)&0xF) #define DDR0_03_INITAREF_MASK 0x0000000F #define DDR0_03_INITAREF_ENCODE(n) ((((u32)(n))&0xF)<<0) #define DDR0_03_INITAREF_DECODE(n) ((((u32)(n))>>0)&0xF) #define DDR0_04 0x04 #define DDR0_04_TRC_MASK 0x1F000000 #define DDR0_04_TRC_ENCODE(n) ((((u32)(n))&0x1F)<<24) #define DDR0_04_TRC_DECODE(n) ((((u32)(n))>>24)&0x1F) #define DDR0_04_TRRD_MASK 0x00070000 #define DDR0_04_TRRD_ENCODE(n) ((((u32)(n))&0x7)<<16) #define DDR0_04_TRRD_DECODE(n) ((((u32)(n))>>16)&0x7) #define DDR0_04_TRTP_MASK 0x00000700 #define DDR0_04_TRTP_ENCODE(n) ((((u32)(n))&0x7)<<8) #define DDR0_04_TRTP_DECODE(n) ((((u32)(n))>>8)&0x7) #define DDR0_05 0x05 #define DDR0_05_TMRD_MASK 0x1F000000 #define DDR0_05_TMRD_ENCODE(n) ((((u32)(n))&0x1F)<<24) #define DDR0_05_TMRD_DECODE(n) ((((u32)(n))>>24)&0x1F) #define DDR0_05_TEMRS_MASK 0x00070000 #define DDR0_05_TEMRS_ENCODE(n) ((((u32)(n))&0x7)<<16) #define DDR0_05_TEMRS_DECODE(n) ((((u32)(n))>>16)&0x7) #define DDR0_05_TRP_MASK 0x00000F00 #define DDR0_05_TRP_ENCODE(n) ((((u32)(n))&0xF)<<8) #define DDR0_05_TRP_DECODE(n) ((((u32)(n))>>8)&0xF) #define DDR0_05_TRAS_MIN_MASK 0x000000FF #define DDR0_05_TRAS_MIN_ENCODE(n) ((((u32)(n))&0xFF)<<0) #define DDR0_05_TRAS_MIN_DECODE(n) ((((u32)(n))>>0)&0xFF) #define DDR0_06 0x06 #define DDR0_06_WRITEINTERP_MASK 0x01000000 #define DDR0_06_WRITEINTERP_ENCODE(n) ((((u32)(n))&0x1)<<24) #define DDR0_06_WRITEINTERP_DECODE(n) ((((u32)(n))>>24)&0x1) #define DDR0_06_TWTR_MASK 0x00070000 #define DDR0_06_TWTR_ENCODE(n) ((((u32)(n))&0x7)<<16) #define DDR0_06_TWTR_DECODE(n) ((((u32)(n))>>16)&0x7) #define DDR0_06_TDLL_MASK 0x0000FF00 #define DDR0_06_TDLL_ENCODE(n) ((((u32)(n))&0xFF)<<8) #define DDR0_06_TDLL_DECODE(n) ((((u32)(n))>>8)&0xFF) #define DDR0_06_TRFC_MASK 0x0000007F #define DDR0_06_TRFC_ENCODE(n) ((((u32)(n))&0x7F)<<0) #define DDR0_06_TRFC_DECODE(n) ((((u32)(n))>>0)&0x7F) #define DDR0_07 0x07 #define DDR0_07_NO_CMD_INIT_MASK 0x01000000 #define DDR0_07_NO_CMD_INIT_ENCODE(n) ((((u32)(n))&0x1)<<24) #define DDR0_07_NO_CMD_INIT_DECODE(n) ((((u32)(n))>>24)&0x1) #define DDR0_07_TFAW_MASK 0x001F0000 #define DDR0_07_TFAW_ENCODE(n) ((((u32)(n))&0x1F)<<16) #define DDR0_07_TFAW_DECODE(n) ((((u32)(n))>>16)&0x1F) #define DDR0_07_AUTO_REFRESH_MODE_MASK 0x00000100 #define DDR0_07_AUTO_REFRESH_MODE_ENCODE(n) ((((u32)(n))&0x1)<<8) #define DDR0_07_AUTO_REFRESH_MODE_DECODE(n) ((((u32)(n))>>8)&0x1) #define DDR0_07_AREFRESH_MASK 0x00000001 #define DDR0_07_AREFRESH_ENCODE(n) ((((u32)(n))&0x1)<<0) #define DDR0_07_AREFRESH_DECODE(n) ((((u32)(n))>>0)&0x1) #define DDR0_08 0x08 #define DDR0_08_WRLAT_MASK 0x07000000 #define DDR0_08_WRLAT_ENCODE(n) ((((u32)(n))&0x7)<<24) #define DDR0_08_WRLAT_DECODE(n) ((((u32)(n))>>24)&0x7) #define DDR0_08_TCPD_MASK 0x00FF0000 #define DDR0_08_TCPD_ENCODE(n) ((((u32)(n))&0xFF)<<16) #define DDR0_08_TCPD_DECODE(n) ((((u32)(n))>>16)&0xFF) #define DDR0_08_DQS_N_EN_MASK 0x00000100 #define DDR0_08_DQS_N_EN_ENCODE(n) ((((u32)(n))&0x1)<<8) #define DDR0_08_DQS_N_EN_DECODE(n) ((((u32)(n))>>8)&0x1) #define DDR0_08_DDRII_SDRAM_MODE_MASK 0x00000001 #define DDR0_08_DDRII_ENCODE(n) ((((u32)(n))&0x1)<<0) #define DDR0_08_DDRII_DECODE(n) ((((u32)(n))>>0)&0x1) #define DDR0_09 0x09 #define DDR0_09_OCD_ADJUST_PDN_CS_0_MASK 0x1F000000 #define DDR0_09_OCD_ADJUST_PDN_CS_0_ENCODE(n) ((((u32)(n))&0x1F)<<24) #define DDR0_09_OCD_ADJUST_PDN_CS_0_DECODE(n) ((((u32)(n))>>24)&0x1F) #define DDR0_09_RTT_0_MASK 0x00030000 #define DDR0_09_RTT_0_ENCODE(n) ((((u32)(n))&0x3)<<16) #define DDR0_09_RTT_0_DECODE(n) ((((u32)(n))>>16)&0x3) #define DDR0_09_WR_DQS_SHIFT_BYPASS_MASK 0x00007F00 #define DDR0_09_WR_DQS_SHIFT_BYPASS_ENCODE(n) ((((u32)(n))&0x7F)<<8) #define DDR0_09_WR_DQS_SHIFT_BYPASS_DECODE(n) ((((u32)(n))>>8)&0x7F) #define DDR0_09_WR_DQS_SHIFT_MASK 0x0000007F #define DDR0_09_WR_DQS_SHIFT_ENCODE(n) ((((u32)(n))&0x7F)<<0) #define DDR0_09_WR_DQS_SHIFT_DECODE(n) ((((u32)(n))>>0)&0x7F) #define DDR0_10 0x0A #define DDR0_10_WRITE_MODEREG_MASK 0x00010000 /* Write only */ #define DDR0_10_WRITE_MODEREG_ENCODE(n) ((((u32)(n))&0x1)<<16) #define DDR0_10_WRITE_MODEREG_DECODE(n) ((((u32)(n))>>16)&0x1) #define DDR0_10_CS_MAP_MASK 0x00000300 #define DDR0_10_CS_MAP_NO_MEM 0x00000000 #define DDR0_10_CS_MAP_RANK0_INSTALLED 0x00000100 #define DDR0_10_CS_MAP_RANK1_INSTALLED 0x00000200 #define DDR0_10_CS_MAP_ENCODE(n) ((((u32)(n))&0x3)<<8) #define DDR0_10_CS_MAP_DECODE(n) ((((u32)(n))>>8)&0x3) #define DDR0_10_OCD_ADJUST_PUP_CS_0_MASK 0x0000001F #define DDR0_10_OCD_ADJUST_PUP_CS_0_ENCODE(n) ((((u32)(n))&0x1F)<<0) #define DDR0_10_OCD_ADJUST_PUP_CS_0_DECODE(n) ((((u32)(n))>>0)&0x1F) #define DDR0_11 0x0B #define DDR0_11_SREFRESH_MASK 0x01000000 #define DDR0_11_SREFRESH_ENCODE(n) ((((u32)(n))&0x1)<<24) #define DDR0_11_SREFRESH_DECODE(n) ((((u32)(n))>>24)&0x1F) #define DDR0_11_TXSNR_MASK 0x00FF0000 #define DDR0_11_TXSNR_ENCODE(n) ((((u32)(n))&0xFF)<<16) #define DDR0_11_TXSNR_DECODE(n) ((((u32)(n))>>16)&0xFF) #define DDR0_11_TXSR_MASK 0x0000FF00 #define DDR0_11_TXSR_ENCODE(n) ((((u32)(n))&0xFF)<<8) #define DDR0_11_TXSR_DECODE(n) ((((u32)(n))>>8)&0xFF) #define DDR0_12 0x0C #define DDR0_12_TCKE_MASK 0x0000007 #define DDR0_12_TCKE_ENCODE(n) ((((u32)(n))&0x7)<<0) #define DDR0_12_TCKE_DECODE(n) ((((u32)(n))>>0)&0x7) #define DDR0_14 0x0E #define DDR0_14_DLL_BYPASS_MODE_MASK 0x01000000 #define DDR0_14_DLL_BYPASS_MODE_ENCODE(n) ((((u32)(n))&0x1)<<24) #define DDR0_14_DLL_BYPASS_MODE_DECODE(n) ((((u32)(n))>>24)&0x1) #define DDR0_14_REDUC_MASK 0x00010000 #define DDR0_14_REDUC_64BITS 0x00000000 #define DDR0_14_REDUC_32BITS 0x00010000 #define DDR0_14_REDUC_ENCODE(n) ((((u32)(n))&0x1)<<16) #define DDR0_14_REDUC_DECODE(n) ((((u32)(n))>>16)&0x1) #define DDR0_14_REG_DIMM_ENABLE_MASK 0x00000100 #define DDR0_14_REG_DIMM_ENABLE_ENCODE(n) ((((u32)(n))&0x1)<<8) #define DDR0_14_REG_DIMM_ENABLE_DECODE(n) ((((u32)(n))>>8)&0x1) #define DDR0_17 0x11 #define DDR0_17_DLL_DQS_DELAY_0_MASK 0x7F000000 #define DDR0_17_DLL_DQS_DELAY_0_ENCODE(n) ((((u32)(n))&0x7F)<<24) #define DDR0_17_DLL_DQS_DELAY_0_DECODE(n) ((((u32)(n))>>24)&0x7F) #define DDR0_17_DLLLOCKREG_MASK 0x00010000 /* Read only */ #define DDR0_17_DLLLOCKREG_LOCKED 0x00010000 #define DDR0_17_DLLLOCKREG_UNLOCKED 0x00000000 #define DDR0_17_DLLLOCKREG_ENCODE(n) ((((u32)(n))&0x1)<<16) #define DDR0_17_DLLLOCKREG_DECODE(n) ((((u32)(n))>>16)&0x1) #define DDR0_17_DLL_LOCK_MASK 0x00007F00 /* Read only */ #define DDR0_17_DLL_LOCK_ENCODE(n) ((((u32)(n))&0x7F)<<8) #define DDR0_17_DLL_LOCK_DECODE(n) ((((u32)(n))>>8)&0x7F) #define DDR0_18 0x12 #define DDR0_18_DLL_DQS_DELAY_X_MASK 0x7F7F7F7F #define DDR0_18_DLL_DQS_DELAY_4_MASK 0x7F000000 #define DDR0_18_DLL_DQS_DELAY_4_ENCODE(n) ((((u32)(n))&0x7F)<<24) #define DDR0_18_DLL_DQS_DELAY_4_DECODE(n) ((((u32)(n))>>24)&0x7F) #define DDR0_18_DLL_DQS_DELAY_3_MASK 0x007F0000 #define DDR0_18_DLL_DQS_DELAY_3_ENCODE(n) ((((u32)(n))&0x7F)<<16) #define DDR0_18_DLL_DQS_DELAY_3_DECODE(n) ((((u32)(n))>>16)&0x7F) #define DDR0_18_DLL_DQS_DELAY_2_MASK 0x00007F00 #define DDR0_18_DLL_DQS_DELAY_2_ENCODE(n) ((((u32)(n))&0x7F)<<8) #define DDR0_18_DLL_DQS_DELAY_2_DECODE(n) ((((u32)(n))>>8)&0x7F) #define DDR0_18_DLL_DQS_DELAY_1_MASK 0x0000007F #define DDR0_18_DLL_DQS_DELAY_1_ENCODE(n) ((((u32)(n))&0x7F)<<0) #define DDR0_18_DLL_DQS_DELAY_1_DECODE(n) ((((u32)(n))>>0)&0x7F) #define DDR0_19 0x13 #define DDR0_19_DLL_DQS_DELAY_X_MASK 0x7F7F7F7F #define DDR0_19_DLL_DQS_DELAY_8_MASK 0x7F000000 #define DDR0_19_DLL_DQS_DELAY_8_ENCODE(n) ((((u32)(n))&0x7F)<<24) #define DDR0_19_DLL_DQS_DELAY_8_DECODE(n) ((((u32)(n))>>24)&0x7F) #define DDR0_19_DLL_DQS_DELAY_7_MASK 0x007F0000 #define DDR0_19_DLL_DQS_DELAY_7_ENCODE(n) ((((u32)(n))&0x7F)<<16) #define DDR0_19_DLL_DQS_DELAY_7_DECODE(n) ((((u32)(n))>>16)&0x7F) #define DDR0_19_DLL_DQS_DELAY_6_MASK 0x00007F00 #define DDR0_19_DLL_DQS_DELAY_6_ENCODE(n) ((((u32)(n))&0x7F)<<8) #define DDR0_19_DLL_DQS_DELAY_6_DECODE(n) ((((u32)(n))>>8)&0x7F) #define DDR0_19_DLL_DQS_DELAY_5_MASK 0x0000007F #define DDR0_19_DLL_DQS_DELAY_5_ENCODE(n) ((((u32)(n))&0x7F)<<0) #define DDR0_19_DLL_DQS_DELAY_5_DECODE(n) ((((u32)(n))>>0)&0x7F) #define DDR0_20 0x14 #define DDR0_20_DLL_DQS_BYPASS_3_MASK 0x7F000000 #define DDR0_20_DLL_DQS_BYPASS_3_ENCODE(n) ((((u32)(n))&0x7F)<<24) #define DDR0_20_DLL_DQS_BYPASS_3_DECODE(n) ((((u32)(n))>>24)&0x7F) #define DDR0_20_DLL_DQS_BYPASS_2_MASK 0x007F0000 #define DDR0_20_DLL_DQS_BYPASS_2_ENCODE(n) ((((u32)(n))&0x7F)<<16) #define DDR0_20_DLL_DQS_BYPASS_2_DECODE(n) ((((u32)(n))>>16)&0x7F) #define DDR0_20_DLL_DQS_BYPASS_1_MASK 0x00007F00 #define DDR0_20_DLL_DQS_BYPASS_1_ENCODE(n) ((((u32)(n))&0x7F)<<8) #define DDR0_20_DLL_DQS_BYPASS_1_DECODE(n) ((((u32)(n))>>8)&0x7F) #define DDR0_20_DLL_DQS_BYPASS_0_MASK 0x0000007F #define DDR0_20_DLL_DQS_BYPASS_0_ENCODE(n) ((((u32)(n))&0x7F)<<0) #define DDR0_20_DLL_DQS_BYPASS_0_DECODE(n) ((((u32)(n))>>0)&0x7F) #define DDR0_21 0x15 #define DDR0_21_DLL_DQS_BYPASS_7_MASK 0x7F000000 #define DDR0_21_DLL_DQS_BYPASS_7_ENCODE(n) ((((u32)(n))&0x7F)<<24) #define DDR0_21_DLL_DQS_BYPASS_7_DECODE(n) ((((u32)(n))>>24)&0x7F) #define DDR0_21_DLL_DQS_BYPASS_6_MASK 0x007F0000 #define DDR0_21_DLL_DQS_BYPASS_6_ENCODE(n) ((((u32)(n))&0x7F)<<16) #define DDR0_21_DLL_DQS_BYPASS_6_DECODE(n) ((((u32)(n))>>16)&0x7F) #define DDR0_21_DLL_DQS_BYPASS_5_MASK 0x00007F00 #define DDR0_21_DLL_DQS_BYPASS_5_ENCODE(n) ((((u32)(n))&0x7F)<<8) #define DDR0_21_DLL_DQS_BYPASS_5_DECODE(n) ((((u32)(n))>>8)&0x7F) #define DDR0_21_DLL_DQS_BYPASS_4_MASK 0x0000007F #define DDR0_21_DLL_DQS_BYPASS_4_ENCODE(n) ((((u32)(n))&0x7F)<<0) #define DDR0_21_DLL_DQS_BYPASS_4_DECODE(n) ((((u32)(n))>>0)&0x7F) #define DDR0_22 0x16 #define DDR0_22_CTRL_RAW_MASK 0x03000000 #define DDR0_22_CTRL_RAW_ECC_DISABLE 0x00000000 #define DDR0_22_CTRL_RAW_ECC_CHECK_ONLY 0x01000000 #define DDR0_22_CTRL_RAW_NO_ECC_RAM 0x02000000 #define DDR0_22_CTRL_RAW_ECC_ENABLE 0x03000000 #define DDR0_22_CTRL_RAW_ENCODE(n) ((((u32)(n))&0x3)<<24) #define DDR0_22_CTRL_RAW_DECODE(n) ((((u32)(n))>>24)&0x3) #define DDR0_22_DQS_OUT_SHIFT_BYPASS_MASK 0x007F0000 #define DDR0_22_DQS_OUT_SHIFT_BYPASS_ENCODE(n) ((((u32)(n))&0x7F)<<16) #define DDR0_22_DQS_OUT_SHIFT_BYPASS_DECODE(n) ((((u32)(n))>>16)&0x7F) #define DDR0_22_DQS_OUT_SHIFT_MASK 0x00007F00 #define DDR0_22_DQS_OUT_SHIFT_ENCODE(n) ((((u32)(n))&0x7F)<<8) #define DDR0_22_DQS_OUT_SHIFT_DECODE(n) ((((u32)(n))>>8)&0x7F) #define DDR0_22_DLL_DQS_BYPASS_8_MASK 0x0000007F #define DDR0_22_DLL_DQS_BYPASS_8_ENCODE(n) ((((u32)(n))&0x7F)<<0) #define DDR0_22_DLL_DQS_BYPASS_8_DECODE(n) ((((u32)(n))>>0)&0x7F) #define DDR0_23 0x17 #define DDR0_23_ODT_RD_MAP_CS0_MASK 0x03000000 #define DDR0_23_ODT_RD_MAP_CS0_ENCODE(n) ((((u32)(n))&0x3)<<24) #define DDR0_23_ODT_RD_MAP_CS0_DECODE(n) ((((u32)(n))>>24)&0x3) #define DDR0_23_ECC_C_SYND_MASK 0x00FF0000 /* Read only */ #define DDR0_23_ECC_C_SYND_ENCODE(n) ((((u32)(n))&0xFF)<<16) #define DDR0_23_ECC_C_SYND_DECODE(n) ((((u32)(n))>>16)&0xFF) #define DDR0_23_ECC_U_SYND_MASK 0x0000FF00 /* Read only */ #define DDR0_23_ECC_U_SYND_ENCODE(n) ((((u32)(n))&0xFF)<<8) #define DDR0_23_ECC_U_SYND_DECODE(n) ((((u32)(n))>>8)&0xFF) #define DDR0_23_FWC_MASK 0x00000001 /* Write only */ #define DDR0_23_FWC_ENCODE(n) ((((u32)(n))&0x1)<<0) #define DDR0_23_FWC_DECODE(n) ((((u32)(n))>>0)&0x1) #define DDR0_24 0x18 #define DDR0_24_RTT_PAD_TERMINATION_MASK 0x03000000 #define DDR0_24_RTT_PAD_TERMINATION_ENCODE(n) ((((u32)(n))&0x3)<<24) #define DDR0_24_RTT_PAD_TERMINATION_DECODE(n) ((((u32)(n))>>24)&0x3) #define DDR0_24_ODT_WR_MAP_CS1_MASK 0x00030000 #define DDR0_24_ODT_WR_MAP_CS1_ENCODE(n) ((((u32)(n))&0x3)<<16) #define DDR0_24_ODT_WR_MAP_CS1_DECODE(n) ((((u32)(n))>>16)&0x3) #define DDR0_24_ODT_RD_MAP_CS1_MASK 0x00000300 #define DDR0_24_ODT_RD_MAP_CS1_ENCODE(n) ((((u32)(n))&0x3)<<8) #define DDR0_24_ODT_RD_MAP_CS1_DECODE(n) ((((u32)(n))>>8)&0x3) #define DDR0_24_ODT_WR_MAP_CS0_MASK 0x00000003 #define DDR0_24_ODT_WR_MAP_CS0_ENCODE(n) ((((u32)(n))&0x3)<<0) #define DDR0_24_ODT_WR_MAP_CS0_DECODE(n) ((((u32)(n))>>0)&0x3) #define DDR0_25 0x19 #define DDR0_25_VERSION_MASK 0xFFFF0000 /* Read only */ #define DDR0_25_VERSION_ENCODE(n) ((((u32)(n))&0xFFFF)<<16) #define DDR0_25_VERSION_DECODE(n) ((((u32)(n))>>16)&0xFFFF) #define DDR0_25_OUT_OF_RANGE_LENGTH_MASK 0x000003FF /* Read only */ #define DDR0_25_OUT_OF_RANGE_LENGTH_ENCODE(n) ((((u32)(n))&0x3FF)<<0) #define DDR0_25_OUT_OF_RANGE_LENGTH_DECODE(n) ((((u32)(n))>>0)&0x3FF) #define DDR0_26 0x1A #define DDR0_26_TRAS_MAX_MASK 0xFFFF0000 #define DDR0_26_TRAS_MAX_ENCODE(n) ((((u32)(n))&0xFFFF)<<16) #define DDR0_26_TRAS_MAX_DECODE(n) ((((u32)(n))>>16)&0xFFFF) #define DDR0_26_TREF_MASK 0x00003FFF #define DDR0_26_TREF_ENCODE(n) ((((u32)(n))&0x3FFF)<<0) #define DDR0_26_TREF_DECODE(n) ((((u32)(n))>>0)&0x3FFF) #define DDR0_27 0x1B #define DDR0_27_EMRS_DATA_MASK 0x3FFF0000 #define DDR0_27_EMRS_DATA_ENCODE(n) ((((u32)(n))&0x3FFF)<<16) #define DDR0_27_EMRS_DATA_DECODE(n) ((((u32)(n))>>16)&0x3FFF) #define DDR0_27_TINIT_MASK 0x0000FFFF #define DDR0_27_TINIT_ENCODE(n) ((((u32)(n))&0xFFFF)<<0) #define DDR0_27_TINIT_DECODE(n) ((((u32)(n))>>0)&0xFFFF) #define DDR0_28 0x1C #define DDR0_28_EMRS3_DATA_MASK 0x3FFF0000 #define DDR0_28_EMRS3_DATA_ENCODE(n) ((((u32)(n))&0x3FFF)<<16) #define DDR0_28_EMRS3_DATA_DECODE(n) ((((u32)(n))>>16)&0x3FFF) #define DDR0_28_EMRS2_DATA_MASK 0x00003FFF #define DDR0_28_EMRS2_DATA_ENCODE(n) ((((u32)(n))&0x3FFF)<<0) #define DDR0_28_EMRS2_DATA_DECODE(n) ((((u32)(n))>>0)&0x3FFF) #define DDR0_31 0x1F #define DDR0_31_XOR_CHECK_BITS_MASK 0x0000FFFF #define DDR0_31_XOR_CHECK_BITS_ENCODE(n) ((((u32)(n))&0xFFFF)<<0) #define DDR0_31_XOR_CHECK_BITS_DECODE(n) ((((u32)(n))>>0)&0xFFFF) #define DDR0_32 0x20 #define DDR0_32_OUT_OF_RANGE_ADDR_MASK 0xFFFFFFFF /* Read only */ #define DDR0_32_OUT_OF_RANGE_ADDR_ENCODE(n) ((((u32)(n))&0xFFFFFFFF)<<0) #define DDR0_32_OUT_OF_RANGE_ADDR_DECODE(n) ((((u32)(n))>>0)&0xFFFFFFFF) #define DDR0_33 0x21 #define DDR0_33_OUT_OF_RANGE_ADDR_MASK 0x00000001 /* Read only */ #define DDR0_33_OUT_OF_RANGE_ADDR_ENCODE(n) ((((u32)(n))&0x1)<<0) #define DDR0_33_OUT_OF_RANGE_ADDR_DECODE(n) ((((u32)(n))>>0)&0x1) #define DDR0_34 0x22 #define DDR0_34_ECC_U_ADDR_MASK 0xFFFFFFFF /* Read only */ #define DDR0_34_ECC_U_ADDR_ENCODE(n) ((((u32)(n))&0xFFFFFFFF)<<0) #define DDR0_34_ECC_U_ADDR_DECODE(n) ((((u32)(n))>>0)&0xFFFFFFFF) #define DDR0_35 0x23 #define DDR0_35_ECC_U_ADDR_MASK 0x00000001 /* Read only */ #define DDR0_35_ECC_U_ADDR_ENCODE(n) ((((u32)(n))&0x1)<<0) #define DDR0_35_ECC_U_ADDR_DECODE(n) ((((u32)(n))>>0)&0x1) #define DDR0_36 0x24 #define DDR0_36_ECC_U_DATA_MASK 0xFFFFFFFF /* Read only */ #define DDR0_36_ECC_U_DATA_ENCODE(n) ((((u32)(n))&0xFFFFFFFF)<<0) #define DDR0_36_ECC_U_DATA_DECODE(n) ((((u32)(n))>>0)&0xFFFFFFFF) #define DDR0_37 0x25 #define DDR0_37_ECC_U_DATA_MASK 0xFFFFFFFF /* Read only */ #define DDR0_37_ECC_U_DATA_ENCODE(n) ((((u32)(n))&0xFFFFFFFF)<<0) #define DDR0_37_ECC_U_DATA_DECODE(n) ((((u32)(n))>>0)&0xFFFFFFFF) #define DDR0_38 0x26 #define DDR0_38_ECC_C_ADDR_MASK 0xFFFFFFFF /* Read only */ #define DDR0_38_ECC_C_ADDR_ENCODE(n) ((((u32)(n))&0xFFFFFFFF)<<0) #define DDR0_38_ECC_C_ADDR_DECODE(n) ((((u32)(n))>>0)&0xFFFFFFFF) #define DDR0_39 0x27 #define DDR0_39_ECC_C_ADDR_MASK 0x00000001 /* Read only */ #define DDR0_39_ECC_C_ADDR_ENCODE(n) ((((u32)(n))&0x1)<<0) #define DDR0_39_ECC_C_ADDR_DECODE(n) ((((u32)(n))>>0)&0x1) #define DDR0_40 0x28 #define DDR0_40_ECC_C_DATA_MASK 0xFFFFFFFF /* Read only */ #define DDR0_40_ECC_C_DATA_ENCODE(n) ((((u32)(n))&0xFFFFFFFF)<<0) #define DDR0_40_ECC_C_DATA_DECODE(n) ((((u32)(n))>>0)&0xFFFFFFFF) #define DDR0_41 0x29 #define DDR0_41_ECC_C_DATA_MASK 0xFFFFFFFF /* Read only */ #define DDR0_41_ECC_C_DATA_ENCODE(n) ((((u32)(n))&0xFFFFFFFF)<<0) #define DDR0_41_ECC_C_DATA_DECODE(n) ((((u32)(n))>>0)&0xFFFFFFFF) #define DDR0_42 0x2A #define DDR0_42_ADDR_PINS_MASK 0x07000000 #define DDR0_42_ADDR_PINS_ENCODE(n) ((((u32)(n))&0x7)<<24) #define DDR0_42_ADDR_PINS_DECODE(n) ((((u32)(n))>>24)&0x7) #define DDR0_42_CASLAT_LIN_GATE_MASK 0x0000000F #define DDR0_42_CASLAT_LIN_GATE_ENCODE(n) ((((u32)(n))&0xF)<<0) #define DDR0_42_CASLAT_LIN_GATE_DECODE(n) ((((u32)(n))>>0)&0xF) #define DDR0_43 0x2B #define DDR0_43_TWR_MASK 0x07000000 #define DDR0_43_TWR_ENCODE(n) ((((u32)(n))&0x7)<<24) #define DDR0_43_TWR_DECODE(n) ((((u32)(n))>>24)&0x7) #define DDR0_43_APREBIT_MASK 0x000F0000 #define DDR0_43_APREBIT_ENCODE(n) ((((u32)(n))&0xF)<<16) #define DDR0_43_APREBIT_DECODE(n) ((((u32)(n))>>16)&0xF) #define DDR0_43_COLUMN_SIZE_MASK 0x00000700 #define DDR0_43_COLUMN_SIZE_ENCODE(n) ((((u32)(n))&0x7)<<8) #define DDR0_43_COLUMN_SIZE_DECODE(n) ((((u32)(n))>>8)&0x7) #define DDR0_43_EIGHT_BANK_MODE_MASK 0x00000001 #define DDR0_43_EIGHT_BANK_MODE_8_BANKS 0x00000001 #define DDR0_43_EIGHT_BANK_MODE_4_BANKS 0x00000000 #define DDR0_43_EIGHT_BANK_MODE_ENCODE(n) ((((u32)(n))&0x1)<<0) #define DDR0_43_EIGHT_BANK_MODE_DECODE(n) ((((u32)(n))>>0)&0x1) #define DDR0_44 0x2C #define DDR0_44_TRCD_MASK 0x000000FF #define DDR0_44_TRCD_ENCODE(n) ((((u32)(n))&0xFF)<<0) #define DDR0_44_TRCD_DECODE(n) ((((u32)(n))>>0)&0xFF) #endif /* CONFIG_SDRAM_PPC4xx_DENALI_DDR2 */ #ifndef __ASSEMBLY__ struct sdram_timing { u32 wrdtr; u32 clktr; }; /* * Prototypes */ inline void ppc4xx_ibm_ddr2_register_dump(void); u32 mfdcr_any(u32); void mtdcr_any(u32, u32); u32 ddr_wrdtr(u32); u32 ddr_clktr(u32); void spd_ddr_init_hang(void); u32 DQS_autocalibration(void); phys_size_t sdram_memsize(void); void dcbz_area(u32 start_address, u32 num_bytes); #endif /* __ASSEMBLY__ */ #endif /* _PPC4xx_SDRAM_H_ */
{ "pile_set_name": "Github" }
// // UIImageView+LGFImageView.m // LGFOCTool // // Created by apple on 2017/5/3. // Copyright © 2017年 来国锋. All rights reserved. // #import "UIImageView+LGFImageView.h" static const char *lgf_NetImageNameKey = "lgf_NetImageNameKey"; @implementation UIImageView (LGFImageView) @dynamic lgf_NetImageName; #pragma mark - 控件唯一名字(通常用于确定某一个特殊的view) - (NSString *)lgf_NetImageName { return objc_getAssociatedObject(self, &lgf_NetImageNameKey); } - (void)setLgf_NetImageName:(NSString *)lgf_NetImageName { objc_setAssociatedObject(self, &lgf_NetImageNameKey, lgf_NetImageName, OBJC_ASSOCIATION_COPY); } #pragma mark - 创建imageview动画 /** * @param imageArray 图片名称数组 * @param duration 动画时间 */ - (void)lgf_AnimationWithImageArray:(NSArray*)imageArray duration:(NSTimeInterval)duration { if (imageArray && !([imageArray count] > 0)) { return; } NSMutableArray *images = [NSMutableArray array]; for (NSInteger i = 0; i < imageArray.count; i++) { UIImage *image = [UIImage imageNamed:[imageArray objectAtIndex:i]]; [images addObject:image]; } [self setImage:[images objectAtIndex:0]]; [self setAnimationImages:images]; [self setAnimationDuration:duration]; [self setAnimationRepeatCount:0]; } #pragma mark - 添加可伸缩图片 - (void)lgf_SetImageWithStretchableImage:(UIImage*)image { self.image = [image stretchableImageWithLeftCapWidth:image.size.width/2 topCapHeight:image.size.height/2]; } #pragma mark - 给 ImageView 添加图片的同时 在某个区域添加 水印 /** @param image 图片 @param waterMark 水印 @param rect 水印添加区域 */ - (void)lgf_SetImage:(UIImage *)image withWaterMark:(UIImage *)waterMark inRect:(CGRect)rect { if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0) { UIGraphicsBeginImageContextWithOptions(self.frame.size, NO, 0.0); } //原图 [image drawInRect:self.bounds]; //水印图 [waterMark drawInRect:rect]; UIImage *newPic = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); self.image = newPic; } #pragma mark - 给 ImageView 添加图片的同时 在某个区域添加 文字水印 /** @param image 图片 @param waterMarkString 水印文字 @param rect 水印添加区域 @param color 文字颜色 @param font 文字字体 */ - (void)lgf_SetImage:(UIImage *)image withStringWaterMark:(NSString *)waterMarkString inRect:(CGRect)rect color:(UIColor *)color font:(UIFont *)font { if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0) { UIGraphicsBeginImageContextWithOptions(self.frame.size, NO, 0.0); // 0.0 for scale means "scale for device's main screen". } //原图 [image drawInRect:self.bounds]; //文字颜色 [color set]; //水印文字 if ([waterMarkString respondsToSelector:@selector(drawInRect:withAttributes:)]) { [waterMarkString drawInRect:rect withAttributes:@{NSFontAttributeName:font}]; } else { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" [waterMarkString drawInRect:rect withFont:font]; #pragma clang diagnostic pop } UIImage *newPic = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); self.image = newPic; } #pragma mark - 给 ImageView 添加图片的同时 在某个点添加 文字水印 /** @param image 图片 @param waterMarkString 水印文字 @param point 水印添加点 @param color 文字颜色 @param font 文字字体 */ - (void)lgf_SetImage:(UIImage *)image withWaterMarkString:(NSString *)waterMarkString atPoint:(CGPoint)point color:(UIColor *)color font:(UIFont *)font { if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0) { UIGraphicsBeginImageContextWithOptions(self.frame.size, NO, 0.0); } //原图 [image drawInRect:self.bounds]; //文字颜色 [color set]; //水印文字 if ([waterMarkString respondsToSelector:@selector(drawAtPoint:withAttributes:)]) { [waterMarkString drawAtPoint:point withAttributes:@{NSFontAttributeName:font}]; } else { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" [waterMarkString drawAtPoint:point withFont:font]; #pragma clang diagnostic pop } UIImage *newPic = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); self.image = newPic; } @end
{ "pile_set_name": "Github" }
// Distributed under the terms of the MIT license // Test case submitted to project by https://github.com/practicalswift (practicalswift) // Test case found by fuzzing let c{class A{let a=[1}class B<T where g:C{let en=[(var a{
{ "pile_set_name": "Github" }
var anObject = require('./_an-object'); var IE8_DOM_DEFINE = require('./_ie8-dom-define'); var toPrimitive = require('./_to-primitive'); var dP = Object.defineProperty; exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return dP(O, P, Attributes); } catch (e) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); if ('value' in Attributes) O[P] = Attributes.value; return O; };
{ "pile_set_name": "Github" }
 using UnityEngine; using UNEB; public class OutputMesh : Node { }
{ "pile_set_name": "Github" }
// Copyright 2008 Louis DeJardin - http://whereslou.com // // 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. // using System; using System.Collections.Generic; using System.Linq; using System.Web; using Spark; namespace MediumTrustHosting { /// <summary> /// Provide a base class for all of the views. This class is named /// in the web.config spark/pages/@pageTypeName setting. /// /// Properties and methods can be added for use in spark templates. /// </summary> public abstract class BaseView : AbstractSparkView { protected BaseView() { ViewData = new ViewDataDictionary(); } /// <summary> /// Context is assigned by BaseHandler.CreateView /// </summary> public HttpContext Context { get; set; } /// <summary> /// The generated code will use ViewData.Eval("propertyname") if /// the template is using the viewdata element /// </summary> public ViewDataDictionary ViewData { get; set; } /// <summary> /// Provides a normalized application path /// </summary> public string SiteRoot { get { string[] parts = Context.Request.ApplicationPath.Split(new[] {'/', '\\'}, StringSplitOptions.RemoveEmptyEntries); return string.Concat(parts.Select(part => "/" + part).ToArray()); } } /// <summary> /// The generated code will use the SiteResource method when /// an html attribute for a url starts with ~ /// </summary> public string SiteResource(string path) { if (path.StartsWith("~/")) return SiteRoot + path.Substring(1); return path; } /// <summary> /// ${H(blah)} is a convenience to htmlencode the value of blah. /// </summary> /// <param name="text"></param> /// <returns></returns> public string H(object text) { return Context.Server.HtmlEncode(Convert.ToString(text)); } #region Nested type: ViewDataDictionary public class ViewDataDictionary : Dictionary<string, object> { public object Eval(string key) { return this[key]; } } #endregion } }
{ "pile_set_name": "Github" }
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build linux package fsnotify import ( "errors" "fmt" "io" "os" "path/filepath" "strings" "sync" "unsafe" "golang.org/x/sys/unix" ) // Watcher watches a set of files, delivering events to a channel. type Watcher struct { Events chan Event Errors chan error mu sync.Mutex // Map access fd int poller *fdPoller watches map[string]*watch // Map of inotify watches (key: path) paths map[int]string // Map of watched paths (key: watch descriptor) done chan struct{} // Channel for sending a "quit message" to the reader goroutine doneResp chan struct{} // Channel to respond to Close } // NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. func NewWatcher() (*Watcher, error) { // Create inotify fd fd, errno := unix.InotifyInit1(unix.IN_CLOEXEC) if fd == -1 { return nil, errno } // Create epoll poller, err := newFdPoller(fd) if err != nil { unix.Close(fd) return nil, err } w := &Watcher{ fd: fd, poller: poller, watches: make(map[string]*watch), paths: make(map[int]string), Events: make(chan Event), Errors: make(chan error), done: make(chan struct{}), doneResp: make(chan struct{}), } go w.readEvents() return w, nil } func (w *Watcher) isClosed() bool { select { case <-w.done: return true default: return false } } // Close removes all watches and closes the events channel. func (w *Watcher) Close() error { if w.isClosed() { return nil } // Send 'close' signal to goroutine, and set the Watcher to closed. close(w.done) // Wake up goroutine w.poller.wake() // Wait for goroutine to close <-w.doneResp return nil } // Add starts watching the named file or directory (non-recursively). func (w *Watcher) Add(name string) error { name = filepath.Clean(name) if w.isClosed() { return errors.New("inotify instance already closed") } const agnosticEvents = unix.IN_MOVED_TO | unix.IN_MOVED_FROM | unix.IN_CREATE | unix.IN_ATTRIB | unix.IN_MODIFY | unix.IN_MOVE_SELF | unix.IN_DELETE | unix.IN_DELETE_SELF var flags uint32 = agnosticEvents w.mu.Lock() defer w.mu.Unlock() watchEntry := w.watches[name] if watchEntry != nil { flags |= watchEntry.flags | unix.IN_MASK_ADD } wd, errno := unix.InotifyAddWatch(w.fd, name, flags) if wd == -1 { return errno } if watchEntry == nil { w.watches[name] = &watch{wd: uint32(wd), flags: flags} w.paths[wd] = name } else { watchEntry.wd = uint32(wd) watchEntry.flags = flags } return nil } // Remove stops watching the named file or directory (non-recursively). func (w *Watcher) Remove(name string) error { name = filepath.Clean(name) // Fetch the watch. w.mu.Lock() defer w.mu.Unlock() watch, ok := w.watches[name] // Remove it from inotify. if !ok { return fmt.Errorf("can't remove non-existent inotify watch for: %s", name) } // We successfully removed the watch if InotifyRmWatch doesn't return an // error, we need to clean up our internal state to ensure it matches // inotify's kernel state. delete(w.paths, int(watch.wd)) delete(w.watches, name) // inotify_rm_watch will return EINVAL if the file has been deleted; // the inotify will already have been removed. // watches and pathes are deleted in ignoreLinux() implicitly and asynchronously // by calling inotify_rm_watch() below. e.g. readEvents() goroutine receives IN_IGNORE // so that EINVAL means that the wd is being rm_watch()ed or its file removed // by another thread and we have not received IN_IGNORE event. success, errno := unix.InotifyRmWatch(w.fd, watch.wd) if success == -1 { // TODO: Perhaps it's not helpful to return an error here in every case. // the only two possible errors are: // EBADF, which happens when w.fd is not a valid file descriptor of any kind. // EINVAL, which is when fd is not an inotify descriptor or wd is not a valid watch descriptor. // Watch descriptors are invalidated when they are removed explicitly or implicitly; // explicitly by inotify_rm_watch, implicitly when the file they are watching is deleted. return errno } return nil } type watch struct { wd uint32 // Watch descriptor (as returned by the inotify_add_watch() syscall) flags uint32 // inotify flags of this watch (see inotify(7) for the list of valid flags) } // readEvents reads from the inotify file descriptor, converts the // received events into Event objects and sends them via the Events channel func (w *Watcher) readEvents() { var ( buf [unix.SizeofInotifyEvent * 4096]byte // Buffer for a maximum of 4096 raw events n int // Number of bytes read with read() errno error // Syscall errno ok bool // For poller.wait ) defer close(w.doneResp) defer close(w.Errors) defer close(w.Events) defer unix.Close(w.fd) defer w.poller.close() for { // See if we have been closed. if w.isClosed() { return } ok, errno = w.poller.wait() if errno != nil { select { case w.Errors <- errno: case <-w.done: return } continue } if !ok { continue } n, errno = unix.Read(w.fd, buf[:]) // If a signal interrupted execution, see if we've been asked to close, and try again. // http://man7.org/linux/man-pages/man7/signal.7.html : // "Before Linux 3.8, reads from an inotify(7) file descriptor were not restartable" if errno == unix.EINTR { continue } // unix.Read might have been woken up by Close. If so, we're done. if w.isClosed() { return } if n < unix.SizeofInotifyEvent { var err error if n == 0 { // If EOF is received. This should really never happen. err = io.EOF } else if n < 0 { // If an error occurred while reading. err = errno } else { // Read was too short. err = errors.New("notify: short read in readEvents()") } select { case w.Errors <- err: case <-w.done: return } continue } var offset uint32 // We don't know how many events we just read into the buffer // While the offset points to at least one whole event... for offset <= uint32(n-unix.SizeofInotifyEvent) { // Point "raw" to the event in the buffer raw := (*unix.InotifyEvent)(unsafe.Pointer(&buf[offset])) mask := uint32(raw.Mask) nameLen := uint32(raw.Len) if mask&unix.IN_Q_OVERFLOW != 0 { select { case w.Errors <- ErrEventOverflow: case <-w.done: return } } // If the event happened to the watched directory or the watched file, the kernel // doesn't append the filename to the event, but we would like to always fill the // the "Name" field with a valid filename. We retrieve the path of the watch from // the "paths" map. w.mu.Lock() name, ok := w.paths[int(raw.Wd)] // IN_DELETE_SELF occurs when the file/directory being watched is removed. // This is a sign to clean up the maps, otherwise we are no longer in sync // with the inotify kernel state which has already deleted the watch // automatically. if ok && mask&unix.IN_DELETE_SELF == unix.IN_DELETE_SELF { delete(w.paths, int(raw.Wd)) delete(w.watches, name) } w.mu.Unlock() if nameLen > 0 { // Point "bytes" at the first byte of the filename bytes := (*[unix.PathMax]byte)(unsafe.Pointer(&buf[offset+unix.SizeofInotifyEvent])) // The filename is padded with NULL bytes. TrimRight() gets rid of those. name += "/" + strings.TrimRight(string(bytes[0:nameLen]), "\000") } event := newEvent(name, mask) // Send the events that are not ignored on the events channel if !event.ignoreLinux(mask) { select { case w.Events <- event: case <-w.done: return } } // Move to the next event in the buffer offset += unix.SizeofInotifyEvent + nameLen } } } // Certain types of events can be "ignored" and not sent over the Events // channel. Such as events marked ignore by the kernel, or MODIFY events // against files that do not exist. func (e *Event) ignoreLinux(mask uint32) bool { // Ignore anything the inotify API says to ignore if mask&unix.IN_IGNORED == unix.IN_IGNORED { return true } // If the event is not a DELETE or RENAME, the file must exist. // Otherwise the event is ignored. // *Note*: this was put in place because it was seen that a MODIFY // event was sent after the DELETE. This ignores that MODIFY and // assumes a DELETE will come or has come if the file doesn't exist. if !(e.Op&Remove == Remove || e.Op&Rename == Rename) { _, statErr := os.Lstat(e.Name) return os.IsNotExist(statErr) } return false } // newEvent returns an platform-independent Event based on an inotify mask. func newEvent(name string, mask uint32) Event { e := Event{Name: name} if mask&unix.IN_CREATE == unix.IN_CREATE || mask&unix.IN_MOVED_TO == unix.IN_MOVED_TO { e.Op |= Create } if mask&unix.IN_DELETE_SELF == unix.IN_DELETE_SELF || mask&unix.IN_DELETE == unix.IN_DELETE { e.Op |= Remove } if mask&unix.IN_MODIFY == unix.IN_MODIFY { e.Op |= Write } if mask&unix.IN_MOVE_SELF == unix.IN_MOVE_SELF || mask&unix.IN_MOVED_FROM == unix.IN_MOVED_FROM { e.Op |= Rename } if mask&unix.IN_ATTRIB == unix.IN_ATTRIB { e.Op |= Chmod } return e }
{ "pile_set_name": "Github" }
#import <Foundation/Foundation.h> @interface EXPDoubleTuple : NSObject { double *_values; size_t _size; } @property (nonatomic, assign) double *values; @property (nonatomic, assign) size_t size; - (id)initWithDoubleValues:(double *)values size:(size_t)size; @end
{ "pile_set_name": "Github" }
/******************************************************************************* * Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. * This file 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. * ***************************************************************************** * * AWS Tools for Windows (TM) PowerShell (TM) * */ using System; using System.Collections.Generic; using System.Linq; using System.Management.Automation; using System.Text; using Amazon.PowerShell.Common; using Amazon.Runtime; using Amazon.MediaPackageVod; using Amazon.MediaPackageVod.Model; namespace Amazon.PowerShell.Cmdlets.EMPV { /// <summary> /// Removes tags from the specified resource. You can specify one or more tags to remove. /// </summary> [Cmdlet("Remove", "EMPVResourceTag", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.High)] [OutputType("None")] [AWSCmdlet("Calls the AWS Elemental MediaPackage VOD UntagResource API operation.", Operation = new[] {"UntagResource"}, SelectReturnType = typeof(Amazon.MediaPackageVod.Model.UntagResourceResponse))] [AWSCmdletOutput("None or Amazon.MediaPackageVod.Model.UntagResourceResponse", "This cmdlet does not generate any output." + "The service response (type Amazon.MediaPackageVod.Model.UntagResourceResponse) can be referenced from properties attached to the cmdlet entry in the $AWSHistory stack." )] public partial class RemoveEMPVResourceTagCmdlet : AmazonMediaPackageVodClientCmdlet, IExecutor { #region Parameter ResourceArn /// <summary> /// <para> /// The Amazon Resource Name (ARN) for the resource. /// You can get this from the response to any request to the resource. /// </para> /// </summary> #if !MODULAR [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)] #else [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String ResourceArn { get; set; } #endregion #region Parameter TagKey /// <summary> /// <para> /// A comma-separated list of the tag keys to remove /// from the resource. /// </para> /// </summary> #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyCollection] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] [Alias("TagKeys")] public System.String[] TagKey { get; set; } #endregion #region Parameter Select /// <summary> /// Use the -Select parameter to control the cmdlet output. The cmdlet doesn't have a return value by default. /// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.MediaPackageVod.Model.UntagResourceResponse). /// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value. /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public string Select { get; set; } = "*"; #endregion #region Parameter PassThru /// <summary> /// Changes the cmdlet behavior to return the value passed to the ResourceArn parameter. /// The -PassThru parameter is deprecated, use -Select '^ResourceArn' instead. This parameter will be removed in a future version. /// </summary> [System.Obsolete("The -PassThru parameter is deprecated, use -Select '^ResourceArn' instead. This parameter will be removed in a future version.")] [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter PassThru { get; set; } #endregion #region Parameter Force /// <summary> /// This parameter overrides confirmation prompts to force /// the cmdlet to continue its operation. This parameter should always /// be used with caution. /// </summary> [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter Force { get; set; } #endregion protected override void ProcessRecord() { base.ProcessRecord(); var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.ResourceArn), MyInvocation.BoundParameters); if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Remove-EMPVResourceTag (UntagResource)")) { return; } var context = new CmdletContext(); // allow for manipulation of parameters prior to loading into context PreExecutionContextLoad(context); #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute if (ParameterWasBound(nameof(this.Select))) { context.Select = CreateSelectDelegate<Amazon.MediaPackageVod.Model.UntagResourceResponse, RemoveEMPVResourceTagCmdlet>(Select) ?? throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select)); if (this.PassThru.IsPresent) { throw new System.ArgumentException("-PassThru cannot be used when -Select is specified.", nameof(this.Select)); } } else if (this.PassThru.IsPresent) { context.Select = (response, cmdlet) => this.ResourceArn; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute context.ResourceArn = this.ResourceArn; #if MODULAR if (this.ResourceArn == null && ParameterWasBound(nameof(this.ResourceArn))) { WriteWarning("You are passing $null as a value for parameter ResourceArn which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif if (this.TagKey != null) { context.TagKey = new List<System.String>(this.TagKey); } #if MODULAR if (this.TagKey == null && ParameterWasBound(nameof(this.TagKey))) { WriteWarning("You are passing $null as a value for parameter TagKey which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif // allow further manipulation of loaded context prior to processing PostExecutionContextLoad(context); var output = Execute(context) as CmdletOutput; ProcessOutput(output); } #region IExecutor Members public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.MediaPackageVod.Model.UntagResourceRequest(); if (cmdletContext.ResourceArn != null) { request.ResourceArn = cmdletContext.ResourceArn; } if (cmdletContext.TagKey != null) { request.TagKeys = cmdletContext.TagKey; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return output; } public ExecutorContext CreateContext() { return new CmdletContext(); } #endregion #region AWS Service Operation Call private Amazon.MediaPackageVod.Model.UntagResourceResponse CallAWSServiceOperation(IAmazonMediaPackageVod client, Amazon.MediaPackageVod.Model.UntagResourceRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Elemental MediaPackage VOD", "UntagResource"); try { #if DESKTOP return client.UntagResource(request); #elif CORECLR return client.UntagResourceAsync(request).GetAwaiter().GetResult(); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } } #endregion internal partial class CmdletContext : ExecutorContext { public System.String ResourceArn { get; set; } public List<System.String> TagKey { get; set; } public System.Func<Amazon.MediaPackageVod.Model.UntagResourceResponse, RemoveEMPVResourceTagCmdlet, object> Select { get; set; } = (response, cmdlet) => null; } } }
{ "pile_set_name": "Github" }
// Place your settings in this file to overwrite default and user settings. { // Configure glob patterns for excluding files and folders in the file explorer. "files.exclude": { "**/.git": true, "**/.DS_Store": true, "**/bower_components": true, "**/coverage": true, "**/lib-amd": true, "src/**/*.scss.ts": true }, "typescript.tsdk": ".\\node_modules\\typescript\\lib" }
{ "pile_set_name": "Github" }
// -*- C++ -*- // =================================================================== /** * @file SL3_SecurityCurrent_Impl.h * * @author Ossama Othman <[email protected]> */ // =================================================================== #ifndef TAO_SL3_SECURITY_CURRENT_IMPL_H #define TAO_SL3_SECURITY_CURRENT_IMPL_H #include /**/ "ace/pre.h" #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "orbsvcs/Security/security_export.h" #include "orbsvcs/SecurityLevel3C.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { namespace SL3 { /** * @class SecurityCurrent_Impl * * @brief Base class for the TSS portion of any underlying * security mechanism. * * This class provides the same interface as the * SecurityLevel3::SecurityCurrent object. However, it is not * derived from that interface since we need to explicitly avoid * virtual inheritance so that it is safe to store subclasses in a * "void * *" and later cast that pointer back to the subclass * pointer type. */ class TAO_Security_Export SecurityCurrent_Impl { public: /// Destructor. virtual ~SecurityCurrent_Impl (void); /** * @name SecurityLevel3::Current Methods * * These methods are founds in the SecurityLevel3::Current * interface. */ //@{ /// Return the Credentials received from the client associate with /// the current request. virtual SecurityLevel3::ClientCredentials_ptr client_credentials () = 0; /// Is the current request local? virtual CORBA::Boolean request_is_local () = 0; //@} /// Return the unique tag that identifies the concrete subclass. virtual CORBA::ULong tag (void) const = 0; }; } // End Security namespace. } // End TAO namespace. TAO_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" #endif /* TAO_SL3_SECURITY_CURRENT_IMPL_H */
{ "pile_set_name": "Github" }
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { CommonModule as NgCommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { CommonModule } from '../../common/common.module'; import { LoginForm } from './login/login'; import { RegisterForm } from './register/register'; import { FbRegisterForm } from './fb-register/fb-register'; import { OnboardingForm } from './onboarding/onboarding'; import { Tutorial } from './tutorial/tutorial'; import { CaptchaModule } from '../captcha/captcha.module'; import { ExperimentsModule } from '../experiments/experiments.module'; import { PopoverComponent } from './popover-validation/popover.component'; @NgModule({ imports: [ NgCommonModule, CommonModule, RouterModule.forChild([]), FormsModule, ReactiveFormsModule, CaptchaModule, ExperimentsModule, ], declarations: [ LoginForm, RegisterForm, FbRegisterForm, OnboardingForm, Tutorial, PopoverComponent, ], exports: [ LoginForm, RegisterForm, FbRegisterForm, OnboardingForm, Tutorial, PopoverComponent, ], }) export class MindsFormsModule {}
{ "pile_set_name": "Github" }
// // MASConstraint.h // Masonry // // Created by Jonas Budelmann on 22/07/13. // Copyright (c) 2013 cloudling. All rights reserved. // #import "MASUtilities.h" /** * Enables Constraints to be created with chainable syntax * Constraint can represent single NSLayoutConstraint (MASViewConstraint) * or a group of NSLayoutConstraints (MASComposisteConstraint) */ @interface MASConstraint : NSObject // Chaining Support /** * Modifies the NSLayoutConstraint constant, * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight */ - (MASConstraint * (^)(MASEdgeInsets insets))insets; /** * Modifies the NSLayoutConstraint constant, * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following * NSLayoutAttributeWidth, NSLayoutAttributeHeight */ - (MASConstraint * (^)(CGSize offset))sizeOffset; /** * Modifies the NSLayoutConstraint constant, * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following * NSLayoutAttributeCenterX, NSLayoutAttributeCenterY */ - (MASConstraint * (^)(CGPoint offset))centerOffset; /** * Modifies the NSLayoutConstraint constant */ - (MASConstraint * (^)(CGFloat offset))offset; /** * Modifies the NSLayoutConstraint constant based on a value type */ - (MASConstraint * (^)(NSValue *value))valueOffset; /** * Sets the NSLayoutConstraint multiplier property */ - (MASConstraint * (^)(CGFloat multiplier))multipliedBy; /** * Sets the NSLayoutConstraint multiplier to 1.0/dividedBy */ - (MASConstraint * (^)(CGFloat divider))dividedBy; /** * Sets the NSLayoutConstraint priority to a float or MASLayoutPriority */ - (MASConstraint * (^)(MASLayoutPriority priority))priority; /** * Sets the NSLayoutConstraint priority to MASLayoutPriorityLow */ - (MASConstraint * (^)())priorityLow; /** * Sets the NSLayoutConstraint priority to MASLayoutPriorityMedium */ - (MASConstraint * (^)())priorityMedium; /** * Sets the NSLayoutConstraint priority to MASLayoutPriorityHigh */ - (MASConstraint * (^)())priorityHigh; /** * Sets the constraint relation to NSLayoutRelationEqual * returns a block which accepts one of the following: * MASViewAttribute, UIView, NSValue, NSArray * see readme for more details. */ - (MASConstraint * (^)(id attr))equalTo; /** * Sets the constraint relation to NSLayoutRelationGreaterThanOrEqual * returns a block which accepts one of the following: * MASViewAttribute, UIView, NSValue, NSArray * see readme for more details. */ - (MASConstraint * (^)(id attr))greaterThanOrEqualTo; /** * Sets the constraint relation to NSLayoutRelationLessThanOrEqual * returns a block which accepts one of the following: * MASViewAttribute, UIView, NSValue, NSArray * see readme for more details. */ - (MASConstraint * (^)(id attr))lessThanOrEqualTo; /** * Optional semantic property which has no effect but improves the readability of constraint */ - (MASConstraint *)with; /** * Optional semantic property which has no effect but improves the readability of constraint */ - (MASConstraint *)and; /** * Creates a new MASCompositeConstraint with the called attribute and reciever */ - (MASConstraint *)left; - (MASConstraint *)top; - (MASConstraint *)right; - (MASConstraint *)bottom; - (MASConstraint *)leading; - (MASConstraint *)trailing; - (MASConstraint *)width; - (MASConstraint *)height; - (MASConstraint *)centerX; - (MASConstraint *)centerY; - (MASConstraint *)baseline; #if TARGET_OS_IPHONE - (MASConstraint *)leftMargin; - (MASConstraint *)rightMargin; - (MASConstraint *)topMargin; - (MASConstraint *)bottomMargin; - (MASConstraint *)leadingMargin; - (MASConstraint *)trailingMargin; - (MASConstraint *)centerXWithinMargins; - (MASConstraint *)centerYWithinMargins; #endif /** * Sets the constraint debug name */ - (MASConstraint * (^)(id key))key; // NSLayoutConstraint constant Setters // for use outside of mas_updateConstraints/mas_makeConstraints blocks /** * Modifies the NSLayoutConstraint constant, * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight */ - (void)setInsets:(MASEdgeInsets)insets; /** * Modifies the NSLayoutConstraint constant, * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following * NSLayoutAttributeWidth, NSLayoutAttributeHeight */ - (void)setSizeOffset:(CGSize)sizeOffset; /** * Modifies the NSLayoutConstraint constant, * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following * NSLayoutAttributeCenterX, NSLayoutAttributeCenterY */ - (void)setCenterOffset:(CGPoint)centerOffset; /** * Modifies the NSLayoutConstraint constant */ - (void)setOffset:(CGFloat)offset; // NSLayoutConstraint Installation support #if TARGET_OS_MAC && !TARGET_OS_IPHONE /** * Whether or not to go through the animator proxy when modifying the constraint */ @property (nonatomic, copy, readonly) MASConstraint *animator; #endif /** * Activates an NSLayoutConstraint if it's supported by an OS. * Invokes install otherwise. */ - (void)activate; /** * Deactivates previously installed/activated NSLayoutConstraint. */ - (void)deactivate; /** * Creates a NSLayoutConstraint and adds it to the appropriate view. */ - (void)install; /** * Removes previously installed NSLayoutConstraint */ - (void)uninstall; @end /** * Convenience auto-boxing macros for MASConstraint methods. * * Defining MAS_SHORTHAND_GLOBALS will turn on auto-boxing for default syntax. * A potential drawback of this is that the unprefixed macros will appear in global scope. */ #define mas_equalTo(...) equalTo(MASBoxValue((__VA_ARGS__))) #define mas_greaterThanOrEqualTo(...) greaterThanOrEqualTo(MASBoxValue((__VA_ARGS__))) #define mas_lessThanOrEqualTo(...) lessThanOrEqualTo(MASBoxValue((__VA_ARGS__))) #define mas_offset(...) valueOffset(MASBoxValue((__VA_ARGS__))) #ifdef MAS_SHORTHAND_GLOBALS #define equalTo(...) mas_equalTo(__VA_ARGS__) #define greaterThanOrEqualTo(...) mas_greaterThanOrEqualTo(__VA_ARGS__) #define lessThanOrEqualTo(...) mas_lessThanOrEqualTo(__VA_ARGS__) #define offset(...) mas_offset(__VA_ARGS__) #endif @interface MASConstraint (AutoboxingSupport) /** * Aliases to corresponding relation methods (for shorthand macros) * Also needed to aid autocompletion */ - (MASConstraint * (^)(id attr))mas_equalTo; - (MASConstraint * (^)(id attr))mas_greaterThanOrEqualTo; - (MASConstraint * (^)(id attr))mas_lessThanOrEqualTo; /** * A dummy method to aid autocompletion */ - (MASConstraint * (^)(id offset))mas_offset; @end
{ "pile_set_name": "Github" }
{ "commentStamp" : "", "super" : "WAFileHandlerListing", "category" : "Seaside-Core-Libraries", "classinstvars" : [ ], "pools" : [ ], "classvars" : [ ], "instvars" : [ ], "name" : "WATextFileHandlerListing", "type" : "normal" }
{ "pile_set_name": "Github" }
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.
{ "pile_set_name": "Github" }
/* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2010 PCSX2 Dev Team * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. * * PCSX2 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 PCSX2. * If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "Dependencies.h" // -------------------------------------------------------------------------------------- // wxBaseTools.h // // This file is meant to contain utility classes for users of the wxWidgets library. // All classes in this file are strictly dependent on wxBase libraries only, meaning // you don't need to include or link against wxCore (GUI) to build them. For tools // which require wxCore, see wxGuiTools.h // -------------------------------------------------------------------------------------- extern void pxExplore(const wxString &path); extern void pxExplore(const char *path); extern void pxLaunch(const wxString &path); extern void pxLaunch(const char *path); // -------------------------------------------------------------------------------------- // wxDoNotLogInThisScope // -------------------------------------------------------------------------------------- // This class is used to disable wx's sometimes inappropriate amount of forced error logging // during specific activities. For example, when using wxDynamicLibrary to detect the // validity of DLLs, wx will log errors for missing symbols. (sigh) // // Usage: Basic auto-cleanup destructor class. Create an instance inside a scope, and // logging will be re-enabled when scope is terminated. :) // class wxDoNotLogInThisScope { DeclareNoncopyableObject(wxDoNotLogInThisScope); protected: bool m_prev; public: wxDoNotLogInThisScope() { m_prev = wxLog::EnableLogging(false); } virtual ~wxDoNotLogInThisScope() { wxLog::EnableLogging(m_prev); } }; extern wxString pxReadLine(wxInputStream &input); extern void pxReadLine(wxInputStream &input, wxString &dest); extern void pxReadLine(wxInputStream &input, wxString &dest, std::string &intermed); extern bool pxReadLine(wxInputStream &input, std::string &dest); extern void pxWriteLine(wxOutputStream &output); extern void pxWriteLine(wxOutputStream &output, const wxString &text); extern void pxWriteMultiline(wxOutputStream &output, const wxString &src);
{ "pile_set_name": "Github" }
package org.diez.examples.poodlesurfjava; import androidx.appcompat.app.AppCompatActivity; import android.graphics.drawable.PaintDrawable; import android.graphics.drawable.shapes.RectShape; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.airbnb.lottie.LottieAnimationView; import org.diez.poodleSurf.*; public class MainActivity extends AppCompatActivity { private DesignLanguage diez; private ModelMocks mocks; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); DesignLanguage designLanguage = new DesignLanguage(); new Diez<>(new DesignLanguage(), findViewById(android.R.id.content)).attach((DesignLanguage component) -> { runOnUiThread(() -> { diez = component; onDiezUpdated(); }); return null; }); new Diez<>(new ModelMocks(), findViewById(android.R.id.content)).attach((ModelMocks component) -> { runOnUiThread(() -> { mocks = component; onMocksUpdated(); }); return null; }); } private void onDiezUpdated () { System.out.println("======== DS updated ==========="); System.out.println(diez); View rootView = findViewById(R.id.root); int color = diez.getPalette().getBackground().getColor(); rootView.setBackgroundColor(color); Image image = diez.getDesigns().getReport().getHeader().getMapPinIcon(); ImageView imageView = findViewById(R.id.imageView); ImageKt.load(imageView, image); View backgroundImageView = findViewById(R.id.backgroundImageView); ImageKt.loadBackgroundImage(backgroundImageView, image); TextView textView = findViewById(R.id.textView); ImageKt.loadLeftDrawable(textView, image); Typograph typograph = diez.getTypographs().getHeaderTitle(); TypographKt.apply(textView, typograph); LinearGradient linearGradient = diez.getPalette().getContentBackground(); PaintDrawable drawable = new PaintDrawable(); drawable.setShape(new RectShape()); drawable.setShaderFactory(linearGradient.getShaderFactory()); View gradientView = findViewById(R.id.gradientView); gradientView.setBackground(drawable); Lottie lottie = diez.getDesigns().getLoading().getAnimation(); LottieAnimationView animationView = findViewById(R.id.animationView); LottieKt.load(animationView, lottie); Panel panel = diez.getDesigns().getReport().getSwell().getShared().getPanel(); PanelView panelView = findViewById(R.id.panelView); panelView.apply(panel); } private void onMocksUpdated () { System.out.println("======== Mocks updated ==========="); System.out.println(mocks); } }
{ "pile_set_name": "Github" }
<?php /** * Locale data for 'az_Cyrl'. * * This file is automatically generated by yiic cldr command. * * Copyright © 1991-2007 Unicode, Inc. All rights reserved. * Distributed under the Terms of Use in http://www.unicode.org/copyright.html. * * Copyright © 2008-2011 Yii Software LLC (http://www.yiiframework.com/license/) */ return array ( 'version' => '6546', 'numberSymbols' => array ( 'alias' => '', 'decimal' => '.', 'group' => ',', 'list' => ';', 'percentSign' => '%', 'plusSign' => '+', 'minusSign' => '-', 'exponential' => 'E', 'perMille' => '‰', 'infinity' => '∞', 'nan' => 'NaN', ), 'decimalFormat' => '#,##0.###', 'scientificFormat' => '#E0', 'percentFormat' => '#,##0%', 'currencyFormat' => '¤ #,##0.00', 'currencySymbols' => array ( 'AUD' => 'AU$', 'BRL' => 'R$', 'CAD' => 'CA$', 'CNY' => 'CN¥', 'EUR' => '€', 'GBP' => '£', 'HKD' => 'HK$', 'ILS' => '₪', 'INR' => '₹', 'JPY' => 'JP¥', 'KRW' => '₩', 'MXN' => 'MX$', 'NZD' => 'NZ$', 'THB' => '฿', 'TWD' => 'NT$', 'USD' => 'US$', 'VND' => '₫', 'XAF' => 'FCFA', 'XCD' => 'EC$', 'XOF' => 'CFA', 'XPF' => 'CFPF', 'AZN' => 'ман.', ), 'monthNames' => array ( 'wide' => array ( 1 => 'јанвар', 2 => 'феврал', 3 => 'март', 4 => 'апрел', 5 => 'май', 6 => 'ијун', 7 => 'ијул', 8 => 'август', 9 => 'сентјабр', 10 => 'октјабр', 11 => 'нојабр', 12 => 'декабр', ), 'abbreviated' => array ( 1 => 'yan', 2 => 'fev', 3 => 'mar', 4 => 'apr', 5 => 'may', 6 => 'iyn', 7 => 'iyl', 8 => 'avq', 9 => 'sen', 10 => 'okt', 11 => 'noy', 12 => 'dek', ), ), 'monthNamesSA' => array ( 'narrow' => array ( 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9', 10 => '10', 11 => '11', 12 => '12', ), ), 'weekDayNames' => array ( 'wide' => array ( 0 => 'базар', 1 => 'базар ертәси', 2 => 'чәршәнбә ахшамы', 3 => 'чәршәнбә', 4 => 'ҹүмә ахшамы', 5 => 'ҹүмә', 6 => 'шәнбә', ), 'abbreviated' => array ( 0 => 'B.', 1 => 'B.E.', 2 => 'Ç.A.', 3 => 'Ç.', 4 => 'C.A.', 5 => 'C', 6 => 'Ş.', ), ), 'weekDayNamesSA' => array ( 'narrow' => array ( 0 => '7', 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', ), ), 'eraNames' => array ( 'abbreviated' => array ( 0 => 'e.ə.', 1 => 'b.e.', ), 'wide' => array ( 0 => 'eramızdan əvvəl', 1 => 'bizim eramızın', ), 'narrow' => array ( 0 => 'e.ə.', 1 => 'b.e.', ), ), 'dateFormats' => array ( 'full' => 'EEEE, d, MMMM, y', 'long' => 'd MMMM , y', 'medium' => 'd MMM, y', 'short' => 'yy/MM/dd', ), 'timeFormats' => array ( 'full' => 'HH:mm:ss zzzz', 'long' => 'HH:mm:ss z', 'medium' => 'HH:mm:ss', 'short' => 'HH:mm', ), 'dateTimeFormat' => '{1} {0}', 'amName' => 'AM', 'pmName' => 'PM', 'orientation' => 'ltr', 'languages' => array ( 'aa' => 'afarca', 'ab' => 'abxazca', 'ace' => 'akin dili', 'ach' => 'akoli dili', 'ada' => 'adangme dili', 'ady' => 'aduge dili', 'ae' => 'avestanca', 'af' => 'Afrikaanca', 'afa' => 'afro-aziat dili', 'afh' => 'afrihili dili', 'ain' => 'aynuca', 'ak' => 'akanca', 'akk' => 'akadianca', 'ale' => 'aleutca', 'alg' => 'algonguyan dili', 'alt' => 'cənub altay dili', 'am' => 'amarikcə', 'an' => 'aragonca', 'ang' => 'qədimi ingiliscə', 'anp' => 'angikə dili', 'apa' => 'apaçi dili', 'ar' => 'Ərəbcə', 'arc' => 'aramik dili', 'arn' => 'araukanca', 'arp' => 'arapaho dili', 'art' => 'suni dil', 'arw' => 'aravakça', 'ast' => 'asturicə', 'ath' => 'atapaskanca', 'aus' => 'avstraliyca', 'av' => 'avarikcə', 'awa' => 'avadicə', 'ay' => 'aymarca', 'az' => 'Азәрбајҹан', 'ba' => 'başkir dili', 'bad' => 'banda dili', 'bai' => 'bamilek dili', 'bal' => 'baluc dili', 'ban' => 'balincə', 'bas' => 'basa dili', 'bat' => 'baltik dili', 'be' => 'belarusca', 'bej' => 'beja dili', 'bem' => 'bemba dili', 'ber' => 'berber dili', 'bg' => 'bolqarca', 'bh' => 'biharicə', 'bho' => 'bxoçpuri dili', 'bi' => 'bislama dili', 'bik' => 'bikolca', 'bin' => 'bini dili', 'bla' => 'siksikə dili', 'bm' => 'bambara dili', 'bn' => 'Benqal dili', 'bnt' => 'bantu dili', 'bo' => 'tibet dili', 'br' => 'Bretonca', 'bra' => 'braj dili', 'bs' => 'bosniya dili', 'btk' => 'batak dili', 'bua' => 'buryat dili', 'bug' => 'bugin dili', 'byn' => 'bilincə', 'ca' => 'katalanca', 'cad' => 'kado dili', 'cai' => 'mərkəzi amerika indus dili', 'car' => 'karib dili', 'cau' => 'qavqaz dili', 'cch' => 'atsamca', 'ce' => 'çeçen dili', 'ceb' => 'kebuano dili', 'cel' => 'kelt dili', 'ch' => 'çamoro dili', 'chb' => 'çibçə dili', 'chg' => 'çağatay dili', 'chk' => 'çukiz dili', 'chm' => 'mari dili', 'chn' => 'çinuk ləhçəsi', 'cho' => 'çoktau dili', 'chp' => 'çipevyan dili', 'chr' => 'çiroki dili', 'chy' => 'çeyen dili', 'cmc' => 'çamik dili', 'co' => 'korsikan dili', 'cop' => 'kopt dili', 'cpe' => 'inglis kreol dili', 'cpf' => 'fransız kreol dili', 'cpp' => 'portugal kreol dili', 'cr' => 'kri dili', 'crh' => 'krım türkçə', 'crp' => 'kreol dili', 'cs' => 'çex dili', 'csb' => 'kaşubyan dili', 'cu' => 'kilsə slav dili', 'cus' => 'kuşitik dili', 'cv' => 'çuvaş dili', 'cy' => 'uelscə', 'da' => 'danimarka dili', 'dak' => 'dakota dili', 'dar' => 'darqva dili', 'day' => 'dayak dili', 'de' => 'алманҹа', 'de_at' => 'almanca (AT)', 'de_ch' => 'isveç yüksək almancası', 'del' => 'delaver dili', 'den' => 'slavey', 'dgr' => 'doqrib dili', 'din' => 'dinka dili', 'doi' => 'doqri dili', 'dra' => 'dravid dili', 'dsb' => 'aşağı sorbca', 'dua' => 'duala dili', 'dum' => 'ortacaq hollandca', 'dv' => 'diveh dili', 'dyu' => 'dyula dili', 'dz' => 'dzonqa dili', 'ee' => 'eve dili', 'efi' => 'efik dili', 'egy' => 'qədimi misir dili', 'eka' => 'ekacuk dili', 'el' => 'yunanca', 'elx' => 'elamit dili', 'en' => 'инҝилисҹә', 'en_au' => 'ingiliscə (AU)', 'en_ca' => 'ingiliscə (CA)', 'en_gb' => 'ingiliscə (GB)', 'en_us' => 'ingiliscə (ABŞ)', 'enm' => 'ortacaq ingiliscə', 'eo' => 'esperanto dili', 'es' => 'испанҹа', 'es_419' => 'latın amerika ispancası', 'es_es' => 'iber-ispanca', 'et' => 'estonca', 'eu' => 'bask dili', 'ewo' => 'evondo dili', 'fa' => 'farsca', 'fan' => 'fang dili', 'fat' => 'fanti dili', 'ff' => 'fula dili', 'fi' => 'fincə', 'fil' => 'taqaloqca', 'fiu' => 'fin-uğri dili', 'fj' => 'fiji dili', 'fo' => 'farer dili', 'fon' => 'fon dili', 'fr' => 'франсызҹа', 'fr_ca' => 'fransızca (CA)', 'fr_ch' => 'isveç fransızca', 'frm' => 'ortacaq fransızca', 'fro' => 'qədimi fransızca', 'frr' => 'şimal fris dili', 'fur' => 'friul dili', 'fy' => 'frisk dili', 'ga' => 'irlandca', 'gaa' => 'qa dili', 'gay' => 'qayo dili', 'gba' => 'qabaya dili', 'gd' => 'skot gaelik dili', 'gem' => 'Alman dili', 'gez' => 'qez dili', 'gil' => 'qilbert gili', 'gl' => 'qalisian dili', 'gmh' => 'ortacaq yüksək almanca', 'gn' => 'quaranicə', 'goh' => 'qədimi almanca', 'gon' => 'qondi dili', 'gor' => 'qorontalo dili', 'got' => 'gotça', 'grb' => 'qrebo dili', 'grc' => 'qədimi yunanca', 'gsw' => 'isveç almanca', 'gu' => 'gujarati dili', 'gv' => 'manks dili', 'gwi' => 'qviçin dili', 'ha' => 'Hausa dili', 'hai' => 'hayda dili', 'haw' => 'Qavayca', 'he' => 'ivritcə', 'hi' => 'hindi dili', 'hil' => 'hiliqaynon dili', 'him' => 'himaçali dili', 'hit' => 'hittit dili', 'hmn' => 'monq dili', 'ho' => 'hiri motu dili', 'hr' => 'xorvatca', 'hsb' => 'yuxarı sorbca', 'ht' => 'haiti dili', 'hu' => 'macarca', 'hup' => 'hupa dili', 'hy' => 'Ermənicə', 'hz' => 'Herer dili', 'ia' => 'interlingua dili', 'iba' => 'iban dili', 'id' => 'indoneziya dili', 'ie' => 'interlingue dili', 'ig' => 'iqbo dili', 'ii' => 'siçuan yi dili', 'ijo' => 'ico dili', 'ik' => 'inupiaq dili', 'ilo' => 'iloko dili', 'inc' => 'diqər hint dili', 'ine' => 'hint-yevropa dili', 'inh' => 'inquş dili', 'io' => 'ido dili', 'ira' => 'iranca', 'iro' => 'irokuay dili', 'is' => 'isləndcə', 'it' => 'италјанҹа', 'iu' => 'inuktikut dili', 'ja' => 'јапонҹа', 'jbo' => 'loğban dili', 'jpr' => 'judo-farsca', 'jrb' => 'jude-ərəbcə', 'jv' => 'yavaca dili', 'ka' => 'gürcü dili', 'kaa' => 'qara-qalpaq dili', 'kab' => 'kabule dili', 'kac' => 'kaçinca', 'kaj' => 'ju dili', 'kam' => 'kamba dili', 'kar' => 'karen dili', 'kaw' => 'kavi dili', 'kbd' => 'kabardca', 'kcg' => 'tiyap dili', 'kfo' => 'koro dili', 'kg' => 'konqo dili', 'kha' => 'xazi dili', 'khi' => 'xoyzan dili', 'kho' => 'xotan dili', 'ki' => 'kikuyu dili', 'kj' => 'kuanyama dili', 'kk' => 'qazax dili', 'kl' => 'kalalisut dili', 'km' => 'kambodiya dili', 'kmb' => 'kimbundu dili', 'kn' => 'kannada dili', 'ko' => 'koreya dili', 'kok' => 'konkan dili', 'kos' => 'kosreyan dili', 'kpe' => 'kpelle dili', 'kr' => 'kanur dili', 'krc' => 'qaraçay-balkar dili', 'krl' => 'karelyan dili', 'kro' => 'kru dili', 'kru' => 'kurux dili', 'ks' => 'kəşmir dili', 'ku' => 'kürdcə', 'kum' => 'kumuk dili', 'kut' => 'kutenay dili', 'kv' => 'komi dili', 'kw' => 'korniş dili', 'ky' => 'qırğızca', 'la' => 'latınca', 'lad' => 'ladin dili', 'lah' => 'laxnda dili', 'lam' => 'lamba dili', 'lb' => 'luksemburq dili', 'lez' => 'ləzqi dili', 'lg' => 'qanda dili', 'li' => 'limburqiş dili', 'ln' => 'Linqala dili', 'lo' => 'laos dili', 'lol' => 'monqo dili', 'loz' => 'lozi dili', 'lt' => 'litva dili', 'lu' => 'luba-katanqa dili', 'lua' => 'luba-lulua dili', 'lui' => 'luyseno dili', 'lun' => 'lunda dili', 'luo' => 'luo dili', 'lus' => 'lushayca', 'lv' => 'latışca', 'mad' => 'maduriz dili', 'mag' => 'maqahi dili', 'mai' => 'maitili dili', 'mak' => 'makasar dili', 'man' => 'məndinqo dili', 'map' => 'avstronezicə', 'mas' => 'masay dili', 'mdf' => 'mokşa dili', 'mdr' => 'mandar dili', 'men' => 'mende dili', 'mg' => 'malaqas dili', 'mga' => 'ortacaq irlandca', 'mh' => 'marşal dili', 'mi' => 'maori dili', 'mic' => 'mikmak dili', 'min' => 'minanqkaban dili', 'mis' => 'çeşitli diller', 'mk' => 'makedoniya dili', 'mkh' => 'mon-xmer dili', 'ml' => 'malayalamca', 'mn' => 'monqolca', 'mnc' => 'mançu dili', 'mni' => 'manipüri dili', 'mno' => 'manobo dili', 'mo' => 'moldavca', 'moh' => 'moxak dili', 'mos' => 'mosi dili', 'mr' => 'marati dili', 'ms' => 'malayca', 'mt' => 'malta dili', 'mul' => 'digər dillər', 'mun' => 'munda dili', 'mus' => 'krik dili', 'mwl' => 'mirand dili', 'mwr' => 'maruari dili', 'my' => 'burmis dili', 'myn' => 'maya dili', 'myv' => 'erzya dili', 'na' => 'nauru dili', 'nah' => 'nahuatl dili', 'nai' => 'şimal amerika yerli dili', 'nap' => 'neapolital dili', 'nb' => 'norvec bokmal dili', 'nd' => 'şimal ndebele dili', 'nds' => 'aşağı almanca', 'ne' => 'nepalca', 'new' => 'nevari dili', 'ng' => 'nqonka dili', 'nia' => 'nyas dili', 'nic' => 'niger-kordofyan dili', 'niu' => 'niyuan dili', 'nl' => 'hollandca', 'nl_be' => 'flem dili', 'nn' => 'norveç ninorsk dili', 'no' => 'norveç dili', 'nog' => 'noqay dili', 'non' => 'qədimi norsca', 'nqo' => 'nqo dili', 'nr' => 'cənub ndebele dili', 'nso' => 'şimal soto dili', 'nub' => 'nubiy dili', 'nv' => 'navayo dili', 'ny' => 'nyanca dili', 'nym' => 'nyamvezi dili', 'nyn' => 'nyankol dili', 'nyo' => 'niyoro dili', 'nzi' => 'nizima dili', 'oc' => 'oksitanca', 'oj' => 'ocibva dili', 'om' => 'oromo dili', 'or' => 'Oriyə dili', 'os' => 'osetik dili', 'osa' => 'osage dili', 'ota' => 'osman dili', 'oto' => 'otomian dili', 'pa' => 'puncab dili', 'paa' => 'papua dili', 'pag' => 'panqasinan dili', 'pal' => 'paxlavi dili', 'pam' => 'pampanqa dili', 'pap' => 'papyamento dili', 'pau' => 'palayanca', 'peo' => 'qədimi farsca', 'phi' => 'filipin dili', 'phn' => 'foyenik dili', 'pi' => 'pali dili', 'pl' => 'Polish dili', 'pon' => 'ponpeyan dili', 'pra' => 'prakrit dili', 'pro' => 'qədimi provensialca', 'ps' => 'Puştu dili', 'pt' => 'португалҹа', 'pt_pt' => 'İber portuqalca', 'qu' => 'kuechya dili', 'raj' => 'racastan dili', 'rap' => 'rapanu dili', 'rar' => 'rarotonqan dili', 'rn' => 'rundi dili', 'ro' => 'rumın', 'rom' => 'roman dili', 'root' => 'rut dili', 'ru' => 'русҹа', 'rup' => 'aromanca', 'rw' => 'kinyarvanda dili', 'sa' => 'Sanskrit dili', 'sad' => 'sandave dili', 'sah' => 'yakut dili', 'sai' => 'cənub amerika yerli dili', 'sal' => 'salişan dili', 'sam' => 'samaritan dili', 'sas' => 'sasak dili', 'sat' => 'santal dili', 'sc' => 'sardin dili', 'scn' => 'sisili dili', 'sco' => 'skots dili', 'sd' => 'sindhi dili', 'se' => 'şimal sami dili', 'sel' => 'selkup dili', 'sem' => 'ivrit dili', 'sg' => 'sanqo dili', 'sga' => 'qədimi irlandca', 'sgn' => 'işarət dili', 'sh' => 'serb-xorvatca', 'shn' => 'şan dili', 'si' => 'sinhaliscə', 'sid' => 'sidamo dili', 'sio' => 'sioyan dili', 'sit' => 'sino-tibet dili', 'sk' => 'slovakca', 'sl' => 'slovencə', 'sla' => 'slav dili', 'sm' => 'samoa dili', 'sma' => 'cənub sami dili', 'smi' => 'səmi dili', 'smj' => 'lule sami dili', 'smn' => 'inari sami', 'sms' => 'skolt dili', 'sn' => 'şona dili', 'snk' => 'soninke dili', 'so' => 'somali dili', 'sog' => 'soqdiyen dili', 'son' => 'sonqay dili', 'sq' => 'Albanca', 'sr' => 'serb dili', 'srn' => 'sranan tonqo dili', 'srr' => 'serer dilii', 'ss' => 'svati dili', 'ssa' => 'nilo-sahara dili', 'st' => 'Sesoto dili', 'su' => 'sundanca', 'suk' => 'sukuma dili', 'sus' => 'susu dili', 'sux' => 'sumeryan dili', 'sv' => 'isveçcə', 'sw' => 'suahilicə', 'syr' => 'siryak dili', 'ta' => 'tamilcə', 'tai' => 'tay dili', 'te' => 'teluqu dili', 'tem' => 'timne dili', 'ter' => 'tereno dili', 'tet' => 'tetum dili', 'tg' => 'tacik dili', 'th' => 'tayca', 'ti' => 'tiqrin dili', 'tig' => 'tiqre dili', 'tiv' => 'tiv dili', 'tk' => 'türkməncə', 'tkl' => 'tokelay dili', 'tl' => 'taqaloq dili', 'tlh' => 'klinqon', 'tli' => 'tlinqit dili', 'tmh' => 'tamaşek dili', 'tn' => 'svana dili', 'to' => 'tonqa dili', 'tog' => 'niyasa tonga dili', 'tpi' => 'tok pisin dili', 'tr' => 'türkcə', 'ts' => 'sonqa dili', 'tsi' => 'simşyan dili', 'tt' => 'tatarca', 'tum' => 'tumbuka dili', 'tup' => 'tupi dili', 'tut' => 'altaik dili', 'tvl' => 'tuvalu dili', 'tw' => 'Tvi dili', 'ty' => 'taxiti dili', 'tyv' => 'tuvinyan dili', 'udm' => 'udmurt dili', 'ug' => 'uyğurca', 'uga' => 'uqaritik dili', 'uk' => 'ukraynaca', 'umb' => 'umbundu dili', 'und' => 'bilinməyən vəya gəcərsiz dil', 'ur' => 'urduca', 'uz' => 'özbəkcə', 'vai' => 'vay dili', 've' => 'venda dili', 'vi' => 'vyetnamca', 'vo' => 'volapük dili', 'vot' => 'votik dili', 'wa' => 'valun dili', 'wak' => 'vakaşan dili', 'wal' => 'valamo dili', 'war' => 'varay dili', 'was' => 'vaşo dili', 'wen' => 'sorb dili', 'wo' => 'volof dili', 'xal' => 'kalmıqca', 'xh' => 'xosa dili', 'yao' => 'yao dili', 'yap' => 'yapiz dili', 'yi' => 'Yahudi dili', 'yo' => 'yoruba dili', 'ypk' => 'yupik dili', 'za' => 'juənq dili', 'zap' => 'zapotek dili', 'zbl' => 'blisimbols dili', 'zen' => 'zenaqa dili', 'zh' => 'чинҹә', 'zh_hans' => 'adi çincə', 'zh_hant' => 'gələnəksəl çincə', 'znd' => 'zande dili', 'zu' => 'zulu dili', 'zun' => 'zuni dili', 'zza' => 'zaza dili', ), 'scripts' => array ( 'arab' => 'ərəb', 'armi' => 'armi', 'armn' => 'erməni', 'avst' => 'avestan', 'bali' => 'bali', 'batk' => 'batak', 'beng' => 'benqal', 'blis' => 'blissymbols', 'bopo' => 'Bopomofo', 'brah' => 'brahmi', 'brai' => 'kor yazısı', 'bugi' => 'buqin', 'buhd' => 'buhid', 'cakm' => 'kakm', 'cans' => 'birləşmiş kanada yerli yazısı', 'cari' => 'kariyan', 'cham' => 'çam', 'cher' => 'çiroki', 'cirt' => 'sirt', 'copt' => 'koptik', 'cprt' => 'kipr', 'cyrl' => 'kiril', 'cyrs' => 'qədimi kilsa kirili', 'deva' => 'devanagari', 'dsrt' => 'deseret', 'egyd' => 'misir demotik', 'egyh' => 'misir hiyeratik', 'egyp' => 'misir hiyeroqlif', 'ethi' => 'efiopiya', 'geok' => 'gürcü xutsuri', 'geor' => 'gürcü', 'glag' => 'qlaqolitik', 'goth' => 'qotik', 'grek' => 'yunan', 'gujr' => 'qucarat', 'guru' => 'qurmuxi', 'hang' => 'hanqul', 'hani' => 'han', 'hano' => 'hanunu', 'hans' => 'basitləştirilmiş han', 'hant' => 'qədimi han', 'hebr' => 'yahudi', 'hira' => 'iragana', 'hmng' => 'pahav monq', 'hrkt' => 'katakana vəya hiraqana', 'hung' => 'qədimi macar', 'inds' => 'hindistan', 'ital' => 'qədimi italyalı', 'java' => 'cava', 'jpan' => 'yapon', 'kali' => 'kayax li', 'kana' => 'katakana', 'khar' => 'xaroşti', 'khmr' => 'xmer', 'knda' => 'kannada', 'kore' => 'korean', 'kthi' => 'kti', 'lana' => 'lanna', 'laoo' => 'lao', 'latf' => 'fraktur latını', 'latg' => 'gael latını', 'latn' => 'latın', 'lepc' => 'lepçə', 'limb' => 'limbu', 'lyci' => 'lusian', 'lydi' => 'ludian', 'mand' => 'mandayen', 'mani' => 'maniçayen', 'maya' => 'maya hiyeroqlifi', 'mero' => 'meroytik', 'mlym' => 'malayalam', 'mong' => 'monqol', 'moon' => 'mun', 'mtei' => 'meytey mayek', 'mymr' => 'miyanmar', 'nkoo' => 'nko', 'ogam' => 'oğam', 'olck' => 'ol çiki', 'orkh' => 'orxon', 'orya' => 'oriya', 'osma' => 'osmanya', 'perm' => 'qədimi permik', 'phag' => 'faqs-pa', 'phli' => 'fli', 'phlp' => 'flp', 'phlv' => 'kitab paxlavi', 'phnx' => 'foenik', 'plrd' => 'polard fonetik', 'prti' => 'prti', 'rjng' => 'recəng', 'roro' => 'ronqoronqo', 'runr' => 'runik', 'samr' => 'samaritan', 'sara' => 'sarati', 'saur' => 'saurastra', 'sgnw' => 'işarət yazısı', 'shaw' => 'şavyan', 'sinh' => 'sinhala', 'sund' => 'sundan', 'sylo' => 'siloti nəqri', 'syrc' => 'siryak', 'syre' => 'estrangela süryanice', 'tagb' => 'taqbanva', 'tale' => 'tay le', 'talu' => 'təzə tay lu', 'taml' => 'tamil', 'tavt' => 'tavt', 'telu' => 'telugu', 'teng' => 'tengvar', 'tfng' => 'tifinaq', 'tglg' => 'taqaloq', 'thaa' => 'txana', 'thai' => 'tay', 'tibt' => 'tibet', 'ugar' => 'uqarit', 'vaii' => 'vay', 'visp' => 'danışma səsləri', 'xpeo' => 'qədimi fars', 'xsux' => 'sumer-akadyan kuneyform', 'yiii' => 'yi', 'zmth' => 'zmth', 'zsym' => 'zsym', 'zxxx' => 'yazısız', 'zyyy' => 'adi yazi', 'zzzz' => 'bilinməyən veya gəcərsiz', ), 'territories' => array ( '001' => 'Dünya', '002' => 'Afrika', '003' => 'Şimal Amerika', '005' => 'Cənub Amerika', '009' => 'Okeyaniya', '011' => 'Qərb afrika', '013' => 'Orta Amerika', '014' => 'Şərq Afrika', '015' => 'Şimal Afrika', '017' => 'Orta Afrika', '019' => 'Amerikalar', '029' => 'Kariyıplar', '030' => 'Şərq Asiya', '034' => 'Cənub Asiya', '035' => 'Cənub Şərq Asiya', '039' => 'Cənub Avropa', '053' => 'Avstraliya və Yeni Zelandiya', '054' => 'Melanesya', '057' => 'Mikronesiya reqionu', '061' => 'Polineziya', 142 => 'Aziya', 143 => 'Orta Aziya', 145 => 'Qərb Asiya', 150 => 'Avropa', 151 => 'Şərq Avropa', 154 => 'Şimal Avropa', 155 => 'Qərb Avropa', 419 => 'Latın Amerikası', 'ad' => 'Andorra', 'ae' => 'Birləşmiş Ərəb Emiratları', 'af' => 'Əfqənistan', 'ag' => 'Antiqua və Barbuda', 'ai' => 'Anquila', 'al' => 'Albaniya', 'am' => 'Ermənistan', 'an' => 'Hollandiya antilleri', 'ao' => 'Angola', 'aq' => 'Antarktika', 'ar' => 'Arqentina', 'as' => 'Amerika Samoası', 'at' => 'Avstriya', 'au' => 'Avstraliya', 'aw' => 'Aruba', 'ax' => 'Aland Adaları', 'az' => 'Азәрбајҹан', 'ba' => 'Bosniya və Herzokovina', 'bb' => 'Barbados', 'bd' => 'Banqladeş', 'be' => 'Belçika', 'bf' => 'Burkina Faso', 'bg' => 'Bolqariya', 'bh' => 'Bahreyn', 'bi' => 'Burundi', 'bj' => 'Benin', 'bl' => 'Seynt Bartelemey', 'bm' => 'Bermuda', 'bn' => 'Bruney', 'bo' => 'Boliviya', 'br' => 'Бразилија', 'bs' => 'Bahamalar', 'bt' => 'Butan', 'bv' => 'Bove Adası', 'bw' => 'Botsvana', 'by' => 'Belarus', 'bz' => 'Beliz', 'ca' => 'Kanada', 'cc' => 'Kokos Adaları', 'cd' => 'Konqo - Kinşasa', 'cf' => 'Orta Afrika respublikası', 'cg' => 'Konqo - Brazavil', 'ch' => 'isveçriya', 'ci' => 'İvori Sahili', 'ck' => 'Kuk Adaları', 'cl' => 'Çile', 'cm' => 'Kamerun', 'cn' => 'Чин', 'co' => 'Kolumbiya', 'cr' => 'Kosta Rika', 'cu' => 'Kuba', 'cv' => 'Kape Verde', 'cx' => 'Çristmas Adası', 'cy' => 'Kipr', 'cz' => 'Çex respublikası', 'de' => 'Алманија', 'dj' => 'Ciboti', 'dk' => 'Danemarka', 'dm' => 'Dominika', 'do' => 'Dominik Respublikası', 'dz' => 'Cezayır', 'ec' => 'Ekvador', 'ee' => 'Estoniya', 'eg' => 'Misir', 'eh' => 'Qərb Sahara', 'er' => 'Eritreya', 'es' => 'İspaniya', 'et' => 'Efiopiya', 'eu' => 'Avropa Birləşliyi', 'fi' => 'Finlandiya', 'fj' => 'Fici', 'fk' => 'Folkland Adaları', 'fm' => 'Mikronesiya', 'fo' => 'Faro Adaları', 'fr' => 'Франса', 'ga' => 'Qabon', 'gb' => 'Birləşmiş Krallıq', 'gd' => 'Qrenada', 'ge' => 'Gürcüstan', 'gf' => 'Fransız Quyanası', 'gg' => 'Görnsey', 'gh' => 'Qana', 'gi' => 'Gibraltar', 'gl' => 'Qrinland', 'gm' => 'Qambiya', 'gn' => 'Qvineya', 'gp' => 'Qvadalup', 'gq' => 'Ekvator Qineya', 'gr' => 'Yunanıstan', 'gs' => 'Cənub Gürcüstan və Cənub Sandvilç Adaları', 'gt' => 'Qvatemala', 'gu' => 'Quam', 'gw' => 'Qvineya-Bisau', 'gy' => 'Quyana', 'hk' => 'Honk Konq', 'hm' => 'Hörd və Makdonald Adaları', 'hn' => 'Qonduras', 'hr' => 'Xorvatiya', 'ht' => 'Haiti', 'hu' => 'Macaristan', 'id' => 'İndoneziya', 'ie' => 'İrlandiya', 'il' => 'İzrail', 'im' => 'Man Adası', 'in' => 'Һиндистан', 'io' => 'Britaniya-Hindistan Okeanik territoriyası', 'iq' => 'İrak', 'ir' => 'İran', 'is' => 'İslandiya', 'it' => 'Италија', 'je' => 'Cörsi', 'jm' => 'Yamayka', 'jo' => 'Ürdün', 'jp' => 'Јапонија', 'ke' => 'Kenya', 'kg' => 'Kırqızstan', 'kh' => 'Kambodiya', 'ki' => 'Kiribati', 'km' => 'Komoros', 'kn' => 'Seynt Kits və Nevis', 'kp' => 'Şimal Koreya', 'kr' => 'Cənub Koreya', 'kw' => 'Kuveyt', 'ky' => 'Kayman Adaları', 'kz' => 'Kazaxstan', 'la' => 'Laos', 'lb' => 'Lebanon', 'lc' => 'Seynt Lusiya', 'li' => 'Lixtenşteyn', 'lk' => 'Şri Lanka', 'lr' => 'Liberiya', 'ls' => 'Lesoto', 'lt' => 'Litva', 'lu' => 'Lüksemburq', 'lv' => 'Latviya', 'ly' => 'Libya', 'ma' => 'Morokko', 'mc' => 'Monako', 'md' => 'Moldova', 'me' => 'Monteneqro', 'mf' => 'Seynt Martin', 'mg' => 'Madaqaskar', 'mh' => 'Marşal Adaları', 'mk' => 'Masedoniya', 'ml' => 'Mali', 'mm' => 'Myanmar', 'mn' => 'Monqoliya', 'mo' => 'Makao', 'mp' => 'Şimal Mariana Adaları', 'mq' => 'Martiniqu', 'mr' => 'Mavritaniya', 'ms' => 'Montserat', 'mt' => 'Malta', 'mu' => 'Mavritis', 'mv' => 'Maldiv', 'mw' => 'Malavi', 'mx' => 'Meksika', 'my' => 'Malaysiya', 'mz' => 'Mazambik', 'na' => 'Namibiya', 'nc' => 'Yeni Kaledoniya', 'ne' => 'nijer', 'nf' => 'Norfolk Adası', 'ng' => 'Nijeriya', 'ni' => 'Nikaraqua', 'nl' => 'Hollandiya', 'no' => 'Norvec', 'np' => 'Nepal', 'nr' => 'Nauru', 'nu' => 'Niye', 'nz' => 'Yeni Zelandiya', 'om' => 'Oman', 'pa' => 'Panama', 'pe' => 'Peru', 'pf' => 'Fransız Polineziya', 'pg' => 'Papua Yeni Qvineya', 'ph' => 'Filipin', 'pk' => 'Pakistan', 'pl' => 'Polşa', 'pm' => 'Seynt Piyer və Mikelon', 'pn' => 'Pitkarn', 'pr' => 'Puerto Riko', 'ps' => 'Fələstin Bölqüsü', 'pt' => 'Portuqal', 'pw' => 'Palav', 'py' => 'Paraqvay', 'qa' => 'Qatar', 'qo' => 'Uzak Okeyaniya', 're' => 'Reyunion', 'ro' => 'Romaniya', 'rs' => 'Serbiya', 'ru' => 'Русија', 'rw' => 'Rvanda', 'sa' => 'Saudi Ərəbistan', 'sb' => 'Solomon Adaları', 'sc' => 'Seyçels', 'sd' => 'sudan', 'se' => 'isveç', 'sg' => 'Sinqapur', 'sh' => 'Seynt Elena', 'si' => 'Sloveniya', 'sj' => 'svalbard və yan mayen', 'sk' => 'Slovakiya', 'sl' => 'Siyera Leon', 'sm' => 'San Marino', 'sn' => 'Seneqal', 'so' => 'Somaliya', 'sr' => 'surinamə', 'st' => 'Sao Tom və Prinsip', 'sv' => 'El Salvador', 'sy' => 'siriya', 'sz' => 'svazilənd', 'tc' => 'Türk və Kaykos Adaları', 'td' => 'Çad', 'tf' => 'Fransız Cənub teritoriyası', 'tg' => 'Toqo', 'th' => 'tayland', 'tj' => 'tacikistan', 'tk' => 'Tokelau', 'tl' => 'Şərq Timor', 'tm' => 'Türkmənistan', 'tn' => 'Tunisiya', 'to' => 'Tonqa', 'tr' => 'Türkiya', 'tt' => 'Trinidan və Tobaqo', 'tv' => 'Tuvalu', 'tw' => 'tayvan', 'tz' => 'tanzaniya', 'ua' => 'Ukraina', 'ug' => 'Uqanda', 'um' => 'Birləşmiş Ştatların uzaq adaları', 'us' => 'Америка Бирләшмиш Штатлары', 'uy' => 'Uruqvay', 'uz' => 'Özbəkistan', 'va' => 'Vatikan', 'vc' => 'Seynt Vinsent və Qrenada', 've' => 'Venesuela', 'vg' => 'Britaniya Virgin Adaları', 'vi' => 'ABŞ Virqin Adaları', 'vn' => 'Vyetnam', 'vu' => 'Vanuatu', 'wf' => 'Valis və Futuna', 'ws' => 'Samoa', 'ye' => 'Yemen', 'yt' => 'Mayot', 'za' => 'Cənub Afrika', 'zm' => 'Zambiya', 'zw' => 'Zimbabve', 'zz' => 'bilinmir', ), );
{ "pile_set_name": "Github" }
<div class="modal-header"> <h3 class="modal-title">Please select the category</h3> </div> <div class="modal-body" style="text-align: left"> <ul> <li> <a href="#" ng-click="$event.preventDefault(); select('')">No category</a> </li> <li ng-repeat="category in categories"> <a href="#" ng-click="$event.preventDefault(); select(category)">{{ category }}</a> </li> </ul> </div>
{ "pile_set_name": "Github" }
/* * Copyright 2013 the original author or 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 org.gradle.nativeplatform.toolchain.internal; import org.gradle.api.Action; import org.gradle.api.internal.file.FileResolver; import org.gradle.internal.os.OperatingSystem; import org.gradle.listener.ActionBroadcast; import org.gradle.nativeplatform.toolchain.NativePlatformToolChain; import java.io.File; public abstract class ExtendableToolChain<T extends NativePlatformToolChain> implements NativeToolChainInternal { private final String name; protected final OperatingSystem operatingSystem; private final FileResolver fileResolver; protected final ActionBroadcast<T> configureActions = new ActionBroadcast<T>(); protected ExtendableToolChain(String name, OperatingSystem operatingSystem, FileResolver fileResolver) { this.name = name; this.operatingSystem = operatingSystem; this.fileResolver = fileResolver; } public String getName() { return name; } protected abstract String getTypeName(); public String getDisplayName() { return String.format("Tool chain '%s' (%s)", getName(), getTypeName()); } @Override public String toString() { return getDisplayName(); } public String getOutputType() { return String.format("%s-%s", getName(), operatingSystem.getName()); } public void eachPlatform(Action<? super T> action) { configureActions.add(action); } protected File resolve(Object path) { return fileResolver.resolve(path); } }
{ "pile_set_name": "Github" }
<?php use yii\helpers\Html; use yii\web\View; /** @var $this View */ /** @var $id string */ /** @var $services stdClass[] See EAuth::getServices() */ /** @var $action string */ /** @var $popup bool */ /** @var $assetBundle string Alias to AssetBundle */ Yii::createObject(['class' => $assetBundle])->register($this); // Open the authorization dilalog in popup window. if ($popup) { $options = []; foreach ($services as $name => $service) { $options[$service->id] = $service->jsArguments; } $this->registerJs('$("#' . $id . '").eauth(' . json_encode($options) . ');'); } ?> <div class="eauth" id="<?php echo $id; ?>"> <ul class="eauth-list"> <?php foreach ($services as $name => $service) { echo '<li class="eauth-service eauth-service-id-' . $service->id . '">'; echo Html::a($service->title, [$action, 'service' => $name], [ 'class' => 'eauth-service-link', 'data-eauth-service' => $service->id, ]); echo '</li>'; } ?> </ul> </div>
{ "pile_set_name": "Github" }
e5a0b5cc530260b1ee94105e8c989ba21856b4a2 Use pipes instead of socketpair in SFTP diff --git a/sftp.c b/sftp.c index 2799e4a1..9ce7055a 100644 --- a/sftp.c +++ b/sftp.c @@ -2296,6 +2296,10 @@ interactive_loop(struct sftp_conn *conn, char *file1, char *file2) return (err >= 0 ? 0 : -1); } +#ifdef __serenity__ +#define USE_PIPES 1 +#endif + static void connect_to_server(char *path, char **args, int *in, int *out) {
{ "pile_set_name": "Github" }
/* * Tigase XMPP Server - The instant messaging server * Copyright (C) 2004 Tigase, Inc. ([email protected]) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, version 3 of the License. * * 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. Look for COPYING file in the top folder. * If not, see http://www.gnu.org/licenses/. */ package tigase.io; import tigase.annotations.TigaseDeprecated; import tigase.server.Lifecycle; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import java.io.File; import java.io.IOException; import java.nio.ByteOrder; import java.security.KeyStore; import java.security.cert.CertificateParsingException; import java.util.Map; /** * Describe interface SSLContextContainerIfc here. * <br> * Created: Tue Nov 20 11:43:32 2007 * * @author <a href="mailto:[email protected]">Artur Hefczyc</a> */ public interface SSLContextContainerIfc extends Lifecycle { /** * Constant <code>ALLOW_INVALID_CERTS_KEY</code> is a key pointing to a configuration parameters specyfying if * invalid certificates are acceptable by the server. Invalid certificates are expired ones or certificates issued * for a different domain. This should be really set to <code>false</code> in any real deployment and can be set ot * <code>true</code> in development invironment. */ String ALLOW_INVALID_CERTS_KEY = "allow-invalid-certs"; /** * Constant <code>ALLOW_INVALID_CERTS_VAL</code> is a default configuration parameter specifying if invalid * certificates are acceptable by the server. */ String ALLOW_INVALID_CERTS_VAL = "false"; /** * Constant <code>ALLOW_SELF_SIGNED_CERTS_KEY</code> is a key pointing to a configuration parameter specifying if * self-signed certificates are acceptable for the server. */ String ALLOW_SELF_SIGNED_CERTS_KEY = "allow-self-signed-certs"; /** * Constant <code>ALLOW_SELF_SIGNED_CERTS_VAL</code> is a default configuration value specifying if self-signed * certificates are allowed by the server. */ String ALLOW_SELF_SIGNED_CERTS_VAL = "true"; String CERT_ALIAS_KEY = "cert-alias"; String CERT_SAVE_TO_DISK_KEY = "cert-save-to-disk"; /** * Constant <code>DEFAULT_DOMAIN_CERT_KEY</code> is a key pointing to the domain with default certificate. */ String DEFAULT_DOMAIN_CERT_KEY = "ssl-def-cert-domain"; /** * Constant <code>DEFAULT_DOMAIN_CERT_VAL</code> keeps default value for a domain with default certificate. */ String DEFAULT_DOMAIN_CERT_VAL = "default"; /** * Constant <code>JKS_KEYSTORE_FILE_KEY</code> is a key pointing to a JKS keystore file. */ String JKS_KEYSTORE_FILE_KEY = "keys-store"; /** * Constant <code>JKS_KEYSTORE_FILE_VAL</code> keeps default value for a JKS keystore file. */ String JKS_KEYSTORE_FILE_VAL = "certs" + File.separator + "rsa-keystore"; /** * Constant <code>JKS_KEYSTORE_PWD_KEY</code> is a key pointing to a private key password, */ String JKS_KEYSTORE_PWD_KEY = "keys-store-password"; /** * Constant <code>JKS_KEYSTORE_PWD_VAL</code> is a default private key password. */ String JKS_KEYSTORE_PWD_VAL = "keystore"; String PEM_CERTIFICATE_KEY = "pem-certificate"; /** * Constant <code>SERVER_CERTS_DIR_KEY</code> is a key pointing to a configuration parameter with directory names * where all server certificates are stored. This can be a comma separated list of directories, instead of a single * directory name. Certificates are stored in <code>*.pem</code> files where the first part of the file name is a * domain name i.e.: <code>yourdomain.com.pem</code>. There is one exception though. The file named * <code>default.pem</code> stores a certificate which is a default certificate for the server if certificate for * specific domain is missing. */ String SERVER_CERTS_LOCATION_KEY = "ssl-certs-location"; /** * Constant <code>SERVER_CERTS_DIR_VAL</code> is a default directory name where all certificate files are stored. */ String SERVER_CERTS_LOCATION_VAL = "certs/"; /** * Constant <code>SSL_CONTAINER_CLASS_KEY</code> is a key pointing to a container implementation class. The class is * loaded at startup time and initialized using configuration parameters. Some container implementations may accept * different parameters set. Please refer to the implementation for more details. */ String SSL_CONTAINER_CLASS_KEY = "ssl-container-class"; /** * Constant <code>SSL_CONTAINER_CLASS_VAL</code> keeps default container implementation class loaded if none is * specified in configuration file. */ String SSL_CONTAINER_CLASS_VAL = SSLContextContainer.class.getName(); /** * Constant <code>TRUSTED_CERTS_DIR_KEY</code> is a key pointing to a configuration parameter where all trusted * certificates are stored. This can be a comma separated list of directories. */ String TRUSTED_CERTS_DIR_KEY = "trusted-certs-dir"; /** * Constant <code>TRUSTED_CERTS_DIR_VAL</code> is a default directory name where all trusted certificates are * stored. */ String TRUSTED_CERTS_DIR_VAL = "/etc/ssl/certs"; /** * Constant <code>TRUSTSTORE_FILE_KEY</code> is a key pointing to a trust store file. */ String TRUSTSTORE_FILE_KEY = "trusts-store"; /** * Constant <code>TRUSTSTORE_FILE_VAL</code> is a default truststore file. */ String TRUSTSTORE_FILE_VAL = "certs" + File.separator + "truststore"; /** * Constant <code>TRUSTSTORE_PWD_KEY</code> is a key pointing to a trustore file password. */ String TRUSTSTORE_PWD_KEY = "trusts-store-password"; /** * Constant <code>TRUSTSTORE_PWD_VAL</code> is a default password for truststore file. */ String TRUSTSTORE_PWD_VAL = "truststore"; // ~--- methods // -------------------------------------------------------------- /** * Method <code>addCertificates</code> allows to add more certificates at run time after the container has bee * already initialized. This is to avoid server restart if there are certificates updates or new certificates for * new virtual domain. The method should add new certificates or replace existing one if there is already a * certificate for a domain. * * @param params a <code>Map</code> value with configuration parameters. * */ void addCertificates(Map<String, String> params) throws CertificateParsingException; IOInterface createIoInterface(String protocol, String local_hostname, String remote_hostname, int port, boolean clientMode, boolean wantClientAuth, boolean needClientAuth, ByteOrder byteOrder, TrustManager[] x509TrustManagers, TLSEventHandler eventHandler, IOInterface ioi, CertificateContainerIfc certificateContainer) throws IOException; @Deprecated @TigaseDeprecated(since = "8.1.0", removeIn = "9.0.0") default IOInterface createIoInterface(String protocol, String tls_hostname, int port, boolean clientMode, boolean wantClientAuth, boolean needClientAuth, ByteOrder byteOrder, TrustManager[] x509TrustManagers, TLSEventHandler eventHandler, IOInterface ioi, CertificateContainerIfc certificateContainer) throws IOException { return this.createIoInterface(protocol, tls_hostname, tls_hostname, port, clientMode, wantClientAuth, needClientAuth, byteOrder, x509TrustManagers, eventHandler, ioi, certificateContainer); }; // ~--- get methods // ---------------------------------------------------------- /** * Method <code>getSSLContext</code> creates and returns new SSLContext for a given domain (hostname). For creation * of the SSLContext a certificate associated with this domain (hostname) should be used. If there is no specific * certificate for a given domain then default certificate should be used. * * @param protocol a <code>String</code> is either 'SSL' or 'TLS' value. * @param hostname a <code>String</code> value keeps a hostname or domain for SSLContext. * @param clientMode if set SSLContext will be created for client mode (ie. creation of server certificate will be * skipped if there is no certificate) * * @return a <code>SSLContext</code> value */ SSLContext getSSLContext(String protocol, String hostname, boolean clientMode); /** * Method <code>getSSLContext</code> creates and returns new SSLContext for a given domain (hostname). For creation * of the SSLContext a certificate associated with this domain (hostname) should be used. If there is no specific * certificate for a given domain then default certificate should be used. * * @param protocol a <code>String</code> is either 'SSL' or 'TLS' value. * @param hostname a <code>String</code> value keeps a hostname or domain for SSLContext. * @param clientMode if set SSLContext will be created for client mode (ie. creation of server certificate will be * skipped if there is no certificate) * @param tms array of TrustManagers which should be used to validate remote certificate * * @return a <code>SSLContext</code> value */ SSLContext getSSLContext(String protocol, String hostname, boolean clientMode, TrustManager[] tms); /** * Returns a trust store with all trusted certificates. * * @return a KeyStore with all trusted certificates, the KeyStore can be empty but cannot be null. */ KeyStore getTrustStore(); String[] getEnabledCiphers(String domain); String[] getEnabledProtocols(String domain, boolean client); @Deprecated @TigaseDeprecated(since = "8.1.0") default String[] getEnabledCiphers() { return getEnabledCiphers(null); }; @Deprecated @TigaseDeprecated(since = "8.1.0") default String[] getEnabledProtocols() { return getEnabledProtocols(null, true); }; }
{ "pile_set_name": "Github" }
package abstractfactory import "fmt" //OrderMainDAO 为订单主记录 type OrderMainDAO interface { SaveOrderMain() } //OrderDetailDAO 为订单详情纪录 type OrderDetailDAO interface { SaveOrderDetail() } //DAOFactory DAO 抽象模式工厂接口 type DAOFactory interface { CreateOrderMainDAO() OrderMainDAO CreateOrderDetailDAO() OrderDetailDAO } //RDBMainDAP 为关系型数据库的OrderMainDAO实现 type RDBMainDAO struct{} //SaveOrderMain ... func (*RDBMainDAO) SaveOrderMain() { fmt.Print("rdb main save\n") } //RDBDetailDAO 为关系型数据库的OrderDetailDAO实现 type RDBDetailDAO struct{} // SaveOrderDetail ... func (*RDBDetailDAO) SaveOrderDetail() { fmt.Print("rdb detail save\n") } //RDBDAOFactory 是RDB 抽象工厂实现 type RDBDAOFactory struct{} func (*RDBDAOFactory) CreateOrderMainDAO() OrderMainDAO { return &RDBMainDAO{} } func (*RDBDAOFactory) CreateOrderDetailDAO() OrderDetailDAO { return &RDBDetailDAO{} } //XMLMainDAO XML存储 type XMLMainDAO struct{} //SaveOrderMain ... func (*XMLMainDAO) SaveOrderMain() { fmt.Print("xml main save\n") } //XMLDetailDAO XML存储 type XMLDetailDAO struct{} // SaveOrderDetail ... func (*XMLDetailDAO) SaveOrderDetail() { fmt.Print("xml detail save") } //XMLDAOFactory 是RDB 抽象工厂实现 type XMLDAOFactory struct{} func (*XMLDAOFactory) CreateOrderMainDAO() OrderMainDAO { return &XMLMainDAO{} } func (*XMLDAOFactory) CreateOrderDetailDAO() OrderDetailDAO { return &XMLDetailDAO{} }
{ "pile_set_name": "Github" }
package kubeletconfig type forgetError struct { Err error } func newForgetError(err error) *forgetError { return &forgetError{Err: err} } func (e *forgetError) Error() string { return e.Err.Error() }
{ "pile_set_name": "Github" }
#version 450 uniform sampler2D SPIRV_Cross_CombinedTexSPIRV_Cross_DummySampler; layout(location = 0) flat in uvec3 in_var_TEXCOORD0; layout(location = 0) out vec4 out_var_SV_Target0; void main() { out_var_SV_Target0 = texelFetch(SPIRV_Cross_CombinedTexSPIRV_Cross_DummySampler, ivec2(in_var_TEXCOORD0.xy), int(in_var_TEXCOORD0.z)); }
{ "pile_set_name": "Github" }
Copyright (c) 2002-2015 Xiph.org Foundation 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.
{ "pile_set_name": "Github" }
#!/usr/bin/env python # 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. # # Modified from the Apache Arrow project for the Terrier project. import argparse import codecs import difflib import fnmatch import os import subprocess import sys def check(arguments, source_dir): formatted_filenames = [] error = False for directory, subdirs, filenames in os.walk(source_dir): fullpaths = (os.path.join(directory, filename) for filename in filenames) source_files = [x for x in fullpaths if x.endswith(".h") or x.endswith(".cpp")] formatted_filenames.extend( # Filter out files that match the globs in the globs file [filename for filename in source_files if not any((fnmatch.fnmatch(filename, exclude_glob) for exclude_glob in exclude_globs))]) if arguments.fix: if not arguments.quiet: # Print out each file on its own line, but run # clang format once for all of the files print("\n".join(map(lambda x: "Formatting {}".format(x), formatted_filenames))) subprocess.check_call([arguments.clang_format_binary, "-i"] + formatted_filenames) else: for filename in formatted_filenames: if not arguments.quiet: print("Checking {}".format(filename)) # # Due to some incompatibilities between Python 2 and # Python 3, there are some specific actions we take here # to make sure the difflib.unified_diff call works. # # In Python 2, the call to subprocess.check_output return # a 'str' type. In Python 3, however, the call returns a # 'bytes' type unless the 'encoding' argument is # specified. Unfortunately, the 'encoding' argument is not # in the Python 2 API. We could do an if/else here based # on the version of Python we are running, but it's more # straightforward to read the file in binary and do utf-8 # conversion. In Python 2, it's just converting string # types to unicode types, whereas in Python 3 it's # converting bytes types to utf-8 encoded str types. This # approach ensures that the arguments to # difflib.unified_diff are acceptable string types in both # Python 2 and Python 3. with open(filename, "rb") as reader: # Run clang-format and capture its output formatted = subprocess.check_output( [arguments.clang_format_binary, filename]) formatted = codecs.decode(formatted, "utf-8") # Read the original file original = codecs.decode(reader.read(), "utf-8") # Run the equivalent of diff -u diff = list(difflib.unified_diff( original.splitlines(True), formatted.splitlines(True), fromfile=filename, tofile="{} (after clang format)".format( filename))) if diff: print("{} had clang-format style issues".format(filename)) # Print out the diff to stderr error = True sys.stderr.writelines(diff) return error if __name__ == "__main__": parser = argparse.ArgumentParser( description="Runs clang format on all of the source " "files. If --fix is specified, and compares the output " "with the existing file, outputting a unifiied diff if " "there are any necessary changes") parser.add_argument("clang_format_binary", help="Path to the clang-format binary") parser.add_argument("exclude_globs", help="Filename containing globs for files " "that should be excluded from the checks") parser.add_argument("--source_dirs", help="Comma-separated root directories of the code") parser.add_argument("--fix", default=False, action="store_true", help="If specified, will re-format the source " "code instead of comparing the re-formatted " "output, defaults to %(default)s") parser.add_argument("--quiet", default=False, action="store_true", help="If specified, only print errors") args = parser.parse_args() had_err = False exclude_globs = [line.strip() for line in open(args.exclude_globs)] for source_dir in args.source_dirs.split(','): if len(source_dir) > 0: had_err = check(args, source_dir) sys.exit(1 if had_err else 0)
{ "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.netbeans.core.startup; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import junit.framework.Test; import org.netbeans.InvalidException; import org.netbeans.Module; import org.netbeans.ModuleManager; import org.netbeans.junit.NbModuleSuite; import org.netbeans.junit.NbModuleSuite.Configuration; import org.netbeans.junit.NbTestCase; import org.openide.util.Exceptions; import org.openide.util.Mutex; /** * * @author Jaroslav Tulach <[email protected]> */ public class InstallTmpModuleTest extends NbTestCase { private static final Logger LOG = Logger.getLogger(InstallTmpModuleTest.class.getName()); public InstallTmpModuleTest(String name) { super(name); } public static Test suite() { Configuration c = NbModuleSuite.createConfiguration(InstallTmpModuleTest.class); c = c.addTest("testInstallJARFromTmp").failOnException(Level.INFO).gui(false); return c.suite(); } public void testInstallJARFromTmp() throws Exception { final ModuleManager mgr = Main.getModuleSystem().getManager(); File dir = File.createTempFile("dir", ".dir"); dir.delete(); dir.mkdirs(); assertTrue("Directory created", dir.isDirectory()); assertEquals("No files in it", 0, dir.list().length); File f = CLILookupHelpTest.createJAR(dir, "org.tmp.test", null); final Module m = mgr.create(f, null, false, false, false); mgr.mutex().writeAccess(new Mutex.ExceptionAction<Void>() { @Override public Void run() throws Exception { mgr.enable(m); return null; } }); assertTrue("Module is enabled", m.isEnabled()); } }
{ "pile_set_name": "Github" }
package com.lzy.imagepicker.view; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PointF; import android.graphics.RectF; import android.graphics.Region; import android.graphics.Shader; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.support.v4.view.ViewCompat; import android.util.AttributeSet; import android.util.TypedValue; import android.view.MotionEvent; import android.widget.ImageView; import com.lzy.imagepicker.R; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; /** * ================================================ * 作 者:廖子尧 * 版 本:1.0 * 创建日期:2016/1/7 * 描 述: * Matrix 的9个值分别为 缩放 平移 倾斜 * MSCALE_X MSKEW_X MTRANS_X * MSKEW_Y MSCALE_Y MTRANS_Y * MPERSP_0 MPERSP_1 MPERSP_2 * 修订历史: * ================================================ */ public class CropImageView extends ImageView { /******************************** 中间的FocusView绘图相关的参数 *****************************/ public enum Style { RECTANGLE, CIRCLE } private Style[] styles = {Style.RECTANGLE, Style.CIRCLE}; private int mMaskColor = 0xAF000000; //暗色 private int mBorderColor = 0xAA808080; //焦点框的边框颜色 private int mBorderWidth = 1; //焦点边框的宽度(画笔宽度) private int mFocusWidth = 250; //焦点框的宽度 private int mFocusHeight = 250; //焦点框的高度 private int mDefaultStyleIndex = 0; //默认焦点框的形状 private Style mStyle = styles[mDefaultStyleIndex]; private Paint mBorderPaint = new Paint(); private Path mFocusPath = new Path(); private RectF mFocusRect = new RectF(); /******************************** 图片缩放位移控制的参数 ************************************/ private static final float MAX_SCALE = 4.0f; //最大缩放比,图片缩放后的大小与中间选中区域的比值 private static final int NONE = 0; // 初始化 private static final int DRAG = 1; // 拖拽 private static final int ZOOM = 2; // 缩放 private static final int ROTATE = 3; // 旋转 private static final int ZOOM_OR_ROTATE = 4; // 缩放或旋转 private static final int SAVE_SUCCESS = 1001; // 缩放或旋转 private static final int SAVE_ERROR = 1002; // 缩放或旋转 private int mImageWidth; private int mImageHeight; private int mRotatedImageWidth; private int mRotatedImageHeight; private Matrix matrix = new Matrix(); //图片变换的matrix private Matrix savedMatrix = new Matrix(); //开始变幻的时候,图片的matrix private PointF pA = new PointF(); //第一个手指按下点的坐标 private PointF pB = new PointF(); //第二个手指按下点的坐标 private PointF midPoint = new PointF(); //两个手指的中间点 private PointF doubleClickPos = new PointF(); //双击图片的时候,双击点的坐标 private PointF mFocusMidPoint = new PointF(); //中间View的中间点 private int mode = NONE; //初始的模式 private long doubleClickTime = 0; //第二次双击的时间 private double rotation = 0; //手指旋转的角度,不是90的整数倍,可能为任意值,需要转换成level private float oldDist = 1; //双指第一次的距离 private int sumRotateLevel = 0; //旋转的角度,90的整数倍 private float mMaxScale = MAX_SCALE;//程序根据不同图片的大小,动态得到的最大缩放比 private boolean isInited = false; //是否经过了 onSizeChanged 初始化 private boolean mSaving = false; //是否正在保存 private static Handler mHandler = new InnerHandler(); public CropImageView(Context context) { this(context, null); } public CropImageView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public CropImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mFocusWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mFocusWidth, getResources().getDisplayMetrics()); mFocusHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mFocusHeight, getResources().getDisplayMetrics()); mBorderWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mBorderWidth, getResources().getDisplayMetrics()); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CropImageView); mMaskColor = a.getColor(R.styleable.CropImageView_cropMaskColor, mMaskColor); mBorderColor = a.getColor(R.styleable.CropImageView_cropBorderColor, mBorderColor); mBorderWidth = a.getDimensionPixelSize(R.styleable.CropImageView_cropBorderWidth, mBorderWidth); mFocusWidth = a.getDimensionPixelSize(R.styleable.CropImageView_cropFocusWidth, mFocusWidth); mFocusHeight = a.getDimensionPixelSize(R.styleable.CropImageView_cropFocusHeight, mFocusHeight); mDefaultStyleIndex = a.getInteger(R.styleable.CropImageView_cropStyle, mDefaultStyleIndex); mStyle = styles[mDefaultStyleIndex]; a.recycle(); //只允许图片为当前的缩放模式 setScaleType(ScaleType.MATRIX); } @Override public void setImageBitmap(Bitmap bm) { super.setImageBitmap(bm); initImage(); } @Override public void setImageDrawable(Drawable drawable) { super.setImageDrawable(drawable); initImage(); } @Override public void setImageResource(int resId) { super.setImageResource(resId); initImage(); } @Override public void setImageURI(Uri uri) { super.setImageURI(uri); initImage(); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); isInited = true; initImage(); } /** 初始化图片和焦点框 */ private void initImage() { Drawable d = getDrawable(); if (!isInited || d == null) return; mode = NONE; matrix = getImageMatrix(); mImageWidth = mRotatedImageWidth = d.getIntrinsicWidth(); mImageHeight = mRotatedImageHeight = d.getIntrinsicHeight(); //计算出焦点框的中点的坐标和上、下、左、右边的x或y的值 int viewWidth = getWidth(); int viewHeight = getHeight(); float midPointX = viewWidth / 2; float midPointY = viewHeight / 2; mFocusMidPoint = new PointF(midPointX, midPointY); if (mStyle == Style.CIRCLE) { int focusSize = Math.min(mFocusWidth, mFocusHeight); mFocusWidth = focusSize; mFocusHeight = focusSize; } mFocusRect.left = mFocusMidPoint.x - mFocusWidth / 2; mFocusRect.right = mFocusMidPoint.x + mFocusWidth / 2; mFocusRect.top = mFocusMidPoint.y - mFocusHeight / 2; mFocusRect.bottom = mFocusMidPoint.y + mFocusHeight / 2; //适配焦点框的缩放比例(图片的最小边不小于焦点框的最小边) float fitFocusScale = getScale(mImageWidth, mImageHeight, mFocusWidth, mFocusHeight, true); mMaxScale = fitFocusScale * MAX_SCALE; //适配显示图片的ImageView的缩放比例(图片至少有一边是铺满屏幕的显示的情形) float fitViewScale = getScale(mImageWidth, mImageHeight, viewWidth, viewHeight, false); //确定最终的缩放比例,在适配焦点框的前提下适配显示图片的ImageView, //方案:首先满足适配焦点框,如果还能适配显示图片的ImageView,则适配它,即取缩放比例的最大值。 //采取这种方案的原因:有可能图片很长或者很高,适配了ImageView的时候可能会宽/高已经小于焦点框的宽/高 float scale = fitViewScale > fitFocusScale ? fitViewScale : fitFocusScale; //图像中点为中心进行缩放 matrix.setScale(scale, scale, mImageWidth / 2, mImageHeight / 2); float[] mImageMatrixValues = new float[9]; matrix.getValues(mImageMatrixValues); //获取缩放后的mImageMatrix的值 float transX = mFocusMidPoint.x - (mImageMatrixValues[2] + mImageWidth * mImageMatrixValues[0] / 2); //X轴方向的位移 float transY = mFocusMidPoint.y - (mImageMatrixValues[5] + mImageHeight * mImageMatrixValues[4] / 2); //Y轴方向的位移 matrix.postTranslate(transX, transY); setImageMatrix(matrix); invalidate(); } /** 计算边界缩放比例 isMinScale 是否最小比例,true 最小缩放比例, false 最大缩放比例 */ private float getScale(int bitmapWidth, int bitmapHeight, int minWidth, int minHeight, boolean isMinScale) { float scale; float scaleX = (float) minWidth / bitmapWidth; float scaleY = (float) minHeight / bitmapHeight; if (isMinScale) { scale = scaleX > scaleY ? scaleX : scaleY; } else { scale = scaleX < scaleY ? scaleX : scaleY; } return scale; } /** 绘制焦点框 */ @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (Style.RECTANGLE == mStyle) { mFocusPath.addRect(mFocusRect, Path.Direction.CCW); canvas.save(); canvas.clipRect(0, 0, getWidth(), getHeight()); canvas.clipPath(mFocusPath, Region.Op.DIFFERENCE); canvas.drawColor(mMaskColor); canvas.restore(); } else if (Style.CIRCLE == mStyle) { float radius = Math.min((mFocusRect.right - mFocusRect.left) / 2, (mFocusRect.bottom - mFocusRect.top) / 2); mFocusPath.addCircle(mFocusMidPoint.x, mFocusMidPoint.y, radius, Path.Direction.CCW); canvas.save(); canvas.clipRect(0, 0, getWidth(), getHeight()); canvas.clipPath(mFocusPath, Region.Op.DIFFERENCE); canvas.drawColor(mMaskColor); canvas.restore(); } mBorderPaint.setColor(mBorderColor); mBorderPaint.setStyle(Paint.Style.STROKE); mBorderPaint.setStrokeWidth(mBorderWidth); mBorderPaint.setAntiAlias(true); canvas.drawPath(mFocusPath, mBorderPaint); mFocusPath.reset(); } @Override public boolean onTouchEvent(MotionEvent event) { if (mSaving || null == getDrawable()) { return super.onTouchEvent(event); } switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: //第一个点按下 savedMatrix.set(matrix); //以后每次需要变换的时候,以现在的状态为基础进行变换 pA.set(event.getX(), event.getY()); pB.set(event.getX(), event.getY()); mode = DRAG; break; case MotionEvent.ACTION_POINTER_DOWN: //第二个点按下 if (event.getActionIndex() > 1) break; pA.set(event.getX(0), event.getY(0)); pB.set(event.getX(1), event.getY(1)); midPoint.set((pA.x + pB.x) / 2, (pA.y + pB.y) / 2); oldDist = spacing(pA, pB); savedMatrix.set(matrix); //以后每次需要变换的时候,以现在的状态为基础进行变换 if (oldDist > 10f) mode = ZOOM_OR_ROTATE;//两点之间的距离大于10才有效 break; case MotionEvent.ACTION_MOVE: if (mode == ZOOM_OR_ROTATE) { PointF pC = new PointF(event.getX(1) - event.getX(0) + pA.x, event.getY(1) - event.getY(0) + pA.y); double a = spacing(pB.x, pB.y, pC.x, pC.y); double b = spacing(pA.x, pA.y, pC.x, pC.y); double c = spacing(pA.x, pA.y, pB.x, pB.y); if (a >= 10) { double cosB = (a * a + c * c - b * b) / (2 * a * c); double angleB = Math.acos(cosB); double PID4 = Math.PI / 4; //旋转时,默认角度在 45 - 135 度之间 if (angleB > PID4 && angleB < 3 * PID4) mode = ROTATE; else mode = ZOOM; } } if (mode == DRAG) { matrix.set(savedMatrix); matrix.postTranslate(event.getX() - pA.x, event.getY() - pA.y); fixTranslation(); setImageMatrix(matrix); } else if (mode == ZOOM) { float newDist = spacing(event.getX(0), event.getY(0), event.getX(1), event.getY(1)); if (newDist > 10f) { matrix.set(savedMatrix); // 这里之所以用 maxPostScale 矫正一下,主要是防止缩放到最大时,继续缩放图片会产生位移 float tScale = Math.min(newDist / oldDist, maxPostScale()); if (tScale != 0) { matrix.postScale(tScale, tScale, midPoint.x, midPoint.y); fixScale(); fixTranslation(); setImageMatrix(matrix); } } } else if (mode == ROTATE) { PointF pC = new PointF(event.getX(1) - event.getX(0) + pA.x, event.getY(1) - event.getY(0) + pA.y); double a = spacing(pB.x, pB.y, pC.x, pC.y); double b = spacing(pA.x, pA.y, pC.x, pC.y); double c = spacing(pA.x, pA.y, pB.x, pB.y); if (b > 10) { double cosA = (b * b + c * c - a * a) / (2 * b * c); double angleA = Math.acos(cosA); double ta = pB.y - pA.y; double tb = pA.x - pB.x; double tc = pB.x * pA.y - pA.x * pB.y; double td = ta * pC.x + tb * pC.y + tc; if (td > 0) { angleA = 2 * Math.PI - angleA; } rotation = angleA; matrix.set(savedMatrix); matrix.postRotate((float) (rotation * 180 / Math.PI), midPoint.x, midPoint.y); setImageMatrix(matrix); } } break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_UP: if (mode == DRAG) { if (spacing(pA, pB) < 50) { long now = System.currentTimeMillis(); if (now - doubleClickTime < 500 && spacing(pA, doubleClickPos) < 50) { doubleClick(pA.x, pA.y); now = 0; } doubleClickPos.set(pA); doubleClickTime = now; } } else if (mode == ROTATE) { int rotateLevel = (int) Math.floor((rotation + Math.PI / 4) / (Math.PI / 2)); if (rotateLevel == 4) rotateLevel = 0; matrix.set(savedMatrix); matrix.postRotate(90 * rotateLevel, midPoint.x, midPoint.y); if (rotateLevel == 1 || rotateLevel == 3) { int tmp = mRotatedImageWidth; mRotatedImageWidth = mRotatedImageHeight; mRotatedImageHeight = tmp; } fixScale(); fixTranslation(); setImageMatrix(matrix); sumRotateLevel += rotateLevel; } mode = NONE; break; } //解决部分机型无法拖动的问题 ViewCompat.postInvalidateOnAnimation(this); return true; } /** 修正图片的缩放比 */ private void fixScale() { float imageMatrixValues[] = new float[9]; matrix.getValues(imageMatrixValues); float currentScale = Math.abs(imageMatrixValues[0]) + Math.abs(imageMatrixValues[1]); float minScale = getScale(mRotatedImageWidth, mRotatedImageHeight, mFocusWidth, mFocusHeight, true); mMaxScale = minScale * MAX_SCALE; //保证图片最小是占满中间的焦点空间 if (currentScale < minScale) { float scale = minScale / currentScale; matrix.postScale(scale, scale); } else if (currentScale > mMaxScale) { float scale = mMaxScale / currentScale; matrix.postScale(scale, scale); } } /** 修正图片的位移 */ private void fixTranslation() { RectF imageRect = new RectF(0, 0, mImageWidth, mImageHeight); matrix.mapRect(imageRect); //获取当前图片(缩放以后的)相对于当前控件的位置区域,超过控件的上边缘或左边缘为负 float deltaX = 0, deltaY = 0; if (imageRect.left > mFocusRect.left) { deltaX = -imageRect.left + mFocusRect.left; } else if (imageRect.right < mFocusRect.right) { deltaX = -imageRect.right + mFocusRect.right; } if (imageRect.top > mFocusRect.top) { deltaY = -imageRect.top + mFocusRect.top; } else if (imageRect.bottom < mFocusRect.bottom) { deltaY = -imageRect.bottom + mFocusRect.bottom; } matrix.postTranslate(deltaX, deltaY); } /** 获取当前图片允许的最大缩放比 */ private float maxPostScale() { float imageMatrixValues[] = new float[9]; matrix.getValues(imageMatrixValues); float curScale = Math.abs(imageMatrixValues[0]) + Math.abs(imageMatrixValues[1]); return mMaxScale / curScale; } /** 计算两点之间的距离 */ private float spacing(float x1, float y1, float x2, float y2) { float x = x1 - x2; float y = y1 - y2; return (float) Math.sqrt(x * x + y * y); } /** 计算两点之间的距离 */ private float spacing(PointF pA, PointF pB) { return spacing(pA.x, pA.y, pB.x, pB.y); } /** 双击触发的方法 */ private void doubleClick(float x, float y) { float p[] = new float[9]; matrix.getValues(p); float curScale = Math.abs(p[0]) + Math.abs(p[1]); float minScale = getScale(mRotatedImageWidth, mRotatedImageHeight, mFocusWidth, mFocusHeight, true); if (curScale < mMaxScale) { //每次双击的时候,缩放加 minScale float toScale = Math.min(curScale + minScale, mMaxScale) / curScale; matrix.postScale(toScale, toScale, x, y); } else { float toScale = minScale / curScale; matrix.postScale(toScale, toScale, x, y); fixTranslation(); } setImageMatrix(matrix); } /** * @param expectWidth 期望的宽度 * @param exceptHeight 期望的高度 * @param isSaveRectangle 是否按矩形区域保存图片 * @return 裁剪后的Bitmap */ public Bitmap getCropBitmap(int expectWidth, int exceptHeight, boolean isSaveRectangle) { if (expectWidth <= 0 || exceptHeight < 0) return null; Bitmap srcBitmap = ((BitmapDrawable) getDrawable()).getBitmap(); srcBitmap = rotate(srcBitmap, sumRotateLevel * 90); //最好用level,因为角度可能不是90的整数 return makeCropBitmap(srcBitmap, mFocusRect, getImageMatrixRect(), expectWidth, exceptHeight, isSaveRectangle); } /** * @param bitmap 要旋转的图片 * @param degrees 选择的角度(单位 度) * @return 旋转后的Bitmap */ private Bitmap rotate(Bitmap bitmap, int degrees) { if (degrees != 0 && bitmap != null) { Matrix matrix = new Matrix(); matrix.setRotate(degrees, (float) bitmap.getWidth() / 2, (float) bitmap.getHeight() / 2); try { Bitmap rotateBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); if (bitmap != rotateBitmap) { // bitmap.recycle(); return rotateBitmap; } } catch (OutOfMemoryError ex) { ex.printStackTrace(); } } return bitmap; } /** * @return 获取当前图片显示的矩形区域 */ private RectF getImageMatrixRect() { RectF rectF = new RectF(); rectF.set(0, 0, getDrawable().getIntrinsicWidth(), getDrawable().getIntrinsicHeight()); matrix.mapRect(rectF); return rectF; } /** * @param bitmap 需要裁剪的图片 * @param focusRect 中间需要裁剪的矩形区域 * @param imageMatrixRect 当前图片在屏幕上的显示矩形区域 * @param expectWidth 希望获得的图片宽度,如果图片宽度不足时,拉伸图片 * @param exceptHeight 希望获得的图片高度,如果图片高度不足时,拉伸图片 * @param isSaveRectangle 是否希望按矩形区域保存图片 * @return 裁剪后的图片的Bitmap */ private Bitmap makeCropBitmap(Bitmap bitmap, RectF focusRect, RectF imageMatrixRect, int expectWidth, int exceptHeight, boolean isSaveRectangle) { float scale = imageMatrixRect.width() / bitmap.getWidth(); int left = (int) ((focusRect.left - imageMatrixRect.left) / scale); int top = (int) ((focusRect.top - imageMatrixRect.top) / scale); int width = (int) (focusRect.width() / scale); int height = (int) (focusRect.height() / scale); if (left < 0) left = 0; if (top < 0) top = 0; if (left + width > bitmap.getWidth()) width = bitmap.getWidth() - left; if (top + height > bitmap.getHeight()) height = bitmap.getHeight() - top; try { bitmap = Bitmap.createBitmap(bitmap, left, top, width, height); if (expectWidth != width || exceptHeight != height) { bitmap = Bitmap.createScaledBitmap(bitmap, expectWidth, exceptHeight, true); if (mStyle == CropImageView.Style.CIRCLE && !isSaveRectangle) { //如果是圆形,就将图片裁剪成圆的 int length = Math.min(expectWidth, exceptHeight); int radius = length / 2; Bitmap circleBitmap = Bitmap.createBitmap(length, length, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(circleBitmap); BitmapShader bitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); Paint paint = new Paint(); paint.setShader(bitmapShader); canvas.drawCircle(expectWidth / 2f, exceptHeight / 2f, radius, paint); bitmap = circleBitmap; } } } catch (OutOfMemoryError e) { e.printStackTrace(); } return bitmap; } /** * @param folder 希望保存的文件夹 * @param expectWidth 希望保存的图片宽度 * @param exceptHeight 希望保存的图片高度 * @param isSaveRectangle 是否希望按矩形区域保存图片 */ public void saveBitmapToFile(File folder, int expectWidth, int exceptHeight, boolean isSaveRectangle) { if (mSaving) return; mSaving = true; final Bitmap croppedImage = getCropBitmap(expectWidth, exceptHeight, isSaveRectangle); Bitmap.CompressFormat outputFormat = Bitmap.CompressFormat.JPEG; File saveFile = createFile(folder, "IMG_", ".jpg"); if (mStyle == CropImageView.Style.CIRCLE && !isSaveRectangle) { outputFormat = Bitmap.CompressFormat.PNG; saveFile = createFile(folder, "IMG_", ".png"); } final Bitmap.CompressFormat finalOutputFormat = outputFormat; final File finalSaveFile = saveFile; new Thread() { @Override public void run() { saveOutput(croppedImage, finalOutputFormat, finalSaveFile); } }.start(); } /** 根据系统时间、前缀、后缀产生一个文件 */ private File createFile(File folder, String prefix, String suffix) { if (!folder.exists() || !folder.isDirectory()) folder.mkdirs(); try { File nomedia = new File(folder, ".nomedia"); //在当前文件夹底下创建一个 .nomedia 文件 if (!nomedia.exists()) nomedia.createNewFile(); } catch (IOException e) { e.printStackTrace(); } SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.CHINA); String filename = prefix + dateFormat.format(new Date(System.currentTimeMillis())) + suffix; return new File(folder, filename); } /** 将图片保存在本地 */ private void saveOutput(Bitmap croppedImage, Bitmap.CompressFormat outputFormat, File saveFile) { OutputStream outputStream = null; try { outputStream = getContext().getContentResolver().openOutputStream(Uri.fromFile(saveFile)); if (outputStream != null) croppedImage.compress(outputFormat, 90, outputStream); Message.obtain(mHandler, SAVE_SUCCESS, saveFile).sendToTarget(); } catch (IOException ex) { ex.printStackTrace(); Message.obtain(mHandler, SAVE_ERROR, saveFile).sendToTarget(); } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } mSaving = false; croppedImage.recycle(); } private static class InnerHandler extends Handler { public InnerHandler() { super(Looper.getMainLooper()); } @Override public void handleMessage(Message msg) { File saveFile = (File) msg.obj; switch (msg.what) { case SAVE_SUCCESS: if (mListener != null) mListener.onBitmapSaveSuccess(saveFile); break; case SAVE_ERROR: if (mListener != null) mListener.onBitmapSaveError(saveFile); break; } } } /** 图片保存完成的监听 */ private static OnBitmapSaveCompleteListener mListener; public interface OnBitmapSaveCompleteListener { void onBitmapSaveSuccess(File file); void onBitmapSaveError(File file); } public void setOnBitmapSaveCompleteListener(OnBitmapSaveCompleteListener listener) { mListener = listener; } /** 返回焦点框宽度 */ public int getFocusWidth() { return mFocusWidth; } /** 设置焦点框的宽度 */ public void setFocusWidth(int width) { mFocusWidth = width; initImage(); } /** 获取焦点框的高度 */ public int getFocusHeight() { return mFocusHeight; } /** 设置焦点框的高度 */ public void setFocusHeight(int height) { mFocusHeight = height; initImage(); } /** 返回阴影颜色 */ public int getMaskColor() { return mMaskColor; } /** 设置阴影颜色 */ public void setMaskColor(int color) { mMaskColor = color; invalidate(); } /** 返回焦点框边框颜色 */ public int getFocusColor() { return mBorderColor; } /** 设置焦点框边框颜色 */ public void setBorderColor(int color) { mBorderColor = color; invalidate(); } /** 返回焦点框边框绘制宽度 */ public float getBorderWidth() { return mBorderWidth; } /** 设置焦点边框宽度 */ public void setBorderWidth(int width) { mBorderWidth = width; invalidate(); } /** 设置焦点框的形状 */ public void setFocusStyle(Style style) { this.mStyle = style; invalidate(); } /** 获取焦点框的形状 */ public Style getFocusStyle() { return mStyle; } }
{ "pile_set_name": "Github" }
package tc.oc.pgm.xml; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.Method; import java.util.Map; import java.util.Optional; import org.jdom2.Element; import tc.oc.commons.core.inspect.Inspectable; import tc.oc.pgm.xml.finder.NodeFinder; import tc.oc.pgm.xml.parser.PrimitiveParser; import tc.oc.pgm.xml.validate.Validation; /** * A reflectively parsed object. * * Instances are generated automatically from XML, based on the names * and types of the interface methods. */ public interface Parseable extends Inspectable { @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @interface Property { String name() default ""; String[] alias() default {}; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @interface Nodes { Class<? extends NodeFinder>[] value(); } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @interface Split { Class<? extends NodeSplitter> value(); } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @interface Parse { Class<? extends PrimitiveParser> value(); } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @interface Validate { Class<? extends Validation>[] value(); } /** * Indicates that a property is obsolete, and should not appear in documentation */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @interface Legacy {} default Optional<Element> sourceElement() { throw new UnsupportedOperationException(); } default Map<Method, Object> parsedValues() { throw new UnsupportedOperationException(); } }
{ "pile_set_name": "Github" }
// Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. $(document).on('change', '.btn-file :file', function() { var input = $(this), numFiles = input.get(0).files ? input.get(0).files.length : 1, label = input.val().replace(/\\/g, '/').replace(/.*\//, ''); input.trigger('fileselect', [numFiles, label]); }); $(document).ready(function() { $('.btn-file :file').on('fileselect', function(event, numFiles, label) { var input = $(this).parents('.input-group').find(':text'), log = numFiles > 1 ? numFiles + ' files selected' : label; if (input.length) { input.val(log); } else { if (log) alert(log); } }); });
{ "pile_set_name": "Github" }
/*! tether 1.4.0 */ (function(root, factory) { if (typeof define === 'function' && define.amd) { define(factory); } else if (typeof exports === 'object') { module.exports = factory(require, exports, module); } else { root.Tether = factory(); } }(this, function(require, exports, module) { 'use strict'; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } var TetherBase = undefined; if (typeof TetherBase === 'undefined') { TetherBase = { modules: [] }; } var zeroElement = null; // Same as native getBoundingClientRect, except it takes into account parent <frame> offsets // if the element lies within a nested document (<frame> or <iframe>-like). function getActualBoundingClientRect(node) { var boundingRect = node.getBoundingClientRect(); // The original object returned by getBoundingClientRect is immutable, so we clone it // We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9 var rect = {}; for (var k in boundingRect) { rect[k] = boundingRect[k]; } if (node.ownerDocument !== document) { var _frameElement = node.ownerDocument.defaultView.frameElement; if (_frameElement) { var frameRect = getActualBoundingClientRect(_frameElement); rect.top += frameRect.top; rect.bottom += frameRect.top; rect.left += frameRect.left; rect.right += frameRect.left; } } return rect; } function getScrollParents(el) { // In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null; // https://bugzilla.mozilla.org/show_bug.cgi?id=548397 var computedStyle = getComputedStyle(el) || {}; var position = computedStyle.position; var parents = []; if (position === 'fixed') { return [el]; } var parent = el; while ((parent = parent.parentNode) && parent && parent.nodeType === 1) { var style = undefined; try { style = getComputedStyle(parent); } catch (err) {} if (typeof style === 'undefined' || style === null) { parents.push(parent); return parents; } var _style = style; var overflow = _style.overflow; var overflowX = _style.overflowX; var overflowY = _style.overflowY; if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) { if (position !== 'absolute' || ['relative', 'absolute', 'fixed'].indexOf(style.position) >= 0) { parents.push(parent); } } } parents.push(el.ownerDocument.body); // If the node is within a frame, account for the parent window scroll if (el.ownerDocument !== document) { parents.push(el.ownerDocument.defaultView); } return parents; } var uniqueId = (function () { var id = 0; return function () { return ++id; }; })(); var zeroPosCache = {}; var getOrigin = function getOrigin() { // getBoundingClientRect is unfortunately too accurate. It introduces a pixel or two of // jitter as the user scrolls that messes with our ability to detect if two positions // are equivilant or not. We place an element at the top left of the page that will // get the same jitter, so we can cancel the two out. var node = zeroElement; if (!node || !document.body.contains(node)) { node = document.createElement('div'); node.setAttribute('data-tether-id', uniqueId()); extend(node.style, { top: 0, left: 0, position: 'absolute' }); document.body.appendChild(node); zeroElement = node; } var id = node.getAttribute('data-tether-id'); if (typeof zeroPosCache[id] === 'undefined') { zeroPosCache[id] = getActualBoundingClientRect(node); // Clear the cache when this position call is done defer(function () { delete zeroPosCache[id]; }); } return zeroPosCache[id]; }; function removeUtilElements() { if (zeroElement) { document.body.removeChild(zeroElement); } zeroElement = null; }; function getBounds(el) { var doc = undefined; if (el === document) { doc = document; el = document.documentElement; } else { doc = el.ownerDocument; } var docEl = doc.documentElement; var box = getActualBoundingClientRect(el); var origin = getOrigin(); box.top -= origin.top; box.left -= origin.left; if (typeof box.width === 'undefined') { box.width = document.body.scrollWidth - box.left - box.right; } if (typeof box.height === 'undefined') { box.height = document.body.scrollHeight - box.top - box.bottom; } box.top = box.top - docEl.clientTop; box.left = box.left - docEl.clientLeft; box.right = doc.body.clientWidth - box.width - box.left; box.bottom = doc.body.clientHeight - box.height - box.top; return box; } function getOffsetParent(el) { return el.offsetParent || document.documentElement; } var _scrollBarSize = null; function getScrollBarSize() { if (_scrollBarSize) { return _scrollBarSize; } var inner = document.createElement('div'); inner.style.width = '100%'; inner.style.height = '200px'; var outer = document.createElement('div'); extend(outer.style, { position: 'absolute', top: 0, left: 0, pointerEvents: 'none', visibility: 'hidden', width: '200px', height: '150px', overflow: 'hidden' }); outer.appendChild(inner); document.body.appendChild(outer); var widthContained = inner.offsetWidth; outer.style.overflow = 'scroll'; var widthScroll = inner.offsetWidth; if (widthContained === widthScroll) { widthScroll = outer.clientWidth; } document.body.removeChild(outer); var width = widthContained - widthScroll; _scrollBarSize = { width: width, height: width }; return _scrollBarSize; } function extend() { var out = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; var args = []; Array.prototype.push.apply(args, arguments); args.slice(1).forEach(function (obj) { if (obj) { for (var key in obj) { if (({}).hasOwnProperty.call(obj, key)) { out[key] = obj[key]; } } } }); return out; } function removeClass(el, name) { if (typeof el.classList !== 'undefined') { name.split(' ').forEach(function (cls) { if (cls.trim()) { el.classList.remove(cls); } }); } else { var regex = new RegExp('(^| )' + name.split(' ').join('|') + '( |$)', 'gi'); var className = getClassName(el).replace(regex, ' '); setClassName(el, className); } } function addClass(el, name) { if (typeof el.classList !== 'undefined') { name.split(' ').forEach(function (cls) { if (cls.trim()) { el.classList.add(cls); } }); } else { removeClass(el, name); var cls = getClassName(el) + (' ' + name); setClassName(el, cls); } } function hasClass(el, name) { if (typeof el.classList !== 'undefined') { return el.classList.contains(name); } var className = getClassName(el); return new RegExp('(^| )' + name + '( |$)', 'gi').test(className); } function getClassName(el) { // Can't use just SVGAnimatedString here since nodes within a Frame in IE have // completely separately SVGAnimatedString base classes if (el.className instanceof el.ownerDocument.defaultView.SVGAnimatedString) { return el.className.baseVal; } return el.className; } function setClassName(el, className) { el.setAttribute('class', className); } function updateClasses(el, add, all) { // Of the set of 'all' classes, we need the 'add' classes, and only the // 'add' classes to be set. all.forEach(function (cls) { if (add.indexOf(cls) === -1 && hasClass(el, cls)) { removeClass(el, cls); } }); add.forEach(function (cls) { if (!hasClass(el, cls)) { addClass(el, cls); } }); } var deferred = []; var defer = function defer(fn) { deferred.push(fn); }; var flush = function flush() { var fn = undefined; while (fn = deferred.pop()) { fn(); } }; var Evented = (function () { function Evented() { _classCallCheck(this, Evented); } _createClass(Evented, [{ key: 'on', value: function on(event, handler, ctx) { var once = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; if (typeof this.bindings === 'undefined') { this.bindings = {}; } if (typeof this.bindings[event] === 'undefined') { this.bindings[event] = []; } this.bindings[event].push({ handler: handler, ctx: ctx, once: once }); } }, { key: 'once', value: function once(event, handler, ctx) { this.on(event, handler, ctx, true); } }, { key: 'off', value: function off(event, handler) { if (typeof this.bindings === 'undefined' || typeof this.bindings[event] === 'undefined') { return; } if (typeof handler === 'undefined') { delete this.bindings[event]; } else { var i = 0; while (i < this.bindings[event].length) { if (this.bindings[event][i].handler === handler) { this.bindings[event].splice(i, 1); } else { ++i; } } } } }, { key: 'trigger', value: function trigger(event) { if (typeof this.bindings !== 'undefined' && this.bindings[event]) { var i = 0; for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } while (i < this.bindings[event].length) { var _bindings$event$i = this.bindings[event][i]; var handler = _bindings$event$i.handler; var ctx = _bindings$event$i.ctx; var once = _bindings$event$i.once; var context = ctx; if (typeof context === 'undefined') { context = this; } handler.apply(context, args); if (once) { this.bindings[event].splice(i, 1); } else { ++i; } } } } }]); return Evented; })(); TetherBase.Utils = { getActualBoundingClientRect: getActualBoundingClientRect, getScrollParents: getScrollParents, getBounds: getBounds, getOffsetParent: getOffsetParent, extend: extend, addClass: addClass, removeClass: removeClass, hasClass: hasClass, updateClasses: updateClasses, defer: defer, flush: flush, uniqueId: uniqueId, Evented: Evented, getScrollBarSize: getScrollBarSize, removeUtilElements: removeUtilElements }; /* globals TetherBase, performance */ 'use strict'; var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })(); var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var _get = function get(_x6, _x7, _x8) { var _again = true; _function: while (_again) { var object = _x6, property = _x7, receiver = _x8; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x6 = parent; _x7 = property; _x8 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } if (typeof TetherBase === 'undefined') { throw new Error('You must include the utils.js file before tether.js'); } var _TetherBase$Utils = TetherBase.Utils; var getScrollParents = _TetherBase$Utils.getScrollParents; var getBounds = _TetherBase$Utils.getBounds; var getOffsetParent = _TetherBase$Utils.getOffsetParent; var extend = _TetherBase$Utils.extend; var addClass = _TetherBase$Utils.addClass; var removeClass = _TetherBase$Utils.removeClass; var updateClasses = _TetherBase$Utils.updateClasses; var defer = _TetherBase$Utils.defer; var flush = _TetherBase$Utils.flush; var getScrollBarSize = _TetherBase$Utils.getScrollBarSize; var removeUtilElements = _TetherBase$Utils.removeUtilElements; function within(a, b) { var diff = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2]; return a + diff >= b && b >= a - diff; } var transformKey = (function () { if (typeof document === 'undefined') { return ''; } var el = document.createElement('div'); var transforms = ['transform', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform']; for (var i = 0; i < transforms.length; ++i) { var key = transforms[i]; if (el.style[key] !== undefined) { return key; } } })(); var tethers = []; var position = function position() { tethers.forEach(function (tether) { tether.position(false); }); flush(); }; function now() { if (typeof performance !== 'undefined' && typeof performance.now !== 'undefined') { return performance.now(); } return +new Date(); } (function () { var lastCall = null; var lastDuration = null; var pendingTimeout = null; var tick = function tick() { if (typeof lastDuration !== 'undefined' && lastDuration > 16) { // We voluntarily throttle ourselves if we can't manage 60fps lastDuration = Math.min(lastDuration - 16, 250); // Just in case this is the last event, remember to position just once more pendingTimeout = setTimeout(tick, 250); return; } if (typeof lastCall !== 'undefined' && now() - lastCall < 10) { // Some browsers call events a little too frequently, refuse to run more than is reasonable return; } if (pendingTimeout != null) { clearTimeout(pendingTimeout); pendingTimeout = null; } lastCall = now(); position(); lastDuration = now() - lastCall; }; if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') { ['resize', 'scroll', 'touchmove'].forEach(function (event) { window.addEventListener(event, tick); }); } })(); var MIRROR_LR = { center: 'center', left: 'right', right: 'left' }; var MIRROR_TB = { middle: 'middle', top: 'bottom', bottom: 'top' }; var OFFSET_MAP = { top: 0, left: 0, middle: '50%', center: '50%', bottom: '100%', right: '100%' }; var autoToFixedAttachment = function autoToFixedAttachment(attachment, relativeToAttachment) { var left = attachment.left; var top = attachment.top; if (left === 'auto') { left = MIRROR_LR[relativeToAttachment.left]; } if (top === 'auto') { top = MIRROR_TB[relativeToAttachment.top]; } return { left: left, top: top }; }; var attachmentToOffset = function attachmentToOffset(attachment) { var left = attachment.left; var top = attachment.top; if (typeof OFFSET_MAP[attachment.left] !== 'undefined') { left = OFFSET_MAP[attachment.left]; } if (typeof OFFSET_MAP[attachment.top] !== 'undefined') { top = OFFSET_MAP[attachment.top]; } return { left: left, top: top }; }; function addOffset() { var out = { top: 0, left: 0 }; for (var _len = arguments.length, offsets = Array(_len), _key = 0; _key < _len; _key++) { offsets[_key] = arguments[_key]; } offsets.forEach(function (_ref) { var top = _ref.top; var left = _ref.left; if (typeof top === 'string') { top = parseFloat(top, 10); } if (typeof left === 'string') { left = parseFloat(left, 10); } out.top += top; out.left += left; }); return out; } function offsetToPx(offset, size) { if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) { offset.left = parseFloat(offset.left, 10) / 100 * size.width; } if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) { offset.top = parseFloat(offset.top, 10) / 100 * size.height; } return offset; } var parseOffset = function parseOffset(value) { var _value$split = value.split(' '); var _value$split2 = _slicedToArray(_value$split, 2); var top = _value$split2[0]; var left = _value$split2[1]; return { top: top, left: left }; }; var parseAttachment = parseOffset; var TetherClass = (function (_Evented) { _inherits(TetherClass, _Evented); function TetherClass(options) { var _this = this; _classCallCheck(this, TetherClass); _get(Object.getPrototypeOf(TetherClass.prototype), 'constructor', this).call(this); this.position = this.position.bind(this); tethers.push(this); this.history = []; this.setOptions(options, false); TetherBase.modules.forEach(function (module) { if (typeof module.initialize !== 'undefined') { module.initialize.call(_this); } }); this.position(); } _createClass(TetherClass, [{ key: 'getClass', value: function getClass() { var key = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; var classes = this.options.classes; if (typeof classes !== 'undefined' && classes[key]) { return this.options.classes[key]; } else if (this.options.classPrefix) { return this.options.classPrefix + '-' + key; } else { return key; } } }, { key: 'setOptions', value: function setOptions(options) { var _this2 = this; var pos = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; var defaults = { offset: '0 0', targetOffset: '0 0', targetAttachment: 'auto auto', classPrefix: 'tether' }; this.options = extend(defaults, options); var _options = this.options; var element = _options.element; var target = _options.target; var targetModifier = _options.targetModifier; this.element = element; this.target = target; this.targetModifier = targetModifier; if (this.target === 'viewport') { this.target = document.body; this.targetModifier = 'visible'; } else if (this.target === 'scroll-handle') { this.target = document.body; this.targetModifier = 'scroll-handle'; } ['element', 'target'].forEach(function (key) { if (typeof _this2[key] === 'undefined') { throw new Error('Tether Error: Both element and target must be defined'); } if (typeof _this2[key].jquery !== 'undefined') { _this2[key] = _this2[key][0]; } else if (typeof _this2[key] === 'string') { _this2[key] = document.querySelector(_this2[key]); } }); addClass(this.element, this.getClass('element')); if (!(this.options.addTargetClasses === false)) { addClass(this.target, this.getClass('target')); } if (!this.options.attachment) { throw new Error('Tether Error: You must provide an attachment'); } this.targetAttachment = parseAttachment(this.options.targetAttachment); this.attachment = parseAttachment(this.options.attachment); this.offset = parseOffset(this.options.offset); this.targetOffset = parseOffset(this.options.targetOffset); if (typeof this.scrollParents !== 'undefined') { this.disable(); } if (this.targetModifier === 'scroll-handle') { this.scrollParents = [this.target]; } else { this.scrollParents = getScrollParents(this.target); } if (!(this.options.enabled === false)) { this.enable(pos); } } }, { key: 'getTargetBounds', value: function getTargetBounds() { if (typeof this.targetModifier !== 'undefined') { if (this.targetModifier === 'visible') { if (this.target === document.body) { return { top: pageYOffset, left: pageXOffset, height: innerHeight, width: innerWidth }; } else { var bounds = getBounds(this.target); var out = { height: bounds.height, width: bounds.width, top: bounds.top, left: bounds.left }; out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top)); out.height = Math.min(out.height, bounds.height - (bounds.top + bounds.height - (pageYOffset + innerHeight))); out.height = Math.min(innerHeight, out.height); out.height -= 2; out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left)); out.width = Math.min(out.width, bounds.width - (bounds.left + bounds.width - (pageXOffset + innerWidth))); out.width = Math.min(innerWidth, out.width); out.width -= 2; if (out.top < pageYOffset) { out.top = pageYOffset; } if (out.left < pageXOffset) { out.left = pageXOffset; } return out; } } else if (this.targetModifier === 'scroll-handle') { var bounds = undefined; var target = this.target; if (target === document.body) { target = document.documentElement; bounds = { left: pageXOffset, top: pageYOffset, height: innerHeight, width: innerWidth }; } else { bounds = getBounds(target); } var style = getComputedStyle(target); var hasBottomScroll = target.scrollWidth > target.clientWidth || [style.overflow, style.overflowX].indexOf('scroll') >= 0 || this.target !== document.body; var scrollBottom = 0; if (hasBottomScroll) { scrollBottom = 15; } var height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom; var out = { width: 15, height: height * 0.975 * (height / target.scrollHeight), left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15 }; var fitAdj = 0; if (height < 408 && this.target === document.body) { fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58; } if (this.target !== document.body) { out.height = Math.max(out.height, 24); } var scrollPercentage = this.target.scrollTop / (target.scrollHeight - height); out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth); if (this.target === document.body) { out.height = Math.max(out.height, 24); } return out; } } else { return getBounds(this.target); } } }, { key: 'clearCache', value: function clearCache() { this._cache = {}; } }, { key: 'cache', value: function cache(k, getter) { // More than one module will often need the same DOM info, so // we keep a cache which is cleared on each position call if (typeof this._cache === 'undefined') { this._cache = {}; } if (typeof this._cache[k] === 'undefined') { this._cache[k] = getter.call(this); } return this._cache[k]; } }, { key: 'enable', value: function enable() { var _this3 = this; var pos = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0]; if (!(this.options.addTargetClasses === false)) { addClass(this.target, this.getClass('enabled')); } addClass(this.element, this.getClass('enabled')); this.enabled = true; this.scrollParents.forEach(function (parent) { if (parent !== _this3.target.ownerDocument) { parent.addEventListener('scroll', _this3.position); } }); if (pos) { this.position(); } } }, { key: 'disable', value: function disable() { var _this4 = this; removeClass(this.target, this.getClass('enabled')); removeClass(this.element, this.getClass('enabled')); this.enabled = false; if (typeof this.scrollParents !== 'undefined') { this.scrollParents.forEach(function (parent) { parent.removeEventListener('scroll', _this4.position); }); } } }, { key: 'destroy', value: function destroy() { var _this5 = this; this.disable(); tethers.forEach(function (tether, i) { if (tether === _this5) { tethers.splice(i, 1); } }); // Remove any elements we were using for convenience from the DOM if (tethers.length === 0) { removeUtilElements(); } } }, { key: 'updateAttachClasses', value: function updateAttachClasses(elementAttach, targetAttach) { var _this6 = this; elementAttach = elementAttach || this.attachment; targetAttach = targetAttach || this.targetAttachment; var sides = ['left', 'top', 'bottom', 'right', 'middle', 'center']; if (typeof this._addAttachClasses !== 'undefined' && this._addAttachClasses.length) { // updateAttachClasses can be called more than once in a position call, so // we need to clean up after ourselves such that when the last defer gets // ran it doesn't add any extra classes from previous calls. this._addAttachClasses.splice(0, this._addAttachClasses.length); } if (typeof this._addAttachClasses === 'undefined') { this._addAttachClasses = []; } var add = this._addAttachClasses; if (elementAttach.top) { add.push(this.getClass('element-attached') + '-' + elementAttach.top); } if (elementAttach.left) { add.push(this.getClass('element-attached') + '-' + elementAttach.left); } if (targetAttach.top) { add.push(this.getClass('target-attached') + '-' + targetAttach.top); } if (targetAttach.left) { add.push(this.getClass('target-attached') + '-' + targetAttach.left); } var all = []; sides.forEach(function (side) { all.push(_this6.getClass('element-attached') + '-' + side); all.push(_this6.getClass('target-attached') + '-' + side); }); defer(function () { if (!(typeof _this6._addAttachClasses !== 'undefined')) { return; } updateClasses(_this6.element, _this6._addAttachClasses, all); if (!(_this6.options.addTargetClasses === false)) { updateClasses(_this6.target, _this6._addAttachClasses, all); } delete _this6._addAttachClasses; }); } }, { key: 'position', value: function position() { var _this7 = this; var flushChanges = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0]; // flushChanges commits the changes immediately, leave true unless you are positioning multiple // tethers (in which case call Tether.Utils.flush yourself when you're done) if (!this.enabled) { return; } this.clearCache(); // Turn 'auto' attachments into the appropriate corner or edge var targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment); this.updateAttachClasses(this.attachment, targetAttachment); var elementPos = this.cache('element-bounds', function () { return getBounds(_this7.element); }); var width = elementPos.width; var height = elementPos.height; if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') { var _lastSize = this.lastSize; // We cache the height and width to make it possible to position elements that are // getting hidden. width = _lastSize.width; height = _lastSize.height; } else { this.lastSize = { width: width, height: height }; } var targetPos = this.cache('target-bounds', function () { return _this7.getTargetBounds(); }); var targetSize = targetPos; // Get an actual px offset from the attachment var offset = offsetToPx(attachmentToOffset(this.attachment), { width: width, height: height }); var targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize); var manualOffset = offsetToPx(this.offset, { width: width, height: height }); var manualTargetOffset = offsetToPx(this.targetOffset, targetSize); // Add the manually provided offset offset = addOffset(offset, manualOffset); targetOffset = addOffset(targetOffset, manualTargetOffset); // It's now our goal to make (element position + offset) == (target position + target offset) var left = targetPos.left + targetOffset.left - offset.left; var top = targetPos.top + targetOffset.top - offset.top; for (var i = 0; i < TetherBase.modules.length; ++i) { var _module2 = TetherBase.modules[i]; var ret = _module2.position.call(this, { left: left, top: top, targetAttachment: targetAttachment, targetPos: targetPos, elementPos: elementPos, offset: offset, targetOffset: targetOffset, manualOffset: manualOffset, manualTargetOffset: manualTargetOffset, scrollbarSize: scrollbarSize, attachment: this.attachment }); if (ret === false) { return false; } else if (typeof ret === 'undefined' || typeof ret !== 'object') { continue; } else { top = ret.top; left = ret.left; } } // We describe the position three different ways to give the optimizer // a chance to decide the best possible way to position the element // with the fewest repaints. var next = { // It's position relative to the page (absolute positioning when // the element is a child of the body) page: { top: top, left: left }, // It's position relative to the viewport (fixed positioning) viewport: { top: top - pageYOffset, bottom: pageYOffset - top - height + innerHeight, left: left - pageXOffset, right: pageXOffset - left - width + innerWidth } }; var doc = this.target.ownerDocument; var win = doc.defaultView; var scrollbarSize = undefined; if (win.innerHeight > doc.documentElement.clientHeight) { scrollbarSize = this.cache('scrollbar-size', getScrollBarSize); next.viewport.bottom -= scrollbarSize.height; } if (win.innerWidth > doc.documentElement.clientWidth) { scrollbarSize = this.cache('scrollbar-size', getScrollBarSize); next.viewport.right -= scrollbarSize.width; } if (['', 'static'].indexOf(doc.body.style.position) === -1 || ['', 'static'].indexOf(doc.body.parentElement.style.position) === -1) { // Absolute positioning in the body will be relative to the page, not the 'initial containing block' next.page.bottom = doc.body.scrollHeight - top - height; next.page.right = doc.body.scrollWidth - left - width; } if (typeof this.options.optimizations !== 'undefined' && this.options.optimizations.moveElement !== false && !(typeof this.targetModifier !== 'undefined')) { (function () { var offsetParent = _this7.cache('target-offsetparent', function () { return getOffsetParent(_this7.target); }); var offsetPosition = _this7.cache('target-offsetparent-bounds', function () { return getBounds(offsetParent); }); var offsetParentStyle = getComputedStyle(offsetParent); var offsetParentSize = offsetPosition; var offsetBorder = {}; ['Top', 'Left', 'Bottom', 'Right'].forEach(function (side) { offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle['border' + side + 'Width']); }); offsetPosition.right = doc.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right; offsetPosition.bottom = doc.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom; if (next.page.top >= offsetPosition.top + offsetBorder.top && next.page.bottom >= offsetPosition.bottom) { if (next.page.left >= offsetPosition.left + offsetBorder.left && next.page.right >= offsetPosition.right) { // We're within the visible part of the target's scroll parent var scrollTop = offsetParent.scrollTop; var scrollLeft = offsetParent.scrollLeft; // It's position relative to the target's offset parent (absolute positioning when // the element is moved to be a child of the target's offset parent). next.offset = { top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top, left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left }; } } })(); } // We could also travel up the DOM and try each containing context, rather than only // looking at the body, but we're gonna get diminishing returns. this.move(next); this.history.unshift(next); if (this.history.length > 3) { this.history.pop(); } if (flushChanges) { flush(); } return true; } // THE ISSUE }, { key: 'move', value: function move(pos) { var _this8 = this; if (!(typeof this.element.parentNode !== 'undefined')) { return; } var same = {}; for (var type in pos) { same[type] = {}; for (var key in pos[type]) { var found = false; for (var i = 0; i < this.history.length; ++i) { var point = this.history[i]; if (typeof point[type] !== 'undefined' && !within(point[type][key], pos[type][key])) { found = true; break; } } if (!found) { same[type][key] = true; } } } var css = { top: '', left: '', right: '', bottom: '' }; var transcribe = function transcribe(_same, _pos) { var hasOptimizations = typeof _this8.options.optimizations !== 'undefined'; var gpu = hasOptimizations ? _this8.options.optimizations.gpu : null; if (gpu !== false) { var yPos = undefined, xPos = undefined; if (_same.top) { css.top = 0; yPos = _pos.top; } else { css.bottom = 0; yPos = -_pos.bottom; } if (_same.left) { css.left = 0; xPos = _pos.left; } else { css.right = 0; xPos = -_pos.right; } if (window.matchMedia) { // HubSpot/tether#207 var retina = window.matchMedia('only screen and (min-resolution: 1.3dppx)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3)').matches; if (!retina) { xPos = Math.round(xPos); yPos = Math.round(yPos); } } css[transformKey] = 'translateX(' + xPos + 'px) translateY(' + yPos + 'px)'; if (transformKey !== 'msTransform') { // The Z transform will keep this in the GPU (faster, and prevents artifacts), // but IE9 doesn't support 3d transforms and will choke. css[transformKey] += " translateZ(0)"; } } else { if (_same.top) { css.top = _pos.top + 'px'; } else { css.bottom = _pos.bottom + 'px'; } if (_same.left) { css.left = _pos.left + 'px'; } else { css.right = _pos.right + 'px'; } } }; var moved = false; if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) { css.position = 'absolute'; transcribe(same.page, pos.page); } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) { css.position = 'fixed'; transcribe(same.viewport, pos.viewport); } else if (typeof same.offset !== 'undefined' && same.offset.top && same.offset.left) { (function () { css.position = 'absolute'; var offsetParent = _this8.cache('target-offsetparent', function () { return getOffsetParent(_this8.target); }); if (getOffsetParent(_this8.element) !== offsetParent) { defer(function () { _this8.element.parentNode.removeChild(_this8.element); offsetParent.appendChild(_this8.element); }); } transcribe(same.offset, pos.offset); moved = true; })(); } else { css.position = 'absolute'; transcribe({ top: true, left: true }, pos.page); } if (!moved) { if (this.options.bodyElement) { this.options.bodyElement.appendChild(this.element); } else { var offsetParentIsBody = true; var currentNode = this.element.parentNode; while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY') { if (getComputedStyle(currentNode).position !== 'static') { offsetParentIsBody = false; break; } currentNode = currentNode.parentNode; } if (!offsetParentIsBody) { this.element.parentNode.removeChild(this.element); this.element.ownerDocument.body.appendChild(this.element); } } } // Any css change will trigger a repaint, so let's avoid one if nothing changed var writeCSS = {}; var write = false; for (var key in css) { var val = css[key]; var elVal = this.element.style[key]; if (elVal !== val) { write = true; writeCSS[key] = val; } } if (write) { defer(function () { extend(_this8.element.style, writeCSS); _this8.trigger('repositioned'); }); } } }]); return TetherClass; })(Evented); TetherClass.modules = []; TetherBase.position = position; var Tether = extend(TetherClass, TetherBase); /* globals TetherBase */ 'use strict'; var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })(); var _TetherBase$Utils = TetherBase.Utils; var getBounds = _TetherBase$Utils.getBounds; var extend = _TetherBase$Utils.extend; var updateClasses = _TetherBase$Utils.updateClasses; var defer = _TetherBase$Utils.defer; var BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom']; function getBoundingRect(tether, to) { if (to === 'scrollParent') { to = tether.scrollParents[0]; } else if (to === 'window') { to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset]; } if (to === document) { to = to.documentElement; } if (typeof to.nodeType !== 'undefined') { (function () { var node = to; var size = getBounds(to); var pos = size; var style = getComputedStyle(to); to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top]; // Account any parent Frames scroll offset if (node.ownerDocument !== document) { var win = node.ownerDocument.defaultView; to[0] += win.pageXOffset; to[1] += win.pageYOffset; to[2] += win.pageXOffset; to[3] += win.pageYOffset; } BOUNDS_FORMAT.forEach(function (side, i) { side = side[0].toUpperCase() + side.substr(1); if (side === 'Top' || side === 'Left') { to[i] += parseFloat(style['border' + side + 'Width']); } else { to[i] -= parseFloat(style['border' + side + 'Width']); } }); })(); } return to; } TetherBase.modules.push({ position: function position(_ref) { var _this = this; var top = _ref.top; var left = _ref.left; var targetAttachment = _ref.targetAttachment; if (!this.options.constraints) { return true; } var _cache = this.cache('element-bounds', function () { return getBounds(_this.element); }); var height = _cache.height; var width = _cache.width; if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') { var _lastSize = this.lastSize; // Handle the item getting hidden as a result of our positioning without glitching // the classes in and out width = _lastSize.width; height = _lastSize.height; } var targetSize = this.cache('target-bounds', function () { return _this.getTargetBounds(); }); var targetHeight = targetSize.height; var targetWidth = targetSize.width; var allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')]; this.options.constraints.forEach(function (constraint) { var outOfBoundsClass = constraint.outOfBoundsClass; var pinnedClass = constraint.pinnedClass; if (outOfBoundsClass) { allClasses.push(outOfBoundsClass); } if (pinnedClass) { allClasses.push(pinnedClass); } }); allClasses.forEach(function (cls) { ['left', 'top', 'right', 'bottom'].forEach(function (side) { allClasses.push(cls + '-' + side); }); }); var addClasses = []; var tAttachment = extend({}, targetAttachment); var eAttachment = extend({}, this.attachment); this.options.constraints.forEach(function (constraint) { var to = constraint.to; var attachment = constraint.attachment; var pin = constraint.pin; if (typeof attachment === 'undefined') { attachment = ''; } var changeAttachX = undefined, changeAttachY = undefined; if (attachment.indexOf(' ') >= 0) { var _attachment$split = attachment.split(' '); var _attachment$split2 = _slicedToArray(_attachment$split, 2); changeAttachY = _attachment$split2[0]; changeAttachX = _attachment$split2[1]; } else { changeAttachX = changeAttachY = attachment; } var bounds = getBoundingRect(_this, to); if (changeAttachY === 'target' || changeAttachY === 'both') { if (top < bounds[1] && tAttachment.top === 'top') { top += targetHeight; tAttachment.top = 'bottom'; } if (top + height > bounds[3] && tAttachment.top === 'bottom') { top -= targetHeight; tAttachment.top = 'top'; } } if (changeAttachY === 'together') { if (tAttachment.top === 'top') { if (eAttachment.top === 'bottom' && top < bounds[1]) { top += targetHeight; tAttachment.top = 'bottom'; top += height; eAttachment.top = 'top'; } else if (eAttachment.top === 'top' && top + height > bounds[3] && top - (height - targetHeight) >= bounds[1]) { top -= height - targetHeight; tAttachment.top = 'bottom'; eAttachment.top = 'bottom'; } } if (tAttachment.top === 'bottom') { if (eAttachment.top === 'top' && top + height > bounds[3]) { top -= targetHeight; tAttachment.top = 'top'; top -= height; eAttachment.top = 'bottom'; } else if (eAttachment.top === 'bottom' && top < bounds[1] && top + (height * 2 - targetHeight) <= bounds[3]) { top += height - targetHeight; tAttachment.top = 'top'; eAttachment.top = 'top'; } } if (tAttachment.top === 'middle') { if (top + height > bounds[3] && eAttachment.top === 'top') { top -= height; eAttachment.top = 'bottom'; } else if (top < bounds[1] && eAttachment.top === 'bottom') { top += height; eAttachment.top = 'top'; } } } if (changeAttachX === 'target' || changeAttachX === 'both') { if (left < bounds[0] && tAttachment.left === 'left') { left += targetWidth; tAttachment.left = 'right'; } if (left + width > bounds[2] && tAttachment.left === 'right') { left -= targetWidth; tAttachment.left = 'left'; } } if (changeAttachX === 'together') { if (left < bounds[0] && tAttachment.left === 'left') { if (eAttachment.left === 'right') { left += targetWidth; tAttachment.left = 'right'; left += width; eAttachment.left = 'left'; } else if (eAttachment.left === 'left') { left += targetWidth; tAttachment.left = 'right'; left -= width; eAttachment.left = 'right'; } } else if (left + width > bounds[2] && tAttachment.left === 'right') { if (eAttachment.left === 'left') { left -= targetWidth; tAttachment.left = 'left'; left -= width; eAttachment.left = 'right'; } else if (eAttachment.left === 'right') { left -= targetWidth; tAttachment.left = 'left'; left += width; eAttachment.left = 'left'; } } else if (tAttachment.left === 'center') { if (left + width > bounds[2] && eAttachment.left === 'left') { left -= width; eAttachment.left = 'right'; } else if (left < bounds[0] && eAttachment.left === 'right') { left += width; eAttachment.left = 'left'; } } } if (changeAttachY === 'element' || changeAttachY === 'both') { if (top < bounds[1] && eAttachment.top === 'bottom') { top += height; eAttachment.top = 'top'; } if (top + height > bounds[3] && eAttachment.top === 'top') { top -= height; eAttachment.top = 'bottom'; } } if (changeAttachX === 'element' || changeAttachX === 'both') { if (left < bounds[0]) { if (eAttachment.left === 'right') { left += width; eAttachment.left = 'left'; } else if (eAttachment.left === 'center') { left += width / 2; eAttachment.left = 'left'; } } if (left + width > bounds[2]) { if (eAttachment.left === 'left') { left -= width; eAttachment.left = 'right'; } else if (eAttachment.left === 'center') { left -= width / 2; eAttachment.left = 'right'; } } } if (typeof pin === 'string') { pin = pin.split(',').map(function (p) { return p.trim(); }); } else if (pin === true) { pin = ['top', 'left', 'right', 'bottom']; } pin = pin || []; var pinned = []; var oob = []; if (top < bounds[1]) { if (pin.indexOf('top') >= 0) { top = bounds[1]; pinned.push('top'); } else { oob.push('top'); } } if (top + height > bounds[3]) { if (pin.indexOf('bottom') >= 0) { top = bounds[3] - height; pinned.push('bottom'); } else { oob.push('bottom'); } } if (left < bounds[0]) { if (pin.indexOf('left') >= 0) { left = bounds[0]; pinned.push('left'); } else { oob.push('left'); } } if (left + width > bounds[2]) { if (pin.indexOf('right') >= 0) { left = bounds[2] - width; pinned.push('right'); } else { oob.push('right'); } } if (pinned.length) { (function () { var pinnedClass = undefined; if (typeof _this.options.pinnedClass !== 'undefined') { pinnedClass = _this.options.pinnedClass; } else { pinnedClass = _this.getClass('pinned'); } addClasses.push(pinnedClass); pinned.forEach(function (side) { addClasses.push(pinnedClass + '-' + side); }); })(); } if (oob.length) { (function () { var oobClass = undefined; if (typeof _this.options.outOfBoundsClass !== 'undefined') { oobClass = _this.options.outOfBoundsClass; } else { oobClass = _this.getClass('out-of-bounds'); } addClasses.push(oobClass); oob.forEach(function (side) { addClasses.push(oobClass + '-' + side); }); })(); } if (pinned.indexOf('left') >= 0 || pinned.indexOf('right') >= 0) { eAttachment.left = tAttachment.left = false; } if (pinned.indexOf('top') >= 0 || pinned.indexOf('bottom') >= 0) { eAttachment.top = tAttachment.top = false; } if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== _this.attachment.top || eAttachment.left !== _this.attachment.left) { _this.updateAttachClasses(eAttachment, tAttachment); _this.trigger('update', { attachment: eAttachment, targetAttachment: tAttachment }); } }); defer(function () { if (!(_this.options.addTargetClasses === false)) { updateClasses(_this.target, addClasses, allClasses); } updateClasses(_this.element, addClasses, allClasses); }); return { top: top, left: left }; } }); /* globals TetherBase */ 'use strict'; var _TetherBase$Utils = TetherBase.Utils; var getBounds = _TetherBase$Utils.getBounds; var updateClasses = _TetherBase$Utils.updateClasses; var defer = _TetherBase$Utils.defer; TetherBase.modules.push({ position: function position(_ref) { var _this = this; var top = _ref.top; var left = _ref.left; var _cache = this.cache('element-bounds', function () { return getBounds(_this.element); }); var height = _cache.height; var width = _cache.width; var targetPos = this.getTargetBounds(); var bottom = top + height; var right = left + width; var abutted = []; if (top <= targetPos.bottom && bottom >= targetPos.top) { ['left', 'right'].forEach(function (side) { var targetPosSide = targetPos[side]; if (targetPosSide === left || targetPosSide === right) { abutted.push(side); } }); } if (left <= targetPos.right && right >= targetPos.left) { ['top', 'bottom'].forEach(function (side) { var targetPosSide = targetPos[side]; if (targetPosSide === top || targetPosSide === bottom) { abutted.push(side); } }); } var allClasses = []; var addClasses = []; var sides = ['left', 'top', 'right', 'bottom']; allClasses.push(this.getClass('abutted')); sides.forEach(function (side) { allClasses.push(_this.getClass('abutted') + '-' + side); }); if (abutted.length) { addClasses.push(this.getClass('abutted')); } abutted.forEach(function (side) { addClasses.push(_this.getClass('abutted') + '-' + side); }); defer(function () { if (!(_this.options.addTargetClasses === false)) { updateClasses(_this.target, addClasses, allClasses); } updateClasses(_this.element, addClasses, allClasses); }); return true; } }); /* globals TetherBase */ 'use strict'; var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })(); TetherBase.modules.push({ position: function position(_ref) { var top = _ref.top; var left = _ref.left; if (!this.options.shift) { return; } var shift = this.options.shift; if (typeof this.options.shift === 'function') { shift = this.options.shift.call(this, { top: top, left: left }); } var shiftTop = undefined, shiftLeft = undefined; if (typeof shift === 'string') { shift = shift.split(' '); shift[1] = shift[1] || shift[0]; var _shift = shift; var _shift2 = _slicedToArray(_shift, 2); shiftTop = _shift2[0]; shiftLeft = _shift2[1]; shiftTop = parseFloat(shiftTop, 10); shiftLeft = parseFloat(shiftLeft, 10); } else { shiftTop = shift.top; shiftLeft = shift.left; } top += shiftTop; left += shiftLeft; return { top: top, left: left }; } }); return Tether; }));
{ "pile_set_name": "Github" }
<html> <head> <title>DarkBASIC Professional Help File</title> </head> <body background="..\..\gfx\dbpro_bg.jpg"> <!-- Page Header --> <center><table width="340" border="0" cellpadding="0" cellspacing="0"> <tr> <td><img src="..\..\gfx\dbph_head_1.jpg" width="102" height="51"></td> <td><a href="..\..\main.htm"><img src="..\..\gfx\dbph_head_2.jpg" width="47" height="51" border="0"></a></td> <td><a href="..\..\commands.htm"><img src="..\..\gfx\dbph_head_3.jpg" width="50" height="51" border="0"></a></td> <td><a href="..\..\examples.htm"><img src="..\..\gfx\dbph_head_4.jpg" width="47" height="51" border="0"></a></td> <td><a href="..\..\documents.htm"><img src="..\..\gfx\dbph_head_5.jpg" width="46" height="51" border="0"></a></td> <td><a href="..\..\index.htm"><img src="..\..\gfx\dbph_head_6.jpg" width="56" height="51" border="0"></a></td> </tr> </table></center> <font face="Verdana"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td> <!-- Function Head --> <font face="Verdana" size="5"> <b> FORCE WATER EFFECT </b> <font face="Verdana" size="2"> <p> This command will use the current control device if it has force feedback capability. </p> </font> <!-- Synopsis --> <table width="590" cellpadding="3"> <tr><td bgcolor="#0d4283"><font color="#ffffff" size="3"><b>&nbsp; Syntax </b></font></td></tr> </table> <font face="Verdana" size="2"> <pre> FORCE WATER EFFECT Magnitude Value, Delay Value </pre> </font> <!-- Parameters --> <table width="590" cellpadding="3"> <tr><td bgcolor="#0d4283"><font color="#ffffff" size="3"><b>&nbsp; Parameters </b></font></td></tr> </table> <font face="Verdana" size="2"> <pre> Magnitude Value </pre> <blockquote> Integer <br> The magnitude value determines the strength of the force between 0 and 100 </blockquote> <pre> Delay Value </pre> <blockquote> Integer <br> The delay value indicates how many milliseconds the effect lasts for. A delay value of zero indicates an infinite effect of force </blockquote> </font> <BR> <!-- Returns --> <table width="590" cellpadding="3"> <tr><td bgcolor="#0d4283"><font color="#ffffff" size="3"><b>&nbsp; Returns </b></font></td></tr> </table> <font face="Verdana" size="2"> <p> This command does not return a value. </p> </font> <!-- Description --> <table width="590" cellpadding="3"> <tr><td bgcolor="#0d4283"><font color="#ffffff" size="3"><b>&nbsp; Description </b></font></td></tr> </table> <font face="Verdana" size="2"> <p> The command will force the device to simulate the effect of moving through water. The force applied to any joystick movement will simulate a dampening effect when fast movements are attempted by the user. The magnitude value determines the strength of the force between 0 and 100. The delay value indicates how many milliseconds the effect lasts for. A delay value of zero indicates an infinite effect of force. The magnitude and delay should be integer values. This command is NOT an action forced on the controller, but an influence against the natural movement of the main joypad by the end user. Only some devices offer this counterforce. Counterforce will not be available in such devices as rumble pack gamepads. </p> </font> <!-- Examples --> <table width="590" cellpadding="3"> <tr><td bgcolor="#0d4283"><font color="#ffffff" size="3"><b>&nbsp; Example Code </b></font></td></tr> </table> <font face="Verdana" size="2"> <pre> rem Prepare Force Feedback (if available)<BR> ForcePresent=0<BR> empty checklist<BR> PERFORM CHECKLIST FOR CONTROL DEVICES<BR> for c=1 to checklist quantity()<BR> if checklist value a(c)=1<BR> SET CONTROL DEVICE checklist string$(c)<BR> ForcePresent=1<BR> endif<BR> next c<BR> rem Test loop<BR> do<BR> rem Produce random values<BR> MagnitudeValue=rnd(100)<BR> DelayValue=rnd(100)<BR> if ForcePresent=1<BR> FORCE WATER EFFECT MagnitudeValue, DelayValue<BR> wait 1000*8<BR> FORCE NO EFFECT<BR> endif<BR> loop<BR> end<BR> </pre> </font> <!-- See Also --> <table width="590" cellpadding="3"> <tr><td bgcolor="#0d4283"><font color="#ffffff" size="3"><b>&nbsp; See also </b></font></td></tr> </table> <font face="Verdana" size="2"> <p> <a href="..\input.htm">INPUT Commands Menu<BR> </a> <a href="..\..\index.htm">Index</a><BR> </p> </font> <BR> <!-- Function Footer --> </font> </td></tr></table> <br> <!-- Page Footer --> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center"><img src="..\..\gfx\dbph_foot_1.jpg" width="340" height="38"></td> </tr> </table> </body> </html>
{ "pile_set_name": "Github" }
define(function () { /** * "Convert" value into a 32-bit unsigned integer. * IMPORTANT: Value will wrap at 2^32. */ function toUInt(val){ return val >>> 0; } return toUInt; });
{ "pile_set_name": "Github" }
package au.edu.wehi.idsv.debruijn.positional.optimiseddatastructures; import java.util.Collection; import java.util.stream.Stream; public abstract class SortedByPositionCollection<T, TColl extends Collection<T>> extends SortedByPosition<T, TColl> implements Collection<T> { public SortedByPositionCollection(int blockBits) { super(blockBits); } @Override protected T popAtPosition(TColl ts) { T t = peekAtPosition(ts); remove(t); return t; } @Override protected boolean addAtPosition(TColl existing, T toAdd) { return existing.add(toAdd); } @Override protected boolean removeAtPosition(TColl ts, T obj) { return ts.remove(obj); } @Override protected boolean positionIsEmpty(TColl ts) { return ts.isEmpty(); } @Override protected int positionSize(TColl ts) { return ts.size(); } @Override protected boolean containsAtPosition(TColl ts, T obj) { return ts.contains(obj); } @Override protected Stream<T> positionStream(TColl coll) { return coll.stream(); } }
{ "pile_set_name": "Github" }
{ "parent": "minecraft:item/generated", "textures": { "layer0": "techreborn:item/dust/zinc_dust" } }
{ "pile_set_name": "Github" }
{ "91": { "number": "91", "name": "الشمس", "name_latin": "Asy-Syams", "number_of_ayah": "15", "text": { "1": "وَالشَّمْسِ وَضُحٰىهَاۖ", "2": "وَالْقَمَرِ اِذَا تَلٰىهَاۖ", "3": "وَالنَّهَارِ اِذَا جَلّٰىهَاۖ", "4": "وَالَّيْلِ اِذَا يَغْشٰىهَاۖ", "5": "وَالسَّمَاۤءِ وَمَا بَنٰىهَاۖ", "6": "وَالْاَرْضِ وَمَا طَحٰىهَاۖ", "7": "وَنَفْسٍ وَّمَا سَوّٰىهَاۖ", "8": "فَاَلْهَمَهَا فُجُوْرَهَا وَتَقْوٰىهَاۖ", "9": "قَدْ اَفْلَحَ مَنْ زَكّٰىهَاۖ", "10": "وَقَدْ خَابَ مَنْ دَسّٰىهَاۗ", "11": "كَذَّبَتْ ثَمُوْدُ بِطَغْوٰىهَآ ۖ", "12": "اِذِ انْۢبَعَثَ اَشْقٰىهَاۖ", "13": "فَقَالَ لَهُمْ رَسُوْلُ اللّٰهِ نَاقَةَ اللّٰهِ وَسُقْيٰهَاۗ", "14": "فَكَذَّبُوْهُ فَعَقَرُوْهَاۖ فَدَمْدَمَ عَلَيْهِمْ رَبُّهُمْ بِذَنْۢبِهِمْ فَسَوّٰىهَاۖ", "15": "وَلَا يَخَافُ عُقْبٰهَا ࣖ" }, "translations": { "id": { "name": "Matahari", "text": { "1": "Demi matahari dan sinarnya pada pagi hari,", "2": "demi bulan apabila mengiringinya,", "3": "demi siang apabila menampakkannya,", "4": "demi malam apabila menutupinya (gelap gulita),", "5": "demi langit serta pembinaannya (yang menakjubkan),", "6": "demi bumi serta penghamparannya,", "7": "demi jiwa serta penyempurnaan (ciptaan)nya,", "8": "maka Dia mengilhamkan kepadanya (jalan) kejahatan dan ketakwaannya,", "9": "sungguh beruntung orang yang menyucikannya (jiwa itu),", "10": "dan sungguh rugi orang yang mengotorinya.", "11": "(Kaum) samud telah mendustakan (rasulnya) karena mereka melampaui batas (zalim),", "12": "ketika bangkit orang yang paling celaka di antara mereka,", "13": "lalu Rasul Allah (Saleh) berkata kepada mereka, “(Biarkanlah) unta betina dari Allah ini dengan minumannya.”", "14": "Namun mereka mendustakannya dan menyembelihnya, karena itu Tuhan membinasakan mereka karena dosanya, lalu diratakan-Nya (dengan tanah),", "15": "dan Dia tidak takut terhadap akibatnya." } } }, "tafsir": { "id": { "kemenag": { "name": "Kemenag", "source": "Aplikasi Quran Kementrian Agama Republik Indonesia", "text": { "1": "Allah bersumpah dengan matahari dan cahayanya pada waktu duha yang sangat terang dan kontras dengan sesaat sebelumnya di mana kegelapan menutup alam ini. Kemudian Allah bersumpah dengan bulan yang bertolak belakang dengan matahari, sebab ia bukan sumber cahaya tetapi hanya menerima cahaya dari matahari.\n\nMenurut kajian ilmiah, cahaya di pagi hari adalah yang paling lengkap kekayaan panjang gelombangnya. Oleh karena itu, cahaya matahari pagi paling baik khasiatnya bagi manusia. Matahari adalah sumber energi utama bagi manusia, sedang cahayanya terdiri dari cahaya tampak, inframerah, dan ultraviolet. Cahaya tampak memiliki tujuh spektrum yang berbeda dan masing-masing memiliki kegunaan yang berbeda bagi tubuh manusia. Adapun inframerah bermanfaat untuk mengurangi rasa sakit pada otot-otot, dan ultraviolet berfungsi sebagai fitokatalis yang mempercepat perubahan pro-vitamin D yang ada pada kulit manusia menjadi vitamin D.", "2": "Allah bersumpah dengan matahari dan cahayanya pada waktu duha yang sangat terang dan kontras dengan sesaat sebelumnya di mana kegelapan menutup alam ini. Kemudian Allah bersumpah dengan bulan yang bertolak belakang dengan matahari, sebab ia bukan sumber cahaya tetapi hanya menerima cahaya dari matahari.\n\nMenurut kajian ilmiah, cahaya di pagi hari adalah yang paling lengkap kekayaan panjang gelombangnya. Oleh karena itu, cahaya matahari pagi paling baik khasiatnya bagi manusia. Matahari adalah sumber energi utama bagi manusia, sedang cahayanya terdiri dari cahaya tampak, inframerah, dan ultraviolet. Cahaya tampak memiliki tujuh spektrum yang berbeda dan masing-masing memiliki kegunaan yang berbeda bagi tubuh manusia. Adapun inframerah bermanfaat untuk mengurangi rasa sakit pada otot-otot, dan ultraviolet berfungsi sebagai fitokatalis yang mempercepat perubahan pro-vitamin D yang ada pada kulit manusia menjadi vitamin D.", "3": "Selanjutnya Allah bersumpah dengan siang dan malam. Siang menampakkan matahari, sedangkan malam menyembunyikan matahari. Dengan ini, Allah memberikan isyarat tentang sistem perputaran bulan dan bumi terhadap matahari sebagai penanda waktu bagi manusia. Perputaran bumi terhadap matahari menimbulkan sistem penanda waktu syamsiah sedang perputaran bulan terhadap bumi menimbulkan penanda waktu qomariyah. Pergerakan ketiga benda langit ini yang begitu terstruktur tersebut menunjukkan betapa kuasa Allah.", "4": "Selanjutnya Allah bersumpah dengan siang dan malam. Siang menampakkan matahari, sedangkan malam menyembunyikan matahari. Dengan ini, Allah memberikan isyarat tentang sistem perputaran bulan dan bumi terhadap matahari sebagai penanda waktu bagi manusia. Perputaran bumi terhadap matahari menimbulkan sistem penanda waktu syamsiah sedang perputaran bulan terhadap bumi menimbulkan penanda waktu qomariyah. Pergerakan ketiga benda langit ini yang begitu terstruktur tersebut menunjukkan betapa kuasa Allah.", "5": "Selanjutnya lagi, Allah bersumpah dengan langit dan bumi. Langit, yaitu kosmos beserta segala isinya, menyangga langit itu sehingga tetap berfungsi sebagai atap bumi. Dan bumi itu terhampar sehingga menyediakan potensi-potensi yang dapat dimanfaatkan manusia untuk hidup di atasnya.", "6": "Selanjutnya lagi, Allah bersumpah dengan langit dan bumi. Langit, yaitu kosmos beserta segala isinya, menyangga langit itu sehingga tetap berfungsi sebagai atap bumi. Dan bumi itu terhampar sehingga menyediakan potensi-potensi yang dapat dimanfaatkan manusia untuk hidup di atasnya.", "7": "Terakhir, Allah bersumpah dengan diri manusia yang telah Ia ciptakan dengan kondisi fisik dan psikis yang sempurna. Setelah menciptakannya secara sempurna, Allah memasukkan ke dalam diri manusia potensi jahat dan baik.", "8": "Terakhir, Allah bersumpah dengan diri manusia yang telah Ia ciptakan dengan kondisi fisik dan psikis yang sempurna. Setelah menciptakannya secara sempurna, Allah memasukkan ke dalam diri manusia potensi jahat dan baik.", "9": "Dalam ayat-ayat ini, Allah menegaskan pesan yang begitu pentingnya sehingga untuk itu Ia perlu bersumpah. Pesan itu adalah bahwa orang yang membersihkan dirinya, yaitu mengendalikan dirinya sehingga hanya mengerjakan perbuatan-perbuatan baik, akan beruntung, yaitu bahagia di dunia dan terutama di akhirat. Sedangkan orang yang mengotori dirinya, yaitu mengikuti hawa nafsunya sehingga melakukan perbuatan-perbuatan dosa, akan celaka, yaitu tidak bahagia di dunia dan di akhirat masuk neraka.", "10": "Dalam ayat-ayat ini, Allah menegaskan pesan yang begitu pentingnya sehingga untuk itu Ia perlu bersumpah. Pesan itu adalah bahwa orang yang membersihkan dirinya, yaitu mengendalikan dirinya sehingga hanya mengerjakan perbuatan-perbuatan baik, akan beruntung, yaitu bahagia di dunia dan terutama di akhirat. Sedangkan orang yang mengotori dirinya, yaitu mengikuti hawa nafsunya sehingga melakukan perbuatan-perbuatan dosa, akan celaka, yaitu tidak bahagia di dunia dan di akhirat masuk neraka.", "11": "Kaum Samud adalah umat Nabi Saleh. Mereka telah mendustakan dan mengingkari kenabian dan ajaran-ajaran yang dibawa Nabi Saleh dari Allah. Nabi Saleh diberi mukjizat oleh Allah sebagai ujian bagi kaumnya, yaitu seekor unta betina yang dijelmakan dari sebuah batu besar, untuk menandingi keahlian kaum itu yang sangat piawai dalam seni patung dari batu. Bila mereka piawai dalam seni patung sehingga patung itu terlihat bagaikan hidup, maka mukjizat Nabi Saleh adalah menjelmakan seekor unta betina yang benar-benar hidup dari sebuah batu. Akan tetapi, mereka tidak mengakuinya, dan berusaha membunuh unta itu.", "12": "Awal kecelakaan bagi kaum Samud adalah ketika tampil seorang yang paling jahat dari mereka, yaitu Qudar bin Salif. Ia adalah seorang yang sangat berani, perkasa, dan bengis. Ia datang memprovokasi kaumnya untuk membunuh unta betina mukjizat Nabi Saleh.", "13": "Nabi Saleh memperingatkan kaumnya agar tidak mengganggu unta itu. Ia memperingatkan bahwa unta itu adalah mukjizat dari Allah, dan haknya untuk memperoleh minum berselang hari dengan mereka, harus dihormati. Ia memperingatkan pula bahwa bila mereka mengganggunya, mereka akan mendapat bahaya.", "14": "Akan tetapi, kaumnya memandang Nabi Saleh bohong, begitu juga unta itu sebagai mukjizat, dan menganggap sepi peringatan Nabi Saleh tersebut. Unta itu mereka tangkap beramai-ramai, lalu Qudar bin Salif membunuhnya dengan cara memotong-motongnya. Akhirnya Allah meratakan negeri mereka dengan tanah, dengan mengirim petir yang menggelegar yang diiringi gempa yang dahsyat, sebagai balasan pembangkangan dan dosa-dosa mereka.", "15": "Allah tidak peduli bencana yang Ia timpakan kepada mereka dengan korban yang begitu besar. Hal itu karena pembangkangan mereka yang sudah sangat keterlaluan, yaitu membunuh unta betina (mukjizat) yang diturunkan-Nya kepada nabi-Nya." } } } } } }
{ "pile_set_name": "Github" }
(function (global) { var etimes = document.querySelector("#etimes") , dtimes = document.querySelector("#dtimes") , nrsamples = document.querySelector("#nrsamples"); function printStreamTimes(e, d, nr) { !!e && (etimes.innerHTML = ""+e); !!d && (dtimes.innerHTML = ""+d); !!nr && (nrsamples.innerHTML = ""+nr); } global.printStreamTimes = printStreamTimes; var tdtimes = document.querySelector("#dtotaltime") , tetimes = document.querySelector("#etotaltime") , dsize = document.querySelector("#dsize") , esize = document.querySelector("#esize"); function printFileTimes(ds, es, td, te) { !!ds && (dsize.innerHTML = ""+ds); !!es && (esize.innerHTML = ""+es); !!td && (tdtimes.innerHTML = ""+td); !!te && (tetimes.innerHTML = ""+te); } global.printFileTimes = printFileTimes; function addDownloadLink(filename, sel, data, mimetype) { var url = "data:"+mimetype+";base64,"+btoa(data); var container = document.querySelector(sel).parentElement; var anchor = "<br/><a download=\""+filename+"\" href=\"" + url + "\">" + filename + " ("+data.length/1024.0+" Kbytes)</a>"; container.innerHTML += anchor; } function handleFileSelect(evt, isTypedArray) { var file = evt.target.files[0]; Speex.readFile(evt, function(e) { var tks = file.name.split("."); var filename = tks[0] , ext = tks[1]; var samples, sampleRate; if (ext === "ogg") { var data = e.target.result, ret, header; ret = Speex.decodeFile(data); samples = ret[0]; header = ret[1]; sampleRate = header.rate; addDownloadLink(filename+".wav", "#file_ogg", samples, "audio/wav"); printFileTimes(samples.length*2, file.length, performance.getEntriesByName("decode")[0].duration, null); Speex.util.play(samples, sampleRate); } else if (ext == "wav") { var data = e.target.result; samples = Speex.encodeFile(data); addDownloadLink(filename+".ogg", "#file_wav", samples, "audio/ogg"); printFileTimes(data.length, samples.length, 0, performance.getEntriesByName("encode")[0].duration); } }, isTypedArray); } document.getElementById('file_ogg').addEventListener('change', function (evt) { handleFileSelect(evt); }, false); document.getElementById('file_wav').addEventListener('change', function (evt) { handleFileSelect(evt, true); }, false); setTimeout(function(){ Speex.checkAudioElements(); }, 200); })(window);
{ "pile_set_name": "Github" }
//! Trait implementations for `BitBox` use crate::{ boxed::BitBox, order::BitOrder, pointer::BitPtr, slice::BitSlice, store::BitStore, vec::BitVec, }; use alloc::boxed::Box; use core::{ any, borrow::{ Borrow, BorrowMut, }, cmp, convert::TryFrom, fmt::{ self, Binary, Debug, Display, Formatter, LowerHex, Octal, Pointer, UpperHex, }, hash::{ Hash, Hasher, }, }; use tap::pipe::Pipe; #[cfg(not(tarpaulin_include))] impl<O, T> Borrow<BitSlice<O, T>> for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline(always)] fn borrow(&self) -> &BitSlice<O, T> { self.as_bitslice() } } #[cfg(not(tarpaulin_include))] impl<O, T> BorrowMut<BitSlice<O, T>> for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline(always)] fn borrow_mut(&mut self) -> &mut BitSlice<O, T> { self.as_mut_bitslice() } } #[cfg(not(tarpaulin_include))] impl<O, T> Clone for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline] fn clone(&self) -> Self { self.as_bitslice().pipe(Self::from_bitslice) } } #[cfg(not(tarpaulin_include))] impl<O, T> Eq for BitBox<O, T> where O: BitOrder, T: BitStore, { } #[cfg(not(tarpaulin_include))] impl<O, T> Ord for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline] fn cmp(&self, other: &Self) -> cmp::Ordering { self.as_bitslice().cmp(other.as_bitslice()) } } #[cfg(not(tarpaulin_include))] impl<O1, O2, T1, T2> PartialEq<BitBox<O2, T2>> for BitSlice<O1, T1> where O1: BitOrder, O2: BitOrder, T1: BitStore, T2: BitStore, { #[inline] fn eq(&self, other: &BitBox<O2, T2>) -> bool { self == other.as_bitslice() } } #[cfg(not(tarpaulin_include))] impl<O1, O2, T1, T2> PartialEq<BitBox<O2, T2>> for &BitSlice<O1, T1> where O1: BitOrder, O2: BitOrder, T1: BitStore, T2: BitStore, { #[inline] fn eq(&self, other: &BitBox<O2, T2>) -> bool { *self == other.as_bitslice() } } #[cfg(not(tarpaulin_include))] impl<O1, O2, T1, T2> PartialEq<BitBox<O2, T2>> for &mut BitSlice<O1, T1> where O1: BitOrder, O2: BitOrder, T1: BitStore, T2: BitStore, { #[inline] fn eq(&self, other: &BitBox<O2, T2>) -> bool { **self == other.as_bitslice() } } #[cfg(not(tarpaulin_include))] impl<O, T, Rhs> PartialEq<Rhs> for BitBox<O, T> where O: BitOrder, T: BitStore, Rhs: ?Sized + PartialEq<BitSlice<O, T>>, { #[inline] fn eq(&self, other: &Rhs) -> bool { other == self.as_bitslice() } } #[cfg(not(tarpaulin_include))] impl<O, T> PartialOrd<BitBox<O, T>> for BitSlice<O, T> where O: BitOrder, T: BitStore, { #[inline] fn partial_cmp(&self, other: &BitBox<O, T>) -> Option<cmp::Ordering> { self.partial_cmp(other.as_bitslice()) } } #[cfg(not(tarpaulin_include))] impl<O, T, Rhs> PartialOrd<Rhs> for BitBox<O, T> where O: BitOrder, T: BitStore, Rhs: ?Sized + PartialOrd<BitSlice<O, T>>, { #[inline] fn partial_cmp(&self, other: &Rhs) -> Option<cmp::Ordering> { other.partial_cmp(self.as_bitslice()) } } #[cfg(not(tarpaulin_include))] impl<O, T> AsRef<BitSlice<O, T>> for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline(always)] fn as_ref(&self) -> &BitSlice<O, T> { self.as_bitslice() } } #[cfg(not(tarpaulin_include))] impl<O, T> AsMut<BitSlice<O, T>> for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline(always)] fn as_mut(&mut self) -> &mut BitSlice<O, T> { self.as_mut_bitslice() } } #[cfg(not(tarpaulin_include))] impl<'a, O, T> From<&'a BitSlice<O, T>> for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline(always)] fn from(slice: &'a BitSlice<O, T>) -> Self { Self::from_bitslice(slice) } } #[cfg(not(tarpaulin_include))] impl<O, T> From<BitVec<O, T>> for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline(always)] fn from(bv: BitVec<O, T>) -> Self { bv.into_boxed_bitslice() } } #[cfg(not(tarpaulin_include))] impl<O, T> Into<Box<[T]>> for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline(always)] fn into(self) -> Box<[T]> { self.into_boxed_slice() } } #[cfg(not(tarpaulin_include))] impl<O, T> TryFrom<Box<[T]>> for BitBox<O, T> where O: BitOrder, T: BitStore, { type Error = Box<[T]>; #[inline(always)] fn try_from(boxed: Box<[T]>) -> Result<Self, Self::Error> { Self::try_from_boxed_slice(boxed) } } #[cfg(not(tarpaulin_include))] impl<O, T> Default for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline(always)] fn default() -> Self { Self { pointer: BitPtr::EMPTY.to_nonnull(), } } } #[cfg(not(tarpaulin_include))] impl<O, T> Debug for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline] fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { if fmt.alternate() { self.bitptr().render( fmt, "Box", Some(any::type_name::<O>()), None, )?; fmt.write_str(" ")?; } Display::fmt(self.as_bitslice(), fmt) } } #[cfg(not(tarpaulin_include))] impl<O, T> Display for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline] fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { Display::fmt(self.as_bitslice(), fmt) } } #[cfg(not(tarpaulin_include))] impl<O, T> Binary for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline] fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { Binary::fmt(self.as_bitslice(), fmt) } } #[cfg(not(tarpaulin_include))] impl<O, T> LowerHex for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline] fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { LowerHex::fmt(self.as_bitslice(), fmt) } } #[cfg(not(tarpaulin_include))] impl<O, T> Octal for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline] fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { Octal::fmt(self.as_bitslice(), fmt) } } #[cfg(not(tarpaulin_include))] impl<O, T> Pointer for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline] fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { self.bitptr() .render(fmt, "Box", Some(any::type_name::<O>()), None) } } #[cfg(not(tarpaulin_include))] impl<O, T> UpperHex for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline] fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { UpperHex::fmt(self.as_bitslice(), fmt) } } #[cfg(not(tarpaulin_include))] impl<O, T> Hash for BitBox<O, T> where O: BitOrder, T: BitStore, { #[inline] fn hash<H>(&self, state: &mut H) where H: Hasher { self.as_bitslice().hash(state) } } #[cfg(not(tarpaulin_include))] unsafe impl<O, T> Send for BitBox<O, T> where O: BitOrder, T: BitStore, { } #[cfg(not(tarpaulin_include))] unsafe impl<O, T> Sync for BitBox<O, T> where O: BitOrder, T: BitStore, { } #[cfg(not(tarpaulin_include))] impl<O, T> Unpin for BitBox<O, T> where O: BitOrder, T: BitStore, { }
{ "pile_set_name": "Github" }
export declare function InterruptError(): any;
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <merge xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <TextView android:id="@android:id/text1" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:textAppearance="@style/TextAppearance.InitialsView" tools:text="A" /> <ImageView android:id="@android:id/icon" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" /> </merge>
{ "pile_set_name": "Github" }
<?php /* * Copyright 2014 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. */ class Google_Service_Vision_GoogleCloudVisionV1p2beta1AnnotateFileResponse extends Google_Collection { protected $collection_key = 'responses'; protected $errorType = 'Google_Service_Vision_Status'; protected $errorDataType = ''; protected $inputConfigType = 'Google_Service_Vision_GoogleCloudVisionV1p2beta1InputConfig'; protected $inputConfigDataType = ''; protected $responsesType = 'Google_Service_Vision_GoogleCloudVisionV1p2beta1AnnotateImageResponse'; protected $responsesDataType = 'array'; public $totalPages; /** * @param Google_Service_Vision_Status */ public function setError(Google_Service_Vision_Status $error) { $this->error = $error; } /** * @return Google_Service_Vision_Status */ public function getError() { return $this->error; } /** * @param Google_Service_Vision_GoogleCloudVisionV1p2beta1InputConfig */ public function setInputConfig(Google_Service_Vision_GoogleCloudVisionV1p2beta1InputConfig $inputConfig) { $this->inputConfig = $inputConfig; } /** * @return Google_Service_Vision_GoogleCloudVisionV1p2beta1InputConfig */ public function getInputConfig() { return $this->inputConfig; } /** * @param Google_Service_Vision_GoogleCloudVisionV1p2beta1AnnotateImageResponse */ public function setResponses($responses) { $this->responses = $responses; } /** * @return Google_Service_Vision_GoogleCloudVisionV1p2beta1AnnotateImageResponse */ public function getResponses() { return $this->responses; } public function setTotalPages($totalPages) { $this->totalPages = $totalPages; } public function getTotalPages() { return $this->totalPages; } }
{ "pile_set_name": "Github" }
<!-- Copyright (c) Microsoft Corporation. All rights reserved --> <!-- Licensed under the MIT License. --> <UserControl x:Class="SnipInsight.Views.EditorSideNavigation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:SnipInsight.Views" xmlns:ari="clr-namespace:SnipInsight.Controls.Ariadne" xmlns:properties="clr-namespace:SnipInsight.Properties" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="50"> <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="../ResourceDictionaries/Icons.xaml" /> <ResourceDictionary Source="../ResourceDictionaries/AriadneStyles.xaml" /> <ResourceDictionary Source="../ResourceDictionaries/SnipStyles.xaml" /> <ResourceDictionary Source="../ResourceDictionaries/SnipTemplates.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources> <Grid> <StackPanel> <Grid Height="20"/> <Grid> <ari:AriEraseRadioButton x:Name="PenToggle" VerticalAlignment="Stretch" IsChecked="{Binding PenChecked, Mode=TwoWay}" Checked="PenButton_Check" Click="PenButton_Click" LostKeyboardFocus="PenToggleLostKeyboardFocus" ToolTip="{x:Static properties:Resources.Pen_Toggle}" AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self},Path= Name}"/> <ari:AriIcon Template="{StaticResource Drawing_Pen_32_Icon}" /> <Popup x:Name="PenPalettePopup" Placement="Left" PlacementTarget="{Binding ElementName=PenToggle}" IsOpen="false" Focusable="True" StaysOpen="False"> <Grid x:Name="ToggleContainer" HorizontalAlignment="Center" Opacity="1" FocusManager.IsFocusScope="True" Width="302.5" Height="158"> <Border x:Name="Tool2Border" BorderThickness="0.5" BorderBrush="{DynamicResource ThemeDarkGrey}" Background="{DynamicResource ThemeGreyBrush}" Style="{DynamicResource ToggleContainerGrid}"> <StackPanel x:Name="ToggleStackContainer" VerticalAlignment="Top" Orientation="Vertical"> <TextBlock Text="Colors" Margin="10,10,10,0"/> <StackPanel Orientation="Horizontal"> <ari:AriInkRadioButton x:Name="BlackColorButton" Ink="Black" IsChecked="True" Checked="ColorButton_Checked" AutomationProperties.Name="BlackColorButton"/> <ari:AriInkRadioButton x:Name="RedColorButton" Ink="Red" Checked="ColorButton_Checked" AutomationProperties.Name="RedColorButton"/> <ari:AriInkRadioButton x:Name="YellowColorButton" Ink="Orange" Checked="ColorButton_Checked" AutomationProperties.Name="OrangeColorButton"/> <ari:AriInkRadioButton x:Name="GreenColorButton" Ink="Green" Checked="ColorButton_Checked" AutomationProperties.Name="GreenColorButton"/> <ari:AriInkRadioButton x:Name="BlueColorButton" Ink="Blue" Checked="ColorButton_Checked" AutomationProperties.Name="BlueColorButton" /> </StackPanel> <TextBlock Text="Weight" Margin="10,2"/> <StackPanel Orientation="Horizontal"> <ari:AriIconLabelMenuItem x:Name="PenSize1Button" Label="Very Fine" IsShy="True" Height="50" Click="PenSizeButton_Click" AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self},Path= Name}"> <ari:AriIconLabelMenuItem.Icon> <Grid Height="32" Width="32"> <Ellipse x:Name="PenSize1Shape" Fill="#FFCCCCCC" Height="8" Width="8" /> </Grid> </ari:AriIconLabelMenuItem.Icon> </ari:AriIconLabelMenuItem> <ari:AriIconLabelMenuItem x:Name="PenSize3Button" Label="Fine" IsShy="True" Height="50" Click="PenSizeButton_Click" AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self},Path= Name}"> <ari:AriIconLabelMenuItem.Icon> <Grid Height="32" Width="32"> <Ellipse x:Name="PenSize3Shape" Fill="#FFCCCCCC" Height="12" Width="12" /> </Grid> </ari:AriIconLabelMenuItem.Icon> </ari:AriIconLabelMenuItem> <ari:AriIconLabelMenuItem x:Name="PenSize5Button" Label="Medium" IsShy="True" Height="50" Click="PenSizeButton_Click" AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self},Path= Name}"> <ari:AriIconLabelMenuItem.Icon> <Grid Height="32" Width="32"> <Ellipse x:Name="PenSize5Shape" Fill="#FFCCCCCC" Height="16" Width="16" /> </Grid> </ari:AriIconLabelMenuItem.Icon> </ari:AriIconLabelMenuItem> <ari:AriIconLabelMenuItem x:Name="PenSize9Button" Label="Thick" IsShy="True" Height="50" Click="PenSizeButton_Click" LostKeyboardFocus="PenSizeLostKeyboardFocus" AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self},Path= Name}"> <ari:AriIconLabelMenuItem.Icon> <Grid Height="32" Width="32"> <Ellipse x:Name="PenSize9Shape" Fill="#FFCCCCCC" Height="20" Width="20" /> </Grid> </ari:AriIconLabelMenuItem.Icon> </ari:AriIconLabelMenuItem> </StackPanel> </StackPanel> </Border> </Grid> </Popup> <Rectangle Style="{DynamicResource SideNavigationRectangle}" Visibility="{Binding ElementName=PenToggle, Path=IsChecked, Converter={StaticResource BooleanToVisibility}}"/> <ari:AriIcon Template="{StaticResource Expand_Icon}" HorizontalAlignment="Right" Margin="3,0" Visibility="{Binding ElementName=PenToggle, Path=IsChecked, Converter={StaticResource BooleanToVisibility}}"/> </Grid> <Grid> <ari:AriEraseRadioButton x:Name="HighlighterButton" IsChecked="{Binding HighlighterChecked, Mode=TwoWay}" Checked="Highlighter_Checked" ToolTip ="{x:Static properties:Resources.Highlighter}" AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self},Path= Name}" /> <ari:AriIcon VerticalAlignment="Center" HorizontalAlignment="Center" Template="{StaticResource Highlight_32_Icon}" /> <Rectangle Style="{DynamicResource SideNavigationRectangle}" Visibility="{Binding ElementName=HighlighterButton, Path=IsChecked, Converter={StaticResource BooleanToVisibility}}" AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self},Path= Name}"/> </Grid> <Grid> <ari:AriEraseRadioButton x:Name="EraserButton" IsChecked="{Binding EraserChecked, Mode=TwoWay}" ToolTip="{x:Static properties:Resources.Eraser}" AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self},Path= Name}"/> <ari:AriIcon VerticalAlignment="Center" HorizontalAlignment="Center" Template="{StaticResource Eraser_32_Icon}" /> <Rectangle Style="{DynamicResource SideNavigationRectangle}" Visibility="{Binding ElementName=EraserButton, Path=IsChecked, Converter={StaticResource BooleanToVisibility}}"/> </Grid> <Grid> <ari:AriEraseRadioButton x:Name="EraseAllButton" Command="{Binding EraseAllCommand}" ToolTip="{x:Static properties:Resources.Erase_All}" AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self},Path= Name}"/> <ari:AriIcon Template="{StaticResource EraseAll_32_Icon}" /> </Grid> <Grid> <ari:AriEraseRadioButton x:Name="UndoButton" Command="{Binding UndoCommand}" ToolTip="{x:Static properties:Resources.Undo}" AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self},Path= Name}"/> <ari:AriIcon Template="{StaticResource Undo_32_Icon}" /> </Grid> <Grid> <ari:AriEraseRadioButton x:Name="RedoButton" Command="{Binding RedoCommand}" ToolTip="{x:Static properties:Resources.Redo}" AutomationProperties.Name="{Binding RelativeSource={RelativeSource Self},Path= Name}"/> <ari:AriIcon Template="{StaticResource Redo_32_Icon}" /> </Grid> </StackPanel> </Grid> </UserControl>
{ "pile_set_name": "Github" }
import { AppPage } from './app.po'; describe('workspace-project App', () => { let page: AppPage; beforeEach(() => { page = new AppPage(); }); it('should display welcome message', () => { page.navigateTo(); expect(page.getParagraphText()).toEqual('Welcome to app!'); }); });
{ "pile_set_name": "Github" }
extension VariableValue: Encodable where Value: Encodable { /// Encodes this value into the given encoder. /// - Parameter encoder: The encoder to write data to. /// - Throws: This function throws an error if any values are invalid for the given encoder's format. public func encode(to encoder: Encoder) throws { var container = encoder.singleValueContainer() switch self { case .value(let value): try container.encode(value) case .variable(let variable): try container.encode(variable) } } }
{ "pile_set_name": "Github" }
import React from 'react'; import PropTypes from 'prop-types'; import classNames from '../../utils/classnames'; const PreviewButton = (props) => { const { className, primary, children, ...others } = props; const cls = classNames({ 'weui-form-preview__btn': true, 'weui-form-preview__btn_default': !primary, 'weui-form-preview__btn_primary': primary, [className]: className }); return ( <a className={cls} {...others}> {children} </a> ); }; PreviewButton.propTypes = { /** * Primary style of button * */ primary: PropTypes.bool }; PreviewButton.defaultProps = { primary: false }; export default PreviewButton;
{ "pile_set_name": "Github" }
AusweisApp2 1.12.2 ^^^^^^^^^^^^^^^^^^ **Releasedatum:** 30. Juni 2017 Anwender """""""" - Veröffentlichung der AusweisApp2 unter geänderten Nutzungsbedingungen (EUPL v1.2). Entwickler """""""""" - Bereitstellung des Sourcecode der AusweisApp2 auf GitHub.
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2014-2020 Lukas Krejci and other contributors as indicated by the @author tags. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>used-scopes</groupId> <artifactId>parent</artifactId> <version>0</version> <packaging>pom</packaging> <modules> <module>compile</module> <module>deep-compile-compile</module> <module>deep-compile-provided</module> <module>deep-provided-compile</module> <module>deep-provided-provided</module> <module>provided</module> <module>root</module> </modules> </project>
{ "pile_set_name": "Github" }
* Fix logs sometimes not containing stacktraces * Support periodic database export * Support transliteration for Arabic and Farsi * Try to make alarm details scrollable (for small devices) * Amazfit Bip: Implement find phone feature * Amazfit Bip: Support flashing latest GPS firmware * Amazfit Cor: Support flashing latest firmware * Pebble: Fix crash with experimental background javascript * Charts: Several fixes to the MPAndroidChart library
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="standard"> <route id="magento_pagecache" frontName="page_cache"> <module name="Magento_PageCache" /> </route> </router> </config>
{ "pile_set_name": "Github" }
# Attempt to load a config.make file. # If none is found, project defaults in config.project.make will be used. ifneq ($(wildcard config.make),) include config.make endif # make sure the the OF_ROOT location is defined ifndef OF_ROOT OF_ROOT=../../.. endif # call the project makefile! include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk
{ "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 <Intents/INIntent.h> #import <Intents/INStopShareETAIntentExport-Protocol.h> @class NSArray, NSString; @interface INStopShareETAIntent : INIntent <INStopShareETAIntentExport> { } - (void)setParametersByName:(id)arg1; - (id)parametersByName; - (void)setVerb:(id)arg1; - (id)verb; - (void)setDomain:(id)arg1; - (id)domain; - (void)_redactForMissingPrivacyEntitlementOptions:(unsigned long long)arg1 containingAppBundleId:(id)arg2; - (id)_dictionaryRepresentation; - (void)setRecipients:(id)arg1; @property(readonly, copy) NSArray *recipients; - (id)initWithRecipients:(id)arg1; - (void)_setMetadata:(id)arg1; - (id)_metadata; - (id)_typedBackingStore; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
{ "pile_set_name": "Github" }
# Accessibility ## Accessibility A product is accessible when all people—regardless of ability—can navigate it, understand it, and use it to achieve their goals. A truly successful product is accessible to the widest possible audience. These general guidelines are a good starting point for designers who want to learn about accessibility. Designing fully accessible products is a complex topic that requires in-depth study. For more info, visit the Google [accessibility site](http://www.google.com/accessibility/building/). **How can your product best serve a user with disabilities?** To start, think about how users will interact with your product using assistive technologies. Imagine using your product in the following ways: - Without sound - Without color - With high contrast mode enabled - With the screen magnified - With a screen reader (no visible screen) - With voice control only - With a combination of the above Then consider the following key areas that affect accessibility: navigation, readability, and guidance & feedback. ### NAVIGATION **Help users to be fast and efficient.** How easy is it to navigate the page quickly and efficiently (for example, jumping to key sections or getting back to primary navigation)? Present the most important information first. Small changes, like bringing a "create" button to the top, can make navigation much faster. **Make touch targets at least 48x48 pixels.** 48x48 (px, dp) is the recommended minimum touch target size for any on-screen element. Also check how much space is between the elements of your mobile design. In most cases it should be 8 dp or more. **Support mouse-free and standard gesture navigation.** Is every part of your design, any user task and every use case keyboard-accessible on web interfaces and accessible with the basic interaction gestures on mobile devices? Blind users can’t use a mouse to explore your interface in a visual way. Instead of a mouse, they will use their keyboard to navigate or swipe through elements on their mobile devices. Ensure that mouseover information is also accessible to users who don’t use a mouse. Make sure that the keyboard shortcuts are consistent with platform standards. **Manage the focus of your user.** Are you sure that your user and their focus never get lost when navigating between pop ups, alerts, and various screens? Also think about how users will return to a screen after closing a pop-up window. Make sure that their focus will return to where it was before the pop-up opened. ### READABILITY **Ensure the product is still usable with larger font sizes.**Is your text still legible when a user magnifies the screen or enlarges the font? Are the essential elements still visible, usable, and not overlapping? See it for yourself by using any of the built-in OS/Browser/App accessibility tools for zoom and large fonts. **Ensure critical text has enough contrast.** In most cases, “sufficient contrast” means having a contrast ratio of 4.5:1. Enough contrast between the background and the text or critical elements allows all users and those with poor vision in particular to read your message more easily. Smaller text needs lots of contrast, while big headings can tolerate a wider range of colors and backgrounds. **Use more than just color to convey critical information.** This is especially crucial for all color blind users. If colors in the design communicate specific information (for example, visualizing traffic: red = high traffic, green = no traffic) it is important to offer an alternate way for the user to get the same information. In addition to using color, add other elements like shapes, patterns, texture, or text. **Provide clues about spatial relationships.** Is any information conveyed spatially or by layout that wouldn't be apparent to a blind user who navigates one element at a time? Since assistive technologies don't indicate the distance between elements, provide some additional clue that elements are related, like sharing a common heading. **Give visual alternatives to sound and vice versa.** If you have audio elements, do you provide closed captions, a transcript, or another visual alternative? This guideline also applies to system alert sounds. Any flashing or blinking needs to be translated into a sound, and vice versa. ### GUIDANCE AND FEEDBACK **Make interactive controls clear and discoverable.** Do all interactive controls have associated text labels, tooltips, or placeholder text to indicate their purpose? Are you consistent in your terminology throughout the entire app? Provide the most relevant information first to the assistive technologies. When naming elements, make sure you're consistent in your terminology throughout your app. **Provide alternative text for images and video.** Are you relying on graphical elements to convey information that isn't also provided in a written format? Do labels provide sufficient semantic context for the task (for example, not just "download" but "download dinner menu")? Provide alternative text for all images and icons, and avoid using images of text in cases where a standard widget would work. **Offer guidance and help.** Can the user find help quickly when s/he does not know what an element is supposed to mean? If a critical element times out, is there a way for the user to reactivate it? Include clear and easy-to-find help and provide contextual help so that your user can look up what keyboard shortcuts or gestures are available and how to access and use features. **Give meaning to your links.** Is the purpose of each link clear? Generic anchor text like “click here” does not explain a link’s purpose. Put the purpose of the link in the link text itself. A better solution to “click here” is a concrete link like "Device settings." Some assistive technology modes let the user scan just the links, ignoring other content, to make navigation more efficient.
{ "pile_set_name": "Github" }
/** * @file * @brief Debugging code to scan the list of items and monsters. **/ #pragma once void debug_item_scan(); void debug_mons_scan(); void check_map_validity();
{ "pile_set_name": "Github" }
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using IdentityServer4.Events; using IdentityServer4.Models; using IdentityServer4.Services; using IdentityServer4.Validation; using Microsoft.Extensions.Logging; using System.Threading.Tasks; namespace IdentityServer4.Stores { /// <summary> /// Client store decorator for running runtime configuration validation checks /// </summary> public class ValidatingClientStore<T> : IClientStore where T : IClientStore { private readonly IClientStore _inner; private readonly IClientConfigurationValidator _validator; private readonly IEventService _events; private readonly ILogger<ValidatingClientStore<T>> _logger; private readonly string _validatorType; /// <summary> /// Initializes a new instance of the <see cref="ValidatingClientStore{T}" /> class. /// </summary> /// <param name="inner">The inner.</param> /// <param name="validator">The validator.</param> /// <param name="events">The events.</param> /// <param name="logger">The logger.</param> public ValidatingClientStore(T inner, IClientConfigurationValidator validator, IEventService events, ILogger<ValidatingClientStore<T>> logger) { _inner = inner; _validator = validator; _events = events; _logger = logger; _validatorType = validator.GetType().FullName; } /// <summary> /// Finds a client by id (and runs the validation logic) /// </summary> /// <param name="clientId">The client id</param> /// <returns> /// The client or an InvalidOperationException /// </returns> public async Task<Client> FindClientByIdAsync(string clientId) { var client = await _inner.FindClientByIdAsync(clientId); if (client != null) { _logger.LogTrace("Calling into client configuration validator: {validatorType}", _validatorType); var context = new ClientConfigurationValidationContext(client); await _validator.ValidateAsync(context); if (context.IsValid) { _logger.LogDebug("client configuration validation for client {clientId} succeeded.", client.ClientId); return client; } _logger.LogError("Invalid client configuration for client {clientId}: {errorMessage}", client.ClientId, context.ErrorMessage); await _events.RaiseAsync(new InvalidClientConfigurationEvent(client, context.ErrorMessage)); return null; } return null; } } }
{ "pile_set_name": "Github" }
// Django SyntaxHighlighter theme $background: #0a2b1d !default; $line_highlighted_background: #233729 !default; $line_highlighted_number: white !default; $gutter_text: #497958 !default; $gutter_border_color: #41a83e !default; $toolbar_collapsed_a: #96dd3b !default; $toolbar_collapsed_a_hover: #fff !default; $toolbar_collapsed_background: #000 !default; $toolbar_a: #fff !default; $toolbar_a_hover: #ffe862 !default; $code_plain: #f8f8f8 !default; $code_comments: #336442 !default; $code_string: #9df39f !default; $code_keyword: #96dd3b !default; $code_preprocessor: #91bb9e !default; $code_variable: #ffaa3e !default; $code_value: #f7e741 !default; $code_functions: #ffaa3e !default; $code_constants: #e0e8ff !default; $code_color1: #eb939a !default; $code_color2: #91bb9e !default; $code_color3: #edef7d !default; @import "_theme_template.scss"; .syntaxhighlighter { .comments { font-style: italic !important; } .keyword { font-weight: bold !important; } }
{ "pile_set_name": "Github" }
util-deprecate ============== ### The Node.js `util.deprecate()` function with browser support In Node.js, this module simply re-exports the `util.deprecate()` function. In the web browser (i.e. via browserify), a browser-specific implementation of the `util.deprecate()` function is used. ## API A `deprecate()` function is the only thing exposed by this module. ``` javascript // setup: exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead'); // users see: foo(); // foo() is deprecated, use bar() instead foo(); foo(); ``` ## License (The MIT License) Copyright (c) 2014 Nathan Rajlich <[email protected]> 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.
{ "pile_set_name": "Github" }
SUBROUTINE ALG C C THIS IS THE DRIVER SUBROUTINE FOR THE ALG MODULE C INTEGER APRESS,ATEMP,STRML,PGEOM,NAME(2),SYSBUF, 1 TITLE1(18),WD(2),ALGDB CHARACTER UFM*23,UWM*25,UIM*29 COMMON /XMSSG / UFM,UWM,UIM COMMON /BLANK / APRESS,ATEMP,STRML,PGEOM,IPRTK,IFAIL,SIGN,ZORIGN, 1 FXCOOR,FYCOOR,FZCOOR COMMON /SYSTEM/ SYSBUF,NOUT COMMON /ALGINO/ ISCR3,ALGDB COMMON /UDSTR2/ NBLDES,STAG(21),CHORDD(21) COMMON /UD3PRT/ IPRTC,ISTRML,IPGEOM CZZ COMMON /ZZALGX/ IZ(1) COMMON /ZZZZZZ/ IZ(1) COMMON /CONTRL/ NANAL,NAERO,NARBIT,LOG1,LOG2,LOG3,LOG4,LOG5,LOG6 DATA NAME / 4HALG ,4H / DATA WD / 2HNO ,2HAN / DATA ISCR1 , ISCR2 / 301,302 / C ISCR3 = 303 ISCR4 = 304 ISTRML = STRML IPGEOM = PGEOM IF (IPGEOM .EQ. 3) IPGEOM = 1 IPRTC = IPRTK NZ = KORSZ(IZ) IBUF1 = NZ - SYSBUF + 1 IBUF2 = IBUF1 - SYSBUF IBUF3 = IBUF2 - SYSBUF IF (3*SYSBUF .GT. NZ) CALL MESAGE (-8,0,NAME) CALL ALGPR (IERR) IF (IERR .LT. 0) GO TO 400 ALGDB = ISCR1 IF (IERR .EQ. 1) ALGDB = ISCR2 LOG1 = ALGDB LOG2 = NOUT LOG3 = 7 LOG4 = ALGDB LOG5 = ISCR4 LOG6 = 9 CALL GOPEN (LOG1,IZ(IBUF1),0) CALL FREAD (LOG1,TITLE1,18,1) CALL FREAD (LOG1,NANAL,1,0) CALL FREAD (LOG1,NAERO,1,1) NARBIT = 0 IF (IPRTC .EQ. 1) WRITE (LOG2,20) TITLE1,NANAL,WD(NAERO+1) IF (IPRTC .EQ. 0) WRITE (LOG2,40) UIM 20 FORMAT (1H1,/40X,48HALG MODULE - COMPRESSOR DESIGN - CONTROL SECTI 1ON , /40X,48(1H*), //10X,8HTITLE = ,18A4, /10X,39HNUMBER OF ANALYT 2IC MEALINE BLADEROWS = ,I3, /10X,14HTHERE WILL BE ,A2,33H ENTRY TO 3 THE AERODYNAMIC SECTION ) 40 FORMAT (A29,' - MODULE ALG ENTERED.') C IF (NANAL .EQ. 0) GO TO 200 IFILE = LOG5 CALL OPEN (*500,LOG5,IZ(IBUF2),1) CALL ALGAN CALL CLOSE (LOG5,1) 200 IF (NAERO .EQ. 0) GO TO 300 IFILE = LOG5 CALL OPEN (*500,LOG5,IZ(IBUF2),0) IFILE = ISCR3 CALL OPEN (*500,ISCR3,IZ(IBUF3),1) CALL ALGAR CALL CLOSE (ISCR3,1) CALL CLOSE (LOG5,1) 300 CALL CLOSE (LOG1,1) CALL ALGPO (ISCR3) 400 GO TO 600 500 CALL MESAGE(-1,IFILE,NAME) C 600 RETURN END
{ "pile_set_name": "Github" }
rcutorture.torture_type=rcu_busted
{ "pile_set_name": "Github" }
/* * Ethernet: An implementation of the Ethernet Device Driver suite for the * uClinux 2.0.38 operating system. This Driver has been developed * for AT75C220 board. * * NOTE: The driver is implemented for one MAC * * Version: @(#)at91rm9200_net.h 1.0.0 01/10/2001 * * Authors: Lineo Inc <www.lineo.com> * * * 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 * 2 of the License, or (at your option) any later version. */ #ifndef AT91RM9200_ETHERNET #define AT91RM9200_ETHERNET #include <common.h> #include <asm/io.h> #include <asm/arch/hardware.h> #define FALSE 0 #define TRUE 1 #define ETHERNET_ADDRESS_SIZE 6 typedef unsigned char UCHAR; /* Interface to drive the physical layer */ typedef struct _AT91S_PhyOps { unsigned char (*Init)(AT91S_EMAC *pmac); unsigned int (*IsPhyConnected)(AT91S_EMAC *pmac); unsigned char (*GetLinkSpeed)(AT91S_EMAC *pmac); unsigned char (*AutoNegotiate)(AT91S_EMAC *pmac, int *); } AT91S_PhyOps,*AT91PS_PhyOps; #define EMAC_DESC_DONE 0x00000001 /* ownership bit */ #define EMAC_DESC_WRAP 0x00000002 /* bit for wrap */ /****************** function prototypes **********************/ /* MII functions */ void at91rm9200_EmacEnableMDIO(AT91PS_EMAC p_mac); void at91rm9200_EmacDisableMDIO(AT91PS_EMAC p_mac); UCHAR at91rm9200_EmacReadPhy(AT91PS_EMAC p_mac, unsigned char RegisterAddress, unsigned short *pInput); UCHAR at91rm9200_EmacWritePhy(AT91PS_EMAC p_mac, unsigned char RegisterAddress, unsigned short *pOutput); void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops); #endif /* AT91RM9200_ETHERNET */
{ "pile_set_name": "Github" }
# 1phase with MD_Gaussian (var = log(mass-density) with Gaussian capillary) formulation # constant-bulk density, constant porosity, 1component # unsaturated [Mesh] type = GeneratedMesh dim = 2 nx = 1 ny = 1 [] [GlobalParams] PorousFlowDictator = dictator [] [Variables] [./md] [../] [] [ICs] [./md] type = RandomIC min = -1 max = -0.224 # unsaturated for md<log(density_P0=0.8)=-0.223 variable = md [../] [] [Kernels] [./mass0] type = PorousFlowMassTimeDerivative fluid_component = 0 variable = md [../] [] [UserObjects] [./dictator] type = PorousFlowDictator porous_flow_vars = 'md' number_fluid_phases = 1 number_fluid_components = 1 [../] [] [Modules] [./FluidProperties] [./simple_fluid] type = SimpleFluidProperties bulk_modulus = 1.5 density0 = 0.8 thermal_expansion = 0 [../] [../] [] [Materials] [./temperature] type = PorousFlowTemperature [../] [./ppss] type = PorousFlow1PhaseMD_Gaussian mass_density = md al = 1.1 density_P0 = 0.8 bulk_modulus = 1.5 [../] [./massfrac] type = PorousFlowMassFraction [../] [./simple_fluid] type = PorousFlowSingleComponentFluid fp = simple_fluid phase = 0 [../] [./porosity] type = PorousFlowPorosityConst porosity = 0.1 [../] [] [Preconditioning] active = check [./andy] type = SMP full = true petsc_options_iname = '-ksp_type -pc_type -snes_atol -snes_rtol -snes_max_it' petsc_options_value = 'bcgs bjacobi 1E-15 1E-10 10000' [../] [./check] type = SMP full = true petsc_options = '-snes_test_display' petsc_options_iname = '-ksp_type -pc_type -snes_atol -snes_rtol -snes_max_it -snes_type' petsc_options_value = 'bcgs bjacobi 1E-15 1E-10 10000 test' [../] [] [Executioner] type = Transient solve_type = Newton dt = 1 end_time = 1 [] [Outputs] exodus = false []
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <sparql xmlns="http://www.w3.org/2005/sparql-results#"> <head> <variable name="x"/> <variable name="p"/> <variable name="v"/> </head> <results> <result> <binding name="x"> <uri>http://example/x</uri> </binding> <binding name="p"> <uri>http://example/p</uri> </binding> <binding name="v"> <literal datatype="http://www.w3.org/2001/XMLSchema#integer">99</literal> </binding> </result> <result> <binding name="x"> <uri>http://example/x</uri> </binding> <binding name="p"> <uri>http://example/p</uri> </binding> <binding name="v"> <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal> </binding> </result> <result> <binding name="x"> <uri>http://example/x</uri> </binding> <binding name="p"> <uri>http://example/p</uri> </binding> <binding name="v"> <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal> </binding> </result> </results> </sparql>
{ "pile_set_name": "Github" }
/* * SPDX-License-Identifier: MIT * * Copyright © 2019 Intel Corporation */ #ifndef I915_GEM_IOCTLS_H #define I915_GEM_IOCTLS_H struct drm_device; struct drm_file; int i915_gem_busy_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_execbuffer_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_get_caching_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_get_tiling_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_mmap_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_mmap_offset_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_pread_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_set_tiling_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_throttle_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file); int i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file); #endif
{ "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. */ // This file was autogenerated by go-to-protobuf. Do not edit it manually! syntax = 'proto2'; package k8s.io.api.scheduling.v1; import "k8s.io/api/core/v1/generated.proto"; import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/generated.proto"; import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; // Package-wide variables from generator "generated". option go_package = "v1"; // PriorityClass defines mapping from a priority class name to the priority // integer value. The value can be any valid integer. message PriorityClass { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // The value of this priority class. This is the actual priority that pods // receive when they have the name of this class in their pod spec. optional int32 value = 2; // globalDefault specifies whether this PriorityClass should be considered as // the default priority for pods that do not have any priority class. // Only one PriorityClass can be marked as `globalDefault`. However, if more than // one PriorityClasses exists with their `globalDefault` field set to true, // the smallest value of such global default PriorityClasses will be used as the default priority. // +optional optional bool globalDefault = 3; // description is an arbitrary string that usually provides guidelines on // when this priority class should be used. // +optional optional string description = 4; // PreemptionPolicy is the Policy for preempting pods with lower priority. // One of Never, PreemptLowerPriority. // Defaults to PreemptLowerPriority if unset. // This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature. // +optional optional string preemptionPolicy = 5; } // PriorityClassList is a collection of priority classes. message PriorityClassList { // Standard list metadata // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; // items is the list of PriorityClasses repeated PriorityClass items = 2; }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "ApplicationBuiltins.h" #include "Application.h" #include "ServiceBroker.h" #include "filesystem/ZipManager.h" #include "messaging/ApplicationMessenger.h" #include "interfaces/AnnouncementManager.h" #include "network/Network.h" #include "settings/AdvancedSettings.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" #include "utils/FileOperationJob.h" #include "utils/JSONVariantParser.h" #include "utils/log.h" #include "utils/StringUtils.h" #include "utils/URIUtils.h" #include "utils/Variant.h" #include <stdlib.h> using namespace KODI::MESSAGING; /*! \brief Extract an archive. * \param params The parameters * \details params[0] = The archive URL. * params[1] = Destination path (optional). * If not given, extracts to folder with archive. */ static int Extract(const std::vector<std::string>& params) { // Detects if file is zip or rar then extracts std::string strDestDirect; if (params.size() < 2) strDestDirect = URIUtils::GetDirectory(params[0]); else strDestDirect = params[1]; URIUtils::AddSlashAtEnd(strDestDirect); if (URIUtils::IsZIP(params[0])) g_ZipManager.ExtractArchive(params[0],strDestDirect); else CLog::Log(LOGERROR, "Extract, No archive given"); return 0; } /*! \brief Mute volume. * \param params (ignored) */ static int Mute(const std::vector<std::string>& params) { g_application.ToggleMute(); return 0; } /*! \brief Notify all listeners on announcement bus. * \param params The parameters. * \details params[0] = sender. * params[1] = data. * params[2] = JSON with extra parameters (optional). */ static int NotifyAll(const std::vector<std::string>& params) { CVariant data; if (params.size() > 2) { if (!CJSONVariantParser::Parse(params[2], data)) { CLog::Log(LOGERROR, "NotifyAll failed to parse data: %s", params[2].c_str()); return -3; } } CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Other, params[0].c_str(), params[1].c_str(), data); return 0; } /*! \brief Set volume. * \param params the parameters. * \details params[0] = Volume level. * params[1] = "showVolumeBar" to show volume bar (optional). */ static int SetVolume(const std::vector<std::string>& params) { float oldVolume = g_application.GetVolume(); float volume = (float)strtod(params[0].c_str(), nullptr); g_application.SetVolume(volume); if(oldVolume != volume) { if(params.size() > 1 && StringUtils::EqualsNoCase(params[1], "showVolumeBar")) { CApplicationMessenger::GetInstance().PostMsg(TMSG_VOLUME_SHOW, oldVolume < volume ? ACTION_VOLUME_UP : ACTION_VOLUME_DOWN); } } return 0; } /*! \brief Toggle debug info. * \param params (ignored) */ static int ToggleDebug(const std::vector<std::string>& params) { bool debug = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_DEBUG_SHOWLOGINFO); CServiceBroker::GetSettingsComponent()->GetSettings()->SetBool(CSettings::SETTING_DEBUG_SHOWLOGINFO, !debug); CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->SetDebugMode(!debug); return 0; } /*! \brief Toggle DPMS state. * \param params (ignored) */ static int ToggleDPMS(const std::vector<std::string>& params) { g_application.ToggleDPMS(true); return 0; } /*! \brief Send a WOL packet to a given host. * \param params The parameters. * \details params[0] = The MAC of the host to wake. */ static int WakeOnLAN(const std::vector<std::string>& params) { CServiceBroker::GetNetwork().WakeOnLan(params[0].c_str()); return 0; } // Note: For new Texts with comma add a "\" before!!! Is used for table text. // /// \page page_List_of_built_in_functions /// \section built_in_functions_3 Application built-in's /// /// ----------------------------------------------------------------------------- /// /// \table_start /// \table_h2_l{ /// Function, /// Description } /// \table_row2_l{ /// <b>`Extract(url [\, dest])`</b> /// , /// Extracts a specified archive to an optionally specified 'absolute' path. /// @param[in] url The archive URL. /// @param[in] dest Destination path (optional). /// @note If not given\, extracts to folder with archive. /// } /// \table_row2_l{ /// <b>`Mute`</b> /// , /// Mutes (or unmutes) the volume. /// } /// \table_row2_l{ /// <b>`NotifyAll(sender\, data [\, json])`</b> /// , /// Notify all connected clients /// @param[in] sender Sender. /// @param[in] data Data. /// @param[in] json JSON with extra parameters (optional). /// } /// \table_row2_l{ /// <b>`SetVolume(percent[\,showvolumebar])`</b> /// , /// Sets the volume to the percentage specified. Optionally\, show the Volume /// Dialog in Kodi when setting the volume. /// @param[in] percent Volume level. /// @param[in] showvolumebar Add "showVolumeBar" to show volume bar (optional). /// } /// \table_row2_l{ /// <b>`ToggleDebug`</b> /// , /// Toggles debug mode on/off /// } /// \table_row2_l{ /// <b>`ToggleDPMS`</b> /// , /// Toggle DPMS mode manually /// } /// \table_row2_l{ /// <b>`WakeOnLan(mac)`</b> /// , /// Sends the wake-up packet to the broadcast address for the specified MAC /// address (Format: FF:FF:FF:FF:FF:FF or FF-FF-FF-FF-FF-FF). /// @param[in] mac The MAC of the host to wake. /// } /// \table_end /// CBuiltins::CommandMap CApplicationBuiltins::GetOperations() const { return { {"extract", {"Extracts the specified archive", 1, Extract}}, {"mute", {"Mute the player", 0, Mute}}, {"notifyall", {"Notify all connected clients", 2, NotifyAll}}, {"setvolume", {"Set the current volume", 1, SetVolume}}, {"toggledebug", {"Enables/disables debug mode", 0, ToggleDebug}}, {"toggledpms", {"Toggle DPMS mode manually", 0, ToggleDPMS}}, {"wakeonlan", {"Sends the wake-up packet to the broadcast address for the specified MAC address", 1, WakeOnLAN}} }; }
{ "pile_set_name": "Github" }
{ "openapi": "3.0.0", "info": { "title": "AHEM - Ad Hoc Email", "description": "Welcome to the AHEM API documentation.<br>AHEM provides an easy to use RESTful API that allows testing or building anything on top of the AHEM mail server.<br>All endpoints follow the URL: <br>https://www.ahem.email/api/<br><br>__Authorization__<br>A token must be obtained by calling https://www.ahem.email/auth/authenticate.<br>The response will contain a token field. Tokens must be added to each api call in the Authorization header and a Bearer token, unless the server is set with token expiration == -1.", "contact": {}, "termsOfService": "https://www.ahem.email/privacy", "version": "1.0" }, "servers": [ { "url": "https://www.ahem.email", "variables": {} } ], "paths": { "/api/alive": { "get": { "tags": [ "General" ], "summary": "Get system check results", "description": "", "operationId": "GetSystemCheckResults", "parameters": [], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "example": { "success": true, "api": true, "smtp": true, "db": true }, "$ref": "#/components/schemas/GetSystemCheckResultsResponse" }, "example": { "success": true, "api": true, "smtp": true, "db": true } } } } }, "x-operation-settings": { "CollectParameters": false, "AllowDynamicQueryParameters": false, "AllowDynamicFormParameters": false, "IsMultiContentStreaming": false } } }, "/api/properties": { "get": { "tags": [ "General" ], "summary": "Get server properties", "description": "", "operationId": "GetServerProperties", "parameters": [], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "example": { "serverBaseUri": "https://www.ahem.email", "emailDeleteInterval": 86400, "emailDeleteAge": 7200, "allowedDomains": [ "ahem.email", "mail.ahem.email", "ahem-email.com" ], "allowAutocomplete": false, "customText": null }, "$ref": "#/components/schemas/GetServerPropertiesResponse" }, "example": { "serverBaseUri": "https://www.ahem.email", "emailDeleteInterval": 86400, "emailDeleteAge": 7200, "allowedDomains": [ "ahem.email", "mail.ahem.email", "ahem-email.com" ], "allowAutocomplete": false, "customText": null } } } } }, "x-operation-settings": { "CollectParameters": false, "AllowDynamicQueryParameters": false, "AllowDynamicFormParameters": false, "IsMultiContentStreaming": false } } }, "/api/emailCount": { "get": { "tags": [ "General" ], "summary": "Get server email count", "description": "", "operationId": "GetEmailCount", "parameters": [], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "example": { "serverBaseUri": "https://www.ahem.email", "count": 654, "since": 1539648000 }, "$ref": "#/components/schemas/GetEmailCount" } } } } }, "x-operation-settings": { "CollectParameters": false, "AllowDynamicQueryParameters": false, "AllowDynamicFormParameters": false, "IsMultiContentStreaming": false } } }, "/api/auth/token": { "post": { "tags": [ "General" ], "summary": "Get access token", "description": "", "operationId": "GetAccessToken", "parameters": [ { "name": "Content-Type", "in": "header", "description": "", "required": true, "style": "simple", "explode": false, "schema": { "type": "string", "example": "application/json" } } ], "requestBody": { "description": "", "content": { "text/plain": { "schema": { "type": "object" } } }, "required": true }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "example": { "success": true, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpcCI6Ijo6MSIsImlhdCI6MTUzOTU1NTI5NCwiZXhwIjoxNTM5NTU4ODk0fQ.Y8FhYY5OGbHNn6EOcrF81swX3xeLF4t7Q6F5L7z6Xdg" }, "$ref": "#/components/schemas/GetAccessTokenResponse" }, "example": { "success": true, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpcCI6Ijo6MSIsImlhdCI6MTUzOTU1NTI5NCwiZXhwIjoxNTM5NTU4ODk0fQ.Y8FhYY5OGbHNn6EOcrF81swX3xeLF4t7Q6F5L7z6Xdg" } } } } }, "x-operation-settings": { "CollectParameters": false, "AllowDynamicQueryParameters": false, "AllowDynamicFormParameters": false, "IsMultiContentStreaming": false } } }, "/api/mailbox/{mailboxName}/email": { "get": { "tags": [ "Mailbox" ], "security": [ { "bearerAuth": [] } ], "summary": "get a mailbox's emails list", "description": "", "operationId": "GetAMailbox'sEmailsList", "parameters": [ { "name": "mailboxName", "in": "path", "description": "mailbox name.", "required": true, "style": "simple", "explode": false, "schema": { "type": "string", "example": "mailboxName" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "array", "items": { "example": [ { "emailId": "5bc3c17cb76d8f4e1099725c", "sender": { "address": "[email protected]", "name": "AHEM Test!" }, "subject": "AHEM mail test!", "timestamp": 1539555708477, "isRead": true } ], "$ref": "#/components/schemas/GetAMailboxsEmailsListResponse" }, "description": "" }, "example": [ { "emailId": "5bc3c17cb76d8f4e1099725c", "sender": { "address": "[email protected]", "name": "AHEM Test!" }, "subject": "AHEM mail test!", "timestamp": 1539555708477, "isRead": true } ] } } }, "401": { "description": "Unexpected error in API call. See HTTP response body for details.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetAMailboxsEmailsList401Response" }, "example": { "success": false, "message": "No token provided." } } } }, "404": { "description": "Unexpected error in API call. See HTTP response body for details.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetAMailboxsEmailsList404Response" }, "example": { "error": "MAILBOX IS EMPTY!" } } } } }, "x-operation-settings": { "CollectParameters": false, "AllowDynamicQueryParameters": false, "AllowDynamicFormParameters": false, "IsMultiContentStreaming": false } } }, "/api/mailbox/{mailboxName}/email/{emailId}": { "get": { "tags": [ "Email" ], "summary": "Get an email's content", "security": [ { "bearerAuth": [] } ], "description": "", "operationId": "GetAnEmail'sContent", "parameters": [ { "name": "mailboxName", "in": "path", "description": "mailbox name.", "required": true, "style": "simple", "explode": false, "schema": { "type": "string", "example": "mailboxName" } }, { "name": "emailId", "in": "path", "description": "mailbox name.", "required": true, "style": "simple", "explode": false, "schema": { "type": "string", "example": "emailId" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "example": { "_id": "5bc64017002e254f65eb37ef", "attachments": [ { "type": "attachment", "content": "iVBORw0KGgoAAAANSUhEUgAAAfoAAAFkCAYAAADIefl6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7J13eFRV2sB/585MekIggQAJyaRAgACWIGAHFQXE3pB1RSyfvXfctaDr2ru7rq6ia9dV1w4qigKWVXQt2AqJCmyPszLl/0c8IQ3mc14/tXXMdCsQ6rBX1c+w8Qhx8xjeCyPbDOPNKP/ODxOQzrk/F5xqAJLlywJtCnwdF5entjUxq0UFBcTkSuQmCC", "contentType": "image/png", "release": null, "contentDisposition": "attachment", "filename": "ahem-happy.png", "contentId": "<[email protected]>", "cid": "[email protected]", "related": true, "headers": { "content-type": { "value": "image/png", "params": { "name": "ahem-happy.png" } }, "content-id": "<[email protected]>", "content-transfer-encoding": "base64", "content-disposition": { "value": "attachment", "params": { "filename": "ahem-happy.png" } } }, "checksum": "4ac3f7fa98c8c86bb1677f32279db7ad", "size": 57654 } ], "headers": { "content-type": { "value": "multipart/alternative", "params": { "boundary": "--_NmP-56cbf8151211f597-Part_1" } }, "from": { "value": [ { "address": "[email protected]", "name": "AHEM Test!" } ], "html": "<span class=\"mp_address_group\"><span class=\"mp_address_name\">AHEM Test!</span> &lt;<a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a>&gt;</span>", "text": "AHEM Test! <[email protected]>" }, "to": { "value": [ { "address": "[email protected]", "name": "" } ], "html": "<span class=\"mp_address_group\"><a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a></span>", "text": "[email protected]" }, "subject": "AHEM mail test! ✔", "message-id": "<[email protected]>", "date": "2018-10-16T19:46:31Z", "mime-version": "1.0" }, "headerLines": [ { "key": "content-type", "line": "Content-Type: multipart/alternative;\r\n boundary=\"--_NmP-56cbf8151211f597-Part_1\"" }, { "key": "from", "line": "From: \"AHEM Test!\" <[email protected]>" }, { "key": "to", "line": "To: [email protected]" }, { "key": "subject", "line": "Subject: =?UTF-8?Q?AHEM_mail_test!_=E2=9C=94?=" }, { "key": "message-id", "line": "Message-ID: <[email protected]>" }, { "key": "date", "line": "Date: Tue, 16 Oct 2018 19:46:31 +0000" }, { "key": "mime-version", "line": "MIME-Version: 1.0" } ], "html": "<p><b>API Test:</b> <span style=\"color: darkgreen\">✔</span></p><p><b>SMTP Test:</b> <span style=\"color: darkgreen\">✔</span></p><p><b>DB Test:</b> <span style=\"color: darkgreen\">✔</span></p><p><br/></p>", "text": "API: ✔ SMTP: ✔ DB: ✔", "textAsHtml": "<p>API: &#x2714; SMTP: &#x2714; DB: &#x2714;</p>", "subject": "AHEM mail test! ✔", "date": "2018-10-16T19:46:31Z", "to": { "value": [ { "address": "[email protected]", "name": "" } ], "html": "<span class=\"mp_address_group\"><a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a></span>", "text": "[email protected]" }, "from": { "value": [ { "address": "[email protected]", "name": "AHEM Test!" } ], "html": "<span class=\"mp_address_group\"><span class=\"mp_address_name\">AHEM Test!</span> &lt;<a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a>&gt;</span>", "text": "AHEM Test! <[email protected]>" }, "messageId": "<[email protected]>", "timestamp": 1539719191853 }, "$ref": "#/components/schemas/GetAnEmailsContentResponse" }, "example": { "_id": "5bc64017002e254f65eb37ef", "attachments": [ { "type": "attachment", "content": "iVBORw0KGgoAAAANSUhEUgAAAfoAAAFkCAYAAADIefl6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7J13eFRV2sB/585MekIggQAJyaRAgACWIGAHFQXE3pB1RSyfvXfctaDr2ru7rq6ia9dV1w4qigKWVXQt2AqJCmyPszLl/0c8IQ3mc14/tXXMdCsQ6rBX1c+w8Qhx8xjeCyPbDOPNKP/ODxOQzrk/F5xqAJLlywJtCnwdF5entjUxq0UFBcTkSuQmCC", "contentType": "image/png", "release": null, "contentDisposition": "attachment", "filename": "ahem-happy.png", "contentId": "<[email protected]>", "cid": "[email protected]", "related": true, "headers": { "content-type": { "value": "image/png", "params": { "name": "ahem-happy.png" } }, "content-id": "<[email protected]>", "content-transfer-encoding": "base64", "content-disposition": { "value": "attachment", "params": { "filename": "ahem-happy.png" } } }, "checksum": "4ac3f7fa98c8c86bb1677f32279db7ad", "size": 57654 } ], "headers": { "content-type": { "value": "multipart/alternative", "params": { "boundary": "--_NmP-56cbf8151211f597-Part_1" } }, "from": { "value": [ { "address": "[email protected]", "name": "AHEM Test!" } ], "html": "<span class=\"mp_address_group\"><span class=\"mp_address_name\">AHEM Test!</span> &lt;<a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a>&gt;</span>", "text": "AHEM Test! <[email protected]>" }, "to": { "value": [ { "address": "[email protected]", "name": "" } ], "html": "<span class=\"mp_address_group\"><a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a></span>", "text": "[email protected]" }, "subject": "AHEM mail test! ✔", "message-id": "<[email protected]>", "date": "2018-10-16T19:46:31Z", "mime-version": "1.0" }, "headerLines": [ { "key": "content-type", "line": "Content-Type: multipart/alternative;\r\n boundary=\"--_NmP-56cbf8151211f597-Part_1\"" }, { "key": "from", "line": "From: \"AHEM Test!\" <[email protected]>" }, { "key": "to", "line": "To: [email protected]" }, { "key": "subject", "line": "Subject: =?UTF-8?Q?AHEM_mail_test!_=E2=9C=94?=" }, { "key": "message-id", "line": "Message-ID: <[email protected]>" }, { "key": "date", "line": "Date: Tue, 16 Oct 2018 19:46:31 +0000" }, { "key": "mime-version", "line": "MIME-Version: 1.0" } ], "html": "<p><b>API Test:</b> <span style=\"color: darkgreen\">✔</span></p><p><b>SMTP Test:</b> <span style=\"color: darkgreen\">✔</span></p><p><b>DB Test:</b> <span style=\"color: darkgreen\">✔</span></p><p><br/></p>", "text": "API: ✔ SMTP: ✔ DB: ✔", "textAsHtml": "<p>API: &#x2714; SMTP: &#x2714; DB: &#x2714;</p>", "subject": "AHEM mail test! ✔", "date": "2018-10-16T19:46:31Z", "to": { "value": [ { "address": "[email protected]", "name": "" } ], "html": "<span class=\"mp_address_group\"><a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a></span>", "text": "[email protected]" }, "from": { "value": [ { "address": "[email protected]", "name": "AHEM Test!" } ], "html": "<span class=\"mp_address_group\"><span class=\"mp_address_name\">AHEM Test!</span> &lt;<a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a>&gt;</span>", "text": "AHEM Test! <[email protected]>" }, "messageId": "<[email protected]>", "timestamp": 1539719191853 } } } }, "404": { "description": "Unexpected error in API call. See HTTP response body for details.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetAnEmailsContent404Response" }, "example": { "error": "MAILBOX IS EMPTY!" } } } }, "500": { "description": "Unexpected error in API call. See HTTP response body for details.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetAnEmailsContent404Response" }, "example": { "error": "error details" } } } } }, "x-operation-settings": { "CollectParameters": false, "AllowDynamicQueryParameters": false, "AllowDynamicFormParameters": false, "IsMultiContentStreaming": false } }, "delete": { "tags": [ "Email" ], "summary": "Delete an Email", "security": [ { "bearerAuth": [] } ], "description": "", "operationId": "DeleteAnEmail", "parameters": [ { "name": "mailboxName", "in": "path", "description": "mailbox name.", "required": true, "style": "simple", "explode": false, "schema": { "type": "string", "example": "mailboxName" } }, { "name": "emailId", "in": "path", "description": "mailbox name.", "required": true, "style": "simple", "explode": false, "schema": { "type": "string", "example": "emailId" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "example": { "success": true }, "$ref": "#/components/schemas/DeleteAnEmailResponse" }, "example": { "success": true } } } }, "500": { "description": "Unexpected error in API call. See HTTP response body for details.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeleteAnEmail500Response" }, "example": { "error": "error details" } } } }, "404": { "description": "Unexpected error in API call. See HTTP response body for details.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeleteAnEmail404Response" }, "example": { "success": false, "message": "EMAIL NOT FOUND" } } } } }, "x-operation-settings": { "CollectParameters": false, "AllowDynamicQueryParameters": false, "AllowDynamicFormParameters": false, "IsMultiContentStreaming": false } }, "patch": { "tags": [ "Email" ], "security": [ { "bearerAuth": [] } ], "summary": "Update an Email's metadata", "description": "", "operationId": "UpdateAnEmail'sMetadata", "parameters": [ { "name": "mailboxName", "in": "path", "description": "mailbox name.", "required": true, "style": "simple", "explode": false, "schema": { "type": "string", "example": "mailboxName" } }, { "name": "emailId", "in": "path", "description": "mailbox name.", "required": true, "style": "simple", "explode": false, "schema": { "type": "string", "example": "emailId" } } ], "requestBody": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateAnEmailsMetadataRequest" } } }, "required": true }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "example": { "n": 1, "nModified": 0, "ok": 1 }, "$ref": "#/components/schemas/UpdateAnEmailsMetadataResponse" }, "example": { "n": 1, "nModified": 0, "ok": 1 } } } }, "500": { "description": "Unexpected error in API call. See HTTP response body for details.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateAnEmailsMetadata500Response" }, "example": { "error": "error details" } } } } }, "x-operation-settings": { "CollectParameters": false, "AllowDynamicQueryParameters": false, "AllowDynamicFormParameters": false, "IsMultiContentStreaming": false } } } }, "components": { "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } }, "schemas": { "GetSystemCheckResultsResponse": { "title": "Get system check results response", "required": [ "success", "api", "smtp", "db" ], "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "api": { "type": "boolean", "example": true }, "smtp": { "type": "boolean", "example": true }, "db": { "type": "boolean", "example": true } }, "example": { "success": true, "api": true, "smtp": true, "db": true } }, "GetServerPropertiesResponse": { "title": "Get server properties response", "required": [ "serverBaseUri", "emailDeleteInterval", "emailDeleteAge", "allowedDomains", "allowAutocomplete", "customText" ], "type": "object", "properties": { "serverBaseUri": { "type": "string", "example": "https://www.ahem.email" }, "emailDeleteInterval": { "type": "integer", "format": "int32", "example": 86400 }, "emailDeleteAge": { "type": "integer", "format": "int32", "example": 7200 }, "allowedDomains": { "type": "array", "items": { "type": "string", "example": [ "ahem.email", "mail.ahem.email", "ahem-email.com" ] }, "description": "" }, "allowAutocomplete": { "type": "boolean", "example": false }, "customText": { "type": "string", "nullable": true } }, "example": { "serverBaseUri": "https://www.ahem.email", "emailDeleteInterval": 86400, "emailDeleteAge": 7200, "allowedDomains": [ "ahem.email", "mail.ahem.email", "ahem-email.com" ], "allowAutocomplete": false, "customText": null } }, "GetEmailCount": { "title": "Get email count results response", "type": "object", "properties": { "count": { "type": "integer", "example": 654 }, "since": { "type": "integer", "example": 1539648000 }, "example": { "count": 654, "since": 1539648000 } } }, "GetAccessTokenResponse": { "title": "Get access token response", "required": [ "success", "token" ], "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "token": { "type": "string", "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpcCI6Ijo6MSIsImlhdCI6MTUzOTU1NTI5NCwiZXhwIjoxNTM5NTU4ODk0fQ.Y8FhYY5OGbHNn6EOcrF81swX3xeLF4t7Q6F5L7z6Xdg" } }, "example": { "success": true, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpcCI6Ijo6MSIsImlhdCI6MTUzOTU1NTI5NCwiZXhwIjoxNTM5NTU4ODk0fQ.Y8FhYY5OGbHNn6EOcrF81swX3xeLF4t7Q6F5L7z6Xdg" } }, "GetAMailboxsEmailsListResponse": { "title": "get a mailbox's emails list response", "required": [ "emailId", "sender", "subject", "timestamp", "isRead" ], "type": "object", "properties": { "emailId": { "type": "string", "example": "5bc3c17cb76d8f4e1099725c" }, "sender": { "type": "object", "example": { "address": "[email protected]", "name": "AHEM Test!" } }, "subject": { "type": "string", "example": "AHEM mail test!" }, "timestamp": { "type": "integer", "format": "int64", "example": 1539555708477 }, "isRead": { "type": "boolean", "example": true } }, "example": { "emailId": "5bc3c17cb76d8f4e1099725c", "sender": { "address": "[email protected]", "name": "AHEM Test!" }, "subject": "AHEM mail test!", "timestamp": 1539555708477, "isRead": true } }, "GetAMailboxsEmailsList404Response": { "title": "get a mailbox's emails list 404 response", "required": [ "error" ], "type": "object", "properties": { "error": { "type": "string", "example": "MAILBOX IS EMPTY!" } }, "example": { "error": "MAILBOX IS EMPTY!" } }, "GetAMailboxsEmailsList401Response": { "title": "get a mailbox's emails list 401 response", "required": [ "success", "message" ], "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "message": { "type": "string", "example": "No token provided." } }, "example": { "success": false, "message": "No token provided." } }, "GetAnEmailsContentResponse": { "title": "Get an email's content response", "required": [ "_id", "attachments", "headers", "headerLines", "html", "text", "textAsHtml", "subject", "date", "to", "from", "messageId", "timestamp" ], "type": "object", "properties": { "_id": { "type": "string", "example": "5bc64017002e254f65eb37ef" }, "attachments": { "type": "array", "items": { "type": "object", "example": [ { "type": "attachment", "content": "iVBORw0KGgoAAAANSUhEUgAAAfoAAAFkCAYAAADIefl6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7J13eFRV2sB/585MekIggQAJyaRAgACWIGAHFQXE3pB1RSyfvXfctaDr2ru7rq6ia9dV1w4qigKWVXQt2AqJCmyPszLl/0c8IQ3mc14/tXXMdCsQ6rBX1c+w8Qhx8xjeCyPbDOPNKP/ODxOQzrk/F5xqAJLlywJtCnwdF5entjUxq0UFBcTkSuQmCC", "contentType": "image/png", "release": null, "contentDisposition": "attachment", "filename": "ahem-happy.png", "contentId": "<[email protected]>", "cid": "[email protected]", "related": true, "headers": { "content-type": { "value": "image/png", "params": { "name": "ahem-happy.png" } }, "content-id": "<[email protected]>", "content-transfer-encoding": "base64", "content-disposition": { "value": "attachment", "params": { "filename": "ahem-happy.png" } } }, "checksum": "4ac3f7fa98c8c86bb1677f32279db7ad", "size": 57654 } ] }, "description": "" }, "headers": { "type": "object", "example": { "content-type": { "value": "multipart/alternative", "params": { "boundary": "--_NmP-56cbf8151211f597-Part_1" } }, "from": { "value": [ { "address": "[email protected]", "name": "AHEM Test!" } ], "html": "<span class=\"mp_address_group\"><span class=\"mp_address_name\">AHEM Test!</span> &lt;<a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a>&gt;</span>", "text": "AHEM Test! <[email protected]>" }, "to": { "value": [ { "address": "[email protected]", "name": "" } ], "html": "<span class=\"mp_address_group\"><a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a></span>", "text": "[email protected]" }, "subject": "AHEM mail test! ✔", "message-id": "<[email protected]>", "date": "2018-10-16T19:46:31Z", "mime-version": "1.0" } }, "headerLines": { "type": "array", "items": { "type": "object", "example": [ { "key": "content-type", "line": "Content-Type: multipart/alternative;\r\n boundary=\"--_NmP-56cbf8151211f597-Part_1\"" }, { "key": "from", "line": "From: \"AHEM Test!\" <[email protected]>" }, { "key": "to", "line": "To: [email protected]" }, { "key": "subject", "line": "Subject: =?UTF-8?Q?AHEM_mail_test!_=E2=9C=94?=" }, { "key": "message-id", "line": "Message-ID: <[email protected]>" }, { "key": "date", "line": "Date: Tue, 16 Oct 2018 19:46:31 +0000" }, { "key": "mime-version", "line": "MIME-Version: 1.0" } ] }, "description": "" }, "html": { "type": "string", "example": "<p><b>API Test:</b> <span style=\"color: darkgreen\">✔</span></p><p><b>SMTP Test:</b> <span style=\"color: darkgreen\">✔</span></p><p><b>DB Test:</b> <span style=\"color: darkgreen\">✔</span></p><p><br/></p>" }, "text": { "type": "string", "example": "API: ✔ SMTP: ✔ DB: ✔" }, "textAsHtml": { "type": "string", "example": "<p>API: &#x2714; SMTP: &#x2714; DB: &#x2714;</p>" }, "subject": { "type": "string", "example": "AHEM mail test! ✔" }, "date": { "type": "string", "example": "10/16/2018 7:46:31 PM" }, "to": { "type": "object", "example": { "value": [ { "address": "[email protected]", "name": "" } ], "html": "<span class=\"mp_address_group\"><a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a></span>", "text": "[email protected]" } }, "from": { "type": "object", "example": { "value": [ { "address": "[email protected]", "name": "AHEM Test!" } ], "html": "<span class=\"mp_address_group\"><span class=\"mp_address_name\">AHEM Test!</span> &lt;<a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a>&gt;</span>", "text": "AHEM Test! <[email protected]>" } }, "messageId": { "type": "string", "example": "<[email protected]>" }, "timestamp": { "type": "integer", "format": "int64", "example": 1539719191853 } }, "example": { "_id": "5bc64017002e254f65eb37ef", "attachments": [ { "type": "attachment", "content": "iVBORw0KGgoAAAANSUhEUgAAAfoAAAFkCAYAAADIefl6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7J13eFRV2sB/585MekIggQAJyaRAgACWIGAHFQXE3pB1RSyfvXfctaDr2ru7rq6ia9dV1w4qigKWVXQt2AqJCmyPszLl/0c8IQ3mc14/tXXMdCsQ6rBX1c+w8Qhx8xjeCyPbDOPNKP/ODxOQzrk/F5xqAJLlywJtCnwdF5entjUxq0UFBcTkSuQmCC", "contentType": "image/png", "release": null, "contentDisposition": "attachment", "filename": "ahem-happy.png", "contentId": "<[email protected]>", "cid": "[email protected]", "related": true, "headers": { "content-type": { "value": "image/png", "params": { "name": "ahem-happy.png" } }, "content-id": "<[email protected]>", "content-transfer-encoding": "base64", "content-disposition": { "value": "attachment", "params": { "filename": "ahem-happy.png" } } }, "checksum": "4ac3f7fa98c8c86bb1677f32279db7ad", "size": 57654 } ], "headers": { "content-type": { "value": "multipart/alternative", "params": { "boundary": "--_NmP-56cbf8151211f597-Part_1" } }, "from": { "value": [ { "address": "[email protected]", "name": "AHEM Test!" } ], "html": "<span class=\"mp_address_group\"><span class=\"mp_address_name\">AHEM Test!</span> &lt;<a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a>&gt;</span>", "text": "AHEM Test! <[email protected]>" }, "to": { "value": [ { "address": "[email protected]", "name": "" } ], "html": "<span class=\"mp_address_group\"><a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a></span>", "text": "[email protected]" }, "subject": "AHEM mail test! ✔", "message-id": "<[email protected]>", "date": "2018-10-16T19:46:31Z", "mime-version": "1.0" }, "headerLines": [ { "key": "content-type", "line": "Content-Type: multipart/alternative;\r\n boundary=\"--_NmP-56cbf8151211f597-Part_1\"" }, { "key": "from", "line": "From: \"AHEM Test!\" <[email protected]>" }, { "key": "to", "line": "To: [email protected]" }, { "key": "subject", "line": "Subject: =?UTF-8?Q?AHEM_mail_test!_=E2=9C=94?=" }, { "key": "message-id", "line": "Message-ID: <[email protected]>" }, { "key": "date", "line": "Date: Tue, 16 Oct 2018 19:46:31 +0000" }, { "key": "mime-version", "line": "MIME-Version: 1.0" } ], "html": "<p><b>API Test:</b> <span style=\"color: darkgreen\">✔</span></p><p><b>SMTP Test:</b> <span style=\"color: darkgreen\">✔</span></p><p><b>DB Test:</b> <span style=\"color: darkgreen\">✔</span></p><p><br/></p>", "text": "API: ✔ SMTP: ✔ DB: ✔", "textAsHtml": "<p>API: &#x2714; SMTP: &#x2714; DB: &#x2714;</p>", "subject": "AHEM mail test! ✔", "date": "2018-10-16T19:46:31Z", "to": { "value": [ { "address": "[email protected]", "name": "" } ], "html": "<span class=\"mp_address_group\"><a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a></span>", "text": "[email protected]" }, "from": { "value": [ { "address": "[email protected]", "name": "AHEM Test!" } ], "html": "<span class=\"mp_address_group\"><span class=\"mp_address_name\">AHEM Test!</span> &lt;<a href=\"mailto:[email protected]\" class=\"mp_address_email\">[email protected]</a>&gt;</span>", "text": "AHEM Test! <[email protected]>" }, "messageId": "<[email protected]>", "timestamp": 1539719191853 } }, "GetAnEmailsContent404Response": { "title": "Get an email's content 404 response", "required": [ "error" ], "type": "object", "properties": { "error": { "type": "string", "example": "MAILBOX IS EMPTY!" } }, "example": { "error": "MAILBOX IS EMPTY!" } }, "DeleteAnEmailResponse": { "title": "Delete an Email response", "required": [ "success" ], "type": "object", "properties": { "success": { "type": "boolean", "example": true } }, "example": { "success": true } }, "DeleteAnEmail500Response": { "title": "Delete an Email 500 response", "required": [ "error" ], "type": "object", "properties": { "error": { "type": "string", "example": "error details" } }, "example": { "error": "error details" } }, "DeleteAnEmail404Response": { "title": "Delete an Email 404 response", "required": [ "success", "message" ], "type": "object", "properties": { "success": { "type": "boolean", "example": false }, "message": { "type": "string", "example": "EMAIL NOT FOUND" } }, "example": { "error": "error details" } }, "UpdateAnEmailsMetadataRequest": { "title": "Update an Email's metadata request", "required": [ "isRead" ], "type": "object", "properties": { "isRead": { "type": "boolean", "example": true } }, "example": { "isRead": true } }, "UpdateAnEmailsMetadataResponse": { "title": "Update an Email's metadata response", "required": [ "n", "nModified", "ok" ], "type": "object", "properties": { "n": { "type": "integer", "format": "int32", "example": 1 }, "nModified": { "type": "integer", "format": "int32", "example": 0 }, "ok": { "type": "integer", "format": "int32", "example": 1 } }, "example": { "n": 1, "nModified": 0, "ok": 1 } }, "UpdateAnEmailsMetadata500Response": { "title": "Update an Email's metadata 500 response", "required": [ "error" ], "type": "object", "properties": { "error": { "type": "string", "example": "error details" } }, "example": { "error": "error details" } } } }, "security": [], "tags": [ { "name": "General", "description": "General APIs" }, { "name": "Mailbox", "description": "Mailbox actions" }, { "name": "Email", "description": "Email actions" } ] }
{ "pile_set_name": "Github" }
/** * Global variables */ var session="true"; /*===========================================Gorgeous split-line==============================================*/ /** * ui */ $(function(){ $("h6").each(function(){ $(this).removeClass("selected"); }); $("ul").each(function(){ $(this).removeClass("opened"); $(this).addClass("closed"); }); $("#h-menu-order").addClass("selected"); $("#menu-order").removeClass("closed"); $("#menu-order").addClass("opened"); }); /*===========================================Gorgeous split-line==============================================*/ /** * flexigrid list */ $(function() { $("#orderinvoicemanagement").flexigrid( { url : 'findAllOrderIvoice.action', dataType : 'json', cache : false, colModel : [{ display : '订单编号', name : 'orderid', width : 100, sortable : true, align : 'center' }, { display : '发票类型', name : 'invType', width : 100, sortable : true, align : 'center' }, { display : '发票抬头', name : 'invPayee', width : 300, sortable : true, align : 'center' }, { display : '发票内容', name : 'invContent', width : 300, sortable : true, align : 'center' }, { display : '总金额', name : 'amount', width : 100, sortable : true, align : 'center' }, { display : '是否已开票', name : 'state', width : 100, sortable : true, align : 'center' }, { display : '开票会员', name : 'username', width : 150, sortable : true, align : 'center' }, { display : '提交开票时间', name : 'createtime', width : 200, sortable : true, align : 'center' } ], buttons : [ { name : '删除', bclass : 'delete', onpress : action }, { name : '标记已开票', bclass : 'add', onpress : action }, { name : '标记未开票', bclass : 'add', onpress : action }, { separator : true } ], searchitems : [ { display : '请选择搜索条件', name : 'sc', isdefault : true }, { display : '订单编号', name : 'orderid' } ], sortname : "createtime", sortorder : "desc", usepager : true, title : '需开票订单列表', useRp : true, rp : 20, rpOptions : [ 5, 20, 40, 100 ], showTableToggleBtn : true, width : 'auto', height : 'auto', pagestat : '显示{from}到{to}条,共{total}条记录', procmsg : '正在获取数据,请稍候...', checkbox:true }); function action(com, grid) { if (com == '删除') { if($('.trSelected',grid).length>0){ jConfirm('确定删除此项吗?', '信息提示', function(r) { if (r) { var str=""; $('.trSelected',grid).each(function(){ str+=this.id.substr(3)+","; }); $.post("DelOrderInvoice.action", { "orderInvoiceid" : str }, function(data) { $('#orderinvoicemanagement').flexReload(); }); } }); return; }else{ jAlert('请选择要删除的信息!','信息提示'); return false; } } else if (com == '标记已开票') { if($('.trSelected',grid).length>0){ jConfirm('确定更新此项吗?', '信息提示', function(r) { if (r) { var str=""; $('.trSelected',grid).each(function(){ str+=this.id.substr(3)+","; }); $.post("UpdateOrderInvoiceState.action", { "orderInvoiceid" : str, "state" : "1" }, function(data) { $('#orderinvoicemanagement').flexReload(); }); } }); return; }else{ jAlert('请选择要更新的信息!','信息提示'); return false; } } else if (com == '标记未开票') { if($('.trSelected',grid).length>0){ jConfirm('确定更新此项吗?', '信息提示', function(r) { if (r) { var str=""; $('.trSelected',grid).each(function(){ str+=this.id.substr(3)+","; }); $.post("UpdateOrderInvoiceState.action", { "orderInvoiceid" : str, "state" : "0" }, function(data) { $('#orderinvoicemanagement').flexReload(); }); } }); return; }else{ jAlert('请选择要更新的信息!','信息提示'); return false; } } } }); /*===========================================Gorgeous split-line==============================================*/
{ "pile_set_name": "Github" }
#!/usr/bin/env node var spawn = require('child_process').spawn // Returns a process running `git ls-remote <url>` that calls `with_ref` on // each parsed reference. The url may point to a local repository. function ls (url, with_ref) { var ls = spawn('git', ['ls-remote', url]) ls.stdout.on('data', function (lines) { lines.toString().split('\n').forEach(function (line) { if (!line || line === '') { return } line = line.split('\t') var sha = line[0] var branch = line[1] if (sha.length !== 40) { console.warn('[git ls-remote] expected a 40-byte sha: ' + sha + '\n') console.warn('[git ls-remote] on line: ' + line.join('\t')) } with_ref(sha, branch) }) }) return ls } function pad4 (num) { num = num.toString(16) while (num.length < 4) { num = '0' + num } return num } // Invokes `$ git-upload-pack --strict <dir>`, communicates haves and wants and // emits 'ready' when stdout becomes a pack file stream. function upload_pack (dir, want, have) { // reference: // https://github.com/git/git/blob/b594c975c7e865be23477989d7f36157ad437dc7/Documentation/technical/pack-protocol.txt#L346-L393 var upload = spawn('git-upload-pack', ['--strict', dir]) writeln('want ' + want) writeln() if (have) { writeln('have ' + have) writeln() } writeln('done') // We want to read git's output one line at a time, and not read any more // than we have to. That way, when we finish discussing wants and haves, we // can pipe the rest of the output to a stream. // // We use `mode` to keep track of state and formulate responses. It returns // `false` when we should stop reading. var mode = list upload.stdout.on('readable', function () { while (true) { var line = getline() if (line === null) { return // to wait for more output } if (!mode(line)) { upload.stdout.removeAllListeners('readable') upload.emit('ready') return } } }) var getline_len = null // Extracts exactly one line from the stream. Uses `getline_len` in case the // whole line could not be read. function getline () { // Format: '####line' where '####' represents the length of 'line' in hex. if (!getline_len) { getline_len = upload.stdout.read(4) if (getline_len === null) { return null } getline_len = parseInt(getline_len, 16) } if (getline_len === 0) { return '' } // Subtract by the four we just read, and the terminating newline. var line = upload.stdout.read(getline_len - 4 - 1) if (!line) { return null } getline_len = null upload.stdout.read(1) // And discard the newline. return line.toString() } // First, the server lists the refs it has, but we already know from // `git ls-remote`, so wait for it to signal the end. function list (line) { if (line === '') { mode = have ? ack_objects_continue : wait_for_nak } return true } // If we only gave wants, git should respond with 'NAK', then the pack file. function wait_for_nak (line) { return line !== 'NAK' } // With haves, we wait for 'ACK', but only if not ending in 'continue'. function ack_objects_continue (line) { return !(line.search(/^ACK/) !== -1 && line.search(/continue$/) === -1) } // Writes one line to stdin so git-upload-pack can understand. function writeln (line) { if (line) { var len = pad4(line.length + 4 + 1) // Add one for the newline. upload.stdin.write(len + line + '\n') } else { upload.stdin.write('0000') } } return upload } module.exports = {ls: ls, upload_pack: upload_pack}
{ "pile_set_name": "Github" }
import warnings import numpy as np from matplotlib.colors import Normalize from matplotlib.collections import LineCollection from mpl_scatter_density.generic_density_artist import GenericDensityArtist from astropy.visualization import (ImageNormalize, LinearStretch, SqrtStretch, AsinhStretch, LogStretch) from glue.utils import defer_draw, broadcast_to, nanmax, ensure_numerical, datetime64_to_mpl from glue.viewers.scatter.state import ScatterLayerState from glue.viewers.scatter.python_export import python_export_scatter_layer from glue.viewers.matplotlib.layer_artist import MatplotlibLayerArtist from glue.core.exceptions import IncompatibleAttribute from matplotlib.lines import Line2D STRETCHES = {'linear': LinearStretch, 'sqrt': SqrtStretch, 'arcsinh': AsinhStretch, 'log': LogStretch} CMAP_PROPERTIES = set(['cmap_mode', 'cmap_att', 'cmap_vmin', 'cmap_vmax', 'cmap']) MARKER_PROPERTIES = set(['size_mode', 'size_att', 'size_vmin', 'size_vmax', 'size_scaling', 'size', 'fill']) LINE_PROPERTIES = set(['linewidth', 'linestyle']) DENSITY_PROPERTIES = set(['dpi', 'stretch', 'density_contrast']) VISUAL_PROPERTIES = (CMAP_PROPERTIES | MARKER_PROPERTIES | DENSITY_PROPERTIES | LINE_PROPERTIES | set(['color', 'alpha', 'zorder', 'visible'])) DATA_PROPERTIES = set(['layer', 'x_att', 'y_att', 'cmap_mode', 'size_mode', 'density_map', 'xerr_att', 'yerr_att', 'xerr_visible', 'yerr_visible', 'vector_visible', 'vx_att', 'vy_att', 'vector_arrowhead', 'vector_mode', 'vector_origin', 'line_visible', 'markers_visible', 'vector_scaling']) def ravel_artists(errorbar_artist): for artist_container in errorbar_artist: if artist_container is not None: for artist in artist_container: if artist is not None: yield artist class InvertedNormalize(Normalize): def __call__(self, *args, **kwargs): return 1 - super(InvertedNormalize, self).__call__(*args, **kwargs) class DensityMapLimits(object): contrast = 1 def min(self, array): return 0 def max(self, array): return 10. ** (np.log10(nanmax(array)) * self.contrast) def set_mpl_artist_cmap(artist, values, state=None, cmap=None, vmin=None, vmax=None): if state is not None: vmin = state.cmap_vmin vmax = state.cmap_vmax cmap = state.cmap if not isinstance(artist, GenericDensityArtist): artist.set_array(values) artist.set_cmap(cmap) if vmin > vmax: artist.set_clim(vmax, vmin) artist.set_norm(InvertedNormalize(vmax, vmin)) else: artist.set_clim(vmin, vmax) artist.set_norm(Normalize(vmin, vmax)) class ColoredLineCollection(LineCollection): def __init__(self, x, y, **kwargs): segments = np.zeros((0, 2, 2)) super(ColoredLineCollection, self).__init__(segments, **kwargs) self.set_points(x, y) def set_points(self, x, y, oversample=True): if len(x) == 0: self.set_segments(np.zeros((0, 2, 2))) return if oversample: x_fine = np.zeros(len(x) * 2 - 1, dtype=float) y_fine = np.zeros(len(y) * 2 - 1, dtype=float) x_fine[::2] = x x_fine[1::2] = 0.5 * (x[1:] + x[:-1]) y_fine[::2] = y y_fine[1::2] = 0.5 * (y[1:] + y[:-1]) points = np.array([x_fine, y_fine]).transpose().reshape(-1, 1, 2) segments = np.concatenate([points[:-1], points[1:]], axis=1) self.set_segments(segments) else: points = np.array([x, y]).transpose() self.set_segments([points]) def set_linearcolor(self, color=None, data=None, **kwargs): if color is None: data_new = np.zeros((len(data) - 1) * 2) data_new[::2] = data[:-1] data_new[1::2] = data[1:] set_mpl_artist_cmap(self, data_new, **kwargs) else: if isinstance(color, np.ndarray): color_new = np.zeros(((color.shape[0] - 1) * 2,) + color.shape[1:]) color_new[::2] = color[:-1] color_new[1::2] = color[1:] color = color_new self.set_array(None) self.set_color(color) def plot_colored_line(ax, x, y, c=None, cmap=None, vmin=None, vmax=None, **kwargs): lc = ColoredLineCollection(x, y, **kwargs) lc.set_linearcolor(color=c, cmap=cmap, vmin=vmin, vmax=vmax) ax.add_collection(lc) return lc class ScatterLayerArtist(MatplotlibLayerArtist): _layer_state_cls = ScatterLayerState _python_exporter = python_export_scatter_layer def __init__(self, axes, viewer_state, layer_state=None, layer=None): super(ScatterLayerArtist, self).__init__(axes, viewer_state, layer_state=layer_state, layer=layer) # Watch for changes in the viewer state which would require the # layers to be redrawn self._viewer_state.add_global_callback(self._update_scatter) self.state.add_global_callback(self._update_scatter) # Scatter density self.density_auto_limits = DensityMapLimits() self._set_axes(axes) self.errorbar_index = 2 self.vector_index = 3 # NOTE: Matplotlib can't deal with NaN values in errorbar correctly, so # we need to prefilter values - the following variable is used to store # the mask for the values we keep, so that we can apply it to the color # See also https://github.com/matplotlib/matplotlib/issues/13799 self._errorbar_keep = None def _set_axes(self, axes): self.axes = axes self.scatter_artist = self.axes.scatter([], []) self.plot_artist = self.axes.plot([], [], 'o', mec='none')[0] self.errorbar_artist = self.axes.errorbar([], [], fmt='none') self.vector_artist = None self.line_collection = ColoredLineCollection([], []) self.axes.add_collection(self.line_collection) with warnings.catch_warnings(): warnings.filterwarnings("ignore", message='All-NaN slice encountered') self.density_artist = GenericDensityArtist(self.axes, color='white', vmin=self.density_auto_limits.min, vmax=self.density_auto_limits.max, update_while_panning=False, histogram2d_func=self.compute_density_map, label=None) self.axes.add_artist(self.density_artist) self.mpl_artists = [self.scatter_artist, self.plot_artist, self.errorbar_artist, self.vector_artist, self.line_collection, self.density_artist] def compute_density_map(self, *args, **kwargs): try: density_map = self.state.compute_density_map(*args, **kwargs) except IncompatibleAttribute: self.disable_invalid_attributes(self._viewer_state.x_att, self._viewer_state.y_att) return np.array([[np.nan]]) else: self.enable() return density_map @defer_draw def _update_data(self): # Layer artist has been cleared already if len(self.mpl_artists) == 0: return try: if not self.state.density_map: x = ensure_numerical(self.layer[self._viewer_state.x_att].ravel()) if x.dtype.kind == 'M': x = datetime64_to_mpl(x) except (IncompatibleAttribute, IndexError): # The following includes a call to self.clear() self.disable_invalid_attributes(self._viewer_state.x_att) return else: self.enable() try: if not self.state.density_map: y = ensure_numerical(self.layer[self._viewer_state.y_att].ravel()) if y.dtype.kind == 'M': y = datetime64_to_mpl(y) except (IncompatibleAttribute, IndexError): # The following includes a call to self.clear() self.disable_invalid_attributes(self._viewer_state.y_att) return else: self.enable() if self.state.markers_visible: if self.state.density_map: # We don't use x, y here because we actually make use of the # ability of the density artist to call a custom histogram # method which is defined on this class and does the data # access. self.plot_artist.set_data([], []) self.scatter_artist.set_offsets(np.zeros((0, 2))) else: self.density_artist.set_label(None) if self._use_plot_artist(): # In this case we use Matplotlib's plot function because it has much # better performance than scatter. self.plot_artist.set_data(x, y) else: offsets = np.vstack((x, y)).transpose() self.scatter_artist.set_offsets(offsets) else: self.plot_artist.set_data([], []) self.scatter_artist.set_offsets(np.zeros((0, 2))) if self.state.line_visible: if self.state.cmap_mode == 'Fixed': self.line_collection.set_points(x, y, oversample=False) else: # In the case where we want to color the line, we need to over # sample the line by a factor of two so that we can assign the # correct colors to segments - if we didn't do this, then # segments on one side of a point would be a different color # from the other side. With oversampling, we can have half a # segment on either side of a point be the same color as a # point self.line_collection.set_points(x, y) else: self.line_collection.set_points([], []) for eartist in ravel_artists(self.errorbar_artist): try: eartist.remove() except ValueError: pass if self.vector_artist is not None: self.vector_artist.remove() self.vector_artist = None if self.state.vector_visible: if self.state.vx_att is not None and self.state.vy_att is not None: vx = ensure_numerical(self.layer[self.state.vx_att].ravel()) vy = ensure_numerical(self.layer[self.state.vy_att].ravel()) if self.state.vector_mode == 'Polar': ang = vx length = vy # assume ang is anti clockwise from the x axis vx = length * np.cos(np.radians(ang)) vy = length * np.sin(np.radians(ang)) else: vx = None vy = None if self.state.vector_arrowhead: hw = 3 hl = 5 else: hw = 1 hl = 0 vmax = nanmax(np.hypot(vx, vy)) self.vector_artist = self.axes.quiver(x, y, vx, vy, units='width', pivot=self.state.vector_origin, headwidth=hw, headlength=hl, scale_units='width', angles='xy', scale=10 / self.state.vector_scaling * vmax ) self.mpl_artists[self.vector_index] = self.vector_artist if self.state.xerr_visible or self.state.yerr_visible: keep = ~np.isnan(x) & ~np.isnan(y) if self.state.xerr_visible and self.state.xerr_att is not None: xerr = ensure_numerical(self.layer[self.state.xerr_att].ravel()).copy() keep &= ~np.isnan(xerr) else: xerr = None if self.state.yerr_visible and self.state.yerr_att is not None: yerr = ensure_numerical(self.layer[self.state.yerr_att].ravel()).copy() keep &= ~np.isnan(yerr) else: yerr = None if xerr is not None: xerr = xerr[keep] if yerr is not None: yerr = yerr[keep] self._errorbar_keep = keep self.errorbar_artist = self.axes.errorbar(x[keep], y[keep], fmt='none', xerr=xerr, yerr=yerr ) self.mpl_artists[self.errorbar_index] = self.errorbar_artist @defer_draw def _update_visual_attributes(self, changed, force=False): if not self.enabled: return if self.state.markers_visible: if self.state.density_map: if self.state.cmap_mode == 'Fixed': if force or 'color' in changed or 'cmap_mode' in changed: self.density_artist.set_color(self.state.color) self.density_artist.set_clim(self.density_auto_limits.min, self.density_auto_limits.max) elif force or any(prop in changed for prop in CMAP_PROPERTIES): c = ensure_numerical(self.layer[self.state.cmap_att].ravel()) set_mpl_artist_cmap(self.density_artist, c, self.state) if force or 'stretch' in changed: self.density_artist.set_norm(ImageNormalize(stretch=STRETCHES[self.state.stretch]())) if force or 'dpi' in changed: self.density_artist.set_dpi(self._viewer_state.dpi) if force or 'density_contrast' in changed: self.density_auto_limits.contrast = self.state.density_contrast self.density_artist.stale = True else: if self._use_plot_artist(): if force or 'color' in changed or 'fill' in changed: if self.state.fill: self.plot_artist.set_markeredgecolor('none') self.plot_artist.set_markerfacecolor(self.state.color) else: self.plot_artist.set_markeredgecolor(self.state.color) self.plot_artist.set_markerfacecolor('none') if force or 'size' in changed or 'size_scaling' in changed: self.plot_artist.set_markersize(self.state.size * self.state.size_scaling) else: # TEMPORARY: Matplotlib has a bug that causes set_alpha to # change the colors back: https://github.com/matplotlib/matplotlib/issues/8953 if 'alpha' in changed: force = True if self.state.cmap_mode == 'Fixed': if force or 'color' in changed or 'cmap_mode' in changed or 'fill' in changed: self.scatter_artist.set_array(None) if self.state.fill: self.scatter_artist.set_facecolors(self.state.color) self.scatter_artist.set_edgecolors('none') else: self.scatter_artist.set_facecolors('none') self.scatter_artist.set_edgecolors(self.state.color) elif force or any(prop in changed for prop in CMAP_PROPERTIES) or 'fill' in changed: self.scatter_artist.set_edgecolors(None) self.scatter_artist.set_facecolors(None) c = ensure_numerical(self.layer[self.state.cmap_att].ravel()) set_mpl_artist_cmap(self.scatter_artist, c, self.state) if self.state.fill: self.scatter_artist.set_edgecolors('none') else: colors = self.scatter_artist.get_facecolors() self.scatter_artist.set_facecolors('none') self.scatter_artist.set_edgecolors(colors) if force or any(prop in changed for prop in MARKER_PROPERTIES): if self.state.size_mode == 'Fixed': s = self.state.size * self.state.size_scaling s = broadcast_to(s, self.scatter_artist.get_sizes().shape) else: s = ensure_numerical(self.layer[self.state.size_att].ravel()) s = ((s - self.state.size_vmin) / (self.state.size_vmax - self.state.size_vmin)) # The following ensures that the sizes are in the # range 3 to 30 before the final size_scaling. np.clip(s, 0, 1, out=s) s *= 0.95 s += 0.05 s *= (30 * self.state.size_scaling) # Note, we need to square here because for scatter, s is actually # proportional to the marker area, not radius. self.scatter_artist.set_sizes(s ** 2) if self.state.line_visible: if self.state.cmap_mode == 'Fixed': if force or 'color' in changed or 'cmap_mode' in changed: self.line_collection.set_linearcolor(color=self.state.color) elif force or any(prop in changed for prop in CMAP_PROPERTIES): # Higher up we oversampled the points in the line so that # half a segment on either side of each point has the right # color, so we need to also oversample the color here. c = ensure_numerical(self.layer[self.state.cmap_att].ravel()) self.line_collection.set_linearcolor(data=c, state=self.state) if force or 'linewidth' in changed: self.line_collection.set_linewidth(self.state.linewidth) if force or 'linestyle' in changed: self.line_collection.set_linestyle(self.state.linestyle) if self.state.vector_visible and self.vector_artist is not None: if self.state.cmap_mode == 'Fixed': if force or 'color' in changed or 'cmap_mode' in changed: self.vector_artist.set_array(None) self.vector_artist.set_color(self.state.color) elif force or any(prop in changed for prop in CMAP_PROPERTIES): c = ensure_numerical(self.layer[self.state.cmap_att].ravel()) set_mpl_artist_cmap(self.vector_artist, c, self.state) if self.state.xerr_visible or self.state.yerr_visible: for eartist in ravel_artists(self.errorbar_artist): if self.state.cmap_mode == 'Fixed': if force or 'color' in changed or 'cmap_mode' in changed: eartist.set_color(self.state.color) elif force or any(prop in changed for prop in CMAP_PROPERTIES): c = ensure_numerical(self.layer[self.state.cmap_att].ravel()).copy() c = c[self._errorbar_keep] set_mpl_artist_cmap(eartist, c, self.state) if force or 'alpha' in changed: eartist.set_alpha(self.state.alpha) if force or 'visible' in changed: eartist.set_visible(self.state.visible) if force or 'zorder' in changed: eartist.set_zorder(self.state.zorder) for artist in [self.scatter_artist, self.plot_artist, self.vector_artist, self.line_collection, self.density_artist]: if artist is None: continue if force or 'alpha' in changed: artist.set_alpha(self.state.alpha) if force or 'zorder' in changed: artist.set_zorder(self.state.zorder) if force or 'visible' in changed: # We need to hide the density artist if it is not needed because # otherwise it might still show even if there is no data as the # neutral/zero color might not be white. if artist is self.density_artist: artist.set_visible(self.state.visible and self.state.density_map and self.state.markers_visible) else: artist.set_visible(self.state.visible) if self._use_plot_artist(): self.scatter_artist.set_visible(False) else: self.plot_artist.set_visible(False) self.redraw() @defer_draw def _update_scatter(self, force=False, **kwargs): if (self._viewer_state.x_att is None or self._viewer_state.y_att is None or self.state.layer is None): return changed = set() if force else self.pop_changed_properties() if force or len(changed & DATA_PROPERTIES) > 0: self._update_data() force = True if force or len(changed & VISUAL_PROPERTIES) > 0: self._update_visual_attributes(changed, force=force) def get_layer_color(self): if self.state.cmap_mode == 'Fixed': return self.state.color else: return self.state.cmap @defer_draw def update(self): self._update_scatter(force=True) self.redraw() def remove(self): super(ScatterLayerArtist, self).remove() # Clean up the density artist to avoid circular references to do a # reference to the self.histogram2d method in density artist. self.density_artist = None def get_handle_legend(self): if self.enabled and self.state.visible: handles = [] if self.state.markers_visible: if self.state.density_map: if self.state.cmap_mode == 'Fixed': color = self.get_layer_color() else: color = self.layer.style.color handle = Line2D([0, ], [0, ], marker=".", linestyle="none", ms=self.state.size, alpha=self.state.alpha, color=color) handles.append(handle) # as placeholder else: if self._use_plot_artist(): handles.append(self.plot_artist) else: handles.append(self.scatter_artist) if self.state.line_visible: handles.append(self.line_collection) if self.state.vector_visible: handles.append(self.vector_artist) if self.state.xerr_visible or self.state.yerr_visible: handles.append(self.errorbar_artist) handles = tuple(handles) if len(handles) > 0: return handles, self.layer.label, None else: return None, None, None else: return None, None, None def _use_plot_artist(self): res = self.state.cmap_mode == 'Fixed' and self.state.size_mode == 'Fixed' return res and (not hasattr(self._viewer_state, 'plot_mode') or not self._viewer_state.plot_mode == 'polar')
{ "pile_set_name": "Github" }
/*========================================================================= * * Copyright NumFOCUS * * 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.txt * * 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. * *=========================================================================*/ #ifndef itkInOrderTreeIterator_h #define itkInOrderTreeIterator_h #include "itkTreeIteratorBase.h" namespace itk { template <typename TTreeType> class InOrderTreeIterator : public TreeIteratorBase<TTreeType> { public: /** Typedefs */ using Self = InOrderTreeIterator; using Superclass = TreeIteratorBase<TTreeType>; using TreeType = TTreeType; using ValueType = typename TTreeType::ValueType; using TreeNodeType = typename Superclass::TreeNodeType; using NodeType = typename Superclass::NodeType; /** Constructors */ InOrderTreeIterator(TreeType & start); InOrderTreeIterator(TreeType * tree, TreeNodeType * start = nullptr); /** Get the type of iterator */ NodeType GetType() const override; /** Clone function */ TreeIteratorBase<TTreeType> * Clone() override; protected: /** Return the next node */ const ValueType & Next() override; /** Return true if the next node exists */ bool HasNext() const override; private: /** Find the next node */ const TreeNodeType * FindNextNode() const; }; /** Constructor */ template <typename TTreeType> InOrderTreeIterator<TTreeType>::InOrderTreeIterator(TTreeType & start) : TreeIteratorBase<TTreeType>(start) {} /** Constructor */ template <typename TTreeType> InOrderTreeIterator<TTreeType>::InOrderTreeIterator(TTreeType * tree, TreeNodeType * start) : TreeIteratorBase<TTreeType>(tree, start) {} /** Get the type of the iterator */ template <typename TTreeType> typename InOrderTreeIterator<TTreeType>::NodeType InOrderTreeIterator<TTreeType>::GetType() const { return TreeIteratorBaseEnums::TreeIteratorBaseNode::INORDER; } /** Return true if the next node exists */ template <typename TTreeType> bool InOrderTreeIterator<TTreeType>::HasNext() const { if (const_cast<TreeNodeType *>(FindNextNode()) != nullptr) { return true; } return false; } /** Return the next node */ template <typename TTreeType> const typename InOrderTreeIterator<TTreeType>::ValueType & InOrderTreeIterator<TTreeType>::Next() { this->m_Position = const_cast<TreeNodeType *>(FindNextNode()); if (this->m_Position == nullptr) { return this->m_Root->Get(); // value irrelevant, but we have to return something } return this->m_Position->Get(); } /** Find the next node */ template <typename TTreeType> const typename InOrderTreeIterator<TTreeType>::TreeNodeType * InOrderTreeIterator<TTreeType>::FindNextNode() const { if (this->m_Position == nullptr) { return nullptr; } if (this->m_Position->HasChildren()) { return this->m_Position->GetChild(0); } if (!this->m_Position->HasParent()) { return nullptr; } TreeNodeType * child = this->m_Position; TreeNodeType * parent = this->m_Position->GetParent(); int childPosition = parent->ChildPosition(child); int lastChildPosition = parent->CountChildren() - 1; while (childPosition < lastChildPosition) { TreeNodeType * help = parent->GetChild(childPosition + 1); if (help != nullptr) { return help; } childPosition++; } while (parent->HasParent()) { child = parent; parent = parent->GetParent(); // Subtree if (parent->ChildPosition(this->m_Root) >= 0) { return nullptr; } childPosition = parent->ChildPosition(child); lastChildPosition = parent->CountChildren() - 1; while (childPosition < lastChildPosition) { TreeNodeType * help = parent->GetChild(childPosition + 1); if (help != nullptr) { return help; } } } return nullptr; } /** Clone function */ template <typename TTreeType> TreeIteratorBase<TTreeType> * InOrderTreeIterator<TTreeType>::Clone() { auto * clone = new InOrderTreeIterator(const_cast<TTreeType *>(this->m_Tree)); *clone = *this; return clone; } } // end namespace itk #endif
{ "pile_set_name": "Github" }
__ace_shadowed__.define('ace/snippets/csharp', ['require', 'exports', 'module' ], function(require, exports, module) { exports.snippetText = ""; exports.scope = "csharp"; });
{ "pile_set_name": "Github" }
/* * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. */ /* * 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 com.sun.org.apache.xalan.internal.xsltc.compiler; import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE; import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL; import com.sun.org.apache.bcel.internal.generic.InstructionList; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NodeSetType; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NodeType; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ReferenceType; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ResultTreeType; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util; import com.sun.org.apache.xml.internal.utils.XML11Char; import java.util.ArrayList; import java.util.List; /** * @author Jacek Ambroziak * @author Santiago Pericas-Geertsen * @LastModified: Oct 2017 */ final class ApplyTemplates extends Instruction { private Expression _select; private Type _type = null; private QName _modeName; private String _functionName; public void display(int indent) { indent(indent); Util.println("ApplyTemplates"); indent(indent + IndentIncrement); Util.println("select " + _select.toString()); if (_modeName != null) { indent(indent + IndentIncrement); Util.println("mode " + _modeName); } } public boolean hasWithParams() { return hasContents(); } public void parseContents(Parser parser) { final String select = getAttribute("select"); final String mode = getAttribute("mode"); if (select.length() > 0) { _select = parser.parseExpression(this, "select", null); } if (mode.length() > 0) { if (!XML11Char.isXML11ValidQName(mode)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, mode, this); parser.reportError(Constants.ERROR, err); } _modeName = parser.getQNameIgnoreDefaultNs(mode); } // instantiate Mode if needed, cache (apply temp) function name _functionName = parser.getTopLevelStylesheet().getMode(_modeName).functionName(); parseChildren(parser);// with-params } public Type typeCheck(SymbolTable stable) throws TypeCheckError { if (_select != null) { _type = _select.typeCheck(stable); if (_type instanceof NodeType || _type instanceof ReferenceType) { _select = new CastExpr(_select, Type.NodeSet); _type = Type.NodeSet; } if (_type instanceof NodeSetType||_type instanceof ResultTreeType) { typeCheckContents(stable); // with-params return Type.Void; } throw new TypeCheckError(this); } else { typeCheckContents(stable); // with-params return Type.Void; } } /** * Translate call-template. A parameter frame is pushed only if * some template in the stylesheet uses parameters. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { boolean setStartNodeCalled = false; final Stylesheet stylesheet = classGen.getStylesheet(); final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int current = methodGen.getLocalIndex("current"); // check if sorting nodes is required final List<Sort> sortObjects = new ArrayList<>(); for (final SyntaxTreeNode child : getContents()) { if (child instanceof Sort) { sortObjects.add((Sort)child); } } // Push a new parameter frame if (stylesheet.hasLocalParams() || hasContents()) { il.append(classGen.loadTranslet()); final int pushFrame = cpg.addMethodref(TRANSLET_CLASS, PUSH_PARAM_FRAME, PUSH_PARAM_FRAME_SIG); il.append(new INVOKEVIRTUAL(pushFrame)); // translate with-params translateContents(classGen, methodGen); } il.append(classGen.loadTranslet()); // The 'select' expression is a result-tree if ((_type != null) && (_type instanceof ResultTreeType)) { // <xsl:sort> cannot be applied to a result tree - issue warning if (sortObjects.size() > 0) { ErrorMsg err = new ErrorMsg(ErrorMsg.RESULT_TREE_SORT_ERR,this); getParser().reportError(WARNING, err); } // Put the result tree (a DOM adapter) on the stack _select.translate(classGen, methodGen); // Get back the DOM and iterator (not just iterator!!!) _type.translateTo(classGen, methodGen, Type.NodeSet); } else { il.append(methodGen.loadDOM()); // compute node iterator for applyTemplates if (sortObjects.size() > 0) { Sort.translateSortIterator(classGen, methodGen, _select, sortObjects); int setStartNode = cpg.addInterfaceMethodref(NODE_ITERATOR, SET_START_NODE, "(I)"+ NODE_ITERATOR_SIG); il.append(methodGen.loadCurrentNode()); il.append(new INVOKEINTERFACE(setStartNode,2)); setStartNodeCalled = true; } else { if (_select == null) Mode.compileGetChildren(classGen, methodGen, current); else _select.translate(classGen, methodGen); } } if (_select != null && !setStartNodeCalled) { _select.startIterator(classGen, methodGen); } //!!! need to instantiate all needed modes final String className = classGen.getStylesheet().getClassName(); il.append(methodGen.loadHandler()); final String applyTemplatesSig = classGen.getApplyTemplatesSig(); final int applyTemplates = cpg.addMethodref(className, _functionName, applyTemplatesSig); il.append(new INVOKEVIRTUAL(applyTemplates)); // unmap parameters to release temporary result trees for (final SyntaxTreeNode child : getContents()) { if (child instanceof WithParam) { ((WithParam)child).releaseResultTree(classGen, methodGen); } } // Pop parameter frame if (stylesheet.hasLocalParams() || hasContents()) { il.append(classGen.loadTranslet()); final int popFrame = cpg.addMethodref(TRANSLET_CLASS, POP_PARAM_FRAME, POP_PARAM_FRAME_SIG); il.append(new INVOKEVIRTUAL(popFrame)); } } }
{ "pile_set_name": "Github" }
// // ProductInfoCell.h // ETShop-for-iOS // // Created by EleTeam(Tony Wong) on 15/06/29. // Copyright © 2015年 EleTeam. All rights reserved. // // @email [email protected] // // @license The MIT License (MIT) // #import <UIKit/UIKit.h> #import "Product.h" //产品详情页顶部的产品信息 @interface ProductInfoCell : UITableViewCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier product:(Product *)product; + (CGFloat)heightWithNoShortDescription; + (CGFloat)heightWithShortDescription; @end
{ "pile_set_name": "Github" }
/* * libratbox: a library used by ircd-ratbox and other things * openssl_ratbox.h: OpenSSL backend data * * Copyright (C) 2015-2016 Aaron Jones <[email protected]> * * 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 2 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 * */ #ifndef LRB_OPENSSL_H_INC #define LRB_OPENSSL_H_INC 1 #include <openssl/dh.h> #include <openssl/ec.h> #include <openssl/err.h> #include <openssl/evp.h> #include <openssl/rand.h> #include <openssl/ssl.h> #include <openssl/opensslv.h> /* * A long time ago, in a world far away, OpenSSL had a well-established mechanism for ensuring compatibility with * regards to added, changed, and removed functions, by having an SSLEAY_VERSION_NUMBER macro. This was then * renamed to OPENSSL_VERSION_NUMBER, but the old macro was kept around for compatibility until OpenSSL version * 1.1.0. * * Then the OpenBSD developers decided that having OpenSSL in their codebase was a bad idea. They forked it to * create LibreSSL, gutted all of the functionality they didn't want or need, and generally improved the library * a lot. Then, as the OpenBSD developers are want to do, they packaged up LibreSSL for release to other * operating systems, as LibreSSL Portable. Think along the lines of OpenSSH where they have also done this. * * The fun part of this story ends there. LibreSSL has an OPENSSL_VERSION_NUMBER macro, but they have set it to a * stupidly high value, version 2.0. OpenSSL version 2.0 does not exist, and LibreSSL 2.2 does not implement * everything OpenSSL 1.0.2 or 1.1.0 do. This completely breaks the entire purpose of the macro. * * The ifdef soup below is for LibreSSL compatibility. Please find whoever thought setting OPENSSL_VERSION_NUMBER * to a version that does not exist was a good idea. Encourage them to realise that it is not. -- amdj */ #if !defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x10100000L) # define LRB_SSL_NO_EXPLICIT_INIT 1 #endif #if !defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x10002000L) # define LRB_HAVE_TLS_SET_CURVES 1 # if (OPENSSL_VERSION_NUMBER < 0x10100000L) # define LRB_HAVE_TLS_ECDH_AUTO 1 # endif #endif #if defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER >= 0x20020002L) # define LRB_HAVE_TLS_METHOD_API 1 #else # if !defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x10100000L) # define LRB_HAVE_TLS_METHOD_API 1 # endif #endif #if !defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x10100000L) # define LRB_SSL_VTEXT_COMPILETIME OPENSSL_VERSION_TEXT # define LRB_SSL_VTEXT_RUNTIME OpenSSL_version(OPENSSL_VERSION) # define LRB_SSL_VNUM_COMPILETIME OPENSSL_VERSION_NUMBER # define LRB_SSL_VNUM_RUNTIME OpenSSL_version_num() # define LRB_SSL_FULL_VERSION_INFO 1 #else # if defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER >= 0x20200000L) # define LRB_SSL_VTEXT_RUNTIME SSLeay_version(SSLEAY_VERSION) # define LRB_SSL_VNUM_COMPILETIME LIBRESSL_VERSION_NUMBER # else # define LRB_SSL_VTEXT_RUNTIME SSLeay_version(SSLEAY_VERSION) # define LRB_SSL_VNUM_COMPILETIME SSLEAY_VERSION_NUMBER # endif #endif #if !defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER > 0x10101000L) # define LRB_HAVE_TLS_ECDH_X25519 1 #else # if defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER > 0x2050100fL) # define LRB_HAVE_TLS_ECDH_X25519 1 # endif #endif /* * Default supported ciphersuites (if the user does not provide any) and * curves (OpenSSL 1.0.2+). Hardcoded secp384r1 (NIST P-384) is used on * OpenSSL 1.0.0 and 1.0.1 (if available). * * We prefer AEAD ciphersuites first in order of strength, then SHA2 * ciphersuites, then remaining suites. */ static const char rb_default_ciphers[] = "" "aECDSA+kEECDH+CHACHA20:" "aRSA+kEECDH+CHACHA20:" "aRSA+kEDH+CHACHA20:" "aECDSA+kEECDH+AESGCM:" "aRSA+kEECDH+AESGCM:" "aRSA+kEDH+AESGCM:" "aECDSA+kEECDH+AESCCM:" "aRSA+kEECDH+AESCCM:" "aRSA+kEDH+AESCCM:" "@STRENGTH:" "aECDSA+kEECDH+HIGH+SHA384:" "aRSA+kEECDH+HIGH+SHA384:" "aRSA+kEDH+HIGH+SHA384:" "aECDSA+kEECDH+HIGH+SHA256:" "aRSA+kEECDH+HIGH+SHA256:" "aRSA+kEDH+HIGH+SHA256:" "aECDSA+kEECDH+HIGH:" "aRSA+kEECDH+HIGH:" "aRSA+kEDH+HIGH:" "HIGH:" "!3DES:" "!aNULL"; #ifdef LRB_HAVE_TLS_SET_CURVES # ifdef LRB_HAVE_TLS_ECDH_X25519 static char rb_default_curves[] = "X25519:P-521:P-384:P-256"; # else static char rb_default_curves[] = "P-521:P-384:P-256"; # endif #endif #endif /* LRB_OPENSSL_H_INC */
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>RedmineWikiFormatting (Markdown)</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="../wiki_syntax_detailed.css" /> </head> <body> <h1><a name="1" class="wiki-page"></a>Wiki formatting (Markdown)</h1> <ul class='toc'> <li><a href='#2'>Links</a></li> <ul> <li><a href='#3'>Redmine links</a></li> <li><a href='#4'>External links</a></li> </ul> <li><a href='#5'>Text formatting</a></li> <ul> <li><a href='#6'>Font style</a></li> <li><a href='#7'>Inline images</a></li> <li><a href='#8'>Headings</a></li> <li><a href='#10'>Blockquotes</a></li> <li><a href='#11'>Table of content</a></li> <li><a href='#14'>Horizontal Rule</a></li> </ul> <li><a href='#12'>Macros</a></li> <li><a href='#13'>Code highlighting</a></li> </ul> <h2><a name="2" class="wiki-page"></a>Links</h2> <h3><a name="3" class="wiki-page"></a>Redmine links</h3> <p>Redmine allows hyperlinking between resources (issues, changesets, wiki pages...) from anywhere wiki formatting is used.</p> <ul> <li>Link to an issue: <strong>#124</strong> (displays <del><a href="#" class="issue" title="bulk edit doesn't change the category or fixed version properties (Closed)">#124</a></del>, link is striked-through if the issue is closed)</li> <li>Link to an issue including tracker name and subject: <strong>##124</strong> (displays <a href="#" class="issue" title="bulk edit doesn't change the category or fixed version properties (New)">Bug #124</a>: bulk edit doesn't change the category or fixed version properties)</li> <li>Link to an issue note: <strong>#124-6</strong>, or <strong>#124#note-6</strong></li> <li>Link to an issue note within the same issue: <strong>#note-6</strong></li> </ul> <p>Wiki links:</p> <ul> <li><strong>[[Guide]]</strong> displays a link to the page named 'Guide': <a href="#" class="wiki-page">Guide</a></li> <li><strong>[[Guide#further-reading]]</strong> takes you to the anchor "further-reading". Headings get automatically assigned anchors so that you can refer to them: <a href="#" class="wiki-page">Guide</a></li> <li><strong>[[#further-reading]]</strong> link to the anchor "further-reading" of the current page: <a href="#" class="wiki-page">#further-reading</a></li> <li><strong>[[Guide|User manual]]</strong> displays a link to the same page but with a different text: <a href="#" class="wiki-page">User manual</a></li> </ul> <p>You can also link to pages of an other project wiki:</p> <ul> <li><strong>[[sandbox:some page]]</strong> displays a link to the page named 'Some page' of the Sandbox wiki</li> <li><strong>[[sandbox:]]</strong> displays a link to the Sandbox wiki main page</li> </ul> <p>Wiki links are displayed in red if the page doesn't exist yet, eg: <a href="#" class="wiki-page new">Nonexistent page</a>.</p> <p>Links to other resources:</p> <ul> <li>Documents: <ul> <li><strong>document#17</strong> (link to document with id 17)</li> <li><strong>document:Greetings</strong> (link to the document with title "Greetings")</li> <li><strong>document:"Some document"</strong> (double quotes can be used when document title contains spaces)</li> <li><strong>sandbox:document:"Some document"</strong> (link to a document with title "Some document" in other project "sandbox")</li> </ul> </li> </ul> <ul> <li>Versions: <ul> <li><strong>version#3</strong> (link to version with id 3)</li> <li><strong>version:1.0.0</strong> (link to version named "1.0.0")</li> <li><strong>version:"1.0 beta 2"</strong></li> <li><strong>sandbox:version:1.0.0</strong> (link to version "1.0.0" in the project "sandbox")</li> </ul> </li> </ul> <ul> <li>Attachments: <ul> <li><strong>attachment:file.zip</strong> (link to the attachment of the current object named file.zip)</li> <li>For now, attachments of the current object can be referenced only (if you're on an issue, it's possible to reference attachments of this issue only)</li> </ul> </li> </ul> <ul> <li>Changesets: <ul> <li><strong>r758</strong> (link to a changeset)</li> <li><strong>commit:c6f4d0fd</strong> (link to a changeset with a non-numeric hash)</li> <li><strong>svn1|r758</strong> (link to a changeset of a specific repository, for projects with multiple repositories)</li> <li><strong>commit:hg|c6f4d0fd</strong> (link to a changeset with a non-numeric hash of a specific repository)</li> <li><strong>sandbox:r758</strong> (link to a changeset of another project)</li> <li><strong>sandbox:commit:c6f4d0fd</strong> (link to a changeset with a non-numeric hash of another project)</li> </ul> </li> </ul> <ul> <li>Repository files: <ul> <li><strong>source:some/file</strong> (link to the file located at /some/file in the project's repository)</li> <li><strong>source:some/file@52</strong> (link to the file's revision 52)</li> <li><strong>source:some/file#L120</strong> (link to line 120 of the file)</li> <li><strong>source:some/file@52#L120</strong> (link to line 120 of the file's revision 52)</li> <li><strong>source:"some file@52#L120"</strong> (use double quotes when the URL contains spaces</li> <li><strong>export:some/file</strong> (force the download of the file)</li> <li><strong>source:svn1|some/file</strong> (link to a file of a specific repository, for projects with multiple repositories)</li> <li><strong>sandbox:source:some/file</strong> (link to the file located at /some/file in the repository of the project "sandbox")</li> <li><strong>sandbox:export:some/file</strong> (force the download of the file)</li> </ul> </li> </ul> <ul> <li>Forums: <ul> <li><strong>forum#1</strong> (link to forum with id 1</li> <li><strong>forum:Support</strong> (link to forum named Support)</li> <li><strong>forum:"Technical Support"</strong> (use double quotes if forum name contains spaces)</li> </ul> </li> </ul> <ul> <li>Forum messages: <ul> <li><strong>message#1218</strong> (link to message with id 1218)</li> </ul> </li> </ul> <ul> <li>Projects: <ul> <li><strong>project#3</strong> (link to project with id 3)</li> <li><strong>project:some-project</strong> (link to project with name or slug of "some-project")</li> <li><strong>project:"Some Project"</strong> (use double quotes for project name containing spaces)</li> </ul> </li> </ul> <ul> <li>News: <ul> <li><strong>news#2</strong> (link to news item with id 2)</li> <li><strong>news:Greetings</strong> (link to news item named "Greetings")</li> <li><strong>news:"First Release"</strong> (use double quotes if news item name contains spaces)</li> </ul> </li> </ul> <ul> <li>Users: <ul> <li><strong>user#2</strong> (link to user with id 2)</li> <li><strong>user:jsmith</strong> (Link to user with login jsmith)</li> <li><strong>@jsmith</strong> (Link to user with login jsmith)</li> </ul> </li> </ul> <p>Escaping:</p> <ul> <li>You can prevent Redmine links from being parsed by preceding them with an exclamation mark: !</li> </ul> <h3><a name="4" class="wiki-page"></a>External links</h3> <p>URLs (starting with: www, http, https, ftp, ftps, sftp and sftps) and email addresses are automatically turned into clickable links:</p> <pre> http://www.redmine.org, [email protected] </pre> <p>displays: <a class="external" href="http://www.redmine.org">http://www.redmine.org</a>, <a href="mailto:[email protected]" class="email">[email protected]</a></p> <p>If you want to display a specific text instead of the URL, you can use the standard markdown syntax:</p> <pre> [Redmine web site](http://www.redmine.org) </pre> <p>displays: <a href="http://www.redmine.org" class="external">Redmine web site</a></p> <h2><a name="5" class="wiki-page"></a>Text formatting</h2> <p>For things such as headlines, bold, tables, lists, Redmine supports Markdown syntax. See <a class="external" href="http://daringfireball.net/projects/markdown/syntax">http://daringfireball.net/projects/markdown/syntax</a> for information on using any of these features. A few samples are included below, but the engine is capable of much more of that.</p> <h3><a name="6" class="wiki-page"></a>Font style</h3> <pre> * **bold** * *Italic* * ***bold italic*** * _underline_ * ~~strike-through~~ </pre> <p>Display:</p> <ul> <li><strong>bold</strong></li> <li><em>italic</em></li> <li><em><strong>bold italic</strong></em></li> <li><u>underline</u></li> <li><del>strike-through</del></li> </ul> <h3><a name="7" class="wiki-page"></a>Inline images</h3> <ul> <li><strong>![](image_url)</strong> displays an image located at image_url (markdown syntax)</li> <li>If you have an image attached to your wiki page, it can be displayed inline using its filename: <strong>![](attached_image)</strong></li> <li>Images in your computer's clipboard can be pasted directly using Ctrl-v or Command-v (note that Internet Explorer is not supported).</li> <li>Image files can be dragged onto the text area in order to be uploaded and embedded.</li> </ul> <h3><a name="8" class="wiki-page"></a>Headings</h3> <pre> # Heading ## Subheading ### Subsubheading </pre> <p>Redmine assigns an anchor to each of those headings thus you can link to them with "#Heading", "#Subheading" and so forth.</p> <h3><a name="10" class="wiki-page"></a>Blockquotes</h3> <p>Start the paragraph with <strong>&gt;</strong></p> <pre> &gt; Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern. To go live, all you need to add is a database and a web server. </pre> <p>Display:</p> <blockquote> <p>Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern.<br />To go live, all you need to add is a database and a web server.</p> </blockquote> <h3><a name="11" class="wiki-page"></a>Table of content</h3> <pre> {{toc}} =&gt; left aligned toc {{&gt;toc}} =&gt; right aligned toc </pre> <h3><a name="14" class="wiki-page"></a>Horizontal Rule</h3> <pre> --- </pre> <h2><a name="12" class="wiki-page"></a>Macros</h2> <p>Redmine has the following builtin macros:</p> <p> <dl> <dt><code>hello_world</code></dt> <dd><p>Sample macro.</p></dd> <dt><code>macro_list</code></dt> <dd><p>Displays a list of all available macros, including description if available.</p></dd> <dt><code>child_pages</code></dt> <dd><p>Displays a list of child pages. With no argument, it displays the child pages of the current wiki page. Examples:</p> <pre><code>{{child_pages}} -- can be used from a wiki page only {{child_pages(depth=2)}} -- display 2 levels nesting only</code></pre></dd> <dt><code>include</code></dt> <dd><p>Include a wiki page. Example:</p> <pre><code>{{include(Foo)}}</code></pre> <p>or to include a page of a specific project wiki:</p> <pre><code>{{include(projectname:Foo)}}</code></pre></dd> <dt><code>collapse</code></dt> <dd><p>Inserts of collapsed block of text. Example:</p> <pre><code>{{collapse(View details...) This is a block of text that is collapsed by default. It can be expanded by clicking a link. }}</code></pre></dd> <dt><code>thumbnail</code></dt> <dd><p>Displays a clickable thumbnail of an attached image. Examples:</p> <pre>{{thumbnail(image.png)}} {{thumbnail(image.png, size=300, title=Thumbnail)}}</pre></dd> <dt><code>issue</code></dt> <dd><p>Inserts a link to an issue with flexible text. Examples:</p> <pre>{{issue(123)}} -- Issue #123: Enhance macro capabilities {{issue(123, project=true)}} -- Andromeda - Issue #123:Enhance macro capabilities {{issue(123, tracker=false)}} -- #123: Enhance macro capabilities {{issue(123, subject=false, project=true)}} -- Andromeda - Issue #123</pre></dd> </dl> </p> <h2><a name="13" class="wiki-page"></a>Code highlighting</h2> <p>Default code highlightment relies on <a href="http://rouge.jneen.net/" class="external">Rouge</a>, a syntax highlighting library written in pure Ruby. It supports many commonly used languages such as <strong>c</strong>, <strong>cpp</strong> (c++), <strong>csharp</strong> (c#, cs), <strong>css</strong>, <strong>diff</strong> (patch, udiff), <strong>go</strong> (golang), <strong>groovy</strong>, <strong>html</strong>, <strong>java</strong>, <strong>javascript</strong> (js), <strong>kotlin</strong>, <strong>objective_c</strong> (objc), <strong>perl</strong> (pl), <strong>php</strong>, <strong>python</strong> (py), <strong>r</strong>, <strong>ruby</strong> (rb), <strong>sass</strong>, <strong>scala</strong>, <strong>shell</strong> (bash, zsh, ksh, sh), <strong>sql</strong>, <strong>swift</strong>, <strong>xml</strong> and <strong>yaml</strong> (yml) languages, where the names inside parentheses are aliases. Please refer to <a href="https://www.redmine.org/projects/redmine/wiki/RedmineCodeHighlightingLanguages" class="external">https://www.redmine.org/projects/redmine/wiki/RedmineCodeHighlightingLanguages</a> for the full list of supported languages.</p> <p>You can highlight code at any place that supports wiki formatting using this syntax (note that the language name or alias is case-insensitive):</p> <pre> ``` ruby Place your code here. ``` </pre> <p>Example:</p> <pre><code class="ruby syntaxhl"><span class="c1"># The Greeter class</span> <span class="k">class</span> <span class="nc">Greeter</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span> <span class="vi">@name</span> <span class="o">=</span> <span class="nb">name</span><span class="p">.</span><span class="nf">capitalize</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">salute</span> <span class="nb">puts</span> <span class="s2">"Hello </span><span class="si">#{</span><span class="vi">@name</span><span class="si">}</span><span class="s2">!"</span> <span class="k">end</span> <span class="k">end</span> </code></pre> </body> </html>
{ "pile_set_name": "Github" }
/* * Copyright (C) 2015 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. */ //! \file #ifndef TNT_FILAMENT_DRIVER_PIXEL_BUFFERDESCRIPTOR_H #define TNT_FILAMENT_DRIVER_PIXEL_BUFFERDESCRIPTOR_H #include <backend/BufferDescriptor.h> #include <backend/DriverEnums.h> #include <utils/compiler.h> #include <assert.h> #include <stddef.h> #include <stdint.h> namespace filament { namespace backend { /** * A descriptor to an image in main memory, typically used to transfer image data from the CPU * to the GPU. * * A PixelBufferDescriptor owns the memory buffer it references, therefore PixelBufferDescriptor * cannot be copied, but can be moved. * * PixelBufferDescriptor releases ownership of the memory-buffer when it's destroyed. */ class UTILS_PUBLIC PixelBufferDescriptor : public BufferDescriptor { public: using PixelDataFormat = backend::PixelDataFormat; using PixelDataType = backend::PixelDataType; PixelBufferDescriptor() = default; /** * Creates a new PixelBufferDescriptor referencing an image in main memory * * @param buffer Virtual address of the buffer containing the image * @param size Size in bytes of the buffer containing the image * @param format Format of the image pixels * @param type Type of the image pixels * @param alignment Alignment in bytes of pixel rows * @param left Left coordinate in pixels * @param top Top coordinate in pixels * @param stride Stride of a row in pixels * @param callback A callback used to release the CPU buffer * @param user An opaque user pointer passed to the callback function when it's called */ PixelBufferDescriptor(void const* buffer, size_t size, PixelDataFormat format, PixelDataType type, uint8_t alignment = 1, uint32_t left = 0, uint32_t top = 0, uint32_t stride = 0, Callback callback = nullptr, void* user = nullptr) noexcept : BufferDescriptor(buffer, size, callback, user), left(left), top(top), stride(stride), format(format), type(type), alignment(alignment) { } /** * Creates a new PixelBufferDescriptor referencing an image in main memory * * @param buffer Virtual address of the buffer containing the image * @param size Size in bytes of the buffer containing the image * @param format Format of the image pixels * @param type Type of the image pixels * @param callback A callback used to release the CPU buffer * @param user An opaque user pointer passed to the callback function when it's called */ PixelBufferDescriptor(void const* buffer, size_t size, PixelDataFormat format, PixelDataType type, Callback callback, void* user = nullptr) noexcept : BufferDescriptor(buffer, size, callback, user), stride(0), format(format), type(type), alignment(1) { } /** * Creates a new PixelBufferDescriptor referencing a compressed image in main memory * * @param buffer Virtual address of the buffer containing the image * @param size Size in bytes of the buffer containing the image * @param format Compressed format of the image * @param imageSize Compressed size of the image * @param callback A callback used to release the CPU buffer * @param user An opaque user pointer passed to the callback function when it's called */ PixelBufferDescriptor(void const* buffer, size_t size, backend::CompressedPixelDataType format, uint32_t imageSize, Callback callback, void* user = nullptr) noexcept : BufferDescriptor(buffer, size, callback, user), imageSize(imageSize), compressedFormat(format), type(PixelDataType::COMPRESSED), alignment(1) { } /** * Computes the size in bytes needed to fit an image of given dimensions and format * * @param format Format of the image pixels * @param type Type of the image pixels * @param stride Stride of a row in pixels * @param height Height of the image in rows * @param alignment Alignment in bytes of pixel rows * @return The buffer size needed to fit this image in bytes */ static constexpr size_t computeDataSize(PixelDataFormat format, PixelDataType type, size_t stride, size_t height, size_t alignment) noexcept { assert(alignment); if (type == PixelDataType::COMPRESSED) { return 0; } size_t n = 0; switch (format) { case PixelDataFormat::R: case PixelDataFormat::R_INTEGER: case PixelDataFormat::DEPTH_COMPONENT: case PixelDataFormat::ALPHA: n = 1; break; case PixelDataFormat::RG: case PixelDataFormat::RG_INTEGER: case PixelDataFormat::DEPTH_STENCIL: n = 2; break; case PixelDataFormat::RGB: case PixelDataFormat::RGB_INTEGER: n = 3; break; case PixelDataFormat::UNUSED: // shouldn't happen (used to be rgbm) case PixelDataFormat::RGBA: case PixelDataFormat::RGBA_INTEGER: n = 4; break; } size_t bpp = n; switch (type) { case PixelDataType::COMPRESSED: // Impossible -- to squash the IDE warnings case PixelDataType::UBYTE: case PixelDataType::BYTE: // nothing to do break; case PixelDataType::USHORT_565: case PixelDataType::USHORT: case PixelDataType::SHORT: case PixelDataType::HALF: bpp *= 2; break; case PixelDataType::UINT: case PixelDataType::INT: case PixelDataType::FLOAT: bpp *= 4; break; case PixelDataType::UINT_10F_11F_11F_REV: // Special case, format must be RGB and uses 4 bytes assert(format == PixelDataFormat::RGB); bpp = 4; break; case PixelDataType::UINT_2_10_10_10_REV: // Special case, format must be RGBA and uses 4 bytes assert(format == PixelDataFormat::RGBA); bpp = 4; break; } size_t bpr = bpp * stride; size_t bprAligned = (bpr + (alignment - 1)) & -alignment; return bprAligned * height; } //! left coordinate in pixels uint32_t left = 0; //! top coordinate in pixels uint32_t top = 0; union { struct { //! stride in pixels uint32_t stride; //! Pixel data format PixelDataFormat format; }; struct { //! compressed image size uint32_t imageSize; //! compressed image format backend::CompressedPixelDataType compressedFormat; }; }; //! pixel data type PixelDataType type : 4; //! row alignment in bytes uint8_t alignment : 4; }; } // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_PIXEL_BUFFERDESCRIPTOR_H
{ "pile_set_name": "Github" }
{ "code": 1, "msg": "上传成功", "data": { "url": [ "../images/logo.png", "../images/captcha.jpg" ] } }
{ "pile_set_name": "Github" }