text
stringlengths
2
100k
meta
dict
-----BEGIN ENCRYPTED PRIVATE KEY----- MIICxjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIERyXk+8ULCgCAggA MBQGCCqGSIb3DQMHBAhUeao9yOi6uwSCAoDMyMGii0I2y8CvM8SrY9tRx+Zt8WsP vhEWhI1kbzWpZUdS1URWGZZz6oS33GnvUDmN1fZC3V/k9OcknZvfv8UtHj6RhK3a dBgLVjEkFfqz2/4cOfha9FrRUJXXwW5JmnNhn3e8WZTvbtEt0e89n4jZWjWnkeoJ rySKWuPn9SKzwFdPh7ur8N2BfjvwxdAZ1uShnj/Umik8o5wJZUz/7w0nd7JpcsOE r9wC446li8t3owkm81z5jFTQW9SYZmT0ecICF1CRJgsp060TQzBeAKAM2skiOZXr ldQBUqZBrYV2ZZ3+bepLrmsgobxDzhiNrRXjs+8lO3TGerc6ZD496Xv5XSJF3QuF aUjWnaW2YX46nRWY60Bq3IhAbuAGF3YGvk4O/+n90Y4NUXj8mwLq8sFMlXKMyxLy fHBfWKpwTFgtdBO4nSPrn310+xiPSxU61WGMZkBlgv5X75xiX5ZYktUxVlktvr1Z +ZPeIMRzuoeK8J8iwzx1ADbOVPCAGnPuYbvUalGoGQkjCUEdL08XauaUdK0eDMTh 5gh1amQg+PTb/ZmYAhaDjHsuzIIgfWtsfL+Xk9AsTimK/qwP6mQLT6Kb+PowX3mQ Tr4SkJH31Jp6mTxueoCtqPEC1BxhuDlqlTvmPdgIPCf4dbFtsEsSGbWRUYuZXgwg Qmhp6TC3YNPVtLusoCMwjXkUSxRhScAzb6RpEGJwL94grF1UvTfleTGfOppKxZdG yjzbJcUlcSCuw844HZDwHVzORQT3zxaguKuu/XcgINd5mU2STOopz3AkHhKLSFej UANon6Dke8NLp96JvX/NN8zqvauRHg/r7RgcSHQWRZpbAzX4bgsEX2Mc -----END ENCRYPTED PRIVATE KEY-----
{ "pile_set_name": "Github" }
import axios from 'axios' import { Promise } from 'es6-promise' const api = {} export default api let uuid = localStorage.uuid || '' api.getUUID = () => { return axios.get('/api/uuid').then(res => { return uuid = localStorage.uuid = res.data }) } api.checkLogin = () => { return axios.get('/api/instance/' + uuid) } api.loginConfirm = () => { return axios.get('/api/login/' + uuid) } api.usersList = pluginName => { return axios.get(`/api/usersList/${pluginName}/${uuid}`).then(res => { return res.data.sort((a,b) => (a.switch > b.switch ? -1 : a.py > b.py ? 1 : -1)) }) } api.userSwitch = (pluginName, username) => { return axios.get(`/api/userSwitch/${pluginName}/${uuid}/${username}`) } api.sendGroupMessage = msg => { return axios.post('/api/sendGroupMessage/' + uuid, {msg:msg}) }
{ "pile_set_name": "Github" }
{ "headers": { "cache-control": "no-cache, no-store, max-age=0, must-revalidate", "pragma": "no-cache", "expires": "Mon, 01 Jan 1990 00:00:00 GMT", "date": "Fri, 09 Nov 2018 18:39:35 GMT", "vary": "Origin, X-Origin", "content-type": "application/json; charset=UTF-8", "x-content-type-options": "nosniff", "x-frame-options": "SAMEORIGIN", "x-xss-protection": "1; mode=block", "server": "GSE", "alt-svc": "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"", "transfer-encoding": "chunked", "status": "200", "content-length": "505", "-content-encoding": "gzip" }, "body": { "kind": "sql#operation", "selfLink": "https://www.googleapis.com/sql/v1beta4/projects/cloud-custodian/operations/5ae5f1c7-f5ea-4c59-a306-332a0aca2c2b", "targetProject": "cloud-custodian", "targetId": "brenttest-5", "targetLink": "https://www.googleapis.com/sql/v1beta4/projects/cloud-custodian/instances/brenttest-5", "name": "5ae5f1c7-f5ea-4c59-a306-332a0aca2c2b", "operationType": "UPDATE", "status": "PENDING", "user": "[email protected]", "insertTime": "2018-11-09T18:39:35.861Z" } }
{ "pile_set_name": "Github" }
# coding:utf8 # ============================================================================== # Copyright 2017 Baidu.com, Inc. All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """ This package implements some utility functions shared by PaddlePaddle and Tensorflow model implementations. Authors: liuyuan([email protected]) Date: 2017/10/06 18:23:06 """ from .dureader_eval import compute_bleu_rouge from .dureader_eval import normalize from .preprocess import find_fake_answer from .preprocess import find_best_question_match __all__ = [ 'compute_bleu_rouge', 'normalize', 'find_fake_answer', 'find_best_question_match', ]
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <pkgmetadata> <maintainer type="project"> <email>[email protected]</email> <name>Gentoo Haskell</name> </maintainer> <use> <flag name="examples">Build examples</flag> </use> <longdescription> This package provides bindings to the low-level btrfs API (i.e. the @BTRFS_IOC_@* @ioctl@s). Currently, only a subset of the API is supported, including all functions needed to work with subvolumes/snapshots as well as file cloning. In order to build this package, @linux-headers@ needs to be installed. Warning: btrfs is still considered experimental. This module is also experimental and may contain serious bugs that may result in data loss. Do not use it on data that has not been backed up yet. </longdescription> </pkgmetadata>
{ "pile_set_name": "Github" }
#include "shader.h" Shader::Shader(std::string name) : name(name) { linked = false; isCompute = false; ID = glCreateProgram(); } Shader::~Shader() { glDeleteProgram(ID); } Shader::Shader(std::string name, const char * computeShaderPath) : name(name) { linked = false; isCompute = false; ID = glCreateProgram(); this->attachShader(BaseShader(computeShaderPath)); this->linkPrograms(); } Shader * Shader::attachShader(BaseShader s) { if (!isCompute) { glAttachShader(ID, s.getShad()); if (s.getName() == "COMPUTE") isCompute = true; this->shaders.push_back(s.getShad()); } else { std::cout << "ERROR: TRYING TO LINK A NON COMPUTE SHADER TO COMPUTE PROGRAM" << std::endl; } return this; } void Shader::linkPrograms() { glLinkProgram(ID); if (checkCompileErrors(ID, "PROGRAM", "")) { linked = true; std::cout << "PROGRAM " << name << " CORRECTLY LINKED" << std::endl; while (!shaders.empty()) { glDeleteShader(shaders.back()); shaders.pop_back(); } } else { std::cout << "ERROR WHILE LINKING TO " << name << " PROGRAM" << std::endl; } } void Shader::use() { if (linked) glUseProgram(ID); else { std::cout << "PROGRAMS NOT LINKED!" << std::endl; } } // utility uniform functions // ------------------------------------------------------------------------ void Shader::setBool(const std::string &name, bool value) const { glUniform1i(glGetUniformLocation(ID, name.c_str()), (int)value); } // ------------------------------------------------------------------------ void Shader::setInt(const std::string &name, int value) const { glUniform1i(glGetUniformLocation(ID, name.c_str()), value); } // ------------------------------------------------------------------------ void Shader::setFloat(const std::string &name, float value) const { glUniform1f(glGetUniformLocation(ID, name.c_str()), value); } void Shader::setVec2(const std::string &name, glm::vec2 vector) const { unsigned int location = glGetUniformLocation(ID, name.c_str()); glUniform2fv(location, 1, glm::value_ptr(vector)); } void Shader::setVec3(const std::string &name, glm::vec3 vector) const { unsigned int location = glGetUniformLocation(ID, name.c_str()); glUniform3fv(location, 1, glm::value_ptr(vector)); } void Shader::setVec4(const std::string &name, glm::vec4 vector) const { unsigned int location = glGetUniformLocation(ID, name.c_str()); glUniform4fv(location, 1, glm::value_ptr(vector)); } void Shader::setMat4(const std::string &name, glm::mat4 matrix) const { unsigned int mat = glGetUniformLocation(ID, name.c_str()); glUniformMatrix4fv(mat, 1, false, glm::value_ptr(matrix)); } void Shader::setSampler2D(const std::string &name, unsigned int texture, int id) const { glActiveTexture(GL_TEXTURE0 + id); glBindTexture(GL_TEXTURE_2D, texture); this->setInt(name, id); } void Shader::setSampler3D(const std::string &name, unsigned int texture, int id) const { glActiveTexture(GL_TEXTURE0 + id); glBindTexture(GL_TEXTURE_3D, texture); this->setInt(name, id); } /* void Shader::checkCompileErrors(unsigned int shader, std::string type, std::string shaderName) { int success; char infoLog[1024]; if (type != "PROGRAM") { glGetShaderiv(shader, GL_COMPILE_STATUS, &success); if (!success) { glGetShaderInfoLog(shader, 1024, NULL, infoLog); std::cout << "ERROR: SHADER" << shaderName << "COMPILATION ERROR of type: " << type << "\n" << infoLog << "\n -- --------------------------------------------------- -- " << std::endl; } } else { glGetProgramiv(shader, GL_LINK_STATUS, &success); if (!success) { glGetProgramInfoLog(shader, 1024, NULL, infoLog); std::cout << "ERROR::PROGRAM_LINKING_ERROR of type: " << type << "\n" << infoLog << "\n -- --------------------------------------------------- -- " << std::endl; } } //if (success) { // std::cout << type + " SHADER SUCCESSFULLY COMPILED AND/OR LINKED!" << std::endl; //} } */ /* std::string Shader::loadShaderFromFile(const char* shaderPath) { std::string shaderCode; std::ifstream shaderFile; shaderFile.exceptions(std::ifstream::failbit | std::ifstream::badbit); try { // open files shaderFile.open(shaderPath); std::stringstream shaderStream; // read file's buffer contents into streams shaderStream << shaderFile.rdbuf(); // close file handlers shaderFile.close(); // convert stream into string shaderCode = shaderStream.str(); } catch (std::ifstream::failure e) { std::cout << "ERROR::SHADER "<< getShaderName(shaderPath) << " FILE_NOT_SUCCESFULLY_READ" << std::endl; } return shaderCode; } std::string Shader::getShaderName(const char* path) { std::string pathstr = std::string(path); const size_t last_slash_idx = pathstr.find_last_of("/"); if (std::string::npos != last_slash_idx) { pathstr.erase(0, last_slash_idx + 1); } return pathstr; } */
{ "pile_set_name": "Github" }
#ifndef SUB_STRUCT_FILE_OPEN_H__ #define SUB_STRUCT_FILE_OPEN_H__ #include "rcConnect.h" #include "objInfo.h" int rcSubStructFileOpen( rcComm_t *conn, subFile_t *subFile ); #endif
{ "pile_set_name": "Github" }
/////////////////////////////////////////////////////////////////////////////// // Name: tests/controls/styledtextctrltest.cpp // Purpose: wxStyledTextCtrl unit test // Author: New Pagodi // Created: 2019-03-10 // Copyright: (c) 2019 wxWidgets development team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #include "testprec.h" #if wxUSE_STC #if defined(WXUSINGDLL) #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/app.h" #endif // WX_PRECOMP #include "wx/stc/stc.h" #include "wx/uiaction.h" #include "testwindow.h" #if defined(__WXOSX_COCOA__) || defined(__WXMSW__) || defined(__WXGTK__) class StcPopupWindowsTestCase { public: StcPopupWindowsTestCase() : m_stc(new wxStyledTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY)) { m_focusAlwaysRetained=true; m_calltipClickReceived=false; m_stc->Bind(wxEVT_KILL_FOCUS, &StcPopupWindowsTestCase::OnKillSTCFocus, this); m_stc->Bind(wxEVT_STC_CALLTIP_CLICK, &StcPopupWindowsTestCase::OnCallTipClick, this); } ~StcPopupWindowsTestCase() { delete m_stc; } void OnKillSTCFocus(wxFocusEvent& WXUNUSED(event)) { m_focusAlwaysRetained=false; } void OnCallTipClick(wxStyledTextEvent& WXUNUSED(event)) { m_calltipClickReceived=true; } protected: wxStyledTextCtrl* const m_stc; bool m_focusAlwaysRetained; bool m_calltipClickReceived; }; // This set of tests is used to verify that an autocompletion popup does not // take focus from its parent styled text control. TEST_CASE_METHOD(StcPopupWindowsTestCase, "wxStyledTextCtrl::AutoComp", "[wxStyledTextCtrl][focus]") { m_stc->SetFocus(); m_focusAlwaysRetained = true; m_stc->AutoCompShow(0,"ability able about above abroad absence absent"); #if wxUSE_UIACTIONSIMULATOR // Pressing the tab key should cause the current entry in the list to be // entered into the styled text control. However with GTK+, characters sent // with the UI simulator seem to arrive too late, so select the current // entry with a double click instead. wxUIActionSimulator sim; #ifdef __WXGTK__ wxPoint zeroPosition = m_stc->PointFromPosition(0); int textHt = m_stc->TextHeight(0); int textWd = m_stc->TextWidth(0,"ability"); wxPoint autoCompPoint(zeroPosition.x + textWd/2, zeroPosition.y + textHt + textHt/2); wxPoint scrnPoint = m_stc->ClientToScreen(autoCompPoint); sim.MouseMove(scrnPoint); sim.MouseDblClick(); #else sim.Char(WXK_TAB); #endif // __WXGTK__ ::wxYield(); CHECK( m_stc->GetText() == "ability" ); #endif //wxUSE_UIACTIONSIMULATOR if ( m_stc->AutoCompActive() ) m_stc->AutoCompCancel(); CHECK_FOCUS_IS( m_stc ); // Unfortunately under GTK we do get focus loss events, at least sometimes // (and actually more often than not, especially with GTK2, but this // happens with GTK3 too). #ifndef __WXGTK__ CHECK( m_focusAlwaysRetained ); #endif // !__WXGTK__ } // This test is used to verify that a call tip receives mouse clicks. However // the clicks do sent with the UI simulator do not seem to be received on // cocoa for some reason, so skip the test there for now. #if !defined(__WXOSX_COCOA__) TEST_CASE_METHOD(StcPopupWindowsTestCase, "wxStyledTextCtrl::Calltip", "[wxStyledTextCtrl][focus]") { m_stc->SetFocus(); m_calltipClickReceived = false; m_focusAlwaysRetained = true; wxString calltipText = "This is a calltip."; m_stc->CallTipShow(0,calltipText); #if wxUSE_UIACTIONSIMULATOR wxUIActionSimulator sim; wxPoint zeroPosition = m_stc->PointFromPosition(0); int textHt = m_stc->TextHeight(0); int textWd = m_stc->TextWidth(0,calltipText); // zeroPosition is the top left of position 0 and the call tip should have // roughly the same height as textHt (there seems to be some extra padding // that makes it a little taller, but it's roughly the same height), // so (zeroPosition.x+textWd/2,zeroPosition.y+textHt+textHt/2) should // be the middle of the calltip. wxPoint calltipMidPoint(zeroPosition.x + textWd/2, zeroPosition.y + textHt + textHt/2); wxPoint scrnPoint = m_stc->ClientToScreen(calltipMidPoint); sim.MouseMove(scrnPoint); sim.MouseClick(); ::wxYield(); CHECK( m_calltipClickReceived ); #endif // wxUSE_UIACTIONSIMULATOR if ( m_stc->CallTipActive() ) m_stc->CallTipCancel(); // Verify that clicking the call tip did not take focus from the STC. // // Unfortunately this test fails for unknown reasons under Xvfb (but only // there). if ( !IsRunningUnderXVFB() ) CHECK_FOCUS_IS( m_stc ); // With wxGTK there is the same problem here as in the test above. #ifndef __WXGTK__ CHECK( m_focusAlwaysRetained ); #endif // !__WXGTK__ } #endif // !defined(__WXOSX_COCOA__) #endif // defined(__WXOSX_COCOA__) || defined(__WXMSW__) || defined(__WXGTK__) #endif // WXUSINGDLL #endif // wxUSE_STC
{ "pile_set_name": "Github" }
(eterm-256color :fetcher github :repo "dieggsy/eterm-256color" :files (:defaults "eterm-256color.ti"))
{ "pile_set_name": "Github" }
import multiprocessing import threading import Queue from uuid import uuid4 import numpy as np import SharedArray import data def load_shared(args): i, array_name, fname, kwargs = args array = SharedArray.attach(array_name) array[i] = data.load_augment(fname, **kwargs) class BatchIterator(object): def __init__(self, batch_size): self.batch_size = batch_size def __call__(self, X, y=None, transform=None, color_vec=None): self.tf = transform self.color_vec = color_vec self.X, self.y = X, y return self def __iter__(self): n_samples = self.X.shape[0] bs = self.batch_size for i in range((n_samples + bs - 1) // bs): sl = slice(i * bs, (i + 1) * bs) Xb = self.X[sl] if self.y is not None: yb = self.y[sl] else: yb = None yield self.transform(Xb, yb) def transform(self, Xb, yb): return Xb, yb def __getstate__(self): state = dict(self.__dict__) for attr in ('X', 'y',): if attr in state: del state[attr] return state class QueueIterator(BatchIterator): """BatchIterator with seperate thread to do the image reading.""" def __iter__(self): queue = Queue.Queue(maxsize=20) end_marker = object() def producer(): for Xb, yb in super(QueueIterator, self).__iter__(): queue.put((np.array(Xb), np.array(yb))) queue.put(end_marker) thread = threading.Thread(target=producer) thread.daemon = True thread.start() item = queue.get() while item is not end_marker: yield item queue.task_done() item = queue.get() class SharedIterator(QueueIterator): def __init__(self, config, deterministic=False, *args, **kwargs): self.config = config self.deterministic = deterministic self.pool = multiprocessing.Pool() super(SharedIterator, self).__init__(*args, **kwargs) def transform(self, Xb, yb): shared_array_name = str(uuid4()) try: shared_array = SharedArray.create( shared_array_name, [len(Xb), 3, self.config.get('w'), self.config.get('h')], dtype=np.float32) fnames, labels = super(SharedIterator, self).transform(Xb, yb) args = [] for i, fname in enumerate(fnames): kwargs = {k: self.config.get(k) for k in ['w', 'h']} if not self.deterministic: kwargs.update({k: self.config.get(k) for k in ['aug_params', 'sigma']}) kwargs['transform'] = getattr(self, 'tf', None) kwargs['color_vec'] = getattr(self, 'color_vec', None) args.append((i, shared_array_name, fname, kwargs)) self.pool.map(load_shared, args) Xb = np.array(shared_array, dtype=np.float32) finally: SharedArray.delete(shared_array_name) if labels is not None: labels = labels[:, np.newaxis] return Xb, labels class ResampleIterator(SharedIterator): def __init__(self, config, *args, **kwargs): self.config = config self.count = 0 super(ResampleIterator, self).__init__(config, *args, **kwargs) def __call__(self, X, y=None, transform=None, color_vec=None): if y is not None: alpha = self.config.cnf['balance_ratio'] ** self.count class_weights = self.config.cnf['balance_weights'] * alpha \ + self.config.cnf['final_balance_weights'] * (1 - alpha) self.count += 1 indices = data.balance_per_class_indices(y, weights=class_weights) X = X[indices] y = y[indices] return super(ResampleIterator, self).__call__(X, y, transform=transform, color_vec=color_vec)
{ "pile_set_name": "Github" }
Point(1) = {0.0,0.0,0,0.04}; Point(2) = {3.1415926535897931,0.0,0,0.04}; Point(3) = {3.1415926535897931,3.1415926535897931,0,0.04}; Point(4) = {0.0,3.1415926535897931,0,0.04}; Line(1) = {4,3}; Line(2) = {3,2}; Line(3) = {2,1}; Line(4) = {1,4}; Line Loop(5) = {1,2,3,4}; Plane Surface(6) = {5}; Physical Line(7) = {3}; Physical Line(8) = {2}; Physical Line(9) = {1}; Physical Line(10) = {4}; Physical Surface(12) = {6};
{ "pile_set_name": "Github" }
var convert = require('./convert'), func = convert('uniqWith', require('../uniqWith')); func.placeholder = require('./placeholder'); module.exports = func;
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="{{ g.user.locale }}"> <head> <title>{{instance}} | {{title}}</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="apple-mobile-web-app-capable" content="yes"> <!-- Bootstrap --> <link rel="apple-touch-icon" sizes="140x140" href="{{ url_for('static', filename='favicon.ico') }}"> <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}"> <link href="{{ url_for('static', filename='css/libs/bootstrap.min.css') }}" rel="stylesheet" media="screen"> <link href="{{ url_for('static', filename='css/style.css') }}" rel="stylesheet" media="screen"> {% if g.user.get_theme == 1 %} <link href="{{ url_for('static', filename='css/caliBlur-style.css') }}" rel="stylesheet" media="screen"> {% endif %} <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> {% block header %}{% endblock %} </head> <body class="{{ page }}"> {% block body %} <div class="discover"> <h2>{{title}}</h2> <div class="row"> {% for entry in entries %} <div class="col-sm-3 col-lg-2 col-xs-6 book"> <div class="meta"> <p class="title">{{entry.title|shortentitle}}</p> <p class="author"> {% for author in entry.authors %} <a href="{{url_for('web.books_list', data='author', sort='new', book_id=author.id) }}">{{author.name.replace('|',',')}}</a> {% if not loop.last %} &amp; {% endif %} {% endfor %} </p> </div> <div class="btn-group" role="group" aria-label="Download, send to Kindle, reading"> {% if g.user.role_download() %} {% if entry.data|length %} <div class="btn-group" role="group"> {% if entry.data|length < 2 %} {% for format in entry.data %} <a href="{{ url_for('web.download_link', book_id=entry.id, book_format=format.format|lower, anyname=entry.id|string+'.'+format.format|lower) }}" id="btnGroupDrop1{{format.format|lower}}" class="btn btn-primary" role="button"> <span class="glyphicon glyphicon-download"></span>{{format.format}} ({{ format.uncompressed_size|filesizeformat }}) </a> {% endfor %} {% else %} <button id="btnGroupDrop1" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="glyphicon glyphicon-download"></span> {{_('Download')}} <span class="caret"></span> </button> <ul class="dropdown-menu" aria-labelledby="btnGroupDrop1"> {% for format in entry.data %} <li><a href="{{ url_for('web.download_link', book_id=entry.id, book_format=format.format|lower, anyname=entry.id|string+'.'+format.format|lower) }}">{{format.format}} ({{ format.uncompressed_size|filesizeformat }})</a></li> {% endfor %} </ul> {% endif %} </div> {% endif %} {% endif %} </div> </div> {% endfor %} </div> </div> <script src="{{ url_for('static', filename='js/libs/jquery.min.js') }}"></script> <script src="{{ url_for('static', filename='js/libs/bootstrap.min.js') }}"></script> {% endblock %} </body> </html>
{ "pile_set_name": "Github" }
import Scroll from '../../../blots/scroll'; describe('Bold', function() { it('optimize and merge', function() { const scroll = this.initialize( Scroll, '<p><strong>a</strong>b<strong>c</strong></p>', ); const bold = document.createElement('b'); bold.appendChild(scroll.domNode.firstChild.childNodes[1]); scroll.domNode.firstChild.insertBefore( bold, scroll.domNode.firstChild.lastChild, ); scroll.update(); expect(scroll.domNode).toEqualHTML('<p><strong>abc</strong></p>'); }); });
{ "pile_set_name": "Github" }
[ { "kids":[], "uid":"2952751297", "parent":"zf4MEjO7D", "text":"v", "mid":"Cmm3o64Ci", "date":"2015-06-13 14:29:51" }, { "kids":[], "uid":"2969172382", "parent":"BAHnM4Cbt", "text":"", "mid":"BAQA7DW1k", "date":"2014-12-14 23:12:52" }, { "kids":[], "uid":"pandapu", "parent":"BALaKah8R", "text":"", "mid":"BAPgCqCf7", "date":"2014-12-14 19:52:04" }, { "kids":[], "uid":"345950719", "parent":"BAHvwgdjy", "text":"→_→", "mid":"BAMYisRdA", "date":"2014-12-14 14:01:25" }, { "kids":[], "uid":"1729062082", "parent":"BAHov13tl", "text":"@始安公士或:@鞠部有羽:@风卡尔:侵华日军南京大屠杀遇难同胞纪念馆一期、二期工程是东南大学建筑研究所所长、中国建筑大师齐康院士设计的,三期新馆是华南理工大学建筑研究院院长、建筑大师何镜堂院士设计的。几期工程建设均不是日本人出资的。妈了个逼的会看日本维基了不起啊整个人都被日糊涂了吧傻逼", "mid":"BAMXfpQfx", "date":"2014-12-14 13:58:51" }, { "kids":[], "uid":"1729062082", "parent":"BAHtWqYKZ", "text":"@始安公士或:@风卡尔:难怪今年编的时候把钱数改多了233", "mid":"BAMX1dBuI", "date":"2014-12-14 13:58:17" }, { "kids":[], "uid":"2512401877", "parent":"BAHnM4Cbt", "text":"@鞠部有羽: →", "mid":"BAMlJl6Il", "date":"2014-12-14 12:26:25" }, { "kids":[], "uid":"1716956062", "parent":"BAHnM4Cbt", "text":"", "mid":"BALMaFBjz", "date":"2014-12-14 10:58:49" }, { "kids":[], "uid":"1895437373", "parent":"BAHnM4Cbt", "text":"转发以正视听", "mid":"BALAp5Zmd", "date":"2014-12-14 10:29:49" }, { "kids":[], "uid":"2032910365", "parent":"BALcnvvd4", "text":"这个日本播报什么鬼", "mid":"BALg86liv", "date":"2014-12-14 09:39:52" }, { "kids":[], "uid":"hanwensw", "parent":"BALaKah8R", "text":"", "mid":"BALdKi5GX", "date":"2014-12-14 09:34:00" }, { "kids":[ "BALg86liv" ], "uid":"2829727474", "parent":"BAHnM4Cbt", "text":"", "mid":"BALcnvvd4", "date":"2014-12-14 09:30:38" }, { "kids":[ "BAPgCqCf7", "BALdKi5GX" ], "uid":"1649134622", "parent":"BAHmgqqJ3", "text":"", "mid":"BALaKah8R", "date":"2014-12-14 09:26:36" }, { "kids":[], "uid":"woshiyuxiaomiao", "parent":"BAHnM4Cbt", "text":"", "mid":"BAL4vCE5v", "date":"2014-12-14 09:11:15" }, { "kids":[], "uid":"1439122241", "parent":"BAHnM4Cbt", "text":"", "mid":"BAL1J3shw", "date":"2014-12-14 09:04:22" }, { "kids":[], "uid":"2776708982", "parent":"BAHnM4Cbt", "text":"", "mid":"BAKZExIJg", "date":"2014-12-14 08:59:16" }, { "kids":[], "uid":"2966059160", "parent":"BAHnM4Cbt", "text":"", "mid":"BAKIHcpzi", "date":"2014-12-14 08:17:29" }, { "kids":[], "uid":"2023334373", "parent":"BAHnM4Cbt", "text":"", "mid":"BAKDtl46o", "date":"2014-12-14 08:04:38" }, { "kids":[], "uid":"1790006491", "parent":"BAHnM4Cbt", "text":"Sb播报", "mid":"BAIVQ4cmh", "date":"2014-12-14 03:44:23" }, { "kids":[], "uid":"2522665562", "parent":"BAHnM4Cbt", "text":"/@宅宋喵:", "mid":"BAIbQgDOg", "date":"2014-12-14 01:51:03" }, { "kids":[], "uid":"2537364800", "parent":"BAHMfso98", "text":"敌人还想用另一种方式亡我中华。有很多新汉奸。[怒骂][怒骂][怒骂]", "mid":"BAHN2vHxU", "date":"2014-12-14 00:49:58" }, { "kids":[], "uid":"1224267074", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHMt3kT9", "date":"2014-12-14 00:48:32" }, { "kids":[ "BAHN2vHxU" ], "uid":"2537364800", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHMfso98", "date":"2014-12-14 00:48:01" }, { "kids":[], "uid":"zifeiyuchen", "parent":"BAHmgqqJ3", "text":"", "mid":"BAHITq8yf", "date":"2014-12-14 00:39:44" }, { "kids":[], "uid":"1134621450", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHHhvHR8", "date":"2014-12-14 00:35:47" }, { "kids":[], "uid":"2246083305", "parent":"BAHnM4Cbt", "text":"→", "mid":"BAHENBuFR", "date":"2014-12-14 00:29:40" }, { "kids":[], "uid":"morenshaoguangliu", "parent":"BAHomrDL3", "text":"/@风卡尔:难怪今年编的时候把钱数改多了233", "mid":"BAHEsABHX", "date":"2014-12-14 00:28:50" }, { "kids":[], "uid":"2063265935", "parent":"BAHBg304Y", "text":"", "mid":"BAHE8uYdo", "date":"2014-12-14 00:28:02" }, { "kids":[], "uid":"3370908284", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHBB1SWc", "date":"2014-12-14 00:21:46" }, { "kids":[ "BAHE8uYdo" ], "uid":"1907152205", "parent":"BAHnM4Cbt", "text":":", "mid":"BAHBg304Y", "date":"2014-12-14 00:20:56" }, { "kids":[], "uid":"1463550215", "parent":"BAHxHALit", "text":"", "mid":"BAHAf7KcZ", "date":"2014-12-14 00:18:26" }, { "kids":[], "uid":"3968166808", "parent":"BAHtWqYKZ", "text":"", "mid":"BAHyCm0t0", "date":"2014-12-14 00:14:26" }, { "kids":[], "uid":"362823882w", "parent":"BAHomrDL3", "text":"/@风卡尔:难怪今年编的时候把钱数改多了233", "mid":"BAHyxksHJ", "date":"2014-12-14 00:14:14" }, { "kids":[], "uid":"3968166808", "parent":"BAHmgqqJ3", "text":"", "mid":"BAHxSgUZ1", "date":"2014-12-14 00:12:35" }, { "kids":[], "uid":"dameweise", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHxPgxnq", "date":"2014-12-14 00:12:29" }, { "kids":[ "BAHAf7KcZ" ], "uid":"5020370422", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHxHALit", "date":"2014-12-14 00:12:11" }, { "kids":[], "uid":"2479866510", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHwtEtNR", "date":"2014-12-14 00:09:10" }, { "kids":[], "uid":"theloveinmorning", "parent":"BAHvwgdjy", "text":"", "mid":"BAHw8m58T", "date":"2014-12-14 00:08:19" }, { "kids":[], "uid":"1418015820", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHvDoeHk", "date":"2014-12-14 00:07:05" }, { "kids":[ "BAMYisRdA", "BAHw8m58T" ], "uid":"xiongbaobaozhu", "parent":"BAHtWqYKZ", "text":"", "mid":"BAHvwgdjy", "date":"2014-12-14 00:06:48" }, { "kids":[], "uid":"erica0618", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHumrxgZ", "date":"2014-12-14 00:03:57" }, { "kids":[ "BAMYisRdA", "BAMX1dBuI", "BAHyCm0t0", "BAHw8m58T", "BAHvwgdjy" ], "uid":"1339432837", "parent":"BAHomrDL3", "text":"", "mid":"BAHtWqYKZ", "date":"2014-12-14 00:02:55" }, { "kids":[], "uid":"1740274074", "parent":"BAHmgqqJ3", "text":"", "mid":"BAHtP3SFG", "date":"2014-12-14 00:02:37" }, { "kids":[], "uid":"1828274683", "parent":"BAHnpjeyE", "text":"", "mid":"BAHtC65S4", "date":"2014-12-14 00:02:06" }, { "kids":[], "uid":"1820640905", "parent":"BAHpeec5n", "text":"", "mid":"BAHrIuyHm", "date":"2014-12-13 23:57:26" }, { "kids":[], "uid":"gamewarrior", "parent":"BAHov13tl", "text":"", "mid":"BAHrDaDfM", "date":"2014-12-13 23:57:12" }, { "kids":[], "uid":"1838959770", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHrnrO5n", "date":"2014-12-13 23:56:36" }, { "kids":[], "uid":"owlwihte", "parent":"", "text":"造谣死全家[太阳]", "mid":"BAHrm1NjS", "date":"2014-12-13 23:56:32" }, { "kids":[], "uid":"owlwihte", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHrchnfC", "date":"2014-12-13 23:56:08" }, { "kids":[], "uid":"xz48114900", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHpsqH0h", "date":"2014-12-13 23:51:51" }, { "kids":[ "BAHrIuyHm" ], "uid":"1349557471", "parent":"BAHmgqqJ3", "text":"", "mid":"BAHpeec5n", "date":"2014-12-13 23:51:17" }, { "kids":[ "BAMXfpQfx", "BAHrDaDfM" ], "uid":"1339432837", "parent":"BAHnM4Cbt", "text":"", "mid":"BAHov13tl", "date":"2014-12-13 23:49:30" }, { "kids":[ "BAMYisRdA", "BAMX1dBuI", "BAHEsABHX", "BAHyCm0t0", "BAHyxksHJ", "BAHw8m58T", "BAHvwgdjy", "BAHtWqYKZ" ], "uid":"yingjunwan", "parent":"", "text":"回复@王真实_字昋昊:难怪今年编的时候把钱数改多了233", "mid":"BAHomrDL3", "date":"2014-12-13 23:49:09" }, { "kids":[ "BAQA7DW1k", "BAMXfpQfx", "BAMlJl6Il", "BALMaFBjz", "BALAp5Zmd", "BALg86liv", "BALcnvvd4", "BAL4vCE5v", "BAL1J3shw", "BAKZExIJg", "BAKIHcpzi", "BAKDtl46o", "BAIVQ4cmh", "BAIbQgDOg", "BAHN2vHxU", "BAHMt3kT9", "BAHMfso98", "BAHHhvHR8", "BAHENBuFR", "BAHE8uYdo", "BAHBB1SWc", "BAHBg304Y", "BAHAf7KcZ", "BAHxPgxnq", "BAHxHALit", "BAHwtEtNR", "BAHvDoeHk", "BAHumrxgZ", "BAHrDaDfM", "BAHrnrO5n", "BAHrchnfC", "BAHpsqH0h", "BAHov13tl" ], "uid":"tzscat", "parent":"BAHmgqqJ3", "text":"", "mid":"BAHnM4Cbt", "date":"2014-12-13 23:47:43" }, { "kids":[], "uid":"2546096823", "parent":"BAHmgqqJ3", "text":"", "mid":"BAHnHFQL9", "date":"2014-12-13 23:47:33" }, { "kids":[ "BAHtC65S4" ], "uid":"1425757482", "parent":"BAHmgqqJ3", "text":"最右", "mid":"BAHnpjeyE", "date":"2014-12-13 23:46:49" }, { "kids":[ "BAQA7DW1k", "BAPgCqCf7", "BAMXfpQfx", "BAMlJl6Il", "BALMaFBjz", "BALAp5Zmd", "BALg86liv", "BALdKi5GX", "BALcnvvd4", "BALaKah8R", "BAL4vCE5v", "BAL1J3shw", "BAKZExIJg", "BAKIHcpzi", "BAKDtl46o", "BAIVQ4cmh", "BAIbQgDOg", "BAHN2vHxU", "BAHMt3kT9", "BAHMfso98", "BAHITq8yf", "BAHHhvHR8", "BAHENBuFR", "BAHE8uYdo", "BAHBB1SWc", "BAHBg304Y", "BAHAf7KcZ", "BAHxSgUZ1", "BAHxPgxnq", "BAHxHALit", "BAHwtEtNR", "BAHvDoeHk", "BAHumrxgZ", "BAHtP3SFG", "BAHtC65S4", "BAHrIuyHm", "BAHrDaDfM", "BAHrnrO5n", "BAHrchnfC", "BAHpsqH0h", "BAHpeec5n", "BAHov13tl", "BAHnM4Cbt", "BAHnHFQL9", "BAHnpjeyE" ], "uid":"yingjunwan", "parent":"zeUNluqBQ", "text":"陈年老梗", "mid":"BAHmgqqJ3", "date":"2014-12-13 23:44:00" }, { "kids":[], "uid":"2803239420", "parent":"zfbd9D90y", "text":"", "mid":"zfpnC85ja", "date":"2013-01-21 01:52:54" }, { "kids":[], "uid":"2919427880", "parent":"zfbd9D90y", "text":"", "mid":"zfo1qwLYT", "date":"2013-01-20 22:25:30" }, { "kids":[], "uid":"545478958", "parent":"zeUHJ8tID", "text":"代表首任老馆长的亲属严正抗议胡乱造谣!", "mid":"zffn7rPqh", "date":"2013-01-20 00:24:13" }, { "kids":[], "uid":"2393530844", "parent":"zeUHJ8tID", "text":"", "mid":"zfcccgxZv", "date":"2013-01-19 16:19:04" }, { "kids":[ "zfpnC85ja", "zfo1qwLYT" ], "uid":"2792022461", "parent":"zeUHJ8tID", "text":"", "mid":"zfbd9D90y", "date":"2013-01-19 13:48:41" }, { "kids":[], "uid":"2667225007", "parent":"zeUHJ8tID", "text":"", "mid":"zf7mqFNB1", "date":"2013-01-19 04:00:33" }, { "kids":[], "uid":"2789657324", "parent":"zeVRQfEWt", "text":"", "mid":"zf6rF5DpB", "date":"2013-01-19 01:40:41" }, { "kids":[ "Cmm3o64Ci" ], "uid":"cangui", "parent":"zeUHJ8tID", "text":"围观在日本的女妓者。", "mid":"zf4MEjO7D", "date":"2013-01-18 21:26:52" }, { "kids":[], "uid":"shendaming2011", "parent":"zeUHJ8tID", "text":"@蔡成平 不应该这么没谱呀", "mid":"zf4wMmYql", "date":"2013-01-18 20:47:48" }, { "kids":[], "uid":"719940401", "parent":"", "text":"造谣一时爽啊~~~~", "mid":"zf2oNzC1v", "date":"2013-01-18 15:22:37" }, { "kids":[], "uid":"1237024401", "parent":"zf16Gl9XQ", "text":"其余用途都拿去给原博买脑残片了(这种智商就别学人家玩什么免责留白装逼了)公知们要实行智商准入制,你们猪队友真是太多了真愁人", "mid":"zf23GzQD8", "date":"2013-01-18 14:30:35" }, { "kids":[], "uid":"2019033953", "parent":"", "text":"你作为一名记者,应该懂得发表实事求是的报道,在你没有求证的情况下,胡乱引用日本单方言论,还装B引申资金用途?不仅没有职业操守,还没有智商,更加没有脸!祝福你早日被右翼份子带去极乐世界使用3千万日元(冥币)!", "mid":"zf1tatFcM", "date":"2013-01-18 13:00:38" }, { "kids":[], "uid":"1635260782", "parent":"zeUHJ8tID", "text":"驻日女记者就是这样\"中日亲善\"的?你不配做记者,中国人在日本的脸都是被你们这样的人丢的吧", "mid":"zf1hO5NYX", "date":"2013-01-18 12:32:40" }, { "kids":[], "uid":"ranxiaochuan", "parent":"", "text":"造谣一时爽,全家火葬场。", "mid":"zf1eR82ht", "date":"2013-01-18 12:25:22" }, { "kids":[ "zf23GzQD8" ], "uid":"1405844237", "parent":"zeVZUbx2g", "text":"PO主就算要秀下限也要先看看自己的智商啊", "mid":"zf16Gl9XQ", "date":"2013-01-18 12:05:16" }, { "kids":[], "uid":"schumiwa", "parent":"", "text":"这种真的要死一户口本了", "mid":"zf0Oojodq", "date":"2013-01-18 11:20:12" }, { "kids":[], "uid":"1452645531", "parent":"", "text":"再次活捉一个带v的傻逼公共知识分子。", "mid":"zf0CLxDqv", "date":"2013-01-18 10:51:34" }, { "kids":[], "uid":"1766361990", "parent":"zeUHJ8tID", "text":"", "mid":"zf0tPddpJ", "date":"2013-01-18 10:29:31" }, { "kids":[], "uid":"shiffy", "parent":"zeZrP4Qbt", "text":"回复@言不邪:[哈哈]这小子居然在我面前提独立思想.@天益水火 @爱思想网 @共识网", "mid":"zf0oXw0cY", "date":"2013-01-18 10:17:32" }, { "kids":[], "uid":"1013945900", "parent":"", "text":"总忘不了那个100日元约等于0.8元RMB的年代", "mid":"zeZNUlry5", "date":"2013-01-18 08:46:16" }, { "kids":[], "uid":"1720617222", "parent":"zeKU0C5GK", "text":"@孙秀萍-0720: 南京大屠杀纪念馆是时任日本社民党委员长田边诚1980年访问南京时,提出要建设的。并捐赠了3千万日元的资金。这个说法的出处为日本讲谈社出版的《浜田幸一『日本をダメにした九人の政治家』講談社 (10秒前)", "mid":"zeZEV3gSS", "date":"2013-01-18 08:24:08" }, { "kids":[], "uid":"feng0203v", "parent":"zeWELt4s7", "text":"造谣一时爽,全家火葬场", "mid":"zeZwIxOn5", "date":"2013-01-18 08:03:54" }, { "kids":[ "zf0oXw0cY" ], "uid":"shiffy", "parent":"zeLnv9xFn", "text":"回复@言不邪:不要试图教猫唱歌.这样不但不会有结果.还会惹猫不高兴.[哈哈]", "mid":"zeZrP4Qbt", "date":"2013-01-18 07:51:52" }, { "kids":[], "uid":"2920610332", "parent":"zeVJa6VaN", "text":"", "mid":"zeZmrqhsj", "date":"2013-01-18 07:38:36" }, { "kids":[], "uid":"mx9stq", "parent":"zeUHJ8tID", "text":"现在的某些妓者的节操可真是碎了一地啊 还真他大爷的\"非常日本\"有本事制谣传谣 却手残不会辟谣 还美名谣言倒逼真相", "mid":"zeYcs1JvZ", "date":"2013-01-18 04:41:14" }, { "kids":[], "uid":"2919718662", "parent":"zeVRQfEWt", "text":"", "mid":"zeXpTyrsc", "date":"2013-01-18 02:41:37" }, { "kids":[], "uid":"1396165173", "parent":"zeUHJ8tID", "text":"", "mid":"zeWJz0LWM", "date":"2013-01-18 00:57:19" }, { "kids":[], "uid":"jadepeony", "parent":"zeUHJ8tID", "text":"@yubarnet 请看,原PO造谣说是日本人捐资修建的,已经被举报处理", "mid":"zeWId5klx", "date":"2013-01-18 00:53:56" }, { "kids":[ "zeZwIxOn5" ], "uid":"2293966703", "parent":"", "text":"博主造谣一时爽全家火葬场,日本维基根本就是洗白的", "mid":"zeWELt4s7", "date":"2013-01-18 00:45:27" }, { "kids":[], "uid":"3214751933", "parent":"", "text":"", "mid":"zeWBUb3RF", "date":"2013-01-18 00:38:27" }, { "kids":[], "uid":"wwdarliu", "parent":"zeWkEvjK1", "text":"还加V呢,应该是驻日女优采访录 作者吧", "mid":"zeWwVCVRw", "date":"2013-01-18 00:26:13" }, { "kids":[], "uid":"1406266851", "parent":"", "text":"晒晒汉奸", "mid":"zeWv7mZLv", "date":"2013-01-18 00:21:45" }, { "kids":[], "uid":"1946221697", "parent":"", "text":"纯傻逼", "mid":"zeWsQpusC", "date":"2013-01-18 00:16:08" }, { "kids":[], "uid":"1881169471", "parent":"", "text":"老逼让日本狗操多了吧,吃小鬼子屎多了撑的吧![怒骂][怒骂][怒骂]", "mid":"zeWnE2hEF", "date":"2013-01-18 00:03:15" }, { "kids":[ "zeWwVCVRw" ], "uid":"338960808", "parent":"", "text":"博主得多下贱才会造这种谣?[弱]", "mid":"zeWkEvjK1", "date":"2013-01-17 23:55:55" }, { "kids":[], "uid":"wirainbow", "parent":"", "text":"", "mid":"zeWjzpx75", "date":"2013-01-17 23:53:16" }, { "kids":[], "uid":"1838561861", "parent":"zeVLQwxAF", "text":"颠倒黑白!小日本不得好死!", "mid":"zeWiyct6M", "date":"2013-01-17 23:50:44" }, { "kids":[], "uid":"1839598612", "parent":"zeWcWFbue", "text":"博主真TM是贱货", "mid":"zeWeunDm1", "date":"2013-01-17 23:40:46" }, { "kids":[], "uid":"itsdaydream", "parent":"zeUYajgu0", "text":"[鄙视]博猪肯定是日本人@等夏躁郁症 @浮流", "mid":"zeWes1WR9", "date":"2013-01-17 23:40:40" }, { "kids":[ "zeWeunDm1" ], "uid":"itsdaydream", "parent":"zeUYajgu0", "text":"博猪直接火葬场,这点猪头肉我还不屑呢[鄙视]", "mid":"zeWcWFbue", "date":"2013-01-17 23:36:58" }, { "kids":[], "uid":"1728636741", "parent":"", "text":"真不要脸", "mid":"zeWaliW4f", "date":"2013-01-17 23:30:33" }, { "kids":[], "uid":"dianaholmes", "parent":"zeUHJ8tID", "text":"不实消消息已处理哦也!造谣一时爽,咳咳", "mid":"zeW8UoHVm", "date":"2013-01-17 23:27:01" }, { "kids":[], "uid":"1846555003", "parent":"", "text":"只能说呵呵,挂SB不解释", "mid":"zeW3YdQlK", "date":"2013-01-17 23:14:51" }, { "kids":[], "uid":"1919744412", "parent":"", "text":"", "mid":"zeW2CCRyM", "date":"2013-01-17 23:11:30" }, { "kids":[ "zf16Gl9XQ" ], "uid":"1825914203", "parent":"zeVHU72SI", "text":"设计师是齐康啊,我国建筑学泰斗啊,还有3000万日元能干啥啊?这个建筑物造价放在当年也应该有几千万人民币啦,你不要瞎扯", "mid":"zeVZUbx2g", "date":"2013-01-17 23:04:47" }, { "kids":[], "uid":"zyshuang", "parent":"zeUKqpTqY", "text":"全家火葬场", "mid":"zeVXC2XXc", "date":"2013-01-17 22:59:08" }, { "kids":[], "uid":"wuge1102", "parent":"zeUJVCJpS", "text":"居然有人相信。", "mid":"zeVTPpus4", "date":"2013-01-17 22:49:52" }, { "kids":[ "zf6rF5DpB", "zeXpTyrsc" ], "uid":"1407454871", "parent":"zeUHJ8tID", "text":"相信朱馆长!", "mid":"zeVRQfEWt", "date":"2013-01-17 22:44:58" }, { "kids":[ "zeWiyct6M" ], "uid":"zhoudawei", "parent":"zeV6iFlY7", "text":"原来是记妓者,我了然了", "mid":"zeVLQwxAF", "date":"2013-01-17 22:30:10" }, { "kids":[ "zeZmrqhsj" ], "uid":"1729985683", "parent":"zeUYc2s7B", "text":"sb记者", "mid":"zeVJa6VaN", "date":"2013-01-17 22:23:35" }, { "kids":[ "zeVZUbx2g" ], "uid":"1855436794", "parent":"", "text":"3000万日元2333333笑尿了", "mid":"zeVHU72SI", "date":"2013-01-17 22:20:29" }, { "kids":[], "uid":"2079277613", "parent":"", "text":"", "mid":"zeVH5jIrF", "date":"2013-01-17 22:18:28" }, { "kids":[], "uid":"koya625", "parent":"", "text":"其实这是个钓鱼贴 专钓傻缺带V公知的[偷笑]", "mid":"zeVFYpQUP", "date":"2013-01-17 22:15:45" }, { "kids":[], "uid":"dianaholmes", "parent":"zeUHJ8tID", "text":"造谣一时爽,全家", "mid":"zeVFm3Owr", "date":"2013-01-17 22:14:11" }, { "kids":[], "uid":"maceyyang", "parent":"zeVByukbE", "text":"奇了怪了,怎么纪念馆每隔一段时间就躺枪一次[汗]", "mid":"zeVFe5NCk", "date":"2013-01-17 22:13:53" }, { "kids":[], "uid":"1945490325", "parent":"", "text":"", "mid":"zeVE5rKvf", "date":"2013-01-17 22:11:04" }, { "kids":[], "uid":"1778145824", "parent":"zeVByukbE", "text":"三环= =笔误笔误", "mid":"zeVDOAazS", "date":"2013-01-17 22:10:25" }, { "kids":[], "uid":"2068750763", "parent":"", "text":"这明显是造谣嘛,但好歹给出了官方出处,希望国内造谣党学学博主。", "mid":"zeVDi5Z6g", "date":"2013-01-17 22:09:05" }, { "kids":[], "uid":"2723627043", "parent":"zeVByukbE", "text":"", "mid":"zeVDg1TKG", "date":"2013-01-17 22:09:01" }, { "kids":[ "zeVFe5NCk", "zeVDOAazS", "zeVDg1TKG" ], "uid":"1778145824", "parent":"", "text":"南屠纪念馆的设计者不是齐康老先生吗?博主是脑残?还3000W日元,折合人民币后在北京六环内买套方子都买不起吧", "mid":"zeVByukbE", "date":"2013-01-17 22:04:51" }, { "kids":[], "uid":"2042999121", "parent":"zeUHJ8tID", "text":"", "mid":"zeVyCfwBF", "date":"2013-01-17 21:57:36" }, { "kids":[], "uid":"2581902452", "parent":"zeVhEwX95", "text":"日文wiki上竟然就是照原PO说的所写...问题是wiki的来源是一段youtube上的采访,被采访的人叫半本茂,他说了一大堆日本人出资3000万日本人设计,最后来一句,都是听说的...||||希望日本右翼也可以造谣死一户口本,不对,应该是死一住民票[黑线]", "mid":"zeVxdk3jl", "date":"2013-01-17 21:54:07" }, { "kids":[], "uid":"1748040742", "parent":"zeV8k0Nr4", "text":"造谣一时爽", "mid":"zeVwTvZwi", "date":"2013-01-17 21:53:21" }, { "kids":[], "uid":"uc75569922", "parent":"", "text":"脑子有病就去医治,医治不了不乐意医就直接去S吧!", "mid":"zeVtRiBvC", "date":"2013-01-17 21:45:51" }, { "kids":[], "uid":"renjintingxin", "parent":"zeV9r92eP", "text":"我都想不通,怎么会有这么不要脸的人", "mid":"zeVqn3flx", "date":"2013-01-17 21:37:18" }, { "kids":[], "uid":"2105204933", "parent":"", "text":"三千万日元……好大一笔钱哟", "mid":"zeVlGeAFt", "date":"2013-01-17 21:25:43" }, { "kids":[], "uid":"1357337992", "parent":"zeV9r92eP", "text":"", "mid":"zeVjAe6Jf", "date":"2013-01-17 21:20:34" }, { "kids":[ "zeVxdk3jl" ], "uid":"1963722647", "parent":"", "text":"1980年原日本社会党委员长田边诚访问南京,表示希望建设大屠杀纪念馆,并为纪念馆建设捐赠了870万日元。而大屠杀纪念馆的一期建设是1983年才由政府批准成立的,纪念馆由东南大学齐康设计,广场浮雕由南艺钱大泾设计,和日本人无关,以上是维基百科上查到的", "mid":"zeVhEwX95", "date":"2013-01-17 21:15:49" }, { "kids":[], "uid":"prosperlee", "parent":"zeUHJ8tID", "text":"", "mid":"zeVgFE4Gw", "date":"2013-01-17 21:13:24" }, { "kids":[], "uid":"1984707211", "parent":"zeV9r92eP", "text":"取证未明朗前,谁说的我都不信。", "mid":"zeVdOFKQa", "date":"2013-01-17 21:06:21" }, { "kids":[], "uid":"1893159435", "parent":"", "text":"", "mid":"zeVdziOdB", "date":"2013-01-17 21:05:44" }, { "kids":[], "uid":"wj1929", "parent":"zeV9r92eP", "text":"[怒]", "mid":"zeVdoElgj", "date":"2013-01-17 21:05:17" }, { "kids":[], "uid":"2686702781", "parent":"zeV9r92eP", "text":"狗。。。", "mid":"zeVdboxWg", "date":"2013-01-17 21:04:46" }, { "kids":[], "uid":"1403498431", "parent":"", "text":"这绝对是个谣言!侵华日军南京大屠杀遇难同胞纪念馆一期、二期是东南大学建筑研究所所长、中国建筑大师齐康院士设计,三期是华南理工大学建筑研究院院长、建筑大师何镜堂院士设计。几期工程均不是日本人出资。", "mid":"zeVd389ue", "date":"2013-01-17 21:04:28" }, { "kids":[], "uid":"1462776770", "parent":"zeV6iFlY7", "text":"“紫金花女孩”", "mid":"zeVbT14bk", "date":"2013-01-17 21:01:34" }, { "kids":[], "uid":"1400811275", "parent":"zeV6Qlsfb", "text":"博主是谣姐儿啊[鄙视]", "mid":"zeVb035VV", "date":"2013-01-17 20:59:22" }, { "kids":[], "uid":"2854196494", "parent":"", "text":"博猪在装无辜呢", "mid":"zeVaRd5Cs", "date":"2013-01-17 20:59:03" }, { "kids":[ "zeVqn3flx", "zeVjAe6Jf", "zeVdOFKQa", "zeVdoElgj", "zeVdboxWg" ], "uid":"2493590842", "parent":"", "text":"俩无耻日奴杂碎!", "mid":"zeV9r92eP", "date":"2013-01-17 20:55:34" }, { "kids":[], "uid":"hxq216", "parent":"", "text":"右边儿请赶紧披露,都等着看呢。[鼓掌]@微博小秘书 你们站方人员参与造谣传谣,会怎么处理呢?", "mid":"zeV92kkiT", "date":"2013-01-17 20:54:35" }, { "kids":[], "uid":"1830654182", "parent":"", "text":"没人愿意有南京大屠杀这样的惨剧!不知道日本有人知道反省么!", "mid":"zeV8znCRh", "date":"2013-01-17 20:53:25" }, { "kids":[ "zeVwTvZwi" ], "uid":"fish423", "parent":"zeUTyzgIU", "text":"造谣一时爽,全家火葬场", "mid":"zeV8k0Nr4", "date":"2013-01-17 20:52:48" }, { "kids":[], "uid":"ameriika", "parent":"", "text":"真的活活气死了,老娘祖籍江苏,当年我外公家里死多少人!邻里就没有一家是全活着的!有家两个小孩活活挑死在刺刀上!尼玛你看个倾向性那么强的维基就当是事实是吧!?那些死去的人绝对会来找你的!你要失望了,他们肯定不是来艹你的!就是围着你不停的问“你怎么没死”啊!", "mid":"zeV8cC7m5", "date":"2013-01-17 20:52:30" }, { "kids":[], "uid":"pimaozi", "parent":"zeUP30Jqh", "text":"", "mid":"zeV6TiMzO", "date":"2013-01-17 20:49:17" }, { "kids":[ "zeVb035VV" ], "uid":"1401227000", "parent":"zeV6iFlY7", "text":"右边两位?打算替鬼子刷锅?博主在日本,让新浪封掉她就拉倒了", "mid":"zeV6Qlsfb", "date":"2013-01-17 20:49:11" }, { "kids":[ "zeVLQwxAF", "zeVbT14bk", "zeV6Qlsfb" ], "uid":"1403915120", "parent":"zeUZ9qa9E", "text":"", "mid":"zeV6iFlY7", "date":"2013-01-17 20:47:49" }, { "kids":[], "uid":"2019884837", "parent":"zeV3dfIKT", "text":"看来想卖书都得造谣当公知啊", "mid":"zeV6iE0tf", "date":"2013-01-17 20:47:51" }, { "kids":[], "uid":"2687818850", "parent":"", "text":"这种傻逼更年期妇女,没有任何的良心与良知,除了跟风放屁之外完全没有别的本事。转发消息连最基本的验证功课都不做,还说只是觉得新奇。那我也说句让你觉得新奇的话,你去转发一下?我听说你其实不是你爸亲生的。", "mid":"zeV5t08Gj", "date":"2013-01-17 20:45:44" }, { "kids":[], "uid":"1428031081", "parent":"", "text":"sb博主知道1980年的日元值多少钱吗?我一般不骂人!但今天我要骂我擦博主尼玛逼!", "mid":"zeV5lzeWE", "date":"2013-01-17 20:45:29" }, { "kids":[], "uid":"2624480122", "parent":"", "text":"据说,这个记者的诞生也有日本的一部分参与!", "mid":"zeV5ev1u4", "date":"2013-01-17 20:45:13" }, { "kids":[], "uid":"2839513832", "parent":"", "text":"谴责!", "mid":"zeV5edq27", "date":"2013-01-17 20:45:12" }, { "kids":[], "uid":"olivia70", "parent":"zeUYaARWd", "text":"的确现在不应该鼓吹民族仇恨,但拿日本维基来给日本洗白这站得住脚么", "mid":"zeV5ebTKh", "date":"2013-01-17 20:45:13" }, { "kids":[], "uid":"suethree", "parent":"", "text":"这特么还要举证??请问是要举啥证???@微博小秘书 @微博辟谣 去日本体检项目里有洗脑这一项么谁来告诉我[怒]", "mid":"zeV4rqd8J", "date":"2013-01-17 20:43:16" }, { "kids":[ "zeV6iE0tf" ], "uid":"2687818850", "parent":"", "text":"南京大屠杀纪念馆初建设计者齐康,扩建设计者何镜堂、刘宇波,都是中国人。目前没有任何证据能够证明田边诚曾经为纪念馆捐款。即便有捐款,1980年的三千万日元经过与当时的美日汇率换算后折合人民币约18万左右,870万日元折合5万元左右,完全不足以修完纪念馆还能给人贪污。这种谎言没有任何意义。", "mid":"zeV3dfIKT", "date":"2013-01-17 20:40:14" }, { "kids":[], "uid":"2101557260", "parent":"", "text":"造谣一时爽 全家火葬场 我这次是认真的", "mid":"zeV1bmL2Y", "date":"2013-01-17 20:35:14" }, { "kids":[], "uid":"sikongyingwu", "parent":"", "text":"@侵华日军南京大屠杀遇难同胞纪念馆 请辟谣!!", "mid":"zeV1a8Ga6", "date":"2013-01-17 20:35:09" }, { "kids":[], "uid":"2043178057", "parent":"zeUVmg9D7", "text":"三峡五亿?", "mid":"zeV0LAOYl", "date":"2013-01-17 20:34:11" }, { "kids":[], "uid":"209111020", "parent":"zeUZaDIbs", "text":"", "mid":"zeV0s8Rhh", "date":"2013-01-17 20:33:26" }, { "kids":[], "uid":"liyulei1993", "parent":"zeUR08VP6", "text":"", "mid":"zeV0a5flz", "date":"2013-01-17 20:32:43" }, { "kids":[], "uid":"lovekuntoria", "parent":"", "text":"你们全家也是日本人资助的吧!", "mid":"zeUZMamqx", "date":"2013-01-17 20:31:47" }, { "kids":[], "uid":"2068818411", "parent":"", "text":"最近有想带日本人去参观一下的想法", "mid":"zeUZyjoZR", "date":"2013-01-17 20:31:13" }, { "kids":[], "uid":"576601789", "parent":"zeUYc2s7B", "text":"", "mid":"zeUZuah0b", "date":"2013-01-17 20:31:01" }, { "kids":[], "uid":"2854196494", "parent":"", "text":"竟然还有几位相信。。。我感到一种无力感。。。原po又改装清纯,艹,操,洗地的婊子样还想当清倌人?", "mid":"zeUZdzFBZ", "date":"2013-01-17 20:30:23" }, { "kids":[ "zeV0s8Rhh" ], "uid":"1731125571", "parent":"zeUJVCJpS", "text":"卄、sb以为只有自己才能看日本維基啊、那个維基开头就质疑了南京大屠杀的人数、后面更质疑纪念馆的展品的可信度、批评展馆的目的、完全就是站在日本立场的东西、竟然还有人拿来做真相。为了反某党、拿日本右翼的东西当宝、贱不贱呀", "mid":"zeUZaDIbs", "date":"2013-01-17 20:30:17" }, { "kids":[ "zeV6iFlY7" ], "uid":"gaolinman", "parent":"zeUYajgu0", "text":"你不嫌脏了你的蔡国庆?", "mid":"zeUZ9qa9E", "date":"2013-01-17 20:30:13" }, { "kids":[ "zeVJa6VaN", "zeUZuah0b" ], "uid":"207778625", "parent":"zeUWy9a9I", "text":"", "mid":"zeUYc2s7B", "date":"2013-01-17 20:27:52" }, { "kids":[ "zeV5ebTKh" ], "uid":"tifenn", "parent":"zeUNluqBQ", "text":"", "mid":"zeUYaARWd", "date":"2013-01-17 20:27:49" }, { "kids":[ "zeWes1WR9", "zeWcWFbue", "zeUZ9qa9E" ], "uid":"2751425153", "parent":"", "text":"我日博主他妈", "mid":"zeUYajgu0", "date":"2013-01-17 20:27:48" }, { "kids":[], "uid":"seeccsee", "parent":"zeUWYoyPY", "text":"博主无恥不要脸", "mid":"zeUY9p4yM", "date":"2013-01-17 20:27:43" }, { "kids":[], "uid":"brotherwei001", "parent":"", "text":"博主用这个造谣不怕遭天谴吗?[怒]", "mid":"zeUXX0uDb", "date":"2013-01-17 20:27:16" }, { "kids":[], "uid":"kusozongyi", "parent":"zeUWy9a9I", "text":"钓鱼帖吧,确实够无耻", "mid":"zeUXECC1F", "date":"2013-01-17 20:26:33" }, { "kids":[], "uid":"1752461610", "parent":"", "text":"造谣一时爽,全家火葬场。原博主自重!!", "mid":"zeUXc353Y", "date":"2013-01-17 20:25:21" }, { "kids":[ "zeUY9p4yM" ], "uid":"1946221697", "parent":"", "text":"", "mid":"zeUWYoyPY", "date":"2013-01-17 20:24:53" }, { "kids":[], "uid":"819811121", "parent":"", "text":"三千万日元顶多做一期全能住宅改造王的预算好不好[挖鼻屎]造谣也不造个智商高点的", "mid":"zeUWWktAB", "date":"2013-01-17 20:24:47" }, { "kids":[], "uid":"2315805284", "parent":"", "text":"围观脑残", "mid":"zeUWPwzVs", "date":"2013-01-17 20:24:31" }, { "kids":[], "uid":"1668378503", "parent":"zeUJVCJpS", "text":"擦,拿这种事造谣很有意思吗?!", "mid":"zeUWD9akz", "date":"2013-01-17 20:24:01" }, { "kids":[], "uid":"anson8461", "parent":"zeKU0C5GK", "text":"搞半天日本人说的呀…日本人是你大爷啊", "mid":"zeUWBEhry", "date":"2013-01-17 20:23:58" }, { "kids":[ "zeUYc2s7B", "zeUXECC1F" ], "uid":"qingjiu9", "parent":"zeUTuEKCz", "text":"原博无耻之尤!", "mid":"zeUWy9a9I", "date":"2013-01-17 20:23:49" }, { "kids":[], "uid":"1349769505", "parent":"zeUTd13OC", "text":"看到原博关注的是些什么货色就懂了,全是些不造谣不舒服斯基翔[挖鼻屎]", "mid":"zeUWmAqVR", "date":"2013-01-17 20:23:22" }, { "kids":[], "uid":"1743163867", "parent":"zeUJVCJpS", "text":"日。语。维。基。好高级哦,什么时候这个谁都能捅的货也能当铁证啦", "mid":"zeUVQ4xWR", "date":"2013-01-17 20:22:04" }, { "kids":[], "uid":"3087056771", "parent":"zeUHJ8tID", "text":"制造谣言的人真可耻。", "mid":"zeUVufTGq", "date":"2013-01-17 20:21:12" }, { "kids":[ "zeV0LAOYl" ], "uid":"1919160742", "parent":"zeUHJ8tID", "text":"", "mid":"zeUVmg9D7", "date":"2013-01-17 20:20:53" }, { "kids":[], "uid":"2346032624", "parent":"zeUJVCJpS", "text":"最右的微博让俺大开眼界妥妥的~~~", "mid":"zeUUAoqfG", "date":"2013-01-17 20:18:59" }, { "kids":[ "zeV8k0Nr4" ], "uid":"rachelkurt", "parent":"zeUJVCJpS", "text":"这人欣赏李承鹏呀!还用说什么吗?", "mid":"zeUTyzgIU", "date":"2013-01-17 20:16:27" }, { "kids":[ "zeUWy9a9I" ], "uid":"1751298614", "parent":"zeUNluqBQ", "text":"拿这种事造谣的都去死!", "mid":"zeUTuEKCz", "date":"2013-01-17 20:16:18" }, { "kids":[], "uid":"1681506250", "parent":"zeUJVCJpS", "text":"狗屁妓者!造谣死全家!", "mid":"zeUThFHnp", "date":"2013-01-17 20:15:46" }, { "kids":[ "zeUWmAqVR" ], "uid":"1349769505", "parent":"zeUJVCJpS", "text":"#谁信谁傻逼系列#", "mid":"zeUTd13OC", "date":"2013-01-17 20:15:32" }, { "kids":[], "uid":"2285748402", "parent":"", "text":"其实我想告诉你,日本其实是不存在的!", "mid":"zeUTaklDv", "date":"2013-01-17 20:15:28" }, { "kids":[], "uid":"2004998751", "parent":"zeUNsikbt", "text":"好吧,我同意你说的,把他们全送去[酷][酷]", "mid":"zeUT9pAdl", "date":"2013-01-17 20:15:26" }, { "kids":[], "uid":"1845837954", "parent":"", "text":"造这种谣死一户口本!", "mid":"zeUSLf00u", "date":"2013-01-17 20:14:28" }, { "kids":[], "uid":"zheng1008", "parent":"zeUHJ8tID", "text":"", "mid":"zeUSEFf4Y", "date":"2013-01-17 20:14:11" }, { "kids":[], "uid":"1819324183", "parent":"zeUJVCJpS", "text":"谁信谁傻逼", "mid":"zeUSzE3ww", "date":"2013-01-17 20:14:01" }, { "kids":[], "uid":"xxxbeam", "parent":"zeUPjxprl", "text":"这真是我见过的……", "mid":"zeURO8OxZ", "date":"2013-01-17 20:12:07" }, { "kids":[], "uid":"1845857210", "parent":"zeUJVCJpS", "text":"造这种谣言的死全家不解释!", "mid":"zeURC3L1b", "date":"2013-01-17 20:11:36" }, { "kids":[], "uid":"kikirara", "parent":"zeUNVfWWx", "text":"就算3千万日元也才200多人民币好嘛,怎么够用", "mid":"zeURvbXH1", "date":"2013-01-17 20:11:23" }, { "kids":[ "zeV0a5flz" ], "uid":"yingxuewan", "parent":"", "text":"朱馆长这个微博我要保存的~以后兴许有用~", "mid":"zeUR08VP6", "date":"2013-01-17 20:10:09" }, { "kids":[], "uid":"emellend", "parent":"", "text":"造谣一时爽,全家火葬场", "mid":"zeUQtDENk", "date":"2013-01-17 20:08:52" }, { "kids":[], "uid":"2956701330", "parent":"", "text":"已举报,造谣死全家. 这种无中生有的事还求辟谣求你麻痹,应该是博主先拿证据举证才对,不然博主这种贱货母狗在国外你早因造谣而被抓监狱里了/@丁香_求出拂素起龙漪: 尼玛的就算大脑里不是王水造这种谣的畜生都该给灌进去", "mid":"zeUQ9f5x2", "date":"2013-01-17 20:08:03" }, { "kids":[], "uid":"amoonli", "parent":"", "text":"博主是吃日本人的屎吃到脑残了吧!!", "mid":"zeUQ85zd4", "date":"2013-01-17 20:08:00" }, { "kids":[], "uid":"210127204", "parent":"", "text":"傻逼", "mid":"zeUPyE4Bg", "date":"2013-01-17 20:06:36" }, { "kids":[ "zeURO8OxZ" ], "uid":"yigeyigechai", "parent":"zeUL92w8v", "text":"为什么这也要造谣啊!", "mid":"zeUPjxprl", "date":"2013-01-17 20:06:00" }, { "kids":[ "zeV6TiMzO" ], "uid":"1147071504", "parent":"zeUNsikbt", "text":"驻日妓者,呵呵呵", "mid":"zeUP30Jqh", "date":"2013-01-17 20:05:20" }, { "kids":[], "uid":"1793620894", "parent":"zeUNluqBQ", "text":"继续@黄粱---梦", "mid":"zeUOX64UI", "date":"2013-01-17 20:05:06" }, { "kids":[], "uid":"1956033021", "parent":"zeULD8PTO", "text":"", "mid":"zeUOyy03j", "date":"2013-01-17 20:04:08" }, { "kids":[], "uid":"jisipomiao", "parent":"", "text":"最右和博主SB,造谣一时爽全家火葬场,当设计者齐康和何镜堂不存在是吧", "mid":"zeUOvBZkQ", "date":"2013-01-17 20:04:01" }, { "kids":[], "uid":"kiwifield", "parent":"zeUJVCJpS", "text":"装的应该是翔", "mid":"zeUNW9c2L", "date":"2013-01-17 20:02:37" }, { "kids":[ "zeURvbXH1" ], "uid":"312414678", "parent":"zeUJVCJpS", "text":"呵呵呵", "mid":"zeUNVfWWx", "date":"2013-01-17 20:02:33" }, { "kids":[ "zeUT9pAdl", "zeUP30Jqh" ], "uid":"1878700370", "parent":"", "text":"[鄙视]我去过南京大屠杀纪念馆,旧馆我记得是东南大学的教授齐康院士设计,新馆是何镜堂设计的,哪去找日本人?旧馆当年是南京人民捐建的关日本人毛事儿???造谣无耻!!造谣一时爽,全家火葬场,左小祖咒例子在前!!", "mid":"zeUNsikbt", "date":"2013-01-17 20:01:23" }, { "kids":[ "BAQA7DW1k", "BAPgCqCf7", "BAMXfpQfx", "BAMlJl6Il", "BALMaFBjz", "BALAp5Zmd", "BALg86liv", "BALdKi5GX", "BALcnvvd4", "BALaKah8R", "BAL4vCE5v", "BAL1J3shw", "BAKZExIJg", "BAKIHcpzi", "BAKDtl46o", "BAIVQ4cmh", "BAIbQgDOg", "BAHN2vHxU", "BAHMt3kT9", "BAHMfso98", "BAHITq8yf", "BAHHhvHR8", "BAHENBuFR", "BAHE8uYdo", "BAHBB1SWc", "BAHBg304Y", "BAHAf7KcZ", "BAHxSgUZ1", "BAHxPgxnq", "BAHxHALit", "BAHwtEtNR", "BAHvDoeHk", "BAHumrxgZ", "BAHtP3SFG", "BAHtC65S4", "BAHrIuyHm", "BAHrDaDfM", "BAHrnrO5n", "BAHrchnfC", "BAHpsqH0h", "BAHpeec5n", "BAHov13tl", "BAHnM4Cbt", "BAHnHFQL9", "BAHnpjeyE", "BAHmgqqJ3", "zeUYaARWd", "zeUTuEKCz", "zeUOX64UI" ], "uid":"yingjunwan", "parent":"", "text":"侵华日军南京大屠杀遇难同胞纪念馆一期、二期工程是东南大学建筑研究所所长、中国建筑大师齐康院士设计的,三期新馆是华南理工大学建筑研究院院长、建筑大师何镜堂院士设计的。几期工程建设均不是日本人出资的。(妈了个逼的会看日本维基了不起啊整个人都被日糊涂了吧傻逼", "mid":"zeUNluqBQ", "date":"2013-01-17 20:01:07" }, { "kids":[], "uid":"2013912774", "parent":"", "text":"", "mid":"zeUMXjx9p", "date":"2013-01-17 20:00:08" }, { "kids":[], "uid":"207657895", "parent":"zeUJVCJpS", "text":"王水无误。。。", "mid":"zeUMU2ZWJ", "date":"2013-01-17 20:00:01" }, { "kids":[], "uid":"1794325805", "parent":"zeUJVCJpS", "text":"造谣那啥那啥火葬场", "mid":"zeUMvxHEx", "date":"2013-01-17 19:59:02" }, { "kids":[], "uid":"yundanfengqingguoguo", "parent":"zeUJVCJpS", "text":"博主傻逼!纪念馆是齐康设计的。另外这段子让姐想到AC上面有个回复三峡大坝只用五亿建造的梗", "mid":"zeUMjoe1v", "date":"2013-01-17 19:58:34" }, { "kids":[], "uid":"1710950603", "parent":"zeUJVCJpS", "text":"右边王水是要现配的 你应该所 1/4 脑子是硝酸 3/4脑子是 是盐酸", "mid":"zeUMieRLo", "date":"2013-01-17 19:58:32" }, { "kids":[], "uid":"seniordoraemon", "parent":"", "text":"求辟谣,当年装几个三菱空调还掀起风波呢这还了得", "mid":"zeUM6o4yb", "date":"2013-01-17 19:58:05" }, { "kids":[], "uid":"1908123857", "parent":"zeUJVCJpS", "text":"他妈的你爹是谁!!!", "mid":"zeULYFCeX", "date":"2013-01-17 19:57:44" }, { "kids":[], "uid":"2564936155", "parent":"", "text":"这个博主就是日军遗孤吧!赶紧送回去!", "mid":"zeULXzRa4", "date":"2013-01-17 19:57:40" }, { "kids":[], "uid":"1878700370", "parent":"zeUJVCJpS", "text":"没去过大屠杀纪念馆的就他妈给我闭嘴。。草。。。", "mid":"zeULNcZv7", "date":"2013-01-17 19:57:17" }, { "kids":[], "uid":"912107109", "parent":"zeUJVCJpS", "text":"博主傻逼", "mid":"zeULKd1iA", "date":"2013-01-17 19:57:13" }, { "kids":[], "uid":"1853479750", "parent":"zeUJVCJpS", "text":"设计者你麻痹!别的都不说,光馆前那口钟的整体就是我母校建筑系设计的!造谣死一户口本,你个汉奸!", "mid":"zeULIrQIZ", "date":"2013-01-17 19:57:08" }, { "kids":[], "uid":"motata8154", "parent":"zeRi4ktLD", "text":"", "mid":"zeULG7str", "date":"2013-01-17 19:57:00" }, { "kids":[ "zeUOyy03j" ], "uid":"1793620894", "parent":"", "text":"@黄粱---梦 你要的辟谣", "mid":"zeULD8PTO", "date":"2013-01-17 19:56:55" }, { "kids":[], "uid":"1930259725", "parent":"zeUJVCJpS", "text":"po主满脑翔吧!!!", "mid":"zeULo3hE4", "date":"2013-01-17 19:56:17" }, { "kids":[], "uid":"1857871752", "parent":"zeUKrzI6y", "text":"擦!", "mid":"zeULiqegI", "date":"2013-01-17 19:56:06" }, { "kids":[], "uid":"orangeandsnow", "parent":"zeUJVCJpS", "text":"造谣挂一户口本", "mid":"zeULi9WwZ", "date":"2013-01-17 19:56:05" }, { "kids":[ "zeUPjxprl" ], "uid":"coldsmilexiong", "parent":"zeUKhuEF4", "text":"举报", "mid":"zeUL92w8v", "date":"2013-01-17 19:55:42" }, { "kids":[], "uid":"1142683333", "parent":"zeUJVCJpS", "text":"已举报不谢", "mid":"zeUL7ua63", "date":"2013-01-17 19:55:40" }, { "kids":[ "zeULiqegI" ], "uid":"1905336547", "parent":"zeUJVCJpS", "text":"#谁信谁傻逼系列#", "mid":"zeUKrzI6y", "date":"2013-01-17 19:54:00" }, { "kids":[ "zeVXC2XXc" ], "uid":"motata8154", "parent":"zeUJVCJpS", "text":"博主有证据吗?造谣一时爽", "mid":"zeUKqpTqY", "date":"2013-01-17 19:53:54" }, { "kids":[ "zeUL92w8v" ], "uid":"lilyefair", "parent":"zeUJVCJpS", "text":"尼玛的就算大脑里不是王水造这种谣的畜生都该给灌进去", "mid":"zeUKhuEF4", "date":"2013-01-17 19:53:36" }, { "kids":[ "zeVTPpus4", "zeUZaDIbs", "zeUWD9akz", "zeUVQ4xWR", "zeUUAoqfG", "zeUTyzgIU", "zeUThFHnp", "zeUTd13OC", "zeUSzE3ww", "zeURC3L1b", "zeUNW9c2L", "zeUNVfWWx", "zeUMU2ZWJ", "zeUMvxHEx", "zeUMjoe1v", "zeUMieRLo", "zeULYFCeX", "zeULNcZv7", "zeULKd1iA", "zeULIrQIZ", "zeULo3hE4", "zeULi9WwZ", "zeUL7ua63", "zeUKrzI6y", "zeUKqpTqY", "zeUKhuEF4" ], "uid":"1865807363", "parent":"zeUIM9e34", "text":"信这种的人,大!脑!里!装!的!是!王!水!么!", "mid":"zeUJVCJpS", "date":"2013-01-17 19:52:44" }, { "kids":[], "uid":"jiajingann", "parent":"zeUHJ8tID", "text":"", "mid":"zeUJn5Ax1", "date":"2013-01-17 19:51:18" }, { "kids":[], "uid":"543798235", "parent":"zeUHJ8tID", "text":"傻逼的日本维基百科", "mid":"zeUJfEK0g", "date":"2013-01-17 19:51:02" }, { "kids":[ "zeUJVCJpS" ], "uid":"yingjunwan", "parent":"", "text":"造谣死一户口本", "mid":"zeUIM9e34", "date":"2013-01-17 19:49:53" }, { "kids":[ "Cmm3o64Ci", "zffn7rPqh", "zfcccgxZv", "zfbd9D90y", "zf7mqFNB1", "zf4MEjO7D", "zf4wMmYql", "zf1hO5NYX", "zf0tPddpJ", "zeYcs1JvZ", "zeWJz0LWM", "zeWId5klx", "zeW8UoHVm", "zeVRQfEWt", "zeVFm3Owr", "zeVyCfwBF", "zeVgFE4Gw", "zeUVufTGq", "zeUVmg9D7", "zeUSEFf4Y", "zeUJn5Ax1", "zeUJfEK0g" ], "uid":"1702128822", "parent":"", "text":"这简直是造谣,无中生有", "mid":"zeUHJ8tID", "date":"2013-01-17 19:47:18" }, { "kids":[], "uid":"1642323714", "parent":"", "text":"", "mid":"zeUHC1FWF", "date":"2013-01-17 19:47:00" }, { "kids":[], "uid":"1452906844", "parent":"", "text":"这个。。。这个。。。这样还有脸骂别人吗?[怒]", "mid":"zeTD0hDzq", "date":"2013-01-17 17:02:55" }, { "kids":[], "uid":"momokatx", "parent":"zeQRc5l6r", "text":"", "mid":"zeTmuCJ74", "date":"2013-01-17 16:22:15" }, { "kids":[], "uid":"2596554803", "parent":"", "text":"回复@车水码农:请注意,事情发生在80年代,那时的物价、工资,你查查就知道。另外维基百科也没说870万日元建成了阿,只说用于建设了。另外也感谢其他各位网友纷纷发言,并爱特我,恕不能一一回复。", "mid":"zeSJm4UCY", "date":"2013-01-17 14:45:49" }, { "kids":[], "uid":"2617080927", "parent":"", "text":"", "mid":"zeSoObMqJ", "date":"2013-01-17 13:55:10" }, { "kids":[], "uid":"1872812322", "parent":"zeRnQah3Z", "text":"", "mid":"zeROTnVPJ", "date":"2013-01-17 12:26:43" }, { "kids":[], "uid":"2243649422", "parent":"", "text":"回复@边儿上坐个屁篓子:是捐了3000万,不是800万。按你的算法应折合25万,当时天下均36,你还记得吗?我想作者的用意是说只有1/4被用于建设的无奈,和3/4被....", "mid":"zeRObl2pF", "date":"2013-01-17 12:24:57" }, { "kids":[], "uid":"zippers", "parent":"", "text":"", "mid":"zeRNRAqjO", "date":"2013-01-17 12:24:11" }, { "kids":[], "uid":"2001162327", "parent":"zeRDUjaVw", "text":"", "mid":"zeRNLDnFc", "date":"2013-01-17 12:23:56" }, { "kids":[], "uid":"2455460214", "parent":"", "text":"[围观]", "mid":"zeRLv2LgP", "date":"2013-01-17 12:18:20" }, { "kids":[], "uid":"eyitokiwa", "parent":"zeRyNdO0Z", "text":"[吃惊][吃惊][闭嘴][吃惊]", "mid":"zeRKcCe15", "date":"2013-01-17 12:15:10" }, { "kids":[ "zeRNLDnFc" ], "uid":"2483576047", "parent":"", "text":"", "mid":"zeRDUjaVw", "date":"2013-01-17 11:59:39" }, { "kids":[], "uid":"4587d", "parent":"zeRpebdDe", "text":"", "mid":"zeRCUucC5", "date":"2013-01-17 11:57:12" }, { "kids":[], "uid":"rosemouse", "parent":"zeQA5cYwW", "text":"", "mid":"zeRzr6R2X", "date":"2013-01-17 11:48:38" }, { "kids":[ "zeRKcCe15" ], "uid":"1860851282", "parent":"zeQvAy0eU", "text":"[吃惊]", "mid":"zeRyNdO0Z", "date":"2013-01-17 11:47:02" }, { "kids":[], "uid":"2243413364", "parent":"zeQPGDy3e", "text":"马上就要被和谐了", "mid":"zeRvMcWka", "date":"2013-01-17 11:39:36" }, { "kids":[], "uid":"1953955447", "parent":"zeQA5cYwW", "text":"", "mid":"zeRrRyOo8", "date":"2013-01-17 11:29:59" }, { "kids":[ "zeRCUucC5" ], "uid":"lovinwang", "parent":"", "text":"", "mid":"zeRpebdDe", "date":"2013-01-17 11:23:29" }, { "kids":[ "zeROTnVPJ" ], "uid":"1894227604", "parent":"", "text":"这哪个报社的记者?用心实在是险恶!在中日敏感时期发这样的含沙射影的消息!纪念馆的建设和设计我印象都是南京政府所为,另外,八零年日元对美元应该大约二百多,人民币兑美元应该1.7,八百多万日元当时也就是六七万人民币。作为记者,现在发这样的消息目的是什么??", "mid":"zeRnQah3Z", "date":"2013-01-17 11:20:04" }, { "kids":[], "uid":"1877587551", "parent":"zeQvAy0eU", "text":"碎~", "mid":"zeRkIAxO7", "date":"2013-01-17 11:12:23" }, { "kids":[ "zeULG7str" ], "uid":"hudiemiao", "parent":"", "text":"", "mid":"zeRi4ktLD", "date":"2013-01-17 11:05:51" }, { "kids":[], "uid":"tonylingzi", "parent":"", "text":"余った資金は共○党関係者で分けたという~", "mid":"zeRhrEnvn", "date":"2013-01-17 11:04:17" }, { "kids":[], "uid":"1735479073", "parent":"", "text":"挂傻B", "mid":"zeR3pnYxK", "date":"2013-01-17 10:29:43" }, { "kids":[], "uid":"1764448051", "parent":"zeQA5cYwW", "text":"好神奇的国度!", "mid":"zeR349ml3", "date":"2013-01-17 10:28:53" }, { "kids":[], "uid":"2265810724", "parent":"", "text":"", "mid":"zeR0Pe7ib", "date":"2013-01-17 10:23:22" }, { "kids":[], "uid":"meiguilieshou", "parent":"", "text":"", "mid":"zeR04fWt7", "date":"2013-01-17 10:21:30" }, { "kids":[], "uid":"317421024", "parent":"zeQNDjVqN", "text":"余った資金は共産党関係者で分けたという。", "mid":"zeQWCk0u3", "date":"2013-01-17 10:12:59" }, { "kids":[], "uid":"1967244905", "parent":"zeQIUciGV", "text":"", "mid":"zeQVJEXY0", "date":"2013-01-17 10:10:50" }, { "kids":[], "uid":"haruyou", "parent":"", "text":"[衰]", "mid":"zeQUB2kX4", "date":"2013-01-17 10:08:01" }, { "kids":[ "zeTmuCJ74" ], "uid":"2301842014", "parent":"zeQA5cYwW", "text":"这里没有真相", "mid":"zeQRc5l6r", "date":"2013-01-17 09:59:37" }, { "kids":[], "uid":"1995661570", "parent":"", "text":"", "mid":"zeQR96pH1", "date":"2013-01-17 09:59:31" }, { "kids":[], "uid":"1900873447", "parent":"", "text":"", "mid":"zeQPVsq2h", "date":"2013-01-17 09:56:31" }, { "kids":[], "uid":"1640172360", "parent":"", "text":"", "mid":"zeQPTEJbF", "date":"2013-01-17 09:56:27" }, { "kids":[ "zeRvMcWka" ], "uid":"makiyeah", "parent":"", "text":"这个必须扩散出去", "mid":"zeQPGDy3e", "date":"2013-01-17 09:55:55" }, { "kids":[], "uid":"2788032844", "parent":"", "text":"旧馆是东南大学齐康院士设计的,新馆扩建是华南理工何镜堂院士设计的,日本人是脑子流感了么?!强烈不满[右哼哼]", "mid":"zeQO2rOpc", "date":"2013-01-17 09:51:52" }, { "kids":[ "zeQWCk0u3" ], "uid":"1056888477", "parent":"zeQA5cYwW", "text":"", "mid":"zeQNDjVqN", "date":"2013-01-17 09:50:52" }, { "kids":[], "uid":"westsea", "parent":"", "text":"又一个把维基当史实的白痴", "mid":"zeQJwyXU4", "date":"2013-01-17 09:40:45" }, { "kids":[ "zeQVJEXY0" ], "uid":"yesyes33", "parent":"zeLoffuR0", "text":"", "mid":"zeQIUciGV", "date":"2013-01-17 09:39:13" }, { "kids":[ "zeRzr6R2X", "zeRrRyOo8", "zeR349ml3", "zeQRc5l6r", "zeQNDjVqN" ], "uid":"2087679491", "parent":"zeQvAy0eU", "text":"", "mid":"zeQA5cYwW", "date":"2013-01-17 09:17:29" }, { "kids":[], "uid":"2036174842", "parent":"zeLqupu7C", "text":"纯转……", "mid":"zeQzvcoR7", "date":"2013-01-17 09:16:03" }, { "kids":[ "zeRyNdO0Z", "zeRkIAxO7", "zeQA5cYwW" ], "uid":"1893877413", "parent":"zeLtpibO7", "text":"刚查了日本wiki,情况属实。可是百度百科里没有。[思考]", "mid":"zeQvAy0eU", "date":"2013-01-17 09:06:25" }, { "kids":[], "uid":"jioke", "parent":"zeLxGlVdk", "text":"这就是所谓的三观尽毁?", "mid":"zeQjzl9eD", "date":"2013-01-17 08:36:48" }, { "kids":[], "uid":"2725506751", "parent":"", "text":"。。", "mid":"zeQcWiiQs", "date":"2013-01-17 08:20:27" }, { "kids":[], "uid":"2174519981", "parent":"", "text":"起码钱的事儿还是说不清的 就算新闻假的 我还是倾向于它是真的 支那人就这操行嘛[嘻嘻]", "mid":"zePMlu0bA", "date":"2013-01-17 07:14:56" }, { "kids":[], "uid":"2804691520", "parent":"zeLqvkAhZ", "text":"", "mid":"zePmC80TZ", "date":"2013-01-17 06:11:33" }, { "kids":[], "uid":"lijiaxinncu", "parent":"", "text":"纪念馆由东南大学建筑学院齐康设计,以“生与死”、“痛与恨”为主题,占地13000多平方米,建筑面积1900多平方米,其中主体建筑面积1300多平方米,建成史料陈列厅、电影放映厅、遗骨陈列室及藏品库等,被评为“中国80年代十大优秀建筑设计”之一。广场浮雕由南京艺术学院钱大泾设计。", "mid":"zePmmr0Qz", "date":"2013-01-17 06:10:55" }, { "kids":[], "uid":"lijiaxinncu", "parent":"", "text":"为什么公知只会得到没有文化没有思想立场、没有全局观的人的认同?因为他们自己本来就缺乏足够的知识文化,以为会几个字就很牛B,其实不过是别人眼中的小丑罢了。此微博多么的吸引别人的眼球啊,多么会转移话题,尤其是最后一句,让那些只会附和不会去了解客观事实的人觉得,这个社会是如此万恶!", "mid":"zePmedt9m", "date":"2013-01-17 06:10:36" }, { "kids":[], "uid":"333715888", "parent":"", "text":"博主是智商无下限还是操守无下限?", "mid":"zePi60cH0", "date":"2013-01-17 06:00:25" }, { "kids":[], "uid":"333715888", "parent":"", "text":"妓者果无操守!", "mid":"zePeGFSxX", "date":"2013-01-17 05:52:02" }, { "kids":[], "uid":"2919556020", "parent":"zeLubrH3L", "text":"", "mid":"zeOYt9u95", "date":"2013-01-17 05:12:04" }, { "kids":[], "uid":"2920183184", "parent":"", "text":"", "mid":"zeOPS5sHa", "date":"2013-01-17 04:50:53" }, { "kids":[], "uid":"1933917821", "parent":"", "text":"[熊猫]", "mid":"zeOOe8n6J", "date":"2013-01-17 04:46:49" }, { "kids":[], "uid":"williamcatlovemdd", "parent":"", "text":"估计这记者不是傻逼就是中钓鱼贴了", "mid":"zeOAhwZPv", "date":"2013-01-17 04:12:29" }, { "kids":[], "uid":"2127538451", "parent":"", "text":"@自由老庄howell @钟惟仼 元芳傻眼了吧", "mid":"zeNP18jsY", "date":"2013-01-17 02:16:02" }, { "kids":[], "uid":"1143724381", "parent":"", "text":"", "mid":"zeNJ3v2Kn", "date":"2013-01-17 02:01:21" }, { "kids":[], "uid":"thegreatlionking", "parent":"zeNyz7TDh", "text":"无耻的货", "mid":"zeNBgBALK", "date":"2013-01-17 01:42:10" }, { "kids":[ "zeNBgBALK" ], "uid":"2952689121", "parent":"", "text":"贱逼博猪狗日杂碎 /@言不邪:http:", "mid":"zeNyz7TDh", "date":"2013-01-17 01:35:30" }, { "kids":[], "uid":"2697714477", "parent":"", "text":"俺家只要道歉,前面俺们当家的说了:给钱是瞧不起俺!", "mid":"zeN4nqyoK", "date":"2013-01-17 00:21:05" }, { "kids":[], "uid":"3044834341", "parent":"", "text":"这种东西其实还是不要转出来的好", "mid":"zeMWazHLe", "date":"2013-01-17 00:00:56" }, { "kids":[], "uid":"1680837570", "parent":"zeMHhbEPS", "text":"[鄙视][鄙视]", "mid":"zeMLNjLrJ", "date":"2013-01-16 23:35:21" }, { "kids":[], "uid":"2253455411", "parent":"zeKU0C5GK", "text":"求证", "mid":"zeML8z6QF", "date":"2013-01-16 23:33:41" }, { "kids":[], "uid":"zheng1008", "parent":"", "text":"我是来围观右边这群人的,顺手抄送@侵华日军南京大屠杀遇难同胞纪念馆", "mid":"zeMIxenuR", "date":"2013-01-16 23:27:20" }, { "kids":[ "zeMLNjLrJ" ], "uid":"1169157534", "parent":"", "text":"", "mid":"zeMHhbEPS", "date":"2013-01-16 23:24:13" }, { "kids":[], "uid":"2251599027", "parent":"", "text":"让人看不起 夜班工人丙:纪念馆老馆新馆的设计者都是中国人,博主资料有误吧?倒是有6位日本友人获过纪念馆特别贡献奖,其一是日本圆光寺住持大东仁,他为纪念馆搜集了1000多件珍贵文物。田边城在日侵华该认罪的态度上是积极的,曾说“没有赔偿的道歉是虚假的道歉,没有道歉的赔偿是不道义的赔偿", "mid":"zeMGN5d0R", "date":"2013-01-16 23:22:58" }, { "kids":[], "uid":"1896045975", "parent":"", "text":"", "mid":"zeMF8cJLj", "date":"2013-01-16 23:18:54" }, { "kids":[], "uid":"1406757791", "parent":"zeMqAm6G6", "text":"", "mid":"zeMCUwAWu", "date":"2013-01-16 23:13:26" }, { "kids":[], "uid":"1853422060", "parent":"zeMqAm6G6", "text":"此博主?!", "mid":"zeMuwsgK1", "date":"2013-01-16 22:52:48" }, { "kids":[ "zeMCUwAWu", "zeMuwsgK1" ], "uid":"1169157534", "parent":"zeMlpw1Vq", "text":"", "mid":"zeMqAm6G6", "date":"2013-01-16 22:43:03" }, { "kids":[], "uid":"2750091120", "parent":"", "text":"", "mid":"zeMphs8uw", "date":"2013-01-16 22:39:54" }, { "kids":[ "zeMqAm6G6" ], "uid":"2249021653", "parent":"zeMgwCOPB", "text":"别有用心的"傻逼"![怒]", "mid":"zeMlpw1Vq", "date":"2013-01-16 22:30:19" }, { "kids":[], "uid":"2128614983", "parent":"zeLo7iGb3", "text":"", "mid":"zeMipmqBS", "date":"2013-01-16 22:22:57" }, { "kids":[], "uid":"nygysj1993", "parent":"zeLMGdedv", "text":"@忍辱偷生海侧卫: 纪念馆由东南大学建筑学院齐康设计,以“生与死”、“痛与恨”为主题,占地13000多平方米,建筑面积1900多平方米,其中主体建筑面积1300多平方米,建成史料陈列厅、电影放映厅、遗骨陈列室及藏品库等,被评为“中国80年代十大优秀建筑设计”之一。广场浮雕由南京艺术学院钱大泾设计。", "mid":"zeMhuByf5", "date":"2013-01-16 22:20:41" }, { "kids":[ "zeMlpw1Vq" ], "uid":"1962838677", "parent":"zeLRu4RJa", "text":"这样的博主不是傻逼就是轮子", "mid":"zeMgwCOPB", "date":"2013-01-16 22:18:17" }, { "kids":[], "uid":"sonsyun", "parent":"", "text":"", "mid":"zeMenBi9q", "date":"2013-01-16 22:13:01" }, { "kids":[], "uid":"2085917391", "parent":"zeM8A1axK", "text":"@巨人程晨:", "mid":"zeMbriwfZ", "date":"2013-01-16 22:05:45" }, { "kids":[], "uid":"1856946984", "parent":"", "text":"", "mid":"zeMat1wGv", "date":"2013-01-16 22:03:24" }, { "kids":[], "uid":"tootomata", "parent":"", "text":"造谣死全家", "mid":"zeMa3keFK", "date":"2013-01-16 22:02:22" }, { "kids":[], "uid":"apia", "parent":"", "text":"", "mid":"zeM9v3yZ4", "date":"2013-01-16 22:00:58" }, { "kids":[], "uid":"1762746085", "parent":"zeM3I3dGO", "text":"", "mid":"zeM8Iz7f9", "date":"2013-01-16 21:59:05" }, { "kids":[ "zeMbriwfZ" ], "uid":"echengchen", "parent":"", "text":"", "mid":"zeM8A1axK", "date":"2013-01-16 21:58:44" }, { "kids":[], "uid":"578733007", "parent":"", "text":"", "mid":"zeM822qFR", "date":"2013-01-16 21:57:21" }, { "kids":[], "uid":"2330365670", "parent":"", "text":"开门!查水表的!", "mid":"zeM7s266l", "date":"2013-01-16 21:55:57" }, { "kids":[], "uid":"1888988660", "parent":"", "text":"对比wiki日语版 http:", "mid":"zeM5Yp0Ti", "date":"2013-01-16 21:52:17" }, { "kids":[ "zeM8Iz7f9" ], "uid":"21dorami", "parent":"", "text":"求辟谣", "mid":"zeM3I3dGO", "date":"2013-01-16 21:46:44" }, { "kids":[], "uid":"1043891787", "parent":"", "text":"情何以堪", "mid":"zeM2PCuVB", "date":"2013-01-16 21:44:35" }, { "kids":[], "uid":"yuesy", "parent":"", "text":"870万日元修个大屠杀纪念馆!你钓鱼吧!造谣的去过纪念馆么?", "mid":"zeM246x1b", "date":"2013-01-16 21:42:40" }, { "kids":[], "uid":"1568938093", "parent":"zeLo7iGb3", "text":"不知道的事太多了。", "mid":"zeM0JC0Z8", "date":"2013-01-16 21:39:22" }, { "kids":[], "uid":"1602944814", "parent":"zeLRu4RJa", "text":"", "mid":"zeM0yFWzw", "date":"2013-01-16 21:38:56" }, { "kids":[], "uid":"2919404750", "parent":"zeLqvkAhZ", "text":"", "mid":"zeLV2eA9O", "date":"2013-01-16 21:25:20" }, { "kids":[], "uid":"1729935370", "parent":"zeLRu4RJa", "text":"挂", "mid":"zeLUQFsVs", "date":"2013-01-16 21:24:55" }, { "kids":[], "uid":"1783551973", "parent":"zeLLEqiUt", "text":"支持打脸。", "mid":"zeLUDp7ab", "date":"2013-01-16 21:24:23" }, { "kids":[], "uid":"1885458752", "parent":"zeLRu4RJa", "text":"", "mid":"zeLTjBjtf", "date":"2013-01-16 21:21:06" }, { "kids":[ "zeMgwCOPB", "zeM0yFWzw", "zeLUQFsVs", "zeLTjBjtf" ], "uid":"1752670993", "parent":"zeLN49s3d", "text":"挂!", "mid":"zeLRu4RJa", "date":"2013-01-16 21:16:38" }, { "kids":[], "uid":"2015116873", "parent":"", "text":"你肯定不清楚日元与人民币汇率。三千万日元约二百万人民币,870万日元约六十万人民币。修纪念馆可能够呛。", "mid":"zeLR47fmq", "date":"2013-01-16 21:15:35" }, { "kids":[], "uid":"2411388510", "parent":"zeLLEqiUt", "text":"", "mid":"zeLQEDrAh", "date":"2013-01-16 21:14:34" }, { "kids":[], "uid":"2957079177", "parent":"", "text":"870万日元不是什么大数字,就是个意思吧", "mid":"zeLPT6qKN", "date":"2013-01-16 21:12:41" }, { "kids":[], "uid":"2582599122", "parent":"zeLLEqiUt", "text":"原POSB已举报", "mid":"zeLPNrYvL", "date":"2013-01-16 21:12:28" }, { "kids":[], "uid":"2957079177", "parent":"", "text":"2005年12月13日,纪念馆的二期扩建工程正式奠基[11],2006年6月26日起闭馆扩建,2007年12月13日竣工,总投资4.77亿元人民币,建设工程获得民间捐款450万元人民币。扩建工程由华南理工大学何镜堂主持设计,建筑构思展现“战争、杀戮、和平”三个概念。", "mid":"zeLPKerB9", "date":"2013-01-16 21:12:19" }, { "kids":[], "uid":"2957079177", "parent":"", "text":"维基百科抄的说1980年代,原日本社会党委员长田边诚访问南京,表示希望建设本馆,并为纪念馆建设捐赠了870万日元。", "mid":"zeLPrBefy", "date":"2013-01-16 21:11:36" }, { "kids":[], "uid":"guyuanwanli", "parent":"zeLLEqiUt", "text":"http:", "mid":"zeLOi82c0", "date":"2013-01-16 21:08:45" }, { "kids":[], "uid":"jltlovekkw", "parent":"zeLN49s3d", "text":"谢谢日本戴迪", "mid":"zeLOexkBa", "date":"2013-01-16 21:08:37" }, { "kids":[ "zeLRu4RJa", "zeLOexkBa" ], "uid":"1804656237", "parent":"zeLLEqiUt", "text":"非常日本", "mid":"zeLN49s3d", "date":"2013-01-16 21:05:41" }, { "kids":[ "zeMhuByf5" ], "uid":"2957079177", "parent":"zeLLEqiUt", "text":"纪念馆由东南大学建筑学院齐康设计,以“生与死”、“痛与恨”为主题,占地13000多平方米,建筑面积1900多平方米,其中主体建筑面积1300多平方米,建成史料陈列厅、电影放映厅、遗骨陈列室及藏品库等,被评为“中国80年代十大优秀建筑设计”之一。广场浮雕由南京艺术学院钱大泾设计。", "mid":"zeLMGdedv", "date":"2013-01-16 21:04:47" }, { "kids":[ "zeLUDp7ab", "zeLQEDrAh", "zeLPNrYvL", "zeLOi82c0", "zeLN49s3d", "zeLMGdedv" ], "uid":"cindyvinea", "parent":"zeLHa4AtC", "text":"记得南京大屠杀纪念馆是由东南大学建筑学院齐康设计的。查到的资料显示齐康原名齐毓康,原籍浙江天台,生于江苏南京。怎么就成了日本人了?", "mid":"zeLLEqiUt", "date":"2013-01-16 21:02:13" }, { "kids":[], "uid":"qxh0526", "parent":"", "text":"本当?!", "mid":"zeLLp2Q6j", "date":"2013-01-16 21:01:38" }, { "kids":[], "uid":"1149366807", "parent":"zeLo7iGb3", "text":"", "mid":"zeLKXyZgx", "date":"2013-01-16 21:00:33" }, { "kids":[], "uid":"idqpbi", "parent":"zeKU0C5GK", "text":"", "mid":"zeLJDquZr", "date":"2013-01-16 20:57:16" }, { "kids":[], "uid":"idqpbi", "parent":"", "text":"", "mid":"zeLJb3CJG", "date":"2013-01-16 20:56:09" }, { "kids":[ "zeLLEqiUt" ], "uid":"2437542064", "parent":"", "text":"所以要感恩戴德。", "mid":"zeLHa4AtC", "date":"2013-01-16 20:51:11" }, { "kids":[], "uid":"2497743600", "parent":"", "text":"艹我的爱国主义要碎了。。@哎呦您一定长命百岁", "mid":"zeLGCo2af", "date":"2013-01-16 20:49:51" }, { "kids":[], "uid":"kernelws", "parent":"", "text":"晕", "mid":"zeLDFqmcg", "date":"2013-01-16 20:42:36" }, { "kids":[], "uid":"2117163852", "parent":"", "text":"预感很快这条微博就会消失了……@中西柚樺太郎: ??", "mid":"zeLDBjz9b", "date":"2013-01-16 20:42:25" }, { "kids":[], "uid":"saintiki", "parent":"", "text":"里面70%的资料都是日方的资料", "mid":"zeLCRdC5q", "date":"2013-01-16 20:40:35" }, { "kids":[], "uid":"iris0120", "parent":"", "text":"哎哟 求个真相", "mid":"zeLC80BU3", "date":"2013-01-16 20:38:45" }, { "kids":[], "uid":"1312737481", "parent":"", "text":"", "mid":"zeLBD0gPF", "date":"2013-01-16 20:37:34" }, { "kids":[], "uid":"duoduoshcn", "parent":"zeLAqcU4F", "text":"", "mid":"zeLBBdZ1F", "date":"2013-01-16 20:37:29" }, { "kids":[], "uid":"1164370143", "parent":"zeLvN19XF", "text":"", "mid":"zeLBxEZRZ", "date":"2013-01-16 20:37:19" }, { "kids":[ "zeLBBdZ1F" ], "uid":"amy5250", "parent":"zeLvpoDKk", "text":"难怪我去那个纪念馆我就感觉里面的设计布局感觉都很日本,原来是日本人设计的", "mid":"zeLAqcU4F", "date":"2013-01-16 20:34:35" }, { "kids":[], "uid":"1191473231", "parent":"", "text":"。。。", "mid":"zeLz1Fekm", "date":"2013-01-16 20:31:05" }, { "kids":[], "uid":"776234809", "parent":"", "text":"[吃惊]三观粉碎…", "mid":"zeLyXuNCJ", "date":"2013-01-16 20:31:00" }, { "kids":[], "uid":"1496861122", "parent":"", "text":"很想了解细节", "mid":"zeLyVqIjr", "date":"2013-01-16 20:30:54" }, { "kids":[], "uid":"anakindeng", "parent":"", "text":"", "mid":"zeLy0pN4o", "date":"2013-01-16 20:28:35" }, { "kids":[], "uid":"1971681451", "parent":"", "text":"", "mid":"zeLxJxH4c", "date":"2013-01-16 20:27:59" }, { "kids":[ "zeQjzl9eD" ], "uid":"xdszg", "parent":"", "text":"[衰][吃惊]", "mid":"zeLxGlVdk", "date":"2013-01-16 20:27:49" }, { "kids":[], "uid":"1783456524", "parent":"zeLo7iGb3", "text":"", "mid":"zeLxtDiCx", "date":"2013-01-16 20:27:20" }, { "kids":[], "uid":"forestmorning", "parent":"", "text":"", "mid":"zeLwrcsVv", "date":"2013-01-16 20:24:44" }, { "kids":[], "uid":"1863014391", "parent":"", "text":"牢记历史教训,中日友好,世界和平。", "mid":"zeLwiku2T", "date":"2013-01-16 20:24:25" }, { "kids":[ "zeLBxEZRZ" ], "uid":"1762479437", "parent":"", "text":"", "mid":"zeLvN19XF", "date":"2013-01-16 20:23:10" }, { "kids":[], "uid":"huludewa", "parent":"", "text":"", "mid":"zeLvK62Ou", "date":"2013-01-16 20:23:03" }, { "kids":[ "zeLAqcU4F" ], "uid":"yiyio1015", "parent":"", "text":"@Alice_Annie", "mid":"zeLvpoDKk", "date":"2013-01-16 20:22:14" }, { "kids":[], "uid":"szhkyt", "parent":"", "text":"碎一地。", "mid":"zeLv5gSPw", "date":"2013-01-16 20:21:26" }, { "kids":[], "uid":"2728775085", "parent":"", "text":"这个是初耳。愤日的估计要涂鸦。", "mid":"zeLuUlXtM", "date":"2013-01-16 20:21:00" }, { "kids":[], "uid":"zjcxwj", "parent":"", "text":"真相一披露,心碎几何人?", "mid":"zeLurFLrC", "date":"2013-01-16 20:19:50" }, { "kids":[], "uid":"zoeystyle", "parent":"", "text":"真的假的?", "mid":"zeLuhk5DE", "date":"2013-01-16 20:19:28" }, { "kids":[ "zeOYt9u95" ], "uid":"1528002637", "parent":"", "text":"", "mid":"zeLubrH3L", "date":"2013-01-16 20:19:12" }, { "kids":[], "uid":"1788861137", "parent":"", "text":"", "mid":"zeLtC00Dh", "date":"2013-01-16 20:17:46" }, { "kids":[], "uid":"2188454260", "parent":"", "text":"", "mid":"zeLtyrOMe", "date":"2013-01-16 20:17:39" }, { "kids":[], "uid":"mr0223", "parent":"", "text":"碎一地啊碎一地", "mid":"zeLtvrEvE", "date":"2013-01-16 20:17:31" }, { "kids":[ "zeQvAy0eU" ], "uid":"2955420764", "parent":"", "text":"在南京呆了那麽久倒不知道", "mid":"zeLtpibO7", "date":"2013-01-16 20:17:18" }, { "kids":[], "uid":"zivonpatton", "parent":"", "text":"南京大屠杀纪念馆建设的初衷应该是让人们了解并铭记战争的残酷,而非是让人们因为仇恨而重蹈覆辙...", "mid":"zeLtkwX7L", "date":"2013-01-16 20:17:08" }, { "kids":[], "uid":"tongsuiyuan", "parent":"", "text":"呵呵,知道真相就揭啊,直接揭了既爽快有伸张了正义,还对国家证明日本侵华历史有大大的好处。在类似性质的事情上老是欲遮欲的风格,时间长了国人都会厌烦的。不管是政府还是民主自由的先进分子,老这样国人都会在感情上相当厌烦的。", "mid":"zeLsB2ZAf", "date":"2013-01-16 20:15:18" }, { "kids":[], "uid":"1916808844", "parent":"", "text":"", "mid":"zeLsmhnDZ", "date":"2013-01-16 20:14:41" }, { "kids":[], "uid":"3211498767", "parent":"", "text":"", "mid":"zeLsdplBg", "date":"2013-01-16 20:14:19" }, { "kids":[], "uid":"akun", "parent":"", "text":"", "mid":"zeLrVE3Pr", "date":"2013-01-16 20:13:41" }, { "kids":[], "uid":"2634025662", "parent":"", "text":"[吃惊]", "mid":"zeLrTkoIv", "date":"2013-01-16 20:13:34" }, { "kids":[], "uid":"1542943407", "parent":"zeLqyiKe6", "text":"", "mid":"zeLrQEEOy", "date":"2013-01-16 20:13:27" }, { "kids":[], "uid":"rwoo55", "parent":"", "text":"", "mid":"zeLrim0kY", "date":"2013-01-16 20:12:07" }, { "kids":[], "uid":"2710106680", "parent":"", "text":"呵呵 谁知道真相是什么", "mid":"zeLqUpMQx", "date":"2013-01-16 20:11:06" }, { "kids":[], "uid":"wenleigao", "parent":"zeLqupu7C", "text":"你这个小日本奸细....[酷]", "mid":"zeLqTfPNc", "date":"2013-01-16 20:11:06" }, { "kids":[], "uid":"shijinmr", "parent":"", "text":"[围观]", "mid":"zeLqSkkVS", "date":"2013-01-16 20:11:05" }, { "kids":[ "zeLrQEEOy" ], "uid":"2038137941", "parent":"", "text":"", "mid":"zeLqyiKe6", "date":"2013-01-16 20:10:15" }, { "kids":[ "zePmC80TZ", "zeLV2eA9O" ], "uid":"2286909220", "parent":"", "text":"", "mid":"zeLqvkAhZ", "date":"2013-01-16 20:10:08" }, { "kids":[ "zeQzvcoR7", "zeLqTfPNc" ], "uid":"freiheitzzz", "parent":"", "text":"@红拂李靖 @天蓝海蓝82 @-小囡她爸-", "mid":"zeLqupu7C", "date":"2013-01-16 20:10:07" }, { "kids":[], "uid":"2449702094", "parent":"", "text":"确实碎了", "mid":"zeLqrrTll", "date":"2013-01-16 20:09:58" }, { "kids":[], "uid":"nero111", "parent":"", "text":"[汗]", "mid":"zeLq8ijiT", "date":"2013-01-16 20:09:14" }, { "kids":[], "uid":"huludewa", "parent":"", "text":"", "mid":"zeLq5ia8H", "date":"2013-01-16 20:09:06" }, { "kids":[], "uid":"frankxi26", "parent":"", "text":"", "mid":"zeLpZFn9Y", "date":"2013-01-16 20:08:54" }, { "kids":[], "uid":"1248587194", "parent":"", "text":"是日本的左翼学者在帮助中国保存历史记忆,但某些过激派却莫名其妙地敌视所有日本人,抗日剧也非常无厘头,也难怪最近几年日本民众对华越来越厌烦。当年的左翼学者实际上在纵容极端反日情绪,在现在看来这太不好了。", "mid":"zeLpTt7jS", "date":"2013-01-16 20:08:38" }, { "kids":[], "uid":"1674888551", "parent":"", "text":"", "mid":"zeLpHFpn4", "date":"2013-01-16 20:08:11" }, { "kids":[], "uid":"chinarafale", "parent":"", "text":"小泉去抗战胜利纪念馆鞠躬也没披露。", "mid":"zeLpuDERE", "date":"2013-01-16 20:07:40" }, { "kids":[], "uid":"1877464530", "parent":"", "text":"", "mid":"zeLph42Rs", "date":"2013-01-16 20:07:06" }, { "kids":[], "uid":"chenyongningbo", "parent":"", "text":"碎就碎吧,真相就是该让民众知晓", "mid":"zeLoHA7EF", "date":"2013-01-16 20:05:40" }, { "kids":[ "zeQIUciGV" ], "uid":"2060626077", "parent":"", "text":"", "mid":"zeLoffuR0", "date":"2013-01-16 20:04:35" }, { "kids":[ "zeMipmqBS", "zeM0JC0Z8", "zeLKXyZgx", "zeLxtDiCx" ], "uid":"toushanglaoyouwushui", "parent":"", "text":"", "mid":"zeLo7iGb3", "date":"2013-01-16 20:04:16" }, { "kids":[ "zeZrP4Qbt" ], "uid":"shiffy", "parent":"", "text":"[good]", "mid":"zeLnv9xFn", "date":"2013-01-16 20:02:45" }, { "kids":[], "uid":"2366202874", "parent":"zeL7O5khp", "text":"该信谁?对谎多者,肯定不信。", "mid":"zeLmrzDZv", "date":"2013-01-16 20:00:10" }, { "kids":[], "uid":"210106560", "parent":"", "text":"", "mid":"zeLa7qb32", "date":"2013-01-16 19:29:47" }, { "kids":[ "zeLmrzDZv" ], "uid":"2269789074", "parent":"zeKP4ePG5", "text":"“?”后面的故事有谁知道啊?", "mid":"zeL7O5khp", "date":"2013-01-16 19:24:05" }, { "kids":[], "uid":"idogo", "parent":"", "text":"这个转不转呢?[怒]", "mid":"zeKYtw1n1", "date":"2013-01-16 19:01:04" }, { "kids":[ "zeZEV3gSS", "zeUWBEhry", "zeML8z6QF", "zeLJDquZr" ], "uid":"2596554803", "parent":"zeKP4ePG5", "text":"南京大屠杀纪念馆是时任日本社民党委员长田边诚1980年访问南京时,提出要建设的。并捐赠了3千万日元的资金。这个说法的出处为日本讲谈社出版的《浜田幸一『日本をダメにした九人の政治家』講談社 (10秒前)", "mid":"zeKU0C5GK", "date":"2013-01-16 18:50:04" }, { "kids":[], "uid":"1401118132", "parent":"", "text":"", "mid":"zeKRFwnjd", "date":"2013-01-16 18:44:18" }, { "kids":[ "zeL7O5khp", "zeKU0C5GK" ], "uid":"rollinluo", "parent":"", "text":"?", "mid":"zeKP4ePG5", "date":"2013-01-16 18:37:54" }, { "kids":[], "uid":"1934878365", "parent":"", "text":"@WBB-斌斌 @快乐旺旺", "mid":"zeKNQznf5", "date":"2013-01-16 18:34:55" }, { "kids":[], "uid":"2274547581", "parent":"", "text":"是事实吗?", "mid":"zeKLaeO0i", "date":"2013-01-16 18:28:16" } ]
{ "pile_set_name": "Github" }
/* * RFC 1186/1320 compliant MD4 implementation * * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine * * Copyright (C) 2009 Paul Bakker <polarssl_maintainer at polarssl dot org> * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the names of PolarSSL or XySSL 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. */ /* * The MD4 algorithm was designed by Ron Rivest in 1990. * * http://www.ietf.org/rfc/rfc1186.txt * http://www.ietf.org/rfc/rfc1320.txt */ #include "netif/ppp/ppp_opts.h" #if PPP_SUPPORT && LWIP_INCLUDED_POLARSSL_MD4 #include "netif/ppp/polarssl/md4.h" #include <string.h> /* * 32-bit integer manipulation macros (little endian) */ #ifndef GET_ULONG_LE #define GET_ULONG_LE(n,b,i) \ { \ (n) = ( (unsigned long) (b)[(i) ] ) \ | ( (unsigned long) (b)[(i) + 1] << 8 ) \ | ( (unsigned long) (b)[(i) + 2] << 16 ) \ | ( (unsigned long) (b)[(i) + 3] << 24 ); \ } #endif #ifndef PUT_ULONG_LE #define PUT_ULONG_LE(n,b,i) \ { \ (b)[(i) ] = (unsigned char) ( (n) ); \ (b)[(i) + 1] = (unsigned char) ( (n) >> 8 ); \ (b)[(i) + 2] = (unsigned char) ( (n) >> 16 ); \ (b)[(i) + 3] = (unsigned char) ( (n) >> 24 ); \ } #endif /* * MD4 context setup */ void md4_starts( md4_context *ctx ) { ctx->total[0] = 0; ctx->total[1] = 0; ctx->state[0] = 0x67452301; ctx->state[1] = 0xEFCDAB89; ctx->state[2] = 0x98BADCFE; ctx->state[3] = 0x10325476; } static void md4_process( md4_context *ctx, const unsigned char data[64] ) { unsigned long X[16], A, B, C, D; GET_ULONG_LE( X[ 0], data, 0 ); GET_ULONG_LE( X[ 1], data, 4 ); GET_ULONG_LE( X[ 2], data, 8 ); GET_ULONG_LE( X[ 3], data, 12 ); GET_ULONG_LE( X[ 4], data, 16 ); GET_ULONG_LE( X[ 5], data, 20 ); GET_ULONG_LE( X[ 6], data, 24 ); GET_ULONG_LE( X[ 7], data, 28 ); GET_ULONG_LE( X[ 8], data, 32 ); GET_ULONG_LE( X[ 9], data, 36 ); GET_ULONG_LE( X[10], data, 40 ); GET_ULONG_LE( X[11], data, 44 ); GET_ULONG_LE( X[12], data, 48 ); GET_ULONG_LE( X[13], data, 52 ); GET_ULONG_LE( X[14], data, 56 ); GET_ULONG_LE( X[15], data, 60 ); #define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) A = ctx->state[0]; B = ctx->state[1]; C = ctx->state[2]; D = ctx->state[3]; #define F(x, y, z) ((x & y) | ((~x) & z)) #define P(a,b,c,d,x,s) { a += F(b,c,d) + x; a = S(a,s); } P( A, B, C, D, X[ 0], 3 ); P( D, A, B, C, X[ 1], 7 ); P( C, D, A, B, X[ 2], 11 ); P( B, C, D, A, X[ 3], 19 ); P( A, B, C, D, X[ 4], 3 ); P( D, A, B, C, X[ 5], 7 ); P( C, D, A, B, X[ 6], 11 ); P( B, C, D, A, X[ 7], 19 ); P( A, B, C, D, X[ 8], 3 ); P( D, A, B, C, X[ 9], 7 ); P( C, D, A, B, X[10], 11 ); P( B, C, D, A, X[11], 19 ); P( A, B, C, D, X[12], 3 ); P( D, A, B, C, X[13], 7 ); P( C, D, A, B, X[14], 11 ); P( B, C, D, A, X[15], 19 ); #undef P #undef F #define F(x,y,z) ((x & y) | (x & z) | (y & z)) #define P(a,b,c,d,x,s) { a += F(b,c,d) + x + 0x5A827999; a = S(a,s); } P( A, B, C, D, X[ 0], 3 ); P( D, A, B, C, X[ 4], 5 ); P( C, D, A, B, X[ 8], 9 ); P( B, C, D, A, X[12], 13 ); P( A, B, C, D, X[ 1], 3 ); P( D, A, B, C, X[ 5], 5 ); P( C, D, A, B, X[ 9], 9 ); P( B, C, D, A, X[13], 13 ); P( A, B, C, D, X[ 2], 3 ); P( D, A, B, C, X[ 6], 5 ); P( C, D, A, B, X[10], 9 ); P( B, C, D, A, X[14], 13 ); P( A, B, C, D, X[ 3], 3 ); P( D, A, B, C, X[ 7], 5 ); P( C, D, A, B, X[11], 9 ); P( B, C, D, A, X[15], 13 ); #undef P #undef F #define F(x,y,z) (x ^ y ^ z) #define P(a,b,c,d,x,s) { a += F(b,c,d) + x + 0x6ED9EBA1; a = S(a,s); } P( A, B, C, D, X[ 0], 3 ); P( D, A, B, C, X[ 8], 9 ); P( C, D, A, B, X[ 4], 11 ); P( B, C, D, A, X[12], 15 ); P( A, B, C, D, X[ 2], 3 ); P( D, A, B, C, X[10], 9 ); P( C, D, A, B, X[ 6], 11 ); P( B, C, D, A, X[14], 15 ); P( A, B, C, D, X[ 1], 3 ); P( D, A, B, C, X[ 9], 9 ); P( C, D, A, B, X[ 5], 11 ); P( B, C, D, A, X[13], 15 ); P( A, B, C, D, X[ 3], 3 ); P( D, A, B, C, X[11], 9 ); P( C, D, A, B, X[ 7], 11 ); P( B, C, D, A, X[15], 15 ); #undef F #undef P ctx->state[0] += A; ctx->state[1] += B; ctx->state[2] += C; ctx->state[3] += D; } /* * MD4 process buffer */ void md4_update( md4_context *ctx, const unsigned char *input, int ilen ) { int fill; unsigned long left; if( ilen <= 0 ) return; left = ctx->total[0] & 0x3F; fill = 64 - left; ctx->total[0] += ilen; ctx->total[0] &= 0xFFFFFFFF; if( ctx->total[0] < (unsigned long) ilen ) ctx->total[1]++; if( left && ilen >= fill ) { MEMCPY( (void *) (ctx->buffer + left), input, fill ); md4_process( ctx, ctx->buffer ); input += fill; ilen -= fill; left = 0; } while( ilen >= 64 ) { md4_process( ctx, input ); input += 64; ilen -= 64; } if( ilen > 0 ) { MEMCPY( (void *) (ctx->buffer + left), input, ilen ); } } static const unsigned char md4_padding[64] = { 0x80, 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 }; /* * MD4 final digest */ void md4_finish( md4_context *ctx, unsigned char output[16] ) { unsigned long last, padn; unsigned long high, low; unsigned char msglen[8]; high = ( ctx->total[0] >> 29 ) | ( ctx->total[1] << 3 ); low = ( ctx->total[0] << 3 ); PUT_ULONG_LE( low, msglen, 0 ); PUT_ULONG_LE( high, msglen, 4 ); last = ctx->total[0] & 0x3F; padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); md4_update( ctx, md4_padding, padn ); md4_update( ctx, msglen, 8 ); PUT_ULONG_LE( ctx->state[0], output, 0 ); PUT_ULONG_LE( ctx->state[1], output, 4 ); PUT_ULONG_LE( ctx->state[2], output, 8 ); PUT_ULONG_LE( ctx->state[3], output, 12 ); } /* * output = MD4( input buffer ) */ void md4( unsigned char *input, int ilen, unsigned char output[16] ) { md4_context ctx; md4_starts( &ctx ); md4_update( &ctx, input, ilen ); md4_finish( &ctx, output ); } #endif /* PPP_SUPPORT && LWIP_INCLUDED_POLARSSL_MD4 */
{ "pile_set_name": "Github" }
= All you ever wanted to know about counter-rollovers in Dstat == What you need to know about counter rollovers Unfortunately, Dstat is susceptible for counter rollovers, which may give you bogus performance output. Linux currently implements counters as 32bit values (not sure on 64bit platforms). This means a counter can go up to 2^32 (= 4294967296 = 4G) values. Especially for network devices (which are calculated in bytes) this is too much as it means every 4GB, the counter is reset to 0. On a 1Gbps interface that is fully used, this happens every 32 seconds. On 2 bonded 10Gbps interfaces, this happens after 1.6 seconds. Since /proc is updated every second, this becomes almost impossible to catch. == How does this impact Dstat ? Currently Dstat has a problem if you specify delays that are too big. I.e. using 60 or 120 seconds delay in Dstat will make Dstat check these counters only once per minute or every two minutes. In the case the value is reset, it might be lower than the previous value (which causes negative values) or worse, the value is actually higher (which will go unnoticed and you get bogus information and Dstat won't know). This is very problematic, and it's important you are aware of this. == What are the solutions ? The only fix for Dstat is to check more often than the specified delay. Unfortunately, this requires a re-design (or an ugly hack). There are plans to use 64bit counters on Linux and/or changing the output from using bytes to kbytes. None of this is sure. (add pointers to threads) To work-around this problem, you could always use a delay of 1 second, and re-calculate averages in Excel. This will work fine as long as you also re-calculate the negative values (by adding 2^32 to them). If the rollovers happen only sporadically, you can just ignore those values. == What can I do ? Since this is Open Source, you are free to fix this and send me the fix. Or help with a redesign of Dstat to overcome this problem. Also look at the TODO file to see what other changes are expected in a redesign of Dstat. Since I have a lot of other responsibilities and am currently not using Dstat for something where this problem matters much, I will have no time to look at it closely (unless the fix or the redesign is made fairly simple). It all depends on how quick I think I can fix/redesign it and how much time I have. Your help could be to reduce the time it takes for me to fix it :) NOTE: Please send me improvements to this document.
{ "pile_set_name": "Github" }
/** * @file hal_nvic.c * @author XRADIO IOT WLAN Team */ /* * Copyright (C) 2017 XRADIO TECHNOLOGY CO., LTD. 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 XRADIO TECHNOLOGY CO., LTD. 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. */ #include "hal_base.h" #include "pm/pm.h" #include "sys/param.h" #include "sys/xr_debug.h" /** * @brief Set the handler for the specified interrupt * @param[in] IRQn interrupt number * @param[in] handler Handler of the specified interrupt * @return None */ void HAL_NVIC_SetIRQHandler(IRQn_Type IRQn, NVIC_IRQHandler handler) { uint32_t *vectors = (uint32_t *)SCB->VTOR; vectors[IRQn + NVIC_PERIPH_IRQ_OFFSET] = (uint32_t)handler; } /** * @brief Get the handler of the specified interrupt * @param[in] IRQn interrupt number * @return IRQ Handler of the specified interrupt */ NVIC_IRQHandler HAL_NVIC_GetIRQHandler(IRQn_Type IRQn) { uint32_t *vectors = (uint32_t*)SCB->VTOR; return (NVIC_IRQHandler)(vectors[IRQn + NVIC_PERIPH_IRQ_OFFSET]); } /** * @brief Set priority grouping of the NVIC interrupt controller * @param [in] priorityGroup Priority grouping field * @return None */ void HAL_NVIC_SetPriorityGrouping(uint32_t priorityGroup) { NVIC_SetPriorityGrouping(priorityGroup); } /** * @brief Get Priority Grouping of the NVIC interrupt controller * @return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). */ uint32_t HAL_NVIC_GetPriorityGrouping(void) { return NVIC_GetPriorityGrouping(); } /** * @brief Set the interrupt priority of the specified interrupt * @param[in] IRQn Interrupt number * @param[in] priority Interrupt priority of the specified interrupt * @return None */ void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) { NVIC_SetPriority(IRQn, priority); } /** * @brief Get the interrupt priority of the specified interrupt * @param[in] IRQn Interrupt number * @return Interrupt priority of the specified interrupt */ uint32_t HAL_NVIC_GetPriority(IRQn_Type IRQn) { return NVIC_GetPriority(IRQn); } /** * @brief Enable external (device-specific) interrupt * @param[in] IRQn External interrupt number. Value cannot be negative. * @return None */ void HAL_NVIC_EnableIRQ(IRQn_Type IRQn) { NVIC_EnableIRQ(IRQn); } /** * @brief Disable external (device-specific) interrupt * @param[in] IRQn External interrupt number. Value cannot be negative. * @return None */ void HAL_NVIC_DisableIRQ(IRQn_Type IRQn) { NVIC_DisableIRQ(IRQn); } /** * @brief Set the pending bit of the specified external (device-specific) * interrupt * @param[in] IRQn External interrupt number. Value cannot be negative. * @return None */ void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn) { NVIC_SetPendingIRQ(IRQn); } /** * @brief Get the pending status of the specified external (device-specific) * interrupt * @param[in] IRQn External interrupt number. Value cannot be negative. * @return 0 Interrupt status is not pending * @return 1 Interrupt status is pending */ int HAL_NVIC_IsPendingIRQ(IRQn_Type IRQn) { return (int)(NVIC_GetPendingIRQ(IRQn)); } /** * @brief Clear the pending bit of the specified external (device-specific) * interrupt * @param[in] IRQn External interrupt number. Value cannot be negative. * @return None */ void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn) { NVIC_ClearPendingIRQ(IRQn); } #ifdef CONFIG_PM struct nvic_regs { uint32_t vector_table; /* Vector Table Offset */ uint32_t int_ctrl_state; /* Interrupt Control and State */ uint32_t app_int; /* Application Interrupt Reset control */ uint32_t sys_ctrl; /* System control */ uint32_t config_ctrl; /* Configuration control */ uint32_t sys_pri[3]; /* System Handler Priority */ uint32_t sys_hcrs; /* System Handler control and state register */ uint32_t systick_ctrl; /* SysTick Control Status */ uint32_t systick_reload; /* SysTick Reload */ uint32_t int_en[DIV_ROUND_UP(NVIC_VECTOR_TABLE_SIZE, 32)]; /* Interrupt set enable */ uint8_t int_priority[NVIC_PERIPH_IRQ_NUM * 4]; /* Interrupt priority */ #ifdef __CONFIG_CPU_CM4F uint32_t cpacr; /* Coprocessor Access Control Register */ uint32_t fpccr; /* Floating-Point Context Control Register */ uint32_t fpcar; /* Floating-Point Context Address Register */ #endif }; static struct nvic_regs nvic_reg_store; static int nvic_suspend(struct soc_device *dev, enum suspend_state_t state) { uint32_t i = 0; volatile uint32_t *reg_en_addr; volatile uint8_t *reg_ip_addr; struct nvic_regs *nvic_back = &nvic_reg_store; switch (state) { case PM_MODE_SLEEP: break; case PM_MODE_STANDBY: case PM_MODE_HIBERNATION: /* Save the NVIC control registers */ nvic_back->vector_table = SCB->VTOR; nvic_back->int_ctrl_state = SCB->ICSR; nvic_back->app_int = SCB->AIRCR; nvic_back->sys_ctrl = SCB->SCR; nvic_back->config_ctrl = SCB->CCR; reg_en_addr = (volatile uint32_t *)SCB->SHP; for (i = 0; i < 3; i++) { nvic_back->sys_pri[i] = reg_en_addr[i]; } nvic_back->sys_hcrs = SCB->SHCSR; /* Systick registers */ nvic_back->systick_ctrl = SysTick->CTRL; nvic_back->systick_reload = SysTick->LOAD; /* clear pending and disable systick */ SysTick->CTRL &= ~0x03; SCB->ICSR = (SCB->ICSR | 0x4000000) >> 1; /* Save the interrupt enable registers */ reg_en_addr = NVIC->ISER; for (i = 0; i < DIV_ROUND_UP(NVIC_VECTOR_TABLE_SIZE, 32); i++) { nvic_back->int_en[i] = reg_en_addr[i]; //NVIC->ICER[i] = 0xffffffff; /* disable all ints */ } /* Save the interrupt priority registers */ reg_ip_addr = NVIC->IP; for (i = 0; i < sizeof(nvic_back->int_priority); i++) { nvic_back->int_priority[i] = reg_ip_addr[i]; } #ifdef __CONFIG_CPU_CM4F nvic_back->cpacr = SCB->CPACR; nvic_back->fpccr = FPU->FPCCR; nvic_back->fpcar = FPU->FPCAR; #endif HAL_DBG("a%s okay\n", __func__); break; default: break; } return 0; } static int nvic_resume(struct soc_device *dev, enum suspend_state_t state) { uint32_t i = 0; volatile uint32_t *reg_en_addr; volatile uint8_t *reg_ip_addr; struct nvic_regs *nvic_back = &nvic_reg_store; switch (state) { case PM_MODE_SLEEP: break; case PM_MODE_STANDBY: case PM_MODE_HIBERNATION: /* Restore the NVIC control registers */ SCB->VTOR = nvic_back->vector_table; SCB->AIRCR = (nvic_back->app_int & 0x0ffff) | (0x5FA << SCB_AIRCR_VECTKEY_Pos); SCB->SCR = nvic_back->sys_ctrl; SCB->CCR = nvic_back->config_ctrl; reg_en_addr = (volatile uint32_t *)SCB->SHP; for (i = 0; i < 3; i++) { reg_en_addr[i] = nvic_back->sys_pri[i]; } SCB->SHCSR = nvic_back->sys_hcrs; /* Systick registers */ SysTick->CTRL = nvic_back->systick_ctrl; SysTick->LOAD = nvic_back->systick_reload; /* Restore the interrupt priority registers */ reg_ip_addr = NVIC->IP; for (i = 0; i < sizeof(nvic_back->int_priority); i++) { reg_ip_addr[i] = nvic_back->int_priority[i]; } /* Restore the interrupt enable registers */ reg_en_addr = NVIC->ISER; for (i = 0; i < DIV_ROUND_UP(NVIC_VECTOR_TABLE_SIZE, 32); i++) { reg_en_addr[i] = nvic_back->int_en[i]; } #ifdef __CONFIG_CPU_CM4F SCB->CPACR = nvic_back->cpacr; FPU->FPCCR = nvic_back->fpccr; FPU->FPCAR = nvic_back->fpcar; #endif __asm(" dsb \n"); __asm(" isb \n"); HAL_DBG("a%s okay\n", __func__); break; default: break; } return 0; } void nvic_print_regs(void) { //print_hex_dump_words(&nvic_reg_store, sizeof(nvic_reg_store)); } static struct soc_device_driver nvic_drv = { .name = "nvic", .suspend_noirq = nvic_suspend, .resume_noirq = nvic_resume, }; static struct soc_device nvic_dev = { .name = "nvic", .driver = &nvic_drv, }; #define NVIC_DEV (&nvic_dev) #endif /** * @brief Initialize the NVIC module * @return None */ void HAL_NVIC_Init(void) { /* Enable some system fault exceptions */ SCB->SHCSR |= SCB_SHCSR_USGFAULTENA_Msk | SCB_SHCSR_BUSFAULTENA_Msk | SCB_SHCSR_MEMFAULTENA_Msk; #ifdef CONFIG_PM pm_register_ops(NVIC_DEV); #endif }
{ "pile_set_name": "Github" }
/* * Copyright 2018 Red Hat Inc. * * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #include "channv50.h" #include <core/client.h> #include <nvif/clc37e.h> #include <nvif/unpack.h> static const struct nv50_disp_mthd_list gv100_disp_wndw_mthd_base = { .mthd = 0x0000, .addr = 0x000000, .data = { { 0x0200, 0x690200 }, { 0x020c, 0x69020c }, { 0x0210, 0x690210 }, { 0x0214, 0x690214 }, { 0x0218, 0x690218 }, { 0x021c, 0x69021c }, { 0x0220, 0x690220 }, { 0x0224, 0x690224 }, { 0x0228, 0x690228 }, { 0x022c, 0x69022c }, { 0x0230, 0x690230 }, { 0x0234, 0x690234 }, { 0x0238, 0x690238 }, { 0x0240, 0x690240 }, { 0x0244, 0x690244 }, { 0x0248, 0x690248 }, { 0x024c, 0x69024c }, { 0x0250, 0x690250 }, { 0x0254, 0x690254 }, { 0x0260, 0x690260 }, { 0x0264, 0x690264 }, { 0x0268, 0x690268 }, { 0x026c, 0x69026c }, { 0x0270, 0x690270 }, { 0x0274, 0x690274 }, { 0x0280, 0x690280 }, { 0x0284, 0x690284 }, { 0x0288, 0x690288 }, { 0x028c, 0x69028c }, { 0x0290, 0x690290 }, { 0x0298, 0x690298 }, { 0x029c, 0x69029c }, { 0x02a0, 0x6902a0 }, { 0x02a4, 0x6902a4 }, { 0x02a8, 0x6902a8 }, { 0x02ac, 0x6902ac }, { 0x02b0, 0x6902b0 }, { 0x02b4, 0x6902b4 }, { 0x02b8, 0x6902b8 }, { 0x02bc, 0x6902bc }, { 0x02c0, 0x6902c0 }, { 0x02c4, 0x6902c4 }, { 0x02c8, 0x6902c8 }, { 0x02cc, 0x6902cc }, { 0x02d0, 0x6902d0 }, { 0x02d4, 0x6902d4 }, { 0x02d8, 0x6902d8 }, { 0x02dc, 0x6902dc }, { 0x02e0, 0x6902e0 }, { 0x02e4, 0x6902e4 }, { 0x02e8, 0x6902e8 }, { 0x02ec, 0x6902ec }, { 0x02f0, 0x6902f0 }, { 0x02f4, 0x6902f4 }, { 0x02f8, 0x6902f8 }, { 0x02fc, 0x6902fc }, { 0x0300, 0x690300 }, { 0x0304, 0x690304 }, { 0x0308, 0x690308 }, { 0x0310, 0x690310 }, { 0x0314, 0x690314 }, { 0x0318, 0x690318 }, { 0x031c, 0x69031c }, { 0x0320, 0x690320 }, { 0x0324, 0x690324 }, { 0x0328, 0x690328 }, { 0x032c, 0x69032c }, { 0x033c, 0x69033c }, { 0x0340, 0x690340 }, { 0x0344, 0x690344 }, { 0x0348, 0x690348 }, { 0x034c, 0x69034c }, { 0x0350, 0x690350 }, { 0x0354, 0x690354 }, { 0x0358, 0x690358 }, { 0x0364, 0x690364 }, { 0x0368, 0x690368 }, { 0x036c, 0x69036c }, { 0x0370, 0x690370 }, { 0x0374, 0x690374 }, { 0x0380, 0x690380 }, {} } }; const struct nv50_disp_chan_mthd gv100_disp_wndw_mthd = { .name = "Window", .addr = 0x001000, .prev = 0x000800, .data = { { "Global", 1, &gv100_disp_wndw_mthd_base }, {} } }; static void gv100_disp_wndw_intr(struct nv50_disp_chan *chan, bool en) { struct nvkm_device *device = chan->disp->base.engine.subdev.device; const u32 mask = 0x00000001 << chan->head; const u32 data = en ? mask : 0; nvkm_mask(device, 0x611da4, mask, data); } const struct nv50_disp_chan_func gv100_disp_wndw = { .init = gv100_disp_dmac_init, .fini = gv100_disp_dmac_fini, .intr = gv100_disp_wndw_intr, .user = gv100_disp_chan_user, .bind = gv100_disp_dmac_bind, }; static int gv100_disp_wndw_new_(const struct nv50_disp_chan_func *func, const struct nv50_disp_chan_mthd *mthd, struct nv50_disp *disp, int chid, const struct nvkm_oclass *oclass, void *argv, u32 argc, struct nvkm_object **pobject) { union { struct nvc37e_window_channel_dma_v0 v0; } *args = argv; struct nvkm_object *parent = oclass->parent; int wndw, ret = -ENOSYS; u64 push; nvif_ioctl(parent, "create window channel dma size %d\n", argc); if (!(ret = nvif_unpack(ret, &argv, &argc, args->v0, 0, 0, false))) { nvif_ioctl(parent, "create window channel dma vers %d " "pushbuf %016llx index %d\n", args->v0.version, args->v0.pushbuf, args->v0.index); if (!(disp->wndw.mask & BIT(args->v0.index))) return -EINVAL; push = args->v0.pushbuf; wndw = args->v0.index; } else return ret; return nv50_disp_dmac_new_(func, mthd, disp, chid + wndw, wndw, push, oclass, pobject); } int gv100_disp_wndw_new(const struct nvkm_oclass *oclass, void *argv, u32 argc, struct nv50_disp *disp, struct nvkm_object **pobject) { return gv100_disp_wndw_new_(&gv100_disp_wndw, &gv100_disp_wndw_mthd, disp, 1, oclass, argv, argc, pobject); }
{ "pile_set_name": "Github" }
// Javascript routines for interaction with SVG documents produced by // gnuplot's SVG terminal driver. var gnuplot_svg = { }; gnuplot_svg.version = "30 May 2015"; gnuplot_svg.SVGDoc = null; gnuplot_svg.SVGRoot = null; gnuplot_svg.Init = function(e) { gnuplot_svg.SVGDoc = e.target.ownerDocument; gnuplot_svg.SVGRoot = gnuplot_svg.SVGDoc.documentElement; gnuplot_svg.axisdate = new Date(); } gnuplot_svg.toggleVisibility = function(evt, targetId) { var newTarget = evt.target; if (targetId) newTarget = gnuplot_svg.SVGDoc.getElementById(targetId); var newValue = newTarget.getAttributeNS(null, 'visibility') if ('hidden' != newValue) newValue = 'hidden'; else newValue = 'visible'; newTarget.setAttributeNS(null, 'visibility', newValue); if (targetId) { newTarget = gnuplot_svg.SVGDoc.getElementById(targetId.concat("_keyentry")); if (newTarget) newTarget.setAttributeNS(null, 'style', newValue == 'hidden' ? 'filter:url(#greybox)' : 'none'); } evt.preventDefault(); evt.stopPropagation(); } // Mouse tracking echos coordinates to a floating text box gnuplot_svg.getText = function() { return(document.getElementById("coord_text")); } gnuplot_svg.updateCoordBox = function(t, evt) { /* * Apply screen CTM transformation to the evt screenX and screenY to get * coordinates in SVG coordinate space. Use scaling parameters stored in * the plot document by gnuplot to convert further into plot coordinates. * Then position the floating text box using the SVG coordinates. */ var m = document.documentElement.getScreenCTM(); var p = document.documentElement.createSVGPoint(); p.x = evt.clientX; p.y = evt.clientY; p = p.matrixTransform(m.inverse()); var label_x, label_y; // Allow for scrollbar position (Firefox, others?) if (typeof evt.pageX != 'undefined') { p.x = evt.pageX; p.y = evt.pageY; } t.setAttribute("x", p.x); t.setAttribute("y", p.y); var plotcoord = gnuplot_svg.mouse2plot(p.x,p.y); if (gnuplot_svg.plot_timeaxis_x == "DMS" || gnuplot_svg.plot_timeaxis_y == "DMS") { if (gnuplot_svg.plot_timeaxis_x == "DMS") label_x = gnuplot_svg.convert_to_DMS(x); else label_x = plotcoord.x.toFixed(2); if (gnuplot_svg.plot_timeaxis_y == "DMS") label_y = gnuplot_svg.convert_to_DMS(y); else label_y = plotcoord.y.toFixed(2); } else if (gnuplot_svg.polar_mode) { polar = gnuplot_svg.convert_to_polar(plotcoord.x,plotcoord.y); label_x = "ang= " + polar.ang.toPrecision(4); label_y = "R= " + polar.r.toPrecision(4); } else if (gnuplot_svg.plot_timeaxis_x == "Date") { gnuplot_svg.axisdate.setTime(1000. * plotcoord.x); var year = gnuplot_svg.axisdate.getUTCFullYear(); var month = gnuplot_svg.axisdate.getUTCMonth(); var date = gnuplot_svg.axisdate.getUTCDate(); label_x = (" " + date).slice (-2) + "/" + ("0" + (month+1)).slice (-2) + "/" + year; label_y = plotcoord.y.toFixed(2); } else if (gnuplot_svg.plot_timeaxis_x == "Time") { gnuplot_svg.axisdate.setTime(1000. * plotcoord.x); var hour = gnuplot_svg.axisdate.getUTCHours(); var minute = gnuplot_svg.axisdate.getUTCMinutes(); var second = gnuplot_svg.axisdate.getUTCSeconds(); label_x = ("0" + hour).slice (-2) + ":" + ("0" + minute).slice (-2) + ":" + ("0" + second).slice (-2); label_y = plotcoord.y.toFixed(2); } else if (gnuplot_svg.plot_timeaxis_x == "DateTime") { gnuplot_svg.axisdate.setTime(1000. * plotcoord.x); label_x = gnuplot_svg.axisdate.toUTCString(); label_y = plotcoord.y.toFixed(2); } else { label_x = plotcoord.x.toFixed(2); label_y = plotcoord.y.toFixed(2); } while (null != t.firstChild) { t.removeChild(t.firstChild); } var textNode = document.createTextNode(". "+label_x+" "+label_y); t.appendChild(textNode); } gnuplot_svg.showCoordBox = function(evt) { var t = gnuplot_svg.getText(); if (null != t) { t.setAttribute("visibility", "visible"); gnuplot_svg.updateCoordBox(t, evt); } } gnuplot_svg.moveCoordBox = function(evt) { var t = gnuplot_svg.getText(); if (null != t) gnuplot_svg.updateCoordBox(t, evt); } gnuplot_svg.hideCoordBox = function(evt) { var t = gnuplot_svg.getText(); if (null != t) t.setAttribute("visibility", "hidden"); } gnuplot_svg.toggleCoordBox = function(evt) { var t = gnuplot_svg.getText(); if (null != t) { var state = t.getAttribute('visibility'); if ('hidden' != state) state = 'hidden'; else state = 'visible'; t.setAttribute('visibility', state); } } gnuplot_svg.toggleGrid = function() { if (!gnuplot_svg.SVGDoc.getElementsByClassName) // Old browsers return; var grid = gnuplot_svg.SVGDoc.getElementsByClassName('gridline'); for (var i=0; i<grid.length; i++) { var state = grid[i].getAttribute('visibility'); grid[i].setAttribute('visibility', (state == 'hidden') ? 'visible' : 'hidden'); } } gnuplot_svg.showHypertext = function(evt, mouseovertext) { var lines = mouseovertext.split('\n'); // If text starts with "image:" process it as an xlinked bitmap if (lines[0].substring(0,5) == "image") { var nameindex = lines[0].indexOf(":"); if (nameindex > 0) { gnuplot_svg.showHyperimage(evt, lines[0]); lines[0] = lines[0].slice(nameindex+1); } } var anchor_x = evt.clientX; var anchor_y = evt.clientY; // Allow for scrollbar position (Firefox, others?) if (typeof evt.pageX != 'undefined') { anchor_x = evt.pageX; anchor_y = evt.pageY; } var hypertextbox = document.getElementById("hypertextbox") hypertextbox.setAttributeNS(null,"x",anchor_x+10); hypertextbox.setAttributeNS(null,"y",anchor_y+4); hypertextbox.setAttributeNS(null,"visibility","visible"); var hypertext = document.getElementById("hypertext") hypertext.setAttributeNS(null,"x",anchor_x+14); hypertext.setAttributeNS(null,"y",anchor_y+18); hypertext.setAttributeNS(null,"visibility","visible"); var height = 2+16*lines.length; hypertextbox.setAttributeNS(null,"height",height); var length = hypertext.getComputedTextLength(); hypertextbox.setAttributeNS(null,"width",length+8); // bounce off frame bottom if (anchor_y > gnuplot_svg.plot_ybot + 16 - height) { anchor_y -= height; hypertextbox.setAttributeNS(null,"y",anchor_y+4); hypertext.setAttributeNS(null,"y",anchor_y+18); } while (null != hypertext.firstChild) { hypertext.removeChild(hypertext.firstChild); } var textNode = document.createTextNode(lines[0]); if (lines.length <= 1) { hypertext.appendChild(textNode); } else { xmlns="http://www.w3.org/2000/svg"; var tspan_element = document.createElementNS(xmlns, "tspan"); tspan_element.appendChild(textNode); hypertext.appendChild(tspan_element); length = tspan_element.getComputedTextLength(); var ll = length; for (var l=1; l<lines.length; l++) { var tspan_element = document.createElementNS(xmlns, "tspan"); tspan_element.setAttributeNS(null,"dy", 16); textNode = document.createTextNode(lines[l]); tspan_element.appendChild(textNode); hypertext.appendChild(tspan_element); ll = tspan_element.getComputedTextLength(); if (length < ll) length = ll; } hypertextbox.setAttributeNS(null,"width",length+8); } // bounce off right edge if (anchor_x > gnuplot_svg.plot_xmax + 14 - length) { anchor_x -= length; hypertextbox.setAttributeNS(null,"x",anchor_x+10); hypertext.setAttributeNS(null,"x",anchor_x+14); } // left-justify multiline text var tspan_element = hypertext.firstChild; while (tspan_element) { // if (typeof tspan_element == 'tspan') // Broken tspan_element.setAttributeNS(null,"x",anchor_x+14); tspan_element = tspan_element.nextElementSibling; } } gnuplot_svg.hideHypertext = function () { var hypertextbox = document.getElementById("hypertextbox") var hypertext = document.getElementById("hypertext") var hyperimage = document.getElementById("hyperimage") hypertextbox.setAttributeNS(null,"visibility","hidden"); hypertext.setAttributeNS(null,"visibility","hidden"); hyperimage.setAttributeNS(null,"visibility","hidden"); } gnuplot_svg.showHyperimage = function(evt, linktext) { var anchor_x = evt.clientX; var anchor_y = evt.clientY; // Allow for scrollbar position (Firefox, others?) if (typeof evt.pageX != 'undefined') { anchor_x = evt.pageX; anchor_y = evt.pageY; } var hyperimage = document.getElementById("hyperimage") hyperimage.setAttributeNS(null,"x",anchor_x); hyperimage.setAttributeNS(null,"y",anchor_y); hyperimage.setAttributeNS(null,"visibility","visible"); // Pick up height and width from "image(width,height):name" var width = hyperimage.getAttributeNS(null,"width"); var height = hyperimage.getAttributeNS(null,"height"); if (linktext.charAt(5) == "(") { width = parseInt(linktext.slice(6)); height = parseInt(linktext.slice(linktext.indexOf(",") + 1)); hyperimage.setAttributeNS(null,"width",width); hyperimage.setAttributeNS(null,"height",height); hyperimage.setAttributeNS(null,"preserveAspectRatio","none"); } // bounce off frame bottom and right if (anchor_y > gnuplot_svg.plot_ybot + 50 - height) hyperimage.setAttributeNS(null,"y",20 + anchor_y-height); if (anchor_x > gnuplot_svg.plot_xmax + 150 - width) hyperimage.setAttributeNS(null,"x",10 + anchor_x-width); // attach image URL as a link linktext = linktext.slice(linktext.indexOf(":") + 1); var xlinkns = "http://www.w3.org/1999/xlink"; hyperimage.setAttributeNS(xlinkns,"xlink:href",linktext); } // Convert from svg panel mouse coordinates to the coordinate // system of the gnuplot figure gnuplot_svg.mouse2plot = function(mousex,mousey) { var plotcoord = new Object; var plotx = mousex - gnuplot_svg.plot_xmin; var ploty = mousey - gnuplot_svg.plot_ybot; var x,y; if (gnuplot_svg.plot_logaxis_x != 0) { x = Math.log(gnuplot_svg.plot_axis_xmax) - Math.log(gnuplot_svg.plot_axis_xmin); x = x * (plotx / (gnuplot_svg.plot_xmax - gnuplot_svg.plot_xmin)) + Math.log(gnuplot_svg.plot_axis_xmin); x = Math.exp(x); } else { x = gnuplot_svg.plot_axis_xmin + (plotx / (gnuplot_svg.plot_xmax-gnuplot_svg.plot_xmin)) * (gnuplot_svg.plot_axis_xmax - gnuplot_svg.plot_axis_xmin); } if (gnuplot_svg.plot_logaxis_y != 0) { y = Math.log(gnuplot_svg.plot_axis_ymax) - Math.log(gnuplot_svg.plot_axis_ymin); y = y * (ploty / (gnuplot_svg.plot_ytop - gnuplot_svg.plot_ybot)) + Math.log(gnuplot_svg.plot_axis_ymin); y = Math.exp(y); } else { y = gnuplot_svg.plot_axis_ymin + (ploty / (gnuplot_svg.plot_ytop-gnuplot_svg.plot_ybot)) * (gnuplot_svg.plot_axis_ymax - gnuplot_svg.plot_axis_ymin); } plotcoord.x = x; plotcoord.y = y; return plotcoord; } gnuplot_svg.convert_to_polar = function (x,y) { polar = new Object; var phi, r; phi = Math.atan2(y,x); if (gnuplot_svg.plot_logaxis_r) r = Math.exp( (x/Math.cos(phi) + Math.log(gnuplot_svg.plot_axis_rmin)/Math.LN10) * Math.LN10); else r = x/Math.cos(phi) + gnuplot_svg.plot_axis_rmin; polar.ang = phi * 180./Math.PI; polar.r = r; return polar; } gnuplot_svg.convert_to_DMS = function (x) { var dms = {d:0, m:0, s:0}; var deg = Math.abs(x); dms.d = Math.floor(deg); dms.m = Math.floor((deg - dms.d) * 60.); dms.s = Math.floor((deg - dms.d) * 3600. - dms.m * 60.); fmt = ((x<0)?"-":" ") + dms.d.toFixed(0) + "°" + dms.m.toFixed(0) + "\"" + dms.s.toFixed(0) + "'"; return fmt; }
{ "pile_set_name": "Github" }
fun main() { let ba = Array::ofSizeUnsafe[Int64](0L); assert(ba.size() == 0L); let ba = Array::fill[Int64](10L, 2L); assert(ba.size() == 10L); ba(0L) = 10L; ba(1L) = 11L; ba(2L) = 12L; assert(10L == ba(0L)); assert(11L == ba(1L)); assert(12L == ba(2L)); assert(2L == ba(9L)); }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <testsuites> <testsuite name="tensorflow/python/kernel_tests/batch_matrix_band_part_op_test" tests="1" failures="0" errors="0"> <testcase name="tensorflow/python/kernel_tests/batch_matrix_band_part_op_test" status="run"></testcase> </testsuite> </testsuites>
{ "pile_set_name": "Github" }
/* * Copyright 2018 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.google.cloud.tools.jib.api; import com.google.cloud.tools.jib.builder.steps.BuildResult; import com.google.cloud.tools.jib.builder.steps.StepsRunner; import com.google.cloud.tools.jib.configuration.BuildContext; import com.google.cloud.tools.jib.configuration.ImageConfiguration; import com.google.cloud.tools.jib.docker.DockerClient; import com.google.cloud.tools.jib.event.EventHandlers; import com.google.cloud.tools.jib.filesystem.XdgDirectories; import com.google.common.base.Preconditions; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.HashSet; import java.util.Optional; import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.function.Consumer; import java.util.function.Function; import javax.annotation.Nullable; /** Configures how to containerize. */ public class Containerizer { /** * The default directory for caching the base image layers, in {@code [user cache * home]/google-cloud-tools-java/jib}. */ public static final Path DEFAULT_BASE_CACHE_DIRECTORY = XdgDirectories.getCacheHome(); private static final String DEFAULT_TOOL_NAME = "jib-core"; private static final String DEFAULT_TOOL_VERSION = Containerizer.class.getPackage().getImplementationVersion(); private static final String DESCRIPTION_FOR_DOCKER_REGISTRY = "Building and pushing image"; private static final String DESCRIPTION_FOR_DOCKER_DAEMON = "Building image to Docker daemon"; private static final String DESCRIPTION_FOR_TARBALL = "Building image tarball"; /** * Gets a new {@link Containerizer} that containerizes to a container registry. * * @param registryImage the {@link RegistryImage} that defines target container registry and * credentials * @return a new {@link Containerizer} */ public static Containerizer to(RegistryImage registryImage) { ImageConfiguration imageConfiguration = ImageConfiguration.builder(registryImage.getImageReference()) .setCredentialRetrievers(registryImage.getCredentialRetrievers()) .build(); Function<BuildContext, StepsRunner> stepsRunnerFactory = buildContext -> StepsRunner.begin(buildContext).registryPushSteps(); return new Containerizer( DESCRIPTION_FOR_DOCKER_REGISTRY, imageConfiguration, stepsRunnerFactory, true); } /** * Gets a new {@link Containerizer} that containerizes to a Docker daemon. * * @param dockerDaemonImage the {@link DockerDaemonImage} that defines target Docker daemon * @return a new {@link Containerizer} */ public static Containerizer to(DockerDaemonImage dockerDaemonImage) { ImageConfiguration imageConfiguration = ImageConfiguration.builder(dockerDaemonImage.getImageReference()).build(); DockerClient dockerClient = new DockerClient( dockerDaemonImage.getDockerExecutable(), dockerDaemonImage.getDockerEnvironment()); Function<BuildContext, StepsRunner> stepsRunnerFactory = buildContext -> StepsRunner.begin(buildContext).dockerLoadSteps(dockerClient); return new Containerizer( DESCRIPTION_FOR_DOCKER_DAEMON, imageConfiguration, stepsRunnerFactory, false); } /** * Gets a new {@link Containerizer} that containerizes to a tarball archive. * * @param tarImage the {@link TarImage} that defines target output file * @return a new {@link Containerizer} */ public static Containerizer to(TarImage tarImage) { if (!tarImage.getImageReference().isPresent()) { throw new IllegalArgumentException( "Image name must be set when building a TarImage; use TarImage#named(...) to set the name" + " of the target image"); } ImageConfiguration imageConfiguration = ImageConfiguration.builder(tarImage.getImageReference().get()).build(); Function<BuildContext, StepsRunner> stepsRunnerFactory = buildContext -> StepsRunner.begin(buildContext).tarBuildSteps(tarImage.getPath()); return new Containerizer( DESCRIPTION_FOR_TARBALL, imageConfiguration, stepsRunnerFactory, false); } private final String description; private final ImageConfiguration imageConfiguration; private final Function<BuildContext, StepsRunner> stepsRunnerFactory; private final boolean mustBeOnline; private final Set<String> additionalTags = new HashSet<>(); private final EventHandlers.Builder eventHandlersBuilder = EventHandlers.builder(); @Nullable private ExecutorService executorService; private Path baseImageLayersCacheDirectory = DEFAULT_BASE_CACHE_DIRECTORY; @Nullable private Path applicationLayersCacheDirectory; private boolean allowInsecureRegistries = false; private boolean offline = false; private String toolName = DEFAULT_TOOL_NAME; @Nullable private String toolVersion = DEFAULT_TOOL_VERSION; private boolean alwaysCacheBaseImage = false; /** Instantiate with {@link #to}. */ private Containerizer( String description, ImageConfiguration imageConfiguration, Function<BuildContext, StepsRunner> stepsRunnerFactory, boolean mustBeOnline) { this.description = description; this.imageConfiguration = imageConfiguration; this.stepsRunnerFactory = stepsRunnerFactory; this.mustBeOnline = mustBeOnline; } /** * Adds an additional tag to tag the target image with. For example, the following would * containerize to both {@code gcr.io/my-project/my-image:tag} and {@code * gcr.io/my-project/my-image:tag2}: * * <pre>{@code * Containerizer.to(RegistryImage.named("gcr.io/my-project/my-image:tag")).withAdditionalTag("tag2"); * }</pre> * * @param tag the additional tag to push to * @return this */ public Containerizer withAdditionalTag(String tag) { Preconditions.checkArgument(ImageReference.isValidTag(tag), "invalid tag '%s'", tag); additionalTags.add(tag); return this; } /** * Sets the {@link ExecutorService} Jib executes on. Jib, by default, uses {@link * Executors#newCachedThreadPool}. * * @param executorService the {@link ExecutorService} * @return this */ public Containerizer setExecutorService(@Nullable ExecutorService executorService) { this.executorService = executorService; return this; } /** * Sets the directory to use for caching base image layers. This cache can (and should) be shared * between multiple images. The default base image layers cache directory is {@code [user cache * home]/google-cloud-tools-java/jib} ({@link #DEFAULT_BASE_CACHE_DIRECTORY}. This directory can * be the same directory used for {@link #setApplicationLayersCache}. * * @param cacheDirectory the cache directory * @return this */ public Containerizer setBaseImageLayersCache(Path cacheDirectory) { baseImageLayersCacheDirectory = cacheDirectory; return this; } /** * Sets the directory to use for caching application layers. This cache can be shared between * multiple images. If not set, a temporary directory will be used as the application layers * cache. This directory can be the same directory used for {@link #setBaseImageLayersCache}. * * @param cacheDirectory the cache directory * @return this */ public Containerizer setApplicationLayersCache(Path cacheDirectory) { applicationLayersCacheDirectory = cacheDirectory; return this; } /** * Adds the {@code eventConsumer} to handle the {@link JibEvent} with class {@code eventType}. The * order in which handlers are added is the order in which they are called when the event is * dispatched. * * <p><b>Note: Implementations of {@code eventConsumer} must be thread-safe.</b> * * @param eventType the event type that {@code eventConsumer} should handle * @param eventConsumer the event handler * @param <E> the type of {@code eventType} * @return this */ public <E extends JibEvent> Containerizer addEventHandler( Class<E> eventType, Consumer<? super E> eventConsumer) { eventHandlersBuilder.add(eventType, eventConsumer); return this; } /** * Adds the {@code eventConsumer} to handle all {@link JibEvent} types. See {@link * #addEventHandler(Class, Consumer)} for more details. * * @param eventConsumer the event handler * @return this */ public Containerizer addEventHandler(Consumer<JibEvent> eventConsumer) { eventHandlersBuilder.add(JibEvent.class, eventConsumer); return this; } /** * Sets whether or not to allow communication over HTTP/insecure HTTPS. * * @param allowInsecureRegistries if {@code true}, insecure connections will be allowed * @return this */ public Containerizer setAllowInsecureRegistries(boolean allowInsecureRegistries) { this.allowInsecureRegistries = allowInsecureRegistries; return this; } /** * Sets whether or not to run the build in offline mode. In offline mode, the base image is * retrieved from the cache instead of pulled from a registry, and the build will fail if the base * image is not in the cache or if the target is an image registry. * * @param offline if {@code true}, the build will run in offline mode * @return this */ public Containerizer setOfflineMode(boolean offline) { if (mustBeOnline && offline) { throw new IllegalStateException("Cannot build to a container registry in offline mode"); } this.offline = offline; return this; } /** * Sets the name of the tool that is using Jib Core. The tool name is sent as part of the {@code * User-Agent} in registry requests and set as the {@code created_by} in the container layer * history. Defaults to {@code jib-core}. * * @param toolName the name of the tool using this library * @return this */ public Containerizer setToolName(String toolName) { this.toolName = toolName; return this; } /** * Sets the version of the tool that is using Jib Core. The tool version is sent as part of the * {@code User-Agent} in registry requests and set as the {@code created_by} in the container * layer history. Defaults to the current version of jib-core. * * @param toolVersion the name of the tool using this library * @return this */ public Containerizer setToolVersion(@Nullable String toolVersion) { this.toolVersion = toolVersion; return this; } /** * Controls the optimization which skips downloading base image layers that exist in a target * registry. If the user does not set this property, then read as false. * * @param alwaysCacheBaseImage if {@code true}, base image layers are always pulled and cached. If * {@code false}, base image layers will not be pulled/cached if they already exist on the * target registry. * @return this */ public Containerizer setAlwaysCacheBaseImage(boolean alwaysCacheBaseImage) { this.alwaysCacheBaseImage = alwaysCacheBaseImage; return this; } Set<String> getAdditionalTags() { return additionalTags; } Optional<ExecutorService> getExecutorService() { return Optional.ofNullable(executorService); } Path getBaseImageLayersCacheDirectory() { return baseImageLayersCacheDirectory; } Path getApplicationLayersCacheDirectory() throws CacheDirectoryCreationException { if (applicationLayersCacheDirectory == null) { // Uses a temporary directory if application layers cache directory is not set. try { applicationLayersCacheDirectory = Files.createTempDirectory(null); applicationLayersCacheDirectory.toFile().deleteOnExit(); } catch (IOException ex) { throw new CacheDirectoryCreationException(ex); } } return applicationLayersCacheDirectory; } EventHandlers buildEventHandlers() { return eventHandlersBuilder.build(); } boolean getAllowInsecureRegistries() { return allowInsecureRegistries; } boolean isOfflineMode() { return offline; } String getToolName() { return toolName; } @Nullable String getToolVersion() { return toolVersion; } boolean getAlwaysCacheBaseImage() { return alwaysCacheBaseImage; } String getDescription() { return description; } ImageConfiguration getImageConfiguration() { return imageConfiguration; } BuildResult run(BuildContext buildContext) throws ExecutionException, InterruptedException { return stepsRunnerFactory.apply(buildContext).run(); } }
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" @class NSString; __attribute__((visibility("hidden"))) @interface MFPFont : NSObject { float mSize; int mUnit; unsigned int mFlags; NSString *mName; } - (struct __CTFont *)createCTFontWithGraphics:(id)arg1; - (void)setName:(id)arg1; - (id)name; - (void)setFlags:(unsigned int)arg1; - (unsigned int)flags; - (void)setUnit:(int)arg1; - (int)unit; - (void)setSize:(float)arg1; - (float)size; - (void)dealloc; @end
{ "pile_set_name": "Github" }
[/============================================================================== Copyright (C) 2013 Richard Thomson 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) ===============================================================================/] [section:compilation Compilation and Usage Variants] __test__ is available in several forms: * a single, minimal header * a header-only form * a static library * a shared library The minimal header can be useful in situations where you don't already have the library built and want to quickly explore a test with a minimal amount of fuss. Once you need to create multiple unit tests, you will quickly outgrow the minimal header. The header only form is useful when you don't want to be bothered with compiling the library. Once you have multiple compilation units with unit tests in each compilation unit, you will grow tired of the compilation cost involved with the header only form of the framework. The static library form is the easiest to integrate into your build system as it doesn't require any installation of runtime files in order to execute your tests. This runtime simplicity comes at the cost of increased link times and executable sizes. The dynamic library form requires the most effort for successful test execution, but provides faster link times than the static library, faster compile times than the header only form and provides all the features of the framework compared to the minimal header. [caution __test__ is not a thread-safe library. Care should be taken when automated tests create multiple threads and interact with data structures passed to __test__ macros or functions.] [section:minimal_header Minimal Header] A lightweight, minimal version of the testing framework can be obtained by including =<boost/test/minimal.hpp>=. This header provides only the following macros: [table [[Macro] [Meaning]] [[=BOOST_CHECK(=['expression]=)=] [If ['expression] is false, the test fails and test execution continues.]] [[=BOOST_REQUIRE(=['expression]=)=] [If ['expression] is false, the test fails and test execution terminates.]] [[=BOOST_ERROR(=['message]=)=] [Report ['message], fail the test and continue test execution.]] [[=BOOST_FAIL(=['message]=)=] [Report ['message], fail the test and terminate test execution.]] ] The header supplies an implementation of =main= that executes a single test case by calling a free function named =test_main= with the following signature: ``` int test_main(int argc, char *argv[]); ``` The arguments =argc= and =argv= are passed to =test_main= from the implementation of =main= supplied by the test framework. No command-line argument processing is performed by =main=. A summary report of errors recorded by the test case is printed out after executing the test case. If any exception is thrown by the test case, it is caught by =main= and treated as an error from the test case. ``` #include <boost/test/minimal.hpp> int test_main(int argc, char *argv[]) { // test case } ``` [heading Example Source Code] * System under test: * [@boost:/libs/test/doc/src/system_under_test/hello/hello.cpp hello.cpp] * An example of using the minimal test framework: * [@boost:/libs/test/doc/src/examples/compilation/minimal/test_hello.cpp test_hello.cpp]. [endsect] [section =main=] To use the implementation of =main= provided by __test__, exactly one source file must define __boost_test_main__ before including =<boost/test/unit_test.hpp>=. If multiple source files define __boost_test_main__, then a multiply defined symbol error will occur during linking. If __boost_test_no_main__ is defined, then no implementation of =main= will be provided and the test executable must provide an initialization function. The exact initialization function that must be provided varies depending on how the library is compiled. The details are shown in the discussion of each compilation variation. When __test__ is compiled as a library, __boost_test_no_main__ must be defined when the library is compiled for it to work properly in those circumstances. [endsect] [section:header_only Header Only] The entire unit test framework can be incorporated into an executable by including the file =<boost/test/included/unit_test.hpp>=. Because the entire implementation is incorporated into the source file including this header, only a single source file in the test executable can include this header. Additional source files must define __boost_test_no_lib__ before including =<boost/test/unit_test.hpp>= to prevent any automatic linking to a shared library. If additional source files attempt to include =<boost/test/included/unit_test.hpp>=, a multiply defined symbol error will occur during linking. ``` // In exactly one source file: #include <boost/test/included/unit_test.hpp> // test cases (optional) ``` ``` // In additional source files #define BOOST_TEST_NO_LIB #include <boost/test/unit_test.hpp> // test cases ``` If __boost_test_no_main__ is defined, then an implementation of =main= must be provided that executes the test cases. This is most readily done by delegating to __unit_test_main__. ``` // In exactly one source file #define BOOST_TEST_NO_MAIN #include <boost/test/unit_test.hpp> boost::unit_test::test_suite *init_function(int argc, char *argv[]) { // create test cases and suites and return a pointer to any enclosing // suite, or 0. return 0; } int main(int argc, char* argv[]) { return ::boost::unit_test::unit_test_main(&init_function, argc, argv); } ``` [heading Example Source Code] The [link test.tutorials tutorials] all use the header-only version of __test__. [endsect] [section Static Library] To build __test__ as a static library, first build the boost build tools, as described in the [@boost:/more/getting_started/index.html Getting Started] documentation. After you have bootstrapped the build tools, build the test library with by invoking =b2= with arguments similar to the following: ``b2 --with-test link=static`` This will place the resulting libraries in =stage/lib= at the top level of the boost tree. In a static library configuration, __test__ is compiled into a single static library named =boost_unit_test_framework= and the test executable is linked against that library. Exactly one compilation unit in the test executable should define __boost_test_main__, in order run the tests. ``` // In exactly one source file #define BOOST_TEST_MAIN #include <boost/test/unit_test.hpp> // test cases (optional) ``` Additional source files simply include the main unit test header and define more test cases and/or suites. ``` // In additional source files #include <boost/test/unit_test.hpp> // test cases ``` To compile the library with no implementation of =main=, add __boost_test_no_main__ to the =cxxflags= property for b2: ``b2 --with-test link=static define=BOOST_TEST_NO_MAIN`` When the library is compiled with __boost_test_no_main__ defined, one source file must provide a definition for =main=. The simplest is to delegate to __unit_test_main__ and provide an implementation of an initialization function that manually adds test cases and suites to the test tree. Any test cases or test suites added with __boost_auto_test_case__, __boost_fixture_test_case__, __boost_auto_test_suite__ or __boost_fixture_test_suite__ are automatically added. ``` // In exactly one source file #define BOOST_TEST_NO_MAIN #include <boost/test/unit_test.hpp> boost::unit_test::test_suite *init_function(int argc, char *argv[]) { // create test cases and suites and return a pointer to any enclosing // suite, or 0. return 0; } int main(int argc, char *argv[]) { return boost::unit_test::unit_test_main(init_function, argc, argv); } ``` [heading Example Source Code] * System under test: * [@boost:/libs/test/doc/src/system_under_test/hello/hello.hpp hello.hpp] * [@boost:/libs/test/doc/src/system_under_test/hello/hello.cpp hello.cpp]. * An example of using the standard implementation of =main=: * [@boost:/libs/test/doc/src/examples/compilation/static/main.cpp main.cpp] * [@boost:/libs/test/doc/src/examples/compilation/static/test_hello.cpp test_hello.cpp]. * An example of using a custom =main=: * [@boost:/libs/test/doc/src/examples/compilation/static_main/main.cpp main.cpp] * [@boost:/libs/test/doc/src/examples/compilation/static_main/test_hello.cpp test_hello.cpp]. [endsect] [section Shared Library] To build __test__ as a shared library, first build the boost build tools, as described in the [@boost:/more/getting_started/index.html Getting Started] documentation. After you have bootstrapped the build tools, build the test library with by invoking =b2= with arguments similar to the following: ``b2 --with-test link=shared`` This will place the resulting libraries in =stage/lib= at the top level of the boost tree. In a shared library configuration, __test__ is compiled into a single shared library named =boost_unit_test_framework= and the test executable is linked against that library to import symbols from the library. The __test__ shared library must be available to the runtime loader in order for the tests to execute. Every compilation unit that includes a header from __test__ must define __boost_test_dyn_link__ first so that declarations are properly annotated as imported symbols. When __boost_test_dyn_link__ is defined, __test__ also defines __boost_test_alternative_init_api__. Exactly one compilation unit in the test executable should define __boost_test_main__, in order run the tests. ``` // In exactly one compilation unit #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN #include <boost/test/unit_test.hpp> // test cases (optional) ``` Additional source files define __boost_test_dyn_link__, include the main unit test header and define more test cases and/or suites. ``` // In additional source files #define BOOST_TEST_DYN_LINK #include <boost/test/unit_test.hpp> // test cases ``` To compile the library with no implementation of =main=, add __boost_test_no_main__ to the =cxxflags= property for b2: ``b2 --with-test link=shared define=BOOST_TEST_NO_MAIN`` When the library is compiled with __boost_test_no_main__ defined, one source file must provide a definition for =main=. The simplest is to delegate to __unit_test_main__ and provide an implementation of an initialization function that manually adds test cases and suites to the test tree. Any test cases or test suites added with __boost_auto_test_case__, __boost_fixture_test_case__, __boost_auto_test_suite__ or __boost_fixture_test_suite__ are automatically added. ``` // In exactly one source file #define BOOST_TEST_NO_MAIN #include <boost/test/unit_test.hpp> bool init_function() { // create test cases and suites and return a boolean indicating // success (true) or failure (false). return true; } int main(int argc, char* argv[]) { return ::boost::unit_test::unit_test_main(&init_function, argc, argv); } ``` [heading Example Source Code] * System under test: * [@boost:/libs/test/doc/src/system_under_test/hello/hello.hpp hello.hpp] * [@boost:/libs/test/doc/src/system_under_test/hello/hello.cpp hello.cpp] * An example of using the standard implementation of =main=: * [@boost:/libs/test/doc/src/examples/compilation/dynamic/main.cpp main.cpp] * [@boost:/libs/test/doc/src/examples/compilation/dynamic/test_hello.cpp test_hello.cpp]. * An example of using a custom =main=: * [@boost:/libs/test/doc/src/examples/compilation/dynamic_main/main.cpp main.cpp] * [@boost:/libs/test/doc/src/examples/compilation/dynamic_main/test_hello.cpp test_hello.cpp]. [endsect] [endsect]
{ "pile_set_name": "Github" }
--- layout: 2016/x/ap --- :skip-front-matter: = Problem: ISBN Questions? Feel free to head to https://www.reddit.com/r/cs50[CS50 on Reddit], http://cs50.stackexchange.com[CS50 on StackExchange], or the https://www.facebook.com/groups/cs50[CS50 Facebook group]. == Objectives * Use algorithms to solve problems. * Learn about checksums. * See how to manipulate a large piece of data to create meaningful pieces from it. == Recommended Reading * Pages 1 – 7, 9, and 10 of http://www.howstuffworks.com/c.htm. * Chapters 1 – 5, 9, and 11 &#8211; 17 of _Absolute Beginner's Guide to C_. * Chapters 1 – 6 of _Programming in C_. include::../../honesty.adoc[] == Assessment Your work on this problem set will be evaluated along four axes primarily. Scope:: To what extent does your code implement the features required by our specification? Correctness:: To what extent is your code consistent with our specifications and free of bugs? Design:: To what extent is your code written well (i.e., clearly, efficiently, elegantly, and/or logically)? Style:: To what extent is your code readable (i.e., commented and indented with variables aptly named)? To obtain a passing grade in this course, all students must ordinarily submit all assigned problems unless granted an exception in writing by the instructor. == Readin' Bookz As you may know, most any book that you borrow or buy has an International Standard Book Number, otherwise known as an __ISBN__ or ISBN-10, "a 10-digit number that uniquely identifies books and book-like products published internationally."footnote:[http://www.isbn.org/standards/home/isbn/us/isbnqa.asp] Books published since 2007 might also have an ISBN-13, a 13-digit number with a similar purpose, but never mind those. It turns out that the last of an ISBN-10's digits is a "check digit," otherwise known (in binary contexts) as a "checksum," a number related mathematically to its preceding digits. ISBN-10s' digits are supposed to adhere to a formula, not unlike credit card numbers, and this check digit allows you to check whether an ISBN-10's other nine digits are (most likely) valid without having to check, say, a database of books. Per the International ISBN Agency's ISBN Users' Manual, "The check digit is the last digit of an ISBN. It is calculated on a modulus 11 with weights 10-2, using X in lieu of 10 where ten would occur as a check digit."footnote:[http://www.isbn-international.org/en/userman/download/ISBNmanual.pdf] image:orly.jpg[Rly?] Yes rly, but what does that mean? The manual elaborates. "This means that each of the first nine digits of the ISBN--excluding the check digit itself--is multiplied by a number ranging from 10 to 2 and that the resulting sum of the products, plus the check digit, must be divisible by 11 without a remainder." Okay, better, but still a bit unclear. Let's define the check digit in terms of a formula. Fortunately, thanks to "modular arithmetic," we can simplify the Agency's formal definition using weights ranging from 1 to 9 instead of 10 to 2. In fact, it's really quite simple. If x~1~ represents an ISBN-10's first digit and x~10~ its lastfootnote:[Normally, we'd start counting from 0 and not 1, but for ISBN-10s, it's simpler not to!], it turns out that: x~10~ = (1&middot;x~1~ + 2&middot;x~2~ + 3&middot;x~3~ + 4&middot;x~4~ + 5&middot;x~5~ + 6&middot;x~6~ + 7&middot;x~7~ + 8&middot;x~8~ + 9&middot;x~9~) mod 11 In other words, to compute an ISBN-10's tenth digit, multiply its first digit by 1, its second digit by 2, its third digit by 3, its fourth digit by 4, its fifth digit by 5, its sixth digit by 6, its seventh digit by 7, its eighth digit by 8, and its ninth digit by 9. Take the sum of those products and then divide it by 11. The remainder should be the ISBN-10's tenth digit! If, though, that remainder is 10, the tenth digit should instead be printed as `X` lest it be confused with a `1` followed by `0`. == I S BN Calculatin' Let's try all this out. The ISBN-10 for the _Absolute Beginner's Guide to C_, one of the course's recommended books, is 0-789-75198-4, the tenth digit of which is, obviously, 4. But is the syllabus right? Well, let's first take that sum using the ISBN-10's first nine digits (highlighted in bold): 1&middot;**0** + 2&middot;**7** + 3&middot;**8** + 4&middot;**9** + 5&middot;**7** + 6&middot;**5** + 7&middot;**1** + 8&middot;**9** + 9&middot;**8** = 290 If we now divide that sum by 11, we get 290 &divide; 11 = 26 4/11 (i.e., a remainder of 4)! Well that's kind of neat, the ISBN is legit! Actually, also thanks to modular arithmetic, we could just include that tenth digit in our sum and multiply it by 10: 1&middot;**0** + 2&middot;**7** + 3&middot;**8** + 4&middot;**9** + 5&middot;**7** + 6&middot;**5** + 7&middot;**1** + 8&middot;**9** + 9&middot;**8** + 10&middot;**4** = 330 If we now divide this sum by 11, we get 330 &divide; 11 = 30 with no remainder at all, which is an equivalent way of saying the ISBN-10 is legit! Stated more formally, 0 &equiv; 330 (mod 11)! Hopefully those exclamation points make the math more exciting. So, computing this check digit's not hard, but it does get a bit tedious by hand. Let's write a program. Create a file called `isbn.c` inside of your `~/workspace/chapter1` directory, in which you should write a program that prompts the user for an ISBN-10 and then reports (via `printf`) whether the number's legit. So that we can automate some tests of your code, we ask that your program's last line of output be either `YES\n` or `NO\n`, nothing more, nothing less. For simplicity, you may assume that the user's input will be exactly ten decimal digits (i.e., devoid of hyphens and `X`), the first of which might even be zero(es), as in the case of our recommended book. But do not assume that the user's input will fit in an `int`! Recall, after all, that the largest value that can fit in an `int` is 2^32^ - 1 = 4,294,967,295 (and, even then, only if declared as `unsigned`). True, that's a 10-digit value, but there might still be a problem. (What?) Best to be safe and use `GetLongLong` from CS50's library to get users' input. (Why?) Okay, so you've gotten some input. What should you do? Well, realize that this C program, not unlike Scratch projects, can be reduced to the most basic of building blocks. For the sake of discussion, suppose that some variable `x` contains a 10-digit `long long` (with no leading zeroes). How can you get at its tenth (i.e., rightmost) digit? Well how about this? [source,c] ---- int tenth = x % 10; ---- Do you see why that works? Do not pass Go until it dawns on you why! How, now, can you get at that same variable's ninth digit? Well, why don't we first get rid of its tenth digit by shifting every other one place to the right? [source,c] ---- x = x / 10; ---- How about that trick? Do you see why it works? The ninth digit, now, is just: [source,c] ---- int ninth = x % 10; ---- So we bet there's a pattern here. And odds are you don't need to (i.e., shouldn't) copy/paste lines like the above nine or ten times. Loops are your friend. To be sure, other approaches exist. Proceed as you wish! Perhaps some of these tricks, though, will get you started. To compile your program, type [source,bash] ---- make isbn ---- Assuming your program compiled without errors (or, ideally, warnings) via either command, run your program with the command below. [source,bash] ---- ./isbn ---- Consider the below representative of how your own program should behave when passed a valid ISBN-10 (sans hyphens); underlined is some user's input. [source,subs=quotes] ---- ~/workspace/chapter1 $ [underline]#./isbn# ISBN: [underline]#0789751984# YES ---- Of course, `GetLongLong` itself will reject an ISBN-10's hyphens (and more) anyway: [source,subs=quotes] ---- ~/workspace/chapter1 $ [underline]#./isbn# ISBN: [underline]#0-789-75198-4# Retry: [underline]#foo# Retry: [underline]#0789751984# YES ---- But it's up to you to catch inputs that are not ISBN-10s (e.g., Jenny'sfootnote:[https://en.wikipedia.org/wiki/867-5309/Jenny] phone number), even if ten digits. [source,subs=quotes] ---- ~/workspace/chapter1 $ [underline]#./isbn# ISBN: [underline]#5558675309# NO ---- Test out your program with a whole bunch of inputs, both valid and invalid. (We certainly will!) There are lots of valid ISBN-10s on http://www.amazon.com[amazon.com]. Of course, you should also test your program with `check50`: [source,bash] ---- check50 1617.chapter1.isbn isbn.c ---- If your program behaves incorrectly on some inputs (or doesn't compile at all), have fun debugging! And if you'd like to play with the staff's own implementation of `isbn` on CS50 IDE, you may execute the below. [source,bash] ---- ~cs50/chapter1/isbn ---- == How to Submit === Step 1 of 3 Recall that, in the Scratch problem, you signed up for a https://github.com/[GitHub account]. If you haven't already, visit https://cs50.me/[cs50.me], log in with that same GitHub account, and click *Authorize application*. If you've forgotten your GitHub account's password, https://github.com/password_reset[reset it] first. Once you've logged in and authorized, you can immediately log out. Logging in once simply ensures that you can submit code via `submit50`, per step 2 of 3! === Step 2 of 3 * To submit `isbn`, execute + [source] ---- cd ~/workspace/chapter1/ submit50 2016/ap/isbn ---- + inputting your GitHub username and GitHub password as prompted. If you run into any trouble, email [email protected]! You may resubmit any problem as many times as you'd like. === Step 3 of 3 Submit https://forms.cs50.net/2016/x/ap/isbn[this form]! Your submission should be graded within a few weeks, at which point your score will appear at https://cs50.me/[cs50.me]! This was ISBN.
{ "pile_set_name": "Github" }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__CWE135_54b.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__CWE135.label.xml Template File: sources-sinks-54b.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Void pointer to a wchar_t array * GoodSource: Void pointer to a char array * Sinks: * GoodSink: Allocate memory using wcslen() and copy data * BadSink : Allocate memory using strlen() and copy data * Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD /* bad function declaration */ void CWE122_Heap_Based_Buffer_Overflow__CWE135_54c_badSink(void * data); void CWE122_Heap_Based_Buffer_Overflow__CWE135_54b_badSink(void * data) { CWE122_Heap_Based_Buffer_Overflow__CWE135_54c_badSink(data); } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE122_Heap_Based_Buffer_Overflow__CWE135_54c_goodG2BSink(void * data); void CWE122_Heap_Based_Buffer_Overflow__CWE135_54b_goodG2BSink(void * data) { CWE122_Heap_Based_Buffer_Overflow__CWE135_54c_goodG2BSink(data); } /* goodB2G uses the BadSource with the GoodSink */ void CWE122_Heap_Based_Buffer_Overflow__CWE135_54c_goodB2GSink(void * data); void CWE122_Heap_Based_Buffer_Overflow__CWE135_54b_goodB2GSink(void * data) { CWE122_Heap_Based_Buffer_Overflow__CWE135_54c_goodB2GSink(data); } #endif /* OMITGOOD */
{ "pile_set_name": "Github" }
 namespace MyCompany.Visitors.Model { using System.ComponentModel.DataAnnotations; using System.Runtime.Serialization; /// <summary> /// Visitor Picture Entity /// </summary> [DataContract] public class VisitorPicture { /// <summary> /// UniqueId /// </summary> [Key] [DataMember] public int VisitorPictureId { get; set; } /// <summary> /// Picture Type /// </summary> [DataMember] public PictureType PictureType { get; set; } /// <summary> /// Content /// </summary> [DataMember] public byte[] Content { get; set; } /// <summary> /// VisitorId /// </summary> [DataMember] public int VisitorId { get; set; } /* /// <summary> /// Visitor /// </summary> [DataMember] public Visitor Visitor { get; set; }*/ } }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2010 Michael Krufky ([email protected]) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 2. * * see Documentation/dvb/README.dvb-usb for more information */ #include <linux/vmalloc.h> #include <linux/i2c.h> #include "mxl111sf.h" #include "mxl111sf-reg.h" #include "mxl111sf-phy.h" #include "mxl111sf-i2c.h" #include "mxl111sf-gpio.h" #include "mxl111sf-demod.h" #include "mxl111sf-tuner.h" #include "lgdt3305.h" int dvb_usb_mxl111sf_debug; module_param_named(debug, dvb_usb_mxl111sf_debug, int, 0644); MODULE_PARM_DESC(debug, "set debugging level " "(1=info, 2=xfer, 4=i2c, 8=reg, 16=adv (or-able))."); int dvb_usb_mxl111sf_isoc; module_param_named(isoc, dvb_usb_mxl111sf_isoc, int, 0644); MODULE_PARM_DESC(isoc, "enable usb isoc xfer (0=bulk, 1=isoc)."); #define ANT_PATH_AUTO 0 #define ANT_PATH_EXTERNAL 1 #define ANT_PATH_INTERNAL 2 int dvb_usb_mxl111sf_rfswitch = #if 0 ANT_PATH_AUTO; #else ANT_PATH_EXTERNAL; #endif module_param_named(rfswitch, dvb_usb_mxl111sf_rfswitch, int, 0644); MODULE_PARM_DESC(rfswitch, "force rf switch position (0=auto, 1=ext, 2=int)."); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); #define deb_info(args...) dprintk(dvb_usb_mxl111sf_debug, 0x13, args) #define deb_reg(args...) dprintk(dvb_usb_mxl111sf_debug, 0x08, args) #define deb_adv(args...) dprintk(dvb_usb_mxl111sf_debug, MXL_ADV_DBG, args) int mxl111sf_ctrl_msg(struct dvb_usb_device *d, u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) { int wo = (rbuf == NULL || rlen == 0); /* write-only */ int ret; u8 sndbuf[1+wlen]; deb_adv("%s(wlen = %d, rlen = %d)\n", __func__, wlen, rlen); memset(sndbuf, 0, 1+wlen); sndbuf[0] = cmd; memcpy(&sndbuf[1], wbuf, wlen); ret = (wo) ? dvb_usb_generic_write(d, sndbuf, 1+wlen) : dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0); mxl_fail(ret); return ret; } /* ------------------------------------------------------------------------ */ #define MXL_CMD_REG_READ 0xaa #define MXL_CMD_REG_WRITE 0x55 int mxl111sf_read_reg(struct mxl111sf_state *state, u8 addr, u8 *data) { u8 buf[2]; int ret; ret = mxl111sf_ctrl_msg(state->d, MXL_CMD_REG_READ, &addr, 1, buf, 2); if (mxl_fail(ret)) { mxl_debug("error reading reg: 0x%02x", addr); goto fail; } if (buf[0] == addr) *data = buf[1]; else { err("invalid response reading reg: 0x%02x != 0x%02x, 0x%02x", addr, buf[0], buf[1]); ret = -EINVAL; } deb_reg("R: (0x%02x, 0x%02x)\n", addr, *data); fail: return ret; } int mxl111sf_write_reg(struct mxl111sf_state *state, u8 addr, u8 data) { u8 buf[] = { addr, data }; int ret; deb_reg("W: (0x%02x, 0x%02x)\n", addr, data); ret = mxl111sf_ctrl_msg(state->d, MXL_CMD_REG_WRITE, buf, 2, NULL, 0); if (mxl_fail(ret)) err("error writing reg: 0x%02x, val: 0x%02x", addr, data); return ret; } /* ------------------------------------------------------------------------ */ int mxl111sf_write_reg_mask(struct mxl111sf_state *state, u8 addr, u8 mask, u8 data) { int ret; u8 val; if (mask != 0xff) { ret = mxl111sf_read_reg(state, addr, &val); #if 1 /* dont know why this usually errors out on the first try */ if (mxl_fail(ret)) err("error writing addr: 0x%02x, mask: 0x%02x, " "data: 0x%02x, retrying...", addr, mask, data); ret = mxl111sf_read_reg(state, addr, &val); #endif if (mxl_fail(ret)) goto fail; } val &= ~mask; val |= data; ret = mxl111sf_write_reg(state, addr, val); mxl_fail(ret); fail: return ret; } /* ------------------------------------------------------------------------ */ int mxl111sf_ctrl_program_regs(struct mxl111sf_state *state, struct mxl111sf_reg_ctrl_info *ctrl_reg_info) { int i, ret = 0; for (i = 0; ctrl_reg_info[i].addr | ctrl_reg_info[i].mask | ctrl_reg_info[i].data; i++) { ret = mxl111sf_write_reg_mask(state, ctrl_reg_info[i].addr, ctrl_reg_info[i].mask, ctrl_reg_info[i].data); if (mxl_fail(ret)) { err("failed on reg #%d (0x%02x)", i, ctrl_reg_info[i].addr); break; } } return ret; } /* ------------------------------------------------------------------------ */ static int mxl1x1sf_get_chip_info(struct mxl111sf_state *state) { int ret; u8 id, ver; char *mxl_chip, *mxl_rev; if ((state->chip_id) && (state->chip_ver)) return 0; ret = mxl111sf_read_reg(state, CHIP_ID_REG, &id); if (mxl_fail(ret)) goto fail; state->chip_id = id; ret = mxl111sf_read_reg(state, TOP_CHIP_REV_ID_REG, &ver); if (mxl_fail(ret)) goto fail; state->chip_ver = ver; switch (id) { case 0x61: mxl_chip = "MxL101SF"; break; case 0x63: mxl_chip = "MxL111SF"; break; default: mxl_chip = "UNKNOWN MxL1X1"; break; } switch (ver) { case 0x36: state->chip_rev = MXL111SF_V6; mxl_rev = "v6"; break; case 0x08: state->chip_rev = MXL111SF_V8_100; mxl_rev = "v8_100"; break; case 0x18: state->chip_rev = MXL111SF_V8_200; mxl_rev = "v8_200"; break; default: state->chip_rev = 0; mxl_rev = "UNKNOWN REVISION"; break; } info("%s detected, %s (0x%x)", mxl_chip, mxl_rev, ver); fail: return ret; } #define get_chip_info(state) \ ({ \ int ___ret; \ ___ret = mxl1x1sf_get_chip_info(state); \ if (mxl_fail(___ret)) { \ mxl_debug("failed to get chip info" \ " on first probe attempt"); \ ___ret = mxl1x1sf_get_chip_info(state); \ if (mxl_fail(___ret)) \ err("failed to get chip info during probe"); \ else \ mxl_debug("probe needed a retry " \ "in order to succeed."); \ } \ ___ret; \ }) /* ------------------------------------------------------------------------ */ static int mxl111sf_power_ctrl(struct dvb_usb_device *d, int onoff) { /* power control depends on which adapter is being woken: * save this for init, instead, via mxl111sf_adap_fe_init */ return 0; } static int mxl111sf_adap_fe_init(struct dvb_frontend *fe) { struct dvb_usb_adapter *adap = fe->dvb->priv; struct dvb_usb_device *d = adap->dev; struct mxl111sf_state *state = d->priv; struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe->id].priv; int err; /* exit if we didnt initialize the driver yet */ if (!state->chip_id) { mxl_debug("driver not yet initialized, exit."); goto fail; } deb_info("%s()\n", __func__); mutex_lock(&state->fe_lock); state->alt_mode = adap_state->alt_mode; if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0) err("set interface failed"); err = mxl1x1sf_soft_reset(state); mxl_fail(err); err = mxl111sf_init_tuner_demod(state); mxl_fail(err); err = mxl1x1sf_set_device_mode(state, adap_state->device_mode); mxl_fail(err); mxl111sf_enable_usb_output(state); mxl_fail(err); mxl1x1sf_top_master_ctrl(state, 1); mxl_fail(err); if ((MXL111SF_GPIO_MOD_DVBT != adap_state->gpio_mode) && (state->chip_rev > MXL111SF_V6)) { mxl111sf_config_pin_mux_modes(state, PIN_MUX_TS_SPI_IN_MODE_1); mxl_fail(err); } err = mxl111sf_init_port_expander(state); if (!mxl_fail(err)) { state->gpio_mode = adap_state->gpio_mode; err = mxl111sf_gpio_mode_switch(state, state->gpio_mode); mxl_fail(err); #if 0 err = fe->ops.init(fe); #endif msleep(100); /* add short delay after enabling * the demod before touching it */ } return (adap_state->fe_init) ? adap_state->fe_init(fe) : 0; fail: return -ENODEV; } static int mxl111sf_adap_fe_sleep(struct dvb_frontend *fe) { struct dvb_usb_adapter *adap = fe->dvb->priv; struct dvb_usb_device *d = adap->dev; struct mxl111sf_state *state = d->priv; struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe->id].priv; int err; /* exit if we didnt initialize the driver yet */ if (!state->chip_id) { mxl_debug("driver not yet initialized, exit."); goto fail; } deb_info("%s()\n", __func__); err = (adap_state->fe_sleep) ? adap_state->fe_sleep(fe) : 0; mutex_unlock(&state->fe_lock); return err; fail: return -ENODEV; } static int mxl111sf_ep6_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) { struct dvb_usb_device *d = adap->dev; struct mxl111sf_state *state = d->priv; struct mxl111sf_adap_state *adap_state = adap->fe_adap[adap->active_fe].priv; int ret = 0; u8 tmp; deb_info("%s(%d)\n", __func__, onoff); if (onoff) { ret = mxl111sf_enable_usb_output(state); mxl_fail(ret); ret = mxl111sf_config_mpeg_in(state, 1, 1, adap_state->ep6_clockphase, 0, 0); mxl_fail(ret); #if 0 } else { ret = mxl111sf_disable_656_port(state); mxl_fail(ret); #endif } return ret; } static int mxl111sf_ep4_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) { struct dvb_usb_device *d = adap->dev; struct mxl111sf_state *state = d->priv; int ret = 0; deb_info("%s(%d)\n", __func__, onoff); if (onoff) { ret = mxl111sf_enable_usb_output(state); mxl_fail(ret); } return ret; } /* ------------------------------------------------------------------------ */ static struct lgdt3305_config hauppauge_lgdt3305_config = { .i2c_addr = 0xb2 >> 1, .mpeg_mode = LGDT3305_MPEG_SERIAL, .tpclk_edge = LGDT3305_TPCLK_RISING_EDGE, .tpvalid_polarity = LGDT3305_TP_VALID_HIGH, .deny_i2c_rptr = 1, .spectral_inversion = 0, .qam_if_khz = 6000, .vsb_if_khz = 6000, }; static int mxl111sf_lgdt3305_frontend_attach(struct dvb_usb_adapter *adap) { struct dvb_usb_device *d = adap->dev; struct mxl111sf_state *state = d->priv; int fe_id = adap->num_frontends_initialized; struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv; int ret; deb_adv("%s()\n", __func__); /* save a pointer to the dvb_usb_device in device state */ state->d = d; adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1; state->alt_mode = adap_state->alt_mode; if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0) err("set interface failed"); state->gpio_mode = MXL111SF_GPIO_MOD_ATSC; adap_state->gpio_mode = state->gpio_mode; adap_state->device_mode = MXL_TUNER_MODE; adap_state->ep6_clockphase = 1; ret = mxl1x1sf_soft_reset(state); if (mxl_fail(ret)) goto fail; ret = mxl111sf_init_tuner_demod(state); if (mxl_fail(ret)) goto fail; ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode); if (mxl_fail(ret)) goto fail; ret = mxl111sf_enable_usb_output(state); if (mxl_fail(ret)) goto fail; ret = mxl1x1sf_top_master_ctrl(state, 1); if (mxl_fail(ret)) goto fail; ret = mxl111sf_init_port_expander(state); if (mxl_fail(ret)) goto fail; ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode); if (mxl_fail(ret)) goto fail; adap->fe_adap[fe_id].fe = dvb_attach(lgdt3305_attach, &hauppauge_lgdt3305_config, &adap->dev->i2c_adap); if (adap->fe_adap[fe_id].fe) { adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init; adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init; adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep; adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep; return 0; } ret = -EIO; fail: return ret; } static struct mxl111sf_demod_config mxl_demod_config = { .read_reg = mxl111sf_read_reg, .write_reg = mxl111sf_write_reg, .program_regs = mxl111sf_ctrl_program_regs, }; static int mxl111sf_attach_demod(struct dvb_usb_adapter *adap) { struct dvb_usb_device *d = adap->dev; struct mxl111sf_state *state = d->priv; int fe_id = adap->num_frontends_initialized; struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv; int ret; deb_adv("%s()\n", __func__); /* save a pointer to the dvb_usb_device in device state */ state->d = d; adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 1 : 2; state->alt_mode = adap_state->alt_mode; if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0) err("set interface failed"); state->gpio_mode = MXL111SF_GPIO_MOD_DVBT; adap_state->gpio_mode = state->gpio_mode; adap_state->device_mode = MXL_SOC_MODE; adap_state->ep6_clockphase = 1; ret = mxl1x1sf_soft_reset(state); if (mxl_fail(ret)) goto fail; ret = mxl111sf_init_tuner_demod(state); if (mxl_fail(ret)) goto fail; ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode); if (mxl_fail(ret)) goto fail; ret = mxl111sf_enable_usb_output(state); if (mxl_fail(ret)) goto fail; ret = mxl1x1sf_top_master_ctrl(state, 1); if (mxl_fail(ret)) goto fail; /* dont care if this fails */ mxl111sf_init_port_expander(state); adap->fe_adap[fe_id].fe = dvb_attach(mxl111sf_demod_attach, state, &mxl_demod_config); if (adap->fe_adap[fe_id].fe) { adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init; adap->fe_adap[fe_id].fe->ops.init = mxl111sf_adap_fe_init; adap_state->fe_sleep = adap->fe_adap[fe_id].fe->ops.sleep; adap->fe_adap[fe_id].fe->ops.sleep = mxl111sf_adap_fe_sleep; return 0; } ret = -EIO; fail: return ret; } static inline int mxl111sf_set_ant_path(struct mxl111sf_state *state, int antpath) { return mxl111sf_idac_config(state, 1, 1, (antpath == ANT_PATH_INTERNAL) ? 0x3f : 0x00, 0); } #define DbgAntHunt(x, pwr0, pwr1, pwr2, pwr3) \ err("%s(%d) FINAL input set to %s rxPwr:%d|%d|%d|%d\n", \ __func__, __LINE__, \ (ANT_PATH_EXTERNAL == x) ? "EXTERNAL" : "INTERNAL", \ pwr0, pwr1, pwr2, pwr3) #define ANT_HUNT_SLEEP 90 #define ANT_EXT_TWEAK 0 static int mxl111sf_ant_hunt(struct dvb_frontend *fe) { struct dvb_usb_adapter *adap = fe->dvb->priv; struct dvb_usb_device *d = adap->dev; struct mxl111sf_state *state = d->priv; int antctrl = dvb_usb_mxl111sf_rfswitch; u16 rxPwrA, rxPwr0, rxPwr1, rxPwr2; /* FIXME: must force EXTERNAL for QAM - done elsewhere */ mxl111sf_set_ant_path(state, antctrl == ANT_PATH_AUTO ? ANT_PATH_EXTERNAL : antctrl); if (antctrl == ANT_PATH_AUTO) { #if 0 msleep(ANT_HUNT_SLEEP); #endif fe->ops.tuner_ops.get_rf_strength(fe, &rxPwrA); mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL); msleep(ANT_HUNT_SLEEP); fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr0); mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL); msleep(ANT_HUNT_SLEEP); fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr1); mxl111sf_set_ant_path(state, ANT_PATH_INTERNAL); msleep(ANT_HUNT_SLEEP); fe->ops.tuner_ops.get_rf_strength(fe, &rxPwr2); if (rxPwr1+ANT_EXT_TWEAK >= rxPwr2) { /* return with EXTERNAL enabled */ mxl111sf_set_ant_path(state, ANT_PATH_EXTERNAL); DbgAntHunt(ANT_PATH_EXTERNAL, rxPwrA, rxPwr0, rxPwr1, rxPwr2); } else { /* return with INTERNAL enabled */ DbgAntHunt(ANT_PATH_INTERNAL, rxPwrA, rxPwr0, rxPwr1, rxPwr2); } } return 0; } static struct mxl111sf_tuner_config mxl_tuner_config = { .if_freq = MXL_IF_6_0, /* applies to external IF output, only */ .invert_spectrum = 0, .read_reg = mxl111sf_read_reg, .write_reg = mxl111sf_write_reg, .program_regs = mxl111sf_ctrl_program_regs, .top_master_ctrl = mxl1x1sf_top_master_ctrl, .ant_hunt = mxl111sf_ant_hunt, }; static int mxl111sf_attach_tuner(struct dvb_usb_adapter *adap) { struct dvb_usb_device *d = adap->dev; struct mxl111sf_state *state = d->priv; int fe_id = adap->num_frontends_initialized; deb_adv("%s()\n", __func__); if (NULL != dvb_attach(mxl111sf_tuner_attach, adap->fe_adap[fe_id].fe, state, &mxl_tuner_config)) return 0; return -EIO; } static int mxl111sf_fe_ioctl_override(struct dvb_frontend *fe, unsigned int cmd, void *parg, unsigned int stage) { int err = 0; switch (stage) { case DVB_FE_IOCTL_PRE: switch (cmd) { case FE_READ_SIGNAL_STRENGTH: err = fe->ops.tuner_ops.get_rf_strength(fe, parg); /* If no error occurs, prevent dvb-core from handling * this IOCTL, otherwise return the error */ if (0 == err) err = 1; break; } break; case DVB_FE_IOCTL_POST: /* no post-ioctl handling required */ break; } return err; }; static u32 mxl111sf_i2c_func(struct i2c_adapter *adapter) { return I2C_FUNC_I2C; } struct i2c_algorithm mxl111sf_i2c_algo = { .master_xfer = mxl111sf_i2c_xfer, .functionality = mxl111sf_i2c_func, #ifdef NEED_ALGO_CONTROL .algo_control = dummy_algo_control, #endif }; static struct dvb_usb_device_properties mxl111sf_dvbt_bulk_properties; static struct dvb_usb_device_properties mxl111sf_dvbt_isoc_properties; static struct dvb_usb_device_properties mxl111sf_atsc_bulk_properties; static struct dvb_usb_device_properties mxl111sf_atsc_isoc_properties; static int mxl111sf_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct dvb_usb_device *d = NULL; deb_adv("%s()\n", __func__); if (((dvb_usb_mxl111sf_isoc) && (0 == dvb_usb_device_init(intf, &mxl111sf_dvbt_isoc_properties, THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &mxl111sf_atsc_isoc_properties, THIS_MODULE, &d, adapter_nr))) || 0 == dvb_usb_device_init(intf, &mxl111sf_dvbt_bulk_properties, THIS_MODULE, &d, adapter_nr) || 0 == dvb_usb_device_init(intf, &mxl111sf_atsc_bulk_properties, THIS_MODULE, &d, adapter_nr) || 0) { struct mxl111sf_state *state = d->priv; static u8 eeprom[256]; struct i2c_client c; int ret; ret = get_chip_info(state); if (mxl_fail(ret)) err("failed to get chip info during probe"); mutex_init(&state->fe_lock); if (state->chip_rev > MXL111SF_V6) mxl111sf_config_pin_mux_modes(state, PIN_MUX_TS_SPI_IN_MODE_1); c.adapter = &d->i2c_adap; c.addr = 0xa0 >> 1; ret = tveeprom_read(&c, eeprom, sizeof(eeprom)); if (mxl_fail(ret)) return 0; tveeprom_hauppauge_analog(&c, &state->tv, (0x84 == eeprom[0xa0]) ? eeprom + 0xa0 : eeprom + 0x80); #if 0 switch (state->tv.model) { case 117001: case 126001: case 138001: break; default: printk(KERN_WARNING "%s: warning: " "unknown hauppauge model #%d\n", __func__, state->tv.model); } #endif return 0; } err("Your device is not yet supported by this driver. " "See kernellabs.com for more info"); return -EINVAL; } static struct usb_device_id mxl111sf_table[] = { /* 0 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc600) }, /* ATSC+ IR */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc601) }, /* ATSC */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc602) }, /* + */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc603) }, /* ATSC+ */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc604) }, /* DVBT */ /* 5 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc609) }, /* ATSC IR */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60a) }, /* + IR */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60b) }, /* ATSC+ IR */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc60c) }, /* DVBT IR */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc653) }, /* ATSC+ */ /*10 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc65b) }, /* ATSC+ IR */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb700) }, /* ATSC+ sw */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb701) }, /* ATSC sw */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb702) }, /* + sw */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb703) }, /* ATSC+ sw */ /*15 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb704) }, /* DVBT sw */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb753) }, /* ATSC+ sw */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb763) }, /* ATSC+ no */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb764) }, /* DVBT no */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd853) }, /* ATSC+ sw */ /*20 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd854) }, /* DVBT sw */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd863) }, /* ATSC+ no */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd864) }, /* DVBT no */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8d3) }, /* ATSC+ sw */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8d4) }, /* DVBT sw */ /*25 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8e3) }, /* ATSC+ no */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8e4) }, /* DVBT no */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xd8ff) }, /* ATSC+ */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc612) }, /* + */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc613) }, /* ATSC+ */ /*30 */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc61a) }, /* + IR */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xc61b) }, /* ATSC+ IR */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb757) }, /* ATSC+DVBT sw */ { USB_DEVICE(USB_VID_HAUPPAUGE, 0xb767) }, /* ATSC+DVBT no */ {} /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, mxl111sf_table); #define MXL111SF_EP4_BULK_STREAMING_CONFIG \ .size_of_priv = sizeof(struct mxl111sf_adap_state), \ .streaming_ctrl = mxl111sf_ep4_streaming_ctrl, \ .stream = { \ .type = USB_BULK, \ .count = 5, \ .endpoint = 0x04, \ .u = { \ .bulk = { \ .buffersize = 8192, \ } \ } \ } /* FIXME: works for v6 but not v8 silicon */ #define MXL111SF_EP4_ISOC_STREAMING_CONFIG \ .size_of_priv = sizeof(struct mxl111sf_adap_state), \ .streaming_ctrl = mxl111sf_ep4_streaming_ctrl, \ .stream = { \ .type = USB_ISOC, \ .count = 5, \ .endpoint = 0x04, \ .u = { \ .isoc = { \ .framesperurb = 96, \ /* FIXME: v6 SILICON: */ \ .framesize = 564, \ .interval = 1, \ } \ } \ } #define MXL111SF_EP6_BULK_STREAMING_CONFIG \ .size_of_priv = sizeof(struct mxl111sf_adap_state), \ .streaming_ctrl = mxl111sf_ep6_streaming_ctrl, \ .stream = { \ .type = USB_BULK, \ .count = 5, \ .endpoint = 0x06, \ .u = { \ .bulk = { \ .buffersize = 8192, \ } \ } \ } /* FIXME */ #define MXL111SF_EP6_ISOC_STREAMING_CONFIG \ .size_of_priv = sizeof(struct mxl111sf_adap_state), \ .streaming_ctrl = mxl111sf_ep6_streaming_ctrl, \ .stream = { \ .type = USB_ISOC, \ .count = 5, \ .endpoint = 0x06, \ .u = { \ .isoc = { \ .framesperurb = 24, \ .framesize = 3072, \ .interval = 1, \ } \ } \ } #define MXL111SF_DEFAULT_DEVICE_PROPERTIES \ .caps = DVB_USB_IS_AN_I2C_ADAPTER, \ .usb_ctrl = DEVICE_SPECIFIC, \ /* use usb alt setting 1 for EP4 ISOC transfer (dvb-t), \ EP6 BULK transfer (atsc/qam), \ use usb alt setting 2 for EP4 BULK transfer (dvb-t), \ EP6 ISOC transfer (atsc/qam), \ */ \ .power_ctrl = mxl111sf_power_ctrl, \ .i2c_algo = &mxl111sf_i2c_algo, \ .generic_bulk_ctrl_endpoint = MXL_EP2_REG_WRITE, \ .generic_bulk_ctrl_endpoint_response = MXL_EP1_REG_READ, \ .size_of_priv = sizeof(struct mxl111sf_state) static struct dvb_usb_device_properties mxl111sf_dvbt_bulk_properties = { MXL111SF_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, .adapter = { { .fe_ioctl_override = mxl111sf_fe_ioctl_override, .num_frontends = 1, .fe = {{ .frontend_attach = mxl111sf_attach_demod, .tuner_attach = mxl111sf_attach_tuner, MXL111SF_EP4_BULK_STREAMING_CONFIG, } }, }, }, .num_device_descs = 4, .devices = { { "Hauppauge 126xxx DVBT (bulk)", { NULL }, { &mxl111sf_table[4], &mxl111sf_table[8], NULL }, }, { "Hauppauge 117xxx DVBT (bulk)", { NULL }, { &mxl111sf_table[15], &mxl111sf_table[18], NULL }, }, { "Hauppauge 138xxx DVBT (bulk)", { NULL }, { &mxl111sf_table[20], &mxl111sf_table[22], &mxl111sf_table[24], &mxl111sf_table[26], NULL }, }, { "Hauppauge 126xxx (tp-bulk)", { NULL }, { &mxl111sf_table[28], &mxl111sf_table[30], NULL }, }, } }; static struct dvb_usb_device_properties mxl111sf_dvbt_isoc_properties = { MXL111SF_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, .adapter = { { .fe_ioctl_override = mxl111sf_fe_ioctl_override, .num_frontends = 1, .fe = {{ .frontend_attach = mxl111sf_attach_demod, .tuner_attach = mxl111sf_attach_tuner, MXL111SF_EP4_ISOC_STREAMING_CONFIG, } }, }, }, .num_device_descs = 4, .devices = { { "Hauppauge 126xxx DVBT (isoc)", { NULL }, { &mxl111sf_table[4], &mxl111sf_table[8], NULL }, }, { "Hauppauge 117xxx DVBT (isoc)", { NULL }, { &mxl111sf_table[15], &mxl111sf_table[18], NULL }, }, { "Hauppauge 138xxx DVBT (isoc)", { NULL }, { &mxl111sf_table[20], &mxl111sf_table[22], &mxl111sf_table[24], &mxl111sf_table[26], NULL }, }, { "Hauppauge 126xxx (tp-isoc)", { NULL }, { &mxl111sf_table[28], &mxl111sf_table[30], NULL }, }, } }; static struct dvb_usb_device_properties mxl111sf_atsc_bulk_properties = { MXL111SF_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, .adapter = { { .fe_ioctl_override = mxl111sf_fe_ioctl_override, .num_frontends = 2, .fe = {{ .frontend_attach = mxl111sf_lgdt3305_frontend_attach, .tuner_attach = mxl111sf_attach_tuner, MXL111SF_EP6_BULK_STREAMING_CONFIG, }, { .frontend_attach = mxl111sf_attach_demod, .tuner_attach = mxl111sf_attach_tuner, MXL111SF_EP4_BULK_STREAMING_CONFIG, }}, }, }, .num_device_descs = 6, .devices = { { "Hauppauge 126xxx ATSC (bulk)", { NULL }, { &mxl111sf_table[1], &mxl111sf_table[5], NULL }, }, { "Hauppauge 117xxx ATSC (bulk)", { NULL }, { &mxl111sf_table[12], NULL }, }, { "Hauppauge 126xxx ATSC+ (bulk)", { NULL }, { &mxl111sf_table[0], &mxl111sf_table[3], &mxl111sf_table[7], &mxl111sf_table[9], &mxl111sf_table[10], NULL }, }, { "Hauppauge 117xxx ATSC+ (bulk)", { NULL }, { &mxl111sf_table[11], &mxl111sf_table[14], &mxl111sf_table[16], &mxl111sf_table[17], &mxl111sf_table[32], &mxl111sf_table[33], NULL }, }, { "Hauppauge Mercury (tp-bulk)", { NULL }, { &mxl111sf_table[19], &mxl111sf_table[21], &mxl111sf_table[23], &mxl111sf_table[25], &mxl111sf_table[27], NULL }, }, { "Hauppauge WinTV-Aero-M", { NULL }, { &mxl111sf_table[29], &mxl111sf_table[31], NULL }, }, } }; static struct dvb_usb_device_properties mxl111sf_atsc_isoc_properties = { MXL111SF_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, .adapter = { { .fe_ioctl_override = mxl111sf_fe_ioctl_override, .num_frontends = 2, .fe = {{ .frontend_attach = mxl111sf_lgdt3305_frontend_attach, .tuner_attach = mxl111sf_attach_tuner, MXL111SF_EP6_ISOC_STREAMING_CONFIG, }, { .frontend_attach = mxl111sf_attach_demod, .tuner_attach = mxl111sf_attach_tuner, MXL111SF_EP4_ISOC_STREAMING_CONFIG, }}, }, }, .num_device_descs = 6, .devices = { { "Hauppauge 126xxx ATSC (isoc)", { NULL }, { &mxl111sf_table[1], &mxl111sf_table[5], NULL }, }, { "Hauppauge 117xxx ATSC (isoc)", { NULL }, { &mxl111sf_table[12], NULL }, }, { "Hauppauge 126xxx ATSC+ (isoc)", { NULL }, { &mxl111sf_table[0], &mxl111sf_table[3], &mxl111sf_table[7], &mxl111sf_table[9], &mxl111sf_table[10], NULL }, }, { "Hauppauge 117xxx ATSC+ (isoc)", { NULL }, { &mxl111sf_table[11], &mxl111sf_table[14], &mxl111sf_table[16], &mxl111sf_table[17], &mxl111sf_table[32], &mxl111sf_table[33], NULL }, }, { "Hauppauge Mercury (tp-isoc)", { NULL }, { &mxl111sf_table[19], &mxl111sf_table[21], &mxl111sf_table[23], &mxl111sf_table[25], &mxl111sf_table[27], NULL }, }, { "Hauppauge WinTV-Aero-M (tp-isoc)", { NULL }, { &mxl111sf_table[29], &mxl111sf_table[31], NULL }, }, } }; static struct usb_driver mxl111sf_driver = { .name = "dvb_usb_mxl111sf", .probe = mxl111sf_probe, .disconnect = dvb_usb_device_exit, .id_table = mxl111sf_table, }; module_usb_driver(mxl111sf_driver); MODULE_AUTHOR("Michael Krufky <[email protected]>"); MODULE_DESCRIPTION("Driver for MaxLinear MxL111SF"); MODULE_VERSION("1.0"); MODULE_LICENSE("GPL"); /* * Local variables: * c-basic-offset: 8 * End: */
{ "pile_set_name": "Github" }
import difflib import logging from django.conf import settings from django.contrib.sites.models import Site from django.urls import reverse as django_reverse from django.utils.translation import ugettext as _, ugettext_lazy as _lazy from bleach import clean from tidings.events import InstanceEvent, Event, EventUnion from tidings.utils import hash_to_unsigned from wikimarkup.parser import ALLOWED_TAGS, ALLOWED_ATTRIBUTES from kitsune.sumo import email_utils from kitsune.sumo.templatetags.jinja_helpers import add_utm from kitsune.sumo.urlresolvers import reverse from kitsune.wiki.models import Document log = logging.getLogger("k.wiki.events") def get_diff_for(doc, old_rev, new_rev): fromfile = "[%s] %s #%s" % (doc.locale, doc.title, old_rev.id) tofile = "[%s] %s #%s" % (doc.locale, doc.title, new_rev.id) # Get diff diff_parts = difflib.unified_diff( old_rev.content.splitlines(1), new_rev.content.splitlines(1), fromfile=fromfile, tofile=tofile, ) # Join diff parts # XXX this is super goofy acc = "" for d in diff_parts: if isinstance(d, str): acc = acc + d else: acc = acc + d.decode("utf8") # Clean output return clean(acc, ALLOWED_TAGS, ALLOWED_ATTRIBUTES) def context_dict(revision, ready_for_l10n=False, revision_approved=False): """Return a dict that fills in the blanks in KB notification templates.""" diff = "" l10n = revision.document.revisions.filter(is_ready_for_localization=True) approved = revision.document.revisions.filter(is_approved=True) if ready_for_l10n and l10n.count() > 1: old_rev = l10n.order_by("-created")[1] diff = get_diff_for(revision.document, old_rev, revision) elif revision_approved and approved.count() > 1: old_rev = approved.order_by("-created")[1] diff = get_diff_for(revision.document, old_rev, revision) elif revision.document.current_revision is not None: old_rev = revision.document.current_revision diff = get_diff_for(revision.document, old_rev, revision) return { "document_title": revision.document.title, "creator": revision.creator, "host": Site.objects.get_current().domain, "diff": diff, "summary": clean(revision.summary, ALLOWED_TAGS, ALLOWED_ATTRIBUTES), "fulltext": clean(revision.content, ALLOWED_TAGS, ALLOWED_ATTRIBUTES), } class EditDocumentEvent(InstanceEvent): """Event fired when a certain document is edited""" event_type = "wiki edit document" content_type = Document def __init__(self, revision): super(EditDocumentEvent, self).__init__(revision.document) self.revision = revision def _mails(self, users_and_watches): revision = self.revision document = revision.document log.debug("Sending edited notification email for document (id=%s)" % document.id) subject = _lazy("{title} was edited by {creator}") url = reverse("wiki.document_revisions", locale=document.locale, args=[document.slug]) context = context_dict(revision) context["revisions_url"] = add_utm(url, "wiki-edit") context["locale"] = document.locale context["title"] = document.title context["creator"] = revision.creator context["comment"] = revision.comment return email_utils.emails_with_users_and_watches( subject=subject, text_template="wiki/email/edited.ltxt", html_template="wiki/email/edited.html", context_vars=context, users_and_watches=users_and_watches, default_locale=document.locale, ) class _RevisionConstructor(object): """An event that receives a revision when constructed""" def __init__(self, revision): super(_RevisionConstructor, self).__init__() self.revision = revision class _BaseProductFilter(object): """A base class for product filters. It adds a _filter_by_product method that filters down a list of (user, watches) to only the users watching the products for the revision. """ def _filter_by_product(self, all_watchers): products = self.revision.document.get_products() product_hashes = [hash_to_unsigned(s.slug) for s in products] watchers_and_watches = [] # Weed out the users that have a product filter that isn't one of the # document's products. for user, watches in all_watchers: for watch in watches: # Get the product filters for the watch, if any. prods = watch.filters.filter(name="product").values_list("value", flat=True) # If there are no product filters, they are watching them all. if len(prods) == 0: watchers_and_watches.append((user, watches)) break # Otherwise, check if they are watching any of the document's # products. for prod in prods: if prod in product_hashes: watchers_and_watches.append((user, watches)) break return watchers_and_watches class _ProductFilter(_BaseProductFilter): """An event that receives a revision when constructed and filters according to that revision's document's products""" filters = {"product"} # notify(), stop_notifying(), and is_notifying() take... # (user_or_email, product=optional_product) def _users_watching(self, **kwargs): # Get the users watching any or all products. users = list(self._users_watching_by_filter(**kwargs)) # Weed out the users that have a product filter that isn't one of the # document's products. return self._filter_by_product(users) class _LocaleAndProductFilter(_BaseProductFilter): """An event that receives a revision when constructed and filters according to that revision's document's locale and products.""" filters = {"locale", "product"} # notify(), stop_notifying(), and is_notifying() take... # (user_or_email, locale=some_locale, product=optional_product) def _users_watching(self, **kwargs): locale = self.revision.document.locale # Get the users just subscribed to the locale (any and all products). users = list(self._users_watching_by_filter(locale=locale, **kwargs)) # Weed out the users that have a product filter that isn't one of the # document's products. return self._filter_by_product(users) class ReviewableRevisionInLocaleEvent(_RevisionConstructor, _LocaleAndProductFilter, Event): """Event fired when any revision in a certain locale is ready for review""" # Our event_type suffices to limit our scope, so we don't bother # setting content_type. event_type = "reviewable wiki in locale" def _mails(self, users_and_watches): revision = self.revision document = revision.document log.debug("Sending ready for review email for revision (id=%s)" % revision.id) subject = _lazy("{title} is ready for review ({creator})") url = reverse( "wiki.review_revision", locale=document.locale, args=[document.slug, revision.id], ) context = context_dict(revision) context["revision_url"] = add_utm(url, "wiki-ready-review") context["locale"] = document.locale context["title"] = document.title context["creator"] = revision.creator context["comment"] = revision.comment users = [] for u, w in users_and_watches: if document.allows(u, "review_revision"): users.append((u, w)) return email_utils.emails_with_users_and_watches( subject=subject, text_template="wiki/email/ready_for_review.ltxt", html_template="wiki/email/ready_for_review.html", context_vars=context, users_and_watches=users, default_locale=document.locale, ) class ReadyRevisionEvent(_RevisionConstructor, _ProductFilter, Event): """Event fired when a revision becomes ready for l10n.""" event_type = "ready wiki" def _mails(self, users_and_watches): """Send readiness mails.""" revision = self.revision document = revision.document log.debug("Sending ready notifications for revision (id=%s)" % revision.id) subject = _lazy("{title} has a revision ready for localization") url = django_reverse("wiki.translate", args=[document.slug]) context = context_dict(revision, ready_for_l10n=True) context["l10n_url"] = add_utm(url, "wiki-ready-l10n") context["title"] = document.title return email_utils.emails_with_users_and_watches( subject=subject, text_template="wiki/email/ready_for_l10n.ltxt", html_template="wiki/email/ready_for_l10n.html", context_vars=context, users_and_watches=users_and_watches, default_locale=document.locale, ) class ApproveRevisionInLocaleEvent(_RevisionConstructor, _LocaleAndProductFilter, Event): """Event fed to a union when any revision in a certain locale is approved Not intended to be fired individually """ # No other content types have a concept of approval, so we don't bother # setting content_type. event_type = "approved wiki in locale" class ApprovedOrReadyUnion(EventUnion): """Event union fired when a revision is approved and also possibly ready Unioned events must have a `revision` attr. """ def __init__(self, *args, **kwargs): super(ApprovedOrReadyUnion, self).__init__(*args, **kwargs) self._revision = self.events[0].revision def _mails(self, users_and_watches): """Send approval or readiness mails, as appropriate. If a given user is watching the Ready event and the revision is in fact ready, say so. Otherwise, just send the Approval email. """ revision = self._revision document = revision.document is_ready = revision.is_ready_for_localization log.debug("Sending approved/ready notifications for revision (id=%s)" % revision.id) # Localize the subject and message with the appropriate # context. If there is an error, fall back to English. @email_utils.safe_translation def _make_mail(locale, user, watches): if is_ready and ReadyRevisionEvent.event_type in (w.event_type for w in watches): c = context_dict(revision, ready_for_l10n=True) # TODO: Expose all watches c["watch"] = watches[0] url = reverse("wiki.translate", args=[document.slug], locale=locale) c["l10n_url"] = add_utm(url, "wiki-ready-l10n") subject = _("{title} has a revision ready for localization") text_template = "wiki/email/ready_for_l10n.ltxt" html_template = "wiki/email/ready_for_l10n.html" else: c = context_dict(revision, revision_approved=True) approved_url = reverse( "wiki.document", locale=document.locale, args=[document.slug] ) c["document_url"] = add_utm(approved_url, "wiki-approved") # TODO: Expose all watches. c["watch"] = watches[0] c["reviewer"] = revision.reviewer subject = _("{title} ({locale}) has a new approved revision ({reviewer})") text_template = "wiki/email/approved.ltxt" html_template = "wiki/email/approved.html" subject = subject.format( title=document.title, reviewer=revision.reviewer.username, locale=document.locale, ) mail = email_utils.make_mail( subject=subject, text_template=text_template, html_template=html_template, context_vars=c, from_email=settings.TIDINGS_FROM_ADDRESS, to_email=user.email, ) return mail for user, watches in users_and_watches: # Figure out the locale to use for l10n. if hasattr(user, "profile"): locale = user.profile.locale else: locale = document.locale yield _make_mail(locale, user, watches)
{ "pile_set_name": "Github" }
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build linux // +build arm64 // +build !gccgo #include "textflag.h" // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. TEXT ·Syscall(SB),NOSPLIT,$0-56 B syscall·Syscall(SB) TEXT ·Syscall6(SB),NOSPLIT,$0-80 B syscall·Syscall6(SB) TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 BL runtime·entersyscall(SB) MOVD a1+8(FP), R0 MOVD a2+16(FP), R1 MOVD a3+24(FP), R2 MOVD $0, R3 MOVD $0, R4 MOVD $0, R5 MOVD trap+0(FP), R8 // syscall entry SVC MOVD R0, r1+32(FP) // r1 MOVD R1, r2+40(FP) // r2 BL runtime·exitsyscall(SB) RET TEXT ·RawSyscall(SB),NOSPLIT,$0-56 B syscall·RawSyscall(SB) TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 B syscall·RawSyscall6(SB) TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 MOVD a1+8(FP), R0 MOVD a2+16(FP), R1 MOVD a3+24(FP), R2 MOVD $0, R3 MOVD $0, R4 MOVD $0, R5 MOVD trap+0(FP), R8 // syscall entry SVC MOVD R0, r1+32(FP) MOVD R1, r2+40(FP) RET
{ "pile_set_name": "Github" }
#!/bin/bash # # @@@ START COPYRIGHT @@@ # # 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. # # @@@ END COPYRIGHT @@@ # shell $1 $2 $3 $4 $5 $6 $7 $8 $9
{ "pile_set_name": "Github" }
#version 450 layout(location = 0) flat in int index; layout(location = 0) out float color; // lookup table const float table[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; void main() { color = table[index]; }
{ "pile_set_name": "Github" }
/* ****************************************************************** ** ** OpenSees - Open System for Earthquake Engineering Simulation ** ** Pacific Earthquake Engineering Research Center ** ** ** ** ** ** (C) Copyright 2001, The Regents of the University of California ** ** All Rights Reserved. ** ** ** ** Commercial use of this program without express permission of the ** ** University of California, Berkeley, is strictly prohibited. See ** ** file 'COPYRIGHT' in main directory for information on usage and ** ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. ** ** ** ** Developed by: ** ** Frank McKenna ([email protected]) ** ** Gregory L. Fenves ([email protected]) ** ** Filip C. Filippou ([email protected]) ** ** ** ** Reliability module developed by: ** ** Terje Haukaas ([email protected]) ** ** Armen Der Kiureghian ([email protected]) ** ** ** ** ****************************************************************** */ // $Revision: 1.11 $ // $Date: 2008-05-12 16:05:22 $ // $Source: /usr/local/cvs/OpenSees/SRC/reliability/analysis/randomNumber/CStdLibRandGenerator.cpp,v $ // // Written by Terje Haukaas ([email protected]) // #include <RandomNumberGenerator.h> #include <CStdLibRandGenerator.h> #include <NormalRV.h> #include <Vector.h> #include <math.h> #include <stdlib.h> #include <time.h> CStdLibRandGenerator::CStdLibRandGenerator() :RandomNumberGenerator() { generatedNumbers = 0; setSeed(0); } CStdLibRandGenerator::~CStdLibRandGenerator() { if (generatedNumbers != 0) delete generatedNumbers; } int CStdLibRandGenerator::generate_nIndependentUniformNumbers(int n, double lower, double upper, int seedIn) { // Initial declarations int randomNumberBetween0AndRAND_MAX; double randomNumberBetween0And1; // set RNG seed if necessary if (seedIn != 0) setSeed(seedIn); // size output vector if (generatedNumbers == 0) { generatedNumbers = new Vector(n); } else if (generatedNumbers->Size() != n) { delete generatedNumbers; generatedNumbers = new Vector(n); } Vector &randomArray = *generatedNumbers; // Create array of standard normal random numbers for ( int j=0; j<n; j++) { // Generate a number between 0 and RAND_MAX randomNumberBetween0AndRAND_MAX = rand(); // Modify it so that the value lies between 0 and 1 randomNumberBetween0And1 = (double)randomNumberBetween0AndRAND_MAX/RAND_MAX; // Transform according to uniform distribution randomArray(j) = (upper-lower)*randomNumberBetween0And1 + lower; } // KRM - not sure what this is meant to do, should probably use setSeed(0) seed = randomNumberBetween0AndRAND_MAX; return 0; } int CStdLibRandGenerator::generate_nIndependentStdNormalNumbers(int n, int seedIn) { // Initial declarations int randomNumberBetween0AndRAND_MAX; double randomNumberBetween0And1; // set RNG seed if necessary if (seedIn != 0) setSeed(seedIn); // size output vector if (generatedNumbers == 0) { generatedNumbers = new Vector(n); } else if (generatedNumbers->Size() != n) { delete generatedNumbers; generatedNumbers = new Vector(n); } Vector &randomArray = *generatedNumbers; // Create array of standard normal random numbers static NormalRV uRV(1, 0.0, 1.0); for ( int j=0; j<n; j++) { // Generate a number between 0 and RAND_MAX randomNumberBetween0AndRAND_MAX = rand(); // Modify it so that the value lies between 0 and 1 randomNumberBetween0And1 = (double)randomNumberBetween0AndRAND_MAX/RAND_MAX; // Treat two special cases if (randomNumberBetween0And1 == 0.0) { randomNumberBetween0And1 = 0.0000001; } if (randomNumberBetween0And1 == 1.0) { randomNumberBetween0And1 = 0.9999999; } // Transform that number into a standard normal variable // Phi(z) = F(x) // z = invPhi( F(x) ) // where F(x) for the uniform distribution from 0 to 1 in fact is equal to x itself. randomArray(j) = uRV.getInverseCDFvalue(randomNumberBetween0And1); } // KRM - not sure what this is meant to do, should probably use setSeed(0) seed = randomNumberBetween0AndRAND_MAX; return 0; } const Vector& CStdLibRandGenerator::getGeneratedNumbers() { return (*generatedNumbers); } int CStdLibRandGenerator::getSeed() { return seed; } void CStdLibRandGenerator::setSeed(int passedSeed) { if (passedSeed!=0) { srand(passedSeed); seed = passedSeed; } else { seed = time(NULL); srand(seed); } } double CStdLibRandGenerator::generate_singleUniformNumber(double lower, double upper) { // this is silly, shouldn't repeat code with _single and _n functions - KRM // modifying to use previous methods generate_nIndependentUniformNumbers(1, lower, upper); return (*generatedNumbers)(0); } double CStdLibRandGenerator::generate_singleStdNormalNumber(void) { // this is silly, shouldn't repeat code with _single and _n functions - KRM // modifying to use previous methods generate_nIndependentStdNormalNumbers(1); return (*generatedNumbers)(0); }
{ "pile_set_name": "Github" }
define([], function () { return { 'PropertyPaneDescription': 'Configurez le formulaire de la liste ici. Une fois la liste configurée, les champs peuvent être déplacés, insérés et supprimés dans le contenu du webpart.', 'BasicGroupName': 'Paramètres', 'TitleFieldLabel': 'Titre', 'DescriptionFieldLabel': 'Description', 'ListFieldLabel': 'Liste', 'FormTypeFieldLabel': 'Type de formulaire', 'ItemIdFieldLabel': 'ID de l\'item', 'ItemIdFieldDescription': 'Entrez un nombre pour l\'ID ou le nom du paramètre de chaîne de requête à utiliser pour l\'ID.', 'ShowUnsupportedFieldsLabel': 'Afficher les champs non pris en charge', 'RedirectUrlFieldLabel': 'URL de redirection après l\'enregistrement (facultatif)', 'RedirectUrlFieldDescription': 'Peut contenir [ID] comme placeholder remplacable par l\'ID de l\'élément mis à jour ou créé. Exemple: /list/Test/DispForm.aspx?ID=[ID]', 'LocalWorkbenchUnsupported': 'L\'exécution du WebPart dans votre Workbench local n\'est pas prise en charge. Veuillez l\'exécuter dans votre site SharePoint.', 'MissingListConfiguration': 'Veuillez configurer une liste SharePoint dans les propriétés du WebPart.', 'ConfigureWebpartButtonText': 'Configurer le WebPart', 'ErrorOnLoadingLists': 'Erreur de chargement des listes : ', } });
{ "pile_set_name": "Github" }
/** * @author LinkedIn */ var expect = require('expect.js'), sinon = require('sinon'), coverage = require('../../../lib/coverage'), testHelper = require('../../lib/helpers'), testPath = require('../../lib/helpers').sampleTests, config = require('../../../lib/config'), path = require('path'), executor = require('../../../lib/executor'), testcase = require('../../../lib/testcase'), path = require('path'), fs = require('fs'); describe('lib/executor', function() { before(function () { config.cwd = testHelper.fakeCwd(); }); it('should not be modifiable', function() { executor.foo = 'bar'; expect(executor.foo).to.be(undefined); }); it('should parse testcases from test string correctly', function() { var exec = new executor.Executor(), tests = testPath( 'foo' ) + ',' + testPath( 'bar' ), result; result = exec.parseTests(tests); expect(result).to.be.ok(); expect(Object.keys(result).length).to.be(2); }); it('should handle parsing testcases from undefined test string', function() { var exec = new executor.Executor(), tests, result; result = exec.parseTests(tests); expect(result).to.be.ok(); expect(Object.keys(result).length).to.be(0); }); it('should handle tests being specified with a .js file extension', function() { var exec = new executor.Executor(), tests = testPath( 'foo.js' ), result = exec.parseTests(tests); expect(Object.keys(result).length).to.be(1); }); it('should fail when a specified test file or folder does not exist', function (){ var exec = new executor.Executor(), logger = sinon.stub(exec.logger,'error'), exit = sinon.stub(process, 'exit'), tests = testPath('bad_non_existent_file_path'); //Expect an exception and a call to process.exit expect(function() { exec.parseTests(tests); }).to.throwException(); expect(exit.calledOnce).to.be(true); //Restore stubs exit.restore(); logger.restore(); }); it('should enforce require annotations option by default', function () { var exec = new executor.Executor(), tests = testPath('require_annotations'), result; result = exec.parseTests(tests); expect(Object.keys(result).length).to.be(1); }); it('should not enforce require annotations option if specified', function () { var exec = new executor.Executor(), tests = testPath('require_annotations'), result; exec.requireTestAnnotations = false; result = exec.parseTests(tests); expect(Object.keys(result).length).to.be(2); }); it('should parse comments in test cases', function() { var exec = new executor.Executor(), tests = testPath( 'parse_comments' ), result = exec.parseTests(tests), first; first = Object.keys(result)[0]; expect(result).to.be.ok(); expect(result[first]).to.be.ok(); expect(result[first].annotations['venus-library']).to.be('mocha'); expect(result[first].annotations['venus-include'].length).to.be(2); expect(result[first].annotations['venus-include-group'].length).to.be(1); }); it('parseTestPaths should omit .venus folder', function() { var exec = new executor.Executor(), testPaths = [testPath('.venus')], result; result = exec.parseTestPaths(testPaths); expect(Object.keys(result).length).to.be(0); }); describe('specify hostname on command line', function () { var conf = testHelper.testConfig(), exec = new executor.Executor(conf), test = testPath('parse_comments'), options, url; options = { hostname: 'foobar.com', test: test, homeFolder: path.resolve(__dirname, '..', '..') }; it('should use the hostname specified on command line', function (done) { exec.init(options).then(function () { url = exec.testgroup.testArray[0].url.run; expect(url.indexOf('http://foobar.com')).to.be(0); done(); }); }); }); describe('specify hostname through config', function () { var exec = new executor.Executor(testHelper.testConfig()), test = testPath('parse_comments'), options, url; options = { test: test, homeFolder: path.resolve(__dirname, '..', '..') }; it('should use the hostname specified in config', function (done) { exec.init(options).then(function () { url = exec.testgroup.testArray[0].url.run; expect(url.indexOf('http://barfoo.com')).to.be(0); done(); }); }); }); describe('createTestObjects', function() { it('should create config file when called with single file', function() { var exec = new executor.Executor(), mock = sinon.mock(exec), test = testPath('foo.js'), testcaseMock = sinon.mock(testcase), configMock = sinon.mock(config), hostname = require('../../../lib/constants').hostname; // Expectations mock.expects('getNextTestId').once().returns(1); configMock.expects('getConfig').once().returns('configFile'); testcaseMock.expects('create').once().withExactArgs({ path: test, id: 1, runUrl: 'http://' + hostname + ':' + exec.port + exec.urlNamespace + '/1', runPath: exec.urlNamespace + '/1', instrumentCodeCoverate: exec.instrumentCodeCoverage, config: 'configFile', hotReload: true }); exec.createTestObjects([test]); // config.cwd is the dir of the file being tested expect(config.cwd).to.be(path.dirname(test)); // Verify expectations mock.verify(); configMock.verify(); testcaseMock.verify(); }); }); describe('shutdown', function() { beforeEach(function() { sinon.stub(coverage, 'writeSummary'); sinon.stub(process, 'exit'); }); afterEach(function() { coverage.writeSummary.restore(); process.exit.restore(); }); it('should exit with status 1 if there are errors', function() { var exec = new executor.Executor(); exec.testgroup = {}; exec.reporter = { errored: true, emit: sinon.spy() }; exec.shutdown(); expect(process.exit.args[0][0]).to.be(1); }); }); });
{ "pile_set_name": "Github" }
namespace PKHeX.Core.Searching { public enum CloneDetectionMethod { None, HashDetails, HashPID, } }
{ "pile_set_name": "Github" }
# query-string [![Build Status](https://travis-ci.com/sindresorhus/query-string.svg?branch=master)](https://travis-ci.com/github/sindresorhus/query-string) [![](https://badgen.net/bundlephobia/minzip/query-string)](https://bundlephobia.com/result?p=query-string) > Parse and stringify URL [query strings](https://en.wikipedia.org/wiki/Query_string) <br> --- <div align="center"> <p> <p> <sup> <a href="https://github.com/sponsors/sindresorhus">My open source work is supported by the community</a> </sup> </p> <sup>Special thanks to:</sup> <br> <br> <a href="https://standardresume.co"> <img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="200"/> </a> </p> </div> --- <br> ## Install ``` $ npm install query-string ``` This module targets Node.js 6 or later and the latest version of Chrome, Firefox, and Safari. If you want support for older browsers, or, if your project is using create-react-app v1, use version 5: `npm install query-string@5`. ## Usage ```js const queryString = require('query-string'); console.log(location.search); //=> '?foo=bar' const parsed = queryString.parse(location.search); console.log(parsed); //=> {foo: 'bar'} console.log(location.hash); //=> '#token=bada55cafe' const parsedHash = queryString.parse(location.hash); console.log(parsedHash); //=> {token: 'bada55cafe'} parsed.foo = 'unicorn'; parsed.ilike = 'pizza'; const stringified = queryString.stringify(parsed); //=> 'foo=unicorn&ilike=pizza' location.search = stringified; // note that `location.search` automatically prepends a question mark console.log(location.search); //=> '?foo=unicorn&ilike=pizza' ``` ## API ### .parse(string, options?) Parse a query string into an object. Leading `?` or `#` are ignored, so you can pass `location.search` or `location.hash` directly. The returned object is created with [`Object.create(null)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create) and thus does not have a `prototype`. #### options Type: `object` ##### decode Type: `boolean`\ Default: `true` Decode the keys and values. URL components are decoded with [`decode-uri-component`](https://github.com/SamVerschueren/decode-uri-component). ##### arrayFormat Type: `string`\ Default: `'none'` - `'bracket'`: Parse arrays with bracket representation: ```js const queryString = require('query-string'); queryString.parse('foo[]=1&foo[]=2&foo[]=3', {arrayFormat: 'bracket'}); //=> {foo: ['1', '2', '3']} ``` - `'index'`: Parse arrays with index representation: ```js const queryString = require('query-string'); queryString.parse('foo[0]=1&foo[1]=2&foo[3]=3', {arrayFormat: 'index'}); //=> {foo: ['1', '2', '3']} ``` - `'comma'`: Parse arrays with elements separated by comma: ```js const queryString = require('query-string'); queryString.parse('foo=1,2,3', {arrayFormat: 'comma'}); //=> {foo: ['1', '2', '3']} ``` - `'separator'`: Parse arrays with elements separated by a custom character: ```js const queryString = require('query-string'); queryString.parse('foo=1|2|3', {arrayFormat: 'separator', arrayFormatSeparator: '|'}); //=> {foo: ['1', '2', '3']} ``` - `'none'`: Parse arrays with elements using duplicate keys: ```js const queryString = require('query-string'); queryString.parse('foo=1&foo=2&foo=3'); //=> {foo: ['1', '2', '3']} ``` ##### arrayFormatSeparator Type: `string`\ Default: `','` The character used to separate array elements when using `{arrayFormat: 'separator'}`. ##### sort Type: `Function | boolean`\ Default: `true` Supports both `Function` as a custom sorting function or `false` to disable sorting. ##### parseNumbers Type: `boolean`\ Default: `false` ```js const queryString = require('query-string'); queryString.parse('foo=1', {parseNumbers: true}); //=> {foo: 1} ``` Parse the value as a number type instead of string type if it's a number. ##### parseBooleans Type: `boolean`\ Default: `false` ```js const queryString = require('query-string'); queryString.parse('foo=true', {parseBooleans: true}); //=> {foo: true} ``` Parse the value as a boolean type instead of string type if it's a boolean. ### .stringify(object, options?) Stringify an object into a query string and sorting the keys. #### options Type: `object` ##### strict Type: `boolean`\ Default: `true` Strictly encode URI components with [strict-uri-encode](https://github.com/kevva/strict-uri-encode). It uses [encodeURIComponent](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) if set to false. You probably [don't care](https://github.com/sindresorhus/query-string/issues/42) about this option. ##### encode Type: `boolean`\ Default: `true` [URL encode](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) the keys and values. ##### arrayFormat Type: `string`\ Default: `'none'` - `'bracket'`: Serialize arrays using bracket representation: ```js const queryString = require('query-string'); queryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'bracket'}); //=> 'foo[]=1&foo[]=2&foo[]=3' ``` - `'index'`: Serialize arrays using index representation: ```js const queryString = require('query-string'); queryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'index'}); //=> 'foo[0]=1&foo[1]=2&foo[2]=3' ``` - `'comma'`: Serialize arrays by separating elements with comma: ```js const queryString = require('query-string'); queryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'comma'}); //=> 'foo=1,2,3' ``` - `'none'`: Serialize arrays by using duplicate keys: ```js const queryString = require('query-string'); queryString.stringify({foo: [1, 2, 3]}); //=> 'foo=1&foo=2&foo=3' ``` ##### arrayFormatSeparator Type: `string`\ Default: `','` The character used to separate array elements when using `{arrayFormat: 'separator'}`. ##### sort Type: `Function | boolean` Supports both `Function` as a custom sorting function or `false` to disable sorting. ```js const queryString = require('query-string'); const order = ['c', 'a', 'b']; queryString.stringify({a: 1, b: 2, c: 3}, { sort: (a, b) => order.indexOf(a) - order.indexOf(b) }); //=> 'c=3&a=1&b=2' ``` ```js const queryString = require('query-string'); queryString.stringify({b: 1, c: 2, a: 3}, {sort: false}); //=> 'b=1&c=2&a=3' ``` If omitted, keys are sorted using `Array#sort()`, which means, converting them to strings and comparing strings in Unicode code point order. ##### skipNull Skip keys with `null` as the value. Note that keys with `undefined` as the value are always skipped. Type: `boolean`\ Default: `false` ```js const queryString = require('query-string'); queryString.stringify({a: 1, b: undefined, c: null, d: 4}, { skipNull: true }); //=> 'a=1&d=4' ``` ```js const queryString = require('query-string'); queryString.stringify({a: undefined, b: null}, { skipNull: true }); //=> '' ``` ##### skipEmptyString Skip keys with an empty string as the value. Type: `boolean`\ Default: `false` ```js const queryString = require('query-string'); queryString.stringify({a: 1, b: '', c: '', d: 4}, { skipEmptyString: true }); //=> 'a=1&d=4' ``` ```js const queryString = require('query-string'); queryString.stringify({a: '', b: ''}, { skipEmptyString: true }); //=> '' ``` ### .extract(string) Extract a query string from a URL that can be passed into `.parse()`. Note: This behaviour can be changed with the `skipNull` option. ### .parseUrl(string, options?) Extract the URL and the query string as an object. Returns an object with a `url` and `query` property. If the `parseFragmentIdentifier` option is `true`, the object will also contain a `fragmentIdentifier` property. ```js const queryString = require('query-string'); queryString.parseUrl('https://foo.bar?foo=bar'); //=> {url: 'https://foo.bar', query: {foo: 'bar'}} queryString.parseUrl('https://foo.bar?foo=bar#xyz', {parseFragmentIdentifier: true}); //=> {url: 'https://foo.bar', query: {foo: 'bar'}, fragmentIdentifier: 'xyz'} ``` #### options Type: `object` The options are the same as for `.parse()`. Extra options are as below. ##### parseFragmentIdentifier Parse the fragment identifier from the URL. Type: `boolean`\ Default: `false` ```js const queryString = require('query-string'); queryString.parseUrl('https://foo.bar?foo=bar#xyz', {parseFragmentIdentifier: true}); //=> {url: 'https://foo.bar', query: {foo: 'bar'}, fragmentIdentifier: 'xyz'} ``` ### .stringifyUrl(object, options?) Stringify an object into a URL with a query string and sorting the keys. The inverse of [`.parseUrl()`](https://github.com/sindresorhus/query-string#parseurlstring-options) The `options` are the same as for `.stringify()`. Returns a string with the URL and a query string. Query items in the `query` property overrides queries in the `url` property. The `fragmentIdentifier` property overrides the fragment identifier in the `url` property. ```js queryString.stringifyUrl({url: 'https://foo.bar', query: {foo: 'bar'}}); //=> 'https://foo.bar?foo=bar' queryString.stringifyUrl({url: 'https://foo.bar?foo=baz', query: {foo: 'bar'}}); //=> 'https://foo.bar?foo=bar' queryString.stringifyUrl({ url: 'https://foo.bar', query: { top: 'foo' }, fragmentIdentifier: 'bar' }); //=> 'https://foo.bar?top=foo#bar' ``` #### object Type: `object` ##### url Type: `string` The URL to stringify. ##### query Type: `object` Query items to add to the URL. ## Nesting This module intentionally doesn't support nesting as it's not spec'd and varies between implementations, which causes a lot of [edge cases](https://github.com/visionmedia/node-querystring/issues). You're much better off just converting the object to a JSON string: ```js const queryString = require('query-string'); queryString.stringify({ foo: 'bar', nested: JSON.stringify({ unicorn: 'cake' }) }); //=> 'foo=bar&nested=%7B%22unicorn%22%3A%22cake%22%7D' ``` However, there is support for multiple instances of the same key: ```js const queryString = require('query-string'); queryString.parse('likes=cake&name=bob&likes=icecream'); //=> {likes: ['cake', 'icecream'], name: 'bob'} queryString.stringify({color: ['taupe', 'chartreuse'], id: '515'}); //=> 'color=taupe&color=chartreuse&id=515' ``` ## Falsy values Sometimes you want to unset a key, or maybe just make it present without assigning a value to it. Here is how falsy values are stringified: ```js const queryString = require('query-string'); queryString.stringify({foo: false}); //=> 'foo=false' queryString.stringify({foo: null}); //=> 'foo' queryString.stringify({foo: undefined}); //=> '' ``` ## query-string for enterprise Available as part of the Tidelift Subscription. The maintainers of query-string and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-query-string?utm_source=npm-query-string&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
{ "pile_set_name": "Github" }
if (Boolean()) {} for (; Boolean();) { console.log('a'); console.log('b'); } while (Boolean()) { console.log('a'); console.log('b'); } do {} while (Boolean()); if (Boolean()) console.log('a'); if (Boolean()) {class C {}} if (Boolean()) { console.log('a'); console.log('b'); } let foo = 1; if (Boolean()) { console.log(foo); { const foo = 1; console.log(foo); } } if (Boolean()) { { const foo = 1; // TODO doesn't shadow a variable in the outer scope console.log(foo); } } label: {}
{ "pile_set_name": "Github" }
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2016 The Go Authors. All rights reserved. // https://github.com/golang/protobuf // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package ptypes // This file implements operations on google.protobuf.Timestamp. import ( "errors" "fmt" "time" tspb "github.com/golang/protobuf/ptypes/timestamp" ) const ( // Seconds field of the earliest valid Timestamp. // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). minValidSeconds = -62135596800 // Seconds field just after the latest valid Timestamp. // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix(). maxValidSeconds = 253402300800 ) // validateTimestamp determines whether a Timestamp is valid. // A valid timestamp represents a time in the range // [0001-01-01, 10000-01-01) and has a Nanos field // in the range [0, 1e9). // // If the Timestamp is valid, validateTimestamp returns nil. // Otherwise, it returns an error that describes // the problem. // // Every valid Timestamp can be represented by a time.Time, but the converse is not true. func validateTimestamp(ts *tspb.Timestamp) error { if ts == nil { return errors.New("timestamp: nil Timestamp") } if ts.Seconds < minValidSeconds { return fmt.Errorf("timestamp: %v before 0001-01-01", ts) } if ts.Seconds >= maxValidSeconds { return fmt.Errorf("timestamp: %v after 10000-01-01", ts) } if ts.Nanos < 0 || ts.Nanos >= 1e9 { return fmt.Errorf("timestamp: %v: nanos not in range [0, 1e9)", ts) } return nil } // Timestamp converts a google.protobuf.Timestamp proto to a time.Time. // It returns an error if the argument is invalid. // // Unlike most Go functions, if Timestamp returns an error, the first return value // is not the zero time.Time. Instead, it is the value obtained from the // time.Unix function when passed the contents of the Timestamp, in the UTC // locale. This may or may not be a meaningful time; many invalid Timestamps // do map to valid time.Times. // // A nil Timestamp returns an error. The first return value in that case is // undefined. func Timestamp(ts *tspb.Timestamp) (time.Time, error) { // Don't return the zero value on error, because corresponds to a valid // timestamp. Instead return whatever time.Unix gives us. var t time.Time if ts == nil { t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp } else { t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC() } return t, validateTimestamp(ts) } // TimestampNow returns a google.protobuf.Timestamp for the current time. func TimestampNow() *tspb.Timestamp { ts, err := TimestampProto(time.Now()) if err != nil { panic("ptypes: time.Now() out of Timestamp range") } return ts } // TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. // It returns an error if the resulting Timestamp is invalid. func TimestampProto(t time.Time) (*tspb.Timestamp, error) { ts := &tspb.Timestamp{ Seconds: t.Unix(), Nanos: int32(t.Nanosecond()), } if err := validateTimestamp(ts); err != nil { return nil, err } return ts, nil } // TimestampString returns the RFC 3339 string for valid Timestamps. For invalid // Timestamps, it returns an error message in parentheses. func TimestampString(ts *tspb.Timestamp) string { t, err := Timestamp(ts) if err != nil { return fmt.Sprintf("(%v)", err) } return t.Format(time.RFC3339Nano) }
{ "pile_set_name": "Github" }
using System; public static class MaxIncreasingSequence { /// <summary> /// This function printing subsequances of smaller elements before this of the pointed index /// </summary> /// <param name="arr">The array in which we search</param> /// <param name="index">Index of element before which to search</param> public static void PrintSequenceAtIndex(this int[] arr, int index) { int prevIndex = index; Console.Write(arr[index] + " "); // Back iterating to the elements for (; index >= 0; index--) { // Check if there is smaller element from the last found if (arr[index] < arr[prevIndex]) { Console.Write(arr[index] + " "); prevIndex = index; // Save the index of the new last element } } } static void Main() { int[] arr = { 9, 6, 2, 7, 4, 7, 5, 6, 7, 8, 4 }; int[] len = new int[arr.Length]; Console.WriteLine("Array: {0}", string.Join(", ", arr)); Console.WriteLine(); len[0] = 1; int indexOfBiggestSubset = 0; for (int x = 0; x < arr.Length; x++) { Console.WriteLine("{0}: At element {1}", x, arr[x]); // At first the max length is 1 len[x] = 1; // Search in previous elements for smaller value for (int i = 0; i < x; i++) { // The first check finds smaller element and second - check if can be // formed with this element bigger subsequence from the existed if (arr[i] < arr[x]) { if (len[i] + 1 > len[x]) { // Save the length of found subsequence of x with element 'i' len[x] = len[i] + 1; } // How works the code: Console.WriteLine("Found smaller element: {0} -> {1}", arr[x], arr[i]); Console.WriteLine("The new sequence is {0} with the sequence at {1}", arr[x], arr[i]); Console.Write("Sequence: {0} ", arr[x]); arr.PrintSequenceAtIndex(i); Console.WriteLine(); Console.WriteLine(); } } // Check if this is the biggest subsequence until now if (len[x] > len[indexOfBiggestSubset]) { indexOfBiggestSubset = x; } Console.WriteLine(); } Console.WriteLine("All sequences found:"); for (int i = 0; i < arr.Length; i++) { Console.Write("{0}: number: {1} - lenght: {2} sequence: ", i, arr[i], len[i]); arr.PrintSequenceAtIndex(i); Console.WriteLine(); } Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Longest sequence: "); arr.PrintSequenceAtIndex(indexOfBiggestSubset); Console.ReadKey(); } }
{ "pile_set_name": "Github" }
MACRO(ST_SET_DEFAULT_BUILD_TYPE TYPE_) IF(NOT CMAKE_BUILD_TYPE AND NOT DEFAULT_BUILD_TYPE_SET) SET(DEFAULT_BUILD_TYPE_SET TRUE CACHE INTERNAL "" FORCE) SET( CMAKE_BUILD_TYPE "${TYPE_}" CACHE STRING "Build type (Release Debug RelWithDebInfo MinSizeRel)" FORCE ) ENDIF(NOT CMAKE_BUILD_TYPE AND NOT DEFAULT_BUILD_TYPE_SET) ENDMACRO(ST_SET_DEFAULT_BUILD_TYPE)
{ "pile_set_name": "Github" }
#ifndef BOOST_THREAD_PTHREAD_ONCE_HPP #define BOOST_THREAD_PTHREAD_ONCE_HPP // once.hpp // // (C) Copyright 2007-8 Anthony Williams // (C) Copyright 2011-2012 Vicente J. Botet Escriba // // 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) #include <boost/thread/detail/config.hpp> #include <boost/thread/detail/move.hpp> #include <boost/thread/detail/invoke.hpp> #include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp> #include <boost/thread/detail/delete.hpp> #include <boost/core/no_exceptions_support.hpp> #include <boost/bind.hpp> #include <boost/assert.hpp> #include <boost/config/abi_prefix.hpp> #include <boost/cstdint.hpp> #include <pthread.h> #include <csignal> namespace boost { struct once_flag; #define BOOST_ONCE_INITIAL_FLAG_VALUE 0 namespace thread_detail { typedef boost::uint32_t uintmax_atomic_t; #define BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_C2(value) value##u #define BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_C2(~0) } #ifdef BOOST_THREAD_PROVIDES_ONCE_CXX11 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template<typename Function, class ...ArgTypes> inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args); #else template<typename Function> inline void call_once(once_flag& flag, Function f); template<typename Function, typename T1> inline void call_once(once_flag& flag, Function f, T1 p1); template<typename Function, typename T1, typename T2> inline void call_once(once_flag& flag, Function f, T1 p1, T2 p2); template<typename Function, typename T1, typename T2, typename T3> inline void call_once(once_flag& flag, Function f, T1 p1, T2 p2, T3 p3); #endif struct once_flag { BOOST_THREAD_NO_COPYABLE(once_flag) BOOST_CONSTEXPR once_flag() BOOST_NOEXCEPT : epoch(BOOST_ONCE_INITIAL_FLAG_VALUE) {} private: volatile thread_detail::uintmax_atomic_t epoch; #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template<typename Function, class ...ArgTypes> friend void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args); #else template<typename Function> friend void call_once(once_flag& flag, Function f); template<typename Function, typename T1> friend void call_once(once_flag& flag, Function f, T1 p1); template<typename Function, typename T1, typename T2> friend void call_once(once_flag& flag, Function f, T1 p1, T2 p2); template<typename Function, typename T1, typename T2, typename T3> friend void call_once(once_flag& flag, Function f, T1 p1, T2 p2, T3 p3); #endif }; #define BOOST_ONCE_INIT once_flag() #else // BOOST_THREAD_PROVIDES_ONCE_CXX11 struct once_flag { volatile thread_detail::uintmax_atomic_t epoch; }; #define BOOST_ONCE_INIT {BOOST_ONCE_INITIAL_FLAG_VALUE} #endif // BOOST_THREAD_PROVIDES_ONCE_CXX11 #if defined BOOST_THREAD_PROVIDES_INVOKE #define BOOST_THREAD_INVOKE_RET_VOID detail::invoke #define BOOST_THREAD_INVOKE_RET_VOID_CALL #elif defined BOOST_THREAD_PROVIDES_INVOKE_RET #define BOOST_THREAD_INVOKE_RET_VOID detail::invoke<void> #define BOOST_THREAD_INVOKE_RET_VOID_CALL #else #define BOOST_THREAD_INVOKE_RET_VOID boost::bind #define BOOST_THREAD_INVOKE_RET_VOID_CALL () #endif namespace thread_detail { BOOST_THREAD_DECL uintmax_atomic_t& get_once_per_thread_epoch(); BOOST_THREAD_DECL extern uintmax_atomic_t once_global_epoch; BOOST_THREAD_DECL extern pthread_mutex_t once_epoch_mutex; BOOST_THREAD_DECL extern pthread_cond_t once_epoch_cv; } // Based on Mike Burrows fast_pthread_once algorithm as described in // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2444.html #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template<typename Function, class ...ArgTypes> inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(ArgTypes)... args) { static thread_detail::uintmax_atomic_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE; static thread_detail::uintmax_atomic_t const being_initialized=uninitialized_flag+1; thread_detail::uintmax_atomic_t const epoch=flag.epoch; thread_detail::uintmax_atomic_t& this_thread_epoch=thread_detail::get_once_per_thread_epoch(); if(epoch<this_thread_epoch) { pthread::pthread_mutex_scoped_lock lk(&thread_detail::once_epoch_mutex); while(flag.epoch<=being_initialized) { if(flag.epoch==uninitialized_flag) { flag.epoch=being_initialized; BOOST_TRY { pthread::pthread_mutex_scoped_unlock relocker(&thread_detail::once_epoch_mutex); BOOST_THREAD_INVOKE_RET_VOID( thread_detail::decay_copy(boost::forward<Function>(f)), thread_detail::decay_copy(boost::forward<ArgTypes>(args))... ) BOOST_THREAD_INVOKE_RET_VOID_CALL; } BOOST_CATCH (...) { flag.epoch=uninitialized_flag; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); BOOST_RETHROW } BOOST_CATCH_END flag.epoch=--thread_detail::once_global_epoch; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); } else { while(flag.epoch==being_initialized) { BOOST_VERIFY(!pthread_cond_wait(&thread_detail::once_epoch_cv,&thread_detail::once_epoch_mutex)); } } } this_thread_epoch=thread_detail::once_global_epoch; } } #else template<typename Function> inline void call_once(once_flag& flag, Function f) { static thread_detail::uintmax_atomic_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE; static thread_detail::uintmax_atomic_t const being_initialized=uninitialized_flag+1; thread_detail::uintmax_atomic_t const epoch=flag.epoch; thread_detail::uintmax_atomic_t& this_thread_epoch=thread_detail::get_once_per_thread_epoch(); if(epoch<this_thread_epoch) { pthread::pthread_mutex_scoped_lock lk(&thread_detail::once_epoch_mutex); while(flag.epoch<=being_initialized) { if(flag.epoch==uninitialized_flag) { flag.epoch=being_initialized; BOOST_TRY { pthread::pthread_mutex_scoped_unlock relocker(&thread_detail::once_epoch_mutex); f(); } BOOST_CATCH (...) { flag.epoch=uninitialized_flag; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); BOOST_RETHROW } BOOST_CATCH_END flag.epoch=--thread_detail::once_global_epoch; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); } else { while(flag.epoch==being_initialized) { BOOST_VERIFY(!pthread_cond_wait(&thread_detail::once_epoch_cv,&thread_detail::once_epoch_mutex)); } } } this_thread_epoch=thread_detail::once_global_epoch; } } template<typename Function, typename T1> inline void call_once(once_flag& flag, Function f, T1 p1) { static thread_detail::uintmax_atomic_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE; static thread_detail::uintmax_atomic_t const being_initialized=uninitialized_flag+1; thread_detail::uintmax_atomic_t const epoch=flag.epoch; thread_detail::uintmax_atomic_t& this_thread_epoch=thread_detail::get_once_per_thread_epoch(); if(epoch<this_thread_epoch) { pthread::pthread_mutex_scoped_lock lk(&thread_detail::once_epoch_mutex); while(flag.epoch<=being_initialized) { if(flag.epoch==uninitialized_flag) { flag.epoch=being_initialized; BOOST_TRY { pthread::pthread_mutex_scoped_unlock relocker(&thread_detail::once_epoch_mutex); BOOST_THREAD_INVOKE_RET_VOID(f,p1) BOOST_THREAD_INVOKE_RET_VOID_CALL; } BOOST_CATCH (...) { flag.epoch=uninitialized_flag; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); BOOST_RETHROW } BOOST_CATCH_END flag.epoch=--thread_detail::once_global_epoch; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); } else { while(flag.epoch==being_initialized) { BOOST_VERIFY(!pthread_cond_wait(&thread_detail::once_epoch_cv,&thread_detail::once_epoch_mutex)); } } } this_thread_epoch=thread_detail::once_global_epoch; } } template<typename Function, typename T1, typename T2> inline void call_once(once_flag& flag, Function f, T1 p1, T2 p2) { static thread_detail::uintmax_atomic_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE; static thread_detail::uintmax_atomic_t const being_initialized=uninitialized_flag+1; thread_detail::uintmax_atomic_t const epoch=flag.epoch; thread_detail::uintmax_atomic_t& this_thread_epoch=thread_detail::get_once_per_thread_epoch(); if(epoch<this_thread_epoch) { pthread::pthread_mutex_scoped_lock lk(&thread_detail::once_epoch_mutex); while(flag.epoch<=being_initialized) { if(flag.epoch==uninitialized_flag) { flag.epoch=being_initialized; BOOST_TRY { pthread::pthread_mutex_scoped_unlock relocker(&thread_detail::once_epoch_mutex); BOOST_THREAD_INVOKE_RET_VOID(f,p1, p2) BOOST_THREAD_INVOKE_RET_VOID_CALL; } BOOST_CATCH (...) { flag.epoch=uninitialized_flag; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); BOOST_RETHROW } BOOST_CATCH_END flag.epoch=--thread_detail::once_global_epoch; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); } else { while(flag.epoch==being_initialized) { BOOST_VERIFY(!pthread_cond_wait(&thread_detail::once_epoch_cv,&thread_detail::once_epoch_mutex)); } } } this_thread_epoch=thread_detail::once_global_epoch; } } template<typename Function, typename T1, typename T2, typename T3> inline void call_once(once_flag& flag, Function f, T1 p1, T2 p2, T3 p3) { static thread_detail::uintmax_atomic_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE; static thread_detail::uintmax_atomic_t const being_initialized=uninitialized_flag+1; thread_detail::uintmax_atomic_t const epoch=flag.epoch; thread_detail::uintmax_atomic_t& this_thread_epoch=thread_detail::get_once_per_thread_epoch(); if(epoch<this_thread_epoch) { pthread::pthread_mutex_scoped_lock lk(&thread_detail::once_epoch_mutex); while(flag.epoch<=being_initialized) { if(flag.epoch==uninitialized_flag) { flag.epoch=being_initialized; BOOST_TRY { pthread::pthread_mutex_scoped_unlock relocker(&thread_detail::once_epoch_mutex); BOOST_THREAD_INVOKE_RET_VOID(f,p1, p2, p3) BOOST_THREAD_INVOKE_RET_VOID_CALL; } BOOST_CATCH (...) { flag.epoch=uninitialized_flag; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); BOOST_RETHROW } BOOST_CATCH_END flag.epoch=--thread_detail::once_global_epoch; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); } else { while(flag.epoch==being_initialized) { BOOST_VERIFY(!pthread_cond_wait(&thread_detail::once_epoch_cv,&thread_detail::once_epoch_mutex)); } } } this_thread_epoch=thread_detail::once_global_epoch; } } template<typename Function> inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f) { static thread_detail::uintmax_atomic_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE; static thread_detail::uintmax_atomic_t const being_initialized=uninitialized_flag+1; thread_detail::uintmax_atomic_t const epoch=flag.epoch; thread_detail::uintmax_atomic_t& this_thread_epoch=thread_detail::get_once_per_thread_epoch(); if(epoch<this_thread_epoch) { pthread::pthread_mutex_scoped_lock lk(&thread_detail::once_epoch_mutex); while(flag.epoch<=being_initialized) { if(flag.epoch==uninitialized_flag) { flag.epoch=being_initialized; BOOST_TRY { pthread::pthread_mutex_scoped_unlock relocker(&thread_detail::once_epoch_mutex); f(); } BOOST_CATCH (...) { flag.epoch=uninitialized_flag; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); BOOST_RETHROW } BOOST_CATCH_END flag.epoch=--thread_detail::once_global_epoch; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); } else { while(flag.epoch==being_initialized) { BOOST_VERIFY(!pthread_cond_wait(&thread_detail::once_epoch_cv,&thread_detail::once_epoch_mutex)); } } } this_thread_epoch=thread_detail::once_global_epoch; } } template<typename Function, typename T1> inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(T1) p1) { static thread_detail::uintmax_atomic_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE; static thread_detail::uintmax_atomic_t const being_initialized=uninitialized_flag+1; thread_detail::uintmax_atomic_t const epoch=flag.epoch; thread_detail::uintmax_atomic_t& this_thread_epoch=thread_detail::get_once_per_thread_epoch(); if(epoch<this_thread_epoch) { pthread::pthread_mutex_scoped_lock lk(&thread_detail::once_epoch_mutex); while(flag.epoch<=being_initialized) { if(flag.epoch==uninitialized_flag) { flag.epoch=being_initialized; BOOST_TRY { pthread::pthread_mutex_scoped_unlock relocker(&thread_detail::once_epoch_mutex); BOOST_THREAD_INVOKE_RET_VOID( thread_detail::decay_copy(boost::forward<Function>(f)), thread_detail::decay_copy(boost::forward<T1>(p1)) ) BOOST_THREAD_INVOKE_RET_VOID_CALL; } BOOST_CATCH (...) { flag.epoch=uninitialized_flag; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); BOOST_RETHROW } BOOST_CATCH_END flag.epoch=--thread_detail::once_global_epoch; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); } else { while(flag.epoch==being_initialized) { BOOST_VERIFY(!pthread_cond_wait(&thread_detail::once_epoch_cv,&thread_detail::once_epoch_mutex)); } } } this_thread_epoch=thread_detail::once_global_epoch; } } template<typename Function, typename T1, typename T2> inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(T1) p1, BOOST_THREAD_RV_REF(T2) p2) { static thread_detail::uintmax_atomic_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE; static thread_detail::uintmax_atomic_t const being_initialized=uninitialized_flag+1; thread_detail::uintmax_atomic_t const epoch=flag.epoch; thread_detail::uintmax_atomic_t& this_thread_epoch=thread_detail::get_once_per_thread_epoch(); if(epoch<this_thread_epoch) { pthread::pthread_mutex_scoped_lock lk(&thread_detail::once_epoch_mutex); while(flag.epoch<=being_initialized) { if(flag.epoch==uninitialized_flag) { flag.epoch=being_initialized; BOOST_TRY { pthread::pthread_mutex_scoped_unlock relocker(&thread_detail::once_epoch_mutex); BOOST_THREAD_INVOKE_RET_VOID( thread_detail::decay_copy(boost::forward<Function>(f)), thread_detail::decay_copy(boost::forward<T1>(p1)), thread_detail::decay_copy(boost::forward<T1>(p2)) ) BOOST_THREAD_INVOKE_RET_VOID_CALL; } BOOST_CATCH (...) { flag.epoch=uninitialized_flag; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); BOOST_RETHROW } BOOST_CATCH_END flag.epoch=--thread_detail::once_global_epoch; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); } else { while(flag.epoch==being_initialized) { BOOST_VERIFY(!pthread_cond_wait(&thread_detail::once_epoch_cv,&thread_detail::once_epoch_mutex)); } } } this_thread_epoch=thread_detail::once_global_epoch; } } template<typename Function, typename T1, typename T2, typename T3> inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f, BOOST_THREAD_RV_REF(T1) p1, BOOST_THREAD_RV_REF(T2) p2, BOOST_THREAD_RV_REF(T3) p3) { static thread_detail::uintmax_atomic_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE; static thread_detail::uintmax_atomic_t const being_initialized=uninitialized_flag+1; thread_detail::uintmax_atomic_t const epoch=flag.epoch; thread_detail::uintmax_atomic_t& this_thread_epoch=thread_detail::get_once_per_thread_epoch(); if(epoch<this_thread_epoch) { pthread::pthread_mutex_scoped_lock lk(&thread_detail::once_epoch_mutex); while(flag.epoch<=being_initialized) { if(flag.epoch==uninitialized_flag) { flag.epoch=being_initialized; BOOST_TRY { pthread::pthread_mutex_scoped_unlock relocker(&thread_detail::once_epoch_mutex); BOOST_THREAD_INVOKE_RET_VOID( thread_detail::decay_copy(boost::forward<Function>(f)), thread_detail::decay_copy(boost::forward<T1>(p1)), thread_detail::decay_copy(boost::forward<T1>(p2)), thread_detail::decay_copy(boost::forward<T1>(p3)) ) BOOST_THREAD_INVOKE_RET_VOID_CALL; } BOOST_CATCH (...) { flag.epoch=uninitialized_flag; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); BOOST_RETHROW } BOOST_CATCH_END flag.epoch=--thread_detail::once_global_epoch; BOOST_VERIFY(!pthread_cond_broadcast(&thread_detail::once_epoch_cv)); } else { while(flag.epoch==being_initialized) { BOOST_VERIFY(!pthread_cond_wait(&thread_detail::once_epoch_cv,&thread_detail::once_epoch_mutex)); } } } this_thread_epoch=thread_detail::once_global_epoch; } } #endif } #include <boost/config/abi_suffix.hpp> #endif
{ "pile_set_name": "Github" }
var hid_8c = [ [ "hidAccelRead", "hid_8c.html#adb6764e07c888b3094ad32b09071efe9", null ], [ "hidCheckSectionUpdateTime", "hid_8c.html#ab1f55e81030b9782c47ef7664be8c948", null ], [ "hidCircleRead", "hid_8c.html#a54c0f28a80c0bac4d16afbb7fd06c49b", null ], [ "hidExit", "hid_8c.html#a7784294ec63d4f8c781b269b6d9cde90", null ], [ "hidGyroRead", "hid_8c.html#a4c1997053e9484b870e03ed163ae4f09", null ], [ "hidInit", "hid_8c.html#afc602450fb88cb918394d8873f203242", null ], [ "hidKeysDown", "hid_8c.html#a5241e5eaffb18758228c278b8c1c0f89", null ], [ "hidKeysHeld", "hid_8c.html#aaf5a91f50a1b7c789a4eb1602104f750", null ], [ "hidKeysUp", "hid_8c.html#ad9bb845986bad46e1cb08c2b9faadaff", null ], [ "hidScanInput", "hid_8c.html#a693176942033ed9b75e4c1525a152d46", null ], [ "hidTouchRead", "hid_8c.html#acbeb326bdd6790f15684c70908403bb8", null ], [ "HIDUSER_DisableAccelerometer", "hid_8c.html#a3e6363d53ab98c16ce9de5764f431bbb", null ], [ "HIDUSER_DisableGyroscope", "hid_8c.html#a5fcf3d0905261cea6b023432e7cbd91d", null ], [ "HIDUSER_EnableAccelerometer", "hid_8c.html#a524f2b7f49966a99c36ad5a60ac26e6b", null ], [ "HIDUSER_EnableGyroscope", "hid_8c.html#af761ebd89db6396ce726b4685f69f616", null ], [ "HIDUSER_GetHandles", "hid_8c.html#a8a9406b839e0a81f25216edee4ca5244", null ], [ "hidWaitForEvent", "hid_8c.html#aedaa5be3b6bcf878907c11d76dc545a3", null ], [ "hidEvents", "hid_8c.html#a61a00d51454b43305db17449b0bd07b6", null ], [ "hidHandle", "hid_8c.html#af0bb5727f93730491c583d50aec8f39c", null ], [ "hidMemHandle", "hid_8c.html#a3d4f4dbade7cf795ae547e57cc65fae3", null ], [ "hidSharedMem", "hid_8c.html#ace06068f77e18a81596565ee45fbc68e", null ] ];
{ "pile_set_name": "Github" }
#pragma once #ifndef SESSION_H_5KG6ZMAB #define SESSION_H_5KG6ZMAB #include "asio.hpp" #include <memory> #include <vector> #include "rpc/config.h" #include "rpc/msgpack.hpp" #include "rpc/dispatcher.h" #include "rpc/detail/async_writer.h" #include "rpc/detail/log.h" namespace rpc { class server; namespace detail { class server_session : public async_writer { public: server_session(server *srv, RPCLIB_ASIO::io_service *io, RPCLIB_ASIO::ip::tcp::socket socket, std::shared_ptr<dispatcher> disp, bool suppress_exceptions); void start(); void close(); private: void do_read(); private: server* parent_; RPCLIB_ASIO::io_service *io_; RPCLIB_ASIO::strand read_strand_; std::shared_ptr<dispatcher> disp_; RPCLIB_MSGPACK::unpacker pac_; RPCLIB_MSGPACK::sbuffer output_buf_; const bool suppress_exceptions_; RPCLIB_CREATE_LOG_CHANNEL(session) }; } /* detail */ } /* rpc */ #endif /* end of include guard: SESSION_H_5KG6ZMAB */
{ "pile_set_name": "Github" }
{%- extends 'index.html' -%} {%- block body -%} {% if session.get('post-preview') %} {% set post_title = session['post-preview'].get('title', None) %} {% set post_preview = session['post-preview'].get('preview', None) %} {% set post_body = session['post-preview'].get('body', None) %} {% set post_tags = session['post-preview'].get('tags', None) %} {% else %} {% set post_title = '' %} {% set post_preview = '' %} {% set post_body = '' %} {% set post_tags = '' %} {% endif %} <div class="post clearfix"> <div class="row"> <div class="col-lg-8"> <div class="page-header"> <h1>New post</h1> </div> <div class="content"> {%- with messages = get_flashed_messages(with_categories=True) -%} {%- if messages -%} {%- for category, message in messages -%} <div class="response"> <span class="message {{ category }}">{%- if category == 'success' -%}✔{%- endif -%}&nbsp;{{ message }}</span> </div> {%- endfor -%} {%- endif -%} {%- endwith -%} <form id="post-form" role="form" method="post" action="{{ url_for('new_post') }}"> <div class="form-group {% if error and error_type == 'validate' %} has-error{% endif %}"> {%- if error and error_type == 'validate' -%} <label class="control-label" for="post-title">Required field</label> {%- endif -%} <input type="text" class="form-control" name="post-title" id="post-title" placeholder="Post Title" value="{{ post_title | safe }}" required> </div> <div class="form-group"> <textarea id="post-short" name="post-short" class="form-control" rows="3" placeholder="Short Text">{{ post_preview | safe }}</textarea> </div> <div class="form-group {% if error and error_type == 'validate' %} has-error{% endif %}"> {%- if error and error_type == 'validate' -%} <label class="control-label" for="post-full">Required field</label> {%- endif -%} <textarea id="post-full" name="post-full" class="form-control" rows="6" placeholder="Full Text" required>{{ post_body | safe }}</textarea> </div> <div class="form-group"> <label for="post-tags">Tags</label> <input type="text" name="post-tags" class="form-control" id="post-tags" placeholder="Comma separated" value="{{ ','.join(post_tags) }}"> </div> <div class="form-group"> <input type="hidden" name="post-preview" id="preview"> <input name="_csrf_token" type="hidden" value="{{ csrf_token() }}"> <input id="post-submit" type="submit" class="btn btn-primary" value="Submit"> <input id="post-preview" type="submit" class="btn" value="Preview"> </div> </form> </div> </div> </div> </div> {%- endblock -%} {%- block scripts -%} <script src="//codeorigin.jquery.com/jquery-2.0.3.min.js"></script> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="{{ url_for('static', filename='js/a-tools.js') }}"></script> <script src="{{ url_for('static', filename='js/showdown.js') }}"></script> <script src="{{ url_for('static', filename='js/mdmagick.js') }}"></script> <script src="{{ url_for('static', filename='js/main.js') }}"></script> {%- endblock -%}
{ "pile_set_name": "Github" }
import Vue from 'vue' import Router from 'vue-router' import Login from '../components/Login/Login.vue'; import Chatting from '../components/Chatting/Chatting.vue'; import AI from '../components/Chatting/AI.vue'; Vue.use(Router) const router = new Router({ routes: [ { path: '/', name: 'Login', component: Login }, { path: '/chatting', name: 'Chatting', component: Chatting, // beforeEnter: (to, from, next) => { // console.log('router', Math.random()); // next(); // } }, { path: '/AI', name: 'AI', component: AI, }, ] }); export default router;
{ "pile_set_name": "Github" }
/* * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef HEADER_RAND_LCL_H # define HEADER_RAND_LCL_H # define ENTROPY_NEEDED 32 /* require 256 bits = 32 bytes of randomness */ # if !defined(USE_MD5_RAND) && !defined(USE_SHA1_RAND) && !defined(USE_MDC2_RAND) && !defined(USE_MD2_RAND) # define USE_SHA1_RAND # endif # include <openssl/evp.h> # define MD_Update(a,b,c) EVP_DigestUpdate(a,b,c) # define MD_Final(a,b) EVP_DigestFinal_ex(a,b,NULL) # if defined(USE_MD5_RAND) # include <openssl/md5.h> # define MD_DIGEST_LENGTH MD5_DIGEST_LENGTH # define MD_Init(a) EVP_DigestInit_ex(a,EVP_md5(), NULL) # define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md5(), NULL) # elif defined(USE_SHA1_RAND) # include <openssl/sha.h> # define MD_DIGEST_LENGTH SHA_DIGEST_LENGTH # define MD_Init(a) EVP_DigestInit_ex(a,EVP_sha1(), NULL) # define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_sha1(), NULL) # elif defined(USE_MDC2_RAND) # include <openssl/mdc2.h> # define MD_DIGEST_LENGTH MDC2_DIGEST_LENGTH # define MD_Init(a) EVP_DigestInit_ex(a,EVP_mdc2(), NULL) # define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_mdc2(), NULL) # elif defined(USE_MD2_RAND) # include <openssl/md2.h> # define MD_DIGEST_LENGTH MD2_DIGEST_LENGTH # define MD_Init(a) EVP_DigestInit_ex(a,EVP_md2(), NULL) # define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md2(), NULL) # endif void rand_hw_xor(unsigned char *buf, size_t num); #endif
{ "pile_set_name": "Github" }
//===----------------------------------------------------------------------===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// %{ stringSubscriptComment = """ /// Subscripting strings with integers is not available. /// /// The concept of "the `i`th character in a string" has /// different interpretations in different libraries and system /// components. The correct interpretation should be selected /// according to the use case and the APIs involved, so `String` /// cannot be subscripted with an integer. /// /// Swift provides several different ways to access the character /// data stored inside strings. /// /// - `String.utf8` is a collection of UTF-8 code units in the /// string. Use this API when converting the string to UTF-8. /// Most POSIX APIs process strings in terms of UTF-8 code units. /// /// - `String.utf16` is a collection of UTF-16 code units in /// string. Most Cocoa and Cocoa touch APIs process strings in /// terms of UTF-16 code units. For example, instances of /// `NSRange` used with `NSAttributedString` and /// `NSRegularExpression` store substring offsets and lengths in /// terms of UTF-16 code units. /// /// - `String.unicodeScalars` is a collection of Unicode scalars. /// Use this API when you are performing low-level manipulation /// of character data. /// /// - `String.characters` is a collection of extended grapheme /// clusters, which are an approximation of user-perceived /// characters. /// /// Note that when processing strings that contain human-readable /// text, character-by-character processing should be avoided to /// the largest extent possible. Use high-level locale-sensitive /// Unicode algorithms instead, for example, /// `String.localizedStandardCompare()`, /// `String.localizedLowercaseString`, /// `String.localizedStandardRangeOfString()` etc.""" }% extension String { ${stringSubscriptComment} @available( *, unavailable, message: "cannot subscript String with an Int, see the documentation comment for discussion") public subscript(i: Int) -> Character { Builtin.unreachable() } % for Range in 'Range', 'ClosedRange', 'CountableRange', 'CountableClosedRange': ${stringSubscriptComment} @available( *, unavailable, message: "cannot subscript String with a ${Range}<Int>, see the documentation comment for discussion") public subscript(bounds: ${Range}<Int>) -> String { Builtin.unreachable() } % end }
{ "pile_set_name": "Github" }
/** Used to match words composed of alphanumeric characters. */ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; /** * Splits an ASCII `string` into an array of its words. * * @private * @param {string} The string to inspect. * @returns {Array} Returns the words of `string`. */ function asciiWords(string) { return string.match(reAsciiWord) || []; } module.exports = asciiWords;
{ "pile_set_name": "Github" }
// Modified by Princeton University on June 9th, 2015 /* * ========== Copyright Header Begin ========================================== * * OpenSPARC T1 Processor File: ASI_LSU_CTRL_MMUs_enable_disable_test.s * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. * * The above named program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License version 2 as published by the Free Software Foundation. * * The above named 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 work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * ========== Copyright Header End ============================================ */ #define THREAD_COUNT 4 #include "boot.s" ! ! Test DMMU & IMMU enable and disable ASI ! #define LSU_CONTROL_REG_ASI 0x45 #define LSU_CONTROL_REG_DIMMU_MASK 0x0c #define LSU_CONTROL_REG_DMMU_MASK 0x08 #define LSU_CONTROL_REG_IMMU_MASK 0x04 #define LSU_CONTROL_REG_DCIC_MASK 0x03 #define LSU_CONTROL_REG_DC_MASK 0x02 #define LSU_CONTROL_REG_IC_MASK 0x01 .text .global main main: ! test enters here from boot in user mode ! Split into seperate threads and Load Thread ID into %g2, then jump to common code th_fork(th_main) th_main_0: setx active_thread, %l1, %o5 jmpl %o5, %o7 add %g0,0,%g2 ! put thread number into bits 1:0 th_main_1: setx active_thread, %l1, %o5 jmpl %o5, %o7 add %g0,1,%g2 ! put thread number into bits 1:0 th_main_2: setx active_thread, %l1, %o5 jmpl %o5, %o7 add %g0,2,%g2 ! put thread number into bits 1:0 th_main_3: setx active_thread, %l1, %o5 jmpl %o5, %o7 add %g0,3,%g2 ! put thread number into bits 1:0 ! ! Note that to simplify ASI cache accesses this segment should be mapped VA==PA==RA ! SECTION .ACTIVE_THREAD_SEC TEXT_VA=0x0000000040008000 attr_text { Name = .ACTIVE_THREAD_SEC, VA= 0x0000000040008000, PA= ra2pa(0x0000000040008000,0), RA= 0x0000000040008000, part_0_i_ctx_nonzero_ps0_tsb, part_0_d_ctx_nonzero_ps0_tsb, TTE_G=1, TTE_Context=PCONTEXT, TTE_V=1, TTE_Size=0, TTE_NFO=0, TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_P=0, TTE_W=1 } attr_text { Name = .ACTIVE_THREAD_SEC, hypervisor } .text .global active_thread ! ! ! ! active_thread: ta T_CHANGE_HPRIV ! enter Hyper mode setx Page1_Label1,%l0,%i0 ! setup addressability setx Page2_Label1,%l0,%i1 setx Data1,%l0,%i2 setx Data2,%l0,%i3 debug1: or %g0,%i0,%g0 ! for debug or %g0,%i1,%g0 ! for debug or %g0,%i2,%g0 ! for debug or %g0,%i3,%g0 ! for debug ! ! VA IMMU on IMMU off DMMU on DMMU off ! 10 18 -- 1 10 (H) -- 2 xx xx ! 18 10 -- 2 18 (H) -- 1 xx xx ! 20 xx xx 28 -- 3s 20 (H) -- 4s ! 28 xx xx 20 -- 4s 28 (H) -- 3s ! ! (H) Hypervisor translated ! Turn_IDMMU_off: add %g0,LSU_CONTROL_REG_DCIC_MASK,%l2 ! D$ + I$ enable bits add %g0,LSU_CONTROL_REG_DIMMU_MASK,%l3 ! I & D MMU enable bits ldxa [%g0]LSU_CONTROL_REG_ASI,%l1 or %l2,%l1,%l1 ! insure I$ & D$ are enabled or %l3,%l1,%l1 xor %l3,%l1,%l1 ! insure IMMU & DMMU are disabled stxa %l1,[%g0]LSU_CONTROL_REG_ASI ldx [%i2+0],%i4 ! get Data1 value ldx [%i3+0],%i5 ! get Data2 value xor %g7,%g7,%g7 ! clear error counter ta T_CHANGE_NONHPRIV ! ! Both MMU's off so V=R=P ! test_part1: jmpl %i0,%l0 ! execute 1st page (@ PA 40018000) nop test_part1a: cmp %g1,2 bne test_fail add %g7,1,%g7 ! jumped to wrong page, error code is 1 cmp %g2,%i5 bne test_fail add %g7,1,%g7 ! fetched wrong data1, error code is 2 cmp %g3,%i4 bne test_fail add %g7,1,%g7 ! fetched wrong data2, error code is 3 jmpl %i1,%l0 ! execute 2nd page (@ PA 40010000) cmp %g1,1 bne test_fail add %g7,1,%g7 ! jumped to wrong page, error code is 4 ! ! Now turn on DMMU and try again ! ta T_CHANGE_HPRIV ! enter Hyper mode add %g0,LSU_CONTROL_REG_DMMU_MASK,%l3 ! DMMU enable bit ldxa [%g0]LSU_CONTROL_REG_ASI,%l1 xor %l3,%l1,%l1 stxa %l1,[%g0]LSU_CONTROL_REG_ASI ! DMMU enabled, I MMU still off ta T_CHANGE_NONHPRIV test_part2: jmpl %i0,%l0 ! execute 1st page (@ PA 40018000) nop test_part2a: cmp %g1,2 bne test_fail add %g7,1,%g7 ! jumped to wrong page, error code is 1 cmp %g2,%i4 bne test_fail add %g7,1,%g7 ! fetched wrong data1, error code is 2 cmp %g3,%i5 bne test_fail add %g7,1,%g7 ! fetched wrong data2, error code is 3 jmpl %i1,%l0 cmp %g1,1 bne test_fail add %g7,1,%g7 ! jumped to wrong page, error code is 4 ! ! Now turn on I & D MMUs and try again ! ta T_CHANGE_HPRIV ! enter Hyper mode add %g0,LSU_CONTROL_REG_IMMU_MASK,%l3 ! IMMU enable bit ldxa [%g0]LSU_CONTROL_REG_ASI,%l1 xor %l3,%l1,%l1 stxa %l1,[%g0]LSU_CONTROL_REG_ASI ! Both MMUs enabled ta T_CHANGE_NONHPRIV test_part3: jmpl %i0,%l0 ! execute 2nd page (@ PA 40010000) nop test_part3a: cmp %g1,1 bne test_fail add %g7,1,%g7 ! jumped to wrong page, error code is 1 cmp %g2,%i4 bne test_fail add %g7,1,%g7 ! fetched wrong data1, error code is 2 cmp %g3,%i5 bne test_fail add %g7,1,%g7 ! fetched wrong data2, error code is 3 jmpl %i1,%l0 ! execute 2nd page (@ PA 40020000) cmp %g1,2 bne test_fail add %g7,1,%g7 ! jumped to wrong page, error code is 4 ! ! Now turn off DMMU and try again ! ta T_CHANGE_HPRIV ! enter Hyper mode add %g0,LSU_CONTROL_REG_DMMU_MASK,%l3 ! DMMU enable bit ldxa [%g0]LSU_CONTROL_REG_ASI,%l1 xor %l3,%l1,%l1 stxa %l1,[%g0]LSU_CONTROL_REG_ASI ! IMMU enabled, DMMU disabled ta T_CHANGE_NONHPRIV test_part4: jmpl %i0,%l0 ! execute 1st page (@ PA 40018000) nop test_part4a: cmp %g1,1 bne test_fail add %g7,1,%g7 ! jumped to wrong page, error code is 1 cmp %g2,%i5 bne test_fail add %g7,1,%g7 ! fetched wrong data1, error code is 2 cmp %g3,%i4 bne test_fail add %g7,1,%g7 ! fetched wrong data2, error code is 3 jmpl %i1,%l0 ! execute 2nd page (@ PA 40020000) cmp %g1,2 bne test_fail add %g7,1,%g7 ! jumped to wrong page, error code is 4 ! test_pass: ta T_GOOD_TRAP nop ! ! test_fail: ta T_BAD_TRAP nop ! SECTION .PAGE1_THREAD_SEC TEXT_VA=0x0000000040018000 attr_text { Name = .PAGE1_THREAD_SEC, VA= 0x0000000040018000, PA= ra2pa(0x0000000040010000,0), RA= 0x0000000040010000, part_0_i_ctx_nonzero_ps0_tsb, part_0_d_ctx_nonzero_ps0_tsb, TTE_G=1, TTE_Context=PCONTEXT, TTE_V=1, TTE_Size=0, TTE_NFO=0, TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_P=0, TTE_W=1 } attr_text { Name = .PAGE1_THREAD_SEC, hypervisor } .text .global Page1_Label1 ! ! ! ! Page1_Label1: add %g0,1,%g1 ldx [%i2+0],%g2 ldx [%i3+0],%g3 jmpl %l0+4,%l1 ! return nop SECTION .PAGE2_THREAD_SEC TEXT_VA=0x0000000040010000 attr_text { Name = .PAGE2_THREAD_SEC, VA= 0x0000000040010000, PA= ra2pa(0x0000000040018000,0), RA= 0x0000000040018000, part_0_i_ctx_nonzero_ps0_tsb, part_0_d_ctx_nonzero_ps0_tsb, TTE_G=1, TTE_Context=PCONTEXT, TTE_V=1, TTE_Size=0, TTE_NFO=0, TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_P=0, TTE_W=1 } attr_text { Name = .PAGE2_THREAD_SEC, hypervisor } .text .global Page2_Label1 ! ! ! ! Page2_Label1: add %g0,2,%g1 ldx [%i2+0],%g2 ldx [%i3+0],%g3 jmpl %l0+4,%l1 ! return nop SECTION .DATA1_AREA_SEC DATA_VA=0x0000000040020000 attr_data { Name = .DATA1_AREA_SEC, VA= 0x0000000040020000, PA= ra2pa(0x0000000040028000,0), RA= 0x0000000040028000, part_0_i_ctx_nonzero_ps0_tsb, part_0_d_ctx_nonzero_ps0_tsb, TTE_G=1, TTE_Context=PCONTEXT, TTE_V=1, TTE_Size=0, TTE_NFO=0, TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_P=0, TTE_W=1 } attr_data { Name = .DATA1_AREA_SEC, hypervisor } .data .global Data1 Data1: .xword 0x3333333333333333 .xword 0 SECTION .DATA2_AREA_SEC DATA_VA=0x0000000040028000 attr_data { Name = .DATA2_AREA_SEC, VA= 0x0000000040028000, PA= ra2pa(0x0000000040020000,0), RA= 0x0000000040020000, part_0_i_ctx_nonzero_ps0_tsb, part_0_d_ctx_nonzero_ps0_tsb, TTE_G=1, TTE_Context=PCONTEXT, TTE_V=1, TTE_Size=0, TTE_NFO=0, TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0, TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_P=0, TTE_W=1 } attr_data { Name = .DATA2_AREA_SEC, hypervisor } .data .global Data2 Data2: .xword 0x4444444444444444 .xword 0
{ "pile_set_name": "Github" }
/* * Twittnuker - Twitter client for Android * * Copyright (C) 2013-2017 vanita5 <[email protected]> * * This program incorporates a modified version of Twidere. * Copyright (C) 2012-2017 Mariotaku Lee <[email protected]> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package de.vanita5.twittnuker.model import android.content.Context import android.content.res.Resources import android.graphics.Typeface import android.support.v4.content.ContextCompat import android.text.SpannableString import android.text.SpannableStringBuilder import android.text.Spanned import android.text.style.StyleSpan import de.vanita5.microblog.library.twitter.model.Activity import de.vanita5.twittnuker.R import de.vanita5.twittnuker.extension.model.activityStatus import de.vanita5.twittnuker.text.style.NonBreakEllipseSpan import de.vanita5.twittnuker.util.UserColorNameManager import org.oshkimaadziig.george.androidutils.SpanFormatter class ActivityTitleSummaryMessage private constructor(val icon: Int, val color: Int, val title: CharSequence, val summary: CharSequence?) { companion object { fun get(context: Context, manager: UserColorNameManager, activity: ParcelableActivity, sources: Array<ParcelableLiteUser>, defaultColor: Int, shouldUseStarsForLikes: Boolean, nameFirst: Boolean): ActivityTitleSummaryMessage? { val resources = context.resources when (activity.action) { Activity.Action.FOLLOW -> { val typeIcon = R.drawable.ic_activity_action_follow val color = ContextCompat.getColor(context, R.color.highlight_follow) val title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_follow, R.string.activity_about_me_follow_multi, sources, nameFirst) return ActivityTitleSummaryMessage(typeIcon, color, title, null) } Activity.Action.FAVORITE -> { val typeIcon: Int val color: Int val title: CharSequence if (shouldUseStarsForLikes) { typeIcon = R.drawable.ic_activity_action_favorite color = ContextCompat.getColor(context, R.color.highlight_favorite) title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_favorite, R.string.activity_about_me_favorite_multi, sources, nameFirst) } else { typeIcon = R.drawable.ic_activity_action_like color = ContextCompat.getColor(context, R.color.highlight_like) title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_like, R.string.activity_about_me_like_multi, sources, nameFirst) } val summary = generateTextOnlySummary(activity.summary_line) return ActivityTitleSummaryMessage(typeIcon, color, title, summary) } Activity.Action.RETWEET -> { val typeIcon = R.drawable.ic_activity_action_retweet val color = ContextCompat.getColor(context, R.color.highlight_retweet) val title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_retweet, R.string.activity_about_me_retweet_multi, sources, nameFirst) val summary = generateTextOnlySummary(activity.summary_line) return ActivityTitleSummaryMessage(typeIcon, color, title, summary) } Activity.Action.FAVORITED_RETWEET -> { val typeIcon: Int val color: Int val title: CharSequence if (shouldUseStarsForLikes) { typeIcon = R.drawable.ic_activity_action_favorite color = ContextCompat.getColor(context, R.color.highlight_favorite) title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_favorited_retweet, R.string.activity_about_me_favorited_retweet_multi, sources, nameFirst) } else { typeIcon = R.drawable.ic_activity_action_like color = ContextCompat.getColor(context, R.color.highlight_like) title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_liked_retweet, R.string.activity_about_me_liked_retweet_multi, sources, nameFirst) } val summary = generateStatusTextSummary(context, manager, activity.summary_line, nameFirst) return ActivityTitleSummaryMessage(typeIcon, color, title, summary) } Activity.Action.RETWEETED_RETWEET -> { val typeIcon = R.drawable.ic_activity_action_retweet val color = ContextCompat.getColor(context, R.color.highlight_retweet) val title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_retweeted_retweet, R.string.activity_about_me_retweeted_retweet_multi, sources, nameFirst) val summary = generateStatusTextSummary(context, manager, activity.summary_line, nameFirst) return ActivityTitleSummaryMessage(typeIcon, color, title, summary) } Activity.Action.RETWEETED_MENTION -> { val typeIcon = R.drawable.ic_activity_action_retweet val color = ContextCompat.getColor(context, R.color.highlight_retweet) val title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_retweeted_mention, R.string.activity_about_me_retweeted_mention_multi, sources, nameFirst) val summary = generateStatusTextSummary(context, manager, activity.summary_line, nameFirst) return ActivityTitleSummaryMessage(typeIcon, color, title, summary) } Activity.Action.FAVORITED_MENTION -> { val typeIcon: Int val color: Int val title: CharSequence if (shouldUseStarsForLikes) { typeIcon = R.drawable.ic_activity_action_favorite color = ContextCompat.getColor(context, R.color.highlight_favorite) title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_favorited_mention, R.string.activity_about_me_favorited_mention_multi, sources, nameFirst) } else { typeIcon = R.drawable.ic_activity_action_like color = ContextCompat.getColor(context, R.color.highlight_like) title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_liked_mention, R.string.activity_about_me_liked_mention_multi, sources, nameFirst) } val summary = generateStatusTextSummary(context, manager, activity.summary_line, nameFirst) return ActivityTitleSummaryMessage(typeIcon, color, title, summary) } Activity.Action.LIST_MEMBER_ADDED -> { val title: CharSequence val icon = R.drawable.ic_activity_action_list_added if (sources.size == 1 && activity.summary_line?.size == 1) { val firstDisplayName = SpannableString(manager.getDisplayName( sources[0], nameFirst)) val listName = SpannableString(activity.summary_line[0].content) firstDisplayName.setSpan(StyleSpan(Typeface.BOLD), 0, firstDisplayName.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) listName.setSpan(StyleSpan(Typeface.BOLD), 0, listName.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) val format = context.getString(R.string.activity_about_me_list_member_added_with_name) title = SpanFormatter.format(format, firstDisplayName, listName) } else { title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_list_member_added, R.string.activity_about_me_list_member_added_multi, sources, nameFirst) } return ActivityTitleSummaryMessage(icon, defaultColor, title, null) } Activity.Action.MENTION, Activity.Action.REPLY, Activity.Action.QUOTE -> { val status = activity.activityStatus ?: return null val title = SpannableString(manager.getDisplayName(status, nameFirst)) title.setSpan(StyleSpan(Typeface.BOLD), 0, title.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) return ActivityTitleSummaryMessage(0, 0, title, status.text_unescaped) } Activity.Action.JOINED_TWITTER -> { val typeIcon = R.drawable.ic_activity_action_follow val color = ContextCompat.getColor(context, R.color.highlight_follow) val title = getTitleStringAboutMe(resources, manager, R.string.activity_joined_twitter, R.string.activity_joined_twitter_multi, sources, nameFirst) return ActivityTitleSummaryMessage(typeIcon, color, title, null) } Activity.Action.MEDIA_TAGGED -> { val typeIcon = R.drawable.ic_activity_action_media_tagged val color = ContextCompat.getColor(context, R.color.highlight_tagged) val title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_media_tagged, R.string.activity_about_me_media_tagged_multi, sources, nameFirst) val summary = generateStatusTextSummary(context, manager, activity.summary_line, nameFirst) return ActivityTitleSummaryMessage(typeIcon, color, title, summary) } Activity.Action.FAVORITED_MEDIA_TAGGED -> { val typeIcon: Int val color: Int val title: CharSequence if (shouldUseStarsForLikes) { typeIcon = R.drawable.ic_activity_action_favorite color = ContextCompat.getColor(context, R.color.highlight_favorite) title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_favorited_media_tagged, R.string.activity_about_me_favorited_media_tagged_multi, sources, nameFirst) } else { typeIcon = R.drawable.ic_activity_action_like color = ContextCompat.getColor(context, R.color.highlight_like) title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_liked_media_tagged, R.string.activity_about_me_liked_media_tagged_multi, sources, nameFirst) } val summary = generateStatusTextSummary(context, manager, activity.summary_line, nameFirst) return ActivityTitleSummaryMessage(typeIcon, color, title, summary) } Activity.Action.RETWEETED_MEDIA_TAGGED -> { val typeIcon = R.drawable.ic_activity_action_retweet val color = ContextCompat.getColor(context, R.color.highlight_retweet) val title = getTitleStringAboutMe(resources, manager, R.string.activity_about_me_retweeted_media_tagged, R.string.activity_about_me_retweeted_media_tagged_multi, sources, nameFirst) val summary = generateStatusTextSummary(context, manager, activity.summary_line, nameFirst) return ActivityTitleSummaryMessage(typeIcon, color, title, summary) } } return null } private fun generateStatusTextSummary(context: Context, manager: UserColorNameManager, statuses: Array<ParcelableActivity.SummaryLine>?, nameFirst: Boolean): Spanned? { return statuses?.joinTo(SpannableStringBuilder(), separator = "\n") { status -> val displayName = SpannableString(manager.getDisplayName(status.key, status.name, status.screen_name, nameFirst)).also { it.setSpan(StyleSpan(Typeface.BOLD), 0, it.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) } val statusText = if (statuses.size > 1) { SpannableString(status.content.replace('\n', ' ')).also { it.setSpan(NonBreakEllipseSpan(), 0, it.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) } } else { status.content } return@joinTo SpanFormatter.format(context.getString(R.string.title_summary_line_format), displayName, statusText) } } private fun generateTextOnlySummary(lines: Array<ParcelableActivity.SummaryLine>?): CharSequence? { return lines?.joinTo(SpannableStringBuilder(), separator = "\n") { status -> if (lines.size > 1) { return@joinTo SpannableString(status.content.replace('\n', ' ')).also { it.setSpan(NonBreakEllipseSpan(), 0, it.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) } } else { return@joinTo status.content } } } private fun getTitleStringAboutMe(resources: Resources, manager: UserColorNameManager, stringRes: Int, stringResMulti: Int, sources: Array<ParcelableLiteUser>, nameFirst: Boolean): CharSequence { val firstDisplayName = SpannableString(manager.getDisplayName(sources[0], nameFirst)) firstDisplayName.setSpan(StyleSpan(Typeface.BOLD), 0, firstDisplayName.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) if (sources.size == 1) { val format = resources.getString(stringRes) return SpanFormatter.format(format, firstDisplayName) } else if (sources.size == 2) { val format = resources.getString(stringResMulti) val secondDisplayName = SpannableString(manager.getDisplayName(sources[1], nameFirst)) secondDisplayName.setSpan(StyleSpan(Typeface.BOLD), 0, secondDisplayName.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) return SpanFormatter.format(format, firstDisplayName, secondDisplayName) } else { val othersCount = sources.size - 1 val nOthers = resources.getQuantityString(R.plurals.N_others, othersCount, othersCount) val format = resources.getString(stringResMulti) return SpanFormatter.format(format, firstDisplayName, nOthers) } } } }
{ "pile_set_name": "Github" }
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package kinesisvideomedia import ( "github.com/aws/aws-sdk-go/private/protocol" ) const ( // ErrCodeClientLimitExceededException for service response error code // "ClientLimitExceededException". // // Kinesis Video Streams has throttled the request because you have exceeded // the limit of allowed client calls. Try making the call later. ErrCodeClientLimitExceededException = "ClientLimitExceededException" // ErrCodeConnectionLimitExceededException for service response error code // "ConnectionLimitExceededException". // // Kinesis Video Streams has throttled the request because you have exceeded // the limit of allowed client connections. ErrCodeConnectionLimitExceededException = "ConnectionLimitExceededException" // ErrCodeInvalidArgumentException for service response error code // "InvalidArgumentException". // // The value for this input parameter is invalid. ErrCodeInvalidArgumentException = "InvalidArgumentException" // ErrCodeInvalidEndpointException for service response error code // "InvalidEndpointException". // // Status Code: 400, Caller used wrong endpoint to write data to a stream. On // receiving such an exception, the user must call GetDataEndpoint with AccessMode // set to "READ" and use the endpoint Kinesis Video returns in the next GetMedia // call. ErrCodeInvalidEndpointException = "InvalidEndpointException" // ErrCodeNotAuthorizedException for service response error code // "NotAuthorizedException". // // Status Code: 403, The caller is not authorized to perform an operation on // the given stream, or the token has expired. ErrCodeNotAuthorizedException = "NotAuthorizedException" // ErrCodeResourceNotFoundException for service response error code // "ResourceNotFoundException". // // Status Code: 404, The stream with the given name does not exist. ErrCodeResourceNotFoundException = "ResourceNotFoundException" ) var exceptionFromCode = map[string]func(protocol.ResponseMetadata) error{ "ClientLimitExceededException": newErrorClientLimitExceededException, "ConnectionLimitExceededException": newErrorConnectionLimitExceededException, "InvalidArgumentException": newErrorInvalidArgumentException, "InvalidEndpointException": newErrorInvalidEndpointException, "NotAuthorizedException": newErrorNotAuthorizedException, "ResourceNotFoundException": newErrorResourceNotFoundException, }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no" /> <title>ImageMagick - Security Policy</title> <meta name="application-name" content="ImageMagick" /> <meta name="description" content="Use ImageMagick® to create, edit, compose, and convert bitmap images. Resize an image, crop it, change its shades and colors, add captions, and more." /> <meta name="application-url" content="https://imagemagick.org" /> <meta name="generator" content="PHP" /> <meta name="keywords" content="security, policy, image converter, image resizer, image editor, photo editor, jpg converter, png converter, tiff converter, vector images, online, free, swiss army" /> <meta name="rating" content="GENERAL" /> <meta name="robots" content="INDEX, FOLLOW" /> <meta name="generator" content="ImageMagick Studio LLC" /> <meta name="author" content="ImageMagick Studio LLC" /> <meta name="revisit-after" content="2 DAYS" /> <meta name="resource-type" content="document" /> <meta name="copyright" content="Copyright (c) 1999-2020 ImageMagick Studio LLC" /> <meta name="distribution" content="Global" /> <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" /> <meta property='og:url' content='../' /> <meta property='og:title' content='ImageMagick' /> <meta property='og:image' content='../images/logo.png' /> <meta property='og:type' content='website' /> <meta property='og:site_name' content='ImageMagick' /> <meta property='og:description' content="Create, Edit, Compose, or Convert Bitmap Images" /> <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> <link href="security-policy.html" rel="canonical" /> <link href="../images/wand.png" rel="icon" /> <link href="../images/wand.ico" rel="shortcut icon" /> <link href="assets/magick.css" rel="stylesheet" /> </head> <body> <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"> <a class="navbar-brand" href="../index.html"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../images/wand.ico"/></a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="navbar-collapse collapse" id="navbarsMagick" style=""> <ul class="navbar-nav mr-auto"> <li class="nav-item "> <a class="nav-link" href="../index.html">Home <span class="sr-only">(current)</span></a> </li> <li class="nav-item "> <a class="nav-link" href="download.html">Download</a> </li> <li class="nav-item "> <a class="nav-link" href="command-line-tools.html">Tools</a> </li> <li class="nav-item "> <a class="nav-link" href="command-line-processing.html">Command-line</a> </li> <li class="nav-item "> <a class="nav-link" href="develop.html">Develop</a> </li> <li class="nav-item"> <a class="nav-link" target="_blank" href="https://github.com/ImageMagick/ImageMagick/discussions">Community</a> </li> <li class="nav-item"> </li> <li class="nav-item"> <iframe src="https://github.com/sponsors/ImageMagick/button" title="Sponsor ImageMagick" height="35" width="107" style="border: 0;"></iframe> </li> </ul> </div> <form class="form-inline my-2 my-md-0" action="https://imagemagick.org/script/search.php"> <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search"> <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button> </form> </nav> <div class="container"> <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3129977114552745" data-ad-slot="6345125851" data-full-width-responsive="true" data-ad-format="horizontal"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <main role="main" class="container"> <div class="magick-template"> <div class="magick-header"> <p class="text-center"><a href="security-policy.html#policy">Security Policy </a> • <a href="security-policy.html#synchronize">Pixel Cache Synchronize Policy</a> • <a href="security-policy.html#zero-configuration">Zero Configuration Security Policy</a> • <a href="security-policy.html#other">Other Security Considerations</a></p> <p class="lead magick-description">ImageMagick best practices strongly encourages you to configure a security <a href="https://imagemagick.org/source/policy.xml">policy.xml</a> that suits your local environment. The policy is open by default. This affords maximum utility for ImageMagick installations that run in a sandboxed environment, perhaps in a Docker instance, or behind a firewall where security risks are greatly diminished as opposed to a public website.</p> <p>Security is a trade-off between a secure environment and convenience. If you want ImageMagick to be optimally secure, you could, for example, limit ImageMagick to only read or write web safe images (e.g. GIF, JPEG, PNG). However, ImageMagick provides for a more secure option by adjusting the security policy per the requirements of your local environment or organizational policies. The security policy covers areas such as memory, which paths to read or write, how many images are permitted in an image sequence, how long a workflow can run, how much disk the image pixels can consume, a secret passphrase for remote connections, which coders are permitted or denied, and others. These policies should provide robust coverage to not only secure your environment per your requirements but also ensure ImageMagick remains a good citizen (e.g. prevent thrashing with large images) in your local environment.</p> <p>As an example, suppose you download an image from the internet and unbeknownst to you its been crafted to generate a 20000 by 20000 pixel image. ImageMagick attempts to allocate enough resources (memory, disk) and your system will likely deny the resource request and exit. However, its also possible that your computer might be temporarily sluggish or unavailable or ImageMagick may abort. To prevent such a scenario, you can set limits in the <code>policy.xml</code> configuration file. You might wonder why ImageMagick does not already include reasonable limits? Simply because what is reasonable in your environment, might not be reasonable to someone else. For example, you may have ImageMagick sandboxed where security is not a concern, whereas another user may use ImageMagick to process images on their publically accessible website. Or ImageMagick runs on a host with 1TB of memory whereas another ImageMagick instance runs on an mobile phone. By policy, permitting giga-pixel image processing on the large memory host makes sense, not so much for the resource constrained mobile phone. If you utilize ImageMagick from a public website, you may want to increase security by preventing usage of the MVG or HTTPS coders. Only you can decide what are reasonable limits taking in consideration your environment. We provide this policy with reasonable limits and encourage you to modify it to suit your local environment:</p> <pre class="pre-scrollable"><code>&lt;policymap> &lt;!-- temporary path must be a preexisting writable directory --> &lt;policy domain="resource" name="temporary-path" value="/data/magick"/> &lt;policy domain="resource" name="memory" value="256MiB"/> &lt;policy domain="resource" name="list-length" value="32"/> &lt;policy domain="resource" name="width" value="8KP"/> &lt;policy domain="resource" name="height" value="8KP"/> &lt;policy domain="resource" name="map" value="512MiB"/> &lt;policy domain="resource" name="area" value="16KP"/> &lt;policy domain="resource" name="disk" value="1GiB"/> &lt;policy domain="resource" name="file" value="768"/> &lt;policy domain="resource" name="thread" value="2"/> &lt;policy domain="resource" name="time" value="120"/> &lt;policy domain="cache" name="memory-map" value="anonymous"/> &lt;policy domain="cache" name="synchronize" value="true"/> &lt;policy domain="cache" name="shared-secret" value="<em>passphrase</em>" stealth="True"/> &lt;policy domain="coder" rights="write" pattern="{HTTP,HTTPS,MVG,PS,EPS,PDF,XPS}" /> &lt;policy domain="filter" rights="none" pattern="*" /> &lt;policy domain="path" rights="none" pattern="@*"/> <!-- indirect reads not permitted --> &lt;/policymap></code></pre> <p>Since we process multiple simultaneous sessions, we do not want any one session consuming all the available memory. With this policy, large images are cached to disk. If the image is too large and exceeds the pixel cache disk limit, the program exits. In addition, we place a time limit to prevent any run-away processing tasks. If any one image has a width or height that exceeds 8192 pixels or if an image sequence exceeds 32 frames, an exception is thrown and processing stops. As of ImageMagick 7.0.1-8, you can prevent the use of any delegate or all delegates (set the pattern to "*"). Note, prior to these releases, use a domain of <code>coder</code> to prevent delegate usage (e.g. <code>domain="coder" rights="none" pattern="HTTPS"</code>). We prevent users from executing any image filters. The policy also prevents indirect reads. If you want to, for example, read text from a file (e.g. <code>caption:@myCaption.txt</code>), you'll need to disable the <code>path</code> policy.</p> <p>Policy patterns are <em>case sensitive</em>. To get expected behavior, coders and modules must be upper-case (e.g. "EPS" not "eps").</p> <p>Here is what you can expect when you restrict the HTTPS coder, for example:</p> <pre class="highlight">-> convert ../images/wizard.png wizard.jpg convert: attempt to perform an operation not allowed by the security policy `HTTPS' convert: no images defined `wizard.jpg'</pre> <p>As of ImageMagick version 7.0.4-7, you can conveniently deny access to all delegates and coders except for a small subset of proven web-safe image types. For example,</p> <pre class="highlight"><code>&lt;policy domain="delegate" rights="none" pattern="*" /> &lt;policy domain="module" rights="none" pattern="*" /> &lt;policy domain="module" rights="read | write" pattern="{GIF,JPEG,PNG,WEBP}" /></code></pre> <p>Here we disable just a few Postscript related formats:</p> <pre class="highlight"><code>&lt;policy domain="module" rights="write" pattern="{PDF,PS,PS2,PS3,XPS}" /></code></pre> <p>As of ImageMagick 7.0.7-0, you can allocate the pixel cache and some internal buffers with anonymous memory mapping rather than from heap. As a consequence, the pixels are initialized to zero resulting in a minor performance penalty. You can also securely delete any temporary files for increased security. The value is the number of times to shred (replace its content with random data) before deleting a temporary file. For example,</p> <pre class="highlight"><code>&lt;policy domain="system" name="memory-map" value="anonymous"/> &lt;policy domain="cache" name="memory-map" value="anonymous"/> &lt;policy domain="system" name="shred" value="1"/></code></pre> <p>Some image processing algorithms (e.g. wavelet transform) might consume a substantial amount of memory to complete. ImageMagick maintains a separate memory pool for these large resource requests and as of 7.0.6-1 permits you to set a maximum request limit. If the limit is exceeded, the allocation is instead memory-mapped on disk. Here we limit the maximum memory request by policy:</p> <pre class="highlight"><code>&lt;policy domain="system" name="max-memory-request" value="256MiB"/> </code></pre> <p>As of ImageMagick version 7.0.4-23, you can limit the maximum number of images in a sequence. For example, to limit an image sequence to 64 frames, use:</p> <pre class="highlight"><code>&lt;policy domain="resource" name="list-length" value="64"/></code></pre> <p>You can verify your policy changes are in effect with this command:</p> <pre class="pre-scrollable">-> identify -list policy Path: ImageMagick-7/policy.xml Policy: Resource name: list-length value: 32 Policy: Resource name: time value: 120 Policy: Resource name: thread value: 2 Policy: Resource name: file value: 768 Policy: Resource name: disk value: 1GiB Policy: Resource name: map value: 512MiB Policy: Resource name: memory value: 256MiB Policy: Resource name: area value: 16KP Policy: Resource name: height value: 8KP Policy: Resource name: width value: 8KP Policy: Resource name: temporary-path value: /opt/tmp Policy: System name: precision value: 6 Policy: Cache name: memory-map value: anonymous Policy: Cache name: synchronize value: true Policy: Coder rights: Write pattern: {HTTP,HTTPS,MVG,PS,EPS,PDF,XPS} Policy: Filter rights: None pattern: * Policy: Path rights: None pattern: @* Path: [built-in] Policy: Undefined rights: None</pre> <p>Notice the <code>shared-secret</code> policy is not listed due to the <code>stealth</code> property.</p> <p>As of ImageMagick 7.0.6-0, you can programmatically set the ImageMagick security policy with SetMagickSecurityPolicy() (MagickCore) or MagickSetSecurityPolicy() (MagickWand).</p> <p>As of ImageMagick version 7.0.8-11, you can set a module security policy. For example, to prevent Postscript or PDF interpretation, use:</p> <pre class="highlight"><code>&lt;policy domain="module" rights="none" pattern="{ps,pdf,xps}/></code></pre> <p>For additional details about resource limits and the policy configuration file, read <a href="resources.html">Resources</a> and <a href="architecture.html">Architecture</a>.</p> <h2><a class="anchor" id="synchronize"></a>Pixel Cache Synchronize Policy</h2> <p>When writing image pixels to disk, ImageMagick firsts preallocates the disk file, which is much faster than fully populating the file with zeros. To further increase performance, we memory-map the file on disk. With memory-mapping, we get an increase in performance (up to 5x), however, there remains a possibility that as the disk file is populated, it may run out of free space. The OS then throws a SIGBUS signal which prevents ImageMagick from continuing. To prevent a SIGBUS, use this security policy: <pre class="highlight"> &lt;policy domain="cache" name="synchronize" value="True"/> </pre> <p>Set to True to ensure all image data is fully flushed and synchronized to disk. There is a performance penalty, however, the benefits include ensuring a valid image file in the event of a system crash and early reporting if there is not enough disk space for the image pixel cache.</p> <h2><a class="anchor" id="zero-configuration"></a>Zero Configuration Security Policy</h2> <p>A zero configuration build of ImageMagick does not permit external configuration files. To define your security policy, you must instead edit the <code>MagickCore/policy-private.h</code> source module, add your policy statements, and then build the ImageMagick distribution. Here is an example zero configuration security policy:</p> <pre class="highlight"><code>static const char *ZeroConfigurationPolicy = \ "&lt;policymap> \ &lt;policy domain=\"coder\" rights=\"none\" pattern=\"MVG\"/> \ &lt;/policymap>";</code></pre> <h2><a class="anchor" id="other"></a>Other Security Considerations</h2> <p>If you spot a security flaw in ImageMagick, post your concern as an issue to <a href="https://github.com/ImageMagick/ImageMagick/issues">GitHub</a>. Be sure to include how to reproduce the security flaw and a link to any images needed to reproduce the flaw. Alternatively, <a href="https://imagemagick.org/script/contact.php">contact us</a> and select Security Issue as the issue.</p> <p>In addition to the security policy, you can make ImageMagick safer by ...</p> <ul> <li>keeping ImageMagick up-to-date. The latest releases have fixes for any security flaws we discovered in the past;</li> <li>sanitizing any filenames or command line options you pass to ImageMagick;</li> <li>running ImageMagick in a sanitized software container such as Docker;</li> <li>running ImageMagick as the least-privileged user (e.g. 'nobody');</li> <li>explicitly setting the image file type. For example, use the filename <code>png:image.png</code> rather than <code>image.png</code>. Without an explicit image type in the filename, ImageMagick guesses the image type.</li> <li>do not create temporary files in shared directories, instead specify a private area to store only ImageMagick temporary files by setting the <code>temporary-path</code> security policy or the <code>-define registry:temporary-path=/data/magick</code> command-line option.</li> </ul> </div> </div> </main><!-- /.container --> <footer class="magick-footer"> <div class="container"> <p><a href="security-policy.html">Security</a> • <a href="resources.html">Resources</a> <a href="security-policy.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../images/wand.ico"/></a> <a href="links.html">Related</a> • <a href="sitemap.html">Sitemap</a> <br/> <a href="support.html">Sponsor</a> • <a href="cite.html">Cite</a> • <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> • <a href="https://imagemagick.org/script/contact.php">Contact Us</a> <br/> <a href="https://github.com/imagemagick/imagemagick" target="_blank" rel="noopener" aria-label="GitHub"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 512 499.36" width="2%" height="2%" role="img" focusable="false"><title>GitHub</title><path fill="currentColor" fill-rule="evenodd" d="M256 0C114.64 0 0 114.61 0 256c0 113.09 73.34 209 175.08 242.9 12.8 2.35 17.47-5.56 17.47-12.34 0-6.08-.22-22.18-.35-43.54-71.2 15.49-86.2-34.34-86.2-34.34-11.64-29.57-28.42-37.45-28.42-37.45-23.27-15.84 1.73-15.55 1.73-15.55 25.69 1.81 39.21 26.38 39.21 26.38 22.84 39.12 59.92 27.82 74.5 21.27 2.33-16.54 8.94-27.82 16.25-34.22-56.84-6.43-116.6-28.43-116.6-126.49 0-27.95 10-50.8 26.35-68.69-2.63-6.48-11.42-32.5 2.51-67.75 0 0 21.49-6.88 70.4 26.24a242.65 242.65 0 0 1 128.18 0c48.87-33.13 70.33-26.24 70.33-26.24 14 35.25 5.18 61.27 2.55 67.75 16.41 17.9 26.31 40.75 26.31 68.69 0 98.35-59.85 120-116.88 126.32 9.19 7.9 17.38 23.53 17.38 47.41 0 34.22-.31 61.83-.31 70.23 0 6.85 4.61 14.81 17.6 12.31C438.72 464.97 512 369.08 512 256.02 512 114.62 397.37 0 256 0z"/></svg></a> • <a href="https://twitter.com/imagemagick" target="_blank" rel="noopener" aria-label="Twitter"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 512 416.32" width="2%" height="2%" role="img" focusable="false"><title>Twitter</title><path fill="currentColor" d="M160.83 416.32c193.2 0 298.92-160.22 298.92-298.92 0-4.51 0-9-.2-13.52A214 214 0 0 0 512 49.38a212.93 212.93 0 0 1-60.44 16.6 105.7 105.7 0 0 0 46.3-58.19 209 209 0 0 1-66.79 25.37 105.09 105.09 0 0 0-181.73 71.91 116.12 116.12 0 0 0 2.66 24c-87.28-4.3-164.73-46.3-216.56-109.82A105.48 105.48 0 0 0 68 159.6a106.27 106.27 0 0 1-47.53-13.11v1.43a105.28 105.28 0 0 0 84.21 103.06 105.67 105.67 0 0 1-47.33 1.84 105.06 105.06 0 0 0 98.14 72.94A210.72 210.72 0 0 1 25 370.84a202.17 202.17 0 0 1-25-1.43 298.85 298.85 0 0 0 160.83 46.92"/></svg></a> <br/> <small>© 1999-2020 ImageMagick Studio LLC</small></p> <div> </footer> <!-- Javascript assets --> <script src="assets/magick.js" crossorigin="anonymous"></script> <script>window.jQuery || document.write('<script src="https://localhost/ajax/libs/jquery/3.4.1/jquery.min.js"><\/script>')</script> </body> </html> <!-- Magick Cache 18th September 2020 19:38 -->
{ "pile_set_name": "Github" }
[Go] [History recording mode] [Send group chat invitation] [Incoming group chat invitation] [The transaction identifier is:] [Error %s %s] [Select Command] [Not supported] [In progress. Please Wait...] [Requesting command list. Please wait...] [Jabber Ad-Hoc commands at %s] [Sending Ad-Hoc command to %s] [Supports Service Discovery items list] [Can request advanced processing of message stanzas] [Supports generic publish-subscribe functionality] [Supports Message Receipts] [Supports private XML Storage (for bookmarks and other)] [Supports attention requests ('nudge')] [Support Message Archive Management (XEP-0313)] [Supports chat history retrieving] [Supports Miranda NG notes extension] [Receives information about OMEMO devices] [Supports message carbons (XEP-0280)] [User %s is now banned.] [User %s changed status to %s with message: %s] [User %s changed status to %s] [Room configuration was changed.] [Outcast] [Affiliation of %s was changed to '%s'.] [because room is now members-only] [user banned] [Invite Users to\n%s] [%s from\n%s] [Real JID not available] [Outgoing XML parsing error] [request timeout.] [Add search directory] [Use for uploads] [Identities] [category] [Category] [Supported features] [Info request error] [Items request error] [Room list request timed out.] [<no nick>] [Please specify group chat directory first.] [has set the subject to:] [Group chat invitation to\n%s] [Open] [Jabber Bookmarks Error] [Conference Room Configuration] [Voice List] [Do you want to create OMEMO session with new device:] [OMEMO: New session] [Bambara] [Bihari] [Corsican] [Cree] [Ewe] [Western Frisian] [Manx] [Hausa] [Herero] [Igbo] [Sichuan Yi] [Interlingue] [Interlingua (International Auxiliary Language Association)] [Inupiaq] [Kannada] [Kashmiri] [Kanuri] [Central Khmer] [Kikuyu; Gikuyu] [Kongo] [Kuanyama; Kwanyama] [Limburgan; Limburger; Limburgish] [Lingala] [Luba-Katanga] [Ganda] [Malayalam] [Marathi] [Navajo; Navaho] [Ndonga] [Ojibwa] [Oriya] [Oromo] [Shona] [Sundanese] [Telugu] [Tibetan] [Twi] [Zhuang; Chuang] [Roster] [Use message delivery receipts (XEP-0184)] [Log presence errors] [Enable user tunes receiving] [Inline pictures in messages (XEP-0231)] [Enable chat states sending (XEP-0085)] [Enable server-side history (XEP-0136)] [Enable carbon copies (XEP-0280)] [Use Stream Management (XEP-0198) if possible (Testing)] [Embrace picture URLs with [img]] [Ignore server roster (groups and nick names)] [Accept only in band incoming filetransfers (don't disclose own IP)] [Use OMEMO encryption for messages if possible (XEP-0384) (Basic support without GUI)] [Do not open chat windows on creation] [League Of Legends (EU Nordic)] [League Of Legends (EU West)] [League Of Legends (Oceania)] [League Of Legends (US)] [Odnoklassniki] [Set New Password for %s@%s] [No valid OMEMO session exists] [Command completed successfully] [Error occurred during processing command] [Set status] [Set options] [Forward unread messages] [Leave group chats] [Quit Miranda NG] [Change Status] [Choose the status and status message] [Extended away (Not available)] [Priority] [Change global status] [Set Options] [Set the desired options] [Automatically Accept File Transfers] [Play sounds] [Disable remote controlling (check twice what you are doing)] [There is no messages to forward] [Forward options] [%d message(s) to be forwarded] [%d message(s) forwarded] [Workstation successfully locked] [Error %d occurred during workstation lock] [Confirmation needed] [Please confirm Miranda NG shutdown] [There is no group chats to leave] [Choose the group chats you want to leave] [Error %s %s\r\nPlease select other server] [Error %s %s\r\nTry to specify more detailed] [Select/type search service URL above and press <Go>] [sent error presence] [sent unknown presence type] [Authentication failed for %s@%s.] [Message redirected from: %s\r\n] [Unable to decrypt a carbon copy of the encrypted outgoing message] [Registration canceled] [<currently online>] [Last activity] [Client capabilities] [Software information] [Tune] [<no information available>] [Please switch online to see more details.] [Redirect] [Payment required] [Request timeout] [Remote server timeout] [<advanced status slot>] [gardening] [running an errand] [hiking] [jogging] [playing sports] [Grooming] [going out] [commuting] [/me slaps %s around a bit with a large trout]
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" > <translate android:duration="300" android:fromXDelta="0" android:toXDelta="-100%p" /> </set>
{ "pile_set_name": "Github" }
// mksyscall.pl -tags linux,ppc64 syscall_linux.go syscall_linux_ppc64x.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build linux,ppc64 package unix import ( "syscall" "unsafe" ) var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(newpath) if err != nil { return } _, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 unsafe.Pointer if len(buf) > 0 { _p1 = unsafe.Pointer(&buf[0]) } else { _p1 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(newpath) if err != nil { return } _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, times *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) { r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func keyctlJoin(cmd int, arg2 string) (ret int, err error) { var _p0 *byte _p0, err = BytePtrFromString(arg2) if err != nil { return } r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) { var _p0 *byte _p0, err = BytePtrFromString(arg3) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(arg4) if err != nil { return } r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) { var _p0 unsafe.Pointer if len(payload) > 0 { _p0 = unsafe.Pointer(&payload[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0) ret = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(arg) if err != nil { return } _, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) { var _p0 *byte _p0, err = BytePtrFromString(source) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(target) if err != nil { return } var _p2 *byte _p2, err = BytePtrFromString(fstype) if err != nil { return } _, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Acct(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) { var _p0 *byte _p0, err = BytePtrFromString(keyType) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(description) if err != nil { return } var _p2 unsafe.Pointer if len(payload) > 0 { _p2 = unsafe.Pointer(&payload[0]) } else { _p2 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0) id = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtimex(buf *Timex) (state int, err error) { r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0) state = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ClockGettime(clockid int32, time *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) { r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(oldfd int) (fd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup3(oldfd int, newfd int, flags int) (err error) { _, _, e1 := Syscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func EpollCreate(size int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func EpollCreate1(flag int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { _, _, e1 := RawSyscall6(SYS_EPOLL_CTL, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Eventfd(initval uint, flags int) (fd int, err error) { r0, _, e1 := Syscall(SYS_EVENTFD2, uintptr(initval), uintptr(flags), 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { Syscall(SYS_EXIT_GROUP, uintptr(code), 0, 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fdatasync(fd int) (err error) { _, _, e1 := Syscall(SYS_FDATASYNC, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) ppid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrandom(buf []byte, flags int) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettid() (tid int) { r0, _, _ := RawSyscall(SYS_GETTID, 0, 0, 0) tid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getxattr(path string, attr string, dest []byte) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } var _p2 unsafe.Pointer if len(dest) > 0 { _p2 = unsafe.Pointer(&dest[0]) } else { _p2 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) if err != nil { return } r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask)) watchdesc = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func InotifyInit1(flags int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT1, uintptr(flags), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_RM_WATCH, uintptr(fd), uintptr(watchdesc), 0) success = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kill(pid int, sig syscall.Signal) (err error) { _, _, e1 := RawSyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Klogctl(typ int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } var _p2 unsafe.Pointer if len(dest) > 0 { _p2 = unsafe.Pointer(&dest[0]) } else { _p2 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listxattr(path string, dest []byte) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 unsafe.Pointer if len(dest) > 0 { _p1 = unsafe.Pointer(&dest[0]) } else { _p1 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Llistxattr(path string, dest []byte) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 unsafe.Pointer if len(dest) > 0 { _p1 = unsafe.Pointer(&dest[0]) } else { _p1 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest))) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lremovexattr(path string, attr string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lsetxattr(path string, attr string, data []byte, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } var _p2 unsafe.Pointer if len(data) > 0 { _p2 = unsafe.Pointer(&data[0]) } else { _p2 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Nanosleep(time *Timespec, leftover *Timespec) (err error) { _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func PivotRoot(newroot string, putold string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(newroot) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(putold) if err != nil { return } _, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) { _, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Removexattr(path string, attr string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(newpath) if err != nil { return } _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) { var _p0 *byte _p0, err = BytePtrFromString(keyType) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(description) if err != nil { return } var _p2 *byte _p2, err = BytePtrFromString(callback) if err != nil { return } r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0) id = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setdomainname(p []byte) (err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sethostname(p []byte) (err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setns(fd int, nstype int) (err error) { _, _, e1 := Syscall(SYS_SETNS, uintptr(fd), uintptr(nstype), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setxattr(path string, attr string, data []byte, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } var _p2 unsafe.Pointer if len(data) > 0 { _p2 = unsafe.Pointer(&data[0]) } else { _p2 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() { Syscall(SYS_SYNC, 0, 0, 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sysinfo(info *Sysinfo_t) (err error) { _, _, e1 := RawSyscall(SYS_SYSINFO, uintptr(unsafe.Pointer(info)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { r0, _, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) n = int64(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { _, _, e1 := RawSyscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Times(tms *Tms) (ticks uintptr, err error) { r0, _, e1 := RawSyscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0) ticks = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(mask int) (oldmask int) { r0, _, _ := RawSyscall(SYS_UMASK, uintptr(mask), 0, 0) oldmask = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Uname(buf *Utsname) (err error) { _, _, e1 := RawSyscall(SYS_UNAME, uintptr(unsafe.Pointer(buf)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(target string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(target) if err != nil { return } _, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unshare(flags int) (err error) { _, _, e1 := Syscall(SYS_UNSHARE, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ustat(dev int, ubuf *Ustat_t) (err error) { _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func exitThread(code int) (err error) { _, _, e1 := Syscall(SYS_EXIT, uintptr(code), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, p *byte, np int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, p *byte, np int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Madvise(b []byte, advice int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { _p0 = unsafe.Pointer(&events[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, buf *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) egid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (euid int) { r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) euid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) gid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_UGETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) uid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func InotifyInit() (fd int, err error) { r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Iopl(level int) (err error) { _, _, e1 := Syscall(SYS_IOPL, uintptr(level), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, n int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pause() (err error) { _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setfsgid(gid int) (err error) { _, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setfsuid(uid int) (err error) { _, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresgid(rgid int, egid int, sgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setresuid(ruid int, euid int, suid int) (err error) { _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(resource int, rlim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int64(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, buf *Statfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func SyncFileRange(fd int, off int64, n int64, flags int) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(off), uintptr(n), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) { r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(n int, list *_Gid_t) (nn int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) nn = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(n int, list *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)) xaddr = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Time(t *Time_t) (tt Time_t, err error) { r0, _, e1 := RawSyscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0) tt = Time_t(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Utime(path string, buf *Utimbuf) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe(p *[2]_C_int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe2(p *[2]_C_int, flags int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return }
{ "pile_set_name": "Github" }
import React from 'react'; import { Alert, StyleSheet, Text, View, AsyncStorage, TouchableOpacity, Image, KeyboardAvoidingView, Keyboard, Platform } from 'react-native'; import jwtDecoder from 'jwt-decode'; import Login from './components/Auth/Login'; import Signup from './components/Auth/Signup'; import { signup, login } from '../authActions'; export default class Auth extends React.Component { state = { isLoggedIn: false, tabIndex: 0, loginProps: { email: '', password: '' }, isKeyboardOpen: false } componentWillMount () { this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this.keyboardShowCallback); this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this.keyboardHideCallback); } componentWillUnmount () { this.keyboardDidShowListener.remove(); this.keyboardDidHideListener.remove(); } keyboardShowCallback = () => { this.setState({ isKeyboardOpen: true}); } keyboardHideCallback = () => { this.setState({ isKeyboardOpen: false}); } switchTabs = (tabIndex) => { this.setState({ tabIndex }); } performSignup = (email, password, successCb, errorCb) => { const successCallback = () => { successCb(); this.setState({ loginProps: { email, password }, tabIndex: 0 }); Alert.alert('Success!', 'Successfully signed up! Please login.') } signup(email, password, successCallback, errorCb); } performLogin = (email, password, successCb, errorCb) => { const successCallback = (response) => { successCb(); this.setState({ tabIndex: 0 }); const decodedToken = jwtDecoder(response.token); AsyncStorage.setItem('@todo-graphql:session', JSON.stringify({ token: response.token, name: decodedToken.name, id: decodedToken.sub, exp: decodedToken.exp })).then(() => { this.props.navigation.navigate('Loading'); }) } login(email, password, successCallback, errorCb); } render() { const { tabIndex, loginProps, isKeyboardOpen } = this.state; const logo = () => { return ( <View style={styles.titleContainer}> <View className={styles.logoWrapper}> <Image source={require('../images/hasura_logo_horizontal_blue.png')} style={styles.logo} /> </View> <View style={styles.titleTextWrapper}> <Text style={styles.title}>React Native Todo App with GraphQL</Text> </View> </View> ) } const tabs = () => { const displayTab = tabIndex === 0 ? <Login submit={this.performLogin} {...loginProps}/> : <Signup submit={this.performSignup}/> let loginTabStyle, signupTabStyle, loginTabTextStyle, signupTabTextStyle; if (tabIndex === 0) { loginTabStyle = styles.activeTab; signupTabStyle = styles.tab; loginTabTextStyle = styles.tabHeaderTextActive; signupTabTextStyle = styles.tabHeaderText } else { signupTabStyle = styles.activeTab; loginTabStyle = styles.tab; loginTabTextStyle = styles.tabHeaderText; signupTabTextStyle = styles.tabHeaderTextActive; } return ( <View style={isKeyboardOpen ? styles.koTabContainer : styles.tabContainer} > <View style={styles.tabHeader}> <TouchableOpacity style={loginTabStyle} onPress={() => this.switchTabs(0)}> <Text style={loginTabTextStyle}>LOG IN</Text> </TouchableOpacity> <TouchableOpacity style={signupTabStyle} onPress={() => this.switchTabs(1)}> <Text style={signupTabTextStyle}>SIGN UP</Text> </TouchableOpacity> </View> <View style={styles.tabContent} > {displayTab} </View> </View> ) } return ( <KeyboardAvoidingView style={styles.container} behavior={Platform.OS === 'ios' ? 'padding' : undefined} enabled > {!isKeyboardOpen && logo()} {tabs()} </KeyboardAvoidingView> ); } } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'space-between', paddingBottom: 20 }, tabContainer: { flex: 0.5, width: 400, marginTop: 40 }, tabHeader: { flex: 0.3, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', paddingHorizontal: 30, marginBottom: 40 }, tabContent: { flex: 1, }, tab: { flex: 1, justifyContent: 'center', alignItems: 'center', borderBottomColor: '#D5CEE7', borderBottomWidth: 1, }, activeTab: { flex: 1, justifyContent: 'center', alignItems: 'center', borderBottomColor: '#39235A', borderBottomWidth: 3, }, tabHeaderText: { fontSize: 18, color: '#808389', alignSelf: 'center', marginBottom: 15 }, tabHeaderTextActive: { fontSize: 18, color: '#39235A', alignSelf: 'center', fontWeight: 'bold', marginBottom: 15 }, titleContainer: { flex: 0.5, marginTop: 40, paddingHorizontal: 30, justifyContent: 'space-between' }, titleTextWrapper: { flex: 1, fontSize: 30, marginTop: 30 }, title: { fontSize: 50, textAlign: 'left', fontWeight: '900', color: '#39235A' }, logoWrapper: { paddingHorizontal: 20, marginBottom: 40 }, logo: { height: 40, width: 134 }, koTabContainer: { width: 400, marginTop: 40, maxHeight: 400, flex: 1 }, });
{ "pile_set_name": "Github" }
import fnmatch import json from os.path import basename from pip._vendor.packaging.utils import canonicalize_name from pytest import mark def pip(script, command, requirement): return script.pip( command, '--prefer-binary', '--no-cache-dir', '--use-feature=fast-deps', requirement, allow_stderr_warning=True, ) def assert_installed(script, names): list_output = json.loads(script.pip('list', '--format=json').stdout) installed = {canonicalize_name(item['name']) for item in list_output} assert installed.issuperset(map(canonicalize_name, names)) @mark.network @mark.parametrize(('requirement', 'expected'), ( ('Paste==3.4.2', ('Paste', 'six')), ('Paste[flup]==3.4.2', ('Paste', 'six', 'flup')), )) def test_install_from_pypi(requirement, expected, script): pip(script, 'install', requirement) assert_installed(script, expected) @mark.network @mark.parametrize(('requirement', 'expected'), ( ('Paste==3.4.2', ('Paste-3.4.2-*.whl', 'six-*.whl')), ('Paste[flup]==3.4.2', ('Paste-3.4.2-*.whl', 'six-*.whl', 'flup-*')), )) def test_download_from_pypi(requirement, expected, script): result = pip(script, 'download', requirement) created = list(map(basename, result.files_created)) assert all(fnmatch.filter(created, f) for f in expected) @mark.network def test_build_wheel_with_deps(data, script): result = pip(script, 'wheel', data.packages/'requiresPaste') created = list(map(basename, result.files_created)) assert fnmatch.filter(created, 'requiresPaste-3.1.4-*.whl') assert fnmatch.filter(created, 'Paste-3.4.2-*.whl') assert fnmatch.filter(created, 'six-*.whl') @mark.network def test_require_hash(script, tmp_path): reqs = tmp_path / 'requirements.txt' reqs.write_text( u'idna==2.10' ' --hash=sha256:' 'b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0' ' --hash=sha256:' 'b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6' ) result = script.pip( 'download', '--use-feature=fast-deps', '-r', str(reqs), allow_stderr_warning=True, ) created = list(map(basename, result.files_created)) assert fnmatch.filter(created, 'idna-2.10*') @mark.network def test_hash_mismatch(script, tmp_path): reqs = tmp_path / 'requirements.txt' reqs.write_text(u'idna==2.10 --hash=sha256:irna') result = script.pip( 'download', '--use-feature=fast-deps', '-r', str(reqs), expect_error=True, ) assert 'DO NOT MATCH THE HASHES' in result.stderr
{ "pile_set_name": "Github" }
using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Collections; using System.ComponentModel; using System.Windows.Forms; namespace SharpKeys { /// <summary> /// Summary description for Dialog_KeyItem. /// </summary> public class Dialog_KeyItem : System.Windows.Forms.Form { // passed into here so it can be pushed through to type key internal Hashtable m_hashKeys = null; internal System.Windows.Forms.ListBox lbFrom; internal System.Windows.Forms.ListBox lbTo; private System.Windows.Forms.Button btnFrom; private System.Windows.Forms.Button btnTo; private Button btnOK; private GroupBox groupBox2; private GroupBox groupBox1; private Panel mainPanel; private Button btnCancel; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; public Dialog_KeyItem() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Dialog_KeyItem)); this.lbFrom = new System.Windows.Forms.ListBox(); this.btnFrom = new System.Windows.Forms.Button(); this.btnTo = new System.Windows.Forms.Button(); this.lbTo = new System.Windows.Forms.ListBox(); this.btnOK = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.mainPanel = new System.Windows.Forms.Panel(); this.btnCancel = new System.Windows.Forms.Button(); this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); this.mainPanel.SuspendLayout(); this.SuspendLayout(); // // lbFrom // this.lbFrom.IntegralHeight = false; this.lbFrom.Location = new System.Drawing.Point(9, 20); this.lbFrom.Name = "lbFrom"; this.lbFrom.ScrollAlwaysVisible = true; this.lbFrom.Size = new System.Drawing.Size(230, 276); this.lbFrom.TabIndex = 0; // // btnFrom // this.btnFrom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnFrom.Location = new System.Drawing.Point(164, 311); this.btnFrom.Name = "btnFrom"; this.btnFrom.Size = new System.Drawing.Size(75, 23); this.btnFrom.TabIndex = 1; this.btnFrom.Text = "Type &Key"; this.btnFrom.Click += new System.EventHandler(this.btnFrom_Click); // // btnTo // this.btnTo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnTo.Location = new System.Drawing.Point(164, 311); this.btnTo.Name = "btnTo"; this.btnTo.Size = new System.Drawing.Size(75, 23); this.btnTo.TabIndex = 0; this.btnTo.Text = "Type K&ey"; this.btnTo.Click += new System.EventHandler(this.btnTo_Click); // // lbTo // this.lbTo.IntegralHeight = false; this.lbTo.Location = new System.Drawing.Point(9, 20); this.lbTo.Name = "lbTo"; this.lbTo.ScrollAlwaysVisible = true; this.lbTo.Size = new System.Drawing.Size(230, 276); this.lbTo.TabIndex = 1; // // btnOK // this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnOK.Location = new System.Drawing.Point(367, 373); this.btnOK.Name = "btnOK"; this.btnOK.Size = new System.Drawing.Size(75, 23); this.btnOK.TabIndex = 2; this.btnOK.Text = "OK"; // // groupBox2 // this.groupBox2.Controls.Add(this.btnTo); this.groupBox2.Controls.Add(this.lbTo); this.groupBox2.Location = new System.Drawing.Point(271, 12); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(251, 347); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "&To this key:"; // // groupBox1 // this.groupBox1.Controls.Add(this.lbFrom); this.groupBox1.Controls.Add(this.btnFrom); this.groupBox1.Location = new System.Drawing.Point(14, 12); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(251, 347); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "&Map this key:"; // // mainPanel // this.mainPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.mainPanel.BackColor = System.Drawing.Color.Transparent; this.mainPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.mainPanel.Controls.Add(this.groupBox1); this.mainPanel.Controls.Add(this.btnOK); this.mainPanel.Controls.Add(this.groupBox2); this.mainPanel.Controls.Add(this.btnCancel); this.mainPanel.Location = new System.Drawing.Point(12, 12); this.mainPanel.Name = "mainPanel"; this.mainPanel.Size = new System.Drawing.Size(537, 410); this.mainPanel.TabIndex = 4; this.mainPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.mainPanel_Paint); // // btnCancel // this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.Location = new System.Drawing.Point(447, 373); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.TabIndex = 3; this.btnCancel.Text = "Cancel"; // // Dialog_KeyItem // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(561, 434); this.Controls.Add(this.mainPanel); this.DoubleBuffered = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Dialog_KeyItem"; this.ShowInTaskbar = false; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Paint += new System.Windows.Forms.PaintEventHandler(this.Dialog_KeyItem_Paint); this.Resize += new System.EventHandler(this.Dialog_KeyItem_Resize); this.groupBox2.ResumeLayout(false); this.groupBox1.ResumeLayout(false); this.mainPanel.ResumeLayout(false); this.ResumeLayout(false); } #endregion private void btnFrom_Click(object sender, System.EventArgs e) { // Pop open the "typing" form to collect keyboard input to get a valid code Dialog_KeyPress dlg = new Dialog_KeyPress(); dlg.m_hashKeys = m_hashKeys; if (dlg.ShowDialog() == DialogResult.OK) { if (lbFrom.Items.Contains(dlg.m_strSelected)) lbFrom.SelectedItem = dlg.m_strSelected; else { // probably an international keyboard code MessageBox.Show("You've entered a key that SharpKeys doesn't know about.\n\nPlease check the SharpKeys website for an updated release", "SharpKeys"); } } } private void btnTo_Click(object sender, System.EventArgs e) { // Pop open the "typing" form to collect keyboard input to get a valid code Dialog_KeyPress dlg = new Dialog_KeyPress(); dlg.m_hashKeys = m_hashKeys; if (dlg.ShowDialog() == DialogResult.OK) { if (lbTo.Items.Contains(dlg.m_strSelected)) lbTo.SelectedItem = dlg.m_strSelected; else { // probably an international keyboard code MessageBox.Show("You've entered a key that SharpKeys doesn't know about.\n\nPlease check the SharpKeys website for an updated release", "SharpKeys"); } } } private void Dialog_KeyItem_Paint(object sender, PaintEventArgs e) { Graphics graphics = e.Graphics; Rectangle rectangle = new Rectangle(0, 0, this.Width, this.Height); LinearGradientBrush linearGradientBrush = new LinearGradientBrush(rectangle, Color.FromArgb(188, 188, 188), Color.FromArgb(225, 225, 225), LinearGradientMode.ForwardDiagonal); graphics.FillRectangle(linearGradientBrush, rectangle); } private void Dialog_KeyItem_Resize(object sender, EventArgs e) { this.Invalidate(); } private void mainPanel_Paint(object sender, PaintEventArgs e) { Graphics graphics = e.Graphics; Rectangle rectangle = new Rectangle(0, 0, mainPanel.Width, mainPanel.Height); LinearGradientBrush linearGradientBrush = new LinearGradientBrush(rectangle, Color.FromArgb(209, 221, 228), Color.FromArgb(237, 239, 247), //Color.FromArgb(236, 241, 243), LinearGradientMode.Vertical); graphics.FillRectangle(linearGradientBrush, rectangle); } } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2008-2020, Hazelcast, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hazelcast.security.permission; public class ExecutorServicePermission extends InstancePermission { private static final int ALL = CREATE | DESTROY; public ExecutorServicePermission(String name, String... actions) { super(name, actions); } @Override protected int initMask(String[] actions) { int mask = NONE; for (String action : actions) { if (ActionConstants.ACTION_ALL.equals(action)) { return ALL; } if (ActionConstants.ACTION_CREATE.equals(action)) { mask |= CREATE; } else if (ActionConstants.ACTION_DESTROY.equals(action)) { mask |= DESTROY; } } return mask; } }
{ "pile_set_name": "Github" }
// mksysnum_linux.pl -Ilinux/usr/include -m64 -D__arch64__ linux/usr/include/asm/unistd.h // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT // +build sparc64,linux package unix const ( SYS_RESTART_SYSCALL = 0 SYS_EXIT = 1 SYS_FORK = 2 SYS_READ = 3 SYS_WRITE = 4 SYS_OPEN = 5 SYS_CLOSE = 6 SYS_WAIT4 = 7 SYS_CREAT = 8 SYS_LINK = 9 SYS_UNLINK = 10 SYS_EXECV = 11 SYS_CHDIR = 12 SYS_CHOWN = 13 SYS_MKNOD = 14 SYS_CHMOD = 15 SYS_LCHOWN = 16 SYS_BRK = 17 SYS_PERFCTR = 18 SYS_LSEEK = 19 SYS_GETPID = 20 SYS_CAPGET = 21 SYS_CAPSET = 22 SYS_SETUID = 23 SYS_GETUID = 24 SYS_VMSPLICE = 25 SYS_PTRACE = 26 SYS_ALARM = 27 SYS_SIGALTSTACK = 28 SYS_PAUSE = 29 SYS_UTIME = 30 SYS_ACCESS = 33 SYS_NICE = 34 SYS_SYNC = 36 SYS_KILL = 37 SYS_STAT = 38 SYS_SENDFILE = 39 SYS_LSTAT = 40 SYS_DUP = 41 SYS_PIPE = 42 SYS_TIMES = 43 SYS_UMOUNT2 = 45 SYS_SETGID = 46 SYS_GETGID = 47 SYS_SIGNAL = 48 SYS_GETEUID = 49 SYS_GETEGID = 50 SYS_ACCT = 51 SYS_MEMORY_ORDERING = 52 SYS_IOCTL = 54 SYS_REBOOT = 55 SYS_SYMLINK = 57 SYS_READLINK = 58 SYS_EXECVE = 59 SYS_UMASK = 60 SYS_CHROOT = 61 SYS_FSTAT = 62 SYS_FSTAT64 = 63 SYS_GETPAGESIZE = 64 SYS_MSYNC = 65 SYS_VFORK = 66 SYS_PREAD64 = 67 SYS_PWRITE64 = 68 SYS_MMAP = 71 SYS_MUNMAP = 73 SYS_MPROTECT = 74 SYS_MADVISE = 75 SYS_VHANGUP = 76 SYS_MINCORE = 78 SYS_GETGROUPS = 79 SYS_SETGROUPS = 80 SYS_GETPGRP = 81 SYS_SETITIMER = 83 SYS_SWAPON = 85 SYS_GETITIMER = 86 SYS_SETHOSTNAME = 88 SYS_DUP2 = 90 SYS_FCNTL = 92 SYS_SELECT = 93 SYS_FSYNC = 95 SYS_SETPRIORITY = 96 SYS_SOCKET = 97 SYS_CONNECT = 98 SYS_ACCEPT = 99 SYS_GETPRIORITY = 100 SYS_RT_SIGRETURN = 101 SYS_RT_SIGACTION = 102 SYS_RT_SIGPROCMASK = 103 SYS_RT_SIGPENDING = 104 SYS_RT_SIGTIMEDWAIT = 105 SYS_RT_SIGQUEUEINFO = 106 SYS_RT_SIGSUSPEND = 107 SYS_SETRESUID = 108 SYS_GETRESUID = 109 SYS_SETRESGID = 110 SYS_GETRESGID = 111 SYS_RECVMSG = 113 SYS_SENDMSG = 114 SYS_GETTIMEOFDAY = 116 SYS_GETRUSAGE = 117 SYS_GETSOCKOPT = 118 SYS_GETCWD = 119 SYS_READV = 120 SYS_WRITEV = 121 SYS_SETTIMEOFDAY = 122 SYS_FCHOWN = 123 SYS_FCHMOD = 124 SYS_RECVFROM = 125 SYS_SETREUID = 126 SYS_SETREGID = 127 SYS_RENAME = 128 SYS_TRUNCATE = 129 SYS_FTRUNCATE = 130 SYS_FLOCK = 131 SYS_LSTAT64 = 132 SYS_SENDTO = 133 SYS_SHUTDOWN = 134 SYS_SOCKETPAIR = 135 SYS_MKDIR = 136 SYS_RMDIR = 137 SYS_UTIMES = 138 SYS_STAT64 = 139 SYS_SENDFILE64 = 140 SYS_GETPEERNAME = 141 SYS_FUTEX = 142 SYS_GETTID = 143 SYS_GETRLIMIT = 144 SYS_SETRLIMIT = 145 SYS_PIVOT_ROOT = 146 SYS_PRCTL = 147 SYS_PCICONFIG_READ = 148 SYS_PCICONFIG_WRITE = 149 SYS_GETSOCKNAME = 150 SYS_INOTIFY_INIT = 151 SYS_INOTIFY_ADD_WATCH = 152 SYS_POLL = 153 SYS_GETDENTS64 = 154 SYS_INOTIFY_RM_WATCH = 156 SYS_STATFS = 157 SYS_FSTATFS = 158 SYS_UMOUNT = 159 SYS_SCHED_SET_AFFINITY = 160 SYS_SCHED_GET_AFFINITY = 161 SYS_GETDOMAINNAME = 162 SYS_SETDOMAINNAME = 163 SYS_UTRAP_INSTALL = 164 SYS_QUOTACTL = 165 SYS_SET_TID_ADDRESS = 166 SYS_MOUNT = 167 SYS_USTAT = 168 SYS_SETXATTR = 169 SYS_LSETXATTR = 170 SYS_FSETXATTR = 171 SYS_GETXATTR = 172 SYS_LGETXATTR = 173 SYS_GETDENTS = 174 SYS_SETSID = 175 SYS_FCHDIR = 176 SYS_FGETXATTR = 177 SYS_LISTXATTR = 178 SYS_LLISTXATTR = 179 SYS_FLISTXATTR = 180 SYS_REMOVEXATTR = 181 SYS_LREMOVEXATTR = 182 SYS_SIGPENDING = 183 SYS_QUERY_MODULE = 184 SYS_SETPGID = 185 SYS_FREMOVEXATTR = 186 SYS_TKILL = 187 SYS_EXIT_GROUP = 188 SYS_UNAME = 189 SYS_INIT_MODULE = 190 SYS_PERSONALITY = 191 SYS_REMAP_FILE_PAGES = 192 SYS_EPOLL_CREATE = 193 SYS_EPOLL_CTL = 194 SYS_EPOLL_WAIT = 195 SYS_IOPRIO_SET = 196 SYS_GETPPID = 197 SYS_SIGACTION = 198 SYS_SGETMASK = 199 SYS_SSETMASK = 200 SYS_SIGSUSPEND = 201 SYS_OLDLSTAT = 202 SYS_USELIB = 203 SYS_READDIR = 204 SYS_READAHEAD = 205 SYS_SOCKETCALL = 206 SYS_SYSLOG = 207 SYS_LOOKUP_DCOOKIE = 208 SYS_FADVISE64 = 209 SYS_FADVISE64_64 = 210 SYS_TGKILL = 211 SYS_WAITPID = 212 SYS_SWAPOFF = 213 SYS_SYSINFO = 214 SYS_IPC = 215 SYS_SIGRETURN = 216 SYS_CLONE = 217 SYS_IOPRIO_GET = 218 SYS_ADJTIMEX = 219 SYS_SIGPROCMASK = 220 SYS_CREATE_MODULE = 221 SYS_DELETE_MODULE = 222 SYS_GET_KERNEL_SYMS = 223 SYS_GETPGID = 224 SYS_BDFLUSH = 225 SYS_SYSFS = 226 SYS_AFS_SYSCALL = 227 SYS_SETFSUID = 228 SYS_SETFSGID = 229 SYS__NEWSELECT = 230 SYS_SPLICE = 232 SYS_STIME = 233 SYS_STATFS64 = 234 SYS_FSTATFS64 = 235 SYS__LLSEEK = 236 SYS_MLOCK = 237 SYS_MUNLOCK = 238 SYS_MLOCKALL = 239 SYS_MUNLOCKALL = 240 SYS_SCHED_SETPARAM = 241 SYS_SCHED_GETPARAM = 242 SYS_SCHED_SETSCHEDULER = 243 SYS_SCHED_GETSCHEDULER = 244 SYS_SCHED_YIELD = 245 SYS_SCHED_GET_PRIORITY_MAX = 246 SYS_SCHED_GET_PRIORITY_MIN = 247 SYS_SCHED_RR_GET_INTERVAL = 248 SYS_NANOSLEEP = 249 SYS_MREMAP = 250 SYS__SYSCTL = 251 SYS_GETSID = 252 SYS_FDATASYNC = 253 SYS_NFSSERVCTL = 254 SYS_SYNC_FILE_RANGE = 255 SYS_CLOCK_SETTIME = 256 SYS_CLOCK_GETTIME = 257 SYS_CLOCK_GETRES = 258 SYS_CLOCK_NANOSLEEP = 259 SYS_SCHED_GETAFFINITY = 260 SYS_SCHED_SETAFFINITY = 261 SYS_TIMER_SETTIME = 262 SYS_TIMER_GETTIME = 263 SYS_TIMER_GETOVERRUN = 264 SYS_TIMER_DELETE = 265 SYS_TIMER_CREATE = 266 SYS_IO_SETUP = 268 SYS_IO_DESTROY = 269 SYS_IO_SUBMIT = 270 SYS_IO_CANCEL = 271 SYS_IO_GETEVENTS = 272 SYS_MQ_OPEN = 273 SYS_MQ_UNLINK = 274 SYS_MQ_TIMEDSEND = 275 SYS_MQ_TIMEDRECEIVE = 276 SYS_MQ_NOTIFY = 277 SYS_MQ_GETSETATTR = 278 SYS_WAITID = 279 SYS_TEE = 280 SYS_ADD_KEY = 281 SYS_REQUEST_KEY = 282 SYS_KEYCTL = 283 SYS_OPENAT = 284 SYS_MKDIRAT = 285 SYS_MKNODAT = 286 SYS_FCHOWNAT = 287 SYS_FUTIMESAT = 288 SYS_FSTATAT64 = 289 SYS_UNLINKAT = 290 SYS_RENAMEAT = 291 SYS_LINKAT = 292 SYS_SYMLINKAT = 293 SYS_READLINKAT = 294 SYS_FCHMODAT = 295 SYS_FACCESSAT = 296 SYS_PSELECT6 = 297 SYS_PPOLL = 298 SYS_UNSHARE = 299 SYS_SET_ROBUST_LIST = 300 SYS_GET_ROBUST_LIST = 301 SYS_MIGRATE_PAGES = 302 SYS_MBIND = 303 SYS_GET_MEMPOLICY = 304 SYS_SET_MEMPOLICY = 305 SYS_KEXEC_LOAD = 306 SYS_MOVE_PAGES = 307 SYS_GETCPU = 308 SYS_EPOLL_PWAIT = 309 SYS_UTIMENSAT = 310 SYS_SIGNALFD = 311 SYS_TIMERFD_CREATE = 312 SYS_EVENTFD = 313 SYS_FALLOCATE = 314 SYS_TIMERFD_SETTIME = 315 SYS_TIMERFD_GETTIME = 316 SYS_SIGNALFD4 = 317 SYS_EVENTFD2 = 318 SYS_EPOLL_CREATE1 = 319 SYS_DUP3 = 320 SYS_PIPE2 = 321 SYS_INOTIFY_INIT1 = 322 SYS_ACCEPT4 = 323 SYS_PREADV = 324 SYS_PWRITEV = 325 SYS_RT_TGSIGQUEUEINFO = 326 SYS_PERF_EVENT_OPEN = 327 SYS_RECVMMSG = 328 SYS_FANOTIFY_INIT = 329 SYS_FANOTIFY_MARK = 330 SYS_PRLIMIT64 = 331 SYS_NAME_TO_HANDLE_AT = 332 SYS_OPEN_BY_HANDLE_AT = 333 SYS_CLOCK_ADJTIME = 334 SYS_SYNCFS = 335 SYS_SENDMMSG = 336 SYS_SETNS = 337 SYS_PROCESS_VM_READV = 338 SYS_PROCESS_VM_WRITEV = 339 SYS_KERN_FEATURES = 340 SYS_KCMP = 341 SYS_FINIT_MODULE = 342 SYS_SCHED_SETATTR = 343 SYS_SCHED_GETATTR = 344 SYS_RENAMEAT2 = 345 SYS_SECCOMP = 346 SYS_GETRANDOM = 347 SYS_MEMFD_CREATE = 348 SYS_BPF = 349 SYS_EXECVEAT = 350 SYS_MEMBARRIER = 351 SYS_USERFAULTFD = 352 SYS_BIND = 353 SYS_LISTEN = 354 SYS_SETSOCKOPT = 355 SYS_MLOCK2 = 356 SYS_COPY_FILE_RANGE = 357 SYS_PREADV2 = 358 SYS_PWRITEV2 = 359 )
{ "pile_set_name": "Github" }
$NetBSD: distinfo,v 1.1 2018/08/29 06:15:46 wiz Exp $ SHA1 (Test-LoadAllModules-0.022.tar.gz) = 9fb5fefc841f597f24ea7efba3ed0057060136dd RMD160 (Test-LoadAllModules-0.022.tar.gz) = 8cb616f6012ed378b2b74c9009633c508b8ff2d1 SHA512 (Test-LoadAllModules-0.022.tar.gz) = 1223cc802f900cc14b99a8ebb7c19ca34117ac043d9f0a6b759f3432138fd3f7a9159d4d991a6e107ebc44c04d32714aa793d82f8830286fee96a1d57636862a Size (Test-LoadAllModules-0.022.tar.gz) = 45213 bytes SHA1 (patch-Makefile.PL) = 963683b5da4a87952b1fff840681e253f8119471
{ "pile_set_name": "Github" }
#include <param.h> #include <x86.h> #include <proto.h> #include <proc.h> #include <page.h> #include <vm.h> #include <conf.h> /* * proc.c - 2010 fleurer * this file implies the initilization of proc[0] and the implementation * of fork(), * * */ struct proc proc0; struct proc *proc[NPROC] = {NULL, }; struct proc *cu = NULL; struct tss_desc tss; extern void _hwint_ret(); /* ----------------------------------------------------------------- */ /* * find an empty proc slot, return the number as pid * return 0 on fail * */ int find_pid(){ int nr; for(nr=0; nr<NPROC; nr++){ if (proc[nr]==NULL){ return nr; } } return 0; } /* Spawn a kernel thread. * This is not quite cool, but we have to do some initialization in * kernel's address space, the approach in linux0.11 is not quite * ease here for the fact that trap occured in the kernel space do * not refering the esp in TSS. * * returns a pointer to the newly borned proc, one page size(with the kernel stack). * */ struct proc* kspawn(void (*func)()){ uint nr; int fd, n; struct file *fp; struct proc *p; nr = find_pid(); if (nr == 0) { panic("no free pid"); } p = (struct proc *) kmalloc(PAGE); if (p==NULL) { panic("no free page"); } proc[nr] = p; p->p_stat = SSLEEP; // set SRUN later. p->p_pid = nr; p->p_ppid = cu->p_pid; p->p_pgrp = cu->p_pgrp; p->p_flag = cu->p_flag; p->p_cpu = cu->p_cpu; p->p_nice = cu->p_nice; p->p_pri = PUSER; // p->p_euid = cu->p_euid; p->p_egid = cu->p_egid; p->p_ruid = cu->p_ruid; p->p_rgid = cu->p_rgid; // increase the reference count of inodes, and dup files if (cu->p_wdir != NULL) { p->p_wdir = cu->p_wdir; p->p_wdir->i_count++; p->p_iroot = cu->p_iroot; p->p_iroot->i_count++; } // dup the files, and fdflag for (fd=0; fd<NOFILE; fd++){ fp = cu->p_ofile[fd]; if (fp != NULL) { fp->f_count++; fp->f_ino->i_count++; } p->p_ofile[fd] = fp; p->p_fdflag[fd] = cu->p_fdflag[fd]; } // signals p->p_sig = cu->p_sig; p->p_sigmask = cu->p_sigmask; for (n=0; n<NSIG; n++) { p->p_sigact[n] = cu->p_sigact[n]; } // clone kernel's address space. vm_clone(&p->p_vm); p->p_contxt = cu->p_contxt; p->p_contxt.eip = (uint)func; p->p_contxt.esp = (uint)p+PAGE; p->p_stat = SRUN; return p; } /* * main part of sys_fork(). * note that the fact that ALL process swtching occurs in kernel * space, hence fork() just returns to _hwint_ret(in entry.S.rb), * and initialize a kernel stack just as intrrupt occurs here. * */ int do_fork(struct trap *tf){ struct proc *p; struct trap *ntf; p = kspawn(&_hwint_ret); ntf = (struct trap *)((uint)p+PAGE) - 1; *ntf = *tf; ntf->eax = 0; // this is why fork() returns 0. p->p_contxt.esp = (uint)ntf; p->p_trap = ntf; return p->p_pid; } /* ----------------------------------------------------------- */ /* * init proc[0] * set the LDT and th ONLY TSS into GDT * and make current as proc[0] */ void proc0_init(){ int fd; struct proc *p = cu = proc[0] = &proc0; p->p_pid = 0; p->p_ppid = 0; p->p_stat = SRUN; p->p_flag = SLOAD; // on shedule p->p_cpu = 0; p->p_pri = 0; p->p_nice = 20; // on user p->p_euid = 0; p->p_egid = 0; // attach the page table p->p_vm.vm_pgd = pgd0; // p->p_wdir = NULL; p->p_iroot = NULL; // init tss tss.ss0 = KERN_DS; tss.esp0 = KSTACK0; for (fd=0; fd<NOFILE; fd++){ p->p_ofile[fd] = NULL; } } /* --------------------------------------------------- */ void dump_proc(struct proc *p){ printk("%s ", (p==cu)? "-":" " ); printk("pid:%d pri:%d cpu:%d nice:%d stat:%d esp0:%x eip:%x \n", p->p_pid, p->p_pri, p->p_cpu, p->p_nice, p->p_stat, p->p_contxt.esp, p->p_contxt.eip); } void dump_procs(){ int i; struct proc *p; for(i=0; i<NPROC; i++){ p = proc[i]; if(p){ dump_proc(p); } } }
{ "pile_set_name": "Github" }
Usage: 输入三个参数,起始日期,结束日期,25, 最后一个参数表示三天涨幅25%. python growth.py 2017-03-01 2017-03-28 25 或 growth.exe 2017-03-01 2017-03-28 25
{ "pile_set_name": "Github" }
/* * Copyright (C) 2004, 2006, 2007, 2008, 2013 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. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import "config.h" #import "WebScriptObjectPrivate.h" #import "BridgeJSC.h" #import "DOMInternal.h" #import "Frame.h" #import "JSDOMWindow.h" #import "JSDOMWindowCustom.h" #import "JSHTMLElement.h" #import "JSMainThreadExecState.h" #import "JSPluginElementFunctions.h" #import "ObjCRuntimeObject.h" #import "WebCoreObjCExtras.h" #import "objc_instance.h" #import "runtime_object.h" #import "runtime_root.h" #import <JavaScriptCore/APICast.h> #import <JavaScriptCore/JSContextInternal.h> #import <JavaScriptCore/JSValueInternal.h> #import <interpreter/CallFrame.h> #import <runtime/Completion.h> #import <runtime/InitializeThreading.h> #import <runtime/JSGlobalObject.h> #import <runtime/JSLock.h> #import <wtf/HashMap.h> #import <wtf/Lock.h> #import <wtf/NeverDestroyed.h> #import <wtf/Threading.h> #import <wtf/text/WTFString.h> using namespace JSC::Bindings; using namespace WebCore; using JSC::CallData; using JSC::CallType; using JSC::CallType::None; using JSC::ExecState; using JSC::Identifier; using JSC::JSLockHolder; using JSC::JSObject; using JSC::MarkedArgumentBuffer; using JSC::PutPropertySlot; using JSC::jsCast; using JSC::jsUndefined; using JSC::makeSource; namespace WebCore { static StaticLock spinLock; static HashMap<JSObject*, NSObject *>& wrapperCache() { static NeverDestroyed<HashMap<JSObject*, NSObject *>> map; return map; } NSObject* getJSWrapper(JSObject* impl) { ASSERT(isMainThread()); LockHolder holder(&spinLock); NSObject* wrapper = wrapperCache().get(impl); return wrapper ? [[wrapper retain] autorelease] : nil; } void addJSWrapper(NSObject* wrapper, JSObject* impl) { ASSERT(isMainThread()); LockHolder holder(&spinLock); wrapperCache().set(impl, wrapper); } void removeJSWrapper(JSObject* impl) { LockHolder holder(&spinLock); wrapperCache().remove(impl); } static void removeJSWrapperIfRetainCountOne(NSObject* wrapper, JSObject* impl) { LockHolder holder(&spinLock); if ([wrapper retainCount] == 1) wrapperCache().remove(impl); } id createJSWrapper(JSC::JSObject* object, PassRefPtr<JSC::Bindings::RootObject> origin, PassRefPtr<JSC::Bindings::RootObject> root) { if (id wrapper = getJSWrapper(object)) return wrapper; return [[[WebScriptObject alloc] _initWithJSObject:object originRootObject:origin rootObject:root] autorelease]; } static void addExceptionToConsole(ExecState* exec, JSC::Exception* exception) { JSDOMWindow* window = asJSDOMWindow(exec->vmEntryGlobalObject()); if (!window || !exception) return; reportException(exec, exception); } static void addExceptionToConsole(ExecState* exec) { JSC::Exception* exception = exec->exception(); exec->clearException(); addExceptionToConsole(exec, exception); } } // namespace WebCore @implementation WebScriptObjectPrivate @end @implementation WebScriptObject + (void)initialize { #if !USE(WEB_THREAD) JSC::initializeThreading(); WTF::initializeMainThreadToProcessMainThread(); #endif // !USE(WEB_THREAD) } + (id)scriptObjectForJSObject:(JSObjectRef)jsObject originRootObject:(RootObject*)originRootObject rootObject:(RootObject*)rootObject { if (id domWrapper = createDOMWrapper(toJS(jsObject), originRootObject, rootObject)) return domWrapper; return WebCore::createJSWrapper(toJS(jsObject), originRootObject, rootObject); } - (void)_setImp:(JSObject*)imp originRootObject:(PassRefPtr<RootObject>)originRootObject rootObject:(PassRefPtr<RootObject>)rootObject { // This function should only be called once, as a (possibly lazy) initializer. ASSERT(!_private->imp); ASSERT(!_private->rootObject); ASSERT(!_private->originRootObject); ASSERT(imp); _private->imp = imp; _private->rootObject = rootObject.leakRef(); _private->originRootObject = originRootObject.leakRef(); WebCore::addJSWrapper(self, imp); if (_private->rootObject) _private->rootObject->gcProtect(imp); } - (void)_setOriginRootObject:(PassRefPtr<RootObject>)originRootObject andRootObject:(PassRefPtr<RootObject>)rootObject { ASSERT(_private->imp); if (rootObject) rootObject->gcProtect(_private->imp); if (_private->rootObject && _private->rootObject->isValid()) _private->rootObject->gcUnprotect(_private->imp); if (_private->rootObject) _private->rootObject->deref(); if (_private->originRootObject) _private->originRootObject->deref(); _private->rootObject = rootObject.leakRef(); _private->originRootObject = originRootObject.leakRef(); } - (id)_initWithJSObject:(JSC::JSObject*)imp originRootObject:(PassRefPtr<JSC::Bindings::RootObject>)originRootObject rootObject:(PassRefPtr<JSC::Bindings::RootObject>)rootObject { ASSERT(imp); self = [super init]; _private = [[WebScriptObjectPrivate alloc] init]; [self _setImp:imp originRootObject:originRootObject rootObject:rootObject]; return self; } - (JSObject*)_imp { // Associate the WebScriptObject with the JS wrapper for the ObjC DOM wrapper. // This is done on lazily, on demand. if (!_private->imp && _private->isCreatedByDOMWrapper) [self _initializeScriptDOMNodeImp]; return [self _rootObject] ? _private->imp : 0; } - (BOOL)_hasImp { return _private->imp != nil; } // Node that DOMNode overrides this method. So you should almost always // use this method call instead of _private->rootObject directly. - (RootObject*)_rootObject { return _private->rootObject && _private->rootObject->isValid() ? _private->rootObject : 0; } - (RootObject *)_originRootObject { return _private->originRootObject && _private->originRootObject->isValid() ? _private->originRootObject : 0; } - (BOOL)_isSafeScript { RootObject *root = [self _rootObject]; if (!root) return false; if (!_private->originRootObject) return true; if (!_private->originRootObject->isValid()) return false; // It's not actually correct to call shouldAllowAccessToFrame in this way because // JSDOMWindowBase* isn't the right object to represent the currently executing // JavaScript. Instead, we should use ExecState, like we do elsewhere. JSDOMWindowBase* target = jsCast<JSDOMWindowBase*>(root->globalObject()); return BindingSecurity::shouldAllowAccessToDOMWindow(_private->originRootObject->globalObject()->globalExec(), target->wrapped()); } - (JSGlobalContextRef)_globalContextRef { if (![self _isSafeScript]) return nil; return toGlobalRef([self _rootObject]->globalObject()->globalExec()); } - (oneway void)release { // If we're releasing the last reference to this object, remove if from the map. if (_private->imp) WebCore::removeJSWrapperIfRetainCountOne(self, _private->imp); [super release]; } - (void)dealloc { if (WebCoreObjCScheduleDeallocateOnMainThread([WebScriptObject class], self)) return; if (_private->rootObject && _private->rootObject->isValid()) _private->rootObject->gcUnprotect(_private->imp); if (_private->rootObject) _private->rootObject->deref(); if (_private->originRootObject) _private->originRootObject->deref(); [_private release]; [super dealloc]; } + (BOOL)throwException:(NSString *)exceptionMessage { ObjcInstance::setGlobalException(exceptionMessage); return YES; } static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* rootObject, MarkedArgumentBuffer& aList) { int i, numObjects = array ? [array count] : 0; for (i = 0; i < numObjects; i++) { id anObject = [array objectAtIndex:i]; aList.append(convertObjcValueToValue(exec, &anObject, ObjcObjectType, rootObject)); } } - (id)callWebScriptMethod:(NSString *)name withArguments:(NSArray *)args { if (![self _isSafeScript]) return nil; // Look up the function object. ExecState* exec = [self _rootObject]->globalObject()->globalExec(); JSLockHolder lock(exec); ASSERT(!exec->hadException()); JSC::JSValue function = [self _imp]->get(exec, Identifier::fromString(exec, String(name))); CallData callData; CallType callType = getCallData(function, callData); if (callType == CallType::None) return nil; MarkedArgumentBuffer argList; getListFromNSArray(exec, args, [self _rootObject], argList); if (![self _isSafeScript]) return nil; NakedPtr<JSC::Exception> exception; JSC::JSValue result = JSMainThreadExecState::profiledCall(exec, JSC::ProfilingReason::Other, function, callType, callData, [self _imp], argList, exception); if (exception) { addExceptionToConsole(exec, exception); result = jsUndefined(); } // Convert and return the result of the function call. id resultObj = [WebScriptObject _convertValueToObjcValue:result originRootObject:[self _originRootObject] rootObject:[self _rootObject]]; return resultObj; } - (id)evaluateWebScript:(NSString *)script { if (![self _isSafeScript]) return nil; ExecState* exec = [self _rootObject]->globalObject()->globalExec(); ASSERT(!exec->hadException()); JSLockHolder lock(exec); JSC::JSValue returnValue = JSMainThreadExecState::profiledEvaluate(exec, JSC::ProfilingReason::Other, makeSource(String(script)), JSC::JSValue()); id resultObj = [WebScriptObject _convertValueToObjcValue:returnValue originRootObject:[self _originRootObject] rootObject:[self _rootObject]]; return resultObj; } - (void)setValue:(id)value forKey:(NSString *)key { if (![self _isSafeScript]) return; ExecState* exec = [self _rootObject]->globalObject()->globalExec(); ASSERT(!exec->hadException()); JSLockHolder lock(exec); JSObject* object = JSC::jsDynamicCast<JSObject*>([self _imp]); PutPropertySlot slot(object); object->methodTable()->put(object, exec, Identifier::fromString(exec, String(key)), convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]), slot); if (exec->hadException()) { addExceptionToConsole(exec); exec->clearException(); } } - (id)valueForKey:(NSString *)key { if (![self _isSafeScript]) return nil; ExecState* exec = [self _rootObject]->globalObject()->globalExec(); ASSERT(!exec->hadException()); id resultObj; { // Need to scope this lock to ensure that we release the lock before calling // [super valueForKey:key] which might throw an exception and bypass the JSLock destructor, // leaving the lock permanently held JSLockHolder lock(exec); JSC::JSValue result = [self _imp]->get(exec, Identifier::fromString(exec, String(key))); if (exec->hadException()) { addExceptionToConsole(exec); result = jsUndefined(); exec->clearException(); } resultObj = [WebScriptObject _convertValueToObjcValue:result originRootObject:[self _originRootObject] rootObject:[self _rootObject]]; } if ([resultObj isKindOfClass:[WebUndefined class]]) resultObj = [super valueForKey:key]; // defaults to throwing an exception return resultObj; } - (void)removeWebScriptKey:(NSString *)key { if (![self _isSafeScript]) return; ExecState* exec = [self _rootObject]->globalObject()->globalExec(); ASSERT(!exec->hadException()); JSLockHolder lock(exec); [self _imp]->methodTable()->deleteProperty([self _imp], exec, Identifier::fromString(exec, String(key))); if (exec->hadException()) { addExceptionToConsole(exec); exec->clearException(); } } - (BOOL)hasWebScriptKey:(NSString *)key { if (![self _isSafeScript]) return NO; ExecState* exec = [self _rootObject]->globalObject()->globalExec(); ASSERT(!exec->hadException()); JSLockHolder lock(exec); BOOL result = [self _imp]->hasProperty(exec, Identifier::fromString(exec, String(key))); if (exec->hadException()) { addExceptionToConsole(exec); exec->clearException(); } return result; } - (NSString *)stringRepresentation { if (![self _isSafeScript]) { // This is a workaround for a gcc 3.3 internal compiler error. return @"Undefined"; } ExecState* exec = [self _rootObject]->globalObject()->globalExec(); JSLockHolder lock(exec); id result = convertValueToObjcValue(exec, [self _imp], ObjcObjectType).objectValue; NSString *description = [result description]; return description; } - (id)webScriptValueAtIndex:(unsigned)index { if (![self _isSafeScript]) return nil; ExecState* exec = [self _rootObject]->globalObject()->globalExec(); ASSERT(!exec->hadException()); JSLockHolder lock(exec); JSC::JSValue result = [self _imp]->get(exec, index); if (exec->hadException()) { addExceptionToConsole(exec); result = jsUndefined(); exec->clearException(); } id resultObj = [WebScriptObject _convertValueToObjcValue:result originRootObject:[self _originRootObject] rootObject:[self _rootObject]]; return resultObj; } - (void)setWebScriptValueAtIndex:(unsigned)index value:(id)value { if (![self _isSafeScript]) return; ExecState* exec = [self _rootObject]->globalObject()->globalExec(); ASSERT(!exec->hadException()); JSLockHolder lock(exec); [self _imp]->methodTable()->putByIndex([self _imp], exec, index, convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]), false); if (exec->hadException()) { addExceptionToConsole(exec); exec->clearException(); } } - (void)setException:(NSString *)description { if (![self _rootObject]) return; ObjcInstance::setGlobalException(description, [self _rootObject]->globalObject()); } - (JSObjectRef)JSObject { if (![self _isSafeScript]) return 0; ExecState* exec = [self _rootObject]->globalObject()->globalExec(); JSLockHolder lock(exec); return toRef([self _imp]); } + (id)_convertValueToObjcValue:(JSC::JSValue)value originRootObject:(RootObject*)originRootObject rootObject:(RootObject*)rootObject { if (value.isObject()) { JSObject* object = asObject(value); JSLockHolder lock(rootObject->globalObject()->vm()); if (object->inherits(JSHTMLElement::info())) { // Plugin elements cache the instance internally. if (ObjcInstance* instance = static_cast<ObjcInstance*>(pluginInstance(jsCast<JSHTMLElement*>(object)->wrapped()))) return instance->getObject(); } else if (object->inherits(ObjCRuntimeObject::info())) { ObjCRuntimeObject* runtimeObject = static_cast<ObjCRuntimeObject*>(object); ObjcInstance* instance = runtimeObject->getInternalObjCInstance(); if (instance) return instance->getObject(); return nil; } return [WebScriptObject scriptObjectForJSObject:toRef(object) originRootObject:originRootObject rootObject:rootObject]; } if (value.isString()) return asString(value)->value(rootObject->globalObject()->globalExec()); if (value.isNumber()) return [NSNumber numberWithDouble:value.asNumber()]; if (value.isBoolean()) return [NSNumber numberWithBool:value.asBoolean()]; if (value.isUndefined()) return [WebUndefined undefined]; // jsNull is not returned as NSNull because existing applications do not expect // that return value. Return as nil for compatibility. <rdar://problem/4651318> <rdar://problem/4701626> // Other types (e.g., UnspecifiedType) also return as nil. return nil; } #if JSC_OBJC_API_ENABLED - (JSValue *)JSValue { if (![self _isSafeScript]) return 0; return [JSValue valueWithJSValueRef:[self JSObject] inContext:[JSContext contextWithJSGlobalContextRef:[self _globalContextRef]]]; } #endif @end @interface WebScriptObject (WebKitCocoaBindings) - (id)objectAtIndex:(unsigned)index; @end @implementation WebScriptObject (WebKitCocoaBindings) #if 0 // FIXME: We'd like to add this, but we can't do that until this issue is resolved: // http://bugs.webkit.org/show_bug.cgi?id=13129: presence of 'count' method on // WebScriptObject breaks Democracy player. - (unsigned)count { id length = [self valueForKey:@"length"]; if (![length respondsToSelector:@selector(intValue)]) return 0; return [length intValue]; } #endif - (id)objectAtIndex:(unsigned)index { return [self webScriptValueAtIndex:index]; } @end @implementation WebUndefined + (id)allocWithZone:(NSZone *)unusedZone { UNUSED_PARAM(unusedZone); static WebUndefined *sharedUndefined = 0; if (!sharedUndefined) sharedUndefined = [super allocWithZone:NULL]; return sharedUndefined; } - (NSString *)description { return @"undefined"; } - (id)initWithCoder:(NSCoder *)unusedCoder { UNUSED_PARAM(unusedCoder); return self; } - (void)encodeWithCoder:(NSCoder *)unusedCoder { UNUSED_PARAM(unusedCoder); } - (id)copyWithZone:(NSZone *)unusedZone { UNUSED_PARAM(unusedZone); return self; } - (id)retain { return self; } - (oneway void)release { } - (NSUInteger)retainCount { return NSUIntegerMax; } - (id)autorelease { return self; } #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wobjc-missing-super-calls" - (void)dealloc { return; } #pragma clang diagnostic pop + (WebUndefined *)undefined { return [WebUndefined allocWithZone:NULL]; } @end
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 3042bb625e3e9924580b1e5ca0129d72 timeCreated: 1551069481 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
//------------------------------------------------------------------------------ // GB_red: hard-coded functions for reductions //------------------------------------------------------------------------------ // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2020, All Rights Reserved. // http://suitesparse.com See GraphBLAS/Doc/License.txt for license. //------------------------------------------------------------------------------ // If this file is in the Generated/ folder, do not edit it (auto-generated). #include "GB.h" #ifndef GBCOMPACT #include "GB_atomics.h" #include "GB_ek_slice.h" #include "GB_control.h" #include "GB_red__include.h" // The reduction is defined by the following types and operators: // Assemble tuples: GB_red_build__min_uint32 // Reduce to scalar: GB_red_scalar__min_uint32 // Reduce each vector: GB_red_eachvec__min_uint32 // Reduce each index: GB_red_eachindex__min_uint32 // A type: uint32_t // C type: uint32_t // Reduce: if (aij < s) s = aij // Identity: UINT32_MAX // Terminal: if (s == 0) break ; #define GB_ATYPE \ uint32_t #define GB_CTYPE \ uint32_t // declare scalar #define GB_SCALAR(s) \ uint32_t s // Array to array // W [k] = (ztype) S [i], with typecast #define GB_CAST_ARRAY_TO_ARRAY(W,k,S,i) \ W [k] = S [i] // W [k] += (ztype) S [i], with typecast #define GB_ADD_CAST_ARRAY_TO_ARRAY(W,k,S,i) \ if (S [i] < W [k]) W [k] = S [i] // W [k] = S [i], no typecast #define GB_COPY_ARRAY_TO_ARRAY(W,k,S,i) \ W [k] = S [i] // W [k] += S [i], no typecast #define GB_ADD_ARRAY_TO_ARRAY(W,k,S,i) \ if (S [i] < W [k]) W [k] = S [i] // Array to scalar // s = (ztype) Ax [p], with typecast #define GB_CAST_ARRAY_TO_SCALAR(s,Ax,p) \ s = Ax [p] // s = W [k], no typecast #define GB_COPY_ARRAY_TO_SCALAR(s,W,k) \ s = W [k] // s += (ztype) Ax [p], with typecast #define GB_ADD_CAST_ARRAY_TO_SCALAR(s,Ax,p) \ if (Ax [p] < s) s = Ax [p] // s += S [i], no typecast #define GB_ADD_ARRAY_TO_SCALAR(s,S,i) \ if (S [i] < s) s = S [i] // Scalar to array // W [k] = s, no typecast #define GB_COPY_SCALAR_TO_ARRAY(W,k,s) \ W [k] = s // W [k] += s, no typecast #define GB_ADD_SCALAR_TO_ARRAY(W,k,s) \ if (s < W [k]) W [k] = s // break the loop if terminal condition reached #define GB_HAS_TERMINAL \ 1 #define GB_TERMINAL_VALUE \ 0 #define GB_BREAK_IF_TERMINAL(t) \ if (s == 0) break ; // panel size for built-in operators #define GB_PANEL \ 16 // special case for the ANY monoid #define GB_IS_ANY_MONOID \ 0 // disable this operator and use the generic case if these conditions hold #define GB_DISABLE \ (GxB_NO_MIN || GxB_NO_UINT32 || GxB_NO_MIN_UINT32) //------------------------------------------------------------------------------ // reduce to a scalar, for monoids only //------------------------------------------------------------------------------ GrB_Info GB_red_scalar__min_uint32 ( uint32_t *result, const GrB_Matrix A, GB_void *GB_RESTRICT W_space, int ntasks, int nthreads ) { #if GB_DISABLE return (GrB_NO_VALUE) ; #else uint32_t s = (*result) ; #include "GB_reduce_panel.c" (*result) = s ; return (GrB_SUCCESS) ; #endif } //------------------------------------------------------------------------------ // reduce to each vector: each vector A(:,k) reduces to a scalar Tx (k) //------------------------------------------------------------------------------ GrB_Info GB_red_eachvec__min_uint32 ( uint32_t *GB_RESTRICT Tx, GrB_Matrix A, const int64_t *GB_RESTRICT kfirst_slice, const int64_t *GB_RESTRICT klast_slice, const int64_t *GB_RESTRICT pstart_slice, GB_void *Wfirst_space, GB_void *Wlast_space, int ntasks, int nthreads ) { #if GB_DISABLE return (GrB_NO_VALUE) ; #else #include "GB_reduce_each_vector.c" return (GrB_SUCCESS) ; #endif } //------------------------------------------------------------------------------ // reduce to each index: each A(i,:) reduces to a scalar T (i) //------------------------------------------------------------------------------ GrB_Info GB_red_eachindex__min_uint32 ( GrB_Matrix *Thandle, GrB_Type ttype, GrB_Matrix A, const int64_t *GB_RESTRICT pstart_slice, int nth, int nthreads, GB_Context Context ) { #if GB_DISABLE return (GrB_NO_VALUE) ; #else GrB_Info info = GrB_SUCCESS ; GrB_Matrix T = NULL ; (*Thandle) = NULL ; #define GB_FREE_ALL ; #include "GB_reduce_each_index.c" (*Thandle) = T ; return (info) ; #endif } //------------------------------------------------------------------------------ // build matrix //------------------------------------------------------------------------------ GrB_Info GB_red_build__min_uint32 ( uint32_t *GB_RESTRICT Tx, int64_t *GB_RESTRICT Ti, const uint32_t *GB_RESTRICT S, int64_t nvals, int64_t ndupl, const int64_t *GB_RESTRICT I_work, const int64_t *GB_RESTRICT K_work, const int64_t *GB_RESTRICT tstart_slice, const int64_t *GB_RESTRICT tnz_slice, int nthreads ) { #if GB_DISABLE return (GrB_NO_VALUE) ; #else #include "GB_reduce_build_template.c" return (GrB_SUCCESS) ; #endif } #endif
{ "pile_set_name": "Github" }
/** * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.v5; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import org.apache.activemq.openwire.*; import org.apache.activemq.command.*; /** * Test case for the OpenWire marshalling for FlushCommand * * * NOTE!: This file is auto generated - do not modify! * if you need to make a change, please see the modify the groovy scripts in the * under src/gram/script and then use maven openwire:generate to regenerate * this file. * * */ public class FlushCommandTest extends BaseCommandTestSupport { public static FlushCommandTest SINGLETON = new FlushCommandTest(); public Object createObject() throws Exception { FlushCommand info = new FlushCommand(); populateObject(info); return info; } protected void populateObject(Object object) throws Exception { super.populateObject(object); FlushCommand info = (FlushCommand) object; } }
{ "pile_set_name": "Github" }
/* * @adonisjs/lucid * * (c) Harminder Virk <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ import { LucidModel, LucidRow } from '@ioc:Adonis/Lucid/Model' import { QueryClientContract } from '@ioc:Adonis/Lucid/Database' import { OneOrMany } from '@ioc:Adonis/Lucid/DatabaseQueryBuilder' import { HasManyThroughClientContract } from '@ioc:Adonis/Lucid/Relations' import { HasManyThrough } from './index' import { HasManyThroughQueryBuilder } from './QueryBuilder' import { HasManyThroughSubQueryBuilder } from './SubQueryBuilder' /** * Query client for executing queries in scope to the defined * relationship */ export class HasManyThroughClient implements HasManyThroughClientContract<HasManyThrough, LucidModel> { constructor( public relation: HasManyThrough, private parent: LucidRow, private client: QueryClientContract ) {} /** * Generate a related query builder */ public static query( client: QueryClientContract, relation: HasManyThrough, rows: OneOrMany<LucidRow> ) { const query = new HasManyThroughQueryBuilder(client.knexQuery(), client, rows, relation) typeof relation.onQueryHook === 'function' && relation.onQueryHook(query) return query } /** * Generate a related eager query builder */ public static eagerQuery( client: QueryClientContract, relation: HasManyThrough, rows: OneOrMany<LucidRow> ) { const query = new HasManyThroughQueryBuilder(client.knexQuery(), client, rows, relation) query.isRelatedPreloadQuery = true typeof relation.onQueryHook === 'function' && relation.onQueryHook(query) return query } /** * Returns an instance of the sub query */ public static subQuery(client: QueryClientContract, relation: HasManyThrough) { const query = new HasManyThroughSubQueryBuilder(client.knexQuery(), client, relation) typeof relation.onQueryHook === 'function' && relation.onQueryHook(query) return query } /** * Returns an instance of has many through query builder */ public query(): any { return HasManyThroughClient.query(this.client, this.relation, this.parent) } }
{ "pile_set_name": "Github" }
{ "extends": "@ethereumjs/config-tsc", "include": ["src/**/*.ts", "src/**/*.json", "tests/*.ts", "tests/*.json"] }
{ "pile_set_name": "Github" }
__precompile__() module Requests export URI, FileParam, headers, cookies, statuscode, post, requestfor export get_streaming, post_streaming, write_chunked export save export set_proxy, set_https_proxy, get_request_settings import Base: get, write import Base.Filesystem: File import URIParser: URI import HttpCommon: Cookie using Compat using HttpParser using HttpCommon using URIParser using MbedTLS using Codecs using JSON using Libz const CRLF = "\r\n" include("parsing.jl") include("multipart.jl") include("streaming.jl") include("mimetypes.jl") function __init__() __init_parsing__() __init_streaming__() init_proxy() end type GlobalSettings http_proxy::Nullable{URI} https_proxy::Nullable{URI} max_redirects::Int end GlobalSettings() = GlobalSettings(Nullable{URI}(), Nullable{URI}(), 5) function Base.show(io::IO, settings::GlobalSettings) println(io, "HTTP proxy: ", isnull(settings.http_proxy) ? "No proxy" : get(settings.http_proxy)) println(io, "HTTPS proxy: ", isnull(settings.https_proxy) ? "No proxy" : get(settings.https_proxy)) print(io, "Max redirects: ", settings.max_redirects) end const SETTINGS = GlobalSettings() function init_proxy() if haskey(ENV, "http_proxy") try proxy = ENV["http_proxy"] set_proxy(proxy) info("Using proxy $proxy from http_proxy environment variable") catch err warn("Problem parsing http_proxy environment variable $(ENV["http_proxy"]); ignoring\n $err") end end if haskey(ENV, "https_proxy") try proxy = ENV["https_proxy"] set_https_proxy(proxy) info("Using HTTPS proxy $proxy from https_proxy environment variable") catch err warn("Problem parsing https_proxy environment variable $(ENV["https_proxy"]); ignoring\n $err") end end end set_proxy(proxy::URI) = set_proxy(Nullable(proxy)) set_proxy(proxy::Nullable{URI}) = SETTINGS.http_proxy = proxy set_proxy(proxy) = set_proxy(URI(proxy)) set_https_proxy(proxy) = SETTINGS.https_proxy=Nullable(URI(proxy)) get_request_settings() = SETTINGS ## Convenience methods for extracting the payload of a response for kind in [:Response, :Request] @eval bytes(r::$kind) = r.data @eval text(r::$kind) = Compat.String(bytes(r)) @eval Base.String(r::$kind) = text(r) if VERSION < v"0.6.0-dev.2521" @eval function Base.bytestring(r::$kind) Base.depwarn("bytestring(r::$($kind)) is deprecated, use String(r) instead.", :bytestring) String(r) end end @eval Base.readstring(r::$kind) = text(r) if VERSION < v"0.6.0-dev.2521" @eval function Base.readall(r::$kind) Base.depwarn("readall(r::$($kind)) is deprecated, use readstring(r) instead.", :readall) readstring(r) end end @eval Base.read(r::$kind) = bytes(r) @eval json(r::$kind; kwargs...) = JSON.parse(text(r); kwargs...) ## Response getters to future-proof against changes to the Response type @eval headers(r::$kind) = r.headers end cookies(r::Response) = r.cookies statuscode(r::Response) = r.status function requestfor(r::Response) isnull(r.request) && error("No associated request for response") get(r.request) end history(r::Response) = r.history # Stolen from https://github.com/dcjones/Gadfly.jl/blob/7fd56991e55b6617d37d7e3d0d69a310bdd36b05/src/Gadfly.jl#L1016 function open_file(filename) if is_apple() run(`open $(filename)`) elseif is_unix() run(`xdg-open $(filename)`) elseif is_windows() run(`$(ENV["COMSPEC"]) /c start $(filename)`) end end function mimetype(r::Response) if haskey(headers(r), "Content-Type") ct = split(headers(r)["Content-Type"], ";")[1] return Nullable(ct) else return Nullable{String}() end end function contentdisposition(r::Response) if haskey(headers(r), "Content-Disposition") cd = split(headers(r)["Content-Disposition"], ";") if length(cd) ≥ 2 filepart = split(cd[2], "=", limit=2) if length(filepart) == 2 return filepart[2] |> strip |> f->strip(f, '"') |> Nullable end end end return Nullable{String}() end """ `save(r::Response, path=".")` Saves the data in the response in the directory `path`. If the path is a directory, then the filename is automatically chosen based on the response headers. Returns the full pathname of the saved file. """ function save(r::Response, path=".") if !isdir(path) filename = path else maybe_basename = contentdisposition(r) if !isnull(maybe_basename) filename = joinpath(path, get(maybe_basename)) else ext = "txt" maybe_mt = mimetype(r) if !isnull(maybe_mt) mt = get(maybe_mt) if haskey(MIMETYPES, mt) ext = MIMETYPES[mt] else if '/' ∉ mt ext = mt end end end basefile = Dates.format(now(), "mm-dd-yyyy-H-M") filename = joinpath(path, "$basefile.$ext") end end open(filename, "w") do file write(file, bytes(r)) end filename end """ `view(r::Response)` View the data in the response with whatever application is associated with its mimetype. """ function view(r::Response) path = save(r, mktempdir()) open_file(path) end http_port(uri) = uri.port == 0 ? 80 : uri.port https_port(uri) = uri.port == 0 ? 443 : uri.port function default_request(method,resource,host,data,user_headers=Dict{Union{},Union{}}()) headers = Dict( "User-Agent" => "Requests.jl/0.0.0", "Host" => host, "Accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" ) if !isempty(data) headers["Content-Length"] = dec(sizeof(data)) end merge!(headers,user_headers) Request(method,resource,headers,data) end function resourcefor(uri::URI) r = uri.path if !isempty(uri.query) r = "$r?$(uri.query)" end r end function default_request(uri::URI,headers,data,method) resource = resourcefor(uri) if !isempty(uri.userinfo) && !haskey(headers,"Authorization") headers["Authorization"] = "Basic $(base64encode(uri.userinfo))" end host = uri.port == 0 ? uri.host : "$(uri.host):$(uri.port)" request = default_request(method,resource,host,data,headers) request.uri = uri return request end scheme(uri::URI) = isdefined(uri, :scheme) ? uri.scheme : uri.schema function format_query_str(queryparams; uri = URI("")) query_str = isempty(uri.query) ? string() : string(uri.query, "&") for (k, v) in queryparams if isa(v, Array) query_str *= join(map(vi -> "$(URIParser.escape(string(k)))=$(URIParser.escape(string(vi)))", v), "&") * "&" else query_str *= "$(URIParser.escape(string(k)))=$(URIParser.escape(string(v)))&" end end chop(query_str) # remove the trailing & end timeout_in_sec(::Void) = Inf timeout_in_sec(t::Dates.TimePeriod) = Dates.toms(t)/1000. timeout_in_sec(t) = convert(Float64, t) cookie_value(c::Cookie) = c.value cookie_value(s) = s function cookie_request_header(d::Dict) join(["$key=$(cookie_value(val))" for (key,val) in d], ';') end cookie_request_header(cookies::AbstractVector{Cookie}) = cookie_request_header(Dict([Pair(cookie.name, cookie.value) for cookie in cookies])) const is_location = r"^location$"i function get_redirect_uri(response) 300 <= statuscode(response) < 400 || return Nullable{URI}() hdrs = headers(response) for (key, val) in hdrs if is_location(key) uri = URI(val) if isempty(uri.host) # Redirect URL was given as a relative path request = requestfor(response) uri = URI(request.uri.scheme, request.uri.host, request.uri.port, uri.path, uri.query) end return Nullable(uri) end end return Nullable{URI}() end immutable RedirectException <: Exception max_redirects::Int end function Base.show(io::IO, err::RedirectException) print(io, "RedirectException: more than $(err.max_redirects) redirects attempted.") end macro check_body() has_body = esc(:has_body) write_body = esc(:write_body) quote $write_body || error("Incompatible arguments: write_body cannot be false if a data argument is provided.") $has_body && error("Multiple body options specified. Please only specify one") $has_body = true end end function do_request(uri::URI, verb; kwargs...) response_stream = do_stream_request(uri, verb; kwargs...) response = response_stream.response response.data = read(response_stream) if get(response.headers, "Content-Encoding", "") ∈ ("gzip", "deflate") if !isempty(response.data) response.data = response.data |> ZlibInflateInputStream |> read end end response end parse_request_data(data) = (data, "application/octet-stream") parse_request_data(data::Associative) = (format_query_str(data), "application/x-www-form-urlencoded") function do_stream_request(uri::URI, verb; headers = Dict{AbstractString, AbstractString}(), cookies = nothing, data = nothing, json = nothing, files = FileParam[], timeout = nothing, query::Dict = Dict(), allow_redirects = true, max_redirects = SETTINGS.max_redirects, history = Response[], tls_conf = TLS_VERIFY, write_body = true, gzip_data = false, compressed = false, proxy = SETTINGS.http_proxy, https_proxy = SETTINGS.https_proxy ) query_str = format_query_str(query; uri = uri) newuri = URI(uri; query = query_str) timeout_sec = timeout_in_sec(timeout) body = "" has_body = false if json ≠ nothing @check_body if get(headers,"Content-Type","application/json") != "application/json" error("Tried to send json data with incompatible Content-Type") end headers["Content-Type"] = "application/json" body = JSON.json(json) end if data ≠ nothing @check_body body, default_content_type = parse_request_data(data) if "Content-Type" ∉ keys(headers) headers["Content-Type"] = default_content_type end if gzip_data headers["Content-Encoding"] = "gzip" body = Vector{UInt8}(body) |> ZlibDeflateInputStream |> read end end if compressed headers["Accept-Encoding"] = "gzip, deflate" end if cookies ≠ nothing headers["Cookie"] = cookie_request_header(cookies) end request = default_request(newuri, headers, body, verb) if isempty(files) response_stream = open_stream(request, tls_conf, timeout_sec, proxy, https_proxy) if write_body write(response_stream, request.data) end else @check_body verb == "POST" || error("Multipart file post only supported with POST") if haskey(headers,"Content-Type") && !beginswith(headers["Content-Type"],"multipart/form-data") error("Tried to send form data with invalid Content-Type. ") end multipart_settings = prepare_multipart_request!(request, files) response_stream = open_stream(request, tls_conf, timeout_sec, proxy, https_proxy) send_multipart(response_stream, multipart_settings, files) end main_task = current_task() @schedule begin try process_response(response_stream) catch err Base.throwto(main_task, err) end while response_stream.state < BodyDone wait(response_stream) end if response_stream.state != UpgradeConnection close(response_stream) end end if write_body while response_stream.state < HeadersDone wait(response_stream) end response_stream.response.history = history if allow_redirects && verb ≠ :head redirect_uri = get_redirect_uri(response_stream) if !isnull(redirect_uri) length(response_stream.response.history) > max_redirects && throw(RedirectException(max_redirects)) push!(history, response_stream.response) return do_stream_request(get(redirect_uri), verb; headers=headers, data=data, json=json, files=files, timeout=timeout, allow_redirects=allow_redirects, max_redirects=max_redirects, history=history, tls_conf=tls_conf, compressed=compressed) end end end return response_stream end for f in [:get, :post, :put, :delete, :head, :trace, :options, :patch, :connect] f_str = uppercase(string(f)) f_stream = Symbol(string(f, "_streaming")) @eval begin function ($f)(uri::URI, data::AbstractString; headers::Dict=Dict()) do_request(uri, $f_str; data=data, headers=headers) end function ($f_stream)(uri::URI, data::AbstractString; headers::Dict=Dict()) do_stream_request(uri, $f_str; data=data, headers=headers) end ($f)(uri::AbstractString; args...) = ($f)(URI(uri); args...) ($f)(uri::URI; args...) = do_request(uri, $f_str; args...) ($f_stream)(uri::AbstractString; args...) = ($f_stream)(URI(uri); args...) ($f_stream)(uri::URI; args...) = do_stream_request(uri, $f_str; args...) end end end
{ "pile_set_name": "Github" }
// // Copyright © 2017 Arm Ltd. All rights reserved. // SPDX-License-Identifier: MIT // #include "../InferenceTest.hpp" #include "../MnistDatabase.hpp" #include "armnnTfParser/ITfParser.hpp" int main(int argc, char* argv[]) { armnn::TensorShape inputTensorShape({ 1, 784, 1, 1 }); int retVal = EXIT_FAILURE; try { using DataType = float; using DatabaseType = MnistDatabase; using ParserType = armnnTfParser::ITfParser; using ModelType = InferenceModel<ParserType, DataType>; // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions. retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>( argc, argv, "simple_mnist_tf.prototxt", false, "Placeholder", "Softmax", { 0, 1, 2, 3, 4 }, [](const char* dataDir, const ModelType&) { return DatabaseType(dataDir, true); }, &inputTensorShape); } catch (const std::exception& e) { // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an // exception of type std::length_error. // Using stderr instead in this context as there is no point in nesting try-catch blocks here. std::cerr << "WARNING: TfMnist-Armnn: An error has occurred when running " "the classifier inference tests: " << e.what() << std::endl; } return retVal; }
{ "pile_set_name": "Github" }
{ "name": "smarty/smarty", "type": "library", "description": "Smarty - the compiling PHP template engine", "keywords": [ "templating" ], "homepage": "http://www.smarty.net", "license": "LGPL-3.0", "authors": [ { "name": "Monte Ohrt", "email": "[email protected]" }, { "name": "Uwe Tews", "email": "[email protected]" }, { "name": "Rodney Rehm", "email": "[email protected]" } ], "support": { "irc": "irc://irc.freenode.org/smarty", "issues": "https://github.com/smarty-php/smarty/issues", "forum": "http://www.smarty.net/forums/" }, "require": { "php": ">=5.2" }, "autoload": { "files": [ "libs/bootstrap.php" ] }, "extra": { "branch-alias": { "dev-master": "3.1.x-dev" } } }
{ "pile_set_name": "Github" }
/* rusage.h -*- C++ -*- Jeremy Barnes, 26 November 2012 Copyright (c) 2012 Datacratic Inc. All rights reserved. Small structure to track resource usage. */ #pragma once #include "soa/jsoncpp/json.h" #include <sys/time.h> #include <sys/resource.h> namespace Datacratic { /** Resource usage structure. */ struct RUsage { RUsage() { clear(); } RUsage(const struct rusage & res) { userTime = res.ru_utime.tv_sec + (res.ru_utime.tv_usec / 1000000.0); systemTime = res.ru_stime.tv_sec + (res.ru_stime.tv_usec / 1000000.0); minorFaults = res.ru_minflt; majorFaults = res.ru_majflt; voluntaryContextSwitches = res.ru_nvcsw; involuntaryContextSwitches = res.ru_nivcsw; } void clear() { userTime = systemTime = minorFaults = majorFaults = voluntaryContextSwitches = involuntaryContextSwitches = 0; } double userTime; double systemTime; long minorFaults; long majorFaults; long voluntaryContextSwitches; long involuntaryContextSwitches; void getForCurrentProcess() { struct rusage rusage; getrusage(RUSAGE_SELF, &rusage); // TODO: check return code... *this = RUsage(rusage); } RUsage operator - (const RUsage & other) const { RUsage result; result.userTime = userTime - other.userTime; result.systemTime = systemTime - other.systemTime; result.minorFaults = minorFaults - other.minorFaults; result.majorFaults = majorFaults - other.majorFaults; result.voluntaryContextSwitches = voluntaryContextSwitches - other.voluntaryContextSwitches; result.involuntaryContextSwitches = involuntaryContextSwitches - other.involuntaryContextSwitches; return result; } Json::Value toJson() const { Json::Value result; result["userTime"] = userTime; result["systemTime"] = systemTime; result["totalTime"] = userTime + systemTime; result["minorFaults"] = (int)minorFaults; result["majorFaults"] = (int)majorFaults; result["totalFaults"] = int(minorFaults + majorFaults); result["voluntaryContextSwitches"] = (int)voluntaryContextSwitches; result["involuntaryContextSwitches"] = (int)involuntaryContextSwitches; result["contextSwitches"] = int(voluntaryContextSwitches + involuntaryContextSwitches); return result; } }; } // namespace Datacratic
{ "pile_set_name": "Github" }
<% title "#{@kind if @kind != 'runtime'} Dependency Tree for #{@project} #{@version} on #{@project.platform_name} - Libraries.io" %> <h1> <%= fa_icon 'code-fork' %> <%= @kind if @kind != 'runtime' %> Dependency Tree for <%= link_to "#{@project} #{@version}", version_path(@version.to_param) %> on <%= link_to @project.platform, platform_path(@project.platform) %> </h1> <% if @date != Date.today %> <p> <small> As if it was resolved on <%= @date.to_formatted_s(:long_ordinal) %> </small> </p> <% end %> <hr> <div class="row"> <div id="tree"> <%= render 'tree/tree', tree: @tree %> </div> </div>
{ "pile_set_name": "Github" }
// Copyright (c) 2001-2011 Hartmut Kaiser // Copyright (c) 2001-2011 Joel de Guzman // // 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) #if !defined(SPIRIT_REPOSITORY_KARMA_DIRECTIVE_APR_28_2009_1258PM) #define SPIRIT_REPOSITORY_KARMA_DIRECTIVE_APR_28_2009_1258PM #if defined(_MSC_VER) #pragma once #endif #include <boost/spirit/repository/home/karma/directive/confix.hpp> #endif
{ "pile_set_name": "Github" }
require 'rails/generators' module Foundation module Generators class InstallGenerator < ::Rails::Generators::Base desc "Install Foundation within a Rails project" source_root File.join(File.dirname(__FILE__), "templates") argument :layout_name, :type => :string, :default => "application", :banner => "layout_name" class_option :haml, :desc => "Generate Haml layout instead of erb", :type => :boolean class_option :slim, :desc => "Generate Slim layout instead of erb", :type => :boolean def add_assets # rails_ujs breaks, need to incorporate rails-behavior plugin for this to work seamlessly # gsub_file "app/assets/javascripts/application#{detect_js_format[0]}", /\/\/= require jquery\n/, "" insert_into_file File.join(javascripts_base_dir, "application#{detect_js_format[0]}"), "#{detect_js_format[1]} require foundation\n", :before => "require_tree .\n" append_to_file File.join(javascripts_base_dir, "application#{detect_js_format[0]}"), "#{detect_js_format[2]}" create_app_scss insert_into_file File.join(stylesheets_base_dir, "application#{detect_css_format[0]}"), "\n#{detect_css_format[1]} require foundation_and_overrides\n", :after => "require_self" end def detect_js_format %w(.coffee .coffee.erb .js.coffee .js.coffee.erb .js .js.erb).each do |ext| if File.exist?(File.join(javascripts_base_dir, "application#{ext}")) if ext.include?(".coffee") return [ext, "#=", "\n() ->\n $(document).foundation()\n"] else return [ext, "//=", "\n$(function(){ $(document).foundation(); });\n"] end end end end def detect_css_format %w(.css .css.sass .sass .css.scss .scss).each do |ext| if File.exist?(File.join(stylesheets_base_dir, "application#{ext}")) if ext.include?(".sass") || ext.include?(".scss") return [ext, "//="] else return [ext, " *="] end end end end def create_layout if options.haml? || (defined?(Haml) && options.haml?) template "application.html.haml", File.join(layouts_base_dir, "#{file_name}.html.haml") elsif options.slim? || (defined?(Slim) && options.slim?) template "application.html.slim", File.join(layouts_base_dir, "#{file_name}.html.slim") else template "application.html.erb", File.join(layouts_base_dir, "#{file_name}.html.erb") end end def create_app_scss template "foundation_and_overrides.scss", File.join(stylesheets_base_dir, "foundation_and_overrides.scss") template "_settings.scss", File.join(stylesheets_base_dir, "_settings.scss") template "browserslist", File.join(stylesheets_base_dir, "browserslist") end private def file_name layout_name.underscore.downcase end def javascripts_base_dir File.join("app", "assets", "javascripts") end def stylesheets_base_dir File.join("app", "assets", "stylesheets") end def layouts_base_dir File.join("app", "views", "layouts") end end end end
{ "pile_set_name": "Github" }
// This file is generated // Copyright (c) 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef protocol_Profiler_h #define protocol_Profiler_h #include "platform/inspector_protocol/Platform.h" #include "platform/inspector_protocol/Array.h" #include "platform/inspector_protocol/BackendCallback.h" #include "platform/inspector_protocol/DispatcherBase.h" #include "platform/inspector_protocol/ErrorSupport.h" #include "platform/inspector_protocol/FrontendChannel.h" #include "platform/inspector_protocol/Maybe.h" #include "platform/inspector_protocol/Object.h" #include "platform/inspector_protocol/Platform.h" #include "platform/inspector_protocol/String16.h" #include "platform/inspector_protocol/Values.h" #include "platform/inspector_protocol/ValueConversions.h" // For each imported domain we generate a ValueConversions struct instead of a full domain definition // and include Domain::API version from there. #include "platform\v8_inspector\protocol/Runtime.h" #include "platform\v8_inspector\protocol/Debugger.h" namespace blink { namespace protocol { namespace Profiler { // ------------- Forward and enum declarations. // CPU Profile node. Holds callsite information, execution statistics and child nodes. class CPUProfileNode; // Profile. class CPUProfile; // Specifies a number of samples attributed to a certain source position. class PositionTickInfo; // ------------- Type and builder declarations. // CPU Profile node. Holds callsite information, execution statistics and child nodes. class PLATFORM_EXPORT CPUProfileNode { PROTOCOL_DISALLOW_COPY(CPUProfileNode); public: static std::unique_ptr<CPUProfileNode> parse(protocol::Value* value, ErrorSupport* errors); ~CPUProfileNode() { } protocol::Runtime::CallFrame* getCallFrame() { return m_callFrame.get(); } void setCallFrame(std::unique_ptr<protocol::Runtime::CallFrame> value) { m_callFrame = std::move(value); } int getHitCount() { return m_hitCount; } void setHitCount(int value) { m_hitCount = value; } protocol::Array<protocol::Profiler::CPUProfileNode>* getChildren() { return m_children.get(); } void setChildren(std::unique_ptr<protocol::Array<protocol::Profiler::CPUProfileNode>> value) { m_children = std::move(value); } String16 getDeoptReason() { return m_deoptReason; } void setDeoptReason(const String16& value) { m_deoptReason = value; } int getId() { return m_id; } void setId(int value) { m_id = value; } protocol::Array<protocol::Profiler::PositionTickInfo>* getPositionTicks() { return m_positionTicks.get(); } void setPositionTicks(std::unique_ptr<protocol::Array<protocol::Profiler::PositionTickInfo>> value) { m_positionTicks = std::move(value); } std::unique_ptr<protocol::DictionaryValue> serialize() const; std::unique_ptr<CPUProfileNode> clone() const; template<int STATE> class CPUProfileNodeBuilder { public: enum { NoFieldsSet = 0, CallFrameSet = 1 << 1, HitCountSet = 1 << 2, ChildrenSet = 1 << 3, DeoptReasonSet = 1 << 4, IdSet = 1 << 5, PositionTicksSet = 1 << 6, AllFieldsSet = (CallFrameSet | HitCountSet | ChildrenSet | DeoptReasonSet | IdSet | PositionTicksSet | 0)}; CPUProfileNodeBuilder<STATE | CallFrameSet>& setCallFrame(std::unique_ptr<protocol::Runtime::CallFrame> value) { static_assert(!(STATE & CallFrameSet), "property callFrame should not be set yet"); m_result->setCallFrame(std::move(value)); return castState<CallFrameSet>(); } CPUProfileNodeBuilder<STATE | HitCountSet>& setHitCount(int value) { static_assert(!(STATE & HitCountSet), "property hitCount should not be set yet"); m_result->setHitCount(value); return castState<HitCountSet>(); } CPUProfileNodeBuilder<STATE | ChildrenSet>& setChildren(std::unique_ptr<protocol::Array<protocol::Profiler::CPUProfileNode>> value) { static_assert(!(STATE & ChildrenSet), "property children should not be set yet"); m_result->setChildren(std::move(value)); return castState<ChildrenSet>(); } CPUProfileNodeBuilder<STATE | DeoptReasonSet>& setDeoptReason(const String16& value) { static_assert(!(STATE & DeoptReasonSet), "property deoptReason should not be set yet"); m_result->setDeoptReason(value); return castState<DeoptReasonSet>(); } CPUProfileNodeBuilder<STATE | IdSet>& setId(int value) { static_assert(!(STATE & IdSet), "property id should not be set yet"); m_result->setId(value); return castState<IdSet>(); } CPUProfileNodeBuilder<STATE | PositionTicksSet>& setPositionTicks(std::unique_ptr<protocol::Array<protocol::Profiler::PositionTickInfo>> value) { static_assert(!(STATE & PositionTicksSet), "property positionTicks should not be set yet"); m_result->setPositionTicks(std::move(value)); return castState<PositionTicksSet>(); } std::unique_ptr<CPUProfileNode> build() { static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); return std::move(m_result); } private: friend class CPUProfileNode; CPUProfileNodeBuilder() : m_result(new CPUProfileNode()) { } template<int STEP> CPUProfileNodeBuilder<STATE | STEP>& castState() { return *reinterpret_cast<CPUProfileNodeBuilder<STATE | STEP>*>(this); } std::unique_ptr<protocol::Profiler::CPUProfileNode> m_result; }; static CPUProfileNodeBuilder<0> create() { return CPUProfileNodeBuilder<0>(); } private: CPUProfileNode() { m_hitCount = 0; m_id = 0; } std::unique_ptr<protocol::Runtime::CallFrame> m_callFrame; int m_hitCount; std::unique_ptr<protocol::Array<protocol::Profiler::CPUProfileNode>> m_children; String16 m_deoptReason; int m_id; std::unique_ptr<protocol::Array<protocol::Profiler::PositionTickInfo>> m_positionTicks; }; // Profile. class PLATFORM_EXPORT CPUProfile { PROTOCOL_DISALLOW_COPY(CPUProfile); public: static std::unique_ptr<CPUProfile> parse(protocol::Value* value, ErrorSupport* errors); ~CPUProfile() { } protocol::Profiler::CPUProfileNode* getHead() { return m_head.get(); } void setHead(std::unique_ptr<protocol::Profiler::CPUProfileNode> value) { m_head = std::move(value); } double getStartTime() { return m_startTime; } void setStartTime(double value) { m_startTime = value; } double getEndTime() { return m_endTime; } void setEndTime(double value) { m_endTime = value; } bool hasSamples() { return m_samples.isJust(); } protocol::Array<int>* getSamples(protocol::Array<int>* defaultValue) { return m_samples.isJust() ? m_samples.fromJust() : defaultValue; } void setSamples(std::unique_ptr<protocol::Array<int>> value) { m_samples = std::move(value); } bool hasTimestamps() { return m_timestamps.isJust(); } protocol::Array<double>* getTimestamps(protocol::Array<double>* defaultValue) { return m_timestamps.isJust() ? m_timestamps.fromJust() : defaultValue; } void setTimestamps(std::unique_ptr<protocol::Array<double>> value) { m_timestamps = std::move(value); } std::unique_ptr<protocol::DictionaryValue> serialize() const; std::unique_ptr<CPUProfile> clone() const; template<int STATE> class CPUProfileBuilder { public: enum { NoFieldsSet = 0, HeadSet = 1 << 1, StartTimeSet = 1 << 2, EndTimeSet = 1 << 3, AllFieldsSet = (HeadSet | StartTimeSet | EndTimeSet | 0)}; CPUProfileBuilder<STATE | HeadSet>& setHead(std::unique_ptr<protocol::Profiler::CPUProfileNode> value) { static_assert(!(STATE & HeadSet), "property head should not be set yet"); m_result->setHead(std::move(value)); return castState<HeadSet>(); } CPUProfileBuilder<STATE | StartTimeSet>& setStartTime(double value) { static_assert(!(STATE & StartTimeSet), "property startTime should not be set yet"); m_result->setStartTime(value); return castState<StartTimeSet>(); } CPUProfileBuilder<STATE | EndTimeSet>& setEndTime(double value) { static_assert(!(STATE & EndTimeSet), "property endTime should not be set yet"); m_result->setEndTime(value); return castState<EndTimeSet>(); } CPUProfileBuilder<STATE>& setSamples(std::unique_ptr<protocol::Array<int>> value) { m_result->setSamples(std::move(value)); return *this; } CPUProfileBuilder<STATE>& setTimestamps(std::unique_ptr<protocol::Array<double>> value) { m_result->setTimestamps(std::move(value)); return *this; } std::unique_ptr<CPUProfile> build() { static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); return std::move(m_result); } private: friend class CPUProfile; CPUProfileBuilder() : m_result(new CPUProfile()) { } template<int STEP> CPUProfileBuilder<STATE | STEP>& castState() { return *reinterpret_cast<CPUProfileBuilder<STATE | STEP>*>(this); } std::unique_ptr<protocol::Profiler::CPUProfile> m_result; }; static CPUProfileBuilder<0> create() { return CPUProfileBuilder<0>(); } private: CPUProfile() { m_startTime = 0; m_endTime = 0; } std::unique_ptr<protocol::Profiler::CPUProfileNode> m_head; double m_startTime; double m_endTime; Maybe<protocol::Array<int>> m_samples; Maybe<protocol::Array<double>> m_timestamps; }; // Specifies a number of samples attributed to a certain source position. class PLATFORM_EXPORT PositionTickInfo { PROTOCOL_DISALLOW_COPY(PositionTickInfo); public: static std::unique_ptr<PositionTickInfo> parse(protocol::Value* value, ErrorSupport* errors); ~PositionTickInfo() { } int getLine() { return m_line; } void setLine(int value) { m_line = value; } int getTicks() { return m_ticks; } void setTicks(int value) { m_ticks = value; } std::unique_ptr<protocol::DictionaryValue> serialize() const; std::unique_ptr<PositionTickInfo> clone() const; template<int STATE> class PositionTickInfoBuilder { public: enum { NoFieldsSet = 0, LineSet = 1 << 1, TicksSet = 1 << 2, AllFieldsSet = (LineSet | TicksSet | 0)}; PositionTickInfoBuilder<STATE | LineSet>& setLine(int value) { static_assert(!(STATE & LineSet), "property line should not be set yet"); m_result->setLine(value); return castState<LineSet>(); } PositionTickInfoBuilder<STATE | TicksSet>& setTicks(int value) { static_assert(!(STATE & TicksSet), "property ticks should not be set yet"); m_result->setTicks(value); return castState<TicksSet>(); } std::unique_ptr<PositionTickInfo> build() { static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); return std::move(m_result); } private: friend class PositionTickInfo; PositionTickInfoBuilder() : m_result(new PositionTickInfo()) { } template<int STEP> PositionTickInfoBuilder<STATE | STEP>& castState() { return *reinterpret_cast<PositionTickInfoBuilder<STATE | STEP>*>(this); } std::unique_ptr<protocol::Profiler::PositionTickInfo> m_result; }; static PositionTickInfoBuilder<0> create() { return PositionTickInfoBuilder<0>(); } private: PositionTickInfo() { m_line = 0; m_ticks = 0; } int m_line; int m_ticks; }; // ------------- Backend interface. class PLATFORM_EXPORT Backend { public: virtual void enable(ErrorString*) = 0; virtual void disable(ErrorString*) = 0; virtual void setSamplingInterval(ErrorString*, int in_interval) = 0; virtual void start(ErrorString*) = 0; virtual void stop(ErrorString*, std::unique_ptr<protocol::Profiler::CPUProfile>* out_profile) = 0; protected: virtual ~Backend() { } }; // ------------- Frontend interface. class PLATFORM_EXPORT Frontend { public: Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { } void consoleProfileStarted(const String16& id, std::unique_ptr<protocol::Debugger::Location> location, const Maybe<String16>& title = Maybe<String16>()); void consoleProfileFinished(const String16& id, std::unique_ptr<protocol::Debugger::Location> location, std::unique_ptr<protocol::Profiler::CPUProfile> profile, const Maybe<String16>& title = Maybe<String16>()); void flush() { m_frontendChannel->flushProtocolNotifications(); } private: FrontendChannel* m_frontendChannel; }; // ------------- Dispatcher. class PLATFORM_EXPORT Dispatcher { public: static void wire(UberDispatcher*, blink::protocol::Profiler::Backend*); private: Dispatcher() { } }; // ------------- Metainfo. class PLATFORM_EXPORT Metainfo { public: using BackendClass = Backend; using FrontendClass = Frontend; using DispatcherClass = Dispatcher; static const char domainName[]; static const char commandPrefix[]; }; } // namespace Profiler } // namespace protocol } // namespace blink #endif // !defined(protocol_Profiler_h)
{ "pile_set_name": "Github" }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing.Constraints; using Microsoft.AspNetCore.Routing.Patterns; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Moq; using Xunit; namespace Microsoft.AspNetCore.Routing.Matching { public class DfaMatcherBuilderTest { [Fact] public void BuildDfaTree_SingleEndpoint_Empty() { // Arrange var builder = CreateDfaMatcherBuilder(); var endpoint = CreateEndpoint("/"); builder.AddEndpoint(endpoint); // Act var root = builder.BuildDfaTree(); // Assert Assert.Same(endpoint, Assert.Single(root.Matches)); Assert.Null(root.Parameters); Assert.Null(root.Literals); } [Fact] public void BuildDfaTree_SingleEndpoint_Literals() { // Arrange var builder = CreateDfaMatcherBuilder(); var endpoint = CreateEndpoint("a/b/c"); builder.AddEndpoint(endpoint); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Null(a.Matches); Assert.Null(a.Parameters); next = Assert.Single(a.Literals); Assert.Equal("b", next.Key); var b = next.Value; Assert.Null(b.Matches); Assert.Null(b.Parameters); next = Assert.Single(b.Literals); Assert.Equal("c", next.Key); var c = next.Value; Assert.Same(endpoint, Assert.Single(c.Matches)); Assert.Null(c.Parameters); Assert.Null(c.Literals); } [Fact] public void BuildDfaTree_SingleEndpoint_Parameters() { // Arrange var builder = CreateDfaMatcherBuilder(); var endpoint = CreateEndpoint("{a}/{b}/{c}"); builder.AddEndpoint(endpoint); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Literals); var a = root.Parameters; Assert.Null(a.Matches); Assert.Null(a.Literals); var b = a.Parameters; Assert.Null(b.Matches); Assert.Null(b.Literals); var c = b.Parameters; Assert.Same(endpoint, Assert.Single(c.Matches)); Assert.Null(c.Parameters); Assert.Null(c.Literals); } [Fact] public void BuildDfaTree_SingleEndpoint_CatchAll() { // Arrange var builder = CreateDfaMatcherBuilder(); var endpoint = CreateEndpoint("{a}/{*b}"); builder.AddEndpoint(endpoint); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Literals); var a = root.Parameters; // The catch all can match a path like '/a' Assert.Same(endpoint, Assert.Single(a.Matches)); Assert.Null(a.Literals); Assert.Null(a.Parameters); // Catch-all nodes include an extra transition that loops to process // extra segments. var catchAll = a.CatchAll; Assert.Same(endpoint, Assert.Single(catchAll.Matches)); Assert.Null(catchAll.Literals); Assert.Same(catchAll, catchAll.Parameters); Assert.Same(catchAll, catchAll.CatchAll); } [Fact] public void BuildDfaTree_SingleEndpoint_CatchAllAtRoot() { // Arrange var builder = CreateDfaMatcherBuilder(); var endpoint = CreateEndpoint("{*a}"); builder.AddEndpoint(endpoint); // Act var root = builder.BuildDfaTree(); // Assert Assert.Same(endpoint, Assert.Single(root.Matches)); Assert.Null(root.Literals); // Catch-all nodes include an extra transition that loops to process // extra segments. var catchAll = root.CatchAll; Assert.Same(endpoint, Assert.Single(catchAll.Matches)); Assert.Null(catchAll.Literals); Assert.Same(catchAll, catchAll.Parameters); } [Fact] public void BuildDfaTree_MultipleEndpoint_LiteralAndLiteral() { // Arrange var builder = CreateDfaMatcherBuilder(); var endpoint1 = CreateEndpoint("a/b1/c"); builder.AddEndpoint(endpoint1); var endpoint2 = CreateEndpoint("a/b2/c"); builder.AddEndpoint(endpoint2); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Null(a.Matches); Assert.Equal(2, a.Literals.Count); var b1 = a.Literals["b1"]; Assert.Null(b1.Matches); Assert.Null(b1.Parameters); next = Assert.Single(b1.Literals); Assert.Equal("c", next.Key); var c1 = next.Value; Assert.Same(endpoint1, Assert.Single(c1.Matches)); Assert.Null(c1.Parameters); Assert.Null(c1.Literals); var b2 = a.Literals["b2"]; Assert.Null(b2.Matches); Assert.Null(b2.Parameters); next = Assert.Single(b2.Literals); Assert.Equal("c", next.Key); var c2 = next.Value; Assert.Same(endpoint2, Assert.Single(c2.Matches)); Assert.Null(c2.Parameters); Assert.Null(c2.Literals); } [Fact] public void BuildDfaTree_MultipleEndpoint_LiteralDifferentCase() { // Arrange var builder = CreateDfaMatcherBuilder(); var endpoint1 = CreateEndpoint("a/b1/c"); builder.AddEndpoint(endpoint1); var endpoint2 = CreateEndpoint("A/b2/c"); builder.AddEndpoint(endpoint2); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Null(a.Matches); Assert.Equal(2, a.Literals.Count); var b1 = a.Literals["b1"]; Assert.Null(b1.Matches); Assert.Null(b1.Parameters); next = Assert.Single(b1.Literals); Assert.Equal("c", next.Key); var c1 = next.Value; Assert.Same(endpoint1, Assert.Single(c1.Matches)); Assert.Null(c1.Parameters); Assert.Null(c1.Literals); var b2 = a.Literals["b2"]; Assert.Null(b2.Matches); Assert.Null(b2.Parameters); next = Assert.Single(b2.Literals); Assert.Equal("c", next.Key); var c2 = next.Value; Assert.Same(endpoint2, Assert.Single(c2.Matches)); Assert.Null(c2.Parameters); Assert.Null(c2.Literals); } [Fact] public void BuildDfaTree_MultipleEndpoint_LiteralAndParameter() { // Arrange var builder = CreateDfaMatcherBuilder(); var endpoint1 = CreateEndpoint("a/b/c"); builder.AddEndpoint(endpoint1); var endpoint2 = CreateEndpoint("a/{b}/c"); builder.AddEndpoint(endpoint2); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Null(a.Matches); next = Assert.Single(a.Literals); Assert.Equal("b", next.Key); var b = next.Value; Assert.Null(b.Matches); Assert.Null(b.Parameters); next = Assert.Single(b.Literals); Assert.Equal("c", next.Key); var c1 = next.Value; Assert.Collection( c1.Matches, e => Assert.Same(endpoint1, e), e => Assert.Same(endpoint2, e)); Assert.Null(c1.Parameters); Assert.Null(c1.Literals); var b2 = a.Parameters; Assert.Null(b2.Matches); Assert.Null(b2.Parameters); next = Assert.Single(b2.Literals); Assert.Equal("c", next.Key); var c2 = next.Value; Assert.Same(endpoint2, Assert.Single(c2.Matches)); Assert.Null(c2.Parameters); Assert.Null(c2.Literals); } [Fact] public void BuildDfaTree_MultipleEndpoint_ParameterAndParameter() { // Arrange var builder = CreateDfaMatcherBuilder(); var endpoint1 = CreateEndpoint("a/{b1}/c"); builder.AddEndpoint(endpoint1); var endpoint2 = CreateEndpoint("a/{b2}/c"); builder.AddEndpoint(endpoint2); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Null(a.Matches); Assert.Null(a.Literals); var b = a.Parameters; Assert.Null(b.Matches); Assert.Null(b.Parameters); next = Assert.Single(b.Literals); Assert.Equal("c", next.Key); var c = next.Value; Assert.Collection( c.Matches, e => Assert.Same(endpoint1, e), e => Assert.Same(endpoint2, e)); Assert.Null(c.Parameters); Assert.Null(c.Literals); } [Fact] public void BuildDfaTree_MultipleEndpoint_LiteralAndCatchAll() { // Arrange var builder = CreateDfaMatcherBuilder(); var endpoint1 = CreateEndpoint("a/b/c"); builder.AddEndpoint(endpoint1); var endpoint2 = CreateEndpoint("a/{*b}"); builder.AddEndpoint(endpoint2); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Same(endpoint2, Assert.Single(a.Matches)); next = Assert.Single(a.Literals); Assert.Equal("b", next.Key); var b1 = next.Value; Assert.Same(endpoint2, Assert.Single(a.Matches)); Assert.Null(b1.Parameters); next = Assert.Single(b1.Literals); Assert.Equal("c", next.Key); var c1 = next.Value; Assert.Collection( c1.Matches, e => Assert.Same(endpoint1, e), e => Assert.Same(endpoint2, e)); Assert.Null(c1.Parameters); Assert.Null(c1.Literals); var catchAll = a.CatchAll; Assert.Same(endpoint2, Assert.Single(catchAll.Matches)); Assert.Same(catchAll, catchAll.Parameters); Assert.Same(catchAll, catchAll.CatchAll); } [Fact] public void BuildDfaTree_MultipleEndpoint_ParameterAndCatchAll() { // Arrange var builder = CreateDfaMatcherBuilder(); var endpoint1 = CreateEndpoint("a/{b}/c"); builder.AddEndpoint(endpoint1); var endpoint2 = CreateEndpoint("a/{*b}"); builder.AddEndpoint(endpoint2); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Same(endpoint2, Assert.Single(a.Matches)); Assert.Null(a.Literals); var b1 = a.Parameters; Assert.Same(endpoint2, Assert.Single(a.Matches)); Assert.Null(b1.Parameters); next = Assert.Single(b1.Literals); Assert.Equal("c", next.Key); var c1 = next.Value; Assert.Collection( c1.Matches, e => Assert.Same(endpoint1, e), e => Assert.Same(endpoint2, e)); Assert.Null(c1.Parameters); Assert.Null(c1.Literals); var catchAll = a.CatchAll; Assert.Same(endpoint2, Assert.Single(catchAll.Matches)); Assert.Same(catchAll, catchAll.Parameters); Assert.Same(catchAll, catchAll.CatchAll); } [Fact] public void BuildDfaTree_WithPolicies() { // Arrange var builder = CreateDfaMatcherBuilder(new TestMetadata1MatcherPolicy(), new TestMetadata2MatcherPolicy()); var endpoint1 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(0), new TestMetadata2(true), }); builder.AddEndpoint(endpoint1); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Empty(a.Matches); Assert.IsType<TestMetadata1MatcherPolicy>(a.NodeBuilder); Assert.Collection( a.PolicyEdges.OrderBy(e => e.Key), e => Assert.Equal(0, e.Key)); var test1_0 = a.PolicyEdges[0]; Assert.Empty(a.Matches); Assert.IsType<TestMetadata2MatcherPolicy>(test1_0.NodeBuilder); Assert.Collection( test1_0.PolicyEdges.OrderBy(e => e.Key), e => Assert.Equal(true, e.Key)); var test2_true = test1_0.PolicyEdges[true]; Assert.Same(endpoint1, Assert.Single(test2_true.Matches)); Assert.Null(test2_true.NodeBuilder); Assert.Null(test2_true.PolicyEdges); } [Fact] public void BuildDfaTree_WithPolicies_AndBranches() { // Arrange var builder = CreateDfaMatcherBuilder(new TestMetadata1MatcherPolicy(), new TestMetadata2MatcherPolicy()); var endpoint1 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(0), new TestMetadata2(true), }); builder.AddEndpoint(endpoint1); var endpoint2 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(1), new TestMetadata2(true), }); builder.AddEndpoint(endpoint2); var endpoint3 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(1), new TestMetadata2(false), }); builder.AddEndpoint(endpoint3); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Empty(a.Matches); Assert.IsType<TestMetadata1MatcherPolicy>(a.NodeBuilder); Assert.Collection( a.PolicyEdges.OrderBy(e => e.Key), e => Assert.Equal(0, e.Key), e => Assert.Equal(1, e.Key)); var test1_0 = a.PolicyEdges[0]; Assert.Empty(test1_0.Matches); Assert.IsType<TestMetadata2MatcherPolicy>(test1_0.NodeBuilder); Assert.Collection( test1_0.PolicyEdges.OrderBy(e => e.Key), e => Assert.Equal(true, e.Key)); var test2_true = test1_0.PolicyEdges[true]; Assert.Same(endpoint1, Assert.Single(test2_true.Matches)); Assert.Null(test2_true.NodeBuilder); Assert.Null(test2_true.PolicyEdges); var test1_1 = a.PolicyEdges[1]; Assert.Empty(test1_1.Matches); Assert.IsType<TestMetadata2MatcherPolicy>(test1_1.NodeBuilder); Assert.Collection( test1_1.PolicyEdges.OrderBy(e => e.Key), e => Assert.Equal(false, e.Key), e => Assert.Equal(true, e.Key)); test2_true = test1_1.PolicyEdges[true]; Assert.Same(endpoint2, Assert.Single(test2_true.Matches)); Assert.Null(test2_true.NodeBuilder); Assert.Null(test2_true.PolicyEdges); var test2_false = test1_1.PolicyEdges[false]; Assert.Same(endpoint3, Assert.Single(test2_false.Matches)); Assert.Null(test2_false.NodeBuilder); Assert.Null(test2_false.PolicyEdges); } [Fact] public void BuildDfaTree_WithPolicies_AndBranches_FirstPolicySkipped() { // Arrange var builder = CreateDfaMatcherBuilder(new TestMetadata1MatcherPolicy(), new TestMetadata2MatcherPolicy()); var endpoint1 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata2(true), }); builder.AddEndpoint(endpoint1); var endpoint2 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata2(true), }); builder.AddEndpoint(endpoint2); var endpoint3 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata2(false), }); builder.AddEndpoint(endpoint3); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Empty(a.Matches); Assert.IsType<TestMetadata2MatcherPolicy>(a.NodeBuilder); Assert.Collection( a.PolicyEdges.OrderBy(e => e.Key), e => Assert.Equal(false, e.Key), e => Assert.Equal(true, e.Key)); var test2_true = a.PolicyEdges[true]; Assert.Equal(new[] { endpoint1, endpoint2, }, test2_true.Matches); Assert.Null(test2_true.NodeBuilder); Assert.Null(test2_true.PolicyEdges); var test2_false = a.PolicyEdges[false]; Assert.Equal(new[] { endpoint3, }, test2_false.Matches); Assert.Null(test2_false.NodeBuilder); Assert.Null(test2_false.PolicyEdges); } [Fact] public void BuildDfaTree_WithPolicies_AndBranches_SecondSkipped() { // Arrange var builder = CreateDfaMatcherBuilder(new TestMetadata1MatcherPolicy(), new TestMetadata2MatcherPolicy()); var endpoint1 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(0), }); builder.AddEndpoint(endpoint1); var endpoint2 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(1), }); builder.AddEndpoint(endpoint2); var endpoint3 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(1), }); builder.AddEndpoint(endpoint3); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Empty(a.Matches); Assert.IsType<TestMetadata1MatcherPolicy>(a.NodeBuilder); Assert.Collection( a.PolicyEdges.OrderBy(e => e.Key), e => Assert.Equal(0, e.Key), e => Assert.Equal(1, e.Key)); var test1_0 = a.PolicyEdges[0]; Assert.Equal(new[] { endpoint1, }, test1_0.Matches); Assert.Null(test1_0.NodeBuilder); Assert.Null(test1_0.PolicyEdges); var test1_1 = a.PolicyEdges[1]; Assert.Equal(new[] { endpoint2, endpoint3, }, test1_1.Matches); Assert.Null(test1_1.NodeBuilder); Assert.Null(test1_1.PolicyEdges); } [Fact] public void BuildDfaTree_WithPolicies_AndBranches_NonRouteEndpoint() { // Arrange var builder = CreateDfaMatcherBuilder(new TestNonRoutePatternMatcherPolicy()); var endpoint1 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(0), }); builder.AddEndpoint(endpoint1); var endpoint2 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(1), }); builder.AddEndpoint(endpoint2); var endpoint3 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(1), }); builder.AddEndpoint(endpoint3); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Empty(a.Matches); Assert.IsType<TestNonRoutePatternMatcherPolicy>(a.NodeBuilder); Assert.Collection( a.PolicyEdges.OrderBy(e => e.Key), e => Assert.Equal(0, e.Key), e => Assert.Equal(1, e.Key), e => Assert.Equal(int.MaxValue, e.Key)); var test1_0 = a.PolicyEdges[0]; Assert.Equal(new[] { endpoint1, }, test1_0.Matches); Assert.Null(test1_0.NodeBuilder); Assert.Null(test1_0.PolicyEdges); var test1_1 = a.PolicyEdges[1]; Assert.Equal(new[] { endpoint2, endpoint3, }, test1_1.Matches); Assert.Null(test1_1.NodeBuilder); Assert.Null(test1_1.PolicyEdges); var nonRouteEndpoint = a.PolicyEdges[int.MaxValue]; Assert.Equal("MaxValueEndpoint", Assert.Single(nonRouteEndpoint.Matches).DisplayName); } [Fact] public void BuildDfaTree_WithPolicies_AndBranches_BothPoliciesSkipped() { // Arrange var builder = CreateDfaMatcherBuilder(new TestMetadata1MatcherPolicy(), new TestMetadata2MatcherPolicy()); var endpoint1 = CreateEndpoint("/a", metadata: new object[] { }); builder.AddEndpoint(endpoint1); var endpoint2 = CreateEndpoint("/a", metadata: new object[] { }); builder.AddEndpoint(endpoint2); var endpoint3 = CreateEndpoint("/a", metadata: new object[] { }); builder.AddEndpoint(endpoint3); // Act var root = builder.BuildDfaTree(); // Assert Assert.Null(root.Matches); Assert.Null(root.Parameters); var next = Assert.Single(root.Literals); Assert.Equal("a", next.Key); var a = next.Value; Assert.Equal(new[] { endpoint1, endpoint2, endpoint3, }, a.Matches); Assert.Null(a.NodeBuilder); Assert.Null(a.PolicyEdges); } [Fact] public void CreateCandidate_JustLiterals() { // Arrange var endpoint = CreateEndpoint("/a/b/c"); var builder = CreateDfaMatcherBuilder(); // Act var candidate = builder.CreateCandidate(endpoint, score: 0); // Assert Assert.Equal(Candidate.CandidateFlags.None, candidate.Flags); Assert.Empty(candidate.Slots); Assert.Empty(candidate.Captures); Assert.Equal(default, candidate.CatchAll); Assert.Empty(candidate.ComplexSegments); Assert.Empty(candidate.Constraints); } [Fact] public void CreateCandidate_Parameters() { // Arrange var endpoint = CreateEndpoint("/{a}/{b}/{c}"); var builder = CreateDfaMatcherBuilder(); // Act var candidate = builder.CreateCandidate(endpoint, score: 0); // Assert Assert.Equal(Candidate.CandidateFlags.HasCaptures, candidate.Flags); Assert.Equal(3, candidate.Slots.Length); Assert.Collection( candidate.Captures, c => Assert.Equal(("a", 0, 0), c), c => Assert.Equal(("b", 1, 1), c), c => Assert.Equal(("c", 2, 2), c)); Assert.Equal(default, candidate.CatchAll); Assert.Empty(candidate.ComplexSegments); Assert.Empty(candidate.Constraints); } [Fact] public void CreateCandidate_Parameters_WithDefaults() { // Arrange var endpoint = CreateEndpoint("/{a=aa}/{b=bb}/{c=cc}"); var builder = CreateDfaMatcherBuilder(); // Act var candidate = builder.CreateCandidate(endpoint, score: 0); // Assert Assert.Equal( Candidate.CandidateFlags.HasDefaults | Candidate.CandidateFlags.HasCaptures, candidate.Flags); Assert.Collection( candidate.Slots, s => Assert.Equal(new KeyValuePair<string, object>("a", "aa"), s), s => Assert.Equal(new KeyValuePair<string, object>("b", "bb"), s), s => Assert.Equal(new KeyValuePair<string, object>("c", "cc"), s)); Assert.Collection( candidate.Captures, c => Assert.Equal(("a", 0, 0), c), c => Assert.Equal(("b", 1, 1), c), c => Assert.Equal(("c", 2, 2), c)); Assert.Equal(default, candidate.CatchAll); Assert.Empty(candidate.ComplexSegments); Assert.Empty(candidate.Constraints); } [Fact] public void CreateCandidate_Parameters_CatchAll() { // Arrange var endpoint = CreateEndpoint("/{a}/{b}/{*c=cc}"); var builder = CreateDfaMatcherBuilder(); // Act var candidate = builder.CreateCandidate(endpoint, score: 0); // Assert Assert.Equal( Candidate.CandidateFlags.HasDefaults | Candidate.CandidateFlags.HasCaptures | Candidate.CandidateFlags.HasCatchAll, candidate.Flags); Assert.Collection( candidate.Slots, s => Assert.Equal(new KeyValuePair<string, object>("c", "cc"), s), s => Assert.Equal(new KeyValuePair<string, object>(null, null), s), s => Assert.Equal(new KeyValuePair<string, object>(null, null), s)); Assert.Collection( candidate.Captures, c => Assert.Equal(("a", 0, 1), c), c => Assert.Equal(("b", 1, 2), c)); Assert.Equal(("c", 2, 0), candidate.CatchAll); Assert.Empty(candidate.ComplexSegments); Assert.Empty(candidate.Constraints); } // Defaults are processed first, which affects the slot ordering. [Fact] public void CreateCandidate_Parameters_OutOfLineDefaults() { // Arrange var endpoint = CreateEndpoint("/{a}/{b}/{c=cc}", new { a = "aa", d = "dd", }); var builder = CreateDfaMatcherBuilder(); // Act var candidate = builder.CreateCandidate(endpoint, score: 0); // Assert Assert.Equal( Candidate.CandidateFlags.HasDefaults | Candidate.CandidateFlags.HasCaptures, candidate.Flags); Assert.Collection( candidate.Slots, s => Assert.Equal(new KeyValuePair<string, object>("a", "aa"), s), s => Assert.Equal(new KeyValuePair<string, object>("d", "dd"), s), s => Assert.Equal(new KeyValuePair<string, object>("c", "cc"), s), s => Assert.Equal(new KeyValuePair<string, object>(null, null), s)); Assert.Collection( candidate.Captures, c => Assert.Equal(("a", 0, 0), c), c => Assert.Equal(("b", 1, 3), c), c => Assert.Equal(("c", 2, 2), c)); Assert.Equal(default, candidate.CatchAll); Assert.Empty(candidate.ComplexSegments); Assert.Empty(candidate.Constraints); } [Fact] public void CreateCandidate_Parameters_ComplexSegments() { // Arrange var endpoint = CreateEndpoint("/{a}-{b=bb}/{c}"); var builder = CreateDfaMatcherBuilder(); // Act var candidate = builder.CreateCandidate(endpoint, score: 0); // Assert Assert.Equal( Candidate.CandidateFlags.HasDefaults | Candidate.CandidateFlags.HasCaptures | Candidate.CandidateFlags.HasComplexSegments, candidate.Flags); Assert.Collection( candidate.Slots, s => Assert.Equal(new KeyValuePair<string, object>("b", "bb"), s), s => Assert.Equal(new KeyValuePair<string, object>(null, null), s)); Assert.Collection( candidate.Captures, c => Assert.Equal(("c", 1, 1), c)); Assert.Equal(default, candidate.CatchAll); Assert.Collection( candidate.ComplexSegments, s => Assert.Equal(0, s.segmentIndex)); Assert.Empty(candidate.Constraints); } [Fact] public void CreateCandidate_RouteConstraints() { // Arrange var endpoint = CreateEndpoint("/a/b/c", constraints: new { a = new IntRouteConstraint(), }); var builder = CreateDfaMatcherBuilder(); // Act var candidate = builder.CreateCandidate(endpoint, score: 0); // Assert Assert.Equal(Candidate.CandidateFlags.HasConstraints, candidate.Flags); Assert.Empty(candidate.Slots); Assert.Empty(candidate.Captures); Assert.Equal(default, candidate.CatchAll); Assert.Empty(candidate.ComplexSegments); Assert.Single(candidate.Constraints); } [Fact] public void CreateCandidate_CustomParameterPolicy() { // Arrange var endpoint = CreateEndpoint("/a/b/c", constraints: new { a = new CustomParameterPolicy(), }); var builder = CreateDfaMatcherBuilder(); // Act var candidate = builder.CreateCandidate(endpoint, score: 0); // Assert Assert.Equal(Candidate.CandidateFlags.None, candidate.Flags); Assert.Empty(candidate.Slots); Assert.Empty(candidate.Captures); Assert.Equal(default, candidate.CatchAll); Assert.Empty(candidate.ComplexSegments); Assert.Empty(candidate.Constraints); } private class CustomParameterPolicy : IParameterPolicy { } [Fact] public void CreateCandidates_CreatesScoresCorrectly() { // Arrange var endpoints = new[] { CreateEndpoint("/a/b/c", constraints: new { a = new IntRouteConstraint(), }, metadata: new object[] { new TestMetadata1(), new TestMetadata2(), }), CreateEndpoint("/a/b/c", constraints: new { a = new AlphaRouteConstraint(), }, metadata: new object[] { new TestMetadata1(), new TestMetadata2(), }), CreateEndpoint("/a/b/c", constraints: new { a = new IntRouteConstraint(), }, metadata: new object[] { new TestMetadata1(), }), CreateEndpoint("/a/b/c", constraints: new { a = new IntRouteConstraint(), }, metadata: new object[] { new TestMetadata2(), }), CreateEndpoint("/a/b/c", constraints: new { }, metadata: new object[] { }), CreateEndpoint("/a/b/c", constraints: new { }, metadata: new object[] { }), }; var builder = CreateDfaMatcherBuilder(new TestMetadata1MatcherPolicy(), new TestMetadata2MatcherPolicy()); // Act var candidates = builder.CreateCandidates(endpoints); // Assert Assert.Collection( candidates, c => Assert.Equal(0, c.Score), c => Assert.Equal(0, c.Score), c => Assert.Equal(1, c.Score), c => Assert.Equal(2, c.Score), c => Assert.Equal(3, c.Score), c => Assert.Equal(3, c.Score)); } private static DfaMatcherBuilder CreateDfaMatcherBuilder(params MatcherPolicy[] policies) { var dataSource = new CompositeEndpointDataSource(Array.Empty<EndpointDataSource>()); return new DfaMatcherBuilder( NullLoggerFactory.Instance, new DefaultParameterPolicyFactory(Options.Create(new RouteOptions()), Mock.Of<IServiceProvider>()), Mock.Of<EndpointSelector>(), policies); } private RouteEndpoint CreateEndpoint( string template, object defaults = null, object constraints = null, params object[] metadata) { return new RouteEndpoint( TestConstants.EmptyRequestDelegate, RoutePatternFactory.Parse(template, new RouteValueDictionary(defaults), new RouteValueDictionary(constraints)), 0, new EndpointMetadataCollection(metadata), "test"); } private class TestMetadata1 { public TestMetadata1() { } public TestMetadata1(int state) { State = state; } public int State { get; set; } } private class TestMetadata1MatcherPolicy : MatcherPolicy, IEndpointComparerPolicy, INodeBuilderPolicy { public override int Order => 100; public IComparer<Endpoint> Comparer => EndpointMetadataComparer<TestMetadata1>.Default; public bool AppliesToEndpoints(IReadOnlyList<Endpoint> endpoints) { return endpoints.Any(e => e.Metadata.GetMetadata<TestMetadata1>() != null); } public PolicyJumpTable BuildJumpTable(int exitDestination, IReadOnlyList<PolicyJumpTableEdge> edges) { throw new NotImplementedException(); } public IReadOnlyList<PolicyNodeEdge> GetEdges(IReadOnlyList<Endpoint> endpoints) { return endpoints .GroupBy(e => e.Metadata.GetMetadata<TestMetadata1>().State) .Select(g => new PolicyNodeEdge(g.Key, g.ToArray())) .ToArray(); } } private class TestMetadata2 { public TestMetadata2() { } public TestMetadata2(bool state) { State = state; } public bool State { get; set; } } private class TestMetadata2MatcherPolicy : MatcherPolicy, IEndpointComparerPolicy, INodeBuilderPolicy { public override int Order => 101; public IComparer<Endpoint> Comparer => EndpointMetadataComparer<TestMetadata2>.Default; public bool AppliesToEndpoints(IReadOnlyList<Endpoint> endpoints) { return endpoints.Any(e => e.Metadata.GetMetadata<TestMetadata2>() != null); } public PolicyJumpTable BuildJumpTable(int exitDestination, IReadOnlyList<PolicyJumpTableEdge> edges) { throw new NotImplementedException(); } public IReadOnlyList<PolicyNodeEdge> GetEdges(IReadOnlyList<Endpoint> endpoints) { return endpoints .GroupBy(e => e.Metadata.GetMetadata<TestMetadata2>().State) .Select(g => new PolicyNodeEdge(g.Key, g.ToArray())) .ToArray(); } } private class TestNonRoutePatternMatcherPolicy : MatcherPolicy, IEndpointComparerPolicy, INodeBuilderPolicy { public override int Order => 100; public IComparer<Endpoint> Comparer => EndpointMetadataComparer<TestMetadata1>.Default; public bool AppliesToEndpoints(IReadOnlyList<Endpoint> endpoints) { return endpoints.Any(e => e.Metadata.GetMetadata<TestMetadata1>() != null); } public PolicyJumpTable BuildJumpTable(int exitDestination, IReadOnlyList<PolicyJumpTableEdge> edges) { throw new NotImplementedException(); } public IReadOnlyList<PolicyNodeEdge> GetEdges(IReadOnlyList<Endpoint> endpoints) { var edges = endpoints .GroupBy(e => e.Metadata.GetMetadata<TestMetadata1>().State) .Select(g => new PolicyNodeEdge(g.Key, g.ToArray())) .ToList(); var maxValueEndpoint = new Endpoint(TestConstants.EmptyRequestDelegate, EndpointMetadataCollection.Empty, "MaxValueEndpoint"); edges.Add(new PolicyNodeEdge(int.MaxValue, new[] { maxValueEndpoint })); return edges; } } } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE map SYSTEM "http://mapeditor.org/dtd/1.0/map.dtd"> <map version="1.0" orientation="orthogonal" width="128" height="128" tilewidth="32" tileheight="32"> <tileset firstgid="1" name="../../tileset/ground/water/water.png" tilewidth="32" tileheight="32"> <image source="../../tileset/ground/water/water.png"/> </tileset> <tileset firstgid="25" name="../../tileset/ground/indoor/brown.png" tilewidth="32" tileheight="32"> <image source="../../tileset/ground/indoor/brown.png" trans="ff00ff"/> </tileset> <tileset firstgid="31" name="../../tileset/ground/indoor/brown_hole.png" tilewidth="32" tileheight="32"> <image source="../../tileset/ground/indoor/brown_hole.png" trans="ff00ff"/> </tileset> <tileset firstgid="87" name="../../tileset/furniture/chair/wooden_pale.png" tilewidth="32" tileheight="32"> <image source="../../tileset/furniture/chair/wooden_pale.png"/> </tileset> <tileset firstgid="91" name="../../tileset/furniture/table/long_side_on_pale.png" tilewidth="32" tileheight="32"> <image source="../../tileset/furniture/table/long_side_on_pale.png"/> </tileset> <tileset firstgid="94" name="../../tileset/item/pot/pot_burgundy.png" tilewidth="32" tileheight="32"> <image source="../../tileset/item/pot/pot_burgundy.png" trans="ffffff"/> </tileset> <tileset firstgid="95" name="../../tileset/ground/ladder/small.png" tilewidth="32" tileheight="32"> <image source="../../tileset/ground/ladder/small.png" trans="ff00ff"/> </tileset> <tileset firstgid="96" name="../../tileset/item/pot/barrel.png" tilewidth="32" tileheight="32"> <image source="../../tileset/item/pot/barrel.png" trans="ff00ff"/> </tileset> <tileset firstgid="98" name="../../tileset/furniture/table/grey_pale.png" tilewidth="32" tileheight="32"> <image source="../../tileset/furniture/table/grey_pale.png" trans="ff00ff"/> </tileset> <tileset firstgid="106" name="../../tileset/furniture/table/table_with_beer.png" tilewidth="32" tileheight="32"> <image source="../../tileset/furniture/table/table_with_beer.png" trans="ff00ff"/> </tileset> <tileset firstgid="114" name="../../tileset/furniture/carpet/plain_colours.png" tilewidth="32" tileheight="32"> <image source="../../tileset/furniture/carpet/plain_colours.png"/> </tileset> <tileset firstgid="124" name="../../tileset/furniture/table/table_with_hob.png" tilewidth="32" tileheight="32"> <image source="../../tileset/furniture/table/table_with_hob.png" trans="ff00ff"/> </tileset> <tileset firstgid="129" name="../../tileset/furniture/table/grey_plain.png" tilewidth="32" tileheight="32"> <image source="../../tileset/furniture/table/grey_plain.png"/> </tileset> <tileset firstgid="138" name="../../tileset/building/stairs/dark_stairs.png" tilewidth="32" tileheight="32"> <image source="../../tileset/building/stairs/dark_stairs.png" trans="ff00ff"/> </tileset> <tileset firstgid="140" name="../../tileset/item/food/meals_2.png" tilewidth="32" tileheight="32"> <image source="../../tileset/item/food/meals_2.png"/> </tileset> <tileset firstgid="142" name="../../tileset/item/drink/red_wine.png" tilewidth="32" tileheight="32"> <image source="../../tileset/item/drink/red_wine.png"/> </tileset> <tileset firstgid="146" name="logic/creature/small_animal" tilewidth="32" tileheight="32"> <image source="../../tileset/logic/creature/rodent.png"/> </tileset> <tileset firstgid="151" name="logic/portal" tilewidth="32" tileheight="32"> <image source="../../tileset/logic/portal.png"/> </tileset> <tileset firstgid="167" name="logic/collision" tilewidth="32" tileheight="32"> <image source="../../tileset/logic/collision.png"/> </tileset> <tileset firstgid="168" name="item/firewood" tilewidth="32" tileheight="32"> <image source="../../tileset/item/firewood.png"/> </tileset> <layer name="0_floor" width="128" height="128"> <data encoding="base64" compression="gzip"> H4sIAAAAAAAAAO3Z0QqCMBiAUcGn6AXSm5Iiw97/xVJCGOKQMFxs5+KAyC5++FY6rKuqqgEAAAAA AAAAAAAAAIDsnHZKPT/7+59HTaAN7rcba1LPz/7+l9E10AX3u401qedHf37bf9JErvXPS6x/H7nW Py/+/8s2NXxUn9/47LnSP7Ym9fzs7x8T9nf+z9Pa2X4Wvv8tOf/nIfb+t8XzPw/6l03/sulfNv3L pn/Z9GcY3b5ofx+9/mBujt8D2udraw9on79B++JNe6Bf0L4svvMBAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAABwtDfnTonSAAABAA== </data> </layer> <layer name="1_terrain" width="128" height="128"> <data encoding="base64" compression="gzip"> H4sIAAAAAAAAAO3YS0rEQBQF0FqHjW5LwV/8gT1SR05UUAe2W3HqBn2NBso2hgimCpJz4JKQ0YNb eYNKCQAAAAAAAAAAAAAAAIA5u4vcRx5qD8K/283ym6vIdeSmyESUtB85iBzWHoQq9rIwP0P2f64Z bxQqGLL/HyNPkeek/6kZsv9fIqvIa5GJgJKO0+deb8N8HNUegKr6+j+NXGY5KzIRJfX1v4zcZlkW mYiS+vo/T9///4siE1HS28Yz1977t3H/Pz3r3t9Td/9Mn/7naRHZ/nr/S/87ka1RJqK0/AycZN+b 1H0fpPvpyc9Aq0k/7wF1P12bZ6BJ/vu56doDa7qfj0XHN90DAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAwtg/YQVujAAABAA== </data> </layer> <layer name="2_object" width="128" height="128"> <data encoding="base64" compression="gzip"> H4sIAAAAAAAAAO3RsQkAIBRDQfdXCzdxRP8Ogim8g/QP0hoAAAAAAAAAAAAAAAAAAADwi1FbtZkO AQAArvV0AAAROx1AlP8BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4 4QD96bD8AAABAA== </data> </layer> <layer name="4_roof_add" width="128" height="128"> <data encoding="base64" compression="gzip"> H4sIAAAAAAAAAO3OAQ0AAAgDoPdPY0RjfDpIQAIAAAAAAAAAAAAAAAAAAAAAAAAAXDHtAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACvLW7hin8AAAEA </data> </layer> <layer name="objects" width="128" height="128" visible="0"> <data encoding="base64" compression="gzip"> H4sIAAAAAAAAAO3XsQ0AIAgEQPdvrXRaKxMXMBC4m+CLTx7GAAAAAAAAAAAAAAAAAKCqGR2AlPSC SxcAAKCOFR2AFPx50M+ODgCEsfsA0Jc7gJc+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAC/HLyWO1kAAAEA </data> </layer> <layer name="collision" width="128" height="128" visible="0" opacity="0.37"> <data encoding="base64" compression="gzip"> H4sIAAAAAAAAAO3SUQqDMBAE0Nz/Il6zX4WybKQtmsHwFh4mGmFgcowxDgAAAAAAAAAAAAAAAAC2 083RrOs/6dys7b87w/PVLsfHs65Hec/z/Tvp3OT6T2fm2v67/SjrdE7u67+O/nlPOgfr+u76n006 L9f3/8uk87Km/9nZdF7W9d/t03lZ1393Np2X6/s/uwd10nm57x58M+mc6J9M/+mM3N/77Hs6J2vu wNk79vWe2Z791UnnAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPb2Ah9Q zJsAAAEA </data> </layer> <layer name="protection" width="128" height="128" visible="0"> <data encoding="base64" compression="gzip"> H4sIAAAAAAAAAO3BAQEAAACAkP6v7ggKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAauuOl9cAAAEA </data> </layer> </map>
{ "pile_set_name": "Github" }
package com.subgraph.orchid.directory.parsing; public interface DocumentParsingHandler { void parseKeywordLine(); void endOfDocument(); }
{ "pile_set_name": "Github" }
// Copyright 2013 // Author: Christopher Van Arsdale #include <string> #include "common/log/log.h" #include "common/strings/path.h" #include "common/strings/strutil.h" #include "repobuild/env/input.h" #include "repobuild/env/target.h" #include "repobuild/nodes/util.h" using std::string; namespace repobuild { // static string NodeUtil::StripSpecialDirs(const Input& input, const string& path) { string dir = path; while (true) { if (strings::HasPrefix(dir, input.genfile_dir())) { dir = dir.substr(std::min(input.genfile_dir().size() + 1, dir.size())); continue; } if (strings::HasPrefix(dir, input.source_dir())) { dir = dir.substr(std::min(input.source_dir().size() + 1, dir.size())); continue; } if (strings::HasPrefix(dir, input.object_dir())) { dir = dir.substr(std::min(input.object_dir().size() + 1, dir.size())); continue; } if (strings::HasPrefix(dir, input.pkgfile_dir())) { dir = dir.substr(std::min(input.pkgfile_dir().size() + 1, dir.size())); continue; } break; } return dir; } // static bool NodeUtil::StartsWithSpecialDirs(const Input& input, const string& path) { return (strings::HasPrefix(path, input.genfile_dir()) || strings::HasPrefix(path, input.source_dir()) || strings::HasPrefix(path, input.object_dir()) || strings::HasPrefix(path, input.pkgfile_dir())); } ComponentHelper::ComponentHelper(const std::string& component, const std::string& base_dir) : component_(component), base_dir_(base_dir) { } ComponentHelper::~ComponentHelper() { } string ComponentHelper::RewriteFile(const Input& input, const string& path) const { string file = NodeUtil::StripSpecialDirs(input, path); if (!base_dir_.empty() && strings::HasPrefix(file, base_dir_ + "/")) { file = file.substr(base_dir_.size() + 1); if (!component_.empty()) { return strings::JoinPath(component_, file); } } return file; } bool ComponentHelper::RewriteDependency(TargetInfo* target) const { VLOG(2) << "RewriteDependency: " << target->full_path(); if (!target->was_relative() && target->top_component() == component_) { string new_dir; if (target->dir().size() > component_.size()) { new_dir = strings::JoinPath(base_dir_, target->dir().substr(component_.size() + 1)); } else { new_dir = base_dir_; } *target = TargetInfo("//" + new_dir + ":" + target->local_path()); VLOG(2) << "Rewrote: " << target->full_path(); return true; } return false; } bool ComponentHelper::CoversPath(const Input& input, const string& path) const { string file = NodeUtil::StripSpecialDirs(input, path); return strings::HasPrefix(file, base_dir_); } } // namespace repobuild
{ "pile_set_name": "Github" }
/** * MetroFramework - Modern UI for WinForms * * The MIT License (MIT) * Copyright (c) 2011 Sven Walter, http://github.com/viperneo * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in the * Software without restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to the * following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System; using System.Collections.Generic; using System.Text; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Drawing.Text; namespace MetroFramework.Drawing { internal sealed class MetroBackBuffer { private Bitmap backBuffer; public MetroBackBuffer(Size bufferSize) { backBuffer = new Bitmap(bufferSize.Width, bufferSize.Height, PixelFormat.Format32bppArgb); } public Graphics CreateGraphics() { Graphics g = Graphics.FromImage(backBuffer); g.CompositingMode = CompositingMode.SourceOver; g.CompositingQuality = CompositingQuality.HighQuality; g.InterpolationMode = InterpolationMode.High; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.SmoothingMode = SmoothingMode.AntiAlias; g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; return g; } public void Draw(Graphics g) { g.DrawImageUnscaled(backBuffer, Point.Empty); } } }
{ "pile_set_name": "Github" }
#!/usr/bin/env roseus (load "irteus/kalmanlib.l") (ros::load-ros-manifest "roseus") (ros::load-ros-manifest "posedetection_msgs") (ros::roseus "marker-publish") (ros::roseus-add-msgs "posedetection_msgs") (setq *map-id* "/map") (setq *solve-tf* t) (setq *object-width* (ros::get-param "~object_width" 0)) (setq *object-height* (ros::get-param "~object_height" 0)) (setq *relative-pose-str* (ros::get-param "~relative_pose" "0 0 0 0 0 0 1")) (setq *detection-topic* (ros::get-param "~detection_topic" "/kinect_head/rgb/ObjectDetection")) (setq *marker-life* (ros::get-param "~marker_life" 300)) (setq *base-frame-id* (ros::get-param "~base_frame_id" "/base_footprint")) (setq *calc-kalman* t) (setq *detect-flag* t) (setq *tf-force* nil) (setq *target-obj* (make-cube 60 60 60)) (send *target-obj* :reset-coords) (setf (get *target-obj* :type) (ros::get-param "~target_type" nil)) (setq *map-frame-objectdetection* (instance posedetection_msgs::ObjectDetection :init)) (send *map-frame-objectdetection* :header :frame_id *map-id*) (setq *filtered-objectdetection* (instance posedetection_msgs::ObjectDetection :init)) (send *filtered-objectdetection* :header :frame_id *map-id*) (setq *kfs-lst* nil) (setq *list-of-target-x-pos* nil) (setq *threshold-of-target-x-pos-diff* 30) ; mm (setq *average-of-target-x-pos* 0) (defclass kalman-filters :super propertied-object :slots (kfp kfr) ) (defmethod kalman-filters (:init (&key (pos (float-vector 0 0 0)) (yaw (float-vector 0))) (setq kfp (instance kalman-filter :init :state-dim 3 :measure-dim 3 :q-variance 1)) (send kfp :x (float-vector (elt pos 0) (elt pos 1) (elt pos 2))) (setq kfr (instance kalman-filter :init :state-dim 2 :measure-dim 1 :q-variance 0.1)) (send kfr :x (float-vector yaw 0)) ;; (send kfp :x pos) ;; (send kfp :A (make-array (list 3 3))) ;; (send kfp :A #2f((1 0 0 1 0 0) (0 1 0 0 1 0) (0 0 1 0 0 1) (0 0 0 1 0 0) (0 0 0 0 1 0) (0 0 0 0 0 1))) ;; (send kfr :A (make-array (list 2 2))) ;; (send kfr :A #2f((1 1) (0 1))) ;; (setq kfr (instance kalman-filter :init :state-dim 1 :measure-dim 1)) ;; (send kfr :x (float-vector yaw)) ) (:pos (p) (send kfp :x p) ) (:yaw (y) (send kfr :x y) ) (:proc (z1 z2) (let (h1 h2) (setq h1 (send kfp :proc z1 :adaptive t :m 3)) (setq h2 (send kfr :proc (float-vector z2) :adaptive t :m 30)) (list h1 h2) )) (:P () (send kfp :P) )) (defmethod coordinates (:stamp (&optional s) (if s (setf (get self :stamp) s)) (get self :stamp)) (:frame_id (&optional f) (if f (setf (get self :frame_id) f)) (get self :frame_id))) (defun remap-to-map-frame-and-store-ObjectDetection (target-obj msg) (let ((obj-lst (send msg :objects)) (frame (send msg :header :frame_id)) (tp (get target-obj :type)) tmp-obj-lst stamp trans) (ros::ros-debug "object detection callback target ~A(~A), frame ~A, object ~A" tp (stringp tp) frame target-obj) (dolist (obj obj-lst) (when (or (not (stringp tp)) (substringp tp (send obj :type))) ;; found target (setq stamp (if *tf-force* (ros::time 0) (send msg :header :stamp))) (cond (*solve-tf* (unless (boundp '*tfl*) (setq *tfl* (instance ros::transform-listener :init))) (unless (send *tfl* :wait-for-transform *map-id* frame stamp 1) (ros::ros-error "could not solve ~A to ~A" *map-id* frame)) (setq trans (send *tfl* :lookup-transform *map-id* frame stamp)) (ros::ros-debug "trans ~A" trans)) (t (setq trans (make-coords)))) (when trans (let ((tmp-obj (instance posedetection_msgs::Object6DPose :init))) (ros::ros-info "object detected ~A ~A ~20,9f" (send obj :type) (ros::tf-pose->coords (send obj :pose)) (send (send msg :header :stamp) :to-sec)) (send target-obj :name (send obj :type)) (send target-obj :stamp (send msg :header :stamp)) (send target-obj :frame_id (send msg :header :frame_id)) (send target-obj :reset-coords) (send target-obj :move-to trans :local) (send target-obj :move-to (ros::tf-pose->coords (send obj :pose)) :local) (send tmp-obj :pose (ros::coords->tf-pose target-obj)) (send tmp-obj :type (send obj :type)) (setq tmp-obj-lst (append tmp-obj-lst (list tmp-obj))) (when (find-method target-obj :update-descendants) (send target-obj :update-descendants) ;; clean me ) (unless (boundp '*tfb*) (setq *tfb* (instance ros::transform-broadcaster :init))) (send *tfb* :send-transform (ros::tf-pose->coords (send obj :pose)) frame (send target-obj :name)) )))) (send *map-frame-objectdetection* :objects tmp-obj-lst) (send *map-frame-objectdetection* :header :stamp (send msg :header :stamp)) )) (defun publish-marker (target-obj marker-life &key (publish-name "object_detection_marker_array") (object-name *map-frame-objectdetection*) (text-name nil) (text-color nil) (obj-color nil)) (let ((mf-obj-lst (send object-name :objects)) (tmp-tgtobj (make-cube 60 60 60)) (tp (get target-obj :type))) (when obj-color (send tmp-tgtobj :set-color obj-color)) (dolist (obj mf-obj-lst) (when (or (not (stringp tp)) (substringp tp (send obj :type))) ;; found target (send tmp-tgtobj :move-to (ros::tf-pose->coords (send obj :pose)) :local) (ros::publish publish-name (instance visualization_msgs::MarkerArray :init :markers (list (text->marker-msg (cond (text-name text-name) (t (send obj :type) )) (send (send (ros::tf-pose->coords (send obj :pose)) :copy-worldcoords) :translate #f(-100 0 100)) (send object-name :header) :ns (format nil "object_text_~A" (send obj :type)) :color (cond (text-color text-color) (t #f(1 0 0))) :scale 100 :lifetime marker-life :id 0) (coords->marker-msg (send (ros::tf-pose->coords (send obj :pose)) :copy-worldcoords) (send object-name :header) :ns (format nil "object_coords_~A" (send obj :type)) ;; :size 200 :width 20 :lifetime marker-life :id 1) (object->marker-msg tmp-tgtobj (send object-name :header) :ns (format nil "object_body_~A" (send obj :type)) :lifetime marker-life :id 2) ))))))) (defun catch-outlier (target-obj) (let ((mf-obj-lst (send *map-frame-objectdetection* :objects)) (tmp-tgtobj (make-cube 60 60 60)) (marker-life 700) (outlierflag nil) (tp (get target-obj :type))) (dolist (obj mf-obj-lst) (when (or (not (stringp tp)) (substringp tp (send obj :type))) ;; found target (send tmp-tgtobj :move-to (ros::tf-pose->coords (send obj :pose)) :local) (cond ((< (length *list-of-target-x-pos*) 20) ;;stock only (setq *list-of-target-x-pos* (append *list-of-target-x-pos* (list (aref (send tmp-tgtobj :pos) 0)))) ) (t (setq *average-of-target-x-pos* 0) (dolist (x *list-of-target-x-pos* nil) (setq *average-of-target-x-pos* (+ *average-of-target-x-pos* x)) ) (setq *average-of-target-x-pos* (/ *average-of-target-x-pos* 20)) (ros::ros-info "ave:~A x: ~A diff:~A outlierflag:~A" *average-of-target-x-pos* (aref (send tmp-tgtobj :pos) 0) (abs (- *average-of-target-x-pos* (aref (send tmp-tgtobj :pos) 0))) (< *threshold-of-target-x-pos-diff* (abs (- *average-of-target-x-pos* (aref (send tmp-tgtobj :pos) 0)))) ) (cond ((< *threshold-of-target-x-pos-diff* (abs (- *average-of-target-x-pos* (aref (send tmp-tgtobj :pos) 0)))) ;; outsider (ros::ros-info "publish outlier") (setq outlierflag t) (setq *list-of-target-x-pos* (append (cdr *list-of-target-x-pos*) (list (aref (send tmp-tgtobj :pos) 0)))) ) (t ;; inside ;; like queue (setq *list-of-target-x-pos* (append (cdr *list-of-target-x-pos*) (list (aref (send tmp-tgtobj :pos) 0)))) )))))) (when outlierflag (publish-marker target-obj *marker-life* :publish-name "outlier" :object-name *map-frame-objectdetection* :text-name "outlier" :text-color (float-vector 0 1 0) :obj-color (float-vector 0.4 1 0.4)) ) (return-from catch-outlier outlierflag) )) (defparameter *poselist* nil) (defun add-to-xlist (x) (setq *poselist* (append *poselist* (list x))) (cond ((> (length *poselist*) 10) (setq *poselist* (cdr *poselist*)) ) (t nil))) (defun calc-covariance () (let ((x-cov 0) (y-cov 0) (z-cov 0) (x-ave 0) (y-ave 0) (z-ave 0)) ;; (ros::ros-info "poselist:~A" *poselist*) (dolist (pose *poselist*) (setq x-ave (+ x-ave (send pose :position :x))) (setq y-ave (+ y-ave (send pose :position :y))) (setq z-ave (+ z-ave (send pose :position :z))) ) (setq x-ave (/ (* 1.0 x-ave) (length *poselist*))) (setq y-ave (/ (* 1.0 y-ave) (length *poselist*))) (setq z-ave (/ (* 1.0 z-ave) (length *poselist*))) ;; (ros::ros-info "x-ave:~A" x-ave) (dolist (pose *poselist*) (setq x-cov (+ x-cov (* (- (send pose :position :x) x-ave) (- (send pose :position :x) x-ave)))) (setq y-cov (+ y-cov (* (- (send pose :position :y) y-ave) (- (send pose :position :y) y-ave)))) (setq z-cov (+ z-cov (* (- (send pose :position :z) z-ave) (- (send pose :position :z) z-ave)))) ) (setq x-cov (/ (* 1.0 x-cov) (length *poselist*))) (setq y-cov (/ (* 1.0 y-cov) (length *poselist*))) (setq z-cov (/ (* 1.0 z-cov) (length *poselist*))) ;; too small (setq x-cov (* x-cov 100)) (setq y-cov (* y-cov 100)) (setq z-cov (* z-cov 100)) ;; (ros::ros-info "x-cov:~A" x-cov) ;; (return-from calc-covariance (list x-cov y-cov z-cov)) (list x-cov y-cov z-cov) )) (defun simply-calc-covariance-and-pub-PoseStamped-and-PoseWithCovarianceStamped (target-obj &key (object-name *map-frame-objectdetection*)) (let* ((mf-obj-lst (send object-name :objects)) (tmp-posestamped (instance geometry_msgs::PoseStamped :init)) (tp (get target-obj :type)) (relative-pose-stream (make-string-input-stream *relative-pose-str*)) (tmp-pose (instance geometry_msgs::Pose :init)) covlst (tmp-posewithcovariancestamped (instance geometry_msgs::PoseWithCovarianceStamped :init)) (tmp-cov (send tmp-posewithcovariancestamped :pose :covariance)) ) ;; currently considered only 1 kind of data comes (dolist (obj mf-obj-lst) (when (or (not (stringp tp)) (substringp tp (send obj :type))) ;; found target (add-to-xlist (send obj :pose)) )) (setf covlst (calc-covariance)) (send tmp-pose :position :x (read relative-pose-stream nil)) (send tmp-pose :position :y (read relative-pose-stream nil)) (send tmp-pose :position :z (read relative-pose-stream nil)) (send tmp-pose :orientation :x (read relative-pose-stream nil)) (send tmp-pose :orientation :y (read relative-pose-stream nil)) (send tmp-pose :orientation :z (read relative-pose-stream nil)) (send tmp-pose :orientation :w (read relative-pose-stream nil)) (setq inverse-trans (send (send (ros::tf-pose->coords tmp-pose) :inverse-transformation) :translate (float-vector (* (/ *object-height* 2.0) 1000) (* (/ *object-width* 2.0) 1000) 0))) (dolist (obj mf-obj-lst) (when (or (not (stringp tp)) (substringp tp (send obj :type))) ;; found target (let ((tmp-coords (send (ros::tf-pose->coords (send obj :pose)) :copy-worldcoords))) (send tmp-coords :transform inverse-trans) (send tmp-posestamped :pose (ros::coords->tf-pose tmp-coords)) (send tmp-posestamped :header (send object-name :header)) ))) (setf (elt tmp-cov 0) (car covlst)) (setf (elt tmp-cov 7) (cadr covlst)) (setf (elt tmp-cov 14) (caddr covlst)) (unless (eq (car covlst) 0.0) (ros::ros-info "simplecov x:~A y:~A z:~A" (car covlst) (cadr covlst) (caddr covlst)) (setf (elt tmp-cov 21) 0.1) (setf (elt tmp-cov 28) 0.1) (setf (elt tmp-cov 35) 0.1) (send tmp-posewithcovariancestamped :header (send object-name :header)) (send tmp-posewithcovariancestamped :pose :pose (send tmp-posestamped :pose)) (send tmp-posewithcovariancestamped :pose :covariance tmp-cov) (ros::publish "simplecov" tmp-posewithcovariancestamped) ) )) (defun apply-kalman-filter-to-mapframeobjectdetection () (let ((mf-obj-lst (send *map-frame-objectdetection* :objects)) (flag t) ) (dolist (obj mf-obj-lst) (dolist (kf *kfs-lst*) (cond ((equal (get kf :type) (send obj :type)) (let ((ps (send (ros::tf-pose->coords (send obj :pose)) :pos)) (yaw (elt (elt (rpy-angle (send (ros::tf-pose->coords (send obj :pose)) :rot)) 0) 0)) z^ ) (setq flag nil) (setq z^ (send kf :proc ps yaw)) (dolist (fo (send *filtered-objectdetection* :objects)) (cond ((equal (get kf :type) (send fo :type)) (let ((tmp-coords (make-coords))) (send tmp-coords :locate (elt z^ 0)) (send tmp-coords :rotate (elt (elt z^ 1) 0) :z) (send fo :pose (ros::coords->tf-pose tmp-coords)))) (t nil))) )) (t nil))) (if flag (progn (let ((tmp-kfs (instance kalman-filters :init :pos (send (ros::tf-pose->coords (send obj :pose)) :pos) :yaw (elt (elt (rpy-angle (send (ros::tf-pose->coords (send obj :pose)) :rot)) 0) 0))) tmp-fo ) (setf (get tmp-kfs :type) (send obj :type)) (setq *kfs-lst* (append *kfs-lst* (list tmp-kfs))) (send *filtered-objectdetection* :objects (append (send *filtered-objectdetection* :objects) (list obj))) )))) (send *filtered-objectdetection* :header (send *map-frame-objectdetection* :header)) )) (defun pub-PoseStamped-and-PoseWithCovarianceStamped (target-obj &key (object-name *map-frame-objectdetection*)) (let ((mf-obj-lst (send object-name :objects)) (tmp-posestamped (instance geometry_msgs::PoseStamped :init)) (tmp-posewithcovariancestamped (instance geometry_msgs::PoseWithCovarianceStamped :init)) (relative-pose-stream (make-string-input-stream *relative-pose-str*)) (tmp-pose (instance geometry_msgs::Pose :init)) (tp (get target-obj :type))) (ros::unsubscribe "/openni_c2/rgb/image_rect_color") (send tmp-pose :position :x (read relative-pose-stream nil)) (send tmp-pose :position :y (read relative-pose-stream nil)) (send tmp-pose :position :z (read relative-pose-stream nil)) (send tmp-pose :orientation :x (read relative-pose-stream nil)) (send tmp-pose :orientation :y (read relative-pose-stream nil)) (send tmp-pose :orientation :z (read relative-pose-stream nil)) (send tmp-pose :orientation :w (read relative-pose-stream nil)) (print-ros-msg tmp-pose) (setq inverse-trans (send (send (ros::tf-pose->coords tmp-pose) :inverse-transformation) :translate (float-vector (* (/ *object-height* 2.0) 1000) (* (/ *object-width* 2.0) 1000) 0))) (dolist (obj mf-obj-lst) (when (or (not (stringp tp)) (substringp tp (send obj :type))) ;; found target (let ((tmp-coords (send (ros::tf-pose->coords (send obj :pose)) :copy-worldcoords))) (send tmp-coords :transform inverse-trans) (send tmp-posestamped :pose (ros::coords->tf-pose tmp-coords)) (send tmp-posestamped :header (send object-name :header)) ))) (unless (null *kfs-lst*) (let ((cov (send (car *kfs-lst*) :P)) (tmp-cov (send tmp-posewithcovariancestamped :pose :covariance))) (setq *pwc* tmp-cov) (setq *cov* cov) (setf (elt tmp-cov 0) (/ (elt (matrix-row cov 0) 0) 100.0)) (setf (elt tmp-cov 1) (/ (elt (matrix-row cov 0) 1) 100.0)) (setf (elt tmp-cov 2) (/ (elt (matrix-row cov 0) 2) 100.0)) (setf (elt tmp-cov 6) (/ (elt (matrix-row cov 1) 0) 100.0)) (setf (elt tmp-cov 7) (/ (elt (matrix-row cov 1) 1) 100.0)) (setf (elt tmp-cov 8) (/ (elt (matrix-row cov 1) 2) 100.0)) (setf (elt tmp-cov 12) (/ (elt (matrix-row cov 2) 0) 100.0)) (setf (elt tmp-cov 13) (/ (elt (matrix-row cov 2) 1) 100.0)) (setf (elt tmp-cov 14) (/ (elt (matrix-row cov 2) 2) 100.0)) (setf (elt tmp-cov 21) 0.1) (setf (elt tmp-cov 28) 0.1) (setf (elt tmp-cov 35) 0.1) (ros::ros-info "estimated covariance of adaptive kalmanfilter:~A" cov) (ros::ros-info "poswithcovariance: ~A" tmp-cov) (send tmp-posewithcovariancestamped :header (send object-name :header)) (send tmp-posewithcovariancestamped :pose :pose (send tmp-posestamped :pose)) (send tmp-posewithcovariancestamped :pose :covariance tmp-cov) (ros::publish "posewithcovstamped" tmp-posewithcovariancestamped) )) (ros::publish "attention_clipper/input/pose" tmp-posestamped) )) (defun attention-init (msg) (let ((tmp-pose (instance geometry_msgs::Pose :init)) (tmp-pose-stamped (instance geometry_msgs::PoseStamped :init)) (header (instance std_msgs::header :init)) ) (send tmp-pose :position :x 0) (send tmp-pose :position :y 0) (send tmp-pose :position :z 0.2) (send tmp-pose :orientation :x 0) (send tmp-pose :orientation :y 0) (send tmp-pose :orientation :z 0) (send tmp-pose :orientation :w 1) (send header :stamp (ros::time 0)) (send header :frame_id "/openni_rgb_optical_frame") (send tmp-pose-stamped :pose tmp-pose) (send tmp-pose-stamped :header header) (ros::publish "attention_clipper/input/pose" tmp-pose-stamped) )) (defun pub-cb (target-obj msg) (let () ;; remap to map-frame and store it to *mapframe-objectdetection* (remap-to-map-frame-and-store-ObjectDetection target-obj msg) (when *calc-kalman* (cond ((send target-obj :stamp);;for avoiding tf error (publish-marker target-obj *marker-life* :text-name "raw" :obj-color (float-vector 1 0.4 0.4)) (simply-calc-covariance-and-pub-PoseStamped-and-PoseWithCovarianceStamped target-obj) (when (null (catch-outlier target-obj)) ;; avoiding divergence by outlier (apply-kalman-filter-to-mapframeobjectdetection) (publish-marker target-obj *marker-life* :object-name *filtered-objectdetection* :publish-name "filtered" :obj-color (float-vector 0.4 0.4 1) :text-color (float-vector 0 0 1) :text-name "filtered") (pub-PoseStamped-and-PoseWithCovarianceStamped target-obj) )) (t nil) )))) (defun target-obj-cb (req) (let ((m (send req :response)) (cds (make-coords)) (tmp-coords (instance posedetection_msgs::Object6DPose :init)) ts) (send tmp-coords :pose :orientation :w 1) (send tmp-coords :reliability 0.5) (unless (boundp '*tfl*) (setq *tfl* (instance ros::transform-listener :init))) (unless (send *tfl* :wait-for-transform *base-frame-id* *map-id* (ros::time 0) 1) (ros::ros-error "could not solve ~A to ~A" *base-frame-id* *map-id*)) (setq ts (send *tfl* :lookup-transform *base-frame-id* *map-id* (ros::time 0))) (ros::ros-info "ts ~A" ts) (send cds :reset-coords) (cond ((and ts (send *map-frame-objectdetection* :objects)) (send cds :move-to ts :local) (Let ((mf-obj-lst (send *map-frame-objectdetection* :objects)) (tp (send req :type))) (dolist (obj mf-obj-lst) (when (or (not (stringp tp)) (substringp tp (send obj :type))) ;; found target (send cds :move-to (ros::tf-pose->coords (send obj :pose)) :local) (send tmp-coords :pose (ros::coords->tf-pose (send cds :copy-worldcoords))) (send tmp-coords :type (send obj :type)) (ros::ros-info "in cb tmp-coords:(~A ~A ~A)" (send (send (send tmp-coords :pose) :position) :x) (send (send (send tmp-coords :pose) :position) :y) (send (send (send tmp-coords :pose) :position) :z)))))) (t (send tmp-coords :reliability 0) nil)) (ros::ros-info "cds:~A" (send cds :worldcoords)) (send m :object_pose tmp-coords) (ros::ros-info "reliability:~A type:~A" (send (send m :object_pose) :reliability) (send (send m :object_pose) :type)) m)) (defun detect-switch-cb (msg) (ros::ros-debug "detect-switch data:~A" (send msg :data)) (setq *detect-flag* (send msg :data)) (when *detect-flag* ;; reflesh (setq *map-frame-objectdetection* (instance posedetection_msgs::ObjectDetection :init)) (send *map-frame-objectdetection* :header :frame_id *map-id*) ;; avoiding header error in rviz )) (ros::advertise "object_detection_marker_array" visualization_msgs::MarkerArray 5) (ros::advertise "filtered" visualization_msgs::MarkerArray 5) (ros::advertise "outlier" visualization_msgs::MarkerArray 5) (ros::advertise "attention_clipper/input/pose" geometry_msgs::PoseStamped 1) (ros::advertise "posewithcovstamped" geometry_msgs::PoseWithCovarianceStamped 1) (ros::advertise "simplecov" geometry_msgs::PoseWithCovarianceStamped 1) (ros::advertise-service "targetobj" posedetection_msgs::TargetObj #'target-obj-cb) (ros::subscribe "input/image" sensor_msgs::Image #'attention-init) (ros::subscribe "input/switch" std_msgs::Bool #'detect-switch-cb) (ros::rate 10) (while t (ros::spin-once) (cond (*detect-flag* (ros::subscribe "input/ObjectDetection" posedetection_msgs::ObjectDetection #'pub-cb *target-obj*)) (t (ros::unsubscribe detection-topic))) (ros::sleep))
{ "pile_set_name": "Github" }
<?php /** * Shopware 5 * Copyright (c) shopware AG * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Shopware" is a registered trademark of shopware AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ namespace Shopware\Components\Model; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Repository\RepositoryFactory; use Doctrine\Persistence\ObjectRepository; class ProxyAwareRepositoryFactory implements RepositoryFactory { /** * The list of EntityRepository instances. * * @var ObjectRepository[] */ private $repositoryList = []; /** * @var \Enlight_Hook_HookManager */ private $hookManager; public function __construct(\Enlight_Hook_HookManager $hookManager) { $this->hookManager = $hookManager; } /** * {@inheritdoc} */ public function getRepository(EntityManagerInterface $entityManager, $entityName) { $entityName = ltrim($entityName, '\\'); $repositoryHash = $entityManager->getClassMetadata($entityName)->getName() . spl_object_hash($entityManager); if (isset($this->repositoryList[$repositoryHash])) { return $this->repositoryList[$repositoryHash]; } return $this->repositoryList[$repositoryHash] = $this->createRepository($entityManager, $entityName); } /** * @param string $entityName * * @return ObjectRepository */ private function createRepository(EntityManagerInterface $entityManager, $entityName) { /* @var \Doctrine\ORM\Mapping\ClassMetadata $metadata */ $metadata = $entityManager->getClassMetadata($entityName); /** @var string|null $repositoryClassName */ $repositoryClassName = $metadata->customRepositoryClassName; if ($repositoryClassName === null) { $repositoryClassName = $entityManager->getConfiguration()->getDefaultRepositoryClassName(); } $repositoryClassName = $this->hookManager->getProxy($repositoryClassName); return new $repositoryClassName($entityManager, $metadata); } }
{ "pile_set_name": "Github" }
{ "images" : [ { "idiom" : "universal", "filename" : "[email protected]", "scale" : "1x" }, { "idiom" : "universal", "filename" : "[email protected]", "scale" : "2x" }, { "idiom" : "universal", "filename" : "[email protected]", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2002-2020 "Neo4j," * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j 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/>. */ package org.neo4j.cypher.result; import org.neo4j.cypher.internal.runtime.QueryStatistics; import org.neo4j.kernel.impl.query.QuerySubscription; import org.neo4j.memory.OptionalMemoryTracker; /** * The result API of a Cypher runtime */ public interface RuntimeResult extends AutoCloseable, QuerySubscription, OptionalMemoryTracker { enum ConsumptionState { NOT_STARTED, HAS_MORE, EXHAUSTED } /** * Names of the returned fields of this result. */ String[] fieldNames(); /** * Returns the consumption state of this result. This state changes when the result is served */ ConsumptionState consumptionState(); /** * Get the {@link QueryStatistics} related to this query execution. */ QueryStatistics queryStatistics(); /** * Get the {@link QueryProfile} of this query execution. */ QueryProfile queryProfile(); @Override void close(); }
{ "pile_set_name": "Github" }
/*********************************************************************** * * Copyright (c) 2012-2020 Barbara Geller * Copyright (c) 2012-2020 Ansel Sermersheim * * Copyright (c) 2015 The Qt Company Ltd. * Copyright (c) 2012-2016 Digia Plc and/or its subsidiary(-ies). * Copyright (c) 2008-2012 Nokia Corporation and/or its subsidiary(-ies). * * This file is part of CopperSpice. * * CopperSpice is free software. You can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * CopperSpice 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. * * https://www.gnu.org/licenses/ * ***********************************************************************/ #include <qaccessiblewidget_complex_p.h> #include <qaccessible.h> #include <qapplication.h> #include <qabstractbutton.h> #include <qevent.h> #include <qheaderview.h> #include <qtabbar.h> #include <qcombobox.h> #include <qlistview.h> #include <qtableview.h> #include <qlineedit.h> #include <qstyle.h> #include <qstyleoption.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qtreeview.h> #include <qabstractscrollarea.h> #include <qscrollarea.h> #include <qscrollbar.h> #include <qdebug.h> #include <qtabbar_p.h> #ifndef QT_NO_ACCESSIBILITY QString qt_accStripAmp(const QString &text); QString qt_accHotKey(const QString &text); #ifndef QT_NO_TABBAR /*! \class QAccessibleTabBar \brief The QAccessibleTabBar class implements the QAccessibleInterface for tab bars. \internal \ingroup accessibility */ class QAccessibleTabButton: public QAccessibleInterface, public QAccessibleActionInterface { public: QAccessibleTabButton(QTabBar *parent, int index) : m_parent(parent), m_index(index) {} void *interface_cast(QAccessible::InterfaceType t) override { if (t == QAccessible::ActionInterface) { return static_cast<QAccessibleActionInterface *>(this); } return 0; } QObject *object() const override { return 0; } QAccessible::Role role() const override { return QAccessible::PageTab; } QAccessible::State state() const override { if (!isValid()) { QAccessible::State s; s.invalid = true; return s; } return parent()->state(); } QRect rect() const override { if (!isValid()) { return QRect(); } QPoint tp = m_parent->mapToGlobal(QPoint(0, 0)); QRect rec = m_parent->tabRect(m_index); rec = QRect(tp.x() + rec.x(), tp.y() + rec.y(), rec.width(), rec.height()); return rec; } bool isValid() const override { return m_parent.data() && m_parent->count() > m_index; } QAccessibleInterface *childAt(int, int) const override { return 0; } int childCount() const override { return 0; } int indexOfChild(const QAccessibleInterface *) const override { return -1; } QString text(QAccessible::Text t) const override { if (!isValid()) { return QString(); } switch (t) { case QAccessible::Name: return qt_accStripAmp(m_parent->tabText(m_index)); case QAccessible::Accelerator: return qt_accHotKey(m_parent->tabText(m_index)); case QAccessible::Description: return m_parent->tabToolTip(m_index); case QAccessible::Help: return m_parent->tabWhatsThis(m_index); default: break; } return QString(); } void setText(QAccessible::Text, const QString &) override {} QAccessibleInterface *parent() const override { return QAccessible::queryAccessibleInterface(m_parent.data()); } QAccessibleInterface *child(int) const override { return 0; } // action interface QStringList actionNames() const override { return QStringList(pressAction()); } void doAction(const QString &actionName) override { if (isValid() && actionName == pressAction()) { m_parent->setCurrentIndex(m_index); } } QStringList keyBindingsForAction(const QString &) const override { return QStringList(); } int index() const { return m_index; } private: QPointer<QTabBar> m_parent; int m_index; }; /*! Constructs a QAccessibleTabBar object for \a w. */ QAccessibleTabBar::QAccessibleTabBar(QWidget *w) : QAccessibleWidget(w, QAccessible::PageTabList) { Q_ASSERT(tabBar()); } QAccessibleTabBar::~QAccessibleTabBar() { for (QAccessible::Id id : m_childInterfaces) { QAccessible::deleteAccessibleInterface(id); } } /*! Returns the QTabBar. */ QTabBar *QAccessibleTabBar::tabBar() const { return qobject_cast<QTabBar *>(object()); } QAccessibleInterface *QAccessibleTabBar::child(int index) const { if (QAccessible::Id id = m_childInterfaces.value(index)) { return QAccessible::accessibleInterface(id); } // first the tabs, then 2 buttons if (index < tabBar()->count()) { QAccessibleTabButton *button = new QAccessibleTabButton(tabBar(), index); QAccessible::registerAccessibleInterface(button); m_childInterfaces.insert(index, QAccessible::uniqueId(button)); return button; } else if (index >= tabBar()->count()) { // left button if (index - tabBar()->count() == 0) { return QAccessible::queryAccessibleInterface(tabBar()->d_func()->leftB); } // right button if (index - tabBar()->count() == 1) { return QAccessible::queryAccessibleInterface(tabBar()->d_func()->rightB); } } return 0; } int QAccessibleTabBar::indexOfChild(const QAccessibleInterface *child) const { if (child->object() && child->object() == tabBar()->d_func()->leftB) { return tabBar()->count(); } if (child->object() && child->object() == tabBar()->d_func()->rightB) { return tabBar()->count() + 1; } if (child->role() == QAccessible::PageTab) { QAccessibleInterface *parent = child->parent(); if (parent == this) { const QAccessibleTabButton *tabButton = static_cast<const QAccessibleTabButton *>(child); return tabButton->index(); } } return -1; } int QAccessibleTabBar::childCount() const { // tabs + scroll buttons return tabBar()->count() + 2; } QString QAccessibleTabBar::text(QAccessible::Text t) const { if (t == QAccessible::Name) { return qt_accStripAmp(tabBar()->tabText(tabBar()->currentIndex())); } else if (t == QAccessible::Accelerator) { return qt_accHotKey(tabBar()->tabText(tabBar()->currentIndex())); } return QString(); } #endif // QT_NO_TABBAR #ifndef QT_NO_COMBOBOX /*! \class QAccessibleComboBox \brief The QAccessibleComboBox class implements the QAccessibleInterface for editable and read-only combo boxes. \internal \ingroup accessibility */ /*! Constructs a QAccessibleComboBox object for \a w. */ QAccessibleComboBox::QAccessibleComboBox(QWidget *w) : QAccessibleWidget(w, QAccessible::ComboBox) { Q_ASSERT(comboBox()); } /*! Returns the combobox. */ QComboBox *QAccessibleComboBox::comboBox() const { return qobject_cast<QComboBox *>(object()); } QAccessibleInterface *QAccessibleComboBox::child(int index) const { if (index == 0) { QAbstractItemView *view = comboBox()->view(); //QWidget *parent = view ? view->parentWidget() : 0; return QAccessible::queryAccessibleInterface(view); } else if (index == 1 && comboBox()->isEditable()) { return QAccessible::queryAccessibleInterface(comboBox()->lineEdit()); } return 0; } int QAccessibleComboBox::childCount() const { // list and text edit return comboBox()->isEditable() ? 2 : 1; } QAccessibleInterface *QAccessibleComboBox::childAt(int x, int y) const { if (comboBox()->isEditable() && comboBox()->lineEdit()->rect().contains(x, y)) { return child(1); } return 0; } int QAccessibleComboBox::indexOfChild(const QAccessibleInterface *child) const { if (comboBox()->view() == child->object()) { return 0; } if (comboBox()->isEditable() && comboBox()->lineEdit() == child->object()) { return 1; } return -1; } /*! \reimp */ QString QAccessibleComboBox::text(QAccessible::Text t) const { QString str; switch (t) { case QAccessible::Name: #ifdef Q_OS_UNIX // on Linux we use relations for this, name is text (fall through to Value) [[fallthrough]]; #else str = QAccessibleWidget::text(t); break; #endif case QAccessible::Value: if (comboBox()->isEditable()) { str = comboBox()->lineEdit()->text(); } else { str = comboBox()->currentText(); } break; #ifndef QT_NO_SHORTCUT case QAccessible::Accelerator: str = QKeySequence(Qt::Key_Down).toString(QKeySequence::NativeText); break; #endif default: break; } if (str.isEmpty()) { str = QAccessibleWidget::text(t); } return str; } QStringList QAccessibleComboBox::actionNames() const { return QStringList() << showMenuAction() << pressAction(); } QString QAccessibleComboBox::localizedActionDescription(const QString &actionName) const { if (actionName == showMenuAction() || actionName == pressAction()) { return QComboBox::tr("Open the combo box selection popup"); } return QString(); } void QAccessibleComboBox::doAction(const QString &actionName) { if (actionName == showMenuAction() || actionName == pressAction()) { if (comboBox()->view()->isVisible()) { comboBox()->hidePopup(); } else { comboBox()->showPopup(); } } } QStringList QAccessibleComboBox::keyBindingsForAction(const QString &/*actionName*/) const { return QStringList(); } #endif // QT_NO_COMBOBOX #ifndef QT_NO_SCROLLAREA // ======================= QAccessibleAbstractScrollArea ======================= QAccessibleAbstractScrollArea::QAccessibleAbstractScrollArea(QWidget *widget) : QAccessibleWidget(widget, QAccessible::Client) { Q_ASSERT(qobject_cast<QAbstractScrollArea *>(widget)); } QAccessibleInterface *QAccessibleAbstractScrollArea::child(int index) const { return QAccessible::queryAccessibleInterface(accessibleChildren().at(index)); } int QAccessibleAbstractScrollArea::childCount() const { return accessibleChildren().count(); } int QAccessibleAbstractScrollArea::indexOfChild(const QAccessibleInterface *child) const { if (!child || !child->object()) { return -1; } return accessibleChildren().indexOf(qobject_cast<QWidget *>(child->object())); } bool QAccessibleAbstractScrollArea::isValid() const { return (QAccessibleWidget::isValid() && abstractScrollArea() && abstractScrollArea()->viewport()); } QAccessibleInterface *QAccessibleAbstractScrollArea::childAt(int x, int y) const { if (!abstractScrollArea()->isVisible()) { return 0; } for (int i = 0; i < childCount(); ++i) { QPoint wpos = accessibleChildren().at(i)->mapToGlobal(QPoint(0, 0)); QRect rect = QRect(wpos, accessibleChildren().at(i)->size()); if (rect.contains(x, y)) { return child(i); } } return 0; } QAbstractScrollArea *QAccessibleAbstractScrollArea::abstractScrollArea() const { return static_cast<QAbstractScrollArea *>(object()); } QWidgetList QAccessibleAbstractScrollArea::accessibleChildren() const { QWidgetList children; // Viewport. QWidget *viewport = abstractScrollArea()->viewport(); if (viewport) { children.append(viewport); } // Horizontal scrollBar container. QScrollBar *horizontalScrollBar = abstractScrollArea()->horizontalScrollBar(); if (horizontalScrollBar && horizontalScrollBar->isVisible()) { children.append(horizontalScrollBar->parentWidget()); } // Vertical scrollBar container. QScrollBar *verticalScrollBar = abstractScrollArea()->verticalScrollBar(); if (verticalScrollBar && verticalScrollBar->isVisible()) { children.append(verticalScrollBar->parentWidget()); } // CornerWidget. QWidget *cornerWidget = abstractScrollArea()->cornerWidget(); if (cornerWidget && cornerWidget->isVisible()) { children.append(cornerWidget); } return children; } QAccessibleAbstractScrollArea::AbstractScrollAreaElement QAccessibleAbstractScrollArea::elementType(QWidget *widget) const { if (!widget) { return Undefined; } if (widget == abstractScrollArea()) { return Self; } if (widget == abstractScrollArea()->viewport()) { return Viewport; } if (widget->objectName() == QLatin1String("qt_scrollarea_hcontainer")) { return HorizontalContainer; } if (widget->objectName() == QLatin1String("qt_scrollarea_vcontainer")) { return VerticalContainer; } if (widget == abstractScrollArea()->cornerWidget()) { return CornerWidget; } return Undefined; } bool QAccessibleAbstractScrollArea::isLeftToRight() const { return abstractScrollArea()->isLeftToRight(); } // ======================= QAccessibleScrollArea =========================== QAccessibleScrollArea::QAccessibleScrollArea(QWidget *widget) : QAccessibleAbstractScrollArea(widget) { Q_ASSERT(qobject_cast<QScrollArea *>(widget)); } #endif // QT_NO_SCROLLAREA #endif // QT_NO_ACCESSIBILITY
{ "pile_set_name": "Github" }
package common import ( "math/rand" "testing" ) func TestPackLe16AgainstGeneric(t *testing.T) { var p Poly var buf1, buf2 [PolyLe16Size]byte for j := 0; j < 1000; j++ { for i := 0; i < 256; i++ { p[i] = uint32(rand.Intn(16)) } p.PackLe16(buf1[:]) p.packLe16Generic(buf2[:]) if buf1 != buf2 { t.Fatal() } } } func BenchmarkPackLe16(b *testing.B) { var p Poly var buf [PolyLe16Size]byte for i := 0; i < b.N; i++ { p.PackLe16(buf[:]) } } func BenchmarkPackLe16Generic(b *testing.B) { var p Poly var buf [PolyLe16Size]byte for i := 0; i < b.N; i++ { p.packLe16Generic(buf[:]) } } func BenchmarkUnpackLeGamma1(b *testing.B) { var p Poly var buf [PolyLeGamma1Size]byte for i := 0; i < b.N; i++ { p.UnpackLeGamma1(buf[:]) } }
{ "pile_set_name": "Github" }
INSERT INTO jforum_categories (category_id, category_title, category_order, category_moderated) VALUES (1, 'c1', 0, 0) INSERT INTO jforum_forums (forum_id, category_id, forum_name, forum_order, forum_moderated) VALUES (1, 1, 'f1.1', 0, 0) INSERT INTO jforum_users (user_id, username, user_password, user_email, user_active, USER_ATTACHSIG, USER_ALLOWAVATAR, USER_ALLOWBBCODE, USER_ALLOWHTML, DELETED, USER_NOTIFY_ALWAYS, USER_NOTIFY_PM, USER_ALLOW_PM, RANK_ID, USER_ALLOWSMILIES, USER_POSTS, USER_VIEWEMAIL, USER_ALLOW_VIEWONLINE, USER_NOTIFY_TEXT, user_notify) VALUES (1, 'u1', 'x', 'y', 0, 0, 0, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, 0) INSERT INTO jforum_topics (topic_id, forum_id, topic_subject, user_id, topic_date, TOPIC_STATUS, TOPIC_REPLIES, TOPIC_VIEWS, TOPIC_TYPE, TOPIC_VOTE_ID, topic_moved_id, need_moderate,has_attachment) VALUES (1, 1, 't1.1', 1, CURRENT_TIMESTAMP, 0, 0, 0, 0, null, 0, 0,false) INSERT INTO jforum_topics (topic_id, forum_id, topic_subject, user_id, topic_date, TOPIC_STATUS, TOPIC_REPLIES, TOPIC_VIEWS, TOPIC_TYPE, TOPIC_VOTE_ID, topic_moved_id, need_moderate,has_attachment) VALUES (2, 1, 't1.2', 1, CURRENT_TIMESTAMP, 0, 0, 0, 0, null, 0, 0,false) INSERT INTO jforum_posts (post_id, topic_id, user_id, post_date, need_moderate, enable_bbcode, post_edit_count, attach, enable_html, enable_sig, enable_smilies) VALUES (1, 1, 1, '2008-06-11 14:54:32', 0, 0, 0, 0, 0, 0, 0) INSERT INTO jforum_posts (post_id, topic_id, user_id, post_date, need_moderate, enable_bbcode, post_edit_count, attach, enable_html, enable_sig, enable_smilies) VALUES (2, 1, 1, '2008-06-11 14:54:33', 0, 0, 0, 0, 0, 0, 0) INSERT INTO jforum_posts (post_id, topic_id, user_id, post_date, need_moderate, enable_bbcode, post_edit_count, attach, enable_html, enable_sig, enable_smilies) VALUES (3, 1, 1, '2008-06-11 14:54:33', 0, 0, 0, 0, 0, 0, 0) INSERT INTO jforum_posts (post_id, topic_id, user_id, post_date, need_moderate, enable_bbcode, post_edit_count, attach, enable_html, enable_sig, enable_smilies) VALUES (4, 2, 1, '2008-06-11 14:54:34', 0, 0, 0, 0, 0, 0, 0)
{ "pile_set_name": "Github" }
// Copyright (C) 2012 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.gerrit.server.restapi.change; import static com.google.gerrit.extensions.conditions.BooleanCondition.and; import static com.google.gerrit.server.project.ProjectCache.illegalState; import com.google.gerrit.entities.BranchNameKey; import com.google.gerrit.entities.RefNames; import com.google.gerrit.extensions.api.changes.CherryPickInput; import com.google.gerrit.extensions.common.ChangeInfo; import com.google.gerrit.extensions.restapi.BadRequestException; import com.google.gerrit.extensions.restapi.ResourceConflictException; import com.google.gerrit.extensions.restapi.Response; import com.google.gerrit.extensions.restapi.RestApiException; import com.google.gerrit.extensions.restapi.RestModifyView; import com.google.gerrit.extensions.webui.UiAction; import com.google.gerrit.server.change.ChangeJson; import com.google.gerrit.server.change.RevisionResource; import com.google.gerrit.server.permissions.PermissionBackend; import com.google.gerrit.server.permissions.PermissionBackendException; import com.google.gerrit.server.permissions.ProjectPermission; import com.google.gerrit.server.permissions.RefPermission; import com.google.gerrit.server.project.ContributorAgreementsChecker; import com.google.gerrit.server.project.InvalidChangeOperationException; import com.google.gerrit.server.project.NoSuchChangeException; import com.google.gerrit.server.project.NoSuchProjectException; import com.google.gerrit.server.project.ProjectCache; import com.google.gerrit.server.project.ProjectState; import com.google.gerrit.server.update.UpdateException; import com.google.inject.Inject; import com.google.inject.Singleton; import java.io.IOException; import org.eclipse.jgit.errors.ConfigInvalidException; @Singleton public class CherryPick implements RestModifyView<RevisionResource, CherryPickInput>, UiAction<RevisionResource> { private final PermissionBackend permissionBackend; private final CherryPickChange cherryPickChange; private final ChangeJson.Factory json; private final ContributorAgreementsChecker contributorAgreements; private final ProjectCache projectCache; @Inject CherryPick( PermissionBackend permissionBackend, CherryPickChange cherryPickChange, ChangeJson.Factory json, ContributorAgreementsChecker contributorAgreements, ProjectCache projectCache) { this.permissionBackend = permissionBackend; this.cherryPickChange = cherryPickChange; this.json = json; this.contributorAgreements = contributorAgreements; this.projectCache = projectCache; } @Override public Response<ChangeInfo> apply(RevisionResource rsrc, CherryPickInput input) throws IOException, UpdateException, RestApiException, PermissionBackendException, ConfigInvalidException, NoSuchProjectException { input.parent = input.parent == null ? 1 : input.parent; if (input.destination == null || input.destination.trim().isEmpty()) { throw new BadRequestException("destination must be non-empty"); } String refName = RefNames.fullName(input.destination); contributorAgreements.check(rsrc.getProject(), rsrc.getUser()); permissionBackend .currentUser() .project(rsrc.getChange().getProject()) .ref(refName) .check(RefPermission.CREATE_CHANGE); projectCache .get(rsrc.getProject()) .orElseThrow(illegalState(rsrc.getProject())) .checkStatePermitsWrite(); try { CherryPickChange.Result cherryPickResult = cherryPickChange.cherryPick( rsrc.getChange(), rsrc.getPatchSet(), input, BranchNameKey.create(rsrc.getProject(), refName)); ChangeInfo changeInfo = json.noOptions().format(rsrc.getProject(), cherryPickResult.changeId()); changeInfo.containsGitConflicts = !cherryPickResult.filesWithGitConflicts().isEmpty() ? true : null; return Response.ok(changeInfo); } catch (InvalidChangeOperationException e) { throw new BadRequestException(e.getMessage()); } catch (NoSuchChangeException e) { throw new ResourceConflictException(e.getMessage()); } } @Override public UiAction.Description getDescription(RevisionResource rsrc) { boolean projectStatePermitsWrite = projectCache.get(rsrc.getProject()).map(ProjectState::statePermitsWrite).orElse(false); return new UiAction.Description() .setLabel("Cherry Pick") .setTitle("Cherry pick change to a different branch") .setVisible( and( rsrc.isCurrent() && projectStatePermitsWrite, permissionBackend .currentUser() .project(rsrc.getProject()) .testCond(ProjectPermission.CREATE_CHANGE))); } }
{ "pile_set_name": "Github" }
{ stdenv , fetchFromGitHub , nix-update-script , python3 , meson , ninja , vala , pkgconfig , libgee , pantheon , gtk3 , glib , gettext , gsettings-desktop-schemas , gobject-introspection , wrapGAppsHook }: stdenv.mkDerivation rec { pname = "granite"; version = "5.5.0"; outputs = [ "out" "dev" ]; src = fetchFromGitHub { owner = "elementary"; repo = pname; rev = version; sha256 = "sha256-ytbjuo9RnYyJ9+LqtWE117dGlNErLl+nmTM22xGGDo8="; }; passthru = { updateScript = nix-update-script { attrPath = "pantheon.${pname}"; }; }; nativeBuildInputs = [ gettext gobject-introspection meson ninja pkgconfig python3 vala wrapGAppsHook ]; buildInputs = [ glib gtk3 libgee ]; propagatedBuildInputs = [ gsettings-desktop-schemas # is_clock_format_12h uses "org.gnome.desktop.interface clock-format" ]; postPatch = '' chmod +x meson/post_install.py patchShebangs meson/post_install.py ''; meta = with stdenv.lib; { description = "An extension to GTK used by elementary OS"; longDescription = '' Granite is a companion library for GTK and GLib. Among other things, it provides complex widgets and convenience functions designed for use in apps built for elementary OS. ''; homepage = "https://github.com/elementary/granite"; license = licenses.lgpl3Plus; platforms = platforms.linux; maintainers = pantheon.maintainers; }; }
{ "pile_set_name": "Github" }
package require import ( "errors" "testing" "time" ) // AssertionTesterInterface defines an interface to be used for testing assertion methods type AssertionTesterInterface interface { TestMethod() } // AssertionTesterConformingObject is an object that conforms to the AssertionTesterInterface interface type AssertionTesterConformingObject struct { } func (a *AssertionTesterConformingObject) TestMethod() { } // AssertionTesterNonConformingObject is an object that does not conform to the AssertionTesterInterface interface type AssertionTesterNonConformingObject struct { } type MockT struct { Failed bool } func (t *MockT) FailNow() { t.Failed = true } func (t *MockT) Errorf(format string, args ...interface{}) { _, _ = format, args } func TestImplements(t *testing.T) { Implements(t, (*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject)) mockT := new(MockT) Implements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject)) if !mockT.Failed { t.Error("Check should fail") } } func TestIsType(t *testing.T) { IsType(t, new(AssertionTesterConformingObject), new(AssertionTesterConformingObject)) mockT := new(MockT) IsType(mockT, new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject)) if !mockT.Failed { t.Error("Check should fail") } } func TestEqual(t *testing.T) { Equal(t, 1, 1) mockT := new(MockT) Equal(mockT, 1, 2) if !mockT.Failed { t.Error("Check should fail") } } func TestNotEqual(t *testing.T) { NotEqual(t, 1, 2) mockT := new(MockT) NotEqual(mockT, 2, 2) if !mockT.Failed { t.Error("Check should fail") } } func TestExactly(t *testing.T) { a := float32(1) b := float32(1) c := float64(1) Exactly(t, a, b) mockT := new(MockT) Exactly(mockT, a, c) if !mockT.Failed { t.Error("Check should fail") } } func TestNotNil(t *testing.T) { NotNil(t, new(AssertionTesterConformingObject)) mockT := new(MockT) NotNil(mockT, nil) if !mockT.Failed { t.Error("Check should fail") } } func TestNil(t *testing.T) { Nil(t, nil) mockT := new(MockT) Nil(mockT, new(AssertionTesterConformingObject)) if !mockT.Failed { t.Error("Check should fail") } } func TestTrue(t *testing.T) { True(t, true) mockT := new(MockT) True(mockT, false) if !mockT.Failed { t.Error("Check should fail") } } func TestFalse(t *testing.T) { False(t, false) mockT := new(MockT) False(mockT, true) if !mockT.Failed { t.Error("Check should fail") } } func TestContains(t *testing.T) { Contains(t, "Hello World", "Hello") mockT := new(MockT) Contains(mockT, "Hello World", "Salut") if !mockT.Failed { t.Error("Check should fail") } } func TestNotContains(t *testing.T) { NotContains(t, "Hello World", "Hello!") mockT := new(MockT) NotContains(mockT, "Hello World", "Hello") if !mockT.Failed { t.Error("Check should fail") } } func TestPanics(t *testing.T) { Panics(t, func() { panic("Panic!") }) mockT := new(MockT) Panics(mockT, func() {}) if !mockT.Failed { t.Error("Check should fail") } } func TestNotPanics(t *testing.T) { NotPanics(t, func() {}) mockT := new(MockT) NotPanics(mockT, func() { panic("Panic!") }) if !mockT.Failed { t.Error("Check should fail") } } func TestNoError(t *testing.T) { NoError(t, nil) mockT := new(MockT) NoError(mockT, errors.New("some error")) if !mockT.Failed { t.Error("Check should fail") } } func TestError(t *testing.T) { Error(t, errors.New("some error")) mockT := new(MockT) Error(mockT, nil) if !mockT.Failed { t.Error("Check should fail") } } func TestEqualError(t *testing.T) { EqualError(t, errors.New("some error"), "some error") mockT := new(MockT) EqualError(mockT, errors.New("some error"), "Not some error") if !mockT.Failed { t.Error("Check should fail") } } func TestEmpty(t *testing.T) { Empty(t, "") mockT := new(MockT) Empty(mockT, "x") if !mockT.Failed { t.Error("Check should fail") } } func TestNotEmpty(t *testing.T) { NotEmpty(t, "x") mockT := new(MockT) NotEmpty(mockT, "") if !mockT.Failed { t.Error("Check should fail") } } func TestWithinDuration(t *testing.T) { a := time.Now() b := a.Add(10 * time.Second) WithinDuration(t, a, b, 15*time.Second) mockT := new(MockT) WithinDuration(mockT, a, b, 5*time.Second) if !mockT.Failed { t.Error("Check should fail") } } func TestInDelta(t *testing.T) { InDelta(t, 1.001, 1, 0.01) mockT := new(MockT) InDelta(mockT, 1, 2, 0.5) if !mockT.Failed { t.Error("Check should fail") } } func TestZero(t *testing.T) { Zero(t, "") mockT := new(MockT) Zero(mockT, "x") if !mockT.Failed { t.Error("Check should fail") } } func TestNotZero(t *testing.T) { NotZero(t, "x") mockT := new(MockT) NotZero(mockT, "") if !mockT.Failed { t.Error("Check should fail") } } func TestJSONEq_EqualSONString(t *testing.T) { mockT := new(MockT) JSONEq(mockT, `{"hello": "world", "foo": "bar"}`, `{"hello": "world", "foo": "bar"}`) if mockT.Failed { t.Error("Check should pass") } } func TestJSONEq_EquivalentButNotEqual(t *testing.T) { mockT := new(MockT) JSONEq(mockT, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) if mockT.Failed { t.Error("Check should pass") } } func TestJSONEq_HashOfArraysAndHashes(t *testing.T) { mockT := new(MockT) JSONEq(mockT, "{\r\n\t\"numeric\": 1.5,\r\n\t\"array\": [{\"foo\": \"bar\"}, 1, \"string\", [\"nested\", \"array\", 5.5]],\r\n\t\"hash\": {\"nested\": \"hash\", \"nested_slice\": [\"this\", \"is\", \"nested\"]},\r\n\t\"string\": \"foo\"\r\n}", "{\r\n\t\"numeric\": 1.5,\r\n\t\"hash\": {\"nested\": \"hash\", \"nested_slice\": [\"this\", \"is\", \"nested\"]},\r\n\t\"string\": \"foo\",\r\n\t\"array\": [{\"foo\": \"bar\"}, 1, \"string\", [\"nested\", \"array\", 5.5]]\r\n}") if mockT.Failed { t.Error("Check should pass") } } func TestJSONEq_Array(t *testing.T) { mockT := new(MockT) JSONEq(mockT, `["foo", {"hello": "world", "nested": "hash"}]`, `["foo", {"nested": "hash", "hello": "world"}]`) if mockT.Failed { t.Error("Check should pass") } } func TestJSONEq_HashAndArrayNotEquivalent(t *testing.T) { mockT := new(MockT) JSONEq(mockT, `["foo", {"hello": "world", "nested": "hash"}]`, `{"foo": "bar", {"nested": "hash", "hello": "world"}}`) if !mockT.Failed { t.Error("Check should fail") } } func TestJSONEq_HashesNotEquivalent(t *testing.T) { mockT := new(MockT) JSONEq(mockT, `{"foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) if !mockT.Failed { t.Error("Check should fail") } } func TestJSONEq_ActualIsNotJSON(t *testing.T) { mockT := new(MockT) JSONEq(mockT, `{"foo": "bar"}`, "Not JSON") if !mockT.Failed { t.Error("Check should fail") } } func TestJSONEq_ExpectedIsNotJSON(t *testing.T) { mockT := new(MockT) JSONEq(mockT, "Not JSON", `{"foo": "bar", "hello": "world"}`) if !mockT.Failed { t.Error("Check should fail") } } func TestJSONEq_ExpectedAndActualNotJSON(t *testing.T) { mockT := new(MockT) JSONEq(mockT, "Not JSON", "Not JSON") if !mockT.Failed { t.Error("Check should fail") } } func TestJSONEq_ArraysOfDifferentOrder(t *testing.T) { mockT := new(MockT) JSONEq(mockT, `["foo", {"hello": "world", "nested": "hash"}]`, `[{ "hello": "world", "nested": "hash"}, "foo"]`) if !mockT.Failed { t.Error("Check should fail") } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:paddingBottom="@dimen/hb" android:layout_width="fill_parent" android:layout_height="wrap_content" android:weightSum="2.0" android:minHeight="@dimen/j7" xmlns:android="http://schemas.android.com/apk/res/android"> <TextView android:textSize="@dimen/i8" android:textColor="@color/hc" android:gravity="center" android:id="@id/cr8" android:clickable="true" android:layout_width="0.0dip" android:layout_height="@dimen/j7" android:text="@string/dj3" android:layout_weight="1.0" /> <TextView android:id="@id/bdt" android:background="#ffeeeeee" android:layout_width="2.0px" android:layout_height="32.0dip" /> <TextView android:textSize="@dimen/i8" android:textColor="@color/hc" android:gravity="center" android:id="@id/cr9" android:clickable="true" android:layout_width="0.0dip" android:layout_height="@dimen/j7" android:text="@string/dje" android:layout_weight="1.0" /> </LinearLayout>
{ "pile_set_name": "Github" }
// Copyright (c) 2012 Google Inc. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. int comdat_function() { return 1; } int main() { return 0; }
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0) on Fri Oct 02 00:10:13 EDT 2015 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class org.owasp.appsensor.kafka.KafkaRequestHandler (appsensor-parent 2.2.0 API)</title> <meta name="date" content="2015-10-02"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.owasp.appsensor.kafka.KafkaRequestHandler (appsensor-parent 2.2.0 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="header"> <h2 title="Uses of Class org.owasp.appsensor.kafka.KafkaRequestHandler" class="title">Uses of Class<br>org.owasp.appsensor.kafka.KafkaRequestHandler</h2> </div> <div class="classUseContainer">No usage of org.owasp.appsensor.kafka.KafkaRequestHandler</div> <p class="legalCopy"><small>Copyright &#169; 2015 <a href="http://www.owasp.org">The Open Web Application Security Project (OWASP)</a>. All rights reserved.</small></p> </body> </html>
{ "pile_set_name": "Github" }
<template> <v-fab-transition> <v-btn v-scroll="onScroll" v-show="fab" fab dark fixed bottom right color="red" @click="toTop" > <v-icon>keyboard_arrow_up</v-icon> </v-btn> </v-fab-transition> </template> <script> // import { smoothScrollTo } from '@/utils/util'; export default { name: 'AppFab', data() { return { fab: false, }; }, methods: { onScroll() { // console.log('---document.documentElement.scrollTop', document.documentElement.scrollTop); // console.log('---document.body.scrollTop', document.body.scrollTop); // console.log('---main-container scrollTop', document.querySelector('.main-container').scrollTop); if (typeof window === 'undefined') { return; } const top = window.pageYOffset || window.scrollY || document.documentElement.scrollTop || document.body.scrollTop || document.querySelector('#main-container').scrollTop || 0; // console.log('---top-------', top); this.fab = top > 100; }, toTop() { this.$router.push({ hash: '' }); // const dom = document.scrollingElement || document.documentElement || document.body; // smoothScrollTo(dom, 0, 600); // document.querySelector('#main-container').scrollTop = 0; // const el = document.body; this.$vuetify.goTo(0, { duration: 600, }); // el.scrollTo({ // top: 0, // behavior: 'smooth', // }); }, }, }; </script>
{ "pile_set_name": "Github" }
syntax "makefile" "(m|M)akefile$" "\.mak$" color brightgreen "((C|CXX|LD)FLAGS)|LIBADD|LIBS|include" icolor cyan start="\{" end="\}" icolor cyan start="\(" end="\)" color brightyellow "\$" color green "#.*$" color red "[:=]" color magenta "\<(if|ifeq|else|endif)\>" color blue "\$\{.*}" color brightblue "\w+:" color green "#.*$"
{ "pile_set_name": "Github" }
/* tslint:disable */ // This file was automatically generated and should not be edited. export enum Episode { NEWHOPE = 'NEWHOPE', EMPIRE = 'EMPIRE', JEDI = 'JEDI', } export type ReviewInput = { stars: number; commentary?: string | null; favorite_color?: ColorInput | null; }; export type ColorInput = { red: number; green: number; blue: number; }; export type HeroQueryVariables = { episode?: Episode | null; }; export type HeroQuery = { hero: | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; homePlanet: string | null; height: number | null; mass: number | null; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; homePlanet: string | null; height: number | null; mass: number | null; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; homePlanet: string | null; height: number | null; mass: number | null; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; }) | null; }; export type ReviewsQueryVariables = { episode: Episode; }; export type ReviewsQuery = { reviews: Array<{ episode: Episode | null; stars: number; commentary: string | null; } | null> | null; }; export type SearchQueryVariables = { text?: string | null; }; export type SearchQuery = { search: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; } | { id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; }) | null > | null; }; export type CharacterQueryVariables = { id: string; }; export type CharacterQuery = { character: | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; homePlanet: string | null; height: number | null; mass: number | null; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; homePlanet: string | null; height: number | null; mass: number | null; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; homePlanet: string | null; height: number | null; mass: number | null; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; }) | null; }; export type DroidQueryVariables = { id: string; }; export type DroidQuery = { droid: { id: string; name: string; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; homePlanet: string | null; height: number | null; mass: number | null; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; homePlanet: string | null; height: number | null; mass: number | null; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; homePlanet: string | null; height: number | null; mass: number | null; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; } | null; }; export type HumanQueryVariables = { id: string; }; export type HumanQuery = { human: { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; homePlanet: string | null; height: number | null; mass: number | null; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; homePlanet: string | null; height: number | null; mass: number | null; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; homePlanet: string | null; height: number | null; mass: number | null; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; primaryFunction: string | null; }) | null > | null; friendsConnection: { totalCount: number | null; edges: Array<{ cursor: string; } | null> | null; friends: Array< | ( | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; friends: Array< | ( | { id: string; name: string; homePlanet: string | null; height: number | null; mass: number | null; } | { id: string; name: string; primaryFunction: string | null; }) | null > | null; primaryFunction: string | null; }) | null > | null; }; appearsIn: Array<Episode | null>; starships: Array<{ id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null> | null; } | null; }; export type StarshipQueryVariables = { id: string; }; export type StarshipQuery = { starship: { id: string; name: string; length: number | null; coordinates: Array<Array<number>> | null; } | null; }; export type CreateReviewMutationVariables = { episode?: Episode | null; review: ReviewInput; }; export type CreateReviewMutation = { createReview: { episode: Episode | null; stars: number; commentary: string | null; } | null; }; export type ReviewAddedSubscriptionVariables = { episode?: Episode | null; }; export type ReviewAddedSubscription = { reviewAdded: { episode: Episode | null; stars: number; commentary: string | null; } | null; };
{ "pile_set_name": "Github" }