text
stringlengths
2
99.9k
meta
dict
#!/usr/bin/env perl if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } # DESCRIPTION: Verilator: Verilog Test driver/expect definition # # Copyright 2011 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); compile( v_flags2 => ["t/t_dpi_qw_c.cpp"], verilator_flags2 => ["-Wall -Wno-DECLFILENAME -no-l2name"], ); execute( check_finished => 1, ); ok(1); 1;
{ "pile_set_name": "Github" }
unit wmSOAPRESTU; interface uses System.SysUtils, System.Classes, Web.HTTPApp, Soap.InvokeRegistry, Soap.WSDLIntf, System.TypInfo, Soap.WebServExp, Soap.WSDLBind, Xml.XMLSchema, Soap.WSDLPub, Soap.SOAPPasInv, Soap.SOAPHTTPPasInv, Soap.SOAPHTTPDisp, Soap.WebBrokerSOAP, MVCFramework, MVCFramework.Commons; type TwmSOAPREST = class(TWebModule) HTTPSoapDispatcher: THTTPSoapDispatcher; HTTPSoapPascalInvoker: THTTPSoapPascalInvoker; WSDLHTMLPublish: TWSDLHTMLPublish; procedure WebModuleCreate(Sender: TObject); procedure WebModuleDestroy(Sender: TObject); procedure wmSOAPRESTSoapActionAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); private FMVCEngine: TMVCEngine; public { Public declarations } end; var WebModuleClass: TComponentClass = TwmSOAPREST; implementation { %CLASSGROUP 'Vcl.Controls.TControl' } {$R *.dfm} uses MVCFramework.Middleware.StaticFiles, RESTControllerCustomerU; procedure TwmSOAPREST.WebModuleCreate(Sender: TObject); begin FMVCEngine := TMVCEngine.Create(self, procedure(Config: TMVCConfig) begin Config[TMVCConfigKey.AllowUnhandledAction] := 'true'; end); FMVCEngine.AddController(TControllerCustomer); FMVCEngine.AddMiddleware(TMVCStaticFilesMiddleware.Create( '/', { StaticFilesPath } 'www', { DocumentRoot } 'index.html' { IndexDocument - Before it was named fallbackresource }, False )); end; procedure TwmSOAPREST.WebModuleDestroy(Sender: TObject); begin if Assigned(FMVCEngine) then FreeAndNil(FMVCEngine); end; procedure TwmSOAPREST.wmSOAPRESTSoapActionAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); begin WSDLHTMLPublish.ServiceInfo(Sender, Request, Response, Handled); end; end.
{ "pile_set_name": "Github" }
namespace Catel.Tests.Data { using System.Collections.ObjectModel; using Catel.Data; /// <summary> /// ObjectWithDefaultValues Data object class which fully supports serialization, property changed notifications, /// backwards compatibility and error checking. /// </summary> public class ObjectWithDefaultValues : ModelBase { #region Fields #endregion #region Constructors #endregion #region Properties /// <summary> /// ValueType_NoDefaultValue. /// </summary> public int ValueType_NoDefaultValue { get { return GetValue<int>(ValueType_NoDefaultValueProperty); } set { SetValue(ValueType_NoDefaultValueProperty, value); } } /// <summary> /// Register the ValueType_NoDefaultValue property so it is known in the class. /// </summary> public static readonly IPropertyData ValueType_NoDefaultValueProperty = RegisterProperty<int>("ValueType_NoDefaultValue"); /// <summary> /// ValueType_DefaultValueViaValue. /// </summary> public int ValueType_DefaultValueViaValue { get { return GetValue<int>(ValueType_DefaultValueViaValueProperty); } set { SetValue(ValueType_DefaultValueViaValueProperty, value); } } /// <summary> /// Register the ValueType_DefaultValueViaValue property so it is known in the class. /// </summary> public static readonly IPropertyData ValueType_DefaultValueViaValueProperty = RegisterProperty<int>("ValueType_DefaultValueViaValue", 5); /// <summary> /// ValueType_DefaultValueViaCallback. /// </summary> public int ValueType_DefaultValueViaCallback { get { return GetValue<int>(ValueType_DefaultValueViaCallbackProperty); } set { SetValue(ValueType_DefaultValueViaCallbackProperty, value); } } /// <summary> /// Register the ValueType_DefaultValueViaCallback property so it is known in the class. /// </summary> public static readonly IPropertyData ValueType_DefaultValueViaCallbackProperty = RegisterProperty<int>("ValueType_DefaultValueViaCallback", () => 10); /// <summary> /// ReferenceType_NoDefaultValue. /// </summary> public Collection<int> ReferenceType_NoDefaultValue { get { return GetValue<Collection<int>>(ReferenceType_NoDefaultValueProperty); } set { SetValue(ReferenceType_NoDefaultValueProperty, value); } } /// <summary> /// Register the ReferenceType_NoDefaultValue property so it is known in the class. /// </summary> public static readonly IPropertyData ReferenceType_NoDefaultValueProperty = RegisterProperty<Collection<int>>("ReferenceType_NoDefaultValue"); /// <summary> /// ReferenceType_DefaultValueViaValue. /// </summary> public Collection<int> ReferenceType_DefaultValueViaValue { get { return GetValue<Collection<int>>(ReferenceType_DefaultValueViaValueProperty); } set { SetValue(ReferenceType_DefaultValueViaValueProperty, value); } } /// <summary> /// Register the ReferenceType_DefaultValueViaValue property so it is known in the class. /// </summary> public static readonly IPropertyData ReferenceType_DefaultValueViaValueProperty = RegisterProperty("ReferenceType_DefaultValueViaValue", typeof(Collection<int>), new Collection<int>()); /// <summary> /// ReferenceType_DefaultValueViaCallback. /// </summary> public Collection<int> ReferenceType_DefaultValueViaCallback { get { return GetValue<Collection<int>>(ReferenceType_DefaultValueViaCallbackProperty); } set { SetValue(ReferenceType_DefaultValueViaCallbackProperty, value); } } /// <summary> /// Register the ReferenceType_DefaultValueViaCallback property so it is known in the class. /// </summary> public static readonly IPropertyData ReferenceType_DefaultValueViaCallbackProperty = RegisterProperty("ReferenceType_DefaultValueViaCallback", typeof(Collection<int>), () => new Collection<int>()); #endregion #region Methods #endregion } }
{ "pile_set_name": "Github" }
// Copyright 2015 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // A very simple image interface that reports image dimensions and allows // for setting and getting individual pixels. Implement the interface by // wrapping the image library of your choice. #ifndef SH_IMAGE_H #define SH_IMAGE_H #include <memory> #include "Eigen/Dense" namespace sh { class Image { public: Image() {} virtual ~Image() {} virtual int width() const = 0; virtual int height() const = 0; virtual Eigen::Array3f GetPixel(int x, int y) const = 0; virtual void SetPixel(int x, int y, const Eigen::Array3f& v) = 0; }; } // namespace sh #endif // IMAGE_H
{ "pile_set_name": "Github" }
Sphinx==1.8.3 \ --hash=sha256:429e3172466df289f0f742471d7e30ba3ee11f3b5aecd9a840480d03f14bcfe5 \ --hash=sha256:c4cb17ba44acffae3d3209646b6baec1e215cad3065e852c68cc569d4df1b9f8 recommonmark==0.5.0 \ --hash=sha256:c85228b9b7aea7157662520e74b4e8791c5eacd375332ec68381b52bf10165be \ --hash=sha256:a520b8d25071a51ae23a27cf6252f2fe387f51bdc913390d83b2b50617f5bb48 snowballstemmer==1.2.1 \ --hash=sha256:9f3bcd3c401c3e862ec0ebe6d2c069ebc012ce142cce209c098ccb5b09136e89 \ --hash=sha256:919f26a68b2c17a7634da993d91339e288964f93c274f1343e3bbbe2096e1128 alabaster==0.7.12 \ --hash=sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359 \ --hash=sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02 MarkupSafe==1.1.0 \ --hash=sha256:efdc45ef1afc238db84cb4963aa689c0408912a0239b0721cb172b4016eb31d6 \ --hash=sha256:52ccb45e77a1085ec5461cde794e1aa037df79f473cbc69b974e73940655c8d7 \ --hash=sha256:525396ee324ee2da82919f2ee9c9e73b012f23e7640131dd1b53a90206a0f09c \ --hash=sha256:5c3fbebd7de20ce93103cb3183b47671f2885307df4a17a0ad56a1dd51273d36 \ --hash=sha256:f82e347a72f955b7017a39708a3667f106e6ad4d10b25f237396a7115d8ed5fd \ --hash=sha256:31cbb1359e8c25f9f48e156e59e2eaad51cd5242c05ed18a8de6dbe85184e4b7 \ --hash=sha256:edce2ea7f3dfc981c4ddc97add8a61381d9642dc3273737e756517cc03e84dd6 \ --hash=sha256:19f637c2ac5ae9da8bfd98cef74d64b7e1bb8a63038a3505cd182c3fac5eb4d9 \ --hash=sha256:98e439297f78fca3a6169fd330fbe88d78b3bb72f967ad9961bcac0d7fdd1550 \ --hash=sha256:fb7c206e01ad85ce57feeaaa0bf784b97fa3cad0d4a5737bc5295785f5c613a1 \ --hash=sha256:1fa6058938190ebe8290e5cae6c351e14e7bb44505c4a7624555ce57fbbeba0d \ --hash=sha256:e982fe07ede9fada6ff6705af70514a52beb1b2c3d25d4e873e82114cf3c5401 \ --hash=sha256:5e5851969aea17660e55f6a3be00037a25b96a9b44d2083651812c99d53b14d1 \ --hash=sha256:f137c02498f8b935892d5c0172560d7ab54bc45039de8805075e19079c639a9c \ --hash=sha256:3e835d8841ae7863f64e40e19477f7eb398674da6a47f09871673742531e6f4b \ --hash=sha256:5edfa27b2d3eefa2210fb2f5d539fbed81722b49f083b2c6566455eb7422fd7e \ --hash=sha256:857eebb2c1dc60e4219ec8e98dfa19553dae33608237e107db9c6078b1167856 \ --hash=sha256:bf54103892a83c64db58125b3f2a43df6d2cb2d28889f14c78519394feb41492 \ --hash=sha256:048ef924c1623740e70204aa7143ec592504045ae4429b59c30054cb31e3c432 \ --hash=sha256:83381342bfc22b3c8c06f2dd93a505413888694302de25add756254beee8449c \ --hash=sha256:130f844e7f5bdd8e9f3f42e7102ef1d49b2e6fdf0d7526df3f87281a532d8c8b \ --hash=sha256:52b07fbc32032c21ad4ab060fec137b76eb804c4b9a1c7c7dc562549306afad2 \ --hash=sha256:1f19ef5d3908110e1e891deefb5586aae1b49a7440db952454b4e281b41620cd \ --hash=sha256:1b8a7a87ad1b92bd887568ce54b23565f3fd7018c4180136e1cf412b405a47af \ --hash=sha256:d9ac82be533394d341b41d78aca7ed0e0f4ba5a2231602e2f05aa87f25c51672 \ --hash=sha256:1c25694ca680b6919de53a4bb3bdd0602beafc63ff001fea2f2fc16ec3a11834 \ --hash=sha256:7d263e5770efddf465a9e31b78362d84d015cc894ca2c131901a4445eaa61ee1 \ --hash=sha256:4e97332c9ce444b0c2c38dd22ddc61c743eb208d916e4265a2a3b575bdccb1d3 Jinja2==2.10.3 \ --hash=sha256:74320bb91f31270f9551d46522e33af46a80c3d619f4a4bf42b3164d30b5911f \ --hash=sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de imagesize==1.1.0 \ --hash=sha256:3f349de3eb99145973fefb7dbe38554414e5c30abd0c8e4b970a7c9d09f3a1d8 \ --hash=sha256:f3832918bc3c66617f92e35f5d70729187676313caa60c187eb0f28b8fe5e3b5 pytz==2018.9 \ --hash=sha256:32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9 \ --hash=sha256:d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c Babel==2.6.0 \ --hash=sha256:6778d85147d5d85345c14a26aada5e478ab04e39b078b0745ee6870c2b5cf669 \ --hash=sha256:8cba50f48c529ca3fa18cf81fa9403be176d374ac4d60738b839122dfaaa3d23 Pygments==2.4.2 \ --hash=sha256:71e430bc85c88a430f000ac1d9b331d2407f681d6f6aec95e8bcfbc3df5b0127 \ --hash=sha256:881c4c157e45f30af185c1ffe8d549d48ac9127433f2c380c24b84572ad66297 six==1.12.0 \ --hash=sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c \ --hash=sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73 pyparsing==2.3.0 \ --hash=sha256:40856e74d4987de5d01761a22d1621ae1c7f8774585acae358aa5c5936c6c90b \ --hash=sha256:f353aab21fd474459d97b709e527b5571314ee5f067441dc9f88e33eecd96592 packaging==18.0 \ --hash=sha256:f95a1e147590f204328170981833854229bb2912ac3d5f89e2a8ccd2834800c9 \ --hash=sha256:0886227f54515e592aaa2e5a553332c73962917f2831f1b0f9b9f4380a4b9807 docutils==0.14 \ --hash=sha256:7a4bd47eaf6596e1295ecb11361139febe29b084a87bf005bf899f9a42edc3c6 \ --hash=sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6 \ --hash=sha256:51e64ef2ebfb29cae1faa133b3710143496eca21c530f3f71424d77687764274 chardet==3.0.4 \ --hash=sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691 \ --hash=sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae idna==2.8 \ --hash=sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c \ --hash=sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407 certifi==2018.11.29 \ --hash=sha256:993f830721089fef441cdfeb4b2c8c9df86f0c63239f06bd025a76a7daddb033 \ --hash=sha256:47f9c83ef4c0c621eaef743f133f09fa8a74a9b75f037e8624f83bd1b6626cb7 urllib3==1.25.6 \ --hash=sha256:3de946ffbed6e6746608990594d08faac602528ac7015ac28d33cee6a45b7398 \ --hash=sha256:9a107b99a5393caf59c7aa3c1249c16e6879447533d0887f4336dde834c7be86 requests==2.22.0 \ --hash=sha256:11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4 \ --hash=sha256:9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9a590f48c010551dc6c4b31 typing==3.6.6 \ --hash=sha256:a4c8473ce11a65999c8f59cb093e70686b6c84c98df58c1dae9b3b196089858a \ --hash=sha256:57dcf675a99b74d64dacf6fba08fb17cf7e3d5fdff53d4a30ea2a5e7e52543d4 \ --hash=sha256:4027c5f6127a6267a435201981ba156de91ad0d1d98e9ddc2aa173453453492d sphinxcontrib-websupport==1.1.0 \ --hash=sha256:68ca7ff70785cbe1e7bccc71a48b5b6d965d79ca50629606c7861a21b206d9dd \ --hash=sha256:9de47f375baf1ea07cdb3436ff39d7a9c76042c10a769c52353ec46e4e8fc3b9 future==0.17.1 \ --hash=sha256:67045236dcfd6816dc439556d009594abf643e5eb48992e36beac09c2ca659b8 CommonMark==0.8.1 \ --hash=sha256:9f6dda7876b2bb88dd784440166f4bc8e56cb2b2551264051123bacb0b6c1d8a \ --hash=sha256:abcbc854e0eae5deaf52ae5e328501b78b4a0758bf98ac8bb792fce993006084 sphinx_rtd_theme==0.4.2 \ --hash=sha256:d0f6bc70f98961145c5b0e26a992829363a197321ba571b31b24ea91879e0c96 \ --hash=sha256:02f02a676d6baabb758a20c7a479d58648e0f64f13e07d1b388e9bb2afe86a09 fluent.pygments==0.1.0 \ --hash=sha256:4fa2e83322b559a2f9f43af8cb383569534d9424c68d4fe7ca75c5bf091572c6 \ --hash=sha256:7a552a056e229203ac8d4321316a0075dec53a70c8afbcf4ea48482e3af05860 fluent.syntax==0.17.0 \ --hash=sha256:ac3db2f77d62b032fdf1f17ef5c390b7801a9e9fb58d41eca3825c0d47b88d79 \ --hash=sha256:e26be470aeebe4badd84f7bb0b648414e0f2ef95d26e5336d634af99e402ea61
{ "pile_set_name": "Github" }
#!SHELLPATH cp /system/kernel/KERNELTOBOOT/kernel.desc DEVICEWORKDIR/kernel rm DEVICEWORKDIR/runscript && rm DEVICEWORKDIR/sysrun && /system/bin/reboot
{ "pile_set_name": "Github" }
// This script provides functions to generate coloured output. const chalk = require('chalk') module.exports = { error: function (message) { console.error(chalk.bold.red(message)) }, warn: function (message) { console.warn(chalk.yellow(message)) }, info: function (message) { console.log(chalk.keyword('cornflowerblue')(message)) }, verbose: function (message) { console.log(chalk.grey(message)) }, success: function (message) { console.log(chalk.bold.green(message)) } }
{ "pile_set_name": "Github" }
# Copyright (c) 2017, Intel Corporation # # 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. set(TMP_SOURCES_ ${CMAKE_CURRENT_LIST_DIR}/vphal_common_specific.c ${CMAKE_CURRENT_LIST_DIR}/vphal_render_common_specific.c ) set(TMP_HEADERS_ "") set(SOURCES_ ${SOURCES_} ${TMP_SOURCES_} ) # no header for now #set(HEADERS_ # ${HEADERS_} # ${TMP_HEADERS_} #) # #media_add_curr_to_include_path()
{ "pile_set_name": "Github" }
/* * Copyright (c) 2007 Mellanox Technologies. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ #include <linux/kernel.h> #include <linux/ethtool.h> #include <linux/netdevice.h> #include <linux/mlx4/driver.h> #include <linux/mlx4/device.h> #include <linux/in.h> #include <net/ip.h> #include "mlx4_en.h" #include "en_port.h" #define EN_ETHTOOL_QP_ATTACH (1ull << 63) #define EN_ETHTOOL_SHORT_MASK cpu_to_be16(0xffff) #define EN_ETHTOOL_WORD_MASK cpu_to_be32(0xffffffff) static int mlx4_en_moderation_update(struct mlx4_en_priv *priv) { int i; int err = 0; for (i = 0; i < priv->tx_ring_num; i++) { priv->tx_cq[i]->moder_cnt = priv->tx_frames; priv->tx_cq[i]->moder_time = priv->tx_usecs; if (priv->port_up) { err = mlx4_en_set_cq_moder(priv, priv->tx_cq[i]); if (err) return err; } } if (priv->adaptive_rx_coal) return 0; for (i = 0; i < priv->rx_ring_num; i++) { priv->rx_cq[i]->moder_cnt = priv->rx_frames; priv->rx_cq[i]->moder_time = priv->rx_usecs; priv->last_moder_time[i] = MLX4_EN_AUTO_CONF; if (priv->port_up) { err = mlx4_en_set_cq_moder(priv, priv->rx_cq[i]); if (err) return err; } } return err; } static void mlx4_en_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); strlcpy(drvinfo->version, DRV_VERSION " (" DRV_RELDATE ")", sizeof(drvinfo->version)); snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d.%d.%d", (u16) (mdev->dev->caps.fw_ver >> 32), (u16) ((mdev->dev->caps.fw_ver >> 16) & 0xffff), (u16) (mdev->dev->caps.fw_ver & 0xffff)); strlcpy(drvinfo->bus_info, pci_name(mdev->dev->persist->pdev), sizeof(drvinfo->bus_info)); drvinfo->n_stats = 0; drvinfo->regdump_len = 0; drvinfo->eedump_len = 0; } static const char mlx4_en_priv_flags[][ETH_GSTRING_LEN] = { "blueflame", }; static const char main_strings[][ETH_GSTRING_LEN] = { "rx_packets", "tx_packets", "rx_bytes", "tx_bytes", "rx_errors", "tx_errors", "rx_dropped", "tx_dropped", "multicast", "collisions", "rx_length_errors", "rx_over_errors", "rx_crc_errors", "rx_frame_errors", "rx_fifo_errors", "rx_missed_errors", "tx_aborted_errors", "tx_carrier_errors", "tx_fifo_errors", "tx_heartbeat_errors", "tx_window_errors", /* port statistics */ "tso_packets", "xmit_more", "queue_stopped", "wake_queue", "tx_timeout", "rx_alloc_failed", "rx_csum_good", "rx_csum_none", "rx_csum_complete", "tx_chksum_offload", /* packet statistics */ "broadcast", "rx_prio_0", "rx_prio_1", "rx_prio_2", "rx_prio_3", "rx_prio_4", "rx_prio_5", "rx_prio_6", "rx_prio_7", "tx_prio_0", "tx_prio_1", "tx_prio_2", "tx_prio_3", "tx_prio_4", "tx_prio_5", "tx_prio_6", "tx_prio_7", }; #define NUM_MAIN_STATS 21 #define NUM_ALL_STATS (NUM_MAIN_STATS + NUM_PORT_STATS + NUM_PKT_STATS + NUM_PERF_STATS) static const char mlx4_en_test_names[][ETH_GSTRING_LEN]= { "Interrupt Test", "Link Test", "Speed Test", "Register Test", "Loopback Test", }; static u32 mlx4_en_get_msglevel(struct net_device *dev) { return ((struct mlx4_en_priv *) netdev_priv(dev))->msg_enable; } static void mlx4_en_set_msglevel(struct net_device *dev, u32 val) { ((struct mlx4_en_priv *) netdev_priv(dev))->msg_enable = val; } static void mlx4_en_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) { struct mlx4_en_priv *priv = netdev_priv(netdev); int err = 0; u64 config = 0; u64 mask; if ((priv->port < 1) || (priv->port > 2)) { en_err(priv, "Failed to get WoL information\n"); return; } mask = (priv->port == 1) ? MLX4_DEV_CAP_FLAG_WOL_PORT1 : MLX4_DEV_CAP_FLAG_WOL_PORT2; if (!(priv->mdev->dev->caps.flags & mask)) { wol->supported = 0; wol->wolopts = 0; return; } err = mlx4_wol_read(priv->mdev->dev, &config, priv->port); if (err) { en_err(priv, "Failed to get WoL information\n"); return; } if (config & MLX4_EN_WOL_MAGIC) wol->supported = WAKE_MAGIC; else wol->supported = 0; if (config & MLX4_EN_WOL_ENABLED) wol->wolopts = WAKE_MAGIC; else wol->wolopts = 0; } static int mlx4_en_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) { struct mlx4_en_priv *priv = netdev_priv(netdev); u64 config = 0; int err = 0; u64 mask; if ((priv->port < 1) || (priv->port > 2)) return -EOPNOTSUPP; mask = (priv->port == 1) ? MLX4_DEV_CAP_FLAG_WOL_PORT1 : MLX4_DEV_CAP_FLAG_WOL_PORT2; if (!(priv->mdev->dev->caps.flags & mask)) return -EOPNOTSUPP; if (wol->supported & ~WAKE_MAGIC) return -EINVAL; err = mlx4_wol_read(priv->mdev->dev, &config, priv->port); if (err) { en_err(priv, "Failed to get WoL info, unable to modify\n"); return err; } if (wol->wolopts & WAKE_MAGIC) { config |= MLX4_EN_WOL_DO_MODIFY | MLX4_EN_WOL_ENABLED | MLX4_EN_WOL_MAGIC; } else { config &= ~(MLX4_EN_WOL_ENABLED | MLX4_EN_WOL_MAGIC); config |= MLX4_EN_WOL_DO_MODIFY; } err = mlx4_wol_write(priv->mdev->dev, config, priv->port); if (err) en_err(priv, "Failed to set WoL information\n"); return err; } static int mlx4_en_get_sset_count(struct net_device *dev, int sset) { struct mlx4_en_priv *priv = netdev_priv(dev); int bit_count = hweight64(priv->stats_bitmap); switch (sset) { case ETH_SS_STATS: return (priv->stats_bitmap ? bit_count : NUM_ALL_STATS) + (priv->tx_ring_num * 2) + #ifdef CONFIG_NET_RX_BUSY_POLL (priv->rx_ring_num * 5); #else (priv->rx_ring_num * 2); #endif case ETH_SS_TEST: return MLX4_EN_NUM_SELF_TEST - !(priv->mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UC_LOOPBACK) * 2; case ETH_SS_PRIV_FLAGS: return ARRAY_SIZE(mlx4_en_priv_flags); default: return -EOPNOTSUPP; } } static void mlx4_en_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, uint64_t *data) { struct mlx4_en_priv *priv = netdev_priv(dev); int index = 0; int i, j = 0; spin_lock_bh(&priv->stats_lock); if (!(priv->stats_bitmap)) { for (i = 0; i < NUM_MAIN_STATS; i++) data[index++] = ((unsigned long *) &priv->stats)[i]; for (i = 0; i < NUM_PORT_STATS; i++) data[index++] = ((unsigned long *) &priv->port_stats)[i]; for (i = 0; i < NUM_PKT_STATS; i++) data[index++] = ((unsigned long *) &priv->pkstats)[i]; } else { for (i = 0; i < NUM_MAIN_STATS; i++) { if ((priv->stats_bitmap >> j) & 1) data[index++] = ((unsigned long *) &priv->stats)[i]; j++; } for (i = 0; i < NUM_PORT_STATS; i++) { if ((priv->stats_bitmap >> j) & 1) data[index++] = ((unsigned long *) &priv->port_stats)[i]; j++; } } for (i = 0; i < priv->tx_ring_num; i++) { data[index++] = priv->tx_ring[i]->packets; data[index++] = priv->tx_ring[i]->bytes; } for (i = 0; i < priv->rx_ring_num; i++) { data[index++] = priv->rx_ring[i]->packets; data[index++] = priv->rx_ring[i]->bytes; #ifdef CONFIG_NET_RX_BUSY_POLL data[index++] = priv->rx_ring[i]->yields; data[index++] = priv->rx_ring[i]->misses; data[index++] = priv->rx_ring[i]->cleaned; #endif } spin_unlock_bh(&priv->stats_lock); } static void mlx4_en_self_test(struct net_device *dev, struct ethtool_test *etest, u64 *buf) { mlx4_en_ex_selftest(dev, &etest->flags, buf); } static void mlx4_en_get_strings(struct net_device *dev, uint32_t stringset, uint8_t *data) { struct mlx4_en_priv *priv = netdev_priv(dev); int index = 0; int i; switch (stringset) { case ETH_SS_TEST: for (i = 0; i < MLX4_EN_NUM_SELF_TEST - 2; i++) strcpy(data + i * ETH_GSTRING_LEN, mlx4_en_test_names[i]); if (priv->mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UC_LOOPBACK) for (; i < MLX4_EN_NUM_SELF_TEST; i++) strcpy(data + i * ETH_GSTRING_LEN, mlx4_en_test_names[i]); break; case ETH_SS_STATS: /* Add main counters */ if (!priv->stats_bitmap) { for (i = 0; i < NUM_MAIN_STATS; i++) strcpy(data + (index++) * ETH_GSTRING_LEN, main_strings[i]); for (i = 0; i < NUM_PORT_STATS; i++) strcpy(data + (index++) * ETH_GSTRING_LEN, main_strings[i + NUM_MAIN_STATS]); for (i = 0; i < NUM_PKT_STATS; i++) strcpy(data + (index++) * ETH_GSTRING_LEN, main_strings[i + NUM_MAIN_STATS + NUM_PORT_STATS]); } else for (i = 0; i < NUM_MAIN_STATS + NUM_PORT_STATS; i++) { if ((priv->stats_bitmap >> i) & 1) { strcpy(data + (index++) * ETH_GSTRING_LEN, main_strings[i]); } if (!(priv->stats_bitmap >> i)) break; } for (i = 0; i < priv->tx_ring_num; i++) { sprintf(data + (index++) * ETH_GSTRING_LEN, "tx%d_packets", i); sprintf(data + (index++) * ETH_GSTRING_LEN, "tx%d_bytes", i); } for (i = 0; i < priv->rx_ring_num; i++) { sprintf(data + (index++) * ETH_GSTRING_LEN, "rx%d_packets", i); sprintf(data + (index++) * ETH_GSTRING_LEN, "rx%d_bytes", i); #ifdef CONFIG_NET_RX_BUSY_POLL sprintf(data + (index++) * ETH_GSTRING_LEN, "rx%d_napi_yield", i); sprintf(data + (index++) * ETH_GSTRING_LEN, "rx%d_misses", i); sprintf(data + (index++) * ETH_GSTRING_LEN, "rx%d_cleaned", i); #endif } break; case ETH_SS_PRIV_FLAGS: for (i = 0; i < ARRAY_SIZE(mlx4_en_priv_flags); i++) strcpy(data + i * ETH_GSTRING_LEN, mlx4_en_priv_flags[i]); break; } } static u32 mlx4_en_autoneg_get(struct net_device *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; u32 autoneg = AUTONEG_DISABLE; if ((mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETH_BACKPL_AN_REP) && (priv->port_state.flags & MLX4_EN_PORT_ANE)) autoneg = AUTONEG_ENABLE; return autoneg; } static u32 ptys_get_supported_port(struct mlx4_ptys_reg *ptys_reg) { u32 eth_proto = be32_to_cpu(ptys_reg->eth_proto_cap); if (eth_proto & (MLX4_PROT_MASK(MLX4_10GBASE_T) | MLX4_PROT_MASK(MLX4_1000BASE_T) | MLX4_PROT_MASK(MLX4_100BASE_TX))) { return SUPPORTED_TP; } if (eth_proto & (MLX4_PROT_MASK(MLX4_10GBASE_CR) | MLX4_PROT_MASK(MLX4_10GBASE_SR) | MLX4_PROT_MASK(MLX4_56GBASE_SR4) | MLX4_PROT_MASK(MLX4_40GBASE_CR4) | MLX4_PROT_MASK(MLX4_40GBASE_SR4) | MLX4_PROT_MASK(MLX4_1000BASE_CX_SGMII))) { return SUPPORTED_FIBRE; } if (eth_proto & (MLX4_PROT_MASK(MLX4_56GBASE_KR4) | MLX4_PROT_MASK(MLX4_40GBASE_KR4) | MLX4_PROT_MASK(MLX4_20GBASE_KR2) | MLX4_PROT_MASK(MLX4_10GBASE_KR) | MLX4_PROT_MASK(MLX4_10GBASE_KX4) | MLX4_PROT_MASK(MLX4_1000BASE_KX))) { return SUPPORTED_Backplane; } return 0; } static u32 ptys_get_active_port(struct mlx4_ptys_reg *ptys_reg) { u32 eth_proto = be32_to_cpu(ptys_reg->eth_proto_oper); if (!eth_proto) /* link down */ eth_proto = be32_to_cpu(ptys_reg->eth_proto_cap); if (eth_proto & (MLX4_PROT_MASK(MLX4_10GBASE_T) | MLX4_PROT_MASK(MLX4_1000BASE_T) | MLX4_PROT_MASK(MLX4_100BASE_TX))) { return PORT_TP; } if (eth_proto & (MLX4_PROT_MASK(MLX4_10GBASE_SR) | MLX4_PROT_MASK(MLX4_56GBASE_SR4) | MLX4_PROT_MASK(MLX4_40GBASE_SR4) | MLX4_PROT_MASK(MLX4_1000BASE_CX_SGMII))) { return PORT_FIBRE; } if (eth_proto & (MLX4_PROT_MASK(MLX4_10GBASE_CR) | MLX4_PROT_MASK(MLX4_56GBASE_CR4) | MLX4_PROT_MASK(MLX4_40GBASE_CR4))) { return PORT_DA; } if (eth_proto & (MLX4_PROT_MASK(MLX4_56GBASE_KR4) | MLX4_PROT_MASK(MLX4_40GBASE_KR4) | MLX4_PROT_MASK(MLX4_20GBASE_KR2) | MLX4_PROT_MASK(MLX4_10GBASE_KR) | MLX4_PROT_MASK(MLX4_10GBASE_KX4) | MLX4_PROT_MASK(MLX4_1000BASE_KX))) { return PORT_NONE; } return PORT_OTHER; } #define MLX4_LINK_MODES_SZ \ (FIELD_SIZEOF(struct mlx4_ptys_reg, eth_proto_cap) * 8) enum ethtool_report { SUPPORTED = 0, ADVERTISED = 1, SPEED = 2 }; /* Translates mlx4 link mode to equivalent ethtool Link modes/speed */ static u32 ptys2ethtool_map[MLX4_LINK_MODES_SZ][3] = { [MLX4_100BASE_TX] = { SUPPORTED_100baseT_Full, ADVERTISED_100baseT_Full, SPEED_100 }, [MLX4_1000BASE_T] = { SUPPORTED_1000baseT_Full, ADVERTISED_1000baseT_Full, SPEED_1000 }, [MLX4_1000BASE_CX_SGMII] = { SUPPORTED_1000baseKX_Full, ADVERTISED_1000baseKX_Full, SPEED_1000 }, [MLX4_1000BASE_KX] = { SUPPORTED_1000baseKX_Full, ADVERTISED_1000baseKX_Full, SPEED_1000 }, [MLX4_10GBASE_T] = { SUPPORTED_10000baseT_Full, ADVERTISED_10000baseT_Full, SPEED_10000 }, [MLX4_10GBASE_CX4] = { SUPPORTED_10000baseKX4_Full, ADVERTISED_10000baseKX4_Full, SPEED_10000 }, [MLX4_10GBASE_KX4] = { SUPPORTED_10000baseKX4_Full, ADVERTISED_10000baseKX4_Full, SPEED_10000 }, [MLX4_10GBASE_KR] = { SUPPORTED_10000baseKR_Full, ADVERTISED_10000baseKR_Full, SPEED_10000 }, [MLX4_10GBASE_CR] = { SUPPORTED_10000baseKR_Full, ADVERTISED_10000baseKR_Full, SPEED_10000 }, [MLX4_10GBASE_SR] = { SUPPORTED_10000baseKR_Full, ADVERTISED_10000baseKR_Full, SPEED_10000 }, [MLX4_20GBASE_KR2] = { SUPPORTED_20000baseMLD2_Full | SUPPORTED_20000baseKR2_Full, ADVERTISED_20000baseMLD2_Full | ADVERTISED_20000baseKR2_Full, SPEED_20000 }, [MLX4_40GBASE_CR4] = { SUPPORTED_40000baseCR4_Full, ADVERTISED_40000baseCR4_Full, SPEED_40000 }, [MLX4_40GBASE_KR4] = { SUPPORTED_40000baseKR4_Full, ADVERTISED_40000baseKR4_Full, SPEED_40000 }, [MLX4_40GBASE_SR4] = { SUPPORTED_40000baseSR4_Full, ADVERTISED_40000baseSR4_Full, SPEED_40000 }, [MLX4_56GBASE_KR4] = { SUPPORTED_56000baseKR4_Full, ADVERTISED_56000baseKR4_Full, SPEED_56000 }, [MLX4_56GBASE_CR4] = { SUPPORTED_56000baseCR4_Full, ADVERTISED_56000baseCR4_Full, SPEED_56000 }, [MLX4_56GBASE_SR4] = { SUPPORTED_56000baseSR4_Full, ADVERTISED_56000baseSR4_Full, SPEED_56000 }, }; static u32 ptys2ethtool_link_modes(u32 eth_proto, enum ethtool_report report) { int i; u32 link_modes = 0; for (i = 0; i < MLX4_LINK_MODES_SZ; i++) { if (eth_proto & MLX4_PROT_MASK(i)) link_modes |= ptys2ethtool_map[i][report]; } return link_modes; } static u32 ethtool2ptys_link_modes(u32 link_modes, enum ethtool_report report) { int i; u32 ptys_modes = 0; for (i = 0; i < MLX4_LINK_MODES_SZ; i++) { if (ptys2ethtool_map[i][report] & link_modes) ptys_modes |= 1 << i; } return ptys_modes; } /* Convert actual speed (SPEED_XXX) to ptys link modes */ static u32 speed2ptys_link_modes(u32 speed) { int i; u32 ptys_modes = 0; for (i = 0; i < MLX4_LINK_MODES_SZ; i++) { if (ptys2ethtool_map[i][SPEED] == speed) ptys_modes |= 1 << i; } return ptys_modes; } static int ethtool_get_ptys_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_ptys_reg ptys_reg; u32 eth_proto; int ret; memset(&ptys_reg, 0, sizeof(ptys_reg)); ptys_reg.local_port = priv->port; ptys_reg.proto_mask = MLX4_PTYS_EN; ret = mlx4_ACCESS_PTYS_REG(priv->mdev->dev, MLX4_ACCESS_REG_QUERY, &ptys_reg); if (ret) { en_warn(priv, "Failed to run mlx4_ACCESS_PTYS_REG status(%x)", ret); return ret; } en_dbg(DRV, priv, "ptys_reg.proto_mask %x\n", ptys_reg.proto_mask); en_dbg(DRV, priv, "ptys_reg.eth_proto_cap %x\n", be32_to_cpu(ptys_reg.eth_proto_cap)); en_dbg(DRV, priv, "ptys_reg.eth_proto_admin %x\n", be32_to_cpu(ptys_reg.eth_proto_admin)); en_dbg(DRV, priv, "ptys_reg.eth_proto_oper %x\n", be32_to_cpu(ptys_reg.eth_proto_oper)); en_dbg(DRV, priv, "ptys_reg.eth_proto_lp_adv %x\n", be32_to_cpu(ptys_reg.eth_proto_lp_adv)); cmd->supported = 0; cmd->advertising = 0; cmd->supported |= ptys_get_supported_port(&ptys_reg); eth_proto = be32_to_cpu(ptys_reg.eth_proto_cap); cmd->supported |= ptys2ethtool_link_modes(eth_proto, SUPPORTED); eth_proto = be32_to_cpu(ptys_reg.eth_proto_admin); cmd->advertising |= ptys2ethtool_link_modes(eth_proto, ADVERTISED); cmd->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause; cmd->advertising |= (priv->prof->tx_pause) ? ADVERTISED_Pause : 0; cmd->advertising |= (priv->prof->tx_pause ^ priv->prof->rx_pause) ? ADVERTISED_Asym_Pause : 0; cmd->port = ptys_get_active_port(&ptys_reg); cmd->transceiver = (SUPPORTED_TP & cmd->supported) ? XCVR_EXTERNAL : XCVR_INTERNAL; if (mlx4_en_autoneg_get(dev)) { cmd->supported |= SUPPORTED_Autoneg; cmd->advertising |= ADVERTISED_Autoneg; } cmd->autoneg = (priv->port_state.flags & MLX4_EN_PORT_ANC) ? AUTONEG_ENABLE : AUTONEG_DISABLE; eth_proto = be32_to_cpu(ptys_reg.eth_proto_lp_adv); cmd->lp_advertising = ptys2ethtool_link_modes(eth_proto, ADVERTISED); cmd->lp_advertising |= (priv->port_state.flags & MLX4_EN_PORT_ANC) ? ADVERTISED_Autoneg : 0; cmd->phy_address = 0; cmd->mdio_support = 0; cmd->maxtxpkt = 0; cmd->maxrxpkt = 0; cmd->eth_tp_mdix = ETH_TP_MDI_INVALID; cmd->eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO; return ret; } static void ethtool_get_default_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct mlx4_en_priv *priv = netdev_priv(dev); int trans_type; cmd->autoneg = AUTONEG_DISABLE; cmd->supported = SUPPORTED_10000baseT_Full; cmd->advertising = ADVERTISED_10000baseT_Full; trans_type = priv->port_state.transceiver; if (trans_type > 0 && trans_type <= 0xC) { cmd->port = PORT_FIBRE; cmd->transceiver = XCVR_EXTERNAL; cmd->supported |= SUPPORTED_FIBRE; cmd->advertising |= ADVERTISED_FIBRE; } else if (trans_type == 0x80 || trans_type == 0) { cmd->port = PORT_TP; cmd->transceiver = XCVR_INTERNAL; cmd->supported |= SUPPORTED_TP; cmd->advertising |= ADVERTISED_TP; } else { cmd->port = -1; cmd->transceiver = -1; } } static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct mlx4_en_priv *priv = netdev_priv(dev); int ret = -EINVAL; if (mlx4_en_QUERY_PORT(priv->mdev, priv->port)) return -ENOMEM; en_dbg(DRV, priv, "query port state.flags ANC(%x) ANE(%x)\n", priv->port_state.flags & MLX4_EN_PORT_ANC, priv->port_state.flags & MLX4_EN_PORT_ANE); if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETH_PROT_CTRL) ret = ethtool_get_ptys_settings(dev, cmd); if (ret) /* ETH PROT CRTL is not supported or PTYS CMD failed */ ethtool_get_default_settings(dev, cmd); if (netif_carrier_ok(dev)) { ethtool_cmd_speed_set(cmd, priv->port_state.link_speed); cmd->duplex = DUPLEX_FULL; } else { ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN); cmd->duplex = DUPLEX_UNKNOWN; } return 0; } /* Calculate PTYS admin according ethtool speed (SPEED_XXX) */ static __be32 speed_set_ptys_admin(struct mlx4_en_priv *priv, u32 speed, __be32 proto_cap) { __be32 proto_admin = 0; if (!speed) { /* Speed = 0 ==> Reset Link modes */ proto_admin = proto_cap; en_info(priv, "Speed was set to 0, Reset advertised Link Modes to default (%x)\n", be32_to_cpu(proto_cap)); } else { u32 ptys_link_modes = speed2ptys_link_modes(speed); proto_admin = cpu_to_be32(ptys_link_modes) & proto_cap; en_info(priv, "Setting Speed to %d\n", speed); } return proto_admin; } static int mlx4_en_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_ptys_reg ptys_reg; __be32 proto_admin; int ret; u32 ptys_adv = ethtool2ptys_link_modes(cmd->advertising, ADVERTISED); int speed = ethtool_cmd_speed(cmd); en_dbg(DRV, priv, "Set Speed=%d adv=0x%x autoneg=%d duplex=%d\n", speed, cmd->advertising, cmd->autoneg, cmd->duplex); if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETH_PROT_CTRL) || (cmd->duplex == DUPLEX_HALF)) return -EINVAL; memset(&ptys_reg, 0, sizeof(ptys_reg)); ptys_reg.local_port = priv->port; ptys_reg.proto_mask = MLX4_PTYS_EN; ret = mlx4_ACCESS_PTYS_REG(priv->mdev->dev, MLX4_ACCESS_REG_QUERY, &ptys_reg); if (ret) { en_warn(priv, "Failed to QUERY mlx4_ACCESS_PTYS_REG status(%x)\n", ret); return 0; } proto_admin = cmd->autoneg == AUTONEG_ENABLE ? cpu_to_be32(ptys_adv) : speed_set_ptys_admin(priv, speed, ptys_reg.eth_proto_cap); proto_admin &= ptys_reg.eth_proto_cap; if (!proto_admin) { en_warn(priv, "Not supported link mode(s) requested, check supported link modes.\n"); return -EINVAL; /* nothing to change due to bad input */ } if (proto_admin == ptys_reg.eth_proto_admin) return 0; /* Nothing to change */ en_dbg(DRV, priv, "mlx4_ACCESS_PTYS_REG SET: ptys_reg.eth_proto_admin = 0x%x\n", be32_to_cpu(proto_admin)); ptys_reg.eth_proto_admin = proto_admin; ret = mlx4_ACCESS_PTYS_REG(priv->mdev->dev, MLX4_ACCESS_REG_WRITE, &ptys_reg); if (ret) { en_warn(priv, "Failed to write mlx4_ACCESS_PTYS_REG eth_proto_admin(0x%x) status(0x%x)", be32_to_cpu(ptys_reg.eth_proto_admin), ret); return ret; } mutex_lock(&priv->mdev->state_lock); if (priv->port_up) { en_warn(priv, "Port link mode changed, restarting port...\n"); mlx4_en_stop_port(dev, 1); if (mlx4_en_start_port(dev)) en_err(priv, "Failed restarting port %d\n", priv->port); } mutex_unlock(&priv->mdev->state_lock); return 0; } static int mlx4_en_get_coalesce(struct net_device *dev, struct ethtool_coalesce *coal) { struct mlx4_en_priv *priv = netdev_priv(dev); coal->tx_coalesce_usecs = priv->tx_usecs; coal->tx_max_coalesced_frames = priv->tx_frames; coal->tx_max_coalesced_frames_irq = priv->tx_work_limit; coal->rx_coalesce_usecs = priv->rx_usecs; coal->rx_max_coalesced_frames = priv->rx_frames; coal->pkt_rate_low = priv->pkt_rate_low; coal->rx_coalesce_usecs_low = priv->rx_usecs_low; coal->pkt_rate_high = priv->pkt_rate_high; coal->rx_coalesce_usecs_high = priv->rx_usecs_high; coal->rate_sample_interval = priv->sample_interval; coal->use_adaptive_rx_coalesce = priv->adaptive_rx_coal; return 0; } static int mlx4_en_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal) { struct mlx4_en_priv *priv = netdev_priv(dev); if (!coal->tx_max_coalesced_frames_irq) return -EINVAL; priv->rx_frames = (coal->rx_max_coalesced_frames == MLX4_EN_AUTO_CONF) ? MLX4_EN_RX_COAL_TARGET : coal->rx_max_coalesced_frames; priv->rx_usecs = (coal->rx_coalesce_usecs == MLX4_EN_AUTO_CONF) ? MLX4_EN_RX_COAL_TIME : coal->rx_coalesce_usecs; /* Setting TX coalescing parameters */ if (coal->tx_coalesce_usecs != priv->tx_usecs || coal->tx_max_coalesced_frames != priv->tx_frames) { priv->tx_usecs = coal->tx_coalesce_usecs; priv->tx_frames = coal->tx_max_coalesced_frames; } /* Set adaptive coalescing params */ priv->pkt_rate_low = coal->pkt_rate_low; priv->rx_usecs_low = coal->rx_coalesce_usecs_low; priv->pkt_rate_high = coal->pkt_rate_high; priv->rx_usecs_high = coal->rx_coalesce_usecs_high; priv->sample_interval = coal->rate_sample_interval; priv->adaptive_rx_coal = coal->use_adaptive_rx_coalesce; priv->tx_work_limit = coal->tx_max_coalesced_frames_irq; return mlx4_en_moderation_update(priv); } static int mlx4_en_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int err; if (pause->autoneg) return -EINVAL; priv->prof->tx_pause = pause->tx_pause != 0; priv->prof->rx_pause = pause->rx_pause != 0; err = mlx4_SET_PORT_general(mdev->dev, priv->port, priv->rx_skb_size + ETH_FCS_LEN, priv->prof->tx_pause, priv->prof->tx_ppp, priv->prof->rx_pause, priv->prof->rx_ppp); if (err) en_err(priv, "Failed setting pause params\n"); return err; } static void mlx4_en_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) { struct mlx4_en_priv *priv = netdev_priv(dev); pause->tx_pause = priv->prof->tx_pause; pause->rx_pause = priv->prof->rx_pause; } static int mlx4_en_set_ringparam(struct net_device *dev, struct ethtool_ringparam *param) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; u32 rx_size, tx_size; int port_up = 0; int err = 0; if (param->rx_jumbo_pending || param->rx_mini_pending) return -EINVAL; rx_size = roundup_pow_of_two(param->rx_pending); rx_size = max_t(u32, rx_size, MLX4_EN_MIN_RX_SIZE); rx_size = min_t(u32, rx_size, MLX4_EN_MAX_RX_SIZE); tx_size = roundup_pow_of_two(param->tx_pending); tx_size = max_t(u32, tx_size, MLX4_EN_MIN_TX_SIZE); tx_size = min_t(u32, tx_size, MLX4_EN_MAX_TX_SIZE); if (rx_size == (priv->port_up ? priv->rx_ring[0]->actual_size : priv->rx_ring[0]->size) && tx_size == priv->tx_ring[0]->size) return 0; mutex_lock(&mdev->state_lock); if (priv->port_up) { port_up = 1; mlx4_en_stop_port(dev, 1); } mlx4_en_free_resources(priv); priv->prof->tx_ring_size = tx_size; priv->prof->rx_ring_size = rx_size; err = mlx4_en_alloc_resources(priv); if (err) { en_err(priv, "Failed reallocating port resources\n"); goto out; } if (port_up) { err = mlx4_en_start_port(dev); if (err) en_err(priv, "Failed starting port\n"); } err = mlx4_en_moderation_update(priv); out: mutex_unlock(&mdev->state_lock); return err; } static void mlx4_en_get_ringparam(struct net_device *dev, struct ethtool_ringparam *param) { struct mlx4_en_priv *priv = netdev_priv(dev); memset(param, 0, sizeof(*param)); param->rx_max_pending = MLX4_EN_MAX_RX_SIZE; param->tx_max_pending = MLX4_EN_MAX_TX_SIZE; param->rx_pending = priv->port_up ? priv->rx_ring[0]->actual_size : priv->rx_ring[0]->size; param->tx_pending = priv->tx_ring[0]->size; } static u32 mlx4_en_get_rxfh_indir_size(struct net_device *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); return priv->rx_ring_num; } static u32 mlx4_en_get_rxfh_key_size(struct net_device *netdev) { return MLX4_EN_RSS_KEY_SIZE; } static int mlx4_en_check_rxfh_func(struct net_device *dev, u8 hfunc) { struct mlx4_en_priv *priv = netdev_priv(dev); /* check if requested function is supported by the device */ if ((hfunc == ETH_RSS_HASH_TOP && !(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_TOP)) || (hfunc == ETH_RSS_HASH_XOR && !(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_XOR))) return -EINVAL; priv->rss_hash_fn = hfunc; if (hfunc == ETH_RSS_HASH_TOP && !(dev->features & NETIF_F_RXHASH)) en_warn(priv, "Toeplitz hash function should be used in conjunction with RX hashing for optimal performance\n"); if (hfunc == ETH_RSS_HASH_XOR && (dev->features & NETIF_F_RXHASH)) en_warn(priv, "Enabling both XOR Hash function and RX Hashing can limit RPS functionality\n"); return 0; } static int mlx4_en_get_rxfh(struct net_device *dev, u32 *ring_index, u8 *key, u8 *hfunc) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_rss_map *rss_map = &priv->rss_map; int rss_rings; size_t n = priv->rx_ring_num; int err = 0; rss_rings = priv->prof->rss_rings ?: priv->rx_ring_num; rss_rings = 1 << ilog2(rss_rings); while (n--) { if (!ring_index) break; ring_index[n] = rss_map->qps[n % rss_rings].qpn - rss_map->base_qpn; } if (key) memcpy(key, priv->rss_key, MLX4_EN_RSS_KEY_SIZE); if (hfunc) *hfunc = priv->rss_hash_fn; return err; } static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index, const u8 *key, const u8 hfunc) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int port_up = 0; int err = 0; int i; int rss_rings = 0; /* Calculate RSS table size and make sure flows are spread evenly * between rings */ for (i = 0; i < priv->rx_ring_num; i++) { if (!ring_index) continue; if (i > 0 && !ring_index[i] && !rss_rings) rss_rings = i; if (ring_index[i] != (i % (rss_rings ?: priv->rx_ring_num))) return -EINVAL; } if (!rss_rings) rss_rings = priv->rx_ring_num; /* RSS table size must be an order of 2 */ if (!is_power_of_2(rss_rings)) return -EINVAL; if (hfunc != ETH_RSS_HASH_NO_CHANGE) { err = mlx4_en_check_rxfh_func(dev, hfunc); if (err) return err; } mutex_lock(&mdev->state_lock); if (priv->port_up) { port_up = 1; mlx4_en_stop_port(dev, 1); } if (ring_index) priv->prof->rss_rings = rss_rings; if (key) memcpy(priv->rss_key, key, MLX4_EN_RSS_KEY_SIZE); if (port_up) { err = mlx4_en_start_port(dev); if (err) en_err(priv, "Failed starting port\n"); } mutex_unlock(&mdev->state_lock); return err; } #define all_zeros_or_all_ones(field) \ ((field) == 0 || (field) == (__force typeof(field))-1) static int mlx4_en_validate_flow(struct net_device *dev, struct ethtool_rxnfc *cmd) { struct ethtool_usrip4_spec *l3_mask; struct ethtool_tcpip4_spec *l4_mask; struct ethhdr *eth_mask; if (cmd->fs.location >= MAX_NUM_OF_FS_RULES) return -EINVAL; if (cmd->fs.flow_type & FLOW_MAC_EXT) { /* dest mac mask must be ff:ff:ff:ff:ff:ff */ if (!is_broadcast_ether_addr(cmd->fs.m_ext.h_dest)) return -EINVAL; } switch (cmd->fs.flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) { case TCP_V4_FLOW: case UDP_V4_FLOW: if (cmd->fs.m_u.tcp_ip4_spec.tos) return -EINVAL; l4_mask = &cmd->fs.m_u.tcp_ip4_spec; /* don't allow mask which isn't all 0 or 1 */ if (!all_zeros_or_all_ones(l4_mask->ip4src) || !all_zeros_or_all_ones(l4_mask->ip4dst) || !all_zeros_or_all_ones(l4_mask->psrc) || !all_zeros_or_all_ones(l4_mask->pdst)) return -EINVAL; break; case IP_USER_FLOW: l3_mask = &cmd->fs.m_u.usr_ip4_spec; if (l3_mask->l4_4_bytes || l3_mask->tos || l3_mask->proto || cmd->fs.h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4 || (!l3_mask->ip4src && !l3_mask->ip4dst) || !all_zeros_or_all_ones(l3_mask->ip4src) || !all_zeros_or_all_ones(l3_mask->ip4dst)) return -EINVAL; break; case ETHER_FLOW: eth_mask = &cmd->fs.m_u.ether_spec; /* source mac mask must not be set */ if (!is_zero_ether_addr(eth_mask->h_source)) return -EINVAL; /* dest mac mask must be ff:ff:ff:ff:ff:ff */ if (!is_broadcast_ether_addr(eth_mask->h_dest)) return -EINVAL; if (!all_zeros_or_all_ones(eth_mask->h_proto)) return -EINVAL; break; default: return -EINVAL; } if ((cmd->fs.flow_type & FLOW_EXT)) { if (cmd->fs.m_ext.vlan_etype || !((cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK)) == 0 || (cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK)) == cpu_to_be16(VLAN_VID_MASK))) return -EINVAL; if (cmd->fs.m_ext.vlan_tci) { if (be16_to_cpu(cmd->fs.h_ext.vlan_tci) >= VLAN_N_VID) return -EINVAL; } } return 0; } static int mlx4_en_ethtool_add_mac_rule(struct ethtool_rxnfc *cmd, struct list_head *rule_list_h, struct mlx4_spec_list *spec_l2, unsigned char *mac) { int err = 0; __be64 mac_msk = cpu_to_be64(MLX4_MAC_MASK << 16); spec_l2->id = MLX4_NET_TRANS_RULE_ID_ETH; memcpy(spec_l2->eth.dst_mac_msk, &mac_msk, ETH_ALEN); memcpy(spec_l2->eth.dst_mac, mac, ETH_ALEN); if ((cmd->fs.flow_type & FLOW_EXT) && (cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK))) { spec_l2->eth.vlan_id = cmd->fs.h_ext.vlan_tci; spec_l2->eth.vlan_id_msk = cpu_to_be16(VLAN_VID_MASK); } list_add_tail(&spec_l2->list, rule_list_h); return err; } static int mlx4_en_ethtool_add_mac_rule_by_ipv4(struct mlx4_en_priv *priv, struct ethtool_rxnfc *cmd, struct list_head *rule_list_h, struct mlx4_spec_list *spec_l2, __be32 ipv4_dst) { #ifdef CONFIG_INET unsigned char mac[ETH_ALEN]; if (!ipv4_is_multicast(ipv4_dst)) { if (cmd->fs.flow_type & FLOW_MAC_EXT) memcpy(&mac, cmd->fs.h_ext.h_dest, ETH_ALEN); else memcpy(&mac, priv->dev->dev_addr, ETH_ALEN); } else { ip_eth_mc_map(ipv4_dst, mac); } return mlx4_en_ethtool_add_mac_rule(cmd, rule_list_h, spec_l2, &mac[0]); #else return -EINVAL; #endif } static int add_ip_rule(struct mlx4_en_priv *priv, struct ethtool_rxnfc *cmd, struct list_head *list_h) { int err; struct mlx4_spec_list *spec_l2 = NULL; struct mlx4_spec_list *spec_l3 = NULL; struct ethtool_usrip4_spec *l3_mask = &cmd->fs.m_u.usr_ip4_spec; spec_l3 = kzalloc(sizeof(*spec_l3), GFP_KERNEL); spec_l2 = kzalloc(sizeof(*spec_l2), GFP_KERNEL); if (!spec_l2 || !spec_l3) { err = -ENOMEM; goto free_spec; } err = mlx4_en_ethtool_add_mac_rule_by_ipv4(priv, cmd, list_h, spec_l2, cmd->fs.h_u. usr_ip4_spec.ip4dst); if (err) goto free_spec; spec_l3->id = MLX4_NET_TRANS_RULE_ID_IPV4; spec_l3->ipv4.src_ip = cmd->fs.h_u.usr_ip4_spec.ip4src; if (l3_mask->ip4src) spec_l3->ipv4.src_ip_msk = EN_ETHTOOL_WORD_MASK; spec_l3->ipv4.dst_ip = cmd->fs.h_u.usr_ip4_spec.ip4dst; if (l3_mask->ip4dst) spec_l3->ipv4.dst_ip_msk = EN_ETHTOOL_WORD_MASK; list_add_tail(&spec_l3->list, list_h); return 0; free_spec: kfree(spec_l2); kfree(spec_l3); return err; } static int add_tcp_udp_rule(struct mlx4_en_priv *priv, struct ethtool_rxnfc *cmd, struct list_head *list_h, int proto) { int err; struct mlx4_spec_list *spec_l2 = NULL; struct mlx4_spec_list *spec_l3 = NULL; struct mlx4_spec_list *spec_l4 = NULL; struct ethtool_tcpip4_spec *l4_mask = &cmd->fs.m_u.tcp_ip4_spec; spec_l2 = kzalloc(sizeof(*spec_l2), GFP_KERNEL); spec_l3 = kzalloc(sizeof(*spec_l3), GFP_KERNEL); spec_l4 = kzalloc(sizeof(*spec_l4), GFP_KERNEL); if (!spec_l2 || !spec_l3 || !spec_l4) { err = -ENOMEM; goto free_spec; } spec_l3->id = MLX4_NET_TRANS_RULE_ID_IPV4; if (proto == TCP_V4_FLOW) { err = mlx4_en_ethtool_add_mac_rule_by_ipv4(priv, cmd, list_h, spec_l2, cmd->fs.h_u. tcp_ip4_spec.ip4dst); if (err) goto free_spec; spec_l4->id = MLX4_NET_TRANS_RULE_ID_TCP; spec_l3->ipv4.src_ip = cmd->fs.h_u.tcp_ip4_spec.ip4src; spec_l3->ipv4.dst_ip = cmd->fs.h_u.tcp_ip4_spec.ip4dst; spec_l4->tcp_udp.src_port = cmd->fs.h_u.tcp_ip4_spec.psrc; spec_l4->tcp_udp.dst_port = cmd->fs.h_u.tcp_ip4_spec.pdst; } else { err = mlx4_en_ethtool_add_mac_rule_by_ipv4(priv, cmd, list_h, spec_l2, cmd->fs.h_u. udp_ip4_spec.ip4dst); if (err) goto free_spec; spec_l4->id = MLX4_NET_TRANS_RULE_ID_UDP; spec_l3->ipv4.src_ip = cmd->fs.h_u.udp_ip4_spec.ip4src; spec_l3->ipv4.dst_ip = cmd->fs.h_u.udp_ip4_spec.ip4dst; spec_l4->tcp_udp.src_port = cmd->fs.h_u.udp_ip4_spec.psrc; spec_l4->tcp_udp.dst_port = cmd->fs.h_u.udp_ip4_spec.pdst; } if (l4_mask->ip4src) spec_l3->ipv4.src_ip_msk = EN_ETHTOOL_WORD_MASK; if (l4_mask->ip4dst) spec_l3->ipv4.dst_ip_msk = EN_ETHTOOL_WORD_MASK; if (l4_mask->psrc) spec_l4->tcp_udp.src_port_msk = EN_ETHTOOL_SHORT_MASK; if (l4_mask->pdst) spec_l4->tcp_udp.dst_port_msk = EN_ETHTOOL_SHORT_MASK; list_add_tail(&spec_l3->list, list_h); list_add_tail(&spec_l4->list, list_h); return 0; free_spec: kfree(spec_l2); kfree(spec_l3); kfree(spec_l4); return err; } static int mlx4_en_ethtool_to_net_trans_rule(struct net_device *dev, struct ethtool_rxnfc *cmd, struct list_head *rule_list_h) { int err; struct ethhdr *eth_spec; struct mlx4_spec_list *spec_l2; struct mlx4_en_priv *priv = netdev_priv(dev); err = mlx4_en_validate_flow(dev, cmd); if (err) return err; switch (cmd->fs.flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) { case ETHER_FLOW: spec_l2 = kzalloc(sizeof(*spec_l2), GFP_KERNEL); if (!spec_l2) return -ENOMEM; eth_spec = &cmd->fs.h_u.ether_spec; mlx4_en_ethtool_add_mac_rule(cmd, rule_list_h, spec_l2, &eth_spec->h_dest[0]); spec_l2->eth.ether_type = eth_spec->h_proto; if (eth_spec->h_proto) spec_l2->eth.ether_type_enable = 1; break; case IP_USER_FLOW: err = add_ip_rule(priv, cmd, rule_list_h); break; case TCP_V4_FLOW: err = add_tcp_udp_rule(priv, cmd, rule_list_h, TCP_V4_FLOW); break; case UDP_V4_FLOW: err = add_tcp_udp_rule(priv, cmd, rule_list_h, UDP_V4_FLOW); break; } return err; } static int mlx4_en_flow_replace(struct net_device *dev, struct ethtool_rxnfc *cmd) { int err; struct mlx4_en_priv *priv = netdev_priv(dev); struct ethtool_flow_id *loc_rule; struct mlx4_spec_list *spec, *tmp_spec; u32 qpn; u64 reg_id; struct mlx4_net_trans_rule rule = { .queue_mode = MLX4_NET_TRANS_Q_FIFO, .exclusive = 0, .allow_loopback = 1, .promisc_mode = MLX4_FS_REGULAR, }; rule.port = priv->port; rule.priority = MLX4_DOMAIN_ETHTOOL | cmd->fs.location; INIT_LIST_HEAD(&rule.list); /* Allow direct QP attaches if the EN_ETHTOOL_QP_ATTACH flag is set */ if (cmd->fs.ring_cookie == RX_CLS_FLOW_DISC) qpn = priv->drop_qp.qpn; else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) { qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1); } else { if (cmd->fs.ring_cookie >= priv->rx_ring_num) { en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist\n", cmd->fs.ring_cookie); return -EINVAL; } qpn = priv->rss_map.qps[cmd->fs.ring_cookie].qpn; if (!qpn) { en_warn(priv, "rxnfc: RX ring (%llu) is inactive\n", cmd->fs.ring_cookie); return -EINVAL; } } rule.qpn = qpn; err = mlx4_en_ethtool_to_net_trans_rule(dev, cmd, &rule.list); if (err) goto out_free_list; loc_rule = &priv->ethtool_rules[cmd->fs.location]; if (loc_rule->id) { err = mlx4_flow_detach(priv->mdev->dev, loc_rule->id); if (err) { en_err(priv, "Fail to detach network rule at location %d. registration id = %llx\n", cmd->fs.location, loc_rule->id); goto out_free_list; } loc_rule->id = 0; memset(&loc_rule->flow_spec, 0, sizeof(struct ethtool_rx_flow_spec)); list_del(&loc_rule->list); } err = mlx4_flow_attach(priv->mdev->dev, &rule, &reg_id); if (err) { en_err(priv, "Fail to attach network rule at location %d\n", cmd->fs.location); goto out_free_list; } loc_rule->id = reg_id; memcpy(&loc_rule->flow_spec, &cmd->fs, sizeof(struct ethtool_rx_flow_spec)); list_add_tail(&loc_rule->list, &priv->ethtool_list); out_free_list: list_for_each_entry_safe(spec, tmp_spec, &rule.list, list) { list_del(&spec->list); kfree(spec); } return err; } static int mlx4_en_flow_detach(struct net_device *dev, struct ethtool_rxnfc *cmd) { int err = 0; struct ethtool_flow_id *rule; struct mlx4_en_priv *priv = netdev_priv(dev); if (cmd->fs.location >= MAX_NUM_OF_FS_RULES) return -EINVAL; rule = &priv->ethtool_rules[cmd->fs.location]; if (!rule->id) { err = -ENOENT; goto out; } err = mlx4_flow_detach(priv->mdev->dev, rule->id); if (err) { en_err(priv, "Fail to detach network rule at location %d. registration id = 0x%llx\n", cmd->fs.location, rule->id); goto out; } rule->id = 0; memset(&rule->flow_spec, 0, sizeof(struct ethtool_rx_flow_spec)); list_del(&rule->list); out: return err; } static int mlx4_en_get_flow(struct net_device *dev, struct ethtool_rxnfc *cmd, int loc) { int err = 0; struct ethtool_flow_id *rule; struct mlx4_en_priv *priv = netdev_priv(dev); if (loc < 0 || loc >= MAX_NUM_OF_FS_RULES) return -EINVAL; rule = &priv->ethtool_rules[loc]; if (rule->id) memcpy(&cmd->fs, &rule->flow_spec, sizeof(struct ethtool_rx_flow_spec)); else err = -ENOENT; return err; } static int mlx4_en_get_num_flows(struct mlx4_en_priv *priv) { int i, res = 0; for (i = 0; i < MAX_NUM_OF_FS_RULES; i++) { if (priv->ethtool_rules[i].id) res++; } return res; } static int mlx4_en_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, u32 *rule_locs) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int err = 0; int i = 0, priority = 0; if ((cmd->cmd == ETHTOOL_GRXCLSRLCNT || cmd->cmd == ETHTOOL_GRXCLSRULE || cmd->cmd == ETHTOOL_GRXCLSRLALL) && (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_DEVICE_MANAGED || !priv->port_up)) return -EINVAL; switch (cmd->cmd) { case ETHTOOL_GRXRINGS: cmd->data = priv->rx_ring_num; break; case ETHTOOL_GRXCLSRLCNT: cmd->rule_cnt = mlx4_en_get_num_flows(priv); break; case ETHTOOL_GRXCLSRULE: err = mlx4_en_get_flow(dev, cmd, cmd->fs.location); break; case ETHTOOL_GRXCLSRLALL: while ((!err || err == -ENOENT) && priority < cmd->rule_cnt) { err = mlx4_en_get_flow(dev, cmd, i); if (!err) rule_locs[priority++] = i; i++; } err = 0; break; default: err = -EOPNOTSUPP; break; } return err; } static int mlx4_en_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) { int err = 0; struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_DEVICE_MANAGED || !priv->port_up) return -EINVAL; switch (cmd->cmd) { case ETHTOOL_SRXCLSRLINS: err = mlx4_en_flow_replace(dev, cmd); break; case ETHTOOL_SRXCLSRLDEL: err = mlx4_en_flow_detach(dev, cmd); break; default: en_warn(priv, "Unsupported ethtool command. (%d)\n", cmd->cmd); return -EINVAL; } return err; } static void mlx4_en_get_channels(struct net_device *dev, struct ethtool_channels *channel) { struct mlx4_en_priv *priv = netdev_priv(dev); memset(channel, 0, sizeof(*channel)); channel->max_rx = MAX_RX_RINGS; channel->max_tx = MLX4_EN_MAX_TX_RING_P_UP; channel->rx_count = priv->rx_ring_num; channel->tx_count = priv->tx_ring_num / MLX4_EN_NUM_UP; } static int mlx4_en_set_channels(struct net_device *dev, struct ethtool_channels *channel) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int port_up = 0; int err = 0; if (channel->other_count || channel->combined_count || channel->tx_count > MLX4_EN_MAX_TX_RING_P_UP || channel->rx_count > MAX_RX_RINGS || !channel->tx_count || !channel->rx_count) return -EINVAL; mutex_lock(&mdev->state_lock); if (priv->port_up) { port_up = 1; mlx4_en_stop_port(dev, 1); } mlx4_en_free_resources(priv); priv->num_tx_rings_p_up = channel->tx_count; priv->tx_ring_num = channel->tx_count * MLX4_EN_NUM_UP; priv->rx_ring_num = channel->rx_count; err = mlx4_en_alloc_resources(priv); if (err) { en_err(priv, "Failed reallocating port resources\n"); goto out; } netif_set_real_num_tx_queues(dev, priv->tx_ring_num); netif_set_real_num_rx_queues(dev, priv->rx_ring_num); if (dev->num_tc) mlx4_en_setup_tc(dev, MLX4_EN_NUM_UP); en_warn(priv, "Using %d TX rings\n", priv->tx_ring_num); en_warn(priv, "Using %d RX rings\n", priv->rx_ring_num); if (port_up) { err = mlx4_en_start_port(dev); if (err) en_err(priv, "Failed starting port\n"); } err = mlx4_en_moderation_update(priv); out: mutex_unlock(&mdev->state_lock); return err; } static int mlx4_en_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int ret; ret = ethtool_op_get_ts_info(dev, info); if (ret) return ret; if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS) { info->so_timestamping |= SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_RX_HARDWARE | SOF_TIMESTAMPING_RAW_HARDWARE; info->tx_types = (1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_ON); info->rx_filters = (1 << HWTSTAMP_FILTER_NONE) | (1 << HWTSTAMP_FILTER_ALL); if (mdev->ptp_clock) info->phc_index = ptp_clock_index(mdev->ptp_clock); } return ret; } static int mlx4_en_set_priv_flags(struct net_device *dev, u32 flags) { struct mlx4_en_priv *priv = netdev_priv(dev); bool bf_enabled_new = !!(flags & MLX4_EN_PRIV_FLAGS_BLUEFLAME); bool bf_enabled_old = !!(priv->pflags & MLX4_EN_PRIV_FLAGS_BLUEFLAME); int i; if (bf_enabled_new == bf_enabled_old) return 0; /* Nothing to do */ if (bf_enabled_new) { bool bf_supported = true; for (i = 0; i < priv->tx_ring_num; i++) bf_supported &= priv->tx_ring[i]->bf_alloced; if (!bf_supported) { en_err(priv, "BlueFlame is not supported\n"); return -EINVAL; } priv->pflags |= MLX4_EN_PRIV_FLAGS_BLUEFLAME; } else { priv->pflags &= ~MLX4_EN_PRIV_FLAGS_BLUEFLAME; } for (i = 0; i < priv->tx_ring_num; i++) priv->tx_ring[i]->bf_enabled = bf_enabled_new; en_info(priv, "BlueFlame %s\n", bf_enabled_new ? "Enabled" : "Disabled"); return 0; } static u32 mlx4_en_get_priv_flags(struct net_device *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); return priv->pflags; } static int mlx4_en_get_tunable(struct net_device *dev, const struct ethtool_tunable *tuna, void *data) { const struct mlx4_en_priv *priv = netdev_priv(dev); int ret = 0; switch (tuna->id) { case ETHTOOL_TX_COPYBREAK: *(u32 *)data = priv->prof->inline_thold; break; default: ret = -EINVAL; break; } return ret; } static int mlx4_en_set_tunable(struct net_device *dev, const struct ethtool_tunable *tuna, const void *data) { struct mlx4_en_priv *priv = netdev_priv(dev); int val, ret = 0; switch (tuna->id) { case ETHTOOL_TX_COPYBREAK: val = *(u32 *)data; if (val < MIN_PKT_LEN || val > MAX_INLINE) ret = -EINVAL; else priv->prof->inline_thold = val; break; default: ret = -EINVAL; break; } return ret; } static int mlx4_en_get_module_info(struct net_device *dev, struct ethtool_modinfo *modinfo) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int ret; u8 data[4]; /* Read first 2 bytes to get Module & REV ID */ ret = mlx4_get_module_info(mdev->dev, priv->port, 0/*offset*/, 2/*size*/, data); if (ret < 2) return -EIO; switch (data[0] /* identifier */) { case MLX4_MODULE_ID_QSFP: modinfo->type = ETH_MODULE_SFF_8436; modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN; break; case MLX4_MODULE_ID_QSFP_PLUS: if (data[1] >= 0x3) { /* revision id */ modinfo->type = ETH_MODULE_SFF_8636; modinfo->eeprom_len = ETH_MODULE_SFF_8636_LEN; } else { modinfo->type = ETH_MODULE_SFF_8436; modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN; } break; case MLX4_MODULE_ID_QSFP28: modinfo->type = ETH_MODULE_SFF_8636; modinfo->eeprom_len = ETH_MODULE_SFF_8636_LEN; break; case MLX4_MODULE_ID_SFP: modinfo->type = ETH_MODULE_SFF_8472; modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; break; default: return -ENOSYS; } return 0; } static int mlx4_en_get_module_eeprom(struct net_device *dev, struct ethtool_eeprom *ee, u8 *data) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int offset = ee->offset; int i = 0, ret; if (ee->len == 0) return -EINVAL; memset(data, 0, ee->len); while (i < ee->len) { en_dbg(DRV, priv, "mlx4_get_module_info i(%d) offset(%d) len(%d)\n", i, offset, ee->len - i); ret = mlx4_get_module_info(mdev->dev, priv->port, offset, ee->len - i, data + i); if (!ret) /* Done reading */ return 0; if (ret < 0) { en_err(priv, "mlx4_get_module_info i(%d) offset(%d) bytes_to_read(%d) - FAILED (0x%x)\n", i, offset, ee->len - i, ret); return 0; } i += ret; offset += ret; } return 0; } const struct ethtool_ops mlx4_en_ethtool_ops = { .get_drvinfo = mlx4_en_get_drvinfo, .get_settings = mlx4_en_get_settings, .set_settings = mlx4_en_set_settings, .get_link = ethtool_op_get_link, .get_strings = mlx4_en_get_strings, .get_sset_count = mlx4_en_get_sset_count, .get_ethtool_stats = mlx4_en_get_ethtool_stats, .self_test = mlx4_en_self_test, .get_wol = mlx4_en_get_wol, .set_wol = mlx4_en_set_wol, .get_msglevel = mlx4_en_get_msglevel, .set_msglevel = mlx4_en_set_msglevel, .get_coalesce = mlx4_en_get_coalesce, .set_coalesce = mlx4_en_set_coalesce, .get_pauseparam = mlx4_en_get_pauseparam, .set_pauseparam = mlx4_en_set_pauseparam, .get_ringparam = mlx4_en_get_ringparam, .set_ringparam = mlx4_en_set_ringparam, .get_rxnfc = mlx4_en_get_rxnfc, .set_rxnfc = mlx4_en_set_rxnfc, .get_rxfh_indir_size = mlx4_en_get_rxfh_indir_size, .get_rxfh_key_size = mlx4_en_get_rxfh_key_size, .get_rxfh = mlx4_en_get_rxfh, .set_rxfh = mlx4_en_set_rxfh, .get_channels = mlx4_en_get_channels, .set_channels = mlx4_en_set_channels, .get_ts_info = mlx4_en_get_ts_info, .set_priv_flags = mlx4_en_set_priv_flags, .get_priv_flags = mlx4_en_get_priv_flags, .get_tunable = mlx4_en_get_tunable, .set_tunable = mlx4_en_set_tunable, .get_module_info = mlx4_en_get_module_info, .get_module_eeprom = mlx4_en_get_module_eeprom };
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <Workspace version = "1.0"> <FileRef location = "self:/Users/jarrodparkes/Desktop/Guard.playground"> </FileRef> </Workspace>
{ "pile_set_name": "Github" }
/*- * See the file LICENSE for redistribution information. * * Copyright (c) 1996-2003 * Sleepycat Software. All rights reserved. */ #include "db_config.h" #ifndef lint static const char revid[] = "$Id: hash_stub.c,v 1.4 2003/07/01 19:47:14 bostic Exp $"; #endif /* not lint */ #ifndef NO_SYSTEM_INCLUDES #include <sys/types.h> #endif #include "db_int.h" #include "dbinc/db_page.h" #include "dbinc/hash.h" /* * If the library wasn't compiled with the Hash access method, various * routines aren't available. Stub them here, returning an appropriate * error. */ /* * __db_nohasham -- * Error when a Berkeley DB build doesn't include the access method. * * PUBLIC: int __db_no_hash_am __P((DB_ENV *)); */ int __db_no_hash_am(dbenv) DB_ENV *dbenv; { __db_err(dbenv, "library build did not include support for the Hash access method"); abort(); return (DB_OPNOTSUP); } int __ham_30_hashmeta(dbp, real_name, obuf) DB *dbp; char *real_name; u_int8_t *obuf; { COMPQUIET(real_name, NULL); COMPQUIET(obuf, NULL); return (__db_no_hash_am(dbp->dbenv)); } int __ham_30_sizefix(dbp, fhp, realname, metabuf) DB *dbp; DB_FH *fhp; char *realname; u_int8_t *metabuf; { COMPQUIET(fhp, NULL); COMPQUIET(realname, NULL); COMPQUIET(metabuf, NULL); return (__db_no_hash_am(dbp->dbenv)); } int __ham_31_hash(dbp, real_name, flags, fhp, h, dirtyp) DB *dbp; char *real_name; u_int32_t flags; DB_FH *fhp; PAGE *h; int *dirtyp; { COMPQUIET(real_name, NULL); COMPQUIET(flags, 0); COMPQUIET(fhp, NULL); COMPQUIET(h, NULL); COMPQUIET(dirtyp, NULL); return (__db_no_hash_am(dbp->dbenv)); } int __ham_31_hashmeta(dbp, real_name, flags, fhp, h, dirtyp) DB *dbp; char *real_name; u_int32_t flags; DB_FH *fhp; PAGE *h; int *dirtyp; { COMPQUIET(real_name, NULL); COMPQUIET(flags, 0); COMPQUIET(fhp, NULL); COMPQUIET(h, NULL); COMPQUIET(dirtyp, NULL); return (__db_no_hash_am(dbp->dbenv)); } int __ham_c_count(dbc, recnop) DBC *dbc; db_recno_t *recnop; { COMPQUIET(recnop, NULL); return (__db_no_hash_am(dbc->dbp->dbenv)); } int __ham_c_dup(orig_dbc, new_dbc) DBC *orig_dbc, *new_dbc; { COMPQUIET(new_dbc, NULL); return (__db_no_hash_am(orig_dbc->dbp->dbenv)); } int __ham_c_init(dbc) DBC *dbc; { return (__db_no_hash_am(dbc->dbp->dbenv)); } void __ham_cprint(dbc) DBC *dbc; { COMPQUIET(dbc, NULL); return; } int __ham_db_close(dbp) DB *dbp; { COMPQUIET(dbp, NULL); return (0); } int __ham_db_create(dbp) DB *dbp; { COMPQUIET(dbp, NULL); return (0); } int __ham_init_getpgnos(dbenv, dtabp, dtabsizep) DB_ENV *dbenv; int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); size_t *dtabsizep; { COMPQUIET(dbenv, NULL); COMPQUIET(dtabp, NULL); COMPQUIET(dtabsizep, NULL); return (0); } int __ham_init_getallpgnos(dbenv, dtabp, dtabsizep) DB_ENV *dbenv; int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); size_t *dtabsizep; { COMPQUIET(dbenv, NULL); COMPQUIET(dtabp, NULL); COMPQUIET(dtabsizep, NULL); return (0); } int __ham_init_print(dbenv, dtabp, dtabsizep) DB_ENV *dbenv; int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); size_t *dtabsizep; { COMPQUIET(dbenv, NULL); COMPQUIET(dtabp, NULL); COMPQUIET(dtabsizep, NULL); return (0); } int __ham_init_recover(dbenv, dtabp, dtabsizep) DB_ENV *dbenv; int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *)); size_t *dtabsizep; { COMPQUIET(dbenv, NULL); COMPQUIET(dtabp, NULL); COMPQUIET(dtabsizep, NULL); return (0); } int __ham_meta2pgset(dbp, vdp, hmeta, flags, pgset) DB *dbp; VRFY_DBINFO *vdp; HMETA *hmeta; u_int32_t flags; DB *pgset; { COMPQUIET(vdp, NULL); COMPQUIET(hmeta, NULL); COMPQUIET(flags, 0); COMPQUIET(pgset, NULL); return (__db_no_hash_am(dbp->dbenv)); } int __ham_metachk(dbp, name, hashm) DB *dbp; const char *name; HMETA *hashm; { COMPQUIET(name, NULL); COMPQUIET(hashm, NULL); return (__db_no_hash_am(dbp->dbenv)); } int __ham_new_file(dbp, txn, fhp, name) DB *dbp; DB_TXN *txn; DB_FH *fhp; const char *name; { COMPQUIET(txn, NULL); COMPQUIET(fhp, NULL); COMPQUIET(name, NULL); return (__db_no_hash_am(dbp->dbenv)); } int __ham_new_subdb(mdbp, dbp, txn) DB *mdbp, *dbp; DB_TXN *txn; { COMPQUIET(dbp, NULL); COMPQUIET(txn, NULL); return (__db_no_hash_am(mdbp->dbenv)); } int __ham_open(dbp, txn, name, base_pgno, flags) DB *dbp; DB_TXN *txn; const char *name; db_pgno_t base_pgno; u_int32_t flags; { COMPQUIET(txn, NULL); COMPQUIET(name, NULL); COMPQUIET(base_pgno, 0); COMPQUIET(flags, 0); return (__db_no_hash_am(dbp->dbenv)); } int __ham_pgin(dbenv, dummydbp, pg, pp, cookie) DB_ENV *dbenv; DB *dummydbp; db_pgno_t pg; void *pp; DBT *cookie; { COMPQUIET(dummydbp, NULL); COMPQUIET(pg, 0); COMPQUIET(pp, NULL); COMPQUIET(cookie, NULL); return (__db_no_hash_am(dbenv)); } int __ham_pgout(dbenv, dummydbp, pg, pp, cookie) DB_ENV *dbenv; DB *dummydbp; db_pgno_t pg; void *pp; DBT *cookie; { COMPQUIET(dummydbp, NULL); COMPQUIET(pg, 0); COMPQUIET(pp, NULL); COMPQUIET(cookie, NULL); return (__db_no_hash_am(dbenv)); } int __ham_mswap(pg) void *pg; { COMPQUIET(pg, NULL); return (__db_no_hash_am(NULL)); } int __ham_quick_delete(dbc) DBC *dbc; { return (__db_no_hash_am(dbc->dbp->dbenv)); } int __ham_reclaim(dbp, txn) DB *dbp; DB_TXN *txn; { COMPQUIET(txn, NULL); return (__db_no_hash_am(dbp->dbenv)); } int __ham_salvage(dbp, vdp, pgno, h, handle, callback, flags) DB *dbp; VRFY_DBINFO *vdp; db_pgno_t pgno; PAGE *h; void *handle; int (*callback) __P((void *, const void *)); u_int32_t flags; { COMPQUIET(vdp, NULL); COMPQUIET(pgno, 0); COMPQUIET(h, NULL); COMPQUIET(handle, NULL); COMPQUIET(callback, NULL); COMPQUIET(flags, 0); return (__db_no_hash_am(dbp->dbenv)); } int __ham_stat(dbc, spp, flags) DBC *dbc; void *spp; u_int32_t flags; { COMPQUIET(spp, NULL); COMPQUIET(flags, 0); return (__db_no_hash_am(dbc->dbp->dbenv)); } int __ham_truncate(dbc, countp) DBC *dbc; u_int32_t *countp; { COMPQUIET(dbc, NULL); COMPQUIET(countp, NULL); return (__db_no_hash_am(dbc->dbp->dbenv)); } int __ham_vrfy(dbp, vdp, h, pgno, flags) DB *dbp; VRFY_DBINFO *vdp; PAGE *h; db_pgno_t pgno; u_int32_t flags; { COMPQUIET(vdp, NULL); COMPQUIET(h, NULL); COMPQUIET(pgno, 0); COMPQUIET(flags, 0); return (__db_no_hash_am(dbp->dbenv)); } int __ham_vrfy_hashing(dbp, nentries, m, thisbucket, pgno, flags, hfunc) DB *dbp; u_int32_t nentries; HMETA *m; u_int32_t thisbucket; db_pgno_t pgno; u_int32_t flags; u_int32_t (*hfunc) __P((DB *, const void *, u_int32_t)); { COMPQUIET(nentries, 0); COMPQUIET(m, NULL); COMPQUIET(thisbucket, 0); COMPQUIET(pgno, 0); COMPQUIET(flags, 0); COMPQUIET(hfunc, NULL); return (__db_no_hash_am(dbp->dbenv)); } int __ham_vrfy_meta(dbp, vdp, m, pgno, flags) DB *dbp; VRFY_DBINFO *vdp; HMETA *m; db_pgno_t pgno; u_int32_t flags; { COMPQUIET(vdp, NULL); COMPQUIET(m, NULL); COMPQUIET(pgno, 0); COMPQUIET(flags, 0); return (__db_no_hash_am(dbp->dbenv)); } int __ham_vrfy_structure(dbp, vdp, meta_pgno, flags) DB *dbp; VRFY_DBINFO *vdp; db_pgno_t meta_pgno; u_int32_t flags; { COMPQUIET(vdp, NULL); COMPQUIET(meta_pgno, 0); COMPQUIET(flags, 0); return (__db_no_hash_am(dbp->dbenv)); }
{ "pile_set_name": "Github" }
--- layout: global title: Under File Storage Extension API nickname: UFS Extension API group: Storage Integrations priority: 101 --- This page is intended for developers of under storage extensions. Please look at [managing extensions]({{ '/en/ufs/Ufs-Extensions.html' | relativize_url }}) for a guide to using existing extensions. * Table of Contents {:toc} ## Introduction Under storage extensions provide a framework to enable additional storage systems to work with Alluxio and makes it convenient to develop modules not already supported by Alluxio. Extensions are built as JARs and included at a specific extensions location to be picked up by core Alluxio. This page describes the mechanics of how extensions in Alluxio work, and provides detailed instructions for developing an under storage extension. If the modules included in core Alluxio do not use the interface supported by your desired storage system, you may choose to implement an under storage extension. ## Implementing an Under Storage Extension Building a new under storage connector involves: - Implementing the required under storage interface - Declaring the service implementation - Bundling up the implementation and transitive dependencies in an uber JAR A reference implementation can be found in the [alluxio-extensions](https://github.com/Alluxio/alluxio-extensions/tree/master/underfs/tutorial) repository. In the rest of this section, we describe the steps involved in writing a new under storage extension. The sample project, called `DummyUnderFileSystem`, uses maven as the build and dependency management tool, and forwards all operations to a local filesystem. ### Implement the Under Storage Interface The [HDFS Submodule](https://github.com/alluxio/alluxio/tree/master/underfs/hdfs) and [S3 Submodule](https://github.com/alluxio/alluxio/tree/master/underfs/s3a) are good examples of how to enable a storage system to serve as Alluxio's underlying storage. Step 1: Implement the interface `UnderFileSystem` The `UnderFileSystem` interface is defined in the module `org.alluxio:alluxio-core-common`. Choose to extend either `ConsistentUnderFileSystem` or `ObjectUnderFileSystem` to implement the `UnderFileSystem` interface. - **`ConsistentUnderFileSystem`**: used for storage like HDFS which is not eventually consistent. - **`ObjectUnderFileSystem`**: suitable for connecting to object storage and abstracts away mapping file system operations to an object store. ```java public class DummyUnderFileSystem extends ConsistentUnderFileSystem { // Implement filesystem operations ... } ``` or, ```java public class DummyUnderFileSystem extends ObjectUnderFileSystem { // Implement object store operations ... } ``` Step 2: Implement the interface `UnderFileSystemFactory` The under storage factory determines defines which paths the `UnderFileSystem` implementation supports and how to create the `UnderFileSystem` implementation. ```java public class DummyUnderFileSystemFactory implements UnderFileSystemFactory { ... @Override public UnderFileSystem create(String path, UnderFileSystemConfiguration conf) { // Create the under storage instance } @Override public boolean supportsPath(String path) { // Choose which schemes to support, e.g., dummy:// } } ``` Step 3: Define any properties required to configure the `UnderFileSystem`. ```java public class DummyUnderFileSystemPropertyKey { public static final PropertyKey DUMMY_UFS_PROPERTY = new PropertyKey.Builder(Name.DUMMY_UFS_PROPERTY) .setDescription("...") .setDefaultValue("...") .build(); public static final class Name { public static final String DUMMY_UFS_PROPERTY = "fs.dummy.property"; } } ``` ### Declare the Service Create a file at `src/main/resources/META-INF/services/alluxio.underfs.UnderFileSystemFactory` advertising the implemented `UnderFileSystemFactory` to the ServiceLoader. ``` alluxio.underfs.dummy.DummyUnderFileSystemFactory ``` ### Build Include all transitive dependencies of the extension project in the built JAR using either `maven-shade-plugin` or `maven-assembly`. In addition, to avoid collisions, specify scope for the dependency `alluxio-core-common` as `provided`. The maven definition would look like: ```xml <dependencies> <!-- Core Alluxio dependencies --> <dependency> <groupId>org.alluxio</groupId> <artifactId>alluxio-core-common</artifactId> <scope>provided</scope> </dependency> ... </dependencies> ``` Build the tarball: ```console $ mvn package ``` ### Install to Alluxio Install the tarball to Alluxio: ```console $ ./bin/alluxio extensions install <path>/<to>/<probject>/target/alluxio-underfs-<ufsName>-<version>.jar ``` ### Test the Under Storage Extension To ensure the new under storage module fulfills the minimum requirements to work with Alluxio, one can run contract tests to test different workflows with various combinations of operations against the under storage. ```console $ ./bin/alluxio runUfsTests --path <scheme>://<path>/ -D<key>=<value> ``` In addition, one can also mount the under storage and run other kinds of tests on it. Please refer to [managing extensions]({{ '/en/ufs/Ufs-Extensions.html' | relativize_url }}). ## How it Works ### Service Discovery Extension JARs are loaded dynamically at runtime by Alluxio servers, which enables Alluxio to talk to new under storage systems without requiring a restart. Alluxio servers use Java [ServiceLoader](https://docs.oracle.com/javase/7/docs/api/java/util/ServiceLoader.html) to discover implementations of the under storage API. Providers include implementations of the `alluxio.underfs.UnderFileSystemFactory` interface. The implementation is advertised by including a text file in `META_INF/services` with a single line pointing to the class implementing the said interface. ### Dependency Management Implementors are required to include transitive dependencies in their extension JARs. Alluxio performs isolated classloading for each extension JARs to avoid dependency conflicts between Alluxio servers and extensions. ## Contributing your Under Storage extension to Alluxio Congratulations! You have developed a new under storage extension to Alluxio. Let the community know by submitting a pull request to the Alluxio [repository](https://github.com/Alluxio/alluxio/blob/master/docs/en/ufs/Ufs-Extensions.md) to edit the list of extensions section on the [documentation page]({{ '/en/ufs/Ufs-Extensions.html' | relativize_url }}).
{ "pile_set_name": "Github" }
## @file # Instance of PCI Express Library using the 256 MB PCI Express MMIO window. # # PCI Express Library that uses the 256 MB PCI Express MMIO window to perform # PCI Configuration cycles. Layers on top of an I/O Library instance. # # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved. # Portions copyright (c) 2016, American Megatrends, Inc. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php. # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # # ## [Defines] INF_VERSION = 0x00010005 BASE_NAME = SmmPciExpressLib FILE_GUID = 00D24382-8231-4B18-A4F0-2D94D8FE2E81 MODULE_TYPE = DXE_SMM_DRIVER VERSION_STRING = 1.0 LIBRARY_CLASS = PciExpressLib|DXE_SMM_DRIVER SMM_CORE CONSTRUCTOR = SmmPciExpressLibConstructor [Sources] PciExpressLib.c [Packages] MdePkg/MdePkg.dec [LibraryClasses] BaseLib PcdLib DebugLib IoLib [Pcd] gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## CONSUMES
{ "pile_set_name": "Github" }
package internal // MainPath stores the file path of the main package. On App Engine Standard // using Go version 1.9 and below, this will be unset. On App Engine Flex and // App Engine Standard second-gen (Go 1.11 and above), this will be the // filepath to package main. var MainPath string
{ "pile_set_name": "Github" }
# frozen_string_literal: true RSpec.shared_examples 'reportable note' do |type| include MobileHelpers include NotesHelper let(:comment) { find("##{ActionView::RecordIdentifier.dom_id(note)}") } let(:more_actions_selector) { '.more-actions.dropdown' } let(:abuse_report_path) { new_abuse_report_path(user_id: note.author.id, ref_url: noteable_note_url(note)) } it 'has an edit button' do expect(comment).to have_selector('.js-note-edit') end it 'has a `More actions` dropdown' do expect(comment).to have_selector(more_actions_selector) end it 'dropdown has Report and Delete links' do dropdown = comment.find(more_actions_selector) open_dropdown(dropdown) expect(dropdown).to have_link('Report abuse to admin', href: abuse_report_path) if type == 'issue' || type == 'merge_request' expect(dropdown).to have_button('Delete comment') else expect(dropdown).to have_link('Delete comment', href: note_url(note, project)) end end it 'Report button links to a report page' do dropdown = comment.find(more_actions_selector) open_dropdown(dropdown) dropdown.click_link('Report abuse to admin') expect(find('#user_name')['value']).to match(note.author.username) expect(find('#abuse_report_message')['value']).to match(noteable_note_url(note)) end def open_dropdown(dropdown) # make window wide enough that tooltip doesn't trigger horizontal scrollbar restore_window_size dropdown.find('.more-actions-toggle').click dropdown.find('.dropdown-menu li', match: :first) end end
{ "pile_set_name": "Github" }
/** * @author: Dennis Hernández * @webSite: http://djhvscf.github.io/Blog * @version: v1.0.0 * * @update zhixin wen <[email protected]> */ !function ($) { 'use strict'; $.extend($.fn.bootstrapTable.defaults, { keyEvents: false }); var BootstrapTable = $.fn.bootstrapTable.Constructor, _init = BootstrapTable.prototype.init; BootstrapTable.prototype.init = function () { _init.apply(this, Array.prototype.slice.apply(arguments)); this.initKeyEvents(); }; BootstrapTable.prototype.initKeyEvents = function () { if (this.options.keyEvents) { var that = this; $(document).off('keydown').on('keydown', function (e) { var $search = that.$toolbar.find('.search input'), $refresh = that.$toolbar.find('button[name="refresh"]'), $toggle = that.$toolbar.find('button[name="toggle"]'), $paginationSwitch = that.$toolbar.find('button[name="paginationSwitch"]'); if (document.activeElement === $search.get(0)) { return true; } switch (e.keyCode) { case 83: //s if (!that.options.search) { return; } $search.focus(); return false; case 82: //r if (!that.options.showRefresh) { return; } $refresh.click(); return false; case 84: //t if (!that.options.showToggle) { return; } $toggle.click(); return false; case 80: //p if (!that.options.showPaginationSwitch) { return; } $paginationSwitch.click(); return false; case 37: // left if (!that.options.pagination) { return; } that.prevPage(); return false; case 39: // right if (!that.options.pagination) { return; } that.nextPage(); return; } }); } }; }(jQuery);
{ "pile_set_name": "Github" }
use std::error::Error; use futures::StreamExt; use heim_disk as disk; #[heim_derive::test] async fn smoke_partitions() -> Result<(), Box<dyn Error>> { let partitions = disk::partitions().await?; futures::pin_mut!(partitions); while let Some(part) = partitions.next().await { let part = part?; let _ = part.device(); let _ = part.mount_point(); let _ = part.file_system(); #[cfg(target_os = "macos")] { use heim_disk::os::macos::PartitionExt; let _ = part.flags(); } #[cfg(target_os = "windows")] { use heim_disk::os::windows::PartitionExt; let _ = part.flags(); let _ = part.drive_type(); } } Ok(()) } #[heim_derive::test] async fn smoke_partitions_physical() -> Result<(), Box<dyn Error>> { let partitions = disk::partitions_physical().await?; futures::pin_mut!(partitions); while let Some(part) = partitions.next().await { let part = part?; let _ = part.device(); let _ = part.mount_point(); let _ = part.file_system(); #[cfg(target_os = "macos")] { use heim_disk::os::macos::PartitionExt; let _ = part.flags(); } #[cfg(target_os = "windows")] { use heim_disk::os::windows::PartitionExt; let _ = part.flags(); let _ = part.drive_type(); } } Ok(()) } #[heim_derive::test] async fn smoke_usage() -> Result<(), Box<dyn Error>> { let usage = disk::usage("/").await?; let _ = usage.total(); let _ = usage.used(); let _ = usage.free(); let _ = usage.ratio(); #[cfg(unix)] { use heim_disk::os::unix::UsageExt; let _ = usage.flags(); } Ok(()) } #[heim_derive::test] async fn smoke_io_counters() -> Result<(), Box<dyn Error>> { #[cfg(target_os = "windows")] { use std::process::Command; let _ = Command::new("diskperf").arg("-y").status(); } let counters = disk::io_counters().await?; futures::pin_mut!(counters); while let Some(count) = counters.next().await { let count = count.unwrap(); let _ = count.device_name(); let _ = count.read_count(); let _ = count.write_count(); let _ = count.read_bytes(); let _ = count.write_bytes(); } Ok(()) } #[heim_derive::test] async fn smoke_io_counters_physical() -> Result<(), Box<dyn Error>> { #[cfg(target_os = "windows")] { use std::process::Command; let _ = Command::new("diskperf").arg("-y").status(); } let counters = disk::io_counters_physical().await?; futures::pin_mut!(counters); while let Some(count) = counters.next().await { let count = count?; let _ = count.device_name(); let _ = count.read_count(); let _ = count.write_count(); let _ = count.read_bytes(); let _ = count.write_bytes(); } Ok(()) }
{ "pile_set_name": "Github" }
package testutil import ( "net" testing "github.com/mitchellh/go-testing-interface" "github.com/stretchr/testify/require" ) // RequireDeadlineErr requires that an error be caused by a net.Conn's deadline // being reached (after being set by conn.Set{Read,Write}Deadline or // SetDeadline). func RequireDeadlineErr(t testing.T, err error) { t.Helper() require.NotNil(t, err) netErr, ok := err.(net.Error) require.Truef(t, ok, "error does not implement net.Error: (%T) %v", err, err) require.Contains(t, netErr.Error(), ": i/o timeout") require.True(t, netErr.Timeout()) require.True(t, netErr.Temporary()) }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.SwipeRefreshLayout android:id="@id/swipe_refresh" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.RecyclerView android:id="@id/recycler_view" android:layout_width="match_parent" android:layout_height="match_parent"> </android.support.v7.widget.RecyclerView> </android.support.v4.widget.SwipeRefreshLayout>
{ "pile_set_name": "Github" }
0
{ "pile_set_name": "Github" }
var isMergeable = require('./is-mergeable'); var sortSelectors = require('../level-1/sort-selectors'); var tidyRules = require('../level-1/tidy-rules'); var OptimizationLevel = require('../../options/optimization-level').OptimizationLevel; var serializeBody = require('../../writer/one-time').body; var serializeRules = require('../../writer/one-time').rules; var Token = require('../../tokenizer/token'); function unsafeSelector(value) { return /\.|\*| :/.test(value); } function isBemElement(token) { var asString = serializeRules(token[1]); return asString.indexOf('__') > -1 || asString.indexOf('--') > -1; } function withoutModifier(selector) { return selector.replace(/--[^ ,>\+~:]+/g, ''); } function removeAnyUnsafeElements(left, candidates) { var leftSelector = withoutModifier(serializeRules(left[1])); for (var body in candidates) { var right = candidates[body]; var rightSelector = withoutModifier(serializeRules(right[1])); if (rightSelector.indexOf(leftSelector) > -1 || leftSelector.indexOf(rightSelector) > -1) delete candidates[body]; } } function mergeNonAdjacentByBody(tokens, context) { var options = context.options; var mergeSemantically = options.level[OptimizationLevel.Two].mergeSemantically; var adjacentSpace = options.compatibility.selectors.adjacentSpace; var selectorsSortingMethod = options.level[OptimizationLevel.One].selectorsSortingMethod; var mergeablePseudoClasses = options.compatibility.selectors.mergeablePseudoClasses; var mergeablePseudoElements = options.compatibility.selectors.mergeablePseudoElements; var multiplePseudoMerging = options.compatibility.selectors.multiplePseudoMerging; var candidates = {}; for (var i = tokens.length - 1; i >= 0; i--) { var token = tokens[i]; if (token[0] != Token.RULE) continue; if (token[2].length > 0 && (!mergeSemantically && unsafeSelector(serializeRules(token[1])))) candidates = {}; if (token[2].length > 0 && mergeSemantically && isBemElement(token)) removeAnyUnsafeElements(token, candidates); var candidateBody = serializeBody(token[2]); var oldToken = candidates[candidateBody]; if (oldToken && isMergeable(serializeRules(token[1]), mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging) && isMergeable(serializeRules(oldToken[1]), mergeablePseudoClasses, mergeablePseudoElements, multiplePseudoMerging)) { if (token[2].length > 0) { token[1] = tidyRules(oldToken[1].concat(token[1]), false, adjacentSpace, false, context.warnings); token[1] = token[1].length > 1 ? sortSelectors(token[1], selectorsSortingMethod) : token[1]; } else { token[1] = oldToken[1].concat(token[1]); } oldToken[2] = []; candidates[candidateBody] = null; } candidates[serializeBody(token[2])] = token; } } module.exports = mergeNonAdjacentByBody;
{ "pile_set_name": "Github" }
/* * QNX6 file system, Linux implementation. * * Version : 1.0.0 * * History : * * 01-02-2012 by Kai Bankett ([email protected]) : first release. * 16-02-2012 page map extension by Al Viro * */ #include <linux/fs.h> #include <linux/pagemap.h> typedef __u16 __bitwise __fs16; typedef __u32 __bitwise __fs32; typedef __u64 __bitwise __fs64; #include <linux/qnx6_fs.h> #ifdef CONFIG_QNX6FS_DEBUG #define QNX6DEBUG(X) printk X #else #define QNX6DEBUG(X) (void) 0 #endif struct qnx6_sb_info { struct buffer_head *sb_buf; /* superblock buffer */ struct qnx6_super_block *sb; /* our superblock */ int s_blks_off; /* blkoffset fs-startpoint */ int s_ptrbits; /* indirect pointer bitfield */ unsigned long s_mount_opt; /* all mount options */ int s_bytesex; /* holds endianess info */ struct inode * inodes; struct inode * longfile; }; struct qnx6_inode_info { __fs32 di_block_ptr[QNX6_NO_DIRECT_POINTERS]; __u8 di_filelevels; __u32 i_dir_start_lookup; struct inode vfs_inode; }; extern struct inode *qnx6_iget(struct super_block *sb, unsigned ino); extern struct dentry *qnx6_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags); #ifdef CONFIG_QNX6FS_DEBUG extern void qnx6_superblock_debug(struct qnx6_super_block *, struct super_block *); #endif extern const struct inode_operations qnx6_dir_inode_operations; extern const struct file_operations qnx6_dir_operations; static inline struct qnx6_sb_info *QNX6_SB(struct super_block *sb) { return sb->s_fs_info; } static inline struct qnx6_inode_info *QNX6_I(struct inode *inode) { return container_of(inode, struct qnx6_inode_info, vfs_inode); } #define clear_opt(o, opt) (o &= ~(QNX6_MOUNT_##opt)) #define set_opt(o, opt) (o |= (QNX6_MOUNT_##opt)) #define test_opt(sb, opt) (QNX6_SB(sb)->s_mount_opt & \ QNX6_MOUNT_##opt) enum { BYTESEX_LE, BYTESEX_BE, }; static inline __u64 fs64_to_cpu(struct qnx6_sb_info *sbi, __fs64 n) { if (sbi->s_bytesex == BYTESEX_LE) return le64_to_cpu((__force __le64)n); else return be64_to_cpu((__force __be64)n); } static inline __fs64 cpu_to_fs64(struct qnx6_sb_info *sbi, __u64 n) { if (sbi->s_bytesex == BYTESEX_LE) return (__force __fs64)cpu_to_le64(n); else return (__force __fs64)cpu_to_be64(n); } static inline __u32 fs32_to_cpu(struct qnx6_sb_info *sbi, __fs32 n) { if (sbi->s_bytesex == BYTESEX_LE) return le32_to_cpu((__force __le32)n); else return be32_to_cpu((__force __be32)n); } static inline __fs32 cpu_to_fs32(struct qnx6_sb_info *sbi, __u32 n) { if (sbi->s_bytesex == BYTESEX_LE) return (__force __fs32)cpu_to_le32(n); else return (__force __fs32)cpu_to_be32(n); } static inline __u16 fs16_to_cpu(struct qnx6_sb_info *sbi, __fs16 n) { if (sbi->s_bytesex == BYTESEX_LE) return le16_to_cpu((__force __le16)n); else return be16_to_cpu((__force __be16)n); } static inline __fs16 cpu_to_fs16(struct qnx6_sb_info *sbi, __u16 n) { if (sbi->s_bytesex == BYTESEX_LE) return (__force __fs16)cpu_to_le16(n); else return (__force __fs16)cpu_to_be16(n); } extern struct qnx6_super_block *qnx6_mmi_fill_super(struct super_block *s, int silent); static inline void qnx6_put_page(struct page *page) { kunmap(page); page_cache_release(page); } extern unsigned qnx6_find_entry(int len, struct inode *dir, const char *name, struct page **res_page);
{ "pile_set_name": "Github" }
/*global ODSA */ // Written by Jun Yang and Cliff Shaffer // Linked list deletion $(document).ready(function() { "use strict"; var av_name = "llistRemoveCON"; // Load the config object with interpreter and code created by odsaUtils.js var config = ODSA.UTILS.loadConfig({av_name: av_name}), interpret = config.interpreter, // get the interpreter code = config.code; // get the code object var av = new JSAV(av_name); var pseudo = av.code(code[0]); // Relative offsets var leftMargin = 250; var topMargin = 35; var l = av.ds.list({nodegap: 30, center: false, left: leftMargin, top: topMargin}); l.addFirst("null").addFirst(10).addFirst(35).addFirst(8).addFirst(23).addFirst("null"); l.layout(); av.pointer("head", l.get(0)); av.pointer("curr", l.get(2)); av.pointer("tail", l.get(5)); l.get(2).addVLine(); // Dashline var dashline = av.g.polyline([[leftMargin + 186, topMargin + 32], [leftMargin + 125 + 74, topMargin + 32], [leftMargin + 199, topMargin + 3], [leftMargin + 276, topMargin + 3], [leftMargin + 276, topMargin + 32], [leftMargin + 297, topMargin + 32]], {"arrow-end": "classic-wide-long", opacity: 0, "stroke-width": 2, "stroke-dasharray": "-"}); // Create hidden array for holding the removed value var arr = av.ds.array([10], {indexed: false, left: leftMargin + 140, top: topMargin + 50}).hide(); var labelIt = av.label("it", {left: leftMargin + 125, top: topMargin + 54}); labelIt.hide(); // Slide 1 av.umsg(interpret("sc1")); pseudo.setCurrentLine("sig"); av.displayInit(); // Slide 2 av.umsg(interpret("sc2")); l.get(2).highlight(); l.layout({updateLeft: false}); // Do not change left position on update av.step(); // Slide 3 av.umsg(interpret("sc3")); arr.show(); av.effects.copyValue(l.get(2), arr, 0); labelIt.show(); l.get(2).unhighlight(); arr.highlight(0); pseudo.setCurrentLine("remember"); av.step(); // Slide 4 av.umsg(interpret("sc4")); av.effects.copyValue(l.get(3), l.get(2)); l.get(2).highlight(); arr.unhighlight(0); pseudo.setCurrentLine("setelem"); av.step(); // Slide 5 av.umsg(interpret("sc5")); l.get(2).edgeToNext().hide(); l.get(3).edgeToNext().hide(); dashline.show(); l.get(4).highlight(); pseudo.setCurrentLine("setnext"); av.step(); // Slide 6 av.umsg(interpret("sc6")); l.remove(3); dashline.hide(); l.layout(); l.get(2).edgeToNext().show(); l.get(2).unhighlight(); l.get(3).unhighlight(); pseudo.setCurrentLine("listSize"); av.step(); // Slide 7 av.umsg(interpret("sc7")); arr.highlight(); pseudo.setCurrentLine("return"); av.recorded(); });
{ "pile_set_name": "Github" }
div.sheet-tabs { margin-bottom: 2%; grid-template-columns: 1fr 10%; div.sheet-type, div.sheet-settings { padding: 2% 1%; } div.sheet-type { grid-template-columns: repeat(4, 1fr); } div.sheet-col { @extend %gridRowCol; } label { display: grid; } input { grid-column: 1; height: auto; opacity: 0; height: 100%; width: 80%; &:hover ~ span { transform: scale(1.1); } &:active ~ span { margin-top: 2px; margin-bottom: -2px; } &:checked ~ span { background-color: $primary; color: $white; } } span { border: 2px solid $primary; display: inline-block; grid-column: 1; min-height: 20px; width: 80%; padding-top: 1.5%; cursor: pointer; box-shadow: $box-shadow; border-radius: 5px; } div.sheet-settings { justify-self: end; align-self: center; label { max-width: 80px; justify-self: end; } span { margin: 2%; } } } input[name='attr_settings_toggle'][value='settings'] ~ div.sheet-tabs div.sheet-type { cursor: not-allowed; & label > span { cursor: not-allowed; opacity: 0.4; } }
{ "pile_set_name": "Github" }
// // WKDiscovery.m // WiimoteKit // // Created by Jean-Daniel Dupas on 12/01/08. // Copyright 2008 Shadow Lab. All rights reserved. // #import <WiimoteKit/WKDiscovery.h> #import "WKBase.h" #import <WiimoteKit/WKTypes.h> #import <IOBluetooth/objc/IOBluetoothDevice.h> #import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h> #import <IOBluetooth/objc/IOBluetoothSDPDataElement.h> #import <IOBluetooth/objc/IOBluetoothSDPServiceRecord.h> NSString * const WKDeviceRegistryWillSearchDevicesNotification = @"WKDeviceRegistryWillSearchDevices"; NSString * const WKDeviceRegistryDidSearchDevicesNotification = @"WKDeviceRegistryDidSearchDevices"; NSString * const WKDeviceRegistryErrorKey = @"WKDeviceRegistryErrorKey"; NSString * const WKDeviceRegistryDidFoundDeviceNotification = @"WKDeviceRegistryDidFoundDevice"; NSString * const WKDeviceRegistryFoundDeviceKey = @"WKDeviceRegistryFoundDeviceKey"; @implementation WKDeviceRegistry + (WKDeviceRegistry *)sharedRegistry { static WKDeviceRegistry *sShared = nil; if (!sShared) { sShared = [[WKDeviceRegistry alloc] init]; } return sShared; } - (id)init { if (self = [super init]) { wk_devices = [[NSMutableArray alloc] init]; [IOBluetoothDevice registerForConnectNotifications:self selector:@selector(bluetoothDidConnect:device:)]; } return self; } - (void)dealloc { [wk_inquiry setDelegate:nil]; [wk_inquiry release]; [wk_devices release]; [super dealloc]; } - (BOOL)isSearching { return wk_inquiry != nil; } - (IOReturn)search { if ([self isSearching]) return kIOReturnSuccess; if (!IOBluetoothLocalDeviceAvailable()) return kIOReturnNotAttached; wk_inquiry = [IOBluetoothDeviceInquiry inquiryWithDelegate:self]; [wk_inquiry setInquiryLength:20]; [wk_inquiry setSearchCriteria:kBluetoothServiceClassMajorAny majorDeviceClass:kBluetoothDeviceClassMajorPeripheral minorDeviceClass:kBluetoothDeviceClassMinorPeripheral2Joystick]; [wk_inquiry setUpdateNewDeviceNames:NO]; IOReturn status = [wk_inquiry start]; if (status == kIOReturnSuccess) { [wk_inquiry retain]; } else { NSLog(@"Error: Inquiry did not start, error %s", mach_error_string(status)); [wk_inquiry setDelegate:nil]; wk_inquiry = nil; } return status; } - (void)stop { [wk_inquiry stop]; } - (NSArray *)devices { return wk_devices; } - (void)addDevice:(IOBluetoothDevice *)device { if (![wk_devices containsObject:device]) { // test if this is a wiimote bool wiimote = false; if ([device getLastServicesUpdate]) { NSArray *services = [device getServices]; NSUInteger idx = 0; for (idx = 0; idx < [services count] && !wiimote; idx++) { IOBluetoothSDPServiceRecord *record = [services objectAtIndex:idx]; NSDictionary *attrs = [record getAttributes]; IOBluetoothSDPDataElement *vendor = [attrs objectForKey:[NSNumber numberWithLong:kBluetoothSDPAttributeDeviceIdentifierVendorID]]; IOBluetoothSDPDataElement *product = [attrs objectForKey:[NSNumber numberWithLong:kBluetoothSDPAttributeDeviceIdentifierProductID]]; if (vendor && product) { wiimote = [vendor containsValue:[NSNumber numberWithLong:0x057e]] && [product containsValue:[NSNumber numberWithLong:0x0306]]; } } } else { NSLog(@"require data to identify device"); /* initiate a name request and wait async reply. */ [device performSDPQuery:self]; return; } if (wiimote) { [wk_devices addObject:device]; [[NSNotificationCenter defaultCenter] postNotificationName:WKDeviceRegistryDidFoundDeviceNotification object:self userInfo:[NSDictionary dictionaryWithObject:device forKey:WKDeviceRegistryFoundDeviceKey]]; } else { NSLog(@"Find a device but does not look like it is a wiimote: %@", device); } } } #pragma mark - - (void)deviceInquiryStarted:(IOBluetoothDeviceInquiry*)sender { [[NSNotificationCenter defaultCenter] postNotificationName:WKDeviceRegistryWillSearchDevicesNotification object:self]; } - (void)deviceInquiryDeviceFound:(IOBluetoothDeviceInquiry*)sender device:(IOBluetoothDevice *)device { [self addDevice:device]; } - (void)deviceInquiryComplete:(IOBluetoothDeviceInquiry*)sender error:(IOReturn)error aborted:(BOOL)aborted { [[NSNotificationCenter defaultCenter] postNotificationName:WKDeviceRegistryDidSearchDevicesNotification object:self userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:error] forKey:WKDeviceRegistryErrorKey]]; [wk_inquiry setDelegate:nil]; [wk_inquiry release]; wk_inquiry = nil; } #pragma mark - - (void)remoteNameRequestComplete:(IOBluetoothDevice *)device status:(IOReturn)status { if (kIOReturnSuccess == status) { [self addDevice:device]; } else { NSLog(@"name query fail (%d) for device: %@", status, device); } } - (void)bluetoothDidConnect:(IOBluetoothUserNotification *)aNotification device:(IOBluetoothDevice *)device { [self addDevice:device]; } @end
{ "pile_set_name": "Github" }
// Copyright (c) 2018 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. // // WSO2 Inc. licenses this file to you under the Apache License, // Version 2.0 (the "License"); you may not use this file except // in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. import ballerina/java; #Represents a channel, which could be used to read characters through a given ReadableByteChannel. public class ReadableCharacterChannel { private ReadableByteChannel byteChannel; private string charset; # Constructs a `ReadableCharacterChannel` from a given `ReadableByteChannel` and `Charset`. # # + byteChannel - The `ReadableByteChannel`, which would be used to read the characters # + charset - The character set, which would be used to encode/decode the given bytes to characters public function init(ReadableByteChannel byteChannel, string charset) { self.byteChannel = byteChannel; self.charset = charset; initReadableCharacterChannel(self, byteChannel, charset); } # Reads a given number of characters. This will attempt to read up to the `numberOfChars` characters of the channel. # An `io:EofError` will return once the channel reaches the end. # ```ballerina # string|io:Error result = readableCharChannel.read(1000); # ``` # # + numberOfChars - Number of characters, which should be read # + return - Content, which is read, an `EofError` once the channel reaches the end or else an `io:Error` public function read(@untainted int numberOfChars) returns @tainted string|Error { return readExtern(self, numberOfChars); } # Reads a JSON from the given channel. # ```ballerina # json|io:Error result = readableCharChannel.readJson(); # ``` # # + return - The read JSON string or else an `io:Error` public function readJson() returns @tainted json|Error { return readJsonExtern(self); } # Reads an XML from the given channel. # ```ballerina # json|io:Error result = readableCharChannel.readXml(); # ``` # # + return - The read XML or else an `io:Error` public function readXml() returns @tainted xml|Error { return readXmlExtern(self); } # Reads a property from a .properties file with a default value. # ```ballerina # string|io:Error result = readableCharChannel.readProperty(key, defaultValue); # ``` # + key - The property key needs to read. # + defaultValue - Default value to be return. # + return - The read property value or else an `io:Error` public function readProperty(string key, string defaultValue="") returns @tainted string|Error { return readPropertyExtern(self, key, defaultValue); } # Reads all properties from a .properties file. # ```ballerina # map<string>|io:Error result = readableCharChannel.readAllProperties(); # ``` # # + return - A map that contains all properties public function readAllProperties() returns @tainted map<string>|Error { return readAllPropertiesExtern(self); } # Closes a given character channel. # ```ballerina # io:Error? err = readableCharChannel.close(); # ``` # # + return - If an error occurred while writing public function close() returns Error? { return closeReadableCharacterChannel(self); } } function initReadableCharacterChannel(ReadableCharacterChannel characterChannel, ReadableByteChannel byteChannel, string charset) = @java:Method { name: "initCharacterChannel", 'class: "org.ballerinalang.stdlib.io.nativeimpl.CharacterChannelUtils" } external; function readExtern(ReadableCharacterChannel characterChannel, @untainted int numberOfChars) returns @tainted string|Error = @java:Method { name: "read", 'class: "org.ballerinalang.stdlib.io.nativeimpl.CharacterChannelUtils" } external; function readJsonExtern(ReadableCharacterChannel characterChannel) returns @tainted json|Error = @java:Method { name: "readJson", 'class: "org.ballerinalang.stdlib.io.nativeimpl.CharacterChannelUtils" } external; function readXmlExtern(ReadableCharacterChannel characterChannel) returns @tainted xml|Error = @java:Method { name: "readXml", 'class: "org.ballerinalang.stdlib.io.nativeimpl.CharacterChannelUtils" } external; function readPropertyExtern(ReadableCharacterChannel characterChannel, string key, string defaultValue) returns @tainted string|Error = @java:Method { name: "readProperty", 'class: "org.ballerinalang.stdlib.io.nativeimpl.CharacterChannelUtils" } external; function readAllPropertiesExtern(ReadableCharacterChannel characterChannel) returns @tainted map<string>|Error = @java:Method { name: "readAllProperties", 'class: "org.ballerinalang.stdlib.io.nativeimpl.CharacterChannelUtils" } external; function closeReadableCharacterChannel(ReadableCharacterChannel characterChannel) returns Error? = @java:Method { name: "close", 'class: "org.ballerinalang.stdlib.io.nativeimpl.CharacterChannelUtils" } external;
{ "pile_set_name": "Github" }
// Copyright (c) 2017 Marshall A. Greenblatt. 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 name Chromium Embedded // Framework 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. // // --------------------------------------------------------------------------- // // This file was generated by the CEF translator tool and should not edited // by hand. See the translator.README.txt file in the tools directory for // more information. // #ifndef CEF_INCLUDE_CAPI_CEF_ORIGIN_WHITELIST_CAPI_H_ #define CEF_INCLUDE_CAPI_CEF_ORIGIN_WHITELIST_CAPI_H_ #pragma once #include "include/capi/cef_base_capi.h" #ifdef __cplusplus extern "C" { #endif /// // Add an entry to the cross-origin access whitelist. // // The same-origin policy restricts how scripts hosted from different origins // (scheme + domain + port) can communicate. By default, scripts can only access // resources with the same origin. Scripts hosted on the HTTP and HTTPS schemes // (but no other schemes) can use the "Access-Control-Allow-Origin" header to // allow cross-origin requests. For example, https://source.example.com can make // XMLHttpRequest requests on http://target.example.com if the // http://target.example.com request returns an "Access-Control-Allow-Origin: // https://source.example.com" response header. // // Scripts in separate frames or iframes and hosted from the same protocol and // domain suffix can execute cross-origin JavaScript if both pages set the // document.domain value to the same domain suffix. For example, // scheme://foo.example.com and scheme://bar.example.com can communicate using // JavaScript if both domains set document.domain="example.com". // // This function is used to allow access to origins that would otherwise violate // the same-origin policy. Scripts hosted underneath the fully qualified // |source_origin| URL (like http://www.example.com) will be allowed access to // all resources hosted on the specified |target_protocol| and |target_domain|. // If |target_domain| is non-NULL and |allow_target_subdomains| if false (0) // only exact domain matches will be allowed. If |target_domain| contains a top- // level domain component (like "example.com") and |allow_target_subdomains| is // true (1) sub-domain matches will be allowed. If |target_domain| is NULL and // |allow_target_subdomains| if true (1) all domains and IP addresses will be // allowed. // // This function cannot be used to bypass the restrictions on local or display // isolated schemes. See the comments on CefRegisterCustomScheme for more // information. // // This function may be called on any thread. Returns false (0) if // |source_origin| is invalid or the whitelist cannot be accessed. /// CEF_EXPORT int cef_add_cross_origin_whitelist_entry( const cef_string_t* source_origin, const cef_string_t* target_protocol, const cef_string_t* target_domain, int allow_target_subdomains); /// // Remove an entry from the cross-origin access whitelist. Returns false (0) if // |source_origin| is invalid or the whitelist cannot be accessed. /// CEF_EXPORT int cef_remove_cross_origin_whitelist_entry( const cef_string_t* source_origin, const cef_string_t* target_protocol, const cef_string_t* target_domain, int allow_target_subdomains); /// // Remove all entries from the cross-origin access whitelist. Returns false (0) // if the whitelist cannot be accessed. /// CEF_EXPORT int cef_clear_cross_origin_whitelist(); #ifdef __cplusplus } #endif #endif // CEF_INCLUDE_CAPI_CEF_ORIGIN_WHITELIST_CAPI_H_
{ "pile_set_name": "Github" }
// Generated by grunt-webfont // Based on https://github.com/endtwist/fontcustom/blob/master/lib/fontcustom/templates/fontcustom.css @font-face { font-family:"summernote"; src:url("./font/summernote.eot?dbafe969167589eda84514394d126413"); src:url("./font/summernote.eot?#iefix") format("embedded-opentype"), url("./font/summernote.woff?dbafe969167589eda84514394d126413") format("woff"), url("./font/summernote.ttf?dbafe969167589eda84514394d126413") format("truetype"); font-weight:normal; font-style:normal; } // Bootstrap Overrides [class^="note-icon-"]:before, [class*=" note-icon-"]:before { display:inline-block; vertical-align:middle; font: normal normal normal 14px summernote; font-size: inherit; speak:none; text-decoration:inherit; text-transform:none; text-rendering:auto; -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; } // Mixins .note-icon-align-center, .note-icon-align-indent, .note-icon-align-justify, .note-icon-align-left, .note-icon-align-outdent, .note-icon-align-right, .note-icon-align, .note-icon-arrow-circle-down, .note-icon-arrow-circle-left, .note-icon-arrow-circle-right, .note-icon-arrow-circle-up, .note-icon-arrows-alt, .note-icon-arrows-h, .note-icon-arrows-v, .note-icon-bold, .note-icon-caret, .note-icon-chain-broken, .note-icon-circle, .note-icon-close, .note-icon-code, .note-icon-col-after, .note-icon-col-before, .note-icon-col-remove, .note-icon-eraser, .note-icon-font, .note-icon-frame, .note-icon-italic, .note-icon-link, .note-icon-magic, .note-icon-menu-check, .note-icon-minus, .note-icon-orderedlist, .note-icon-pencil, .note-icon-picture, .note-icon-question, .note-icon-redo, .note-icon-row-above, .note-icon-row-below, .note-icon-row-remove, .note-icon-special-character, .note-icon-square, .note-icon-strikethrough, .note-icon-subscript, .note-icon-summernote, .note-icon-superscript, .note-icon-table, .note-icon-text-height, .note-icon-trash, .note-icon-underline, .note-icon-undo, .note-icon-unorderedlist, .note-icon-video { &:before { font-family:"summernote"; display:inline-block; font-weight:normal; font-style:normal; text-decoration:inherit; } } // Icons .note-icon-align-center { &:before { content:"\f101"; } } .note-icon-align-indent { &:before { content:"\f102"; } } .note-icon-align-justify { &:before { content:"\f103"; } } .note-icon-align-left { &:before { content:"\f104"; } } .note-icon-align-outdent { &:before { content:"\f105"; } } .note-icon-align-right { &:before { content:"\f106"; } } .note-icon-align { &:before { content:"\f107"; } } .note-icon-arrow-circle-down { &:before { content:"\f108"; } } .note-icon-arrow-circle-left { &:before { content:"\f109"; } } .note-icon-arrow-circle-right { &:before { content:"\f10a"; } } .note-icon-arrow-circle-up { &:before { content:"\f10b"; } } .note-icon-arrows-alt { &:before { content:"\f10c"; } } .note-icon-arrows-h { &:before { content:"\f10d"; } } .note-icon-arrows-v { &:before { content:"\f10e"; } } .note-icon-bold { &:before { content:"\f10f"; } } .note-icon-caret { &:before { content:"\f110"; } } .note-icon-chain-broken { &:before { content:"\f111"; } } .note-icon-circle { &:before { content:"\f112"; } } .note-icon-close { &:before { content:"\f113"; } } .note-icon-code { &:before { content:"\f114"; } } .note-icon-col-after { &:before { content:"\f115"; } } .note-icon-col-before { &:before { content:"\f116"; } } .note-icon-col-remove { &:before { content:"\f117"; } } .note-icon-eraser { &:before { content:"\f118"; } } .note-icon-font { &:before { content:"\f119"; } } .note-icon-frame { &:before { content:"\f11a"; } } .note-icon-italic { &:before { content:"\f11b"; } } .note-icon-link { &:before { content:"\f11c"; } } .note-icon-magic { &:before { content:"\f11d"; } } .note-icon-menu-check { &:before { content:"\f11e"; } } .note-icon-minus { &:before { content:"\f11f"; } } .note-icon-orderedlist { &:before { content:"\f120"; } } .note-icon-pencil { &:before { content:"\f121"; } } .note-icon-picture { &:before { content:"\f122"; } } .note-icon-question { &:before { content:"\f123"; } } .note-icon-redo { &:before { content:"\f124"; } } .note-icon-row-above { &:before { content:"\f125"; } } .note-icon-row-below { &:before { content:"\f126"; } } .note-icon-row-remove { &:before { content:"\f127"; } } .note-icon-special-character { &:before { content:"\f128"; } } .note-icon-square { &:before { content:"\f129"; } } .note-icon-strikethrough { &:before { content:"\f12a"; } } .note-icon-subscript { &:before { content:"\f12b"; } } .note-icon-summernote { &:before { content:"\f12c"; } } .note-icon-superscript { &:before { content:"\f12d"; } } .note-icon-table { &:before { content:"\f12e"; } } .note-icon-text-height { &:before { content:"\f12f"; } } .note-icon-trash { &:before { content:"\f130"; } } .note-icon-underline { &:before { content:"\f131"; } } .note-icon-undo { &:before { content:"\f132"; } } .note-icon-unorderedlist { &:before { content:"\f133"; } } .note-icon-video { &:before { content:"\f134"; } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.awt.peer; import java.awt.Choice; /** * The peer interface for {@link Choice}. * * The peer interfaces are intended only for use in porting * the AWT. They are not intended for use by application * developers, and developers should not implement peers * nor invoke any of the peer methods directly on the peer * instances. */ public interface ChoicePeer extends ComponentPeer { /** * Adds an item with the string {@code item} to the combo box list * at index {@code index}. * * @param item the label to be added to the list * @param index the index where to add the item * * @see Choice#add(String) */ void add(String item, int index); /** * Removes the item at index {@code index} from the combo box list. * * @param index the index where to remove the item * * @see Choice#remove(int) */ void remove(int index); /** * Removes all items from the combo box list. * * @see Choice#removeAll() */ void removeAll(); /** * Selects the item at index {@code index}. * * @param index the index which should be selected * * @see Choice#select(int) */ void select(int index); }
{ "pile_set_name": "Github" }
package rpc import ( "bytes" "encoding/binary" "encoding/json" "fmt" "github.com/golang/glog" "github.com/oikomi/FishChatServer2/common/ecode" commmodel "github.com/oikomi/FishChatServer2/common/model" "github.com/oikomi/FishChatServer2/protocol/rpc" "github.com/oikomi/FishChatServer2/server/manager/conf" "github.com/oikomi/FishChatServer2/server/manager/dao" "github.com/oikomi/FishChatServer2/server/manager/model" sd "github.com/oikomi/FishChatServer2/service_discovery/etcd" "golang.org/x/net/context" "google.golang.org/grpc" "net" ) type RPCServer struct { dao *dao.Dao } // func (s *RPCServer) GetOfflineMsgs(ctx context.Context, in *rpc.MGOfflineMsgReq) (res *rpc.MGOfflineMsgRes, err error) { // glog.Info("GetOfflineMsgs") // tmpRes, err := s.dao.MongoDB.GetOfflineMsg(in.Uid) // if err != nil { // glog.Error(err) // res = &rpc.MGOfflineMsgRes{ // ErrCode: ecode.ServerErr.Uint32(), // ErrStr: ecode.ServerErr.String(), // } // return // } // resMsgs := make([]*rpc.OfflineMsg, 0) // for _, msg := range tmpRes { // resMsg := &rpc.OfflineMsg{ // SourceUID: msg.SourceUID, // TargetUID: msg.TargetUID, // MsgID: msg.MsgID, // Msg: msg.Msg, // } // resMsgs = append(resMsgs, resMsg) // } // res = &rpc.MGOfflineMsgRes{ // ErrCode: ecode.OK.Uint32(), // ErrStr: ecode.OK.String(), // Msgs: resMsgs, // } // return // } func (s *RPCServer) ExceptionMsg(ctx context.Context, in *rpc.MGExceptionMsgReq) (res *rpc.MGExceptionMsgRes, err error) { glog.Info("ExceptionMsg") return } func (s *RPCServer) SetExceptionMsg(ctx context.Context, in *rpc.MGExceptionMsgReq) (res *rpc.MGExceptionMsgRes, err error) { glog.Info("SetExceptionMsg") exceptionMsg := &commmodel.ExceptionMsg{ SourceUID: in.SourceUID, TargetUID: in.TargetUID, MsgID: in.MsgID, Msg: in.Msg, } data, err := json.Marshal(exceptionMsg) if err != nil { glog.Error(err) res = &rpc.MGExceptionMsgRes{ ErrCode: ecode.ServerErr.Uint32(), ErrStr: ecode.ServerErr.String(), } return } if err = s.dao.Redis.SetExceptionMsg(ctx, in.MsgID, string(data)); err != nil { glog.Error(err) res = &rpc.MGExceptionMsgRes{ ErrCode: ecode.ServerErr.Uint32(), ErrStr: ecode.ServerErr.String(), } return } res = &rpc.MGExceptionMsgRes{ ErrCode: ecode.OK.Uint32(), ErrStr: ecode.OK.String(), } return } func (s *RPCServer) Sync(ctx context.Context, in *rpc.MGSyncMsgReq) (res *rpc.MGSyncMsgRes, err error) { glog.Info("Sync") offsetMsgs := make([]*rpc.MGSyncMsgResOffsetMsg, 0) _, err = s.dao.Mysql.UpdateUserMsgID(ctx, in.UID, in.CurrentID) if err != nil { glog.Error(err) res = &rpc.MGSyncMsgRes{ ErrCode: ecode.ServerErr.Uint32(), ErrStr: ecode.ServerErr.String(), } return } userMsgID, err := s.dao.Mysql.GetUserMsgID(ctx, in.UID) if err != nil { glog.Error(err) res = &rpc.MGSyncMsgRes{ ErrCode: ecode.ServerErr.Uint32(), ErrStr: ecode.ServerErr.String(), } return } if userMsgID.CurrentMsgID == userMsgID.TotalMsgID { res = &rpc.MGSyncMsgRes{ ErrCode: ecode.OK.Uint32(), ErrStr: ecode.OK.String(), CurrentID: userMsgID.TotalMsgID, Msgs: offsetMsgs, } return } for i := userMsgID.CurrentMsgID; i <= userMsgID.TotalMsgID; i++ { hRes, err := s.dao.HBase.GetMsgs(ctx, fmt.Sprintf("%d_%d", in.UID, i)) if err != nil { glog.Error(err) } offsetMsg := &rpc.MGSyncMsgResOffsetMsg{} for _, c := range hRes.Cells { if c != nil { if bytes.Equal(c.Family, model.HbaseFamilyUser) { if bytes.Equal(c.Qualifier, model.HbaseColumnSourceUID) { offsetMsg.SourceUID = int64(binary.BigEndian.Uint64(c.Value)) } else if bytes.Equal(c.Qualifier, model.HbaseColumnTargetUID) { offsetMsg.TargetUID = int64(binary.BigEndian.Uint64(c.Value)) } else if bytes.Equal(c.Qualifier, model.HbaseColumnGroupID) { offsetMsg.GroupID = int64(binary.BigEndian.Uint64(c.Value)) } } else if bytes.Equal(c.Family, model.HbaseFamilyMsg) { if bytes.Equal(c.Qualifier, model.HbaseColumnMsgType) { offsetMsg.MsgType = string(c.Value) } else if bytes.Equal(c.Qualifier, model.HbaseColumnMsgID) { offsetMsg.MsgID = string(c.Value) } else if bytes.Equal(c.Qualifier, model.HbaseColumnMsg) { offsetMsg.Msg = string(c.Value) } } } } offsetMsgs = append(offsetMsgs, offsetMsg) } // for _, o := range offsetMsgs { // glog.Info(o) // } res = &rpc.MGSyncMsgRes{ ErrCode: ecode.OK.Uint32(), ErrStr: ecode.OK.String(), CurrentID: userMsgID.TotalMsgID, Msgs: offsetMsgs, } return } func RPCServerInit() { glog.Info("[manager] rpc server init: ", conf.Conf.RPCServer.Addr) lis, err := net.Listen(conf.Conf.RPCServer.Proto, conf.Conf.RPCServer.Addr) if err != nil { glog.Error(err) panic(err) } err = sd.Register(conf.Conf.ServiceDiscoveryServer.ServiceName, conf.Conf.ServiceDiscoveryServer.RPCAddr, conf.Conf.ServiceDiscoveryServer.EtcdAddr, conf.Conf.ServiceDiscoveryServer.Interval, conf.Conf.ServiceDiscoveryServer.TTL) if err != nil { glog.Error(err) panic(err) } s := grpc.NewServer() rpcServer := &RPCServer{ dao: dao.NewDao(), } rpc.RegisterManagerServerRPCServer(s, rpcServer) s.Serve(lis) }
{ "pile_set_name": "Github" }
include/master-slave.inc Warnings: Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. [connection master] [connection slave] SET GLOBAL DEBUG="+d,dbug_set_high_prio_sql_thread"; include/stop_slave_sql.inc include/start_slave_sql.inc [connection master] CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (0); include/rpl_connect.inc [creating sigcon] [connection sigcon] include/sync_slave_sql_with_master.inc SET DEBUG_SYNC='ha_innobase_end_statement WAIT_FOR waiting1'; BEGIN; UPDATE t1 SET c1=99 WHERE c1=0; [connection slave] [connection master] UPDATE t1 SET c1=1 WHERE c1=0; [connection slave] SET DEBUG_SYNC='now SIGNAL waiting1'; [connection sigcon] [connection sigcon] COMMIT; ERROR HY000: Got error 149 - 'Lock deadlock; Retry transaction' during COMMIT include/sync_slave_sql_with_master.inc include/assert.inc ['There is a 1 in t1'] include/assert.inc ['There is no 0 in t1'] include/assert.inc ['There is no 99 in t1'] DROP TABLE t1; include/sync_slave_sql_with_master.inc include/stop_slave_sql.inc SET GLOBAL DEBUG="-d,dbug_set_high_prio_sql_thread"; include/start_slave_sql.inc include/rpl_end.inc
{ "pile_set_name": "Github" }
class ManagingUser < User has_one :team, class_name: 'ManagedTeam', foreign_key: :manager, primary_key: :email, inverse_of: :user has_many :teams, class_name: 'ManagedTeam', foreign_key: :manager, primary_key: :email, inverse_of: :user def team_id=(id) self.team = ManagedTeam.find_by_id(id) end end
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{83479215-9D94-49E9-8492-05B2D2A589F4}</ProjectGuid> <OutputType>Exe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>CreateProcessWithDllTest</RootNamespace> <AssemblyName>CreateProcessWithDllTest</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <NoWin32Manifest>true</NoWin32Manifest> <PublishUrl>publish\</PublishUrl> <Install>true</Install> <InstallFrom>Disk</InstallFrom> <UpdateEnabled>false</UpdateEnabled> <UpdateMode>Foreground</UpdateMode> <UpdateInterval>7</UpdateInterval> <UpdateIntervalUnits>Days</UpdateIntervalUnits> <UpdatePeriodically>false</UpdatePeriodically> <UpdateRequired>false</UpdateRequired> <MapFileExtensions>true</MapFileExtensions> <ApplicationRevision>0</ApplicationRevision> <ApplicationVersion>1.0.0.%2a</ApplicationVersion> <IsWebBootstrapper>false</IsWebBootstrapper> <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> <FileUpgradeFlags> </FileUpgradeFlags> <UpgradeBackupLocation> </UpgradeBackupLocation> <OldToolsVersion>3.5</OldToolsVersion> <TargetFrameworkProfile /> <BaseIntermediateOutputPath>..\..\..\obj\2017\CSharpCreateProcessWithDllTest\$(Configuration)\$(Platform)</BaseIntermediateOutputPath> <IntermediateOutputPath>$(BaseIntermediateOutputPath)\</IntermediateOutputPath> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <DebugSymbols>true</DebugSymbols> <OutputPath>..\..\..\bin\2017\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <DebugType>full</DebugType> <PlatformTarget>x86</PlatformTarget> <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> <ErrorReport>prompt</ErrorReport> <UseVSHostingProcess>false</UseVSHostingProcess> <Prefer32Bit>false</Prefer32Bit> <BaseIntermediateOutputPath>..\..\..\obj\2017\CSharpCreateProcessWithDllTest\$(Configuration)\$(Platform)</BaseIntermediateOutputPath> <IntermediateOutputPath>$(BaseIntermediateOutputPath)\</IntermediateOutputPath> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <OutputPath>..\..\..\bin\2017\</OutputPath> <DefineConstants>TRACE</DefineConstants> <Optimize>true</Optimize> <DebugType>pdbonly</DebugType> <PlatformTarget>x86</PlatformTarget> <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> <ErrorReport>prompt</ErrorReport> <UseVSHostingProcess>false</UseVSHostingProcess> <Prefer32Bit>false</Prefer32Bit> <BaseIntermediateOutputPath>..\..\..\obj\2017\CSharpCreateProcessWithDllTest\$(Configuration)\$(Platform)</BaseIntermediateOutputPath> <IntermediateOutputPath>$(BaseIntermediateOutputPath)\</IntermediateOutputPath> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> <DebugSymbols>true</DebugSymbols> <OutputPath>..\..\..\bin64\2017\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <DebugType>full</DebugType> <PlatformTarget>x64</PlatformTarget> <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> <UseVSHostingProcess>false</UseVSHostingProcess> <ErrorReport>prompt</ErrorReport> <Prefer32Bit>false</Prefer32Bit> <BaseIntermediateOutputPath>..\..\..\obj\2017\CSharpCreateProcessWithDllTest\$(Configuration)\$(Platform)</BaseIntermediateOutputPath> <IntermediateOutputPath>$(BaseIntermediateOutputPath)\</IntermediateOutputPath> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> <OutputPath>..\..\..\bin64\2017\</OutputPath> <DefineConstants>TRACE</DefineConstants> <Optimize>true</Optimize> <DebugType>pdbonly</DebugType> <PlatformTarget>x64</PlatformTarget> <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> <UseVSHostingProcess>false</UseVSHostingProcess> <ErrorReport>prompt</ErrorReport> <Prefer32Bit>false</Prefer32Bit> <BaseIntermediateOutputPath>..\..\..\obj\2017\CSharpCreateProcessWithDllTest\$(Configuration)\$(Platform)</BaseIntermediateOutputPath> <IntermediateOutputPath>$(BaseIntermediateOutputPath)\</IntermediateOutputPath> </PropertyGroup> <ItemGroup> <Reference Include="DeviareLiteInterop"> <HintPath>..\..\..\bin\2017\DeviareLiteInterop.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Windows.Forms" /> </ItemGroup> <ItemGroup> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> <Visible>False</Visible> <ProductName>.NET Framework Client Profile</ProductName> <Install>false</Install> </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Net.Framework.2.0"> <Visible>False</Visible> <ProductName>.NET Framework 2.0 %28x86%29</ProductName> <Install>false</Install> </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Net.Framework.3.0"> <Visible>False</Visible> <ProductName>.NET Framework 3.0 %28x86%29</ProductName> <Install>false</Install> </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Net.Framework.3.5"> <Visible>False</Visible> <ProductName>.NET Framework 3.5</ProductName> <Install>false</Install> </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> <Visible>False</Visible> <ProductName>.NET Framework 3.5 SP1</ProductName> <Install>true</Install> </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> <Visible>False</Visible> <ProductName>Windows Installer 3.1</ProductName> <Install>true</Install> </BootstrapperPackage> </ItemGroup> <ItemGroup> <None Include="app.config" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> <PropertyGroup> <PostBuildEvent>IF "$(PlatformName)" == "x86" ( COPY /Y "$(ProjectDir)Manifests\CreateProcessWithDllTest.embed.manifest" "$(TargetDir)\CreateProcessWithDllTest.exe.manifest" ) IF "$(PlatformName)" == "x64" ( COPY /Y "$(TargetDir)..\..\bin\2017\TestDll.dll" "$(TargetDir)" COPY /Y "$(ProjectDir)Manifests\CreateProcessWithDllTest64.embed.manifest" "$(TargetDir)\CreateProcessWithDllTest.exe.manifest" )</PostBuildEvent> </PropertyGroup> </Project>
{ "pile_set_name": "Github" }
{ "jsonSchemaSemanticVersion": "1.0.0", "imports": [ { "corpusPath": "cdm:/foundations.cdm.json" }, { "corpusPath": "/core/operationsCommon/Common.cdm.json", "moniker": "base_Common" }, { "corpusPath": "/core/operationsCommon/DataEntityView.cdm.json", "moniker": "base_DataEntityView" }, { "corpusPath": "/core/operationsCommon/Tables/SupplyChain/SalesAndMarketing/Group/SalesPackageAppearance.cdm.json" }, { "corpusPath": "/core/operationsCommon/Tables/SupplyChain/Inventory/TransactionHeader/WMSBillOfLading.cdm.json" }, { "corpusPath": "/core/operationsCommon/Tables/Finance/Ledger/Main/CompanyInfo.cdm.json" } ], "definitions": [ { "entityName": "WMSBillOfLadingCarrier", "extendsEntity": "base_Common/Common", "exhibitsTraits": [ { "traitReference": "is.CDM.entityVersion", "arguments": [ { "name": "versionNumber", "value": "1.1" } ] } ], "hasAttributes": [ { "name": "additionalInfo", "dataType": "WMSBOLAdditionalInfo", "isNullable": true, "displayName": "Describe items", "description": "" }, { "name": "billOfLadingId", "dataType": "WMSBillOfLadingId", "description": "" }, { "name": "handlingPackageType", "dataType": "integer", "isNullable": true, "displayName": "Handling unit", "description": "" }, { "name": "handlingQty", "dataType": "InventQty", "isNullable": true, "displayName": "Handling quantity", "description": "" }, { "name": "hazardousMaterial", "dataType": "WMSHazardousMaterial", "isNullable": true, "description": "" }, { "name": "packageAppearance", "dataType": "WMSPackageAppearance", "isNullable": true, "description": "" }, { "name": "packagePackageType", "dataType": "integer", "isNullable": true, "displayName": "Package unit", "description": "" }, { "name": "packageQty", "dataType": "InventQty", "isNullable": true, "displayName": "Package quantity", "description": "" }, { "name": "pdsCWHandlingQty", "dataType": "PdsCWInventQty", "isNullable": true, "displayName": "Handling CW quantity", "description": "" }, { "name": "pdsCWPackageQty", "dataType": "PdsCWInventQty", "isNullable": true, "displayName": "Package CW quantity", "description": "" }, { "name": "weight", "dataType": "Weight", "isNullable": true, "description": "" }, { "name": "DataAreaId", "dataType": "string", "isReadOnly": true }, { "entity": { "entityReference": "SalesPackageAppearance" }, "name": "Relationship_SalesPackageAppearanceRelationship", "resolutionGuidance": { "entityByReference": { "allowReference": true } } }, { "entity": { "entityReference": "WMSBillOfLading" }, "name": "Relationship_WMSBillOfLadingRelationship", "resolutionGuidance": { "entityByReference": { "allowReference": true } } }, { "entity": { "entityReference": "CompanyInfo" }, "name": "Relationship_CompanyRelationship", "resolutionGuidance": { "entityByReference": { "allowReference": true } } } ], "displayName": "Bill of lading items" }, { "dataTypeName": "WMSBOLAdditionalInfo", "extendsDataType": "string" }, { "dataTypeName": "WMSBillOfLadingId", "extendsDataType": "string" }, { "dataTypeName": "InventQty", "extendsDataType": "decimal" }, { "dataTypeName": "WMSHazardousMaterial", "extendsDataType": "integer" }, { "dataTypeName": "WMSPackageAppearance", "extendsDataType": "string" }, { "dataTypeName": "PdsCWInventQty", "extendsDataType": "decimal" }, { "dataTypeName": "Weight", "extendsDataType": "decimal" } ] }
{ "pile_set_name": "Github" }
using System.Collections.Generic; using System.Linq; namespace Ink.Parsed { public class Divert : Parsed.Object { public Parsed.Path target { get; protected set; } public Parsed.Object targetContent { get; protected set; } public List<Expression> arguments { get; protected set; } public Runtime.Divert runtimeDivert { get; protected set; } public bool isFunctionCall { get; set; } public bool isEmpty { get; set; } public bool isTunnel { get; set; } public bool isThread { get; set; } public bool isEnd { get { return target != null && target.dotSeparatedComponents == "END"; } } public bool isDone { get { return target != null && target.dotSeparatedComponents == "DONE"; } } public Divert (Parsed.Path target, List<Expression> arguments = null) { this.target = target; this.arguments = arguments; if (arguments != null) { AddContent (arguments.Cast<Parsed.Object> ().ToList ()); } } public Divert (Parsed.Object targetContent) { this.targetContent = targetContent; } public override Runtime.Object GenerateRuntimeObject () { // End = end flow immediately // Done = return from thread or instruct the flow that it's safe to exit if (isEnd) { return Runtime.ControlCommand.End (); } if (isDone) { return Runtime.ControlCommand.Done (); } runtimeDivert = new Runtime.Divert (); // Normally we resolve the target content during the // Resolve phase, since we expect all runtime objects to // be available in order to find the final runtime path for // the destination. However, we need to resolve the target // (albeit without the runtime target) early so that // we can get information about the arguments - whether // they're by reference - since it affects the code we // generate here. ResolveTargetContent (); CheckArgumentValidity (); // Passing arguments to the knot bool requiresArgCodeGen = arguments != null && arguments.Count > 0; if ( requiresArgCodeGen || isFunctionCall || isTunnel || isThread ) { var container = new Runtime.Container (); // Generate code for argument evaluation // This argument generation is coded defensively - it should // attempt to generate the code for all the parameters, even if // they don't match the expected arguments. This is so that the // parameter objects themselves are generated correctly and don't // get into a state of attempting to resolve references etc // without being generated. if (requiresArgCodeGen) { // Function calls already in an evaluation context if (!isFunctionCall) { container.AddContent (Runtime.ControlCommand.EvalStart()); } List<FlowBase.Argument> targetArguments = null; if( targetContent ) targetArguments = (targetContent as FlowBase).arguments; for (var i = 0; i < arguments.Count; ++i) { Expression argToPass = arguments [i]; FlowBase.Argument argExpected = null; if( targetArguments != null && i < targetArguments.Count ) argExpected = targetArguments [i]; // Pass by reference: argument needs to be a variable reference if (argExpected != null && argExpected.isByReference) { var varRef = argToPass as VariableReference; if (varRef == null) { Error ("Expected variable name to pass by reference to 'ref " + argExpected.name + "' but saw " + argToPass.ToString ()); break; } // Check that we're not attempting to pass a read count by reference var targetPath = new Path(varRef.path); Parsed.Object targetForCount = targetPath.ResolveFromContext (this); if (targetForCount != null) { Error ("can't pass a read count by reference. '" + targetPath.dotSeparatedComponents+"' is a knot/stitch/label, but '"+target.dotSeparatedComponents+"' requires the name of a VAR to be passed."); break; } var varPointer = new Runtime.VariablePointerValue (varRef.name); container.AddContent (varPointer); } // Normal value being passed: evaluate it as normal else { argToPass.GenerateIntoContainer (container); } } // Function calls were already in an evaluation context if (!isFunctionCall) { container.AddContent (Runtime.ControlCommand.EvalEnd()); } } // Starting a thread? A bit like a push to the call stack below... but not. // It sort of puts the call stack on a thread stack (argh!) - forks the full flow. if (isThread) { container.AddContent(Runtime.ControlCommand.StartThread()); } // If this divert is a function call, tunnel, we push to the call stack // so we can return again else if (isFunctionCall || isTunnel) { runtimeDivert.pushesToStack = true; runtimeDivert.stackPushType = isFunctionCall ? Runtime.PushPopType.Function : Runtime.PushPopType.Tunnel; } // Jump into the "function" (knot/stitch) container.AddContent (runtimeDivert); return container; } // Simple divert else { return runtimeDivert; } } // When the divert is to a target that's actually a variable name // rather than an explicit knot/stitch name, try interpretting it // as such by getting the variable name. public string PathAsVariableName() { return target.firstComponent; } void ResolveTargetContent() { if (isEmpty || isEnd) { return; } if (targetContent == null) { // Is target of this divert a variable name that will be de-referenced // at runtime? If so, there won't be any further reference resolution // we can do at this point. var variableTargetName = PathAsVariableName (); if (variableTargetName != null) { var flowBaseScope = ClosestFlowBase (); var resolveResult = flowBaseScope.ResolveVariableWithName (variableTargetName, fromNode: this); if (resolveResult.found) { // Make sure that the flow was typed correctly, given that we know that this // is meant to be a divert target if (resolveResult.isArgument) { var argument = resolveResult.ownerFlow.arguments.Where (a => a.name == variableTargetName).First(); if ( !argument.isDivertTarget ) { Error ("Since '" + argument.name + "' is used as a variable divert target (on "+this.debugMetadata+"), it should be marked as: -> " + argument.name, resolveResult.ownerFlow); } } runtimeDivert.variableDivertName = variableTargetName; return; } } targetContent = target.ResolveFromContext (this); } } public override void ResolveReferences(Story context) { if (isEmpty || isEnd || isDone) { return; } if (targetContent) { runtimeDivert.targetPath = targetContent.runtimePath; } // Resolve children (the arguments) base.ResolveReferences (context); // May be null if it's a built in function (e.g. TURNS_SINCE) // or if it's a variable target. var targetFlow = targetContent as FlowBase; if (targetFlow) { if (!targetFlow.isFunction && this.isFunctionCall) { base.Error (targetFlow.name + " hasn't been marked as a function, but it's being called as one. Do you need to delcare the knot as '== function " + targetFlow.name + " =='?"); } else if (targetFlow.isFunction && !this.isFunctionCall && !(this.parent is DivertTarget)) { base.Error (targetFlow.name + " can't be diverted to. It can only be called as a function since it's been marked as such: '" + targetFlow.name + "(...)'"); } } // Check validity of target content bool targetWasFound = targetContent != null; bool isBuiltIn = false; bool isExternal = false; if (target.numberOfComponents == 1 ) { // BuiltIn means TURNS_SINCE, CHOICE_COUNT, RANDOM or SEED_RANDOM isBuiltIn = FunctionCall.IsBuiltIn (target.firstComponent); // Client-bound function? isExternal = context.IsExternal (target.firstComponent); if (isBuiltIn || isExternal) { if (!isFunctionCall) { base.Error (target.firstComponent + " must be called as a function: ~ " + target.firstComponent + "()"); } if (isExternal) { runtimeDivert.isExternal = true; if( arguments != null ) runtimeDivert.externalArgs = arguments.Count; runtimeDivert.pushesToStack = false; runtimeDivert.targetPath = new Runtime.Path (this.target.firstComponent); CheckExternalArgumentValidity (context); } return; } } // Variable target? if (runtimeDivert.variableDivertName != null) { return; } if( !targetWasFound && !isBuiltIn && !isExternal ) Error ("target not found: '" + target + "'"); } // Returns false if there's an error void CheckArgumentValidity() { if (isEmpty) return; // Argument passing: Check for errors in number of arguments var numArgs = 0; if (arguments != null && arguments.Count > 0) numArgs = arguments.Count; // Missing content? // Can't check arguments properly. It'll be due to some // other error though, so although there's a problem and // we report false, we don't need to report a specific error. // It may also be because it's a valid call to an external // function, that we check at the resolve stage. if (targetContent == null) { return; } FlowBase targetFlow = targetContent as FlowBase; // No error, crikey! if (numArgs == 0 && (targetFlow == null || !targetFlow.hasParameters)) { return; } if (targetFlow == null && numArgs > 0) { Error ("target needs to be a knot or stitch in order to pass arguments"); return; } if (targetFlow.arguments == null && numArgs > 0) { Error ("target (" + targetFlow.name + ") doesn't take parameters"); return; } if( this.parent is DivertTarget ) { if (numArgs > 0) Error ("can't store arguments in a divert target variable"); return; } var paramCount = targetFlow.arguments.Count; if (paramCount != numArgs) { string butClause; if (numArgs == 0) { butClause = "but there weren't any passed to it"; } else if (numArgs < paramCount) { butClause = "but only got " + numArgs; } else { butClause = "but got " + numArgs; } Error ("to '" + targetFlow.name + "' requires " + paramCount + " arguments, "+butClause); return; } // Light type-checking for divert target arguments for (int i = 0; i < paramCount; ++i) { FlowBase.Argument flowArg = targetFlow.arguments [i]; Parsed.Expression divArgExpr = arguments [i]; // Expecting a divert target as an argument, let's do some basic type checking if (flowArg.isDivertTarget) { // Not passing a divert target or any kind of variable reference? var varRef = divArgExpr as VariableReference; if (!(divArgExpr is DivertTarget) && varRef == null ) { Error ("Target '" + targetFlow.name + "' expects a divert target for the parameter named -> " + flowArg.name + " but saw " + divArgExpr, divArgExpr); } // Passing 'a' instead of '-> a'? // i.e. read count instead of divert target else if (varRef != null) { // Unfortunately have to manually resolve here since we're still in code gen var knotCountPath = new Path(varRef.path); Parsed.Object targetForCount = knotCountPath.ResolveFromContext (varRef); if (targetForCount != null) { Error ("Passing read count of '" + knotCountPath.dotSeparatedComponents + "' instead of a divert target. You probably meant '" + knotCountPath + "'"); } } } } if (targetFlow == null) { Error ("Can't call as a function or with arguments unless it's a knot or stitch"); return; } return; } void CheckExternalArgumentValidity(Story context) { string externalName = target.firstComponent; ExternalDeclaration external = null; var found = context.externals.TryGetValue(externalName, out external); System.Diagnostics.Debug.Assert (found, "external not found"); int externalArgCount = external.argumentNames.Count; int ownArgCount = 0; if (arguments != null) { ownArgCount = arguments.Count; } if (ownArgCount != externalArgCount) { Error ("incorrect number of arguments sent to external function '" + externalName + "'. Expected " + externalArgCount + " but got " + ownArgCount); } } public override void Error (string message, Object source = null, bool isWarning = false) { // Could be getting an error from a nested Divert if (source != this && source) { base.Error (message, source); return; } if (isFunctionCall) { base.Error ("Function call " + message, source, isWarning); } else { base.Error ("Divert " + message, source, isWarning); } } public override string ToString () { if (target != null) return target.ToString (); else return "-> <empty divert>"; } } }
{ "pile_set_name": "Github" }
# This file is part of DmpBbo, a set of libraries and programs for the # black-box optimization of dynamical movement primitives. # Copyright (C) 2014 Freek Stulp, ENSTA-ParisTech # # DmpBbo is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # DmpBbo 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 Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with DmpBbo. If not, see <http://www.gnu.org/licenses/>.
{ "pile_set_name": "Github" }
package com.demo.top; import com.demo.domain.TopProductEntity; import org.apache.flink.api.common.state.ListState; import org.apache.flink.api.common.state.ListStateDescriptor; import org.apache.flink.api.java.tuple.Tuple; import org.apache.flink.configuration.Configuration; import org.apache.flink.streaming.api.functions.KeyedProcessFunction; import org.apache.flink.util.Collector; import java.util.ArrayList; import java.util.Comparator; import java.util.List; public class TopNHotItems extends KeyedProcessFunction<Tuple, TopProductEntity, List<String>> { private final int topSize; public TopNHotItems(int topSize) { this.topSize = topSize; } private ListState<TopProductEntity> itemState; @Override public void open(Configuration parameters) throws Exception { super.open(parameters); // 状态的注册 ListStateDescriptor<TopProductEntity> itemsStateDesc = new ListStateDescriptor<>( "itemState-state", TopProductEntity.class); itemState = getRuntimeContext().getListState(itemsStateDesc); } @Override public void processElement(TopProductEntity topProductEntity, Context context, Collector<List<String>> collector) throws Exception { itemState.add(topProductEntity); // 注册 windowEnd+1 的 EventTime Timer, 当触发时,说明收齐了属于windowEnd窗口的所有商品数据 context.timerService().registerEventTimeTimer(topProductEntity.getWindowEnd() + 1); } @Override public void onTimer(long timestamp, OnTimerContext ctx, Collector<List<String>> out) throws Exception { List<TopProductEntity> allItems = new ArrayList<>(); for (TopProductEntity item : itemState.get()) { allItems.add(item); } // 提前清除状态中的数据,释放空间 itemState.clear(); // 按照点击量从大到小排序 allItems.sort(new Comparator<TopProductEntity>() { @Override public int compare(TopProductEntity o1, TopProductEntity o2) { return (int) (o2.getActionTimes() - o1.getActionTimes()); } }); List<String> ret = new ArrayList<>(); allItems.forEach(i-> ret.add(String.valueOf(i.getProductId()))); out.collect(ret); } }
{ "pile_set_name": "Github" }
/* Copyright 2019 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // +k8s:deepcopy-gen=package // +k8s:protobuf-gen=package // +k8s:openapi-gen=true // +groupName=discovery.k8s.io package v1beta1 // import "k8s.io/api/discovery/v1beta1"
{ "pile_set_name": "Github" }
[CustomMessages] pt_br.IDP_FormCaption =Baixando arquivos pt_br.IDP_FormDescription =Por favor aguarde, enquanto recebe arquivos adicionais... pt_br.IDP_TotalProgress =Progresso total pt_br.IDP_CurrentFile =Arquivo atual pt_br.IDP_File =Arquivo: pt_br.IDP_Speed =Velocidade: pt_br.IDP_Status =Estado: pt_br.IDP_ElapsedTime =Tempo decorrido: pt_br.IDP_RemainingTime =Tempo remanescente: pt_br.IDP_DetailsButton =Detalhes pt_br.IDP_HideButton =Ocultar pt_br.IDP_RetryButton =Repetir pt_br.IDP_IgnoreButton = pt_br.IDP_KBs =KB/s pt_br.IDP_MBs =MB/s pt_br.IDP_X_of_X =%.2f de %.2f pt_br.IDP_KB =KB pt_br.IDP_MB =MB pt_br.IDP_GB =GB pt_br.IDP_Initializing =Inicializando... pt_br.IDP_GettingFileInformation=Recebendo informações do arquivo... pt_br.IDP_StartingDownload =Iniciando o download... pt_br.IDP_Connecting =Conectando... pt_br.IDP_Downloading =Baixando... pt_br.IDP_DownloadComplete =Download finalizado pt_br.IDP_DownloadFailed =Falha no download pt_br.IDP_CannotConnect =Não pode conectar pt_br.IDP_CancellingDownload =Cancelando o download... pt_br.IDP_Unknown =Desconhecido pt_br.IDP_DownloadCancelled =Download cancelado pt_br.IDP_RetryNext =Verifique sua conexão e clique em 'Repetir' para tentar novamente o download dos arquivos, ou clique em 'Próximo' para continuar a instalação mesmo assim. pt_br.IDP_RetryCancel =Verifique sua conexão e clique em 'Repetir' para tentar novamente o download dos arquivos, ou clique em 'Cancel' para finalizar a Instalação. pt_br.IDP_FilesNotDownloaded = pt_br.IDP_HTTPError_X =erro HTTP %d pt_br.IDP_400 =Requisição inválida (400) pt_br.IDP_401 =Acesso negado (401) pt_br.IDP_404 =Arquivo não encontrado (404) pt_br.IDP_407 =Autenticação de proxy necessária (407) pt_br.IDP_500 =Erro interno do servidor (500) pt_br.IDP_502 =Bad Gateway (502) pt_br.IDP_503 =Serviço temporariamente indisponível (503)
{ "pile_set_name": "Github" }
15.2. 何时用 SSE ==== 如上所述,SSE 是一种技术,允许客户订阅服务器上产生的事件通知。服务器生成新的事件和将这些事件发送回订阅的客户端来接收通知。换句话说,SSE 为单向发布-订阅模式提供了一个解决方案。 一个很好的应用场景是,SSE 可以用于简单的 RESTful 服务的消息交换。客户端发送新消息到服务器,并从其他客户端订阅接收消息。我们称这种资源为 messages(信息)。在发布新消息到这个资源是一个典型的客户端与之messages 资源之间的 HTTP 请求-响应交互,订阅接收所有新的消息通知这会很男,并且对于与一系列标准的请求-响应消息交换的模型是不切实际的。使用 SSE 服务器发送的事件提供了一个更实际的方法。您可以使用SSE 让客户订阅信息资源通过标准 GET 请求(例如使用 SSE 客户端API,javascript API 或 Jersey 客户端 API ),以独立的事件让服务器广播新消息给所有连接上的客户端(在我们的例子中使用 Jersey Server SSE API)。注意,在 Jersey 中,支持 SSE 通常被实现为一个 JAX-RS 资源的方法。在你的 Jersey/JAX-RS 应用程序中,不需要做任何特别的提供对 SSE 的支持,您启用 SSE 的资源是一个标准的 REST 风格的 Web应用程序的一部分,定义了应用程序的 REST API。接下来的章节描述了SSE支持在 Jersey 的更多细节。 *重要* *注意,在 Jersey 中,支持 SSE 通常通过一个 JAX-RS 资源来实现, Jersey SSE APIs 并不是 JAX-RS 规范的一部分。SSE 所支持和相关 API 是一个扩展了 JAX-RS 的特定功能。*
{ "pile_set_name": "Github" }
import _plotly_utils.basevalidators class UidValidator(_plotly_utils.basevalidators.StringValidator): def __init__(self, plotly_name="uid", parent_name="scattermapbox", **kwargs): super(UidValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_type=kwargs.pop("edit_type", "plot"), role=kwargs.pop("role", "info"), **kwargs )
{ "pile_set_name": "Github" }
import * as H from "history"; export interface IProps { history: H.History; }
{ "pile_set_name": "Github" }
# Navigation bar links and tooltips navbar_overview=Vista general navbar_overview_tooltip=Resum general de membres de l'espai navbar_status=Estat de la matr\u00edcula navbar_status_tooltip=Mostra els membres de l'espai organitzats per l'estat de les matr\u00edcules navbar_permissions=Autoritzacions navbar_permissions_tooltip=Mostra i edita els permisos dels participants d'aquest espai # Page titles title_permissions=Autoritzacions # Search roster_search_text=Cerca roster_search_button=Cerca roster_clear_button=Neteja # Participants drop-down roster_sections_all=Tot # Group membership drop-down roster_group_ungrouped=Sense grup roster_group_bygroup=Per grup roster_group_unassigned=Sense assignar # Enrollment drop-down roster_enrollment_status_all=Tots # Participants and roles currently_displaying_participants=Actualment es mostren {0} participants currently_displaying_participant=Actualment es mostra {0} participant role_breakdown_fragment={0} amb rol {1} # Filters enrollment_set_filter_label=Configura enrollment_status_filter_label=Estat # Roster member group drop-down member_group_all_option=... m\u00faltiples # Print and export buttons print_roster=Imprimeix l'orla print_roster_tooltip=Imprimeix aquesta p\u00e0gina export_roster=Exporta l'orla export_roster_tooltip=Exporta aquesta orla # Show/hide names button roster_hide_names=Amaga els noms roster_hide_pictures=Amaga les fotografies # Official/Profile radio picture_source_group=Font de la fotografia roster_show_official_pictures=Oficial roster_show_profile_pictures=Perfil # View types layout_group=Format roster_card_view=Targetes roster_photo_view=Graella de fotografies roster_spreadsheet_view=Llista # Profile profile_email=Correu electr\u00f2nic profile_picture_alt=Fotografia de # Facets facet_picture=Fotografia facet_name=Nom facet_userId=Identificaci\u00f3 de l'usuari facet_user_name_pronunciation=Com es pronuncia facet_userProperties=Propietats de l'usuari facet_email=Correu electr\u00f2nic facet_role=Rol facet_status=Estat facet_credits=Cr\u00e8dits facet_groups=Grups facet_roster=Orla # Page title messages title_msg_permissions=Estableix els permisos corresponents als rols d'aquest espai no_participants=No s'han trobat resultats # Permissions roster_permissions_role=Rol roster_save_button=Desa roster_cancel_button=Cancel\u00b7la permissions_header=Perm\u00eds perm-roster.viewallmembers=Pot veure tots els participants perm-roster.viewhidden=Pot veure els participants ocults perm-roster.export=Pot exportar l'orla perm-roster.viewgroup=Pot veure els grups perm-roster.viewenrollmentstatus=Pot veure l'estat de la matr\u00edcula dels participants perm-roster.viewprofile=Pot veure el perfil dels participants perm-roster.viewemail=Pot veure el correu electr\u00f2nic dels participants perm-roster.viewofficialphoto=Pot veure la fotografia oficial dels participants perm-roster.viewsitevisits=Pot veure el nombre de visites a l'espai dels participants perm-roster.viewuserproperties=Pot veure les propietats dels participants groups=Grup roles_label=Rol total_visits=Nombre total de visites last_visit=Darrera visita months=Gen,Feb,Mar,Abr,Mai,Jun,Jul,Ago,Set,Oct,Nov,Des no_visits_yet=Cap encara screenreader_comboBox=Per operar amb la caixa combo, premeu Alt+Fletxa Avall per obrir-la i useu les fletxes per rec\u00f3rrer les opcions. name_pronunciation_not_provided=[No s'ha proporcionat] name_pronunciation_profile_link=Introdueix la pronunciaci\u00f3 del nom a l'eina Perfil
{ "pile_set_name": "Github" }
#include <stdlib.h> #include <string.h> // The issue here is the same one in memcmptest -- 'strchr' and 'index' are // aliases, as are 'strrchr' and 'rindex'. In each case, the shorter name // gets preferred, ie. 'index' and 'rindex'. int main(int argc, char* argv[]) { char *s, *a __attribute__((unused)), *b __attribute__((unused)); s = malloc(sizeof(char)); // Nb: s[0] is uninitialised, but almost certainly a zero a = strchr (s, '1'); b = strrchr(s, '1'); return 0;//((int)a + (int)b); }
{ "pile_set_name": "Github" }
/*===========================================================================* * * * smtsock.c - TCP/IP Socket agent * * * * Copyright (c) 1991-2010 iMatix Corporation * * * * ------------------ GPL Licensed Source Code ------------------ * * iMatix makes this software available under the GNU General * * Public License (GPL) license for open source projects. For * * details of the GPL license please see www.gnu.org or read the * * file license.gpl provided in this package. * * * * 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 in the file 'license.gpl'; if * * not, see <http://www.gnu.org/licenses/>. * * * * You can also license this software under iMatix's General Terms * * of Business (GTB) for commercial projects. If you have not * * explicitly licensed this software under the iMatix GTB you may * * only use it under the terms of the GNU General Public License. * * * * For more information, send an email to [email protected]. * * -------------------------------------------------------------- * *===========================================================================*/ #include "smtpriv.h" /* SMT definitions */ /* ------------------------------------------------------------------------- This module has been extensively hand-optimised for both data and processing efficiency. As a result it may also be somewhat difficult to follow and prone to errors. This is an attempt to explain what is going on so that the code may make more sense. A. DATA ---- 1. There are two queues of socket requests: main_list and wait_list. main_list contains queued requests grouped/sorted as follows: - grouped by socket number in no particular order (in practice the order is that in which the first request on the socket since the last time all requests on that socket were cleared was received). - sorted by request type: 'input-type' requests are INPUT, READ and READR, while 'output-type' requests are all others, including CLOSE. Output-type requests come before input-type requests. - sorted in chronological order of request reception. wait_list contains requests simply in the order in which they are received. Every request in wait_list has at least one corresponding request on the same socket in main_list. These requests are held in wait_list pending insertion at the appropriate point in main_list. Note that requests in both main_list and wait_list are active and must be processed as rapidly as posible. For the purposes of optimisation, two redundant variables are maintained in parallel with wait_list. fd_waiting is a file descriptor bitset containing those socket handles on which there is a request in wait_list. wait_count contains the total number of requests in wait_list. Since fd_waiting may never be required, it is dynamically allocated one time for all the first time it is used. 2. There are six file descriptor bitsets used for calls to select(). There are two groups of three: the input to and result from the call for input, output and error checks respectively. These are named fd_{in/out/err}_{check/result}. The bitsets fd_{in/out/err}_check are maintained permanently, ie at the exit of any module in smtsock these three bitsets contain exactly those socket numbers for which there are active requests in either main_list or wait_list. fd_err_check is always a logical OR of fd_in_check with fd_out_check. 3. The variable top_socket is maintained so that it is always at least as big but preferably no bigger than the highest socket number on which there is an active request. Note that it is non-trivial to determine the highest socket number when a request is deleted. We recalculate top_socket whenever we walk the entire list of requests, so that it will be lowered (after a request is delete) following the next walk at the latest. We optimise this process with the flags deleted and deleted_walking which indicate, respectively, whether a queued request was deleted since the last time top_socket was guaranteed up-to-date and whether a queued request was deleted since we last began a walk of the requests (since if this is the case then we are no longer guaranteed to be up-to-date when the walk is over). Note also that non-queued requests don't trigger deleted or deleted_walking as they are not reflected in the value of top_socket. B. PROCESSING ---------- 1. Request reception. Requests are created before being queued. We attempt to service certain types of requests immediately so that they never need to be queued. READ/H/R requests are attempted if there are no currently queued input-type requests on the socket; WRITE/H requests are attempted if there are no queued output-type requests. CLOSE requests are attempted if there are no queued requests of any type. While it would be nice to attempt the CLOSE as long as there are no output requests pending, we have the problem that input-type requests would need to be cancelled immediately and we don't have the data structures to locate them efficiently. 2. Request queuing. Performed by request_queue. When a request is received, fd_err_check is examined to see whether there are any existing requests on the same socket. If not, the request is added at the end of main_list and the socket is added to fd_err_check; otherwise it is added at the end of wait_list and the socket is added to fd_waiting. In either case the socket is added to fd_in_check or fd_out_check as appropriate, and both top_socket and new_top_socket are updated if the new socket number is higher than their previous value. 3. Socket watching. This is handled by check_activity_nonblock and wait_for_activity_blocking when SMT is active and idle respectively. The dialog manager handles calling these functions. check_activity_nonblock calls sock_select with no timeout. If socket activity is detected it sends an ACTIVITY event to the socket queue to wake it up and begin processing of the result. wait_for_activity_blocking makes use of the fact that it is called when SMT is idle to do some housekeeping. It performs two tasks: merging requests in wait_list and recalculating top_socket, optimising using wait_count and deleted to avoid redundant processing. 4. Request merging. Performed by merge_waiting_requests_same_socket There are several things going on at once and the whole thing is quite optimised so pay attention. # First note that this function must only be called with the argument request pointing to the *first* request on a given socket in main_list. On return this pointer is updated so that it still points to the first request on the socket. This function finds all requests in wait_list on the same socket and merges them into main_list at the approprate location. At the same time it validates that the new requests being queued are not meaningless. Meaningless requests are: any request following an unprocessed CLOSE, any output-type request following an unprocessed OUTPUT and any input-type request following an unprocessed INPUT or READR. 5. Checking for socket activity. Performed by check_next_socket_activity This module is called as the requests in main_list are walked following socket activity. When activity is detected, walking stops while the activity is processed. Then walking continues from where it was. For each request, the function proceeds as follows: It updates new_top_socket if required to the current request socket handle. If there are any waiting requests on the same socket, they are all merged immediately. If there was error activity on the socket, this activity is flagged as the next to process. If there was output activity, this is flagged as the next to process. The socket is removed from fd_out_result so that successive output requests on the same socket don't get triggered. In addition, the following request is examined to see if it is another output request on the same socket. If it isn't then the socket is removed from fd_out_check, and fd_err_check if appropriate. If the output request was actually a CLOSE, then any remaining input requests get sent a CLOSED reply immediately and they are destroyed. The socket also gets removed from the input and error check sets as well as the input result bitset. Then skip further output requests on the same socket. If there was input activity, this is flagged as the next to process. The socket is removed from fd_in_result so that successive input requests on the same socket don't get triggered. In addition, the following request is examined to see if it is another request on the same socket. If it isn't then the socket is removed from fd_in_check, and fd_err_check if appropriate. Then skip all further requests on the same socket. If no activity was flagged, proceed to the next request. If all requests have been processed, update top_socket to the value of new_top_socket. If no requests were deleted during the walk of the requests then we can flag that no requests have been deleted since top_socket was last guaranteed correct (deleted). 6. Request processing is pretty straightforward. The only request which invokes more complicated stuff is FLUSH. - FLUSH: There are two versions of the flush request: flush all requests or only input-type requests. For reasons of optimisation, these two cases are treated separately. When flushing all requests, we can simply walk both main_list and wait_list, destroying requests on the given socket as we go. When flushing only input requests, we need to maintain the data so that any remaining output-type requests are processed cleanly. We do this by merging waiting requests on the same socket, so that we know that all requests on our socket are in main_list. Then we find the input-type requests and destroy them. The bitsets are maintained appropriately but top_socket is not recalculated at this stage. -------------------------------------------------------------------------*/ /*- Definitions -------------------------------------------------------------*/ #define AGENT_NAME SMT_SOCKET /* Our public name */ #define SINGLE_THREADED TRUE /* Single-threaded agent */ #define WRITE_TIMEOUT 10 /* Default write timeout */ typedef enum { SOCK_READ, SOCK_WRITE, SOCK_INPUT, SOCK_OUTPUT, SOCK_CLOSE, SOCK_CONNECT } REQUEST_TYPE; #define request_is_input(r) (r->type == SOCK_READ || r->type == SOCK_INPUT) #define request_is_output(r) (! request_is_input(r)) typedef struct _SOCKREQ { /* Request descriptor */ struct _SOCKREQ /* */ *next, *prev; /* Doubly-linked list */ long id; /* Unique internal request ID */ REQUEST_TYPE type; /* Type of request */ QID reply_to; /* Who sent the request event */ sock_t handle; /* Socket for request */ byte *buffer; /* Buffer for i/o, or NULL */ qbyte max_size; /* Maximum size of buffer */ qbyte cur_size; /* Current size of buffer */ qbyte min_size; /* Minimum data to process */ dbyte timeout; /* Expiry time in seconds */ time_t expires; /* Expiry time, or 0 */ void *tag; /* User-defined request tag */ int repeat:1; /* Repeated request? */ int huge_block:1; /* Huge blocks? */ int reply:1; /* Send OK reply afer write? */ int queued:1; /* Is request queued? */ } SOCKREQ; /*- Function prototypes -----------------------------------------------------*/ static void request_destroy (SOCKREQ *request); int check_activity_nonblock (int interval, void *dummyarg); static void merge_waiting_requests_same_socket (SOCKREQ **request); static void send_ok_reply (SOCKREQ *request); static void send_closed_reply (SOCKREQ *request); static void reply_illegal_sequence_error (SOCKREQ *request); int wait_for_activity_blocking (long wait_date, long wait_time, void *dummyarg); static SOCKREQ *create_small_read_type_request (THREAD *thread); static SOCKREQ *request_create (QID *reply_to, REQUEST_TYPE request_type, dbyte timeout, sock_t handle, void *tag); static void process_read_type_request (SOCKREQ *request); static int read_some_data (SOCKREQ *request); static void request_queue (SOCKREQ *request); static void reply_error (QID *qid, char *message, void *tag); static SOCKREQ *create_huge_read_type_request (THREAD *thread); static void clear_check_after_input_request (SOCKREQ *request); static void clear_check_after_output_request (SOCKREQ *request); static void handle_partial_io (SOCKREQ *request, int bytes_done); static int write_some_data (SOCKREQ *request); static void prepare_to_cancel_all_requests (void); static void send_error_reply (SOCKREQ *request); #if defined (DEBUG) static void print_sock_lists (void); static void print_sock_request (SOCKREQ *request); static void print_sock_select (const char *intro, int num_sockets, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout); static void print_sock_select_set (char *buffer, int num_sockets, fd_set *set); static void print_sock_check (void); #endif /*- Global variables used in this source file only --------------------------*/ static Bool walking, /* Currently walking requests? */ trace_flag = FALSE, /* Trace socket activity? */ deleted, /* Requests deleted? */ deleted_walking; /* ... while walking requests. */ static NODE /* Two request lists. */ main_list, wait_list; static fd_set fd_in_check, /* Check bitsets */ fd_out_check, fd_err_check, fd_in_result, /* Result bitsets */ fd_out_result, fd_err_result, *fd_waiting = NULL; /* Sockets in waiting requests */ static sock_t top_socket, /* Highest socket number */ new_top_socket; /* Temporary during request walk */ static QID sockq, /* Our own (unique) queue */ operq; /* Operator console event queue */ static SOCKREQ *current_request, /* Pointer to request (in list) */ *active_request; /* Request we're processing */ static long last_id = 0; /* Last used request ID */ static int wait_count = 0; /* Number of requests in wait list */ #include "smtsock.d" /* Include dialog data */ /******************** INITIALISE AGENT - ENTRY POINT *********************/ /* ---------------------------------------------------------------------[<]- Function: smtsock_init Synopsis: Initialises the SMT socket agent. Returns 0 if initialised okay, -1 if there was an error. The socket agent manages all sockets (TCP and UPD) used by an SMT application. Creates an unnamed thread automatically: send events to that thread. Initialises the sflsock socket interface automatically. Supports these public methods: <Table> READ Read a specified amount of input data (use SMT_SOCK_READ). WRITE Write a specified amount of output data (use SMT_SOCK_WRITE). READR Read input data, repeatedly (use SMT_SOCK_READ). READH As for READ, but for blocks > 64k (use SMT_SOCK_READH). WRITEH As for WRITE, but for blocks > 64k (use SMT_SOCK_WRITEH). READRH As for READR, but for blocks > 64k (use SMT_SOCK_READH). INPUT Wait for any input ready on socket (use SMT_SOCK_INPUT). OUTPUT Wait for any output ready on socket (use SMT_SOCK_OUTPUT). CONNECT Make socket connection to host & port (use SMT_SOCK_CONNECT). FLUSH Delete all requests for specified socket (use SMT_SOCK_FLUSH). </Table> Sends errors to the SMTOPER agent; see doc for reply events. ---------------------------------------------------------------------[>]-*/ int smtsock_init (void) { AGENT *agent; /* Handle for our agent */ THREAD *thread; /* Handle to console thread */ # include "smtsock.i" /* Include dialog interpreter */ agent->priority = SMT_PRIORITY_HIGH; /* Shutdown event comes from Kernel */ declare_smtlib_shutdown (shutdown_event, SMT_PRIORITY_MAX); /* Public methods supported by this agent */ declare_smtsock_read (read_event, 0); declare_smtsock_readr (readr_event, 0); declare_smtsock_readh (readh_event, 0); declare_smtsock_readrh (readrh_event, 0); declare_smtsock_write (write_event, 0); declare_smtsock_writeh (writeh_event, 0); declare_smtsock_input (input_event, 0); declare_smtsock_output (output_event, 0); declare_smtsock_connect (connect_event, 0); declare_smtsock_close (close_event, 0); declare_smtsock_flush (flush_event, 0); /* Alarm event sent by timer to this agent */ declare_smttime_reply (timeout_event, 0); /* Private method used to cycle on select() call */ method_declare (agent, "_ACTIVITY", activity_event, 0); /* Ensure that operator console is running, else start it up */ if (agent_lookup (SMT_OPERATOR) == NULL) smtoper_init (); if ((thread = thread_lookup (SMT_OPERATOR, "")) != NULL) operq = thread->queue->qid; else return (-1); /* Ensure that timer agent is running, else start it up */ if (smttime_init ()) return (-1); /* Register blocking asyncronous function. This must be done after */ /* starting smttime or it will be overridden. */ register_async_blocking (wait_for_activity_blocking, NULL); /* Initialise the socket interface and register smtsock_term() */ if (sock_init () == 0) smt_atexit ((function) sock_term); else { send_smtoper_error (&operq, "smtsock: could not initialise socket interface"); send_smtoper_error (&operq, strprintf ("smtsock: %s", connect_errlist [connect_error ()])); return (-1); } ip_nonblock = TRUE; /* Want nonblocking sockets */ /* Create initial, unnamed thread */ thread = thread_create (AGENT_NAME, ""); sockq = thread->queue->qid; /* Start with no sockets needing attention. */ FD_ZERO (&fd_in_check); FD_ZERO (&fd_out_check); FD_ZERO (&fd_err_check); top_socket = 0; new_top_socket = 0; deleted = FALSE; /* Signal okay to caller that we initialised okay */ return (0); } /* ---------------------------------------------------------------------[<]- Function: smtsock_trace Synopsis: Enables/disables socket tracing: to enable, call with TRUE as argument; to disable call with FALSE as argument. Socket trace data is sent to the console. ---------------------------------------------------------------------[>]-*/ void smtsock_trace (Bool trace_value) { trace_flag = trace_value; } /* ------------------------------------------------------------------------- * request_destroy * * Destroys the specified request. */ static void request_destroy (SOCKREQ *request) { /* Clear timer request, if there was one */ if (request->timeout) clear_requests_matching_tag (&sockq, (void *) request->id); /* Only flag request as deleted if it was queued. */ if (request->queued) { deleted = TRUE; deleted_walking = TRUE; /* If this request is the current request in request walk, advance */ /* now to the next request. */ if (request == current_request) current_request = current_request->next; } /* Free dynamically-allocated fields in the request block, as reqd. */ mem_free (request->buffer); mem_free (list_unlink (request)); } int wait_for_activity_blocking (long wait_date, long wait_time, void *dummyarg) { SOCKREQ *request, *next_request; long current_date, current_time, days, csecs; struct timeval timeout; struct timeval *timeoutptr; int rc; /* Return code from select() */ if (trace_flag) coprintf ("Blocking wait until %lu %lu.", wait_date, wait_time); /* Since this is idle time, we start by doing a request merge and */ /* recalculate top_socket as required. We optimise here is several */ /* ways: If no request has been deleted since top_socket was calculated */ /* or if all waiting requests have been merged then the loop can stop. */ /* Careful not to update top_socket if the loop was terminated early. */ /* Another simple optimisation is to find the first request on a */ /* different socket before doing the merge, since the merge can make */ /* the finding process longer. */ request = (SOCKREQ *) main_list.next; new_top_socket = 0; while ((wait_count || deleted) && ((NODE *) request != &main_list)) { next_request = request; while ((NODE *) next_request != &main_list && next_request->handle == request->handle) next_request = next_request->next; if (wait_count && FD_ISSET ((int) request->handle, fd_waiting)) merge_waiting_requests_same_socket (&request); request = next_request; /* Since the original request may have been deleted during the */ /* merge, we adjust new_top_socket to the handle of the previous */ /* remaining request. */ if ((NODE *) request->prev != &main_list) new_top_socket = max (request->prev->handle, new_top_socket); } if (deleted) { ASSERT (new_top_socket <= top_socket); if (trace_flag && new_top_socket < top_socket) coprintf ("smtsock: -- setting top_socket to %d", new_top_socket) ; top_socket = new_top_socket; deleted = FALSE; } if (wait_date < 99999999) { timeoutptr = &timeout; /* Work out how long to wait. */ get_date_time_now(&current_date, &current_time); date_diff (wait_date, wait_time, current_date, current_time, &days, &csecs); csecs++; /* Round up to avoid busy waiting. */ if ((days >= 0) && (csecs >= 0)) /* wait_date/time is in future. */ { timeout.tv_sec = days * 86400 + csecs / 100; timeout.tv_usec = (csecs % 100) * 10000; } else { /* If time is in the past, do the select without blocking */ timeout.tv_sec = 0; timeout.tv_usec = 0; } } else { if (top_socket) timeoutptr = NULL; /* Block indefinitely. */ else return 0; /* Don't wait forever on no socket. */ } /* First copy sets to check because select () uses the same data */ /* space for its result. */ memcpy (&fd_in_result, &fd_in_check, sizeof (fd_set)); memcpy (&fd_out_result, &fd_out_check, sizeof (fd_set)); memcpy (&fd_err_result, &fd_err_check, sizeof (fd_set)); # if defined (DEBUG) if (trace_flag) print_sock_select ( "smtsock: called blocking select", (int) top_socket + 1, &fd_in_result, &fd_out_result, &fd_err_result, timeoutptr); # endif rc = sock_select ( (int) top_socket + 1, /* Handles to check */ &fd_in_result, /* Check/result for input */ &fd_out_result, /* Check/result for output */ &fd_err_result, /* Check/result for error */ timeoutptr); if (rc > 0) { # if defined (DEBUG) if (trace_flag) print_sock_select ( "smtsock: returned activity", (int) top_socket + 1, &fd_in_result, &fd_out_result, &fd_err_result, timeoutptr); # endif event_send ( &sockq, /* Send to ourselves */ NULL, /* No queue for reply */ "_ACTIVITY", /* Name of event to send */ NULL, 0, /* No event body */ NULL, NULL, NULL, /* No response events */ 0); /* No timeout */ walking = TRUE; return 1; } if (rc < 0) { int errorvalue = errno; trace("smtsock: Error in (blocking) select: %d (%d)\n", rc, errorvalue); fprintf(stderr, "smtsock: Error in (blocking) select: " "%d (%d)\n", rc, errorvalue); } return rc; } static void merge_waiting_requests_same_socket (SOCKREQ **request) { SOCKREQ *waiting_request, *next_waiting_request, *after_output_request, *after_input_request; Bool disallow_input, disallow_output; sock_t handle; disallow_input = FALSE; disallow_output = FALSE; handle = (*request)->handle; if (trace_flag) coprintf ("smtsock: -- merging requests on %d", handle) ; FD_CLR ((int) handle, fd_waiting); after_output_request = NULL; after_input_request = NULL; waiting_request = (SOCKREQ *) wait_list.next; FOREVER { /* Find waiting request on same socket as current request. */ while (((NODE *) waiting_request != &wait_list) && (waiting_request->handle != handle)) waiting_request = waiting_request->next; if ((NODE *) waiting_request == &wait_list) break; next_waiting_request = waiting_request->next; list_unlink (waiting_request); wait_count--; /* Find place to merge request as required. This code is optimised */ /* and delicate. Note that requests in the main list are grouped */ /* by socket number and within those groups are sorted so that */ /* output requests precede input requests. Within a specific */ /* request type they are in the order in which they were received. */ /* At the same time, this loop rejects illegal request sequences: */ /* anything after a close, output after an OUTPUT or input after an */ /* INPUT or READR. */ if (! after_output_request) { after_output_request = *request; while (((NODE *) after_output_request != &main_list) && (after_output_request->handle == handle) && (request_is_output (after_output_request))) { disallow_output = disallow_output || after_output_request->type == SOCK_OUTPUT || after_output_request->type == SOCK_CLOSE; disallow_input = disallow_input || after_output_request->type == SOCK_CLOSE; after_output_request = after_output_request->next; } } if (request_is_output (waiting_request)) { if (disallow_output) reply_illegal_sequence_error (waiting_request); else { list_relink_before (waiting_request, after_output_request); /* If there were previously no output requests, set request */ /* to point to the new request, now the first request on */ /* the socket. */ if (after_output_request == *request) *request = waiting_request; } } else { if (! after_input_request) { after_input_request = after_output_request; while ((NODE *) after_input_request != &main_list && after_input_request->handle == handle) { disallow_input = disallow_input || after_input_request->type == SOCK_INPUT || after_input_request->repeat; after_input_request = after_input_request->next; } } if (disallow_input) reply_illegal_sequence_error (waiting_request); else { list_relink_before (waiting_request, after_input_request); /* If there were previously no input requests then the new */ /* request is the first request after output requests. */ if (after_input_request == after_output_request) after_output_request = waiting_request; } } waiting_request = next_waiting_request; } } static void send_ok_reply (SOCKREQ *request) { if (request->reply) { if (request->type == SOCK_READ) if (request->huge_block) lsend_smtsock_readh_ok (&request->reply_to, &sockq, NULL, NULL, NULL, 0, request->cur_size, request->buffer, request->tag); else lsend_smtsock_read_ok (&request->reply_to, &sockq, NULL, NULL, NULL, 0, (dbyte) request->cur_size, request->buffer, request->tag); else if (request->type == SOCK_CONNECT) lsend_smtsock_connect_ok (&request->reply_to, &sockq, NULL, NULL, NULL, 0, request->handle, request->tag); else lsend_smtsock_ok (&request->reply_to, &sockq, NULL, NULL, NULL, 0, request->tag); } if (request->repeat) request->cur_size = 0; else request_destroy (request); } static void send_closed_reply (SOCKREQ *request) { if (request->type == SOCK_READ) if (request->huge_block) lsend_smtsock_readh_closed (&request->reply_to, &sockq, NULL, NULL, NULL, 0, request->cur_size, request->buffer, request->tag); else lsend_smtsock_read_closed (&request->reply_to, &sockq, NULL, NULL, NULL, 0, (dbyte) request->cur_size, request->buffer, request->tag); else lsend_smtsock_closed (&request->reply_to, &sockq, NULL, NULL, NULL, 0, request->tag); request_destroy (request); } static void reply_illegal_sequence_error (SOCKREQ *request) { reply_error (&request->reply_to, "Illegal request sequence.", request->tag); request_destroy (request); } #if defined (DEBUG) void print_sock_check (void) { struct timeval no_block = { 0, 0 }; /* Timeout for select = don't block */ coprintf ("-------------------------------------------------------"); print_sock_lists (); print_sock_select ( "smtsock: Handle checked", (int) top_socket, &fd_in_check, &fd_out_check, &fd_err_check, &no_block); coprintf ("-------------------------------------------------------"); } static void print_sock_lists (void) { SOCKREQ *current; coprintf ("Main list content"); current = main_list.next; while ((NODE *) current != &main_list) { print_sock_request (current); current = current->next; } coprintf ("Wait list content"); current = wait_list.next; while ((NODE *) current != &wait_list) { print_sock_request (current); current = current->next; } } static void print_sock_request (SOCKREQ *request) { char *sock_type = "?"; switch (request->type) { case SOCK_READ: sock_type = "READ "; break; case SOCK_WRITE: sock_type = "WRITE "; break; case SOCK_INPUT: sock_type = "INPUT "; break; case SOCK_OUTPUT: sock_type = "OUTPUT "; break; case SOCK_CLOSE: sock_type = "CLOSE "; break; case SOCK_CONNECT: sock_type = "CONNECT"; break; } coprintf ("%s id=%ld handle=%d size=%ld min=%ld max=%ld reply=%d", sock_type, request->id, request->handle, request->cur_size, request->min_size, request->max_size, request->reply); } static void print_sock_select (const char *intro, int num_sockets, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout) { static char buffer [1024 + 1]; buffer [0] = 0; strncat (buffer, strprintf ("%s: top=%d, read=(", intro, num_sockets), 1024); print_sock_select_set (buffer, num_sockets, readfds); strncat (buffer, "), write=(", 1024); print_sock_select_set (buffer, num_sockets, writefds); strncat (buffer, "), error=(", 1024); print_sock_select_set (buffer, num_sockets, errorfds); if (timeout) strncat (buffer, strprintf ("), timeout=%ld.%03d", timeout->tv_sec, (long) (timeout->tv_usec / 1000)), 1024); else strncat (buffer, "], NULL)", 1024); coprintf ("%s", buffer); } static void print_sock_select_set (char *buffer, int num_sockets, fd_set *set) { int i; Bool first = TRUE, second = FALSE, third = FALSE; for (i = 0; i < num_sockets; ++i) if (FD_ISSET (i, set)) { if (first) { strncat (buffer, strprintf ("%d", i), 1024); first = FALSE; } else if (second) third = TRUE; else strncat (buffer, strprintf (", %d", i), 1024); if (! second) { second = TRUE; third = FALSE; } } else { second = FALSE; if (third) { third = FALSE; strncat (buffer, strprintf (" .. %d", i-1), 1024); } } if (third) strncat (buffer, strprintf (" .. %d", i-1), 1024); } #endif /************************* INITIALISE THE THREAD *************************/ MODULE initialise_the_thread (THREAD *thread) { list_reset (&main_list); /* Initialise requests lists */ list_reset (&wait_list); wait_count = 0; the_next_event = ok_event; } /********************** SCHEDULE NON BLOCKING SELECT *********************/ MODULE schedule_non_blocking_select (THREAD *thread) { /* Ensure our polling function is scheduled to run after the next */ /* state change. */ #if defined (DEBUG) if (trace_flag) print_sock_check(); #endif schedule_polling_function (check_activity_nonblock, NULL, 1); walking = FALSE; } /* Maximum number of thread state changes between polling for activity */ #define MAX_POLLING_INTERVAL (10) int check_activity_nonblock (int interval, void *dummyarg) { struct timeval no_block = { 0, 0 }; /* Timeout for select = don't block */ int rc; /* Return code from select() */ /* First copy sets to check because select () uses the same data */ /* space for its result. */ memcpy (&fd_in_result, &fd_in_check, sizeof (fd_set)); memcpy (&fd_out_result, &fd_out_check, sizeof (fd_set)); memcpy (&fd_err_result, &fd_err_check, sizeof (fd_set)); if (top_socket) { #if defined (DEBUG) if (trace_flag) { print_sock_lists (); print_sock_select ( "smtsock: called non-blocking select", (int) top_socket + 1, &fd_in_result, &fd_out_result, &fd_err_result, &no_block); } #endif rc = sock_select ((int) top_socket + 1, /* Handles to check */ &fd_in_result, /* Check/result for input */ &fd_out_result, /* Check/result for output */ &fd_err_result, /* Check/result for error */ &no_block); /* Timeout */ if (rc > 0) { #if defined (DEBUG) if (trace_flag) print_sock_select ( "smtsock: returned activity", (int) top_socket + 1, &fd_in_result, &fd_out_result, &fd_err_result, &no_block); #endif /* Don't send another ACTIVITY event if we are already walking */ /* the request list. */ if (! walking) { event_send ( &sockq, /* Send to ourselves */ NULL, /* No queue for reply */ "_ACTIVITY", /* Name of event to send */ NULL, 0, /* No event body */ NULL, NULL, NULL, /* No response events */ 0); /* No timeout */ walking = TRUE; } /* Temporarily disable calls to ourselves; the main thread */ /* will reschedule us when required. */ schedule_polling_function (check_activity_nonblock, NULL, 0); return 1; } else { if (rc == 0) { /* Nothing happened, reschedule ourselves to run less */ /* often; once activity happens we'll be scheduled back */ /* up again. */ if (interval < MAX_POLLING_INTERVAL) schedule_polling_function (check_activity_nonblock, NULL, (interval + 1)); } else /* (rc < 0) */ { int errorvalue = errno; trace("smtsock: Error in (non-blocking) select: " "%d (%d)\n", rc, errorvalue); coprintf ("smtsock: Error in (non-blocking) select: " "%d (%d)\n", rc, errorvalue); } return rc; } } return 0; } /************************** CREATE READ REQUEST **************************/ MODULE create_read_request (THREAD *thread) { SOCKREQ *request; request = create_small_read_type_request (thread); if (request) process_read_type_request (request); } static SOCKREQ * create_small_read_type_request (THREAD *thread) { SOCKREQ *request = NULL; struct_smtsock_read *message; /* Get arguments from message */ if (get_smtsock_read ( thread->event->body, &message)) { raise_exception (fatal_event); return NULL; } if (trace_flag) coprintf ("smtsock: READ min=%d max=%d socket=%ld timeout=%d", message->min_size, message->max_size, message->socket, message->timeout) ; if (message->max_size == 0 || message->socket == 0) reply_error (&thread->event->sender, "Null read request", message->tag); else { if ((request = request_create (&thread->event->sender, SOCK_READ, message->timeout, message->socket, message->tag)) != NULL) { request->max_size = message->max_size; request->min_size = message->min_size ? message->min_size : message->max_size; if (! socket_is_alive (message->socket)) { send_closed_reply (request); request = NULL; } } } free_smtsock_read (&message); return request; } /* ------------------------------------------------------------------------- * request_create * * Creates a new request, and initialises it to empty. If the request * could not be created, sends an SOCK_ERROR event to the caller, and * returns null. Otherwise returns the address of the created request. */ static SOCKREQ * request_create (QID *reply_to, REQUEST_TYPE request_type, dbyte timeout, sock_t handle, void *tag) { SOCKREQ *request; /* Request we create */ if (handle == 0 || handle == INVALID_SOCKET) { reply_error (reply_to , "Invalid socket handle", tag); return NULL; } list_create (request, sizeof (SOCKREQ)); if (! request) reply_error (reply_to, "Out of memory", tag); else { /* Initialise the request with default values */ request->id = ++last_id; request->type = request_type; request->reply_to = *reply_to; request->handle = handle; request->buffer = NULL; request->max_size = 0; request->cur_size = 0; request->min_size = 0; request->tag = tag; request->repeat = FALSE; request->huge_block = FALSE; request->timeout = timeout; request->reply = TRUE; request->queued = FALSE; /* It's really not correct ANSI C to compute with timevals; this */ /* will just have to do for now. It may break on weird systems. */ request->expires = timeout ? time (NULL) + timeout : 0; } return (request); } static void process_read_type_request (SOCKREQ *request) { Bool queue = TRUE; /* If no input requests are currently queued we can try to */ /* read data before queuing the request. If enough data are */ /* available, we reply immediately to the request. Otherwise, */ /* or if this request is repeated, we queue it. We check for */ /* a closed socket here but other errors can wait for regular */ /* processing. */ if (! FD_ISSET ((int) request->handle, &fd_in_check)) { read_some_data (request); if (request->cur_size >= request->min_size) { queue = request->repeat; send_ok_reply (request); } else if (sockerrno == EPIPE || sockerrno == ECONNRESET) { send_closed_reply (request); queue = FALSE; } else queue = TRUE; } if (queue) request_queue (request); } static int read_some_data (SOCKREQ *request) { int rc; if (! request->buffer) { request->buffer = mem_alloc (request->max_size); if (request->buffer == NULL) { raise_exception (fatal_event); return 0; } } rc = read_TCP (request->handle, request->buffer + request->cur_size, (size_t) (request->max_size - request->cur_size)); if (trace_flag) { byte *ptr = (byte *) request->buffer + request->cur_size; coprintf ("smtsock: reading %d bytes '%02x %02x %02x %02x %02x %02x %02x %02x...'", rc, ptr [0], ptr [1], ptr [2], ptr [3], ptr [4], ptr [5], ptr [6], ptr [7]); } if (rc > 0) request->cur_size += rc; return rc; } static void request_queue (SOCKREQ *request) { if (request->timeout) { smttime_request_alarm_with_reply ( &sockq, NULL, NULL, NULL, 0, 0, request->timeout * 100, (void *) request->id); /* Tag data */ } if (! FD_ISSET ((int) request->handle, &fd_err_check)) { /* Not a duplicated request */ FD_SET ((int) request->handle, &fd_err_check); node_relink_before (request, &main_list); } else /* Duplicated request */ { if (! fd_waiting) { fd_waiting = mem_alloc (sizeof (*fd_waiting)); FD_ZERO (fd_waiting); } FD_SET ((int) request->handle, fd_waiting); node_relink_before (request, &wait_list); wait_count++; } FD_SET ((int) request->handle, request_is_input (request) ? &fd_in_check : &fd_out_check); /* Recalculate both top_socket and new_top_socket. The latter */ /* because we are potentially in the process of recalculating */ /* top_socket in new_top_socket. Subtle. */ top_socket = max (request->handle, top_socket); new_top_socket = max (request->handle, new_top_socket); /* And flag that request is queued. */ request->queued = TRUE; } /* ------------------------------------------------------------------------- * reply_error * * Formats and sends a message containing the socket number and an error * message. */ static void reply_error (QID *qid, char *message, void *tag) { lsend_smtsock_error (qid, /* Send to specified queue */ &sockq, /* No queue for reply */ NULL, NULL, NULL, 0, message, (void *) tag); } /*********************** CREATE READ REPEAT REQUEST **********************/ MODULE create_read_repeat_request (THREAD *thread) { SOCKREQ *request; request = create_small_read_type_request (thread); if (request) { request->repeat = TRUE; process_read_type_request (request); } } /************************ CREATE HUGE READ REQUEST ***********************/ MODULE create_huge_read_request (THREAD *thread) { SOCKREQ *request; request = create_huge_read_type_request (thread); if (request) process_read_type_request (request); } static SOCKREQ * create_huge_read_type_request (THREAD *thread) { SOCKREQ *request = NULL; struct_smtsock_readh *message; /* Get arguments from message */ if (get_smtsock_readh ( thread->event->body, &message)) { raise_exception (fatal_event); return NULL; } if (trace_flag) coprintf ("smtsock: READH min=%ld max=%ld socket=%ld timeout=%d", message->min_size, message->max_size, message->socket, message->timeout); if (message->max_size == 0 || message->socket == 0) reply_error (&thread->event->sender, "Null read request", message->tag); else if (message->max_size > UINT_MAX) reply_error (&thread->event->sender, "Read request too large for memory model", message->tag); else if ((request = request_create (&thread->event->sender, SOCK_READ, message->timeout, message->socket, message->tag)) != NULL) { request->huge_block = TRUE; request->max_size = message->max_size; request->min_size = message->min_size ? message->min_size : message->max_size; if (! socket_is_alive (message->socket)) { send_closed_reply (request); request = NULL; } } free_smtsock_readh (&message); return request; } /******************** CREATE HUGE READ REPEAT REQUEST ********************/ MODULE create_huge_read_repeat_request (THREAD *thread) { SOCKREQ *request; request = create_huge_read_type_request (thread); if (request) { request->repeat = TRUE; process_read_type_request (request); } } /************************** CREATE WRITE REQUEST *************************/ MODULE create_write_request (THREAD *thread) { SOCKREQ *request; struct_smtsock_write *message; /* Get arguments from message */ if (get_smtsock_write ( thread->event->body, &message)) { raise_exception (fatal_event); return; } /* For write requests we do not want to allow a zero timeout, it makes no sense and on some bogus OSes (Solaris) it can cause socket leaks. */ if (message->timeout == 0) message->timeout = WRITE_TIMEOUT; if (trace_flag) coprintf ( "smtsock: WRITE size=%d socket=%ld timeout=%d data=%x %x %x %x", message->size, message->socket, message->timeout, ((byte *) message->data) [0], ((byte *) message->data) [1], ((byte *) message->data) [2], ((byte *) message->data) [3]); if (message->size == 0 || message->socket == 0) reply_error (&thread->event->sender, "Null write request", message->tag); else { if ((request = request_create (&thread->event->sender, SOCK_WRITE, message->timeout, message->socket, message->tag)) != NULL) { request->max_size = message->size; request->min_size = message->size; request->buffer = message->data; request->reply = message->reply; message->data = NULL; /* Avoids deallocation of data */ if (socket_is_alive (message->socket)) request_queue (request); else send_closed_reply (request); } } free_smtsock_write (&message); } /*********************** CREATE HUGE WRITE REQUEST ***********************/ MODULE create_huge_write_request (THREAD *thread) { SOCKREQ *request; struct_smtsock_writeh *message; /* Get arguments from message */ if (get_smtsock_writeh ( thread->event->body, &message)) { raise_exception (fatal_event); return; } /* For write requests we do not want to allow a zero timeout, it makes no sense and on some bogus OSes (Solaris) it can cause socket leaks. */ if (message->timeout == 0) message->timeout = WRITE_TIMEOUT; if (trace_flag) coprintf ( "smtsock: WRITEH size=%ld socket=%ld time=%d data=%x%x%x%x", message->size, message->socket, message->timeout, (byte) message->data [0], (byte) message->data [1], (byte) message->data [2], (byte) message->data [3]) ; if (message->size == 0 || message->socket == 0) reply_error (&thread->event->sender, "Null write request", message->tag); else if (message->size > UINT_MAX) reply_error (&thread->event->sender, "Write request too large for memory model", message->tag); else { if ((request = request_create (&thread->event->sender, SOCK_WRITE, message->timeout, message->socket, message->tag)) != NULL) { request->huge_block = TRUE; request->max_size = message->size; request->min_size = message->size; request->buffer = message->data; request->reply = message->reply; message->data = NULL; /* Avoids deallocation of data */ if (socket_is_alive (message->socket)) request_queue (request); else send_closed_reply (request); } } free_smtsock_writeh (&message); } /************************** CREATE INPUT REQUEST *************************/ MODULE create_input_request (THREAD *thread) { SOCKREQ *request; struct_smtsock_input *message; /* Get arguments from message */ if (get_smtsock_input ( thread->event->body, &message)) { raise_exception (fatal_event); return; } if (trace_flag) /* send_smtoper_info (&operq, */coprintf ("%s", strprintf ("smtsock: INPUT socket=%ld timeout=%d", message->socket, message->timeout)); if (message->socket == 0) reply_error (&thread->event->sender, "Null input request", message->tag); else { if ((request = request_create (&thread->event->sender, SOCK_INPUT, message->timeout, message->socket, message->tag)) != NULL) { if (socket_is_alive (message->socket)) request_queue (request); else send_closed_reply (request); } } free_smtsock_input (&message); } /************************* CREATE OUTPUT REQUEST *************************/ MODULE create_output_request (THREAD *thread) { SOCKREQ *request; struct_smtsock_output *message; /* Get arguments from message */ if (get_smtsock_output ( thread->event->body, &message)) { raise_exception (fatal_event); return; } if (trace_flag) /* send_smtoper_info (&operq, */coprintf ("%s", strprintf ("smtsock: OUTPUT socket=%ld timeout=%d", message->socket, message->timeout)); if (message->socket == 0) reply_error (&thread->event->sender, "Null output request", message->tag); else { if ((request = request_create (&thread->event->sender, SOCK_OUTPUT, message->timeout, message->socket, message->tag)) != NULL) { if (socket_is_alive (message->socket)) request_queue (request); } } free_smtsock_output (&message); } /************************* CREATE CONNECT REQUEST ************************/ MODULE create_connect_request (THREAD *thread) { SOCKREQ *request; struct_smtsock_connect *message; struct sockaddr_in host_addr; /* Structure for connection */ sock_t handle; /* Handle for connection */ /* Get arguments from message */ if (get_smtsock_connect ( thread->event->body, &message)) { raise_exception (fatal_event); return; } if (trace_flag) coprintf ("smtsock: CONNECT type=%s to=%s/%s nbr=%lx/%d timeout=%d", message->type, message->host, message->service, message->address, message->port, message->timeout); /* Build socket address structure and connect to host. Either of the */ /* information pairs (host, service) (address, port) will be used */ /* by the connect function. */ build_sockaddr (&host_addr, message->address, message->port); handle = connect_socket (message->host, message->service, message->type, &host_addr, 3, 0); /* The connect call can fail, in which case we return the connect error */ /* message. If the call succeeds, we need to wait until the socket is */ /* ready for use, since we use non-blocking sockets. We generate a */ /* write request; when this is true we'll send an ok event plus the */ /* socket handle to the calling program. */ if (handle == INVALID_SOCKET) reply_error (&thread->event->sender, connect_errlist [connect_error ()], message->tag); else if (handle > 0) /* Else wait until ready to write */ { if ((request = request_create (&thread->event->sender, SOCK_CONNECT, message->timeout, handle, message->tag)) != NULL) request_queue (request); } free_smtsock_connect (&message); } /************************** CREATE CLOSE REQUEST *************************/ MODULE create_close_request (THREAD *thread) { SOCKREQ *request; struct_smtsock_close *message; int rc; Bool queue; /* Get arguments from message */ if (get_smtsock_close ( thread->event->body, &message)) { raise_exception (fatal_event); return; } if (trace_flag) coprintf ("smtsock: CLOSE socket=%ld", message->socket); if (message->socket == 0) reply_error (&thread->event->sender, "Null close request", message->tag); else { /* If there are no pending requests, try just closing the socket */ /* with a non-blocking call. */ if (! FD_ISSET ((int) message->socket, &fd_err_check)) { queue = FALSE; rc = close_socket (message->socket); if (! rc) { if (message->reply) lsend_smtsock_ok (&thread->event->sender, &sockq, NULL, NULL, NULL, 0, message->tag); } else if (sockerrno == EPIPE || sockerrno == ECONNRESET) lsend_smtsock_closed (&thread->event->sender, &sockq, NULL, NULL, NULL, 0, message->tag); else queue = TRUE; } else queue = TRUE; if (queue) if ((request = request_create (&thread->event->sender, SOCK_CLOSE, message->timeout, message->socket, message->tag)) != NULL) { request->reply = message->reply; request_queue (request); } } free_smtsock_close (&message); } /************************* FLUSH SOCKET REQUESTS *************************/ MODULE flush_socket_requests (THREAD *thread) { struct_smtsock_flush *message; SOCKREQ *request; /* Get arguments from message */ if (get_smtsock_flush ( thread->event->body, &message)) { raise_exception (fatal_event); return; } if (trace_flag) coprintf ("smtsock: FLUSH socket=%ld alltypes=%s", message->socket, message->alltypes ? "TRUE" : "FALSE"); /* Find any requests on the specified socket. We optimise by looking */ /* at the check bitsets to see if there are any requests to delete. */ if (message->alltypes ? FD_ISSET ((int) message->socket, &fd_err_check) : FD_ISSET ((int) message->socket, &fd_in_check)) { /* We know there must be a request so don't bother testing for the */ /* end of the list in this loop. */ request = (SOCKREQ *) main_list.next; while (request->handle != message->socket) request = request->next; /* We separate flush processing into two cases: */ /* 1. Brute force when all requests can be deleted, ie either */ /* alltypes is TRUE or there are no pending output requests. */ /* 2. More delicate if some requests are going to remain */ /* following the flush. */ if (message->alltypes || (! FD_ISSET ((int) message->socket, &fd_out_check))) { /* Clear output bitset here, rest of bitset processing later. */ FD_CLR ((int) message->socket, &fd_out_check); /* Destroy requests in main_list. */ while (((NODE *) request != &main_list) && (request->handle == message->socket)) { request = request->next; request_destroy (request->prev); } /* Destroy requests in wait_list. */ if (wait_count && FD_ISSET ((int) message->socket, fd_waiting)) { FD_CLR ((int) message->socket, fd_waiting); request = (SOCKREQ *) wait_list.next; while (wait_count && ((NODE *) request != &wait_list)) { request = request->next; if (request->prev->handle == message->socket) { request_destroy (request->prev); wait_count--; } } } } else { /* Now deal with the more complicated case of just deleting */ /* input requests. Although more optimisation is possible, we */ /* draw the line in the sand here and just do a merge before */ /* destroying all input requests. Note that any merged */ /* requests which go before the current request must be output */ /* requests, so can be ignored here. */ if (wait_count && FD_ISSET ((int) message->socket, fd_waiting)) merge_waiting_requests_same_socket (&request); /* Skip past output-type requests. */ while (((NODE *) request != &main_list) && (request_is_output (request)) && (request->handle == message->socket)) request = request->next; /* Now we can destroy all requests on this socket. */ while (((NODE *) request != &main_list) && (request->handle == message->socket)) { request = request->next; request_destroy (request->prev); } } /* Now clear input bitset. */ FD_CLR ((int) message->socket, &fd_in_check); /* And error checkset as necessary. */ if (! FD_ISSET ((int) message->socket, &fd_out_check)) FD_CLR ((int) message->socket, &fd_err_check); } free_smtsock_flush (&message); } /************************* FIND TIMED OUT REQUEST ************************/ MODULE find_timed_out_request (THREAD *thread) { struct_smttime_tag *timer_reply; long timeout_id; SOCKREQ *request; /* Get request from event body */ get_smttime_tag (thread->event->body, &timer_reply); timeout_id = (long) timer_reply->tag; free_smttime_tag (&timer_reply); active_request = NULL; FORLIST (request, main_list) { /* Merge as we look for timed-out request - it could still be in */ /* wait_list. */ if (wait_count && FD_ISSET ((int) request->handle, fd_waiting)) merge_waiting_requests_same_socket (&request); /* Identify time-out request by its ID. */ if (timeout_id == request->id) { active_request = request; break; } } } /************************ REPLY TIMEOUT TO REQUEST ***********************/ MODULE reply_timeout_to_request (THREAD *thread) { if (active_request) { if (active_request->type == SOCK_READ) if (active_request->huge_block) send_smtsock_readh_timeout (&active_request->reply_to, active_request->cur_size, active_request->buffer, active_request->tag); else send_smtsock_read_timeout (&active_request->reply_to, (dbyte) active_request->cur_size, active_request->buffer, active_request->tag); else send_smtsock_timeout (&active_request->reply_to, active_request->tag); /* Since timeouts don't necessarily occur in the same order as */ /* requests are made, test that there are no preceding requests of */ /* the same type before clearing the corresponding check bits. */ if (request_is_input (active_request)) { if (((NODE *) active_request->prev == &main_list) || (active_request->prev->handle != active_request->handle) || (request_is_output (active_request->prev))) clear_check_after_input_request (active_request); } else if (((NODE *) active_request->prev == &main_list) || (active_request->prev->handle != active_request->handle)) clear_check_after_output_request (active_request); request_destroy (active_request); } } static void clear_check_after_input_request (SOCKREQ *request) { sock_t handle = request->handle; if (((NODE *) request->next == &main_list) || (request->next->handle != handle)) { FD_CLR ((int) handle, &fd_in_check); if (! FD_ISSET ((int) handle, &fd_out_check)) FD_CLR ((int) handle, &fd_err_check); } } static void clear_check_after_output_request (SOCKREQ *request) { sock_t handle = request->handle; if (((NODE *) request->next == &main_list) || (request_is_input (request->next)) || (request->next->handle != handle)) { FD_CLR ((int) handle, &fd_out_check); if (! FD_ISSET ((int) handle, &fd_in_check)) FD_CLR ((int) handle, &fd_err_check); } } /********************** CHECK FIRST SOCKET ACTIVITY **********************/ MODULE check_first_socket_activity (THREAD *thread) { current_request = (SOCKREQ *) main_list.next; new_top_socket = 0; deleted_walking = FALSE; check_next_socket_activity (thread); } /*********************** CHECK NEXT SOCKET ACTIVITY **********************/ MODULE check_next_socket_activity (THREAD *thread) { sock_t handle; #if defined (DEBUG) if (trace_flag) print_sock_check(); #endif active_request = NULL; while ((NODE *) current_request != &main_list) { handle = current_request->handle; if (wait_count && FD_ISSET ((int) handle, fd_waiting)) merge_waiting_requests_same_socket (&current_request); new_top_socket = max (handle, new_top_socket); /* Now check for any kind of activity on the socket. Error */ /* activity applies to all requests on that socket. Other activty */ /* only applies to one request of the given type (input or output) */ /* so we clear the activity bit in the relevant result set. */ if (FD_ISSET ((int) handle, &fd_err_result)) { active_request = current_request; current_request = current_request->next; } else if (request_is_output (current_request)) { if (FD_ISSET ((int) handle, &fd_out_result)) { active_request = current_request; /* Clear output result immediately. */ FD_CLR ((int) handle, &fd_out_result); /* If request is a close, reply closed to any other */ /* requests on the same socket immediately. */ if (active_request->type == SOCK_CLOSE) { FD_CLR ((int) handle, &fd_out_check); FD_CLR ((int) handle, &fd_in_check); FD_CLR ((int) handle, &fd_in_result); FD_CLR ((int) handle, &fd_err_check); while (((NODE *) current_request->next != &main_list) && (current_request->next->handle == handle)) send_closed_reply (current_request->next); } else clear_check_after_output_request (active_request); } /* Skip past other output requests on this socket. */ do current_request = current_request->next; while (((NODE *) current_request != &main_list) && (current_request->handle == handle) && (request_is_output (current_request))); } else /* Request is input-type. */ { if (FD_ISSET ((int) handle, &fd_in_result)) { active_request = current_request; /* Clear input result immediately and input check if no */ /* further input requests remain. */ FD_CLR ((int) handle, &fd_in_result); if (! active_request->repeat) clear_check_after_input_request (active_request); } /* Skip past other requests on this socket. */ do current_request = current_request->next; while (((NODE *) current_request != &main_list) && (current_request->handle == handle)); } /* If any event got set, we can access it as active_request */ if (active_request) { if (trace_flag) coprintf ("smtsock: -- activity on %d", active_request->handle); break; } } /* End-of-loop processing. Replace top_socket with new_top_socket. */ if ((NODE *) current_request == &main_list) { if (trace_flag && new_top_socket < top_socket) if (trace_flag) coprintf ("smtsock: -- setting top_socket to %d", new_top_socket); top_socket = new_top_socket; /* And if no requests were deleted while the request walk was in */ /* progress then we can flag no deleted requests ie top_socket is */ /* guaranteed to be up-to-date. */ if (! deleted_walking) deleted = FALSE; } # if defined (DEBUG) if (trace_flag) print_sock_check(); # endif } /********************** GENERATE REQUEST TYPE EVENT **********************/ MODULE generate_request_type_event (THREAD *thread) { static event_t request_type_event [] = { read_event, write_event, input_event, output_event, close_event, connect_event }; if (! active_request) the_next_event = no_active_request_event; else if (FD_ISSET ((int) active_request->handle, &fd_err_result)) the_next_event = exception_event; else the_next_event = request_type_event [active_request->type]; } /************************* READ DATA FROM SOCKET *************************/ MODULE read_data_from_socket (THREAD *thread) { /* Read as much data as we can from the request's socket, then */ /* update the request appropriately. */ if (trace_flag) coprintf ("smtsock: reading %d bytes from %ld", active_request->max_size - active_request->cur_size, active_request->handle); handle_partial_io (active_request, read_some_data (active_request)); } /* ------------------------------------------------------------------------- * handle_partial_io * * Handles the return code from a socket read or write, to update the * request size indicators and set the next event. */ static void handle_partial_io (SOCKREQ *request, int bytes_done) { /* If we read something, update the request cur_size, and check if */ /* we got everything. If so, we can signal 'finished'. Else we loop. */ if (bytes_done > 0) { if (request->cur_size >= request->min_size) the_next_event = finished_event; else the_next_event = incomplete_event; } /* If the return code was zero, the socket got closed. Whatever we */ /* got, we'll send back. Some systems return EPIPE or ECONNRESET. */ else if (bytes_done == 0 || sockerrno == EPIPE || sockerrno == ECONNRESET) the_next_event = closed_event; else /* In principle we can't get an EAGAIN, since we waited until the */ /* socket was ready, but you never know. We'll just try again... */ if (sockerrno == EAGAIN || sockerrno == EWOULDBLOCK) the_next_event = incomplete_event; /* Anything else, that's an error */ else the_next_event = error_event; /* If request wasn't completed, set the check bits again. */ if (the_next_event == incomplete_event) { FD_SET ((int) request->handle, &fd_err_check); FD_SET ((int) request->handle, request_is_input (request) ? &fd_in_check : &fd_out_check); } } /************************** WRITE DATA TO SOCKET *************************/ MODULE write_data_to_socket (THREAD *thread) { /* Write as much data as we can to the request's socket, then */ /* update the request appropriately. */ #if defined (DEBUG) if (trace_flag) print_sock_check(); #endif if (trace_flag) coprintf ("smtsock: writing %d bytes to %ld", active_request->max_size - active_request->cur_size, active_request->handle) ; handle_partial_io (active_request, write_some_data (active_request)); #if defined (DEBUG) if (trace_flag) print_sock_check(); #endif } static int write_some_data (SOCKREQ *request) { int rc; rc = write_TCP (request->handle, request->buffer + request->cur_size, (size_t) (request->max_size - request->cur_size)); if (trace_flag) { byte *ptr = (byte *) request->buffer + request->cur_size; coprintf ("smtsock: writing %02x %02x %02x %02x %02x %02x %02x %02x...", ptr [0], ptr [1], ptr [2], ptr [3], ptr [4], ptr [5], ptr [6], ptr [7]); } request->cur_size += rc; return rc; } /************************ CONFIRM SOCKET CONNECTED ***********************/ MODULE confirm_socket_connected (THREAD *thread) { int rc; rc = socket_error (active_request->handle); if (rc) the_next_event = error_event; else the_next_event = finished_event; } /************************** REPLY OK TO REQUEST **************************/ MODULE reply_ok_to_request (THREAD *thread) { #if defined (DEBUG) if (trace_flag) print_sock_check(); #endif send_ok_reply (active_request); #if defined (DEBUG) if (trace_flag) { coprintf ("After send ok"); print_sock_check(); } #endif } /**************************** CLOSE THE SOCKET ***************************/ MODULE close_the_socket (THREAD *thread) { int rc; if (trace_flag) coprintf ("smtsock: closing socket %ld", active_request->handle); rc = close_socket (active_request->handle); if (! rc) the_next_event = finished_event; else if (sockerrno == EPIPE || sockerrno == ECONNRESET) the_next_event = closed_event; /* Anything else, that's an error */ else the_next_event = error_event; } /************************ PROCESS SOCKET EXCEPTION ***********************/ MODULE process_socket_exception (THREAD *thread) { /* This function needs replacing in order for socket exception handling to be done properly. */ /* PH: what the heck does this mean? */ sock_t active_handle; SOCKREQ *request; prepare_to_cancel_all_requests (); /* Now reply exception and destroy each request. */ active_handle = active_request->handle; request = active_request; while (((NODE *) request != &main_list) && (request->handle == active_handle)) { reply_error (&request->reply_to, "Socket exception", request->tag); request = request->next; request_destroy (request->prev); } /* And close the socket. */ close_socket (active_handle); } /* prepare_to_cancel_all_requests is called following an error condition on */ /* a socket. It merges waiting requests on the same socket and clears the */ /* socket from the bitset. All that remains to be done is to reply to the */ /* requests and destroy them. */ static void prepare_to_cancel_all_requests (void) { sock_t active_handle; SOCKREQ *request; /* First backtrack to the first request on this socket. */ active_handle = active_request->handle; request = active_request; while (((NODE *) request->prev != &main_list) && (request->prev->handle == active_handle)) request = request->prev; /* Then merge any waiting requests. */ if (wait_count && FD_ISSET ((int) request->handle, fd_waiting)) merge_waiting_requests_same_socket (&request); /* And set the active request to first request on the socket. */ active_request = request; /* And drop the socket from bitsets */ FD_CLR ((int) active_handle, &fd_in_check); FD_CLR ((int) active_handle, &fd_out_check); FD_CLR ((int) active_handle, &fd_err_check); } /********************** REPLY CLOSED TO ALL REQUESTS *********************/ MODULE reply_closed_to_all_requests (THREAD *thread) { sock_t active_handle; SOCKREQ *request; prepare_to_cancel_all_requests (); /* Now reply closed and destroy each request. */ active_handle = active_request->handle; request = active_request; while (((NODE *) request != &main_list) && (request->handle == active_handle)) { request = request->next; send_closed_reply (request->prev); } } /********************** REPLY ERROR TO ALL REQUESTS **********************/ MODULE reply_error_to_all_requests (THREAD *thread) { sock_t active_handle; SOCKREQ *request; prepare_to_cancel_all_requests (); /* Now reply error and destroy each request. */ active_handle = active_request->handle; request = active_request; while (((NODE *) request != &main_list) && (request->handle == active_handle)) { request = request->next; send_error_reply (request->prev); } /* And close the socket. */ close_socket (active_handle); } static void send_error_reply (SOCKREQ *request) { reply_error (&request->reply_to, (char *) sockmsg (), request->tag); request_destroy (request); } /**************************** REQUEST SHUTDOWN ***************************/ MODULE request_shutdown (THREAD *thread) { smt_shutdown (); } /************************** DESTROY ALL REQUESTS *************************/ MODULE destroy_all_requests (THREAD *thread) { while (main_list.next != &main_list) request_destroy (main_list.next); while (wait_list.next != &wait_list) { request_destroy (wait_list.next); wait_count--; } } /************************* TERMINATE THE THREAD **************************/ MODULE terminate_the_thread (THREAD *thread) { if (fd_waiting) mem_free (fd_waiting); the_next_event = terminate_event; deschedule_polling_function (check_activity_nonblock, NULL); }
{ "pile_set_name": "Github" }
'use strict'; const Binary = require('./binary') const Docker = require('./docker') const Node = require('./node') const Python = require('./python') const Swift = require('./swift') const Php = require('./php') const Sequence = require('./sequence') const Java = require('./java') const Ruby = require('./ruby') class Runtimes { constructor(serverless) { this.serverless = serverless; this.runtimes = [ new Binary(serverless), new Docker(serverless), new Node(serverless), new Python(serverless), new Swift(serverless), new Php(serverless), new Sequence(serverless), new Java(serverless), new Ruby(serverless) ]; } exec (functionObj) { const matched = this.runtimes.find(runtime => runtime.match(functionObj)) if (matched) return Promise.resolve(matched.exec(functionObj)) throw new this.serverless.classes.Error( 'This runtime is not currently supported by the OpenWhisk provider plugin.'); } } module.exports = Runtimes
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2018 Intel Corporation */ #include "igc_mac.h" #include "igc_nvm.h" /** * igc_poll_eerd_eewr_done - Poll for EEPROM read/write completion * @hw: pointer to the HW structure * @ee_reg: EEPROM flag for polling * * Polls the EEPROM status bit for either read or write completion based * upon the value of 'ee_reg'. */ static s32 igc_poll_eerd_eewr_done(struct igc_hw *hw, int ee_reg) { s32 ret_val = -IGC_ERR_NVM; u32 attempts = 100000; u32 i, reg = 0; for (i = 0; i < attempts; i++) { if (ee_reg == IGC_NVM_POLL_READ) reg = rd32(IGC_EERD); else reg = rd32(IGC_EEWR); if (reg & IGC_NVM_RW_REG_DONE) { ret_val = 0; break; } udelay(5); } return ret_val; } /** * igc_acquire_nvm - Generic request for access to EEPROM * @hw: pointer to the HW structure * * Set the EEPROM access request bit and wait for EEPROM access grant bit. * Return successful if access grant bit set, else clear the request for * EEPROM access and return -IGC_ERR_NVM (-1). */ s32 igc_acquire_nvm(struct igc_hw *hw) { s32 timeout = IGC_NVM_GRANT_ATTEMPTS; u32 eecd = rd32(IGC_EECD); s32 ret_val = 0; wr32(IGC_EECD, eecd | IGC_EECD_REQ); eecd = rd32(IGC_EECD); while (timeout) { if (eecd & IGC_EECD_GNT) break; udelay(5); eecd = rd32(IGC_EECD); timeout--; } if (!timeout) { eecd &= ~IGC_EECD_REQ; wr32(IGC_EECD, eecd); hw_dbg("Could not acquire NVM grant\n"); ret_val = -IGC_ERR_NVM; } return ret_val; } /** * igc_release_nvm - Release exclusive access to EEPROM * @hw: pointer to the HW structure * * Stop any current commands to the EEPROM and clear the EEPROM request bit. */ void igc_release_nvm(struct igc_hw *hw) { u32 eecd; eecd = rd32(IGC_EECD); eecd &= ~IGC_EECD_REQ; wr32(IGC_EECD, eecd); } /** * igc_read_nvm_eerd - Reads EEPROM using EERD register * @hw: pointer to the HW structure * @offset: offset of word in the EEPROM to read * @words: number of words to read * @data: word read from the EEPROM * * Reads a 16 bit word from the EEPROM using the EERD register. */ s32 igc_read_nvm_eerd(struct igc_hw *hw, u16 offset, u16 words, u16 *data) { struct igc_nvm_info *nvm = &hw->nvm; u32 i, eerd = 0; s32 ret_val = 0; /* A check for invalid values: offset too large, too many words, * and not enough words. */ if (offset >= nvm->word_size || (words > (nvm->word_size - offset)) || words == 0) { hw_dbg("nvm parameter(s) out of bounds\n"); ret_val = -IGC_ERR_NVM; goto out; } for (i = 0; i < words; i++) { eerd = ((offset + i) << IGC_NVM_RW_ADDR_SHIFT) + IGC_NVM_RW_REG_START; wr32(IGC_EERD, eerd); ret_val = igc_poll_eerd_eewr_done(hw, IGC_NVM_POLL_READ); if (ret_val) break; data[i] = (rd32(IGC_EERD) >> IGC_NVM_RW_REG_DATA); } out: return ret_val; } /** * igc_read_mac_addr - Read device MAC address * @hw: pointer to the HW structure */ s32 igc_read_mac_addr(struct igc_hw *hw) { u32 rar_high; u32 rar_low; u16 i; rar_high = rd32(IGC_RAH(0)); rar_low = rd32(IGC_RAL(0)); for (i = 0; i < IGC_RAL_MAC_ADDR_LEN; i++) hw->mac.perm_addr[i] = (u8)(rar_low >> (i * 8)); for (i = 0; i < IGC_RAH_MAC_ADDR_LEN; i++) hw->mac.perm_addr[i + 4] = (u8)(rar_high >> (i * 8)); for (i = 0; i < ETH_ALEN; i++) hw->mac.addr[i] = hw->mac.perm_addr[i]; return 0; } /** * igc_validate_nvm_checksum - Validate EEPROM checksum * @hw: pointer to the HW structure * * Calculates the EEPROM checksum by reading/adding each word of the EEPROM * and then verifies that the sum of the EEPROM is equal to 0xBABA. */ s32 igc_validate_nvm_checksum(struct igc_hw *hw) { u16 checksum = 0; u16 i, nvm_data; s32 ret_val = 0; for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) { ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data); if (ret_val) { hw_dbg("NVM Read Error\n"); goto out; } checksum += nvm_data; } if (checksum != (u16)NVM_SUM) { hw_dbg("NVM Checksum Invalid\n"); ret_val = -IGC_ERR_NVM; goto out; } out: return ret_val; } /** * igc_update_nvm_checksum - Update EEPROM checksum * @hw: pointer to the HW structure * * Updates the EEPROM checksum by reading/adding each word of the EEPROM * up to the checksum. Then calculates the EEPROM checksum and writes the * value to the EEPROM. */ s32 igc_update_nvm_checksum(struct igc_hw *hw) { u16 checksum = 0; u16 i, nvm_data; s32 ret_val; for (i = 0; i < NVM_CHECKSUM_REG; i++) { ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data); if (ret_val) { hw_dbg("NVM Read Error while updating checksum.\n"); goto out; } checksum += nvm_data; } checksum = (u16)NVM_SUM - checksum; ret_val = hw->nvm.ops.write(hw, NVM_CHECKSUM_REG, 1, &checksum); if (ret_val) hw_dbg("NVM Write Error while updating checksum.\n"); out: return ret_val; }
{ "pile_set_name": "Github" }
require 'spec_helper' module RubyEventStore RSpec.describe SerializedRecord do let(:event_id) { "event_id" } let(:data) { "data" } let(:metadata) { "metadata" } let(:event_type) { "event_type" } let(:timestamp) { "2019-10-03T22:25:22Z" } let(:time) { Time.utc(2019, 10, 03, 22, 25, 22) } specify 'constructor accept all arguments and returns frozen instance' do record = described_class.new(event_id: event_id, data: data, metadata: metadata, event_type: event_type, timestamp: timestamp) expect(record.event_id).to be event_id expect(record.metadata).to be metadata expect(record.data).to be data expect(record.event_type).to be event_type expect(record.frozen?).to be true end specify 'constructor raised SerializedRecord::StringsRequired when argument is not a String' do [[1, 1, 1, 1], [1, "string", "string", "string"], ["string", "string", "string", 1]].each do |sample| event_id, data, metadata, event_type = sample expect do described_class.new(event_id: event_id, data: data, metadata: metadata, event_type: event_type, timestamp: timestamp) end.to raise_error SerializedRecord::StringsRequired end end specify "in-equality" do [ ["a", "a", "a", "a", "a"], ["b", "a", "a", "a", "a"], ["a", "b", "a", "a", "a"], ["a", "a", "b", "a", "a"], ["a", "a", "a", "b", "a"], ["a", "a", "a", "a", "b"], ].permutation(2).each do |one, two| a = SerializedRecord.new(event_id: one[0], data: one[1], metadata: one[2], event_type: one[3], timestamp: one[4]) b = SerializedRecord.new(event_id: two[0], data: two[1], metadata: two[2], event_type: two[3], timestamp: two[4]) c = Class.new(SerializedRecord).new(event_id: one[0], data: one[1], metadata: one[2], event_type: one[3], timestamp: one[4]) expect(a).not_to eq(b) expect(a).not_to eql(b) expect(a.hash).not_to eq(b.hash) h = {a => :val} expect(h[b]).to be_nil expect(a).not_to eq(c) expect(a).not_to eql(c) expect(a.hash).not_to eq(c.hash) h = {a => :val} expect(h[c]).to be_nil end end specify "equality" do a = SerializedRecord.new(event_id: "a", data: "b", metadata: "c", event_type: "d", timestamp: "e") b = SerializedRecord.new(event_id: "a", data: "b", metadata: "c", event_type: "d", timestamp: "e") expect(a).to eq(b) expect(a).to eql(b) expect(a.hash).to eql(b.hash) h = {a => :val} expect(h[b]).to eq(:val) end specify "hash" do a = SerializedRecord.new(event_id: "a", data: "b", metadata: "c", event_type: "d", timestamp: "e") expect(a.hash).not_to eq([SerializedRecord, "a", "b", "c", "d", "e"].hash) end specify "to_h" do a = SerializedRecord.new(event_id: "a", data: "b", metadata: "c", event_type: "d", timestamp: "e") expect(a.to_h).to eq({ event_id: "a", data: "b", metadata: "c", event_type: "d", timestamp: "e", }) end specify 'constructor raised when required args are missing' do expect do described_class.new end.to raise_error ArgumentError end specify '#deserialize' do actual = SerializedRecord.new(event_id: "a", data: "--- b\n", metadata: "--- c\n", event_type: "d", timestamp: timestamp) expected = Record.new(event_id: "a", data: "b", metadata: "c", event_type: "d", timestamp: time) expect(actual.deserialize(YAML)).to eq(expected) end end end
{ "pile_set_name": "Github" }
<?php namespace App\Models\Blogs; use App\Models\BaseModel; use App\Models\Blogs\Traits\Attribute\BlogAttribute; use App\Models\Blogs\Traits\Relationship\BlogRelationship; use App\Models\ModelTrait; use Illuminate\Database\Eloquent\SoftDeletes; class Blog extends BaseModel { use ModelTrait, SoftDeletes, BlogAttribute, BlogRelationship { // BlogAttribute::getEditButtonAttribute insteadof ModelTrait; } protected $fillable = [ 'name', 'slug', 'publish_datetime', 'content', 'meta_title', 'cannonical_link', 'meta_keywords', 'meta_description', 'status', 'featured_image', 'created_by', ]; protected $dates = [ 'publish_datetime', 'created_at', 'updated_at', ]; /** * The database table used by the model. * * @var string */ protected $table; public function __construct(array $attributes = []) { parent::__construct($attributes); $this->table = config('module.blogs.table'); } }
{ "pile_set_name": "Github" }
// // UIImageViewModeScaleAspect.swift // UIImageViewModeScaleAspect // // Created by Vivien Cormier on 06/07/16. // Copyright © 2016 Vivien Cormier. All rights reserved. // import UIKit @IBDesignable open class UIImageViewModeScaleAspect: UIView { public enum ScaleAspect { case fit case fill } @IBInspectable open var image: UIImage? { didSet { transitionImage.image = image } } internal var transitionImage: UIImageView fileprivate var newTransitionImageFrame: CGRect? fileprivate var newSelfFrame: CGRect? required public init?(coder aDecoder: NSCoder) { transitionImage = UIImageView() transitionImage.contentMode = .center super.init(coder: aDecoder) addSubview(transitionImage) transitionImage.frame = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height) transitionImage.autoresizingMask = [ .flexibleWidth, .flexibleHeight] clipsToBounds = true } override public init(frame: CGRect) { transitionImage = UIImageView(frame: CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)) transitionImage.contentMode = .scaleAspectFit; super.init(frame: frame) addSubview(transitionImage) clipsToBounds = true } //MARK: Automatic animations /** Animate the UIImageView between to UIViewContentModeScaleAspect[Fill, Fit] - Parameters: - scaleAspect: Content mode that you want to change. - frame: Optional parameters. New frame you want to set to your image during the animation. If nil, only the scale aspect is changed. - duration: The total duration of the animations, measured in seconds. If you specify a negative value or 0, the changes are made without animating them. - delay: Optional parameters. The amount of time (measured in seconds) to wait before beginning the animations. Specify a value of 0 to begin the animations immediately. - completion: Optional parameters. A block object to be executed when the animation sequence ends. This block has no return value and takes a single Boolean argument that indicates whether or not the animations actually finished before the completion handler was called. If the duration of the animation is 0, this block is performed at the beginning of the next run loop cycle. This parameter may be NULL. - Returns: Animated image. */ open func animate(_ scaleAspect: ScaleAspect, frame: CGRect? = nil, duration: Double, delay: Double? = nil, completion: ((Bool) -> Void)? = nil) -> Void { var newFrame = self.frame if frame != nil { newFrame = frame! } initialeState(scaleAspect, newFrame: newFrame) var delayAnimation = 0.0 if delay != nil { delayAnimation = delay! } UIView.animate(withDuration: duration, delay: delayAnimation, options: .allowAnimatedContent, animations: { self.transitionState(scaleAspect) }, completion: { (finished) in self.endState(scaleAspect) completion?(finished) }) } //MARK: Manual animations /** If you want to animate yourself the image, you need to call this function before the animation block. - Parameters: - scaleAspect: Content mode that you want to change. - Returns: New frame for the image */ open func initialeState(_ newScaleAspect: ScaleAspect, newFrame: CGRect) -> Void { precondition(transitionImage.image != nil) if newScaleAspect == ScaleAspect.fill && contentMode == .scaleAspectFill || newScaleAspect == ScaleAspect.fit && contentMode == .scaleAspectFit { print("UIImageViewModeScaleAspect - Warning : You are trying to animate your image to \(contentMode) but it's already set.") } let ratio = transitionImage.image!.size.width / transitionImage.image!.size.height if newScaleAspect == ScaleAspect.fill { newTransitionImageFrame = initialeTransitionImageFrame(newScaleAspect, ratio: ratio, newFrame: newFrame) } else { transitionImage.frame = initialeTransitionImageFrame(newScaleAspect, ratio: ratio, newFrame: frame) transitionImage.contentMode = UIViewContentMode.scaleAspectFit; newTransitionImageFrame = CGRect(x: 0, y: 0, width: newFrame.size.width, height: newFrame.size.height); } newSelfFrame = newFrame } /** If you want to animate yourself the image, you need to call this function inside the animation block - Parameters: - scaleAspect: Content mode that you want to change. - Returns: New frame for the image */ open func transitionState(_ scaleAspect: ScaleAspect) -> Void { transitionImage.frame = newTransitionImageFrame! super.frame = newSelfFrame! } /** If you want to animate yourself the image, you need to call this function in the completion block of the animation. - Parameters: - scaleAspect: Content mode that you want to change. - Returns: New frame for the image */ open func endState(_ scaleAspect: ScaleAspect) -> Void { if scaleAspect == ScaleAspect.fill { transitionImage.contentMode = .scaleAspectFill; transitionImage.frame = CGRect(x: 0, y: 0, width: self.frame.size.width, height: self.frame.size.height); } } //MARK: Override override open var frame: CGRect { didSet { transitionImage.frame = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height) } } override open var contentMode: UIViewContentMode { get { return transitionImage.contentMode } set(newContentMode) { transitionImage.contentMode = newContentMode } } //MARK: Private fileprivate static func contentMode(_ scaleAspect: ScaleAspect) -> UIViewContentMode { switch scaleAspect { case .fit: return UIViewContentMode.scaleAspectFit case .fill: return UIViewContentMode.scaleAspectFill } } fileprivate func initialeTransitionImageFrame(_ scaleAspect: ScaleAspect, ratio: CGFloat, newFrame: CGRect) -> CGRect { var selectFrameFormula = false let ratioSelf = newFrame.size.width / newFrame.size.height if (ratio > ratioSelf ) { selectFrameFormula = true } if scaleAspect == ScaleAspect.fill { if (selectFrameFormula) { return CGRect( x: -(newFrame.size.height * ratio - newFrame.size.width) / 2.0, y: 0, width: newFrame.size.height * ratio, height: newFrame.size.height) }else{ return CGRect(x: 0, y: -(newFrame.size.width / ratio - newFrame.size.height) / 2.0, width: newFrame.size.width, height: newFrame.size.width / ratio) } } else { if (selectFrameFormula) { return CGRect( x: -(frame.size.height * ratio - frame.size.width) / 2.0, y: 0, width: frame.size.height * ratio, height: frame.size.height) }else{ return CGRect(x: 0, y: -(frame.size.width / ratio - frame.size.height) / 2.0, width: frame.size.width, height: frame.size.width / ratio) } } } }
{ "pile_set_name": "Github" }
<?php namespace App\Http\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier; class VerifyCsrfToken extends BaseVerifier { /** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ // ]; }
{ "pile_set_name": "Github" }
<testcase> # # For this test the server rejects the EPRT command, # code in lib591 makes use of curl_multi_timeout() # and server does not establish data connection. # <info> <keywords> FTP PORT STOR multi EPRT refused NODATACONN425 </keywords> </info> # Server-side <reply> <data> </data> <servercmd> NODATACONN425 REPLY EPRT 500 we don't like EPRT now </servercmd> </reply> # Client-side <client> <server> ftp </server> <tool> lib591 </tool> <name> FTP multi PORT and 425 on upload </name> <command> ftp://%HOSTIP:%FTPPORT/path/591 %FTPTIME2 log/upload591 </command> <file name="log/upload591"> Moooooooooooo for 591 upload this </file> </client> # Verify data after the test has been "shot" <verify> # Strip off parts of the PORT and EPRT commands that might differ <strippart> s/^PORT (.*)/PORT/ s/^EPRT \|1\|(.*)/EPRT \|1\|/ </strippart> <protocol> USER anonymous PASS [email protected] PWD CWD path EPRT |1| PORT TYPE I STOR 591 QUIT </protocol> # CURLE_FTP_ACCEPT_FAILED = 10 <errorcode> 10 </errorcode> <upload> </upload> </verify> </testcase>
{ "pile_set_name": "Github" }
THD - Technische Hochschule Deggendorf
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{E127ECCB-8AAB-48C4-A4A3-0B9494911B86}</ProjectGuid> <Keyword>Win32Proj</Keyword> <RootNamespace>MPIPTVSource</RootNamespace> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <CharacterSet>MultiByte</CharacterSet> <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>MultiByte</CharacterSet> <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> <TargetExt>.ax</TargetExt> <OutDir>.\bin\Debug\</OutDir> <IntDir>.\obj\Debug\</IntDir> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LinkIncremental>false</LinkIncremental> <TargetExt>.ax</TargetExt> <OutDir>.\bin\Release\</OutDir> <IntDir>.\obj\Release\</IntDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <PrecompiledHeader>Use</PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MPIPTVSOURCE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>$(SolutionDir)baseclasses;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <AdditionalDependencies>strmbasd.lib;winmm.lib;Shlwapi.lib;Ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <ModuleDefinitionFile>mpiptvsource.def</ModuleDefinitionFile> <AdditionalLibraryDirectories>$(SolutionDir)baseclasses\debug\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> </Link> <PostBuildEvent> <Command>IF NOT EXIST "$(SolutionDir)\MPIPTVSource\bin\Debug" mkdir "$(SolutionDir)\MPIPTVSource\bin\Debug" copy /Y "$(TargetPath)" "$(SolutionDir)\MPIPTVSource\bin\Debug\$(TargetFileName)" copy /Y "$(TargetDir)\$(TargetName).pdb" "$(SolutionDir)\MPIPTVSource\bin\Debug\$(TargetName).pdb"</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <WarningLevel>Level3</WarningLevel> <PrecompiledHeader>Use</PrecompiledHeader> <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MPIPTVSOURCE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>$(SolutionDir)baseclasses;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> <SubSystem>Windows</SubSystem> <GenerateDebugInformation>true</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> <ModuleDefinitionFile>mpiptvsource.def</ModuleDefinitionFile> <AdditionalLibraryDirectories>$(SolutionDir)baseclasses\release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalDependencies>strmbase.lib;winmm.lib;Shlwapi.lib;Ws2_32.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> <PostBuildEvent> <Command>IF NOT EXIST "$(SolutionDir)\MPIPTVSource\bin\Release" mkdir "$(SolutionDir)\MPIPTVSource\bin\Release" copy /Y "$(TargetPath)" "$(SolutionDir)\MPIPTVSource\bin\Release\$(TargetFileName)"</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemGroup> <ClInclude Include="Collection.h" /> <ClInclude Include="Crc32.h" /> <ClInclude Include="IMPIPTVConnectInfo.h" /> <ClInclude Include="LinearBuffer.h" /> <ClInclude Include="Logger.h" /> <ClInclude Include="Memory.h" /> <ClInclude Include="MPIPTVSource.h" /> <ClInclude Include="MPIPTVSourceExports.h" /> <ClInclude Include="MPIPTVSourceStream.h" /> <ClInclude Include="Network.h" /> <ClInclude Include="Parameter.h" /> <ClInclude Include="ParameterCollection.h" /> <ClInclude Include="PatParser.h" /> <ClInclude Include="PmtParser.h" /> <ClInclude Include="PmtStreamDescription.h" /> <ClInclude Include="PmtStreamDescriptionCollection.h" /> <ClInclude Include="ProtocolInterface.h" /> <ClInclude Include="stdafx.h" /> <ClInclude Include="Strings.h" /> <ClInclude Include="targetver.h" /> <ClInclude Include="Utilities.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="Crc32.cpp" /> <ClCompile Include="dllmain.cpp"> <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> </PrecompiledHeader> <CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> </PrecompiledHeader> </ClCompile> <ClCompile Include="LinearBuffer.cpp" /> <ClCompile Include="Logger.cpp" /> <ClCompile Include="Memory.cpp" /> <ClCompile Include="MPIPTVSource.cpp" /> <ClCompile Include="MPIPTVSourceStream.cpp" /> <ClCompile Include="Network.cpp" /> <ClCompile Include="Parameter.cpp" /> <ClCompile Include="ParameterCollection.cpp" /> <ClCompile Include="PatParser.cpp" /> <ClCompile Include="PmtParser.cpp" /> <ClCompile Include="PmtStreamDescription.cpp" /> <ClCompile Include="PmtStreamDescriptionCollection.cpp" /> <ClCompile Include="stdafx.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> </ClCompile> <ClCompile Include="Strings.cpp" /> <ClCompile Include="Utilities.cpp" /> </ItemGroup> <ItemGroup> <None Include="mpiptvsource.def" /> <None Include="MPIPTVSource.ini" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> </Project>
{ "pile_set_name": "Github" }
// { dg-options "-std=c++0x" } // { dg-require-cstdint "" } // // 2010-10-13 Paolo Carlini <[email protected]> // // Copyright (C) 2010-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. // 26.5.8.5.1 Class template discrete_distribution // [rand.dist.samp.discrete] #include <random> void test01() { std::discrete_distribution<> u; std::minstd_rand0 rng; u(rng); } int main() { test01(); return 0; }
{ "pile_set_name": "Github" }
#Tootle Stats #Clusters: 25 #CacheIn/Out: 0.949x (0.934/0.985) #OverdrawIn/Out: 2.654x (0.133/0.050) #OverdrawMaxIn/Out: 1.387x (0.312/0.225) v 5.5 0.00122285 -5.99883 v 5.43157 0.651272 -6.21694 v 5.5 1.33553 -5.84915 v 5.5 -1.33736 -5.84915 v 5.43157 -0.653103 -6.21694 v 5.25196 -0.674486 -6.39656 v 5.25196 0.672655 -6.39656 v 5.43157 1.92999 -5.94323 v 5.5 2.60142 -5.40438 v 5.5 -2.60325 -5.40438 v 5.43157 -1.93182 -5.94323 v 5.25196 -1.98741 -6.11858 v 4.99963 -2.0088 -6.18272 v 4.99963 -0.678762 -6.46498 v 4.99963 0.681208 -6.46498 v 5.25196 1.98986 -6.11858 v 5.43157 3.12317 -5.41293 v 5.5 3.739 -4.69018 v 5.5 -3.74083 -4.69018 v 5.43157 -3.125 -5.41293 v 5.25196 -3.21481 -5.57117 v 4.99963 -3.24902 -5.63104 v 0.000244379 -2.0088 -6.18272 v 0.000244379 -0.678762 -6.46498 v 0.000244379 0.681208 -6.46498 v 0.000244379 2.00697 -6.18272 v 4.99963 2.00697 -6.18272 v 4.99963 3.25147 -5.63104 v 5.25196 3.21725 -5.57117 v 5.43157 4.18377 -4.64314 v 5.5 4.69269 -3.74076 v 5.5 -4.69025 -3.74076 v 5.43157 -4.18133 -4.64314 v 5.25196 -4.30535 -4.77999 v 4.99963 -4.34812 -4.83131 v 0.000244379 -3.24902 -5.63104 v 0.000244379 -4.1685 -6.23404 v 0.000244379 -2.8684 -6.93114 v 0.000244379 2.87085 -6.93114 v 0.000244379 4.16667 -6.23404 v 0.000244379 5.30425 -5.30174 v 0.000244379 3.25147 -5.63104 v 0.000244379 4.35056 -4.83131 v 4.99963 4.35056 -4.83131 v 5.25196 4.30352 -4.77999 v 5.25196 5.20589 -3.77925 v 5.43157 5.05621 -3.67234 v 5.5 5.40689 -2.60318 v 5.5 1.9642 -3.39863 v 5.5 -1.96175 -3.39863 v 5.5 -5.40445 -2.60318 v 5.43157 -5.05804 -3.67234 v 5.25196 -5.20344 -3.77925 v 4.99963 -5.25904 -3.82202 v 0.000244379 -4.34812 -4.83131 v 0.000244379 -5.30181 -5.30174 v -2.00122 -4.1685 -6.23404 v -2.00122 -2.8684 -6.93114 v -2.00122 -1.46139 -7.35452 v 0.000244379 -1.46139 -7.35452 v 0.000244379 1.46383 -7.35452 v -2.00122 2.87085 -6.93114 v -2.00122 4.16667 -6.23404 v -2.00122 5.30425 -5.30174 v -2.00122 6.23656 -4.16843 v 0.000244379 6.23656 -4.16843 v 0.000244379 5.25721 -3.82202 v 4.99963 5.25721 -3.82202 v 4.99963 5.9372 -2.64167 v 5.25196 5.87732 -2.61601 v 5.43157 5.71053 -2.54331 v 5.5 5.84739 -1.33729 v 5.5 6.00135 0.00129295 v 5.5 3.92718 0.00129295 v 5.47862 3.77322 0.00129295 v 5.47862 1.88722 -3.26606 v 5.47862 -1.88477 -3.26606 v 5.5 -3.92473 0.00129295 v 5.5 -5.84922 -1.33729 v 5.43157 -5.70809 -2.54331 v 5.25196 -5.87488 -2.61601 v 4.99963 -5.93903 -2.64167 v 0.000244379 -5.25904 -3.82202 v 0.000244379 -6.23411 -4.16843 v -2.00122 -5.30181 -5.30174 v -2.00122 1.46383 -7.35452 v -2.00122 0.00122285 -7.49993 v 0.000244379 0.00122285 -7.49993 v -2.00122 -6.23411 -4.16843 v -2.00122 0.00122285 -4.00164 v -2.00122 1.03617 -3.86479 v -2.00122 1.99841 -3.46278 v -2.00122 6.92938 -2.86833 v 0.000244379 6.92938 -2.86833 v 0.000244379 5.9372 -2.64167 v 0.000244379 6.35631 -1.35012 v 4.99963 6.35631 -1.35012 v 5.25196 6.29216 -1.33729 v 5.43157 6.11254 -1.2988 v 5.4273 6.24511 0.00129295 v 5.46151 6.18952 0.00129295 v 5.43157 6.11254 1.30139 v 5.5 5.84739 1.3356 v 5.5 5.40689 2.60149 v 5.5 1.9642 3.40122 v 5.47862 1.88722 3.26437 v 5.41447 1.81879 3.15317 v 5.41447 3.64064 0.00129295 v 5.41447 1.81879 -3.15059 v 5.41447 -1.82062 -3.15059 v 5.47862 -3.77077 0.00129295 v 5.5 -1.96175 3.40122 v 5.5 -5.9989 0.00129295 v 5.43157 -6.11437 -1.2988 v 5.25196 -6.29399 -1.33729 v 4.99963 -6.35814 -1.35012 v 0.000244379 -5.93903 -2.64167 v 0.000244379 -6.92693 -2.86833 v -2.00122 -6.92693 -2.86833 v -2.00122 -1.03372 -3.86479 v -10.9993 0.00122285 -4.00164 v -10.9993 1.03617 -3.86479 v -10.9993 1.99841 -3.46278 v -10.9993 2.82808 -2.82984 v -2.00122 2.82808 -2.82984 v -2.00122 3.4653 -2.00017 v -2.00122 7.35704 -1.46132 v 0.000244379 7.35704 -1.46132 v 0.000244379 7.49817 0.00129295 v 0.000244379 6.50171 0.00129295 v 4.99963 6.50171 0.00129295 v 5.19208 6.46322 0.00129295 v 5.2434 6.42473 0.00129295 v 5.35459 6.35203 0.00129295 v 5.25196 6.29216 1.3356 v 5.25196 5.87732 2.61859 v 5.43157 5.71053 2.54162 v 5.43157 5.05621 3.67492 v 5.5 4.69269 3.73907 v 5.47862 -1.88477 3.26864 v 5.41447 -1.82062 3.15317 v 5.32038 -1.7693 3.06764 v 5.32038 1.77175 3.06764 v 5.32038 3.54228 0.00129295 v 5.32038 1.77175 -3.06506 v 5.32038 -1.7693 -3.06506 v 5.41447 -3.6382 0.00129295 v 5.32038 -3.53983 0.00129295 v 5.21347 -3.48424 0.00129295 v 5.21347 -1.74365 3.01632 v 5.21347 1.74181 3.01632 v 5.21347 3.48241 0.00129295 v 5.21347 1.74181 -3.01801 v 5.21347 -1.74365 -3.01801 v 5.098 -1.73082 -3.00091 v 5.098 -3.46285 0.00129295 v 5.098 -1.73082 2.99922 v 5.098 1.73326 2.99922 v 5.098 3.4653 0.00129295 v 5.098 1.73326 -3.00091 v 0.000244379 1.73326 -3.00091 v 0.000244379 -1.73082 -3.00091 v 0.000244379 -3.46285 0.00129295 v 0.000244379 -1.73082 2.99922 v 0.000244379 1.73326 2.99922 v 0.000244379 3.4653 0.00129295 v 5.5 -4.69025 3.73907 v 5.5 -5.40445 2.60149 v 5.5 -5.84922 1.3356 v 5.46151 -6.19135 0.00129295 v 5.4273 -6.24694 0.00129295 v 5.35459 -6.35386 0.00129295 v 5.2434 -6.42656 0.00129295 v 4.99963 -6.49927 0.00129295 v 0.000244379 -6.35814 -1.35012 v 0.000244379 -7.35459 -1.46132 v -2.00122 -7.35459 -1.46132 v -2.00122 -2.82991 -2.82984 v -2.00122 -2.00024 -3.46278 v -10.9993 -1.03372 -3.86479 v -12 0.00122285 -3.00091 v -12 0.929253 -2.85122 v -12 1.7632 -2.42784 v -12 2.42608 -1.76496 v -10.9993 3.4653 -2.00017 v -10.9993 3.86303 -1.03365 v -2.00122 3.86303 -1.03365 v -2.00122 3.99988 0.00129295 v -2.00122 7.49817 0.00129295 v -2.00122 7.35704 1.4639 v 0.000244379 7.35704 1.4639 v 0.000244379 6.35631 1.35271 v 4.99963 6.35631 1.35271 v 4.99963 5.9372 2.64425 v 4.99963 5.25721 3.82033 v 5.25196 5.20589 3.78184 v 5.25196 4.30352 4.78257 v 5.43157 4.18377 4.64572 v 5.5 3.739 4.69276 v 5.5 -3.74083 4.69276 v 5.43157 -4.18133 4.64572 v 5.43157 -5.05804 3.67492 v 5.43157 -5.70809 2.54162 v 5.43157 -6.11437 1.30139 v 5.25196 -6.29399 1.3356 v 5.19208 -6.46078 0.00129295 v 4.99963 -6.35814 1.35271 v 0.000244379 -6.49927 0.00129295 v 0.000244379 -7.5 0.00129295 v -2.00122 -7.5 0.00129295 v -2.00122 -3.86486 -1.03365 v -2.00122 -3.46285 -2.00017 v -10.9993 -2.82991 -2.82984 v -10.9993 -2.00024 -3.46278 v -12 -0.926807 -2.85122 v -12 -1.76503 -2.42784 v -12 -2.42791 -1.76496 v -12 2.85374 -0.926737 v -12 2.99915 0.00129295 v -10.9993 3.99988 0.00129295 v -10.9993 3.86303 1.03624 v -2.00122 3.86303 1.03624 v -2.00122 3.4653 1.99848 v -2.00122 2.82808 2.82815 v -2.00122 6.92938 2.87092 v 0.000244379 6.92938 2.87092 v 0.000244379 5.9372 2.64425 v 0.000244379 5.25721 3.82033 v 0.000244379 4.35056 4.82962 v 4.99963 4.35056 4.82962 v 5.25196 3.21725 5.56947 v 5.43157 3.12317 5.41124 v 5.5 2.60142 5.40696 v 5.5 -2.60325 5.40696 v 5.43157 -3.125 5.41124 v 5.25196 -4.30535 4.78257 v 5.25196 -5.20344 3.78184 v 5.25196 -5.87488 2.61859 v 4.99963 -5.93903 2.64425 v 0.000244379 -6.35814 1.35271 v 0.000244379 -7.35459 1.4639 v -2.00122 -7.35459 1.4639 v -2.00122 -4.00171 0.00129295 v -10.9993 -3.86486 -1.03365 v -10.9993 -3.46285 -2.00017 v -12 -2.85129 -0.926737 v -12 -3.00098 0.00129295 v -12 2.85374 0.929323 v -10.9993 3.4653 1.99848 v -10.9993 2.82808 2.82815 v -2.00122 1.99841 3.46537 v -2.00122 1.03617 3.8631 v -2.00122 6.23656 4.16674 v 0.000244379 6.23656 4.16674 v 0.000244379 5.30425 5.30432 v 0.000244379 3.25147 5.62935 v 4.99963 3.25147 5.62935 v 5.25196 1.98986 6.11688 v 5.43157 1.92999 5.94582 v 5.5 1.33553 5.84746 v 5.5 -1.33736 5.84746 v 5.43157 -1.93182 5.94582 v 5.25196 -3.21481 5.56947 v 4.99963 -3.24902 5.62935 v 4.99963 -4.34812 4.82962 v 4.99963 -5.25904 3.82033 v 0.000244379 -5.93903 2.64425 v 0.000244379 -6.92693 2.87092 v -2.00122 -6.92693 2.87092 v -2.00122 -3.46285 1.99848 v -2.00122 -3.86486 1.03624 v -10.9993 -4.00171 0.00129295 v -10.9993 -3.86486 1.03624 v -12 -2.85129 0.929323 v -12 2.42608 1.76327 v -12 1.7632 2.42615 v -10.9993 1.99841 3.46537 v -10.9993 1.03617 3.8631 v -2.00122 0.00122285 3.99995 v -2.00122 -6.23411 4.16674 v -2.00122 -5.30181 5.30432 v -2.00122 5.30425 5.30432 v -2.00122 4.16667 6.23663 v 0.000244379 4.16667 6.23663 v 0.000244379 2.00697 6.18103 v 4.99963 2.00697 6.18103 v 5.25196 0.672655 6.39914 v 5.43157 0.651272 6.21525 v 5.5 0.00122285 6.00142 v 5.43157 -0.653103 6.21525 v 5.25196 -1.98741 6.11688 v 4.99963 -2.0088 6.18103 v 0.000244379 -3.24902 5.62935 v 0.000244379 -4.34812 4.82962 v 0.000244379 -5.25904 3.82033 v 0.000244379 -6.23411 4.16674 v -2.00122 -2.00024 3.46537 v -2.00122 -2.82991 2.82815 v -10.9993 -3.46285 1.99848 v -12 -2.42791 1.76327 v -12 -1.76503 2.42615 v -12 -0.926807 2.85381 v -12 0.929253 2.85381 v -12 0.00122285 2.99922 v -10.9993 0.00122285 3.99995 v -10.9993 -1.03372 3.8631 v -2.00122 -1.03372 3.8631 v -10.9993 -2.00024 3.46537 v -10.9993 -2.82991 2.82815 v 0.000244379 -5.30181 5.30432 v 0.000244379 -4.1685 6.23663 v -2.00122 -4.1685 6.23663 v -2.00122 -2.8684 6.92945 v -2.00122 2.87085 6.92945 v 0.000244379 2.87085 6.92945 v 0.000244379 0.681208 6.46329 v 4.99963 0.681208 6.46329 v 5.25196 -0.674486 6.39914 v 4.99963 -0.678762 6.46329 v 0.000244379 -2.0088 6.18103 v 0.000244379 -0.678762 6.46329 v 0.000244379 -2.8684 6.92945 v 0.000244379 -1.46139 7.35711 v -2.00122 -1.46139 7.35711 v -2.00122 1.46383 7.35711 v 0.000244379 1.46383 7.35711 v 0.000244379 0.00122285 7.49824 v -2.00122 0.00122285 7.49824 f 161 166 162 f 162 166 163 f 163 166 165 f 163 165 164 f 158 164 165 f 107 142 143 f 142 150 143 f 143 150 151 f 150 157 151 f 151 157 158 f 157 164 158 f 157 163 164 f 142 149 150 f 149 156 150 f 150 156 157 f 156 163 157 f 156 162 163 f 142 148 149 f 148 154 149 f 141 148 142 f 141 147 148 f 146 148 147 f 149 155 156 f 108 145 109 f 108 144 145 f 144 153 145 f 144 152 153 f 152 159 153 f 153 159 160 f 159 166 160 f 160 166 161 f 108 143 144 f 143 151 144 f 144 151 152 f 151 158 152 f 152 158 159 f 158 165 159 f 159 165 166 f 110 146 147 f 109 146 110 f 109 145 146 f 145 154 146 f 146 154 148 f 145 153 154 f 153 160 154 f 154 160 155 f 149 154 155 f 155 160 161 f 155 161 162 f 155 162 156 f 283 314 284 f 283 313 314 f 313 324 314 f 314 324 325 f 314 325 315 f 283 312 313 f 312 322 313 f 282 312 283 f 281 312 282 f 281 311 312 f 255 282 283 f 313 323 324 f 280 310 281 f 253 280 281 f 253 279 280 f 279 307 280 f 280 307 297 f 269 280 297 f 269 296 280 f 253 281 282 f 253 282 254 f 269 297 298 f 269 298 270 f 242 269 270 f 242 268 269 f 242 270 271 f 242 271 243 f 210 242 243 f 210 241 242 f 210 243 211 f 177 210 211 f 177 209 210 f 177 211 212 f 177 212 178 f 119 177 178 f 119 176 177 f 119 178 179 f 119 179 120 f 89 119 120 f 89 118 119 f 89 120 90 f 65 89 90 f 64 89 65 f 64 85 89 f 84 89 85 f 65 90 91 f 65 91 92 f 65 92 93 f 65 93 66 f 92 125 93 f 93 125 126 f 93 126 127 f 93 127 94 f 126 187 127 f 127 187 188 f 127 188 189 f 127 189 128 f 188 222 189 f 189 222 190 f 129 189 190 f 190 222 223 f 190 223 224 f 190 224 225 f 190 225 191 f 224 251 225 f 225 251 252 f 225 252 253 f 225 253 226 f 252 279 253 f 41 64 65 f 324 327 328 f 324 328 325 f 325 328 326 f 37 57 58 f 57 62 58 f 58 62 86 f 58 86 59 f 38 58 59 f 57 63 62 f 39 62 63 f 57 85 63 f 63 85 64 f 40 63 64 f 56 85 57 f 61 86 62 f 59 87 60 f 59 86 87 f 86 88 87 f 248 275 249 f 248 274 275 f 274 300 275 f 275 300 301 f 275 301 276 f 250 275 276 f 247 274 248 f 247 273 274 f 273 299 274 f 274 299 300 f 219 247 248 f 219 246 247 f 244 247 246 f 219 248 220 f 220 248 221 f 247 272 273 f 300 309 301 f 180 215 181 f 181 215 182 f 121 181 182 f 182 215 183 f 123 182 183 f 122 182 123 f 183 215 216 f 183 216 184 f 124 183 184 f 214 216 215 f 302 306 305 f 302 305 304 f 302 304 303 f 276 302 303 f 276 301 302 f 301 308 302 f 278 304 305 f 278 303 304 f 277 303 278 f 276 303 277 f 184 218 185 f 184 217 218 f 217 246 218 f 218 246 219 f 186 218 219 f 184 216 217 f 213 217 216 f 217 245 246 f 124 184 185 f 124 185 125 f 92 124 125 f 92 123 124 f 123 183 124 f 125 185 126 f 126 185 186 f 126 186 187 f 186 220 187 f 187 220 188 f 185 218 186 f 186 219 220 f 91 123 92 f 91 122 123 f 221 248 249 f 221 249 223 f 221 223 222 f 188 221 222 f 188 220 221 f 223 249 224 f 224 249 250 f 224 250 251 f 250 277 251 f 251 277 252 f 252 277 278 f 252 278 279 f 249 275 250 f 250 276 277 f 278 305 279 f 279 305 306 f 279 306 307 f 306 308 307 f 297 307 308 f 297 308 309 f 297 309 298 f 298 309 299 f 270 298 299 f 270 299 271 f 302 308 306 f 271 299 273 f 299 309 300 f 301 309 308 f 178 212 213 f 212 245 213 f 213 245 217 f 211 245 212 f 211 244 245 f 244 246 245 f 211 243 244 f 243 272 244 f 244 272 247 f 243 271 272 f 271 273 272 f 264 292 293 f 264 293 294 f 264 294 265 f 236 264 265 f 236 263 264 f 263 291 264 f 262 291 263 f 265 294 295 f 265 295 266 f 237 265 266 f 236 265 237 f 266 295 267 f 239 266 267 f 235 263 236 f 292 320 293 f 292 319 320 f 319 321 320 f 317 321 319 f 316 321 317 f 286 316 317 f 286 317 287 f 292 318 319 f 317 319 318 f 287 317 318 f 287 318 290 f 290 318 291 f 291 318 292 f 264 291 292 f 285 316 286 f 257 285 286 f 256 285 257 f 230 256 257 f 229 256 230 f 195 229 230 f 195 228 229 f 257 286 258 f 231 257 258 f 230 257 231 f 197 230 231 f 195 230 197 f 195 197 196 f 138 196 197 f 258 286 287 f 258 287 259 f 197 231 232 f 231 258 232 f 173 206 174 f 180 214 215 f 179 214 180 f 178 214 179 f 178 213 214 f 213 216 214 f 120 179 180 f 120 180 121 f 90 120 121 f 90 121 122 f 90 122 91 f 121 180 181 f 121 182 122 f 52 81 53 f 53 81 82 f 53 82 54 f 34 53 54 f 33 53 34 f 81 116 82 f 82 116 117 f 82 117 83 f 54 82 83 f 54 83 55 f 81 115 116 f 116 175 117 f 16 29 17 f 16 28 29 f 28 44 29 f 29 44 45 f 29 45 30 f 30 45 46 f 45 68 46 f 46 68 69 f 16 27 28 f 27 42 28 f 28 42 43 f 28 43 44 f 43 68 44 f 44 68 45 f 15 27 16 f 15 26 27 f 26 42 27 f 7 15 16 f 7 14 15 f 14 25 15 f 15 25 26 f 7 16 8 f 14 24 25 f 6 14 7 f 2 6 7 f 43 67 68 f 67 95 68 f 136 196 137 f 136 195 196 f 136 194 195 f 194 228 195 f 194 227 228 f 193 227 194 f 192 227 193 f 131 192 193 f 130 192 131 f 135 194 136 f 135 193 194 f 133 193 135 f 132 193 133 f 131 193 132 f 98 131 132 f 97 131 98 f 97 130 131 f 96 130 97 f 102 135 136 f 98 132 133 f 98 133 99 f 99 133 134 f 133 135 134 f 46 69 70 f 69 97 70 f 70 97 98 f 70 98 71 f 69 96 97 f 69 95 96 f 68 95 69 f 5 12 6 f 6 12 13 f 6 13 14 f 13 24 14 f 13 23 24 f 13 22 23 f 22 36 23 f 12 22 13 f 12 21 22 f 21 35 22 f 22 35 36 f 35 55 36 f 35 54 55 f 34 54 35 f 21 34 35 f 20 34 21 f 11 21 12 f 239 267 240 f 207 239 240 f 207 240 208 f 174 207 208 f 174 208 175 f 116 174 175 f 115 174 116 f 115 173 174 f 191 225 226 f 191 226 227 f 191 227 192 f 129 191 192 f 129 190 191 f 226 228 227 f 226 254 228 f 228 254 229 f 229 254 255 f 229 255 256 f 255 284 256 f 256 284 285 f 284 316 285 f 226 253 254 f 255 283 284 f 254 282 255 f 129 192 130 f 96 129 130 f 96 128 129 f 128 189 129 f 95 128 96 f 94 128 95 f 94 127 128 f 67 94 95 f 66 94 67 f 66 93 94 f 43 66 67 f 41 66 43 f 41 65 66 f 41 43 42 f 26 41 42 f 26 40 41 f 40 64 41 f 25 40 26 f 25 39 40 f 39 63 40 f 25 38 39 f 38 60 39 f 39 60 61 f 39 61 62 f 24 38 25 f 24 37 38 f 37 58 38 f 23 37 24 f 23 36 37 f 36 56 37 f 37 56 57 f 36 55 56 f 55 84 56 f 56 84 85 f 55 83 84 f 83 118 84 f 84 118 89 f 83 117 118 f 117 176 118 f 118 176 119 f 117 175 176 f 175 209 176 f 176 209 177 f 175 208 209 f 208 240 209 f 209 240 241 f 209 241 210 f 240 267 241 f 241 267 268 f 241 268 242 f 267 295 268 f 268 295 296 f 268 296 269 f 294 296 295 f 294 310 296 f 280 296 310 f 293 310 294 f 293 320 310 f 310 320 311 f 281 310 311 f 311 320 321 f 311 321 315 f 311 315 322 f 311 322 312 f 315 321 316 f 284 315 316 f 284 314 315 f 38 59 60 f 313 322 323 f 322 326 323 f 323 326 327 f 323 327 324 f 315 326 322 f 315 325 326 f 326 328 327 f 60 87 88 f 60 88 61 f 61 88 86 f 71 98 99 f 71 99 72 f 48 71 72 f 47 71 48 f 47 70 71 f 46 70 47 f 30 46 47 f 72 99 100 f 72 100 101 f 72 101 73 f 49 72 73 f 48 72 49 f 31 48 49 f 31 47 48 f 30 47 31 f 99 134 100 f 100 134 135 f 100 135 102 f 100 102 101 f 73 101 102 f 73 102 103 f 73 103 74 f 49 73 74 f 49 74 75 f 49 75 76 f 49 76 50 f 32 49 50 f 31 49 32 f 102 137 103 f 103 137 104 f 74 103 104 f 74 104 105 f 74 105 106 f 74 106 75 f 102 136 137 f 232 258 259 f 232 259 233 f 199 232 233 f 198 232 199 f 197 232 198 f 138 197 198 f 233 259 260 f 233 260 234 f 200 233 234 f 199 233 200 f 167 199 200 f 139 199 167 f 139 198 199 f 138 198 139 f 259 288 260 f 260 288 289 f 260 289 261 f 234 260 261 f 234 261 262 f 234 262 235 f 200 234 235 f 200 235 201 f 167 200 201 f 259 287 288 f 287 290 288 f 288 290 289 f 261 289 290 f 261 290 262 f 262 290 291 f 235 262 263 f 167 201 202 f 167 202 168 f 112 167 168 f 112 139 167 f 105 139 112 f 104 139 105 f 104 138 139 f 168 202 203 f 168 203 169 f 112 168 169 f 112 169 113 f 78 112 113 f 78 111 112 f 111 140 112 f 105 112 140 f 105 140 106 f 169 203 204 f 169 204 171 f 169 171 170 f 113 169 170 f 113 170 171 f 113 171 114 f 79 113 114 f 78 113 79 f 51 78 79 f 50 78 51 f 50 77 78 f 77 111 78 f 77 110 111 f 110 147 111 f 111 147 140 f 140 147 141 f 107 140 141 f 106 140 107 f 76 110 77 f 76 109 110 f 75 109 76 f 75 108 109 f 75 107 108 f 107 143 108 f 50 76 77 f 75 106 107 f 107 141 142 f 32 50 51 f 32 51 52 f 32 52 33 f 19 32 33 f 19 31 32 f 18 31 19 f 18 30 31 f 51 80 52 f 51 79 80 f 79 114 80 f 33 52 53 f 104 137 138 f 137 196 138 f 11 20 21 f 10 20 11 f 10 19 20 f 19 33 20 f 20 33 34 f 4 10 11 f 4 9 10 f 9 18 10 f 10 18 19 f 4 11 5 f 1 4 5 f 1 3 4 f 3 9 4 f 3 8 9 f 8 17 9 f 9 17 18 f 17 30 18 f 17 29 30 f 5 11 12 f 8 16 17 f 2 5 6 f 1 5 2 f 1 2 3 f 2 8 3 f 2 7 8 f 52 80 81 f 80 115 81 f 80 114 115 f 114 172 115 f 115 172 173 f 172 204 173 f 173 204 205 f 173 205 206 f 114 171 172 f 171 204 172 f 203 205 204 f 203 238 205 f 202 238 203 f 202 237 238 f 201 237 202 f 201 236 237 f 201 235 236 f 205 238 207 f 207 238 239 f 238 266 239 f 237 266 238 f 174 205 207 f 174 206 205
{ "pile_set_name": "Github" }
// // System.Web.HttpCacheability.cs // // Author: // Bob Smith <[email protected]> // // (C) Bob Smith // // // 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. // namespace System.Web { public enum HttpCacheability { NoCache = 0x1, Private, Server, Public, ServerAndPrivate, ServerAndNoCache = 0x3 } }
{ "pile_set_name": "Github" }
# -*- coding: ascii -*- # # Util/Counter.py : Fast counter for use with CTR-mode ciphers # # Written in 2008 by Dwayne C. Litzenberger <[email protected]> # # =================================================================== # The contents of this file are dedicated to the public domain. To # the extent that dedication to the public domain is not available, # everyone is granted a worldwide, perpetual, royalty-free, # non-exclusive license to exercise all rights associated with the # contents of this file for any purpose whatsoever. # No rights are reserved. # # 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. # =================================================================== """Fast counter functions for CTR cipher modes. CTR is a chaining mode for symmetric block encryption or decryption. Messages are divideded into blocks, and the cipher operation takes place on each block using the secret key and a unique *counter block*. The most straightforward way to fulfil the uniqueness property is to start with an initial, random *counter block* value, and increment it as the next block is processed. The block ciphers from `Cryptodome.Cipher` (when configured in *MODE_CTR* mode) invoke a callable object (the *counter* parameter) to get the next *counter block*. Unfortunately, the Python calling protocol leads to major performance degradations. The counter functions instantiated by this module will be invoked directly by the ciphers in `Cryptodome.Cipher`. The fact that the Python layer is bypassed lead to more efficient (and faster) execution of CTR cipher modes. An example of usage is the following: >>> from Cryptodome.Cipher import AES >>> from Cryptodome.Util import Counter >>> from Cryptodome import Random >>> >>> nonce = Random.get_random_bytes(8) >>> ctr = Counter.new(64, nonce) >>> key = b'AES-128 symm key' >>> plaintext = b'X'*1000000 >>> cipher = AES.new(key, AES.MODE_CTR, counter=ctr) >>> ciphertext = cipher.encrypt(plaintext) """ from Cryptodome.Util.py3compat import * def new(nbits, prefix=b(""), suffix=b(""), initial_value=1, little_endian=False, allow_wraparound=False): """Create a stateful counter block function suitable for CTR encryption modes. Each call to the function returns the next counter block. Each counter block is made up by three parts:: prefix || counter value || postfix The counter value is incremented by 1 at each call. :Parameters: nbits : integer Length of the desired counter value, in bits. It must be a multiple of 8. prefix : byte string The constant prefix of the counter block. By default, no prefix is used. suffix : byte string The constant postfix of the counter block. By default, no suffix is used. initial_value : integer The initial value of the counter. Default value is 1. little_endian : boolean If *True*, the counter number will be encoded in little endian format. If *False* (default), in big endian format. allow_wraparound : boolean This parameter is ignored. :Returns: An object that can be passed with the 'counter' parameter to a CTR mode cipher. It must hold that ``len(prefix) + nbits//8 + len(suffix)`` matches the block size of the underlying block cipher. """ if (nbits % 8) != 0: raise ValueError("'nbits' must be a multiple of 8") # Ignore wraparound return {"counter_len": nbits // 8, "prefix": prefix, "suffix": suffix, "initial_value": initial_value, "little_endian": little_endian }
{ "pile_set_name": "Github" }
[ { "date": "2025-01-01 00:00:00", "start": "2024-12-31T22:00:00.000Z", "end": "2025-01-01T22:00:00.000Z", "name": "New Year's Day", "type": "public", "rule": "01-01", "_weekday": "Wed" }, { "date": "2025-01-09 00:00:00", "start": "2025-01-08T22:00:00.000Z", "end": "2025-01-09T22:00:00.000Z", "name": "Peace Agreement Day", "type": "public", "rule": "01-09", "_weekday": "Thu" }, { "date": "2025-03-08 00:00:00", "start": "2025-03-07T22:00:00.000Z", "end": "2025-03-08T22:00:00.000Z", "name": "International Women's Day", "type": "public", "rule": "03-08", "_weekday": "Sat" }, { "date": "2025-03-31 00:00:00 -0600", "start": "2025-03-30T16:00:00.000Z", "end": "2025-03-31T16:00:00.000Z", "name": "End of Ramadan (Eid al-Fitr)", "type": "public", "rule": "2 Shawwal", "_weekday": "Mon" }, { "date": "2025-05-16 00:00:00", "start": "2025-05-15T22:00:00.000Z", "end": "2025-05-16T22:00:00.000Z", "name": "SPLA Day", "type": "public", "rule": "05-16", "_weekday": "Fri" }, { "date": "2025-06-08 00:00:00 -0600", "start": "2025-06-07T16:00:00.000Z", "end": "2025-06-08T16:00:00.000Z", "name": "Feast of the Sacrifice (Eid al-Adha)", "type": "public", "rule": "12 Dhu al-Hijjah", "_weekday": "Sun" }, { "date": "2025-07-07 00:00:00", "start": "2025-07-06T22:00:00.000Z", "end": "2025-07-07T22:00:00.000Z", "name": "Mother's Day", "type": "observance", "rule": "1st monday in July", "_weekday": "Mon" }, { "date": "2025-07-09 00:00:00", "start": "2025-07-08T22:00:00.000Z", "end": "2025-07-09T22:00:00.000Z", "name": "Independence Day", "type": "public", "rule": "07-09", "_weekday": "Wed" }, { "date": "2025-07-30 00:00:00", "start": "2025-07-29T22:00:00.000Z", "end": "2025-07-30T22:00:00.000Z", "name": "Martyrs Day", "type": "public", "rule": "07-30", "_weekday": "Wed" }, { "date": "2025-12-25 00:00:00", "start": "2025-12-24T22:00:00.000Z", "end": "2025-12-25T22:00:00.000Z", "name": "Christmas Day", "type": "public", "rule": "12-25", "_weekday": "Thu" }, { "date": "2025-12-28 00:00:00", "start": "2025-12-27T22:00:00.000Z", "end": "2025-12-28T22:00:00.000Z", "name": "Republic Day", "type": "public", "rule": "12-28", "_weekday": "Sun" }, { "date": "2025-12-31 00:00:00", "start": "2025-12-30T22:00:00.000Z", "end": "2025-12-31T22:00:00.000Z", "name": "New Year's Eve", "type": "public", "rule": "12-31", "_weekday": "Wed" } ]
{ "pile_set_name": "Github" }
\documentclass{article} %DIF LATEXDIFF DIFFERENCE FILE %DIF DEL circonflex-old.tex Thu Jun 12 00:01:26 2014 %DIF ADD circonflex-new.tex Thu Jun 12 00:01:26 2014 %DIF PREAMBLE EXTENSION ADDED BY LATEXDIFF %DIF UNDERLINE PREAMBLE %DIF PREAMBLE \RequirePackage[normalem]{ulem} %DIF PREAMBLE \RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} %DIF PREAMBLE \providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}} %DIF PREAMBLE \providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}} %DIF PREAMBLE %DIF SAFE PREAMBLE %DIF PREAMBLE \providecommand{\DIFaddbegin}{} %DIF PREAMBLE \providecommand{\DIFaddend}{} %DIF PREAMBLE \providecommand{\DIFdelbegin}{} %DIF PREAMBLE \providecommand{\DIFdelend}{} %DIF PREAMBLE %DIF FLOATSAFE PREAMBLE %DIF PREAMBLE \providecommand{\DIFaddFL}[1]{\DIFadd{#1}} %DIF PREAMBLE \providecommand{\DIFdelFL}[1]{\DIFdel{#1}} %DIF PREAMBLE \providecommand{\DIFaddbeginFL}{} %DIF PREAMBLE \providecommand{\DIFaddendFL}{} %DIF PREAMBLE \providecommand{\DIFdelbeginFL}{} %DIF PREAMBLE \providecommand{\DIFdelendFL}{} %DIF PREAMBLE %DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF \begin{document} Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w}\`{o}\DIFadd{rld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w}\'{o}\DIFadd{rld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w\^orld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w\"orld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w\H{o}rld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w}\~{o}\DIFadd{rld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w\c{o}rld}\DIFaddend ! \DIFdelbegin \DIFdel{Hello world}\DIFdelend %DIF > Hello w\k{o}rld! \DIFaddbegin \DIFadd{Hello wor}{\DIFadd{\l}}\DIFadd{d}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w}\={o}\DIFadd{rld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w\b{o}rld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w}\.{o}\DIFadd{rld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w\d{o}rld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w\r{o}rld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w\u{o}rld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w\v{o}rld}\DIFaddend ! Hello \DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \DIFadd{w\t{or}ld}\DIFaddend ! Hello\DIFdelbegin \DIFdel{world}\DIFdelend \DIFaddbegin \_world\DIFaddend ! and some real superscript, e.g. a degree sign: \DIFdelbegin \DIFdel{$^\circ$. }\DIFdelend \DIFaddbegin \DIFadd{Water: H$_2$O }\DIFaddend\end{document}
{ "pile_set_name": "Github" }
/* * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.lang; /** * Signals that a method has been invoked at an illegal or * inappropriate time. In other words, the Java environment or * Java application is not in an appropriate state for the requested * operation. * * @author Jonni Kanerva * @since 1.1 */ public class IllegalStateException extends RuntimeException { /** * Constructs an IllegalStateException with no detail message. * A detail message is a String that describes this particular exception. */ public IllegalStateException() { super(); } /** * Constructs an IllegalStateException with the specified detail * message. A detail message is a String that describes this particular * exception. * * @param s the String that contains a detailed message */ public IllegalStateException(String s) { super(s); } /** * Constructs a new exception with the specified detail message and * cause. * * <p>Note that the detail message associated with <code>cause</code> is * <i>not</i> automatically incorporated in this exception's detail * message. * * @param message the detail message (which is saved for later retrieval * by the {@link Throwable#getMessage()} method). * @param cause the cause (which is saved for later retrieval by the * {@link Throwable#getCause()} method). (A {@code null} value * is permitted, and indicates that the cause is nonexistent or * unknown.) * @since 1.5 */ public IllegalStateException(String message, Throwable cause) { super(message, cause); } /** * Constructs a new exception with the specified cause and a detail * message of {@code (cause==null ? null : cause.toString())} (which * typically contains the class and detail message of {@code cause}). * This constructor is useful for exceptions that are little more than * wrappers for other throwables (for example, {@link * java.security.PrivilegedActionException}). * * @param cause the cause (which is saved for later retrieval by the * {@link Throwable#getCause()} method). (A {@code null} value is * permitted, and indicates that the cause is nonexistent or * unknown.) * @since 1.5 */ public IllegalStateException(Throwable cause) { super(cause); } static final long serialVersionUID = -1848914673093119416L; }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright 2016 Hippo Seven ~ ~ 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. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="?attr/dialogPreferredPadding" android:paddingTop="@dimen/abc_dialog_padding_top_material" android:paddingBottom="@dimen/abc_dialog_padding_top_material" android:paddingRight="?attr/dialogPreferredPadding"> <com.hippo.widget.ProgressView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" style="@style/ProgressView"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="@string/please_wait"/> </LinearLayout>
{ "pile_set_name": "Github" }
// Copyright (c) 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. /** * @extends {WebInspector.Object} * @constructor */ WebInspector.SharedSidebarModel = function() { WebInspector.Object.call(this); this._node = WebInspector.context.flavor(WebInspector.DOMNode); WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._onNodeChanged, this); } /** * @param {?WebInspector.DOMNode} node * @return {?WebInspector.DOMNode} */ WebInspector.SharedSidebarModel.elementNode = function(node) { if (node && node.nodeType() === Node.TEXT_NODE && node.parentNode) node = node.parentNode; if (node && node.nodeType() !== Node.ELEMENT_NODE) node = null; return node; } WebInspector.SharedSidebarModel.Events = { ComputedStyleChanged: "ComputedStyleChanged" } WebInspector.SharedSidebarModel.prototype = { /** * @return {?WebInspector.DOMNode} */ node: function() { return this._node; }, /** * @return {?WebInspector.CSSStyleModel} */ cssModel: function() { return this._cssModel; }, /** * @param {!WebInspector.Event} event */ _onNodeChanged: function(event) { this._node = /** @type {?WebInspector.DOMNode} */(event.data); this._updateTarget(this._node ? this._node.target() : null); this._onComputedStyleChanged(); }, /** * @param {?WebInspector.Target} target */ _updateTarget: function(target) { if (this._target === target) return; if (this._target) { this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded, this._onComputedStyleChanged, this); this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved, this._onComputedStyleChanged, this); this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._onComputedStyleChanged, this); this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged, this._onComputedStyleChanged, this); this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.PseudoStateForced, this._onComputedStyleChanged, this); this._cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.ModelWasEnabled, this._onComputedStyleChanged, this); this._domModel.removeEventListener(WebInspector.DOMModel.Events.DOMMutated, this._onComputedStyleChanged, this); } this._target = target; if (target) { this._cssModel = WebInspector.CSSStyleModel.fromTarget(target); this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded, this._onComputedStyleChanged, this); this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved, this._onComputedStyleChanged, this); this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._onComputedStyleChanged, this); this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged, this._onComputedStyleChanged, this); this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.PseudoStateForced, this._onComputedStyleChanged, this); this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.ModelWasEnabled, this._onComputedStyleChanged, this); this._domModel = WebInspector.DOMModel.fromTarget(target); this._domModel.addEventListener(WebInspector.DOMModel.Events.DOMMutated, this._onComputedStyleChanged, this); } }, /** * @return {?WebInspector.DOMNode} */ _elementNode: function() { return WebInspector.SharedSidebarModel.elementNode(this.node()); }, /** * @return {!Promise.<?WebInspector.SharedSidebarModel.ComputedStyle>} */ fetchComputedStyle: function() { var elementNode = this._elementNode(); var cssModel = this.cssModel(); if (!elementNode || !cssModel) return Promise.resolve(/** @type {?WebInspector.SharedSidebarModel.ComputedStyle} */(null)); if (!this._computedStylePromise) this._computedStylePromise = cssModel.computedStylePromise(elementNode.id).then(verifyOutdated.bind(this, elementNode)); return this._computedStylePromise; /** * @param {!WebInspector.DOMNode} elementNode * @param {?Map.<string, string>} style * @return {?WebInspector.SharedSidebarModel.ComputedStyle} * @this {WebInspector.SharedSidebarModel} */ function verifyOutdated(elementNode, style) { return elementNode === this._elementNode() && style ? new WebInspector.SharedSidebarModel.ComputedStyle(elementNode, style) : /** @type {?WebInspector.SharedSidebarModel.ComputedStyle} */(null); } }, _onComputedStyleChanged: function() { delete this._computedStylePromise; this.dispatchEventToListeners(WebInspector.SharedSidebarModel.Events.ComputedStyleChanged); }, __proto__: WebInspector.Object.prototype } /** * @constructor * @param {!WebInspector.DOMNode} node * @param {!Map.<string, string>} computedStyle */ WebInspector.SharedSidebarModel.ComputedStyle = function(node, computedStyle) { this.node = node; this.computedStyle = computedStyle; }
{ "pile_set_name": "Github" }
/* * Autopsy Forensic Browser * * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier <at> sleuthkit <dot> org * * 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.sleuthkit.autopsy.timeline.ui.listvew; import javafx.scene.control.Menu; import javafx.scene.control.MenuItem; import javafx.scene.control.SeparatorMenuItem; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.MenuElement; import javax.swing.SwingUtilities; /** * Allows creation of JavaFX menus with the same structure as Swing menus and * which invoke the same actions. */ class SwingFXMenuUtils { private SwingFXMenuUtils() { } /** * Factory method that creates a JavaFX MenuItem backed by a swing * MenuElement * * @param jMenuElement The MenuElement to create a JavaFX menu for. * * @return a MenuItem for the given MenuElement */ public static MenuItem createFXMenu(MenuElement jMenuElement) { if (jMenuElement == null) { //Since null is sometime used to represenet a seperator, follow that convention. return new SeparatorMenuItem(); } else if (jMenuElement instanceof JMenu) { return new MenuAdapter((JMenu) jMenuElement); } else if (jMenuElement instanceof JPopupMenu) { return new MenuAdapter((JPopupMenu) jMenuElement); } else { return new MenuItemAdapter((JMenuItem) jMenuElement); } } /** * A JavaFX MenuItem that invokes the backing JMenuItem when clicked. */ private static class MenuItemAdapter extends MenuItem { private MenuItemAdapter(final JMenuItem jMenuItem) { super(jMenuItem.getText()); setDisable(jMenuItem.isEnabled() == false); setOnAction(actionEvent -> SwingUtilities.invokeLater(jMenuItem::doClick)); } } /** * A JavaFX Menu that has the same structure as a given Swing JMenu or * JPopupMenu. */ private static class MenuAdapter extends Menu { /** * Constructor for JMenu * * @param jMenu The JMenu to parallel in this Menu. */ MenuAdapter(final JMenu jMenu) { super(jMenu.getText()); setDisable(jMenu.isEnabled() == false); populateSubMenus(jMenu); } /** * Constructor for JPopupMenu * * @param jPopupMenu The JPopupMenu to parallel in this Menu. */ MenuAdapter(JPopupMenu jPopupMenu) { super(jPopupMenu.getLabel()); setDisable(jPopupMenu.isEnabled() == false); populateSubMenus(jPopupMenu); } /** * Populate the sub menus of this menu. * * @param menu The MenuElement whose sub elements will be used to * populate the sub menus of this menu. */ private void populateSubMenus(MenuElement menu) { for (MenuElement menuElement : menu.getSubElements()) { if (menuElement == null) { //Since null is sometime used to represenet a seperator, follow that convention. getItems().add(new SeparatorMenuItem()); } else if (menuElement instanceof JMenuItem) { getItems().add(SwingFXMenuUtils.createFXMenu(menuElement)); } else if (menuElement instanceof JPopupMenu) { populateSubMenus(menuElement); } else { throw new UnsupportedOperationException("Unown MenuElement subclass: " + menuElement.getClass().getName()); } } } } }
{ "pile_set_name": "Github" }
/// Find missing clk_puts. /// //# This only signals a missing clk_put when there is a clk_put later //# in the same function. //# False positives can be due to loops. // // Confidence: Moderate // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: // Options: virtual context virtual org virtual report @clk@ expression e; statement S,S1; int ret; position p1,p2,p3; @@ e = clk_get@p1(...) ... when != clk_put(e) if (<+...e...+>) S ... when any when != clk_put(e) when != if (...) { ... clk_put(e); ... } ( if (ret == 0) S1 | if (...) { ... return 0; } | if (...) { ... return <+...e...+>; } | *if@p2 (...) { ... when != clk_put(e) when forall return@p3 ...; } ) ... when any clk_put(e); @script:python depends on org@ p1 << clk.p1; p2 << clk.p2; p3 << clk.p3; @@ cocci.print_main("clk_get",p1) cocci.print_secs("if",p2) cocci.print_secs("needed clk_put",p3) @script:python depends on report@ p1 << clk.p1; p2 << clk.p2; p3 << clk.p3; @@ msg = "ERROR: missing clk_put; clk_get on line %s and execution via conditional on line %s" % (p1[0].line,p2[0].line) coccilib.report.print_report(p3[0],msg)
{ "pile_set_name": "Github" }
// is_evenly_divisible_by.hpp --------------------------------------------------------------// // Copyright 2009-2010 Vicente J. Botet Escriba // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt #ifndef BOOST_CHRONO_DETAIL_NO_WARNING_SIGNED_UNSIGNED_CMP_HPP #define BOOST_CHRONO_DETAIL_NO_WARNING_SIGNED_UNSIGNED_CMP_HPP // // We simply cannot include this header on gcc without getting copious warnings of the kind: // //../../../boost/chrono/detail/no_warning/signed_unsigned_cmp.hpp:37: warning: comparison between signed and unsigned integer expressions // // And yet there is no other reasonable implementation, so we declare this a system header // to suppress these warnings. // #if defined(__GNUC__) && (__GNUC__ >= 4) #pragma GCC system_header #elif defined __SUNPRO_CC #pragma disable_warn #elif defined _MSC_VER #pragma warning(push, 1) #endif namespace boost { namespace chrono { namespace detail { template <class T, class U> bool lt(T t, U u) { return t < u; } template <class T, class U> bool gt(T t, U u) { return t > u; } } // namespace detail } // namespace detail } // namespace chrono #if defined __SUNPRO_CC #pragma enable_warn #elif defined _MSC_VER #pragma warning(pop) #endif #endif // BOOST_CHRONO_DETAIL_NO_WARNING_SIGNED_UNSIGNED_CMP_HPP
{ "pile_set_name": "Github" }
{ "Novus G8": { "type": "tablet", "properties": { "Device_Name": "G8", "Device_Code_Name": "G8", "Device_Maker": "Novus", "Device_Pointing_Method": "touchscreen", "Device_Brand_Name": "Novus" }, "standard": true }, "Novus 7.85": { "type": "tablet", "properties": { "Device_Name": "7.85", "Device_Code_Name": "7.85", "Device_Maker": "Novus", "Device_Pointing_Method": "touchscreen", "Device_Brand_Name": "Novus" }, "standard": true } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> <device id="retina4_0" orientation="portrait"> <adaptation id="fullscreen"/> </device> <dependencies> <deployment identifier="iOS"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/> <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> <!--View Controller--> <scene sceneID="tne-QT-ifu"> <objects> <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="wbdownloader" customModuleProvider="target" sceneMemberID="viewController"> <layoutGuides> <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/> <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/> </layoutGuides> <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> <rect key="frame" x="0.0" y="0.0" width="320" height="568"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Kqz-7Q-NI5"> <rect key="frame" x="115" y="270.5" width="205" height="42"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="25"/> <color key="tintColor" red="0.58715379238128662" green="0.030138561502099037" blue="0.18835785984992981" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <state key="normal" title="抓取微博视频"/> <connections> <action selector="parse" destination="BYZ-38-t0r" eventType="touchUpInside" id="WXQ-sZ-QMY"/> </connections> </button> <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="输入某条微博或某博主首页地址" textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="22" translatesAutoresizingMaskIntoConstraints="NO" id="wmj-9p-2BS"> <rect key="frame" x="0.0" y="223.5" width="320" height="27"/> <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <fontDescription key="fontDescription" type="system" pointSize="22"/> <textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="URL" returnKeyType="done" enablesReturnKeyAutomatically="YES"/> </textField> <button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KWX-c9-Xp6"> <rect key="frame" x="0.0" y="270.5" width="115" height="42"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="25"/> <color key="tintColor" red="0.58715379238128662" green="0.030138561502099037" blue="0.18835785984992981" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <state key="normal" title="放弃"/> <connections> <action selector="stopParse" destination="BYZ-38-t0r" eventType="touchUpInside" id="a8a-nL-AmI"/> </connections> </button> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NIZ-D9-G5S"> <rect key="frame" x="270" y="20" width="50" height="50"/> <constraints> <constraint firstAttribute="height" constant="50" id="sLc-Il-h1L"/> <constraint firstAttribute="width" constant="50" id="uCs-ME-I5L"/> </constraints> </button> </subviews> <color key="backgroundColor" red="0.87833553549999999" green="0.87848657370000005" blue="0.8783260584" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstItem="wmj-9p-2BS" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="13z-vN-T15"/> <constraint firstAttribute="trailing" secondItem="wmj-9p-2BS" secondAttribute="trailing" id="9zt-Yx-hBA"/> <constraint firstItem="KWX-c9-Xp6" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="UQH-ey-Dkk"/> <constraint firstItem="NIZ-D9-G5S" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" id="WYp-bu-YgR"/> <constraint firstItem="KWX-c9-Xp6" firstAttribute="centerY" secondItem="Kqz-7Q-NI5" secondAttribute="centerY" id="fEP-An-4O4"/> <constraint firstItem="Kqz-7Q-NI5" firstAttribute="bottom" secondItem="8bC-Xf-vdC" secondAttribute="bottom" multiplier="0.55" id="fPZ-Y9-dnc"/> <constraint firstItem="Kqz-7Q-NI5" firstAttribute="leading" secondItem="KWX-c9-Xp6" secondAttribute="trailing" id="rjX-zL-JIq"/> <constraint firstItem="KWX-c9-Xp6" firstAttribute="width" secondItem="8bC-Xf-vdC" secondAttribute="width" multiplier="0.36" id="rok-rA-U6C"/> <constraint firstItem="NIZ-D9-G5S" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailing" id="tT6-2g-QeD"/> <constraint firstAttribute="trailing" secondItem="Kqz-7Q-NI5" secondAttribute="trailing" id="v0t-RN-1F7"/> <constraint firstItem="Kqz-7Q-NI5" firstAttribute="top" secondItem="wmj-9p-2BS" secondAttribute="bottom" constant="20" id="z9h-Aj-75G"/> </constraints> </view> <connections> <outlet property="moreBtn" destination="NIZ-D9-G5S" id="3pu-AR-j4Z"/> <outlet property="parseBtn" destination="Kqz-7Q-NI5" id="e0T-A5-cdE"/> <outlet property="stopParseBtn" destination="KWX-c9-Xp6" id="R1u-3v-yvB"/> <outlet property="tf" destination="wmj-9p-2BS" id="TuP-V8-uJc"/> </connections> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> </objects> <point key="canvasLocation" x="459.375" y="50.70422535211268"/> </scene> <!--Video TableVC--> <scene sceneID="Lfv-SO-8KG"> <objects> <tableViewController storyboardIdentifier="VideoTableVC" id="Y2S-Dh-P8U" customClass="VideoTableVC" customModule="wbdownloader" customModuleProvider="target" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="150" sectionHeaderHeight="28" sectionFooterHeight="28" id="no8-tA-sjH"> <rect key="frame" x="0.0" y="0.0" width="320" height="568"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <prototypes> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="videoCell" rowHeight="150" id="8mM-0n-4eT" customClass="VideoCell" customModule="wbdownloader" customModuleProvider="target"> <rect key="frame" x="0.0" y="28" width="320" height="150"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="8mM-0n-4eT" id="C9b-KN-Zcz"> <rect key="frame" x="0.0" y="0.0" width="320" height="150"/> <autoresizingMask key="autoresizingMask"/> </tableViewCellContentView> </tableViewCell> </prototypes> <connections> <outlet property="dataSource" destination="Y2S-Dh-P8U" id="l8Z-0e-i6g"/> <outlet property="delegate" destination="Y2S-Dh-P8U" id="hZJ-s8-esA"/> </connections> </tableView> <navigationItem key="navigationItem" id="kkW-qx-Upm"> <barButtonItem key="rightBarButtonItem" systemItem="done" id="Mml-56-28A"> <connections> <action selector="dismiss:" destination="Y2S-Dh-P8U" id="ZDt-TD-oqo"/> </connections> </barButtonItem> </navigationItem> </tableViewController> <placeholder placeholderIdentifier="IBFirstResponder" id="VFs-KR-rkD" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> <point key="canvasLocation" x="1869.375" y="50.70422535211268"/> </scene> <!--NaviVC--> <scene sceneID="klh-EA-Md9"> <objects> <navigationController storyboardIdentifier="navi" automaticallyAdjustsScrollViewInsets="NO" id="hye-OD-TiV" customClass="NaviVC" customModule="wbdownloader" customModuleProvider="target" sceneMemberID="viewController"> <toolbarItems/> <navigationBar key="navigationBar" contentMode="scaleToFill" id="kuD-9g-mVf"> <rect key="frame" x="0.0" y="20" width="320" height="44"/> <autoresizingMask key="autoresizingMask"/> </navigationBar> <nil name="viewControllers"/> <connections> <segue destination="Y2S-Dh-P8U" kind="relationship" relationship="rootViewController" id="1Cg-6u-zYJ"/> </connections> </navigationController> <placeholder placeholderIdentifier="IBFirstResponder" id="pQN-Ol-FGn" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> <point key="canvasLocation" x="1140" y="51"/> </scene> </scenes> </document>
{ "pile_set_name": "Github" }
## # This file is an EasyBuild reciPY as per https://github.com/easybuilders/easybuild # # Copyright:: Copyright 2012-2013 The Cyprus Institute # Authors:: Andreas Panteli <[email protected]>, Thekla Loizou <[email protected]>, # George Tsouloupas <[email protected]> # License:: MIT/GPL # ## easyblock = 'PythonPackage' name = 'Biopython' version = '1.68' versionsuffix = '-Python-%(pyver)s' homepage = 'http://www.biopython.org' description = """Biopython is a set of freely available tools for biological computation written in Python by an international team of developers. It is a distributed collaborative effort to develop Python libraries and applications which address the needs of current and future work in bioinformatics. """ toolchain = {'name': 'intel', 'version': '2016b'} source_urls = ['http://biopython.org/DIST'] sources = [SOURCELOWER_TAR_GZ] dependencies = [ ('Python', '3.5.2') ] sanity_check_paths = { 'files': [], 'dirs': ['lib/python%(pyshortver)s/site-packages/Bio', 'lib/python%(pyshortver)s/site-packages/BioSQL'] } options = {'modulename': 'Bio'} moduleclass = 'bio'
{ "pile_set_name": "Github" }
/* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ package scala.runtime; public class BooleanRef implements java.io.Serializable { private static final long serialVersionUID = -5730524563015615974L; public boolean elem; public BooleanRef(boolean elem) { this.elem = elem; } public String toString() { return String.valueOf(elem); } public static BooleanRef create(boolean e) { return new BooleanRef(e); } public static BooleanRef zero() { return new BooleanRef(false); } }
{ "pile_set_name": "Github" }
// (C) Copyright Edward Diener 2011,2012,2013 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). #if !defined(BOOST_TTI_DETAIL_PTMF_HPP) #define BOOST_TTI_DETAIL_PTMF_HPP #include <boost/config.hpp> #include <boost/mpl/push_front.hpp> #include <boost/function_types/member_function_pointer.hpp> namespace boost { namespace tti { namespace detail { template < class BOOST_TTI_DETAIL_TP_T, class BOOST_TTI_DETAIL_TP_R, class BOOST_TTI_DETAIL_TP_FS, class BOOST_TTI_DETAIL_TP_TAG > struct ptmf_seq { typedef typename boost::function_types::member_function_pointer < typename boost::mpl::push_front < typename boost::mpl::push_front<BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_T>::type, BOOST_TTI_DETAIL_TP_R >::type, BOOST_TTI_DETAIL_TP_TAG >::type type; }; } } } #endif // BOOST_TTI_DETAIL_PTMF_HPP
{ "pile_set_name": "Github" }
/* * Copyright 2016 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.openrtb.json; import static com.google.common.truth.Truth.assertThat; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.openrtb.OpenRtb; import com.google.openrtb.TestExt; import java.io.IOException; /** * Test helper class, to be used for generating and comparing JSON test data. */ class OpenRtbJsonResponseHelper { /** * Response JSON containing: native part as adm string field. */ static final String RESPONSE_SHORT_NOROOT_STRING = OpenRtbJsonFactoryHelper.readFile("RESPONSE_SHORT_NOROOT_STRING.json"); /** * Response JSON containing: native part as adm_native object. */ static final String RESPONSE_SHORT_NOROOT_OBJECT = OpenRtbJsonFactoryHelper.readFile("RESPONSE_SHORT_NOROOT_OBJECT.json"); /** * Response JSON containing: native part as adm string field; root native. enabled */ static final String RESPONSE_SHORT_ROOT___STRING = OpenRtbJsonFactoryHelper.readFile("RESPONSE_SHORT_ROOT___STRING.json"); /** * Response JSON containing: native part as adm_native object; root native. enabled */ static final String RESPONSE_SHORT_ROOT___OBJECT = OpenRtbJsonFactoryHelper.readFile("RESPONSE_SHORT_ROOT___OBJECT.json"); /** * Response JSON containing: native part as adm string field; nearly all possible fields filled. */ static final String RESPONSE_FULL__NOROOT_STRING = OpenRtbJsonFactoryHelper.readFile("RESPONSE_FULL__NOROOT_STRING.json"); /** * Response JSON containing: native part as adm_native object; nearly all possible fields filled. */ static final String RESPONSE_FULL__NOROOT_OBJECT = OpenRtbJsonFactoryHelper.readFile("RESPONSE_FULL__NOROOT_OBJECT.json"); /** * Response JSON containing: native part as adm string field; root native enabled; nearly all * possible fields filled. */ static final String RESPONSE_FULL__ROOT___STRING = OpenRtbJsonFactoryHelper.readFile("RESPONSE_FULL__ROOT___STRING.json"); /** * Response JSON containing: native part as adm_native object; root native enabled; nearly all * possible fields filled. */ static final String RESPONSE_FULL__ROOT___OBJECT = OpenRtbJsonFactoryHelper.readFile("RESPONSE_FULL__ROOT___OBJECT.json"); public static void testJsonGeneratedFiles() throws IOException { assertThat(generateJson(false, false, false)).isEqualTo(RESPONSE_SHORT_NOROOT_STRING); assertThat(generateJson(false, false, true)).isEqualTo(RESPONSE_SHORT_NOROOT_OBJECT); assertThat(generateJson(false, true, false)).isEqualTo(RESPONSE_SHORT_ROOT___STRING); assertThat(generateJson(false, true, true)).isEqualTo(RESPONSE_SHORT_ROOT___OBJECT); assertThat(generateJson(true, false, false)).isEqualTo(RESPONSE_FULL__NOROOT_STRING); assertThat(generateJson(true, false, true)).isEqualTo(RESPONSE_FULL__NOROOT_OBJECT); assertThat(generateJson(true, true, false)).isEqualTo(RESPONSE_FULL__ROOT___STRING); assertThat(generateJson(true, true, true)).isEqualTo(RESPONSE_FULL__ROOT___OBJECT); } public static void main(String[] args) throws IOException { OpenRtbJsonFactoryHelper.writeFile( "openrtb-core/src/test/resources/RESPONSE_SHORT_NOROOT_STRING.json", generateJson(false, false, false)); OpenRtbJsonFactoryHelper.writeFile( "openrtb-core/src/test/resources/RESPONSE_SHORT_NOROOT_OBJECT.json", generateJson(false, false, true)); OpenRtbJsonFactoryHelper.writeFile( "openrtb-core/src/test/resources/RESPONSE_SHORT_ROOT___STRING.json", generateJson(false, true, false)); OpenRtbJsonFactoryHelper.writeFile( "openrtb-core/src/test/resources/RESPONSE_SHORT_ROOT___OBJECT.json", generateJson(false, true, true)); OpenRtbJsonFactoryHelper.writeFile( "openrtb-core/src/test/resources/RESPONSE_FULL__NOROOT_STRING.json", generateJson(true, false, false)); OpenRtbJsonFactoryHelper.writeFile( "openrtb-core/src/test/resources/RESPONSE_FULL__NOROOT_OBJECT.json", generateJson(true, false, true)); OpenRtbJsonFactoryHelper.writeFile( "openrtb-core/src/test/resources/RESPONSE_FULL__ROOT___STRING.json", generateJson(true, true, false)); OpenRtbJsonFactoryHelper.writeFile( "openrtb-core/src/test/resources/RESPONSE_FULL__ROOT___OBJECT.json", generateJson(true, true, true)); } /** * Json generator method. * * @param isFull true, if nearly all fields should be filled; just some selected fields otherwise * @param isRootNative true, if the "native" field should be included as root element * @param isNativeObject true, if the native part should be generated as Json object; * String otherwise * @return not pretty printed String representation of Json */ private static String generateJson(boolean isFull, boolean isRootNative, boolean isNativeObject) throws IOException { ObjectMapper mapper = new ObjectMapper(); Object json = mapper.readValue( generateResponse(isFull, isRootNative, isNativeObject), Object.class); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(json); } private static String generateResponse( boolean isFull, boolean isRootNative, boolean isNativeObject) throws IOException { return isFull ? generateFullResponse(isRootNative, isNativeObject) : generateShortResponse(isRootNative, isNativeObject); } private static String generateShortResponse(boolean isRootNative, boolean isNativeObject) throws IOException { OpenRtbJsonFactory jsonFactory = OpenRtbJsonFactoryHelper.newJsonFactory(isRootNative, isNativeObject); OpenRtb.BidResponse.SeatBid.Bid.Builder seatBid = OpenRtb.BidResponse.SeatBid.Bid.newBuilder() .setId("bid") .setImpid("imp") .setPrice(19.95) .setAdid("adid") .setNurl("http://iwon.com") .addAdomain("http://myads.com") .setIurl("http://mycdn.com/ad.gif") .setCid("cid") .setCrid("crid") .addAttr(OpenRtb.CreativeAttribute.TEXT_ONLY) .setDealid("deal") .setW(100) .setH(80) .setBundle("com.google.testapp") .addCat("IAB10-2") .setExtension(TestExt.testBid, OpenRtbJsonFactoryHelper.test1); OpenRtb.NativeResponse.Builder nativeResponse = OpenRtb.NativeResponse.newBuilder() .setVer("1.0") .setLink(OpenRtb.NativeResponse.Link.newBuilder().setUrl("http://go.there.com")) .addImptrackers("http://my.imp.tracker"); if (isNativeObject) { seatBid.setAdmNative(nativeResponse); } else { seatBid.setAdm(jsonFactory.newNativeWriter().writeNativeResponse(nativeResponse.build())); } OpenRtb.BidResponse.Builder bidResponse = OpenRtb.BidResponse.newBuilder() .setId("resp") .addSeatbid(OpenRtb.BidResponse.SeatBid.newBuilder() .addBid(seatBid) .setSeat("seat")) .setBidid("bid") .setCur("USD") .setCustomdata("mydata") .setNbr(OpenRtb.NoBidReason.TECHNICAL_ERROR); return jsonFactory.newWriter().writeBidResponse(bidResponse.build()); } private static String generateFullResponse(boolean isRootNative, boolean isNativeObject) throws IOException { OpenRtbJsonFactory JsonFactory = OpenRtbJsonFactoryHelper.newJsonFactory(isRootNative, isNativeObject); OpenRtb.BidResponse.SeatBid.Bid.Builder seatBid1 = OpenRtb.BidResponse.SeatBid.Bid.newBuilder() .setId("bid1") .setImpid("imp1") .setPrice(19.95) .setAdid("adid1") .setNurl("http://iwon.com") .addAdomain("http://myads.com") .setIurl("http://mycdn.com/ad.gif") .setCid("cid1") .setCrid("crid1") .addAttr(OpenRtb.CreativeAttribute.TEXT_ONLY) .setDealid("deal1") .setW(100) .setH(80) .setBundle("com.google.testapp") .addCat("IAB10-2") .setExtension(TestExt.testBid, OpenRtbJsonFactoryHelper.test1); OpenRtb.NativeResponse.Builder nativeResponse1 = OpenRtb.NativeResponse.newBuilder() .setVer("1.0") .setLink(OpenRtb.NativeResponse.Link.newBuilder().setUrl("http://go.there.com")) .addImptrackers("http://my.first.imp.tracker"); OpenRtb.BidResponse.SeatBid.Bid.Builder seatBid2 = OpenRtb.BidResponse.SeatBid.Bid.newBuilder() .setId("bid2") .setImpid("imp2") .setPrice(19.95) .setAdid("adid2") .setNurl("http://iwon.com") .addAdomain("http://myads.com") .setIurl("http://mycdn.com/ad.gif") .setCid("cid2") .setCrid("crid2") .addAttr(OpenRtb.CreativeAttribute.TEXT_ONLY) .setDealid("deal2") .setW(100) .setH(80) .setBundle("com.google.testapp") .addCat("IAB10-2") .setExtension(TestExt.testBid, OpenRtbJsonFactoryHelper.test1); OpenRtb.NativeResponse.Builder nativeResponse2 = OpenRtb.NativeResponse.newBuilder() .setVer("2.0") .setLink(OpenRtb.NativeResponse.Link.newBuilder().setUrl("http://go.there.com")) .addImptrackers("http://my.second.imp.tracker"); OpenRtb.BidResponse.SeatBid.Bid.Builder seatBid3 = OpenRtb.BidResponse.SeatBid.Bid.newBuilder() .setId("bid2") .setImpid("imp3") .setPrice(19.95) .setAdid("adid3") .setNurl("http://iwon.com") .addAdomain("http://myads.com") .setIurl("http://mycdn.com/ad.gif") .setCid("cid3") .setCrid("crid3") .addAttr(OpenRtb.CreativeAttribute.TEXT_ONLY) .setDealid("deal3") .setW(100) .setH(80) .setBundle("com.google.testapp") .addCat("IAB10-2") .setExtension(TestExt.testBid, OpenRtbJsonFactoryHelper.test1); OpenRtb.NativeResponse.Builder nativeResponse3 = OpenRtb.NativeResponse.newBuilder() .setVer("3.0") .setLink(OpenRtb.NativeResponse.Link.newBuilder().setUrl("http://go.there.com")) .addImptrackers("http://my.third.imp.tracker"); if (isNativeObject) { seatBid1.setAdmNative(nativeResponse1); seatBid2.setAdmNative(nativeResponse2); seatBid3.setAdmNative(nativeResponse3); } else { seatBid1.setAdm(JsonFactory.newNativeWriter().writeNativeResponse(nativeResponse1.build())); seatBid2.setAdm(JsonFactory.newNativeWriter().writeNativeResponse(nativeResponse2.build())); seatBid3.setAdm(JsonFactory.newNativeWriter().writeNativeResponse(nativeResponse3.build())); } OpenRtb.BidResponse.SeatBid.Builder seat1 = OpenRtb.BidResponse.SeatBid.newBuilder() .addBid(seatBid1) .setSeat("seat1") .setGroup(false) .setExtension(TestExt.testSeat, OpenRtbJsonFactoryHelper.test1); OpenRtb.BidResponse.SeatBid.Builder seat2 = OpenRtb.BidResponse.SeatBid.newBuilder() .addBid(seatBid2) .addBid(seatBid3) .setSeat("seat2") .setGroup(true) .setExtension(TestExt.testSeat, OpenRtbJsonFactoryHelper.test1); OpenRtb.BidResponse.Builder bidResponse = OpenRtb.BidResponse.newBuilder() .setId("resp1") .addSeatbid(seat1) .addSeatbid(seat2) .setBidid("bid1") .setCur("USD") .setCustomdata("mydata") .setNbr(OpenRtb.NoBidReason.TECHNICAL_ERROR) .setExtension(TestExt.testResponse1, OpenRtbJsonFactoryHelper.test1) .addExtension(TestExt.testResponse2, OpenRtbJsonFactoryHelper.test2) .addExtension(TestExt.testResponse2, OpenRtbJsonFactoryHelper.test2) .setExtension(TestExt.testResponse2A, OpenRtbJsonFactoryHelper.test2) .setExtension(TestExt.testResponse2B, OpenRtbJsonFactoryHelper.test2) .setExtension(TestExt.testResponse3, 99) .addExtension(TestExt.testResponse4, 10) .addExtension(TestExt.testResponse4, 20); return JsonFactory.newWriter().writeBidResponse(bidResponse.build()); } }
{ "pile_set_name": "Github" }
@echo off setlocal enabledelayedexpansion setlocal enableextensions set ES_MAIN_CLASS=org.elasticsearch.index.shard.ShardToolCli call "%~dp0elasticsearch-cli.bat" ^ %%* ^ || exit /b 1 endlocal endlocal
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <resources> <!-- Text for context menu item to open the link in a new tab. --> <string name="mozac_feature_contextmenu_open_link_in_new_tab">Åbn link i nyt faneblad</string> <!-- Text for context menu item to open the link in a private tab. --> <string name="mozac_feature_contextmenu_open_link_in_private_tab">Åbn link i privat faneblad</string> <!-- Text for context menu item to open the image in a new tab. --> <string name="mozac_feature_contextmenu_open_image_in_new_tab">Åbn billede i nyt faneblad</string> <!-- Text for context menu item to save / download the link. --> <string name="mozac_feature_contextmenu_download_link">Hent link</string> <!-- Text for context menu item to share the link with an other app. --> <string name="mozac_feature_contextmenu_share_link">Del link</string> <!-- Text for context menu item to share the image with an other app. --> <string name="mozac_feature_contextmenu_share_image">Del billede</string> <!-- Text for context menu item to copy the link to the clipboard. --> <string name="mozac_feature_contextmenu_copy_link">Kopier link</string> <!-- Text for context menu item to copy the URL pointing to the image to the clipboard. --> <string name="mozac_feature_contextmenu_copy_image_location">Kopier billedadresse</string> <!-- Text for context menu item to save / download the image. --> <string name="mozac_feature_contextmenu_save_image">Gem billede</string> <!-- Text for context menu item to save / download the file. --> <string name="mozac_feature_contextmenu_save_file_to_device">Gem fil på enheden</string> <!-- Text for confirmation "snackbar" shown after opening a link in a new tab. --> <string name="mozac_feature_contextmenu_snackbar_new_tab_opened">Nyt faneblad er åbnet</string> <!-- Text for confirmation "snackbar" shown after opening a link in a new private tab. --> <string name="mozac_feature_contextmenu_snackbar_new_private_tab_opened">Et nyt privat faneblad blev åbnet</string> <!-- Text for confirmation "snackbar" shown after copying a link or image URL to the clipboard. --> <string name="mozac_feature_contextmenu_snackbar_link_copied">Link kopieret til udklipsholder</string> <!-- Action shown in a "snacbkar" after opening a new/private tab. Clicking this action will switch to the newly opened tab. --> <string name="mozac_feature_contextmenu_snackbar_action_switch">Skift</string> <!-- Text for context menu item to open the link in an external app. --> <string name="mozac_feature_contextmenu_open_link_in_external_app">Åbn link i en ekstern app</string> <!-- Text for context menu item to share the email with another app. --> <string name="mozac_feature_contextmenu_share_email_address">Del mailadresse</string> <!-- Text for context menu item to copy the email address to the clipboard. --> <string name="mozac_feature_contextmenu_copy_email_address">Kopier mailadresse</string> <!-- Text for confirmation "snackbar" shown after copying a email address to the clipboard. --> <string name="mozac_feature_contextmenu_snackbar_email_address_copied">Mailadresse kopieret til udklipsholder</string> <!-- Text for context menu item to add to a contact. --> <string name="mozac_feature_contextmenu_add_to_contact">Føj til kontakt</string> <!-- Action shown in a text selection context menu. This will prompt a search using the selected text.--> <string name="mozac_selection_context_menu_search_2">Søg</string> <!-- Action shown in a text selection context menu. This will prompt a search in a private tab using the selected text--> <string name="mozac_selection_context_menu_search_privately_2">Privat søgning</string> <!-- Action shown in a text selection context menu. This will prompt a share of the selected text. --> <string name="mozac_selection_context_menu_share">Del</string> <!-- Action shown in a text selection context menu. This will prompt a new email from the selected text. --> <string name="mozac_selection_context_menu_email">Send mail</string> <!-- Action shown in a text selection context menu. This will prompt a new call from the selected text. --> <string name="mozac_selection_context_menu_call">Ring</string> </resources>
{ "pile_set_name": "Github" }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Core\Exception; /** * AccountExpiredException is thrown when the user account has expired. * * @author Fabien Potencier <[email protected]> * @author Alexander <[email protected]> */ class AccountExpiredException extends AccountStatusException { /** * {@inheritdoc} */ public function getMessageKey() { return 'Account has expired.'; } }
{ "pile_set_name": "Github" }
// 0x0500F6E0 static const s16 king_bobomb_seg5_animvalue_0500F6E0[] = { 0x0000, 0x0000, 0xFFFD, 0xFFF4, 0xFFE9, 0xFFE0, 0xFFDC, 0xFFDE, 0xFFE1, 0xFFE6, 0xFFEB, 0xFFF2, 0xFFF8, 0xFFFD, 0x0001, 0x0007, 0x000D, 0x0013, 0x0019, 0x001F, 0x0024, 0x0028, 0x002A, 0x002B, 0x0029, 0x0023, 0x001A, 0x0011, 0x0008, 0x0002, 0x02A5, 0x02A7, 0x02AC, 0x02B2, 0x02B7, 0x02B9, 0x02B9, 0x02B7, 0x02B5, 0x02B2, 0x02B0, 0x02AE, 0x02AD, 0x02AE, 0x02AF, 0x02B1, 0x02B4, 0x02B6, 0x02B9, 0x02BB, 0x02BC, 0x02BD, 0x02BD, 0x02BC, 0x02B8, 0x02B3, 0x02AE, 0x02AA, 0x02A6, 0xFFFB, 0x0000, 0x001C, 0x006C, 0x00E4, 0x017A, 0x0225, 0x02DA, 0x038E, 0x0439, 0x04D0, 0x0548, 0x0597, 0x05B4, 0x05A5, 0x057C, 0x053B, 0x04E7, 0x0483, 0x0412, 0x0399, 0x031A, 0x0299, 0x021A, 0x01A1, 0x0130, 0x00CC, 0x0078, 0x0037, 0x000E, 0x0000, 0x0005, 0x0015, 0x002A, 0x0041, 0x0057, 0x0067, 0x006E, 0x0069, 0x0054, 0x002A, 0xFFEA, 0xFF38, 0xFE00, 0xFCA6, 0xFB8E, 0xFB1D, 0xFC4B, 0xFE8E, 0x0000, 0x0052, 0x007E, 0x008B, 0x0080, 0x0067, 0x0045, 0x0024, 0x000A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0005, 0x0008, 0x000A, 0x0008, 0x0000, 0xFFE9, 0xFFC3, 0xFF9F, 0xFF8C, 0xFF89, 0xFF8D, 0xFF94, 0xFF9F, 0xFFAB, 0xFFB7, 0xFFC1, 0xFFCC, 0xFFDA, 0xFFE8, 0xFFF4, 0xFFFD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0009, 0x001E, 0x0034, 0x003D, 0x0030, 0x0000, 0xFF84, 0xFEC0, 0xFDEF, 0xFD4A, 0xFCC4, 0xFC33, 0xFBA6, 0xFB2B, 0xFAD0, 0xFAA4, 0xFAB6, 0xFB3F, 0xFC45, 0xFD83, 0xFEB9, 0xFFA4, 0x0000, 0x00C8, 0x02AF, 0x050A, 0x072E, 0x0870, 0x0826, 0x05AA, 0x0165, 0xFC3F, 0xF71D, 0xF2E8, 0xF085, 0xF17D, 0xF545, 0xF9A7, 0xFC6E, 0xFD66, 0xFDEB, 0xFE1C, 0xFE1A, 0xFE05, 0xFDFD, 0xFE22, 0xFE76, 0xFEDD, 0xFF46, 0xFFA4, 0xFFE7, 0x0000, 0xFFFF, 0xFFFD, 0xFFFA, 0xFFF9, 0xFFFA, 0x0000, 0x000B, 0x001B, 0x002E, 0x0042, 0x0056, 0x0068, 0x0077, 0x0086, 0x0094, 0x00A2, 0x00B0, 0x00BF, 0x00D4, 0x00F0, 0x0109, 0x0117, 0x0112, 0x00F2, 0x00BC, 0x007C, 0x003F, 0x0011, 0x0000, 0x003F, 0x00E0, 0x01B4, 0x0290, 0x0346, 0x03AA, 0x03C0, 0x03AC, 0x0373, 0x0317, 0x029D, 0x0209, 0x0137, 0x001E, 0xFEE7, 0xFDBB, 0xFCC1, 0xFC24, 0xFC04, 0xFC4D, 0xFCD0, 0xFD63, 0xFDDA, 0xFE41, 0xFEB8, 0xFF31, 0xFF9A, 0xFFE4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFDE, 0xFF92, 0xFF45, 0xFF23, 0xFF53, 0x0000, 0x019D, 0x0420, 0x06F7, 0x098E, 0x0B53, 0x0BB4, 0x09C0, 0x05C3, 0x0105, 0xFCD0, 0xFA69, 0xFA16, 0xFAEA, 0xFC69, 0xFE14, 0xFF71, 0x0000, 0x0000, 0x0001, 0x0003, 0x0004, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0004, 0x0004, 0x0004, 0x0003, 0x0003, 0x0003, 0x0002, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xEA00, 0xE975, 0xE853, 0xE75F, 0xE759, 0xE903, 0xEC4B, 0xF071, 0xF535, 0xFA56, 0xFF95, 0x04B0, 0x096A, 0x0D80, 0x10B4, 0x12F3, 0x1457, 0x14DC, 0x1481, 0x1344, 0x1122, 0x0DC1, 0x0913, 0x038C, 0xFDA2, 0xF7C6, 0xF26D, 0xEE0C, 0xEB17, 0xEECC, 0xEECC, 0xEECC, 0xEECB, 0xEECB, 0xEECB, 0xEECB, 0xEECB, 0xEECC, 0xEECC, 0xEECC, 0xEECC, 0xEECD, 0xEECD, 0xEECD, 0xEECD, 0xEECD, 0xEECD, 0xEECD, 0xEECD, 0xEECD, 0xEECD, 0xEECD, 0xEECD, 0xEECC, 0xEECC, 0xEECC, 0xEECC, 0xEECC, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0004, 0x0004, 0x0003, 0x0002, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0002, 0x0002, 0x0003, 0x0003, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0005, 0x0005, 0xF3C7, 0xF25A, 0xEF18, 0xEB88, 0xE931, 0xE99B, 0xEC82, 0xF073, 0xF52D, 0xFA70, 0xFFFB, 0x058E, 0x0AE9, 0x0FCC, 0x13F6, 0x17B2, 0x1B16, 0x1D95, 0x1EA1, 0x1DAC, 0x1AC2, 0x1691, 0x1178, 0x0BD5, 0x060A, 0x0076, 0xFB7A, 0xF773, 0xF4C2, 0xEECC, 0xEECC, 0xEECB, 0xEECA, 0xEEC9, 0xEEC8, 0xEEC8, 0xEEC8, 0xEEC8, 0xEEC9, 0xEEC9, 0xEEC9, 0xEECA, 0xEECA, 0xEECA, 0xEECA, 0xEECA, 0xEECB, 0xEECB, 0xEECB, 0xEECB, 0xEECB, 0xEECB, 0xEECB, 0xEECC, 0xEECC, 0xEECC, 0xEECC, 0xEECC, 0xC001, 0xC009, 0x0003, 0x0003, 0x0003, 0x0003, 0x0002, 0x0002, 0x0002, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0002, 0x0003, 0x0003, 0x0003, 0xF085, 0xF0F7, 0xF236, 0xF421, 0xF694, 0xF96E, 0xFC8C, 0xFFCC, 0x030C, 0x062A, 0x0904, 0x0B77, 0x0D61, 0x0EA1, 0x0F13, 0x0EAF, 0x0D96, 0x0BE5, 0x09B6, 0x0727, 0x0451, 0x0152, 0xFE46, 0xFB47, 0xF871, 0xF5E1, 0xF3B3, 0xF201, 0xF0E9, 0xF1FC, 0xF1FC, 0xF1FC, 0xF1FC, 0xF1FC, 0xF1FC, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FC, 0xF1FC, 0xF1FC, 0xF1FC, 0xF1FC, 0x0003, 0x0003, 0x0003, 0x0003, 0x0002, 0x0002, 0x0002, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0001, 0x0001, 0x0002, 0x0002, 0x0002, 0x0003, 0x0003, 0x0003, 0xF639, 0xF69F, 0xF7BC, 0xF972, 0xFBA3, 0xFE2F, 0x00F7, 0x03DE, 0x06C6, 0x098F, 0x0C1B, 0x0E4B, 0x1001, 0x111F, 0x1184, 0x112B, 0x1031, 0x0EAE, 0x0CBB, 0x0A71, 0x07E9, 0x053B, 0x0281, 0xFFD5, 0xFD4D, 0xFB03, 0xF910, 0xF78D, 0xF692, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0xF1FD, 0x8001, 0xC000, 0xC000, 0x2000, 0x3FFF, 0xE000, 0x2000, 0x3FFF, 0xE000, 0x054B, 0x0507, 0x0452, 0x0350, 0x0223, 0x00EF, 0xFFD9, 0xFEBB, 0xFD6E, 0xFC0C, 0xFAAE, 0xF96F, 0xF86A, 0xF7B7, 0xF772, 0xF7AC, 0xF854, 0xF950, 0xFA84, 0xFBD7, 0xFD2E, 0xFE6D, 0xFF7B, 0x007A, 0x0193, 0x02AC, 0x03AF, 0x0485, 0x0516, 0x0000, 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0004, 0x0004, 0x0004, 0x0003, 0x0003, 0x0002, 0x0002, 0x0001, 0x0000, 0xFFFF, 0xFFFC, 0xFFFA, 0xFFF7, 0xFFF4, 0xFFF2, 0xFFF1, 0xFFF0, 0xFFF1, 0xFFF3, 0xFFF7, 0xFFFA, 0xFFFD, 0x0000, 0x4000, 0x4055, 0x412A, 0x423E, 0x4352, 0x4427, 0x447C, 0x445B, 0x4403, 0x437E, 0x42DA, 0x4222, 0x4163, 0x40A9, 0x4000, 0x3F50, 0x3E81, 0x3DA3, 0x3CC8, 0x3C00, 0x3B5D, 0x3AEF, 0x3AC6, 0x3B10, 0x3BCF, 0x3CD5, 0x3DF2, 0x3EF7, 0x3FB6, }; // 0x0500FCA4 static const u16 king_bobomb_seg5_animindex_0500FCA4[] = { 0x001D, 0x0001, 0x001D, 0x001E, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x001D, 0x028B, 0x001D, 0x02A8, 0x001D, 0x02C5, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0288, 0x0001, 0x0289, 0x0001, 0x028A, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x01D2, 0x001D, 0x0076, 0x001D, 0x0093, 0x001D, 0x00B0, 0x0001, 0x0000, 0x0001, 0x0000, 0x001D, 0x003C, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0285, 0x0001, 0x0286, 0x0001, 0x0287, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x01D3, 0x001D, 0x00CD, 0x001D, 0x00EA, 0x001D, 0x0107, 0x0001, 0x0000, 0x0001, 0x0000, 0x001D, 0x0059, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0284, 0x001D, 0x01D4, 0x001D, 0x01F1, 0x001D, 0x020E, 0x001D, 0x0124, 0x001D, 0x0141, 0x001D, 0x015E, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0282, 0x0001, 0x0283, 0x001D, 0x022B, 0x001D, 0x0248, 0x001D, 0x0265, 0x001D, 0x017B, 0x001D, 0x0198, 0x001D, 0x01B5, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x003B, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, }; // 0x0500FE18 static const struct Animation king_bobomb_seg5_anim_0500FE18 = { 0, 0, 0, 0, 0x1D, ANIMINDEX_NUMPARTS(king_bobomb_seg5_animindex_0500FCA4), king_bobomb_seg5_animvalue_0500F6E0, king_bobomb_seg5_animindex_0500FCA4, 0, };
{ "pile_set_name": "Github" }
import { connect } from 'react-redux'; import ResponseTextArea from '../../components/response-text-area'; const mapStateToProps = state => { return { tags: state.bioNlp.response.tags, loading: state.bioNlp.loading } } export default connect(mapStateToProps, null)(ResponseTextArea);
{ "pile_set_name": "Github" }
package org.wordpress.android.ui.reader.services.discover import android.app.job.JobParameters import android.app.job.JobService import android.content.Context import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job import org.wordpress.android.WordPress import org.wordpress.android.ui.reader.services.ServiceCompletionListener import org.wordpress.android.ui.reader.services.discover.ReaderDiscoverLogic.DiscoverTasks import org.wordpress.android.util.AppLog import org.wordpress.android.util.AppLog.T.READER import org.wordpress.android.util.LocaleManager import javax.inject.Inject import javax.inject.Named import kotlin.coroutines.CoroutineContext class ReaderDiscoverJobService : JobService(), ServiceCompletionListener, CoroutineScope { @Inject @field:Named("IO_THREAD") lateinit var ioDispatcher: CoroutineDispatcher private lateinit var readerDiscoverLogic: ReaderDiscoverLogic private var job: Job = Job() override val coroutineContext: CoroutineContext get() = ioDispatcher + job override fun attachBaseContext(newBase: Context) { super.attachBaseContext(LocaleManager.setLocale(newBase)) } override fun onStartJob(params: JobParameters): Boolean { AppLog.i(READER, "reader discover job service > started") val task = DiscoverTasks.values()[(params.extras[ReaderDiscoverServiceStarter.ARG_DISCOVER_TASK] as Int)] readerDiscoverLogic.performTasks(task, params) return true } override fun onStopJob(params: JobParameters): Boolean { AppLog.i(READER, "reader discover job service > stopped") jobFinished(params, false) return false } override fun onCreate() { super.onCreate() val component = (application as WordPress).component() component.inject(this) readerDiscoverLogic = ReaderDiscoverLogic(this, this, component) AppLog.i(READER, "reader discover job service > created") } override fun onDestroy() { AppLog.i(READER, "reader discover job service > destroyed") job.cancel() super.onDestroy() } override fun onCompleted(companion: Any) { AppLog.i(READER, "reader discover job service > all tasks completed") jobFinished(companion as JobParameters, false) } }
{ "pile_set_name": "Github" }
--- layout: solution title: "Jenkins and PHP" --- Most web applications are changed and adapted quite frequently and quickly. Their environment, for example the size and the behaviour of the user base, are constantly changing. What was sufficient yesterday can be insufficient today. Especially in a web environment it is important to monitor and continuously improve the internal quality not only when developing, but also when maintaining the software. Many of the plugins referenced (right) can be used to integrate with PHP projects, but may first need to be configured the create appropriately formatted files when working with PHP projects. == Configuring PHP Tools The configurations below assume the use of link:https://ant.apache.org[Apache Ant] as the build tool for executing PHP tools. Originally described on link:https://jenkins-php.org/automation.html[jenkins-php.org]. === PHPUnit The `phpunit` task in the `build.xml` assumes that an XML configuration file for PHPUnit is used to configure the following logging targets: [source,xml] ---- <logging> <log type="coverage-html" target="build/coverage"/> <log type="coverage-clover" target="build/logs/clover.xml"/> <log type="coverage-crap4j" target="build/logs/crap4j.xml"/> <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/> </logging> ---- You can download a sample `phpunit.xml.dist` and place it in your project root to get started. More information can be found in the documentation for PHPUnit. === phpDox The `phpdox` task in the `build.xml` assumes that an XML configuration file for phpDox is used to configure the API documentation generation: [source,xml] ---- <phpdox xmlns="http://xml.phpdox.net/config"> <project name="name-of-project" source="src" workdir="build/phpdox"> <collector publiconly="false"> <include mask="*.php" /> </collector> <generator output="build"> <build engine="html" enabled="true" output="api"> <file extension="html" /> </build> </generator> </project> </phpdox> ---- More information can be found in the documentation for phpDox. === PHP_CodeSniffer The `phpcs` and `phpcs-ci` tasks in the `build.xml` assume that an XML configuration file for PHP_CodeSniffer is used to configure the coding standard: [source,xml] ---- <ruleset name="name-of-your-coding-standard"> <description>Description of your coding standard</description> <rule ref="Generic.PHP.DisallowShortOpenTag"/> <!-- ... --> </ruleset> ---- The build script assumes that the rule sets for PHP_CodeSniffer is located at `build/phpcs.xml`. More information can be found in the documentation for PHP_CodeSniffer. === PHPMD The `phpmd` and `phpmd-ci` tasks in the `build.xml` assume that an XML configuration file for PHPMD is used to configure the coding standard: [source,xml] ---- <ruleset name="name-of-your-coding-standard" xmlns="https://pmd.sf.net/ruleset/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://pmd.sf.net/ruleset/1.0.0 https://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation="https://pmd.sf.net/ruleset_xml_schema.xsd"> <description>Description of your coding standard</description> <rule ref="rulesets/codesize.xml/CyclomaticComplexity" /> <!-- ... --> </ruleset> ---- The build script assumes that the rule sets for PHPMD is located at `build/phpmd.xml`. More information can be found in the documentation for PHPMD. [NOTE] ==== Much of this content was originally created by link:https://sebastian-bergmann.de/[Sebastian Bergmann] and hosted on link:https://jenkins-php.org[Jenkins PHP]. ====
{ "pile_set_name": "Github" }
junit_tests( sources = ["*.scala"], compiler_option_sets = ["fatal_warnings"], strict_deps = True, dependencies = [ "3rdparty/jvm/org/scala-lang/modules:scala-xml", "3rdparty/jvm/org/scalatest", "3rdparty/jvm/org/scalatestplus:junit", "util/util-core:util-core-util", "util/util-intellij/src/main/resources", ], )
{ "pile_set_name": "Github" }
# Using Fsr 408 (Force sensitive resistor) with Raspberry Pi Force sensitive resistors change its resistivity depending on how much it is pressed. This feature allows to detect physical pressure, squeezing and weight. This sample demonstrates use of FSR Interlink 402 model, other types of FSR sensors usage will be pretty identical. FSR generates analog signal so it should be connected to analog input of a controller, as Raspberry Pi haven't analog input one can use ADC converter in between FSR and Rasp Pi. Also you can use collecting capacitor and measure its fill up time to determine if FSR is pressed. From my experience if you need more accurate measurement better to use ADC (Analog to Digital Converter). Else if only need to check/determine if FSR is pressed or not using capacitor could work. This example demonstrates both case. ## Detecting pressure/squeezing with Fsr408, Mcp3008 and Raspberry Pi In below example MCP3008 Analog to Digital Converter used for converting FSR analog output into digital. Read value then can be used for calculating voltage, resistance and pressure force approxinmately. We need to create Mcp3008 instance depending on how you connected it to the controller, [please refer this for more about binding MCP3008](https://github.com/dotnet/iot/tree/master/src/devices/Mcp3008/samples) Code sample for [measuring pressure/squeezing with Fsr408 and ADC converter MCP3008](Program.cs#L24-L37): ```csharp FsrWithAdcSample fsrWithAdc = new FsrWithAdcSample(); while (true) { int value = fsrWithAdc.Read(0); double voltage = fsrWithAdc.CalculateVoltage(value); double resistance = fsrWithAdc.CalculateFsrResistance(voltage); double force = fsrWithAdc.CalculateForce(resistance); Console.WriteLine($"Read value: {value}, milli voltage: {voltage.ToString("f2")}, resistance: {resistance.ToString("f2")}, approximate force in Newtons: {force.ToString("f2")}"); Thread.Sleep(500); } ``` ![Fsr408 with Mcp3008 and Raspberry Pi diagram](Fsr408_Mcp3008_RaspPi.png) Here we supplied 3.3 volt power to FSR, if you use other power source (like 5V) please update _voltageSupplied variable with corresponding value. Also used 10 kOhm resistor, if you are using resistor with diffent resistance please update _resistance variable value for calculating voltage, FSR resistance and pressure force correctly. ## Hardware elements The following elements are used in this sample: * [Force Sensitive Resistor](https://www.adafruit.com/product/166) * [MCP3008](https://www.adafruit.com/product/856) * [Pull down Resistor 10 kOhm](https://www.adafruit.com/product/2784) ## Detecting touch/squeezing with Fsr408, capacitor and Raspberry Pi Using capacitor for reading FSR analog input was producing kind of noisy signal, so from my experience if you only need to check/determine if FSR is pressed or not use of capacitor could serve well, but if you need more fine tuned measurement better use Analog to Digital Converter. You can use the following code to [detect if Force Sensitive Resistor is pressed, using - capacitor](Program.cs#L41-L56): ```csharp FsrWithCapacitorSample fsrWithCapacitor = new FsrWithCapacitorSample(); while (true) { int value = fsrWithCapacitor.ReadCapacitorChargingDuration(); if (value == 30000) { // 30000 is count limit, if we got this count it means Fsr has its highest resistance, so it is not pressed Console.WriteLine("Not pressed"); } else { Console.WriteLine($"Pressed {value}"); } Thread.Sleep(500); } ``` ![Fsr408 with Capacitor and Raspberry Pi diagram](Fsr408_Capacitor_RaspPi.png) Here we are using pin 18 for input, if you are using different pin please update _pinNumber variable. ## Hardware elements The following elements are used in this sample: * [Force Sensitive Resistor](https://www.adafruit.com/product/166) * Capacitor 0.1 micro Farade ## References The sample is based on following resources: * [FSR data sheet](https://cdn-learn.adafruit.com/assets/assets/000/010/126/original/fsrguide.pdf) * [Reading Analog Input from a Potentiometer](https://github.com/dotnet/iot/tree/master/src/devices/Mcp3008/samples) * [Using an FSR](https://learn.adafruit.com/force-sensitive-resistor-fsr/using-an-fsr) * [Basic Resistor Sensor Reading on Raspberry Pi](https://learn.adafruit.com/basic-resistor-sensor-reading-on-raspberry-pi)
{ "pile_set_name": "Github" }
/* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. * 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. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Adam Dunkels <[email protected]> * */ #ifndef __LWIP_IP_H__ #define __LWIP_IP_H__ #include "lwip/opt.h" #include "lwip/def.h" #include "lwip/pbuf.h" #include "lwip/ip_addr.h" #include "lwip/err.h" #include "lwip/netif.h" #ifdef __cplusplus extern "C" { #endif /** Currently, the function ip_output_if_opt() is only used with IGMP */ #define IP_OPTIONS_SEND LWIP_IGMP #define IP_HLEN 20 #define IP_PROTO_ICMP 1 #define IP_PROTO_IGMP 2 #define IP_PROTO_UDP 17 #define IP_PROTO_UDPLITE 136 #define IP_PROTO_TCP 6 /* This is passed as the destination address to ip_output_if (not to ip_output), meaning that an IP header already is constructed in the pbuf. This is used when TCP retransmits. */ #ifdef IP_HDRINCL #undef IP_HDRINCL #endif /* IP_HDRINCL */ #define IP_HDRINCL NULL #if LWIP_NETIF_HWADDRHINT #define IP_PCB_ADDRHINT ;u8_t addr_hint #else #define IP_PCB_ADDRHINT #endif /* LWIP_NETIF_HWADDRHINT */ /* This is the common part of all PCB types. It needs to be at the beginning of a PCB type definition. It is located here so that changes to this common part are made in one location instead of having to change all PCB structs. */ #define IP_PCB \ /* ip addresses in network byte order */ \ ip_addr_t local_ip; \ ip_addr_t remote_ip; \ /* Socket options */ \ u8_t so_options; \ /* Type Of Service */ \ u8_t tos; \ /* Time To Live */ \ u8_t ttl \ /* link layer address resolution hint */ \ IP_PCB_ADDRHINT struct ip_pcb { /* Common members of all PCB types */ IP_PCB; }; /* * Option flags per-socket. These are the same like SO_XXX. */ /*#define SOF_DEBUG 0x01U Unimplemented: turn on debugging info recording */ #define SOF_ACCEPTCONN 0x02U /* socket has had listen() */ #define SOF_REUSEADDR 0x04U /* allow local address reuse */ #define SOF_KEEPALIVE 0x08U /* keep connections alive */ /*#define SOF_DONTROUTE 0x10U Unimplemented: just use interface addresses */ #define SOF_BROADCAST 0x20U /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */ /*#define SOF_USELOOPBACK 0x40U Unimplemented: bypass hardware when possible */ #define SOF_LINGER 0x80U /* linger on close if data present */ /*#define SOF_OOBINLINE 0x0100U Unimplemented: leave received OOB data in line */ /*#define SOF_REUSEPORT 0x0200U Unimplemented: allow local address & port reuse */ /* These flags are inherited (e.g. from a listen-pcb to a connection-pcb): */ #define SOF_INHERITED (SOF_REUSEADDR|SOF_KEEPALIVE|SOF_LINGER/*|SOF_DEBUG|SOF_DONTROUTE|SOF_OOBINLINE*/) #ifdef PACK_STRUCT_USE_INCLUDES # include "arch/bpstruct.h" #endif PACK_STRUCT_BEGIN struct ip_hdr { /* version / header length */ PACK_STRUCT_FIELD(u8_t _v_hl); /* type of service */ PACK_STRUCT_FIELD(u8_t _tos); /* total length */ PACK_STRUCT_FIELD(u16_t _len); /* identification */ PACK_STRUCT_FIELD(u16_t _id); /* fragment offset field */ PACK_STRUCT_FIELD(u16_t _offset); #define IP_RF 0x8000U /* reserved fragment flag */ #define IP_DF 0x4000U /* dont fragment flag */ #define IP_MF 0x2000U /* more fragments flag */ #define IP_OFFMASK 0x1fffU /* mask for fragmenting bits */ /* time to live */ PACK_STRUCT_FIELD(u8_t _ttl); /* protocol*/ PACK_STRUCT_FIELD(u8_t _proto); /* checksum */ PACK_STRUCT_FIELD(u16_t _chksum); /* source and destination IP addresses */ PACK_STRUCT_FIELD(ip_addr_p_t src); PACK_STRUCT_FIELD(ip_addr_p_t dest); } PACK_STRUCT_STRUCT; PACK_STRUCT_END #ifdef PACK_STRUCT_USE_INCLUDES # include "arch/epstruct.h" #endif #define IPH_V(hdr) ((hdr)->_v_hl >> 4) #define IPH_HL(hdr) ((hdr)->_v_hl & 0x0f) #define IPH_TOS(hdr) ((hdr)->_tos) #define IPH_LEN(hdr) ((hdr)->_len) #define IPH_ID(hdr) ((hdr)->_id) #define IPH_OFFSET(hdr) ((hdr)->_offset) #define IPH_TTL(hdr) ((hdr)->_ttl) #define IPH_PROTO(hdr) ((hdr)->_proto) #define IPH_CHKSUM(hdr) ((hdr)->_chksum) #define IPH_VHL_SET(hdr, v, hl) (hdr)->_v_hl = (((v) << 4) | (hl)) #define IPH_TOS_SET(hdr, tos) (hdr)->_tos = (tos) #define IPH_LEN_SET(hdr, len) (hdr)->_len = (len) #define IPH_ID_SET(hdr, id) (hdr)->_id = (id) #define IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off) #define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl = (u8_t)(ttl) #define IPH_PROTO_SET(hdr, proto) (hdr)->_proto = (u8_t)(proto) #define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum) /** The interface that provided the packet for the current callback invocation. */ extern struct netif *current_netif; /** Header of the input packet currently being processed. */ extern const struct ip_hdr *current_header; /** Source IP address of current_header */ extern ip_addr_t current_iphdr_src; /** Destination IP address of current_header */ extern ip_addr_t current_iphdr_dest; #define ip_init() /* Compatibility define, not init needed. */ struct netif *ip_route(ip_addr_t *dest); err_t ip_input(struct pbuf *p, struct netif *inp); err_t ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto); err_t ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif); #if LWIP_NETIF_HWADDRHINT err_t ip_output_hinted(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint); #endif /* LWIP_NETIF_HWADDRHINT */ #if IP_OPTIONS_SEND err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options, u16_t optlen); #endif /* IP_OPTIONS_SEND */ /** Get the interface that received the current packet. * This function must only be called from a receive callback (udp_recv, * raw_recv, tcp_accept). It will return NULL otherwise. */ #define ip_current_netif() (current_netif) /** Get the IP header of the current packet. * This function must only be called from a receive callback (udp_recv, * raw_recv, tcp_accept). It will return NULL otherwise. */ #define ip_current_header() (current_header) /** Source IP address of current_header */ #define ip_current_src_addr() (&current_iphdr_src) /** Destination IP address of current_header */ #define ip_current_dest_addr() (&current_iphdr_dest) /** Gets an IP pcb option (SOF_* flags) */ #define ip_get_option(pcb, opt) ((pcb)->so_options & (opt)) /** Sets an IP pcb option (SOF_* flags) */ #define ip_set_option(pcb, opt) ((pcb)->so_options |= (opt)) /** Resets an IP pcb option (SOF_* flags) */ #define ip_reset_option(pcb, opt) ((pcb)->so_options &= ~(opt)) #if IP_DEBUG void ip_debug_print(struct pbuf *p); #else #define ip_debug_print(p) #endif /* IP_DEBUG */ #ifdef __cplusplus } #endif #endif /* __LWIP_IP_H__ */
{ "pile_set_name": "Github" }
home_modes: entities: - input_boolean.guest_mode - input_boolean.school_mode - input_boolean.alert_mode - input_boolean.speech_notifications - input_boolean.text_notifications - input_boolean.last_message - sensor.low_battery
{ "pile_set_name": "Github" }
<?xml version='1.0' encoding='utf-8'?> <document xmlns="https://code.dccouncil.us/schemas/dc-library" xmlns:codified="https://code.dccouncil.us/schemas/codified" xmlns:codify="https://code.dccouncil.us/schemas/codify" xmlns:xi="http://www.w3.org/2001/XInclude" id="D.C. Law 22-24"> <num type="law">22-24</num> <num type="bill">22-104</num> <num type="act">22-128</num> <heading type="short">Inclusionary Zoning Consistency Amendment Act of 2017</heading> <heading type="long">To amend the Inclusionary Zoning Implementation Amendment Act of 2006 to reflect the changes to the inclusionary zoning regulations adopted by the Zoning Commission for the District of Columbia on October 17, 2016; and to amend the District of Columbia Administrative Procedure Act, the Housing Production Trust Fund Act of 1988, and section 47-902 of the District of Columbia Official Code to make conforming amendments.</heading> <meta> <effective>2017-09-23</effective> <citations> <citation type="law" url="http://lims.dccouncil.us/Download/37357/B22-0104-SignedAct.pdf">D.C. Law 22-24</citation> <citation type="register">64 DCR 7647</citation> </citations> <history> <vote date="2017-05-16" reading="First"/> <vote date="2017-07-11" reading="Final"/> <enacted>2017-07-31</enacted> <summary>Law 22-24 amends income percentages associated with the low-income and middle-income designations within the Metropolitan Statistical Area. </summary> <committee>Committee of the Whole</committee> </history> </meta> <text>BE IT ENACTED BY THE COUNCIL OF THE DISTRICT OF COLUMBIA, That this act may be cited as the "Inclusionary Zoning Consistency Amendment Act of 2017".</text> <section codify:doc="D.C. Code"> <num>2</num> <text>The Inclusionary Zoning Implementation Amendment Act of 2006, effective March 14, 2007 (D.C. Law 16-275; D.C Official Code § 6-1041.01 <em>et seq.</em>), is amended as follows:</text> <para codify:path="§6-1041.01"> <num>(a)</num> <text>Section 101 (D.C. Official Code § 6-1041.01) is amended as follows:</text> <para codify:path="(1)|num"> <num>(1)</num> <text>The existing paragraph (1) is redesignated as paragraph (1A).</text> <codify:find-replace count="1"> <find>(1)</find> <replace>(1A)</replace> </codify:find-replace> </para> <para> <num>(2)</num> <text>A new paragraph (1) is added to read as follows:</text> <include lvl="1"> <para> <codify:insert before="(1A)"/> <num>(1)</num> <text>"Eligible household" means a household of one or more individuals with a total annual income adjusted for household size equal to or less than 50% of the MFI, 60% of the MFI, 80% of the MFI, or other percentage of the MFI established by an order approving a Planned Unit Development pursuant to Chapter 3 of Title 11-X of the District of Columbia Municipal Regulations.</text> </para> </include> <aftertext>.</aftertext> </para> <para codify:path="(2)"> <num>(3)</num> <text>Paragraph (2) is amended by striking the phrase "11 DCMR § 2602.1" and inserting the phrase "Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations" in its place.</text> <codify:find-replace count="1"> <find>2602.1.</find> <replace></replace> </codify:find-replace> <codify:find-replace count="1"> <find>11 DCMR §</find> <replace>Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations.</replace> </codify:find-replace> </para> <para codify:path="(3)"> <num>(4)</num> <text>Paragraph (3) is amended by striking the phrase "low- and moderate-income households as required by the Inclusionary Zoning Program" and inserting the phrase "eligible households as required by the Inclusionary Zoning Program or established by an order approving a Planned Unit Development pursuant to Chapter 3 of Title 11-X of the District of Columbia Municipal Regulations" in its place.</text> <codify:find-replace count="1"> <find>low- and moderate-income households as required by the Inclusionary Zoning Program</find> <replace>eligible households as required by the Inclusionary Zoning Program or established by an order approving a Planned Unit Development pursuant to Chapter 3 of Title 11-X of the District of Columbia Municipal Regulations</replace> </codify:find-replace> </para> <para codify:path="(4)"> <num>(5)</num> <text>Paragraph (4) is amended by striking the phrase "Chapter 26 of Title 11 of the District of Columbia Municipal Regulations (11 DCMR 2600 <em>et seq.</em>), this act, and the regulations" and inserting the phrase "Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations, this act, and the regulations and administrative issuances" in its place.</text> <codify:find-replace count="1"> <find>Chapter 26 of Title 11 of the District of Columbia Municipal Regulations (11 DCMR 2600 et seq.), this subchapter, and the regulations</find> <replace>Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations, <code-cite doc="D.C. Code" path="6|10|II-A">this act</code-cite>, and the regulations and administrative issuances</replace> </codify:find-replace> </para> <para codify:path="(5)"> <num>(6)</num> <text>Paragraph (5) is amended to read as follows:</text> <include lvl="1"> <para> <codify:replace/> <num>(5)</num> <text>"Median Family Income" or "MFI" means the median family income for a household in the Washington Metropolitan Statistical Area as set forth in the periodic calculation provided by the United States Department of Housing and Urban Development, adjusted for family size without regard to any adjustments made by the United States Department of Housing and Urban Development for the purposes of the programs it administers.</text> </para> </include> <aftertext>.</aftertext> </para> <para codify:path="(6)"> <num>(7)</num> <text>Paragraph (6) is repealed.</text> <codify:repeal/> </para> </para> <para codify:path="§6-1041.02|(b)"> <num>(b)</num> <text>Section 102(b) (D.C. Official Code § 6-1041.02(b)) is amended by striking the phrase "Chapter 26 of Title 11" and inserting the phrase "Chapter 10 of Title 11-C" in its place.</text> <codify:find-replace count="1"> <find>Chapter 26 of Title 11</find> <replace>Chapter 10 of Title 11-C</replace> </codify:find-replace> </para> <para codify:path="§6-1041.03"> <num>(c)</num> <text>Section 103 (D.C. Official Code § 6-1041.03) is amended as follows:</text> <para codify:path="(a)"> <num>(1)</num> <text>Subsection (a) is amended as follows:</text> <para codify:path="(3)"> <num>(A)</num> <text>Paragraph (3) is amended by striking the phrase "low-income households shall be set so that a household earning 50% of the Metropolitan Statistical Area median" and inserting the phrase "eligible households shall be set so that an eligible household earning 50% of the MFI, 60% of the MFI, 80% of the MFI, or other percentage of the MFI established by an order approving a Planned Unit Development pursuant to Chapter 3 of Title 11-X of the District of Columbia Municipal Regulations" in its place.</text> <codify:find-replace count="1"> <find>low-income households shall be set so that a household earning 50% of the Metropolitan Statistical Area median</find> <replace>eligible households shall be set so that an eligible household earning 50% of the MFI, 60% of the MFI, 80% of the MFI, or other percentage of the MFI established by an order approving a Planned Unit Development pursuant to Chapter 3 of Title 11-X of the District of Columbia Municipal Regulations</replace> </codify:find-replace> </para> <para codify:path="(4)"> <num>(B)</num> <text>Paragraph (4) is repealed.</text> <codify:repeal/> </para> </para> <para codify:path="(b)"> <num>(2)</num> <text>Subsection (b) is amended by striking the phrase ", but shall not become effective until" and inserting the phrase "and shall become effective upon" in its place.</text> <codify:find-replace count="1"> <find>, but shall not become effective until</find> <replace> and shall become effective upon</replace> </codify:find-replace> </para> </para> <para codify:path="§6-1041.07"> <num>(d)</num> <text>Section 107 (D.C. Official Code § 6-1041.07) is amended as follows:</text> <para codify:path="(2)"> <num>(1)</num> <text>Paragraph (2) is amended by striking the phrase "low- or moderate-income households" and inserting the phrase "eligible households" in its place.</text> <codify:find-replace count="1"> <find>low- or moderate-income households</find> <replace>eligible households</replace> </codify:find-replace> </para> <para codify:path="(6)"> <num>(2)</num> <text>Paragraph (6) is amended by striking the phrase "Chapter 26 of Title 11 of the District of Columbia Municipal Regulations (11 DCMR 2600 <em>et seq.</em>)" and inserting the phrase "Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations" in its place.</text> <codify:find-replace count="1"> <find>Chapter 26 of Title 11 of the District of Columbia Municipal Regulations (11 DCMR 2600 et seq.)</find> <replace>Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations</replace> </codify:find-replace> </para> <para codify:path="(9)"> <num>(3)</num> <text>Paragraph (9) is amended by striking the phrase "low- or moderate-income households" and inserting the phrase "eligible households" in its place.</text> <codify:find-replace count="1"> <find>low- or moderate-income households</find> <replace>eligible households</replace> </codify:find-replace> </para> </para> <para codify:path="§6-1041.09|(a)"> <num>(e)</num> <text>Section 109(a) (D.C. Official Code § 6-1041.09(a)) is amended as follows:</text> <para codify:path="(5)"> <num>(1)</num> <text>Paragraph (5) is amended by striking the phrase "low- or moderate-income households" and inserting the phrase "eligible households" in its place.</text> <codify:find-replace count="1"> <find>low- or moderate-income households</find> <replace>eligible households</replace> </codify:find-replace> </para> <para codify:path="(6)"> <num>(2)</num> <text>Paragraph (6) is amended by striking the phrase "low- or moderate-income households" and inserting the phrase "eligible households" in its place.</text> <codify:find-replace count="1"> <find>low- or moderate-income households</find> <replace>eligible households</replace> </codify:find-replace> </para> </para> </section> <section> <num>3</num> <text>Section 102(8)(E) of the District of Columbia Administrative Procedure Act, approved October 21, 1968 (82 Stat. 1204; D.C. Official Code § 2-502(8)(E)), is amended by striking the phrase "Chapter 26 of Title 11 of the District of Columbia Municipal Regulations (11 DCMR 2600 <em>et seq.</em>)" and inserting the phrase "Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations" in its place.</text> <codify:find-replace doc="D.C. Code" path="§2-502|(8)|(E)" count="1"> <find>Chapter 26 of Title 11 of the District of Columbia Municipal Regulations (11 DCMR 2600 et seq.)</find> <replace>Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations</replace> </codify:find-replace> </section> <section> <num>4</num> <text>Section 3(c)(17) of the Housing Production Trust Fund Act of 1988, effective March 16, 1989 (D.C. Law 7-202; D.C. Official Code § 42-2802(c)(17)), is amended by striking the phrase "low- and moderate-income households" and inserting the phrase "eligible households" in its place.</text> <codify:find-replace doc="D.C. Code" path="§42-2802|(c)|(17)" count="1"> <find>low- and moderate-income households</find> <replace>eligible households</replace> </codify:find-replace> </section> <section> <num>5</num> <text>Section 47-902(23) of the District of Columbia Official Code is amended by striking the phrase "low- and moderate-income household" and inserting the phrase "eligible household" in its place.</text> <codify:find-replace doc="D.C. Code" path="§47-902|(23)" count="1" technical="true"> <find>low- or moderate-income household</find> <replace>eligible household</replace> </codify:find-replace> </section> <section> <num>6</num> <heading>Applicability.</heading> <text>This act shall apply as of June 5, 2017, which is the effective date of the amendments to the inclusionary zoning regulations, set forth at Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations, that were promulgated by the Zoning Commission for the District of Columbia on October 17, 2016 in its Notice of Final Rulemaking and Zoning Commission Order No. 04-33G (63 DCR 15404).</text> <codify:annotation doc="D.C. Code" path="§6-1041.01" type="Editor's Notes" history="false"> <cite doc="D.C. Law 22-24" path="§6">Section 6 of D.C. Law 22-24</cite> provided that Law 22-24 "shall apply as of June 5, 2017, which is the effective date of the amendments to the inclusionary zoning regulations, set forth at Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations, that were promulgated by the Zoning Commission for the District of Columbia on October 17, 2016 in its Notice of Final Rulemaking and Zoning Commission Order No. 04-33G (63 DCR 15404)." </codify:annotation> <codify:annotation doc="D.C. Code" path="§6-1041.02" type="Editor's Notes" history="false"> <cite doc="D.C. Law 22-24" path="§6">Section 6 of D.C. Law 22-24</cite> provided that Law 22-24 "shall apply as of June 5, 2017, which is the effective date of the amendments to the inclusionary zoning regulations, set forth at Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations, that were promulgated by the Zoning Commission for the District of Columbia on October 17, 2016 in its Notice of Final Rulemaking and Zoning Commission Order No. 04-33G (63 DCR 15404)." </codify:annotation> <codify:annotation doc="D.C. Code" path="§6-1041.03" type="Editor's Notes" history="false"> <cite doc="D.C. Law 22-24" path="§6">Section 6 of D.C. Law 22-24</cite> provided that Law 22-24 "shall apply as of June 5, 2017, which is the effective date of the amendments to the inclusionary zoning regulations, set forth at Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations, that were promulgated by the Zoning Commission for the District of Columbia on October 17, 2016 in its Notice of Final Rulemaking and Zoning Commission Order No. 04-33G (63 DCR 15404)." </codify:annotation> <codify:annotation doc="D.C. Code" path="§6-1041.07" type="Editor's Notes" history="false"> <cite doc="D.C. Law 22-24" path="§6">Section 6 of D.C. Law 22-24</cite> provided that Law 22-24 "shall apply as of June 5, 2017, which is the effective date of the amendments to the inclusionary zoning regulations, set forth at Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations, that were promulgated by the Zoning Commission for the District of Columbia on October 17, 2016 in its Notice of Final Rulemaking and Zoning Commission Order No. 04-33G (63 DCR 15404)." </codify:annotation> <codify:annotation doc="D.C. Code" path="§6-1041.09" type="Editor's Notes" history="false"> <cite doc="D.C. Law 22-24" path="§6">Section 6 of D.C. Law 22-24</cite> provided that Law 22-24 "shall apply as of June 5, 2017, which is the effective date of the amendments to the inclusionary zoning regulations, set forth at Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations, that were promulgated by the Zoning Commission for the District of Columbia on October 17, 2016 in its Notice of Final Rulemaking and Zoning Commission Order No. 04-33G (63 DCR 15404)." </codify:annotation> <codify:annotation doc="D.C. Code" path="§2-502" type="Editor's Notes" history="false"> <cite doc="D.C. Law 22-24" path="§6">Section 6 of D.C. Law 22-24</cite> provided that Law 22-24 "shall apply as of June 5, 2017, which is the effective date of the amendments to the inclusionary zoning regulations, set forth at Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations, that were promulgated by the Zoning Commission for the District of Columbia on October 17, 2016 in its Notice of Final Rulemaking and Zoning Commission Order No. 04-33G (63 DCR 15404)." </codify:annotation> <codify:annotation doc="D.C. Code" path="§42-2802" type="Editor's Notes" history="false"> <cite doc="D.C. Law 22-24" path="§6">Section 6 of D.C. Law 22-24</cite> provided that Law 22-24 "shall apply as of June 5, 2017, which is the effective date of the amendments to the inclusionary zoning regulations, set forth at Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations, that were promulgated by the Zoning Commission for the District of Columbia on October 17, 2016 in its Notice of Final Rulemaking and Zoning Commission Order No. 04-33G (63 DCR 15404)." </codify:annotation> <codify:annotation doc="D.C. Code" path="§47-902" type="Editor's Notes" history="false"> <cite doc="D.C. Law 22-24" path="§6">Section 6 of D.C. Law 22-24</cite> provided that Law 22-24 "shall apply as of June 5, 2017, which is the effective date of the amendments to the inclusionary zoning regulations, set forth at Chapter 10 of Title 11-C of the District of Columbia Municipal Regulations, that were promulgated by the Zoning Commission for the District of Columbia on October 17, 2016 in its Notice of Final Rulemaking and Zoning Commission Order No. 04-33G (63 DCR 15404)." </codify:annotation> </section> <section> <num>7</num> <heading>Fiscal impact statement.</heading> <text>The Council adopts the fiscal impact statement in the committee report as the fiscal impact statement required by section 4a of the General Legislative Procedures Act of 1975, approved October 16, 2006 (120 Stat. 2038; D.C. Official Code § 1-301.47a).</text> </section> <section> <num>8</num> <heading>Effective date.</heading> <text>This act shall take effect following approval by the Mayor (or in the event of veto by the Mayor, action by the Council to override the veto), a 30-day period of congressional review as provided in section 602(c)(1) of the District of Columbia Home Rule Act, approved December 24, 1973 (87 Stat. 813; D.C. Official Code § 1-206.02(c)(1)), and publication in the District of Columbia Register.</text> </section> </document>
{ "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.shardingsphere.infra.executor.sql.resourced.jdbc.group; import org.apache.shardingsphere.infra.executor.sql.ConnectionMode; import org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit; import org.apache.shardingsphere.infra.executor.sql.resourced.jdbc.StatementExecuteUnit; import org.apache.shardingsphere.infra.executor.sql.resourced.jdbc.connection.JDBCExecutionConnection; import org.apache.shardingsphere.infra.executor.sql.resourced.group.ResourceManagedExecuteGroupEngine; import org.apache.shardingsphere.infra.rule.ShardingSphereRule; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Collection; import java.util.List; /** * Execute group engine for prepared statement. */ public final class PreparedStatementExecuteGroupEngine extends ResourceManagedExecuteGroupEngine<StatementExecuteUnit, JDBCExecutionConnection, Connection, StatementOption> { public PreparedStatementExecuteGroupEngine(final int maxConnectionsSizePerQuery, final JDBCExecutionConnection executionConnection, final StatementOption option, final Collection<ShardingSphereRule> rules) { super(maxConnectionsSizePerQuery, executionConnection, option, rules); } @Override protected StatementExecuteUnit createStorageResourceExecuteUnit(final ExecutionUnit executionUnit, final JDBCExecutionConnection executionConnection, final Connection connection, final ConnectionMode connectionMode, final StatementOption option) throws SQLException { PreparedStatement preparedStatement = createPreparedStatement( executionUnit.getSqlUnit().getSql(), executionUnit.getSqlUnit().getParameters(), executionConnection, connection, connectionMode, option); return new StatementExecuteUnit(executionUnit, connectionMode, preparedStatement); } private PreparedStatement createPreparedStatement(final String sql, final List<Object> parameters, final JDBCExecutionConnection executionConnection, final Connection connection, final ConnectionMode connectionMode, final StatementOption statementOption) throws SQLException { return (PreparedStatement) executionConnection.createStorageResource(sql, parameters, connection, connectionMode, statementOption); } }
{ "pile_set_name": "Github" }
package com.lordofthejars.nosqlunit.core; public interface LoadStrategyFactory { LoadStrategyOperation getLoadStrategyInstance( LoadStrategyEnum loadStrategyEnum, DatabaseOperation databaseOperation); }
{ "pile_set_name": "Github" }
# razzle-plugin-css This is just a stub. Razzle comes with CSS. The same exact setup as `create-react-app`.
{ "pile_set_name": "Github" }
#include <iostream> #include <string> #include <unistd.h> #include <vector> #include <fstream> #include <algorithm> #include <random> #include <chrono> using namespace std; int main( int argc, char** argv) { if(argc < 4) { cout << "Usage .... exec input_file output_file_basename num_partitions" << endl; exit(-1); } std::string input_file = argv[1]; std::string output_file = argv[2]; int num_partition = atoi(argv[3]); std::ifstream infile(input_file); std::vector<std::pair<std::string, int> > lines; std::string line; size_t pos; int label; while (std::getline(infile, line)) { pos = line.find_last_of(' '); label = atoi(line.substr(pos + 1).c_str()); lines.push_back(std::make_pair(line.substr(0, pos), label)); } std::cout << "Input file " << input_file << std::endl; std::cout << "Shuffling data" << std::endl; unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); std::shuffle(lines.begin(), lines.end(),std::default_random_engine(seed)); int num = lines.size(); int batch = int(num/num_partition); std::cout << "A total of " << num << " rows"; std::cout << " Num of partition " << num_partition; std::cout << " Data per partition " << batch << std::endl; std::cout << "Original file shuffled and save as: " << output_file << std::endl; ofstream base_ofs(output_file.c_str()); if (!base_ofs) { std::cout << "\n In write_file can't open file : " << output_file; exit(1); } for(auto& l0 : lines) base_ofs << l0.first << " " << l0.second << std::endl; std::cout << " Start partitioning " << std::endl; for(int p = 0; p < num_partition; p++) { int start = p * batch; int end = start + batch; std::string partition_file = output_file + ".p" + to_string(p); std::cout << "Partitioned file name " << partition_file << std::endl; ofstream ofs(partition_file.c_str()); if (!ofs) { std::cout << "\n In write_file: can't open file : " << partition_file; exit(1); } for(int l = start; l < end; l++) ofs << lines[l].first << " " << lines[l].second << endl; } std::cout << "DONE!" << std::endl; return 0; }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "webrtc/modules/audio_coding/neteq/audio_vector.h" #include <assert.h> #include <stdlib.h> #include <string> #include "testing/gtest/include/gtest/gtest.h" #include "webrtc/typedefs.h" namespace webrtc { class AudioVectorTest : public ::testing::Test { protected: virtual void SetUp() { // Populate test array. for (size_t i = 0; i < array_length(); ++i) { array_[i] = i; } } size_t array_length() const { return sizeof(array_) / sizeof(array_[0]); } int16_t array_[10]; }; // Create and destroy AudioVector objects, both empty and with a predefined // length. TEST_F(AudioVectorTest, CreateAndDestroy) { AudioVector vec1; EXPECT_TRUE(vec1.Empty()); EXPECT_EQ(0u, vec1.Size()); size_t initial_size = 17; AudioVector vec2(initial_size); EXPECT_FALSE(vec2.Empty()); EXPECT_EQ(initial_size, vec2.Size()); } // Test the subscript operator [] for getting and setting. TEST_F(AudioVectorTest, SubscriptOperator) { AudioVector vec(array_length()); for (size_t i = 0; i < array_length(); ++i) { vec[i] = static_cast<int16_t>(i); const int16_t& value = vec[i]; // Make sure to use the const version. EXPECT_EQ(static_cast<int16_t>(i), value); } } // Test the PushBack method and the CopyFrom method. The Clear method is also // invoked. TEST_F(AudioVectorTest, PushBackAndCopy) { AudioVector vec; AudioVector vec_copy; vec.PushBack(array_, array_length()); vec.CopyTo(&vec_copy); // Copy from |vec| to |vec_copy|. ASSERT_EQ(array_length(), vec.Size()); ASSERT_EQ(array_length(), vec_copy.Size()); for (size_t i = 0; i < array_length(); ++i) { EXPECT_EQ(array_[i], vec[i]); EXPECT_EQ(array_[i], vec_copy[i]); } // Clear |vec| and verify that it is empty. vec.Clear(); EXPECT_TRUE(vec.Empty()); // Now copy the empty vector and verify that the copy becomes empty too. vec.CopyTo(&vec_copy); EXPECT_TRUE(vec_copy.Empty()); } // Try to copy to a NULL pointer. Nothing should happen. TEST_F(AudioVectorTest, CopyToNull) { AudioVector vec; AudioVector* vec_copy = NULL; vec.PushBack(array_, array_length()); vec.CopyTo(vec_copy); } // Test the PushBack method with another AudioVector as input argument. TEST_F(AudioVectorTest, PushBackVector) { static const size_t kLength = 10; AudioVector vec1(kLength); AudioVector vec2(kLength); // Set the first vector to [0, 1, ..., kLength - 1]. // Set the second vector to [kLength, kLength + 1, ..., 2 * kLength - 1]. for (size_t i = 0; i < kLength; ++i) { vec1[i] = static_cast<int16_t>(i); vec2[i] = static_cast<int16_t>(i + kLength); } // Append vec2 to the back of vec1. vec1.PushBack(vec2); ASSERT_EQ(2 * kLength, vec1.Size()); for (size_t i = 0; i < 2 * kLength; ++i) { EXPECT_EQ(static_cast<int16_t>(i), vec1[i]); } } // Test the PushFront method. TEST_F(AudioVectorTest, PushFront) { AudioVector vec; vec.PushFront(array_, array_length()); ASSERT_EQ(array_length(), vec.Size()); for (size_t i = 0; i < array_length(); ++i) { EXPECT_EQ(array_[i], vec[i]); } } // Test the PushFront method with another AudioVector as input argument. TEST_F(AudioVectorTest, PushFrontVector) { static const size_t kLength = 10; AudioVector vec1(kLength); AudioVector vec2(kLength); // Set the first vector to [0, 1, ..., kLength - 1]. // Set the second vector to [kLength, kLength + 1, ..., 2 * kLength - 1]. for (size_t i = 0; i < kLength; ++i) { vec1[i] = static_cast<int16_t>(i); vec2[i] = static_cast<int16_t>(i + kLength); } // Prepend vec1 to the front of vec2. vec2.PushFront(vec1); ASSERT_EQ(2 * kLength, vec2.Size()); for (size_t i = 0; i < 2 * kLength; ++i) { EXPECT_EQ(static_cast<int16_t>(i), vec2[i]); } } // Test the PopFront method. TEST_F(AudioVectorTest, PopFront) { AudioVector vec; vec.PushBack(array_, array_length()); vec.PopFront(1); // Remove one element. EXPECT_EQ(array_length() - 1u, vec.Size()); for (size_t i = 0; i < array_length() - 1; ++i) { EXPECT_EQ(static_cast<int16_t>(i + 1), vec[i]); } vec.PopFront(array_length()); // Remove more elements than vector size. EXPECT_EQ(0u, vec.Size()); } // Test the PopBack method. TEST_F(AudioVectorTest, PopBack) { AudioVector vec; vec.PushBack(array_, array_length()); vec.PopBack(1); // Remove one element. EXPECT_EQ(array_length() - 1u, vec.Size()); for (size_t i = 0; i < array_length() - 1; ++i) { EXPECT_EQ(static_cast<int16_t>(i), vec[i]); } vec.PopBack(array_length()); // Remove more elements than vector size. EXPECT_EQ(0u, vec.Size()); } // Test the Extend method. TEST_F(AudioVectorTest, Extend) { AudioVector vec; vec.PushBack(array_, array_length()); vec.Extend(5); // Extend with 5 elements, which should all be zeros. ASSERT_EQ(array_length() + 5u, vec.Size()); // Verify that all are zero. for (size_t i = array_length(); i < array_length() + 5; ++i) { EXPECT_EQ(0, vec[i]); } } // Test the InsertAt method with an insert position in the middle of the vector. TEST_F(AudioVectorTest, InsertAt) { AudioVector vec; vec.PushBack(array_, array_length()); static const int kNewLength = 5; int16_t new_array[kNewLength]; // Set array elements to {100, 101, 102, ... }. for (int i = 0; i < kNewLength; ++i) { new_array[i] = 100 + i; } int insert_position = 5; vec.InsertAt(new_array, kNewLength, insert_position); // Verify that the vector looks as follows: // {0, 1, ..., |insert_position| - 1, 100, 101, ..., 100 + kNewLength - 1, // |insert_position|, |insert_position| + 1, ..., kLength - 1}. size_t pos = 0; for (int i = 0; i < insert_position; ++i) { EXPECT_EQ(array_[i], vec[pos]); ++pos; } for (int i = 0; i < kNewLength; ++i) { EXPECT_EQ(new_array[i], vec[pos]); ++pos; } for (size_t i = insert_position; i < array_length(); ++i) { EXPECT_EQ(array_[i], vec[pos]); ++pos; } } // Test the InsertZerosAt method with an insert position in the middle of the // vector. Use the InsertAt method as reference. TEST_F(AudioVectorTest, InsertZerosAt) { AudioVector vec; AudioVector vec_ref; vec.PushBack(array_, array_length()); vec_ref.PushBack(array_, array_length()); static const int kNewLength = 5; int insert_position = 5; vec.InsertZerosAt(kNewLength, insert_position); int16_t new_array[kNewLength] = {0}; // All zero elements. vec_ref.InsertAt(new_array, kNewLength, insert_position); // Verify that the vectors are identical. ASSERT_EQ(vec_ref.Size(), vec.Size()); for (size_t i = 0; i < vec.Size(); ++i) { EXPECT_EQ(vec_ref[i], vec[i]); } } // Test the InsertAt method with an insert position at the start of the vector. TEST_F(AudioVectorTest, InsertAtBeginning) { AudioVector vec; vec.PushBack(array_, array_length()); static const int kNewLength = 5; int16_t new_array[kNewLength]; // Set array elements to {100, 101, 102, ... }. for (int i = 0; i < kNewLength; ++i) { new_array[i] = 100 + i; } int insert_position = 0; vec.InsertAt(new_array, kNewLength, insert_position); // Verify that the vector looks as follows: // {100, 101, ..., 100 + kNewLength - 1, // 0, 1, ..., kLength - 1}. size_t pos = 0; for (int i = 0; i < kNewLength; ++i) { EXPECT_EQ(new_array[i], vec[pos]); ++pos; } for (size_t i = insert_position; i < array_length(); ++i) { EXPECT_EQ(array_[i], vec[pos]); ++pos; } } // Test the InsertAt method with an insert position at the end of the vector. TEST_F(AudioVectorTest, InsertAtEnd) { AudioVector vec; vec.PushBack(array_, array_length()); static const int kNewLength = 5; int16_t new_array[kNewLength]; // Set array elements to {100, 101, 102, ... }. for (int i = 0; i < kNewLength; ++i) { new_array[i] = 100 + i; } int insert_position = array_length(); vec.InsertAt(new_array, kNewLength, insert_position); // Verify that the vector looks as follows: // {0, 1, ..., kLength - 1, 100, 101, ..., 100 + kNewLength - 1 }. size_t pos = 0; for (size_t i = 0; i < array_length(); ++i) { EXPECT_EQ(array_[i], vec[pos]); ++pos; } for (int i = 0; i < kNewLength; ++i) { EXPECT_EQ(new_array[i], vec[pos]); ++pos; } } // Test the InsertAt method with an insert position beyond the end of the // vector. Verify that a position beyond the end of the vector does not lead to // an error. The expected outcome is the same as if the vector end was used as // input position. That is, the input position should be capped at the maximum // allowed value. TEST_F(AudioVectorTest, InsertBeyondEnd) { AudioVector vec; vec.PushBack(array_, array_length()); static const int kNewLength = 5; int16_t new_array[kNewLength]; // Set array elements to {100, 101, 102, ... }. for (int i = 0; i < kNewLength; ++i) { new_array[i] = 100 + i; } int insert_position = array_length() + 10; // Too large. vec.InsertAt(new_array, kNewLength, insert_position); // Verify that the vector looks as follows: // {0, 1, ..., kLength - 1, 100, 101, ..., 100 + kNewLength - 1 }. size_t pos = 0; for (size_t i = 0; i < array_length(); ++i) { EXPECT_EQ(array_[i], vec[pos]); ++pos; } for (int i = 0; i < kNewLength; ++i) { EXPECT_EQ(new_array[i], vec[pos]); ++pos; } } // Test the OverwriteAt method with a position such that all of the new values // fit within the old vector. TEST_F(AudioVectorTest, OverwriteAt) { AudioVector vec; vec.PushBack(array_, array_length()); static const int kNewLength = 5; int16_t new_array[kNewLength]; // Set array elements to {100, 101, 102, ... }. for (int i = 0; i < kNewLength; ++i) { new_array[i] = 100 + i; } size_t insert_position = 2; vec.OverwriteAt(new_array, kNewLength, insert_position); // Verify that the vector looks as follows: // {0, ..., |insert_position| - 1, 100, 101, ..., 100 + kNewLength - 1, // |insert_position|, |insert_position| + 1, ..., kLength - 1}. size_t pos = 0; for (pos = 0; pos < insert_position; ++pos) { EXPECT_EQ(array_[pos], vec[pos]); } for (int i = 0; i < kNewLength; ++i) { EXPECT_EQ(new_array[i], vec[pos]); ++pos; } for (; pos < array_length(); ++pos) { EXPECT_EQ(array_[pos], vec[pos]); } } // Test the OverwriteAt method with a position such that some of the new values // extend beyond the end of the current vector. This is valid, and the vector is // expected to expand to accommodate the new values. TEST_F(AudioVectorTest, OverwriteBeyondEnd) { AudioVector vec; vec.PushBack(array_, array_length()); static const int kNewLength = 5; int16_t new_array[kNewLength]; // Set array elements to {100, 101, 102, ... }. for (int i = 0; i < kNewLength; ++i) { new_array[i] = 100 + i; } int insert_position = array_length() - 2; vec.OverwriteAt(new_array, kNewLength, insert_position); ASSERT_EQ(array_length() - 2u + kNewLength, vec.Size()); // Verify that the vector looks as follows: // {0, ..., |insert_position| - 1, 100, 101, ..., 100 + kNewLength - 1, // |insert_position|, |insert_position| + 1, ..., kLength - 1}. int pos = 0; for (pos = 0; pos < insert_position; ++pos) { EXPECT_EQ(array_[pos], vec[pos]); } for (int i = 0; i < kNewLength; ++i) { EXPECT_EQ(new_array[i], vec[pos]); ++pos; } // Verify that we checked to the end of |vec|. EXPECT_EQ(vec.Size(), static_cast<size_t>(pos)); } TEST_F(AudioVectorTest, CrossFade) { static const size_t kLength = 100; static const size_t kFadeLength = 10; AudioVector vec1(kLength); AudioVector vec2(kLength); // Set all vector elements to 0 in |vec1| and 100 in |vec2|. for (size_t i = 0; i < kLength; ++i) { vec1[i] = 0; vec2[i] = 100; } vec1.CrossFade(vec2, kFadeLength); ASSERT_EQ(2 * kLength - kFadeLength, vec1.Size()); // First part untouched. for (size_t i = 0; i < kLength - kFadeLength; ++i) { EXPECT_EQ(0, vec1[i]); } // Check mixing zone. for (size_t i = 0 ; i < kFadeLength; ++i) { EXPECT_NEAR((i + 1) * 100 / (kFadeLength + 1), vec1[kLength - kFadeLength + i], 1); } // Second part untouched. for (size_t i = kLength; i < vec1.Size(); ++i) { EXPECT_EQ(100, vec1[i]); } } } // namespace webrtc
{ "pile_set_name": "Github" }
#-- copyright #OpenProject is an open source project management software. #Copyright (C) 2012-2020 the OpenProject GmbH #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License version 3. #OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: #Copyright (C) 2006-2017 Jean-Philippe Lang #Copyright (C) 2010-2013 the ChiliProject Team #This program is free software; you can redistribute it and/or #modify it under the terms of the GNU General Public License #as published by the Free Software Foundation; either version 2 #of the License, or (at your option) any later version. #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. #You should have received a copy of the GNU General Public License #along with this program; if not, write to the Free Software #Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #See docs/COPYRIGHT.rdoc for more details. #++ #English strings go here for Rails i18n hu: activerecord: attributes: meeting: location: "Helyszín" duration: "Időtartam" participants: "Közreműködők" participants_attended: "Résztvevők" participants_invited: "Meghívottak" start_time: "Idő" start_time_hour: "Kezdési időpont" errors: messages: invalid_time_format: "nem egy érvényes időpont. Előírt formátum: óó:pp" models: meeting_agenda: "Napirend" meeting_minutes: "Jegyzőkönyv" description_attended: "részt vett" description_invite: "meghívott" events: meeting: Esemény szerkesztve meeting_agenda: Esemény napirendje szerkesztve meeting_agenda_closed: Esemény napirendje lezárva meeting_agenda_opened: Esemény napirendje megnyitva meeting_minutes: Jegyzőkönyv szerkesztve meeting_minutes_created: Jegyzőkönyv létrehozva error_notification_with_errors: "Nem sikerült elküldeni az értesítőt. A következő címzettek nem lettek értesítve: %{recipients}" label_meeting: "Megbeszélés" label_meeting_plural: "Megbeszélések" label_meeting_new: "Új megbeszélés" label_meeting_edit: "Megbeszélés szerkesztése" label_meeting_agenda: "Napirend" label_meeting_minutes: "Jegyzőkönyv" label_meeting_close: "Bezár" label_meeting_open: "Open" label_meeting_agenda_close: "Napirend lezárása a jegyzőkönyv megkezdéséhez" label_meeting_date_time: "Dátum/idő" label_meeting_diff: "Eltérés" label_notify: "Küldés véleményezésre" label_icalendar: "iCalendar küldése" label_version: "Verzió" label_time_zone: "Idő zóna" label_start_date: "Indulási dátum" notice_successful_notification: "Értesítés sikeresen kiküldve" notice_timezone_missing: Nincs időzóna beállítva, %{zone} a feltételezett. Időzóna beállításához kattintson ide. permission_create_meetings: "Megbeszélések létrehozása" permission_edit_meetings: "Megbeszélések szerkesztése" permission_delete_meetings: "Megbeszélések törlése" permission_view_meetings: "Megbeszélések megtekintése" permission_create_meeting_agendas: "Napirendek kezelése" permission_close_meeting_agendas: "Napirendek lezárása" permission_send_meeting_agendas_notification: "Napirend véleményezésre küldésének értesítése" permission_create_meeting_minutes: "Jegyzőkönyvek kezelése" permission_send_meeting_minutes_notification: "Jegyzőkönyvek véleményezésre küldésének értesítése" permission_meetings_send_invite: "Invite users to meetings" permission_send_meeting_agendas_icalendar: "Send meeting agenda as calendar entry" project_module_meetings: "Megbeszélések" text_duration_in_hours: "Hossza (óra)" text_in_hours: "órában" text_meeting_agenda_for_meeting: 'a "%{meeting}" megbeszélés napirendje' text_meeting_closing_are_you_sure: "Biztosan le akarod zárni a találkozót?" text_meeting_agenda_open_are_you_sure: "This will overwrite all changes in the minutes! Do you want to continue?" text_meeting_minutes_for_meeting: 'a "%{meeting}" megbeszélés jegyzőkönyve' text_review_meeting_agenda: "%{author} véleményezésre küldte %{link} -t." text_review_meeting_minutes: "%{author} véleményezésre küldte %{link} -t." text_notificiation_invited: "Ez a levél alább egy ics bejegyzést tartalmaz a megbeszélésről:"
{ "pile_set_name": "Github" }
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. part of $LIBRARYNAME; $(ANNOTATIONS)$(CLASS_MODIFIERS)class Console { const Console._safe(); static const Console _safeConsole = const Console._safe(); bool get _isConsoleDefined => JS('bool', 'typeof console != "undefined"'); @DomName('Console.memory') MemoryInfo get memory => _isConsoleDefined ? JS('MemoryInfo', 'console.memory') : null; @DomName('Console.assertCondition') void assertCondition(bool condition, Object arg) => _isConsoleDefined ? JS('void', 'console.assertCondition(#, #)', condition, arg) : null; @DomName('Console.clear') void clear(Object arg) => _isConsoleDefined ? JS('void', 'console.clear(#)', arg) : null; @DomName('Console.count') void count(Object arg) => _isConsoleDefined ? JS('void', 'console.count(#)', arg) : null; @DomName('Console.debug') void debug(Object arg) => _isConsoleDefined ? JS('void', 'console.debug(#)', arg) : null; @DomName('Console.dir') void dir(Object arg) => _isConsoleDefined ? JS('void', 'console.dir(#)', arg) : null; @DomName('Console.dirxml') void dirxml(Object arg) => _isConsoleDefined ? JS('void', 'console.dirxml(#)', arg) : null; @DomName('Console.error') void error(Object arg) => _isConsoleDefined ? JS('void', 'console.error(#)', arg) : null; @DomName('Console.group') void group(Object arg) => _isConsoleDefined ? JS('void', 'console.group(#)', arg) : null; @DomName('Console.groupCollapsed') void groupCollapsed(Object arg) => _isConsoleDefined ? JS('void', 'console.groupCollapsed(#)', arg) : null; @DomName('Console.groupEnd') void groupEnd() => _isConsoleDefined ? JS('void', 'console.groupEnd()') : null; @DomName('Console.info') void info(Object arg) => _isConsoleDefined ? JS('void', 'console.info(#)', arg) : null; @DomName('Console.log') void log(Object arg) => _isConsoleDefined ? JS('void', 'console.log(#)', arg) : null; @DomName('Console.markTimeline') void markTimeline(Object arg) => _isConsoleDefined ? JS('void', 'console.markTimeline(#)', arg) : null; @DomName('Console.profile') void profile(String title) => _isConsoleDefined ? JS('void', 'console.profile(#)', title) : null; @DomName('Console.profileEnd') void profileEnd(String title) => _isConsoleDefined ? JS('void', 'console.profileEnd(#)', title) : null; @DomName('Console.table') void table(Object arg) => _isConsoleDefined ? JS('void', 'console.table(#)', arg) : null; @DomName('Console.time') void time(String title) => _isConsoleDefined ? JS('void', 'console.time(#)', title) : null; @DomName('Console.timeEnd') void timeEnd(String title) => _isConsoleDefined ? JS('void', 'console.timeEnd(#)', title) : null; @DomName('Console.timeStamp') void timeStamp(Object arg) => _isConsoleDefined ? JS('void', 'console.timeStamp(#)', arg) : null; @DomName('Console.trace') void trace(Object arg) => _isConsoleDefined ? JS('void', 'console.trace(#)', arg) : null; @DomName('Console.warn') void warn(Object arg) => _isConsoleDefined ? JS('void', 'console.warn(#)', arg) : null; $!MEMBERS }
{ "pile_set_name": "Github" }
package io.seata.samples.sca.customer; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; /** * Created by yu.hb on 2019-10-30 */ @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) @EnableDiscoveryClient @EnableFeignClients // 扫描 @FeignClient 注解 @MapperScan("io.seata.samples.sca.customer.mapper") public class CustomerApp { public static void main(String[] args) { SpringApplication.run(CustomerApp.class, args); } }
{ "pile_set_name": "Github" }
#include <Core/Core.h> using namespace Upp; void GetRepoInfo(String repo, Date& d, int& rev) { String s = Sys("svn info " + repo); LOG("SVN info:"); LOG(s); int q = s.FindAfter("Last Changed Rev: "); ASSERT(q >= 0); rev = atoi(~s + q); ASSERT(rev > 0); q = s.FindAfter("Last Changed Date: "); ASSERT(q >= 0); s = s.Mid(q); ASSERT(s.GetCount() > 18); // 2014-10-30 01:01:56 // 0123456789012345678 d.year = atoi(s); d.month = atoi(~s + 5); d.day = atoi(~s + 8); } CONSOLE_APP_MAIN { StdLogSetup(LOG_COUT|LOG_FILE); Date d, d1; int rev, rev1; GetRepoInfo("svn://localhost/upp", d, rev); GetRepoInfo("svn://www.ultimatepp.org/upp", d1, rev1); LOG("Main repository last date: " << d1); LOG("Main repository revision: " << rev1); LOG("Mirror repository last date: " << d); LOG("Mirror repository revision: " << rev); ASSERT(d == d1 && rev == rev1); GetRepoInfo("svn://www.ultimatepp.org/upp/trunk", d, rev); LOG("upp.src revision: " << rev); String h = HttpRequest("https://github.com/ultimatepp/mirror/commits/master").Execute(); LOG("---- GIT"); LOG(h); int q = h.FindAfter("git-svn-id: svn://ultimatepp.org/upp/trunk@"); ASSERT(q >= 0); rev1 = atoi(~h + q); LOG("GIT mirror revision " << rev1); ASSERT(rev == rev1); LOG("------------------- OK"); }
{ "pile_set_name": "Github" }
/* * /MathJax/fonts/HTML-CSS/TeX/png/AMS/Regular/SpacingModLetters.js * * Copyright (c) 2010-2013 The MathJax Consortium * * Part of the MathJax library. * See http://www.mathjax.org for details. * * Licensed under the Apache License, Version 2.0; * you may not use this file except in compliance with the License. * * http://www.apache.org/licenses/LICENSE-2.0 */ MathJax.OutputJax["HTML-CSS"].defineImageData({MathJax_AMS:{710:[[18,3,-3],[21,3,-4],[25,3,-5],[29,4,-6],[34,5,-8],[40,5,-9],[47,6,-11],[56,8,-12],[66,8,-16],[79,10,-19],[93,12,-21],[110,14,-26],[131,17,-30],[156,20,-36]],732:[[17,2,-4],[21,2,-5],[24,4,-5],[29,5,-7],[34,4,-9],[40,5,-10],[47,6,-12],[56,6,-15],[66,8,-17],[78,9,-21],[93,11,-25],[110,13,-29],[130,15,-35],[155,18,-41]]}});MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].imgDir+"/AMS/Regular"+MathJax.OutputJax["HTML-CSS"].imgPacked+"/SpacingModLetters.js");
{ "pile_set_name": "Github" }
# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # Anonymous <[email protected]>, 2020. msgid "" msgstr "" "Project-Id-Version: Weblate 4.3\n" "Report-Msgid-Bugs-To: [email protected]\n" "POT-Creation-Date: 2020-09-23 13:14+0000\n" "PO-Revision-Date: 2020-08-17 13:35+0000\n" "Last-Translator: Anonymous <[email protected]>\n" "Language-Team: Asturian <https://hosted.weblate.org/projects/weblate/" "javascript/ast/>\n" "Language: ast\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 4.2-dev\n" #: weblate/static/editor/base.js:150 #, javascript-format msgid "Cmd+%s" msgstr "" #: weblate/static/editor/base.js:152 #, fuzzy, javascript-format #| msgid "Alt+M then %s" msgid "Ctrl+%s" msgstr "Alt+M dempués %s" #: weblate/static/editor/full.js:219 msgid "The request for machine translation has failed:" msgstr "Falló la solicitú pa la maquina de traducción:" #: weblate/static/editor/full.js:232 #, javascript-format msgid "The request for machine translation using %s has failed:" msgstr "Falló la solicitú pa la máquina de traducción usando %s:" #: weblate/static/editor/full.js:266 #, fuzzy, javascript-format #| msgid "Alt+M then %s" msgid "Cmd+M then %s" msgstr "Alt+M dempués %s" #: weblate/static/editor/full.js:268 #, fuzzy, javascript-format #| msgid "Alt+M then %s" msgid "Ctrl+M then %s" msgstr "Alt+M dempués %s" #: weblate/static/editor/full.js:352 #, javascript-format msgid "Press Cmd+I then %s to dismiss this." msgstr "" #: weblate/static/editor/full.js:357 #, javascript-format msgid "Press Ctrl+I then %s to dismiss this." msgstr "" #: weblate/static/editor/full.js:481 msgid "Copy" msgstr "Copiar" #: weblate/static/editor/full.js:487 msgid "Copy and save" msgstr "Copiar y guardar" #: weblate/static/editor/zen.js:100 msgid "There are some unsaved changes, are you sure you want to leave?" msgstr "Hai delles camudancies ensin guardar, ¿de xuru que quies dexales?" #: weblate/static/loader-bootstrap.js:148 msgid "Add to screenshot" msgstr "Añadir a imaxe de pantalla" #: weblate/static/loader-bootstrap.js:165 msgid "Error loading search results!" msgstr "¡Error al cargar los resultaos de la gueta!" #: weblate/static/loader-bootstrap.js:169 msgid "No new matching source strings found." msgstr "Nun s'alcontraron cadenes fonte nueves que coincidan." #: weblate/static/loader-bootstrap.js:235 msgid "Sort this column" msgstr "Ordenar esta columna" #: weblate/static/loader-bootstrap.js:364 msgid "Error while loading page:" msgstr "Fallu al cargar la páxina:" #: weblate/static/loader-bootstrap.js:525 #: weblate/static/loader-bootstrap.js:532 msgid "Sunday" msgstr "Domingu" #: weblate/static/loader-bootstrap.js:526 msgid "Monday" msgstr "Llunes" #: weblate/static/loader-bootstrap.js:527 msgid "Tuesday" msgstr "Martes" #: weblate/static/loader-bootstrap.js:528 msgid "Wednesday" msgstr "Miércoles" #: weblate/static/loader-bootstrap.js:529 msgid "Thursday" msgstr "Xueves" #: weblate/static/loader-bootstrap.js:530 msgid "Friday" msgstr "Vienres" #: weblate/static/loader-bootstrap.js:531 msgid "Saturday" msgstr "Sábadu" #: weblate/static/loader-bootstrap.js:535 #: weblate/static/loader-bootstrap.js:542 msgctxt "Short (for example three letter) name of day in week" msgid "Sun" msgstr "Dom" #: weblate/static/loader-bootstrap.js:536 msgctxt "Short (for example three letter) name of day in week" msgid "Mon" msgstr "Llu" #: weblate/static/loader-bootstrap.js:537 msgctxt "Short (for example three letter) name of day in week" msgid "Tue" msgstr "Mar" #: weblate/static/loader-bootstrap.js:538 msgctxt "Short (for example three letter) name of day in week" msgid "Wed" msgstr "Mié" #: weblate/static/loader-bootstrap.js:539 msgctxt "Short (for example three letter) name of day in week" msgid "Thu" msgstr "Xue" #: weblate/static/loader-bootstrap.js:540 msgctxt "Short (for example three letter) name of day in week" msgid "Fri" msgstr "Vie" #: weblate/static/loader-bootstrap.js:541 msgctxt "Short (for example three letter) name of day in week" msgid "Sat" msgstr "Sáb" #: weblate/static/loader-bootstrap.js:545 #: weblate/static/loader-bootstrap.js:552 msgctxt "Minimal (for example two letter) name of day in week" msgid "Su" msgstr "Do" #: weblate/static/loader-bootstrap.js:546 msgctxt "Minimal (for example two letter) name of day in week" msgid "Mo" msgstr "Ll" #: weblate/static/loader-bootstrap.js:547 msgctxt "Minimal (for example two letter) name of day in week" msgid "Tu" msgstr "Ma" #: weblate/static/loader-bootstrap.js:548 msgctxt "Minimal (for example two letter) name of day in week" msgid "We" msgstr "Mi" #: weblate/static/loader-bootstrap.js:549 msgctxt "Minimal (for example two letter) name of day in week" msgid "Th" msgstr "Xu" #: weblate/static/loader-bootstrap.js:550 msgctxt "Minimal (for example two letter) name of day in week" msgid "Fr" msgstr "Vi" #: weblate/static/loader-bootstrap.js:551 msgctxt "Minimal (for example two letter) name of day in week" msgid "Sa" msgstr "Sá" #: weblate/static/loader-bootstrap.js:555 msgid "January" msgstr "Xineru" #: weblate/static/loader-bootstrap.js:556 msgid "February" msgstr "Febreru" #: weblate/static/loader-bootstrap.js:557 msgid "March" msgstr "Marzu" #: weblate/static/loader-bootstrap.js:558 msgid "April" msgstr "Abril" #: weblate/static/loader-bootstrap.js:559 msgid "May" msgstr "Mayu" #: weblate/static/loader-bootstrap.js:560 msgid "June" msgstr "Xunu" #: weblate/static/loader-bootstrap.js:561 msgid "July" msgstr "Xunetu" #: weblate/static/loader-bootstrap.js:562 msgid "August" msgstr "Agostu" #: weblate/static/loader-bootstrap.js:563 msgid "September" msgstr "Setiembre" #: weblate/static/loader-bootstrap.js:564 msgid "October" msgstr "Ochobre" #: weblate/static/loader-bootstrap.js:565 msgid "November" msgstr "Payares" #: weblate/static/loader-bootstrap.js:566 msgid "December" msgstr "Avientu" #: weblate/static/loader-bootstrap.js:569 msgctxt "Short name of month" msgid "Jan" msgstr "Xin" #: weblate/static/loader-bootstrap.js:570 msgctxt "Short name of month" msgid "Feb" msgstr "Feb" #: weblate/static/loader-bootstrap.js:571 msgctxt "Short name of month" msgid "Mar" msgstr "Mar" #: weblate/static/loader-bootstrap.js:572 msgctxt "Short name of month" msgid "Apr" msgstr "Abr" #: weblate/static/loader-bootstrap.js:573 msgctxt "Short name of month" msgid "May" msgstr "May" #: weblate/static/loader-bootstrap.js:574 msgctxt "Short name of month" msgid "Jun" msgstr "Xun" #: weblate/static/loader-bootstrap.js:575 msgctxt "Short name of month" msgid "Jul" msgstr "Xnt" #: weblate/static/loader-bootstrap.js:576 msgctxt "Short name of month" msgid "Aug" msgstr "Ago" #: weblate/static/loader-bootstrap.js:577 msgctxt "Short name of month" msgid "Sep" msgstr "Set" #: weblate/static/loader-bootstrap.js:578 msgctxt "Short name of month" msgid "Oct" msgstr "Och" #: weblate/static/loader-bootstrap.js:579 msgctxt "Short name of month" msgid "Nov" msgstr "Pay" #: weblate/static/loader-bootstrap.js:580 msgctxt "Short name of month" msgid "Dec" msgstr "Avi" #: weblate/static/loader-bootstrap.js:582 msgid "Today" msgstr "Güei" #: weblate/static/loader-bootstrap.js:583 msgid "Clear" msgstr "Llimpiar" #: weblate/static/loader-bootstrap.js:740 msgid "Text copied to clipboard." msgstr "" #: weblate/static/loader-bootstrap.js:743 msgid "Please press Ctrl+C to copy." msgstr "" #: weblate/static/loader-bootstrap.js:767 msgid "Search…" msgstr "" #: weblate/static/loader-bootstrap.js:768 msgid "Available:" msgstr "Disponible:" #: weblate/static/loader-bootstrap.js:769 msgid "Chosen:" msgstr "" #: weblate/static/zammad.js:3 msgid "Weblate feedback" msgstr "" #: weblate/static/zammad.js:4 msgid "Get help" msgstr "" #: weblate/static/zammad.js:6 #, javascript-format msgid "" "Thank you for your inquiry (#%s)! We'll contact you as soon as possible." msgstr "" #: weblate/static/zammad.js:13 msgid "Subject" msgstr "Asuntu" #: weblate/static/zammad.js:21 msgid "Your name" msgstr "El to nome" #: weblate/static/zammad.js:29 msgid "Your e-mail" msgstr "El to corréu" #: weblate/static/zammad.js:37 msgid "Message" msgstr "Mensax" #: weblate/static/zammad.js:41 msgid "" "Please contact us in English, otherwise we might be unable to process your " "request." msgstr "" "Por favor, comunícate con nós n'inglés, d'otra manera probablemente nun " "podremos procesar la solicitú." #: weblate/static/zammad.js:47 msgid "Attachments" msgstr "" #, fuzzy #~| msgid "Alt+I then %s" #~ msgid "Ctrl+I then %s" #~ msgstr "Alt+I dempués %s" #~ msgid "Selected:" #~ msgstr "Seleicionao:" #~ msgid "Alt+%s" #~ msgstr "Alt+%s" #, fuzzy #~| msgctxt "Short name of month" #~| msgid "Nov" #~ msgid "Now" #~ msgstr "Pay" #~ msgid "Cancel" #~ msgstr "Encaboxar" #~ msgid "Translated strings" #~ msgstr "Cadenes tornaes" #~ msgid "Ok" #~ msgstr "Val" #~ msgid "AJAX request to load this content has failed!" #~ msgstr "¡Falló la petición AJAX pa cargar esti conteníu!" #~ msgid "Loading…" #~ msgstr "En cargando…"
{ "pile_set_name": "Github" }
// // GJRedDotProtocol.h // GJRedDotDemo // // Created by wangyutao on 16/5/20. // Copyright © 2016年 wangyutao. All rights reserved. // #import <Foundation/Foundation.h> @protocol GJRedDotModelProtocol; @protocol GJRedDotProtocol <NSObject> /** * get cache model when use custom model * * @param key : red dot key * * @return model */ - (id<GJRedDotModelProtocol>)getCacheModelWithKey:(NSString *)key; /** * save model or whatever cache with key * * @param key red dot key */ - (void)saveModelWithKey:(NSString *)key; @end
{ "pile_set_name": "Github" }
<div id="main_column" class="xxlarge-11 xlarge-10 large-9 medium-8 columns" style="padding-top: 1rem; height: 3993px;" data-equalizer-watch=""> <!-- main column content - comment used to remove left column and center content on some pages --> <h1>Nova groups for food processing</h1> <h2>A classification in 4 groups to highlight the degree of processing of foods</h2> <p>In the report "The UN Decade of Nutrition, the NOVA food classification and the trouble with ultra-processing" (<a href="https://www.cambridge.org/core/journals/public-health-nutrition/article/un-decade-of-nutrition-the-nova-food-classification-and-the-trouble-with-ultraprocessing/2A9776922A28F8F757BDA32C3266AC2A">pdf</a>, <a href="https://archive.wphna.org/wp-content/uploads/2016/01/WN-2016-7-1-3-28-38-Monteiro-Cannon-Levy-et-al-NOVA.pdf">pdf</a>), Carlos Augusto Monteiro, Geoffrey Cannon, Jean-Claude Moubarac, Renata Bertazzi Levy, Maria Laura C. Louzada and Patrícia Constante Jaime advocate for the adoption of a system of grades from 1 to 4 to allow to simply compare the degree of processing of products.</p> <p>New research associating researchers from Inserm, Inra and the Paris 13 University (Centre de recherche épidémiologie et statistique Sorbonne Paris Cité, équipe EREN) suggest a correlation between the cosumption of ultra-transformed foods and an increased risk of developing a cancer. </p> <a href="https://www.bmj.com/content/360/bmj.k322">Consumption of ultra-processed foods and cancer risk: results from NutriNet-Santé prospective cohort</a><br> <a href="https://presse.inserm.fr/consommation-daliments-ultra-transformes-et-risque-de-cancer/30645/">Press Release in French : Consommation d’aliments ultra-transformés et risque de cancer</a><br><br> <p>Some countries use the NOVA groups for their dietary guidelines or goals, for instance:</p> <ul> <li><a href="http://www.fao.org/nutrition/education/food-based-dietary-guidelines/regions/countries/brazil/en/">Brazil's dietary guidelines</a> recommend to limit consumption of processed food and avoid ultra-processed food.</li> <li><a href="https://www.hcsp.fr/Explore.cgi/avisrapportsdomaine?clefr=648">France's public health nutritional policy goals for 2018-2022</a> aims to reduce consumption of group 4 ultra-processed foods by 20%.</li> </ul> The NOVA classification assigns a group to food products based on how much processing they have been through: <br> <img src="https://static.openfoodfacts.org/images/misc/nova-group-1.svg"> <img src="https://static.openfoodfacts.org/images/misc/nova-group-2.svg"> <img src="https://static.openfoodfacts.org/images/misc/nova-group-3.svg"> <img src="https://static.openfoodfacts.org/images/misc/nova-group-4.svg"> <br><br> <ul> <li>1. taldea - Prozesatu gabeko edo ahalik eta gutxien prozesatutako elikagaiak</li> <li>2. taldea - Sukaldaritzako osagaiak prozesatu</li> <li>3. taldea - Prozesatutako jakiak</li> <li>4. taldea - Ultra-prozesatutako jakiak eta edariak</li> </ul> <h3>Group 1. Prozesatu gabeko edo ahalik eta gutxien prozesatutako elikagaiak</h3> <p>Unprocessed (or natural) foods are edible parts of plants (seeds, fruits, leaves, stems, roots) or of animals (muscle, offal, eggs, milk), and also fungi, algae and water, after separation from nature. </p> <p>Minimally processed foods are natural foods altered by processes that include removal of inedible or unwanted parts, and drying, crushing, grinding, fractioning, filtering, roasting, boiling, non-alcoholic fermentation, pasteurization, refrigeration, chilling, freezing, placing in containers and vacuum-packaging. These processes are designed to preserve natural foods, to make them suitable for storage, or to make them safe or edible or more pleasant to consume. Many unprocessed or minimally processed foods are prepared and cooked at home or in restaurant kitchens in combination with processed culinary ingredients as dishes or meals.</p> <h3>Group 2. Sukaldaritzako osagaiak prozesatu</h3> <p>Processed culinary ingredients, such as oils, butter, sugar and salt, are substances derived from Group 1 foods or from nature by processes that include pressing, refining, grinding, milling and drying. The purpose of such processes is to make durable products that are suitable for use in home and restaurant kitchens to prepare, season and cook Group 1 foods and to make with them varied and enjoyable hand-made dishes and meals, such as stews, soups and broths, salads, breads, preserves, drinks and desserts. They are not meant to be consumed by themselves, and are normally used in combination with Group 1 foods to make freshly prepared drinks, dishes and meals.</p> <h3>Group 3. Prozesatutako jakiak</h3> <p>Processed foods, such as bottled vegetables, canned fish, fruits in syrup, cheeses and freshly made breads, are made essentially by adding salt, oil, sugar or other substances from Group 2 to Group 1 foods. </p> <p>Processes include various preservation or cooking methods, and, in the case of breads and cheese, non-alcoholic fermentation. Most processed foods have two or three ingredients, and are recognizable as modified versions of Group 1 foods. They are edible by themselves or, more usually, in combination with other foods. The purpose of processing here is to increase the durability of Group 1 foods, or to modify or enhance their sensory qualities.</p> <h3>Group 4. Ultra-processed foods</h3> <p>Ultra-processed foods, such as soft drinks, sweet or savoury packaged snacks, reconstituted meat products and pre-prepared frozen dishes, are not modified foods but formulations made mostly or entirely from substances derived from foods and additives, with little if any intact Group 1 food.</p> <p>Ingredients of these formulations usually include those also used in processed foods, such as sugars, oils, fats or salt. But ultra-processed products also include other sources of energy and nutrients not normally used in culinary preparations. Some of these are directly extracted from foods, such as casein, lactose, whey and gluten.</p> <p>Many are derived from further processing of food constituents, such as hydrogenated or interesterified oils, hydrolysed proteins, soya protein isolate, maltodextrin, invert sugar and high-fructose corn syrup.</p> <p>Additives in ultra-processed foods include some also used in processed foods, such as preservatives, antioxidants and stabilizers. Classes of additives found only in ultra-processed products include those used to imitate or enhance the sensory qualities of foods or to disguise unpalatable aspects of the final product. These additives include dyes and other colours, colour stabilizers; flavours, flavour enhancers, non-sugar sweeteners; and processing aids such as carbonating, firming, bulking and anti-bulking, de-foaming, anti-caking and glazing agents, emulsifiers, sequestrants and humectants.</p> <p>A multitude of sequences of processes is used to combine the usually many ingredients and to create the final product (hence 'ultra-processed'). The processes include several with no domestic equivalents, such as hydrogenation and hydrolysation, extrusion and moulding, and pre-processing for frying.</p> <p>The overall purpose of ultra-processing is to create branded, convenient (durable, ready to consume), attractive (hyper-palatable) and highly profitable (low-cost ingredients) food products designed to displace all other food groups. Ultra-processed food products are usually packaged attractively and marketed intensively.</p> <div class="small-12 medium-6 columns"> <img src="https://static.openfoodfacts.org/images/misc/nutriscore-biscuits-e.800x600.jpg" alt="NutriScore on the Open Food Facts mobile app"> <p><em>Get the NOVA group with the Open Food Facts app!</em></p> </div> <h3>Install the Open Food Facts mobile app</h3> <p>To scan food products, get the NOVA group for ultra-processed foods, their Nutri-Score nutritional grade, allergens alerts and to decypher food additives, install the free Open Food Facts app!</p> <a href="https://apps.apple.com/app/open-food-facts/id588797948"><img src="https://static.openfoodfacts.org/images/misc/appstore/black/appstore_US.svg" alt="Available on the App Store" width="120" height="40"></a> <a href="https://play.google.com/store/apps/details?id=org.openfoodfacts.scanner&hl=eu"><img src="https://world.openfoodfacts.org/images/misc/google-play-badge-svg-master/img/en_get.svg" alt="Available on Google Play" width="102" height="40"></a> <a href="https://www.microsoft.com/en-us/p/openfoodfacts/9nblggh0dkqr"><img src="https://world.openfoodfacts.org/images/misc/microsoft/English.svg" alt="Windows Phone Store" width="109" height="40"></a> <a href="https://world.openfoodfacts.org/files/off.apk"><img src="https://static.openfoodfacts.org/images/misc/android-apk.svg" alt="Android APK"></a> <br><br> <p>You will also be able to easily add new products to Open Food Facts and help to build a common good to improve everyone's food and health. Thank you!</p> <h2>The Nova score on Open Food Facts</h2> <p>The formula for calculating the Nova score were published in the <a href="https://archive.wphna.org/wp-content/uploads/2016/01/WN-2016-7-1-3-28-38-Monteiro-Cannon-Levy-et-al-NOVA.pdf">NOVA. The star shines bright</a> article published in World Nutrition Volume 7, Number 1 - 3, January - March 2016 </p> <p>Please note that this is still experimental work as multilingual taxonomisation of ingredients is still an ongoing work on Open Food Facts.</p> <h2>Formula to determine the Nova group</h2> <h3>We start by assigning group 1</h3> <h4>We first try to identify group 2 processed culinary ingredients</h4> <ul> <li><a href="https://world.openfoodfacts.org/category/en:fats">fats</a></li> <li><a href="https://world.openfoodfacts.org/category/en:salts">gatzak</a></li> <li><a href="https://world.openfoodfacts.org/category/en:vinegars">vinegars</a></li> <li><a href="https://world.openfoodfacts.org/category/en:sugars">azukreak</a></li> <li><a href="https://world.openfoodfacts.org/category/en:honeys">eztiak</a></li> <li><a href="https://world.openfoodfacts.org/category/en:maple-syrups">maple syrups</a></li> </ul> <h4>Ingredients and categories associated with group 3 will not be applied to food identified as group 2</h4> <ul> <li><a href="https://world.openfoodfacts.org/ingredient/en:preservative">preservative</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:salt">gatza</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:sugar">azukrea</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:vegetable-oil">vegetable oil</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:butter">gurina</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:honey">eztia</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:maple-syrup">maple-syrup</a></li> </ul> <h4>Ingredients and categories only found in group 4</h4> <ul> <li><a href="https://world.openfoodfacts.org/ingredient/en:colour">colour</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:colour-stabilizer">colour stabilizer</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:flavour-enhancer">flavour enhancer</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:sweetener">sweetener</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:carbonating-agent">carbonating agent</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:firming-agent">firming agent</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:bulking-agent">bulking agent</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:anti-bulking-agent">anti-bulking agent</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:de-foaming-agent">de-foaming agent</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:anti-caking-agent">anti-caking agent</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:glazing-agent">glazing agent</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:emulsifier">emulsifier</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:sequestrant">sequestrant</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:humectant">humectant</a></li> </ul> <ul> <li><a href="https://world.openfoodfacts.org/ingredient/en:flavour">flavour</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:casein">casein</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:lactose">lactose</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:whey">gazura</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:hydrogenated-oil">hydrogenated-oil</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:hydrolysed-proteins">hydrolysed-proteins</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:maltodextrin">maltodextrin</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:invert-sugar">invert-sugar</a></li> <li><a href="https://world.openfoodfacts.org/ingredient/en:high-fructose-corn-syrup">high-fructose-corn-syrup</a></li> </ul> <ul> <li><a href="https://world.openfoodfacts.org/category/en:sodas">freskagarriak</a></li> <li><a href="https://world.openfoodfacts.org/category/en:ice-creams">ice creams</a></li> <li><a href="https://world.openfoodfacts.org/category/en:chocolates">chocolates</a></li> <li><a href="https://world.openfoodfacts.org/category/en:candies">candies</a></li> <li><a href="https://world.openfoodfacts.org/category/en:meals">bazkariak</a></li> <li><a href="https://world.openfoodfacts.org/category/en:sugary-snacks">sugary snacks</a></li> <li><a href="https://world.openfoodfacts.org/category/en:salty-snacks">salty snacks</a></li> <li><a href="https://world.openfoodfacts.org/category/en:baby-milks">baby milks</a></li> <li><a href="https://world.openfoodfacts.org/category/en:sausages">sausages</a></li> </ul> <p>You can help us determine the Nova group for more products by completing the ingredients and the categories of products.</p> </div>
{ "pile_set_name": "Github" }
// -*- Mode: Java -*- // // XmlGlobalAttribute.java /* +---------------------------- BEGIN LICENSE BLOCK ---------------------------+ | | | Version: MPL 1.1/GPL 2.0/LGPL 2.1 | | | | The contents of this file are subject to the Mozilla Public License | | Version 1.1 (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.mozilla.org/MPL/ | | | | Software distributed under the License is distributed on an "AS IS" basis, | | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | | for the specific language governing rights and limitations under the | | License. | | | | The Original Code is the STELLA Programming Language. | | | | The Initial Developer of the Original Code is | | UNIVERSITY OF SOUTHERN CALIFORNIA, INFORMATION SCIENCES INSTITUTE | | 4676 Admiralty Way, Marina Del Rey, California 90292, U.S.A. | | | | Portions created by the Initial Developer are Copyright (C) 1996-2017 | | the Initial Developer. All Rights Reserved. | | | | Contributor(s): | | | | Alternatively, the contents of this file may be used under the terms of | | either the GNU General Public License Version 2 or later (the "GPL"), or | | the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | | in which case the provisions of the GPL or the LGPL are applicable instead | | of those above. If you wish to allow use of your version of this file only | | under the terms of either the GPL or the LGPL, and not to allow others to | | use your version of this file under the terms of the MPL, indicate your | | decision by deleting the provisions above and replace them with the notice | | and other provisions required by the GPL or the LGPL. If you do not delete | | the provisions above, a recipient may use your version of this file under | | the terms of any one of the MPL, the GPL or the LGPL. | | | +---------------------------- END LICENSE BLOCK -----------------------------+ */ package edu.isi.stella; import edu.isi.stella.javalib.*; public class XmlGlobalAttribute extends XmlAttribute { public String namespaceName; public String namespaceUri; public static XmlGlobalAttribute newXmlGlobalAttribute() { { XmlGlobalAttribute self = null; self = new XmlGlobalAttribute(); self.surfaceForm = null; self.name = null; self.namespaceUri = null; self.namespaceName = null; return (self); } } public static boolean xmlGlobalAttributeMatchP(XmlGlobalAttribute attribute, String name, String namespace) { return (Stella.stringEqlP(attribute.name, name) && Stella.stringEqlP(attribute.namespaceUri, namespace)); } /** Return <code>true</code> if <code>attribute</code> is a global XML attribute with name <code>name</code> * in namespace <code>namespace</code>. Note that <code>namespace</code> is the full URI, not an * abbreviation. Also, <code>namespace</code> may be <code>null</code>, in which case <code>attribute</code> * must not have a namespace associated with it. * @param name * @param namespace * @return boolean */ public boolean xmlAttributeMatchP(String name, String namespace) { { XmlGlobalAttribute attribute = this; return (Stella.stringEqlP(attribute.name, name) && Stella.stringEqlP(attribute.namespaceUri, namespace)); } } public static Stella_Object accessXmlGlobalAttributeSlotValue(XmlGlobalAttribute self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Stella.SYM_STELLA_NAMESPACE_NAME) { if (setvalueP) { self.namespaceName = ((StringWrapper)(value)).wrapperValue; } else { value = StringWrapper.wrapString(self.namespaceName); } } else if (slotname == Stella.SYM_STELLA_NAMESPACE_URI) { if (setvalueP) { self.namespaceUri = ((StringWrapper)(value)).wrapperValue; } else { value = StringWrapper.wrapString(self.namespaceUri); } } else { { OutputStringStream stream000 = OutputStringStream.newOutputStringStream(); stream000.nativeStream.print("`" + slotname + "' is not a valid case option"); throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace())); } } return (value); } public Surrogate primaryType() { { XmlGlobalAttribute self = this; return (Stella.SGT_STELLA_XML_GLOBAL_ATTRIBUTE); } } }
{ "pile_set_name": "Github" }
/* Copyright (c) 2007-2014 Contributors as noted in the AUTHORS file This file is part of 0MQ. 0MQ is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 0MQ 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "poller_base.hpp" #include "i_poll_events.hpp" #include "err.hpp" zmq::poller_base_t::poller_base_t () { } zmq::poller_base_t::~poller_base_t () { // Make sure there is no more load on the shutdown. zmq_assert (get_load () == 0); } int zmq::poller_base_t::get_load () { return load.get (); } void zmq::poller_base_t::adjust_load (int amount_) { if (amount_ > 0) load.add (amount_); else if (amount_ < 0) load.sub (-amount_); } void zmq::poller_base_t::add_timer (int timeout_, i_poll_events *sink_, int id_) { uint64_t expiration = clock.now_ms () + timeout_; timer_info_t info = {sink_, id_}; timers.insert (timers_t::value_type (expiration, info)); } void zmq::poller_base_t::cancel_timer (i_poll_events *sink_, int id_) { // Complexity of this operation is O(n). We assume it is rarely used. for (timers_t::iterator it = timers.begin (); it != timers.end (); ++it) if (it->second.sink == sink_ && it->second.id == id_) { timers.erase (it); return; } // Timer not found. zmq_assert (false); } uint64_t zmq::poller_base_t::execute_timers () { // Fast track. if (timers.empty ()) return 0; // Get the current time. uint64_t current = clock.now_ms (); // Execute the timers that are already due. timers_t::iterator it = timers.begin (); while (it != timers.end ()) { // If we have to wait to execute the item, same will be true about // all the following items (multimap is sorted). Thus we can stop // checking the subsequent timers and return the time to wait for // the next timer (at least 1ms). if (it->first > current) return it->first - current; // Trigger the timer. it->second.sink->timer_event (it->second.id); // Remove it from the list of active timers. timers_t::iterator o = it; ++it; timers.erase (o); } // There are no more timers. return 0; }
{ "pile_set_name": "Github" }
############################################################################## # # file : Makefile # created : 2014年 09月 01日 星期一 13:08:53 EDT # copyright : (C) 2002 Chenyi Chen # ############################################################################## # # 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. # ############################################################################## ROBOT = chenyi_AI9 MODULE = ${ROBOT}.so MODULEDIR = drivers/${ROBOT} SOURCES = ${ROBOT}.cpp SHIPDIR = drivers/${ROBOT} SHIP = ${ROBOT}.xml pw-evoviwrc.rgb logo.rgb SHIPSUBDIRS = PKGSUBDIRS = ${SHIPSUBDIRS} src-robots-chenyi_AI9_PKGFILES = $(shell find * -maxdepth 0 -type f -print) src-robots-chenyi_AI9_PKGDIR = ${PACKAGE}-${VERSION}/$(subst ${TORCS_BASE},,$(shell pwd)) include ${MAKE_DEFAULT}
{ "pile_set_name": "Github" }