text
stringlengths
2
100k
meta
dict
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>comment</key> <string>By Jim Isaacs - jimisaacs.com</string> <key>name</key> <string>Dreamweaver</string> <key>settings</key> <array> <dict> <key>settings</key> <dict> <key>background</key> <string>#FFFFFF</string> <key>caret</key> <string>#000000</string> <key>foreground</key> <string>#000000</string> <key>invisibles</key> <string>#BFBFBF</string> <key>lineHighlight</key> <string>#00000012</string> <key>selection</key> <string>#5EA0FF</string> </dict> </dict> <dict> <key>name</key> <string>text</string> <key>scope</key> <string>text</string> <key>settings</key> <dict> <key>foreground</key> <string>#000000</string> </dict> </dict> <dict> <key>name</key> <string>constant numeric</string> <key>scope</key> <string>constant.numeric - source.css</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#EE000B</string> </dict> </dict> <dict> <key>name</key> <string>comment general</string> <key>scope</key> <string>comment</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#9A9A9A</string> </dict> </dict> <dict> <key>name</key> <string>html meta</string> <key>scope</key> <string>text.html meta.tag</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#00359E</string> </dict> </dict> <dict> <key>name</key> <string>html string</string> <key>scope</key> <string>text.html.basic meta.tag string.quoted - source</string> <key>settings</key> <dict> <key>foreground</key> <string>#001EFF</string> </dict> </dict> <dict> <key>name</key> <string>html contstant</string> <key>scope</key> <string>text.html.basic constant.character.entity.html</string> <key>settings</key> <dict> <key>fontStyle</key> <string>bold</string> <key>foreground</key> <string>#000000</string> </dict> </dict> <dict> <key>name</key> <string>html a tag</string> <key>scope</key> <string>text.html meta.tag.a - string</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#106800</string> </dict> </dict> <dict> <key>name</key> <string>html img tag</string> <key>scope</key> <string>text.html meta.tag.img - string</string> <key>settings</key> <dict> <key>foreground</key> <string>#6D232E</string> </dict> </dict> <dict> <key>name</key> <string>html form tag</string> <key>scope</key> <string>text.html meta.tag.form - string</string> <key>settings</key> <dict> <key>foreground</key> <string>#FF9700</string> </dict> </dict> <dict> <key>name</key> <string>html table</string> <key>scope</key> <string>text.html meta.tag.table - string</string> <key>settings</key> <dict> <key>foreground</key> <string>#009079</string> </dict> </dict> <dict> <key>name</key> <string>js embedded</string> <key>scope</key> <string>source.js.embedded.html punctuation.definition.tag - source.php, source.js.embedded.html entity.name.tag.script, source.js.embedded entity.other.attribute-name - source.js string</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#842B44</string> </dict> </dict> <dict> <key>name</key> <string>js comment</string> <key>scope</key> <string>source.js comment - source.php</string> <key>settings</key> <dict> <key>foreground</key> <string>#9A9A9A</string> </dict> </dict> <dict> <key>name</key> <string>js meta function</string> <key>scope</key> <string>source.js meta.function - source.php</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#000000</string> </dict> </dict> <dict> <key>name</key> <string>js instance / support.function</string> <key>scope</key> <string>source.js meta.class - source.php, source.js support.function - source.php</string> <key>settings</key> <dict> <key>foreground</key> <string>#24C696</string> </dict> </dict> <dict> <key>name</key> <string>js string</string> <key>scope</key> <string>source.js string - source.php, source.js keyword.operator</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#0035FF</string> </dict> </dict> <dict> <key>name</key> <string>js support</string> <key>scope</key> <string>source.js support.class</string> <key>settings</key> <dict> <key>foreground</key> <string>#7E00B7</string> </dict> </dict> <dict> <key>name</key> <string>js storage</string> <key>scope</key> <string>source.js storage</string> <key>settings</key> <dict> <key>fontStyle</key> <string>bold</string> <key>foreground</key> <string>#000000</string> </dict> </dict> <dict> <key>name</key> <string>js storage (not function) / bool / new / braces</string> <key>scope</key> <string>source.js storage - storage.type.function - source.php, source.js constant - source.php, source.js keyword - source.php, source.js variable.language, source.js meta.brace, source.js punctuation.definition.parameters.begin, source.js punctuation.definition.parameters.end</string> <key>settings</key> <dict> <key>fontStyle</key> <string>bold</string> <key>foreground</key> <string>#05208C</string> </dict> </dict> <dict> <key>name</key> <string>js regexp</string> <key>scope</key> <string>source.js string.regexp, source.js string.regexp constant</string> <key>settings</key> <dict> <key>foreground</key> <string>#106800</string> </dict> </dict> <dict> <key>name</key> <string>css embedded</string> <key>scope</key> <string>source.css.embedded.html punctuation.definition.tag, source.css.embedded.html entity.name.tag.style, source.css.embedded entity.other.attribute-name - meta.selector</string> <key>settings</key> <dict> <key>foreground</key> <string>#8D00B7</string> </dict> </dict> <dict> <key>name</key> <string>css @import</string> <key>scope</key> <string>source.css meta.at-rule.import.css</string> <key>settings</key> <dict> <key>fontStyle</key> <string>bold</string> <key>foreground</key> <string>#009C7F</string> </dict> </dict> <dict> <key>name</key> <string>css @important</string> <key>scope</key> <string>source.css keyword.other.important</string> <key>settings</key> <dict> <key>fontStyle</key> <string>bold</string> <key>foreground</key> <string>#EE000B</string> </dict> </dict> <dict> <key>name</key> <string>css @media</string> <key>scope</key> <string>source.css meta.at-rule.media</string> <key>settings</key> <dict> <key>fontStyle</key> <string>bold</string> <key>foreground</key> <string>#430303</string> </dict> </dict> <dict> <key>name</key> <string>css string</string> <key>scope</key> <string>source.css string</string> <key>settings</key> <dict> <key>foreground</key> <string>#106800</string> </dict> </dict> <dict> <key>name</key> <string>css selector/prop-list</string> <key>scope</key> <string>source.css meta.selector, source.css meta.property-list, source.css meta.at-rule</string> <key>settings</key> <dict> <key>foreground</key> <string>#DA29FF</string> </dict> </dict> <dict> <key>name</key> <string>css punctuation</string> <key>scope</key> <string>source.css punctuation.separator - source.php, source.css punctuation.terminator - source.php</string> <key>settings</key> <dict> <key>fontStyle</key> <string>bold</string> <key>foreground</key> <string>#DA29FF</string> </dict> </dict> <dict> <key>name</key> <string>css property name</string> <key>scope</key> <string>source.css meta.property-name</string> <key>settings</key> <dict> <key>foreground</key> <string>#05208C</string> </dict> </dict> <dict> <key>name</key> <string>css property value</string> <key>scope</key> <string>source.css meta.property-value</string> <key>settings</key> <dict> <key>foreground</key> <string>#0035FF</string> </dict> </dict> <dict> <key>name</key> <string>php begin/end block</string> <key>scope</key> <string>source.php punctuation.section.embedded.begin, source.php punctuation.section.embedded.end</string> <key>settings</key> <dict> <key>fontStyle</key> <string>bold</string> <key>foreground</key> <string>#EE000B</string> </dict> </dict> <dict> <key>name</key> <string>php</string> <key>scope</key> <string>source.php - punctuation.section</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#000000</string> </dict> </dict> <dict> <key>name</key> <string>php varaible</string> <key>scope</key> <string>source.php variable, source.php meta.function.arguments</string> <key>settings</key> <dict> <key>foreground</key> <string>#000000</string> </dict> </dict> <dict> <key>name</key> <string>php punctuation</string> <key>scope</key> <string>source.php punctuation - string - variable - meta.function</string> <key>settings</key> <dict> <key>foreground</key> <string>#05208C</string> </dict> </dict> <dict> <key>name</key> <string>php storage.type</string> <key>scope</key> <string>source.php storage.type</string> <key>settings</key> <dict> <key>foreground</key> <string>#24BF96</string> </dict> </dict> <dict> <key>name</key> <string>php keyword general / storage misc</string> <key>scope</key> <string>source.php keyword - comment, source.php storage.type.class, source.php storage.type.interface, source.php storage.modifier, source.php constant.language</string> <key>settings</key> <dict> <key>foreground</key> <string>#009714</string> </dict> </dict> <dict> <key>name</key> <string>php support / storage / operator</string> <key>scope</key> <string>source.php support , source.php storage, source.php keyword.operator, source.php storage.type.function</string> <key>settings</key> <dict> <key>foreground</key> <string>#0035FF</string> </dict> </dict> <dict> <key>name</key> <string>php varaible global</string> <key>scope</key> <string>source.php variable.other.global</string> <key>settings</key> <dict> <key>foreground</key> <string>#0092F2</string> </dict> </dict> <dict> <key>name</key> <string>php support constant</string> <key>scope</key> <string>source.php support.constant, source.php constant.language.php</string> <key>settings</key> <dict> <key>foreground</key> <string>#551D02</string> </dict> </dict> <dict> <key>name</key> <string>php string</string> <key>scope</key> <string>source.php string, source.php string keyword.operator</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#E20000</string> </dict> </dict> <dict> <key>name</key> <string>php string variable</string> <key>scope</key> <string>source.php string.quoted.double variable</string> <key>settings</key> <dict> <key>foreground</key> <string>#FF6200</string> </dict> </dict> <dict> <key>name</key> <string>php comment general</string> <key>scope</key> <string>source.php comment</string> <key>settings</key> <dict> <key>foreground</key> <string>#FF9404</string> </dict> </dict> <dict> <key>name</key> <string>Invalid</string> <key>scope</key> <string>invalid</string> <key>settings</key> <dict> <key>background</key> <string>#EFFF8A</string> <key>fontStyle</key> <string>bold</string> <key>foreground</key> <string>#EE000B</string> </dict> </dict> </array> <key>uuid</key> <string>4C43099A-C325-4F56-BACB-F332209207B0</string> </dict> </plist>
{ "pile_set_name": "Github" }
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: > when String.prototype.indexOf(searchString, position) is called first Call ToString, giving it the this value as its argument. Then Call ToString(searchString) and Call ToNumber(position) es5id: 15.5.4.7_A4_T2 description: > Override toString and valueOf functions, second toString throw exception includes: [$FAIL.js] ---*/ var __obj = {toString:function(){return "\u0041B";}} var __obj2 = {valueOf:function(){return {};},toString:function(){throw "intointeger";}} var __str = new String("ABB\u0041BABAB"); ////////////////////////////////////////////////////////////////////////////// //CHECK#1 with(__str){ try { var x = indexOf(__obj, __obj2); $FAIL('#1: "var x = indexOf(__obj, __obj2)" lead to throwing exception'); } catch (e) { if (e!=="intointeger") { $ERROR('#1.1: Exception === "intointeger". Actual: '+e); } } } // //////////////////////////////////////////////////////////////////////////////
{ "pile_set_name": "Github" }
using FreeBird.Infrastructure; using FreeBird.Infrastructure.Domain; using FreeBird.Infrastructure.Domain.Repositories; using FreeBird.Infrastructure.Domain.Uow; using FreeBird.Infrastructure.Exceptions; using FreeBird.Infrastructure.Linq; using FreeBird.Infrastructure.Utilities; using SimpleSSO.Application.Core; using SimpleSSO.Domain; using SimpleSSO.Domain.System; using SimpleSSO.DTO.System; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SimpleSSO.Application.System { public class UserService { private readonly IRepository<User> _userRepo; private readonly IRepository<Role> _roleRepo; private readonly IUnitOfWork _unitOfWork; private readonly ICurrentContext _currentContext; public UserService(IRepository<User> userRepo, IRepository<Role> roleRepo, IUnitOfWork unitOfWork, ICurrentContext currentContext) { _userRepo = userRepo; _roleRepo = roleRepo; _unitOfWork = unitOfWork; _currentContext = currentContext; } public void Add(UserDTO userParam) { Guard.ArgumentNotNull(userParam, "userParam"); if (_userRepo.Exists(u => u.Name == userParam.Name)) { throw new BusinessException("该用户名已存在,请另外选择一个。"); } User user = new User() { Name = userParam.Name, Password = userParam.Password, RealName = userParam.RealName, Mobile = userParam.Mobile, Email = userParam.Email, IsLocked = userParam.IsLocked }; user.Init(_currentContext.User?.Name); user.EncryptPassword(); _userRepo.Add(user); _unitOfWork.Commit(); } public void Update(UserDTO userParam) { Guard.ArgumentNotNull(userParam, "userParam"); User oldUser = _userRepo.Get(u => u.ID == userParam.ID); if (oldUser == null) { throw new BusinessException("不存在该用户。"); } oldUser.RealName = userParam.RealName; oldUser.Mobile = userParam.Mobile; oldUser.Email = userParam.Email; oldUser.IsLocked = userParam.IsLocked; oldUser.InitUpdate(_currentContext.User?.Name); var oldRoles = oldUser.Roles.ToList(); //新增 userParam.RoleIDs.Where(w => oldRoles.All(a => a.ID != w)).ToList().ForEach( a => { oldUser.Roles.Add(_roleRepo.Get(a)); }); //删除 oldRoles.Where(w => !userParam.RoleIDs.Contains(w.ID)).ToList().ForEach( a => { oldUser.Roles.Remove(a); }); if (!string.IsNullOrWhiteSpace(userParam.Password)) { oldUser.Password = userParam.Password; oldUser.EncryptPassword(); } _userRepo.Update(oldUser); _unitOfWork.Commit(); } public void ResetPassword(int userID, string password) { if (string.IsNullOrEmpty(password)) { throw new Exception("密码不能为空。"); } User user = _userRepo.Get(p => p.UserID == userID); user.Password = password; user.EncryptPassword(); _userRepo.Update(user); _unitOfWork.Commit(); } public void Delete(Guid id) { User user = _userRepo.Get(id); _userRepo.Delete(user); _unitOfWork.Commit(); } public void Delete(List<Guid> ids) { _userRepo.DeleteOnDemand(ids); } public User GetUserByName(string name) { return _userRepo.Get(x => x.Name == name); } public MsgResult<User> Login(string userName, string password) { User user = this.GetUserByName(userName); return Login(user, password); } public MsgResult<User> Login(int userID, string password) { User user = _userRepo.Get(t => t.UserID == userID); return Login(user, password); } private MsgResult<User> Login(User user,string password) { if (user == null) { return new MsgResult<User>(false, null, "用户不存在"); } if (user.PasswordEqual(password)) { if (user.IsLocked) { return new MsgResult<User>(false, null, "用户不存在"); } return new MsgResult<User>(user); } return new MsgResult<User>(false, null, "用户不存在"); } public IEnumerable<User> FindAll() { return _userRepo.GetAll(); } public IEnumerable<User> Query(UserDTO user, IPageParam pageParam) { Guard.ArgumentNotNull(user, "user"); Guard.ArgumentNotNull(pageParam, "pageParam"); var expression = ExpressionBuilder.True<User>(); expression = expression.AndIf(t => t.Name.Contains(user.Name), !string.IsNullOrEmpty(user.Name)); return _userRepo.Query(expression, t => t.CreatedOn, true, pageParam); } } }
{ "pile_set_name": "Github" }
第九章 后端环境搭建:web.py的使用 ======================================================================= 前面都是前端的一些内容,但是要想做出一个能用的东西,始终是不能脱离后端的。因此这一节主要介绍如何使用python的一个web框架webpy。我想读我这个教程的同学大多都是前端,对后端没有什么感觉。因此关于后端的介绍以能用为主,不涉及太多的后端的东西。 9.1 python是什么 ---------------------- 简单来说Python和JavaScript一样,是一个动态语言,运行在服务器端。语法类似于程序伪码,或者说类似于自然语言。过多的语法和关键字就不再介绍。只需要记住Python是用缩进来判断语法块的,不像js用大括号。 9.2 webpy是什么 ---------------------- 和Backbonejs是js的一个框架一样,webpy是python的一个简单的web开发的框架。可以通过简单的几行代码启动一个web服务(虽然只是输出helloworld ^_^)。用它可以简单的满足咱们的开发需求。 因为是基于Python的框架,因此需要先安装Python环境,具体怎么装就不细说了,到http://python.org/download/ 安装python2.7.6这个版本。 之后按照 `webpy <http://webpy.org/>`_ 官网的说明,通过命令安装webpy: :: pip install web.py 或者 easy_install web.py 注意:linux下非root用户需要sudo 9.3 来一个Helloworld ----------------------------- 安装好之后,直接把webpy网站上的那段代码,贴到的用编辑器打开的文件中,保存为server.py。webpy网站代码如下: .. code:: python import web urls = ( '/', 'index' ) app = web.application(urls, globals()) class index: def GET(self): return 'Hello, World!' if __name__ == "__main__": app.run() 然后在server.py的同目录下执行:: python server.py 之后命令行会输出:: http://0.0.0.0:8080/ 这个提示,现在你在浏览器访问 http://127.0.0.1:8080 ,就会看到熟悉的helloworld,是不是超级简单。 9.4 简单构建api接口 ---------------------------- 在上面代码的基础上,按照前面backboneModel的定义,我们需要一个todo这模型的对应的链接,这个链接应该返回json格式的数据。并且能够支持post、put、get、delete这四个请求。现在来看接口部分的代码: .. code:: python #添加todo相关的urls urls = ( '/', 'index', #返回首页 # 处理前端todo的请求,操作对应的todo '/todo/(\d+)/', 'todo', # 处理前端todo的整体请求,主要是获取所有的todo数据 '/todo/', 'todos', ) .. code:: python #添加接口的处理代码 class todo: def GET(self, todo_id=None): context = { "title": "下午3点,coding", "order": 0, "done": False, } return json.dumps(context) #处理整体的请求 class todos: def GET(self): result = [] result.append({ "title": "下午3点,coding", "order": 0, "done": False, }) return json.dumps(result) 添加完这部分代码之后,启动server.py。访问 http://localhost:8080/todo/ 就能看到数据了,这里只是实现了get方法,其他的方法在下一篇中介绍。 9.5 加入数据库sqlite ------------------------------- 关于数据存储部分,我们使用sqlite数据库。sqlite的好处就是不需要安装即可使用。这样可以省去在数据库安装方面的折腾。 sqlite的介绍就不多说了,感兴趣的同学想必已经在查sqlite相关的东西了。这里只是演示在webpy中如何操作sqlite。 具体依然看代码: .. code:: python #使用sqlite3操作数据库 import sqlite3 conn = sqlite3.connect('todos.db') #把todo改为这样: class todo: def GET(self, todo_id=None): cur = conn.cursor() cur.execute(sql_query + ' where id=?', (todo_id, )) todo = cur.fetchone() cur.close() # 先用这种比较傻的方式 context = { "id": todo[0], "title": todo[1], "order": todo[2], "done": todo[3], } return json.dumps(context) class todos: def GET(self): result = [] cur = conn.cursor() cur.execute(sql_query) todos = cur.fetchall() cur.close() for todo in todos: result.append({ "id": todo[0], "title": todo[1], "order": todo[2], "done": todo[3], }) return json.dumps(result) 完整代码可以在 `code` 文件夹找到。使用时,先运行init_sqlite.py这个文件,会帮你创建一个sqlite的数据库,并且插入一条数据,然后运行server.py就可以在浏览器访问 http://localhost:8080/todo/ 或者http://localhost:8080/todo/1/ 看到输出数据了。 9.6 总结 ------------------------- 这里打算用webpy+sqlite来完成后台主要是想到这个东西比Django+Mysql那一套搭建起来比较容易。有兴趣看Django后台搭建的可以看这篇文章: `django开发环境搭建及使用 <http://www.the5fire.com/10-django-dev-env.html>`_ 。 这里没有使用webpy自带的db模块进行数据的操作,主要是文档和案例都不全,并且源码看起来挺绕。用Python自带的模块显然操作起来有点笨拙,之后会对这个数据操作部分进行简单的封装。 **导航** * 上一章 08 `实战演练:todos分析(三)总结 <08-backbonejs-todos-3.rst>`_ * 下一章 10 `实战演练:扩展todos到Server端(backbonejs+webpy) <10-expand-todos-with-server.rst>`_
{ "pile_set_name": "Github" }
{ "name": "docker-registry-client", "version": "3.2.10", "description": "node.js client for the Docker Registry API", "main": "./lib/index.js", "dependencies": { "assert-plus": "^0.1.5", "base64url": "1.x >=1.0.4", "bunyan": "1.x >=1.3.3", "jws": "3.1.0", "jwk-to-pem": "1.2.0", "restify-clients": "^1.4.0", "restify-errors": "^3.0.0", "strsplit": "1.x", "tough-cookie": "2.0.x", "vasync": "1.x >=1.6.1", "verror": "1.x >=1.6.0", "www-authenticate": "0.6.x >=0.6.2" }, "engines": { "node": ">=0.10" }, "license": "MPL-2.0" }
{ "pile_set_name": "Github" }
/***************************************************************** | | Platinum - AV Media Browser (Media Server Control Point) | | Copyright (c) 2004-2010, Plutinosoft, LLC. | All rights reserved. | http://www.plutinosoft.com | | This program is free software; you can redistribute it and/or | modify it under the terms of the GNU General Public License | as published by the Free Software Foundation; either version 2 | of the License, or (at your option) any later version. | | OEMs, ISVs, VARs and other distributors that combine and | distribute commercially licensed software with Platinum software | and do not wish to distribute the source code for the commercially | licensed software under version 2, or (at your option) any later | version, of the GNU General Public License (the "GPL") must enter | into a commercial license agreement with Plutinosoft, LLC. | [email protected] | | 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; see the file LICENSE.txt. If not, write to | the Free Software Foundation, Inc., | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | http://www.gnu.org/licenses/gpl-2.0.html | ****************************************************************/ /*---------------------------------------------------------------------- | includes +---------------------------------------------------------------------*/ #include "Neptune.h" #include "PltMediaBrowser.h" #include "PltDidl.h" NPT_SET_LOCAL_LOGGER("platinum.media.server.browser") /*---------------------------------------------------------------------- | PLT_MediaBrowser::PLT_MediaBrowser +---------------------------------------------------------------------*/ PLT_MediaBrowser::PLT_MediaBrowser(PLT_CtrlPointReference& ctrl_point, PLT_MediaBrowserDelegate* delegate /* = NULL */) : m_CtrlPoint(ctrl_point), m_Delegate(delegate) { m_CtrlPoint->AddListener(this); } /*---------------------------------------------------------------------- | PLT_MediaBrowser::~PLT_MediaBrowser +---------------------------------------------------------------------*/ PLT_MediaBrowser::~PLT_MediaBrowser() { m_CtrlPoint->RemoveListener(this); } /*---------------------------------------------------------------------- | PLT_MediaBrowser::OnDeviceAdded +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::OnDeviceAdded(PLT_DeviceDataReference& device) { // verify the device implements the function we need PLT_Service* serviceCDS; PLT_Service* serviceCMR; NPT_String type; if (!device->GetType().StartsWith("urn:schemas-upnp-org:device:MediaServer")) return NPT_FAILURE; type = "urn:schemas-upnp-org:service:ContentDirectory:*"; if (NPT_FAILED(device->FindServiceByType(type, serviceCDS))) { NPT_LOG_WARNING_2("Service %s not found in device \"%s\"", type.GetChars(), device->GetFriendlyName().GetChars()); return NPT_FAILURE; } else { // in case it's a newer upnp implementation, force to 1 serviceCDS->ForceVersion(1); } type = "urn:schemas-upnp-org:service:ConnectionManager:*"; if (NPT_FAILED(device->FindServiceByType(type, serviceCMR))) { NPT_LOG_WARNING_2("Service %s not found in device \"%s\"", type.GetChars(), device->GetFriendlyName().GetChars()); return NPT_FAILURE; } else { // in case it's a newer upnp implementation, force to 1 serviceCMR->ForceVersion(1); } { NPT_AutoLock lock(m_MediaServers); PLT_DeviceDataReference data; NPT_String uuid = device->GetUUID(); // is it a new device? if (NPT_SUCCEEDED(NPT_ContainerFind(m_MediaServers, PLT_DeviceDataFinder(uuid), data))) { NPT_LOG_WARNING_1("Device (%s) is already in our list!", (const char*)uuid); return NPT_FAILURE; } NPT_LOG_FINE_1("Device Found: %s", (const char*)*device); m_MediaServers.Add(device); } if (m_Delegate && m_Delegate->OnMSAdded(device)) { m_CtrlPoint->Subscribe(serviceCDS); m_CtrlPoint->Subscribe(serviceCMR); } return NPT_SUCCESS; } /*---------------------------------------------------------------------- | PLT_MediaBrowser::OnDeviceRemoved +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::OnDeviceRemoved(PLT_DeviceDataReference& device) { if (!device->GetType().StartsWith("urn:schemas-upnp-org:device:MediaServer")) return NPT_FAILURE; { NPT_AutoLock lock(m_MediaServers); // only release if we have kept it around PLT_DeviceDataReference data; NPT_String uuid = device->GetUUID(); // Have we seen that device? if (NPT_FAILED(NPT_ContainerFind(m_MediaServers, PLT_DeviceDataFinder(uuid), data))) { NPT_LOG_WARNING_1("Device (%s) not found in our list!", (const char*)uuid); return NPT_FAILURE; } NPT_LOG_FINE_1("Device Removed: %s", (const char*)*device); m_MediaServers.Remove(device); } if (m_Delegate) { m_Delegate->OnMSRemoved(device); } return NPT_SUCCESS; } /*---------------------------------------------------------------------- | PLT_MediaBrowser::FindServer +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::FindServer(const char* uuid, PLT_DeviceDataReference& device) { NPT_AutoLock lock(m_MediaServers); if (NPT_FAILED(NPT_ContainerFind(m_MediaServers, PLT_DeviceDataFinder(uuid), device))) { NPT_LOG_FINE_1("Device (%s) not found in our list of servers", (const char*)uuid); return NPT_FAILURE; } return NPT_SUCCESS; } /*---------------------------------------------------------------------- | PLT_MediaBrowser::Search +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::Search(PLT_DeviceDataReference& device, const char* container_id, const char* search_criteria, NPT_UInt32 start_index, NPT_UInt32 count, const char* filter, void* userdata) { // verify device still in our list PLT_DeviceDataReference device_data; NPT_CHECK_WARNING(FindServer(device->GetUUID(), device_data)); // create action PLT_ActionReference action; NPT_CHECK_SEVERE(m_CtrlPoint->CreateAction( device, "urn:schemas-upnp-org:service:ContentDirectory:1", "Search", action)); // Set the container id PLT_Arguments args; if (NPT_FAILED(action->SetArgumentValue("ContainerID", container_id))) { return NPT_ERROR_INVALID_PARAMETERS; } // set the Search Criteria if (NPT_FAILED(action->SetArgumentValue("SearchCriteria", search_criteria))) { return NPT_ERROR_INVALID_PARAMETERS; } // set the Filter if (NPT_FAILED(action->SetArgumentValue("Filter", filter))) { return NPT_ERROR_INVALID_PARAMETERS; } // set the Starting Index if (NPT_FAILED(action->SetArgumentValue("StartingIndex", NPT_String::FromInteger(start_index)))) { return NPT_ERROR_INVALID_PARAMETERS; } // set the Requested Count if (NPT_FAILED(action->SetArgumentValue("RequestedCount", NPT_String::FromInteger(count)))) { return NPT_ERROR_INVALID_PARAMETERS; } // set the Requested Count if (NPT_FAILED(action->SetArgumentValue("SortCriteria", ""))) { return NPT_ERROR_INVALID_PARAMETERS; } // invoke the action if (NPT_FAILED(m_CtrlPoint->InvokeAction(action, userdata))) { return NPT_ERROR_INVALID_PARAMETERS; } return NPT_SUCCESS; } /*---------------------------------------------------------------------- | PLT_MediaBrowser::Browse +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::Browse(PLT_DeviceDataReference& device, const char* obj_id, NPT_UInt32 start_index, NPT_UInt32 count, bool browse_metadata, const char* filter, const char* sort_criteria, void* userdata) { // verify device still in our list PLT_DeviceDataReference device_data; NPT_CHECK_WARNING(FindServer(device->GetUUID(), device_data)); // create action PLT_ActionReference action; NPT_CHECK_SEVERE(m_CtrlPoint->CreateAction( device, "urn:schemas-upnp-org:service:ContentDirectory:1", "Browse", action)); // Set the object id PLT_Arguments args; if (NPT_FAILED(action->SetArgumentValue("ObjectID", obj_id))) { return NPT_ERROR_INVALID_PARAMETERS; } // set the browse_flag if (NPT_FAILED(action->SetArgumentValue("BrowseFlag", browse_metadata?"BrowseMetadata":"BrowseDirectChildren"))) { return NPT_ERROR_INVALID_PARAMETERS; } // set the Filter if (NPT_FAILED(action->SetArgumentValue("Filter", filter))) { return NPT_ERROR_INVALID_PARAMETERS; } // set the Starting Index if (NPT_FAILED(action->SetArgumentValue("StartingIndex", NPT_String::FromInteger(start_index)))) { return NPT_ERROR_INVALID_PARAMETERS; } // set the Requested Count if (NPT_FAILED(action->SetArgumentValue("RequestedCount", NPT_String::FromInteger(count)))) { return NPT_ERROR_INVALID_PARAMETERS; } // set the Requested Count if (NPT_FAILED(action->SetArgumentValue("SortCriteria", sort_criteria))) { return NPT_ERROR_INVALID_PARAMETERS; } // invoke the action if (NPT_FAILED(m_CtrlPoint->InvokeAction(action, userdata))) { return NPT_ERROR_INVALID_PARAMETERS; } return NPT_SUCCESS; } /*---------------------------------------------------------------------- | PLT_MediaBrowser::GetSearchCapabilities +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::GetSearchCapabilities(PLT_DeviceDataReference& device, void* userdata) { // verify device still in our list PLT_DeviceDataReference device_data; NPT_CHECK_WARNING(FindServer(device->GetUUID(), device_data)); // create action PLT_ActionReference action; NPT_CHECK_SEVERE(m_CtrlPoint->CreateAction( device, "urn:schemas-upnp-org:service:ContentDirectory:1", "GetSearchCapabilities", action)); // invoke the action if (NPT_FAILED(m_CtrlPoint->InvokeAction(action, userdata))) { return NPT_ERROR_INVALID_PARAMETERS; } return NPT_SUCCESS; } /*---------------------------------------------------------------------- | PLT_MediaBrowser::GetSortCapabilities +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::GetSortCapabilities(PLT_DeviceDataReference& device, void* userdata) { // verify device still in our list PLT_DeviceDataReference device_data; NPT_CHECK_WARNING(FindServer(device->GetUUID(), device_data)); // create action PLT_ActionReference action; NPT_CHECK_SEVERE(m_CtrlPoint->CreateAction( device, "urn:schemas-upnp-org:service:ContentDirectory:1", "GetSortCapabilities", action)); // invoke the action if (NPT_FAILED(m_CtrlPoint->InvokeAction(action, userdata))) { return NPT_ERROR_INVALID_PARAMETERS; } return NPT_SUCCESS; } /*---------------------------------------------------------------------- | PLT_MediaBrowser::OnActionResponse +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::OnActionResponse(NPT_Result res, PLT_ActionReference& action, void* userdata) { // look for device in our list first PLT_DeviceDataReference device; NPT_String uuid = action->GetActionDesc().GetService()->GetDevice()->GetUUID(); if (NPT_FAILED(FindServer(uuid, device))) res = NPT_FAILURE; NPT_String actionName = action->GetActionDesc().GetName(); if (actionName.Compare("Browse", true) == 0) { return OnBrowseResponse(res, device, action, userdata); } else if (actionName.Compare("Search", true) == 0) { return OnSearchResponse(res, device, action, userdata); } else if (actionName.Compare("GetSearchCapabilities", true) == 0) { return OnGetSearchCapabilitiesResponse(res, device, action, userdata); } else if (actionName.Compare("GetSortCapabilities", true) == 0) { return OnGetSortCapabilitiesResponse(res, device, action, userdata); } return NPT_SUCCESS; } /*---------------------------------------------------------------------- | PLT_MediaBrowser::OnBrowseResponse +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::OnBrowseResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata) { NPT_String value; PLT_BrowseInfo info; NPT_String unescaped; if (!m_Delegate) return NPT_SUCCESS; if (NPT_FAILED(res) || action->GetErrorCode() != 0) { goto bad_action; } if (NPT_FAILED(action->GetArgumentValue("ObjectID", info.object_id))) { goto bad_action; } if (NPT_FAILED(action->GetArgumentValue("UpdateID", value)) || value.GetLength() == 0 || NPT_FAILED(value.ToInteger(info.uid))) { goto bad_action; } if (NPT_FAILED(action->GetArgumentValue("NumberReturned", value)) || value.GetLength() == 0 || NPT_FAILED(value.ToInteger(info.nr))) { goto bad_action; } if (NPT_FAILED(action->GetArgumentValue("TotalMatches", value)) || value.GetLength() == 0 || NPT_FAILED(value.ToInteger(info.tm))) { goto bad_action; } if (NPT_FAILED(action->GetArgumentValue("Result", value)) || value.GetLength() == 0) { goto bad_action; } if (NPT_FAILED(PLT_Didl::FromDidl(value, info.items))) { goto bad_action; } m_Delegate->OnBrowseResult(NPT_SUCCESS, device, &info, userdata); return NPT_SUCCESS; bad_action: m_Delegate->OnBrowseResult(NPT_FAILURE, device, NULL, userdata); return NPT_FAILURE; } /*---------------------------------------------------------------------- | PLT_MediaBrowser::OnSearchResponse +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::OnSearchResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata) { NPT_String value; PLT_BrowseInfo info; NPT_String unescaped; if (!m_Delegate) return NPT_SUCCESS; if (NPT_FAILED(res) || action->GetErrorCode() != 0) { goto bad_action; } if (NPT_FAILED(action->GetArgumentValue("ContainerId", info.object_id))) { goto bad_action; } if (NPT_FAILED(action->GetArgumentValue("UpdateID", value)) || value.GetLength() == 0 || NPT_FAILED(value.ToInteger(info.uid))) { goto bad_action; } if (NPT_FAILED(action->GetArgumentValue("NumberReturned", value)) || value.GetLength() == 0 || NPT_FAILED(value.ToInteger(info.nr))) { goto bad_action; } if (NPT_FAILED(action->GetArgumentValue("TotalMatches", value)) || value.GetLength() == 0 || NPT_FAILED(value.ToInteger(info.tm))) { goto bad_action; } if (NPT_FAILED(action->GetArgumentValue("Result", value)) || value.GetLength() == 0) { goto bad_action; } if (NPT_FAILED(PLT_Didl::FromDidl(value, info.items))) { goto bad_action; } m_Delegate->OnSearchResult(NPT_SUCCESS, device, &info, userdata); return NPT_SUCCESS; bad_action: m_Delegate->OnSearchResult(NPT_FAILURE, device, NULL, userdata); return NPT_FAILURE; } /*---------------------------------------------------------------------- | PLT_MediaBrowser::OnGetSearchCapabilitiesResponse +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::OnGetSearchCapabilitiesResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata) { NPT_String value; if (!m_Delegate) return NPT_SUCCESS; if (NPT_FAILED(res) || action->GetErrorCode() != 0) { goto bad_action; } if (NPT_FAILED(action->GetArgumentValue("SearchCaps", value))) { goto bad_action; } m_Delegate->OnGetSearchCapabilitiesResult(NPT_SUCCESS, device, value, userdata); return NPT_SUCCESS; bad_action: m_Delegate->OnGetSearchCapabilitiesResult(NPT_FAILURE, device, value, userdata); return NPT_FAILURE; } /*---------------------------------------------------------------------- | PLT_MediaBrowser::OnGetSearchCapabilitiesResponse +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::OnGetSortCapabilitiesResponse(NPT_Result res, PLT_DeviceDataReference& device, PLT_ActionReference& action, void* userdata) { NPT_String value; if (!m_Delegate) return NPT_SUCCESS; if (NPT_FAILED(res) || action->GetErrorCode() != 0) { goto bad_action; } if (NPT_FAILED(action->GetArgumentValue("SortCaps", value))) { goto bad_action; } m_Delegate->OnGetSortCapabilitiesResult(NPT_SUCCESS, device, value, userdata); return NPT_SUCCESS; bad_action: m_Delegate->OnGetSortCapabilitiesResult(NPT_FAILURE, device, value, userdata); return NPT_FAILURE; } /*---------------------------------------------------------------------- | PLT_MediaBrowser::OnEventNotify +---------------------------------------------------------------------*/ NPT_Result PLT_MediaBrowser::OnEventNotify(PLT_Service* service, NPT_List<PLT_StateVariable*>* vars) { if (!service->GetDevice()->GetType().StartsWith("urn:schemas-upnp-org:device:MediaServer")) return NPT_FAILURE; if (!m_Delegate) return NPT_SUCCESS; /* make sure device associated to service is still around */ PLT_DeviceDataReference data; NPT_CHECK_WARNING(FindServer(service->GetDevice()->GetUUID(), data)); m_Delegate->OnMSStateVariablesChanged(service, vars); return NPT_SUCCESS; }
{ "pile_set_name": "Github" }
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package InternalClass { import InternalClass.*; // Commenting out the import statement as this is not allowed by the compiler now // import Definitions.Classes.InternalClass; // As this is a dynamic class, it will not be seen by the testcase, hence // creating a wrapper function for this and changing the name for this file. // DynExtInternalClass extends DynExtInternalClassInner dynamic class DynExtInternalClassInner extends InternalClass { // ************************************ // access default method of parent // from default method of sub class // ************************************ function subGetArray() : Array { return this.getArray(); } function subSetArray(a:Array) { this.setArray(a); } // ************************************ // access default method of parent // from public method of sub class // ************************************ public function pubSubGetArray() : Array { return this.getArray(); } public function pubSubSetArray(a:Array) { this.setArray(a); } // this is needed so that the test cases can access this from // outside the class. This way the test case itself preserved public function testSubGetSetArray(a:Array) : Array { this.subSetArray(a); return this.subGetArray(); } // ************************************ // access default method of parent // from private method of sub class // ************************************ private function privSubGetArray() : Array { return this.getArray(); } private function privSubSetArray(a:Array) { this.setArray(a); } // function to test above from test scripts public function testPrivSubArray(a:Array) : Array { this.privSubSetArray(a); return this.privSubGetArray(); } // ************************************ // access default method of parent // from final method of sub class // ************************************ final function finGetArray() : Array { return this.getArray(); } final function finSetArray(a:Array) { this.setArray(a); } // this is needed so that the test cases can access this from // outside the class. This way the test case itself preserved public function testFinSubArray(a:Array) : Array { this.subSetArray(a); return this.subGetArray(); } // ************************************ // access default method of parent // from static method of sub class // ************************************ static function statGetArray() : Array { return getArray(); } static function statSetArray(a:Array) { setArray(a); } // this is needed so that the test cases can access this from // outside the class. This way the test case itself preserved public function testStatSubArray(a:Array) : Array { statSetArray(a); return statGetArray(); } // ************************************ // access default method of parent // from public final method of sub class // ************************************ public final function pubFinSubGetArray() : Array { return this.getArray(); } final public function pubFinSubSetArray(a:Array) { this.setArray(a); } // ************************************ // access default method of parent // from private final method of sub class // ************************************ private final function privFinSubGetArray() : Array { return this.getArray(); } final private function privFinSubSetArray(a:Array) { this.setArray(a); } public function testPrivFinSubArray(a:Array):Array { this.privFinSubSetArray(a); return this.privFinSubGetArray(); } // ************************************ // access default method of parent // from virtual method of sub class // ************************************ virtual function virtSubGetArray() : Array { return this.getArray(); } virtual function virtSubSetArray(a:Array) { this.setArray(a); } public function testVirtSubArray(a:Array) : Array { this.virtSubSetArray(a); return this.virtSubGetArray(); } // ************************************ // access default method of parent // from public virtual method of sub class // ************************************ virtual public function pubVirtSubGetArray() : Array { return this.getArray(); } public virtual function pubVirtSubSetArray(a:Array) { this.setArray(a); } // ************************************ // access default method of parent // from private virtual method of sub class // ************************************ virtual private function privVirtSubGetArray() : Array { return this.getArray(); } private virtual function privVirtSubSetArray(a:Array) { this.setArray(a); } public function testPrivVirtSubArray(a:Array) : Array { this.privVirtSubSetArray(a); return this.privVirtSubGetArray(); } // *************************************** // access default property from // default method of sub class // *************************************** function subGetDPArray() : Array { return array; } function subSetDPArray(a:Array) { array = a; } // this is needed so that the test cases can access this from // outside the class. This way the test case itself preserved public function testSubGetSetDPArray(a:Array) : Array { this.subSetDPArray(a); return this.subGetDPArray(); } // *************************************** // access default property from // public method of sub class // *************************************** public function pubSubGetDPArray() : Array { return this.array; } public function pubSubSetDPArray(a:Array) { this.array = a; } // *************************************** // access default property from // private method of sub class // *************************************** private function privSubGetDPArray() : Array { return this.array; } private function privSubSetDPArray(a:Array) { this.array = a; } public function testPrivSubDPArray(a:Array) : Array { this.privSubSetDPArray(a); return this.privSubGetDPArray(); } // *************************************** // access default property from // final method of sub class // *************************************** final function finSubGetDPArray() : Array { return this.array; } final function finSubSetDPArray(a:Array) { this.array = a; } public function testFinSubDPArray(a:Array) : Array { this.finSubSetDPArray(a); return this.finSubGetDPArray(); } // *************************************** // access default property from // virtual method of sub class // *************************************** virtual function virtSubGetDPArray() : Array { return array; } virtual function virtSubSetDPArray(a:Array) { array = a; } public function testVirtSubDPArray(a:Array) : Array { this.virtSubSetDPArray(a); return this.virtSubGetDPArray(); } // *************************************** // access default property from // public virtual method of sub class // *************************************** public virtual function pubVirtSubGetDPArray() : Array { return this.array; } virtual public function pubVirtSubSetDPArray(a:Array) { this.array = a; } // *************************************** // access default property from // private final method of sub class // *************************************** private final function privFinSubGetDPArray() : Array { return this.array; } final private function privFinSubSetDPArray(a:Array) { this.array = a; } public function testPrivFinSubDPArray(a:Array):Array { this.privFinSubSetDPArray(a); return this.privFinSubGetDPArray(); } // *************************************** // access default property from // private virtual method of sub class // *************************************** private virtual function privVirtSubGetDPArray() : Array { return this.array; } virtual private function privVirtSubSetDPArray(a:Array) { this.array = a; } public function testPrivVirtSubDPArray(a:Array):Array { this.privVirtSubSetDPArray(a); return this.privVirtSubGetDPArray(); } // *************************************** // access default property from // public final method of sub class // *************************************** public final function pubFinSubGetDPArray() : Array { return this.array; } final public function pubFinSubSetDPArray(a:Array) { this.array = a; } } // PUBLIC wrapper function for the dynamic class to be accessed; // otherwise it will give the error: // ReferenceError: DynExtInternalClass is not defined // at global$init() public class DynExtInternalClass extends DynExtInternalClassInner {} }
{ "pile_set_name": "Github" }
package com.cyl.musiclake.ui.music.mv import com.cyl.musicapi.netease.* import com.cyl.musiclake.api.music.baidu.BaiduApiServiceImpl import com.cyl.musiclake.api.music.netease.NeteaseApiServiceImpl import com.cyl.musiclake.bean.MvInfoBean import com.cyl.musiclake.api.net.ApiManager import com.cyl.musiclake.api.net.RequestCallBack import com.cyl.musiclake.bean.VideoInfoBean import io.reactivex.Observable /** * Des : * Author : master. * Date : 2018/7/8 . */ class VideoLoadModel { /** * 加载mv Url */ fun loadMvUrl(type: Int, mvid: String?, result: RequestCallBack<String>?) { val observable = mvid?.let { NeteaseApiServiceImpl.getVideoUrlInfo(type, mvid) } ?: return ApiManager.request(observable, result) } /** * 加载mv详情 */ fun loadMvDetail(mvid: String?, type: Int, result: RequestCallBack<VideoInfoBean>?) { val observable = if (type == 2) { mvid?.let { NeteaseApiServiceImpl.getMvDetailInfo(it) } } else { mvid?.let { NeteaseApiServiceImpl.getVideoDetailInfo(it) } } ApiManager.request(observable, result) } /** * * 加载最新mv */ fun loadRecentMv(limit: Int = 30, result: RequestCallBack<MvInfo>?) { val observable = NeteaseApiServiceImpl.getNewestMv(limit) ApiManager.request(observable, result) } /** * * 加载排行榜mv */ fun loadMv(offset: Int, result: RequestCallBack<MvInfo>?) { val observable = NeteaseApiServiceImpl.getTopMv(50, offset) ApiManager.request(observable, result) } /** * * 加载推荐mv */ fun loadPersonalizedMv(result: RequestCallBack<MvInfo>?) { val observable = NeteaseApiServiceImpl.personalizedMv() ApiManager.request(observable, result) } /** * 获取相似mv */ fun loadSimilarMv(mvid: String?, type: Int, result: RequestCallBack<MutableList<VideoInfoBean>>?) { val observable = if (type == 2) { mvid?.let { NeteaseApiServiceImpl.getSimilarMv(it) } } else { mvid?.let { NeteaseApiServiceImpl.getRelatedVideoList(it) } } observable?.let { ApiManager.request(it, result) } } /** *获取mv数据 */ fun loadMvComment(mvid: String?, type: String, offset: Int = 0, result: RequestCallBack<MvComment>?) { val observable = mvid?.let { NeteaseApiServiceImpl.getMvComment(it, type, offset) } ?: return ApiManager.request(observable, result) } /** *搜索mv数据 */ fun searchMv(key: String, offset: Int, result: RequestCallBack<SearchInfo>?) { val observable = NeteaseApiServiceImpl.searchMoreInfo(key, 30, offset, 1004) ApiManager.request(observable, result) } fun loadBaiduMv(songId: String?, result: RequestCallBack<MvInfoBean>?) { val observable = BaiduApiServiceImpl.getMvInfo(songId) ApiManager.request(observable, result) } }
{ "pile_set_name": "Github" }
// #NoMT #CompilerOptions // --codepage 0 // It does not mean much to me... //<Expects status="success"></Expects> #light let x = "a" let y = 'a'.ToString(); (if x = y then 0 else 1) |> exit
{ "pile_set_name": "Github" }
<!-- desktop --> <div fxHide.lt-md> <button mat-button data-cy="projectSelectMenuButton" class="space__button_hover_primary" [matMenuTriggerFor]="menu" > <div fxLayout="row" fxLayoutAlign="start center"> <div class="mat-button__text">Projects</div> <mat-icon class="space__toolbar-icon">expand_more</mat-icon> </div> </button> <mat-menu xPosition="before" yPosition="below" #menu="matMenu"> <div class="menu"> <div class="menu__options"> <div class="menu__options-group"> <div class="menu__options-title">Projects</div> <button mat-menu-item *ngFor="let projectId of (projectsIds$ | async)" data-cy="projectSelectMenuProjectItemButton" [routerLink]="['/project', projectId, 'mode', 'prod', 'blockml']" > &nbsp;&nbsp;{{ projectId | capitalize }} </button> <button mat-menu-item (click)="openNewProjectDialog()" data-cy="projectSelectMenuNewProjectButton" > <mat-icon>add</mat-icon>New project</button > </div> </div> </div> </mat-menu> </div> <!-- mobile --> <div fxHide.gt-sm> <mat-accordion> <mat-expansion-panel> <mat-expansion-panel-header> <mat-panel-title> Projects </mat-panel-title> <mat-panel-description> {{ layoutProjectId$ | async | capitalize }} </mat-panel-description> </mat-expansion-panel-header> <button mat-menu-item *ngFor="let projectId of (projectsIds$ | async)" data-cy="projectSelectMenuProjectItemButtonMobile" [routerLink]="['/project', projectId, 'mode', 'prod', 'blockml']" > &nbsp;&nbsp;{{ projectId | capitalize }} </button> <button mat-menu-item (click)="openNewProjectDialog()" data-cy="projectSelectMenuNewProjectButtonMobile" > <mat-icon>add</mat-icon>New project</button > </mat-expansion-panel> </mat-accordion> </div>
{ "pile_set_name": "Github" }
package simplelru // LRUCache is the interface for simple LRU cache. type LRUCache interface { // Adds a value to the cache, returns true if an eviction occurred and // updates the "recently used"-ness of the key. Add(key, value interface{}) bool // Returns key's value from the cache and // updates the "recently used"-ness of the key. #value, isFound Get(key interface{}) (value interface{}, ok bool) // Check if a key exsists in cache without updating the recent-ness. Contains(key interface{}) (ok bool) // Returns key's value without updating the "recently used"-ness of the key. Peek(key interface{}) (value interface{}, ok bool) // Removes a key from the cache. Remove(key interface{}) bool // Removes the oldest entry from cache. RemoveOldest() (interface{}, interface{}, bool) // Returns the oldest entry from the cache. #key, value, isFound GetOldest() (interface{}, interface{}, bool) // Returns a slice of the keys in the cache, from oldest to newest. Keys() []interface{} // Returns the number of items in the cache. Len() int // Clear all cache entries Purge() }
{ "pile_set_name": "Github" }
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "fm", "em" ], "DAY": [ "s\u00f6ndag", "m\u00e5ndag", "tisdag", "onsdag", "torsdag", "fredag", "l\u00f6rdag" ], "ERANAMES": [ "f\u00f6re Kristus", "efter Kristus" ], "ERAS": [ "f.Kr.", "e.Kr." ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december" ], "SHORTDAY": [ "s\u00f6n", "m\u00e5n", "tis", "ons", "tors", "fre", "l\u00f6r" ], "SHORTMONTH": [ "jan.", "feb.", "mars", "apr.", "maj", "juni", "juli", "aug.", "sep.", "okt.", "nov.", "dec." ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "EEEE d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y HH:mm:ss", "mediumDate": "d MMM y", "mediumTime": "HH:mm:ss", "short": "y-MM-dd HH:mm", "shortDate": "y-MM-dd", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "kr", "DECIMAL_SEP": ",", "GROUP_SEP": "\u00a0", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "sv-se", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
{ "pile_set_name": "Github" }
<?php namespace FedEx\ShipService\ComplexType; use FedEx\AbstractComplexType; /** * CustomerImageUsage * * @author Jeremy Dunn <[email protected]> * @package PHP FedEx API wrapper * @subpackage Ship Service * * @property \FedEx\ShipService\SimpleType\CustomerImageUsageType|string $Type * @property \FedEx\ShipService\SimpleType\ImageId|string $Id */ class CustomerImageUsage extends AbstractComplexType { /** * Name of this complex type * * @var string */ protected $name = 'CustomerImageUsage'; /** * Set Type * * @param \FedEx\ShipService\SimpleType\CustomerImageUsageType|string $type * @return $this */ public function setType($type) { $this->values['Type'] = $type; return $this; } /** * Set Id * * @param \FedEx\ShipService\SimpleType\ImageId|string $id * @return $this */ public function setId($id) { $this->values['Id'] = $id; return $this; } }
{ "pile_set_name": "Github" }
// Copyright 2016 The etcd Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package clientv3 import ( "context" "crypto/tls" "errors" "fmt" "net" "net/url" "os" "strconv" "strings" "sync" "time" "github.com/google/uuid" "go.etcd.io/etcd/clientv3/balancer" "go.etcd.io/etcd/clientv3/balancer/picker" "go.etcd.io/etcd/clientv3/balancer/resolver/endpoint" "go.etcd.io/etcd/etcdserver/api/v3rpc/rpctypes" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) var ( ErrNoAvailableEndpoints = errors.New("etcdclient: no available endpoints") ErrOldCluster = errors.New("etcdclient: old cluster version") roundRobinBalancerName = fmt.Sprintf("etcd-%s", picker.RoundrobinBalanced.String()) ) func init() { lg := zap.NewNop() if os.Getenv("ETCD_CLIENT_DEBUG") != "" { var err error lg, err = zap.NewProductionConfig().Build() // info level logging if err != nil { panic(err) } } balancer.RegisterBuilder(balancer.Config{ Policy: picker.RoundrobinBalanced, Name: roundRobinBalancerName, Logger: lg, }) } // Client provides and manages an etcd v3 client session. type Client struct { Cluster KV Lease Watcher Auth Maintenance conn *grpc.ClientConn cfg Config creds *credentials.TransportCredentials balancer balancer.Balancer resolverGroup *endpoint.ResolverGroup mu *sync.Mutex ctx context.Context cancel context.CancelFunc // Username is a user name for authentication. Username string // Password is a password for authentication. Password string // tokenCred is an instance of WithPerRPCCredentials()'s argument tokenCred *authTokenCredential callOpts []grpc.CallOption lg *zap.Logger } // New creates a new etcdv3 client from a given configuration. func New(cfg Config) (*Client, error) { if len(cfg.Endpoints) == 0 { return nil, ErrNoAvailableEndpoints } return newClient(&cfg) } // NewCtxClient creates a client with a context but no underlying grpc // connection. This is useful for embedded cases that override the // service interface implementations and do not need connection management. func NewCtxClient(ctx context.Context) *Client { cctx, cancel := context.WithCancel(ctx) return &Client{ctx: cctx, cancel: cancel} } // NewFromURL creates a new etcdv3 client from a URL. func NewFromURL(url string) (*Client, error) { return New(Config{Endpoints: []string{url}}) } // NewFromURLs creates a new etcdv3 client from URLs. func NewFromURLs(urls []string) (*Client, error) { return New(Config{Endpoints: urls}) } // Close shuts down the client's etcd connections. func (c *Client) Close() error { c.cancel() c.Watcher.Close() c.Lease.Close() if c.resolverGroup != nil { c.resolverGroup.Close() } if c.conn != nil { return toErr(c.ctx, c.conn.Close()) } return c.ctx.Err() } // Ctx is a context for "out of band" messages (e.g., for sending // "clean up" message when another context is canceled). It is // canceled on client Close(). func (c *Client) Ctx() context.Context { return c.ctx } // Endpoints lists the registered endpoints for the client. func (c *Client) Endpoints() (eps []string) { // copy the slice; protect original endpoints from being changed eps = make([]string, len(c.cfg.Endpoints)) copy(eps, c.cfg.Endpoints) return } // SetEndpoints updates client's endpoints. func (c *Client) SetEndpoints(eps ...string) { c.mu.Lock() defer c.mu.Unlock() c.cfg.Endpoints = eps c.resolverGroup.SetEndpoints(eps) } // Sync synchronizes client's endpoints with the known endpoints from the etcd membership. func (c *Client) Sync(ctx context.Context) error { mresp, err := c.MemberList(ctx) if err != nil { return err } var eps []string for _, m := range mresp.Members { eps = append(eps, m.ClientURLs...) } c.SetEndpoints(eps...) return nil } func (c *Client) autoSync() { if c.cfg.AutoSyncInterval == time.Duration(0) { return } for { select { case <-c.ctx.Done(): return case <-time.After(c.cfg.AutoSyncInterval): ctx, cancel := context.WithTimeout(c.ctx, 5*time.Second) err := c.Sync(ctx) cancel() if err != nil && err != c.ctx.Err() { lg.Lvl(4).Infof("Auto sync endpoints failed: %v", err) } } } } type authTokenCredential struct { token string tokenMu *sync.RWMutex } func (cred authTokenCredential) RequireTransportSecurity() bool { return false } func (cred authTokenCredential) GetRequestMetadata(ctx context.Context, s ...string) (map[string]string, error) { cred.tokenMu.RLock() defer cred.tokenMu.RUnlock() return map[string]string{ rpctypes.TokenFieldNameGRPC: cred.token, }, nil } func (c *Client) processCreds(scheme string) (creds *credentials.TransportCredentials) { creds = c.creds switch scheme { case "unix": case "http": creds = nil case "https", "unixs": if creds != nil { break } tlsconfig := &tls.Config{} emptyCreds := credentials.NewTLS(tlsconfig) creds = &emptyCreds default: creds = nil } return creds } // dialSetupOpts gives the dial opts prior to any authentication. func (c *Client) dialSetupOpts(creds *credentials.TransportCredentials, dopts ...grpc.DialOption) (opts []grpc.DialOption, err error) { if c.cfg.DialKeepAliveTime > 0 { params := keepalive.ClientParameters{ Time: c.cfg.DialKeepAliveTime, Timeout: c.cfg.DialKeepAliveTimeout, PermitWithoutStream: c.cfg.PermitWithoutStream, } opts = append(opts, grpc.WithKeepaliveParams(params)) } opts = append(opts, dopts...) // Provide a net dialer that supports cancelation and timeout. f := func(dialEp string, t time.Duration) (net.Conn, error) { proto, host, _ := endpoint.ParseEndpoint(dialEp) select { case <-c.ctx.Done(): return nil, c.ctx.Err() default: } dialer := &net.Dialer{Timeout: t} return dialer.DialContext(c.ctx, proto, host) } opts = append(opts, grpc.WithDialer(f)) if creds != nil { opts = append(opts, grpc.WithTransportCredentials(*creds)) } else { opts = append(opts, grpc.WithInsecure()) } // Interceptor retry and backoff. // TODO: Replace all of clientv3/retry.go with interceptor based retry, or with // https://github.com/grpc/proposal/blob/master/A6-client-retries.md#retry-policy // once it is available. rrBackoff := withBackoff(c.roundRobinQuorumBackoff(defaultBackoffWaitBetween, defaultBackoffJitterFraction)) opts = append(opts, // Disable stream retry by default since go-grpc-middleware/retry does not support client streams. // Streams that are safe to retry are enabled individually. grpc.WithStreamInterceptor(c.streamClientInterceptor(c.lg, withMax(0), rrBackoff)), grpc.WithUnaryInterceptor(c.unaryClientInterceptor(c.lg, withMax(defaultUnaryMaxRetries), rrBackoff)), ) return opts, nil } // Dial connects to a single endpoint using the client's config. func (c *Client) Dial(ep string) (*grpc.ClientConn, error) { creds := c.directDialCreds(ep) // Use the grpc passthrough resolver to directly dial a single endpoint. // This resolver passes through the 'unix' and 'unixs' endpoints schemes used // by etcd without modification, allowing us to directly dial endpoints and // using the same dial functions that we use for load balancer dialing. return c.dial(fmt.Sprintf("passthrough:///%s", ep), creds) } func (c *Client) getToken(ctx context.Context) error { var err error // return last error in a case of fail var auth *authenticator for i := 0; i < len(c.cfg.Endpoints); i++ { ep := c.cfg.Endpoints[i] // use dial options without dopts to avoid reusing the client balancer var dOpts []grpc.DialOption _, host, _ := endpoint.ParseEndpoint(ep) target := c.resolverGroup.Target(host) creds := c.dialWithBalancerCreds(ep) dOpts, err = c.dialSetupOpts(creds, c.cfg.DialOptions...) if err != nil { err = fmt.Errorf("failed to configure auth dialer: %v", err) continue } dOpts = append(dOpts, grpc.WithBalancerName(roundRobinBalancerName)) auth, err = newAuthenticator(ctx, target, dOpts, c) if err != nil { continue } defer auth.close() var resp *AuthenticateResponse resp, err = auth.authenticate(ctx, c.Username, c.Password) if err != nil { continue } c.tokenCred.tokenMu.Lock() c.tokenCred.token = resp.Token c.tokenCred.tokenMu.Unlock() return nil } return err } // dialWithBalancer dials the client's current load balanced resolver group. The scheme of the host // of the provided endpoint determines the scheme used for all endpoints of the client connection. func (c *Client) dialWithBalancer(ep string, dopts ...grpc.DialOption) (*grpc.ClientConn, error) { _, host, _ := endpoint.ParseEndpoint(ep) target := c.resolverGroup.Target(host) creds := c.dialWithBalancerCreds(ep) return c.dial(target, creds, dopts...) } // dial configures and dials any grpc balancer target. func (c *Client) dial(target string, creds *credentials.TransportCredentials, dopts ...grpc.DialOption) (*grpc.ClientConn, error) { opts, err := c.dialSetupOpts(creds, dopts...) if err != nil { return nil, fmt.Errorf("failed to configure dialer: %v", err) } if c.Username != "" && c.Password != "" { c.tokenCred = &authTokenCredential{ tokenMu: &sync.RWMutex{}, } ctx, cancel := c.ctx, func() {} if c.cfg.DialTimeout > 0 { ctx, cancel = context.WithTimeout(ctx, c.cfg.DialTimeout) } err = c.getToken(ctx) if err != nil { if toErr(ctx, err) != rpctypes.ErrAuthNotEnabled { if err == ctx.Err() && ctx.Err() != c.ctx.Err() { err = context.DeadlineExceeded } cancel() return nil, err } } else { opts = append(opts, grpc.WithPerRPCCredentials(c.tokenCred)) } cancel() } opts = append(opts, c.cfg.DialOptions...) dctx := c.ctx if c.cfg.DialTimeout > 0 { var cancel context.CancelFunc dctx, cancel = context.WithTimeout(c.ctx, c.cfg.DialTimeout) defer cancel() // TODO: Is this right for cases where grpc.WithBlock() is not set on the dial options? } conn, err := grpc.DialContext(dctx, target, opts...) if err != nil { return nil, err } return conn, nil } func (c *Client) directDialCreds(ep string) *credentials.TransportCredentials { _, hostPort, scheme := endpoint.ParseEndpoint(ep) creds := c.creds if len(scheme) != 0 { creds = c.processCreds(scheme) if creds != nil { c := *creds clone := c.Clone() // Set the server name must to the endpoint hostname without port since grpc // otherwise attempts to check if x509 cert is valid for the full endpoint // including the scheme and port, which fails. host, _ := endpoint.ParseHostPort(hostPort) clone.OverrideServerName(host) creds = &clone } } return creds } func (c *Client) dialWithBalancerCreds(ep string) *credentials.TransportCredentials { _, _, scheme := endpoint.ParseEndpoint(ep) creds := c.creds if len(scheme) != 0 { creds = c.processCreds(scheme) } return creds } // WithRequireLeader requires client requests to only succeed // when the cluster has a leader. func WithRequireLeader(ctx context.Context) context.Context { md := metadata.Pairs(rpctypes.MetadataRequireLeaderKey, rpctypes.MetadataHasLeader) return metadata.NewOutgoingContext(ctx, md) } func newClient(cfg *Config) (*Client, error) { if cfg == nil { cfg = &Config{} } var creds *credentials.TransportCredentials if cfg.TLS != nil { c := credentials.NewTLS(cfg.TLS) creds = &c } // use a temporary skeleton client to bootstrap first connection baseCtx := context.TODO() if cfg.Context != nil { baseCtx = cfg.Context } ctx, cancel := context.WithCancel(baseCtx) client := &Client{ conn: nil, cfg: *cfg, creds: creds, ctx: ctx, cancel: cancel, mu: new(sync.Mutex), callOpts: defaultCallOpts, } lcfg := DefaultLogConfig if cfg.LogConfig != nil { lcfg = *cfg.LogConfig } var err error client.lg, err = lcfg.Build() if err != nil { return nil, err } if cfg.Username != "" && cfg.Password != "" { client.Username = cfg.Username client.Password = cfg.Password } if cfg.MaxCallSendMsgSize > 0 || cfg.MaxCallRecvMsgSize > 0 { if cfg.MaxCallRecvMsgSize > 0 && cfg.MaxCallSendMsgSize > cfg.MaxCallRecvMsgSize { return nil, fmt.Errorf("gRPC message recv limit (%d bytes) must be greater than send limit (%d bytes)", cfg.MaxCallRecvMsgSize, cfg.MaxCallSendMsgSize) } callOpts := []grpc.CallOption{ defaultFailFast, defaultMaxCallSendMsgSize, defaultMaxCallRecvMsgSize, } if cfg.MaxCallSendMsgSize > 0 { callOpts[1] = grpc.MaxCallSendMsgSize(cfg.MaxCallSendMsgSize) } if cfg.MaxCallRecvMsgSize > 0 { callOpts[2] = grpc.MaxCallRecvMsgSize(cfg.MaxCallRecvMsgSize) } client.callOpts = callOpts } // Prepare a 'endpoint://<unique-client-id>/' resolver for the client and create a endpoint target to pass // to dial so the client knows to use this resolver. client.resolverGroup, err = endpoint.NewResolverGroup(fmt.Sprintf("client-%s", uuid.New().String())) if err != nil { client.cancel() return nil, err } client.resolverGroup.SetEndpoints(cfg.Endpoints) if len(cfg.Endpoints) < 1 { return nil, fmt.Errorf("at least one Endpoint must is required in client config") } dialEndpoint := cfg.Endpoints[0] // Use a provided endpoint target so that for https:// without any tls config given, then // grpc will assume the certificate server name is the endpoint host. conn, err := client.dialWithBalancer(dialEndpoint, grpc.WithBalancerName(roundRobinBalancerName)) if err != nil { client.cancel() client.resolverGroup.Close() return nil, err } // TODO: With the old grpc balancer interface, we waited until the dial timeout // for the balancer to be ready. Is there an equivalent wait we should do with the new grpc balancer interface? client.conn = conn client.Cluster = NewCluster(client) client.KV = NewKV(client) client.Lease = NewLease(client) client.Watcher = NewWatcher(client) client.Auth = NewAuth(client) client.Maintenance = NewMaintenance(client) if cfg.RejectOldCluster { if err := client.checkVersion(); err != nil { client.Close() return nil, err } } go client.autoSync() return client, nil } // roundRobinQuorumBackoff retries against quorum between each backoff. // This is intended for use with a round robin load balancer. func (c *Client) roundRobinQuorumBackoff(waitBetween time.Duration, jitterFraction float64) backoffFunc { return func(attempt uint) time.Duration { // after each round robin across quorum, backoff for our wait between duration n := uint(len(c.Endpoints())) quorum := (n/2 + 1) if attempt%quorum == 0 { c.lg.Info("backoff", zap.Uint("attempt", attempt), zap.Uint("quorum", quorum), zap.Duration("waitBetween", waitBetween), zap.Float64("jitterFraction", jitterFraction)) return jitterUp(waitBetween, jitterFraction) } c.lg.Info("backoff skipped", zap.Uint("attempt", attempt), zap.Uint("quorum", quorum)) return 0 } } func (c *Client) checkVersion() (err error) { var wg sync.WaitGroup errc := make(chan error, len(c.cfg.Endpoints)) ctx, cancel := context.WithCancel(c.ctx) if c.cfg.DialTimeout > 0 { ctx, cancel = context.WithTimeout(ctx, c.cfg.DialTimeout) } wg.Add(len(c.cfg.Endpoints)) for _, ep := range c.cfg.Endpoints { // if cluster is current, any endpoint gives a recent version go func(e string) { defer wg.Done() resp, rerr := c.Status(ctx, e) if rerr != nil { errc <- rerr return } vs := strings.Split(resp.Version, ".") maj, min := 0, 0 if len(vs) >= 2 { maj, _ = strconv.Atoi(vs[0]) min, rerr = strconv.Atoi(vs[1]) } if maj < 3 || (maj == 3 && min < 2) { rerr = ErrOldCluster } errc <- rerr }(ep) } // wait for success for i := 0; i < len(c.cfg.Endpoints); i++ { if err = <-errc; err == nil { break } } cancel() wg.Wait() return err } // ActiveConnection returns the current in-use connection func (c *Client) ActiveConnection() *grpc.ClientConn { return c.conn } // isHaltErr returns true if the given error and context indicate no forward // progress can be made, even after reconnecting. func isHaltErr(ctx context.Context, err error) bool { if ctx != nil && ctx.Err() != nil { return true } if err == nil { return false } ev, _ := status.FromError(err) // Unavailable codes mean the system will be right back. // (e.g., can't connect, lost leader) // Treat Internal codes as if something failed, leaving the // system in an inconsistent state, but retrying could make progress. // (e.g., failed in middle of send, corrupted frame) // TODO: are permanent Internal errors possible from grpc? return ev.Code() != codes.Unavailable && ev.Code() != codes.Internal } // isUnavailableErr returns true if the given error is an unavailable error func isUnavailableErr(ctx context.Context, err error) bool { if ctx != nil && ctx.Err() != nil { return false } if err == nil { return false } ev, _ := status.FromError(err) // Unavailable codes mean the system will be right back. // (e.g., can't connect, lost leader) return ev.Code() == codes.Unavailable } func toErr(ctx context.Context, err error) error { if err == nil { return nil } err = rpctypes.Error(err) if _, ok := err.(rpctypes.EtcdError); ok { return err } if ev, ok := status.FromError(err); ok { code := ev.Code() switch code { case codes.DeadlineExceeded: fallthrough case codes.Canceled: if ctx.Err() != nil { err = ctx.Err() } case codes.Unavailable: case codes.FailedPrecondition: err = grpc.ErrClientConnClosing } } return err } func canceledByCaller(stopCtx context.Context, err error) bool { if stopCtx.Err() == nil || err == nil { return false } return err == context.Canceled || err == context.DeadlineExceeded } // IsConnCanceled returns true, if error is from a closed gRPC connection. // ref. https://github.com/grpc/grpc-go/pull/1854 func IsConnCanceled(err error) bool { if err == nil { return false } // >= gRPC v1.10.x s, ok := status.FromError(err) if ok { // connection is canceled or server has already closed the connection return s.Code() == codes.Canceled || s.Message() == "transport is closing" } // >= gRPC v1.10.x if err == context.Canceled { return true } // <= gRPC v1.7.x returns 'errors.New("grpc: the client connection is closing")' return strings.Contains(err.Error(), "grpc: the client connection is closing") } func getHost(ep string) string { url, uerr := url.Parse(ep) if uerr != nil || !strings.Contains(ep, "://") { return ep } return url.Host }
{ "pile_set_name": "Github" }
/**************************************************************************** * arch/or1k/src/common/up_task_start.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <[email protected]> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name NuttX 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. * ****************************************************************************/ /**************************************************************************** * Included Files ****************************************************************************/ #include <nuttx/config.h> #include <nuttx/arch.h> #include "svcall.h" #include "up_internal.h" #ifndef CONFIG_BUILD_FLAT /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** * Name: up_task_start * * Description: * In this kernel mode build, this function will be called to execute a * task in user-space. When the task is first started, a kernel-mode * stub will first run to perform some housekeeping functions. This * kernel-mode stub will then be called transfer control to the user-mode * task. * * Normally the a user-mode start-up stub will also execute before the * task actually starts. See libc/sched/task_startup.c * * Input Parameters: * taskentry - The user-space entry point of the task. * argc - The number of parameters being passed. * argv - The parameters being passed. These lie in kernel-space memory * and will have to be reallocated in user-space memory. * * Returned Value: * This function should not return. It should call the user-mode start-up * stub and that stub should call exit if/when the user task terminates. * ****************************************************************************/ void up_task_start(main_t taskentry, int argc, FAR char *argv[]) { /* Let sys_call3() do all of the work */ sinfo("entry %p argc %d\n", taskentry, argc); sys_call3(SYS_task_start, (uintptr_t)taskentry, (uintptr_t)argc, (uintptr_t)argv); PANIC(); } #endif /* !CONFIG_BUILD_FLAT */
{ "pile_set_name": "Github" }
/**** * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development. * Created 2015 by Skurydin Alexey * http://github.com/SmingHub/Sming * All files of the Sming Core are provided under the LGPL v3 license. * * HttpServer.cpp * * Modified: 2017 - Slavey Karadzhov <[email protected]> * ****/ #include "HttpServer.h" #include "TcpClient.h" #include "WString.h" void HttpServer::configure(const HttpServerSettings& settings) { this->settings = settings; if(settings.minHeapSize > -1) { minHeapSize = settings.minHeapSize; } maxConnections = settings.maxActiveConnections; if(settings.useDefaultBodyParsers) { setBodyParser(MIME_FORM_URL_ENCODED, formUrlParser); } setKeepAlive(settings.keepAliveSeconds); } TcpConnection* HttpServer::createClient(tcp_pcb* clientTcp) { HttpServerConnection* con = new HttpServerConnection(clientTcp); con->setResourceTree(&paths); con->setBodyParsers(&bodyParsers); con->setCloseOnContentError(settings.closeOnContentError); return con; }
{ "pile_set_name": "Github" }
/* * oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. * * Copyright (c) 2014, Gluu */ package org.gluu.oxauth.model.session; import org.gluu.oxauth.model.error.IErrorType; /** * Error codes for End Session error responses. * * @author Javier Rojas Blum Date: 12.16.2011 */ public enum EndSessionErrorResponseType implements IErrorType { /** * The provided access token is invalid, or was issued to another client. */ INVALID_GRANT("invalid_grant"), /** * The request is missing a required parameter, includes an unsupported parameter or parameter value, repeats a * parameter, or is otherwise malformed. */ INVALID_REQUEST("invalid_request"), /** * The provided access token and session state are invalid or were issued to another client. */ INVALID_GRANT_AND_SESSION("invalid_grant_and_session"), /** * The provided session state is empty. */ SESSION_NOT_PASSED("session_not_passed"), /** * The provided post logout uri is empty. */ POST_LOGOUT_URI_NOT_PASSED("post_logout_uri_not_passed"), /** * The provided post logout uri is not associated with client */ POST_LOGOUT_URI_NOT_ASSOCIATED_WITH_CLIENT("post_logout_uri_not_associated_with_client"); private final String paramName; private EndSessionErrorResponseType(String paramName) { this.paramName = paramName; } /** * Returns the corresponding {@link EndSessionErrorResponseType} from a given string. * * @param param The string value to convert. * @return The corresponding {@link EndSessionErrorResponseType}, otherwise <code>null</code>. */ public static EndSessionErrorResponseType fromString(String param) { if (param != null) { for (EndSessionErrorResponseType err : EndSessionErrorResponseType .values()) { if (param.equals(err.paramName)) { return err; } } } return null; } /** * Returns a string representation of the object. In this case the parameter name. * * @return The string representation of the object. */ @Override public String toString() { return paramName; } /** * Gets error parameter. * * @return error parameter */ @Override public String getParameter() { return paramName; } }
{ "pile_set_name": "Github" }
Goal: ----- CppClean attempts to find problems in C++ source that slow development in large code bases, for example various forms of unused code. Unused code can be unused functions, methods, data members, types, etc to unnecessary #include directives. Unnecessary #includes can cause considerable extra compiles increasing the edit-compile-run cycle. The project home page is: http://code.google.com/p/cppclean/ Features: --------- * Find and print C++ language constructs: classes, methods, functions, etc. * Find classes with virtual methods, no virtual destructor, and no bases * Find global/static data that are potential problems when using threads * Unnecessary forward class declarations * Unnecessary function declarations * Undeclared function definitions * (planned) Find unnecessary header files #included - No direct reference to anything in the header - Header is unnecessary if classes were forward declared instead * (planned) Source files that reference headers not directly #included, ie, files that rely on a transitive #include from another header * (planned) Unused members (private, protected, & public) methods and data * (planned) Store AST in a SQL database so relationships can be queried AST is Abstract Syntax Tree, a representation of parsed source code. http://en.wikipedia.org/wiki/Abstract_syntax_tree System Requirements: -------------------- * Python 2.4 or later (2.3 probably works too) * Works on Windows (untested), Mac OS X, and Unix How to Run: ----------- For all examples, it is assumed that cppclean resides in a directory called /cppclean. To print warnings for classes with virtual methods, no virtual destructor and no base classes: /cppclean/run.sh nonvirtual_dtors.py file1.h file2.h file3.cc ... To print all the functions defined in header file(s): /cppclean/run.sh functions.py file1.h file2.h ... All the commands take multiple files on the command line. Other programs include: find_warnings, headers, methods, and types. Some other programs are available, but used primarily for debugging. run.sh is a simple wrapper that sets PYTHONPATH to /cppclean and then runs the program in /cppclean/cpp/PROGRAM.py. There is currently no equivalent for Windows. Contributions for a run.bat file would be greatly appreciated. How to Configure: ----------------- You can add a siteheaders.py file in /cppclean/cpp to configure where to look for other headers (typically -I options passed to a compiler). Currently two values are supported: _TRANSITIVE and GetIncludeDirs. _TRANSITIVE should be set to a boolean value (True or False) indicating whether to transitively process all header files. The default is False. GetIncludeDirs is a function that takes a single argument and returns a sequence of directories to include. This can be a generator or return a static list. def GetIncludeDirs(filename): return ['/some/path/with/other/headers'] # Here is a more complicated example. def GetIncludeDirs(filename): yield '/path1' yield os.path.join('/path2', os.path.dirname(filename)) yield '/path3' How to Test: ------------ For all examples, it is assumed that cppclean resides in a directory called /cppclean. The tests require cd /cppclean make test # To generate expected results after a change: make expected Current Status: --------------- The parser works pretty well for header files, parsing about 99% of Google's header files. Anything which inspects structure of C++ source files should work reasonably well. Function bodies are not transformed to an AST, but left as tokens. Much work is still needed on finding unused header files and storing an AST in a database. Non-goals: ---------- * Parsing all valid C++ source * Handling invalid C++ source gracefully * Compiling to machine code (or anything beyond an AST) Contact: -------- If you used cppclean, I would love to hear about your experiences [email protected]. Even if you don't use cppclean, I'd like to hear from you. :-) (You can contact me directly at: [email protected])
{ "pile_set_name": "Github" }
open bossLib HolKernel boolLib listTheory rich_listTheory optionTheory combinTheory arithmeticTheory pairTheory; open sortingTheory wordsTheory; open ottTheory ottLib caml_typedefTheory; open utilTheory basicTheory; val _ = new_theory "matching_fun"; val ALL_DISTINCT_MAP = Q.prove ( `!l f. ALL_DISTINCT (MAP f l) ==> ALL_DISTINCT l`, Induct THEN SRW_TAC [] [MEM_MAP] THEN METIS_TAC []); val list_assoc_MAP_11 = Q.prove ( `!l f k. (!x x'. (f x = f x') = (x = x')) ==> (list_assoc (f k) (MAP (\x. (f (FST x), SND x)) l) = list_assoc k l)`, Induct THEN SRW_TAC [] [list_assoc_def] THEN Cases_on `h` THEN SRW_TAC [] [list_assoc_def] THEN FULL_SIMP_TAC list_ss []); val MEM_SPLIT = Q.prove ( `!x l. MEM x l = ?l1 l2. l = l1++x::l2`, Induct_on `l` THEN SRW_TAC [] [] THEN EQ_TAC THEN SRW_TAC [] [] THENL [METIS_TAC [APPEND], METIS_TAC [APPEND], Cases_on `l1` THEN FULL_SIMP_TAC list_ss [] THEN METIS_TAC []]); val pat_match_def = tDefine "pat_match" `(pat_match (P_var vn) e = SOME [(vn, e)]) /\ (pat_match P_any e = SOME []) /\ (pat_match (P_constant constant) e = if (e = Expr_constant constant) then SOME [] else NONE) /\ (pat_match (P_alias pat vn) e = OPTION_MAP (\s. s++[(vn, e)]) (pat_match pat e)) /\ (pat_match (P_typed pat t) e = pat_match pat e) /\ (pat_match (P_or pat1 pat2) e = case pat_match pat1 e of SOME s -> SOME s || NONE -> pat_match pat2 e) /\ (pat_match (P_construct c plist) e = case e of Expr_construct c' elist -> if ~(c' = c) then NONE else pat_match_list plist elist || _ -> NONE) /\ (pat_match (P_construct_any c) e = case e of Expr_construct c' elist -> if (c = c') then SOME [] else NONE || _ -> NONE) /\ (pat_match (P_tuple plist) e = case e of Expr_tuple elist -> pat_match_list plist elist || _ -> NONE) /\ (pat_match (P_record fplist) e = case e of Expr_record felist -> if ~ALL_DISTINCT (MAP FST felist) \/ ~(ALL_DISTINCT (MAP FST fplist)) then NONE else pat_match_rec_list fplist felist || _ -> NONE) /\ (pat_match (P_cons pat1 pat2) e = case e of Expr_cons e1 e2 -> (case pat_match pat1 e1 of SOME s1 -> (case pat_match pat2 e2 of SOME s2 -> SOME (s1++s2) || NONE -> NONE) || NONE -> NONE) || _ -> NONE) /\ (pat_match_list [] [] = SOME []) /\ (pat_match_list (p::plist) (e::elist) = case pat_match p e of SOME s1 -> (case pat_match_list plist elist of SOME s2 -> SOME (s1++s2) || NONE -> NONE) || NONE -> NONE) /\ (pat_match_list _ _ = NONE) /\ (pat_match_rec_list [] _ = SOME []) /\ (pat_match_rec_list ((f, p)::fplist) felist = case list_assoc f felist of SOME e -> (case pat_match p e of SOME s1 -> (case pat_match_rec_list fplist felist of SOME s2 -> SOME (s1++s2) || NONE -> NONE) || NONE -> NONE) || NONE -> NONE)` (WF_REL_TAC `measure (sum_case (pattern_size o FST) (sum_case (pattern1_size o FST) (pattern2_size o FST)))`); val pat_match_ind = fetch "-" "pat_match_ind"; val pat_match_is_val_thm = Q.store_thm ("pat_match_is_val_thm", `(!p e s. is_value_of_expr e /\ (pat_match p e = SOME s) ==> EVERY is_value_of_expr (MAP SND s)) /\ (!pl el s. EVERY is_value_of_expr el /\ (pat_match_list pl el = SOME s) ==> EVERY is_value_of_expr (MAP SND s)) /\ (!fpl fel s. EVERY is_value_of_expr (MAP SND fel) /\ (pat_match_rec_list fpl fel = SOME s) ==> EVERY is_value_of_expr (MAP SND s))`, HO_MATCH_MP_TAC pat_match_ind THEN SRW_TAC [] [pat_match_def, is_value_of_expr_def, EVERY_MAP] THEN SRW_TAC [] [] THENL [Cases_on `pat_match p e` THEN FULL_SIMP_TAC (srw_ss()) [], Cases_on `e` THEN FULL_SIMP_TAC (srw_ss()) [COND_EXPAND_EQ, is_value_of_expr_def] THEN METIS_TAC [], Cases_on `e` THEN FULL_SIMP_TAC (srw_ss()) [COND_EXPAND_EQ, is_value_of_expr_def] THEN METIS_TAC [EVERY_DEF], Cases_on `e` THEN FULL_SIMP_TAC (srw_ss()) [COND_EXPAND_EQ, is_value_of_expr_def] THEN METIS_TAC [], Cases_on `e` THEN FULL_SIMP_TAC (srw_ss()) [COND_EXPAND_EQ, is_value_of_expr_def, LAMBDA_PROD2] THEN METIS_TAC [], Cases_on `e` THEN FULL_SIMP_TAC (srw_ss()) [COND_EXPAND_EQ, is_value_of_expr_def] THEN Cases_on `pat_match p e'` THEN FULL_SIMP_TAC (srw_ss()) [] THEN Cases_on `pat_match p' e0` THEN FULL_SIMP_TAC (srw_ss()) [] THEN METIS_TAC [EVERY_APPEND], Cases_on `pat_match p e` THEN FULL_SIMP_TAC (srw_ss()) [] THEN Cases_on `pat_match_list pl el` THEN FULL_SIMP_TAC (srw_ss()) [] THEN METIS_TAC [EVERY_APPEND], Cases_on `list_assoc f fel` THEN FULL_SIMP_TAC (srw_ss()) [] THEN Cases_on `pat_match p x` THEN FULL_SIMP_TAC (srw_ss()) [] THEN Cases_on `pat_match_rec_list fpl fel` THEN FULL_SIMP_TAC (srw_ss()) [] THEN SRW_TAC [] [] THEN IMP_RES_TAC list_assoc_mem THEN FULL_SIMP_TAC list_ss [EVERY_MEM] THEN METIS_TAC [SND]]); local val lem1 = Q.prove ( `!s. (substs_x_xs case s of substs_x_xs l -> l) = s`, Cases THEN SRW_TAC [] []); val lem2 = Q.prove ( `!l1 l2 l3. (LENGTH l1 = LENGTH l2) /\ (LENGTH l2 = LENGTH l3) /\ EVERY (\x. JM_match (FST x) (FST (SND x)) (substs_x_xs (SND (SND x)))) (ZIP (l1,ZIP (l2,l3))) ==> EVERY (\x. JM_match (FST x) (FST (SND x)) (SND (SND x))) (ZIP (l1,ZIP (l2,MAP substs_x_xs l3)))`, Induct THEN Cases_on `l2` THEN Cases_on `l3` THEN FULL_SIMP_TAC list_ss []); val lem3 = Q.prove ( `!l. EVERY (\x. P (SND (SND (SND x))) (FST (SND x)) (FST (SND (SND x)))) l /\ MEM p l /\ ALL_DISTINCT (MAP FST l) ==> case list_assoc (FST p) (MAP (\z. (FST z,SND (SND (SND z)))) l ++ fn_v''_list) of NONE -> F || SOME e -> P e (FST (SND p)) (FST (SND (SND p)))`, Induct THEN SRW_TAC [] [list_assoc_def] THEN FULL_SIMP_TAC list_ss [] THEN Cases_on `list_assoc (FST h) (MAP (\z. (FST z,SND (SND (SND z)))) l ++ fn_v''_list)` THEN FULL_SIMP_TAC (srw_ss()) [MEM_MAP] THEN METIS_TAC []); val field_to_fn_11 = Q.store_thm ("field_to_fn_11", `!x x'. (field_to_fn x = field_to_fn x') = (x = x')`, Cases THEN Cases THEN SRW_TAC [] [field_to_fn_def]); val lem4 = Q.prove ( `!fplist slist l. EVERY (\z. is_value_of_expr (SND z)) l /\ ALL_DISTINCT (MAP FST l) /\ ALL_DISTINCT (MAP FST fplist) /\ (LENGTH slist = LENGTH fplist) /\ EVERY (\z. case list_assoc (FST (FST z)) l of NONE -> F || SOME e -> JM_match e (SND (FST z)) (substs_x_xs (SND z))) (ZIP (fplist,slist)) ==> ?fn_v''_list field_name'_pat_substs_x_v'_list field_name_v_list. (l = MAP (\z. (F_name (FST z),SND z)) field_name_v_list) /\ (fplist = MAP (\z. (F_name (FST z),FST (SND z))) field_name'_pat_substs_x_v'_list) /\ (FLAT slist = FLAT (MAP (\x. case x of substs_x_xs l' -> l') (MAP (UNCURRY (\field_name_'. UNCURRY (\pat_. FST))) field_name'_pat_substs_x_v'_list))) /\ EVERY (\z. is_value_of_expr (SND z)) fn_v''_list /\ EVERY (\z. is_value_of_expr (SND (SND (SND z)))) field_name'_pat_substs_x_v'_list /\ EVERY (\z. is_value_of_expr (SND z)) field_name_v_list /\ PERM (MAP (\z. (FST z,SND (SND (SND z)))) field_name'_pat_substs_x_v'_list ++ fn_v''_list) field_name_v_list /\ EVERY (\x. JM_match (SND (SND (SND x))) (FST (SND x)) (FST (SND (SND x)))) field_name'_pat_substs_x_v'_list /\ ALL_DISTINCT (MAP (\z. name_fn (FST z)) field_name_v_list)`, Induct THEN SRW_TAC [] [] THEN Cases_on `slist` THEN FULL_SIMP_TAC list_ss [] THENL [MAP_EVERY Q.EXISTS_TAC [`MAP (\x. (field_to_fn (FST x), (SND x))) l`, `MAP (\x. (field_to_fn (FST x), (SND x))) l`] THEN SRW_TAC [] [MAP_MAP, field_to_fn_thm, MAP_I, EVERY_MAP] THEN METIS_TAC [MAP_11_ALL_DISTINCT, name_11, field_to_fn_11], Cases_on `list_assoc (FST h) l` THEN FULL_SIMP_TAC list_ss [] THEN Q.PAT_ASSUM `!slist l'. P slist l' ==> Q slist l'` (MP_TAC o Q.SPECL [`t`, `l`]) THEN SRW_TAC [] [] THEN IMP_RES_TAC list_assoc_mem THEN FULL_SIMP_TAC list_ss [EVERY_MAP, MAP_MAP] THEN Cases_on `h` THEN Cases_on `q` THEN FULL_SIMP_TAC (srw_ss()) [] THEN `MEM (f',x) (MAP (\z. (FST z,SND z)) field_name_v_list)` by (FULL_SIMP_TAC (srw_ss()) [MEM_MAP] THEN METIS_TAC []) THEN FULL_SIMP_TAC (srw_ss()) [MAP_I] THEN IMP_RES_TAC PERM_MEM_EQ THEN FULL_SIMP_TAC list_ss [] THEN1 (FULL_SIMP_TAC list_ss [MEM_MAP] THEN METIS_TAC []) THEN FULL_SIMP_TAC list_ss [MEM_SPLIT] THEN MAP_EVERY Q.EXISTS_TAC [`l1''++l2''`, `(f', r, substs_x_xs h', x):: field_name'_pat_substs_x_v'_list`, `field_name_v_list`] THEN SRW_TAC [] [field_to_fn_thm] THEN FULL_SIMP_TAC list_ss [EVERY_MAP] THEN METIS_TAC [PERM_REFL, CONS_PERM, APPEND, PERM_SYM, PERM_TRANS]]); val list_TAC = Cases_on `e` THEN SRW_TAC [] [] THEN FULL_SIMP_TAC list_ss [is_value_of_expr_def, ETA_THM, ELIM_UNCURRY] THEN EQ_TAC THEN SRW_TAC [] [] THENL [FULL_SIMP_TAC list_ss [LENGTH_MAP] THEN Q.PAT_ASSUM `!s. f ==> ((?slist. P slist) = g)` (MP_TAC o GSYM o Q.SPEC `FLAT (MAP (\x. case SND (SND x) of substs_x_xs l -> l) (v_pat_substs_x_list: (expr#pattern#substs_x) list))`) THEN SRW_TAC [] [MAP_MAP] THEN Q.EXISTS_TAC `MAP (\x. case SND (SND x) of substs_x_xs l -> l) (v_pat_substs_x_list: (expr#pattern#substs_x) list)` THEN SRW_TAC [] [ZIP_MAP, LENGTH_MAP, LENGTH_ZIP, MAP_ZIP_SAME] THEN SRW_TAC [] [MAP_MAP, EVERY_MAP, lem1], RES_TAC THEN SRW_TAC [] [] THEN Q.EXISTS_TAC `ZIP (l,ZIP (plist,MAP substs_x_xs slist))` THEN SRW_TAC [] [MAP_FST_ZIP, LENGTH_ZIP, GSYM MAP_MAP, GSYM EVERY_MAP, MAP_SND_ZIP] THEN SRW_TAC [] [MAP_MAP, lem1, MAP_I, lem2]]; in val match_thm = Q.store_thm ("match_thm", `(!p e s. is_value_of_expr e ==> (JM_match e p (substs_x_xs s) = (pat_match p e = SOME s))) /\ (!plist elist s. EVERY is_value_of_expr elist ==> ((LENGTH plist = LENGTH elist) /\ (?slist. (LENGTH slist = LENGTH elist) /\ (s = FLAT slist) /\ EVERY (\(e, p, s). JM_match e p (substs_x_xs s)) (ZIP (elist, ZIP (plist, slist)))) = (pat_match_list plist elist = SOME s))) /\ (!fplist felist s. EVERY is_value_of_expr (MAP SND felist) ==> ((?slist. (LENGTH slist = LENGTH fplist) /\ (s = FLAT slist) /\ EVERY (\((f, p), s). case list_assoc f felist of NONE -> F || SOME e -> JM_match e p (substs_x_xs s)) (ZIP (fplist, slist))) = (pat_match_rec_list fplist felist = SOME s)))`, HO_MATCH_MP_TAC pat_match_ind THEN SRW_TAC [] [pat_match_def, JM_match_fun, is_value_of_expr_def] THEN IMP_RES_TAC pat_match_is_val_thm THEN FULL_SIMP_TAC list_ss [EVERY_MAP] THENL [METIS_TAC [], METIS_TAC [], METIS_TAC [], METIS_TAC [], METIS_TAC [], SRW_TAC [] [JM_matchP_thm] THEN Cases_on `pat_match p e` THEN FULL_SIMP_TAC (srw_ss()) [] THEN METIS_TAC [], list_TAC, Cases_on `e` THEN SRW_TAC [] [] THEN FULL_SIMP_TAC list_ss [is_value_of_expr_def] THEN METIS_TAC [], list_TAC, Cases_on `e` THEN SRW_TAC [] [] THENL [CCONTR_TAC THEN FULL_SIMP_TAC list_ss [EVERY_MAP, MAP_MAP] THEN SRW_TAC [] [] THEN METIS_TAC [MAP_11_ALL_DISTINCT, name_11, field_11], CCONTR_TAC THEN FULL_SIMP_TAC list_ss [EVERY_MAP, MAP_MAP] THEN SRW_TAC [] [] THEN `PERM (MAP FST (MAP (\z. (FST z,SND (SND (SND z)))) field_name'_pat_substs_x_v'_list ++ fn_v''_list)) (MAP FST field_name_v_list)` by METIS_TAC [PERM_MAP] THEN FULL_SIMP_TAC list_ss [MAP_MAP] THEN IMP_RES_TAC PERM_ALL_DISTINCT THEN FULL_SIMP_TAC list_ss [ALL_DISTINCT_APPEND] THEN METIS_TAC [MAP_11_ALL_DISTINCT, name_11, field_11], FULL_SIMP_TAC list_ss [is_value_of_expr_def, LAMBDA_PROD2] THEN POP_ASSUM (MP_TAC o GSYM) THEN SRW_TAC [] [] THEN EQ_TAC THEN SRW_TAC [] [] THENL [Q.EXISTS_TAC `MAP (\x. case FST (SND (SND x)) of substs_x_xs l -> l) (field_name'_pat_substs_x_v'_list:(field_name#pattern#substs_x#expr) list)` THEN SRW_TAC [] [ELIM_UNCURRY, MAP_MAP, ZIP_MAP, MAP_ZIP_SAME] THEN SRW_TAC [] [EVERY_MAP, EVERY_MEM, lem1, list_assoc_MAP_11] THEN FULL_SIMP_TAC (srw_ss()) [MAP_MAP, MAP_11_ALL_DISTINCT, ETA_THM] THEN `PERM (MAP FST (MAP (\z. (FST z,SND (SND (SND z)))) field_name'_pat_substs_x_v'_list ++ fn_v''_list)) (MAP FST field_name_v_list)` by METIS_TAC [PERM_MAP] THEN `ALL_DISTINCT (MAP FST (MAP (\z. (FST z,SND (SND (SND z)))) field_name'_pat_substs_x_v'_list ++ fn_v''_list))` by METIS_TAC [PERM_ALL_DISTINCT, MAP_MAP, FST, MAP_APPEND] THEN METIS_TAC [lem3, PERM_list_assoc], METIS_TAC [lem4]]], Cases_on `e` THEN SRW_TAC [] [] THEN Cases_on `pat_match p e'` THEN SRW_TAC [] [] THENL [CCONTR_TAC THEN FULL_SIMP_TAC list_ss [] THEN Cases_on `substs_x1` THEN FULL_SIMP_TAC list_ss [] THEN METIS_TAC [], Cases_on `pat_match p' e0` THEN SRW_TAC [] [] THENL [CCONTR_TAC THEN FULL_SIMP_TAC list_ss [] THEN Cases_on `substs_x2` THEN FULL_SIMP_TAC list_ss [] THEN METIS_TAC [], FULL_SIMP_TAC list_ss [is_value_of_expr_def] THEN EQ_TAC THEN SRW_TAC [] [] THENL [Cases_on `substs_x1` THEN Cases_on `substs_x2` THEN SRW_TAC [] [] THEN METIS_TAC [], MAP_EVERY Q.EXISTS_TAC [`substs_x_xs x`, `substs_x_xs x'`] THEN SRW_TAC [] []]]], Cases_on `s` THEN SRW_TAC [] [] THENL [Q.EXISTS_TAC `[]` THEN SRW_TAC [] [], Cases_on `slist` THEN SRW_TAC [] []], Cases_on `pat_match p e` THEN SRW_TAC [] [] THENL [CCONTR_TAC THEN FULL_SIMP_TAC list_ss [] THEN SRW_TAC [] [] THEN Cases_on `slist` THEN FULL_SIMP_TAC list_ss [] THEN METIS_TAC [], Cases_on `pat_match_list plist elist` THEN SRW_TAC [] [] THENL [CCONTR_TAC THEN FULL_SIMP_TAC list_ss [] THEN Cases_on `slist` THEN FULL_SIMP_TAC list_ss [EVERY_MEM, EXISTS_MEM] THEN METIS_TAC [], EQ_TAC THEN SRW_TAC [] [] THENL [Cases_on `slist` THEN FULL_SIMP_TAC list_ss [] THEN METIS_TAC [], METIS_TAC [], POP_ASSUM (MP_TAC o Q.SPEC `x'`) THEN SRW_TAC [] [] THEN Q.EXISTS_TAC `x::slist` THEN SRW_TAC [] []]]], Cases_on `s` THEN SRW_TAC [] [] THENL [Q.EXISTS_TAC `[]` THEN SRW_TAC [] [], Cases_on `slist` THEN SRW_TAC [] []], Cases_on `list_assoc f felist` THEN SRW_TAC [] [] THENL [Cases_on `slist` THEN SRW_TAC [] [], Cases_on `pat_match p x` THEN SRW_TAC [] [] THENL [CCONTR_TAC THEN Cases_on `slist` THEN FULL_SIMP_TAC list_ss [] THEN REPEAT (POP_ASSUM MP_TAC) THEN SRW_TAC [] [EVERY_MEM] THEN METIS_TAC [SND, list_assoc_mem], Cases_on `pat_match_rec_list fplist felist` THEN SRW_TAC [] [] THENL [CCONTR_TAC THEN Cases_on `slist` THEN FULL_SIMP_TAC list_ss [] THEN REPEAT (POP_ASSUM MP_TAC) THEN SRW_TAC [] [EVERY_MEM, o_DEF] THEN METIS_TAC [], EQ_TAC THEN SRW_TAC [] [] THENL [Cases_on `slist` THEN FULL_SIMP_TAC list_ss [] THEN REPEAT (POP_ASSUM MP_TAC) THEN SRW_TAC [] [EVERY_MEM] THEN METIS_TAC [SND, list_assoc_mem], POP_ASSUM (MP_TAC o Q.SPEC `x''`) THEN SRW_TAC [] [] THEN Q.EXISTS_TAC `x'::slist` THEN SRW_TAC [] [] THEN FULL_SIMP_TAC list_ss [EVERY_MEM] THEN METIS_TAC [SND, list_assoc_mem]]]]]]); end; val _ = export_theory ();
{ "pile_set_name": "Github" }
/* * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.imageio.plugins.common; import java.io.IOException; import javax.imageio.stream.ImageInputStreamImpl; import javax.imageio.stream.ImageInputStream; public final class SubImageInputStream extends ImageInputStreamImpl { ImageInputStream stream; long startingPos; int startingLength; int length; public SubImageInputStream(ImageInputStream stream, int length) throws IOException { this.stream = stream; this.startingPos = stream.getStreamPosition(); this.startingLength = this.length = length; } public int read() throws IOException { if (length == 0) { // Local EOF return -1; } else { --length; return stream.read(); } } public int read(byte[] b, int off, int len) throws IOException { if (length == 0) { // Local EOF return -1; } len = Math.min(len, length); int bytes = stream.read(b, off, len); length -= bytes; return bytes; } public long length() { return startingLength; } public void seek(long pos) throws IOException { stream.seek(pos - startingPos); streamPos = pos; } @SuppressWarnings("deprecation") protected void finalize() throws Throwable { // Empty finalizer (for improved performance; no need to call // super.finalize() in this case) } }
{ "pile_set_name": "Github" }
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * @name: S13.2.2_A18_T2; * @section: 13.2.2; * @assertion: Using arguments object within a "with" Expression that is nested in a function is admitted; * @description: Object is declared with "__obj={callee:"a"}"; */ this.callee = 0; var b; __obj={callee:"a"}; function f(){ with (arguments){ callee=1; b=true; return arguments; } }; result=f(__obj); ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (callee !== 0) { $ERROR('#1: callee === 0. Actual: callee ==='+callee); } // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //CHECK#2 if (__obj.callee !== "a") { $ERROR('#2: __obj.callee === "a". Actual: __obj.callee ==='+__obj.callee); } // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //CHECK#3 if (result.callee !== 1) { $ERROR('#3: result.callee === 1. Actual: result.callee ==='+result.callee); } // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// //CHECK#4 if (!(this.b)) { $ERROR('#4: this.b === true. Actual: this.b ==='+this.b); } // //////////////////////////////////////////////////////////////////////////////
{ "pile_set_name": "Github" }
/*! * jQuery UI Google Map 3.0-rc * http://code.google.com/p/jquery-ui-map/ * Copyright (c) 2010 - 2012 Johan Säll Larsson * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php * * Depends: * jquery.ui.map.js */ ( function($) { $.extend($.ui.gmap.prototype, { /** * Computes directions between two or more places. * @param directionsRequest:google.maps.DirectionsRequest * @param directionsRendererOptions:google.maps.DirectionsRendererOptions (optional) * @param callback:function(result:google.maps.DirectionsResult, status:google.maps.DirectionsStatus) * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#DirectionsRequest * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#DirectionsRendererOptions * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#DirectionsResult */ displayDirections: function(directionsRequest, directionsRendererOptions, callback) { var self = this; var directionService = this.get('services > DirectionsService', new google.maps.DirectionsService()); var directionRenderer = this.get('services > DirectionsRenderer', new google.maps.DirectionsRenderer()); if ( directionsRendererOptions ) { directionRenderer.setOptions(directionsRendererOptions); } directionService.route(directionsRequest, function(results, status) { if ( status === 'OK' ) { directionRenderer.setDirections(results); directionRenderer.setMap(self.get('map')); } else { directionRenderer.setMap(null); } callback(results, status); }); }, /** * Displays the panorama for a given LatLng or panorama ID. * @param panel:jQuery/String/Node * @param streetViewPanoramaOptions:google.maps.StreetViewPanoramaOptions (optional) * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#StreetViewPanoramaOptions */ displayStreetView: function(panel, streetViewPanoramaOptions) { this.get('map').setStreetView(this.get('services > StreetViewPanorama', new google.maps.StreetViewPanorama(this._unwrap(panel), streetViewPanoramaOptions))); }, /** * A service for converting between an address and a LatLng. * @param geocoderRequest:google.maps.GeocoderRequest * @param callback:function(result:google.maps.GeocoderResult, status:google.maps.GeocoderStatus), * @see http://code.google.com/intl/sv-SE/apis/maps/documentation/javascript/reference.html#GeocoderResult */ search: function(geocoderRequest, callback) { this.get('services > Geocoder', new google.maps.Geocoder()).geocode(geocoderRequest, callback); } }); } (jQuery) );
{ "pile_set_name": "Github" }
.. highlightlang:: c .. _type-structs: Type Objects ============ Perhaps one of the most important structures of the Python object system is the structure that defines a new type: the :c:type:`PyTypeObject` structure. Type objects can be handled using any of the :c:func:`PyObject_\*` or :c:func:`PyType_\*` functions, but do not offer much that's interesting to most Python applications. These objects are fundamental to how objects behave, so they are very important to the interpreter itself and to any extension module that implements new types. Type objects are fairly large compared to most of the standard types. The reason for the size is that each type object stores a large number of values, mostly C function pointers, each of which implements a small part of the type's functionality. The fields of the type object are examined in detail in this section. The fields will be described in the order in which they occur in the structure. Typedefs: unaryfunc, binaryfunc, ternaryfunc, inquiry, intargfunc, intintargfunc, intobjargproc, intintobjargproc, objobjargproc, destructor, freefunc, printfunc, getattrfunc, getattrofunc, setattrfunc, setattrofunc, reprfunc, hashfunc The structure definition for :c:type:`PyTypeObject` can be found in :file:`Include/object.h`. For convenience of reference, this repeats the definition found there: .. literalinclude:: ../includes/typestruct.h The type object structure extends the :c:type:`PyVarObject` structure. The :attr:`ob_size` field is used for dynamic types (created by :func:`type_new`, usually called from a class statement). Note that :c:data:`PyType_Type` (the metatype) initializes :c:member:`~PyTypeObject.tp_itemsize`, which means that its instances (i.e. type objects) *must* have the :attr:`ob_size` field. .. c:member:: PyObject* PyObject._ob_next PyObject* PyObject._ob_prev These fields are only present when the macro ``Py_TRACE_REFS`` is defined. Their initialization to *NULL* is taken care of by the ``PyObject_HEAD_INIT`` macro. For statically allocated objects, these fields always remain *NULL*. For dynamically allocated objects, these two fields are used to link the object into a doubly-linked list of *all* live objects on the heap. This could be used for various debugging purposes; currently the only use is to print the objects that are still alive at the end of a run when the environment variable :envvar:`PYTHONDUMPREFS` is set. These fields are not inherited by subtypes. .. c:member:: Py_ssize_t PyObject.ob_refcnt This is the type object's reference count, initialized to ``1`` by the ``PyObject_HEAD_INIT`` macro. Note that for statically allocated type objects, the type's instances (objects whose :attr:`ob_type` points back to the type) do *not* count as references. But for dynamically allocated type objects, the instances *do* count as references. This field is not inherited by subtypes. .. c:member:: PyTypeObject* PyObject.ob_type This is the type's type, in other words its metatype. It is initialized by the argument to the ``PyObject_HEAD_INIT`` macro, and its value should normally be ``&PyType_Type``. However, for dynamically loadable extension modules that must be usable on Windows (at least), the compiler complains that this is not a valid initializer. Therefore, the convention is to pass *NULL* to the ``PyObject_HEAD_INIT`` macro and to initialize this field explicitly at the start of the module's initialization function, before doing anything else. This is typically done like this:: Foo_Type.ob_type = &PyType_Type; This should be done before any instances of the type are created. :c:func:`PyType_Ready` checks if :attr:`ob_type` is *NULL*, and if so, initializes it to the :attr:`ob_type` field of the base class. :c:func:`PyType_Ready` will not change this field if it is non-zero. This field is inherited by subtypes. .. c:member:: Py_ssize_t PyVarObject.ob_size For statically allocated type objects, this should be initialized to zero. For dynamically allocated type objects, this field has a special internal meaning. This field is not inherited by subtypes. .. c:member:: char* PyTypeObject.tp_name Pointer to a NUL-terminated string containing the name of the type. For types that are accessible as module globals, the string should be the full module name, followed by a dot, followed by the type name; for built-in types, it should be just the type name. If the module is a submodule of a package, the full package name is part of the full module name. For example, a type named :class:`T` defined in module :mod:`M` in subpackage :mod:`Q` in package :mod:`P` should have the :c:member:`~PyTypeObject.tp_name` initializer ``"P.Q.M.T"``. For dynamically allocated type objects, this should just be the type name, and the module name explicitly stored in the type dict as the value for key ``'__module__'``. For statically allocated type objects, the tp_name field should contain a dot. Everything before the last dot is made accessible as the :attr:`__module__` attribute, and everything after the last dot is made accessible as the :attr:`__name__` attribute. If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is made accessible as the :attr:`__name__` attribute, and the :attr:`__module__` attribute is undefined (unless explicitly set in the dictionary, as explained above). This means your type will be impossible to pickle. This field is not inherited by subtypes. .. c:member:: Py_ssize_t PyTypeObject.tp_basicsize Py_ssize_t PyTypeObject.tp_itemsize These fields allow calculating the size in bytes of instances of the type. There are two kinds of types: types with fixed-length instances have a zero :c:member:`~PyTypeObject.tp_itemsize` field, types with variable-length instances have a non-zero :c:member:`~PyTypeObject.tp_itemsize` field. For a type with fixed-length instances, all instances have the same size, given in :c:member:`~PyTypeObject.tp_basicsize`. For a type with variable-length instances, the instances must have an :attr:`ob_size` field, and the instance size is :c:member:`~PyTypeObject.tp_basicsize` plus N times :c:member:`~PyTypeObject.tp_itemsize`, where N is the "length" of the object. The value of N is typically stored in the instance's :attr:`ob_size` field. There are exceptions: for example, ints use a negative :attr:`ob_size` to indicate a negative number, and N is ``abs(ob_size)`` there. Also, the presence of an :attr:`ob_size` field in the instance layout doesn't mean that the instance structure is variable-length (for example, the structure for the list type has fixed-length instances, yet those instances have a meaningful :attr:`ob_size` field). The basic size includes the fields in the instance declared by the macro :c:macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD` (whichever is used to declare the instance struct) and this in turn includes the :attr:`_ob_prev` and :attr:`_ob_next` fields if they are present. This means that the only correct way to get an initializer for the :c:member:`~PyTypeObject.tp_basicsize` is to use the ``sizeof`` operator on the struct used to declare the instance layout. The basic size does not include the GC header size. These fields are inherited separately by subtypes. If the base type has a non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is generally not safe to set :c:member:`~PyTypeObject.tp_itemsize` to a different non-zero value in a subtype (though this depends on the implementation of the base type). A note about alignment: if the variable items require a particular alignment, this should be taken care of by the value of :c:member:`~PyTypeObject.tp_basicsize`. Example: suppose a type implements an array of ``double``. :c:member:`~PyTypeObject.tp_itemsize` is ``sizeof(double)``. It is the programmer's responsibility that :c:member:`~PyTypeObject.tp_basicsize` is a multiple of ``sizeof(double)`` (assuming this is the alignment requirement for ``double``). .. c:member:: destructor PyTypeObject.tp_dealloc A pointer to the instance destructor function. This function must be defined unless the type guarantees that its instances will never be deallocated (as is the case for the singletons ``None`` and ``Ellipsis``). The destructor function is called by the :c:func:`Py_DECREF` and :c:func:`Py_XDECREF` macros when the new reference count is zero. At this point, the instance is still in existence, but there are no references to it. The destructor function should free all references which the instance owns, free all memory buffers owned by the instance (using the freeing function corresponding to the allocation function used to allocate the buffer), and finally (as its last action) call the type's :c:member:`~PyTypeObject.tp_free` function. If the type is not subtypable (doesn't have the :const:`Py_TPFLAGS_BASETYPE` flag bit set), it is permissible to call the object deallocator directly instead of via :c:member:`~PyTypeObject.tp_free`. The object deallocator should be the one used to allocate the instance; this is normally :c:func:`PyObject_Del` if the instance was allocated using :c:func:`PyObject_New` or :c:func:`PyObject_VarNew`, or :c:func:`PyObject_GC_Del` if the instance was allocated using :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar`. This field is inherited by subtypes. .. c:member:: printfunc PyTypeObject.tp_print An optional pointer to the instance print function. The print function is only called when the instance is printed to a *real* file; when it is printed to a pseudo-file (like a :class:`io.StringIO` instance), the instance's :c:member:`~PyTypeObject.tp_repr` or :c:member:`~PyTypeObject.tp_str` function is called to convert it to a string. These are also called when the type's :c:member:`~PyTypeObject.tp_print` field is *NULL*. A type should never implement :c:member:`~PyTypeObject.tp_print` in a way that produces different output than :c:member:`~PyTypeObject.tp_repr` or :c:member:`~PyTypeObject.tp_str` would. The print function is called with the same signature as :c:func:`PyObject_Print`: ``int tp_print(PyObject *self, FILE *file, int flags)``. The *self* argument is the instance to be printed. The *file* argument is the stdio file to which it is to be printed. The *flags* argument is composed of flag bits. The only flag bit currently defined is :const:`Py_PRINT_RAW`. When the :const:`Py_PRINT_RAW` flag bit is set, the instance should be printed the same way as :c:member:`~PyTypeObject.tp_str` would format it; when the :const:`Py_PRINT_RAW` flag bit is clear, the instance should be printed the same way as :c:member:`~PyTypeObject.tp_repr` would format it. It should return ``-1`` and set an exception condition when an error occurs. It is possible that the :c:member:`~PyTypeObject.tp_print` field will be deprecated. In any case, it is recommended not to define :c:member:`~PyTypeObject.tp_print`, but instead to rely on :c:member:`~PyTypeObject.tp_repr` and :c:member:`~PyTypeObject.tp_str` for printing. This field is inherited by subtypes. .. c:member:: getattrfunc PyTypeObject.tp_getattr An optional pointer to the get-attribute-string function. This field is deprecated. When it is defined, it should point to a function that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, but taking a C string instead of a Python string object to give the attribute name. The signature is the same as for :c:func:`PyObject_GetAttrString`. This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject.tp_getattro` from its base type when the subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject.tp_getattro` are both *NULL*. .. c:member:: setattrfunc PyTypeObject.tp_setattr An optional pointer to the set-attribute-string function. This field is deprecated. When it is defined, it should point to a function that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, but taking a C string instead of a Python string object to give the attribute name. The signature is the same as for :c:func:`PyObject_SetAttrString`. This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` from its base type when the subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` are both *NULL*. .. c:member:: void* PyTypeObject.tp_reserved Reserved slot, formerly known as tp_compare. .. c:member:: reprfunc PyTypeObject.tp_repr .. index:: builtin: repr An optional pointer to a function that implements the built-in function :func:`repr`. The signature is the same as for :c:func:`PyObject_Repr`; it must return a string or a Unicode object. Ideally, this function should return a string that, when passed to :func:`eval`, given a suitable environment, returns an object with the same value. If this is not feasible, it should return a string starting with ``'<'`` and ending with ``'>'`` from which both the type and the value of the object can be deduced. When this field is not set, a string of the form ``<%s object at %p>`` is returned, where ``%s`` is replaced by the type name, and ``%p`` by the object's memory address. This field is inherited by subtypes. .. c:member:: PyNumberMethods* tp_as_number Pointer to an additional structure that contains fields relevant only to objects which implement the number protocol. These fields are documented in :ref:`number-structs`. The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the contained fields are inherited individually. .. c:member:: PySequenceMethods* tp_as_sequence Pointer to an additional structure that contains fields relevant only to objects which implement the sequence protocol. These fields are documented in :ref:`sequence-structs`. The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the contained fields are inherited individually. .. c:member:: PyMappingMethods* tp_as_mapping Pointer to an additional structure that contains fields relevant only to objects which implement the mapping protocol. These fields are documented in :ref:`mapping-structs`. The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the contained fields are inherited individually. .. c:member:: hashfunc PyTypeObject.tp_hash .. index:: builtin: hash An optional pointer to a function that implements the built-in function :func:`hash`. The signature is the same as for :c:func:`PyObject_Hash`; it must return a value of the type Py_hash_t. The value ``-1`` should not be returned as a normal return value; when an error occurs during the computation of the hash value, the function should set an exception and return ``-1``. This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to block inheritance of the hash method from a parent type. This is interpreted as the equivalent of ``__hash__ = None`` at the Python level, causing ``isinstance(o, collections.Hashable)`` to correctly return ``False``. Note that the converse is also true - setting ``__hash__ = None`` on a class at the Python level will result in the ``tp_hash`` slot being set to :c:func:`PyObject_HashNotImplemented`. When this field is not set, an attempt to take the hash of the object raises :exc:`TypeError`. This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash`, when the subtype's :c:member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both *NULL*. .. c:member:: ternaryfunc PyTypeObject.tp_call An optional pointer to a function that implements calling the object. This should be *NULL* if the object is not callable. The signature is the same as for :c:func:`PyObject_Call`. This field is inherited by subtypes. .. c:member:: reprfunc PyTypeObject.tp_str An optional pointer to a function that implements the built-in operation :func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls the constructor for that type. This constructor calls :c:func:`PyObject_Str` to do the actual work, and :c:func:`PyObject_Str` will call this handler.) The signature is the same as for :c:func:`PyObject_Str`; it must return a string or a Unicode object. This function should return a "friendly" string representation of the object, as this is the representation that will be used, among other things, by the :func:`print` function. When this field is not set, :c:func:`PyObject_Repr` is called to return a string representation. This field is inherited by subtypes. .. c:member:: getattrofunc PyTypeObject.tp_getattro An optional pointer to the get-attribute function. The signature is the same as for :c:func:`PyObject_GetAttr`. It is usually convenient to set this field to :c:func:`PyObject_GenericGetAttr`, which implements the normal way of looking for object attributes. This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject.tp_getattro` from its base type when the subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject.tp_getattro` are both *NULL*. .. c:member:: setattrofunc PyTypeObject.tp_setattro An optional pointer to the set-attribute function. The signature is the same as for :c:func:`PyObject_SetAttr`. It is usually convenient to set this field to :c:func:`PyObject_GenericSetAttr`, which implements the normal way of setting object attributes. This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` from its base type when the subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` are both *NULL*. .. c:member:: PyBufferProcs* PyTypeObject.tp_as_buffer Pointer to an additional structure that contains fields relevant only to objects which implement the buffer interface. These fields are documented in :ref:`buffer-structs`. The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the contained fields are inherited individually. .. c:member:: long PyTypeObject.tp_flags This field is a bit mask of various flags. Some flags indicate variant semantics for certain situations; others are used to indicate that certain fields in the type object (or in the extension structures referenced via :c:member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject.tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, and :c:member:`~PyTypeObject.tp_as_buffer`) that were historically not always present are valid; if such a flag bit is clear, the type fields it guards must not be accessed and must be considered to have a zero or *NULL* value instead. Inheritance of this field is complicated. Most flag bits are inherited individually, i.e. if the base type has a flag bit set, the subtype inherits this flag bit. The flag bits that pertain to extension structures are strictly inherited if the extension structure is inherited, i.e. the base type's value of the flag bit is copied into the subtype together with a pointer to the extension structure. The :const:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if the :const:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and the :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have *NULL* values. The following bit masks are currently defined; these can be ORed together using the ``|`` operator to form the value of the :c:member:`~PyTypeObject.tp_flags` field. The macro :c:func:`PyType_HasFeature` takes a type and a flags value, *tp* and *f*, and checks whether ``tp->tp_flags & f`` is non-zero. .. data:: Py_TPFLAGS_HEAPTYPE This bit is set when the type object itself is allocated on the heap. In this case, the :attr:`ob_type` field of its instances is considered a reference to the type, and the type object is INCREF'ed when a new instance is created, and DECREF'ed when an instance is destroyed (this does not apply to instances of subtypes; only the type referenced by the instance's ob_type gets INCREF'ed or DECREF'ed). .. data:: Py_TPFLAGS_BASETYPE This bit is set when the type can be used as the base type of another type. If this bit is clear, the type cannot be subtyped (similar to a "final" class in Java). .. data:: Py_TPFLAGS_READY This bit is set when the type object has been fully initialized by :c:func:`PyType_Ready`. .. data:: Py_TPFLAGS_READYING This bit is set while :c:func:`PyType_Ready` is in the process of initializing the type object. .. data:: Py_TPFLAGS_HAVE_GC This bit is set when the object supports garbage collection. If this bit is set, instances must be created using :c:func:`PyObject_GC_New` and destroyed using :c:func:`PyObject_GC_Del`. More information in section :ref:`supporting-cycle-detection`. This bit also implies that the GC-related fields :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` are present in the type object. .. data:: Py_TPFLAGS_DEFAULT This is a bitmask of all the bits that pertain to the existence of certain fields in the type object and its extension structures. Currently, it includes the following bits: :const:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`, :const:`Py_TPFLAGS_HAVE_VERSION_TAG`. .. c:member:: char* PyTypeObject.tp_doc An optional pointer to a NUL-terminated C string giving the docstring for this type object. This is exposed as the :attr:`__doc__` attribute on the type and instances of the type. This field is *not* inherited by subtypes. .. c:member:: traverseproc PyTypeObject.tp_traverse An optional pointer to a traversal function for the garbage collector. This is only used if the :const:`Py_TPFLAGS_HAVE_GC` flag bit is set. More information about Python's garbage collection scheme can be found in section :ref:`supporting-cycle-detection`. The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage collector to detect reference cycles. A typical implementation of a :c:member:`~PyTypeObject.tp_traverse` function simply calls :c:func:`Py_VISIT` on each of the instance's members that are Python objects. For example, this is function :c:func:`local_traverse` from the :mod:`_thread` extension module:: static int local_traverse(localobject *self, visitproc visit, void *arg) { Py_VISIT(self->args); Py_VISIT(self->kw); Py_VISIT(self->dict); return 0; } Note that :c:func:`Py_VISIT` is called only on those members that can participate in reference cycles. Although there is also a ``self->key`` member, it can only be *NULL* or a Python string and therefore cannot be part of a reference cycle. On the other hand, even if you know a member can never be part of a cycle, as a debugging aid you may want to visit it anyway just so the :mod:`gc` module's :func:`~gc.get_referents` function will include it. Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to :c:func:`local_traverse` to have these specific names; don't name them just anything. This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_clear` and the :const:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type if they are all zero in the subtype. .. c:member:: inquiry PyTypeObject.tp_clear An optional pointer to a clear function for the garbage collector. This is only used if the :const:`Py_TPFLAGS_HAVE_GC` flag bit is set. The :c:member:`~PyTypeObject.tp_clear` member function is used to break reference cycles in cyclic garbage detected by the garbage collector. Taken together, all :c:member:`~PyTypeObject.tp_clear` functions in the system must combine to break all reference cycles. This is subtle, and if in any doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For example, the tuple type does not implement a :c:member:`~PyTypeObject.tp_clear` function, because it's possible to prove that no reference cycle can be composed entirely of tuples. Therefore the :c:member:`~PyTypeObject.tp_clear` functions of other types must be sufficient to break any cycle containing a tuple. This isn't immediately obvious, and there's rarely a good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`. Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the instance's references to those of its members that may be Python objects, and set its pointers to those members to *NULL*, as in the following example:: static int local_clear(localobject *self) { Py_CLEAR(self->key); Py_CLEAR(self->args); Py_CLEAR(self->kw); Py_CLEAR(self->dict); return 0; } The :c:func:`Py_CLEAR` macro should be used, because clearing references is delicate: the reference to the contained object must not be decremented until after the pointer to the contained object is set to *NULL*. This is because decrementing the reference count may cause the contained object to become trash, triggering a chain of reclamation activity that may include invoking arbitrary Python code (due to finalizers, or weakref callbacks, associated with the contained object). If it's possible for such code to reference *self* again, it's important that the pointer to the contained object be *NULL* at that time, so that *self* knows the contained object can no longer be used. The :c:func:`Py_CLEAR` macro performs the operations in a safe order. Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break reference cycles, it's not necessary to clear contained objects like Python strings or Python integers, which can't participate in reference cycles. On the other hand, it may be convenient to clear all contained Python objects, and write the type's :c:member:`~PyTypeObject.tp_dealloc` function to invoke :c:member:`~PyTypeObject.tp_clear`. More information about Python's garbage collection scheme can be found in section :ref:`supporting-cycle-detection`. This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_traverse` and the :const:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type if they are all zero in the subtype. .. c:member:: richcmpfunc PyTypeObject.tp_richcompare An optional pointer to the rich comparison function, whose signature is ``PyObject *tp_richcompare(PyObject *a, PyObject *b, int op)``. The function should return the result of the comparison (usually ``Py_True`` or ``Py_False``). If the comparison is undefined, it must return ``Py_NotImplemented``, if another error occurred it must return ``NULL`` and set an exception condition. .. note:: If you want to implement a type for which only a limited set of comparisons makes sense (e.g. ``==`` and ``!=``, but not ``<`` and friends), directly raise :exc:`TypeError` in the rich comparison function. This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` when the subtype's :c:member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both *NULL*. The following constants are defined to be used as the third argument for :c:member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`: +----------------+------------+ | Constant | Comparison | +================+============+ | :const:`Py_LT` | ``<`` | +----------------+------------+ | :const:`Py_LE` | ``<=`` | +----------------+------------+ | :const:`Py_EQ` | ``==`` | +----------------+------------+ | :const:`Py_NE` | ``!=`` | +----------------+------------+ | :const:`Py_GT` | ``>`` | +----------------+------------+ | :const:`Py_GE` | ``>=`` | +----------------+------------+ .. c:member:: long PyTypeObject.tp_weaklistoffset If the instances of this type are weakly referenceable, this field is greater than zero and contains the offset in the instance structure of the weak reference list head (ignoring the GC header, if present); this offset is used by :c:func:`PyObject_ClearWeakRefs` and the :c:func:`PyWeakref_\*` functions. The instance structure needs to include a field of type :c:type:`PyObject\*` which is initialized to *NULL*. Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that is the list head for weak references to the type object itself. This field is inherited by subtypes, but see the rules listed below. A subtype may override this offset; this means that the subtype uses a different weak reference list head than the base type. Since the list head is always found via :c:member:`~PyTypeObject.tp_weaklistoffset`, this should not be a problem. When a type defined by a class statement has no :attr:`~object.__slots__` declaration, and none of its base types are weakly referenceable, the type is made weakly referenceable by adding a weak reference list head slot to the instance layout and setting the :c:member:`~PyTypeObject.tp_weaklistoffset` of that slot's offset. When a type's :attr:`__slots__` declaration contains a slot named :attr:`__weakref__`, that slot becomes the weak reference list head for instances of the type, and the slot's offset is stored in the type's :c:member:`~PyTypeObject.tp_weaklistoffset`. When a type's :attr:`__slots__` declaration does not contain a slot named :attr:`__weakref__`, the type inherits its :c:member:`~PyTypeObject.tp_weaklistoffset` from its base type. .. c:member:: getiterfunc PyTypeObject.tp_iter An optional pointer to a function that returns an iterator for the object. Its presence normally signals that the instances of this type are iterable (although sequences may be iterable without this function). This function has the same signature as :c:func:`PyObject_GetIter`. This field is inherited by subtypes. .. c:member:: iternextfunc PyTypeObject.tp_iternext An optional pointer to a function that returns the next item in an iterator. When the iterator is exhausted, it must return *NULL*; a :exc:`StopIteration` exception may or may not be set. When another error occurs, it must return *NULL* too. Its presence signals that the instances of this type are iterators. Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` function, and that function should return the iterator instance itself (not a new iterator instance). This function has the same signature as :c:func:`PyIter_Next`. This field is inherited by subtypes. .. c:member:: struct PyMethodDef* PyTypeObject.tp_methods An optional pointer to a static *NULL*-terminated array of :c:type:`PyMethodDef` structures, declaring regular methods of this type. For each entry in the array, an entry is added to the type's dictionary (see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor. This field is not inherited by subtypes (methods are inherited through a different mechanism). .. c:member:: struct PyMemberDef* PyTypeObject.tp_members An optional pointer to a static *NULL*-terminated array of :c:type:`PyMemberDef` structures, declaring regular data members (fields or slots) of instances of this type. For each entry in the array, an entry is added to the type's dictionary (see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor. This field is not inherited by subtypes (members are inherited through a different mechanism). .. c:member:: struct PyGetSetDef* PyTypeObject.tp_getset An optional pointer to a static *NULL*-terminated array of :c:type:`PyGetSetDef` structures, declaring computed attributes of instances of this type. For each entry in the array, an entry is added to the type's dictionary (see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor. This field is not inherited by subtypes (computed attributes are inherited through a different mechanism). .. XXX belongs elsewhere Docs for PyGetSetDef:: typedef PyObject *(*getter)(PyObject *, void *); typedef int (*setter)(PyObject *, PyObject *, void *); typedef struct PyGetSetDef { char *name; /* attribute name */ getter get; /* C function to get the attribute */ setter set; /* C function to set the attribute */ char *doc; /* optional doc string */ void *closure; /* optional additional data for getter and setter */ } PyGetSetDef; .. c:member:: PyTypeObject* PyTypeObject.tp_base An optional pointer to a base type from which type properties are inherited. At this level, only single inheritance is supported; multiple inheritance require dynamically creating a type object by calling the metatype. This field is not inherited by subtypes (obviously), but it defaults to ``&PyBaseObject_Type`` (which to Python programmers is known as the type :class:`object`). .. c:member:: PyObject* PyTypeObject.tp_dict The type's dictionary is stored here by :c:func:`PyType_Ready`. This field should normally be initialized to *NULL* before PyType_Ready is called; it may also be initialized to a dictionary containing initial attributes for the type. Once :c:func:`PyType_Ready` has initialized the type, extra attributes for the type may be added to this dictionary only if they don't correspond to overloaded operations (like :meth:`__add__`). This field is not inherited by subtypes (though the attributes defined in here are inherited through a different mechanism). .. warning:: It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:member:`~PyTypeObject.tp_dict` with the dictionary C-API. .. c:member:: descrgetfunc PyTypeObject.tp_descr_get An optional pointer to a "descriptor get" function. The function signature is :: PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type); .. XXX explain. This field is inherited by subtypes. .. c:member:: descrsetfunc PyTypeObject.tp_descr_set An optional pointer to a "descriptor set" function. The function signature is :: int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value); This field is inherited by subtypes. .. XXX explain. .. c:member:: long PyTypeObject.tp_dictoffset If the instances of this type have a dictionary containing instance variables, this field is non-zero and contains the offset in the instances of the type of the instance variable dictionary; this offset is used by :c:func:`PyObject_GenericGetAttr`. Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is the dictionary for attributes of the type object itself. If the value of this field is greater than zero, it specifies the offset from the start of the instance structure. If the value is less than zero, it specifies the offset from the *end* of the instance structure. A negative offset is more expensive to use, and should only be used when the instance structure contains a variable-length part. This is used for example to add an instance variable dictionary to subtypes of :class:`str` or :class:`tuple`. Note that the :c:member:`~PyTypeObject.tp_basicsize` field should account for the dictionary added to the end in that case, even though the dictionary is not included in the basic object layout. On a system with a pointer size of 4 bytes, :c:member:`~PyTypeObject.tp_dictoffset` should be set to ``-4`` to indicate that the dictionary is at the very end of the structure. The real dictionary offset in an instance can be computed from a negative :c:member:`~PyTypeObject.tp_dictoffset` as follows:: dictoffset = tp_basicsize + abs(ob_size)*tp_itemsize + tp_dictoffset if dictoffset is not aligned on sizeof(void*): round up to sizeof(void*) where :c:member:`~PyTypeObject.tp_basicsize`, :c:member:`~PyTypeObject.tp_itemsize` and :c:member:`~PyTypeObject.tp_dictoffset` are taken from the type object, and :attr:`ob_size` is taken from the instance. The absolute value is taken because ints use the sign of :attr:`ob_size` to store the sign of the number. (There's never a need to do this calculation yourself; it is done for you by :c:func:`_PyObject_GetDictPtr`.) This field is inherited by subtypes, but see the rules listed below. A subtype may override this offset; this means that the subtype instances store the dictionary at a difference offset than the base type. Since the dictionary is always found via :c:member:`~PyTypeObject.tp_dictoffset`, this should not be a problem. When a type defined by a class statement has no :attr:`~object.__slots__` declaration, and none of its base types has an instance variable dictionary, a dictionary slot is added to the instance layout and the :c:member:`~PyTypeObject.tp_dictoffset` is set to that slot's offset. When a type defined by a class statement has a :attr:`__slots__` declaration, the type inherits its :c:member:`~PyTypeObject.tp_dictoffset` from its base type. (Adding a slot named :attr:`~object.__dict__` to the :attr:`__slots__` declaration does not have the expected effect, it just causes confusion. Maybe this should be added as a feature just like :attr:`__weakref__` though.) .. c:member:: initproc PyTypeObject.tp_init An optional pointer to an instance initialization function. This function corresponds to the :meth:`__init__` method of classes. Like :meth:`__init__`, it is possible to create an instance without calling :meth:`__init__`, and it is possible to reinitialize an instance by calling its :meth:`__init__` method again. The function signature is :: int tp_init(PyObject *self, PyObject *args, PyObject *kwds) The self argument is the instance to be initialized; the *args* and *kwds* arguments represent positional and keyword arguments of the call to :meth:`__init__`. The :c:member:`~PyTypeObject.tp_init` function, if not *NULL*, is called when an instance is created normally by calling its type, after the type's :c:member:`~PyTypeObject.tp_new` function has returned an instance of the type. If the :c:member:`~PyTypeObject.tp_new` function returns an instance of some other type that is not a subtype of the original type, no :c:member:`~PyTypeObject.tp_init` function is called; if :c:member:`~PyTypeObject.tp_new` returns an instance of a subtype of the original type, the subtype's :c:member:`~PyTypeObject.tp_init` is called. This field is inherited by subtypes. .. c:member:: allocfunc PyTypeObject.tp_alloc An optional pointer to an instance allocation function. The function signature is :: PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems) The purpose of this function is to separate memory allocation from memory initialization. It should return a pointer to a block of memory of adequate length for the instance, suitably aligned, and initialized to zeros, but with :attr:`ob_refcnt` set to ``1`` and :attr:`ob_type` set to the type argument. If the type's :c:member:`~PyTypeObject.tp_itemsize` is non-zero, the object's :attr:`ob_size` field should be initialized to *nitems* and the length of the allocated memory block should be ``tp_basicsize + nitems*tp_itemsize``, rounded up to a multiple of ``sizeof(void*)``; otherwise, *nitems* is not used and the length of the block should be :c:member:`~PyTypeObject.tp_basicsize`. Do not use this function to do any other instance initialization, not even to allocate additional memory; that should be done by :c:member:`~PyTypeObject.tp_new`. This field is inherited by static subtypes, but not by dynamic subtypes (subtypes created by a class statement); in the latter, this field is always set to :c:func:`PyType_GenericAlloc`, to force a standard heap allocation strategy. That is also the recommended value for statically defined types. .. c:member:: newfunc PyTypeObject.tp_new An optional pointer to an instance creation function. If this function is *NULL* for a particular type, that type cannot be called to create new instances; presumably there is some other way to create instances, like a factory function. The function signature is :: PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) The subtype argument is the type of the object being created; the *args* and *kwds* arguments represent positional and keyword arguments of the call to the type. Note that subtype doesn't have to equal the type whose :c:member:`~PyTypeObject.tp_new` function is called; it may be a subtype of that type (but not an unrelated type). The :c:member:`~PyTypeObject.tp_new` function should call ``subtype->tp_alloc(subtype, nitems)`` to allocate space for the object, and then do only as much further initialization as is absolutely necessary. Initialization that can safely be ignored or repeated should be placed in the :c:member:`~PyTypeObject.tp_init` handler. A good rule of thumb is that for immutable types, all initialization should take place in :c:member:`~PyTypeObject.tp_new`, while for mutable types, most initialization should be deferred to :c:member:`~PyTypeObject.tp_init`. This field is inherited by subtypes, except it is not inherited by static types whose :c:member:`~PyTypeObject.tp_base` is *NULL* or ``&PyBaseObject_Type``. .. c:member:: destructor PyTypeObject.tp_free An optional pointer to an instance deallocation function. Its signature is :c:type:`freefunc`:: void tp_free(void *) An initializer that is compatible with this signature is :c:func:`PyObject_Free`. This field is inherited by static subtypes, but not by dynamic subtypes (subtypes created by a class statement); in the latter, this field is set to a deallocator suitable to match :c:func:`PyType_GenericAlloc` and the value of the :const:`Py_TPFLAGS_HAVE_GC` flag bit. .. c:member:: inquiry PyTypeObject.tp_is_gc An optional pointer to a function called by the garbage collector. The garbage collector needs to know whether a particular object is collectible or not. Normally, it is sufficient to look at the object's type's :c:member:`~PyTypeObject.tp_flags` field, and check the :const:`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture of statically and dynamically allocated instances, and the statically allocated instances are not collectible. Such types should define this function; it should return ``1`` for a collectible instance, and ``0`` for a non-collectible instance. The signature is :: int tp_is_gc(PyObject *self) (The only example of this are types themselves. The metatype, :c:data:`PyType_Type`, defines this function to distinguish between statically and dynamically allocated types.) This field is inherited by subtypes. .. c:member:: PyObject* PyTypeObject.tp_bases Tuple of base types. This is set for types created by a class statement. It should be *NULL* for statically defined types. This field is not inherited. .. c:member:: PyObject* PyTypeObject.tp_mro Tuple containing the expanded set of base types, starting with the type itself and ending with :class:`object`, in Method Resolution Order. This field is not inherited; it is calculated fresh by :c:func:`PyType_Ready`. .. c:member:: PyObject* PyTypeObject.tp_cache Unused. Not inherited. Internal use only. .. c:member:: PyObject* PyTypeObject.tp_subclasses List of weak references to subclasses. Not inherited. Internal use only. .. c:member:: PyObject* PyTypeObject.tp_weaklist Weak reference list head, for weak references to this type object. Not inherited. Internal use only. The remaining fields are only defined if the feature test macro :const:`COUNT_ALLOCS` is defined, and are for internal use only. They are documented here for completeness. None of these fields are inherited by subtypes. .. c:member:: Py_ssize_t PyTypeObject.tp_allocs Number of allocations. .. c:member:: Py_ssize_t PyTypeObject.tp_frees Number of frees. .. c:member:: Py_ssize_t PyTypeObject.tp_maxalloc Maximum simultaneously allocated objects. .. c:member:: PyTypeObject* PyTypeObject.tp_next Pointer to the next type object with a non-zero :c:member:`~PyTypeObject.tp_allocs` field. Also, note that, in a garbage collected Python, tp_dealloc may be called from any Python thread, not just the thread which created the object (if the object becomes part of a refcount cycle, that cycle might be collected by a garbage collection on any thread). This is not a problem for Python API calls, since the thread on which tp_dealloc is called will own the Global Interpreter Lock (GIL). However, if the object being destroyed in turn destroys objects from some other C or C++ library, care should be taken to ensure that destroying those objects on the thread which called tp_dealloc will not violate any assumptions of the library. .. _number-structs: Number Object Structures ======================== .. sectionauthor:: Amaury Forgeot d'Arc .. c:type:: PyNumberMethods This structure holds pointers to the functions which an object uses to implement the number protocol. Each function is used by the function of similar name documented in the :ref:`number` section. Here is the structure definition:: typedef struct { binaryfunc nb_add; binaryfunc nb_subtract; binaryfunc nb_multiply; binaryfunc nb_remainder; binaryfunc nb_divmod; ternaryfunc nb_power; unaryfunc nb_negative; unaryfunc nb_positive; unaryfunc nb_absolute; inquiry nb_bool; unaryfunc nb_invert; binaryfunc nb_lshift; binaryfunc nb_rshift; binaryfunc nb_and; binaryfunc nb_xor; binaryfunc nb_or; unaryfunc nb_int; void *nb_reserved; unaryfunc nb_float; binaryfunc nb_inplace_add; binaryfunc nb_inplace_subtract; binaryfunc nb_inplace_multiply; binaryfunc nb_inplace_remainder; ternaryfunc nb_inplace_power; binaryfunc nb_inplace_lshift; binaryfunc nb_inplace_rshift; binaryfunc nb_inplace_and; binaryfunc nb_inplace_xor; binaryfunc nb_inplace_or; binaryfunc nb_floor_divide; binaryfunc nb_true_divide; binaryfunc nb_inplace_floor_divide; binaryfunc nb_inplace_true_divide; unaryfunc nb_index; } PyNumberMethods; .. note:: Binary and ternary functions must check the type of all their operands, and implement the necessary conversions (at least one of the operands is an instance of the defined type). If the operation is not defined for the given operands, binary and ternary functions must return ``Py_NotImplemented``, if another error occurred they must return ``NULL`` and set an exception. .. note:: The :c:data:`nb_reserved` field should always be ``NULL``. It was previously called :c:data:`nb_long`, and was renamed in Python 3.0.1. .. _mapping-structs: Mapping Object Structures ========================= .. sectionauthor:: Amaury Forgeot d'Arc .. c:type:: PyMappingMethods This structure holds pointers to the functions which an object uses to implement the mapping protocol. It has three members: .. c:member:: lenfunc PyMappingMethods.mp_length This function is used by :c:func:`PyMapping_Length` and :c:func:`PyObject_Size`, and has the same signature. This slot may be set to *NULL* if the object has no defined length. .. c:member:: binaryfunc PyMappingMethods.mp_subscript This function is used by :c:func:`PyObject_GetItem` and has the same signature. This slot must be filled for the :c:func:`PyMapping_Check` function to return ``1``, it can be *NULL* otherwise. .. c:member:: objobjargproc PyMappingMethods.mp_ass_subscript This function is used by :c:func:`PyObject_SetItem` and has the same signature. If this slot is *NULL*, the object does not support item assignment. .. _sequence-structs: Sequence Object Structures ========================== .. sectionauthor:: Amaury Forgeot d'Arc .. c:type:: PySequenceMethods This structure holds pointers to the functions which an object uses to implement the sequence protocol. .. c:member:: lenfunc PySequenceMethods.sq_length This function is used by :c:func:`PySequence_Size` and :c:func:`PyObject_Size`, and has the same signature. .. c:member:: binaryfunc PySequenceMethods.sq_concat This function is used by :c:func:`PySequence_Concat` and has the same signature. It is also used by the ``+`` operator, after trying the numeric addition via the :c:member:`~PyTypeObject.tp_as_number.nb_add` slot. .. c:member:: ssizeargfunc PySequenceMethods.sq_repeat This function is used by :c:func:`PySequence_Repeat` and has the same signature. It is also used by the ``*`` operator, after trying numeric multiplication via the :c:member:`~PyTypeObject.tp_as_number.nb_mul` slot. .. c:member:: ssizeargfunc PySequenceMethods.sq_item This function is used by :c:func:`PySequence_GetItem` and has the same signature. This slot must be filled for the :c:func:`PySequence_Check` function to return ``1``, it can be *NULL* otherwise. Negative indexes are handled as follows: if the :attr:`sq_length` slot is filled, it is called and the sequence length is used to compute a positive index which is passed to :attr:`sq_item`. If :attr:`sq_length` is *NULL*, the index is passed as is to the function. .. c:member:: ssizeobjargproc PySequenceMethods.sq_ass_item This function is used by :c:func:`PySequence_SetItem` and has the same signature. This slot may be left to *NULL* if the object does not support item assignment. .. c:member:: objobjproc PySequenceMethods.sq_contains This function may be used by :c:func:`PySequence_Contains` and has the same signature. This slot may be left to *NULL*, in this case :c:func:`PySequence_Contains` simply traverses the sequence until it finds a match. .. c:member:: binaryfunc PySequenceMethods.sq_inplace_concat This function is used by :c:func:`PySequence_InPlaceConcat` and has the same signature. It should modify its first operand, and return it. .. c:member:: ssizeargfunc PySequenceMethods.sq_inplace_repeat This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same signature. It should modify its first operand, and return it. .. XXX need to explain precedence between mapping and sequence .. XXX explains when to implement the sq_inplace_* slots .. _buffer-structs: Buffer Object Structures ======================== .. sectionauthor:: Greg J. Stein <[email protected]> .. sectionauthor:: Benjamin Peterson .. sectionauthor:: Stefan Krah .. c:type:: PyBufferProcs This structure holds pointers to the functions required by the :ref:`Buffer protocol <bufferobjects>`. The protocol defines how an exporter object can expose its internal data to consumer objects. .. c:member:: getbufferproc PyBufferProcs.bf_getbuffer The signature of this function is:: int (PyObject *exporter, Py_buffer *view, int flags); Handle a request to *exporter* to fill in *view* as specified by *flags*. Except for point (3), an implementation of this function MUST take these steps: (1) Check if the request can be met. If not, raise :c:data:`PyExc_BufferError`, set :c:data:`view->obj` to *NULL* and return -1. (2) Fill in the requested fields. (3) Increment an internal counter for the number of exports. (4) Set :c:data:`view->obj` to *exporter* and increment :c:data:`view->obj`. (5) Return 0. If *exporter* is part of a chain or tree of buffer providers, two main schemes can be used: * Re-export: Each member of the tree acts as the exporting object and sets :c:data:`view->obj` to a new reference to itself. * Redirect: The buffer request is redirected to the root object of the tree. Here, :c:data:`view->obj` will be a new reference to the root object. The individual fields of *view* are described in section :ref:`Buffer structure <buffer-structure>`, the rules how an exporter must react to specific requests are in section :ref:`Buffer request types <buffer-request-types>`. All memory pointed to in the :c:type:`Py_buffer` structure belongs to the exporter and must remain valid until there are no consumers left. :c:member:`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides`, :c:member:`~Py_buffer.suboffsets` and :c:member:`~Py_buffer.internal` are read-only for the consumer. :c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes buffer while dealing correctly with all request types. :c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps this function. .. c:member:: releasebufferproc PyBufferProcs.bf_releasebuffer The signature of this function is:: void (PyObject *exporter, Py_buffer *view); Handle a request to release the resources of the buffer. If no resources need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be *NULL*. Otherwise, a standard implementation of this function will take these optional steps: (1) Decrement an internal counter for the number of exports. (2) If the counter is 0, free all memory associated with *view*. The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep track of buffer-specific resources. This field is guaranteed to remain constant, while a consumer MAY pass a copy of the original buffer as the *view* argument. This function MUST NOT decrement :c:data:`view->obj`, since that is done automatically in :c:func:`PyBuffer_Release` (this scheme is useful for breaking reference cycles). :c:func:`PyBuffer_Release` is the interface for the consumer that wraps this function.
{ "pile_set_name": "Github" }
//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 // UNSUPPORTED: libcpp-no-deduction-guides // <string_view> // Test that the constructors offered by std::basic_string_view are formulated // so they're compatible with implicit deduction guides. #include <string_view> #include <cassert> #include "test_macros.h" #include "constexpr_char_traits.h" // Overloads // --------------- // (1) basic_string_view() - NOT TESTED // (2) basic_string_view(const basic_string_view&) // (3) basic_string_view(const CharT*, size_type) // (4) basic_string_view(const CharT*) int main(int, char**) { { // Testing (1) // Nothing to do. Cannot deduce without any arguments. } { // Testing (2) const std::string_view sin("abc"); std::basic_string_view s(sin); ASSERT_SAME_TYPE(decltype(s), std::string_view); assert(s == "abc"); using WSV = std::basic_string_view<wchar_t, constexpr_char_traits<wchar_t>>; const WSV win(L"abcdef"); std::basic_string_view w(win); ASSERT_SAME_TYPE(decltype(w), WSV); assert(w == L"abcdef"); } { // Testing (3) std::basic_string_view s("abc", 2); ASSERT_SAME_TYPE(decltype(s), std::string_view); assert(s == "ab"); std::basic_string_view w(L"abcdef", 4); ASSERT_SAME_TYPE(decltype(w), std::wstring_view); assert(w == L"abcd"); } { // Testing (4) std::basic_string_view s("abc"); ASSERT_SAME_TYPE(decltype(s), std::string_view); assert(s == "abc"); std::basic_string_view w(L"abcdef"); ASSERT_SAME_TYPE(decltype(w), std::wstring_view); assert(w == L"abcdef"); } return 0; }
{ "pile_set_name": "Github" }
package io.github.jhipster.sample.service.mapper; import io.github.jhipster.sample.domain.Authority; import io.github.jhipster.sample.domain.User; import io.github.jhipster.sample.service.dto.UserDTO; import org.springframework.stereotype.Service; import java.util.*; import java.util.stream.Collectors; /** * Mapper for the entity {@link User} and its DTO called {@link UserDTO}. * * Normal mappers are generated using MapStruct, this one is hand-coded as MapStruct * support is still in beta, and requires a manual step with an IDE. */ @Service public class UserMapper { public List<UserDTO> usersToUserDTOs(List<User> users) { return users.stream() .filter(Objects::nonNull) .map(this::userToUserDTO) .collect(Collectors.toList()); } public UserDTO userToUserDTO(User user) { return new UserDTO(user); } public List<User> userDTOsToUsers(List<UserDTO> userDTOs) { return userDTOs.stream() .filter(Objects::nonNull) .map(this::userDTOToUser) .collect(Collectors.toList()); } public User userDTOToUser(UserDTO userDTO) { if (userDTO == null) { return null; } else { User user = new User(); user.setId(userDTO.getId()); user.setLogin(userDTO.getLogin()); user.setFirstName(userDTO.getFirstName()); user.setLastName(userDTO.getLastName()); user.setEmail(userDTO.getEmail()); user.setImageUrl(userDTO.getImageUrl()); user.setActivated(userDTO.isActivated()); user.setLangKey(userDTO.getLangKey()); Set<Authority> authorities = this.authoritiesFromStrings(userDTO.getAuthorities()); user.setAuthorities(authorities); return user; } } private Set<Authority> authoritiesFromStrings(Set<String> authoritiesAsString) { Set<Authority> authorities = new HashSet<>(); if (authoritiesAsString != null) { authorities = authoritiesAsString.stream().map(string -> { Authority auth = new Authority(); auth.setName(string); return auth; }).collect(Collectors.toSet()); } return authorities; } public User userFromId(Long id) { if (id == null) { return null; } User user = new User(); user.setId(id); return user; } }
{ "pile_set_name": "Github" }
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object k; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform 3.75e-3; boundaryField { inlet { type fixedValue; value $internalField; } outlet { type inletOutlet; inletValue $internalField; value $internalField; } walls { type kqRWallFunction; value $internalField; } defaultFaces { type empty; } ACMI1_blockage { type kqRWallFunction; value $internalField; } ACMI1_couple { type cyclicACMI; value $internalField; } ACMI2_blockage { type kqRWallFunction; value $internalField; } ACMI2_couple { type cyclicACMI; value $internalField; } } // ************************************************************************* //
{ "pile_set_name": "Github" }
# Copyright (C) 2002-2019 Free Software Foundation, Inc. # # This file is part of GCC. # # GCC 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, or (at your option) # any later version. # # GCC 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 GCC; see the file COPYING3. If not see # <http://www.gnu.org/licenses/>. # Build the libraries for both hard and soft floating point MULTILIB_OPTIONS = EL/EB msoft-float mips2 MULTILIB_DIRNAMES = el eb soft-float mips2
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="refresh" content="0;URL=constant.PROC_PIDTASKALLINFO.html"> </head> <body> <p>Redirecting to <a href="constant.PROC_PIDTASKALLINFO.html">constant.PROC_PIDTASKALLINFO.html</a>...</p> <script>location.replace("constant.PROC_PIDTASKALLINFO.html" + location.search + location.hash);</script> </body> </html>
{ "pile_set_name": "Github" }
/* Copyright 2003-2015 Joaquin M Lopez Munoz. * 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/multi_index for library home page. */ #ifndef BOOST_MULTI_INDEX_DETAIL_INDEX_LOADER_HPP #define BOOST_MULTI_INDEX_DETAIL_INDEX_LOADER_HPP #if defined(_MSC_VER) #pragma once #endif #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <algorithm> #include <boost/archive/archive_exception.hpp> #include <boost/noncopyable.hpp> #include <boost/multi_index/detail/auto_space.hpp> #include <boost/multi_index/detail/raw_ptr.hpp> #include <boost/serialization/nvp.hpp> #include <boost/throw_exception.hpp> #include <cstddef> namespace boost{ namespace multi_index{ namespace detail{ /* Counterpart of index_saver (check index_saver.hpp for serialization * details.)* multi_index_container is in charge of supplying the info about * the base sequence, and each index can subsequently load itself using the * const interface of index_loader. */ template<typename Node,typename FinalNode,typename Allocator> class index_loader:private noncopyable { public: index_loader(const Allocator& al,std::size_t size): spc(al,size),size_(size),n(0),sorted(false) { } template<class Archive> void add(Node* node,Archive& ar,const unsigned int) { ar>>serialization::make_nvp("position",*node); entries()[n++]=node; } template<class Archive> void add_track(Node* node,Archive& ar,const unsigned int) { ar>>serialization::make_nvp("position",*node); } /* A rearranger is passed two nodes, and is expected to * reposition the second after the first. * If the first node is 0, then the second should be moved * to the beginning of the sequence. */ template<typename Rearranger,class Archive> void load(Rearranger r,Archive& ar,const unsigned int)const { FinalNode* prev=unchecked_load_node(ar); if(!prev)return; if(!sorted){ std::sort(entries(),entries()+size_); sorted=true; } check_node(prev); for(;;){ for(;;){ FinalNode* node=load_node(ar); if(!node)break; if(node==prev)prev=0; r(prev,node); prev=node; } prev=load_node(ar); if(!prev)break; } } private: Node** entries()const{return raw_ptr<Node**>(spc.data());} /* We try to delay sorting as much as possible just in case it * is not necessary, hence this version of load_node. */ template<class Archive> FinalNode* unchecked_load_node(Archive& ar)const { Node* node=0; ar>>serialization::make_nvp("pointer",node); return static_cast<FinalNode*>(node); } template<class Archive> FinalNode* load_node(Archive& ar)const { Node* node=0; ar>>serialization::make_nvp("pointer",node); check_node(node); return static_cast<FinalNode*>(node); } void check_node(Node* node)const { if(node!=0&&!std::binary_search(entries(),entries()+size_,node)){ throw_exception( archive::archive_exception( archive::archive_exception::other_exception)); } } auto_space<Node*,Allocator> spc; std::size_t size_; std::size_t n; mutable bool sorted; }; } /* namespace multi_index::detail */ } /* namespace multi_index */ } /* namespace boost */ #endif
{ "pile_set_name": "Github" }
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2015, Itseez Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's 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 name of the copyright holders may not 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 Intel Corporation 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. // //M*/ #ifndef OPENCV_HAL_NEON_UTILS_HPP #define OPENCV_HAL_NEON_UTILS_HPP #include "opencv2/core/cvdef.h" //! @addtogroup core_utils_neon //! @{ #if CV_NEON inline int32x2_t cv_vrnd_s32_f32(float32x2_t v) { static int32x2_t v_sign = vdup_n_s32(1 << 31), v_05 = vreinterpret_s32_f32(vdup_n_f32(0.5f)); int32x2_t v_addition = vorr_s32(v_05, vand_s32(v_sign, vreinterpret_s32_f32(v))); return vcvt_s32_f32(vadd_f32(v, vreinterpret_f32_s32(v_addition))); } inline int32x4_t cv_vrndq_s32_f32(float32x4_t v) { static int32x4_t v_sign = vdupq_n_s32(1 << 31), v_05 = vreinterpretq_s32_f32(vdupq_n_f32(0.5f)); int32x4_t v_addition = vorrq_s32(v_05, vandq_s32(v_sign, vreinterpretq_s32_f32(v))); return vcvtq_s32_f32(vaddq_f32(v, vreinterpretq_f32_s32(v_addition))); } inline uint32x2_t cv_vrnd_u32_f32(float32x2_t v) { static float32x2_t v_05 = vdup_n_f32(0.5f); return vcvt_u32_f32(vadd_f32(v, v_05)); } inline uint32x4_t cv_vrndq_u32_f32(float32x4_t v) { static float32x4_t v_05 = vdupq_n_f32(0.5f); return vcvtq_u32_f32(vaddq_f32(v, v_05)); } inline float32x4_t cv_vrecpq_f32(float32x4_t val) { float32x4_t reciprocal = vrecpeq_f32(val); reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal); reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal); return reciprocal; } inline float32x2_t cv_vrecp_f32(float32x2_t val) { float32x2_t reciprocal = vrecpe_f32(val); reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal); reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal); return reciprocal; } inline float32x4_t cv_vrsqrtq_f32(float32x4_t val) { float32x4_t e = vrsqrteq_f32(val); e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e); e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e); return e; } inline float32x2_t cv_vrsqrt_f32(float32x2_t val) { float32x2_t e = vrsqrte_f32(val); e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e); e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e); return e; } inline float32x4_t cv_vsqrtq_f32(float32x4_t val) { return cv_vrecpq_f32(cv_vrsqrtq_f32(val)); } inline float32x2_t cv_vsqrt_f32(float32x2_t val) { return cv_vrecp_f32(cv_vrsqrt_f32(val)); } #endif //! @} #endif // OPENCV_HAL_NEON_UTILS_HPP
{ "pile_set_name": "Github" }
package main // pure version import ( "flag" "github.com/Vonng/ac/lib" ) const ( defaultDictPath = "/ramdisk/vonng/dict.txt" defaultInputPath = "/ramdisk/vonng/video_title.txt" defaultOutputPath = "/ramdisk/vonng/vonng.txt" ) // args var ( dictPath string // dict path inputPath string // input path outputPath string // output path ) func main() { flag.StringVar(&inputPath, "i", defaultInputPath, "input filename") flag.StringVar(&outputPath, "o", defaultOutputPath, "output filename") flag.StringVar(&dictPath, "d", defaultDictPath, "dict filename") flag.Parse() lib.Run(inputPath, outputPath, dictPath) }
{ "pile_set_name": "Github" }
/* Highcharts funnel module, Beta (c) 2010-2012 Torstein Hønsi License: www.highcharts.com/license */ (function(d){var u=d.getOptions().plotOptions,p=d.seriesTypes,D=d.merge,z=function(){},A=d.each;u.funnel=D(u.pie,{center:["50%","50%"],width:"90%",neckWidth:"30%",height:"100%",neckHeight:"25%",dataLabels:{connectorWidth:1,connectorColor:"#606060"},size:!0,states:{select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}}});p.funnel=d.extendClass(p.pie,{type:"funnel",animate:z,translate:function(){var a=function(k,a){return/%$/.test(k)?a*parseInt(k,10)/100:parseInt(k,10)},g=0,e=this.chart,f=e.plotWidth, e=e.plotHeight,h=0,c=this.options,C=c.center,b=a(C[0],f),d=a(C[0],e),p=a(c.width,f),i,q,j=a(c.height,e),r=a(c.neckWidth,f),s=a(c.neckHeight,e),v=j-s,a=this.data,w,x,u=c.dataLabels.position==="left"?1:0,y,m,B,n,l,t,o;this.getWidthAt=q=function(k){return k>j-s||j===s?r:r+(p-r)*((j-s-k)/(j-s))};this.getX=function(k,a){return b+(a?-1:1)*(q(k)/2+c.dataLabels.distance)};this.center=[b,d,j];this.centerX=b;A(a,function(a){g+=a.y});A(a,function(a){o=null;x=g?a.y/g:0;m=d-j/2+h*j;l=m+x*j;i=q(m);y=b-i/2;B=y+ i;i=q(l);n=b-i/2;t=n+i;m>v?(y=n=b-r/2,B=t=b+r/2):l>v&&(o=l,i=q(v),n=b-i/2,t=n+i,l=v);w=["M",y,m,"L",B,m,t,l];o&&w.push(t,o,n,o);w.push(n,l,"Z");a.shapeType="path";a.shapeArgs={d:w};a.percentage=x*100;a.plotX=b;a.plotY=(m+(o||l))/2;a.tooltipPos=[b,a.plotY];a.slice=z;a.half=u;h+=x});this.setTooltipPoints()},drawPoints:function(){var a=this,g=a.options,e=a.chart.renderer;A(a.data,function(f){var h=f.graphic,c=f.shapeArgs;h?h.animate(c):f.graphic=e.path(c).attr({fill:f.color,stroke:g.borderColor,"stroke-width":g.borderWidth}).add(a.group)})}, sortByAngle:z,drawDataLabels:function(){var a=this.data,g=this.options.dataLabels.distance,e,f,h,c=a.length,d,b;for(this.center[2]-=2*g;c--;)h=a[c],f=(e=h.half)?1:-1,b=h.plotY,d=this.getX(b,e),h.labelPos=[0,b,d+(g-5)*f,b,d+g*f,b,e?"right":"left",0];p.pie.prototype.drawDataLabels.call(this)}})})(Highcharts);
{ "pile_set_name": "Github" }
if @error.nil? # page.replace_html "attendance-student-#{@student.id}-class-hour-#{@absentee.month_date}", :partial => 'attendance_cell' if @config.config_value=="Daily" page.replace_html "student-#{@student.id}-date-#{@absentee.month_date.strftime("%d-%m-%Y")}", :partial => 'attendance_cell' else page.replace_html "student-#{@student.id}-date-#{@absentee.month_date.strftime("%d-%m-%Y")}-timing-#{@absentee.class_timing_id}", :partial => 'attendance_cell' end page << "Modalbox.hide();" page.call "rebind" else page.replace_html 'form-errors', :partial => 'errors', :object => @absentee page.visual_effect(:highlight, 'form-errors') end
{ "pile_set_name": "Github" }
#!/usr/bin/env perl # Copyright 2009 The Go Authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. # This program reads a file containing function prototypes # (like syscall_solaris.go) and generates system call bodies. # The prototypes are marked by lines beginning with "//sys" # and read like func declarations if //sys is replaced by func, but: # * The parameter lists must give a name for each argument. # This includes return parameters. # * The parameter lists must give a type for each argument: # the (x, y, z int) shorthand is not allowed. # * If the return parameter is an error number, it must be named err. # * If go func name needs to be different than its libc name, # * or the function is not in libc, name could be specified # * at the end, after "=" sign, like # //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt use strict; my $cmdline = "mksyscall_solaris.pl " . join(' ', @ARGV); my $errors = 0; my $_32bit = ""; binmode STDOUT; if($ARGV[0] eq "-b32") { $_32bit = "big-endian"; shift; } elsif($ARGV[0] eq "-l32") { $_32bit = "little-endian"; shift; } if($ARGV[0] =~ /^-/) { print STDERR "usage: mksyscall_solaris.pl [-b32 | -l32] [file ...]\n"; exit 1; } if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { print STDERR "GOARCH or GOOS not defined in environment\n"; exit 1; } sub parseparamlist($) { my ($list) = @_; $list =~ s/^\s*//; $list =~ s/\s*$//; if($list eq "") { return (); } return split(/\s*,\s*/, $list); } sub parseparam($) { my ($p) = @_; if($p !~ /^(\S*) (\S*)$/) { print STDERR "$ARGV:$.: malformed parameter: $p\n"; $errors = 1; return ("xx", "int"); } return ($1, $2); } my $package = ""; my $text = ""; my $dynimports = ""; my $linknames = ""; my @vars = (); while(<>) { chomp; s/\s+/ /g; s/^\s+//; s/\s+$//; $package = $1 if !$package && /^package (\S+)$/; my $nonblock = /^\/\/sysnb /; next if !/^\/\/sys / && !$nonblock; # Line must be of the form # func Open(path string, mode int, perm int) (fd int, err error) # Split into name, in params, out params. if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) { print STDERR "$ARGV:$.: malformed //sys declaration\n"; $errors = 1; next; } my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6); # Split argument lists on comma. my @in = parseparamlist($in); my @out = parseparamlist($out); # So file name. if($modname eq "") { $modname = "libc"; } # System call name. if($sysname eq "") { $sysname = "$func"; } # System call pointer variable name. my $sysvarname = "proc$sysname"; my $strconvfunc = "BytePtrFromString"; my $strconvtype = "*byte"; $sysname =~ y/A-Z/a-z/; # All libc functions are lowercase. # Runtime import of function to allow cross-platform builds. $dynimports .= "//go:cgo_import_dynamic libc_${sysname} ${sysname} \"$modname.so\"\n"; # Link symbol to proc address variable. $linknames .= "//go:linkname ${sysvarname} libc_${sysname}\n"; # Library proc address variable. push @vars, $sysvarname; # Go function header. $out = join(', ', @out); if($out ne "") { $out = " ($out)"; } if($text ne "") { $text .= "\n" } $text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out; # Check if err return available my $errvar = ""; foreach my $p (@out) { my ($name, $type) = parseparam($p); if($type eq "error") { $errvar = $name; last; } } # Prepare arguments to Syscall. my @args = (); my @uses = (); my $n = 0; foreach my $p (@in) { my ($name, $type) = parseparam($p); if($type =~ /^\*/) { push @args, "uintptr(unsafe.Pointer($name))"; } elsif($type eq "string" && $errvar ne "") { $text .= "\tvar _p$n $strconvtype\n"; $text .= "\t_p$n, $errvar = $strconvfunc($name)\n"; $text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n"; push @args, "uintptr(unsafe.Pointer(_p$n))"; push @uses, "use(unsafe.Pointer(_p$n))"; $n++; } elsif($type eq "string") { print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n"; $text .= "\tvar _p$n $strconvtype\n"; $text .= "\t_p$n, _ = $strconvfunc($name)\n"; push @args, "uintptr(unsafe.Pointer(_p$n))"; push @uses, "use(unsafe.Pointer(_p$n))"; $n++; } elsif($type =~ /^\[\](.*)/) { # Convert slice into pointer, length. # Have to be careful not to take address of &a[0] if len == 0: # pass nil in that case. $text .= "\tvar _p$n *$1\n"; $text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n"; push @args, "uintptr(unsafe.Pointer(_p$n))", "uintptr(len($name))"; $n++; } elsif($type eq "int64" && $_32bit ne "") { if($_32bit eq "big-endian") { push @args, "uintptr($name >> 32)", "uintptr($name)"; } else { push @args, "uintptr($name)", "uintptr($name >> 32)"; } } elsif($type eq "bool") { $text .= "\tvar _p$n uint32\n"; $text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n"; push @args, "uintptr(_p$n)"; $n++; } else { push @args, "uintptr($name)"; } } my $nargs = @args; # Determine which form to use; pad args with zeros. my $asm = "sysvicall6"; if ($nonblock) { $asm = "rawSysvicall6"; } if(@args <= 6) { while(@args < 6) { push @args, "0"; } } else { print STDERR "$ARGV:$.: too many arguments to system call\n"; } # Actual call. my $args = join(', ', @args); my $call = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $args)"; # Assign return values. my $body = ""; my $failexpr = ""; my @ret = ("_", "_", "_"); my @pout= (); my $do_errno = 0; for(my $i=0; $i<@out; $i++) { my $p = $out[$i]; my ($name, $type) = parseparam($p); my $reg = ""; if($name eq "err") { $reg = "e1"; $ret[2] = $reg; $do_errno = 1; } else { $reg = sprintf("r%d", $i); $ret[$i] = $reg; } if($type eq "bool") { $reg = "$reg != 0"; } if($type eq "int64" && $_32bit ne "") { # 64-bit number in r1:r0 or r0:r1. if($i+2 > @out) { print STDERR "$ARGV:$.: not enough registers for int64 return\n"; } if($_32bit eq "big-endian") { $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1); } else { $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i); } $ret[$i] = sprintf("r%d", $i); $ret[$i+1] = sprintf("r%d", $i+1); } if($reg ne "e1") { $body .= "\t$name = $type($reg)\n"; } } if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") { $text .= "\t$call\n"; } else { $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n"; } foreach my $use (@uses) { $text .= "\t$use\n"; } $text .= $body; if ($do_errno) { $text .= "\tif e1 != 0 {\n"; $text .= "\t\terr = e1\n"; $text .= "\t}\n"; } $text .= "\treturn\n"; $text .= "}\n"; } if($errors) { exit 1; } print <<EOF; // $cmdline // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // +build $ENV{'GOARCH'},$ENV{'GOOS'} package $package import ( "syscall" "unsafe" ) EOF print "import \"golang.org/x/sys/unix\"\n" if $package ne "unix"; my $vardecls = "\t" . join(",\n\t", @vars); $vardecls .= " syscallFunc"; chomp($_=<<EOF); $dynimports $linknames var ( $vardecls ) $text EOF print $_; exit 0;
{ "pile_set_name": "Github" }
# Replacement * [PGS Replacement](#pgs-replacement) * [Gateway Replacement](#gateway-replacement) * [Configuration Master Replacement](#configuration-master-replacement) * [Zookeeper Replacement](#zookeeper-replacement) ## PGS Replacement The replacement operation is to make a additional replicas and then terminate the existing ones. ### Add replica to a new machine You can add replicas to the new machine with the administrative script. By adding replicas to the new machine, the data load is distributed over both the existing and the new machines. Follow the procedure below: * Set up the environment of new machine * Create a configuration file for the new cluster, in the following form ``` # CLUSTER PGS_ID PG_ID PM_NAME PM_IP PORT test_cluster 0 0 testmachine01.dev 123.123.123.123 7000 test_cluster 1 0 testmachine02.dev 123.123.123.124 7000 ``` * Run the administrative script. ``` $ fab main ``` * Select "Add replication" * Enter the location of the configuration file that you created previously, when you are prompted to input file name that is required to add replicas, as shown below. <pre> ======================================= 1. Show cluster information 2. Upgrade PGS 3. Upgrade GW 4. Install Cluster 5. Install PGS 6. Install GW 7. Uninstall Cluster 8. Uninstall PGS 9. Uninstall GW 10. Add replication 11. Leave replication 12. Migration 13. Repair Cluster (Cluster already installed) 14. Deploy bash_profile x. Exit ======================================= >> 10 Confirm Mode? [Y/n] <b>Y</b> Read PGS information from command line(Y) or a file(n). [Y/n] <b>n</b> Input file name: <b>setting_add_replicas</b> </pre> * Use "Show cluster information" of the script to check if the replicas are successfully added. ### Remove the Existing Replica Remove the replicas on the existing machine, with the administrative script. Then, overall data load is flowed into the new machine. Follow the procedure below: * Create a configuration file that will be used to remove replicas, in the following form ``` # CLUSTER PGS_ID test_cluster 0 test_cluster 1 ``` * Run the administrative script. ``` $ fab main ``` * Select "Uninstall PGS." * Enter the location of the configuration file that you created previously, when you are prompted to input file name that is required to remove replicas. * Use "Show cluster information" of the script to check if the replicas are successfully removed. ## Gateway Replacement First, you should install gateway on the new machine, and then remove the one from the existing machine. Once you add the gateway to the new machine, the data load is distributed over both the existing and the new machines. Then, remove the existing gateway so that the overall data load is flowed into the new machine only. ### Adding a new gateway * Create a configuration file for the new gateway. ``` # GATEWAY CLUSTER GW_ID PM_NAME PM_IP PORT test_cluster 1 testmachine01.dev 123.123.123.123 6000 test_cluster 2 testmachine02.dev 123.123.123.124 6000 ``` * Run the administrative script. * Select "Install GW." * Enter the location of the configuration file that you created previously, when you are prompted to input file name that is required to install the gateway. * Use "Show cluster information" of the script to check if the gateway is successfully added to the new machine. ### Remove the existing gateway * Create a configuration file for the gateway to remove. ``` # GATEWAY CLUSTER GW_ID test_cluster 1 test_cluster 2 ``` * Run the administrative script. * Select "Uninstall GW." * Enter the location of the configuration file that you created previously, when you are prompted to input file name that is required to uninstall the gateway. * Use "Show cluster information" of the script to check if the gateway is successfully removed from the existing machine. ## Configuration Master Replacement First, you should terminate the Configuration Master processes on the existing machine, and then run the Configuration Master on the new machine. * Copy the Configuration Master to $NBASE_ARC_HOME/confmaster folder on the new machine. * Kill all the Configuration Master processes that are running on the existing machine. ``` kill -9 <confmaster pid> ``` * Check if z-nodes used to manage Configuration Master are deleted from ZooKeeper. Check the folders, /RC/CC /LE and /RC/CC/FD. They should not be in those folders. If the z-nodes still exist in the folders even after you terminate all the Configuration Master processes, check again after a while. ``` $ zkCli.sh zookeeper prompt$ ls /RC/CC/FD [] zookeeper prompt$ ls /RC/CC/LE [] ``` * Run the Configuration Master on the new machine. ``` $ ./confmaster.sh ``` ## Zookeeper Replacement To replace ZooKeeper, you should install new ZooKeeper first, add it to the existing ensemble and remove the existing ZooKeeper one by one from the ensemble. ### Add Zookeeper to New Machine * Check if all ZooKeepers in the ensemble are normally running. They should be composed of one leader and the other followers. * Add the addresses of the existing and the new ZooKeepers in the ZooKeeper configuration file of the new machine. ``` #Existing ZooKeepers server.1=123.123.123.123:2881:3881 server.2=123.123.123.123:2882:3882 server.3=123.123.123.123:2883:3883 #New ZooKeepers server.4=123.123.123.124:2884:3884 server.5=123.123.123.124:2885:3885 ``` * Run ZooKeepers on the new machine to add them to the existing ZooKeeper ensemble. * Open the ZooKeeper configuration file of the existing machine, and add the ZooKeeper connection addresses of the new machine. ``` #New ZooKeeper server.4=123.123.123.124:2884:3884 server.5=123.123.123.124:2885:3885 ``` * Restart ZooKeepers of the existing machine, one by one. ### Remove the Existing ZooKeeper * Check if ZooKeepers included in the ensemble are normally running. They should be composed of one leader and the other followers. * Terminate one of the existing ZooKeeper servers, open the configuration file of the rest of them, and restart the servers except the one that is terminated. * Repeat the previous step 2 for the existing ZooKeepers to terminate them all, so that only the ZooKeepers on the new machine can run.
{ "pile_set_name": "Github" }
/* Copyright 2018 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package v1alpha2 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha2" ) const ( // AnnotationClusterInfrastructureReady indicates the cluster's // infrastructure sources are ready and machines may be created. AnnotationClusterInfrastructureReady = "vsphere.infrastructure.cluster.x-k8s.io/infrastructure-ready" // AnnotationControlPlaneReady indicates the cluster's control plane is // ready. AnnotationControlPlaneReady = "vsphere.infrastructure.cluster.x-k8s.io/control-plane-ready" // ValueReady is the ready value for *Ready annotations. ValueReady = "true" ) // VSphereMachineTemplateResource describes the data needed to create a VSphereMachine from a template type VSphereMachineTemplateResource struct { metav1.TypeMeta `json:",inline"` // Standard object's metadata. clusterv1.ObjectMeta `json:"metadata,omitempty"` // Spec is the specification of the desired behavior of the machine. Spec VSphereMachineSpec `json:"spec"` } // VSphereMachineProviderConditionType is a valid value for VSphereMachineProviderCondition.Type type VSphereMachineProviderConditionType string // Valid conditions for an VSphere machine instance const ( // MachineCreated indicates whether the machine has been created or not. If not, // it should include a reason and message for the failure. MachineCreated VSphereMachineProviderConditionType = "MachineCreated" ) // APIEndpoint represents a reachable Kubernetes API endpoint. type APIEndpoint struct { // The hostname on which the API server is serving. Host string `json:"host"` // The port on which the API server is serving. Port int `json:"port"` } // NetworkSpec defines the virtual machine's network configuration. type NetworkSpec struct { // Devices is the list of network devices used by the virtual machine. // TODO(akutz) Make sure at least one network matches the // ClusterSpec.CloudProviderConfiguration.Network.Name Devices []NetworkDeviceSpec `json:"devices"` // Routes is a list of optional, static routes applied to the virtual // machine. // +optional Routes []NetworkRouteSpec `json:"routes,omitempty"` // PreferredAPIServeCIDR is the preferred CIDR for the Kubernetes API // server endpoint on this machine // +optional PreferredAPIServerCIDR string `json:"preferredAPIServerCidr,omitempty"` } // NetworkDeviceSpec defines the network configuration for a virtual machine's // network device. type NetworkDeviceSpec struct { // NetworkName is the name of the vSphere network to which the device // will be connected. NetworkName string `json:"networkName"` // DeviceName may be used to explicitly assign a name to the network device // as it exists in the guest operating system. // +optional DeviceName string `json:"deviceName,omitempty"` // DHCP4 is a flag that indicates whether or not to use DHCP for IPv4 // on this device. // If true then IPAddrs should not contain any IPv4 addresses. // +optional DHCP4 bool `json:"dhcp4,omitempty"` // DHCP6 is a flag that indicates whether or not to use DHCP for IPv6 // on this device. // If true then IPAddrs should not contain any IPv6 addresses. // +optional DHCP6 bool `json:"dhcp6,omitempty"` // Gateway4 is the IPv4 gateway used by this device. // Required when DHCP4 is false. // +optional Gateway4 string `json:"gateway4,omitempty"` // Gateway4 is the IPv4 gateway used by this device. // Required when DHCP6 is false. // +optional Gateway6 string `json:"gateway6,omitempty"` // IPAddrs is a list of one or more IPv4 and/or IPv6 addresses to assign // to this device. // Required when DHCP4 and DHCP6 are both false. // +optional IPAddrs []string `json:"ipAddrs,omitempty"` // MTU is the device’s Maximum Transmission Unit size in bytes. // +optional MTU *int64 `json:"mtu,omitempty"` // MACAddr is the MAC address used by this device. // It is generally a good idea to omit this field and allow a MAC address // to be generated. // Please note that this value must use the VMware OUI to work with the // in-tree vSphere cloud provider. // +optional MACAddr string `json:"macAddr,omitempty"` // Nameservers is a list of IPv4 and/or IPv6 addresses used as DNS // nameservers. // Please note that Linux allows only three nameservers (https://linux.die.net/man/5/resolv.conf). // +optional Nameservers []string `json:"nameservers,omitempty"` // Routes is a list of optional, static routes applied to the device. // +optional Routes []NetworkRouteSpec `json:"routes,omitempty"` // SearchDomains is a list of search domains used when resolving IP // addresses with DNS. // +optional SearchDomains []string `json:"searchDomains,omitempty"` } // NetworkRouteSpec defines a static network route. type NetworkRouteSpec struct { // To is an IPv4 or IPv6 address. To string `json:"to"` // Via is an IPv4 or IPv6 address. Via string `json:"via"` // Metric is the weight/priority of the route. Metric int32 `json:"metric"` } // NetworkStatus provides information about one of a VM's networks. type NetworkStatus struct { // Connected is a flag that indicates whether this network is currently // connected to the VM. Connected bool `json:"connected,omitempty"` // IPAddrs is one or more IP addresses reported by vm-tools. // +optional IPAddrs []string `json:"ipAddrs,omitempty"` // MACAddr is the MAC address of the network device. MACAddr string `json:"macAddr"` // NetworkName is the name of the network. // +optional NetworkName string `json:"networkName,omitempty"` } // VirtualMachineState describes the state of a VM. type VirtualMachineState string const ( // VirtualMachineStateNotFound is the string representing a VM that // cannot be located. VirtualMachineStateNotFound VirtualMachineState = "notfound" // VirtualMachineStatePending is the string representing a VM with an in-flight task. VirtualMachineStatePending = "pending" // VirtualMachineStateReady is the string representing a powered-on VM with reported IP addresses. VirtualMachineStateReady = "ready" ) // VirtualMachinePowerState describe the power state of a VM type VirtualMachinePowerState string const ( // VirtualMachinePowerStatePoweredOn is the string representing a VM in powered on state VirtualMachinePowerStatePoweredOn VirtualMachinePowerState = "poweredOn" // VirtualMachinePowerStatePoweredOff is the string representing a VM in powered off state VirtualMachinePowerStatePoweredOff = "poweredOff" // VirtualMachinePowerStateSuspended is the string representing a VM in suspended state VirtualMachinePowerStateSuspended = "suspended" ) // VirtualMachine represents data about a vSphere virtual machine object. type VirtualMachine struct { // Name is the VM's name. Name string `json:"name"` // BiosUUID is the VM's BIOS UUID. BiosUUID string `json:"biosUUID"` // State is the VM's state. State VirtualMachineState `json:"state"` // Network is the status of the VM's network devices. Network []NetworkStatus `json:"network"` }
{ "pile_set_name": "Github" }
#pragma once #include <stdint.h> #include <stdbool.h> #include "libmpv/render.h" #include "vo.h" // Helper for finding a parameter value. It returns the direct pointer to the // value, and if not present, just returns the def argument. In particular, if // def is not NULL, this never returns NULL (unless a param value is defined // as accepting NULL, or the libmpv API user is triggering UB). void *get_mpv_render_param(mpv_render_param *params, mpv_render_param_type type, void *def); #define GET_MPV_RENDER_PARAM(params, type, ctype, def) \ (*(ctype *)get_mpv_render_param(params, type, &(ctype){(def)})) typedef int (*mp_render_cb_control_fn)(struct vo *vo, void *cb_ctx, int *events, uint32_t request, void *data); void mp_render_context_set_control_callback(mpv_render_context *ctx, mp_render_cb_control_fn callback, void *callback_ctx); bool mp_render_context_acquire(mpv_render_context *ctx); struct render_backend { struct mpv_global *global; struct mp_log *log; const struct render_backend_fns *fns; // Set on init, immutable afterwards. int driver_caps; struct mp_hwdec_devices *hwdec_devs; void *priv; }; // Generic backend for rendering via libmpv. This corresponds to vo/vo_driver, // except for rendering via the mpv_render_*() API. (As a consequence it's as // generic as the VO API.) Like with VOs, one backend can support multiple // underlying GPU APIs. struct render_backend_fns { // Returns libmpv error code. In particular, this function has to check for // MPV_RENDER_PARAM_API_TYPE, and silently return MPV_ERROR_NOT_IMPLEMENTED // if the API is not included in this backend. // If this fails, ->destroy() will be called. int (*init)(struct render_backend *ctx, mpv_render_param *params); // Check if the passed IMGFMT_ is supported. bool (*check_format)(struct render_backend *ctx, int imgfmt); // Implementation of mpv_render_context_set_parameter(). Optional. int (*set_parameter)(struct render_backend *ctx, mpv_render_param param); // Like vo_driver.reconfig(). void (*reconfig)(struct render_backend *ctx, struct mp_image_params *params); // Like VOCTRL_RESET. void (*reset)(struct render_backend *ctx); void (*screenshot)(struct render_backend *ctx, struct vo_frame *frame, struct voctrl_screenshot *args); void (*perfdata)(struct render_backend *ctx, struct voctrl_performance_data *out); // Like vo_driver.get_image(). struct mp_image *(*get_image)(struct render_backend *ctx, int imgfmt, int w, int h, int stride_align); // This has two purposes: 1. set queue attributes on VO, 2. update the // renderer's OSD pointer. Keep in mind that as soon as the caller releases // the renderer lock, the VO pointer can become invalid. The OSD pointer // will technically remain valid (even though it's a vo field), until it's // unset with this function. // Will be called if vo changes, or if renderer options change. void (*update_external)(struct render_backend *ctx, struct vo *vo); // Update screen area. void (*resize)(struct render_backend *ctx, struct mp_rect *src, struct mp_rect *dst, struct mp_osd_res *osd); // Get target surface size from mpv_render_context_render() arguments. int (*get_target_size)(struct render_backend *ctx, mpv_render_param *params, int *out_w, int *out_h); // Implementation of mpv_render_context_render(). int (*render)(struct render_backend *ctx, mpv_render_param *params, struct vo_frame *frame); // Free all data in ctx->priv. void (*destroy)(struct render_backend *ctx); }; extern const struct render_backend_fns render_backend_gpu; extern const struct render_backend_fns render_backend_sw;
{ "pile_set_name": "Github" }
diff --recursive -u gcc-7.4.0-vanilla/libitm/beginend.cc gcc-7.4.0/libitm/beginend.cc --- gcc-7.4.0-vanilla/libitm/beginend.cc 2017-01-01 07:07:43.905435000 -0500 +++ gcc-7.4.0/libitm/beginend.cc 2019-11-09 00:31:10.093128945 -0500 @@ -431,7 +431,7 @@ // Save everything that we might have to restore on restarts or aborts. jb = tx->jb; undolog_size = tx->undolog.size(); - memcpy(&alloc_actions, &tx->alloc_actions, sizeof(alloc_actions)); + alloc_actions = tx->alloc_actions; user_actions_size = tx->user_actions.size(); id = tx->id; prop = tx->prop; @@ -449,7 +449,7 @@ // commits of nested transactions. Allocation actions must be committed // before committing the snapshot. tx->jb = jb; - memcpy(&tx->alloc_actions, &alloc_actions, sizeof(alloc_actions)); + tx->alloc_actions = alloc_actions; tx->id = id; tx->prop = prop; } @@ -485,7 +485,7 @@ prop = cp->prop; if (cp->disp != abi_disp()) set_abi_disp(cp->disp); - memcpy(&alloc_actions, &cp->alloc_actions, sizeof(alloc_actions)); + alloc_actions = cp->alloc_actions; nesting = cp->nesting; } else diff --recursive -u gcc-7.4.0-vanilla/libitm/method-ml.cc gcc-7.4.0/libitm/method-ml.cc --- gcc-7.4.0-vanilla/libitm/method-ml.cc 2017-01-01 07:07:43.905435000 -0500 +++ gcc-7.4.0/libitm/method-ml.cc 2019-11-09 01:12:58.674388557 -0500 @@ -138,7 +138,9 @@ // This store is only executed while holding the serial lock, so relaxed // memory order is sufficient here. Same holds for the memset. time.store(0, memory_order_relaxed); - memset(orecs, 0, sizeof(atomic<gtm_word>) * L2O_ORECS); + void *p = orecs; + memset(p, 0, sizeof(atomic<gtm_word>) * L2O_ORECS); + } };
{ "pile_set_name": "Github" }
<!DOCTYPE HTML> <html> <head> <style> table { border-collapse: collapse; background-color: red; } td, th { background-color: lime; width:100px; height:100px; box-sizing:border-box; } td { border-top: 4px solid lime; } </style> </head> <body> <table cellpadding="0"> <tr><th colspan="2"></th></tr> <tr><th></th><td></td> </table> </body> </html>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <title>Adaptive Cards Designer</title> <script src="https://unpkg.com/[email protected]/dist/markdown-it.min.js"></script> <script src="https://unpkg.com/[email protected]/min/vs/loader.js"></script> <style type="text/css"> * { box-sizing: border-box; } body { margin: 0; } </style> <script type="text/javascript"> window.onload = function () { ACDesigner.GlobalSettings.enableDataBindingSupport = true; ACDesigner.GlobalSettings.showDataStructureTooklbox = true; ACDesigner.GlobalSettings.showSampleDataEditorToolbox = true; ACDesigner.GlobalSettings.showVersionPicker = true; if (!ACDesigner.SettingsManager.isLocalStorageAvailable) { console.log("Local storage is not available."); } let designer = new ACDesigner.CardDesigner(ACDesigner.defaultMicrosoftHosts); require.config({ paths: { 'vs': 'https://unpkg.com/[email protected]/min/vs' } }); require(['vs/editor/editor.main'], function () { designer.monacoModuleLoaded(); }); designer.attachTo(document.getElementById("designerRootHost")); }; </script> </head> <body> <div style="font-family: 'Segoe UI', sans-serif; font-size: 14px; display: flex; flex-direction: column; height: 100vh;"> <div id="designerRootHost"></div> </div> </body> </html>
{ "pile_set_name": "Github" }
# coding: utf-8 """ Swagger Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 OpenAPI spec version: 1.0.0 Contact: [email protected] Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class ModelReturn(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ swagger_types = { '_return': 'int' } attribute_map = { '_return': 'return' } def __init__(self, _return=None): # noqa: E501 """ModelReturn - a model defined in Swagger""" # noqa: E501 self.__return = None self.discriminator = None if _return is not None: self._return = _return @property def _return(self): """Gets the _return of this ModelReturn. # noqa: E501 :return: The _return of this ModelReturn. # noqa: E501 :rtype: int """ return self.__return @_return.setter def _return(self, _return): """Sets the _return of this ModelReturn. :param _return: The _return of this ModelReturn. # noqa: E501 :type: int """ self.__return = _return def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value if issubclass(ModelReturn, dict): for key, value in self.items(): result[key] = value return result def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, ModelReturn): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """Returns true if both objects are not equal""" return not self == other
{ "pile_set_name": "Github" }
@extends('layout.default') @section('breadcrumb') <li> <a href="{{ route('staff.dashboard.index') }}" itemprop="url" class="l-breadcrumb-item-link"> <span itemprop="title" class="l-breadcrumb-item-link-title">@lang('staff.staff-dashboard')</span> </a> </li> <li> <a href="{{ route('staff.groups.index') }}" itemprop="url" class="l-breadcrumb-item-link"> <span itemprop="title" class="l-breadcrumb-item-link-title">@lang('common.user') Groups</span> </a> </li> <li class="active"> <a href="{{ route('staff.groups.create', ['group' => $group->name, 'id' => $group->id]) }}" itemprop="url" class="l-breadcrumb-item-link"> <span itemprop="title" class="l-breadcrumb-item-link-title">@lang('common.edit') User Group</span> </a> </li> @endsection @section('content') <div class="container box"> <h2>{{ $group->name }} Permissions</h2> <div class="table-responsive"> <form role="form" method="POST" action="{{ route('staff.groups.update', ['group' => $group->name, 'id' => $group->id]) }}"> @csrf <div class="table-responsive"> <table class="table table-condensed table-striped table-bordered table-hover"> <thead> <tr> <th>@lang('common.name')</th> <th>@lang('common.position')</th> <th>Level</th> <th>Color</th> <th>Icon</th> <th>Effect</th> <th>Internal</th> <th>Modo</th> <th>Admin</th> <th>Owner</th> <th>Trusted</th> <th>Immune</th> <th>Freeleech</th> <th>Double Upload</th> <th>Incognito</th> <th>Upload</th> <th>Autogroup</th> </tr> </thead> <tbody> <tr> <td><label> <input type="text" name="name" value="{{ $group->name }}" class="form-control" /> </label></td> <td><label> <input type="text" name="position" value="{{ $group->position }}" class="form-control" /> </label> </td> <td><label> <input type="text" name="level" value="{{ $group->level }}" class="form-control" /> </label> </td> <td><label> <input type="text" name="color" value="{{ $group->color }}" class="form-control" /> </label> </td> <td><label> <input type="text" name="icon" value="{{ $group->icon }}" class="form-control" /> </label></td> <td><label> <input type="text" name="effect" value="{{ $group->effect }}" class="form-control" /> </label> </td> <td> @if ($group->is_internal == 1) <input type="hidden" name="is_internal" value="0"> <label> <input type="checkbox" name="is_internal" value="1" checked> </label> @else <input type="hidden" name="is_internal" value="0"> <label> <input type="checkbox" name="is_internal" value="1"> </label> @endif </td> <td> @if ($group->is_modo == 1) <input type="hidden" name="is_modo" value="0"> <label> <input type="checkbox" name="is_modo" value="1" checked> </label> @else <input type="hidden" name="is_modo" value="0"> <label> <input type="checkbox" name="is_modo" value="1"> </label> @endif </td> <td> @if ($group->is_admin == 1) <input type="hidden" name="is_admin" value="0"> <label> <input type="checkbox" name="is_admin" value="1" checked> </label> @else <input type="hidden" name="is_admin" value="0"> <label> <input type="checkbox" name="is_admin" value="1"> </label> @endif </td> <td> @if ($group->is_owner == 1) <input type="hidden" name="is_owner" value="0"> <label> <input type="checkbox" name="is_owner" value="1" checked> </label> @else <input type="hidden" name="is_owner" value="0"> <label> <input type="checkbox" name="is_owner" value="1"> </label> @endif </td> <td> @if ($group->is_trusted == 1) <input type="hidden" name="is_trusted" value="0"> <label> <input type="checkbox" name="is_trusted" value="1" checked> </label> @else <input type="hidden" name="is_trusted" value="0"> <label> <input type="checkbox" name="is_trusted" value="1"> </label> @endif </td> <td> @if ($group->is_immune == 1) <input type="hidden" name="is_immune" value="0"> <label> <input type="checkbox" name="is_immune" value="1" checked> </label> @else <input type="hidden" name="is_immune" value="0"> <label> <input type="checkbox" name="is_immune" value="1"> </label> @endif </td> <td> @if ($group->is_freeleech == 1) <input type="hidden" name="is_freeleech" value="0"> <label> <input type="checkbox" name="is_freeleech" value="1" checked> </label> @else <input type="hidden" name="is_freeleech" value="0"> <label> <input type="checkbox" name="is_freeleech" value="1"> </label> @endif </td> <td> @if ($group->is_double_upload == 1) <input type="hidden" name="is_double_upload" value="0"> <label> <input type="checkbox" name="is_double_upload" value="1" checked> </label> @else <input type="hidden" name="is_double_upload" value="0"> <label> <input type="checkbox" name="is_double_upload" value="1"> </label> @endif </td> <td> @if ($group->is_incognito == 1) <input type="hidden" name="is_incognito" value="0"> <label> <input type="checkbox" name="is_incognito" value="1" checked> </label> @else <input type="hidden" name="is_incognito" value="0"> <label> <input type="checkbox" name="is_incognito" value="1"> </label> @endif </td> <td> @if ($group->can_upload == 1) <input type="hidden" name="can_upload" value="0"> <label> <input type="checkbox" name="can_upload" value="1" checked> </label> @else <input type="hidden" name="can_upload" value="0"> <label> <input type="checkbox" name="can_upload" value="1"> </label> @endif </td> <td> @if ($group->autogroup == 1) <input type="hidden" name="autogroup" value="0"> <label> <input type="checkbox" name="autogroup" value="1" checked> </label> @else <input type="hidden" name="autogroup" value="0"> <label> <input type="checkbox" name="autogroup" value="1"> </label> @endif </td> </tr> </tbody> </table> </div> <button type="submit" class="btn btn-primary">@lang('common.submit')</button> </form> </div> </div> @endsection
{ "pile_set_name": "Github" }
/* Simple DirectMedia Layer Copyright (C) 1997-2016 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _SDL_mutex_h #define _SDL_mutex_h /** * \file SDL_mutex.h * * Functions to provide thread synchronization primitives. */ #include "SDL_stdinc.h" #include "SDL_error.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * Synchronization functions which can time out return this value * if they time out. */ #define SDL_MUTEX_TIMEDOUT 1 /** * This is the timeout value which corresponds to never time out. */ #define SDL_MUTEX_MAXWAIT (~(Uint32)0) /** * \name Mutex functions */ /* @{ */ /* The SDL mutex structure, defined in SDL_sysmutex.c */ struct SDL_mutex; typedef struct SDL_mutex SDL_mutex; /** * Create a mutex, initialized unlocked. */ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void); /** * Lock the mutex. * * \return 0, or -1 on error. */ #define SDL_mutexP(m) SDL_LockMutex(m) extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex); /** * Try to lock the mutex * * \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error */ extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex); /** * Unlock the mutex. * * \return 0, or -1 on error. * * \warning It is an error to unlock a mutex that has not been locked by * the current thread, and doing so results in undefined behavior. */ #define SDL_mutexV(m) SDL_UnlockMutex(m) extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex); /** * Destroy a mutex. */ extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex); /* @} *//* Mutex functions */ /** * \name Semaphore functions */ /* @{ */ /* The SDL semaphore structure, defined in SDL_syssem.c */ struct SDL_semaphore; typedef struct SDL_semaphore SDL_sem; /** * Create a semaphore, initialized with value, returns NULL on failure. */ extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value); /** * Destroy a semaphore. */ extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem); /** * This function suspends the calling thread until the semaphore pointed * to by \c sem has a positive count. It then atomically decreases the * semaphore count. */ extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem); /** * Non-blocking variant of SDL_SemWait(). * * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would * block, and -1 on error. */ extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem); /** * Variant of SDL_SemWait() with a timeout in milliseconds. * * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not * succeed in the allotted time, and -1 on error. * * \warning On some platforms this function is implemented by looping with a * delay of 1 ms, and so should be avoided if possible. */ extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms); /** * Atomically increases the semaphore's count (not blocking). * * \return 0, or -1 on error. */ extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem); /** * Returns the current count of the semaphore. */ extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem); /* @} *//* Semaphore functions */ /** * \name Condition variable functions */ /* @{ */ /* The SDL condition variable structure, defined in SDL_syscond.c */ struct SDL_cond; typedef struct SDL_cond SDL_cond; /** * Create a condition variable. * * Typical use of condition variables: * * Thread A: * SDL_LockMutex(lock); * while ( ! condition ) { * SDL_CondWait(cond, lock); * } * SDL_UnlockMutex(lock); * * Thread B: * SDL_LockMutex(lock); * ... * condition = true; * ... * SDL_CondSignal(cond); * SDL_UnlockMutex(lock); * * There is some discussion whether to signal the condition variable * with the mutex locked or not. There is some potential performance * benefit to unlocking first on some platforms, but there are some * potential race conditions depending on how your code is structured. * * In general it's safer to signal the condition variable while the * mutex is locked. */ extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void); /** * Destroy a condition variable. */ extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond); /** * Restart one of the threads that are waiting on the condition variable. * * \return 0 or -1 on error. */ extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond); /** * Restart all threads that are waiting on the condition variable. * * \return 0 or -1 on error. */ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond); /** * Wait on the condition variable, unlocking the provided mutex. * * \warning The mutex must be locked before entering this function! * * The mutex is re-locked once the condition variable is signaled. * * \return 0 when it is signaled, or -1 on error. */ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex); /** * Waits for at most \c ms milliseconds, and returns 0 if the condition * variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not * signaled in the allotted time, and -1 on error. * * \warning On some platforms this function is implemented by looping with a * delay of 1 ms, and so should be avoided if possible. */ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms); /* @} *//* Condition variable functions */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* _SDL_mutex_h */ /* vi: set ts=4 sw=4 expandtab: */
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: f137eba12ee10834cb19632437cfdb2e NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
<!-- ScadaBR 1.0 - Pacote de Modificações Community Edition http://www.scadabr.org.br Adecuación y Traducion para Español: Copyright (C) 2012 por Mílmero González [email protected] This file is free software: you may copy, redistribute 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 file 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/>. This file incorporates work covered by the following copyright and permission notice: Mango - Open Source M2M - http://mango.serotoninsoftware.com Copyright (C) 2006-2011 Serotonin Software Technologies Inc. @author Matthew Lohbihler 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/. --> <h1>Descripci&oacute;n General</h1> <p>Una lista de supervisi&oacute;n es un conjunto de tablas conformadas por puntos que se desean ver simultaneamente. Los valores de los puntos y de sus tiempos son actualizados autom&aacute;ticamente (no es necesario actualizar la p&aacute;gina).</p> <p>NOTA: El sistema opera m&aacute;s eficientemente si Ud. no realiza refrescamientos sobre esta p&aacute;gina.</p> <h1>Lista de Supervisi&oacute;n con Nombre</h1> <p>Un usuario puede tener m&uacute;ltiples listas de supervisi&oacute;n diferenciadas por sus nombres, aunque s&oacute;lo podr&aacute; ver una a la vez.</p> <p>Para crear una lista de supervisi&oacute;n nueva, haga clic en el icono <img src="images/add.png"/> que est&aacute; en la esquina superior derecha de la secci&oacute;n de Lista de Supervisi&oacute;n. Una nueva lista de supervisi&oacute;n se identificar&aacute; inicialmente como "(sin nombre)". Para nombrarla coloque el cursor sobre el icono <img src="images/pencil.png"/> y se mostrar&aacute; el panel de edici&oacute;n de nombre, introduzca el nombre deseado, y haga clic en "Guardar". Para eliminar una lista de supervisi&oacute;n, haga clic en el icono <img src="images/delete.png"/> en la esquina superior derecha de la secci&oacute;n de lista de supervisi&oacute;n. Cada usuario debe tener al menos una lista de supervisi&oacute;n, por lo que el icono de borrar s&oacute;lo aparecer&aacute; si existe m&aacute;s de una lista declarada.</p> <h1>Puntos en las Listas de Supervisi&oacute;n</h1> <p>Un punto puede estar en varias listas se supervisi&oacute;n, por lo que puede crear listas tan espec&iacute;ficas y detalladas como lo requiera.</p> <p>Los datos mostrados para cada punto en la lista dependen de la configuraci&oacute;n del punto. Cuando un punto permita la modificaci&oacute;n de su valor (para el cual tenga permiso de escritura) mostrar&aacute; a su lado un icono de <em>Establecer valor</em> (<img src="images/icon_edit.png"/>). Posicionando el rat&oacute;n sobre este icono, se presentar&aacute;n las opciones de modificaci&oacute;n del punto. Los puntos que son configurados para graficarse mostrar&aacute;n el icono de graficable (<img src="images/icon_chart.png"/>). Al presionar este icono se desplegar&aacute; el gr&aacute;fico correspondiente. Los gr&aacute;ficos actualizan autom&aacute;ticamente tanto los valores de puntos como sus tiempos, as&iacute; que cuando un dato nuevo est&aacute; disponible el gr&aacute;fico lo mostrar&aacute; inmediatamente. El icono para detalles del punto (<img src="images/icon_comp.png"/>) lo llevar&aacute; a la p&aacute;gina de los detalles del punto seleccionado.</p> <p>Para reordenar los puntos de su lista, utilice los iconos de <em>Mover</em>. Presionando el icono <img src="images/arrow_down_thin.png"/> mover&aacute; el punto una posici&oacute;n hacia abajo en la lista, mientras que utilizando el icono <img src="images/arrow_up_thin.png"/> lo subir&aacute;.</p> <p>Para agregar puntos a la actual lista, seleccione el nombre del punto con el rat&oacute;n en la secci&oacute;n de los <em>Puntos</em>. Estos se agregar&aacute;n al final de la lista. Para remover puntos de la lista, haga clic sobre el icono de eliminar (<img src="images/bullet_delete.png"/>) al lado superior derecho de la fila del punto. Haciendo clic en este icono s&oacute;lo se remueve el punto &uacute;nicamente de la lista de supervisi&oacute;n&mdash; esta acci&oacute;n no elimina el punto del sistema. No confunda el icono de <em>Remover Punto</em> con el icono de <em>Eliminar lista de supervisi&oacute;n </em> en la parte superior de la p&aacute;gina.</p> <h1>Resaltado</h1> <p>Los valores y tiempos de las listas de supervisi&oacute;n resaltar&aacute;n brevemente cuando cambien. Esta condici&oacute;n permanecer&aacute; hasta que se complete el siguiente ciclo de actualizaci&oacute;n. Los tiempos generalmente estar&aacute;n resaltados, a diferencia de los valores de los puntos, ya que las lecturas de los puntos siempre implican un cambio de hora, m&aacute;s no necesariamente habr&aacute; un cambio en su valor.</p>
{ "pile_set_name": "Github" }
<html> <head> <style type="text/css"> @font-face { font-family: dvsm; src: url(../fonts/DejaVuSansMono.woff); } body { font-family: dvsm; } </style> </head> <body> <p>foo <span style="color:white">x&#x301;y&#x302;z&#x303;z&#x304;y</span> bar</p> </body> </html>
{ "pile_set_name": "Github" }
{-# LANGUAGE CPP, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Graphics.UI.FLTK.LowLevel.JPEGImage ( jpegImageNew, jpegImageNewWithData -- * Hierarchy -- -- $hierarchy ) where #include "Fl_ExportMacros.h" #include "Fl_Types.h" #include "Fl_JPEG_ImageC.h" import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum) import Graphics.UI.FLTK.LowLevel.Fl_Types import Graphics.UI.FLTK.LowLevel.Utils import Graphics.UI.FLTK.LowLevel.Hierarchy import Graphics.UI.FLTK.LowLevel.RGBImage import qualified Data.ByteString as B import qualified Data.Text as T {# fun Fl_JPEG_Image_New as jpegImageNew' { `CString' } -> `Ptr ()' id #} {# fun Fl_JPEG_Image_New_WithData as jpegImageNewWithData' { `CString', id `Ptr CUChar' } -> `Ptr ()' id #} jpegImageNew :: T.Text -> IO (Either UnknownError (Ref JPEGImage)) jpegImageNew filename' = withText filename' jpegImageNew' >>= toRef >>= checkImage jpegImageNewWithData :: T.Text -> B.ByteString -> IO (Either UnknownError (Ref JPEGImage)) jpegImageNewWithData l' data' = do jpeg' <- copyByteStringToCString data' labelString <- copyTextToCString l' jpegImageNewWithData' labelString (castPtr jpeg') >>= toRef >>= checkImage -- $hierarchy -- @ -- "Graphics.UI.FLTK.LowLevel.Image" -- | -- v -- "Graphics.UI.FLTK.LowLevel.RGBImage" -- | -- v -- "Graphics.UI.FLTK.LowLevel.JPEGImage" -- @
{ "pile_set_name": "Github" }
# Sistem Genel Bakışı Oluşturma Kjj Project configurations can be found in the `.gn` and `.gni` files. ## GN Files The following `gn` files contain the main rules for building Electron: * `BUILD.gn` defines how Electron itself is built and includes the default configurations for linking with Chromium. * `build/args/{debug,release,all}.gn` contain the default build arguments for building Electron. ## Eleman Oluşturma Chromium oldukça büyük bir proje olduğu için son bağlama aşaması ilerlemeyi zorlaştıran bir kaç dakika alabilir. Bunu gidermek için, Chromium her elemanı ortak kitaplıkta ayıran, bağlantıları çok hızlandıran ama dosya boyut ve performansını feda eden '' eleman oluştur'' u sundu. Electron inherits this build option from Chromium. In `Debug` builds, the binary will be linked to a shared library version of Chromium's components to achieve fast linking time; for `Release` builds, the binary will be linked to the static library versions, so we can have the best possible binary size and performance. ## Testler **NB** _this section is out of date and contains information that is no longer relevant to the GN-built electron._ Değişikliklerinizin proje kodlama stiline uyumunu test etmek için kullandığı: ```sh $ npm run lint ``` İşlevselleği test etmek için: ```sh $ npm testi ``` Electron kaynak kodunda ne zaman değişiklik yaparsanız, şu testten önce inşa etmeyi yeniden çalıştırmalısınız: ```sh $ npm run build && npm test ``` Test paketini belirli testi izole ederek veya hali hazırda kullandığınız Mocha' nın </a> özellikli özel testlerini engelleyerek daha hızlı çalıştırabilirsiniz. Append `.only` to any `describe` or `it` function call:</p> ```js describe.only('some feature', () => { // ... only tests in this block will be run }) ``` Alternatif olarak, mocha'nın `grep` seçeneğini sadece verilen normal ifade modeliyle eşleşen testleri çalıştırmak için kullanabilirsiniz: ```sh $ npm test -- --grep child_process ``` Yerel modülleri içeren testler ( ör. `runas`) hata ayıklama yapısı ile çalıştırılamaz ( ayrıntılar için bkz. [#2558](https://github.com/electron/electron/issues/2558)), ama sürüm yapılarıyla birlikte çalışacaklardır. Sürüm yapısıyla testleri çalıştırmak için kullanacağınız: ```sh $ npm test -- -R ```
{ "pile_set_name": "Github" }
source("TestHarness.bsh"); class Foo15 { Foo15 getFoo() { return null; } void putFoo( Foo15 foo ) { } static Foo15 getFooStatic() { return null; } static void putFooStatic( Foo15 foo ) { } } interface Bar15 { Bar15 getBar(); void putBar( Bar15 foo ); } f = new Foo15(); ic=Bar15.class; complete();
{ "pile_set_name": "Github" }
/*------------------------------------------------------------------------ * Vulkan Conformance Tests * ------------------------ * * Copyright (c) 2016 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *//*! * \file vktSparseResourcesBufferMemoryAliasing.cpp * \brief Sparse buffer memory aliasing tests *//*--------------------------------------------------------------------*/ #include "vktSparseResourcesBufferMemoryAliasing.hpp" #include "vktSparseResourcesTestsUtil.hpp" #include "vktSparseResourcesBase.hpp" #include "vktTestCaseUtil.hpp" #include "vkDefs.hpp" #include "vkRef.hpp" #include "vkRefUtil.hpp" #include "vkPlatform.hpp" #include "vkPrograms.hpp" #include "vkRefUtil.hpp" #include "vkMemUtil.hpp" #include "vkBarrierUtil.hpp" #include "vkQueryUtil.hpp" #include "vkBuilderUtil.hpp" #include "vkTypeUtil.hpp" #include "vkCmdUtil.hpp" #include "vkObjUtil.hpp" #include "deStringUtil.hpp" #include "deUniquePtr.hpp" #include <string> #include <vector> using namespace vk; namespace vkt { namespace sparse { namespace { enum ShaderParameters { SIZE_OF_UINT_IN_SHADER = 4u, MODULO_DIVISOR = 1024u }; tcu::UVec3 computeWorkGroupSize (const deUint32 numInvocations) { const deUint32 maxComputeWorkGroupInvocations = 128u; const tcu::UVec3 maxComputeWorkGroupSize = tcu::UVec3(128u, 128u, 64u); deUint32 numInvocationsLeft = numInvocations; const deUint32 xWorkGroupSize = std::min(std::min(numInvocationsLeft, maxComputeWorkGroupSize.x()), maxComputeWorkGroupInvocations); numInvocationsLeft = numInvocationsLeft / xWorkGroupSize + ((numInvocationsLeft % xWorkGroupSize) ? 1u : 0u); const deUint32 yWorkGroupSize = std::min(std::min(numInvocationsLeft, maxComputeWorkGroupSize.y()), maxComputeWorkGroupInvocations / xWorkGroupSize); numInvocationsLeft = numInvocationsLeft / yWorkGroupSize + ((numInvocationsLeft % yWorkGroupSize) ? 1u : 0u); const deUint32 zWorkGroupSize = std::min(std::min(numInvocationsLeft, maxComputeWorkGroupSize.z()), maxComputeWorkGroupInvocations / (xWorkGroupSize*yWorkGroupSize)); numInvocationsLeft = numInvocationsLeft / zWorkGroupSize + ((numInvocationsLeft % zWorkGroupSize) ? 1u : 0u); return tcu::UVec3(xWorkGroupSize, yWorkGroupSize, zWorkGroupSize); } class BufferSparseMemoryAliasingCase : public TestCase { public: BufferSparseMemoryAliasingCase (tcu::TestContext& testCtx, const std::string& name, const std::string& description, const deUint32 bufferSize, const glu::GLSLVersion glslVersion, const bool useDeviceGroups); void initPrograms (SourceCollections& sourceCollections) const; TestInstance* createInstance (Context& context) const; virtual void checkSupport (Context& context) const; private: const deUint32 m_bufferSizeInBytes; const glu::GLSLVersion m_glslVersion; const bool m_useDeviceGroups; }; BufferSparseMemoryAliasingCase::BufferSparseMemoryAliasingCase (tcu::TestContext& testCtx, const std::string& name, const std::string& description, const deUint32 bufferSize, const glu::GLSLVersion glslVersion, const bool useDeviceGroups) : TestCase (testCtx, name, description) , m_bufferSizeInBytes (bufferSize) , m_glslVersion (glslVersion) , m_useDeviceGroups (useDeviceGroups) { } void BufferSparseMemoryAliasingCase::checkSupport (Context& context) const { context.requireDeviceCoreFeature(DEVICE_CORE_FEATURE_SPARSE_BINDING); context.requireDeviceCoreFeature(DEVICE_CORE_FEATURE_SPARSE_RESIDENCY_ALIASED); } void BufferSparseMemoryAliasingCase::initPrograms (SourceCollections& sourceCollections) const { // Create compute program const char* const versionDecl = glu::getGLSLVersionDeclaration(m_glslVersion); const deUint32 numInvocations = m_bufferSizeInBytes / SIZE_OF_UINT_IN_SHADER; const tcu::UVec3 workGroupSize = computeWorkGroupSize(numInvocations); std::ostringstream src; src << versionDecl << "\n" << "layout (local_size_x = " << workGroupSize.x() << ", local_size_y = " << workGroupSize.y() << ", local_size_z = " << workGroupSize.z() << ") in;\n" << "layout(set = 0, binding = 0, std430) writeonly buffer Output\n" << "{\n" << " uint result[];\n" << "} sb_out;\n" << "\n" << "void main (void)\n" << "{\n" << " uint index = gl_GlobalInvocationID.x + (gl_GlobalInvocationID.y + gl_GlobalInvocationID.z*gl_NumWorkGroups.y*gl_WorkGroupSize.y)*gl_NumWorkGroups.x*gl_WorkGroupSize.x;\n" << " if ( index < " << m_bufferSizeInBytes / SIZE_OF_UINT_IN_SHADER << "u )\n" << " {\n" << " sb_out.result[index] = index % " << MODULO_DIVISOR << "u;\n" << " }\n" << "}\n"; sourceCollections.glslSources.add("comp") << glu::ComputeSource(src.str()); } class BufferSparseMemoryAliasingInstance : public SparseResourcesBaseInstance { public: BufferSparseMemoryAliasingInstance (Context& context, const deUint32 bufferSize, const bool useDeviceGroups); tcu::TestStatus iterate (void); private: const deUint32 m_bufferSizeInBytes; const deUint32 m_useDeviceGroups; }; BufferSparseMemoryAliasingInstance::BufferSparseMemoryAliasingInstance (Context& context, const deUint32 bufferSize, const bool useDeviceGroups) : SparseResourcesBaseInstance (context, useDeviceGroups) , m_bufferSizeInBytes (bufferSize) , m_useDeviceGroups (useDeviceGroups) { } tcu::TestStatus BufferSparseMemoryAliasingInstance::iterate (void) { const InstanceInterface& instance = m_context.getInstanceInterface(); { // Create logical device supporting both sparse and compute operations QueueRequirementsVec queueRequirements; queueRequirements.push_back(QueueRequirements(VK_QUEUE_SPARSE_BINDING_BIT, 1u)); queueRequirements.push_back(QueueRequirements(VK_QUEUE_COMPUTE_BIT, 1u)); createDeviceSupportingQueues(queueRequirements); } const vk::VkPhysicalDevice& physicalDevice = getPhysicalDevice(); const DeviceInterface& deviceInterface = getDeviceInterface(); const Queue& sparseQueue = getQueue(VK_QUEUE_SPARSE_BINDING_BIT, 0); const Queue& computeQueue = getQueue(VK_QUEUE_COMPUTE_BIT, 0); // Go through all physical devices for (deUint32 physDevID = 0; physDevID < m_numPhysicalDevices; physDevID++) { const deUint32 firstDeviceID = physDevID; const deUint32 secondDeviceID = (firstDeviceID + 1) % m_numPhysicalDevices; VkBufferCreateInfo bufferCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // VkStructureType sType; DE_NULL, // const void* pNext; VK_BUFFER_CREATE_SPARSE_BINDING_BIT | VK_BUFFER_CREATE_SPARSE_ALIASED_BIT, // VkBufferCreateFlags flags; m_bufferSizeInBytes, // VkDeviceSize size; VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT, // VkBufferUsageFlags usage; VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode; 0u, // deUint32 queueFamilyIndexCount; DE_NULL // const deUint32* pQueueFamilyIndices; }; const deUint32 queueFamilyIndices[] = { sparseQueue.queueFamilyIndex, computeQueue.queueFamilyIndex }; if (sparseQueue.queueFamilyIndex != computeQueue.queueFamilyIndex) { bufferCreateInfo.sharingMode = VK_SHARING_MODE_CONCURRENT; bufferCreateInfo.queueFamilyIndexCount = 2u; bufferCreateInfo.pQueueFamilyIndices = queueFamilyIndices; } // Create sparse buffers const Unique<VkBuffer> sparseBufferWrite(createBuffer(deviceInterface, getDevice(), &bufferCreateInfo)); const Unique<VkBuffer> sparseBufferRead(createBuffer(deviceInterface, getDevice(), &bufferCreateInfo)); // Create sparse buffers memory bind semaphore const Unique<VkSemaphore> bufferMemoryBindSemaphore(createSemaphore(deviceInterface, getDevice())); const VkMemoryRequirements bufferMemRequirements = getBufferMemoryRequirements(deviceInterface, getDevice(), *sparseBufferWrite); if (bufferMemRequirements.size > getPhysicalDeviceProperties(instance, physicalDevice).limits.sparseAddressSpaceSize) TCU_THROW(NotSupportedError, "Required memory size for sparse resources exceeds device limits"); DE_ASSERT((bufferMemRequirements.size % bufferMemRequirements.alignment) == 0); const deUint32 memoryType = findMatchingMemoryType(instance, getPhysicalDevice(secondDeviceID), bufferMemRequirements, MemoryRequirement::Any); if (memoryType == NO_MATCH_FOUND) return tcu::TestStatus::fail("No matching memory type found"); if (firstDeviceID != secondDeviceID) { VkPeerMemoryFeatureFlags peerMemoryFeatureFlags = (VkPeerMemoryFeatureFlags)0; const deUint32 heapIndex = getHeapIndexForMemoryType(instance, getPhysicalDevice(secondDeviceID), memoryType); deviceInterface.getDeviceGroupPeerMemoryFeatures(getDevice(), heapIndex, firstDeviceID, secondDeviceID, &peerMemoryFeatureFlags); if (((peerMemoryFeatureFlags & VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT) == 0) || ((peerMemoryFeatureFlags & VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT) == 0)) { TCU_THROW(NotSupportedError, "Peer memory does not support COPY_SRC and GENERIC_DST"); } } const VkSparseMemoryBind sparseMemoryBind = makeSparseMemoryBind(deviceInterface, getDevice(), bufferMemRequirements.size, memoryType, 0u); Move<VkDeviceMemory> deviceMemoryPtr(check<VkDeviceMemory>(sparseMemoryBind.memory), Deleter<VkDeviceMemory>(deviceInterface, getDevice(), DE_NULL)); { const VkSparseBufferMemoryBindInfo sparseBufferMemoryBindInfo[2] = { makeSparseBufferMemoryBindInfo (*sparseBufferWrite, //VkBuffer buffer; 1u, //deUint32 bindCount; &sparseMemoryBind //const VkSparseMemoryBind* Binds; ), makeSparseBufferMemoryBindInfo (*sparseBufferRead, //VkBuffer buffer; 1u, //deUint32 bindCount; &sparseMemoryBind //const VkSparseMemoryBind* Binds; ) }; const VkDeviceGroupBindSparseInfo devGroupBindSparseInfo = { VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHR, //VkStructureType sType; DE_NULL, //const void* pNext; firstDeviceID, //deUint32 resourceDeviceIndex; secondDeviceID, //deUint32 memoryDeviceIndex; }; const VkBindSparseInfo bindSparseInfo = { VK_STRUCTURE_TYPE_BIND_SPARSE_INFO, //VkStructureType sType; m_useDeviceGroups ? &devGroupBindSparseInfo : DE_NULL, //const void* pNext; 0u, //deUint32 waitSemaphoreCount; DE_NULL, //const VkSemaphore* pWaitSemaphores; 2u, //deUint32 bufferBindCount; sparseBufferMemoryBindInfo, //const VkSparseBufferMemoryBindInfo* pBufferBinds; 0u, //deUint32 imageOpaqueBindCount; DE_NULL, //const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds; 0u, //deUint32 imageBindCount; DE_NULL, //const VkSparseImageMemoryBindInfo* pImageBinds; 1u, //deUint32 signalSemaphoreCount; &bufferMemoryBindSemaphore.get() //const VkSemaphore* pSignalSemaphores; }; // Submit sparse bind commands for execution VK_CHECK(deviceInterface.queueBindSparse(sparseQueue.queueHandle, 1u, &bindSparseInfo, DE_NULL)); } // Create output buffer const VkBufferCreateInfo outputBufferCreateInfo = makeBufferCreateInfo(m_bufferSizeInBytes, VK_BUFFER_USAGE_TRANSFER_DST_BIT); const Unique<VkBuffer> outputBuffer(createBuffer(deviceInterface, getDevice(), &outputBufferCreateInfo)); const de::UniquePtr<Allocation> outputBufferAlloc(bindBuffer(deviceInterface, getDevice(), getAllocator(), *outputBuffer, MemoryRequirement::HostVisible)); // Create command buffer for compute and data transfer operations const Unique<VkCommandPool> commandPool(makeCommandPool(deviceInterface, getDevice(), computeQueue.queueFamilyIndex)); const Unique<VkCommandBuffer> commandBuffer(allocateCommandBuffer(deviceInterface, getDevice(), *commandPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY)); // Start recording commands beginCommandBuffer(deviceInterface, *commandBuffer); // Create descriptor set const Unique<VkDescriptorSetLayout> descriptorSetLayout( DescriptorSetLayoutBuilder() .addSingleBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_SHADER_STAGE_COMPUTE_BIT) .build(deviceInterface, getDevice())); // Create compute pipeline const Unique<VkShaderModule> shaderModule(createShaderModule(deviceInterface, getDevice(), m_context.getBinaryCollection().get("comp"), DE_NULL)); const Unique<VkPipelineLayout> pipelineLayout(makePipelineLayout(deviceInterface, getDevice(), *descriptorSetLayout)); const Unique<VkPipeline> computePipeline(makeComputePipeline(deviceInterface, getDevice(), *pipelineLayout, *shaderModule)); deviceInterface.cmdBindPipeline(*commandBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, *computePipeline); // Create descriptor set const Unique<VkDescriptorPool> descriptorPool( DescriptorPoolBuilder() .addType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1u) .build(deviceInterface, getDevice(), VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1u)); const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(deviceInterface, getDevice(), *descriptorPool, *descriptorSetLayout)); { const VkDescriptorBufferInfo sparseBufferInfo = makeDescriptorBufferInfo(*sparseBufferWrite, 0u, m_bufferSizeInBytes); DescriptorSetUpdateBuilder() .writeSingle(*descriptorSet, DescriptorSetUpdateBuilder::Location::binding(0u), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, &sparseBufferInfo) .update(deviceInterface, getDevice()); } deviceInterface.cmdBindDescriptorSets(*commandBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, *pipelineLayout, 0u, 1u, &descriptorSet.get(), 0u, DE_NULL); { deUint32 numInvocationsLeft = m_bufferSizeInBytes / SIZE_OF_UINT_IN_SHADER; const tcu::UVec3 workGroupSize = computeWorkGroupSize(numInvocationsLeft); const tcu::UVec3 maxComputeWorkGroupCount = tcu::UVec3(65535u, 65535u, 65535u); numInvocationsLeft -= workGroupSize.x()*workGroupSize.y()*workGroupSize.z(); const deUint32 xWorkGroupCount = std::min(numInvocationsLeft, maxComputeWorkGroupCount.x()); numInvocationsLeft = numInvocationsLeft / xWorkGroupCount + ((numInvocationsLeft % xWorkGroupCount) ? 1u : 0u); const deUint32 yWorkGroupCount = std::min(numInvocationsLeft, maxComputeWorkGroupCount.y()); numInvocationsLeft = numInvocationsLeft / yWorkGroupCount + ((numInvocationsLeft % yWorkGroupCount) ? 1u : 0u); const deUint32 zWorkGroupCount = std::min(numInvocationsLeft, maxComputeWorkGroupCount.z()); numInvocationsLeft = numInvocationsLeft / zWorkGroupCount + ((numInvocationsLeft % zWorkGroupCount) ? 1u : 0u); if (numInvocationsLeft != 1u) TCU_THROW(NotSupportedError, "Buffer size is not supported"); deviceInterface.cmdDispatch(*commandBuffer, xWorkGroupCount, yWorkGroupCount, zWorkGroupCount); } { const VkBufferMemoryBarrier sparseBufferWriteBarrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT, *sparseBufferWrite, 0ull, m_bufferSizeInBytes); deviceInterface.cmdPipelineBarrier(*commandBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0u, 0u, DE_NULL, 1u, &sparseBufferWriteBarrier, 0u, DE_NULL); } { const VkBufferCopy bufferCopy = makeBufferCopy(0u, 0u, m_bufferSizeInBytes); deviceInterface.cmdCopyBuffer(*commandBuffer, *sparseBufferRead, *outputBuffer, 1u, &bufferCopy); } { const VkBufferMemoryBarrier outputBufferHostBarrier = makeBufferMemoryBarrier(VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *outputBuffer, 0ull, m_bufferSizeInBytes); deviceInterface.cmdPipelineBarrier(*commandBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT, 0u, 0u, DE_NULL, 1u, &outputBufferHostBarrier, 0u, DE_NULL); } // End recording commands endCommandBuffer(deviceInterface, *commandBuffer); // The stage at which execution is going to wait for finish of sparse binding operations const VkPipelineStageFlags waitStageBits[] = { VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT }; // Submit commands for execution and wait for completion // In case of device groups, submit on the physical device with the resource submitCommandsAndWait(deviceInterface, getDevice(), computeQueue.queueHandle, *commandBuffer, 1u, &bufferMemoryBindSemaphore.get(), waitStageBits, 0, DE_NULL, m_useDeviceGroups, firstDeviceID); // Retrieve data from output buffer to host memory invalidateAlloc(deviceInterface, getDevice(), *outputBufferAlloc); const deUint8* outputData = static_cast<const deUint8*>(outputBufferAlloc->getHostPtr()); // Wait for sparse queue to become idle deviceInterface.queueWaitIdle(sparseQueue.queueHandle); // Prepare reference data std::vector<deUint8> referenceData; referenceData.resize(m_bufferSizeInBytes); std::vector<deUint32> referenceDataBlock; referenceDataBlock.resize(MODULO_DIVISOR); for (deUint32 valueNdx = 0; valueNdx < MODULO_DIVISOR; ++valueNdx) { referenceDataBlock[valueNdx] = valueNdx % MODULO_DIVISOR; } const deUint32 fullBlockSizeInBytes = MODULO_DIVISOR * SIZE_OF_UINT_IN_SHADER; const deUint32 lastBlockSizeInBytes = m_bufferSizeInBytes % fullBlockSizeInBytes; const deUint32 numberOfBlocks = m_bufferSizeInBytes / fullBlockSizeInBytes + (lastBlockSizeInBytes ? 1u : 0u); for (deUint32 blockNdx = 0; blockNdx < numberOfBlocks; ++blockNdx) { const deUint32 offset = blockNdx * fullBlockSizeInBytes; deMemcpy(&referenceData[0] + offset, &referenceDataBlock[0], ((offset + fullBlockSizeInBytes) <= m_bufferSizeInBytes) ? fullBlockSizeInBytes : lastBlockSizeInBytes); } // Compare reference data with output data if (deMemCmp(&referenceData[0], outputData, m_bufferSizeInBytes) != 0) return tcu::TestStatus::fail("Failed"); } return tcu::TestStatus::pass("Passed"); } TestInstance* BufferSparseMemoryAliasingCase::createInstance (Context& context) const { return new BufferSparseMemoryAliasingInstance(context, m_bufferSizeInBytes, m_useDeviceGroups); } } // anonymous ns void addBufferSparseMemoryAliasingTests(tcu::TestCaseGroup* group, const bool useDeviceGroups) { group->addChild(new BufferSparseMemoryAliasingCase(group->getTestContext(), "buffer_size_2_10", "", 1 << 10, glu::GLSL_VERSION_440, useDeviceGroups)); group->addChild(new BufferSparseMemoryAliasingCase(group->getTestContext(), "buffer_size_2_12", "", 1 << 12, glu::GLSL_VERSION_440, useDeviceGroups)); group->addChild(new BufferSparseMemoryAliasingCase(group->getTestContext(), "buffer_size_2_16", "", 1 << 16, glu::GLSL_VERSION_440, useDeviceGroups)); group->addChild(new BufferSparseMemoryAliasingCase(group->getTestContext(), "buffer_size_2_17", "", 1 << 17, glu::GLSL_VERSION_440, useDeviceGroups)); group->addChild(new BufferSparseMemoryAliasingCase(group->getTestContext(), "buffer_size_2_20", "", 1 << 20, glu::GLSL_VERSION_440, useDeviceGroups)); group->addChild(new BufferSparseMemoryAliasingCase(group->getTestContext(), "buffer_size_2_24", "", 1 << 24, glu::GLSL_VERSION_440, useDeviceGroups)); } } // sparse } // vkt
{ "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. */ import org.apache.ofbiz.base.component.ComponentConfig import org.apache.ofbiz.base.config.GenericConfigException import org.apache.ofbiz.base.config.ResourceHandler import org.apache.ofbiz.base.util.UtilXml import org.apache.ofbiz.base.util.UtilMisc import org.w3c.dom.Document import org.w3c.dom.Element List testList = [] for (ComponentConfig.TestSuiteInfo testSuiteInfo: ComponentConfig.getAllTestSuiteInfos(parameters.compName)) { String componentName = testSuiteInfo.componentConfig.getComponentName() ResourceHandler testSuiteResource = testSuiteInfo.createResourceHandler() try { Document testSuiteDocument = testSuiteResource.getDocument() Element documentElement = testSuiteDocument.getDocumentElement() suiteName = documentElement.getAttribute("suite-name") firstLine = true for (Element testCaseElement : UtilXml.childElementList(documentElement, UtilMisc.toSet("test-case", "test-group"))) { testMap = [:] String caseName = testCaseElement.getAttribute("case-name") if (firstLine == true) { testMap = UtilMisc.toMap("suiteName", suiteName, "suiteNameSave", suiteName, "caseName", caseName) firstLine = false } else { testMap = UtilMisc.toMap("suiteNameSave", suiteName, "caseName", caseName) } testList.add(testMap) } } catch (GenericConfigException e) { String errMsg = "Error reading XML document from ResourceHandler for loader [" + testSuiteResource.getLoaderName() + "] and location [" + testSuiteResource.getLocation() + "]" logError(e, errMsg) throw new IllegalArgumentException(errMsg) } } context.suits = testList
{ "pile_set_name": "Github" }
# # Automatically generated file; DO NOT EDIT. # Linux/arm 4.9.13 Kernel Configuration # CONFIG_ARM=y CONFIG_ARM_HAS_SG_CHAIN=y CONFIG_MIGHT_HAVE_PCI=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y CONFIG_HAVE_PROC_CPU=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_LOCKDEP_SUPPORT=y CONFIG_TRACE_IRQFLAGS_SUPPORT=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_GENERIC_HWEIGHT=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_ARCH_SUPPORTS_UPROBES=y CONFIG_VECTORS_BASE=0xffff0000 CONFIG_ARM_PATCH_PHYS_VIRT=y CONFIG_GENERIC_BUG=y CONFIG_PGTABLE_LEVELS=2 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_EXTABLE_SORT=y # # General setup # CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" # CONFIG_COMPILE_TEST is not set CONFIG_LOCALVERSION="" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KERNEL_XZ=y CONFIG_HAVE_KERNEL_LZO=y CONFIG_HAVE_KERNEL_LZ4=y CONFIG_KERNEL_GZIP=y # CONFIG_KERNEL_LZMA is not set # CONFIG_KERNEL_XZ is not set # CONFIG_KERNEL_LZO is not set # CONFIG_KERNEL_LZ4 is not set CONFIG_DEFAULT_HOSTNAME="" # CONFIG_SWAP is not set CONFIG_SYSVIPC=y CONFIG_SYSVIPC_SYSCTL=y CONFIG_POSIX_MQUEUE=y CONFIG_POSIX_MQUEUE_SYSCTL=y CONFIG_CROSS_MEMORY_ATTACH=y CONFIG_FHANDLE=y CONFIG_USELIB=y # CONFIG_AUDIT is not set CONFIG_HAVE_ARCH_AUDITSYSCALL=y # # IRQ subsystem # CONFIG_GENERIC_IRQ_PROBE=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_IRQ_SHOW_LEVEL=y CONFIG_HARDIRQS_SW_RESEND=y CONFIG_GENERIC_IRQ_CHIP=y CONFIG_IRQ_DOMAIN=y CONFIG_IRQ_DOMAIN_HIERARCHY=y CONFIG_HANDLE_DOMAIN_IRQ=y # CONFIG_IRQ_DOMAIN_DEBUG is not set CONFIG_IRQ_FORCED_THREADING=y CONFIG_SPARSE_IRQ=y CONFIG_ARCH_CLOCKSOURCE_DATA=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_ARCH_HAS_TICK_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y # # Timers subsystem # CONFIG_TICK_ONESHOT=y CONFIG_NO_HZ_COMMON=y # CONFIG_HZ_PERIODIC is not set CONFIG_NO_HZ_IDLE=y # CONFIG_NO_HZ_FULL is not set # CONFIG_NO_HZ is not set CONFIG_HIGH_RES_TIMERS=y # # CPU/Task time and stats accounting # CONFIG_TICK_CPU_ACCOUNTING=y # CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set # CONFIG_IRQ_TIME_ACCOUNTING is not set # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_TASKSTATS is not set # # RCU Subsystem # CONFIG_PREEMPT_RCU=y # CONFIG_RCU_EXPERT is not set CONFIG_SRCU=y # CONFIG_TASKS_RCU is not set CONFIG_RCU_STALL_COMMON=y # CONFIG_TREE_RCU_TRACE is not set # CONFIG_RCU_EXPEDITE_BOOT is not set CONFIG_BUILD_BIN2C=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y CONFIG_LOG_BUF_SHIFT=17 CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 CONFIG_NMI_LOG_BUF_SHIFT=13 CONFIG_GENERIC_SCHED_CLOCK=y # CONFIG_CGROUPS is not set # CONFIG_CHECKPOINT_RESTORE is not set # CONFIG_NAMESPACES is not set # CONFIG_SCHED_AUTOGROUP is not set # CONFIG_SYSFS_DEPRECATED is not set CONFIG_RELAY=y CONFIG_BLK_DEV_INITRD=y CONFIG_INITRAMFS_SOURCE="" CONFIG_RD_GZIP=y # CONFIG_RD_BZIP2 is not set # CONFIG_RD_LZMA is not set # CONFIG_RD_XZ is not set # CONFIG_RD_LZO is not set # CONFIG_RD_LZ4 is not set CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_SYSCTL=y CONFIG_ANON_INODES=y CONFIG_HAVE_UID16=y CONFIG_BPF=y CONFIG_EXPERT=y CONFIG_UID16=y CONFIG_MULTIUSER=y # CONFIG_SGETMASK_SYSCALL is not set CONFIG_SYSFS_SYSCALL=y # CONFIG_SYSCTL_SYSCALL is not set # CONFIG_KALLSYMS is not set CONFIG_PRINTK=y CONFIG_PRINTK_NMI=y CONFIG_BUG=y CONFIG_ELF_CORE=y CONFIG_BASE_FULL=y CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_SIGNALFD=y CONFIG_TIMERFD=y CONFIG_EVENTFD=y # CONFIG_BPF_SYSCALL is not set CONFIG_SHMEM=y CONFIG_AIO=y CONFIG_ADVISE_SYSCALLS=y # CONFIG_USERFAULTFD is not set CONFIG_MEMBARRIER=y CONFIG_EMBEDDED=y CONFIG_HAVE_PERF_EVENTS=y CONFIG_PERF_USE_VMALLOC=y # # Kernel Performance Events And Counters # # CONFIG_PERF_EVENTS is not set CONFIG_VM_EVENT_COUNTERS=y # CONFIG_SLUB_DEBUG is not set # CONFIG_COMPAT_BRK is not set # CONFIG_SLAB is not set CONFIG_SLUB=y # CONFIG_SLOB is not set # CONFIG_SLAB_FREELIST_RANDOM is not set CONFIG_SLUB_CPU_PARTIAL=y # CONFIG_SYSTEM_DATA_VERIFICATION is not set # CONFIG_PROFILING is not set CONFIG_HAVE_OPROFILE=y # CONFIG_KPROBES is not set CONFIG_JUMP_LABEL=y # CONFIG_STATIC_KEYS_SELFTEST is not set # CONFIG_UPROBES is not set # CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_OPTPROBES=y CONFIG_HAVE_NMI=y CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_HAVE_DMA_CONTIGUOUS=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GENERIC_IDLE_POLL_SETUP=y CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y CONFIG_HAVE_CLK=y CONFIG_HAVE_DMA_API_DEBUG=y CONFIG_HAVE_PERF_REGS=y CONFIG_HAVE_PERF_USER_STACK_DUMP=y CONFIG_HAVE_ARCH_JUMP_LABEL=y CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y CONFIG_HAVE_ARCH_SECCOMP_FILTER=y CONFIG_SECCOMP_FILTER=y CONFIG_HAVE_GCC_PLUGINS=y # CONFIG_GCC_PLUGINS is not set CONFIG_HAVE_CC_STACKPROTECTOR=y # CONFIG_CC_STACKPROTECTOR is not set CONFIG_CC_STACKPROTECTOR_NONE=y # CONFIG_CC_STACKPROTECTOR_REGULAR is not set # CONFIG_CC_STACKPROTECTOR_STRONG is not set CONFIG_HAVE_CONTEXT_TRACKING=y CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y CONFIG_HAVE_MOD_ARCH_SPECIFIC=y CONFIG_MODULES_USE_ELF_REL=y CONFIG_ARCH_HAS_ELF_RANDOMIZE=y CONFIG_HAVE_ARCH_MMAP_RND_BITS=y CONFIG_HAVE_EXIT_THREAD=y CONFIG_ARCH_MMAP_RND_BITS_MIN=8 CONFIG_ARCH_MMAP_RND_BITS_MAX=16 CONFIG_ARCH_MMAP_RND_BITS=8 # CONFIG_HAVE_ARCH_HASH is not set # CONFIG_ISA_BUS_API is not set CONFIG_CLONE_BACKWARDS=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_OLD_SIGACTION=y # CONFIG_CPU_NO_EFFICIENT_FFS is not set # CONFIG_HAVE_ARCH_VMAP_STACK is not set # # GCOV-based kernel profiling # # CONFIG_GCOV_KERNEL is not set CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y CONFIG_HAVE_GENERIC_DMA_COHERENT=y CONFIG_RT_MUTEXES=y CONFIG_BASE_SMALL=0 CONFIG_MODULES=y # CONFIG_MODULE_FORCE_LOAD is not set CONFIG_MODULE_UNLOAD=y # CONFIG_MODULE_FORCE_UNLOAD is not set # CONFIG_MODVERSIONS is not set # CONFIG_MODULE_SRCVERSION_ALL is not set # CONFIG_MODULE_SIG is not set # CONFIG_MODULE_COMPRESS is not set # CONFIG_TRIM_UNUSED_KSYMS is not set CONFIG_BLOCK=y CONFIG_LBDAF=y # CONFIG_BLK_DEV_BSG is not set # CONFIG_BLK_DEV_BSGLIB is not set # CONFIG_BLK_DEV_INTEGRITY is not set # CONFIG_BLK_CMDLINE_PARSER is not set # # Partition Types # # CONFIG_PARTITION_ADVANCED is not set CONFIG_MSDOS_PARTITION=y CONFIG_EFI_PARTITION=y # # IO Schedulers # CONFIG_IOSCHED_NOOP=y CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y # CONFIG_DEFAULT_DEADLINE is not set CONFIG_DEFAULT_CFQ=y # CONFIG_DEFAULT_NOOP is not set CONFIG_DEFAULT_IOSCHED="cfq" CONFIG_UNINLINE_SPIN_UNLOCK=y CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y CONFIG_MUTEX_SPIN_ON_OWNER=y CONFIG_RWSEM_SPIN_ON_OWNER=y CONFIG_LOCK_SPIN_ON_OWNER=y # CONFIG_FREEZER is not set # # System Type # CONFIG_MMU=y CONFIG_ARCH_MULTIPLATFORM=y # CONFIG_ARCH_GEMINI is not set # CONFIG_ARCH_EBSA110 is not set # CONFIG_ARCH_EP93XX is not set # CONFIG_ARCH_FOOTBRIDGE is not set # CONFIG_ARCH_NETX is not set # CONFIG_ARCH_IOP13XX is not set # CONFIG_ARCH_IOP32X is not set # CONFIG_ARCH_IOP33X is not set # CONFIG_ARCH_IXP4XX is not set # CONFIG_ARCH_DOVE is not set # CONFIG_ARCH_KS8695 is not set # CONFIG_ARCH_W90X900 is not set # CONFIG_ARCH_LPC32XX is not set # CONFIG_ARCH_PXA is not set # CONFIG_ARCH_RPC is not set # CONFIG_ARCH_SA1100 is not set # CONFIG_ARCH_S3C24XX is not set # CONFIG_ARCH_DAVINCI is not set # CONFIG_ARCH_OMAP1 is not set # # Multiple platform selection # # # CPU Core family selection # # CONFIG_ARCH_MULTI_V6 is not set CONFIG_ARCH_MULTI_V7=y CONFIG_ARCH_MULTI_V6_V7=y # CONFIG_ARCH_MULTI_CPU_AUTO is not set # CONFIG_ARCH_VIRT is not set # CONFIG_ARCH_MVEBU is not set # CONFIG_ARCH_ALPINE is not set # CONFIG_ARCH_ARTPEC is not set # CONFIG_ARCH_AT91 is not set # CONFIG_ARCH_BCM is not set # CONFIG_ARCH_BERLIN is not set # CONFIG_ARCH_DIGICOLOR is not set # CONFIG_ARCH_HIGHBANK is not set # CONFIG_ARCH_HISI is not set # CONFIG_ARCH_KEYSTONE is not set # CONFIG_ARCH_MESON is not set # CONFIG_ARCH_MXC is not set # CONFIG_ARCH_MEDIATEK is not set # # TI OMAP/AM/DM/DRA Family # # CONFIG_ARCH_OMAP3 is not set # CONFIG_ARCH_OMAP4 is not set # CONFIG_SOC_OMAP5 is not set # CONFIG_SOC_AM33XX is not set # CONFIG_SOC_AM43XX is not set # CONFIG_SOC_DRA7XX is not set # CONFIG_ARCH_MMP is not set # CONFIG_ARCH_QCOM is not set # CONFIG_ARCH_REALVIEW is not set # CONFIG_ARCH_ROCKCHIP is not set # CONFIG_ARCH_SOCFPGA is not set # CONFIG_PLAT_SPEAR is not set # CONFIG_ARCH_STI is not set # CONFIG_ARCH_S5PV210 is not set # CONFIG_ARCH_EXYNOS is not set # CONFIG_ARCH_RENESAS is not set CONFIG_ARCH_SUNXI=y # CONFIG_MACH_SUN4I is not set # CONFIG_MACH_SUN5I is not set # CONFIG_MACH_SUN6I is not set CONFIG_MACH_SUN7I=y # CONFIG_MACH_SUN8I is not set # CONFIG_MACH_SUN9I is not set # CONFIG_ARCH_SIRF is not set # CONFIG_ARCH_TANGO is not set # CONFIG_ARCH_TEGRA is not set # CONFIG_ARCH_UNIPHIER is not set # CONFIG_ARCH_U8500 is not set # CONFIG_ARCH_VEXPRESS is not set # CONFIG_ARCH_WM8850 is not set # CONFIG_ARCH_ZX is not set # CONFIG_ARCH_ZYNQ is not set # # Processor Type # CONFIG_CPU_V7=y CONFIG_CPU_32v6K=y CONFIG_CPU_32v7=y CONFIG_CPU_ABRT_EV7=y CONFIG_CPU_PABRT_V7=y CONFIG_CPU_CACHE_V7=y CONFIG_CPU_CACHE_VIPT=y CONFIG_CPU_COPY_V6=y CONFIG_CPU_TLB_V7=y CONFIG_CPU_HAS_ASID=y CONFIG_CPU_CP15=y CONFIG_CPU_CP15_MMU=y # # Processor Features # # CONFIG_ARM_LPAE is not set # CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set CONFIG_ARM_THUMB=y # CONFIG_ARM_THUMBEE is not set CONFIG_ARM_VIRT_EXT=y CONFIG_SWP_EMULATE=y # CONFIG_CPU_BIG_ENDIAN is not set # CONFIG_CPU_ICACHE_DISABLE is not set # CONFIG_CPU_BPREDICT_DISABLE is not set CONFIG_KUSER_HELPERS=y CONFIG_VDSO=y CONFIG_OUTER_CACHE=y CONFIG_OUTER_CACHE_SYNC=y CONFIG_MIGHT_HAVE_CACHE_L2X0=y CONFIG_CACHE_L2X0=y # CONFIG_PL310_ERRATA_588369 is not set # CONFIG_PL310_ERRATA_727915 is not set # CONFIG_PL310_ERRATA_753970 is not set # CONFIG_PL310_ERRATA_769419 is not set CONFIG_ARM_L1_CACHE_SHIFT_6=y CONFIG_ARM_L1_CACHE_SHIFT=6 CONFIG_ARM_DMA_MEM_BUFFERABLE=y CONFIG_ARM_HEAVY_MB=y CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y CONFIG_DEBUG_RODATA=y CONFIG_DEBUG_ALIGN_RODATA=y CONFIG_MULTI_IRQ_HANDLER=y # CONFIG_ARM_ERRATA_430973 is not set # CONFIG_ARM_ERRATA_643719 is not set # CONFIG_ARM_ERRATA_720789 is not set # CONFIG_ARM_ERRATA_754322 is not set # CONFIG_ARM_ERRATA_754327 is not set # CONFIG_ARM_ERRATA_764369 is not set # CONFIG_ARM_ERRATA_775420 is not set # CONFIG_ARM_ERRATA_798181 is not set # CONFIG_ARM_ERRATA_773022 is not set # CONFIG_ARM_ERRATA_818325_852422 is not set # CONFIG_ARM_ERRATA_821420 is not set # CONFIG_ARM_ERRATA_825619 is not set # CONFIG_ARM_ERRATA_852421 is not set # CONFIG_ARM_ERRATA_852423 is not set # # Bus support # # CONFIG_PCI is not set # CONFIG_PCI_DOMAINS_GENERIC is not set # CONFIG_PCI_SYSCALL is not set # CONFIG_PCCARD is not set # # Kernel Features # CONFIG_HAVE_SMP=y CONFIG_SMP=y CONFIG_SMP_ON_UP=y CONFIG_ARM_CPU_TOPOLOGY=y # CONFIG_SCHED_MC is not set # CONFIG_SCHED_SMT is not set CONFIG_HAVE_ARM_ARCH_TIMER=y # CONFIG_MCPM is not set # CONFIG_BIG_LITTLE is not set CONFIG_VMSPLIT_3G=y # CONFIG_VMSPLIT_3G_OPT is not set # CONFIG_VMSPLIT_2G is not set # CONFIG_VMSPLIT_1G is not set CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_NR_CPUS=2 # CONFIG_HOTPLUG_CPU is not set CONFIG_ARM_PSCI=y CONFIG_ARCH_NR_GPIO=416 # CONFIG_PREEMPT_NONE is not set # CONFIG_PREEMPT_VOLUNTARY is not set CONFIG_PREEMPT=y CONFIG_PREEMPT_COUNT=y CONFIG_HZ_FIXED=0 # CONFIG_HZ_100 is not set # CONFIG_HZ_200 is not set # CONFIG_HZ_250 is not set # CONFIG_HZ_300 is not set # CONFIG_HZ_500 is not set CONFIG_HZ_1000=y CONFIG_HZ=1000 CONFIG_SCHED_HRTICK=y # CONFIG_THUMB2_KERNEL is not set CONFIG_ARM_PATCH_IDIV=y CONFIG_AEABI=y # CONFIG_OABI_COMPAT is not set # CONFIG_ARCH_SPARSEMEM_DEFAULT is not set # CONFIG_ARCH_SELECT_MEMORY_MODEL is not set CONFIG_HAVE_ARCH_PFN_VALID=y # CONFIG_HIGHMEM is not set CONFIG_CPU_SW_DOMAIN_PAN=y CONFIG_ARCH_WANT_GENERAL_HUGETLB=y # CONFIG_ARM_MODULE_PLTS is not set CONFIG_FLATMEM=y CONFIG_FLAT_NODE_MEM_MAP=y CONFIG_HAVE_MEMBLOCK=y CONFIG_NO_BOOTMEM=y CONFIG_MEMORY_ISOLATION=y # CONFIG_HAVE_BOOTMEM_INFO_NODE is not set CONFIG_SPLIT_PTLOCK_CPUS=4 CONFIG_COMPACTION=y CONFIG_MIGRATION=y # CONFIG_PHYS_ADDR_T_64BIT is not set # CONFIG_KSM is not set CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 CONFIG_CLEANCACHE=y CONFIG_CMA=y # CONFIG_CMA_DEBUG is not set # CONFIG_CMA_DEBUGFS is not set CONFIG_CMA_AREAS=7 # CONFIG_ZPOOL is not set # CONFIG_ZBUD is not set # CONFIG_ZSMALLOC is not set CONFIG_GENERIC_EARLY_IOREMAP=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_FRAME_VECTOR=y CONFIG_FORCE_MAX_ZONEORDER=11 CONFIG_ALIGNMENT_TRAP=y CONFIG_UACCESS_WITH_MEMCPY=y CONFIG_SECCOMP=y CONFIG_SWIOTLB=y CONFIG_IOMMU_HELPER=y # CONFIG_PARAVIRT is not set # CONFIG_PARAVIRT_TIME_ACCOUNTING is not set # CONFIG_XEN is not set # # Boot options # CONFIG_USE_OF=y CONFIG_ATAGS=y # CONFIG_DEPRECATED_PARAM_STRUCT is not set CONFIG_ZBOOT_ROM_TEXT=0 CONFIG_ZBOOT_ROM_BSS=0 # CONFIG_ARM_APPENDED_DTB is not set CONFIG_CMDLINE="" # CONFIG_CRASH_DUMP is not set CONFIG_AUTO_ZRELADDR=y # CONFIG_EFI is not set # # CPU Power Management # # # CPU Frequency scaling # CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ_GOV_ATTR_SET=y CONFIG_CPU_FREQ_GOV_COMMON=y CONFIG_CPU_FREQ_STAT=y # CONFIG_CPU_FREQ_STAT_DETAILS is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_POWERSAVE=y CONFIG_CPU_FREQ_GOV_USERSPACE=y CONFIG_CPU_FREQ_GOV_ONDEMAND=y CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y # CONFIG_CPU_FREQ_GOV_SCHEDUTIL is not set # # CPU frequency scaling drivers # CONFIG_CPUFREQ_DT=y CONFIG_CPUFREQ_DT_PLATDEV=y # CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set # CONFIG_ARM_KIRKWOOD_CPUFREQ is not set # CONFIG_QORIQ_CPUFREQ is not set # # CPU Idle # # CONFIG_CPU_IDLE is not set # CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set # # Floating point emulation # # # At least one emulation must be selected # CONFIG_VFP=y CONFIG_VFPv3=y CONFIG_NEON=y CONFIG_KERNEL_MODE_NEON=y # # Userspace binary formats # CONFIG_BINFMT_ELF=y CONFIG_ELFCORE=y CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y CONFIG_BINFMT_SCRIPT=y # CONFIG_BINFMT_FLAT is not set # CONFIG_HAVE_AOUT is not set # CONFIG_BINFMT_MISC is not set CONFIG_COREDUMP=y # # Power management options # # CONFIG_SUSPEND is not set CONFIG_PM=y # CONFIG_PM_DEBUG is not set # CONFIG_APM_EMULATION is not set CONFIG_PM_OPP=y CONFIG_PM_CLK=y # CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM_CPU_SUSPEND=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y CONFIG_NET=y CONFIG_NET_INGRESS=y # # Networking options # CONFIG_PACKET=y # CONFIG_PACKET_DIAG is not set CONFIG_UNIX=y # CONFIG_UNIX_DIAG is not set # CONFIG_XFRM_USER is not set # CONFIG_NET_KEY is not set CONFIG_INET=y # CONFIG_IP_MULTICAST is not set # CONFIG_IP_ADVANCED_ROUTER is not set CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y # CONFIG_IP_PNP_BOOTP is not set # CONFIG_IP_PNP_RARP is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE_DEMUX is not set # CONFIG_NET_IP_TUNNEL is not set CONFIG_SYN_COOKIES=y # CONFIG_NET_UDP_TUNNEL is not set # CONFIG_NET_FOU is not set # CONFIG_INET_AH is not set # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set # CONFIG_INET_XFRM_TUNNEL is not set # CONFIG_INET_TUNNEL is not set # CONFIG_INET_XFRM_MODE_TRANSPORT is not set # CONFIG_INET_XFRM_MODE_TUNNEL is not set # CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_DIAG is not set # CONFIG_TCP_CONG_ADVANCED is not set CONFIG_TCP_CONG_CUBIC=y CONFIG_DEFAULT_TCP_CONG="cubic" # CONFIG_TCP_MD5SIG is not set # CONFIG_IPV6 is not set # CONFIG_NETWORK_SECMARK is not set CONFIG_NET_PTP_CLASSIFY=y # CONFIG_NETWORK_PHY_TIMESTAMPING is not set CONFIG_NETFILTER=y # CONFIG_NETFILTER_DEBUG is not set # CONFIG_NETFILTER_ADVANCED is not set # # Core Netfilter Configuration # CONFIG_NETFILTER_INGRESS=y CONFIG_NETFILTER_NETLINK=m CONFIG_NETFILTER_NETLINK_LOG=m CONFIG_NF_CONNTRACK=m CONFIG_NF_LOG_COMMON=m # CONFIG_NF_CONNTRACK_PROCFS is not set CONFIG_NF_CONNTRACK_FTP=m # CONFIG_NF_CONNTRACK_IRC is not set CONFIG_NF_CONNTRACK_BROADCAST=m CONFIG_NF_CONNTRACK_NETBIOS_NS=m # CONFIG_NF_CONNTRACK_SIP is not set CONFIG_NF_CT_NETLINK=m # CONFIG_NETFILTER_NETLINK_GLUE_CT is not set CONFIG_NF_NAT=m CONFIG_NF_NAT_NEEDED=y # CONFIG_NF_NAT_AMANDA is not set CONFIG_NF_NAT_FTP=m # CONFIG_NF_NAT_IRC is not set # CONFIG_NF_NAT_SIP is not set # CONFIG_NF_NAT_TFTP is not set CONFIG_NF_NAT_REDIRECT=m # CONFIG_NF_TABLES is not set CONFIG_NETFILTER_XTABLES=y # # Xtables combined modules # CONFIG_NETFILTER_XT_MARK=m # # Xtables targets # CONFIG_NETFILTER_XT_TARGET_LOG=m CONFIG_NETFILTER_XT_NAT=m CONFIG_NETFILTER_XT_TARGET_NETMAP=m CONFIG_NETFILTER_XT_TARGET_NFLOG=m CONFIG_NETFILTER_XT_TARGET_REDIRECT=m CONFIG_NETFILTER_XT_TARGET_TCPMSS=m # # Xtables matches # CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m CONFIG_NETFILTER_XT_MATCH_STATE=m # CONFIG_IP_SET is not set # CONFIG_IP_VS is not set # # IP: Netfilter Configuration # CONFIG_NF_DEFRAG_IPV4=m CONFIG_NF_CONNTRACK_IPV4=m # CONFIG_NF_DUP_IPV4 is not set CONFIG_NF_LOG_ARP=m CONFIG_NF_LOG_IPV4=m CONFIG_NF_REJECT_IPV4=m CONFIG_NF_NAT_IPV4=m CONFIG_NF_NAT_MASQUERADE_IPV4=m # CONFIG_NF_NAT_PPTP is not set # CONFIG_NF_NAT_H323 is not set CONFIG_IP_NF_IPTABLES=y CONFIG_IP_NF_FILTER=y CONFIG_IP_NF_TARGET_REJECT=m CONFIG_IP_NF_NAT=m CONFIG_IP_NF_TARGET_MASQUERADE=m CONFIG_IP_NF_MANGLE=m # CONFIG_IP_NF_RAW is not set # CONFIG_IP_DCCP is not set # CONFIG_IP_SCTP is not set # CONFIG_RDS is not set # CONFIG_TIPC is not set # CONFIG_ATM is not set # CONFIG_L2TP is not set # CONFIG_BRIDGE is not set CONFIG_HAVE_NET_DSA=y # CONFIG_VLAN_8021Q is not set # CONFIG_DECNET is not set # CONFIG_LLC2 is not set # CONFIG_IPX is not set # CONFIG_ATALK is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set # CONFIG_PHONET is not set # CONFIG_IEEE802154 is not set # CONFIG_NET_SCHED is not set # CONFIG_DCB is not set CONFIG_DNS_RESOLVER=y # CONFIG_BATMAN_ADV is not set # CONFIG_OPENVSWITCH is not set # CONFIG_VSOCKETS is not set # CONFIG_NETLINK_DIAG is not set # CONFIG_MPLS is not set # CONFIG_HSR is not set # CONFIG_NET_SWITCHDEV is not set # CONFIG_NET_L3_MASTER_DEV is not set # CONFIG_NET_NCSI is not set CONFIG_RPS=y CONFIG_RFS_ACCEL=y CONFIG_XPS=y # CONFIG_SOCK_CGROUP_DATA is not set CONFIG_NET_RX_BUSY_POLL=y CONFIG_BQL=y # CONFIG_BPF_JIT is not set CONFIG_NET_FLOW_LIMIT=y # # Network testing # # CONFIG_NET_PKTGEN is not set # CONFIG_HAMRADIO is not set # CONFIG_CAN is not set # CONFIG_IRDA is not set # CONFIG_BT is not set # CONFIG_AF_RXRPC is not set # CONFIG_AF_KCM is not set # CONFIG_STREAM_PARSER is not set CONFIG_WIRELESS=y CONFIG_WIRELESS_EXT=y CONFIG_WEXT_CORE=y CONFIG_WEXT_PROC=y CONFIG_WEXT_SPY=y CONFIG_WEXT_PRIV=y CONFIG_CFG80211=m # CONFIG_NL80211_TESTMODE is not set # CONFIG_CFG80211_DEVELOPER_WARNINGS is not set # CONFIG_CFG80211_CERTIFICATION_ONUS is not set # CONFIG_CFG80211_DEFAULT_PS is not set # CONFIG_CFG80211_DEBUGFS is not set # CONFIG_CFG80211_INTERNAL_REGDB is not set CONFIG_CFG80211_CRDA_SUPPORT=y CONFIG_CFG80211_WEXT=y CONFIG_LIB80211=m CONFIG_LIB80211_CRYPT_WEP=m CONFIG_LIB80211_CRYPT_CCMP=m CONFIG_LIB80211_CRYPT_TKIP=m # CONFIG_LIB80211_DEBUG is not set CONFIG_MAC80211=m CONFIG_MAC80211_HAS_RC=y CONFIG_MAC80211_RC_MINSTREL=y CONFIG_MAC80211_RC_MINSTREL_HT=y # CONFIG_MAC80211_RC_MINSTREL_VHT is not set CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" # CONFIG_MAC80211_MESH is not set CONFIG_MAC80211_LEDS=y # CONFIG_MAC80211_DEBUGFS is not set # CONFIG_MAC80211_MESSAGE_TRACING is not set # CONFIG_MAC80211_DEBUG_MENU is not set CONFIG_MAC80211_STA_HASH_MAX_SIZE=0 # CONFIG_WIMAX is not set CONFIG_RFKILL=m CONFIG_RFKILL_LEDS=y CONFIG_RFKILL_INPUT=y # CONFIG_RFKILL_REGULATOR is not set # CONFIG_RFKILL_GPIO is not set # CONFIG_NET_9P is not set # CONFIG_CAIF is not set # CONFIG_CEPH_LIB is not set # CONFIG_NFC is not set # CONFIG_LWTUNNEL is not set # CONFIG_DST_CACHE is not set # CONFIG_NET_DEVLINK is not set CONFIG_MAY_USE_DEVLINK=y CONFIG_HAVE_CBPF_JIT=y # # Device Drivers # # # Generic Driver Options # CONFIG_UEVENT_HELPER=y CONFIG_UEVENT_HELPER_PATH="" CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y CONFIG_STANDALONE=y CONFIG_PREVENT_FIRMWARE_BUILD=y CONFIG_FW_LOADER=y # CONFIG_FIRMWARE_IN_KERNEL is not set CONFIG_EXTRA_FIRMWARE="" # CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set CONFIG_ALLOW_DEV_COREDUMP=y # CONFIG_DEBUG_DRIVER is not set # CONFIG_DEBUG_DEVRES is not set # CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set # CONFIG_SYS_HYPERVISOR is not set # CONFIG_GENERIC_CPU_DEVICES is not set CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_REGMAP_SPI=y CONFIG_REGMAP_MMIO=y CONFIG_REGMAP_IRQ=y CONFIG_DMA_SHARED_BUFFER=y # CONFIG_FENCE_TRACE is not set CONFIG_DMA_CMA=y # # Default contiguous memory area size: # CONFIG_CMA_SIZE_MBYTES=16 CONFIG_CMA_SIZE_SEL_MBYTES=y # CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set # CONFIG_CMA_SIZE_SEL_MIN is not set # CONFIG_CMA_SIZE_SEL_MAX is not set CONFIG_CMA_ALIGNMENT=8 # # Bus devices # # CONFIG_BRCMSTB_GISB_ARB is not set CONFIG_SUNXI_RSB=y # CONFIG_VEXPRESS_CONFIG is not set # CONFIG_CONNECTOR is not set # CONFIG_MTD is not set CONFIG_DTC=y CONFIG_OF=y # CONFIG_OF_UNITTEST is not set CONFIG_OF_FLATTREE=y CONFIG_OF_EARLY_FLATTREE=y CONFIG_OF_ADDRESS=y CONFIG_OF_IRQ=y CONFIG_OF_NET=y CONFIG_OF_MDIO=y CONFIG_OF_RESERVED_MEM=y # CONFIG_OF_OVERLAY is not set CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y # CONFIG_PARPORT is not set CONFIG_BLK_DEV=y # CONFIG_BLK_DEV_NULL_BLK is not set # CONFIG_BLK_DEV_COW_COMMON is not set # CONFIG_BLK_DEV_LOOP is not set # CONFIG_BLK_DEV_DRBD is not set # CONFIG_BLK_DEV_NBD is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=2 CONFIG_BLK_DEV_RAM_SIZE=4096 # CONFIG_CDROM_PKTCDVD is not set # CONFIG_ATA_OVER_ETH is not set # CONFIG_MG_DISK is not set # CONFIG_BLK_DEV_RBD is not set # CONFIG_NVME_TARGET is not set # # Misc devices # # CONFIG_SENSORS_LIS3LV02D is not set # CONFIG_AD525X_DPOT is not set # CONFIG_DUMMY_IRQ is not set # CONFIG_ICS932S401 is not set # CONFIG_ENCLOSURE_SERVICES is not set # CONFIG_APDS9802ALS is not set # CONFIG_ISL29003 is not set # CONFIG_ISL29020 is not set # CONFIG_SENSORS_TSL2550 is not set # CONFIG_SENSORS_BH1770 is not set # CONFIG_SENSORS_APDS990X is not set # CONFIG_HMC6352 is not set # CONFIG_DS1682 is not set # CONFIG_TI_DAC7512 is not set # CONFIG_USB_SWITCH_FSA9480 is not set # CONFIG_LATTICE_ECP3_CONFIG is not set # CONFIG_SRAM is not set # CONFIG_C2PORT is not set # # EEPROM support # # CONFIG_EEPROM_AT24 is not set # CONFIG_EEPROM_AT25 is not set # CONFIG_EEPROM_LEGACY is not set # CONFIG_EEPROM_MAX6875 is not set CONFIG_EEPROM_93CX6=m # CONFIG_EEPROM_93XX46 is not set # # Texas Instruments shared transport line discipline # # CONFIG_TI_ST is not set # CONFIG_SENSORS_LIS3_SPI is not set # CONFIG_SENSORS_LIS3_I2C is not set # # Altera FPGA firmware download module # # CONFIG_ALTERA_STAPL is not set # # Intel MIC Bus Driver # # # SCIF Bus Driver # # # VOP Bus Driver # # # Intel MIC Host Driver # # # Intel MIC Card Driver # # # SCIF Driver # # # Intel MIC Coprocessor State Management (COSM) Drivers # # # VOP Driver # # CONFIG_ECHO is not set # CONFIG_CXL_BASE is not set # CONFIG_CXL_AFU_DRIVER_OPS is not set # # SCSI device support # CONFIG_SCSI_MOD=y # CONFIG_RAID_ATTRS is not set CONFIG_SCSI=y CONFIG_SCSI_DMA=y # CONFIG_SCSI_NETLINK is not set # CONFIG_SCSI_MQ_DEFAULT is not set # CONFIG_SCSI_PROC_FS is not set # # SCSI support type (disk, tape, CD-ROM) # CONFIG_BLK_DEV_SD=m # CONFIG_CHR_DEV_ST is not set # CONFIG_CHR_DEV_OSST is not set # CONFIG_BLK_DEV_SR is not set # CONFIG_CHR_DEV_SG is not set # CONFIG_CHR_DEV_SCH is not set # CONFIG_SCSI_CONSTANTS is not set # CONFIG_SCSI_LOGGING is not set # CONFIG_SCSI_SCAN_ASYNC is not set # # SCSI Transports # # CONFIG_SCSI_SPI_ATTRS is not set # CONFIG_SCSI_FC_ATTRS is not set # CONFIG_SCSI_ISCSI_ATTRS is not set # CONFIG_SCSI_SAS_ATTRS is not set # CONFIG_SCSI_SAS_LIBSAS is not set # CONFIG_SCSI_SRP_ATTRS is not set # CONFIG_SCSI_LOWLEVEL is not set # CONFIG_SCSI_DH is not set # CONFIG_SCSI_OSD_INITIATOR is not set CONFIG_ATA=y # CONFIG_ATA_NONSTANDARD is not set CONFIG_ATA_VERBOSE_ERROR=y CONFIG_SATA_PMP=y # # Controllers with non-SFF native interface # # CONFIG_SATA_AHCI_PLATFORM is not set # CONFIG_AHCI_CEVA is not set CONFIG_AHCI_SUNXI=y # CONFIG_AHCI_QORIQ is not set # CONFIG_ATA_SFF is not set # CONFIG_MD is not set # CONFIG_TARGET_CORE is not set CONFIG_NETDEVICES=y CONFIG_MII=y CONFIG_NET_CORE=y # CONFIG_BONDING is not set # CONFIG_DUMMY is not set # CONFIG_EQUALIZER is not set # CONFIG_NET_TEAM is not set # CONFIG_MACVLAN is not set # CONFIG_VXLAN is not set # CONFIG_MACSEC is not set # CONFIG_NETCONSOLE is not set # CONFIG_NETPOLL is not set # CONFIG_NET_POLL_CONTROLLER is not set CONFIG_TUN=m # CONFIG_TUN_VNET_CROSS_LE is not set # CONFIG_VETH is not set # CONFIG_NLMON is not set # # CAIF transport drivers # # # Distributed Switch Architecture drivers # CONFIG_ETHERNET=y CONFIG_NET_VENDOR_ALLWINNER=y CONFIG_SUN4I_EMAC=y # CONFIG_ALTERA_TSE is not set CONFIG_NET_VENDOR_AMAZON=y # CONFIG_NET_VENDOR_ARC is not set # CONFIG_NET_VENDOR_AURORA is not set # CONFIG_NET_CADENCE is not set # CONFIG_NET_VENDOR_BROADCOM is not set # CONFIG_NET_VENDOR_CIRRUS is not set # CONFIG_DM9000 is not set # CONFIG_DNET is not set CONFIG_NET_VENDOR_EZCHIP=y # CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set # CONFIG_NET_VENDOR_FARADAY is not set # CONFIG_NET_VENDOR_HISILICON is not set # CONFIG_NET_VENDOR_INTEL is not set # CONFIG_NET_VENDOR_MARVELL is not set # CONFIG_NET_VENDOR_MICREL is not set # CONFIG_NET_VENDOR_MICROCHIP is not set # CONFIG_NET_VENDOR_NATSEMI is not set CONFIG_NET_VENDOR_NETRONOME=y # CONFIG_ETHOC is not set # CONFIG_NET_VENDOR_QUALCOMM is not set CONFIG_NET_VENDOR_RENESAS=y # CONFIG_NET_VENDOR_ROCKER is not set # CONFIG_NET_VENDOR_SAMSUNG is not set # CONFIG_NET_VENDOR_SEEQ is not set # CONFIG_NET_VENDOR_SMSC is not set CONFIG_NET_VENDOR_STMICRO=y CONFIG_STMMAC_ETH=y CONFIG_STMMAC_PLATFORM=y CONFIG_DWMAC_GENERIC=y CONFIG_DWMAC_SUNXI=y CONFIG_NET_VENDOR_SYNOPSYS=y # CONFIG_SYNOPSYS_DWC_ETH_QOS is not set # CONFIG_NET_VENDOR_VIA is not set # CONFIG_NET_VENDOR_WIZNET is not set CONFIG_PHYLIB=y CONFIG_SWPHY=y # # MDIO bus device drivers # # CONFIG_MDIO_BCM_UNIMAC is not set # CONFIG_MDIO_BITBANG is not set # CONFIG_MDIO_BUS_MUX_GPIO is not set # CONFIG_MDIO_BUS_MUX_MMIOREG is not set # CONFIG_MDIO_HISI_FEMAC is not set CONFIG_MDIO_SUN4I=y # # MII PHY device drivers # # CONFIG_AMD_PHY is not set # CONFIG_AQUANTIA_PHY is not set # CONFIG_AT803X_PHY is not set # CONFIG_BCM7XXX_PHY is not set # CONFIG_BCM87XX_PHY is not set # CONFIG_BROADCOM_PHY is not set # CONFIG_CICADA_PHY is not set # CONFIG_DAVICOM_PHY is not set # CONFIG_DP83848_PHY is not set # CONFIG_DP83867_PHY is not set CONFIG_FIXED_PHY=y # CONFIG_ICPLUS_PHY is not set # CONFIG_INTEL_XWAY_PHY is not set # CONFIG_LSI_ET1011C_PHY is not set # CONFIG_LXT_PHY is not set # CONFIG_MARVELL_PHY is not set # CONFIG_MICREL_PHY is not set # CONFIG_MICROCHIP_PHY is not set # CONFIG_MICROSEMI_PHY is not set # CONFIG_NATIONAL_PHY is not set # CONFIG_QSEMI_PHY is not set # CONFIG_REALTEK_PHY is not set # CONFIG_SMSC_PHY is not set # CONFIG_STE10XP is not set # CONFIG_TERANETICS_PHY is not set # CONFIG_VITESSE_PHY is not set # CONFIG_XILINX_GMII2RGMII is not set # CONFIG_MICREL_KS8995MA is not set CONFIG_PPP=m CONFIG_PPP_BSDCOMP=m CONFIG_PPP_DEFLATE=m CONFIG_PPP_FILTER=y CONFIG_PPP_MPPE=m CONFIG_PPP_MULTILINK=y CONFIG_PPPOE=m CONFIG_PPP_ASYNC=m CONFIG_PPP_SYNC_TTY=m # CONFIG_SLIP is not set CONFIG_SLHC=m CONFIG_USB_NET_DRIVERS=y CONFIG_USB_CATC=m CONFIG_USB_KAWETH=m CONFIG_USB_PEGASUS=m CONFIG_USB_RTL8150=m CONFIG_USB_RTL8152=m # CONFIG_USB_LAN78XX is not set CONFIG_USB_USBNET=m CONFIG_USB_NET_AX8817X=m CONFIG_USB_NET_AX88179_178A=m CONFIG_USB_NET_CDCETHER=m CONFIG_USB_NET_CDC_EEM=m CONFIG_USB_NET_CDC_NCM=m # CONFIG_USB_NET_HUAWEI_CDC_NCM is not set CONFIG_USB_NET_CDC_MBIM=m CONFIG_USB_NET_DM9601=m CONFIG_USB_NET_SR9700=m CONFIG_USB_NET_SR9800=m CONFIG_USB_NET_SMSC75XX=m CONFIG_USB_NET_SMSC95XX=m # CONFIG_USB_NET_GL620A is not set # CONFIG_USB_NET_NET1080 is not set # CONFIG_USB_NET_PLUSB is not set CONFIG_USB_NET_MCS7830=m CONFIG_USB_NET_RNDIS_HOST=m # CONFIG_USB_NET_CDC_SUBSET is not set # CONFIG_USB_NET_ZAURUS is not set # CONFIG_USB_NET_CX82310_ETH is not set # CONFIG_USB_NET_KALMIA is not set # CONFIG_USB_NET_QMI_WWAN is not set CONFIG_USB_HSO=m CONFIG_USB_NET_INT51X1=m CONFIG_USB_IPHETH=m # CONFIG_USB_SIERRA_NET is not set # CONFIG_USB_VL600 is not set # CONFIG_USB_NET_CH9200 is not set CONFIG_WLAN=y CONFIG_WLAN_VENDOR_ADMTEK=y CONFIG_ATH_COMMON=m CONFIG_WLAN_VENDOR_ATH=y # CONFIG_ATH_DEBUG is not set CONFIG_ATH9K_HW=m CONFIG_ATH9K_COMMON=m # CONFIG_ATH9K_BTCOEX_SUPPORT is not set CONFIG_ATH9K=m CONFIG_ATH9K_AHB=y # CONFIG_ATH9K_DEBUGFS is not set # CONFIG_ATH9K_DYNACK is not set # CONFIG_ATH9K_WOW is not set CONFIG_ATH9K_RFKILL=y # CONFIG_ATH9K_CHANNEL_CONTEXT is not set CONFIG_ATH9K_PCOEM=y CONFIG_ATH9K_HTC=m # CONFIG_ATH9K_HTC_DEBUGFS is not set # CONFIG_ATH9K_HWRNG is not set CONFIG_CARL9170=m # CONFIG_CARL9170_LEDS is not set CONFIG_CARL9170_WPC=y # CONFIG_CARL9170_HWRNG is not set CONFIG_ATH6KL=m # CONFIG_ATH6KL_SDIO is not set CONFIG_ATH6KL_USB=m # CONFIG_ATH6KL_DEBUG is not set CONFIG_AR5523=m CONFIG_ATH10K=m # CONFIG_ATH10K_DEBUG is not set # CONFIG_ATH10K_DEBUGFS is not set CONFIG_WCN36XX=m # CONFIG_WCN36XX_DEBUGFS is not set CONFIG_WLAN_VENDOR_ATMEL=y CONFIG_AT76C50X_USB=m CONFIG_WLAN_VENDOR_BROADCOM=y CONFIG_B43=m CONFIG_B43_BCMA=y CONFIG_B43_SSB=y CONFIG_B43_BUSES_BCMA_AND_SSB=y # CONFIG_B43_BUSES_BCMA is not set # CONFIG_B43_BUSES_SSB is not set # CONFIG_B43_SDIO is not set CONFIG_B43_BCMA_PIO=y CONFIG_B43_PIO=y CONFIG_B43_PHY_G=y CONFIG_B43_PHY_N=y CONFIG_B43_PHY_LP=y CONFIG_B43_PHY_HT=y CONFIG_B43_LEDS=y CONFIG_B43_HWRNG=y # CONFIG_B43_DEBUG is not set CONFIG_B43LEGACY=m CONFIG_B43LEGACY_LEDS=y CONFIG_B43LEGACY_HWRNG=y # CONFIG_B43LEGACY_DEBUG is not set CONFIG_B43LEGACY_DMA=y CONFIG_B43LEGACY_PIO=y CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y # CONFIG_B43LEGACY_DMA_MODE is not set # CONFIG_B43LEGACY_PIO_MODE is not set CONFIG_BRCMUTIL=m # CONFIG_BRCMSMAC is not set CONFIG_BRCMFMAC=m CONFIG_BRCMFMAC_PROTO_BCDC=y # CONFIG_BRCMFMAC_SDIO is not set CONFIG_BRCMFMAC_USB=y # CONFIG_BRCM_TRACING is not set # CONFIG_BRCMDBG is not set CONFIG_WLAN_VENDOR_CISCO=y CONFIG_WLAN_VENDOR_INTEL=y CONFIG_WLAN_VENDOR_INTERSIL=y CONFIG_HOSTAP=m CONFIG_HOSTAP_FIRMWARE=y CONFIG_HOSTAP_FIRMWARE_NVRAM=y CONFIG_P54_COMMON=m CONFIG_P54_USB=m # CONFIG_P54_SPI is not set CONFIG_P54_LEDS=y CONFIG_WLAN_VENDOR_MARVELL=y CONFIG_LIBERTAS=m CONFIG_LIBERTAS_USB=m # CONFIG_LIBERTAS_SDIO is not set # CONFIG_LIBERTAS_SPI is not set # CONFIG_LIBERTAS_DEBUG is not set # CONFIG_LIBERTAS_MESH is not set CONFIG_LIBERTAS_THINFIRM=m # CONFIG_LIBERTAS_THINFIRM_DEBUG is not set CONFIG_LIBERTAS_THINFIRM_USB=m CONFIG_MWIFIEX=m # CONFIG_MWIFIEX_SDIO is not set CONFIG_MWIFIEX_USB=m CONFIG_WLAN_VENDOR_MEDIATEK=y # CONFIG_MT7601U is not set CONFIG_WLAN_VENDOR_RALINK=y CONFIG_RT2X00=m CONFIG_RT2500USB=m CONFIG_RT73USB=m CONFIG_RT2800USB=m CONFIG_RT2800USB_RT33XX=y CONFIG_RT2800USB_RT35XX=y CONFIG_RT2800USB_RT3573=y CONFIG_RT2800USB_RT53XX=y CONFIG_RT2800USB_RT55XX=y CONFIG_RT2800USB_UNKNOWN=y CONFIG_RT2800_LIB=m CONFIG_RT2X00_LIB_USB=m CONFIG_RT2X00_LIB=m CONFIG_RT2X00_LIB_FIRMWARE=y CONFIG_RT2X00_LIB_CRYPTO=y CONFIG_RT2X00_LIB_LEDS=y # CONFIG_RT2X00_DEBUG is not set CONFIG_WLAN_VENDOR_REALTEK=y CONFIG_RTL8187=m CONFIG_RTL8187_LEDS=y CONFIG_RTL_CARDS=m CONFIG_RTL8192CU=m CONFIG_RTLWIFI=m CONFIG_RTLWIFI_USB=m CONFIG_RTLWIFI_DEBUG=y CONFIG_RTL8192C_COMMON=m # CONFIG_RTL8XXXU is not set CONFIG_WLAN_VENDOR_RSI=y CONFIG_RSI_91X=m # CONFIG_RSI_DEBUGFS is not set # CONFIG_RSI_SDIO is not set CONFIG_RSI_USB=m CONFIG_WLAN_VENDOR_ST=y # CONFIG_CW1200 is not set CONFIG_WLAN_VENDOR_TI=y # CONFIG_WL1251 is not set # CONFIG_WL12XX is not set # CONFIG_WL18XX is not set # CONFIG_WLCORE is not set CONFIG_WLAN_VENDOR_ZYDAS=y CONFIG_USB_ZD1201=m CONFIG_ZD1211RW=m # CONFIG_ZD1211RW_DEBUG is not set # CONFIG_MAC80211_HWSIM is not set CONFIG_USB_NET_RNDIS_WLAN=m # # Enable WiMAX (Networking options) to see the WiMAX drivers # # CONFIG_WAN is not set # CONFIG_ISDN is not set # CONFIG_NVM is not set # # Input device support # CONFIG_INPUT=y CONFIG_INPUT_LEDS=y CONFIG_INPUT_FF_MEMLESS=m # CONFIG_INPUT_POLLDEV is not set # CONFIG_INPUT_SPARSEKMAP is not set # CONFIG_INPUT_MATRIXKMAP is not set # # Userland interfaces # # CONFIG_INPUT_MOUSEDEV is not set # CONFIG_INPUT_JOYDEV is not set # CONFIG_INPUT_EVDEV is not set # CONFIG_INPUT_EVBUG is not set # # Input Device Drivers # # CONFIG_INPUT_KEYBOARD is not set # CONFIG_INPUT_MOUSE is not set # CONFIG_INPUT_JOYSTICK is not set # CONFIG_INPUT_TABLET is not set # CONFIG_INPUT_TOUCHSCREEN is not set CONFIG_INPUT_MISC=y # CONFIG_INPUT_AD714X is not set # CONFIG_INPUT_ATMEL_CAPTOUCH is not set # CONFIG_INPUT_BMA150 is not set # CONFIG_INPUT_E3X0_BUTTON is not set # CONFIG_INPUT_MMA8450 is not set # CONFIG_INPUT_MPU3050 is not set # CONFIG_INPUT_GP2A is not set # CONFIG_INPUT_GPIO_BEEPER is not set # CONFIG_INPUT_GPIO_TILT_POLLED is not set # CONFIG_INPUT_GPIO_DECODER is not set # CONFIG_INPUT_ATI_REMOTE2 is not set # CONFIG_INPUT_KEYSPAN_REMOTE is not set # CONFIG_INPUT_KXTJ9 is not set # CONFIG_INPUT_POWERMATE is not set # CONFIG_INPUT_YEALINK is not set # CONFIG_INPUT_CM109 is not set # CONFIG_INPUT_REGULATOR_HAPTIC is not set CONFIG_INPUT_AXP20X_PEK=y # CONFIG_INPUT_UINPUT is not set # CONFIG_INPUT_PCF8574 is not set # CONFIG_INPUT_PWM_BEEPER is not set # CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set # CONFIG_INPUT_ADXL34X is not set # CONFIG_INPUT_IMS_PCU is not set # CONFIG_INPUT_CMA3000 is not set # CONFIG_INPUT_DRV260X_HAPTICS is not set # CONFIG_INPUT_DRV2665_HAPTICS is not set # CONFIG_INPUT_DRV2667_HAPTICS is not set # CONFIG_RMI4_CORE is not set # # Hardware I/O ports # # CONFIG_SERIO is not set # CONFIG_GAMEPORT is not set # # Character devices # CONFIG_TTY=y CONFIG_VT=y CONFIG_CONSOLE_TRANSLATIONS=y CONFIG_VT_CONSOLE=y CONFIG_HW_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y CONFIG_UNIX98_PTYS=y # CONFIG_LEGACY_PTYS is not set # CONFIG_SERIAL_NONSTANDARD is not set # CONFIG_N_GSM is not set # CONFIG_TRACE_SINK is not set CONFIG_DEVMEM=y # CONFIG_DEVKMEM is not set # # Serial drivers # CONFIG_SERIAL_EARLYCON=y CONFIG_SERIAL_8250=y # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set # CONFIG_SERIAL_8250_FINTEK is not set CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_DMA=y CONFIG_SERIAL_8250_NR_UARTS=8 CONFIG_SERIAL_8250_RUNTIME_UARTS=8 # CONFIG_SERIAL_8250_EXTENDED is not set CONFIG_SERIAL_8250_FSL=y # CONFIG_SERIAL_8250_DW is not set # CONFIG_SERIAL_8250_EM is not set # CONFIG_SERIAL_8250_RT288X is not set # CONFIG_SERIAL_OF_PLATFORM is not set # # Non-8250 serial port support # # CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST is not set # CONFIG_SERIAL_MAX3100 is not set # CONFIG_SERIAL_MAX310X is not set # CONFIG_SERIAL_UARTLITE is not set CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y # CONFIG_SERIAL_SCCNXP is not set # CONFIG_SERIAL_SC16IS7XX is not set # CONFIG_SERIAL_BCM63XX is not set # CONFIG_SERIAL_ALTERA_JTAGUART is not set # CONFIG_SERIAL_ALTERA_UART is not set # CONFIG_SERIAL_IFX6X60 is not set # CONFIG_SERIAL_XILINX_PS_UART is not set # CONFIG_SERIAL_ARC is not set # CONFIG_SERIAL_FSL_LPUART is not set # CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set # CONFIG_SERIAL_ST_ASC is not set # CONFIG_SERIAL_STM32 is not set CONFIG_TTY_PRINTK=y # CONFIG_HVC_DCC is not set # CONFIG_IPMI_HANDLER is not set CONFIG_HW_RANDOM=y # CONFIG_HW_RANDOM_TIMERIOMEM is not set # CONFIG_R3964 is not set CONFIG_RAW_DRIVER=y CONFIG_MAX_RAW_DEVS=256 # CONFIG_TCG_TPM is not set # CONFIG_XILLYBUS is not set # # I2C support # CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_COMPAT=y CONFIG_I2C_CHARDEV=m CONFIG_I2C_MUX=m # # Multiplexer I2C Chip support # # CONFIG_I2C_ARB_GPIO_CHALLENGE is not set # CONFIG_I2C_MUX_GPIO is not set # CONFIG_I2C_MUX_PCA9541 is not set # CONFIG_I2C_MUX_PCA954x is not set # CONFIG_I2C_MUX_PINCTRL is not set # CONFIG_I2C_MUX_REG is not set # CONFIG_I2C_DEMUX_PINCTRL is not set CONFIG_I2C_HELPER_AUTO=y CONFIG_I2C_ALGOBIT=m # # I2C Hardware Bus support # # # I2C system bus drivers (mostly embedded / system-on-chip) # # CONFIG_I2C_CBUS_GPIO is not set # CONFIG_I2C_DESIGNWARE_PLATFORM is not set # CONFIG_I2C_EMEV2 is not set # CONFIG_I2C_GPIO is not set CONFIG_I2C_MV64XXX=y # CONFIG_I2C_OCORES is not set # CONFIG_I2C_PCA_PLATFORM is not set # CONFIG_I2C_PXA_PCI is not set # CONFIG_I2C_RK3X is not set # CONFIG_I2C_SIMTEC is not set # CONFIG_I2C_XILINX is not set # # External I2C/SMBus adapter drivers # # CONFIG_I2C_DIOLAN_U2C is not set # CONFIG_I2C_PARPORT_LIGHT is not set # CONFIG_I2C_ROBOTFUZZ_OSIF is not set # CONFIG_I2C_TAOS_EVM is not set # CONFIG_I2C_TINY_USB is not set # # Other I2C/SMBus bus drivers # # CONFIG_I2C_STUB is not set # CONFIG_I2C_SLAVE is not set # CONFIG_I2C_DEBUG_CORE is not set # CONFIG_I2C_DEBUG_ALGO is not set # CONFIG_I2C_DEBUG_BUS is not set CONFIG_SPI=y # CONFIG_SPI_DEBUG is not set CONFIG_SPI_MASTER=y # # SPI Master Controller Drivers # # CONFIG_SPI_ALTERA is not set # CONFIG_SPI_AXI_SPI_ENGINE is not set # CONFIG_SPI_BITBANG is not set # CONFIG_SPI_CADENCE is not set # CONFIG_SPI_DESIGNWARE is not set # CONFIG_SPI_GPIO is not set # CONFIG_SPI_FSL_SPI is not set # CONFIG_SPI_OC_TINY is not set # CONFIG_SPI_PXA2XX_PCI is not set # CONFIG_SPI_ROCKCHIP is not set # CONFIG_SPI_SC18IS602 is not set CONFIG_SPI_SUN4I=m # CONFIG_SPI_SUN6I is not set # CONFIG_SPI_XCOMM is not set # CONFIG_SPI_XILINX is not set # CONFIG_SPI_ZYNQMP_GQSPI is not set # # SPI Protocol Masters # # CONFIG_SPI_SPIDEV is not set # CONFIG_SPI_LOOPBACK_TEST is not set # CONFIG_SPI_TLE62X0 is not set # CONFIG_SPMI is not set # CONFIG_HSI is not set # # PPS support # CONFIG_PPS=y # CONFIG_PPS_DEBUG is not set # # PPS clients support # # CONFIG_PPS_CLIENT_KTIMER is not set # CONFIG_PPS_CLIENT_LDISC is not set # CONFIG_PPS_CLIENT_GPIO is not set # # PPS generators support # # # PTP clock support # CONFIG_PTP_1588_CLOCK=y # # Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. # CONFIG_PINCTRL=y # # Pin controllers # CONFIG_PINMUX=y CONFIG_PINCONF=y CONFIG_GENERIC_PINCONF=y # CONFIG_DEBUG_PINCTRL is not set # CONFIG_PINCTRL_AMD is not set # CONFIG_PINCTRL_SINGLE is not set CONFIG_PINCTRL_SUNXI=y # CONFIG_PINCTRL_SUN4I_A10 is not set # CONFIG_PINCTRL_SUN5I_A10S is not set # CONFIG_PINCTRL_SUN5I_A13 is not set # CONFIG_PINCTRL_GR8 is not set # CONFIG_PINCTRL_SUN6I_A31 is not set # CONFIG_PINCTRL_SUN6I_A31S is not set # CONFIG_PINCTRL_SUN6I_A31_R is not set CONFIG_PINCTRL_SUN7I_A20=y # CONFIG_PINCTRL_SUN8I_A23 is not set # CONFIG_PINCTRL_SUN8I_A33 is not set # CONFIG_PINCTRL_SUN8I_A83T is not set # CONFIG_PINCTRL_SUN8I_A23_R is not set # CONFIG_PINCTRL_SUN8I_H3 is not set # CONFIG_PINCTRL_SUN8I_H3_R is not set # CONFIG_PINCTRL_SUN9I_A80 is not set # CONFIG_PINCTRL_SUN9I_A80_R is not set CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y CONFIG_GPIOLIB=y CONFIG_OF_GPIO=y # CONFIG_DEBUG_GPIO is not set CONFIG_GPIO_SYSFS=y # # Memory mapped GPIO drivers # # CONFIG_GPIO_74XX_MMIO is not set # CONFIG_GPIO_ALTERA is not set # CONFIG_GPIO_AXP209 is not set # CONFIG_GPIO_DWAPB is not set # CONFIG_GPIO_EM is not set # CONFIG_GPIO_GENERIC_PLATFORM is not set # CONFIG_GPIO_GRGPIO is not set # CONFIG_GPIO_MOCKUP is not set # CONFIG_GPIO_MPC8XXX is not set # CONFIG_GPIO_SYSCON is not set # CONFIG_GPIO_XILINX is not set # CONFIG_GPIO_ZEVIO is not set # CONFIG_GPIO_ZX is not set # # I2C GPIO expanders # # CONFIG_GPIO_ADP5588 is not set # CONFIG_GPIO_ADNP is not set # CONFIG_GPIO_MAX7300 is not set # CONFIG_GPIO_MAX732X is not set # CONFIG_GPIO_PCA953X is not set # CONFIG_GPIO_PCF857X is not set # CONFIG_GPIO_SX150X is not set # CONFIG_GPIO_TPIC2810 is not set # CONFIG_GPIO_TS4900 is not set # # MFD GPIO expanders # # CONFIG_HTC_EGPIO is not set # # SPI GPIO expanders # # CONFIG_GPIO_74X164 is not set # CONFIG_GPIO_MAX7301 is not set # CONFIG_GPIO_MC33880 is not set # CONFIG_GPIO_PISOSR is not set # # SPI or I2C GPIO expanders # # CONFIG_GPIO_MCP23S08 is not set # # USB GPIO expanders # # CONFIG_W1 is not set # CONFIG_POWER_AVS is not set # CONFIG_POWER_RESET is not set CONFIG_POWER_SUPPLY=y # CONFIG_POWER_SUPPLY_DEBUG is not set # CONFIG_PDA_POWER is not set # CONFIG_TEST_POWER is not set # CONFIG_BATTERY_DS2780 is not set # CONFIG_BATTERY_DS2781 is not set # CONFIG_BATTERY_DS2782 is not set # CONFIG_BATTERY_SBS is not set # CONFIG_BATTERY_BQ27XXX is not set # CONFIG_BATTERY_MAX17040 is not set # CONFIG_BATTERY_MAX17042 is not set # CONFIG_CHARGER_ISP1704 is not set # CONFIG_CHARGER_MAX8903 is not set # CONFIG_CHARGER_LP8727 is not set # CONFIG_CHARGER_GPIO is not set # CONFIG_CHARGER_MANAGER is not set # CONFIG_CHARGER_BQ2415X is not set # CONFIG_CHARGER_BQ24190 is not set # CONFIG_CHARGER_BQ24257 is not set # CONFIG_CHARGER_BQ24735 is not set # CONFIG_CHARGER_BQ25890 is not set # CONFIG_CHARGER_SMB347 is not set # CONFIG_BATTERY_GAUGE_LTC2941 is not set # CONFIG_CHARGER_RT9455 is not set CONFIG_AXP20X_POWER=y # CONFIG_HWMON is not set CONFIG_THERMAL=y CONFIG_THERMAL_OF=y # CONFIG_THERMAL_WRITABLE_TRIPS is not set CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y # CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set # CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set # CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR is not set # CONFIG_THERMAL_GOV_FAIR_SHARE is not set CONFIG_THERMAL_GOV_STEP_WISE=y # CONFIG_THERMAL_GOV_BANG_BANG is not set # CONFIG_THERMAL_GOV_USER_SPACE is not set # CONFIG_THERMAL_GOV_POWER_ALLOCATOR is not set # CONFIG_CPU_THERMAL is not set # CONFIG_CLOCK_THERMAL is not set # CONFIG_THERMAL_EMULATION is not set # CONFIG_QORIQ_THERMAL is not set # # ACPI INT340X thermal drivers # CONFIG_WATCHDOG=y CONFIG_WATCHDOG_CORE=y # CONFIG_WATCHDOG_NOWAYOUT is not set # CONFIG_WATCHDOG_SYSFS is not set # # Watchdog Device Drivers # # CONFIG_SOFT_WATCHDOG is not set # CONFIG_GPIO_WATCHDOG is not set # CONFIG_XILINX_WATCHDOG is not set # CONFIG_ZIIRAVE_WATCHDOG is not set # CONFIG_CADENCE_WATCHDOG is not set # CONFIG_DW_WATCHDOG is not set CONFIG_SUNXI_WATCHDOG=y # CONFIG_MAX63XX_WATCHDOG is not set # CONFIG_MEN_A21_WDT is not set # # USB-based Watchdog Cards # # CONFIG_USBPCWATCHDOG is not set # # Watchdog Pretimeout Governors # # CONFIG_WATCHDOG_PRETIMEOUT_GOV is not set CONFIG_SSB_POSSIBLE=y # # Sonics Silicon Backplane # CONFIG_SSB=m CONFIG_SSB_BLOCKIO=y CONFIG_SSB_SDIOHOST_POSSIBLE=y # CONFIG_SSB_SDIOHOST is not set # CONFIG_SSB_SILENT is not set # CONFIG_SSB_DEBUG is not set # CONFIG_SSB_DRIVER_GPIO is not set CONFIG_BCMA_POSSIBLE=y # # Broadcom specific AMBA # CONFIG_BCMA=m CONFIG_BCMA_BLOCKIO=y # CONFIG_BCMA_HOST_SOC is not set # CONFIG_BCMA_DRIVER_GMAC_CMN is not set # CONFIG_BCMA_DRIVER_GPIO is not set # CONFIG_BCMA_DEBUG is not set # # Multifunction device drivers # CONFIG_MFD_CORE=y # CONFIG_MFD_ACT8945A is not set # CONFIG_MFD_AS3711 is not set # CONFIG_MFD_AS3722 is not set # CONFIG_PMIC_ADP5520 is not set # CONFIG_MFD_AAT2870_CORE is not set # CONFIG_MFD_ATMEL_FLEXCOM is not set # CONFIG_MFD_ATMEL_HLCDC is not set # CONFIG_MFD_BCM590XX is not set # CONFIG_MFD_AC100 is not set CONFIG_MFD_AXP20X=y CONFIG_MFD_AXP20X_I2C=y CONFIG_MFD_AXP20X_RSB=y # CONFIG_MFD_CROS_EC is not set # CONFIG_MFD_ASIC3 is not set # CONFIG_PMIC_DA903X is not set # CONFIG_MFD_DA9052_SPI is not set # CONFIG_MFD_DA9052_I2C is not set # CONFIG_MFD_DA9055 is not set # CONFIG_MFD_DA9062 is not set # CONFIG_MFD_DA9063 is not set # CONFIG_MFD_DA9150 is not set # CONFIG_MFD_DLN2 is not set # CONFIG_MFD_EXYNOS_LPASS is not set # CONFIG_MFD_MC13XXX_SPI is not set # CONFIG_MFD_MC13XXX_I2C is not set # CONFIG_MFD_HI6421_PMIC is not set # CONFIG_HTC_PASIC3 is not set # CONFIG_HTC_I2CPLD is not set # CONFIG_INTEL_SOC_PMIC is not set # CONFIG_MFD_KEMPLD is not set # CONFIG_MFD_88PM800 is not set # CONFIG_MFD_88PM805 is not set # CONFIG_MFD_88PM860X is not set # CONFIG_MFD_MAX14577 is not set # CONFIG_MFD_MAX77620 is not set # CONFIG_MFD_MAX77686 is not set # CONFIG_MFD_MAX77693 is not set # CONFIG_MFD_MAX77843 is not set # CONFIG_MFD_MAX8907 is not set # CONFIG_MFD_MAX8925 is not set # CONFIG_MFD_MAX8997 is not set # CONFIG_MFD_MAX8998 is not set # CONFIG_MFD_MT6397 is not set # CONFIG_MFD_MENF21BMC is not set # CONFIG_EZX_PCAP is not set # CONFIG_MFD_VIPERBOARD is not set # CONFIG_MFD_RETU is not set # CONFIG_MFD_PCF50633 is not set # CONFIG_UCB1400_CORE is not set # CONFIG_MFD_PM8921_CORE is not set # CONFIG_MFD_RT5033 is not set # CONFIG_MFD_RTSX_USB is not set # CONFIG_MFD_RC5T583 is not set # CONFIG_MFD_RK808 is not set # CONFIG_MFD_RN5T618 is not set # CONFIG_MFD_SEC_CORE is not set # CONFIG_MFD_SI476X_CORE is not set # CONFIG_MFD_SM501 is not set # CONFIG_MFD_SKY81452 is not set # CONFIG_MFD_SMSC is not set # CONFIG_ABX500_CORE is not set # CONFIG_MFD_STMPE is not set # CONFIG_MFD_SUN6I_PRCM is not set CONFIG_MFD_SYSCON=y # CONFIG_MFD_TI_AM335X_TSCADC is not set # CONFIG_MFD_LP3943 is not set # CONFIG_MFD_LP8788 is not set # CONFIG_MFD_PALMAS is not set # CONFIG_TPS6105X is not set # CONFIG_TPS65010 is not set # CONFIG_TPS6507X is not set # CONFIG_MFD_TPS65086 is not set # CONFIG_MFD_TPS65090 is not set # CONFIG_MFD_TPS65217 is not set # CONFIG_MFD_TI_LP873X is not set # CONFIG_MFD_TPS65218 is not set # CONFIG_MFD_TPS6586X is not set # CONFIG_MFD_TPS65910 is not set # CONFIG_MFD_TPS65912_I2C is not set # CONFIG_MFD_TPS65912_SPI is not set # CONFIG_MFD_TPS80031 is not set # CONFIG_TWL4030_CORE is not set # CONFIG_TWL6040_CORE is not set # CONFIG_MFD_WL1273_CORE is not set # CONFIG_MFD_LM3533 is not set # CONFIG_MFD_TC3589X is not set # CONFIG_MFD_TMIO is not set # CONFIG_MFD_T7L66XB is not set # CONFIG_MFD_TC6387XB is not set # CONFIG_MFD_TC6393XB is not set # CONFIG_MFD_ARIZONA_I2C is not set # CONFIG_MFD_ARIZONA_SPI is not set # CONFIG_MFD_WM8400 is not set # CONFIG_MFD_WM831X_I2C is not set # CONFIG_MFD_WM831X_SPI is not set # CONFIG_MFD_WM8350_I2C is not set # CONFIG_MFD_WM8994 is not set CONFIG_REGULATOR=y # CONFIG_REGULATOR_DEBUG is not set CONFIG_REGULATOR_FIXED_VOLTAGE=y # CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set # CONFIG_REGULATOR_USERSPACE_CONSUMER is not set # CONFIG_REGULATOR_ACT8865 is not set # CONFIG_REGULATOR_AD5398 is not set # CONFIG_REGULATOR_ANATOP is not set CONFIG_REGULATOR_AXP20X=y # CONFIG_REGULATOR_DA9210 is not set # CONFIG_REGULATOR_DA9211 is not set # CONFIG_REGULATOR_FAN53555 is not set CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_ISL9305 is not set # CONFIG_REGULATOR_ISL6271A is not set # CONFIG_REGULATOR_LP3971 is not set # CONFIG_REGULATOR_LP3972 is not set # CONFIG_REGULATOR_LP872X is not set # CONFIG_REGULATOR_LP8755 is not set # CONFIG_REGULATOR_LTC3589 is not set # CONFIG_REGULATOR_LTC3676 is not set # CONFIG_REGULATOR_MAX1586 is not set # CONFIG_REGULATOR_MAX8649 is not set # CONFIG_REGULATOR_MAX8660 is not set # CONFIG_REGULATOR_MAX8952 is not set # CONFIG_REGULATOR_MAX8973 is not set # CONFIG_REGULATOR_MT6311 is not set # CONFIG_REGULATOR_PFUZE100 is not set # CONFIG_REGULATOR_PV88060 is not set # CONFIG_REGULATOR_PV88080 is not set # CONFIG_REGULATOR_PV88090 is not set # CONFIG_REGULATOR_PWM is not set # CONFIG_REGULATOR_TPS51632 is not set # CONFIG_REGULATOR_TPS62360 is not set # CONFIG_REGULATOR_TPS65023 is not set # CONFIG_REGULATOR_TPS6507X is not set # CONFIG_REGULATOR_TPS6524X is not set CONFIG_MEDIA_SUPPORT=y # # Multimedia core support # CONFIG_MEDIA_CAMERA_SUPPORT=y CONFIG_MEDIA_ANALOG_TV_SUPPORT=y CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y # CONFIG_MEDIA_RADIO_SUPPORT is not set # CONFIG_MEDIA_SDR_SUPPORT is not set # CONFIG_MEDIA_RC_SUPPORT is not set CONFIG_MEDIA_CONTROLLER=y # CONFIG_MEDIA_CONTROLLER_DVB is not set CONFIG_VIDEO_DEV=y # CONFIG_VIDEO_V4L2_SUBDEV_API is not set CONFIG_VIDEO_V4L2=y # CONFIG_VIDEO_ADV_DEBUG is not set # CONFIG_VIDEO_FIXED_MINOR_RANGES is not set CONFIG_VIDEO_TUNER=m CONFIG_VIDEOBUF_GEN=m CONFIG_VIDEOBUF_VMALLOC=m CONFIG_VIDEOBUF2_CORE=y CONFIG_VIDEOBUF2_MEMOPS=y CONFIG_VIDEOBUF2_VMALLOC=y CONFIG_DVB_CORE=y # CONFIG_DVB_NET is not set # CONFIG_TTPCI_EEPROM is not set CONFIG_DVB_MAX_ADAPTERS=8 # CONFIG_DVB_DYNAMIC_MINORS is not set # # Media drivers # CONFIG_MEDIA_USB_SUPPORT=y # # Webcam devices # CONFIG_USB_VIDEO_CLASS=y CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y CONFIG_USB_GSPCA=m CONFIG_USB_M5602=m CONFIG_USB_STV06XX=m CONFIG_USB_GL860=m CONFIG_USB_GSPCA_BENQ=m CONFIG_USB_GSPCA_CONEX=m CONFIG_USB_GSPCA_CPIA1=m CONFIG_USB_GSPCA_DTCS033=m CONFIG_USB_GSPCA_ETOMS=m CONFIG_USB_GSPCA_FINEPIX=m CONFIG_USB_GSPCA_JEILINJ=m CONFIG_USB_GSPCA_JL2005BCD=m CONFIG_USB_GSPCA_KINECT=m CONFIG_USB_GSPCA_KONICA=m CONFIG_USB_GSPCA_MARS=m CONFIG_USB_GSPCA_MR97310A=m CONFIG_USB_GSPCA_NW80X=m CONFIG_USB_GSPCA_OV519=m CONFIG_USB_GSPCA_OV534=m CONFIG_USB_GSPCA_OV534_9=m CONFIG_USB_GSPCA_PAC207=m CONFIG_USB_GSPCA_PAC7302=m CONFIG_USB_GSPCA_PAC7311=m CONFIG_USB_GSPCA_SE401=m CONFIG_USB_GSPCA_SN9C2028=m CONFIG_USB_GSPCA_SN9C20X=m CONFIG_USB_GSPCA_SONIXB=m CONFIG_USB_GSPCA_SONIXJ=m CONFIG_USB_GSPCA_SPCA500=m CONFIG_USB_GSPCA_SPCA501=m CONFIG_USB_GSPCA_SPCA505=m CONFIG_USB_GSPCA_SPCA506=m CONFIG_USB_GSPCA_SPCA508=m CONFIG_USB_GSPCA_SPCA561=m CONFIG_USB_GSPCA_SPCA1528=m CONFIG_USB_GSPCA_SQ905=m CONFIG_USB_GSPCA_SQ905C=m CONFIG_USB_GSPCA_SQ930X=m CONFIG_USB_GSPCA_STK014=m CONFIG_USB_GSPCA_STK1135=m CONFIG_USB_GSPCA_STV0680=m CONFIG_USB_GSPCA_SUNPLUS=m CONFIG_USB_GSPCA_T613=m CONFIG_USB_GSPCA_TOPRO=m CONFIG_USB_GSPCA_TOUPTEK=m CONFIG_USB_GSPCA_TV8532=m CONFIG_USB_GSPCA_VC032X=m CONFIG_USB_GSPCA_VICAM=m CONFIG_USB_GSPCA_XIRLINK_CIT=m CONFIG_USB_GSPCA_ZC3XX=m CONFIG_USB_PWC=m # CONFIG_USB_PWC_DEBUG is not set CONFIG_USB_PWC_INPUT_EVDEV=y CONFIG_VIDEO_CPIA2=m CONFIG_USB_ZR364XX=m CONFIG_USB_STKWEBCAM=m CONFIG_USB_S2255=m CONFIG_VIDEO_USBTV=m # # Analog TV USB devices # CONFIG_VIDEO_PVRUSB2=m CONFIG_VIDEO_PVRUSB2_SYSFS=y CONFIG_VIDEO_PVRUSB2_DVB=y # CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set CONFIG_VIDEO_HDPVR=m CONFIG_VIDEO_USBVISION=m CONFIG_VIDEO_STK1160_COMMON=m CONFIG_VIDEO_STK1160_AC97=y CONFIG_VIDEO_STK1160=m CONFIG_VIDEO_GO7007=m CONFIG_VIDEO_GO7007_USB=m CONFIG_VIDEO_GO7007_LOADER=m CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m # # Analog/digital TV USB devices # CONFIG_VIDEO_AU0828=m CONFIG_VIDEO_AU0828_V4L2=y # # Digital TV USB devices # CONFIG_DVB_USB_V2=m CONFIG_DVB_USB_AF9015=m CONFIG_DVB_USB_AF9035=m CONFIG_DVB_USB_ANYSEE=m CONFIG_DVB_USB_AU6610=m CONFIG_DVB_USB_AZ6007=m CONFIG_DVB_USB_CE6230=m CONFIG_DVB_USB_EC168=m CONFIG_DVB_USB_GL861=m CONFIG_DVB_USB_MXL111SF=m CONFIG_DVB_USB_RTL28XXU=m CONFIG_DVB_USB_DVBSKY=m CONFIG_SMS_USB_DRV=m CONFIG_DVB_B2C2_FLEXCOP_USB=m # CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set CONFIG_DVB_AS102=m # # Webcam, TV (analog/digital) USB devices # CONFIG_VIDEO_EM28XX=m CONFIG_VIDEO_EM28XX_V4L2=m CONFIG_VIDEO_EM28XX_ALSA=m CONFIG_VIDEO_EM28XX_DVB=m CONFIG_V4L_PLATFORM_DRIVERS=y CONFIG_SOC_CAMERA=m # CONFIG_SOC_CAMERA_PLATFORM is not set # CONFIG_V4L_MEM2MEM_DRIVERS is not set # CONFIG_V4L_TEST_DRIVERS is not set # CONFIG_DVB_PLATFORM_DRIVERS is not set # # Supported MMC/SDIO adapters # # CONFIG_SMS_SDIO_DRV is not set CONFIG_MEDIA_COMMON_OPTIONS=y # # common driver options # CONFIG_VIDEO_CX2341X=m CONFIG_VIDEO_TVEEPROM=m CONFIG_CYPRESS_FIRMWARE=m CONFIG_DVB_B2C2_FLEXCOP=m CONFIG_SMS_SIANO_MDTV=m # # Media ancillary drivers (tuners, sensors, i2c, spi, frontends) # # CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set CONFIG_MEDIA_ATTACH=y # # I2C Encoders, decoders, sensors and other helper chips # # # Audio decoders, processors and mixers # # CONFIG_VIDEO_TVAUDIO is not set # CONFIG_VIDEO_TDA7432 is not set # CONFIG_VIDEO_TDA9840 is not set # CONFIG_VIDEO_TEA6415C is not set # CONFIG_VIDEO_TEA6420 is not set CONFIG_VIDEO_MSP3400=m # CONFIG_VIDEO_CS3308 is not set # CONFIG_VIDEO_CS5345 is not set CONFIG_VIDEO_CS53L32A=m # CONFIG_VIDEO_TLV320AIC23B is not set # CONFIG_VIDEO_UDA1342 is not set CONFIG_VIDEO_WM8775=m # CONFIG_VIDEO_WM8739 is not set # CONFIG_VIDEO_VP27SMPX is not set # CONFIG_VIDEO_SONY_BTF_MPX is not set # # RDS decoders # # CONFIG_VIDEO_SAA6588 is not set # # Video decoders # # CONFIG_VIDEO_ADV7183 is not set # CONFIG_VIDEO_BT819 is not set # CONFIG_VIDEO_BT856 is not set # CONFIG_VIDEO_BT866 is not set # CONFIG_VIDEO_KS0127 is not set # CONFIG_VIDEO_ML86V7667 is not set # CONFIG_VIDEO_AD5820 is not set # CONFIG_VIDEO_SAA7110 is not set CONFIG_VIDEO_SAA711X=m # CONFIG_VIDEO_TVP514X is not set # CONFIG_VIDEO_TVP5150 is not set # CONFIG_VIDEO_TVP7002 is not set # CONFIG_VIDEO_TW2804 is not set # CONFIG_VIDEO_TW9903 is not set # CONFIG_VIDEO_TW9906 is not set # CONFIG_VIDEO_VPX3220 is not set # # Video and audio decoders # # CONFIG_VIDEO_SAA717X is not set CONFIG_VIDEO_CX25840=m # # Video encoders # # CONFIG_VIDEO_SAA7127 is not set # CONFIG_VIDEO_SAA7185 is not set # CONFIG_VIDEO_ADV7170 is not set # CONFIG_VIDEO_ADV7175 is not set # CONFIG_VIDEO_ADV7343 is not set # CONFIG_VIDEO_ADV7393 is not set # CONFIG_VIDEO_AK881X is not set # CONFIG_VIDEO_THS8200 is not set # # Camera sensor devices # # CONFIG_VIDEO_OV2659 is not set CONFIG_VIDEO_OV7640=m CONFIG_VIDEO_OV7670=m CONFIG_VIDEO_VS6624=m CONFIG_VIDEO_MT9M111=m CONFIG_VIDEO_MT9V011=m CONFIG_VIDEO_SR030PC30=m # # Flash devices # # CONFIG_VIDEO_ADP1653 is not set # CONFIG_VIDEO_AS3645A is not set # CONFIG_VIDEO_LM3560 is not set # CONFIG_VIDEO_LM3646 is not set # # Video improvement chips # # CONFIG_VIDEO_UPD64031A is not set # CONFIG_VIDEO_UPD64083 is not set # # Audio/Video compression chips # # CONFIG_VIDEO_SAA6752HS is not set # # Miscellaneous helper chips # # CONFIG_VIDEO_THS7303 is not set # CONFIG_VIDEO_M52790 is not set # # Sensors used on soc_camera driver # # # soc_camera sensor drivers # CONFIG_SOC_CAMERA_IMX074=m CONFIG_SOC_CAMERA_MT9M001=m CONFIG_SOC_CAMERA_MT9M111=m CONFIG_SOC_CAMERA_MT9T031=m CONFIG_SOC_CAMERA_MT9T112=m CONFIG_SOC_CAMERA_MT9V022=m CONFIG_SOC_CAMERA_OV2640=m CONFIG_SOC_CAMERA_OV5642=m CONFIG_SOC_CAMERA_OV6650=m CONFIG_SOC_CAMERA_OV772X=m CONFIG_SOC_CAMERA_OV9640=m CONFIG_SOC_CAMERA_OV9740=m CONFIG_SOC_CAMERA_RJ54N1=m CONFIG_SOC_CAMERA_TW9910=m # # SPI helper chips # CONFIG_MEDIA_TUNER=y # # Customize TV tuners # # CONFIG_MEDIA_TUNER_SIMPLE is not set # CONFIG_MEDIA_TUNER_TDA8290 is not set # CONFIG_MEDIA_TUNER_TDA827X is not set # CONFIG_MEDIA_TUNER_TDA18271 is not set # CONFIG_MEDIA_TUNER_TDA9887 is not set # CONFIG_MEDIA_TUNER_TEA5761 is not set # CONFIG_MEDIA_TUNER_TEA5767 is not set # CONFIG_MEDIA_TUNER_MSI001 is not set # CONFIG_MEDIA_TUNER_MT20XX is not set # CONFIG_MEDIA_TUNER_MT2060 is not set # CONFIG_MEDIA_TUNER_MT2063 is not set # CONFIG_MEDIA_TUNER_MT2266 is not set # CONFIG_MEDIA_TUNER_MT2131 is not set # CONFIG_MEDIA_TUNER_QT1010 is not set # CONFIG_MEDIA_TUNER_XC2028 is not set # CONFIG_MEDIA_TUNER_XC5000 is not set # CONFIG_MEDIA_TUNER_XC4000 is not set # CONFIG_MEDIA_TUNER_MXL5005S is not set # CONFIG_MEDIA_TUNER_MXL5007T is not set # CONFIG_MEDIA_TUNER_MC44S803 is not set # CONFIG_MEDIA_TUNER_MAX2165 is not set # CONFIG_MEDIA_TUNER_TDA18218 is not set # CONFIG_MEDIA_TUNER_FC0011 is not set # CONFIG_MEDIA_TUNER_FC0012 is not set # CONFIG_MEDIA_TUNER_FC0013 is not set # CONFIG_MEDIA_TUNER_TDA18212 is not set # CONFIG_MEDIA_TUNER_E4000 is not set # CONFIG_MEDIA_TUNER_FC2580 is not set # CONFIG_MEDIA_TUNER_M88RS6000T is not set # CONFIG_MEDIA_TUNER_TUA9001 is not set # CONFIG_MEDIA_TUNER_SI2157 is not set # CONFIG_MEDIA_TUNER_IT913X is not set # CONFIG_MEDIA_TUNER_R820T is not set # CONFIG_MEDIA_TUNER_MXL301RF is not set # CONFIG_MEDIA_TUNER_QM1D1C0042 is not set # # Customise DVB Frontends # # # Multistandard (satellite) frontends # # CONFIG_DVB_STB0899 is not set # CONFIG_DVB_STB6100 is not set # CONFIG_DVB_STV090x is not set # CONFIG_DVB_STV6110x is not set # CONFIG_DVB_M88DS3103 is not set # # Multistandard (cable + terrestrial) frontends # # CONFIG_DVB_DRXK is not set # CONFIG_DVB_TDA18271C2DD is not set # CONFIG_DVB_SI2165 is not set CONFIG_DVB_MN88472=m CONFIG_DVB_MN88473=m # # DVB-S (satellite) frontends # # CONFIG_DVB_CX24110 is not set # CONFIG_DVB_CX24123 is not set # CONFIG_DVB_MT312 is not set # CONFIG_DVB_ZL10036 is not set # CONFIG_DVB_ZL10039 is not set # CONFIG_DVB_S5H1420 is not set # CONFIG_DVB_STV0288 is not set # CONFIG_DVB_STB6000 is not set # CONFIG_DVB_STV0299 is not set # CONFIG_DVB_STV6110 is not set # CONFIG_DVB_STV0900 is not set # CONFIG_DVB_TDA8083 is not set # CONFIG_DVB_TDA10086 is not set # CONFIG_DVB_TDA8261 is not set # CONFIG_DVB_VES1X93 is not set # CONFIG_DVB_TUNER_ITD1000 is not set # CONFIG_DVB_TUNER_CX24113 is not set # CONFIG_DVB_TDA826X is not set # CONFIG_DVB_TUA6100 is not set # CONFIG_DVB_CX24116 is not set # CONFIG_DVB_CX24117 is not set CONFIG_DVB_CX24120=m # CONFIG_DVB_SI21XX is not set # CONFIG_DVB_TS2020 is not set # CONFIG_DVB_DS3000 is not set # CONFIG_DVB_MB86A16 is not set # CONFIG_DVB_TDA10071 is not set # # DVB-T (terrestrial) frontends # # CONFIG_DVB_SP8870 is not set # CONFIG_DVB_SP887X is not set # CONFIG_DVB_CX22700 is not set # CONFIG_DVB_CX22702 is not set # CONFIG_DVB_S5H1432 is not set # CONFIG_DVB_DRXD is not set # CONFIG_DVB_L64781 is not set # CONFIG_DVB_TDA1004X is not set # CONFIG_DVB_NXT6000 is not set # CONFIG_DVB_MT352 is not set CONFIG_DVB_ZL10353=m # CONFIG_DVB_DIB3000MB is not set # CONFIG_DVB_DIB3000MC is not set # CONFIG_DVB_DIB7000M is not set # CONFIG_DVB_DIB7000P is not set # CONFIG_DVB_DIB9000 is not set # CONFIG_DVB_TDA10048 is not set CONFIG_DVB_AF9013=m CONFIG_DVB_EC100=m # CONFIG_DVB_HD29L2 is not set # CONFIG_DVB_STV0367 is not set # CONFIG_DVB_CXD2820R is not set CONFIG_DVB_CXD2841ER=m CONFIG_DVB_RTL2830=m CONFIG_DVB_RTL2832=m # CONFIG_DVB_SI2168 is not set CONFIG_DVB_AS102_FE=m # CONFIG_DVB_GP8PSK_FE is not set # # DVB-C (cable) frontends # # CONFIG_DVB_VES1820 is not set # CONFIG_DVB_TDA10021 is not set # CONFIG_DVB_TDA10023 is not set # CONFIG_DVB_STV0297 is not set # # ATSC (North American/Korean Terrestrial/Cable DTV) frontends # # CONFIG_DVB_NXT200X is not set # CONFIG_DVB_OR51211 is not set # CONFIG_DVB_OR51132 is not set # CONFIG_DVB_BCM3510 is not set # CONFIG_DVB_LGDT330X is not set # CONFIG_DVB_LGDT3305 is not set # CONFIG_DVB_LGDT3306A is not set # CONFIG_DVB_LG2160 is not set # CONFIG_DVB_S5H1409 is not set # CONFIG_DVB_AU8522_DTV is not set # CONFIG_DVB_AU8522_V4L is not set # CONFIG_DVB_S5H1411 is not set # # ISDB-T (terrestrial) frontends # # CONFIG_DVB_S921 is not set # CONFIG_DVB_DIB8000 is not set # CONFIG_DVB_MB86A20S is not set # # ISDB-S (satellite) & ISDB-T (terrestrial) frontends # # CONFIG_DVB_TC90522 is not set # # Digital terrestrial only tuners/PLL # # CONFIG_DVB_PLL is not set # CONFIG_DVB_TUNER_DIB0070 is not set # CONFIG_DVB_TUNER_DIB0090 is not set # # SEC control devices for DVB-S # # CONFIG_DVB_DRX39XYJ is not set CONFIG_DVB_LNBH25=m # CONFIG_DVB_LNBP21 is not set # CONFIG_DVB_LNBP22 is not set # CONFIG_DVB_ISL6405 is not set # CONFIG_DVB_ISL6421 is not set # CONFIG_DVB_ISL6423 is not set # CONFIG_DVB_A8293 is not set # CONFIG_DVB_SP2 is not set # CONFIG_DVB_LGS8GL5 is not set # CONFIG_DVB_LGS8GXX is not set # CONFIG_DVB_ATBM8830 is not set # CONFIG_DVB_TDA665x is not set # CONFIG_DVB_IX2505V is not set # CONFIG_DVB_M88RS2000 is not set CONFIG_DVB_AF9033=m CONFIG_DVB_HORUS3A=m CONFIG_DVB_ASCOT2E=m CONFIG_DVB_HELENE=m # # Tools to develop new frontends # # CONFIG_DVB_DUMMY_FE is not set # # Graphics support # # CONFIG_IMX_IPUV3_CORE is not set # CONFIG_DRM is not set # # ACP (Audio CoProcessor) Configuration # # # Frame buffer Devices # CONFIG_FB=y # CONFIG_FIRMWARE_EDID is not set CONFIG_FB_CMDLINE=y CONFIG_FB_NOTIFY=y # CONFIG_FB_DDC is not set # CONFIG_FB_BOOT_VESA_SUPPORT is not set CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_IMAGEBLIT=y # CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set # CONFIG_FB_SYS_FILLRECT is not set # CONFIG_FB_SYS_COPYAREA is not set # CONFIG_FB_SYS_IMAGEBLIT is not set # CONFIG_FB_FOREIGN_ENDIAN is not set # CONFIG_FB_SYS_FOPS is not set # CONFIG_FB_SVGALIB is not set # CONFIG_FB_MACMODES is not set # CONFIG_FB_BACKLIGHT is not set # CONFIG_FB_MODE_HELPERS is not set # CONFIG_FB_TILEBLITTING is not set # # Frame buffer hardware drivers # # CONFIG_FB_OPENCORES is not set # CONFIG_FB_S1D13XXX is not set # CONFIG_FB_SMSCUFX is not set # CONFIG_FB_UDL is not set # CONFIG_FB_IBM_GXT4500 is not set # CONFIG_FB_VIRTUAL is not set # CONFIG_FB_METRONOME is not set # CONFIG_FB_BROADSHEET is not set # CONFIG_FB_AUO_K190X is not set CONFIG_FB_SIMPLE=y # CONFIG_FB_SSD1307 is not set # CONFIG_BACKLIGHT_LCD_SUPPORT is not set # CONFIG_VGASTATE is not set # # Console display driver support # CONFIG_DUMMY_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE=y # CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set # CONFIG_LOGO is not set CONFIG_SOUND=y # CONFIG_SOUND_OSS_CORE is not set CONFIG_SND=y CONFIG_SND_TIMER=y CONFIG_SND_PCM=y CONFIG_SND_DMAENGINE_PCM=y CONFIG_SND_HWDEP=m CONFIG_SND_RAWMIDI=m CONFIG_SND_JACK=y CONFIG_SND_JACK_INPUT_DEV=y # CONFIG_SND_SEQUENCER is not set # CONFIG_SND_MIXER_OSS is not set # CONFIG_SND_PCM_OSS is not set CONFIG_SND_PCM_TIMER=y # CONFIG_SND_HRTIMER is not set # CONFIG_SND_DYNAMIC_MINORS is not set CONFIG_SND_SUPPORT_OLD_API=y CONFIG_SND_PROC_FS=y CONFIG_SND_VERBOSE_PROCFS=y # CONFIG_SND_VERBOSE_PRINTK is not set # CONFIG_SND_DEBUG is not set CONFIG_SND_VMASTER=y # CONFIG_SND_RAWMIDI_SEQ is not set # CONFIG_SND_OPL3_LIB_SEQ is not set # CONFIG_SND_OPL4_LIB_SEQ is not set # CONFIG_SND_SBAWE_SEQ is not set # CONFIG_SND_EMU10K1_SEQ is not set CONFIG_SND_AC97_CODEC=m CONFIG_SND_DRIVERS=y CONFIG_SND_DUMMY=m CONFIG_SND_ALOOP=m # CONFIG_SND_MTPAV is not set # CONFIG_SND_SERIAL_U16550 is not set # CONFIG_SND_MPU401 is not set # CONFIG_SND_AC97_POWER_SAVE is not set # # HD-Audio # CONFIG_SND_HDA_PREALLOC_SIZE=64 CONFIG_SND_ARM=y CONFIG_SND_SPI=y CONFIG_SND_USB=y CONFIG_SND_USB_AUDIO=m CONFIG_SND_USB_UA101=m CONFIG_SND_USB_CAIAQ=m CONFIG_SND_USB_CAIAQ_INPUT=y CONFIG_SND_USB_6FIRE=m # CONFIG_SND_USB_HIFACE is not set # CONFIG_SND_BCD2000 is not set # CONFIG_SND_USB_POD is not set # CONFIG_SND_USB_PODHD is not set # CONFIG_SND_USB_TONEPORT is not set # CONFIG_SND_USB_VARIAX is not set CONFIG_SND_SOC=y CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y # CONFIG_SND_SOC_AMD_ACP is not set # CONFIG_SND_ATMEL_SOC is not set # CONFIG_SND_DESIGNWARE_I2S is not set # # SoC Audio for Freescale CPUs # # # Common SoC Audio options for Freescale CPUs: # # CONFIG_SND_SOC_FSL_ASRC is not set # CONFIG_SND_SOC_FSL_SAI is not set # CONFIG_SND_SOC_FSL_SSI is not set # CONFIG_SND_SOC_FSL_SPDIF is not set # CONFIG_SND_SOC_FSL_ESAI is not set # CONFIG_SND_SOC_IMX_AUDMUX is not set # CONFIG_SND_SOC_IMG is not set # # Allwinner SoC Audio support # CONFIG_SND_SUN4I_CODEC=y CONFIG_SND_SUN4I_I2S=y CONFIG_SND_SUN4I_SPDIF=y # CONFIG_SND_SOC_XTFPGA_I2S is not set CONFIG_SND_SOC_I2C_AND_SPI=y # # CODEC drivers # # CONFIG_SND_SOC_AC97_CODEC is not set # CONFIG_SND_SOC_ADAU1701 is not set # CONFIG_SND_SOC_ADAU7002 is not set # CONFIG_SND_SOC_AK4104 is not set # CONFIG_SND_SOC_AK4554 is not set # CONFIG_SND_SOC_AK4613 is not set # CONFIG_SND_SOC_AK4642 is not set # CONFIG_SND_SOC_AK5386 is not set # CONFIG_SND_SOC_ALC5623 is not set # CONFIG_SND_SOC_BT_SCO is not set # CONFIG_SND_SOC_CS35L32 is not set # CONFIG_SND_SOC_CS35L33 is not set # CONFIG_SND_SOC_CS42L51_I2C is not set # CONFIG_SND_SOC_CS42L52 is not set # CONFIG_SND_SOC_CS42L56 is not set # CONFIG_SND_SOC_CS42L73 is not set # CONFIG_SND_SOC_CS4265 is not set # CONFIG_SND_SOC_CS4270 is not set # CONFIG_SND_SOC_CS4271_I2C is not set # CONFIG_SND_SOC_CS4271_SPI is not set # CONFIG_SND_SOC_CS42XX8_I2C is not set # CONFIG_SND_SOC_CS4349 is not set # CONFIG_SND_SOC_CS53L30 is not set # CONFIG_SND_SOC_ES8328 is not set # CONFIG_SND_SOC_GTM601 is not set # CONFIG_SND_SOC_INNO_RK3036 is not set # CONFIG_SND_SOC_MAX98504 is not set # CONFIG_SND_SOC_MAX9860 is not set # CONFIG_SND_SOC_PCM1681 is not set # CONFIG_SND_SOC_PCM179X_I2C is not set # CONFIG_SND_SOC_PCM179X_SPI is not set # CONFIG_SND_SOC_PCM3168A_I2C is not set # CONFIG_SND_SOC_PCM3168A_SPI is not set # CONFIG_SND_SOC_PCM512x_I2C is not set # CONFIG_SND_SOC_PCM512x_SPI is not set # CONFIG_SND_SOC_RT5616 is not set # CONFIG_SND_SOC_RT5631 is not set # CONFIG_SND_SOC_RT5677_SPI is not set # CONFIG_SND_SOC_SGTL5000 is not set # CONFIG_SND_SOC_SIRF_AUDIO_CODEC is not set # CONFIG_SND_SOC_SPDIF is not set # CONFIG_SND_SOC_SSM2602_SPI is not set # CONFIG_SND_SOC_SSM2602_I2C is not set # CONFIG_SND_SOC_SSM4567 is not set # CONFIG_SND_SOC_STA32X is not set # CONFIG_SND_SOC_STA350 is not set # CONFIG_SND_SOC_STI_SAS is not set # CONFIG_SND_SOC_TAS2552 is not set # CONFIG_SND_SOC_TAS5086 is not set # CONFIG_SND_SOC_TAS571X is not set # CONFIG_SND_SOC_TAS5720 is not set # CONFIG_SND_SOC_TFA9879 is not set # CONFIG_SND_SOC_TLV320AIC23_I2C is not set # CONFIG_SND_SOC_TLV320AIC23_SPI is not set # CONFIG_SND_SOC_TLV320AIC31XX is not set # CONFIG_SND_SOC_TLV320AIC3X is not set # CONFIG_SND_SOC_TS3A227E is not set # CONFIG_SND_SOC_WM8510 is not set # CONFIG_SND_SOC_WM8523 is not set # CONFIG_SND_SOC_WM8580 is not set # CONFIG_SND_SOC_WM8711 is not set # CONFIG_SND_SOC_WM8728 is not set # CONFIG_SND_SOC_WM8731 is not set # CONFIG_SND_SOC_WM8737 is not set # CONFIG_SND_SOC_WM8741 is not set # CONFIG_SND_SOC_WM8750 is not set # CONFIG_SND_SOC_WM8753 is not set # CONFIG_SND_SOC_WM8770 is not set # CONFIG_SND_SOC_WM8776 is not set # CONFIG_SND_SOC_WM8804_I2C is not set # CONFIG_SND_SOC_WM8804_SPI is not set # CONFIG_SND_SOC_WM8903 is not set # CONFIG_SND_SOC_WM8960 is not set # CONFIG_SND_SOC_WM8962 is not set # CONFIG_SND_SOC_WM8974 is not set # CONFIG_SND_SOC_WM8978 is not set # CONFIG_SND_SOC_WM8985 is not set # CONFIG_SND_SOC_NAU8810 is not set # CONFIG_SND_SOC_TPA6130A2 is not set # CONFIG_SND_SIMPLE_CARD is not set # CONFIG_SND_SIMPLE_SCU_CARD is not set # CONFIG_SOUND_PRIME is not set CONFIG_AC97_BUS=m # # HID support # CONFIG_HID=y # CONFIG_HID_BATTERY_STRENGTH is not set CONFIG_HIDRAW=y # CONFIG_UHID is not set CONFIG_HID_GENERIC=y # # Special HID drivers # # CONFIG_HID_A4TECH is not set # CONFIG_HID_ACRUX is not set # CONFIG_HID_APPLE is not set # CONFIG_HID_APPLEIR is not set # CONFIG_HID_AUREAL is not set CONFIG_HID_BELKIN=m # CONFIG_HID_BETOP_FF is not set CONFIG_HID_CHERRY=m # CONFIG_HID_CHICONY is not set # CONFIG_HID_CORSAIR is not set # CONFIG_HID_PRODIKEYS is not set # CONFIG_HID_CMEDIA is not set # CONFIG_HID_CP2112 is not set # CONFIG_HID_CYPRESS is not set # CONFIG_HID_DRAGONRISE is not set # CONFIG_HID_EMS_FF is not set # CONFIG_HID_ELECOM is not set # CONFIG_HID_ELO is not set CONFIG_HID_EZKEY=m # CONFIG_HID_GEMBIRD is not set # CONFIG_HID_GFRM is not set CONFIG_HID_HOLTEK=m # CONFIG_HOLTEK_FF is not set # CONFIG_HID_GT683R is not set # CONFIG_HID_KEYTOUCH is not set # CONFIG_HID_KYE is not set # CONFIG_HID_UCLOGIC is not set # CONFIG_HID_WALTOP is not set # CONFIG_HID_GYRATION is not set # CONFIG_HID_ICADE is not set # CONFIG_HID_TWINHAN is not set # CONFIG_HID_KENSINGTON is not set # CONFIG_HID_LCPOWER is not set # CONFIG_HID_LED is not set # CONFIG_HID_LENOVO is not set CONFIG_HID_LOGITECH=m # CONFIG_HID_LOGITECH_DJ is not set # CONFIG_HID_LOGITECH_HIDPP is not set # CONFIG_LOGITECH_FF is not set # CONFIG_LOGIRUMBLEPAD2_FF is not set # CONFIG_LOGIG940_FF is not set # CONFIG_LOGIWHEELS_FF is not set # CONFIG_HID_MAGICMOUSE is not set CONFIG_HID_MICROSOFT=m CONFIG_HID_MONTEREY=m # CONFIG_HID_MULTITOUCH is not set # CONFIG_HID_NTRIG is not set CONFIG_HID_ORTEK=m # CONFIG_HID_PANTHERLORD is not set # CONFIG_HID_PENMOUNT is not set # CONFIG_HID_PETALYNX is not set # CONFIG_HID_PICOLCD is not set # CONFIG_HID_PLANTRONICS is not set # CONFIG_HID_PRIMAX is not set # CONFIG_HID_ROCCAT is not set # CONFIG_HID_SAITEK is not set CONFIG_HID_SAMSUNG=m # CONFIG_HID_SONY is not set # CONFIG_HID_SPEEDLINK is not set # CONFIG_HID_STEELSERIES is not set # CONFIG_HID_SUNPLUS is not set # CONFIG_HID_RMI is not set # CONFIG_HID_GREENASIA is not set # CONFIG_HID_SMARTJOYPLUS is not set # CONFIG_HID_TIVO is not set # CONFIG_HID_TOPSEED is not set # CONFIG_HID_THINGM is not set # CONFIG_HID_THRUSTMASTER is not set # CONFIG_HID_WACOM is not set # CONFIG_HID_WIIMOTE is not set # CONFIG_HID_XINMO is not set # CONFIG_HID_ZEROPLUS is not set # CONFIG_HID_ZYDACRON is not set # CONFIG_HID_SENSOR_HUB is not set # CONFIG_HID_ALPS is not set # # USB HID support # CONFIG_USB_HID=y CONFIG_HID_PID=y CONFIG_USB_HIDDEV=y # # I2C HID support # # CONFIG_I2C_HID is not set CONFIG_USB_OHCI_LITTLE_ENDIAN=y CONFIG_USB_SUPPORT=y CONFIG_USB_COMMON=y CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y # # Miscellaneous USB options # CONFIG_USB_DEFAULT_PERSIST=y # CONFIG_USB_DYNAMIC_MINORS is not set CONFIG_USB_OTG=y # CONFIG_USB_OTG_WHITELIST is not set # CONFIG_USB_OTG_BLACKLIST_HUB is not set CONFIG_USB_OTG_FSM=y # CONFIG_USB_LEDS_TRIGGER_USBPORT is not set # CONFIG_USB_MON is not set # CONFIG_USB_WUSB_CBAF is not set # # USB Host Controller Drivers # # CONFIG_USB_C67X00_HCD is not set # CONFIG_USB_XHCI_HCD is not set CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_ROOT_HUB_TT=y CONFIG_USB_EHCI_TT_NEWSCHED=y CONFIG_USB_EHCI_HCD_PLATFORM=y # CONFIG_USB_OXU210HP_HCD is not set # CONFIG_USB_ISP116X_HCD is not set # CONFIG_USB_ISP1362_HCD is not set # CONFIG_USB_FOTG210_HCD is not set # CONFIG_USB_MAX3421_HCD is not set CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_HCD_PLATFORM=y # CONFIG_USB_SL811_HCD is not set # CONFIG_USB_R8A66597_HCD is not set # CONFIG_USB_HCD_BCMA is not set # CONFIG_USB_HCD_SSB is not set # CONFIG_USB_HCD_TEST_MODE is not set # # USB Device Class drivers # CONFIG_USB_ACM=m # CONFIG_USB_PRINTER is not set CONFIG_USB_WDM=m # CONFIG_USB_TMC is not set # # NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may # # # also be needed; see USB_STORAGE Help for more info # CONFIG_USB_STORAGE=m # CONFIG_USB_STORAGE_DEBUG is not set # CONFIG_USB_STORAGE_REALTEK is not set # CONFIG_USB_STORAGE_DATAFAB is not set # CONFIG_USB_STORAGE_FREECOM is not set # CONFIG_USB_STORAGE_ISD200 is not set # CONFIG_USB_STORAGE_USBAT is not set # CONFIG_USB_STORAGE_SDDR09 is not set # CONFIG_USB_STORAGE_SDDR55 is not set # CONFIG_USB_STORAGE_JUMPSHOT is not set # CONFIG_USB_STORAGE_ALAUDA is not set # CONFIG_USB_STORAGE_ONETOUCH is not set # CONFIG_USB_STORAGE_KARMA is not set # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set # CONFIG_USB_STORAGE_ENE_UB6250 is not set # CONFIG_USB_UAS is not set # # USB Imaging devices # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set # CONFIG_USBIP_CORE is not set CONFIG_USB_MUSB_HDRC=y # CONFIG_USB_MUSB_HOST is not set # CONFIG_USB_MUSB_GADGET is not set CONFIG_USB_MUSB_DUAL_ROLE=y # # Platform Glue Layer # CONFIG_USB_MUSB_SUNXI=y # # MUSB DMA mode # # CONFIG_MUSB_PIO_ONLY is not set # CONFIG_USB_DWC3 is not set # CONFIG_USB_DWC2 is not set # CONFIG_USB_CHIPIDEA is not set # CONFIG_USB_ISP1760 is not set # # USB port drivers # CONFIG_USB_SERIAL=m # CONFIG_USB_SERIAL_GENERIC is not set # CONFIG_USB_SERIAL_SIMPLE is not set # CONFIG_USB_SERIAL_AIRCABLE is not set # CONFIG_USB_SERIAL_ARK3116 is not set # CONFIG_USB_SERIAL_BELKIN is not set # CONFIG_USB_SERIAL_CH341 is not set # CONFIG_USB_SERIAL_WHITEHEAT is not set # CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set # CONFIG_USB_SERIAL_CP210X is not set # CONFIG_USB_SERIAL_CYPRESS_M8 is not set # CONFIG_USB_SERIAL_EMPEG is not set # CONFIG_USB_SERIAL_FTDI_SIO is not set # CONFIG_USB_SERIAL_VISOR is not set # CONFIG_USB_SERIAL_IPAQ is not set # CONFIG_USB_SERIAL_IR is not set # CONFIG_USB_SERIAL_EDGEPORT is not set # CONFIG_USB_SERIAL_EDGEPORT_TI is not set # CONFIG_USB_SERIAL_F81232 is not set # CONFIG_USB_SERIAL_GARMIN is not set # CONFIG_USB_SERIAL_IPW is not set # CONFIG_USB_SERIAL_IUU is not set # CONFIG_USB_SERIAL_KEYSPAN_PDA is not set # CONFIG_USB_SERIAL_KEYSPAN is not set # CONFIG_USB_SERIAL_KLSI is not set # CONFIG_USB_SERIAL_KOBIL_SCT is not set # CONFIG_USB_SERIAL_MCT_U232 is not set # CONFIG_USB_SERIAL_METRO is not set # CONFIG_USB_SERIAL_MOS7720 is not set # CONFIG_USB_SERIAL_MOS7840 is not set # CONFIG_USB_SERIAL_MXUPORT is not set # CONFIG_USB_SERIAL_NAVMAN is not set # CONFIG_USB_SERIAL_PL2303 is not set # CONFIG_USB_SERIAL_OTI6858 is not set # CONFIG_USB_SERIAL_QCAUX is not set # CONFIG_USB_SERIAL_QUALCOMM is not set # CONFIG_USB_SERIAL_SPCP8X5 is not set # CONFIG_USB_SERIAL_SAFE is not set # CONFIG_USB_SERIAL_SIERRAWIRELESS is not set # CONFIG_USB_SERIAL_SYMBOL is not set # CONFIG_USB_SERIAL_TI is not set # CONFIG_USB_SERIAL_CYBERJACK is not set # CONFIG_USB_SERIAL_XIRCOM is not set CONFIG_USB_SERIAL_WWAN=m CONFIG_USB_SERIAL_OPTION=m # CONFIG_USB_SERIAL_OMNINET is not set # CONFIG_USB_SERIAL_OPTICON is not set # CONFIG_USB_SERIAL_XSENS_MT is not set # CONFIG_USB_SERIAL_WISHBONE is not set # CONFIG_USB_SERIAL_SSU100 is not set # CONFIG_USB_SERIAL_QT2 is not set # CONFIG_USB_SERIAL_DEBUG is not set # # USB Miscellaneous drivers # # CONFIG_USB_EMI62 is not set # CONFIG_USB_EMI26 is not set # CONFIG_USB_ADUTUX is not set # CONFIG_USB_SEVSEG is not set # CONFIG_USB_RIO500 is not set # CONFIG_USB_LEGOTOWER is not set # CONFIG_USB_LCD is not set # CONFIG_USB_CYPRESS_CY7C63 is not set # CONFIG_USB_CYTHERM is not set # CONFIG_USB_IDMOUSE is not set # CONFIG_USB_FTDI_ELAN is not set # CONFIG_USB_APPLEDISPLAY is not set # CONFIG_USB_SISUSBVGA is not set # CONFIG_USB_LD is not set # CONFIG_USB_TRANCEVIBRATOR is not set # CONFIG_USB_IOWARRIOR is not set # CONFIG_USB_TEST is not set # CONFIG_USB_EHSET_TEST_FIXTURE is not set # CONFIG_USB_ISIGHTFW is not set # CONFIG_USB_YUREX is not set # CONFIG_USB_EZUSB_FX2 is not set # CONFIG_USB_HSIC_USB3503 is not set # CONFIG_USB_HSIC_USB4604 is not set # CONFIG_USB_LINK_LAYER_TEST is not set # CONFIG_USB_CHAOSKEY is not set # # USB Physical Layer drivers # CONFIG_USB_PHY=y CONFIG_NOP_USB_XCEIV=y # CONFIG_AM335X_PHY_USB is not set CONFIG_USB_GPIO_VBUS=y # CONFIG_USB_ISP1301 is not set # CONFIG_USB_ULPI is not set CONFIG_USB_GADGET=y # CONFIG_USB_GADGET_DEBUG is not set # CONFIG_USB_GADGET_DEBUG_FILES is not set # CONFIG_USB_GADGET_DEBUG_FS is not set CONFIG_USB_GADGET_VBUS_DRAW=2 CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 # # USB Peripheral Controller # # CONFIG_USB_FUSB300 is not set # CONFIG_USB_FOTG210_UDC is not set # CONFIG_USB_GR_UDC is not set # CONFIG_USB_R8A66597 is not set # CONFIG_USB_PXA27X is not set # CONFIG_USB_MV_UDC is not set # CONFIG_USB_MV_U3D is not set # CONFIG_USB_M66592 is not set # CONFIG_USB_BDC_UDC is not set # CONFIG_USB_NET2272 is not set # CONFIG_USB_GADGET_XILINX is not set # CONFIG_USB_DUMMY_HCD is not set # CONFIG_USB_CONFIGFS is not set # CONFIG_USB_ZERO is not set # CONFIG_USB_AUDIO is not set # CONFIG_USB_ETH is not set # CONFIG_USB_G_NCM is not set # CONFIG_USB_GADGETFS is not set # CONFIG_USB_FUNCTIONFS is not set # CONFIG_USB_MASS_STORAGE is not set # CONFIG_USB_G_SERIAL is not set # CONFIG_USB_MIDI_GADGET is not set # CONFIG_USB_G_PRINTER is not set # CONFIG_USB_CDC_COMPOSITE is not set # CONFIG_USB_G_ACM_MS is not set # CONFIG_USB_G_MULTI is not set # CONFIG_USB_G_HID is not set # CONFIG_USB_G_DBGP is not set # CONFIG_USB_G_WEBCAM is not set # CONFIG_USB_LED_TRIG is not set # CONFIG_USB_ULPI_BUS is not set # CONFIG_UWB is not set CONFIG_MMC=y # CONFIG_MMC_DEBUG is not set CONFIG_PWRSEQ_EMMC=y CONFIG_PWRSEQ_SIMPLE=y # # MMC/SD/SDIO Card Drivers # CONFIG_MMC_BLOCK=y CONFIG_MMC_BLOCK_MINORS=8 CONFIG_MMC_BLOCK_BOUNCE=y # CONFIG_SDIO_UART is not set # CONFIG_MMC_TEST is not set # # MMC/SD/SDIO Host Controller Drivers # # CONFIG_MMC_SDHCI is not set # CONFIG_MMC_SPI is not set # CONFIG_MMC_DW is not set # CONFIG_MMC_VUB300 is not set # CONFIG_MMC_USHC is not set # CONFIG_MMC_USDHI6ROL0 is not set CONFIG_MMC_SUNXI=y # CONFIG_MMC_MTK is not set # CONFIG_MEMSTICK is not set CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y # CONFIG_LEDS_CLASS_FLASH is not set # # LED drivers # # CONFIG_LEDS_BCM6328 is not set # CONFIG_LEDS_BCM6358 is not set # CONFIG_LEDS_LM3530 is not set # CONFIG_LEDS_LM3642 is not set # CONFIG_LEDS_PCA9532 is not set # CONFIG_LEDS_GPIO is not set # CONFIG_LEDS_LP3944 is not set # CONFIG_LEDS_LP5521 is not set # CONFIG_LEDS_LP5523 is not set # CONFIG_LEDS_LP5562 is not set # CONFIG_LEDS_LP8501 is not set # CONFIG_LEDS_LP8860 is not set # CONFIG_LEDS_PCA955X is not set # CONFIG_LEDS_PCA963X is not set # CONFIG_LEDS_DAC124S085 is not set # CONFIG_LEDS_PWM is not set # CONFIG_LEDS_REGULATOR is not set # CONFIG_LEDS_BD2802 is not set # CONFIG_LEDS_LT3593 is not set # CONFIG_LEDS_TCA6507 is not set # CONFIG_LEDS_TLC591XX is not set # CONFIG_LEDS_LM355x is not set # CONFIG_LEDS_IS31FL319X is not set # CONFIG_LEDS_IS31FL32XX is not set # # LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM) # # CONFIG_LEDS_BLINKM is not set # CONFIG_LEDS_SYSCON is not set # # LED Triggers # CONFIG_LEDS_TRIGGERS=y # CONFIG_LEDS_TRIGGER_TIMER is not set # CONFIG_LEDS_TRIGGER_ONESHOT is not set # CONFIG_LEDS_TRIGGER_DISK is not set # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set # CONFIG_LEDS_TRIGGER_BACKLIGHT is not set # CONFIG_LEDS_TRIGGER_CPU is not set # CONFIG_LEDS_TRIGGER_GPIO is not set # CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set # # iptables trigger is under Netfilter config (LED target) # # CONFIG_LEDS_TRIGGER_TRANSIENT is not set # CONFIG_LEDS_TRIGGER_CAMERA is not set # CONFIG_LEDS_TRIGGER_PANIC is not set # CONFIG_ACCESSIBILITY is not set CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y # CONFIG_EDAC is not set CONFIG_RTC_LIB=y CONFIG_RTC_CLASS=y CONFIG_RTC_HCTOSYS=y CONFIG_RTC_HCTOSYS_DEVICE="rtc0" CONFIG_RTC_SYSTOHC=y CONFIG_RTC_SYSTOHC_DEVICE="rtc0" # CONFIG_RTC_DEBUG is not set # # RTC interfaces # CONFIG_RTC_INTF_SYSFS=y CONFIG_RTC_INTF_PROC=y CONFIG_RTC_INTF_DEV=y # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set # CONFIG_RTC_DRV_TEST is not set # # I2C RTC drivers # # CONFIG_RTC_DRV_ABB5ZES3 is not set # CONFIG_RTC_DRV_ABX80X is not set CONFIG_RTC_DRV_DS1307=m # CONFIG_RTC_DRV_DS1307_CENTURY is not set CONFIG_RTC_DRV_DS1374=m # CONFIG_RTC_DRV_DS1374_WDT is not set CONFIG_RTC_DRV_DS1672=m # CONFIG_RTC_DRV_HYM8563 is not set CONFIG_RTC_DRV_MAX6900=m CONFIG_RTC_DRV_RS5C372=m CONFIG_RTC_DRV_ISL1208=m CONFIG_RTC_DRV_ISL12022=m CONFIG_RTC_DRV_X1205=m CONFIG_RTC_DRV_PCF8523=m # CONFIG_RTC_DRV_PCF85063 is not set CONFIG_RTC_DRV_PCF8563=m CONFIG_RTC_DRV_PCF8583=m CONFIG_RTC_DRV_M41T80=m # CONFIG_RTC_DRV_M41T80_WDT is not set CONFIG_RTC_DRV_BQ32K=m CONFIG_RTC_DRV_S35390A=m CONFIG_RTC_DRV_FM3130=m # CONFIG_RTC_DRV_RX8010 is not set CONFIG_RTC_DRV_RX8581=m CONFIG_RTC_DRV_RX8025=m CONFIG_RTC_DRV_EM3027=m # CONFIG_RTC_DRV_RV8803 is not set # # SPI RTC drivers # CONFIG_RTC_DRV_M41T93=m CONFIG_RTC_DRV_M41T94=m # CONFIG_RTC_DRV_DS1302 is not set CONFIG_RTC_DRV_DS1305=m # CONFIG_RTC_DRV_DS1343 is not set # CONFIG_RTC_DRV_DS1347 is not set CONFIG_RTC_DRV_DS1390=m # CONFIG_RTC_DRV_MAX6916 is not set CONFIG_RTC_DRV_R9701=m CONFIG_RTC_DRV_RX4581=m # CONFIG_RTC_DRV_RX6110 is not set CONFIG_RTC_DRV_RS5C348=m CONFIG_RTC_DRV_MAX6902=m CONFIG_RTC_DRV_PCF2123=m # CONFIG_RTC_DRV_MCP795 is not set CONFIG_RTC_I2C_AND_SPI=y # # SPI and I2C RTC drivers # CONFIG_RTC_DRV_DS3232=m CONFIG_RTC_DRV_PCF2127=m CONFIG_RTC_DRV_RV3029C2=m # # Platform RTC drivers # # CONFIG_RTC_DRV_CMOS is not set # CONFIG_RTC_DRV_DS1286 is not set # CONFIG_RTC_DRV_DS1511 is not set # CONFIG_RTC_DRV_DS1553 is not set # CONFIG_RTC_DRV_DS1685_FAMILY is not set # CONFIG_RTC_DRV_DS1742 is not set # CONFIG_RTC_DRV_DS2404 is not set # CONFIG_RTC_DRV_STK17TA8 is not set # CONFIG_RTC_DRV_M48T86 is not set # CONFIG_RTC_DRV_M48T35 is not set # CONFIG_RTC_DRV_M48T59 is not set # CONFIG_RTC_DRV_MSM6242 is not set # CONFIG_RTC_DRV_BQ4802 is not set # CONFIG_RTC_DRV_RP5C01 is not set # CONFIG_RTC_DRV_V3020 is not set # CONFIG_RTC_DRV_ZYNQMP is not set # # on-CPU RTC drivers # # CONFIG_RTC_DRV_SUN6I is not set CONFIG_RTC_DRV_SUNXI=y # CONFIG_RTC_DRV_SNVS is not set # # HID Sensor RTC drivers # # CONFIG_RTC_DRV_HID_SENSOR_TIME is not set CONFIG_DMADEVICES=y # CONFIG_DMADEVICES_DEBUG is not set # # DMA Devices # CONFIG_DMA_ENGINE=y CONFIG_DMA_VIRTUAL_CHANNELS=y CONFIG_DMA_OF=y CONFIG_DMA_SUN4I=y # CONFIG_FSL_EDMA is not set # CONFIG_INTEL_IDMA64 is not set # CONFIG_NBPFAXI_DMA is not set # CONFIG_QCOM_HIDMA_MGMT is not set # CONFIG_QCOM_HIDMA is not set # CONFIG_DW_DMAC is not set # # DMA Clients # # CONFIG_ASYNC_TX_DMA is not set # CONFIG_DMATEST is not set # # DMABUF options # # CONFIG_SYNC_FILE is not set # CONFIG_AUXDISPLAY is not set # CONFIG_UIO is not set # CONFIG_VIRT_DRIVERS is not set # # Virtio drivers # # CONFIG_VIRTIO_MMIO is not set # # Microsoft Hyper-V guest support # CONFIG_STAGING=y CONFIG_PRISM2_USB=m # CONFIG_COMEDI is not set CONFIG_RTLLIB=m CONFIG_RTLLIB_CRYPTO_CCMP=m CONFIG_RTLLIB_CRYPTO_TKIP=m CONFIG_RTLLIB_CRYPTO_WEP=m CONFIG_R8712U=m CONFIG_R8188EU=m CONFIG_88EU_AP_MODE=y # CONFIG_VT6656 is not set # # Speakup console speech # # CONFIG_SPEAKUP is not set # CONFIG_STAGING_MEDIA is not set # # Android # # CONFIG_STAGING_BOARD is not set # CONFIG_LTE_GDM724X is not set # CONFIG_LNET is not set # CONFIG_GS_FPGABOOT is not set # CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set # CONFIG_FB_TFT is not set # CONFIG_WILC1000_SDIO is not set # CONFIG_WILC1000_SPI is not set # CONFIG_MOST is not set # CONFIG_KS7010 is not set # CONFIG_GREYBUS is not set # CONFIG_GOLDFISH is not set # CONFIG_CHROME_PLATFORMS is not set CONFIG_CLKDEV_LOOKUP=y CONFIG_HAVE_CLK_PREPARE=y CONFIG_COMMON_CLK=y # # Common Clock Framework # # CONFIG_COMMON_CLK_SI5351 is not set # CONFIG_COMMON_CLK_SI514 is not set # CONFIG_COMMON_CLK_SI570 is not set # CONFIG_COMMON_CLK_CDCE706 is not set # CONFIG_COMMON_CLK_CDCE925 is not set # CONFIG_COMMON_CLK_CS2000_CP is not set # CONFIG_CLK_QORIQ is not set # CONFIG_COMMON_CLK_NXP is not set # CONFIG_COMMON_CLK_PWM is not set # CONFIG_COMMON_CLK_PXA is not set # CONFIG_COMMON_CLK_PIC32 is not set CONFIG_SUNXI_CCU=y # CONFIG_SUN6I_A31_CCU is not set # CONFIG_SUN8I_A23_CCU is not set # CONFIG_SUN8I_A33_CCU is not set # CONFIG_SUN8I_H3_CCU is not set # # Hardware Spinlock drivers # # # Clock Source drivers # CONFIG_CLKSRC_OF=y CONFIG_CLKSRC_PROBE=y CONFIG_CLKSRC_MMIO=y CONFIG_SUN4I_TIMER=y CONFIG_SUN5I_HSTIMER=y CONFIG_ARM_ARCH_TIMER=y CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y # CONFIG_ARM_TIMER_SP804 is not set # CONFIG_ATMEL_PIT is not set # CONFIG_SH_TIMER_CMT is not set # CONFIG_SH_TIMER_MTU2 is not set # CONFIG_SH_TIMER_TMU is not set # CONFIG_EM_TIMER_STI is not set # CONFIG_MAILBOX is not set # CONFIG_IOMMU_SUPPORT is not set # # Remoteproc drivers # # CONFIG_STE_MODEM_RPROC is not set # # Rpmsg drivers # # # SOC (System On Chip) specific Drivers # # # Broadcom SoC drivers # # CONFIG_SOC_BRCMSTB is not set CONFIG_SUNXI_SRAM=y # CONFIG_SOC_TI is not set # CONFIG_PM_DEVFREQ is not set CONFIG_EXTCON=y # # Extcon Device Drivers # # CONFIG_EXTCON_AXP288 is not set # CONFIG_EXTCON_GPIO is not set # CONFIG_EXTCON_MAX3355 is not set # CONFIG_EXTCON_QCOM_SPMI_MISC is not set # CONFIG_EXTCON_RT8973A is not set # CONFIG_EXTCON_SM5502 is not set # CONFIG_EXTCON_USB_GPIO is not set # CONFIG_MEMORY is not set # CONFIG_IIO is not set CONFIG_PWM=y CONFIG_PWM_SYSFS=y # CONFIG_PWM_FSL_FTM is not set # CONFIG_PWM_PCA9685 is not set CONFIG_PWM_SUN4I=y CONFIG_IRQCHIP=y CONFIG_ARM_GIC=y CONFIG_ARM_GIC_MAX_NR=1 # CONFIG_IPACK_BUS is not set CONFIG_ARCH_HAS_RESET_CONTROLLER=y CONFIG_RESET_CONTROLLER=y # CONFIG_RESET_ATH79 is not set # CONFIG_RESET_BERLIN is not set # CONFIG_RESET_LPC18XX is not set # CONFIG_RESET_MESON is not set # CONFIG_RESET_PISTACHIO is not set # CONFIG_RESET_SOCFPGA is not set # CONFIG_RESET_STM32 is not set CONFIG_RESET_SUNXI=y # CONFIG_TI_SYSCON_RESET is not set # CONFIG_RESET_ZYNQ is not set # CONFIG_FMC is not set # # PHY Subsystem # CONFIG_GENERIC_PHY=y # CONFIG_PHY_PXA_28NM_HSIC is not set # CONFIG_PHY_PXA_28NM_USB2 is not set # CONFIG_BCM_KONA_USB2_PHY is not set CONFIG_PHY_SUN4I_USB=y # CONFIG_PHY_SUN9I_USB is not set # CONFIG_POWERCAP is not set # CONFIG_MCB is not set # # Performance monitor support # # CONFIG_RAS is not set # # Android # # CONFIG_ANDROID is not set CONFIG_NVMEM=y CONFIG_NVMEM_SUNXI_SID=y # CONFIG_STM is not set # CONFIG_INTEL_TH is not set # # FPGA Configuration Support # # CONFIG_FPGA is not set # # Firmware Drivers # CONFIG_ARM_PSCI_FW=y # CONFIG_FIRMWARE_MEMMAP is not set # CONFIG_FW_CFG_SYSFS is not set CONFIG_HAVE_ARM_SMCCC=y # # File systems # CONFIG_DCACHE_WORD_ACCESS=y # CONFIG_EXT2_FS is not set CONFIG_EXT3_FS=m # CONFIG_EXT3_FS_POSIX_ACL is not set # CONFIG_EXT3_FS_SECURITY is not set CONFIG_EXT4_FS=y CONFIG_EXT4_USE_FOR_EXT2=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y # CONFIG_EXT4_ENCRYPTION is not set # CONFIG_EXT4_DEBUG is not set CONFIG_JBD2=y # CONFIG_JBD2_DEBUG is not set CONFIG_FS_MBCACHE=y # CONFIG_REISERFS_FS is not set # CONFIG_JFS_FS is not set # CONFIG_XFS_FS is not set # CONFIG_GFS2_FS is not set # CONFIG_OCFS2_FS is not set # CONFIG_BTRFS_FS is not set # CONFIG_NILFS2_FS is not set # CONFIG_F2FS_FS is not set CONFIG_FS_POSIX_ACL=y CONFIG_EXPORTFS=y # CONFIG_EXPORTFS_BLOCK_OPS is not set CONFIG_FILE_LOCKING=y CONFIG_MANDATORY_FILE_LOCKING=y # CONFIG_FS_ENCRYPTION is not set CONFIG_FSNOTIFY=y CONFIG_DNOTIFY=y CONFIG_INOTIFY_USER=y CONFIG_FANOTIFY=y # CONFIG_QUOTA is not set # CONFIG_QUOTACTL is not set CONFIG_AUTOFS4_FS=y CONFIG_FUSE_FS=m # CONFIG_CUSE is not set # CONFIG_OVERLAY_FS is not set # # Caches # CONFIG_FSCACHE=y # CONFIG_FSCACHE_STATS is not set # CONFIG_FSCACHE_HISTOGRAM is not set # CONFIG_FSCACHE_DEBUG is not set # CONFIG_FSCACHE_OBJECT_LIST is not set CONFIG_CACHEFILES=y # CONFIG_CACHEFILES_DEBUG is not set # CONFIG_CACHEFILES_HISTOGRAM is not set # # CD-ROM/DVD Filesystems # # CONFIG_ISO9660_FS is not set # CONFIG_UDF_FS is not set # # DOS/FAT/NT Filesystems # CONFIG_FAT_FS=y # CONFIG_MSDOS_FS is not set CONFIG_VFAT_FS=y CONFIG_FAT_DEFAULT_CODEPAGE=437 CONFIG_FAT_DEFAULT_IOCHARSET="ascii" # CONFIG_FAT_DEFAULT_UTF8 is not set # CONFIG_NTFS_FS is not set # # Pseudo filesystems # CONFIG_PROC_FS=y CONFIG_PROC_SYSCTL=y CONFIG_PROC_PAGE_MONITOR=y # CONFIG_PROC_CHILDREN is not set CONFIG_KERNFS=y CONFIG_SYSFS=y CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TMPFS_XATTR=y # CONFIG_HUGETLB_PAGE is not set CONFIG_CONFIGFS_FS=y # CONFIG_MISC_FILESYSTEMS is not set CONFIG_NETWORK_FILESYSTEMS=y # CONFIG_NFS_FS is not set # CONFIG_NFSD is not set # CONFIG_CEPH_FS is not set CONFIG_CIFS=y # CONFIG_CIFS_STATS is not set CONFIG_CIFS_WEAK_PW_HASH=y CONFIG_CIFS_UPCALL=y # CONFIG_CIFS_XATTR is not set # CONFIG_CIFS_DEBUG is not set CONFIG_CIFS_DFS_UPCALL=y CONFIG_CIFS_SMB2=y # CONFIG_CIFS_SMB311 is not set CONFIG_CIFS_FSCACHE=y # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set CONFIG_NLS=y CONFIG_NLS_DEFAULT="utf8" CONFIG_NLS_CODEPAGE_437=y # CONFIG_NLS_CODEPAGE_737 is not set # CONFIG_NLS_CODEPAGE_775 is not set # CONFIG_NLS_CODEPAGE_850 is not set # CONFIG_NLS_CODEPAGE_852 is not set # CONFIG_NLS_CODEPAGE_855 is not set # CONFIG_NLS_CODEPAGE_857 is not set # CONFIG_NLS_CODEPAGE_860 is not set # CONFIG_NLS_CODEPAGE_861 is not set # CONFIG_NLS_CODEPAGE_862 is not set # CONFIG_NLS_CODEPAGE_863 is not set # CONFIG_NLS_CODEPAGE_864 is not set # CONFIG_NLS_CODEPAGE_865 is not set # CONFIG_NLS_CODEPAGE_866 is not set # CONFIG_NLS_CODEPAGE_869 is not set # CONFIG_NLS_CODEPAGE_936 is not set # CONFIG_NLS_CODEPAGE_950 is not set # CONFIG_NLS_CODEPAGE_932 is not set # CONFIG_NLS_CODEPAGE_949 is not set # CONFIG_NLS_CODEPAGE_874 is not set # CONFIG_NLS_ISO8859_8 is not set # CONFIG_NLS_CODEPAGE_1250 is not set # CONFIG_NLS_CODEPAGE_1251 is not set CONFIG_NLS_ASCII=y CONFIG_NLS_ISO8859_1=y # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set # CONFIG_NLS_ISO8859_4 is not set # CONFIG_NLS_ISO8859_5 is not set # CONFIG_NLS_ISO8859_6 is not set # CONFIG_NLS_ISO8859_7 is not set # CONFIG_NLS_ISO8859_9 is not set # CONFIG_NLS_ISO8859_13 is not set # CONFIG_NLS_ISO8859_14 is not set # CONFIG_NLS_ISO8859_15 is not set # CONFIG_NLS_KOI8_R is not set # CONFIG_NLS_KOI8_U is not set # CONFIG_NLS_MAC_ROMAN is not set # CONFIG_NLS_MAC_CELTIC is not set # CONFIG_NLS_MAC_CENTEURO is not set # CONFIG_NLS_MAC_CROATIAN is not set # CONFIG_NLS_MAC_CYRILLIC is not set # CONFIG_NLS_MAC_GAELIC is not set # CONFIG_NLS_MAC_GREEK is not set # CONFIG_NLS_MAC_ICELAND is not set # CONFIG_NLS_MAC_INUIT is not set # CONFIG_NLS_MAC_ROMANIAN is not set # CONFIG_NLS_MAC_TURKISH is not set CONFIG_NLS_UTF8=y # CONFIG_DLM is not set # # Kernel hacking # # # printk and dmesg options # CONFIG_PRINTK_TIME=y CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 # CONFIG_BOOT_PRINTK_DELAY is not set # CONFIG_DYNAMIC_DEBUG is not set # # Compile-time checks and compiler options # # CONFIG_DEBUG_INFO is not set CONFIG_ENABLE_WARN_DEPRECATED=y CONFIG_ENABLE_MUST_CHECK=y CONFIG_FRAME_WARN=2048 CONFIG_STRIP_ASM_SYMS=y # CONFIG_READABLE_ASM is not set # CONFIG_UNUSED_SYMBOLS is not set # CONFIG_PAGE_OWNER is not set CONFIG_DEBUG_FS=y # CONFIG_HEADERS_CHECK is not set # CONFIG_DEBUG_SECTION_MISMATCH is not set CONFIG_SECTION_MISMATCH_WARN_ONLY=y CONFIG_FRAME_POINTER=y # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set CONFIG_MAGIC_SYSRQ=y CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1 CONFIG_DEBUG_KERNEL=y # # Memory Debugging # # CONFIG_PAGE_EXTENSION is not set # CONFIG_DEBUG_PAGEALLOC is not set # CONFIG_PAGE_POISONING is not set # CONFIG_DEBUG_OBJECTS is not set # CONFIG_SLUB_STATS is not set CONFIG_HAVE_DEBUG_KMEMLEAK=y # CONFIG_DEBUG_KMEMLEAK is not set # CONFIG_DEBUG_STACK_USAGE is not set # CONFIG_DEBUG_VM is not set # CONFIG_DEBUG_MEMORY_INIT is not set # CONFIG_DEBUG_PER_CPU_MAPS is not set # CONFIG_DEBUG_SHIRQ is not set # # Debug Lockups and Hangs # # CONFIG_LOCKUP_DETECTOR is not set CONFIG_DETECT_HUNG_TASK=y CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 # CONFIG_WQ_WATCHDOG is not set # CONFIG_PANIC_ON_OOPS is not set CONFIG_PANIC_ON_OOPS_VALUE=0 CONFIG_PANIC_TIMEOUT=0 # CONFIG_SCHED_DEBUG is not set # CONFIG_SCHED_INFO is not set # CONFIG_SCHEDSTATS is not set # CONFIG_SCHED_STACK_END_CHECK is not set # CONFIG_DEBUG_TIMEKEEPING is not set # CONFIG_TIMER_STATS is not set # CONFIG_DEBUG_PREEMPT is not set # # Lock Debugging (spinlocks, mutexes, etc...) # # CONFIG_DEBUG_RT_MUTEXES is not set # CONFIG_DEBUG_SPINLOCK is not set # CONFIG_DEBUG_MUTEXES is not set # CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set # CONFIG_DEBUG_LOCK_ALLOC is not set # CONFIG_PROVE_LOCKING is not set # CONFIG_LOCK_STAT is not set # CONFIG_DEBUG_ATOMIC_SLEEP is not set # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_LOCK_TORTURE_TEST is not set # CONFIG_STACKTRACE is not set # CONFIG_DEBUG_KOBJECT is not set # CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_DEBUG_LIST is not set # CONFIG_DEBUG_PI_LIST is not set # CONFIG_DEBUG_SG is not set # CONFIG_DEBUG_NOTIFIERS is not set # CONFIG_DEBUG_CREDENTIALS is not set # # RCU Debugging # # CONFIG_PROVE_RCU is not set # CONFIG_SPARSE_RCU_POINTER is not set # CONFIG_TORTURE_TEST is not set # CONFIG_RCU_PERF_TEST is not set # CONFIG_RCU_TORTURE_TEST is not set CONFIG_RCU_CPU_STALL_TIMEOUT=60 # CONFIG_RCU_TRACE is not set # CONFIG_RCU_EQS_DEBUG is not set # CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set # CONFIG_NOTIFIER_ERROR_INJECTION is not set # CONFIG_FAULT_INJECTION is not set # CONFIG_LATENCYTOP is not set CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y CONFIG_HAVE_DYNAMIC_FTRACE=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_SYSCALL_TRACEPOINTS=y CONFIG_HAVE_C_RECORDMCOUNT=y CONFIG_TRACING_SUPPORT=y # CONFIG_FTRACE is not set # # Runtime Testing # # CONFIG_LKDTM is not set # CONFIG_TEST_LIST_SORT is not set # CONFIG_BACKTRACE_SELF_TEST is not set # CONFIG_RBTREE_TEST is not set # CONFIG_INTERVAL_TREE_TEST is not set # CONFIG_PERCPU_TEST is not set # CONFIG_ATOMIC64_SELFTEST is not set # CONFIG_TEST_HEXDUMP is not set # CONFIG_TEST_STRING_HELPERS is not set # CONFIG_TEST_KSTRTOX is not set # CONFIG_TEST_PRINTF is not set # CONFIG_TEST_BITMAP is not set # CONFIG_TEST_UUID is not set # CONFIG_TEST_RHASHTABLE is not set # CONFIG_TEST_HASH is not set # CONFIG_DMA_API_DEBUG is not set # CONFIG_TEST_LKM is not set # CONFIG_TEST_USER_COPY is not set # CONFIG_TEST_BPF is not set # CONFIG_TEST_FIRMWARE is not set # CONFIG_TEST_UDELAY is not set # CONFIG_MEMTEST is not set # CONFIG_TEST_STATIC_KEYS is not set # CONFIG_SAMPLES is not set CONFIG_HAVE_ARCH_KGDB=y # CONFIG_KGDB is not set # CONFIG_ARCH_WANTS_UBSAN_NO_NULL is not set # CONFIG_UBSAN is not set CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y # CONFIG_STRICT_DEVMEM is not set # CONFIG_ARM_PTDUMP is not set # CONFIG_ARM_UNWIND is not set # CONFIG_DEBUG_USER is not set # CONFIG_DEBUG_LL is not set CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" # CONFIG_DEBUG_UART_8250 is not set CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" # CONFIG_PID_IN_CONTEXTIDR is not set # CONFIG_DEBUG_SET_MODULE_RONX is not set # CONFIG_CORESIGHT is not set # # Security options # CONFIG_KEYS=y # CONFIG_PERSISTENT_KEYRINGS is not set # CONFIG_BIG_KEYS is not set # CONFIG_ENCRYPTED_KEYS is not set # CONFIG_KEY_DH_OPERATIONS is not set # CONFIG_SECURITY_DMESG_RESTRICT is not set # CONFIG_SECURITY is not set # CONFIG_SECURITYFS is not set CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y CONFIG_HAVE_ARCH_HARDENED_USERCOPY=y # CONFIG_HARDENED_USERCOPY is not set CONFIG_DEFAULT_SECURITY_DAC=y CONFIG_DEFAULT_SECURITY="" CONFIG_CRYPTO=y # # Crypto core or helper # CONFIG_CRYPTO_ALGAPI=y CONFIG_CRYPTO_ALGAPI2=y CONFIG_CRYPTO_AEAD=y CONFIG_CRYPTO_AEAD2=y CONFIG_CRYPTO_BLKCIPHER=y CONFIG_CRYPTO_BLKCIPHER2=y CONFIG_CRYPTO_HASH=y CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_RNG=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_RNG_DEFAULT=y CONFIG_CRYPTO_AKCIPHER2=y CONFIG_CRYPTO_KPP2=y # CONFIG_CRYPTO_RSA is not set # CONFIG_CRYPTO_DH is not set # CONFIG_CRYPTO_ECDH is not set CONFIG_CRYPTO_MANAGER=y CONFIG_CRYPTO_MANAGER2=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y CONFIG_CRYPTO_GF128MUL=m CONFIG_CRYPTO_NULL=y CONFIG_CRYPTO_NULL2=y # CONFIG_CRYPTO_PCRYPT is not set CONFIG_CRYPTO_WORKQUEUE=y CONFIG_CRYPTO_CRYPTD=m # CONFIG_CRYPTO_MCRYPTD is not set # CONFIG_CRYPTO_AUTHENC is not set # CONFIG_CRYPTO_TEST is not set CONFIG_CRYPTO_ABLK_HELPER=m # # Authenticated Encryption with Associated Data # CONFIG_CRYPTO_CCM=m CONFIG_CRYPTO_GCM=m # CONFIG_CRYPTO_CHACHA20POLY1305 is not set CONFIG_CRYPTO_SEQIV=y CONFIG_CRYPTO_ECHAINIV=m # # Block modes # CONFIG_CRYPTO_CBC=y CONFIG_CRYPTO_CTR=m CONFIG_CRYPTO_CTS=m CONFIG_CRYPTO_ECB=y # CONFIG_CRYPTO_LRW is not set # CONFIG_CRYPTO_PCBC is not set CONFIG_CRYPTO_XTS=m # CONFIG_CRYPTO_KEYWRAP is not set # # Hash modes # CONFIG_CRYPTO_CMAC=y CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_XCBC=m # CONFIG_CRYPTO_VMAC is not set # # Digest # CONFIG_CRYPTO_CRC32C=y # CONFIG_CRYPTO_CRC32 is not set # CONFIG_CRYPTO_CRCT10DIF is not set CONFIG_CRYPTO_GHASH=m # CONFIG_CRYPTO_POLY1305 is not set CONFIG_CRYPTO_MD4=y CONFIG_CRYPTO_MD5=y CONFIG_CRYPTO_MICHAEL_MIC=m # CONFIG_CRYPTO_RMD128 is not set # CONFIG_CRYPTO_RMD160 is not set # CONFIG_CRYPTO_RMD256 is not set # CONFIG_CRYPTO_RMD320 is not set CONFIG_CRYPTO_SHA1=m CONFIG_CRYPTO_SHA256=y CONFIG_CRYPTO_SHA512=m # CONFIG_CRYPTO_SHA3 is not set CONFIG_CRYPTO_TGR192=m CONFIG_CRYPTO_WP512=m # # Ciphers # CONFIG_CRYPTO_AES=y # CONFIG_CRYPTO_ANUBIS is not set CONFIG_CRYPTO_ARC4=y # CONFIG_CRYPTO_BLOWFISH is not set # CONFIG_CRYPTO_CAMELLIA is not set CONFIG_CRYPTO_CAST_COMMON=m CONFIG_CRYPTO_CAST5=m # CONFIG_CRYPTO_CAST6 is not set CONFIG_CRYPTO_DES=y # CONFIG_CRYPTO_FCRYPT is not set # CONFIG_CRYPTO_KHAZAD is not set # CONFIG_CRYPTO_SALSA20 is not set # CONFIG_CRYPTO_CHACHA20 is not set # CONFIG_CRYPTO_SEED is not set # CONFIG_CRYPTO_SERPENT is not set # CONFIG_CRYPTO_TEA is not set # CONFIG_CRYPTO_TWOFISH is not set # # Compression # CONFIG_CRYPTO_DEFLATE=m # CONFIG_CRYPTO_LZO is not set # CONFIG_CRYPTO_842 is not set # CONFIG_CRYPTO_LZ4 is not set # CONFIG_CRYPTO_LZ4HC is not set # # Random Number Generation # CONFIG_CRYPTO_ANSI_CPRNG=m CONFIG_CRYPTO_DRBG_MENU=y CONFIG_CRYPTO_DRBG_HMAC=y # CONFIG_CRYPTO_DRBG_HASH is not set # CONFIG_CRYPTO_DRBG_CTR is not set CONFIG_CRYPTO_DRBG=y CONFIG_CRYPTO_JITTERENTROPY=y CONFIG_CRYPTO_USER_API=m # CONFIG_CRYPTO_USER_API_HASH is not set CONFIG_CRYPTO_USER_API_SKCIPHER=m # CONFIG_CRYPTO_USER_API_RNG is not set # CONFIG_CRYPTO_USER_API_AEAD is not set # CONFIG_CRYPTO_HW is not set # CONFIG_ASYMMETRIC_KEY_TYPE is not set # # Certificates for signature checking # CONFIG_ARM_CRYPTO=y CONFIG_CRYPTO_SHA1_ARM=m CONFIG_CRYPTO_SHA1_ARM_NEON=m CONFIG_CRYPTO_SHA1_ARM_CE=m CONFIG_CRYPTO_SHA2_ARM_CE=m CONFIG_CRYPTO_SHA256_ARM=m # CONFIG_CRYPTO_SHA512_ARM is not set CONFIG_CRYPTO_AES_ARM=m CONFIG_CRYPTO_AES_ARM_BS=m CONFIG_CRYPTO_AES_ARM_CE=m CONFIG_CRYPTO_GHASH_ARM_CE=m # CONFIG_BINARY_PRINTF is not set # # Library routines # CONFIG_BITREVERSE=y CONFIG_HAVE_ARCH_BITREVERSE=y CONFIG_RATIONAL=y CONFIG_GENERIC_STRNCPY_FROM_USER=y CONFIG_GENERIC_STRNLEN_USER=y CONFIG_GENERIC_NET_UTILS=y CONFIG_GENERIC_PCI_IOMAP=y CONFIG_GENERIC_IO=y CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y CONFIG_CRC_CCITT=y CONFIG_CRC16=y # CONFIG_CRC_T10DIF is not set CONFIG_CRC_ITU_T=y CONFIG_CRC32=y # CONFIG_CRC32_SELFTEST is not set CONFIG_CRC32_SLICEBY8=y # CONFIG_CRC32_SLICEBY4 is not set # CONFIG_CRC32_SARWATE is not set # CONFIG_CRC32_BIT is not set # CONFIG_CRC7 is not set CONFIG_LIBCRC32C=y # CONFIG_CRC8 is not set # CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set # CONFIG_RANDOM32_SELFTEST is not set CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=m CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y # CONFIG_XZ_DEC is not set # CONFIG_XZ_DEC_BCJ is not set CONFIG_DECOMPRESS_GZIP=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_ASSOCIATIVE_ARRAY=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HAS_DMA=y CONFIG_CPU_RMAP=y CONFIG_DQL=y CONFIG_GLOB=y # CONFIG_GLOB_SELFTEST is not set CONFIG_NLATTR=y # CONFIG_CORDIC is not set # CONFIG_DDR is not set # CONFIG_IRQ_POLL is not set CONFIG_LIBFDT=y CONFIG_FONT_SUPPORT=y # CONFIG_FONTS is not set CONFIG_FONT_8x8=y CONFIG_FONT_8x16=y # CONFIG_SG_SPLIT is not set CONFIG_SG_POOL=y CONFIG_ARCH_HAS_SG_CHAIN=y CONFIG_SBITMAP=y # CONFIG_VIRTUALIZATION is not set
{ "pile_set_name": "Github" }
/* ** x86/x64 IR assembler (SSA IR -> machine code). ** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h */ /* -- Guard handling ------------------------------------------------------ */ /* Generate an exit stub group at the bottom of the reserved MCode memory. */ static MCode *asm_exitstub_gen(ASMState *as, ExitNo group) { ExitNo i, groupofs = (group*EXITSTUBS_PER_GROUP) & 0xff; MCode *mxp = as->mcbot; MCode *mxpstart = mxp; if (mxp + (2+2)*EXITSTUBS_PER_GROUP+8+5 >= as->mctop) asm_mclimit(as); /* Push low byte of exitno for each exit stub. */ *mxp++ = XI_PUSHi8; *mxp++ = (MCode)groupofs; for (i = 1; i < EXITSTUBS_PER_GROUP; i++) { *mxp++ = XI_JMPs; *mxp++ = (MCode)((2+2)*(EXITSTUBS_PER_GROUP - i) - 2); *mxp++ = XI_PUSHi8; *mxp++ = (MCode)(groupofs + i); } /* Push the high byte of the exitno for each exit stub group. */ *mxp++ = XI_PUSHi8; *mxp++ = (MCode)((group*EXITSTUBS_PER_GROUP)>>8); /* Jump to exit handler which fills in the ExitState. */ *mxp++ = XI_JMP; mxp += 4; *((int32_t *)(mxp-4)) = jmprel(mxp, (MCode *)(void *)lj_vm_exit_handler); /* Commit the code for this group (even if assembly fails later on). */ lj_mcode_commitbot(as->J, mxp); as->mcbot = mxp; as->mclim = as->mcbot + MCLIM_REDZONE; return mxpstart; } /* Setup all needed exit stubs. */ static void asm_exitstub_setup(ASMState *as, ExitNo nexits) { ExitNo i; if (nexits >= EXITSTUBS_PER_GROUP*LJ_MAX_EXITSTUBGR) lj_trace_err(as->J, LJ_TRERR_SNAPOV); for (i = 0; i < (nexits+EXITSTUBS_PER_GROUP-1)/EXITSTUBS_PER_GROUP; i++) if (as->J->exitstubgroup[i] == NULL) as->J->exitstubgroup[i] = asm_exitstub_gen(as, i); } /* Emit conditional branch to exit for guard. ** It's important to emit this *after* all registers have been allocated, ** because rematerializations may invalidate the flags. */ static void asm_guardcc(ASMState *as, int cc) { MCode *target = exitstub_addr(as->J, as->snapno); MCode *p = as->mcp; if (LJ_UNLIKELY(p == as->invmcp)) { as->loopinv = 1; *(int32_t *)(p+1) = jmprel(p+5, target); target = p; cc ^= 1; if (as->realign) { if (LJ_UNLIKELY(as->mrm.base == RID_RIP)) as->mrm.ofs += 2; /* Fixup RIP offset for pending fused load. */ emit_sjcc(as, cc, target); return; } } if (LJ_UNLIKELY(as->mrm.base == RID_RIP)) as->mrm.ofs += 6; /* Fixup RIP offset for pending fused load. */ emit_jcc(as, cc, target); } /* -- Memory operand fusion ----------------------------------------------- */ /* Limit linear search to this distance. Avoids O(n^2) behavior. */ #define CONFLICT_SEARCH_LIM 31 /* Check if a reference is a signed 32 bit constant. */ static int asm_isk32(ASMState *as, IRRef ref, int32_t *k) { if (irref_isk(ref)) { IRIns *ir = IR(ref); if (ir->o == IR_KNULL || !irt_is64(ir->t)) { *k = ir->i; return 1; } else if (checki32((int64_t)ir_k64(ir)->u64)) { *k = (int32_t)ir_k64(ir)->u64; return 1; } } return 0; } /* Check if there's no conflicting instruction between curins and ref. ** Also avoid fusing loads if there are multiple references. */ static int noconflict(ASMState *as, IRRef ref, IROp conflict, int noload) { IRIns *ir = as->ir; IRRef i = as->curins; if (i > ref + CONFLICT_SEARCH_LIM) return 0; /* Give up, ref is too far away. */ while (--i > ref) { if (ir[i].o == conflict) return 0; /* Conflict found. */ else if (!noload && (ir[i].op1 == ref || ir[i].op2 == ref)) return 0; } return 1; /* Ok, no conflict. */ } /* Fuse array base into memory operand. */ static IRRef asm_fuseabase(ASMState *as, IRRef ref) { IRIns *irb = IR(ref); as->mrm.ofs = 0; if (irb->o == IR_FLOAD) { IRIns *ira = IR(irb->op1); lua_assert(irb->op2 == IRFL_TAB_ARRAY); /* We can avoid the FLOAD of t->array for colocated arrays. */ if (ira->o == IR_TNEW && ira->op1 <= LJ_MAX_COLOSIZE && !neverfuse(as) && noconflict(as, irb->op1, IR_NEWREF, 1)) { as->mrm.ofs = (int32_t)sizeof(GCtab); /* Ofs to colocated array. */ return irb->op1; /* Table obj. */ } } else if (irb->o == IR_ADD && irref_isk(irb->op2)) { /* Fuse base offset (vararg load). */ as->mrm.ofs = IR(irb->op2)->i; return irb->op1; } return ref; /* Otherwise use the given array base. */ } /* Fuse array reference into memory operand. */ static void asm_fusearef(ASMState *as, IRIns *ir, RegSet allow) { IRIns *irx; lua_assert(ir->o == IR_AREF); as->mrm.base = (uint8_t)ra_alloc1(as, asm_fuseabase(as, ir->op1), allow); irx = IR(ir->op2); if (irref_isk(ir->op2)) { as->mrm.ofs += 8*irx->i; as->mrm.idx = RID_NONE; } else { rset_clear(allow, as->mrm.base); as->mrm.scale = XM_SCALE8; /* Fuse a constant ADD (e.g. t[i+1]) into the offset. ** Doesn't help much without ABCelim, but reduces register pressure. */ as->mrm.idx = (uint8_t)ra_alloc1(as, ir->op2, allow); } } /* Fuse array/hash/upvalue reference into memory operand. ** Caveat: this may allocate GPRs for the base/idx registers. Be sure to ** pass the final allow mask, excluding any GPRs used for other inputs. ** In particular: 2-operand GPR instructions need to call ra_dest() first! */ static void asm_fuseahuref(ASMState *as, IRRef ref, RegSet allow) { IRIns *ir = IR(ref); if (ra_noreg(ir->r)) { switch ((IROp)ir->o) { case IR_AREF: if (mayfuse(as, ref)) { asm_fusearef(as, ir, allow); return; } break; case IR_HREFK: if (mayfuse(as, ref)) { as->mrm.base = (uint8_t)ra_alloc1(as, ir->op1, allow); as->mrm.ofs = (int32_t)(IR(ir->op2)->op2 * sizeof(Node)); as->mrm.idx = RID_NONE; return; } break; case IR_UREFC: if (irref_isk(ir->op1)) { GCfunc *fn = ir_kfunc(IR(ir->op1)); GCupval *uv = &gcref(fn->l.uvptr[(ir->op2 >> 8)])->uv; int64_t ofs = dispofs(as, &uv->tv); if (checki32(ofs) && checki32(ofs+4)) { as->mrm.ofs = (int32_t)ofs; as->mrm.base = RID_DISPATCH; as->mrm.idx = RID_NONE; return; } } break; default: lua_assert(ir->o == IR_HREF || ir->o == IR_NEWREF || ir->o == IR_UREFO || ir->o == IR_KKPTR); break; } } as->mrm.base = (uint8_t)ra_alloc1(as, ref, allow); as->mrm.ofs = 0; as->mrm.idx = RID_NONE; } /* Fuse FLOAD/FREF reference into memory operand. */ static void asm_fusefref(ASMState *as, IRIns *ir, RegSet allow) { lua_assert(ir->o == IR_FLOAD || ir->o == IR_FREF); as->mrm.idx = RID_NONE; if (ir->op1 == REF_NIL) { as->mrm.ofs = (int32_t)(ir->op2 << 2) - GG_OFS(dispatch); as->mrm.base = RID_DISPATCH; return; } as->mrm.ofs = field_ofs[ir->op2]; if (irref_isk(ir->op1)) { IRIns *op1 = IR(ir->op1); if (ir->op1 == REF_NIL) { as->mrm.ofs -= GG_OFS(dispatch); as->mrm.base = RID_DISPATCH; return; } else if (op1->o == IR_KPTR || op1->o == IR_KKPTR) { intptr_t ofs = dispofs(as, ir_kptr(op1)); if (checki32(as->mrm.ofs + ofs)) { as->mrm.ofs += (int32_t)ofs; as->mrm.base = RID_DISPATCH; return; } } } as->mrm.base = (uint8_t)ra_alloc1(as, ir->op1, allow); } /* Fuse string reference into memory operand. */ static void asm_fusestrref(ASMState *as, IRIns *ir, RegSet allow) { IRIns *irr; lua_assert(ir->o == IR_STRREF); as->mrm.base = as->mrm.idx = RID_NONE; as->mrm.scale = XM_SCALE1; as->mrm.ofs = sizeof(GCstr); Reg r = ra_alloc1(as, ir->op1, allow); rset_clear(allow, r); as->mrm.base = (uint8_t)r; irr = IR(ir->op2); if (irref_isk(ir->op2)) { as->mrm.ofs += irr->i; } else { Reg r; /* Fuse a constant add into the offset, e.g. string.sub(s, i+10). */ r = ra_alloc1(as, ir->op2, allow); if (as->mrm.base == RID_NONE) as->mrm.base = (uint8_t)r; else as->mrm.idx = (uint8_t)r; } } static void asm_fusexref(ASMState *as, IRRef ref, RegSet allow) { IRIns *ir = IR(ref); as->mrm.idx = RID_NONE; if (ir->o == IR_KPTR || ir->o == IR_KKPTR) { intptr_t ofs = dispofs(as, ir_kptr(ir)); if (checki32(ofs)) { as->mrm.ofs = (int32_t)ofs; as->mrm.base = RID_DISPATCH; return; } } if (0) { } else { as->mrm.ofs = 0; if (canfuse(as, ir) && ir->o == IR_ADD && ra_noreg(ir->r)) { /* Gather (base+idx*sz)+ofs as emitted by cdata ptr/array indexing. */ IRIns *irx; IRRef idx; Reg r; if (asm_isk32(as, ir->op2, &as->mrm.ofs)) { /* Recognize x+ofs. */ ref = ir->op1; ir = IR(ref); if (!(ir->o == IR_ADD && canfuse(as, ir) && ra_noreg(ir->r))) goto noadd; } as->mrm.scale = XM_SCALE1; idx = ir->op1; ref = ir->op2; irx = IR(idx); if (!(irx->o == IR_BSHL || irx->o == IR_ADD)) { /* Try other operand. */ idx = ir->op2; ref = ir->op1; irx = IR(idx); } if (canfuse(as, irx) && ra_noreg(irx->r)) { if (irx->o == IR_BSHL && irref_isk(irx->op2) && IR(irx->op2)->i <= 3) { /* Recognize idx<<b with b = 0-3, corresponding to sz = (1),2,4,8. */ idx = irx->op1; as->mrm.scale = (uint8_t)(IR(irx->op2)->i << 6); } else if (irx->o == IR_ADD && irx->op1 == irx->op2) { /* FOLD does idx*2 ==> idx<<1 ==> idx+idx. */ idx = irx->op1; as->mrm.scale = XM_SCALE2; } } r = ra_alloc1(as, idx, allow); rset_clear(allow, r); as->mrm.idx = (uint8_t)r; } noadd: as->mrm.base = (uint8_t)ra_alloc1(as, ref, allow); } } /* Fuse load of 64 bit IR constant into memory operand. */ static Reg asm_fuseloadk64(ASMState *as, IRIns *ir) { const uint64_t *k = &ir_k64(ir)->u64; if (checki32((intptr_t)k)) { as->mrm.ofs = ptr2addr(k); as->mrm.base = RID_NONE; } else if (checki32(dispofs(as, k))) { as->mrm.ofs = (int32_t)dispofs(as, k); as->mrm.base = RID_DISPATCH; } else if (checki32(mcpofs(as, k)) && checki32(mcpofs(as, k+1)) && checki32(mctopofs(as, k)) && checki32(mctopofs(as, k+1))) { as->mrm.ofs = (int32_t)mcpofs(as, k); as->mrm.base = RID_RIP; } else { if (ir->i) { lua_assert(*k == *(uint64_t*)(as->mctop - ir->i)); } else { while ((uintptr_t)as->mcbot & 7) *as->mcbot++ = XI_INT3; *(uint64_t*)as->mcbot = *k; ir->i = (int32_t)(as->mctop - as->mcbot); as->mcbot += 8; as->mclim = as->mcbot + MCLIM_REDZONE; lj_mcode_commitbot(as->J, as->mcbot); } as->mrm.ofs = (int32_t)mcpofs(as, as->mctop - ir->i); as->mrm.base = RID_RIP; } as->mrm.idx = RID_NONE; return RID_MRM; } /* Fuse load into memory operand. ** ** Important caveat: this may emit RIP-relative loads! So don't place any ** code emitters between this function and the use of its result. ** The only permitted exception is asm_guardcc(). */ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow) { IRIns *ir = IR(ref); if (ra_hasreg(ir->r)) { if (allow != RSET_EMPTY) { /* Fast path. */ ra_noweak(as, ir->r); return ir->r; } fusespill: /* Force a spill if only memory operands are allowed (asm_x87load). */ as->mrm.base = RID_ESP; as->mrm.ofs = ra_spill(as, ir); as->mrm.idx = RID_NONE; return RID_MRM; } if (ir->o == IR_KNUM) { RegSet avail = as->freeset & ~as->modset & RSET_FPR; lua_assert(allow != RSET_EMPTY); if (!(avail & (avail-1))) /* Fuse if less than two regs available. */ return asm_fuseloadk64(as, ir); } else if (ref == REF_BASE || ir->o == IR_KINT64) { RegSet avail = as->freeset & ~as->modset & RSET_GPR; lua_assert(allow != RSET_EMPTY); if (!(avail & (avail-1))) { /* Fuse if less than two regs available. */ if (ref == REF_BASE) { as->mrm.ofs = (int32_t)dispofs(as, &J2G(as->J)->jit_base); as->mrm.base = RID_DISPATCH; as->mrm.idx = RID_NONE; return RID_MRM; } else { return asm_fuseloadk64(as, ir); } } } else if (mayfuse(as, ref)) { RegSet xallow = (allow & RSET_GPR) ? allow : RSET_GPR; if (ir->o == IR_SLOAD) { if (!(ir->op2 & (IRSLOAD_PARENT|IRSLOAD_CONVERT)) && noconflict(as, ref, IR_RETF, 0) && !irt_isaddr(ir->t)) { as->mrm.base = (uint8_t)ra_alloc1(as, REF_BASE, xallow); as->mrm.ofs = 8*((int32_t)ir->op1-1-LJ_FR2) + (!LJ_FR2 && (ir->op2 & IRSLOAD_FRAME) ? 4 : 0); as->mrm.idx = RID_NONE; return RID_MRM; } } else if (ir->o == IR_FLOAD) { /* Generic fusion is only ok for 32 bit operand (but see asm_comp). */ if ((irt_isint(ir->t) || irt_isu32(ir->t) || irt_isaddr(ir->t)) && noconflict(as, ref, IR_FSTORE, 0)) { asm_fusefref(as, ir, xallow); return RID_MRM; } } else if (ir->o == IR_ALOAD || ir->o == IR_HLOAD || ir->o == IR_ULOAD) { if (noconflict(as, ref, ir->o + IRDELTA_L2S, 0) && !irt_isaddr(ir->t)) { asm_fuseahuref(as, ir->op1, xallow); return RID_MRM; } } else if (ir->o == IR_XLOAD) { /* Generic fusion is not ok for 8/16 bit operands (but see asm_comp). ** Fusing unaligned memory operands is ok on x86 (except for SIMD types). */ if ((!irt_typerange(ir->t, IRT_I8, IRT_U16)) && noconflict(as, ref, IR_XSTORE, 0)) { asm_fusexref(as, ir->op1, xallow); return RID_MRM; } } else if (ir->o == IR_VLOAD && !irt_isaddr(ir->t)) { asm_fuseahuref(as, ir->op1, xallow); return RID_MRM; } } if (ir->o == IR_FLOAD && ir->op1 == REF_NIL) { asm_fusefref(as, ir, RSET_EMPTY); return RID_MRM; } if (!(as->freeset & allow) && !emit_canremat(ref) && (allow == RSET_EMPTY || ra_hasspill(ir->s) || iscrossref(as, ref))) goto fusespill; return ra_allocref(as, ref, allow); } /* Don't fuse a 32 bit load into a 64 bit operation. */ static Reg asm_fuseloadm(ASMState *as, IRRef ref, RegSet allow, int is64) { if (is64 && !irt_is64(IR(ref)->t)) return ra_alloc1(as, ref, allow); return asm_fuseload(as, ref, allow); } /* -- Calls --------------------------------------------------------------- */ /* Count the required number of stack slots for a call. */ static int asm_count_call_slots(ASMState *as, const CCallInfo *ci, IRRef *args) { uint32_t i, nargs = CCI_XNARGS(ci); int nslots = 0; if (LJ_ABI_WIN) { nslots = (int)(nargs*2); /* Only matters for more than four args. */ } else { int ngpr = REGARG_NUMGPR, nfpr = REGARG_NUMFPR; for (i = 0; i < nargs; i++) if (args[i] && irt_isfp(IR(args[i])->t)) { if (nfpr > 0) nfpr--; else nslots += 2; } else { if (ngpr > 0) ngpr--; else nslots += 2; } } return nslots; } /* Generate a call to a C function. */ static void asm_gencall(ASMState *as, const CCallInfo *ci, IRRef *args) { uint32_t n, nargs = CCI_XNARGS(ci); int32_t ofs = STACKARG_OFS; uint32_t gprs = REGARG_GPRS; Reg fpr = REGARG_FIRSTFPR; MCode *patchnfpr = NULL; if ((void *)ci->func) emit_call(as, ci->func); if ((ci->flags & CCI_VARARG)) { /* Special handling for vararg calls. */ patchnfpr = --as->mcp; /* Indicate number of used FPRs in register al. */ *--as->mcp = XI_MOVrib | RID_EAX; } for (n = 0; n < nargs; n++) { /* Setup args. */ IRRef ref = args[n]; IRIns *ir = IR(ref); Reg r; /* POSIX/x64 argument registers are used in order of appearance. */ if (irt_isfp(ir->t)) { r = fpr <= REGARG_LASTFPR ? fpr++ : 0; } else { r = gprs & 31; gprs >>= 5; } if (r) { /* Argument is in a register. */ if (r < RID_MAX_GPR && ref < ASMREF_TMP1) { if (!(ir->o == IR_KINT || ir->o == IR_KNULL)) emit_loadu64(as, r, ir_k64(ir)->u64); else emit_loadi(as, r, ir->i); } else { lua_assert(rset_test(as->freeset, r)); /* Must have been evicted. */ if (ra_hasreg(ir->r)) { ra_noweak(as, ir->r); emit_movrr(as, ir, r, ir->r); } else { ra_allocref(as, ref, RID2RSET(r)); } } } else if (irt_isfp(ir->t)) { /* FP argument is on stack. */ lua_assert(!(irt_isfloat(ir->t) && irref_isk(ref))); /* No float k. */ r = ra_alloc1(as, ref, RSET_FPR); emit_rmro(as, irt_isnum(ir->t) ? XO_MOVSDto : XO_MOVSSto, r, RID_ESP, ofs); ofs += 8; } else { /* Non-FP argument is on stack. */ r = ra_alloc1(as, ref, RSET_GPR); emit_movtomro(as, REX_64 + r, RID_ESP, ofs); ofs += sizeof(intptr_t); } checkmclim(as); } if (patchnfpr) *patchnfpr = fpr - REGARG_FIRSTFPR; } /* Setup result reg/sp for call. Evict scratch regs. */ static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci) { RegSet drop = RSET_SCRATCH; if ((ci->flags & CCI_NOFPRCLOBBER)) drop &= ~RSET_FPR; if (ra_hasreg(ir->r)) rset_clear(drop, ir->r); /* Dest reg handled below. */ ra_evictset(as, drop); /* Evictions must be performed first. */ if (ra_used(ir)) { if (irt_isfp(ir->t)) { int32_t ofs = sps_scale(ir->s); /* Use spill slot or temp slots. */ if ((ci->flags & CCI_CASTU64)) { Reg dest = ir->r; if (ra_hasreg(dest)) { ra_free(as, dest); ra_modified(as, dest); emit_rr(as, XO_MOVD, dest|REX_64, RID_RET); /* Really MOVQ. */ } if (ofs) emit_movtomro(as, RID_RET|REX_64, RID_ESP, ofs); } else { ra_destreg(as, ir, RID_FPRET); } } else { lua_assert(!irt_ispri(ir->t)); ra_destreg(as, ir, RID_RET); } } } /* Return a constant function pointer or NULL for indirect calls. */ static void *asm_callx_func(ASMState *as, IRIns *irf, IRRef func) { if (irref_isk(func)) { MCode *p; if (irf->o == IR_KINT64) p = (MCode *)(void *)ir_k64(irf)->u64; else p = (MCode *)(void *)(uintptr_t)(uint32_t)irf->i; if (p - as->mcp == (int32_t)(p - as->mcp)) return p; /* Call target is still in +-2GB range. */ /* Avoid the indirect case of emit_call(). Try to hoist func addr. */ } return NULL; } static void asm_callx(ASMState *as, IRIns *ir) { IRRef args[CCI_NARGS_MAX*2]; CCallInfo ci; IRRef func; IRIns *irf; ci.flags = asm_callx_flags(as, ir); asm_collectargs(as, ir, &ci, args); asm_setupresult(as, ir, &ci); func = ir->op2; irf = IR(func); if (irf->o == IR_CARG) { func = irf->op1; irf = IR(func); } ci.func = (ASMFunction)asm_callx_func(as, irf, func); if (!(void *)ci.func) { /* Use a (hoistable) non-scratch register for indirect calls. */ RegSet allow = (RSET_GPR & ~RSET_SCRATCH); Reg r = ra_alloc1(as, func, allow); emit_rr(as, XO_GROUP5, XOg_CALL, r); } asm_gencall(as, &ci, args); } /* -- Returns ------------------------------------------------------------- */ /* Return to lower frame. Guard that it goes to the right spot. */ static void asm_retf(ASMState *as, IRIns *ir) { Reg base = ra_alloc1(as, REF_BASE, RSET_GPR); Reg rpc = ra_scratch(as, rset_exclude(RSET_GPR, base)); void *pc = ir_kptr(IR(ir->op2)); int32_t delta = 1+LJ_FR2+bc_a(*((const BCIns *)pc - 1)); as->topslot -= (BCReg)delta; if ((int32_t)as->topslot < 0) as->topslot = 0; irt_setmark(IR(REF_BASE)->t); /* Children must not coalesce with BASE reg. */ emit_setgl(as, base, jit_base); emit_addptr(as, base, -8*delta); asm_guardcc(as, CC_NE); emit_rmro(as, XO_CMP, rpc|REX_GC64, base, -8); emit_loadu64(as, rpc, u64ptr(pc)); } /* -- Type conversions ---------------------------------------------------- */ static void asm_tointg(ASMState *as, IRIns *ir, Reg left) { Reg tmp = ra_scratch(as, rset_exclude(RSET_FPR, left)); Reg dest = ra_dest(as, ir, RSET_GPR); asm_guardcc(as, CC_P); asm_guardcc(as, CC_NE); emit_rr(as, XO_UCOMISD, left, tmp); emit_rr(as, XO_CVTSI2SD, tmp, dest); emit_rr(as, XO_XORPS, tmp, tmp); /* Avoid partial register stall. */ emit_rr(as, XO_CVTTSD2SI, dest, left); /* Can't fuse since left is needed twice. */ } static void asm_tobit(ASMState *as, IRIns *ir) { Reg dest = ra_dest(as, ir, RSET_GPR); Reg tmp = ra_noreg(IR(ir->op1)->r) ? ra_alloc1(as, ir->op1, RSET_FPR) : ra_scratch(as, RSET_FPR); Reg right; emit_rr(as, XO_MOVDto, tmp, dest); right = asm_fuseload(as, ir->op2, rset_exclude(RSET_FPR, tmp)); emit_mrm(as, XO_ADDSD, tmp, right); ra_left(as, tmp, ir->op1); } static void asm_conv(ASMState *as, IRIns *ir) { IRType st = (IRType)(ir->op2 & IRCONV_SRCMASK); int st64 = (st == IRT_I64 || st == IRT_U64 || st == IRT_P64); int stfp = (st == IRT_NUM || st == IRT_FLOAT); IRRef lref = ir->op1; lua_assert(irt_type(ir->t) != st); if (irt_isfp(ir->t)) { Reg dest = ra_dest(as, ir, RSET_FPR); if (stfp) { /* FP to FP conversion. */ Reg left = asm_fuseload(as, lref, RSET_FPR); emit_mrm(as, st == IRT_NUM ? XO_CVTSD2SS : XO_CVTSS2SD, dest, left); if (left == dest) return; /* Avoid the XO_XORPS. */ } else { /* Integer to FP conversion. */ Reg left = (st == IRT_U32 || st == IRT_U64) ? ra_alloc1(as, lref, RSET_GPR) : asm_fuseloadm(as, lref, RSET_GPR, st64); if (st == IRT_U64) { MCLabel l_end = emit_label(as); cTValue *k = &as->J->k64[LJ_K64_2P64]; emit_rma(as, XO_ADDSD, dest, k); /* Add 2^64 to compensate. */ emit_sjcc(as, CC_NS, l_end); emit_rr(as, XO_TEST, left|REX_64, left); /* Check if u64 >= 2^63. */ } emit_mrm(as, irt_isnum(ir->t) ? XO_CVTSI2SD : XO_CVTSI2SS, dest|((st64 || st == IRT_U32) ? REX_64 : 0), left); } emit_rr(as, XO_XORPS, dest, dest); /* Avoid partial register stall. */ } else if (stfp) { /* FP to integer conversion. */ if (irt_isguard(ir->t)) { /* Checked conversions are only supported from number to int. */ lua_assert(irt_isint(ir->t) && st == IRT_NUM); asm_tointg(as, ir, ra_alloc1(as, lref, RSET_FPR)); } else { Reg dest = ra_dest(as, ir, RSET_GPR); x86Op op = st == IRT_NUM ? XO_CVTTSD2SI : XO_CVTTSS2SI; if (irt_isu64(ir->t)) { /* LJ_64: For inputs >= 2^63 add -2^64, convert again. */ Reg tmp = ra_noreg(IR(lref)->r) ? ra_alloc1(as, lref, RSET_FPR) : ra_scratch(as, RSET_FPR); MCLabel l_end = emit_label(as); emit_rr(as, op, dest|REX_64, tmp); if (st == IRT_NUM) emit_rma(as, XO_ADDSD, tmp, &as->J->k64[LJ_K64_M2P64_31]); else emit_rma(as, XO_ADDSS, tmp, &as->J->k32[LJ_K32_M2P64_31]); emit_sjcc(as, CC_NS, l_end); emit_rr(as, XO_TEST, dest|REX_64, dest); /* Check if dest negative. */ emit_rr(as, op, dest|REX_64, tmp); ra_left(as, tmp, lref); } else { if (irt_isu32(ir->t)) emit_rr(as, XO_MOV, dest, dest); /* Zero hiword. */ emit_mrm(as, op, dest|((irt_is64(ir->t) || irt_isu32(ir->t)) ? REX_64 : 0), asm_fuseload(as, lref, RSET_FPR)); } } } else if (st >= IRT_I8 && st <= IRT_U16) { /* Extend to 32 bit integer. */ Reg left, dest = ra_dest(as, ir, RSET_GPR); RegSet allow = RSET_GPR; x86Op op; lua_assert(irt_isint(ir->t) || irt_isu32(ir->t)); if (st == IRT_I8) { op = XO_MOVSXb; allow = RSET_GPR8; dest |= FORCE_REX; } else if (st == IRT_U8) { op = XO_MOVZXb; allow = RSET_GPR8; dest |= FORCE_REX; } else if (st == IRT_I16) { op = XO_MOVSXw; } else { op = XO_MOVZXw; } left = asm_fuseload(as, lref, allow); /* Add extra MOV if source is already in wrong register. */ emit_mrm(as, op, dest, left); } else { /* 32/64 bit integer conversions. */ if (irt_is64(ir->t)) { Reg dest = ra_dest(as, ir, RSET_GPR); if (st64 || !(ir->op2 & IRCONV_SEXT)) { /* 64/64 bit no-op (cast) or 32 to 64 bit zero extension. */ ra_left(as, dest, lref); /* Do nothing, but may need to move regs. */ } else { /* 32 to 64 bit sign extension. */ Reg left = asm_fuseload(as, lref, RSET_GPR); emit_mrm(as, XO_MOVSXd, dest|REX_64, left); } } else { Reg dest = ra_dest(as, ir, RSET_GPR); if (st64) { Reg left = asm_fuseload(as, lref, RSET_GPR); /* This is either a 32 bit reg/reg mov which zeroes the hiword ** or a load of the loword from a 64 bit address. */ emit_mrm(as, XO_MOV, dest, left); } else { /* 32/32 bit no-op (cast). */ ra_left(as, dest, lref); /* Do nothing, but may need to move regs. */ } } } } static void asm_strto(ASMState *as, IRIns *ir) { /* Force a spill slot for the destination register (if any). */ const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_strscan_num]; IRRef args[2]; RegSet drop = RSET_SCRATCH; if ((drop & RSET_FPR) != RSET_FPR && ra_hasreg(ir->r)) rset_set(drop, ir->r); /* WIN64 doesn't spill all FPRs. */ ra_evictset(as, drop); asm_guardcc(as, CC_E); emit_rr(as, XO_TEST, RID_RET, RID_RET); /* Test return status. */ args[0] = ir->op1; /* GCstr *str */ args[1] = ASMREF_TMP1; /* TValue *n */ asm_gencall(as, ci, args); /* Store the result to the spill slot or temp slots. */ emit_rmro(as, XO_LEA, ra_releasetmp(as, ASMREF_TMP1)|REX_64, RID_ESP, sps_scale(ir->s)); } /* -- Memory references --------------------------------------------------- */ /* Get pointer to TValue. */ static void asm_tvptr(ASMState *as, Reg dest, IRRef ref) { IRIns *ir = IR(ref); if (irt_isnum(ir->t)) { /* For numbers use the constant itself or a spill slot as a TValue. */ if (irref_isk(ref)) emit_loada(as, dest, ir_knum(ir)); else emit_rmro(as, XO_LEA, dest|REX_64, RID_ESP, ra_spill(as, ir)); } else { /* Otherwise use g->tmptv to hold the TValue. */ if (irref_isk(ref)) { TValue k; lj_ir_kvalue(as->J->L, &k, ir); emit_movmroi(as, dest, 4, k.u32.hi); emit_movmroi(as, dest, 0, k.u32.lo); } else { /* TODO: 64 bit store + 32 bit load-modify-store is suboptimal. */ Reg src = ra_alloc1(as, ref, rset_exclude(RSET_GPR, dest)); if (irt_is64(ir->t)) { emit_u32(as, irt_toitype(ir->t) << 15); emit_rmro(as, XO_ARITHi, XOg_OR, dest, 4); } else { /* Currently, no caller passes integers that might end up here. */ emit_movmroi(as, dest, 4, (irt_toitype(ir->t) << 15)); } emit_movtomro(as, REX_64IR(ir, src), dest, 0); } emit_loada(as, dest, &J2G(as->J)->tmptv); } } static void asm_aref(ASMState *as, IRIns *ir) { Reg dest = ra_dest(as, ir, RSET_GPR); asm_fusearef(as, ir, RSET_GPR); if (!(as->mrm.idx == RID_NONE && as->mrm.ofs == 0)) emit_mrm(as, XO_LEA, dest|REX_GC64, RID_MRM); else if (as->mrm.base != dest) emit_rr(as, XO_MOV, dest|REX_GC64, as->mrm.base); } /* Inlined hash lookup. Specialized for key type and for const keys. ** The equivalent C code is: ** Node *n = hashkey(t, key); ** do { ** if (lj_obj_equal(&n->key, key)) return &n->val; ** } while ((n = nextnode(n))); ** return niltv(L); */ static void asm_href(ASMState *as, IRIns *ir, IROp merge) { RegSet allow = RSET_GPR; int destused = ra_used(ir); Reg dest = ra_dest(as, ir, allow); Reg tab = ra_alloc1(as, ir->op1, rset_clear(allow, dest)); Reg key = RID_NONE, tmp = RID_NONE; IRIns *irkey = IR(ir->op2); int isk = irref_isk(ir->op2); IRType1 kt = irkey->t; uint32_t khash; MCLabel l_end, l_loop, l_next; if (!isk) { rset_clear(allow, tab); key = ra_alloc1(as, ir->op2, irt_isnum(kt) ? RSET_FPR : allow); tmp = ra_scratch(as, rset_exclude(allow, key)); } /* Key not found in chain: jump to exit (if merged) or load niltv. */ l_end = emit_label(as); if (merge == IR_NE) asm_guardcc(as, CC_E); /* XI_JMP is not found by lj_asm_patchexit. */ else if (destused) emit_loada(as, dest, niltvg(J2G(as->J))); /* Follow hash chain until the end. */ l_loop = emit_sjcc_label(as, CC_NZ); emit_rr(as, XO_TEST, dest|REX_GC64, dest); emit_rmro(as, XO_MOV, dest|REX_GC64, dest, offsetof(Node, next)); l_next = emit_label(as); /* Type and value comparison. */ if (merge == IR_EQ) asm_guardcc(as, CC_E); else emit_sjcc(as, CC_E, l_end); if (irt_isnum(kt)) { if (isk) { /* Assumes -0.0 is already canonicalized to +0.0. */ emit_gmroi(as, XG_ARITHi(XOg_CMP), dest, offsetof(Node, key.u32.lo), (int32_t)ir_knum(irkey)->u32.lo); emit_sjcc(as, CC_NE, l_next); emit_gmroi(as, XG_ARITHi(XOg_CMP), dest, offsetof(Node, key.u32.hi), (int32_t)ir_knum(irkey)->u32.hi); } else { emit_sjcc(as, CC_P, l_next); emit_rmro(as, XO_UCOMISD, key, dest, offsetof(Node, key.n)); emit_sjcc(as, CC_AE, l_next); /* The type check avoids NaN penalties and complaints from Valgrind. */ emit_i8(as, LJ_TISNUM); emit_rmro(as, XO_ARITHi8, XOg_CMP, dest, offsetof(Node, key.it)); } } else if (irt_isaddr(kt)) { if (isk) { TValue k; k.u64 = ((uint64_t)irt_toitype(irkey->t) << 47) | irkey[1].tv.u64; emit_gmroi(as, XG_ARITHi(XOg_CMP), dest, offsetof(Node, key.u32.lo), k.u32.lo); emit_sjcc(as, CC_NE, l_next); emit_gmroi(as, XG_ARITHi(XOg_CMP), dest, offsetof(Node, key.u32.hi), k.u32.hi); } else { emit_rmro(as, XO_CMP, tmp|REX_64, dest, offsetof(Node, key.u64)); } } else { lua_assert(irt_ispri(kt) && !irt_isnil(kt)); emit_u32(as, (irt_toitype(kt)<<15)|0x7fff); emit_rmro(as, XO_ARITHi, XOg_CMP, dest, offsetof(Node, key.it)); } emit_sfixup(as, l_loop); checkmclim(as); if (!isk && irt_isaddr(kt)) { emit_rr(as, XO_OR, tmp|REX_64, key); emit_loadu64(as, tmp, (uint64_t)irt_toitype(kt) << 47); } /* Load main position relative to tab->node into dest. */ khash = isk ? ir_khash(irkey) : 1; if (khash == 0) { emit_rmro(as, XO_MOV, dest|REX_GC64, tab, offsetof(GCtab, node)); } else { emit_rmro(as, XO_ARITH(XOg_ADD), dest|REX_GC64, tab, offsetof(GCtab,node)); if ((as->flags & JIT_F_PREFER_IMUL)) { emit_i8(as, sizeof(Node)); emit_rr(as, XO_IMULi8, dest, dest); } else { emit_shifti(as, XOg_SHL, dest, 3); emit_rmrxo(as, XO_LEA, dest, dest, dest, XM_SCALE2, 0); } if (isk) { emit_gri(as, XG_ARITHi(XOg_AND), dest, (int32_t)khash); emit_rmro(as, XO_MOV, dest, tab, offsetof(GCtab, hmask)); } else if (irt_isstr(kt)) { emit_rmro(as, XO_ARITH(XOg_AND), dest, key, offsetof(GCstr, hash)); emit_rmro(as, XO_MOV, dest, tab, offsetof(GCtab, hmask)); } else { /* Must match with hashrot() in lj_tab.c. */ emit_rmro(as, XO_ARITH(XOg_AND), dest, tab, offsetof(GCtab, hmask)); emit_rr(as, XO_ARITH(XOg_SUB), dest, tmp); emit_shifti(as, XOg_ROL, tmp, HASH_ROT3); emit_rr(as, XO_ARITH(XOg_XOR), dest, tmp); emit_shifti(as, XOg_ROL, dest, HASH_ROT2); emit_rr(as, XO_ARITH(XOg_SUB), tmp, dest); emit_shifti(as, XOg_ROL, dest, HASH_ROT1); emit_rr(as, XO_ARITH(XOg_XOR), tmp, dest); if (irt_isnum(kt)) { emit_rr(as, XO_ARITH(XOg_ADD), dest, dest); emit_shifti(as, XOg_SHR|REX_64, dest, 32); emit_rr(as, XO_MOV, tmp, dest); emit_rr(as, XO_MOVDto, key|REX_64, dest); } else { emit_rr(as, XO_MOV, tmp, key); checkmclim(as); emit_gri(as, XG_ARITHi(XOg_XOR), dest, irt_toitype(kt) << 15); if ((as->flags & JIT_F_BMI2)) { emit_i8(as, 32); emit_mrm(as, XV_RORX|VEX_64, dest, key); } else { emit_shifti(as, XOg_SHR|REX_64, dest, 32); emit_rr(as, XO_MOV, dest|REX_64, key|REX_64); } } } } } static void asm_hrefk(ASMState *as, IRIns *ir) { IRIns *kslot = IR(ir->op2); IRIns *irkey = IR(kslot->op1); int32_t ofs = (int32_t)(kslot->op2 * sizeof(Node)); Reg dest = ra_used(ir) ? ra_dest(as, ir, RSET_GPR) : RID_NONE; Reg node = ra_alloc1(as, ir->op1, RSET_GPR); lua_assert(ofs % sizeof(Node) == 0); if (ra_hasreg(dest)) { if (ofs != 0) { if (dest == node && !(as->flags & JIT_F_LEA_AGU)) emit_gri(as, XG_ARITHi(XOg_ADD), dest|REX_GC64, ofs); else emit_rmro(as, XO_LEA, dest|REX_GC64, node, ofs); } else if (dest != node) { emit_rr(as, XO_MOV, dest|REX_GC64, node); } } asm_guardcc(as, CC_NE); if (!irt_ispri(irkey->t)) { Reg key = ra_scratch(as, rset_exclude(RSET_GPR, node)); emit_rmro(as, XO_CMP, key|REX_64, node, ofs + (int32_t)offsetof(Node, key.u64)); lua_assert(irt_isnum(irkey->t) || irt_isgcv(irkey->t)); /* Assumes -0.0 is already canonicalized to +0.0. */ emit_loadu64(as, key, irt_isnum(irkey->t) ? ir_knum(irkey)->u64 : ((uint64_t)irt_toitype(irkey->t) << 47) | (uint64_t)ir_kgc(irkey)); } else { lua_assert(!irt_isnil(irkey->t)); emit_i32(as, (irt_toitype(irkey->t)<<15)|0x7fff); emit_rmro(as, XO_ARITHi, XOg_CMP, node, ofs + (int32_t)offsetof(Node, key.it)); } } static void asm_uref(ASMState *as, IRIns *ir) { Reg dest = ra_dest(as, ir, RSET_GPR); if (irref_isk(ir->op1)) { GCfunc *fn = ir_kfunc(IR(ir->op1)); MRef *v = &gcref(fn->l.uvptr[(ir->op2 >> 8)])->uv.v; emit_rma(as, XO_MOV, dest|REX_GC64, v); } else { Reg uv = ra_scratch(as, RSET_GPR); Reg func = ra_alloc1(as, ir->op1, RSET_GPR); if (ir->o == IR_UREFC) { emit_rmro(as, XO_LEA, dest|REX_GC64, uv, offsetof(GCupval, tv)); asm_guardcc(as, CC_NE); emit_i8(as, 1); emit_rmro(as, XO_ARITHib, XOg_CMP, uv, offsetof(GCupval, closed)); } else { emit_rmro(as, XO_MOV, dest|REX_GC64, uv, offsetof(GCupval, v)); } emit_rmro(as, XO_MOV, uv|REX_GC64, func, (int32_t)offsetof(GCfuncL, uvptr) + (int32_t)sizeof(MRef) * (int32_t)(ir->op2 >> 8)); } } static void asm_fref(ASMState *as, IRIns *ir) { Reg dest = ra_dest(as, ir, RSET_GPR); asm_fusefref(as, ir, RSET_GPR); emit_mrm(as, XO_LEA, dest, RID_MRM); } static void asm_strref(ASMState *as, IRIns *ir) { Reg dest = ra_dest(as, ir, RSET_GPR); asm_fusestrref(as, ir, RSET_GPR); if (as->mrm.base == RID_NONE) emit_loadi(as, dest, as->mrm.ofs); else if (as->mrm.base == dest && as->mrm.idx == RID_NONE) emit_gri(as, XG_ARITHi(XOg_ADD), dest|REX_GC64, as->mrm.ofs); else emit_mrm(as, XO_LEA, dest|REX_GC64, RID_MRM); } /* -- Loads and stores ---------------------------------------------------- */ static void asm_fxload(ASMState *as, IRIns *ir) { Reg dest = ra_dest(as, ir, irt_isfp(ir->t) ? RSET_FPR : RSET_GPR); x86Op xo; if (ir->o == IR_FLOAD) asm_fusefref(as, ir, RSET_GPR); else asm_fusexref(as, ir->op1, RSET_GPR); /* ir->op2 is ignored -- unaligned loads are ok on x86. */ switch (irt_type(ir->t)) { case IRT_I8: xo = XO_MOVSXb; break; case IRT_U8: xo = XO_MOVZXb; break; case IRT_I16: xo = XO_MOVSXw; break; case IRT_U16: xo = XO_MOVZXw; break; case IRT_NUM: xo = XO_MOVSD; break; case IRT_FLOAT: xo = XO_MOVSS; break; default: if (irt_is64(ir->t)) dest |= REX_64; else lua_assert(irt_isint(ir->t) || irt_isu32(ir->t) || irt_isaddr(ir->t)); xo = XO_MOV; break; } emit_mrm(as, xo, dest, RID_MRM); } #define asm_fload(as, ir) asm_fxload(as, ir) #define asm_xload(as, ir) asm_fxload(as, ir) static void asm_fxstore(ASMState *as, IRIns *ir) { RegSet allow = RSET_GPR; Reg src = RID_NONE, osrc = RID_NONE; int32_t k = 0; if (ir->r == RID_SINK) return; /* The IRT_I16/IRT_U16 stores should never be simplified for constant ** values since mov word [mem], imm16 has a length-changing prefix. */ if (irt_isi16(ir->t) || irt_isu16(ir->t) || irt_isfp(ir->t) || !asm_isk32(as, ir->op2, &k)) { RegSet allow8 = irt_isfp(ir->t) ? RSET_FPR : (irt_isi8(ir->t) || irt_isu8(ir->t)) ? RSET_GPR8 : RSET_GPR; src = osrc = ra_alloc1(as, ir->op2, allow8); rset_clear(allow, src); } if (ir->o == IR_FSTORE) { asm_fusefref(as, IR(ir->op1), allow); } else { asm_fusexref(as, ir->op1, allow); } if (ra_hasreg(src)) { x86Op xo; switch (irt_type(ir->t)) { case IRT_I8: case IRT_U8: xo = XO_MOVtob; src |= FORCE_REX; break; case IRT_I16: case IRT_U16: xo = XO_MOVtow; break; case IRT_NUM: xo = XO_MOVSDto; break; case IRT_FLOAT: xo = XO_MOVSSto; break; default: if (irt_is64(ir->t)) src |= REX_64; else lua_assert(irt_isint(ir->t) || irt_isu32(ir->t) || irt_isaddr(ir->t)); xo = XO_MOVto; break; } emit_mrm(as, xo, src, RID_MRM); } else { if (irt_isi8(ir->t) || irt_isu8(ir->t)) { emit_i8(as, k); emit_mrm(as, XO_MOVmib, 0, RID_MRM); } else { lua_assert(irt_is64(ir->t) || irt_isint(ir->t) || irt_isu32(ir->t) || irt_isaddr(ir->t)); emit_i32(as, k); emit_mrm(as, XO_MOVmi, REX_64IR(ir, 0), RID_MRM); } } } #define asm_fstore(as, ir) asm_fxstore(as, ir) #define asm_xstore(as, ir) asm_fxstore(as, ir) static void asm_ahuvload(ASMState *as, IRIns *ir) { Reg tmp = RID_NONE; lua_assert(irt_isnum(ir->t) || irt_ispri(ir->t) || irt_isaddr(ir->t)); if (ra_used(ir)) { RegSet allow = irt_isnum(ir->t) ? RSET_FPR : RSET_GPR; Reg dest = ra_dest(as, ir, allow); asm_fuseahuref(as, ir->op1, RSET_GPR); if (irt_isaddr(ir->t)) { emit_shifti(as, XOg_SHR|REX_64, dest, 17); asm_guardcc(as, CC_NE); emit_i8(as, irt_toitype(ir->t)); emit_rr(as, XO_ARITHi8, XOg_CMP, dest); emit_i8(as, XI_O16); if ((as->flags & JIT_F_BMI2)) { emit_i8(as, 47); emit_mrm(as, XV_RORX|VEX_64, dest, RID_MRM); } else { emit_shifti(as, XOg_ROR|REX_64, dest, 47); emit_mrm(as, XO_MOV, dest|REX_64, RID_MRM); } return; } else emit_mrm(as, dest < RID_MAX_GPR ? XO_MOV : XO_MOVSD, dest, RID_MRM); } else { RegSet gpr = RSET_GPR; if (irt_isaddr(ir->t)) { tmp = ra_scratch(as, RSET_GPR); gpr = rset_exclude(gpr, tmp); } asm_fuseahuref(as, ir->op1, gpr); } /* Always do the type check, even if the load result is unused. */ as->mrm.ofs += 4; asm_guardcc(as, irt_isnum(ir->t) ? CC_AE : CC_NE); if (irt_type(ir->t) >= IRT_NUM) { lua_assert(irt_isinteger(ir->t) || irt_isnum(ir->t)); emit_u32(as, LJ_TISNUM << 15); emit_mrm(as, XO_ARITHi, XOg_CMP, RID_MRM); } else if (irt_isaddr(ir->t)) { as->mrm.ofs -= 4; emit_i8(as, irt_toitype(ir->t)); emit_mrm(as, XO_ARITHi8, XOg_CMP, tmp); emit_shifti(as, XOg_SAR|REX_64, tmp, 47); emit_mrm(as, XO_MOV, tmp|REX_64, RID_MRM); } else if (irt_isnil(ir->t)) { as->mrm.ofs -= 4; emit_i8(as, -1); emit_mrm(as, XO_ARITHi8, XOg_CMP|REX_64, RID_MRM); } else { emit_u32(as, (irt_toitype(ir->t) << 15) | 0x7fff); emit_mrm(as, XO_ARITHi, XOg_CMP, RID_MRM); } } static void asm_ahustore(ASMState *as, IRIns *ir) { if (ir->r == RID_SINK) return; if (irt_isnum(ir->t)) { Reg src = ra_alloc1(as, ir->op2, RSET_FPR); asm_fuseahuref(as, ir->op1, RSET_GPR); emit_mrm(as, XO_MOVSDto, src, RID_MRM); } else if (irref_isk(ir->op2)) { TValue k; lj_ir_kvalue(as->J->L, &k, IR(ir->op2)); asm_fuseahuref(as, ir->op1, RSET_GPR); if (tvisnil(&k)) { emit_i32(as, -1); emit_mrm(as, XO_MOVmi, REX_64, RID_MRM); } else { emit_u32(as, k.u32.lo); emit_mrm(as, XO_MOVmi, 0, RID_MRM); as->mrm.ofs += 4; emit_u32(as, k.u32.hi); emit_mrm(as, XO_MOVmi, 0, RID_MRM); } } else { IRIns *irr = IR(ir->op2); RegSet allow = RSET_GPR; Reg src = RID_NONE; if (!irref_isk(ir->op2)) { src = ra_alloc1(as, ir->op2, allow); rset_clear(allow, src); } asm_fuseahuref(as, ir->op1, allow); if (ra_hasreg(src)) { /* TODO: 64 bit store + 32 bit load-modify-store is suboptimal. */ as->mrm.ofs += 4; emit_u32(as, irt_toitype(ir->t) << 15); emit_mrm(as, XO_ARITHi, XOg_OR, RID_MRM); as->mrm.ofs -= 4; emit_mrm(as, XO_MOVto, src|REX_64, RID_MRM); } else { lua_assert(!irt_ispri(irr->t) && irt_isaddr(ir->t)); emit_i32(as, irr->i); emit_mrm(as, XO_MOVmi, 0, RID_MRM); } } } static void asm_sload(ASMState *as, IRIns *ir) { int32_t ofs = 8*((int32_t)ir->op1-1-LJ_FR2) + (!LJ_FR2 && (ir->op2 & IRSLOAD_FRAME) ? 4 : 0); IRType1 t = ir->t; Reg base; lua_assert(!(ir->op2 & IRSLOAD_PARENT)); /* Handled by asm_head_side(). */ lua_assert(irt_isguard(t) || !(ir->op2 & IRSLOAD_TYPECHECK)); lua_assert(!irt_isint(t) || (ir->op2 & (IRSLOAD_CONVERT|IRSLOAD_FRAME))); if ((ir->op2 & IRSLOAD_CONVERT) && irt_isguard(t) && irt_isint(t)) { Reg left = ra_scratch(as, RSET_FPR); asm_tointg(as, ir, left); /* Frees dest reg. Do this before base alloc. */ base = ra_alloc1(as, REF_BASE, RSET_GPR); emit_rmro(as, XO_MOVSD, left, base, ofs); t.irt = IRT_NUM; /* Continue with a regular number type check. */ } else if (ra_used(ir)) { RegSet allow = irt_isnum(t) ? RSET_FPR : RSET_GPR; Reg dest = ra_dest(as, ir, allow); base = ra_alloc1(as, REF_BASE, RSET_GPR); lua_assert(irt_isnum(t) || irt_isint(t) || irt_isaddr(t)); if ((ir->op2 & IRSLOAD_CONVERT)) { t.irt = irt_isint(t) ? IRT_NUM : IRT_INT; /* Check for original type. */ emit_rmro(as, irt_isint(t) ? XO_CVTSI2SD : XO_CVTTSD2SI, dest, base, ofs); } else { if (irt_isaddr(t)) { /* LJ_GC64 type check + tag removal without BMI2 and with BMI2: ** ** mov r64, [addr] rorx r64, [addr], 47 ** ror r64, 47 ** cmp r16, itype cmp r16, itype ** jne ->exit jne ->exit ** shr r64, 16 shr r64, 16 */ emit_shifti(as, XOg_SHR|REX_64, dest, 17); if ((ir->op2 & IRSLOAD_TYPECHECK)) { asm_guardcc(as, CC_NE); emit_i8(as, irt_toitype(t)); emit_rr(as, XO_ARITHi8, XOg_CMP, dest); emit_i8(as, XI_O16); } if ((as->flags & JIT_F_BMI2)) { emit_i8(as, 47); emit_rmro(as, XV_RORX|VEX_64, dest, base, ofs); } else { if ((ir->op2 & IRSLOAD_TYPECHECK)) emit_shifti(as, XOg_ROR|REX_64, dest, 47); else emit_shifti(as, XOg_SHL|REX_64, dest, 17); emit_rmro(as, XO_MOV, dest|REX_64, base, ofs); } return; } else emit_rmro(as, irt_isnum(t) ? XO_MOVSD : XO_MOV, dest, base, ofs); } } else { if (!(ir->op2 & IRSLOAD_TYPECHECK)) return; /* No type check: avoid base alloc. */ base = ra_alloc1(as, REF_BASE, RSET_GPR); } if ((ir->op2 & IRSLOAD_TYPECHECK)) { /* Need type check, even if the load result is unused. */ asm_guardcc(as, irt_isnum(t) ? CC_AE : CC_NE); if (irt_type(t) >= IRT_NUM) { lua_assert(irt_isinteger(t) || irt_isnum(t)); emit_u32(as, LJ_TISNUM << 15); emit_rmro(as, XO_ARITHi, XOg_CMP, base, ofs+4); } else if (irt_isnil(t)) { /* LJ_GC64 type check for nil: ** ** cmp qword [addr], -1 ** jne ->exit */ emit_i8(as, -1); emit_rmro(as, XO_ARITHi8, XOg_CMP|REX_64, base, ofs); } else if (irt_ispri(t)) { emit_u32(as, (irt_toitype(t) << 15) | 0x7fff); emit_rmro(as, XO_ARITHi, XOg_CMP, base, ofs+4); } else { /* LJ_GC64 type check only: ** ** mov r64, [addr] ** sar r64, 47 ** cmp r32, itype ** jne ->exit */ Reg tmp = ra_scratch(as, rset_exclude(RSET_GPR, base)); emit_i8(as, irt_toitype(t)); emit_rr(as, XO_ARITHi8, XOg_CMP, tmp); emit_shifti(as, XOg_SAR|REX_64, tmp, 47); emit_rmro(as, XO_MOV, tmp|REX_64, base, ofs); } } } /* -- Allocations --------------------------------------------------------- */ static void asm_cnew(ASMState *as, IRIns *ir) { CTState *cts = ctype_ctsG(J2G(as->J)); CTypeID id = (CTypeID)IR(ir->op1)->i; CTSize sz; CTInfo info = lj_ctype_info(cts, id, &sz); const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_mem_newgco]; IRRef args[4]; lua_assert(sz != CTSIZE_INVALID || (ir->o == IR_CNEW && ir->op2 != REF_NIL)); as->gcsteps++; asm_setupresult(as, ir, ci); /* GCcdata * */ /* Initialize immutable cdata object. */ if (ir->o == IR_CNEWI) { RegSet allow = (RSET_GPR & ~RSET_SCRATCH); Reg r64 = sz == 8 ? REX_64 : 0; if (irref_isk(ir->op2)) { IRIns *irk = IR(ir->op2); uint64_t k = (irk->o == IR_KINT64 || irk->o == IR_KPTR || irk->o == IR_KKPTR) ? ir_k64(irk)->u64 : (uint64_t)(uint32_t)irk->i; if (sz == 4 || checki32((int64_t)k)) { emit_i32(as, (int32_t)k); emit_rmro(as, XO_MOVmi, r64, RID_RET, sizeof(GCcdata)); } else { emit_movtomro(as, RID_ECX + r64, RID_RET, sizeof(GCcdata)); emit_loadu64(as, RID_ECX, k); } } else { Reg r = ra_alloc1(as, ir->op2, allow); emit_movtomro(as, r + r64, RID_RET, sizeof(GCcdata)); } lua_assert(sz == 4 || sz == 8); } else if (ir->op2 != REF_NIL) { /* Create VLA/VLS/aligned cdata. */ ci = &lj_ir_callinfo[IRCALL_lj_cdata_newv]; args[0] = ASMREF_L; /* lua_State *L */ args[1] = ir->op1; /* CTypeID id */ args[2] = ir->op2; /* CTSize sz */ args[3] = ASMREF_TMP1; /* CTSize align */ asm_gencall(as, ci, args); emit_loadi(as, ra_releasetmp(as, ASMREF_TMP1), (int32_t)ctype_align(info)); return; } /* Combine initialization of marked, gct and ctypeid. */ emit_movtomro(as, RID_ECX, RID_RET, offsetof(GCcdata, marked)); emit_gri(as, XG_ARITHi(XOg_OR), RID_ECX, (int32_t)((~LJ_TCDATA<<8)+(id<<16))); emit_gri(as, XG_ARITHi(XOg_AND), RID_ECX, LJ_GC_WHITES); emit_opgl(as, XO_MOVZXb, RID_ECX, gc.currentwhite); args[0] = ASMREF_L; /* lua_State *L */ args[1] = ASMREF_TMP1; /* MSize size */ asm_gencall(as, ci, args); emit_loadi(as, ra_releasetmp(as, ASMREF_TMP1), (int32_t)(sz+sizeof(GCcdata))); } /* -- Write barriers ------------------------------------------------------ */ static void asm_tbar(ASMState *as, IRIns *ir) { Reg tab = ra_alloc1(as, ir->op1, RSET_GPR); Reg tmp = ra_scratch(as, rset_exclude(RSET_GPR, tab)); MCLabel l_end = emit_label(as); emit_movtomro(as, tmp|REX_GC64, tab, offsetof(GCtab, gclist)); emit_setgl(as, tab, gc.grayagain); emit_getgl(as, tmp, gc.grayagain); emit_i8(as, ~LJ_GC_BLACK); emit_rmro(as, XO_ARITHib, XOg_AND, tab, offsetof(GCtab, marked)); emit_sjcc(as, CC_Z, l_end); emit_i8(as, LJ_GC_BLACK); emit_rmro(as, XO_GROUP3b, XOg_TEST, tab, offsetof(GCtab, marked)); } static void asm_obar(ASMState *as, IRIns *ir) { const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_gc_barrieruv]; IRRef args[2]; MCLabel l_end; Reg obj; /* No need for other object barriers (yet). */ lua_assert(IR(ir->op1)->o == IR_UREFC); ra_evictset(as, RSET_SCRATCH); l_end = emit_label(as); args[0] = ASMREF_TMP1; /* global_State *g */ args[1] = ir->op1; /* TValue *tv */ asm_gencall(as, ci, args); emit_loada(as, ra_releasetmp(as, ASMREF_TMP1), J2G(as->J)); obj = IR(ir->op1)->r; emit_sjcc(as, CC_Z, l_end); emit_i8(as, LJ_GC_WHITES); if (irref_isk(ir->op2)) { GCobj *vp = ir_kgc(IR(ir->op2)); emit_rma(as, XO_GROUP3b, XOg_TEST, &vp->gch.marked); } else { Reg val = ra_alloc1(as, ir->op2, rset_exclude(RSET_SCRATCH&RSET_GPR, obj)); emit_rmro(as, XO_GROUP3b, XOg_TEST, val, (int32_t)offsetof(GChead, marked)); } emit_sjcc(as, CC_Z, l_end); emit_i8(as, LJ_GC_BLACK); emit_rmro(as, XO_GROUP3b, XOg_TEST, obj, (int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv)); } /* -- FP/int arithmetic and logic operations ------------------------------ */ /* Load reference onto x87 stack. Force a spill to memory if needed. */ static void asm_x87load(ASMState *as, IRRef ref) { IRIns *ir = IR(ref); if (ir->o == IR_KNUM) { cTValue *tv = ir_knum(ir); if (tvispzero(tv)) /* Use fldz only for +0. */ emit_x87op(as, XI_FLDZ); else if (tvispone(tv)) emit_x87op(as, XI_FLD1); else emit_rma(as, XO_FLDq, XOg_FLDq, tv); } else if (ir->o == IR_CONV && ir->op2 == IRCONV_NUM_INT && !ra_used(ir) && !irref_isk(ir->op1) && mayfuse(as, ir->op1)) { IRIns *iri = IR(ir->op1); emit_rmro(as, XO_FILDd, XOg_FILDd, RID_ESP, ra_spill(as, iri)); } else { emit_mrm(as, XO_FLDq, XOg_FLDq, asm_fuseload(as, ref, RSET_EMPTY)); } } static void asm_fpmath(ASMState *as, IRIns *ir) { IRFPMathOp fpm = (IRFPMathOp)ir->op2; if (fpm == IRFPM_SQRT) { Reg dest = ra_dest(as, ir, RSET_FPR); Reg left = asm_fuseload(as, ir->op1, RSET_FPR); emit_mrm(as, XO_SQRTSD, dest, left); } else if (fpm <= IRFPM_TRUNC) { if (as->flags & JIT_F_SSE4_1) { /* SSE4.1 has a rounding instruction. */ Reg dest = ra_dest(as, ir, RSET_FPR); Reg left = asm_fuseload(as, ir->op1, RSET_FPR); /* ROUNDSD has a 4-byte opcode which doesn't fit in x86Op. ** Let's pretend it's a 3-byte opcode, and compensate afterwards. ** This is atrocious, but the alternatives are much worse. */ /* Round down/up/trunc == 1001/1010/1011. */ emit_i8(as, 0x09 + fpm); emit_mrm(as, XO_ROUNDSD, dest, left); if (as->mcp[1] != (MCode)(XO_ROUNDSD >> 16)) { as->mcp[0] = as->mcp[1]; as->mcp[1] = 0x0f; /* Swap 0F and REX. */ } *--as->mcp = 0x66; /* 1st byte of ROUNDSD opcode. */ } else { /* Call helper functions for SSE2 variant. */ /* The modified regs must match with the *.dasc implementation. */ RegSet drop = RSET_RANGE(RID_XMM0, RID_XMM3+1)|RID2RSET(RID_EAX); if (ra_hasreg(ir->r)) rset_clear(drop, ir->r); /* Dest reg handled below. */ ra_evictset(as, drop); ra_destreg(as, ir, RID_XMM0); emit_call(as, fpm == IRFPM_FLOOR ? lj_vm_floor_sse : fpm == IRFPM_CEIL ? lj_vm_ceil_sse : lj_vm_trunc_sse); ra_left(as, RID_XMM0, ir->op1); } } else if (fpm == IRFPM_EXP2 && asm_fpjoin_pow(as, ir)) { /* Rejoined to pow(). */ } else { asm_callid(as, ir, IRCALL_lj_vm_floor + fpm); } } #define asm_atan2(as, ir) asm_callid(as, ir, IRCALL_atan2) static void asm_ldexp(ASMState *as, IRIns *ir) { int32_t ofs = sps_scale(ir->s); /* Use spill slot or temp slots. */ Reg dest = ir->r; if (ra_hasreg(dest)) { ra_free(as, dest); ra_modified(as, dest); emit_rmro(as, XO_MOVSD, dest, RID_ESP, ofs); } emit_rmro(as, XO_FSTPq, XOg_FSTPq, RID_ESP, ofs); emit_x87op(as, XI_FPOP1); emit_x87op(as, XI_FSCALE); asm_x87load(as, ir->op1); asm_x87load(as, ir->op2); } static void asm_fppowi(ASMState *as, IRIns *ir) { /* The modified regs must match with the *.dasc implementation. */ RegSet drop = RSET_RANGE(RID_XMM0, RID_XMM1+1)|RID2RSET(RID_EAX); if (ra_hasreg(ir->r)) rset_clear(drop, ir->r); /* Dest reg handled below. */ ra_evictset(as, drop); ra_destreg(as, ir, RID_XMM0); emit_call(as, lj_vm_powi_sse); ra_left(as, RID_XMM0, ir->op1); ra_left(as, RID_EAX, ir->op2); } static void asm_pow(ASMState *as, IRIns *ir) { if (!irt_isnum(ir->t)) asm_callid(as, ir, irt_isi64(ir->t) ? IRCALL_lj_carith_powi64 : IRCALL_lj_carith_powu64); else asm_fppowi(as, ir); } static int asm_swapops(ASMState *as, IRIns *ir) { IRIns *irl = IR(ir->op1); IRIns *irr = IR(ir->op2); lua_assert(ra_noreg(irr->r)); if (!irm_iscomm(lj_ir_mode[ir->o])) return 0; /* Can't swap non-commutative operations. */ if (irref_isk(ir->op2)) return 0; /* Don't swap constants to the left. */ if (ra_hasreg(irl->r)) return 1; /* Swap if left already has a register. */ if (ra_samehint(ir->r, irr->r)) return 1; /* Swap if dest and right have matching hints. */ if (as->curins > as->loopref) { /* In variant part? */ if (ir->op2 < as->loopref && !irt_isphi(irr->t)) return 0; /* Keep invariants on the right. */ if (ir->op1 < as->loopref && !irt_isphi(irl->t)) return 1; /* Swap invariants to the right. */ } if (opisfusableload(irl->o)) return 1; /* Swap fusable loads to the right. */ return 0; /* Otherwise don't swap. */ } static void asm_fparith(ASMState *as, IRIns *ir, x86Op xo) { IRRef lref = ir->op1; IRRef rref = ir->op2; RegSet allow = RSET_FPR; Reg dest; Reg right = IR(rref)->r; if (ra_hasreg(right)) { rset_clear(allow, right); ra_noweak(as, right); } dest = ra_dest(as, ir, allow); if (lref == rref) { right = dest; } else if (ra_noreg(right)) { if (asm_swapops(as, ir)) { IRRef tmp = lref; lref = rref; rref = tmp; } right = asm_fuseload(as, rref, rset_clear(allow, dest)); } emit_mrm(as, xo, dest, right); ra_left(as, dest, lref); } static void asm_intarith(ASMState *as, IRIns *ir, x86Arith xa) { IRRef lref = ir->op1; IRRef rref = ir->op2; RegSet allow = RSET_GPR; Reg dest, right; int32_t k = 0; if (as->flagmcp == as->mcp) { /* Drop test r,r instruction. */ MCode *p = as->mcp + ((*as->mcp < XI_TESTb) ? 3 : 2); if ((p[1] & 15) < 14) { if ((p[1] & 15) >= 12) p[1] -= 4; /* L <->S, NL <-> NS */ as->flagmcp = NULL; as->mcp = p; } /* else: cannot transform LE/NLE to cc without use of OF. */ } right = IR(rref)->r; if (ra_hasreg(right)) { rset_clear(allow, right); ra_noweak(as, right); } dest = ra_dest(as, ir, allow); if (lref == rref) { right = dest; } else if (ra_noreg(right) && !asm_isk32(as, rref, &k)) { if (asm_swapops(as, ir)) { IRRef tmp = lref; lref = rref; rref = tmp; } right = asm_fuseloadm(as, rref, rset_clear(allow, dest), irt_is64(ir->t)); } if (irt_isguard(ir->t)) /* For IR_ADDOV etc. */ asm_guardcc(as, CC_O); if (xa != XOg_X_IMUL) { if (ra_hasreg(right)) emit_mrm(as, XO_ARITH(xa), REX_64IR(ir, dest), right); else emit_gri(as, XG_ARITHi(xa), REX_64IR(ir, dest), k); } else if (ra_hasreg(right)) { /* IMUL r, mrm. */ emit_mrm(as, XO_IMUL, REX_64IR(ir, dest), right); } else { /* IMUL r, r, k. */ /* NYI: use lea/shl/add/sub (FOLD only does 2^k) depending on CPU. */ Reg left = asm_fuseloadm(as, lref, RSET_GPR, irt_is64(ir->t)); x86Op xo; if (checki8(k)) { emit_i8(as, k); xo = XO_IMULi8; } else { emit_i32(as, k); xo = XO_IMULi; } emit_mrm(as, xo, REX_64IR(ir, dest), left); return; } ra_left(as, dest, lref); } /* LEA is really a 4-operand ADD with an independent destination register, ** up to two source registers and an immediate. One register can be scaled ** by 1, 2, 4 or 8. This can be used to avoid moves or to fuse several ** instructions. ** ** Currently only a few common cases are supported: ** - 3-operand ADD: y = a+b; y = a+k with a and b already allocated ** - Left ADD fusion: y = (a+b)+k; y = (a+k)+b ** - Right ADD fusion: y = a+(b+k) ** The ommited variants have already been reduced by FOLD. ** ** There are more fusion opportunities, like gathering shifts or joining ** common references. But these are probably not worth the trouble, since ** array indexing is not decomposed and already makes use of all fields ** of the ModRM operand. */ static int asm_lea(ASMState *as, IRIns *ir) { IRIns *irl = IR(ir->op1); IRIns *irr = IR(ir->op2); RegSet allow = RSET_GPR; Reg dest; as->mrm.base = as->mrm.idx = RID_NONE; as->mrm.scale = XM_SCALE1; as->mrm.ofs = 0; if (ra_hasreg(irl->r)) { rset_clear(allow, irl->r); ra_noweak(as, irl->r); as->mrm.base = irl->r; if (irref_isk(ir->op2) || ra_hasreg(irr->r)) { /* The PHI renaming logic does a better job in some cases. */ if (ra_hasreg(ir->r) && ((irt_isphi(irl->t) && as->phireg[ir->r] == ir->op1) || (irt_isphi(irr->t) && as->phireg[ir->r] == ir->op2))) return 0; if (irref_isk(ir->op2)) { as->mrm.ofs = irr->i; } else { rset_clear(allow, irr->r); ra_noweak(as, irr->r); as->mrm.idx = irr->r; } } else if (irr->o == IR_ADD && mayfuse(as, ir->op2) && irref_isk(irr->op2)) { Reg idx = ra_alloc1(as, irr->op1, allow); rset_clear(allow, idx); as->mrm.idx = (uint8_t)idx; as->mrm.ofs = IR(irr->op2)->i; } else { return 0; } } else { return 0; } dest = ra_dest(as, ir, allow); emit_mrm(as, XO_LEA, dest, RID_MRM); return 1; /* Success. */ } static void asm_add(ASMState *as, IRIns *ir) { if (irt_isnum(ir->t)) asm_fparith(as, ir, XO_ADDSD); else if ((as->flags & JIT_F_LEA_AGU) || as->flagmcp == as->mcp || irt_is64(ir->t) || !asm_lea(as, ir)) asm_intarith(as, ir, XOg_ADD); } static void asm_sub(ASMState *as, IRIns *ir) { if (irt_isnum(ir->t)) asm_fparith(as, ir, XO_SUBSD); else /* Note: no need for LEA trick here. i-k is encoded as i+(-k). */ asm_intarith(as, ir, XOg_SUB); } static void asm_mul(ASMState *as, IRIns *ir) { if (irt_isnum(ir->t)) asm_fparith(as, ir, XO_MULSD); else asm_intarith(as, ir, XOg_X_IMUL); } static void asm_div(ASMState *as, IRIns *ir) { if (!irt_isnum(ir->t)) asm_callid(as, ir, irt_isi64(ir->t) ? IRCALL_lj_carith_divi64 : IRCALL_lj_carith_divu64); else asm_fparith(as, ir, XO_DIVSD); } static void asm_mod(ASMState *as, IRIns *ir) { if (!irt_isint(ir->t)) asm_callid(as, ir, irt_isi64(ir->t) ? IRCALL_lj_carith_modi64 : IRCALL_lj_carith_modu64); else asm_callid(as, ir, IRCALL_lj_vm_modi); } static void asm_neg_not(ASMState *as, IRIns *ir, x86Group3 xg) { Reg dest = ra_dest(as, ir, RSET_GPR); emit_rr(as, XO_GROUP3, REX_64IR(ir, xg), dest); ra_left(as, dest, ir->op1); } static void asm_neg(ASMState *as, IRIns *ir) { if (irt_isnum(ir->t)) asm_fparith(as, ir, XO_XORPS); else asm_neg_not(as, ir, XOg_NEG); } #define asm_abs(as, ir) asm_fparith(as, ir, XO_ANDPS) static void asm_intmin_max(ASMState *as, IRIns *ir, int cc) { Reg right, dest = ra_dest(as, ir, RSET_GPR); IRRef lref = ir->op1, rref = ir->op2; if (irref_isk(rref)) { lref = rref; rref = ir->op1; } right = ra_alloc1(as, rref, rset_exclude(RSET_GPR, dest)); emit_rr(as, XO_CMOV + (cc<<24), REX_64IR(ir, dest), right); emit_rr(as, XO_CMP, REX_64IR(ir, dest), right); ra_left(as, dest, lref); } static void asm_min(ASMState *as, IRIns *ir) { if (irt_isnum(ir->t)) asm_fparith(as, ir, XO_MINSD); else asm_intmin_max(as, ir, CC_G); } static void asm_max(ASMState *as, IRIns *ir) { if (irt_isnum(ir->t)) asm_fparith(as, ir, XO_MAXSD); else asm_intmin_max(as, ir, CC_L); } /* Note: don't use LEA for overflow-checking arithmetic! */ #define asm_addov(as, ir) asm_intarith(as, ir, XOg_ADD) #define asm_subov(as, ir) asm_intarith(as, ir, XOg_SUB) #define asm_mulov(as, ir) asm_intarith(as, ir, XOg_X_IMUL) #define asm_bnot(as, ir) asm_neg_not(as, ir, XOg_NOT) static void asm_bswap(ASMState *as, IRIns *ir) { Reg dest = ra_dest(as, ir, RSET_GPR); as->mcp = emit_op(XO_BSWAP + ((dest&7) << 24), REX_64IR(ir, 0), dest, 0, as->mcp, 1); ra_left(as, dest, ir->op1); } #define asm_band(as, ir) asm_intarith(as, ir, XOg_AND) #define asm_bor(as, ir) asm_intarith(as, ir, XOg_OR) #define asm_bxor(as, ir) asm_intarith(as, ir, XOg_XOR) static void asm_bitshift(ASMState *as, IRIns *ir, x86Shift xs, x86Op xv) { IRRef rref = ir->op2; IRIns *irr = IR(rref); Reg dest; if (irref_isk(rref)) { /* Constant shifts. */ int shift; dest = ra_dest(as, ir, RSET_GPR); shift = irr->i & (irt_is64(ir->t) ? 63 : 31); if (!xv && shift && (as->flags & JIT_F_BMI2)) { Reg left = asm_fuseloadm(as, ir->op1, RSET_GPR, irt_is64(ir->t)); if (left != dest) { /* BMI2 rotate right by constant. */ emit_i8(as, xs == XOg_ROL ? -shift : shift); emit_mrm(as, VEX_64IR(ir, XV_RORX), dest, left); return; } } switch (shift) { case 0: break; case 1: emit_rr(as, XO_SHIFT1, REX_64IR(ir, xs), dest); break; default: emit_shifti(as, REX_64IR(ir, xs), dest, shift); break; } } else if ((as->flags & JIT_F_BMI2) && xv) { /* BMI2 variable shifts. */ Reg left, right; dest = ra_dest(as, ir, RSET_GPR); right = ra_alloc1(as, rref, RSET_GPR); left = asm_fuseloadm(as, ir->op1, rset_exclude(RSET_GPR, right), irt_is64(ir->t)); emit_mrm(as, VEX_64IR(ir, xv) ^ (right << 19), dest, left); return; } else { /* Variable shifts implicitly use register cl (i.e. ecx). */ Reg right; dest = ra_dest(as, ir, rset_exclude(RSET_GPR, RID_ECX)); if (dest == RID_ECX) { dest = ra_scratch(as, rset_exclude(RSET_GPR, RID_ECX)); emit_rr(as, XO_MOV, RID_ECX, dest); } right = irr->r; if (ra_noreg(right)) right = ra_allocref(as, rref, RID2RSET(RID_ECX)); else if (right != RID_ECX) ra_scratch(as, RID2RSET(RID_ECX)); emit_rr(as, XO_SHIFTcl, REX_64IR(ir, xs), dest); ra_noweak(as, right); if (right != RID_ECX) emit_rr(as, XO_MOV, RID_ECX, right); } ra_left(as, dest, ir->op1); /* ** Note: avoid using the flags resulting from a shift or rotate! ** All of them cause a partial flag stall, except for r,1 shifts ** (but not rotates). And a shift count of 0 leaves the flags unmodified. */ } #define asm_bshl(as, ir) asm_bitshift(as, ir, XOg_SHL, XV_SHLX) #define asm_bshr(as, ir) asm_bitshift(as, ir, XOg_SHR, XV_SHRX) #define asm_bsar(as, ir) asm_bitshift(as, ir, XOg_SAR, XV_SARX) #define asm_brol(as, ir) asm_bitshift(as, ir, XOg_ROL, 0) #define asm_bror(as, ir) asm_bitshift(as, ir, XOg_ROR, 0) /* -- Comparisons --------------------------------------------------------- */ /* Virtual flags for unordered FP comparisons. */ #define VCC_U 0x1000 /* Unordered. */ #define VCC_P 0x2000 /* Needs extra CC_P branch. */ #define VCC_S 0x4000 /* Swap avoids CC_P branch. */ #define VCC_PS (VCC_P|VCC_S) /* Map of comparisons to flags. ORDER IR. */ #define COMPFLAGS(ci, cin, cu, cf) ((ci)+((cu)<<4)+((cin)<<8)+(cf)) static const uint16_t asm_compmap[IR_ABC+1] = { /* signed non-eq unsigned flags */ /* LT */ COMPFLAGS(CC_GE, CC_G, CC_AE, VCC_PS), /* GE */ COMPFLAGS(CC_L, CC_L, CC_B, 0), /* LE */ COMPFLAGS(CC_G, CC_G, CC_A, VCC_PS), /* GT */ COMPFLAGS(CC_LE, CC_L, CC_BE, 0), /* ULT */ COMPFLAGS(CC_AE, CC_A, CC_AE, VCC_U), /* UGE */ COMPFLAGS(CC_B, CC_B, CC_B, VCC_U|VCC_PS), /* ULE */ COMPFLAGS(CC_A, CC_A, CC_A, VCC_U), /* UGT */ COMPFLAGS(CC_BE, CC_B, CC_BE, VCC_U|VCC_PS), /* EQ */ COMPFLAGS(CC_NE, CC_NE, CC_NE, VCC_P), /* NE */ COMPFLAGS(CC_E, CC_E, CC_E, VCC_U|VCC_P), /* ABC */ COMPFLAGS(CC_BE, CC_B, CC_BE, VCC_U|VCC_PS) /* Same as UGT. */ }; /* FP and integer comparisons. */ static void asm_comp(ASMState *as, IRIns *ir) { uint32_t cc = asm_compmap[ir->o]; if (irt_isnum(ir->t)) { IRRef lref = ir->op1; IRRef rref = ir->op2; Reg left, right; MCLabel l_around; /* ** An extra CC_P branch is required to preserve ordered/unordered ** semantics for FP comparisons. This can be avoided by swapping ** the operands and inverting the condition (except for EQ and UNE). ** So always try to swap if possible. ** ** Another option would be to swap operands to achieve better memory ** operand fusion. But it's unlikely that this outweighs the cost ** of the extra branches. */ if (cc & VCC_S) { /* Swap? */ IRRef tmp = lref; lref = rref; rref = tmp; cc ^= (VCC_PS|(5<<4)); /* A <-> B, AE <-> BE, PS <-> none */ } left = ra_alloc1(as, lref, RSET_FPR); l_around = emit_label(as); asm_guardcc(as, cc >> 4); if (cc & VCC_P) { /* Extra CC_P branch required? */ if (!(cc & VCC_U)) { asm_guardcc(as, CC_P); /* Branch to exit for ordered comparisons. */ } else if (l_around != as->invmcp) { emit_sjcc(as, CC_P, l_around); /* Branch around for unordered. */ } else { /* Patched to mcloop by asm_loop_fixup. */ as->loopinv = 2; if (as->realign) emit_sjcc(as, CC_P, as->mcp); else emit_jcc(as, CC_P, as->mcp); } } right = asm_fuseload(as, rref, rset_exclude(RSET_FPR, left)); emit_mrm(as, XO_UCOMISD, left, right); } else { IRRef lref = ir->op1, rref = ir->op2; IROp leftop = (IROp)(IR(lref)->o); Reg r64 = REX_64IR(ir, 0); int32_t imm = 0; lua_assert(irt_is64(ir->t) || irt_isint(ir->t) || irt_isu32(ir->t) || irt_isaddr(ir->t) || irt_isu8(ir->t)); /* Swap constants (only for ABC) and fusable loads to the right. */ if (irref_isk(lref) || (!irref_isk(rref) && opisfusableload(leftop))) { if ((cc & 0xc) == 0xc) cc ^= 0x53; /* L <-> G, LE <-> GE */ else if ((cc & 0xa) == 0x2) cc ^= 0x55; /* A <-> B, AE <-> BE */ lref = ir->op2; rref = ir->op1; } if (asm_isk32(as, rref, &imm)) { IRIns *irl = IR(lref); /* Check wether we can use test ins. Not for unsigned, since CF=0. */ int usetest = (imm == 0 && (cc & 0xa) != 0x2); if (usetest && irl->o == IR_BAND && irl+1 == ir && !ra_used(irl)) { /* Combine comp(BAND(ref, r/imm), 0) into test mrm, r/imm. */ Reg right, left = RID_NONE; RegSet allow = RSET_GPR; if (!asm_isk32(as, irl->op2, &imm)) { left = ra_alloc1(as, irl->op2, allow); rset_clear(allow, left); } else { /* Try to Fuse IRT_I8/IRT_U8 loads, too. See below. */ IRIns *irll = IR(irl->op1); if (opisfusableload((IROp)irll->o) && (irt_isi8(irll->t) || irt_isu8(irll->t))) { IRType1 origt = irll->t; /* Temporarily flip types. */ irll->t.irt = (irll->t.irt & ~IRT_TYPE) | IRT_INT; as->curins--; /* Skip to BAND to avoid failing in noconflict(). */ right = asm_fuseload(as, irl->op1, RSET_GPR); as->curins++; irll->t = origt; if (right != RID_MRM) goto test_nofuse; /* Fusion succeeded, emit test byte mrm, imm8. */ asm_guardcc(as, cc); emit_i8(as, (imm & 0xff)); emit_mrm(as, XO_GROUP3b, XOg_TEST, RID_MRM); return; } } as->curins--; /* Skip to BAND to avoid failing in noconflict(). */ right = asm_fuseloadm(as, irl->op1, allow, r64); as->curins++; /* Undo the above. */ test_nofuse: asm_guardcc(as, cc); if (ra_noreg(left)) { emit_i32(as, imm); emit_mrm(as, XO_GROUP3, r64 + XOg_TEST, right); } else { emit_mrm(as, XO_TEST, r64 + left, right); } } else { Reg left; if (opisfusableload((IROp)irl->o) && ((irt_isu8(irl->t) && checku8(imm)) || ((irt_isi8(irl->t) || irt_isi16(irl->t)) && checki8(imm)) || (irt_isu16(irl->t) && checku16(imm) && checki8((int16_t)imm)))) { /* Only the IRT_INT case is fused by asm_fuseload. ** The IRT_I8/IRT_U8 loads and some IRT_I16/IRT_U16 loads ** are handled here. ** Note that cmp word [mem], imm16 should not be generated, ** since it has a length-changing prefix. Compares of a word ** against a sign-extended imm8 are ok, however. */ IRType1 origt = irl->t; /* Temporarily flip types. */ irl->t.irt = (irl->t.irt & ~IRT_TYPE) | IRT_INT; left = asm_fuseload(as, lref, RSET_GPR); irl->t = origt; if (left == RID_MRM) { /* Fusion succeeded? */ if (irt_isu8(irl->t) || irt_isu16(irl->t)) cc >>= 4; /* Need unsigned compare. */ asm_guardcc(as, cc); emit_i8(as, imm); emit_mrm(as, (irt_isi8(origt) || irt_isu8(origt)) ? XO_ARITHib : XO_ARITHiw8, r64 + XOg_CMP, RID_MRM); return; } /* Otherwise handle register case as usual. */ } else { left = asm_fuseloadm(as, lref, irt_isu8(ir->t) ? RSET_GPR8 : RSET_GPR, r64); } asm_guardcc(as, cc); if (usetest && left != RID_MRM) { /* Use test r,r instead of cmp r,0. */ x86Op xo = XO_TEST; if (irt_isu8(ir->t)) { lua_assert(ir->o == IR_EQ || ir->o == IR_NE); xo = XO_TESTb; if (!rset_test(RSET_RANGE(RID_EAX, RID_EBX+1), left)) { left |= FORCE_REX; } } emit_rr(as, xo, r64 + left, left); if (irl+1 == ir) /* Referencing previous ins? */ as->flagmcp = as->mcp; /* Set flag to drop test r,r if possible. */ } else { emit_gmrmi(as, XG_ARITHi(XOg_CMP), r64 + left, imm); } } } else { Reg left = ra_alloc1(as, lref, RSET_GPR); Reg right = asm_fuseloadm(as, rref, rset_exclude(RSET_GPR, left), r64); asm_guardcc(as, cc); emit_mrm(as, XO_CMP, r64 + left, right); } } } #define asm_equal(as, ir) asm_comp(as, ir) /* -- Support for 64 bit ops in 32 bit mode ------------------------------- */ /* Hiword op of a split 64 bit op. Previous op must be the loword op. */ static void asm_hiop(ASMState *as, IRIns *ir) { UNUSED(as); UNUSED(ir); lua_assert(0); /* Unused on x64 or without FFI. */ } /* -- Stack handling ------------------------------------------------------ */ /* Check Lua stack size for overflow. Use exit handler as fallback. */ static void asm_stack_check(ASMState *as, BCReg topslot, IRIns *irp, RegSet allow, ExitNo exitno) { /* Try to get an unused temp. register, otherwise spill/restore eax. */ Reg pbase = irp ? irp->r : RID_BASE; Reg r = allow ? rset_pickbot(allow) : RID_EAX; emit_jcc(as, CC_B, exitstub_addr(as->J, exitno)); if (allow == RSET_EMPTY) /* Restore temp. register. */ emit_rmro(as, XO_MOV, r|REX_64, RID_ESP, 0); else ra_modified(as, r); emit_gri(as, XG_ARITHi(XOg_CMP), r|REX_GC64, (int32_t)(8*topslot)); if (ra_hasreg(pbase) && pbase != r) emit_rr(as, XO_ARITH(XOg_SUB), r|REX_GC64, pbase); else emit_rmro(as, XO_ARITH(XOg_SUB), r|REX_64, RID_DISPATCH, (int32_t)dispofs(as, &J2G(as->J)->jit_base)); emit_rmro(as, XO_MOV, r|REX_GC64, r, offsetof(lua_State, maxstack)); emit_getgl(as, r, cur_L); if (allow == RSET_EMPTY) /* Spill temp. register. */ emit_rmro(as, XO_MOVto, r|REX_64, RID_ESP, 0); } /* Restore Lua stack from on-trace state. */ static void asm_stack_restore(ASMState *as, SnapShot *snap) { SnapEntry *map = &as->T->snapmap[snap->mapofs]; #if !LJ_FR2 || defined(LUA_USE_ASSERT) SnapEntry *flinks = &as->T->snapmap[snap_nextofs(as->T, snap)-1-LJ_FR2]; #endif MSize n, nent = snap->nent; /* Store the value of all modified slots to the Lua stack. */ for (n = 0; n < nent; n++) { SnapEntry sn = map[n]; BCReg s = snap_slot(sn); int32_t ofs = 8*((int32_t)s-1-LJ_FR2); IRRef ref = snap_ref(sn); IRIns *ir = IR(ref); if ((sn & SNAP_NORESTORE)) continue; if (irt_isnum(ir->t)) { Reg src = ra_alloc1(as, ref, RSET_FPR); emit_rmro(as, XO_MOVSDto, src, RID_BASE, ofs); } else { lua_assert(irt_ispri(ir->t) || irt_isaddr(ir->t)); if (!irref_isk(ref)) { Reg src = ra_alloc1(as, ref, rset_exclude(RSET_GPR, RID_BASE)); if (irt_is64(ir->t)) { /* TODO: 64 bit store + 32 bit load-modify-store is suboptimal. */ emit_u32(as, irt_toitype(ir->t) << 15); emit_rmro(as, XO_ARITHi, XOg_OR, RID_BASE, ofs+4); } else { emit_movmroi(as, RID_BASE, ofs+4, (irt_toitype(ir->t)<<15)|0x7fff); } emit_movtomro(as, REX_64IR(ir, src), RID_BASE, ofs); } else { TValue k; lj_ir_kvalue(as->J->L, &k, ir); if (tvisnil(&k)) { emit_i32(as, -1); emit_rmro(as, XO_MOVmi, REX_64, RID_BASE, ofs); } else { emit_movmroi(as, RID_BASE, ofs+4, k.u32.hi); emit_movmroi(as, RID_BASE, ofs, k.u32.lo); } } if ((sn & (SNAP_CONT|SNAP_FRAME))) { } } checkmclim(as); } lua_assert(map + nent == flinks); } /* -- GC handling --------------------------------------------------------- */ /* Check GC threshold and do one or more GC steps. */ static void asm_gc_check(ASMState *as) { const CCallInfo *ci = &lj_ir_callinfo[IRCALL_lj_gc_step_jit]; IRRef args[2]; MCLabel l_end; Reg tmp; ra_evictset(as, RSET_SCRATCH); l_end = emit_label(as); /* Exit trace if in GCSatomic or GCSfinalize. Avoids syncing GC objects. */ asm_guardcc(as, CC_NE); /* Assumes asm_snap_prep() already done. */ emit_rr(as, XO_TEST, RID_RET, RID_RET); args[0] = ASMREF_TMP1; /* global_State *g */ args[1] = ASMREF_TMP2; /* MSize steps */ asm_gencall(as, ci, args); tmp = ra_releasetmp(as, ASMREF_TMP1); emit_rmro(as, XO_LEA, tmp|REX_64, RID_DISPATCH, GG_DISP2G); emit_loadi(as, ra_releasetmp(as, ASMREF_TMP2), as->gcsteps); /* Jump around GC step if GC total < GC threshold. */ emit_sjcc(as, CC_B, l_end); emit_opgl(as, XO_ARITH(XOg_CMP), tmp|REX_GC64, gc.threshold); emit_getgl(as, tmp, gc.total); as->gcsteps = 0; checkmclim(as); } /* -- Loop handling ------------------------------------------------------- */ /* Fixup the loop branch. */ static void asm_loop_fixup(ASMState *as) { MCode *p = as->mctop; MCode *target = as->mcp; if (as->realign) { /* Realigned loops use short jumps. */ as->realign = NULL; /* Stop another retry. */ lua_assert(((intptr_t)target & 15) == 0); if (as->loopinv) { /* Inverted loop branch? */ p -= 5; p[0] = XI_JMP; lua_assert(target - p >= -128); p[-1] = (MCode)(target - p); /* Patch sjcc. */ if (as->loopinv == 2) p[-3] = (MCode)(target - p + 2); /* Patch opt. short jp. */ } else { lua_assert(target - p >= -128); p[-1] = (MCode)(int8_t)(target - p); /* Patch short jmp. */ p[-2] = XI_JMPs; } } else { MCode *newloop; p[-5] = XI_JMP; if (as->loopinv) { /* Inverted loop branch? */ /* asm_guardcc already inverted the jcc and patched the jmp. */ p -= 5; newloop = target+4; *(int32_t *)(p-4) = (int32_t)(target - p); /* Patch jcc. */ if (as->loopinv == 2) { *(int32_t *)(p-10) = (int32_t)(target - p + 6); /* Patch opt. jp. */ newloop = target+8; } } else { /* Otherwise just patch jmp. */ *(int32_t *)(p-4) = (int32_t)(target - p); newloop = target+3; } /* Realign small loops and shorten the loop branch. */ if (newloop >= p - 128) { as->realign = newloop; /* Force a retry and remember alignment. */ as->curins = as->stopins; /* Abort asm_trace now. */ as->T->nins = as->orignins; /* Remove any added renames. */ } } } /* -- Head of trace ------------------------------------------------------- */ /* Coalesce BASE register for a root trace. */ static void asm_head_root_base(ASMState *as) { IRIns *ir = IR(REF_BASE); Reg r = ir->r; if (ra_hasreg(r)) { ra_free(as, r); if (rset_test(as->modset, r) || irt_ismarked(ir->t)) ir->r = RID_INIT; /* No inheritance for modified BASE register. */ if (r != RID_BASE) emit_rr(as, XO_MOV, r|REX_GC64, RID_BASE); } } /* Coalesce or reload BASE register for a side trace. */ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow) { IRIns *ir = IR(REF_BASE); Reg r = ir->r; if (ra_hasreg(r)) { ra_free(as, r); if (rset_test(as->modset, r) || irt_ismarked(ir->t)) ir->r = RID_INIT; /* No inheritance for modified BASE register. */ if (irp->r == r) { rset_clear(allow, r); /* Mark same BASE register as coalesced. */ } else if (ra_hasreg(irp->r) && rset_test(as->freeset, irp->r)) { /* Move from coalesced parent reg. */ rset_clear(allow, irp->r); emit_rr(as, XO_MOV, r|REX_GC64, irp->r); } else { emit_getgl(as, r, jit_base); /* Otherwise reload BASE. */ } } return allow; } /* -- Tail of trace ------------------------------------------------------- */ /* Fixup the tail code. */ static void asm_tail_fixup(ASMState *as, TraceNo lnk, int track) { /* Note: don't use as->mcp swap + emit_*: emit_op overwrites more bytes. */ MCode *p = as->mctop; MCode *target, *q; int32_t spadj = as->T->spadjust; if (spadj == 0) { p -= ((as->flags & JIT_F_LEA_AGU) ? 7 : 6) + 1; } else { MCode *p1; /* Patch stack adjustment. */ if (checki8(spadj)) { p -= 3; p1 = p-6; *p1 = (MCode)spadj; } else { p1 = p-9; *(int32_t *)p1 = spadj; } if ((as->flags & JIT_F_LEA_AGU)) { p1[-4] = 0x48; p1[-3] = (MCode)XI_LEA; p1[-2] = MODRM(checki8(spadj) ? XM_OFS8 : XM_OFS32, RID_ESP, RID_ESP); p1[-1] = MODRM(XM_SCALE1, RID_ESP, RID_ESP); } else { p1[-3] = 0x48; p1[-2] = (MCode)(checki8(spadj) ? XI_ARITHi8 : XI_ARITHi); p1[-1] = MODRM(XM_REG, XOg_ADD, RID_ESP); } } /* Patch exit branch. */ target = (lnk ? traceref(as->J, lnk)->mcode : (track ? (MCode *)lj_vm_exit_interp : (MCode *)lj_vm_exit_interp_notrack)); *(int32_t *)(p-4) = jmprel(p, target); p[-5] = XI_JMP; /* Drop unused mcode tail. Fill with NOPs to make the prefetcher happy. */ for (q = as->mctop-1; q >= p; q--) *q = XI_NOP; as->mctop = p; } /* Prepare tail of code. */ static void asm_tail_prep(ASMState *as) { MCode *p = as->mctop; /* Realign and leave room for backwards loop branch or exit branch. */ if (as->realign) { int i = ((int)(intptr_t)as->realign) & 15; /* Fill unused mcode tail with NOPs to make the prefetcher happy. */ while (i-- > 0) *--p = XI_NOP; as->mctop = p; p -= (as->loopinv ? 5 : 2); /* Space for short/near jmp. */ } else { p -= 5; /* Space for exit branch (near jmp). */ } if (as->loopref) { as->invmcp = as->mcp = p; } else { /* Leave room for ESP adjustment: add esp, imm or lea esp, [esp+imm] */ as->mcp = p - (((as->flags & JIT_F_LEA_AGU) ? 7 : 6) + 1); as->invmcp = NULL; } } /* -- Trace setup --------------------------------------------------------- */ /* Ensure there are enough stack slots for call arguments. */ static Reg asm_setup_call_slots(ASMState *as, IRIns *ir, const CCallInfo *ci) { IRRef args[CCI_NARGS_MAX*2]; int nslots; asm_collectargs(as, ir, ci, args); nslots = asm_count_call_slots(as, ci, args); if (nslots > as->evenspill) /* Leave room for args in stack slots. */ as->evenspill = nslots; return irt_isfp(ir->t) ? REGSP_HINT(RID_FPRET) : REGSP_HINT(RID_RET); } /* Target-specific setup. */ static void asm_setup_target(ASMState *as) { asm_exitstub_setup(as, as->T->nsnap); as->mrm.base = 0; } /* -- Trace patching ------------------------------------------------------ */ static const uint8_t map_op1[256] = { 0x92,0x92,0x92,0x92,0x52,0x45,0x51,0x51,0x92,0x92,0x92,0x92,0x52,0x45,0x51,0x20, 0x92,0x92,0x92,0x92,0x52,0x45,0x51,0x51,0x92,0x92,0x92,0x92,0x52,0x45,0x51,0x51, 0x92,0x92,0x92,0x92,0x52,0x45,0x10,0x51,0x92,0x92,0x92,0x92,0x52,0x45,0x10,0x51, 0x92,0x92,0x92,0x92,0x52,0x45,0x10,0x51,0x92,0x92,0x92,0x92,0x52,0x45,0x10,0x51, 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, 0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51, 0x51,0x51,0x92,0x92,0x10,0x10,0x12,0x11,0x45,0x86,0x52,0x93,0x51,0x51,0x51,0x51, 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, 0x93,0x86,0x93,0x93,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92, 0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x51,0x47,0x51,0x51,0x51,0x51,0x51, 0x59,0x59,0x59,0x59,0x51,0x51,0x51,0x51,0x52,0x45,0x51,0x51,0x51,0x51,0x51,0x51, 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05, 0x93,0x93,0x53,0x51,0x70,0x71,0x93,0x86,0x54,0x51,0x53,0x51,0x51,0x52,0x51,0x51, 0x92,0x92,0x92,0x92,0x52,0x52,0x51,0x51,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92, 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x45,0x45,0x47,0x52,0x51,0x51,0x51,0x51, 0x10,0x51,0x10,0x10,0x51,0x51,0x63,0x66,0x51,0x51,0x51,0x51,0x51,0x51,0x92,0x92 }; static const uint8_t map_op2[256] = { 0x93,0x93,0x93,0x93,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x52,0x51,0x93,0x52,0x94, 0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93, 0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x53,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93, 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x34,0x51,0x35,0x51,0x51,0x51,0x51,0x51, 0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93, 0x53,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93, 0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93, 0x94,0x54,0x54,0x54,0x93,0x93,0x93,0x52,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93, 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46, 0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93, 0x52,0x52,0x52,0x93,0x94,0x93,0x51,0x51,0x52,0x52,0x52,0x93,0x94,0x93,0x93,0x93, 0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x94,0x93,0x93,0x93,0x93,0x93, 0x93,0x93,0x94,0x93,0x94,0x94,0x94,0x93,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, 0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93, 0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93, 0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x93,0x52 }; static uint32_t asm_x86_inslen(const uint8_t* p) { uint32_t result = 0; uint32_t prefixes = 0; uint32_t x = map_op1[*p]; for (;;) { switch (x >> 4) { case 0: return result + x + (prefixes & 4); case 1: prefixes |= x; x = map_op1[*++p]; result++; break; case 2: x = map_op2[*++p]; break; case 3: p++; goto mrm; case 4: result -= (prefixes & 2); /* fallthrough */ case 5: return result + (x & 15); case 6: /* Group 3. */ if (p[1] & 0x38) x = 2; else if ((prefixes & 2) && (x == 0x66)) x = 4; goto mrm; case 7: /* VEX c4/c5. */ if (x == 0x70) { x = *++p & 0x1f; result++; if (x >= 2) { p += 2; result += 2; goto mrm; } } p++; result++; x = map_op2[*++p]; break; case 8: result -= (prefixes & 2); /* fallthrough */ case 9: mrm: /* ModR/M and possibly SIB. */ result += (x & 15); x = *++p; switch (x >> 6) { case 0: if ((x & 7) == 5) return result + 4; break; case 1: result++; break; case 2: result += 4; break; case 3: return result; } if ((x & 7) == 4) { result++; if (x < 0x40 && (p[1] & 7) == 5) result += 4; } return result; } } } /* Patch exit jumps of existing machine code to a new target. */ void lj_asm_patchexit(jit_State *J, GCtrace *T, ExitNo exitno, MCode *target) { MCode *p = T->mcode; MCode *mcarea = lj_mcode_patch(J, p, 0); MSize len = T->szmcode; MCode *px = exitstub_addr(J, exitno) - 6; MCode *pe = p+len-6; uint32_t statei = (uint32_t)(GG_OFS(g.vmstate) - GG_OFS(dispatch)); if (len > 5 && p[len-5] == XI_JMP && p+len-6 + *(int32_t *)(p+len-4) == px) *(int32_t *)(p+len-4) = jmprel(p+len, target); /* Do not patch parent exit for a stack check. Skip beyond vmstate update. */ for (; p < pe; p += asm_x86_inslen(p)) { intptr_t ofs = (p[0] & 0xf0) == 0x40; if (*(uint32_t *)(p+2+ofs) == statei && p[ofs] == XI_MOVmi) break; } lua_assert(p < pe); for (; p < pe; p += asm_x86_inslen(p)) if ((*(uint16_t *)p & 0xf0ff) == 0x800f && p + *(int32_t *)(p+2) == px) *(int32_t *)(p+2) = jmprel(p+6, target); lj_mcode_sync(T->mcode, T->mcode + T->szmcode); lj_mcode_patch(J, mcarea, 1); }
{ "pile_set_name": "Github" }
<!DOCTYPE HTML> <html lang="en"> <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=401046 --> <head> <title>Test for Bug 401046</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> <style type="text/css"> #display span { margin-bottom: 1em; } </style> </head> <body> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=401046">Mozilla Bug 401046</a> <p id="display" lang="zh-Hans"> <span id="s0" style="font-size: 0">汉字</span> <span id="s4" style="font-size: 4px">汉字</span> <span id="s12" style="font-size: 12px">汉字</span> <span id="s28" style="font-size: 28px">汉字</span> </p> <div id="content" style="display: none"> </div> <pre id="test"> <script class="testbody" type="text/javascript"> /** Test for Bug 401046 **/ SimpleTest.waitForExplicitFinish(); var elts = [ document.getElementById("s0"), document.getElementById("s4"), document.getElementById("s12"), document.getElementById("s28") ]; function fs(idx) { // The computed font size actually *doesn't* currently reflect the // minimum font size preference, but things in em units do. Not sure // if this is how it ought to be... return getComputedStyle(elts[idx], "").marginBottom; } SpecialPowers.pushPrefEnv({'clear': [['font.minimum-size.zh-CN']]}, step1); function step1() { is(fs(0), "0px", "at min font size 0, 0px should compute to 0px"); is(fs(1), "4px", "at min font size 0, 4px should compute to 4px"); is(fs(2), "12px", "at min font size 0, 12px should compute to 12px"); is(fs(3), "28px", "at min font size 0, 28px should compute to 28px"); SpecialPowers.pushPrefEnv({'set': [['font.minimum-size.zh-CN', 7]]}, step2); } function step2() { is(fs(0), "0px", "at min font size 7, 0px should compute to 0px"); is(fs(1), "7px", "at min font size 7, 4px should compute to 7px"); is(fs(2), "12px", "at min font size 7, 12px should compute to 12px"); is(fs(3), "28px", "at min font size 7, 28px should compute to 28px"); SpecialPowers.pushPrefEnv({'set': [['font.minimum-size.zh-CN', 18]]}, step3); } function step3() { is(fs(0), "0px", "at min font size 18, 0px should compute to 0px"); is(fs(1), "18px", "at min font size 18, 4px should compute to 18px"); is(fs(2), "18px", "at min font size 18, 12px should compute to 18px"); is(fs(3), "28px", "at min font size 18, 28px should compute to 28px"); SpecialPowers.pushPrefEnv({'clear': [['font.minimum-size.zh-CN']]}, SimpleTest.finish); } </script> </pre> </body> </html>
{ "pile_set_name": "Github" }
⚽The rest is ASCII01. The rest is ASCII02. The rest is ASCII03. The rest is ASCII04. The rest is ASCII05. The rest is ASCII06. The rest is ASCII07. The rest is ASCII08. The rest is ASCII09. The rest is ASCII10. The rest is ASCII11. The rest is ASCII12. The rest is ASCII13. The rest is ASCII14. The rest is ASCII15. The rest is ASCII16. The rest is ASCII17. The rest is ASCII18. The rest is ASCII19. The rest is ASCII20. The rest is ASCII21. The rest is ASCII22.
{ "pile_set_name": "Github" }
/* * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018-11-27 SummerGift add spi flash port file */ #include <rtthread.h> #include "spi_flash.h" #include "spi_flash_sfud.h" #include "drv_spi.h" #if defined(BSP_USING_SPI_FLASH) static int rt_hw_spi_flash_init(void) { __HAL_RCC_GPIOA_CLK_ENABLE(); rt_hw_spi_device_attach("spi2", "spi20", GPIOB, GPIO_PIN_12); if (RT_NULL == rt_sfud_flash_probe("W25Q64", "spi20")) { return -RT_ERROR; }; return RT_EOK; } INIT_COMPONENT_EXPORT(rt_hw_spi_flash_init); #endif
{ "pile_set_name": "Github" }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Copyright (c) Microsoft Corporation. All rights reserved. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include "SPOT_Messaging.h" HRESULT Library_spot_native_Microsoft_SPOT_Messaging_EndPoint::_ctor___VOID__mscorlibSystemType__U4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_MESSAGING(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_spot_native_Microsoft_SPOT_Messaging_EndPoint::GetMessage___MicrosoftSPOTMessagingMessage__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_MESSAGING(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_spot_native_Microsoft_SPOT_Messaging_EndPoint::Check___BOOLEAN__mscorlibSystemType__U4__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_MESSAGING(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_spot_native_Microsoft_SPOT_Messaging_EndPoint::SendMessageRaw___SZARRAY_U1__mscorlibSystemType__U4__I4__SZARRAY_U1( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_MESSAGING(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); } HRESULT Library_spot_native_Microsoft_SPOT_Messaging_EndPoint::ReplyRaw___VOID__MicrosoftSPOTMessagingMessage__SZARRAY_U1( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_MESSAGING(); TINYCLR_HEADER(); TINYCLR_SET_AND_LEAVE(stack.NotImplementedStub()); TINYCLR_NOCLEANUP(); }
{ "pile_set_name": "Github" }
// Semmle test case for CWE-327: Use of a Broken or Risky Cryptographic Algorithm // http://cwe.mitre.org/data/definitions/327.html package test.cwe327.semmle.tests; import javax.crypto.*; import javax.crypto.spec.*; import java.security.*; class Test { public void test() { try { String input = "ABCDEFG123456"; KeyGenerator keyGenerator; SecretKeySpec secretKeySpec; Cipher cipher; { // BAD: DES is a weak algorithm keyGenerator = KeyGenerator.getInstance("DES"); } // GOOD: RSA is a strong algorithm // NB: in general the algorithms used in the various stages must be // the same, but for testing purposes we will vary them keyGenerator = KeyGenerator.getInstance("RSA"); /* Perform initialization of KeyGenerator */ keyGenerator.init(112); SecretKey secretKey = keyGenerator.generateKey(); byte[] byteKey = secretKey.getEncoded(); { // BAD: foo is an unknown algorithm that may not be secure secretKeySpec = new SecretKeySpec(byteKey, "foo"); } // GOOD: GCM is a strong algorithm secretKeySpec = new SecretKeySpec(byteKey, "GCM"); { // BAD: RC2 is a weak algorithm cipher = Cipher.getInstance("RC2"); } // GOOD: ECIES is a strong algorithm cipher = Cipher.getInstance("ECIES"); cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec); byte[] encrypted = cipher.doFinal(input.getBytes("UTF-8")); } catch (Exception e) { // fail } } }
{ "pile_set_name": "Github" }
 using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Diagnostics.Runtime.Utilities; using System.IO; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using System.Collections.Generic; using Microsoft.Diagnostics.Runtime.Utilities.Pdb; namespace Microsoft.Diagnostics.Runtime.Tests { [TestClass] public class SymbolLocatorTests { static public readonly string WellKnownDac = "mscordacwks_X86_X86_4.6.96.00.dll"; static public readonly int WellKnownDacTimeStamp = 0x55b96946; static public readonly int WellKnownDacImageSize = 0x006a8000; static public readonly string WellKnownNativePdb = "clr.pdb"; static public readonly Guid WellKnownNativePdbGuid = new Guid("0350aa66-2d49-4425-ab28-9b43a749638d"); static public readonly int WellKnownNativePdbAge = 2; static internal SymbolLocator GetLocator() { string tmpPath = Helpers.TestWorkingDirectory; SymbolLocator locator = new DefaultSymbolLocator(); locator.SymbolCache = tmpPath; return locator; } [TestMethod] public void SymbolLocatorTimeoutNegativeTest() { var locator = GetLocator(); locator.Timeout = 1; locator.SymbolCache += "\\TestTimeoutNegative"; string pdb = locator.FindPdb(WellKnownNativePdb, WellKnownNativePdbGuid, WellKnownNativePdbAge); Assert.IsNull(pdb); } [TestMethod] public void SymbolLocatorTimeoutTest() { var locator = GetLocator(); locator.Timeout = 10000; locator.SymbolCache += "\\TestTimeout"; string pdb = locator.FindPdb(WellKnownNativePdb, WellKnownNativePdbGuid, WellKnownNativePdbAge); Assert.IsNotNull(pdb); } [TestMethod] public void FindBinaryNegativeTest() { SymbolLocator _locator = GetLocator(); string dac = _locator.FindBinary(WellKnownDac, WellKnownDacTimeStamp + 1, WellKnownDacImageSize + 1, false); Assert.IsNull(dac); } [TestMethod] public void FindPdbNegativeTest() { SymbolLocator _locator = GetLocator(); string pdb = _locator.FindPdb(WellKnownNativePdb, WellKnownNativePdbGuid, WellKnownNativePdbAge + 1); Assert.IsNull(pdb); } [TestMethod] public async Task FindBinaryAsyncNegativeTest() { SymbolLocator _locator = GetLocator(); List<Task<string>> tasks = new List<Task<string>>(); for (int i = 0; i < 10; i++) tasks.Add(_locator.FindBinaryAsync(WellKnownDac, WellKnownDacTimeStamp + 1, WellKnownDacImageSize + 1, false)); // Ensure we got the same answer for everything. foreach (var task in tasks) { string dac = await task; Assert.IsNull(dac); } } [TestMethod] public async Task FindPdbAsyncNegativeTest() { SymbolLocator _locator = GetLocator(); List<Task<string>> tasks = new List<Task<string>>(); for (int i = 0; i < 10; i++) tasks.Add(_locator.FindPdbAsync(WellKnownNativePdb, WellKnownNativePdbGuid, WellKnownNativePdbAge + 1)); // Ensure we got the same answer for everything. foreach (var task in tasks) { string pdb = await task; Assert.IsNull(pdb); } } [TestMethod] public void FindBinaryTest() { SymbolLocator _locator = GetLocator(); string dac = _locator.FindBinary(WellKnownDac, WellKnownDacTimeStamp, WellKnownDacImageSize, false); Assert.IsNotNull(dac); Assert.IsTrue(File.Exists(dac)); } [TestMethod] public void FindPdbTest() { SymbolLocator _locator = GetLocator(); string pdb = _locator.FindPdb(WellKnownNativePdb, WellKnownNativePdbGuid, WellKnownNativePdbAge); Assert.IsNotNull(pdb); Assert.IsTrue(File.Exists(pdb)); Assert.IsTrue(PdbMatches(pdb, WellKnownNativePdbGuid, WellKnownNativePdbAge)); } static bool PdbMatches(string pdb, Guid guid, int age) { Guid fileGuid; int fileAge; PdbReader.GetPdbProperties(pdb, out fileGuid, out fileAge); return guid == fileGuid && age == fileAge; } [TestMethod] public async Task FindBinaryAsyncTest() { SymbolLocator _locator = GetLocator(); Task<string> first = _locator.FindBinaryAsync(WellKnownDac, WellKnownDacTimeStamp, WellKnownDacImageSize, false); List<Task<string>> tasks = new List<Task<string>>(); for (int i = 0; i < 10; i++) tasks.Add(_locator.FindBinaryAsync(WellKnownDac, WellKnownDacTimeStamp, WellKnownDacImageSize, false)); string dac = await first; Assert.IsNotNull(dac); Assert.IsTrue(File.Exists(dac)); new PEFile(dac).Dispose(); // This will throw if the image is invalid. // Ensure we got the same answer for everything. foreach (var task in tasks) { string taskDac = await task; Assert.AreEqual(dac, taskDac); } } [TestMethod] public async Task FindPdbAsyncTest() { SymbolLocator _locator = GetLocator(); Task<string> first = _locator.FindPdbAsync(WellKnownNativePdb, WellKnownNativePdbGuid, WellKnownNativePdbAge); List<Task<string>> tasks = new List<Task<string>>(); for (int i = 0; i < 10; i++) tasks.Add(_locator.FindPdbAsync(WellKnownNativePdb, WellKnownNativePdbGuid, WellKnownNativePdbAge)); string pdb = await first; Assert.IsNotNull(pdb); Assert.IsTrue(File.Exists(pdb)); Assert.IsTrue(PdbMatches(pdb, WellKnownNativePdbGuid, WellKnownNativePdbAge)); // Ensure we got the same answer for everything. foreach (var task in tasks) { string taskPdb = await task; Assert.AreEqual(taskPdb, pdb); } } } }
{ "pile_set_name": "Github" }
// Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage-istanbul-reporter'), require('@angular-devkit/build-angular/plugins/karma') ], client: { clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { dir: require('path').join(__dirname, '../coverage'), reports: ['html', 'lcovonly', 'text-summary'], fixWebpackSourcePaths: true }, reporters: ['progress', 'kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false }); };
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" default-locale="en-US"> <!-- Generated with https://github.com/citation-style-language/utilities/tree/master/generate_dependent_styles/data/taylor-and-francis --> <info> <title>Housing Policy Debate</title> <id>http://www.zotero.org/styles/housing-policy-debate</id> <link href="http://www.zotero.org/styles/housing-policy-debate" rel="self"/> <link href="http://www.zotero.org/styles/apa" rel="independent-parent"/> <link href="http://www.tandfonline.com/action/authorSubmission?journalCode=RHPD20&amp;page=instructions" rel="documentation"/> <category citation-format="author-date"/> <category field="political_science"/> <issn>1051-1482</issn> <eissn>2152-050X</eissn> <updated>2014-05-17T12:00:00+00:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> </style>
{ "pile_set_name": "Github" }
/* * talloc_report into a string * * Copyright Volker Lendecke <[email protected]> 2015 * * 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/>. */ #ifndef _TALLOC_REPORT_H_ #define _TALLOC_REPORT_H_ #include <talloc.h> char *talloc_report_str(TALLOC_CTX *mem_ctx, TALLOC_CTX *root); #endif
{ "pile_set_name": "Github" }
# HIFIMAN HE4XX See [usage instructions](https://github.com/jaakkopasanen/AutoEq#usage) for more options and info. ### Parametric EQs In case of using parametric equalizer, apply preamp of **-5.4dB** and build filters manually with these parameters. The first 5 filters can be used independently. When using independent subset of filters, apply preamp of **-5.5dB**. | Type | Fc | Q | Gain | |:--------|:---------|:-----|:--------| | Peaking | 20 Hz | 0.93 | 4.7 dB | | Peaking | 49 Hz | 1.65 | 2.0 dB | | Peaking | 1813 Hz | 2.06 | 5.0 dB | | Peaking | 7139 Hz | 3.13 | -7.4 dB | | Peaking | 11134 Hz | 3.8 | 1.9 dB | | Peaking | 207 Hz | 1.76 | -1.1 dB | | Peaking | 1296 Hz | 3.64 | 0.6 dB | | Peaking | 2247 Hz | 4.48 | 2.2 dB | | Peaking | 2742 Hz | 1.57 | -2.2 dB | | Peaking | 3684 Hz | 3.86 | 2.6 dB | ### Fixed Band EQs In case of using fixed band (also called graphic) equalizer, apply preamp of **-5.0dB** (if available) and set gains manually with these parameters. | Type | Fc | Q | Gain | |:--------|:---------|:-----|:--------| | Peaking | 31 Hz | 1.41 | 4.3 dB | | Peaking | 62 Hz | 1.41 | 1.3 dB | | Peaking | 125 Hz | 1.41 | -0.3 dB | | Peaking | 250 Hz | 1.41 | -0.8 dB | | Peaking | 500 Hz | 1.41 | -0.1 dB | | Peaking | 1000 Hz | 1.41 | 0.2 dB | | Peaking | 2000 Hz | 1.41 | 4.3 dB | | Peaking | 4000 Hz | 1.41 | -0.5 dB | | Peaking | 8000 Hz | 1.41 | -3.9 dB | | Peaking | 16000 Hz | 1.41 | -2.3 dB | ### Graphs ![](./HIFIMAN%20HE4XX.png)
{ "pile_set_name": "Github" }
@auto_projection(value = 1) simple = { value : TEXT; };
{ "pile_set_name": "Github" }
import React from 'react'; import { mount } from 'enzyme'; import AvatarMenu from '..'; describe('<AvatarMenu/>', () => { it('should pass the icon passed to the AvatarButton', () => { const component = mount( <AvatarMenu icon={<svg />}> <span /> </AvatarMenu>, ); expect(component.find('AvatarButton').prop('icon')).toEqual(<svg />); }); it('should set the title passed in the AvatarButton', () => { const component = mount( <AvatarMenu title="my title"> <span /> </AvatarMenu>, ); expect(component.find('AvatarButton').prop('title')).toBe('my title'); }); it('should set the disabled passed in the AvatarButton', () => { const component = mount( <AvatarMenu disabled> <span /> </AvatarMenu>, ); expect(component.find('AvatarButton').prop('disabled')).toBe(true); }); it('should set the tabIndex passed in the AvatarButton', () => { const component = mount( <AvatarMenu tabIndex={0}> <span /> </AvatarMenu>, ); expect(component.find('AvatarButton').prop('tabIndex')).toBe(0); }); it('should set the initials passed in the AvatarButton', () => { const component = mount( <AvatarMenu initials="CM"> <span /> </AvatarMenu>, ); expect(component.find('AvatarButton').prop('initials')).toBe('CM'); }); it('should set the initialsVariant passed in the AvatarButton', () => { const component = mount( <AvatarMenu initialsVariant="inverse"> <span /> </AvatarMenu>, ); expect(component.find('AvatarButton').prop('initialsVariant')).toBe('inverse'); }); it('should set the avatarSize passed in the AvatarButton', () => { const component = mount( <AvatarMenu avatarSize="small"> <span /> </AvatarMenu>, ); expect(component.find('AvatarButton').prop('avatarSize')).toBe('small'); }); it('should set the src passed in the AvatarButton', () => { const component = mount( <AvatarMenu src="mages/user/user2.jpg"> <span /> </AvatarMenu>, ); expect(component.find('AvatarButton').prop('src')).toBe('mages/user/user2.jpg'); }); });
{ "pile_set_name": "Github" }
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_HOUSEHOLDER_MODULE_H #define EIGEN_HOUSEHOLDER_MODULE_H #include "Core" #include "src/Core/util/DisableStupidWarnings.h" /** \defgroup Householder_Module Householder module * This module provides Householder transformations. * * \code * #include <Eigen/Householder> * \endcode */ #include "src/Householder/Householder.h" #include "src/Householder/HouseholderSequence.h" #include "src/Householder/BlockHouseholder.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_HOUSEHOLDER_MODULE_H /* vim: set filetype=cpp et sw=2 ts=2 ai: */
{ "pile_set_name": "Github" }
--- - src: https://github.com/mrlesmithjr/ansible-apache2.git - src: https://github.com/mrlesmithjr/ansible-cmdb.git - src: https://github.com/mrlesmithjr/ansible-postfix.git - src: https://github.com/mrlesmithjr/ansible-timezone.git
{ "pile_set_name": "Github" }
:baby_bottle:
{ "pile_set_name": "Github" }
#include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; // define a custom template unary functor template<typename Scalar> struct CwiseClampOp { CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {} const Scalar operator()(const Scalar& x) const { return x<m_inf ? m_inf : (x>m_sup ? m_sup : x); } Scalar m_inf, m_sup; }; int main(int, char**) { Matrix4d m1 = Matrix4d::Random(); cout << m1 << endl << "becomes: " << endl << m1.unaryExpr(CwiseClampOp<double>(-0.5,0.5)) << endl; return 0; }
{ "pile_set_name": "Github" }
#living_room-hall-garden you are in the living_room to the east there is the hall to the north there is the kitchen to the west there is the veranda ? what do you want to do go to the garden .cx -> east . east >>> End context you are in the hall to the east there is the corridor to the north there is the library to the west there is the living_room to the south there is the garden ? what do you want to do .x -> south . south >>> End context
{ "pile_set_name": "Github" }
/** * FreeRDP: A Remote Desktop Protocol Implementation * Static Virtual Channel Interface * * Copyright 2009-2011 Jay Sorg * Copyright 2015 Thincast Technologies GmbH * Copyright 2015 DI (FH) Martin Haimberger <[email protected]> * * 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. */ #ifndef FREERDP_SVC_H #define FREERDP_SVC_H #include <freerdp/api.h> #include <freerdp/types.h> #include <winpr/wtsapi.h> #include <freerdp/freerdp.h> #define CHANNEL_EVENT_USER 1000 #define CHANNEL_EXPORT_FUNC_NAME "VirtualChannelEntry" #define CHANNEL_EXPORT_FUNC_NAME_EX "VirtualChannelEntryEx" #define FREERDP_CHANNEL_MAGIC_NUMBER 0x46524450 struct _CHANNEL_ENTRY_POINTS_FREERDP { UINT32 cbSize; UINT32 protocolVersion; PVIRTUALCHANNELINIT pVirtualChannelInit; PVIRTUALCHANNELOPEN pVirtualChannelOpen; PVIRTUALCHANNELCLOSE pVirtualChannelClose; PVIRTUALCHANNELWRITE pVirtualChannelWrite; /* Extended Fields */ UINT32 MagicNumber; /* identifies FreeRDP */ void* pExtendedData; /* extended initial data */ void* pInterface; /* channel callback interface, use after initialization */ void** ppInterface; /* channel callback interface, use for initialization */ rdpContext* context; }; typedef struct _CHANNEL_ENTRY_POINTS_FREERDP CHANNEL_ENTRY_POINTS_FREERDP; typedef CHANNEL_ENTRY_POINTS_FREERDP* PCHANNEL_ENTRY_POINTS_FREERDP; struct _CHANNEL_ENTRY_POINTS_FREERDP_EX { UINT32 cbSize; UINT32 protocolVersion; PVIRTUALCHANNELINITEX pVirtualChannelInitEx; PVIRTUALCHANNELOPENEX pVirtualChannelOpenEx; PVIRTUALCHANNELCLOSEEX pVirtualChannelCloseEx; PVIRTUALCHANNELWRITEEX pVirtualChannelWriteEx; /* Extended Fields */ UINT32 MagicNumber; /* identifies FreeRDP */ void* pExtendedData; /* extended initial data */ void* pInterface; /* channel callback interface, use after initialization */ void** ppInterface; /* channel callback interface, use for initialization */ rdpContext* context; }; typedef struct _CHANNEL_ENTRY_POINTS_FREERDP_EX CHANNEL_ENTRY_POINTS_FREERDP_EX; typedef CHANNEL_ENTRY_POINTS_FREERDP_EX* PCHANNEL_ENTRY_POINTS_FREERDP_EX; #endif /* FREERDP_SVC_H */
{ "pile_set_name": "Github" }
module Cms class Attachment < ActiveRecord::Base MULTIPLE = 'multiple' SANITIZATION_REGEXES = [[/\s/, '_'], [/[&+()]/, '-'], [/[=?!'"{}\[\]#<>%]/, '']] #' this tic cleans up emacs ruby mode self.table_name = :cms_attachments cattr_accessor :definitions, :instance_writer => false @@definitions = {}.with_indifferent_access cattr_reader :configuration before_validation :set_cardinality before_save :set_section, :sanitized_file_path_and_name before_create :setup_attachment belongs_to :attachable, :polymorphic => true extend DefaultAccessible validates :attachment_name, :attachable_type, :presence => true is_addressable include Cms::Concerns::Addressable::DeprecatedPageAccessors is_archivable; is_publishable; uses_soft_delete; is_userstamped; is_versioned scope :named, lambda { |name| {:conditions => {:attachment_name => name.to_s}} } scope :multiple, -> {where(:cardinality => MULTIPLE)} FILE_BLOCKS = "Cms::AbstractFileBlock" validates_presence_of :data_file_path, :if => Proc.new { |a| a.attachable_type == FILE_BLOCKS } validates_uniqueness_of :data_file_path, :message =>"must be unique. (Another file, image or page is already using '%{value}').", :if => Proc.new { |a| a.attachable_type == FILE_BLOCKS } class << self def permitted_params super + [:attachable_class, :data] end # Makes file paths more URL friendly def sanitize_file_path(file_path) SANITIZATION_REGEXES.inject(file_path.to_s) do |s, (regex, replace)| s.gsub(regex, replace) end end def definitions_for(klass, type) definitions[klass].inject({}) { |d, (k, v)| d[k.capitalize] = v if v["type"] == type; d } end def configuration @@configuration ||= Cms::Attachments.configuration end # Returns a Proc that can be used to dynamically determine styles based on the Cms::Attachment class # # Paperclip can handle a :styles parameter which responds to :call(Paperclip::Attachment) def dynamically_return_styles lambda do |paperclip_attachment| cms_attachment = paperclip_attachment.instance # Look up the style for the given block if cms_attachment.has_assigned_content_type? configuration_value(cms_attachment.content_block_class, cms_attachment.attachment_name, :styles) else # New attachments that aren't associated with an Attaching type yet have no styles {} end end end def find_live_by_file_path(path) Attachment.published.not_archived.find_by_data_file_path path end def configure_paperclip # @todo This might be better done using subclasses of Attachment for each document instance. # We could use single table inheritance to avoid needing to do meta configurations. has_attached_file :data, :url => configuration.url, :path => configuration.path, :styles => dynamically_return_styles, # Needed for versioning so that we keep all previous files. :preserve_files => true, #TODO: enable custom processors :processors => configuration.processors, :default_url => configuration.default_url, :default_style => configuration.default_style, :use_timestamp => configuration.use_timestamp, :whiny => configuration.whiny, :storage => rail_config(:storage), :s3_credentials => rail_config(:s3_credentials), :bucket => rail_config(:s3_bucket), :s3_host_name => rail_config(:s3_host_name), :s3_host_alias => rail_config(:s3_host_alias) end # Looks up a value from Rails config def rail_config(key) Rails.configuration.cms.attachments[key] end # Looks up the configuration value given: # @param [Class] block_class The class of a block which has an attachment. # @param [String] name_of_attachment The name of the attachment association (i.e. if was 'has_attachment :photos' then pass 'photo') # @param [Symbol] key The key for the value to be fetched (i.e. :styles) def configuration_value(block_class, name_of_attachment, key) class_definitions = definitions[block_class] if class_definitions == nil raise "Couldn't find any definitions for '#{block_class}'. Available definitions are #{definitions.inspect}." end attachment_definition = class_definitions[name_of_attachment] if attachment_definition == nil raise "Verify that '#{block_class}' defines an attachment named ':#{name_of_attachment}'." end attachment_definition[key] || configuration.send(key) end end def attachable_class attachable_type end # @todo There isn't any good reason I know of why this needs to be a distinct field. Needed to add it to get it working for 4.0 though. def attachable_class=(klass) self.attachable_type = klass end def section=(section) dirty! if self.section != section super(section) end def config_value_for(key) self.class.configuration_value(content_block_class, attachment_name, key) end def content_block_class attachable.try(:class).try(:name) || attachable_type #attachable_class || attachable.try(:class).try(:name) || attachable_type end def icon { :doc => %w[doc], :gif => %w[gif jpg jpeg png tiff bmp], :htm => %w[htm html], :pdf => %w[pdf], :ppt => %w[ppt], :swf => %w[swf], :txt => %w[txt], :xls => %w[xls], :xml => %w[xml], :zip => %w[zip rar tar gz tgz] }.each do |icon, extensions| return icon if extensions.include?(data_file_extension) end :file end # For authorized users, return the path to get the specific version of the file associated with this attachment. # Guests should always get 'data_file_path' which is the public version of the asset. def attachment_version_path "/cms/attachments/#{id}?version=#{version}" end def public? section ? section.public? : false end def is_image? %w[jpg gif png jpeg].include?(data_file_extension) end # Returns a Paperclip generated relative path to the file (with thumbnail sizing) def url(style_name = configuration.default_style) data.url(style_name) end # Returns the absolute file location of the underlying asset def path(style_name = configuration.default_style) data.path(style_name) end def original_filename data_file_name end alias :file_name :original_filename def size data_file_size end def content_type data_content_type end alias :file_type :content_type # Returns the definitions for this particular attachment type. # @return [Hash] Empty Hash if no definition have been defined for this attachment. def config content_defs = definitions[content_block_class] ? definitions[content_block_class] : {} content_defs[attachment_name] ? content_defs[attachment_name] : {} end # Determines if this Attachment has access to configuration information yet. Until it is assigned to an Attaching object, # it will lack style information. def has_assigned_content_type?() attachable_type && attachment_name end protected private def data_file_extension data_file_name.split('.').last.downcase if data_file_name && data_file_name['.'] end # Filter - Ensure that paths are going to URL friendly (and won't need encoding for special characters.') def sanitized_file_path_and_name if data_file_path self.data_file_path = self.class.sanitize_file_path(data_file_path) if !data_file_path.empty? && !data_file_path.starts_with?("/") self.data_file_path = "/#{data_file_path}" end end if data_file_name self.data_file_name = self.class.sanitize_file_path(data_file_name) end end def set_section unless parent self.parent = Section.root.first end end def setup_attachment data.instance_variable_set :@url, config_value_for(:url) data.instance_variable_set :@path, config_value_for(:path) data.instance_variable_set :@styles, config_value_for(:styles) data.instance_variable_set :@normalized_styles, nil data.send :post_process_styles end # Attachments should always be configured with a cardinality def set_cardinality unless cardinality self.cardinality = config[:type].to_s end end end end
{ "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_View * @subpackage Helper * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: HtmlElement.php 24593 2012-01-05 20:35:02Z matthew $ */ /** * @see Zend_View_Helper_Abstract */ require_once 'Zend/View/Helper/Abstract.php'; /** * @category Zend * @package Zend_View * @subpackage Helper * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_View_Helper_HtmlElement extends Zend_View_Helper_Abstract { /** * EOL character */ const EOL = "\n"; /** * The tag closing bracket * * @var string */ protected $_closingBracket = null; /** * Get the tag closing bracket * * @return string */ public function getClosingBracket() { if (!$this->_closingBracket) { if ($this->_isXhtml()) { $this->_closingBracket = ' />'; } else { $this->_closingBracket = '>'; } } return $this->_closingBracket; } /** * Is doctype XHTML? * * @return boolean */ protected function _isXhtml() { $doctype = $this->view->doctype(); return $doctype->isXhtml(); } /** * Is doctype strict? * * @return boolean */ protected function _isStrictDoctype() { $doctype = $this->view->doctype(); return $doctype->isStrict(); } /** * Converts an associative array to a string of tag attributes. * * @access public * * @param array $attribs From this array, each key-value pair is * converted to an attribute name and value. * * @return string The XHTML for the attributes. */ protected function _htmlAttribs($attribs) { $xhtml = ''; foreach ((array) $attribs as $key => $val) { $key = $this->view->escape($key); if (('on' == substr($key, 0, 2)) || ('constraints' == $key)) { // Don't escape event attributes; _do_ substitute double quotes with singles if (!is_scalar($val)) { // non-scalar data should be cast to JSON first require_once 'Zend/Json.php'; $val = Zend_Json::encode($val); } // Escape single quotes inside event attribute values. // This will create html, where the attribute value has // single quotes around it, and escaped single quotes or // non-escaped double quotes inside of it $val = str_replace('\'', '&#39;', $val); } else { if (is_array($val)) { $val = implode(' ', $val); } $val = $this->view->escape($val); } if ('id' == $key) { $val = $this->_normalizeId($val); } if (strpos($val, '"') !== false) { $xhtml .= " $key='$val'"; } else { $xhtml .= " $key=\"$val\""; } } return $xhtml; } /** * Normalize an ID * * @param string $value * @return string */ protected function _normalizeId($value) { if (strstr($value, '[')) { if ('[]' == substr($value, -2)) { $value = substr($value, 0, strlen($value) - 2); } $value = trim($value, ']'); $value = str_replace('][', '-', $value); $value = str_replace('[', '-', $value); } return $value; } }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <script type="text/javascript">window.location.replace('/rmwc/?p=' + window.location.pathname.split('/rmwc/')[1] + (window.location.search ? '&' + window.location.search.slice(1) : ''));</script> <meta name="google-site-verification" content="zArJNTXiV31Ctcf8DTTd9DHQxIcRv5j67mRvpyMN8VE" /> <meta name="description" content="RMWC is a React wrapper for the official Material Components Web library."> <meta name="keywords" content="RMWC, Material, Design, Components, Web, React, material-components-web"> </head> <body class="mdc-typography"> <noscript>You need to enable JavaScript to run this app.</noscript> </body> </html>
{ "pile_set_name": "Github" }
// CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE (function() { var mode = CodeMirror.getMode({tabSize: 4}, 'textile'); function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } MT('simpleParagraphs', 'Some text.', '', 'Some more text.'); /* * Phrase Modifiers */ MT('em', 'foo [em _bar_]'); MT('emBoogus', 'code_mirror'); MT('strong', 'foo [strong *bar*]'); MT('strongBogus', '3 * 3 = 9'); MT('italic', 'foo [em __bar__]'); MT('italicBogus', 'code__mirror'); MT('bold', 'foo [strong **bar**]'); MT('boldBogus', '3 ** 3 = 27'); MT('simpleLink', '[link "CodeMirror":http://codemirror.net]'); MT('referenceLink', '[link "CodeMirror":code_mirror]', 'Normal Text.', '[link [[code_mirror]]http://codemirror.net]'); MT('footCite', 'foo bar[qualifier [[1]]]'); MT('footCiteBogus', 'foo bar[[1a2]]'); MT('special-characters', 'Registered [tag (r)], ' + 'Trademark [tag (tm)], and ' + 'Copyright [tag (c)] 2008'); MT('cite', "A book is [keyword ??The Count of Monte Cristo??] by Dumas."); MT('additionAndDeletion', 'The news networks declared [negative -Al Gore-] ' + '[positive +George W. Bush+] the winner in Florida.'); MT('subAndSup', 'f(x, n) = log [builtin ~4~] x [builtin ^n^]'); MT('spanAndCode', 'A [quote %span element%] and [atom @code element@]'); MT('spanBogus', 'Percentage 25% is not a span.'); MT('citeBogus', 'Question? is not a citation.'); MT('codeBogus', '[email protected]'); MT('subBogus', '~username'); MT('supBogus', 'foo ^ bar'); MT('deletionBogus', '3 - 3 = 0'); MT('additionBogus', '3 + 3 = 6'); MT('image', 'An image: [string !http://www.example.com/image.png!]'); MT('imageWithAltText', 'An image: [string !http://www.example.com/image.png (Alt Text)!]'); MT('imageWithUrl', 'An image: [string !http://www.example.com/image.png!:http://www.example.com/]'); /* * Headers */ MT('h1', '[header&header-1 h1. foo]'); MT('h2', '[header&header-2 h2. foo]'); MT('h3', '[header&header-3 h3. foo]'); MT('h4', '[header&header-4 h4. foo]'); MT('h5', '[header&header-5 h5. foo]'); MT('h6', '[header&header-6 h6. foo]'); MT('h7Bogus', 'h7. foo'); MT('multipleHeaders', '[header&header-1 h1. Heading 1]', '', 'Some text.', '', '[header&header-2 h2. Heading 2]', '', 'More text.'); MT('h1inline', '[header&header-1 h1. foo ][header&header-1&em _bar_][header&header-1 baz]'); /* * Lists */ MT('ul', 'foo', 'bar', '', '[variable-2 * foo]', '[variable-2 * bar]'); MT('ulNoBlank', 'foo', 'bar', '[variable-2 * foo]', '[variable-2 * bar]'); MT('ol', 'foo', 'bar', '', '[variable-2 # foo]', '[variable-2 # bar]'); MT('olNoBlank', 'foo', 'bar', '[variable-2 # foo]', '[variable-2 # bar]'); MT('ulFormatting', '[variable-2 * ][variable-2&em _foo_][variable-2 bar]', '[variable-2 * ][variable-2&strong *][variable-2&em&strong _foo_]' + '[variable-2&strong *][variable-2 bar]', '[variable-2 * ][variable-2&strong *foo*][variable-2 bar]'); MT('olFormatting', '[variable-2 # ][variable-2&em _foo_][variable-2 bar]', '[variable-2 # ][variable-2&strong *][variable-2&em&strong _foo_]' + '[variable-2&strong *][variable-2 bar]', '[variable-2 # ][variable-2&strong *foo*][variable-2 bar]'); MT('ulNested', '[variable-2 * foo]', '[variable-3 ** bar]', '[keyword *** bar]', '[variable-2 **** bar]', '[variable-3 ** bar]'); MT('olNested', '[variable-2 # foo]', '[variable-3 ## bar]', '[keyword ### bar]', '[variable-2 #### bar]', '[variable-3 ## bar]'); MT('ulNestedWithOl', '[variable-2 * foo]', '[variable-3 ## bar]', '[keyword *** bar]', '[variable-2 #### bar]', '[variable-3 ** bar]'); MT('olNestedWithUl', '[variable-2 # foo]', '[variable-3 ** bar]', '[keyword ### bar]', '[variable-2 **** bar]', '[variable-3 ## bar]'); MT('definitionList', '[number - coffee := Hot ][number&em _and_][number black]', '', 'Normal text.'); MT('definitionListSpan', '[number - coffee :=]', '', '[number Hot ][number&em _and_][number black =:]', '', 'Normal text.'); MT('boo', '[number - dog := woof woof]', '[number - cat := meow meow]', '[number - whale :=]', '[number Whale noises.]', '', '[number Also, ][number&em _splashing_][number . =:]'); /* * Attributes */ MT('divWithAttribute', '[punctuation div][punctuation&attribute (#my-id)][punctuation . foo bar]'); MT('divWithAttributeAnd2emRightPadding', '[punctuation div][punctuation&attribute (#my-id)((][punctuation . foo bar]'); MT('divWithClassAndId', '[punctuation div][punctuation&attribute (my-class#my-id)][punctuation . foo bar]'); MT('paragraphWithCss', 'p[attribute {color:red;}]. foo bar'); MT('paragraphNestedStyles', 'p. [strong *foo ][strong&em _bar_][strong *]'); MT('paragraphWithLanguage', 'p[attribute [[fr]]]. Parlez-vous français?'); MT('paragraphLeftAlign', 'p[attribute <]. Left'); MT('paragraphRightAlign', 'p[attribute >]. Right'); MT('paragraphRightAlign', 'p[attribute =]. Center'); MT('paragraphJustified', 'p[attribute <>]. Justified'); MT('paragraphWithLeftIndent1em', 'p[attribute (]. Left'); MT('paragraphWithRightIndent1em', 'p[attribute )]. Right'); MT('paragraphWithLeftIndent2em', 'p[attribute ((]. Left'); MT('paragraphWithRightIndent2em', 'p[attribute ))]. Right'); MT('paragraphWithLeftIndent3emRightIndent2em', 'p[attribute ((())]. Right'); MT('divFormatting', '[punctuation div. ][punctuation&strong *foo ]' + '[punctuation&strong&em _bar_][punctuation&strong *]'); MT('phraseModifierAttributes', 'p[attribute (my-class)]. This is a paragraph that has a class and' + ' this [em _][em&attribute (#special-phrase)][em emphasized phrase_]' + ' has an id.'); MT('linkWithClass', '[link "(my-class). This is a link with class":http://redcloth.org]'); /* * Layouts */ MT('paragraphLayouts', 'p. This is one paragraph.', '', 'p. This is another.'); MT('div', '[punctuation div. foo bar]'); MT('pre', '[operator pre. Text]'); MT('bq.', '[bracket bq. foo bar]', '', 'Normal text.'); MT('footnote', '[variable fn123. foo ][variable&strong *bar*]'); /* * Spanning Layouts */ MT('bq..ThenParagraph', '[bracket bq.. foo bar]', '', '[bracket More quote.]', 'p. Normal Text'); MT('bq..ThenH1', '[bracket bq.. foo bar]', '', '[bracket More quote.]', '[header&header-1 h1. Header Text]'); MT('bc..ThenParagraph', '[atom bc.. # Some ruby code]', '[atom obj = {foo: :bar}]', '[atom puts obj]', '', '[atom obj[[:love]] = "*love*"]', '[atom puts obj.love.upcase]', '', 'p. Normal text.'); MT('fn1..ThenParagraph', '[variable fn1.. foo bar]', '', '[variable More.]', 'p. Normal Text'); MT('pre..ThenParagraph', '[operator pre.. foo bar]', '', '[operator More.]', 'p. Normal Text'); /* * Tables */ MT('table', '[variable-3&operator |_. name |_. age|]', '[variable-3 |][variable-3&strong *Walter*][variable-3 | 5 |]', '[variable-3 |Florence| 6 |]', '', 'p. Normal text.'); MT('tableWithAttributes', '[variable-3&operator |_. name |_. age|]', '[variable-3 |][variable-3&attribute /2.][variable-3 Jim |]', '[variable-3 |][variable-3&attribute \\2{color: red}.][variable-3 Sam |]'); /* * HTML */ MT('html', '[comment <div id="wrapper">]', '[comment <section id="introduction">]', '', '[header&header-1 h1. Welcome]', '', '[variable-2 * Item one]', '[variable-2 * Item two]', '', '[comment <a href="http://example.com">Example</a>]', '', '[comment </section>]', '[comment </div>]'); MT('inlineHtml', 'I can use HTML directly in my [comment <span class="youbetcha">Textile</span>].'); /* * No-Textile */ MT('notextile', '[string-2 notextile. *No* formatting]'); MT('notextileInline', 'Use [string-2 ==*asterisks*==] for [strong *strong*] text.'); MT('notextileWithPre', '[operator pre. *No* formatting]'); MT('notextileWithSpanningPre', '[operator pre.. *No* formatting]', '', '[operator *No* formatting]'); })();
{ "pile_set_name": "Github" }
var addButton = document.querySelector('#add'); var displayButton = document.querySelector('#display'); var DB_NAME = 'timestamps'; var DB_VERSION = 1; var STORE_NAME = 'store'; var db; var request = indexedDB.open(DB_NAME, DB_VERSION); request.onupgradeneeded = function() { // Create a new object store if this is the first time we're using // this DB_NAME/DB_VERSION combo. request.result.createObjectStore(STORE_NAME, {autoIncrement: true}); }; request.onsuccess = function() { db = request.result; // Enable our buttons once the IndexedDB instance is available. addButton.disabled = false; displayButton.disabled = false; }; addButton.addEventListener('click', function() { var transaction = db.transaction(STORE_NAME, 'readwrite'); var objectStore = transaction.objectStore(STORE_NAME); // Add the current timestamp to IndexedDB. objectStore.put(Date.now()).onsuccess = function() { ChromeSamples.setStatus('Added timestamp to IndexedDB.'); }; }); function logTimestamps(timestamps) { ChromeSamples.setStatus('There are ' + timestamps.length + ' timestamp(s) saved in IndexedDB: ' + timestamps.join(', ')); } displayButton.addEventListener('click', function() { var transaction = db.transaction(STORE_NAME, 'readonly'); var objectStore = transaction.objectStore(STORE_NAME); if ('getAll' in objectStore) { // IDBObjectStore.getAll() will return the full set of items in our store. objectStore.getAll().onsuccess = function(event) { logTimestamps(event.target.result); }; } else { // Fallback to the traditional cursor approach if getAll isn't supported. var timestamps = []; objectStore.openCursor().onsuccess = function(event) { var cursor = event.target.result; if (cursor) { timestamps.push(cursor.value); cursor.continue(); } else { logTimestamps(timestamps); } }; } });
{ "pile_set_name": "Github" }
#include "a.h" /* * 14. Three-part titles. */ void r_lt(int argc, Rune **argv) { Rune *p; if(argc < 2) nr(L(".lt"), evalscale(L("6.5i"), 'm')); else{ if(argc > 2) warn("too many arguments for .lt"); p = argv[1]; if(p[0] == '-') nr(L(".lt"), getnr(L(".lt"))-evalscale(p+1, 'm')); else if(p[0] == '+') nr(L(".lt"), getnr(L(".lt"))+evalscale(p+1, 'm')); else nr(L(".lt"), evalscale(p, 'm')); } } void t14init(void) { addreq(L("tl"), r_warn, -1); addreq(L("pc"), r_nop, -1); /* page number char */ addreq(L("lt"), r_lt, -1); }
{ "pile_set_name": "Github" }
This provides guidance on how to contribute various content to `rocksdb.org`. ## Getting started You should only have to do these one time. - Rename this file to `CONTRIBUTING.md`. - Rename `EXAMPLE-README-FOR-RUNNING-DOCS.md` to `README.md` (replacing the existing `README.md` that came with the template). - Rename `EXAMPLE-LICENSE` to `LICENSE`. - Review the [template information](./TEMPLATE-INFORMATION.md). - Review `./_config.yml`. - Make sure you update `title`, `description`, `tagline` and `gacode` (Google Analytics) in `./_config.yml`. ## Basic Structure Most content is written in markdown. You name the file `something.md`, then have a header that looks like this: ``` --- docid: getting-started title: Getting started with ProjectName layout: docs permalink: /docs/getting-started.html --- ``` Customize these values for each document, blog post, etc. > The filename of the `.md` file doesn't actually matter; what is important is the `docid` being unique and the `permalink` correct and unique too). ## Landing page Modify `index.md` with your new or updated content. If you want a `GridBlock` as part of your content, you can do so directly with HTML: ``` <div class="gridBlock"> <div class="blockElement twoByGridBlock alignLeft"> <div class="blockContent"> <h3>Your Features</h3> <ul> <li>The <a href="http://example.org/">Example</a></li> <li><a href="http://example.com">Another Example</a></li> </ul> </div> </div> <div class="blockElement twoByGridBlock alignLeft"> <div class="blockContent"> <h3>More information</h3> <p> Stuff here </p> </div> </div> </div> ``` or with a combination of changing `./_data/features.yml` and adding some Liquid to `index.md`, such as: ``` {% include content/gridblocks.html data_source=site.data.features imagealign="bottom"%} ``` ## Blog To modify a blog post, edit the appopriate markdown file in `./_posts/`. Adding a new blog post is a four-step process. > Some posts have a `permalink` and `comments` in the blog post YAML header. You will not need these for new blog posts. These are an artifact of migrating the blog from Wordpress to gh-pages. 1. Create your blog post in `./_posts/` in markdown (file extension `.md` or `.markdown`). See current posts in that folder or `./doc-type-examples/2016-04-07-blog-post-example.md` for an example of the YAML format. **If the `./_posts` directory does not exist, create it**. - You can add a `<!--truncate-->` tag in the middle of your post such that you show only the excerpt above that tag in the main `/blog` index on your page. 1. If you have not authored a blog post before, modify the `./_data/authors.yml` file with the `author` id you used in your blog post, along with your full name and Facebook ID to get your profile picture. 1. [Run the site locally](./README.md) to test your changes. It will be at `http://127.0.0.1/blog/your-new-blog-post-title.html` 1. Push your changes to GitHub. ## Docs To modify docs, edit the appropriate markdown file in `./_docs/`. To add docs to the site.... 1. Add your markdown file to the `./_docs/` folder. See `./doc-type-examples/docs-hello-world.md` for an example of the YAML header format. **If the `./_docs/` directory does not exist, create it**. - You can use folders in the `./_docs/` directory to organize your content if you want. 1. Update `_data/nav_docs.yml` to add your new document to the navigation bar. Use the `docid` you put in your doc markdown in as the `id` in the `_data/nav_docs.yml` file. 1. [Run the site locally](./README.md) to test your changes. It will be at `http://127.0.0.1/docs/your-new-doc-permalink.html` 1. Push your changes to GitHub. ## Header Bar To modify the header bar, change `./_data/nav.yml`. ## Top Level Page To modify a top-level page, edit the appropriate markdown file in `./top-level/` If you want a top-level page (e.g., http://your-site.com/top-level.html) -- not in `/blog/` or `/docs/`.... 1. Create a markdown file in the root `./top-level/`. See `./doc-type-examples/top-level-example.md` for more information. 1. If you want a visible link to that file, update `_data/nav.yml` to add a link to your new top-level document in the header bar. > This is not necessary if you just want to have a page that is linked to from another page, but not exposed as direct link to the user. 1. [Run the site locally](./README.md) to test your changes. It will be at `http://127.0.0.1/your-top-level-page-permalink.html` 1. Push your changes to GitHub. ## Other Changes - CSS: `./css/main.css` or `./_sass/*.scss`. - Images: `./static/images/[docs | posts]/....` - Main Blog post HTML: `./_includes/post.html` - Main Docs HTML: `./_includes/doc.html`
{ "pile_set_name": "Github" }
;;; ls-lisp-tests.el --- tests for ls-lisp.el -*- lexical-binding: t-*- ;; Copyright (C) 2017-2018 Free Software Foundation, Inc. ;; Author: Tino Calancha <[email protected]> ;; Keywords: ;; This file is part of GNU Emacs. ;; GNU Emacs 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. ;; GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. ;;; Commentary: ;;; Code: (require 'ert) (require 'ls-lisp) (require 'dired) (ert-deftest ls-lisp-unload () "Test for https://debbugs.gnu.org/xxxxx ." (should (advice-member-p 'ls-lisp--insert-directory 'insert-directory)) (unload-feature 'ls-lisp 'force) (should-not (advice-member-p 'ls-lisp--insert-directory 'insert-directory)) (require 'ls-lisp)) (ert-deftest ls-lisp-test-bug27762 () "Test for https://debbugs.gnu.org/27762 ." (let* ((dir source-directory) (default-directory dir) (files (mapcar (lambda (f) (concat "src/" f)) (directory-files (expand-file-name "src") nil "\\.*\\.c\\'"))) ls-lisp-use-insert-directory-program buf) (unwind-protect (let ((file1 "src/cygw32.c") (file2 "src/atimer.c")) (setq buf (dired (nconc (list dir) files))) (dired-goto-file (expand-file-name file2 default-directory)) (should-not (looking-at "^ -")) ; Must be 2 spaces not 3. (setq files (cons file1 (delete file1 files))) (kill-buffer buf) (setq buf (dired (nconc (list dir) files))) (should (looking-at "src")) (next-line) ; File names must be aligned. (should (looking-at "src"))) (when (buffer-live-p buf) (kill-buffer buf))))) (ert-deftest ls-lisp-test-bug27631 () "Test for https://debbugs.gnu.org/27631 ." (let* ((dir (make-temp-file "bug27631" 'dir)) (dir1 (expand-file-name "dir1" dir)) (dir2 (expand-file-name "dir2" dir)) (default-directory dir) ls-lisp-use-insert-directory-program buf) (unwind-protect (progn (make-directory dir1) (make-directory dir2) (with-temp-file (expand-file-name "a.txt" dir1)) (with-temp-file (expand-file-name "b.txt" dir2)) (setq buf (dired (expand-file-name "dir*/*.txt" dir))) (dired-toggle-marks) (should (cdr (dired-get-marked-files)))) (delete-directory dir 'recursive) (when (buffer-live-p buf) (kill-buffer buf))))) (ert-deftest ls-lisp-test-bug27693 () "Test for https://debbugs.gnu.org/27693 ." (let ((dir (expand-file-name "lisp" source-directory)) (size "") ls-lisp-use-insert-directory-program buf) (unwind-protect (progn (setq buf (dired (list dir "simple.el" "subr.el")) size (number-to-string (file-attribute-size (file-attributes (dired-get-filename))))) (search-backward-regexp size nil t) (should (looking-back "[[:space:]]" (1- (point))))) (when (buffer-live-p buf) (kill-buffer buf))))) (provide 'ls-lisp-tests) ;;; ls-lisp-tests.el ends here
{ "pile_set_name": "Github" }
Relájese, mejore el enfoque y aumente la productividad con sonidos de fondo.
{ "pile_set_name": "Github" }
# /* ************************************************************************** # * * # * (C) Copyright Paul Mensonides 2002. # * 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 for most recent version. */ # # include <boost/preprocessor/config/config.hpp> # # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_DMC() # include <boost/preprocessor/detail/dmc/auto_rec.hpp> # else # # ifndef BOOST_PREPROCESSOR_DETAIL_AUTO_REC_HPP # define BOOST_PREPROCESSOR_DETAIL_AUTO_REC_HPP # # include <boost/preprocessor/control/iif.hpp> # # /* BOOST_PP_AUTO_REC */ # # define BOOST_PP_AUTO_REC(pred, n) BOOST_PP_NODE_ENTRY_ ## n(pred) # # define BOOST_PP_NODE_ENTRY_256(p) BOOST_PP_NODE_128(p)(p)(p)(p)(p)(p)(p)(p) # define BOOST_PP_NODE_ENTRY_128(p) BOOST_PP_NODE_64(p)(p)(p)(p)(p)(p)(p) # define BOOST_PP_NODE_ENTRY_64(p) BOOST_PP_NODE_32(p)(p)(p)(p)(p)(p) # define BOOST_PP_NODE_ENTRY_32(p) BOOST_PP_NODE_16(p)(p)(p)(p)(p) # define BOOST_PP_NODE_ENTRY_16(p) BOOST_PP_NODE_8(p)(p)(p)(p) # define BOOST_PP_NODE_ENTRY_8(p) BOOST_PP_NODE_4(p)(p)(p) # define BOOST_PP_NODE_ENTRY_4(p) BOOST_PP_NODE_2(p)(p) # define BOOST_PP_NODE_ENTRY_2(p) BOOST_PP_NODE_1(p) # # define BOOST_PP_NODE_128(p) BOOST_PP_IIF(p(128), BOOST_PP_NODE_64, BOOST_PP_NODE_192) # define BOOST_PP_NODE_64(p) BOOST_PP_IIF(p(64), BOOST_PP_NODE_32, BOOST_PP_NODE_96) # define BOOST_PP_NODE_32(p) BOOST_PP_IIF(p(32), BOOST_PP_NODE_16, BOOST_PP_NODE_48) # define BOOST_PP_NODE_16(p) BOOST_PP_IIF(p(16), BOOST_PP_NODE_8, BOOST_PP_NODE_24) # define BOOST_PP_NODE_8(p) BOOST_PP_IIF(p(8), BOOST_PP_NODE_4, BOOST_PP_NODE_12) # define BOOST_PP_NODE_4(p) BOOST_PP_IIF(p(4), BOOST_PP_NODE_2, BOOST_PP_NODE_6) # define BOOST_PP_NODE_2(p) BOOST_PP_IIF(p(2), BOOST_PP_NODE_1, BOOST_PP_NODE_3) # define BOOST_PP_NODE_1(p) BOOST_PP_IIF(p(1), 1, 2) # define BOOST_PP_NODE_3(p) BOOST_PP_IIF(p(3), 3, 4) # define BOOST_PP_NODE_6(p) BOOST_PP_IIF(p(6), BOOST_PP_NODE_5, BOOST_PP_NODE_7) # define BOOST_PP_NODE_5(p) BOOST_PP_IIF(p(5), 5, 6) # define BOOST_PP_NODE_7(p) BOOST_PP_IIF(p(7), 7, 8) # define BOOST_PP_NODE_12(p) BOOST_PP_IIF(p(12), BOOST_PP_NODE_10, BOOST_PP_NODE_14) # define BOOST_PP_NODE_10(p) BOOST_PP_IIF(p(10), BOOST_PP_NODE_9, BOOST_PP_NODE_11) # define BOOST_PP_NODE_9(p) BOOST_PP_IIF(p(9), 9, 10) # define BOOST_PP_NODE_11(p) BOOST_PP_IIF(p(11), 11, 12) # define BOOST_PP_NODE_14(p) BOOST_PP_IIF(p(14), BOOST_PP_NODE_13, BOOST_PP_NODE_15) # define BOOST_PP_NODE_13(p) BOOST_PP_IIF(p(13), 13, 14) # define BOOST_PP_NODE_15(p) BOOST_PP_IIF(p(15), 15, 16) # define BOOST_PP_NODE_24(p) BOOST_PP_IIF(p(24), BOOST_PP_NODE_20, BOOST_PP_NODE_28) # define BOOST_PP_NODE_20(p) BOOST_PP_IIF(p(20), BOOST_PP_NODE_18, BOOST_PP_NODE_22) # define BOOST_PP_NODE_18(p) BOOST_PP_IIF(p(18), BOOST_PP_NODE_17, BOOST_PP_NODE_19) # define BOOST_PP_NODE_17(p) BOOST_PP_IIF(p(17), 17, 18) # define BOOST_PP_NODE_19(p) BOOST_PP_IIF(p(19), 19, 20) # define BOOST_PP_NODE_22(p) BOOST_PP_IIF(p(22), BOOST_PP_NODE_21, BOOST_PP_NODE_23) # define BOOST_PP_NODE_21(p) BOOST_PP_IIF(p(21), 21, 22) # define BOOST_PP_NODE_23(p) BOOST_PP_IIF(p(23), 23, 24) # define BOOST_PP_NODE_28(p) BOOST_PP_IIF(p(28), BOOST_PP_NODE_26, BOOST_PP_NODE_30) # define BOOST_PP_NODE_26(p) BOOST_PP_IIF(p(26), BOOST_PP_NODE_25, BOOST_PP_NODE_27) # define BOOST_PP_NODE_25(p) BOOST_PP_IIF(p(25), 25, 26) # define BOOST_PP_NODE_27(p) BOOST_PP_IIF(p(27), 27, 28) # define BOOST_PP_NODE_30(p) BOOST_PP_IIF(p(30), BOOST_PP_NODE_29, BOOST_PP_NODE_31) # define BOOST_PP_NODE_29(p) BOOST_PP_IIF(p(29), 29, 30) # define BOOST_PP_NODE_31(p) BOOST_PP_IIF(p(31), 31, 32) # define BOOST_PP_NODE_48(p) BOOST_PP_IIF(p(48), BOOST_PP_NODE_40, BOOST_PP_NODE_56) # define BOOST_PP_NODE_40(p) BOOST_PP_IIF(p(40), BOOST_PP_NODE_36, BOOST_PP_NODE_44) # define BOOST_PP_NODE_36(p) BOOST_PP_IIF(p(36), BOOST_PP_NODE_34, BOOST_PP_NODE_38) # define BOOST_PP_NODE_34(p) BOOST_PP_IIF(p(34), BOOST_PP_NODE_33, BOOST_PP_NODE_35) # define BOOST_PP_NODE_33(p) BOOST_PP_IIF(p(33), 33, 34) # define BOOST_PP_NODE_35(p) BOOST_PP_IIF(p(35), 35, 36) # define BOOST_PP_NODE_38(p) BOOST_PP_IIF(p(38), BOOST_PP_NODE_37, BOOST_PP_NODE_39) # define BOOST_PP_NODE_37(p) BOOST_PP_IIF(p(37), 37, 38) # define BOOST_PP_NODE_39(p) BOOST_PP_IIF(p(39), 39, 40) # define BOOST_PP_NODE_44(p) BOOST_PP_IIF(p(44), BOOST_PP_NODE_42, BOOST_PP_NODE_46) # define BOOST_PP_NODE_42(p) BOOST_PP_IIF(p(42), BOOST_PP_NODE_41, BOOST_PP_NODE_43) # define BOOST_PP_NODE_41(p) BOOST_PP_IIF(p(41), 41, 42) # define BOOST_PP_NODE_43(p) BOOST_PP_IIF(p(43), 43, 44) # define BOOST_PP_NODE_46(p) BOOST_PP_IIF(p(46), BOOST_PP_NODE_45, BOOST_PP_NODE_47) # define BOOST_PP_NODE_45(p) BOOST_PP_IIF(p(45), 45, 46) # define BOOST_PP_NODE_47(p) BOOST_PP_IIF(p(47), 47, 48) # define BOOST_PP_NODE_56(p) BOOST_PP_IIF(p(56), BOOST_PP_NODE_52, BOOST_PP_NODE_60) # define BOOST_PP_NODE_52(p) BOOST_PP_IIF(p(52), BOOST_PP_NODE_50, BOOST_PP_NODE_54) # define BOOST_PP_NODE_50(p) BOOST_PP_IIF(p(50), BOOST_PP_NODE_49, BOOST_PP_NODE_51) # define BOOST_PP_NODE_49(p) BOOST_PP_IIF(p(49), 49, 50) # define BOOST_PP_NODE_51(p) BOOST_PP_IIF(p(51), 51, 52) # define BOOST_PP_NODE_54(p) BOOST_PP_IIF(p(54), BOOST_PP_NODE_53, BOOST_PP_NODE_55) # define BOOST_PP_NODE_53(p) BOOST_PP_IIF(p(53), 53, 54) # define BOOST_PP_NODE_55(p) BOOST_PP_IIF(p(55), 55, 56) # define BOOST_PP_NODE_60(p) BOOST_PP_IIF(p(60), BOOST_PP_NODE_58, BOOST_PP_NODE_62) # define BOOST_PP_NODE_58(p) BOOST_PP_IIF(p(58), BOOST_PP_NODE_57, BOOST_PP_NODE_59) # define BOOST_PP_NODE_57(p) BOOST_PP_IIF(p(57), 57, 58) # define BOOST_PP_NODE_59(p) BOOST_PP_IIF(p(59), 59, 60) # define BOOST_PP_NODE_62(p) BOOST_PP_IIF(p(62), BOOST_PP_NODE_61, BOOST_PP_NODE_63) # define BOOST_PP_NODE_61(p) BOOST_PP_IIF(p(61), 61, 62) # define BOOST_PP_NODE_63(p) BOOST_PP_IIF(p(63), 63, 64) # define BOOST_PP_NODE_96(p) BOOST_PP_IIF(p(96), BOOST_PP_NODE_80, BOOST_PP_NODE_112) # define BOOST_PP_NODE_80(p) BOOST_PP_IIF(p(80), BOOST_PP_NODE_72, BOOST_PP_NODE_88) # define BOOST_PP_NODE_72(p) BOOST_PP_IIF(p(72), BOOST_PP_NODE_68, BOOST_PP_NODE_76) # define BOOST_PP_NODE_68(p) BOOST_PP_IIF(p(68), BOOST_PP_NODE_66, BOOST_PP_NODE_70) # define BOOST_PP_NODE_66(p) BOOST_PP_IIF(p(66), BOOST_PP_NODE_65, BOOST_PP_NODE_67) # define BOOST_PP_NODE_65(p) BOOST_PP_IIF(p(65), 65, 66) # define BOOST_PP_NODE_67(p) BOOST_PP_IIF(p(67), 67, 68) # define BOOST_PP_NODE_70(p) BOOST_PP_IIF(p(70), BOOST_PP_NODE_69, BOOST_PP_NODE_71) # define BOOST_PP_NODE_69(p) BOOST_PP_IIF(p(69), 69, 70) # define BOOST_PP_NODE_71(p) BOOST_PP_IIF(p(71), 71, 72) # define BOOST_PP_NODE_76(p) BOOST_PP_IIF(p(76), BOOST_PP_NODE_74, BOOST_PP_NODE_78) # define BOOST_PP_NODE_74(p) BOOST_PP_IIF(p(74), BOOST_PP_NODE_73, BOOST_PP_NODE_75) # define BOOST_PP_NODE_73(p) BOOST_PP_IIF(p(73), 73, 74) # define BOOST_PP_NODE_75(p) BOOST_PP_IIF(p(75), 75, 76) # define BOOST_PP_NODE_78(p) BOOST_PP_IIF(p(78), BOOST_PP_NODE_77, BOOST_PP_NODE_79) # define BOOST_PP_NODE_77(p) BOOST_PP_IIF(p(77), 77, 78) # define BOOST_PP_NODE_79(p) BOOST_PP_IIF(p(79), 79, 80) # define BOOST_PP_NODE_88(p) BOOST_PP_IIF(p(88), BOOST_PP_NODE_84, BOOST_PP_NODE_92) # define BOOST_PP_NODE_84(p) BOOST_PP_IIF(p(84), BOOST_PP_NODE_82, BOOST_PP_NODE_86) # define BOOST_PP_NODE_82(p) BOOST_PP_IIF(p(82), BOOST_PP_NODE_81, BOOST_PP_NODE_83) # define BOOST_PP_NODE_81(p) BOOST_PP_IIF(p(81), 81, 82) # define BOOST_PP_NODE_83(p) BOOST_PP_IIF(p(83), 83, 84) # define BOOST_PP_NODE_86(p) BOOST_PP_IIF(p(86), BOOST_PP_NODE_85, BOOST_PP_NODE_87) # define BOOST_PP_NODE_85(p) BOOST_PP_IIF(p(85), 85, 86) # define BOOST_PP_NODE_87(p) BOOST_PP_IIF(p(87), 87, 88) # define BOOST_PP_NODE_92(p) BOOST_PP_IIF(p(92), BOOST_PP_NODE_90, BOOST_PP_NODE_94) # define BOOST_PP_NODE_90(p) BOOST_PP_IIF(p(90), BOOST_PP_NODE_89, BOOST_PP_NODE_91) # define BOOST_PP_NODE_89(p) BOOST_PP_IIF(p(89), 89, 90) # define BOOST_PP_NODE_91(p) BOOST_PP_IIF(p(91), 91, 92) # define BOOST_PP_NODE_94(p) BOOST_PP_IIF(p(94), BOOST_PP_NODE_93, BOOST_PP_NODE_95) # define BOOST_PP_NODE_93(p) BOOST_PP_IIF(p(93), 93, 94) # define BOOST_PP_NODE_95(p) BOOST_PP_IIF(p(95), 95, 96) # define BOOST_PP_NODE_112(p) BOOST_PP_IIF(p(112), BOOST_PP_NODE_104, BOOST_PP_NODE_120) # define BOOST_PP_NODE_104(p) BOOST_PP_IIF(p(104), BOOST_PP_NODE_100, BOOST_PP_NODE_108) # define BOOST_PP_NODE_100(p) BOOST_PP_IIF(p(100), BOOST_PP_NODE_98, BOOST_PP_NODE_102) # define BOOST_PP_NODE_98(p) BOOST_PP_IIF(p(98), BOOST_PP_NODE_97, BOOST_PP_NODE_99) # define BOOST_PP_NODE_97(p) BOOST_PP_IIF(p(97), 97, 98) # define BOOST_PP_NODE_99(p) BOOST_PP_IIF(p(99), 99, 100) # define BOOST_PP_NODE_102(p) BOOST_PP_IIF(p(102), BOOST_PP_NODE_101, BOOST_PP_NODE_103) # define BOOST_PP_NODE_101(p) BOOST_PP_IIF(p(101), 101, 102) # define BOOST_PP_NODE_103(p) BOOST_PP_IIF(p(103), 103, 104) # define BOOST_PP_NODE_108(p) BOOST_PP_IIF(p(108), BOOST_PP_NODE_106, BOOST_PP_NODE_110) # define BOOST_PP_NODE_106(p) BOOST_PP_IIF(p(106), BOOST_PP_NODE_105, BOOST_PP_NODE_107) # define BOOST_PP_NODE_105(p) BOOST_PP_IIF(p(105), 105, 106) # define BOOST_PP_NODE_107(p) BOOST_PP_IIF(p(107), 107, 108) # define BOOST_PP_NODE_110(p) BOOST_PP_IIF(p(110), BOOST_PP_NODE_109, BOOST_PP_NODE_111) # define BOOST_PP_NODE_109(p) BOOST_PP_IIF(p(109), 109, 110) # define BOOST_PP_NODE_111(p) BOOST_PP_IIF(p(111), 111, 112) # define BOOST_PP_NODE_120(p) BOOST_PP_IIF(p(120), BOOST_PP_NODE_116, BOOST_PP_NODE_124) # define BOOST_PP_NODE_116(p) BOOST_PP_IIF(p(116), BOOST_PP_NODE_114, BOOST_PP_NODE_118) # define BOOST_PP_NODE_114(p) BOOST_PP_IIF(p(114), BOOST_PP_NODE_113, BOOST_PP_NODE_115) # define BOOST_PP_NODE_113(p) BOOST_PP_IIF(p(113), 113, 114) # define BOOST_PP_NODE_115(p) BOOST_PP_IIF(p(115), 115, 116) # define BOOST_PP_NODE_118(p) BOOST_PP_IIF(p(118), BOOST_PP_NODE_117, BOOST_PP_NODE_119) # define BOOST_PP_NODE_117(p) BOOST_PP_IIF(p(117), 117, 118) # define BOOST_PP_NODE_119(p) BOOST_PP_IIF(p(119), 119, 120) # define BOOST_PP_NODE_124(p) BOOST_PP_IIF(p(124), BOOST_PP_NODE_122, BOOST_PP_NODE_126) # define BOOST_PP_NODE_122(p) BOOST_PP_IIF(p(122), BOOST_PP_NODE_121, BOOST_PP_NODE_123) # define BOOST_PP_NODE_121(p) BOOST_PP_IIF(p(121), 121, 122) # define BOOST_PP_NODE_123(p) BOOST_PP_IIF(p(123), 123, 124) # define BOOST_PP_NODE_126(p) BOOST_PP_IIF(p(126), BOOST_PP_NODE_125, BOOST_PP_NODE_127) # define BOOST_PP_NODE_125(p) BOOST_PP_IIF(p(125), 125, 126) # define BOOST_PP_NODE_127(p) BOOST_PP_IIF(p(127), 127, 128) # define BOOST_PP_NODE_192(p) BOOST_PP_IIF(p(192), BOOST_PP_NODE_160, BOOST_PP_NODE_224) # define BOOST_PP_NODE_160(p) BOOST_PP_IIF(p(160), BOOST_PP_NODE_144, BOOST_PP_NODE_176) # define BOOST_PP_NODE_144(p) BOOST_PP_IIF(p(144), BOOST_PP_NODE_136, BOOST_PP_NODE_152) # define BOOST_PP_NODE_136(p) BOOST_PP_IIF(p(136), BOOST_PP_NODE_132, BOOST_PP_NODE_140) # define BOOST_PP_NODE_132(p) BOOST_PP_IIF(p(132), BOOST_PP_NODE_130, BOOST_PP_NODE_134) # define BOOST_PP_NODE_130(p) BOOST_PP_IIF(p(130), BOOST_PP_NODE_129, BOOST_PP_NODE_131) # define BOOST_PP_NODE_129(p) BOOST_PP_IIF(p(129), 129, 130) # define BOOST_PP_NODE_131(p) BOOST_PP_IIF(p(131), 131, 132) # define BOOST_PP_NODE_134(p) BOOST_PP_IIF(p(134), BOOST_PP_NODE_133, BOOST_PP_NODE_135) # define BOOST_PP_NODE_133(p) BOOST_PP_IIF(p(133), 133, 134) # define BOOST_PP_NODE_135(p) BOOST_PP_IIF(p(135), 135, 136) # define BOOST_PP_NODE_140(p) BOOST_PP_IIF(p(140), BOOST_PP_NODE_138, BOOST_PP_NODE_142) # define BOOST_PP_NODE_138(p) BOOST_PP_IIF(p(138), BOOST_PP_NODE_137, BOOST_PP_NODE_139) # define BOOST_PP_NODE_137(p) BOOST_PP_IIF(p(137), 137, 138) # define BOOST_PP_NODE_139(p) BOOST_PP_IIF(p(139), 139, 140) # define BOOST_PP_NODE_142(p) BOOST_PP_IIF(p(142), BOOST_PP_NODE_141, BOOST_PP_NODE_143) # define BOOST_PP_NODE_141(p) BOOST_PP_IIF(p(141), 141, 142) # define BOOST_PP_NODE_143(p) BOOST_PP_IIF(p(143), 143, 144) # define BOOST_PP_NODE_152(p) BOOST_PP_IIF(p(152), BOOST_PP_NODE_148, BOOST_PP_NODE_156) # define BOOST_PP_NODE_148(p) BOOST_PP_IIF(p(148), BOOST_PP_NODE_146, BOOST_PP_NODE_150) # define BOOST_PP_NODE_146(p) BOOST_PP_IIF(p(146), BOOST_PP_NODE_145, BOOST_PP_NODE_147) # define BOOST_PP_NODE_145(p) BOOST_PP_IIF(p(145), 145, 146) # define BOOST_PP_NODE_147(p) BOOST_PP_IIF(p(147), 147, 148) # define BOOST_PP_NODE_150(p) BOOST_PP_IIF(p(150), BOOST_PP_NODE_149, BOOST_PP_NODE_151) # define BOOST_PP_NODE_149(p) BOOST_PP_IIF(p(149), 149, 150) # define BOOST_PP_NODE_151(p) BOOST_PP_IIF(p(151), 151, 152) # define BOOST_PP_NODE_156(p) BOOST_PP_IIF(p(156), BOOST_PP_NODE_154, BOOST_PP_NODE_158) # define BOOST_PP_NODE_154(p) BOOST_PP_IIF(p(154), BOOST_PP_NODE_153, BOOST_PP_NODE_155) # define BOOST_PP_NODE_153(p) BOOST_PP_IIF(p(153), 153, 154) # define BOOST_PP_NODE_155(p) BOOST_PP_IIF(p(155), 155, 156) # define BOOST_PP_NODE_158(p) BOOST_PP_IIF(p(158), BOOST_PP_NODE_157, BOOST_PP_NODE_159) # define BOOST_PP_NODE_157(p) BOOST_PP_IIF(p(157), 157, 158) # define BOOST_PP_NODE_159(p) BOOST_PP_IIF(p(159), 159, 160) # define BOOST_PP_NODE_176(p) BOOST_PP_IIF(p(176), BOOST_PP_NODE_168, BOOST_PP_NODE_184) # define BOOST_PP_NODE_168(p) BOOST_PP_IIF(p(168), BOOST_PP_NODE_164, BOOST_PP_NODE_172) # define BOOST_PP_NODE_164(p) BOOST_PP_IIF(p(164), BOOST_PP_NODE_162, BOOST_PP_NODE_166) # define BOOST_PP_NODE_162(p) BOOST_PP_IIF(p(162), BOOST_PP_NODE_161, BOOST_PP_NODE_163) # define BOOST_PP_NODE_161(p) BOOST_PP_IIF(p(161), 161, 162) # define BOOST_PP_NODE_163(p) BOOST_PP_IIF(p(163), 163, 164) # define BOOST_PP_NODE_166(p) BOOST_PP_IIF(p(166), BOOST_PP_NODE_165, BOOST_PP_NODE_167) # define BOOST_PP_NODE_165(p) BOOST_PP_IIF(p(165), 165, 166) # define BOOST_PP_NODE_167(p) BOOST_PP_IIF(p(167), 167, 168) # define BOOST_PP_NODE_172(p) BOOST_PP_IIF(p(172), BOOST_PP_NODE_170, BOOST_PP_NODE_174) # define BOOST_PP_NODE_170(p) BOOST_PP_IIF(p(170), BOOST_PP_NODE_169, BOOST_PP_NODE_171) # define BOOST_PP_NODE_169(p) BOOST_PP_IIF(p(169), 169, 170) # define BOOST_PP_NODE_171(p) BOOST_PP_IIF(p(171), 171, 172) # define BOOST_PP_NODE_174(p) BOOST_PP_IIF(p(174), BOOST_PP_NODE_173, BOOST_PP_NODE_175) # define BOOST_PP_NODE_173(p) BOOST_PP_IIF(p(173), 173, 174) # define BOOST_PP_NODE_175(p) BOOST_PP_IIF(p(175), 175, 176) # define BOOST_PP_NODE_184(p) BOOST_PP_IIF(p(184), BOOST_PP_NODE_180, BOOST_PP_NODE_188) # define BOOST_PP_NODE_180(p) BOOST_PP_IIF(p(180), BOOST_PP_NODE_178, BOOST_PP_NODE_182) # define BOOST_PP_NODE_178(p) BOOST_PP_IIF(p(178), BOOST_PP_NODE_177, BOOST_PP_NODE_179) # define BOOST_PP_NODE_177(p) BOOST_PP_IIF(p(177), 177, 178) # define BOOST_PP_NODE_179(p) BOOST_PP_IIF(p(179), 179, 180) # define BOOST_PP_NODE_182(p) BOOST_PP_IIF(p(182), BOOST_PP_NODE_181, BOOST_PP_NODE_183) # define BOOST_PP_NODE_181(p) BOOST_PP_IIF(p(181), 181, 182) # define BOOST_PP_NODE_183(p) BOOST_PP_IIF(p(183), 183, 184) # define BOOST_PP_NODE_188(p) BOOST_PP_IIF(p(188), BOOST_PP_NODE_186, BOOST_PP_NODE_190) # define BOOST_PP_NODE_186(p) BOOST_PP_IIF(p(186), BOOST_PP_NODE_185, BOOST_PP_NODE_187) # define BOOST_PP_NODE_185(p) BOOST_PP_IIF(p(185), 185, 186) # define BOOST_PP_NODE_187(p) BOOST_PP_IIF(p(187), 187, 188) # define BOOST_PP_NODE_190(p) BOOST_PP_IIF(p(190), BOOST_PP_NODE_189, BOOST_PP_NODE_191) # define BOOST_PP_NODE_189(p) BOOST_PP_IIF(p(189), 189, 190) # define BOOST_PP_NODE_191(p) BOOST_PP_IIF(p(191), 191, 192) # define BOOST_PP_NODE_224(p) BOOST_PP_IIF(p(224), BOOST_PP_NODE_208, BOOST_PP_NODE_240) # define BOOST_PP_NODE_208(p) BOOST_PP_IIF(p(208), BOOST_PP_NODE_200, BOOST_PP_NODE_216) # define BOOST_PP_NODE_200(p) BOOST_PP_IIF(p(200), BOOST_PP_NODE_196, BOOST_PP_NODE_204) # define BOOST_PP_NODE_196(p) BOOST_PP_IIF(p(196), BOOST_PP_NODE_194, BOOST_PP_NODE_198) # define BOOST_PP_NODE_194(p) BOOST_PP_IIF(p(194), BOOST_PP_NODE_193, BOOST_PP_NODE_195) # define BOOST_PP_NODE_193(p) BOOST_PP_IIF(p(193), 193, 194) # define BOOST_PP_NODE_195(p) BOOST_PP_IIF(p(195), 195, 196) # define BOOST_PP_NODE_198(p) BOOST_PP_IIF(p(198), BOOST_PP_NODE_197, BOOST_PP_NODE_199) # define BOOST_PP_NODE_197(p) BOOST_PP_IIF(p(197), 197, 198) # define BOOST_PP_NODE_199(p) BOOST_PP_IIF(p(199), 199, 200) # define BOOST_PP_NODE_204(p) BOOST_PP_IIF(p(204), BOOST_PP_NODE_202, BOOST_PP_NODE_206) # define BOOST_PP_NODE_202(p) BOOST_PP_IIF(p(202), BOOST_PP_NODE_201, BOOST_PP_NODE_203) # define BOOST_PP_NODE_201(p) BOOST_PP_IIF(p(201), 201, 202) # define BOOST_PP_NODE_203(p) BOOST_PP_IIF(p(203), 203, 204) # define BOOST_PP_NODE_206(p) BOOST_PP_IIF(p(206), BOOST_PP_NODE_205, BOOST_PP_NODE_207) # define BOOST_PP_NODE_205(p) BOOST_PP_IIF(p(205), 205, 206) # define BOOST_PP_NODE_207(p) BOOST_PP_IIF(p(207), 207, 208) # define BOOST_PP_NODE_216(p) BOOST_PP_IIF(p(216), BOOST_PP_NODE_212, BOOST_PP_NODE_220) # define BOOST_PP_NODE_212(p) BOOST_PP_IIF(p(212), BOOST_PP_NODE_210, BOOST_PP_NODE_214) # define BOOST_PP_NODE_210(p) BOOST_PP_IIF(p(210), BOOST_PP_NODE_209, BOOST_PP_NODE_211) # define BOOST_PP_NODE_209(p) BOOST_PP_IIF(p(209), 209, 210) # define BOOST_PP_NODE_211(p) BOOST_PP_IIF(p(211), 211, 212) # define BOOST_PP_NODE_214(p) BOOST_PP_IIF(p(214), BOOST_PP_NODE_213, BOOST_PP_NODE_215) # define BOOST_PP_NODE_213(p) BOOST_PP_IIF(p(213), 213, 214) # define BOOST_PP_NODE_215(p) BOOST_PP_IIF(p(215), 215, 216) # define BOOST_PP_NODE_220(p) BOOST_PP_IIF(p(220), BOOST_PP_NODE_218, BOOST_PP_NODE_222) # define BOOST_PP_NODE_218(p) BOOST_PP_IIF(p(218), BOOST_PP_NODE_217, BOOST_PP_NODE_219) # define BOOST_PP_NODE_217(p) BOOST_PP_IIF(p(217), 217, 218) # define BOOST_PP_NODE_219(p) BOOST_PP_IIF(p(219), 219, 220) # define BOOST_PP_NODE_222(p) BOOST_PP_IIF(p(222), BOOST_PP_NODE_221, BOOST_PP_NODE_223) # define BOOST_PP_NODE_221(p) BOOST_PP_IIF(p(221), 221, 222) # define BOOST_PP_NODE_223(p) BOOST_PP_IIF(p(223), 223, 224) # define BOOST_PP_NODE_240(p) BOOST_PP_IIF(p(240), BOOST_PP_NODE_232, BOOST_PP_NODE_248) # define BOOST_PP_NODE_232(p) BOOST_PP_IIF(p(232), BOOST_PP_NODE_228, BOOST_PP_NODE_236) # define BOOST_PP_NODE_228(p) BOOST_PP_IIF(p(228), BOOST_PP_NODE_226, BOOST_PP_NODE_230) # define BOOST_PP_NODE_226(p) BOOST_PP_IIF(p(226), BOOST_PP_NODE_225, BOOST_PP_NODE_227) # define BOOST_PP_NODE_225(p) BOOST_PP_IIF(p(225), 225, 226) # define BOOST_PP_NODE_227(p) BOOST_PP_IIF(p(227), 227, 228) # define BOOST_PP_NODE_230(p) BOOST_PP_IIF(p(230), BOOST_PP_NODE_229, BOOST_PP_NODE_231) # define BOOST_PP_NODE_229(p) BOOST_PP_IIF(p(229), 229, 230) # define BOOST_PP_NODE_231(p) BOOST_PP_IIF(p(231), 231, 232) # define BOOST_PP_NODE_236(p) BOOST_PP_IIF(p(236), BOOST_PP_NODE_234, BOOST_PP_NODE_238) # define BOOST_PP_NODE_234(p) BOOST_PP_IIF(p(234), BOOST_PP_NODE_233, BOOST_PP_NODE_235) # define BOOST_PP_NODE_233(p) BOOST_PP_IIF(p(233), 233, 234) # define BOOST_PP_NODE_235(p) BOOST_PP_IIF(p(235), 235, 236) # define BOOST_PP_NODE_238(p) BOOST_PP_IIF(p(238), BOOST_PP_NODE_237, BOOST_PP_NODE_239) # define BOOST_PP_NODE_237(p) BOOST_PP_IIF(p(237), 237, 238) # define BOOST_PP_NODE_239(p) BOOST_PP_IIF(p(239), 239, 240) # define BOOST_PP_NODE_248(p) BOOST_PP_IIF(p(248), BOOST_PP_NODE_244, BOOST_PP_NODE_252) # define BOOST_PP_NODE_244(p) BOOST_PP_IIF(p(244), BOOST_PP_NODE_242, BOOST_PP_NODE_246) # define BOOST_PP_NODE_242(p) BOOST_PP_IIF(p(242), BOOST_PP_NODE_241, BOOST_PP_NODE_243) # define BOOST_PP_NODE_241(p) BOOST_PP_IIF(p(241), 241, 242) # define BOOST_PP_NODE_243(p) BOOST_PP_IIF(p(243), 243, 244) # define BOOST_PP_NODE_246(p) BOOST_PP_IIF(p(246), BOOST_PP_NODE_245, BOOST_PP_NODE_247) # define BOOST_PP_NODE_245(p) BOOST_PP_IIF(p(245), 245, 246) # define BOOST_PP_NODE_247(p) BOOST_PP_IIF(p(247), 247, 248) # define BOOST_PP_NODE_252(p) BOOST_PP_IIF(p(252), BOOST_PP_NODE_250, BOOST_PP_NODE_254) # define BOOST_PP_NODE_250(p) BOOST_PP_IIF(p(250), BOOST_PP_NODE_249, BOOST_PP_NODE_251) # define BOOST_PP_NODE_249(p) BOOST_PP_IIF(p(249), 249, 250) # define BOOST_PP_NODE_251(p) BOOST_PP_IIF(p(251), 251, 252) # define BOOST_PP_NODE_254(p) BOOST_PP_IIF(p(254), BOOST_PP_NODE_253, BOOST_PP_NODE_255) # define BOOST_PP_NODE_253(p) BOOST_PP_IIF(p(253), 253, 254) # define BOOST_PP_NODE_255(p) BOOST_PP_IIF(p(255), 255, 256) # # endif # endif
{ "pile_set_name": "Github" }
apiVersion: v1 data: MYSQL_ROOT_PASSWORD: ?{base64:targets/all-glob/mysql/password:3192c15c} MYSQL_ROOT_PASSWORD_SHA256: ?{base64:targets/all-glob/mysql/password_sha256:a18bc263} kind: Secret metadata: annotations: {} labels: name: glob_instance name: glob_instance namespace: all-glob type: Opaque
{ "pile_set_name": "Github" }
/*! { "name": "ES5 String", "property": "es5string", "notes": [{ "name": "ECMAScript 5.1 Language Specification", "href": "http://www.ecma-international.org/ecma-262/5.1/" }], "polyfills": ["es5shim"], "authors": ["Ron Waldon (@jokeyrhyme)"], "tags": ["es5"] } !*/ /* DOC Check if browser implements ECMAScript 5 String per specification. */ define(['Modernizr'], function(Modernizr) { Modernizr.addTest('es5string', function() { return !!(String.prototype && String.prototype.trim); }); });
{ "pile_set_name": "Github" }
$(if custom_methods and #custom_methods > 0 then OUT = [[ // // Custom Methods // ]] for i=1,#custom_methods do OUT=OUT..'\n' OUT=OUT..custom_methods[i].return_type..[[ ${name}::]]..custom_methods[i].name..'(' if custom_methods[i].parameters then for pnum=1,#custom_methods[i].parameters do if pnum > 1 then OUT=OUT..', ' end OUT=OUT..custom_methods[i].parameters[pnum].type ..' '.. custom_methods[i].parameters[pnum].var_name end end OUT=OUT..[[ ) { ]]..custom_methods[i].body..[[ } ]] end end)
{ "pile_set_name": "Github" }
 Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AsyncStreamingTcpServer", "AsyncStreamingTcpServer.vcproj", "{FB8CC898-3E55-4695-839B-870D28D1A036}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Itanium = Debug|Itanium Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Itanium = Release|Itanium Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {FB8CC898-3E55-4695-839B-870D28D1A036}.Debug|Itanium.ActiveCfg = Debug|Itanium {FB8CC898-3E55-4695-839B-870D28D1A036}.Debug|Itanium.Build.0 = Debug|Itanium {FB8CC898-3E55-4695-839B-870D28D1A036}.Debug|Win32.ActiveCfg = Debug|Win32 {FB8CC898-3E55-4695-839B-870D28D1A036}.Debug|Win32.Build.0 = Debug|Win32 {FB8CC898-3E55-4695-839B-870D28D1A036}.Debug|x64.ActiveCfg = Debug|x64 {FB8CC898-3E55-4695-839B-870D28D1A036}.Debug|x64.Build.0 = Debug|x64 {FB8CC898-3E55-4695-839B-870D28D1A036}.Release|Itanium.ActiveCfg = Release|Itanium {FB8CC898-3E55-4695-839B-870D28D1A036}.Release|Itanium.Build.0 = Release|Itanium {FB8CC898-3E55-4695-839B-870D28D1A036}.Release|Win32.ActiveCfg = Release|Win32 {FB8CC898-3E55-4695-839B-870D28D1A036}.Release|Win32.Build.0 = Release|Win32 {FB8CC898-3E55-4695-839B-870D28D1A036}.Release|x64.ActiveCfg = Release|x64 {FB8CC898-3E55-4695-839B-870D28D1A036}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal
{ "pile_set_name": "Github" }
using NUnit.Framework; using Warewolf.Options; namespace Warewolf.Data.Options.Tests { [TestFixture] public class ConditionExpressionTests { [Test] public void ConditionExpression_GivenMatchExpression() { var condition = new ConditionExpression { Left = "[[a]]", Cond = new ConditionMatch { MatchType = enDecisionType.IsEqual, Right = "bob" } }; var result = condition.ToString(); Assert.AreEqual("[[a]] = bob", result); } [Test] public void ConditionExpression_GivenBetweenExpression() { var condition = new ConditionExpression { Left = "[[a]]", Cond = new ConditionBetween() { MatchType = enDecisionType.IsBetween, From = "2", To = "10", } }; var result = condition.ToString(); Assert.AreEqual("[[a]] is greater than 2 and less than 10", result); } [Test] public void ConditionExpression_GivenNotBetweenExpression() { var condition = new ConditionExpression { Left = "[[a]]", Cond = new ConditionBetween() { MatchType = enDecisionType.NotBetween, From = "2", To = "10", } }; var result = condition.ToString(); Assert.AreEqual("[[a]] is less than 2 and more than 10", result); } [Test] public void ConditionExpression_GivenIsSingleOperand() { var condition = new ConditionExpression { Left = "[[a]]", Cond = new ConditionMatch() { MatchType = enDecisionType.IsNull, Right = "2", } }; var result = condition.ToString(); Assert.AreEqual("[[a]] Is NULL", result); } [Test] public void ConditionExpression_ToOptions() { var condition = new ConditionExpression { Left = "[[a]]", Cond = new ConditionBetween() { MatchType = enDecisionType.NotBetween, From = "2", To = "10", } }; var result = condition.ToOptions(); Assert.AreEqual(typeof(OptionConditionExpression), result[0].GetType()); var optionConditionExpression = result[0] as OptionConditionExpression; Assert.IsNotNull(optionConditionExpression); Assert.AreEqual("[[a]]", optionConditionExpression.Left); Assert.AreEqual(enDecisionType.NotBetween, optionConditionExpression.MatchType); Assert.AreEqual("Not Between", optionConditionExpression.SelectedMatchType.Name); Assert.AreEqual(32, optionConditionExpression.SelectedMatchType.Value); Assert.AreEqual("2", optionConditionExpression.From); Assert.AreEqual("10", optionConditionExpression.To); } } }
{ "pile_set_name": "Github" }
/* * Copyright 2016 Hans de Goede <[email protected]> * * This file is dual-licensed: you can use it either under the terms * of the GPL or the X11 license, at your option. Note that this dual * licensing only applies to this file, and not this project as a * whole. * * a) This file 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 file 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. * * Or, alternatively, * * b) 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. */ /dts-v1/; #include "sun5i-a13.dtsi" #include "sun5i-reference-design-tablet.dtsi" #include <dt-bindings/interrupt-controller/irq.h> / { model = "Empire Electronix M712 tablet"; compatible = "empire-electronix,m712", "allwinner,sun5i-a13"; };
{ "pile_set_name": "Github" }
/* * Copyright (C) 2008 Apple Inc. 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 Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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. */ #ifndef WebScriptDebugger_h #define WebScriptDebugger_h #include <heap/Strong.h> #include <debugger/Debugger.h> #include <wtf/RetainPtr.h> namespace JSC { class DebuggerCallFrame; class ExecState; class JSGlobalObject; class JSObject; class ArgList; class UString; } @class WebScriptCallFrame; NSString *toNSString(const JSC::UString&); class WebScriptDebugger : public JSC::Debugger { public: WebScriptDebugger(JSC::JSGlobalObject*); void initGlobalCallFrame(const JSC::DebuggerCallFrame&); virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const JSC::UString& errorMsg); virtual void callEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber); virtual void atStatement(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber); virtual void returnEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber); virtual void exception(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber, bool hasHandler); virtual void willExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno); virtual void didExecuteProgram(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno); virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineno); JSC::JSGlobalObject* globalObject() const { return m_globalObject.get(); } WebScriptCallFrame *globalCallFrame() const { return m_globalCallFrame.get(); } private: bool m_callingDelegate; RetainPtr<WebScriptCallFrame> m_topCallFrame; JSC::Strong<JSC::JSGlobalObject> m_globalObject; RetainPtr<WebScriptCallFrame> m_globalCallFrame; }; #endif // WebScriptDebugger_h
{ "pile_set_name": "Github" }
from wfdb.io.record import (Record, MultiRecord, rdheader, rdrecord, rdsamp, wrsamp, dl_database, edf2mit, mit2edf, wav2mit, mit2wav, wfdb2mat, sampfreq, signame, SIGNAL_CLASSES) from wfdb.io._signal import est_res, wr_dat_file from wfdb.io.annotation import (Annotation, rdann, wrann, show_ann_labels, show_ann_classes, ann2rr) from wfdb.io.download import get_dbs, get_record_list, dl_files, set_db_index_url from wfdb.io.tff import rdtff
{ "pile_set_name": "Github" }
// A sample QUnit test QUnit.test("equal test", function (assert) { assert.equal( 0, 0, "Zero, Zero; equal succeeds" ); assert.equal( "", 0, "Empty, Zero; equal succeeds" ); assert.equal( "", "", "Empty, Empty; equal succeeds" ); assert.equal( 0, false, "Zero, false; equal succeeds" ); });
{ "pile_set_name": "Github" }
/** * @typedef {object} Phaser.Types.Loader.XHRSettingsObject * @since 3.0.0 * * @property {XMLHttpRequestResponseType} responseType - The response type of the XHR request, i.e. `blob`, `text`, etc. * @property {boolean} [async=true] - Should the XHR request use async or not? * @property {string} [user=''] - Optional username for the XHR request. * @property {string} [password=''] - Optional password for the XHR request. * @property {integer} [timeout=0] - Optional XHR timeout value. * @property {(object|undefined)} [headers] - This value is used to populate the XHR `setRequestHeader` and is undefined by default. * @property {(string|undefined)} [header] - This value is used to populate the XHR `setRequestHeader` and is undefined by default. * @property {(string|undefined)} [headerValue] - This value is used to populate the XHR `setRequestHeader` and is undefined by default. * @property {(string|undefined)} [requestedWith] - This value is used to populate the XHR `setRequestHeader` and is undefined by default. * @property {(string|undefined)} [overrideMimeType] - Provide a custom mime-type to use instead of the default. * @property {boolean} [withCredentials=false] - The withCredentials property indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates. Setting withCredentials has no effect on same-site requests. */
{ "pile_set_name": "Github" }
package client import ( "net/url" "github.com/docker/docker/api/types" "golang.org/x/net/context" ) // NodeRemove removes a Node. func (cli *Client) NodeRemove(ctx context.Context, nodeID string, options types.NodeRemoveOptions) error { query := url.Values{} if options.Force { query.Set("force", "1") } resp, err := cli.delete(ctx, "/nodes/"+nodeID, query, nil) ensureReaderClosed(resp) return err }
{ "pile_set_name": "Github" }
using Chloe.Infrastructure; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; namespace Chloe.SqlServer { public class DefaultDbConnectionFactory : IDbConnectionFactory { string _connString; public DefaultDbConnectionFactory(string connString) { Utils.CheckNull(connString, "connString"); this._connString = connString; } public IDbConnection CreateConnection() { SqlConnection conn = new SqlConnection(this._connString); return conn; } } }
{ "pile_set_name": "Github" }
# Expressions Delve can evaluate a subset of go expression language, specifically the following features are supported: - All (binary and unary) on basic types except <-, ++ and -- - Comparison operators on any type - Type casts between numeric types - Type casts of integer constants into any pointer type and vice versa - Type casts between string, []byte and []rune - Struct member access (i.e. `somevar.memberfield`) - Slicing and indexing operators on arrays, slices and strings - Map access - Pointer dereference - Calls to builtin functions: `cap`, `len`, `complex`, `imag` and `real` - Type assertion on interface variables (i.e. `somevar.(concretetype)`) # Nesting limit When delve evaluates a memory address it will automatically return the value of nested struct members, array and slice items and dereference pointers. However to limit the size of the output evaluation will be limited to two levels deep. Beyond two levels only the address of the item will be returned, for example: ``` (dlv) print c1 main.cstruct { pb: *struct main.bstruct { a: (*main.astruct)(0xc82000a430), }, sa: []*main.astruct len: 3, cap: 3, [ *(*main.astruct)(0xc82000a440), *(*main.astruct)(0xc82000a450), *(*main.astruct)(0xc82000a460), ], } ``` To see the contents of the first item of the slice `c1.sa` there are two possibilities: 1. Execute `print c1.sa[0]` 2. Use the address directly, executing: `print *(*main.astruct)(0xc82000a440)` # Elements limit For arrays, slices, strings and maps delve will only return a maximum of 64 elements at a time: ``` (dlv) print ba []int len: 200, cap: 200, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...+136 more] ``` To see more values use the slice operator: ``` (dlv) print ba[64:] []int len: 136, cap: 136, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...+72 more] ``` For this purpose delve allows use of the slice operator on maps, `m[64:]` will return the key/value pairs of map `m` that follow the first 64 key/value pairs (note that delve iterates over maps using a fixed ordering). These limits can be configured with `max-string-len` and `max-array-values`. See [config](https://github.com/go-delve/delve/tree/master/Documentation/cli#config) for usage. # Interfaces Interfaces will be printed using the following syntax: ``` <interface name>(<concrete type>) <value> ``` For example: ``` (dlv) p iface1 (dlv) p iface1 interface {}(*struct main.astruct) *{A: 1, B: 2} (dlv) p iface2 interface {}(*struct string) *"test" (dlv) p err1 error(*struct main.astruct) *{A: 1, B: 2} ``` To use the contents of an interface variable use a type assertion: ``` (dlv) p iface1.(*main.astruct).B 2 ``` Or just use the special `.(data)` type assertion: ``` (dlv) p iface1.(data).B 2 ``` If the contents of the interface variable are a struct or a pointer to struct the fields can also be accessed directly: ``` (dlv) p iface1.B 2 ``` # Specifying package paths Packages with the same name can be disambiguated by using the full package path. For example, if the application imports two packages, `some/package` and `some/other/package`, both defining a variable `A`, the two variables can be accessed using this syntax: ``` (dlv) p "some/package".A (dlv) p "some/other/package".A ``` # Pointers in Cgo Char pointers are always treated as NUL terminated strings, both indexing and the slice operator can be applied to them. Other C pointers can also be used similarly to Go slices, with indexing and the slice operator. In both of these cases it is up to the user to respect array bounds.
{ "pile_set_name": "Github" }
# -*- coding: utf-8 -*- # frozen_string_literal: true require 'utils/ArithmeticEvaluator' require 'utils/format' require 'utils/normalize' require 'utils/table' require 'utils/d66_grid_table' # ビーストバインド トリニティのダイスボット # # = 前ver(1.43.07)からの変更・修正 # * nBBで判定を行う際、「ダイスを1個しか振らない場合」の達成値計算が正しくなかった誤りを修正。 # * @x(クリティカル値指定)、を加減式で入力できるように仕様変更。クリティカル値は、加減式での入力なら%w(人間性からのクリティカル値計算)と併用可能に。 # * #y(ファンブル値指定)を加減式で入力できるように仕様変更。また、「ファンブルしても達成値が0にならない」モード#Ayを追加。 # * &v(出目v未満のダイスを出目vとして扱う)のモードを追加。2018年12月現在、ゲーマーズ・フィールド誌先行収録データでのみ使用するモードです。 # * 「暴露表」および「正体判明チャート」をダイスボットに組み込み。 # * どどんとふ以外のボーンズ&カーズを用いたオンラインセッション用ツールにあわせ、ヘルプメッセージ部分からイニシアティブ表についての言及を削除。 class BeastBindTrinity < DiceBot # ゲームシステムの識別子 ID = 'BeastBindTrinity' # ゲームシステム名 NAME = 'ビーストバインド トリニティ' # ゲームシステム名の読みがな SORT_KEY = 'ひいすとはいんととりにてい' # ダイスボットの使い方 HELP_MESSAGE = <<INFO_MESSAGE_TEXT ・判定 (nBB+m%w@x#y$z&v)  n個のD6を振り、出目の大きい2個から達成値を算出。修正mも可能。  %w、@x、#y、$z、&vはすべて省略可能。 >%w:現在の人間性が w であるとして、クリティカル値(C値)を計算。 ・省略した場合、C値=12として達成値を算出する。 >@x:クリティカル値修正。(加減式でも入力可能) ・xに直接数字を書くと、C値をその数字に上書きする。  「絶対にクリティカルしない」状態は、@13など xを13以上に指定すること。 ・xの先頭が「+」か「-」なら、計算したC値にその値を加算。例)@-1、@+2  この方法でC値をプラスする場合、上限は12となる。 >#y、#Ay:ファンブル値修正。(加減式でも入力可能) ・yに直接数字を書くと、ファンブル値をその数字に設定。 ・yの数字の先頭が「+」か「-」なら、ファンブル値=2にその数字を加算。例)#+2 ・※#Ayとすると、ファンブルしても達成値を通常通り算出。 例)#A+1 >$z:ダイスの出目をzに固定して判定する。複数指定可。    《運命歪曲》など「ダイスの1個を振り直す」効果等に使用する。  例)2BB$1 →ダイスを2個振る判定で、ダイス1個の出目を1で固定  例)2BB$16→ダイスを2個振る判定で、ダイスの出目を1と6で固定 >&v:出目がv未満のダイスがあれば、出目がvだったものとして達成値を計算する。  例)2BB&3 →出目3未満(→出目1、2)を出目3だったものとして計算。 ・D66ダイスあり ・邂逅表:EMO ・暴露表:EXPO_A ・魔獣化暴露表:EXPO_B ・アイドル専用暴露表:EXPO_I ・アイドル専用魔獣化暴露表:EXPO_J ・正体判明チャートA~C:FACE_A, FACE_B, FACE_C INFO_MESSAGE_TEXT def initialize super @sendMode = 2 @sortType = 0 @d66Type = 2 end class BBCommand def initialize(command) @command = command parse() end def roll(bot) if @parse_error return nil end @bot = bot dice_list_org = roll_with_dice_pool() if dice_list_org.empty? return "ERROR:振るダイスの数が0個です" end dice_list_filtered = dice_list_org.map { |dice| [dice, @dice_value_lower_limit].max }.sort @dice_total = dice_list_filtered.inject(0, :+) total = calc_total() dice_list_org_str = "[#{dice_list_org.join(',')}]" if dice_list_filtered != dice_list_org sequence = [ command_expr(), dice_list_org_str, interim_expr(dice_list_filtered), dice_status(), total.to_s, result_compare(total) ].compact return sequence.join(" > ") end private def parse() m = /^(\d+)(?:R6|BB6?)((?:[\+\-]\d+)+)?(?:%(\-?\d+))?(?:@([\+\-\d]+))?(?:#(A)?([\+\-\d]+))?(?:\$([1-6]+))?(?:&([1-6]))?(?:([>=]+)(\d+))?$/.match(@command) unless m @parse_error = true return end @dice_num = m[1].to_i @modify_number = m[2] ? ArithmeticEvaluator.new.eval(m[2]) : 0 @critical = parse_critical(m[3], m[4]) @keep_value_on_fumble = !m[5].nil? @fumble = parse_fumble(m[6]) @dice_pool = m[7] ? m[7].split("").map(&:to_i) : [] @dice_pool.pop(@dice_pool.size - @dice_num) if @dice_pool.size > @dice_num @dice_value_lower_limit = m[8].to_i @cmp_op = Normalize.comparison_operator(m[9]) @target_number = m[10] && m[10].to_i @parse_error = false end # @param humanity [String, nil] # @param atmark [String, nil] # @return [Integer] def parse_critical(humanity, atmark) humanity = humanity ? humanity.to_i : 99 atmark_value = atmark ? ArithmeticEvaluator.new.eval(atmark) : 0 critical = if /^[+-]/.match(atmark) [critical_from_humanity(humanity) + atmark_value, 12].min elsif atmark atmark_value else critical_from_humanity(humanity) end return critical end def critical_from_humanity(humanity) if humanity <= 0 9 elsif humanity <= 20 10 elsif humanity <= 40 11 else 12 end end # @param sharp [String, nil] # @return [Integer] def parse_fumble(sharp) sharp_value = sharp ? ArithmeticEvaluator.new.eval(sharp) : 0 if /^[+-]/.match(sharp) 2 + sharp_value elsif sharp sharp_value else 2 end end def roll_with_dice_pool dice_times = @dice_num - @dice_pool.size dice_list = Array.new(dice_times) { @bot.roll(1, 6)[0] } + @dice_pool return dice_list.sort end def command_expr modifier = Format.modifier(@modify_number) "(#{@dice_num}BB#{modifier}@#{@critical}\##{@fumble}#{@cmp_op}#{@target_number})" end def interim_expr(dice_list) expr = "#{@dice_total}[#{dice_list.join(',')}]#{Format.modifier(@modify_number)}" expr += "+20" if critical? return expr end def dice_status if fumble? "ファンブル" elsif critical? "クリティカル" end end def fumble? @dice_total <= @fumble end def critical? @dice_total >= @critical end def calc_total total = @dice_total + @modify_number if fumble? total = 0 unless @keep_value_on_fumble elsif critical? total += 20 end if total < 0 total = 0 end return total end def result_compare(total) if @cmp_op total.send(@cmp_op, @target_number) ? "成功" : "失敗" end end end def rollDiceCommand(command) if (ret = roll_tables(command, TABLES)) return ret end bb = BBCommand.new(command) return bb.roll(self) end TABLES = { 'EMO' => D66GridTable.new( '邂逅表', [ ['家族', '家族', '信頼', '信頼', '忘却', '忘却'], ['慈愛', '慈愛', '憧憬', '憧憬', '感銘', '感銘'], ['同志', '同志', '幼子', '幼子', '興味', '興味'], ['ビジネス', 'ビジネス', '師事', '師事', '好敵手', '好敵手'], ['友情', '友情', '忠誠', '忠誠', '恐怖', '恐怖'], ['執着', '執着', '軽蔑', '軽蔑', '憎悪', '憎悪'], ] ), 'EXPO_A' => Table.new( '暴露表', '1D6', [ '噂になるがすぐ忘れられる', '都市伝説として処理される', 'ワイドショーをにぎわす', 'シナリオ中[迫害状態]になる', '絆の対象ひとりに正体が知られる', '魔獣化暴露表へ' ] ), 'EXPO_B' => Table.new( '魔獣化暴露表', '1D6', [ 'トンデモ業界の伝説になる', 'シナリオ中[迫害状態]になる', 'シナリオ中[迫害状態]になる', '絆の対象ひとりに正体が知られる', '絆の対象ひとりに正体が知られる', '自衛隊退魔部隊×2D6体の襲撃' ] ), 'EXPO_I' => Table.new( 'アイドル専用暴露表', '1D6', [ '愉快な伝説として人気になる', 'ワイドショーをにぎわす', '炎上。シナリオ中[迫害状態]', '所属事務所に2D6時間説教される', '絆の対象ひとりに正体が知られる', 'アイドル専用魔獣化暴露表へ' ] ), 'EXPO_J' => Table.new( 'アイドル専用魔獣化暴露表', '1D6', [ 'シナリオ中[迫害状態]になる', 'シナリオ中[迫害状態]になる', '絆の対象ひとりに正体が知られる', '事務所から契約を解除される', '絆の対象ひとりに正体が知られる', '1D6本のレギュラー番組を失う' ] ), 'FACE_A' => Table.new( '正体判明チャートA', '1D6', [ 'あなたを受け入れてくれる', 'あなたを受け入れてくれる', '絆が(拒絶)に書き換わる', '絆がエゴに書き換わる', '気絶しその事実を忘れる', '精神崩壊する' ] ), 'FACE_B' => Table.new( '正体判明チャートB', '1D6', [ 'あなたを受け入れてくれる', '狂乱し攻撃してくる', '退場。その場から逃亡。暴露表へ', '絆がエゴに書き換わる', '精神崩壊する', '精神崩壊する' ] ), 'FACE_C' => Table.new( '正体判明チャートC', '1D6', [ 'あなたを受け入れてくれる', '退場。その場から逃亡。暴露表へ', '退場。その場から逃亡。暴露表へ', '絆がエゴに書き換わる', '精神崩壊する', '精神崩壊する' ] ), }.freeze setPrefixes(['\d+BB.*', '\d+R6.*'] + TABLES.keys) end
{ "pile_set_name": "Github" }
## DOM [Back](./../HTML.md) - DOM(the **D**ocument **O**bject **M**odel) is a platform- and language-neutral(語言無關的) interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents.
{ "pile_set_name": "Github" }
'use strict'; var GetIntrinsic = require('../GetIntrinsic'); var $Math = GetIntrinsic('%Math%'); var ToNumber = require('./ToNumber'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); var $sign = require('../helpers/sign'); var $mod = require('../helpers/mod'); var $floor = $Math.floor; var $abs = $Math.abs; module.exports = function ToUint8(argument) { var number = ToNumber(argument); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = $sign(number) * $floor($abs(number)); return $mod(posInt, 0x100); };
{ "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. */ #include "ap_config.h" #define CORE_PRIVATE #include "httpd.h" #include "http_config.h" #include "http_main.h" #include "http_log.h" #include "unixd.h" #include "mpm_common.h" #include "os.h" #include "ap_mpm.h" #include "apr_thread_proc.h" #include "apr_strings.h" #include "apr_portable.h" #ifdef HAVE_PWD_H #include <pwd.h> #endif #ifdef HAVE_SYS_RESOURCE_H #include <sys/resource.h> #endif /* XXX */ #include <sys/stat.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #ifdef HAVE_GRP_H #include <grp.h> #endif #ifdef HAVE_STRINGS_H #include <strings.h> #endif #ifdef HAVE_SYS_SEM_H #include <sys/sem.h> #endif #ifdef HAVE_SYS_PRCTL_H #include <sys/prctl.h> #endif unixd_config_rec unixd_config; /* Set group privileges. * * Note that we use the username as set in the config files, rather than * the lookup of to uid --- the same uid may have multiple passwd entries, * with different sets of groups for each. */ static int set_group_privs(void) { if (!geteuid()) { const char *name; /* Get username if passed as a uid */ if (unixd_config.user_name[0] == '#') { struct passwd *ent; uid_t uid = atoi(&unixd_config.user_name[1]); if ((ent = getpwuid(uid)) == NULL) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "getpwuid: couldn't determine user name from uid %u, " "you probably need to modify the User directive", (unsigned)uid); return -1; } name = ent->pw_name; } else name = unixd_config.user_name; #if !defined(OS2) && !defined(TPF) /* OS/2 and TPF don't support groups. */ /* * Set the GID before initgroups(), since on some platforms * setgid() is known to zap the group list. */ if (setgid(unixd_config.group_id) == -1) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "setgid: unable to set group id to Group %u", (unsigned)unixd_config.group_id); return -1; } /* Reset `groups' attributes. */ if (initgroups(name, unixd_config.group_id) == -1) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "initgroups: unable to set groups for User %s " "and Group %u", name, (unsigned)unixd_config.group_id); return -1; } #endif /* !defined(OS2) && !defined(TPF) */ } return 0; } AP_DECLARE(int) unixd_setup_child(void) { if (set_group_privs()) { return -1; } if (NULL != unixd_config.chroot_dir) { if (geteuid()) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "Cannot chroot when not started as root"); return -1; } if (chdir(unixd_config.chroot_dir) != 0) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "Can't chdir to %s", unixd_config.chroot_dir); return -1; } if (chroot(unixd_config.chroot_dir) != 0) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "Can't chroot to %s", unixd_config.chroot_dir); return -1; } if (chdir("/") != 0) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "Can't chdir to new root"); return -1; } } #ifdef MPE /* Only try to switch if we're running as MANAGER.SYS */ if (geteuid() == 1 && unixd_config.user_id > 1) { GETPRIVMODE(); if (setuid(unixd_config.user_id) == -1) { GETUSERMODE(); ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "setuid: unable to change to uid: %ld", (long) unixd_config.user_id); exit(1); } GETUSERMODE(); } #else /* Only try to switch if we're running as root */ if (!geteuid() && ( #ifdef _OSD_POSIX os_init_job_environment(NULL, unixd_config.user_name, ap_exists_config_define("DEBUG")) != 0 || #endif setuid(unixd_config.user_id) == -1)) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "setuid: unable to change to uid: %ld", (long) unixd_config.user_id); return -1; } #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) /* this applies to Linux 2.4+ */ #ifdef AP_MPM_WANT_SET_COREDUMPDIR if (ap_coredumpdir_configured) { if (prctl(PR_SET_DUMPABLE, 1)) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "set dumpable failed - this child will not coredump" " after software errors"); } } #endif #endif #endif return 0; } /* * Modified by Reed, avoid ap_uname2id exit, return -1 instead. */ AP_DECLARE(const char *) unixd_set_user(cmd_parms *cmd, void *dummy, const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } unixd_config.user_name = arg; unixd_config.user_id = ap_uname2id(arg); /** valid local user, remember it */ if( unixd_config.user_id != -1 ){ cmd->local_conf->user = 1; /** make sure it is real name */ if (arg && arg[0] == '#'){ unixd_config.user_name = ap_uid2name(unixd_config.user_id); } } return NULL; } /* * Modified by Reed, avoid ap_gname2id exit, return -1 instead. */ AP_DECLARE(const char *) unixd_set_group(cmd_parms *cmd, void *dummy, const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } unixd_config.group_name = arg; unixd_config.group_id = ap_gname2id(arg); /** valid local group, remember it */ if( unixd_config.group_id != -1 ){ cmd->local_conf->group = 1; /** make sure it is real name */ if (arg && arg[0] == '#'){ unixd_config.group_name = ap_gid2name(unixd_config.group_id); } } return NULL; } AP_DECLARE(const char *) unixd_set_chroot_dir(cmd_parms *cmd, void *dummy, const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } if (!ap_is_directory(cmd->pool, arg)) { return "ChrootDir must be a valid directory"; } unixd_config.chroot_dir = arg; return NULL; } AP_DECLARE(const char *) unixd_set_suexec(cmd_parms *cmd, void *dummy, int arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) { return err; } if (!unixd_config.suexec_enabled && arg) { return "suEXEC isn't supported; check existence, owner, and " "file mode of " SUEXEC_BIN; } unixd_config.suexec_enabled = arg; return NULL; } AP_DECLARE(void) unixd_pre_config(apr_pool_t *ptemp) { apr_finfo_t wrapper; unixd_config.user_name = DEFAULT_USER; unixd_config.user_id = ap_uname2id(DEFAULT_USER); unixd_config.group_id = ap_gname2id(DEFAULT_GROUP); unixd_config.chroot_dir = NULL; /* none */ /* Check for suexec */ unixd_config.suexec_enabled = 0; if ((apr_stat(&wrapper, SUEXEC_BIN, APR_FINFO_NORM, ptemp)) != APR_SUCCESS) { return; } if ((wrapper.protection & APR_USETID) && wrapper.user == 0) { unixd_config.suexec_enabled = 1; } } AP_DECLARE(void) unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit, const char *arg, const char * arg2, int type) { #if (defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS)) && APR_HAVE_STRUCT_RLIMIT && APR_HAVE_GETRLIMIT char *str; struct rlimit *limit; /* If your platform doesn't define rlim_t then typedef it in ap_config.h */ rlim_t cur = 0; rlim_t max = 0; *plimit = (struct rlimit *)apr_pcalloc(cmd->pool, sizeof(**plimit)); limit = *plimit; if ((getrlimit(type, limit)) != 0) { *plimit = NULL; ap_log_error(APLOG_MARK, APLOG_ERR, errno, cmd->server, "%s: getrlimit failed", cmd->cmd->name); return; } if ((str = ap_getword_conf(cmd->pool, &arg))) { if (!strcasecmp(str, "max")) { cur = limit->rlim_max; } else { cur = atol(str); } } else { ap_log_error(APLOG_MARK, APLOG_ERR, 0, cmd->server, "Invalid parameters for %s", cmd->cmd->name); return; } if (arg2 && (str = ap_getword_conf(cmd->pool, &arg2))) { max = atol(str); } /* if we aren't running as root, cannot increase max */ if (geteuid()) { limit->rlim_cur = cur; if (max) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, cmd->server, "Must be uid 0 to raise maximum %s", cmd->cmd->name); } } else { if (cur) { limit->rlim_cur = cur; } if (max) { limit->rlim_max = max; } } #else ap_log_error(APLOG_MARK, APLOG_ERR, 0, cmd->server, "Platform does not support rlimit for %s", cmd->cmd->name); #endif } APR_HOOK_STRUCT( APR_HOOK_LINK(get_suexec_identity) ) AP_IMPLEMENT_HOOK_RUN_FIRST(ap_unix_identity_t *, get_suexec_identity, (const request_rec *r), (r), NULL) static apr_status_t ap_unix_create_privileged_process( apr_proc_t *newproc, const char *progname, const char * const *args, const char * const *env, apr_procattr_t *attr, ap_unix_identity_t *ugid, apr_pool_t *p) { int i = 0; const char **newargs; char *newprogname; char *execuser, *execgroup; const char *argv0; if (!unixd_config.suexec_enabled) { return apr_proc_create(newproc, progname, args, env, attr, p); } argv0 = ap_strrchr_c(progname, '/'); /* Allow suexec's "/" check to succeed */ if (argv0 != NULL) { argv0++; } else { argv0 = progname; } if (ugid->userdir) { execuser = apr_psprintf(p, "~%ld", (long) ugid->uid); } else { execuser = apr_psprintf(p, "%ld", (long) ugid->uid); } execgroup = apr_psprintf(p, "%ld", (long) ugid->gid); if (!execuser || !execgroup) { return APR_ENOMEM; } i = 0; if (args) { while (args[i]) { i++; } } /* allocate space for 4 new args, the input args, and a null terminator */ newargs = apr_palloc(p, sizeof(char *) * (i + 4)); newprogname = SUEXEC_BIN; newargs[0] = SUEXEC_BIN; newargs[1] = execuser; newargs[2] = execgroup; newargs[3] = apr_pstrdup(p, argv0); /* ** using a shell to execute suexec makes no sense thus ** we force everything to be APR_PROGRAM, and never ** APR_SHELLCMD */ if(apr_procattr_cmdtype_set(attr, APR_PROGRAM) != APR_SUCCESS) { return APR_EGENERAL; } i = 1; do { newargs[i + 3] = args[i]; } while (args[i++]); return apr_proc_create(newproc, newprogname, newargs, env, attr, p); } AP_DECLARE(apr_status_t) ap_os_create_privileged_process( const request_rec *r, apr_proc_t *newproc, const char *progname, const char * const *args, const char * const *env, apr_procattr_t *attr, apr_pool_t *p) { ap_unix_identity_t *ugid = ap_run_get_suexec_identity(r); if (ugid == NULL) { return apr_proc_create(newproc, progname, args, env, attr, p); } return ap_unix_create_privileged_process(newproc, progname, args, env, attr, ugid, p); } /* XXX move to APR and externalize (but implement differently :) ) */ static apr_lockmech_e proc_mutex_mech(apr_proc_mutex_t *pmutex) { const char *mechname = apr_proc_mutex_name(pmutex); if (!strcmp(mechname, "sysvsem")) { return APR_LOCK_SYSVSEM; } else if (!strcmp(mechname, "flock")) { return APR_LOCK_FLOCK; } return APR_LOCK_DEFAULT; } AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex) { if (!geteuid()) { apr_lockmech_e mech = proc_mutex_mech(pmutex); switch(mech) { #if APR_HAS_SYSVSEM_SERIALIZE case APR_LOCK_SYSVSEM: { apr_os_proc_mutex_t ospmutex; #if !APR_HAVE_UNION_SEMUN union semun { long val; struct semid_ds *buf; unsigned short *array; }; #endif union semun ick; struct semid_ds buf; apr_os_proc_mutex_get(&ospmutex, pmutex); buf.sem_perm.uid = unixd_config.user_id; buf.sem_perm.gid = unixd_config.group_id; buf.sem_perm.mode = 0600; ick.buf = &buf; if (semctl(ospmutex.crossproc, 0, IPC_SET, ick) < 0) { return errno; } } break; #endif #if APR_HAS_FLOCK_SERIALIZE case APR_LOCK_FLOCK: { const char *lockfile = apr_proc_mutex_lockfile(pmutex); if (lockfile) { if (chown(lockfile, unixd_config.user_id, -1 /* no gid change */) < 0) { return errno; } } } break; #endif default: /* do nothing */ break; } } return APR_SUCCESS; } AP_DECLARE(apr_status_t) unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex) { #if !APR_PROC_MUTEX_IS_GLOBAL apr_os_global_mutex_t osgmutex; apr_os_global_mutex_get(&osgmutex, gmutex); return unixd_set_proc_mutex_perms(osgmutex.proc_mutex); #else /* APR_PROC_MUTEX_IS_GLOBAL */ /* In this case, apr_proc_mutex_t and apr_global_mutex_t are the same. */ return unixd_set_proc_mutex_perms(gmutex); #endif /* APR_PROC_MUTEX_IS_GLOBAL */ } AP_DECLARE(apr_status_t) unixd_accept(void **accepted, ap_listen_rec *lr, apr_pool_t *ptrans) { apr_socket_t *csd; apr_status_t status; #ifdef _OSD_POSIX int sockdes; #endif *accepted = NULL; status = apr_socket_accept(&csd, lr->sd, ptrans); if (status == APR_SUCCESS) { *accepted = csd; #ifdef _OSD_POSIX apr_os_sock_get(&sockdes, csd); if (sockdes >= FD_SETSIZE) { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, "new file descriptor %d is too large; you probably need " "to rebuild Apache with a larger FD_SETSIZE " "(currently %d)", sockdes, FD_SETSIZE); apr_socket_close(csd); return APR_EINTR; } #endif return APR_SUCCESS; } if (APR_STATUS_IS_EINTR(status)) { return status; } /* Our old behaviour here was to continue after accept() * errors. But this leads us into lots of troubles * because most of the errors are quite fatal. For * example, EMFILE can be caused by slow descriptor * leaks (say in a 3rd party module, or libc). It's * foolish for us to continue after an EMFILE. We also * seem to tickle kernel bugs on some platforms which * lead to never-ending loops here. So it seems best * to just exit in most cases. */ switch (status) { #if defined(HPUX11) && defined(ENOBUFS) /* On HPUX 11.x, the 'ENOBUFS, No buffer space available' * error occurs because the accept() cannot complete. * You will not see ENOBUFS with 10.20 because the kernel * hides any occurrence from being returned to user space. * ENOBUFS with 11.x's TCP/IP stack is possible, and could * occur intermittently. As a work-around, we are going to * ignore ENOBUFS. */ case ENOBUFS: #endif #ifdef EPROTO /* EPROTO on certain older kernels really means * ECONNABORTED, so we need to ignore it for them. * See discussion in new-httpd archives nh.9701 * search for EPROTO. * * Also see nh.9603, search for EPROTO: * There is potentially a bug in Solaris 2.x x<6, * and other boxes that implement tcp sockets in * userland (i.e. on top of STREAMS). On these * systems, EPROTO can actually result in a fatal * loop. See PR#981 for example. It's hard to * handle both uses of EPROTO. */ case EPROTO: #endif #ifdef ECONNABORTED case ECONNABORTED: #endif /* Linux generates the rest of these, other tcp * stacks (i.e. bsd) tend to hide them behind * getsockopt() interfaces. They occur when * the net goes sour or the client disconnects * after the three-way handshake has been done * in the kernel but before userland has picked * up the socket. */ #ifdef ECONNRESET case ECONNRESET: #endif #ifdef ETIMEDOUT case ETIMEDOUT: #endif #ifdef EHOSTUNREACH case EHOSTUNREACH: #endif #ifdef ENETUNREACH case ENETUNREACH: #endif /* EAGAIN/EWOULDBLOCK can be returned on BSD-derived * TCP stacks when the connection is aborted before * we call connect, but only because our listener * sockets are non-blocking (AP_NONBLOCK_WHEN_MULTI_LISTEN) */ #ifdef EAGAIN case EAGAIN: #endif #ifdef EWOULDBLOCK #if !defined(EAGAIN) || EAGAIN != EWOULDBLOCK case EWOULDBLOCK: #endif #endif break; #ifdef ENETDOWN case ENETDOWN: /* * When the network layer has been shut down, there * is not much use in simply exiting: the parent * would simply re-create us (and we'd fail again). * Use the CHILDFATAL code to tear the server down. * @@@ Martin's idea for possible improvement: * A different approach would be to define * a new APEXIT_NETDOWN exit code, the reception * of which would make the parent shutdown all * children, then idle-loop until it detected that * the network is up again, and restart the children. * Ben Hyde noted that temporary ENETDOWN situations * occur in mobile IP. */ ap_log_error(APLOG_MARK, APLOG_EMERG, status, ap_server_conf, "apr_socket_accept: giving up."); return APR_EGENERAL; #endif /*ENETDOWN*/ #ifdef TPF case EINACT: ap_log_error(APLOG_MARK, APLOG_EMERG, status, ap_server_conf, "offload device inactive"); return APR_EGENERAL; break; default: ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, "select/accept error (%d)", status); return APR_EGENERAL; #else default: ap_log_error(APLOG_MARK, APLOG_ERR, status, ap_server_conf, "apr_socket_accept: (client socket)"); return APR_EGENERAL; #endif } return status; } #ifdef _OSD_POSIX #include "apr_lib.h" #define USER_LEN 8 typedef enum { bs2_unknown, /* not initialized yet. */ bs2_noFORK, /* no fork() because -X flag was specified */ bs2_FORK, /* only fork() because uid != 0 */ bs2_UFORK /* Normally, ufork() is used to switch identities. */ } bs2_ForkType; static bs2_ForkType forktype = bs2_unknown; static void ap_str_toupper(char *str) { while (*str) { *str = apr_toupper(*str); ++str; } } /* Determine the method for forking off a child in such a way as to * set both the POSIX and BS2000 user id's to the unprivileged user. */ static bs2_ForkType os_forktype(int one_process) { /* have we checked the OS version before? If yes return the previous * result - the OS release isn't going to change suddenly! */ if (forktype == bs2_unknown) { /* not initialized yet */ /* No fork if the one_process option was set */ if (one_process) { forktype = bs2_noFORK; } /* If the user is unprivileged, use the normal fork() only. */ else if (getuid() != 0) { forktype = bs2_FORK; } else forktype = bs2_UFORK; } return forktype; } /* This routine complements the setuid() call: it causes the BS2000 job * environment to be switched to the target user's user id. * That is important if CGI scripts try to execute native BS2000 commands. */ int os_init_job_environment(server_rec *server, const char *user_name, int one_process) { bs2_ForkType type = os_forktype(one_process); /* We can be sure that no change to uid==0 is possible because of * the checks in http_core.c:set_user() */ if (one_process) { type = forktype = bs2_noFORK; ap_log_error(APLOG_MARK, APLOG_ERR, 0, server, "The debug mode of Apache should only " "be started by an unprivileged user!"); return 0; } return 0; } /* BS2000 requires a "special" version of fork() before a setuid() call */ pid_t os_fork(const char *user) { pid_t pid; char username[USER_LEN+1]; switch (os_forktype(0)) { case bs2_FORK: pid = fork(); break; case bs2_UFORK: apr_cpystrn(username, user, sizeof username); /* Make user name all upper case - for some versions of ufork() */ ap_str_toupper(username); pid = ufork(username); if (pid == -1 && errno == EPERM) { ap_log_error(APLOG_MARK, APLOG_EMERG, errno, NULL, "ufork: Possible mis-configuration " "for user %s - Aborting.", user); exit(1); } break; default: pid = 0; break; } return pid; } #endif /* _OSD_POSIX */
{ "pile_set_name": "Github" }
<?php /** * Customize API: WP_Customize_New_Menu_Control class * * @package WordPress * @subpackage Customize * @since 4.4.0 */ /** * Customize control class for new menus. * * @since 4.3.0 * * @see WP_Customize_Control */ class WP_Customize_New_Menu_Control extends WP_Customize_Control { /** * Control type. * * @since 4.3.0 * @access public * @var string */ public $type = 'new_menu'; /** * Render the control's content. * * @since 4.3.0 * @access public */ public function render_content() { ?> <button type="button" class="button button-primary" id="create-new-menu-submit"><?php _e( 'Create Menu' ); ?></button> <span class="spinner"></span> <?php } }
{ "pile_set_name": "Github" }
// Copyright (c) 2016 Ventu.io, Oleg Sklyar, contributors // The use of this source code is governed by a MIT style license found in the LICENSE file package shortid_test import ( "testing" "time" "github.com/corestoreio/pkg/util/shortid" ) func Test_onGetDefault_defaultInstance(t *testing.T) { sid := shortid.GetDefault() expected := "Shortid(worker=0, epoch=2016-01-01 00:00:00 +0000 UTC, abc=Abc{alphabet='gzmZM7VINvOFcpho01x-fYPs8Q_urjq6RkiWGn4SHDdK5t2TAJbaBLEyUwlX9C3e'))" if sid.String() != expected { t.Errorf("expected %v", expected) } } func Test_onSetDefault_replacesDefaultInstance(t *testing.T) { expected := "Shortid(worker=0, epoch=2016-01-01 00:00:00 +0000 UTC, abc=Abc{alphabet='gzmZM7VINvOFcpho01x-fYPs8Q_urjq6RkiWGn4SHDdK5t2TAJbaBLEyUwlX9C3e'))" sid := shortid.GetDefault() if sid.String() != expected { t.Errorf("expected %v", expected) } // different worker, different seed (thus different shuffling) shortid.SetDefault(shortid.MustNew(1, shortid.DefaultABC, 2)) expected = "Shortid(worker=1, epoch=2016-01-01 00:00:00 +0000 UTC, abc=Abc{alphabet='ip8bKduCDxnMQy-JrVHAN5h1s396jBvmFZOL0Pg2WTqwIE7f4ackXzoUSYlGt_eR'))" sid = shortid.GetDefault() if sid.String() != expected { t.Errorf("expected %v", expected) } } func Test_onGenerate_success(t *testing.T) { time.Sleep(2 * time.Millisecond) if id, err := shortid.Generate(); err != nil { t.Error(err) } else if len(id) != 9 { t.Error("incorrect id length") } time.Sleep(2 * time.Millisecond) if id, err := shortid.Generate(); err != nil { t.Error(err) } else if len(id) != 9 { t.Error("incorrect id length") } } func Test_oMustGenerate_success(t *testing.T) { time.Sleep(2 * time.Millisecond) if id := shortid.MustGenerate(); len(id) != 9 { t.Error("incorrect id length") } time.Sleep(2 * time.Millisecond) if id := shortid.MustGenerate(); len(id) != 9 { t.Error("incorrect id length") } } func TestShortid_onNew_success(t *testing.T) { expected := "Shortid(worker=5, epoch=2016-01-01 00:00:00 +0000 UTC, abc=Abc{alphabet='gzmZM7VINvOFcpho01x-fYPs8Q_urjq6RkiWGn4SHDdK5t2TAJbaBLEyUwlX9C3e'))" if sid, err := shortid.New(5, shortid.DefaultABC, 1); err != nil { t.Error(err) } else if sid.String() != expected { t.Errorf("expected %v, found %v", expected, sid.String()) } expected = "Shortid(worker=31, epoch=2016-01-01 00:00:00 +0000 UTC, abc=Abc{alphabet='gzmZM7VINvOFcpho01x-fYPs8Q_urjq6RkiWGn4SHDdK5t2TAJbaBLEyUwlX9C3e'))" if sid, err := shortid.New(31, shortid.DefaultABC, 1); err != nil { t.Error(err) } else if sid.String() != expected { t.Errorf("expected %v, found %v", expected, sid.String()) } } func TestShortid_onNew_withDifferentSeed_successWithDifferentShuffling(t *testing.T) { expected := "Shortid(worker=2, epoch=2016-01-01 00:00:00 +0000 UTC, abc=Abc{alphabet='gzmZM7VINvOFcpho01x-fYPs8Q_urjq6RkiWGn4SHDdK5t2TAJbaBLEyUwlX9C3e'))" if sid, err := shortid.New(2, shortid.DefaultABC, 1); err != nil { t.Error(err) } else if sid.String() != expected { t.Errorf("expected %v, found %v", expected, sid.String()) } expected = "Shortid(worker=2, epoch=2016-01-01 00:00:00 +0000 UTC, abc=Abc{alphabet='U8dEc3Hnuq_RfyDApaT1ZxQmYePBCNMkF4-KJSvhjw609I7GlbzsriOL52XVoWgt'))" if sid, err := shortid.New(2, shortid.DefaultABC, 345234); err != nil { t.Error(err) } else if sid.String() != expected { t.Errorf("expected %v, found %v", expected, sid.String()) } } func TestShortid_onNew_withWorkerAbove31_error(t *testing.T) { if _, err := shortid.New(32, shortid.DefaultABC, 1); err == nil { t.Error("expected error") } } func TestShortid_onNew_withIncorrectAbs_error(t *testing.T) { if _, err := shortid.New(1, "aasefvowefvjaHEFV", 1); err == nil { t.Error("expected error") } } func TestShortid_onMustNew_success(t *testing.T) { expected := "Shortid(worker=2, epoch=2016-01-01 00:00:00 +0000 UTC, abc=Abc{alphabet='gzmZM7VINvOFcpho01x-fYPs8Q_urjq6RkiWGn4SHDdK5t2TAJbaBLEyUwlX9C3e'))" if sid := shortid.MustNew(2, shortid.DefaultABC, 1); sid.String() != expected { t.Errorf("expected %v, found %v", expected, sid.String()) } } func TestShortid_onError_panic(t *testing.T) { defer func() { if r := recover(); r == nil { t.Error("expected panic") } }() shortid.MustNew(1, "aasefvowefvjaHEFV", 1) } func TestShortid_onGenerate_success(t *testing.T) { sid := shortid.MustNew(1, shortid.DefaultABC, 1) if id, err := sid.Generate(); err != nil { t.Error(err) } else if len(id) != 9 { t.Errorf("expected id of length 9, found %v", id) } time.Sleep(2 * time.Millisecond) if id, err := sid.Generate(); err != nil { t.Error(err) } else if len(id) != 9 { t.Errorf("expected id of length 9, found %v", id) } } func TestShortid_onMustGenerate_success(t *testing.T) { sid := shortid.MustNew(1, shortid.DefaultABC, 1) if id := sid.MustGenerate(); len(id) != 9 { t.Errorf("expected id of length 9, found %v", id) } time.Sleep(2 * time.Millisecond) if id := sid.MustGenerate(); len(id) != 9 { t.Errorf("expected id of length 9, found %v", id) } } // func TestShortid_onGenerateInternal -- covered in integration tests func TestShortid_onAbc_success(t *testing.T) { sid := shortid.MustNew(1, shortid.DefaultABC, 1) expected := "Abc{alphabet='gzmZM7VINvOFcpho01x-fYPs8Q_urjq6RkiWGn4SHDdK5t2TAJbaBLEyUwlX9C3e')" if abc := sid.Abc(); abc.String() != expected { t.Errorf("expected %v, found %v", expected, abc.String()) } } func TestShortid_onEpoch_success(t *testing.T) { sid := shortid.MustNew(1, shortid.DefaultABC, 1) expected := time.Date(2016, time.January, 1, 0, 0, 0, 0, time.UTC) if sid.Epoch() != expected { t.Errorf("expected %v, found %v", expected, sid.Epoch()) } } func TestShortid_onWorker_success(t *testing.T) { sid := shortid.MustNew(25, shortid.DefaultABC, 1) if sid.Worker() != 25 { t.Errorf("expected 25, found %v", sid.Worker()) } } func TestAbc_onNewAbc_success(t *testing.T) { expected := "Abc{alphabet='gzmZM7VINvOFcpho01x-fYPs8Q_urjq6RkiWGn4SHDdK5t2TAJbaBLEyUwlX9C3e')" if abc, err := shortid.NewAbc(shortid.DefaultABC, 1); err != nil { t.Error(err) } else if abc.String() != expected { t.Errorf("expected %v, found %v", expected, abc.String()) } } func TestAbc_onNewAbc_wrongAlphabetLength_error(t *testing.T) { if _, err := shortid.NewAbc("asgliaeprugb", 1); err == nil { t.Error("expected error") } if _, err := shortid.NewAbc("1234567890qwertzuiopüäsdfghjklöä$<yxcvbnm,.->YXCVBNM;:_ASDFGHJKLQWERTZ", 1); err == nil { t.Error("expected error") } } func TestAbc_onNewAbc_alphabetNonUnique_error(t *testing.T) { runes := []rune(shortid.DefaultABC) if _, err := shortid.NewAbc(string(runes), 1); err != nil { t.Error(err) } runes[5] = 'A' if _, err := shortid.NewAbc(string(runes), 1); err == nil { t.Error("error expected") } } func TestAbc_onMustNewAbc_success(t *testing.T) { expected := "Abc{alphabet='gzmZM7VINvOFcpho01x-fYPs8Q_urjq6RkiWGn4SHDdK5t2TAJbaBLEyUwlX9C3e')" if abc := shortid.MustNewAbc(shortid.DefaultABC, 1); abc.String() != expected { t.Errorf("expected %v, found %v", expected, abc.String()) } } func TestAbc_onMustNewAbc_onError_panics(t *testing.T) { defer func() { if r := recover(); r == nil { t.Error("panic expected") } }() shortid.MustNewAbc("asgliaeprugb", 1) } func TestAbc_onEncode_withVal0_success(t *testing.T) { abc := shortid.MustNewAbc(shortid.DefaultABC, 1) if id, err := abc.Encode(0, 1, 4); err != nil { t.Error(err) } else if len(id) != 1 { t.Errorf("expected 1 symbol") } } func TestAbc_onEncode_withValSmall_success(t *testing.T) { abc := shortid.MustNewAbc(shortid.DefaultABC, 1) if _, err := abc.Encode(48, 1, 4); err == nil { t.Errorf("expected error") } if id, err := abc.Encode(48, 2, 4); err != nil { t.Error(err) } else if len(id) != 2 { t.Errorf("expected 2 symbols") } } func TestAbc_onEncode_withValHuge_success(t *testing.T) { abc := shortid.MustNewAbc(shortid.DefaultABC, 1) if _, err := abc.Encode(214235345234524356, 14, 4); err == nil { t.Error("expected error") } if id, err := abc.Encode(214235345234524356, 15, 4); err != nil { t.Error(err) } else if len(id) != 15 { t.Errorf("expected 15 symbols") } } func TestAbc_onEncode_withNSymbols0_success(t *testing.T) { abc := shortid.MustNewAbc(shortid.DefaultABC, 1) if id, err := abc.Encode(214235345234524356, 0, 4); err != nil { t.Error(err) } else if len(id) != 15 { t.Errorf("expected 15 symbols") } } func TestAbc_onEncode_withDigits6_success(t *testing.T) { abc := shortid.MustNewAbc(shortid.DefaultABC, 1) if id, err := abc.Encode(214235345234524356, 0, 6); err != nil { t.Error(err) } else if len(id) != 10 { t.Errorf("expected 10 symbols") } } func TestAbc_onEncode_withDigitsWrong_error(t *testing.T) { abc := shortid.MustNewAbc(shortid.DefaultABC, 1) if _, err := abc.Encode(25, 0, 3); err == nil { t.Error("expected error") } if _, err := abc.Encode(25, 0, 4); err != nil { t.Error(err) } if _, err := abc.Encode(25, 0, 5); err != nil { t.Error(err) } if _, err := abc.Encode(25, 0, 6); err != nil { t.Error(err) } if _, err := abc.Encode(25, 0, 7); err == nil { t.Error("expected error") } } func TestAbc_onMustEncode_success(t *testing.T) { abc := shortid.MustNewAbc(shortid.DefaultABC, 1) if id := abc.MustEncode(25, 0, 4); len(id) != 2 { t.Errorf("expected len=2: %v", id) } } func TestAbc_onMustEncode_onError_panics(t *testing.T) { abc := shortid.MustNewAbc(shortid.DefaultABC, 1) defer func() { if r := recover(); r == nil { t.Error("expected panic") } }() abc.MustEncode(25, 0, 2) } func TestAbc_onAlphabet_success(t *testing.T) { abc := shortid.MustNewAbc(shortid.DefaultABC, 1) expected := "gzmZM7VINvOFcpho01x-fYPs8Q_urjq6RkiWGn4SHDdK5t2TAJbaBLEyUwlX9C3e" if abc.Alphabet() != expected { t.Errorf("expected %v, found %v", expected, abc.Alphabet()) } }
{ "pile_set_name": "Github" }