text
stringlengths
2
100k
meta
dict
# Deployment script/program for DL Cluster For specific deployment procedure, please follow the instruction in [here](../../docs/deployment/Readme.md).
{ "pile_set_name": "Github" }
/* * Copyright (C) Research In Motion Limited 2010. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef SVGResources_h #define SVGResources_h #if ENABLE(SVG) #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> namespace WebCore { class Document; class RenderObject; class RenderSVGResourceClipper; class RenderSVGResourceContainer; class RenderSVGResourceFilter; class RenderSVGResourceMarker; class RenderSVGResourceMasker; class SVGRenderStyle; // Holds a set of resources associated with a RenderObject class SVGResources { WTF_MAKE_NONCOPYABLE(SVGResources); WTF_MAKE_FAST_ALLOCATED; public: SVGResources(); bool buildCachedResources(const RenderObject*, const SVGRenderStyle*); // Ordinary resources RenderSVGResourceClipper* clipper() const { return m_clipperFilterMaskerData ? m_clipperFilterMaskerData->clipper : 0; } #if ENABLE(FILTERS) RenderSVGResourceFilter* filter() const { return m_clipperFilterMaskerData ? m_clipperFilterMaskerData->filter : 0; } #endif RenderSVGResourceMarker* markerStart() const { return m_markerData ? m_markerData->markerStart : 0; } RenderSVGResourceMarker* markerMid() const { return m_markerData ? m_markerData->markerMid : 0; } RenderSVGResourceMarker* markerEnd() const { return m_markerData ? m_markerData->markerEnd : 0; } RenderSVGResourceMasker* masker() const { return m_clipperFilterMaskerData ? m_clipperFilterMaskerData->masker : 0; } // Paint servers RenderSVGResourceContainer* fill() const { return m_fillStrokeData ? m_fillStrokeData->fill : 0; } RenderSVGResourceContainer* stroke() const { return m_fillStrokeData ? m_fillStrokeData->stroke : 0; } // Chainable resources - linked through xlink:href RenderSVGResourceContainer* linkedResource() const { return m_linkedResource; } void buildSetOfResources(HashSet<RenderSVGResourceContainer*>&); // Methods operating on all cached resources void removeClientFromCache(RenderObject*, bool markForInvalidation = true) const; void resourceDestroyed(RenderSVGResourceContainer*); #ifndef NDEBUG void dump(const RenderObject*); #endif private: friend class SVGResourcesCycleSolver; // Only used by SVGResourcesCache cycle detection logic void resetClipper(); #if ENABLE(FILTERS) void resetFilter(); #endif void resetMarkerStart(); void resetMarkerMid(); void resetMarkerEnd(); void resetMasker(); void resetFill(); void resetStroke(); void resetLinkedResource(); private: bool setClipper(RenderSVGResourceClipper*); #if ENABLE(FILTERS) bool setFilter(RenderSVGResourceFilter*); #endif bool setMarkerStart(RenderSVGResourceMarker*); bool setMarkerMid(RenderSVGResourceMarker*); bool setMarkerEnd(RenderSVGResourceMarker*); bool setMasker(RenderSVGResourceMasker*); bool setFill(RenderSVGResourceContainer*); bool setStroke(RenderSVGResourceContainer*); bool setLinkedResource(RenderSVGResourceContainer*); // From SVG 1.1 2nd Edition // clipper: 'container elements' and 'graphics elements' // filter: 'container elements' and 'graphics elements' // masker: 'container elements' and 'graphics elements' // -> a, circle, defs, ellipse, glyph, g, image, line, marker, mask, missing-glyph, path, pattern, polygon, polyline, rect, svg, switch, symbol, text, use struct ClipperFilterMaskerData { ClipperFilterMaskerData() : clipper(0) #if ENABLE(FILTERS) , filter(0) #endif , masker(0) { } static PassOwnPtr<ClipperFilterMaskerData> create() { return adoptPtr(new ClipperFilterMaskerData); } RenderSVGResourceClipper* clipper; #if ENABLE(FILTERS) RenderSVGResourceFilter* filter; #endif RenderSVGResourceMasker* masker; }; // From SVG 1.1 2nd Edition // marker: line, path, polygon, polyline struct MarkerData { MarkerData() : markerStart(0) , markerMid(0) , markerEnd(0) { } static PassOwnPtr<MarkerData> create() { return adoptPtr(new MarkerData); } RenderSVGResourceMarker* markerStart; RenderSVGResourceMarker* markerMid; RenderSVGResourceMarker* markerEnd; }; // From SVG 1.1 2nd Edition // fill: 'shapes' and 'text content elements' // stroke: 'shapes' and 'text content elements' // -> altGlyph, circle, ellipse, line, path, polygon, polyline, rect, text, textPath, tref, tspan struct FillStrokeData { FillStrokeData() : fill(0) , stroke(0) { } static PassOwnPtr<FillStrokeData> create() { return adoptPtr(new FillStrokeData); } RenderSVGResourceContainer* fill; RenderSVGResourceContainer* stroke; }; OwnPtr<ClipperFilterMaskerData> m_clipperFilterMaskerData; OwnPtr<MarkerData> m_markerData; OwnPtr<FillStrokeData> m_fillStrokeData; RenderSVGResourceContainer* m_linkedResource; }; } #endif #endif
{ "pile_set_name": "Github" }
<?php /* * 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. * * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ namespace Doctrine\DBAL\Driver\PDOMySql; use Doctrine\DBAL\Connection; /** * PDO MySql driver. * * @since 2.0 */ class Driver implements \Doctrine\DBAL\Driver { /** * {@inheritdoc} */ public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) { $conn = new \Doctrine\DBAL\Driver\PDOConnection( $this->_constructPdoDsn($params), $username, $password, $driverOptions ); return $conn; } /** * Constructs the MySql PDO DSN. * * @param array $params * * @return string The DSN. */ private function _constructPdoDsn(array $params) { $dsn = 'mysql:'; if (isset($params['host']) && $params['host'] != '') { $dsn .= 'host=' . $params['host'] . ';'; } if (isset($params['port'])) { $dsn .= 'port=' . $params['port'] . ';'; } if (isset($params['dbname'])) { $dsn .= 'dbname=' . $params['dbname'] . ';'; } if (isset($params['unix_socket'])) { $dsn .= 'unix_socket=' . $params['unix_socket'] . ';'; } if (isset($params['charset'])) { $dsn .= 'charset=' . $params['charset'] . ';'; } return $dsn; } /** * {@inheritdoc} */ public function getDatabasePlatform() { return new \Doctrine\DBAL\Platforms\MySqlPlatform(); } /** * {@inheritdoc} */ public function getSchemaManager(\Doctrine\DBAL\Connection $conn) { return new \Doctrine\DBAL\Schema\MySqlSchemaManager($conn); } /** * {@inheritdoc} */ public function getName() { return 'pdo_mysql'; } /** * {@inheritdoc} */ public function getDatabase(\Doctrine\DBAL\Connection $conn) { $params = $conn->getParams(); if (isset($params['dbname'])) { return $params['dbname']; } return $conn->query('SELECT DATABASE()')->fetchColumn(); } }
{ "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. // = 快速搜索集成教程 :jbake-type: platform-tutorial :jbake-tags: tutorials :jbake-status: published :syntax: true :source-highlighter: pygments :toc: left :toc-title: :icons: font :experimental: :description: 快速搜索集成教程 - Apache NetBeans :keywords: Apache NetBeans Platform, Platform Tutorials, 快速搜索集成教程 本教程介绍如何编写在 NetBeans 快速搜索功能中集成新项目的模块。 (可选)要解决疑难问题,可以 link:http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=11179[ 下载完整的样例 ]并查看其源代码。 == [[快速搜索集成简介]] NetBeans IDE 6.5 中引入的快速搜索功能由 IDE 右上角的一个文本字段组成。在该字段中键入搜索字符串时,会出现一个下拉列表并显示匹配的项目。缺省情况下,这些项目来自在 IDE 中注册的操作名称以及 IDE 的 Java 帮助中的帮助主题。选择操作项目将调用该操作;选择帮助项目将在 JavaHelp 中打开该主题。 此外, link:http://bits.netbeans.org/dev/javadoc/org-netbeans-spi-quicksearch/overview-summary.html[快速搜索 API] 已被公开。您可以使用它将您自己的搜索项目集成到快速搜索功能中。您可以在 IDE 中使用该功能,也可以在 NetBeans 平台上将它作为应用程序的一部分使用。 在本教程,您将创建一个模块,用于将 link:http://netbeans.dzone.com[NetBeans Zone] 中的项目集成到快速搜索功能中: image::images/deployed-result.png[] == 创建模块项目 在本节中,我们将利用向导创建每个 NetBeans 模块所需的源代码结构。源代码结构包含位于特定位置的某些文件夹以及一组始终需要的文件。例如,每个 NetBeans 模块都需要一个 ``nbproject`` 文件夹和一个 ``layer.xml`` 文件,前者用于存放项目的 meta 数据,后者用于工具栏按钮和窗口等项的声明性注册。 [start=1] 1. 选择“文件”>“新建项目”(Ctrl-Shift-N)。在“类别”下选择“NetBeans 模块”。在“项目”下面,选择“模块”并单击“下一步”。 [start=2] 1. 在“名称和位置”面板的“项目名称”中键入 ``NetBeansZoneSearch`` 。将项目位置更改为计算机上的任意目录,例如 ``c:\mymodules`` 。将“独立模块”单选按钮保留为选中状态。此面板现在应如下所示: image::images/new-module-1.png[] 单击“下一步”。 [start=3] 1. 在“基本模块配置”面板中,键入 ``org.netbeans.modules.nbzone`` 作为代码名称基。在建议的模块显示名称中添加空格,以将其更改为 ``NetBeans Zone Search`` 。选中“生成 XML 层”复选框,并保留本地化绑定和 XML 层的位置不变,这样它们将存储在名称为 ``org/netbeans/modules/demo`` 的包中。此面板现在应如下所示: image::images/new-module-2.png[] [start=4] 1. 单击“完成”。 IDE 将创建 ``NetBeans Zone Search`` 项目。此项目包含所有源代码和项目 meta 数据,例如项目的 Ant 生成脚本。此项目将会在 IDE 中打开。您可以在“项目”窗口 (Ctrl-1) 中查看其逻辑结构,在“文件”窗口 (Ctrl-2) 中查看其文件结构。 == [[使用“快速搜索提供器”向导]] 在本节中,我们将通过向导来创建实现快速搜索功能集成所需的桩模块类和层条目。 [start=1] 1. 右键单击项目节点,然后选择“新建”>“其他”。在“新建文件”对话框中,选择“模块开发”>“快速搜索提供器”。 [start=2] 1. 在“快速搜索提供器”面板中,设置以下信息: * *提供器类名。*指定向导将生成的桩模块的类名。在该字段中键入 "NBZoneSearchProvider"。 * *包。*指定将在其中生成桩模块类的包。从下拉列表中选择 "org.netbeans.modules.nbzone"。 * *类别显示名称。*指定桩模块将创建的类别的显示名称。在该字段中键入 "NetBeans Zone"。 * *命令前缀。*指定在搜索桩模块将创建的类别时,用于缩小搜索范围的前缀。在该字段中键入 "nb"。 * *弹出式窗口中的位置。*指定新类别在快速搜索功能中的位置。保留值为 "0" 不变,这样类别将处于弹出式窗口第一个位置。 您现在应该看到下面的屏幕: image::images/quick-search-template.png[] [start=3] 1. 单击“完成”。 “项目”窗口现在应如下所示: image::images/projects-window-final.png[] 在 ``layer.xml`` 文件中,您应该能看到以下内容: [source,xml] ---- <filesystem> <folder name="QuickSearch"> <folder name="NetBeansZone"> <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.nbzone.Bundle"/> <attr name="command" stringvalue="nb"/> <attr name="position" intvalue="0"/> <file name="org-netbeans-modules-nbzone-NBZoneSearchProvider.instance"/> </folder> </folder> </filesystem> ---- == 集成外部 HTML DOM 解析器 在下一部分中,我们需要一个 HTML DOM 解析器来解析 NetBeans Zone。您可以选择任何合适的解析器。考虑到本教程的目的,我们将使用 link:http://sourceforge.net/project/showfiles.php?group_id=13153[JTidy]。 可以采用两种方法将外部 JAR 文件集成到模块中。第一种方法是将 JAR 放置在一个单独的“库包装器模块” 中,并在将两个模块集成到模块套件中之前让功能模块_依赖于_该库包装器模块。使用两个单独模块的好处在于,当新版本的外部 JAR 发行时,您只需要重新分发一个较小的模块(其中只包含外部 JAR),而不是还包含功能代码的大模块。第二种方法是将 JAR 添加到功能模块中,下面采用的就是这种方法。这种方法的好处在于,它在短期内比较便利,因为您只需要分发一个模块,而它的缺点在于,您会将外部库和功能代码混合在一起,而这不是一种严格的模块化方法。 [start=1] 1. 下载 link:http://sourceforge.net/project/showfiles.php?group_id=13153[JTidy] 并找到下载包中的 ``Tidy.jar`` 。 [start=2] 1. 在“文件”窗口中,创建如下所示的文件夹结构,将 ``Tidy.jar`` 放置在 ``release/modules/ext`` 文件夹中: image::images/tidyjar.png[] [start=3] 1. 在 ``project.xml`` 文件的结束部分,该文件位于 ``nbproject`` 文件夹,添加下面的粗体标记: [source,xml] ---- ... ... ... *<class-path-extension> <runtime-relative-path>ext/Tidy.jar</runtime-relative-path> <binary-origin>release/modules/ext/Tidy.jar</binary-origin> </class-path-extension>* ---- [start=4] 1. 在 ``project.properties`` 文件中,添加以下内容: [source,java] ---- cp.extra=release/modules/ext/Tidy.jar ---- 现在,外部 HTML DOM 解析器已经在您模块的类路径中。您可以使用 JAR 中的类,如下一部分所示。 == 实现快速搜索集成 接下来,我们将实现 API。API 的类如下所示: |=== |类 |描述 | link:http://bits.netbeans.org/dev/javadoc/org-netbeans-spi-quicksearch/org/netbeans/spi/quicksearch/SearchProvider.html[SearchProvider] |快速搜索 API 的主接口。实现此接口,为您的快速搜索提供新的结果分组。 | link:http://bits.netbeans.org/dev/javadoc/org-netbeans-spi-quicksearch/org/netbeans/spi/quicksearch/SearchRequest.html[SearchRequest] |快速搜索请求的描述。 | link:http://bits.netbeans.org/dev/javadoc/org-netbeans-spi-quicksearch/org/netbeans/spi/quicksearch/SearchResponse.html[SearchResponse] |收集 SearchRequest 结果的响应对象。 |=== 下面,我们将设置所需模块的依赖关系,然后在我们自己的模块中实现它们。 [start=1] 1. 右键单击项目,选择“属性”,在“库”面板中设置以下 个依赖关系。 image::images/set-dependencies.png[] [start=2] 1. 打开生成的类。 [start=3] 1. 修改该类,如下所示: [source,java] ---- public class NBZoneSearchProvider implements link:http://bits.netbeans.org/dev/javadoc/org-netbeans-spi-quicksearch/org/netbeans/spi/quicksearch/SearchProvider.html[SearchProvider] { /** * Method is called by infrastructure when search operation is requested.* Implementors should evaluate given request and fill response object with * apropriate results * * @param request Search request object that contains search string * @param response Search response object that stores search results * Note that it's important to react to return value of * SearchResponse.addResult(...) method and stop computation if * false value is returned. */ @Override public void evaluate( link:http://bits.netbeans.org/dev/javadoc/org-netbeans-spi-quicksearch/org/netbeans/spi/quicksearch/SearchRequest.html[SearchRequest request], link:http://bits.netbeans.org/dev/javadoc/org-netbeans-spi-quicksearch/org/netbeans/spi/quicksearch/SearchResponse.html[SearchResponse response]) { try { *//The URL that we are providing a search for:* URL url = new URL("http://netbeans.dzone.com"); *//Stuff needed by Tidy:* Tidy tidy = new Tidy(); tidy.setXHTML(true); tidy.setTidyMark(false); tidy.setShowWarnings(false); tidy.setQuiet(true); *//Get the org.w3c.dom.Document from Tidy, //or use a different parser of your choice:* Document doc = tidy.parseDOM(url.openStream(), null); *//Get all "a" elements:* NodeList list = doc.getElementsByTagName("a"); *//Get the number of elements:* int length = list.getLength(); *//Loop through all the "a" elements:* for (int i = 0; i < length; i++) { String href = null; if (null != list.item(i).getAttributes().getNamedItem("href")) { *//Get the "href" attribute from the current "a" element:* href = list.item(i).getAttributes().getNamedItem("href").getNodeValue(); } *//Get the "title" attribute from the current "a" element:* if (null != list.item(i).getAttributes().getNamedItem("title")) { String title = list.item(i).getAttributes().getNamedItem("title").getNodeValue(); *//If the title matches the requested text:* if (title.toLowerCase().indexOf( link:http://bits.netbeans.org/dev/javadoc/org-netbeans-spi-quicksearch/org/netbeans/spi/quicksearch/SearchRequest.html[request.getText().toLowerCase()]) != -1) { *//Add the runnable and the title to the response //and return if nothing is added:* if (! link:http://bits.netbeans.org/dev/javadoc/org-netbeans-spi-quicksearch/org/netbeans/spi/quicksearch/SearchResponse.html[response.addResult(new OpenFoundArticle(href), title)]) { return; } } } } } catch (IOException ex) { Exceptions.printStackTrace(ex); } } private static class OpenFoundArticle implements Runnable { private String article; public OpenFoundArticle(String article) { this.article = article; } public void run() { try { URL url = new URL("http://netbeans.dzone.com" + article); StatusDisplayer.getDefault().setStatusText(url.toString()); URLDisplayer.getDefault().showURL(url); } catch (MalformedURLException ex) { Logger.getLogger(NBZoneSearchProvider.class.getName()).log(Level.SEVERE, null, ex); } } } } ---- [start=4] 1. 确保声明了以下导入数据: [source,java] ---- import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.logging.Level; import java.util.logging.Logger; import org.netbeans.spi.quicksearch.SearchProvider; import org.netbeans.spi.quicksearch.SearchRequest; import org.netbeans.spi.quicksearch.SearchResponse; import org.openide.awt.HtmlBrowser.URLDisplayer; import org.openide.awt.StatusDisplayer; import org.openide.util.Exceptions; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.w3c.tidy.Tidy; ---- == 安装并试用功能 现在,安装模块并使用快速搜索功能集成。IDE 使用 Ant 生成脚本来生成和安装模块。此生成脚本是在创建项目时创建的。 [start=1] 1. 在“项目”窗口中,右键单击项目并选择“运行”。 此时将启动一个新的 IDE 实例,并安装快速搜索集成模块。 [start=2] 1. 在快速搜索功能中键入一个字符串,如果字符串匹配 NetBeans Zone 中的某个标题,则 NetBeans Zone 中的该项目将包括在结果中: image::images/deployed-result.png[] 如果您键入在 ``layer.xml`` 中定义的命令前缀,并紧跟一个空格,则只搜索相关的类别: image::images/command.png[] [start=3] 1. 单击某个项目,如果您在 IDE 中设置了浏览器,则会打开该浏览器并显示所选的文章。 == [[在 NetBeans 平台上使用快速搜索功能]] 上一部分假定您为现有应用程序创建了一个模块。如果您要在 NetBeans 平台上创建自己的应用程序,而不是创建模块,请阅读下面两个主题。 === 在 NetBeans 平台上启用快速搜索功能 虽然 NetBeans IDE 随带了对快速搜索功能的支持,但 NetBeans 平台却并非如此。缺省情况下,快速搜索功能是隐藏的。根据下面的步骤启用该功能。 [start=1] 1. 将以下标记添加到 ``layer.xml`` 文件中: [source,xml] ---- <folder name="Toolbars"> <folder name="QuickSearch"> <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.nbzone.Bundle"/> <file name="org-netbeans-modules-quicksearch-QuickSearchAction.shadow"> <attr name="originalFile" stringvalue="Actions/Edit/org-netbeans-modules-quicksearch-QuickSearchAction.instance"/> </file> </folder> </folder> ---- [start=2] 1. 将此键/值对添加到 ``Bundle.properties`` 文件 中: [source,java] ---- Toolbars/QuickSearch=Quick Search ---- [start=3] 1. 运行 NetBeans 平台应用程序,您应该能看到快速搜索功能现已可用: image::images/netbeans-platform-qsearch.png[] === 在 NetBeans 平台上启用缺省 Web 搜索提供器 缺省 Web 搜索提供器实现可以用在 NetBeans 源代码中。该提供器将在 Google 中搜索与搜索字符串匹配的文本。在 IDE 中,它的作用是在 ``netbeans.org`` 和相关站点中搜索与 IDE 相关的在线文档。 *注意:*遗憾的是,IDE 中禁用了 Web 搜索提供器,因为在多次使用之后,Google 会抱怨自动搜索违背了其使用条款,并拒绝继续提供服务。 如果您接受上述限制,您可以标记此 Web 搜索提供器并在您的 NetBeans 平台应用程序中用它。 [start=1] 1. 如前所述,确保已经启用快速搜索功能。 [start=2] 1. 将以下标记添加到 ``layer.xml`` 文件中: [source,xml] ---- <folder name="Guardian"> <file name="org-netbeans-modules-quicksearch-web-WebQuickSearchProviderImpl.instance"/> </folder> ---- [start=3] 1. 在应用程序的 " ``branding`` " 文件夹中,创建如下所示的文件夹分层结构以及 ``Bundle.properties`` 文件: image::images/brand-provider.png[] 在 IDE 中,上述属性是硬编码在代码中的,但是对于 NetBeans 平台,它们没有自己的定义,因此需要像上面那样标记这些属性: [source,java] ---- quicksearch.web.site=netbeans.org quicksearch.web.url_patterns=.*netbeans\.org/kb.*,\ /.*wiki\.netbeans\.org/.*faq.*,.*wiki\.netbeans\.org/.*howto.*,\ .*platform\.netbeans\.org/tutorials.* ---- [start=4] 1. 运行 NetBeans 平台应用程序,您应该能看到 Web 快速搜索功能现已可用: image::images/clare-wigfall.png[] == 创建可共享的模块二进制文件 该模块现已完成,您可以将其交给其他用户使用了。为此,您需要创建一个 "NBM"(NetBeans 模块)二进制文件并分发它。 [start=1] 1. 在“项目”窗口中,右键单击“ ``NetBeans Zone 搜索`` ”项目,然后选择“创建 NBM”。 此时将创建 NBM 文件,您可以在“文件”窗口 (Ctrl-2) 中查看它: image::images/shareable-binary.png[] [start=2] 1. 例如,通过 link:http://plugins.netbeans.org/PluginPortal/[NetBeans 插件门户]向其他人提供该文件。接收者应使用插件管理器(“工具”>“插件”)来安装它。 link:http://netbeans.apache.org/community/mailing-lists.html[请将您的意见和建议发送给我们] == 后续步骤 有关创建和开发 NetBeans 模块的详细信息,请参见以下资源: * link:https://netbeans.apache.org/platform/index.html[NetBeans 平台主页] * link:http://bits.netbeans.org/dev/javadoc/index.html[NetBeans API 列表(当前开发版本)] * link:https://netbeans.apache.org/kb/docs/platform_zh_CN.html[其他相关教程]
{ "pile_set_name": "Github" }
// // AppDelegate.swift // CombineSchedulers // // Created by Point-Free on 6/2/20. // Copyright © 2020 Point-Free. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Called when a new scene session is being created. // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { // Called when the user discards a scene session. // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } }
{ "pile_set_name": "Github" }
# Copyright 2016 Intel # # 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. import re from six.moves.urllib.parse import urlparse import syntribos.signal def https_check(test): """Checks if the returned response consists of non-secure endpoint URIs :returns: syntribos.signal.SynSignal """ check_name = "HTTPS_CHECK" if not test.init_signals.ran_check(check_name): response_text = test.init_resp.text else: response_text = test.test_resp.text target = test.init_req.url domain = urlparse(target).hostname regex = r"\bhttp://{0}".format(domain) if re.search(regex, response_text): text = "Non https endpoint URIs present in the response text" slug = "HTTP_LINKS_PRESENT" return syntribos.signal.SynSignal(text=text, slug=slug, strength=1.0, check_name=check_name)
{ "pile_set_name": "Github" }
# -*- coding: utf-8 -*- __license__ = 'GPL v3' __copyright__ = '2009, John Schember <[email protected]>' __docformat__ = 'restructuredtext en' import os class EreaderError(Exception): pass def image_name(name, taken_names=()): name = os.path.basename(name) if len(name) > 32: cut = len(name) - 32 names = name[:10] namee = name[10+cut:] name = '%s%s.png' % (names, namee) i = 0 base_name, ext = os.path.splitext(name) while name in taken_names: i += 1 name = '%s%s%s' % (base_name, i, ext) return name.ljust(32, '\x00')[:32]
{ "pile_set_name": "Github" }
/* * MIT License * * Copyright (c) 2017 EPAM Systems * * 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. */ package com.epam.catgenome.util.sort; import htsjdk.tribble.readers.AsciiLineReader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.io.PrintWriter; public class VCFSorter extends AbstractFeatureSorter { private static final Logger LOG = LoggerFactory.getLogger(VCFSorter.class); public VCFSorter(File inputFile, File outputFile, File tmpDir) { super(inputFile, outputFile, tmpDir); } @Override Parser getParser() { return new Parser(0, 1); } @Override String writeHeader(AsciiLineReader reader, PrintWriter writer) { try { String nextLine = reader.readLine(); while (nextLine.startsWith("#")) { writer.println(nextLine); nextLine = reader.readLine(); } return nextLine; } catch (IOException e) { LOG.error("Error writing header", e); return null; } } }
{ "pile_set_name": "Github" }
<?php namespace Test\Classes; use Test\Analyzer; include_once dirname(__DIR__, 2).'/Test/Analyzer.php'; class Finalclass extends Analyzer { /* 1 methods */ public function testClasses_Finalclass01() { $this->generic_test('Classes_Finalclass.01'); } } ?>
{ "pile_set_name": "Github" }
// Copyright 2004 The Trustees of Indiana University. // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Authors: Douglas Gregor // Andrew Lumsdaine #ifndef BOOST_GRAPH_PARALLEL_BFS_HPP #define BOOST_GRAPH_PARALLEL_BFS_HPP #ifndef BOOST_GRAPH_USE_MPI #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included" #endif #include <boost/graph/breadth_first_search.hpp> #include <boost/graph/overloading.hpp> #include <boost/graph/distributed/concepts.hpp> #include <boost/graph/distributed/detail/filtered_queue.hpp> #include <boost/graph/distributed/queue.hpp> #include <boost/dynamic_bitset.hpp> #include <boost/pending/queue.hpp> #include <boost/graph/parallel/properties.hpp> #include <boost/graph/parallel/container_traits.hpp> namespace boost { namespace detail { /** @brief A unary predicate that decides when to push into a * breadth-first search queue. * * This predicate stores a color map that is used to determine * when to push. If it is provided with a key for which the color * is white, it darkens the color to gray and returns true (so * that the value will be pushed appropriately); if the color is * not white, it returns false so that the vertex will be * ignored. */ template<typename ColorMap> struct darken_and_push { typedef typename property_traits<ColorMap>::key_type argument_type; typedef bool result_type; explicit darken_and_push(const ColorMap& color) : color(color) { } bool operator()(const argument_type& value) const { typedef color_traits<typename property_traits<ColorMap>::value_type> Color; if (get(color, value) == Color::white()) { put(color, value, Color::gray()); return true; } else { return false; } } ColorMap color; }; template<typename IndexMap> struct has_not_been_seen { typedef bool result_type; has_not_been_seen() { } has_not_been_seen(std::size_t n, IndexMap index_map) : seen(n), index_map(index_map) {} template<typename Key> result_type operator()(Key key) { bool result = seen[get(index_map, key)]; seen[get(index_map, key)] = true; return !result; } void swap(has_not_been_seen& other) { using std::swap; swap(seen, other.seen); swap(index_map, other.index_map); } private: dynamic_bitset<> seen; IndexMap index_map; }; template<typename IndexMap> inline void swap(has_not_been_seen<IndexMap>& x, has_not_been_seen<IndexMap>& y) { x.swap(y); } template <class DistributedGraph, class ColorMap, class BFSVisitor, class BufferRef, class VertexIndexMap> inline void parallel_bfs_helper (DistributedGraph& g, typename graph_traits<DistributedGraph>::vertex_descriptor s, ColorMap color, BFSVisitor vis, BufferRef Q, VertexIndexMap) { set_property_map_role(vertex_color, color); color.set_consistency_model(0); breadth_first_search(g, s, Q.ref, vis, color); } template <class DistributedGraph, class ColorMap, class BFSVisitor, class VertexIndexMap> void parallel_bfs_helper (DistributedGraph& g, typename graph_traits<DistributedGraph>::vertex_descriptor s, ColorMap color, BFSVisitor vis, boost::param_not_found, VertexIndexMap vertex_index) { using boost::graph::parallel::process_group; typedef graph_traits<DistributedGraph> Traits; typedef typename Traits::vertex_descriptor Vertex; typedef typename boost::graph::parallel::process_group_type<DistributedGraph>::type process_group_type; set_property_map_role(vertex_color, color); color.set_consistency_model(0); // Buffer default typedef typename property_map<DistributedGraph, vertex_owner_t> ::const_type vertex_owner_map; typedef boost::graph::distributed::distributed_queue< process_group_type, vertex_owner_map, queue<Vertex>, detail::darken_and_push<ColorMap> > queue_t; queue_t Q(process_group(g), get(vertex_owner, g), detail::darken_and_push<ColorMap>(color)); breadth_first_search(g, s, Q, vis, color); } template <class DistributedGraph, class ColorMap, class BFSVisitor, class P, class T, class R> void bfs_helper (DistributedGraph& g, typename graph_traits<DistributedGraph>::vertex_descriptor s, ColorMap color, BFSVisitor vis, const bgl_named_params<P, T, R>& params, boost::mpl::true_) { parallel_bfs_helper (g, s, color, vis, get_param(params, buffer_param_t()), choose_const_pmap(get_param(params, vertex_index), g, vertex_index)); } } } #endif // BOOST_GRAPH_PARALLEL_BFS_HPP
{ "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 var b = (e = [B : { struct S { let a { class A { class case ,
{ "pile_set_name": "Github" }
// I use the following config with direnv and set the following values: // export PKR_VAR_bastion_host="" // export PKR_VAR_bastion_user="" // export PKR_VAR_datacenter_name="" // export PKR_VAR_esxi_host="" // export PKR_VAR_esxi_password="" // export PKR_VAR_esxi_user="" // export PKR_VAR_vcenter_endpoint="" // export PKR_VAR_vcenter_password="" // export PKR_VAR_vcenter_user="" // export PKR_VAR_vm_ip="" // export PKR_VAR_gateway_ip="" // ... variable "vcenter_endpoint" { type = string } variable "vcenter_user" { type = string } variable "vcenter_password" { type = string } variable "esxi_host" { type = string } variable "esxi_password" { type = string } variable "esxi_user" { type = string } variable "datacenter_name" { type = string } variable "vm_ip" { type = string } variable "gateway_ip" { type = string } variable "datastore" { default = "datastore1" } variable "remote_private_key_file_path" { type = string } source "vsphere-iso" "base-ubuntu-amd64" { vcenter_server = var.vcenter_endpoint username = var.vcenter_user password = var.vcenter_password host = var.esxi_host insecure_connection = true datacenter = var.datacenter_name datastore = "datastore1" ssh_password = "vagrant" ssh_username = "vagrant" CPUs = 1 RAM = 512 * 2 RAM_reserve_all = true disk_controller_type = "pvscsi" floppy_files = [ "etc/http/preseed_hardcoded_ip.cfg" ] guest_os_type = "ubuntu64Guest" network_adapters { network = "VM Network" network_card = "vmxnet3" } storage { disk_size = 32768 disk_thin_provisioned = true } boot_command = [ "<enter><wait><f6><wait><esc><wait>", "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>", "<bs><bs><bs>", "/install/vmlinuz", " initrd=/install/initrd.gz", " priority=critical", " locale=en_US", " file=/media/preseed_hardcoded_ip.cfg", " netcfg/get_ipaddress=${var.vm_ip}", " netcfg/get_gateway=${var.gateway_ip}", "<enter>" ] } source "vsphere-iso" "base-alpine-amd64" { vcenter_server = var.vcenter_endpoint username = var.vcenter_user password = var.vcenter_password host = var.esxi_host insecure_connection = true datacenter = var.datacenter_name datastore = "datastore1" ssh_username = "root" ssh_password = var.alpine_password CPUs = 1 RAM = 512 * 2 RAM_reserve_all = true guest_os_type = "otherLinux64Guest" floppy_files = local.floppy_files_alpine_vsphere network_adapters { network = "VM Network" network_card = "vmxnet3" } storage { disk_size = 32768 disk_thin_provisioned = true } }
{ "pile_set_name": "Github" }
// // NuoRenderer.h // ModelViewer // // Created by middleware on 11/8/16. // Copyright © 2016 middleware. All rights reserved. // #import <Foundation/Foundation.h> #import <Metal/Metal.h> #import "NuoRenderPassTarget.h" @class NuoRenderPassEncoder; @class NuoCommandBuffer; @interface NuoRenderPass : NSObject @property (nonatomic, weak) id<MTLCommandQueue> commandQueue; @property (nonatomic, strong) NuoRenderPassTarget* renderTarget; - (void)setDrawableSize:(CGSize)drawableSize; - (void)setSampleCount:(NSUInteger)sampleCount; /** * draw calls that target to their own target (e.g. shadow map texture) */ - (void)predrawWithCommandBuffer:(NuoCommandBuffer*)commandBuffer; /** * draw calls that target to the *_renderTarget* */ - (void)drawWithCommandBuffer:(NuoCommandBuffer*)commandBuffer; - (BOOL)isPipelinePass; - (NuoRenderPassEncoder*)retainDefaultEncoder:(NuoCommandBuffer*)commandBuffer; - (void)releaseDefaultEncoder; @end
{ "pile_set_name": "Github" }
bundle = <<END require 'minigl' require 'fileutils' require 'rbconfig' include MiniGL END file_names = %w(global bomb elements enemies form items movie options player section stage stage_menu world menu game) file_names.each do |name| File.open("#{name}.rb") do |f| c = f.read c.gsub!(/^require(_relative)? '[a-z0-9_]+'\n/, '') c.gsub!(/^include [A-Za-z0-9_]+\n/, '') c.gsub!(/^\s*#.*\n/, '') c.gsub!(/ #[^"\n]+$/, '') bundle += c + "\n" puts "Processed #{name}" end end bundle.gsub!("\n\n", "\n") bundle.gsub!("\n\n", "\n") File.open('sb.rb', 'w+') do |f| f.write bundle end
{ "pile_set_name": "Github" }
/* iCheck plugin Line skin, yellow ----------------------------------- */ .icheckbox_line-yellow, .iradio_line-yellow { position: relative; display: block; margin: 0; padding: 5px 15px 5px 38px; font-size: 13px; line-height: 17px; color: #fff; background: #FFC414; border: none; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; cursor: pointer; } .icheckbox_line-yellow .icheck_line-icon, .iradio_line-yellow .icheck_line-icon { position: absolute; top: 50%; left: 13px; width: 13px; height: 11px; margin: -5px 0 0 0; padding: 0; overflow: hidden; background: url(line.png) no-repeat; border: none; } .icheckbox_line-yellow.hover, .icheckbox_line-yellow.checked.hover, .iradio_line-yellow.hover { background: #FFD34F; } .icheckbox_line-yellow.checked, .iradio_line-yellow.checked { background: #FFC414; } .icheckbox_line-yellow.checked .icheck_line-icon, .iradio_line-yellow.checked .icheck_line-icon { background-position: -15px 0; } .icheckbox_line-yellow.disabled, .iradio_line-yellow.disabled { background: #FFE495; cursor: default; } .icheckbox_line-yellow.disabled .icheck_line-icon, .iradio_line-yellow.disabled .icheck_line-icon { background-position: -30px 0; } .icheckbox_line-yellow.checked.disabled, .iradio_line-yellow.checked.disabled { background: #FFE495; } .icheckbox_line-yellow.checked.disabled .icheck_line-icon, .iradio_line-yellow.checked.disabled .icheck_line-icon { background-position: -45px 0; } /* HiDPI support */ @media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi), (min-resolution: 1.25dppx) { .icheckbox_line-yellow .icheck_line-icon, .iradio_line-yellow .icheck_line-icon { background-image: url([email protected]); -webkit-background-size: 60px 13px; background-size: 60px 13px; } }
{ "pile_set_name": "Github" }
package ecs //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the License. //You may obtain a copy of the License at // //http://www.apache.org/licenses/LICENSE-2.0 // //Unless required by applicable law or agreed to in writing, software //distributed under the License is distributed on an "AS IS" BASIS, //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //See the License for the specific language governing permissions and //limitations under the License. // // Code generated by Alibaba Cloud SDK Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" ) // ModifyUserBusinessBehavior invokes the ecs.ModifyUserBusinessBehavior API synchronously // api document: https://help.aliyun.com/api/ecs/modifyuserbusinessbehavior.html func (client *Client) ModifyUserBusinessBehavior(request *ModifyUserBusinessBehaviorRequest) (response *ModifyUserBusinessBehaviorResponse, err error) { response = CreateModifyUserBusinessBehaviorResponse() err = client.DoAction(request, response) return } // ModifyUserBusinessBehaviorWithChan invokes the ecs.ModifyUserBusinessBehavior API asynchronously // api document: https://help.aliyun.com/api/ecs/modifyuserbusinessbehavior.html // asynchronous document: https://help.aliyun.com/document_detail/66220.html func (client *Client) ModifyUserBusinessBehaviorWithChan(request *ModifyUserBusinessBehaviorRequest) (<-chan *ModifyUserBusinessBehaviorResponse, <-chan error) { responseChan := make(chan *ModifyUserBusinessBehaviorResponse, 1) errChan := make(chan error, 1) err := client.AddAsyncTask(func() { defer close(responseChan) defer close(errChan) response, err := client.ModifyUserBusinessBehavior(request) if err != nil { errChan <- err } else { responseChan <- response } }) if err != nil { errChan <- err close(responseChan) close(errChan) } return responseChan, errChan } // ModifyUserBusinessBehaviorWithCallback invokes the ecs.ModifyUserBusinessBehavior API asynchronously // api document: https://help.aliyun.com/api/ecs/modifyuserbusinessbehavior.html // asynchronous document: https://help.aliyun.com/document_detail/66220.html func (client *Client) ModifyUserBusinessBehaviorWithCallback(request *ModifyUserBusinessBehaviorRequest, callback func(response *ModifyUserBusinessBehaviorResponse, err error)) <-chan int { result := make(chan int, 1) err := client.AddAsyncTask(func() { var response *ModifyUserBusinessBehaviorResponse var err error defer close(result) response, err = client.ModifyUserBusinessBehavior(request) callback(response, err) result <- 1 }) if err != nil { defer close(result) callback(nil, err) result <- 0 } return result } // ModifyUserBusinessBehaviorRequest is the request struct for api ModifyUserBusinessBehavior type ModifyUserBusinessBehaviorRequest struct { *requests.RpcRequest ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"` StatusValue string `position:"Query" name:"statusValue"` ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"` OwnerAccount string `position:"Query" name:"OwnerAccount"` OwnerId requests.Integer `position:"Query" name:"OwnerId"` StatusKey string `position:"Query" name:"statusKey"` } // ModifyUserBusinessBehaviorResponse is the response struct for api ModifyUserBusinessBehavior type ModifyUserBusinessBehaviorResponse struct { *responses.BaseResponse RequestId string `json:"RequestId" xml:"RequestId"` } // CreateModifyUserBusinessBehaviorRequest creates a request to invoke ModifyUserBusinessBehavior API func CreateModifyUserBusinessBehaviorRequest() (request *ModifyUserBusinessBehaviorRequest) { request = &ModifyUserBusinessBehaviorRequest{ RpcRequest: &requests.RpcRequest{}, } request.InitWithApiInfo("Ecs", "2014-05-26", "ModifyUserBusinessBehavior", "ecs", "openAPI") request.Method = requests.POST return } // CreateModifyUserBusinessBehaviorResponse creates a response to parse from ModifyUserBusinessBehavior response func CreateModifyUserBusinessBehaviorResponse() (response *ModifyUserBusinessBehaviorResponse) { response = &ModifyUserBusinessBehaviorResponse{ BaseResponse: &responses.BaseResponse{}, } return }
{ "pile_set_name": "Github" }
{ "name": "GreenPay", "version": "1.0.3", "summary": "GreenPay allows a Website, iOS and Android applications to process card payments", "description": "GreenPay allows any Website, iOS or Android applications to process card payments. Also, GreenPay allow the merchant to tokenize cards in a secure way and also make payments with these cards.", "homepage": "https://www.greenpay.me/", "license": { "type": "Copyright", "text": " Copyright 2019\n Permission is granted to clients of GreenPay\n" }, "authors": "GreenPay", "platforms": { "ios": "9.3" }, "source": { "git": "https://gitlab.com/gp-sdks/greenpay-ios-sdk-framework-releases.git", "tag": "1.0.3" }, "vendored_frameworks": "GreenpaySDK.xcframework", "swift_versions": "5.0", "dependencies": { "CryptoSwift": [ "~> 1.1.3" ], "SwiftyRSA": [ "~> 1.5.0" ], "PromiseKit": [ "~> 6.10.0" ] }, "swift_version": "5.0" }
{ "pile_set_name": "Github" }
# -*- coding: utf-8 -*- from xml.etree.ElementTree import parse from lazagne.config.module_info import ModuleInfo from lazagne.config.constant import * import os class ApacheDirectoryStudio(ModuleInfo): def __init__(self): ModuleInfo.__init__(self, 'apachedirectorystudio', 'sysadmin') # Interesting XML attributes in ADS connection configuration self.attr_to_extract = ["host", "port", "bindPrincipal", "bindPassword", "authMethod"] def extract_connections_credentials(self): """ Extract all connection's credentials. :return: List of dict in which one dict contains all information for a connection. """ repos_creds = [] connection_file_location = os.path.join( constant.profile["USERPROFILE"], u'.ApacheDirectoryStudio\\.metadata\\.plugins\\org.apache.directory.studio.connection.core\\connections.xml' ) if os.path.isfile(connection_file_location): try: connections = parse(connection_file_location).getroot() connection_nodes = connections.findall(".//connection") for connection_node in connection_nodes: creds = {} for connection_attr_name in connection_node.attrib: if connection_attr_name in self.attr_to_extract: creds[connection_attr_name] = connection_node.attrib[connection_attr_name].strip() if creds: repos_creds.append(creds) except Exception as e: self.error(u"Cannot retrieve connections credentials '%s'" % e) return repos_creds def run(self): """ Main function """ # Extract all available connections credentials repos_creds = self.extract_connections_credentials() # Parse and process the list of connections credentials pwd_found = [] for creds in repos_creds: pwd_found.append({ "Host" : creds["host"], "Port" : creds["port"], "Login" : creds["bindPrincipal"], "Password" : creds["bindPassword"], "AuthenticationMethod" : creds["authMethod"] }) return pwd_found
{ "pile_set_name": "Github" }
/****************************************************************************** * _ _____ __________ * * | | / / _ | / __/_ __/ Visibility * * | |/ / __ |_\ \ / / Across * * |___/_/ |_/___/ /_/ Space and Time * * * * This file is part of VAST. It is subject to the license terms in the * * LICENSE file found in the top-level directory of this distribution and at * * http://vast.io/license. No part of VAST, including this file, may be * * copied, modified, propagated, or distributed except according to the terms * * contained in the LICENSE file. * ******************************************************************************/ #pragma once #include <chrono> #include <string> #include "vast/concept/printable/core.hpp" #include "vast/concept/printable/numeric/integral.hpp" #include "vast/concept/printable/numeric/real.hpp" #include "vast/time.hpp" namespace vast { namespace policy { struct adaptive {}; struct fixed {}; } // namespace policy template <class Rep, class Period, class Policy = policy::adaptive> struct duration_printer : printer<duration_printer<Rep, Period, Policy>> { using attribute = std::chrono::duration<Rep, Period>; template <class To, class R, class P> static auto is_at_least(std::chrono::duration<R, P> d) { return std::chrono::duration_cast<To>(std::chrono::abs(d)) >= To{1}; } template <class To, class R, class P> static auto count(std::chrono::duration<R, P> d) { using fractional = std::chrono::duration<double, typename To::period>; return std::chrono::duration_cast<fractional>(d).count(); } template <class R, class P> static auto units(std::chrono::duration<R, P>) { return "not implemented"; } #define UNIT_SUFFIX(type, suffix) \ template <class R> \ static auto units(std::chrono::duration<R, type>) { \ return suffix; \ } UNIT_SUFFIX(std::atto, "as") UNIT_SUFFIX(std::femto, "fs") UNIT_SUFFIX(std::pico, "ps") UNIT_SUFFIX(std::nano, "ns") UNIT_SUFFIX(std::micro, "us") UNIT_SUFFIX(std::milli, "ms") UNIT_SUFFIX(std::centi, "cs") UNIT_SUFFIX(std::deci, "ds") UNIT_SUFFIX(std::ratio<1>, "s") UNIT_SUFFIX(std::deca, "das") UNIT_SUFFIX(std::hecto, "hs") UNIT_SUFFIX(std::kilo, "ks") UNIT_SUFFIX(std::mega, "Ms") UNIT_SUFFIX(std::giga, "Gs") UNIT_SUFFIX(std::tera, "Ts") UNIT_SUFFIX(std::peta, "Ps") UNIT_SUFFIX(std::exa, "Es") UNIT_SUFFIX(std::ratio<60>, "min") UNIT_SUFFIX(std::ratio<3600>, "h") #undef UNIT_SUFFIX template <class Iterator> bool print(Iterator& out, std::chrono::duration<Rep, Period> d) const { if constexpr (std::is_same_v<Policy, policy::fixed>) { auto p = make_printer<Rep>{} << units(d); return p(out, d.count()); } else if constexpr (std::is_same_v<Policy, policy::adaptive>) { using namespace std::chrono; auto num = printers::real2; if (is_at_least<days>(d)) return (num << 'd')(out, count<days>(d)); if (is_at_least<hours>(d)) return (num << 'h')(out, count<hours>(d)); if (is_at_least<minutes>(d)) return (num << 'm')(out, count<minutes>(d)); if (is_at_least<seconds>(d)) return (num << 's')(out, count<seconds>(d)); if (is_at_least<milliseconds>(d)) return (num << "ms")(out, count<milliseconds>(d)); if (is_at_least<microseconds>(d)) return (num << "us")(out, count<microseconds>(d)); return (num << "ns")(out, count<nanoseconds>(d)); } } }; namespace { struct year_month_day { unsigned short year; unsigned char month; unsigned char day; }; // Logic extracted from // https://github.com/HowardHinnant/date/blob/master/include/date/date.h // An explanation for this algorithm can be found here: // http://howardhinnant.github.io/date_algorithms.html#civil_from_days constexpr year_month_day from_days(days dp) noexcept { static_assert(std::numeric_limits<unsigned>::digits >= 18, "This algorithm has not been ported to a 16 bit unsigned " "integer"); static_assert(std::numeric_limits<int>::digits >= 20, "This algorithm has not been ported to a 16 bit signed " "integer"); auto const z = dp.count() + 719468; auto const era = (z >= 0 ? z : z - 146096) / 146097; auto const doe = static_cast<unsigned>(z - era * 146097); auto const yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; auto const y = static_cast<days::rep>(yoe) + era * 400; auto const doy = doe - (365 * yoe + yoe / 4 - yoe / 100); auto const mp = (5 * doy + 2) / 153; auto const d = static_cast<unsigned char>(doy - (153 * mp + 2) / 5 + 1); auto const m = static_cast<unsigned char>(mp < 10 ? mp + 3 : mp - 9); return year_month_day{static_cast<unsigned short>(y + (m <= 2)), m, d}; } } // namespace template <class Clock, class Duration> struct time_point_printer : printer<time_point_printer<Clock, Duration>> { using attribute = std::chrono::time_point<Clock, Duration>; template <class Iterator> bool print(Iterator& out, std::chrono::time_point<Clock, Duration> tp) const { using namespace std::chrono; constexpr auto num = printers::integral<int>; constexpr auto num2 = printers::integral<int, policy::plain, 2>; constexpr auto unum2 = printers::integral<unsigned, policy::plain, 2>; auto p = num << '-' << unum2 << '-' << unum2 << 'T' << num2 << ':' << num2 << ':' << num2; auto sd = floor<days>(tp); auto [Y, M, D] = from_days(duration_cast<days>(sd - time{})); auto t = tp - sd; auto h = duration_cast<hours>(t); auto m = duration_cast<minutes>(t - h); auto s = duration_cast<seconds>(t - h - m); auto sub_secs = duration_cast<nanoseconds>(t - h - m - s).count(); if (!p(out, static_cast<int>(Y), static_cast<unsigned>(M), static_cast<unsigned>(D), static_cast<int>(h.count()), static_cast<int>(m.count()), static_cast<int>(s.count()))) return false; if (sub_secs == 0) return true; // For the sub-second part, we print print down to the lowest resolution // necessary (all the way down to ns). constexpr auto num3 = printers::integral<int, policy::plain, 3>; constexpr auto num6 = printers::integral<int, policy::plain, 6>; constexpr auto num9 = printers::integral<int, policy::plain, 9>; *out++ = '.'; if (sub_secs % 1000000 == 0) return num3(out, sub_secs / 1000000); if (sub_secs % 1000 == 0) return num6(out, sub_secs / 1000); return num9(out, sub_secs); } }; template <class Rep, class Period> struct printer_registry<std::chrono::duration<Rep, Period>> { using type = duration_printer<Rep, Period>; }; template <class Clock, class Duration> struct printer_registry<std::chrono::time_point<Clock, Duration>> { using type = time_point_printer<Clock, Duration>; }; namespace printers { template <class Duration, class Policy = policy::adaptive> const auto duration = duration_printer< typename Duration::rep, typename Duration::period, Policy >{}; template <class Clock, class Duration = typename Clock::duration> const auto time_point = time_point_printer<Clock, Duration>{}; } // namespace printers } // namespace vast
{ "pile_set_name": "Github" }
<?php /* * Opulence * * @link https://www.opulencephp.com * @copyright Copyright (C) 2017 David Young * @license https://github.com/opulencephp/Opulence/blob/master/LICENSE.md */ namespace Opulence\Console\Requests\Tokenizers; use RuntimeException; /** * Defines the string tokenizer */ class StringTokenizer implements ITokenizer { /** * @inheritdoc */ public function tokenize($input) : array { $input = trim($input); $inDoubleQuotes = false; $inSingleQuotes = false; $charArray = preg_split('//u', $input, -1, PREG_SPLIT_NO_EMPTY); $previousChar = ''; $buffer = ''; $tokens = []; foreach ($charArray as $charIter => $char) { switch ($char) { case '"': // If the double quote is inside single quotes, we treat it as part of a quoted string if (!$inSingleQuotes) { $inDoubleQuotes = !$inDoubleQuotes; } $buffer .= '"'; break; case "'": // If the single quote is inside double quotes, we treat it as part of a quoted string if (!$inDoubleQuotes) { $inSingleQuotes = !$inSingleQuotes; } $buffer .= "'"; break; default: if ($inDoubleQuotes || $inSingleQuotes || $char !== ' ') { $buffer .= $char; } elseif ($char === ' ' && $previousChar !== ' ' && mb_strlen($buffer) > 0) { // We've hit a space outside a quoted string, so flush the buffer $tokens[] = $buffer; $buffer = ''; } } $previousChar = $char; } // Flush out the buffer if (mb_strlen($buffer) > 0) { $tokens[] = $buffer; } if ($inDoubleQuotes || $inSingleQuotes) { throw new RuntimeException('Unclosed ' . ($inDoubleQuotes ? 'double' : 'single') . ' quote'); } return $tokens; } }
{ "pile_set_name": "Github" }
{ "compilerOptions": { "newLine": "LF" } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2007, Novell Inc. * * This program is licensed under the BSD license, read LICENSE.BSD * for further information */ #ifndef LIBSOLV_POOLVENDOR_H #define LIBSOLV_POOLVENDOR_H #include "pool.h" #ifdef __cplusplus extern "C" { #endif Id pool_vendor2mask(Pool *pool, Id vendor); void pool_setvendorclasses(Pool *pool, const char **vendorclasses); void pool_addvendorclass(Pool *pool, const char **vendorclass); #ifdef __cplusplus } #endif #endif /* LIBSOLV_POOLVENDOR_H */
{ "pile_set_name": "Github" }
// // UMSocialTwitterHandler.h // SocialSDK // // Created by yeahugo on 14-1-13. // Copyright (c) 2014年 Umeng. All rights reserved. // #import <Foundation/Foundation.h> @interface UMSocialTwitterHandler : NSObject /** 使用友盟提供的方法来分享到twitter */ +(void)openTwitter; /** 设置twitter应用key、secret */ +(void)setTwitterAppKey:(NSString *)appKey withSecret:(NSString *)secret; @end
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <resources xmlns:ns1="urn:oasis:names:tc:xliff:document:1.2"> <string msgid="4600421777120114993" name="abc_action_bar_home_description">"હોમ પર નેવિગેટ કરો"</string> <string msgid="1594238315039666878" name="abc_action_bar_up_description">"ઉપર નેવિગેટ કરો"</string> <string msgid="3588849162933574182" name="abc_action_menu_overflow_description">"વધુ વિકલ્પો"</string> <string msgid="4076576682505996667" name="abc_action_mode_done">"થઈ ગયું"</string> <string msgid="7468859129482906941" name="abc_activity_chooser_view_see_all">"બધું જુઓ"</string> <string msgid="2031811694353399454" name="abc_activitychooserview_choose_application">"એક ઍપ્લિકેશન પસંદ કરો"</string> <string msgid="121134116657445385" name="abc_capital_off">"બંધ"</string> <string msgid="3405795526292276155" name="abc_capital_on">"ચાલુ"</string> <string msgid="7723749260725869598" name="abc_search_hint">"શોધો…"</string> <string msgid="3691816814315814921" name="abc_searchview_description_clear">"ક્વેરી સાફ કરો"</string> <string msgid="2550479030709304392" name="abc_searchview_description_query">"શોધ ક્વેરી"</string> <string msgid="8264924765203268293" name="abc_searchview_description_search">"શોધો"</string> <string msgid="8928215447528550784" name="abc_searchview_description_submit">"ક્વેરી સબમિટ કરો"</string> <string msgid="893419373245838918" name="abc_searchview_description_voice">"વૉઇસ શોધ"</string> <string msgid="3421042268587513524" name="abc_shareactionprovider_share_with">"આની સાથે શેર કરો"</string> <string msgid="3300176832234831527" name="abc_shareactionprovider_share_with_application">"<ns1:g id="APPLICATION_NAME">%s</ns1:g>ની સાથે શેર કરો"</string> <string msgid="1603543279005712093" name="abc_toolbar_collapse_description">"સંકુચિત કરો"</string> <string msgid="146198913615257606" name="search_menu_title">"શોધો"</string> <string msgid="7988687684186075107" name="status_bar_notification_info_overflow">"999+"</string> </resources>
{ "pile_set_name": "Github" }
package net.anotheria.moskito.webui.shared.api.filter; /** * A single matcher that can be used in filters. * * @author lrosenberg * @since 20.04.15 09:22 */ public interface Matcher { /** * Returns true if the target matches criteria. * @param target target to check. * @return */ boolean doesMatch(String target); }
{ "pile_set_name": "Github" }
# Tenko parser test case - Path: tests/testcases/assigns/to_keyword/should_listen_to_use_strict_in_getters_5bstatic5d.md > :: assigns : to keyword > > ::> should listen to use strict in getters 5bstatic5d ## Input `````js x = { get x() { "use strict"; static = 787984536; } } ````` ## Output _Note: the whole output block is auto-generated. Manual changes will be overwritten!_ Below follow outputs in five parsing modes: sloppy, sloppy+annexb, strict script, module, module+annexb. Note that the output parts are auto-generated by the test runner to reflect actual result. ### Sloppy mode Parsed with script goal and as if the code did not start with strict mode header. ````` throws: Parser error! Cannot use this name (`static`) as a variable name because: `static` is a reserved word in strict mode start@1:0, error@1:30 ╔══╦═════════════════ 1 ║ x = { get x() { "use strict"; static = 787984536; } } ║ ^^^^^^------- error ╚══╩═════════════════ ````` ### Strict mode Parsed with script goal but as if it was starting with `"use strict"` at the top. _Output same as sloppy mode._ ### Module goal Parsed with the module goal. _Output same as sloppy mode._ ### Sloppy mode with AnnexB Parsed with script goal with AnnexB rules enabled and as if the code did not start with strict mode header. _Output same as sloppy mode._ ### Module goal with AnnexB Parsed with the module goal with AnnexB rules enabled. _Output same as sloppy mode._
{ "pile_set_name": "Github" }
// 665 easy 非递减数列 // 给定一个长度为 n 的整数数组,你的任务是判断在最多改变 1 个元素的情况下,该数组能否变成一个非递减数列。 // 我们是这样定义一个非递减数列的: 对于数组中所有的 i (1 <= i < n),满足 array[i] <= array[i + 1]。 // // 示例 1: // 输入: [4,2,3] // 输出: True // 解释: 你可以通过把第一个4变成1来使得它成为一个非递减数列。 // 示例 2: // 输入: [4,2,1] // 输出: False // 解释: 你不能在只改变一个元素的情况下将其变为非递减数列。 // 说明:  n 的范围为 [1, 10,000]。 /** * @param {number[]} arr * @return {boolean} */ var checkPossibility = function(arr) { if (arr.length <= 2) return true; let count = 0; let index; for (let i = 0; i < arr.length - 1; i++){ if (arr[i] > arr[i+1]){ count++; index = i; } } if (count === 0) return true; // 不太可能 if (count > 1) return false; // 等于1 的情况下, 分为边界上断掉,和中间部分断掉两种情况 if (index === 0 || index === arr.length - 2) return true; if (arr[index] <= arr[index + 2] || arr[index - 1] <= arr[index + 1]){ return true; } else { return false; } }; // console.log(checkPossibility([3,4,2,3])) console.log(checkPossibility([4,2,3])) // console.log(sortEn(arr11)) // [4,1,2,3] 两头必然为true // [3,14,16,1,5] false // [1,4,1,4] true
{ "pile_set_name": "Github" }
/* * Copyright (C) 2011 Apple Inc. * Copyright (C) 2010 Sencha, Inc. * Copyright (C) 2010 Igalia S.L. * All rights reserved. * * 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. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. 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. */ #pragma once #include "Color.h" #include "FloatRect.h" #include "FloatRoundedRect.h" #include <wtf/Function.h> #include <wtf/Noncopyable.h> namespace WebCore { class AffineTransform; class GraphicsContext; struct GraphicsContextState; class ImageBuffer; class ShadowBlur { WTF_MAKE_NONCOPYABLE(ShadowBlur); public: enum ShadowType { NoShadow, SolidShadow, BlurShadow }; ShadowBlur(); ShadowBlur(const FloatSize& radius, const FloatSize& offset, const Color&, bool shadowsIgnoreTransforms = false); ShadowBlur(const GraphicsContextState&); void setShadowValues(const FloatSize&, const FloatSize& , const Color&, bool ignoreTransforms = false); void setShadowsIgnoreTransforms(bool ignoreTransforms) { m_shadowsIgnoreTransforms = ignoreTransforms; } bool shadowsIgnoreTransforms() const { return m_shadowsIgnoreTransforms; } void drawRectShadow(GraphicsContext&, const FloatRoundedRect&); void drawInsetShadow(GraphicsContext&, const FloatRect&, const FloatRoundedRect& holeRect); using DrawBufferCallback = WTF::Function<void(ImageBuffer&, const FloatPoint&, const FloatSize&)>; using DrawImageCallback = WTF::Function<void(ImageBuffer&, const FloatRect&, const FloatRect&)>; using FillRectCallback = WTF::Function<void(const FloatRect&, const Color&)>; using FillRectWithHoleCallback = WTF::Function<void(const FloatRect&, const FloatRect&, const Color&)>; using DrawShadowCallback = WTF::Function<void(GraphicsContext&)>; // DrawBufferCallback is for drawing shadow without tiling. // DrawImageCallback and FillRectCallback is for drawing shadow with tiling. void drawRectShadow(const AffineTransform&, const IntRect& clipBounds, const FloatRoundedRect& shadowedRect, const DrawBufferCallback&, const DrawImageCallback&, const FillRectCallback&); void drawInsetShadow(const AffineTransform&, const IntRect& clipBounds, const FloatRect& fullRect, const FloatRoundedRect& holeRect, const DrawBufferCallback&, const DrawImageCallback&, const FillRectWithHoleCallback&); void drawShadowLayer(const AffineTransform&, const IntRect& clipBounds, const FloatRect& layerArea, const DrawShadowCallback&, const DrawBufferCallback&); void blurLayerImage(unsigned char*, const IntSize&, int stride); void clear(); ShadowType type() const { return m_type; } private: void updateShadowBlurValues(); void drawShadowBuffer(GraphicsContext&); void adjustBlurRadius(const AffineTransform&); enum ShadowDirection { OuterShadow, InnerShadow }; IntSize calculateLayerBoundingRect(const AffineTransform&, const FloatRect& layerArea, const IntRect& clipRect); IntSize templateSize(const IntSize& blurredEdgeSize, const FloatRoundedRect::Radii&) const; void blurShadowBuffer(const IntSize& templateSize); void blurAndColorShadowBuffer(const IntSize& templateSize); void drawInsetShadowWithoutTiling(const AffineTransform&, const FloatRect& fullRect, const FloatRoundedRect& holeRect, const IntSize& layerSize, const DrawBufferCallback&); void drawInsetShadowWithTiling(const AffineTransform&, const FloatRect& fullRect, const FloatRoundedRect& holeRect, const IntSize& shadowTemplateSize, const IntSize& blurredEdgeSize, const DrawImageCallback&, const FillRectWithHoleCallback&); void drawRectShadowWithoutTiling(const AffineTransform&, const FloatRoundedRect& shadowedRect, const IntSize& layerSize, const DrawBufferCallback&); void drawRectShadowWithTiling(const AffineTransform&, const FloatRoundedRect& shadowedRect, const IntSize& shadowTemplateSize, const IntSize& blurredEdgeSize, const DrawImageCallback&, const FillRectCallback&); void drawLayerPiecesAndFillCenter(const FloatRect& shadowBounds, const FloatRoundedRect::Radii&, const IntSize& roundedRadius, const IntSize& templateSize, const DrawImageCallback&, const FillRectCallback&); void drawLayerPieces(const FloatRect& shadowBounds, const FloatRoundedRect::Radii&, const IntSize& roundedRadius, const IntSize& templateSize, const DrawImageCallback&); IntSize blurredEdgeSize() const; ShadowType m_type { NoShadow }; Color m_color; FloatSize m_blurRadius; FloatSize m_offset; ImageBuffer* m_layerImage { nullptr }; // Buffer to where the temporary shadow will be drawn to. FloatSize m_shadowedResultSize; // Size of the result of shadowing which is same as shadowedRect + blurred edges. FloatPoint m_layerOrigin; // Top-left corner of the (possibly clipped) bounding rect to draw the shadow to. FloatSize m_layerSize; // Size of m_layerImage pixels that need blurring. FloatSize m_layerContextTranslation; // Translation to apply to m_layerContext for the shadow to be correctly clipped. bool m_shadowsIgnoreTransforms { false }; }; } // namespace WebCore
{ "pile_set_name": "Github" }
/****************************************************************************** * Copyright (C) 2015 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /*****************************************************************************/ /** * * @file xhdcp1x_rx.c * @addtogroup hdcp1x_v4_4 * @{ * * This contains the main implementation file for the Xilinx HDCP receive state * machine * * <pre> * MODIFICATION HISTORY: * * Ver Who Date Changes * ----- ------ -------- -------------------------------------------------- * 1.00 fidus 07/16/15 Initial release. * 1.10 MG 01/18/16 Added function XHdcp1x_RxIsEnabled and * XHdcp1x_RxIsInProgress. * 3.0 yas 02/13/16 Upgraded to support HDCP Repeater functionality. * Added a new enum XHdcp1x_EventType value: * XHDCP1X_EVENT_DOWNSTREAMREADY. * Added new XHdcp1x_StateType values: * XHDCP1X_STATE_WAITFORDOWNSTREAM, * XHDCP1X_STATE_ASSEMBLEKSVLIST. * Added a new function: * XHdcp1x_RxDownstreamReady, XHdcp1x_RxGetRepeaterInfo, * XHdcp1x_RxSetCallBack. * Updated the following functions for Repeater: * XHdcp1x_RxStartComputations, * XHdcp1x_RxPollForComputations, XHdcp1x_RxEnterState, * XHdcp1x_RxDoTheState. * 3.1 yas 07/28/16 Repeater functionality extended to support HDMI. * Removed the XHdcp1x_RxDownstreamReadyCallback. * Added fucntions, * XHdcp1x_RxSetRepeaterBcaps,XHdcp1x_RxIsInComputations, * XHdcp1x_RxIsInWaitforready, XHdcp1x_RxHandleTimeout, * XHdcp1x_RxStartTimer, XHdcp1x_RxStopTimer, * XHdcp1x_RxBusyDelay, XHdcp1x_RxSetTopologyUpdate, * XHdcp1x_RxSetTopology, XHdcp1x_RxSetTopologyKSVList, * XHdcp1x_RxSetTopologyDepth, * XHdcp1x_RxSetTopologyDeviceCnt, * XHdcp1x_RxSetTopologyMaxCascadeExceeded, * XHdcp1x_RxSetTopologyMaxDevsExceeded, * XHdcp1x_RxCheckEncryptionChange. * 4.1 yas 11/10/16 Added function XHdcp1x_RxSetHdmiMode. * </pre> * *****************************************************************************/ /***************************** Include Files *********************************/ #include "xparameters.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include "xhdcp1x.h" #include "xhdcp1x_cipher.h" #include "xhdcp1x_debug.h" #include "xhdcp1x_port.h" #if (defined(XPAR_XV_HDMIRX_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX_NUM_INSTANCES > 0)) || \ (defined(XPAR_XV_HDMIRX1_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX1_NUM_INSTANCES > 0)) #include "xhdcp1x_port_hdmi.h" #else #include "xhdcp1x_port_dp.h" #endif #include "xhdcp1x_rx.h" #include "xhdcp1x_platform.h" #include "sha1.h" #include "xil_types.h" /************************** Constant Definitions *****************************/ #define XVPHY_FLAG_PHY_UP (1u << 0) /**< Flag to track physical state */ #define XVPHY_TMO_5MS (5u) /**< Timeout value for 5ms */ #define XVPHY_TMO_100MS (100u) /**< Timeout value for 100ms */ #define XVPHY_TMO_1SECOND (1000u) /**< Timeout value for 1s */ /**************************** Type Definitions *******************************/ /** * This enumerates the Event Types for HDCP Receiver state machine. */ typedef enum { XHDCP1X_EVENT_NULL, XHDCP1X_EVENT_AUTHENTICATE, XHDCP1X_EVENT_CHECK, XHDCP1X_EVENT_DISABLE, XHDCP1X_EVENT_ENABLE, XHDCP1X_EVENT_PHYDOWN, XHDCP1X_EVENT_PHYUP, XHDCP1X_EVENT_POLL, XHDCP1X_EVENT_UPDATERi, XHDCP1X_EVENT_TIMEOUT, XHDCP1X_EVENT_DOWNSTREAMREADY, } XHdcp1x_EventType; /** * This enumerates the State Types for HDCP Receiver state machine. */ typedef enum { XHDCP1X_STATE_DISABLED = XHDCP1X_RX_STATE_DISABLED, XHDCP1X_STATE_UNAUTHENTICATED = XHDCP1X_RX_STATE_UNAUTHENTICATED, XHDCP1X_STATE_COMPUTATIONS = XHDCP1X_RX_STATE_COMPUTATIONS, XHDCP1X_STATE_WAITFORDOWNSTREAM = XHDCP1X_RX_STATE_WAITFORDOWNSTREAM, XHDCP1X_STATE_ASSEMBLEKSVLIST = XHDCP1X_RX_STATE_ASSEMBLEKSVLIST, XHDCP1X_STATE_AUTHENTICATED = XHDCP1X_RX_STATE_AUTHENTICATED, XHDCP1X_STATE_LINKINTEGRITYFAILED = XHDCP1X_RX_STATE_LINKINTEGRITYFAILED, XHDCP1X_STATE_PHYDOWN = XHDCP1X_RX_STATE_PHYDOWN, } XHdcp1x_StateType; /***************** Macros (Inline Functions) Definitions *********************/ /*************************** Function Prototypes *****************************/ static void XHdcp1x_RxDebugLog(const XHdcp1x *InstancePtr, const char *LogMsg); static void XHdcp1x_RxPostEvent(XHdcp1x *InstancePtr, XHdcp1x_EventType Event); static void XHdcp1x_RxStartTimer(XHdcp1x *InstancePtr, u16 TimeoutInMs); static void XHdcp1x_RxStopTimer(XHdcp1x *InstancePtr); #if XHDCP1X_ADDITIONAL_DEBUG static void XHdcp1x_RxBusyDelay(XHdcp1x *InstancePtr, u16 DelayInMs); #endif static void XHdcp1x_RxAuthCallback(void *Parameter); static void XHdcp1x_RxLinkFailCallback(void *Parameter); static void XHdcp1x_RxRiUpdateCallback(void *Parameter); static void XHdcp1x_RxSetCheckLinkState(XHdcp1x *InstancePtr, int IsEnabled); static void XHdcp1x_RxEnableState(XHdcp1x *InstancePtr); static void XHdcp1x_RxDisableState(XHdcp1x *InstancePtr); static void XHdcp1x_RxStartComputations(XHdcp1x *InstancePtr, XHdcp1x_StateType *NextStatePtr); static void XHdcp1x_RxPollForComputations(XHdcp1x *InstancePtr, XHdcp1x_StateType *NextStatePtr); static int XHdcp1x_RxCalculateSHA1Value(XHdcp1x *InstancePtr, u16 RepeaterInfo); static void XHdcp1x_RxAssembleKSVList(XHdcp1x *InstancePtr, XHdcp1x_StateType *NextStatePtr); static void XHdcp1x_RxUpdateRi(XHdcp1x *InstancePtr); static void XHdcp1x_RxCheckLinkIntegrity(XHdcp1x *InstancePtr, XHdcp1x_StateType *NextStatePtr); static void XHdcp1x_RxReportLinkIntegrityFailure(XHdcp1x *InstancePtr, XHdcp1x_StateType *NextStatePtr); static void XHdcp1x_RxRunDisabledState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr); static void XHdcp1x_RxRunUnauthenticatedState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr); static void XHdcp1x_RxRunComputationsState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr); static void XHdcp1x_RxRunAuthenticatedState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr); static void XHdcp1x_RxRunLinkIntegrityFailedState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr); static void XHdcp1x_RxRunPhysicalLayerDownState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr); static void XHdcp1x_RxEnterState(XHdcp1x *InstancePtr, XHdcp1x_StateType State, XHdcp1x_StateType *NextStatePtr); static void XHdcp1x_RxExitState(XHdcp1x *InstancePtr, XHdcp1x_StateType State); static void XHdcp1x_RxDoTheState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event); static void XHdcp1x_RxProcessPending(XHdcp1x *InstancePtr); static const char *XHdcp1x_RxStateToString(XHdcp1x_StateType State); #if XHDCP1X_ADDITIONAL_DEBUG static const char *XHdcp1x_RxEventToString(XHdcp1x_EventType Event); #endif /************************** Function Definitions *****************************/ /*****************************************************************************/ /** * This function installs callback functions for the given * HandlerType: * * @param InstancePtr is a pointer to the HDCP core instance. * @param HandlerType specifies the type of handler. * @param CallbackFunc is the address of the callback function. * @param CallbackRef is a user data item that will be passed to the * callback function when it is invoked. * * @return * - XST_SUCCESS if callback function installed successfully. * - XST_INVALID_PARAM when HandlerType is invalid. * * @note Invoking this function for a handler that already has been * installed replaces it with the new handler. * ******************************************************************************/ int XHdcp1x_RxSetCallback(XHdcp1x *InstancePtr, XHdcp1x_HandlerType HandlerType, void *CallbackFunc, void *CallbackRef) { /* Verify arguments. */ Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(HandlerType > (XHDCP1X_HANDLER_UNDEFINED)); Xil_AssertNonvoid(HandlerType < (XHDCP1X_HANDLER_INVALID)); Xil_AssertNonvoid(CallbackFunc != NULL); Xil_AssertNonvoid(CallbackRef != NULL); u32 Status; /* Check for handler type */ switch (HandlerType) { case (XHDCP1X_HANDLER_DDC_SETREGADDR): InstancePtr->Rx.DdcSetAddressCallback = (XHdcp1x_SetDdcHandler)CallbackFunc; InstancePtr->Rx.DdcSetAddressCallbackRef = CallbackRef; InstancePtr->Rx.IsDdcSetAddressCallbackSet = (TRUE); Status = XST_SUCCESS; break; case (XHDCP1X_HANDLER_DDC_SETREGDATA): InstancePtr->Rx.DdcSetDataCallback = (XHdcp1x_SetDdcHandler)CallbackFunc; InstancePtr->Rx.DdcSetDataCallbackRef = CallbackRef; InstancePtr->Rx.IsDdcSetDataCallbackSet = (TRUE); Status = XST_SUCCESS; break; case (XHDCP1X_HANDLER_DDC_GETREGDATA): InstancePtr->Rx.DdcGetDataCallback = (XHdcp1x_GetDdcHandler)CallbackFunc; InstancePtr->Rx.DdcGetDataCallbackRef = CallbackRef; InstancePtr->Rx.IsDdcGetDataCallbackSet = (TRUE); Status = XST_SUCCESS; break; /* Repeater - trigger Downstream Authentication */ /* Eqilvalent of case * (XHDCP1X_RPTR_HDLR_TRIG_DOWNSTREAM_AUTH): */ case (XHDCP1X_HANDLER_RPTR_TRIGDWNSTRMAUTH): InstancePtr->Rx.RepeaterDownstreamAuthCallback = (XHdcp1x_Callback)CallbackFunc; InstancePtr->Rx.RepeaterDownstreamAuthRef = CallbackRef; InstancePtr->Rx.IsRepeaterDownstreamAuthCallbackSet = (TRUE); Status = XST_SUCCESS; break; // authenticated case (XHDCP1X_HANDLER_AUTHENTICATED): InstancePtr->Rx.AuthenticatedCallback = (XHdcp1x_Callback)CallbackFunc; InstancePtr->Rx.AuthenticatedCallbackRef = CallbackRef; InstancePtr->Rx.IsAuthenticatedCallbackSet = (TRUE); Status = XST_SUCCESS; break; // unauthenticated case (XHDCP1X_HANDLER_UNAUTHENTICATED): InstancePtr->Rx.UnauthenticatedCallback = (XHdcp1x_Callback)CallbackFunc; InstancePtr->Rx.UnauthenticatedCallbackRef = CallbackRef; InstancePtr->Rx.IsUnauthenticatedCallbackSet = (TRUE); Status = XST_SUCCESS; break; // topology updated case (XHDCP1X_HANDLER_TOPOLOGY_UPDATE): InstancePtr->Rx.TopologyUpdateCallback = (XHdcp1x_Callback)CallbackFunc; InstancePtr->Rx.TopologyUpdateCallbackRef = CallbackRef; InstancePtr->Rx.IsTopologyUpdateCallbackSet = (TRUE); Status = XST_SUCCESS; break; // encryption updated case (XHDCP1X_HANDLER_ENCRYPTION_UPDATE): InstancePtr->Rx.EncryptionUpdateCallback = (XHdcp1x_Callback)CallbackFunc; InstancePtr->Rx.EncryptionUpdateCallbackRef = CallbackRef; InstancePtr->Rx.IsEncryptionUpdateCallbackSet = (TRUE); Status = XST_SUCCESS; break; default: Status = XST_INVALID_PARAM; break; } return (Status); } /*****************************************************************************/ /** * This function initializes a HDCP receiver state machine. * * @param InstancePtr is the receiver instance. * * @return None. * * @note None. * ******************************************************************************/ void XHdcp1x_RxInit(XHdcp1x *InstancePtr) { XHdcp1x_StateType DummyState = XHDCP1X_STATE_DISABLED; /* Update theHandler */ InstancePtr->Rx.PendingEvents = 0; /* Kick the state machine */ XHdcp1x_RxEnterState(InstancePtr, XHDCP1X_STATE_DISABLED, &DummyState); } /*****************************************************************************/ /** * This function polls the HDCP receiver module. * * @param InstancePtr is the receiver instance. * * @return * - XST_SUCCESS if successful. * * @note None. * ******************************************************************************/ int XHdcp1x_RxPoll(XHdcp1x *InstancePtr) { int Status = XST_SUCCESS; /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Process any pending events */ XHdcp1x_RxProcessPending(InstancePtr); /* Poll it */ XHdcp1x_RxDoTheState(InstancePtr, XHDCP1X_EVENT_POLL); return (Status); } /*****************************************************************************/ /** * This function set the REPEATER bit for the HDCP RX interface. * * @param InstancePtr is the receiver instance. * @param IsRptr is the truth value to determine if the repeater bit * in the port registers is to be set. * @return * - XST_SUCCESS if successful. * * @note This function disables and then re-enables the interface. * ******************************************************************************/ int XHdcp1x_RxSetRepeaterBcaps(XHdcp1x *InstancePtr, u8 IsRptr) { int Status = XST_SUCCESS; /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); Status = XHdcp1x_PortSetRepeater(InstancePtr, IsRptr); if (Status != XST_SUCCESS) { return XST_FAILURE; } return (Status); } /*****************************************************************************/ /** * This function resets an HDCP interface. * * @param InstancePtr is the receiver instance. * * @return * - XST_SUCCESS if successful. * * @note This function disables and then re-enables the interface. * ******************************************************************************/ int XHdcp1x_RxReset(XHdcp1x *InstancePtr) { int Status = XST_SUCCESS; /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Reset it */ XHdcp1x_RxPostEvent(InstancePtr, XHDCP1X_EVENT_DISABLE); XHdcp1x_RxPostEvent(InstancePtr, XHDCP1X_EVENT_ENABLE); return (Status); } /*****************************************************************************/ /** * This function enables a HDCP receive interface. * * @param InstancePtr is the receiver instance. * * @return * - XST_SUCCESS if successful. * * @note None. * ******************************************************************************/ int XHdcp1x_RxEnable(XHdcp1x *InstancePtr) { int Status = XST_SUCCESS; /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Post it */ XHdcp1x_RxPostEvent(InstancePtr, XHDCP1X_EVENT_ENABLE); return (Status); } /*****************************************************************************/ /** * This function disables a HDCP receive interface. * * @param InstancePtr is the receiver instance. * * @return * - XST_SUCCESS if successful. * * @note None. * ******************************************************************************/ int XHdcp1x_RxDisable(XHdcp1x *InstancePtr) { int Status = XST_SUCCESS; /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Post it */ XHdcp1x_RxPostEvent(InstancePtr, XHDCP1X_EVENT_DISABLE); return (Status); } /*****************************************************************************/ /** * This function queries an interface to check if is enabled. * * @param InstancePtr is the receiver instance. * * @return Truth value indicating is enabled (true) or not (false). * * @note None. * ******************************************************************************/ int XHdcp1x_RxIsEnabled(const XHdcp1x *InstancePtr) { int IsEnabled = FALSE; /* Verify arguments. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Case-wise process the current state of Rx state machine */ switch (InstancePtr->Rx.CurrentState) { case XHDCP1X_STATE_DISABLED: IsEnabled = FALSE; break; /* Otherwise */ default: IsEnabled = TRUE; break; } return (IsEnabled); } /*****************************************************************************/ /** * This function updates the physical state of an HDCP interface. * * @param InstancePtr is the receiver instance. * @param IsUp is truth value indicating the status of physical interface. * * @return * - XST_SUCCESS if successful. * * @note None. * ******************************************************************************/ int XHdcp1x_RxSetPhysicalState(XHdcp1x *InstancePtr, int IsUp) { int Status = XST_SUCCESS; XHdcp1x_EventType Event = XHDCP1X_EVENT_PHYDOWN; /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Determine Event */ if (IsUp) { Event = XHDCP1X_EVENT_PHYUP; } /* Post it */ XHdcp1x_RxPostEvent(InstancePtr, Event); return (Status); } /*****************************************************************************/ /** * This function set the lane count of an hdcp interface. * * @param InstancePtr is the receiver instance. * @param LaneCount is the number of lanes of the interface. * * @return * - XST_SUCCESS if successful. * * @note None. * ******************************************************************************/ int XHdcp1x_RxSetLaneCount(XHdcp1x *InstancePtr, int LaneCount) { /* Verify arguments. */ Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(LaneCount > 0); /* Set it */ return (XHdcp1x_CipherSetNumLanes(InstancePtr, LaneCount)); } /*****************************************************************************/ /** * This function initiates downstream ready/ assemble ksv list on an interface. * * @param InstancePtr is the receiver instance. * * @return * - XST_SUCCESS if successful. * * @note None. * ******************************************************************************/ int XHdcp1x_RxDownstreamReady(XHdcp1x *InstancePtr) { int Status = XST_SUCCESS; /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Post the re-authentication request */ XHdcp1x_RxPostEvent(InstancePtr, XHDCP1X_EVENT_DOWNSTREAMREADY); return (Status); } /*****************************************************************************/ /** * This function initiates authentication on an interface. * * @param InstancePtr is the receiver instance. * * @return * - XST_SUCCESS if successful. * * @note None. * ******************************************************************************/ int XHdcp1x_RxAuthenticate(XHdcp1x *InstancePtr) { int Status = XST_SUCCESS; /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Post the re-authentication request */ XHdcp1x_RxPostEvent(InstancePtr, XHDCP1X_EVENT_AUTHENTICATE); return (Status); } /*****************************************************************************/ /** * This function queries an interface to check if authentication is in * progress. * * @param InstancePtr is the receiver instance. * * @return Truth value indicating in progress (true) or not (false). * * @note None. * ******************************************************************************/ int XHdcp1x_RxIsInProgress(const XHdcp1x *InstancePtr) { int IsInProgress = FALSE; /* Verify arguments. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Case-wise process the current state of Rx state machine */ switch (InstancePtr->Rx.CurrentState) { case XHDCP1X_STATE_COMPUTATIONS: IsInProgress = TRUE; break; /* Otherwise */ default: IsInProgress = FALSE; break; } return (IsInProgress); } /*****************************************************************************/ /** * This function queries an interface to check if its been authenticated. * * @param InstancePtr is the receiver instance. * * @return Truth value indicating authenticated (true) or not (false). * * @note None. * ******************************************************************************/ int XHdcp1x_RxIsAuthenticated(const XHdcp1x *InstancePtr) { int IsAuthenticated = FALSE; /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Determine IsAuthenticated */ if (InstancePtr->Rx.CurrentState == XHDCP1X_STATE_AUTHENTICATED) { IsAuthenticated = TRUE; } return (IsAuthenticated); } /*****************************************************************************/ /** * This function queries an interface to check if its in the computations state. * * @param InstancePtr is the receiver instance. * * @return Truth value indicating authenticated (true) or not (false). * * @note None. * ******************************************************************************/ int XHdcp1x_RxIsInComputations(const XHdcp1x *InstancePtr) { int IsInComp = FALSE; /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Determine IsAuthenticated */ if (InstancePtr->Rx.CurrentState == XHDCP1X_STATE_COMPUTATIONS) { IsInComp = TRUE; } return (IsInComp); } /*****************************************************************************/ /** * This function queries an interface to check if its in the * wait-for-downstream-ready state. * * @param InstancePtr is the receiver instance. * * @return Truth value indicating authenticated (true) or not (false). * * @note None. * ******************************************************************************/ int XHdcp1x_RxIsInWaitforready(const XHdcp1x *InstancePtr) { int IsInWfr = FALSE; /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Determine IsAuthenticated */ if (InstancePtr->Rx.CurrentState == XHDCP1X_STATE_WAITFORDOWNSTREAM) { IsInWfr = TRUE; } return (IsInWfr); } /*****************************************************************************/ /** * This function retrieves the current encryption stream map. * * @param InstancePtr is the receiver instance. * * @return The current encryption stream map. * * @note None. * ******************************************************************************/ u64 XHdcp1x_RxGetEncryption(const XHdcp1x *InstancePtr) { /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Get it */ return (XHdcp1x_CipherGetEncryption(InstancePtr)); } /*****************************************************************************/ /** * This function handles a timeout on an HDCP interface. * * @param InstancePtr is the receiver instance. * * @return None. * * @note None. * ******************************************************************************/ void XHdcp1x_RxHandleTimeout(XHdcp1x *InstancePtr) { /* Verify arguments. */ Xil_AssertVoid(InstancePtr != NULL); /* Post the timeout */ XHdcp1x_RxPostEvent(InstancePtr, XHDCP1X_EVENT_TIMEOUT); } /*****************************************************************************/ /** * This function implements the debug display output for receiver instances. * * @param InstancePtr is the receiver instance. * * @return * - XST_SUCCESS if successful. * * @note None. * ******************************************************************************/ int XHdcp1x_RxInfo(const XHdcp1x *InstancePtr) { u64 LocalKsv = 0; u32 Version = 0; /* Verify argument. */ Xil_AssertNonvoid(InstancePtr != NULL); /* Display it */ XHDCP1X_DEBUG_PRINTF("Type: "); if (InstancePtr->Config.IsHDMI) { XHDCP1X_DEBUG_PRINTF("hdmi-rx\r\n"); } else { XHDCP1X_DEBUG_PRINTF("dp-rx\r\n"); } XHDCP1X_DEBUG_PRINTF("Current State: %s\r\n", XHdcp1x_RxStateToString(InstancePtr->Rx.CurrentState)); XHDCP1X_DEBUG_PRINTF("Previous State: %s\r\n", XHdcp1x_RxStateToString(InstancePtr->Rx.PreviousState)); XHDCP1X_DEBUG_PRINTF("Encrypted?: %s\r\n", XHdcp1x_IsEncrypted(InstancePtr) ? "Yes" : "No"); XHDCP1X_DEBUG_PRINTF("Flags: %04X\r\n", InstancePtr->Rx.Flags); Version = XHdcp1x_GetDriverVersion(); XHDCP1X_DEBUG_PRINTF("Driver Version: %d.%02d.%02d\r\n", ((Version >> 16) &0xFFFFu), ((Version >> 8) & 0xFFu), (Version & 0xFFu)); Version = XHdcp1x_CipherGetVersion(InstancePtr); XHDCP1X_DEBUG_PRINTF("Cipher Version: %d.%02d.%02d\r\n", ((Version >> 16) &0xFFFFu), ((Version >> 8) & 0xFFu), (Version & 0xFFu)); LocalKsv = XHdcp1x_CipherGetLocalKsv(InstancePtr); XHDCP1X_DEBUG_PRINTF("Local KSV: %02lX", (LocalKsv >> 32)); XHDCP1X_DEBUG_PRINTF("%08lX\r\n", (LocalKsv & 0xFFFFFFFFu)); XHDCP1X_DEBUG_PRINTF("\r\n"); XHDCP1X_DEBUG_PRINTF("Rx Stats\r\n"); XHDCP1X_DEBUG_PRINTF("Auth Attempts: %d\r\n", InstancePtr->Rx.Stats.AuthAttempts); XHDCP1X_DEBUG_PRINTF("Link Failures: %d\r\n", InstancePtr->Rx.Stats.LinkFailures); XHDCP1X_DEBUG_PRINTF("Ri Updates: %d\r\n", InstancePtr->Rx.Stats.RiUpdates); XHDCP1X_DEBUG_PRINTF("\r\n"); XHDCP1X_DEBUG_PRINTF("Cipher Stats\r\n"); XHDCP1X_DEBUG_PRINTF("Int Count: %d\r\n", InstancePtr->Cipher.Stats.IntCount); XHDCP1X_DEBUG_PRINTF("\r\n"); XHDCP1X_DEBUG_PRINTF("Port Stats\r\n"); XHDCP1X_DEBUG_PRINTF("Int Count: %d\r\n", InstancePtr->Port.Stats.IntCount); return (XST_SUCCESS); } /*****************************************************************************/ /** * This function copies the V'H0, V'H1, V'H2, V'H3, V'H4, KSVList and * BInfo values in the HDCP RX HDCP Instance for Repeater validation . * * @param InstancePtr is the receiver instance. * @param RepeaterInfoPtr is the Repeater information in the * transmitter instance. * * @return * - XST_SUCCESS if successful. * * @note None. * ******************************************************************************/ int XHdcp1x_RxGetRepeaterInfo(XHdcp1x *InstancePtr, XHdcp1x_RepeaterExchange *RepeaterInfoPtr) { int Status = XST_SUCCESS; u32 ksvCount=0; u32 ksvsToCopy; /* Verify arguments. */ Xil_AssertNonvoid(InstancePtr != NULL); Xil_AssertNonvoid(RepeaterInfoPtr != NULL); /* * Copy the Depth read from the downstream HDCP device and * increment it by one to account for the Repeater itself */ InstancePtr->RepeaterValues.Depth = RepeaterInfoPtr->Depth + 1; /* Copy the device count read from the downstream HDCP device */ InstancePtr->RepeaterValues.DeviceCount = RepeaterInfoPtr->DeviceCount; /* Copy the KSVList */ ksvsToCopy = InstancePtr->RepeaterValues.DeviceCount; for(ksvCount=0 ; ksvCount < ksvsToCopy ; ksvCount++) { InstancePtr->RepeaterValues.KsvList[ksvCount] = RepeaterInfoPtr->KsvList[ksvCount]; } /* Copy the SHA1 Hash value V'H0 */ InstancePtr->RepeaterValues.V[0] = RepeaterInfoPtr->V[0]; /* Copy the SHA1 Hash value V'H1 */ InstancePtr->RepeaterValues.V[1] = RepeaterInfoPtr->V[1]; /* Copy the SHA1 Hash value V'H2 */ InstancePtr->RepeaterValues.V[2] = RepeaterInfoPtr->V[2]; /* Copy the SHA1 Hash value V'H3 */ InstancePtr->RepeaterValues.V[3] = RepeaterInfoPtr->V[3]; /* Copy the SHA1 Hash value V'H4 */ InstancePtr->RepeaterValues.V[4] = RepeaterInfoPtr->V[4]; return (Status); } /*****************************************************************************/ /** * This function logs a debug message on behalf of a handler state machine. * * @param InstancePtr is the receiver instance. * @param LogMsg is the message to log. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxDebugLog(const XHdcp1x *InstancePtr, const char *LogMsg) { char Label[16]; /* Format Label */ snprintf(Label, sizeof(Label), "hdcp-rx(%hu) - ", InstancePtr->Config.DeviceId); /* Log it */ XHDCP1X_DEBUG_LOGMSG(Label); XHDCP1X_DEBUG_LOGMSG(LogMsg); XHDCP1X_DEBUG_LOGMSG("\r\n"); } /*****************************************************************************/ /** * This function posts an event to a state machine. * * @param InstancePtr is the receiver instance. * @param Event is the event to post. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxPostEvent(XHdcp1x *InstancePtr, XHdcp1x_EventType Event) { /* Check for disable and clear any pending enable */ if (Event == XHDCP1X_EVENT_DISABLE) { InstancePtr->Rx.PendingEvents &= ~(1u << XHDCP1X_EVENT_ENABLE); } /* Check for phy-down and clear any pending phy-up */ else if (Event == XHDCP1X_EVENT_PHYDOWN) { InstancePtr->Rx.PendingEvents &= ~(1u << XHDCP1X_EVENT_PHYUP); } /* Post it */ InstancePtr->Rx.PendingEvents |= (1u << Event); } /*****************************************************************************/ /** * This function starts a state machine's timer. * * @param InstancePtr is the state machine. * @param TimeoutInMs is the timeout in milli-seconds. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxStartTimer(XHdcp1x *InstancePtr, u16 TimeoutInMs) { /* Start it */ XHdcp1x_PlatformTimerStart(InstancePtr, TimeoutInMs); } /*****************************************************************************/ /** * This function stops a state machine's timer. * * @param InstancePtr is the state machine. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxStopTimer(XHdcp1x *InstancePtr) { /* Stop it */ XHdcp1x_PlatformTimerStop(InstancePtr); } #if XHDCP1X_ADDITIONAL_DEBUG /*****************************************************************************/ /** * This function busy delays a state machine. * * @param InstancePtr is the state machine. * @param DelayInMs is the delay time in milli-seconds. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxBusyDelay(XHdcp1x *InstancePtr, u16 DelayInMs) { /* Busy wait */ XHdcp1x_PlatformTimerBusy(InstancePtr, DelayInMs); } #endif /*****************************************************************************/ /** * This function acts as the re-authentication callback for a state machine. * * @param Parameter is the parameter specified during registration. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxAuthCallback(void *Parameter) { XHdcp1x *InstancePtr = (XHdcp1x *)Parameter; /* Post the re-authentication request */ XHdcp1x_RxPostEvent(InstancePtr, XHDCP1X_EVENT_AUTHENTICATE); } /*****************************************************************************/ /** * This function acts as the link failure callback for a state machine. * * @param Parameter is the parameter specified during registration. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxLinkFailCallback(void *Parameter) { XHdcp1x *InstancePtr = (XHdcp1x *)Parameter; /* Post the check request */ XHdcp1x_RxPostEvent(InstancePtr, XHDCP1X_EVENT_CHECK); } /*****************************************************************************/ /** * This function acts as the Ri register update callback for a state machine. * * @param Parameter is the parameter specified during registration. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxRiUpdateCallback(void *Parameter) { XHdcp1x *InstancePtr = (XHdcp1x *)Parameter; if(InstancePtr->Rx.CurrentState == XHDCP1X_STATE_AUTHENTICATED) { /* Update the Ri value. */ XHdcp1x_RxUpdateRi(InstancePtr); } else { /* Post the update Ri request. */ XHdcp1x_RxPostEvent(InstancePtr, XHDCP1X_EVENT_UPDATERi); } } /*****************************************************************************/ /** * This function sets the check link state of the handler. * * @param InstancePtr is the receiver instance. * @param IsEnabled is truth value indicating on/off. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxSetCheckLinkState(XHdcp1x *InstancePtr, int IsEnabled) { /* Check for HDMI */ if (InstancePtr->Config.IsHDMI) { XHdcp1x_CipherSetRiUpdate(InstancePtr, IsEnabled); } /* Check for DP */ else { XHdcp1x_CipherSetLinkStateCheck(InstancePtr, IsEnabled); } } /*****************************************************************************/ /** * This function enables a receiver state machine. * * @param InstancePtr is the receiver instance. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxEnableState(XHdcp1x *InstancePtr) { u64 MyKsv = 0; u8 Buf[8]; /* Disable and register the link failure callback */ XHdcp1x_CipherSetLinkStateCheck(InstancePtr, FALSE); XHdcp1x_CipherSetCallback(InstancePtr, XHDCP1X_CIPHER_HANDLER_LINK_FAILURE, &XHdcp1x_RxLinkFailCallback, InstancePtr); /* Disable and register the Ri callback */ XHdcp1x_CipherSetRiUpdate(InstancePtr, FALSE); XHdcp1x_CipherSetCallback(InstancePtr, XHDCP1X_CIPHER_HANDLER_Ri_UPDATE, &XHdcp1x_RxRiUpdateCallback, InstancePtr); /* Enable the crypto engine */ XHdcp1x_CipherEnable(InstancePtr); /* Read MyKsv */ MyKsv = XHdcp1x_CipherGetLocalKsv(InstancePtr); /* If unknown - try again for good luck */ if (MyKsv == 0) { MyKsv = XHdcp1x_CipherGetLocalKsv(InstancePtr); } /* Initialize Bksv */ memset(Buf, 0, 8); XHDCP1X_PORT_UINT_TO_BUF(Buf, MyKsv, XHDCP1X_PORT_SIZE_BKSV * 8); XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BKSV, Buf, XHDCP1X_PORT_SIZE_BKSV); /* Register the re-authentication callback */ XHdcp1x_PortSetCallback(InstancePtr, XHDCP1X_PORT_HANDLER_AUTHENTICATE, &XHdcp1x_RxAuthCallback, InstancePtr); /* Enable the hdcp port */ XHdcp1x_PortEnable(InstancePtr); /* Update the hdcp encryption status */ InstancePtr->Rx.XORState.CurrentState = FALSE; } /*****************************************************************************/ /** * This function disables a receiver state machine. * * @param InstancePtr is the receiver instance. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxDisableState(XHdcp1x *InstancePtr) { /* Disable the hdcp cipher and port */ XHdcp1x_PortDisable(InstancePtr); XHdcp1x_CipherDisable(InstancePtr); /* Clear statistics */ memset(&(InstancePtr->Rx.Stats), 0, sizeof(InstancePtr->Rx.Stats)); } /*****************************************************************************/ /** * This function initiates the computations for a receiver state machine. * * @param InstancePtr is the receiver instance. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxStartComputations(XHdcp1x *InstancePtr, XHdcp1x_StateType *NextStatePtr) { /* NextStatePtr not being used */ UNUSED(NextStatePtr); u8 Buf[8]; u64 Value = 0; u32 X = 0; u32 Y = 0; u32 Z = 0; /* Log */ XHdcp1x_RxDebugLog(InstancePtr, "starting computations"); /* Update statistics */ InstancePtr->Rx.Stats.AuthAttempts++; /* Determine theAKsv */ memset(Buf, 0, 8); XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_AKSV, Buf, XHDCP1X_PORT_SIZE_AKSV); XHDCP1X_PORT_BUF_TO_UINT(Value, Buf, XHDCP1X_PORT_SIZE_AKSV * 8); /* Load the cipher with the remote ksv */ XHdcp1x_CipherSetRemoteKsv(InstancePtr, Value); /* Update theU64Value with An */ memset(Buf, 0, 8); XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_AN, Buf, XHDCP1X_PORT_SIZE_AN); XHDCP1X_PORT_BUF_TO_UINT(Value, Buf, XHDCP1X_PORT_SIZE_AN * 8); /* Load the cipher B registers with An */ X = (u32)(Value & 0x0FFFFFFFul); Value >>= 28; Y = (u32)(Value & 0x0FFFFFFFul); Value >>= 28; if (InstancePtr->IsRepeater) { Z = (u32)((Value | 0x00000100) & 0x000001FFul); } else { Z = (u32)(Value & 0x000000FFul); } XHdcp1x_CipherSetB(InstancePtr, X, Y, Z); /* Initiate the block cipher */ XHdcp1x_CipherDoRequest(InstancePtr, XHDCP1X_CIPHER_REQUEST_BLOCK); } /*****************************************************************************/ /** * This function polls the progress of the computations for a state machine. * * @param InstancePtr is the receiver instance. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxPollForComputations(XHdcp1x *InstancePtr, XHdcp1x_StateType *NextStatePtr) { /* Check for done */ if (XHdcp1x_CipherIsRequestComplete(InstancePtr)) { u8 Buf[4]; u16 Ro = 0; /* Log */ XHdcp1x_RxDebugLog(InstancePtr, "computations complete"); /* Read theRo */ Ro = XHdcp1x_CipherGetRo(InstancePtr); /* Initialize Buf */ memset(Buf, 0, 4); XHDCP1X_PORT_UINT_TO_BUF(Buf, Ro, 16); /* Update the value of Ro' */ XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_RO, Buf, 2); #if (defined(XPAR_XV_HDMIRX_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX_NUM_INSTANCES > 0)) || \ (defined(XPAR_XV_HDMIRX1_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX1_NUM_INSTANCES > 0)) /* No reset required in the sofware for HDMI. KSV fifo * pointer reset is implemented in the hardware. */ #else u32 KSVPtrReset = 0; /* Reset the KSV FIFO read pointer to ox6802C */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_HDCP_RESET_KSV, &KSVPtrReset, 4); KSVPtrReset |= XHDCP1X_PORT_HDCP_RESET_KSV_RST; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_HDCP_RESET_KSV, &KSVPtrReset, 4); KSVPtrReset &= ~XHDCP1X_PORT_HDCP_RESET_KSV_RST; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_HDCP_RESET_KSV, &KSVPtrReset, 4); #if defined(XHDCP1X_PORT_BIT_BSTATUS_RO_AVAILABLE) /* Update the Bstatus to indicate Ro' available */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf, XHDCP1X_PORT_SIZE_BSTATUS); Buf[0] |= XHDCP1X_PORT_BIT_BSTATUS_RO_AVAILABLE; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf, XHDCP1X_PORT_SIZE_BSTATUS); #endif #endif if (InstancePtr->IsRepeater) { *NextStatePtr = XHDCP1X_STATE_WAITFORDOWNSTREAM; if (InstancePtr->Rx. IsRepeaterDownstreamAuthCallbackSet) { if (InstancePtr->Rx. RepeaterDownstreamAuthCallback != NULL) { InstancePtr->Rx.RepeaterDownstreamAuthCallback (InstancePtr->Rx.RepeaterDownstreamAuthRef); } else { XHdcp1x_RxDebugLog(InstancePtr, "Warning: Repeater Downstream" "interface not triggered," "CallBack not Initialized !!!"); } } } else { *NextStatePtr = XHDCP1X_STATE_AUTHENTICATED; } } else { XHdcp1x_RxDebugLog(InstancePtr, "waiting for computations"); } } /*****************************************************************************/ /** * This function calculates the SHA-1 Hash value for the Repeater Rx interface. * * @param InstancePtr is the hdcp state machine. * @param RepeaterInfo is the repeater information. * * @return Truth value indicating valid (TRUE) or invalid (FALSE). * * @note None. * ******************************************************************************/ static int XHdcp1x_RxCalculateSHA1Value(XHdcp1x *InstancePtr, u16 RepeaterInfo) { SHA1Context Sha1Context; u8 Buf[24]; u32 NumToRead = 0; int IsValid = FALSE; u32 KsvCount; u64 tempKsv; /* Initialize Buf */ memset(Buf, 0, 24); /* Initialize Sha1Context */ SHA1Reset(&Sha1Context); /* Assume success */ IsValid = TRUE; /* Determine theNumToRead */ NumToRead = ((RepeaterInfo & 0x7Fu)); /* Read one ksv at a time from the * Ksv List and send it to SHA1 Input */ KsvCount = 0; while (KsvCount < NumToRead) { if (InstancePtr->RepeaterValues.DeviceCount > 0) { tempKsv = InstancePtr->RepeaterValues.KsvList[KsvCount]; XHDCP1X_PORT_UINT_TO_BUF(Buf , tempKsv , (XHDCP1X_PORT_SIZE_BKSV*8)); SHA1Input(&Sha1Context , Buf , XHDCP1X_PORT_SIZE_BKSV); } else { IsValid = FALSE; } KsvCount++; } /* Check for success */ if (IsValid) { u64 Mo = 0; u8 Sha1Result[SHA1HashSize]; /* Insert RepeaterInfo into the SHA-1 transform */ Buf[0] = (u8) (RepeaterInfo & 0xFFu); Buf[1] = (u8) ((RepeaterInfo >> 8) & 0xFFu); SHA1Input(&Sha1Context, Buf, 2); /* Insert the Mo into the SHA-1 transform */ Mo = XHdcp1x_CipherGetMo(InstancePtr); XHDCP1X_PORT_UINT_TO_BUF(Buf, Mo, 64); SHA1Input(&Sha1Context, Buf, 8); /* Finalize the SHA-1 result and confirm success */ if (SHA1Result(&Sha1Context, Sha1Result) == shaSuccess) { /* Offset(XHDCP1X_PORT_OFFSET_VH0) = 0 */ u8 Offset = 0; const u8 *Sha1Buf = Sha1Result; int NumIterations = (SHA1HashSize >> 2); /* Iterate through the SHA-1 chunks */ do { u32 CalcValue = 0; /* Determine CalcValue */ CalcValue = *Sha1Buf++; CalcValue <<= 8; CalcValue |= *Sha1Buf++; CalcValue <<= 8; CalcValue |= *Sha1Buf++; CalcValue <<= 8; CalcValue |= *Sha1Buf++; /* Update the V' value in the Instance * Pointer for the HDCP state machine */ InstancePtr->RepeaterValues.V[Offset] = CalcValue; /* Update for loop */ Offset++; NumIterations--; } while (NumIterations > 0); } /* Otherwise */ else { IsValid = FALSE; } } return (IsValid); } /*****************************************************************************/ /** * This function does the necessary actions to update HDCP * after the topology has been set. * * @param InstancePtr is a pointer to the Hdcp1x core instance. * * @return None. * * @note None. ******************************************************************************/ void XHdcp1x_RxSetTopologyUpdate(XHdcp1x *InstancePtr) { /* Post the re-authentication request */ XHdcp1x_RxPostEvent(InstancePtr, XHDCP1X_EVENT_DOWNSTREAMREADY); } /*****************************************************************************/ /** * This function sets the RepeaterInfo value int the HDCP RX instance * * @param InstancePtr is a pointer to the Hdcp1x core instance. * @param TopologyPtr is the pointer to topology information. * * @return None. * * @note None. ******************************************************************************/ void XHdcp1x_RxSetTopology(XHdcp1x *InstancePtr, const XHdcp1x_RepeaterExchange *TopologyPtr) { memcpy(&(InstancePtr->RepeaterValues), TopologyPtr, sizeof(XHdcp1x_RepeaterExchange)); } /*****************************************************************************/ /** * This function sets the KSVList value(s) in the HDCP RX KSV Fifo register * space for the upstream interface to read. * * @param InstancePtr is a pointer to the Hdcp1x core instance. * @param ListPtr is a pointer to the KSV list. * @param ListSize is the number of KSVs in the list. * * @return None. * * @note None. ******************************************************************************/ void XHdcp1x_RxSetTopologyKSVList(XHdcp1x *InstancePtr, u8 *ListPtr, u32 ListSize) { u32 i; for(i=0 ; i<ListSize; i++) { memcpy(&InstancePtr->RepeaterValues.KsvList[i], (ListPtr + (i*5)), XHDCP1X_PORT_SIZE_BKSV); } } /*****************************************************************************/ /** * This function sets the Depth value in the HDCP RX BStatus/BInfo register * space for the upstream interface to read. * * @param InstancePtr is a pointer to the Hdcp1x core instance. * @param Value is the Depth value. * * @return None. * * @note None. ******************************************************************************/ void XHdcp1x_RxSetTopologyDepth(XHdcp1x *InstancePtr, u32 Value) { InstancePtr->RepeaterValues.Depth = Value; } /*****************************************************************************/ /** * This function sets the DEVICE_COUNT value in the HDCP RX register space * for the upstream interface to read. * * @param InstancePtr is a pointer to the Hdcp1x core instance. * @param Value is the device count value. * * @return None. * * @note None. ******************************************************************************/ void XHdcp1x_RxSetTopologyDeviceCnt(XHdcp1x *InstancePtr, u32 Value) { InstancePtr->RepeaterValues.DeviceCount = Value; } /*****************************************************************************/ /** * This function sets the MAX_CASCADE_EXCEEDED error flag in the HDCP * BStatus/BInfo register to indicate a topology error. Setting the flag * indicates a depth of more than (4 - 1). * * @param InstancePtr is a pointer to the Hdcp1x core instance. * @param Value is either TRUE or FALSE. * * @return None. * * @note None. ******************************************************************************/ void XHdcp1x_RxSetTopologyMaxCascadeExceeded(XHdcp1x *InstancePtr, u8 Value) { #if (defined(XPAR_XV_HDMIRX_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX_NUM_INSTANCES > 0)) || \ (defined(XPAR_XV_HDMIRX1_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX1_NUM_INSTANCES > 0)) u32 BStatus; /* Update the value of Max Devices exceeded in BStatus */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &BStatus, XHDCP1X_PORT_SIZE_BSTATUS); BStatus |= (u32)(Value << XHDCP1X_PORT_BSTATUS_DEPTH_ERR_SHIFT); XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &BStatus, XHDCP1X_PORT_SIZE_BSTATUS); #else u32 BInfo; /* Update the value of Depth in BInfo */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BINFO, &BInfo, XHDCP1X_PORT_SIZE_BINFO); BInfo |= (Value << XHDCP1X_PORT_BINFO_DEPTH_ERR_SHIFT); XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BINFO, &BInfo, XHDCP1X_PORT_SIZE_BINFO); #endif } /*****************************************************************************/ /** * This function sets the MAX_DEVS_EXCEEDED error flag in the HDCP * BStatus register to indicate a topology error. Setting the flag * indicates that more than 31 downstream devices are attached. * * @param InstancePtr is a pointer to the Hdcp1x core instance. * @param Value is either TRUE or FALSE. * * @return None. * * @note None. ******************************************************************************/ void XHdcp1x_RxSetTopologyMaxDevsExceeded(XHdcp1x *InstancePtr, u8 Value) { /* Verify arguments */ Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(Value == FALSE || Value == TRUE); #if (defined(XPAR_XV_HDMIRX_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX_NUM_INSTANCES > 0)) || \ (defined(XPAR_XV_HDMIRX1_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX1_NUM_INSTANCES > 0)) u16 DevCntErr = (Value & 0xFFFF); u32 BStatus; /* Update the value of Max Devices exceeded in BStatus */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &BStatus, XHDCP1X_PORT_SIZE_BSTATUS); BStatus |= (DevCntErr << XHDCP1X_PORT_BSTATUS_DEV_CNT_ERR_SHIFT); XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &BStatus, XHDCP1X_PORT_SIZE_BSTATUS); #else u32 BInfo; /* Update the value of Depth in BInfo */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BINFO, &BInfo, XHDCP1X_PORT_SIZE_BINFO); BInfo |= (Value << XHDCP1X_PORT_BINFO_DEV_CNT_ERR_SHIFT); XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BINFO, &BInfo, XHDCP1X_PORT_SIZE_BINFO); #endif } /*****************************************************************************/ /** * This function set the HDMI_MODE in the BStatus register of the HDMI RX DDC * space. * * @param InstancePtr is a pointer to the Hdcp1x core instance. * @param Value is the truth-value. * * @return None. * * @note None. ******************************************************************************/ void XHdcp1x_RxSetHdmiMode(XHdcp1x *InstancePtr, u8 Value) { /* Verify arguments */ Xil_AssertVoid(InstancePtr != NULL); #if (defined(XPAR_XV_HDMIRX_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX_NUM_INSTANCES > 0)) || \ (defined(XPAR_XV_HDMIRX1_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX1_NUM_INSTANCES > 0)) u32 BStatus; /* Update the value of HDMI_MODE bit in the BStatus Register */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &BStatus, XHDCP1X_PORT_SIZE_BSTATUS); if (Value == TRUE) { BStatus |= XHDCP1X_PORT_BIT_BSTATUS_HDMI_MODE; } else { BStatus &= ~XHDCP1X_PORT_BIT_BSTATUS_HDMI_MODE; } XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &BStatus, XHDCP1X_PORT_SIZE_BSTATUS); #else UNUSED(Value); #endif } /*****************************************************************************/ /** * This function writes the KSV List and the BInfo values to the RX * DPCD register space and sets the READY bit. * * @param InstancePtr is the receiver instance. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxAssembleKSVList(XHdcp1x *InstancePtr, XHdcp1x_StateType *NextStatePtr) { /* Verify arguments. */ Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(NextStatePtr != NULL); /* Check if the max cascade and max depth is not exceeded */ if (InstancePtr->RepeaterValues.Depth > XHDCP1X_RPTR_MAX_CASCADE) { XHdcp1x_RxDebugLog(InstancePtr, "Repeater maximum\ cascade exceeded"); *NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED; } else if (InstancePtr->RepeaterValues.DeviceCount > XHDCP1X_RPTR_MAX_DEVS_COUNT) { XHdcp1x_RxDebugLog(InstancePtr, "Repeater maximum\ Depth exceeded"); *NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED; } else { #if (defined(XPAR_XV_HDMIRX_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX_NUM_INSTANCES > 0)) || \ (defined(XPAR_XV_HDMIRX1_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX1_NUM_INSTANCES > 0)) u32 BCaps; #else u32 BInfo; u32 KSVPtrReset; #endif u32 BStatus; u8 Buf[5]; u8 Buf_full[XHDCP1X_PORT_SIZE_BKSV * XHDCP1X_RPTR_MAX_DEVS_COUNT]; u32 sha1value; u32 ksvCount, ksvsToWrite; u16 RepeaterInfo = 0; #if (defined(XPAR_XV_HDMIRX_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX_NUM_INSTANCES > 0)) || \ (defined(XPAR_XV_HDMIRX1_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX1_NUM_INSTANCES > 0)) /* Ensure that the READY bit is clear */ /* Update the Ready bit in the BCaps Register */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BCAPS, &BCaps, XHDCP1X_PORT_SIZE_BCAPS); if(BCaps & XHDCP1X_PORT_BIT_BCAPS_READY) { BCaps &= ~XHDCP1X_PORT_BIT_BCAPS_READY; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BCAPS , &BCaps, XHDCP1X_PORT_SIZE_BCAPS); } /* Update the value of Depth and Device count in BStatus */ memset(Buf,0,5); XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &BStatus, XHDCP1X_PORT_SIZE_BSTATUS); BStatus |= ((InstancePtr->RepeaterValues.Depth<<8) & 0x0700); BStatus |= ((InstancePtr->RepeaterValues.DeviceCount) & 0x007F); BStatus |= XHDCP1X_PORT_BIT_BSTATUS_HDMI_MODE; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &BStatus, XHDCP1X_PORT_SIZE_BSTATUS); #else /* Update the value of Depth in BInfo */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BINFO, &BInfo, XHDCP1X_PORT_SIZE_BINFO); BInfo |= ((InstancePtr->RepeaterValues.Depth<<8) & 0x0700); XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BINFO, &BInfo, XHDCP1X_PORT_SIZE_BINFO); /*Update the value of Device Count in the BInfo register */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BINFO, &BInfo, XHDCP1X_PORT_SIZE_BINFO); BInfo |= ((InstancePtr->RepeaterValues.DeviceCount) & 0x007F); XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BINFO, &BInfo, XHDCP1X_PORT_SIZE_BINFO); XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BINFO, &BInfo, XHDCP1X_PORT_SIZE_BINFO); #endif /* Update the KSV List in the KSV Fifo */ ksvsToWrite = InstancePtr->RepeaterValues.DeviceCount; ksvCount = 0; while(ksvsToWrite>0) { u64 tempKsv; memset(Buf,0,5); tempKsv = InstancePtr->RepeaterValues.KsvList[ksvCount]; XHDCP1X_PORT_UINT_TO_BUF(Buf, tempKsv , (XHDCP1X_PORT_SIZE_BKSV * 8)); #if (defined(XPAR_XV_HDMIRX_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX_NUM_INSTANCES > 0)) || \ (defined(XPAR_XV_HDMIRX1_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX1_NUM_INSTANCES > 0)) /* Write the KSV to the HDCP_DAT register each time, * The KSV Fifo will auto increment */ XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_KSVFIFO, Buf, XHDCP1X_PORT_SIZE_BKSV); #else memcpy((Buf_full + (ksvCount * XHDCP1X_PORT_SIZE_BKSV)), Buf, XHDCP1X_PORT_SIZE_BKSV); if (ksvsToWrite == 1) { XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_KSVFIFO, Buf_full, (InstancePtr->RepeaterValues.DeviceCount * XHDCP1X_PORT_SIZE_BKSV)); } #endif ksvCount++; ksvsToWrite -= 1; } #if (defined(XPAR_XV_HDMIRX_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX_NUM_INSTANCES > 0)) || \ (defined(XPAR_XV_HDMIRX1_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX1_NUM_INSTANCES > 0)) RepeaterInfo = (XHDCP1X_PORT_BIT_BSTATUS_HDMI_MODE) | (XHDCP1X_PORT_BSTATUS_BIT_DEPTH_NO_ERR) | (InstancePtr->RepeaterValues.Depth << XHDCP1X_PORT_BSTATUS_DEPTH_SHIFT) | (XHDCP1X_PORT_BSTATUS_BIT_DEV_CNT_NO_ERR) | (InstancePtr->RepeaterValues.DeviceCount & XHDCP1X_PORT_BSTATUS_DEV_CNT_MASK); #else RepeaterInfo = (XHDCP1X_PORT_BINFO_BIT_DEPTH_NO_ERR) | (InstancePtr->RepeaterValues.Depth << XHDCP1X_PORT_BINFO_DEPTH_SHIFT) | (XHDCP1X_PORT_BINFO_BIT_DEV_CNT_NO_ERR) | (InstancePtr->RepeaterValues.DeviceCount & XHDCP1X_PORT_BINFO_DEV_CNT_MASK); #endif XHdcp1x_RxCalculateSHA1Value(InstancePtr,RepeaterInfo); #if (defined(XPAR_XV_HDMIRX_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX_NUM_INSTANCES > 0)) || \ (defined(XPAR_XV_HDMIRX1_NUM_INSTANCES) && \ (XPAR_XV_HDMIRX1_NUM_INSTANCES > 0)) /* Update the value of V'H0 */ sha1value = 0; sha1value = InstancePtr->RepeaterValues.V[0]; XHDCP1X_PORT_UINT_TO_BUF(Buf, sha1value , (XHDCP1X_PORT_SIZE_VH0 * 8)); XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_VH0, Buf, XHDCP1X_PORT_SIZE_VH0); /* Update the value of V'H1 */ sha1value = InstancePtr->RepeaterValues.V[1]; XHDCP1X_PORT_UINT_TO_BUF(Buf, sha1value , (XHDCP1X_PORT_SIZE_VH1 * 8)); XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_VH1, Buf, XHDCP1X_PORT_SIZE_VH1); /* Update the value of V'H2 */ sha1value = InstancePtr->RepeaterValues.V[2]; XHDCP1X_PORT_UINT_TO_BUF(Buf, sha1value , (XHDCP1X_PORT_SIZE_VH2 * 8)); XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_VH2, Buf , XHDCP1X_PORT_SIZE_VH2); /* Update the value of V'H3 */ sha1value = InstancePtr->RepeaterValues.V[3]; XHDCP1X_PORT_UINT_TO_BUF(Buf, sha1value , (XHDCP1X_PORT_SIZE_VH3 * 8)); XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_VH3, Buf , XHDCP1X_PORT_SIZE_VH3); /* Update the value of V'H4 */ sha1value = InstancePtr->RepeaterValues.V[4]; XHDCP1X_PORT_UINT_TO_BUF(Buf, sha1value , (XHDCP1X_PORT_SIZE_VH4 * 8)); XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_VH4, Buf, XHDCP1X_PORT_SIZE_VH4); /* Update the Ready bit in the BCaps Register */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BCAPS, &BCaps, XHDCP1X_PORT_SIZE_BCAPS); BCaps |= XHDCP1X_PORT_BIT_BCAPS_READY; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BCAPS , &BCaps, XHDCP1X_PORT_SIZE_BCAPS); #else /* Update the value of V'H0 */ sha1value = 0; sha1value = InstancePtr->RepeaterValues.V[0]; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_VH0, &sha1value, XHDCP1X_PORT_SIZE_VH0); /* Update the value of V'H1 */ sha1value = InstancePtr->RepeaterValues.V[1]; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_VH1, &sha1value, XHDCP1X_PORT_SIZE_VH1); /* Update the value of V'H2 */ sha1value = InstancePtr->RepeaterValues.V[2]; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_VH2, &sha1value , XHDCP1X_PORT_SIZE_VH2); /* Update the value of V'H3 */ sha1value = InstancePtr->RepeaterValues.V[3]; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_VH3, &sha1value , XHDCP1X_PORT_SIZE_VH3); /* Update the value of V'H4 */ sha1value = InstancePtr->RepeaterValues.V[4]; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_VH4, &sha1value, XHDCP1X_PORT_SIZE_VH4); /* Reset the KSV FIFO read pointer to ox6802C */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_HDCP_RESET_KSV, &KSVPtrReset, XHDCP1X_PORT_SIZE_HDCP_RESET_KSV); KSVPtrReset |= XHDCP1X_PORT_HDCP_RESET_KSV_RST; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_HDCP_RESET_KSV, &KSVPtrReset, XHDCP1X_PORT_SIZE_HDCP_RESET_KSV); KSVPtrReset &= ~XHDCP1X_PORT_HDCP_RESET_KSV_RST; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_HDCP_RESET_KSV, &KSVPtrReset, XHDCP1X_PORT_SIZE_HDCP_RESET_KSV); /* Update the Ready bit in the BStatus Register */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, &BStatus, XHDCP1X_PORT_SIZE_BSTATUS); BStatus |= XHDCP1X_PORT_BIT_BSTATUS_READY; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS , &BStatus, XHDCP1X_PORT_SIZE_BSTATUS); #endif *NextStatePtr = XHDCP1X_STATE_AUTHENTICATED; } } /*****************************************************************************/ /** * This function updates the Ro'/Ri' register of the state machine. * * @param InstancePtr is the receiver instance. * @param NextStatePtr is the next state. * * @return None. * * @note This function has to save the value of Ri (in RememberRi) as * the macro that converts from a uint16 to a HDCP buffer * destroys the original value. * ******************************************************************************/ static void XHdcp1x_RxUpdateRi(XHdcp1x *InstancePtr) { char LogBuf[20]; u8 Buf[4]; u16 Ri = 0; u16 RememberRi = 0; /* Read Ri */ Ri = XHdcp1x_CipherGetRi(InstancePtr); /* Update RememberRi */ RememberRi = Ri; /* Initialize theBuf */ memset(Buf, 0, 4); XHDCP1X_PORT_UINT_TO_BUF(Buf, Ri, XHDCP1X_PORT_SIZE_RO * 8); /* Update the value of Ro' */ XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_RO, Buf, sizeof(Ri)); #if defined(XHDCP1X_PORT_BIT_BSTATUS_RO_AVAILABLE) /* Update the Bstatus to indicate Ro' available */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf, XHDCP1X_PORT_SIZE_BSTATUS); Buf[0] |= XHDCP1X_PORT_BIT_BSTATUS_RO_AVAILABLE; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf, XHDCP1X_PORT_SIZE_BSTATUS); #endif /* Update statistics */ InstancePtr->Rx.Stats.RiUpdates++; /* Determine theLogBuf */ snprintf(LogBuf, 20, "update Ri (%04X)", RememberRi); /* Log */ XHdcp1x_RxDebugLog(InstancePtr, LogBuf); } /*****************************************************************************/ /** * This functions handles check the integrity of the link. * * @param InstancePtr is the receiver instance. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxCheckLinkIntegrity(XHdcp1x *InstancePtr, XHdcp1x_StateType *NextStatePtr) { if (XHdcp1x_CipherIsLinkUp(InstancePtr)) { *NextStatePtr = XHDCP1X_STATE_AUTHENTICATED; } else { *NextStatePtr = XHDCP1X_STATE_LINKINTEGRITYFAILED; } } /*****************************************************************************/ /** * This functions handles check if the encryption status (enable/disable) of * the HDCP cipher has changed. * * @param InstancePtr is the receiver instance. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxCheckEncryptionChange(XHdcp1x *InstancePtr) { InstancePtr->Rx.XORState.PreviousState = InstancePtr->Rx.XORState.CurrentState; InstancePtr->Rx.XORState.CurrentState = XHdcp1x_CipherXorInProgress(InstancePtr); /* Check if encrypted */ if (InstancePtr->Rx.XORState.CurrentState != InstancePtr->Rx.XORState.PreviousState) { /* Call encryption update callback */ if (InstancePtr->Rx.IsEncryptionUpdateCallbackSet) { InstancePtr->Rx.EncryptionUpdateCallback( InstancePtr->Rx.EncryptionUpdateCallbackRef); } } /* Start a 2 second timer again */ XHdcp1x_RxStartTimer(InstancePtr, (2 * XVPHY_TMO_1SECOND)); } /*****************************************************************************/ /** * This functions reports the failure of link integrity. * * @param InstancePtr is the receiver instance. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxReportLinkIntegrityFailure(XHdcp1x *InstancePtr, XHdcp1x_StateType *NextStatePtr) { /* NextStatePtr not being used */ UNUSED(NextStatePtr); #if defined(XHDCP1X_PORT_BIT_BSTATUS_LINK_FAILURE) u8 Buf[XHDCP1X_PORT_SIZE_BSTATUS]; /* Update the Bstatus register */ XHdcp1x_PortRead(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf, XHDCP1X_PORT_SIZE_BSTATUS); Buf[0] |= XHDCP1X_PORT_BIT_BSTATUS_LINK_FAILURE; XHdcp1x_PortWrite(InstancePtr, XHDCP1X_PORT_OFFSET_BSTATUS, Buf, XHDCP1X_PORT_SIZE_BSTATUS); #endif /* Log */ XHdcp1x_RxDebugLog(InstancePtr, "link integrity failed"); } /*****************************************************************************/ /** * This function runs the "disabled" state of the receiver state machine. * * @param InstancePtr is the receiver instance. * @param Event is the event to process. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxRunDisabledState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr) { /* Case-wise process the kind of event called */ switch (Event) { /* For enable */ case XHDCP1X_EVENT_ENABLE: *NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED; if ((InstancePtr->Rx.Flags & XVPHY_FLAG_PHY_UP) == 0) { *NextStatePtr = XHDCP1X_STATE_PHYDOWN; } break; /* For physical layer down */ case XHDCP1X_EVENT_PHYDOWN: InstancePtr->Rx.Flags &= ~XVPHY_FLAG_PHY_UP; break; /* For physical layer up */ case XHDCP1X_EVENT_PHYUP: InstancePtr->Rx.Flags |= XVPHY_FLAG_PHY_UP; break; /* Otherwise */ default: /* Do nothing */ break; } } /*****************************************************************************/ /** * This function runs the "unauthenticated" state of the receiver state machine. * * @param InstancePtr is the receiver instance. * @param Event is the event to process. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxRunUnauthenticatedState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr) { /* InstancePtr not being used */ UNUSED(InstancePtr); /* Case-wise process the kind of event called */ switch (Event) { /* For authenticate */ case XHDCP1X_EVENT_AUTHENTICATE: *NextStatePtr = XHDCP1X_STATE_COMPUTATIONS; break; /* For disable */ case XHDCP1X_EVENT_DISABLE: *NextStatePtr = XHDCP1X_STATE_DISABLED; break; /* For physical layer down */ case XHDCP1X_EVENT_PHYDOWN: *NextStatePtr = XHDCP1X_STATE_PHYDOWN; break; /* Otherwise */ default: /* Do nothing */ break; } } /*****************************************************************************/ /** * This function runs the "computations" state of the receiver state machine. * * @param InstancePtr is the receiver instance. * @param Event is the event to process. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxRunComputationsState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr) { /* Case-wise process the kind of event called */ switch (Event) { /* For authenticate */ case XHDCP1X_EVENT_AUTHENTICATE: XHdcp1x_RxStartComputations(InstancePtr, NextStatePtr); break; /* For disable */ case XHDCP1X_EVENT_DISABLE: *NextStatePtr = XHDCP1X_STATE_DISABLED; break; /* For physical layer down */ case XHDCP1X_EVENT_PHYDOWN: *NextStatePtr = XHDCP1X_STATE_PHYDOWN; break; /* For poll */ case XHDCP1X_EVENT_POLL: XHdcp1x_RxPollForComputations(InstancePtr, NextStatePtr); break; /* Otherwise */ default: /* Do nothing */ break; } } /*****************************************************************************/ /** * This function runs the "wait for downstream" state of the receiver state machine. * * @param InstancePtr is the receiver instance. * @param Event is the event to process. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxRunWaitForDownstreamState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr) { /* InstancePtr not being used */ UNUSED(InstancePtr); /* Case-wise process the kind of event called */ switch (Event) { /* For authenticate */ case XHDCP1X_EVENT_AUTHENTICATE: *NextStatePtr = XHDCP1X_STATE_COMPUTATIONS; break; /* For disable */ case XHDCP1X_EVENT_DISABLE: *NextStatePtr = XHDCP1X_STATE_DISABLED; break; /* For physical layer down */ case XHDCP1X_EVENT_PHYDOWN: *NextStatePtr = XHDCP1X_STATE_PHYDOWN; break; /* For timeout event */ case XHDCP1X_EVENT_TIMEOUT: *NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED; break; case XHDCP1X_EVENT_DOWNSTREAMREADY: *NextStatePtr = XHDCP1X_STATE_ASSEMBLEKSVLIST; break; case XHDCP1X_EVENT_NULL: /*Do nothing */ break; case XHDCP1X_EVENT_CHECK: /*Do nothing */ break; case XHDCP1X_EVENT_ENABLE: /* Do nothing */ break; case XHDCP1X_EVENT_PHYUP: /* Do nothing */ break; case XHDCP1X_EVENT_POLL: /* Do nothing */ break; case XHDCP1X_EVENT_UPDATERi: /* Do nothing */ break; } } /*****************************************************************************/ /** * This function runs the "assemble KSV list" state of the receiver state machine. * * @param InstancePtr is the receiver instance. * @param Event is the event to process. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxRunAssembleKsvListState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr) { /* InstancePtr not being used */ UNUSED(InstancePtr); /* Case-wise process the kind of event called */ switch (Event) { /* For disable */ case XHDCP1X_EVENT_DISABLE: *NextStatePtr = XHDCP1X_STATE_DISABLED; break; /* For physical layer down */ case XHDCP1X_EVENT_PHYDOWN: *NextStatePtr = XHDCP1X_STATE_PHYDOWN; break; case XHDCP1X_EVENT_NULL: /* Do nothing */ break; case XHDCP1X_EVENT_AUTHENTICATE: /* Do nothing */ break; case XHDCP1X_EVENT_CHECK: /* Do nothing */ break; case XHDCP1X_EVENT_ENABLE: /* Do nothing */ break; case XHDCP1X_EVENT_PHYUP: /* Do nothing */ break; case XHDCP1X_EVENT_POLL: /* Do nothing */ break; case XHDCP1X_EVENT_UPDATERi: /* Do nothing */ break; case XHDCP1X_EVENT_TIMEOUT: /* Do nothing */ break; case XHDCP1X_EVENT_DOWNSTREAMREADY: /* Do nothing */ break; } } /*****************************************************************************/ /** * This function runs the "authenticated" state of the receiver state machine. * * @param InstancePtr is the receiver instance. * @param Event is the event to process. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxRunAuthenticatedState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr) { /* Case-wise process the kind of event called */ switch (Event) { /* For authenticate */ case XHDCP1X_EVENT_AUTHENTICATE: *NextStatePtr = XHDCP1X_STATE_COMPUTATIONS; break; /* For check */ case XHDCP1X_EVENT_CHECK: XHdcp1x_RxCheckLinkIntegrity(InstancePtr, NextStatePtr); break; /* For disable */ case XHDCP1X_EVENT_DISABLE: *NextStatePtr = XHDCP1X_STATE_DISABLED; break; /* For physical layer down */ case XHDCP1X_EVENT_PHYDOWN: *NextStatePtr = XHDCP1X_STATE_PHYDOWN; break; /* For update Ri */ case XHDCP1X_EVENT_UPDATERi: XHdcp1x_RxUpdateRi(InstancePtr); break; /* In every 2 second priodically checks encryption status */ case XHDCP1X_EVENT_TIMEOUT: XHdcp1x_RxCheckEncryptionChange(InstancePtr); break; /* Otherwise */ default: /* Do nothing */ break; } } /*****************************************************************************/ /** * This function runs the "link integrity failed" state of the receiver state * machine. * * @param InstancePtr is the receiver instance. * @param Event is the event to process. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxRunLinkIntegrityFailedState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr) { /* Case-wise process the kind of event called */ switch (Event) { /* For authenticate */ case XHDCP1X_EVENT_AUTHENTICATE: *NextStatePtr = XHDCP1X_STATE_COMPUTATIONS; break; /* For check */ case XHDCP1X_EVENT_CHECK: XHdcp1x_RxCheckLinkIntegrity(InstancePtr, NextStatePtr); break; /* For disable */ case XHDCP1X_EVENT_DISABLE: *NextStatePtr = XHDCP1X_STATE_DISABLED; break; /* For physical layer down */ case XHDCP1X_EVENT_PHYDOWN: *NextStatePtr = XHDCP1X_STATE_PHYDOWN; break; /* Otherwise */ default: /* Do nothing */ break; } } /*****************************************************************************/ /** * This function runs the "physical layer down" state of the receiver state * machine. * * @param InstancePtr is the receiver instance. * @param Event is the event to process. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxRunPhysicalLayerDownState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event, XHdcp1x_StateType *NextStatePtr) { /* InstancePtr not being used */ UNUSED(InstancePtr); /* Case-wise process the kind of event called */ switch (Event) { /* For disable */ case XHDCP1X_EVENT_DISABLE: *NextStatePtr = XHDCP1X_STATE_DISABLED; break; /* For physical layer up */ case XHDCP1X_EVENT_PHYUP: *NextStatePtr = XHDCP1X_STATE_UNAUTHENTICATED; break; /* Otherwise */ default: /* Do nothing */ break; } } /*****************************************************************************/ /** * This function enters a HDCP receiver state. * * @param InstancePtr is the receiver instance. * @param State is the state to enter. * @param NextStatePtr is the next state. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxEnterState(XHdcp1x *InstancePtr, XHdcp1x_StateType State, XHdcp1x_StateType *NextStatePtr) { /* Case-wise process the kind of state called */ switch (State) { /* For the disabled state */ case XHDCP1X_STATE_DISABLED: XHdcp1x_RxDisableState(InstancePtr); break; /* For the unauthenticated state */ case XHDCP1X_STATE_UNAUTHENTICATED: XHdcp1x_RxSetCheckLinkState(InstancePtr, FALSE); InstancePtr->Rx.Flags |= XVPHY_FLAG_PHY_UP; if (InstancePtr->Rx.IsUnauthenticatedCallbackSet) { InstancePtr->Rx.UnauthenticatedCallback( InstancePtr->Rx.UnauthenticatedCallbackRef); } break; /* For the computations state */ case XHDCP1X_STATE_COMPUTATIONS: XHdcp1x_RxStartComputations(InstancePtr, NextStatePtr); break; /* For the wait-for-downstream state */ case XHDCP1X_STATE_WAITFORDOWNSTREAM: XHdcp1x_RxSetCheckLinkState(InstancePtr, TRUE); XHdcp1x_RxStartTimer(InstancePtr, ((5 * XVPHY_TMO_1SECOND) + (5 * XVPHY_TMO_100MS)) ); break; /* For assemble KSV list */ case XHDCP1X_STATE_ASSEMBLEKSVLIST: XHdcp1x_RxAssembleKSVList(InstancePtr, NextStatePtr); break; /* For the authenticated state */ case XHDCP1X_STATE_AUTHENTICATED: XHdcp1x_RxDebugLog(InstancePtr, "authenticated"); XHdcp1x_RxSetCheckLinkState(InstancePtr, TRUE); if(InstancePtr->Rx.IsAuthenticatedCallbackSet) { InstancePtr->Rx.AuthenticatedCallback( InstancePtr->Rx.AuthenticatedCallbackRef); } XHdcp1x_RxStartTimer(InstancePtr, (2 * XVPHY_TMO_1SECOND)); break; /* For the link integrity failed state */ case XHDCP1X_STATE_LINKINTEGRITYFAILED: InstancePtr->Rx.Stats.LinkFailures++; XHdcp1x_RxReportLinkIntegrityFailure(InstancePtr, NextStatePtr); break; /* For physical layer down */ case XHDCP1X_STATE_PHYDOWN: InstancePtr->Rx.Flags &= ~XVPHY_FLAG_PHY_UP; XHdcp1x_CipherDisable(InstancePtr); break; /* Otherwise */ default: /* Do nothing */ break; } } /*****************************************************************************/ /** * This function exits a HDCP receiver state. * * @param InstancePtr is the receiver instance. * @param State is the state to exit. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxExitState(XHdcp1x *InstancePtr, XHdcp1x_StateType State) { /* Case-wise process the kind of state called */ switch (State) { /* For the disabled state */ case XHDCP1X_STATE_DISABLED: XHdcp1x_RxEnableState(InstancePtr); break; /* For the authenticated state */ case XHDCP1X_STATE_AUTHENTICATED: XHdcp1x_RxStopTimer(InstancePtr); XHdcp1x_RxSetCheckLinkState(InstancePtr, FALSE); break; /* For physical layer down */ case XHDCP1X_STATE_PHYDOWN: XHdcp1x_CipherEnable(InstancePtr); break; /* For wait-for-downstream ready */ case XHDCP1X_STATE_WAITFORDOWNSTREAM: XHdcp1x_RxStopTimer(InstancePtr); /* Otherwise */ default: /* Do nothing */ break; } } /*****************************************************************************/ /** * This function drives a HDCP receiver state machine. * * @param InstancePtr is the receiver instance. * @param Event is the event to process. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxDoTheState(XHdcp1x *InstancePtr, XHdcp1x_EventType Event) { XHdcp1x_StateType NextState = InstancePtr->Rx.CurrentState; /* Case-wise process the kind of state called */ switch (InstancePtr->Rx.CurrentState) { /* For the disabled state */ case XHDCP1X_STATE_DISABLED: XHdcp1x_RxRunDisabledState(InstancePtr, Event, &NextState); break; /* For the unauthenticated state */ case XHDCP1X_STATE_UNAUTHENTICATED: XHdcp1x_RxRunUnauthenticatedState(InstancePtr, Event, &NextState); break; /* For the computations state */ case XHDCP1X_STATE_COMPUTATIONS: XHdcp1x_RxRunComputationsState(InstancePtr, Event, &NextState); break; /* For the Wait For Downstream state */ case XHDCP1X_STATE_WAITFORDOWNSTREAM: XHdcp1x_RxRunWaitForDownstreamState(InstancePtr, Event, &NextState); break; /* For the assemble ksv list state */ case XHDCP1X_STATE_ASSEMBLEKSVLIST: XHdcp1x_RxRunAssembleKsvListState(InstancePtr, Event, &NextState); break; /* For the authenticated state */ case XHDCP1X_STATE_AUTHENTICATED: XHdcp1x_RxRunAuthenticatedState(InstancePtr, Event, &NextState); break; /* For the link integrity failed state */ case XHDCP1X_STATE_LINKINTEGRITYFAILED: XHdcp1x_RxRunLinkIntegrityFailedState(InstancePtr, Event, &NextState); break; /* For the physical layer down state */ case XHDCP1X_STATE_PHYDOWN: XHdcp1x_RxRunPhysicalLayerDownState(InstancePtr, Event, &NextState); break; /* Otherwise */ default: break; } /* Check for state change */ while (InstancePtr->Rx.CurrentState != NextState) { /* Perform the state transition */ XHdcp1x_RxExitState(InstancePtr, InstancePtr->Rx.CurrentState); InstancePtr->Rx.PreviousState = InstancePtr->Rx.CurrentState; InstancePtr->Rx.CurrentState = NextState; XHdcp1x_RxEnterState(InstancePtr, InstancePtr->Rx.CurrentState, &NextState); } } /*****************************************************************************/ /** * This function processes the events pending on a state machine. * * @param InstancePtr is the receiver instance. * * @return None. * * @note None. * ******************************************************************************/ static void XHdcp1x_RxProcessPending(XHdcp1x *InstancePtr) { /* Check for any pending events */ if (InstancePtr->Rx.PendingEvents != 0) { u16 Pending = InstancePtr->Rx.PendingEvents; XHdcp1x_EventType Event = XHDCP1X_EVENT_NULL; /* Update InstancePtr */ InstancePtr->Rx.PendingEvents = 0; /* Iterate through thePending */ do { /* Check for a pending event */ if ((Pending & 1u) != 0) { XHdcp1x_RxDoTheState(InstancePtr, Event); } /* Update for loop */ Pending >>= 1; Event++; } while (Pending != 0); } } /*****************************************************************************/ /** * This function converts from a state to a display string. * * @param State is the state to convert. * * @return The corresponding display string. * * @note None. * ******************************************************************************/ static const char *XHdcp1x_RxStateToString(XHdcp1x_StateType State) { const char *String = NULL; /* Case-wise process the input state */ switch (State) { case XHDCP1X_STATE_DISABLED: String = "disabled"; break; case XHDCP1X_STATE_UNAUTHENTICATED: String = "unauthenticated"; break; case XHDCP1X_STATE_COMPUTATIONS: String = "computations"; break; case XHDCP1X_STATE_WAITFORDOWNSTREAM: String = "wait-for-downstream"; break; case XHDCP1X_STATE_ASSEMBLEKSVLIST: String = "assemble-ksv-list"; break; case XHDCP1X_STATE_AUTHENTICATED: String = "authenticated"; break; case XHDCP1X_STATE_LINKINTEGRITYFAILED: String = "link-integrity-failed"; break; case XHDCP1X_STATE_PHYDOWN: String = "physical-layer-down"; break; default: String = "unknown?"; break; } return (String); } #if XHDCP1X_ADDITIONAL_DEBUG /*****************************************************************************/ /** * This function converts from a event to a display string. * * @param Event is the event to convert. * * @return The corresponding display string. * * @note None. * ******************************************************************************/ static const char *XHdcp1x_RxEventToString(XHdcp1x_EventType Event) { const char *String = NULL; /* Case-wise process the input event */ switch (Event) { case XHDCP1X_EVENT_NULL: String = "null"; break; case XHDCP1X_EVENT_AUTHENTICATE: String = "authenticate"; break; case XHDCP1X_EVENT_CHECK: String = "check"; break; case XHDCP1X_EVENT_DISABLE: String = "disable"; break; case XHDCP1X_EVENT_ENABLE: String = "enable"; break; case XHDCP1X_EVENT_PHYDOWN: String = "phy-down"; break; case XHDCP1X_EVENT_PHYUP: String = "phy-up"; break; case XHDCP1X_EVENT_POLL: String = "poll"; break; case XHDCP1X_EVENT_UPDATERi: String = "update-ri"; break; case XHDCP1X_EVENT_DOWNSTREAMREADY: String = "downstream-ready"; break; default: String = "unknown?"; break; } return (String); } #endif /** @} */
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="@TOOLS_VERSION@" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|@PLATFORM@"> <Configuration>Debug</Configuration> <Platform>@PLATFORM@</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|@PLATFORM@"> <Configuration>Release</Configuration> <Platform>@PLATFORM@</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{7705EEF6-6980-48F9-A045-699DAFE860C9}</ProjectGuid> <Keyword>Win32Proj</Keyword> <RootNamespace>rwlock_test</RootNamespace> @WINDOWS_TARGET_PLATFORM_VERSION@ </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <CharacterSet>MultiByte</CharacterSet> @PLATFORM_TOOLSET@ </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>MultiByte</CharacterSet> @PLATFORM_TOOLSET@ </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'"> <LinkIncremental>true</LinkIncremental> <OutDir>..\..\..\Build\$(Configuration)\</OutDir> <IntDir>.\$(Configuration)\</IntDir> <IntDirSharingDetected>None</IntDirSharingDetected> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'"> <LinkIncremental>false</LinkIncremental> <OutDir>..\..\..\Build\$(Configuration)\</OutDir> <IntDir>.\$(Configuration)\</IntDir> <IntDirSharingDetected>None</IntDirSharingDetected> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'"> <ClCompile> <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level4</WarningLevel> <TreatWarningAsError>false</TreatWarningAsError> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <FunctionLevelLinking>true</FunctionLevelLinking> <PrecompiledHeaderOutputFile>.\$(Configuration)\$(TargetName).pch</PrecompiledHeaderOutputFile> <AssemblerListingLocation>.\$(Configuration)\</AssemblerListingLocation> <ObjectFileName>.\$(Configuration)\</ObjectFileName> <ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName> <BrowseInformation>true</BrowseInformation> <ForcedIncludeFiles>..\..\..\config.h</ForcedIncludeFiles> <AdditionalIncludeDirectories>.\;..\..\..\;@LIBXML2_INC@..\..\..\lib\isc\win32;..\..\..\lib\isc\win32\include;..\..\..\lib\isc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <CompileAs>CompileAsC</CompileAs> </ClCompile> <Link> <SubSystem>Console</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile> <AdditionalLibraryDirectories>..\..\..\lib\isc\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalDependencies>@[email protected];ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'"> <ClCompile> <WarningLevel>Level1</WarningLevel> <TreatWarningAsError>true</TreatWarningAsError> <PrecompiledHeader> </PrecompiledHeader> <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>@INTRINSIC@</IntrinsicFunctions> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <WholeProgramOptimization>false</WholeProgramOptimization> <StringPooling>true</StringPooling> <PrecompiledHeaderOutputFile>.\$(Configuration)\$(TargetName).pch</PrecompiledHeaderOutputFile> <AssemblerListingLocation>.\$(Configuration)\</AssemblerListingLocation> <ObjectFileName>.\$(Configuration)\</ObjectFileName> <ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName> <ForcedIncludeFiles>..\..\..\config.h</ForcedIncludeFiles> <AdditionalIncludeDirectories>.\;..\..\..\;@LIBXML2_INC@..\..\..\lib\isc\win32;..\..\..\lib\isc\win32\include;..\..\..\lib\isc\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <CompileAs>CompileAsC</CompileAs> </ClCompile> <Link> <SubSystem>Console</SubSystem> <GenerateDebugInformation>false</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> <OutputFile>..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile> <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration> <AdditionalLibraryDirectories>..\..\..\lib\isc\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalDependencies>@[email protected];ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="..\rwlock_test.c" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> </Project>
{ "pile_set_name": "Github" }
# Copyright 2017 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. source_set("cpp") { sources = [ "audio_system_factory.cc", "audio_system_factory.h", "audio_system_to_service_adapter.cc", "audio_system_to_service_adapter.h", "debug_recording_session.cc", "debug_recording_session.h", "debug_recording_session_factory.cc", "debug_recording_session_factory.h", "device_factory.cc", "device_factory.h", "input_ipc.cc", "input_ipc.h", ] public_deps = [ "//base", "//media", "//services/audio/public/mojom", "//services/service_manager/public/cpp", ] } source_set("test_support") { testonly = true sources = [ "fake_stream_factory.cc", "fake_stream_factory.h", "fake_system_info.cc", "fake_system_info.h", ] deps = [ "//testing/gmock", ] public_deps = [ "//base", "//media", "//services/audio/public/mojom", "//services/service_manager/public/cpp", ] }
{ "pile_set_name": "Github" }
--! define class for PriorityQueue local class = {mt = {}} --! define class for PriorityQueue local Queue = class --! define class for PriorityQueue class.mt.__index = class ---! @brief create Queue ---! @return return a self table local function create() local self = {} setmetatable(self, class.mt) self.first = 1 self.last = 0 return self end class.create = create ---! @brief The first element to determine the queue ---! @return The first element of the queue local function front(self) local first = self.first if first > self.last then return nil else return self[first] end end class.front = front ---! @brief Take the element of the queue ---! @return The first element of the queue local function popFront(self) local first = self.first if first>self.last then return nil end local value = self[first] self[first] = nil self.first = first+1 return value end class.popFront = popFront ---! @brief Judge the last element of the queue ---! @return The last element of the queue local function back(self) local last = self.last if self.first > last then return nil else return self[last] end end class.back = back ---! @brief Put an element in the last position of the queue ---! @param element the element to pushed in local function pushBack(self, element) self.last = self.last + 1 self[self.last] = element end class.pushBack = pushBack ---! @brief Queue length ---! @param Queue length local function count(self) if self.first>self.last then return 0 end local count = self.last-self.first+1 return count end class.count = count local function clear(self) for i=self.first,self.last do self[i] = nil end self.first = 1 self.last = 0 end class.clear = clear class.reset = clear return Queue
{ "pile_set_name": "Github" }
//----------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Collections.ObjectModel; using System.IdentityModel.Claims; using System.IdentityModel.Policy; using System.IdentityModel.Selectors; using System.Xml; public abstract class SamlStatement { public abstract IAuthorizationPolicy CreatePolicy(ClaimSet issuer, SamlSecurityTokenAuthenticator samlAuthenticator); public abstract bool IsReadOnly { get; } public abstract void MakeReadOnly(); public abstract void ReadXml(XmlDictionaryReader reader, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer, SecurityTokenResolver outOfBandTokenResolver); public abstract void WriteXml(XmlDictionaryWriter writer, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer); } }
{ "pile_set_name": "Github" }
// (C) Copyright Gennadiy Rozental 2002-2008. // (C) Copyright Daryle Walker 2000-2001. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. // // File : $RCSfile$ // // Version : $Revision$ // // Description : simulate /dev/null stream // *************************************************************************** #ifndef BOOST_NULLSTREAM_HPP_071894GER #define BOOST_NULLSTREAM_HPP_071894GER #include <ostream> // for std::basic_ostream #include <streambuf> // for std::basic_streambuf #include <string> // for std::char_traits #include <boost/utility/base_from_member.hpp> #include <boost/test/detail/suppress_warnings.hpp> //____________________________________________________________________________// namespace boost { // ************************************************************************** // // ************** basic_nullbuf ************** // // ************************************************************************** // // Class for a buffer that reads nothing and writes to nothing. // Idea from an Usenet post by Tom <[email protected]> at // 27 Oct 2000 14:06:21 GMT on comp.lang.c++. template<typename CharType, class CharTraits = ::std::char_traits<CharType> > class basic_nullbuf : public ::std::basic_streambuf<CharType, CharTraits> { typedef ::std::basic_streambuf<CharType, CharTraits> base_type; public: // Types typedef typename base_type::char_type char_type; typedef typename base_type::traits_type traits_type; typedef typename base_type::int_type int_type; typedef typename base_type::pos_type pos_type; typedef typename base_type::off_type off_type; // Use automatic default constructor and destructor protected: // The default implementations of the miscellaneous virtual // member functions are sufficient. // The default implementations of the input & putback virtual // member functions, being nowhere but EOF, are sufficient. // The output virtual member functions need to be changed to // accept anything without any problems, instead of being at EOF. virtual ::std::streamsize xsputn( char_type const* /*s*/, ::std::streamsize n ) { return n; } // "s" is unused virtual int_type overflow( int_type c = traits_type::eof() ) { return traits_type::not_eof( c ); } }; typedef basic_nullbuf<char> nullbuf; typedef basic_nullbuf<wchar_t> wnullbuf; // ************************************************************************** // // ************** basic_onullstream ************** // // ************************************************************************** // // Output streams based on basic_nullbuf. #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable: 4355) // 'this' : used in base member initializer list #endif template< typename CharType, class CharTraits = ::std::char_traits<CharType> > class basic_onullstream : private boost::base_from_member<basic_nullbuf<CharType, CharTraits> > , public ::std::basic_ostream<CharType, CharTraits> { typedef boost::base_from_member<basic_nullbuf<CharType, CharTraits> > pbase_type; typedef ::std::basic_ostream<CharType, CharTraits> base_type; public: // Constructor basic_onullstream() : pbase_type(), base_type( &this->pbase_type::member ) {} }; #ifdef BOOST_MSVC # pragma warning(default: 4355) #endif typedef basic_onullstream<char> onullstream; typedef basic_onullstream<wchar_t> wonullstream; } // namespace boost //____________________________________________________________________________// #include <boost/test/detail/enable_warnings.hpp> #endif // BOOST_NULLSTREAM_HPP_071894GER
{ "pile_set_name": "Github" }
/******************************************************************************* * Copyright (c) 2013 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Obeo - initial API and implementation *******************************************************************************/ package org.obeonetwork.dsl.uml2.design.tests.plugin; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import org.obeonetwork.dsl.uml2.design.tests.plugin.manual.UmlDesignerManualPluginTests; @RunWith(Suite.class) @SuiteClasses({UmlDesignerPluginTests.class, UmlDesignerManualPluginTests.class}) /** * Testing : All generated and manual plugin UML Designer tests */ public class AllPluginTests { }
{ "pile_set_name": "Github" }
/** @file optimal_vars_finder.h * * Interface to a function that optimizes the choice of variable for GCD * computations. */ /* * GiNaC Copyright (C) 1999-2016 Johannes Gutenberg University Mainz, Germany * * 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 GINAC_CHINREM_GCD_OPTIMAL_SYMBOL_FINDER_H #define GINAC_CHINREM_GCD_OPTIMAL_SYMBOL_FINDER_H #include "ex.h" #include <vector> namespace GiNaC { /** * @brief Find the order of variables which is optimal for GCD computation. * * Collects statistical information about the highest and lowest degrees * of all variables that appear in two polynomials. Sorts the variables * by minimum degree (lowest to highest). The information gathered by * this function is used by GCD routines to find out the main variable * for GCD computation. */ extern exvector gcd_optimal_variables_order(const ex& A, const ex& B); } // namespace GiNaC #endif // GINAC_CHINREM_GCD_OPTIMAL_SYMBOL_FINDER_H
{ "pile_set_name": "Github" }
//// Copyright (c) Microsoft Corporation. All rights reserved (function () { "use strict"; var sampleTitle = "Media Editing"; var scenarios = [ { url: "/html/scenario1.html", title: "Trimming and Saving a clip" }, { url: "/html/scenario2.html", title: "Appending multiple clips" }, { url: "/html/scenario3.html", title: "Adding background audio tracks" }, { url: "/html/scenario4.html", title: "Adding overlays to a clip" } ]; WinJS.Namespace.define("SdkSample", { sampleTitle: sampleTitle, scenarios: new WinJS.Binding.List(scenarios) }); })();
{ "pile_set_name": "Github" }
import React from 'react'; interface Props { name: string; } export default class TSPreset extends React.Component<Props> { render() { return null; } }
{ "pile_set_name": "Github" }
Arguments with no value mpi_null: Base test mpi_read_write_string #1 mpi_read_write_string:10:"128":10:"128":100:0:0 Base test mpi_read_write_string #2 mpi_read_write_string:10:"128":16:"80":100:0:0 Base test mpi_read_write_string #3 (Read zero) mpi_read_write_string:10:"0":10:"0":100:0:0 Base test mpi_read_write_string #3 (Negative decimal) mpi_read_write_string:10:"-23":10:"-23":100:0:0 Base test mpi_read_write_string #3 (Negative hex) mpi_read_write_string:16:"-20":10:"-32":100:0:0 Base test mpi_read_write_string #3 (Negative decimal) mpi_read_write_string:16:"-23":16:"-23":100:0:0 Test mpi_read_write_string #1 (Invalid character) mpi_read_write_string:10:"a28":0:"":100:MBEDTLS_ERR_MPI_INVALID_CHARACTER:0 Test mpi_read_write_string #2 (Illegal input radix) mpi_read_write_string:19:"a28":0:"":100:MBEDTLS_ERR_MPI_BAD_INPUT_DATA:0 Test mpi_read_write_string #3 (Buffer just fits) mpi_read_write_string:16:"-23":16:"-23":4:0:0 Test mpi_read_write_string #4 (Buffer too small) mpi_read_write_string:16:"-23":16:"-23":3:0:MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL Test mpi_read_write_string #5 (Illegal output radix) mpi_read_write_string:16:"-23":17:"-23":4:0:MBEDTLS_ERR_MPI_BAD_INPUT_DATA Test mpi_read_write_string #6 (Output radix of 15) mpi_read_write_string:10:"29":15:"1e":100:0:0 Test mpi_read_write_string #7 mpi_read_write_string:10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":16:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":200:0:0 Test mpi_read_write_string #8 (Empty MPI -> hex) mpi_read_write_string:16:"":16:"00":4:0:0 Test mpi_read_write_string #9 (Empty MPI -> dec) mpi_read_write_string:16:"":10:"0":4:0:0 Test mpi_write_string #10 (Negative hex with odd number of digits) mpi_read_write_string:16:"-1":16:"":3:0:MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL Base test mbedtls_mpi_read_binary #1 mbedtls_mpi_read_binary:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924" Base test mbedtls_mpi_write_binary #1 mbedtls_mpi_write_binary:10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":200:0 Test mbedtls_mpi_write_binary #1 (Buffer just fits) mbedtls_mpi_write_binary:16:"123123123123123123123123123":"0123123123123123123123123123":14:0 Test mbedtls_mpi_write_binary #2 (Buffer too small) mbedtls_mpi_write_binary:16:"123123123123123123123123123":"123123123123123123123123123":13:MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL Base test mbedtls_mpi_read_file #1 mbedtls_mpi_read_file:10:"data_files/mpi_10":"01f55332c3a48b910f9942f6c914e58bef37a47ee45cb164a5b6b8d1006bf59a059c21449939ebebfdf517d2e1dbac88010d7b1f141e997bd6801ddaec9d05910f4f2de2b2c4d714e2c14a72fc7f17aa428d59c531627f09":0 Test mbedtls_mpi_read_file #1 (Empty file) mbedtls_mpi_read_file:10:"data_files/hash_file_4":"":MBEDTLS_ERR_MPI_FILE_IO_ERROR Test mbedtls_mpi_read_file #2 (Illegal input) mbedtls_mpi_read_file:10:"data_files/hash_file_3":"":0 Test mbedtls_mpi_read_file #3 (Input too big) mbedtls_mpi_read_file:10:"data_files/mpi_too_big":"":MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL Base test mbedtls_mpi_write_file #1 mbedtls_mpi_write_file:10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":16:"data_files/mpi_write" Base test mbedtls_mpi_lsb #1 mbedtls_mpi_lsb:10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":2 Base test mbedtls_mpi_lsb #2 mbedtls_mpi_lsb:10:"24":3 Base test mbedtls_mpi_lsb #3 mbedtls_mpi_lsb:16:"24":2 Base test mbedtls_mpi_lsb #4 mbedtls_mpi_lsb:16:"2000":13 Base test mbedtls_mpi_bitlen #1 mbedtls_mpi_bitlen:10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":764 Base test mbedtls_mpi_bitlen #2 mbedtls_mpi_bitlen:10:"24":5 Base test mbedtls_mpi_bitlen #3 mbedtls_mpi_bitlen:10:"1":1 Base test mbedtls_mpi_bitlen #4 mbedtls_mpi_bitlen:10:"15":4 Base test mbedtls_mpi_bitlen #5 mbedtls_mpi_bitlen:10:"16":5 Base test mbedtls_mpi_bitlen #6 mbedtls_mpi_bitlen:10:"10":4 Base test mbedtls_mpi_bitlen #7 mbedtls_mpi_bitlen:10:"0":0 Base test mbedtls_mpi_cmp_int #1 mbedtls_mpi_cmp_int:693:693:0 Base test mbedtls_mpi_cmp_int #2 mbedtls_mpi_cmp_int:693:692:1 Base test mbedtls_mpi_cmp_int #3 mbedtls_mpi_cmp_int:693:694:-1 Base test mbedtls_mpi_cmp_int (Negative values) #1 mbedtls_mpi_cmp_int:-2:-2:0 Base test mbedtls_mpi_cmp_int (Negative values) #2 mbedtls_mpi_cmp_int:-2:-3:1 Base test mbedtls_mpi_cmp_int (Negative values) #3 mbedtls_mpi_cmp_int:-2:-1:-1 Base test mbedtls_mpi_cmp_mpi #1 mbedtls_mpi_cmp_mpi:10:"693":10:"693":0 Base test mbedtls_mpi_cmp_mpi #2 mbedtls_mpi_cmp_mpi:10:"693":10:"692":1 Base test mbedtls_mpi_cmp_mpi #3 mbedtls_mpi_cmp_mpi:10:"693":10:"694":-1 Base test mbedtls_mpi_cmp_mpi (Negative values) #1 mbedtls_mpi_cmp_mpi:10:"-2":10:"-2":0 Base test mbedtls_mpi_cmp_mpi (Negative values) #2 mbedtls_mpi_cmp_mpi:10:"-2":10:"-3":1 Base test mbedtls_mpi_cmp_mpi (Negative values) #3 mbedtls_mpi_cmp_mpi:10:"-2":10:"-1":-1 Base test mbedtls_mpi_cmp_mpi (Mixed values) #4 mbedtls_mpi_cmp_mpi:10:"-3":10:"2":-1 Base test mbedtls_mpi_cmp_mpi (Mixed values) #5 mbedtls_mpi_cmp_mpi:10:"2":10:"-3":1 Base test mbedtls_mpi_cmp_mpi (Mixed values) #6 mbedtls_mpi_cmp_mpi:10:"-2":10:"31231231289798":-1 Base test mbedtls_mpi_cmp_abs #1 mbedtls_mpi_cmp_abs:10:"693":10:"693":0 Base test mbedtls_mpi_cmp_abs #2 mbedtls_mpi_cmp_abs:10:"693":10:"692":1 Base test mbedtls_mpi_cmp_abs #3 mbedtls_mpi_cmp_abs:10:"693":10:"694":-1 Base test mbedtls_mpi_cmp_abs (Negative values) #1 mbedtls_mpi_cmp_abs:10:"-2":10:"-2":0 Base test mbedtls_mpi_cmp_abs (Negative values) #2 mbedtls_mpi_cmp_abs:10:"-2":10:"-3":-1 Base test mbedtls_mpi_cmp_abs (Negative values) #3 mbedtls_mpi_cmp_abs:10:"-2":10:"-1":1 Base test mbedtls_mpi_cmp_abs (Zero and Zero) #4 mbedtls_mpi_cmp_abs:10:"0":10:"0":0 Base test mbedtls_mpi_cmp_abs (Mix values) #1 mbedtls_mpi_cmp_abs:10:"-2":10:"2":0 Base test mbedtls_mpi_cmp_abs (Mix values) #2 mbedtls_mpi_cmp_abs:10:"2":10:"-3":-1 Base test mbedtls_mpi_cmp_abs (Mix values) #3 mbedtls_mpi_cmp_abs:10:"-2":10:"1":1 Base test mbedtls_mpi_copy #1 mbedtls_mpi_copy:0:1500 Base test mpi_copy_self #1 mpi_copy_self:14 Base test mbedtls_mpi_swap #1 mbedtls_mpi_swap:0:1500 Test mbedtls_mpi_shrink #1 mbedtls_mpi_shrink:2:2:4:4 Test mbedtls_mpi_shrink #2 mbedtls_mpi_shrink:4:2:4:4 Test mbedtls_mpi_shrink #3 mbedtls_mpi_shrink:8:2:4:4 Test mbedtls_mpi_shrink #4 mbedtls_mpi_shrink:8:4:4:4 Test mbedtls_mpi_shrink #5 mbedtls_mpi_shrink:8:6:4:6 Test mbedtls_mpi_shrink #6 mbedtls_mpi_shrink:4:2:0:2 Test mbedtls_mpi_shrink #7 mbedtls_mpi_shrink:4:1:0:1 Test mbedtls_mpi_shrink #8 mbedtls_mpi_shrink:4:0:0:1 Test mbedtls_mpi_safe_cond_assign #1 mbedtls_mpi_safe_cond_assign:+1:"01":+1:"02" Test mbedtls_mpi_safe_cond_assign #2 mbedtls_mpi_safe_cond_assign:+1:"FF000000000000000001":+1:"02" Test mbedtls_mpi_safe_cond_assign #3 mbedtls_mpi_safe_cond_assign:+1:"01":+1:"FF000000000000000002" Test mbedtls_mpi_safe_cond_assign #4 mbedtls_mpi_safe_cond_assign:+1:"01":-1:"02" Test mbedtls_mpi_safe_cond_assign #5 mbedtls_mpi_safe_cond_assign:-1:"01":+1:"02" Test mbedtls_mpi_safe_cond_assign #6 mbedtls_mpi_safe_cond_assign:-1:"01":-1:"02" Test mbedtls_mpi_safe_cond_swap #1 mbedtls_mpi_safe_cond_swap:+1:"01":+1:"02" Test mbedtls_mpi_safe_cond_swap #2 mbedtls_mpi_safe_cond_swap:+1:"FF000000000000000001":+1:"02" Test mbedtls_mpi_safe_cond_swap #3 mbedtls_mpi_safe_cond_swap:+1:"01":+1:"FF000000000000000002" Test mbedtls_mpi_safe_cond_swap #4 mbedtls_mpi_safe_cond_swap:+1:"01":-1:"02" Test mbedtls_mpi_safe_cond_swap #5 mbedtls_mpi_safe_cond_swap:-1:"01":+1:"02" Test mbedtls_mpi_safe_cond_swap #6 mbedtls_mpi_safe_cond_swap:-1:"01":-1:"02" Base test mbedtls_mpi_add_abs #1 mbedtls_mpi_add_abs:10:"12345678":10:"642531":10:"12988209" Base test mbedtls_mpi_add_abs #2 mbedtls_mpi_add_abs:10:"-12345678":10:"642531":10:"12988209" Base test mbedtls_mpi_add_abs #3 mbedtls_mpi_add_abs:10:"12345678":10:"-642531":10:"12988209" Base test mbedtls_mpi_add_abs #4 mbedtls_mpi_add_abs:10:"-12345678":10:"-642531":10:"12988209" Test mbedtls_mpi_add_abs #1 mbedtls_mpi_add_abs:10:"-643808006803554439230129854961492699151386107534013432918073439524138264842370630061369715394739134090922937332590384720397133335969549256322620979036686633213903952966175107096769180017646161851573147596390153":10:"56125680981752282333498088313568935051383833838594899821664631784577337171193624243181360054669678410455329112434552942717084003541384594864129940145043086760031292483340068923506115878221189886491132772739661669044958531131327771":10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924" Test mbedtls_mpi_add_abs #2 (add to first value) mpi_add_abs_add_first:10:"123123":10:"123123":10:"246246" Test mbedtls_mpi_add_abs #3 (add to second value) mpi_add_abs_add_second:10:"123123":10:"123123":10:"246246" Regression mbedtls_mpi_add_abs (add small to very large MPI with carry rollover) mbedtls_mpi_add_abs:16:"FFFFFFFFFFFFFFFFFFFFFFFFFFFFF8":16:"08":16:"1000000000000000000000000000000" Regression mbedtls_mpi_add_abs (add small to very large MPI with carry rollover) mbedtls_mpi_add_abs:16:"08":16:"FFFFFFFFFFFFFFFFFFFFFFFFFFFFF8":16:"1000000000000000000000000000000" Base test mbedtls_mpi_add_mpi #1 mbedtls_mpi_add_mpi:10:"12345678":10:"642531":10:"12988209" Base test mbedtls_mpi_add_mpi #2 mbedtls_mpi_add_mpi:10:"-12345678":10:"642531":10:"-11703147" Base test mbedtls_mpi_add_mpi #3 mbedtls_mpi_add_mpi:10:"12345678":10:"-642531":10:"11703147" Base test mbedtls_mpi_add_mpi #4 mbedtls_mpi_add_mpi:10:"-12345678":10:"-642531":10:"-12988209" Test mbedtls_mpi_add_mpi #1 mbedtls_mpi_add_mpi:10:"203956878356401977405765866929034577280193993314348263094772646453283062722701277632936616063144088173312372882677123879538709400158306567338328279154499698366071906766440037074217117805690872792848149112022286332144876183376326512083574821647933992961249917319836219304274280243803104015000563790123":10:"531872289054204184185084734375133399408303613982130856645299464930952178606045848877129147820387996428175564228204785846141207532462936339834139412401975338705794646595487324365194792822189473092273993580587964571659678084484152603881094176995594813302284232006001752128168901293560051833646881436219":10:"735829167410606161590850601304167976688497607296479119740072111384235241328747126510065763883532084601487937110881909725679916932621242907172467691556475037071866553361927361439411910627880345885122142692610250903804554267860479115964668998643528806263534149325837971432443181537363155848647445226342" Test mbedtls_mpi_add_mpi #2 mbedtls_mpi_add_mpi:10:"643808006803554439230129854961492699151386107534013432918073439524138264842370630061369715394739134090922937332590384720397133335969549256322620979036686633213903952966175107096769180017646161851573147596390153":10:"56125680981752282333498088313568935051383833838594899821664631784577337171193624243181360054669678410455329112434552942717084003541384594864129940145043086760031292483340068923506115878221189886491132772739661669044958531131327771":10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924" Base test mbedtls_mpi_add_mpi inplace #1 mbedtls_mpi_add_mpi_inplace:10:"12345678":10:"24691356" Test mbedtls_mpi_add_mpi inplace #2 mbedtls_mpi_add_mpi_inplace:10:"643808006803554439230129854961492699151386107534013432918073439524138264842370630061369715394739134090922937332590384720397133335969549256322620979036686633213903952966175107096769180017646161851573147596390153":10:"1287616013607108878460259709922985398302772215068026865836146879048276529684741260122739430789478268181845874665180769440794266671939098512645241958073373266427807905932350214193538360035292323703146295192780306" Test mbedtls_mpi_add_mpi inplace #3 mbedtls_mpi_add_mpi_inplace:16:"ffffffffffffffffffffffffffffffff":16:"01fffffffffffffffffffffffffffffffe" Test mbedtls_mpi_add_int #1 mbedtls_mpi_add_int:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":9871232:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227022647561" Test mbedtls_mpi_add_int #2 mbedtls_mpi_add_int:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":-9871232:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227002905097" Base test mbedtls_mpi_sub_abs #1 (Test with larger second input) mbedtls_mpi_sub_abs:10:"5":10:"7":10:"0":MBEDTLS_ERR_MPI_NEGATIVE_VALUE Base test mbedtls_mpi_sub_abs #2 (Test with larger second input) mbedtls_mpi_sub_abs:10:"-5":10:"-7":10:"0":MBEDTLS_ERR_MPI_NEGATIVE_VALUE Base test mbedtls_mpi_sub_abs #3 (Test with larger second input) mbedtls_mpi_sub_abs:10:"-5":10:"7":10:"0":MBEDTLS_ERR_MPI_NEGATIVE_VALUE Base test mbedtls_mpi_sub_abs #4 (Test with larger second input) mbedtls_mpi_sub_abs:10:"5":10:"-7":10:"0":MBEDTLS_ERR_MPI_NEGATIVE_VALUE Base test mbedtls_mpi_sub_abs #1 mbedtls_mpi_sub_abs:10:"7":10:"5":10:"2":0 Base test mbedtls_mpi_sub_abs #2 mbedtls_mpi_sub_abs:10:"-7":10:"-5":10:"2":0 Base test mbedtls_mpi_sub_abs #3 mbedtls_mpi_sub_abs:10:"-7":10:"5":10:"2":0 Base test mbedtls_mpi_sub_abs #4 mbedtls_mpi_sub_abs:10:"7":10:"-5":10:"2":0 Test mbedtls_mpi_sub_abs #1 mbedtls_mpi_sub_abs:16:"FFFFFFFFFF":16:"01":16:"FFFFFFFFFE":0 Test mbedtls_mpi_sub_abs #2 mbedtls_mpi_sub_abs:16:"FFFFFFFFF0":16:"01":16:"FFFFFFFFEF":0 Test mbedtls_mpi_sub_abs #3 mbedtls_mpi_sub_abs:16:"FF00000000":16:"0F00000000":16:"F000000000":0 Test mbedtls_mpi_sub_abs #4 mbedtls_mpi_sub_abs:16:"FF00000000":16:"0F00000001":16:"EFFFFFFFFF":0 Base test mbedtls_mpi_sub_mpi #1 (Test with negative result) mbedtls_mpi_sub_mpi:10:"5":10:"7":10:"-2" Base test mbedtls_mpi_sub_mpi #2 (Test with negative inputs) mbedtls_mpi_sub_mpi:10:"-5":10:"-7":10:"2" Base test mbedtls_mpi_sub_mpi #3 (Test with negative base) mbedtls_mpi_sub_mpi:10:"-5":10:"7":10:"-12" Base test mbedtls_mpi_sub_mpi #4 (Test with negative subtraction) mbedtls_mpi_sub_mpi:10:"5":10:"-7":10:"12" Test mbedtls_mpi_sub_mpi #1 mbedtls_mpi_sub_mpi:10:"531872289054204184185084734375133399408303613982130856645299464930952178606045848877129147820387996428175564228204785846141207532462936339834139412401975338705794646595487324365194792822189473092273993580587964571659678084484152603881094176995594813302284232006001752128168901293560051833646881436219":10:"203956878356401977405765866929034577280193993314348263094772646453283062722701277632936616063144088173312372882677123879538709400158306567338328279154499698366071906766440037074217117805690872792848149112022286332144876183376326512083574821647933992961249917319836219304274280243803104015000563790123":10:"327915410697802206779318867446098822128109620667782593550526818477669115883344571244192531757243908254863191345527661966602498132304629772495811133247475640339722739829047287290977675016498600299425844468565678239514801901107826091797519355347660820341034314686165532823894621049756947818646317646096" Test mbedtls_mpi_sub_mpi #2 (Test for negative result) mbedtls_mpi_sub_mpi:10:"643808006803554439230129854961492699151386107534013432918073439524138264842370630061369715394739134090922937332590384720397133335969549256322620979036686633213903952966175107096769180017646161851573147596390153":10:"56125680981752282333498088313568935051383833838594899821664631784577337171193624243181360054669678410455329112434552942717084003541384594864129940145043086760031292483340068923506115878221189886491132772739661669044958531131327771":10:"-56125680981752282332854280306765380612153703983633407122513245677043323738275550803657221789827307780393959397039813808626161066208794210143732806809073537503708671504303382290292211925255014779394363592722015507193385383534937618" Test mbedtls_mpi_sub_int #1 mbedtls_mpi_sub_int:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":-9871232:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227022647561" Test mbedtls_mpi_sub_int #2 mbedtls_mpi_sub_int:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":9871232:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227002905097" Test mbedtls_mpi_shift_l #1 mbedtls_mpi_shift_l:10:"64":1:10:"128" Test mbedtls_mpi_shift_l #2 mbedtls_mpi_shift_l:10:"658385546911733550164516088405238961461880256029834598831972039469421755117818013653494814438931957316403111689187691446941406788869098983929874080332195117465344344350008880118042764943201875870917468833709791733282363323948005998269792207":37:10:"90487820548639020691922304619723076305400961610119884872723190678642804168382367856686134531865643066983017249846286450251272364365605022750900439437595355052945035915579216557330505438734955340526145476988250171181404966718289259743378883640981192704" Test mbedtls_mpi_shift_r #1 mbedtls_mpi_shift_r:10:"128":1:10:"64" Test mbedtls_mpi_shift_r #2 mbedtls_mpi_shift_r:10:"120815570979701484704906977000760567182871429114712069861589084706550626575967516787438008593490722779337547394120718248995900363209947025063336882559539208430319216688889117222633155838468458047056355241515415159736436403445579777425189969":45:10:"3433785053053426415343295076376096153094051405637175942660777670498379921354157795219578264137985649407981651226029903483433269093721578004287291678324982297860947730012217028349628999378309630601971640587504883789518896817457" Test mbedtls_mpi_shift_r #4 mbedtls_mpi_shift_r:16:"FFFFFFFFFFFFFFFF":63:16:"01" Test mbedtls_mpi_shift_r #4 mbedtls_mpi_shift_r:16:"FFFFFFFFFFFFFFFF":64:16:"00" Test mbedtls_mpi_shift_r #6 mbedtls_mpi_shift_r:16:"FFFFFFFFFFFFFFFF":65:16:"00" Test mbedtls_mpi_shift_r #7 mbedtls_mpi_shift_r:16:"FFFFFFFFFFFFFFFF":128:16:"00" Base test mbedtls_mpi_mul_mpi #1 mbedtls_mpi_mul_mpi:10:"5":10:"7":10:"35" Base test mbedtls_mpi_mul_mpi #2 mbedtls_mpi_mul_mpi:10:"-5":10:"7":10:"-35" Base test mbedtls_mpi_mul_mpi #3 mbedtls_mpi_mul_mpi:10:"5":10:"-7":10:"-35" Base test mbedtls_mpi_mul_mpi #4 mbedtls_mpi_mul_mpi:10:"-5":10:"-7":10:"35" Test mbedtls_mpi_mul_mpi #1 mbedtls_mpi_mul_mpi:10:"28911710017320205966167820725313234361535259163045867986277478145081076845846493521348693253530011243988160148063424837895971948244167867236923919506962312185829914482993478947657472351461336729641485069323635424692930278888923450060546465883490944265147851036817433970984747733020522259537":10:"16471581891701794764704009719057349996270239948993452268812975037240586099924712715366967486587417803753916334331355573776945238871512026832810626226164346328807407669366029926221415383560814338828449642265377822759768011406757061063524768140567867350208554439342320410551341675119078050953":10:"476221599179424887669515829231223263939342135681791605842540429321038144633323941248706405375723482912535192363845116154236465184147599697841273424891410002781967962186252583311115708128167171262206919514587899883547279647025952837516324649656913580411611297312678955801899536937577476819667861053063432906071315727948826276092545739432005962781562403795455162483159362585281248265005441715080197800335757871588045959754547836825977169125866324128449699877076762316768127816074587766799018626179199776188490087103869164122906791440101822594139648973454716256383294690817576188761" Test mbedtls_mpi_mul_int #1 mbedtls_mpi_mul_int:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":9871232:10:"20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":"==" Test mbedtls_mpi_mul_int #2 (Unsigned, thus failure) mbedtls_mpi_mul_int:10:"2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":-9871232:10:"-20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":"!=" Test mbedtls_mpi_mul_int #3 mbedtls_mpi_mul_int:10:"-2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":9871232:10:"-20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":"==" Test mbedtls_mpi_mul_int #4 (Unsigned, thus failure) mbedtls_mpi_mul_int:10:"-2039568783564019774057658669290345772801939933143482630947726464532830627227012776329":-9871232:10:"20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":"!=" Base test mbedtls_mpi_div_mpi #1 mbedtls_mpi_div_mpi:10:"1000":10:"13":10:"76":10:"12":0 Base test mbedtls_mpi_div_mpi #2 (Divide by zero) mbedtls_mpi_div_mpi:10:"1000":10:"0":10:"1":10:"1":MBEDTLS_ERR_MPI_DIVISION_BY_ZERO Base test mbedtls_mpi_div_mpi #3 mbedtls_mpi_div_mpi:10:"1000":10:"-13":10:"-76":10:"12":0 Test mbedtls_mpi_div_mpi #1 mbedtls_mpi_div_mpi:10:"20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":10:"34":10:"592148724779947824773845002981655249516095268533053127589864347174804198178334111238460803":10:"26":0 Test mbedtls_mpi_div_mpi #2 mbedtls_mpi_div_mpi:10:"476221599179424887669515829231223263939342135681791605842540429321038144633323941248706405375723482912535192363845116154236465184147599697841273424891410002781967962186252583311115708128167171262206919514587899883547279647025952837516324649656913580411611297312678955801899536937577476819667861053063432906071315727948826276092545739432005962781562403795455162483159362585281248265005441715080197800335757871588045959754547836825977169125866324128449699877076762316768127816074587766799018626179199776188490087103869164122906791440101822594139648973454716256383294690817576188762":10:"28911710017320205966167820725313234361535259163045867986277478145081076845846493521348693253530011243988160148063424837895971948244167867236923919506962312185829914482993478947657472351461336729641485069323635424692930278888923450060546465883490944265147851036817433970984747733020522259537":10:"16471581891701794764704009719057349996270239948993452268812975037240586099924712715366967486587417803753916334331355573776945238871512026832810626226164346328807407669366029926221415383560814338828449642265377822759768011406757061063524768140567867350208554439342320410551341675119078050953":10:"1":0 Test mbedtls_mpi_div_mpi #3 mbedtls_mpi_div_mpi:10:"1000":10:"7":10:"142":10:"6":0 Test mbedtls_mpi_div_mpi #4 mbedtls_mpi_div_mpi:10:"777":10:"7":10:"111":10:"0":0 Base test mbedtls_mpi_div_int #1 mbedtls_mpi_div_int:10:"1000":13:10:"76":10:"12":0 Base test mbedtls_mpi_div_int #2 (Divide by zero) mbedtls_mpi_div_int:10:"1000":0:10:"1":10:"1":MBEDTLS_ERR_MPI_DIVISION_BY_ZERO Base test mbedtls_mpi_div_int #3 mbedtls_mpi_div_int:10:"1000":-13:10:"-76":10:"12":0 Test mbedtls_mpi_div_int #1 mbedtls_mpi_div_int:10:"20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":34:10:"592148724779947824773845002981655249516095268533053127589864347174804198178334111238460803":10:"26":0 Test mbedtls_mpi_div_int #2 mbedtls_mpi_div_int:10:"20133056642518226042310730101376278483547239130123806338055387803943342738063359782107667328":-34:10:"-592148724779947824773845002981655249516095268533053127589864347174804198178334111238460803":10:"26":0 Base test mbedtls_mpi_mod_mpi #1 mbedtls_mpi_mod_mpi:10:"1000":10:"13":10:"12":0 Base test mbedtls_mpi_mod_mpi #2 (Divide by zero) mbedtls_mpi_mod_mpi:10:"1000":10:"0":10:"0":MBEDTLS_ERR_MPI_DIVISION_BY_ZERO Base test mbedtls_mpi_mod_mpi #3 mbedtls_mpi_mod_mpi:10:"-1000":10:"13":10:"1":0 Base test mbedtls_mpi_mod_mpi #4 (Negative modulo) mbedtls_mpi_mod_mpi:10:"1000":10:"-13":10:"-1":MBEDTLS_ERR_MPI_NEGATIVE_VALUE Base test mbedtls_mpi_mod_mpi #5 (Negative modulo) mbedtls_mpi_mod_mpi:10:"-1000":10:"-13":10:"-12":MBEDTLS_ERR_MPI_NEGATIVE_VALUE Base test mbedtls_mpi_mod_int #1 mbedtls_mpi_mod_int:10:"1000":13:12:0 Base test mbedtls_mpi_mod_int #2 (Divide by zero) mbedtls_mpi_mod_int:10:"1000":0:0:MBEDTLS_ERR_MPI_DIVISION_BY_ZERO Base test mbedtls_mpi_mod_int #3 mbedtls_mpi_mod_int:10:"-1000":13:1:0 Base test mbedtls_mpi_mod_int #4 (Negative modulo) mbedtls_mpi_mod_int:10:"1000":-13:0:MBEDTLS_ERR_MPI_NEGATIVE_VALUE Base test mbedtls_mpi_mod_int #5 (Negative modulo) mbedtls_mpi_mod_int:10:"-1000":-13:0:MBEDTLS_ERR_MPI_NEGATIVE_VALUE Base test mbedtls_mpi_mod_int #6 (By 1) mbedtls_mpi_mod_int:10:"1000":1:0:0 Base test mbedtls_mpi_mod_int #7 (By 2) mbedtls_mpi_mod_int:10:"1001":2:1:0 Base test mbedtls_mpi_mod_int #8 (By 2) mbedtls_mpi_mod_int:10:"1000":2:0:0 Base test mbedtls_mpi_exp_mod #1 mbedtls_mpi_exp_mod:10:"23":10:"13":10:"29":10:"":10:"24":0 Base test mbedtls_mpi_exp_mod #2 (Even N) mbedtls_mpi_exp_mod:10:"23":10:"13":10:"30":10:"":10:"0":MBEDTLS_ERR_MPI_BAD_INPUT_DATA Base test mbedtls_mpi_exp_mod #3 (Negative N) mbedtls_mpi_exp_mod:10:"23":10:"13":10:"-29":10:"":10:"0":MBEDTLS_ERR_MPI_BAD_INPUT_DATA Base test mbedtls_mpi_exp_mod #4 (Negative base) mbedtls_mpi_exp_mod:10:"-23":10:"13":10:"29":10:"":10:"5":0 Base test mbedtls_mpi_exp_mod #5 (Negative exponent) mbedtls_mpi_exp_mod:10:"23":10:"-13":10:"29":10:"":10:"0":MBEDTLS_ERR_MPI_BAD_INPUT_DATA Base test mbedtls_mpi_exp_mod #7 (Negative base + exponent) mbedtls_mpi_exp_mod:10:"-23":10:"-13":10:"29":10:"":10:"0":MBEDTLS_ERR_MPI_BAD_INPUT_DATA Test mbedtls_mpi_exp_mod #1 mbedtls_mpi_exp_mod:10:"433019240910377478217373572959560109819648647016096560523769010881172869083338285573756574557395862965095016483867813043663981946477698466501451832407592327356331263124555137732393938242285782144928753919588632679050799198937132922145084847":10:"5781538327977828897150909166778407659250458379645823062042492461576758526757490910073628008613977550546382774775570888130029763571528699574717583228939535960234464230882573615930384979100379102915657483866755371559811718767760594919456971354184113721":10:"583137007797276923956891216216022144052044091311388601652961409557516421612874571554415606746479105795833145583959622117418531166391184939066520869800857530421873250114773204354963864729386957427276448683092491947566992077136553066273207777134303397724679138833126700957":10:"":10:"114597449276684355144920670007147953232659436380163461553186940113929777196018164149703566472936578890991049344459204199888254907113495794730452699842273939581048142004834330369483813876618772578869083248061616444392091693787039636316845512292127097865026290173004860736":0 Test mbedtls_mpi_exp_mod (Negative base) mbedtls_mpi_exp_mod:10:"-10000000000":10:"10000000000":10:"99999":10:"":10:"99998":0 Test mbedtls_mpi_exp_mod (Negative base) mbedtls_mpi_exp_mod:16:"-9f13012cd92aa72fb86ac8879d2fde4f7fd661aaae43a00971f081cc60ca277059d5c37e89652e2af2585d281d66ef6a9d38a117e9608e9e7574cd142dc55278838a2161dd56db9470d4c1da2d5df15a908ee2eb886aaa890f23be16de59386663a12f1afbb325431a3e835e3fd89b98b96a6f77382f458ef9a37e1f84a03045c8676ab55291a94c2228ea15448ee96b626b998":16:"40a54d1b9e86789f06d9607fb158672d64867665c73ee9abb545fc7a785634b354c7bae5b962ce8040cf45f2c1f3d3659b2ee5ede17534c8fc2ec85c815e8df1fe7048d12c90ee31b88a68a081f17f0d8ce5f4030521e9400083bcea73a429031d4ca7949c2000d597088e0c39a6014d8bf962b73bb2e8083bd0390a4e00b9b3":16:"eeaf0ab9adb38dd69c33f80afa8fc5e86072618775ff3c0b9ea2314c9c256576d674df7496ea81d3383b4813d692c6e0e0d5d8e250b98be48e495c1d6089dad15dc7d7b46154d6b6ce8ef4ad69b15d4982559b297bcf1885c529f566660e57ec68edbc3c05726cc02fd4cbf4976eaa9afd5138fe8376435b9fc61d2fc0eb06e3":16:"":16:"21acc7199e1b90f9b4844ffe12c19f00ec548c5d32b21c647d48b6015d8eb9ec9db05b4f3d44db4227a2b5659c1a7cceb9d5fa8fa60376047953ce7397d90aaeb7465e14e820734f84aa52ad0fc66701bcbb991d57715806a11531268e1e83dd48288c72b424a6287e9ce4e5cc4db0dd67614aecc23b0124a5776d36e5c89483":0 Base test GCD #1 mbedtls_mpi_gcd:10:"693":10:"609":10:"21" Base test GCD #2 mbedtls_mpi_gcd:10:"1764":10:"868":10:"28" Base test GCD #3 mbedtls_mpi_gcd:10:"768454923":10:"542167814":10:"1" Test GCD #1 mbedtls_mpi_gcd:10:"433019240910377478217373572959560109819648647016096560523769010881172869083338285573756574557395862965095016483867813043663981946477698466501451832407592327356331263124555137732393938242285782144928753919588632679050799198937132922145084847":10:"5781538327977828897150909166778407659250458379645823062042492461576758526757490910073628008613977550546382774775570888130029763571528699574717583228939535960234464230882573615930384979100379102915657483866755371559811718767760594919456971354184113721":10:"1" Base test mbedtls_mpi_inv_mod #1 mbedtls_mpi_inv_mod:10:"3":10:"11":10:"4":0 Base test mbedtls_mpi_inv_mod #2 mbedtls_mpi_inv_mod:10:"3":10:"0":10:"0":MBEDTLS_ERR_MPI_BAD_INPUT_DATA Base test mbedtls_mpi_inv_mod #3 mbedtls_mpi_inv_mod:10:"3":10:"-11":10:"4":MBEDTLS_ERR_MPI_BAD_INPUT_DATA Base test mbedtls_mpi_inv_mod #4 mbedtls_mpi_inv_mod:10:"2":10:"4":10:"0":MBEDTLS_ERR_MPI_NOT_ACCEPTABLE Test mbedtls_mpi_inv_mod #1 mbedtls_mpi_inv_mod:16:"aa4df5cb14b4c31237f98bd1faf527c283c2d0f3eec89718664ba33f9762907c":16:"fffbbd660b94412ae61ead9c2906a344116e316a256fd387874c6c675b1d587d":16:"8d6a5c1d7adeae3e94b9bcd2c47e0d46e778bc8804a2cc25c02d775dc3d05b0c":0 Base test mbedtls_mpi_is_prime #1 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"0":MBEDTLS_ERR_MPI_NOT_ACCEPTABLE Base test mbedtls_mpi_is_prime #2 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"1":MBEDTLS_ERR_MPI_NOT_ACCEPTABLE Base test mbedtls_mpi_is_prime #3 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"2":0 Base test mbedtls_mpi_is_prime #4 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"3":0 Base test mbedtls_mpi_is_prime #5 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"4":MBEDTLS_ERR_MPI_NOT_ACCEPTABLE Base test mbedtls_mpi_is_prime #6 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"5":0 Base test mbedtls_mpi_is_prime #7 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"27":MBEDTLS_ERR_MPI_NOT_ACCEPTABLE Base test mbedtls_mpi_is_prime #8 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"47":0 Test mbedtls_mpi_is_prime #1a depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"83726728883146151979668243326097049289208482987685965276439157162337476477581":MBEDTLS_ERR_MPI_NOT_ACCEPTABLE Test mbedtls_mpi_is_prime #1b depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"81248637410584921454869308488899267096530643632730258201256092582281263244641":MBEDTLS_ERR_MPI_NOT_ACCEPTABLE Test mbedtls_mpi_is_prime #2a depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"827131507221654563937832686696200995595835694437983658840870036586124168186967796809117749047430768825822857042432722828096779098498192459819306321073968735177531164565305635281198148032612029767584644305912099":0 Test mbedtls_mpi_is_prime #2b depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"827131507221654563937832686696200995595835694437983658840870036586124168186967796809117749047430768825822857042432722828096779098498192459819306321073968735177531164565305635281198148032612029767584644305912001":MBEDTLS_ERR_MPI_NOT_ACCEPTABLE Test mbedtls_mpi_is_prime #3 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"2833419889721787128217599":0 Test mbedtls_mpi_is_prime #4 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"195845982777569926302400511":0 Test mbedtls_mpi_is_prime #5 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"4776913109852041418248056622882488319":0 Test mbedtls_mpi_is_prime #5 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"768614336404564651":0 Test mbedtls_mpi_is_prime #6 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"201487636602438195784363":0 Test mbedtls_mpi_is_prime #7 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"845100400152152934331135470251":0 Test mbedtls_mpi_is_prime #8 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"56713727820156410577229101238628035243":0 Test mbedtls_mpi_is_prime #9 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"203956878356401977405765866929034577280193993314348263094772646453283062722701277632936616063144088173312372882677123879538709400158306567338328279154499698366071906766440037074217117805690872792848149112022286332144876183376326512083574821647933992961249917319836219304274280243803104015000563790123":0 Test mbedtls_mpi_is_prime #10 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"531872289054204184185084734375133399408303613982130856645299464930952178606045848877129147820387996428175564228204785846141207532462936339834139412401975338705794646595487324365194792822189473092273993580587964571659678084484152603881094176995594813302284232006001752128168901293560051833646881436219":0 Test mbedtls_mpi_is_prime #11 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"319705304701141539155720137200974664666792526059405792539680974929469783512821793995613718943171723765238853752439032835985158829038528214925658918372196742089464683960239919950882355844766055365179937610326127675178857306260955550407044463370239890187189750909036833976197804646589380690779463976173":0 Test mbedtls_mpi_is_prime #12 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"200603822195324642393516294012917598972967449320074999667103434371470616000652036570009912021332527788252300901905236578801044680456930305350440933538867383130165841118050781326291059830545891570648243241795871":0 Test mbedtls_mpi_is_prime #13 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"827131507221654563937832686696200995595835694437983658840870036586124168186967796809117749047430768825822857042432722828096779098498192459819306321073968735177531164565305635281198148032612029767584644305912099":0 Test mbedtls_mpi_is_prime #14 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"964274047248418797145090983157197980855078966882276492572788532954904112655338439361306213898569516593744267391754033306465125919199692703323878557833023573312685002670662846477592597659826113460619815244721311":0 Test mbedtls_mpi_is_prime #15 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"170141183460469231731687303715884105727":0 Test mbedtls_mpi_is_prime #16 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"2147483647":0 Test mbedtls_mpi_is_prime #17 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"961748941":0 Test mbedtls_mpi_is_prime #18 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"179424691":0 Test mbedtls_mpi_is_prime #19 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"32452867":0 Test mbedtls_mpi_is_prime #20 depends_on:MBEDTLS_GENPRIME mbedtls_mpi_is_prime:10:"49979687":0 Test mbedtls_mpi_gen_prime (Too small) depends_on:MBEDTLS_GENPRIME mbedtls_mpi_gen_prime:2:0:MBEDTLS_ERR_MPI_BAD_INPUT_DATA Test mbedtls_mpi_gen_prime (OK, minimum size) depends_on:MBEDTLS_GENPRIME mbedtls_mpi_gen_prime:3:0:0 Test mbedtls_mpi_gen_prime (Larger) depends_on:MBEDTLS_GENPRIME mbedtls_mpi_gen_prime:128:0:0 Test mbedtls_mpi_gen_prime (Safe) depends_on:MBEDTLS_GENPRIME mbedtls_mpi_gen_prime:128:1:0 Test bit getting (Value bit 25) mbedtls_mpi_get_bit:10:"49979687":25:1 Test bit getting (Larger but same limb) mbedtls_mpi_get_bit:10:"49979687":26:0 Test bit getting (Larger and non-existing limb) mbedtls_mpi_get_bit:10:"49979687":500:0 Test bit getting (Value bit 24) mbedtls_mpi_get_bit:10:"49979687":24:0 Test bit getting (Value bit 23) mbedtls_mpi_get_bit:10:"49979687":23:1 Test bit set (Change existing value with a 1) mbedtls_mpi_set_bit:10:"49979687":24:1:10:"66756903":0 Test bit set (Change existing value with a 0) mbedtls_mpi_set_bit:10:"49979687":25:0:10:"16425255":0 Test bit set (Add above existing limbs with a 0) mbedtls_mpi_set_bit:10:"49979687":80:0:10:"49979687":0 Test bit set (Add above existing limbs with a 1) mbedtls_mpi_set_bit:10:"49979687":80:1:10:"1208925819614629224685863":0 Test bit set (Bit index larger than 31 with a 0) mbedtls_mpi_set_bit:16:"FFFFFFFFFFFFFFFF":32:0:16:"FFFFFFFEFFFFFFFF":0 Test bit set (Bit index larger than 31 with a 1) mbedtls_mpi_set_bit:16:"00":32:1:16:"0100000000":0 Test bit set (Invalid bit value) mbedtls_mpi_set_bit:16:"00":5:2:16:"00":MBEDTLS_ERR_MPI_BAD_INPUT_DATA MPI Selftest depends_on:MBEDTLS_SELF_TEST mpi_selftest:
{ "pile_set_name": "Github" }
package com.univocity.trader.indicators; import com.univocity.trader.candles.Candle; import com.univocity.trader.indicators.base.SingleValueIndicator; import com.univocity.trader.indicators.base.TimeInterval; import com.univocity.trader.strategy.Indicator; public class CommodityChannelIndex extends SingleValueIndicator { private double value; private final double factor; private final TypicalPrice typicalPriceInd; private final MovingAverage smaInd; private final MeanDeviation meanDeviationInd; public CommodityChannelIndex(int length, TimeInterval interval) { super(interval, null); factor = 0.015; typicalPriceInd = new TypicalPrice(interval); smaInd = new MovingAverage(length, interval, c -> typicalPriceInd.getValue()); meanDeviationInd = new MeanDeviation(length, interval, c -> typicalPriceInd.getValue()); } @Override protected boolean process(Candle candle, double value, boolean updating) { typicalPriceInd.accumulate(candle); smaInd.accumulate(candle); meanDeviationInd.accumulate(candle); final double typicalPrice = typicalPriceInd.getValue(); final double typicalPriceAvg = smaInd.getValue(); final double meanDeviation = meanDeviationInd.getValue(); if (meanDeviation == 0.0) { this.value = 0.0; } else { this.value = (typicalPrice - typicalPriceAvg) / (meanDeviation * factor); } return true; } @Override public double getValue() { return value; } @Override protected Indicator[] children() { return new Indicator[]{typicalPriceInd, smaInd, meanDeviationInd}; } }
{ "pile_set_name": "Github" }
%% %% %CopyrightBegin% %% %% Copyright Ericsson AB 2018-2018. 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. %% %% %CopyrightEnd% %% %% -module(ssl_ECC). -include_lib("common_test/include/ct.hrl"). -include_lib("public_key/include/public_key.hrl"). -export([client_ecdh_rsa_server_ecdh_rsa/1, client_ecdhe_rsa_server_ecdh_rsa/1, client_ecdhe_ecdsa_server_ecdh_rsa/1, client_ecdh_rsa_server_ecdhe_rsa/1, client_ecdhe_rsa_server_ecdhe_rsa/1, client_ecdhe_ecdsa_server_ecdhe_rsa/1, client_ecdh_ecdsa_server_ecdh_ecdsa/1, client_ecdhe_rsa_server_ecdh_ecdsa/1, client_ecdhe_ecdsa_server_ecdh_ecdsa/1, client_ecdh_rsa_server_ecdhe_ecdsa/1, client_ecdh_ecdsa_server_ecdhe_ecdsa/1, client_ecdhe_ecdsa_server_ecdhe_ecdsa/1 ]). %% Test diffrent certificate chain types, note that it is the servers %% chain that affect what cipher suite that will be choosen %% ECDH_RSA client_ecdh_rsa_server_ecdh_rsa(Config) when is_list(Config) -> Ext = x509_test:extensions([{key_usage, [keyAgreement]}]), Suites = all_rsa_suites(Config), Default = ssl_test_lib:default_cert_chain_conf(), {COpts, SOpts} = ssl_test_lib:make_ec_cert_chains([{server_chain, [[], [], [{extensions, Ext}]]}, {client_chain, Default}], ecdh_rsa, ecdh_rsa, Config), ssl_test_lib:basic_test(ssl_test_lib:ssl_options(COpts, Config), ssl_test_lib:ssl_options(SOpts, Config), [{check_keyex, ecdh_rsa}, {ciphers, Suites} | proplists:delete(check_keyex, Config)]). client_ecdhe_rsa_server_ecdh_rsa(Config) when is_list(Config) -> Ext = x509_test:extensions([{key_usage, [keyAgreement]}]), Suites = all_rsa_suites(Config), Default = ssl_test_lib:default_cert_chain_conf(), {COpts, SOpts} = ssl_test_lib:make_ec_cert_chains([{server_chain, [[], [], [{extensions, Ext}]]}, {client_chain, Default}], ecdhe_rsa, ecdh_rsa, Config), ssl_test_lib:basic_test(ssl_test_lib:ssl_options(COpts, Config), ssl_test_lib:ssl_options(SOpts, Config), [{check_keyex, ecdh_rsa}, {ciphers, Suites} | proplists:delete(check_keyex, Config)]). client_ecdhe_ecdsa_server_ecdh_rsa(Config) when is_list(Config) -> Ext = x509_test:extensions([{key_usage, [keyAgreement]}]), Suites = all_rsa_suites(Config), Default = ssl_test_lib:default_cert_chain_conf(), {COpts, SOpts} = ssl_test_lib:make_ec_cert_chains([{server_chain, [[], [], [{extensions, Ext}]]}, {client_chain, Default}], ecdhe_ecdsa, ecdh_rsa, Config), ssl_test_lib:basic_test(ssl_test_lib:ssl_options(COpts, Config), ssl_test_lib:ssl_options(SOpts, Config), [{check_keyex, ecdh_rsa}, {ciphers, Suites} | proplists:delete(check_keyex, Config)]). %% ECDHE_RSA client_ecdh_rsa_server_ecdhe_rsa(Config) when is_list(Config) -> Ext = x509_test:extensions([{key_usage, [digitalSignature]}]), Default = ssl_test_lib:default_cert_chain_conf(), {COpts, SOpts} = ssl_test_lib:make_ec_cert_chains([{server_chain, [[], [], [{extensions, Ext}]]}, {client_chain, Default}], ecdh_rsa, ecdhe_rsa, Config), ssl_test_lib:basic_test(ssl_test_lib:ssl_options(COpts, Config), ssl_test_lib:ssl_options(SOpts, Config), [{check_keyex, ecdhe_rsa} | proplists:delete(check_keyex, Config)]). client_ecdhe_rsa_server_ecdhe_rsa(Config) when is_list(Config) -> Ext = x509_test:extensions([{key_usage, [digitalSignature]}]), Default = ssl_test_lib:default_cert_chain_conf(), {COpts, SOpts} = ssl_test_lib:make_ec_cert_chains([{server_chain, [[], [], [{extensions, Ext}]]}, {client_chain, Default}], ecdhe_rsa, ecdhe_rsa, Config), ssl_test_lib:basic_test(ssl_test_lib:ssl_options(COpts, Config), ssl_test_lib:ssl_options(SOpts, Config), [{check_keyex, ecdhe_rsa} | proplists:delete(check_keyex, Config)]). client_ecdhe_ecdsa_server_ecdhe_rsa(Config) when is_list(Config) -> Ext = x509_test:extensions([{key_usage, [digitalSignature]}]), Default = ssl_test_lib:default_cert_chain_conf(), {COpts, SOpts} = ssl_test_lib:make_ec_cert_chains([{server_chain, [[], [], [{extensions, Ext}]]}, {client_chain, Default}], ecdh_ecdsa, ecdhe_rsa, Config), ssl_test_lib:basic_test(ssl_test_lib:ssl_options(COpts, Config), ssl_test_lib:ssl_options(SOpts, Config), [{check_keyex, ecdhe_rsa} | proplists:delete(check_keyex, Config)]). %% ECDH_ECDSA client_ecdh_ecdsa_server_ecdh_ecdsa(Config) when is_list(Config) -> Ext = x509_test:extensions([{key_usage, [keyAgreement]}]), {COpts, SOpts} = ssl_test_lib:make_ec_cert_chains([{server_chain, [[], [], [{extensions, Ext}]]}, {client_chain, ssl_test_lib:default_cert_chain_conf()}], ecdh_ecdsa, ecdh_ecdsa, Config), ssl_test_lib:basic_test(ssl_test_lib:ssl_options(COpts, Config), ssl_test_lib:ssl_options(SOpts, Config), [{check_keyex, ecdh_ecdsa} | proplists:delete(check_keyex, Config)]). client_ecdhe_rsa_server_ecdh_ecdsa(Config) when is_list(Config) -> Ext = x509_test:extensions([{key_usage, [keyAgreement]}]), {COpts, SOpts} = ssl_test_lib:make_ec_cert_chains([{server_chain, [[], [], [{extensions, Ext}]]}, {client_chain, ssl_test_lib:default_cert_chain_conf()}], ecdhe_rsa, ecdh_ecdsa, Config), ssl_test_lib:basic_test(ssl_test_lib:ssl_options(COpts, Config), ssl_test_lib:ssl_options(SOpts, Config), [{check_keyex, ecdh_ecdsa} | proplists:delete(check_keyex, Config)]). client_ecdhe_ecdsa_server_ecdh_ecdsa(Config) when is_list(Config) -> Ext = x509_test:extensions([{key_usage, [keyAgreement]}]), {COpts, SOpts} = ssl_test_lib:make_ec_cert_chains([{server_chain, [[], [], [{extensions, Ext}]]}, {client_chain, ssl_test_lib:default_cert_chain_conf()}], ecdhe_ecdsa, ecdh_ecdsa, Config), ssl_test_lib:basic_test(ssl_test_lib:ssl_options(COpts, Config), ssl_test_lib:ssl_options(SOpts, Config), [{check_keyex, ecdh_ecdsa} | proplists:delete(check_keyex, Config)]). %% ECDHE_ECDSA client_ecdh_rsa_server_ecdhe_ecdsa(Config) when is_list(Config) -> Ext = x509_test:extensions([{key_usage, [digitalSignature]}]), Default = ssl_test_lib:default_cert_chain_conf(), {COpts, SOpts} = ssl_test_lib:make_ec_cert_chains([{server_chain, [[], [], [{extensions, Ext}]]}, {client_chain, Default}], ecdh_rsa, ecdhe_ecdsa, Config), ssl_test_lib:basic_test(ssl_test_lib:ssl_options(COpts, Config), ssl_test_lib:ssl_options(SOpts, Config), [{check_keyex, ecdhe_ecdsa} | proplists:delete(check_keyex, Config)]). client_ecdh_ecdsa_server_ecdhe_ecdsa(Config) when is_list(Config) -> Ext = x509_test:extensions([{key_usage, [digitalSignature]}]), Default = ssl_test_lib:default_cert_chain_conf(), {COpts, SOpts} = ssl_test_lib:make_ec_cert_chains([{server_chain, [[], [], [{extensions, Ext}]]}, {client_chain, Default}], ecdh_ecdsa, ecdhe_ecdsa, Config), ssl_test_lib:basic_test(ssl_test_lib:ssl_options(COpts, Config), ssl_test_lib:ssl_options(SOpts, Config), [{check_keyex, ecdhe_ecdsa} | proplists:delete(check_keyex, Config)]). client_ecdhe_ecdsa_server_ecdhe_ecdsa(Config) when is_list(Config) -> Ext = x509_test:extensions([{key_usage, [digitalSignature]}]), Default = ssl_test_lib:default_cert_chain_conf(), {COpts, SOpts} = ssl_test_lib:make_ec_cert_chains([{server_chain, [[], [], [{extensions, Ext}]]}, {client_chain, Default}], ecdhe_ecdsa, ecdhe_ecdsa, Config), ssl_test_lib:basic_test(ssl_test_lib:ssl_options(COpts, Config), ssl_test_lib:ssl_options(SOpts, Config), [{check_keyex, ecdhe_ecdsa} | proplists:delete(check_keyex, Config)]). %%-------------------------------------------------------------------- %% Internal functions ----------------------------------------------- %%-------------------------------------------------------------------- all_rsa_suites(Config) -> Version = proplists:get_value(tls_version, Config), All = ssl:cipher_suites(all, Version), Default = ssl:cipher_suites(default, Version), RSASuites = ssl:filter_cipher_suites(All,[{key_exchange, fun(rsa) -> true;(_) -> false end}]), ssl:append_cipher_suites(RSASuites, Default).
{ "pile_set_name": "Github" }
////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_CONTAINER_USES_ALLOCATOR_FWD_HPP #define BOOST_CONTAINER_USES_ALLOCATOR_FWD_HPP #include <boost/container/detail/workaround.hpp> #include <boost/container/detail/std_fwd.hpp> //! \file //! This header forward declares boost::container::constructible_with_allocator_prefix, //! boost::container::constructible_with_allocator_suffix and //! boost::container::uses_allocator. Also defines the following types: namespace boost { namespace container { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED template <int Dummy = 0> struct std_allocator_arg_holder { static ::std::allocator_arg_t *dummy; }; template <int Dummy> //Silence null-reference compiler warnings ::std::allocator_arg_t *std_allocator_arg_holder<Dummy>::dummy = reinterpret_cast< ::std::allocator_arg_t * >(0x1234); typedef const std::allocator_arg_t & allocator_arg_t; #else //! The allocator_arg_t struct is an empty structure type used as a unique type to //! disambiguate constructor and function overloading. Specifically, several types //! have constructors with allocator_arg_t as the first argument, immediately followed //! by an argument of a type that satisfies Allocator requirements typedef unspecified allocator_arg_t; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED //! The `erased_type` struct is an empty struct that serves as a placeholder for a type //! T in situations where the actual type T is determined at runtime. For example, //! the nested type, `allocator_type`, is an alias for `erased_type` in classes that //! use type-erased allocators. struct erased_type {}; //! A instance of type //! allocator_arg_t static allocator_arg_t allocator_arg = BOOST_CONTAINER_DOC1ST(unspecified, *std_allocator_arg_holder<>::dummy); // @cond template <class T> struct constructible_with_allocator_suffix; template <class T> struct constructible_with_allocator_prefix; template <typename T, typename Allocator> struct uses_allocator; // @endcond }} // namespace boost { namespace container { #endif //BOOST_CONTAINER_USES_ALLOCATOR_HPP
{ "pile_set_name": "Github" }
[holland:backup] plugin = random backups-to-keep = 1 auto-purge-failures = yes purge-policy = after-backup [random] bytes = 222
{ "pile_set_name": "Github" }
class WebBrowserRefreshOption(Enum,IComparable,IFormattable,IConvertible): """ Specifies constants that define how the System.Windows.Forms.WebBrowser control can refresh its contents. enum WebBrowserRefreshOption,values: Completely (3),Continue (2),IfExpired (1),Normal (0) """ def __eq__(self,*args): """ x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """ pass def __format__(self,*args): """ __format__(formattable: IFormattable,format: str) -> str """ pass def __ge__(self,*args): pass def __gt__(self,*args): pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __le__(self,*args): pass def __lt__(self,*args): pass def __ne__(self,*args): pass def __reduce_ex__(self,*args): pass def __str__(self,*args): pass Completely=None Continue=None IfExpired=None Normal=None value__=None
{ "pile_set_name": "Github" }
JASC-PAL 0100 16 222 222 222 255 255 255 205 205 205 255 0 255 255 0 255 255 0 255 255 0 255 255 0 255 255 0 255 255 0 255 255 0 255 205 213 131 172 180 98 123 131 90 65 74 16 16 16 16
{ "pile_set_name": "Github" }
{ "domain": "xbox_live", "name": "Xbox Live", "documentation": "https://www.home-assistant.io/integrations/xbox_live", "requirements": ["xboxapi==2.0.1"], "codeowners": ["@MartinHjelmare"] }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2003-2020 Rony Shapiro <[email protected]>. * All rights reserved. Use of the code is allowed under the * Artistic License 2.0 terms, as specified in the LICENSE file * distributed with this code, or available from * http://www.opensource.org/licenses/artistic-license-2.0.php */ #pragma once #include "FilterBaseDlg.h" #include "core/Itemdata.h" // for CItemData::EntryStatus // CFilterEntryStatusDlg dialog class CFilterEntryStatusDlg : public CFilterBaseDlg { DECLARE_DYNAMIC(CFilterEntryStatusDlg) public: CFilterEntryStatusDlg(CWnd* pParent = NULL); // standard constructor virtual ~CFilterEntryStatusDlg(); // Dialog Data enum { IDD = IDD_FILTER_ENTRYSTATUS }; CItemData::EntryStatus m_estatus; protected: virtual BOOL OnInitDialog(); virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support afx_msg void OnCbnSelchangeEntryStatusRule(); afx_msg void OnCbnSelchangeEntryStatus1(); afx_msg void OnBnClickedOk(); DECLARE_MESSAGE_MAP() CComboBox m_cbxRule, m_cbxEStatus; private: int m_estatus2selection[CItemData::ES_LAST]; };
{ "pile_set_name": "Github" }
<?php /** * Pre-transform that changes converts a boolean attribute to fixed CSS */ class HTMLPurifier_AttrTransform_BoolToCSS extends HTMLPurifier_AttrTransform { /** * Name of boolean attribute that is trigger. * @type string */ protected $attr; /** * CSS declarations to add to style, needs trailing semicolon. * @type string */ protected $css; /** * @param string $attr attribute name to convert from * @param string $css CSS declarations to add to style (needs semicolon) */ public function __construct($attr, $css) { $this->attr = $attr; $this->css = $css; } /** * @param array $attr * @param HTMLPurifier_Config $config * @param HTMLPurifier_Context $context * @return array */ public function transform($attr, $config, $context) { if (!isset($attr[$this->attr])) { return $attr; } unset($attr[$this->attr]); $this->prependCSS($attr, $this->css); return $attr; } } // vim: et sw=4 sts=4
{ "pile_set_name": "Github" }
function Cw = getCameraCenter(camRtC2W) Cw = camRtC2W(1:3,4);
{ "pile_set_name": "Github" }
{burn} = require './burner' processor = require './processor' {SignatureEngine} = require('./sigeng') #----------------------------- exports.box = burn exports.unbox = processor.do_message exports.SignatureEngine = SignatureEngine #-----------------------------
{ "pile_set_name": "Github" }
entity repro1 is end repro1; architecture behav of repro1 is signal s1, s2 : bit; component comp port (i : in bit; o : out bit); end component; begin s1 <= '1'; c : comp port map (i => s1, o => s2); end behav;
{ "pile_set_name": "Github" }
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * @category Zend * @package Zend_Pdf * @subpackage Actions * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Rendition.php 20096 2010-01-06 02:05:09Z bkarwin $ */ /** Zend_Pdf_Action */ #require_once 'Zend/Pdf/Action.php'; /** * PDF 'Controls the playing of multimedia content' action * PDF 1.5+ feature * * @package Zend_Pdf * @subpackage Actions * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Pdf_Action_Rendition extends Zend_Pdf_Action { }
{ "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="en"> <head> <!-- Generated by javadoc (1.8.0_152-release) on Fri Jul 13 11:56:24 IST 2018 --> <title>Uses of Package com.androidhiddencamera</title> <meta name="date" content="2018-07-13"> <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="Uses of Package com.androidhiddencamera"; } } 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</li> <li class="navBarCell1Rev">Use</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../deprecated-list.html">Deprecated</a></li> <li><a href="../../index-files/index-1.html">Index</a></li> <li><a href="../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../index.html?com/androidhiddencamera/package-use.html" target="_top">Frames</a></li> <li><a href="package-use.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> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 title="Uses of Package com.androidhiddencamera" class="title">Uses of Package<br>com.androidhiddencamera</h1> </div> <div class="contentContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../com/androidhiddencamera/package-summary.html">com.androidhiddencamera</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#com.androidhiddencamera">com.androidhiddencamera</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#com.kevalpatel2106.sample">com.kevalpatel2106.sample</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.androidhiddencamera"> <!-- --> </a> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in <a href="../../com/androidhiddencamera/package-summary.html">com.androidhiddencamera</a> used by <a href="../../com/androidhiddencamera/package-summary.html">com.androidhiddencamera</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colOne"><a href="../../com/androidhiddencamera/class-use/CameraCallbacks.html#com.androidhiddencamera">CameraCallbacks</a> <div class="block">Created by Keval on 14-Oct-16.</div> </td> </tr> <tr class="rowColor"> <td class="colOne"><a href="../../com/androidhiddencamera/class-use/CameraConfig.html#com.androidhiddencamera">CameraConfig</a> <div class="block">Created by Keval on 12-Nov-16.</div> </td> </tr> <tr class="altColor"> <td class="colOne"><a href="../../com/androidhiddencamera/class-use/CameraConfig.Builder.html#com.androidhiddencamera">CameraConfig.Builder</a>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colOne"><a href="../../com/androidhiddencamera/class-use/CameraError.CameraErrorCodes.html#com.androidhiddencamera">CameraError.CameraErrorCodes</a>&nbsp;</td> </tr> <tr class="altColor"> <td class="colOne"><a href="../../com/androidhiddencamera/class-use/CameraPreview.html#com.androidhiddencamera">CameraPreview</a> <div class="block">Created by Keval on 10-Nov-16.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.kevalpatel2106.sample"> <!-- --> </a> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in <a href="../../com/androidhiddencamera/package-summary.html">com.androidhiddencamera</a> used by <a href="../../com/kevalpatel2106/sample/package-summary.html">com.kevalpatel2106.sample</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colOne"><a href="../../com/androidhiddencamera/class-use/CameraCallbacks.html#com.kevalpatel2106.sample">CameraCallbacks</a> <div class="block">Created by Keval on 14-Oct-16.</div> </td> </tr> <tr class="rowColor"> <td class="colOne"><a href="../../com/androidhiddencamera/class-use/CameraConfig.html#com.kevalpatel2106.sample">CameraConfig</a> <div class="block">Created by Keval on 12-Nov-16.</div> </td> </tr> <tr class="altColor"> <td class="colOne"><a href="../../com/androidhiddencamera/class-use/CameraError.CameraErrorCodes.html#com.kevalpatel2106.sample">CameraError.CameraErrorCodes</a>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colOne"><a href="../../com/androidhiddencamera/class-use/HiddenCameraActivity.html#com.kevalpatel2106.sample">HiddenCameraActivity</a> <div class="block">Created by Keval on 27-Oct-16.</div> </td> </tr> <tr class="altColor"> <td class="colOne"><a href="../../com/androidhiddencamera/class-use/HiddenCameraFragment.html#com.kevalpatel2106.sample">HiddenCameraFragment</a> <div class="block">Created by Keval on 27-Oct-16.</div> </td> </tr> <tr class="rowColor"> <td class="colOne"><a href="../../com/androidhiddencamera/class-use/HiddenCameraService.html#com.kevalpatel2106.sample">HiddenCameraService</a> <div class="block">Created by Keval on 27-Oct-16.</div> </td> </tr> </tbody> </table> </li> </ul> </div> <!-- ======= 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</li> <li class="navBarCell1Rev">Use</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../deprecated-list.html">Deprecated</a></li> <li><a href="../../index-files/index-1.html">Index</a></li> <li><a href="../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../index.html?com/androidhiddencamera/package-use.html" target="_top">Frames</a></li> <li><a href="package-use.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> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "pile_set_name": "Github" }
package registry import ( "fmt" "github.com/docker/distribution/reference" digest "github.com/opencontainers/go-digest" ) // Image holds information about an image. type Image struct { Domain string Path string Tag string Digest digest.Digest named reference.Named } // String returns the string representation of an image. func (i Image) String() string { return i.named.String() } // Reference returns either the digest if it is non-empty or the tag for the image. func (i Image) Reference() string { if len(i.Digest.String()) > 1 { return i.Digest.String() } return i.Tag } // WithDigest sets the digest for an image. func (i *Image) WithDigest(digest digest.Digest) (err error) { i.Digest = digest i.named, err = reference.WithDigest(i.named, digest) return err } // ParseImage returns an Image struct with all the values filled in for a given image. func ParseImage(image string) (Image, error) { // Parse the image name and tag. named, err := reference.ParseNormalizedNamed(image) if err != nil { return Image{}, fmt.Errorf("parsing image %q failed: %v", image, err) } // Add the latest lag if they did not provide one. named = reference.TagNameOnly(named) i := Image{ named: named, Domain: reference.Domain(named), Path: reference.Path(named), } // Add the tag if there was one. if tagged, ok := named.(reference.Tagged); ok { i.Tag = tagged.Tag() } // Add the digest if there was one. if canonical, ok := named.(reference.Canonical); ok { i.Digest = canonical.Digest() } return i, nil }
{ "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 <objc/NSObject.h> #import <CFNetwork/NSURLSessionDelegate-Protocol.h> #import <CFNetwork/NSURLSessionTaskDelegate-Protocol.h> @class NSString; @interface myDelegates : NSObject <NSURLSessionTaskDelegate, NSURLSessionDelegate> { } - (void)URLSession:(id)arg1 didReceiveChallenge:(id)arg2 completionHandler:(CDUnknownBlockType)arg3; - (void)URLSession:(id)arg1 readClosedForStreamTask:(id)arg2; - (void)URLSession:(id)arg1 writeClosedForStreamTask:(id)arg2; - (void)URLSession:(id)arg1 task:(id)arg2 didCompleteWithError:(id)arg3; // 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" }
/* Copyright Rene Rivera 2013 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_PREDEF_DETAIL_ENDIAN_COMPAT_H #define BOOST_PREDEF_DETAIL_ENDIAN_COMPAT_H #include <boost/predef/other/endian.h> #if BOOST_ENDIAN_BIG_BYTE # define BOOST_BIG_ENDIAN # define BOOST_BYTE_ORDER 4321 #endif #if BOOST_ENDIAN_LITTLE_BYTE # define BOOST_LITTLE_ENDIAN # define BOOST_BYTE_ORDER 1234 #endif #if BOOST_ENDIAN_LITTLE_WORD # define BOOST_PDP_ENDIAN # define BOOST_BYTE_ORDER 2134 #endif #endif
{ "pile_set_name": "Github" }
#include "SpriteAnim_BindLua.h" #include "Vector_BindLua.h" const char SpriteAnim_BindLua::className[] = "SpriteAnim"; Luna<SpriteAnim_BindLua>::FunctionType SpriteAnim_BindLua::methods[] = { lunamethod(SpriteAnim_BindLua, SetRot), lunamethod(SpriteAnim_BindLua, SetRotation), lunamethod(SpriteAnim_BindLua, SetOpacity), lunamethod(SpriteAnim_BindLua, SetFade), lunamethod(SpriteAnim_BindLua, SetRepeatable), lunamethod(SpriteAnim_BindLua, SetVelocity), lunamethod(SpriteAnim_BindLua, SetScaleX), lunamethod(SpriteAnim_BindLua, SetScaleY), lunamethod(SpriteAnim_BindLua, SetMovingTexAnim), lunamethod(SpriteAnim_BindLua, SetDrawRecAnim), lunamethod(SpriteAnim_BindLua, GetRot), lunamethod(SpriteAnim_BindLua, GetRotation), lunamethod(SpriteAnim_BindLua, GetOpacity), lunamethod(SpriteAnim_BindLua, GetFade), lunamethod(SpriteAnim_BindLua, GetRepeatable), lunamethod(SpriteAnim_BindLua, GetVelocity), lunamethod(SpriteAnim_BindLua, GetScaleX), lunamethod(SpriteAnim_BindLua, GetScaleY), lunamethod(SpriteAnim_BindLua, GetMovingTexAnim), lunamethod(SpriteAnim_BindLua, GetDrawRecAnim), { NULL, NULL } }; Luna<SpriteAnim_BindLua>::PropertyType SpriteAnim_BindLua::properties[] = { { NULL, NULL } }; SpriteAnim_BindLua::SpriteAnim_BindLua(const wiSprite::Anim& anim) :anim(anim) { } SpriteAnim_BindLua::SpriteAnim_BindLua(lua_State *L) { anim = wiSprite::Anim(); } int SpriteAnim_BindLua::SetRot(lua_State *L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { anim.rot = wiLua::SGetFloat(L, 1); } else { wiLua::SError(L, "SetRot(float rot) not enough arguments!"); } return 0; } int SpriteAnim_BindLua::SetRotation(lua_State *L) { return SetRot(L); } int SpriteAnim_BindLua::SetOpacity(lua_State *L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { anim.opa = wiLua::SGetFloat(L, 1); } else { wiLua::SError(L, "SetOpacity(float val) not enough arguments!"); } return 0; } int SpriteAnim_BindLua::SetFade(lua_State *L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { anim.fad = wiLua::SGetFloat(L, 1); } else { wiLua::SError(L, "SetFade(float val) not enough arguments!"); } return 0; } int SpriteAnim_BindLua::SetRepeatable(lua_State *L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { anim.repeatable = wiLua::SGetBool(L, 1); } else { wiLua::SError(L, "SetRepeatable(float val) not enough arguments!"); } return 0; } int SpriteAnim_BindLua::SetVelocity(lua_State *L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { Vector_BindLua* vec = Luna<Vector_BindLua>::lightcheck(L, 1); if (vec != nullptr) { XMStoreFloat3(&anim.vel, vec->vector); } else { wiLua::SError(L, "SetVelocity(Vector val) argument is not a Vector!"); } } else { wiLua::SError(L, "SetVelocity(Vector val) not enough arguments!"); } return 0; } int SpriteAnim_BindLua::SetScaleX(lua_State *L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { anim.scaleX = wiLua::SGetFloat(L, 1); } else { wiLua::SError(L, "SetScaleX(float val) not enough arguments!"); } return 0; } int SpriteAnim_BindLua::SetScaleY(lua_State *L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { anim.scaleY = wiLua::SGetFloat(L, 1); } else { wiLua::SError(L, "SetScaleY(float val) not enough arguments!"); } return 0; } int SpriteAnim_BindLua::SetMovingTexAnim(lua_State *L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { MovingTexAnim_BindLua* data = Luna<MovingTexAnim_BindLua>::lightcheck(L, 1); if (data != nullptr) { anim.movingTexAnim = data->anim; } else { wiLua::SError(L, "SetMovingTexAnim(MovingTexAnim data) argument is not a MovingTexAnim!"); } } else { wiLua::SError(L, "SetMovingTexAnim(MovingTexAnim data) not enough arguments!"); } return 0; } int SpriteAnim_BindLua::SetDrawRecAnim(lua_State *L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { DrawRectAnim_BindLua* data = Luna<DrawRectAnim_BindLua>::lightcheck(L, 1); if (data != nullptr) { anim.drawRectAnim = data->anim; } else { wiLua::SError(L, "SetDrawRecAnim(DrawRecAnim data) argument is not a DrawRecAnim!"); } } else { wiLua::SError(L, "SetDrawRecAnim(DrawRecAnim data) not enough arguments!"); } return 0; } int SpriteAnim_BindLua::GetRot(lua_State *L) { wiLua::SSetFloat(L, anim.rot); return 1; } int SpriteAnim_BindLua::GetRotation(lua_State *L) { return GetRot(L); } int SpriteAnim_BindLua::GetOpacity(lua_State *L) { wiLua::SSetFloat(L, anim.opa); return 1; } int SpriteAnim_BindLua::GetFade(lua_State *L) { wiLua::SSetFloat(L, anim.fad); return 1; } int SpriteAnim_BindLua::GetRepeatable(lua_State *L) { wiLua::SSetBool(L, anim.repeatable); return 1; } int SpriteAnim_BindLua::GetVelocity(lua_State *L) { Luna<Vector_BindLua>::push(L, new Vector_BindLua(XMLoadFloat3(&anim.vel))); return 1; } int SpriteAnim_BindLua::GetScaleX(lua_State *L) { wiLua::SSetFloat(L, anim.scaleX); return 1; } int SpriteAnim_BindLua::GetScaleY(lua_State *L) { wiLua::SSetFloat(L, anim.scaleY); return 1; } int SpriteAnim_BindLua::GetMovingTexAnim(lua_State *L) { Luna<MovingTexAnim_BindLua>::push(L, new MovingTexAnim_BindLua(anim.movingTexAnim)); return 1; } int SpriteAnim_BindLua::GetDrawRecAnim(lua_State *L) { Luna<DrawRectAnim_BindLua>::push(L, new DrawRectAnim_BindLua(anim.drawRectAnim)); return 1; } void SpriteAnim_BindLua::Bind() { static bool initialized = false; if (!initialized) { initialized = true; Luna<SpriteAnim_BindLua>::Register(wiLua::GetLuaState()); Luna<MovingTexAnim_BindLua>::Register(wiLua::GetLuaState()); Luna<DrawRectAnim_BindLua>::Register(wiLua::GetLuaState()); } } const char MovingTexAnim_BindLua::className[] = "MovingTexAnim"; Luna<MovingTexAnim_BindLua>::FunctionType MovingTexAnim_BindLua::methods[] = { lunamethod(MovingTexAnim_BindLua, SetSpeedX), lunamethod(MovingTexAnim_BindLua, SetSpeedY), lunamethod(MovingTexAnim_BindLua, GetSpeedX), lunamethod(MovingTexAnim_BindLua, GetSpeedY), { NULL, NULL } }; Luna<MovingTexAnim_BindLua>::PropertyType MovingTexAnim_BindLua::properties[] = { { NULL, NULL } }; MovingTexAnim_BindLua::MovingTexAnim_BindLua(const wiSprite::Anim::MovingTexAnim& anim) :anim(anim) { } MovingTexAnim_BindLua::MovingTexAnim_BindLua(lua_State *L) { anim = wiSprite::Anim::MovingTexAnim(); int argc = wiLua::SGetArgCount(L); if (argc > 0) { anim.speedX = wiLua::SGetFloat(L, 1); if (argc > 1) { anim.speedY = wiLua::SGetFloat(L, 2); } } } MovingTexAnim_BindLua::~MovingTexAnim_BindLua() { } int MovingTexAnim_BindLua::SetSpeedX(lua_State *L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { anim.speedX = wiLua::SGetFloat(L, 1); } else { wiLua::SError(L, "SetSpeedX(float val) not enough arguments!"); } return 0; } int MovingTexAnim_BindLua::SetSpeedY(lua_State *L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { anim.speedY = wiLua::SGetFloat(L, 1); } else { wiLua::SError(L, "SetSpeedY(float val) not enough arguments!"); } return 0; } int MovingTexAnim_BindLua::GetSpeedX(lua_State *L) { wiLua::SSetFloat(L, anim.speedX); return 1; } int MovingTexAnim_BindLua::GetSpeedY(lua_State *L) { wiLua::SSetFloat(L, anim.speedY); return 1; } const char DrawRectAnim_BindLua::className[] = "DrawRecAnim"; Luna<DrawRectAnim_BindLua>::FunctionType DrawRectAnim_BindLua::methods[] = { lunamethod(DrawRectAnim_BindLua, SetFrameRate), lunamethod(DrawRectAnim_BindLua, SetFrameCount), lunamethod(DrawRectAnim_BindLua, SetHorizontalFrameCount), lunamethod(DrawRectAnim_BindLua, GetFrameRate), lunamethod(DrawRectAnim_BindLua, GetFrameCount), lunamethod(DrawRectAnim_BindLua, GetHorizontalFrameCount), { NULL, NULL } }; Luna<DrawRectAnim_BindLua>::PropertyType DrawRectAnim_BindLua::properties[] = { { NULL, NULL } }; DrawRectAnim_BindLua::DrawRectAnim_BindLua(const wiSprite::Anim::DrawRectAnim& data) :anim(anim) { } DrawRectAnim_BindLua::DrawRectAnim_BindLua(lua_State *L) { anim = wiSprite::Anim::DrawRectAnim(); } DrawRectAnim_BindLua::~DrawRectAnim_BindLua() { } int DrawRectAnim_BindLua::SetFrameRate(lua_State* L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { anim.frameRate = wiLua::SGetFloat(L, 1); } else { wiLua::SError(L, "SetFrameRate(float val) not enough arguments!"); } return 0; } int DrawRectAnim_BindLua::SetFrameCount(lua_State* L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { anim.frameCount = wiLua::SGetInt(L, 1); } else { wiLua::SError(L, "SetFrameCount(int val) not enough arguments!"); } return 0; } int DrawRectAnim_BindLua::SetHorizontalFrameCount(lua_State* L) { int argc = wiLua::SGetArgCount(L); if (argc > 0) { anim.horizontalFrameCount = wiLua::SGetInt(L, 1); } else { wiLua::SError(L, "SetHorizontalFrameCount(int val) not enough arguments!"); } return 0; } int DrawRectAnim_BindLua::GetFrameRate(lua_State* L) { wiLua::SSetFloat(L, anim.frameRate); return 1; } int DrawRectAnim_BindLua::GetFrameCount(lua_State* L) { wiLua::SSetInt(L, anim.frameCount); return 1; } int DrawRectAnim_BindLua::GetHorizontalFrameCount(lua_State* L) { wiLua::SSetInt(L, anim.horizontalFrameCount); return 1; }
{ "pile_set_name": "Github" }
/* This Java source file was generated by test-to-java.xsl and is a derived work from the source document. The source document contained the following notice: Copyright (c) 2001-2004 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property 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 W3C License http://www.w3.org/Consortium/Legal/ for more details. */ package org.w3c.domts.level1.core; import org.w3c.dom.*; import org.w3c.domts.DOMTestCase; import org.w3c.domts.DOMTestDocumentBuilderFactory; /** * The "getSpecified()" method for an Attr node should return true if the * value of the attribute is changed. * Retrieve the attribute named "class" from the last * child of of the THIRD employee and change its * value to "Yes"(which is the default DTD value). This * should cause the "getSpecified()" method to be true. * This test uses the "setAttribute(name,value)" method * from the Element interface and the "getNamedItem(name)" * method from the NamedNodeMap interface. * @author Curt Arnold * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273</a> */ public final class hc_attrspecifiedvaluechanged extends DOMTestCase { /** * Constructor. * @param factory document factory, may not be null * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration */ public hc_attrspecifiedvaluechanged(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { super(factory); // // check if loaded documents are supported for content type // String contentType = getContentType(); preload(contentType, "hc_staff", true); } /** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList addressList; Node testNode; NamedNodeMap attributes; Attr streetAttr; boolean state; doc = (Document) load("hc_staff", true); addressList = doc.getElementsByTagName("acronym"); testNode = addressList.item(2); ((Element) /*Node */testNode).setAttribute("class", "Y\u03b1"); // android-changed: GREEK LOWER CASE ALPHA attributes = testNode.getAttributes(); streetAttr = (Attr) attributes.getNamedItem("class"); state = streetAttr.getSpecified(); assertTrue("acronymClassSpecified", state); } /** * Gets URI that identifies the test. * @return uri identifier of test */ public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrspecifiedvaluechanged"; } /** * Runs this test from the command line. * @param args command line arguments */ public static void main(final String[] args) { DOMTestCase.doMain(hc_attrspecifiedvaluechanged.class, args); } }
{ "pile_set_name": "Github" }
/* ****************************************************************************** * Copyright (C) 2015, International Business Machines Corporation and * others. All Rights Reserved. ****************************************************************************** * * File UNIFIEDCACHE.CPP ****************************************************************************** */ #include "uhash.h" #include "unifiedcache.h" #include "umutex.h" #include "mutex.h" #include "uassert.h" #include "ucln_cmn.h" static icu::UnifiedCache *gCache = NULL; static icu::SharedObject *gNoValue = NULL; static UMutex gCacheMutex = U_MUTEX_INITIALIZER; static UConditionVar gInProgressValueAddedCond = U_CONDITION_INITIALIZER; static icu::UInitOnce gCacheInitOnce = U_INITONCE_INITIALIZER; static const int32_t MAX_EVICT_ITERATIONS = 10; static int32_t DEFAULT_MAX_UNUSED = 1000; static int32_t DEFAULT_PERCENTAGE_OF_IN_USE = 100; U_CDECL_BEGIN static UBool U_CALLCONV unifiedcache_cleanup() { gCacheInitOnce.reset(); if (gCache) { delete gCache; gCache = NULL; } if (gNoValue) { delete gNoValue; gNoValue = NULL; } return TRUE; } U_CDECL_END U_NAMESPACE_BEGIN U_CAPI int32_t U_EXPORT2 ucache_hashKeys(const UHashTok key) { const CacheKeyBase *ckey = (const CacheKeyBase *) key.pointer; return ckey->hashCode(); } U_CAPI UBool U_EXPORT2 ucache_compareKeys(const UHashTok key1, const UHashTok key2) { const CacheKeyBase *p1 = (const CacheKeyBase *) key1.pointer; const CacheKeyBase *p2 = (const CacheKeyBase *) key2.pointer; return *p1 == *p2; } U_CAPI void U_EXPORT2 ucache_deleteKey(void *obj) { CacheKeyBase *p = (CacheKeyBase *) obj; delete p; } CacheKeyBase::~CacheKeyBase() { } static void U_CALLCONV cacheInit(UErrorCode &status) { U_ASSERT(gCache == NULL); ucln_common_registerCleanup( UCLN_COMMON_UNIFIED_CACHE, unifiedcache_cleanup); // gNoValue must be created first to avoid assertion error in // cache constructor. gNoValue = new SharedObject(); gCache = new UnifiedCache(status); if (gCache == NULL) { status = U_MEMORY_ALLOCATION_ERROR; } if (U_FAILURE(status)) { delete gCache; delete gNoValue; gCache = NULL; gNoValue = NULL; return; } // We add a softref because we want hash elements with gNoValue to be // elligible for purging but we don't ever want gNoValue to be deleted. gNoValue->addSoftRef(); } UnifiedCache *UnifiedCache::getInstance(UErrorCode &status) { umtx_initOnce(gCacheInitOnce, &cacheInit, status); if (U_FAILURE(status)) { return NULL; } U_ASSERT(gCache != NULL); return gCache; } UnifiedCache::UnifiedCache(UErrorCode &status) : fHashtable(NULL), fEvictPos(UHASH_FIRST), fItemsInUseCount(0), fMaxUnused(DEFAULT_MAX_UNUSED), fMaxPercentageOfInUse(DEFAULT_PERCENTAGE_OF_IN_USE), fAutoEvictedCount(0) { if (U_FAILURE(status)) { return; } U_ASSERT(gNoValue != NULL); fHashtable = uhash_open( &ucache_hashKeys, &ucache_compareKeys, NULL, &status); if (U_FAILURE(status)) { return; } uhash_setKeyDeleter(fHashtable, &ucache_deleteKey); } void UnifiedCache::setEvictionPolicy( int32_t count, int32_t percentageOfInUseItems, UErrorCode &status) { if (U_FAILURE(status)) { return; } if (count < 0 || percentageOfInUseItems < 0) { status = U_ILLEGAL_ARGUMENT_ERROR; return; } Mutex lock(&gCacheMutex); fMaxUnused = count; fMaxPercentageOfInUse = percentageOfInUseItems; } int32_t UnifiedCache::unusedCount() const { Mutex lock(&gCacheMutex); return uhash_count(fHashtable) - fItemsInUseCount; } int64_t UnifiedCache::autoEvictedCount() const { Mutex lock(&gCacheMutex); return fAutoEvictedCount; } int32_t UnifiedCache::keyCount() const { Mutex lock(&gCacheMutex); return uhash_count(fHashtable); } void UnifiedCache::flush() const { Mutex lock(&gCacheMutex); // Use a loop in case cache items that are flushed held hard references to // other cache items making those additional cache items eligible for // flushing. while (_flush(FALSE)); } #ifdef UNIFIED_CACHE_DEBUG #include <stdio.h> void UnifiedCache::dump() { UErrorCode status = U_ZERO_ERROR; const UnifiedCache *cache = getInstance(status); if (U_FAILURE(status)) { fprintf(stderr, "Unified Cache: Error fetching cache.\n"); return; } cache->dumpContents(); } void UnifiedCache::dumpContents() const { Mutex lock(&gCacheMutex); _dumpContents(); } // Dumps content of cache. // On entry, gCacheMutex must be held. // On exit, cache contents dumped to stderr. void UnifiedCache::_dumpContents() const { int32_t pos = UHASH_FIRST; const UHashElement *element = uhash_nextElement(fHashtable, &pos); char buffer[256]; int32_t cnt = 0; for (; element != NULL; element = uhash_nextElement(fHashtable, &pos)) { const SharedObject *sharedObject = (const SharedObject *) element->value.pointer; const CacheKeyBase *key = (const CacheKeyBase *) element->key.pointer; if (sharedObject->hasHardReferences()) { ++cnt; fprintf( stderr, "Unified Cache: Key '%s', error %d, value %p, total refcount %d, soft refcount %d\n", key->writeDescription(buffer, 256), key->creationStatus, sharedObject == gNoValue ? NULL :sharedObject, sharedObject->getRefCount(), sharedObject->getSoftRefCount()); } } fprintf(stderr, "Unified Cache: %d out of a total of %d still have hard references\n", cnt, uhash_count(fHashtable)); } #endif UnifiedCache::~UnifiedCache() { // Try our best to clean up first. flush(); { // Now all that should be left in the cache are entries that refer to // each other and entries with hard references from outside the cache. // Nothing we can do about these so proceed to wipe out the cache. Mutex lock(&gCacheMutex); _flush(TRUE); } uhash_close(fHashtable); } // Returns the next element in the cache round robin style. // On entry, gCacheMutex must be held. const UHashElement * UnifiedCache::_nextElement() const { const UHashElement *element = uhash_nextElement(fHashtable, &fEvictPos); if (element == NULL) { fEvictPos = UHASH_FIRST; return uhash_nextElement(fHashtable, &fEvictPos); } return element; } // Flushes the contents of the cache. If cache values hold references to other // cache values then _flush should be called in a loop until it returns FALSE. // On entry, gCacheMutex must be held. // On exit, those values with are evictable are flushed. If all is true // then every value is flushed even if it is not evictable. // Returns TRUE if any value in cache was flushed or FALSE otherwise. UBool UnifiedCache::_flush(UBool all) const { UBool result = FALSE; int32_t origSize = uhash_count(fHashtable); for (int32_t i = 0; i < origSize; ++i) { const UHashElement *element = _nextElement(); if (all || _isEvictable(element)) { const SharedObject *sharedObject = (const SharedObject *) element->value.pointer; uhash_removeElement(fHashtable, element); sharedObject->removeSoftRef(); result = TRUE; } } return result; } // Computes how many items should be evicted. // On entry, gCacheMutex must be held. // Returns number of items that should be evicted or a value <= 0 if no // items need to be evicted. int32_t UnifiedCache::_computeCountOfItemsToEvict() const { int32_t maxPercentageOfInUseCount = fItemsInUseCount * fMaxPercentageOfInUse / 100; int32_t maxUnusedCount = fMaxUnused; if (maxUnusedCount < maxPercentageOfInUseCount) { maxUnusedCount = maxPercentageOfInUseCount; } return uhash_count(fHashtable) - fItemsInUseCount - maxUnusedCount; } // Run an eviction slice. // On entry, gCacheMutex must be held. // _runEvictionSlice runs a slice of the evict pipeline by examining the next // 10 entries in the cache round robin style evicting them if they are eligible. void UnifiedCache::_runEvictionSlice() const { int32_t maxItemsToEvict = _computeCountOfItemsToEvict(); if (maxItemsToEvict <= 0) { return; } for (int32_t i = 0; i < MAX_EVICT_ITERATIONS; ++i) { const UHashElement *element = _nextElement(); if (_isEvictable(element)) { const SharedObject *sharedObject = (const SharedObject *) element->value.pointer; uhash_removeElement(fHashtable, element); sharedObject->removeSoftRef(); ++fAutoEvictedCount; if (--maxItemsToEvict == 0) { break; } } } } // Places a new value and creationStatus in the cache for the given key. // On entry, gCacheMutex must be held. key must not exist in the cache. // On exit, value and creation status placed under key. Soft reference added // to value on successful add. On error sets status. void UnifiedCache::_putNew( const CacheKeyBase &key, const SharedObject *value, const UErrorCode creationStatus, UErrorCode &status) const { if (U_FAILURE(status)) { return; } CacheKeyBase *keyToAdopt = key.clone(); if (keyToAdopt == NULL) { status = U_MEMORY_ALLOCATION_ERROR; return; } keyToAdopt->fCreationStatus = creationStatus; if (value->noSoftReferences()) { _registerMaster(keyToAdopt, value); } uhash_put(fHashtable, keyToAdopt, (void *) value, &status); if (U_SUCCESS(status)) { value->addSoftRef(); } } // Places value and status at key if there is no value at key or if cache // entry for key is in progress. Otherwise, it leaves the current value and // status there. // On entry. gCacheMutex must not be held. value must be // included in the reference count of the object to which it points. // On exit, value and status are changed to what was already in the cache if // something was there and not in progress. Otherwise, value and status are left // unchanged in which case they are placed in the cache on a best-effort basis. // Caller must call removeRef() on value. void UnifiedCache::_putIfAbsentAndGet( const CacheKeyBase &key, const SharedObject *&value, UErrorCode &status) const { Mutex lock(&gCacheMutex); const UHashElement *element = uhash_find(fHashtable, &key); if (element != NULL && !_inProgress(element)) { _fetch(element, value, status); return; } if (element == NULL) { UErrorCode putError = U_ZERO_ERROR; // best-effort basis only. _putNew(key, value, status, putError); } else { _put(element, value, status); } // Run an eviction slice. This will run even if we added a master entry // which doesn't increase the unused count, but that is still o.k _runEvictionSlice(); } // Attempts to fetch value and status for key from cache. // On entry, gCacheMutex must not be held value must be NULL and status must // be U_ZERO_ERROR. // On exit, either returns FALSE (In this // case caller should try to create the object) or returns TRUE with value // pointing to the fetched value and status set to fetched status. When // FALSE is returned status may be set to failure if an in progress hash // entry could not be made but value will remain unchanged. When TRUE is // returned, caler must call removeRef() on value. UBool UnifiedCache::_poll( const CacheKeyBase &key, const SharedObject *&value, UErrorCode &status) const { U_ASSERT(value == NULL); U_ASSERT(status == U_ZERO_ERROR); Mutex lock(&gCacheMutex); const UHashElement *element = uhash_find(fHashtable, &key); while (element != NULL && _inProgress(element)) { umtx_condWait(&gInProgressValueAddedCond, &gCacheMutex); element = uhash_find(fHashtable, &key); } if (element != NULL) { _fetch(element, value, status); return TRUE; } _putNew(key, gNoValue, U_ZERO_ERROR, status); return FALSE; } // Gets value out of cache. // On entry. gCacheMutex must not be held. value must be NULL. status // must be U_ZERO_ERROR. // On exit. value and status set to what is in cache at key or on cache // miss the key's createObject() is called and value and status are set to // the result of that. In this latter case, best effort is made to add the // value and status to the cache. If createObject() fails to create a value, // gNoValue is stored in cache, and value is set to NULL. Caller must call // removeRef on value if non NULL. void UnifiedCache::_get( const CacheKeyBase &key, const SharedObject *&value, const void *creationContext, UErrorCode &status) const { U_ASSERT(value == NULL); U_ASSERT(status == U_ZERO_ERROR); if (_poll(key, value, status)) { if (value == gNoValue) { SharedObject::clearPtr(value); } return; } if (U_FAILURE(status)) { return; } value = key.createObject(creationContext, status); U_ASSERT(value == NULL || value->hasHardReferences()); U_ASSERT(value != NULL || status != U_ZERO_ERROR); if (value == NULL) { SharedObject::copyPtr(gNoValue, value); } _putIfAbsentAndGet(key, value, status); if (value == gNoValue) { SharedObject::clearPtr(value); } } void UnifiedCache::decrementItemsInUseWithLockingAndEviction() const { Mutex mutex(&gCacheMutex); decrementItemsInUse(); _runEvictionSlice(); } void UnifiedCache::incrementItemsInUse() const { ++fItemsInUseCount; } void UnifiedCache::decrementItemsInUse() const { --fItemsInUseCount; } // Register a master cache entry. // On entry, gCacheMutex must be held. // On exit, items in use count incremented, entry is marked as a master // entry, and value registered with cache so that subsequent calls to // addRef() and removeRef() on it correctly updates items in use count void UnifiedCache::_registerMaster( const CacheKeyBase *theKey, const SharedObject *value) const { theKey->fIsMaster = TRUE; ++fItemsInUseCount; value->registerWithCache(this); } // Store a value and error in given hash entry. // On entry, gCacheMutex must be held. Hash entry element must be in progress. // value must be non NULL. // On Exit, soft reference added to value. value and status stored in hash // entry. Soft reference removed from previous stored value. Waiting // threads notified. void UnifiedCache::_put( const UHashElement *element, const SharedObject *value, const UErrorCode status) const { U_ASSERT(_inProgress(element)); const CacheKeyBase *theKey = (const CacheKeyBase *) element->key.pointer; const SharedObject *oldValue = (const SharedObject *) element->value.pointer; theKey->fCreationStatus = status; if (value->noSoftReferences()) { _registerMaster(theKey, value); } value->addSoftRef(); UHashElement *ptr = const_cast<UHashElement *>(element); ptr->value.pointer = (void *) value; oldValue->removeSoftRef(); // Tell waiting threads that we replace in-progress status with // an error. umtx_condBroadcast(&gInProgressValueAddedCond); } void UnifiedCache::copyPtr(const SharedObject *src, const SharedObject *&dest) { if(src != dest) { if(dest != NULL) { dest->removeRefWhileHoldingCacheLock(); } dest = src; if(src != NULL) { src->addRefWhileHoldingCacheLock(); } } } void UnifiedCache::clearPtr(const SharedObject *&ptr) { if (ptr != NULL) { ptr->removeRefWhileHoldingCacheLock(); ptr = NULL; } } // Fetch value and error code from a particular hash entry. // On entry, gCacheMutex must be held. value must be either NULL or must be // included in the ref count of the object to which it points. // On exit, value and status set to what is in the hash entry. Caller must // eventually call removeRef on value. // If hash entry is in progress, value will be set to gNoValue and status will // be set to U_ZERO_ERROR. void UnifiedCache::_fetch( const UHashElement *element, const SharedObject *&value, UErrorCode &status) { const CacheKeyBase *theKey = (const CacheKeyBase *) element->key.pointer; status = theKey->fCreationStatus; // Since we have the cache lock, calling regular SharedObject methods // could cause us to deadlock on ourselves since they may need to lock // the cache mutex. UnifiedCache::copyPtr((const SharedObject *) element->value.pointer, value); } // Determine if given hash entry is in progress. // On entry, gCacheMutex must be held. UBool UnifiedCache::_inProgress(const UHashElement *element) { const SharedObject *value = NULL; UErrorCode status = U_ZERO_ERROR; _fetch(element, value, status); UBool result = _inProgress(value, status); // Since we have the cache lock, calling regular SharedObject methods // could cause us to deadlock on ourselves since they may need to lock // the cache mutex. UnifiedCache::clearPtr(value); return result; } // Determine if given hash entry is in progress. // On entry, gCacheMutex must be held. UBool UnifiedCache::_inProgress( const SharedObject *theValue, UErrorCode creationStatus) { return (theValue == gNoValue && creationStatus == U_ZERO_ERROR); } // Determine if given hash entry is eligible for eviction. // On entry, gCacheMutex must be held. UBool UnifiedCache::_isEvictable(const UHashElement *element) { const CacheKeyBase *theKey = (const CacheKeyBase *) element->key.pointer; const SharedObject *theValue = (const SharedObject *) element->value.pointer; // Entries that are under construction are never evictable if (_inProgress(theValue, theKey->fCreationStatus)) { return FALSE; } // We can evict entries that are either not a master or have just // one reference (The one reference being from the cache itself). return (!theKey->fIsMaster || (theValue->getSoftRefCount() == 1 && theValue->noHardReferences())); } U_NAMESPACE_END
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>CSS Test: Letter-spacing using 'em' units with a nominal value, 6em</title> <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> <link rel="help" href="http://www.w3.org/TR/CSS21/text.html#propdef-letter-spacing" /> <link rel="help" href="http://www.w3.org/TR/CSS21/text.html#spacing-props" /> <meta name="flags" content="ahem" /> <meta name="assert" content="The 'letter-spacing' property sets a nominal length value in 'em' units." /> <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> <style type="text/css"> div { font: 16px/1em Ahem; } #span1 { margin-left: 6em; } #test { letter-spacing: 6em; } </style> </head> <body> <p>Test passes if there are only two boxes below (with no jagged edges).</p> <div> <div> <span>x</span><span id="span1">x</span> </div> <div id="test">xx</div> </div> </body> </html>
{ "pile_set_name": "Github" }
--- title: Why your agency or org should sponsor Lando metaTitle: Why you should sponsor Lando | Lando description: Support your developers and keep them focused on what matters most; achieving your organization's or clients' goals, not solving DevOps problems! And, get your orgs name in front tens of thousands of potential hires and clients while doing it! summary: Support your developers and keep them focused on what matters most; achieving your organization or client's goals, not solving DevOps problems! And, get your orgs name in front tens of thousands of potential hires and clients while doing it! date: 2020-02-08 original: author: Mike Pirog pic: https://www.gravatar.com/avatar/dc1322b3ddd0ef682862d7f281c821bb link: https://twitter.com/pirogcommamike location: Providence, RI tags: - lando feed: enable: true author: - name: Mike Pirog email: [email protected] link: https://twitter.com/pirogcommamike contributor: - name: Mike Pirog email: [email protected] link: https://twitter.com/pirogcommamike --- Sponsoring Lando is more than just supporting a free and open source local development tool. It's about giving a shit about your developers and giving them the tools they want and need to do their best work. Happy developers are productive and focused developers. And get it for way less than it would cost to build similar tools in-house. Trust us, [we know](/2017/10/24/journey-lando/) :) However, if that is not reason enough... here are five more ;) ## 1. It saves you time and money Solving local dev [is hard](/2017/10/24/journey-lando/), _very hard_, so chances are Lando has saved you considerable time and money when compared to its competitors or DIY options. The more resources we have the more we can make sure Lando, its documentation, guides, tutorials and video trainings are up to date. After all, development, workflows and tools are _always_ changing. The more Lando keeps pace the more time and money we can save you. If Lando has given you value, return some of that value back to us so we can provide even more value back in return. Positive feedback loop! [Help us, help you](https://www.youtube.com/watch?v=XmlXU4uK5rA)! ## 2. It's developer insurance Lando has an active community on [Slack](https://launchpass.com/devwithlando) that offers free, real time support to everyone as time allows. Generally, we try to scope questions so they are Lando focused but we are more than happy to answer _any_ development question if we can afford to do so. If every agency that uses Lando sponsored us we would be able to provide **TWO** dedicated support persons to help answer any blocking dev questions your team might have. How awesome would it be knowing that the Lando team has got your back if you get into a tight spot and need someone to help unblock you? You don't even need to use Lando we're down to try and help! ## 3. It helps you hire Want to attract great developers? We know over 10,000! Sponsor Lando and we'll proudly fly your orgs logo on our [documentation](https://docs.lando.dev), [marketing site](https://lando.dev) and [blog](https://docs.lando.dev). We're also down to co-market, partner and retweet your orgs content. What better way to attract great talent then to declare loudly, proudly and clearly that you are on their side. Join our movement of developer advocacy and show that you give a shit. ## 4. It's an investment in your team One of the best things about Lando is its extended ecosystem of [documentation](https://docs.lando.dev), [helpful guides](https://docs.lando.dev/guides/lando-info.html), [video tutorials](https://www.youtube.com/channel/UCl_QBNuGJNoo7yH-n18K7Kg), [blog posts](https://blog.lando.dev), [trainings, presentations and other events](https://events.lando.dev). These materials, combined with Slack, give your team access to our team and their collective battle-hardened wisdom and experience. Our team has not only built a tool that other developers depend on but we've logged well over a hundred trainings and thousands of support hours. We are happy to do as much of this as our users want and with your sponsorship we can! ## 5. It's the right thing to do With the exception of a [Kickstarter](https://www.kickstarter.com/projects/kalabox/kalabox-advanced-web-tools-for-the-people) we ran back in 2014 Lando has been overwhelmingly (eg 90%+) "funded" by [Tandem](https://thinktandem.io), our previous agency [Kalamuna](https://kalamuna.ca) and _tons_ of after hours and volunteer time. Hopefully this is sufficient evidence that we are _pretty committed_ to the cause of developer liberation! However, at our current and projected growth it is no longer possible for us to solely shoulder the increasing infrastructure and engineering costs. Help us [share the load](https://www.youtube.com/watch?v=wlJgD4GuDVs)! After all, we are building all of this for you! It's also important to mention that fundamentally Lando is about helping other developers. We want to stay accountable to _you_ not VC overlords. There has never been a business model and with your help there never will be. ## Bottom Line The math on this is fairly straightforward! If every Lando-using org or agency [sponsored us](https://lando.dev/sponsor/) at the $99 per month level we would be able to... * Answer the vast majority of your Lando and non-Lando related development questions on [Slack](https://launchpass.com/devwithlando). * Churn out more guides, documentation and tutorials based on what users need or want. * Work on Lando full time, this means staying up to date with development changes, version updates, new tools, bug fixes, user features; everything. * Take more time to manage the Lando community and its contributors. * Cover our infrastructure costs and compensate our core contributor team. To put this in perspective, you likely pay more money to host a _single_ website than you would to a support a tool that can single handedly build _any_ website. If you think that sounds like a pretty fucking good deal then please, [support our mission](https://lando.dev/sponsor) to liberate developers across the galaxy so they can focus on their most important work!
{ "pile_set_name": "Github" }
// Named EC curves // Requires ec.js, jsbn.js, and jsbn2.js var BigInteger = require('jsbn').BigInteger var ECCurveFp = require('./ec.js').ECCurveFp // ---------------- // X9ECParameters // constructor function X9ECParameters(curve,g,n,h) { this.curve = curve; this.g = g; this.n = n; this.h = h; } function x9getCurve() { return this.curve; } function x9getG() { return this.g; } function x9getN() { return this.n; } function x9getH() { return this.h; } X9ECParameters.prototype.getCurve = x9getCurve; X9ECParameters.prototype.getG = x9getG; X9ECParameters.prototype.getN = x9getN; X9ECParameters.prototype.getH = x9getH; // ---------------- // SECNamedCurves function fromHex(s) { return new BigInteger(s, 16); } function secp128r1() { // p = 2^128 - 2^97 - 1 var p = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF"); var a = fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC"); var b = fromHex("E87579C11079F43DD824993C2CEE5ED3"); //byte[] S = Hex.decode("000E0D4D696E6768756151750CC03A4473D03679"); var n = fromHex("FFFFFFFE0000000075A30D1B9038A115"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "161FF7528B899B2D0C28607CA52C5B86" + "CF5AC8395BAFEB13C02DA292DDED7A83"); return new X9ECParameters(curve, G, n, h); } function secp160k1() { // p = 2^160 - 2^32 - 2^14 - 2^12 - 2^9 - 2^8 - 2^7 - 2^3 - 2^2 - 1 var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73"); var a = BigInteger.ZERO; var b = fromHex("7"); //byte[] S = null; var n = fromHex("0100000000000000000001B8FA16DFAB9ACA16B6B3"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB" + "938CF935318FDCED6BC28286531733C3F03C4FEE"); return new X9ECParameters(curve, G, n, h); } function secp160r1() { // p = 2^160 - 2^31 - 1 var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF"); var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC"); var b = fromHex("1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45"); //byte[] S = Hex.decode("1053CDE42C14D696E67687561517533BF3F83345"); var n = fromHex("0100000000000000000001F4C8F927AED3CA752257"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "4A96B5688EF573284664698968C38BB913CBFC82" + "23A628553168947D59DCC912042351377AC5FB32"); return new X9ECParameters(curve, G, n, h); } function secp192k1() { // p = 2^192 - 2^32 - 2^12 - 2^8 - 2^7 - 2^6 - 2^3 - 1 var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37"); var a = BigInteger.ZERO; var b = fromHex("3"); //byte[] S = null; var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D" + "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D"); return new X9ECParameters(curve, G, n, h); } function secp192r1() { // p = 2^192 - 2^64 - 1 var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF"); var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC"); var b = fromHex("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1"); //byte[] S = Hex.decode("3045AE6FC8422F64ED579528D38120EAE12196D5"); var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012" + "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811"); return new X9ECParameters(curve, G, n, h); } function secp224r1() { // p = 2^224 - 2^96 + 1 var p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001"); var a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE"); var b = fromHex("B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4"); //byte[] S = Hex.decode("BD71344799D5C7FCDC45B59FA3B9AB8F6A948BC5"); var n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21" + "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34"); return new X9ECParameters(curve, G, n, h); } function secp256r1() { // p = 2^224 (2^32 - 1) + 2^192 + 2^96 - 1 var p = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF"); var a = fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC"); var b = fromHex("5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B"); //byte[] S = Hex.decode("C49D360886E704936A6678E1139D26B7819F7E90"); var n = fromHex("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551"); var h = BigInteger.ONE; var curve = new ECCurveFp(p, a, b); var G = curve.decodePointHex("04" + "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296" + "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5"); return new X9ECParameters(curve, G, n, h); } // TODO: make this into a proper hashtable function getSECCurveByName(name) { if(name == "secp128r1") return secp128r1(); if(name == "secp160k1") return secp160k1(); if(name == "secp160r1") return secp160r1(); if(name == "secp192k1") return secp192k1(); if(name == "secp192r1") return secp192r1(); if(name == "secp224r1") return secp224r1(); if(name == "secp256r1") return secp256r1(); return null; } module.exports = { "secp128r1":secp128r1, "secp160k1":secp160k1, "secp160r1":secp160r1, "secp192k1":secp192k1, "secp192r1":secp192r1, "secp224r1":secp224r1, "secp256r1":secp256r1 }
{ "pile_set_name": "Github" }
#include "ImageArraySplitGadget.h" namespace Gadgetron{ ImageArraySplitGadget::ImageArraySplitGadget() { } int ImageArraySplitGadget::process(GadgetContainerMessage<ISMRMRD::ImageHeader>* m1) { if (this->next()->putq(m1) < 0) { m1->release(); return GADGET_FAIL; } return GADGET_OK; } int ImageArraySplitGadget::process( GadgetContainerMessage<IsmrmrdImageArray>* m1) { //Grab a reference to the buffer containing the imaging data IsmrmrdImageArray & imagearr = *m1->getObjectPtr(); //7D, fixed order [X, Y, Z, CHA, N, S, LOC] uint16_t X = imagearr.data_.get_size(0); uint16_t Y = imagearr.data_.get_size(1); uint16_t Z = imagearr.data_.get_size(2); uint16_t CHA = imagearr.data_.get_size(3); uint16_t N = imagearr.data_.get_size(4); uint16_t S = imagearr.data_.get_size(5); uint16_t LOC = imagearr.data_.get_size(6); //Each image will be [X,Y,Z,CHA] big std::vector<size_t> img_dims(4); img_dims[0] = X; img_dims[1] = Y; img_dims[2] = Z; img_dims[3] = CHA; //Loop over N, S and LOC for (uint16_t loc=0; loc < LOC; loc++) { for (uint16_t s=0; s < S; s++) { for (uint16_t n=0; n < N; n++) { //Create a new image header and copy the header for this n, s and loc GadgetContainerMessage<ISMRMRD::ImageHeader>* cm1 = new GadgetContainerMessage<ISMRMRD::ImageHeader>(); memcpy(cm1->getObjectPtr(), &imagearr.headers_(n,s,loc), sizeof(ISMRMRD::ImageHeader)); //Create a new image image // and the 4D data block [X,Y,Z,CHA] for this n, s and loc GadgetContainerMessage< hoNDArray< std::complex<float> > >* cm2 = new GadgetContainerMessage<hoNDArray< std::complex<float> > >(); try{cm2->getObjectPtr()->create(img_dims);} catch (std::runtime_error &err){ GEXCEPTION(err,"Unable to allocate new image\n"); cm1->release(); cm2->release(); return GADGET_FAIL; } memcpy(cm2->getObjectPtr()->get_data_ptr(), &imagearr.data_(0,0,0,0,n,s,loc), X*Y*Z*CHA*sizeof(std::complex<float>)); //Chain them cm1->cont(cm2); //Creat a new meta container if needed and copy if (imagearr.meta_.size()>0) { GadgetContainerMessage< ISMRMRD::MetaContainer >* cm3 = new GadgetContainerMessage< ISMRMRD::MetaContainer >(); size_t mindex = loc*N*S + s*N + n; *cm3->getObjectPtr() = imagearr.meta_[mindex]; cm2->cont(cm3); } //Pass the image down the chain if (this->next()->putq(cm1) < 0) { return GADGET_FAIL; } } } } m1->release(); return GADGET_OK; } GADGET_FACTORY_DECLARE(ImageArraySplitGadget) }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `SOL_SOCKET` constant in crate `libc`."> <meta name="keywords" content="rust, rustlang, rust-lang, SOL_SOCKET"> <title>libc::SOL_SOCKET - Rust</title> <link rel="stylesheet" type="text/css" href="../rustdoc.css"> <link rel="stylesheet" type="text/css" href="../main.css"> <link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico"> </head> <body class="rustdoc"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <nav class="sidebar"> <a href='../libc/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='' width='100'></a> <p class='location'><a href='index.html'>libc</a></p><script>window.sidebarCurrent = {name: 'SOL_SOCKET', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script> </nav> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content constant"> <h1 class='fqn'><span class='in-band'><a href='index.html'>libc</a>::<wbr><a class='constant' href=''>SOL_SOCKET</a></span><span class='out-of-band'><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>&#x2212;</span>] </a> </span><a id='src-2008' class='srclink' href='../src/libc/unix/notbsd/linux/other/mod.rs.html#154' title='goto source code'>[src]</a></span></h1> <pre class='rust const'>pub const SOL_SOCKET: <a class='type' href='../libc/type.c_int.html' title='libc::c_int'>c_int</a><code> = </code><code>1</code></pre><div class='stability'><em class='stab unstable'>Unstable (<code>libc</code>)<p>: use <code>libc</code> from crates.io</p> </em></div></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <aside id="help" class="hidden"> <div> <h1 class="hidden">Help</h1> <div class="shortcuts"> <h2>Keyboard Shortcuts</h2> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>&larrb;</dt> <dd>Move up in search results</dd> <dt>&rarrb;</dt> <dd>Move down in search results</dd> <dt>&#9166;</dt> <dd>Go to active search result</dd> </dl> </div> <div class="infos"> <h2>Search Tricks</h2> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code>) </p> </div> </div> </aside> <script> window.rootPath = "../"; window.currentCrate = "libc"; window.playgroundUrl = ""; </script> <script src="../jquery.js"></script> <script src="../main.js"></script> <script defer src="../search-index.js"></script> </body> </html>
{ "pile_set_name": "Github" }
/* * Copyright 2015 Amazon.com, Inc. or its affiliates. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * BSD license below: * * 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. * * 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 ENA_ETH_COM_H_ #define ENA_ETH_COM_H_ #include "ena_com.h" /* head update threshold in units of (queue size / ENA_COMP_HEAD_THRESH) */ #define ENA_COMP_HEAD_THRESH 4 struct ena_com_tx_ctx { struct ena_com_tx_meta ena_meta; struct ena_com_buf *ena_bufs; /* For LLQ, header buffer - pushed to the device mem space */ void *push_header; enum ena_eth_io_l3_proto_index l3_proto; enum ena_eth_io_l4_proto_index l4_proto; u16 num_bufs; u16 req_id; /* For regular queue, indicate the size of the header * For LLQ, indicate the size of the pushed buffer */ u16 header_len; u8 meta_valid; u8 tso_enable; u8 l3_csum_enable; u8 l4_csum_enable; u8 l4_csum_partial; u8 df; /* Don't fragment */ }; struct ena_com_rx_ctx { struct ena_com_rx_buf_info *ena_bufs; enum ena_eth_io_l3_proto_index l3_proto; enum ena_eth_io_l4_proto_index l4_proto; bool l3_csum_err; bool l4_csum_err; u8 l4_csum_checked; /* fragmented packet */ bool frag; u32 hash; u16 descs; int max_bufs; u8 pkt_offset; }; int ena_com_prepare_tx(struct ena_com_io_sq *io_sq, struct ena_com_tx_ctx *ena_tx_ctx, int *nb_hw_desc); int ena_com_rx_pkt(struct ena_com_io_cq *io_cq, struct ena_com_io_sq *io_sq, struct ena_com_rx_ctx *ena_rx_ctx); int ena_com_add_single_rx_desc(struct ena_com_io_sq *io_sq, struct ena_com_buf *ena_buf, u16 req_id); bool ena_com_cq_empty(struct ena_com_io_cq *io_cq); static inline void ena_com_unmask_intr(struct ena_com_io_cq *io_cq, struct ena_eth_io_intr_reg *intr_reg) { writel(intr_reg->intr_control, io_cq->unmask_reg); } static inline int ena_com_free_q_entries(struct ena_com_io_sq *io_sq) { u16 tail, next_to_comp, cnt; next_to_comp = io_sq->next_to_comp; tail = io_sq->tail; cnt = tail - next_to_comp; return io_sq->q_depth - 1 - cnt; } /* Check if the submission queue has enough space to hold required_buffers */ static inline bool ena_com_sq_have_enough_space(struct ena_com_io_sq *io_sq, u16 required_buffers) { int temp; if (io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_HOST) return ena_com_free_q_entries(io_sq) >= required_buffers; /* This calculation doesn't need to be 100% accurate. So to reduce * the calculation overhead just Subtract 2 lines from the free descs * (one for the header line and one to compensate the devision * down calculation. */ temp = required_buffers / io_sq->llq_info.descs_per_entry + 2; return ena_com_free_q_entries(io_sq) > temp; } static inline bool ena_com_meta_desc_changed(struct ena_com_io_sq *io_sq, struct ena_com_tx_ctx *ena_tx_ctx) { if (!ena_tx_ctx->meta_valid) return false; return !!memcmp(&io_sq->cached_tx_meta, &ena_tx_ctx->ena_meta, sizeof(struct ena_com_tx_meta)); } static inline bool is_llq_max_tx_burst_exists(struct ena_com_io_sq *io_sq) { return (io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) && io_sq->llq_info.max_entries_in_tx_burst > 0; } static inline bool ena_com_is_doorbell_needed(struct ena_com_io_sq *io_sq, struct ena_com_tx_ctx *ena_tx_ctx) { struct ena_com_llq_info *llq_info; int descs_after_first_entry; int num_entries_needed = 1; u16 num_descs; if (!is_llq_max_tx_burst_exists(io_sq)) return false; llq_info = &io_sq->llq_info; num_descs = ena_tx_ctx->num_bufs; if (llq_info->disable_meta_caching || unlikely(ena_com_meta_desc_changed(io_sq, ena_tx_ctx))) ++num_descs; if (num_descs > llq_info->descs_num_before_header) { descs_after_first_entry = num_descs - llq_info->descs_num_before_header; num_entries_needed += DIV_ROUND_UP(descs_after_first_entry, llq_info->descs_per_entry); } pr_debug("queue: %d num_descs: %d num_entries_needed: %d\n", io_sq->qid, num_descs, num_entries_needed); return num_entries_needed > io_sq->entries_in_tx_burst_left; } static inline int ena_com_write_sq_doorbell(struct ena_com_io_sq *io_sq) { u16 max_entries_in_tx_burst = io_sq->llq_info.max_entries_in_tx_burst; u16 tail = io_sq->tail; pr_debug("write submission queue doorbell for queue: %d tail: %d\n", io_sq->qid, tail); writel(tail, io_sq->db_addr); if (is_llq_max_tx_burst_exists(io_sq)) { pr_debug("reset available entries in tx burst for queue %d to %d\n", io_sq->qid, max_entries_in_tx_burst); io_sq->entries_in_tx_burst_left = max_entries_in_tx_burst; } return 0; } static inline int ena_com_update_dev_comp_head(struct ena_com_io_cq *io_cq) { u16 unreported_comp, head; bool need_update; if (unlikely(io_cq->cq_head_db_reg)) { head = io_cq->head; unreported_comp = head - io_cq->last_head_update; need_update = unreported_comp > (io_cq->q_depth / ENA_COMP_HEAD_THRESH); if (unlikely(need_update)) { pr_debug("Write completion queue doorbell for queue %d: head: %d\n", io_cq->qid, head); writel(head, io_cq->cq_head_db_reg); io_cq->last_head_update = head; } } return 0; } static inline void ena_com_update_numa_node(struct ena_com_io_cq *io_cq, u8 numa_node) { struct ena_eth_io_numa_node_cfg_reg numa_cfg; if (!io_cq->numa_node_cfg_reg) return; numa_cfg.numa_cfg = (numa_node & ENA_ETH_IO_NUMA_NODE_CFG_REG_NUMA_MASK) | ENA_ETH_IO_NUMA_NODE_CFG_REG_ENABLED_MASK; writel(numa_cfg.numa_cfg, io_cq->numa_node_cfg_reg); } static inline void ena_com_comp_ack(struct ena_com_io_sq *io_sq, u16 elem) { io_sq->next_to_comp += elem; } static inline void ena_com_cq_inc_head(struct ena_com_io_cq *io_cq) { io_cq->head++; /* Switch phase bit in case of wrap around */ if (unlikely((io_cq->head & (io_cq->q_depth - 1)) == 0)) io_cq->phase ^= 1; } static inline int ena_com_tx_comp_req_id_get(struct ena_com_io_cq *io_cq, u16 *req_id) { u8 expected_phase, cdesc_phase; struct ena_eth_io_tx_cdesc *cdesc; u16 masked_head; masked_head = io_cq->head & (io_cq->q_depth - 1); expected_phase = io_cq->phase; cdesc = (struct ena_eth_io_tx_cdesc *) ((uintptr_t)io_cq->cdesc_addr.virt_addr + (masked_head * io_cq->cdesc_entry_size_in_bytes)); /* When the current completion descriptor phase isn't the same as the * expected, it mean that the device still didn't update * this completion. */ cdesc_phase = READ_ONCE(cdesc->flags) & ENA_ETH_IO_TX_CDESC_PHASE_MASK; if (cdesc_phase != expected_phase) return -EAGAIN; dma_rmb(); *req_id = READ_ONCE(cdesc->req_id); if (unlikely(*req_id >= io_cq->q_depth)) { pr_err("Invalid req id %d\n", cdesc->req_id); return -EINVAL; } ena_com_cq_inc_head(io_cq); return 0; } #endif /* ENA_ETH_COM_H_ */
{ "pile_set_name": "Github" }
# node-is-arrayish [![Travis-CI.org Build Status](https://img.shields.io/travis/Qix-/node-is-arrayish.svg?style=flat-square)](https://travis-ci.org/Qix-/node-is-arrayish) [![Coveralls.io Coverage Rating](https://img.shields.io/coveralls/Qix-/node-is-arrayish.svg?style=flat-square)](https://coveralls.io/r/Qix-/node-is-arrayish) > Determines if an object can be used like an Array ## Example ```javascript var isArrayish = require('is-arrayish'); isArrayish([]); // true isArrayish({__proto__: []}); // true isArrayish({}); // false isArrayish({length:10}); // false ``` ## License Licensed under the [MIT License](http://opensource.org/licenses/MIT). You can find a copy of it in [LICENSE](LICENSE).
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean id="database0" class="com.dianping.zebra.group.jdbc.GroupDataSource" init-method="init" destroy-method="close"> <property name="jdbcRef" value="replacetest-gds0"/> <property name="driverClass" value="org.h2.Driver"/> <property name="configManagerType" value="local"/> <property name="minPoolSize" value="2"/> <property name="maxPoolSize" value="4"/> <property name="initialPoolSize" value="2"/> </bean> <bean id="database1" class="com.dianping.zebra.group.jdbc.GroupDataSource" init-method="init" destroy-method="close"> <property name="jdbcRef" value="replacetest-gds1"/> <property name="driverClass" value="org.h2.Driver"/> <property name="configManagerType" value="local"/> <property name="minPoolSize" value="2"/> <property name="maxPoolSize" value="4"/> <property name="initialPoolSize" value="2"/> </bean> <bean id="zebraDS" class="com.dianping.zebra.shard.jdbc.ShardDataSource" init-method="init"> <property name="dataSourcePool"> <map> <entry key="database0" value-ref="database0"/> <entry key="database1" value-ref="database1"/> </map> </property> <property name="routerFactory"> <bean class="com.dianping.zebra.shard.router.builder.XmlResourceRouterBuilder"> <constructor-arg value="mockdb-config/testReplace/router-multidb-replacetest.xml"/> </bean> </property> </bean> </beans>
{ "pile_set_name": "Github" }
/** * Created by lzhan on 2017/8/22. */ // exports.createUnique=createUnique; var hex_chr = "0123456789abcdef"; function rhex(num) { str = ""; for(j = 0; j <= 3; j++) str += hex_chr.charAt((num >> (j * 8 + 4)) & 0x0F) + hex_chr.charAt((num >> (j * 8)) & 0x0F); return str; } function str2blks_MD5(str) { nblk = ((str.length + 8) >> 6) + 1; blks = new Array(nblk * 16); for(i = 0; i < nblk * 16; i++) blks[i] = 0; for(i = 0; i < str.length; i++) blks[i >> 2] |= str.charCodeAt(i) << ((i % 4) * 8); blks[i >> 2] |= 0x80 << ((i % 4) * 8); blks[nblk * 16 - 2] = str.length * 8; return blks; } function add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } function rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } function cmn(q, a, b, x, s, t) { return add(rol(add(add(a, q), add(x, t)), s), b); } function ff(a, b, c, d, x, s, t) { return cmn((b & c) | ((~b) & d), a, b, x, s, t); } function gg(a, b, c, d, x, s, t) { return cmn((b & d) | (c & (~d)), a, b, x, s, t); } function hh(a, b, c, d, x, s, t) { return cmn(b ^ c ^ d, a, b, x, s, t); } function ii(a, b, c, d, x, s, t) { return cmn(c ^ (b | (~d)), a, b, x, s, t); } function MD5(str) { x = str2blks_MD5(str); var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for(i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; a = ff(a, b, c, d, x[i+ 0], 7 , -680876936); d = ff(d, a, b, c, x[i+ 1], 12, -389564586); c = ff(c, d, a, b, x[i+ 2], 17, 606105819); b = ff(b, c, d, a, x[i+ 3], 22, -1044525330); a = ff(a, b, c, d, x[i+ 4], 7 , -176418897); d = ff(d, a, b, c, x[i+ 5], 12, 1200080426); c = ff(c, d, a, b, x[i+ 6], 17, -1473231341); b = ff(b, c, d, a, x[i+ 7], 22, -45705983); a = ff(a, b, c, d, x[i+ 8], 7 , 1770035416); d = ff(d, a, b, c, x[i+ 9], 12, -1958414417); c = ff(c, d, a, b, x[i+10], 17, -42063); b = ff(b, c, d, a, x[i+11], 22, -1990404162); a = ff(a, b, c, d, x[i+12], 7 , 1804603682); d = ff(d, a, b, c, x[i+13], 12, -40341101); c = ff(c, d, a, b, x[i+14], 17, -1502002290); b = ff(b, c, d, a, x[i+15], 22, 1236535329); a = gg(a, b, c, d, x[i+ 1], 5 , -165796510); d = gg(d, a, b, c, x[i+ 6], 9 , -1069501632); c = gg(c, d, a, b, x[i+11], 14, 643717713); b = gg(b, c, d, a, x[i+ 0], 20, -373897302); a = gg(a, b, c, d, x[i+ 5], 5 , -701558691); d = gg(d, a, b, c, x[i+10], 9 , 38016083); c = gg(c, d, a, b, x[i+15], 14, -660478335); b = gg(b, c, d, a, x[i+ 4], 20, -405537848); a = gg(a, b, c, d, x[i+ 9], 5 , 568446438); d = gg(d, a, b, c, x[i+14], 9 , -1019803690); c = gg(c, d, a, b, x[i+ 3], 14, -187363961); b = gg(b, c, d, a, x[i+ 8], 20, 1163531501); a = gg(a, b, c, d, x[i+13], 5 , -1444681467); d = gg(d, a, b, c, x[i+ 2], 9 , -51403784); c = gg(c, d, a, b, x[i+ 7], 14, 1735328473); b = gg(b, c, d, a, x[i+12], 20, -1926607734); a = hh(a, b, c, d, x[i+ 5], 4 , -378558); d = hh(d, a, b, c, x[i+ 8], 11, -2022574463); c = hh(c, d, a, b, x[i+11], 16, 1839030562); b = hh(b, c, d, a, x[i+14], 23, -35309556); a = hh(a, b, c, d, x[i+ 1], 4 , -1530992060); d = hh(d, a, b, c, x[i+ 4], 11, 1272893353); c = hh(c, d, a, b, x[i+ 7], 16, -155497632); b = hh(b, c, d, a, x[i+10], 23, -1094730640); a = hh(a, b, c, d, x[i+13], 4 , 681279174); d = hh(d, a, b, c, x[i+ 0], 11, -358537222); c = hh(c, d, a, b, x[i+ 3], 16, -722521979); b = hh(b, c, d, a, x[i+ 6], 23, 76029189); a = hh(a, b, c, d, x[i+ 9], 4 , -640364487); d = hh(d, a, b, c, x[i+12], 11, -421815835); c = hh(c, d, a, b, x[i+15], 16, 530742520); b = hh(b, c, d, a, x[i+ 2], 23, -995338651); a = ii(a, b, c, d, x[i+ 0], 6 , -198630844); d = ii(d, a, b, c, x[i+ 7], 10, 1126891415); c = ii(c, d, a, b, x[i+14], 15, -1416354905); b = ii(b, c, d, a, x[i+ 5], 21, -57434055); a = ii(a, b, c, d, x[i+12], 6 , 1700485571); d = ii(d, a, b, c, x[i+ 3], 10, -1894986606); c = ii(c, d, a, b, x[i+10], 15, -1051523); b = ii(b, c, d, a, x[i+ 1], 21, -2054922799); a = ii(a, b, c, d, x[i+ 8], 6 , 1873313359); d = ii(d, a, b, c, x[i+15], 10, -30611744); c = ii(c, d, a, b, x[i+ 6], 15, -1560198380); b = ii(b, c, d, a, x[i+13], 21, 1309151649); a = ii(a, b, c, d, x[i+ 4], 6 , -145523070); d = ii(d, a, b, c, x[i+11], 10, -1120210379); c = ii(c, d, a, b, x[i+ 2], 15, 718787259); b = ii(b, c, d, a, x[i+ 9], 21, -343485551); a = add(a, olda); b = add(b, oldb); c = add(c, oldc); d = add(d, oldd); } return rhex(a) + rhex(b) + rhex(c) + rhex(d); } exports.createUnique=function () { var date=new Date().valueOf(); var random=Math.random(); return date+''+random; }; exports.MD5=MD5; exports.dateFormat=function (time,fmt) { //author: meizz var o = { "M+": time.getMonth() + 1, //月份 "d+": time.getDate(), //日 "h+": time.getHours(), //小时 "m+": time.getMinutes(), //分 "s+": time.getSeconds(), //秒 "q+": Math.floor((time.getMonth() + 3) / 3), //季度 "S": time.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (time.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; }; exports.formatLongString=function (str,len) { if(str.length<=len || len<=3){ return str; }{ return str.substring(0,len-3)+'...'; } } exports.secret='jobapp';
{ "pile_set_name": "Github" }
/* * Copyright (c) scott.cgi All Rights Reserved. * * This source code belongs to project Mojoc, which is a pure C Game Engine hosted on GitHub. * The Mojoc Game Engine is licensed under the MIT License, and will continue to be iterated with coding passion. * * License : https://github.com/scottcgi/Mojoc/blob/master/LICENSE * GitHub : https://github.com/scottcgi/Mojoc * CodeStyle: https://github.com/scottcgi/Mojoc/wiki/Code-Style * * Since : 2013-1-2 * Update : 2019-1-24 * Author : scott.cgi */ #ifndef DRAWABLE_H #define DRAWABLE_H #include <stdbool.h> #include "Engine/Graphics/OpenGL/Platform/gl3.h" #include "Engine/Toolkit/Math/Matrix.h" #include "Engine/Toolkit/Math/Math.h" #include "Engine/Toolkit/HeaderUtils/Bitwise.h" #include "Engine/Toolkit/Utils/ArrayList.h" #include "Engine/Graphics/Draw/Color.h" #include "Engine/Toolkit/Math/Vector.h" #include "Engine/Toolkit/HeaderUtils/UserData.h" /** * If contains 'Is' the state can set add and clear, * else the state will automatically set add and clear. */ typedef enum { DrawableState_Null = 0, /** * Whether drawable is invisible. */ DrawableState_IsInvisible = 1, /** * Whether drawable mvp matrix need to update. */ DrawableState_IsUpdateMVPMatrix = 1 << 1, /** * Whether drawable calculate blendColor by parent. */ DrawableState_IsBlendColor = 1 << 2, /** * Flag drawable inverse matrix need to update. */ DrawableState_UpdateInverseMatrix = 1 << 3, //---------------------------------------------------------------------------------------------------------------------- /** * Flag drawable transform has changed. */ DrawableState_TransformChanged = 1 << 4, /** * Flag drawable rgb has changed. */ DrawableState_RGBChanged = 1 << 5, /** * Flag drawable opacity has changed. */ DrawableState_OpacityChanged = 1 << 6, /** * Flag drawable has been drawn. */ DrawableState_DrawChanged = 1 << 7, /** * Flag drawable color has changed */ DrawableState_ColorChanged = DrawableState_RGBChanged | DrawableState_OpacityChanged, //---------------------------------------------------------------------------------------------------------------------- /** * Flag drawable parent has changed. */ DrawableState_Parent = 1 << 8, /** * Flag drawable position x has changed. */ DrawableState_PositionX = 1 << 9, /** * Flag drawable position y has changed. */ DrawableState_PositionY = 1 << 10, /** * Flag drawable position z has changed. */ DrawableState_PositionZ = 1 << 11, /** * Flag drawable position x and y have changed. */ DrawableState_Position2 = DrawableState_PositionX | DrawableState_PositionY, //---------------------------------------------------------------------------------------------------------------------- /** * Flag drawable scale x has changed. */ DrawableState_ScaleX = 1 << 12, /** * Flag drawable scale y has changed. */ DrawableState_ScaleY = 1 << 13, /** * Flag drawable scale z has changed. */ DrawableState_ScaleZ = 1 << 14, /** * Flag drawable scale x and y have changed. */ DrawableState_Scale2 = DrawableState_ScaleX | DrawableState_ScaleY, //---------------------------------------------------------------------------------------------------------------------- /** * Flag drawable rotation x has changed. */ DrawableState_RotationX = 1 << 15, /** * Flag drawable rotation x has changed. */ DrawableState_RotationY = 1 << 16, /** * Flag drawable rotation x has changed. */ DrawableState_RotationZ = 1 << 17, //---------------------------------------------------------------------------------------------------------------------- /** * Flag drawable rgb has changed. */ DrawableState_RGB = 1 << 18, /** * Flag drawable opacity has changed. */ DrawableState_Opacity = 1 << 19, /** * Flag drawable color has changed. */ DrawableState_Color = DrawableState_RGB | DrawableState_Opacity, //---------------------------------------------------------------------------------------------------------------------- /** * Flag drawable position scale rotate translate parent have changed. */ DrawableState_Transform = DrawableState_Parent | DrawableState_PositionX | DrawableState_PositionY | DrawableState_PositionZ | DrawableState_ScaleX | DrawableState_ScaleY | DrawableState_ScaleZ | DrawableState_RotationX | DrawableState_RotationY | DrawableState_RotationZ, /** * Flag drawable transform and color have changed. */ DrawableState_Draw = DrawableState_Transform | DrawableState_Color, } DrawableState; typedef struct Drawable Drawable; /** * If object can be drawn then must inherit Drawable. * the drawable provides transform, color, state, matrix properties, * but render function must be implemented by subclass. */ struct Drawable { UserData userData[1]; /* Default 0.0f, use openGL coordinate. */ float width; float height; //---------------------------------------------------------------------------------------------------------------------- /** * If has parent will render use parent modelMatrix, * and parent invisible that children will stop rendering. */ Drawable* parent; /* The local position relative parent, default 0.0f. */ float positionX; float positionY; float positionZ; /* The local scale relative parent, default 1.0f. */ float scaleX; float scaleY; float scaleZ; /** * The local rotation relative parent, default 0.0f and clockwise [0.0f - 360.0f]. */ float rotationX; float rotationY; float rotationZ; /** * The color value each between [0.0f, 1.0f], default {1.0f, 1.0f, 1.0f, 1.0f}. */ Color color [1]; /** * If set DrawableState_IsBlendColor * equal (color) * (parent blendColor) * else * equal color * * default {1.0f, 1.0f, 1.0f, 1.0f} */ Color blendColor [1]; //---------------------------------------------------------------------------------------------------------------------- /** * Cached MVP matrix when property has changed will update. */ Matrix4 mvpMatrix [1]; /** * Cached model matrix when property has changed will update. */ Matrix4 modelMatrix [1]; /** * Cached inverse model matrix。 */ Matrix4 inverseMatrix[1]; /** * Flag the property changes. */ DrawableState state; //---------------------------------------------------------------------------------------------------------------------- /** * Custom draw for preparing rendering data. * called by ADrawable's Draw, do not use any openGL command, * and can check any state change. * * if called in Scheduler or Coroutine may have draw order problem, * because the draw oder common controlled by Component. */ void (*Draw) (Drawable* drawable); /** * Render with openGL command. */ void (*Render)(Drawable* drawable); }; /** * Control Drawable and coordinate conversion. */ struct ADrawable { Drawable* (*Create) (void); void (*Init) (Drawable* outDrawable); /** * Transform model matrix by position scale rotation, * and calculate mvp matrix and blend color if needed, * and call drawable's Draw method. * * if render method implemented will push Drawable into render queue for flush openGL command. */ void (*Draw) (Drawable* drawable); /** * Call Render function of Drawable in the render queue and clear it for next frame. * the drawable will push into render queue when it's Draw function called. */ void (*Render) (void); /** * Get render queue size. */ int (*GetDrawCalls) (void); /** * Convert localPositionX in localParent to world coordinate. * return world position x. */ float (*ConvertToWorldPositionX) (Drawable* localParent, float localPositionX); /** * Convert localPositionY in localParent to world coordinate. * return world position y. */ float (*ConvertToWorldPositionY) (Drawable* localParent, float localPositionY); /** * Convert localPositionV2 in localParent to world coordinate. */ void (*ConvertToWorldPositionV2) ( Drawable* localParent, Vector2* localPositionV2, Vector2* outWorldPositionV2 ); /** * Convert worldPositionX to localParent coordinate. * return local position x */ float (*ConvertToLocalPositionX) (Drawable* localParent, float worldPositionX); /** * Convert worldPositionY to localParent coordinate. * return local position y. */ float (*ConvertToLocalPositionY) (Drawable* localParent, float worldPositionY); /** * Convert worldPositionV2 to localParent coordinate. */ void (*ConvertToLocalPositionV2) ( Drawable* localParent, Vector2* worldPositionV2, Vector2* outLocalPositionV2 ); /** * Set drawable parent and keep world transform. * if parent NULL transform will convert to world coordinate. */ void (*ConvertToParent) (Drawable* drawable, Drawable* parent); /** * Convert localPositionX in parentA to parentB coordinate. * return local position x in parentB. */ float (*ConvertBetweenLocalPositionX) (Drawable* parentA, float localPositionX, Drawable* parentB); /** * Convert localPositionY in parentA to ParentB coordinate. * return local position y in parentB. */ float (*ConvertBetweenLocalPositionY) (Drawable* parentA, float localPositionY, Drawable* parentB); /** * Convert localPositionV2 in parentA to outLocalPositionV2 in parentB. */ void (*ConvertBetweenLocalPositionV2) ( Drawable* parentA, Vector2* localPositionV2, Drawable* parentB, Vector2* outLocalPositionV2 ); /** * If Drawable has flip will transform rotationZ to flipped value. */ float (*GetFlipRotationZ) (Drawable* drawable, float rotationZ); /** * Get drawable rotationZ in world coordinate. */ float (*GetWorldRotationZ) (Drawable* drawable); /** * Get drawable scaleX in world coordinate. */ float (*GetWorldScaleX) (Drawable* drawable); /** * Get drawable scaleY in world coordinate. */ float (*GetWorldScaleY) (Drawable* drawable); /** * Get drawable scale Vector2 in world coordinate. */ void (*GetWorldScaleV2) (Drawable* drawable, Vector2* outScaleV2); /** * Get drawable position x in world coordinate. */ float (*GetWorldPositionX) (Drawable* drawable); /** * Get drawable position x in world coordinate. */ float (*GetWorldPositionY) (Drawable* drawable); /** * Get drawable position Vector2 in world coordinate. */ void (*GetWorldPositionV2) (Drawable* drawable, Vector2* outPositionV2); /** * Get drawable position Vector3 in world coordinate. */ void (*GetWorldPositionV3) (Drawable* drawable, Vector3* outPositionV3); }; extern struct ADrawable ADrawable[1]; //---------------------------------------------------------------------------------------------------------------------- /** * Check drawable whether has state. */ static inline bool ADrawable_CheckState(Drawable* drawable, DrawableState state) { return ABitwise_Check(drawable->state, state); } /** * Add state to drawable. */ static inline void ADrawable_AddState(Drawable* drawable, DrawableState state) { ABitwise_Add(drawable->state, state); } /** * Set state to drawable. */ static inline void ADrawable_SetState(Drawable* drawable, DrawableState state) { ABitwise_Set(drawable->state, state); } /** * Clear drawable state. */ static inline void ADrawable_ClearState(Drawable* drawable, DrawableState state) { ABitwise_Clear(drawable->state, state); } /** * Clear drawable clearState and add addState. */ static inline void ADrawable_ClearAndAddState(Drawable* drawable, DrawableState clearState, DrawableState addState) { ABitwise_ClearAndAdd(drawable->state, clearState, addState); } //---------------------------------------------------------------------------------------------------------------------- /** * Make drawable visible. */ static inline void ADrawable_SetVisible(Drawable* drawable) { ADrawable_ClearState(drawable, DrawableState_IsInvisible); } /** * Make drawable invisible. */ static inline void ADrawable_SetInvisible(Drawable* drawable) { ADrawable_AddState(drawable, DrawableState_IsInvisible); } /** * Check drawable whether is visible. */ static inline bool ADrawable_CheckVisible(Drawable* drawable) { return ADrawable_CheckState(drawable, DrawableState_IsInvisible) == false; } //---------------------------------------------------------------------------------------------------------------------- /** * Set drawable parent, current transform will become local in new parent. * use ADrawable->ConvertToParent can keep world transform stay. */ static inline void ADrawable_SetParent(Drawable* drawable, Drawable* parent) { drawable->parent = parent; ADrawable_AddState(drawable, DrawableState_Parent); } //---------------------------------------------------------------------------------------------------------------------- /** * Set drawable position x, and flag state for Drawable->Draw to change modelMatrix. */ static inline void ADrawable_SetPositionX(Drawable* drawable, float positionX) { drawable->positionX = positionX; ADrawable_AddState(drawable, DrawableState_PositionX); } /** * Set drawable position y, and flag state for Drawable->Draw to change modelMatrix. */ static inline void ADrawable_SetPositionY(Drawable* drawable, float positionY) { drawable->positionY = positionY; ADrawable_AddState(drawable, DrawableState_PositionY); } /** * Set drawable position x y, and flag state for Drawable->Draw to change modelMatrix. */ static inline void ADrawable_SetPosition2(Drawable* drawable, float positionX, float positionY) { drawable->positionX = positionX; drawable->positionY = positionY; ADrawable_AddState(drawable, DrawableState_Position2); } /** * Set drawable position same x y, and flag state for Drawable->Draw to change modelMatrix. */ static inline void ADrawable_SetPositionSame2(Drawable* drawable, float position) { drawable->positionX = position; drawable->positionY = position; ADrawable_AddState(drawable, DrawableState_Position2); } //---------------------------------------------------------------------------------------------------------------------- /** * Set drawable scale x, and flag state for Drawable->Draw to change modelMatrix. */ static inline void ADrawable_SetScaleX(Drawable* drawable, float scaleX) { drawable->scaleX = scaleX; ADrawable_AddState(drawable, DrawableState_ScaleX); } /** * Set drawable scale y, and flag state for Drawable->Draw to change modelMatrix. */ static inline void ADrawable_SetScaleY(Drawable* drawable, float scaleY) { drawable->scaleY = scaleY; ADrawable_AddState(drawable, DrawableState_ScaleY); } /** * Set drawable scale x y, and flag state for Drawable->Draw to change modelMatrix. */ static inline void ADrawable_SetScale2(Drawable* drawable, float scaleX, float scaleY) { drawable->scaleX = scaleX; drawable->scaleY = scaleY; ADrawable_AddState(drawable, DrawableState_Scale2); } /** * Set drawable scale same x y, and flag state for Drawable->Draw to change modelMatrix. */ static inline void ADrawable_SetScaleSame2(Drawable* drawable, float scale) { drawable->scaleX = scale; drawable->scaleY = scale; ADrawable_AddState(drawable, DrawableState_Scale2); } //---------------------------------------------------------------------------------------------------------------------- /** * Set drawable rotation x, and flag state for Drawable->Draw to change modelMatrix. */ static inline void ADrawable_SetRotationX(Drawable* drawable, float rotationX) { drawable->rotationX = rotationX; ADrawable_AddState(drawable, DrawableState_RotationX); } /** * Set drawable rotation y, and flag state for Drawable->Draw to change modelMatrix. */ static inline void ADrawable_SetRotationY(Drawable* drawable, float rotationY) { drawable->rotationY = rotationY; ADrawable_AddState(drawable, DrawableState_RotationY); } /** * Set drawable rotation z, and flag state for Drawable->Draw to change modelMatrix. */ static inline void ADrawable_SetRotationZ(Drawable* drawable, float rotationZ) { drawable->rotationZ = rotationZ; ADrawable_AddState(drawable, DrawableState_RotationZ); } //---------------------------------------------------------------------------------------------------------------------- /** * Set drawable rgb, and flag state for Drawable->Draw to change blendColor. */ static inline void ADrawable_SetRGB(Drawable* drawable, float red, float green, float blue) { drawable->color->r = red; drawable->color->g = green; drawable->color->b = blue; ADrawable_AddState(drawable, DrawableState_RGB); } /** * Set drawable same rgb, and flag state for Drawable->Draw to change blendColor. */ static inline void ADrawable_SetRGBSame(Drawable* drawable, float rgb) { drawable->color->r = rgb; drawable->color->g = rgb; drawable->color->b = rgb; ADrawable_AddState(drawable, DrawableState_RGB); } /** * Set drawable opacity, and flag state for Drawable->Draw to change blendColor. */ static inline void ADrawable_SetOpacity(Drawable* drawable, float opacity) { drawable->color->a = opacity; ADrawable_AddState(drawable, DrawableState_Opacity); } /** * Set drawable rgba, and flag state for Drawable->Draw to change blendColor. */ static inline void ADrawable_SetRGBA(Drawable* drawable, float red, float green, float blue, float opacity) { drawable->color->r = red; drawable->color->g = green; drawable->color->b = blue; drawable->color->a = opacity; ADrawable_AddState(drawable, DrawableState_Color); } /** * Set drawable same rgba, and flag state for Drawable->Draw to change blendColor. */ static inline void ADrawable_SetRGBASame(Drawable* drawable, float rgba) { drawable->color->r = rgba; drawable->color->g = rgba; drawable->color->b = rgba; drawable->color->a = rgba; ADrawable_AddState(drawable, DrawableState_Color); } /** * Set drawable color, and flag state for Drawable->Draw to change blendColor. */ static inline void ADrawable_SetColor(Drawable* drawable, Color* color) { *drawable->color = *color; ADrawable_AddState(drawable, DrawableState_Color); } /** * Make drawable color blend parent blendColor. */ static inline void ADrawable_SetBlendColor(Drawable* drawable) { ADrawable_AddState(drawable, DrawableState_IsBlendColor); } #endif
{ "pile_set_name": "Github" }
;Paste the following configurations in the corresponding place in MobaXterm.ini. ;Theme: Thayer Bright [Colors] DefaultColorScheme=0 BackgroundColour=27,29,30 ForegroundColour=248,248,248 CursorColour=252,151,31 Black=27,29,30 Red=249,38,114 BoldGreen=182,227,84 BoldYellow=254,237,108 BoldBlue=63,120,255 BoldMagenta=158,111,254 BoldCyan=35,207,213 BoldWhite=248,248,242 Green=77,248,64 Yellow=244,253,34 Blue=39,87,214 Magenta=140,84,254 Cyan=56,200,181 White=204,204,198 BoldBlack=80,83,84 BoldRed=255,89,149
{ "pile_set_name": "Github" }
go-gitconfig ==== [![GitHub release](http://img.shields.io/github/release/tcnksm/go-gitconfig.svg?style=flat-square)][release] [![Wercker](http://img.shields.io/wercker/ci/544ee33aea87f6374f001483.svg?style=flat-square)][wercker] [![Coveralls](http://img.shields.io/coveralls/tcnksm/go-gitconfig.svg?style=flat-square)][coveralls] [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license] [![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs] [release]: https://github.com/tcnksm/go-gitconfig/releases [wercker]: https://app.wercker.com/project/bykey/89c5a6e50a0daceec971ff5ce210164a [coveralls]: https://coveralls.io/r/tcnksm/go-gitconfig [license]: https://github.com/tcnksm/go-gitconfig/blob/master/LICENSE [godocs]: http://godoc.org/github.com/tcnksm/go-gitconfig `go-gitconfig` is a pacakge to use `gitconfig` values in Golang. Sometimes you want to extract username or its email address **implicitly** in your tool. Now most of developer use `git`, so we can use its configuration variables. `go-gitconfig` is for that. `go-gitconfig` is very small, so it may not be included what you want to use. If you want to use more git specific variable, check [Other](##VS). ## Usage If you want to use git user name defined in `~/.gitconfig`: ```go username, err := gitconfig.Username() ``` Or git user email defined in `~/.gitconfig`: ```go email, err := gitconfig.Email() ``` Or, if you want to extract origin url of current project (from `.git/config`): ```go url, err := gitconfig.OriginURL() ``` You can also extract value by key: ```go editor, err := gitconfig.Global("core.editor") ``` ```go remote, err := gitconfig.Local("branch.master.remote") ``` See more details in document at [https://godoc.org/github.com/tcnksm/go-gitconfig](https://godoc.org/github.com/tcnksm/go-gitconfig). ## Install To install, use `go get`: ```bash $ go get -d github.com/tcnksm/go-gitconfig ``` ## VS. - [speedata/gogit](https://github.com/speedata/gogit) - [libgit2/git2go](https://github.com/libgit2/git2go) These packages have many features to use git from golang. `go-gitconfig` is very simple alternative and focus to extract information from gitconfig. `go-gitconfig` is used in [tcnksm/ghr](https://github.com/tcnksm/ghr). ## Contribution 1. Fork ([https://github.com/tcnksm/go-gitconfig/fork](https://github.com/tcnksm/go-gitconfig/fork)) 1. Create a feature branch 1. Commit your changes 1. Rebase your local changes against the master branch 1. Run test suite with the `go test ./...` command and confirm that it passes 1. Run `gofmt -s` 1. Create new Pull Request ## Author [tcnksm](https://github.com/tcnksm)
{ "pile_set_name": "Github" }
package com.andrognito.pinlockview; import android.graphics.Rect; import android.support.v7.widget.RecyclerView; import android.view.View; /** * Created by aritraroy on 31/05/16. */ public class ItemSpaceDecoration extends RecyclerView.ItemDecoration { private final int mHorizontalSpaceWidth; private final int mVerticalSpaceHeight; private final int mSpanCount; private final boolean mIncludeEdge; public ItemSpaceDecoration(int horizontalSpaceWidth, int verticalSpaceHeight, int spanCount, boolean includeEdge) { this.mHorizontalSpaceWidth = horizontalSpaceWidth; this.mVerticalSpaceHeight = verticalSpaceHeight; this.mSpanCount = spanCount; this.mIncludeEdge = includeEdge; } @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { int position = parent.getChildAdapterPosition(view); int column = position % mSpanCount; if (mIncludeEdge) { outRect.left = mHorizontalSpaceWidth - column * mHorizontalSpaceWidth / mSpanCount; outRect.right = (column + 1) * mHorizontalSpaceWidth / mSpanCount; if (position < mSpanCount) { outRect.top = mVerticalSpaceHeight; } outRect.bottom = mVerticalSpaceHeight; } else { outRect.left = column * mHorizontalSpaceWidth / mSpanCount; outRect.right = mHorizontalSpaceWidth - (column + 1) * mHorizontalSpaceWidth / mSpanCount; if (position >= mSpanCount) { outRect.top = mVerticalSpaceHeight; } } } }
{ "pile_set_name": "Github" }
-- fkey2.test -- -- execsql { PRAGMA count_changes = 1 } PRAGMA count_changes = 1
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/epoll.h> #include <util/symbol.h> #include <linux/filter.h> #include "tests.h" #include "debug.h" #include "probe-file.h" #include "build-id.h" #include "util.h" /* To test SDT event, we need libelf support to scan elf binary */ #if defined(HAVE_SDT_EVENT) && defined(HAVE_LIBELF_SUPPORT) #include <sys/sdt.h> static int target_function(void) { DTRACE_PROBE(perf, test_target); return TEST_OK; } /* Copied from builtin-buildid-cache.c */ static int build_id_cache__add_file(const char *filename) { char sbuild_id[SBUILD_ID_SIZE]; u8 build_id[BUILD_ID_SIZE]; int err; err = filename__read_build_id(filename, &build_id, sizeof(build_id)); if (err < 0) { pr_debug("Failed to read build id of %s\n", filename); return err; } build_id__sprintf(build_id, sizeof(build_id), sbuild_id); err = build_id_cache__add_s(sbuild_id, filename, NULL, false, false); if (err < 0) pr_debug("Failed to add build id cache of %s\n", filename); return err; } static char *get_self_path(void) { char *buf = calloc(PATH_MAX, sizeof(char)); if (buf && readlink("/proc/self/exe", buf, PATH_MAX - 1) < 0) { pr_debug("Failed to get correct path of perf\n"); free(buf); return NULL; } return buf; } static int search_cached_probe(const char *target, const char *group, const char *event) { struct probe_cache *cache = probe_cache__new(target, NULL); int ret = 0; if (!cache) { pr_debug("Failed to open probe cache of %s\n", target); return -EINVAL; } if (!probe_cache__find_by_name(cache, group, event)) { pr_debug("Failed to find %s:%s in the cache\n", group, event); ret = -ENOENT; } probe_cache__delete(cache); return ret; } int test__sdt_event(struct test *test __maybe_unused, int subtests __maybe_unused) { int ret = TEST_FAIL; char __tempdir[] = "./test-buildid-XXXXXX"; char *tempdir = NULL, *myself = get_self_path(); if (myself == NULL || mkdtemp(__tempdir) == NULL) { pr_debug("Failed to make a tempdir for build-id cache\n"); goto error; } /* Note that buildid_dir must be an absolute path */ tempdir = realpath(__tempdir, NULL); if (tempdir == NULL) goto error_rmdir; /* At first, scan itself */ set_buildid_dir(tempdir); if (build_id_cache__add_file(myself) < 0) goto error_rmdir; /* Open a cache and make sure the SDT is stored */ if (search_cached_probe(myself, "sdt_perf", "test_target") < 0) goto error_rmdir; /* TBD: probing on the SDT event and collect logs */ /* Call the target and get an event */ ret = target_function(); error_rmdir: /* Cleanup temporary buildid dir */ rm_rf(__tempdir); error: free(tempdir); free(myself); return ret; } #else int test__sdt_event(struct test *test __maybe_unused, int subtests __maybe_unused) { pr_debug("Skip SDT event test because SDT support is not compiled\n"); return TEST_SKIP; } #endif
{ "pile_set_name": "Github" }
/* ----------------------------------------------------------------- * Programmer: Radu Serban @ LLNL * ----------------------------------------------------------------- * SUNDIALS Copyright Start * Copyright (c) 2002-2020, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * * See the top-level LICENSE and NOTICE files for details. * * SPDX-License-Identifier: BSD-3-Clause * SUNDIALS Copyright End * ----------------------------------------------------------------- * This is the header file for a generic package of DENSE matrix * operations, based on the DlsMat type defined in sundials_direct.h. * * There are two sets of dense solver routines listed in * this file: one set uses type DlsMat defined below and the * other set uses the type realtype ** for dense matrix arguments. * Routines that work with the type DlsMat begin with "Dense". * Routines that work with realtype** begin with "dense". * -----------------------------------------------------------------*/ #ifndef _SUNDIALS_DENSE_H #define _SUNDIALS_DENSE_H #include <sundials/sundials_direct.h> #ifdef __cplusplus /* wrapper to enable C++ usage */ extern "C" { #endif /* * ----------------------------------------------------------------- * Functions: DenseGETRF and DenseGETRS * ----------------------------------------------------------------- * DenseGETRF performs the LU factorization of the M by N dense * matrix A. This is done using standard Gaussian elimination * with partial (row) pivoting. Note that this applies only * to matrices with M >= N and full column rank. * * A successful LU factorization leaves the matrix A and the * pivot array p with the following information: * * (1) p[k] contains the row number of the pivot element chosen * at the beginning of elimination step k, k=0, 1, ..., N-1. * * (2) If the unique LU factorization of A is given by PA = LU, * where P is a permutation matrix, L is a lower trapezoidal * matrix with all 1's on the diagonal, and U is an upper * triangular matrix, then the upper triangular part of A * (including its diagonal) contains U and the strictly lower * trapezoidal part of A contains the multipliers, I-L. * * For square matrices (M = N), L is unit lower triangular. * * DenseGETRF returns 0 if successful. Otherwise it encountered * a zero diagonal element during the factorization. In this case * it returns the column index (numbered from one) at which * it encountered the zero. * * DenseGETRS solves the N-dimensional system A x = b using * the LU factorization in A and the pivot information in p * computed in DenseGETRF. The solution x is returned in b. This * routine cannot fail if the corresponding call to DenseGETRF * did not fail. * DenseGETRS does NOT check for a square matrix! * * ----------------------------------------------------------------- * DenseGETRF and DenseGETRS are simply wrappers around denseGETRF * and denseGETRS, respectively, which perform all the work by * directly accessing the data in the DlsMat A (i.e. in A->cols). * ----------------------------------------------------------------- */ SUNDIALS_EXPORT sunindextype DenseGETRF(DlsMat A, sunindextype *p); SUNDIALS_EXPORT void DenseGETRS(DlsMat A, sunindextype *p, realtype *b); SUNDIALS_EXPORT sunindextype denseGETRF(realtype **a, sunindextype m, sunindextype n, sunindextype *p); SUNDIALS_EXPORT void denseGETRS(realtype **a, sunindextype n, sunindextype *p, realtype *b); /* * ----------------------------------------------------------------- * Functions : DensePOTRF and DensePOTRS * ----------------------------------------------------------------- * DensePOTRF computes the Cholesky factorization of a real symmetric * positive definite matrix A. * ----------------------------------------------------------------- * DensePOTRS solves a system of linear equations A*X = B with a * symmetric positive definite matrix A using the Cholesky factorization * A = L*L**T computed by DensePOTRF. * * ----------------------------------------------------------------- * DensePOTRF and DensePOTRS are simply wrappers around densePOTRF * and densePOTRS, respectively, which perform all the work by * directly accessing the data in the DlsMat A (i.e. the field cols) * ----------------------------------------------------------------- */ SUNDIALS_EXPORT sunindextype DensePOTRF(DlsMat A); SUNDIALS_EXPORT void DensePOTRS(DlsMat A, realtype *b); SUNDIALS_EXPORT sunindextype densePOTRF(realtype **a, sunindextype m); SUNDIALS_EXPORT void densePOTRS(realtype **a, sunindextype m, realtype *b); /* * ----------------------------------------------------------------- * Functions : DenseGEQRF and DenseORMQR * ----------------------------------------------------------------- * DenseGEQRF computes a QR factorization of a real M-by-N matrix A: * A = Q * R (with M>= N). * * DenseGEQRF requires a temporary work vector wrk of length M. * ----------------------------------------------------------------- * DenseORMQR computes the product w = Q * v where Q is a real * orthogonal matrix defined as the product of k elementary reflectors * * Q = H(1) H(2) . . . H(k) * * as returned by DenseGEQRF. Q is an M-by-N matrix, v is a vector * of length N and w is a vector of length M (with M >= N). * * DenseORMQR requires a temporary work vector wrk of length M. * * ----------------------------------------------------------------- * DenseGEQRF and DenseORMQR are simply wrappers around denseGEQRF * and denseORMQR, respectively, which perform all the work by * directly accessing the data in the DlsMat A (i.e. the field cols) * ----------------------------------------------------------------- */ SUNDIALS_EXPORT int DenseGEQRF(DlsMat A, realtype *beta, realtype *wrk); SUNDIALS_EXPORT int DenseORMQR(DlsMat A, realtype *beta, realtype *vn, realtype *vm, realtype *wrk); SUNDIALS_EXPORT int denseGEQRF(realtype **a, sunindextype m, sunindextype n, realtype *beta, realtype *wrk); SUNDIALS_EXPORT int denseORMQR(realtype **a, sunindextype m, sunindextype n, realtype *beta, realtype *v, realtype *w, realtype *wrk); /* * ----------------------------------------------------------------- * Function : DenseCopy * ----------------------------------------------------------------- * DenseCopy copies the contents of the M-by-N matrix A into the * M-by-N matrix B. * * DenseCopy is a wrapper around denseCopy which accesses the data * in the DlsMat A and DlsMat B (i.e. the fields cols) * ----------------------------------------------------------------- */ SUNDIALS_EXPORT void DenseCopy(DlsMat A, DlsMat B); SUNDIALS_EXPORT void denseCopy(realtype **a, realtype **b, sunindextype m, sunindextype n); /* * ----------------------------------------------------------------- * Function: DenseScale * ----------------------------------------------------------------- * DenseScale scales the elements of the M-by-N matrix A by the * constant c and stores the result back in A. * * DenseScale is a wrapper around denseScale which performs the actual * scaling by accessing the data in the DlsMat A (i.e. in A->cols). * ----------------------------------------------------------------- */ SUNDIALS_EXPORT void DenseScale(realtype c, DlsMat A); SUNDIALS_EXPORT void denseScale(realtype c, realtype **a, sunindextype m, sunindextype n); /* * ----------------------------------------------------------------- * Function: denseAddIdentity * ----------------------------------------------------------------- * denseAddIdentity adds the identity matrix to the n-by-n matrix * stored in a realtype** array. * ----------------------------------------------------------------- */ SUNDIALS_EXPORT void denseAddIdentity(realtype **a, sunindextype n); /* * ----------------------------------------------------------------- * Function: DenseMatvec * ----------------------------------------------------------------- * DenseMatvec computes the matrix-vector product y = A*x, where A * is an M-by-N matrix, x is a vector of length N, and y is a vector * of length M. No error checking is performed on the length of the * arrays x and y. Only y is modified in this routine. * * DenseMatvec is a wrapper around denseMatvec which performs the * actual product by accessing the data in the DlsMat A. * ----------------------------------------------------------------- */ SUNDIALS_EXPORT void DenseMatvec(DlsMat A, realtype *x, realtype *y); SUNDIALS_EXPORT void denseMatvec(realtype **a, realtype *x, realtype *y, sunindextype m, sunindextype n); #ifdef __cplusplus } #endif #endif
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.14"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>VSTS DemoGenerator: VstsRestAPI.Viewmodel.ReleaseDefinition.ReleaseDefinitions.Definition Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="logo.png"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">VSTS DemoGenerator </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.14 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */</script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespace_vsts_rest_a_p_i.html">VstsRestAPI</a></li><li class="navelem"><a class="el" href="namespace_vsts_rest_a_p_i_1_1_viewmodel.html">Viewmodel</a></li><li class="navelem"><a class="el" href="namespace_vsts_rest_a_p_i_1_1_viewmodel_1_1_release_definition.html">ReleaseDefinition</a></li><li class="navelem"><a class="el" href="class_vsts_rest_a_p_i_1_1_viewmodel_1_1_release_definition_1_1_release_definitions.html">ReleaseDefinitions</a></li><li class="navelem"><a class="el" href="class_vsts_rest_a_p_i_1_1_viewmodel_1_1_release_definition_1_1_release_definitions_1_1_definition.html">Definition</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#properties">Properties</a> &#124; <a href="class_vsts_rest_a_p_i_1_1_viewmodel_1_1_release_definition_1_1_release_definitions_1_1_definition-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">VstsRestAPI.Viewmodel.ReleaseDefinition.ReleaseDefinitions.Definition Class Reference</div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="properties"></a> Properties</h2></td></tr> <tr class="memitem:ad24a7de4cdd8e34d7255287dd7c6817f"><td class="memItemLeft" align="right" valign="top"><a id="ad24a7de4cdd8e34d7255287dd7c6817f"></a> string&#160;</td><td class="memItemRight" valign="bottom"><b>id</b><code> [get, set]</code></td></tr> <tr class="separator:ad24a7de4cdd8e34d7255287dd7c6817f"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:afd5e834b5f9d117ffe2bd4063eecfa66"><td class="memItemLeft" align="right" valign="top"><a id="afd5e834b5f9d117ffe2bd4063eecfa66"></a> string&#160;</td><td class="memItemRight" valign="bottom"><b>name</b><code> [get, set]</code></td></tr> <tr class="separator:afd5e834b5f9d117ffe2bd4063eecfa66"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <hr/>The documentation for this class was generated from the following file:<ul> <li>D:/Canarys/Projects/DemoGeneratorOauth/VstsRestAPI/Viewmodel/ReleaseDefinition/ReleaseDefinitions.cs</li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.14 </small></address> </body> </html>
{ "pile_set_name": "Github" }
"""Unit test package for {{ cookiecutter.project_slug }}."""
{ "pile_set_name": "Github" }
//! Triggers use std::{error::Error, fmt}; use crate::append::rolling_file::LogFile; #[cfg(feature = "file")] use crate::file::Deserializable; #[cfg(feature = "size_trigger")] pub mod size; /// A trait which identifies if the active log file should be rolled over. pub trait Trigger: fmt::Debug + Send + Sync + 'static { /// Determines if the active log file should be rolled over. fn trigger(&self, file: &LogFile) -> Result<bool, Box<dyn Error + Sync + Send>>; } #[cfg(feature = "file")] impl Deserializable for dyn Trigger { fn name() -> &'static str { "trigger" } }
{ "pile_set_name": "Github" }
0.421862 10.830241 0.105349 -2.241611 0.155196 21.872976 0.161152 2.015418 0.382632 -38.778979 0.017710 20.109113 0.129656 15.266887 0.613926 111.900063 0.409277 1.874731 0.807556 111.223754 0.593722 133.835486 0.953239 110.465070 0.257402 15.332899 0.645385 93.983054 0.563460 93.645277 0.408338 -30.719878 0.874394 91.873505 0.263805 -0.192752 0.411198 10.751118 0.449884 9.211901 0.646315 113.533660 0.673718 125.135638 0.805148 113.300462 0.759327 72.668572 0.519172 82.131698 0.741031 106.777146 0.030937 9.859127 0.268848 -34.137955 0.474901 -11.201301 0.588266 120.501998 0.893936 142.826476 0.870990 105.751746 0.430763 39.146258 0.057665 15.371897 0.100076 9.131761 0.980716 116.145896 0.235289 -13.691224 0.228098 16.089151 0.622248 99.345551 0.401467 -1.694383 0.960334 110.795415 0.031214 -5.330042 0.504228 96.003525 0.779660 75.921582 0.504496 101.341462 0.850974 96.293064 0.701119 102.333839 0.191551 5.072326 0.667116 92.310019 0.555584 80.367129 0.680006 132.965442 0.393899 38.605283 0.048940 -9.861871 0.963282 115.407485 0.655496 104.269918 0.576463 141.127267 0.675708 96.227996 0.853457 114.252288 0.003933 -12.182861 0.549512 97.927224 0.218967 -4.712462 0.659972 120.950439 0.008256 8.026816 0.099500 -14.318434 0.352215 -3.747546 0.874926 89.247356 0.635084 99.496059 0.039641 14.147109 0.665111 103.298719 0.156583 -2.540703 0.648843 119.333019 0.893237 95.209585 0.128807 5.558479 0.137438 5.567685 0.630538 98.462792 0.296084 -41.799438 0.632099 84.895098 0.987681 106.726447 0.744909 111.279705 0.862030 104.581156 0.080649 -7.679985 0.831277 59.053356 0.198716 26.878801 0.860932 90.632930 0.883250 92.759595 0.818003 110.272219 0.949216 115.200237 0.460078 -35.957981 0.561077 93.545761 0.863767 114.125786 0.476891 -29.774060 0.537826 81.587922 0.686224 110.911198 0.982327 119.114523 0.944453 92.033481 0.078227 30.216873 0.782937 92.588646 0.465886 2.222139 0.885024 90.247890 0.186077 7.144415 0.915828 84.010074 0.796649 115.572156 0.127821 28.933688 0.433429 6.782575 0.946796 108.574116 0.386915 -17.404601 0.561192 92.142700 0.182490 10.764616 0.878792 95.289476 0.381342 -6.177464 0.358474 -11.731754 0.270647 13.793201 0.488904 -17.641832 0.106773 5.684757 0.270112 4.335675 0.754985 75.860433 0.585174 111.640154 0.458821 12.029692 0.218017 -26.234872 0.583887 99.413850 0.923626 107.802298 0.833620 104.179678 0.870691 93.132591 0.249896 -8.618404 0.748230 109.160652 0.019365 34.048884 0.837588 101.239275 0.529251 115.514729 0.742898 67.038771 0.522034 64.160799 0.498982 3.983061 0.479439 24.355908 0.314834 -14.256200 0.753251 85.017092 0.479362 -17.480446 0.950593 99.072784 0.718623 58.080256 0.218720 -19.605593 0.664113 94.437159 0.942900 131.725134 0.314226 18.904871 0.284509 11.779346 0.004962 -14.624176 0.224087 -50.547649 0.974331 112.822725 0.894610 112.863995 0.167350 0.073380 0.753644 105.024456 0.632241 108.625812 0.314189 -6.090797 0.965527 87.418343 0.820919 94.610538 0.144107 -4.748387 0.072556 -5.682008 0.002447 29.685714 0.851007 79.632376 0.458024 -12.326026 0.627503 139.458881 0.422259 -29.827405 0.714659 63.480271 0.672320 93.608554 0.498592 37.112975 0.698906 96.282845 0.861441 99.699230 0.112425 -12.419909 0.164784 5.244704 0.481531 -18.070497 0.375482 1.779411 0.089325 -14.216755 0.036609 -6.264372 0.945004 54.723563 0.136608 14.970936 0.292285 -41.723711 0.029195 -0.660279 0.998307 100.124230 0.303928 -5.492264 0.957863 117.824392 0.815089 113.377704 0.466399 -10.249874 0.876693 115.617275 0.536121 102.997087 0.373984 -37.359936 0.565162 74.967476 0.085412 -21.449563 0.686411 64.859620 0.908752 107.983366 0.982829 98.005424 0.052766 -42.139502 0.777552 91.899340 0.374316 -3.522501 0.060231 10.008227 0.526225 87.317722 0.583872 67.104433 0.238276 10.615159 0.678747 60.624273 0.067649 15.947398 0.530182 105.030933 0.869389 104.969996 0.698410 75.460417 0.549430 82.558068
{ "pile_set_name": "Github" }
import { SCHEMES } from "../uri"; const NID$ = "(?:[0-9A-Za-z][0-9A-Za-z\\-]{1,31})"; const PCT_ENCODED$ = "(?:\\%[0-9A-Fa-f]{2})"; const TRANS$$ = "[0-9A-Za-z\\(\\)\\+\\,\\-\\.\\:\\=\\@\\;\\$\\_\\!\\*\\'\\/\\?\\#]"; const NSS$ = "(?:(?:" + PCT_ENCODED$ + "|" + TRANS$$ + ")+)"; const URN_SCHEME = new RegExp("^urn\\:(" + NID$ + ")$"); const URN_PATH = new RegExp("^(" + NID$ + ")\\:(" + NSS$ + ")$"); const URN_PARSE = /^([^\:]+)\:(.*)/; const URN_EXCLUDED = /[\x00-\x20\\\"\&\<\>\[\]\^\`\{\|\}\~\x7F-\xFF]/g; //RFC 2141 const handler = { scheme: "urn", parse: function (components, options) { const matches = components.path && components.path.match(URN_PARSE); let urnComponents = components; if (matches) { const scheme = options.scheme || urnComponents.scheme || "urn"; const nid = matches[1].toLowerCase(); const nss = matches[2]; const urnScheme = `${scheme}:${options.nid || nid}`; const schemeHandler = SCHEMES[urnScheme]; urnComponents.nid = nid; urnComponents.nss = nss; urnComponents.path = undefined; if (schemeHandler) { urnComponents = schemeHandler.parse(urnComponents, options); } } else { urnComponents.error = urnComponents.error || "URN can not be parsed."; } return urnComponents; }, serialize: function (urnComponents, options) { const scheme = options.scheme || urnComponents.scheme || "urn"; const nid = urnComponents.nid; const urnScheme = `${scheme}:${options.nid || nid}`; const schemeHandler = SCHEMES[urnScheme]; if (schemeHandler) { urnComponents = schemeHandler.serialize(urnComponents, options); } const uriComponents = urnComponents; const nss = urnComponents.nss; uriComponents.path = `${nid || options.nid}:${nss}`; return uriComponents; }, }; export default handler; //# sourceMappingURL=urn.js.map
{ "pile_set_name": "Github" }
--TEST-- Test Abs Class --FILE-- <?php trait StaticExample { public static function doSomething() { return 'Doing something'; } } class Example { use StaticExample; } Example::doSomething(); ?> --EXPECT-- PHP_TOKEN|<|2 PHP_TOKEN|?|2 PHP_LABEL|php|2 WHITESPACE| |2 PHP_TRAIT|trait|2 WHITESPACE| |2 PHP_LABEL|StaticExample|2 WHITESPACE| |2 PHP_CURLY_OPEN|{ |2 PHP_PUBLIC|public|2 WHITESPACE| |2 PHP_STATIC|static|2 WHITESPACE| |2 PHP_FUNCTION|function|2 WHITESPACE| |2 PHP_LABEL|doSomething|2 PHP_TOKEN|(|2 PHP_TOKEN|)|2 WHITESPACE| |2 PHP_CURLY_OPEN|{ |2 PHP_RETURN|return|2 WHITESPACE| |2 PHP_CONSTANT_ENCAPSED_STRING|'Doing something'|2 PHP_SEMICOLON|;|2 WHITESPACE| |2 PHP_CURLY_CLOSE|} |2 PHP_CURLY_CLOSE|} |2 PHP_CLASS|class|2 WHITESPACE| |2 PHP_LABEL|Example|2 WHITESPACE| |2 PHP_CURLY_OPEN|{ |2 PHP_USE|use|2 WHITESPACE| |2 PHP_LABEL|StaticExample|2 PHP_SEMICOLON|;|2 WHITESPACE| |2 PHP_CURLY_CLOSE|} |2 PHP_LABEL|Example|2 PHP_PAAMAYIM_NEKUDOTAYIM|::|2 PHP_LABEL|doSomething|2 PHP_TOKEN|(|2 PHP_TOKEN|)|2 PHP_SEMICOLON|;|2 WHITESPACE| |2 PHP_CLOSETAG|?>|2
{ "pile_set_name": "Github" }
// Copyright 2011 The Closure Library 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. /** * @fileoverview Definition of the disposable interface. A disposable object * has a dispose method to to clean up references and resources. * @author [email protected] (Nathan Naze) */ goog.provide('goog.disposable.IDisposable'); /** * Interface for a disposable object. If a instance requires cleanup * (references COM objects, DOM notes, or other disposable objects), it should * implement this interface (it may subclass goog.Disposable). * @interface */ goog.disposable.IDisposable = function() {}; /** * Disposes of the object and its resources. * @return {void} Nothing. */ goog.disposable.IDisposable.prototype.dispose; /** * @return {boolean} Whether the object has been disposed of. */ goog.disposable.IDisposable.prototype.isDisposed;
{ "pile_set_name": "Github" }
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * This file is available under and governed by the GNU General Public * License version 2 only, as published by the Free Software Foundation. * However, the following notice accompanied the original version of this * file: * * ASM: a very small and fast Java bytecode manipulation framework * Copyright (c) 2000-2011 INRIA, France Telecom * All rights reserved. * * 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 copyright holders 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. */ package jdk.internal.org.objectweb.asm.util; import jdk.internal.org.objectweb.asm.Opcodes; import jdk.internal.org.objectweb.asm.signature.SignatureVisitor; /** * A {@link SignatureVisitor} that builds the Java generic type declaration corresponding to the * signature it visits. * * @author Eugene Kuleshov * @author Eric Bruneton */ public final class TraceSignatureVisitor extends SignatureVisitor { private static final String COMMA_SEPARATOR = ", "; private static final String EXTENDS_SEPARATOR = " extends "; private static final String IMPLEMENTS_SEPARATOR = " implements "; /** Whether the visited signature is a class signature of a Java interface. */ private final boolean isInterface; /** The Java generic type declaration corresponding to the visited signature. */ private final StringBuilder declaration; /** The Java generic method return type declaration corresponding to the visited signature. */ private StringBuilder returnType; /** The Java generic exception types declaration corresponding to the visited signature. */ private StringBuilder exceptions; /** Whether {@link #visitFormalTypeParameter} has been called. */ private boolean formalTypeParameterVisited; /** Whether {@link #visitInterfaceBound} has been called. */ private boolean interfaceBoundVisited; /** Whether {@link #visitParameterType} has been called. */ private boolean parameterTypeVisited; /** Whether {@link #visitInterface} has been called. */ private boolean interfaceVisited; /** * The stack used to keep track of class types that have arguments. Each element of this stack is * a boolean encoded in one bit. The top of the stack is the least significant bit. Pushing false * = *2, pushing true = *2+1, popping = /2. */ private int argumentStack; /** * The stack used to keep track of array class types. Each element of this stack is a boolean * encoded in one bit. The top of the stack is the lowest order bit. Pushing false = *2, pushing * true = *2+1, popping = /2. */ private int arrayStack; /** The separator to append before the next visited class or inner class type. */ private String separator = ""; /** * Constructs a new {@link TraceSignatureVisitor}. * * @param accessFlags for class type signatures, the access flags of the class. */ public TraceSignatureVisitor(final int accessFlags) { super(Opcodes.ASM7); this.isInterface = (accessFlags & Opcodes.ACC_INTERFACE) != 0; this.declaration = new StringBuilder(); } private TraceSignatureVisitor(final StringBuilder stringBuilder) { super(Opcodes.ASM7); this.isInterface = false; this.declaration = stringBuilder; } @Override public void visitFormalTypeParameter(final String name) { declaration.append(formalTypeParameterVisited ? COMMA_SEPARATOR : "<").append(name); formalTypeParameterVisited = true; interfaceBoundVisited = false; } @Override public SignatureVisitor visitClassBound() { separator = EXTENDS_SEPARATOR; startType(); return this; } @Override public SignatureVisitor visitInterfaceBound() { separator = interfaceBoundVisited ? COMMA_SEPARATOR : EXTENDS_SEPARATOR; interfaceBoundVisited = true; startType(); return this; } @Override public SignatureVisitor visitSuperclass() { endFormals(); separator = EXTENDS_SEPARATOR; startType(); return this; } @Override public SignatureVisitor visitInterface() { if (interfaceVisited) { separator = COMMA_SEPARATOR; } else { separator = isInterface ? EXTENDS_SEPARATOR : IMPLEMENTS_SEPARATOR; interfaceVisited = true; } startType(); return this; } @Override public SignatureVisitor visitParameterType() { endFormals(); if (parameterTypeVisited) { declaration.append(COMMA_SEPARATOR); } else { declaration.append('('); parameterTypeVisited = true; } startType(); return this; } @Override public SignatureVisitor visitReturnType() { endFormals(); if (parameterTypeVisited) { parameterTypeVisited = false; } else { declaration.append('('); } declaration.append(')'); returnType = new StringBuilder(); return new TraceSignatureVisitor(returnType); } @Override public SignatureVisitor visitExceptionType() { if (exceptions == null) { exceptions = new StringBuilder(); } else { exceptions.append(COMMA_SEPARATOR); } return new TraceSignatureVisitor(exceptions); } @Override public void visitBaseType(final char descriptor) { switch (descriptor) { case 'V': declaration.append("void"); break; case 'B': declaration.append("byte"); break; case 'J': declaration.append("long"); break; case 'Z': declaration.append("boolean"); break; case 'I': declaration.append("int"); break; case 'S': declaration.append("short"); break; case 'C': declaration.append("char"); break; case 'F': declaration.append("float"); break; case 'D': declaration.append("double"); break; default: throw new IllegalArgumentException(); } endType(); } @Override public void visitTypeVariable(final String name) { declaration.append(separator).append(name); separator = ""; endType(); } @Override public SignatureVisitor visitArrayType() { startType(); arrayStack |= 1; return this; } @Override public void visitClassType(final String name) { if ("java/lang/Object".equals(name)) { // 'Map<java.lang.Object,java.util.List>' or 'abstract public V get(Object key);' should have // Object 'but java.lang.String extends java.lang.Object' is unnecessary. boolean needObjectClass = argumentStack % 2 != 0 || parameterTypeVisited; if (needObjectClass) { declaration.append(separator).append(name.replace('/', '.')); } } else { declaration.append(separator).append(name.replace('/', '.')); } separator = ""; argumentStack *= 2; } @Override public void visitInnerClassType(final String name) { if (argumentStack % 2 != 0) { declaration.append('>'); } argumentStack /= 2; declaration.append('.'); declaration.append(separator).append(name.replace('/', '.')); separator = ""; argumentStack *= 2; } @Override public void visitTypeArgument() { if (argumentStack % 2 == 0) { ++argumentStack; declaration.append('<'); } else { declaration.append(COMMA_SEPARATOR); } declaration.append('?'); } @Override public SignatureVisitor visitTypeArgument(final char tag) { if (argumentStack % 2 == 0) { ++argumentStack; declaration.append('<'); } else { declaration.append(COMMA_SEPARATOR); } if (tag == EXTENDS) { declaration.append("? extends "); } else if (tag == SUPER) { declaration.append("? super "); } startType(); return this; } @Override public void visitEnd() { if (argumentStack % 2 != 0) { declaration.append('>'); } argumentStack /= 2; endType(); } // ----------------------------------------------------------------------------------------------- /** * Returns the Java generic type declaration corresponding to the visited signature. * * @return the Java generic type declaration corresponding to the visited signature. */ public String getDeclaration() { return declaration.toString(); } /** * Returns the Java generic method return type declaration corresponding to the visited signature. * * @return the Java generic method return type declaration corresponding to the visited signature. */ public String getReturnType() { return returnType == null ? null : returnType.toString(); } /** * Returns the Java generic exception types declaration corresponding to the visited signature. * * @return the Java generic exception types declaration corresponding to the visited signature. */ public String getExceptions() { return exceptions == null ? null : exceptions.toString(); } // ----------------------------------------------------------------------------------------------- private void endFormals() { if (formalTypeParameterVisited) { declaration.append('>'); formalTypeParameterVisited = false; } } private void startType() { arrayStack *= 2; } private void endType() { if (arrayStack % 2 == 0) { arrayStack /= 2; } else { while (arrayStack % 2 != 0) { arrayStack /= 2; declaration.append("[]"); } } } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> <dependencies> <deployment identifier="iOS"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> </dependencies> <scenes> <!--View Controller--> <scene sceneID="EHf-IW-A2E"> <objects> <viewController id="01J-lp-oVM" sceneMemberID="viewController"> <layoutGuides> <viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/> <viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/> </layoutGuides> <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4"> </imageView> </subviews> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/> <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/> </constraints> </view> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> <point key="canvasLocation" x="53" y="375"/> </scene> </scenes> <resources> <image name="LaunchImage" width="168" height="185"/> </resources> </document>
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <phpunit backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" syntaxCheck="false" bootstrap="Tests/bootstrap.php" > <testsuites> <testsuite name="Symfony Config Component Test Suite"> <directory>./Tests/</directory> </testsuite> </testsuites> <filter> <whitelist> <directory>./</directory> <exclude> <directory>./Resources</directory> <directory>./Tests</directory> <directory>./vendor</directory> </exclude> </whitelist> </filter> </phpunit>
{ "pile_set_name": "Github" }
/* Texel - A UCI chess engine. Copyright (C) 2012-2015 Peter Österlund, [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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * killerTable.hpp * * Created on: Feb 25, 2012 * Author: petero */ #ifndef KILLERTABLE_HPP_ #define KILLERTABLE_HPP_ #include "move.hpp" #include "constants.hpp" #include <cassert> /** * Implement a table of killer moves for the killer heuristic. */ class KillerTable { public: /** Create an empty killer table. */ KillerTable(); /** Clear killer table. */ void clear(); /** Add a killer move to the table. Moves are replaced on an LRU basis. */ void addKiller(int ply, const Move& m); /** * Get a score for move m based on hits in the killer table. * The score is 4 for primary hit at ply. * The score is 3 for secondary hit at ply. * The score is 0 otherwise. */ int getKillerScore(int ply, const Move& m) const; private: /** There is one KTEntry for each ply in the search tree. */ struct KTEntry { KTEntry(); int move0; int move1; }; KTEntry ktList[SearchConst::MAX_SEARCH_DEPTH * 2]; }; inline KillerTable::KillerTable() { } inline KillerTable::KTEntry::KTEntry() : move0(0), move1(0) { } inline void KillerTable::addKiller(int ply, const Move& m) { if (ply >= (int)COUNT_OF(ktList)) return; int move = (short)(m.from() + (m.to() << 6) + (m.promoteTo() << 12)); KTEntry& ent = ktList[ply]; if (move != ent.move0) { ent.move1 = ent.move0; ent.move0 = move; } } inline int KillerTable::getKillerScore(int ply, const Move& m) const { int move = (short)(m.from() + (m.to() << 6) + (m.promoteTo() << 12)); if (ply < (int)COUNT_OF(ktList)) { const KTEntry& ent = ktList[ply]; if (move == ent.move0) { return 4; } else if (move == ent.move1) { return 3; } } return 0; } #endif /* KILLERTABLE_HPP_ */
{ "pile_set_name": "Github" }
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/organizations/model/InvalidInputExceptionReason.h> #include <aws/core/utils/HashingUtils.h> #include <aws/core/Globals.h> #include <aws/core/utils/EnumParseOverflowContainer.h> using namespace Aws::Utils; namespace Aws { namespace Organizations { namespace Model { namespace InvalidInputExceptionReasonMapper { static const int INVALID_PARTY_TYPE_TARGET_HASH = HashingUtils::HashString("INVALID_PARTY_TYPE_TARGET"); static const int INVALID_SYNTAX_ORGANIZATION_ARN_HASH = HashingUtils::HashString("INVALID_SYNTAX_ORGANIZATION_ARN"); static const int INVALID_SYNTAX_POLICY_ID_HASH = HashingUtils::HashString("INVALID_SYNTAX_POLICY_ID"); static const int INVALID_ENUM_HASH = HashingUtils::HashString("INVALID_ENUM"); static const int INVALID_ENUM_POLICY_TYPE_HASH = HashingUtils::HashString("INVALID_ENUM_POLICY_TYPE"); static const int INVALID_LIST_MEMBER_HASH = HashingUtils::HashString("INVALID_LIST_MEMBER"); static const int MAX_LENGTH_EXCEEDED_HASH = HashingUtils::HashString("MAX_LENGTH_EXCEEDED"); static const int MAX_VALUE_EXCEEDED_HASH = HashingUtils::HashString("MAX_VALUE_EXCEEDED"); static const int MIN_LENGTH_EXCEEDED_HASH = HashingUtils::HashString("MIN_LENGTH_EXCEEDED"); static const int MIN_VALUE_EXCEEDED_HASH = HashingUtils::HashString("MIN_VALUE_EXCEEDED"); static const int IMMUTABLE_POLICY_HASH = HashingUtils::HashString("IMMUTABLE_POLICY"); static const int INVALID_PATTERN_HASH = HashingUtils::HashString("INVALID_PATTERN"); static const int INVALID_PATTERN_TARGET_ID_HASH = HashingUtils::HashString("INVALID_PATTERN_TARGET_ID"); static const int INPUT_REQUIRED_HASH = HashingUtils::HashString("INPUT_REQUIRED"); static const int INVALID_NEXT_TOKEN_HASH = HashingUtils::HashString("INVALID_NEXT_TOKEN"); static const int MAX_LIMIT_EXCEEDED_FILTER_HASH = HashingUtils::HashString("MAX_LIMIT_EXCEEDED_FILTER"); static const int MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS_HASH = HashingUtils::HashString("MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS"); static const int INVALID_FULL_NAME_TARGET_HASH = HashingUtils::HashString("INVALID_FULL_NAME_TARGET"); static const int UNRECOGNIZED_SERVICE_PRINCIPAL_HASH = HashingUtils::HashString("UNRECOGNIZED_SERVICE_PRINCIPAL"); static const int INVALID_ROLE_NAME_HASH = HashingUtils::HashString("INVALID_ROLE_NAME"); static const int INVALID_SYSTEM_TAGS_PARAMETER_HASH = HashingUtils::HashString("INVALID_SYSTEM_TAGS_PARAMETER"); static const int DUPLICATE_TAG_KEY_HASH = HashingUtils::HashString("DUPLICATE_TAG_KEY"); static const int TARGET_NOT_SUPPORTED_HASH = HashingUtils::HashString("TARGET_NOT_SUPPORTED"); InvalidInputExceptionReason GetInvalidInputExceptionReasonForName(const Aws::String& name) { int hashCode = HashingUtils::HashString(name.c_str()); if (hashCode == INVALID_PARTY_TYPE_TARGET_HASH) { return InvalidInputExceptionReason::INVALID_PARTY_TYPE_TARGET; } else if (hashCode == INVALID_SYNTAX_ORGANIZATION_ARN_HASH) { return InvalidInputExceptionReason::INVALID_SYNTAX_ORGANIZATION_ARN; } else if (hashCode == INVALID_SYNTAX_POLICY_ID_HASH) { return InvalidInputExceptionReason::INVALID_SYNTAX_POLICY_ID; } else if (hashCode == INVALID_ENUM_HASH) { return InvalidInputExceptionReason::INVALID_ENUM; } else if (hashCode == INVALID_ENUM_POLICY_TYPE_HASH) { return InvalidInputExceptionReason::INVALID_ENUM_POLICY_TYPE; } else if (hashCode == INVALID_LIST_MEMBER_HASH) { return InvalidInputExceptionReason::INVALID_LIST_MEMBER; } else if (hashCode == MAX_LENGTH_EXCEEDED_HASH) { return InvalidInputExceptionReason::MAX_LENGTH_EXCEEDED; } else if (hashCode == MAX_VALUE_EXCEEDED_HASH) { return InvalidInputExceptionReason::MAX_VALUE_EXCEEDED; } else if (hashCode == MIN_LENGTH_EXCEEDED_HASH) { return InvalidInputExceptionReason::MIN_LENGTH_EXCEEDED; } else if (hashCode == MIN_VALUE_EXCEEDED_HASH) { return InvalidInputExceptionReason::MIN_VALUE_EXCEEDED; } else if (hashCode == IMMUTABLE_POLICY_HASH) { return InvalidInputExceptionReason::IMMUTABLE_POLICY; } else if (hashCode == INVALID_PATTERN_HASH) { return InvalidInputExceptionReason::INVALID_PATTERN; } else if (hashCode == INVALID_PATTERN_TARGET_ID_HASH) { return InvalidInputExceptionReason::INVALID_PATTERN_TARGET_ID; } else if (hashCode == INPUT_REQUIRED_HASH) { return InvalidInputExceptionReason::INPUT_REQUIRED; } else if (hashCode == INVALID_NEXT_TOKEN_HASH) { return InvalidInputExceptionReason::INVALID_NEXT_TOKEN; } else if (hashCode == MAX_LIMIT_EXCEEDED_FILTER_HASH) { return InvalidInputExceptionReason::MAX_LIMIT_EXCEEDED_FILTER; } else if (hashCode == MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS_HASH) { return InvalidInputExceptionReason::MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS; } else if (hashCode == INVALID_FULL_NAME_TARGET_HASH) { return InvalidInputExceptionReason::INVALID_FULL_NAME_TARGET; } else if (hashCode == UNRECOGNIZED_SERVICE_PRINCIPAL_HASH) { return InvalidInputExceptionReason::UNRECOGNIZED_SERVICE_PRINCIPAL; } else if (hashCode == INVALID_ROLE_NAME_HASH) { return InvalidInputExceptionReason::INVALID_ROLE_NAME; } else if (hashCode == INVALID_SYSTEM_TAGS_PARAMETER_HASH) { return InvalidInputExceptionReason::INVALID_SYSTEM_TAGS_PARAMETER; } else if (hashCode == DUPLICATE_TAG_KEY_HASH) { return InvalidInputExceptionReason::DUPLICATE_TAG_KEY; } else if (hashCode == TARGET_NOT_SUPPORTED_HASH) { return InvalidInputExceptionReason::TARGET_NOT_SUPPORTED; } EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { overflowContainer->StoreOverflow(hashCode, name); return static_cast<InvalidInputExceptionReason>(hashCode); } return InvalidInputExceptionReason::NOT_SET; } Aws::String GetNameForInvalidInputExceptionReason(InvalidInputExceptionReason enumValue) { switch(enumValue) { case InvalidInputExceptionReason::INVALID_PARTY_TYPE_TARGET: return "INVALID_PARTY_TYPE_TARGET"; case InvalidInputExceptionReason::INVALID_SYNTAX_ORGANIZATION_ARN: return "INVALID_SYNTAX_ORGANIZATION_ARN"; case InvalidInputExceptionReason::INVALID_SYNTAX_POLICY_ID: return "INVALID_SYNTAX_POLICY_ID"; case InvalidInputExceptionReason::INVALID_ENUM: return "INVALID_ENUM"; case InvalidInputExceptionReason::INVALID_ENUM_POLICY_TYPE: return "INVALID_ENUM_POLICY_TYPE"; case InvalidInputExceptionReason::INVALID_LIST_MEMBER: return "INVALID_LIST_MEMBER"; case InvalidInputExceptionReason::MAX_LENGTH_EXCEEDED: return "MAX_LENGTH_EXCEEDED"; case InvalidInputExceptionReason::MAX_VALUE_EXCEEDED: return "MAX_VALUE_EXCEEDED"; case InvalidInputExceptionReason::MIN_LENGTH_EXCEEDED: return "MIN_LENGTH_EXCEEDED"; case InvalidInputExceptionReason::MIN_VALUE_EXCEEDED: return "MIN_VALUE_EXCEEDED"; case InvalidInputExceptionReason::IMMUTABLE_POLICY: return "IMMUTABLE_POLICY"; case InvalidInputExceptionReason::INVALID_PATTERN: return "INVALID_PATTERN"; case InvalidInputExceptionReason::INVALID_PATTERN_TARGET_ID: return "INVALID_PATTERN_TARGET_ID"; case InvalidInputExceptionReason::INPUT_REQUIRED: return "INPUT_REQUIRED"; case InvalidInputExceptionReason::INVALID_NEXT_TOKEN: return "INVALID_NEXT_TOKEN"; case InvalidInputExceptionReason::MAX_LIMIT_EXCEEDED_FILTER: return "MAX_LIMIT_EXCEEDED_FILTER"; case InvalidInputExceptionReason::MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: return "MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS"; case InvalidInputExceptionReason::INVALID_FULL_NAME_TARGET: return "INVALID_FULL_NAME_TARGET"; case InvalidInputExceptionReason::UNRECOGNIZED_SERVICE_PRINCIPAL: return "UNRECOGNIZED_SERVICE_PRINCIPAL"; case InvalidInputExceptionReason::INVALID_ROLE_NAME: return "INVALID_ROLE_NAME"; case InvalidInputExceptionReason::INVALID_SYSTEM_TAGS_PARAMETER: return "INVALID_SYSTEM_TAGS_PARAMETER"; case InvalidInputExceptionReason::DUPLICATE_TAG_KEY: return "DUPLICATE_TAG_KEY"; case InvalidInputExceptionReason::TARGET_NOT_SUPPORTED: return "TARGET_NOT_SUPPORTED"; default: EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); } return {}; } } } // namespace InvalidInputExceptionReasonMapper } // namespace Model } // namespace Organizations } // namespace Aws
{ "pile_set_name": "Github" }
-- since PK is textual, starting with 900 only ends up with ten rows. SET @s := ' set @counter := 0; update test_cs.test_split_text set nval = 1; split({start: 900}: update test_cs.test_split_text set nval = nval + 1) { set @counter := @counter + 1; } '; call run(@s); select @counter = 1;
{ "pile_set_name": "Github" }
/** * \file * * Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries. * * \asf_license_start * * \page License * * Subject to your compliance with these terms, you may use Microchip * software and any derivatives exclusively with Microchip products. * It is your responsibility to comply with third party license terms applicable * to your use of third party software (including open source software) that * may accompany Microchip software. * * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. * * \asf_license_stop * */ /* * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a> */ #ifndef _SAM4S_MATRIX_INSTANCE_ #define _SAM4S_MATRIX_INSTANCE_ /* ========== Register definition for MATRIX peripheral ========== */ #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) #define REG_MATRIX_MCFG (0x400E0200U) /**< \brief (MATRIX) Master Configuration Register */ #define REG_MATRIX_SCFG (0x400E0240U) /**< \brief (MATRIX) Slave Configuration Register */ #define REG_MATRIX_PRAS0 (0x400E0280U) /**< \brief (MATRIX) Priority Register A for Slave 0 */ #define REG_MATRIX_PRAS1 (0x400E0288U) /**< \brief (MATRIX) Priority Register A for Slave 1 */ #define REG_MATRIX_PRAS2 (0x400E0290U) /**< \brief (MATRIX) Priority Register A for Slave 2 */ #define REG_MATRIX_PRAS3 (0x400E0298U) /**< \brief (MATRIX) Priority Register A for Slave 3 */ #define REG_MATRIX_PRAS4 (0x400E02A0U) /**< \brief (MATRIX) Priority Register A for Slave 4 */ #define REG_CCFG_SYSIO (0x400E0314U) /**< \brief (MATRIX) System I/O Configuration register */ #define REG_CCFG_SMCNFCS (0x400E031CU) /**< \brief (MATRIX) SMC Chip Select NAND Flash Assignment Register */ #define REG_MATRIX_WPMR (0x400E03E4U) /**< \brief (MATRIX) Write Protect Mode Register */ #define REG_MATRIX_WPSR (0x400E03E8U) /**< \brief (MATRIX) Write Protect Status Register */ #else #define REG_MATRIX_MCFG (*(__IO uint32_t*)0x400E0200U) /**< \brief (MATRIX) Master Configuration Register */ #define REG_MATRIX_SCFG (*(__IO uint32_t*)0x400E0240U) /**< \brief (MATRIX) Slave Configuration Register */ #define REG_MATRIX_PRAS0 (*(__IO uint32_t*)0x400E0280U) /**< \brief (MATRIX) Priority Register A for Slave 0 */ #define REG_MATRIX_PRAS1 (*(__IO uint32_t*)0x400E0288U) /**< \brief (MATRIX) Priority Register A for Slave 1 */ #define REG_MATRIX_PRAS2 (*(__IO uint32_t*)0x400E0290U) /**< \brief (MATRIX) Priority Register A for Slave 2 */ #define REG_MATRIX_PRAS3 (*(__IO uint32_t*)0x400E0298U) /**< \brief (MATRIX) Priority Register A for Slave 3 */ #define REG_MATRIX_PRAS4 (*(__IO uint32_t*)0x400E02A0U) /**< \brief (MATRIX) Priority Register A for Slave 4 */ #define REG_CCFG_SYSIO (*(__IO uint32_t*)0x400E0314U) /**< \brief (MATRIX) System I/O Configuration register */ #define REG_CCFG_SMCNFCS (*(__IO uint32_t*)0x400E031CU) /**< \brief (MATRIX) SMC Chip Select NAND Flash Assignment Register */ #define REG_MATRIX_WPMR (*(__IO uint32_t*)0x400E03E4U) /**< \brief (MATRIX) Write Protect Mode Register */ #define REG_MATRIX_WPSR (*(__I uint32_t*)0x400E03E8U) /**< \brief (MATRIX) Write Protect Status Register */ #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #endif /* _SAM4S_MATRIX_INSTANCE_ */
{ "pile_set_name": "Github" }
(function(){var a=function(){};return new a(1,2,3,4)})()
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminSetNotifyBelowQtyValueActionGroup"> <annotations> <description>Fills in the "Notify for Quantity Below" option in 'Advanced Inventory' panel on the Admin Product creation/edit page.</description> </annotations> <arguments> <argument name="qty" type="string"/> </arguments> <uncheckOption selector="{{AdminProductFormAdvancedInventorySection.notifyBelowQtyConfigSetting}}" stepKey="uncheckNotifyBelowQtyCheckBox"/> <fillField selector="{{AdminProductFormAdvancedInventorySection.notifyBelowQty}}" userInput="{{qty}}" stepKey="fillNotifyBelowQty"/> </actionGroup> </actionGroups>
{ "pile_set_name": "Github" }
<?php /** * Copyright since 2007 PrestaShop SA and Contributors * PrestaShop is an International Registered Trademark & Property of PrestaShop SA * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.md. * It is also available through the world-wide-web at this URL: * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to https://devdocs.prestashop.com/ for more information. * * @author PrestaShop SA and Contributors <[email protected]> * @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Core\Domain\Cart\QueryResult; use PrestaShop\PrestaShop\Core\Domain\Cart\QueryResult\CartInformation\CartAddress; use PrestaShop\PrestaShop\Core\Domain\Cart\QueryResult\CartInformation\CartProduct; use PrestaShop\PrestaShop\Core\Domain\Cart\QueryResult\CartInformation\CartRule; use PrestaShop\PrestaShop\Core\Domain\Cart\QueryResult\CartInformation\CartShipping; use PrestaShop\PrestaShop\Core\Domain\Cart\QueryResult\CartInformation\CartSummary; /** * Holds cart information data */ class CartInformation { /** * @var int */ private $cartId; /** * @var CartProduct[] */ private $products; /** * @var int */ private $currencyId; /** * @var int */ private $langId; /** * @var CartRule[] */ private $cartRules; /** * @var CartAddress[] */ private $addresses; /** * @var CartShipping|null */ private $shipping; /** * @var CartSummary */ private $summary; /** * @param int $cartId * @param array $products * @param int $currencyId * @param int $langId * @param CartRule[] $cartRules * @param CartAddress[] $addresses * @param CartSummary $summary * @param CartShipping $shipping */ public function __construct( int $cartId, array $products, int $currencyId, int $langId, array $cartRules, array $addresses, CartSummary $summary, CartShipping $shipping = null ) { $this->cartId = $cartId; $this->products = $products; $this->currencyId = $currencyId; $this->langId = $langId; $this->cartRules = $cartRules; $this->addresses = $addresses; $this->shipping = $shipping; $this->summary = $summary; } /** * @return int */ public function getCartId(): int { return $this->cartId; } /** * @return CartProduct[] */ public function getProducts(): array { return $this->products; } /** * @return int */ public function getCurrencyId(): int { return $this->currencyId; } /** * @return int */ public function getLangId(): int { return $this->langId; } /** * @return CartRule[] */ public function getCartRules(): array { return $this->cartRules; } /** * @return CartAddress[] */ public function getAddresses(): array { return $this->addresses; } /** * @return CartShipping|null */ public function getShipping(): ?CartShipping { return $this->shipping; } /** * @return CartSummary */ public function getSummary(): CartSummary { return $this->summary; } }
{ "pile_set_name": "Github" }
#ifndef __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__ #define __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__ #include "audio/lua_audio_manual.h" #include "network/lua_cocos2dx_network_manual.h" #include "cocostudio/lua_cocos2dx_coco_studio_manual.hpp" #include "ui/lua_cocos2dx_ui_manual.hpp" #include "spine/lua_cocos2dx_spine_manual.hpp" #include "3d/lua_cocos2dx_3d_manual.h" #include "lua/quick/lua_cocos2dx_quick_manual.hpp" #include "dragonBones/lua_dragonBones.hpp" int lua_module_register(lua_State* L) { //Dont' change the module register order unless you know what your are doing register_audio_module(L); register_network_module(L); register_cocostudio_module(L); register_ui_moudle(L); register_spine_module(L); register_cocos3d_module(L); register_dragonBones_manual(L); return 1; } #endif // __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__
{ "pile_set_name": "Github" }
LoadModule negotiation_module /usr/lib/apache2/modules/mod_negotiation.so
{ "pile_set_name": "Github" }
ul.menu li .menu-group Encode li a(href='base32_encode.html') Base32 li a(href='base32_encode_file.html') Base32 File li a(href='base64_encode.html') Base64 li a(href='base64_encode_file.html') Base64 File li a(href='html_encode.html') HTML li a(href='url_encode.html') URL
{ "pile_set_name": "Github" }
window.setInteractables = () => { interact('.draggable', { context: document }) .draggable({ onmove: onMove, inertia: { enabled: true }, restrict: { drag: 'parent', endOnly: true, elementRect: { top: 0, left: 0, bottom: 1, right: 1 }, }, autoScroll: true, }) function onMove (event) { const target = event.target const x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx const y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy if ('webkitTransform' in target.style || 'transform' in target.style) { target.style.webkitTransform = target.style.transform = 'translate(' + x + 'px, ' + y + 'px)' } else { target.style.left = x + 'px' target.style.top = y + 'px' } target.setAttribute('data-x', x) target.setAttribute('data-y', y) } }
{ "pile_set_name": "Github" }
{ "_from": "http-cache-semantics@^3.8.1", "_id": "[email protected]", "_inBundle": false, "_integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==", "_location": "/http-cache-semantics", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "http-cache-semantics@^3.8.1", "name": "http-cache-semantics", "escapedName": "http-cache-semantics", "rawSpec": "^3.8.1", "saveSpec": null, "fetchSpec": "^3.8.1" }, "_requiredBy": [ "/make-fetch-happen", "/npm-profile/make-fetch-happen", "/npm-registry-fetch/make-fetch-happen" ], "_resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", "_shasum": "39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2", "_spec": "http-cache-semantics@^3.8.1", "_where": "/Users/rebecca/code/npm/node_modules/make-fetch-happen", "author": { "name": "Kornel Lesiński", "email": "[email protected]", "url": "https://kornel.ski/" }, "bugs": { "url": "https://github.com/pornel/http-cache-semantics/issues" }, "bundleDependencies": false, "deprecated": false, "description": "Parses Cache-Control and other headers. Helps building correct HTTP caches and proxies", "devDependencies": { "babel-cli": "^6.24.1", "babel-preset-env": "^1.6.1", "mocha": "^3.4.2" }, "files": [ "node4/index.js" ], "homepage": "https://github.com/pornel/http-cache-semantics#readme", "license": "BSD-2-Clause", "main": "node4/index.js", "name": "http-cache-semantics", "repository": { "type": "git", "url": "git+https://github.com/pornel/http-cache-semantics.git" }, "scripts": { "compile": "babel -d node4/ index.js; babel -d node4/test test", "prepublish": "npm run compile", "test": "npm run compile; mocha node4/test" }, "version": "3.8.1" }
{ "pile_set_name": "Github" }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ 'use strict'; import * as nls from 'vs/nls'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { onUnexpectedError } from 'vs/base/common/errors'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { ICommonCodeEditor, IEditorContribution, EditorContextKeys, ModeContextKeys } from 'vs/editor/common/editorCommon'; import { editorAction, ServicesAccessor, EditorAction, EditorCommand, CommonEditorRegistry } from 'vs/editor/common/editorCommonExtensions'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { editorContribution } from 'vs/editor/browser/editorBrowserExtensions'; import { EditOperation } from 'vs/editor/common/core/editOperation'; import { CodeSnippet } from 'vs/editor/contrib/snippet/common/snippet'; import { SnippetController } from 'vs/editor/contrib/snippet/common/snippetController'; import { Context as SuggestContext, snippetSuggestSupport } from 'vs/editor/contrib/suggest/common/suggest'; import { SuggestModel } from '../common/suggestModel'; import { ICompletionItem } from '../common/completionModel'; import { SuggestWidget } from './suggestWidget'; @editorContribution export class SuggestController implements IEditorContribution { private static ID: string = 'editor.contrib.suggestController'; public static get(editor: ICommonCodeEditor): SuggestController { return editor.getContribution<SuggestController>(SuggestController.ID); } private model: SuggestModel; private widget: SuggestWidget; private toDispose: IDisposable[] = []; constructor( private editor: ICodeEditor, @ICommandService private commandService: ICommandService, @ITelemetryService private telemetryService: ITelemetryService, @IContextKeyService contextKeyService: IContextKeyService, @IInstantiationService instantiationService: IInstantiationService ) { this.model = new SuggestModel(this.editor); this.toDispose.push(this.model.onDidTrigger(e => this.widget.showTriggered(e.auto))); this.toDispose.push(this.model.onDidSuggest(e => this.widget.showSuggestions(e.completionModel, e.isFrozen, e.auto))); this.toDispose.push(this.model.onDidCancel(e => !e.retrigger && this.widget.hideWidget())); // Manage the acceptSuggestionsOnEnter context key let acceptSuggestionsOnEnter = SuggestContext.AcceptSuggestionsOnEnter.bindTo(contextKeyService); let updateFromConfig = () => { acceptSuggestionsOnEnter.set(this.editor.getConfiguration().contribInfo.acceptSuggestionOnEnter); }; this.toDispose.push(this.editor.onDidChangeConfiguration((e) => updateFromConfig())); updateFromConfig(); this.widget = instantiationService.createInstance(SuggestWidget, this.editor); this.toDispose.push(this.widget.onDidSelect(this.onDidSelectItem, this)); } getId(): string { return SuggestController.ID; } dispose(): void { this.toDispose = dispose(this.toDispose); if (this.widget) { this.widget.dispose(); this.widget = null; } if (this.model) { this.model.dispose(); this.model = null; } } private onDidSelectItem(item: ICompletionItem): void { if (item) { const {suggestion, position} = item; const columnDelta = this.editor.getPosition().column - position.column; if (Array.isArray(suggestion.additionalTextEdits)) { this.editor.pushUndoStop(); this.editor.executeEdits('suggestController.additionalTextEdits', suggestion.additionalTextEdits.map(edit => EditOperation.replace(edit.range, edit.text))); this.editor.pushUndoStop(); } const snippet = suggestion.isTMSnippet ? CodeSnippet.fromTextmate(suggestion.insertText) : CodeSnippet.fromInternal(suggestion.insertText); SnippetController.get(this.editor).run( snippet, suggestion.overwriteBefore + columnDelta, suggestion.overwriteAfter ); if (suggestion.command) { this.commandService.executeCommand(suggestion.command.id, ...suggestion.command.arguments).done(undefined, onUnexpectedError); } if (item.support !== snippetSuggestSupport) { this.telemetryService.publicLog('suggestSnippetInsert', { hasPlaceholders: snippet.placeHolders.length > 0 }); } } this.model.cancel(); } triggerSuggest(): void { this.model.trigger(false, false); this.editor.focus(); } acceptSelectedSuggestion(): void { if (this.widget) { const item = this.widget.getFocusedItem(); this.onDidSelectItem(item); } } cancelSuggestWidget(): void { if (this.widget) { this.widget.hideDetailsOrHideWidget(); } } selectNextSuggestion(): void { if (this.widget) { this.widget.selectNext(); } } selectNextPageSuggestion(): void { if (this.widget) { this.widget.selectNextPage(); } } selectPrevSuggestion(): void { if (this.widget) { this.widget.selectPrevious(); } } selectPrevPageSuggestion(): void { if (this.widget) { this.widget.selectPreviousPage(); } } toggleSuggestionDetails(): void { if (this.widget) { this.widget.toggleDetails(); } } } @editorAction export class TriggerSuggestAction extends EditorAction { constructor() { super({ id: 'editor.action.triggerSuggest', label: nls.localize('suggest.trigger.label', "Trigger Suggest"), alias: 'Trigger Suggest', precondition: ContextKeyExpr.and(EditorContextKeys.Writable, ModeContextKeys.hasCompletionItemProvider), kbOpts: { kbExpr: EditorContextKeys.TextFocus, primary: KeyMod.CtrlCmd | KeyCode.Space, mac: { primary: KeyMod.WinCtrl | KeyCode.Space } } }); } public run(accessor:ServicesAccessor, editor:ICommonCodeEditor): void { SuggestController.get(editor).triggerSuggest(); } } const weight = CommonEditorRegistry.commandWeight(90); const SuggestCommand = EditorCommand.bindToContribution<SuggestController>(SuggestController.get); CommonEditorRegistry.registerEditorCommand(new SuggestCommand({ id: 'acceptSelectedSuggestion', precondition: SuggestContext.Visible, handler: x => x.acceptSelectedSuggestion(), kbOpts: { weight: weight, kbExpr: EditorContextKeys.TextFocus, primary: KeyCode.Tab } })); CommonEditorRegistry.registerEditorCommand(new SuggestCommand({ id: 'acceptSelectedSuggestionOnEnter', precondition: SuggestContext.Visible, handler: x => x.acceptSelectedSuggestion(), kbOpts: { weight: weight, kbExpr: ContextKeyExpr.and(EditorContextKeys.TextFocus, SuggestContext.AcceptSuggestionsOnEnter), primary: KeyCode.Enter } })); CommonEditorRegistry.registerEditorCommand(new SuggestCommand({ id: 'hideSuggestWidget', precondition: SuggestContext.Visible, handler: x => x.cancelSuggestWidget(), kbOpts: { weight: weight, kbExpr: EditorContextKeys.TextFocus, primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] } })); CommonEditorRegistry.registerEditorCommand(new SuggestCommand({ id: 'selectNextSuggestion', precondition: ContextKeyExpr.and(SuggestContext.Visible, SuggestContext.MultipleSuggestions), handler: c => c.selectNextSuggestion(), kbOpts: { weight: weight, kbExpr: EditorContextKeys.TextFocus, primary: KeyCode.DownArrow, secondary: [KeyMod.Alt | KeyCode.DownArrow], mac: { primary: KeyCode.DownArrow, secondary: [KeyMod.Alt | KeyCode.DownArrow, KeyMod.WinCtrl | KeyCode.KEY_N] } } })); CommonEditorRegistry.registerEditorCommand(new SuggestCommand({ id: 'selectNextPageSuggestion', precondition: ContextKeyExpr.and(SuggestContext.Visible, SuggestContext.MultipleSuggestions), handler: c => c.selectNextPageSuggestion(), kbOpts: { weight: weight, kbExpr: EditorContextKeys.TextFocus, primary: KeyCode.PageDown, secondary: [KeyMod.Alt | KeyCode.PageDown] } })); CommonEditorRegistry.registerEditorCommand(new SuggestCommand({ id: 'selectPrevSuggestion', precondition: ContextKeyExpr.and(SuggestContext.Visible, SuggestContext.MultipleSuggestions), handler: c => c.selectPrevSuggestion(), kbOpts: { weight: weight, kbExpr: EditorContextKeys.TextFocus, primary: KeyCode.UpArrow, secondary: [KeyMod.Alt | KeyCode.UpArrow], mac: { primary: KeyCode.UpArrow, secondary: [KeyMod.Alt | KeyCode.UpArrow, KeyMod.WinCtrl | KeyCode.KEY_P] } } })); CommonEditorRegistry.registerEditorCommand(new SuggestCommand({ id: 'selectPrevPageSuggestion', precondition: ContextKeyExpr.and(SuggestContext.Visible, SuggestContext.MultipleSuggestions), handler: c => c.selectPrevPageSuggestion(), kbOpts: { weight: weight, kbExpr: EditorContextKeys.TextFocus, primary: KeyCode.PageUp, secondary: [KeyMod.Alt | KeyCode.PageUp] } })); CommonEditorRegistry.registerEditorCommand(new SuggestCommand({ id: 'toggleSuggestionDetails', precondition: SuggestContext.Visible, handler: x => x.toggleSuggestionDetails(), kbOpts: { weight: weight, kbExpr: EditorContextKeys.TextFocus, primary: KeyMod.CtrlCmd | KeyCode.Space, mac: { primary: KeyMod.WinCtrl | KeyCode.Space } } }));
{ "pile_set_name": "Github" }
using CoreWCF.Configuration; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using System; namespace CoreWCF.Channels { internal class HttpTransportServiceBuilder : ITransportServiceBuilder { private bool _configured = false; private DateTime _configuredTime = DateTime.MinValue; private object _lock = new object(); public void Configure(IApplicationBuilder app) { var logger = app.ApplicationServices.GetRequiredService<ILogger<HttpTransportServiceBuilder>>(); logger.LogDebug($"Configure called _configured:{_configured} _configuredTime:{_configuredTime}"); if (!_configured) { logger.LogDebug("!Configured"); lock (_lock) { if (!_configured) { logger.LogDebug("Still !Configured"); ConfigureCore(app); _configured = true; _configuredTime = DateTime.UtcNow; } } } } private void ConfigureCore(IApplicationBuilder app) { var logger = app.ApplicationServices.GetRequiredService<ILogger<HttpTransportServiceBuilder>>(); logger.LogDebug("Adding ServiceModelHttpMiddleware to app builder"); app.UseMiddleware<ServiceModelHttpMiddleware>(app); } } }
{ "pile_set_name": "Github" }
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/firehose/Firehose_EXPORTS.h> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace Firehose { namespace Model { /** * <p>Configures retry behavior in case Kinesis Data Firehose is unable to deliver * documents to Amazon ES.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/firehose-2015-08-04/ElasticsearchRetryOptions">AWS * API Reference</a></p> */ class AWS_FIREHOSE_API ElasticsearchRetryOptions { public: ElasticsearchRetryOptions(); ElasticsearchRetryOptions(Aws::Utils::Json::JsonView jsonValue); ElasticsearchRetryOptions& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>After an initial failure to deliver to Amazon ES, the total amount of time * during which Kinesis Data Firehose retries delivery (including the first * attempt). After this time has elapsed, the failed documents are written to * Amazon S3. Default value is 300 seconds (5 minutes). A value of 0 (zero) results * in no retries.</p> */ inline int GetDurationInSeconds() const{ return m_durationInSeconds; } /** * <p>After an initial failure to deliver to Amazon ES, the total amount of time * during which Kinesis Data Firehose retries delivery (including the first * attempt). After this time has elapsed, the failed documents are written to * Amazon S3. Default value is 300 seconds (5 minutes). A value of 0 (zero) results * in no retries.</p> */ inline bool DurationInSecondsHasBeenSet() const { return m_durationInSecondsHasBeenSet; } /** * <p>After an initial failure to deliver to Amazon ES, the total amount of time * during which Kinesis Data Firehose retries delivery (including the first * attempt). After this time has elapsed, the failed documents are written to * Amazon S3. Default value is 300 seconds (5 minutes). A value of 0 (zero) results * in no retries.</p> */ inline void SetDurationInSeconds(int value) { m_durationInSecondsHasBeenSet = true; m_durationInSeconds = value; } /** * <p>After an initial failure to deliver to Amazon ES, the total amount of time * during which Kinesis Data Firehose retries delivery (including the first * attempt). After this time has elapsed, the failed documents are written to * Amazon S3. Default value is 300 seconds (5 minutes). A value of 0 (zero) results * in no retries.</p> */ inline ElasticsearchRetryOptions& WithDurationInSeconds(int value) { SetDurationInSeconds(value); return *this;} private: int m_durationInSeconds; bool m_durationInSecondsHasBeenSet; }; } // namespace Model } // namespace Firehose } // namespace Aws
{ "pile_set_name": "Github" }