text
stringlengths
2
100k
meta
dict
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_memmove_07.c Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE806.label.xml Template File: sources-sink-07.tmpl.c */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sink: memmove * BadSink : Copy data to string using memmove * Flow Variant: 07 Control flow: if(staticFive==5) and if(staticFive!=5) * * */ #include "std_testcase.h" #include <wchar.h> /* The variable below is not declared "const", but is never assigned * any other value so a tool should be able to identify that reads of * this will always give its initialized value. */ static int staticFive = 5; #ifndef OMITBAD void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_memmove_07_bad() { char * data; data = (char *)malloc(100*sizeof(char)); if(staticFive==5) { /* FLAW: Initialize data as a large buffer that is larger than the small buffer used in the sink */ memset(data, 'A', 100-1); /* fill with 'A's */ data[100-1] = '\0'; /* null terminate */ } { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */ memmove(dest, data, strlen(data)*sizeof(char)); dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); free(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the staticFive==5 to staticFive!=5 */ static void goodG2B1() { char * data; data = (char *)malloc(100*sizeof(char)); if(staticFive!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */ memset(data, 'A', 50-1); /* fill with 'A's */ data[50-1] = '\0'; /* null terminate */ } { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */ memmove(dest, data, strlen(data)*sizeof(char)); dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); free(data); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { char * data; data = (char *)malloc(100*sizeof(char)); if(staticFive==5) { /* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */ memset(data, 'A', 50-1); /* fill with 'A's */ data[50-1] = '\0'; /* null terminate */ } { char dest[50] = ""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */ memmove(dest, data, strlen(data)*sizeof(char)); dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */ printLine(data); free(data); } } void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_memmove_07_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_memmove_07_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_memmove_07_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #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.jackrabbit.webdav.client.methods; import java.io.ByteArrayOutputStream; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; import org.apache.http.HttpEntity; import org.apache.http.entity.ByteArrayEntity; import org.apache.http.entity.ContentType; import org.apache.jackrabbit.webdav.xml.DomUtil; import org.apache.jackrabbit.webdav.xml.XmlSerializable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.xml.sax.SAXException; /** * Utility methods for creating request entities from {@link Document}s or {@link XmlSerializable}s. */ public class XmlEntity { private static Logger LOG = LoggerFactory.getLogger(XmlEntity.class); private static ContentType CT = ContentType.create("application/xml", "UTF-8"); public static HttpEntity create(Document doc) throws IOException { try { ByteArrayOutputStream xml = new ByteArrayOutputStream(); DomUtil.transformDocument(doc, xml); return new ByteArrayEntity(xml.toByteArray(), CT); } catch (TransformerException ex) { LOG.error(ex.getMessage()); throw new IOException(ex); } catch (SAXException ex) { LOG.error(ex.getMessage()); throw new IOException(ex); } } public static HttpEntity create(XmlSerializable payload) throws IOException { try { Document doc = DomUtil.createDocument(); doc.appendChild(payload.toXml(doc)); return create(doc); } catch (ParserConfigurationException ex) { LOG.error(ex.getMessage()); throw new IOException(ex); } } }
{ "pile_set_name": "Github" }
/** * @flow */ /* eslint-disable */ import type { ReaderFragment } from 'relay-runtime'; import type { FragmentReference } from "relay-runtime"; declare export opaque type LocationsList_data$ref: FragmentReference; declare export opaque type LocationsList_data$fragmentType: LocationsList_data$ref; export type LocationsList_data = {| +locations: ?{| +__id: string, +edges: ?$ReadOnlyArray<?{| +node: ?{| +id: string, +name: ?string, +type: ?string, |} |}>, |}, +$refType: LocationsList_data$ref, |}; export type LocationsList_data$data = LocationsList_data; export type LocationsList_data$key = { +$data?: LocationsList_data$data, +$fragmentRefs: LocationsList_data$ref, ... }; const node: ReaderFragment = { "argumentDefinitions": [], "kind": "Fragment", "metadata": { "connection": [ { "count": null, "cursor": null, "direction": "forward", "path": [ "locations" ] } ] }, "name": "LocationsList_data", "selections": [ { "alias": "locations", "args": null, "concreteType": "LocationConnection", "kind": "LinkedField", "name": "__LocationsList_locations_connection", "plural": false, "selections": [ { "alias": null, "args": null, "concreteType": "LocationEdge", "kind": "LinkedField", "name": "edges", "plural": true, "selections": [ { "alias": null, "args": null, "concreteType": "Location", "kind": "LinkedField", "name": "node", "plural": false, "selections": [ { "alias": null, "args": null, "kind": "ScalarField", "name": "id", "storageKey": null }, { "alias": null, "args": null, "kind": "ScalarField", "name": "name", "storageKey": null }, { "alias": null, "args": null, "kind": "ScalarField", "name": "type", "storageKey": null }, { "alias": null, "args": null, "kind": "ScalarField", "name": "__typename", "storageKey": null } ], "storageKey": null }, { "alias": null, "args": null, "kind": "ScalarField", "name": "cursor", "storageKey": null } ], "storageKey": null }, { "alias": null, "args": null, "concreteType": "PageInfo", "kind": "LinkedField", "name": "pageInfo", "plural": false, "selections": [ { "alias": null, "args": null, "kind": "ScalarField", "name": "endCursor", "storageKey": null }, { "alias": null, "args": null, "kind": "ScalarField", "name": "hasNextPage", "storageKey": null } ], "storageKey": null }, { "kind": "ClientExtension", "selections": [ { "alias": null, "args": null, "kind": "ScalarField", "name": "__id", "storageKey": null } ] } ], "storageKey": null } ], "type": "RootQuery", "abstractKey": null }; // prettier-ignore (node: any).hash = '889f1cc9f0546e9d48dcdb71bb4d5f3b'; export default node;
{ "pile_set_name": "Github" }
/* XMRig * Copyright 2010 Jeff Garzik <[email protected]> * Copyright 2012-2014 pooler <[email protected]> * Copyright 2014 Lucas Jones <https://github.com/lucasjones> * Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet> * Copyright 2016 Jay D Dee <[email protected]> * Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt> * Copyright 2014-2019 heapwolf <https://github.com/heapwolf> * Copyright 2018-2020 SChernykh <https://github.com/SChernykh> * Copyright 2016-2020 XMRig <https://github.com/xmrig>, <[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/>. */ #include "base/net/http/HttpContext.h" #include "3rdparty/http-parser/http_parser.h" #include "base/kernel/interfaces/IHttpListener.h" #include "base/tools/Baton.h" #include "base/tools/Chrono.h" #include <algorithm> #include <uv.h> namespace xmrig { static http_parser_settings http_settings; static std::map<uint64_t, HttpContext *> storage; static uint64_t SEQUENCE = 0; class HttpWriteBaton : public Baton<uv_write_t> { public: XMRIG_DISABLE_COPY_MOVE_DEFAULT(HttpWriteBaton) inline HttpWriteBaton(std::string &&body, HttpContext *ctx) : m_ctx(ctx), m_body(std::move(body)) { m_buf = uv_buf_init(&m_body.front(), m_body.size()); } inline ~HttpWriteBaton() { if (m_ctx) { m_ctx->close(); } } void write(uv_stream_t *stream) { uv_write(&req, stream, &m_buf, 1, [](uv_write_t *req, int) { delete reinterpret_cast<HttpWriteBaton *>(req->data); }); } private: HttpContext *m_ctx; std::string m_body; uv_buf_t m_buf{}; }; } // namespace xmrig xmrig::HttpContext::HttpContext(int parser_type, const std::weak_ptr<IHttpListener> &listener) : HttpData(SEQUENCE++), m_timestamp(Chrono::steadyMSecs()), m_listener(listener) { storage[id()] = this; m_parser = new http_parser; m_tcp = new uv_tcp_t; uv_tcp_init(uv_default_loop(), m_tcp); uv_tcp_nodelay(m_tcp, 1); http_parser_init(m_parser, static_cast<http_parser_type>(parser_type)); m_parser->data = m_tcp->data = this; if (http_settings.on_message_complete == nullptr) { attach(&http_settings); } } xmrig::HttpContext::~HttpContext() { delete m_tcp; delete m_parser; } void xmrig::HttpContext::write(std::string &&data, bool close) { if (uv_is_writable(stream()) != 1) { return; } auto baton = new HttpWriteBaton(std::move(data), close ? this : nullptr); baton->write(stream()); } bool xmrig::HttpContext::isRequest() const { return m_parser->type == HTTP_REQUEST; } size_t xmrig::HttpContext::parse(const char *data, size_t size) { if (size == 0) { return size; } return http_parser_execute(m_parser, &http_settings, data, size); } std::string xmrig::HttpContext::ip() const { char ip[46] = {}; sockaddr_storage addr = {}; int size = sizeof(addr); uv_tcp_getpeername(m_tcp, reinterpret_cast<sockaddr*>(&addr), &size); if (reinterpret_cast<sockaddr_in *>(&addr)->sin_family == AF_INET6) { uv_ip6_name(reinterpret_cast<sockaddr_in6*>(&addr), ip, 45); } else { uv_ip4_name(reinterpret_cast<sockaddr_in*>(&addr), ip, 16); } return ip; } uint64_t xmrig::HttpContext::elapsed() const { return Chrono::steadyMSecs() - m_timestamp; } void xmrig::HttpContext::close(int status) { auto listener = httpListener(); if (status < 0 && listener) { this->status = status; listener->onHttpData(*this); } storage.erase(id()); if (!uv_is_closing(handle())) { uv_close(handle(), [](uv_handle_t *handle) -> void { delete reinterpret_cast<HttpContext*>(handle->data); }); } } xmrig::HttpContext *xmrig::HttpContext::get(uint64_t id) { if (storage.count(id) == 0) { return nullptr; } return storage[id]; } void xmrig::HttpContext::closeAll() { for (auto &kv : storage) { if (!uv_is_closing(kv.second->handle())) { uv_close(kv.second->handle(), [](uv_handle_t *handle) -> void { delete reinterpret_cast<HttpContext*>(handle->data); }); } } } int xmrig::HttpContext::onHeaderField(http_parser *parser, const char *at, size_t length) { auto ctx = static_cast<HttpContext*>(parser->data); if (ctx->m_wasHeaderValue) { if (!ctx->m_lastHeaderField.empty()) { ctx->setHeader(); } ctx->m_lastHeaderField = std::string(at, length); ctx->m_wasHeaderValue = false; } else { ctx->m_lastHeaderField += std::string(at, length); } return 0; } int xmrig::HttpContext::onHeaderValue(http_parser *parser, const char *at, size_t length) { auto ctx = static_cast<HttpContext*>(parser->data); if (!ctx->m_wasHeaderValue) { ctx->m_lastHeaderValue = std::string(at, length); ctx->m_wasHeaderValue = true; } else { ctx->m_lastHeaderValue += std::string(at, length); } return 0; } void xmrig::HttpContext::attach(http_parser_settings *settings) { settings->on_message_begin = nullptr; settings->on_status = nullptr; settings->on_chunk_header = nullptr; settings->on_chunk_complete = nullptr; settings->on_url = [](http_parser *parser, const char *at, size_t length) -> int { static_cast<HttpContext*>(parser->data)->url = std::string(at, length); return 0; }; settings->on_header_field = onHeaderField; settings->on_header_value = onHeaderValue; settings->on_headers_complete = [](http_parser* parser) -> int { auto ctx = static_cast<HttpContext*>(parser->data); ctx->status = parser->status_code; if (parser->type == HTTP_REQUEST) { ctx->method = parser->method; } if (!ctx->m_lastHeaderField.empty()) { ctx->setHeader(); } return 0; }; settings->on_body = [](http_parser *parser, const char *at, size_t len) -> int { static_cast<HttpContext*>(parser->data)->body += std::string(at, len); return 0; }; settings->on_message_complete = [](http_parser *parser) -> int { auto ctx = static_cast<HttpContext*>(parser->data); auto listener = ctx->httpListener(); if (listener) { listener->onHttpData(*ctx); ctx->m_listener.reset(); } return 0; }; } void xmrig::HttpContext::setHeader() { std::transform(m_lastHeaderField.begin(), m_lastHeaderField.end(), m_lastHeaderField.begin(), ::tolower); headers.insert({ m_lastHeaderField, m_lastHeaderValue }); m_lastHeaderField.clear(); m_lastHeaderValue.clear(); }
{ "pile_set_name": "Github" }
# https://www.robotstxt.org/robotstxt.html User-agent: * Disallow:
{ "pile_set_name": "Github" }
بالإضافة O إلى O مفاهيم O أخرى O كالفضاء O والزمن O ، O ويتعامل O مع O خصائص O كونية O محسوسة O يمكن O قياسها O مثل O القوة O و O الطاقة O و O الكتلة O و O الشحنة O . O الفيزياء B-MISC ( O من O الكلمة O الإغريقية O فيزيك O " O φυσική O "، O وتعني O معرفة O الطبيعة O ) O هي O العلم O الذي O يدرس O المادة O وحركتها O . O وتعتمد O الفيزياء B-MISC المنهج O التجريبي O ، O أي O أنها O تحاول O تفسير O الظواهر O الطبيعية O والقوانين O التي O تحكم O الكون O عن O طريق O نظريات O قابلة O للاختبار O . O ومع O ذلك O تجد O الميكانيكا B-MISC الكلاسيكية I-MISC مجالا O لتطبيقها O في O وصف O سلوك O أنظمة O دقيقة O ، O فعلى O سبيل O المثال O في O النظرية O الحركية O للغازات O تسري O القوانين O التي O تحكم O حركة O أجسام O ذات O حجم O العادي O على O الجزيئات O المكونة O للغازات O و O هو O ما O يمكن O من O إستنتاج O خصائص O عيانية O مثل O درجة O الحرارة O والضغط O والحجم O . O تتعامل O الميكانيكا B-MISC الكمومية I-MISC مع O نظم O ذات O أحجام O ذرية O أو O تحت O الذرية؛ O مثل O الجزيئات O والذرات O والإلكترونات B-MISC والبروتونات I-MISC وغيرها O من O الجسيمات O الأولية O . O فقد O أنفذ O ميراث O الفلاسفة B-PER الإغريق I-PER من O الضياع O بترجمته O إلى O اللغة O العربية O ثم O وقع O إثرائه O وتنقيحه O وتصحيحه O . O ملاحظة O : O اعتبار O أن O " O الفيزياء B-MISC فرع O من O الرياضيات B-MISC " O عبارة O خاطئة O تماما O , O لأن O النماذج O الرياضية O تستعمل O في O علم B-MISC الفيزياء I-MISC فقط O لتسهيل O فهم O الظواهر O الفيزيائية O . O وهناك O صياغة O نسبية O تقدم O تصحيحات O لحساب O حركة O الأجسام O التي O تسير O بسرعات O تقارب O سرعة O الضوء O . O وتنضوي O هذه O المواضيع O ضمن O ما O يعرف O بالديناميكا B-MISC الكهربائية I-MISC الكلاسيكية I-MISC ، O حيث O تشرح O معادلات B-MISC ماكسويل I-MISC هذه O الظواهر O بطريقة O جيدة O وعامة O . O ولقد O تجسدت O أغلب O التطورات O التي O أحدثتها O بشكل O عملي O في O عدة O قطاعات O من O التقنية O والطب B-MISC . O ويمكن O القول O بطريقة O مبسطة O ، O أن O موتر O الإجهاد O - O الطاقة O هو O سبب O وجود O مجال O تثاقلي O في O زمكان O معين O وذلك O بشكل O أعم O من O ما O تفعله O الكتلة O وحدها O في O قانون B-MISC نيوتن I-MISC الكلاسيكي O للجاذبية O . O ( O إذا O قام O أحد O لاعبي O الفريق O 2 O بعرقلة O أحد O لاعبي O الفريق O 1 O و O لكن O بطريقة O غير O واضحة O أي O لم O يتبين O إن O كان O قد O عرقله O بطريقة O قانونية O أم O لا O . O المجلس O تأسس O في O 1882 O بعد O مقابلة O اتحاد B-ORG كرة I-ORG القدم I-ORG في O مانشستر B-LOC ، O و O اتحاد B-ORG كرة I-ORG القدم I-ORG في O أسكتلندا B-LOC ، O و O اتحاد B-ORG كرة I-ORG القدم I-ORG في O ويلز B-LOC ، O و O اتحاد B-ORG كرة I-ORG القدم I-ORG في O إيرلندا B-LOC . O القانون O 13 O كرة B-MISC القدم I-MISC الحديثة O تطورت O ونشأت O في O بريطانيا B-LOC . O نهاية O المباراة O تعرف O ب O " O نهاية O الوقت O ". O كل O يلعب O كرة B-MISC القدم I-MISC وفق O قوانينه O الخاصة O ، O والتي O لا O تختلف O عن O بعضها O كثيرا O . O كانت O الرغبة O لدى O البريطانيين B-PER بتغيير O رياضة O الرجبي B-MISC العنيفة O كرياضة O رسمية O في O المدارس O البريطانية O إلى O رياضة O منظمة O لا O تحوي O عنفا O كما O تحوي O الرجبي B-MISC . O و O من O الأحداث O التي O صرحت O للفيفا B-ORG أن O تكون O وقت O ضائع O هو O عندما O يتم O إحراز O هدف O و O تؤدي O اللاعبين O احتفالاتهم O بمناسبة O الهدف O ، O فهذا O الوقت O الضائع O يتم O احتسابه O أيضا O كوقت O ضائع O من O قبل O الحكم O . O إن O هذه O المنافسة O تجري O مرة O كل O 4 O أعوام O . O اليابان B-LOC : O يعمل O بها O 53 O مفاعل O نووي O ، O وتقوم O حاليا O بانشاء O 2 O مفاعل O ، O وتخطط O لإنشاء O 14 O مفاعل O . O وما O يثير O تعض O المعارضة O حول O مستقبل O الطاقة O النووية O هو O التكاليف O العالية O لبناء O المفاعلات O ، O ومخاوف O العامة O المتعلقة O بالسلامة O ، O وصعوبة O التخلص O الآمن O من O المخلفات O عالية O الإشعاع O . O ويحتوي O اليورانيوم B-MISC الطبيعي O على O نسبة O 0 O ، O 7 O % O من O يورانيوم B-MISC - O 235 O وهو O نظير O ينشطر O . O كما O تخطط O الدول O لأنشاء O نحو O 200 O مفاعل O نووي O بالإضافة O إلى O ما O سبق O حتى O عام O 2050 O . O ويتم O الانشطار O النووي O بها O لتوليد O حرارة O لتسخين O المياه O وتكوين O البخار O عال O الضغط O ، O الذي O يدير O زعانف O التوربينات O التي O تتصل O بمولدات O كهربائية O . O ووقود O اليورانيوم B-MISC اللازم O للمفاعلات O الإنشطارية O لا O يصنع O قنبلة O ذرية O لأنها O تتطلب O تخصيب O أكثر O من O 90 O % O للحصول O علي O تفاعل O متسلسل O سريع O . O ولا O سيما O وأن O الطاقة O النووية O تزود O دول O العالم O بأكثر O من O 16 O % O من O الطاقة O الكهربائية؛ O فهي O تمد O 35 O % O من O احتياجات O دول O الاتحاد B-ORG الأوروبي I-ORG . O وفي O حالة O التخصيب O يتطلب O تزويد O المفاعل O النووي O ب O 30 O طن O من O اليورانيوم B-MISC المخصب O إلى O درجة O 5و3 O % O لإمداد O مفاعل O واحد O بالوقود O النووي O لمدة O عام O إذا O كان O يعمل O بطاقة O قدرها O 1000 O ميجاوات B-MISC . O السبب O في O رغبة O هذه O الدول O في O انهاء O الطاقة O النووية O على O أراضيها O هي O النفايات O النووية O الضارة O التي O لا O يمكن O إعادة O تصنيعها O . O ورغم O أن O مادة O اليورانيوم B-MISC توجد O بشكل O طبيعي O في O أنحاء O العالم O ، O لكن O القليل O منه O فقط O يوجد O بشكل O مركز O كخام O . O أو O ما O يعرف O بالكتلة O الحرجة O . O روسيا B-LOC : O يعمل O بها O 31 O مفاعل O نووي O ، O وتقوم O حاليا O بانشاء O 8 O مفاعل O ، O وتخطط O لإنشاء O 36 O مفاعل O وقد O كان O أول O من O استخدم O مصطلح O " O سوفت B-MISC وير I-MISC " O لأول O مرة O بهذا O المعنى O " O جون B-PER وايلدر I-PER توكي I-PER " O في O عام O 1958 O . O وربما O تطلبت O العمليات O الحسابية O الأكثر O تعقيدا O استخدام O العديد O من O العمليات O وعناصر O البيانات O معا O . O هذا O بالإضافة O إلى O أنه O توجد O بعض O البرامج O المجانية O أو O التجريبية O . O إن O نوعية O برامج O الكمبيوتر O مهمة O جدا O ، O وخاصة O البرامج O التجارية O والبرامج O التي O تعمل O مع O نظام B-MISC التشغيل I-MISC ، O مثل O برامج O " O مايكروسوفت B-MISC أوفيس I-MISC " O وكذلك O برامج O نظام B-MISC التشغيل I-MISC نفسه O مثل O " O مايكروسوفت B-MISC ويندوز I-MISC " O و O " O لينوكس B-MISC " O ... O إلخ O . O إن O النظرية O التي O تعتبر O الأساس O لمعظم O برامج O الكمبيوتر O الحديثة O قدمها O لأول O مرة O " O آلان B-PER تورينج I-PER " O في O مقاله O الذي O تم O نشره O عام O 1935 O Computable O numbers O with O an O application O to O the O Entscheidungsproblem O . O تتميز O برامج O الكمبيوتر O بخصائص O اقتصادية O تجعل O تصميمها O وإنشائها O وتوزيعها O مختلف O عن O معظم O السلع O الاقتصادية O الأخرى O . O برامج O الكمبيوتر O أو O السوفت B-MISC وير I-MISC مصطلح O عام O يستخدم O لوصف O مجموعة O من O برامج O الكمبيوتر O والإجراءات O وأدلة O التعليمات O الفنية O التي O تؤدي O مهمة O ما O في O نظام B-MISC تشغيل I-MISC الكمبيوتر O . O وعلى O المستوى O الأدنى O ، O يشمل O مصطلح O السوفت B-MISC وير I-MISC أيضا O لغات O البرمجة O الخاصة O بجهاز O الكمبيوتر O أو O ما O يعرف O باسم O ( O Machine B-MISC Language I-MISC ) O والتي O تتعامل O مع O معالج B-MISC ( O أو O بروسيسور B-MISC ) O واحد O . O هذا O وتقدم O بعض O الشركات O ، O مثل O " O صن B-ORG مايكروسيستمز I-ORG " O و O " O نوفيل B-ORG " O و O " O مايكروسوفت B-ORG " O واجهات B-MISC برمجة I-MISC التطبيقات I-MISC الخاصة O بها O لدرجة O أن O العديد O من O التطبيقات O يتم O كتابتها O باستخدام O Software B-MISC Libraries I-MISC ملفات O برامج O خاصة O بها O عادة O ما O تشتمل O على O العديد O من O واجهات B-MISC برمجة I-MISC التطبيقات I-MISC . O هذا O الرجل O هو O ريتشارد B-PER ستولمان I-PER . O والتي O تعمل O ضمن O رخصة O أطلق O عليها O ستولمان B-PER اسم O رخصة O جنو O العمومية O General O Public O License O والتي O تنص O على O أنه O يمكن O لكل O من O يمتلك O أحد O برامج O جنو B-MISC أن O يقوم O بنسخه O ، O أو O تغييره O ، O أو O تعديله O ، O وحتى O بيعه O طالما O كانت O الشيفرة O المصدرية O والتعديلات O التي O يقوم O بها O هؤلاء O متاحة O لجميع O مستخدمي O البرنامج O دون O تمييز O . O ويطلق O ستولمان B-PER على O برمجياته O اسم O GNU B-MISC وهي O اختصار O للعبارة O GNU's B-MISC Not O Unix B-MISC والتي O تلخص O معارضته O لنظام O يونيكس B-MISC ، O والذي O صار O في O حقبة O الثمانينيات O نظاما O خاصا O تجاريا O مقفل O المصدر O ، O يعارض O كل O ما O يؤمن O به O ستولمان B-PER . O ولكن O ما O يقلقني O هو O أن O تستغل O الحكومة O هذه O الأحداث O للتجسس O على O كافة O نواحي O الحياة O الشخصية O للفرد O الأمريكي O ، O بما O في O ذلك O المكالمات O الهاتفية O ، O والبريد O الإلكتروني O ، O وتحركاتنا O الشخصية O . O وكان O المبرمجون O في O تلك O الأيام O يسمحون O للشركات O الخاصة O وغيرها O باستخدام O الشيفرة O المصدرية O لنظم B-MISC التشغيل I-MISC ، O وتعديلها O ، O والإضافة O إليها O ، O واستخدامها O في O مؤسساتهم O ، O بل O واستخدام O الأفكار O الواردة O في O هذه O الشيفرة O لابتكار O برمجيات O جديدة O أفضل O . O وهذا O بالتالي O سيقود O إلى O تسهيل O تناقل O الإبداع O ، O وتضخيم O أثره O ، O وتعظيم O فائدته O . O ويمكن O عمل O ذلك O بالإشارة O إلى O المؤلف O الأصلي O ، O وتضمين O نسخة O من O دليل O الاستخدام O الأصلي O وما O إلى O ذلك O . O ( O وضمن O هذا O التصنيف O ، O فإن O الكثير O من O البرمجيات O التي O تم O إنتاجها O لتعمل O ضمن O نظام O لينكس B-MISC ليست O حرة O ، O وبالتالي O فإنها O لا O تفيد O حركة O المصادر O العمومية O بشيء O ). O وخلف O الانفجار O فجوة O في O الصحراء O قطرها O يقرب O من O كيلومتر O ، O وتحولت O مساحات O كبيرة O من O الرمال O إلى O زجاج O ، O وقدرت O قوة O الانفجار O بأنها O تعادل O تفجير O ( O 20 O . O وعندما O صدرت O الأصوات O من O عدادات O جايجر B-PER قرب O الركام O ، O كان O ذلك O علامة O على O حدوث O الانشطار O ، O ونجاح O عملية O التحكم O فيه O على O الرغم O من O أنها O كانت O تبدو O بدائية O . O تم O ذلك O بعد O مرور O أقل O من O شهرين O على O بداية O العمل O ، O وفي O يوم O 2 O ديسمبر O 1942 O على O وجه O التحديد O ، O تحقق O الأمل O المنشود O الذي O تأكد O بالارتفاع O الهائل O في O درجة O الحرارة O داخل O الركام O . O وكان O هذا O أول O استخدام O للدروع O الواقية O من O الإشعاع O لأن O الأمر O أصبح O مختلفا O عما O كان O عليه O الركام O التجريبي O الصغير O في O شيكاغو B-LOC . O كما O أقيمت O ثانية O المدن O السرية O في O ولاية O واشنطن B-LOC بجوار O نهر B-LOC كولومبيا I-LOC ، O في O منطقة O ليس O بها O غير O قريتين O صغيرتين O . O وعلى O الفور O تم O نقل O ركام O « O فيرمي B-PER » O التجريبي O من O جامعة B-LOC كولومبيا I-LOC إلى O جامعة B-LOC شيكاغو I-LOC ، O ليبدأ O عمله O في O صالة O كانت O مخصصة O للرقص O ، O كما O انتشرت O حول O الجامعة O ، O المعامل O والمخازن O اللازمة O لتجميع O اليورانيوم B-MISC والجرافيت I-MISC النقي O والكادميوم B-MISC . O واستولوا O على O قلعة O قرطاجا B-LOC القديمة O ، O ولكن O وباء O دب O في O صفوف O الفرسان O ، O وتوفي O على O اثره O الملك O وافراد O العائلة O المالكة O المرافقة O باستثناء O فيليب B-PER الابن O البكر O للملك O الذي O شفي O ، O وفي O نفس O يوم O وفاة O الملك O وهو O 25 O اغسطس O 1270 O وصل O اخاه O شارل B-PER الأول I-PER ، O وخاضت O قواته O برفقة O قوات O لويس B-PER بقيادة O خلفه O فيليب B-PER بضع O معارك O ناجحة O ضد O قوات O أمير O تونس B-LOC ، O وفي O أول O نوفمبر O 1270 O وقعت O معاهدة O صلح O مع O المستنصر B-PER الزمتة O بدفع O جزية O مضاعفة O إلى O ملك O الصقليتيين B-PER ، O كما O شملت O حقوقا O تجارية O متبادلة O ، O وبعد O 17 O يوما O من O التوقيع O ، O ركب O الصليبييون B-PER السفن O وغادرو O تونس B-LOC . O فحرر O القدس B-LOC في O 2 O أكتوبر O 1187 O ، O الأمر O الذي O دفع O بالبابا O غريغوريوس B-PER الثامن I-PER إلى O الدعوة O إلى O حملة B-MISC صليبية I-MISC جديدة O . O لكن O برباروسا B-PER غرق O في O 1190 O في O نهر O اللامس B-LOC . O وفي O ذلك O الوقت O بالذات O بدأ O فيضان O النيل B-LOC . O ويذكر O أن O ريموند B-PER القائد O الصليبي O احتل O " O معرة B-LOC النعمان I-LOC "، O وقتل O بها O مائة O ألف O ، O وأشعل O النار O فيها O ، O ثم O أقاموا O دولتهم O الكبرى O المعروفة O باسم O مملكة O القدس B-LOC . O في O 1039 O سمح O خلفه O للإمبراطوريه B-LOC البيزنطيه I-LOC بإعادة O بناء O كنيسة B-LOC القيامة I-LOC . O وقد O خاض O الحروب B-MISC الصليبية I-MISC ضد O المسلمين B-PER ، O وثنية O من O السلاف B-PER ، O والمسيحيين B-PER الروسية I-PER والأرثوذكسية O اليونانية O ، O والمغول B-PER ، O والاعداء O السياسيين O للباباوات O . O عادة O ضد O الوثنيون B-PER ، O والزنادقة B-PER ، O والشعوب O الخاضعة O لحظر O الطرد O لمزيج O من O الدينية O ، O والاقتصادية O ، O و O أسباب O سياسية O . O وكانت O الجموع O تندفع O دون O توقف O ودون O انتظار O أوامر O القيادة O ، O خلفت O وراءها O خرابا O ونهبا O في O المجروالصرب B-LOC واليونان B-LOC وآسيا B-LOC الصغري I-LOC ، O حتى O سحقتهم O قوات B-ORG السلاجقة I-ORG الأتراك I-ORG في O 21 O أكتوبر O عام O 1096 O م O . O قادها O الإمبراطور O فريدريك B-PER الثاني I-PER هوهنشتاوفن I-PER الألماني O الذي O أراد O أن O يحقق O مقاصده O دون O أن O يسحب O سيفه O من O غمده O في O صيف O 1228 O ، O ولم O تحظ O هذه O الحملة O بمباركة O البابوية O بل O حرم O الإمبراطور O من O الكنيسة O لتأخره O في O تنفيذ O نذره O بأخذ O الصليب O . O فكانت O طبقة O المحاربين O الأوروبيين B-PER قد O أصبحوا O بلا O عدو O لقتاله O ، O فأصبحوا O ينشرون O الرعب O بين O السكان O ، O وتحولوا O إلى O السرقة O وقطع O الطرق O والقتال O في O ما O بينهم O ، O فكان O من O الكنيسة O ان O حاولت O التخفيف O بمنع O ذلك O ضد O جماعات O معينة O في O فترات O معينة O من O أجل O السيطرة O على O حالة O الفوضى O القائمة O . O سمح O الحج O الأراضي B-LOC المقدسة I-LOC قبل O وبعد O إعادة O بناء O كنيسة B-LOC القيامة I-LOC . O غير O ان O عناصر O كالكلورين B-MISC والحديد B-MISC والنحاس B-MISC مواد O كيماوية O أساسية O لاتتكسر O بالتفاعلات O الكيماوية O . O وكتلة O الإلكترون B-MISC تعادل O 1 O / O 2000 O كتلة O البروتون B-MISC أو O النيترون B-MISC . O و O يوجد O بالجدول O أكثر O من O 90 O عنصرا O طبيعيا O فوق O الأرض O و O عناصر O صناعية O ابتكرت O . O وكل O عنصر O بذرته O عدد O ثابت O ومتشابه O من O البروتونات B-MISC بالنواة O . O - O تتآكل O بسرعة O . O وفرق O بين O الفلزات B-MISC ( O المعادن O ) O واللافلزات B-MISC . O وبعد O 16 O سنة O من O نشر O جدول O مندليف B-PER استطاع O الكيميائيون O اكتشاف O العناصر O الثلاثة O المفقودة O من O الجدول O وهي O اسكانيديوم B-MISC scandium B-MISC وجاليوم B-MISC gallium B-MISC وجرمانيوم B-MISC germanium B-MISC . O وهذا O الجدول O له O أهميته O لدراسة O الكيمياء B-MISC وفهم O وتبسيط O التفاعلات O الكيميائية O حتي O المعقدة O منها O . O لكن O لعدة O سنوات O لم O يحل O لغز O هذا O التشابه O في O هذا O السلوك O الصفاتي O . O وحدسثنا O السابق O كان O حول O الذرة O المتعادلة O الشحنات O كهربائيا O . O والمجموعات O من O 13 O - O 18في O الجانب O الأيمن O من O المجموعة O يوجد O خط O فاصل O فوقه O اللامعادن O nonmetals B-MISC كالأكسجين B-MISC oxygen B-MISC والكربون B-MISC carbon B-MISC والنيتروجين B-MISC nitrogen B-MISC وفي O الجزء O الأسفل O علي O اليسار O يوجد O القصدير B-MISC tin B-MISC والرصاص B-MISC lead B-MISC . O فأمكن O التعرف O من O خلال O التعرف O علي O مكنونات O الذرة O علي O تفسيرات O للنماذج O المتكررة O بالجدول O الدوري O . O فالنظام O المتبع O ، O الترتيب O حسب O العدد O الذري O للعناصر O . O العناصر O الموجودة O في O كل O مجموعة O لها O نفس O تركيب O غلاف O التكافؤ O من O حيث O عدد O الإلكترونات B-MISC , O وهذا O يعطى O لهذه O العناصر O تشابها O في O الخواص O . O - O توصل O الحرارة O والكهرباء O لكن O ليس O بكفاءة O المعادن O . O هذه O العناصر O الصناعية O لم O يطلق O عليها O أسماء O رسمبة O حتي O الآن O . O وأحدث O عنصر O حضر O ، O به O 116بروتون B-MISC في O نواة O كل O ذرة O . O ولم O يكن O يعرف O لها O تفسيرا O . O وكانت O خواصها O تشبه O ما O ذكره O مندليف B-PER عنها O . O و O المكتبات O العامة O و O مكتبات O الإعارة O و O الجامعات O التي O كانت O تمنح O درجات O علمية O و O المراصد O الفلكية O . O يمكن O ربط O العديد O من O هذا O التعلم O و O التطور O بالجغرافيا O . O هناك O سبب O آخر O لازدهار O العالم B-LOC الإسلامي I-LOC في O هذه O الفترة O و O هو O تركيز O الحضارة O الإسلامية O على O حرية O الكلام O ، O و O يمكن O بيان O هذا O من O خلال O النص O التالي O المأخوذ O من O رسالة O أرسلها O الهاشمي B-PER ( O و O هو O قريب O للخليفة O المأمون B-PER ) O إلى O أحد O خصومه O الدينيين O و O حيث O كان O الهاشمي B-PER يحاول O هديه O إلى O الإسلام O من O خلال O المنطق O : O نعنبر O الدراسات O العربية O الإسلامية O بمثابة O أحدث O الدراسات O التي O تناولت O البيئة O و O علم O البيئة O ، O و O خصوصا O التلوث O ، O من O الأمثلة O على O هذه O الدراسات O ما O كتبه O الكندي B-PER و O الرازي B-PER و O ابن B-PER الجزار I-PER و O التميمي B-PER و O ابن B-PER النفيس I-PER . O كتب O السير O جون B-PER باجوت I-PER جلب I-PER : O ويوجد O آليات O أخرى O لإنتاج O الضوء O : O سرعة O الضوء O في O الزجاج O هي O ثلثي O سرعة O الضوء O في O الفراغ O . O وعند O تسليط O الإشعاع O يلاحظ O تحرك O مؤشر O الجهاز O دلالة O على O وجود O تيار O كهربائي O ، O أي O أن O عددا O من O الإلكترونات B-MISC انتزعت O من O المعدن O وانتقلت O تحت O تأثير O الحقل O الكهربائي O إلى O القطب O الموجب O . O 3 O - O سرعة O الموجة O ( O υ O ) O متر O / O ثانية O . O حيث O ( O E O ) O هي O الطاقة O و O ( O h O ) O هو O ثابت O يسمى O ثابت O بلانك B-PER ويساوي O 6 O . O و O نظرا O لأن O حساسية O العين O تختلف O باختلاف O طول O موجة O الأشعة O الضوئية O المستقبلة O فهي O قادرة O على O التمييز O بين O الألوان O المختلفة O . O E O = O h O . O و O تقاس O أطوال O الموجات O الضوئية O بوحدات O صغيرة O جدا O مثل O الميكرومتر O و O النانومتر O و O الانجستروم O . O المفعول O الكهرضوئي O يتلخص O فيمايلي O : O يسلط O إشعاع O ضوئي O على O معدن O موضوع O في O ناقوس O مفرغ O من O الهواء O وفي O وجود O حقل O كهربائي O مطبق O بين O قطبين O مربوطين O بمقياس O التيار O الكهربائي O . O تستطيع O بعض O الحيوانات O رؤية O بعض O الأطوال O الموجية O الطويلة O مثل O النحل O . O فالجسيم O المتذبذب O يؤثر O بقوة O على O جارة O فتجعله O يتذبذب O أيضا O وبهذه O الطريقة O فأن O الحركة O من O جسيم O إلى O آخر O وبالتالي O يتم O انتقال O الطاقة O الموجية O في O المادة O ، O وهي O حالة O مشابهة O لما O يحدث O في O الماء O عندما O تنقل O الطاقة O إلى O الضفة O دون O أن O تنتقل O جسيمات O الماء O نفسه O أو O انتقال O الصوت O في O الهواء O . O f O حيث O c O سرعة O الضوء O في O الفراغ O . O يمكن O تحفيز O المواد O الفسفورية O بتسليط O جسيمات O دون O الذرية O عليها O . O يحدد O المدى O التقريبي O للطيف B-MISC الكهرومغناطيسي I-MISC من O موجات O الراديو O ذات O الطول O الموجي O الطويل O إلى O أشعة B-MISC جاما I-MISC ذات O الطول O الموجي O القصير O جدا O والطاقة O العالية O . O ويمكن O أيضا O أن O يكون O الإصدار O محفزا O ، O كما O هو O الحال O في O الليزر O أو O في O الموجات O الدقيقة O للمايزر O . O وبالتالي O يمكن O توصيف O المضياء O مسبقا O ، O ولكن O قد O لا O يمكننا O تصنيعه O عمليا O . O قام O رونالدو B-PER بتوقيع O عقد O انتقاله O لمانشستر B-LOC بمبلغ O وصل O قدره O إلى O 12 O . O بل O أموال O ريال B-ORG مدريد I-ORG وحدها O كافية O لشراء O 10 O من O كريستيانو B-PER ويبقى O الكثير O . O في O الدور O النصف O نهائي O ، O إلتقى O منتخب B-ORG البرتغال I-ORG لكرة O القدم O نظيره O الفرنسي O ، O و O استطاع O المنتخب B-ORG الفرنسي I-ORG الفوز O بهدف O مقابل O لا O شيء O ، O و O قد O ألتقى O منتخب B-ORG البرتغال I-ORG صاحب O الأرض O و O الجمهور O منتخب B-ORG ألمانيا I-ORG لكرة O القدم O في O مباراة O تحديد O المركز O الثالث O و O الرابع O ، O و O استطاع O منتخب B-ORG ألمانيا I-ORG أن O يفوز O بثلاثة O أهداف O مقابل O هدف O واحد O ، O و O في O نهاية O البطولة O ، O كان O كريستيانو B-PER رونالدو I-PER يتنافس O مع O الألماني O لوكاس B-PER بودولسكي I-PER و O الإكوادوري O لويس B-PER فالنسيا I-PER على O جائزة O أفضل O لاعب O ناشئ O في O البطولة O ، O و O لكن O لوكاس B-PER بودولسكي I-PER ربح O هذه O الجائزة O بعد O أن O رأت O اللجنة O المختارة O أن O تصرفات O رونالدو B-PER لا O تساعده O على O الفوز O بمثل O هذه O الجائرة O . O يملك O رونالدو B-PER منزلا O يصل O قيمته O إلى O 3 O ملايين O جنيه B-MISC إسترليني I-MISC في O أحد O ضواحي O مانشستر B-PER . O في O 25 O نوفمبر O 2006 O أكدت O صحيفة O " O صن O " O البريطانية O أن O رونالدو B-PER سيصبح O أخصائي O ضربات O الجزاء O في O مانشستر B-ORG يونايتد I-ORG بعد O إخفاق O المهاجم O الفرنسي O لويس B-PER ساها I-PER في O تسديد O ضربة O الجزاء O التي O احتسبت O لمانشستر B-LOC في O إحدى O مباراته O بمسابقة O دوري B-MISC أبطال I-MISC أوروبا I-MISC . O عندما O ترغب O أن O تعرف O عن O شخص O ما O أو O تتحدث O عن O سيرة O لاعب O فأنك O تحتاج O إلى O مقدمة O لكي O تستطيع O أن O تعرف O عنه O , O لكن O عندما O يكون O التعريف O عن O أسطورة O فأنك O لا O تحتاج O سوى O بعض O الكلمات O أو O تلوح O ببعض O الأشارات O مثل O تقبيل O الخاتم O , O راؤول B-PER غونزاليز I-PER أو O كما O يحب O أن O يطلقوا O عليه O عشاق O الريال B-ORG " O روح O البلانكو O " O , O كانت O بداية O إنطلاقة O راؤول B-PER من O روماريدا B-LOC معقل O ريال B-ORG سرقسطه B-LOC , O وأول O هدف O له O كان O في O مرمى O الغريم O المدريدي O أتلتكو B-ORG مدريد I-ORG . O راؤول B-PER غونزاليس I-PER أو O راؤول B-PER أو O الفتى O المدلل O لاعب O كرة O قدم O إسباني O ولد O في O 27 O يونيو O 1977 O في O مدريد B-LOC في O إسبانيا B-LOC وحاليا O يلعب O لنادي B-ORG ريال I-ORG مدريد I-ORG الإسباني I-ORG انتقل O اللاعب O من O نادي B-ORG اتليتكو I-ORG مدريد I-ORG عام1994 O . O تم O إقالة O فالدانو B-PER مكتشف O راؤول B-PER وتم O تعيين O بدلا O عنه O المدرب O الشهير O الدون O فابيو B-PER كابيلو I-PER , O وكانت O الليغا B-MISC الأسبانية I-MISC تضم O 22 O نادي O أي O بمعنى O إن O إحمالي O مباريات O لكل O فريق O في O الدوري O 42 O مباراة O , O وأشرك O كابيلو B-PER راؤول B-PER في O جميع O مباريات O الفريق O الدوري O وأستطاع O راؤول B-PER أن O يسجل O 21 O هدف O وصنع O 25 O هدف O , O ولعب O في O كأس B-MISC إسبانيا I-MISC خمس O مباريات O وسجل O هدف O واحد O , O وحقق O ريال B-ORG مدريد I-ORG في O ذلك O الموسم O لقب O الدوري B-MISC الأسباني I-MISC , O وفي O نهاية O الموسم O رحل O كابيلو B-PER إلى O إيطاليا B-LOC . O وصار O كمن O عمر O تلك O السنين O وعنى O بتلك O العنايات O . O يبين O الرازي B-PER في O نقده O لكتاب O " O البرهان B-MISC " O ما O أهمله O جالينوس B-PER من O ملائمة O العين O لوظيفتها O باتساع O الناظرين O في O الظلمة O وضيقها O في O النور O ، O ومنها O قوله O ( O أي O قول O جالينوس B-PER ): O " O أنا O إذا O غمضنا O إحدى O العينين O اتسع O ثقب O الناظر O في O الأخرى O فنعلم O يقينا O أنه O يملؤه O جوهر O جسمي O ". O ويستشهد O الرازي B-PER بقول O ينسب O إلى O أرسطوطاليس B-PER ، O فيقول O " O اختلف O الحق O وفلاطن O - O وكلاهما O لنا O صديق O ( O إلا O أن O الحق O أصدق O من O فلاطن O ". O في O الري B-LOC اشتهر O الرازي B-PER وجاب O البلاد O وعمل O رئيسا O للبيمارستان B-LOC المعتضدي I-LOC له O الكثير O من O الرسائل O في O شتى O مجالات O الأمراض O وكتب O في O كل O فروع O الطب O والمعرفة O في O ذلك O العصر O ، O وقد O ترجم O بعضها O إلى O اللاتينية O لتستمر O المراجع O الرئيسية O في O الطب O حتى O القرن O السابع O عشر O ، O ومن O أعظم O كتبه O " O تاريخ B-MISC الطب I-MISC " O وكتاب O " O المنصوري B-MISC " O في B-MISC الطب I-MISC و O كتاب O " O الأدوية B-MISC المفردة I-MISC " O الذي O يتضمن O الوصف O الدقيق O لتشريح O أعضاء O الجسم O . O يقول O الرازي B-PER في O كتاب O " O المرشد B-MISC أو I-MISC الفصول I-MISC ": O " O ليس O يكفي O في O أحكام O صناعة O الطب O قراءة O كتبها O . O وعلى O الأرجح O أنه O ولد O في O سنة O 251 O ه O / O 865 O م O . O 250 O ه O / O 864 O م O - O 5 O شعبان O 311ه O / O 19 O نوفمبر O 923 O م O )، O ولد O في O مدينة O الري B-LOC في O خراسان B-LOC ببلاد B-LOC فارس I-LOC . O يذكر O كل O من O ابن B-PER النديم I-PER و O القفطي B-PER أن O الرازي B-PER كان O قد O دون O أسماء O مؤلفاته O في O " O فهرست O " O وضعه O لذلك O الغرض O . O وإذا O أمعنا O النظر O في O قول O الرازي B-PER : O " O وأخبرني O من O كنت O أقرأ O عليه O أن O المأمون B-PER افتصد O " O ثم O قوله O " O وخبرني O بعض O من O كنت O أتعلم O عنه O الفصد O " O لا O ستدللنا O على O أن O الرازي B-PER درس O الطب O على O أستاذ O طيب O ، O ولكنه O تعلم O الفصد O عند O فصاد O من O غير O الأطباء O ، O ممن O كانوا O يمارسون O " O أعمال O الطب O الجزئية O ". O ألف O جالينوس B-PER ( O 130 O م O تقريبا O - O 200 O م O تقريبا O ) O كتابا O في O الفصد O في O ثلاثة O مقالات O ، O وخصص O المقالتين O الأولى O والثانية O من O هذا O الكتاب O لمناقضة O أرسطوطاليس B-PER من O مدرسة B-LOC الإسكندرية I-LOC القديمة I-LOC ، O القرن O الرابع O ق O . O شغل O مناصب O مرموقة O في O الري B-LOC وسافر O ولكنه O أمضى O الشطر O الأخير O من O حياته O بمدينة O الري B-LOC ، O وكان O قد O أصابه O الماء O الأزرق O في O عينيه O ، O ثم O فقد O بصره O وتوفى O في O مسقط O رأسه O إما O في O سنة O 313ه O / O 925 O م O ، O وإما O في O سنة O 320 O ه O / O 932 O م O . O م O )، O فيقول O ، O أن O الفارق O بينهما O في O الكم O وليس O في O الكيف O . O فيما O ياي O جدول O الميداليات O العربية O تم O عزف O كل O من O النشيد O الوطني O اليوناني O و O الصيني O أثناء O التبادل O ، O و O عند O الانتهاء O من O التبادل O أعلن O رسميا O انتهاء O دورة O الألعاب B-MISC الأولمبية I-MISC الثامنة I-MISC و I-MISC العشرون I-MISC . O بعدها O بدائت O الدول O في O الدخول O ( O 202 O دولة O ، O بالأصل O كانت O 220 O دولة O مدعوة O للتمثيل O في O الأولمبيات B-MISC وذلك O لأغراض O سياسية O و O لكن O عدد O الدول O التي O شاركت O بلاعبيها O و O لاعباتها O كانت O 202 O دولة O فقط O ) O مرتبة O هجائيا O حسب O الحروف O اليونانية O مما O جعل O الصين B-LOC والفلبين B-LOC وفنلندا B-LOC من O آخر O الدول O في O الدخول O . O أستاد B-LOC أثينا I-LOC الأولمبي I-LOC الذي O سوف O يتم O به O افتتاح O واختتام O الاحتفالات O لم O ينته O الا O قبل O شهرين O افتتاح O المباريات O مع O افتقاره O للتجهيزات O النهائية O . O فرديا O تبدو O مصر B-LOC في O طليعة O العرب B-PER ب21 O ميدالية O منها O 7 O ذهبيات O وتحتل O المركز O السابع O والأربعين O عالميا O ، O وقد O بدأ O فوز O العرب B-PER بالميداليات O الأولمبية O منذ O دورة O أمستردام B-LOC عام O 1928 O ، O واستمر O تقريبا O دون O توقف O ، O ولكن O المقارنة O بين O 5 O ميداليات O أولمبية O عربية O في O أمسترادم B-LOC ( O 1928 O ) O ، O و7 O ميداليات O عربية O في O أتلانتا B-LOC ( O 1996 O ) O و O 10 O ميداليات O في O أثينا B-LOC ( O 2004 O ) O تعطي O فكرة O عن O بطء O التقدم O أو O المراوحة O في O المكان O للرياضة O العربية O خصوصا O وأن O الميداليات O العربية O انحسرت O منذ O البداية O تقريبا O في O 6 O رياضات O فردية O فقط O هي O ألعاب O القوى O ، O الملاكمة O ، O المصارعة O ، O رفع O الأثقال O ، O الجودو O ، O والغطس O . O أقيم O حفل O الافتتاح O في O 13 O أغسطس O من O 2004 O والذي O تم O الاستعداد O له O بإدارة O المصم O الأيحائي O اليوناني O ديمترس B-PER بابايوانو I-PER . O ‏ O فصرفت‏ O . O وكانت O ولاية O بن B-PER طولون I-PER على O مصر B-LOC أول O الأمر O قاصرة O على O الفسطاط B-LOC فقط O ، O أما O أمر O الخراج O فكان O موكولا O إلى O ابن B-PER المدير I-PER ، O فما O زال O أحمد B-PER يوسع O في O نفوذه O حتى O شمل O سلطانه O مصر B-LOC جميعها O ، O وتولى O أمر O الخراج O وتوسع O حتى O الشام B-LOC و O برقة B-LOC مؤسسا O الدولة B-LOC الطولونية I-LOC التي O حكمت O مصر B-LOC من O سنة O 254 O إلى O 292 O هجرية O = O 868 O إلى O 905م O وتوفى O سنة O 270 O هجرية O = O 884م O وتأتي O أهمية O أحمد B-PER بن I-PER طولون I-PER من O أنه O تتمثل O فيها O النقلة O التي O انتقلتها O مصر B-LOC من O ولاية O تابعة O ل O الخلافة O العباسية O إلى O دولة O ذات O استقلال O ذاتى O . O مئذنة O المسجد O هي O أقدم O مئذنة O موجودة O في O مصر B-LOC . O قال‏ O : O ‏ O ولما O بنى O أحمد B-PER بن I-PER طولون I-PER هذه O السقاية O بلغه O أن O قوما O لا O يستحلون O شرب O مائها O قال O محمد B-PER بن I-PER عبد I-PER الله I-PER بن I-PER عبد I-PER الحكم I-PER الفقيه‏ I-PER : O ‏ O كنت O ليلة O في O داري O إذ O طرقت O بخادم O من O خدام O أحمد B-PER بن I-PER طولون I-PER فقال O لي‏ O : O ‏ O الأمير O يدعوك O فركبت O مذعورا O مرعوبا O فعدل O بي O عن O الطريق O فقلت‏ O : O ‏ O أين O تذهب O بي O فقال‏ O : O ‏ O إلى O الصحراء O والأمير O فيها‏ O . O ويغطى O الأروقة O الأربعة O سقف O من O الخشب O حديث O الصنع O ، O عمل O على O نفس O نمط O السقف O القديم O ، O وبأسفلة O أعيد O وضع O الإزار O الخشب O القديم O ، O المكتوب O عليه O من O الآيات O القرآنية O بالخط O الكوفى O المكبر O . O وأوقف O التقليد O المتبع O بإعطاء O الكأس O لمن O يفوز O به O ثلاث O مرات O . O مع O استمرار O الحدث O الأوليمبي O بقيام O المبارات O بين O الفرق O الهاوية O ، O نظم O السير O توماس B-PER ليبتون I-PER " O بطولة O كأس O السير O توماس B-PER ليبتون I-PER " O في O تورين B-LOC عام O 1909 O . O و O في O بطولات O كأس O العالم O ما O بين O 1934 O و O 1978 O تنافست O 16 O دولة O للفوز O بكأس O العالم O ، O بإستثناء O 1938 O و O 1950 O حين O إنسحبت O بعض O الفرق O بعد O تأهلها O ، O و O قد O لعبت O تلك O البطولات O ب15 O و O 13 O فريق O ، O و O كانت O معظم O الفرق O المشاركة O من O أوروبا B-LOC و O أمريكا B-LOC الجنوبية I-LOC ، O مع O مشاركة O قليلة O من O أمريكا B-LOC الشمالية I-LOC و O آسيا B-LOC و O أفريقيا B-LOC و O أوقيانوسيا B-LOC ، O و O كانت O هذه O الفرق O محط O عبور O لفرق B-ORG أمريكا I-ORG الجنوبية I-ORG و O أوروبا B-LOC ، O و O حتى O عام O 1978 O تأهلت O القليل O من O الفرق O إلى O ما O بعد O الدور O الأول O مثل O منتخب B-ORG الولايات I-ORG المتحدة I-ORG لكرة O القدم O في O عام O 1930 O تأهل O إلى O الدور O النصف O نهائي O ، O و O منتخب B-ORG كوبا I-ORG لكرة O القدم O تأهل O إلى O الدور O الربع O نهائي O في O عام O 1938 O ، O و O منتخب B-ORG كوريا I-ORG الشمالية I-ORG لكرة O القدم O تأهل O إلى O الدور O الربع O نهائي O في O عام O 1966 O ، O و O منتخب B-ORG المكسيك I-ORG لكرة O القدم O تأهل O إلى O الدور O ربع O النهائي O في O عام O 1970 O . O و O قد O كانت O بطولة O كأس O العالم O لكرة O القدم O 1950 O الأولى O التي O تشارك O فيها O الدول B-LOC البريطانية I-LOC ، O و O قد O انسحبت O الفرق B-ORG البريطانية I-ORG من O الفيفا B-ORG في O عام O 1920 O لأنهم O رفضوا O اللعب O مع O الدول O التي O حاربتهم O في O الحرب B-MISC العالمية I-MISC الأولى I-MISC ، O و O قد O شهدت O البطولة O عودة O منتخب B-ORG الأوروغواي I-ORG لكرة O القدم O بطل O كأس O العالم O لكرة O القدم O 1930 O ، O و O قد O فازت O باللقب O مرة O أخرى O . O ككل O ، O شاركت O 13 O دولة O في O البطولة O ، O سبع O منها O من O أمريكا B-LOC الجنوبية I-LOC ، O وأربع O من O أوروبا B-LOC ، O واثنتين O من O أمريكا B-LOC الشمالية I-LOC . O لكن O مشوار O البرازيل B-LOC انقطع O بطولة O 1966 O عندمافازت O إنجلترا B-LOC أصحاب O الأرض O والجمهور O بالكأس O لتمنعهم O من O الإحتفاظ O به O ولو O لأربع O سنوات O زوتحقق O الحلم O البرازيلي O في O المكسيك B-LOC عام O 1970 O واحتفظوا O بالكأس O عندما O فازوا O على O بيرو B-LOC ولكن O الكأس O سرق O ولم O يعثر O عليه O كما O عثر O عليه O عام O 1966 O . O وقيمة O 94€ O مليون O يورو B-MISC ( O أكثر O من O 130$ O مليون O دولار B-MISC , O 80£ O مليون O جنيه B-MISC استرليني I-MISC ) O التي O دفعت O لأجل O انتقال O كريستيانو B-PER رونالدو I-PER من O نادي B-ORG مانشستر I-ORG يونايتد I-ORG إلى O ريال B-ORG مدريد I-ORG موسم O 2009 O تعتبر O أعلى O قيمة O شراء O لاعب O في O تاريخ O كرة O القدم O . O ريال B-ORG مدريد I-ORG أحرز O أول O بطولة O دوري O في O تاريخه O موسم O 1931–32 O . O و O معدل O الحضور O الجماهيري O لريال B-ORG مدريد I-ORG في O موسم O 2007 O - O 08 O كان O 76 O , O 234 O , O وهو O الأعلى O بين O جميع O دوريات O كرة O القدم O الأوروبية O . O الفريق O يلعب O جميع O مبارياته O الرسمية O في O ملعب B-LOC سانتياغو I-LOC بيرنابيو I-LOC في O العاصمة O مدريد B-LOC . O وأيضا O يعتبر O حاليا O أغنى O نادي O في O العالم O حسب O الميزانية O السنوية O . O القائمة O تحتوي O على O المدربين O الذين O أحرزوا O مع O الفريق O بطولة O أو O أكثر O . O وفي O عام O 1920 O , O تم O تعديل O مسمى O الفريق O ليصبح O باسم O ريال B-ORG مدريد I-ORG من O قبل O ملك O إسبانيا B-LOC ألفونسو B-PER الثالث I-PER عشر I-PER حيث O منح O لقب O " O ريال O " O والتي O تعني O ( O ملكي O ) O للفريق O . O وهناك O خطة O مستقبلية O تم O الكشف O عنها O ومن O أهم O نقاطها O تغطية O الملعب O بسقف O متحرك O . O المشاركات O اللاعب O المدة O الأهداف O بطاقة O تعريفية O : O برتغال B-LOC الفشل O الذريع O بعد O مونديال O 1966 O .. O قضى O بوبورسكي B-PER على O أحلام O البرتغال B-LOC بهدف O وحيد O للتشيك B-LOC .. O 3 O - O 2 O بأهداف O نونو B-PER غوميش I-PER ، O لويس B-PER فيغو I-PER وجواو B-PER بينتو I-PER .. O ثم O فازت O البرتغال B-LOC 1 O - O 0 O على O رومانيا B-LOC بهدف O كوستينها B-PER .. O قبل O أن O يحقيق O كونسيساو B-PER 8 O - O 0 O بلشبونة B-LOC .. O في O الثامن O عشر O من O نوفمبر O 1994 O .. O في O إطار O إقصائيات O كأس B-MISC أمم I-MISC أوروبا I-MISC .. O بعدها O تأهلت O البرتغال B-LOC لليورو O ، O وفي O البداية O تمكنت O وحصلت O على O سبع O نقاط O بسهولة O . O ستبقى O هذه O السنة O محفورة O في O ذاكرة O كل O برتغالي B-PER ، O حينما O تمكن O البرتغال B-LOC من O تحقيق O إنجاز O رائع O في O مونديال O 1966 O الذي O أقيم O بإنجلترا B-LOC .. O حيث O وقع O وبعد O وفاة O مروان B-PER بن I-PER الحكم I-PER خلفه O ابنه O عبد B-PER الملك I-PER بن I-PER مروان I-PER الذي O يعتبر O المؤسس O الفعلي O للخلافة O الاموية O بدمشق B-LOC وقام O بتوسيع O الحكم O وتوطيد O دعائم O واركان O الدولة O وعدل O في O حكمه O وكان O له O شأن O كبير O ونشر O العلم O وحافظ O هلى O روابط O الدولة O في O ازدياد O اتساعها O في O جميع O الاتجاهات O نحو O الشرق O والغرب O واهتم O عبد B-PER الملك I-PER بن I-PER مروان I-PER بالعمارة O وانشأ O دور O العبادة O والمدارس O العلمية O في O دمشق B-LOC وغيرها O من O البلاد B-LOC الإسلامية I-LOC . O انحصر O أمر O الخلافة O بعد O أول O جلسة O شورى O بين O علي B-PER بن I-PER أبي I-PER طالب I-PER كرم O الله O وجهه O و O عثمان B-PER بن I-PER عفان I-PER ، O مما O دفع O بالأمر O لإجراء O استفتاء O في O المدينة B-LOC قام O به O عبد B-PER الرحمن I-PER بن I-PER عوف I-PER و O كانت O نتيجته O لصالح O عثمان B-PER بن I-PER عفان I-PER ، O و O يشير O الكثير O من O المؤرخين O أن O الناس O كانت O قد O ملت O سياسات O ابن O الخطاب O التقشفية O و O كانت O تخشى O أن O زاهدا O جديدا O مثل O ابن B-PER أبي I-PER طالب I-PER سيستمر O بزجرهم O من O الإستمستاع O بالثروات O الجديدة O ، O أما O ابن B-PER عفان I-PER فهو O ثري O أصلا O و O تقوا O فهو O لا O يرى O ضيرا O من O التمتع O بما O آتاه O الله O من O نعم O . O قبل O وفاة O ابن B-PER الخطاب I-PER يفطن O إلى O طريقة O جديدة O في O اختيار O الخليفة O القادم O تخلصه O من O مسؤولية O الاختيار O و O التي O ستكون O تطبيقا O فريدا O لمبادئ O الشورى O التي O يحض O عليها O الإسلام O : O ما O كان O من O عمر B-PER إلا O أن O اختار O مجموعة O من O ستة O أشخاص O ( O هم O من O بقي O من O العشرة O المبشرين O بالجنة O ) O أي O إنهم O أشخاص O قد O حازوا O رضا O الله O و O رسوله O و O أمرهم O أن O يجتمعوا O بعد O موته O لاختيار O خليفة O المسلمين B-PER . O و O قبل O موته O عادت O مشكلة O الخلافة O من O جديد O فما O كان O من O أبي B-PER بكر I-PER إلا O أن O حلها O بالوصية O إلى O عمر B-PER بن I-PER الخطاب I-PER الذي O أصبح O خليفة O . O لكن O نقطة O الضعف O الأساسية O أنهم O يقدمون O بعد O ذلك O توصيفا O للأحداث O بدون O تفسيرها O فبعض O السنة B-PER تؤكد O على O عدم O الخوض O في O تفاصيل O الفتنة O و O الخلاف O بين O معاوية B-PER و O علي O باعتبار O الإثنين O من O الصحابة O و O كلاهما O مغفور O لهما O ، O أما O الفريق O الآخر O من O أهل O السنة B-PER و O الجماعة B-PER فيؤكد O خطأ O معاوية B-PER في O الخروج O على O علي B-PER و O يثبتون O أحقية O علي B-PER بدلالة O انتخابه O و O بيعته O . O عرف O أبو B-PER بكر I-PER مباشرة O أن O مثل O هذه O الحركات O تهدد O وحدة O الأمة O و O الدين O و O كان O رده O مباشرة O عن O طريق O مجموعة O حملات O عسكرية O على O القبائل O المرتدة O عرفت O بحروب O الردة B-MISC . O لأن O نظام O جنو B-MISC / O لينكس B-MISC يتطلب O وجود O صلاحيات O لتنفيذ O أي O أمر O وبسبب O كون O الفيروسات O تقوم O بتنفيذ O أعمال O محددة O وبآلية O معينة O فإنه O من O الصعوبة O أن O يحصل O الفيروس O على O صلاحية O للقيام O بعمل O تخريبي O هذا O بالنسبة O للفيروسات O الموجهة O لبرامج O جنو B-MISC / O لينكس B-MISC أما O الفيروسات O الموجهة O للنواة O فإنها O تصادف O مشكلة O التطور O المستمر O للنواة O . O يوجد O في O جنو B-MISC / O لينكس B-MISC العديد O من O التطبيقات O المختلفة O و O لكنها O لا O ترتقي O إلى O مستوى O تلك O الموجودة O في O أنظمة O ويندوز B-MISC و O ماك B-MISC أو O إس B-MISC ، O خاصة O ألعاب O الحاسوب O حيث O لا O يوجد O في O جنو B-MISC / O لينكس B-MISC سوى O القليل O من O الألعاب O التجارية O و O التي O تعد O على O أصابع O اليد O وغالبا O ما O تصدر O بعد O صدور O اللعبة O على O باقي O الأنظمة O و O المنصات O بعدة O شهور O . O يتمتع O نظام O جنو B-MISC / O لينكس B-MISC بدرجة O عالية O من O الأمن O و O الموثوقية O . O بدأ O ريتشارد B-PER ستالمن I-PER مشروع O جنو B-MISC في O 27 O سبتمبر O من O العام O 1983 O ، O لبناء O نظام B-MISC تشغيل I-MISC حر O بالكامل O يوفر O لمستخدمي O الحاسوب O حريتهم O ويعفيهم O من O الاضطرار O لاستخدام O برمجيات O محتكره O تسلبهم O حريتهم O في O تعديل O وتطويع O ومشاركة O البرمجيات O مع O بعضهم O البعض O . O في O هذه O الأثناء O ، O عام O 1991 O ، O بدأ O تطوير O نواة O أخرى O كهواية O للطالب O الفنلدي O لينوس B-PER تورفالدز I-PER أثناء O دراسته O في O جامعة B-LOC هلسينكي I-LOC في O فنلندا B-LOC . O إي B-MISC و O جنوم B-MISC مع O آلاف O البرمجيات O و O الحزم O البرمجية O من O طقم O المكتب O إلى O المصرفات O compiler O و O محررات B-MISC النصوص I-MISC و O بعض O البرامج O العلمية O . O حينما O كان O الزوار O محتشدين O ويبدو O أنها O كانت O قد O سقطت O تلك O البناية O في O زيارة O عرفة O وهي O من O الزيارات O المخصوصة O لحرم O الحسين B-PER ( O عليه O السلام O ) O ويكثر O فيها O الناس O وقد O أصيبت O من O جراء O السقوط O خلق O كثير O فقد O هدمت O السقيفة O مرة O واحدة O ونجا O من O الزوار O جمع O غفير O كان O من O بينهم O أبو B-PER عبد I-PER الله I-PER محمد I-PER بن I-PER عمران I-PER بن I-PER الحجاج I-PER وهو O من O وجوه O أهل O الكوفة B-LOC وهو O الذي O نقل O الخبر O . O وهو O المحل O الذي O ذبح O فيه O الإمام O الحسين B-PER ( O عليه O السلام O )، O وموقعه O إلى O الجنوب O الغربي O من O الرواق O ، O ويتألف O من O غرفة O خاصة O لها O باب O فضي O ، O وأرضيتها O من O المرمر O الناصع O ، O وفيها O سرداب O يعلوه O باب O فضي O أيضا O ، O ويطل O من O هذه O الغرفة O شباك O على O الصحن O من O الخارج O . O يحيط O بالحرم B-LOC الحسيني I-LOC أربعة O أروقة O ، O من O كل O جهة O رواق O ، O يبلغ O عرض O الرواق O الواحد O ( O 5 O م O )، O وطول O ضلع O كل O من O الرواق O الشمالي O والجنوبي O ( O 40 O م O ) O تقريبا O ، O وطول O ضلع O كل O من O الرواق O الشرقي O والغربي O ( O 45 O م O ) O تقريبا O . O فلقد O أتاه O بنو B-PER أبيه I-PER بمثله***هذا O لعمرك O قبره O مهدوم O فتظاهر O بالتقرب O والميل O إلى O العلويين B-PER باعتبارهم O أصحاب O حق O بالخلافة O فاسند O ولاية O العهد O إلى O الإمام O الرضا B-PER ( O عليه O السلام O ) O واستبدل O شعار O العباسيين B-PER بشعار O العلويين B-PER وذلك O عام O 193ه O وأمر O ببناء O قبر O الحسين B-PER عليه O السلام O وفسح O المجال O للعلويين B-PER وغيرهم O بالتنقل O وزيارات O قبور O الأئمة O فتنفس O الشيعة B-PER نسيم O الحرية O وعبير O الكرامة O وذاقوا O طعم O الاطمئنان O . O والنتيجة O كانت O أن O نول O Jacquard B-MISC لم O يتم O اعتباره O حاسوبا O حقيقيا O ولكنه O كان O خطوة O هامة O في O تطوير O الحواسيب B-MISC الرقمية I-MISC الحديثة O . O بدأ O عدد O من O المشاريع O لتطوير O حاسوب O يعتمد O على O بنية O البرنامج O المخزن O في O منتصف O إلى O آخر O الأربعينات O من O القرن O العشرين O . O نظم B-MISC التشغيل I-MISC للمايكروكمبيوتر B-MISC القديم O ذي O الذاكرة O و O قدرات O المعالجة O المحدودتين O كانت O لا O تقدم O كل O المهام O ، O و O الحواسيب B-MISC المدمجة I-MISC دائما O إما O تملك O نظم O تشغيل O متخصصة O أو O لا O تملك O نظام B-MISC تشغيل I-MISC بالكلية O ، O مع O برامجه O التطبيقية O المتخصصة O و O التي O تؤدي O المهام O التي O من O الممكن O أن O تعود O بطريقة O أخرى O إلى O نظام B-MISC التشغيل I-MISC . O إن O تصميمات O الحاسوب O المقاد O بأنبوب B-MISC الصمام B-MISC أصبحت O قيد O الاستخدام O خلال O الخمسينات O من O القرن O العشرين O ، O و O لكن O مع O الوقت O تم O استبدالها O بالحواسيب B-MISC الترانزستورية I-MISC حيث O أنها O أصغر O و O أسرع O و O أرخص O و O أكثر O موثوقية O ، O كل O ذلك O أتاح O لها O أن O يتم O إنتاجها O على O المستوي O التجاري O و O ذلك O في O الستينات O من O القرن O العشرين O . O بانتهاء O الستينات O من O القرن O العشرين O ، O و O مع O الاستخدام O الصناعي O الواسع O للحاسوب O في O العديد O من O الأغراض O ، O أصبح O من O الشائع O استخدامه O لإنجاز O العديد O من O الوظائف O في O المؤسسات O . O و O بسبب O التطور O التقاني O فإن O الحواسيب O الحديثة O تكون O بشكل O جبري O أكثر O قدرة O من O تلك O التي O من O الأجيال O السابقة O ( O ظاهرة O موصوفة O و O مشروحة O جزئيا O بقانون O مور O ). O النوع O الأول O هو O أجهزة O التخزين O الثانوية O مثل O الأقراص O الصلبة O ( O hard O disks O ) O و O وحدات O الأسطوانات O ( O CD O - O ROM O ) O و O key O drives O و O ما O يماثلها O و O التي O تتميز O بالبطء O نسبيا O و O لكنها O ذات O سعات O تخزينية O عالية O ، O حيث O يمكن O تخزين O المعلومات O لاستعادتها O لاحقا O : O النوع O الثاني O هي O الأجهزة O المستخدمة O للاتصال O بشبكات O الحاسب O . O إن O قارئ B-MISC الكروت I-MISC المثقبة I-MISC أو O الاشياء O المماثلة O كانت O تستخدم O لإدخال O الأوامر O و O البيانات O في O ذاكرة O الحاسوب O ، O و O كذلك O استخدم O بعض O أنواع O الطابعات O و O هو O في O العادة O عبارة O عن O teletype B-MISC معدل O لتسجيل O النتائج O . O الحواسيب O متنوعة O ، O في O الواقع O إنها O آلات O معالجة O بيانات O عالمية O . O كان O تشارلز B-PER باباج I-PER أول O من O فكر O و O صمم O حاسوبا O مبرمجا O بالكامل O و O ذلك O في O بداية O عام O 1820 O ولكن O بسبب O مجموعة O من O الحدود O التقنية O في O ذلك O الوقت O والمحدودية O المالية O ، O و O كذلك O عدم O القدرة O على O حل O مشكلة O الإصلاح O غير O الجيد O في O تصميمه O فإن O الجهاز O لم O يتم O بناءه O فعليا O في O حياته O . O إن O إدارة O هذه O المشاريع O شديدة O التعقيد O هو O مفتاح O إمكانية O تنفيذ O هذه O المشاريع O : O لغات O البرمجة O و O تطبيقات O البرمجة O تسمح O بتقسيم O المهمة O إلى O مهام O فرعية O أصغر O فأصغر O حتى O تصبح O في O قدرات O مبرمج O واحد O و O في O وقت O مناسب O . O إلا O أن O قوات B-ORG فرنسا I-ORG الحرة O والقوات B-ORG البريطانية I-ORG عادت O إلى O احتلالها O عام O 1941 O . O أصبحت O مدينة O دمشق B-LOC في O القرن O السابع O وبعد O الفتح O الإسلامي O للمدينة O أهم O المدن B-LOC الإسلامية I-LOC ومنارة O للعلم O والأدب O ومرجع O وموطن O للقادة O والعلماء O والمفكرين O والمشاهير O ، O وتحولت O المدينة O في O العصر O الأموي O من O مركز O ولاية O إلى O عاصمة O أكبر O إمبراطورية B-LOC إسلامية I-LOC الدولة B-LOC الأموية I-LOC تمتد O شرقا O إلى O حدود O الصين B-LOC ، O والى O جبال O البرانس B-LOC ومياه O المحيط B-LOC الأطلسي I-LOC والأندلس B-LOC غربا O . O وقد O سحرت O هذه O البيوت O الراقية O الرحالة O الذين O تدفقوا O على O المشرق O ، O ومنهم O الأسباني O باديا B-PER الذي O زار O مدينة O دمشق B-LOC وشبهة O بيوتها O بالقصور O لروعتها O وتميزها O . O عام O 1946 O استقلت O سوريا B-LOC بشكل O كامل O عن O فرنسا B-LOC وشهدت O المدينة O انطلاقا O وازدهارا O وتوسعا O عمرانيا O كبيرا O منذ O ذلك O الحين O خصوصا O بعد O النكبة O والنكسة O وهجرة O ونزوح O مئات O الألوف O من O السوريين B-PER من O الجولان B-LOC والفلسطينيين B-PER من O فلسطين B-LOC ، O وتضاعفت O مساحة O المدينة O وامتدت O في O جميع O الاتجاهات O . O وفي O دمشق B-LOC أوابد O وآثار O في O كل O زاوية O من O زواياها O ، O وفيها O الشارع O المستقيم O الذي O ورد O ذكره O في O الإنجيل O ومقدسات O إسلامية O ومسيحية O . O كانت O ولاية O دمشق B-LOC من O أكبر O ولايات O السلطنة B-LOC المملوكية I-LOC وأهمها O حيث O عرفت O باسم O " O نيابة B-LOC الشام I-LOC "، O وقد O امتدت O حدودها O إلى O الفرات B-LOC والرستن B-LOC شرقا O وشمالا O ، O والى O البحر B-LOC الأبيض I-LOC المتوسط I-LOC غربا O ، O وإلى O غزة B-LOC والكرك B-LOC جنوبا O . O برزت O مشكلة O حديثة O هي O وجود O مناطق O سكن O عشوائي O حول O مدينة O دمشق B-LOC يسكنها O في O الغالب O المهاجرين O من O الريف O إلى O المدينة O وتعتبر O هذه O من O أكثر O التشوهات O العمرانية O لأقدم O مدينة O بالتاريخ O . O يبلغ O عدد O سكان O دمشق B-LOC حوالي O 5 O مليون O نسمة O حسب O إحصائية O عام O 2004 O ويتألف O سكان O دمشق B-LOC بدرجة O أولى O من O العرب B-PER ثم O الأكراد B-PER الأتراك I-PER والأرمن B-PER والآشوريين B-PER والشركس B-PER . O ويطلق O على O الإلكترونات B-MISC الموجودة O في O الغلاف O الخارجي O إلكترونات B-MISC التكافؤ O ، O والتي O لها O تأثير O كبير O على O السلوك O الكيميائي O للذرة O . O البريليوم B-MISC : O عدد O الإلكترونات B-MISC 4 O ويشغلون O المدارين O 1s2 O 2s2 O l O = O 1 O ويسمى O مدار O p O ويمكن O أن O يحتوي O على O 6 O إلكترونات B-MISC ( O الغلاف O الثاني O وأعلاه O ) O وهذا O مطابق O تماما O مع O مبدأ O استبعاد O باولي B-PER الذي O صاغه O العالم O النمساوي O ولفجانج B-PER باولي I-PER عام O 1925 O ، O ذلك O المبدأ O الذي O ينص O على O أن O جسمين O كموميين O مثل O الإلكترون B-MISC ، O لا O يصح O لهما O أن O يحتلا O نفس O الحالة O الكمومية O في O الذرة O . O و O هنا O يمكننا O أن O نكتب O العلاقة O التالية O : O ، O حيث O Z O تشير O إلى O العدد O الذري O و O N O إلى O عدد O النيوترونات B-MISC . O الذرة O هي O أصغر O جزء O من O العنصر O يمكن O أن O يتميز O به O عن O بقية O العناصر؛ O إذ O كلما O غصنا O أكثر O في O المادة O لنلاقي O البنى O الأصغر O لن O يعود O هناك O فرق O بين O عنصر O و O آخر O . O دالة O الطول O الموجي O للمدار O الإلكترونى O للهيدروجين B-MISC . O تتكون O النواة O الموجبة O هذه O من O بروتونات B-MISC موجبة O الشحنة O ، O و O نيوترونات B-MISC متعادلة O . O وتوجد O خمس O أنواع O رئيسية O للروابط O : O و O التي O تنص O على O : O فقد O إفترضا O أن O لكل O ذرة O شكل O محدد O مثل O الحصوات O الصغيرة O ، O وهذا O الشكل O هو O ما O يحكم O خواص O تلك O الذرة O . O في O عهد O الأمير O السلجوقي B-PER تتش B-PER أمر O وزيره O بإجراء O الإصلاحات O على O نفقته O في O قبة B-LOC النسر I-LOC وكذلك O الدعائم O الأربعة O والأقواس O التي O تعلوها O ، O وسقف O المسجد O والمقصورة O . O وصف O ابن B-PER عساكر I-PER موضوع O فسيفساء O الجدار O الجنوبي O على O شكل O كرمة O ذهبية O . O وفي O أعلى O جدار O القبلة O ، O تنفتح O على O امتداده O نوافذ O ذات O زجاج O ملون O . O ويغطي O هذا O الجناح O المتوسط O سقف O سنمي O في O وسطه O تنهض O قبة B-LOC النسر I-LOC المؤلفة O من O قبة O نصف O كروية O من O الخشب O المصفح O ، O ومن O قبة O ثمانية O تنفتح O فيها O 16 O نافذة O ، O وترتفع O القبة O عن O أرض O الجامع O 45م O وهي O بقطر O 16 O مترا O . O وفي O المسجد B-LOC الأموي I-LOC أول O مئذنة O في O الإسلام O المسماة O مئذنة B-LOC العروس I-LOC وله O اليوم O ثلاث O مآذن O وأربع O أبواب O وقبة O كبيرة O قبة O النسر O وثلاث O قباب O في O صحنه O وأربعة O محاريب O ومشهد O عثمان B-PER ومشهد O أبوبكر B-PER ومشهد O الحسين B-PER ومشهد O عروة B-PER ولوحات O جدارية O ضخمة O من O الفسيفساء O وقاعات O ومتحف O ، O في O داخلة O ضريح O النبي O يحيى B-PER علية O السلام O وبجواره O يرقد O البطل O صلاح B-PER الدين I-PER الأيوبي I-PER وبالقرب O منه O الكثير O من O مقامات O وأضرحة O رجال O ومشاهير O الإسلام O ، O وقد O صلى O فيه O أهم O المشاهير O في O تاريخ O الإسلام O والفاتحين O وعدد O كبير O من O الصحابة O والسلاطين O والخلفاء O والملوك O والولاة O وأكبر O علماء O المسلمين B-PER ، O وهو O أول O جامع O يدخله O أحد O باباوات O روما B-LOC عندما O زار O مدينة O دمشق B-LOC . O ومن O الرواق O تنفتح O على O الصحن O 24 O قنطرة O ومن O الرواقين O الشرقي O والجنوبي O تسع O قناطر O . O وأدى O هذا O الحريق O الهائل O إلى O تلف O المصحف O العثماني O الذي O كان O قد O أرسله O الخليفة O عثمان B-PER بن I-PER عفان I-PER إلى O بلاد B-LOC الشام I-LOC عندما O قام O بتدوين O القرآن O . O فصار O نصفه O مسجد O ونصفه O كنيسة O . O توجد O حاليا O أنظمة O أخرى O في O هذا O المجال O مثل O مفكرة B-MISC جوجل I-MISC google B-MISC calendar I-MISC ، O أو O BSCW B-MISC أو O نظام O شير B-MISC بوينت I-MISC Microsoft B-MISC . O تعرف O هذه O العملية O بالدخول O عن O بعد O Remote B-MISC Access I-MISC . O اسم O إنترنت O في O الإنجليزية O يتكون O من O البادئة O inter O التي O تعني O " O بين O " O و O كلمة O net O التي O تعني O " O شبكة O "، O أي O " O الشبكة B-MISC البينية I-MISC " O و O الاسم O دلالة O على O بنية O إنترنت O باعتبارها O " O شبكة O ما O بين O الشبكات O " O أو O شبكة O من O شبكات O " O أو O ، O و O مع O هذا O فقد O شاعت O خطأ O في O وسائل O الإعلام O العربية O تسمية O " O الشبكة B-MISC الدولية I-MISC للمعلومات I-MISC " O ظنا O أن O المقطع O inter O في O الاسم O هو O اختصار O الكلمة O الإنجليزية O " O international O " O التي O تعني O " O دولي O "، O و O هو O ما O يوحي O على O غير O الواقع O بأن O الشبكة O مشروع O أممي O . O لكن O هذه O اللامركزية O في O الجانب O التقني O لم O يتم O إتباعها O في O الجانب O الاداري O للشابكة O ، O فما O يسمى O حكومة B-ORG الانترنت I-ORG آيكان I-ORG ICANN B-MISC هي O الهيئة O المشرفة O دوليا O على O إصدار O عناوين O الإنترنت O وتتبع O بشكل O غير O مباشر O للولايات B-LOC المتحدة I-LOC الأمريكية I-LOC ، O و O هي O التي O تدير O العقد O الرئيسية O DNS B-MISC في O أكثر O الدول O العالمية O . O و O مثل O الطفرات O في O وسائل O الاتصال O عبر O التاريخ O أضحت O للإنترنت O اليوم O آثار O اجتماعية O و O ثقافية O في O جميع O بقاع O العالم O ، O و O قد O أدت O إلى O تغيير O المفاهيم O التقليدية O لعدة O مجالات O مثل O العمل O و O التعليم O و O التجارة O و O بروز O شكل O آخر O لمجتمع O المعلومات O . O وبحلول O عام O 1996 O صار O استخدام O كلمة O الشابكة B-MISC قد O أصبح O شائعا O ، O وبالتالي O ، O كان O ذلك O سببا O للخلط O في O استعمال O كلمة O إنترنت O على O أنها O إشارة O إلى O الشبكة B-ORG العالمية I-ORG الويب I-ORG . O الشابكة B-MISC ( O الإنترنت O ) O هو O مجموعة O من O شبكات O الحواسيب O المتصلة O معا O عن O طريق O أسلاك O نحاسية O وكابلات O ألياف B-MISC بصرية I-MISC وتوصيلات O لاسلكية O Wireless O وما O إلى O ذلك O . O لا O تضع O الشابكة B-MISC ( O إنترنت O ) O أي O افتراضات O مسبقة O عن O طبيعة O الرسالة O و O فحواها O أو O الهدف O من O إرسالها O أو O كيفية O استخدامها O و O لا O تحاول O إجراء O أي O معالجات O على O الرسالة O أو O محتواها O غير O ما O يتطلبه O إرسالها O بين O النقطتين O . O صفحة O الوب O يمكن O تقريبا O أن O تحتوي O مزيج O من O بيانات O الحاسوب O بما O فيها O الصور O الفوتوغرافية O ، O الرسوميات O Graphics O ، O الصوتيات O ، O النصوص O ، O الفيديو O ، O الوسائط O المتعددة O ومحتويات O تفاعلية O Interactive O Contents O بما O في O ذلك O الألعاب O وغيرها O . O ب O من O الرام O للحصول O على O أداء O معقول O . O وقد O أدى O هذا O إلى O إحباط O المستخدمين O والمبرمجين O لوقت O طويل O . O يحتاج O هذا O إلى O تشغيل O مدير O عرض O س B-MISC على O المضيف O الأولي O - O حيث O يعمل O خادم O س B-MISC -. O آي B-ORG . O org O تهتم O بالتوافق O بين O أسطح O المكتب O والمكونات O الضرورية O لسطح O مكتب O س B-MISC قادر O على O المنافسة O . O بيئة O سطح O مكتب O يونكس B-MISC القياسية O هي O Common O Desktop O Environment O ( O CDE O ). O لا O يمكن O حاليا O فصل O عميل O لس B-MISC أو O جلسة O من O أحد O الخوادم O وإعادة O توصيلها O بخادم O آخر O ، O كما O في O حوسبة O الشبكة O الوهمية O ( O VNC B-MISC ). O 0 O من O XFree86 B-MISC ثم O أصبح O قياسيا O مع O الإصدارة O X11R6 B-MISC . O يشتق O اسم O إكس B-MISC X B-MISC على O أساس O أنه O لاحق O لنظام B-MISC النوافذ I-MISC قبل O عام O 1983 O المدعو O دبليو B-MISC W B-MISC Window O System O ( O و O بما O أن O X B-MISC تلي O W B-MISC مباشرة O في O الأبجدية O اللاتينية O فقد O سمي O X B-MISC ). O مما O نتج O عنه O العديد O من O الواجهات O المختلفة O تماما O ، O و O تطبيقات O لا O تعمل O جيدا O مع O بعضها O البعض O . O البدائل O التاريخية O تشمل O NeWS B-MISC من O صن B-ORG مايكروسيستمز I-ORG ، O عرض O بوست B-MISC سكريبت I-MISC الخاص O ب O NeXT B-MISC الذى O أصبح O فيما O بعد O كوارتز B-MISC من O أبل B-ORG المستخدم O في O نظامها O ماك B-MISC أو I-MISC . O على O الرغم O من O هذا O ، O فقد O حاول O البعض O كتابة O بدائل O ل B-MISC س I-MISC . O ظهرت O الفكرة O الأساسية O لنظام O إكس B-MISC في O معهد B-LOC ماستشوشتش I-LOC للتقانة I-LOC في O عام O 1984 O كتعاون O بين O جيم B-PER غيتيس I-PER Jim B-MISC Gettys I-MISC من O مشروع O أثينا B-LOC و O بوب B-PER شيفلر I-PER من O مخبر B-LOC إم I-LOC . O والآن O ، O فإن O فإن O مبرمجى O الرسوميات O يعملون O على O تناسق O مظهر O البرنامج O وتواصله O بكتابته O لبيئة O سطح O مكتب O محددة O أو O باستخدام O widget B-MISC toolkit I-MISC رسومية O محددة O ، O مما O يتفادى O التعامل O مع O ICCCM B-MISC مباشرة O . O في O الأيام O الأولى O ، O أدى O هذا O إلى O غرامة O واضحة O في O الأداء O مقارنة O بالإصدارات O الحالية O وقتها O من O مايكروسوفت B-MISC ويندوز I-MISC و O ماك B-MISC أو I-MISC . O عندما O يعمل O س B-MISC تحت O نظام O نوفذة O آخر O ( O مثل O مايكروسوفت B-MISC ويندوز I-MISC أو O ماك B-MISC أو O . O منذ O نشر O POSIX B-MISC و O بعد O ذلك O XPG B-MISC ثم O SUS B-MISC أصبح O من O السهل O على O كل O المبرمجين O القيام O بعمل O برامج O لتعمل O علي O بيئة O نظام O UNIX B-MISC حسب O المواصفات O الموحدة O ، O و O حتى O إنشاء O نظام B-MISC تشغيل I-MISC بأكمله O كما O رأينا O محاولات O OSF B-MISC منذ O قليل O . O بعد O نسخة O Solaris B-MISC 2 I-MISC . O و O كان O الهدف O الأساسي O هو O إنشاء O برامج O حرة O بحيث O يسمح O للمبرمج O و O المستخدم O في O إضافة O إي O تعديلات O تكون O متفقة O مع O شروط O المشروع O . O 1 O Standard O ) O 2 O - O X B-MISC / I-MISC Open I-MISC Portability I-MISC Guide I-MISC 3 O - O Single B-MISC UNIX I-MISC Specifications I-MISC 4 I-MISC - O Open B-MISC Group I-MISC Base I-MISC Specifications I-MISC 5 I-MISC - O File B-MISC system I-MISC Hierarchy I-MISC Standard I-MISC يظن O البعض O أن O الاسم O UNIX B-MISC أخذ O من O MULTICS B-MISC بتغيير O كلمة O Multiplexed B-MISC إلى O Uniplexed B-MISC في O مزاح O من O أحد O زملاء O طومسون B-PER . O واجهة B-MISC مستخدم I-MISC تصويرية I-MISC GUI B-MISC : O مثال O KDE B-MISC و O GNOME B-MISC · O برامج O و O أدوات O GNU B-MISC أو O ( O Utilities O and O applications O ) O 1 O أو O POSIX B-MISC تكوين O ما O عرف O باسم O OSF B-MISC من O أعضاء O هذا O الفريق O المتحد O عدة O شركات O من O الجانبين O منها O : O و O قد O استخدم O Linux B-MISC في O تشغيل O أجهزة O الحاسب O الآلي O و O في O بعض O الهواتف O الخلوية O المحمولة O Mobile O Cellular O Phone O و O كنظام B-MISC تشغيل I-MISC خاص O بالبرمجة O في O الزمن O الحقيقي O Real O time O OS O . O و O سبب O ذلك O أن O لينوس B-PER كان O يستخدم O نظام O MINIX B-MISC الذي O قام O بتصميمه O الأستاذ O الجامعي O Andrew B-MISC Tanenbaum I-MISC صاحب O كتاب O Modern B-MISC Operating I-MISC systems I-MISC الشهير O . O و O أصدرت O Sun B-MISC بعدها O نسخة O نظام B-MISC تشغيل I-MISC باسم O تجاري O يدعى O Solaris B-MISC . O و O هي O عبارة O عن O إمكانية O تحميل O النظام O و O نقله O من O جهاز O إلى O أخر O بحيث O لا O يكون O هناك O داعي O لكتابة O البرنامج O بأكمله O من O جديد O ، O بشرط O توافق O النظام O مع O مكونات O الجهاز O الذي O سيعمل O عليه O و O من O أهمها O المعالج B-MISC الدقيق I-MISC Microprocessor B-MISC و O تكون O محتاجا O فقط O إلى O الآتي O : O كانت O Sun B-MISC تستعمل O بيئة B-MISC مستخدم I-MISC تصويرية I-MISC تدعى O Open B-MISC Windows I-MISC بالإعتماد O على O بروتوكولات B-MISC SunView B-MISC و O NeWS B-MISC و O X B-MISC windowing I-MISC system I-MISC . O
{ "pile_set_name": "Github" }
class DragHelper { private static _instance: DragHelper = new DragHelper(); public static getInstance(): DragHelper { return DragHelper._instance; } private readonly _helpPoint: Phaser.Math.Vector2 = new Phaser.Math.Vector2(); private readonly _dragOffset: Phaser.Math.Vector2 = new Phaser.Math.Vector2(); private _dragDisplayObject: Phaser.GameObjects.GameObject = null; public enableDrag(scene: Phaser.Scene, displayObject: Phaser.GameObjects.GameObject): void { scene.input.enable(displayObject); scene.input.setDraggable(displayObject, true); displayObject.on("dragstart", (a, b, c) => { this._dragStartHandler(displayObject, a, b, c); }, this); displayObject.on("dragend", this._dragStopHandler, this); } public disableDrag(scene: Phaser.Scene, displayObject: Phaser.GameObjects.Sprite): void { scene.input.setDraggable(displayObject, false); scene.input.disable(displayObject); displayObject.off("dragstart", this._dragStartHandler, this); displayObject.off("dragend", this._dragStopHandler, this); } private _dragStartHandler(displayObject: Phaser.GameObjects.GameObject, pointer: Phaser.Input.Pointer, dragX: number, dragY: number): void { if (this._dragDisplayObject) { return; } this._dragDisplayObject = displayObject; const armatureDisplay = this._dragDisplayObject.parentContainer as dragonBones.phaser.display.ArmatureDisplay; const bone = armatureDisplay.armature.getBoneByDisplay(this._dragDisplayObject); if (bone) { this._helpPoint.x = pointer.x; this._helpPoint.y = pointer.y; if (bone.offsetMode !== dragonBones.OffsetMode.Override) { bone.offsetMode = dragonBones.OffsetMode.Override; bone.offset.x = bone.global.x; bone.offset.y = bone.global.y; } this._dragOffset.x = bone.offset.x - this._helpPoint.x; this._dragOffset.y = bone.offset.y - this._helpPoint.y; displayObject.on("pointermove", this._dragHandler, this); } } private _dragStopHandler(pointer: Phaser.Input.Pointer, dragX: number, dragY: number, dropped: boolean): void { if (!this._dragDisplayObject) { return; } this._dragDisplayObject.off("pointermove", this._dragHandler, this); this._dragDisplayObject = null; } private _dragHandler(pointer: Phaser.Input.Pointer, localX: number, localY: number): void { if (!this._dragDisplayObject) { return; } const armatureDisplay = this._dragDisplayObject.parentContainer as dragonBones.phaser.display.ArmatureDisplay; const bone = armatureDisplay.armature.getBoneByDisplay(this._dragDisplayObject); if (bone) { this._helpPoint.x = pointer.x; this._helpPoint.y = pointer.y; bone.offset.x = this._helpPoint.x + this._dragOffset.x; bone.offset.y = this._helpPoint.y + this._dragOffset.y; bone.invalidUpdate(); } } }
{ "pile_set_name": "Github" }
# clone [![build status](https://secure.travis-ci.org/pvorb/node-clone.png)](http://travis-ci.org/pvorb/node-clone) [![info badge](https://nodei.co/npm/clone.png?downloads=true&downloadRank=true&stars=true)](http://npm-stat.com/charts.html?package=clone) offers foolproof _deep cloning_ of objects, arrays, numbers, strings etc. in JavaScript. ## Installation npm install clone (It also works with browserify, ender or standalone.) ## Example ~~~ javascript var clone = require('clone'); var a, b; a = { foo: { bar: 'baz' } }; // initial value of a b = clone(a); // clone a -> b a.foo.bar = 'foo'; // change a console.log(a); // show a console.log(b); // show b ~~~ This will print: ~~~ javascript { foo: { bar: 'foo' } } { foo: { bar: 'baz' } } ~~~ **clone** masters cloning simple objects (even with custom prototype), arrays, Date objects, and RegExp objects. Everything is cloned recursively, so that you can clone dates in arrays in objects, for example. ## API `clone(val, circular, depth)` * `val` -- the value that you want to clone, any type allowed * `circular` -- boolean Call `clone` with `circular` set to `false` if you are certain that `obj` contains no circular references. This will give better performance if needed. There is no error if `undefined` or `null` is passed as `obj`. * `depth` -- depth to which the object is to be cloned (optional, defaults to infinity) `clone.clonePrototype(obj)` * `obj` -- the object that you want to clone Does a prototype clone as [described by Oran Looney](http://oranlooney.com/functional-javascript/). ## Circular References ~~~ javascript var a, b; a = { hello: 'world' }; a.myself = a; b = clone(a); console.log(b); ~~~ This will print: ~~~ javascript { hello: "world", myself: [Circular] } ~~~ So, `b.myself` points to `b`, not `a`. Neat! ## Test npm test ## Caveat Some special objects like a socket or `process.stdout`/`stderr` are known to not be cloneable. If you find other objects that cannot be cloned, please [open an issue](https://github.com/pvorb/node-clone/issues/new). ## Bugs and Issues If you encounter any bugs or issues, feel free to [open an issue at github](https://github.com/pvorb/node-clone/issues) or send me an email to <[email protected]>. I also always like to hear from you, if you’re using my code. ## License Copyright © 2011-2015 [Paul Vorbach](http://paul.vorba.ch/) and [contributors](https://github.com/pvorb/node-clone/graphs/contributors). 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, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{ "pile_set_name": "Github" }
#/ # @license Apache-2.0 # # Copyright (c) 2017 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #/ # VARIABLES # # Define the Julia linter: JULIA_LINTER ?= $(JULIA) $(TOOLS_DIR)/lint/julia/linter.jl # Define the command-line options to be used when invoking the executable: JULIA_LINTER_FLAGS ?= # RULES # #/ # Lints Julia files. # # ## Notes # # - This rule supports the environment variables supported by each context-specific (`lint-julia-<context>`) prerequisite. # - This rule is useful when wanting to glob for files, irrespective of context, for a particular package in order to lint all contained Julia files. # # @param {string} [JULIA_SOURCES_FILTER] - file path pattern (e.g., `.*/blas/base/dasum/.*`) # @param {string} [JULIA_TESTS_FIXTURES_FILTER] - file path pattern (e.g., `.*/blas/base/dasum/.*`) # @param {string} [JULIA_EXAMPLES_FILTER] - file path pattern (e.g., `.*/blas/base/dasum/.*`) # @param {string} [JULIA_BENCHMARKS_FILTER] - file path pattern (e.g., `.*/blas/base/dasum/.*`) # @param {*} [FAST_FAIL] - flag indicating whether to stop linting upon encountering a lint error # # @example # make lint-julia # # @example # make lint-julia JULIA_SOURCES_FILTER=".*/blas/base/dasum/.*" JULIA_TESTS_FILTER=".*/blas/base/dasum/.*" JULIA_EXAMPLES_FILTER=".*/blas/base/dasum/.*" JULIA_BENCHMARKS_FILTER=".*/blas/base/dasum/.*" #/ lint-julia: lint-julia-src lint-julia-tests-fixtures lint-julia-examples lint-julia-benchmarks .PHONY: lint-julia #/ # Lints Julia source files. # # ## Notes # # - This rule is useful when wanting to glob for Julia source files (e.g., lint all Julia source files for a particular package). # # @param {string} [JULIA_SOURCES_FILTER] - file path pattern (e.g., `.*/math/base/special/abs/.*`) # @param {*} [FAST_FAIL] - flag indicating whether to stop linting upon encountering a lint error # # @example # make lint-julia-src # # @example # make lint-julia-src JULIA_SOURCES_FILTER=".*/math/base/special/abs/.*" #/ lint-julia-src: ifeq ($(FAIL_FAST), true) $(QUIET) $(FIND_JULIA_SOURCES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \ echo ''; \ echo "Linting file: $$file"; \ $(JULIA_LINTER) $(JULIA_LINTER_FLAGS) $$file || exit 1; \ done else $(QUIET) $(FIND_JULIA_SOURCES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \ echo ''; \ echo "Linting file: $$file"; \ $(JULIA_LINTER) $(JULIA_LINTER_FLAGS) $$file || echo 'Linting failed.'; \ done endif .PHONY: lint-julia-src #/ # Lints Julia test fixture files. # # ## Notes # # - This rule is useful when wanting to glob for Julia test fixture files (e.g., lint all Julia test fixture files for a particular package). # # @param {string} [TESTS_FIXTURES_FILTER] - file path pattern (e.g., `.*/math/base/special/abs/.*`) # @param {*} [FAST_FAIL] - flag indicating whether to stop linting upon encountering a lint error # # @example # make lint-julia-tests-fixtures # # @example # make lint-julia-tests-fixtures JULIA_TESTS_FIXTURES_FILTER=".*/math/base/special/abs/.*" #/ lint-julia-tests-fixtures: ifeq ($(FAIL_FAST), true) $(QUIET) $(FIND_JULIA_TESTS_FIXTURES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \ echo ''; \ echo "Linting file: $$file"; \ $(JULIA_LINTER) $(JULIA_LINTER_FLAGS) $$file || exit 1; \ done else $(QUIET) $(FIND_JULIA_TESTS_FIXTURES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \ echo ''; \ echo "Linting file: $$file"; \ $(JULIA_LINTER) $(JULIA_LINTER_FLAGS) $$file || echo 'Linting failed.'; \ done endif .PHONY: lint-julia-tests-fixtures #/ # Lints Julia examples files. # # ## Notes # # - This rule is useful when wanting to glob for Julia examples files (e.g., lint all Julia examples files for a particular package). # # @param {string} [JULIA_EXAMPLES_FILTER] - file path pattern (e.g., `.*/math/base/special/abs/.*`) # @param {*} [FAST_FAIL] - flag indicating whether to stop linting upon encountering a lint error # # @example # make lint-julia-examples # # @example # make lint-julia-examples JULIA_EXAMPLES_FILTER=".*/math/base/special/abs/.*" #/ lint-julia-examples: ifeq ($(FAIL_FAST), true) $(QUIET) $(FIND_JULIA_EXAMPLES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \ echo ''; \ echo "Linting file: $$file"; \ $(JULIA_LINTER) $(JULIA_LINTER_FLAGS) $$file || exit 1; \ done else $(QUIET) $(FIND_JULIA_EXAMPLES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \ echo ''; \ echo "Linting file: $$file"; \ $(JULIA_LINTER) $(JULIA_LINTER_FLAGS) $$file || echo 'Linting failed.'; \ done endif .PHONY: lint-julia-examples #/ # Lints Julia benchmark files. # # ## Notes # # - This rule is useful when wanting to glob for Julia benchmark files (e.g., lint all Julia benchmark files for a particular package). # # @param {string} [JULIA_BENCHMARKS_FILTER] - file path pattern (e.g., `.*/math/base/special/abs/.*`) # @param {*} [FAST_FAIL] - flag indicating whether to stop linting upon encountering a lint error # # @example # make lint-julia-benchmarks # # @example # make lint-julia-benchmarks JULIA_BENCHMARKS_FILTER=".*/math/base/special/abs/.*" #/ lint-julia-benchmarks: ifeq ($(FAIL_FAST), true) $(QUIET) $(FIND_JULIA_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \ echo ''; \ echo "Linting file: $$file"; \ $(JULIA_LINTER) $(JULIA_LINTER_FLAGS) $$file || exit 1; \ done else $(QUIET) $(FIND_JULIA_BENCHMARKS_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \ echo ''; \ echo "Linting file: $$file"; \ $(JULIA_LINTER) $(JULIA_LINTER_FLAGS) $$file || echo 'Linting failed.'; \ done endif .PHONY: lint-julia-benchmarks #/ # Lints a specified list of Julia files. # # ## Notes # # - This rule is useful when wanting to lint a list of Julia files generated by some other command (e.g., a list of changed Julia files obtained via `git diff`). # # @param {string} FILES - list of Julia file paths # @param {*} [FAST_FAIL] - flag indicating whether to stop linting upon encountering a lint error # # @example # make lint-julia-files FILES='/foo/index.jl /bar/index.jl' #/ lint-julia-files: ifeq ($(FAIL_FAST), true) $(QUIET) for file in $(FILES); do \ echo ''; \ echo "Linting file: $$file"; \ $(JULIA_LINTER) $(JULIA_LINTER_FLAGS) $$file || exit 1; \ done else $(QUIET) for file in $(FILES); do \ echo ''; \ echo "Linting file: $$file"; \ $(JULIA_LINTER) $(JULIA_LINTER_FLAGS) $$file || echo 'Linting failed.'; \ done endif .PHONY: lint-julia-files
{ "pile_set_name": "Github" }
--- page_type: sample languages: - cpp - cppcx products: - windows - windows-uwp urlFragment: Simple3DGameXaml extendedZipContent: - path: SharedContent target: SharedContent - path: LICENSE target: LICENSE description: "A simple first person 3-D game using DirectX (Direct3D 11.2, Direct2D, Windows.Gaming.Input, and XAudio2) and XAML in a C++ app." --- <!--- category: Gaming samplefwlink: http://go.microsoft.com/fwlink/p/?LinkId=620599 ---> # DirectX and XAML game sample Shows the basic end-to-end implementation of a simple first person 3-D game using DirectX (Direct3D 11.2, Direct2D, Windows.Gaming.Input, and XAudio2) and XAML in a C++ app. XAML is used for the heads-up display and game state messages. > **Note:** This sample is part of a large collection of UWP feature samples. > You can download this sample as a standalone ZIP file > [from docs.microsoft.com](https://docs.microsoft.com/samples/microsoft/windows-universal-samples/simple3dgamexaml/), > or you can download the entire collection as a single > [ZIP file](https://github.com/Microsoft/Windows-universal-samples/archive/master.zip), but be > sure to unzip everything to access shared dependencies. For more info on working with the ZIP file, > the samples collection, and GitHub, see [Get the UWP samples from GitHub](https://aka.ms/ovu2uq). > For more samples, see the [Samples portal](https://aka.ms/winsamples) on the Windows Dev Center. Specifically, this sample supports: - A touch input model - A mouse and keyboard input model - A game controller input model - Stereoscopic 3-D display - A XAML heads-up display - A persistent game state - Sound effect playback - In-app purchases and trials There are two versions of this sample: - **Simple3DGameDX**: Uses DirectX to render game UI and implements its own layout. - **Simple3DGameXaml**: Uses XAML to render game UI and handle layout. Both versions share significant amounts of logic: the Common and GameContent folders are identical. In addition, to reduce disk space usage, Simple3DGameXaml references some its assets from the Simple3DGameDX\Cpp\Assets folder. **Note** The Windows universal samples require Visual Studio to build and Windows 10 to execute. To obtain information about Windows 10 development, go to the [Windows Dev Center](http://go.microsoft.com/fwlink/?LinkID=532421) To obtain information about Microsoft Visual Studio and the tools for developing Windows apps, go to [Visual Studio](http://go.microsoft.com/fwlink/?LinkID=532422) ## Reference This sample is written in C++ and requires some experience with graphics programming. A code walkthrough for the Direct3D-specific version of this sample is available here: - [Create a simple game with DirectX](https://docs.microsoft.com/windows/uwp/gaming/tutorial--create-your-first-uwp-directx-game) These topics provide info about the APIs used in this sample: - [DirectX Graphics and Gaming](http://msdn.microsoft.com/library/windows/apps/ee663274) - [Direct3D 11 Overview](http://msdn.microsoft.com/library/windows/apps/ff476345) - [Direct3D 11 Reference](http://msdn.microsoft.com/library/windows/apps/ff476147) - [DXGI reference](http://msdn.microsoft.com/library/windows/apps/bb205169) - [XAudio2](http://msdn.microsoft.com/library/windows/apps/hh405049) - [Windows.Gaming.Input](http://msdn.microsoft.com/library/windows/apps/windows.gaming.input) - [Windows.UI.Xaml](http://msdn.microsoft.com/library/windows/apps/br209045) - [Windows.UI.Xaml.Controls](http://msdn.microsoft.com/library/windows/apps/br227716) - [Windows.UI.Xaml.Controls.SwapChainPanel](http://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.swapchainpanel) ## System requirements **Client:** Windows 10 **Server:** Windows Server 2016 Technical Preview **Phone:** Windows 10 ## Build the sample 1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build. 2. Start Microsoft Visual Studio and select **File** \> **Open** \> **Project/Solution**. 3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio Solution (.sln) file. 4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**. ## Run the sample The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it. ### Deploying the sample - Select Build > Deploy Solution. ### Deploying and running the sample - To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or selectDebug > Start Without Debugging.
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.apollographql.apollo.kmpsample"> <uses-permission android:name="android.permission.INTERNET" /> <application android:name=".KotlinSampleApp" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme" tools:ignore="GoogleAppIndexingWarning"> <activity android:name=".repositories.MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".repositoryDetail.RepositoryDetailActivity" android:parentActivityName=".repositories.MainActivity" /> <activity android:name=".commits.CommitsActivity" android:parentActivityName=".repositoryDetail.RepositoryDetailActivity" /> </application> </manifest>
{ "pile_set_name": "Github" }
/*! * verb <https://github.com/jonschlinkert/verb> * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT License. */ 'use strict'; var verb = require('..'); require('should'); describe('loaded helpers', function () { it('should use helpers from the template-helpers library:', function (done) { verb.render('{%= add(1, 2) %}', function (err, content) { if (err) console.log(err); content.should.equal('3'); done(); }); }); it('should use helpers from the markdown-utils library:', function (done) { verb.render('{%= mdu.link("a", "b") %}', function (err, content) { if (err) console.log(err); content.should.equal('[a](b)'); done(); }); }); });
{ "pile_set_name": "Github" }
.datetimepicker { .glyphicon { .icon-FontAwesome(); &.glyphicon-arrow-left:before { &:extend(.icon-arrow-left:before); } &.glyphicon-arrow-right:before { &:extend(.icon-arrow-right:before); } } } .form-inline .form-group .form-inline { display: inline-block; }
{ "pile_set_name": "Github" }
// // Close icons // -------------------------------------------------- .close { float: right; font-size: (@font-size-base * 1.5); font-weight: @close-font-weight; line-height: 1; color: @close-color; text-shadow: @close-text-shadow; .opacity(.2); &:hover, &:focus { color: @close-color; text-decoration: none; cursor: pointer; .opacity(.5); } // Additional properties for button version // iOS requires the button element instead of an anchor tag. // If you want the anchor version, it requires `href="#"`. // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile button& { padding: 0; cursor: pointer; background: transparent; border: 0; -webkit-appearance: none; } }
{ "pile_set_name": "Github" }
/*********************************************************************** * Copyright (c) 2015 by Regents of the University of Minnesota. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License, Version 2.0 which * accompanies this distribution and is available at * http://www.opensource.org/licenses/apache2.0.php. * *************************************************************************/ package edu.umn.cs.spatialHadoop.util; import java.util.Vector; import org.apache.hadoop.util.IndexedSortable; import org.apache.hadoop.util.IndexedSorter; import org.apache.hadoop.util.Progressable; public class MergeSorter implements IndexedSorter { @Override public void sort(IndexedSortable s, int l, int r) { sort(s, l, r, null); } @Override public void sort(IndexedSortable s, final int l, final int r, Progressable rep) { for (int step = 2; step < (r - l) * 2; step *= 2) { for (int i = l; i < r; i += step) { // In this iteration, we need to merge the two sublists // [i, i + step / 2), [i + step / 2, i + step) int i1 = i; int j1 = i + step / 2; int j2 = Math.min(i + step, r); // In each iteration: Elements in the sublist [i, i1) are in their // correct position. i.e. each element in this sublist is less than // every element on the sublist [i1, j2) // The loop needs to merge the sublists [i1, j1), [j1, j2) while (j1 < j2) { // Step 1: Skip elements in the left list < minimum of right list while (i1 < j1 && s.compare(i1, j1) <= 0) { i1++; } if (i1 == j1) { // Range is already merged. Terminate the loop break; } // Step 2: Find all elements starting from j1 that needs to be moved // to i1 // Note: We don't need to compare [j1] as we know it's less than [i1] int old_j1 = j1++; while (j1 < j2 && s.compare(i1, j1) > 0) { j1++; } // Step 3: Move the elements [old_j1, j1) to the position i1 shift(s, old_j1, j1, i1); // Step 4: Update the indices. i1 += (j1 - old_j1); // I already compared [i1] and I know it's less than or equal to [j1] i1++; // Now the sublist [i, i1) is merged } } } } protected void shift(IndexedSortable s, int src_l, int src_r, int dst_l) { int max_step = src_r - src_l; while (src_l > dst_l) { // Move in steps of (src_r - src_l) but the step should not move beyond // the destination dst_l if (src_l - dst_l >= max_step) { for (int i = 0; i < max_step; i++) { s.swap(src_l + i, src_l - max_step + i); } src_l -= max_step; src_r -= max_step; } else { int step = src_l - dst_l; for (int i = 0; i < step; i++) { s.swap(src_l + i, dst_l + i); } src_l += step; dst_l += step; max_step = src_r - src_l; } } } static final Vector<Integer> x = new Vector<Integer>(); public static void main(String[] args) { for (int i = 0; i < 1000000; i++) { x.add((int) (Math.random() * 100000)); } IndexedSortable sortable = new IndexedSortable() { @Override public void swap(int i, int j) { Integer temp = x.elementAt(i); x.set(i, x.elementAt(j)); x.set(j, temp); } @Override public int compare(int i, int j) { return x.elementAt(i) - x.elementAt(j); } }; MergeSorter sorter = new MergeSorter(); System.out.println(x); sorter.sort(sortable, 0, x.size()); for (int i = 1; i < x.size(); i++) { if (x.elementAt(i - 1) > x.elementAt(i)) System.out.println("tozzzzzzzzzzzzzzzzzzzzzz"); } System.out.println(x); } }
{ "pile_set_name": "Github" }
// Created on: 2005-12-08 // Created by: Sergey KHROMOV // Copyright (c) 2005-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library 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, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #include <math.hxx> #include <math_Function.hxx> #include <math_KronrodSingleIntegration.hxx> #include <math_Vector.hxx> #include <StdFail_NotDone.hxx> #include <TColStd_SequenceOfReal.hxx> //========================================================================== //function : An empty constructor. //========================================================================== math_KronrodSingleIntegration::math_KronrodSingleIntegration() : myIsDone(Standard_False), myValue(0.), myErrorReached(0.), myNbPntsReached(0), myNbIterReached(0) { } //========================================================================== //function : Constructor // //========================================================================== math_KronrodSingleIntegration::math_KronrodSingleIntegration ( math_Function &theFunction, const Standard_Real theLower, const Standard_Real theUpper, const Standard_Integer theNbPnts): myIsDone(Standard_False), myValue(0.), myErrorReached(0.), myNbPntsReached(0) { Perform(theFunction, theLower, theUpper, theNbPnts); } //========================================================================== //function : Constructor // //========================================================================== math_KronrodSingleIntegration::math_KronrodSingleIntegration ( math_Function &theFunction, const Standard_Real theLower, const Standard_Real theUpper, const Standard_Integer theNbPnts, const Standard_Real theTolerance, const Standard_Integer theMaxNbIter) : myIsDone(Standard_False), myValue(0.), myErrorReached(0.), myNbPntsReached(0) { Perform(theFunction, theLower, theUpper, theNbPnts, theTolerance, theMaxNbIter); } //========================================================================== //function : Perform // Computation of the integral. //========================================================================== void math_KronrodSingleIntegration::Perform ( math_Function &theFunction, const Standard_Real theLower, const Standard_Real theUpper, const Standard_Integer theNbPnts) { //const Standard_Real aMinVol = Epsilon(1.); const Standard_Real aPtol = 1.e-9; myNbIterReached = 0; if (theNbPnts < 3 ) { myIsDone = Standard_False; return; } if(theUpper - theLower < aPtol) { myIsDone = Standard_False; return; } // Get an odd value of number of initial points. myNbPntsReached = (theNbPnts%2 == 0) ? theNbPnts + 1 : theNbPnts; myErrorReached = RealLast(); Standard_Integer aNGauss = myNbPntsReached/2; math_Vector aKronrodP(1, myNbPntsReached); math_Vector aKronrodW(1, myNbPntsReached); math_Vector aGaussP(1, aNGauss); math_Vector aGaussW(1, aNGauss); if (!math::KronrodPointsAndWeights(myNbPntsReached, aKronrodP, aKronrodW) || !math::OrderedGaussPointsAndWeights(aNGauss, aGaussP, aGaussW)) { myIsDone = Standard_False; return; } myIsDone = GKRule(theFunction, theLower, theUpper, aGaussP, aGaussW, aKronrodP, aKronrodW, myValue, myErrorReached); if(!myIsDone) return; //Standard_Real anAbsVal = Abs(myValue); myAbsolutError = myErrorReached; //if (anAbsVal > aMinVol) //myErrorReached /= anAbsVal; myNbIterReached++; } //======================================================================= //function : Perform //purpose : //======================================================================= void math_KronrodSingleIntegration::Perform ( math_Function &theFunction, const Standard_Real theLower, const Standard_Real theUpper, const Standard_Integer theNbPnts, const Standard_Real theTolerance, const Standard_Integer theMaxNbIter) { Standard_Real aMinVol = Epsilon(1.); myNbIterReached = 0; // Check prerequisites. if (theNbPnts < 3 || theTolerance <= 0.) { myIsDone = Standard_False; return; } // Get an odd value of number of initial points. myNbPntsReached = (theNbPnts%2 == 0) ? theNbPnts + 1 : theNbPnts; Standard_Integer aNGauss = myNbPntsReached/2; math_Vector aKronrodP(1, myNbPntsReached); math_Vector aKronrodW(1, myNbPntsReached); math_Vector aGaussP(1, aNGauss); math_Vector aGaussW(1, aNGauss); if (!math::KronrodPointsAndWeights(myNbPntsReached, aKronrodP, aKronrodW) || !math::OrderedGaussPointsAndWeights(aNGauss, aGaussP, aGaussW)) { myIsDone = Standard_False; return; } //First iteration myIsDone = GKRule(theFunction, theLower, theUpper, aGaussP, aGaussW, aKronrodP, aKronrodW, myValue, myErrorReached); if(!myIsDone) return; Standard_Real anAbsVal = Abs(myValue); myAbsolutError = myErrorReached; if (anAbsVal > aMinVol) myErrorReached /= anAbsVal; myNbIterReached++; if(myErrorReached <= theTolerance) return; if(myNbIterReached >= theMaxNbIter) return; TColStd_SequenceOfReal anIntervals; TColStd_SequenceOfReal anErrors; TColStd_SequenceOfReal aValues; anIntervals.Append(theLower); anIntervals.Append(theUpper); anErrors.Append(myAbsolutError); aValues.Append(myValue); Standard_Integer i, nint, nbints; Standard_Real maxerr; Standard_Integer count = 0; while(myErrorReached > theTolerance && myNbIterReached < theMaxNbIter) { //Searching interval with max error nbints = anIntervals.Length() - 1; nint = 0; maxerr = 0.; for(i = 1; i <= nbints; ++i) { if(anErrors(i) > maxerr) { maxerr = anErrors(i); nint = i; } } Standard_Real a = anIntervals(nint); Standard_Real b = anIntervals(nint+1); Standard_Real c = 0.5*(a + b); Standard_Real v1, v2, e1, e2; myIsDone = GKRule(theFunction, a, c, aGaussP, aGaussW, aKronrodP, aKronrodW, v1, e1); if(!myIsDone) return; myIsDone = GKRule(theFunction, c, b, aGaussP, aGaussW, aKronrodP, aKronrodW, v2, e2); if(!myIsDone) return; myNbIterReached++; Standard_Real deltav = v1 + v2 - aValues(nint); myValue += deltav; if(Abs(deltav) <= Epsilon(Abs(myValue))) ++count; Standard_Real deltae = e1 + e2 - anErrors(nint); myAbsolutError += deltae; if(myAbsolutError <= Epsilon(Abs(myValue))) ++count; if(Abs(myValue) > aMinVol) myErrorReached = myAbsolutError/Abs(myValue); else myErrorReached = myAbsolutError; if(count > 50) return; //Inserting new interval anIntervals.InsertAfter(nint, c); anErrors(nint) = e1; anErrors.InsertAfter(nint, e2); aValues(nint) = v1; aValues.InsertAfter(nint, v2); } } //======================================================================= //function : GKRule //purpose : //======================================================================= Standard_Boolean math_KronrodSingleIntegration::GKRule( math_Function &theFunction, const Standard_Real theLower, const Standard_Real theUpper, const math_Vector& /*theGaussP*/, const math_Vector& theGaussW, const math_Vector& theKronrodP, const math_Vector& theKronrodW, Standard_Real& theValue, Standard_Real& theError) { Standard_Boolean IsDone; Standard_Integer aNKronrod = theKronrodP.Length(); Standard_Real aGaussVal; Standard_Integer aNPnt2 = (aNKronrod + 1)/2; Standard_Integer i; Standard_Real aDx; Standard_Real aVal1; Standard_Real aVal2; math_Vector f1(1, aNPnt2-1); math_Vector f2(1, aNPnt2-1); Standard_Real aXm = 0.5*(theUpper + theLower); Standard_Real aXr = 0.5*(theUpper - theLower); // Compute Gauss quadrature aGaussVal = 0.; theValue = 0.; for (i = 2; i < aNPnt2; i += 2) { aDx = aXr*theKronrodP.Value(i); if (!theFunction.Value(aXm + aDx, aVal1) || !theFunction.Value(aXm - aDx, aVal2)) { IsDone = Standard_False; return IsDone; } f1(i) = aVal1; f2(i) = aVal2; aGaussVal += (aVal1 + aVal2)*theGaussW.Value(i/2); theValue += (aVal1 + aVal2)*theKronrodW.Value(i); } // Compute value in the middle point. if (!theFunction.Value(aXm, aVal1)) { IsDone = Standard_False; return IsDone; } Standard_Real fc = aVal1; theValue += aVal1*theKronrodW.Value(aNPnt2); if (i == aNPnt2) aGaussVal += aVal1*theGaussW.Value(aNPnt2/2); // Compute Kronrod quadrature for (i = 1; i < aNPnt2; i += 2) { aDx = aXr*theKronrodP.Value(i); if (!theFunction.Value(aXm + aDx, aVal1) || !theFunction.Value(aXm - aDx, aVal2)) { IsDone = Standard_False; return IsDone; } f1(i) = aVal1; f2(i) = aVal2; theValue += (aVal1 + aVal2)*theKronrodW.Value(i); } Standard_Real mean = 0.5*theValue; Standard_Real asc = Abs(fc-mean)*theKronrodW.Value(aNPnt2); for(i = 1; i < aNPnt2; ++i) { asc += theKronrodW.Value(i)*(Abs(f1(i) - mean) + Abs(f2(i) - mean)); } asc *= aXr; theValue *= aXr; aGaussVal *= aXr; // Compute the error and the new number of Kronrod points. theError = Abs(theValue - aGaussVal); Standard_Real scale =1.; if(asc != 0. && theError != 0.) scale = Pow((200.*theError/asc), 1.5); if(scale < 1.) theError = Min(theError, asc*scale); //theFunction.GetStateNumber(); return Standard_True; }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 613ab5d0a2c500f9dbe4f03daed611c6 ModelImporter: serializedVersion: 23 fileIDToRecycleName: 100000: mesh10_mesh10-geometry 100002: mesh11_mesh11-geometry 100004: mesh1_mesh1-geometry 100006: mesh2_mesh2-geometry 100008: mesh3_mesh3-geometry 100010: mesh6_mesh6-geometry 100012: mesh7_mesh7-geometry 100014: mesh8_mesh8-geometry 100016: mesh9_mesh9-geometry 100018: //RootNode 400000: mesh10_mesh10-geometry 400002: mesh11_mesh11-geometry 400004: mesh1_mesh1-geometry 400006: mesh2_mesh2-geometry 400008: mesh3_mesh3-geometry 400010: mesh6_mesh6-geometry 400012: mesh7_mesh7-geometry 400014: mesh8_mesh8-geometry 400016: mesh9_mesh9-geometry 400018: //RootNode 2100000: material_2_11_8 2100002: material_10_24 2100004: material_0_15_8 2100006: material_1_1_8 2100008: material_3_2_8 2100010: material_6_14_8 2100012: material_5_13_8 2100014: material_4_12_8 2100016: material_6_3_8 2100018: material_8_4_8 2100020: material_9_5_8 2100022: material_8_9_8 2100024: material_8_7_8 2100026: material_8_6_8 2100028: material_8_8_8 2100030: material_8_10_8 2300000: mesh10_mesh10-geometry 2300002: mesh11_mesh11-geometry 2300004: mesh1_mesh1-geometry 2300006: mesh2_mesh2-geometry 2300008: mesh3_mesh3-geometry 2300010: mesh6_mesh6-geometry 2300012: mesh7_mesh7-geometry 2300014: mesh8_mesh8-geometry 2300016: mesh9_mesh9-geometry 3300000: mesh10_mesh10-geometry 3300002: mesh11_mesh11-geometry 3300004: mesh1_mesh1-geometry 3300006: mesh2_mesh2-geometry 3300008: mesh3_mesh3-geometry 3300010: mesh6_mesh6-geometry 3300012: mesh7_mesh7-geometry 3300014: mesh8_mesh8-geometry 3300016: mesh9_mesh9-geometry 4300000: mesh10_mesh10-geometry 4300002: mesh11_mesh11-geometry 4300004: mesh1_mesh1-geometry 4300006: mesh2_mesh2-geometry 4300008: mesh3_mesh3-geometry 4300010: mesh6_mesh6-geometry 4300012: mesh7_mesh7-geometry 4300014: mesh8_mesh8-geometry 4300016: mesh9_mesh9-geometry externalObjects: {} materials: importMaterials: 1 materialName: 0 materialSearch: 1 materialLocation: 1 animations: legacyGenerateAnimations: 4 bakeSimulation: 0 resampleCurves: 1 optimizeGameObjects: 0 motionNodeName: rigImportErrors: rigImportWarnings: animationImportErrors: animationImportWarnings: animationRetargetingWarnings: animationDoRetargetingWarnings: 0 importAnimatedCustomProperties: 0 importConstraints: 0 animationCompression: 1 animationRotationError: 0.5 animationPositionError: 0.5 animationScaleError: 0.5 animationWrapMode: 0 extraExposedTransformPaths: [] extraUserProperties: [] clipAnimations: [] isReadable: 1 meshes: lODScreenPercentages: [] globalScale: 1 meshCompression: 0 addColliders: 0 useSRGBMaterialColor: 1 importVisibility: 1 importBlendShapes: 1 importCameras: 1 importLights: 1 swapUVChannels: 0 generateSecondaryUV: 0 useFileUnits: 1 optimizeMeshForGPU: 1 keepQuads: 0 weldVertices: 1 preserveHierarchy: 0 indexFormat: 0 secondaryUVAngleDistortion: 8 secondaryUVAreaDistortion: 15.000001 secondaryUVHardAngle: 88 secondaryUVPackMargin: 4 useFileScale: 1 previousCalculatedGlobalScale: 1 hasPreviousCalculatedGlobalScale: 0 tangentSpace: normalSmoothAngle: 60 normalImportMode: 0 tangentImportMode: 3 normalCalculationMode: 4 legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 blendShapeNormalImportMode: 1 normalSmoothingSource: 0 importAnimation: 1 copyAvatar: 0 humanDescription: serializedVersion: 2 human: [] skeleton: [] armTwist: 0.5 foreArmTwist: 0.5 upperLegTwist: 0.5 legTwist: 0.5 armStretch: 0.05 legStretch: 0.05 feetSpacing: 0 rootMotionBoneName: hasTranslationDoF: 0 hasExtraRoot: 0 skeletonHasParents: 1 lastHumanDescriptionAvatarSource: {instanceID: 0} animationType: 0 humanoidOversampling: 1 additionalBone: 0 userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
/** * Yobi, Project Hosting SW * * Copyright 2012 NAVER Corp. * http://yobi.io * * @author Ahn Hyeok Jun * * 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 models; import com.avaje.ebean.annotation.Transactional; import models.resource.Resource; import models.resource.ResourceConvertible; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.joda.time.Duration; import play.data.validation.Constraints; import play.db.ebean.Model; import utils.JodaDateUtil; import javax.persistence.Id; import javax.persistence.Lob; import javax.persistence.MappedSuperclass; import javax.persistence.Transient; import java.util.Comparator; import java.util.Date; @MappedSuperclass abstract public class Comment extends Model implements TimelineItem, ResourceConvertible { private static final long serialVersionUID = 1L; @Id public Long id; @Lob @Constraints.Required public String contents; @Constraints.Required public Date createdDate; public Long authorId; public String authorLoginId; public String authorName; public Comment() { createdDate = new Date(); } public Comment(User author, String contents) { this(); setAuthor(author); this.contents = contents; } public Duration ago() { return JodaDateUtil.ago(this.createdDate); } @Override abstract public Resource asResource(); abstract public AbstractPosting getParent(); @Transient public void setAuthor(User user) { authorId = user.id; authorLoginId = user.loginId; authorName = user.name; } @Transactional public void save() { super.save(); updateMention(); getParent().update(); } @Transactional public void update() { super.update(); updateMention(); } protected void updateMention() { Mention.update(this.asResource(), NotificationEvent.getMentionedUsers(this.contents)); } public void delete() { Attachment.deleteAll(asResource()); NotificationEvent.deleteBy(this.asResource()); super.delete(); getParent().update(); } public static Comparator<Comment> comparator(){ return new Comparator<Comment>() { @Override public int compare(Comment o1, Comment o2) { return o1.createdDate.compareTo(o2.createdDate); } }; } public Date getDate() { return createdDate; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } Comment rhs = (Comment) obj; return new EqualsBuilder() .appendSuper(super.equals(obj)) .append(this.id, rhs.id) .append(this.contents, rhs.contents) .append(this.createdDate, rhs.createdDate) .append(this.authorId, rhs.authorId) .append(this.authorLoginId, rhs.authorLoginId) .append(this.authorName, rhs.authorName) .isEquals(); } @Override public int hashCode() { return new HashCodeBuilder() .appendSuper(super.hashCode()) .append(id) .append(contents) .append(createdDate) .append(authorId) .append(authorLoginId) .append(authorName) .toHashCode(); } }
{ "pile_set_name": "Github" }
### [UnrealEngine.Framework](./UnrealEngine-Framework.md 'UnrealEngine.Framework').[SpringArmComponent](./SpringArmComponent.md 'UnrealEngine.Framework.SpringArmComponent') ## SpringArmComponent.GetUnfixedCameraPosition(System.Numerics.Vector3) Method Retrieves the unfixed camera position ```csharp public void GetUnfixedCameraPosition(ref System.Numerics.Vector3 value); ``` #### Parameters <a name='UnrealEngine-Framework-SpringArmComponent-GetUnfixedCameraPosition(System-Numerics-Vector3)-value'></a> `value` [System.Numerics.Vector3](https://docs.microsoft.com/en-us/dotnet/api/System.Numerics.Vector3 'System.Numerics.Vector3')
{ "pile_set_name": "Github" }
# This file is machine-generated - editing it directly is not advised [[Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" [[Distributed]] deps = ["Random", "Serialization", "Sockets"] uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" [[InteractiveUtils]] deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" [[Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" [[Markdown]] deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" [[Random]] deps = ["Serialization"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [[Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" [[Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" [[Test]] deps = ["Distributed", "InteractiveUtils", "Logging", "Random"] uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
{ "pile_set_name": "Github" }
--TEST-- ZE2 iterators and break --SKIPIF-- <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> --FILE-- <?php class c_iter implements Iterator { private $obj; private $num = 0; function __construct($obj) { echo __METHOD__ . "\n"; $this->obj = $obj; } function rewind() { echo __METHOD__ . "\n"; } function valid() { $more = $this->num < $this->obj->max; echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; return $more; } function current() { echo __METHOD__ . "\n"; return $this->num; } function next() { echo __METHOD__ . "\n"; $this->num++; } function key() { return $this->num; } } class c implements IteratorAggregate { public $max = 4; function getIterator() { echo __METHOD__ . "\n"; return new c_iter($this); } } $t = new c(); foreach($t as $v) { if ($v == 0) { echo "continue outer\n"; continue; } foreach($t as $w) { if ($w == 1) { echo "continue inner\n"; continue; } if ($w == 2) { echo "break inner\n"; break; } echo "double:$v:$w\n"; } if ($v == 2) { echo "break outer\n"; break; } } print "Done\n"; ?> --EXPECT-- c::getIterator c_iter::__construct c_iter::rewind c_iter::valid = true c_iter::current continue outer c_iter::next c_iter::valid = true c_iter::current c::getIterator c_iter::__construct c_iter::rewind c_iter::valid = true c_iter::current double:1:0 c_iter::next c_iter::valid = true c_iter::current continue inner c_iter::next c_iter::valid = true c_iter::current break inner c_iter::next c_iter::valid = true c_iter::current c::getIterator c_iter::__construct c_iter::rewind c_iter::valid = true c_iter::current double:2:0 c_iter::next c_iter::valid = true c_iter::current continue inner c_iter::next c_iter::valid = true c_iter::current break inner break outer Done
{ "pile_set_name": "Github" }
//! moment.js locale configuration //! locale : Lao [lo] //! author : Ryan Hart : https://github.com/ryanhart2 ;(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' && typeof require === 'function' ? factory(require('../moment')) : typeof define === 'function' && define.amd ? define(['../moment'], factory) : factory(global.moment) }(this, (function (moment) { 'use strict'; //! moment.js locale configuration var lo = moment.defineLocale('lo', { months: 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split( '_' ), monthsShort: 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split( '_' ), weekdays: 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), weekdaysShort: 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'), weekdaysMin: 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'), weekdaysParseExact: true, longDateFormat: { LT: 'HH:mm', LTS: 'HH:mm:ss', L: 'DD/MM/YYYY', LL: 'D MMMM YYYY', LLL: 'D MMMM YYYY HH:mm', LLLL: 'ວັນdddd D MMMM YYYY HH:mm', }, meridiemParse: /ຕອນເຊົ້າ|ຕອນແລງ/, isPM: function (input) { return input === 'ຕອນແລງ'; }, meridiem: function (hour, minute, isLower) { if (hour < 12) { return 'ຕອນເຊົ້າ'; } else { return 'ຕອນແລງ'; } }, calendar: { sameDay: '[ມື້ນີ້ເວລາ] LT', nextDay: '[ມື້ອື່ນເວລາ] LT', nextWeek: '[ວັນ]dddd[ໜ້າເວລາ] LT', lastDay: '[ມື້ວານນີ້ເວລາ] LT', lastWeek: '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT', sameElse: 'L', }, relativeTime: { future: 'ອີກ %s', past: '%sຜ່ານມາ', s: 'ບໍ່ເທົ່າໃດວິນາທີ', ss: '%d ວິນາທີ', m: '1 ນາທີ', mm: '%d ນາທີ', h: '1 ຊົ່ວໂມງ', hh: '%d ຊົ່ວໂມງ', d: '1 ມື້', dd: '%d ມື້', M: '1 ເດືອນ', MM: '%d ເດືອນ', y: '1 ປີ', yy: '%d ປີ', }, dayOfMonthOrdinalParse: /(ທີ່)\d{1,2}/, ordinal: function (number) { return 'ທີ່' + number; }, }); return lo; })));
{ "pile_set_name": "Github" }
Changelog Version Date Changes 2.0.6 2009/03/31 Suppress mb_strrpos warnings, when haystack is empty. Thanks to ted and Michael for reporting the problem. 2.0.5 2009/03/27 Make all mb_* functions optional. If function does not exist - use old version. 2.0.4 2009/03/27 Check for existence of mb_regex_replace and if it does not exist (i.e. php version < 4.2.0) use old wordwrap version 2.0.3 2009/03/26 Fixed %BEG_OF_TITLE% bug. Thanks to everybody who reported this problem (a LOT of people) Fixed broken %author_url_href macro. Now it works again. Fixed broken gravatar function - needed to bring e-mail address to lowercase before using md5 on it. Applied Sven Anderson's patch which replaces the most critical string functions with multibyte character aware php functions. 2.0.2 2007/09/25 Fix: Plugin was not compatible to WordPress 2.0.11 any more. Thank you to Stephan for reporting the bug. 2.0.1 2007/09/24 Added switch on the categories page, which reverses the selection. It is now possible to include or exclude categories. 2.0 2007/09/24 New code for fetching the data: 1. Instead of one expensive database query we now use two or more cheap queries. Thanks to mirra, who reported the problem. And again thank you to the people mentioned in changlog 1.4, where the cache was introduced for the same (performance-) problems on big blogs. 2. This also fixed a bug, which lead to too less than requested comments in lists, ordered by post. Thanks to Johanna and Frédéric for reporting and documenting this. Changed the css in the admin gui, to work around a display issue with Tiger Admin. Thank you, Andi, for finding this. Added %time_since macro, which displays the time since the comment was posted. Thanks to Imran and Keith for sugesting (something like) this (very long ago). Admin interface: Added switch fpr turning on and off smileys. Thank you, panos, for requesting this feature. Support for Custom Smileys Plugin. Thanks to Henry for suggesting this. Fix: Username was not displayed as "Anonymous", if commentor left no name. Thanks to Pixelation for reporting this. Added support for WordPress 2.3. It will drop the post2cat table. Changed plugin to new taxonomy scheme. A *great* thank you goes to Lakatos Zsolt, who provided a complete patch for get-recent-comments-1.5.6, which made it very easy for me to understand how 2.0-beta10 had to be changed. Thank you also to xelios, Ville and Kretzschmar who warned me, that WordPress 2.3 will break the old plugin code. 1.5.5 2007/03/26 Added support for malyfred's Polyglot Plugin. Requested by Torben. 1.5.4 2007/02/01 Use full pingback_author as %comment_author (instead of 'Unknown', if the pingback parser fails to recognize the pingback_author. Thanks again to Gant who found this in his blog. Added %author_url_href macros, which allows to generate inactive links, if the commentator did not leave an url. This was wished (in part long ago) by beej, carl, FilSchiesty and SwB. Added %profile_picture macro, which supports Hannah Gray's Profile Pics Plugin. Thank you for the idea and your help, Markus 1.5.3 2007/01/15 Refresh cache, when a comment is approved by moderator. Problem found by Gant. Thank you! 1.5.2 2007/01/05 Added option for excluding comments from blog authors. Suggested by This is Zimbabwe, Slim, marilyn's shampoo and Igor M. 1.5.1 2006/12/29 Store the cache base64 encoded. There seems to be a problem with the unserialization of multibyte characters. Thanks to priv, who reported the problem and suggested the encoding. After upgrading to this version you should trigger a regeneration of the cache by adding a comment somewhere. 1.5 2006/12/27 New pingback parser Stop losing html entities and tags in the post titles and comments by using wptexturize. Thanks to ejm (again!) and mobius for reporting the problem and making suggestions. Bugfix in widget code: Error, when trackbacks came before comments 1.4 2006/12/24 The plugin is a widget now. Thanks to herrmueller and Thomas de Klein for suggesting this feature. Cache the output in order to reduce the database impact of the plugin. Thanks to the following people for reporting the poor performance and making suggestions to solve the problem: Brandon Stone, King of Fools, Robert Basic and especially CountZero. Option to combine comments and trackbacks in one list (requested by Maniac and die produzentin) Allow to Group comments by their posting (requested by eyolf) Allow limit of comments per post (suggested by Thomas) Use Wordpress 2.1 compatible database variables. Thanks to spencerp, for reporting and fixing. Bugfix: Wrong key used in gravatar hash (Thank you, Hamzeh N., for finding and fixing this). Updated the stylesheets to the look of wordpress 2.x. Added two macros: %comment_type and %post_counter. Use less option variables in db. Updated instructions page. Dropped support for Wordpress 1.2 1.3.1 2006/12/11 Fixes for problems with wordpress running under windows. 1.3 2006/11/26 Fixes for problems with php5. 1.2 2005/09/15 Prevent pingbacks from own blog. Thanks to Matt for the idea and support! To use the feature, go to the trackbacks configuration and enter the address of your webserver. 1.0 2005/03/21 Also show comments to static pages. (They are new in WP 1.5). Thanks to maza for the hint. 0.9 2005/03/20 Introduced admin gui. Handle trackbacks different than comments. Replaced most regular expressions with basic string operations. Dedicated macro for posting time. Requested by Zonekiller 0.8 2005/02/04 Readjusted sequence of arguments to the one described in the documentation. Thanks to Thomas 0.7 2005/02/03 Renamed plugin to get-recent-comments, to make it possible to use the subversion system at www.wp-plugins.org Allow to specify your own formatting in the function call 0.5 2005/01/02 Removed superfluous </p> 0.4 2004/12/19 Use function arguments for displaying HTML before and after the comment Make number of comments and number of characters also function arguments 0.3 2004/12/08 Link to permalink of comment Wrap very long strings 0.2 Don’t show comments that are not approved 0.1 2004/11/03 Initial release Thanks to all who sent bug reports and ideas for improvements. Please send me a mail if I forgot you to mention here.
{ "pile_set_name": "Github" }
" vim:foldmethod=marker:fen: scriptencoding utf-8 let b:caw_oneline_comment = '#' if !exists('b:did_caw_ftplugin') if exists('b:undo_ftplugin') let b:undo_ftplugin .= ' | ' else let b:undo_ftplugin = '' endif let b:undo_ftplugin .= 'unlet! b:caw_oneline_comment b:caw_wrap_oneline_comment b:caw_wrap_multiline_comment b:did_caw_ftplugin' let b:did_caw_ftplugin = 1 endif
{ "pile_set_name": "Github" }
0061..007A 00AA..00AA 00B5..00B5 00BA..00BA 00DF..00F6 00F8..00FF 0101..0101 0103..0103 0105..0105 0107..0107 0109..0109 010B..010B 010D..010D 010F..010F 0111..0111 0113..0113 0115..0115 0117..0117 0119..0119 011B..011B 011D..011D 011F..011F 0121..0121 0123..0123 0125..0125 0127..0127 0129..0129 012B..012B 012D..012D 012F..012F 0131..0131 0133..0133 0135..0135 0137..0138 013A..013A 013C..013C 013E..013E 0140..0140 0142..0142 0144..0144 0146..0146 0148..0149 014B..014B 014D..014D 014F..014F 0151..0151 0153..0153 0155..0155 0157..0157 0159..0159 015B..015B 015D..015D 015F..015F 0161..0161 0163..0163 0165..0165 0167..0167 0169..0169 016B..016B 016D..016D 016F..016F 0171..0171 0173..0173 0175..0175 0177..0177 017A..017A 017C..017C 017E..0180 0183..0183 0185..0185 0188..0188 018C..018D 0192..0192 0195..0195 0199..019B 019E..019E 01A1..01A1 01A3..01A3 01A5..01A5 01A8..01A8 01AA..01AB 01AD..01AD 01B0..01B0 01B4..01B4 01B6..01B6 01B9..01BA 01BD..01BF 01C6..01C6 01C9..01C9 01CC..01CC 01CE..01CE 01D0..01D0 01D2..01D2 01D4..01D4 01D6..01D6 01D8..01D8 01DA..01DA 01DC..01DD 01DF..01DF 01E1..01E1 01E3..01E3 01E5..01E5 01E7..01E7 01E9..01E9 01EB..01EB 01ED..01ED 01EF..01F0 01F3..01F3 01F5..01F5 01F9..01F9 01FB..01FB 01FD..01FD 01FF..01FF 0201..0201 0203..0203 0205..0205 0207..0207 0209..0209 020B..020B 020D..020D 020F..020F 0211..0211 0213..0213 0215..0215 0217..0217 0219..0219 021B..021B 021D..021D 021F..021F 0221..0221 0223..0223 0225..0225 0227..0227 0229..0229 022B..022B 022D..022D 022F..022F 0231..0231 0233..0239 023C..023C 023F..0240 0242..0242 0247..0247 0249..0249 024B..024B 024D..024D 024F..0293 0295..02B8 02C0..02C1 02E0..02E4 0345..0345 0371..0371 0373..0373 0377..0377 037A..037D 0390..0390 03AC..03CE 03D0..03D1 03D5..03D7 03D9..03D9 03DB..03DB 03DD..03DD 03DF..03DF 03E1..03E1 03E3..03E3 03E5..03E5 03E7..03E7 03E9..03E9 03EB..03EB 03ED..03ED 03EF..03F3 03F5..03F5 03F8..03F8 03FB..03FC 0430..045F 0461..0461 0463..0463 0465..0465 0467..0467 0469..0469 046B..046B 046D..046D 046F..046F 0471..0471 0473..0473 0475..0475 0477..0477 0479..0479 047B..047B 047D..047D 047F..047F 0481..0481 048B..048B 048D..048D 048F..048F 0491..0491 0493..0493 0495..0495 0497..0497 0499..0499 049B..049B 049D..049D 049F..049F 04A1..04A1 04A3..04A3 04A5..04A5 04A7..04A7 04A9..04A9 04AB..04AB 04AD..04AD 04AF..04AF 04B1..04B1 04B3..04B3 04B5..04B5 04B7..04B7 04B9..04B9 04BB..04BB 04BD..04BD 04BF..04BF 04C2..04C2 04C4..04C4 04C6..04C6 04C8..04C8 04CA..04CA 04CC..04CC 04CE..04CF 04D1..04D1 04D3..04D3 04D5..04D5 04D7..04D7 04D9..04D9 04DB..04DB 04DD..04DD 04DF..04DF 04E1..04E1 04E3..04E3 04E5..04E5 04E7..04E7 04E9..04E9 04EB..04EB 04ED..04ED 04EF..04EF 04F1..04F1 04F3..04F3 04F5..04F5 04F7..04F7 04F9..04F9 04FB..04FB 04FD..04FD 04FF..04FF 0501..0501 0503..0503 0505..0505 0507..0507 0509..0509 050B..050B 050D..050D 050F..050F 0511..0511 0513..0513 0515..0515 0517..0517 0519..0519 051B..051B 051D..051D 051F..051F 0521..0521 0523..0523 0525..0525 0561..0587 1D00..1DBF 1E01..1E01 1E03..1E03 1E05..1E05 1E07..1E07 1E09..1E09 1E0B..1E0B 1E0D..1E0D 1E0F..1E0F 1E11..1E11 1E13..1E13 1E15..1E15 1E17..1E17 1E19..1E19 1E1B..1E1B 1E1D..1E1D 1E1F..1E1F 1E21..1E21 1E23..1E23 1E25..1E25 1E27..1E27 1E29..1E29 1E2B..1E2B 1E2D..1E2D 1E2F..1E2F 1E31..1E31 1E33..1E33 1E35..1E35 1E37..1E37 1E39..1E39 1E3B..1E3B 1E3D..1E3D 1E3F..1E3F 1E41..1E41 1E43..1E43 1E45..1E45 1E47..1E47 1E49..1E49 1E4B..1E4B 1E4D..1E4D 1E4F..1E4F 1E51..1E51 1E53..1E53 1E55..1E55 1E57..1E57 1E59..1E59 1E5B..1E5B 1E5D..1E5D 1E5F..1E5F 1E61..1E61 1E63..1E63 1E65..1E65 1E67..1E67 1E69..1E69 1E6B..1E6B 1E6D..1E6D 1E6F..1E6F 1E71..1E71 1E73..1E73 1E75..1E75 1E77..1E77 1E79..1E79 1E7B..1E7B 1E7D..1E7D 1E7F..1E7F 1E81..1E81 1E83..1E83 1E85..1E85 1E87..1E87 1E89..1E89 1E8B..1E8B 1E8D..1E8D 1E8F..1E8F 1E91..1E91 1E93..1E93 1E95..1E9D 1E9F..1E9F 1EA1..1EA1 1EA3..1EA3 1EA5..1EA5 1EA7..1EA7 1EA9..1EA9 1EAB..1EAB 1EAD..1EAD 1EAF..1EAF 1EB1..1EB1 1EB3..1EB3 1EB5..1EB5 1EB7..1EB7 1EB9..1EB9 1EBB..1EBB 1EBD..1EBD 1EBF..1EBF 1EC1..1EC1 1EC3..1EC3 1EC5..1EC5 1EC7..1EC7 1EC9..1EC9 1ECB..1ECB 1ECD..1ECD 1ECF..1ECF 1ED1..1ED1 1ED3..1ED3 1ED5..1ED5 1ED7..1ED7 1ED9..1ED9 1EDB..1EDB 1EDD..1EDD 1EDF..1EDF 1EE1..1EE1 1EE3..1EE3 1EE5..1EE5 1EE7..1EE7 1EE9..1EE9 1EEB..1EEB 1EED..1EED 1EEF..1EEF 1EF1..1EF1 1EF3..1EF3 1EF5..1EF5 1EF7..1EF7 1EF9..1EF9 1EFB..1EFB 1EFD..1EFD 1EFF..1F07 1F10..1F15 1F20..1F27 1F30..1F37 1F40..1F45 1F50..1F57 1F60..1F67 1F70..1F7D 1F80..1F87 1F90..1F97 1FA0..1FA7 1FB0..1FB4 1FB6..1FB7 1FBE..1FBE 1FC2..1FC4 1FC6..1FC7 1FD0..1FD3 1FD6..1FD7 1FE0..1FE7 1FF2..1FF4 1FF6..1FF7 2090..2094 210A..210A 210E..210F 2113..2113 212F..212F 2134..2134 2139..2139 213C..213D 2146..2149 214E..214E 2170..217F 2184..2184 24D0..24E9 2C30..2C5E 2C61..2C61 2C65..2C66 2C68..2C68 2C6A..2C6A 2C6C..2C6C 2C71..2C71 2C73..2C74 2C76..2C7D 2C81..2C81 2C83..2C83 2C85..2C85 2C87..2C87 2C89..2C89 2C8B..2C8B 2C8D..2C8D 2C8F..2C8F 2C91..2C91 2C93..2C93 2C95..2C95 2C97..2C97 2C99..2C99 2C9B..2C9B 2C9D..2C9D 2C9F..2C9F 2CA1..2CA1 2CA3..2CA3 2CA5..2CA5 2CA7..2CA7 2CA9..2CA9 2CAB..2CAB 2CAD..2CAD 2CAF..2CAF 2CB1..2CB1 2CB3..2CB3 2CB5..2CB5 2CB7..2CB7 2CB9..2CB9 2CBB..2CBB 2CBD..2CBD 2CBF..2CBF 2CC1..2CC1 2CC3..2CC3 2CC5..2CC5 2CC7..2CC7 2CC9..2CC9 2CCB..2CCB 2CCD..2CCD 2CCF..2CCF 2CD1..2CD1 2CD3..2CD3 2CD5..2CD5 2CD7..2CD7 2CD9..2CD9 2CDB..2CDB 2CDD..2CDD 2CDF..2CDF 2CE1..2CE1 2CE3..2CE4 2CEC..2CEC 2CEE..2CEE 2D00..2D25 A641..A641 A643..A643 A645..A645 A647..A647 A649..A649 A64B..A64B A64D..A64D A64F..A64F A651..A651 A653..A653 A655..A655 A657..A657 A659..A659 A65B..A65B A65D..A65D A65F..A65F A663..A663 A665..A665 A667..A667 A669..A669 A66B..A66B A66D..A66D A681..A681 A683..A683 A685..A685 A687..A687 A689..A689 A68B..A68B A68D..A68D A68F..A68F A691..A691 A693..A693 A695..A695 A697..A697 A723..A723 A725..A725 A727..A727 A729..A729 A72B..A72B A72D..A72D A72F..A731 A733..A733 A735..A735 A737..A737 A739..A739 A73B..A73B A73D..A73D A73F..A73F A741..A741 A743..A743 A745..A745 A747..A747 A749..A749 A74B..A74B A74D..A74D A74F..A74F A751..A751 A753..A753 A755..A755 A757..A757 A759..A759 A75B..A75B A75D..A75D A75F..A75F A761..A761 A763..A763 A765..A765 A767..A767 A769..A769 A76B..A76B A76D..A76D A76F..A778 A77A..A77A A77C..A77C A77F..A77F A781..A781 A783..A783 A785..A785 A787..A787 A78C..A78C FB00..FB06 FB13..FB17 FF41..FF5A 10428..1044F 1D41A..1D433 1D44E..1D454 1D456..1D467 1D482..1D49B 1D4B6..1D4B9 1D4BB..1D4BB 1D4BD..1D4C3 1D4C5..1D4CF 1D4EA..1D503 1D51E..1D537 1D552..1D56B 1D586..1D59F 1D5BA..1D5D3 1D5EE..1D607 1D622..1D63B 1D656..1D66F 1D68A..1D6A5 1D6C2..1D6DA 1D6DC..1D6E1 1D6FC..1D714 1D716..1D71B 1D736..1D74E 1D750..1D755 1D770..1D788 1D78A..1D78F 1D7AA..1D7C2 1D7C4..1D7C9 1D7CB..1D7CB
{ "pile_set_name": "Github" }
import os import sys from setuptools import setup, find_packages DESCRIPTION = "A Django oriented templated / transaction email abstraction" VERSION = '2.3.0' LONG_DESCRIPTION = None try: LONG_DESCRIPTION = open('README.rst').read() except: pass requirements = [ 'django-render-block>=0.5', 'six>=1', ] # python setup.py publish if sys.argv[-1] == 'publish': os.system("python setup.py sdist upload") sys.exit() CLASSIFIERS = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Topic :: Software Development :: Libraries :: Python Modules', 'Framework :: Django', ] setup( name='django-templated-email', version=VERSION, packages=find_packages(exclude=("tests", "tests.*")), include_package_data=True, author='Bradley Whittington', author_email='[email protected]', url='http://github.com/vintasoftware/django-templated-email/', license='MIT', description=DESCRIPTION, long_description=LONG_DESCRIPTION, platforms=['any'], classifiers=CLASSIFIERS, install_requires=requirements, )
{ "pile_set_name": "Github" }
<html><head><title>Epydoc Redirect Page</title> <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="expires" content="0" /> <meta http-equiv="pragma" content="no-cache" /> <script type="text/javascript" src="epydoc.js"></script> </head> <body> <script type="text/javascript"> <!-- var pages = ["FuzzManager.FTB.Signatures.test_CrashSignature.SignatureStackFramesWildcardTailTest-c", "FuzzManager.FTB.Signatures.test_CrashSignature.SignatureStackFramesAlgorithmsTest-c", "FuzzManager.FTB.Signatures.test_CrashSignature.SignatureStackFramesRegressionTest-c", "FuzzManager.FTB.Running.PersistentApplication.SimplePersistentApplication-c", "FuzzManager.FTB.Signatures.test_CrashSignature.SignatureTestCaseMatchTest-c", "FuzzManager.FTB.Signatures.test_CrashSignature.SignatureStackFramesTest-c", "FuzzManager.FTB.Signatures.test_CrashSignature.SignaturePCREShortTest-c", "FuzzManager.FTB.Signatures.tests.GDBParserTestCrashAddressRegression2-c", "FuzzManager.FTB.Signatures.tests.GDBParserTestCrashAddressRegression3-c", "FuzzManager.FTB.Signatures.tests.GDBParserTestCrashAddressRegression4-c", "FuzzManager.FTB.Running.PersistentApplication.PersistentApplication-c", "FuzzManager.FTB.Signatures.test_CrashSignature.SignatureCreateTest-c", "FuzzManager.FTB.Signatures.tests.GDBParserTestCrashAddressSimple-c", "FuzzManager.FTB.Running.PersistentApplication.ApplicationStatus-c", "FuzzManager.FTB.Signatures.tests.CrashSignatureStackFrameTest-c", "FuzzManager.FTB.Signatures.tests.CrashSignatureStackSizeTest-c", "FuzzManager.FTB.Signatures.tests.CrashSignatureRegisterTest-c", "FuzzManager.FTB.Signatures.tests.CrashSignatureAddressTest-c", "FuzzManager.FTB.Signatures.tests.GDBParserTestCrashAddress-c", "FuzzManager.FTB.ProgramConfiguration.ProgramConfiguration-c", "FuzzManager.FTB.Signatures.tests.CrashSignatureOutputTest-c", "FuzzManager.FTB.Signatures.tests.GDBParserTestRegression1-c", "FuzzManager.FTB.Signatures.CrashSignature.CrashSignature-c", "FuzzManager.FTB.Signatures.tests.ASanParserTestHeapCrash-c", "FuzzManager.FTB.Signatures.tests.MinidumpParserTestCrash-c", "FuzzManager.FTB.Signatures.tests.RegisterHelperValueTest-c", "FuzzManager.FTB.Running.StreamCollector.StreamCollector-c", "FuzzManager.FTB.Signatures.CrashInfo.MinidumpCrashInfo-c", "FuzzManager.FTB.Signatures.Symptom.CrashAddressSymptom-c", "FuzzManager.FTB.ConfigurationFiles.ConfigurationFiles-c", "FuzzManager.FTB.Signatures.Symptom.InstructionSymptom-c", "FuzzManager.FTB.Signatures.Symptom.StackFramesSymptom-c", "FuzzManager.FTB.Signatures.tests.AppleParserTestCrash-c", "FuzzManager.FTB.Signatures.tests.MinidumpSelectorTest-c", "FuzzManager.FTB.Signatures.tests.UBSanParserTestCrash-c", "FuzzManager.FTB.Signatures.Symptom.StackFrameSymptom-c", "FuzzManager.FTB.Signatures.tests.ASanParserTestCrash-c", "FuzzManager.FTB.tests.AssertionHelperTestASanFFAbort-c", "FuzzManager.FTB.Signatures.CrashInfo.AppleCrashInfo-c", "FuzzManager.FTB.Signatures.CrashInfo.UBSanCrashInfo-c", "FuzzManager.FTB.Signatures.Matchers.NumberMatchType-c", "FuzzManager.FTB.Signatures.Symptom.StackSizeSymptom-c", "FuzzManager.FTB.Signatures.tests.GDBParserTestCrash-c", "FuzzManager.FTB.tests.AssertionHelperTestSanitizing-c", "FuzzManager.FTB.Signatures.CrashInfo.ASanCrashInfo-c", "FuzzManager.FTB.Signatures.Symptom.TestcaseSymptom-c", "FuzzManager.FTB.Signatures.tests.ASanDetectionTest-c", "FuzzManager.FTB.Signatures.tests.ASanParserTestUAF-c", "FuzzManager.FTB.Signatures.tests.AppleSelectorTest-c", "FuzzManager.Collector.Configuration.Configuration-c", "FuzzManager.FTB.Signatures.CrashInfo.GDBCrashInfo-c", "FuzzManager.FTB.tests.AssertionHelperTestMozCrash-c", "FuzzManager.Collector.tests.TestCollectorRefresh-c", "FuzzManager.FTB.Signatures.CrashInfo.NoCrashInfo-c", "FuzzManager.FTB.Signatures.Symptom.OutputSymptom-c", "FuzzManager.Collector.tests.TestCollectorSubmit-c", "FuzzManager.FTB.Signatures.Matchers.NumberMatch-c", "FuzzManager.FTB.Signatures.Matchers.StringMatch-c", "FuzzManager.FTB.Signatures.test_CrashSignature-m", "FuzzManager.FTB.Signatures.CrashInfo.CrashInfo-c", "FuzzManager.FTB.Running.PersistentApplication-m", "FuzzManager.FTB.Running.AutoRunner.ASanRunner-c", "FuzzManager.FTB.Running.AutoRunner.AutoRunner-c", "FuzzManager.FTB.Running.AutoRunner.GDBRunner-c", "FuzzManager.FTB.Running.GDBRunner.GDBRunner-c", "FuzzManager.FTB.Signatures.Symptom.Symptom-c", "FuzzManager.FTB.Signatures.CrashSignature-m", "FuzzManager.FTB.Signatures.RegisterHelper-m", "FuzzManager.Collector.Collector.Collector-c", "FuzzManager.FTB.Running.StreamCollector-m", "FuzzManager.FTB.Signatures.JSONHelper-m", "FuzzManager.FTB.ProgramConfiguration-m", "FuzzManager.FTB.Signatures.CrashInfo-m", "FuzzManager.Collector.Configuration-m", "FuzzManager.FTB.Signatures.Matchers-m", "FuzzManager.FTB.ConfigurationFiles-m", "FuzzManager.FTB.Running.AutoRunner-m", "FuzzManager.FTB.Signatures.Symptom-m", "FuzzManager.FTB.Running.GDBRunner-m", "FuzzManager.FTB.Signatures.tests-m", "FuzzManager.Collector.Collector-m", "FuzzManager.FTB.AssertionHelper-m", "FuzzManager.Collector.tests-m", "FuzzManager.FTB.Running.GDB-m", "FuzzManager.FTB.Signatures-m", "exceptions.AssertionError-c", "FuzzManager.FTB.Running-m", "FuzzManager.Collector-m", "FuzzManager.FTB.tests-m", "FuzzManager.FTB-m", "abc.ABCMeta-c"]; var dottedName = get_anchor(); if (dottedName) { var target = redirect_url(dottedName); if (target) window.location.replace(target); } // --> </script> <h3>Epydoc Auto-redirect page</h3> <p>When javascript is enabled, this page will redirect URLs of the form <tt>redirect.html#<i>dotted.name</i></tt> to the documentation for the object with the given fully-qualified dotted name.</p> <p><a id="message"> &nbsp; </a></p> <script type="text/javascript"> <!-- if (dottedName) { var msg = document.getElementById("message"); msg.innerHTML = "No documentation found for <tt>"+ dottedName+"</tt>"; } // --> </script> </body> </html>
{ "pile_set_name": "Github" }
// Copyright 2017 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 h2demo package main import "html/template" var pushTmpl = template.Must(template.New("serverpush").Parse(` <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="theme-color" content="#375EAB"> <title>HTTP/2 Server Push Demo</title> <link type="text/css" rel="stylesheet" href="/serverpush/static/style.css?{{.CacheBust}}"> <script> window.initFuncs = []; </script> <script> function showtimes() { var times = 'DOM loaded: ' + (window.performance.timing.domContentLoadedEventEnd - window.performance.timing.navigationStart) + 'ms, ' times += 'DOM complete (all loaded): ' + (window.performance.timing.domComplete - window.performance.timing.navigationStart) + 'ms, ' times += 'Load event fired: ' + (window.performance.timing.loadEventStart - window.performance.timing.navigationStart) + 'ms' document.getElementById('loadtimes').innerHTML = times } </script> </head> <body onload="showtimes()"> <div style="background:#fff9a4;padding:10px"> Note: This page exists for demonstration purposes. For the actual cmd/go docs, go to <a href="golang.org/cmd/go">golang.org/cmd/go</a>. </div> <div style="padding:20px"> <a href="https://{{.HTTPSHost}}/serverpush">HTTP/2 with Server Push</a> | <a href="http://{{.HTTPHost}}/serverpush">HTTP only</a> <div id="loadtimes"></div> </div> <div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;"> ... </div><!-- #lowframe --> <div id="topbar" class="wide"><div class="container"> <div class="top-heading" id="heading-wide"><a href="/">The Go Programming Language</a></div> <div class="top-heading" id="heading-narrow"><a href="/">Go</a></div> <a href="#" id="menu-button"><span id="menu-button-arrow">&#9661;</span></a> <form method="GET" action="/search"> <div id="menu"> <a href="/doc/">Documents</a> <a href="/pkg/">Packages</a> <a href="/project/">The Project</a> <a href="/help/">Help</a> <a href="/blog/">Blog</a> <a id="playgroundButton" href="http://play.golang.org/" title="Show Go Playground">Play</a> <input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search"> </div> </form> </div></div> <div id="playground" class="play"> <div class="input"><textarea class="code" spellcheck="false">package main import "fmt" func main() { fmt.Println("Hello, 世界") }</textarea></div> <div class="output"></div> <div class="buttons"> <a class="run" title="Run this code [shift-enter]">Run</a> <a class="fmt" title="Format this code">Format</a> <a class="share" title="Share this code">Share</a> </div> </div> <div id="page" class="wide"> <div class="container"> <h1>Command go</h1> <div id="nav"></div> <!-- Copyright 2009 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> <!-- Note: Static (i.e., not template-generated) href and id attributes start with "pkg-" to make it impossible for them to conflict with generated attributes (some of which correspond to Go identifiers). --> <script type='text/javascript'> document.ANALYSIS_DATA = null; document.CALLGRAPH = null; </script> <p> Go is a tool for managing Go source code. </p> <p> Usage: </p> <pre>go command [arguments] </pre> <p> The commands are: </p> <pre>build compile packages and dependencies clean remove object files doc show documentation for package or symbol env print Go environment information bug start a bug report fix run go tool fix on packages fmt run gofmt on package sources generate generate Go files by processing source get download and install packages and dependencies install compile and install packages and dependencies list list packages run compile and run Go program test test packages tool run specified go tool version print Go version vet run go tool vet on packages </pre> <p> Use &#34;go help [command]&#34; for more information about a command. </p> <p> Additional help topics: </p> <pre>c calling between Go and C buildmode description of build modes filetype file types gopath GOPATH environment variable environment environment variables importpath import path syntax packages description of package lists testflag description of testing flags testfunc description of testing functions </pre> <p> Use &#34;go help [topic]&#34; for more information about that topic. </p> <h3 id="hdr-Compile_packages_and_dependencies">Compile packages and dependencies</h3> <p> Usage: </p> <pre>go build [-o output] [-i] [build flags] [packages] </pre> <p> Build compiles the packages named by the import paths, along with their dependencies, but it does not install the results. </p> <p> If the arguments to build are a list of .go files, build treats them as a list of source files specifying a single package. </p> <p> When compiling a single main package, build writes the resulting executable to an output file named after the first source file (&#39;go build ed.go rx.go&#39; writes &#39;ed&#39; or &#39;ed.exe&#39;) or the source code directory (&#39;go build unix/sam&#39; writes &#39;sam&#39; or &#39;sam.exe&#39;). The &#39;.exe&#39; suffix is added when writing a Windows executable. </p> <p> When compiling multiple packages or a single non-main package, build compiles the packages but discards the resulting object, serving only as a check that the packages can be built. </p> <p> When compiling packages, build ignores files that end in &#39;_test.go&#39;. </p> <p> The -o flag, only allowed when compiling a single package, forces build to write the resulting executable or object to the named output file, instead of the default behavior described in the last two paragraphs. </p> <p> The -i flag installs the packages that are dependencies of the target. </p> <p> The build flags are shared by the build, clean, get, install, list, run, and test commands: </p> <pre>-a force rebuilding of packages that are already up-to-date. -n print the commands but do not run them. -p n the number of programs, such as build commands or test binaries, that can be run in parallel. The default is the number of CPUs available. -race enable data race detection. Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64. -msan enable interoperation with memory sanitizer. Supported only on linux/amd64, and only with Clang/LLVM as the host C compiler. -v print the names of packages as they are compiled. -work print the name of the temporary work directory and do not delete it when exiting. -x print the commands. -asmflags &#39;flag list&#39; arguments to pass on each go tool asm invocation. -buildmode mode build mode to use. See &#39;go help buildmode&#39; for more. -compiler name name of compiler to use, as in runtime.Compiler (gccgo or gc). -gccgoflags &#39;arg list&#39; arguments to pass on each gccgo compiler/linker invocation. -gcflags &#39;arg list&#39; arguments to pass on each go tool compile invocation. -installsuffix suffix a suffix to use in the name of the package installation directory, in order to keep output separate from default builds. If using the -race flag, the install suffix is automatically set to race or, if set explicitly, has _race appended to it. Likewise for the -msan flag. Using a -buildmode option that requires non-default compile flags has a similar effect. -ldflags &#39;flag list&#39; arguments to pass on each go tool link invocation. -linkshared link against shared libraries previously created with -buildmode=shared. -pkgdir dir install and load all packages from dir instead of the usual locations. For example, when building with a non-standard configuration, use -pkgdir to keep generated packages in a separate location. -tags &#39;tag list&#39; a list of build tags to consider satisfied during the build. For more information about build tags, see the description of build constraints in the documentation for the go/build package. -toolexec &#39;cmd args&#39; a program to use to invoke toolchain programs like vet and asm. For example, instead of running asm, the go command will run &#39;cmd args /path/to/asm &lt;arguments for asm&gt;&#39;. </pre> <p> The list flags accept a space-separated list of strings. To embed spaces in an element in the list, surround it with either single or double quotes. </p> <p> For more about specifying packages, see &#39;go help packages&#39;. For more about where packages and binaries are installed, run &#39;go help gopath&#39;. For more about calling between Go and C/C++, run &#39;go help c&#39;. </p> <p> Note: Build adheres to certain conventions such as those described by &#39;go help gopath&#39;. Not all projects can follow these conventions, however. Installations that have their own conventions or that use a separate software build system may choose to use lower-level invocations such as &#39;go tool compile&#39; and &#39;go tool link&#39; to avoid some of the overheads and design decisions of the build tool. </p> <p> See also: go install, go get, go clean. </p> <h3 id="hdr-Remove_object_files">Remove object files</h3> <p> Usage: </p> <pre>go clean [-i] [-r] [-n] [-x] [build flags] [packages] </pre> <p> Clean removes object files from package source directories. The go command builds most objects in a temporary directory, so go clean is mainly concerned with object files left by other tools or by manual invocations of go build. </p> <p> Specifically, clean removes the following files from each of the source directories corresponding to the import paths: </p> <pre>_obj/ old object directory, left from Makefiles _test/ old test directory, left from Makefiles _testmain.go old gotest file, left from Makefiles test.out old test log, left from Makefiles build.out old test log, left from Makefiles *.[568ao] object files, left from Makefiles DIR(.exe) from go build DIR.test(.exe) from go test -c MAINFILE(.exe) from go build MAINFILE.go *.so from SWIG </pre> <p> In the list, DIR represents the final path element of the directory, and MAINFILE is the base name of any Go source file in the directory that is not included when building the package. </p> <p> The -i flag causes clean to remove the corresponding installed archive or binary (what &#39;go install&#39; would create). </p> <p> The -n flag causes clean to print the remove commands it would execute, but not run them. </p> <p> The -r flag causes clean to be applied recursively to all the dependencies of the packages named by the import paths. </p> <p> The -x flag causes clean to print remove commands as it executes them. </p> <p> For more about build flags, see &#39;go help build&#39;. </p> <p> For more about specifying packages, see &#39;go help packages&#39;. </p> <h3 id="hdr-Show_documentation_for_package_or_symbol">Show documentation for package or symbol</h3> <p> Usage: </p> <pre>go doc [-u] [-c] [package|[package.]symbol[.method]] </pre> <p> Doc prints the documentation comments associated with the item identified by its arguments (a package, const, func, type, var, or method) followed by a one-line summary of each of the first-level items &#34;under&#34; that item (package-level declarations for a package, methods for a type, etc.). </p> <p> Doc accepts zero, one, or two arguments. </p> <p> Given no arguments, that is, when run as </p> <pre>go doc </pre> <p> it prints the package documentation for the package in the current directory. If the package is a command (package main), the exported symbols of the package are elided from the presentation unless the -cmd flag is provided. </p> <p> When run with one argument, the argument is treated as a Go-syntax-like representation of the item to be documented. What the argument selects depends on what is installed in GOROOT and GOPATH, as well as the form of the argument, which is schematically one of these: </p> <pre>go doc &lt;pkg&gt; go doc &lt;sym&gt;[.&lt;method&gt;] go doc [&lt;pkg&gt;.]&lt;sym&gt;[.&lt;method&gt;] go doc [&lt;pkg&gt;.][&lt;sym&gt;.]&lt;method&gt; </pre> <p> The first item in this list matched by the argument is the one whose documentation is printed. (See the examples below.) However, if the argument starts with a capital letter it is assumed to identify a symbol or method in the current directory. </p> <p> For packages, the order of scanning is determined lexically in breadth-first order. That is, the package presented is the one that matches the search and is nearest the root and lexically first at its level of the hierarchy. The GOROOT tree is always scanned in its entirety before GOPATH. </p> <p> If there is no package specified or matched, the package in the current directory is selected, so &#34;go doc Foo&#34; shows the documentation for symbol Foo in the current package. </p> <p> The package path must be either a qualified path or a proper suffix of a path. The go tool&#39;s usual package mechanism does not apply: package path elements like . and ... are not implemented by go doc. </p> <p> When run with two arguments, the first must be a full package path (not just a suffix), and the second is a symbol or symbol and method; this is similar to the syntax accepted by godoc: </p> <pre>go doc &lt;pkg&gt; &lt;sym&gt;[.&lt;method&gt;] </pre> <p> In all forms, when matching symbols, lower-case letters in the argument match either case but upper-case letters match exactly. This means that there may be multiple matches of a lower-case argument in a package if different symbols have different cases. If this occurs, documentation for all matches is printed. </p> <p> Examples: </p> <pre>go doc Show documentation for current package. go doc Foo Show documentation for Foo in the current package. (Foo starts with a capital letter so it cannot match a package path.) go doc encoding/json Show documentation for the encoding/json package. go doc json Shorthand for encoding/json. go doc json.Number (or go doc json.number) Show documentation and method summary for json.Number. go doc json.Number.Int64 (or go doc json.number.int64) Show documentation for json.Number&#39;s Int64 method. go doc cmd/doc Show package docs for the doc command. go doc -cmd cmd/doc Show package docs and exported symbols within the doc command. go doc template.new Show documentation for html/template&#39;s New function. (html/template is lexically before text/template) go doc text/template.new # One argument Show documentation for text/template&#39;s New function. go doc text/template new # Two arguments Show documentation for text/template&#39;s New function. At least in the current tree, these invocations all print the documentation for json.Decoder&#39;s Decode method: go doc json.Decoder.Decode go doc json.decoder.decode go doc json.decode cd go/src/encoding/json; go doc decode </pre> <p> Flags: </p> <pre>-c Respect case when matching symbols. -cmd Treat a command (package main) like a regular package. Otherwise package main&#39;s exported symbols are hidden when showing the package&#39;s top-level documentation. -u Show documentation for unexported as well as exported symbols and methods. </pre> <h3 id="hdr-Print_Go_environment_information">Print Go environment information</h3> <p> Usage: </p> <pre>go env [var ...] </pre> <p> Env prints Go environment information. </p> <p> By default env prints information as a shell script (on Windows, a batch file). If one or more variable names is given as arguments, env prints the value of each named variable on its own line. </p> <h3 id="hdr-Start_a_bug_report">Start a bug report</h3> <p> Usage: </p> <pre>go bug </pre> <p> Bug opens the default browser and starts a new bug report. The report includes useful system information. </p> <h3 id="hdr-Run_go_tool_fix_on_packages">Run go tool fix on packages</h3> <p> Usage: </p> <pre>go fix [packages] </pre> <p> Fix runs the Go fix command on the packages named by the import paths. </p> <p> For more about fix, see &#39;go doc cmd/fix&#39;. For more about specifying packages, see &#39;go help packages&#39;. </p> <p> To run fix with specific options, run &#39;go tool fix&#39;. </p> <p> See also: go fmt, go vet. </p> <h3 id="hdr-Run_gofmt_on_package_sources">Run gofmt on package sources</h3> <p> Usage: </p> <pre>go fmt [-n] [-x] [packages] </pre> <p> Fmt runs the command &#39;gofmt -l -w&#39; on the packages named by the import paths. It prints the names of the files that are modified. </p> <p> For more about gofmt, see &#39;go doc cmd/gofmt&#39;. For more about specifying packages, see &#39;go help packages&#39;. </p> <p> The -n flag prints commands that would be executed. The -x flag prints commands as they are executed. </p> <p> To run gofmt with specific options, run gofmt itself. </p> <p> See also: go fix, go vet. </p> <h3 id="hdr-Generate_Go_files_by_processing_source">Generate Go files by processing source</h3> <p> Usage: </p> <pre>go generate [-run regexp] [-n] [-v] [-x] [build flags] [file.go... | packages] </pre> <p> Generate runs commands described by directives within existing files. Those commands can run any process but the intent is to create or update Go source files. </p> <p> Go generate is never run automatically by go build, go get, go test, and so on. It must be run explicitly. </p> <p> Go generate scans the file for directives, which are lines of the form, </p> <pre>//go:generate command argument... </pre> <p> (note: no leading spaces and no space in &#34;//go&#34;) where command is the generator to be run, corresponding to an executable file that can be run locally. It must either be in the shell path (gofmt), a fully qualified path (/usr/you/bin/mytool), or a command alias, described below. </p> <p> Note that go generate does not parse the file, so lines that look like directives in comments or multiline strings will be treated as directives. </p> <p> The arguments to the directive are space-separated tokens or double-quoted strings passed to the generator as individual arguments when it is run. </p> <p> Quoted strings use Go syntax and are evaluated before execution; a quoted string appears as a single argument to the generator. </p> <p> Go generate sets several variables when it runs the generator: </p> <pre>$GOARCH The execution architecture (arm, amd64, etc.) $GOOS The execution operating system (linux, windows, etc.) $GOFILE The base name of the file. $GOLINE The line number of the directive in the source file. $GOPACKAGE The name of the package of the file containing the directive. $DOLLAR A dollar sign. </pre> <p> Other than variable substitution and quoted-string evaluation, no special processing such as &#34;globbing&#34; is performed on the command line. </p> <p> As a last step before running the command, any invocations of any environment variables with alphanumeric names, such as $GOFILE or $HOME, are expanded throughout the command line. The syntax for variable expansion is $NAME on all operating systems. Due to the order of evaluation, variables are expanded even inside quoted strings. If the variable NAME is not set, $NAME expands to the empty string. </p> <p> A directive of the form, </p> <pre>//go:generate -command xxx args... </pre> <p> specifies, for the remainder of this source file only, that the string xxx represents the command identified by the arguments. This can be used to create aliases or to handle multiword generators. For example, </p> <pre>//go:generate -command foo go tool foo </pre> <p> specifies that the command &#34;foo&#34; represents the generator &#34;go tool foo&#34;. </p> <p> Generate processes packages in the order given on the command line, one at a time. If the command line lists .go files, they are treated as a single package. Within a package, generate processes the source files in a package in file name order, one at a time. Within a source file, generate runs generators in the order they appear in the file, one at a time. </p> <p> If any generator returns an error exit status, &#34;go generate&#34; skips all further processing for that package. </p> <p> The generator is run in the package&#39;s source directory. </p> <p> Go generate accepts one specific flag: </p> <pre>-run=&#34;&#34; if non-empty, specifies a regular expression to select directives whose full original source text (excluding any trailing spaces and final newline) matches the expression. </pre> <p> It also accepts the standard build flags including -v, -n, and -x. The -v flag prints the names of packages and files as they are processed. The -n flag prints commands that would be executed. The -x flag prints commands as they are executed. </p> <p> For more about build flags, see &#39;go help build&#39;. </p> <p> For more about specifying packages, see &#39;go help packages&#39;. </p> <h3 id="hdr-Download_and_install_packages_and_dependencies">Download and install packages and dependencies</h3> <p> Usage: </p> <pre>go get [-d] [-f] [-fix] [-insecure] [-t] [-u] [build flags] [packages] </pre> <p> Get downloads the packages named by the import paths, along with their dependencies. It then installs the named packages, like &#39;go install&#39;. </p> <p> The -d flag instructs get to stop after downloading the packages; that is, it instructs get not to install the packages. </p> <p> The -f flag, valid only when -u is set, forces get -u not to verify that each package has been checked out from the source control repository implied by its import path. This can be useful if the source is a local fork of the original. </p> <p> The -fix flag instructs get to run the fix tool on the downloaded packages before resolving dependencies or building the code. </p> <p> The -insecure flag permits fetching from repositories and resolving custom domains using insecure schemes such as HTTP. Use with caution. </p> <p> The -t flag instructs get to also download the packages required to build the tests for the specified packages. </p> <p> The -u flag instructs get to use the network to update the named packages and their dependencies. By default, get uses the network to check out missing packages but does not use it to look for updates to existing packages. </p> <p> The -v flag enables verbose progress and debug output. </p> <p> Get also accepts build flags to control the installation. See &#39;go help build&#39;. </p> <p> When checking out a new package, get creates the target directory GOPATH/src/&lt;import-path&gt;. If the GOPATH contains multiple entries, get uses the first one. For more details see: &#39;go help gopath&#39;. </p> <p> When checking out or updating a package, get looks for a branch or tag that matches the locally installed version of Go. The most important rule is that if the local installation is running version &#34;go1&#34;, get searches for a branch or tag named &#34;go1&#34;. If no such version exists it retrieves the most recent version of the package. </p> <p> When go get checks out or updates a Git repository, it also updates any git submodules referenced by the repository. </p> <p> Get never checks out or updates code stored in vendor directories. </p> <p> For more about specifying packages, see &#39;go help packages&#39;. </p> <p> For more about how &#39;go get&#39; finds source code to download, see &#39;go help importpath&#39;. </p> <p> See also: go build, go install, go clean. </p> <h3 id="hdr-Compile_and_install_packages_and_dependencies">Compile and install packages and dependencies</h3> <p> Usage: </p> <pre>go install [build flags] [packages] </pre> <p> Install compiles and installs the packages named by the import paths, along with their dependencies. </p> <p> For more about the build flags, see &#39;go help build&#39;. For more about specifying packages, see &#39;go help packages&#39;. </p> <p> See also: go build, go get, go clean. </p> <h3 id="hdr-List_packages">List packages</h3> <p> Usage: </p> <pre>go list [-e] [-f format] [-json] [build flags] [packages] </pre> <p> List lists the packages named by the import paths, one per line. </p> <p> The default output shows the package import path: </p> <pre>bytes encoding/json github.com/gorilla/mux golang.org/x/net/html </pre> <p> The -f flag specifies an alternate format for the list, using the syntax of package template. The default output is equivalent to -f &#39;&#39;. The struct being passed to the template is: </p> <pre>type Package struct { Dir string // directory containing package sources ImportPath string // import path of package in dir ImportComment string // path in import comment on package statement Name string // package name Doc string // package documentation string Target string // install path Shlib string // the shared library that contains this package (only set when -linkshared) Goroot bool // is this package in the Go root? Standard bool // is this package part of the standard Go library? Stale bool // would &#39;go install&#39; do anything for this package? StaleReason string // explanation for Stale==true Root string // Go root or Go path dir containing this package ConflictDir string // this directory shadows Dir in $GOPATH BinaryOnly bool // binary-only package: cannot be recompiled from sources // Source files GoFiles []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles) CgoFiles []string // .go sources files that import &#34;C&#34; IgnoredGoFiles []string // .go sources ignored due to build constraints CFiles []string // .c source files CXXFiles []string // .cc, .cxx and .cpp source files MFiles []string // .m source files HFiles []string // .h, .hh, .hpp and .hxx source files FFiles []string // .f, .F, .for and .f90 Fortran source files SFiles []string // .s source files SwigFiles []string // .swig files SwigCXXFiles []string // .swigcxx files SysoFiles []string // .syso object files to add to archive TestGoFiles []string // _test.go files in package XTestGoFiles []string // _test.go files outside package // Cgo directives CgoCFLAGS []string // cgo: flags for C compiler CgoCPPFLAGS []string // cgo: flags for C preprocessor CgoCXXFLAGS []string // cgo: flags for C++ compiler CgoFFLAGS []string // cgo: flags for Fortran compiler CgoLDFLAGS []string // cgo: flags for linker CgoPkgConfig []string // cgo: pkg-config names // Dependency information Imports []string // import paths used by this package Deps []string // all (recursively) imported dependencies TestImports []string // imports from TestGoFiles XTestImports []string // imports from XTestGoFiles // Error information Incomplete bool // this package or a dependency has an error Error *PackageError // error loading package DepsErrors []*PackageError // errors loading dependencies } </pre> <p> Packages stored in vendor directories report an ImportPath that includes the path to the vendor directory (for example, &#34;d/vendor/p&#34; instead of &#34;p&#34;), so that the ImportPath uniquely identifies a given copy of a package. The Imports, Deps, TestImports, and XTestImports lists also contain these expanded imports paths. See golang.org/s/go15vendor for more about vendoring. </p> <p> The error information, if any, is </p> <pre>type PackageError struct { ImportStack []string // shortest path from package named on command line to this one Pos string // position of error (if present, file:line:col) Err string // the error itself } </pre> <p> The template function &#34;join&#34; calls strings.Join. </p> <p> The template function &#34;context&#34; returns the build context, defined as: </p> <pre>type Context struct { GOARCH string // target architecture GOOS string // target operating system GOROOT string // Go root GOPATH string // Go path CgoEnabled bool // whether cgo can be used UseAllFiles bool // use files regardless of +build lines, file names Compiler string // compiler to assume when computing target paths BuildTags []string // build constraints to match in +build lines ReleaseTags []string // releases the current release is compatible with InstallSuffix string // suffix to use in the name of the install dir } </pre> <p> For more information about the meaning of these fields see the documentation for the go/build package&#39;s Context type. </p> <p> The -json flag causes the package data to be printed in JSON format instead of using the template format. </p> <p> The -e flag changes the handling of erroneous packages, those that cannot be found or are malformed. By default, the list command prints an error to standard error for each erroneous package and omits the packages from consideration during the usual printing. With the -e flag, the list command never prints errors to standard error and instead processes the erroneous packages with the usual printing. Erroneous packages will have a non-empty ImportPath and a non-nil Error field; other information may or may not be missing (zeroed). </p> <p> For more about build flags, see &#39;go help build&#39;. </p> <p> For more about specifying packages, see &#39;go help packages&#39;. </p> <h3 id="hdr-Compile_and_run_Go_program">Compile and run Go program</h3> <p> Usage: </p> <pre>go run [build flags] [-exec xprog] gofiles... [arguments...] </pre> <p> Run compiles and runs the main package comprising the named Go source files. A Go source file is defined to be a file ending in a literal &#34;.go&#34; suffix. </p> <p> By default, &#39;go run&#39; runs the compiled binary directly: &#39;a.out arguments...&#39;. If the -exec flag is given, &#39;go run&#39; invokes the binary using xprog: </p> <pre>&#39;xprog a.out arguments...&#39;. </pre> <p> If the -exec flag is not given, GOOS or GOARCH is different from the system default, and a program named go_$GOOS_$GOARCH_exec can be found on the current search path, &#39;go run&#39; invokes the binary using that program, for example &#39;go_nacl_386_exec a.out arguments...&#39;. This allows execution of cross-compiled programs when a simulator or other execution method is available. </p> <p> For more about build flags, see &#39;go help build&#39;. </p> <p> See also: go build. </p> <h3 id="hdr-Test_packages">Test packages</h3> <p> Usage: </p> <pre>go test [build/test flags] [packages] [build/test flags &amp; test binary flags] </pre> <p> &#39;Go test&#39; automates testing the packages named by the import paths. It prints a summary of the test results in the format: </p> <pre>ok archive/tar 0.011s FAIL archive/zip 0.022s ok compress/gzip 0.033s ... </pre> <p> followed by detailed output for each failed package. </p> <p> &#39;Go test&#39; recompiles each package along with any files with names matching the file pattern &#34;*_test.go&#34;. Files whose names begin with &#34;_&#34; (including &#34;_test.go&#34;) or &#34;.&#34; are ignored. These additional files can contain test functions, benchmark functions, and example functions. See &#39;go help testfunc&#39; for more. Each listed package causes the execution of a separate test binary. </p> <p> Test files that declare a package with the suffix &#34;_test&#34; will be compiled as a separate package, and then linked and run with the main test binary. </p> <p> The go tool will ignore a directory named &#34;testdata&#34;, making it available to hold ancillary data needed by the tests. </p> <p> By default, go test needs no arguments. It compiles and tests the package with source in the current directory, including tests, and runs the tests. </p> <p> The package is built in a temporary directory so it does not interfere with the non-test installation. </p> <p> In addition to the build flags, the flags handled by &#39;go test&#39; itself are: </p> <pre>-args Pass the remainder of the command line (everything after -args) to the test binary, uninterpreted and unchanged. Because this flag consumes the remainder of the command line, the package list (if present) must appear before this flag. -c Compile the test binary to pkg.test but do not run it (where pkg is the last element of the package&#39;s import path). The file name can be changed with the -o flag. -exec xprog Run the test binary using xprog. The behavior is the same as in &#39;go run&#39;. See &#39;go help run&#39; for details. -i Install packages that are dependencies of the test. Do not run the test. -o file Compile the test binary to the named file. The test still runs (unless -c or -i is specified). </pre> <p> The test binary also accepts flags that control execution of the test; these flags are also accessible by &#39;go test&#39;. See &#39;go help testflag&#39; for details. </p> <p> For more about build flags, see &#39;go help build&#39;. For more about specifying packages, see &#39;go help packages&#39;. </p> <p> See also: go build, go vet. </p> <h3 id="hdr-Run_specified_go_tool">Run specified go tool</h3> <p> Usage: </p> <pre>go tool [-n] command [args...] </pre> <p> Tool runs the go tool command identified by the arguments. With no arguments it prints the list of known tools. </p> <p> The -n flag causes tool to print the command that would be executed but not execute it. </p> <p> For more about each tool command, see &#39;go tool command -h&#39;. </p> <h3 id="hdr-Print_Go_version">Print Go version</h3> <p> Usage: </p> <pre>go version </pre> <p> Version prints the Go version, as reported by runtime.Version. </p> <h3 id="hdr-Run_go_tool_vet_on_packages">Run go tool vet on packages</h3> <p> Usage: </p> <pre>go vet [-n] [-x] [build flags] [packages] </pre> <p> Vet runs the Go vet command on the packages named by the import paths. </p> <p> For more about vet, see &#39;go doc cmd/vet&#39;. For more about specifying packages, see &#39;go help packages&#39;. </p> <p> To run the vet tool with specific options, run &#39;go tool vet&#39;. </p> <p> The -n flag prints commands that would be executed. The -x flag prints commands as they are executed. </p> <p> For more about build flags, see &#39;go help build&#39;. </p> <p> See also: go fmt, go fix. </p> <h3 id="hdr-Calling_between_Go_and_C">Calling between Go and C</h3> <p> There are two different ways to call between Go and C/C++ code. </p> <p> The first is the cgo tool, which is part of the Go distribution. For information on how to use it see the cgo documentation (go doc cmd/cgo). </p> <p> The second is the SWIG program, which is a general tool for interfacing between languages. For information on SWIG see <a href="http://swig.org/">http://swig.org/</a>. When running go build, any file with a .swig extension will be passed to SWIG. Any file with a .swigcxx extension will be passed to SWIG with the -c++ option. </p> <p> When either cgo or SWIG is used, go build will pass any .c, .m, .s, or .S files to the C compiler, and any .cc, .cpp, .cxx files to the C++ compiler. The CC or CXX environment variables may be set to determine the C or C++ compiler, respectively, to use. </p> <h3 id="hdr-Description_of_build_modes">Description of build modes</h3> <p> The &#39;go build&#39; and &#39;go install&#39; commands take a -buildmode argument which indicates which kind of object file is to be built. Currently supported values are: </p> <pre>-buildmode=archive Build the listed non-main packages into .a files. Packages named main are ignored. -buildmode=c-archive Build the listed main package, plus all packages it imports, into a C archive file. The only callable symbols will be those functions exported using a cgo //export comment. Requires exactly one main package to be listed. -buildmode=c-shared Build the listed main packages, plus all packages that they import, into C shared libraries. The only callable symbols will be those functions exported using a cgo //export comment. Non-main packages are ignored. -buildmode=default Listed main packages are built into executables and listed non-main packages are built into .a files (the default behavior). -buildmode=shared Combine all the listed non-main packages into a single shared library that will be used when building with the -linkshared option. Packages named main are ignored. -buildmode=exe Build the listed main packages and everything they import into executables. Packages not named main are ignored. -buildmode=pie Build the listed main packages and everything they import into position independent executables (PIE). Packages not named main are ignored. -buildmode=plugin Build the listed main packages, plus all packages that they import, into a Go plugin. Packages not named main are ignored. </pre> <h3 id="hdr-File_types">File types</h3> <p> The go command examines the contents of a restricted set of files in each directory. It identifies which files to examine based on the extension of the file name. These extensions are: </p> <pre>.go Go source files. .c, .h C source files. If the package uses cgo or SWIG, these will be compiled with the OS-native compiler (typically gcc); otherwise they will trigger an error. .cc, .cpp, .cxx, .hh, .hpp, .hxx C++ source files. Only useful with cgo or SWIG, and always compiled with the OS-native compiler. .m Objective-C source files. Only useful with cgo, and always compiled with the OS-native compiler. .s, .S Assembler source files. If the package uses cgo or SWIG, these will be assembled with the OS-native assembler (typically gcc (sic)); otherwise they will be assembled with the Go assembler. .swig, .swigcxx SWIG definition files. .syso System object files. </pre> <p> Files of each of these types except .syso may contain build constraints, but the go command stops scanning for build constraints at the first item in the file that is not a blank line or //-style line comment. See the go/build package documentation for more details. </p> <p> Non-test Go source files can also include a //go:binary-only-package comment, indicating that the package sources are included for documentation only and must not be used to build the package binary. This enables distribution of Go packages in their compiled form alone. See the go/build package documentation for more details. </p> <h3 id="hdr-GOPATH_environment_variable">GOPATH environment variable</h3> <p> The Go path is used to resolve import statements. It is implemented by and documented in the go/build package. </p> <p> The GOPATH environment variable lists places to look for Go code. On Unix, the value is a colon-separated string. On Windows, the value is a semicolon-separated string. On Plan 9, the value is a list. </p> <p> If the environment variable is unset, GOPATH defaults to a subdirectory named &#34;go&#34; in the user&#39;s home directory ($HOME/go on Unix, %USERPROFILE%\go on Windows), unless that directory holds a Go distribution. Run &#34;go env GOPATH&#34; to see the current GOPATH. </p> <p> See <a href="https://golang.org/wiki/SettingGOPATH">https://golang.org/wiki/SettingGOPATH</a> to set a custom GOPATH. </p> <p> Each directory listed in GOPATH must have a prescribed structure: </p> <p> The src directory holds source code. The path below src determines the import path or executable name. </p> <p> The pkg directory holds installed package objects. As in the Go tree, each target operating system and architecture pair has its own subdirectory of pkg (pkg/GOOS_GOARCH). </p> <p> If DIR is a directory listed in the GOPATH, a package with source in DIR/src/foo/bar can be imported as &#34;foo/bar&#34; and has its compiled form installed to &#34;DIR/pkg/GOOS_GOARCH/foo/bar.a&#34;. </p> <p> The bin directory holds compiled commands. Each command is named for its source directory, but only the final element, not the entire path. That is, the command with source in DIR/src/foo/quux is installed into DIR/bin/quux, not DIR/bin/foo/quux. The &#34;foo/&#34; prefix is stripped so that you can add DIR/bin to your PATH to get at the installed commands. If the GOBIN environment variable is set, commands are installed to the directory it names instead of DIR/bin. GOBIN must be an absolute path. </p> <p> Here&#39;s an example directory layout: </p> <pre>GOPATH=/home/user/go /home/user/go/ src/ foo/ bar/ (go code in package bar) x.go quux/ (go code in package main) y.go bin/ quux (installed command) pkg/ linux_amd64/ foo/ bar.a (installed package object) </pre> <p> Go searches each directory listed in GOPATH to find source code, but new packages are always downloaded into the first directory in the list. </p> <p> See <a href="https://golang.org/doc/code.html">https://golang.org/doc/code.html</a> for an example. </p> <h3 id="hdr-Internal_Directories">Internal Directories</h3> <p> Code in or below a directory named &#34;internal&#34; is importable only by code in the directory tree rooted at the parent of &#34;internal&#34;. Here&#39;s an extended version of the directory layout above: </p> <pre>/home/user/go/ src/ crash/ bang/ (go code in package bang) b.go foo/ (go code in package foo) f.go bar/ (go code in package bar) x.go internal/ baz/ (go code in package baz) z.go quux/ (go code in package main) y.go </pre> <p> The code in z.go is imported as &#34;foo/internal/baz&#34;, but that import statement can only appear in source files in the subtree rooted at foo. The source files foo/f.go, foo/bar/x.go, and foo/quux/y.go can all import &#34;foo/internal/baz&#34;, but the source file crash/bang/b.go cannot. </p> <p> See <a href="https://golang.org/s/go14internal">https://golang.org/s/go14internal</a> for details. </p> <h3 id="hdr-Vendor_Directories">Vendor Directories</h3> <p> Go 1.6 includes support for using local copies of external dependencies to satisfy imports of those dependencies, often referred to as vendoring. </p> <p> Code below a directory named &#34;vendor&#34; is importable only by code in the directory tree rooted at the parent of &#34;vendor&#34;, and only using an import path that omits the prefix up to and including the vendor element. </p> <p> Here&#39;s the example from the previous section, but with the &#34;internal&#34; directory renamed to &#34;vendor&#34; and a new foo/vendor/crash/bang directory added: </p> <pre>/home/user/go/ src/ crash/ bang/ (go code in package bang) b.go foo/ (go code in package foo) f.go bar/ (go code in package bar) x.go vendor/ crash/ bang/ (go code in package bang) b.go baz/ (go code in package baz) z.go quux/ (go code in package main) y.go </pre> <p> The same visibility rules apply as for internal, but the code in z.go is imported as &#34;baz&#34;, not as &#34;foo/vendor/baz&#34;. </p> <p> Code in vendor directories deeper in the source tree shadows code in higher directories. Within the subtree rooted at foo, an import of &#34;crash/bang&#34; resolves to &#34;foo/vendor/crash/bang&#34;, not the top-level &#34;crash/bang&#34;. </p> <p> Code in vendor directories is not subject to import path checking (see &#39;go help importpath&#39;). </p> <p> When &#39;go get&#39; checks out or updates a git repository, it now also updates submodules. </p> <p> Vendor directories do not affect the placement of new repositories being checked out for the first time by &#39;go get&#39;: those are always placed in the main GOPATH, never in a vendor subtree. </p> <p> See <a href="https://golang.org/s/go15vendor">https://golang.org/s/go15vendor</a> for details. </p> <h3 id="hdr-Environment_variables">Environment variables</h3> <p> The go command, and the tools it invokes, examine a few different environment variables. For many of these, you can see the default value of on your system by running &#39;go env NAME&#39;, where NAME is the name of the variable. </p> <p> General-purpose environment variables: </p> <pre>GCCGO The gccgo command to run for &#39;go build -compiler=gccgo&#39;. GOARCH The architecture, or processor, for which to compile code. Examples are amd64, 386, arm, ppc64. GOBIN The directory where &#39;go install&#39; will install a command. GOOS The operating system for which to compile code. Examples are linux, darwin, windows, netbsd. GOPATH For more details see: &#39;go help gopath&#39;. GORACE Options for the race detector. See <a href="https://golang.org/doc/articles/race_detector.html">https://golang.org/doc/articles/race_detector.html</a>. GOROOT The root of the go tree. </pre> <p> Environment variables for use with cgo: </p> <pre>CC The command to use to compile C code. CGO_ENABLED Whether the cgo command is supported. Either 0 or 1. CGO_CFLAGS Flags that cgo will pass to the compiler when compiling C code. CGO_CPPFLAGS Flags that cgo will pass to the compiler when compiling C or C++ code. CGO_CXXFLAGS Flags that cgo will pass to the compiler when compiling C++ code. CGO_FFLAGS Flags that cgo will pass to the compiler when compiling Fortran code. CGO_LDFLAGS Flags that cgo will pass to the compiler when linking. CXX The command to use to compile C++ code. PKG_CONFIG Path to pkg-config tool. </pre> <p> Architecture-specific environment variables: </p> <pre>GOARM For GOARCH=arm, the ARM architecture for which to compile. Valid values are 5, 6, 7. GO386 For GOARCH=386, the floating point instruction set. Valid values are 387, sse2. </pre> <p> Special-purpose environment variables: </p> <pre>GOROOT_FINAL The root of the installed Go tree, when it is installed in a location other than where it is built. File names in stack traces are rewritten from GOROOT to GOROOT_FINAL. GO_EXTLINK_ENABLED Whether the linker should use external linking mode when using -linkmode=auto with code that uses cgo. Set to 0 to disable external linking mode, 1 to enable it. GIT_ALLOW_PROTOCOL Defined by Git. A colon-separated list of schemes that are allowed to be used with git fetch/clone. If set, any scheme not explicitly mentioned will be considered insecure by &#39;go get&#39;. </pre> <h3 id="hdr-Import_path_syntax">Import path syntax</h3> <p> An import path (see &#39;go help packages&#39;) denotes a package stored in the local file system. In general, an import path denotes either a standard package (such as &#34;unicode/utf8&#34;) or a package found in one of the work spaces (For more details see: &#39;go help gopath&#39;). </p> <h3 id="hdr-Relative_import_paths">Relative import paths</h3> <p> An import path beginning with ./ or ../ is called a relative path. The toolchain supports relative import paths as a shortcut in two ways. </p> <p> First, a relative path can be used as a shorthand on the command line. If you are working in the directory containing the code imported as &#34;unicode&#34; and want to run the tests for &#34;unicode/utf8&#34;, you can type &#34;go test ./utf8&#34; instead of needing to specify the full path. Similarly, in the reverse situation, &#34;go test ..&#34; will test &#34;unicode&#34; from the &#34;unicode/utf8&#34; directory. Relative patterns are also allowed, like &#34;go test ./...&#34; to test all subdirectories. See &#39;go help packages&#39; for details on the pattern syntax. </p> <p> Second, if you are compiling a Go program not in a work space, you can use a relative path in an import statement in that program to refer to nearby code also not in a work space. This makes it easy to experiment with small multipackage programs outside of the usual work spaces, but such programs cannot be installed with &#34;go install&#34; (there is no work space in which to install them), so they are rebuilt from scratch each time they are built. To avoid ambiguity, Go programs cannot use relative import paths within a work space. </p> <h3 id="hdr-Remote_import_paths">Remote import paths</h3> <p> Certain import paths also describe how to obtain the source code for the package using a revision control system. </p> <p> A few common code hosting sites have special syntax: </p> <pre>Bitbucket (Git, Mercurial) import &#34;bitbucket.org/user/project&#34; import &#34;bitbucket.org/user/project/sub/directory&#34; GitHub (Git) import &#34;github.com/user/project&#34; import &#34;github.com/user/project/sub/directory&#34; Launchpad (Bazaar) import &#34;launchpad.net/project&#34; import &#34;launchpad.net/project/series&#34; import &#34;launchpad.net/project/series/sub/directory&#34; import &#34;launchpad.net/~user/project/branch&#34; import &#34;launchpad.net/~user/project/branch/sub/directory&#34; IBM DevOps Services (Git) import &#34;hub.jazz.net/git/user/project&#34; import &#34;hub.jazz.net/git/user/project/sub/directory&#34; </pre> <p> For code hosted on other servers, import paths may either be qualified with the version control type, or the go tool can dynamically fetch the import path over https/http and discover where the code resides from a &lt;meta&gt; tag in the HTML. </p> <p> To declare the code location, an import path of the form </p> <pre>repository.vcs/path </pre> <p> specifies the given repository, with or without the .vcs suffix, using the named version control system, and then the path inside that repository. The supported version control systems are: </p> <pre>Bazaar .bzr Git .git Mercurial .hg Subversion .svn </pre> <p> For example, </p> <pre>import &#34;example.org/user/foo.hg&#34; </pre> <p> denotes the root directory of the Mercurial repository at example.org/user/foo or foo.hg, and </p> <pre>import &#34;example.org/repo.git/foo/bar&#34; </pre> <p> denotes the foo/bar directory of the Git repository at example.org/repo or repo.git. </p> <p> When a version control system supports multiple protocols, each is tried in turn when downloading. For example, a Git download tries https://, then git+ssh://. </p> <p> By default, downloads are restricted to known secure protocols (e.g. https, ssh). To override this setting for Git downloads, the GIT_ALLOW_PROTOCOL environment variable can be set (For more details see: &#39;go help environment&#39;). </p> <p> If the import path is not a known code hosting site and also lacks a version control qualifier, the go tool attempts to fetch the import over https/http and looks for a &lt;meta&gt; tag in the document&#39;s HTML &lt;head&gt;. </p> <p> The meta tag has the form: </p> <pre>&lt;meta name=&#34;go-import&#34; content=&#34;import-prefix vcs repo-root&#34;&gt; </pre> <p> The import-prefix is the import path corresponding to the repository root. It must be a prefix or an exact match of the package being fetched with &#34;go get&#34;. If it&#39;s not an exact match, another http request is made at the prefix to verify the &lt;meta&gt; tags match. </p> <p> The meta tag should appear as early in the file as possible. In particular, it should appear before any raw JavaScript or CSS, to avoid confusing the go command&#39;s restricted parser. </p> <p> The vcs is one of &#34;git&#34;, &#34;hg&#34;, &#34;svn&#34;, etc, </p> <p> The repo-root is the root of the version control system containing a scheme and not containing a .vcs qualifier. </p> <p> For example, </p> <pre>import &#34;example.org/pkg/foo&#34; </pre> <p> will result in the following requests: </p> <pre><a href="https://example.org/pkg/foo?go-get=1">https://example.org/pkg/foo?go-get=1</a> (preferred) <a href="http://example.org/pkg/foo?go-get=1">http://example.org/pkg/foo?go-get=1</a> (fallback, only with -insecure) </pre> <p> If that page contains the meta tag </p> <pre>&lt;meta name=&#34;go-import&#34; content=&#34;example.org git <a href="https://code.org/r/p/exproj">https://code.org/r/p/exproj</a>&#34;&gt; </pre> <p> the go tool will verify that <a href="https://example.org/?go-get=1">https://example.org/?go-get=1</a> contains the same meta tag and then git clone <a href="https://code.org/r/p/exproj">https://code.org/r/p/exproj</a> into GOPATH/src/example.org. </p> <p> New downloaded packages are written to the first directory listed in the GOPATH environment variable (For more details see: &#39;go help gopath&#39;). </p> <p> The go command attempts to download the version of the package appropriate for the Go release being used. Run &#39;go help get&#39; for more. </p> <h3 id="hdr-Import_path_checking">Import path checking</h3> <p> When the custom import path feature described above redirects to a known code hosting site, each of the resulting packages has two possible import paths, using the custom domain or the known hosting site. </p> <p> A package statement is said to have an &#34;import comment&#34; if it is immediately followed (before the next newline) by a comment of one of these two forms: </p> <pre>package math // import &#34;path&#34; package math /* import &#34;path&#34; */ </pre> <p> The go command will refuse to install a package with an import comment unless it is being referred to by that import path. In this way, import comments let package authors make sure the custom import path is used and not a direct path to the underlying code hosting site. </p> <p> Import path checking is disabled for code found within vendor trees. This makes it possible to copy code into alternate locations in vendor trees without needing to update import comments. </p> <p> See <a href="https://golang.org/s/go14customimport">https://golang.org/s/go14customimport</a> for details. </p> <h3 id="hdr-Description_of_package_lists">Description of package lists</h3> <p> Many commands apply to a set of packages: </p> <pre>go action [packages] </pre> <p> Usually, [packages] is a list of import paths. </p> <p> An import path that is a rooted path or that begins with a . or .. element is interpreted as a file system path and denotes the package in that directory. </p> <p> Otherwise, the import path P denotes the package found in the directory DIR/src/P for some DIR listed in the GOPATH environment variable (For more details see: &#39;go help gopath&#39;). </p> <p> If no import paths are given, the action applies to the package in the current directory. </p> <p> There are four reserved names for paths that should not be used for packages to be built with the go tool: </p> <p> - &#34;main&#34; denotes the top-level package in a stand-alone executable. </p> <p> - &#34;all&#34; expands to all package directories found in all the GOPATH trees. For example, &#39;go list all&#39; lists all the packages on the local system. </p> <p> - &#34;std&#34; is like all but expands to just the packages in the standard Go library. </p> <p> - &#34;cmd&#34; expands to the Go repository&#39;s commands and their internal libraries. </p> <p> Import paths beginning with &#34;cmd/&#34; only match source code in the Go repository. </p> <p> An import path is a pattern if it includes one or more &#34;...&#34; wildcards, each of which can match any string, including the empty string and strings containing slashes. Such a pattern expands to all package directories found in the GOPATH trees with names matching the patterns. As a special case, x/... matches x as well as x&#39;s subdirectories. For example, net/... expands to net and packages in its subdirectories. </p> <p> An import path can also name a package to be downloaded from a remote repository. Run &#39;go help importpath&#39; for details. </p> <p> Every package in a program must have a unique import path. By convention, this is arranged by starting each path with a unique prefix that belongs to you. For example, paths used internally at Google all begin with &#39;google&#39;, and paths denoting remote repositories begin with the path to the code, such as &#39;github.com/user/repo&#39;. </p> <p> Packages in a program need not have unique package names, but there are two reserved package names with special meaning. The name main indicates a command, not a library. Commands are built into binaries and cannot be imported. The name documentation indicates documentation for a non-Go program in the directory. Files in package documentation are ignored by the go command. </p> <p> As a special case, if the package list is a list of .go files from a single directory, the command is applied to a single synthesized package made up of exactly those files, ignoring any build constraints in those files and ignoring any other files in the directory. </p> <p> Directory and file names that begin with &#34;.&#34; or &#34;_&#34; are ignored by the go tool, as are directories named &#34;testdata&#34;. </p> <h3 id="hdr-Description_of_testing_flags">Description of testing flags</h3> <p> The &#39;go test&#39; command takes both flags that apply to &#39;go test&#39; itself and flags that apply to the resulting test binary. </p> <p> Several of the flags control profiling and write an execution profile suitable for &#34;go tool pprof&#34;; run &#34;go tool pprof -h&#34; for more information. The --alloc_space, --alloc_objects, and --show_bytes options of pprof control how the information is presented. </p> <p> The following flags are recognized by the &#39;go test&#39; command and control the execution of any test: </p> <pre>-bench regexp Run (sub)benchmarks matching a regular expression. The given regular expression is split into smaller ones by top-level &#39;/&#39;, where each must match the corresponding part of a benchmark&#39;s identifier. By default, no benchmarks run. To run all benchmarks, use &#39;-bench .&#39; or &#39;-bench=.&#39;. -benchtime t Run enough iterations of each benchmark to take t, specified as a time.Duration (for example, -benchtime 1h30s). The default is 1 second (1s). -count n Run each test and benchmark n times (default 1). If -cpu is set, run n times for each GOMAXPROCS value. Examples are always run once. -cover Enable coverage analysis. -covermode set,count,atomic Set the mode for coverage analysis for the package[s] being tested. The default is &#34;set&#34; unless -race is enabled, in which case it is &#34;atomic&#34;. The values: set: bool: does this statement run? count: int: how many times does this statement run? atomic: int: count, but correct in multithreaded tests; significantly more expensive. Sets -cover. -coverpkg pkg1,pkg2,pkg3 Apply coverage analysis in each test to the given list of packages. The default is for each test to analyze only the package being tested. Packages are specified as import paths. Sets -cover. -cpu 1,2,4 Specify a list of GOMAXPROCS values for which the tests or benchmarks should be executed. The default is the current value of GOMAXPROCS. -parallel n Allow parallel execution of test functions that call t.Parallel. The value of this flag is the maximum number of tests to run simultaneously; by default, it is set to the value of GOMAXPROCS. Note that -parallel only applies within a single test binary. The &#39;go test&#39; command may run tests for different packages in parallel as well, according to the setting of the -p flag (see &#39;go help build&#39;). -run regexp Run only those tests and examples matching the regular expression. For tests the regular expression is split into smaller ones by top-level &#39;/&#39;, where each must match the corresponding part of a test&#39;s identifier. -short Tell long-running tests to shorten their run time. It is off by default but set during all.bash so that installing the Go tree can run a sanity check but not spend time running exhaustive tests. -timeout t If a test runs longer than t, panic. The default is 10 minutes (10m). -v Verbose output: log all tests as they are run. Also print all text from Log and Logf calls even if the test succeeds. </pre> <p> The following flags are also recognized by &#39;go test&#39; and can be used to profile the tests during execution: </p> <pre>-benchmem Print memory allocation statistics for benchmarks. -blockprofile block.out Write a goroutine blocking profile to the specified file when all tests are complete. Writes test binary as -c would. -blockprofilerate n Control the detail provided in goroutine blocking profiles by calling runtime.SetBlockProfileRate with n. See &#39;go doc runtime.SetBlockProfileRate&#39;. The profiler aims to sample, on average, one blocking event every n nanoseconds the program spends blocked. By default, if -test.blockprofile is set without this flag, all blocking events are recorded, equivalent to -test.blockprofilerate=1. -coverprofile cover.out Write a coverage profile to the file after all tests have passed. Sets -cover. -cpuprofile cpu.out Write a CPU profile to the specified file before exiting. Writes test binary as -c would. -memprofile mem.out Write a memory profile to the file after all tests have passed. Writes test binary as -c would. -memprofilerate n Enable more precise (and expensive) memory profiles by setting runtime.MemProfileRate. See &#39;go doc runtime.MemProfileRate&#39;. To profile all memory allocations, use -test.memprofilerate=1 and pass --alloc_space flag to the pprof tool. -mutexprofile mutex.out Write a mutex contention profile to the specified file when all tests are complete. Writes test binary as -c would. -mutexprofilefraction n Sample 1 in n stack traces of goroutines holding a contended mutex. -outputdir directory Place output files from profiling in the specified directory, by default the directory in which &#34;go test&#34; is running. -trace trace.out Write an execution trace to the specified file before exiting. </pre> <p> Each of these flags is also recognized with an optional &#39;test.&#39; prefix, as in -test.v. When invoking the generated test binary (the result of &#39;go test -c&#39;) directly, however, the prefix is mandatory. </p> <p> The &#39;go test&#39; command rewrites or removes recognized flags, as appropriate, both before and after the optional package list, before invoking the test binary. </p> <p> For instance, the command </p> <pre>go test -v -myflag testdata -cpuprofile=prof.out -x </pre> <p> will compile the test binary and then run it as </p> <pre>pkg.test -test.v -myflag testdata -test.cpuprofile=prof.out </pre> <p> (The -x flag is removed because it applies only to the go command&#39;s execution, not to the test itself.) </p> <p> The test flags that generate profiles (other than for coverage) also leave the test binary in pkg.test for use when analyzing the profiles. </p> <p> When &#39;go test&#39; runs a test binary, it does so from within the corresponding package&#39;s source code directory. Depending on the test, it may be necessary to do the same when invoking a generated test binary directly. </p> <p> The command-line package list, if present, must appear before any flag not known to the go test command. Continuing the example above, the package list would have to appear before -myflag, but could appear on either side of -v. </p> <p> To keep an argument for a test binary from being interpreted as a known flag or a package name, use -args (see &#39;go help test&#39;) which passes the remainder of the command line through to the test binary uninterpreted and unaltered. </p> <p> For instance, the command </p> <pre>go test -v -args -x -v </pre> <p> will compile the test binary and then run it as </p> <pre>pkg.test -test.v -x -v </pre> <p> Similarly, </p> <pre>go test -args math </pre> <p> will compile the test binary and then run it as </p> <pre>pkg.test math </pre> <p> In the first example, the -x and the second -v are passed through to the test binary unchanged and with no effect on the go command itself. In the second example, the argument math is passed through to the test binary, instead of being interpreted as the package list. </p> <h3 id="hdr-Description_of_testing_functions">Description of testing functions</h3> <p> The &#39;go test&#39; command expects to find test, benchmark, and example functions in the &#34;*_test.go&#34; files corresponding to the package under test. </p> <p> A test function is one named TestXXX (where XXX is any alphanumeric string not starting with a lower case letter) and should have the signature, </p> <pre>func TestXXX(t *testing.T) { ... } </pre> <p> A benchmark function is one named BenchmarkXXX and should have the signature, </p> <pre>func BenchmarkXXX(b *testing.B) { ... } </pre> <p> An example function is similar to a test function but, instead of using *testing.T to report success or failure, prints output to os.Stdout. If the last comment in the function starts with &#34;Output:&#34; then the output is compared exactly against the comment (see examples below). If the last comment begins with &#34;Unordered output:&#34; then the output is compared to the comment, however the order of the lines is ignored. An example with no such comment is compiled but not executed. An example with no text after &#34;Output:&#34; is compiled, executed, and expected to produce no output. </p> <p> Godoc displays the body of ExampleXXX to demonstrate the use of the function, constant, or variable XXX. An example of a method M with receiver type T or *T is named ExampleT_M. There may be multiple examples for a given function, constant, or variable, distinguished by a trailing _xxx, where xxx is a suffix not beginning with an upper case letter. </p> <p> Here is an example of an example: </p> <pre>func ExamplePrintln() { Println(&#34;The output of\nthis example.&#34;) // Output: The output of // this example. } </pre> <p> Here is another example where the ordering of the output is ignored: </p> <pre>func ExamplePerm() { for _, value := range Perm(4) { fmt.Println(value) } // Unordered output: 4 // 2 // 1 // 3 // 0 } </pre> <p> The entire test file is presented as the example when it contains a single example function, at least one other function, type, variable, or constant declaration, and no test or benchmark functions. </p> <p> See the documentation of the testing package for more information. </p> <div id="footer"> Build version go1.8.<br> Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code is licensed under a <a href="/LICENSE">BSD license</a>.<br> <a href="/doc/tos.html">Terms of Service</a> | <a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a> </div> </div><!-- .container --> </div><!-- #page --> <!-- TODO(adonovan): load these from <head> using "defer" attribute? --> <script type="text/javascript" src="/serverpush/static/jquery.min.js?{{.CacheBust}}"></script> <script type="text/javascript" src="/serverpush/static/playground.js?{{.CacheBust}}"></script> <script>var goVersion = "go1.8";</script> <script type="text/javascript" src="/serverpush/static/godocs.js?{{.CacheBust}}"></script> </body> </html> `))
{ "pile_set_name": "Github" }
# `wasm` library For parsing and manipulating WebAssembly binaries, used by Wasabi internally. Core features: - Supports **WebAssembly version 1 (MVP)** and mutable globals, but other than that **no extensions**. - Supports **`name` custom section**; other custom sections are passed through unmodified as bytes but have no "semantic" representation. - Consists of four main parts: * **Low-level AST** data structures (in `src/ast/lowlevel.rs`), that have a 1:1 mapping to the WebAssembly binary spec. * **WasmBinary** trait for decoding (parsing) a binary into the low-level AST and encoding the low-level AST back into a binary. Most of the trait implementations can be mechanically derived from the low-level AST (with a procedural macro in `binary_derive/`), which cuts down maintenance. * **High-level AST** data structures (in `src/ast/highlevel.rs`), that is much more convenient to modify than the low-level AST directly. Also tries to be idiomatic Rust. E.g., types are inlined (and not in a separate section), imported functions/globals do not have to come before non-imported ones, etc.pp. You should always work on the high-level AST if possible. * **Conversion** between low-level and high-level AST and back. - Unfortunately, not a streaming parser, i.e., the AST "owns" all data (in Rust lingo), which means lots of memory allocation.
{ "pile_set_name": "Github" }
import RandomPlanet from './random-planet'; export default RandomPlanet;
{ "pile_set_name": "Github" }
Filter 1: ON PK Fc 31 Hz Gain 3.2 dB Q 1.41 Filter 2: ON PK Fc 62 Hz Gain -1.9 dB Q 1.41 Filter 3: ON PK Fc 125 Hz Gain -3.7 dB Q 1.41 Filter 4: ON PK Fc 250 Hz Gain -4.9 dB Q 1.41 Filter 5: ON PK Fc 500 Hz Gain -2.4 dB Q 1.41 Filter 6: ON PK Fc 1000 Hz Gain 2.0 dB Q 1.41 Filter 7: ON PK Fc 2000 Hz Gain 2.1 dB Q 1.41 Filter 8: ON PK Fc 4000 Hz Gain 3.3 dB Q 1.41 Filter 9: ON PK Fc 8000 Hz Gain 2.6 dB Q 1.41 Filter 10: ON PK Fc 16000 Hz Gain 9.6 dB Q 1.41
{ "pile_set_name": "Github" }
<a href="/static-site-generator.html" class="lgi">Static Site Generators</a> <a href="/pelican.html" class="lgi">Pelican</a> <a href="/lektor.html" class="lgi">Lektor</a> <a href="/deployment.html" class="lgi">Deployment</a> <a href="http://docs.getpelican.com/en/stable/" class="lgi">Official Pelican Docs {% include "blog/external-link.html" %}</a> <a href="https://github.com/fullstackpython/blog-code-examples/tree/master/generating-static-websites-pelican-jinja2-markdown" class="lgi">Code for this post {% include "blog/external-link.html" %}</a>
{ "pile_set_name": "Github" }
#include <ATen/ATen.h> #include <THC/THCAtomics.cuh> #define CUDA_1D_KERNEL_LOOP(i, n) \ for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < n; \ i += blockDim.x * gridDim.x) #define THREADS_PER_BLOCK 1024 inline int GET_BLOCKS(const int N) { int optimal_block_num = (N + THREADS_PER_BLOCK - 1) / THREADS_PER_BLOCK; int max_block_num = 65000; return min(optimal_block_num, max_block_num); } template <typename scalar_t> __global__ void ROIPoolForward(const int nthreads, const scalar_t *bottom_data, const scalar_t *rois, const scalar_t spatial_scale, const int channels, const int height, const int width, const int pooled_h, const int pooled_w, scalar_t *top_data, int *argmax_data) { CUDA_1D_KERNEL_LOOP(index, nthreads) { // (n, c, ph, pw) is an element in the pooled output int pw = index % pooled_w; int ph = (index / pooled_w) % pooled_h; int c = (index / pooled_w / pooled_h) % channels; int n = index / pooled_w / pooled_h / channels; const scalar_t *offset_rois = rois + n * 5; int roi_batch_ind = offset_rois[0]; // calculate the roi region on feature maps scalar_t roi_x1 = offset_rois[1] * spatial_scale; scalar_t roi_y1 = offset_rois[2] * spatial_scale; scalar_t roi_x2 = (offset_rois[3] + 1) * spatial_scale; scalar_t roi_y2 = (offset_rois[4] + 1) * spatial_scale; // force malformed rois to be 1x1 scalar_t roi_w = roi_x2 - roi_x1; scalar_t roi_h = roi_y2 - roi_y1; if (roi_w <= 0 || roi_h <= 0) continue; scalar_t bin_size_w = roi_w / static_cast<scalar_t>(pooled_w); scalar_t bin_size_h = roi_h / static_cast<scalar_t>(pooled_h); // the corresponding bin region int bin_x1 = floor(static_cast<scalar_t>(pw) * bin_size_w + roi_x1); int bin_y1 = floor(static_cast<scalar_t>(ph) * bin_size_h + roi_y1); int bin_x2 = ceil(static_cast<scalar_t>(pw + 1) * bin_size_w + roi_x1); int bin_y2 = ceil(static_cast<scalar_t>(ph + 1) * bin_size_h + roi_y1); // add roi offsets and clip to input boundaries bin_x1 = min(max(bin_x1, 0), width); bin_y1 = min(max(bin_y1, 0), height); bin_x2 = min(max(bin_x2, 0), width); bin_y2 = min(max(bin_y2, 0), height); bool is_empty = (bin_y2 <= bin_y1) || (bin_x2 <= bin_x1); // If nothing is pooled, argmax = -1 causes nothing to be backprop'd int max_idx = -1; bottom_data += (roi_batch_ind * channels + c) * height * width; // Define an empty pooling region to be zero scalar_t max_val = is_empty ? static_cast<scalar_t>(0) : bottom_data[bin_y1 * width + bin_x1] - 1; for (int h = bin_y1; h < bin_y2; ++h) { for (int w = bin_x1; w < bin_x2; ++w) { int offset = h * width + w; if (bottom_data[offset] > max_val) { max_val = bottom_data[offset]; max_idx = offset; } } } top_data[index] = max_val; if (argmax_data != NULL) argmax_data[index] = max_idx; } } int ROIPoolForwardLaucher(const at::Tensor features, const at::Tensor rois, const float spatial_scale, const int channels, const int height, const int width, const int num_rois, const int pooled_h, const int pooled_w, at::Tensor output, at::Tensor argmax) { const int output_size = num_rois * channels * pooled_h * pooled_w; AT_DISPATCH_FLOATING_TYPES_AND_HALF( features.scalar_type(), "ROIPoolLaucherForward", ([&] { const scalar_t *bottom_data = features.data<scalar_t>(); const scalar_t *rois_data = rois.data<scalar_t>(); scalar_t *top_data = output.data<scalar_t>(); int *argmax_data = argmax.data<int>(); ROIPoolForward<scalar_t> <<<GET_BLOCKS(output_size), THREADS_PER_BLOCK>>>( output_size, bottom_data, rois_data, scalar_t(spatial_scale), channels, height, width, pooled_h, pooled_w, top_data, argmax_data); })); THCudaCheck(cudaGetLastError()); return 1; } template <typename scalar_t> __global__ void ROIPoolBackward(const int nthreads, const scalar_t *top_diff, const scalar_t *rois, const int *argmax_data, const scalar_t spatial_scale, const int channels, const int height, const int width, const int pooled_h, const int pooled_w, scalar_t *bottom_diff) { CUDA_1D_KERNEL_LOOP(index, nthreads) { int pw = index % pooled_w; int ph = (index / pooled_w) % pooled_h; int c = (index / pooled_w / pooled_h) % channels; int n = index / pooled_w / pooled_h / channels; int roi_batch_ind = rois[n * 5]; int bottom_index = argmax_data[(n * channels + c) * pooled_h * pooled_w + ph * pooled_w + pw]; atomicAdd(bottom_diff + (roi_batch_ind * channels + c) * height * width + bottom_index, top_diff[index]); } } int ROIPoolBackwardLaucher(const at::Tensor top_grad, const at::Tensor rois, const at::Tensor argmax, const float spatial_scale, const int batch_size, const int channels, const int height, const int width, const int num_rois, const int pooled_h, const int pooled_w, at::Tensor bottom_grad) { const int output_size = num_rois * pooled_h * pooled_w * channels; AT_DISPATCH_FLOATING_TYPES_AND_HALF( top_grad.scalar_type(), "ROIPoolLaucherBackward", ([&] { const scalar_t *top_diff = top_grad.data<scalar_t>(); const scalar_t *rois_data = rois.data<scalar_t>(); const int *argmax_data = argmax.data<int>(); scalar_t *bottom_diff = bottom_grad.data<scalar_t>(); if (sizeof(scalar_t) == sizeof(double)) { fprintf(stderr, "double is not supported\n"); exit(-1); } ROIPoolBackward<scalar_t> <<<GET_BLOCKS(output_size), THREADS_PER_BLOCK>>>( output_size, top_diff, rois_data, argmax_data, scalar_t(spatial_scale), channels, height, width, pooled_h, pooled_w, bottom_diff); })); THCudaCheck(cudaGetLastError()); return 1; }
{ "pile_set_name": "Github" }
#!/bin/bash set -e listFile=shell_test_list.json case $1 in "store") in=$(</dev/stdin) server=$(echo "$in" | jq --raw-output ".ServerURL") serverHash=$(echo "$server" | sha1sum - | awk '{print $1}') username=$(echo "$in" | jq --raw-output ".Username") password=$(echo "$in" | jq --raw-output ".Secret") echo "{ \"Username\": \"${username}\", \"Secret\": \"${password}\" }" > $TEMP/$serverHash # add the server to the list file if [[ ! -f $TEMP/$listFile ]]; then echo "{ \"${server}\": \"${username}\" }" > $TEMP/$listFile else list=$(<$TEMP/$listFile) echo "$list" | jq ". + {\"${server}\": \"${username}\"}" > $TEMP/$listFile fi ;; "get") in=$(</dev/stdin) serverHash=$(echo "$in" | sha1sum - | awk '{print $1}') if [[ ! -f $TEMP/$serverHash ]]; then echo "credentials not found in native keychain" exit 1 fi payload=$(<$TEMP/$serverHash) echo "$payload" ;; "erase") in=$(</dev/stdin) serverHash=$(echo "$in" | sha1sum - | awk '{print $1}') rm -f $TEMP/$serverHash # Remove the server from the list list=$(<$TEMP/$listFile) echo "$list" | jq "del(.\"${in}\")" > $TEMP/$listFile ;; "list") if [[ ! -f $TEMP/$listFile ]]; then echo "{}" else payload=$(<$TEMP/$listFile) echo "$payload" fi ;; *) echo "unknown credential option" exit 1 ;; esac
{ "pile_set_name": "Github" }
//********************************************************************************** //LibEncryptMsg Copyright 2018 Evgeny Pokhilko //<https://evpo.net/libencryptmsg> // //LibEncryptMsg is released under the Simplified BSD License (see license.txt) //********************************************************************************** #include "state_handlers.h" #include <algorithm> #include "plog/Log.h" #include "session_state.h" #include "emsg_constants.h" using namespace std; using namespace EncryptMsg; using namespace LightStateMachine; namespace { inline Context &ToContext(StateMachineContext &ctx) { StateMachineContext *p = &ctx; return *(static_cast<Context*>(p)); } bool EvaluateResult(Context &context) { auto &state = context.State(); switch(state.emsg_result) { case EmsgResult::Success: case EmsgResult::Pending: break; default: context.SetFailed(true); return false; } return true; } } namespace EncryptMsg { bool InitCanEnter(StateMachineContext &ctx) { Context &context = ToContext(ctx); return !context.State().buffer_stack.empty() || context.State().finish_packets; } void InitOnEnter(StateMachineContext &ctx) { Context &context = ToContext(ctx); auto &state = context.State(); state.packet_chain_it = state.packet_chain.begin(); } bool HeaderCanEnter(StateMachineContext &ctx) { Context &context = ToContext(ctx); if(context.State().buffer_stack.empty() || context.State().buffer_stack.top().empty()) return false; if(context.State().packet_chain_it != context.State().packet_chain.end() && *context.State().packet_chain_it != PacketType::Unknown) return false; return true; } bool HeaderCanExit(StateMachineContext &ctx) { Context &context = ToContext(ctx); auto &state = context.State(); switch(state.emsg_result) { case EmsgResult::Success: case EmsgResult::Pending: return true; default: return false; } } void HeaderOnEnter(StateMachineContext &ctx) { Context &context = ToContext(ctx); auto &state = context.State(); auto &reader = state.packet_factory.GetHeaderReader(); reader.GetInStream().Push(state.buffer_stack.top()); state.buffer_stack.pop(); state.emsg_result = reader.Read(state.finish_packets); switch(state.emsg_result) { case EmsgResult::Success: { if(reader.GetInStream().GetCount() > 0) { state.buffer_stack.emplace(); AppendToBuffer(reader.GetInStream(), state.buffer_stack.top()); } *state.packet_chain_it = reader.GetPacketHeader().packet_type; LOG_DEBUG << "Header: " << GetPacketSpec(reader.GetPacketHeader().packet_type).packet_name; } break; case EmsgResult::Pending: break; default: context.SetFailed(true); break; } } bool ArmorCanEnter(LightStateMachine::StateMachineContext &ctx) { auto &state = ToContext(ctx).State(); return (!state.buffer_stack.empty() || state.finish_packets); } void ArmorOnEnter(LightStateMachine::StateMachineContext &ctx) { Context &context = ToContext(ctx); auto &state = context.State(); if(state.armor_reader.GetStatus() == ArmorStatus::Disabled) return; auto &reader = state.armor_reader; auto &buffer_stack = state.buffer_stack; SafeVector output; auto out_stm = EncryptMsg::MakeOutStream(output); // it can be empty when finishing if(!buffer_stack.empty()) { reader.GetInStream().Push(buffer_stack.top()); buffer_stack.pop(); } if(state.finish_packets) { state.emsg_result = reader.Finish(*out_stm); } else { state.emsg_result = reader.Read(*out_stm); } if(!EvaluateResult(context)) return; switch(reader.GetStatus()) { case ArmorStatus::Disabled: state.message_config.SetArmor(false); buffer_stack.emplace(); AppendToBuffer(reader.GetInStream(), buffer_stack.top()); break; case ArmorStatus::Enabled: state.message_config.SetArmor(true); break; default: break; } if(!output.empty()) { buffer_stack.push(move(output)); } } bool PacketCanExit(StateMachineContext &ctx) { Context &context = ToContext(ctx); auto result = context.State().emsg_result; switch(result) { case EmsgResult::Success: case EmsgResult::Pending: return true; default: return false; } } bool PacketCanEnter(StateMachineContext &ctx) { Context &context = ToContext(ctx); if(context.State().buffer_stack.empty() && !context.State().finish_packets) return false; if(context.State().packet_chain_it == context.State().packet_chain.end() || *context.State().packet_chain_it == PacketType::Unknown) return false; return true; } void PacketOnEnter(StateMachineContext &ctx) { Context &context = ToContext(ctx); auto &state = context.State(); auto packet_chain_it = state.packet_chain_it; LOG_DEBUG << "Packet: " << GetPacketSpec(*packet_chain_it).packet_name; auto packet_pair = state.packet_factory.GetOrCreatePacket(*packet_chain_it); assert(packet_pair.first); auto &packet = *packet_pair.first; if(packet_pair.second) { // new packet auto &packet_header = state.packet_factory.GetHeaderReader().GetPacketHeader(); assert(packet_header.packet_type == *packet_chain_it); size_t body_length = packet_header.body_length; if(packet_header.is_partial_length && !packet_header.is_new_format) { body_length = kMaxStreamLength; } else if(packet_header.is_partial_length && packet_header.is_new_format) { packet.GetInStream().SetPartialLength(true, body_length); } } auto &buffer_stack = state.buffer_stack; Botan::secure_vector<uint8_t> output; auto out_stm = EncryptMsg::MakeOutStream(output); // it can be empty when finishing if(!buffer_stack.empty()) { LOG_DEBUG << "Push bytes to packet: " << buffer_stack.top().size(); packet.GetInStream().Push(buffer_stack.top()); buffer_stack.pop(); } state.emsg_result = packet.Read(*out_stm); switch(state.emsg_result) { case EmsgResult::Success: *state.packet_chain_it = PacketType::Unknown; if(packet.GetInStream().GetCount() > 0) { LOG_DEBUG << "Unused bytes returned: " << packet.GetInStream().GetCount(); buffer_stack.emplace(); AppendToBuffer(packet.GetInStream(), buffer_stack.top()); } break; case EmsgResult::Pending: LOG_DEBUG << "Return Pending"; break; default: context.SetFailed(true); return; } if(packet.IsFinalPacket() && !output.empty()) { state.output.insert(state.output.end(), output.begin(), output.end()); } else if(!output.empty()) { buffer_stack.push(move(output)); // if finishing, we need to enter finish packet state before moving to the next packet if(!state.finish_packets) state.packet_chain_it++; assert(state.packet_chain.end() != state.packet_chain_it); } else if (state.emsg_result == EmsgResult::Success) { auto it = state.packet_chain.begin(); for(;it != state.packet_chain.end() && *it != PacketType::Unknown; it++) { } state.packet_chain_it = it; } } bool FinishCanEnter(StateMachineContext &ctx) { Context &context = ToContext(ctx); if(*context.State().packet_chain_it == PacketType::Unknown) return false; return context.State().finish_packets; } bool FinishCanExit(StateMachineContext &ctx) { Context &context = ToContext(ctx); return context.State().emsg_result == EmsgResult::Success; } void FinishOnEnter(StateMachineContext &ctx) { Context &context = ToContext(ctx); auto &state = context.State(); auto packet_pair = state.packet_factory.GetOrCreatePacket(*state.packet_chain_it); assert(packet_pair.first); assert(!packet_pair.second); LOG_DEBUG << "Finish packet: " << GetPacketSpec(*state.packet_chain_it).packet_name; state.emsg_result = packet_pair.first->Finish(); if(state.emsg_result != EmsgResult::Success) { context.SetFailed(true); return; } *state.packet_chain_it = PacketType::Unknown; state.packet_chain_it ++; } bool BufferEmptyCanEnter(StateMachineContext &ctx) { Context &context = ToContext(ctx); return context.State().buffer_stack.empty() || !context.State().finish_packets; } void BufferEmptyOnEnter(StateMachineContext &ctx) { Context &context = ToContext(ctx); auto &packet_chain = context.State().packet_chain; context.State().packet_chain_it = *packet_chain.begin() == PacketType::Unknown ? packet_chain.end() : packet_chain.begin(); if(!context.State().buffer_stack.empty()) context.State().buffer_stack.pop(); } bool EndCanEnter(StateMachineContext &ctx) { Context &context = ToContext(ctx); auto &state = context.State(); if(state.finish_packets && !std::all_of(state.packet_chain.begin(), state.packet_chain.end(), [](PacketType packet_type) { return packet_type == PacketType::Unknown; })) { return false; } return state.buffer_stack.empty(); } }
{ "pile_set_name": "Github" }
{% extends "_layouts/base.html" %} {% set id = 'pricing-compare' %} {% set title = 'Ionic Platform Pricing - Cross-Platform Web App Development Tools' %} {% set header_style = 'transparent light' %} {% set bodyController = 'pricingCtrl' %} {% set meta_description = "Get pricing on the Ionic Development Platform. From DevOps to our app building solutions and our enterprise mobile app framework." %} {% set cssPath = 'pricing/compare' %} {% set pre_footer = false %} {% block main %} {% include './__sub-header.html' %} <div class="modal collapse fade" id="scalePlanForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-body hubspot-override"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> <hgroup class="hero text-center"> <h3>Contact us</h3> <p class="lg"> Send us a detailed message and an Ionic Sales Representative will get back to you soon. </p> </hgroup> <!--[if lte IE 8]> <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script> <![endif]--> <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script> <script> hbspt.forms.create({ portalId: "3776657", formId: "a6d856c5-39f4-4725-a78f-c356d8d64ac5", css: "" }); </script> </div> </div> </div> </div> <div class="cta cta--transparent"> <div class="container"> <hgroup> <h1>Pricing plans</h1> <p>Cloud app management to continuously build, connect, and ship award-winning cross-platform apps—all from a centralized dashboard.</p> </hgroup> </div> </div> <main> <div class="container"> <div class="toggle" id="pricing-toggle"> <span>Monthly</span> <span class="active">Yearly (15% off)</span> </div> <div id="plans" class="plans annually-active"> <div id="plan-hobby" class="plan__card"> <h3>Hobby</h3> <span class="plan__price"> <strong>Free</strong> </span> <div class="plan__description">An easy way to start building with Ionic</div> <div class="plan__feature__divider"></div> <ul class="plan__feature__list"> <li>Manage app projects in the Ionic <strong>cloud dashboard</strong></li> <li>Access and post questions on Ionic <strong>Forum</strong></li> <li>Deploy <strong>100 live updates / mo</strong></li> <li>Community support</li> </ul> <a class="plan__cta btn sm light" href="/start">Start Free</a> </div> <div id="plan-starter" class="plan__card plan__card--featured"> <div class="plan__note">Best all-in-one package value</div> <h3>Launch</h3> <span class="plan__price"> <span class="plan__price__monthly"> <sup>$</sup><strong>49</strong><small>/mo</small> </span> <span class="plan__price__annually"> <sup>$</sup><strong>42</strong><small>/mo</small> </span> </span> <div class="plan__description">Recommended for indie and freelance developers</div> <div class="plan__feature__divider"></div> <ul class="plan__feature__list"> <li class="plan__feature__highlight">All Hobby plan features, plus:</li> <li><strong>Publish directly to app stores</strong> from your cloud dashboard</li> <li>Deploy <strong>10K live updates</strong> / mo</li> <li>Compile <strong>native app binaries</strong></li> <li>1 concurrency</li> <li>Email support</li> </ul> <a class="plan__cta btn sm" href="/signup?plan=developer&source=framework-{{id}}">Get started</a> </div> <div id="plan-growth" class="plan__card"> <h3>Growth</h3> <span class="plan__price"> <span class="plan__price__monthly"> <sup>$</sup><strong>120</strong><small>/mo</small> </span> <span class="plan__price__annually"> <sup>$</sup><strong>102</strong><small>/mo</small> </span> </span> <div class="plan__description">For lean dev teams and professional developers</div> <div class="plan__feature__divider"></div> <ul class="plan__feature__list"> <li class="plan__feature__highlight">All <strong>Launch</strong> plan features, plus:</li> <li><strong>Collaborate</strong> with team members and clients</li> <li><strong>CI/CD automation</strong> to ship continuously with mobile</li> <li>Deploy <strong>25K live updates</strong> / mo</li> <li>2+ <strong>concurrent builds</strong></li> <li>Email support</li> </ul> <a class="plan__cta btn sm" href="/signup?plan=teams&source=framework-{{id}}">Get started</a> </div> <div id="plan-scale" class="plan__card plan__card--dark"> <h3>Scale</h3> <span class="plan__price"> <strong>Custom</strong> </span> <div class="plan__description">Tailored to businesses building mission-critical apps</div> <div class="plan__feature__divider"></div> <ul class="plan__feature__list"> <li class="plan__feature__highlight">All <strong>Growth</strong> plan features, plus:</li> <li>Scale to millions of users with <strong>custom Deploy limits</strong></li> <li>iOS <strong>Enterprise builds</strong></li> <li>Custom <strong>concurrent builds</strong></li> <li><strong>Role-Based</strong> access control</li> <li><strong>SAML Single sign-on</strong></li> <li><strong>Live onboarding</strong> &amp; premium Appflow product support</li> </ul> <a class="plan__cta btn sm navy" href="#" data-toggle="modal" data-target="#scalePlanForm">Contact Us</a> </div> </div> <a class="anchor-cta anchor" href="#features"> See full feature comparison <svg width="7" height="12" viewBox="0 0 7 12" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M1 1L6 6L1 11" stroke="#639CFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> </svg> </a> </div> <div class="logos"> <div class="container"> <h3>Empowering Teams at innovative companies.</h3> <div class="icons"> <div class="logo--national"></div> <div class="logo--verizon"></div> <div class="logo--comcast"></div> <div class="logo--panera"></div> <div class="logo--mastercard"></div> <div class="logo--usaa"></div> <div class="logo--amtrak"></div> <div class="logo--ge"></div> </div> </div> </div> <div class="container container-wide comparison"> <h2>Pick the plan that works best for you.</h2> <div id="features" class="box"> <div class="table-wrap"> <table> <thead> <tr> <td> <h3>Features</h3> </td> <th> <div class="plan-wrap"> <h4>Hobby</h4> <div class="price"><strong>Free</strong</div> <a href="/start" class="btn micro" id="btn-pricing-hobby">Get started</a> </div> </th> <th> <div class="plan-wrap"> <h4>Launch</h4> <div class="price"><strong>$49</strong>/mo</div> <a href="/signup?plan=developer&source=framework-{{id}}" class="btn micro btn--primary" id="btn-pricing-starter">Get started</a> </div> </th> <th> <div class="plan-wrap"> <h4>Growth</h4> <div class="price" data-toggle="billing-team"><strong>$120</strong>/mo</div> <a href="/signup?plan=teams&source=framework-{{id}}" class="btn micro btn--primary" id="btn-pricing-team">Get started</a> </div> </th> <th> <div class="plan-wrap"> <h4>Scale</h4> <div class="price"><strong>Custom</strong></div> <a href="#" class="btn micro btn--dark" data-toggle="modal" data-target="#scalePlanForm">Contact us</a> </div> </th> </tr> </thead> <tbody> <tr> <th><strong>Ionic Appflow</strong></th> <td><span class="check"></span></td> <td><span class="check"></span></td> <td><span class="check"></span></td> <td><span class="check"></span></td> </tr> <tr> <th>Push to app store</th> <td></td> <td><span class="check"></span></td> <td><span class="check"></span></td> <td><span class="check"></span></td> </tr> <tr> <th> Live app updates <a class="anchor" href="#faq-live-updates"> {% include '../_includes/svg/ico-question.svg' %} </a> </th> <td>100 <small>/ mo</small></td> <td>10,000 <small>/ mo</small></td> <td>25,000 <small>/ mo</small></td> <td>Custom limit</td> </tr> <tr> <th>Native app builds</th> <td></td> <td><span class="check"></span></td> <td><span class="check"></span></td> <td><span class="check"></span></td> </tr> <tr> <th> Concurrency limits <a class="anchor" href="#faq-concurrency"> {% include '../_includes/svg/ico-question.svg' %} </a> </th> <td></td> <td>1</td> <td>2</td> <td>Custom limit</td> </tr> <tr> <th> CI/CD automation {# <a class="anchor" href=""> {% include '../_includes/svg/ico-question.svg' %} </a> #} </th> <td></td> <td></td> <td><span class="check"></span></td> <td><span class="check"></span></td> </tr> <tr> <th><small>Automations</small></th> <td></td> <td></td> <td>4</td> <td>Custom limit</td> </tr> <tr> <th><small>Environments</small></th> <td></td> <td></td> <td>2</td> <td>Custom limit</td> </tr> <tr> <th><small>Configurations</small></th> <td></td> <td></td> <td>2</td> <td>Custom limit</td> </tr> <tr> <th> iOS Enterprise builds <a class="anchor" href="#faq-ios"> {% include '../_includes/svg/ico-question.svg' %} </a> </th> <td></td> <td></td> <td></td> <td><span class="check"></span></td> </tr> <tr> <th> Cloud (SaaS) Git repositories </th> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <th><small>Bitbucket</small></th> <td><span class="check"></span></td> <td><span class="check"></span></td> <td><span class="check"></span></td> <td><span class="check"></span></td> </tr> <tr> <th><small>GitHub</small></th> <td><span class="check"></span></td> <td><span class="check"></span></td> <td><span class="check"></span></td> <td><span class="check"></span></td> </tr> <tr> <th><small>GitLab</small></th> <td><span class="check"></span></td> <td><span class="check"></span></td> <td><span class="check"></span></td> <td><span class="check"></span></td> </tr> <tr> <th> On-Premises Git repositories <a class="anchor" href="#faq-git"> {% include '../_includes/svg/ico-question.svg' %} </a> </th> <td></td> <td></td> <td></td> <td><span class="check"></span></td> </tr> <tr> <th><small>Bitbucket Server</small></th> <td></td> <td></td> <td></td> <td><span class="check"></span></td> </tr> <tr> <th><small>GitLab Self-Managed</small></th> <td></td> <td></td> <td></td> <td><span class="check"></span></td> </tr> <tr> <th><strong>Premium Cloud Support</strong></th> <td colspan="4"></td> </tr> <tr> <th> Account &amp; Billing Support <a class="anchor" href="#faq-account"> {% include '../_includes/svg/ico-question.svg' %} </a> </th> <td></td> <td><span class="check"></span></td> <td><span class="check"></span></td> <td><span class="check"></span></td> </tr> <tr> <th> Premium Product Support <a class="anchor" href="#faq-premium"> {% include '../_includes/svg/ico-question.svg' %} </a> </th> <td></td> <td></td> <td></td> <td><span class="check"></span></td> </tr> <tr> <th>Live Onboarding</th> <td></td> <td></td> <td></td> <td><span class="check"></span></td> </tr> <tr> <th><strong>Admin &amp; Security</strong></th> <td colspan="4"></td> </tr> <tr> <th> Seats included <a class="anchor" href="#faq-seats"> {% include '../_includes/svg/ico-question.svg' %} </a> </th> <td>1</td> <td>1</td> <td>2</td> <td>Custom limit</td> </tr> <tr> <th>Additional Seat Cost</th> <td></td> <td></td> <td>$99/Seat</td> <td>Contact Sales</td> </tr> <tr> <th>Seat Limit</th> <td></td> <td></td> <td>5</td> <td>Custom limit</td> </tr> <tr> <th>Single sign-on</th> <td></td> <td></td> <td></td> <td><span class="check"></span></td> </tr> <tr> <th>Role-based access</th> <td></td> <td></td> <td></td> <td><span class="check"></span></td> </tr> </tbody> <tfoot> <tr> <th></th> <td> <a href="/start" class="btn sm light" id="btn-pricing-starter">Get started</a> </td> <td> <a href="/signup?plan=developer&source=framework-{{id}}" class="btn sm" id="btn-pricing-starter">Get started</a> </td> <td> <a href="/signup?plan=teams&source=framework-{{id}}" class="btn sm" id="btn-pricing-team">Get started</a> </td> <td> <a href="#" class="btn sm dark" data-toggle="modal" data-target="#scalePlanForm">Contact us</a> </td> </tr> </tfoot> </table> </div> </div> </div> </main> <div class="also offwhite-bg"> <div class="container"> <h3>Every plan comes with:</h3> <ul> <li class="also__live"> <h4>Live app updating</h4> <p> Deliver real-time app updates, content changes, A/B tests, bug fixes, and more. Push changes directly to your users, right from the Ionic cloud dashboard. </p> </li> <li class="also__cloud"> <h4>Cloud Dashboard</h4> <p> Get access to a unified Dashboard to house and organize all your Ionic apps, accessible in one place. Track activity and builds from anywhere. </p> </li> <li class="also__git"> <h4>Git-based workflow</h4> <p> With Ionic’s developer platform, starting and deploying apps is as simple as "git push ionic main" and we handle the rest. Connect to your favorite Git host. </p> </li> <li class="also__forum"> <h4>Access to Forum</h4> <p> Having an Ionic account unlocks access to post and comment on the Ionic Forum, the single most active community hub for Ionic developers. </p> </li> </ul> </div> </div> <div class="faq container"> <h3>Have a Question?</h3> <div class="faq__cols"> <ul class="faq__col"> <li id="faq-live-updates"> <h4>How do Live Update limits work?</h4> <p>Using the Ionic <a href="/pro/deploy">Deploy</a> service allows you to push hot code updates directly to your users’ devices, all from the Ionic cloud dashboard, without having to go through the app stores.</p> <p>A single Live Update is one code update to one device. If you send one update to 200 devices, that counts as 200 Live Updates. If you send two updates to 200 devices, that counts as 400 Live Updates.</p> <p>The number of Live Updates varies with each plan. The Launch plan includes 10,000 Live Updates per month. The Growth plan allows up to 25,000 Live Updates per month. The plan limits are refreshed each month. If you exceed your quota for a given month, you will have to upgrade to a higher plan, or wait until the next calendar month to send more updates.</p> <p>If you need more than 25,000 Live Updates, the Scale and Enterprise plans offer custom limits, based on annual usage. Ionic’s Live Update service scales to millions of units, with pricing varying based on the number of Updates in your custom plan. <a href="/sales">Contact our Sales</a> team to learn more about setting up a custom Scale or Enterprise plan.</p> </li> <li id="faq-ios"> <h4>Which plans offer iOS Enterprise builds?</h4> <p>For development teams that would like to use <a href="/pro/package">Ionic Package</a> to generate builds using their Apple Enterprise Program Account Certificate, a subscription to the Scale or Enterprise plan is required. The Apple Developer Enterprise Program allows large organizations to develop and deploy proprietary, internal-use apps to their employees. This program is for specific use cases that require private distribution directly to employees using secure internal systems or through a Mobile Device Management solution.</p> </li> <li id="faq-account"> <h4>What is Account &amp; Billing Support?</h4> <p>Account & Billing Support is available to all plan holders, and includes access to help for issues related to account billing, refunds, cancellations and account re-activations, and password or account access related concerns.</p> </li> <li id="faq-premium"> <h4>What is Premium Product Support?</h4> <p>Timely assistance with troubleshooting issues related to Appflow or the Cloud dashboard.</p> </li> </ul> <ul class="faq__col"> <li> <h4>Do I have to create an Ionic account to use the Framework?</h4> <p>No. Ionic Framework is totally open source and free to download and install without an Ionic account. We invite all Ionic developers to create an account so they can take advantage of free developer tools to help you build better apps and go faster, with tools such as Ionic Deploy for sending Live Updates to your users, and a single cloud dashboard to manage all of your projects. If you just want to start building wit the Framework, freel free!</p> </li> <li id="faq-concurrency"> <h4>What do Concurrency Limits refer to?</h4> <p>Concurrency Limits refers to the number of app builds that can occur at the same time. Once you have hit your limit, additional builds will be queued until the existing builds in process are completed. When you upgrade to the Scale plan, you’ll be able to set a customized concurrency limit that matches your team’s needs and goals.</p> </li> <li id="faq-git"> <h4>What are on-premises (self-hosted) Git repos?</h4> <p>On-premises Git repos are installations of Git services that are installed on your own servers (i.e. your own infrastructure or public cloud). All Ionic account plans offer a Git-based workflow that works with cloud-based Git services such as GitHub, Bitbucket, and GitLab. For teams and businesses that wish to integrate with self-hosted Git repos, we offer support for Bitbucket Server and GitLab Self-Managed as an add-on under the Scale and Enterprise plans. Contact our Sales team to learn more.</p> </li> <li id="faq-seats"> <h4>How many seats are with each plan?</h4> <p>The number of seats included varies by plan. Launch plans include one (1) seat. Growth plans include two (2) seats with the base subscription, with the ability to add up to five (5) team members at $99 per additional seat. Growth subscribers can add additional seats with the Developer Hub.</p> <p>Scale and Enterprise plans offer flexible packages that scale to any number of team members. Please contact our Sales team to discuss a custom plan that accommodates the number of seats you’d like to include. If you are a current customer and would like to add more seats to your existing Scale or Enterprise plan, please contact Support.</p> </li> <li id="faq-enterprise"> <h4>What is the Enterprise Support SLA?</h4> <p>You can customize your SLA as part of an Enterprise plan based on your specific requirements.</p> </li> </ul> </div> </div> {% include '../_includes/promos/quad-cta.html' %} {% endblock %} {% block modals %} {% include './__modal--contact.html' %} {% endblock %} {% block scripts %} <script> const toggle = function() { this.isMonthly = false; this.$plans = document.getElementById('plans'); this.handleClick = event => { const wasMonthlyClicked = event.target.textContent === 'Monthly'; if (this.isMonthly === wasMonthlyClicked) return; this.isMonthly = wasMonthlyClicked; this.toggleEl.querySelector(`span:nth-child(${this.isMonthly ? 1 : 2})`) .classList.add('active'); this.toggleEl.querySelector(`span:nth-child(${this.isMonthly ? 2 : 1})`) .classList.remove('active'); requestAnimationFrame(() => { this.$plans.className = `plans ${this.isMonthly ? 'monthly' : 'annually'}-active` }); } return { // public methods init: () => { this.toggleEl = document.getElementById('pricing-toggle'); this.toggleEl.querySelectorAll('span').forEach(el => { el.addEventListener('click', this.handleClick); }); } } }().init(); </script> {% endblock %}
{ "pile_set_name": "Github" }
//from mongodb-uri var dbObject = {}; function _parseAddress(address, uriObject) { uriObject.hosts = []; address.split(',').forEach(function(h) { var i = h.indexOf(':'); if (i >= 0) { uriObject.hosts.push( { host: decodeURIComponent(h.substring(0, i)), port: parseInt(h.substring(i + 1)) } ); } else { uriObject.hosts.push({ host: decodeURIComponent(h) }); } }); }; function parse(uri) { var uriObject = {}; var i = uri.indexOf('://'); if (i < 0) { throw new Error('No scheme found in URI ' + uri); } uriObject.scheme = uri.substring(0, i); if (this.scheme && this.scheme !== uriObject.scheme) { throw new Error('URI must begin with ' + this.scheme + '://'); } var rest = uri.substring(i + 3); i = rest.indexOf('@'); if (i >= 0) { var credentials = rest.substring(0, i); rest = rest.substring(i + 1); i = credentials.indexOf(':'); if (i >= 0) { uriObject.username = decodeURIComponent(credentials.substring(0, i)); uriObject.password = decodeURIComponent(credentials.substring(i + 1)); } else { uriObject.username = decodeURIComponent(credentials); } } i = rest.indexOf('?'); if (i >= 0) { var options = rest.substring(i + 1); rest = rest.substring(0, i); uriObject.options = {}; options.split('&').forEach(function(o) { var iEquals = o.indexOf('='); uriObject.options[decodeURIComponent(o.substring(0, iEquals))] = decodeURIComponent(o.substring(iEquals + 1)); }); } i = rest.indexOf('/'); if (i >= 0) { // Make sure the database name isn't the empty string if (i < rest.length - 1) { uriObject.database = decodeURIComponent(rest.substring(i + 1)); } rest = rest.substring(0, i); } _parseAddress(rest, uriObject); return uriObject; }; load("../../../frontend/express/config.js"); if (typeof countlyConfig.mongodb === "string") { var uriObject = parse(countlyConfig.mongodb); dbObject.name = uriObject.database; for (var i = 0; i < uriObject.hosts.length; i++) { if (uriObject.hosts[i].port) { uriObject.hosts[i] = uriObject.hosts[i].host + ":" + uriObject.hosts[i].port; } else { uriObject.hosts[i] = uriObject.hosts[i].host; } } dbObject.host = uriObject.hosts.join(","); if (uriObject.options && uriObject.options.replicaSet) { dbObject.host = uriObject.options.replicaSet + "/" + dbObject.host; } dbObject.username = uriObject.username; dbObject.password = uriObject.password; } else { dbObject.name = countlyConfig.mongodb.db || 'countly'; if (typeof countlyConfig.mongodb.replSetServers === 'object') { //mongodb://db1.example.net,db2.example.net:2500/?replicaSet=test dbObject.host = countlyConfig.mongodb.replSetServers.join(","); if (countlyConfig.mongodb.replicaName) { dbObject.host = countlyConfig.mongodb.replicaName + "/" + dbObject.host; } } else { dbObject.host = countlyConfig.mongodb.host + ':' + countlyConfig.mongodb.port; } if (countlyConfig.mongodb.username && countlyConfig.mongodb.password) { dbObject.username = countlyConfig.mongodb.username; dbObject.password = countlyConfig.mongodb.password; } }
{ "pile_set_name": "Github" }
//! moment.js locale configuration //! locale : Uzbek [uz] //! author : Sardor Muminov : https://github.com/muminoff import moment from '../moment'; export default moment.defineLocale('uz', { months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'), weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), longDateFormat : { LT : 'HH:mm', LTS : 'HH:mm:ss', L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY HH:mm', LLLL : 'D MMMM YYYY, dddd HH:mm' }, calendar : { sameDay : '[Бугун соат] LT [да]', nextDay : '[Эртага] LT [да]', nextWeek : 'dddd [куни соат] LT [да]', lastDay : '[Кеча соат] LT [да]', lastWeek : '[Утган] dddd [куни соат] LT [да]', sameElse : 'L' }, relativeTime : { future : 'Якин %s ичида', past : 'Бир неча %s олдин', s : 'фурсат', ss : '%d фурсат', m : 'бир дакика', mm : '%d дакика', h : 'бир соат', hh : '%d соат', d : 'бир кун', dd : '%d кун', M : 'бир ой', MM : '%d ой', y : 'бир йил', yy : '%d йил' }, week : { dow : 1, // Monday is the first day of the week. doy : 7 // The week that contains Jan 4th is the first week of the year. } });
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <title>Home</title> <!-- <link rel="stylesheet" type="text/css" href="../static/css/styles.css"> --> <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/styles.css') }}"> </head> <body> <header> <div class="container"> <div id="brandname"> ML App </div> <h2>Spam Detection For Youtube Comments</h2> </div> </header> <div class="ml-container"> <form action="{{ url_for('predict')}}" method="POST"> <p>Enter Your Comment Here</p> <!-- <input type="text" name="comment"/> --> <textarea name="comment" rows="4" cols="50"></textarea> <br/> <input type="submit" class="btn-info" value="predict"> </form> </div> </body> </html>
{ "pile_set_name": "Github" }
<scheme name="Gruvbox Dark" parent_scheme="Default"> <option name="LINE_SPACING" value="1.0" /> <font> <option name="EDITOR_FONT_NAME" value="Hasklig" /> <option name="EDITOR_FONT_SIZE" value="14" /> </font> <font> <option name="EDITOR_FONT_NAME" value="Menlo" /> <option name="EDITOR_FONT_SIZE" value="14" /> </font> <option name="EDITOR_LIGATURES" value="true" /> <console-font> <option name="EDITOR_FONT_NAME" value="Hack" /> <option name="EDITOR_FONT_SIZE" value="14" /> </console-font> <console-font> <option name="EDITOR_FONT_NAME" value="Menlo" /> <option name="EDITOR_FONT_SIZE" value="12" /> </console-font> <colors> <option name="ADDED_LINES_COLOR" value="79740e" /> <option name="ANNOTATIONS_COLOR" value="928374" /> <option name="CARET_COLOR" value="bbbbbb" /> <option name="CARET_ROW_COLOR" value="3c3836" /> <option name="CONSOLE_BACKGROUND_KEY" value="282828" /> <option name="FILESTATUS_ADDED" value="629755" /> <option name="FILESTATUS_DELETED" value="6c6c6c" /> <option name="FILESTATUS_IDEA_FILESTATUS_DELETED_FROM_FILE_SYSTEM" value="6c6c6c" /> <option name="FILESTATUS_IDEA_FILESTATUS_IGNORED" value="848504" /> <option name="FILESTATUS_IDEA_FILESTATUS_MERGED_WITH_BOTH_CONFLICTS" value="d5756c" /> <option name="FILESTATUS_IDEA_FILESTATUS_MERGED_WITH_CONFLICTS" value="d5756c" /> <option name="FILESTATUS_IDEA_FILESTATUS_MERGED_WITH_PROPERTY_CONFLICTS" value="d5756c" /> <option name="FILESTATUS_MERGED" value="9876aa" /> <option name="FILESTATUS_MODIFIED" value="6897bb" /> <option name="FILESTATUS_NOT_CHANGED_IMMEDIATE" value="6897bb" /> <option name="FILESTATUS_NOT_CHANGED_RECURSIVE" value="6897bb" /> <option name="FILESTATUS_UNKNOWN" value="d1675a" /> <option name="FILESTATUS_addedOutside" value="629755" /> <option name="FILESTATUS_changelistConflict" value="d5756c" /> <option name="FILESTATUS_modifiedOutside" value="6897bb" /> <option name="GUTTER_BACKGROUND" value="282828" /> <option name="INDENT_GUIDE" value="665c54" /> <option name="LINE_NUMBERS_COLOR" value="928374" /> <option name="METHOD_SEPARATORS_COLOR" value="2a2a2a" /> <option name="MODIFIED_LINES_COLOR" value="415f69" /> <option name="RECURSIVE_CALL_ATTRIBUTES" value="574300" /> <option name="RIGHT_MARGIN_COLOR" value="32302f" /> <option name="SELECTED_INDENT_GUIDE" value="f8e1aa" /> <option name="SELECTED_TEARLINE_COLOR" value="8ec07c" /> <option name="SELECTION_BACKGROUND" value="665c54" /> <option name="SELECTION_FOREGROUND" value="" /> <option name="TEARLINE_COLOR" value="665c54" /> <option name="WHITESPACES" value="505050" /> </colors> <attributes> <option name="ABSTRACT_CLASS_NAME_ATTRIBUTES"> <value> <option name="FOREGROUND" value="fabd2f" /> <option name="FONT_TYPE" value="2" /> <option name="EFFECT_COLOR" value="fabd2f" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="ABSTRACT_METHOD_ATTRIBUTES" baseAttributes="METHOD_CALL_ATTRIBUTES" /> <option name="ANNOTATION_NAME_ATTRIBUTES" baseAttributes="DEFAULT_METADATA" /> <option name="ANONYMOUS_CLASS_NAME_ATTRIBUTES"> <value> <option name="FOREGROUND" value="fabd2f" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="BAD_CHARACTER"> <value> <option name="FOREGROUND" value="fb4934" /> <option name="EFFECT_COLOR" value="fa4834" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="BASH.EXTERNAL_COMMAND"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="BASH.FUNCTION_CALL" baseAttributes="DEFAULT_FUNCTION_CALL" /> <option name="BASH.FUNCTION_DEF_NAME"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="BASH.HERE_DOC" baseAttributes="DEFAULT_STRING" /> <option name="BASH.INTERNAL_COMMAND"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="BASH.SHEBANG" baseAttributes="BASH.LINE_COMMENT" /> <option name="BOOKMARKS_ATTRIBUTES"> <value> <option name="ERROR_STRIPE_COLOR" value="b8bb26" /> </value> </option> <option name="BREAKPOINT_ATTRIBUTES"> <value> <option name="BACKGROUND" value="3a2323" /> </value> </option> <option name="Block comment"> <value> <option name="FOREGROUND" value="83786e" /> </value> </option> <option name="CLASS_NAME_ATTRIBUTES"> <value> <option name="FOREGROUND" value="fabd2f" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="COFFEESCRIPT.CLASS_NAME"> <value> <option name="FOREGROUND" value="fabd2f" /> </value> </option> <option name="COFFEESCRIPT.FUNCTION_NAME" baseAttributes="DEFAULT_FUNCTION_DECLARATION" /> <option name="CONSOLE_BLACK_OUTPUT"> <value> <option name="FOREGROUND" value="282828" /> </value> </option> <option name="CONSOLE_BLUE_BRIGHT_OUTPUT"> <value> <option name="FOREGROUND" value="83a598" /> <option name="FONT_TYPE" value="1" /> </value> </option> <option name="CONSOLE_BLUE_OUTPUT"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="CONSOLE_CYAN_BRIGHT_OUTPUT"> <value> <option name="FOREGROUND" value="8ec07c" /> <option name="FONT_TYPE" value="1" /> </value> </option> <option name="CONSOLE_CYAN_OUTPUT"> <value> <option name="FOREGROUND" value="8ec07c" /> </value> </option> <option name="CONSOLE_DARKGRAY_OUTPUT"> <value> <option name="FOREGROUND" value="928374" /> </value> </option> <option name="CONSOLE_ERROR_OUTPUT"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="CONSOLE_GRAY_OUTPUT"> <value> <option name="FOREGROUND" value="bdae93" /> </value> </option> <option name="CONSOLE_GREEN_BRIGHT_OUTPUT"> <value> <option name="FOREGROUND" value="b8bb26" /> <option name="FONT_TYPE" value="1" /> </value> </option> <option name="CONSOLE_GREEN_OUTPUT"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="CONSOLE_MAGENTA_BRIGHT_OUTPUT"> <value> <option name="FOREGROUND" value="d3869b" /> <option name="FONT_TYPE" value="1" /> </value> </option> <option name="CONSOLE_MAGENTA_OUTPUT"> <value> <option name="FOREGROUND" value="d3869b" /> </value> </option> <option name="CONSOLE_NORMAL_OUTPUT"> <value /> </option> <option name="CONSOLE_RANGE_TO_EXECUTE" baseAttributes="INJECTED_LANGUAGE_FRAGMENT" /> <option name="CONSOLE_RED_BRIGHT_OUTPUT"> <value> <option name="FOREGROUND" value="fb4934" /> <option name="FONT_TYPE" value="1" /> </value> </option> <option name="CONSOLE_RED_OUTPUT"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="CONSOLE_SYSTEM_OUTPUT"> <value> <option name="FOREGROUND" value="fabd2f" /> </value> </option> <option name="CONSOLE_USER_INPUT"> <value /> </option> <option name="CONSOLE_WHITE_OUTPUT"> <value> <option name="FOREGROUND" value="ebdbb2" /> </value> </option> <option name="CONSOLE_YELLOW_BRIGHT_OUTPUT"> <value> <option name="FOREGROUND" value="fabd2f" /> <option name="FONT_TYPE" value="1" /> </value> </option> <option name="CONSOLE_YELLOW_OUTPUT"> <value> <option name="FOREGROUND" value="fabd2f" /> </value> </option> <option name="CONSTRUCTOR_CALL_ATTRIBUTES"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="CTRL_CLICKABLE"> <value> <option name="FOREGROUND" value="83a598" /> <option name="EFFECT_COLOR" value="83a598" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="CUSTOM_INVALID_STRING_ESCAPE_ATTRIBUTES"> <value> <option name="FOREGROUND" value="fb4934" /> <option name="EFFECT_COLOR" value="fb4934" /> <option name="EFFECT_TYPE" value="2" /> </value> </option> <option name="CUSTOM_KEYWORD1_ATTRIBUTES"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="CUSTOM_KEYWORD2_ATTRIBUTES"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="CUSTOM_KEYWORD3_ATTRIBUTES"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="CUSTOM_KEYWORD4_ATTRIBUTES"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="CUSTOM_LINE_COMMENT_ATTRIBUTES"> <value> <option name="FOREGROUND" value="928374" /> </value> </option> <option name="CUSTOM_MULTI_LINE_COMMENT_ATTRIBUTES"> <value> <option name="FOREGROUND" value="928374" /> </value> </option> <option name="CUSTOM_NUMBER_ATTRIBUTES"> <value> <option name="FOREGROUND" value="d3869b" /> </value> </option> <option name="CUSTOM_STRING_ATTRIBUTES"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="CUSTOM_VALID_STRING_ESCAPE_ATTRIBUTES"> <value> <option name="FOREGROUND" value="d79921" /> </value> </option> <option name="Clojure Keyword"> <value> <option name="FOREGROUND" value="d3869b" /> </value> </option> <option name="DEFAULT_ATTRIBUTE"> <value> <option name="FOREGROUND" value="d3869b" /> </value> </option> <option name="DEFAULT_BLOCK_COMMENT"> <value> <option name="FOREGROUND" value="928374" /> <option name="FONT_TYPE" value="2" /> </value> </option> <option name="DEFAULT_BRACES"> <value> <option name="FOREGROUND" value="f8e1aa" /> </value> </option> <option name="DEFAULT_BRACKETS"> <value> <option name="FOREGROUND" value="f8e1aa" /> </value> </option> <option name="DEFAULT_CLASS_NAME"> <value> <option name="FOREGROUND" value="fabd2f" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="DEFAULT_CLASS_REFERENCE"> <value> <option name="FOREGROUND" value="fabd2f" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="DEFAULT_COMMA"> <value> <option name="FOREGROUND" value="ebdbb2" /> </value> </option> <option name="DEFAULT_CONSTANT"> <value> <option name="FOREGROUND" value="d3869b" /> </value> </option> <option name="DEFAULT_DOC_COMMENT"> <value> <option name="FOREGROUND" value="83786e" /> </value> </option> <option name="DEFAULT_DOC_COMMENT_TAG"> <value> <option name="FOREGROUND" value="d5c4a1" /> </value> </option> <option name="DEFAULT_DOC_COMMENT_TAG_VALUE"> <value> <option name="FOREGROUND" value="bdae93" /> <option name="FONT_TYPE" value="2" /> </value> </option> <option name="DEFAULT_DOC_MARKUP"> <value> <option name="FOREGROUND" value="bdae93" /> </value> </option> <option name="DEFAULT_DOT"> <value> <option name="FOREGROUND" value="ebdbb2" /> </value> </option> <option name="DEFAULT_ENTITY"> <value> <option name="FOREGROUND" value="d79921" /> </value> </option> <option name="DEFAULT_FUNCTION_CALL"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="DEFAULT_FUNCTION_DECLARATION"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="DEFAULT_GLOBAL_VARIABLE"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="DEFAULT_IDENTIFIER"> <value> <option name="FOREGROUND" value="fbf1c7" /> </value> </option> <option name="DEFAULT_INSTANCE_FIELD"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="DEFAULT_INSTANCE_METHOD"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="DEFAULT_INTERFACE_NAME"> <value> <option name="FOREGROUND" value="fabd2f" /> <option name="EFFECT_COLOR" value="fabd2f" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="DEFAULT_INVALID_STRING_ESCAPE"> <value> <option name="FOREGROUND" value="fb4934" /> <option name="EFFECT_COLOR" value="fb4934" /> <option name="EFFECT_TYPE" value="2" /> </value> </option> <option name="DEFAULT_KEYWORD"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="DEFAULT_LABEL"> <value> <option name="FOREGROUND" value="d3869b" /> </value> </option> <option name="DEFAULT_LINE_COMMENT"> <value> <option name="FOREGROUND" value="928374" /> <option name="FONT_TYPE" value="2" /> </value> </option> <option name="DEFAULT_LOCAL_VARIABLE"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="DEFAULT_METADATA"> <value> <option name="FOREGROUND" value="8ec07c" /> </value> </option> <option name="DEFAULT_NUMBER"> <value> <option name="FOREGROUND" value="d3869b" /> </value> </option> <option name="DEFAULT_OPERATION_SIGN"> <value> <option name="FOREGROUND" value="ebdbb2" /> </value> </option> <option name="DEFAULT_PARAMETER"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="DEFAULT_PARENTHS"> <value> <option name="FOREGROUND" value="f8e1aa" /> </value> </option> <option name="DEFAULT_PREDEFINED_SYMBOL"> <value> <option name="FOREGROUND" value="efc090" /> </value> </option> <option name="DEFAULT_SEMICOLON"> <value> <option name="FOREGROUND" value="ebdbb2" /> </value> </option> <option name="DEFAULT_STATIC_FIELD"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="DEFAULT_STATIC_METHOD"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="DEFAULT_STRING"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="DEFAULT_TAG"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="DEFAULT_TEMPLATE_LANGUAGE_COLOR"> <value> <option name="FOREGROUND" value="d5c4a1" /> </value> </option> <option name="DEFAULT_VALID_STRING_ESCAPE"> <value> <option name="FOREGROUND" value="d79921" /> </value> </option> <option name="DELETED_TEXT_ATTRIBUTES"> <value> <option name="FOREGROUND" value="282828" /> <option name="BACKGROUND" value="ebdbb2" /> </value> </option> <option name="DEPRECATED_ATTRIBUTES"> <value> <option name="FOREGROUND" value="fb4934" /> <option name="FONT_TYPE" value="2" /> <option name="EFFECT_COLOR" value="fb4934" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="DIFF_CONFLICT"> <value> <option name="BACKGROUND" value="45302b" /> <option name="ERROR_STRIPE_COLOR" value="8f5247" /> </value> </option> <option name="DIFF_DELETED"> <value> <option name="BACKGROUND" value="484a4a" /> <option name="ERROR_STRIPE_COLOR" value="656e76" /> </value> </option> <option name="DIFF_INSERTED"> <value> <option name="BACKGROUND" value="294436" /> <option name="ERROR_STRIPE_COLOR" value="447152" /> </value> </option> <option name="DIFF_MODIFIED"> <value> <option name="BACKGROUND" value="385570" /> <option name="ERROR_STRIPE_COLOR" value="43698d" /> </value> </option> <option name="DOC_COMMENT_TAG_VALUE"> <value> <option name="FOREGROUND" value="bdae93" /> </value> </option> <option name="DUPLICATE_FROM_SERVER"> <value> <option name="BACKGROUND" value="5e5339" /> </value> </option> <option name="ELIXIR_ALIAS" baseAttributes="DEFAULT_CLASS_NAME" /> <option name="ELIXIR_BIT"> <value /> </option> <option name="ELIXIR_BRACES" baseAttributes="DEFAULT_BRACES" /> <option name="ELIXIR_BRACKET" baseAttributes="DEFAULT_BRACKETS" /> <option name="ELIXIR_CALLBACK" baseAttributes="ELIXIR_SPECIFICATION" /> <option name="ELIXIR_CHAR_LIST" baseAttributes="DEFAULT_STRING" /> <option name="ELIXIR_CHAR_TOKEN" baseAttributes="DEFAULT_ENTITY" /> <option name="ELIXIR_DOT" baseAttributes="DEFAULT_DOT" /> <option name="ELIXIR_EXPRESSION_SUBSTITUTION_MARK" baseAttributes="DEFAULT_BRACES" /> <option name="ELIXIR_FUNCTION_CALL" baseAttributes="DEFAULT_FUNCTION_CALL" /> <option name="ELIXIR_IGNORED_VARIABLE" baseAttributes="ELIXIR_VARIABLE" /> <option name="ELIXIR_MACRO_CALL"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="ELIXIR_MAP" baseAttributes="DEFAULT_BRACES" /> <option name="ELIXIR_OPERATION_SIGN" baseAttributes="DEFAULT_OPERATION_SIGN" /> <option name="ELIXIR_PARAMETER" baseAttributes="DEFAULT_PARAMETER" /> <option name="ELIXIR_PARENTHESES" baseAttributes="DEFAULT_PARENTHS" /> <option name="ELIXIR_PREDEFINED" baseAttributes="DEFAULT_PREDEFINED_SYMBOL" /> <option name="ELIXIR_SIGIL" baseAttributes="DEFAULT_TEMPLATE_LANGUAGE_COLOR" /> <option name="ELIXIR_SPECIFICATION" baseAttributes="DEFAULT_FUNCTION_DECLARATION" /> <option name="ELIXIR_STRING" baseAttributes="DEFAULT_STRING" /> <option name="ELIXIR_STRUCT" baseAttributes="ELIXIR_MAP" /> <option name="ELIXIR_TYPE" baseAttributes="DEFAULT_METADATA" /> <option name="ELIXIR_TYPE_PARAMETER" baseAttributes="DEFAULT_PARAMETER" /> <option name="ELIXIR_VALID_ESCAPE_SEQUENCE" baseAttributes="DEFAULT_VALID_STRING_ESCAPE" /> <option name="ELIXIR_VARIABLE" baseAttributes="DEFAULT_LOCAL_VARIABLE" /> <option name="ELM_ARROW" baseAttributes="DEFAULT_OPERATION_SIGN" /> <option name="ELM_BRACES" baseAttributes="DEFAULT_BRACES" /> <option name="ELM_BRACKETS" baseAttributes="DEFAULT_BRACKETS" /> <option name="ELM_COMMA" baseAttributes="DEFAULT_COMMA" /> <option name="ELM_DEFINITION_NAME" baseAttributes="DEFAULT_FUNCTION_DECLARATION" /> <option name="ELM_EQ" baseAttributes="DEFAULT_OPERATION_SIGN" /> <option name="ELM_OPERATOR" baseAttributes="DEFAULT_OPERATION_SIGN" /> <option name="ELM_PARENTHESIS" baseAttributes="DEFAULT_PARENTHS" /> <option name="ELM_PIPE" baseAttributes="DEFAULT_OPERATION_SIGN" /> <option name="ELM_TYPE" baseAttributes="DEFAULT_CLASS_NAME" /> <option name="ELM_TYPE_ANNOTATION_NAME" baseAttributes="DEFAULT_FUNCTION_DECLARATION" /> <option name="ELM_TYPE_ANNOTATION_SIGNATURE_TYPES" baseAttributes="DEFAULT_CLASS_REFERENCE" /> <option name="ENUM_NAME_ATTRIBUTES"> <value> <option name="FOREGROUND" value="fabd2f" /> </value> </option> <option name="ERRORS_ATTRIBUTES"> <value> <option name="EFFECT_COLOR" value="fb4934" /> <option name="ERROR_STRIPE_COLOR" value="fb4934" /> <option name="EFFECT_TYPE" value="2" /> </value> </option> <option name="EXECUTIONPOINT_ATTRIBUTES"> <value> <option name="BACKGROUND" value="2d6099" /> </value> </option> <option name="FOLDED_TEXT_ATTRIBUTES"> <value> <option name="FOREGROUND" value="ebdbb2" /> <option name="BACKGROUND" value="427b58" /> </value> </option> <option name="FOLLOWED_HYPERLINK_ATTRIBUTES"> <value> <option name="FOREGROUND" value="83a598" /> <option name="EFFECT_COLOR" value="83a598" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="GENERIC_SERVER_ERROR_OR_WARNING"> <value> <option name="EFFECT_COLOR" value="fe8019" /> <option name="ERROR_STRIPE_COLOR" value="fe8019" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="GHERKIN_OUTLINE_PARAMETER_SUBSTITUTION" baseAttributes="DEFAULT_INSTANCE_FIELD" /> <option name="GHERKIN_PYSTRING" baseAttributes="DEFAULT_STRING" /> <option name="GHERKIN_REGEXP_PARAMETER" baseAttributes="DEFAULT_PARAMETER" /> <option name="GROOVY_KEYWORD" baseAttributes="JAVA_KEYWORD" /> <option name="HANDLEBARS.DATA_PREFIX"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="HANDLEBARS.IDENTIFIERS"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="HANDLEBARS.MUSTACHES"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="HTML_TAG_NAME"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="HYPERLINK_ATTRIBUTES"> <value> <option name="FOREGROUND" value="83a598" /> <option name="EFFECT_COLOR" value="83a598" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="Head symbol"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="Head symbol from clojure.core"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="IDENTIFIER_UNDER_CARET_ATTRIBUTES"> <value> <option name="FOREGROUND" value="ebdbb2" /> <option name="BACKGROUND" value="76678" /> <option name="ERROR_STRIPE_COLOR" value="458587" /> </value> </option> <option name="IGNORE.COMMENT" baseAttributes="DEFAULT_LINE_COMMENT" /> <option name="IGNORE.HEADER" baseAttributes="DEFAULT_DOC_COMMENT_TAG" /> <option name="IGNORE.NEGATION" baseAttributes="DEFAULT_KEYWORD" /> <option name="IGNORE.SECTION" baseAttributes="DEFAULT_DOC_COMMENT" /> <option name="IGNORE.SLASH" baseAttributes="DEFAULT_COMMA" /> <option name="IGNORE.SYNTAX" baseAttributes="DEFAULT_INSTANCE_FIELD" /> <option name="IGNORE.VALUE" baseAttributes="DEFAULT_STRING" /> <option name="IMPLICIT_ANONYMOUS_CLASS_PARAMETER_ATTRIBUTES"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="INFO_ATTRIBUTES"> <value> <option name="EFFECT_COLOR" value="ebdbb2" /> <option name="ERROR_STRIPE_COLOR" value="ebdbb2" /> <option name="EFFECT_TYPE" value="2" /> </value> </option> <option name="INHERITED_METHOD_ATTRIBUTES" baseAttributes="METHOD_CALL_ATTRIBUTES" /> <option name="INJECTED_LANGUAGE_FRAGMENT"> <value> <option name="FOREGROUND" value="f9f5d7" /> </value> </option> <option name="INLINE_PARAMETER_HINT"> <value> <option name="FOREGROUND" value="fbf1c7" /> <option name="BACKGROUND" value="8ec07c" /> </value> </option> <option name="INSTANCE_FIELD_ATTRIBUTES"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="INTERFACE_NAME_ATTRIBUTES"> <value> <option name="FOREGROUND" value="fabd2f" /> <option name="EFFECT_COLOR" value="fabd2f" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="JS.GLOBAL_FUNCTION" baseAttributes="DEFAULT_FUNCTION_DECLARATION" /> <option name="JS.GLOBAL_VARIABLE" baseAttributes="DEFAULT_GLOBAL_VARIABLE" /> <option name="JS.INSTANCE_MEMBER_FUNCTION" baseAttributes="DEFAULT_INSTANCE_METHOD" /> <option name="JS.LOCAL_VARIABLE" baseAttributes="DEFAULT_LOCAL_VARIABLE" /> <option name="JS.PARAMETER" baseAttributes="DEFAULT_PARAMETER" /> <option name="JS.REGEXP" baseAttributes="DEFAULT_STRING" /> <option name="KOTLIN_ANNOTATION"> <value> <option name="FOREGROUND" value="83786e" /> </value> </option> <option name="KOTLIN_LABEL"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="KOTLIN_MUTABLE_VARIABLE"> <value> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="KOTLIN_SMART_CAST_VALUE"> <value> <option name="FONT_TYPE" value="2" /> </value> </option> <option name="LOG_ERROR_OUTPUT"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="LOG_EXPIRED_ENTRY"> <value> <option name="FOREGROUND" value="928374" /> </value> </option> <option name="LOG_WARNING_OUTPUT"> <value> <option name="FOREGROUND" value="fabd2f" /> </value> </option> <option name="List/map to object conversion" baseAttributes="JAVA_NUMBER" /> <option name="MATCHED_BRACE_ATTRIBUTES"> <value> <option name="FOREGROUND" value="ff8647" /> </value> </option> <option name="METHOD_CALL_ATTRIBUTES"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="METHOD_DECLARATION_ATTRIBUTES"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="MULTIMARKDOWN.WIKI_LINK_REF" baseAttributes="MULTIMARKDOWN.WIKI_LINK" /> <option name="MULTIMARKDOWN.WIKI_LINK_SEPARATOR" baseAttributes="MULTIMARKDOWN.WIKI_LINK" /> <option name="NOT_USED_ELEMENT_ATTRIBUTES"> <value> <option name="FOREGROUND" value="928374" /> <option name="EFFECT_COLOR" value="928374" /> <option name="EFFECT_TYPE" value="2" /> </value> </option> <option name="OC.CONDITIONALLY_NOT_COMPILED"> <value> <option name="FOREGROUND" value="928374" /> </value> </option> <option name="OC.LABEL"> <value> <option name="FOREGROUND" value="d3869b" /> </value> </option> <option name="OC.MACRONAME"> <value> <option name="FOREGROUND" value="d3869b" /> <option name="FONT_TYPE" value="1" /> </value> </option> <option name="OC.OVERLOADED_OPERATOR"> <value /> </option> <option name="OC.STRUCT_FIELD"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="OC.STRUCT_LIKE"> <value> <option name="FOREGROUND" value="fabd2f" /> </value> </option> <option name="OC.TYPEDEF"> <value> <option name="FOREGROUND" value="fabd2f" /> </value> </option> <option name="PARAMETER_ATTRIBUTES"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="PHP_EXEC_COMMAND_ID" baseAttributes="DEFAULT_STRING" /> <option name="PHP_PARAMETER" baseAttributes="DEFAULT_PARAMETER" /> <option name="PHP_VAR" baseAttributes="DEFAULT_LOCAL_VARIABLE" /> <option name="PROPERTIES.KEY"> <value> <option name="FOREGROUND" value="d3869b" /> </value> </option> <option name="PUPPET_HEREDOC_BODY" baseAttributes="TEXT" /> <option name="PUPPET_HEREDOC_TAGS" baseAttributes="DEFAULT_IDENTIFIER" /> <option name="PY.BUILTIN_NAME"> <value> <option name="FOREGROUND" value="fe8019" /> </value> </option> <option name="PY.CLASS_DEFINITION"> <value> <option name="FOREGROUND" value="689d6a" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="PY.DECORATOR"> <value> <option name="FOREGROUND" value="d65d0e" /> </value> </option> <option name="PY.FUNC_DEFINITION"> <value> <option name="FOREGROUND" value="689d6a" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="PY.KEYWORD_ARGUMENT"> <value /> </option> <option name="PY.PREDEFINED_DEFINITION"> <value> <option name="FOREGROUND" value="689d6a" /> </value> </option> <option name="PY.PREDEFINED_USAGE"> <value> <option name="FOREGROUND" value="d3869b" /> </value> </option> <option name="PY.SELF_PARAMETER"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="RDOC_DIRECTIVE"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="RDOC_EMAIL"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="RDOC_HEADINGS"> <value> <option name="FOREGROUND" value="fabd2f" /> </value> </option> <option name="RDOC_IDENTIFIER"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="RDOC_KEYWORD"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="RDOC_URL"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="REST.BOLD" baseAttributes="DEFAULT_IDENTIFIER" /> <option name="REST.FIXED" baseAttributes="DEFAULT_IDENTIFIER" /> <option name="REST.INLINE" baseAttributes="DEFAULT_IDENTIFIER" /> <option name="REST.INTERPRETED" baseAttributes="DEFAULT_IDENTIFIER" /> <option name="REST.ITALIC" baseAttributes="DEFAULT_IDENTIFIER" /> <option name="RHTML_EXPRESSION_END_ID" baseAttributes="XML_TAG_NAME" /> <option name="RHTML_EXPRESSION_START_ID" baseAttributes="XML_TAG_NAME" /> <option name="RHTML_OMIT_NEW_LINE_ID"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="RHTML_SCRIPTING_BACKGROUND_ID" baseAttributes="XML_TAG_NAME" /> <option name="RHTML_SCRIPTLET_END_ID" baseAttributes="XML_TAG_NAME" /> <option name="RHTML_SCRIPTLET_START_ID" baseAttributes="XML_TAG_NAME" /> <option name="RUBY_CONSTANT"> <value> <option name="FOREGROUND" value="fabd2f" /> </value> </option> <option name="RUBY_CONSTANT_DECLARATION"> <value> <option name="FOREGROUND" value="fabd2f" /> </value> </option> <option name="RUBY_EXPR_IN_STRING"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="RUBY_GVAR" baseAttributes="DEFAULT_GLOBAL_VARIABLE" /> <option name="RUBY_HASH_ASSOC"> <value> <option name="FOREGROUND" value="fbf1c7" /> <option name="FONT_TYPE" value="2" /> </value> </option> <option name="RUBY_HEREDOC_CONTENT"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="RUBY_HEREDOC_ID"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="RUBY_LINE_CONTINUATION" baseAttributes="DEFAULT_COMMA" /> <option name="RUBY_LOCAL_VAR_ID" baseAttributes="DEFAULT_LOCAL_VARIABLE" /> <option name="RUBY_METHOD_NAME" baseAttributes="DEFAULT_INSTANCE_METHOD" /> <option name="RUBY_NTH_REF" baseAttributes="DEFAULT_PREDEFINED_SYMBOL" /> <option name="RUBY_PARAMDEF_CALL"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="RUBY_PARAMETER_ID" baseAttributes="DEFAULT_PARAMETER" /> <option name="RUBY_REGEXP"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="RUBY_SPECIFIC_CALL"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="RUBY_SYMBOL"> <value> <option name="FOREGROUND" value="d3869b" /> </value> </option> <option name="Rainbow Parens Level 1 (outermost)"> <value> <option name="FOREGROUND" value="928374" /> </value> </option> <option name="Rainbow Parens Level 2"> <value> <option name="FOREGROUND" value="cc241d" /> </value> </option> <option name="Rainbow Parens Level 3"> <value> <option name="FOREGROUND" value="d65d0e" /> </value> </option> <option name="Rainbow Parens Level 4"> <value> <option name="FOREGROUND" value="98971a" /> </value> </option> <option name="Rainbow Parens Level 5"> <value> <option name="FOREGROUND" value="b16286" /> </value> </option> <option name="Rainbow Parens Level 6"> <value> <option name="FOREGROUND" value="458588" /> </value> </option> <option name="Rainbow Parens Level 7"> <value> <option name="FOREGROUND" value="689d6a" /> </value> </option> <option name="Rainbow Parens Level 8"> <value> <option name="FOREGROUND" value="d79921" /> </value> </option> <option name="Rainbow Parens Level 9"> <value> <option name="FOREGROUND" value="f9f5d7" /> </value> </option> <option name="SASS_MIXIN"> <value> <option name="FOREGROUND" value="fb4934" /> </value> </option> <option name="SEARCH_RESULT_ATTRIBUTES"> <value> <option name="FOREGROUND" value="ebdbb2" /> <option name="BACKGROUND" value="76678" /> <option name="ERROR_STRIPE_COLOR" value="76678" /> </value> </option> <option name="SLIM_FILTER" baseAttributes="DEFAULT_LABEL" /> <option name="SLIM_FILTER_CONTENT" baseAttributes="DEFAULT_TEMPLATE_LANGUAGE_COLOR" /> <option name="SLIM_ID" baseAttributes="CSS.HASH" /> <option name="SLIM_RUBY_CODE" baseAttributes="DEFAULT_TEMPLATE_LANGUAGE_COLOR" /> <option name="SPY-JS.EXCEPTION"> <value> <option name="BACKGROUND" value="4f1b14" /> <option name="EFFECT_TYPE" value="2" /> </value> </option> <option name="SPY-JS.FUNCTION_SCOPE"> <value> <option name="BACKGROUND" value="3c3836" /> <option name="EFFECT_TYPE" value="2" /> </value> </option> <option name="SPY-JS.PATH_LEVEL_ONE"> <value> <option name="BACKGROUND" value="504945" /> <option name="EFFECT_TYPE" value="2" /> </value> </option> <option name="SPY-JS.PATH_LEVEL_TWO"> <value> <option name="BACKGROUND" value="665c54" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="SPY-JS.PROGRAM_SCOPE"> <value> <option name="BACKGROUND" value="32302f" /> <option name="EFFECT_TYPE" value="2" /> </value> </option> <option name="SPY-JS.VALUE_HINT"> <value> <option name="EFFECT_COLOR" value="ebdbb2" /> </value> </option> <option name="STATIC_FIELD_ATTRIBUTES"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="STATIC_FINAL_FIELD_ATTRIBUTES" baseAttributes="STATIC_FIELD_ATTRIBUTES" /> <option name="STATIC_METHOD_ATTRIBUTES"> <value> <option name="FOREGROUND" value="b8bb26" /> </value> </option> <option name="TEMPLATE_VARIABLE_ATTRIBUTES"> <value> <option name="FOREGROUND" value="d5c4a1" /> </value> </option> <option name="TEXT"> <value> <option name="FOREGROUND" value="fbf1c7" /> <option name="BACKGROUND" value="282828" /> </value> </option> <option name="TEXT_SEARCH_RESULT_ATTRIBUTES"> <value> <option name="FOREGROUND" value="ebdbb2" /> <option name="BACKGROUND" value="76678" /> <option name="ERROR_STRIPE_COLOR" value="76678" /> </value> </option> <option name="TODO_DEFAULT_ATTRIBUTES"> <value> <option name="FOREGROUND" value="b8bb26" /> <option name="FONT_TYPE" value="2" /> <option name="ERROR_STRIPE_COLOR" value="a74c0" /> </value> </option> <option name="TS.MODULE_NAME"> <value> <option name="FOREGROUND" value="fabd2f" /> </value> </option> <option name="TS.TYPE_PARAMETER"> <value> <option name="FOREGROUND" value="fabd2f" /> <option name="FONT_TYPE" value="2" /> </value> </option> <option name="TYPE_PARAMETER_NAME_ATTRIBUTES"> <value> <option name="FOREGROUND" value="bfa4a4" /> </value> </option> <option name="TYPO"> <value> <option name="EFFECT_COLOR" value="79740e" /> <option name="EFFECT_TYPE" value="2" /> </value> </option> <option name="UNMATCHED_BRACE_ATTRIBUTES"> <value> <option name="FOREGROUND" value="d1243b" /> </value> </option> <option name="Unresolved reference access" baseAttributes="DEFAULT_IDENTIFIER" /> <option name="WARNING_ATTRIBUTES"> <value> <option name="EFFECT_COLOR" value="fabd2f" /> <option name="ERROR_STRIPE_COLOR" value="fabd2f" /> <option name="EFFECT_TYPE" value="2" /> </value> </option> <option name="WRITE_IDENTIFIER_UNDER_CARET_ATTRIBUTES"> <value> <option name="FOREGROUND" value="ebdbb2" /> <option name="BACKGROUND" value="427b58" /> <option name="ERROR_STRIPE_COLOR" value="427b58" /> </value> </option> <option name="WRITE_SEARCH_RESULT_ATTRIBUTES"> <value> <option name="FOREGROUND" value="ebdbb2" /> <option name="BACKGROUND" value="427b58" /> <option name="ERROR_STRIPE_COLOR" value="427b58" /> </value> </option> <option name="WRONG_REFERENCES_ATTRIBUTES"> <value> <option name="FOREGROUND" value="fb4934" /> <option name="EFFECT_COLOR" value="fb4934" /> <option name="EFFECT_TYPE" value="1" /> </value> </option> <option name="XML_PROLOGUE" baseAttributes="TEXT" /> <option name="XML_TAG_NAME"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> <option name="YAML_SCALAR_KEY"> <value> <option name="FOREGROUND" value="83a598" /> </value> </option> </attributes> </scheme>
{ "pile_set_name": "Github" }
/* * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2019, Red Hat Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ package sun.jvm.hotspot.runtime.aarch64; import java.util.*; import sun.jvm.hotspot.code.*; import sun.jvm.hotspot.compiler.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; import sun.jvm.hotspot.utilities.*; import sun.jvm.hotspot.utilities.Observable; import sun.jvm.hotspot.utilities.Observer; /** Specialization of and implementation of abstract methods of the Frame class for the aarch64 family of CPUs. */ public class AARCH64Frame extends Frame { private static final boolean DEBUG; static { DEBUG = System.getProperty("sun.jvm.hotspot.runtime.aarch64.AARCH64Frame.DEBUG") != null; } // All frames private static final int LINK_OFFSET = 0; private static final int RETURN_ADDR_OFFSET = 1; private static final int SENDER_SP_OFFSET = 2; // Interpreter frames private static final int INTERPRETER_FRAME_SENDER_SP_OFFSET = -1; private static final int INTERPRETER_FRAME_LAST_SP_OFFSET = INTERPRETER_FRAME_SENDER_SP_OFFSET - 1; private static final int INTERPRETER_FRAME_METHOD_OFFSET = INTERPRETER_FRAME_LAST_SP_OFFSET - 1; private static int INTERPRETER_FRAME_MDX_OFFSET; // Non-core builds only private static int INTERPRETER_FRAME_PADDING_OFFSET; private static int INTERPRETER_FRAME_MIRROR_OFFSET; private static int INTERPRETER_FRAME_CACHE_OFFSET; private static int INTERPRETER_FRAME_LOCALS_OFFSET; private static int INTERPRETER_FRAME_BCX_OFFSET; private static int INTERPRETER_FRAME_INITIAL_SP_OFFSET; private static int INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET; private static int INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET; // Entry frames private static int ENTRY_FRAME_CALL_WRAPPER_OFFSET = -8; // Native frames private static final int NATIVE_FRAME_INITIAL_PARAM_OFFSET = 2; private static VMReg fp = new VMReg(29); static { VM.registerVMInitializedObserver(new Observer() { public void update(Observable o, Object data) { initialize(VM.getVM().getTypeDataBase()); } }); } private static synchronized void initialize(TypeDataBase db) { INTERPRETER_FRAME_MDX_OFFSET = INTERPRETER_FRAME_METHOD_OFFSET - 1; INTERPRETER_FRAME_PADDING_OFFSET = INTERPRETER_FRAME_MDX_OFFSET - 1; INTERPRETER_FRAME_MIRROR_OFFSET = INTERPRETER_FRAME_PADDING_OFFSET - 1; INTERPRETER_FRAME_CACHE_OFFSET = INTERPRETER_FRAME_MIRROR_OFFSET - 1; INTERPRETER_FRAME_LOCALS_OFFSET = INTERPRETER_FRAME_CACHE_OFFSET - 1; INTERPRETER_FRAME_BCX_OFFSET = INTERPRETER_FRAME_LOCALS_OFFSET - 1; INTERPRETER_FRAME_INITIAL_SP_OFFSET = INTERPRETER_FRAME_BCX_OFFSET - 1; INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET; INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET; } // an additional field beyond sp and pc: Address raw_fp; // frame pointer private Address raw_unextendedSP; private AARCH64Frame() { } private void adjustForDeopt() { if ( pc != null) { // Look for a deopt pc and if it is deopted convert to original pc CodeBlob cb = VM.getVM().getCodeCache().findBlob(pc); if (cb != null && cb.isJavaMethod()) { NMethod nm = (NMethod) cb; if (pc.equals(nm.deoptHandlerBegin())) { if (Assert.ASSERTS_ENABLED) { Assert.that(this.getUnextendedSP() != null, "null SP in Java frame"); } // adjust pc if frame is deoptimized. pc = this.getUnextendedSP().getAddressAt(nm.origPCOffset()); deoptimized = true; } } } } public AARCH64Frame(Address raw_sp, Address raw_fp, Address pc) { this.raw_sp = raw_sp; this.raw_unextendedSP = raw_sp; this.raw_fp = raw_fp; this.pc = pc; adjustUnextendedSP(); // Frame must be fully constructed before this call adjustForDeopt(); if (DEBUG) { System.out.println("AARCH64Frame(sp, fp, pc): " + this); dumpStack(); } } public AARCH64Frame(Address raw_sp, Address raw_fp) { this.raw_sp = raw_sp; this.raw_unextendedSP = raw_sp; this.raw_fp = raw_fp; // We cannot assume SP[-1] always contains a valid return PC (e.g. if // the callee is a C/C++ compiled frame). If the PC is not known to // Java then this.pc is null. Address savedPC = raw_sp.getAddressAt(-1 * VM.getVM().getAddressSize()); if (VM.getVM().isJavaPCDbg(savedPC)) { this.pc = savedPC; } adjustUnextendedSP(); // Frame must be fully constructed before this call adjustForDeopt(); if (DEBUG) { System.out.println("AARCH64Frame(sp, fp): " + this); dumpStack(); } } public AARCH64Frame(Address raw_sp, Address raw_unextendedSp, Address raw_fp, Address pc) { this.raw_sp = raw_sp; this.raw_unextendedSP = raw_unextendedSp; this.raw_fp = raw_fp; this.pc = pc; adjustUnextendedSP(); // Frame must be fully constructed before this call adjustForDeopt(); if (DEBUG) { System.out.println("AARCH64Frame(sp, unextendedSP, fp, pc): " + this); dumpStack(); } } public Object clone() { AARCH64Frame frame = new AARCH64Frame(); frame.raw_sp = raw_sp; frame.raw_unextendedSP = raw_unextendedSP; frame.raw_fp = raw_fp; frame.pc = pc; frame.deoptimized = deoptimized; return frame; } public boolean equals(Object arg) { if (arg == null) { return false; } if (!(arg instanceof AARCH64Frame)) { return false; } AARCH64Frame other = (AARCH64Frame) arg; return (AddressOps.equal(getSP(), other.getSP()) && AddressOps.equal(getUnextendedSP(), other.getUnextendedSP()) && AddressOps.equal(getFP(), other.getFP()) && AddressOps.equal(getPC(), other.getPC())); } public int hashCode() { if (raw_sp == null) { return 0; } return raw_sp.hashCode(); } public String toString() { return "sp: " + (getSP() == null? "null" : getSP().toString()) + ", unextendedSP: " + (getUnextendedSP() == null? "null" : getUnextendedSP().toString()) + ", fp: " + (getFP() == null? "null" : getFP().toString()) + ", pc: " + (pc == null? "null" : pc.toString()); } // accessors for the instance variables public Address getFP() { return raw_fp; } public Address getSP() { return raw_sp; } public Address getID() { return raw_sp; } // FIXME: not implemented yet public boolean isSignalHandlerFrameDbg() { return false; } public int getSignalNumberDbg() { return 0; } public String getSignalNameDbg() { return null; } public boolean isInterpretedFrameValid() { if (Assert.ASSERTS_ENABLED) { Assert.that(isInterpretedFrame(), "Not an interpreted frame"); } // These are reasonable sanity checks if (getFP() == null || getFP().andWithMask(0x3) != null) { return false; } if (getSP() == null || getSP().andWithMask(0x3) != null) { return false; } if (getFP().addOffsetTo(INTERPRETER_FRAME_INITIAL_SP_OFFSET * VM.getVM().getAddressSize()).lessThan(getSP())) { return false; } // These are hacks to keep us out of trouble. // The problem with these is that they mask other problems if (getFP().lessThanOrEqual(getSP())) { // this attempts to deal with unsigned comparison above return false; } if (getFP().minus(getSP()) > 4096 * VM.getVM().getAddressSize()) { // stack frames shouldn't be large. return false; } return true; } // FIXME: not applicable in current system // void patch_pc(Thread* thread, address pc); public Frame sender(RegisterMap regMap, CodeBlob cb) { AARCH64RegisterMap map = (AARCH64RegisterMap) regMap; if (Assert.ASSERTS_ENABLED) { Assert.that(map != null, "map must be set"); } // Default is we done have to follow them. The sender_for_xxx will // update it accordingly map.setIncludeArgumentOops(false); if (isEntryFrame()) return senderForEntryFrame(map); if (isInterpretedFrame()) return senderForInterpreterFrame(map); if(cb == null) { cb = VM.getVM().getCodeCache().findBlob(getPC()); } else { if (Assert.ASSERTS_ENABLED) { Assert.that(cb.equals(VM.getVM().getCodeCache().findBlob(getPC())), "Must be the same"); } } if (cb != null) { return senderForCompiledFrame(map, cb); } // Must be native-compiled frame, i.e. the marshaling code for native // methods that exists in the core system. return new AARCH64Frame(getSenderSP(), getLink(), getSenderPC()); } private Frame senderForEntryFrame(AARCH64RegisterMap map) { if (DEBUG) { System.out.println("senderForEntryFrame"); } if (Assert.ASSERTS_ENABLED) { Assert.that(map != null, "map must be set"); } // Java frame called from C; skip all C frames and return top C // frame of that chunk as the sender AARCH64JavaCallWrapper jcw = (AARCH64JavaCallWrapper) getEntryFrameCallWrapper(); if (Assert.ASSERTS_ENABLED) { Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero"); Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack"); } AARCH64Frame fr; if (jcw.getLastJavaPC() != null) { fr = new AARCH64Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP(), jcw.getLastJavaPC()); } else { fr = new AARCH64Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP()); } map.clear(); if (Assert.ASSERTS_ENABLED) { Assert.that(map.getIncludeArgumentOops(), "should be set by clear"); } return fr; } //------------------------------------------------------------------------------ // frame::adjust_unextended_sp private void adjustUnextendedSP() { // If we are returning to a compiled MethodHandle call site, the // saved_fp will in fact be a saved value of the unextended SP. The // simplest way to tell whether we are returning to such a call site // is as follows: CodeBlob cb = cb(); NMethod senderNm = (cb == null) ? null : cb.asNMethodOrNull(); if (senderNm != null) { // If the sender PC is a deoptimization point, get the original // PC. For MethodHandle call site the unextended_sp is stored in // saved_fp. if (senderNm.isDeoptMhEntry(getPC())) { // DEBUG_ONLY(verifyDeoptMhOriginalPc(senderNm, getFP())); raw_unextendedSP = getFP(); } else if (senderNm.isDeoptEntry(getPC())) { // DEBUG_ONLY(verifyDeoptOriginalPc(senderNm, raw_unextendedSp)); } else if (senderNm.isMethodHandleReturn(getPC())) { raw_unextendedSP = getFP(); } } } private Frame senderForInterpreterFrame(AARCH64RegisterMap map) { if (DEBUG) { System.out.println("senderForInterpreterFrame"); } Address unextendedSP = addressOfStackSlot(INTERPRETER_FRAME_SENDER_SP_OFFSET).getAddressAt(0); Address sp = addressOfStackSlot(SENDER_SP_OFFSET); // We do not need to update the callee-save register mapping because above // us is either another interpreter frame or a converter-frame, but never // directly a compiled frame. // 11/24/04 SFG. With the removal of adapter frames this is no longer true. // However c2 no longer uses callee save register for java calls so there // are no callee register to find. if (map.getUpdateMap()) updateMapWithSavedLink(map, addressOfStackSlot(LINK_OFFSET)); return new AARCH64Frame(sp, unextendedSP, getLink(), getSenderPC()); } private void updateMapWithSavedLink(RegisterMap map, Address savedFPAddr) { map.setLocation(fp, savedFPAddr); } private Frame senderForCompiledFrame(AARCH64RegisterMap map, CodeBlob cb) { if (DEBUG) { System.out.println("senderForCompiledFrame"); } // // NOTE: some of this code is (unfortunately) duplicated AARCH64CurrentFrameGuess // if (Assert.ASSERTS_ENABLED) { Assert.that(map != null, "map must be set"); } // frame owned by optimizing compiler if (Assert.ASSERTS_ENABLED) { Assert.that(cb.getFrameSize() >= 0, "must have non-zero frame size"); } Address senderSP = getUnextendedSP().addOffsetTo(cb.getFrameSize()); // The return_address is always the word on the stack Address senderPC = senderSP.getAddressAt(-1 * VM.getVM().getAddressSize()); // This is the saved value of FP which may or may not really be an FP. // It is only an FP if the sender is an interpreter frame. Address savedFPAddr = senderSP.addOffsetTo(- SENDER_SP_OFFSET * VM.getVM().getAddressSize()); if (map.getUpdateMap()) { // Tell GC to use argument oopmaps for some runtime stubs that need it. // For C1, the runtime stub might not have oop maps, so set this flag // outside of update_register_map. map.setIncludeArgumentOops(cb.callerMustGCArguments()); if (cb.getOopMaps() != null) { ImmutableOopMapSet.updateRegisterMap(this, cb, map, true); } // Since the prolog does the save and restore of FP there is no oopmap // for it so we must fill in its location as if there was an oopmap entry // since if our caller was compiled code there could be live jvm state in it. updateMapWithSavedLink(map, savedFPAddr); } return new AARCH64Frame(senderSP, savedFPAddr.getAddressAt(0), senderPC); } protected boolean hasSenderPD() { return true; } public long frameSize() { return (getSenderSP().minus(getSP()) / VM.getVM().getAddressSize()); } public Address getLink() { try { if (DEBUG) { System.out.println("Reading link at " + addressOfStackSlot(LINK_OFFSET) + " = " + addressOfStackSlot(LINK_OFFSET).getAddressAt(0)); } return addressOfStackSlot(LINK_OFFSET).getAddressAt(0); } catch (Exception e) { if (DEBUG) System.out.println("Returning null"); return null; } } // FIXME: not implementable yet //inline void frame::set_link(intptr_t* addr) { *(intptr_t **)addr_at(link_offset) = addr; } public Address getUnextendedSP() { return raw_unextendedSP; } // Return address: public Address getSenderPCAddr() { return addressOfStackSlot(RETURN_ADDR_OFFSET); } public Address getSenderPC() { return getSenderPCAddr().getAddressAt(0); } // return address of param, zero origin index. public Address getNativeParamAddr(int idx) { return addressOfStackSlot(NATIVE_FRAME_INITIAL_PARAM_OFFSET + idx); } public Address getSenderSP() { return addressOfStackSlot(SENDER_SP_OFFSET); } public Address addressOfInterpreterFrameLocals() { return addressOfStackSlot(INTERPRETER_FRAME_LOCALS_OFFSET); } private Address addressOfInterpreterFrameBCX() { return addressOfStackSlot(INTERPRETER_FRAME_BCX_OFFSET); } public int getInterpreterFrameBCI() { // FIXME: this is not atomic with respect to GC and is unsuitable // for use in a non-debugging, or reflective, system. Need to // figure out how to express this. Address bcp = addressOfInterpreterFrameBCX().getAddressAt(0); Address methodHandle = addressOfInterpreterFrameMethod().getAddressAt(0); Method method = (Method)Metadata.instantiateWrapperFor(methodHandle); return bcpToBci(bcp, method); } public Address addressOfInterpreterFrameMDX() { return addressOfStackSlot(INTERPRETER_FRAME_MDX_OFFSET); } // FIXME //inline int frame::interpreter_frame_monitor_size() { // return BasicObjectLock::size(); //} // expression stack // (the max_stack arguments are used by the GC; see class FrameClosure) public Address addressOfInterpreterFrameExpressionStack() { Address monitorEnd = interpreterFrameMonitorEnd().address(); return monitorEnd.addOffsetTo(-1 * VM.getVM().getAddressSize()); } public int getInterpreterFrameExpressionStackDirection() { return -1; } // top of expression stack public Address addressOfInterpreterFrameTOS() { return getSP(); } /** Expression stack from top down */ public Address addressOfInterpreterFrameTOSAt(int slot) { return addressOfInterpreterFrameTOS().addOffsetTo(slot * VM.getVM().getAddressSize()); } public Address getInterpreterFrameSenderSP() { if (Assert.ASSERTS_ENABLED) { Assert.that(isInterpretedFrame(), "interpreted frame expected"); } return addressOfStackSlot(INTERPRETER_FRAME_SENDER_SP_OFFSET).getAddressAt(0); } // Monitors public BasicObjectLock interpreterFrameMonitorBegin() { return new BasicObjectLock(addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET)); } public BasicObjectLock interpreterFrameMonitorEnd() { Address result = addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET).getAddressAt(0); if (Assert.ASSERTS_ENABLED) { // make sure the pointer points inside the frame Assert.that(AddressOps.gt(getFP(), result), "result must < than frame pointer"); Assert.that(AddressOps.lte(getSP(), result), "result must >= than stack pointer"); } return new BasicObjectLock(result); } public int interpreterFrameMonitorSize() { return BasicObjectLock.size(); } // Method public Address addressOfInterpreterFrameMethod() { return addressOfStackSlot(INTERPRETER_FRAME_METHOD_OFFSET); } // Constant pool cache public Address addressOfInterpreterFrameCPCache() { return addressOfStackSlot(INTERPRETER_FRAME_CACHE_OFFSET); } // Entry frames public JavaCallWrapper getEntryFrameCallWrapper() { return new AARCH64JavaCallWrapper(addressOfStackSlot(ENTRY_FRAME_CALL_WRAPPER_OFFSET).getAddressAt(0)); } protected Address addressOfSavedOopResult() { // offset is 2 for compiler2 and 3 for compiler1 return getSP().addOffsetTo((VM.getVM().isClientCompiler() ? 2 : 3) * VM.getVM().getAddressSize()); } protected Address addressOfSavedReceiver() { return getSP().addOffsetTo(-4 * VM.getVM().getAddressSize()); } private void dumpStack() { for (Address addr = getSP().addOffsetTo(-4 * VM.getVM().getAddressSize()); AddressOps.lt(addr, getSP()); addr = addr.addOffsetTo(VM.getVM().getAddressSize())) { System.out.println(addr + ": " + addr.getAddressAt(0)); } System.out.println("-----------------------"); for (Address addr = getSP(); AddressOps.lte(addr, getSP().addOffsetTo(20 * VM.getVM().getAddressSize())); addr = addr.addOffsetTo(VM.getVM().getAddressSize())) { System.out.println(addr + ": " + addr.getAddressAt(0)); } } }
{ "pile_set_name": "Github" }
See https://github.com/jbake-org/jbake/issues instead
{ "pile_set_name": "Github" }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT License. // See the LICENSE file in the project root for more information. using System.Reactive.Concurrency; using System.Reactive.Disposables; namespace System.Reactive.Linq.ObservableImpl { internal static class Take<TSource> { internal sealed class Count : Producer<TSource, Count._> { private readonly IObservable<TSource> _source; private readonly int _count; public Count(IObservable<TSource> source, int count) { _source = source; _count = count; } public IObservable<TSource> Combine(int count) { // // Minimum semantics: // // xs --o--o--o--o--o--o--| xs --o--o--o--o--o--o--| // xs.Take(5) --o--o--o--o--o| xs.Take(3) --o--o--o| // xs.Take(5).Take(3) --o--o--o| xs.Take(3).Take(5) --o--o--o| // if (_count <= count) { return this; } return new Count(_source, count); } protected override _ CreateSink(IObserver<TSource> observer) => new _(_count, observer); protected override void Run(_ sink) => sink.Run(_source); internal sealed class _ : IdentitySink<TSource> { private int _remaining; public _(int count, IObserver<TSource> observer) : base(observer) { _remaining = count; } public override void OnNext(TSource value) { if (_remaining > 0) { --_remaining; ForwardOnNext(value); if (_remaining == 0) { ForwardOnCompleted(); } } } } } internal sealed class Time : Producer<TSource, Time._> { private readonly IObservable<TSource> _source; private readonly TimeSpan _duration; internal readonly IScheduler _scheduler; public Time(IObservable<TSource> source, TimeSpan duration, IScheduler scheduler) { _source = source; _duration = duration; _scheduler = scheduler; } public IObservable<TSource> Combine(TimeSpan duration) { // // Minimum semantics: // // t 0--1--2--3--4--5--6--7-> t 0--1--2--3--4--5--6--7-> // // xs --o--o--o--o--o--o--| xs --o--o--o--o--o--o--| // xs.Take(5s) --o--o--o--o--o| xs.Take(3s) --o--o--o| // xs.Take(5s).Take(3s) --o--o--o| xs.Take(3s).Take(5s) --o--o--o| // if (_duration <= duration) { return this; } return new Time(_source, duration, _scheduler); } protected override _ CreateSink(IObserver<TSource> observer) => new _(observer); protected override void Run(_ sink) => sink.Run(this); internal sealed class _ : IdentitySink<TSource> { public _(IObserver<TSource> observer) : base(observer) { } private object _gate; private IDisposable _task; public void Run(Time parent) { _gate = new object(); Disposable.SetSingle(ref _task, parent._scheduler.ScheduleAction(this, parent._duration, state => state.Tick())); Run(parent._source); } protected override void Dispose(bool disposing) { if (disposing) { Disposable.TryDispose(ref _task); } base.Dispose(disposing); } private void Tick() { lock (_gate) { ForwardOnCompleted(); } } public override void OnNext(TSource value) { lock (_gate) { ForwardOnNext(value); } } public override void OnError(Exception error) { lock (_gate) { ForwardOnError(error); } } public override void OnCompleted() { lock (_gate) { ForwardOnCompleted(); } } } } } }
{ "pile_set_name": "Github" }
== Wat is WebWolf WebWolf is een web applicatie die onder jouw controle staat. En die jou als hacker in staat stelt om requests naar deze server te sturen. Daarnaast kun je WebWolf gebruiken als tool bij de oefeningen waarin email wordt gebruikt. Het simuleert je email inbox. WebWolf is bij een aantal opdrachten benodigd. Bv. bij de authentication flaws en de XXE XML Entity Injection voorbeelden. Bij de introductie wordt de email functionaliteit uitgetest en daarmee wordt de totale setup van de workshop uitgetest. De lessen waarbij WebWolf nodig is, zijn gemarkeerd met: {nbsp} image::images/wolf-enabled.png[width=115,height=128] {nbsp} WebWolf heeft de volgende onderdelen: * Hosting van bestanden waarmee URL resources kunnen worden gemaakt * Email inbox * Log van binnenkomende requests die zijn uitgelokt op WebWolf Klik webWolfLink:here[] om WebWolf te starten. Je kunt dan met dezelfde gebruiker inloggen als waarmee je je in WebGoat hebt aangemeld.
{ "pile_set_name": "Github" }
; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> AXFR mutual. @ns4.dns.nic.mutual. +nocomments +nocmd +noquestion +nostats +time=15 ;; global options: +cmd ; Transfer failed.
{ "pile_set_name": "Github" }
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SPARSEQR_MODULE_H #define EIGEN_SPARSEQR_MODULE_H #include "SparseCore" #include "OrderingMethods" #include "src/Core/util/DisableStupidWarnings.h" /** \defgroup SparseQR_Module SparseQR module * \brief Provides QR decomposition for sparse matrices * * This module provides a simplicial version of the left-looking Sparse QR decomposition. * The columns of the input matrix should be reordered to limit the fill-in during the * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list * of built-in and external ordering methods. * * \code * #include <Eigen/SparseQR> * \endcode * * */ #include "OrderingMethods" #include "src/SparseCore/SparseColEtree.h" #include "src/SparseQR/SparseQR.h" #include "src/Core/util/ReenableStupidWarnings.h" #endif
{ "pile_set_name": "Github" }
{ key : value, empty: # empty value↓ }
{ "pile_set_name": "Github" }
/** * @file api_tests.cpp * @copyright defined in eos/LICENSE.txt */ #include <algorithm> #include <random> #include <iostream> #include <vector> #include <iterator> #include <sstream> #include <numeric> #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wsign-compare" #include <boost/test/unit_test.hpp> #pragma GCC diagnostic pop #include <boost/iostreams/concepts.hpp> #include <boost/iostreams/stream_buffer.hpp> #include <boost/algorithm/string/predicate.hpp> #include <eosio/testing/tester.hpp> #include <eosio/chain/exceptions.hpp> #include <eosio/chain/account_object.hpp> #include <eosio/chain/contract_table_objects.hpp> #include <eosio/chain/block_summary_object.hpp> #include <eosio/chain/global_property_object.hpp> #include <eosio/chain/wasm_interface.hpp> #include <eosio/chain/resource_limits.hpp> #include <fc/crypto/digest.hpp> #include <fc/crypto/sha256.hpp> #include <fc/exception/exception.hpp> #include <fc/variant_object.hpp> #include <Inline/BasicTypes.h> #include <IR/Module.h> #include <IR/Validate.h> #include <WAST/WAST.h> #include <WASM/WASM.h> #include <Runtime/Runtime.h> #include <test_api/test_api.wast.hpp> #include <test_api_mem/test_api_mem.wast.hpp> #include <test_api_db/test_api_db.wast.hpp> #include <test_api_multi_index/test_api_multi_index.wast.hpp> #include <eosio.bios/eosio.bios.wast.hpp> #include <eosio.bios/eosio.bios.abi.hpp> #define DISABLE_EOSLIB_SERIALIZE #include <test_api/test_api_common.hpp> FC_REFLECT( dummy_action, (a)(b)(c) ) FC_REFLECT( u128_action, (values) ) FC_REFLECT( cf_action, (payload)(cfd_idx) ) FC_REFLECT( dtt_action, (payer)(deferred_account)(deferred_action)(permission_name)(delay_sec) ) FC_REFLECT( invalid_access_action, (code)(val)(index)(store) ) #ifdef NON_VALIDATING_TEST #define TESTER tester #else #define TESTER validating_tester #endif using namespace eosio; using namespace eosio::testing; using namespace chain; using namespace fc; namespace bio = boost::iostreams; template<uint64_t NAME> struct test_api_action { static account_name get_account() { return N(testapi); } static action_name get_name() { return action_name(NAME); } }; FC_REFLECT_TEMPLATE((uint64_t T), test_api_action<T>, BOOST_PP_SEQ_NIL) template<uint64_t NAME> struct test_chain_action { static account_name get_account() { return account_name(config::system_account_name); } static action_name get_name() { return action_name(NAME); } }; FC_REFLECT_TEMPLATE((uint64_t T), test_chain_action<T>, BOOST_PP_SEQ_NIL) struct check_auth { account_name account; permission_name permission; vector<public_key_type> pubkeys; }; FC_REFLECT(check_auth, (account)(permission)(pubkeys) ) struct test_permission_last_used_action { account_name account; permission_name permission; fc::time_point last_used_time; }; FC_REFLECT( test_permission_last_used_action, (account)(permission)(last_used_time) ) constexpr uint64_t TEST_METHOD(const char* CLASS, const char *METHOD) { return ( (uint64_t(DJBH(CLASS))<<32) | uint32_t(DJBH(METHOD)) ); } string I64Str(int64_t i) { std::stringstream ss; ss << i; return ss.str(); } string U64Str(uint64_t i) { std::stringstream ss; ss << i; return ss.str(); } string U128Str(unsigned __int128 i) { return fc::variant(fc::uint128_t(i)).get_string(); } template <typename T> transaction_trace_ptr CallAction(TESTER& test, T ac, const vector<account_name>& scope = {N(testapi)}) { signed_transaction trx; auto pl = vector<permission_level>{{scope[0], config::active_name}}; if (scope.size() > 1) for (int i = 1; i < scope.size(); i++) pl.push_back({scope[i], config::active_name}); action act(pl, ac); trx.actions.push_back(act); test.set_transaction_headers(trx); auto sigs = trx.sign(test.get_private_key(scope[0], "active"), test.control->get_chain_id()); trx.get_signature_keys(test.control->get_chain_id()); auto res = test.push_transaction(trx); BOOST_CHECK_EQUAL(res->receipt->status, transaction_receipt::executed); test.produce_block(); return res; } template <typename T> transaction_trace_ptr CallFunction(TESTER& test, T ac, const vector<char>& data, const vector<account_name>& scope = {N(testapi)}) { { signed_transaction trx; auto pl = vector<permission_level>{{scope[0], config::active_name}}; if (scope.size() > 1) for (unsigned int i=1; i < scope.size(); i++) pl.push_back({scope[i], config::active_name}); action act(pl, ac); act.data = data; act.authorization = {{N(testapi), config::active_name}}; trx.actions.push_back(act); test.set_transaction_headers(trx, test.DEFAULT_EXPIRATION_DELTA); auto sigs = trx.sign(test.get_private_key(scope[0], "active"), test.control->get_chain_id()); trx.get_signature_keys(test.control->get_chain_id() ); auto res = test.push_transaction(trx); BOOST_CHECK_EQUAL(res->receipt->status, transaction_receipt::executed); test.produce_block(); return res; } } #define CALL_TEST_FUNCTION(_TESTER, CLS, MTH, DATA) CallFunction(_TESTER, test_api_action<TEST_METHOD(CLS, MTH)>{}, DATA) #define CALL_TEST_FUNCTION_SYSTEM(_TESTER, CLS, MTH, DATA) CallFunction(_TESTER, test_chain_action<TEST_METHOD(CLS, MTH)>{}, DATA, {config::system_account_name} ) #define CALL_TEST_FUNCTION_SCOPE(_TESTER, CLS, MTH, DATA, ACCOUNT) CallFunction(_TESTER, test_api_action<TEST_METHOD(CLS, MTH)>{}, DATA, ACCOUNT) #define CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION(_TESTER, CLS, MTH, DATA, EXC, EXC_MESSAGE) \ BOOST_CHECK_EXCEPTION( \ CALL_TEST_FUNCTION( _TESTER, CLS, MTH, DATA), \ EXC, \ [](const EXC& e) { \ return expect_assert_message(e, EXC_MESSAGE); \ } \ ); bool is_access_violation(fc::unhandled_exception const & e) { try { std::rethrow_exception(e.get_inner_exception()); } catch (const eosio::chain::wasm_execution_error& e) { return true; } catch (...) { } return false; } bool is_access_violation(const Runtime::Exception& e) { return true; } bool is_assert_exception(fc::assert_exception const & e) { return true; } bool is_page_memory_error(page_memory_error const &e) { return true; } bool is_unsatisfied_authorization(unsatisfied_authorization const & e) { return true;} bool is_wasm_execution_error(eosio::chain::wasm_execution_error const& e) {return true;} bool is_tx_net_usage_exceeded(const tx_net_usage_exceeded& e) { return true; } bool is_block_net_usage_exceeded(const tx_cpu_usage_exceeded& e) { return true; } bool is_tx_cpu_usage_exceeded(const tx_cpu_usage_exceeded& e) { return true; } bool is_block_cpu_usage_exceeded(const tx_cpu_usage_exceeded& e) { return true; } bool is_deadline_exception(const deadline_exception& e) { return true; } /* * register test suite `api_tests` */ BOOST_AUTO_TEST_SUITE(api_tests) /* * Print capturing stuff */ std::vector<std::string> capture; struct MySink : public bio::sink { std::streamsize write(const char* s, std::streamsize n) { std::string tmp; tmp.assign(s, n); capture.push_back(tmp); std::cout << "stream : [" << tmp << "]" << std::endl; return n; } }; uint32_t last_fnc_err = 0; BOOST_FIXTURE_TEST_CASE(action_receipt_tests, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); create_account( N(testapi2) ); produce_blocks(10); set_code( N(testapi), test_api_wast ); produce_blocks(1); auto res = CALL_TEST_FUNCTION( *this, "test_action", "assert_true", {}); BOOST_REQUIRE_EQUAL(uint32_t(res->action_traces[0].receipt.code_sequence), 1); BOOST_REQUIRE_EQUAL(uint32_t(res->action_traces[0].receipt.abi_sequence), 0); set_code( N(testapi), test_api_db_wast ); set_code( config::system_account_name, test_api_db_wast ); res = CALL_TEST_FUNCTION( *this, "test_db", "primary_i64_general", {}); BOOST_REQUIRE_EQUAL(uint32_t(res->action_traces[0].receipt.code_sequence), 2); BOOST_REQUIRE_EQUAL(uint32_t(res->action_traces[0].receipt.abi_sequence), 0); { signed_transaction trx; auto pl = vector<permission_level>{{config::system_account_name, config::active_name}}; action act(pl, test_chain_action<TEST_METHOD("test_db", "primary_i64_general")>{}); act.authorization = {{config::system_account_name, config::active_name}}; trx.actions.push_back(act); this->set_transaction_headers(trx, this->DEFAULT_EXPIRATION_DELTA); trx.sign(this->get_private_key(config::system_account_name, "active"), control->get_chain_id()); trx.get_signature_keys(control->get_chain_id() ); auto res = this->push_transaction(trx); BOOST_CHECK_EQUAL(res->receipt->status, transaction_receipt::executed); this->produce_block(); BOOST_REQUIRE_EQUAL(uint32_t(res->action_traces[0].receipt.code_sequence), 2); BOOST_REQUIRE_EQUAL(uint32_t(res->action_traces[0].receipt.abi_sequence), 1); } set_code( config::system_account_name, eosio_bios_wast ); set_code( N(testapi), eosio_bios_wast ); set_abi(N(testapi), eosio_bios_abi); set_code( N(testapi), test_api_wast ); res = CALL_TEST_FUNCTION( *this, "test_action", "assert_true", {}); BOOST_REQUIRE_EQUAL(uint32_t(res->action_traces[0].receipt.code_sequence), 4); BOOST_REQUIRE_EQUAL(uint32_t(res->action_traces[0].receipt.abi_sequence), 1); } FC_LOG_AND_RETHROW() } /************************************************************************************* * action_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(action_tests, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); create_account( N(acc1) ); create_account( N(acc2) ); create_account( N(acc3) ); create_account( N(acc4) ); produce_blocks(10); set_code( N(testapi), test_api_wast ); produce_blocks(1); // test assert_true CALL_TEST_FUNCTION( *this, "test_action", "assert_true", {}); //test assert_false BOOST_CHECK_EXCEPTION( CALL_TEST_FUNCTION( *this, "test_action", "assert_false", {} ), eosio_assert_message_exception, eosio_assert_message_is("test_action::assert_false") ); // test read_action_normal dummy_action dummy13{DUMMY_ACTION_DEFAULT_A, DUMMY_ACTION_DEFAULT_B, DUMMY_ACTION_DEFAULT_C}; CALL_TEST_FUNCTION( *this, "test_action", "read_action_normal", fc::raw::pack(dummy13)); // test read_action_to_0 std::vector<char> raw_bytes((1<<16)); CALL_TEST_FUNCTION( *this, "test_action", "read_action_to_0", raw_bytes ); // test read_action_to_0 raw_bytes.resize((1<<16)+1); BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION( *this, "test_action", "read_action_to_0", raw_bytes), eosio::chain::wasm_execution_error, [](const eosio::chain::wasm_execution_error& e) { return expect_assert_message(e, "access violation"); } ); // test read_action_to_64k raw_bytes.resize(1); CALL_TEST_FUNCTION( *this, "test_action", "read_action_to_64k", raw_bytes ); // test read_action_to_64k raw_bytes.resize(3); BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION( *this, "test_action", "read_action_to_64k", raw_bytes ), eosio::chain::wasm_execution_error, [](const eosio::chain::wasm_execution_error& e) { return expect_assert_message(e, "access violation"); } ); // test require_notice auto scope = std::vector<account_name>{N(testapi)}; auto test_require_notice = [this](auto& test, std::vector<char>& data, std::vector<account_name>& scope){ signed_transaction trx; auto tm = test_api_action<TEST_METHOD("test_action", "require_notice")>{}; action act(std::vector<permission_level>{{N(testapi), config::active_name}}, tm); vector<char>& dest = *(vector<char> *)(&act.data); std::copy(data.begin(), data.end(), std::back_inserter(dest)); trx.actions.push_back(act); test.set_transaction_headers(trx); trx.sign(test.get_private_key(N(inita), "active"), control->get_chain_id()); auto res = test.push_transaction(trx); BOOST_CHECK_EQUAL(res->receipt->status, transaction_receipt::executed); }; BOOST_CHECK_EXCEPTION(test_require_notice(*this, raw_bytes, scope), unsatisfied_authorization, [](const unsatisfied_authorization& e) { return expect_assert_message(e, "transaction declares authority"); } ); // test require_auth BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION( *this, "test_action", "require_auth", {}), missing_auth_exception, [](const missing_auth_exception& e) { return expect_assert_message(e, "missing authority of"); } ); // test require_auth auto a3only = std::vector<permission_level>{{N(acc3), config::active_name}}; BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION( *this, "test_action", "require_auth", fc::raw::pack(a3only)), missing_auth_exception, [](const missing_auth_exception& e) { return expect_assert_message(e, "missing authority of"); } ); // test require_auth auto a4only = std::vector<permission_level>{{N(acc4), config::active_name}}; BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION( *this, "test_action", "require_auth", fc::raw::pack(a4only)), missing_auth_exception, [](const missing_auth_exception& e) { return expect_assert_message(e, "missing authority of"); } ); // test require_auth auto a3a4 = std::vector<permission_level>{{N(acc3), config::active_name}, {N(acc4), config::active_name}}; auto a3a4_scope = std::vector<account_name>{N(acc3), N(acc4)}; { signed_transaction trx; auto tm = test_api_action<TEST_METHOD("test_action", "require_auth")>{}; auto pl = a3a4; if (a3a4_scope.size() > 1) for (unsigned int i=1; i < a3a4_scope.size(); i++) pl.push_back({a3a4_scope[i], config::active_name}); action act(pl, tm); auto dat = fc::raw::pack(a3a4); vector<char>& dest = *(vector<char> *)(&act.data); std::copy(dat.begin(), dat.end(), std::back_inserter(dest)); act.authorization = {{N(testapi), config::active_name}, {N(acc3), config::active_name}, {N(acc4), config::active_name}}; trx.actions.push_back(act); set_transaction_headers(trx); trx.sign(get_private_key(N(testapi), "active"), control->get_chain_id()); trx.sign(get_private_key(N(acc3), "active"), control->get_chain_id()); trx.sign(get_private_key(N(acc4), "active"), control->get_chain_id()); auto res = push_transaction(trx); BOOST_CHECK_EQUAL(res->receipt->status, transaction_receipt::executed); } uint64_t now = static_cast<uint64_t>( control->head_block_time().time_since_epoch().count() ); now += config::block_interval_us; CALL_TEST_FUNCTION( *this, "test_action", "test_current_time", fc::raw::pack(now)); // test current_time produce_block(); BOOST_CHECK_EXCEPTION( CALL_TEST_FUNCTION( *this, "test_action", "test_current_time", fc::raw::pack(now) ), eosio_assert_message_exception, eosio_assert_message_is("tmp == current_time()") ); // test test_current_receiver CALL_TEST_FUNCTION( *this, "test_action", "test_current_receiver", fc::raw::pack(N(testapi))); // test send_action_sender CALL_TEST_FUNCTION( *this, "test_transaction", "send_action_sender", fc::raw::pack(N(testapi))); produce_block(); // test_publication_time uint64_t pub_time = static_cast<uint64_t>( control->head_block_time().time_since_epoch().count() ); pub_time += config::block_interval_us; CALL_TEST_FUNCTION( *this, "test_action", "test_publication_time", fc::raw::pack(pub_time) ); // test test_abort BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION( *this, "test_action", "test_abort", {} ), abort_called, [](const fc::exception& e) { return expect_assert_message(e, "abort() called"); } ); dummy_action da = { DUMMY_ACTION_DEFAULT_A, DUMMY_ACTION_DEFAULT_B, DUMMY_ACTION_DEFAULT_C }; CallAction(*this, da); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } // test require_recipient loop (doesn't cause infinite loop) BOOST_FIXTURE_TEST_CASE(require_notice_tests, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); create_account( N(acc5) ); produce_blocks(1); set_code( N(testapi), test_api_wast ); set_code( N(acc5), test_api_wast ); produce_blocks(1); // test require_notice signed_transaction trx; auto tm = test_api_action<TEST_METHOD( "test_action", "require_notice_tests" )>{}; action act( std::vector<permission_level>{{N( testapi ), config::active_name}}, tm ); trx.actions.push_back( act ); set_transaction_headers( trx ); trx.sign( get_private_key( N( testapi ), "active" ), control->get_chain_id() ); auto res = push_transaction( trx ); BOOST_CHECK_EQUAL( res->receipt->status, transaction_receipt::executed ); } FC_LOG_AND_RETHROW() } BOOST_FIXTURE_TEST_CASE(ram_billing_in_notify_tests, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); create_account( N(testapi2) ); produce_blocks(10); set_code( N(testapi), test_api_wast ); produce_blocks(1); set_code( N(testapi2), test_api_wast ); produce_blocks(1); BOOST_CHECK_EXCEPTION( CALL_TEST_FUNCTION( *this, "test_action", "test_ram_billing_in_notify", fc::raw::pack( ((unsigned __int128)N(testapi2) << 64) | N(testapi) ) ), subjective_block_production_exception, fc_exception_message_is("Cannot charge RAM to other accounts during notify.") ); CALL_TEST_FUNCTION( *this, "test_action", "test_ram_billing_in_notify", fc::raw::pack( ((unsigned __int128)N(testapi2) << 64) | 0 ) ); CALL_TEST_FUNCTION( *this, "test_action", "test_ram_billing_in_notify", fc::raw::pack( ((unsigned __int128)N(testapi2) << 64) | N(testapi2) ) ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * context free action tests *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(cf_action_tests, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); create_account( N(dummy) ); produce_blocks(10); set_code( N(testapi), test_api_wast ); produce_blocks(1); cf_action cfa; signed_transaction trx; set_transaction_headers(trx); // need at least one normal action BOOST_CHECK_EXCEPTION(push_transaction(trx), tx_no_auths, [](const fc::assert_exception& e) { return expect_assert_message(e, "transaction must have at least one authorization"); } ); action act({}, cfa); trx.context_free_actions.push_back(act); trx.context_free_data.emplace_back(fc::raw::pack<uint32_t>(100)); // verify payload matches context free data trx.context_free_data.emplace_back(fc::raw::pack<uint32_t>(200)); set_transaction_headers(trx); // signing a transaction with only context_free_actions should not be allowed // auto sigs = trx.sign(get_private_key(N(testapi), "active"), control->get_chain_id()); BOOST_CHECK_EXCEPTION(push_transaction(trx), tx_no_auths, [](const fc::exception& e) { return expect_assert_message(e, "transaction must have at least one authorization"); } ); trx.signatures.clear(); // add a normal action along with cfa dummy_action da = { DUMMY_ACTION_DEFAULT_A, DUMMY_ACTION_DEFAULT_B, DUMMY_ACTION_DEFAULT_C }; auto pl = vector<permission_level>{{N(testapi), config::active_name}}; action act1(pl, da); trx.actions.push_back(act1); set_transaction_headers(trx); // run normal passing case auto sigs = trx.sign(get_private_key(N(testapi), "active"), control->get_chain_id()); auto res = push_transaction(trx); BOOST_CHECK_EQUAL(res->receipt->status, transaction_receipt::executed); // attempt to access context free api in non context free action da = { DUMMY_ACTION_DEFAULT_A, 200, DUMMY_ACTION_DEFAULT_C }; action act2(pl, da); trx.signatures.clear(); trx.actions.clear(); trx.actions.push_back(act2); set_transaction_headers(trx); // run (dummy_action.b = 200) case looking for invalid use of context_free api sigs = trx.sign(get_private_key(N(testapi), "active"), control->get_chain_id()); BOOST_CHECK_EXCEPTION(push_transaction(trx), unaccessible_api, [](const fc::exception& e) { return expect_assert_message(e, "this API may only be called from context_free apply"); } ); { // back to normal action action act1(pl, da); signed_transaction trx; trx.context_free_actions.push_back(act); trx.context_free_data.emplace_back(fc::raw::pack<uint32_t>(100)); // verify payload matches context free data trx.context_free_data.emplace_back(fc::raw::pack<uint32_t>(200)); trx.actions.push_back(act1); // attempt to access non context free api for (uint32_t i = 200; i <= 211; ++i) { trx.context_free_actions.clear(); trx.context_free_data.clear(); cfa.payload = i; cfa.cfd_idx = 1; action cfa_act({}, cfa); trx.context_free_actions.emplace_back(cfa_act); trx.signatures.clear(); set_transaction_headers(trx); sigs = trx.sign(get_private_key(N(testapi), "active"), control->get_chain_id()); BOOST_CHECK_EXCEPTION(push_transaction(trx), unaccessible_api, [](const fc::exception& e) { return expect_assert_message(e, "only context free api's can be used in this context" ); } ); } } produce_block(); // test send context free action auto ttrace = CALL_TEST_FUNCTION( *this, "test_transaction", "send_cf_action", {} ); BOOST_CHECK_EQUAL(ttrace->action_traces.size(), 1); BOOST_CHECK_EQUAL(ttrace->action_traces[0].inline_traces.size(), 1); BOOST_CHECK_EQUAL(ttrace->action_traces[0].inline_traces[0].receipt.receiver, account_name("dummy")); BOOST_CHECK_EQUAL(ttrace->action_traces[0].inline_traces[0].act.account, account_name("dummy")); BOOST_CHECK_EQUAL(ttrace->action_traces[0].inline_traces[0].act.name, account_name("event1")); BOOST_CHECK_EQUAL(ttrace->action_traces[0].inline_traces[0].act.authorization.size(), 0); BOOST_CHECK_EXCEPTION( CALL_TEST_FUNCTION( *this, "test_transaction", "send_cf_action_fail", {} ), eosio_assert_message_exception, eosio_assert_message_is("context free actions cannot have authorizations") ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } BOOST_FIXTURE_TEST_CASE(cfa_tx_signature, TESTER) try { action cfa({}, cf_action()); signed_transaction tx1; tx1.context_free_data.emplace_back(fc::raw::pack<uint32_t>(100)); tx1.context_free_actions.push_back(cfa); set_transaction_headers(tx1); signed_transaction tx2; tx2.context_free_data.emplace_back(fc::raw::pack<uint32_t>(200)); tx2.context_free_actions.push_back(cfa); set_transaction_headers(tx2); const private_key_type& priv_key = get_private_key("dummy", "active"); BOOST_TEST((std::string)tx1.sign(priv_key, control->get_chain_id()) != (std::string)tx2.sign(priv_key, control->get_chain_id())); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(cfa_stateful_api, TESTER) try { create_account( N(testapi) ); produce_blocks(1); set_code( N(testapi), test_api_wast ); account_name a = N(testapi2); account_name creator = config::system_account_name; signed_transaction trx; trx.actions.emplace_back( vector<permission_level>{{creator,config::active_name}}, newaccount{ .creator = creator, .name = a, .owner = authority( get_public_key( a, "owner" ) ), .active = authority( get_public_key( a, "active" ) ) }); action act({}, test_api_action<TEST_METHOD("test_transaction", "stateful_api")>{}); trx.context_free_actions.push_back(act); set_transaction_headers(trx); trx.sign( get_private_key( creator, "active" ), control->get_chain_id() ); BOOST_CHECK_EXCEPTION(push_transaction( trx ), fc::exception, [&](const fc::exception &e) { return expect_assert_message(e, "only context free api's can be used in this context"); }); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(deferred_cfa_failed, TESTER) try { create_account( N(testapi) ); produce_blocks(1); set_code( N(testapi), test_api_wast ); account_name a = N(testapi2); account_name creator = config::system_account_name; signed_transaction trx; trx.actions.emplace_back( vector<permission_level>{{creator,config::active_name}}, newaccount{ .creator = creator, .name = a, .owner = authority( get_public_key( a, "owner" ) ), .active = authority( get_public_key( a, "active" ) ) }); action act({}, test_api_action<TEST_METHOD("test_transaction", "stateful_api")>{}); trx.context_free_actions.push_back(act); set_transaction_headers(trx, 10, 2); trx.sign( get_private_key( creator, "active" ), control->get_chain_id() ); BOOST_CHECK_EXCEPTION(push_transaction( trx ), fc::exception, [&](const fc::exception &e) { return expect_assert_message(e, "only context free api's can be used in this context"); }); produce_blocks(10); // CFA failed, testapi2 not created create_account( N(testapi2) ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() BOOST_FIXTURE_TEST_CASE(deferred_cfa_success, TESTER) try { create_account( N(testapi) ); produce_blocks(1); set_code( N(testapi), test_api_wast ); account_name a = N(testapi2); account_name creator = config::system_account_name; signed_transaction trx; trx.actions.emplace_back( vector<permission_level>{{creator,config::active_name}}, newaccount{ .creator = creator, .name = a, .owner = authority( get_public_key( a, "owner" ) ), .active = authority( get_public_key( a, "active" ) ) }); action act({}, test_api_action<TEST_METHOD("test_transaction", "context_free_api")>{}); trx.context_free_actions.push_back(act); set_transaction_headers(trx, 10, 2); trx.sign( get_private_key( creator, "active" ), control->get_chain_id() ); auto trace = push_transaction( trx ); BOOST_REQUIRE(trace != nullptr); if (trace) { BOOST_REQUIRE_EQUAL(transaction_receipt_header::status_enum::delayed, trace->receipt->status); BOOST_REQUIRE_EQUAL(1, trace->action_traces.size()); } produce_blocks(10); // CFA success, testapi2 created BOOST_CHECK_EXCEPTION(create_account( N(testapi2) ), fc::exception, [&](const fc::exception &e) { return expect_assert_message(e, "Cannot create account named testapi2, as that name is already taken"); }); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() /************************************************************************************* * checktime_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(checktime_pass_tests, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); produce_blocks(10); set_code( N(testapi), test_api_wast ); produce_blocks(1); // test checktime_pass CALL_TEST_FUNCTION( *this, "test_checktime", "checktime_pass", {}); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } template<class T> void call_test(TESTER& test, T ac, uint32_t billed_cpu_time_us , uint32_t max_cpu_usage_ms = 200 ) { signed_transaction trx; auto pl = vector<permission_level>{{N(testapi), config::active_name}}; action act(pl, ac); trx.actions.push_back(act); test.set_transaction_headers(trx); //trx.max_cpu_usage_ms = max_cpu_usage_ms; auto sigs = trx.sign(test.get_private_key(N(testapi), "active"), test.control->get_chain_id()); trx.get_signature_keys(test.control->get_chain_id() ); auto res = test.push_transaction( trx, fc::time_point::now() + fc::milliseconds(max_cpu_usage_ms), billed_cpu_time_us ); BOOST_CHECK_EQUAL(res->receipt->status, transaction_receipt::executed); test.produce_block(); }; BOOST_AUTO_TEST_CASE(checktime_fail_tests) { try { TESTER t; t.produce_blocks(2); ilog( "create account" ); t.create_account( N(testapi) ); ilog( "set code" ); t.set_code( N(testapi), test_api_wast ); ilog( "produce block" ); t.produce_blocks(1); int64_t x; int64_t net; int64_t cpu; t.control->get_resource_limits_manager().get_account_limits( N(testapi), x, net, cpu ); wdump((net)(cpu)); #warning TODO call the contract before testing to cache it, and validate that it was cached BOOST_CHECK_EXCEPTION( call_test( t, test_api_action<TEST_METHOD("test_checktime", "checktime_failure")>{}, 5000 ), deadline_exception, is_deadline_exception ); BOOST_CHECK_EXCEPTION( call_test( t, test_api_action<TEST_METHOD("test_checktime", "checktime_failure")>{}, 0 ), tx_cpu_usage_exceeded, is_tx_cpu_usage_exceeded ); uint32_t time_left_in_block_us = config::default_max_block_cpu_usage - config::default_min_transaction_cpu_usage; std::string dummy_string = "nonce"; uint32_t increment = config::default_max_transaction_cpu_usage / 3; for( auto i = 0; time_left_in_block_us > 2*increment; ++i ) { t.push_dummy( N(testapi), dummy_string + std::to_string(i), increment ); time_left_in_block_us -= increment; } BOOST_CHECK_EXCEPTION( call_test( t, test_api_action<TEST_METHOD("test_checktime", "checktime_failure")>{}, 0 ), block_cpu_usage_exceeded, is_block_cpu_usage_exceeded ); BOOST_REQUIRE_EQUAL( t.validate(), true ); } FC_LOG_AND_RETHROW() } BOOST_FIXTURE_TEST_CASE(checktime_intrinsic, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); produce_blocks(10); std::stringstream ss; ss << R"CONTRACT( (module (type $FUNCSIG$vij (func (param i32 i64))) (type $FUNCSIG$j (func (result i64))) (type $FUNCSIG$vjj (func (param i64 i64))) (type $FUNCSIG$vii (func (param i32 i32))) (type $FUNCSIG$i (func (result i32))) (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func )) (type $_1 (func (param i64 i64 i64))) (export "apply" (func $apply)) (import "env" "memmove" (func $memmove (param i32 i32 i32) (result i32))) (import "env" "printui" (func $printui (param i64))) (memory $0 1) (func $apply (type $_1) (param $0 i64) (param $1 i64) (param $2 i64) (drop (grow_memory (i32.const 527))) (call $printui (i64.const 11)) )CONTRACT"; for(unsigned int i = 0; i < 5000; ++i) { ss << R"CONTRACT( (drop (call $memmove (i32.const 1) (i32.const 9) (i32.const 33554432) )) )CONTRACT"; } ss<< "))"; set_code( N(testapi), ss.str().c_str() ); produce_blocks(1); //initialize cache BOOST_CHECK_EXCEPTION( call_test( *this, test_api_action<TEST_METHOD("doesn't matter", "doesn't matter")>{}, 5000, 10 ), deadline_exception, is_deadline_exception ); #warning TODO validate that the contract was successfully cached //it will always call BOOST_CHECK_EXCEPTION( call_test( *this, test_api_action<TEST_METHOD("doesn't matter", "doesn't matter")>{}, 5000, 10 ), deadline_exception, is_deadline_exception ); } FC_LOG_AND_RETHROW() } BOOST_FIXTURE_TEST_CASE(checktime_hashing_fail, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); produce_blocks(10); set_code( N(testapi), test_api_wast ); produce_blocks(1); //hit deadline exception, but cache the contract BOOST_CHECK_EXCEPTION( call_test( *this, test_api_action<TEST_METHOD("test_checktime", "checktime_sha1_failure")>{}, 5000, 10 ), deadline_exception, is_deadline_exception ); #warning TODO validate that the contract was successfully cached //the contract should be cached, now we should get deadline_exception because of calls to checktime() from hashing function BOOST_CHECK_EXCEPTION( call_test( *this, test_api_action<TEST_METHOD("test_checktime", "checktime_sha1_failure")>{}, 5000, 10 ), deadline_exception, is_deadline_exception ); BOOST_CHECK_EXCEPTION( call_test( *this, test_api_action<TEST_METHOD("test_checktime", "checktime_assert_sha1_failure")>{}, 5000, 10 ), deadline_exception, is_deadline_exception ); BOOST_CHECK_EXCEPTION( call_test( *this, test_api_action<TEST_METHOD("test_checktime", "checktime_sha256_failure")>{}, 5000, 10 ), deadline_exception, is_deadline_exception ); BOOST_CHECK_EXCEPTION( call_test( *this, test_api_action<TEST_METHOD("test_checktime", "checktime_assert_sha256_failure")>{}, 5000, 10 ), deadline_exception, is_deadline_exception ); BOOST_CHECK_EXCEPTION( call_test( *this, test_api_action<TEST_METHOD("test_checktime", "checktime_sha512_failure")>{}, 5000, 10 ), deadline_exception, is_deadline_exception ); BOOST_CHECK_EXCEPTION( call_test( *this, test_api_action<TEST_METHOD("test_checktime", "checktime_assert_sha512_failure")>{}, 5000, 10 ), deadline_exception, is_deadline_exception ); BOOST_CHECK_EXCEPTION( call_test( *this, test_api_action<TEST_METHOD("test_checktime", "checktime_ripemd160_failure")>{}, 5000, 10 ), deadline_exception, is_deadline_exception ); BOOST_CHECK_EXCEPTION( call_test( *this, test_api_action<TEST_METHOD("test_checktime", "checktime_assert_ripemd160_failure")>{}, 5000, 10 ), deadline_exception, is_deadline_exception ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * compiler_builtins_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(compiler_builtins_tests, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); produce_blocks(10); set_code( N(testapi), test_api_wast ); produce_blocks(1); // test test_multi3 CALL_TEST_FUNCTION( *this, "test_compiler_builtins", "test_multi3", {}); // test test_divti3 CALL_TEST_FUNCTION( *this, "test_compiler_builtins", "test_divti3", {}); // test test_divti3_by_0 BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION( *this, "test_compiler_builtins", "test_divti3_by_0", {}), arithmetic_exception, [](const fc::exception& e) { return expect_assert_message(e, "divide by zero"); } ); // test test_udivti3 CALL_TEST_FUNCTION( *this, "test_compiler_builtins", "test_udivti3", {}); // test test_udivti3_by_0 BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION( *this, "test_compiler_builtins", "test_udivti3_by_0", {}), arithmetic_exception, [](const fc::exception& e) { return expect_assert_message(e, "divide by zero"); } ); // test test_modti3 CALL_TEST_FUNCTION( *this, "test_compiler_builtins", "test_modti3", {}); // test test_modti3_by_0 BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION( *this, "test_compiler_builtins", "test_modti3_by_0", {}), arithmetic_exception, [](const fc::exception& e) { return expect_assert_message(e, "divide by zero"); } ); // test test_lshlti3 CALL_TEST_FUNCTION( *this, "test_compiler_builtins", "test_lshlti3", {}); // test test_lshrti3 CALL_TEST_FUNCTION( *this, "test_compiler_builtins", "test_lshrti3", {}); // test test_ashlti3 CALL_TEST_FUNCTION( *this, "test_compiler_builtins", "test_ashlti3", {}); // test test_ashrti3 CALL_TEST_FUNCTION( *this, "test_compiler_builtins", "test_ashrti3", {}); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * transaction_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(transaction_tests, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); produce_blocks(100); set_code( N(testapi), test_api_wast ); produce_blocks(1); // test for zero auth { signed_transaction trx; auto tm = test_api_action<TEST_METHOD("test_action", "require_auth")>{}; action act({}, tm); trx.actions.push_back(act); set_transaction_headers(trx); BOOST_CHECK_EXCEPTION(push_transaction(trx), transaction_exception, [](const fc::exception& e) { return expect_assert_message(e, "transaction must have at least one authorization"); } ); } // test send_action CALL_TEST_FUNCTION(*this, "test_transaction", "send_action", {}); // test send_action_empty CALL_TEST_FUNCTION(*this, "test_transaction", "send_action_empty", {}); // test send_action_large BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION(*this, "test_transaction", "send_action_large", {}), inline_action_too_big, [](const fc::exception& e) { return expect_assert_message(e, "inline action too big"); } ); // test send_action_inline_fail BOOST_CHECK_EXCEPTION( CALL_TEST_FUNCTION(*this, "test_transaction", "send_action_inline_fail", {}), eosio_assert_message_exception, eosio_assert_message_is("test_action::assert_false") ); // test send_transaction CALL_TEST_FUNCTION(*this, "test_transaction", "send_transaction", {}); // test send_transaction_empty BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION(*this, "test_transaction", "send_transaction_empty", {}), tx_no_auths, [](const fc::exception& e) { return expect_assert_message(e, "transaction must have at least one authorization"); } ); { produce_blocks(10); transaction_trace_ptr trace; auto c = control->applied_transaction.connect([&]( const transaction_trace_ptr& t) { if (t && t->receipt && t->receipt->status != transaction_receipt::executed) { trace = t; } } ); // test error handling on deferred transaction failure CALL_TEST_FUNCTION(*this, "test_transaction", "send_transaction_trigger_error_handler", {}); BOOST_REQUIRE(trace); BOOST_CHECK_EQUAL(trace->receipt->status, transaction_receipt::soft_fail); c.disconnect(); } // test test_transaction_size CALL_TEST_FUNCTION(*this, "test_transaction", "test_transaction_size", fc::raw::pack(54) ); // TODO: Need a better way to test this. // test test_read_transaction // this is a bit rough, but I couldn't figure out a better way to compare the hashes auto tx_trace = CALL_TEST_FUNCTION( *this, "test_transaction", "test_read_transaction", {} ); string sha_expect = tx_trace->id; BOOST_CHECK_EQUAL(tx_trace->action_traces.front().console == sha_expect, true); // test test_tapos_block_num CALL_TEST_FUNCTION(*this, "test_transaction", "test_tapos_block_num", fc::raw::pack(control->head_block_num()) ); // test test_tapos_block_prefix CALL_TEST_FUNCTION(*this, "test_transaction", "test_tapos_block_prefix", fc::raw::pack(control->head_block_id()._hash[1]) ); // test send_action_recurse BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION(*this, "test_transaction", "send_action_recurse", {}), eosio::chain::transaction_exception, [](const eosio::chain::transaction_exception& e) { return expect_assert_message(e, "max inline action depth per transaction reached"); } ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } BOOST_FIXTURE_TEST_CASE(deferred_transaction_tests, TESTER) { try { produce_blocks(2); create_accounts( {N(testapi), N(testapi2), N(alice)} ); set_code( N(testapi), test_api_wast ); set_code( N(testapi2), test_api_wast ); produce_blocks(1); //schedule { transaction_trace_ptr trace; auto c = control->applied_transaction.connect([&]( const transaction_trace_ptr& t) { if (t->scheduled) { trace = t; } } ); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {} ); BOOST_CHECK(!trace); produce_block( fc::seconds(2) ); //check that it gets executed afterwards BOOST_REQUIRE(trace); //confirm printed message BOOST_TEST(!trace->action_traces.empty()); BOOST_TEST(trace->action_traces.back().console == "deferred executed\n"); c.disconnect(); } produce_blocks(10); //schedule twice without replace_existing flag (second deferred transaction should replace first one) { transaction_trace_ptr trace; uint32_t count = 0; auto c = control->applied_transaction.connect([&]( const transaction_trace_ptr& t) { if (t && t->scheduled) { trace = t; ++count; } } ); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {}); BOOST_CHECK_THROW(CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {}), deferred_tx_duplicate); produce_blocks( 3 ); //check that only one deferred transaction executed auto dtrxs = control->get_scheduled_transactions(); BOOST_CHECK_EQUAL(dtrxs.size(), 1); for (const auto& trx: dtrxs) { control->push_scheduled_transaction(trx, fc::time_point::maximum()); } BOOST_CHECK_EQUAL(1, count); BOOST_REQUIRE(trace); BOOST_CHECK_EQUAL( 1, trace->action_traces.size() ); c.disconnect(); } produce_blocks(10); #warning re-enable deferred transaction replacement test after bug has been fixed #if 0 //schedule twice with replace_existing flag (second deferred transaction should replace first one) { transaction_trace_ptr trace; uint32_t count = 0; auto c = control->applied_transaction.connect([&]( const transaction_trace_ptr& t) { if (t && t->scheduled) { trace = t; ++count; } } ); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction_replace", {}); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction_replace", {}); produce_blocks( 3 ); //check that only one deferred transaction executed auto dtrxs = control->get_scheduled_transactions(); BOOST_CHECK_EQUAL(dtrxs.size(), 1); for (const auto& trx: dtrxs) { control->push_scheduled_transaction(trx, fc::time_point::maximum()); } BOOST_CHECK_EQUAL(1, count); BOOST_CHECK(trace); BOOST_CHECK_EQUAL( 1, trace->action_traces.size() ); c.disconnect(); } #endif produce_blocks(10); //schedule and cancel { transaction_trace_ptr trace; auto c = control->applied_transaction.connect([&]( const transaction_trace_ptr& t) { if (t && t->scheduled) { trace = t; } } ); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_transaction", {}); CALL_TEST_FUNCTION(*this, "test_transaction", "cancel_deferred_transaction_success", {}); produce_block( fc::seconds(2) ); BOOST_CHECK(!trace); c.disconnect(); } produce_blocks(10); //cancel_deferred() return zero if no scheduled transaction found { CALL_TEST_FUNCTION(*this, "test_transaction", "cancel_deferred_transaction_not_found", {}); } produce_blocks(10); //repeated deferred transactions { vector<transaction_trace_ptr> traces; auto c = control->applied_transaction.connect([&]( const transaction_trace_ptr& t) { if (t && t->scheduled) { traces.push_back( t ); } } ); CALL_TEST_FUNCTION(*this, "test_transaction", "repeat_deferred_transaction", fc::raw::pack( (uint32_t)5 ) ); produce_block(); c.disconnect(); BOOST_CHECK_EQUAL( traces.size(), 5 ); } produce_blocks(10); { // Trigger a tx which in turn sends a deferred tx with payer != receiver // Payer is alice in this case, this tx should fail since we don't have the authorization of alice dtt_action dtt_act1; dtt_act1.payer = N(alice); BOOST_CHECK_THROW(CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_tx_with_dtt_action", fc::raw::pack(dtt_act1)), missing_auth_exception); // Send a tx which in turn sends a deferred tx with the deferred tx's receiver != this tx receiver // This will include the authorization of the receiver, and impose any related delay associated with the authority // We set the authorization delay to be 10 sec here, and since the deferred tx delay is set to be 5 sec, so this tx should fail dtt_action dtt_act2; dtt_act2.deferred_account = N(testapi2); dtt_act2.permission_name = N(additional); dtt_act2.delay_sec = 5; auto auth = authority(get_public_key("testapi", name(dtt_act2.permission_name).to_string()), 10); auth.accounts.push_back( permission_level_weight{{N(testapi), config::eosio_code_name}, 1} ); push_action(config::system_account_name, updateauth::get_name(), "testapi", fc::mutable_variant_object() ("account", "testapi") ("permission", name(dtt_act2.permission_name)) ("parent", "active") ("auth", auth) ); push_action(config::system_account_name, linkauth::get_name(), "testapi", fc::mutable_variant_object() ("account", "testapi") ("code", name(dtt_act2.deferred_account)) ("type", name(dtt_act2.deferred_action)) ("requirement", name(dtt_act2.permission_name))); BOOST_CHECK_THROW(CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_tx_with_dtt_action", fc::raw::pack(dtt_act2)), unsatisfied_authorization); // But if the deferred transaction has a sufficient delay, then it should work. dtt_act2.delay_sec = 10; CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_tx_with_dtt_action", fc::raw::pack(dtt_act2)); // Meanwhile, if the deferred tx receiver == this tx receiver, the delay will be ignored, this tx should succeed dtt_action dtt_act3; dtt_act3.deferred_account = N(testapi); dtt_act3.permission_name = N(additional); push_action(config::system_account_name, linkauth::get_name(), "testapi", fc::mutable_variant_object() ("account", "testapi") ("code", name(dtt_act3.deferred_account)) ("type", name(dtt_act3.deferred_action)) ("requirement", name(dtt_act3.permission_name))); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_tx_with_dtt_action", fc::raw::pack(dtt_act3)); //will replace existing transaction // If we make testapi account to be priviledged account: // - the deferred transaction will work no matter who is the payer // - the deferred transaction will not care about the delay of the authorization push_action(config::system_account_name, N(setpriv), config::system_account_name, mutable_variant_object() ("account", "testapi") ("is_priv", 1)); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_tx_with_dtt_action", fc::raw::pack(dtt_act1)); CALL_TEST_FUNCTION(*this, "test_transaction", "send_deferred_tx_with_dtt_action", fc::raw::pack(dtt_act2)); } BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } template <uint64_t NAME> struct setprod_act { static account_name get_account() { return N(config::system_account_name); } static action_name get_name() { return action_name(NAME); } }; /************************************************************************************* * chain_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(chain_tests, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); vector<account_name> producers = { N(inita), N(initb), N(initc), N(initd), N(inite), N(initf), N(initg), N(inith), N(initi), N(initj), N(initk), N(initl), N(initm), N(initn), N(inito), N(initp), N(initq), N(initr), N(inits), N(initt), N(initu) }; create_accounts( producers ); set_producers (producers ); set_code( N(testapi), test_api_wast ); produce_blocks(100); vector<account_name> prods( control->active_producers().producers.size() ); for ( uint32_t i = 0; i < prods.size(); i++ ) { prods[i] = control->active_producers().producers[i].producer_name; } CALL_TEST_FUNCTION( *this, "test_chain", "test_activeprods", fc::raw::pack(prods) ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * db_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(db_tests, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); create_account( N(testapi2) ); produce_blocks(10); set_code( N(testapi), test_api_db_wast ); set_code( N(testapi2), test_api_db_wast ); produce_blocks(1); CALL_TEST_FUNCTION( *this, "test_db", "primary_i64_general", {}); CALL_TEST_FUNCTION( *this, "test_db", "primary_i64_lowerbound", {}); CALL_TEST_FUNCTION( *this, "test_db", "primary_i64_upperbound", {}); CALL_TEST_FUNCTION( *this, "test_db", "idx64_general", {}); CALL_TEST_FUNCTION( *this, "test_db", "idx64_lowerbound", {}); CALL_TEST_FUNCTION( *this, "test_db", "idx64_upperbound", {}); // Store value in primary table invalid_access_action ia1{.code = N(testapi), .val = 10, .index = 0, .store = true}; auto res = push_action( action({{N(testapi), config::active_name}}, N(testapi), WASM_TEST_ACTION("test_db", "test_invalid_access"), fc::raw::pack(ia1)), N(testapi) ); BOOST_CHECK_EQUAL( res, success() ); // Attempt to change the value stored in the primary table under the code of N(testapi) invalid_access_action ia2{.code = ia1.code, .val = 20, .index = 0, .store = true}; res = push_action( action({{N(testapi2), config::active_name}}, N(testapi2), WASM_TEST_ACTION("test_db", "test_invalid_access"), fc::raw::pack(ia2)), N(testapi2) ); wdump((res)); BOOST_CHECK_EQUAL( boost::algorithm::ends_with(res, "db access violation"), true ); // Verify that the value has not changed. ia1.store = false; res = push_action( action({{N(testapi), config::active_name}}, N(testapi), WASM_TEST_ACTION("test_db", "test_invalid_access"), fc::raw::pack(ia1)), N(testapi) ); BOOST_CHECK_EQUAL( res, success() ); // Store value in secondary table ia1.store = true; ia1.index = 1; res = push_action( action({{N(testapi), config::active_name}}, N(testapi), WASM_TEST_ACTION("test_db", "test_invalid_access"), fc::raw::pack(ia1)), N(testapi) ); BOOST_CHECK_EQUAL( res, success() ); // Attempt to change the value stored in the secondary table under the code of N(testapi) ia2.index = 1; res = push_action( action({{N(testapi2), config::active_name}}, N(testapi2), WASM_TEST_ACTION("test_db", "test_invalid_access"), fc::raw::pack(ia2)), N(testapi2) ); BOOST_CHECK_EQUAL( boost::algorithm::ends_with(res, "db access violation"), true ); // Verify that the value has not changed. ia1.store = false; res = push_action( action({{N(testapi), config::active_name}}, N(testapi), WASM_TEST_ACTION("test_db", "test_invalid_access"), fc::raw::pack(ia1)), N(testapi) ); BOOST_CHECK_EQUAL( res, success() ); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_db", "idx_double_nan_create_fail", {}, transaction_exception, "NaN is not an allowed value for a secondary key"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_db", "idx_double_nan_modify_fail", {}, transaction_exception, "NaN is not an allowed value for a secondary key"); uint32_t lookup_type = 0; // 0 for find, 1 for lower bound, and 2 for upper bound; CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_db", "idx_double_nan_lookup_fail", fc::raw::pack(lookup_type), transaction_exception, "NaN is not an allowed value for a secondary key"); lookup_type = 1; CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_db", "idx_double_nan_lookup_fail", fc::raw::pack(lookup_type), transaction_exception, "NaN is not an allowed value for a secondary key"); lookup_type = 2; CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_db", "idx_double_nan_lookup_fail", fc::raw::pack(lookup_type), transaction_exception, "NaN is not an allowed value for a secondary key"); CALL_TEST_FUNCTION( *this, "test_db", "misaligned_secondary_key256_tests", {}); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * multi_index_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(multi_index_tests, TESTER) { try { produce_blocks(1); create_account( N(testapi) ); produce_blocks(1); set_code( N(testapi), test_api_multi_index_wast ); produce_blocks(1); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx64_general", {}); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx64_store_only", {}); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx64_check_without_storing", {}); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx128_general", {}); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx128_store_only", {}); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx128_check_without_storing", {}); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx128_autoincrement_test", {}); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx128_autoincrement_test_part1", {}); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx128_autoincrement_test_part2", {}); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx256_general", {}); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx_double_general", {}); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx_long_double_general", {}); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_pk_iterator_exceed_end", {}, eosio_assert_message_exception, "cannot increment end iterator"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_sk_iterator_exceed_end", {}, eosio_assert_message_exception, "cannot increment end iterator"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_pk_iterator_exceed_begin", {}, eosio_assert_message_exception, "cannot decrement iterator at beginning of table"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_sk_iterator_exceed_begin", {}, eosio_assert_message_exception, "cannot decrement iterator at beginning of index"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_pass_pk_ref_to_other_table", {}, eosio_assert_message_exception, "object passed to iterator_to is not in multi_index"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_pass_sk_ref_to_other_table", {}, eosio_assert_message_exception, "object passed to iterator_to is not in multi_index"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_pass_pk_end_itr_to_iterator_to", {}, eosio_assert_message_exception, "object passed to iterator_to is not in multi_index"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_pass_pk_end_itr_to_modify", {}, eosio_assert_message_exception, "cannot pass end iterator to modify"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_pass_pk_end_itr_to_erase", {}, eosio_assert_message_exception, "cannot pass end iterator to erase"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_pass_sk_end_itr_to_iterator_to", {}, eosio_assert_message_exception, "object passed to iterator_to is not in multi_index"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_pass_sk_end_itr_to_modify", {}, eosio_assert_message_exception, "cannot pass end iterator to modify"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_pass_sk_end_itr_to_erase", {}, eosio_assert_message_exception, "cannot pass end iterator to erase"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_modify_primary_key", {}, eosio_assert_message_exception, "updater cannot change primary key when modifying an object"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_run_out_of_avl_pk", {}, eosio_assert_message_exception, "next primary key in table is at autoincrement limit"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_require_find_fail", {}, eosio_assert_message_exception, "unable to find key"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_require_find_fail_with_msg", {}, eosio_assert_message_exception, "unable to find primary key in require_find"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_require_find_sk_fail", {}, eosio_assert_message_exception, "unable to find secondary key"); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_multi_index", "idx64_require_find_sk_fail_with_msg", {}, eosio_assert_message_exception, "unable to find sec key"); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx64_sk_cache_pk_lookup", {}); CALL_TEST_FUNCTION( *this, "test_multi_index", "idx64_pk_cache_sk_lookup", {}); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * fixedpoint_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(fixedpoint_tests, TESTER) { try { produce_blocks(2); create_account( N(testapi) ); produce_blocks(10); set_code( N(testapi), test_api_wast ); produce_blocks(10); CALL_TEST_FUNCTION( *this, "test_fixedpoint", "create_instances", {}); CALL_TEST_FUNCTION( *this, "test_fixedpoint", "test_addition", {}); CALL_TEST_FUNCTION( *this, "test_fixedpoint", "test_subtraction", {}); CALL_TEST_FUNCTION( *this, "test_fixedpoint", "test_multiplication", {}); CALL_TEST_FUNCTION( *this, "test_fixedpoint", "test_division", {}); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_fixedpoint", "test_division_by_0", {}, eosio_assert_message_exception, "divide by zero" ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * crypto_tests test cases *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(crypto_tests, TESTER) { try { produce_blocks(1000); create_account(N(testapi) ); produce_blocks(1000); set_code(N(testapi), test_api_wast); produce_blocks(1000); { signed_transaction trx; auto pl = vector<permission_level>{{N(testapi), config::active_name}}; action act(pl, test_api_action<TEST_METHOD("test_crypto", "test_recover_key")>{}); auto signatures = trx.sign(get_private_key(N(testapi), "active"), control->get_chain_id()); produce_block(); auto payload = fc::raw::pack( trx.sig_digest( control->get_chain_id() ) ); auto pk = fc::raw::pack( get_public_key( N(testapi), "active" ) ); auto sigs = fc::raw::pack( signatures ); payload.insert( payload.end(), pk.begin(), pk.end() ); payload.insert( payload.end(), sigs.begin(), sigs.end() ); CALL_TEST_FUNCTION( *this, "test_crypto", "test_recover_key", payload ); CALL_TEST_FUNCTION( *this, "test_crypto", "test_recover_key_assert_true", payload ); payload[payload.size()-1] = 0; BOOST_CHECK_EXCEPTION( CALL_TEST_FUNCTION( *this, "test_crypto", "test_recover_key_assert_false", payload ), crypto_api_exception, fc_exception_message_is("Error expected key different than recovered key") ); } CALL_TEST_FUNCTION( *this, "test_crypto", "test_sha1", {} ); CALL_TEST_FUNCTION( *this, "test_crypto", "test_sha256", {} ); CALL_TEST_FUNCTION( *this, "test_crypto", "test_sha512", {} ); CALL_TEST_FUNCTION( *this, "test_crypto", "test_ripemd160", {} ); CALL_TEST_FUNCTION( *this, "test_crypto", "sha1_no_data", {} ); CALL_TEST_FUNCTION( *this, "test_crypto", "sha256_no_data", {} ); CALL_TEST_FUNCTION( *this, "test_crypto", "sha512_no_data", {} ); CALL_TEST_FUNCTION( *this, "test_crypto", "ripemd160_no_data", {} ); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_crypto", "assert_sha256_false", {}, crypto_api_exception, "hash mismatch" ); CALL_TEST_FUNCTION( *this, "test_crypto", "assert_sha256_true", {} ); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_crypto", "assert_sha1_false", {}, crypto_api_exception, "hash mismatch" ); CALL_TEST_FUNCTION( *this, "test_crypto", "assert_sha1_true", {} ); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_crypto", "assert_sha512_false", {}, crypto_api_exception, "hash mismatch" ); CALL_TEST_FUNCTION( *this, "test_crypto", "assert_sha512_true", {} ); CALL_TEST_FUNCTION_AND_CHECK_EXCEPTION( *this, "test_crypto", "assert_ripemd160_false", {}, crypto_api_exception, "hash mismatch" ); CALL_TEST_FUNCTION( *this, "test_crypto", "assert_ripemd160_true", {} ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * memory_tests test cases *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(memory_tests, TESTER) { try { produce_blocks(1000); create_account(N(testapi) ); produce_blocks(1000); set_code(N(testapi), test_api_mem_wast); produce_blocks(1000); CALL_TEST_FUNCTION( *this, "test_memory", "test_memory_allocs", {} ); produce_blocks(1000); CALL_TEST_FUNCTION( *this, "test_memory", "test_memory_hunk", {} ); produce_blocks(1000); CALL_TEST_FUNCTION( *this, "test_memory", "test_memory_hunks", {} ); produce_blocks(1000); //Disabling this for now as it fails due to malloc changes for variable wasm max memory sizes #if 0 CALL_TEST_FUNCTION( *this, "test_memory", "test_memory_hunks_disjoint", {} ); produce_blocks(1000); #endif CALL_TEST_FUNCTION( *this, "test_memory", "test_memset_memcpy", {} ); produce_blocks(1000); BOOST_CHECK_THROW( CALL_TEST_FUNCTION( *this, "test_memory", "test_memcpy_overlap_start", {} ), overlapping_memory_error ); produce_blocks(1000); BOOST_CHECK_THROW( CALL_TEST_FUNCTION( *this, "test_memory", "test_memcpy_overlap_end", {} ), overlapping_memory_error ); produce_blocks(1000); CALL_TEST_FUNCTION( *this, "test_memory", "test_memcmp", {} ); produce_blocks(1000); #define test_memory_oob(func) \ try { \ CALL_TEST_FUNCTION( *this, "test_memory", func, {} ); \ BOOST_FAIL("assert failed in test out of bound memory in " func); \ } catch (...) { \ BOOST_REQUIRE_EQUAL(true, true); \ } #define test_memory_oob2(func) \ try { \ CALL_TEST_FUNCTION( *this, "test_memory", func, {} );\ } catch (const fc::exception& e) {\ if (!expect_assert_message(e, "access violation")) throw; \ } test_memory_oob("test_outofbound_0"); test_memory_oob("test_outofbound_1"); test_memory_oob("test_outofbound_2"); test_memory_oob("test_outofbound_3"); test_memory_oob("test_outofbound_4"); test_memory_oob("test_outofbound_5"); test_memory_oob("test_outofbound_6"); test_memory_oob("test_outofbound_7"); test_memory_oob("test_outofbound_8"); test_memory_oob("test_outofbound_9"); test_memory_oob("test_outofbound_10"); test_memory_oob("test_outofbound_11"); test_memory_oob("test_outofbound_12"); test_memory_oob("test_outofbound_13"); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * extended_memory_tests test cases *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(extended_memory_test_initial_memory, TESTER) { try { produce_blocks(1000); create_account(N(testapi) ); produce_blocks(1000); set_code(N(testapi), test_api_mem_wast); produce_blocks(1000); CALL_TEST_FUNCTION( *this, "test_extended_memory", "test_initial_buffer", {} ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } BOOST_FIXTURE_TEST_CASE(extended_memory_test_page_memory, TESTER) { try { produce_blocks(1000); create_account(N(testapi) ); produce_blocks(1000); set_code(N(testapi), test_api_mem_wast); produce_blocks(1000); CALL_TEST_FUNCTION( *this, "test_extended_memory", "test_page_memory", {} ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } BOOST_FIXTURE_TEST_CASE(extended_memory_test_page_memory_exceeded, TESTER) { try { produce_blocks(1000); create_account(N(testapi) ); produce_blocks(1000); set_code(N(testapi), test_api_mem_wast); produce_blocks(1000); CALL_TEST_FUNCTION( *this, "test_extended_memory", "test_page_memory_exceeded", {} ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } BOOST_FIXTURE_TEST_CASE(extended_memory_test_page_memory_negative_bytes, TESTER) { try { produce_blocks(1000); create_account(N(testapi) ); produce_blocks(1000); set_code(N(testapi), test_api_mem_wast); produce_blocks(1000); CALL_TEST_FUNCTION( *this, "test_extended_memory", "test_page_memory_negative_bytes", {} ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * print_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(print_tests, TESTER) { try { produce_blocks(2); create_account(N(testapi) ); produce_blocks(1000); set_code(N(testapi), test_api_wast); produce_blocks(1000); string captured = ""; // test prints auto tx1_trace = CALL_TEST_FUNCTION( *this, "test_print", "test_prints", {} ); auto tx1_act_cnsl = tx1_trace->action_traces.front().console; BOOST_CHECK_EQUAL(tx1_act_cnsl == "abcefg", true); // test prints_l auto tx2_trace = CALL_TEST_FUNCTION( *this, "test_print", "test_prints_l", {} ); auto tx2_act_cnsl = tx2_trace->action_traces.front().console; BOOST_CHECK_EQUAL(tx2_act_cnsl == "abatest", true); // test printi auto tx3_trace = CALL_TEST_FUNCTION( *this, "test_print", "test_printi", {} ); auto tx3_act_cnsl = tx3_trace->action_traces.front().console; BOOST_CHECK_EQUAL( tx3_act_cnsl.substr(0,1), I64Str(0) ); BOOST_CHECK_EQUAL( tx3_act_cnsl.substr(1,6), I64Str(556644) ); BOOST_CHECK_EQUAL( tx3_act_cnsl.substr(7, std::string::npos), I64Str(-1) ); // test printui auto tx4_trace = CALL_TEST_FUNCTION( *this, "test_print", "test_printui", {} ); auto tx4_act_cnsl = tx4_trace->action_traces.front().console; BOOST_CHECK_EQUAL( tx4_act_cnsl.substr(0,1), U64Str(0) ); BOOST_CHECK_EQUAL( tx4_act_cnsl.substr(1,6), U64Str(556644) ); BOOST_CHECK_EQUAL( tx4_act_cnsl.substr(7, std::string::npos), U64Str(-1) ); // "18446744073709551615" // test printn auto tx5_trace = CALL_TEST_FUNCTION( *this, "test_print", "test_printn", {} ); auto tx5_act_cnsl = tx5_trace->action_traces.front().console; BOOST_CHECK_EQUAL( tx5_act_cnsl.substr(0,5), "abcde" ); BOOST_CHECK_EQUAL( tx5_act_cnsl.substr(5, 5), "ab.de" ); BOOST_CHECK_EQUAL( tx5_act_cnsl.substr(10, 6), "1q1q1q"); BOOST_CHECK_EQUAL( tx5_act_cnsl.substr(16, 11), "abcdefghijk"); BOOST_CHECK_EQUAL( tx5_act_cnsl.substr(27, 12), "abcdefghijkl"); BOOST_CHECK_EQUAL( tx5_act_cnsl.substr(39, 13), "abcdefghijkl1"); BOOST_CHECK_EQUAL( tx5_act_cnsl.substr(52, 13), "abcdefghijkl1"); BOOST_CHECK_EQUAL( tx5_act_cnsl.substr(65, 13), "abcdefghijkl1"); // test printi128 auto tx6_trace = CALL_TEST_FUNCTION( *this, "test_print", "test_printi128", {} ); auto tx6_act_cnsl = tx6_trace->action_traces.front().console; size_t start = 0; size_t end = tx6_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx6_act_cnsl.substr(start, end-start), U128Str(1) ); start = end + 1; end = tx6_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx6_act_cnsl.substr(start, end-start), U128Str(0) ); start = end + 1; end = tx6_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx6_act_cnsl.substr(start, end-start), "-" + U128Str(static_cast<unsigned __int128>(std::numeric_limits<__int128>::lowest())) ); start = end + 1; end = tx6_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx6_act_cnsl.substr(start, end-start), "-" + U128Str(87654323456) ); // test printui128 auto tx7_trace = CALL_TEST_FUNCTION( *this, "test_print", "test_printui128", {} ); auto tx7_act_cnsl = tx7_trace->action_traces.front().console; start = 0; end = tx7_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx7_act_cnsl.substr(start, end-start), U128Str(std::numeric_limits<unsigned __int128>::max()) ); start = end + 1; end = tx7_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx7_act_cnsl.substr(start, end-start), U128Str(0) ); start = end + 1; end = tx7_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx7_act_cnsl.substr(start, end-start), U128Str(87654323456) ); // test printsf auto tx8_trace = CALL_TEST_FUNCTION( *this, "test_print", "test_printsf", {} ); auto tx8_act_cnsl = tx8_trace->action_traces.front().console; start = 0; end = tx8_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx8_act_cnsl.substr(start, end-start), "5.000000e-01" ); start = end + 1; end = tx8_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx8_act_cnsl.substr(start, end-start), "-3.750000e+00" ); start = end + 1; end = tx8_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx8_act_cnsl.substr(start, end-start), "6.666667e-07" ); // test printdf auto tx9_trace = CALL_TEST_FUNCTION( *this, "test_print", "test_printdf", {} ); auto tx9_act_cnsl = tx9_trace->action_traces.front().console; start = 0; end = tx9_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx9_act_cnsl.substr(start, end-start), "5.000000000000000e-01" ); start = end + 1; end = tx9_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx9_act_cnsl.substr(start, end-start), "-3.750000000000000e+00" ); start = end + 1; end = tx9_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx9_act_cnsl.substr(start, end-start), "6.666666666666666e-07" ); // test printqf auto tx10_trace = CALL_TEST_FUNCTION( *this, "test_print", "test_printqf", {} ); auto tx10_act_cnsl = tx10_trace->action_traces.front().console; start = 0; end = tx10_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx10_act_cnsl.substr(start, end-start), "5.000000000000000000e-01" ); start = end + 1; end = tx10_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx10_act_cnsl.substr(start, end-start), "-3.750000000000000000e+00" ); start = end + 1; end = tx10_act_cnsl.find('\n', start); BOOST_CHECK_EQUAL( tx10_act_cnsl.substr(start, end-start), "6.666666666666666667e-07" ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * types_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(types_tests, TESTER) { try { produce_blocks(1000); create_account( N(testapi) ); produce_blocks(1000); set_code( N(testapi), test_api_wast ); produce_blocks(1000); CALL_TEST_FUNCTION( *this, "test_types", "types_size", {}); CALL_TEST_FUNCTION( *this, "test_types", "char_to_symbol", {}); CALL_TEST_FUNCTION( *this, "test_types", "string_to_name", {}); CALL_TEST_FUNCTION( *this, "test_types", "name_class", {}); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * permission_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(permission_tests, TESTER) { try { produce_blocks(1); create_account( N(testapi) ); produce_blocks(1); set_code( N(testapi), test_api_wast ); produce_blocks(1); auto get_result_int64 = [&]() -> int64_t { const auto& db = control->db(); const auto* t_id = db.find<table_id_object, by_code_scope_table>(boost::make_tuple(N(testapi), N(testapi), N(testapi))); FC_ASSERT(t_id != 0, "Table id not found"); const auto& idx = db.get_index<key_value_index, by_scope_primary>(); auto itr = idx.lower_bound(boost::make_tuple(t_id->id)); FC_ASSERT( itr != idx.end() && itr->t_id == t_id->id, "lower_bound failed"); FC_ASSERT( 0 != itr->value.size(), "unexpected result size"); return *reinterpret_cast<const int64_t *>(itr->value.data()); }; CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { .account = N(testapi), .permission = N(active), .pubkeys = { get_public_key(N(testapi), "active") } }) ); BOOST_CHECK_EQUAL( int64_t(1), get_result_int64() ); CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { .account = N(testapi), .permission = N(active), .pubkeys = { public_key_type(string("EOS7GfRtyDWWgxV88a5TRaYY59XmHptyfjsFmHHfioGNJtPjpSmGX")) } }) ); BOOST_CHECK_EQUAL( int64_t(0), get_result_int64() ); CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { .account = N(testapi), .permission = N(active), .pubkeys = { get_public_key(N(testapi), "active"), public_key_type(string("EOS7GfRtyDWWgxV88a5TRaYY59XmHptyfjsFmHHfioGNJtPjpSmGX")) } }) ); BOOST_CHECK_EQUAL( int64_t(0), get_result_int64() ); // Failure due to irrelevant signatures CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { .account = N(noname), .permission = N(active), .pubkeys = { get_public_key(N(testapi), "active") } }) ); BOOST_CHECK_EQUAL( int64_t(0), get_result_int64() ); CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { .account = N(testapi), .permission = N(active), .pubkeys = {} }) ); BOOST_CHECK_EQUAL( int64_t(0), get_result_int64() ); CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { .account = N(testapi), .permission = N(noname), .pubkeys = { get_public_key(N(testapi), "active") } }) ); BOOST_CHECK_EQUAL( int64_t(0), get_result_int64() ); /* BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION( *this, "test_permission", "check_authorization", fc::raw::pack( check_auth { .account = N(testapi), .permission = N(noname), .pubkeys = { get_public_key(N(testapi), "active") } })), fc::exception, [](const fc::exception& e) { return expect_assert_message(e, "unknown key"); } ); */ } FC_LOG_AND_RETHROW() } #if 0 /************************************************************************************* * privileged_tests test case *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(privileged_tests, tester) { try { produce_blocks(2); create_account( N(testapi) ); create_account( N(acc1) ); produce_blocks(100); set_code( N(testapi), test_api_wast ); produce_blocks(1); { signed_transaction trx; auto pl = vector<permission_level>{{config::system_account_name, config::active_name}}; action act(pl, test_chain_action<N(setprods)>()); vector<producer_key> prod_keys = { { N(inita), get_public_key( N(inita), "active" ) }, { N(initb), get_public_key( N(initb), "active" ) }, { N(initc), get_public_key( N(initc), "active" ) }, { N(initd), get_public_key( N(initd), "active" ) }, { N(inite), get_public_key( N(inite), "active" ) }, { N(initf), get_public_key( N(initf), "active" ) }, { N(initg), get_public_key( N(initg), "active" ) }, { N(inith), get_public_key( N(inith), "active" ) }, { N(initi), get_public_key( N(initi), "active" ) }, { N(initj), get_public_key( N(initj), "active" ) }, { N(initk), get_public_key( N(initk), "active" ) }, { N(initl), get_public_key( N(initl), "active" ) }, { N(initm), get_public_key( N(initm), "active" ) }, { N(initn), get_public_key( N(initn), "active" ) }, { N(inito), get_public_key( N(inito), "active" ) }, { N(initp), get_public_key( N(initp), "active" ) }, { N(initq), get_public_key( N(initq), "active" ) }, { N(initr), get_public_key( N(initr), "active" ) }, { N(inits), get_public_key( N(inits), "active" ) }, { N(initt), get_public_key( N(initt), "active" ) }, { N(initu), get_public_key( N(initu), "active" ) } }; vector<char> data = fc::raw::pack(uint32_t(0)); vector<char> keys = fc::raw::pack(prod_keys); data.insert( data.end(), keys.begin(), keys.end() ); act.data = data; trx.actions.push_back(act); set_tapos(trx); auto sigs = trx.sign(get_private_key(config::system_account_name, "active"), control->get_chain_id()); trx.get_signature_keys(control->get_chain_id() ); auto res = push_transaction(trx); BOOST_CHECK_EQUAL(res.status, transaction_receipt::executed); } CALL_TEST_FUNCTION( *this, "test_privileged", "test_is_privileged", {} ); BOOST_CHECK_EXCEPTION( CALL_TEST_FUNCTION( *this, "test_privileged", "test_is_privileged", {} ), transaction_exception, [](const fc::exception& e) { return expect_assert_message(e, "context.privileged: testapi does not have permission to call this API"); } ); } FC_LOG_AND_RETHROW() } #endif /************************************************************************************* * real_tests test cases *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(datastream_tests, TESTER) { try { produce_blocks(1000); create_account(N(testapi) ); produce_blocks(1000); set_code(N(testapi), test_api_wast); produce_blocks(1000); CALL_TEST_FUNCTION( *this, "test_datastream", "test_basic", {} ); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * new api feature test *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(new_api_feature_tests, TESTER) { try { produce_blocks(1); create_account(N(testapi) ); produce_blocks(1); set_code(N(testapi), test_api_wast); produce_blocks(1); BOOST_CHECK_EXCEPTION( CALL_TEST_FUNCTION( *this, "test_transaction", "new_feature", {} ), unaccessible_api, [](const fc::exception& e) { return expect_assert_message(e, "testapi does not have permission to call this API"); }); BOOST_CHECK_EXCEPTION( CALL_TEST_FUNCTION( *this, "test_transaction", "active_new_feature", {} ), unaccessible_api, [](const fc::exception& e) { return expect_assert_message(e, "testapi does not have permission to call this API"); }); // change privilege push_action(config::system_account_name, N(setpriv), config::system_account_name, mutable_variant_object() ("account", "testapi") ("is_priv", 1)); CALL_TEST_FUNCTION( *this, "test_transaction", "new_feature", {} ); BOOST_CHECK_EXCEPTION( CALL_TEST_FUNCTION( *this, "test_transaction", "active_new_feature", {} ), unsupported_feature, [](const fc::exception& e) { return expect_assert_message(e, "Unsupported Hardfork Detected"); }); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * permission_usage_tests test cases *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(permission_usage_tests, TESTER) { try { produce_block(); create_accounts( {N(testapi), N(alice), N(bob)} ); produce_block(); set_code(N(testapi), test_api_wast); produce_block(); push_reqauth( N(alice), {{N(alice), config::active_name}}, {get_private_key(N(alice), "active")} ); CALL_TEST_FUNCTION( *this, "test_permission", "test_permission_last_used", fc::raw::pack(test_permission_last_used_action{ N(alice), config::active_name, control->pending_block_time() }) ); // Fails because the last used time is updated after the transaction executes. BOOST_CHECK_THROW( CALL_TEST_FUNCTION( *this, "test_permission", "test_permission_last_used", fc::raw::pack(test_permission_last_used_action{ N(testapi), config::active_name, control->head_block_time() + fc::milliseconds(config::block_interval_ms) }) ), eosio_assert_message_exception ); produce_blocks(5); set_authority( N(bob), N(perm1), authority( get_private_key(N(bob), "perm1").get_public_key() ) ); push_action(config::system_account_name, linkauth::get_name(), N(bob), fc::mutable_variant_object() ("account", "bob") ("code", "eosio") ("type", "reqauth") ("requirement", "perm1") ); auto permission_creation_time = control->pending_block_time(); produce_blocks(5); CALL_TEST_FUNCTION( *this, "test_permission", "test_permission_last_used", fc::raw::pack(test_permission_last_used_action{ N(bob), N(perm1), permission_creation_time }) ); produce_blocks(5); push_reqauth( N(bob), {{N(bob), N(perm1)}}, {get_private_key(N(bob), "perm1")} ); auto perm1_last_used_time = control->pending_block_time(); CALL_TEST_FUNCTION( *this, "test_permission", "test_permission_last_used", fc::raw::pack(test_permission_last_used_action{ N(bob), config::active_name, permission_creation_time }) ); BOOST_CHECK_THROW( CALL_TEST_FUNCTION( *this, "test_permission", "test_permission_last_used", fc::raw::pack(test_permission_last_used_action{ N(bob), N(perm1), permission_creation_time }) ), eosio_assert_message_exception ); CALL_TEST_FUNCTION( *this, "test_permission", "test_permission_last_used", fc::raw::pack(test_permission_last_used_action{ N(bob), N(perm1), perm1_last_used_time }) ); produce_block(); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * account_creation_time_tests test cases *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(account_creation_time_tests, TESTER) { try { produce_block(); create_account( N(testapi) ); produce_block(); set_code(N(testapi), test_api_wast); produce_block(); create_account( N(alice) ); auto alice_creation_time = control->pending_block_time(); produce_blocks(10); CALL_TEST_FUNCTION( *this, "test_permission", "test_account_creation_time", fc::raw::pack(test_permission_last_used_action{ N(alice), config::active_name, alice_creation_time }) ); produce_block(); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } /************************************************************************************* * eosio_assert_code_tests test cases *************************************************************************************/ BOOST_FIXTURE_TEST_CASE(eosio_assert_code_tests, TESTER) { try { produce_block(); create_account( N(testapi) ); produce_block(); set_code(N(testapi), test_api_wast); const char* abi_string = R"=====( { "version": "eosio::abi/1.0", "types": [], "structs": [], "actions": [], "tables": [], "ricardian_clauses": [], "error_messages": [ {"error_code": 1, "error_msg": "standard error message" }, {"error_code": 42, "error_msg": "The answer to life, the universe, and everything."} ] "abi_extensions": [] } )====="; set_abi( N(testapi), abi_string ); auto var = fc::json::from_string(abi_string); abi_serializer abis(var.as<abi_def>(), abi_serializer_max_time); produce_blocks(10); BOOST_CHECK_EXCEPTION( CALL_TEST_FUNCTION( *this, "test_action", "test_assert_code", fc::raw::pack((uint64_t)42) ), eosio_assert_code_exception, eosio_assert_code_is(42) ); produce_block(); auto omsg1 = abis.get_error_message(1); BOOST_REQUIRE_EQUAL( omsg1.valid(), true ); BOOST_CHECK_EQUAL( *omsg1, "standard error message" ); auto omsg2 = abis.get_error_message(2); BOOST_CHECK_EQUAL( omsg2.valid(), false ); auto omsg3 = abis.get_error_message(42); BOOST_REQUIRE_EQUAL( omsg3.valid(), true ); BOOST_CHECK_EQUAL( *omsg3, "The answer to life, the universe, and everything." ); produce_block(); BOOST_REQUIRE_EQUAL( validate(), true ); } FC_LOG_AND_RETHROW() } BOOST_AUTO_TEST_SUITE_END()
{ "pile_set_name": "Github" }
@import '../../style/variables.less'; button, input[type=button] { &.button { cursor: pointer; outline: none; padding: 1em; background: @color-primary; color: white; border: none; border-radius: 4px; font-size: 1em; font-weight: bold; text-transform: uppercase; &:hover { color: @color-linkColorHover; } &.invert { background: white; border: 2px solid @color-primary; color: @color-primary; &:hover { color: lighten(@color-primary, 20%); } } } }
{ "pile_set_name": "Github" }
/* * Xilinx SPI driver * * supports 8 bit SPI transfers only, with or w/o FIFO * * based on bfin_spi.c, by way of altera_spi.c * Copyright (c) 2005-2008 Analog Devices Inc. * Copyright (c) 2010 Thomas Chou <[email protected]> * Copyright (c) 2010 Graeme Smecher <[email protected]> * Copyright (c) 2012 Stephan Linz <[email protected]> * * Licensed under the GPL-2 or later. * * [0]: http://www.xilinx.com/support/documentation * * [S]: [0]/ip_documentation/xps_spi.pdf * [0]/ip_documentation/axi_spi_ds742.pdf */ #include <config.h> #include <common.h> #include <malloc.h> #include <spi.h> #include "xilinx_spi.h" #ifndef CONFIG_SYS_XILINX_SPI_LIST #define CONFIG_SYS_XILINX_SPI_LIST { CONFIG_SYS_SPI_BASE } #endif #ifndef CONFIG_XILINX_SPI_IDLE_VAL #define CONFIG_XILINX_SPI_IDLE_VAL 0xff #endif #define XILSPI_SPICR_DFLT_ON (SPICR_MANUAL_SS | \ SPICR_MASTER_MODE | \ SPICR_SPE) #define XILSPI_SPICR_DFLT_OFF (SPICR_MASTER_INHIBIT | \ SPICR_MANUAL_SS) #define XILSPI_MAX_XFER_BITS 8 static unsigned long xilinx_spi_base_list[] = CONFIG_SYS_XILINX_SPI_LIST; __attribute__((weak)) int spi_cs_is_valid(unsigned int bus, unsigned int cs) { return bus < ARRAY_SIZE(xilinx_spi_base_list) && cs < 32; } __attribute__((weak)) void spi_cs_activate(struct spi_slave *slave) { struct xilinx_spi_slave *xilspi = to_xilinx_spi_slave(slave); writel(SPISSR_ACT(slave->cs), &xilspi->regs->spissr); } __attribute__((weak)) void spi_cs_deactivate(struct spi_slave *slave) { struct xilinx_spi_slave *xilspi = to_xilinx_spi_slave(slave); writel(SPISSR_OFF, &xilspi->regs->spissr); } void spi_init(void) { /* do nothing */ } void spi_set_speed(struct spi_slave *slave, uint hz) { /* xilinx spi core does not support programmable speed */ } struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, unsigned int max_hz, unsigned int mode) { struct xilinx_spi_slave *xilspi; if (!spi_cs_is_valid(bus, cs)) { printf("XILSPI error: %s: unsupported bus %d / cs %d\n", __func__, bus, cs); return NULL; } xilspi = malloc(sizeof(*xilspi)); if (!xilspi) { printf("XILSPI error: %s: malloc of SPI structure failed\n", __func__); return NULL; } xilspi->slave.bus = bus; xilspi->slave.cs = cs; xilspi->regs = (struct xilinx_spi_reg *)xilinx_spi_base_list[bus]; xilspi->freq = max_hz; xilspi->mode = mode; debug("%s: bus:%i cs:%i base:%p mode:%x max_hz:%d\n", __func__, bus, cs, xilspi->regs, xilspi->mode, xilspi->freq); return &xilspi->slave; } void spi_free_slave(struct spi_slave *slave) { struct xilinx_spi_slave *xilspi = to_xilinx_spi_slave(slave); free(xilspi); } int spi_claim_bus(struct spi_slave *slave) { struct xilinx_spi_slave *xilspi = to_xilinx_spi_slave(slave); u32 spicr; debug("%s: bus:%i cs:%i\n", __func__, slave->bus, slave->cs); writel(SPISSR_OFF, &xilspi->regs->spissr); spicr = XILSPI_SPICR_DFLT_ON; if (xilspi->mode & SPI_LSB_FIRST) spicr |= SPICR_LSB_FIRST; if (xilspi->mode & SPI_CPHA) spicr |= SPICR_CPHA; if (xilspi->mode & SPI_CPOL) spicr |= SPICR_CPOL; if (xilspi->mode & SPI_LOOP) spicr |= SPICR_LOOP; writel(spicr, &xilspi->regs->spicr); return 0; } void spi_release_bus(struct spi_slave *slave) { struct xilinx_spi_slave *xilspi = to_xilinx_spi_slave(slave); debug("%s: bus:%i cs:%i\n", __func__, slave->bus, slave->cs); writel(SPISSR_OFF, &xilspi->regs->spissr); writel(XILSPI_SPICR_DFLT_OFF, &xilspi->regs->spicr); } int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct xilinx_spi_slave *xilspi = to_xilinx_spi_slave(slave); /* assume spi core configured to do 8 bit transfers */ unsigned int bytes = bitlen / XILSPI_MAX_XFER_BITS; const unsigned char *txp = dout; unsigned char *rxp = din; unsigned rxecount = 17; /* max. 16 elements in FIFO, leftover 1 */ debug("%s: bus:%i cs:%i bitlen:%i bytes:%i flags:%lx\n", __func__, slave->bus, slave->cs, bitlen, bytes, flags); if (bitlen == 0) goto done; if (bitlen % XILSPI_MAX_XFER_BITS) { printf("XILSPI warning: %s: Not a multiple of %d bits\n", __func__, XILSPI_MAX_XFER_BITS); flags |= SPI_XFER_END; goto done; } /* empty read buffer */ while (rxecount && !(readl(&xilspi->regs->spisr) & SPISR_RX_EMPTY)) { readl(&xilspi->regs->spidrr); rxecount--; } if (!rxecount) { printf("XILSPI error: %s: Rx buffer not empty\n", __func__); return -1; } if (flags & SPI_XFER_BEGIN) spi_cs_activate(slave); while (bytes--) { unsigned timeout = /* at least 1usec or greater, leftover 1 */ xilspi->freq > XILSPI_MAX_XFER_BITS * 1000000 ? 2 : (XILSPI_MAX_XFER_BITS * 1000000 / xilspi->freq) + 1; /* get Tx element from data out buffer and count up */ unsigned char d = txp ? *txp++ : CONFIG_XILINX_SPI_IDLE_VAL; debug("%s: tx:%x ", __func__, d); /* write out and wait for processing (receive data) */ writel(d & SPIDTR_8BIT_MASK, &xilspi->regs->spidtr); while (timeout && readl(&xilspi->regs->spisr) & SPISR_RX_EMPTY) { timeout--; udelay(1); } if (!timeout) { printf("XILSPI error: %s: Xfer timeout\n", __func__); return -1; } /* read Rx element and push into data in buffer */ d = readl(&xilspi->regs->spidrr) & SPIDRR_8BIT_MASK; if (rxp) *rxp++ = d; debug("rx:%x\n", d); } done: if (flags & SPI_XFER_END) spi_cs_deactivate(slave); return 0; }
{ "pile_set_name": "Github" }
/** * Helpers. */ var s = 1000; var m = s * 60; var h = m * 60; var d = h * 24; var y = d * 365.25; /** * Parse or format the given `val`. * * Options: * * - `long` verbose formatting [false] * * @param {String|Number} val * @param {Object} [options] * @throws {Error} throw an error if val is not a non-empty string or a number * @return {String|Number} * @api public */ module.exports = function(val, options) { options = options || {}; var type = typeof val; if (type === 'string' && val.length > 0) { return parse(val); } else if (type === 'number' && isNaN(val) === false) { return options.long ? fmtLong(val) : fmtShort(val); } throw new Error( 'val is not a non-empty string or a valid number. val=' + JSON.stringify(val) ); }; /** * Parse the given `str` and return milliseconds. * * @param {String} str * @return {Number} * @api private */ function parse(str) { str = String(str); if (str.length > 100) { return; } var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( str ); if (!match) { return; } var n = parseFloat(match[1]); var type = (match[2] || 'ms').toLowerCase(); switch (type) { case 'years': case 'year': case 'yrs': case 'yr': case 'y': return n * y; case 'days': case 'day': case 'd': return n * d; case 'hours': case 'hour': case 'hrs': case 'hr': case 'h': return n * h; case 'minutes': case 'minute': case 'mins': case 'min': case 'm': return n * m; case 'seconds': case 'second': case 'secs': case 'sec': case 's': return n * s; case 'milliseconds': case 'millisecond': case 'msecs': case 'msec': case 'ms': return n; default: return undefined; } } /** * Short format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function fmtShort(ms) { if (ms >= d) { return Math.round(ms / d) + 'd'; } if (ms >= h) { return Math.round(ms / h) + 'h'; } if (ms >= m) { return Math.round(ms / m) + 'm'; } if (ms >= s) { return Math.round(ms / s) + 's'; } return ms + 'ms'; } /** * Long format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function fmtLong(ms) { return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; } /** * Pluralization helper. */ function plural(ms, n, name) { if (ms < n) { return; } if (ms < n * 1.5) { return Math.floor(ms / n) + ' ' + name; } return Math.ceil(ms / n) + ' ' + name + 's'; }
{ "pile_set_name": "Github" }
'use strict'; if (!process.version || process.version.indexOf('v0.') === 0 || process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { module.exports = nextTick; } else { module.exports = process.nextTick; } function nextTick(fn) { var args = new Array(arguments.length - 1); var i = 0; while (i < args.length) { args[i++] = arguments[i]; } process.nextTick(function afterTick() { fn.apply(null, args); }); }
{ "pile_set_name": "Github" }
(ns incanter.zoo-test (:use clojure.test (incanter zoo core stats)) (:require [clj-time.coerce :as c] [clojure.core.matrix.dataset :as ds])) ;; --= Tests (def integers (iterate inc 0)) (deftest roll-apply-test (is (= [3 6 9 12 15] (take 5 (roll-apply #(apply + %) 3 integers))))) (deftest roll-mean-test (is (= [2 3 4 5 6 7 8 9 10 11] (take 10 (roll-mean 5 integers))))) (deftest roll-median-test (is (= [2.0 3.0 4.0 5.0 6.0] (take 5 (roll-median 5 integers))))) (deftest roll-max-test (is (= [2 3 4 5 6] (take 5 (roll-max 3 integers))))) (deftest roll-min-test (is (= [0 1 2 3 4] (take 5 (roll-min 3 integers))))) ;; -------------------- ;; Standard dataset, with :index column (def ds1 (to-dataset [{:index "2012-01-01" :temp 32 :press 100} {:index "2012-01-02" :temp 35 :press 98} {:index "2012-01-03" :temp 30 :press 102} {:index "2012-01-04" :temp 31 :press 103} {:index "2012-01-05" :temp 32 :press 104} {:index "2012-01-06" :temp 33 :press 105}])) ;; Standard dataset with :date column (def ds2 (to-dataset [{:date "2012-01-01" :temp 32 :press 100} {:date "2012-01-02" :temp 35 :press 98} {:date "2012-01-03" :temp 30 :press 102} {:date "2012-01-04" :temp 31 :press 103} {:date "2012-01-05" :temp 32 :press 104} {:date "2012-01-06" :temp 33 :press 105}])) ;; Data with missing values (def ds3 (to-dataset [{:date "2012-01-01" :temp 32} {:date "2012-01-02" :press 98 :temp 32} {:date "2012-01-06" :temp 33}])) (defn zoo-test [] (is (zoo ds1)) (is (zoo ds2 :date)) (is (zoo ds3 :date)) (testing "Check ordering" (let [ts (zoo (to-dataset [{:index "2012-01-01" :a 1} {:index "2012-01-02" :a 2} {:index "2012-01-03" :a 3}]))] (is (= ts (zoo (to-dataset [{:index "2012-01-01" :a 1} {:index "2012-01-03" :a 3} {:index "2012-01-02" :a 2}])))) (is (= ts (zoo (to-dataset [{:index "2012-01-03" :a 3} {:index "2012-01-02" :a 2} {:index "2012-01-01" :a 1}])))))) (testing "Preserve all rows" (is (= (nrow ds1) (nrow (zoo ds1)))) (is (= (nrow ds2) (nrow (zoo ds2 :date)))) (is (= (nrow ds3) (nrow (zoo ds3 :date)))))) (defn $$-test [] ;; Time slicing (let [ts1 (zoo ds1)] (testing "Single date slice" (is (= ($$ "2012-01-01" :temp ts1) 32) "Single col") (is (= (dataset (ds/column-names ts1) [($$ "2012-01-01" :all ts1)]) (dataset (ds/column-names ts1) [{:index (to-date-time "2012-01-01") :press 100 :temp 32}])) "Whole row") (is (= ($$ "2012-01-01" :all ts1) ($$ "2012-01-01" ts1)) "Single arity check") (is (= (nrow ($$ "2012-01-10" :all ts1)) 0) "Date out of range")) (testing "Date range slice" (let [slice ($$ "2012-01-01" "2012-01-03" :all ts1)] (is (= 3 (nrow slice))) (is (= 3 (ncol slice)))) (is (= ($$ "2012-01-01" "2012-01-03" :temp ts1) [32 35 30]) "Single col")) (testing "Native Joda as index" (is (= ($$ (c/from-string "2012-01-03") :temp ts1) 30))) (testing "End point overlaps" (is (= ($$ "2012-01-01" "2012-01-06" :all ts1) ($$ "2012-01-01" "2012-06-10" :all ts1)) "RHS") (is (= ($$ "2012-01-01" "2012-01-06" :all ts1) ($$ "2011-01-01" "2012-06-10" :all ts1)) "LHS&RHS")))) (defn aligned?-test [] (let [ts1 (zoo ds1) ts2 (zoo ds2 :date)] (aligned? ts1 ts2) (is (not (aligned? ts1 (zoo (to-dataset [{:index "2012-01-01" :a 1} {:index "2012-01-02" :a 2}])))) "Unequal length") (is (not (aligned? (zoo (to-dataset [{:index "2012-01-01" :a 1} {:index "2012-01-02" :a 2}])) (zoo (to-dataset [{:index "2012-01-02" :a 1} {:index "2012-01-03" :a 2}])))) "Different indices"))) (defn within-zoo?-test [] (let [ts1 (zoo ds1)] (is (within-zoo? "2012-01-01" ts1)) (is (within-zoo? "2012-01-04" ts1)) (is (not (within-zoo? "2012-01-11" ts1))) (is (within-zoo? (c/from-string "2012-01-02T01:03:03") ts1) "Needn't be same frequency"))) (defn lag-test [] (let [ts1 (zoo ds1) ls1 (lag ts1)] (is (aligned? ts1 ls1) "Indices equal") (is (aligned? ts1 (lag ls1)) "Indices equal") (is (aligned? ts1 (lag ts1 3)) "Indices equal") (is (= ($ 0 [:press :temp] ls1) [nil nil]) "Nil pad the front values") (is (= ($ 0 [:press :temp] ts1) ($ 1 [:press :temp] ls1)) "Second vals of lag = first of ts") (is (= ($ 0 [:press :temp] ts1) ($ 2 [:press :temp] (lag ts1 2))) "Multiperiod lag") (is (= ($ 2 [:press :temp] (-> ts1 lag lag)) ($ 2 [:press :temp] (lag ts1 2))) "Multiperiod lag") (is (= (ds/column-names ts1) (ds/column-names ls1)) "Preserve order of columns"))) (defn zoo-apply-test [] (let [ts (zoo ds1) zs (zoo-apply #(apply min %) 2 ts :temp)] (aligned? ts zs) (is (= (rest ($ :temp zs)) (roll-min 2 ($ :temp ts)))))) ;; Helper for test below (defn- map-diff "Return a map with the different values of v2 - v1" [m1 m2] (into {} (map (fn [[k1 v1] [k2 v2]] (if (and v1 v2) {k2 (- v1 v2)} {k2 nil})) m1 m2))) (defn zoo-row-map-test [] (let [ts1 (zoo ds1) ms1 (zoo-row-map map-diff ts1 ts1) ms2 (zoo-row-map map-diff ts1 (lag ts1))] (is (every? (partial = 0) ($ :temp ms1))) ms2 (is (= ($ :press ms2) [nil -2 4 1 1 1])))) (deftest compliance-test (doseq [impl [:clatrix :ndarray :persistent-vector :vectorz]] (set-current-implementation impl) (println (str "compliance test " impl)) (zoo-test) ($$-test) (aligned?-test) (within-zoo?-test) (lag-test) (zoo-apply-test) (zoo-row-map-test)))
{ "pile_set_name": "Github" }
#!/usr/bin/env perl if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } # DESCRIPTION: Verilator: Verilog Test driver/expect definition # # Copyright 2003 by Wilson Snyder. This program is free software; you # can redistribute it and/or modify it under the terms of either the GNU # Lesser General Public License Version 3 or the Perl Artistic License # Version 2.0. # SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 scenarios(simulator => 1); top_filename("t/t_inst_dtree.v"); compile( v_flags2 => ['+define+INLINE_C +define+INLINE_D'], verilator_flags2 => ['-trace'], ); execute( check_finished => 1, ); ok(1); 1;
{ "pile_set_name": "Github" }
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!--#include virtual="../documentation.html" -->
{ "pile_set_name": "Github" }
import Ember from 'ember'; var Pollster = Ember.Object.extend({ interval: function() { return 2000; // Time between polls (in ms) }.property().readOnly(), schedule: function(f, args) { return Ember.run.later(this, function() { f.apply(this, [args]); this.set('timer', this.schedule(f, args)); }, this.get('interval')); }, stop: function() { Ember.run.cancel(this.get('timer')); }, start: function() { this.set('timer', this.schedule(this.get('onPoll'), this.get('args'))); }, onPoll: function(){ // Do some work } }); export default Pollster;
{ "pile_set_name": "Github" }
/** * Execute a function and return it back directly after execution. * * @param {Function} fn * @return {Function} */ module.exports = function (fn, context) { return fn.call(context), fn; };
{ "pile_set_name": "Github" }
package main import ( "fmt" "github.com/akamensky/argparse" "os" ) func main() { parser := argparse.NewParser("Required-args", "Example of required vs optional arguments") // Required shorthand argument foo := parser.String("f", "foo", &argparse.Options{Required: true, Help: "foo is a required string option"}) // Optional shorthand argument bar := parser.String("b", "bar", &argparse.Options{Required: false, Help: "bar is not a required option"}) // Parse args err := parser.Parse(os.Args) if err != nil { fmt.Print(parser.Usage(err)) } else { fmt.Println("Provided arguments:") fmt.Printf("foo (required): %s\n", *foo) // As an optional string argument, bar will be empty if unused if *bar != "" { fmt.Printf("bar (optional): %s\n", *bar) } } }
{ "pile_set_name": "Github" }
Notice 0: Reading LEF file: Nangate45/Nangate45.lef Notice 0: Created 22 technology layers Notice 0: Created 27 technology vias Notice 0: Created 134 library cells Notice 0: Finished LEF file: Nangate45/Nangate45.lef Notice 0: Reading DEF file: simple05.def Notice 0: Design: ten_cells Notice 0: Created 2 pins. Notice 0: Created 10 components and 45 component-terminals. Notice 0: Created 11 nets and 25 connections. Notice 0: Finished DEF file: simple05.def Warning: could not find power special net Design Stats -------------------------------- total instances 10 multi row instances 0 fixed instances 1 nets 11 design area 16.5 u^2 fixed area 0.8 u^2 movable area 7.7 u^2 utilization 49 % utilization padded 49 % rows 2 row height 1.4 u Placement Analysis -------------------------------- total displacement 2.3 u average displacement 0.2 u max displacement 1.7 u original HPWL 79.2 u legalized HPWL 81.6 u delta HPWL 3 % No differences found.
{ "pile_set_name": "Github" }
TITLE des-586.asm IF @Version LT 800 ECHO MASM version 8.00 or later is strongly recommended. ENDIF .686 .MODEL FLAT OPTION DOTNAME IF @Version LT 800 .text$ SEGMENT PAGE 'CODE' ELSE .text$ SEGMENT ALIGN(64) 'CODE' ENDIF PUBLIC _DES_SPtrans ALIGN 16 __x86_DES_encrypt PROC PRIVATE push ecx ; Round 0 mov eax,DWORD PTR [ecx] xor ebx,ebx mov edx,DWORD PTR 4[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 1 mov eax,DWORD PTR 8[ecx] xor ebx,ebx mov edx,DWORD PTR 12[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 2 mov eax,DWORD PTR 16[ecx] xor ebx,ebx mov edx,DWORD PTR 20[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 3 mov eax,DWORD PTR 24[ecx] xor ebx,ebx mov edx,DWORD PTR 28[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 4 mov eax,DWORD PTR 32[ecx] xor ebx,ebx mov edx,DWORD PTR 36[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 5 mov eax,DWORD PTR 40[ecx] xor ebx,ebx mov edx,DWORD PTR 44[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 6 mov eax,DWORD PTR 48[ecx] xor ebx,ebx mov edx,DWORD PTR 52[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 7 mov eax,DWORD PTR 56[ecx] xor ebx,ebx mov edx,DWORD PTR 60[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 8 mov eax,DWORD PTR 64[ecx] xor ebx,ebx mov edx,DWORD PTR 68[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 9 mov eax,DWORD PTR 72[ecx] xor ebx,ebx mov edx,DWORD PTR 76[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 10 mov eax,DWORD PTR 80[ecx] xor ebx,ebx mov edx,DWORD PTR 84[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 11 mov eax,DWORD PTR 88[ecx] xor ebx,ebx mov edx,DWORD PTR 92[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 12 mov eax,DWORD PTR 96[ecx] xor ebx,ebx mov edx,DWORD PTR 100[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 13 mov eax,DWORD PTR 104[ecx] xor ebx,ebx mov edx,DWORD PTR 108[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 14 mov eax,DWORD PTR 112[ecx] xor ebx,ebx mov edx,DWORD PTR 116[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 15 mov eax,DWORD PTR 120[ecx] xor ebx,ebx mov edx,DWORD PTR 124[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] add esp,4 ret __x86_DES_encrypt ENDP ALIGN 16 __x86_DES_decrypt PROC PRIVATE push ecx ; Round 15 mov eax,DWORD PTR 120[ecx] xor ebx,ebx mov edx,DWORD PTR 124[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 14 mov eax,DWORD PTR 112[ecx] xor ebx,ebx mov edx,DWORD PTR 116[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 13 mov eax,DWORD PTR 104[ecx] xor ebx,ebx mov edx,DWORD PTR 108[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 12 mov eax,DWORD PTR 96[ecx] xor ebx,ebx mov edx,DWORD PTR 100[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 11 mov eax,DWORD PTR 88[ecx] xor ebx,ebx mov edx,DWORD PTR 92[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 10 mov eax,DWORD PTR 80[ecx] xor ebx,ebx mov edx,DWORD PTR 84[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 9 mov eax,DWORD PTR 72[ecx] xor ebx,ebx mov edx,DWORD PTR 76[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 8 mov eax,DWORD PTR 64[ecx] xor ebx,ebx mov edx,DWORD PTR 68[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 7 mov eax,DWORD PTR 56[ecx] xor ebx,ebx mov edx,DWORD PTR 60[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 6 mov eax,DWORD PTR 48[ecx] xor ebx,ebx mov edx,DWORD PTR 52[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 5 mov eax,DWORD PTR 40[ecx] xor ebx,ebx mov edx,DWORD PTR 44[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 4 mov eax,DWORD PTR 32[ecx] xor ebx,ebx mov edx,DWORD PTR 36[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 3 mov eax,DWORD PTR 24[ecx] xor ebx,ebx mov edx,DWORD PTR 28[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 2 mov eax,DWORD PTR 16[ecx] xor ebx,ebx mov edx,DWORD PTR 20[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] ; Round 1 mov eax,DWORD PTR 8[ecx] xor ebx,ebx mov edx,DWORD PTR 12[ecx] xor eax,esi xor ecx,ecx xor edx,esi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor edi,DWORD PTR [ebx*1+ebp] mov bl,dl xor edi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor edi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor edi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor edi,DWORD PTR 0600h[ebx*1+ebp] xor edi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor edi,DWORD PTR 0400h[eax*1+ebp] xor edi,DWORD PTR 0500h[edx*1+ebp] ; Round 0 mov eax,DWORD PTR [ecx] xor ebx,ebx mov edx,DWORD PTR 4[ecx] xor eax,edi xor ecx,ecx xor edx,edi and eax,0fcfcfcfch and edx,0cfcfcfcfh mov bl,al mov cl,ah ror edx,4 xor esi,DWORD PTR [ebx*1+ebp] mov bl,dl xor esi,DWORD PTR 0200h[ecx*1+ebp] mov cl,dh shr eax,16 xor esi,DWORD PTR 0100h[ebx*1+ebp] mov bl,ah shr edx,16 xor esi,DWORD PTR 0300h[ecx*1+ebp] mov cl,dh and eax,0ffh and edx,0ffh xor esi,DWORD PTR 0600h[ebx*1+ebp] xor esi,DWORD PTR 0700h[ecx*1+ebp] mov ecx,DWORD PTR [esp] xor esi,DWORD PTR 0400h[eax*1+ebp] xor esi,DWORD PTR 0500h[edx*1+ebp] add esp,4 ret __x86_DES_decrypt ENDP ALIGN 16 _DES_encrypt1 PROC PUBLIC $L_DES_encrypt1_begin:: push esi push edi ; ; Load the 2 words mov esi,DWORD PTR 12[esp] xor ecx,ecx push ebx push ebp mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 28[esp] mov edi,DWORD PTR 4[esi] ; ; IP rol eax,4 mov esi,eax xor eax,edi and eax,0f0f0f0f0h xor esi,eax xor edi,eax ; rol edi,20 mov eax,edi xor edi,esi and edi,0fff0000fh xor eax,edi xor esi,edi ; rol eax,14 mov edi,eax xor eax,esi and eax,033333333h xor edi,eax xor esi,eax ; rol esi,22 mov eax,esi xor esi,edi and esi,003fc03fch xor eax,esi xor edi,esi ; rol eax,9 mov esi,eax xor eax,edi and eax,0aaaaaaaah xor esi,eax xor edi,eax ; rol edi,1 call $L000pic_point $L000pic_point: pop ebp lea ebp,DWORD PTR ($Ldes_sptrans-$L000pic_point)[ebp] mov ecx,DWORD PTR 24[esp] cmp ebx,0 je $L001decrypt call __x86_DES_encrypt jmp $L002done $L001decrypt: call __x86_DES_decrypt $L002done: ; ; FP mov edx,DWORD PTR 20[esp] ror esi,1 mov eax,edi xor edi,esi and edi,0aaaaaaaah xor eax,edi xor esi,edi ; rol eax,23 mov edi,eax xor eax,esi and eax,003fc03fch xor edi,eax xor esi,eax ; rol edi,10 mov eax,edi xor edi,esi and edi,033333333h xor eax,edi xor esi,edi ; rol esi,18 mov edi,esi xor esi,eax and esi,0fff0000fh xor edi,esi xor eax,esi ; rol edi,12 mov esi,edi xor edi,eax and edi,0f0f0f0f0h xor esi,edi xor eax,edi ; ror eax,4 mov DWORD PTR [edx],eax mov DWORD PTR 4[edx],esi pop ebp pop ebx pop edi pop esi ret _DES_encrypt1 ENDP ALIGN 16 _DES_encrypt2 PROC PUBLIC $L_DES_encrypt2_begin:: push esi push edi ; ; Load the 2 words mov eax,DWORD PTR 12[esp] xor ecx,ecx push ebx push ebp mov esi,DWORD PTR [eax] mov ebx,DWORD PTR 28[esp] rol esi,3 mov edi,DWORD PTR 4[eax] rol edi,3 call $L003pic_point $L003pic_point: pop ebp lea ebp,DWORD PTR ($Ldes_sptrans-$L003pic_point)[ebp] mov ecx,DWORD PTR 24[esp] cmp ebx,0 je $L004decrypt call __x86_DES_encrypt jmp $L005done $L004decrypt: call __x86_DES_decrypt $L005done: ; ; Fixup ror edi,3 mov eax,DWORD PTR 20[esp] ror esi,3 mov DWORD PTR [eax],edi mov DWORD PTR 4[eax],esi pop ebp pop ebx pop edi pop esi ret _DES_encrypt2 ENDP ALIGN 16 _DES_encrypt3 PROC PUBLIC $L_DES_encrypt3_begin:: push ebx mov ebx,DWORD PTR 8[esp] push ebp push esi push edi ; ; Load the data words mov edi,DWORD PTR [ebx] mov esi,DWORD PTR 4[ebx] sub esp,12 ; ; IP rol edi,4 mov edx,edi xor edi,esi and edi,0f0f0f0f0h xor edx,edi xor esi,edi ; rol esi,20 mov edi,esi xor esi,edx and esi,0fff0000fh xor edi,esi xor edx,esi ; rol edi,14 mov esi,edi xor edi,edx and edi,033333333h xor esi,edi xor edx,edi ; rol edx,22 mov edi,edx xor edx,esi and edx,003fc03fch xor edi,edx xor esi,edx ; rol edi,9 mov edx,edi xor edi,esi and edi,0aaaaaaaah xor edx,edi xor esi,edi ; ror edx,3 ror esi,2 mov DWORD PTR 4[ebx],esi mov eax,DWORD PTR 36[esp] mov DWORD PTR [ebx],edx mov edi,DWORD PTR 40[esp] mov esi,DWORD PTR 44[esp] mov DWORD PTR 8[esp],1 mov DWORD PTR 4[esp],eax mov DWORD PTR [esp],ebx call $L_DES_encrypt2_begin mov DWORD PTR 8[esp],0 mov DWORD PTR 4[esp],edi mov DWORD PTR [esp],ebx call $L_DES_encrypt2_begin mov DWORD PTR 8[esp],1 mov DWORD PTR 4[esp],esi mov DWORD PTR [esp],ebx call $L_DES_encrypt2_begin add esp,12 mov edi,DWORD PTR [ebx] mov esi,DWORD PTR 4[ebx] ; ; FP rol esi,2 rol edi,3 mov eax,edi xor edi,esi and edi,0aaaaaaaah xor eax,edi xor esi,edi ; rol eax,23 mov edi,eax xor eax,esi and eax,003fc03fch xor edi,eax xor esi,eax ; rol edi,10 mov eax,edi xor edi,esi and edi,033333333h xor eax,edi xor esi,edi ; rol esi,18 mov edi,esi xor esi,eax and esi,0fff0000fh xor edi,esi xor eax,esi ; rol edi,12 mov esi,edi xor edi,eax and edi,0f0f0f0f0h xor esi,edi xor eax,edi ; ror eax,4 mov DWORD PTR [ebx],eax mov DWORD PTR 4[ebx],esi pop edi pop esi pop ebp pop ebx ret _DES_encrypt3 ENDP ALIGN 16 _DES_decrypt3 PROC PUBLIC $L_DES_decrypt3_begin:: push ebx mov ebx,DWORD PTR 8[esp] push ebp push esi push edi ; ; Load the data words mov edi,DWORD PTR [ebx] mov esi,DWORD PTR 4[ebx] sub esp,12 ; ; IP rol edi,4 mov edx,edi xor edi,esi and edi,0f0f0f0f0h xor edx,edi xor esi,edi ; rol esi,20 mov edi,esi xor esi,edx and esi,0fff0000fh xor edi,esi xor edx,esi ; rol edi,14 mov esi,edi xor edi,edx and edi,033333333h xor esi,edi xor edx,edi ; rol edx,22 mov edi,edx xor edx,esi and edx,003fc03fch xor edi,edx xor esi,edx ; rol edi,9 mov edx,edi xor edi,esi and edi,0aaaaaaaah xor edx,edi xor esi,edi ; ror edx,3 ror esi,2 mov DWORD PTR 4[ebx],esi mov esi,DWORD PTR 36[esp] mov DWORD PTR [ebx],edx mov edi,DWORD PTR 40[esp] mov eax,DWORD PTR 44[esp] mov DWORD PTR 8[esp],0 mov DWORD PTR 4[esp],eax mov DWORD PTR [esp],ebx call $L_DES_encrypt2_begin mov DWORD PTR 8[esp],1 mov DWORD PTR 4[esp],edi mov DWORD PTR [esp],ebx call $L_DES_encrypt2_begin mov DWORD PTR 8[esp],0 mov DWORD PTR 4[esp],esi mov DWORD PTR [esp],ebx call $L_DES_encrypt2_begin add esp,12 mov edi,DWORD PTR [ebx] mov esi,DWORD PTR 4[ebx] ; ; FP rol esi,2 rol edi,3 mov eax,edi xor edi,esi and edi,0aaaaaaaah xor eax,edi xor esi,edi ; rol eax,23 mov edi,eax xor eax,esi and eax,003fc03fch xor edi,eax xor esi,eax ; rol edi,10 mov eax,edi xor edi,esi and edi,033333333h xor eax,edi xor esi,edi ; rol esi,18 mov edi,esi xor esi,eax and esi,0fff0000fh xor edi,esi xor eax,esi ; rol edi,12 mov esi,edi xor edi,eax and edi,0f0f0f0f0h xor esi,edi xor eax,edi ; ror eax,4 mov DWORD PTR [ebx],eax mov DWORD PTR 4[ebx],esi pop edi pop esi pop ebp pop ebx ret _DES_decrypt3 ENDP ALIGN 16 _DES_ncbc_encrypt PROC PUBLIC $L_DES_ncbc_encrypt_begin:: ; push ebp push ebx push esi push edi mov ebp,DWORD PTR 28[esp] ; getting iv ptr from parameter 4 mov ebx,DWORD PTR 36[esp] mov esi,DWORD PTR [ebx] mov edi,DWORD PTR 4[ebx] push edi push esi push edi push esi mov ebx,esp mov esi,DWORD PTR 36[esp] mov edi,DWORD PTR 40[esp] ; getting encrypt flag from parameter 5 mov ecx,DWORD PTR 56[esp] ; get and push parameter 5 push ecx ; get and push parameter 3 mov eax,DWORD PTR 52[esp] push eax push ebx cmp ecx,0 jz $L006decrypt and ebp,4294967288 mov eax,DWORD PTR 12[esp] mov ebx,DWORD PTR 16[esp] jz $L007encrypt_finish $L008encrypt_loop: mov ecx,DWORD PTR [esi] mov edx,DWORD PTR 4[esi] xor eax,ecx xor ebx,edx mov DWORD PTR 12[esp],eax mov DWORD PTR 16[esp],ebx call $L_DES_encrypt1_begin mov eax,DWORD PTR 12[esp] mov ebx,DWORD PTR 16[esp] mov DWORD PTR [edi],eax mov DWORD PTR 4[edi],ebx add esi,8 add edi,8 sub ebp,8 jnz $L008encrypt_loop $L007encrypt_finish: mov ebp,DWORD PTR 56[esp] and ebp,7 jz $L009finish call $L010PIC_point $L010PIC_point: pop edx lea ecx,DWORD PTR ($L011cbc_enc_jmp_table-$L010PIC_point)[edx] mov ebp,DWORD PTR [ebp*4+ecx] add ebp,edx xor ecx,ecx xor edx,edx jmp ebp $L012ej7: mov dh,BYTE PTR 6[esi] shl edx,8 $L013ej6: mov dh,BYTE PTR 5[esi] $L014ej5: mov dl,BYTE PTR 4[esi] $L015ej4: mov ecx,DWORD PTR [esi] jmp $L016ejend $L017ej3: mov ch,BYTE PTR 2[esi] shl ecx,8 $L018ej2: mov ch,BYTE PTR 1[esi] $L019ej1: mov cl,BYTE PTR [esi] $L016ejend: xor eax,ecx xor ebx,edx mov DWORD PTR 12[esp],eax mov DWORD PTR 16[esp],ebx call $L_DES_encrypt1_begin mov eax,DWORD PTR 12[esp] mov ebx,DWORD PTR 16[esp] mov DWORD PTR [edi],eax mov DWORD PTR 4[edi],ebx jmp $L009finish $L006decrypt: and ebp,4294967288 mov eax,DWORD PTR 20[esp] mov ebx,DWORD PTR 24[esp] jz $L020decrypt_finish $L021decrypt_loop: mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] mov DWORD PTR 12[esp],eax mov DWORD PTR 16[esp],ebx call $L_DES_encrypt1_begin mov eax,DWORD PTR 12[esp] mov ebx,DWORD PTR 16[esp] mov ecx,DWORD PTR 20[esp] mov edx,DWORD PTR 24[esp] xor ecx,eax xor edx,ebx mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] mov DWORD PTR [edi],ecx mov DWORD PTR 4[edi],edx mov DWORD PTR 20[esp],eax mov DWORD PTR 24[esp],ebx add esi,8 add edi,8 sub ebp,8 jnz $L021decrypt_loop $L020decrypt_finish: mov ebp,DWORD PTR 56[esp] and ebp,7 jz $L009finish mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] mov DWORD PTR 12[esp],eax mov DWORD PTR 16[esp],ebx call $L_DES_encrypt1_begin mov eax,DWORD PTR 12[esp] mov ebx,DWORD PTR 16[esp] mov ecx,DWORD PTR 20[esp] mov edx,DWORD PTR 24[esp] xor ecx,eax xor edx,ebx mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] $L022dj7: ror edx,16 mov BYTE PTR 6[edi],dl shr edx,16 $L023dj6: mov BYTE PTR 5[edi],dh $L024dj5: mov BYTE PTR 4[edi],dl $L025dj4: mov DWORD PTR [edi],ecx jmp $L026djend $L027dj3: ror ecx,16 mov BYTE PTR 2[edi],cl shl ecx,16 $L028dj2: mov BYTE PTR 1[esi],ch $L029dj1: mov BYTE PTR [esi],cl $L026djend: jmp $L009finish $L009finish: mov ecx,DWORD PTR 64[esp] add esp,28 mov DWORD PTR [ecx],eax mov DWORD PTR 4[ecx],ebx pop edi pop esi pop ebx pop ebp ret ALIGN 64 $L011cbc_enc_jmp_table: DD 0 DD $L019ej1-$L010PIC_point DD $L018ej2-$L010PIC_point DD $L017ej3-$L010PIC_point DD $L015ej4-$L010PIC_point DD $L014ej5-$L010PIC_point DD $L013ej6-$L010PIC_point DD $L012ej7-$L010PIC_point ALIGN 64 _DES_ncbc_encrypt ENDP ALIGN 16 _DES_ede3_cbc_encrypt PROC PUBLIC $L_DES_ede3_cbc_encrypt_begin:: ; push ebp push ebx push esi push edi mov ebp,DWORD PTR 28[esp] ; getting iv ptr from parameter 6 mov ebx,DWORD PTR 44[esp] mov esi,DWORD PTR [ebx] mov edi,DWORD PTR 4[ebx] push edi push esi push edi push esi mov ebx,esp mov esi,DWORD PTR 36[esp] mov edi,DWORD PTR 40[esp] ; getting encrypt flag from parameter 7 mov ecx,DWORD PTR 64[esp] ; get and push parameter 5 mov eax,DWORD PTR 56[esp] push eax ; get and push parameter 4 mov eax,DWORD PTR 56[esp] push eax ; get and push parameter 3 mov eax,DWORD PTR 56[esp] push eax push ebx cmp ecx,0 jz $L030decrypt and ebp,4294967288 mov eax,DWORD PTR 16[esp] mov ebx,DWORD PTR 20[esp] jz $L031encrypt_finish $L032encrypt_loop: mov ecx,DWORD PTR [esi] mov edx,DWORD PTR 4[esi] xor eax,ecx xor ebx,edx mov DWORD PTR 16[esp],eax mov DWORD PTR 20[esp],ebx call $L_DES_encrypt3_begin mov eax,DWORD PTR 16[esp] mov ebx,DWORD PTR 20[esp] mov DWORD PTR [edi],eax mov DWORD PTR 4[edi],ebx add esi,8 add edi,8 sub ebp,8 jnz $L032encrypt_loop $L031encrypt_finish: mov ebp,DWORD PTR 60[esp] and ebp,7 jz $L033finish call $L034PIC_point $L034PIC_point: pop edx lea ecx,DWORD PTR ($L035cbc_enc_jmp_table-$L034PIC_point)[edx] mov ebp,DWORD PTR [ebp*4+ecx] add ebp,edx xor ecx,ecx xor edx,edx jmp ebp $L036ej7: mov dh,BYTE PTR 6[esi] shl edx,8 $L037ej6: mov dh,BYTE PTR 5[esi] $L038ej5: mov dl,BYTE PTR 4[esi] $L039ej4: mov ecx,DWORD PTR [esi] jmp $L040ejend $L041ej3: mov ch,BYTE PTR 2[esi] shl ecx,8 $L042ej2: mov ch,BYTE PTR 1[esi] $L043ej1: mov cl,BYTE PTR [esi] $L040ejend: xor eax,ecx xor ebx,edx mov DWORD PTR 16[esp],eax mov DWORD PTR 20[esp],ebx call $L_DES_encrypt3_begin mov eax,DWORD PTR 16[esp] mov ebx,DWORD PTR 20[esp] mov DWORD PTR [edi],eax mov DWORD PTR 4[edi],ebx jmp $L033finish $L030decrypt: and ebp,4294967288 mov eax,DWORD PTR 24[esp] mov ebx,DWORD PTR 28[esp] jz $L044decrypt_finish $L045decrypt_loop: mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] mov DWORD PTR 16[esp],eax mov DWORD PTR 20[esp],ebx call $L_DES_decrypt3_begin mov eax,DWORD PTR 16[esp] mov ebx,DWORD PTR 20[esp] mov ecx,DWORD PTR 24[esp] mov edx,DWORD PTR 28[esp] xor ecx,eax xor edx,ebx mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] mov DWORD PTR [edi],ecx mov DWORD PTR 4[edi],edx mov DWORD PTR 24[esp],eax mov DWORD PTR 28[esp],ebx add esi,8 add edi,8 sub ebp,8 jnz $L045decrypt_loop $L044decrypt_finish: mov ebp,DWORD PTR 60[esp] and ebp,7 jz $L033finish mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] mov DWORD PTR 16[esp],eax mov DWORD PTR 20[esp],ebx call $L_DES_decrypt3_begin mov eax,DWORD PTR 16[esp] mov ebx,DWORD PTR 20[esp] mov ecx,DWORD PTR 24[esp] mov edx,DWORD PTR 28[esp] xor ecx,eax xor edx,ebx mov eax,DWORD PTR [esi] mov ebx,DWORD PTR 4[esi] $L046dj7: ror edx,16 mov BYTE PTR 6[edi],dl shr edx,16 $L047dj6: mov BYTE PTR 5[edi],dh $L048dj5: mov BYTE PTR 4[edi],dl $L049dj4: mov DWORD PTR [edi],ecx jmp $L050djend $L051dj3: ror ecx,16 mov BYTE PTR 2[edi],cl shl ecx,16 $L052dj2: mov BYTE PTR 1[esi],ch $L053dj1: mov BYTE PTR [esi],cl $L050djend: jmp $L033finish $L033finish: mov ecx,DWORD PTR 76[esp] add esp,32 mov DWORD PTR [ecx],eax mov DWORD PTR 4[ecx],ebx pop edi pop esi pop ebx pop ebp ret ALIGN 64 $L035cbc_enc_jmp_table: DD 0 DD $L043ej1-$L034PIC_point DD $L042ej2-$L034PIC_point DD $L041ej3-$L034PIC_point DD $L039ej4-$L034PIC_point DD $L038ej5-$L034PIC_point DD $L037ej6-$L034PIC_point DD $L036ej7-$L034PIC_point ALIGN 64 _DES_ede3_cbc_encrypt ENDP ALIGN 64 _DES_SPtrans:: $Ldes_sptrans:: DD 34080768,524288,33554434,34080770 DD 33554432,526338,524290,33554434 DD 526338,34080768,34078720,2050 DD 33556482,33554432,0,524290 DD 524288,2,33556480,526336 DD 34080770,34078720,2050,33556480 DD 2,2048,526336,34078722 DD 2048,33556482,34078722,0 DD 0,34080770,33556480,524290 DD 34080768,524288,2050,33556480 DD 34078722,2048,526336,33554434 DD 526338,2,33554434,34078720 DD 34080770,526336,34078720,33556482 DD 33554432,2050,524290,0 DD 524288,33554432,33556482,34080768 DD 2,34078722,2048,526338 DD 1074823184,0,1081344,1074790400 DD 1073741840,32784,1073774592,1081344 DD 32768,1074790416,16,1073774592 DD 1048592,1074823168,1074790400,16 DD 1048576,1073774608,1074790416,32768 DD 1081360,1073741824,0,1048592 DD 1073774608,1081360,1074823168,1073741840 DD 1073741824,1048576,32784,1074823184 DD 1048592,1074823168,1073774592,1081360 DD 1074823184,1048592,1073741840,0 DD 1073741824,32784,1048576,1074790416 DD 32768,1073741824,1081360,1073774608 DD 1074823168,32768,0,1073741840 DD 16,1074823184,1081344,1074790400 DD 1074790416,1048576,32784,1073774592 DD 1073774608,16,1074790400,1081344 DD 67108865,67371264,256,67109121 DD 262145,67108864,67109121,262400 DD 67109120,262144,67371008,1 DD 67371265,257,1,67371009 DD 0,262145,67371264,256 DD 257,67371265,262144,67108865 DD 67371009,67109120,262401,67371008 DD 262400,0,67108864,262401 DD 67371264,256,1,262144 DD 257,262145,67371008,67109121 DD 0,67371264,262400,67371009 DD 262145,67108864,67371265,1 DD 262401,67108865,67108864,67371265 DD 262144,67109120,67109121,262400 DD 67109120,0,67371009,257 DD 67108865,262401,256,67371008 DD 4198408,268439552,8,272633864 DD 0,272629760,268439560,4194312 DD 272633856,268435464,268435456,4104 DD 268435464,4198408,4194304,268435456 DD 272629768,4198400,4096,8 DD 4198400,268439560,272629760,4096 DD 4104,0,4194312,272633856 DD 268439552,272629768,272633864,4194304 DD 272629768,4104,4194304,268435464 DD 4198400,268439552,8,272629760 DD 268439560,0,4096,4194312 DD 0,272629768,272633856,4096 DD 268435456,272633864,4198408,4194304 DD 272633864,8,268439552,4198408 DD 4194312,4198400,272629760,268439560 DD 4104,268435456,268435464,272633856 DD 134217728,65536,1024,134284320 DD 134283296,134218752,66592,134283264 DD 65536,32,134217760,66560 DD 134218784,134283296,134284288,0 DD 66560,134217728,65568,1056 DD 134218752,66592,0,134217760 DD 32,134218784,134284320,65568 DD 134283264,1024,1056,134284288 DD 134284288,134218784,65568,134283264 DD 65536,32,134217760,134218752 DD 134217728,66560,134284320,0 DD 66592,134217728,1024,65568 DD 134218784,1024,0,134284320 DD 134283296,134284288,1056,65536 DD 66560,134283296,134218752,1056 DD 32,66592,134283264,134217760 DD 2147483712,2097216,0,2149588992 DD 2097216,8192,2147491904,2097152 DD 8256,2149589056,2105344,2147483648 DD 2147491840,2147483712,2149580800,2105408 DD 2097152,2147491904,2149580864,0 DD 8192,64,2149588992,2149580864 DD 2149589056,2149580800,2147483648,8256 DD 64,2105344,2105408,2147491840 DD 8256,2147483648,2147491840,2105408 DD 2149588992,2097216,0,2147491840 DD 2147483648,8192,2149580864,2097152 DD 2097216,2149589056,2105344,64 DD 2149589056,2105344,2097152,2147491904 DD 2147483712,2149580800,2105408,0 DD 8192,2147483712,2147491904,2149588992 DD 2149580800,8256,64,2149580864 DD 16384,512,16777728,16777220 DD 16794116,16388,16896,0 DD 16777216,16777732,516,16793600 DD 4,16794112,16793600,516 DD 16777732,16384,16388,16794116 DD 0,16777728,16777220,16896 DD 16793604,16900,16794112,4 DD 16900,16793604,512,16777216 DD 16900,16793600,16793604,516 DD 16384,512,16777216,16793604 DD 16777732,16900,16896,0 DD 512,16777220,4,16777728 DD 0,16777732,16777728,16896 DD 516,16384,16794116,16777216 DD 16794112,4,16388,16794116 DD 16777220,16794112,16793600,16388 DD 545259648,545390592,131200,0 DD 537001984,8388736,545259520,545390720 DD 128,536870912,8519680,131200 DD 8519808,537002112,536871040,545259520 DD 131072,8519808,8388736,537001984 DD 545390720,536871040,0,8519680 DD 536870912,8388608,537002112,545259648 DD 8388608,131072,545390592,128 DD 8388608,131072,536871040,545390720 DD 131200,536870912,0,8519680 DD 545259648,537002112,537001984,8388736 DD 545390592,128,8388736,537001984 DD 545390720,8388608,545259520,536871040 DD 8519680,131200,537002112,545259520 DD 128,545390592,8519808,0 DD 536870912,545259648,131072,8519808 .text$ ENDS END
{ "pile_set_name": "Github" }
__author__ = 'Fan' import numpy as np from algorithms.awsOnline import AWSOnline from algorithms.OnlineBase import FeatureSpec for i in range(0, 1): val_name = map(lambda x: 'v%d' % x, range(1, 11)) print val_name test = AWSOnline('ml-lkYRYeldcrH', 1, 0, 10, val_name, 'uniform', .1) # X, Y = test.collect_pts(2, -1) spec = FeatureSpec('norm', (-1, 1), (-.85, -.85, -.20, -.51, -.49, -.58, -.48, -.38, -.44, -.55)) X, Y = test.collect_universe(1000, spec=spec) print np.bincount(Y)
{ "pile_set_name": "Github" }
/* * Copyright (c) 2002-2020 "Neo4j," * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.neo4j.driver.internal.messaging.v3; import org.neo4j.driver.internal.messaging.MessageFormat; import org.neo4j.driver.internal.messaging.v2.MessageReaderV2; import org.neo4j.driver.internal.packstream.PackInput; import org.neo4j.driver.internal.packstream.PackOutput; public class MessageFormatV3 implements MessageFormat { @Override public Writer newWriter( PackOutput output ) { return new MessageWriterV3( output ); } @Override public Reader newReader( PackInput input ) { return new MessageReaderV2( input ); } }
{ "pile_set_name": "Github" }
// go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build 386,netbsd package unix const ( SYS_EXIT = 1 // { void|sys||exit(int rval); } SYS_FORK = 2 // { int|sys||fork(void); } SYS_READ = 3 // { ssize_t|sys||read(int fd, void *buf, size_t nbyte); } SYS_WRITE = 4 // { ssize_t|sys||write(int fd, const void *buf, size_t nbyte); } SYS_OPEN = 5 // { int|sys||open(const char *path, int flags, ... mode_t mode); } SYS_CLOSE = 6 // { int|sys||close(int fd); } SYS_LINK = 9 // { int|sys||link(const char *path, const char *link); } SYS_UNLINK = 10 // { int|sys||unlink(const char *path); } SYS_CHDIR = 12 // { int|sys||chdir(const char *path); } SYS_FCHDIR = 13 // { int|sys||fchdir(int fd); } SYS_CHMOD = 15 // { int|sys||chmod(const char *path, mode_t mode); } SYS_CHOWN = 16 // { int|sys||chown(const char *path, uid_t uid, gid_t gid); } SYS_BREAK = 17 // { int|sys||obreak(char *nsize); } SYS_GETPID = 20 // { pid_t|sys||getpid_with_ppid(void); } SYS_UNMOUNT = 22 // { int|sys||unmount(const char *path, int flags); } SYS_SETUID = 23 // { int|sys||setuid(uid_t uid); } SYS_GETUID = 24 // { uid_t|sys||getuid_with_euid(void); } SYS_GETEUID = 25 // { uid_t|sys||geteuid(void); } SYS_PTRACE = 26 // { int|sys||ptrace(int req, pid_t pid, void *addr, int data); } SYS_RECVMSG = 27 // { ssize_t|sys||recvmsg(int s, struct msghdr *msg, int flags); } SYS_SENDMSG = 28 // { ssize_t|sys||sendmsg(int s, const struct msghdr *msg, int flags); } SYS_RECVFROM = 29 // { ssize_t|sys||recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } SYS_ACCEPT = 30 // { int|sys||accept(int s, struct sockaddr *name, socklen_t *anamelen); } SYS_GETPEERNAME = 31 // { int|sys||getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } SYS_GETSOCKNAME = 32 // { int|sys||getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } SYS_ACCESS = 33 // { int|sys||access(const char *path, int flags); } SYS_CHFLAGS = 34 // { int|sys||chflags(const char *path, u_long flags); } SYS_FCHFLAGS = 35 // { int|sys||fchflags(int fd, u_long flags); } SYS_SYNC = 36 // { void|sys||sync(void); } SYS_KILL = 37 // { int|sys||kill(pid_t pid, int signum); } SYS_GETPPID = 39 // { pid_t|sys||getppid(void); } SYS_DUP = 41 // { int|sys||dup(int fd); } SYS_PIPE = 42 // { int|sys||pipe(void); } SYS_GETEGID = 43 // { gid_t|sys||getegid(void); } SYS_PROFIL = 44 // { int|sys||profil(char *samples, size_t size, u_long offset, u_int scale); } SYS_KTRACE = 45 // { int|sys||ktrace(const char *fname, int ops, int facs, pid_t pid); } SYS_GETGID = 47 // { gid_t|sys||getgid_with_egid(void); } SYS___GETLOGIN = 49 // { int|sys||__getlogin(char *namebuf, size_t namelen); } SYS___SETLOGIN = 50 // { int|sys||__setlogin(const char *namebuf); } SYS_ACCT = 51 // { int|sys||acct(const char *path); } SYS_IOCTL = 54 // { int|sys||ioctl(int fd, u_long com, ... void *data); } SYS_REVOKE = 56 // { int|sys||revoke(const char *path); } SYS_SYMLINK = 57 // { int|sys||symlink(const char *path, const char *link); } SYS_READLINK = 58 // { ssize_t|sys||readlink(const char *path, char *buf, size_t count); } SYS_EXECVE = 59 // { int|sys||execve(const char *path, char * const *argp, char * const *envp); } SYS_UMASK = 60 // { mode_t|sys||umask(mode_t newmask); } SYS_CHROOT = 61 // { int|sys||chroot(const char *path); } SYS_VFORK = 66 // { int|sys||vfork(void); } SYS_SBRK = 69 // { int|sys||sbrk(intptr_t incr); } SYS_SSTK = 70 // { int|sys||sstk(int incr); } SYS_VADVISE = 72 // { int|sys||ovadvise(int anom); } SYS_MUNMAP = 73 // { int|sys||munmap(void *addr, size_t len); } SYS_MPROTECT = 74 // { int|sys||mprotect(void *addr, size_t len, int prot); } SYS_MADVISE = 75 // { int|sys||madvise(void *addr, size_t len, int behav); } SYS_MINCORE = 78 // { int|sys||mincore(void *addr, size_t len, char *vec); } SYS_GETGROUPS = 79 // { int|sys||getgroups(int gidsetsize, gid_t *gidset); } SYS_SETGROUPS = 80 // { int|sys||setgroups(int gidsetsize, const gid_t *gidset); } SYS_GETPGRP = 81 // { int|sys||getpgrp(void); } SYS_SETPGID = 82 // { int|sys||setpgid(pid_t pid, pid_t pgid); } SYS_DUP2 = 90 // { int|sys||dup2(int from, int to); } SYS_FCNTL = 92 // { int|sys||fcntl(int fd, int cmd, ... void *arg); } SYS_FSYNC = 95 // { int|sys||fsync(int fd); } SYS_SETPRIORITY = 96 // { int|sys||setpriority(int which, id_t who, int prio); } SYS_CONNECT = 98 // { int|sys||connect(int s, const struct sockaddr *name, socklen_t namelen); } SYS_GETPRIORITY = 100 // { int|sys||getpriority(int which, id_t who); } SYS_BIND = 104 // { int|sys||bind(int s, const struct sockaddr *name, socklen_t namelen); } SYS_SETSOCKOPT = 105 // { int|sys||setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } SYS_LISTEN = 106 // { int|sys||listen(int s, int backlog); } SYS_GETSOCKOPT = 118 // { int|sys||getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } SYS_READV = 120 // { ssize_t|sys||readv(int fd, const struct iovec *iovp, int iovcnt); } SYS_WRITEV = 121 // { ssize_t|sys||writev(int fd, const struct iovec *iovp, int iovcnt); } SYS_FCHOWN = 123 // { int|sys||fchown(int fd, uid_t uid, gid_t gid); } SYS_FCHMOD = 124 // { int|sys||fchmod(int fd, mode_t mode); } SYS_SETREUID = 126 // { int|sys||setreuid(uid_t ruid, uid_t euid); } SYS_SETREGID = 127 // { int|sys||setregid(gid_t rgid, gid_t egid); } SYS_RENAME = 128 // { int|sys||rename(const char *from, const char *to); } SYS_FLOCK = 131 // { int|sys||flock(int fd, int how); } SYS_MKFIFO = 132 // { int|sys||mkfifo(const char *path, mode_t mode); } SYS_SENDTO = 133 // { ssize_t|sys||sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } SYS_SHUTDOWN = 134 // { int|sys||shutdown(int s, int how); } SYS_SOCKETPAIR = 135 // { int|sys||socketpair(int domain, int type, int protocol, int *rsv); } SYS_MKDIR = 136 // { int|sys||mkdir(const char *path, mode_t mode); } SYS_RMDIR = 137 // { int|sys||rmdir(const char *path); } SYS_SETSID = 147 // { int|sys||setsid(void); } SYS_SYSARCH = 165 // { int|sys||sysarch(int op, void *parms); } SYS_PREAD = 173 // { ssize_t|sys||pread(int fd, void *buf, size_t nbyte, int PAD, off_t offset); } SYS_PWRITE = 174 // { ssize_t|sys||pwrite(int fd, const void *buf, size_t nbyte, int PAD, off_t offset); } SYS_NTP_ADJTIME = 176 // { int|sys||ntp_adjtime(struct timex *tp); } SYS_SETGID = 181 // { int|sys||setgid(gid_t gid); } SYS_SETEGID = 182 // { int|sys||setegid(gid_t egid); } SYS_SETEUID = 183 // { int|sys||seteuid(uid_t euid); } SYS_PATHCONF = 191 // { long|sys||pathconf(const char *path, int name); } SYS_FPATHCONF = 192 // { long|sys||fpathconf(int fd, int name); } SYS_GETRLIMIT = 194 // { int|sys||getrlimit(int which, struct rlimit *rlp); } SYS_SETRLIMIT = 195 // { int|sys||setrlimit(int which, const struct rlimit *rlp); } SYS_MMAP = 197 // { void *|sys||mmap(void *addr, size_t len, int prot, int flags, int fd, long PAD, off_t pos); } SYS_LSEEK = 199 // { off_t|sys||lseek(int fd, int PAD, off_t offset, int whence); } SYS_TRUNCATE = 200 // { int|sys||truncate(const char *path, int PAD, off_t length); } SYS_FTRUNCATE = 201 // { int|sys||ftruncate(int fd, int PAD, off_t length); } SYS___SYSCTL = 202 // { int|sys||__sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, const void *new, size_t newlen); } SYS_MLOCK = 203 // { int|sys||mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int|sys||munlock(const void *addr, size_t len); } SYS_UNDELETE = 205 // { int|sys||undelete(const char *path); } SYS_GETPGID = 207 // { pid_t|sys||getpgid(pid_t pid); } SYS_REBOOT = 208 // { int|sys||reboot(int opt, char *bootstr); } SYS_POLL = 209 // { int|sys||poll(struct pollfd *fds, u_int nfds, int timeout); } SYS_SEMGET = 221 // { int|sys||semget(key_t key, int nsems, int semflg); } SYS_SEMOP = 222 // { int|sys||semop(int semid, struct sembuf *sops, size_t nsops); } SYS_SEMCONFIG = 223 // { int|sys||semconfig(int flag); } SYS_MSGGET = 225 // { int|sys||msgget(key_t key, int msgflg); } SYS_MSGSND = 226 // { int|sys||msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } SYS_MSGRCV = 227 // { ssize_t|sys||msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } SYS_SHMAT = 228 // { void *|sys||shmat(int shmid, const void *shmaddr, int shmflg); } SYS_SHMDT = 230 // { int|sys||shmdt(const void *shmaddr); } SYS_SHMGET = 231 // { int|sys||shmget(key_t key, size_t size, int shmflg); } SYS_TIMER_CREATE = 235 // { int|sys||timer_create(clockid_t clock_id, struct sigevent *evp, timer_t *timerid); } SYS_TIMER_DELETE = 236 // { int|sys||timer_delete(timer_t timerid); } SYS_TIMER_GETOVERRUN = 239 // { int|sys||timer_getoverrun(timer_t timerid); } SYS_FDATASYNC = 241 // { int|sys||fdatasync(int fd); } SYS_MLOCKALL = 242 // { int|sys||mlockall(int flags); } SYS_MUNLOCKALL = 243 // { int|sys||munlockall(void); } SYS_SIGQUEUEINFO = 245 // { int|sys||sigqueueinfo(pid_t pid, const siginfo_t *info); } SYS_MODCTL = 246 // { int|sys||modctl(int cmd, void *arg); } SYS___POSIX_RENAME = 270 // { int|sys||__posix_rename(const char *from, const char *to); } SYS_SWAPCTL = 271 // { int|sys||swapctl(int cmd, void *arg, int misc); } SYS_MINHERIT = 273 // { int|sys||minherit(void *addr, size_t len, int inherit); } SYS_LCHMOD = 274 // { int|sys||lchmod(const char *path, mode_t mode); } SYS_LCHOWN = 275 // { int|sys||lchown(const char *path, uid_t uid, gid_t gid); } SYS_MSYNC = 277 // { int|sys|13|msync(void *addr, size_t len, int flags); } SYS___POSIX_CHOWN = 283 // { int|sys||__posix_chown(const char *path, uid_t uid, gid_t gid); } SYS___POSIX_FCHOWN = 284 // { int|sys||__posix_fchown(int fd, uid_t uid, gid_t gid); } SYS___POSIX_LCHOWN = 285 // { int|sys||__posix_lchown(const char *path, uid_t uid, gid_t gid); } SYS_GETSID = 286 // { pid_t|sys||getsid(pid_t pid); } SYS___CLONE = 287 // { pid_t|sys||__clone(int flags, void *stack); } SYS_FKTRACE = 288 // { int|sys||fktrace(int fd, int ops, int facs, pid_t pid); } SYS_PREADV = 289 // { ssize_t|sys||preadv(int fd, const struct iovec *iovp, int iovcnt, int PAD, off_t offset); } SYS_PWRITEV = 290 // { ssize_t|sys||pwritev(int fd, const struct iovec *iovp, int iovcnt, int PAD, off_t offset); } SYS___GETCWD = 296 // { int|sys||__getcwd(char *bufp, size_t length); } SYS_FCHROOT = 297 // { int|sys||fchroot(int fd); } SYS_LCHFLAGS = 304 // { int|sys||lchflags(const char *path, u_long flags); } SYS_ISSETUGID = 305 // { int|sys||issetugid(void); } SYS_UTRACE = 306 // { int|sys||utrace(const char *label, void *addr, size_t len); } SYS_GETCONTEXT = 307 // { int|sys||getcontext(struct __ucontext *ucp); } SYS_SETCONTEXT = 308 // { int|sys||setcontext(const struct __ucontext *ucp); } SYS__LWP_CREATE = 309 // { int|sys||_lwp_create(const struct __ucontext *ucp, u_long flags, lwpid_t *new_lwp); } SYS__LWP_EXIT = 310 // { int|sys||_lwp_exit(void); } SYS__LWP_SELF = 311 // { lwpid_t|sys||_lwp_self(void); } SYS__LWP_WAIT = 312 // { int|sys||_lwp_wait(lwpid_t wait_for, lwpid_t *departed); } SYS__LWP_SUSPEND = 313 // { int|sys||_lwp_suspend(lwpid_t target); } SYS__LWP_CONTINUE = 314 // { int|sys||_lwp_continue(lwpid_t target); } SYS__LWP_WAKEUP = 315 // { int|sys||_lwp_wakeup(lwpid_t target); } SYS__LWP_GETPRIVATE = 316 // { void *|sys||_lwp_getprivate(void); } SYS__LWP_SETPRIVATE = 317 // { void|sys||_lwp_setprivate(void *ptr); } SYS__LWP_KILL = 318 // { int|sys||_lwp_kill(lwpid_t target, int signo); } SYS__LWP_DETACH = 319 // { int|sys||_lwp_detach(lwpid_t target); } SYS__LWP_UNPARK = 321 // { int|sys||_lwp_unpark(lwpid_t target, const void *hint); } SYS__LWP_UNPARK_ALL = 322 // { ssize_t|sys||_lwp_unpark_all(const lwpid_t *targets, size_t ntargets, const void *hint); } SYS__LWP_SETNAME = 323 // { int|sys||_lwp_setname(lwpid_t target, const char *name); } SYS__LWP_GETNAME = 324 // { int|sys||_lwp_getname(lwpid_t target, char *name, size_t len); } SYS__LWP_CTL = 325 // { int|sys||_lwp_ctl(int features, struct lwpctl **address); } SYS___SIGACTION_SIGTRAMP = 340 // { int|sys||__sigaction_sigtramp(int signum, const struct sigaction *nsa, struct sigaction *osa, const void *tramp, int vers); } SYS_PMC_GET_INFO = 341 // { int|sys||pmc_get_info(int ctr, int op, void *args); } SYS_PMC_CONTROL = 342 // { int|sys||pmc_control(int ctr, int op, void *args); } SYS_RASCTL = 343 // { int|sys||rasctl(void *addr, size_t len, int op); } SYS_KQUEUE = 344 // { int|sys||kqueue(void); } SYS__SCHED_SETPARAM = 346 // { int|sys||_sched_setparam(pid_t pid, lwpid_t lid, int policy, const struct sched_param *params); } SYS__SCHED_GETPARAM = 347 // { int|sys||_sched_getparam(pid_t pid, lwpid_t lid, int *policy, struct sched_param *params); } SYS__SCHED_SETAFFINITY = 348 // { int|sys||_sched_setaffinity(pid_t pid, lwpid_t lid, size_t size, const cpuset_t *cpuset); } SYS__SCHED_GETAFFINITY = 349 // { int|sys||_sched_getaffinity(pid_t pid, lwpid_t lid, size_t size, cpuset_t *cpuset); } SYS_SCHED_YIELD = 350 // { int|sys||sched_yield(void); } SYS_FSYNC_RANGE = 354 // { int|sys||fsync_range(int fd, int flags, off_t start, off_t length); } SYS_UUIDGEN = 355 // { int|sys||uuidgen(struct uuid *store, int count); } SYS_GETVFSSTAT = 356 // { int|sys||getvfsstat(struct statvfs *buf, size_t bufsize, int flags); } SYS_STATVFS1 = 357 // { int|sys||statvfs1(const char *path, struct statvfs *buf, int flags); } SYS_FSTATVFS1 = 358 // { int|sys||fstatvfs1(int fd, struct statvfs *buf, int flags); } SYS_EXTATTRCTL = 360 // { int|sys||extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } SYS_EXTATTR_SET_FILE = 361 // { int|sys||extattr_set_file(const char *path, int attrnamespace, const char *attrname, const void *data, size_t nbytes); } SYS_EXTATTR_GET_FILE = 362 // { ssize_t|sys||extattr_get_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FILE = 363 // { int|sys||extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } SYS_EXTATTR_SET_FD = 364 // { int|sys||extattr_set_fd(int fd, int attrnamespace, const char *attrname, const void *data, size_t nbytes); } SYS_EXTATTR_GET_FD = 365 // { ssize_t|sys||extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FD = 366 // { int|sys||extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } SYS_EXTATTR_SET_LINK = 367 // { int|sys||extattr_set_link(const char *path, int attrnamespace, const char *attrname, const void *data, size_t nbytes); } SYS_EXTATTR_GET_LINK = 368 // { ssize_t|sys||extattr_get_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_LINK = 369 // { int|sys||extattr_delete_link(const char *path, int attrnamespace, const char *attrname); } SYS_EXTATTR_LIST_FD = 370 // { ssize_t|sys||extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } SYS_EXTATTR_LIST_FILE = 371 // { ssize_t|sys||extattr_list_file(const char *path, int attrnamespace, void *data, size_t nbytes); } SYS_EXTATTR_LIST_LINK = 372 // { ssize_t|sys||extattr_list_link(const char *path, int attrnamespace, void *data, size_t nbytes); } SYS_SETXATTR = 375 // { int|sys||setxattr(const char *path, const char *name, const void *value, size_t size, int flags); } SYS_LSETXATTR = 376 // { int|sys||lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags); } SYS_FSETXATTR = 377 // { int|sys||fsetxattr(int fd, const char *name, const void *value, size_t size, int flags); } SYS_GETXATTR = 378 // { int|sys||getxattr(const char *path, const char *name, void *value, size_t size); } SYS_LGETXATTR = 379 // { int|sys||lgetxattr(const char *path, const char *name, void *value, size_t size); } SYS_FGETXATTR = 380 // { int|sys||fgetxattr(int fd, const char *name, void *value, size_t size); } SYS_LISTXATTR = 381 // { int|sys||listxattr(const char *path, char *list, size_t size); } SYS_LLISTXATTR = 382 // { int|sys||llistxattr(const char *path, char *list, size_t size); } SYS_FLISTXATTR = 383 // { int|sys||flistxattr(int fd, char *list, size_t size); } SYS_REMOVEXATTR = 384 // { int|sys||removexattr(const char *path, const char *name); } SYS_LREMOVEXATTR = 385 // { int|sys||lremovexattr(const char *path, const char *name); } SYS_FREMOVEXATTR = 386 // { int|sys||fremovexattr(int fd, const char *name); } SYS_GETDENTS = 390 // { int|sys|30|getdents(int fd, char *buf, size_t count); } SYS_SOCKET = 394 // { int|sys|30|socket(int domain, int type, int protocol); } SYS_GETFH = 395 // { int|sys|30|getfh(const char *fname, void *fhp, size_t *fh_size); } SYS_MOUNT = 410 // { int|sys|50|mount(const char *type, const char *path, int flags, void *data, size_t data_len); } SYS_MREMAP = 411 // { void *|sys||mremap(void *old_address, size_t old_size, void *new_address, size_t new_size, int flags); } SYS_PSET_CREATE = 412 // { int|sys||pset_create(psetid_t *psid); } SYS_PSET_DESTROY = 413 // { int|sys||pset_destroy(psetid_t psid); } SYS_PSET_ASSIGN = 414 // { int|sys||pset_assign(psetid_t psid, cpuid_t cpuid, psetid_t *opsid); } SYS__PSET_BIND = 415 // { int|sys||_pset_bind(idtype_t idtype, id_t first_id, id_t second_id, psetid_t psid, psetid_t *opsid); } SYS_POSIX_FADVISE = 416 // { int|sys|50|posix_fadvise(int fd, int PAD, off_t offset, off_t len, int advice); } SYS_SELECT = 417 // { int|sys|50|select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } SYS_GETTIMEOFDAY = 418 // { int|sys|50|gettimeofday(struct timeval *tp, void *tzp); } SYS_SETTIMEOFDAY = 419 // { int|sys|50|settimeofday(const struct timeval *tv, const void *tzp); } SYS_UTIMES = 420 // { int|sys|50|utimes(const char *path, const struct timeval *tptr); } SYS_ADJTIME = 421 // { int|sys|50|adjtime(const struct timeval *delta, struct timeval *olddelta); } SYS_FUTIMES = 423 // { int|sys|50|futimes(int fd, const struct timeval *tptr); } SYS_LUTIMES = 424 // { int|sys|50|lutimes(const char *path, const struct timeval *tptr); } SYS_SETITIMER = 425 // { int|sys|50|setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } SYS_GETITIMER = 426 // { int|sys|50|getitimer(int which, struct itimerval *itv); } SYS_CLOCK_GETTIME = 427 // { int|sys|50|clock_gettime(clockid_t clock_id, struct timespec *tp); } SYS_CLOCK_SETTIME = 428 // { int|sys|50|clock_settime(clockid_t clock_id, const struct timespec *tp); } SYS_CLOCK_GETRES = 429 // { int|sys|50|clock_getres(clockid_t clock_id, struct timespec *tp); } SYS_NANOSLEEP = 430 // { int|sys|50|nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } SYS___SIGTIMEDWAIT = 431 // { int|sys|50|__sigtimedwait(const sigset_t *set, siginfo_t *info, struct timespec *timeout); } SYS__LWP_PARK = 434 // { int|sys|50|_lwp_park(const struct timespec *ts, lwpid_t unpark, const void *hint, const void *unparkhint); } SYS_KEVENT = 435 // { int|sys|50|kevent(int fd, const struct kevent *changelist, size_t nchanges, struct kevent *eventlist, size_t nevents, const struct timespec *timeout); } SYS_PSELECT = 436 // { int|sys|50|pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } SYS_POLLTS = 437 // { int|sys|50|pollts(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } SYS_STAT = 439 // { int|sys|50|stat(const char *path, struct stat *ub); } SYS_FSTAT = 440 // { int|sys|50|fstat(int fd, struct stat *sb); } SYS_LSTAT = 441 // { int|sys|50|lstat(const char *path, struct stat *ub); } SYS___SEMCTL = 442 // { int|sys|50|__semctl(int semid, int semnum, int cmd, ... union __semun *arg); } SYS_SHMCTL = 443 // { int|sys|50|shmctl(int shmid, int cmd, struct shmid_ds *buf); } SYS_MSGCTL = 444 // { int|sys|50|msgctl(int msqid, int cmd, struct msqid_ds *buf); } SYS_GETRUSAGE = 445 // { int|sys|50|getrusage(int who, struct rusage *rusage); } SYS_TIMER_SETTIME = 446 // { int|sys|50|timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); } SYS_TIMER_GETTIME = 447 // { int|sys|50|timer_gettime(timer_t timerid, struct itimerspec *value); } SYS_NTP_GETTIME = 448 // { int|sys|50|ntp_gettime(struct ntptimeval *ntvp); } SYS_WAIT4 = 449 // { int|sys|50|wait4(pid_t pid, int *status, int options, struct rusage *rusage); } SYS_MKNOD = 450 // { int|sys|50|mknod(const char *path, mode_t mode, dev_t dev); } SYS_FHSTAT = 451 // { int|sys|50|fhstat(const void *fhp, size_t fh_size, struct stat *sb); } SYS_PIPE2 = 453 // { int|sys||pipe2(int *fildes, int flags); } SYS_DUP3 = 454 // { int|sys||dup3(int from, int to, int flags); } SYS_KQUEUE1 = 455 // { int|sys||kqueue1(int flags); } SYS_PACCEPT = 456 // { int|sys||paccept(int s, struct sockaddr *name, socklen_t *anamelen, const sigset_t *mask, int flags); } SYS_LINKAT = 457 // { int|sys||linkat(int fd1, const char *name1, int fd2, const char *name2, int flags); } SYS_RENAMEAT = 458 // { int|sys||renameat(int fromfd, const char *from, int tofd, const char *to); } SYS_MKFIFOAT = 459 // { int|sys||mkfifoat(int fd, const char *path, mode_t mode); } SYS_MKNODAT = 460 // { int|sys||mknodat(int fd, const char *path, mode_t mode, uint32_t dev); } SYS_MKDIRAT = 461 // { int|sys||mkdirat(int fd, const char *path, mode_t mode); } SYS_FACCESSAT = 462 // { int|sys||faccessat(int fd, const char *path, int amode, int flag); } SYS_FCHMODAT = 463 // { int|sys||fchmodat(int fd, const char *path, mode_t mode, int flag); } SYS_FCHOWNAT = 464 // { int|sys||fchownat(int fd, const char *path, uid_t owner, gid_t group, int flag); } SYS_FEXECVE = 465 // { int|sys||fexecve(int fd, char * const *argp, char * const *envp); } SYS_FSTATAT = 466 // { int|sys||fstatat(int fd, const char *path, struct stat *buf, int flag); } SYS_UTIMENSAT = 467 // { int|sys||utimensat(int fd, const char *path, const struct timespec *tptr, int flag); } SYS_OPENAT = 468 // { int|sys||openat(int fd, const char *path, int oflags, ... mode_t mode); } SYS_READLINKAT = 469 // { int|sys||readlinkat(int fd, const char *path, char *buf, size_t bufsize); } SYS_SYMLINKAT = 470 // { int|sys||symlinkat(const char *path1, int fd, const char *path2); } SYS_UNLINKAT = 471 // { int|sys||unlinkat(int fd, const char *path, int flag); } SYS_FUTIMENS = 472 // { int|sys||futimens(int fd, const struct timespec *tptr); } SYS___QUOTACTL = 473 // { int|sys||__quotactl(const char *path, struct quotactl_args *args); } SYS_POSIX_SPAWN = 474 // { int|sys||posix_spawn(pid_t *pid, const char *path, const struct posix_spawn_file_actions *file_actions, const struct posix_spawnattr *attrp, char *const *argv, char *const *envp); } SYS_RECVMMSG = 475 // { int|sys||recvmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags, struct timespec *timeout); } SYS_SENDMMSG = 476 // { int|sys||sendmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags); } )
{ "pile_set_name": "Github" }
// go run mksyscall.go -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 FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) { r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_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 fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 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) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_FCHMODAT, 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 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 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 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 ClockGetres(clockid int32, res *Timespec) (err error) { _, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 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 ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 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 DeleteModule(name string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(name) if err != nil { return } _, _, e1 := Syscall(SYS_DELETE_MODULE, 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 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 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) { SyscallNoError(SYS_EXIT_GROUP, uintptr(code), 0, 0) 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 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 Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(attr) if err != nil { return } var _p1 unsafe.Pointer if len(dest) > 0 { _p1 = unsafe.Pointer(&dest[0]) } else { _p1 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), 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 FinitModule(fd int, params string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(params) if err != nil { return } _, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), 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 Flistxattr(fd int, dest []byte) (sz int, err error) { var _p0 unsafe.Pointer if len(dest) > 0 { _p0 = unsafe.Pointer(&dest[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_FLISTXATTR, uintptr(fd), uintptr(_p0), 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 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 Fremovexattr(fd int, attr string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsetxattr(fd int, attr string, dest []byte, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(attr) if err != nil { return } var _p1 unsafe.Pointer if len(dest) > 0 { _p1 = unsafe.Pointer(&dest[0]) } else { _p1 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)), uintptr(flags), 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, _ := RawSyscallNoError(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, _ := RawSyscallNoError(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, _ := RawSyscallNoError(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 InitModule(moduleImage []byte, params string) (err error) { var _p0 unsafe.Pointer if len(moduleImage) > 0 { _p0 = unsafe.Pointer(&moduleImage[0]) } else { _p0 = unsafe.Pointer(&_zero) } var _p1 *byte _p1, err = BytePtrFromString(params) if err != nil { return } _, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), 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 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 MemfdCreate(name string, flags int) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(name) if err != nil { return } r0, _, e1 := Syscall(SYS_MEMFD_CREATE, uintptr(unsafe.Pointer(_p0)), 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 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 PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) { r0, _, e1 := Syscall6(SYS_PERF_EVENT_OPEN, uintptr(unsafe.Pointer(attr)), uintptr(pid), uintptr(cpu), uintptr(groupFd), 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 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 Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) n = int(r0) 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 Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (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_RENAMEAT2, 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 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 Signalfd(fd int, mask *Sigset_t, flags int) { SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), 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 Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Syncfs(fd int) (err error) { _, _, e1 := Syscall(SYS_SYNCFS, 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 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, _ := RawSyscallNoError(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 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 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 Msync(b []byte, flags int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) 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 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 faccessat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_FACCESSAT, 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 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 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 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 Fadvise(fd int, offset int64, length int64, advice int) (err error) { _, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 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 Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_NEWFSTATAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 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 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, _ := RawSyscallNoError(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, _ := RawSyscallNoError(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, _ := RawSyscallNoError(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, _ := RawSyscallNoError(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 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 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__NEWSELECT, 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 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 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 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 futimesat(dirfd int, path string, times *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), 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 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 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 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 } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off), uintptr(n), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(cmdline) if err != nil { return } _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return }
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) /* * Copyright (c) 2016 BayLibre, SAS. * Author: Neil Armstrong <[email protected]> */ #include <linux/platform_device.h> #include <linux/mfd/syscon.h> #include "clk-regmap.h" #include "meson-aoclk.h" #include "gxbb-aoclk.h" #define GXBB_AO_GATE(_name, _bit) \ static struct clk_regmap _name##_ao = { \ .data = &(struct clk_regmap_gate_data) { \ .offset = AO_RTI_GEN_CNTL_REG0, \ .bit_idx = (_bit), \ }, \ .hw.init = &(struct clk_init_data) { \ .name = #_name "_ao", \ .ops = &clk_regmap_gate_ops, \ .parent_names = (const char *[]){ "clk81" }, \ .num_parents = 1, \ .flags = CLK_IGNORE_UNUSED, \ }, \ } GXBB_AO_GATE(remote, 0); GXBB_AO_GATE(i2c_master, 1); GXBB_AO_GATE(i2c_slave, 2); GXBB_AO_GATE(uart1, 3); GXBB_AO_GATE(uart2, 5); GXBB_AO_GATE(ir_blaster, 6); static struct aoclk_cec_32k cec_32k_ao = { .hw.init = &(struct clk_init_data) { .name = "cec_32k_ao", .ops = &meson_aoclk_cec_32k_ops, .parent_names = (const char *[]){ "xtal" }, .num_parents = 1, .flags = CLK_IGNORE_UNUSED, }, }; static const unsigned int gxbb_aoclk_reset[] = { [RESET_AO_REMOTE] = 16, [RESET_AO_I2C_MASTER] = 18, [RESET_AO_I2C_SLAVE] = 19, [RESET_AO_UART1] = 17, [RESET_AO_UART2] = 22, [RESET_AO_IR_BLASTER] = 23, }; static struct clk_regmap *gxbb_aoclk_gate[] = { [CLKID_AO_REMOTE] = &remote_ao, [CLKID_AO_I2C_MASTER] = &i2c_master_ao, [CLKID_AO_I2C_SLAVE] = &i2c_slave_ao, [CLKID_AO_UART1] = &uart1_ao, [CLKID_AO_UART2] = &uart2_ao, [CLKID_AO_IR_BLASTER] = &ir_blaster_ao, }; static const struct clk_hw_onecell_data gxbb_aoclk_onecell_data = { .hws = { [CLKID_AO_REMOTE] = &remote_ao.hw, [CLKID_AO_I2C_MASTER] = &i2c_master_ao.hw, [CLKID_AO_I2C_SLAVE] = &i2c_slave_ao.hw, [CLKID_AO_UART1] = &uart1_ao.hw, [CLKID_AO_UART2] = &uart2_ao.hw, [CLKID_AO_IR_BLASTER] = &ir_blaster_ao.hw, [CLKID_AO_CEC_32K] = &cec_32k_ao.hw, }, .num = NR_CLKS, }; static int gxbb_register_cec_ao_32k(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct regmap *regmap; int ret; regmap = syscon_node_to_regmap(of_get_parent(dev->of_node)); if (IS_ERR(regmap)) { dev_err(dev, "failed to get regmap\n"); return PTR_ERR(regmap); } /* Specific clocks */ cec_32k_ao.regmap = regmap; ret = devm_clk_hw_register(dev, &cec_32k_ao.hw); if (ret) { dev_err(&pdev->dev, "clk cec_32k_ao register failed.\n"); return ret; } return 0; } static const struct meson_aoclk_data gxbb_aoclkc_data = { .reset_reg = AO_RTI_GEN_CNTL_REG0, .num_reset = ARRAY_SIZE(gxbb_aoclk_reset), .reset = gxbb_aoclk_reset, .num_clks = ARRAY_SIZE(gxbb_aoclk_gate), .clks = gxbb_aoclk_gate, .hw_data = &gxbb_aoclk_onecell_data, }; static int gxbb_aoclkc_probe(struct platform_device *pdev) { int ret = gxbb_register_cec_ao_32k(pdev); if (ret) return ret; return meson_aoclkc_probe(pdev); } static const struct of_device_id gxbb_aoclkc_match_table[] = { { .compatible = "amlogic,meson-gx-aoclkc", .data = &gxbb_aoclkc_data, }, { } }; static struct platform_driver gxbb_aoclkc_driver = { .probe = gxbb_aoclkc_probe, .driver = { .name = "gxbb-aoclkc", .of_match_table = gxbb_aoclkc_match_table, }, }; builtin_platform_driver(gxbb_aoclkc_driver);
{ "pile_set_name": "Github" }
var app = angular.module('demo', ['ngNotify']); app.controller('MainCtrl', ['$scope', 'ngNotify', function($scope, ngNotify) { 'use strict'; // Custom additions, helpful when testing... /* ngNotify.config({ theme: 'pastel', position: 'top', duration: 'f', type: 'success', sticky: true, html: true, target: '#modular' }); ngNotify.addTheme('newTheme', 'my-new-class'); ngNotify.config({ theme: 'newTheme' }); */ // --- /* ngNotify.addType('notice', 'my-notice-type'); ngNotify.set('This is my notice type!', 'notice'); */ var userCallback = function() { console.log('Callback triggered after message fades.'); }; // Demo notifications... $scope.displayNotify = function(notify) { switch(notify) { case 'success': ngNotify.set('You have successfully logged in!', { type: 'success' }); break; case 'info': ngNotify.set('You have a new message in your inbox.', 'info'); break; case 'warn': ngNotify.set('Please login before accessing that part of the site.', 'warn'); break; case 'error': ngNotify.set('The action you are trying to take does not exist.', 'error'); break; case 'grimace': ngNotify.set('An additional notification type to use.', 'grimace'); break; case 'html': ngNotify.set('&iexcl;<i>You</i> should &copy;heck to make sure the <b>html</b> option is set to true!'); break; case 'modular': ngNotify.set('Modular notification example, bound within our container.', { target: '#modular' }, userCallback); break; default: ngNotify.set('This is the current default message type.'); break; } }; // Configuration options... $scope.theme = 'pure'; $scope.themeOptions = ['pure', 'pastel', 'prime', 'pitchy']; $scope.duration = 4000; $scope.durationOptions = [ { id: 500, value: '500 ms' }, { id: 1000, value: '1000 ms' }, { id: 2000, value: '2000 ms' }, { id: 4000, value: '4000 ms' }, { id: 8000 , value: '8000 ms'} ]; $scope.position = 'bottom'; $scope.positionOptions = ['bottom', 'top']; $scope.defaultType = 'info'; $scope.defaultOptions = ['info', 'success', 'warn', 'error', 'grimace']; $scope.sticky = false; $scope.stickyOptions = [true, false]; $scope.button = true; $scope.buttonOptions = [true, false]; $scope.html = false; $scope.htmlOptions = [true, false]; // Configuration actions... $scope.setDefaultType = function() { ngNotify.config({ type: $scope.defaultType }); }; $scope.setDefaultPosition = function() { ngNotify.config({ position: $scope.position }); }; $scope.setDefaultDuration = function() { ngNotify.config({ duration: $scope.duration }); }; $scope.setDefaultTheme = function() { ngNotify.config({ theme: $scope.theme }); }; $scope.setDefaultSticky = function() { ngNotify.config({ sticky: $scope.sticky }); }; $scope.setDefaultButton = function() { ngNotify.config({ button: $scope.button }); }; $scope.setDefaultHtml = function() { ngNotify.config({ html: $scope.html }); }; $scope.dismissNotify = function() { ngNotify.dismiss(); }; } ]); /* jshint ignore:start */ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-52145715-3', 'matowens.github.io'); ga('send', 'pageview'); /* jshint ignore:end */
{ "pile_set_name": "Github" }
# # Display drivers configuration # menu "Display device support" config DISPLAY_SUPPORT tristate "Display panel/monitor support" ---help--- This framework adds support for low-level control of a display. This includes support for power. Enable this to be able to choose the drivers for controlling the physical display panel/monitor on some platforms. This not only covers LCD displays for PDAs but also other types of displays such as CRT, TVout etc. To have support for your specific display panel you will have to select the proper drivers which depend on this option. comment "Display hardware drivers" depends on DISPLAY_SUPPORT endmenu
{ "pile_set_name": "Github" }
package org.bouncycastle.asn1; import java.io.IOException; public class DEROctetString extends ASN1OctetString { /** * @param string the octets making up the octet string. */ public DEROctetString( byte[] string) { super(string); } public DEROctetString( ASN1Encodable obj) throws IOException { super(obj.toASN1Primitive().getEncoded(ASN1Encoding.DER)); } boolean isConstructed() { return false; } int encodedLength() { return 1 + StreamUtil.calculateBodyLength(string.length) + string.length; } void encode( ASN1OutputStream out) throws IOException { out.writeEncoded(BERTags.OCTET_STRING, string); } static void encode( DEROutputStream derOut, byte[] bytes) throws IOException { derOut.writeEncoded(BERTags.OCTET_STRING, bytes); } }
{ "pile_set_name": "Github" }
/** * `password` type prompt */ var util = require("util"); var chalk = require("chalk"); var Base = require("./base"); var observe = require("../utils/events"); function mask(input) { input = String(input); if (input.length === 0) { return ''; } return new Array(input.length + 1).join('*'); } /** * Module exports */ module.exports = Prompt; /** * Constructor */ function Prompt() { return Base.apply( this, arguments ); } util.inherits( Prompt, Base ); /** * Start the Inquiry session * @param {Function} cb Callback when prompt is done * @return {this} */ Prompt.prototype._run = function( cb ) { this.done = cb; var events = observe(this.rl); // Once user confirm (enter key) var submit = events.line.map( this.filterInput.bind(this) ); var validation = this.handleSubmitEvents( submit ); validation.success.forEach( this.onEnd.bind(this) ); validation.error.forEach( this.onError.bind(this) ); events.keypress.takeUntil( validation.success ).forEach( this.onKeypress.bind(this) ); // Init this.render(); return this; }; /** * Render the prompt to screen * @return {Prompt} self */ Prompt.prototype.render = function (error) { var message = this.getQuestion(); var bottomContent = ''; if (this.status === 'answered') { message += chalk.cyan(mask(this.answer)); } else { message += mask(this.rl.line || ''); } if (error) { bottomContent = '\n' + chalk.red('>> ') + error; } this.screen.render(message, bottomContent); }; /** * When user press `enter` key */ Prompt.prototype.filterInput = function( input ) { if ( !input ) { return this.opt.default != null ? this.opt.default : ""; } return input; }; Prompt.prototype.onEnd = function( state ) { this.status = "answered"; this.answer = state.value; // Re-render prompt this.render(); this.screen.done(); this.done( state.value ); }; Prompt.prototype.onError = function( state ) { this.render(state.isValid); this.rl.output.unmute(); }; /** * When user type */ Prompt.prototype.onKeypress = function() { this.render(); };
{ "pile_set_name": "Github" }
//sidebar $menuBg:#304156; $subMenuBg:#1f2d3d; $menuHover:#001528; $blue:#324157; $light-blue:#3A71A8; $red:#C03639; $pink: #E65D6E; $green: #30B08F; $tiffany: #4AB7BD; $yellow:#FEC171; $panGreen: #30B08F; //sidebar
{ "pile_set_name": "Github" }
package kotlinx.html import kotlinx.html.* import kotlinx.html.impl.* import kotlinx.html.attributes.* /******************************************************************************* DO NOT EDIT This file was generated by module generate *******************************************************************************/ @Suppress("unused") open class SAMP(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("samp", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag { } val SAMP.asFlowContent : FlowContent get() = this val SAMP.asPhrasingContent : PhrasingContent get() = this @Suppress("unused") open class SCRIPT(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("script", consumer, initialAttributes, null, false, false), FlowMetaDataPhrasingContent { var charset : String get() = attributeStringString.get(this, "charset") set(newValue) {attributeStringString.set(this, "charset", newValue)} var type : String get() = attributeStringString.get(this, "type") set(newValue) {attributeStringString.set(this, "type", newValue)} var src : String get() = attributeStringString.get(this, "src") set(newValue) {attributeStringString.set(this, "src", newValue)} var defer : Boolean get() = attributeBooleanTicker.get(this, "defer") set(newValue) {attributeBooleanTicker.set(this, "defer", newValue)} var async : Boolean get() = attributeBooleanTicker.get(this, "async") set(newValue) {attributeBooleanTicker.set(this, "async", newValue)} var nonce : String get() = attributeStringString.get(this, "nonce") set(newValue) {attributeStringString.set(this, "nonce", newValue)} var integrity : String get() = attributeStringString.get(this, "integrity") set(newValue) {attributeStringString.set(this, "integrity", newValue)} @Deprecated("This tag most likely doesn't support text content or requires unsafe content (try unsafe {}") override operator fun Entities.unaryPlus() : Unit { @Suppress("DEPRECATION") entity(this) } @Deprecated("This tag most likely doesn't support text content or requires unsafe content (try unsafe {}") override operator fun String.unaryPlus() : Unit { @Suppress("DEPRECATION") text(this) } @Deprecated("This tag most likely doesn't support text content or requires unsafe content (try unsafe {}") override fun text(s : String) : Unit { super<HTMLTag>.text(s) } @Deprecated("This tag most likely doesn't support text content or requires unsafe content (try unsafe {}") override fun text(n : Number) : Unit { super<HTMLTag>.text(n) } @Deprecated("This tag most likely doesn't support text content or requires unsafe content (try unsafe {}") override fun entity(e : Entities) : Unit { super<HTMLTag>.entity(e) } } val SCRIPT.asFlowContent : FlowContent get() = this val SCRIPT.asMetaDataContent : MetaDataContent get() = this val SCRIPT.asPhrasingContent : PhrasingContent get() = this @Suppress("unused") open class SECTION(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("section", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowSectioningContent { } val SECTION.asFlowContent : FlowContent get() = this val SECTION.asSectioningContent : SectioningContent get() = this @Suppress("unused") open class SELECT(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("select", consumer, initialAttributes, null, true, false), CommonAttributeGroupFacadeFlowInteractivePhrasingContent { var autoFocus : Boolean get() = attributeBooleanTicker.get(this, "autofocus") set(newValue) {attributeBooleanTicker.set(this, "autofocus", newValue)} var disabled : Boolean get() = attributeBooleanTicker.get(this, "disabled") set(newValue) {attributeBooleanTicker.set(this, "disabled", newValue)} var form : String get() = attributeStringString.get(this, "form") set(newValue) {attributeStringString.set(this, "form", newValue)} var multiple : Boolean get() = attributeBooleanTicker.get(this, "multiple") set(newValue) {attributeBooleanTicker.set(this, "multiple", newValue)} var name : String get() = attributeStringString.get(this, "name") set(newValue) {attributeStringString.set(this, "name", newValue)} var size : String get() = attributeStringString.get(this, "size") set(newValue) {attributeStringString.set(this, "size", newValue)} var required : Boolean get() = attributeBooleanTicker.get(this, "required") set(newValue) {attributeBooleanTicker.set(this, "required", newValue)} } /** * Selectable choice */ @HtmlTagMarker inline fun SELECT.option(classes : String? = null, crossinline block : OPTION.() -> Unit = {}) : Unit = OPTION(attributesMapOf("class", classes), consumer).visit(block) /** * Selectable choice */ @HtmlTagMarker fun SELECT.option(classes : String? = null, content : String = "") : Unit = OPTION(attributesMapOf("class", classes), consumer).visit({+content}) /** * Option group */ @HtmlTagMarker inline fun SELECT.optGroup(label : String? = null, classes : String? = null, crossinline block : OPTGROUP.() -> Unit = {}) : Unit = OPTGROUP(attributesMapOf("label", label,"class", classes), consumer).visit(block) val SELECT.asFlowContent : FlowContent get() = this val SELECT.asInteractiveContent : InteractiveContent get() = this val SELECT.asPhrasingContent : PhrasingContent get() = this @Suppress("unused") open class SMALL(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("small", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag { } val SMALL.asFlowContent : FlowContent get() = this val SMALL.asPhrasingContent : PhrasingContent get() = this @Suppress("unused") open class SOURCE(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("source", consumer, initialAttributes, null, true, true), CommonAttributeGroupFacade { var src : String get() = attributeStringString.get(this, "src") set(newValue) {attributeStringString.set(this, "src", newValue)} var type : String get() = attributeStringString.get(this, "type") set(newValue) {attributeStringString.set(this, "type", newValue)} var media : String get() = attributeStringString.get(this, "media") set(newValue) {attributeStringString.set(this, "media", newValue)} } @Suppress("unused") open class SPAN(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("span", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag { } val SPAN.asFlowContent : FlowContent get() = this val SPAN.asPhrasingContent : PhrasingContent get() = this @Suppress("unused") open class STRONG(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("strong", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag { } val STRONG.asFlowContent : FlowContent get() = this val STRONG.asPhrasingContent : PhrasingContent get() = this @Suppress("unused") open class STYLE(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("style", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowMetaDataContent { var type : String get() = attributeStringString.get(this, "type") set(newValue) {attributeStringString.set(this, "type", newValue)} var media : String get() = attributeStringString.get(this, "media") set(newValue) {attributeStringString.set(this, "media", newValue)} var scoped : Boolean get() = attributeBooleanTicker.get(this, "scoped") set(newValue) {attributeBooleanTicker.set(this, "scoped", newValue)} var nonce : String get() = attributeStringString.get(this, "nonce") set(newValue) {attributeStringString.set(this, "nonce", newValue)} @Deprecated("This tag most likely doesn't support text content or requires unsafe content (try unsafe {}") override operator fun Entities.unaryPlus() : Unit { @Suppress("DEPRECATION") entity(this) } @Deprecated("This tag most likely doesn't support text content or requires unsafe content (try unsafe {}") override operator fun String.unaryPlus() : Unit { @Suppress("DEPRECATION") text(this) } @Deprecated("This tag most likely doesn't support text content or requires unsafe content (try unsafe {}") override fun text(s : String) : Unit { super<HTMLTag>.text(s) } @Deprecated("This tag most likely doesn't support text content or requires unsafe content (try unsafe {}") override fun text(n : Number) : Unit { super<HTMLTag>.text(n) } @Deprecated("This tag most likely doesn't support text content or requires unsafe content (try unsafe {}") override fun entity(e : Entities) : Unit { super<HTMLTag>.entity(e) } } val STYLE.asFlowContent : FlowContent get() = this val STYLE.asMetaDataContent : MetaDataContent get() = this @Suppress("unused") open class SUB(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("sub", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag { } val SUB.asFlowContent : FlowContent get() = this val SUB.asPhrasingContent : PhrasingContent get() = this @Suppress("unused") open class SUMMARY(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("summary", consumer, initialAttributes, null, true, false), CommonAttributeGroupFacadeFlowHeadingPhrasingContent { } @Suppress("unused") open class SUP(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("sup", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag { } val SUP.asFlowContent : FlowContent get() = this val SUP.asPhrasingContent : PhrasingContent get() = this @Suppress("unused") open class SVG(initialAttributes : Map<String, String>, override val consumer : TagConsumer<*>) : HTMLTag("svg", consumer, initialAttributes, "http://www.w3.org/2000/svg", false, false), HtmlBlockInlineTag { } val SVG.asFlowContent : FlowContent get() = this val SVG.asPhrasingContent : PhrasingContent get() = this
{ "pile_set_name": "Github" }
{ "type": "Program", "body": [ { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "Identifier", "name": "foo", "range": [ 0, 3 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 3 } } }, "arguments": [ { "type": "ArrowFunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "x", "range": [ 5, 6 ], "loc": { "start": { "line": 1, "column": 5 }, "end": { "line": 1, "column": 6 } } }, { "type": "Identifier", "name": "y", "range": [ 8, 9 ], "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 9 } } } ], "body": { "type": "BlockStatement", "body": [], "range": [ 14, 16 ], "loc": { "start": { "line": 1, "column": 14 }, "end": { "line": 1, "column": 16 } } }, "generator": false, "expression": false, "async": false, "range": [ 4, 16 ], "loc": { "start": { "line": 1, "column": 4 }, "end": { "line": 1, "column": 16 } } } ], "range": [ 0, 17 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 17 } } }, "range": [ 0, 17 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 17 } } } ], "sourceType": "script", "tokens": [ { "type": "Identifier", "value": "foo", "range": [ 0, 3 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 3 } } }, { "type": "Punctuator", "value": "(", "range": [ 3, 4 ], "loc": { "start": { "line": 1, "column": 3 }, "end": { "line": 1, "column": 4 } } }, { "type": "Punctuator", "value": "(", "range": [ 4, 5 ], "loc": { "start": { "line": 1, "column": 4 }, "end": { "line": 1, "column": 5 } } }, { "type": "Identifier", "value": "x", "range": [ 5, 6 ], "loc": { "start": { "line": 1, "column": 5 }, "end": { "line": 1, "column": 6 } } }, { "type": "Punctuator", "value": ",", "range": [ 6, 7 ], "loc": { "start": { "line": 1, "column": 6 }, "end": { "line": 1, "column": 7 } } }, { "type": "Identifier", "value": "y", "range": [ 8, 9 ], "loc": { "start": { "line": 1, "column": 8 }, "end": { "line": 1, "column": 9 } } }, { "type": "Punctuator", "value": ")", "range": [ 9, 10 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 10 } } }, { "type": "Punctuator", "value": "=>", "range": [ 11, 13 ], "loc": { "start": { "line": 1, "column": 11 }, "end": { "line": 1, "column": 13 } } }, { "type": "Punctuator", "value": "{", "range": [ 14, 15 ], "loc": { "start": { "line": 1, "column": 14 }, "end": { "line": 1, "column": 15 } } }, { "type": "Punctuator", "value": "}", "range": [ 15, 16 ], "loc": { "start": { "line": 1, "column": 15 }, "end": { "line": 1, "column": 16 } } }, { "type": "Punctuator", "value": ")", "range": [ 16, 17 ], "loc": { "start": { "line": 1, "column": 16 }, "end": { "line": 1, "column": 17 } } } ], "range": [ 0, 17 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 17 } } }
{ "pile_set_name": "Github" }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. 'use strict'; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; Object.defineProperty(exports, "__esModule", { value: true }); const inversify_1 = require("inversify"); const types_1 = require("../../common/types"); const types_2 = require("../../ioc/types"); let ArgumentsHelper = class ArgumentsHelper { constructor(serviceContainer) { this.logger = serviceContainer.get(types_1.ILogger); } getOptionValues(args, option) { const values = []; let returnNextValue = false; for (const arg of args) { if (returnNextValue) { values.push(arg); returnNextValue = false; continue; } if (arg.startsWith(`${option}=`)) { values.push(arg.substring(`${option}=`.length)); continue; } if (arg === option) { returnNextValue = true; } } switch (values.length) { case 0: { return; } case 1: { return values[0]; } default: { return values; } } } getPositionalArguments(args, optionsWithArguments = [], optionsWithoutArguments = []) { let lastIndexOfOption = -1; args.forEach((arg, index) => { if (optionsWithoutArguments.indexOf(arg) !== -1) { lastIndexOfOption = index; return; } else if (optionsWithArguments.indexOf(arg) !== -1) { // Cuz the next item is the value. lastIndexOfOption = index + 1; } else if (optionsWithArguments.findIndex(item => arg.startsWith(`${item}=`)) !== -1) { lastIndexOfOption = index; return; } else if (arg.startsWith('-')) { // Ok this is an unknown option, lets treat this as one without values. this.logger.logWarning(`Unknown command line option passed into args parser for tests '${arg}'. Please report on https://github.com/Microsoft/vscode-python/issues/new`); lastIndexOfOption = index; return; } else if (args.indexOf('=') > 0) { // Ok this is an unknown option with a value this.logger.logWarning(`Unknown command line option passed into args parser for tests '${arg}'. Please report on https://github.com/Microsoft/vscode-python/issues/new`); lastIndexOfOption = index; } }); return args.slice(lastIndexOfOption + 1); } filterArguments(args, optionsWithArguments = [], optionsWithoutArguments = []) { let ignoreIndex = -1; return args.filter((arg, index) => { if (ignoreIndex === index) { return false; } // Options can use willd cards (with trailing '*') if (optionsWithoutArguments.indexOf(arg) >= 0 || optionsWithoutArguments.filter(option => option.endsWith('*') && arg.startsWith(option.slice(0, -1))).length > 0) { return false; } // Ignore args that match exactly. if (optionsWithArguments.indexOf(arg) >= 0) { ignoreIndex = index + 1; return false; } // Ignore args that match exactly with wild cards & do not have inline values. if (optionsWithArguments.filter(option => arg.startsWith(`${option}=`)).length > 0) { return false; } // Ignore args that match a wild card (ending with *) and no ineline values. // Eg. arg='--log-cli-level' and optionsArguments=['--log-*'] if (arg.indexOf('=') === -1 && optionsWithoutArguments.filter(option => option.endsWith('*') && arg.startsWith(option.slice(0, -1))).length > 0) { ignoreIndex = index + 1; return false; } // Ignore args that match a wild card (ending with *) and have ineline values. // Eg. arg='--log-cli-level=XYZ' and optionsArguments=['--log-*'] if (arg.indexOf('=') >= 0 && optionsWithoutArguments.filter(option => option.endsWith('*') && arg.startsWith(option.slice(0, -1))).length > 0) { return false; } return true; }); } }; ArgumentsHelper = __decorate([ inversify_1.injectable(), __param(0, inversify_1.inject(types_2.IServiceContainer)) ], ArgumentsHelper); exports.ArgumentsHelper = ArgumentsHelper; //# sourceMappingURL=argumentsHelper.js.map
{ "pile_set_name": "Github" }
<?php /* Copyright (c) 2018, G Burton All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder 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 HOLDER 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. */ define('MODULE_CONTENT_NAVBAR_TITLE', 'Navigation Bar'); define('MODULE_CONTENT_NAVBAR_DESCRIPTION', 'Show the Navigation Bar on your site. <div class="alert alert-warning">This module has a number of Sub Modules which must also be installed.<br><br>Admin > Modules > Navbar Modules</div>');
{ "pile_set_name": "Github" }
// MIT License // // Copyright (c) 2009-2017 Luca Piccioni // // 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. // // This file is automatically generated // Disable "'token' is obsolete" warnings #pragma warning disable 618 using System; using Khronos; namespace OpenWF { /// <summary> /// Strongly typed enumeration WFDCommitType. /// </summary> public enum WFDCommitType { /// <summary> /// Strongly typed for value COMMIT_ENTIRE_DEVICE. /// </summary> CommitEntireDevice = Wfd.COMMIT_ENTIRE_DEVICE, /// <summary> /// Strongly typed for value COMMIT_ENTIRE_PORT. /// </summary> CommitEntirePort = Wfd.COMMIT_ENTIRE_PORT, /// <summary> /// Strongly typed for value COMMIT_PIPELINE. /// </summary> CommitPipeline = Wfd.COMMIT_PIPELINE, /// <summary> /// Strongly typed for value COMMIT_FORCE_32BIT. /// </summary> CommitForce32bit = Wfd.COMMIT_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDDeviceAttrib. /// </summary> public enum WFDDeviceAttrib { /// <summary> /// Strongly typed for value DEVICE_ID. /// </summary> DeviceId = Wfd.DEVICE_ID, /// <summary> /// Strongly typed for value DEVICE_ATTRIB_FORCE_32BIT. /// </summary> DeviceAttribForce32bit = Wfd.DEVICE_ATTRIB_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDDeviceFilter. /// </summary> public enum WFDDeviceFilter { /// <summary> /// Strongly typed for value DEVICE_FILTER_PORT_ID. /// </summary> DeviceFilterPortId = Wfd.DEVICE_FILTER_PORT_ID, /// <summary> /// Strongly typed for value DEVICE_FILTER_FORCE_32BIT. /// </summary> DeviceFilterForce32bit = Wfd.DEVICE_FILTER_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDDisplayDataFormat. /// </summary> public enum WFDDisplayDataFormat { /// <summary> /// Strongly typed for value DISPLAY_DATA_FORMAT_NONE. /// </summary> DisplayDataFormatNone = Wfd.DISPLAY_DATA_FORMAT_NONE, /// <summary> /// Strongly typed for value DISPLAY_DATA_FORMAT_EDID_V1. /// </summary> DisplayDataFormatEdidV1 = Wfd.DISPLAY_DATA_FORMAT_EDID_V1, /// <summary> /// Strongly typed for value DISPLAY_DATA_FORMAT_EDID_V2. /// </summary> DisplayDataFormatEdidV2 = Wfd.DISPLAY_DATA_FORMAT_EDID_V2, /// <summary> /// Strongly typed for value DISPLAY_DATA_FORMAT_DISPLAYID. /// </summary> DisplayDataFormatDisplayid = Wfd.DISPLAY_DATA_FORMAT_DISPLAYID, /// <summary> /// Strongly typed for value DISPLAY_DATA_FORMAT_FORCE_32BIT. /// </summary> DisplayDataFormatForce32bit = Wfd.DISPLAY_DATA_FORMAT_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDErrorCode. /// </summary> public enum WFDErrorCode { /// <summary> /// Strongly typed for value ERROR_NONE. /// </summary> ErrorNone = Wfd.ERROR_NONE, /// <summary> /// Strongly typed for value ERROR_OUT_OF_MEMORY. /// </summary> ErrorOutOfMemory = Wfd.ERROR_OUT_OF_MEMORY, /// <summary> /// Strongly typed for value ERROR_ILLEGAL_ARGUMENT. /// </summary> ErrorIllegalArgument = Wfd.ERROR_ILLEGAL_ARGUMENT, /// <summary> /// Strongly typed for value ERROR_NOT_SUPPORTED. /// </summary> ErrorNotSupported = Wfd.ERROR_NOT_SUPPORTED, /// <summary> /// Strongly typed for value ERROR_BAD_ATTRIBUTE. /// </summary> ErrorBadAttribute = Wfd.ERROR_BAD_ATTRIBUTE, /// <summary> /// Strongly typed for value ERROR_IN_USE. /// </summary> ErrorInUse = Wfd.ERROR_IN_USE, /// <summary> /// Strongly typed for value ERROR_BUSY. /// </summary> ErrorBusy = Wfd.ERROR_BUSY, /// <summary> /// Strongly typed for value ERROR_BAD_DEVICE. /// </summary> ErrorBadDevice = Wfd.ERROR_BAD_DEVICE, /// <summary> /// Strongly typed for value ERROR_BAD_HANDLE. /// </summary> ErrorBadHandle = Wfd.ERROR_BAD_HANDLE, /// <summary> /// Strongly typed for value ERROR_INCONSISTENCY. /// </summary> ErrorInconsistency = Wfd.ERROR_INCONSISTENCY, /// <summary> /// Strongly typed for value ERROR_FORCE_32BIT. /// </summary> ErrorForce32bit = Wfd.ERROR_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDEventAttrib. /// </summary> public enum WFDEventAttrib { /// <summary> /// Strongly typed for value EVENT_PIPELINE_BIND_QUEUE_SIZE. /// </summary> EventPipelineBindQueueSize = Wfd.EVENT_PIPELINE_BIND_QUEUE_SIZE, /// <summary> /// Strongly typed for value EVENT_TYPE. /// </summary> EventType = Wfd.EVENT_TYPE, /// <summary> /// Strongly typed for value EVENT_PORT_ATTACH_PORT_ID. /// </summary> EventPortAttachPortId = Wfd.EVENT_PORT_ATTACH_PORT_ID, /// <summary> /// Strongly typed for value EVENT_PORT_ATTACH_STATE. /// </summary> EventPortAttachState = Wfd.EVENT_PORT_ATTACH_STATE, /// <summary> /// Strongly typed for value EVENT_PORT_PROTECTION_PORT_ID. /// </summary> EventPortProtectionPortId = Wfd.EVENT_PORT_PROTECTION_PORT_ID, /// <summary> /// Strongly typed for value EVENT_PIPELINE_BIND_PIPELINE_ID. /// </summary> EventPipelineBindPipelineId = Wfd.EVENT_PIPELINE_BIND_PIPELINE_ID, /// <summary> /// Strongly typed for value EVENT_PIPELINE_BIND_SOURCE. /// </summary> EventPipelineBindSource = Wfd.EVENT_PIPELINE_BIND_SOURCE, /// <summary> /// Strongly typed for value EVENT_PIPELINE_BIND_MASK. /// </summary> EventPipelineBindMask = Wfd.EVENT_PIPELINE_BIND_MASK, /// <summary> /// Strongly typed for value EVENT_PIPELINE_BIND_QUEUE_OVERFLOW. /// </summary> EventPipelineBindQueueOverflow = Wfd.EVENT_PIPELINE_BIND_QUEUE_OVERFLOW, /// <summary> /// Strongly typed for value EVENT_ATTRIB_FORCE_32BIT. /// </summary> EventAttribForce32bit = Wfd.EVENT_ATTRIB_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDEventType. /// </summary> public enum WFDEventType { /// <summary> /// Strongly typed for value EVENT_INVALID. /// </summary> EventInvalid = Wfd.EVENT_INVALID, /// <summary> /// Strongly typed for value EVENT_NONE. /// </summary> EventNone = Wfd.EVENT_NONE, /// <summary> /// Strongly typed for value EVENT_DESTROYED. /// </summary> EventDestroyed = Wfd.EVENT_DESTROYED, /// <summary> /// Strongly typed for value EVENT_PORT_ATTACH_DETACH. /// </summary> EventPortAttachDetach = Wfd.EVENT_PORT_ATTACH_DETACH, /// <summary> /// Strongly typed for value EVENT_PORT_PROTECTION_FAILURE. /// </summary> EventPortProtectionFailure = Wfd.EVENT_PORT_PROTECTION_FAILURE, /// <summary> /// Strongly typed for value EVENT_PIPELINE_BIND_SOURCE_COMPLETE. /// </summary> EventPipelineBindSourceComplete = Wfd.EVENT_PIPELINE_BIND_SOURCE_COMPLETE, /// <summary> /// Strongly typed for value EVENT_PIPELINE_BIND_MASK_COMPLETE. /// </summary> EventPipelineBindMaskComplete = Wfd.EVENT_PIPELINE_BIND_MASK_COMPLETE, /// <summary> /// Strongly typed for value EVENT_FORCE_32BIT. /// </summary> EventForce32bit = Wfd.EVENT_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDPartialRefresh. /// </summary> public enum WFDPartialRefresh { /// <summary> /// Strongly typed for value PARTIAL_REFRESH_NONE. /// </summary> PartialRefreshNone = Wfd.PARTIAL_REFRESH_NONE, /// <summary> /// Strongly typed for value PARTIAL_REFRESH_VERTICAL. /// </summary> PartialRefreshVertical = Wfd.PARTIAL_REFRESH_VERTICAL, /// <summary> /// Strongly typed for value PARTIAL_REFRESH_HORIZONTAL. /// </summary> PartialRefreshHorizontal = Wfd.PARTIAL_REFRESH_HORIZONTAL, /// <summary> /// Strongly typed for value PARTIAL_REFRESH_BOTH. /// </summary> PartialRefreshBoth = Wfd.PARTIAL_REFRESH_BOTH, /// <summary> /// Strongly typed for value PARTIAL_REFRESH_FORCE_32BIT. /// </summary> PartialRefreshForce32bit = Wfd.PARTIAL_REFRESH_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDPipelineConfigAttrib. /// </summary> public enum WFDPipelineConfigAttrib { /// <summary> /// Strongly typed for value PIPELINE_ID. /// </summary> PipelineId = Wfd.PIPELINE_ID, /// <summary> /// Strongly typed for value PIPELINE_PORTID. /// </summary> PipelinePortid = Wfd.PIPELINE_PORTID, /// <summary> /// Strongly typed for value PIPELINE_LAYER. /// </summary> PipelineLayer = Wfd.PIPELINE_LAYER, /// <summary> /// Strongly typed for value PIPELINE_SHAREABLE. /// </summary> PipelineShareable = Wfd.PIPELINE_SHAREABLE, /// <summary> /// Strongly typed for value PIPELINE_DIRECT_REFRESH. /// </summary> PipelineDirectRefresh = Wfd.PIPELINE_DIRECT_REFRESH, /// <summary> /// Strongly typed for value PIPELINE_MAX_SOURCE_SIZE. /// </summary> PipelineMaxSourceSize = Wfd.PIPELINE_MAX_SOURCE_SIZE, /// <summary> /// Strongly typed for value PIPELINE_SOURCE_RECTANGLE. /// </summary> PipelineSourceRectangle = Wfd.PIPELINE_SOURCE_RECTANGLE, /// <summary> /// Strongly typed for value PIPELINE_FLIP. /// </summary> PipelineFlip = Wfd.PIPELINE_FLIP, /// <summary> /// Strongly typed for value PIPELINE_MIRROR. /// </summary> PipelineMirror = Wfd.PIPELINE_MIRROR, /// <summary> /// Strongly typed for value PIPELINE_ROTATION_SUPPORT. /// </summary> PipelineRotationSupport = Wfd.PIPELINE_ROTATION_SUPPORT, /// <summary> /// Strongly typed for value PIPELINE_ROTATION. /// </summary> PipelineRotation = Wfd.PIPELINE_ROTATION, /// <summary> /// Strongly typed for value PIPELINE_SCALE_RANGE. /// </summary> PipelineScaleRange = Wfd.PIPELINE_SCALE_RANGE, /// <summary> /// Strongly typed for value PIPELINE_SCALE_FILTER. /// </summary> PipelineScaleFilter = Wfd.PIPELINE_SCALE_FILTER, /// <summary> /// Strongly typed for value PIPELINE_DESTINATION_RECTANGLE. /// </summary> PipelineDestinationRectangle = Wfd.PIPELINE_DESTINATION_RECTANGLE, /// <summary> /// Strongly typed for value PIPELINE_TRANSPARENCY_ENABLE. /// </summary> PipelineTransparencyEnable = Wfd.PIPELINE_TRANSPARENCY_ENABLE, /// <summary> /// Strongly typed for value PIPELINE_GLOBAL_ALPHA. /// </summary> PipelineGlobalAlpha = Wfd.PIPELINE_GLOBAL_ALPHA, /// <summary> /// Strongly typed for value PIPELINE_ATTRIB_FORCE_32BIT. /// </summary> PipelineAttribForce32bit = Wfd.PIPELINE_ATTRIB_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDPortConfigAttrib. /// </summary> public enum WFDPortConfigAttrib { /// <summary> /// Strongly typed for value PORT_ID. /// </summary> PortId = Wfd.PORT_ID, /// <summary> /// Strongly typed for value PORT_TYPE. /// </summary> PortType = Wfd.PORT_TYPE, /// <summary> /// Strongly typed for value PORT_DETACHABLE. /// </summary> PortDetachable = Wfd.PORT_DETACHABLE, /// <summary> /// Strongly typed for value PORT_ATTACHED. /// </summary> PortAttached = Wfd.PORT_ATTACHED, /// <summary> /// Strongly typed for value PORT_NATIVE_RESOLUTION. /// </summary> PortNativeResolution = Wfd.PORT_NATIVE_RESOLUTION, /// <summary> /// Strongly typed for value PORT_PHYSICAL_SIZE. /// </summary> PortPhysicalSize = Wfd.PORT_PHYSICAL_SIZE, /// <summary> /// Strongly typed for value PORT_FILL_PORT_AREA. /// </summary> PortFillPortArea = Wfd.PORT_FILL_PORT_AREA, /// <summary> /// Strongly typed for value PORT_BACKGROUND_COLOR. /// </summary> PortBackgroundColor = Wfd.PORT_BACKGROUND_COLOR, /// <summary> /// Strongly typed for value PORT_FLIP. /// </summary> PortFlip = Wfd.PORT_FLIP, /// <summary> /// Strongly typed for value PORT_MIRROR. /// </summary> PortMirror = Wfd.PORT_MIRROR, /// <summary> /// Strongly typed for value PORT_ROTATION. /// </summary> PortRotation = Wfd.PORT_ROTATION, /// <summary> /// Strongly typed for value PORT_POWER_MODE. /// </summary> PortPowerMode = Wfd.PORT_POWER_MODE, /// <summary> /// Strongly typed for value PORT_GAMMA_RANGE. /// </summary> PortGammaRange = Wfd.PORT_GAMMA_RANGE, /// <summary> /// Strongly typed for value PORT_GAMMA. /// </summary> PortGamma = Wfd.PORT_GAMMA, /// <summary> /// Strongly typed for value PORT_PARTIAL_REFRESH_SUPPORT. /// </summary> PortPartialRefreshSupport = Wfd.PORT_PARTIAL_REFRESH_SUPPORT, /// <summary> /// Strongly typed for value PORT_PARTIAL_REFRESH_MAXIMUM. /// </summary> PortPartialRefreshMaximum = Wfd.PORT_PARTIAL_REFRESH_MAXIMUM, /// <summary> /// Strongly typed for value PORT_PARTIAL_REFRESH_ENABLE. /// </summary> PortPartialRefreshEnable = Wfd.PORT_PARTIAL_REFRESH_ENABLE, /// <summary> /// Strongly typed for value PORT_PARTIAL_REFRESH_RECTANGLE. /// </summary> PortPartialRefreshRectangle = Wfd.PORT_PARTIAL_REFRESH_RECTANGLE, /// <summary> /// Strongly typed for value PORT_PIPELINE_ID_COUNT. /// </summary> PortPipelineIdCount = Wfd.PORT_PIPELINE_ID_COUNT, /// <summary> /// Strongly typed for value PORT_BINDABLE_PIPELINE_IDS. /// </summary> PortBindablePipelineIds = Wfd.PORT_BINDABLE_PIPELINE_IDS, /// <summary> /// Strongly typed for value PORT_PROTECTION_ENABLE. /// </summary> PortProtectionEnable = Wfd.PORT_PROTECTION_ENABLE, /// <summary> /// Strongly typed for value PORT_ATTRIB_FORCE_32BIT. /// </summary> PortAttribForce32bit = Wfd.PORT_ATTRIB_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDPortModeAttrib. /// </summary> public enum WFDPortModeAttrib { /// <summary> /// Strongly typed for value PORT_MODE_WIDTH. /// </summary> PortModeWidth = Wfd.PORT_MODE_WIDTH, /// <summary> /// Strongly typed for value PORT_MODE_HEIGHT. /// </summary> PortModeHeight = Wfd.PORT_MODE_HEIGHT, /// <summary> /// Strongly typed for value PORT_MODE_REFRESH_RATE. /// </summary> PortModeRefreshRate = Wfd.PORT_MODE_REFRESH_RATE, /// <summary> /// Strongly typed for value PORT_MODE_FLIP_MIRROR_SUPPORT. /// </summary> PortModeFlipMirrorSupport = Wfd.PORT_MODE_FLIP_MIRROR_SUPPORT, /// <summary> /// Strongly typed for value PORT_MODE_ROTATION_SUPPORT. /// </summary> PortModeRotationSupport = Wfd.PORT_MODE_ROTATION_SUPPORT, /// <summary> /// Strongly typed for value PORT_MODE_INTERLACED. /// </summary> PortModeInterlaced = Wfd.PORT_MODE_INTERLACED, /// <summary> /// Strongly typed for value PORT_MODE_ATTRIB_FORCE_32BIT. /// </summary> PortModeAttribForce32bit = Wfd.PORT_MODE_ATTRIB_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDPortType. /// </summary> public enum WFDPortType { /// <summary> /// Strongly typed for value PORT_TYPE_INTERNAL. /// </summary> PortTypeInternal = Wfd.PORT_TYPE_INTERNAL, /// <summary> /// Strongly typed for value PORT_TYPE_COMPOSITE. /// </summary> PortTypeComposite = Wfd.PORT_TYPE_COMPOSITE, /// <summary> /// Strongly typed for value PORT_TYPE_SVIDEO. /// </summary> PortTypeSvideo = Wfd.PORT_TYPE_SVIDEO, /// <summary> /// Strongly typed for value PORT_TYPE_COMPONENT_YPbPr. /// </summary> PortTypeComponentYpbpr = Wfd.PORT_TYPE_COMPONENT_YPbPr, /// <summary> /// Strongly typed for value PORT_TYPE_COMPONENT_RGB. /// </summary> PortTypeComponentRgb = Wfd.PORT_TYPE_COMPONENT_RGB, /// <summary> /// Strongly typed for value PORT_TYPE_COMPONENT_RGBHV. /// </summary> PortTypeComponentRgbhv = Wfd.PORT_TYPE_COMPONENT_RGBHV, /// <summary> /// Strongly typed for value PORT_TYPE_DVI. /// </summary> PortTypeDvi = Wfd.PORT_TYPE_DVI, /// <summary> /// Strongly typed for value PORT_TYPE_HDMI. /// </summary> PortTypeHdmi = Wfd.PORT_TYPE_HDMI, /// <summary> /// Strongly typed for value PORT_TYPE_DISPLAYPORT. /// </summary> PortTypeDisplayport = Wfd.PORT_TYPE_DISPLAYPORT, /// <summary> /// Strongly typed for value PORT_TYPE_OTHER. /// </summary> PortTypeOther = Wfd.PORT_TYPE_OTHER, /// <summary> /// Strongly typed for value PORT_TYPE_FORCE_32BIT. /// </summary> PortTypeForce32bit = Wfd.PORT_TYPE_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDPowerMode. /// </summary> public enum WFDPowerMode { /// <summary> /// Strongly typed for value POWER_MODE_OFF. /// </summary> PowerModeOff = Wfd.POWER_MODE_OFF, /// <summary> /// Strongly typed for value POWER_MODE_SUSPEND. /// </summary> PowerModeSuspend = Wfd.POWER_MODE_SUSPEND, /// <summary> /// Strongly typed for value POWER_MODE_LIMITED_USE. /// </summary> PowerModeLimitedUse = Wfd.POWER_MODE_LIMITED_USE, /// <summary> /// Strongly typed for value POWER_MODE_ON. /// </summary> PowerModeOn = Wfd.POWER_MODE_ON, /// <summary> /// Strongly typed for value POWER_MODE_FORCE_32BIT. /// </summary> PowerModeForce32bit = Wfd.POWER_MODE_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDRotationSupport. /// </summary> public enum WFDRotationSupport { /// <summary> /// Strongly typed for value ROTATION_SUPPORT_NONE. /// </summary> RotationSupportNone = Wfd.ROTATION_SUPPORT_NONE, /// <summary> /// Strongly typed for value ROTATION_SUPPORT_LIMITED. /// </summary> RotationSupportLimited = Wfd.ROTATION_SUPPORT_LIMITED, /// <summary> /// Strongly typed for value ROTATION_SUPPORT_FORMAT_FORCE_32BIT. /// </summary> RotationSupportFormatForce32bit = Wfd.ROTATION_SUPPORT_FORMAT_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDScaleFilter. /// </summary> public enum WFDScaleFilter { /// <summary> /// Strongly typed for value SCALE_FILTER_NONE. /// </summary> ScaleFilterNone = Wfd.SCALE_FILTER_NONE, /// <summary> /// Strongly typed for value SCALE_FILTER_FASTER. /// </summary> ScaleFilterFaster = Wfd.SCALE_FILTER_FASTER, /// <summary> /// Strongly typed for value SCALE_FILTER_BETTER. /// </summary> ScaleFilterBetter = Wfd.SCALE_FILTER_BETTER, /// <summary> /// Strongly typed for value SCALE_FILTER_FORCE_32BIT. /// </summary> ScaleFilterForce32bit = Wfd.SCALE_FILTER_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDStringID. /// </summary> public enum WFDStringID { /// <summary> /// Strongly typed for value VENDOR. /// </summary> Vendor = Wfd.VENDOR, /// <summary> /// Strongly typed for value RENDERER. /// </summary> Renderer = Wfd.RENDERER, /// <summary> /// Strongly typed for value VERSION. /// </summary> Version = Wfd.VERSION, /// <summary> /// Strongly typed for value EXTENSIONS. /// </summary> Extensions = Wfd.EXTENSIONS, /// <summary> /// Strongly typed for value STRING_ID_FORCE_32BIT. /// </summary> StringIdForce32bit = Wfd.STRING_ID_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDTransition. /// </summary> public enum WFDTransition { /// <summary> /// Strongly typed for value TRANSITION_INVALID. /// </summary> TransitionInvalid = Wfd.TRANSITION_INVALID, /// <summary> /// Strongly typed for value TRANSITION_IMMEDIATE. /// </summary> TransitionImmediate = Wfd.TRANSITION_IMMEDIATE, /// <summary> /// Strongly typed for value TRANSITION_AT_VSYNC. /// </summary> TransitionAtVsync = Wfd.TRANSITION_AT_VSYNC, /// <summary> /// Strongly typed for value TRANSITION_FORCE_32BIT. /// </summary> TransitionForce32bit = Wfd.TRANSITION_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDTransparency. /// </summary> public enum WFDTransparency { /// <summary> /// Strongly typed for value TRANSPARENCY_NONE. /// </summary> TransparencyNone = Wfd.TRANSPARENCY_NONE, /// <summary> /// Strongly typed for value TRANSPARENCY_SOURCE_COLOR. /// </summary> TransparencySourceColor = Wfd.TRANSPARENCY_SOURCE_COLOR, /// <summary> /// Strongly typed for value TRANSPARENCY_GLOBAL_ALPHA. /// </summary> TransparencyGlobalAlpha = Wfd.TRANSPARENCY_GLOBAL_ALPHA, /// <summary> /// Strongly typed for value TRANSPARENCY_SOURCE_ALPHA. /// </summary> TransparencySourceAlpha = Wfd.TRANSPARENCY_SOURCE_ALPHA, /// <summary> /// Strongly typed for value TRANSPARENCY_MASK. /// </summary> TransparencyMask = Wfd.TRANSPARENCY_MASK, /// <summary> /// Strongly typed for value TRANSPARENCY_FORCE_32BIT. /// </summary> TransparencyForce32bit = Wfd.TRANSPARENCY_FORCE_32BIT, } /// <summary> /// Strongly typed enumeration WFDTSColorFormat. /// </summary> public enum WFDTSColorFormat { /// <summary> /// Strongly typed for value TSC_FORMAT_UINT8_RGB_8_8_8_LINEAR. /// </summary> TscFormatUint8Rgb888Linear = Wfd.TSC_FORMAT_UINT8_RGB_8_8_8_LINEAR, /// <summary> /// Strongly typed for value TSC_FORMAT_UINT8_RGB_5_6_5_LINEAR. /// </summary> TscFormatUint8Rgb565Linear = Wfd.TSC_FORMAT_UINT8_RGB_5_6_5_LINEAR, /// <summary> /// Strongly typed for value TSC_FORMAT_FORCE_32BIT. /// </summary> TscFormatForce32bit = Wfd.TSC_FORMAT_FORCE_32BIT, } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2018 Arm Limited. * * SPDX-License-Identifier: MIT * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "arm_compute/graph/backends/BackendRegistry.h" using namespace arm_compute::graph::backends; namespace arm_compute { namespace graph { namespace backends { BackendRegistry::BackendRegistry() : _registered_backends() { } BackendRegistry &BackendRegistry::get() { static BackendRegistry instance; return instance; } IDeviceBackend *BackendRegistry::find_backend(Target target) { ARM_COMPUTE_ERROR_ON(!contains(target)); return _registered_backends[target].get(); } IDeviceBackend &BackendRegistry::get_backend(Target target) { IDeviceBackend *backend = find_backend(target); ARM_COMPUTE_ERROR_ON_MSG(!backend, "Requested backend doesn't exist!"); ARM_COMPUTE_ERROR_ON_MSG(!backend->is_backend_supported(), "Requested backend isn't supported"); return *backend; } bool BackendRegistry::contains(Target target) const { auto it = _registered_backends.find(target); return (it != _registered_backends.end()); } const std::map<Target, std::unique_ptr<IDeviceBackend>> &BackendRegistry::backends() const { return _registered_backends; } } // namespace backends } // namespace graph } // namespace arm_compute
{ "pile_set_name": "Github" }
apiVersion: v1 kind: Secret metadata: name: kamus-example-secret type: Opaque data: config.json: ewogICAgImtleSI6ICJ0ZXN0Igp9
{ "pile_set_name": "Github" }
# E6.1-3.rb def talk(a) puts "This is talk version 1." end def talk(a,b=1) puts "This is talk version 2." end talk(2) talk(2,7)
{ "pile_set_name": "Github" }
# frozen_string_literal: true module WPScan module Finders module MainTheme # URLs In 404 Page Finder class UrlsIn404Page < UrlsInHomepage # @return [ Typhoeus::Response ] def page_res @page_res ||= target.error_404_res end end end end end
{ "pile_set_name": "Github" }
:103E000001C0B7C0112484B790E89093610010926C :103E10006100882361F0982F9A70923041F081FF01 :103E200002C097EF94BF282E80E0C6D0E9C085E09D :103E30008093810082E08093C80088E18093C9006C :103E400083E08093CC0086E08093CA008EE0B4D0FB :103E5000279A84E020E93FEF91E03093850020939A :103E6000840096BBB09BFECF1F9AA8954091C800D6 :103E700047FD02C0815089F793D0813479F490D006 :103E8000182FA0D0123811F480E004C088E0113857 :103E900009F083E07ED080E17CD0EECF823419F44B :103EA00084E198D0F8CF853411F485E0FACF8535D8 :103EB00041F476D0C82F74D0D82FCC0FDD1F82D01C :103EC000EACF863519F484E085D0DECF843691F5CB :103ED00067D066D0F82E64D0D82E00E011E05801EB :103EE0008FEFA81AB80A5CD0F80180838501FA1018 :103EF000F6CF68D0F5E4DF1201C0FFCF50E040E01C :103F000063E0CE0136D08E01E0E0F1E06F0182E0A7 :103F1000C80ED11C4081518161E0C8012AD00E5FDA :103F20001F4FF601FC10F2CF50E040E065E0CE01FB :103F300020D0B1CF843771F433D032D0F82E30D0C6 :103F400041D08E01F80185918F0123D0FA94F110B0 :103F5000F9CFA1CF853739F435D08EE11AD084E975 :103F600018D08AE097CF813509F0A9CF88E024D016 :103F7000A6CFFC010A0167BFE895112407B600FC33 :103F8000FDCF667029F0452B19F481E187BFE895D4 :103F900008959091C80095FFFCCF8093CE000895BE :103FA0008091C80087FFFCCF8091C80084FD01C0CC :103FB000A8958091CE000895E0E6F0E098E1908326 :103FC00080830895EDDF803219F088E0F5DFFFCFC0 :103FD00084E1DFCFCF93C82FE3DFC150E9F7CF9162 :023FE000F1CF1F :023FFE000008B9 :0400000300003E00BB :00000001FF
{ "pile_set_name": "Github" }
/* * Copyright 2016 Code Above Lab 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.codeabovelab.dm.cluman.job; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonStreamContext; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.type.TypeFactory; import java.io.IOException; /** */ class JobParametersDeserializer extends JsonDeserializer { private static JobsManager jobsManager; static void setJobsManager(JobsManager jobsManager) { // the ugly hack, because we need access to jobs types in runtime JobParametersDeserializer.jobsManager = jobsManager; } @Override public Object deserialize(JsonParser p, DeserializationContext ctx) throws IOException { if(jobsManager == null) { throw new IllegalStateException("This deserializer need a jobsManager instance, see 'JobParametersDeserializer.setJobsManager'"); } final JsonStreamContext jsc = p.getParsingContext(); String paramName = null; JsonStreamContext parent = jsc; while(parent != null) { paramName = parent.getCurrentName(); if(paramName != null) { break; } parent = parent.getParent(); } if(parent == null) { throw new NullPointerException("Something wrong: we can not find our parent object, " + "may be you use this deserializer on custom object?"); } JobParameters.Builder r = (JobParameters.Builder) parent.getParent().getCurrentValue(); String jobType = r.getType(); JobDescription desc = jobsManager.getDescription(jobType); JobParameterDescription param = desc.getParameters().get(paramName); TypeFactory typeFactory = ctx.getTypeFactory(); JavaType type; if(param == null) { type = typeFactory.constructType(Object.class); } else { type = typeFactory.constructType(param.getType()); } JsonDeserializer<Object> deser = ctx.findNonContextualValueDeserializer(type); try { return deser.deserialize(p, ctx); } catch (Exception e) { throw new RuntimeException("Can not deserialize '" + jobType + "." + paramName + "' job parameter ", e ); } } }
{ "pile_set_name": "Github" }
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Theme\Test\Unit\Block\Html; use Magento\Framework\App\Config; use Magento\Framework\Data\Collection; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Framework\UrlInterface; use Magento\Framework\View\Element\Template\Context; use Magento\Theme\Block\Html\Pager; use PHPUnit\Framework\TestCase; /** * Test For Page class */ class PagerTest extends TestCase { /** * @var Pager $pager */ private $pager; /** * @var Context $context */ private $context; /** * @var Config $scopeConfig */ private $scopeConfig; /** * @var UrlInterface $urlBuilderMock */ private $urlBuilderMock; /** * @inheritdoc */ protected function setUp(): void { $this->context = $this->createMock(Context::class); $this->urlBuilderMock = $this->getMockForAbstractClass(UrlInterface::class); $this->context->expects($this->any()) ->method('getUrlBuilder') ->willReturn($this->urlBuilderMock); $this->scopeConfig = $this->createMock(Config::class); $this->pager = (new ObjectManager($this))->getObject( Pager::class, ['context' => $this->context] ); } /** * Verify current page Url * * @return void */ public function testGetPageUrl(): void { $expectedPageUrl = 'page-url'; $this->urlBuilderMock->expects($this->once()) ->method('getUrl') ->willReturn($expectedPageUrl); $this->assertEquals($expectedPageUrl, $this->pager->getPageUrl(0)); } /** * Verify get pages method. * * @return void */ public function testGetPages(): void { $expectedPages = range(1, 5); $collectionMock = $this->createMock(Collection::class); $collectionMock->expects($this->exactly(2)) ->method('getCurPage') ->willReturn(2); $collectionMock->expects($this->any()) ->method('getLastPageNumber') ->willReturn(10); $this->setCollectionProperty($collectionMock); $this->assertEquals($expectedPages, $this->pager->getPages()); } /** * Test get limit url. * * @dataProvider limitUrlDataProvider * * @param int $page * @param int $size * @param int $limit * @param array $expectedParams * @return void */ public function testGetLimitUrl(int $page, int $size, int $limit, array $expectedParams): void { $expectedArray = [ '_current' => true, '_escape' => true, '_use_rewrite' => true, '_fragment' => null, '_query' => $expectedParams, ]; $collectionMock = $this->createMock(Collection::class); $collectionMock->expects($this->once()) ->method('getCurPage') ->willReturn($page); $collectionMock->expects($this->once()) ->method('getSize') ->willReturn($size); $this->setCollectionProperty($collectionMock); $this->urlBuilderMock->expects($this->once()) ->method('getUrl') ->with('*/*/*', $expectedArray); $this->pager->getLimitUrl($limit); } /** * DataProvider for testGetLimitUrl * * @return array */ public function limitUrlDataProvider(): array { return [ [2, 21, 10, ['limit' => 10]], [3, 21, 10, ['limit' => 10]], [2, 21, 20, ['limit' => 20]], [3, 21, 50, ['limit' => 50, 'p' => null]], [2, 11, 20, ['limit' => 20, 'p' => null]], [4, 40, 20, ['limit' => 20, 'p' => 2]], ]; } /** * Set Collection * * @return void */ private function setCollectionProperty($collection): void { $reflection = new \ReflectionClass($this->pager); $reflection_property = $reflection->getProperty('_collection'); $reflection_property->setAccessible(true); $reflection_property->setValue($this->pager, $collection); } }
{ "pile_set_name": "Github" }
#!/bin/bash # # Analyze a given results directory for rcutorture progress. # # Usage: kvm-recheck-rcu.sh resdir # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, you can access it online at # http://www.gnu.org/licenses/gpl-2.0.html. # # Copyright (C) IBM Corporation, 2014 # # Authors: Paul E. McKenney <[email protected]> i="$1" if test -d $i then : else echo Unreadable results directory: $i exit 1 fi . tools/testing/selftests/rcutorture/bin/functions.sh configfile=`echo $i | sed -e 's/^.*\///'` ngps=`grep ver: $i/console.log 2> /dev/null | tail -1 | sed -e 's/^.* ver: //' -e 's/ .*$//'` if test -z "$ngps" then echo "$configfile -------" else title="$configfile ------- $ngps grace periods" dur=`sed -e 's/^.* rcutorture.shutdown_secs=//' -e 's/ .*$//' < $i/qemu-cmd 2> /dev/null` if test -z "$dur" then : else ngpsps=`awk -v ngps=$ngps -v dur=$dur ' BEGIN { print ngps / dur }' < /dev/null` title="$title ($ngpsps per second)" fi echo $title nclosecalls=`grep --binary-files=text 'torture: Reader Batch' $i/console.log | tail -1 | awk '{for (i=NF-8;i<=NF;i++) sum+=$i; } END {print sum}'` if test -z "$nclosecalls" then exit 0 fi if test "$nclosecalls" -eq 0 then exit 0 fi # Compute number of close calls per tenth of an hour nclosecalls10=`awk -v nclosecalls=$nclosecalls -v dur=$dur 'BEGIN { print int(nclosecalls * 36000 / dur) }' < /dev/null` if test $nclosecalls10 -gt 5 -a $nclosecalls -gt 1 then print_bug $nclosecalls "Reader Batch close calls in" $(($dur/60)) minute run: $i else print_warning $nclosecalls "Reader Batch close calls in" $(($dur/60)) minute run: $i fi fi
{ "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 darwin dragonfly freebsd linux netbsd openbsd solaris package unix var Itoa = itoa
{ "pile_set_name": "Github" }
<?php return [ 'color' => 'Färg som RGB eller Hex (frivilligt)', 'color_ph' => 'Färg, t ex. #ffffff eller rgb(255, 255, 255)', 'create_new_item' => 'Skapa Nytt Menyobjekt', 'delete_item_confirm' => 'Ja, Radera Detta Menyobjekt', 'delete_item_question' => 'Är du säker att du vill radera detta menyobjekt?', 'drag_drop_info' => 'Dra och släpp menyobjekten nedan för att sortera dem.', 'dynamic_route' => 'Dynamisk Rutt', 'edit_item' => 'Redigera Menyobjekt', 'icon_class' => 'Typsnittsikon-klass för menyobjektet (Use a', 'icon_class2' => 'Voyager Typsnittsikon-klass</a>)', 'icon_class_ph' => 'Ikonklass (frivilligt)', 'item_route' => 'Rutt för menyobjektet', 'item_title' => 'Titel för menyobjektet', 'link_type' => 'Länktyp', 'new_menu_item' => 'Nytt menyobjekt', 'open_in' => 'Öppna I', 'open_new' => 'Ny Flik/Fönster', 'open_same' => 'Samma Flik/Fönster', 'route_parameter' => 'Rutt parametrar (om några)', 'static_url' => 'Statisk URL', 'successfully_created' => 'Ny menyobjekt skapat.', 'successfully_deleted' => 'Menyojektet är raderat.', 'successfully_updated' => 'Menyobjekt uppdaterat.', 'updated_order' => 'Ordningen för menyobjekt uppdaterat.', 'url' => 'URL för menyobjektet', 'usage_hint' => 'Du kan visa en meny var som helst på din sajt genom att anropa|Du kan visa denna meny var som helst på din sajt genom att anropa', ];
{ "pile_set_name": "Github" }
/*********************************************************** * @Description : 二分图检测的非递归DFS实现 * @author : 梁山广(Laing Shan Guang) * @date : 2019-08-09 08:21 * @email : [email protected] ***********************************************************/ package Chapter06GraphModellingAndFloodfill.Section1LeetCodeBiPartite; import java.util.ArrayDeque; import java.util.Arrays; /** * LeetCode 785 is-graph-bipartite https://leetcode-cn.com/problems/is-graph-bipartite/ 判断二分图, * 参考 Chapter04DFSInAction.Section10BiPartitionDetect.GraphDFSBiPartitionDetect */ public class SolutionDFS非递归实现 { /** * 使用邻接表形式表达的矩阵。第一个维度的下标就代表图的顶点(顶点用0~n的标号表示) */ private int[][] graph; /** * 顶点是否被访问了 */ private boolean[] visited; /** * 顶点的染色 */ private int[] colors; /** * 当前图是否是二分图,默认是二分图即true */ private boolean isBi = true; public boolean isBipartite(int[][] graph) { this.graph = graph; // 初始化visited数组长度为graph的第一维度长度 this.visited = new boolean[graph.length]; this.colors = new int[graph.length]; // 初始化为false,表示未被访问 Arrays.fill(visited, false); // 颜色必须显式初始化 Arrays.fill(colors, -1); for (int v = 0; v < graph.length; v++) { // 一定注意v顶没被访问才进行新一轮的dfs,因为只要联通分量的一个元素被遍历了,那么这个联通分量内的一定都被遍历了 if (!visited[v]) { if (!dfs(v)) { isBi = false; break; } } } return isBi; } /** * 深度优先遍历,判断是否是二分图 * * @param source 深度优先遍历的起点 * @return 是否是二分图 */ private boolean dfs(int source) { // ArrayDeque使用 https://gitee.com/lsgwr/algorithms/tree/master/Part2Basic/src/main/java/Chapter03StackAndQueues/JavaBuiltIn ArrayDeque<Integer> stack = new ArrayDeque<>(); // 起点染色为1 colors[source] = 1; stack.push(source); // 加入到栈就认为被访问过了 visited[source] = true; // 栈不为空就可以一直往下dfs while (!stack.isEmpty()) { // 获取栈顶元素v int v = stack.pop(); // 遍历v的邻接点 for (int w : graph[v]) { // 如果w还没被访问,就把元素加入到栈里 if (!visited[w]) { stack.push(w); visited[w] = true; // 颜色必须和父节点颜色相反 colors[w] = 1 - colors[v]; } else { // 如果v的一个邻接点w之前已经被访问了,那么看下是不是和v的颜色相同,如果相同,说明有环 if (colors[w] == colors[v]) { // 不是二分图 return false; } } } } return true; } public static void main(String[] args) { int[][] graph = {{1, 3}, {0, 2}, {1, 3}, {0, 2}}; SolutionDFS非递归实现 dfs = new SolutionDFS非递归实现(); System.out.println(dfs.isBipartite(graph)); } }
{ "pile_set_name": "Github" }
<html><head> <link rel="stylesheet" href="../api_static/tomorrow-night.css"> <link rel="stylesheet" href="../api_static/style.css" type="text/css"> <script src="../api_static//highlight.pack.js"></script> <script src="../api_static//script.js"></script> <script>hljs.initHighlightingOnLoad();</script> <meta charset="utf8"> <title> Belt.Map </title></head> <body> <code class="code">(<span class="keyword">module</span>&nbsp;<span class="constructor">Belt_Map</span>)</code></body></html>
{ "pile_set_name": "Github" }
// Copyright 2011 the V8 project authors. 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 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. // Test the case when finally clause throws another exception (stack overflow) // which goes through some try/catch block---we need to clear v8::TryCatch // catcher as it doesn't catch original exception any more. o = {}; o.__defineGetter__('foo', function() { throw 42; }); function f() { try { // throw below sets up Top::thread_local_.catcher_... throw 42; } finally { // ...JS accessor traverses v8 runtime/JS boundary and // when coming back from JS to v8 runtime, retraverses // stack with catcher set while processing exception // which is not caught by external try catch. try { o.foo; } catch(e) { }; return; } }; f();
{ "pile_set_name": "Github" }
/// Copyright (c) 2012 Ecma International. All rights reserved. /** * @path ch15/15.2/15.2.3/15.2.3.12/15.2.3.12-3-28.js * @description Object.isFrozen returns true when all own properties of 'O' are not writable and not configurable, and 'O' is not extensible */ function testcase() { var obj = {}; Object.defineProperty(obj, "foo1", { value: 20, writable: false, enumerable: false, configurable: false }); function get_func() { return 10; } function set_func() { } Object.defineProperty(obj, "foo2", { get: get_func, set: set_func, configurable: false }); Object.preventExtensions(obj); return Object.isFrozen(obj); } runTestCase(testcase);
{ "pile_set_name": "Github" }
Ok, here are my comments and suggestions about the LLVM instruction set. We should discuss some now, but can discuss many of them later, when we revisit synchronization, type inference, and other issues. (We have discussed some of the comments already.) o We should consider eliminating the type annotation in cases where it is essentially obvious from the instruction type, e.g., in br, it is obvious that the first arg. should be a bool and the other args should be labels: br bool <cond>, label <iftrue>, label <iffalse> I think your point was that making all types explicit improves clarity and readability. I agree to some extent, but it also comes at the cost of verbosity. And when the types are obvious from people's experience (e.g., in the br instruction), it doesn't seem to help as much. o On reflection, I really like your idea of having the two different switch types (even though they encode implementation techniques rather than semantics). It should simplify building the CFG and my guess is it could enable some significant optimizations, though we should think about which. o In the lookup-indirect form of the switch, is there a reason not to make the val-type uint? Most HLL switch statements (including Java and C++) require that anyway. And it would also make the val-type uniform in the two forms of the switch. I did see the switch-on-bool examples and, while cute, we can just use the branch instructions in that particular case. o I agree with your comment that we don't need 'neg'. o There's a trade-off with the cast instruction: + it avoids having to define all the upcasts and downcasts that are valid for the operands of each instruction (you probably have thought of other benefits also) - it could make the bytecode significantly larger because there could be a lot of cast operations o Making the second arg. to 'shl' a ubyte seems good enough to me. 255 positions seems adequate for several generations of machines and is more compact than uint. o I still have some major concerns about including malloc and free in the language (either as builtin functions or instructions). LLVM must be able to represent code from many different languages. Languages such as C, C++ Java and Fortran 90 would not be able to use our malloc anyway because each of them will want to provide a library implementation of it. This gets even worse when code from different languages is linked into a single executable (which is fairly common in large apps). Having a single malloc would just not suffice, and instead would simply complicate the picture further because it adds an extra variant in addition to the one each language provides. Instead, providing a default library version of malloc and free (and perhaps a malloc_gc with garbage collection instead of free) would make a good implementation available to anyone who wants it. I don't recall all your arguments in favor so let's discuss this again, and soon. o 'alloca' on the other hand sounds like a good idea, and the implementation seems fairly language-independent so it doesn't have the problems with malloc listed above. o About indirect call: Your option #2 sounded good to me. I'm not sure I understand your concern about an explicit 'icall' instruction? o A pair of important synchronization instr'ns to think about: load-linked store-conditional o Other classes of instructions that are valuable for pipeline performance: conditional-move predicated instructions o I believe tail calls are relatively easy to identify; do you know why .NET has a tailcall instruction? o I agree that we need a static data space. Otherwise, emulating global data gets unnecessarily complex. o About explicit parallelism: We once talked about adding a symbolic thread-id field to each instruction. (It could be optional so single-threaded codes are not penalized.) This could map well to multi-threaded architectures while providing easy ILP for single-threaded onces. But it is probably too radical an idea to include in a base version of LLVM. Instead, it could a great topic for a separate study. What is the semantics of the IA64 stop bit? o And finally, another thought about the syntax for arrays :-) Although this syntax: array <dimension-list> of <type> is verbose, it will be used only in the human-readable assembly code so size should not matter. I think we should consider it because I find it to be the clearest syntax. It could even make arrays of function pointers somewhat readable.
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <background android:drawable="@drawable/ic_launcher_background" /> <foreground android:drawable="@drawable/ic_launcher_foreground" /> </adaptive-icon>
{ "pile_set_name": "Github" }
// Licensed under the MIT License. // Copyright (c) Microsoft Corporation. All rights reserved. using System.Collections.Generic; using System.Runtime.CompilerServices; using AdaptiveExpressions; using Microsoft.Bot.Builder.Dialogs.Adaptive.Conditions; using Newtonsoft.Json; namespace Microsoft.Bot.Builder.Dialogs.Adaptive.Teams { /// <summary> /// Actions triggered when a Teams InvokeActivity is received with activity.name == 'composeExtension/queryLink'. /// </summary> public class OnTeamsAppBasedLinkQuery : OnInvokeActivity { [JsonProperty("$kind")] public new const string Kind = "Teams.OnAppBasedLinkQuery"; [JsonConstructor] public OnTeamsAppBasedLinkQuery(List<Dialog> actions = null, string condition = null, [CallerFilePath] string callerPath = "", [CallerLineNumber] int callerLine = 0) : base(actions: actions, condition: condition, callerPath: callerPath, callerLine: callerLine) { } public override Expression GetExpression() { // if name is 'composeExtension/queryLink' return Expression.AndExpression(Expression.Parse($"{TurnPath.Activity}.name == 'composeExtension/queryLink'"), base.GetExpression()); } } }
{ "pile_set_name": "Github" }
import * as AT from './actionTypes' import { BeneficiariesType, WalletFiatType } from 'core/types' import { CustodialActionTypes } from './types' export const fetchCustodialBeneficiaries = (currency?: WalletFiatType) => ({ type: AT.FETCH_CUSTODIAL_BENEFICIARIES, currency }) export const fetchCustodialBeneficiariesFailure = ( error: string ): CustodialActionTypes => ({ type: AT.FETCH_CUSTODIAL_BENEFICIARIES_FAILURE, payload: { error } }) export const fetchCustodialBeneficiariesLoading = (): CustodialActionTypes => ({ type: AT.FETCH_CUSTODIAL_BENEFICIARIES_LOADING }) export const fetchCustodialBeneficiariesSuccess = ( beneficiaries: BeneficiariesType ): CustodialActionTypes => ({ type: AT.FETCH_CUSTODIAL_BENEFICIARIES_SUCCESS, payload: { beneficiaries } })
{ "pile_set_name": "Github" }
# SPDX-License-Identifier: GPL-2.0-only # # Makefile for the aQuantia device drivers. # obj-$(CONFIG_AQTION) += atlantic/
{ "pile_set_name": "Github" }
inlining checkForCompleteness: stmtLists in: aCodeGen "Set the complete flag if none of the given statement list nodes contains further candidates for inlining." complete := true. stmtLists do: [ :stmtList | stmtList statements do: [ :node | (self inlineableSend: node in: aCodeGen) ifTrue: [ complete := false. "more inlining to do" ^self ]. ]. ]. parseTree nodesDo: [ :n | (self inlineableFunctionCall: n in: aCodeGen) ifTrue: [ complete := false. "more inlining to do" ^self ]. ].
{ "pile_set_name": "Github" }
/*! * negotiator * Copyright(c) 2012 Federico Romero * Copyright(c) 2012-2014 Isaac Z. Schlueter * Copyright(c) 2015 Douglas Christopher Wilson * MIT Licensed */ 'use strict'; /** * Cached loaded submodules. * @private */ var modules = Object.create(null); /** * Module exports. * @public */ module.exports = Negotiator; module.exports.Negotiator = Negotiator; /** * Create a Negotiator instance from a request. * @param {object} request * @public */ function Negotiator(request) { if (!(this instanceof Negotiator)) { return new Negotiator(request); } this.request = request; } Negotiator.prototype.charset = function charset(available) { var set = this.charsets(available); return set && set[0]; }; Negotiator.prototype.charsets = function charsets(available) { var preferredCharsets = loadModule('charset').preferredCharsets; return preferredCharsets(this.request.headers['accept-charset'], available); }; Negotiator.prototype.encoding = function encoding(available) { var set = this.encodings(available); return set && set[0]; }; Negotiator.prototype.encodings = function encodings(available) { var preferredEncodings = loadModule('encoding').preferredEncodings; return preferredEncodings(this.request.headers['accept-encoding'], available); }; Negotiator.prototype.language = function language(available) { var set = this.languages(available); return set && set[0]; }; Negotiator.prototype.languages = function languages(available) { var preferredLanguages = loadModule('language').preferredLanguages; return preferredLanguages(this.request.headers['accept-language'], available); }; Negotiator.prototype.mediaType = function mediaType(available) { var set = this.mediaTypes(available); return set && set[0]; }; Negotiator.prototype.mediaTypes = function mediaTypes(available) { var preferredMediaTypes = loadModule('mediaType').preferredMediaTypes; return preferredMediaTypes(this.request.headers.accept, available); }; // Backwards compatibility Negotiator.prototype.preferredCharset = Negotiator.prototype.charset; Negotiator.prototype.preferredCharsets = Negotiator.prototype.charsets; Negotiator.prototype.preferredEncoding = Negotiator.prototype.encoding; Negotiator.prototype.preferredEncodings = Negotiator.prototype.encodings; Negotiator.prototype.preferredLanguage = Negotiator.prototype.language; Negotiator.prototype.preferredLanguages = Negotiator.prototype.languages; Negotiator.prototype.preferredMediaType = Negotiator.prototype.mediaType; Negotiator.prototype.preferredMediaTypes = Negotiator.prototype.mediaTypes; /** * Load the given module. * @private */ function loadModule(moduleName) { var module = modules[moduleName]; if (module !== undefined) { return module; } // This uses a switch for static require analysis switch (moduleName) { case 'charset': module = require('./lib/charset'); break; case 'encoding': module = require('./lib/encoding'); break; case 'language': module = require('./lib/language'); break; case 'mediaType': module = require('./lib/mediaType'); break; default: throw new Error('Cannot find module \'' + moduleName + '\''); } // Store to prevent invoking require() modules[moduleName] = module; return module; }
{ "pile_set_name": "Github" }
// A mixin which takes a content block that should only // be applied when the current (real or emulated) operating // system is windows // // This helper mixin is useful in so far that it allows us // to keep platform specific styles next to cross-platform // styles instead of splitting them out and possibly forgetting // about them. @mixin win32 { body.platform-win32 & { @content; } } // An exact copy of the win32 mixin except that it allows for // writing base-level rules @mixin win32-context { body.platform-win32 { @content; } } // A mixin which takes a content block that should only // be applied when the current (real or emulated) operating // system is macOS. // // This helper mixin is useful in so far that it allows us // to keep platform specific styles next to cross-platform // styles instead of splitting them out and possibly forgetting // about them. @mixin darwin { body.platform-darwin & { @content; } } // An exact copy of the darwin mixin except that it allows for // writing base-level rules @mixin darwin-context { body.platform-darwin { @content; } }
{ "pile_set_name": "Github" }
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module RailsOmniauth class Application < Rails::Application config.generators do |g| g.test_framework :rspec, fixtures: true, view_specs: false, helper_specs: false, routing_specs: false, controller_specs: false, request_specs: false g.fixture_replacement :factory_girl, dir: "spec/factories" end # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. end end
{ "pile_set_name": "Github" }
#!/usr/bin/env python # import sys sys.stderr.write( 'This tool is no longer necessary as of Kegbot v1.3. ' 'See https://kegbot.org/docs/upgrading for more information.\n' ) sys.exit(1)
{ "pile_set_name": "Github" }
#pragma warning disable 108 // new keyword hiding #pragma warning disable 114 // new keyword hiding namespace Windows.UI.WebUI { #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented] #endif public partial class WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs : global::Windows.ApplicationModel.Activation.IAppointmentsProviderShowTimeFrameActivatedEventArgs,global::Windows.ApplicationModel.Activation.IAppointmentsProviderActivatedEventArgs,global::Windows.ApplicationModel.Activation.IActivatedEventArgs,global::Windows.UI.WebUI.IActivatedEventArgsDeferral,global::Windows.ApplicationModel.Activation.IActivatedEventArgsWithUser { #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::Windows.ApplicationModel.Activation.ActivationKind Kind { get { throw new global::System.NotImplementedException("The member ActivationKind WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.Kind is not implemented in Uno."); } } #endif #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::Windows.ApplicationModel.Activation.ApplicationExecutionState PreviousExecutionState { get { throw new global::System.NotImplementedException("The member ApplicationExecutionState WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.PreviousExecutionState is not implemented in Uno."); } } #endif #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::Windows.ApplicationModel.Activation.SplashScreen SplashScreen { get { throw new global::System.NotImplementedException("The member SplashScreen WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.SplashScreen is not implemented in Uno."); } } #endif #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::Windows.System.User User { get { throw new global::System.NotImplementedException("The member User WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.User is not implemented in Uno."); } } #endif #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public string Verb { get { throw new global::System.NotImplementedException("The member string WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.Verb is not implemented in Uno."); } } #endif #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::System.TimeSpan Duration { get { throw new global::System.NotImplementedException("The member TimeSpan WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.Duration is not implemented in Uno."); } } #endif #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::System.DateTimeOffset TimeToShow { get { throw new global::System.NotImplementedException("The member DateTimeOffset WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.TimeToShow is not implemented in Uno."); } } #endif #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::Windows.UI.WebUI.ActivatedOperation ActivatedOperation { get { throw new global::System.NotImplementedException("The member ActivatedOperation WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.ActivatedOperation is not implemented in Uno."); } } #endif // Forced skipping of method Windows.UI.WebUI.WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.TimeToShow.get // Forced skipping of method Windows.UI.WebUI.WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.Duration.get // Forced skipping of method Windows.UI.WebUI.WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.Verb.get // Forced skipping of method Windows.UI.WebUI.WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.Kind.get // Forced skipping of method Windows.UI.WebUI.WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.PreviousExecutionState.get // Forced skipping of method Windows.UI.WebUI.WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.SplashScreen.get // Forced skipping of method Windows.UI.WebUI.WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.ActivatedOperation.get // Forced skipping of method Windows.UI.WebUI.WebUIAppointmentsProviderShowTimeFrameActivatedEventArgs.User.get // Processing: Windows.ApplicationModel.Activation.IAppointmentsProviderShowTimeFrameActivatedEventArgs // Processing: Windows.ApplicationModel.Activation.IAppointmentsProviderActivatedEventArgs // Processing: Windows.ApplicationModel.Activation.IActivatedEventArgs // Processing: Windows.UI.WebUI.IActivatedEventArgsDeferral // Processing: Windows.ApplicationModel.Activation.IActivatedEventArgsWithUser } }
{ "pile_set_name": "Github" }