text
stringlengths
2
99.9k
meta
dict
/* ************************************************************************ qooxdoo - the new era of web development http://qooxdoo.org Copyright: 2004-2011 1&1 Internet AG, Germany, http://www.1und1.de License: MIT: https://opensource.org/licenses/MIT See the LICENSE file in the project's top-level directory for details. Authors: * Martin Wittemann (wittemann) ************************************************************************ */ /** * Responsible for checking all relevant animation properties. * * Spec: http://www.w3.org/TR/css3-animations/ * * @require(qx.bom.Stylesheet) * @internal */ qx.Bootstrap.define("qx.bom.client.CssAnimation", { statics : { /** * Main check method which returns an object if CSS animations are * supported. This object contains all necessary keys to work with CSS * animations. * <ul> * <li><code>name</code> The name of the css animation style</li> * <li><code>play-state</code> The name of the play-state style</li> * <li><code>start-event</code> The name of the start event</li> * <li><code>iteration-event</code> The name of the iteration event</li> * <li><code>end-event</code> The name of the end event</li> * <li><code>fill-mode</code> The fill-mode style</li> * <li><code>keyframes</code> The name of the keyframes selector.</li> * </ul> * * @internal * @return {Object|null} The described object or null, if animations are * not supported. */ getSupport : function() { var name = qx.bom.client.CssAnimation.getName(); if (name != null) { return { "name" : name, "play-state" : qx.bom.client.CssAnimation.getPlayState(), "start-event" : qx.bom.client.CssAnimation.getAnimationStart(), "iteration-event" : qx.bom.client.CssAnimation.getAnimationIteration(), "end-event" : qx.bom.client.CssAnimation.getAnimationEnd(), "fill-mode" : qx.bom.client.CssAnimation.getFillMode(), "keyframes" : qx.bom.client.CssAnimation.getKeyFrames() }; } return null; }, /** * Checks for the 'animation-fill-mode' CSS style. * @internal * @return {String|null} The name of the style or null, if the style is * not supported. */ getFillMode : function() { return qx.bom.Style.getPropertyName("AnimationFillMode"); }, /** * Checks for the 'animation-play-state' CSS style. * @internal * @return {String|null} The name of the style or null, if the style is * not supported. */ getPlayState : function() { return qx.bom.Style.getPropertyName("AnimationPlayState"); }, /** * Checks for the style name used for animations. * @internal * @return {String|null} The name of the style or null, if the style is * not supported. */ getName : function() { return qx.bom.Style.getPropertyName("animation"); }, /** * Checks for the event name of animation start. * @internal * @return {String} The name of the event. */ getAnimationStart : function() { // special handling for mixed prefixed / unprefixed implementations if (qx.bom.Event.supportsEvent(window, "webkitanimationstart")) { return "webkitAnimationStart"; } var mapping = { "msAnimation" : "MSAnimationStart", "WebkitAnimation" : "webkitAnimationStart", "MozAnimation" : "animationstart", "OAnimation" : "oAnimationStart", "animation" : "animationstart" }; return mapping[this.getName()]; }, /** * Checks for the event name of animation end. * @internal * @return {String} The name of the event. */ getAnimationIteration : function() { // special handling for mixed prefixed / unprefixed implementations if (qx.bom.Event.supportsEvent(window, "webkitanimationiteration")) { return "webkitAnimationIteration"; } var mapping = { "msAnimation" : "MSAnimationIteration", "WebkitAnimation" : "webkitAnimationIteration", "MozAnimation" : "animationiteration", "OAnimation" : "oAnimationIteration", "animation" : "animationiteration" }; return mapping[this.getName()]; }, /** * Checks for the event name of animation end. * @internal * @return {String} The name of the event. */ getAnimationEnd : function() { // special handling for mixed prefixed / unprefixed implementations if (qx.bom.Event.supportsEvent(window, "webkitanimationend")) { return "webkitAnimationEnd"; } var mapping = { "msAnimation" : "MSAnimationEnd", "WebkitAnimation" : "webkitAnimationEnd", "MozAnimation" : "animationend", "OAnimation" : "oAnimationEnd", "animation" : "animationend" }; return mapping[this.getName()]; }, /** * Checks what selector should be used to add keyframes to stylesheets. * @internal * @return {String|null} The name of the selector or null, if the selector * is not supported. */ getKeyFrames : function() { var prefixes = qx.bom.Style.VENDOR_PREFIXES; var keyFrames = []; for (var i=0; i < prefixes.length; i++) { var key = "@" + qx.bom.Style.getCssName(prefixes[i]) + "-keyframes"; keyFrames.push(key); }; keyFrames.unshift("@keyframes"); var sheet = qx.bom.Stylesheet.createElement(); for (var i=0; i < keyFrames.length; i++) { try { qx.bom.Stylesheet.addRule(sheet, keyFrames[i] + " name", ""); return keyFrames[i]; } catch (e) {} }; return null; }, /** * Checks for the requestAnimationFrame method and return the prefixed name. * @internal * @return {String|null} A string the method name or null, if the method * is not supported. */ getRequestAnimationFrame : function() { var choices = [ "requestAnimationFrame", "msRequestAnimationFrame", "webkitRequestAnimationFrame", "mozRequestAnimationFrame", "oRequestAnimationFrame" // currently unspecified, so we guess the name! ]; for (var i=0; i < choices.length; i++) { if (window[choices[i]] != undefined) { return choices[i]; } }; return null; } }, defer : function(statics) { qx.core.Environment.add("css.animation", statics.getSupport); qx.core.Environment.add("css.animation.requestframe", statics.getRequestAnimationFrame); } });
{ "pile_set_name": "Github" }
import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { TranslatorService } from '@core/translator/translator.service'; import { ApiResource } from '@shared/viewModel/api-resource.model'; import { ProblemDetails } from '@shared/viewModel/default-response.model'; import { StandardClaims } from '@shared/viewModel/standard-claims.model'; import { ToasterConfig, ToasterService } from 'angular2-toaster'; import * as jsonpatch from 'fast-json-patch'; import { flatMap, tap } from 'rxjs/operators'; import { ApiResourceService } from '../api-resource.service'; @Component({ selector: "app-api-resource-edit", templateUrl: "./api-resource-edit.component.html", styleUrls: ["./api-resource-edit.component.scss"], providers: [ApiResourceService] }) export class ApiResourceEditComponent implements OnInit { public errors: Array<string>; public model: ApiResource; public toasterconfig: ToasterConfig = new ToasterConfig({ positionClass: 'toast-top-right', showCloseButton: true }); public showButtonLoading: boolean; public resourceId: string; standardClaims: string[]; patchObserver: jsonpatch.Observer<ApiResource>; constructor( private route: ActivatedRoute, private router: Router, public translator: TranslatorService, private apiResourceService: ApiResourceService, public toasterService: ToasterService) { } public ngOnInit() { this.route.params.pipe( tap(p => this.resourceId = p["name"]), flatMap(p => this.apiResourceService.getApiResourceDetails(p["name"])), tap(resource => this.patchObserver = jsonpatch.observe(resource))) .subscribe(result => this.model = result); this.errors = []; this.showButtonLoading = false; this.standardClaims = StandardClaims.claims; } public update() { this.showButtonLoading = true; this.errors = []; this.apiResourceService.partialUpdate(this.resourceId, jsonpatch.generate(this.patchObserver)).subscribe( () => { this.showSuccessMessage(); this.showButtonLoading = false; }, err => { this.errors = ProblemDetails.GetErrors(err).map(a => a.value); this.showButtonLoading = false; } ); } public addClaim(claim: string) { if (this.model.userClaims.find(f => f == claim) == null) this.model.userClaims.push(claim); } public showSuccessMessage() { this.translator.translate.get('toasterMessages').subscribe(a => { this.toasterService.pop("success", a["title-success"], a["message-success"]); }); } }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 91f3ed25af9c2d945ad763ccd9126e05 timeCreated: 1445595745 licenseType: Store TextureImporter: fileIDToRecycleName: {} serializedVersion: 2 mipmaps: mipMapMode: 0 enableMipMap: 1 linearTexture: 1 correctGamma: 0 fadeOut: 0 borderMipMap: 0 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: convertToNormalMap: 0 externalNormalMap: 1 heightScale: .25 normalMapFilter: 0 isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 0 cubemapConvolution: 0 cubemapConvolutionSteps: 8 cubemapConvolutionExponent: 1.5 seamlessCubemap: 0 textureFormat: -1 maxTextureSize: 2048 textureSettings: filterMode: -1 aniso: -1 mipBias: -1 wrapMode: -1 nPOTScale: 1 lightmap: 0 rGBM: 0 compressionQuality: 50 allowsAlphaSplitting: 0 spriteMode: 0 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 spritePivot: {x: .5, y: .5} spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 alphaIsTransparency: 0 textureType: 1 buildTargetSettings: [] spriteSheet: sprites: [] spritePackingTag: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
// Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // Preprocessed version of "boost/mpl/bind_fwd.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { template< typename F, typename T1 = na, typename T2 = na, typename T3 = na , typename T4 = na, typename T5 = na > struct bind; template< typename F > struct bind0; template< typename F, typename T1 > struct bind1; template< typename F, typename T1, typename T2 > struct bind2; template< typename F, typename T1, typename T2, typename T3 > struct bind3; template< typename F, typename T1, typename T2, typename T3, typename T4 > struct bind4; template< typename F, typename T1, typename T2, typename T3, typename T4 , typename T5 > struct bind5; }}
{ "pile_set_name": "Github" }
// Code generated by client-gen. DO NOT EDIT. package fake import ( "context" hivev1 "github.com/openshift/hive/pkg/apis/hive/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" ) // FakeClusterProvisions implements ClusterProvisionInterface type FakeClusterProvisions struct { Fake *FakeHiveV1 ns string } var clusterprovisionsResource = schema.GroupVersionResource{Group: "hive.openshift.io", Version: "v1", Resource: "clusterprovisions"} var clusterprovisionsKind = schema.GroupVersionKind{Group: "hive.openshift.io", Version: "v1", Kind: "ClusterProvision"} // Get takes name of the clusterProvision, and returns the corresponding clusterProvision object, and an error if there is any. func (c *FakeClusterProvisions) Get(ctx context.Context, name string, options v1.GetOptions) (result *hivev1.ClusterProvision, err error) { obj, err := c.Fake. Invokes(testing.NewGetAction(clusterprovisionsResource, c.ns, name), &hivev1.ClusterProvision{}) if obj == nil { return nil, err } return obj.(*hivev1.ClusterProvision), err } // List takes label and field selectors, and returns the list of ClusterProvisions that match those selectors. func (c *FakeClusterProvisions) List(ctx context.Context, opts v1.ListOptions) (result *hivev1.ClusterProvisionList, err error) { obj, err := c.Fake. Invokes(testing.NewListAction(clusterprovisionsResource, clusterprovisionsKind, c.ns, opts), &hivev1.ClusterProvisionList{}) if obj == nil { return nil, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } list := &hivev1.ClusterProvisionList{ListMeta: obj.(*hivev1.ClusterProvisionList).ListMeta} for _, item := range obj.(*hivev1.ClusterProvisionList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } } return list, err } // Watch returns a watch.Interface that watches the requested clusterProvisions. func (c *FakeClusterProvisions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(clusterprovisionsResource, c.ns, opts)) } // Create takes the representation of a clusterProvision and creates it. Returns the server's representation of the clusterProvision, and an error, if there is any. func (c *FakeClusterProvisions) Create(ctx context.Context, clusterProvision *hivev1.ClusterProvision, opts v1.CreateOptions) (result *hivev1.ClusterProvision, err error) { obj, err := c.Fake. Invokes(testing.NewCreateAction(clusterprovisionsResource, c.ns, clusterProvision), &hivev1.ClusterProvision{}) if obj == nil { return nil, err } return obj.(*hivev1.ClusterProvision), err } // Update takes the representation of a clusterProvision and updates it. Returns the server's representation of the clusterProvision, and an error, if there is any. func (c *FakeClusterProvisions) Update(ctx context.Context, clusterProvision *hivev1.ClusterProvision, opts v1.UpdateOptions) (result *hivev1.ClusterProvision, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateAction(clusterprovisionsResource, c.ns, clusterProvision), &hivev1.ClusterProvision{}) if obj == nil { return nil, err } return obj.(*hivev1.ClusterProvision), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). func (c *FakeClusterProvisions) UpdateStatus(ctx context.Context, clusterProvision *hivev1.ClusterProvision, opts v1.UpdateOptions) (*hivev1.ClusterProvision, error) { obj, err := c.Fake. Invokes(testing.NewUpdateSubresourceAction(clusterprovisionsResource, "status", c.ns, clusterProvision), &hivev1.ClusterProvision{}) if obj == nil { return nil, err } return obj.(*hivev1.ClusterProvision), err } // Delete takes name of the clusterProvision and deletes it. Returns an error if one occurs. func (c *FakeClusterProvisions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. Invokes(testing.NewDeleteAction(clusterprovisionsResource, c.ns, name), &hivev1.ClusterProvision{}) return err } // DeleteCollection deletes a collection of objects. func (c *FakeClusterProvisions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewDeleteCollectionAction(clusterprovisionsResource, c.ns, listOpts) _, err := c.Fake.Invokes(action, &hivev1.ClusterProvisionList{}) return err } // Patch applies the patch and returns the patched clusterProvision. func (c *FakeClusterProvisions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *hivev1.ClusterProvision, err error) { obj, err := c.Fake. Invokes(testing.NewPatchSubresourceAction(clusterprovisionsResource, c.ns, name, pt, data, subresources...), &hivev1.ClusterProvision{}) if obj == nil { return nil, err } return obj.(*hivev1.ClusterProvision), err }
{ "pile_set_name": "Github" }
//========================================================================= // ENUMTYPE.CC - part of // OMNeT++/OMNEST // Discrete System Simulation in C++ // // Author: Andras Varga // //========================================================================= /*--------------------------------------------------------------* Copyright (C) 1992-2017 Andras Varga Copyright (C) 2006-2017 OpenSim Ltd. This file is distributed WITHOUT ANY WARRANTY. See the file `license' for details on this and other legal matters. *--------------------------------------------------------------*/ #include <sstream> #include <algorithm> #include "common/stringtokenizer.h" #include "scaveutils.h" #include "enumtype.h" using namespace omnetpp::common; namespace omnetpp { namespace scave { EnumType::EnumType(const EnumType& list) { copy(list); } EnumType::EnumType() { } EnumType::~EnumType() { } void EnumType::copy(const EnumType& other) { valueToNameMap = other.valueToNameMap; nameToValueMap = other.nameToValueMap; } EnumType& EnumType::operator=(const EnumType& other) { if (this == &other) return *this; copy(other); return *this; } void EnumType::insert(int value, const char *name) { valueToNameMap[value] = name; nameToValueMap[name] = value; } const char *EnumType::nameOf(int value) const { std::map<int, std::string>::const_iterator it = valueToNameMap.find(value); return it == valueToNameMap.end() ? nullptr : it->second.c_str(); } int EnumType::valueOf(const char *name, int fallback) const { std::map<std::string, int>::const_iterator it = nameToValueMap.find(name); return it == nameToValueMap.end() ? fallback : it->second; } static bool less(const std::pair<int, std::string>& left, const std::pair<int, std::string>& right) { return left.first < right.first; } static std::string second(std::pair<int, std::string> pair) { return pair.second; } std::vector<std::string> EnumType::getNames() const { std::vector<std::pair<int, std::string> > pairs(valueToNameMap.begin(), valueToNameMap.end()); std::sort(pairs.begin(), pairs.end(), less); std::vector<std::string> names(pairs.size()); std::transform(pairs.begin(), pairs.end(), names.begin(), second); return names; } std::string EnumType::str() const { std::stringstream out; for (std::map<std::string, int>::const_iterator it = nameToValueMap.begin(); it != nameToValueMap.end(); ++it) { if (it != nameToValueMap.begin()) out << ", "; out << it->first << "=" << it->second; } return out.str(); } void EnumType::parseFromString(const char *str) { valueToNameMap.clear(); nameToValueMap.clear(); StringTokenizer tokenizer(str, ", "); int value = -1; while (tokenizer.hasMoreTokens()) { std::string nameValue = tokenizer.nextToken(); std::string::size_type pos = nameValue.find('='); if (pos == std::string::npos) { insert(++value, nameValue.c_str()); } else { std::string name = nameValue.substr(0, pos); std::string valueStr = nameValue.substr(pos+1); if (!parseInt(valueStr.c_str(), value)) throw opp_runtime_error("Enum value must be an int, found: %s", valueStr.c_str()); insert(value, name.c_str()); } } } } // namespace scave } // namespace omnetpp
{ "pile_set_name": "Github" }
{ "LoadBalancerListeners": [] }
{ "pile_set_name": "Github" }
{ "_from": "[email protected]", "_id": "[email protected]", "_inBundle": false, "_integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "_location": "/glob", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, "raw": "[email protected]", "name": "glob", "escapedName": "glob", "rawSpec": "7.1.6", "saveSpec": null, "fetchSpec": "7.1.6" }, "_requiredBy": [ "#USER", "/", "/cacache", "/deglob", "/eslint", "/init-package-json", "/node-gyp", "/nyc", "/pacote", "/read-package-json", "/rimraf", "/tap", "/tap-mocha-reporter", "/test-exclude" ], "_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "_shasum": "141f33b81a7c2492e125594307480c46679278a6", "_spec": "[email protected]", "_where": "/Users/darcyclarke/Documents/Repos/npm/cli", "author": { "name": "Isaac Z. Schlueter", "email": "[email protected]", "url": "http://blog.izs.me/" }, "bugs": { "url": "https://github.com/isaacs/node-glob/issues" }, "bundleDependencies": false, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, "deprecated": false, "description": "a little globber", "devDependencies": { "mkdirp": "0", "rimraf": "^2.2.8", "tap": "^12.0.1", "tick": "0.0.6" }, "engines": { "node": "*" }, "files": [ "glob.js", "sync.js", "common.js" ], "funding": { "url": "https://github.com/sponsors/isaacs" }, "homepage": "https://github.com/isaacs/node-glob#readme", "license": "ISC", "main": "glob.js", "name": "glob", "repository": { "type": "git", "url": "git://github.com/isaacs/node-glob.git" }, "scripts": { "bench": "bash benchmark.sh", "benchclean": "node benchclean.js", "prepublish": "npm run benchclean", "prof": "bash prof.sh && cat profile.txt", "profclean": "rm -f v8.log profile.txt", "test": "tap test/*.js --cov", "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js" }, "version": "7.1.6" }
{ "pile_set_name": "Github" }
require_relative '../../spec_helper' require_relative 'shared/arg' describe "Numeric#phase" do it_behaves_like :numeric_arg, :phase end
{ "pile_set_name": "Github" }
<?php /* * Copyright 2014 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ class Google_Service_SQLAdmin_DatabaseInstanceFailoverReplica extends Google_Model { public $available; public $name; public function setAvailable($available) { $this->available = $available; } public function getAvailable() { return $this->available; } public function setName($name) { $this->name = $name; } public function getName() { return $this->name; } }
{ "pile_set_name": "Github" }
--- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -324,7 +324,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^) quiet_cmd_lzma = LZMA $@ cmd_lzma = (cat $(filter-out FORCE,$^) | \ - lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ + lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ (rm -f $@ ; false) quiet_cmd_lzo = LZO $@ --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -226,7 +226,7 @@ cpio_list= output="/dev/stdout" output_file="" is_cpio_compressed= -compr="gzip -n -9 -f" +compr="gzip -n -9 -f -" arg="$1" case "$arg" in @@ -242,13 +242,13 @@ case "$arg" in output=${cpio_list} echo "$output_file" | grep -q "\.gz$" \ && [ -x "`which gzip 2> /dev/null`" ] \ - && compr="gzip -n -9 -f" + && compr="gzip -n -9 -f -" echo "$output_file" | grep -q "\.bz2$" \ && [ -x "`which bzip2 2> /dev/null`" ] \ - && compr="bzip2 -9 -f" + && compr="bzip2 -9 -f -" echo "$output_file" | grep -q "\.lzma$" \ && [ -x "`which lzma 2> /dev/null`" ] \ - && compr="lzma -9 -f" + && compr="lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so" echo "$output_file" | grep -q "\.xz$" \ && [ -x "`which xz 2> /dev/null`" ] \ && compr="xz --check=crc32 --lzma2=dict=1MiB" @@ -315,7 +315,7 @@ if [ ! -z ${output_file} ]; then if [ "${is_cpio_compressed}" = "compressed" ]; then cat ${cpio_tfile} > ${output_file} else - (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ + (cat ${cpio_tfile} | ${compr} > ${output_file}) \ || (rm -f ${output_file} ; false) fi [ -z ${cpio_file} ] && rm ${cpio_tfile} --- a/lib/decompress.c +++ b/lib/decompress.c @@ -48,6 +48,7 @@ static const struct compress_format comp { {0x1f, 0x9e}, "gzip", gunzip }, { {0x42, 0x5a}, "bzip2", bunzip2 }, { {0x5d, 0x00}, "lzma", unlzma }, + { {0x6d, 0x00}, "lzma-openwrt", unlzma }, { {0xfd, 0x37}, "xz", unxz }, { {0x89, 0x4c}, "lzo", unlzo }, { {0x02, 0x21}, "lz4", unlz4 },
{ "pile_set_name": "Github" }
const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const path = require('path'); module.exports = { mode: "development", devtool: 'cheap-module-source-map', entry: [ './src/utils/polyfills.js', './src/index.jsx', ], output: { path: path.join(__dirname, '/build'), publicPath: '/', filename: 'bundle.js' }, module: { rules: [ { test: /\.jsx?$/, exclude: /node_modules/, use: [ 'babel-loader' ] }, { test: /\.css$/i, use: [ 'style-loader', { loader: 'css-loader', options: { importLoaders: 1, }, }, 'postcss-loader' ] }, { test: /\.(ttf|eot|svg|woff(2)?)(\?v=[\d.]+)?(\?[a-z0-9#-]+)?$/, loader: 'url-loader?limit=100000&name=./css/[hash].[ext]' } ] }, resolve: { extensions: ['.js', '.jsx'] }, devServer: { contentBase: './build' }, plugins: [ new HtmlWebpackPlugin({ template: './build/index.html', inject: true }), new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"development"' }), ], target: "web", stats: false };
{ "pile_set_name": "Github" }
Shader "Hidden/Shader Forge/SFN_Max_5" { Properties { _OutputMask ("Output Mask", Vector) = (1,1,1,1) _A ("A", 2D) = "black" {} _B ("B", 2D) = "black" {} _C ("C", 2D) = "black" {} _D ("D", 2D) = "black" {} _E ("E", 2D) = "black" {} } SubShader { Tags { "RenderType"="Opaque" } Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #define UNITY_PASS_FORWARDBASE #include "UnityCG.cginc" #pragma target 3.0 uniform float4 _OutputMask; uniform sampler2D _A; uniform sampler2D _B; uniform sampler2D _C; uniform sampler2D _D; uniform sampler2D _E; struct VertexInput { float4 vertex : POSITION; float2 texcoord0 : TEXCOORD0; }; struct VertexOutput { float4 pos : SV_POSITION; float2 uv : TEXCOORD0; }; VertexOutput vert (VertexInput v) { VertexOutput o = (VertexOutput)0; o.uv = v.texcoord0; o.pos = UnityObjectToClipPos(v.vertex ); return o; } float4 frag(VertexOutput i) : COLOR { // Read inputs float4 _a = tex2D( _A, i.uv ); float4 _b = tex2D( _B, i.uv ); float4 _c = tex2D( _C, i.uv ); float4 _d = tex2D( _D, i.uv ); float4 _e = tex2D( _E, i.uv ); // Operator float4 outputColor = max(max(max(max(_a, _b), _c), _d), _e); // Return return outputColor * _OutputMask; } ENDCG } } }
{ "pile_set_name": "Github" }
.TH libssh2_session_banner_set 3 "9 Sep 2011" "libssh2 1.4.0" "libssh2 manual" .SH NAME libssh2_session_banner_set - set the SSH prococol banner for the local client .SH SYNOPSIS #include <libssh2.h> int libssh2_session_banner_set(LIBSSH2_SESSION *session, const char *banner); .SH DESCRIPTION \fIsession\fP - Session instance as returned by .BR libssh2_session_init_ex(3) \fIbanner\fP - A pointer to a zero-terminated string holding the user defined banner Set the banner that will be sent to the remote host when the SSH session is started with \fIlibssh2_session_handshake(3)\fP This is optional; a banner corresponding to the protocol and libssh2 version will be sent by default. .SH RETURN VALUE Returns 0 on success or negative on failure. It returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se. .SH ERRORS \fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed. .SH AVAILABILITY Added in 1.4.0. Before 1.4.0 this function was known as libssh2_banner_set(3) .SH SEE ALSO .BR libssh2_session_handshake(3), .BR libssh2_session_banner_get(3)
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:theme="@android:style/ThemeOverlay.Material.Dark" android:background="?android:selectableItemBackground" android:layout_height="wrap_content" android:layout_width="match_parent" android:padding="@dimen/margin_md" android:orientation="vertical"> <TextView android:id="@+id/title" style="@style/HeaderText" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Header" android:layout_marginBottom="@dimen/margin_sm" /> <TextView android:id="@+id/description" style="@style/BodyText" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Some Description" /> </LinearLayout>
{ "pile_set_name": "Github" }
form=词 tags= 芍药斗新妆, 杨柳飞轻雪。 著意留连不放春, 已向东皇说。 况是谪仙家, 自有长生诀。 方士呼来借玉蟾, 要吸杯中月。
{ "pile_set_name": "Github" }
package schemaherokubectlcli import ( "fmt" "os" "path/filepath" "github.com/pkg/errors" "github.com/schemahero/schemahero/pkg/database" "github.com/spf13/cobra" "github.com/spf13/viper" ) func PlanCmd() *cobra.Command { cmd := &cobra.Command{ Use: "plan", Short: "plan a spec application against a database", Long: `...`, SilenceUsage: true, PreRun: func(cmd *cobra.Command, args []string) { viper.BindPFlags(cmd.Flags()) }, RunE: func(cmd *cobra.Command, args []string) error { v := viper.GetViper() // to support automaticenv, we can't use cobra required flags driver := v.GetString("driver") specFile := v.GetString("spec-file") uri := v.GetString("uri") host := v.GetStringSlice("host") if driver == "" || specFile == "" || uri == "" || len(host) == 0 { missing := []string{} if driver == "" { missing = append(missing, "driver") } if specFile == "" { missing = append(missing, "spec-file") } // one of uri or host/port must be specified if uri == "" && len(host) == 0 { missing = append(missing, "uri or host(s)") } if len(missing) > 0 { return fmt.Errorf("missing required params: %v", missing) } } fi, err := os.Stat(v.GetString("spec-file")) if err != nil { return err } if _, err = os.Stat(v.GetString("out")); err == nil { if !v.GetBool("overwrite") { return errors.Errorf("file %s already exists", v.GetString("out")) } err = os.RemoveAll(v.GetString("out")) if err != nil { return errors.Wrap(err, "failed remove existing file") } } var f *os.File if v.GetString("out") != "" { f, err = os.OpenFile(v.GetString("out"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil { return err } defer f.Close() } db := database.Database{ InputDir: v.GetString("input-dir"), OutputDir: v.GetString("output-dir"), Driver: v.GetString("driver"), URI: v.GetString("uri"), Hosts: v.GetStringSlice("host"), Username: v.GetString("username"), Password: v.GetString("password"), Keyspace: v.GetString("keyspace"), } if fi.Mode().IsDir() { err := filepath.Walk(v.GetString("spec-file"), func(path string, info os.FileInfo, err error) error { if !info.IsDir() { statements, err := db.PlanSyncFromFile(path, v.GetString("spec-type")) if err != nil { return err } if f != nil { for _, statement := range statements { if _, err := f.WriteString(fmt.Sprintf("%s;\n", statement)); err != nil { return err } } } else { for _, statement := range statements { fmt.Printf("%s;\n", statement) } } } return nil }) return err } else { statements, err := db.PlanSyncFromFile(v.GetString("spec-file"), v.GetString("spec-type")) if err != nil { return err } if f != nil { for _, statement := range statements { if _, err := f.WriteString(fmt.Sprintf("%s;\n", statement)); err != nil { return err } } } else { for _, statement := range statements { fmt.Printf("%s;\n", statement) } } return nil } }, } cmd.Flags().String("driver", "", "name of the database driver to use") cmd.Flags().String("uri", "", "connection string uri to use") cmd.Flags().String("username", "", "username to use when connecting") cmd.Flags().String("password", "", "password to use when connecting") cmd.Flags().StringSlice("host", []string{}, "hostname to use when connecting") cmd.Flags().String("keyspace", "", "the keyspace to use for databases that support keyspaces") cmd.Flags().String("spec-file", "", "filename or directory name containing the spec(s) to apply") cmd.Flags().String("spec-type", "table", "type of spec in spec-file") cmd.Flags().String("out", "", "filename to write DDL statements to, if not present output file be written to stdout") cmd.Flags().Bool("overwrite", true, "when set, will overwrite the out file, if it already exists") return cmd }
{ "pile_set_name": "Github" }
<?php namespace Drupal\Tests\entity_test\Functional\Rest; use Drupal\entity_test\Entity\EntityTest; use Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait; use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase; use Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait; use Drupal\Tests\Traits\ExpectDeprecationTrait; use Drupal\user\Entity\User; abstract class EntityTestResourceTestBase extends EntityResourceTestBase { use BcTimestampNormalizerUnixTestTrait; use EntityDefinitionTestTrait; use ExpectDeprecationTrait; /** * {@inheritdoc} */ public static $modules = ['entity_test']; /** * {@inheritdoc} */ protected static $entityTypeId = 'entity_test'; /** * {@inheritdoc} */ protected static $patchProtectedFieldNames = []; /** * @var \Drupal\entity_test\Entity\EntityTest */ protected $entity; /** * {@inheritdoc} */ protected function setUpAuthorization($method) { switch ($method) { case 'GET': $this->grantPermissionsToTestedRole(['view test entity']); break; case 'POST': $this->grantPermissionsToTestedRole(['create entity_test entity_test_with_bundle entities']); break; case 'PATCH': case 'DELETE': $this->grantPermissionsToTestedRole(['administer entity_test content']); break; } } /** * {@inheritdoc} */ protected function createEntity() { // Set flag so that internal field 'internal_string_field' is created. // @see entity_test_entity_base_field_info() $this->container->get('state')->set('entity_test.internal_field', TRUE); $this->applyEntityUpdates('entity_test'); $entity_test = EntityTest::create([ 'name' => 'Llama', 'type' => 'entity_test', // Set a value for the internal field to confirm that it will not be // returned in normalization. // @see entity_test_entity_base_field_info(). 'internal_string_field' => [ 'value' => 'This value shall not be internal!', ], ]); $entity_test->setOwnerId(0); $entity_test->save(); return $entity_test; } /** * {@inheritdoc} */ protected function getExpectedNormalizedEntity() { $author = User::load(0); $normalization = [ 'uuid' => [ [ 'value' => $this->entity->uuid(), ], ], 'id' => [ [ 'value' => 1, ], ], 'langcode' => [ [ 'value' => 'en', ], ], 'type' => [ [ 'value' => 'entity_test', ], ], 'name' => [ [ 'value' => 'Llama', ], ], 'created' => [ $this->formatExpectedTimestampItemValues((int) $this->entity->get('created')->value), ], 'user_id' => [ [ 'target_id' => (int) $author->id(), 'target_type' => 'user', 'target_uuid' => $author->uuid(), 'url' => $author->toUrl()->toString(), ], ], 'field_test_text' => [], ]; return $normalization; } /** * {@inheritdoc} */ protected function getNormalizedPostEntity() { return [ 'type' => [ [ 'value' => 'entity_test', ], ], 'name' => [ [ 'value' => 'Dramallama', ], ], ]; } /** * {@inheritdoc} */ protected function getExpectedUnauthorizedAccessMessage($method) { if ($this->config('rest.settings')->get('bc_entity_resource_permissions')) { return parent::getExpectedUnauthorizedAccessMessage($method); } switch ($method) { case 'GET': return "The 'view test entity' permission is required."; case 'POST': return "The following permissions are required: 'administer entity_test content' OR 'administer entity_test_with_bundle content' OR 'create entity_test entity_test_with_bundle entities'."; default: return parent::getExpectedUnauthorizedAccessMessage($method); } } }
{ "pile_set_name": "Github" }
/* * Copyright 2016 Azavea * * 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 geotrellis.raster.mapalgebra.focal import geotrellis.raster._ /** * Computes the standard deviation of a neighborhood for a given raster. Returns a raster of DoubleConstantNoDataCellType. * * @note StandardDeviation does not currently support Double raster data inputs. * If you use a Tile with a Double CellType (FloatConstantNoDataCellType, DoubleConstantNoDataCellType) * the data values will be rounded to integers. */ object StandardDeviation { def calculation(tile: Tile, n: Neighborhood, bounds: Option[GridBounds[Int]] = None, target: TargetCell = TargetCell.All): FocalCalculation[Tile] = { if(tile.cellType.isFloatingPoint) { new CursorCalculation[Tile](tile, n, bounds, target) with DoubleArrayTileResult { var count: Int = 0 var sum: Double = 0 def calc(r: Tile, c: Cursor) = { c.removedCells.foreach { (x, y) => val v = r.getDouble(x, y) if(isData(v)) { count -= 1 if (count == 0) sum = 0 else sum -= v } } c.addedCells.foreach { (x, y) => val v = r.getDouble(x, y) if(isData(v)) { count += 1; sum += v } } val mean = sum / count.toDouble var squares = 0.0 c.allCells.foreach { (x, y) => val v = r.getDouble(x, y) if(isData(v)) { squares += math.pow(v - mean, 2) } } resultTile.setDouble(c.col, c.row, math.sqrt(squares / count.toDouble)) } } } else { new CursorCalculation[Tile](tile, n, bounds, target) with DoubleArrayTileResult { var count: Int = 0 var sum: Int = 0 def calc(r: Tile, c: Cursor) = { c.removedCells.foreach { (x, y) => val v = r.get(x, y) if (isData(v)) { count -= 1; sum -= v } } c.addedCells.foreach { (x, y) => val v = r.get(x, y) if (isData(v)) { count += 1; sum += v } } val mean = sum / count.toDouble var squares = 0.0 c.allCells.foreach { (x, y) => val v = r.get(x, y) if (isData(v)) { squares += math.pow(v - mean, 2) } } resultTile.setDouble(c.col, c.row, math.sqrt(squares / count.toDouble)) } } } } def apply(tile: Tile, n: Neighborhood, bounds: Option[GridBounds[Int]] = None, target: TargetCell = TargetCell.All): Tile = calculation(tile, n, bounds, target).execute() }
{ "pile_set_name": "Github" }
/* SPDX-License-Identifier: GPL-2.0-only */ #include <arch/romstage.h> #include <cbmem.h> void mainboard_romstage_entry(void) { cbmem_recovery(0); }
{ "pile_set_name": "Github" }
.\" ************************************************************************** .\" * _ _ ____ _ .\" * Project ___| | | | _ \| | .\" * / __| | | | |_) | | .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * .\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <[email protected]>, et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms .\" * are also available at https://curl.haxx.se/docs/copyright.html. .\" * .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell .\" * copies of the Software, and permit persons to whom the Software is .\" * furnished to do so, under the terms of the COPYING file. .\" * .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY .\" * KIND, either express or implied. .\" * .\" ************************************************************************** .\" .TH CURLOPT_COOKIESESSION 3 "May 05, 2017" "libcurl 7.56.1" "curl_easy_setopt options" .SH NAME CURLOPT_COOKIESESSION \- start a new cookie session .SH SYNOPSIS #include <curl/curl.h> CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COOKIESESSION, long init); .SH DESCRIPTION Pass a long set to 1 to mark this as a new cookie "session". It will force libcurl to ignore all cookies it is about to load that are "session cookies" from the previous session. By default, libcurl always stores and loads all cookies, independent if they are session cookies or not. Session cookies are cookies without expiry date and they are meant to be alive and existing for this "session" only. A "session" is usually defined in browser land for as long as you have your browser up, more or less. .SH DEFAULT 0 .SH PROTOCOLS HTTP .SH EXAMPLE .nf CURL *curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin"); /* new "session", don't load session cookies */ curl_easy_setopt(curl, CURLOPT_COOKIESESSION, 1L); /* get the (non session) cookies from this file */ curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "/tmp/cookies.txt"); ret = curl_easy_perform(curl); curl_easy_cleanup(curl); } .fi .SH AVAILABILITY Along with HTTP .SH RETURN VALUE Returns CURLE_OK .SH "SEE ALSO" .BR CURLOPT_COOKIEFILE "(3), " CURLOPT_COOKIE "(3), "
{ "pile_set_name": "Github" }
<!-- Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v. 2.0, which is available at http://www.eclipse.org/legal/epl-2.0. This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License v. 2.0 are satisfied: GNU General Public License, version 2 with the GNU Classpath Exception, which is available at https://www.gnu.org/software/classpath/license.html. SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 --> <f:verbatim> <script type="text/javascript"> function initClassname(option) { var selectedOption = getSelectedValueFromForm(document.forms['form1'], 'classnameOption'); enableClassnameFields(option); if (option == 'input'){ #{themeJavascript.JS_PREFIX}.radiobutton.setChecked('#{rbPropId}:optB', true); }else{ #{themeJavascript.JS_PREFIX}.radiobutton.setChecked('#{rbPropId}:optA', true); } } function enableClassnameFields(opt){ if(opt == 'input') { enableComponent('#{classnameTextId}', 'text'); getTextElement('#{classnameTextId}').focus(); #{themeJavascript.JS_PREFIX}.dropDown.setDisabled('#{classnameDropdownId}', true); //showDisplay('none'); document.getElementById('form1:option').value='input'; }else{ //We need to set a timeout to delay the call to getTextElement inside disable component. //otherwise getTextElement will always return null, causing JS error. window.setTimeout("disableComponent('#{classnameTextId}', 'text')", 1); #{themeJavascript.JS_PREFIX}.dropDown.setDisabled('#{classnameDropdownId}', false); //showDisplay(''); document.getElementById('form1:option').value='predefine'; } } var factoryMap = #{pageSession.factoryMap}; function updateFactoryClass(selected) { var component = document.getElementById("#{pageSession.factoryClassTextId}"); component.value = factoryMap[selected]; } function updateFactoryClassOnClick() { var classDD = document.getElementById("#{pageSession.classnameDropdownId}"); var component = document.getElementById("#{pageSession.factoryClassTextId}"); component.value = factoryMap[classDD.value]; } </script> </f:verbatim>
{ "pile_set_name": "Github" }
<!--******************************************************************** * Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved. *********************************************************************--> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title data-i18n='resources.title_componentsLayerList_Vue'></title> <script type="text/javascript" include="vue" src="../js/include-web.js"></script> <script include="ant-design-vue,iclient-mapboxgl-vue,mapbox-gl-enhance" src="../../dist/mapboxgl/include-mapboxgl.js"></script> <style> #main{ margin: 0 auto; width: 100%; height: 100%; } </style> </head> <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;"> <div id="main"> <sm-web-map server-url='https://iportal.supermap.io/iportal' map-id="801571284"> <!-- 图层列表组件:sm-layer-list --> <sm-layer-list position="top-left" :collapsed="false"></sm-layer-list> </sm-web-map> </div> <script> new Vue({ el: '#main' }) </script> </body> </html>
{ "pile_set_name": "Github" }
// entry
{ "pile_set_name": "Github" }
/* * Copyright (C) 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include "Weak.h" #include "JSCInlines.h" #include "WeakSetInlines.h" namespace JSC { void weakClearSlowCase(WeakImpl*& impl) { ASSERT(impl); WeakSet::deallocate(impl); impl = 0; } } // namespace JSC
{ "pile_set_name": "Github" }
import { alias } from '@ember/object/computed'; import { get, computed } from '@ember/object'; import { inject as service } from '@ember/service'; import { Ability } from 'ember-can'; export default Ability.extend({ currentUser: service(), canManage: computed('organization.owner.id', 'currentUser.user.id', function() { return get(this, 'organization.owner.id') === get(this, 'currentUser.user.id'); }), organization: alias('model') });
{ "pile_set_name": "Github" }
version https://git-lfs.github.com/spec/v1 oid sha256:c7d6d9fb472aafeec5afb373b6695546a42dbf7506e450913a7de9464b41c687 size 11088
{ "pile_set_name": "Github" }
/*! * jQuery UI Effects Bounce 1.11.4 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/bounce-effect/ */ (function( factory ) { if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. define([ "jquery", "./effect" ], factory ); } else { // Browser globals factory( jQuery ); } }(function( $ ) { return $.effects.effect.bounce = function( o, done ) { var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "height", "width" ], // defaults: mode = $.effects.setMode( el, o.mode || "effect" ), hide = mode === "hide", show = mode === "show", direction = o.direction || "up", distance = o.distance, times = o.times || 5, // number of internal animations anims = times * 2 + ( show || hide ? 1 : 0 ), speed = o.duration / anims, easing = o.easing, // utility: ref = ( direction === "up" || direction === "down" ) ? "top" : "left", motion = ( direction === "up" || direction === "left" ), i, upAnim, downAnim, // we will need to re-assemble the queue to stack our animations in place queue = el.queue(), queuelen = queue.length; // Avoid touching opacity to prevent clearType and PNG issues in IE if ( show || hide ) { props.push( "opacity" ); } $.effects.save( el, props ); el.show(); $.effects.createWrapper( el ); // Create Wrapper // default distance for the BIGGEST bounce is the outer Distance / 3 if ( !distance ) { distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; } if ( show ) { downAnim = { opacity: 1 }; downAnim[ ref ] = 0; // if we are showing, force opacity 0 and set the initial position // then do the "first" animation el.css( "opacity", 0 ) .css( ref, motion ? -distance * 2 : distance * 2 ) .animate( downAnim, speed, easing ); } // start at the smallest distance if we are hiding if ( hide ) { distance = distance / Math.pow( 2, times - 1 ); } downAnim = {}; downAnim[ ref ] = 0; // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here for ( i = 0; i < times; i++ ) { upAnim = {}; upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; el.animate( upAnim, speed, easing ) .animate( downAnim, speed, easing ); distance = hide ? distance * 2 : distance / 2; } // Last Bounce when Hiding if ( hide ) { upAnim = { opacity: 0 }; upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; el.animate( upAnim, speed, easing ); } el.queue(function() { if ( hide ) { el.hide(); } $.effects.restore( el, props ); $.effects.removeWrapper( el ); done(); }); // inject all the animations we just queued to be first in line (after "inprogress") if ( queuelen > 1) { queue.splice.apply( queue, [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); } el.dequeue(); }; }));
{ "pile_set_name": "Github" }
{ "info" : { "version" : 1, "author" : "xcode" } }
{ "pile_set_name": "Github" }
yargs ======== Yargs be a node.js library fer hearties tryin' ter parse optstrings. With yargs, ye be havin' a map that leads straight to yer treasure! Treasure of course, being a simple option hash. [![Build Status](https://travis-ci.org/bcoe/yargs.png)](https://travis-ci.org/bcoe/yargs) [![Dependency Status](https://gemnasium.com/bcoe/yargs.png)](https://gemnasium.com/bcoe/yargs) [![Coverage Status](https://coveralls.io/repos/bcoe/yargs/badge.svg?branch=)](https://coveralls.io/r/bcoe/yargs?branch=) [![NPM version](https://img.shields.io/npm/v/yargs.svg)](https://www.npmjs.com/package/yargs) > Yargs is the official successor to optimist. Please feel free to submit issues and pull requests. If you'd like to contribute and don't know where to start, have a look at [the issue list](https://github.com/bcoe/yargs/issues) :) examples ======== With yargs, the options be just a hash! ------------------------------------------------------------------- xup.js: ````javascript #!/usr/bin/env node var argv = require('yargs').argv; if (argv.rif - 5 * argv.xup > 7.138) { console.log('Plunder more riffiwobbles!'); } else { console.log('Drop the xupptumblers!'); } ```` *** $ ./xup.js --rif=55 --xup=9.52 Plunder more riffiwobbles! $ ./xup.js --rif 12 --xup 8.1 Drop the xupptumblers! ![Joe was one optimistic pirate.](http://i.imgur.com/4WFGVJ9.png) But don't walk the plank just yet! There be more! You can do short options: ------------------------------------------------- short.js: ````javascript #!/usr/bin/env node var argv = require('yargs').argv; console.log('(%d,%d)', argv.x, argv.y); ```` *** $ ./short.js -x 10 -y 21 (10,21) And booleans, both long, short, and even grouped: ---------------------------------- bool.js: ````javascript #!/usr/bin/env node var util = require('util'); var argv = require('yargs').argv; if (argv.s) { util.print(argv.fr ? 'Le perroquet dit: ' : 'The parrot says: '); } console.log( (argv.fr ? 'couac' : 'squawk') + (argv.p ? '!' : '') ); ```` *** $ ./bool.js -s The parrot says: squawk $ ./bool.js -sp The parrot says: squawk! $ ./bool.js -sp --fr Le perroquet dit: couac! And non-hyphenated options too! Just use `argv._`! ------------------------------------------------- nonopt.js: ````javascript #!/usr/bin/env node var argv = require('yargs').argv; console.log('(%d,%d)', argv.x, argv.y); console.log(argv._); ```` *** $ ./nonopt.js -x 6.82 -y 3.35 rum (6.82,3.35) [ 'rum' ] $ ./nonopt.js "me hearties" -x 0.54 yo -y 1.12 ho (0.54,1.12) [ 'me hearties', 'yo', 'ho' ] Yargs even counts your booleans! ---------------------------------------------------------------------- count.js ````javascript #!/usr/bin/env node var argv = require('yargs') .count('verbose') .alias('v', 'verbose') .argv; VERBOSE_LEVEL = argv.verbose; function WARN() { VERBOSE_LEVEL >= 0 && console.log.apply(console, arguments); } function INFO() { VERBOSE_LEVEL >= 1 && console.log.apply(console, arguments); } function DEBUG() { VERBOSE_LEVEL >= 2 && console.log.apply(console, arguments); } WARN("Showing only important stuff"); INFO("Showing semi-mportant stuff too"); DEBUG("Extra chatty mode"); ```` *** $ node count.js Showing only important stuff $ node count.js -v Showing only important stuff Showing semi-important stuff too $ node count.js -vv Showing only important stuff Showing semi-important stuff too Extra chatty mode $ node count.js -v --verbose Showing only important stuff Showing semi-important stuff too Extra chatty mode Tell users how to use yer options and make demands. ------------------------------------------------- divide.js: ````javascript #!/usr/bin/env node var argv = require('yargs') .usage('Usage: $0 -x [num] -y [num]') .demand(['x','y']) .argv; console.log(argv.x / argv.y); ```` *** $ ./divide.js -x 55 -y 11 5 $ node ./divide.js -x 4.91 -z 2.51 Usage: node ./divide.js -x [num] -y [num] Options: -x [required] -y [required] Missing required arguments: y After yer demands have been met, demand more! Ask for non-hypenated arguments! ----------------------------------------- demand_count.js: ````javascript #!/usr/bin/env node var argv = require('yargs') .demand(2) .argv; console.dir(argv) ```` *** $ ./demand_count.js a Not enough arguments, expected 2, but only found 1 $ ./demand_count.js a b { _: [ 'a', 'b' ], '$0': 'node ./demand_count.js' } $ ./demand_count.js a b c { _: [ 'a', 'b', 'c' ], '$0': 'node ./demand_count.js' } EVEN MORE SHIVER ME TIMBERS! ------------------ default_singles.js: ````javascript #!/usr/bin/env node var argv = require('yargs') .default('x', 10) .default('y', 10) .argv ; console.log(argv.x + argv.y); ```` *** $ ./default_singles.js -x 5 15 default_hash.js: ````javascript #!/usr/bin/env node var argv = require('yargs') .default({ x : 10, y : 10 }) .argv ; console.log(argv.x + argv.y); ```` *** $ ./default_hash.js -y 7 17 And if you really want to get all descriptive about it... --------------------------------------------------------- boolean_single.js ````javascript #!/usr/bin/env node var argv = require('yargs') .boolean('v') .argv ; console.dir(argv.v); console.dir(argv._); ```` *** $ ./boolean_single.js -v "me hearties" yo ho true [ 'me hearties', 'yo', 'ho' ] boolean_double.js ````javascript #!/usr/bin/env node var argv = require('yargs') .boolean(['x','y','z']) .argv ; console.dir([ argv.x, argv.y, argv.z ]); console.dir(argv._); ```` *** $ ./boolean_double.js -x -z one two three [ true, false, true ] [ 'one', 'two', 'three' ] Yargs is here to help you... --------------------------- Ye can describe parameters fer help messages and set aliases. Yargs figures out how ter format a handy help string automatically. line_count.js ````javascript #!/usr/bin/env node var argv = require('yargs') .usage('Usage: $0 <command> [options]') .command('count', 'Count the lines in a file') .demand(1) .example('$0 count -f foo.js', 'count the lines in the given file') .demand('f') .alias('f', 'file') .nargs('f', 1) .describe('f', 'Load a file') .help('h') .alias('h', 'help') .epilog('copyright 2015') .argv; var fs = require('fs'); var s = fs.createReadStream(argv.file); var lines = 0; s.on('data', function (buf) { lines += buf.toString().match(/\n/g).length; }); s.on('end', function () { console.log(lines); }); ```` *** $ node line_count.js count Usage: node test.js <command> [options] Commands: count Count the lines in a file Options: -f, --file Load a file [required] -h, --help Show help Examples: node test.js count -f foo.js count the lines in the given file copyright 2015 Missing required arguments: f $ node line_count.js count --file line_count.js 20 $ node line_count.js count -f line_count.js 20 methods ======= By itself, ````javascript require('yargs').argv ````` will use `process.argv` array to construct the `argv` object. You can pass in the `process.argv` yourself: ````javascript require('yargs')([ '-x', '1', '-y', '2' ]).argv ```` or use .parse() to do the same thing: ````javascript require('yargs').parse([ '-x', '1', '-y', '2' ]) ```` The rest of these methods below come in just before the terminating `.argv`. .alias(key, alias) ------------------ Set key names as equivalent such that updates to a key will propagate to aliases and vice-versa. Optionally `.alias()` can take an object that maps keys to aliases. Each key of this object should be the canonical version of the option, and each value should be a string or an array of strings. .default(key, value, [description]) -------------------- Set `argv[key]` to `value` if no option was specified on `process.argv`. Optionally `.default()` can take an object that maps keys to default values. But wait, there's more! the default value can be a `function` which returns a value. The name of the function will be used in the usage string: ```js var argv = require('yargs') .default('random', function randomValue() { return Math.random() * 256; }).argv; ``` Optionally, `description` can also be provided and will take precedence over displaying the value in the usage instructions: ```js .default('timeout', 60000, '(one-minute)'); ``` .demand(key, [msg | boolean]) ----------------------------- .require(key, [msg | boolean]) ------------------------------ .required(key, [msg | boolean]) ------------------------------- If `key` is a string, show the usage information and exit if `key` wasn't specified in `process.argv`. If `key` is a number, demand at least as many non-option arguments, which show up in `argv._`. If `key` is an Array, demand each element. If a `msg` string is given, it will be printed when the argument is missing, instead of the standard error message. This is especially helpful for the non-option arguments in `argv._`. If a `boolean` value is given, it controls whether the option is demanded; this is useful when using `.options()` to specify command line parameters. .requiresArg(key) ----------------- Specifies either a single option key (string), or an array of options that must be followed by option values. If any option value is missing, show the usage information and exit. The default behaviour is to set the value of any key not followed by an option value to `true`. .implies(x, y) -------------- Given the key `x` is set, it is required that the key `y` is set. implies can also accept an object specifying multiple implications. .describe(key, desc) -------------------- Describe a `key` for the generated usage information. Optionally `.describe()` can take an object that maps keys to descriptions. .option(key, opt) ----------------- .options(key, opt) ------------------ Instead of chaining together `.alias().demand().default().describe().string()`, you can specify keys in `opt` for each of the chainable methods. For example: ````javascript var argv = require('yargs') .option('f', { alias : 'file', demand: true, default: '/etc/passwd', describe: 'x marks the spot', type: 'string' }) .argv ; ```` is the same as ````javascript var argv = require('yargs') .alias('f', 'file') .default('f', '/etc/passwd') .argv ; ```` Optionally `.options()` can take an object that maps keys to `opt` parameters. ````javascript var argv = require('yargs') .options({ 'f': { alias: 'file', demand: true, default: '/etc/passwd', describe: 'x marks the spot', type: 'string' } }) .argv ; ```` .usage(message, opts) --------------------- Set a usage message to show which commands to use. Inside `message`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. `opts` is optional and acts like calling `.options(opts)`. .command(cmd, desc) ------------------- Document the commands exposed by your application (stored in the `_` variable). As an example, here's how the npm cli might document some of its commands: ```js var argv = require('yargs') .usage('npm <command>') .command('install', 'tis a mighty fine package to install') .command('publish', 'shiver me timbers, should you be sharing all that') .argv; ``` .example(cmd, desc) ------------------- Give some example invocations of your program. Inside `cmd`, the string `$0` will get interpolated to the current script name or node command for the present script similar to how `$0` works in bash or perl. Examples will be printed out as part of the help message. .epilogue(str) -------------- .epilog(str) ------------ A message to print at the end of the usage instructions, e.g., ```js var argv = require('yargs') .epilogue('for more information, find our manual at http://example.com'); ``` .check(fn) ---------- Check that certain conditions are met in the provided arguments. `fn` is called with two arguments, the parsed `argv` hash and an array of options and their aliases. If `fn` throws or returns a non-truthy value, show the thrown error, usage information, and exit. .fail(fn) --------- Method to execute when a failure occurs, rather then printing the failure message. `fn` is called with the failure message that would have been printed. .boolean(key) ------------- Interpret `key` as a boolean. If a non-flag option follows `key` in `process.argv`, that string won't get set as the value of `key`. `key` will default to `false`, unless an `default(key, undefined)` is explicitly set. If `key` is an Array, interpret all the elements as booleans. .string(key) ------------ Tell the parser logic not to interpret `key` as a number or boolean. This can be useful if you need to preserve leading zeros in an input. If `key` is an Array, interpret all the elements as strings. `.string('_')` will result in non-hyphenated arguments being interpreted as strings, regardless of whether they resemble numbers. .array(key) ---------- Tell the parser to interpret `key` as an array. If `.array('foo')` is set, `--foo bar` will be parsed as `['bar']` rather than as `'bar'`. .nargs(key, count) ----------- The number of arguments that should be consumed after a key. This can be a useful hint to prevent parsing ambiguity: ```js var argv = require('yargs') .nargs('token', 1) .parse(['--token', '-my-token']); ``` parses as: `{ _: [], token: '-my-token', '$0': 'node test' }` Optionally `.nargs()` can take an object of `key`/`narg` pairs. .config(key) ------------ Tells the parser to interpret `key` as a path to a JSON config file. The file is loaded and parsed, and its properties are set as arguments. .wrap(columns) -------------- Format usage output to wrap at `columns` many columns. By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to specify no column limit. .strict() --------- Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error. .help([option, [description]]) ------------------------------ Add an option (e.g., `--help`) that displays the usage string and exits the process. If present, the `description` parameter customises the description of the help option in the usage string. If invoked without parameters, `.help` returns the generated usage string. Example: ``` var yargs = require("yargs") .usage("$0 -operand1 number -operand2 number -operation [add|subtract]"); console.log(yargs.help()); ``` Later on, ```argv``` can be retrived with ```yargs.argv``` .version(version, [option], [description]) ---------------------------------------- Add an option (e.g., `--version`) that displays the version number (given by the `version` parameter) and exits the process. If present, the `description` parameter customizes the description of the version option in the usage string. You can provide a `function` for version, rather than a string. This is useful if you want to use the version from your package.json: ```js var argv = require('yargs') .version(function() { return require('../package').version; }) .argv; ``` .showHelpOnFail(enable, [message]) ---------------------------------- By default, yargs outputs a usage string if any error is detected. Use the `.showHelpOnFail` method to customize this behaviour. if `enable` is `false`, the usage string is not output. If the `message` parameter is present, this message is output after the error message. line_count.js ````javascript #!/usr/bin/env node var argv = require('yargs') .usage('Count the lines in a file.\nUsage: $0') .demand('f') .alias('f', 'file') .describe('f', 'Load a file') .showHelpOnFail(false, "Specify --help for available options") .argv; // etc. ```` *** $ node line_count.js --file Missing argument value: f Specify --help for available options .showHelp(fn=console.error) --------------------------- Print the usage data using `fn` for printing. Example: ``` var yargs = require("yargs") .usage("$0 -operand1 number -operand2 number -operation [add|subtract]"); yargs.showHelp(); ``` Later on, ```argv``` can be retrived with ```yargs.argv``` .completion(cmd, [description], [fn]); ------------- Enable bash-completion shortcuts for commands and options. `cmd`: when present in `argv._`, will result in the `.bashrc` completion script being outputted. To enable bash completions, concat the generated script to your `.bashrc`, or `.bash_profile`. `description`: provide a description in your usage instructions for the command that generates bash completion scripts. `fn`, rather than relying on yargs' default completion functionlity, which shiver me timbers is pretty awesome, you can provide your own completion method. ```js var argv = require('yargs') .completion('completion', function(current, argv) { // 'current' is the current command being completed. // 'argv' is the parsed arguments so far. // simply return an array of completions. return [ 'foo', 'bar' ]; }) .argv; ``` But wait, there's more! you can provide asynchronous completions. ```js var argv = require('yargs') .completion('completion', function(current, argv, done) { setTimeout(function() { done([ 'apple', 'banana' ]); }, 500); }) .argv; ``` .showCompletionScript() ---------------------- Generate a bash completion script. Users of your application can install this script in their `.bashrc`, and yargs will provide completion shortcuts for commands and options. .exitProcess(enable) ---------------------------------- By default, yargs exits the process when the user passes a help flag, uses the `.version` functionality or when validation fails. Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated. .parse(args) ------------ Parse `args` instead of `process.argv`. Returns the `argv` object. .reset() -------- Reset the argument object built up so far. This is useful for creating nested command line interfaces. ```js var yargs = require('./yargs') .usage('$0 command') .command('hello', 'hello command') .command('world', 'world command') .demand(1, 'must provide a valid command'), argv = yargs.argv, command = argv._[0]; if (command === 'hello') { yargs.reset() .usage('$0 hello') .help('h') .example('$0 hello', 'print the hello message!') .argv console.log('hello!'); } else if (command === 'world'){ yargs.reset() .usage('$0 world') .help('h') .example('$0 world', 'print the world message!') .argv console.log('world!'); } else { yargs.showHelp(); } ``` .argv ----- Get the arguments as a plain old object. Arguments without a corresponding flag show up in the `argv._` array. The script name or node command is available at `argv.$0` similarly to how `$0` works in bash or perl. parsing tricks ============== stop parsing ------------ Use `--` to stop parsing flags and stuff the remainder into `argv._`. $ node examples/reflect.js -a 1 -b 2 -- -c 3 -d 4 { _: [ '-c', '3', '-d', '4' ], '$0': 'node ./examples/reflect.js', a: 1, b: 2 } negate fields ------------- If you want to explicity set a field to false instead of just leaving it undefined or to override a default you can do `--no-key`. $ node examples/reflect.js -a --no-b { _: [], '$0': 'node ./examples/reflect.js', a: true, b: false } numbers ------- Every argument that looks like a number (`!isNaN(Number(arg))`) is converted to one. This way you can just `net.createConnection(argv.port)` and you can add numbers out of `argv` with `+` without having that mean concatenation, which is super frustrating. duplicates ---------- If you specify a flag multiple times it will get turned into an array containing all the values in order. $ node examples/reflect.js -x 5 -x 8 -x 0 { _: [], '$0': 'node ./examples/reflect.js', x: [ 5, 8, 0 ] } dot notation ------------ When you use dots (`.`s) in argument names, an implicit object path is assumed. This lets you organize arguments into nested objects. $ node examples/reflect.js --foo.bar.baz=33 --foo.quux=5 { _: [], '$0': 'node ./examples/reflect.js', foo: { bar: { baz: 33 }, quux: 5 } } short numbers ------------- Short numeric `head -n5` style argument work too: $ node reflect.js -n123 -m456 { '3': true, '6': true, _: [], '$0': 'node ./reflect.js', n: 123, m: 456 } installation ============ With [npm](http://github.com/isaacs/npm), just do: npm install yargs or clone this project on github: git clone http://github.com/bcoe/yargs.git To run the tests with npm, just do: npm test inspired by =========== This module is loosely inspired by Perl's [Getopt::Casual](http://search.cpan.org/~photo/Getopt-Casual-0.13.1/Casual.pm).
{ "pile_set_name": "Github" }
//----------------------------------------------------------------------------- // VRAD_DLL.VPC // // Project Script //----------------------------------------------------------------------------- $Macro SRCDIR "..\.." $Macro OUTBINDIR "$SRCDIR\..\game\bin" $Include "$SRCDIR\vpc_scripts\source_dll_base.vpc" $Configuration { $Compiler { $AdditionalIncludeDirectories "$BASE,..\common,..\vmpi,..\vmpi\mysql\mysqlpp\include,..\vmpi\mysql\include" $PreprocessorDefinitions "$BASE;MPI;PROTECTED_THINGS_DISABLE;VRAD" } $Linker { $AdditionalDependencies "$BASE ws2_32.lib" } } $Project "Vrad_dll" { $Folder "Source Files" { $File "$SRCDIR\public\BSPTreeData.cpp" $File "$SRCDIR\public\disp_common.cpp" $File "$SRCDIR\public\disp_powerinfo.cpp" $File "disp_vrad.cpp" $File "imagepacker.cpp" $File "incremental.cpp" $File "leaf_ambient_lighting.cpp" $File "lightmap.cpp" $File "$SRCDIR\public\loadcmdline.cpp" $File "$SRCDIR\public\lumpfiles.cpp" $File "macro_texture.cpp" $File "..\common\mpi_stats.cpp" $File "mpivrad.cpp" $File "..\common\MySqlDatabase.cpp" $File "..\common\pacifier.cpp" $File "..\common\physdll.cpp" $File "radial.cpp" $File "SampleHash.cpp" $File "trace.cpp" $File "..\common\utilmatlib.cpp" $File "vismat.cpp" $File "..\common\vmpi_tools_shared.cpp" $File "..\common\vmpi_tools_shared.h" $File "vrad.cpp" $File "VRAD_DispColl.cpp" $File "VradDetailProps.cpp" $File "VRadDisps.cpp" $File "vraddll.cpp" $File "VRadStaticProps.cpp" $File "$SRCDIR\public\zip_utils.cpp" $Folder "Common Files" { $File "..\common\bsplib.cpp" $File "$SRCDIR\public\builddisp.cpp" $File "$SRCDIR\public\ChunkFile.cpp" $File "..\common\cmdlib.cpp" $File "$SRCDIR\public\DispColl_Common.cpp" $File "..\common\map_shared.cpp" $File "..\common\polylib.cpp" $File "..\common\scriplib.cpp" $File "..\common\threads.cpp" $File "..\common\tools_minidump.cpp" $File "..\common\tools_minidump.h" } $Folder "Public Files" { $File "$SRCDIR\public\CollisionUtils.cpp" $File "$SRCDIR\public\filesystem_helpers.cpp" $File "$SRCDIR\public\ScratchPad3D.cpp" $File "$SRCDIR\public\ScratchPadUtils.cpp" } } $Folder "Header Files" { $File "disp_vrad.h" $File "iincremental.h" $File "imagepacker.h" $File "incremental.h" $File "leaf_ambient_lighting.h" $File "lightmap.h" $File "macro_texture.h" $File "$SRCDIR\public\map_utils.h" $File "mpivrad.h" $File "radial.h" $File "$SRCDIR\public\bitmap\tgawriter.h" $File "vismat.h" $File "vrad.h" $File "VRAD_DispColl.h" $File "vraddetailprops.h" $File "vraddll.h" $Folder "Common Header Files" { $File "..\common\bsplib.h" $File "..\common\cmdlib.h" $File "..\common\consolewnd.h" $File "..\vmpi\ichannel.h" $File "..\vmpi\imysqlwrapper.h" $File "..\vmpi\iphelpers.h" $File "..\common\ISQLDBReplyTarget.h" $File "..\common\map_shared.h" $File "..\vmpi\messbuf.h" $File "..\common\mpi_stats.h" $File "..\common\MySqlDatabase.h" $File "..\common\pacifier.h" $File "..\common\polylib.h" $File "..\common\scriplib.h" $File "..\vmpi\threadhelpers.h" $File "..\common\threads.h" $File "..\common\utilmatlib.h" $File "..\vmpi\vmpi_defs.h" $File "..\vmpi\vmpi_dispatch.h" $File "..\vmpi\vmpi_distribute_work.h" $File "..\vmpi\vmpi_filesystem.h" } $Folder "Public Header Files" { $File "$SRCDIR\public\mathlib\amd3dx.h" $File "$SRCDIR\public\mathlib\ANORMS.H" $File "$SRCDIR\public\basehandle.h" $File "$SRCDIR\public\tier0\basetypes.h" $File "$SRCDIR\public\tier1\bitbuf.h" $File "$SRCDIR\public\bitvec.h" $File "$SRCDIR\public\BSPFILE.H" $File "$SRCDIR\public\bspflags.h" $File "$SRCDIR\public\BSPTreeData.h" $File "$SRCDIR\public\builddisp.h" $File "$SRCDIR\public\mathlib\bumpvects.h" $File "$SRCDIR\public\tier1\byteswap.h" $File "$SRCDIR\public\tier1\characterset.h" $File "$SRCDIR\public\tier1\checksum_crc.h" $File "$SRCDIR\public\tier1\checksum_md5.h" $File "$SRCDIR\public\ChunkFile.h" $File "$SRCDIR\public\cmodel.h" $File "$SRCDIR\public\CollisionUtils.h" $File "$SRCDIR\public\tier0\commonmacros.h" $File "$SRCDIR\public\mathlib\compressed_vector.h" $File "$SRCDIR\public\const.h" $File "$SRCDIR\public\coordsize.h" $File "$SRCDIR\public\tier0\dbg.h" $File "$SRCDIR\public\disp_common.h" $File "$SRCDIR\public\disp_powerinfo.h" $File "$SRCDIR\public\disp_vertindex.h" $File "$SRCDIR\public\DispColl_Common.h" $File "$SRCDIR\public\tier0\fasttimer.h" $File "$SRCDIR\public\filesystem.h" $File "$SRCDIR\public\filesystem_helpers.h" $File "$SRCDIR\public\GameBSPFile.h" $File "$SRCDIR\public\gametrace.h" $File "$SRCDIR\public\mathlib\halton.h" $File "$SRCDIR\public\materialsystem\hardwareverts.h" $File "$SRCDIR\public\appframework\IAppSystem.h" $File "$SRCDIR\public\tier0\icommandline.h" $File "$SRCDIR\public\ihandleentity.h" $File "$SRCDIR\public\materialsystem\imaterial.h" $File "$SRCDIR\public\materialsystem\imaterialsystem.h" $File "$SRCDIR\public\materialsystem\imaterialvar.h" $File "$SRCDIR\public\tier1\interface.h" $File "$SRCDIR\public\iscratchpad3d.h" $File "$SRCDIR\public\ivraddll.h" $File "$SRCDIR\public\materialsystem\materialsystem_config.h" $File "$SRCDIR\public\mathlib\mathlib.h" $File "$SRCDIR\public\tier0\memdbgon.h" $File "$SRCDIR\public\optimize.h" $File "$SRCDIR\public\phyfile.h" $File "..\common\physdll.h" $File "$SRCDIR\public\tier0\platform.h" $File "$SRCDIR\public\tier0\protected_things.h" $File "$SRCDIR\public\vstdlib\random.h" $File "$SRCDIR\public\ScratchPad3D.h" $File "$SRCDIR\public\ScratchPadUtils.h" $File "$SRCDIR\public\string_t.h" $File "$SRCDIR\public\tier1\strtools.h" $File "$SRCDIR\public\studio.h" $File "$SRCDIR\public\tier1\tokenreader.h" $File "$SRCDIR\public\trace.h" $File "$SRCDIR\public\tier1\utlbuffer.h" $File "$SRCDIR\public\tier1\utldict.h" $File "$SRCDIR\public\tier1\utlhash.h" $File "$SRCDIR\public\tier1\utllinkedlist.h" $File "$SRCDIR\public\tier1\utlmemory.h" $File "$SRCDIR\public\tier1\utlrbtree.h" $File "$SRCDIR\public\tier1\utlsymbol.h" $File "$SRCDIR\public\tier1\utlvector.h" $File "$SRCDIR\public\vcollide.h" $File "$SRCDIR\public\mathlib\vector.h" $File "$SRCDIR\public\mathlib\vector2d.h" $File "$SRCDIR\public\mathlib\vector4d.h" $File "$SRCDIR\public\mathlib\vmatrix.h" $File "..\vmpi\vmpi.h" $File "$SRCDIR\public\vphysics_interface.h" $File "$SRCDIR\public\mathlib\vplane.h" $File "$SRCDIR\public\tier0\vprof.h" $File "$SRCDIR\public\vstdlib\vstdlib.h" $File "$SRCDIR\public\vtf\vtf.h" $File "$SRCDIR\public\wadtypes.h" $File "$SRCDIR\public\worldsize.h" } } $Folder "Link Libraries" { $Lib bitmap $Lib mathlib $Lib raytrace $Lib tier2 $Lib vmpi $Lib vtf $Lib "$LIBCOMMON/lzma" } $File "notes.txt" }
{ "pile_set_name": "Github" }
/* UTILITY CLASSES */ .ignore-css { all: unset; } .pointer { cursor: pointer; } .selectable-all { -webkit-touch-callout: all; -webkit-user-select: all; -khtml-user-select: all; -moz-user-select: all; -ms-user-select: all; user-select: all; } .selectable { -webkit-touch-callout: text !important; -webkit-user-select: text !important; -khtml-user-select: text !important; -moz-user-select: text !important; -ms-user-select: text !important; user-select: text !important; } .no-vis { visibility: hidden; } .filtered { display: none !important; } .scrollbar { overflow-y: scroll !important; overflow-x: hidden !important; } .scrollbar-x { overflow-y: scroll !important; overflow-x: scroll !important; } /* ELEMENT STLYES */ body { overflow: scroll; overflow-x: hidden !important; min-height: 100%; color: var(--theme-color-font); background-color: var(--theme-background); /*disable cursor highlight by default*/ -webkit-touch-callout: none; /* iOS Safari */ -webkit-user-select: none; /* Safari */ -khtml-user-select: none; /* Konqueror HTML */ -moz-user-select: none; /* Old versions of Firefox */ -ms-user-select: none; /* Internet Explorer/Edge */ user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera and Firefox */ scrollbar-color: var(--theme-primary) !important; scrollbar-width: thin; } html { height: 100%; } h1, h2, h3, h4, h5, h6 { color: var(--theme-color-font); } hr { color: var(--theme-secondary); } a { color: var(--theme-primary); } blockquote { border-left: 5px solid var(--theme-primary); } /* SCROLLBARS */ /* width */ ::-webkit-scrollbar { width: 8px; } /* Track */ ::-webkit-scrollbar-track { background: transparent; } /* Handle */ ::-webkit-scrollbar-thumb { background: var(--theme-primary); border-radius: 24px; } /* Handle on hover */ ::-webkit-scrollbar-thumb:hover { background: var(--theme-primary); border-radius: 24px; } ::-webkit-scrollbar-corner { height: 0px; } /* FORM STYLES */ input[type='checkbox'] + span:not(.lever):before, input[type='checkbox']:not(.filled-in) + span:not(.lever):after { border-radius: 4px !important; opacity: .6; } input { color: var(--theme-color-font); -webkit-touch-callout: text !important; -webkit-user-select: text !important; -khtml-user-select: text !important; -moz-user-select: text !important; -ms-user-select: text !important; user-select: text !important; } textarea { color: var(--theme-color-font); -webkit-touch-callout: text !important; -webkit-user-select: text !important; -khtml-user-select: text !important; -moz-user-select: text !important; -ms-user-select: text !important; user-select: text !important; } input:disabled { color: var(--theme-secondary); } /* label color */ .input-field label { color: var(--theme-secondary) !important; } /* label focus color */ .input-field input[type=text]:focus + label, .input-field input[type=password]:focus + label { color: var(--theme-primary) !important; } /* label underline focus color */ .input-field input[type=text]:focus, .input-field input[type=password]:focus{ border-bottom: 1px solid var(--theme-primary) !important; box-shadow: 0 1px 0 0 var(--theme-primary) !important; } /* icon prefix focus color */ .input-field .prefix.active { color: var(--theme-primary) !important; } /* Password fields ------------------------*/ /* label focus color */ .input-field input[type=password]:focus + label { color: var(--theme-primary) !important; } /* label underline focus color */ .input-field input[type=password]:focus { border-bottom: 1px solid var(--theme-primary) !important; box-shadow: 0 1px 0 0 var(--theme-primary) !important; } /* change colour of filled in check box */ .checkbox-orange[type="checkbox"].filled-in:checked + span:not(.lever):after { border: 2px solid var(--theme-primary); background-color: var(--theme-primary); } .input-field select { font-size: 13.5px !important; } .input-field input[type=text]:not(.card-filter), .input-field input[type=password]:not(.card-filter){ font-size: 13.5px !important; line-height: 2 !important; max-height: 30px; } .input-field > label { font-size: .9rem; webkit-transform: unset; transform: unset; } .input-field .prefix { top: 0; } .switch label input[type=checkbox]:checked + .lever { background-color: var(--theme-primary); } .switch label input[type=checkbox]:checked + .lever:after { background-color: var(--theme-primary); } .input-field textarea:focus { border-bottom: 1px solid var(--theme-primary) !important; box-shadow: 0 1px 0 0 var(--theme-primary) !important; } ::-webkit-input-placeholder { color: var(--theme-secondary); } ::-moz-placeholder { color: var(--theme-secondary); } ::placeholder { color: var(--theme-secondary); } .mce-fullscreen { z-index: 102 !important; } .select-wrapper .dropdown-trigger { height: 2rem !important; margin: 0px !important; } .select-wrapper .caret { fill: var(--theme-secondary); } .dropdown-content { border-radius: 10px; background: var(--theme-surface); } .dropdown-content li > a, .dropdown-content li > span { font-size: 14px; } .dropdown-content li:hover, .dropdown-content li.active { background-color: var(--theme-background); } .dropdown-content li > a:hover, .dropdown-content li > a.active, .dropdown-content li > span:hover, .dropdown-content li > span.active { background-color: var(--theme-background); } .dropdown-content li { color: var(--theme-color-font); } .dropdown-content li > span { min-height: 50px; } .autocomplete-content li .highlight { color: var(--theme-primary); } .subfield-text-input { position: relative; top: 6px; } /* END FORM STYLES */ /* SIDENAV*/ #show-sidenav { position: fixed; bottom: 10px; left: 0px; height: 40px; width: 48px; z-index: 9999; border-radius: 0 10px 10px 0; background: var(--theme-primary); } #show-sidenav .material-icons-outlined { font-size: 32px; position: relative; left: 15px; top: 5px; } .sidenav-main .sidenav-collapsible { border-radius: 0px; background-color: var(--theme-surface); } .sidenav li > a > i.material-icons-outlined { color: var(--theme-color-font-muted); } .sidenav li > a:not(.active):hover { background-color: var(--theme-background) !important; } .sidenav li a { color: var(--theme-color-font); } .brand-sidebar { background: var(--theme-surface); } .nav-wrapper { background: var(--theme-surface); } #logout-nav-btn:hover { background-color: rgba(0,0,0,0); } .navbar-fixed { z-index: 101; } .navbar .navbar-light ul a { color: var(--theme-color-font); } .sidenav { background-color: var(--theme-surface); top: unset; overflow-y: scroll; scrollbar-width: none; } #sidenav-mobile-toggle-btn { position: fixed; top: unset; bottom: 10px; } .sidenav-active-rounded .sidenav li > a.active > i { color: var(--theme-on-primary) !important; } .sidenav-active-rounded .sidenav li > a.active > span { color: var(--theme-on-primary) !important; } .sidenav-active-rounded .sidenav li > a.active { min-width: 3.6rem; } /* MODALS AND CARDS */ .modal { background-color: var(--theme-surface); border-radius: 12px !important; position: fixed; } .modal .modal-footer { background-color: var(--theme-surface-1); } @media only screen and (max-width: 992px) { .modal { width: 100vw !important; max-height: 90%; } } .full-height-modal { height: 100%; min-height: 100%; max-height: 100%; position: fixed; top: 0 !important; } .three-qtr-height-modal { height: 85%; min-height: 85%; max-height: 85%; position: fixed; top: unset !important; bottom: 0; } .card { border-radius: 8px; background: var(--theme-surface); } .card .card-reveal { border-radius: 8px; background: var(--theme-surface); } /* TABS */ .tabs { background: var(--theme-surface); } .tabs .tab a { color: var(--theme-primary); border-radius: 10px; } .tabs .tab a:hover { color: var(--theme-primary); } .tabs .tab a.active { color: var(--theme-primary); } .tabs .indicator { background-color: var(--theme-primary); } /* CHIPS */ .chips .autocomplete-content { width: 18vw !important; } .dropdown-content li > a, .dropdown-content li > span { color: var(--theme-secondary); } .chips .autocomplete-content li .highlight { color: var(--theme-primary); } .chips .input { min-width: 320px !important; font-size: 12px; color: var(--theme-color-font); } .chips { margin-bottom: 0px !important; margin-top: 0px !important; } .chip { background-color: var(--theme-background); color: var(--theme-color-font); } /* COLLECTIONS */ .collection { border-radius: 8px; border-color: var(--theme-surface-2); } .collection .collection-item { background-color: var(--theme-surface-1); border-color: var(--theme-surface-2); } .collection.with-header .collection-header { background-color: var(--theme-surface); border-bottom: 0; } .collection a.collection-item:not(.active):hover { background-color: var(--theme-surface-2); } .collection-icon { margin-left: 5px; margin-right: 5px; } /* "CARD FILTER" GLOBAL SEXY SEARCH BAR */ .card-filter-container { position: -webkit-sticky; position: sticky; top: 0; z-index: 1; background-color: transparent; } .card-filter-container .input-field .card-filter { margin: 0px !important; padding-left: 2.75rem !important; border: none !important; border-radius: .4rem !important; background-color: var(--theme-surface-1); font-size: 14px; line-height: 4; -webkit-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.12); box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.12); } .card-filter-container .input-field .card-filter::placeholder { line-height: 4; } .card-filter-container .input-field .card-filter:focus { border-bottom: none !important; -webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .12), 0 1px 5px 0 rgba(0, 0, 0, .2) !important; box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .12), 0 1px 5px 0 rgba(0, 0, 0, .2) !important; } .card-filter-container .card-search-icon { top: 8px; left: 20px; color: var(--theme-secondary); } .card-filter-container .filter-action { position: relative; margin-bottom: -23px; bottom: 35px; right: 15px; color: var(--theme-secondary); } /* MISC COMPONENTS */ .divider { margin-top: 15px; margin-bottom: 15px; background-color: var(--theme-surface-2); } span.badge.new { font-size: 14px; font-weight: 500; float: unset; } .toast { border-radius: 10px !important; } @media screen and (min-width: 992px) { #toast-container { top: auto !important; right: auto !important; bottom: 94%; left: 35%; } } .material-tooltip { max-width: 25vh; } .icon-btn, .icon-btn-warning { padding: 5px; cursor: pointer; border-radius: 24px; } .icon-btn:hover { color: var(--theme-on-primary) !important; background-color: var(--theme-primary); border-radius: 24px; padding: 5px; -webkit-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.12); box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.12); } .icon-btn-warning:hover { color: white !important; background-color: var(--theme-warning); border-radius: 24px; padding: 5px; -webkit-box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.12); box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 1px 3px 0 rgba(0, 0, 0, 0.12); } .progress { background-color: var(--theme-background); } .progress .determinate { background-color: var(--theme-primary); } /*FAB*/ .tap-target-wave::before, .tap-target-wave::after { background-color: var(--theme-background); }
{ "pile_set_name": "Github" }
// Distributed under the terms of the MIT license // Test case submitted to project by https://github.com/practicalswift (practicalswift) // Test case found by fuzzing for { struct A { { { { } } } { } func a { init( ) { class case ,
{ "pile_set_name": "Github" }
/** * @author Richard Davey <[email protected]> * @copyright 2020 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ var Class = require('../utils/Class'); /** * @classdesc * An Image Collection is a special Tile Set containing multiple images, with no slicing into each image. * * Image Collections are normally created automatically when Tiled data is loaded. * * @class ImageCollection * @memberof Phaser.Tilemaps * @constructor * @since 3.0.0 * * @param {string} name - The name of the image collection in the map data. * @param {integer} firstgid - The first image index this image collection contains. * @param {integer} [width=32] - Width of widest image (in pixels). * @param {integer} [height=32] - Height of tallest image (in pixels). * @param {integer} [margin=0] - The margin around all images in the collection (in pixels). * @param {integer} [spacing=0] - The spacing between each image in the collection (in pixels). * @param {object} [properties={}] - Custom Image Collection properties. */ var ImageCollection = new Class({ initialize: function ImageCollection (name, firstgid, width, height, margin, spacing, properties) { if (width === undefined || width <= 0) { width = 32; } if (height === undefined || height <= 0) { height = 32; } if (margin === undefined) { margin = 0; } if (spacing === undefined) { spacing = 0; } /** * The name of the Image Collection. * * @name Phaser.Tilemaps.ImageCollection#name * @type {string} * @since 3.0.0 */ this.name = name; /** * The Tiled firstgid value. * This is the starting index of the first image index this Image Collection contains. * * @name Phaser.Tilemaps.ImageCollection#firstgid * @type {integer} * @since 3.0.0 */ this.firstgid = firstgid | 0; /** * The width of the widest image (in pixels). * * @name Phaser.Tilemaps.ImageCollection#imageWidth * @type {integer} * @readonly * @since 3.0.0 */ this.imageWidth = width | 0; /** * The height of the tallest image (in pixels). * * @name Phaser.Tilemaps.ImageCollection#imageHeight * @type {integer} * @readonly * @since 3.0.0 */ this.imageHeight = height | 0; /** * The margin around the images in the collection (in pixels). * Use `setSpacing` to change. * * @name Phaser.Tilemaps.ImageCollection#imageMarge * @type {integer} * @readonly * @since 3.0.0 */ this.imageMargin = margin | 0; /** * The spacing between each image in the collection (in pixels). * Use `setSpacing` to change. * * @name Phaser.Tilemaps.ImageCollection#imageSpacing * @type {integer} * @readonly * @since 3.0.0 */ this.imageSpacing = spacing | 0; /** * Image Collection-specific properties that are typically defined in the Tiled editor. * * @name Phaser.Tilemaps.ImageCollection#properties * @type {object} * @since 3.0.0 */ this.properties = properties || {}; /** * The cached images that are a part of this collection. * * @name Phaser.Tilemaps.ImageCollection#images * @type {array} * @readonly * @since 3.0.0 */ this.images = []; /** * The total number of images in the image collection. * * @name Phaser.Tilemaps.ImageCollection#total * @type {integer} * @readonly * @since 3.0.0 */ this.total = 0; }, /** * Returns true if and only if this image collection contains the given image index. * * @method Phaser.Tilemaps.ImageCollection#containsImageIndex * @since 3.0.0 * * @param {integer} imageIndex - The image index to search for. * * @return {boolean} True if this Image Collection contains the given index. */ containsImageIndex: function (imageIndex) { return (imageIndex >= this.firstgid && imageIndex < (this.firstgid + this.total)); }, /** * Add an image to this Image Collection. * * @method Phaser.Tilemaps.ImageCollection#addImage * @since 3.0.0 * * @param {integer} gid - The gid of the image in the Image Collection. * @param {string} image - The the key of the image in the Image Collection and in the cache. * * @return {Phaser.Tilemaps.ImageCollection} This ImageCollection object. */ addImage: function (gid, image) { this.images.push({ gid: gid, image: image }); this.total++; return this; } }); module.exports = ImageCollection;
{ "pile_set_name": "Github" }
DELETE FROM command WHERE name IN ('gm','gm chat'); INSERT INTO `command` VALUES ('gm',1,'Syntax: .gm [on/off]\r\n\r\nEnable or Disable in game GM MODE or show current state of on/off not provided.'), ('gm chat',1,'Syntax: .gm chat [on/off]\r\n\r\nEnable or disable chat GM MODE (show gm badge in messages) or show current state of on/off not provided.');
{ "pile_set_name": "Github" }
<component xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2 http://maven.apache.org/xsd/component-1.1.2.xsd" > <dependencySets> <!-- jar files --> <dependencySet> <unpack>false</unpack> <useProjectArtifact>false</useProjectArtifact> <useStrictFiltering>true</useStrictFiltering> <useTransitiveDependencies>false</useTransitiveDependencies> <outputDirectory>lib</outputDirectory> <includes> <include>org.opennms.protocols:org.opennms.protocols.radius:jar:${project.version}</include> </includes> </dependencySet> </dependencySets> </component>
{ "pile_set_name": "Github" }
require(microbenchmark) local({ s <- "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Proin nibh augue, suscipit a, scelerisque sed, lacinia in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus. Phasellus pharetra nulla ac diam. Quisque semper justo at risus. Donec venenatis, turpis vel hendrerit interdum, dui ligula ultricies purus, sed posuere libero dui id orci. Nam congue, pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam sit amet lectus quis est congue mollis. Phasellus congue lacus eget neque. Phasellus ornare, ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam viverra nisi, in interdum massa nibh nec erat." print(microbenchmark( stri_reverse(s), intToUtf8(rev(utf8ToInt(s))) )) srepdup <- stri_dup(s, 10) print(microbenchmark( stri_reverse(srepdup), intToUtf8(rev(utf8ToInt(srepdup))) )) })
{ "pile_set_name": "Github" }
# Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. import cPickle import os import tarfile import PIL.Image from downloader import DataDownloader class Cifar100Downloader(DataDownloader): """ See details about the CIFAR100 dataset here: http://www.cs.toronto.edu/~kriz/cifar.html """ def urlList(self): return [ 'http://www.cs.toronto.edu/~kriz/cifar-100-python.tar.gz', ] def uncompressData(self): filename = 'cifar-100-python.tar.gz' filepath = os.path.join(self.outdir, filename) assert os.path.exists(filepath), 'Expected "%s" to exist' % filename if not os.path.exists(os.path.join(self.outdir, 'cifar-100-python')): print "Uncompressing file=%s ..." % filename with tarfile.open(filepath) as tf: tf.extractall(self.outdir) def processData(self): label_filename = 'meta' label_filepath = os.path.join(self.outdir, 'cifar-100-python', label_filename) with open(label_filepath, 'rb') as infile: pickleObj = cPickle.load(infile) fine_label_names = pickleObj['fine_label_names'] coarse_label_names = pickleObj['coarse_label_names'] for level, label_names in [ ('fine', fine_label_names), ('coarse', coarse_label_names), ]: dirname = os.path.join(self.outdir, level) self.mkdir(dirname, clean=True) with open(os.path.join(dirname, 'labels.txt'), 'w') as outfile: for name in label_names: outfile.write('%s\n' % name) for filename, phase in [ ('train', 'train'), ('test', 'test'), ]: filepath = os.path.join(self.outdir, 'cifar-100-python', filename) assert os.path.exists(filepath), 'Expected "%s" to exist' % filename self.__extractData(filepath, phase, fine_label_names, coarse_label_names) def __extractData(self, input_file, phase, fine_label_names, coarse_label_names): """ Read a pickle file at input_file and output as images Arguments: input_file -- a pickle file phase -- train or test fine_label_names -- mapping from fine_labels to strings coarse_label_names -- mapping from coarse_labels to strings """ print 'Extracting images file=%s ...' % input_file # Read the pickle file with open(input_file, 'rb') as infile: pickleObj = cPickle.load(infile) # print 'Batch -', pickleObj['batch_label'] data = pickleObj['data'] assert data.shape[1] == 3072, 'Unexpected data.shape %s' % (data.shape,) count = data.shape[0] fine_labels = pickleObj['fine_labels'] assert len(fine_labels) == count, 'Expected len(fine_labels) to be %d, not %d' % (count, len(fine_labels)) coarse_labels = pickleObj['coarse_labels'] assert len(coarse_labels) == count, 'Expected len(coarse_labels) to be %d, not %d' % ( count, len(coarse_labels)) filenames = pickleObj['filenames'] assert len(filenames) == count, 'Expected len(filenames) to be %d, not %d' % (count, len(filenames)) data = data.reshape((count, 3, 32, 32)) data = data.transpose((0, 2, 3, 1)) fine_to_coarse = {} # mapping of fine labels to coarse labels fine_dirname = os.path.join(self.outdir, 'fine', phase) os.makedirs(fine_dirname) coarse_dirname = os.path.join(self.outdir, 'coarse', phase) os.makedirs(coarse_dirname) with open(os.path.join(self.outdir, 'fine', '%s.txt' % phase), 'w') as fine_textfile, \ open(os.path.join(self.outdir, 'coarse', '%s.txt' % phase), 'w') as coarse_textfile: for index, image in enumerate(data): # Create the directory fine_label = fine_label_names[fine_labels[index]] dirname = os.path.join(fine_dirname, fine_label) self.mkdir(dirname) # Get the filename filename = filenames[index] ext = os.path.splitext(filename)[1][1:].lower() if ext != self.file_extension: filename = '%s.%s' % (os.path.splitext(filename)[0], self.file_extension) filename = os.path.join(dirname, filename) # Save the image PIL.Image.fromarray(image).save(filename) fine_textfile.write('%s %s\n' % (filename, fine_labels[index])) coarse_textfile.write('%s %s\n' % (filename, coarse_labels[index])) if fine_label not in fine_to_coarse: fine_to_coarse[fine_label] = coarse_label_names[coarse_labels[index]] # Create the coarse dataset with symlinks for fine, coarse in fine_to_coarse.iteritems(): self.mkdir(os.path.join(coarse_dirname, coarse)) os.symlink( # Create relative symlinks for portability os.path.join('..', '..', '..', 'fine', phase, fine), os.path.join(coarse_dirname, coarse, fine) )
{ "pile_set_name": "Github" }
/* sunxvr500.c: Sun 3DLABS XVR-500 Expert3D driver for sparc64 systems * * Copyright (C) 2007 David S. Miller ([email protected]) */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/fb.h> #include <linux/pci.h> #include <linux/init.h> #include <linux/of_device.h> #include <asm/io.h> struct e3d_info { struct fb_info *info; struct pci_dev *pdev; spinlock_t lock; char __iomem *fb_base; unsigned long fb_base_phys; unsigned long fb8_buf_diff; unsigned long regs_base_phys; void __iomem *ramdac; struct device_node *of_node; unsigned int width; unsigned int height; unsigned int depth; unsigned int fb_size; u32 fb_base_reg; u32 fb8_0_off; u32 fb8_1_off; u32 pseudo_palette[16]; }; static int __devinit e3d_get_props(struct e3d_info *ep) { ep->width = of_getintprop_default(ep->of_node, "width", 0); ep->height = of_getintprop_default(ep->of_node, "height", 0); ep->depth = of_getintprop_default(ep->of_node, "depth", 8); if (!ep->width || !ep->height) { printk(KERN_ERR "e3d: Critical properties missing for %s\n", pci_name(ep->pdev)); return -EINVAL; } return 0; } /* My XVR-500 comes up, at 1280x768 and a FB base register value of * 0x04000000, the following video layout register values: * * RAMDAC_VID_WH 0x03ff04ff * RAMDAC_VID_CFG 0x1a0b0088 * RAMDAC_VID_32FB_0 0x04000000 * RAMDAC_VID_32FB_1 0x04800000 * RAMDAC_VID_8FB_0 0x05000000 * RAMDAC_VID_8FB_1 0x05200000 * RAMDAC_VID_XXXFB 0x05400000 * RAMDAC_VID_YYYFB 0x05c00000 * RAMDAC_VID_ZZZFB 0x05e00000 */ /* Video layout registers */ #define RAMDAC_VID_WH 0x00000070UL /* (height-1)<<16 | (width-1) */ #define RAMDAC_VID_CFG 0x00000074UL /* 0x1a000088|(linesz_log2<<16) */ #define RAMDAC_VID_32FB_0 0x00000078UL /* PCI base 32bpp FB buffer 0 */ #define RAMDAC_VID_32FB_1 0x0000007cUL /* PCI base 32bpp FB buffer 1 */ #define RAMDAC_VID_8FB_0 0x00000080UL /* PCI base 8bpp FB buffer 0 */ #define RAMDAC_VID_8FB_1 0x00000084UL /* PCI base 8bpp FB buffer 1 */ #define RAMDAC_VID_XXXFB 0x00000088UL #define RAMDAC_VID_YYYFB 0x0000008cUL /* PCI base of YYY FB */ #define RAMDAC_VID_ZZZFB 0x00000090UL /* PCI base of ZZZ FB */ /* CLUT registers */ #define RAMDAC_INDEX 0x000000bcUL #define RAMDAC_DATA 0x000000c0UL static void e3d_clut_write(struct e3d_info *ep, int index, u32 val) { void __iomem *ramdac = ep->ramdac; unsigned long flags; spin_lock_irqsave(&ep->lock, flags); writel(index, ramdac + RAMDAC_INDEX); writel(val, ramdac + RAMDAC_DATA); spin_unlock_irqrestore(&ep->lock, flags); } static int e3d_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) { struct e3d_info *ep = info->par; u32 red_8, green_8, blue_8; u32 red_10, green_10, blue_10; u32 value; if (regno >= 256) return 1; red_8 = red >> 8; green_8 = green >> 8; blue_8 = blue >> 8; value = (blue_8 << 24) | (green_8 << 16) | (red_8 << 8); if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 16) ((u32 *)info->pseudo_palette)[regno] = value; red_10 = red >> 6; green_10 = green >> 6; blue_10 = blue >> 6; value = (blue_10 << 20) | (green_10 << 10) | (red_10 << 0); e3d_clut_write(ep, regno, value); return 0; } static void e3d_imageblit(struct fb_info *info, const struct fb_image *image) { struct e3d_info *ep = info->par; unsigned long flags; spin_lock_irqsave(&ep->lock, flags); cfb_imageblit(info, image); info->screen_base += ep->fb8_buf_diff; cfb_imageblit(info, image); info->screen_base -= ep->fb8_buf_diff; spin_unlock_irqrestore(&ep->lock, flags); } static void e3d_fillrect(struct fb_info *info, const struct fb_fillrect *rect) { struct e3d_info *ep = info->par; unsigned long flags; spin_lock_irqsave(&ep->lock, flags); cfb_fillrect(info, rect); info->screen_base += ep->fb8_buf_diff; cfb_fillrect(info, rect); info->screen_base -= ep->fb8_buf_diff; spin_unlock_irqrestore(&ep->lock, flags); } static void e3d_copyarea(struct fb_info *info, const struct fb_copyarea *area) { struct e3d_info *ep = info->par; unsigned long flags; spin_lock_irqsave(&ep->lock, flags); cfb_copyarea(info, area); info->screen_base += ep->fb8_buf_diff; cfb_copyarea(info, area); info->screen_base -= ep->fb8_buf_diff; spin_unlock_irqrestore(&ep->lock, flags); } static struct fb_ops e3d_ops = { .owner = THIS_MODULE, .fb_setcolreg = e3d_setcolreg, .fb_fillrect = e3d_fillrect, .fb_copyarea = e3d_copyarea, .fb_imageblit = e3d_imageblit, }; static int __devinit e3d_set_fbinfo(struct e3d_info *ep) { struct fb_info *info = ep->info; struct fb_var_screeninfo *var = &info->var; info->flags = FBINFO_DEFAULT; info->fbops = &e3d_ops; info->screen_base = ep->fb_base; info->screen_size = ep->fb_size; info->pseudo_palette = ep->pseudo_palette; /* Fill fix common fields */ strlcpy(info->fix.id, "e3d", sizeof(info->fix.id)); info->fix.smem_start = ep->fb_base_phys; info->fix.smem_len = ep->fb_size; info->fix.type = FB_TYPE_PACKED_PIXELS; if (ep->depth == 32 || ep->depth == 24) info->fix.visual = FB_VISUAL_TRUECOLOR; else info->fix.visual = FB_VISUAL_PSEUDOCOLOR; var->xres = ep->width; var->yres = ep->height; var->xres_virtual = var->xres; var->yres_virtual = var->yres; var->bits_per_pixel = ep->depth; var->red.offset = 8; var->red.length = 8; var->green.offset = 16; var->green.length = 8; var->blue.offset = 24; var->blue.length = 8; var->transp.offset = 0; var->transp.length = 0; if (fb_alloc_cmap(&info->cmap, 256, 0)) { printk(KERN_ERR "e3d: Cannot allocate color map.\n"); return -ENOMEM; } return 0; } static int __devinit e3d_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) { struct device_node *of_node; const char *device_type; struct fb_info *info; struct e3d_info *ep; unsigned int line_length; int err; of_node = pci_device_to_OF_node(pdev); if (!of_node) { printk(KERN_ERR "e3d: Cannot find OF node of %s\n", pci_name(pdev)); return -ENODEV; } device_type = of_get_property(of_node, "device_type", NULL); if (!device_type) { printk(KERN_INFO "e3d: Ignoring secondary output device " "at %s\n", pci_name(pdev)); return -ENODEV; } err = pci_enable_device(pdev); if (err < 0) { printk(KERN_ERR "e3d: Cannot enable PCI device %s\n", pci_name(pdev)); goto err_out; } info = framebuffer_alloc(sizeof(struct e3d_info), &pdev->dev); if (!info) { printk(KERN_ERR "e3d: Cannot allocate fb_info\n"); err = -ENOMEM; goto err_disable; } ep = info->par; ep->info = info; ep->pdev = pdev; spin_lock_init(&ep->lock); ep->of_node = of_node; /* Read the PCI base register of the frame buffer, which we * need in order to interpret the RAMDAC_VID_*FB* values in * the ramdac correctly. */ pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &ep->fb_base_reg); ep->fb_base_reg &= PCI_BASE_ADDRESS_MEM_MASK; ep->regs_base_phys = pci_resource_start (pdev, 1); err = pci_request_region(pdev, 1, "e3d regs"); if (err < 0) { printk("e3d: Cannot request region 1 for %s\n", pci_name(pdev)); goto err_release_fb; } ep->ramdac = ioremap(ep->regs_base_phys + 0x8000, 0x1000); if (!ep->ramdac) goto err_release_pci1; ep->fb8_0_off = readl(ep->ramdac + RAMDAC_VID_8FB_0); ep->fb8_0_off -= ep->fb_base_reg; ep->fb8_1_off = readl(ep->ramdac + RAMDAC_VID_8FB_1); ep->fb8_1_off -= ep->fb_base_reg; ep->fb8_buf_diff = ep->fb8_1_off - ep->fb8_0_off; ep->fb_base_phys = pci_resource_start (pdev, 0); ep->fb_base_phys += ep->fb8_0_off; err = pci_request_region(pdev, 0, "e3d framebuffer"); if (err < 0) { printk("e3d: Cannot request region 0 for %s\n", pci_name(pdev)); goto err_unmap_ramdac; } err = e3d_get_props(ep); if (err) goto err_release_pci0; line_length = (readl(ep->ramdac + RAMDAC_VID_CFG) >> 16) & 0xff; line_length = 1 << line_length; switch (ep->depth) { case 8: info->fix.line_length = line_length; break; case 16: info->fix.line_length = line_length * 2; break; case 24: info->fix.line_length = line_length * 3; break; case 32: info->fix.line_length = line_length * 4; break; } ep->fb_size = info->fix.line_length * ep->height; ep->fb_base = ioremap(ep->fb_base_phys, ep->fb_size); if (!ep->fb_base) goto err_release_pci0; err = e3d_set_fbinfo(ep); if (err) goto err_unmap_fb; pci_set_drvdata(pdev, info); printk("e3d: Found device at %s\n", pci_name(pdev)); err = register_framebuffer(info); if (err < 0) { printk(KERN_ERR "e3d: Could not register framebuffer %s\n", pci_name(pdev)); goto err_free_cmap; } return 0; err_free_cmap: fb_dealloc_cmap(&info->cmap); err_unmap_fb: iounmap(ep->fb_base); err_release_pci0: pci_release_region(pdev, 0); err_unmap_ramdac: iounmap(ep->ramdac); err_release_pci1: pci_release_region(pdev, 1); err_release_fb: framebuffer_release(info); err_disable: pci_disable_device(pdev); err_out: return err; } static void __devexit e3d_pci_unregister(struct pci_dev *pdev) { struct fb_info *info = pci_get_drvdata(pdev); struct e3d_info *ep = info->par; unregister_framebuffer(info); iounmap(ep->ramdac); iounmap(ep->fb_base); pci_release_region(pdev, 0); pci_release_region(pdev, 1); fb_dealloc_cmap(&info->cmap); framebuffer_release(info); pci_disable_device(pdev); } static struct pci_device_id e3d_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x7a0), }, { PCI_DEVICE(0x1091, 0x7a0), }, { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x7a2), }, { .vendor = PCI_VENDOR_ID_3DLABS, .device = PCI_ANY_ID, .subvendor = PCI_VENDOR_ID_3DLABS, .subdevice = 0x0108, }, { .vendor = PCI_VENDOR_ID_3DLABS, .device = PCI_ANY_ID, .subvendor = PCI_VENDOR_ID_3DLABS, .subdevice = 0x0140, }, { .vendor = PCI_VENDOR_ID_3DLABS, .device = PCI_ANY_ID, .subvendor = PCI_VENDOR_ID_3DLABS, .subdevice = 0x1024, }, { 0, } }; static struct pci_driver e3d_driver = { .name = "e3d", .id_table = e3d_pci_table, .probe = e3d_pci_register, .remove = __devexit_p(e3d_pci_unregister), }; static int __init e3d_init(void) { if (fb_get_options("e3d", NULL)) return -ENODEV; return pci_register_driver(&e3d_driver); } static void __exit e3d_exit(void) { pci_unregister_driver(&e3d_driver); } module_init(e3d_init); module_exit(e3d_exit); MODULE_DESCRIPTION("framebuffer driver for Sun XVR-500 graphics"); MODULE_AUTHOR("David S. Miller <[email protected]>"); MODULE_VERSION("1.0"); MODULE_LICENSE("GPL");
{ "pile_set_name": "Github" }
(* ** Copyright (C) 2011 Hongwei Xi, ATS Trustful Software, Inc. ** ** Permission is hereby granted, free of charge, to any person ** obtaining a copy of this software and associated documentation ** files (the "Software"), to deal in the Software without ** restriction, including without limitation the rights to use, ** copy, modify, merge, publish, distribute, sublicense, and/or sell ** copies of the Software, and to permit persons to whom the ** Software is furnished to do so, subject to the following ** conditions: ** ** The above copyright notice and this permission notice shall be ** included in all copies or substantial portions of the Software. ** ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ** NONINFRINGEMENT. IN NO EVENT SHALL THE 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. *) (* ****** ****** *) (* ** Example: Coin Changes ** ** Author: Hongwei Xi (hwxi AT cs DOT bu DOT edu) ** Time: January, 2011 *) (* ** Ported to ATS2 by Hongwei Xi (gmhwxiATgmailDOTcom) ** Time: March 24, 2013 *) (* ****** ****** *) // #include "share/atspre_staload.hats" // (* ****** ****** *) typedef int4 = (int, int, int, int) (* ****** ****** *) val theCoins = (1, 5, 10, 25): int4 (* ****** ****** *) fun coin_get (n: int): int = if n = 0 then theCoins.0 else if n = 1 then theCoins.1 else if n = 2 then theCoins.2 else if n = 3 then theCoins.3 else ~1 (* erroneous value *) // end of [coin_get] fun coin_change (sum: int): int = let fun aux (sum: int, n: int): int = if sum > 0 then (if n >= 0 then aux (sum, n-1) + aux (sum-coin_get(n), n) else 0) else (if sum < 0 then 0 else 1) // end of [aux] in aux (sum, 3) end // end of [coin_change] (* ****** ****** *) implement main0 () = { val () = println! ("coin_change (25) = ", coin_change (25)) val () = println! ("coin_change (100) = ", coin_change (100)) val () = println! ("coin_change (1000) = ", coin_change (1000)) } (* end of [main] *) (* ****** ****** *) (* end of [coinchange.dats] *)
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v. 2.0, which is available at http://www.eclipse.org/legal/epl-2.0. This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License v. 2.0 are satisfied: GNU General Public License, version 2 with the GNU Classpath Exception, which is available at https://www.gnu.org/software/classpath/license.html. SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 --> <sun-web-app> <session-config> <cookie-properties> <property name="cookieName" value="MYJSESSIONID" /> <property name="cookieSecure" value="dynamic" /> </cookie-properties> </session-config> </sun-web-app>
{ "pile_set_name": "Github" }
<html xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Test Report Tree with Stat Method</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> <thead> <tr><td rowspan="1" colspan="3">Test Report Tree with Stat Method</td></tr> </thead><tbody> <!-- XXX Report tree mode doesn't exists in mobile So this test is skipped --> <tal:block tal:condition="python: context.TestTool_getSkinName()!='Mobile'"> <tal:block metal:use-macro="here/ListBoxZuite_CommonTemplate/macros/init" /> <tr> <td>open</td> <td>${base_url}/foo_module/FooModule_createObjects</td> <td></td> </tr> <tr> <td>assertTextPresent</td> <td>Created Successfully.</td> <td></td> </tr> <tr> <td>open</td> <td>${base_url}/foo_module/Zuite_waitForActivities</td> <td></td> </tr> <tr> <td>assertTextPresent</td> <td>Done.</td> <td></td> </tr> <tr> <td>open</td> <td>${base_url}/foo_module/FooModule_viewFooList/listbox/ListBox_setPropertyList?field_stat_method=portal_catalog;field_report_tree=checked;field_report_root_list=foo_domain%7CFoo%20Domain</td> <td></td> </tr> <tr> <td>assertTextPresent</td> <td>Set Successfully.</td> <td></td> </tr> <tr> <td>open</td> <td>${base_url}/foo_module/view</td> <td></td> </tr> <tr> <td>assertElementNotPresent</td> <td>report_root_url</td> <td></td> </tr> <tr> <td>clickAndWait</td> <td>//input[@class="listbox-tree-report-tree-mode"]</td> <td></td> </tr> <tr> <td>verifySelected</td> <td>report_root_url</td> <td>Foo Domain</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-label-line"]/th[1]</td> <td>Foo Domain</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-label-line"]/th[3]</td> <td>ID</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-label-line"]/th[4]</td> <td>Title</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-label-line"]/th[5]</td> <td>Quantity</td> </tr> <!--<tr> <td>verifyText</td> <td>//tr[@id="listbox_search_line"]/td[1]</td> <td>0 1 2 3 4 5 - Hide</td> </tr>--> <tr> <td>verifyTextPresent</td> <td>1</td> <td></td> </tr> <tr> <td>verifyTextPresent</td> <td>2</td> <td></td> </tr> <tr> <td>verifyTextPresent</td> <td>3</td> <td></td> </tr> <tr> <td>verifyTextPresent</td> <td>4</td> <td></td> </tr> <tr> <td>verifyTextPresent</td> <td>5</td> <td></td> </tr> <tr> <td>verifyTextPresent</td> <td>Hide</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[1]/a[@class="tree-closed"]</td> <td>a</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[2]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[3]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[1]/a[@class="tree-closed"]</td> <td>b</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[2]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[3]</td> <td></td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-2 DataA"]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//span[@class="listbox-current-page-total-number"]</td> <td>2 records</td> </tr> <!-- Click on + a --> <tr> <td>clickAndWait</td> <td>link=a</td> <td></td> </tr> <tr> <td>verifySelected</td> <td>report_root_url</td> <td>Foo Domain</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[1]/a[@class="tree-open"]</td> <td>a</td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[3]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[1]</td> <td></td> </tr> <tr> <td>verifyElementPresent</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[3]</td> <td>0</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-2 DataA"]/td[1]</td> <td></td> </tr> <tr> <td>verifyElementPresent</td> <td>//tr[@class="listbox-data-line-2 DataA"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-2 DataA"]/td[3]</td> <td>4</td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-3 DataB"]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//span[@class="listbox-current-page-total-number"]</td> <td>7 records</td> </tr> <!-- Go to next page --> <tr> <td>clickAndWait</td> <td>//button[@class="listbox_next_page"]</td> <td></td> </tr> <tr> <td>verifySelected</td> <td>report_root_url</td> <td>Foo Domain</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[1]</td> <td></td> </tr> <tr> <td>verifyElementPresent</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[3]</td> <td>8</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[1]/a[@class="tree-closed"]</td> <td>a1</td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[3]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-2 DataA"]/td[1]/a[@class="tree-closed"]</td> <td>a2</td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-2 DataA"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-2 DataA"]/td[3]</td> <td></td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-3 DataB"]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//span[@class="listbox-current-page-total-number"]</td> <td>7 records</td> </tr> <!-- Show all the 1st level --> <tr> <td>clickAndWait</td> <td>link=1</td> <td></td> </tr> <tr> <td>verifySelected</td> <td>report_root_url</td> <td>Foo Domain</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[1]</td> <td></td> </tr> <tr> <td>verifyElementPresent</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[3]</td> <td>8</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[1]/a[@class="tree-closed"]</td> <td>a1</td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[3]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-2 DataA"]/td[1]/a[@class="tree-closed"]</td> <td>a2</td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-2 DataA"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-2 DataA"]/td[3]</td> <td></td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-3 DataB"]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//span[@class="listbox-current-page-total-number"]</td> <td>10 records</td> </tr> <!-- Go to next page --> <tr> <td>clickAndWait</td> <td>//button[@class="listbox_next_page"]</td> <td></td> </tr> <tr> <td>verifySelected</td> <td>report_root_url</td> <td>Foo Domain</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[1]/a[@class="tree-open"]</td> <td>b</td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[3]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[1]</td> <td></td> </tr> <tr> <td>verifyElementPresent</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-1 DataB"]/td[3]</td> <td>1</td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-2 DataA"]/td[1]</td> <td></td> </tr> <tr> <td>verifyElementPresent</td> <td>//tr[@class="listbox-data-line-2 DataA"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-2 DataA"]/td[3]</td> <td>5</td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-3 DataB"]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//span[@class="listbox-current-page-total-number"]</td> <td>10 records</td> </tr> <!-- Hide documents --> <tr> <td>clickAndWait</td> <td>link=Hide</td> <td></td> </tr> <tr> <td>verifySelected</td> <td>report_root_url</td> <td>Foo Domain</td> </tr> <!--<tr> <td>verifyText</td> <td>//tr[@id="listbox_search_line"]/td[1]</td> <td>0 1 2 3 4 5 - Show</td> </tr>--> <tr> <td>verifyTextPresent</td> <td>1</td> <td></td> </tr> <tr> <td>verifyTextPresent</td> <td>2</td> <td></td> </tr> <tr> <td>verifyTextPresent</td> <td>3</td> <td></td> </tr> <tr> <td>verifyTextPresent</td> <td>4</td> <td></td> </tr> <tr> <td>verifyTextPresent</td> <td>5</td> <td></td> </tr> <tr> <td>verifyTextPresent</td> <td>Show</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[1]/a[@class="tree-open"]</td> <td>b</td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[2]/input</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//tr[@class="listbox-data-line-0 DataA"]/td[3]</td> <td></td> </tr> <tr> <td>verifyElementNotPresent</td> <td>//tr[@class="listbox-data-line-1 DataB"]</td> <td></td> </tr> <tr> <td>verifyText</td> <td>//span[@class="listbox-current-page-total-number"]</td> <td>4 records</td> </tr> <!-- Still very far from complete. Closing a tree should be tested, sorting should be tested. --> </tal:block> </tbody></table> </body> </html>
{ "pile_set_name": "Github" }
/* * ds.c -- 16-bit PCMCIA core support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * The initial developer of the original code is David A. Hinds * <[email protected]>. Portions created by David A. Hinds * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. * * (C) 1999 David A. Hinds * (C) 2003 - 2006 Dominik Brodowski */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/errno.h> #include <linux/list.h> #include <linux/delay.h> #include <linux/workqueue.h> #include <linux/crc32.h> #include <linux/firmware.h> #include <linux/kref.h> #define IN_CARD_SERVICES #include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/ds.h> #include <pcmcia/ss.h> #include "cs_internal.h" #include "ds_internal.h" /*====================================================================*/ /* Module parameters */ MODULE_AUTHOR("David Hinds <[email protected]>"); MODULE_DESCRIPTION("PCMCIA Driver Services"); MODULE_LICENSE("GPL"); #ifdef DEBUG int ds_pc_debug; module_param_named(pc_debug, ds_pc_debug, int, 0644); #define ds_dbg(lvl, fmt, arg...) do { \ if (ds_pc_debug > (lvl)) \ printk(KERN_DEBUG "ds: " fmt , ## arg); \ } while (0) #else #define ds_dbg(lvl, fmt, arg...) do { } while (0) #endif spinlock_t pcmcia_dev_list_lock; /*====================================================================*/ /* code which was in cs.c before */ /* String tables for error messages */ typedef struct lookup_t { int key; char *msg; } lookup_t; static const lookup_t error_table[] = { { CS_SUCCESS, "Operation succeeded" }, { CS_BAD_ADAPTER, "Bad adapter" }, { CS_BAD_ATTRIBUTE, "Bad attribute", }, { CS_BAD_BASE, "Bad base address" }, { CS_BAD_EDC, "Bad EDC" }, { CS_BAD_IRQ, "Bad IRQ" }, { CS_BAD_OFFSET, "Bad offset" }, { CS_BAD_PAGE, "Bad page number" }, { CS_READ_FAILURE, "Read failure" }, { CS_BAD_SIZE, "Bad size" }, { CS_BAD_SOCKET, "Bad socket" }, { CS_BAD_TYPE, "Bad type" }, { CS_BAD_VCC, "Bad Vcc" }, { CS_BAD_VPP, "Bad Vpp" }, { CS_BAD_WINDOW, "Bad window" }, { CS_WRITE_FAILURE, "Write failure" }, { CS_NO_CARD, "No card present" }, { CS_UNSUPPORTED_FUNCTION, "Usupported function" }, { CS_UNSUPPORTED_MODE, "Unsupported mode" }, { CS_BAD_SPEED, "Bad speed" }, { CS_BUSY, "Resource busy" }, { CS_GENERAL_FAILURE, "General failure" }, { CS_WRITE_PROTECTED, "Write protected" }, { CS_BAD_ARG_LENGTH, "Bad argument length" }, { CS_BAD_ARGS, "Bad arguments" }, { CS_CONFIGURATION_LOCKED, "Configuration locked" }, { CS_IN_USE, "Resource in use" }, { CS_NO_MORE_ITEMS, "No more items" }, { CS_OUT_OF_RESOURCE, "Out of resource" }, { CS_BAD_HANDLE, "Bad handle" }, { CS_BAD_TUPLE, "Bad CIS tuple" } }; static const lookup_t service_table[] = { { AccessConfigurationRegister, "AccessConfigurationRegister" }, { AddSocketServices, "AddSocketServices" }, { AdjustResourceInfo, "AdjustResourceInfo" }, { CheckEraseQueue, "CheckEraseQueue" }, { CloseMemory, "CloseMemory" }, { DeregisterClient, "DeregisterClient" }, { DeregisterEraseQueue, "DeregisterEraseQueue" }, { GetCardServicesInfo, "GetCardServicesInfo" }, { GetClientInfo, "GetClientInfo" }, { GetConfigurationInfo, "GetConfigurationInfo" }, { GetEventMask, "GetEventMask" }, { GetFirstClient, "GetFirstClient" }, { GetFirstRegion, "GetFirstRegion" }, { GetFirstTuple, "GetFirstTuple" }, { GetNextClient, "GetNextClient" }, { GetNextRegion, "GetNextRegion" }, { GetNextTuple, "GetNextTuple" }, { GetStatus, "GetStatus" }, { GetTupleData, "GetTupleData" }, { MapMemPage, "MapMemPage" }, { ModifyConfiguration, "ModifyConfiguration" }, { ModifyWindow, "ModifyWindow" }, { OpenMemory, "OpenMemory" }, { ParseTuple, "ParseTuple" }, { ReadMemory, "ReadMemory" }, { RegisterClient, "RegisterClient" }, { RegisterEraseQueue, "RegisterEraseQueue" }, { RegisterMTD, "RegisterMTD" }, { ReleaseConfiguration, "ReleaseConfiguration" }, { ReleaseIO, "ReleaseIO" }, { ReleaseIRQ, "ReleaseIRQ" }, { ReleaseWindow, "ReleaseWindow" }, { RequestConfiguration, "RequestConfiguration" }, { RequestIO, "RequestIO" }, { RequestIRQ, "RequestIRQ" }, { RequestSocketMask, "RequestSocketMask" }, { RequestWindow, "RequestWindow" }, { ResetCard, "ResetCard" }, { SetEventMask, "SetEventMask" }, { ValidateCIS, "ValidateCIS" }, { WriteMemory, "WriteMemory" }, { BindDevice, "BindDevice" }, { BindMTD, "BindMTD" }, { ReportError, "ReportError" }, { SuspendCard, "SuspendCard" }, { ResumeCard, "ResumeCard" }, { EjectCard, "EjectCard" }, { InsertCard, "InsertCard" }, { ReplaceCIS, "ReplaceCIS" } }; static int pcmcia_report_error(struct pcmcia_device *p_dev, error_info_t *err) { int i; char *serv; if (!p_dev) printk(KERN_NOTICE); else printk(KERN_NOTICE "%s: ", p_dev->dev.bus_id); for (i = 0; i < ARRAY_SIZE(service_table); i++) if (service_table[i].key == err->func) break; if (i < ARRAY_SIZE(service_table)) serv = service_table[i].msg; else serv = "Unknown service number"; for (i = 0; i < ARRAY_SIZE(error_table); i++) if (error_table[i].key == err->retcode) break; if (i < ARRAY_SIZE(error_table)) printk("%s: %s\n", serv, error_table[i].msg); else printk("%s: Unknown error code %#x\n", serv, err->retcode); return CS_SUCCESS; } /* report_error */ /* end of code which was in cs.c before */ /*======================================================================*/ void cs_error(struct pcmcia_device *p_dev, int func, int ret) { error_info_t err = { func, ret }; pcmcia_report_error(p_dev, &err); } EXPORT_SYMBOL(cs_error); static void pcmcia_check_driver(struct pcmcia_driver *p_drv) { struct pcmcia_device_id *did = p_drv->id_table; unsigned int i; u32 hash; if (!p_drv->probe || !p_drv->remove) printk(KERN_DEBUG "pcmcia: %s lacks a requisite callback " "function\n", p_drv->drv.name); while (did && did->match_flags) { for (i=0; i<4; i++) { if (!did->prod_id[i]) continue; hash = crc32(0, did->prod_id[i], strlen(did->prod_id[i])); if (hash == did->prod_id_hash[i]) continue; printk(KERN_DEBUG "pcmcia: %s: invalid hash for " "product string \"%s\": is 0x%x, should " "be 0x%x\n", p_drv->drv.name, did->prod_id[i], did->prod_id_hash[i], hash); printk(KERN_DEBUG "pcmcia: see " "Documentation/pcmcia/devicetable.txt for " "details\n"); } did++; } return; } /*======================================================================*/ struct pcmcia_dynid { struct list_head node; struct pcmcia_device_id id; }; /** * pcmcia_store_new_id - add a new PCMCIA device ID to this driver and re-probe devices * @driver: target device driver * @buf: buffer for scanning device ID data * @count: input size * * Adds a new dynamic PCMCIA device ID to this driver, * and causes the driver to probe for all devices again. */ static ssize_t pcmcia_store_new_id(struct device_driver *driver, const char *buf, size_t count) { struct pcmcia_dynid *dynid; struct pcmcia_driver *pdrv = to_pcmcia_drv(driver); __u16 match_flags, manf_id, card_id; __u8 func_id, function, device_no; __u32 prod_id_hash[4] = {0, 0, 0, 0}; int fields=0; int retval = 0; fields = sscanf(buf, "%hx %hx %hx %hhx %hhx %hhx %x %x %x %x", &match_flags, &manf_id, &card_id, &func_id, &function, &device_no, &prod_id_hash[0], &prod_id_hash[1], &prod_id_hash[2], &prod_id_hash[3]); if (fields < 6) return -EINVAL; dynid = kzalloc(sizeof(struct pcmcia_dynid), GFP_KERNEL); if (!dynid) return -ENOMEM; INIT_LIST_HEAD(&dynid->node); dynid->id.match_flags = match_flags; dynid->id.manf_id = manf_id; dynid->id.card_id = card_id; dynid->id.func_id = func_id; dynid->id.function = function; dynid->id.device_no = device_no; memcpy(dynid->id.prod_id_hash, prod_id_hash, sizeof(__u32) * 4); spin_lock(&pdrv->dynids.lock); list_add_tail(&pdrv->dynids.list, &dynid->node); spin_unlock(&pdrv->dynids.lock); if (get_driver(&pdrv->drv)) { retval = driver_attach(&pdrv->drv); put_driver(&pdrv->drv); } if (retval) return retval; return count; } static DRIVER_ATTR(new_id, S_IWUSR, NULL, pcmcia_store_new_id); static void pcmcia_free_dynids(struct pcmcia_driver *drv) { struct pcmcia_dynid *dynid, *n; spin_lock(&drv->dynids.lock); list_for_each_entry_safe(dynid, n, &drv->dynids.list, node) { list_del(&dynid->node); kfree(dynid); } spin_unlock(&drv->dynids.lock); } static int pcmcia_create_newid_file(struct pcmcia_driver *drv) { int error = 0; if (drv->probe != NULL) error = sysfs_create_file(&drv->drv.kobj, &driver_attr_new_id.attr); return error; } /** * pcmcia_register_driver - register a PCMCIA driver with the bus core * * Registers a PCMCIA driver with the PCMCIA bus core. */ int pcmcia_register_driver(struct pcmcia_driver *driver) { int error; if (!driver) return -EINVAL; pcmcia_check_driver(driver); /* initialize common fields */ driver->drv.bus = &pcmcia_bus_type; driver->drv.owner = driver->owner; spin_lock_init(&driver->dynids.lock); INIT_LIST_HEAD(&driver->dynids.list); ds_dbg(3, "registering driver %s\n", driver->drv.name); error = driver_register(&driver->drv); if (error < 0) return error; error = pcmcia_create_newid_file(driver); if (error) driver_unregister(&driver->drv); return error; } EXPORT_SYMBOL(pcmcia_register_driver); /** * pcmcia_unregister_driver - unregister a PCMCIA driver with the bus core */ void pcmcia_unregister_driver(struct pcmcia_driver *driver) { ds_dbg(3, "unregistering driver %s\n", driver->drv.name); driver_unregister(&driver->drv); pcmcia_free_dynids(driver); } EXPORT_SYMBOL(pcmcia_unregister_driver); /* pcmcia_device handling */ struct pcmcia_device * pcmcia_get_dev(struct pcmcia_device *p_dev) { struct device *tmp_dev; tmp_dev = get_device(&p_dev->dev); if (!tmp_dev) return NULL; return to_pcmcia_dev(tmp_dev); } void pcmcia_put_dev(struct pcmcia_device *p_dev) { if (p_dev) put_device(&p_dev->dev); } static void pcmcia_release_function(struct kref *ref) { struct config_t *c = container_of(ref, struct config_t, ref); ds_dbg(1, "releasing config_t\n"); kfree(c); } static void pcmcia_release_dev(struct device *dev) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); ds_dbg(1, "releasing device %s\n", p_dev->dev.bus_id); pcmcia_put_socket(p_dev->socket); kfree(p_dev->devname); kref_put(&p_dev->function_config->ref, pcmcia_release_function); kfree(p_dev); } static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc) { if (!s->pcmcia_state.device_add_pending) { ds_dbg(1, "scheduling to add %s secondary" " device to %d\n", mfc ? "mfc" : "pfc", s->sock); s->pcmcia_state.device_add_pending = 1; s->pcmcia_state.mfc_pfc = mfc; schedule_work(&s->device_add); } return; } static int pcmcia_device_probe(struct device * dev) { struct pcmcia_device *p_dev; struct pcmcia_driver *p_drv; struct pcmcia_device_id *did; struct pcmcia_socket *s; cistpl_config_t cis_config; int ret = 0; dev = get_device(dev); if (!dev) return -ENODEV; p_dev = to_pcmcia_dev(dev); p_drv = to_pcmcia_drv(dev->driver); s = p_dev->socket; ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id, p_drv->drv.name); if ((!p_drv->probe) || (!p_dev->function_config) || (!try_module_get(p_drv->owner))) { ret = -EINVAL; goto put_dev; } /* set up some more device information */ ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG, &cis_config); if (!ret) { p_dev->conf.ConfigBase = cis_config.base; p_dev->conf.Present = cis_config.rmask[0]; } else { printk(KERN_INFO "pcmcia: could not parse base and rmask0 of CIS\n"); p_dev->conf.ConfigBase = 0; p_dev->conf.Present = 0; } ret = p_drv->probe(p_dev); if (ret) { ds_dbg(1, "binding %s to %s failed with %d\n", p_dev->dev.bus_id, p_drv->drv.name, ret); goto put_module; } /* handle pseudo multifunction devices: * there are at most two pseudo multifunction devices. * if we're matching against the first, schedule a * call which will then check whether there are two * pseudo devices, and if not, add the second one. */ did = p_dev->dev.driver_data; if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) pcmcia_add_device_later(p_dev->socket, 0); put_module: if (ret) module_put(p_drv->owner); put_dev: if (ret) put_device(dev); return (ret); } /* * Removes a PCMCIA card from the device tree and socket list. */ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *leftover) { struct pcmcia_device *p_dev; struct pcmcia_device *tmp; unsigned long flags; ds_dbg(2, "pcmcia_card_remove(%d) %s\n", s->sock, leftover ? leftover->devname : ""); if (!leftover) s->device_count = 0; else s->device_count = 1; /* unregister all pcmcia_devices registered with this socket, except leftover */ list_for_each_entry_safe(p_dev, tmp, &s->devices_list, socket_device_list) { if (p_dev == leftover) continue; spin_lock_irqsave(&pcmcia_dev_list_lock, flags); list_del(&p_dev->socket_device_list); p_dev->_removed=1; spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); ds_dbg(2, "unregistering device %s\n", p_dev->dev.bus_id); device_unregister(&p_dev->dev); } return; } static int pcmcia_device_remove(struct device * dev) { struct pcmcia_device *p_dev; struct pcmcia_driver *p_drv; struct pcmcia_device_id *did; int i; p_dev = to_pcmcia_dev(dev); p_drv = to_pcmcia_drv(dev->driver); ds_dbg(1, "removing device %s\n", p_dev->dev.bus_id); /* If we're removing the primary module driving a * pseudo multi-function card, we need to unbind * all devices */ did = p_dev->dev.driver_data; if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && (p_dev->socket->device_count != 0) && (p_dev->device_no == 0)) pcmcia_card_remove(p_dev->socket, p_dev); /* detach the "instance" */ if (!p_drv) return 0; if (p_drv->remove) p_drv->remove(p_dev); p_dev->dev_node = NULL; /* check for proper unloading */ if (p_dev->_irq || p_dev->_io || p_dev->_locked) printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", p_drv->drv.name); for (i = 0; i < MAX_WIN; i++) if (p_dev->_win & CLIENT_WIN_REQ(i)) printk(KERN_INFO "pcmcia: driver %s did not release windows properly\n", p_drv->drv.name); /* references from pcmcia_probe_device */ pcmcia_put_dev(p_dev); module_put(p_drv->owner); return 0; } /* * pcmcia_device_query -- determine information about a pcmcia device */ static int pcmcia_device_query(struct pcmcia_device *p_dev) { cistpl_manfid_t manf_id; cistpl_funcid_t func_id; cistpl_vers_1_t *vers1; unsigned int i; vers1 = kmalloc(sizeof(*vers1), GFP_KERNEL); if (!vers1) return -ENOMEM; if (!pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_MANFID, &manf_id)) { p_dev->manf_id = manf_id.manf; p_dev->card_id = manf_id.card; p_dev->has_manf_id = 1; p_dev->has_card_id = 1; } if (!pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_FUNCID, &func_id)) { p_dev->func_id = func_id.func; p_dev->has_func_id = 1; } else { /* rule of thumb: cards with no FUNCID, but with * common memory device geometry information, are * probably memory cards (from pcmcia-cs) */ cistpl_device_geo_t *devgeo; devgeo = kmalloc(sizeof(*devgeo), GFP_KERNEL); if (!devgeo) { kfree(vers1); return -ENOMEM; } if (!pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_DEVICE_GEO, devgeo)) { ds_dbg(0, "mem device geometry probably means " "FUNCID_MEMORY\n"); p_dev->func_id = CISTPL_FUNCID_MEMORY; p_dev->has_func_id = 1; } kfree(devgeo); } if (!pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_VERS_1, vers1)) { for (i=0; i < vers1->ns; i++) { char *tmp; unsigned int length; tmp = vers1->str + vers1->ofs[i]; length = strlen(tmp) + 1; if ((length < 2) || (length > 255)) continue; p_dev->prod_id[i] = kmalloc(sizeof(char) * length, GFP_KERNEL); if (!p_dev->prod_id[i]) continue; p_dev->prod_id[i] = strncpy(p_dev->prod_id[i], tmp, length); } } kfree(vers1); return 0; } /* device_add_lock is needed to avoid double registration by cardmgr and kernel. * Serializes pcmcia_device_add; will most likely be removed in future. * * While it has the caveat that adding new PCMCIA devices inside(!) device_register() * won't work, this doesn't matter much at the moment: the driver core doesn't * support it either. */ static DEFINE_MUTEX(device_add_lock); struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) { struct pcmcia_device *p_dev, *tmp_dev; unsigned long flags; int bus_id_len; s = pcmcia_get_socket(s); if (!s) return NULL; mutex_lock(&device_add_lock); ds_dbg(3, "adding device to %d, function %d\n", s->sock, function); /* max of 4 devices per card */ if (s->device_count == 4) goto err_put; p_dev = kzalloc(sizeof(struct pcmcia_device), GFP_KERNEL); if (!p_dev) goto err_put; p_dev->socket = s; p_dev->device_no = (s->device_count++); p_dev->func = function; p_dev->dev.bus = &pcmcia_bus_type; p_dev->dev.parent = s->dev.parent; p_dev->dev.release = pcmcia_release_dev; bus_id_len = sprintf (p_dev->dev.bus_id, "%d.%d", p_dev->socket->sock, p_dev->device_no); p_dev->devname = kmalloc(6 + bus_id_len + 1, GFP_KERNEL); if (!p_dev->devname) goto err_free; sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id); ds_dbg(3, "devname is %s\n", p_dev->devname); spin_lock_irqsave(&pcmcia_dev_list_lock, flags); /* * p_dev->function_config must be the same for all card functions. * Note that this is serialized by the device_add_lock, so that * only one such struct will be created. */ list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list) if (p_dev->func == tmp_dev->func) { p_dev->function_config = tmp_dev->function_config; kref_get(&p_dev->function_config->ref); } /* Add to the list in pcmcia_bus_socket */ list_add(&p_dev->socket_device_list, &s->devices_list); spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); if (!p_dev->function_config) { ds_dbg(3, "creating config_t for %s\n", p_dev->dev.bus_id); p_dev->function_config = kzalloc(sizeof(struct config_t), GFP_KERNEL); if (!p_dev->function_config) goto err_unreg; kref_init(&p_dev->function_config->ref); } printk(KERN_NOTICE "pcmcia: registering new device %s\n", p_dev->devname); pcmcia_device_query(p_dev); if (device_register(&p_dev->dev)) goto err_unreg; mutex_unlock(&device_add_lock); return p_dev; err_unreg: spin_lock_irqsave(&pcmcia_dev_list_lock, flags); list_del(&p_dev->socket_device_list); spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); err_free: kfree(p_dev->devname); kfree(p_dev); s->device_count--; err_put: mutex_unlock(&device_add_lock); pcmcia_put_socket(s); return NULL; } static int pcmcia_card_add(struct pcmcia_socket *s) { cisinfo_t cisinfo; cistpl_longlink_mfc_t mfc; unsigned int no_funcs, i; int ret = 0; if (!(s->resource_setup_done)) { ds_dbg(3, "no resources available, delaying card_add\n"); return -EAGAIN; /* try again, but later... */ } if (pcmcia_validate_mem(s)) { ds_dbg(3, "validating mem resources failed, " "delaying card_add\n"); return -EAGAIN; /* try again, but later... */ } ret = pccard_validate_cis(s, BIND_FN_ALL, &cisinfo); if (ret || !cisinfo.Chains) { ds_dbg(0, "invalid CIS or invalid resources\n"); return -ENODEV; } if (!pccard_read_tuple(s, BIND_FN_ALL, CISTPL_LONGLINK_MFC, &mfc)) no_funcs = mfc.nfn; else no_funcs = 1; s->functions = no_funcs; for (i=0; i < no_funcs; i++) pcmcia_device_add(s, i); return (ret); } static void pcmcia_delayed_add_device(struct work_struct *work) { struct pcmcia_socket *s = container_of(work, struct pcmcia_socket, device_add); ds_dbg(1, "adding additional device to %d\n", s->sock); pcmcia_device_add(s, s->pcmcia_state.mfc_pfc); s->pcmcia_state.device_add_pending = 0; s->pcmcia_state.mfc_pfc = 0; } static int pcmcia_requery(struct device *dev, void * _data) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); if (!p_dev->dev.driver) { ds_dbg(1, "update device information for %s\n", p_dev->dev.bus_id); pcmcia_device_query(p_dev); } return 0; } static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis) { int no_devices = 0; int ret = 0; unsigned long flags; /* must be called with skt_mutex held */ ds_dbg(0, "re-scanning socket %d\n", skt->sock); spin_lock_irqsave(&pcmcia_dev_list_lock, flags); if (list_empty(&skt->devices_list)) no_devices = 1; spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); /* If this is because of a CIS override, start over */ if (new_cis && !no_devices) pcmcia_card_remove(skt, NULL); /* if no devices were added for this socket yet because of * missing resource information or other trouble, we need to * do this now. */ if (no_devices || new_cis) { ret = pcmcia_card_add(skt); if (ret) return; } /* some device information might have changed because of a CIS * update or because we can finally read it correctly... so * determine it again, overwriting old values if necessary. */ bus_for_each_dev(&pcmcia_bus_type, NULL, NULL, pcmcia_requery); /* we re-scan all devices, not just the ones connected to this * socket. This does not matter, though. */ ret = bus_rescan_devices(&pcmcia_bus_type); if (ret) printk(KERN_INFO "pcmcia: bus_rescan_devices failed\n"); } #ifdef CONFIG_PCMCIA_LOAD_CIS /** * pcmcia_load_firmware - load CIS from userspace if device-provided is broken * @dev - the pcmcia device which needs a CIS override * @filename - requested filename in /lib/firmware/ * * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if * the one provided by the card is broken. The firmware files reside in * /lib/firmware/ in userspace. */ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) { struct pcmcia_socket *s = dev->socket; const struct firmware *fw; char path[20]; int ret = -ENOMEM; int no_funcs; int old_funcs; cisdump_t *cis; cistpl_longlink_mfc_t mfc; if (!filename) return -EINVAL; ds_dbg(1, "trying to load CIS file %s\n", filename); if (strlen(filename) > 14) { printk(KERN_WARNING "pcmcia: CIS filename is too long\n"); return -EINVAL; } snprintf(path, 20, "%s", filename); if (request_firmware(&fw, path, &dev->dev) == 0) { if (fw->size >= CISTPL_MAX_CIS_SIZE) { ret = -EINVAL; printk(KERN_ERR "pcmcia: CIS override is too big\n"); goto release; } cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL); if (!cis) { ret = -ENOMEM; goto release; } cis->Length = fw->size + 1; memcpy(cis->Data, fw->data, fw->size); if (!pcmcia_replace_cis(s, cis)) ret = 0; else { printk(KERN_ERR "pcmcia: CIS override failed\n"); goto release; } /* update information */ pcmcia_device_query(dev); /* does this cis override add or remove functions? */ old_funcs = s->functions; if (!pccard_read_tuple(s, BIND_FN_ALL, CISTPL_LONGLINK_MFC, &mfc)) no_funcs = mfc.nfn; else no_funcs = 1; s->functions = no_funcs; if (old_funcs > no_funcs) pcmcia_card_remove(s, dev); else if (no_funcs > old_funcs) pcmcia_add_device_later(s, 1); } release: release_firmware(fw); return (ret); } #else /* !CONFIG_PCMCIA_LOAD_CIS */ static inline int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) { return -ENODEV; } #endif static inline int pcmcia_devmatch(struct pcmcia_device *dev, struct pcmcia_device_id *did) { if (did->match_flags & PCMCIA_DEV_ID_MATCH_MANF_ID) { if ((!dev->has_manf_id) || (dev->manf_id != did->manf_id)) return 0; } if (did->match_flags & PCMCIA_DEV_ID_MATCH_CARD_ID) { if ((!dev->has_card_id) || (dev->card_id != did->card_id)) return 0; } if (did->match_flags & PCMCIA_DEV_ID_MATCH_FUNCTION) { if (dev->func != did->function) return 0; } if (did->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID1) { if (!dev->prod_id[0]) return 0; if (strcmp(did->prod_id[0], dev->prod_id[0])) return 0; } if (did->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID2) { if (!dev->prod_id[1]) return 0; if (strcmp(did->prod_id[1], dev->prod_id[1])) return 0; } if (did->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3) { if (!dev->prod_id[2]) return 0; if (strcmp(did->prod_id[2], dev->prod_id[2])) return 0; } if (did->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4) { if (!dev->prod_id[3]) return 0; if (strcmp(did->prod_id[3], dev->prod_id[3])) return 0; } if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) { if (dev->device_no != did->device_no) return 0; } if (did->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID) { if ((!dev->has_func_id) || (dev->func_id != did->func_id)) return 0; /* if this is a pseudo-multi-function device, * we need explicit matches */ if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) return 0; if (dev->device_no) return 0; /* also, FUNC_ID matching needs to be activated by userspace * after it has re-checked that there is no possible module * with a prod_id/manf_id/card_id match. */ ds_dbg(0, "skipping FUNC_ID match for %s until userspace " "interaction\n", dev->dev.bus_id); if (!dev->allow_func_id_match) return 0; } if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { ds_dbg(0, "device %s needs a fake CIS\n", dev->dev.bus_id); if (!dev->socket->fake_cis) pcmcia_load_firmware(dev, did->cisfile); if (!dev->socket->fake_cis) return 0; } if (did->match_flags & PCMCIA_DEV_ID_MATCH_ANONYMOUS) { int i; for (i=0; i<4; i++) if (dev->prod_id[i]) return 0; if (dev->has_manf_id || dev->has_card_id || dev->has_func_id) return 0; } dev->dev.driver_data = (void *) did; return 1; } static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { struct pcmcia_device * p_dev = to_pcmcia_dev(dev); struct pcmcia_driver * p_drv = to_pcmcia_drv(drv); struct pcmcia_device_id *did = p_drv->id_table; struct pcmcia_dynid *dynid; /* match dynamic devices first */ spin_lock(&p_drv->dynids.lock); list_for_each_entry(dynid, &p_drv->dynids.list, node) { ds_dbg(3, "trying to match %s to %s\n", dev->bus_id, drv->name); if (pcmcia_devmatch(p_dev, &dynid->id)) { ds_dbg(0, "matched %s to %s\n", dev->bus_id, drv->name); spin_unlock(&p_drv->dynids.lock); return 1; } } spin_unlock(&p_drv->dynids.lock); #ifdef CONFIG_PCMCIA_IOCTL /* matching by cardmgr */ if (p_dev->cardmgr == p_drv) { ds_dbg(0, "cardmgr matched %s to %s\n", dev->bus_id, drv->name); return 1; } #endif while (did && did->match_flags) { ds_dbg(3, "trying to match %s to %s\n", dev->bus_id, drv->name); if (pcmcia_devmatch(p_dev, did)) { ds_dbg(0, "matched %s to %s\n", dev->bus_id, drv->name); return 1; } did++; } return 0; } #ifdef CONFIG_HOTPLUG static int pcmcia_bus_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { struct pcmcia_device *p_dev; int i, length = 0; u32 hash[4] = { 0, 0, 0, 0}; if (!dev) return -ENODEV; p_dev = to_pcmcia_dev(dev); /* calculate hashes */ for (i=0; i<4; i++) { if (!p_dev->prod_id[i]) continue; hash[i] = crc32(0, p_dev->prod_id[i], strlen(p_dev->prod_id[i])); } i = 0; if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "SOCKET_NO=%u", p_dev->socket->sock)) return -ENOMEM; if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "DEVICE_NO=%02X", p_dev->device_no)) return -ENOMEM; if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, "MODALIAS=pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X" "pa%08Xpb%08Xpc%08Xpd%08X", p_dev->has_manf_id ? p_dev->manf_id : 0, p_dev->has_card_id ? p_dev->card_id : 0, p_dev->has_func_id ? p_dev->func_id : 0, p_dev->func, p_dev->device_no, hash[0], hash[1], hash[2], hash[3])) return -ENOMEM; envp[i] = NULL; return 0; } #else static int pcmcia_bus_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { return -ENODEV; } #endif /************************ per-device sysfs output ***************************/ #define pcmcia_device_attr(field, test, format) \ static ssize_t field##_show (struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ return p_dev->test ? sprintf (buf, format, p_dev->field) : -ENODEV; \ } #define pcmcia_device_stringattr(name, field) \ static ssize_t name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ return p_dev->field ? sprintf (buf, "%s\n", p_dev->field) : -ENODEV; \ } pcmcia_device_attr(func, socket, "0x%02x\n"); pcmcia_device_attr(func_id, has_func_id, "0x%02x\n"); pcmcia_device_attr(manf_id, has_manf_id, "0x%04x\n"); pcmcia_device_attr(card_id, has_card_id, "0x%04x\n"); pcmcia_device_stringattr(prod_id1, prod_id[0]); pcmcia_device_stringattr(prod_id2, prod_id[1]); pcmcia_device_stringattr(prod_id3, prod_id[2]); pcmcia_device_stringattr(prod_id4, prod_id[3]); static ssize_t pcmcia_show_pm_state(struct device *dev, struct device_attribute *attr, char *buf) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); if (p_dev->suspended) return sprintf(buf, "off\n"); else return sprintf(buf, "on\n"); } static ssize_t pcmcia_store_pm_state(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); int ret = 0; if (!count) return -EINVAL; if ((!p_dev->suspended) && !strncmp(buf, "off", 3)) ret = dpm_runtime_suspend(dev, PMSG_SUSPEND); else if (p_dev->suspended && !strncmp(buf, "on", 2)) dpm_runtime_resume(dev); return ret ? ret : count; } static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); int i; u32 hash[4] = { 0, 0, 0, 0}; /* calculate hashes */ for (i=0; i<4; i++) { if (!p_dev->prod_id[i]) continue; hash[i] = crc32(0,p_dev->prod_id[i],strlen(p_dev->prod_id[i])); } return sprintf(buf, "pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X" "pa%08Xpb%08Xpc%08Xpd%08X\n", p_dev->has_manf_id ? p_dev->manf_id : 0, p_dev->has_card_id ? p_dev->card_id : 0, p_dev->has_func_id ? p_dev->func_id : 0, p_dev->func, p_dev->device_no, hash[0], hash[1], hash[2], hash[3]); } static ssize_t pcmcia_store_allow_func_id_match(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); int ret; if (!count) return -EINVAL; mutex_lock(&p_dev->socket->skt_mutex); p_dev->allow_func_id_match = 1; mutex_unlock(&p_dev->socket->skt_mutex); ret = bus_rescan_devices(&pcmcia_bus_type); if (ret) printk(KERN_INFO "pcmcia: bus_rescan_devices failed after " "allowing func_id matches\n"); return count; } static struct device_attribute pcmcia_dev_attrs[] = { __ATTR(function, 0444, func_show, NULL), __ATTR(pm_state, 0644, pcmcia_show_pm_state, pcmcia_store_pm_state), __ATTR_RO(func_id), __ATTR_RO(manf_id), __ATTR_RO(card_id), __ATTR_RO(prod_id1), __ATTR_RO(prod_id2), __ATTR_RO(prod_id3), __ATTR_RO(prod_id4), __ATTR_RO(modalias), __ATTR(allow_func_id_match, 0200, NULL, pcmcia_store_allow_func_id_match), __ATTR_NULL, }; /* PM support, also needed for reset */ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); struct pcmcia_driver *p_drv = NULL; int ret = 0; ds_dbg(2, "suspending %s\n", dev->bus_id); if (dev->driver) p_drv = to_pcmcia_drv(dev->driver); if (!p_drv) goto out; if (p_drv->suspend) { ret = p_drv->suspend(p_dev); if (ret) { printk(KERN_ERR "pcmcia: device %s (driver %s) did " "not want to go to sleep (%d)\n", p_dev->devname, p_drv->drv.name, ret); goto out; } } if (p_dev->device_no == p_dev->func) { ds_dbg(2, "releasing configuration for %s\n", dev->bus_id); pcmcia_release_configuration(p_dev); } out: if (!ret) p_dev->suspended = 1; return ret; } static int pcmcia_dev_resume(struct device * dev) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); struct pcmcia_driver *p_drv = NULL; int ret = 0; ds_dbg(2, "resuming %s\n", dev->bus_id); if (dev->driver) p_drv = to_pcmcia_drv(dev->driver); if (!p_drv) goto out; if (p_dev->device_no == p_dev->func) { ds_dbg(2, "requesting configuration for %s\n", dev->bus_id); ret = pcmcia_request_configuration(p_dev, &p_dev->conf); if (ret) goto out; } if (p_drv->resume) ret = p_drv->resume(p_dev); out: if (!ret) p_dev->suspended = 0; return ret; } static int pcmcia_bus_suspend_callback(struct device *dev, void * _data) { struct pcmcia_socket *skt = _data; struct pcmcia_device *p_dev = to_pcmcia_dev(dev); if (p_dev->socket != skt) return 0; return dpm_runtime_suspend(dev, PMSG_SUSPEND); } static int pcmcia_bus_resume_callback(struct device *dev, void * _data) { struct pcmcia_socket *skt = _data; struct pcmcia_device *p_dev = to_pcmcia_dev(dev); if (p_dev->socket != skt) return 0; dpm_runtime_resume(dev); return 0; } static int pcmcia_bus_resume(struct pcmcia_socket *skt) { ds_dbg(2, "resuming socket %d\n", skt->sock); bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); return 0; } static int pcmcia_bus_suspend(struct pcmcia_socket *skt) { ds_dbg(2, "suspending socket %d\n", skt->sock); if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_suspend_callback)) { pcmcia_bus_resume(skt); return -EIO; } return 0; } /*====================================================================== The card status event handler. ======================================================================*/ /* Normally, the event is passed to individual drivers after * informing userspace. Only for CS_EVENT_CARD_REMOVAL this * is inversed to maintain historic compatibility. */ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) { struct pcmcia_socket *s = pcmcia_get_socket(skt); if (!s) { printk(KERN_ERR "PCMCIA obtaining reference to socket %p " \ "failed, event 0x%x lost!\n", skt, event); return -ENODEV; } ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", event, priority, skt); switch (event) { case CS_EVENT_CARD_REMOVAL: s->pcmcia_state.present = 0; pcmcia_card_remove(skt, NULL); handle_event(skt, event); break; case CS_EVENT_CARD_INSERTION: s->pcmcia_state.present = 1; pcmcia_card_add(skt); handle_event(skt, event); break; case CS_EVENT_EJECTION_REQUEST: break; case CS_EVENT_PM_SUSPEND: case CS_EVENT_PM_RESUME: case CS_EVENT_RESET_PHYSICAL: case CS_EVENT_CARD_RESET: default: handle_event(skt, event); break; } pcmcia_put_socket(s); return 0; } /* ds_event */ struct pcmcia_device * pcmcia_dev_present(struct pcmcia_device *_p_dev) { struct pcmcia_device *p_dev; struct pcmcia_device *ret = NULL; p_dev = pcmcia_get_dev(_p_dev); if (!p_dev) return NULL; if (!p_dev->socket->pcmcia_state.present) goto out; if (p_dev->_removed) goto out; if (p_dev->suspended) goto out; ret = p_dev; out: pcmcia_put_dev(p_dev); return ret; } EXPORT_SYMBOL(pcmcia_dev_present); static struct pcmcia_callback pcmcia_bus_callback = { .owner = THIS_MODULE, .event = ds_event, .requery = pcmcia_bus_rescan, .suspend = pcmcia_bus_suspend, .resume = pcmcia_bus_resume, }; static int __devinit pcmcia_bus_add_socket(struct device *dev, struct class_interface *class_intf) { struct pcmcia_socket *socket = dev_get_drvdata(dev); int ret; socket = pcmcia_get_socket(socket); if (!socket) { printk(KERN_ERR "PCMCIA obtaining reference to socket %p failed\n", socket); return -ENODEV; } /* * Ugly. But we want to wait for the socket threads to have started up. * We really should let the drivers themselves drive some of this.. */ msleep(250); #ifdef CONFIG_PCMCIA_IOCTL init_waitqueue_head(&socket->queue); #endif INIT_LIST_HEAD(&socket->devices_list); INIT_WORK(&socket->device_add, pcmcia_delayed_add_device); memset(&socket->pcmcia_state, 0, sizeof(u8)); socket->device_count = 0; ret = pccard_register_pcmcia(socket, &pcmcia_bus_callback); if (ret) { printk(KERN_ERR "PCMCIA registration PCCard core failed for socket %p\n", socket); pcmcia_put_socket(socket); return (ret); } return 0; } static void pcmcia_bus_remove_socket(struct device *dev, struct class_interface *class_intf) { struct pcmcia_socket *socket = dev_get_drvdata(dev); if (!socket) return; socket->pcmcia_state.dead = 1; pccard_register_pcmcia(socket, NULL); /* unregister any unbound devices */ mutex_lock(&socket->skt_mutex); pcmcia_card_remove(socket, NULL); mutex_unlock(&socket->skt_mutex); pcmcia_put_socket(socket); return; } /* the pcmcia_bus_interface is used to handle pcmcia socket devices */ static struct class_interface pcmcia_bus_interface = { .class = &pcmcia_socket_class, .add_dev = &pcmcia_bus_add_socket, .remove_dev = &pcmcia_bus_remove_socket, }; struct bus_type pcmcia_bus_type = { .name = "pcmcia", .uevent = pcmcia_bus_uevent, .match = pcmcia_bus_match, .dev_attrs = pcmcia_dev_attrs, .probe = pcmcia_device_probe, .remove = pcmcia_device_remove, .suspend = pcmcia_dev_suspend, .resume = pcmcia_dev_resume, }; static int __init init_pcmcia_bus(void) { int ret; spin_lock_init(&pcmcia_dev_list_lock); ret = bus_register(&pcmcia_bus_type); if (ret < 0) { printk(KERN_WARNING "pcmcia: bus_register error: %d\n", ret); return ret; } ret = class_interface_register(&pcmcia_bus_interface); if (ret < 0) { printk(KERN_WARNING "pcmcia: class_interface_register error: %d\n", ret); bus_unregister(&pcmcia_bus_type); return ret; } pcmcia_setup_ioctl(); return 0; } fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that * pcmcia_socket_class is already registered */ static void __exit exit_pcmcia_bus(void) { pcmcia_cleanup_ioctl(); class_interface_unregister(&pcmcia_bus_interface); bus_unregister(&pcmcia_bus_type); } module_exit(exit_pcmcia_bus); MODULE_ALIAS("ds");
{ "pile_set_name": "Github" }
{{- if .Capabilities.APIVersions.Has "apps/v1" }} apiVersion: apps/v1 {{- else }} apiVersion: extensions/v1beta1 {{- end }} kind: Deployment metadata: name: disco spec: revisionHistoryLimit: 5 replicas: 1 selector: matchLabels: app: disco template: metadata: labels: app: disco annotations: checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} prometheus.io/scrape: "true" prometheus.io/port: {{ required ".Values.metrics.port missing" .Values.metrics.port | quote }} prometheus.io/targets: {{ required ".Values.metrics.prometheus missing" .Values.metrics.prometheus | quote }} spec: {{- if and .Values.rbac.create .Values.rbac.serviceAccountName }} {{- if not (eq .Values.rbac.serviceAccountName "default") }} serviceAccountName: {{ .Values.rbac.serviceAccountName }} {{- end -}} {{- end }} containers: - name: disco image: {{ include "image" . }} imagePullPolicy: {{ default "IfNotPresent" .Values.image.pullPolicy }} env: - name: OS_PASSWORD valueFrom: secretKeyRef: name: disco-secret key: os-password args: - disco - --config=/etc/disco/config/disco.conf - --ingress-annotation={{ required ".Values.ingressAnnotation missing" .Values.ingressAnnotation }} - --metric-port={{ required ".Values.metrics.port missing" .Values.metrics.port }} - --recordset-ttl={{ required ".Values.recordsetTTL missing" .Values.recordsetTTL }} - --record={{ required ".Values.record missing" .Values.record }} - --zone-name={{ required ".Values.openstack.zoneName missing" .Values.openstack.zoneName }} - --recheck-period={{ required ".Values.recheckPeriod missing" .Values.recheckPeriod }} - --resync-period={{ required ".Values.resyncPeriod missing" .Values.resyncPeriod }} - --threadiness={{ required ".Values.threadiness missing" .Values.threadiness }} - --install-crd={{ required ".Values.installCRD missing" .Values.installCRD }} - --debug={{ default false .Values.debug }} volumeMounts: - name: config mountPath: /etc/disco/config/ ports: - name: metrics containerPort: {{ required ".Values.metrics.port missing" .Values.metrics.port }} volumes: - name: config configMap: name: disco-config
{ "pile_set_name": "Github" }
#!/bin/sh ROOT=`dirname $0` $ROOT/bundle.js nunjucks.js $ROOT/bundle.js -m nunjucks.min.js $ROOT/bundle.js -s nunjucks-slim.js $ROOT/bundle.js -m -s nunjucks-slim.min.js
{ "pile_set_name": "Github" }
// Tideland Go Library - Etc - Errors // // Copyright (C) 2016-2017 Frank Mueller / Tideland / Oldenburg / Germany // // All rights reserved. Use of this source code is governed // by the new BSD license. package etc //-------------------- // IMPORTS //-------------------- import ( "github.com/tideland/golib/errors" ) //-------------------- // CONSTANTS //-------------------- // Error codes of the etc package. const ( ErrIllegalSourceFormat = iota + 1 ErrIllegalConfigSource ErrCannotReadFile ErrCannotPostProcess ErrInvalidPath ErrCannotSplit ErrCannotApply ) var errorMessages = errors.Messages{ ErrIllegalSourceFormat: "illegal source format", ErrIllegalConfigSource: "illegal source for configuration: %v", ErrCannotReadFile: "cannot read configuration file %q", ErrCannotPostProcess: "cannot post-process configuration: %q", ErrInvalidPath: "invalid configuration path %q", ErrCannotSplit: "cannot split configuration", ErrCannotApply: "cannot apply values to configuration", } //-------------------- // ERROR CHECKING //-------------------- // IsInvalidPathError checks if a path cannot be found. func IsInvalidPathError(err error) bool { return errors.IsError(err, ErrInvalidPath) } // EOF
{ "pile_set_name": "Github" }
/* * * Copyright (c) 2007-2016 The University of Waikato, Hamilton, New Zealand. * All rights reserved. * * This file is part of libtrace. * * This code has been developed by the University of Waikato WAND * research group. For further information please see http://www.wand.net.nz/ * * libtrace 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. * * libtrace 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/>. * * */ /* This program takes a series of traces and bpf filters and outputs how many * bytes/packets every time interval */ #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> #include <sys/time.h> #include <sys/types.h> #include <time.h> #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/tcp.h> #include <netinet/ip.h> #include <netinet/ip_icmp.h> #include <arpa/inet.h> #include <sys/socket.h> #include <getopt.h> #include <inttypes.h> #include <lt_inttypes.h> #include "libtrace.h" #include "output.h" #include "rt_protocol.h" #include "dagformat.h" #ifndef UINT32_MAX #define UINT32_MAX 0xffffffffU #endif #define DEFAULT_OUTPUT_FMT "txt" struct libtrace_t *trace; char *output_format=NULL; int merge_inputs = 0; struct filter_t { char *expr; struct libtrace_filter_t *filter; uint64_t count; uint64_t bytes; } *filters = NULL; int filter_count=0; uint64_t totcount; uint64_t totbytes; uint64_t packet_count=UINT64_MAX; double packet_interval=UINT32_MAX; struct output_data_t *output = NULL; static void report_results(double ts,uint64_t count,uint64_t bytes) { int i=0; output_set_data_time(output,0,ts); output_set_data_int(output,1,count); output_set_data_int(output,2,bytes); for(i=0;i<filter_count;++i) { output_set_data_int(output,i*2+3,filters[i].count); output_set_data_int(output,i*2+4,filters[i].bytes); filters[i].count=filters[i].bytes=0; } output_flush_row(output); } static void create_output(char *title) { int i; output=output_init(title,output_format?output_format:DEFAULT_OUTPUT_FMT); if (!output) { fprintf(stderr,"Failed to create output file\n"); return; } output_add_column(output,"ts"); output_add_column(output,"packets"); output_add_column(output,"bytes"); for(i=0;i<filter_count;++i) { char buff[1024]; snprintf(buff,sizeof(buff),"%s packets",filters[i].expr); output_add_column(output,buff); snprintf(buff,sizeof(buff),"%s bytes",filters[i].expr); output_add_column(output,buff); } output_flush_headings(output); } /* Process a trace, counting packets that match filter(s) */ static void run_trace(char *uri) { struct libtrace_packet_t *packet = trace_create_packet(); int i; uint64_t count = 0; uint64_t bytes = 0; double last_ts = 0; double ts = 0; if (!merge_inputs) create_output(uri); if (output == NULL) return; trace = trace_create(uri); if (trace_is_err(trace)) { trace_perror(trace,"trace_create"); trace_destroy(trace); if (!merge_inputs) output_destroy(output); return; } if (trace_start(trace)==-1) { trace_perror(trace,"trace_start"); trace_destroy(trace); if (!merge_inputs) output_destroy(output); return; } for (;;) { int psize; if ((psize = trace_read_packet(trace, packet)) <1) { break; } if (trace_get_packet_buffer(packet,NULL,NULL) == NULL) { continue; } ts = trace_get_seconds(packet); if (last_ts == 0) last_ts = ts; while (packet_interval != UINT64_MAX && last_ts<ts) { report_results(last_ts,count,bytes); count=0; bytes=0; last_ts+=packet_interval; } for(i=0;i<filter_count;++i) { if(trace_apply_filter(filters[i].filter,packet)) { ++filters[i].count; filters[i].bytes+=trace_get_wire_length(packet); } } ++count; bytes+=trace_get_wire_length(packet); if (count >= packet_count) { report_results(ts,count,bytes); count=0; bytes=0; } } report_results(ts,count,bytes); if (trace_is_err(trace)) trace_perror(trace,"%s",uri); trace_destroy(trace); if (!merge_inputs) output_destroy(output); trace_destroy_packet(packet); } static void usage(char *argv0) { fprintf(stderr,"Usage:\n" "%s flags libtraceuri [libtraceuri...]\n" "-i --interval=seconds Duration of reporting interval in seconds\n" "-c --count=packets Exit after count packets received\n" "-o --output-format=txt|csv|html|png Reporting output format\n" "-f --filter=bpf Apply BPF filter. Can be specified multiple times\n" "-m --merge-inputs Do not create separate outputs for each input trace\n" "-H --libtrace-help Print libtrace runtime documentation\n" ,argv0); } int main(int argc, char *argv[]) { int i; while(1) { int option_index; struct option long_options[] = { { "filter", 1, 0, 'f' }, { "interval", 1, 0, 'i' }, { "count", 1, 0, 'c' }, { "output-format", 1, 0, 'o' }, { "libtrace-help", 0, 0, 'H' }, { "merge-inputs", 0, 0, 'm' }, { NULL, 0, 0, 0 }, }; int c=getopt_long(argc, argv, "c:f:i:o:Hm", long_options, &option_index); if (c==-1) break; switch (c) { case 'f': ++filter_count; filters=realloc(filters,filter_count*sizeof(struct filter_t)); filters[filter_count-1].expr=strdup(optarg); filters[filter_count-1].filter=trace_create_filter(optarg); filters[filter_count-1].count=0; filters[filter_count-1].bytes=0; break; case 'i': packet_interval=atof(optarg); break; case 'c': packet_count=atoi(optarg); break; case 'o': if (output_format) free(output_format); output_format=strdup(optarg); break; case 'm': merge_inputs = 1; break; case 'H': trace_help(); exit(1); break; default: fprintf(stderr,"Unknown option: %c\n",c); usage(argv[0]); return 1; } } if (packet_count == UINT64_MAX && packet_interval == UINT32_MAX) { packet_interval = 300; /* every 5 minutes */ } if (optind >= argc) return 0; if (output_format) fprintf(stderr,"output format: '%s'\n",output_format); else fprintf(stderr,"output format: '%s'\n", DEFAULT_OUTPUT_FMT); if (merge_inputs) { /* If we're merging the inputs, we only want to create all * the column headers etc. once rather than doing them once * per trace */ /* This is going to "name" the output based on the first * provided URI - admittedly not ideal */ create_output(argv[optind]); if (output == NULL) return 0; } for(i=optind;i<argc;++i) { run_trace(argv[i]); } if (merge_inputs) { /* Clean up after ourselves */ output_destroy(output); } return 0; }
{ "pile_set_name": "Github" }
// mksysnum_freebsd.pl // Code generated by the command above; see README.md. DO NOT EDIT. // +build 386,freebsd package unix const ( // SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int SYS_EXIT = 1 // { void sys_exit(int rval); } exit \ SYS_FORK = 2 // { int fork(void); } SYS_READ = 3 // { ssize_t read(int fd, void *buf, \ SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, \ SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } SYS_CLOSE = 6 // { int close(int fd); } SYS_WAIT4 = 7 // { int wait4(int pid, int *status, \ SYS_LINK = 9 // { int link(char *path, char *link); } SYS_UNLINK = 10 // { int unlink(char *path); } SYS_CHDIR = 12 // { int chdir(char *path); } SYS_FCHDIR = 13 // { int fchdir(int fd); } SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } SYS_CHMOD = 15 // { int chmod(char *path, int mode); } SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } SYS_OBREAK = 17 // { int obreak(char *nsize); } break \ SYS_GETPID = 20 // { pid_t getpid(void); } SYS_MOUNT = 21 // { int mount(char *type, char *path, \ SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } SYS_SETUID = 23 // { int setuid(uid_t uid); } SYS_GETUID = 24 // { uid_t getuid(void); } SYS_GETEUID = 25 // { uid_t geteuid(void); } SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, \ SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, \ SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, \ SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, \ SYS_ACCEPT = 30 // { int accept(int s, \ SYS_GETPEERNAME = 31 // { int getpeername(int fdes, \ SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, \ SYS_ACCESS = 33 // { int access(char *path, int amode); } SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); } SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); } SYS_SYNC = 36 // { int sync(void); } SYS_KILL = 37 // { int kill(int pid, int signum); } SYS_GETPPID = 39 // { pid_t getppid(void); } SYS_DUP = 41 // { int dup(u_int fd); } SYS_PIPE = 42 // { int pipe(void); } SYS_GETEGID = 43 // { gid_t getegid(void); } SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, \ SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, \ SYS_GETGID = 47 // { gid_t getgid(void); } SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int \ SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } SYS_ACCT = 51 // { int acct(char *path); } SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, \ SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, \ SYS_REBOOT = 55 // { int reboot(int opt); } SYS_REVOKE = 56 // { int revoke(char *path); } SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, \ SYS_EXECVE = 59 // { int execve(char *fname, char **argv, \ SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args \ SYS_CHROOT = 61 // { int chroot(char *path); } SYS_MSYNC = 65 // { int msync(void *addr, size_t len, \ SYS_VFORK = 66 // { int vfork(void); } SYS_SBRK = 69 // { int sbrk(int incr); } SYS_SSTK = 70 // { int sstk(int incr); } SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise \ SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, \ SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, \ SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, \ SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, \ SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, \ SYS_GETPGRP = 81 // { int getpgrp(void); } SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } SYS_SETITIMER = 83 // { int setitimer(u_int which, struct \ SYS_SWAPON = 85 // { int swapon(char *name); } SYS_GETITIMER = 86 // { int getitimer(u_int which, \ SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } SYS_DUP2 = 90 // { int dup2(u_int from, u_int to); } SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, \ SYS_FSYNC = 95 // { int fsync(int fd); } SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, \ SYS_SOCKET = 97 // { int socket(int domain, int type, \ SYS_CONNECT = 98 // { int connect(int s, caddr_t name, \ SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } SYS_BIND = 104 // { int bind(int s, caddr_t name, \ SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, \ SYS_LISTEN = 106 // { int listen(int s, int backlog); } SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, \ SYS_GETRUSAGE = 117 // { int getrusage(int who, \ SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, \ SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, \ SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, \ SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, \ SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } SYS_SETREGID = 127 // { int setregid(int rgid, int egid); } SYS_RENAME = 128 // { int rename(char *from, char *to); } SYS_FLOCK = 131 // { int flock(int fd, int how); } SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, \ SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, \ SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } SYS_RMDIR = 137 // { int rmdir(char *path); } SYS_UTIMES = 138 // { int utimes(char *path, \ SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, \ SYS_SETSID = 147 // { int setsid(void); } SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, \ SYS_NLM_SYSCALL = 154 // { int nlm_syscall(int debug_level, int grace_period, int addr_count, char **addrs); } SYS_NFSSVC = 155 // { int nfssvc(int flag, caddr_t argp); } SYS_LGETFH = 160 // { int lgetfh(char *fname, \ SYS_GETFH = 161 // { int getfh(char *fname, \ SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, \ SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, \ SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, \ SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, \ SYS_FREEBSD6_PREAD = 173 // { ssize_t freebsd6_pread(int fd, void *buf, \ SYS_FREEBSD6_PWRITE = 174 // { ssize_t freebsd6_pwrite(int fd, \ SYS_SETFIB = 175 // { int setfib(int fibnum); } SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } SYS_SETGID = 181 // { int setgid(gid_t gid); } SYS_SETEGID = 182 // { int setegid(gid_t egid); } SYS_SETEUID = 183 // { int seteuid(uid_t euid); } SYS_STAT = 188 // { int stat(char *path, struct stat *ub); } SYS_FSTAT = 189 // { int fstat(int fd, struct stat *sb); } SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); } SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, \ SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, \ SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, \ SYS_FREEBSD6_MMAP = 197 // { caddr_t freebsd6_mmap(caddr_t addr, \ SYS_FREEBSD6_LSEEK = 199 // { off_t freebsd6_lseek(int fd, int pad, \ SYS_FREEBSD6_TRUNCATE = 200 // { int freebsd6_truncate(char *path, int pad, \ SYS_FREEBSD6_FTRUNCATE = 201 // { int freebsd6_ftruncate(int fd, int pad, \ SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, \ SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } SYS_UNDELETE = 205 // { int undelete(char *path); } SYS_FUTIMES = 206 // { int futimes(int fd, struct timeval *tptr); } SYS_GETPGID = 207 // { int getpgid(pid_t pid); } SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, \ SYS_SEMGET = 221 // { int semget(key_t key, int nsems, \ SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, \ SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, \ SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, \ SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, \ SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, \ SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, \ SYS_CLOCK_SETTIME = 233 // { int clock_settime( \ SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, \ SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, \ SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); } SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, \ SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct \ SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); } SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, \ SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( \ SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( \ SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,\ SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, \ SYS_RFORK = 251 // { int rfork(int flags); } SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, \ SYS_ISSETUGID = 253 // { int issetugid(void); } SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); } SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); } SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, \ SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, \ SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } SYS_LUTIMES = 276 // { int lutimes(char *path, \ SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); } SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); } SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); } SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, \ SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, \ SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, \ SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, \ SYS_MODNEXT = 300 // { int modnext(int modid); } SYS_MODSTAT = 301 // { int modstat(int modid, \ SYS_MODFNEXT = 302 // { int modfnext(int modid); } SYS_MODFIND = 303 // { int modfind(const char *name); } SYS_KLDLOAD = 304 // { int kldload(const char *file); } SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); } SYS_KLDFIND = 306 // { int kldfind(const char *file); } SYS_KLDNEXT = 307 // { int kldnext(int fileid); } SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct \ SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); } SYS_GETSID = 310 // { int getsid(pid_t pid); } SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, \ SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, \ SYS_AIO_RETURN = 314 // { int aio_return(struct aiocb *aiocbp); } SYS_AIO_SUSPEND = 315 // { int aio_suspend( \ SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, \ SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } SYS_OAIO_READ = 318 // { int oaio_read(struct oaiocb *aiocbp); } SYS_OAIO_WRITE = 319 // { int oaio_write(struct oaiocb *aiocbp); } SYS_OLIO_LISTIO = 320 // { int olio_listio(int mode, \ SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, \ SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct \ SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int \ SYS_SCHED_GETSCHEDULER = 330 // { int sched_getscheduler (pid_t pid); } SYS_SCHED_YIELD = 331 // { int sched_yield (void); } SYS_SCHED_GET_PRIORITY_MAX = 332 // { int sched_get_priority_max (int policy); } SYS_SCHED_GET_PRIORITY_MIN = 333 // { int sched_get_priority_min (int policy); } SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, \ SYS_UTRACE = 335 // { int utrace(const void *addr, size_t len); } SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, \ SYS_JAIL = 338 // { int jail(struct jail *jail); } SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, \ SYS_SIGSUSPEND = 341 // { int sigsuspend(const sigset_t *sigmask); } SYS_SIGPENDING = 343 // { int sigpending(sigset_t *set); } SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, \ SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, \ SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, \ SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, \ SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, \ SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, \ SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, \ SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, \ SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, \ SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, \ SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, \ SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( \ SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( \ SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, \ SYS_AIO_WAITCOMPLETE = 359 // { int aio_waitcomplete( \ SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, \ SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, \ SYS_KQUEUE = 362 // { int kqueue(void); } SYS_KEVENT = 363 // { int kevent(int fd, \ SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, \ SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, \ SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, \ SYS___SETUGID = 374 // { int __setugid(int flag); } SYS_EACCESS = 376 // { int eaccess(char *path, int amode); } SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, \ SYS___MAC_GET_PROC = 384 // { int __mac_get_proc(struct mac *mac_p); } SYS___MAC_SET_PROC = 385 // { int __mac_set_proc(struct mac *mac_p); } SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, \ SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, \ SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, \ SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, \ SYS_KENV = 390 // { int kenv(int what, const char *name, \ SYS_LCHFLAGS = 391 // { int lchflags(const char *path, \ SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, \ SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, \ SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, \ SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, \ SYS_STATFS = 396 // { int statfs(char *path, \ SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, \ SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); } SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); } SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); } SYS_KSEM_TRYWAIT = 403 // { int ksem_trywait(semid_t id); } SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, \ SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, \ SYS_KSEM_UNLINK = 406 // { int ksem_unlink(const char *name); } SYS_KSEM_GETVALUE = 407 // { int ksem_getvalue(semid_t id, int *val); } SYS_KSEM_DESTROY = 408 // { int ksem_destroy(semid_t id); } SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, \ SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, \ SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, \ SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( \ SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( \ SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( \ SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, \ SYS_SIGACTION = 416 // { int sigaction(int sig, \ SYS_SIGRETURN = 417 // { int sigreturn( \ SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); } SYS_SETCONTEXT = 422 // { int setcontext( \ SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, \ SYS_SWAPOFF = 424 // { int swapoff(const char *name); } SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, \ SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, \ SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, \ SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, \ SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, \ SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, \ SYS_THR_EXIT = 431 // { void thr_exit(long *state); } SYS_THR_SELF = 432 // { int thr_self(long *id); } SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } SYS__UMTX_LOCK = 434 // { int _umtx_lock(struct umtx *umtx); } SYS__UMTX_UNLOCK = 435 // { int _umtx_unlock(struct umtx *umtx); } SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, \ SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( \ SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( \ SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, \ SYS_THR_SUSPEND = 442 // { int thr_suspend( \ SYS_THR_WAKE = 443 // { int thr_wake(long id); } SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); } SYS_AUDIT = 445 // { int audit(const void *record, \ SYS_AUDITON = 446 // { int auditon(int cmd, void *data, \ SYS_GETAUID = 447 // { int getauid(uid_t *auid); } SYS_SETAUID = 448 // { int setauid(uid_t *auid); } SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); } SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); } SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( \ SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( \ SYS_AUDITCTL = 453 // { int auditctl(char *path); } SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, \ SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, \ SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); } SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, \ SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, \ SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, \ SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, \ SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, \ SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); } SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); } SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); } SYS_AIO_FSYNC = 465 // { int aio_fsync(int op, struct aiocb *aiocbp); } SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, \ SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); } SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, \ SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, \ SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, \ SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, \ SYS_TRUNCATE = 479 // { int truncate(char *path, off_t length); } SYS_FTRUNCATE = 480 // { int ftruncate(int fd, off_t length); } SYS_THR_KILL2 = 481 // { int thr_kill2(pid_t pid, long id, int sig); } SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, \ SYS_SHM_UNLINK = 483 // { int shm_unlink(const char *path); } SYS_CPUSET = 484 // { int cpuset(cpusetid_t *setid); } SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, \ SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, \ SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, \ SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, \ SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, \ SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, \ SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, \ SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, \ SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, \ SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, \ SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, \ SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); } SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); } SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, \ SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, \ SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, \ SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, \ SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, \ SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); } SYS_POSIX_OPENPT = 504 // { int posix_openpt(int flags); } SYS_GSSD_SYSCALL = 505 // { int gssd_syscall(char *path); } SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, \ SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, \ SYS_JAIL_REMOVE = 508 // { int jail_remove(int jid); } SYS_CLOSEFROM = 509 // { int closefrom(int lowfd); } SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, \ SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, \ SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, \ SYS_LPATHCONF = 513 // { int lpathconf(char *path, int name); } SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, \ SYS_CAP_ENTER = 516 // { int cap_enter(void); } SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); } SYS_PDFORK = 518 // { int pdfork(int *fdp, int flags); } SYS_PDKILL = 519 // { int pdkill(int fd, int signum); } SYS_PDGETPID = 520 // { int pdgetpid(int fd, pid_t *pidp); } SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, \ SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, \ SYS_SETLOGINCLASS = 524 // { int setloginclass(const char *namebuf); } SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, \ SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, \ SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, \ SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, \ SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, \ SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, \ SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, \ SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, \ SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, \ SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, \ SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, \ SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, \ SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, \ SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, \ SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, \ SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, \ SYS_ACCEPT4 = 541 // { int accept4(int s, \ SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); } SYS_AIO_MLOCK = 543 // { int aio_mlock(struct aiocb *aiocbp); } SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, \ SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, \ SYS_FUTIMENS = 546 // { int futimens(int fd, \ SYS_UTIMENSAT = 547 // { int utimensat(int fd, \ )
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using System.Threading; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; namespace Renci.SshNet.Tests.Classes.Channels { [TestClass] public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageFailure : ChannelSessionTestBase { private uint _localChannelNumber; private uint _localWindowSize; private uint _localPacketSize; private uint _remoteChannelNumber; private uint _remoteWindowSize; private uint _remotePacketSize; private IList<ChannelEventArgs> _channelClosedRegister; private List<ExceptionEventArgs> _channelExceptionRegister; private ChannelSession _channel; private MockSequence _sequence; private SemaphoreLight _sessionSemaphore; private int _initialSessionSemaphoreCount; protected override void SetupData() { var random = new Random(); _localChannelNumber = (uint) random.Next(0, int.MaxValue); _localWindowSize = (uint) random.Next(0, int.MaxValue); _localPacketSize = (uint) random.Next(0, int.MaxValue); _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); _remoteWindowSize = (uint) random.Next(0, int.MaxValue); _remotePacketSize = (uint) random.Next(0, int.MaxValue); _channelClosedRegister = new List<ChannelEventArgs>(); _channelExceptionRegister = new List<ExceptionEventArgs>(); _initialSessionSemaphoreCount = random.Next(10, 20); _sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount); } protected override void SetupMocks() { _sequence = new MockSequence(); SessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object); ConnectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1); SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore); SessionMock.InSequence(_sequence) .Setup( p => p.SendMessage( It.Is<ChannelOpenMessage>( m => m.LocalChannelNumber == _localChannelNumber && m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize && m.Info is SessionChannelOpenInfo))); SessionMock.InSequence(_sequence) .Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>())) .Callback<WaitHandle>( w => { SessionMock.Raise( s => s.ChannelOpenConfirmationReceived += null, new MessageEventArgs<ChannelOpenConfirmationMessage>( new ChannelOpenConfirmationMessage( _localChannelNumber, _remoteWindowSize, _remotePacketSize, _remoteChannelNumber))); w.WaitOne(); }); SessionMock.Setup(p => p.IsConnected).Returns(true); SessionMock.InSequence(_sequence) .Setup( p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))) .Returns(false); } protected override void Arrange() { base.Arrange(); _channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize); _channel.Closed += (sender, args) => _channelClosedRegister.Add(args); _channel.Exception += (sender, args) => _channelExceptionRegister.Add(args); _channel.Open(); SessionMock.Raise( p => p.ChannelEofReceived += null, new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber))); } protected override void Act() { _channel.Dispose(); } [TestMethod] public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount() { Assert.AreEqual(_initialSessionSemaphoreCount, _sessionSemaphore.CurrentCount); } [TestMethod] public void ExceptionShouldNeverHaveFired() { Assert.AreEqual(0, _channelExceptionRegister.Count); } [TestMethod] public void ClosedEventShouldNeverHaveFired() { Assert.AreEqual(0, _channelClosedRegister.Count); } [TestMethod] public void IsOpenShouldReturnFalse() { Assert.IsFalse(_channel.IsOpen); } } }
{ "pile_set_name": "Github" }
--- title: 净土之嚣 date: '2019-07-02' slug: tidy-noise --- 前年列弛大人有感于汪精卫的才情与下场,说:有些人如果没有被推上高位才是一生之幸。[当时我也说](https://www.liechi.org/cn/2017/04/tears_under_the_moon/#comment-3239887778)我自己正有此想法,有意选择保持安静,不去做振臂高呼的所谓社区领袖,原因有二:一是我不想对用户洗脑;二是我认为手握权力太大,终归会有很大的反作用。想必大家都明白我针对的是什么。是的,就是极乐净土(非彼净土,莫误会)。 两年过去,我觉得我的预言基本上成了现实。净土宗的敌对势力开始猛烈开炮了。导火索来自一篇 R 与 Python 的比较文章,那文章写着写着就变味了,变成了炮轰净土党,而之前潜水的反对党也纷纷冒出来,开始各种抱怨、中伤、诽谤、造谣、诬蔑净土宗。由于我与净土宗的距离很近,我有机会在隐蔽处看到了两派各自的态度。限于话题的敏感性,我不想多说具体的人事。总的来说,净土宗或多或少还是有些傲气的,大约是如我两年说的一样,权力会在无意中腐蚀人;就算你不想作恶,你也很可能在间接作恶,而且还自以为带着一身正义。净土宗的大领袖可能是少数几个头脑尚存理智的人,无奈他也收不住场、管不住下面嗷嗷待战的信众了。而反对党呢,在我看来虽然处于绝对的弱势,但反击手段有时候也有点令人作呕,实在太小人了。也可能是被压制久了,他们的头脑已经完全不清醒,不知道自己在说什么,看什么都不对,分不清现实和幻觉。比如[这位大哥](https://twitter.com/winvectorllc/status/1145388135007698945)宣称自己投了一篇文章被敝厂的编辑给拒了,乍一听好像是净土宗在故意打压他,但这跟净土不净土毫无关系,编辑也跳出来[作了澄清](https://twitter.com/topepos/status/1145462243078942720)(哎哟喂,重要的事情为何要在推特垃圾场里说呢)。不是我要卫护敝厂的人,而是我看过前面那位大哥的很多文章和行为,我认为他的话不可信;他非常喜欢扭曲事实,有妄想狂或迫害狂的倾向。有时候净土人士开个毫无恶意的普通玩笑,都能被牵涉、拔高到[宗派战争](https://twitter.com/MattDowle/status/1143255701558448128)。 这些年我们厂招了一大批人来开发净土,越来越闹闹哄哄,而我从入厂至今已六年,仍是单人团队,这也是我刻意的结果。并不是我不想更大的势力,而是我从一开始就看透了树大招风的道理,不想走到树欲静而风不止那一步。现在净土的风似乎就已经停不下来了:粉丝们使劲吹,反对派就使劲怼。影响力大到“头目打个喷嚏,社区就要感冒”的程度。 净土宗主要捧红了两样本来在 R 社区不存在的东西,一是管道,二是 tibble 数据格式。这两样东西我[前年](/cn/2017/07/long-live-the-pipe/)都表达过它们的洗脑效果,也是反对派抨击的主要对象。我在统计之都论坛上也隔三差五看见一些莫名其妙的管道([例一](https://d.cosx.org/d/420580)、[例二](https://d.cosx.org/d/420697)、[最可怕的例三](https://d.cosx.org/d/420476))。真如列弛举的鲁迅举的例子,看那些管道代码,就仿佛看“‘原来,你认得。’林冲笑着说”这样的主语后置的句子。有人觉得我是炮轰净土,我也三番五次澄清我不是在炮轰,而只是提醒:劲酒虽好,不要贪杯哟。 回到本文标题,我的重点在于这里面的喧嚣,这也是我眼中净土宗的最大问题。东西是好,但[叫卖的声音太大啦](https://twitter.com/MichaelDorman84/status/1146680713862897664)。嚣的后果是,非净土宗的声音听起来太微弱,间接受到了打压;有时候甚至是直接受到了打压,比如一些人总为基础 R 包和语法鸣不平,就是因为净土宗的宣传里面给人一种基础 R 非常混乱的印象。乱不乱呢?是很乱,谁叫 R 核心开发团队没有一个所有人都信服的主心骨呢。然而基础 R 应该也不至于乱到一团糟、没法用的地步。嚣还有另一层意思,就是嚣张、狂妄。因为我是近距离观察者,所以我可以负责任地说,几个头目开发者都是很谦虚的人,毫不狂妄,但事实是一回事,外界感受又是另一回事。一群人一起嚷嚷,嚷着嚷着就容易出乱子。已故的美国单口相声表演艺术家 George Carlin 曾经说过这么一段话: > People are wonderful. I love individuals. I hate groups of people. I hate a group of people with a 'common purpose'. 'Cause pretty soon they have little hats. And armbands. And fight songs. And a list of people they're going to visit at 3am. So, I dislike and despise groups of people but I love individuals. Every person you look at; you can see the universe in their eyes, if you're really looking. 可以说一定程度上它描述了当下敝厂领导的净土宗。我们有了 T 恤、六边形贴纸,还有粉丝[创作漫画](https://twitter.com/CMastication/status/1142832452890759169)。我们有着其他人无可比拟的巨大宣传优势。这样的后果是,就算我们推出的是垃圾产品,也一定有无数粉丝叫好。就像《皇帝的新装》一样,没有人敢站出来说皇帝没穿衣服,因为别人都在叫好,你就算觉得不太对也不敢出声,不然好像显得你很蠢。比如 [TC 兄说](https://d.cosx.org/d/420697/14)他至今没明白“非标准运行代码”(non-standard evaluation)是怎么回事,他敢承认,而我估计绝大多数迷迷瞪瞪的粉丝都不敢公开说。其实我也没太明白 rlang 造出来的一系列新概念在弄啥,但这可能是我也没认真看,因为那些玩意儿跟我没啥关系,我不做数据分析,也用不到。这就要说到净土的第二大问题了:发明的新概念太多(尤其是魔法),变动太快。他们自己可能也意识到了这个问题,但丝毫没有刹车的迹象。更可怕的是,狂热的粉丝看见净土开发者承认自己的失误之后,会把这些本来该批评、反省的行为解读为“[聆听社区的声音](https://twitter.com/MilesMcBain/status/1144608295061090306)”:你们过去发明了我们搞不懂的魔法,现在推出了一个更易懂的新魔法,谢主隆恩!这让我想起[一句讽刺](http://www.quotationspage.com/quote/27303.html): > Advertising is the modern substitute for argument; its function is to make the worse appear the better. > > --- George Santayana 在喧嚣中很难有人能静下来反省、批评与自我批评。喧嚣让修正错误这种行为变成了纯粹的恩惠。这不免[让我想起](/cn/2018/12/craving/)《文明及其缺憾》中那种廉价的缩被窝的幸福。推特上总是弥漫着“R 社区是世界上最友好的社区”这种情绪,但这正是我对 R 社区最大的担心。我们的确有很多友好的方面,尤其是对待新手、少数族裔、女性、同性恋等群体,但这个社区现在实在是太缺乏批评的声音,而净土宗的反对派的批评又不靠谱,更像是私人泄愤,而不是健康的批评。要我说,R 社区是过度友好到不太健康的社区。 要发动社区进行批评与自我批评比较难,尤其是在现在群情高涨的情况下。我觉得唯一可行的办法就是人工冷却:把我们喧嚣的宣传机器停一停,不要再主动摇旗呐喊了,留一点网络空间给用户,让他们有时间和机会发表自己的意见。不然,我们一天到晚在推出新功能并喊话,用户根本静不下心来做客观的判断。基于这个原因,我这几年已经大幅减少宣传我开发的新功能。每个包我基本上都是一声不吭更新上 CRAN。我知道,在意的用户一定能自己读那个 NEWS 文件,不必我亲自出马吼一嗓子;不在意的就不在意吧,我不在意他在不在意,反正我已经辣么厉害了。 相传王维的母亲在房中挂着三个字:净、静、境。层层递进:心净才能心静,心静方可达心境。净土宗若是懂中文该多好,我觉得就这三个字就可以醍醐灌顶(到这儿顺便说一句,我们的娃为何要学中文?不应该是为了与中国长辈交流方便,而是中文里有些微言大义的妙处,要欣赏不到就太可惜了)。 作为一个“若为自由故,嘛都可以抛”的人,我最终意识到一件很有意思的事情,就是善意的阴暗面:善意和恶意一样,都会压制到言论自由。在一个过度善意的环境里,人们只会相互吹捧、说好话,仿佛批评就意味着不善良、会变成人民公敌一样。出于这样的担忧,连我也不敢过多在英文世界里提批评意见。去年年底我写了两篇英文日志,非常含蓄地表达了我对净土[统治力](/en/2018/11/dependency-winner/)和[宣传攻势](/en/2018/12/social-media-marketing/)的意见,但估计没多少人能理解我的含蓄。其实我也不是完全没这个胆量,只是我觉得这个世界已经够喧嚣了,我不想再出手让它更吵。与其劝别人住口,不如我先自己住口罢了。我控制不了别人,但寄几还是能控寄寄几的。不必我说,各位客官看了现在这篇日志也请不要帮忙传播到英文社区。 说一段题外话。其实统计之都有类似的问题,大家普遍都太善良、听话。我过去为了追求效率,也有意无意会压制别人的意见。由于我的绝对统治力,通常我都能成功压制。回想起来,我都想不出几次别人反对我的事件;也许是我就是对的,也许是他们不敢或不想发声。我现在只记得若干年前我强烈建议论坛转型到爆栈网的形式,一硕跟我有激烈的争执。再就是有一次璟烁跟我在[一篇文章](https://cosx.org/2017/06/interview-fugee-tsung/)的中英混杂问题上表达过强烈的异议,但也被我镇压了。前年网站改版时,小轩哥有些[样式建议](https://github.com/cosname/cosx.org/pull/624),也被我无情砍掉了。此外,我都不记得还有谁曾经挑战过我。 也许,所有问题的祸端都来自“净”这个形容词。我现在觉得这是净土宗的重大失误:怎么可以自己用褒义词形容自己呢?去年我就感慨过,[形容词太难用](/en/2018/03/on-adjectives/),人们容易夸张,到最后根本搞不清一个形容词究竟是什么意思。比如净土宗下面有些包根本跟净数据没什么关系,而有些包本不属于净土宗却被人当做净土包来攻击(只因为是净土宗的领袖参与了开发),所以这仗有时候也是打得糊里糊涂,硝烟弥漫中看不清净土的真面目到底是怎样的。用了“净”这个褒义词来立国号,自然就有人会想,你自称净,那谁是脏乱差呢。我知道净土领袖没这个意思,他在[净土宣言](https://cran.rstudio.com/web/packages/tidyverse/vignettes/manifesto.html)中也专门强调过净土不意味着别的地方都是脏土,但我深表怀疑到底有几人会注意到这句话。据内幕消息,已经有一位 CRAN 总管在邮件中直接把净土称为脏土了,因为净土包更新频繁、变动太快,引起了 CRAN 的极大不满。这位总管的行为有些幼稚,就像小孩一样,打不过就骂,妄图用恶语获得精神胜利。然而我不觉得他是个例,肯定还有人对净土宗的自我标榜感到不满。敌方的不满只是一方面的问题,另一方面是追随者。谁不想站在一面“净”大旗下呢?它的名义吸引力太大了,加上人类无可救药的偶像崇拜习惯,这个阵营很容易无比团结、和谐、友善。名不正则言不顺;言顺是不是名正的结果呢?净土宗总是宣称自己的工具更容易学习,下载量巨大,学生也多,可有多少人纯粹是因为名义和宣传效应加入这个阵营的呢?如果把“净土”换成一个土得掉渣的中性词,比如“数海”,然后让大领袖用假名开发包(以去除偶像效应),那净土宗还能火起来吗?如果这一串 R 包没有成立一个明确的宗派,那它们还会像现在这样招风引敌吗?也许“净”字大旗就是双重错误:不该写上净字,也不该扯大旗。 因为愚蠢的人类有“我们的孩子不能白白牺牲”综合征(Our Boys Didn't Die in Vain),所以一旦开始打仗,通常难以收手。结束战争比发动战争难得多。这闹剧会如何收场,我也不知道。
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleIdentifier</key> <string>com.alimobilesec.SecurityGuardSDK</string> <key>CFBundleName</key> <string>SecurityGuardSDK</string> <key>CFBundleShortVersionString</key> <string>5.1.94</string> </dict> </plist>
{ "pile_set_name": "Github" }
struct MTLOrigin { var x: Int var y: Int var z: Int init() init(x x: Int, y y: Int, z z: Int) } func MTLOriginMake(_ x: Int, _ y: Int, _ z: Int) -> MTLOrigin struct MTLSize { var width: Int var height: Int var depth: Int init() init(width width: Int, height height: Int, depth depth: Int) } func MTLSizeMake(_ width: Int, _ height: Int, _ depth: Int) -> MTLSize struct MTLRegion { var origin: MTLOrigin var size: MTLSize init() init(origin origin: MTLOrigin, size size: MTLSize) } func MTLRegionMake1D(_ x: Int, _ width: Int) -> MTLRegion func MTLRegionMake2D(_ x: Int, _ y: Int, _ width: Int, _ height: Int) -> MTLRegion func MTLRegionMake3D(_ x: Int, _ y: Int, _ z: Int, _ width: Int, _ height: Int, _ depth: Int) -> MTLRegion
{ "pile_set_name": "Github" }
/* * Copyright (c) 2002-2020 "Neo4j," * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import { mapNodes, mapRelationships, getGraphStats } from './mapper' export class GraphEventHandler { constructor( graph, graphView, getNodeNeighbours, onItemMouseOver, onItemSelected, onGraphModelChange ) { this.graph = graph this.graphView = graphView this.getNodeNeighbours = getNodeNeighbours this.selectedItem = null this.onItemMouseOver = onItemMouseOver this.onItemSelected = onItemSelected this.onGraphModelChange = onGraphModelChange } graphModelChanged() { this.onGraphModelChange(getGraphStats(this.graph)) } selectItem(item) { if (this.selectedItem) { this.selectedItem.selected = false } this.selectedItem = item item.selected = true this.graphView.update() } deselectItem() { if (this.selectedItem) { this.selectedItem.selected = false this.selectedItem = null } this.onItemSelected({ type: 'canvas', item: { nodeCount: this.graph.nodes().length, relationshipCount: this.graph.relationships().length } }) this.graphView.update() } nodeClose(d) { this.graph.removeConnectedRelationships(d) this.graph.removeNode(d) this.deselectItem() this.graphView.update() this.graphModelChanged() } nodeClicked(d) { if (!d) { return } d.fixed = true if (!d.selected) { this.selectItem(d) this.onItemSelected({ type: 'node', item: { id: d.id, labels: d.labels, properties: d.propertyList } }) } else { this.deselectItem() } } nodeUnlock(d) { if (!d) { return } d.fixed = false this.deselectItem() } nodeDblClicked(d) { if (d.expanded) { this.nodeCollapse(d) return } d.expanded = true const graph = this.graph const graphView = this.graphView const graphModelChanged = this.graphModelChanged.bind(this) this.getNodeNeighbours( d, this.graph.findNodeNeighbourIds(d.id), (err, { nodes, relationships }) => { if (err) return graph.addExpandedNodes(d, mapNodes(nodes)) graph.addRelationships(mapRelationships(relationships, graph)) graphView.update() graphModelChanged() } ) } nodeCollapse(d) { d.expanded = false this.graph.collapseNode(d) this.graphView.update() this.graphModelChanged() } onNodeMouseOver(node) { if (!node.contextMenu) { this.onItemMouseOver({ type: 'node', item: { id: node.id, labels: node.labels, properties: node.propertyList } }) } } onMenuMouseOver(itemWithMenu) { this.onItemMouseOver({ type: 'context-menu-item', item: { label: itemWithMenu.contextMenu.label, content: itemWithMenu.contextMenu.menuContent, selection: itemWithMenu.contextMenu.menuSelection } }) } onRelationshipMouseOver(relationship) { this.onItemMouseOver({ type: 'relationship', item: { id: relationship.id, type: relationship.type, properties: relationship.propertyList } }) } onRelationshipClicked(relationship) { if (!relationship.selected) { this.selectItem(relationship) this.onItemSelected({ type: 'relationship', item: { id: relationship.id, type: relationship.type, properties: relationship.propertyList } }) } else { this.deselectItem() } } onCanvasClicked() { this.deselectItem() } onItemMouseOut(item) { this.onItemMouseOver({ type: 'canvas', item: { nodeCount: this.graph.nodes().length, relationshipCount: this.graph.relationships().length } }) } bindEventHandlers() { this.graphView .on('nodeMouseOver', this.onNodeMouseOver.bind(this)) .on('nodeMouseOut', this.onItemMouseOut.bind(this)) .on('menuMouseOver', this.onMenuMouseOver.bind(this)) .on('menuMouseOut', this.onItemMouseOut.bind(this)) .on('relMouseOver', this.onRelationshipMouseOver.bind(this)) .on('relMouseOut', this.onItemMouseOut.bind(this)) .on('relationshipClicked', this.onRelationshipClicked.bind(this)) .on('canvasClicked', this.onCanvasClicked.bind(this)) .on('nodeClose', this.nodeClose.bind(this)) .on('nodeClicked', this.nodeClicked.bind(this)) .on('nodeDblClicked', this.nodeDblClicked.bind(this)) .on('nodeUnlock', this.nodeUnlock.bind(this)) this.onItemMouseOut() } }
{ "pile_set_name": "Github" }
{ "$id": "request.json#", "$schema": "http://json-schema.org/draft-06/schema#", "type": "object", "required": [ "method", "url", "httpVersion", "cookies", "headers", "queryString", "headersSize", "bodySize" ], "properties": { "method": { "type": "string" }, "url": { "type": "string", "format": "uri" }, "httpVersion": { "type": "string" }, "cookies": { "type": "array", "items": { "$ref": "cookie.json#" } }, "headers": { "type": "array", "items": { "$ref": "header.json#" } }, "queryString": { "type": "array", "items": { "$ref": "query.json#" } }, "postData": { "$ref": "postData.json#" }, "headersSize": { "type": "integer" }, "bodySize": { "type": "integer" }, "comment": { "type": "string" } } }
{ "pile_set_name": "Github" }
import React from 'react' import {ActionLink} from 'components/ui/DbLink' import ACTIONS from 'data/ACTIONS' import STATUSES from 'data/STATUSES' import Module from 'parser/core/Module' import {TieredRule, TARGET, Requirement} from 'parser/core/modules/Checklist' import {SEVERITY, TieredSuggestion} from 'parser/core/modules/Suggestions' import {Trans} from '@lingui/react' const STATUS_DURATION = 30000 const RULE_TIERS = { 90: TARGET.WARN, 95: TARGET.SUCCESS, } const SUGGESTION_TIERS = { 500: SEVERITY.MINOR, 9000: SEVERITY.MEDIUM, 30000: SEVERITY.MAJOR, } const DOT_CLIPPING_THRESHOLD = 500 // ms of dot clipping to warrant a suggestion export default class DoTs extends Module { static handle = 'dots' static dependencies = [ 'checklist', 'enemies', 'entityStatuses', 'invuln', 'suggestions', ] _lastApplication = {} _clip = 0 constructor(...args) { super(...args) const filter = { by: 'player', abilityId: [STATUSES.DIA.id], } this.addEventHook(['applydebuff', 'refreshdebuff'], filter, this._onDotApply) this.addEventHook('complete', this._onComplete) } _onDotApply(event) { // Make sure we're tracking for this target const applicationKey = `${event.targetID}|${event.targetInstance}` const lastApplication = this._lastApplication[applicationKey] || 0 // If it's not been applied yet, or we're rushing, set it and skip out if (!lastApplication) { this._lastApplication[applicationKey] = event.timestamp return } // Base clip calc let clip = STATUS_DURATION - (event.timestamp - lastApplication) // Also remove invuln time in the future that casting later would just push dots into // TODO: This relies on a full set of invuln data ahead of time. Can this be trusted? clip -= this.invuln.getInvulnerableUptime('all', event.timestamp, event.timestamp + STATUS_DURATION + clip) // Capping clip at 0 - less than that is downtime, which is handled by the checklist requirement this._clip += Math.max(0, clip) this._lastApplication[applicationKey] = event.timestamp } _onComplete() { // Checklist rule for dot uptime this.checklist.add(new TieredRule({ name: <Trans id="whm.dots.rule.name"> Keep your DoTs up </Trans>, description: <Trans id="whm.dots.rule.description"> As a White Mage, Dia is significant portion of your sustained damage. Aim to keep them it up at all times. </Trans>, tiers: RULE_TIERS, requirements: [ new Requirement({ name: <Trans id="whm.dots.requirement.uptime-dia.name"><ActionLink {...ACTIONS.DIA} /> uptime</Trans>, percent: () => this.getDotUptimePercent(STATUSES.DIA.id), }), ], })) //Suggestion for DoT clipping if (this._clip > DOT_CLIPPING_THRESHOLD) { this.suggestions.add(new TieredSuggestion({ icon: ACTIONS.DIA.icon, content: <Trans id="whm.dots.suggestion.clip-dia.content"> Avoid refreshing Dia significantly before its expiration, this will allow you to cast more Glares. </Trans>, tiers: SUGGESTION_TIERS, value: this._clip, why: <Trans id="whm.dots.suggestion.clip-dia.why"> {this.parser.formatDuration(this._clip)} of {STATUSES.DIA.name} lost to early refreshes. </Trans>, })) } } getDotUptimePercent(statusId) { const statusUptime = this.entityStatuses.getStatusUptime(statusId, this.enemies.getEntities()) const fightDuration = this.parser.currentDuration - this.invuln.getInvulnerableUptime() return (statusUptime / fightDuration) * 100 } }
{ "pile_set_name": "Github" }
package com.loiane.cursojava.aula20.labs; import java.util.Scanner; public class Exer06 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); char[][] jogoVelha = new char[3][3]; System.out.println("Jogador 1 = X"); System.out.println("Jogador 2 = O"); boolean ganhou = false; int jogada = 1; char sinal; int linha = 0, coluna = 0; while (!ganhou){ if (jogada % 2 == 1){ //jogador 1 System.out.println("Vez do jogador 1. Escolha linha e coluna (1-3)."); sinal = 'X'; } else { System.out.println("Vez do jogador 2. Escolha linha e coluna (1-3)."); sinal = 'O'; } boolean linhaValida = false; while (!linhaValida){ System.out.println("Entre com a linha (1, 2 ou 3)"); linha = scan.nextInt(); if (linha >=1 && linha<=3){ linhaValida = true; } else { System.out.println("Entrada inválida, tente novamente"); } } boolean colunaValida = false; while (!colunaValida){ System.out.println("Entre com a coluna (1, 2 ou 3)"); coluna = scan.nextInt(); if (coluna >=1 && coluna<=3){ colunaValida = true; } else { System.out.println("Entrada inválida, tente novamente"); } } linha--; coluna--; if (jogoVelha[linha][coluna] == 'X' || jogoVelha[linha][coluna] == 'O'){ System.out.println("Posição já usada, tente novamente"); } else { //jogada válida jogoVelha[linha][coluna] = sinal; jogada++; } //imprimir tabuleiro for (int i=0; i<jogoVelha.length; i++){ for (int j=0;j<jogoVelha[i].length; j++){ System.out.print(jogoVelha[i][j] + " | "); } System.out.println(); } //verifica se tem ganhador if ((jogoVelha[0][0] == 'X' && jogoVelha[0][1] == 'X' && jogoVelha[0][2] == 'X') || //linha 1 (jogoVelha[1][0] == 'X' && jogoVelha[1][1] == 'X' && jogoVelha[1][2] == 'X') || //linha 2 (jogoVelha[2][0] == 'X' && jogoVelha[2][1] == 'X' && jogoVelha[2][2] == 'X') || //linha 3 (jogoVelha[0][0] == 'X' && jogoVelha[1][0] == 'X' && jogoVelha[2][0] == 'X') || //coluna 1 (jogoVelha[0][1] == 'X' && jogoVelha[1][1] == 'X' && jogoVelha[2][1] == 'X') || //coluna 2 (jogoVelha[0][2] == 'X' && jogoVelha[1][2] == 'X' && jogoVelha[2][2] == 'X') || //coluna 3 (jogoVelha[0][0] == 'X' && jogoVelha[1][1] == 'X' && jogoVelha[2][2] == 'X') || //diagonal (jogoVelha[0][2] == 'X' && jogoVelha[1][1] == 'X' && jogoVelha[2][0] == 'X')){ //diagonal inversa ganhou = true; System.out.println("Parabéns, jogador 1 ganhou!"); } else if ((jogoVelha[0][0] == 'O' && jogoVelha[0][1] == 'O' && jogoVelha[0][2] == 'O') || //linha 1 (jogoVelha[1][0] == 'O' && jogoVelha[1][1] == 'O' && jogoVelha[1][2] == 'O') || //linha 2 (jogoVelha[2][0] == 'O' && jogoVelha[2][1] == 'O' && jogoVelha[2][2] == 'O') || //linha 3 (jogoVelha[0][0] == 'O' && jogoVelha[1][0] == 'O' && jogoVelha[2][0] == 'O') || //coluna 1 (jogoVelha[0][1] == 'O' && jogoVelha[1][1] == 'O' && jogoVelha[2][1] == 'O') || //coluna 2 (jogoVelha[0][2] == 'O' && jogoVelha[1][2] == 'O' && jogoVelha[2][2] == 'O') || //coluna 3 (jogoVelha[0][0] == 'O' && jogoVelha[1][1] == 'O' && jogoVelha[2][2] == 'O') || //diagonal (jogoVelha[0][2] == 'O' && jogoVelha[1][1] == 'O' && jogoVelha[2][0] == 'O')){ //diagonal inversa ganhou = true; System.out.println("Parabéns, jogador 2 ganhou!"); } else if (jogada > 9){ ganhou = true; System.out.println("Ninguém ganhou essa partida."); } } } }
{ "pile_set_name": "Github" }
// Copyright (c) 2014 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. #ifndef CEF_INCLUDE_CAPI_CEF_BASE_CAPI_H_ #define CEF_INCLUDE_CAPI_CEF_BASE_CAPI_H_ #include <stdint.h> #include "include/internal/cef_export.h" #include "include/internal/cef_string.h" #include "include/internal/cef_string_list.h" #include "include/internal/cef_string_map.h" #include "include/internal/cef_string_multimap.h" #include "include/internal/cef_types.h" #ifdef __cplusplus extern "C" { #endif /// // All ref-counted framework structures must include this structure first. /// typedef struct _cef_base_ref_counted_t { /// // Size of the data structure. /// size_t size; /// // Called to increment the reference count for the object. Should be called // for every new copy of a pointer to a given object. /// void (CEF_CALLBACK *add_ref)(struct _cef_base_ref_counted_t* self); /// // Called to decrement the reference count for the object. If the reference // count falls to 0 the object should self-delete. Returns true (1) if the // resulting reference count is 0. /// int (CEF_CALLBACK *release)(struct _cef_base_ref_counted_t* self); /// // Returns true (1) if the current reference count is 1. /// int (CEF_CALLBACK *has_one_ref)(struct _cef_base_ref_counted_t* self); } cef_base_ref_counted_t; /// // All scoped framework structures must include this structure first. /// typedef struct _cef_base_scoped_t { /// // Size of the data structure. /// size_t size; /// // Called to delete this object. May be NULL if the object is not owned. /// void (CEF_CALLBACK *del)(struct _cef_base_scoped_t* self); } cef_base_scoped_t; // Check that the structure |s|, which is defined with a size_t member at the // top, is large enough to contain the specified member |f|. #define CEF_MEMBER_EXISTS(s, f) \ ((intptr_t)&((s)->f) - (intptr_t)(s) + sizeof((s)->f) <= \ *reinterpret_cast<size_t*>(s)) #define CEF_MEMBER_MISSING(s, f) (!CEF_MEMBER_EXISTS(s, f) || !((s)->f)) #ifdef __cplusplus } #endif #endif // CEF_INCLUDE_CAPI_CEF_BASE_CAPI_H_
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Jun 9 2015 22:53:21). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2014 by Steve Nygard. // #import <Cocoa/NSView.h> @interface FlippedView : NSView { } - (BOOL)isFlipped; @end
{ "pile_set_name": "Github" }
{ "type": "bundle", "id": "bundle--78a73eb0-beed-484f-8d46-c9d90519b8e4", "spec_version": "2.0", "objects": [ { "id": "relationship--457cb4ac-e64b-4905-853b-933a28bd34cc", "created_by_ref": "identity--c78cb6e5-0c4b-4611-8297-d1b8b55e40b5", "description": "[PowerSploit](https://attack.mitre.org/software/S0194) contains a collection of Privesc-PowerUp modules that can discover and exploit various path interception opportunities in services, processes, and variables.(Citation: GitHub PowerSploit May 2012)(Citation: PowerSploit Documentation)", "object_marking_refs": [ "marking-definition--fa42a846-8d90-4e51-bc29-71d5b4802168" ], "external_references": [ { "url": "https://github.com/PowerShellMafia/PowerSploit", "description": "PowerShellMafia. (2012, May 26). PowerSploit - A PowerShell Post-Exploitation Framework. Retrieved February 6, 2018.", "source_name": "GitHub PowerSploit May 2012" }, { "url": "http://powersploit.readthedocs.io", "description": "PowerSploit. (n.d.). PowerSploit. Retrieved February 6, 2018.", "source_name": "PowerSploit Documentation" } ], "source_ref": "tool--13cd9151-83b7-410d-9f98-25d0f0d1d80d", "relationship_type": "uses", "target_ref": "attack-pattern--c4ad009b-6e13-4419-8d21-918a1652de02", "type": "relationship", "modified": "2019-04-24T23:43:08.171Z", "created": "2018-10-17T00:14:20.652Z" } ] }
{ "pile_set_name": "Github" }
// +build ignore /* * Minio Go Library for Amazon S3 Compatible Cloud Storage * Copyright 2015-2017 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package main import ( "log" "os" "github.com/minio/minio-go" "github.com/minio/minio-go/pkg/encrypt" ) func main() { // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-testfile, my-bucketname and // my-objectname are dummy values, please replace them with original values. // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access. // This boolean value is the last argument for New(). // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically // determined based on the Endpoint value. s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true) if err != nil { log.Fatalln(err) } // Open a local file that we will upload file, err := os.Open("my-testfile") if err != nil { log.Fatalln(err) } defer file.Close() //// Build an asymmetric key from private and public files // // privateKey, err := ioutil.ReadFile("private.key") // if err != nil { // t.Fatal(err) // } // // publicKey, err := ioutil.ReadFile("public.key") // if err != nil { // t.Fatal(err) // } // // asymmetricKey, err := NewAsymmetricKey(privateKey, publicKey) // if err != nil { // t.Fatal(err) // } //// // Build a symmetric key symmetricKey := encrypt.NewSymmetricKey([]byte("my-secret-key-00")) // Build encryption materials which will encrypt uploaded data cbcMaterials, err := encrypt.NewCBCSecureMaterials(symmetricKey) if err != nil { log.Fatalln(err) } // Encrypt file content and upload to the server n, err := s3Client.PutEncryptedObject("my-bucketname", "my-objectname", file, cbcMaterials) if err != nil { log.Fatalln(err) } log.Println("Uploaded", "my-objectname", " of size: ", n, "Successfully.") }
{ "pile_set_name": "Github" }
# Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/4/
{ "pile_set_name": "Github" }
{{#if implementationOf}} <aside class="tsd-sources"> <p>Implementation of {{#with implementationOf}}{{> typeAndParent}}{{/with}}</p> </aside> {{/if}} {{#if inheritedFrom}} <aside class="tsd-sources"> <p>Inherited from {{#with inheritedFrom}}{{> typeAndParent}}{{/with}}</p> </aside> {{/if}} {{#if overwrites}} <aside class="tsd-sources"> <p>Overrides {{#with overwrites}}{{> typeAndParent}}{{/with}}</p> </aside> {{/if}}
{ "pile_set_name": "Github" }
output "master_cloud_init" { value = "${ join("`", data.template_file.master.*.rendered) }" }
{ "pile_set_name": "Github" }
# frozen_string_literal: true class OEmbedCache < ApplicationRecord serialize :data validates :data, :presence => true has_many :posts # NOTE API V1 to be extracted acts_as_api api_accessible :backbone do |t| t.add :data end def self.find_or_create_by(opts) cache = OEmbedCache.find_or_initialize_by(opts) return cache if cache.persisted? cache.fetch_and_save_oembed_data! # make after create callback and drop this method ? cache end def fetch_and_save_oembed_data! begin response = OEmbed::Providers.get(self.url, {:maxwidth => 420, :maxheight => 420, :frame => 1, :iframe => 1}) rescue => e # noop else self.data = response.fields self.data['trusted_endpoint_url'] = response.provider.endpoint self.save end end def is_trusted_and_has_html? self.from_trusted? and self.data.has_key?('html') end def from_trusted? SECURE_ENDPOINTS.include?(self.data['trusted_endpoint_url']) end def options_hash(prefix = 'thumbnail_') return nil unless self.data.has_key?(prefix + 'url') { :height => self.data.fetch(prefix + 'height', ''), :width => self.data.fetch(prefix + 'width', ''), :alt => self.data.fetch('title', ''), } end end
{ "pile_set_name": "Github" }
<template> <div class="container"> <h1>Home page</h1> <p> <NuxtLink to="/about"> About page </NuxtLink> </p> <p> <NuxtLink to="/users"> Lists of users </NuxtLink> </p> </div> </template>
{ "pile_set_name": "Github" }
#include "MT_Disconnect.h" #include "Counting_Consumer.h" #include "Counting_Supplier.h" #include "orbsvcs/Time_Utilities.h" #include "orbsvcs/Event_Utilities.h" #include "orbsvcs/Event/EC_Event_Channel.h" #include "orbsvcs/Event/EC_Default_Factory.h" static void run_test (PortableServer::POA_ptr poa, int use_callbacks); int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { TAO_EC_Default_Factory::init_svcs (); try { // ORB initialization boiler plate... CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var object = orb->resolve_initial_references ("RootPOA"); PortableServer::POA_var poa = PortableServer::POA::_narrow (object.in ()); PortableServer::POAManager_var poa_manager = poa->the_POAManager (); poa_manager->activate (); // **************************************************************** run_test (poa.in (), 0); run_test (poa.in (), 1); // **************************************************************** poa->destroy (1, 1); orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Service"); return 1; } return 0; } // **************************************************************** void deactivate_servant (PortableServer::Servant servant) { PortableServer::POA_var poa = servant->_default_POA (); PortableServer::ObjectId_var id = poa->servant_to_id (servant); poa->deactivate_object (id.in ()); } void run_test (PortableServer::POA_ptr poa, int use_callbacks) { TAO_EC_Event_Channel_Attributes attributes (poa, poa); attributes.disconnect_callbacks = use_callbacks; TAO_EC_Event_Channel ec_impl (attributes); ec_impl.activate (); RtecEventChannelAdmin::EventChannel_var event_channel = ec_impl._this (); Task task (event_channel.in (), use_callbacks); if (task.activate (THR_BOUND|THR_NEW_LWP, 1) != 0) { ACE_ERROR ((LM_ERROR, "Cannot activate the tasks\n")); } // Wait for all the threads to complete and the return ACE_Thread_Manager::instance ()->wait (); event_channel->destroy (); deactivate_servant (&ec_impl); } Task::Task (RtecEventChannelAdmin::EventChannel_ptr ec, int callbacks) : event_channel (RtecEventChannelAdmin::EventChannel::_duplicate (ec)), use_callbacks (callbacks) { } int Task::svc () { for (int i = 0; i < 10; ++i) { try { this->run_iteration (); } catch (const CORBA::Exception&) { return -1; } } return 0; } void Task::run_iteration (void) { // Obtain the consumer admin.. RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = this->event_channel->for_consumers (); // and the supplier admin.. RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = this->event_channel->for_suppliers (); // **************************************************************** int iterations = 100; EC_Counting_Supplier supplier_0; EC_Counting_Supplier supplier_1; EC_Counting_Consumer consumer_0 ("Consumer/0"); EC_Counting_Consumer consumer_1 ("Consumer/1"); const int event_type = 20; const int event_source = 10; ACE_ConsumerQOS_Factory consumer_qos; consumer_qos.start_disjunction_group (); consumer_qos.insert (event_source, event_type, 0); ACE_SupplierQOS_Factory supplier_qos; supplier_qos.insert (event_source, event_type, 0, 1); for (int i = 0; i != iterations; ++i) { supplier_0.connect (supplier_admin.in (), supplier_qos.get_SupplierQOS ()); consumer_0.connect (consumer_admin.in (), consumer_qos.get_ConsumerQOS ()); if (i % 2 == 1) { supplier_1.connect (supplier_admin.in (), supplier_qos.get_SupplierQOS ()); consumer_1.connect (consumer_admin.in (), consumer_qos.get_ConsumerQOS ()); } supplier_0.disconnect (); consumer_0.disconnect (); if (i % 2 == 1) { consumer_1.disconnect (); supplier_1.disconnect (); } } deactivate_servant (&supplier_0); deactivate_servant (&consumer_0); CORBA::ULong count_0 = 0; CORBA::ULong count_1 = 0; if (use_callbacks) { count_0 += iterations; count_1 += iterations / 2; } if (consumer_0.disconnect_count != count_0) ACE_ERROR ((LM_ERROR, "ERROR: incorrect number of disconnect calls (%d/%d) for " "consumer 0 (%d)\n", consumer_0.disconnect_count, count_0, use_callbacks)); if (supplier_0.disconnect_count != count_0) ACE_ERROR ((LM_ERROR, "ERROR: incorrect number of disconnect calls (%d/%d) for " "supplier 0 (%d)\n", supplier_0.disconnect_count, count_0, use_callbacks)); if (consumer_1.disconnect_count != count_1) ACE_ERROR ((LM_ERROR, "ERROR: incorrect number of disconnect calls (%d/%d) for " "consumer 1 (%d)\n", consumer_1.disconnect_count, count_1, use_callbacks)); if (supplier_1.disconnect_count != count_1) ACE_ERROR ((LM_ERROR, "ERROR: incorrect number of disconnect calls (%d/%d) for " "supplier 1 (%d)\n", supplier_1.disconnect_count, count_1, use_callbacks)); }
{ "pile_set_name": "Github" }
/* * * Copyright 2014 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package transport import ( "fmt" "math" "sync" "sync/atomic" ) // writeQuota is a soft limit on the amount of data a stream can // schedule before some of it is written out. type writeQuota struct { quota int32 // get waits on read from when quota goes less than or equal to zero. // replenish writes on it when quota goes positive again. ch chan struct{} // done is triggered in error case. done <-chan struct{} // replenish is called by loopyWriter to give quota back to. // It is implemented as a field so that it can be updated // by tests. replenish func(n int) } func newWriteQuota(sz int32, done <-chan struct{}) *writeQuota { w := &writeQuota{ quota: sz, ch: make(chan struct{}, 1), done: done, } w.replenish = w.realReplenish return w } func (w *writeQuota) get(sz int32) error { for { if atomic.LoadInt32(&w.quota) > 0 { atomic.AddInt32(&w.quota, -sz) return nil } select { case <-w.ch: continue case <-w.done: return errStreamDone } } } func (w *writeQuota) realReplenish(n int) { sz := int32(n) a := atomic.AddInt32(&w.quota, sz) b := a - sz if b <= 0 && a > 0 { select { case w.ch <- struct{}{}: default: } } } type trInFlow struct { limit uint32 unacked uint32 effectiveWindowSize uint32 } func (f *trInFlow) newLimit(n uint32) uint32 { d := n - f.limit f.limit = n f.updateEffectiveWindowSize() return d } func (f *trInFlow) onData(n uint32) uint32 { f.unacked += n if f.unacked >= f.limit/4 { w := f.unacked f.unacked = 0 f.updateEffectiveWindowSize() return w } f.updateEffectiveWindowSize() return 0 } func (f *trInFlow) reset() uint32 { w := f.unacked f.unacked = 0 f.updateEffectiveWindowSize() return w } func (f *trInFlow) updateEffectiveWindowSize() { atomic.StoreUint32(&f.effectiveWindowSize, f.limit-f.unacked) } func (f *trInFlow) getSize() uint32 { return atomic.LoadUint32(&f.effectiveWindowSize) } // TODO(mmukhi): Simplify this code. // inFlow deals with inbound flow control type inFlow struct { mu sync.Mutex // The inbound flow control limit for pending data. limit uint32 // pendingData is the overall data which have been received but not been // consumed by applications. pendingData uint32 // The amount of data the application has consumed but grpc has not sent // window update for them. Used to reduce window update frequency. pendingUpdate uint32 // delta is the extra window update given by receiver when an application // is reading data bigger in size than the inFlow limit. delta uint32 } // newLimit updates the inflow window to a new value n. // It assumes that n is always greater than the old limit. func (f *inFlow) newLimit(n uint32) uint32 { f.mu.Lock() d := n - f.limit f.limit = n f.mu.Unlock() return d } func (f *inFlow) maybeAdjust(n uint32) uint32 { if n > uint32(math.MaxInt32) { n = uint32(math.MaxInt32) } f.mu.Lock() // estSenderQuota is the receiver's view of the maximum number of bytes the sender // can send without a window update. estSenderQuota := int32(f.limit - (f.pendingData + f.pendingUpdate)) // estUntransmittedData is the maximum number of bytes the sends might not have put // on the wire yet. A value of 0 or less means that we have already received all or // more bytes than the application is requesting to read. estUntransmittedData := int32(n - f.pendingData) // Casting into int32 since it could be negative. // This implies that unless we send a window update, the sender won't be able to send all the bytes // for this message. Therefore we must send an update over the limit since there's an active read // request from the application. if estUntransmittedData > estSenderQuota { // Sender's window shouldn't go more than 2^31 - 1 as specified in the HTTP spec. if f.limit+n > maxWindowSize { f.delta = maxWindowSize - f.limit } else { // Send a window update for the whole message and not just the difference between // estUntransmittedData and estSenderQuota. This will be helpful in case the message // is padded; We will fallback on the current available window(at least a 1/4th of the limit). f.delta = n } f.mu.Unlock() return f.delta } f.mu.Unlock() return 0 } // onData is invoked when some data frame is received. It updates pendingData. func (f *inFlow) onData(n uint32) error { f.mu.Lock() f.pendingData += n if f.pendingData+f.pendingUpdate > f.limit+f.delta { limit := f.limit rcvd := f.pendingData + f.pendingUpdate f.mu.Unlock() return fmt.Errorf("received %d-bytes data exceeding the limit %d bytes", rcvd, limit) } f.mu.Unlock() return nil } // onRead is invoked when the application reads the data. It returns the window size // to be sent to the peer. func (f *inFlow) onRead(n uint32) uint32 { f.mu.Lock() if f.pendingData == 0 { f.mu.Unlock() return 0 } f.pendingData -= n if n > f.delta { n -= f.delta f.delta = 0 } else { f.delta -= n n = 0 } f.pendingUpdate += n if f.pendingUpdate >= f.limit/4 { wu := f.pendingUpdate f.pendingUpdate = 0 f.mu.Unlock() return wu } f.mu.Unlock() return 0 }
{ "pile_set_name": "Github" }
//===--- SemanticARCOptVisitor.h ------------------------------------------===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #ifndef SWIFT_SILOPTIMIZER_SEMANTICARC_SEMANTICARCOPTVISITOR_H #define SWIFT_SILOPTIMIZER_SEMANTICARC_SEMANTICARCOPTVISITOR_H #include "Context.h" #include "OwnershipLiveRange.h" #include "swift/Basic/BlotSetVector.h" #include "swift/Basic/FrozenMultiMap.h" #include "swift/Basic/MultiMapCache.h" #include "swift/SIL/BasicBlockUtils.h" #include "swift/SIL/OwnershipUtils.h" #include "swift/SIL/SILVisitor.h" #include "swift/SILOptimizer/Utils/InstOptUtils.h" #include "swift/SILOptimizer/Utils/ValueLifetime.h" namespace swift { namespace semanticarc { /// A visitor that optimizes ownership instructions and eliminates any trivially /// dead code that results after optimization. It uses an internal worklist that /// is initialized on construction with targets to avoid iterator invalidation /// issues. Rather than revisit the entire CFG like SILCombine and other /// visitors do, we maintain a visitedSinceLastMutation list to ensure that we /// revisit all interesting instructions in between mutations. struct LLVM_LIBRARY_VISIBILITY SemanticARCOptVisitor : SILInstructionVisitor<SemanticARCOptVisitor, bool> { /// Our main worklist. We use this after an initial run through. SmallBlotSetVector<SILValue, 32> worklist; /// A set of values that we have visited since the last mutation. We use this /// to ensure that we do not visit values twice without mutating. /// /// This is specifically to ensure that we do not go into an infinite loop /// when visiting phi nodes. SmallBlotSetVector<SILValue, 16> visitedSinceLastMutation; Context ctx; explicit SemanticARCOptVisitor(SILFunction &fn, bool onlyGuaranteedOpts) : ctx(fn, onlyGuaranteedOpts, InstModCallbacks( [this](SILInstruction *inst) { eraseInstruction(inst); }, [](SILInstruction *) {}, [](SILValue, SILValue) {}, [this](SingleValueInstruction *i, SILValue value) { eraseAndRAUWSingleValueInstruction(i, value); })) {} DeadEndBlocks &getDeadEndBlocks() { return ctx.getDeadEndBlocks(); } /// Given a single value instruction, RAUW it with newValue, add newValue to /// the worklist, and then call eraseInstruction on i. void eraseAndRAUWSingleValueInstruction(SingleValueInstruction *i, SILValue newValue) { worklist.insert(newValue); for (auto *use : i->getUses()) { for (SILValue result : use->getUser()->getResults()) { worklist.insert(result); } } i->replaceAllUsesWith(newValue); eraseInstructionAndAddOperandsToWorklist(i); } /// Add all operands of i to the worklist and then call eraseInstruction on /// i. Assumes that the instruction doesnt have users. void eraseInstructionAndAddOperandsToWorklist(SILInstruction *i) { // Then copy all operands into the worklist for future processing. for (SILValue v : i->getOperandValues()) { worklist.insert(v); } eraseInstruction(i); } /// Pop values off of visitedSinceLastMutation, adding .some values to the /// worklist. void drainVisitedSinceLastMutationIntoWorklist() { while (!visitedSinceLastMutation.empty()) { Optional<SILValue> nextValue = visitedSinceLastMutation.pop_back_val(); if (!nextValue.hasValue()) { continue; } worklist.insert(*nextValue); } } /// Remove all results of the given instruction from the worklist and then /// erase the instruction. Assumes that the instruction does not have any /// users left. void eraseInstruction(SILInstruction *i) { // Remove all SILValues of the instruction from the worklist and then erase // the instruction. for (SILValue result : i->getResults()) { worklist.erase(result); visitedSinceLastMutation.erase(result); } i->eraseFromParent(); // Add everything else from visitedSinceLastMutation to the worklist. drainVisitedSinceLastMutationIntoWorklist(); } InstModCallbacks getCallbacks() { return InstModCallbacks( [this](SILInstruction *inst) { eraseInstruction(inst); }, [](SILInstruction *) {}, [](SILValue, SILValue) {}, [this](SingleValueInstruction *i, SILValue value) { eraseAndRAUWSingleValueInstruction(i, value); }); } /// The default visitor. bool visitSILInstruction(SILInstruction *i) { assert(!isGuaranteedForwardingInst(i) && "Should have forwarding visitor for all ownership forwarding " "instructions"); return false; } bool visitCopyValueInst(CopyValueInst *cvi); bool visitBeginBorrowInst(BeginBorrowInst *bbi); bool visitLoadInst(LoadInst *li); static bool shouldVisitInst(SILInstruction *i) { switch (i->getKind()) { default: return false; case SILInstructionKind::CopyValueInst: case SILInstructionKind::BeginBorrowInst: case SILInstructionKind::LoadInst: return true; } } #define FORWARDING_INST(NAME) \ bool visit##NAME##Inst(NAME##Inst *cls) { \ for (SILValue v : cls->getResults()) { \ worklist.insert(v); \ } \ return false; \ } FORWARDING_INST(Tuple) FORWARDING_INST(Struct) FORWARDING_INST(Enum) FORWARDING_INST(OpenExistentialRef) FORWARDING_INST(Upcast) FORWARDING_INST(UncheckedRefCast) FORWARDING_INST(ConvertFunction) FORWARDING_INST(RefToBridgeObject) FORWARDING_INST(BridgeObjectToRef) FORWARDING_INST(UnconditionalCheckedCast) FORWARDING_INST(UncheckedEnumData) FORWARDING_INST(MarkUninitialized) FORWARDING_INST(SelectEnum) FORWARDING_INST(DestructureStruct) FORWARDING_INST(DestructureTuple) FORWARDING_INST(TupleExtract) FORWARDING_INST(StructExtract) FORWARDING_INST(OpenExistentialValue) FORWARDING_INST(OpenExistentialBoxValue) FORWARDING_INST(MarkDependence) FORWARDING_INST(InitExistentialRef) FORWARDING_INST(DifferentiableFunction) FORWARDING_INST(LinearFunction) FORWARDING_INST(DifferentiableFunctionExtract) FORWARDING_INST(LinearFunctionExtract) #undef FORWARDING_INST #define FORWARDING_TERM(NAME) \ bool visit##NAME##Inst(NAME##Inst *cls) { \ for (auto succValues : cls->getSuccessorBlockArgumentLists()) { \ for (SILValue v : succValues) { \ worklist.insert(v); \ } \ } \ return false; \ } FORWARDING_TERM(SwitchEnum) FORWARDING_TERM(CheckedCastBranch) FORWARDING_TERM(Branch) #undef FORWARDING_TERM bool processWorklist(); bool optimize(); bool performGuaranteedCopyValueOptimization(CopyValueInst *cvi); bool eliminateDeadLiveRangeCopyValue(CopyValueInst *cvi); bool tryJoiningCopyValueLiveRangeWithOperand(CopyValueInst *cvi); }; } // namespace semanticarc } // namespace swift #endif // SWIFT_SILOPTIMIZER_SEMANTICARC_SEMANTICARCOPTVISITOR_H
{ "pile_set_name": "Github" }
<?php namespace Codeception\Lib; use Codeception\Actor; use Codeception\Exception\TestRuntimeException; class Friend { protected $name; protected $actor; protected $data = []; protected $multiSessionModules = []; public function __construct($name, Actor $actor, $modules = []) { $this->name = $name; $this->actor = $actor; $this->multiSessionModules = array_filter($modules, function ($m) { return $m instanceof Interfaces\MultiSession; }); if (empty($this->multiSessionModules)) { throw new TestRuntimeException("No multisession modules used. Can't instantiate friend"); } } public function does($closure) { $currentUserData = []; foreach ($this->multiSessionModules as $module) { $name = $module->_getName(); $currentUserData[$name] = $module->_backupSession(); if (empty($this->data[$name])) { $module->_initializeSession(); $this->data[$name] = $module->_backupSession(); continue; } $module->_loadSession($this->data[$name]); }; $this->actor->comment(strtoupper("{$this->name} does ---")); $ret = $closure($this->actor); $this->actor->comment(strtoupper("--- {$this->name} finished")); foreach ($this->multiSessionModules as $module) { $name = $module->_getName(); $this->data[$name] = $module->_backupSession(); $module->_loadSession($currentUserData[$name]); }; return $ret; } public function isGoingTo($argumentation) { $this->actor->amGoingTo($argumentation); } public function expects($prediction) { $this->actor->expect($prediction); } public function expectsTo($prediction) { $this->actor->expectTo($prediction); } public function leave() { foreach ($this->multiSessionModules as $module) { if (isset($this->data[$module->_getName()])) { $module->_closeSession($this->data[$module->_getName()]); } } } }
{ "pile_set_name": "Github" }
{ "id": 63, "date": "2016/12/16", "sources": [ "https://www.mic.com/articles/172403/ibm-s-ceo-wrote-trump-a-glowing-letter-employees-responded-with-list-of-demands", "https://www.coworker.org/petitions/ibmers-to-ceo-ginni-rometty-affirm-ibm-values", "https://theintercept.com/2016/12/19/ibm-employees-launch-petition-protesting-cooperation-with-donald-trump/" ], "actions": [ "open letter" ], "struggles": [ "ethics" ], "employment_types": [ "white collar workers" ], "description": "IBM employees sign a petition protesting IBM's cooperation with Trump. After the IBM CEO Ginny Rometty sent a letter congratulating Trump on his presidency and refusing to rule out participation from building a muslim registry, IBM employees created a petition on coworker.org to demand that the company acknowledge the diversity of its staff and not work to further the more xenophobic aspects of Trump's agenda.", "online": true, "locations": [ "usa" ], "companies": [ "ibm" ], "workers": 1000, "tags": [ "muslim_registry", "immigration", "trump" ], "author": [ "organizejs" ], "latlngs": [ [ 44.05795005, -92.50701462052399 ] ], "addresses": [ "IBM, Rochester, Olmsted County, Minnesota, 55901:55960, United States of America" ] }
{ "pile_set_name": "Github" }
{ "__inputs": [ { "name": "DS_TESLA", "label": "tesla", "description": "", "type": "datasource", "pluginId": "influxdb", "pluginName": "InfluxDB" }, { "name": "VAR_RANGEUNIT", "type": "constant", "label": "rangeunit", "value": "km", "description": "" } ], "__requires": [ { "type": "grafana", "id": "grafana", "name": "Grafana", "version": "5.4.2" }, { "type": "panel", "id": "graph", "name": "Graph", "version": "5.0.0" }, { "type": "datasource", "id": "influxdb", "name": "InfluxDB", "version": "5.0.0" }, { "type": "panel", "id": "natel-discrete-panel", "name": "Discrete", "version": "0.0.9" }, { "type": "panel", "id": "singlestat", "name": "Singlestat", "version": "5.0.0" } ], "annotations": { "list": [ { "builtIn": 1, "datasource": "-- Grafana --", "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "type": "dashboard" }, { "datasource": "${DS_TESLA}", "enable": false, "hide": false, "iconColor": "rgba(255, 96, 96, 1)", "limit": 100, "name": "charging_state", "query": "select charging_state as title,charging_state as description from charge_state where metric='charging_state' order by time asc", "showIn": 0, "tags": [], "tagsColumn": "", "textColumn": "", "type": "tags" } ] }, "editable": true, "gnetId": null, "graphTooltip": 2, "id": null, "iteration": 1548414540801, "links": [], "panels": [ { "cacheTimeout": null, "colorBackground": false, "colorValue": false, "colors": [ "#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a" ], "datasource": "${DS_TESLA}", "decimals": 2, "format": "none", "gauge": { "maxValue": 100, "minValue": 0, "show": false, "thresholdLabels": false, "thresholdMarkers": true }, "gridPos": { "h": 2, "w": 4, "x": 0, "y": 0 }, "id": 20, "interval": null, "links": [], "mappingType": 1, "mappingTypes": [ { "name": "value to text", "value": 1 }, { "name": "range to text", "value": 2 } ], "maxDataPoints": 100, "nullPointMode": "connected", "nullText": null, "postfix": "$rangeunit", "postfixFontSize": "50%", "prefix": "Ideal", "prefixFontSize": "50%", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "sparkline": { "fillColor": "rgba(31, 118, 189, 0.18)", "full": false, "lineColor": "rgb(31, 120, 193)", "show": false }, "tableColumn": "", "targets": [ { "groupBy": [], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "ideal_battery_range" ], "type": "field" }, { "params": [], "type": "last" }, { "params": [ "*$rangefactor" ], "type": "math" } ] ], "tags": [ { "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "thresholds": "", "title": "Range", "type": "singlestat", "valueFontSize": "80%", "valueMaps": [ { "op": "=", "text": "N/A", "value": "null" } ], "valueName": "avg" }, { "cacheTimeout": null, "colorBackground": false, "colorValue": false, "colors": [ "#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a" ], "datasource": "${DS_TESLA}", "decimals": 2, "format": "none", "gauge": { "maxValue": 100, "minValue": 0, "show": false, "thresholdLabels": false, "thresholdMarkers": true }, "gridPos": { "h": 2, "w": 4, "x": 4, "y": 0 }, "id": 18, "interval": null, "links": [], "mappingType": 1, "mappingTypes": [ { "name": "value to text", "value": 1 }, { "name": "range to text", "value": 2 } ], "maxDataPoints": 100, "nullPointMode": "connected", "nullText": null, "postfix": "$rangeunit", "postfixFontSize": "50%", "prefix": "Est.", "prefixFontSize": "50%", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "sparkline": { "fillColor": "rgba(31, 118, 189, 0.18)", "full": false, "lineColor": "rgb(31, 120, 193)", "show": false }, "tableColumn": "", "targets": [ { "groupBy": [], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "query": "SELECT last(\"est_battery_range\") FROM \"charge_state\" WHERE (\"metric\" = 'est_battery_range') AND $timeFilter", "rawQuery": false, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "est_battery_range" ], "type": "field" }, { "params": [], "type": "last" }, { "params": [ "*$rangefactor" ], "type": "math" } ] ], "tags": [ { "key": "display_name", "operator": "=", "value": "/^$vehicle_name$/" } ] } ], "thresholds": "", "title": "Range", "type": "singlestat", "valueFontSize": "80%", "valueMaps": [ { "op": "=", "text": "N/A", "value": "null" } ], "valueName": "avg" }, { "cacheTimeout": null, "colorBackground": false, "colorValue": false, "colors": [ "#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a" ], "datasource": "${DS_TESLA}", "decimals": 2, "format": "none", "gauge": { "maxValue": 100, "minValue": 0, "show": false, "thresholdLabels": false, "thresholdMarkers": true }, "gridPos": { "h": 2, "w": 4, "x": 8, "y": 0 }, "id": 19, "interval": null, "links": [], "mappingType": 1, "mappingTypes": [ { "name": "value to text", "value": 1 }, { "name": "range to text", "value": 2 } ], "maxDataPoints": 100, "nullPointMode": "connected", "nullText": null, "postfix": "$rangeunit", "postfixFontSize": "50%", "prefix": "Rated", "prefixFontSize": "50%", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "sparkline": { "fillColor": "rgba(31, 118, 189, 0.18)", "full": false, "lineColor": "rgb(31, 120, 193)", "show": false }, "tableColumn": "", "targets": [ { "groupBy": [], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "query": "SELECT last(\"battery_range\") *$rangefactor FROM \"charge_state\" WHERE (\"metric\" = 'battery_range') AND $timeFilter", "rawQuery": false, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "battery_range" ], "type": "field" }, { "params": [], "type": "last" }, { "params": [ "*$rangefactor" ], "type": "math" } ] ], "tags": [ { "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "thresholds": "", "title": "Range", "type": "singlestat", "valueFontSize": "80%", "valueMaps": [ { "op": "=", "text": "N/A", "value": "null" } ], "valueName": "avg" }, { "cacheTimeout": null, "colorBackground": false, "colorValue": false, "colors": [ "#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a" ], "datasource": "${DS_TESLA}", "description": "Energy added on last Charge", "format": "kwatth", "gauge": { "maxValue": 100, "minValue": 0, "show": false, "thresholdLabels": false, "thresholdMarkers": true }, "gridPos": { "h": 2, "w": 3, "x": 12, "y": 0 }, "id": 32, "interval": null, "links": [], "mappingType": 1, "mappingTypes": [ { "name": "value to text", "value": 1 }, { "name": "range to text", "value": 2 } ], "maxDataPoints": 100, "nullPointMode": "connected", "nullText": null, "postfix": "", "postfixFontSize": "50%", "prefix": "", "prefixFontSize": "50%", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "sparkline": { "fillColor": "rgba(31, 118, 189, 0.18)", "full": false, "lineColor": "rgb(31, 120, 193)", "show": false }, "tableColumn": "", "targets": [ { "groupBy": [], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "charge_energy_added" ], "type": "field" } ] ], "tags": [ { "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "thresholds": "", "title": "Energy added", "type": "singlestat", "valueFontSize": "80%", "valueMaps": [ { "op": "=", "text": "N/A", "value": "null" } ], "valueName": "avg" }, { "cacheTimeout": null, "colorBackground": false, "colorValue": false, "colors": [ "#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a" ], "datasource": "${DS_TESLA}", "decimals": 2, "format": "h", "gauge": { "maxValue": 100, "minValue": 0, "show": false, "thresholdLabels": false, "thresholdMarkers": true }, "gridPos": { "h": 2, "w": 3, "x": 15, "y": 0 }, "hideTimeOverride": false, "id": 30, "interval": null, "links": [], "mappingType": 1, "mappingTypes": [ { "name": "value to text", "value": 1 }, { "name": "range to text", "value": 2 } ], "maxDataPoints": 100, "nullPointMode": "connected", "nullText": null, "postfix": "", "postfixFontSize": "50%", "prefix": "", "prefixFontSize": "50%", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "sparkline": { "fillColor": "rgba(31, 118, 189, 0.18)", "full": false, "lineColor": "rgb(31, 120, 193)", "show": false }, "tableColumn": "last", "targets": [ { "alias": "", "groupBy": [], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "time_to_full_charge" ], "type": "field" } ] ], "tags": [ { "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "thresholds": "", "title": "Time to Full at current Rate", "transparent": false, "type": "singlestat", "valueFontSize": "80%", "valueMaps": [], "valueName": "current" }, { "cacheTimeout": null, "colorBackground": false, "colorValue": false, "colors": [ "#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a" ], "datasource": "${DS_TESLA}", "format": "none", "gauge": { "maxValue": 100, "minValue": 0, "show": false, "thresholdLabels": false, "thresholdMarkers": true }, "gridPos": { "h": 2, "w": 3, "x": 18, "y": 0 }, "id": 4, "interval": null, "links": [], "mappingType": 1, "mappingTypes": [ { "name": "value to text", "value": 1 }, { "name": "range to text", "value": 2 } ], "maxDataPoints": 100, "nullPointMode": "connected", "nullText": null, "postfix": "", "postfixFontSize": "50%", "prefix": "", "prefixFontSize": "50%", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "sparkline": { "fillColor": "rgba(31, 118, 189, 0.18)", "full": false, "lineColor": "rgb(31, 120, 193)", "show": false }, "tableColumn": "", "targets": [ { "groupBy": [], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "charger_phases" ], "type": "field" }, { "params": [], "type": "last" } ] ], "tags": [ { "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "thresholds": "", "title": "AC Charger Phases", "type": "singlestat", "valueFontSize": "80%", "valueMaps": [ { "op": "=", "text": "N/A", "value": "null" } ], "valueName": "avg" }, { "cacheTimeout": null, "colorBackground": false, "colorValue": false, "colors": [ "#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a" ], "datasource": "${DS_TESLA}", "format": "amp", "gauge": { "maxValue": 100, "minValue": 0, "show": false, "thresholdLabels": false, "thresholdMarkers": true }, "gridPos": { "h": 2, "w": 3, "x": 21, "y": 0 }, "id": 10, "interval": null, "links": [], "mappingType": 1, "mappingTypes": [ { "name": "value to text", "value": 1 }, { "name": "range to text", "value": 2 } ], "maxDataPoints": 100, "nullPointMode": "connected", "nullText": null, "postfix": "", "postfixFontSize": "50%", "prefix": "", "prefixFontSize": "50%", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "sparkline": { "fillColor": "rgba(31, 118, 189, 0.18)", "full": false, "lineColor": "rgb(31, 120, 193)", "show": false }, "tableColumn": "", "targets": [ { "groupBy": [], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "charger_actual_current" ], "type": "field" }, { "params": [], "type": "last" } ] ], "tags": [ { "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "thresholds": "", "title": "AC Charger Actual Current", "type": "singlestat", "valueFontSize": "80%", "valueMaps": [ { "op": "=", "text": "N/A", "value": "null" } ], "valueName": "avg" }, { "cacheTimeout": null, "colorBackground": false, "colorValue": true, "colors": [ "#e24d42", "#508642", "#e5ac0e" ], "datasource": "${DS_TESLA}", "description": "Voltage supplied by Charger", "format": "volt", "gauge": { "maxValue": 260, "minValue": 0, "show": true, "thresholdLabels": false, "thresholdMarkers": true }, "gridPos": { "h": 5, "w": 4, "x": 0, "y": 2 }, "id": 2, "interval": null, "links": [], "mappingType": 1, "mappingTypes": [ { "name": "value to text", "value": 1 }, { "name": "range to text", "value": 2 } ], "maxDataPoints": 100, "nullPointMode": "connected", "nullText": null, "postfix": "", "postfixFontSize": "50%", "prefix": "", "prefixFontSize": "50%", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "sparkline": { "fillColor": "rgba(31, 118, 189, 0.18)", "full": false, "lineColor": "rgb(31, 120, 193)", "show": false }, "tableColumn": "", "targets": [ { "groupBy": [], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "query": "SELECT last(\"charger_voltage\") FROM \"charge_state\" WHERE (\"display_name\" =~ /^$vehicle_name$/) ", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "charger_voltage" ], "type": "field" }, { "params": [], "type": "last" } ] ], "tags": [ { "key": "metric", "operator": "=", "value": "charger_voltage" }, { "condition": "AND", "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "thresholds": "196,240", "title": "Charger Voltage", "type": "singlestat", "valueFontSize": "80%", "valueMaps": [ { "op": "=", "text": "N/A", "value": "null" } ], "valueName": "current" }, { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, "datasource": "${DS_TESLA}", "fill": 1, "gridPos": { "h": 5, "w": 20, "x": 4, "y": 2 }, "id": 12, "legend": { "avg": false, "current": false, "hideEmpty": false, "hideZero": false, "max": false, "min": false, "show": true, "total": false, "values": false }, "lines": true, "linewidth": 1, "links": [], "nullPointMode": "null", "percentage": false, "pointradius": 5, "points": false, "renderer": "flot", "seriesOverrides": [], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "alias": "charger_voltage", "groupBy": [ { "params": [ "1s" ], "type": "time" }, { "params": [ "previous" ], "type": "fill" } ], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "charger_voltage" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [ { "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "thresholds": [], "timeFrom": null, "timeRegions": [], "timeShift": null, "title": "Charger Voltage", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "buckets": null, "mode": "time", "name": null, "show": true, "values": [] }, "yaxes": [ { "format": "volt", "label": null, "logBase": 1, "max": null, "min": "0", "show": true }, { "format": "short", "label": null, "logBase": 1, "max": null, "min": null, "show": true } ], "yaxis": { "align": false, "alignLevel": null } }, { "cacheTimeout": null, "colorBackground": false, "colorValue": true, "colors": [ "#e24d42", "#e5ac0e", "#508642" ], "datasource": "${DS_TESLA}", "description": "Current Battery Level", "format": "percent", "gauge": { "maxValue": 100, "minValue": 0, "show": true, "thresholdLabels": false, "thresholdMarkers": true }, "gridPos": { "h": 5, "w": 4, "x": 0, "y": 7 }, "id": 14, "interval": null, "links": [], "mappingType": 1, "mappingTypes": [ { "name": "value to text", "value": 1 }, { "name": "range to text", "value": 2 } ], "maxDataPoints": 100, "nullPointMode": "connected", "nullText": null, "postfix": "", "postfixFontSize": "50%", "prefix": "", "prefixFontSize": "50%", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "sparkline": { "fillColor": "rgba(31, 118, 189, 0.18)", "full": false, "lineColor": "rgb(31, 120, 193)", "show": false }, "tableColumn": "", "targets": [ { "groupBy": [], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "battery_level" ], "type": "field" }, { "params": [], "type": "last" } ] ], "tags": [ { "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "thresholds": "8,20", "title": "Battery Level", "type": "singlestat", "valueFontSize": "80%", "valueMaps": [ { "op": "=", "text": "N/A", "value": "null" } ], "valueName": "avg" }, { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, "datasource": "${DS_TESLA}", "fill": 1, "gridPos": { "h": 5, "w": 20, "x": 4, "y": 7 }, "id": 24, "legend": { "avg": false, "current": false, "max": false, "min": false, "show": true, "total": false, "values": false }, "lines": true, "linewidth": 1, "links": [], "nullPointMode": "null", "percentage": false, "pointradius": 5, "points": false, "renderer": "flot", "seriesOverrides": [], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "alias": "battery_level", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "linear" ], "type": "fill" } ], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "query": "SELECT mean(\"battery_level\") FROM \"charge_state\" WHERE (\"display_name\" =~ /^$vehicle_name$/) AND $timeFilter GROUP BY time($__interval) fill(linear)", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "battery_level" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [ { "key": "metric", "operator": "=", "value": "battery_level" }, { "condition": "AND", "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] }, { "alias": "charge_limit_soc", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "previous" ], "type": "fill" } ], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "query": "SELECT mean(\"charge_limit_soc\") FROM \"charge_state\" WHERE (\"display_name\" =~ /^$vehicle_name$/) AND $timeFilter GROUP BY time($__interval) fill(previous)", "rawQuery": true, "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "charge_limit_soc" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [ { "key": "metric", "operator": "=", "value": "charge_limit_soc" }, { "condition": "AND", "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "thresholds": [], "timeFrom": null, "timeRegions": [], "timeShift": null, "title": "Battery Level", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "buckets": null, "mode": "time", "name": null, "show": true, "values": [] }, "yaxes": [ { "decimals": null, "format": "percent", "label": null, "logBase": 1, "max": "100", "min": "0", "show": true }, { "format": "short", "label": null, "logBase": 1, "max": null, "min": null, "show": true } ], "yaxis": { "align": false, "alignLevel": null } }, { "cacheTimeout": null, "colorBackground": false, "colorValue": true, "colors": [ "#e24d42", "#629e51", "#3f6833" ], "datasource": "${DS_TESLA}", "description": "Power supplied by Charger.", "format": "kwatt", "gauge": { "maxValue": 120, "minValue": 0, "show": true, "thresholdLabels": false, "thresholdMarkers": true }, "gridPos": { "h": 5, "w": 4, "x": 0, "y": 12 }, "id": 8, "interval": null, "links": [], "mappingType": 1, "mappingTypes": [ { "name": "value to text", "value": 1 }, { "name": "range to text", "value": 2 } ], "maxDataPoints": 100, "nullPointMode": "connected", "nullText": null, "postfix": "", "postfixFontSize": "50%", "prefix": "", "prefixFontSize": "50%", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "sparkline": { "fillColor": "rgba(31, 118, 189, 0.18)", "full": false, "lineColor": "rgb(31, 120, 193)", "show": false }, "tableColumn": "", "targets": [ { "groupBy": [], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "charger_power" ], "type": "field" }, { "params": [], "type": "last" } ] ], "tags": [ { "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "thresholds": "10,10", "title": "Charger Power", "type": "singlestat", "valueFontSize": "80%", "valueMaps": [ { "op": "=", "text": "N/A", "value": "null" } ], "valueName": "avg" }, { "aliasColors": {}, "bars": false, "dashLength": 10, "dashes": false, "datasource": "${DS_TESLA}", "fill": 1, "gridPos": { "h": 5, "w": 20, "x": 4, "y": 12 }, "id": 26, "legend": { "avg": false, "current": false, "max": false, "min": false, "show": true, "total": false, "values": false }, "lines": true, "linewidth": 1, "links": [], "nullPointMode": "null", "percentage": false, "pointradius": 5, "points": false, "renderer": "flot", "seriesOverrides": [], "spaceLength": 10, "stack": false, "steppedLine": false, "targets": [ { "alias": "charger_power", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "previous" ], "type": "fill" } ], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "charger_power" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [ { "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] }, { "alias": "power", "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "previous" ], "type": "fill" } ], "measurement": "drive_state", "orderByTime": "ASC", "policy": "default", "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "power" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [ { "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "thresholds": [], "timeFrom": null, "timeRegions": [], "timeShift": null, "title": "Chargerpower vs Batterypower", "tooltip": { "shared": true, "sort": 0, "value_type": "individual" }, "type": "graph", "xaxis": { "buckets": null, "mode": "time", "name": null, "show": true, "values": [] }, "yaxes": [ { "format": "kwatt", "label": null, "logBase": 1, "max": null, "min": null, "show": true }, { "format": "short", "label": null, "logBase": 1, "max": null, "min": null, "show": true } ], "yaxis": { "align": false, "alignLevel": null } }, { "backgroundColor": "rgba(128,128,128,0.1)", "colorMaps": [ { "color": "#7EB26D", "text": "Disconnected" }, { "color": "#EAB839", "text": "Starting" }, { "color": "#bf1b00", "text": "Charging" }, { "color": "#EF843C", "text": "Stopped" }, { "color": "#7eb26d", "text": "Complete" }, { "color": "#1F78C1", "text": "NoPower" } ], "crosshairColor": "#8F070C", "datasource": "${DS_TESLA}", "display": "timeline", "expandFromQueryS": 0, "extendLastValue": true, "gridPos": { "h": 4, "w": 20, "x": 4, "y": 17 }, "highlightOnMouseover": true, "id": 28, "legendSortBy": "-ms", "lineColor": "rgba(0,0,0,0.1)", "links": [], "metricNameColor": "#000000", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "rowHeight": 50, "showDistinctCount": false, "showLegend": true, "showLegendNames": false, "showLegendPercent": true, "showLegendValues": true, "showTimeAxis": true, "showTransitionCount": false, "targets": [ { "groupBy": [], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "query": "SELECT \"charging_state\" FROM \"charge_state\" WHERE (\"display_name\" =~ /^$vehicle_name$/) AND $timeFilter-5d", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "charging_state" ], "type": "field" } ] ], "tags": [ { "key": "metric", "operator": "=", "value": "charging_state" }, { "condition": "AND", "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "textSize": 12, "textSizeTime": 12, "timeOptions": [ { "name": "Years", "value": "years" }, { "name": "Months", "value": "months" }, { "name": "Weeks", "value": "weeks" }, { "name": "Days", "value": "days" }, { "name": "Hours", "value": "hours" }, { "name": "Minutes", "value": "minutes" }, { "name": "Seconds", "value": "seconds" }, { "name": "Milliseconds", "value": "milliseconds" } ], "timePrecision": { "name": "Minutes", "value": "minutes" }, "timeTextColor": "#d8d9da", "title": "Charger Events", "type": "natel-discrete-panel", "units": "short", "useTimePrecision": false, "valueMaps": [ { "op": "=", "text": "N/A", "value": "null" } ], "valueTextColor": "#000000", "writeAllValues": true, "writeLastValue": true, "writeMetricNames": false }, { "backgroundColor": "rgba(128,128,128,0.1)", "colorMaps": [ { "color": "#CCC", "text": "N/A" }, { "color": "#7EB26D", "text": "false" }, { "color": "#bf1b00", "text": "true" } ], "crosshairColor": "#8F070C", "datasource": "${DS_TESLA}", "display": "timeline", "expandFromQueryS": 0, "extendLastValue": true, "gridPos": { "h": 4, "w": 20, "x": 4, "y": 21 }, "hideTimeOverride": false, "highlightOnMouseover": true, "id": 34, "legendSortBy": "-ms", "lineColor": "rgba(0,0,0,0.1)", "links": [], "metricNameColor": "#000000", "rangeMaps": [ { "from": "null", "text": "N/A", "to": "null" } ], "rowHeight": 50, "showLegend": true, "showLegendNames": true, "showLegendPercent": true, "showLegendValues": true, "showTimeAxis": true, "targets": [ { "alias": "Battery Heater", "groupBy": [], "measurement": "charge_state", "orderByTime": "ASC", "policy": "default", "query": "SELECT \"battery_heater_on\" FROM \"charge_state\" WHERE (\"display_name\" =~ /^$vehicle_name$/) AND $timeFilter-5d", "rawQuery": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "battery_heater_on" ], "type": "field" } ] ], "tags": [ { "key": "metric", "operator": "=", "value": "battery_heater_on" }, { "condition": "AND", "key": "display_name", "operator": "=~", "value": "/^$vehicle_name$/" } ] } ], "textSize": 24, "textSizeTime": 12, "timeOptions": [ { "name": "Years", "value": "years" }, { "name": "Months", "value": "months" }, { "name": "Weeks", "value": "weeks" }, { "name": "Days", "value": "days" }, { "name": "Hours", "value": "hours" }, { "name": "Minutes", "value": "minutes" }, { "name": "Seconds", "value": "seconds" }, { "name": "Milliseconds", "value": "milliseconds" } ], "timePrecision": { "name": "Minutes", "value": "minutes" }, "timeShift": null, "timeTextColor": "#d8d9da", "title": "Battery Heater", "type": "natel-discrete-panel", "units": "short", "useTimePrecision": false, "valueMaps": [ { "op": "=", "text": "N/A", "value": "null" } ], "valueTextColor": "#000000", "writeAllValues": false, "writeLastValue": true, "writeMetricNames": false } ], "refresh": false, "schemaVersion": 16, "style": "dark", "tags": [ "tesla" ], "templating": { "list": [ { "allValue": null, "current": {}, "datasource": "${DS_TESLA}", "definition": "select distinct(display_name) from (select * from charge_state)", "hide": 0, "includeAll": false, "label": null, "multi": false, "name": "vehicle_name", "options": [], "query": "select distinct(display_name) from (select * from charge_state)", "refresh": 1, "regex": "", "skipUrlSync": false, "sort": 0, "tagValuesQuery": "", "tags": [], "tagsQuery": "", "type": "query", "useTags": false }, { "current": { "value": "${VAR_RANGEUNIT}", "text": "${VAR_RANGEUNIT}" }, "hide": 2, "label": null, "name": "rangeunit", "options": [ { "value": "${VAR_RANGEUNIT}", "text": "${VAR_RANGEUNIT}" } ], "query": "${VAR_RANGEUNIT}", "skipUrlSync": false, "type": "constant" }, { "allValue": null, "current": { "text": "1.60934", "value": "1.60934" }, "hide": 2, "includeAll": false, "label": null, "multi": false, "name": "rangefactor", "options": [ { "selected": true, "text": "1.60934", "value": "1.60934" } ], "query": "1.60934", "skipUrlSync": false, "type": "custom" } ] }, "time": { "from": "now-6h", "to": "now" }, "timepicker": { "refresh_intervals": [ "5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d" ], "time_options": [ "5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d" ] }, "timezone": "", "title": "Charging", "uid": "dNviSBUmk", "version": 141 }
{ "pile_set_name": "Github" }
Ext.define('Redwood.view.Projects', { extend: 'Ext.grid.Panel', alias: 'widget.projectsEditor', store: 'Projects', selType: 'rowmodel', minHeight: 150, manageHeight: true, initComponent: function () { var me = this; this.columns = [ { header: 'Name', dataIndex: 'name', //flex: 1, width: 200 }, { header: 'Language', dataIndex: 'language', //flex: 1, hidden:true, width: 200 }, { xtype: 'actioncolumn', width: 75, items: [ { icon: 'images/edit.png', tooltip: 'Edit', handler: function(grid, rowIndex, colIndex) { me.fireEvent('projectEdit', { rowIndex: rowIndex, colIndex: colIndex }); } }, { icon: 'images/clone.png', tooltip: 'Clone Project', handler: function(grid, rowIndex, colIndex) { me.fireEvent('projectClone', { rowIndex: rowIndex, colIndex: colIndex }); } }, { icon: 'images/delete.png', tooltip: 'Delete', handler: function(grid, rowIndex, colIndex) { me.fireEvent('projectDelete', { rowIndex: rowIndex, colIndex: colIndex }); } } ] } ]; this.dockedItems = [{ xtype: 'toolbar', dock: 'top', items: [ { iconCls: 'icon-add', text: 'Add Project', handler: function(){ me.fireEvent('addProject'); } } ] }]; this.callParent(arguments); } });
{ "pile_set_name": "Github" }
/*********************************************************** Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. 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 OPEN GROUP 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. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /***************************************************************** Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. 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. 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 DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif #include <X11/X.h> #include <X11/Xproto.h> #include <X11/Xprotostr.h> #include "misc.h" #include "regionstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" #include "input.h" #include "dixstruct.h" #include "mi.h" #include <X11/Xmd.h> #include "globals.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" #endif /* machine-independent graphics exposure code. any device that uses the region package can call this. */ #ifndef RECTLIMIT #define RECTLIMIT 25 /* pick a number, any number > 8 */ #endif /* miHandleExposures generate a region for exposures for areas that were copied from obscured or non-existent areas to non-obscured areas of the destination. Paint the background for the region, if the destination is a window. */ RegionPtr miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { RegionPtr prgnSrcClip; /* drawable-relative source clip */ RegionRec rgnSrcRec; RegionPtr prgnDstClip; /* drawable-relative dest clip */ RegionRec rgnDstRec; BoxRec srcBox; /* unclipped source */ RegionRec rgnExposed; /* exposed region, calculated source- relative, made dst relative to intersect with visible parts of dest and send events to client, and then screen relative to paint the window background */ WindowPtr pSrcWin; BoxRec expBox = { 0, }; Bool extents; /* avoid work if we can */ if (!pGC->graphicsExposures && pDstDrawable->type == DRAWABLE_PIXMAP) return NULL; srcBox.x1 = srcx; srcBox.y1 = srcy; srcBox.x2 = srcx + width; srcBox.y2 = srcy + height; if (pSrcDrawable->type != DRAWABLE_PIXMAP) { BoxRec TsrcBox; TsrcBox.x1 = srcx + pSrcDrawable->x; TsrcBox.y1 = srcy + pSrcDrawable->y; TsrcBox.x2 = TsrcBox.x1 + width; TsrcBox.y2 = TsrcBox.y1 + height; pSrcWin = (WindowPtr) pSrcDrawable; if (pGC->subWindowMode == IncludeInferiors) { prgnSrcClip = NotClippedByChildren(pSrcWin); if ((RegionContainsRect(prgnSrcClip, &TsrcBox)) == rgnIN) { RegionDestroy(prgnSrcClip); return NULL; } } else { if ((RegionContainsRect(&pSrcWin->clipList, &TsrcBox)) == rgnIN) return NULL; prgnSrcClip = &rgnSrcRec; RegionNull(prgnSrcClip); RegionCopy(prgnSrcClip, &pSrcWin->clipList); } RegionTranslate(prgnSrcClip, -pSrcDrawable->x, -pSrcDrawable->y); } else { BoxRec box; if ((srcBox.x1 >= 0) && (srcBox.y1 >= 0) && (srcBox.x2 <= pSrcDrawable->width) && (srcBox.y2 <= pSrcDrawable->height)) return NULL; box.x1 = 0; box.y1 = 0; box.x2 = pSrcDrawable->width; box.y2 = pSrcDrawable->height; prgnSrcClip = &rgnSrcRec; RegionInit(prgnSrcClip, &box, 1); pSrcWin = NULL; } if (pDstDrawable == pSrcDrawable) { prgnDstClip = prgnSrcClip; } else if (pDstDrawable->type != DRAWABLE_PIXMAP) { if (pGC->subWindowMode == IncludeInferiors) { prgnDstClip = NotClippedByChildren((WindowPtr) pDstDrawable); } else { prgnDstClip = &rgnDstRec; RegionNull(prgnDstClip); RegionCopy(prgnDstClip, &((WindowPtr) pDstDrawable)->clipList); } RegionTranslate(prgnDstClip, -pDstDrawable->x, -pDstDrawable->y); } else { BoxRec box; box.x1 = 0; box.y1 = 0; box.x2 = pDstDrawable->width; box.y2 = pDstDrawable->height; prgnDstClip = &rgnDstRec; RegionInit(prgnDstClip, &box, 1); } /* drawable-relative source region */ RegionInit(&rgnExposed, &srcBox, 1); /* now get the hidden parts of the source box */ RegionSubtract(&rgnExposed, &rgnExposed, prgnSrcClip); /* move them over the destination */ RegionTranslate(&rgnExposed, dstx - srcx, dsty - srcy); /* intersect with visible areas of dest */ RegionIntersect(&rgnExposed, &rgnExposed, prgnDstClip); /* intersect with client clip region. */ if (pGC->clientClip) RegionIntersect(&rgnExposed, &rgnExposed, pGC->clientClip); /* * If we have LOTS of rectangles, we decide to take the extents * and force an exposure on that. This should require much less * work overall, on both client and server. This is cheating, but * isn't prohibited by the protocol ("spontaneous combustion" :-) * for windows. */ extents = pGC->graphicsExposures && (RegionNumRects(&rgnExposed) > RECTLIMIT) && (pDstDrawable->type != DRAWABLE_PIXMAP); if (pSrcWin) { RegionPtr region; if (!(region = wClipShape(pSrcWin))) region = wBoundingShape(pSrcWin); /* * If you try to CopyArea the extents of a shaped window, compacting the * exposed region will undo all our work! */ if (extents && pSrcWin && region && (RegionContainsRect(region, &srcBox) != rgnIN)) extents = FALSE; } if (extents) { expBox = *RegionExtents(&rgnExposed); RegionReset(&rgnExposed, &expBox); } if ((pDstDrawable->type != DRAWABLE_PIXMAP) && (((WindowPtr) pDstDrawable)->backgroundState != None)) { WindowPtr pWin = (WindowPtr) pDstDrawable; /* make the exposed area screen-relative */ RegionTranslate(&rgnExposed, pDstDrawable->x, pDstDrawable->y); if (extents) { /* PaintWindow doesn't clip, so we have to */ RegionIntersect(&rgnExposed, &rgnExposed, &pWin->clipList); } pDstDrawable->pScreen->PaintWindow((WindowPtr) pDstDrawable, &rgnExposed, PW_BACKGROUND); if (extents) { RegionReset(&rgnExposed, &expBox); } else RegionTranslate(&rgnExposed, -pDstDrawable->x, -pDstDrawable->y); } if (prgnDstClip == &rgnDstRec) { RegionUninit(prgnDstClip); } else if (prgnDstClip != prgnSrcClip) { RegionDestroy(prgnDstClip); } if (prgnSrcClip == &rgnSrcRec) { RegionUninit(prgnSrcClip); } else { RegionDestroy(prgnSrcClip); } if (pGC->graphicsExposures) { /* don't look */ RegionPtr exposed = RegionCreate(NullBox, 0); *exposed = rgnExposed; return exposed; } else { RegionUninit(&rgnExposed); return NULL; } } void miSendExposures(WindowPtr pWin, RegionPtr pRgn, int dx, int dy) { BoxPtr pBox; int numRects; xEvent *pEvent, *pe; int i; pBox = RegionRects(pRgn); numRects = RegionNumRects(pRgn); if (!(pEvent = calloc(1, numRects * sizeof(xEvent)))) return; for (i = numRects, pe = pEvent; --i >= 0; pe++, pBox++) { pe->u.u.type = Expose; pe->u.expose.window = pWin->drawable.id; pe->u.expose.x = pBox->x1 - dx; pe->u.expose.y = pBox->y1 - dy; pe->u.expose.width = pBox->x2 - pBox->x1; pe->u.expose.height = pBox->y2 - pBox->y1; pe->u.expose.count = i; } #ifdef PANORAMIX if (!noPanoramiXExtension) { int scrnum = pWin->drawable.pScreen->myNum; int x = 0, y = 0; XID realWin = 0; if (!pWin->parent) { x = screenInfo.screens[scrnum]->x; y = screenInfo.screens[scrnum]->y; pWin = screenInfo.screens[0]->root; realWin = pWin->drawable.id; } else if (scrnum) { PanoramiXRes *win; win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, scrnum); if (!win) { free(pEvent); return; } realWin = win->info[0].id; dixLookupWindow(&pWin, realWin, serverClient, DixSendAccess); } if (x || y || scrnum) for (i = 0; i < numRects; i++) { pEvent[i].u.expose.window = realWin; pEvent[i].u.expose.x += x; pEvent[i].u.expose.y += y; } } #endif DeliverEvents(pWin, pEvent, numRects, NullWindow); free(pEvent); } void miWindowExposures(WindowPtr pWin, RegionPtr prgn) { RegionPtr exposures = prgn; if (prgn && !RegionNil(prgn)) { RegionRec expRec; int clientInterested = (pWin->eventMask | wOtherEventMasks(pWin)) & ExposureMask; if (clientInterested && (RegionNumRects(prgn) > RECTLIMIT)) { /* * If we have LOTS of rectangles, we decide to take the extents * and force an exposure on that. This should require much less * work overall, on both client and server. This is cheating, but * isn't prohibited by the protocol ("spontaneous combustion" :-). */ BoxRec box = *RegionExtents(prgn); exposures = &expRec; RegionInit(exposures, &box, 1); RegionReset(prgn, &box); /* miPaintWindow doesn't clip, so we have to */ RegionIntersect(prgn, prgn, &pWin->clipList); } pWin->drawable.pScreen->PaintWindow(pWin, prgn, PW_BACKGROUND); if (clientInterested) miSendExposures(pWin, exposures, pWin->drawable.x, pWin->drawable.y); if (exposures == &expRec) RegionUninit(exposures); RegionEmpty(prgn); } } void miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) { ScreenPtr pScreen = pWin->drawable.pScreen; ChangeGCVal gcval[6]; BITS32 gcmask; GCPtr pGC; int i; BoxPtr pbox; xRectangle *prect; int numRects; /* * Distance from screen to destination drawable, use this * to adjust rendering coordinates which come in in screen space */ int draw_x_off, draw_y_off; /* * Tile offset for drawing; these need to align the tile * to the appropriate window origin */ int tile_x_off, tile_y_off; PixUnion fill; Bool solid = TRUE; DrawablePtr drawable = &pWin->drawable; if (what == PW_BACKGROUND) { while (pWin->backgroundState == ParentRelative) pWin = pWin->parent; draw_x_off = drawable->x; draw_y_off = drawable->y; tile_x_off = pWin->drawable.x - draw_x_off; tile_y_off = pWin->drawable.y - draw_y_off; fill = pWin->background; #ifdef COMPOSITE if (pWin->inhibitBGPaint) return; #endif switch (pWin->backgroundState) { case None: return; case BackgroundPixmap: solid = FALSE; break; } } else { PixmapPtr pixmap; fill = pWin->border; solid = pWin->borderIsPixel; /* servers without pixmaps draw their own borders */ if (!pScreen->GetWindowPixmap) return; pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable); drawable = &pixmap->drawable; while (pWin->backgroundState == ParentRelative) pWin = pWin->parent; tile_x_off = pWin->drawable.x; tile_y_off = pWin->drawable.y; #ifdef COMPOSITE draw_x_off = pixmap->screen_x; draw_y_off = pixmap->screen_y; tile_x_off -= draw_x_off; tile_y_off -= draw_y_off; #else draw_x_off = 0; draw_y_off = 0; #endif } gcval[0].val = GXcopy; gcmask = GCFunction; #ifdef ROOTLESS_SAFEALPHA /* Bit mask for alpha channel with a particular number of bits per * pixel. Note that we only care for 32bpp data. Mac OS X uses planar * alpha for 16bpp. */ #define RootlessAlphaMask(bpp) ((bpp) == 32 ? 0xFF000000 : 0) #endif if (solid) { #ifdef ROOTLESS_SAFEALPHA gcval[1].val = fill.pixel | RootlessAlphaMask(pWin->drawable.bitsPerPixel); #else gcval[1].val = fill.pixel; #endif gcval[2].val = FillSolid; gcmask |= GCForeground | GCFillStyle; } else { int c = 1; #ifdef ROOTLESS_SAFEALPHA gcval[c++].val = ((CARD32) -1) & ~RootlessAlphaMask(pWin->drawable.bitsPerPixel); gcmask |= GCPlaneMask; #endif gcval[c++].val = FillTiled; gcval[c++].ptr = (void *) fill.pixmap; gcval[c++].val = tile_x_off; gcval[c++].val = tile_y_off; gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin; } prect = xallocarray(RegionNumRects(prgn), sizeof(xRectangle)); if (!prect) return; pGC = GetScratchGC(drawable->depth, drawable->pScreen); if (!pGC) { free(prect); return; } ChangeGC(NullClient, pGC, gcmask, gcval); ValidateGC(drawable, pGC); numRects = RegionNumRects(prgn); pbox = RegionRects(prgn); for (i = numRects; --i >= 0; pbox++, prect++) { prect->x = pbox->x1 - draw_x_off; prect->y = pbox->y1 - draw_y_off; prect->width = pbox->x2 - pbox->x1; prect->height = pbox->y2 - pbox->y1; } prect -= numRects; (*pGC->ops->PolyFillRect) (drawable, pGC, numRects, prect); free(prect); FreeScratchGC(pGC); } /* MICLEARDRAWABLE -- sets the entire drawable to the background color of * the GC. Useful when we have a scratch drawable and need to initialize * it. */ void miClearDrawable(DrawablePtr pDraw, GCPtr pGC) { ChangeGCVal fg, bg; xRectangle rect; fg.val = pGC->fgPixel; bg.val = pGC->bgPixel; rect.x = 0; rect.y = 0; rect.width = pDraw->width; rect.height = pDraw->height; ChangeGC(NullClient, pGC, GCForeground, &bg); ValidateGC(pDraw, pGC); (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect); ChangeGC(NullClient, pGC, GCForeground, &fg); ValidateGC(pDraw, pGC); }
{ "pile_set_name": "Github" }
tenney engineering inc tny th qtr net shr two cts vs nine cts net vs revs vs mths shr cts vs cts net vs revs mln vs mln reuter
{ "pile_set_name": "Github" }
// <auto-generated /> using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Internal; using SportsStore.Models; using System; namespace SportsStore.Migrations { [DbContext(typeof(ApplicationDbContext))] [Migration("20170816161250_Orders")] partial class Orders { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "2.0.0-rtm-26452") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("SportsStore.Models.CartLine", b => { b.Property<int>("CartLineID") .ValueGeneratedOnAdd(); b.Property<int?>("OrderID"); b.Property<int?>("ProductID"); b.Property<int>("Quantity"); b.HasKey("CartLineID"); b.HasIndex("OrderID"); b.HasIndex("ProductID"); b.ToTable("CartLine"); }); modelBuilder.Entity("SportsStore.Models.Order", b => { b.Property<int>("OrderID") .ValueGeneratedOnAdd(); b.Property<string>("City") .IsRequired(); b.Property<string>("Country") .IsRequired(); b.Property<bool>("GiftWrap"); b.Property<string>("Line1") .IsRequired(); b.Property<string>("Line2"); b.Property<string>("Line3"); b.Property<string>("Name") .IsRequired(); b.Property<string>("State") .IsRequired(); b.Property<string>("Zip"); b.HasKey("OrderID"); b.ToTable("Orders"); }); modelBuilder.Entity("SportsStore.Models.Product", b => { b.Property<int>("ProductID") .ValueGeneratedOnAdd(); b.Property<string>("Category"); b.Property<string>("Description"); b.Property<string>("Name"); b.Property<decimal>("Price"); b.HasKey("ProductID"); b.ToTable("Products"); }); modelBuilder.Entity("SportsStore.Models.CartLine", b => { b.HasOne("SportsStore.Models.Order") .WithMany("Lines") .HasForeignKey("OrderID"); b.HasOne("SportsStore.Models.Product", "Product") .WithMany() .HasForeignKey("ProductID"); }); #pragma warning restore 612, 618 } } }
{ "pile_set_name": "Github" }
#include "php_phalcon.h" #include "phalcon.h" #include <ext/standard/php_smart_string.h> #include <zend_smart_str.h> #include <main/spprintf.h> #include "parser.php7.h" #include "scanner.h" #include "annot.h" #include "kernel/main.h" #include "kernel/exception.h" #define phannot_add_assoc_stringl(var, index, str, len) add_assoc_stringl(var, index, str, len); #define phannot_add_assoc_string(var, index, str) add_assoc_string(var, index, str); static void phannot_ret_literal_zval(zval *ret, int type, phannot_parser_token *T) { array_init(ret); add_assoc_long(ret, "type", type); if (T) { phannot_add_assoc_stringl(ret, "value", T->token, T->token_len); efree(T->token); efree(T); } } static void phannot_ret_array(zval *ret, zval *items) { array_init(ret); add_assoc_long(ret, "type", PHANNOT_T_ARRAY); if (items) { add_assoc_zval(ret, "items", items); } } static void phannot_ret_zval_list(zval *ret, zval *list_left, zval *right_list) { HashTable *list; array_init(ret); if (list_left) { list = Z_ARRVAL_P(list_left); if (zend_hash_index_exists(list, 0)) { { zval *item; ZEND_HASH_FOREACH_VAL(list, item) { Z_TRY_ADDREF_P(item); add_next_index_zval(ret, item); } ZEND_HASH_FOREACH_END(); } zval_dtor(list_left); } else { add_next_index_zval(ret, list_left); } } add_next_index_zval(ret, right_list); } static void phannot_ret_named_item(zval *ret, phannot_parser_token *name, zval *expr) { array_init(ret); add_assoc_zval(ret, "expr", expr); if (name != NULL) { phannot_add_assoc_stringl(ret, "name", name->token, name->token_len); efree(name->token); efree(name); } } static void phannot_ret_annotation(zval *ret, phannot_parser_token *name, zval *arguments, phannot_scanner_state *state) { array_init(ret); add_assoc_long(ret, "type", PHANNOT_T_ANNOTATION); if (name) { phannot_add_assoc_stringl(ret, "name", name->token, name->token_len); efree(name->token); efree(name); } if (arguments) { add_assoc_zval(ret, "arguments", arguments); } phannot_add_assoc_string(ret, "file", (char*) state->active_file); add_assoc_long(ret, "line", state->active_line); }
{ "pile_set_name": "Github" }
// // System.Runtime.Remoting.Metadata.W3cXsd2001.SoapEntity // // Authors: // Martin Willemoes Hansen ([email protected]) // Lluis Sanchez Gual ([email protected]) // // (C) 2003 Martin Willemoes Hansen // // // Copyright (C) 2004 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace System.Runtime.Remoting.Metadata.W3cXsd2001 { [Serializable] [System.Runtime.InteropServices.ComVisible (true)] public sealed class SoapEntity : ISoapXsd { string _value; public SoapEntity () { } public SoapEntity (string value) { _value = SoapHelper.Normalize (value); } public string Value { get { return _value; } set { _value = value; } } public static string XsdType { get { return "ENTITY"; } } public string GetXsdType() { return XsdType; } public static SoapEntity Parse (string value) { return new SoapEntity (value); } public override string ToString() { return _value; } } }
{ "pile_set_name": "Github" }
#pragma once #include "SFAvroProtocol.h" class ProtocolAvroProtocol : public SFAvroProtocol { public: ProtocolAvroProtocol(); virtual ~ProtocolAvroProtocol(); virtual BasePacket* CreateIncomingPacketFromPacketId(int packetId) override; };
{ "pile_set_name": "Github" }
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ // **NOTE** This file was generated by a tool and any changes will be overwritten. // <auto-generated/> // Template Source: Templates\CSharp\Requests\MethodRequest.cs.tt namespace Microsoft.Graph { using System; using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Threading; /// <summary> /// The type WorkbookFunctionsCothRequest. /// </summary> public partial class WorkbookFunctionsCothRequest : BaseRequest, IWorkbookFunctionsCothRequest { /// <summary> /// Constructs a new WorkbookFunctionsCothRequest. /// </summary> public WorkbookFunctionsCothRequest( string requestUrl, IBaseClient client, IEnumerable<Option> options) : base(requestUrl, client, options) { this.ContentType = "application/json"; this.RequestBody = new WorkbookFunctionsCothRequestBody(); } /// <summary> /// Gets the request body. /// </summary> public WorkbookFunctionsCothRequestBody RequestBody { get; private set; } /// <summary> /// Issues the POST request. /// </summary> public System.Threading.Tasks.Task<WorkbookFunctionResult> PostAsync() { return this.PostAsync(CancellationToken.None); } /// <summary> /// Issues the POST request. /// </summary> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The task to await for async call.</returns> public System.Threading.Tasks.Task<WorkbookFunctionResult> PostAsync( CancellationToken cancellationToken) { this.Method = "POST"; return this.SendAsync<WorkbookFunctionResult>(this.RequestBody, cancellationToken); } /// <summary> /// Adds the specified expand value to the request. /// </summary> /// <param name="value">The expand value.</param> /// <returns>The request object to send.</returns> public IWorkbookFunctionsCothRequest Expand(string value) { this.QueryOptions.Add(new QueryOption("$expand", value)); return this; } /// <summary> /// Adds the specified select value to the request. /// </summary> /// <param name="value">The select value.</param> /// <returns>The request object to send.</returns> public IWorkbookFunctionsCothRequest Select(string value) { this.QueryOptions.Add(new QueryOption("$select", value)); return this; } } }
{ "pile_set_name": "Github" }
/************************************************************************** ** This file is part of LiteIDE ** ** Copyright (c) 2011-2019 LiteIDE. All rights reserved. ** ** This library 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.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** In addition, as a special exception, that plugins developed for LiteIDE, ** are allowed to remain closed sourced and can be distributed under any license . ** These rights are included in the file LGPL_EXCEPTION.txt in this package. ** **************************************************************************/ // Module: finddocwidget.cpp // Creator: visualfc <[email protected]> #include "finddocwidget.h" #include "liteenvapi/liteenvapi.h" #include "golangdoc_global.h" #include <QVBoxLayout> #include <QHBoxLayout> #include <QLabel> #include <QToolButton> #include <QActionGroup> #include <QAction> #include <QCoreApplication> #include <QPlainTextEdit> #include <QTextBrowser> //lite_memory_check_begin #if defined(WIN32) && defined(_MSC_VER) && defined(_DEBUG) #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> #define DEBUG_NEW new( _NORMAL_BLOCK, __FILE__, __LINE__ ) #define new DEBUG_NEW #endif //lite_memory_check_end static char help[] = "<b>Search Format</b>" "<pre>" "fmt.\n" " Extracts all fmt pkg symbol document\n" "fmt.Println or fmt Println\n" " Extracts fmt.Println document\n" "fmt.Print or fmt Print\n" " Extracts fmt.Print fmt.Printf fmt.Println etc\n" "Println\n" " Extracts fmt.Println log.Println log.Logger.Println etc" "</pre>" "<b>Search Option</b>" "<pre>" "Match Word.\n" " Match whole world only\n" "Match Case\n" " Match case sensitive\n" "Use Regexp\n" " Use regexp for search\n" " example fmt p.*\n" "</pre>" ; class SearchEdit : public Utils::FancyLineEdit { Q_DECLARE_TR_FUNCTIONS(SearchEdit) public: SearchEdit(QWidget *parent = 0) : Utils::FancyLineEdit(parent) { QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ? QLatin1String("edit-clear-locationbar-rtl") : QLatin1String("edit-clear-locationbar-ltr"), QIcon::fromTheme(QLatin1String("edit-clear"), QIcon(QLatin1String("icon:images/editclear.png")))); setButtonPixmap(Right, icon.pixmap(16)); setPlaceholderText(tr("Search")); setButtonToolTip(Right, tr("Stop Search")); } void showStopButton(bool b) { this->setButtonVisible(Right,b); } }; FindDocWidget::FindDocWidget(LiteApi::IApplication *app, QWidget *parent) : QWidget(parent), m_liteApp(app) { m_findEdit = new SearchEdit; m_findEdit->setPlaceholderText(tr("Search")); m_chaseWidget = new ChaseWidget; m_chaseWidget->setMinimumSize(QSize(16,16)); m_chaseWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); QToolButton *findBtn = new QToolButton; findBtn->setPopupMode(QToolButton::InstantPopup); findBtn->setText(tr("Find")); QHBoxLayout *findLayout = new QHBoxLayout; findLayout->setMargin(2); findLayout->addWidget(m_findEdit); findLayout->addWidget(findBtn); findLayout->addWidget(m_chaseWidget); m_browser = m_liteApp->htmlWidgetManager()->createByName(this,"QTextBrowser"); QStringList paths; paths << m_liteApp->resourcePath()+"/packages/go/godoc"; m_browser->setSearchPaths(paths); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setMargin(1); mainLayout->setSpacing(1); mainLayout->addLayout(findLayout); mainLayout->addWidget(m_browser->widget()); QAction *findAll = new QAction(tr("Find All"),this); QAction *findConst = new QAction(tr("Find const"),this); findConst->setData("const"); QAction *findFunc = new QAction(tr("Find func"),this); findFunc->setData("func"); QAction *findInterface = new QAction(tr("Find interface"),this); findInterface->setData("interface"); QAction *findPkg = new QAction(tr("Find pkg"),this); findPkg->setData("pkg"); QAction *findStruct = new QAction(tr("Find struct"),this); findStruct->setData("struct"); QAction *findType = new QAction(tr("Find type"),this); findType->setData("type"); QAction *findVar = new QAction(tr("Find var"),this); findVar->setData("var"); m_useRegexpCheckAct = new QAction(tr("Use Regexp"),this); m_useRegexpCheckAct->setCheckable(true); m_matchCaseCheckAct = new QAction(tr("Match Case"),this); m_matchCaseCheckAct->setCheckable(true); m_matchWordCheckAct = new QAction(tr("Match Word"),this); m_matchWordCheckAct->setCheckable(true); m_useRegexpCheckAct->setChecked(m_liteApp->settings()->value(GODOCFIND_USEREGEXP,false).toBool()); m_matchCaseCheckAct->setChecked(m_liteApp->settings()->value(GODOCFIND_MATCHCASE,true).toBool()); m_matchWordCheckAct->setChecked(m_liteApp->settings()->value(GODOCFIND_MATCHWORD,false).toBool()); QMenu *menu = new QMenu(findBtn); menu->addActions(QList<QAction*>() << findAll //<< findPkg ); menu->addSeparator(); menu->addActions(QList<QAction*>() << findInterface << findStruct << findType << findFunc << findConst << findVar ); menu->addSeparator(); menu->addAction(m_matchWordCheckAct); menu->addAction(m_matchCaseCheckAct); menu->addAction(m_useRegexpCheckAct); findBtn->setMenu(menu); QAction *helpAct = new QAction(tr("Help"),this); menu->addSeparator(); menu->addAction(helpAct); connect(helpAct,SIGNAL(triggered()),this,SLOT(showHelp())); this->setLayout(mainLayout); connect(findAll,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findConst,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findFunc,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findInterface,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findPkg,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findStruct,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findType,SIGNAL(triggered()),this,SLOT(findDoc())); connect(findVar,SIGNAL(triggered()),this,SLOT(findDoc())); m_process = new ProcessEx(this); connect(m_process,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(stateChanged(QProcess::ProcessState))); connect(m_process,SIGNAL(extOutput(QByteArray,bool)),this,SLOT(extOutput(QByteArray,bool))); connect(m_process,SIGNAL(extFinish(bool,int,QString)),this,SLOT(extFinish(bool,int,QString))); connect(m_findEdit,SIGNAL(returnPressed()),findAll,SIGNAL(triggered())); connect(m_findEdit,SIGNAL(rightButtonClicked()),this,SLOT(abortFind())); connect(m_browser,SIGNAL(linkClicked(QUrl)),this,SLOT(openUrl(QUrl))); QString path = m_liteApp->resourcePath()+"/packages/go/godoc/finddoc.html"; QFile file(path); if (file.open(QIODevice::ReadOnly)) { m_templateData = file.readAll(); file.close(); } //QFont font = m_browser->widget()->font(); //font.setPointSize(12); //m_browser->widget()->setFont(font); showHelp(); } FindDocWidget::~FindDocWidget() { m_liteApp->settings()->setValue(GODOCFIND_MATCHCASE,m_matchCaseCheckAct->isChecked()); m_liteApp->settings()->setValue(GODOCFIND_MATCHWORD,m_matchWordCheckAct->isChecked()); m_liteApp->settings()->setValue(GODOCFIND_USEREGEXP,m_useRegexpCheckAct->isChecked()); abortFind(); delete m_process; } void FindDocWidget::findDoc() { QAction *act = (QAction*)sender(); QString text = m_findEdit->text().trimmed(); if (text.isEmpty()) { return; } QString findFlag = act->data().toString(); abortFind(); QStringList args; args << "finddoc" << "-urltag" << "<liteide_doc>"; if (m_matchWordCheckAct->isChecked()) { args << "-word"; } if (m_matchCaseCheckAct->isChecked()) { args << "-case"; } if (m_useRegexpCheckAct->isChecked()) { args << "-r"; } if (!findFlag.isEmpty()) { args << "-"+findFlag; } args << text.split(" "); m_browser->clear(); m_findFlag = findFlag; m_htmlData.clear(); QString cmd = LiteApi::getGotools(m_liteApp); m_process->setEnvironment(LiteApi::getGoEnvironment(m_liteApp).toStringList()); m_process->start(cmd,args); } struct doc_comment { QString url; QString file; QStringList comment; }; void FindDocWidget::extOutput(QByteArray data, bool error) { if (error) { m_liteApp->appendLog("FindDoc",QString::fromUtf8(data),false); return; } /* http://golang.org/pkg\fmt\#Println c:\go\src\pkg\log\log.go:169: // Println calls l.Output to print to the logger. // Arguments are handled in the manner of fmt.Println. func (l *Logger) Println(v ...interface{}) http://godoc.org\code.google.com\p\go.tools\cmd\vet\#Println F:\vfc\liteide-git\liteidex\src\code.google.com\p\go.tools\cmd\vet\main.go:375: // Println is fmt.Println guarded by -v. func Println(args ...interface{}) */ QList<doc_comment> dc_array; doc_comment dc; int flag = 0; foreach (QString line, QString::fromUtf8(data).split("\n")) { if (line.startsWith("<liteide_doc>")) { flag = 1; if (!dc.url.isEmpty()) { dc_array.push_back(dc); } dc.url = line.mid(13); dc.file.clear(); dc.comment.clear(); continue; } if (flag == 1) { dc.file = line; flag = 2; continue; } if (flag == 2) { dc.comment.push_back(line); } } if (!dc.url.isEmpty()) { dc_array.push_back(dc); } QStringList array; foreach (doc_comment dc, dc_array) { array.append(docToHtml(dc.url,dc.file,dc.comment)); } // qDebug() << array.join("\n"); // if (m_findFlag == "pkg") { // array = parserPkgDoc(QString::fromUtf8(data)); // } else { // array = parserDoc(QString::fromUtf8(data)); // } m_htmlData.append(array.join("\n")); QString html = m_templateData; html.replace("{content}",m_htmlData); int pos = m_browser->scrollBarValue(Qt::Vertical); m_browser->setHtml(html,QUrl()); m_browser->setScrollBarValue(Qt::Vertical,pos); } void FindDocWidget::extFinish(bool, int, QString) { if (m_htmlData.isEmpty()) { QString html = m_templateData; html.replace("{content}","<b>Not found!</b>"); m_browser->setHtml(html,QUrl()); } m_htmlData.clear(); } void FindDocWidget::abortFind() { m_process->stop(100); } void FindDocWidget::stateChanged(QProcess::ProcessState state) { m_chaseWidget->setAnimated(state == QProcess::Running); m_findEdit->showStopButton(state == QProcess::Running); } void FindDocWidget::openUrl(QUrl url) { if (!url.isLocalFile()) { return; } QString text = url.toLocalFile(); QRegExp rep("(\\w?\\:?[\\w\\d\\_\\-\\\\/\\.]+):(\\d+):"); int index = rep.indexIn(text); if (index < 0) return; QStringList capList = rep.capturedTexts(); if (capList.count() < 3) return; QString fileName = capList[1]; QString fileLine = capList[2]; bool ok = false; int line = fileLine.toInt(&ok); if (!ok) return; LiteApi::IEditor *editor = m_liteApp->fileManager()->openEditor(fileName,true); if (editor) { LiteApi::ITextEditor *textEditor = LiteApi::getTextEditor(editor); if (textEditor) { textEditor->gotoLine(line-1,0,true); } } } void FindDocWidget::showHelp() { QString data = m_templateData; data.replace("{content}",help); m_browser->setHtml(data,QUrl()); } static QString escape(const QString &text) { #if QT_VERSION >= 0x050000 return QString(text).toHtmlEscaped(); #else return Qt::escape(text); #endif } QStringList FindDocWidget::docToHtml(const QString &url, const QString &file, const QStringList &comment) { QString sz; QString pkgName; QString findName; if (url.startsWith("http://golang.org/pkg")) { sz = url.mid(21); } else if (url.startsWith("http://golang.org/cmd")) { sz = url.mid(21); } else if (url.startsWith("http://godoc.org")) { sz = url.mid(16); } //\code.google.com\p\go.tools\cmd\vet\#Println int pos = sz.indexOf("#"); if (pos != -1) { pkgName = QDir::fromNativeSeparators(sz.left(pos)); if (pkgName.startsWith("/")) { pkgName = pkgName.mid(1); } if (pkgName.endsWith("/")) { pkgName = pkgName.left(pkgName.length()-1); } findName = sz.mid(pos+1); } QStringList array; array.push_back(QString("<h4><b>%2</b>&nbsp;&nbsp;<a href=\"file:%1\">%3</a></h4>") .arg(QDir::fromNativeSeparators(escape(file))).arg(pkgName).arg(findName)); if (!comment.isEmpty() && ( comment.first().startsWith("const (") || comment.first().startsWith("var (")) ) { array.push_back("<pre>"); QString head = "const "; if (comment.first().startsWith("var (")) { head = "var "; } QStringList incmd; foreach (QString sz, comment) { if (sz.trimmed().startsWith("//")) { incmd.push_back(escape(sz.trimmed())); } else if (sz.indexOf(findName) >= 0) { array.append(incmd); array.push_back(escape(head+sz.replace("\t"," ").trimmed())); } else { incmd.clear(); } } array.push_back("</pre>"); return array; } int flag = 0; QString lastTag; foreach (QString sz, comment) { if (sz.startsWith("//")) { if (flag != 1) { if (!lastTag.isEmpty()) array.push_back(lastTag); array.push_back("<p>"); lastTag = "</p>"; } flag = 1; if (sz.mid(2).trimmed().isEmpty()) { array.push_back("</p><p>"); } else { array.push_back(escape(sz.mid(2))); } } else { if (sz.trimmed().isEmpty()) { continue; } if (flag != 3) { if (!lastTag.isEmpty()) array.push_back(lastTag); array.push_back("<pre>"); lastTag = "</pre>"; } flag = 3; array.push_back(escape(sz.replace("\t"," "))); } } if (!lastTag.isEmpty()) array.push_back(lastTag); array.push_back("<p></p>"); return array; } QStringList FindDocWidget::parserDoc(QString findText) { QStringList array; int lastFlag = 0; QString findName; QString findPos; QString findComment; foreach (QString sz, findText.split('\n')) { int flag = 0; if (sz.startsWith("http://golang.org/pkg")) { flag = 1; sz = sz.mid(21); } else if (sz.startsWith("http://golang.org/cmd")) { flag = 1; sz = sz.mid(21); } else if (sz.startsWith("http://godoc.org")) { flag = 1; sz = sz.mid(16); } else if (sz.startsWith("//")) { flag = 2; sz = sz.mid(2); } else if (sz.isEmpty()) { flag = 4; } else { flag = 3; } if (flag == 1) { //\code.google.com\p\go.tools\cmd\vet\#Println int pos = sz.indexOf("#"); if (pos != -1) { QString pkg = sz.left(pos); pkg = QDir::fromNativeSeparators(pkg); if (pkg.startsWith("/")) { pkg = pkg.mid(1); } if (pkg.endsWith("/")) { pkg = pkg.left(pkg.length()-1); } sz = pkg+sz.mid(pos); findName = sz; } else { QString pkg = sz; pkg = QDir::fromNativeSeparators(pkg); if (pkg.startsWith("/")) { pkg = pkg.mid(1); } if (pkg.endsWith("/")) { pkg = pkg.left(pkg.length()-1); } findName = pkg; } } else if (flag == 3) { if (lastFlag == 1) { findPos = "file:"+sz; array.push_back(QString("<h3><a href=\"%1\">%2</a></h3>").arg(findPos).arg(findName)); } else { array.push_back(QString("<b>%1</b>").arg(sz)); if (!findComment.isEmpty()) { array.push_back(QString("<p>%1</p>").arg(findComment)); } findComment.clear(); } } else if (flag == 2) { findComment += sz.trimmed(); } else if (flag == 4) { } lastFlag = flag; } return array; } QStringList FindDocWidget::parserPkgDoc(QString findText) { QStringList array; int lastFlag = 0; QString findName; QString findPos; QString findComment; bool bHead = false; foreach (QString sz, findText.split('\n')) { int flag = 0; if (sz.startsWith("http://golang.org/pkg")) { flag = 1; sz = sz.mid(21); } else if (sz.startsWith("http://golang.org/cmd")) { flag = 1; sz = sz.mid(21); } else if (sz.startsWith("http://godoc.org")) { flag = 1; sz = sz.mid(16); } else { flag = 3; } if (flag == 1) { bHead = false; } if (bHead) { // findComment.append(sz+"\n"); if (sz.startsWith("\t\t")) { flag = 5; } else if (sz.trimmed().isEmpty()){ flag = 6; } else { flag = 7; } sz.replace("\t"," "); if (lastFlag != flag && !findComment.isEmpty()) { if (lastFlag == 5) { array.push_back(QString("<pre>%1</pre>").arg(findComment)); } else { array.push_back(QString("<p>%1</p>").arg(findComment)); } findComment.clear(); } if (flag == 5) { findComment += sz.trimmed()+"\n"; } else { findComment += sz.trimmed(); } lastFlag = flag; continue; } if (flag == 1) { //\code.google.com\p\go.tools\cmd\vet\#Println int pos = sz.indexOf("#"); if (pos != -1) { QString pkg = sz.left(pos); pkg = QDir::fromNativeSeparators(pkg); if (pkg.startsWith("/")) { pkg = pkg.mid(1); } if (pkg.endsWith("/")) { pkg = pkg.left(pkg.length()-1); } sz = pkg+sz.mid(pos); findName = sz; } else { QString pkg = sz; pkg = QDir::fromNativeSeparators(pkg); if (pkg.startsWith("/")) { pkg = pkg.mid(1); } if (pkg.endsWith("/")) { pkg = pkg.left(pkg.length()-1); } findName = pkg; } } else if (flag == 3) { if (lastFlag == 1) { findPos = "file:"+sz; array.push_back(QString("<h3><a href=\"%1\">%2</a></h3>").arg(findPos).arg(findName)); bHead = true; } } else if (flag == 2) { findComment += sz.trimmed(); } lastFlag = flag; } if (!findComment.isEmpty()) { if (lastFlag == 5) { array.push_back(QString("<pre>%1</pre>").arg(findComment)); } else { array.push_back(QString("<p>%1</p>").arg(findComment)); } } return array; }
{ "pile_set_name": "Github" }
/** * This header is generated by class-dump-z 0.2b. * * Source: /System/Library/PrivateFrameworks/SportsWorkout.framework/SportsWorkout */ #import <SportsWorkout/XXUnknownSuperclass.h> @class NSMutableDictionary, NSDictionary, NSString; @interface SWWorkout : XXUnknownSuperclass { NSString *_workoutState; // 4 = 0x4 NSMutableDictionary *_workoutData; // 8 = 0x8 double _timeOfLastActivation; // 12 = 0xc double _elapsedTimePreviousToLastActivation; // 20 = 0x14 } @property(readonly, assign, nonatomic) NSDictionary *workoutData; // G=0xed7d; @property(readonly, assign, nonatomic) NSString *workoutState; // G=0xee55; @synthesize=_workoutState // declared property getter: - (id)workoutState; // 0xee55 - (void)pauseWorkout; // 0xedfd - (void)activateWorkout; // 0xedb5 // declared property getter: - (id)workoutData; // 0xed7d - (double)getElapsedTimeInSeconds; // 0xed15 - (void)dealloc; // 0xecc1 - (id)init; // 0xebed @end
{ "pile_set_name": "Github" }
<?php namespace Oro\Bundle\RedirectBundle\Tests\Unit\EventListener; use Oro\Bundle\RedirectBundle\EventListener\RedirectExceptionListener; use Oro\Bundle\RedirectBundle\Routing\MatchedUrlDecisionMaker; use Oro\Bundle\RedirectBundle\Routing\SlugRedirectMatcher; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; class RedirectExceptionListenerTest extends \PHPUnit\Framework\TestCase { /** @var SlugRedirectMatcher|\PHPUnit\Framework\MockObject\MockObject */ private $redirectMatcher; /** @var MatchedUrlDecisionMaker|\PHPUnit\Framework\MockObject\MockObject */ private $matchedUrlDecisionMaker; /** @var RedirectExceptionListener */ private $listener; protected function setUp(): void { $this->redirectMatcher = $this->createMock(SlugRedirectMatcher::class); $this->matchedUrlDecisionMaker = $this->createMock(MatchedUrlDecisionMaker::class); $this->listener = new RedirectExceptionListener( $this->redirectMatcher, $this->matchedUrlDecisionMaker ); } /** * @param Request $request * @param bool $isMaster * @param \Exception $exception * * @return GetResponseForExceptionEvent */ private function getEvent(Request $request, $isMaster, \Exception $exception) { return new GetResponseForExceptionEvent( $this->createMock(HttpKernelInterface::class), $request, $isMaster ? HttpKernelInterface::MASTER_REQUEST : HttpKernelInterface::SUB_REQUEST, $exception ); } public function testOnKernelExceptionForNotMasterRequest() { $event = $this->getEvent(Request::create('/test'), false, new NotFoundHttpException()); $this->matchedUrlDecisionMaker->expects($this->never()) ->method('matches'); $this->listener->onKernelException($event); $this->assertFalse($event->hasResponse()); } public function testOnKernelExceptionWhenResponseAlreadySet() { $event = $this->getEvent(Request::create('/test'), true, new NotFoundHttpException()); $response = $this->createMock(Response::class); $event->setResponse($response); $this->matchedUrlDecisionMaker->expects($this->never()) ->method('matches'); $this->listener->onKernelException($event); $this->assertSame($response, $event->getResponse()); } public function testOnKernelExceptionForUnsupportedException() { $event = $this->getEvent(Request::create('/test'), true, new \Exception()); $this->matchedUrlDecisionMaker->expects($this->never()) ->method('matches'); $this->listener->onKernelException($event); $this->assertFalse($event->hasResponse()); } public function testOnKernelExceptionWhenUrlIsNotMatched() { $event = $this->getEvent(Request::create('/test'), true, new NotFoundHttpException()); $this->matchedUrlDecisionMaker->expects($this->once()) ->method('matches') ->willReturn(false); $this->listener->onKernelException($event); $this->assertFalse($event->hasResponse()); } public function testOnKernelExceptionWhenNoRedirect() { $event = $this->getEvent(Request::create('/test'), true, new NotFoundHttpException()); $this->matchedUrlDecisionMaker->expects($this->once()) ->method('matches') ->with('/test') ->willReturn(true); $this->redirectMatcher->expects($this->once()) ->method('match') ->with('/test') ->willReturn(null); $this->listener->onKernelException($event); $this->assertFalse($event->hasResponse()); } public function testOnKernelExceptionForRedirect() { $event = $this->getEvent(Request::create('/test'), true, new NotFoundHttpException()); $this->matchedUrlDecisionMaker->expects($this->once()) ->method('matches') ->with('/test') ->willReturn(true); $this->redirectMatcher->expects($this->once()) ->method('match') ->with('/test') ->willReturn(['pathInfo' => '/test-new', 'statusCode' => 301]); $this->listener->onKernelException($event); $this->assertInstanceOf(RedirectResponse::class, $event->getResponse()); /** @var RedirectResponse $response */ $response = $event->getResponse(); $this->assertEquals('/test-new', $response->getTargetUrl()); $this->assertSame(301, $response->getStatusCode()); } public function testOnKernelExceptionForRedirectWithBaseUrl() { $request = Request::create('/index.php/test'); $request->server->set('SCRIPT_FILENAME', 'index.php'); $request->server->set('SCRIPT_NAME', 'index.php'); $event = $this->getEvent($request, true, new NotFoundHttpException()); $this->matchedUrlDecisionMaker->expects($this->once()) ->method('matches') ->with('/test') ->willReturn(true); $this->redirectMatcher->expects($this->once()) ->method('match') ->with('/test') ->willReturn(['pathInfo' => '/test-new', 'statusCode' => 301]); $this->listener->onKernelException($event); $this->assertInstanceOf(RedirectResponse::class, $event->getResponse()); /** @var RedirectResponse $response */ $response = $event->getResponse(); $this->assertEquals('/index.php/test-new', $response->getTargetUrl()); $this->assertSame(301, $response->getStatusCode()); } }
{ "pile_set_name": "Github" }
{ "tests": { "include": [ "./src/tests/**/*" ] } }
{ "pile_set_name": "Github" }
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "kang\u2019ama", "kingoto" ], "DAY": [ "Ijumapili", "Ijumatatu", "Ijumanne", "Ijumatano", "Alhamisi", "Ijumaa", "Ijumamosi" ], "ERANAMES": [ "Kabla ya Mayesu", "Baada ya Mayesu" ], "ERAS": [ "KM", "BM" ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "Mweri wa kwanza", "Mweri wa kaili", "Mweri wa katatu", "Mweri wa kaana", "Mweri wa tanu", "Mweri wa sita", "Mweri wa saba", "Mweri wa nane", "Mweri wa tisa", "Mweri wa ikumi", "Mweri wa ikumi na moja", "Mweri wa ikumi na mbili" ], "SHORTDAY": [ "Ijp", "Ijt", "Ijn", "Ijtn", "Alh", "Iju", "Ijm" ], "SHORTMONTH": [ "M1", "M2", "M3", "M4", "M5", "M6", "M7", "M8", "M9", "M10", "M11", "M12" ], "STANDALONEMONTH": [ "Mweri wa kwanza", "Mweri wa kaili", "Mweri wa katatu", "Mweri wa kaana", "Mweri wa tanu", "Mweri wa sita", "Mweri wa saba", "Mweri wa nane", "Mweri wa tisa", "Mweri wa ikumi", "Mweri wa ikumi na moja", "Mweri wa ikumi na mbili" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "EEEE, d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y HH:mm:ss", "mediumDate": "d MMM y", "mediumTime": "HH:mm:ss", "short": "dd/MM/y HH:mm", "shortDate": "dd/MM/y", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "TSh", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-\u00a4", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "rof", "localeID": "rof", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
{ "pile_set_name": "Github" }
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>EVP_PKEY_print_private</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rev="made" href="mailto:" /> </head> <body> <ul id="index"> <li><a href="#NAME">NAME</a></li> <li><a href="#SYNOPSIS">SYNOPSIS</a></li> <li><a href="#DESCRIPTION">DESCRIPTION</a></li> <li><a href="#NOTES">NOTES</a></li> <li><a href="#RETURN-VALUES">RETURN VALUES</a></li> <li><a href="#SEE-ALSO">SEE ALSO</a></li> <li><a href="#HISTORY">HISTORY</a></li> <li><a href="#COPYRIGHT">COPYRIGHT</a></li> </ul> <h1 id="NAME">NAME</h1> <p>EVP_PKEY_print_public, EVP_PKEY_print_private, EVP_PKEY_print_params - public key algorithm printing routines</p> <h1 id="SYNOPSIS">SYNOPSIS</h1> <pre><code> <span class="comment">#include &lt;openssl/evp.h&gt;</span> <span class="keyword">int</span> <span class="variable">EVP_PKEY_print_public</span><span class="operator">(</span><span class="variable">BIO</span> <span class="variable">*out</span><span class="operator">,</span> <span class="variable">const</span> <span class="variable">EVP_PKEY</span> <span class="variable">*pkey</span><span class="operator">,</span> <span class="keyword">int</span> <span class="variable">indent</span><span class="operator">,</span> <span class="variable">ASN1_PCTX</span> <span class="variable">*pctx</span><span class="operator">);</span> <span class="keyword">int</span> <span class="variable">EVP_PKEY_print_private</span><span class="operator">(</span><span class="variable">BIO</span> <span class="variable">*out</span><span class="operator">,</span> <span class="variable">const</span> <span class="variable">EVP_PKEY</span> <span class="variable">*pkey</span><span class="operator">,</span> <span class="keyword">int</span> <span class="variable">indent</span><span class="operator">,</span> <span class="variable">ASN1_PCTX</span> <span class="variable">*pctx</span><span class="operator">);</span> <span class="keyword">int</span> <span class="variable">EVP_PKEY_print_params</span><span class="operator">(</span><span class="variable">BIO</span> <span class="variable">*out</span><span class="operator">,</span> <span class="variable">const</span> <span class="variable">EVP_PKEY</span> <span class="variable">*pkey</span><span class="operator">,</span> <span class="keyword">int</span> <span class="variable">indent</span><span class="operator">,</span> <span class="variable">ASN1_PCTX</span> <span class="variable">*pctx</span><span class="operator">);</span> </code></pre> <h1 id="DESCRIPTION">DESCRIPTION</h1> <p>The functions EVP_PKEY_print_public(), EVP_PKEY_print_private() and EVP_PKEY_print_params() print out the public, private or parameter components of key <b>pkey</b> respectively. The key is sent to BIO <b>out</b> in human readable form. The parameter <b>indent</b> indicated how far the printout should be indented.</p> <p>The <b>pctx</b> parameter allows the print output to be finely tuned by using ASN1 printing options. If <b>pctx</b> is set to NULL then default values will be used.</p> <h1 id="NOTES">NOTES</h1> <p>Currently no public key algorithms include any options in the <b>pctx</b> parameter.</p> <p>If the key does not include all the components indicated by the function then only those contained in the key will be printed. For example passing a public key to EVP_PKEY_print_private() will only print the public components.</p> <h1 id="RETURN-VALUES">RETURN VALUES</h1> <p>These functions all return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.</p> <h1 id="SEE-ALSO">SEE ALSO</h1> <p><a href="../man3/EVP_PKEY_CTX_new.html">EVP_PKEY_CTX_new(3)</a>, <a href="../man3/EVP_PKEY_keygen.html">EVP_PKEY_keygen(3)</a></p> <h1 id="HISTORY">HISTORY</h1> <p>These functions were added in OpenSSL 1.0.0.</p> <h1 id="COPYRIGHT">COPYRIGHT</h1> <p>Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved.</p> <p>Licensed under the OpenSSL license (the &quot;License&quot;). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p> </body> </html>
{ "pile_set_name": "Github" }
/* Highcharts JS v3.0.6 (2013-10-04) Plugin for displaying a message when there is no data visible in chart. (c) 2010-2013 Highsoft AS Author: Øystein Moseng License: www.highcharts.com/license */ (function(c){function f(){return!!this.points.length}function g(){this.hasData()?this.hideNoData():this.showNoData()}var d=c.seriesTypes,e=c.Chart.prototype,h=c.getOptions(),i=c.extend;i(h.lang,{noData:"No data to display"});h.noData={position:{x:0,y:0,align:"center",verticalAlign:"middle"},attr:{},style:{fontWeight:"bold",fontSize:"12px",color:"#60606a"}};d.pie.prototype.hasData=f;if(d.gauge)d.gauge.prototype.hasData=f;if(d.waterfall)d.waterfall.prototype.hasData=f;c.Series.prototype.hasData=function(){return this.dataMax!== void 0&&this.dataMin!==void 0};e.showNoData=function(a){var b=this.options,a=a||b.lang.noData,b=b.noData;if(!this.noDataLabel)this.noDataLabel=this.renderer.label(a,0,0,null,null,null,null,null,"no-data").attr(b.attr).css(b.style).add(),this.noDataLabel.align(i(this.noDataLabel.getBBox(),b.position),!1,"plotBox")};e.hideNoData=function(){if(this.noDataLabel)this.noDataLabel=this.noDataLabel.destroy()};e.hasData=function(){for(var a=this.series,b=a.length;b--;)if(a[b].hasData()&&!a[b].options.isInternal)return!0; return!1};e.callbacks.push(function(a){c.addEvent(a,"load",g);c.addEvent(a,"redraw",g)})})(Highcharts);
{ "pile_set_name": "Github" }
/** * Copyright (C) 2009-2014 BIMserver.org * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.bimserver.models.ifc4; /****************************************************************************** * Copyright (C) 2009-2019 BIMserver.org * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see {@literal<http://www.gnu.org/licenses/>}. *****************************************************************************/ import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.emf.common.util.Enumerator; /** * <!-- begin-user-doc --> * A representation of the literals of the enumeration '<em><b>Ifc Work Calendar Type Enum</b></em>', * and utility methods for working with them. * <!-- end-user-doc --> * @see org.bimserver.models.ifc4.Ifc4Package#getIfcWorkCalendarTypeEnum() * @model * @generated */ public enum IfcWorkCalendarTypeEnum implements Enumerator { /** * The '<em><b>NULL</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #NULL_VALUE * @generated * @ordered */ NULL(0, "NULL", "NULL"), /** * The '<em><b>THIRDSHIFT</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #THIRDSHIFT_VALUE * @generated * @ordered */ THIRDSHIFT(1, "THIRDSHIFT", "THIRDSHIFT"), /** * The '<em><b>NOTDEFINED</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #NOTDEFINED_VALUE * @generated * @ordered */ NOTDEFINED(2, "NOTDEFINED", "NOTDEFINED"), /** * The '<em><b>SECONDSHIFT</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #SECONDSHIFT_VALUE * @generated * @ordered */ SECONDSHIFT(3, "SECONDSHIFT", "SECONDSHIFT"), /** * The '<em><b>FIRSTSHIFT</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #FIRSTSHIFT_VALUE * @generated * @ordered */ FIRSTSHIFT(4, "FIRSTSHIFT", "FIRSTSHIFT"), /** * The '<em><b>USERDEFINED</b></em>' literal object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #USERDEFINED_VALUE * @generated * @ordered */ USERDEFINED(5, "USERDEFINED", "USERDEFINED"); /** * The '<em><b>NULL</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>NULL</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #NULL * @model * @generated * @ordered */ public static final int NULL_VALUE = 0; /** * The '<em><b>THIRDSHIFT</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>THIRDSHIFT</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #THIRDSHIFT * @model * @generated * @ordered */ public static final int THIRDSHIFT_VALUE = 1; /** * The '<em><b>NOTDEFINED</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>NOTDEFINED</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #NOTDEFINED * @model * @generated * @ordered */ public static final int NOTDEFINED_VALUE = 2; /** * The '<em><b>SECONDSHIFT</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>SECONDSHIFT</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #SECONDSHIFT * @model * @generated * @ordered */ public static final int SECONDSHIFT_VALUE = 3; /** * The '<em><b>FIRSTSHIFT</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>FIRSTSHIFT</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #FIRSTSHIFT * @model * @generated * @ordered */ public static final int FIRSTSHIFT_VALUE = 4; /** * The '<em><b>USERDEFINED</b></em>' literal value. * <!-- begin-user-doc --> * <p> * If the meaning of '<em><b>USERDEFINED</b></em>' literal object isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @see #USERDEFINED * @model * @generated * @ordered */ public static final int USERDEFINED_VALUE = 5; /** * An array of all the '<em><b>Ifc Work Calendar Type Enum</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final IfcWorkCalendarTypeEnum[] VALUES_ARRAY = new IfcWorkCalendarTypeEnum[] { NULL, THIRDSHIFT, NOTDEFINED, SECONDSHIFT, FIRSTSHIFT, USERDEFINED, }; /** * A public read-only list of all the '<em><b>Ifc Work Calendar Type Enum</b></em>' enumerators. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<IfcWorkCalendarTypeEnum> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the '<em><b>Ifc Work Calendar Type Enum</b></em>' literal with the specified literal value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param literal the literal. * @return the matching enumerator or <code>null</code>. * @generated */ public static IfcWorkCalendarTypeEnum get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { IfcWorkCalendarTypeEnum result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the '<em><b>Ifc Work Calendar Type Enum</b></em>' literal with the specified name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param name the name. * @return the matching enumerator or <code>null</code>. * @generated */ public static IfcWorkCalendarTypeEnum getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { IfcWorkCalendarTypeEnum result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the '<em><b>Ifc Work Calendar Type Enum</b></em>' literal with the specified integer value. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the integer value. * @return the matching enumerator or <code>null</code>. * @generated */ public static IfcWorkCalendarTypeEnum get(int value) { switch (value) { case NULL_VALUE: return NULL; case THIRDSHIFT_VALUE: return THIRDSHIFT; case NOTDEFINED_VALUE: return NOTDEFINED; case SECONDSHIFT_VALUE: return SECONDSHIFT; case FIRSTSHIFT_VALUE: return FIRSTSHIFT; case USERDEFINED_VALUE: return USERDEFINED; } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final int value; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String name; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private final String literal; /** * Only this class can construct instances. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private IfcWorkCalendarTypeEnum(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public int getValue() { return value; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { return literal; } } //IfcWorkCalendarTypeEnum
{ "pile_set_name": "Github" }
var ElementType = require("domelementtype"), DomUtils = module.exports; function find(test, arr, recurse, limit){ var result = [], childs; for(var i = 0, j = arr.length; i < j; i++){ if(test(arr[i])){ result.push(arr[i]); if(--limit <= 0) break; } childs = arr[i].children; if(recurse && childs && childs.length > 0){ childs = find(test, childs, recurse, limit); result = result.concat(childs); limit -= childs.length; if(limit <= 0) break; } } return result; } function findOne(test, arr, recurse){ for(var i = 0, l = arr.length; i < l; i++){ if(test(arr[i])) return arr[i]; if(recurse && arr[i].children && arr[i].children.length > 0){ var elem = findOne(test, arr[i].children, true); if(elem) return elem; } } return null; } function findAll(test, arr){ return arr.reduce(function(arr, elem){ if(elem.children && elem.children.length > 0){ return arr.concat(findAll(test, elem.children)); } else { return arr; } }, arr.filter(test)); } var isTag = DomUtils.isTag = ElementType.isTag; function filter(test, element, recurse, limit){ if(!Array.isArray(element)) element = [element]; if(typeof limit !== "number" || !isFinite(limit)){ if(recurse === false){ return element.filter(test); } else { return findAll(test, element); } } else if(limit === 1){ element = findOne(test, element, recurse !== false); return element ? [element] : []; } else { return find(test, element, recurse !== false, limit); } } DomUtils.filter = filter; DomUtils.testElement = function(options, element){ for(var key in options){ if(!options.hasOwnProperty(key)); else if(key === "tag_name"){ if(!isTag(element) || !options.tag_name(element.name)){ return false; } } else if(key === "tag_type"){ if(!options.tag_type(element.type)) return false; } else if(key === "tag_contains"){ if(isTag(element) || !options.tag_contains(element.data)){ return false; } } else if(!element.attribs || !options[key](element.attribs[key])){ return false; } } return true; }; var Checks = { tag_name: function(name){ if(typeof name === "function"){ return function(elem){ return isTag(elem) && name(elem.name); }; } else if(name === "*"){ return isTag; } else { return function(elem){ return isTag(elem) && elem.name === name; }; } }, tag_type: function(type){ if(typeof type === "function"){ return function(elem){ return type(elem.type); }; } else { return function(elem){ return elem.type === type; }; } }, tag_contains: function(data){ if(typeof type === "function"){ return function(elem){ return !isTag(elem) && data(elem.data); }; } else { return function(elem){ return !isTag(elem) && elem.data === data; }; } } }; function getAttribCheck(attrib, value){ if(typeof value === "function"){ return function(elem){ return elem.attribs && value(elem.attribs[attrib]); }; } else { return function(elem){ return elem.attribs && elem.attribs[attrib] === value; }; } } DomUtils.getElements = function(options, element, recurse, limit){ var funcs = []; for(var key in options){ if(options.hasOwnProperty(key)){ if(key in Checks) funcs.push(Checks[key](options[key])); else funcs.push(getAttribCheck(key, options[key])); } } if(funcs.length === 0) return []; if(funcs.length === 1) return filter(funcs[0], element, recurse, limit); return filter( function(elem){ return funcs.some(function(func){ return func(elem); }); }, element, recurse, limit ); }; DomUtils.getElementById = function(id, element, recurse){ if(!Array.isArray(element)) element = [element]; return findOne(getAttribCheck("id", id), element, recurse !== false); }; DomUtils.getElementsByTagName = function(name, element, recurse, limit){ return filter(Checks.tag_name(name), element, recurse, limit); }; DomUtils.getElementsByTagType = function(type, element, recurse, limit){ return filter(Checks.tag_type(type), element, recurse, limit); }; DomUtils.removeElement = function(elem){ if(elem.prev) elem.prev.next = elem.next; if(elem.next) elem.next.prev = elem.prev; if(elem.parent){ elem.parent.children.splice(elem.parent.children.lastIndexOf(elem), 1); } }; DomUtils.getInnerHTML = function(elem){ if(!elem.children) return ""; var childs = elem.children, childNum = childs.length, ret = ""; for(var i = 0; i < childNum; i++){ ret += DomUtils.getOuterHTML(childs[i]); } return ret; }; //boolean attributes without a value (taken from MatthewMueller/cheerio) var booleanAttribs = { __proto__: null, async: true, autofocus: true, autoplay: true, checked: true, controls: true, defer: true, disabled: true, hidden: true, loop: true, multiple: true, open: true, readonly: true, required: true, scoped: true, selected: true, "/": true //TODO when is this required? }; var emptyTags = { __proto__: null, area: true, base: true, basefont: true, br: true, col: true, frame: true, hr: true, img: true, input: true, isindex: true, link: true, meta: true, param: true, embed: true }; DomUtils.getOuterHTML = function(elem){ var type = elem.type; if(type === ElementType.Text) return elem.data; if(type === ElementType.Comment) return "<!--" + elem.data + "-->"; if(type === ElementType.Directive) return "<" + elem.data + ">"; if(type === ElementType.CDATA) return "<!CDATA " + DomUtils.getInnerHTML(elem) + "]]>"; var ret = "<" + elem.name; if("attribs" in elem){ for(var attr in elem.attribs){ if(elem.attribs.hasOwnProperty(attr)){ ret += " " + attr; var value = elem.attribs[attr]; if(!value){ if( !(attr in booleanAttribs) ){ ret += '=""'; } } else { ret += '="' + value + '"'; } } } } if (elem.name in emptyTags && elem.children.length === 0) { return ret + " />"; } else { return ret + ">" + DomUtils.getInnerHTML(elem) + "</" + elem.name + ">"; } }; DomUtils.getText = function getText(elem){ if(Array.isArray(elem)) return elem.map(getText).join(""); if(isTag(elem) || elem.type === ElementType.CDATA) return getText(elem.children); if(elem.type === ElementType.Text) return elem.data; return ""; };
{ "pile_set_name": "Github" }
// <ACEStransformID>urn:ampas:aces:transformId:v1.5:IDT.ARRI.Alexa-v2-raw-EI800-CCT2600.a1.v1</ACEStransformID> // <ACESuserName>ACES 1.0 Input - ARRIRAW (EI800, 2600K)</ACESuserName> // ARRI ALEXA IDT for ALEXA linear files // with camera EI set to 800 // and CCT of adopted white set to 2600K // Written by v2_IDT_maker.py v0.05 on Friday 19 December 2014 const float EI = 800.0; const float black = 256.0 / 65535.0; const float exp_factor = 0.18 / (0.01 * (400.0/EI)); void main ( input varying float rIn, input varying float gIn, input varying float bIn, input varying float aIn, output varying float rOut, output varying float gOut, output varying float bOut, output varying float aOut) { // convert to white-balanced, black-subtracted linear values float r_lin = (rIn - black) * exp_factor; float g_lin = (gIn - black) * exp_factor; float b_lin = (bIn - black) * exp_factor; // convert to ACES primaries using CCT-dependent matrix rOut = r_lin * 0.784282 + g_lin * 0.070865 + b_lin * 0.144852; gOut = r_lin * 0.022122 + g_lin * 1.041631 + b_lin * -0.063753; bOut = r_lin * 0.028916 + g_lin * -0.355789 + b_lin * 1.326872; aOut = 1.0; }
{ "pile_set_name": "Github" }
package holochain import ( "fmt" . "github.com/holochain/holochain-proto/hash" peer "github.com/libp2p/go-libp2p-peer" ma "github.com/multiformats/go-multiaddr" . "github.com/smartystreets/goconvey/convey" "testing" "time" ) /* @TODO add setup for gossip that adds entry and meta entry so we have something to gossip about. Currently test is ActionReceiver test func TestGossipReceiver(t *testing.T) { d, _, h := PrepareTestChain("test") defer CleanupTestChain(h,d) h.dht.SetupDHT() }*/ func TestGetGossipers(t *testing.T) { nodesCount := 20 mt := setupMultiNodeTesting(nodesCount) defer mt.cleanupMultiNodeTesting() nodes := mt.nodes h := nodes[0] dht := h.dht Convey("should return an empty list if none availabled", t, func() { glist, err := dht.getGossipers() So(err, ShouldBeNil) So(len(glist), ShouldEqual, 0) }) starConnect(t, mt.ctx, nodes, nodesCount) var err error var glist []peer.ID Convey("should return all peers when redundancy factor is 0", t, func() { So(h.nucleus.dna.DHTConfig.RedundancyFactor, ShouldEqual, 0) glist, err = dht.getGossipers() So(err, ShouldBeNil) So(len(glist), ShouldEqual, nodesCount-1) }) Convey("should return neighborhood size peers when neighborhood size is not 0", t, func() { h.nucleus.dna.DHTConfig.RedundancyFactor = 5 glist, err = dht.getGossipers() So(err, ShouldBeNil) So(len(glist), ShouldEqual, 5) }) Convey("should return list sorted by closeness to me", t, func() { So(h.node.Distance(glist[0]).Cmp(h.node.Distance(glist[1])), ShouldBeLessThanOrEqualTo, 0) So(h.node.Distance(glist[1]).Cmp(h.node.Distance(glist[2])), ShouldBeLessThanOrEqualTo, 0) So(h.node.Distance(glist[2]).Cmp(h.node.Distance(glist[3])), ShouldBeLessThanOrEqualTo, 0) So(h.node.Distance(glist[3]).Cmp(h.node.Distance(glist[4])), ShouldBeLessThanOrEqualTo, 0) So(h.node.Distance(glist[0]), ShouldNotEqual, h.node.Distance(glist[4])) }) Convey("it should only return active gossipers.", t, func() { // mark one of nodes previously found as closed id := glist[0] h.node.peerstore.ClearAddrs(id) glist, err = dht.getGossipers() So(err, ShouldBeNil) So(len(glist), ShouldEqual, 5) So(glist[0].Pretty(), ShouldNotEqual, id.Pretty()) }) } func TestGetFindGossiper(t *testing.T) { d, _, h := PrepareTestChain("test") defer CleanupTestChain(h, d) dht := h.dht Convey("FindGossiper should start empty", t, func() { _, err := dht.FindGossiper() So(err, ShouldEqual, ErrDHTErrNoGossipersAvailable) }) Convey("AddGossiper of ourselves should not add the gossiper", t, func() { err := dht.AddGossiper(h.node.HashAddr) So(err, ShouldBeNil) _, err = dht.FindGossiper() So(err, ShouldEqual, ErrDHTErrNoGossipersAvailable) }) fooAddr, _ := makePeer("peer_foo") addr, err := ma.NewMultiaddr("/ip4/127.0.0.1/tcp/1234") if err != nil { panic(err) } h.node.peerstore.AddAddrs(fooAddr, []ma.Multiaddr{addr}, PeerTTL) Convey("AddGossiper add the gossiper", t, func() { err := dht.AddGossiper(fooAddr) So(err, ShouldBeNil) g, err := dht.FindGossiper() So(err, ShouldBeNil) So(g, ShouldEqual, fooAddr) }) Convey("DeleteGossiper should remove a gossiper from the database", t, func() { err := dht.DeleteGossiper(fooAddr) So(err, ShouldBeNil) _, err = dht.FindGossiper() So(err, ShouldEqual, ErrDHTErrNoGossipersAvailable) err = dht.DeleteGossiper(fooAddr) So(err.Error(), ShouldEqual, "not found") }) Convey("GetGossiper should return the gossiper idx", t, func() { idx, err := dht.GetGossiper(fooAddr) So(err, ShouldBeNil) So(idx, ShouldEqual, 0) }) Convey("UpdateGossiper should add a gossiper", t, func() { err := dht.UpdateGossiper(fooAddr, 92) So(err, ShouldBeNil) }) Convey("GetGossiper should return the gossiper idx", t, func() { idx, err := dht.GetGossiper(fooAddr) So(err, ShouldBeNil) So(idx, ShouldEqual, 92) }) Convey("UpdateGossiper should ignore values less than previously stored", t, func() { err := dht.UpdateGossiper(fooAddr, 32) So(err, ShouldBeNil) idx, err := dht.GetGossiper(fooAddr) So(err, ShouldBeNil) So(idx, ShouldEqual, 92) }) Convey("FindGossiper should return the gossiper", t, func() { g, err := dht.FindGossiper() So(err, ShouldBeNil) So(g, ShouldEqual, fooAddr) }) Convey("UpdateGossiper should update when value greater than previously stored", t, func() { err := dht.UpdateGossiper(fooAddr, 132) So(err, ShouldBeNil) idx, err := dht.GetGossiper(fooAddr) So(err, ShouldBeNil) So(idx, ShouldEqual, 132) }) Convey("GetIdx for self should be 2 to start with (DNA not stored)", t, func() { idx, err := dht.GetIdx() So(err, ShouldBeNil) So(idx, ShouldEqual, 2) }) barAddr, _ := makePeer("peer_bar") Convey("GetGossiper should return 0 for unknown gossiper", t, func() { idx, err := dht.GetGossiper(barAddr) So(err, ShouldBeNil) So(idx, ShouldEqual, 0) }) } func TestGossipData(t *testing.T) { d, _, h := PrepareTestChain("test") defer CleanupTestChain(h, d) dht := h.dht Convey("Idx should be 2 at start (first puts are DNA, Agent & Key but DNA put not stored)", t, func() { var idx int idx, err := dht.GetIdx() So(err, ShouldBeNil) So(idx, ShouldEqual, 2) }) var msg1 Message var err error Convey("GetIdxMessage should return the message that made the change", t, func() { msg1, err = dht.GetIdxMessage(1) So(err, ShouldBeNil) So(msg1.Type, ShouldEqual, PUT_REQUEST) So(msg1.Body.(HoldReq).EntryHash.String(), ShouldEqual, h.nodeIDStr) }) Convey("GetFingerprint should return the index of the message that made the change", t, func() { f, _ := msg1.Fingerprint() idx, err := dht.GetFingerprint(f) So(err, ShouldBeNil) So(idx, ShouldEqual, 1) idx, err = dht.GetFingerprint(NullHash()) So(err, ShouldBeNil) So(idx, ShouldEqual, -1) }) // simulate a handled put request now := time.Unix(1, 1) // pick a constant time so the test will always work e := GobEntry{C: "124"} _, hd, _ := h.NewEntry(now, "evenNumbers", &e) hash := hd.EntryLink m1 := h.node.NewMessage(PUT_REQUEST, HoldReq{EntryHash: hash}) Convey("fingerprints for messages should not exist", t, func() { f, _ := m1.Fingerprint() r, _ := dht.HaveFingerprint(f) So(r, ShouldBeFalse) }) ActionReceiver(h, m1) someData := `{"firstName":"Zippy","lastName":"Pinhead"}` e = GobEntry{C: someData} _, hd, _ = h.NewEntry(now, "profile", &e) profileHash := hd.EntryLink ee := GobEntry{C: fmt.Sprintf(`{"Links":[{"Base":"%s"},{"Link":"%s"},{"Tag":"4stars"}]}`, hash.String(), profileHash.String())} _, le, _ := h.NewEntry(time.Now(), "rating", &ee) lr := HoldReq{RelatedHash: hash, EntryHash: le.EntryLink} m2 := h.node.NewMessage(LINK_REQUEST, lr) ActionReceiver(h, m2) Convey("fingerprints for messages should exist", t, func() { f, _ := m1.Fingerprint() r, _ := dht.HaveFingerprint(f) So(r, ShouldBeTrue) f, _ = m1.Fingerprint() r, _ = dht.HaveFingerprint(f) So(r, ShouldBeTrue) }) Convey("Idx should be 4 after puts", t, func() { var idx int idx, err := dht.GetIdx() So(err, ShouldBeNil) So(idx, ShouldEqual, 4) }) Convey("GetPuts should return a list of the puts since an index value", t, func() { puts, err := dht.GetPuts(0) So(err, ShouldBeNil) So(len(puts), ShouldEqual, 4) So(fmt.Sprintf("%v", puts[2].M), ShouldEqual, fmt.Sprintf("%v", *m1)) So(fmt.Sprintf("%v", puts[3].M), ShouldEqual, fmt.Sprintf("%v", *m2)) So(puts[0].Idx, ShouldEqual, 1) So(puts[1].Idx, ShouldEqual, 2) puts, err = dht.GetPuts(4) So(err, ShouldBeNil) So(len(puts), ShouldEqual, 1) So(fmt.Sprintf("%v", puts[0].M), ShouldEqual, fmt.Sprintf("%v", *m2)) So(puts[0].Idx, ShouldEqual, 4) }) } func TestGossip(t *testing.T) { nodesCount := 2 mt := setupMultiNodeTesting(nodesCount) defer mt.cleanupMultiNodeTesting() nodes := mt.nodes h1 := nodes[0] h2 := nodes[1] commit(h1, "oddNumbers", "3") commit(h1, "oddNumbers", "5") commit(h1, "oddNumbers", "7") puts1, _ := h1.dht.GetPuts(0) puts2, _ := h2.dht.GetPuts(0) Convey("Idx after puts", t, func() { So(len(puts1), ShouldEqual, 5) So(len(puts2), ShouldEqual, 2) }) ringConnect(t, mt.ctx, mt.nodes, nodesCount) Convey("gossipWith should add the puts", t, func() { err := h2.dht.gossipWith(h1.nodeID) So(err, ShouldBeNil) go h2.dht.HandleGossipPuts() time.Sleep(time.Millisecond * 100) puts2, _ = h2.dht.GetPuts(0) So(len(puts2), ShouldEqual, 7) }) commit(h1, "evenNumbers", "2") commit(h1, "evenNumbers", "4") Convey("gossipWith should add the puts", t, func() { err := h2.dht.gossipWith(h1.nodeID) So(err, ShouldBeNil) go h2.dht.HandleGossipPuts() time.Sleep(time.Millisecond * 100) puts2, _ = h2.dht.GetPuts(0) So(len(puts2), ShouldEqual, 9) }) } func TestPeerLists(t *testing.T) { d, _, h := PrepareTestChain("test") defer CleanupTestChain(h, d) Convey("it should start with an empty blockedlist", t, func() { peerList, err := h.dht.getList(BlockedList) So(err, ShouldBeNil) So(len(peerList.Records), ShouldEqual, 0) }) Convey("it should have peers after they're added", t, func() { pid1, _ := makePeer("testPeer1") pid2, _ := makePeer("testPeer2") pids := []PeerRecord{PeerRecord{ID: pid1}, PeerRecord{ID: pid2}} idx, _ := h.dht.GetIdx() err := h.dht.addToList(h.node.NewMessage(LISTADD_REQUEST, ListAddReq{ListType: BlockedList, Peers: []string{peer.IDB58Encode(pid1), peer.IDB58Encode(pid2)}}), PeerList{BlockedList, pids}) So(err, ShouldBeNil) afterIdx, _ := h.dht.GetIdx() So(afterIdx-idx, ShouldEqual, 1) peerList, err := h.dht.getList(BlockedList) So(err, ShouldBeNil) So(peerList.Type, ShouldEqual, BlockedList) So(len(peerList.Records), ShouldEqual, 2) So(peerList.Records[0].ID, ShouldEqual, pid1) So(peerList.Records[1].ID, ShouldEqual, pid2) }) } func TestGossipCycle(t *testing.T) { nodesCount := 2 mt := setupMultiNodeTesting(nodesCount) defer mt.cleanupMultiNodeTesting() nodes := mt.nodes h0 := nodes[0] h1 := nodes[1] ringConnect(t, mt.ctx, nodes, nodesCount) Convey("the gossip task should schedule a gossipWithRequest", t, func() { So(len(h0.dht.gchan), ShouldEqual, 0) GossipTask(h0) So(len(h0.dht.gchan), ShouldEqual, 1) }) Convey("handling the gossipWith should result in getting puts, and a gossip back scheduled on receiving node after a delay", t, func() { So(len(h1.dht.gchan), ShouldEqual, 0) So(len(h0.dht.gossipPuts), ShouldEqual, 0) x, ok := <-h0.dht.gchan So(ok, ShouldBeTrue) err := handleGossipWith(h0.dht, x) So(err, ShouldBeNil) // we got receivers puts back and scheduled So(len(h0.dht.gossipPuts), ShouldEqual, 2) So(len(h1.dht.gchan), ShouldEqual, 0) time.Sleep(GossipBackPutDelay * 3) // gossip back scheduled on receiver after delay So(len(h1.dht.gchan), ShouldEqual, 1) }) Convey("gossipWith shouldn't be rentrant with respect to the same gossiper", t, func() { log := &h0.Config.Loggers.Gossip log.color, log.f = log.setupColor("%{message}") // if the code were rentrant the log would should the events in a different order ShouldLog(log, func() { go h0.dht.gossipWith(h1.nodeID) h0.dht.gossipWith(h1.nodeID) time.Sleep(time.Millisecond * 100) }, "node0_starting gossipWith <peer.ID UfY4We>\nnode0_no new puts received\nnode0_finish gossipWith <peer.ID UfY4We>, err=<nil>\nnode0_starting gossipWith <peer.ID UfY4We>\nnode0_no new puts received\nnode0_finish gossipWith <peer.ID UfY4We>, err=<nil>\n") log.color, log.f = log.setupColor(log.Format) }) } func TestGossipErrorCases(t *testing.T) { nodesCount := 2 mt := setupMultiNodeTesting(nodesCount) defer mt.cleanupMultiNodeTesting() nodes := mt.nodes h0 := nodes[0] h1 := nodes[1] ringConnect(t, mt.ctx, nodes, nodesCount) Convey("a rejected put should not break gossiping", t, func() { // inject a bad put hash, _ := NewHash("QmY8Mzg9F69e5P9AoQPYat655HEhc1TVGs11tmfNSzkqz2") h1.dht.Put(h1.node.NewMessage(PUT_REQUEST, HoldReq{EntryHash: hash}), "evenNumbers", hash, h0.nodeID, []byte("bad data"), StatusLive) err := h0.dht.gossipWith(h1.nodeID) So(err, ShouldBeNil) So(len(h0.dht.gossipPuts), ShouldEqual, 3) for i := 0; i < 3; i++ { x, ok := <-h0.dht.gossipPuts So(ok, ShouldBeTrue) err := handleGossipPut(h0.dht, x) So(err, ShouldBeNil) } err = h0.dht.gossipWith(h1.nodeID) So(err, ShouldBeNil) So(len(h0.dht.gossipPuts), ShouldEqual, 0) }) } func TestGossipPropagation(t *testing.T) { nodesCount := 10 mt := setupMultiNodeTesting(nodesCount) defer mt.cleanupMultiNodeTesting() nodes := mt.nodes ringConnect(t, mt.ctx, nodes, nodesCount) //randConnect(t, mt.ctx, nodes, nodesCount, 7, 4) //starConnect(t, mt.ctx, nodes, nodesCount) Convey("each node should have one gossiper from the ring connect", t, func() { for i := 0; i < nodesCount; i++ { glist, err := nodes[i].dht.getGossipers() So(err, ShouldBeNil) So(len(glist), ShouldEqual, 1) } }) Convey("each node should only have it's own puts", t, func() { for i := 0; i < nodesCount; i++ { puts, err := nodes[i].dht.GetPuts(0) So(err, ShouldBeNil) So(len(puts), ShouldEqual, 2) } }) Convey("each node should only have everybody's puts after enough propagation time", t, func() { for i := 0; i < nodesCount; i++ { nodes[i].Config.gossipInterval = 200 * time.Millisecond nodes[i].StartBackgroundTasks() } start := time.Now() propagated := false ticker := time.NewTicker(210 * time.Millisecond) stop := make(chan bool, 1) go func() { for tick := range ticker.C { // abort just in case in 4 seconds (only if propgation fails) if tick.Sub(start) > (10 * time.Second) { //fmt.Printf("Aborting!") stop <- true return } propagated = true // check to see if the nodes have all gotten the puts yet. for i := 0; i < nodesCount; i++ { puts, _ := nodes[i].dht.GetPuts(0) if len(puts) < nodesCount*2 { propagated = false } /* fmt.Printf("NODE%d(%s): %d:", i, nodes[i].nodeID.Pretty()[2:4], len(puts)) for j := 0; j < len(puts); j++ { f, _ := puts[j].M.Fingerprint() fmt.Printf("%s,", f.String()[2:4]) } fmt.Printf("\n ") nodes[i].dht.glk.RLock() for k, _ := range nodes[i].dht.fingerprints { fmt.Printf("%s,", k) } nodes[i].dht.glk.RUnlock() fmt.Printf("\n ") for k, _ := range nodes[i].dht.sources { fmt.Printf("%d,", findNodeIdx(nodes, k)) } fmt.Printf("\n") */ } if propagated { stop <- true return } // fmt.Printf("\n") } }() <-stop ticker.Stop() So(propagated, ShouldBeTrue) }) } func findNodeIdx(nodes []*Holochain, id peer.ID) int { for i, n := range nodes { if id == n.nodeID { return i } } panic("bork!") }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `Rem` trait in crate `core`."> <meta name="keywords" content="rust, rustlang, rust-lang, Rem"> <title>core::ops::Rem - Rust</title> <link rel="stylesheet" type="text/css" href="../../rustdoc.css"> <link rel="stylesheet" type="text/css" href="../../main.css"> <link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico"> </head> <body class="rustdoc"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <nav class="sidebar"> <a href='../../core/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='' width='100'></a> <p class='location'><a href='../index.html'>core</a>::<wbr><a href='index.html'>ops</a></p><script>window.sidebarCurrent = {name: 'Rem', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script> </nav> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content trait"> <h1 class='fqn'><span class='in-band'>Trait <a href='../index.html'>core</a>::<wbr><a href='index.html'>ops</a>::<wbr><a class='trait' href=''>Rem</a></span><span class='out-of-band'><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>&#x2212;</span>] </a> </span><a id='src-13529' class='srclink' href='../../src/core/ops.rs.html#416-424' title='goto source code'>[src]</a></span></h1> <pre class='rust trait'>pub trait Rem&lt;RHS = Self&gt; { type Output = Self; fn <a href='#tymethod.rem' class='fnname'>rem</a>(self, rhs: RHS) -&gt; Self::<a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Output</a>; }</pre><div class='docblock'><p>The <code>Rem</code> trait is used to specify the functionality of <code>%</code>.</p> <h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1> <p>A trivial implementation of <code>Rem</code>. When <code>Foo % Foo</code> happens, it ends up calling <code>rem</code>, and therefore, <code>main</code> prints <code>Remainder-ing!</code>.</p> <span class='rusttest'>use std::ops::Rem; #[derive(Copy, Clone)] struct Foo; impl Rem for Foo { type Output = Foo; fn rem(self, _rhs: Foo) -&gt; Foo { println!(&quot;Remainder-ing!&quot;); self } } fn main() { Foo % Foo; } </span><pre class='rust rust-example-rendered'> <span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>ops</span>::<span class='ident'>Rem</span>; <span class='attribute'>#[<span class='ident'>derive</span>(<span class='ident'>Copy</span>, <span class='ident'>Clone</span>)]</span> <span class='kw'>struct</span> <span class='ident'>Foo</span>; <span class='kw'>impl</span> <span class='ident'>Rem</span> <span class='kw'>for</span> <span class='ident'>Foo</span> { <span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='ident'>Foo</span>; <span class='kw'>fn</span> <span class='ident'>rem</span>(<span class='self'>self</span>, <span class='ident'>_rhs</span>: <span class='ident'>Foo</span>) <span class='op'>-&gt;</span> <span class='ident'>Foo</span> { <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Remainder-ing!&quot;</span>); <span class='self'>self</span> } } <span class='kw'>fn</span> <span class='ident'>main</span>() { <span class='ident'>Foo</span> <span class='op'>%</span> <span class='ident'>Foo</span>; }</pre> </div> <h2 id='associated-types'>Associated Types</h2> <div class='methods'> <h3 id='associatedtype.Output' class='method stab '><code>type Output = Self</code></h3><div class='docblock'><p>The resulting type after applying the <code>%</code> operator</p> </div></div> <h2 id='required-methods'>Required Methods</h2> <div class='methods'> <h3 id='tymethod.rem' class='method stab '><code>fn <a href='#tymethod.rem' class='fnname'>rem</a>(self, rhs: RHS) -&gt; Self::<a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Output</a></code></h3><div class='docblock'><p>The method for the <code>%</code> operator</p> </div></div> <h2 id='implementors'>Implementors</h2> <ul class='item-list' id='implementors-list'> <li><code>impl <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a> for usize</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;usize&gt; for &amp;'a usize</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a usize&gt; for usize</code></li> <li><code>impl&lt;'a, 'b&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a usize&gt; for &amp;'b usize</code></li> <li><code>impl <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a> for u8</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;u8&gt; for &amp;'a u8</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a u8&gt; for u8</code></li> <li><code>impl&lt;'a, 'b&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a u8&gt; for &amp;'b u8</code></li> <li><code>impl <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a> for u16</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;u16&gt; for &amp;'a u16</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a u16&gt; for u16</code></li> <li><code>impl&lt;'a, 'b&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a u16&gt; for &amp;'b u16</code></li> <li><code>impl <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a> for u32</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;u32&gt; for &amp;'a u32</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a u32&gt; for u32</code></li> <li><code>impl&lt;'a, 'b&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a u32&gt; for &amp;'b u32</code></li> <li><code>impl <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a> for u64</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;u64&gt; for &amp;'a u64</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a u64&gt; for u64</code></li> <li><code>impl&lt;'a, 'b&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a u64&gt; for &amp;'b u64</code></li> <li><code>impl <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a> for isize</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;isize&gt; for &amp;'a isize</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a isize&gt; for isize</code></li> <li><code>impl&lt;'a, 'b&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a isize&gt; for &amp;'b isize</code></li> <li><code>impl <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a> for i8</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;i8&gt; for &amp;'a i8</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a i8&gt; for i8</code></li> <li><code>impl&lt;'a, 'b&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a i8&gt; for &amp;'b i8</code></li> <li><code>impl <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a> for i16</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;i16&gt; for &amp;'a i16</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a i16&gt; for i16</code></li> <li><code>impl&lt;'a, 'b&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a i16&gt; for &amp;'b i16</code></li> <li><code>impl <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a> for i32</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;i32&gt; for &amp;'a i32</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a i32&gt; for i32</code></li> <li><code>impl&lt;'a, 'b&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a i32&gt; for &amp;'b i32</code></li> <li><code>impl <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a> for i64</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;i64&gt; for &amp;'a i64</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a i64&gt; for i64</code></li> <li><code>impl&lt;'a, 'b&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a i64&gt; for &amp;'b i64</code></li> <li><code>impl <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a> for f32</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;f32&gt; for &amp;'a f32</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a f32&gt; for f32</code></li> <li><code>impl&lt;'a, 'b&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a f32&gt; for &amp;'b f32</code></li> <li><code>impl <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a> for f64</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;f64&gt; for &amp;'a f64</code></li> <li><code>impl&lt;'a&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a f64&gt; for f64</code></li> <li><code>impl&lt;'a, 'b&gt; <a class='trait' href='../../core/ops/trait.Rem.html' title='core::ops::Rem'>Rem</a>&lt;&amp;'a f64&gt; for &amp;'b f64</code></li> </ul><script type="text/javascript" async src="../../implementors/core/ops/trait.Rem.js"> </script></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <aside id="help" class="hidden"> <div> <h1 class="hidden">Help</h1> <div class="shortcuts"> <h2>Keyboard Shortcuts</h2> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>&larrb;</dt> <dd>Move up in search results</dd> <dt>&rarrb;</dt> <dd>Move down in search results</dd> <dt>&#9166;</dt> <dd>Go to active search result</dd> </dl> </div> <div class="infos"> <h2>Search Tricks</h2> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code>) </p> </div> </div> </aside> <script> window.rootPath = "../../"; window.currentCrate = "core"; window.playgroundUrl = "https://play.rust-lang.org/"; </script> <script src="../../jquery.js"></script> <script src="../../main.js"></script> <script src="../../playpen.js"></script> <script defer src="../../search-index.js"></script> </body> </html>
{ "pile_set_name": "Github" }
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) APP_ABI:= armeabi-v7a APP_ABI+= arm64-v8a APP_PLATFORM:=android-21
{ "pile_set_name": "Github" }
// XFAIL: linux // Different sanitizer coverage types // RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=func -sanitize=address %s | %FileCheck -check-prefix=SANCOV_FUNC %s // RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=bb -sanitize=address %s | %FileCheck -check-prefix=SANCOV_BB %s // RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=edge -sanitize=address %s | %FileCheck -check-prefix=SANCOV_EDGE %s // Try some options // RUN: %swiftc_driver -driver-print-jobs -sanitize-coverage=edge,indirect-calls,trace-bb,trace-cmp,8bit-counters -sanitize=address %s | %FileCheck -check-prefix=SANCOV_EDGE_WITH_OPTIONS %s // Invalid command line arguments // RUN: not %swiftc_driver -driver-print-jobs -sanitize-coverage=func %s 2>&1 | %FileCheck -check-prefix=SANCOV_WITHOUT_XSAN %s // RUN: not %swiftc_driver -driver-print-jobs -sanitize-coverage=bb %s 2>&1 | %FileCheck -check-prefix=SANCOV_WITHOUT_XSAN %s // RUN: not %swiftc_driver -driver-print-jobs -sanitize-coverage=edge %s 2>&1 | %FileCheck -check-prefix=SANCOV_WITHOUT_XSAN %s // RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=unknown %s 2>&1 | %FileCheck -check-prefix=SANCOV_BAD_ARG %s // RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=indirect-calls %s 2>&1 | %FileCheck -check-prefix=SANCOV_MISSING_ARG %s // RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=trace-bb %s 2>&1 | %FileCheck -check-prefix=SANCOV_MISSING_ARG %s // RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=trace-cmp %s 2>&1 | %FileCheck -check-prefix=SANCOV_MISSING_ARG %s // RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize-coverage=8bit-counters %s 2>&1 | %FileCheck -check-prefix=SANCOV_MISSING_ARG %s // SANCOV_FUNC: swift // SANCOV_FUNC-DAG: -sanitize-coverage=func // SANCOV_FUNC-DAG: -sanitize=address // SANCOV_BB: swift // SANCOV_BB-DAG: -sanitize-coverage=bb // SANCOV_BB-DAG: -sanitize=address // SANCOV_EDGE: swift // SANCOV_EDGE-DAG: -sanitize-coverage=edge // SANCOV_EDGE-DAG: -sanitize=address // SANCOV_EDGE_WITH_OPTIONS: swift // SANCOV_EDGE_WITH_OPTIONS-DAG: -sanitize-coverage=edge,indirect-calls,trace-bb,trace-cmp,8bit-counters // SANCOV_EDGE_WITH_OPTIONS-DAG: -sanitize=address // SANCOV_WITHOUT_XSAN: option '-sanitize-coverage=' requires a sanitizer to be enabled. Use -sanitize= to enable a sanitizer // SANCOV_BAD_ARG: unsupported argument 'unknown' to option '-sanitize-coverage=' // SANCOV_MISSING_ARG: error: option '-sanitize-coverage=' is missing a required argument ("func", "bb", "edge")
{ "pile_set_name": "Github" }
import Component from '@glimmer/component'; import { inject as service } from '@ember/service'; import CssModeToggleService from '../services/css-mode-toggle'; export default class CardhostTopEdgeComponent extends Component { @service cssModeToggle!: CssModeToggleService; }
{ "pile_set_name": "Github" }
#ifndef BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP #define BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP // MS compatible compilers support #pragma once #if defined(_MSC_VER) # pragma once #endif /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // basic_iserializer.hpp: extenstion of type_info required for serialization. // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for updates, documentation, and revision history. #include <cstdlib> // NULL #include <boost/config.hpp> #include <boost/archive/basic_archive.hpp> #include <boost/archive/detail/decl.hpp> #include <boost/archive/detail/basic_serializer.hpp> #include <boost/archive/detail/auto_link_archive.hpp> #include <boost/archive/detail/abi_prefix.hpp> // must be the last header #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4511 4512) #endif namespace boost { namespace serialization { class extended_type_info; } // namespace serialization // forward declarations namespace archive { namespace detail { class basic_iarchive; class basic_pointer_iserializer; class BOOST_SYMBOL_VISIBLE basic_iserializer : public basic_serializer { private: basic_pointer_iserializer *m_bpis; protected: explicit BOOST_ARCHIVE_DECL basic_iserializer( const boost::serialization::extended_type_info & type ); virtual BOOST_ARCHIVE_DECL ~basic_iserializer(); public: bool serialized_as_pointer() const { return m_bpis != NULL; } void set_bpis(basic_pointer_iserializer *bpis){ m_bpis = bpis; } const basic_pointer_iserializer * get_bpis_ptr() const { return m_bpis; } virtual void load_object_data( basic_iarchive & ar, void *x, const unsigned int file_version ) const = 0; // returns true if class_info should be saved virtual bool class_info() const = 0 ; // returns true if objects should be tracked virtual bool tracking(const unsigned int) const = 0 ; // returns class version virtual version_type version() const = 0 ; // returns true if this class is polymorphic virtual bool is_polymorphic() const = 0; virtual void destroy(/*const*/ void *address) const = 0 ; }; } // namespae detail } // namespace archive } // namespace boost #ifdef BOOST_MSVC #pragma warning(pop) #endif #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas #endif // BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP
{ "pile_set_name": "Github" }
#!/usr/bin/tail --lines=+2 Content-Type: text/plain Status: 200 OK We could've been some HTML.
{ "pile_set_name": "Github" }
(ns top-scores.core (:gen-class)) (defn- sorted-frequencies [coll max-value] (reduce (fn [counts value] (update counts value inc)) (vec (replicate (inc max-value) 0)) coll)) (defn counting-sort "O(n) time & O(n + k) space solution, where k = max-value." [coll max-value] (reduce-kv (fn [sorted value count] (into sorted (replicate count value))) [] (sorted-frequencies coll max-value)))
{ "pile_set_name": "Github" }
DynamicRangeBuilder.category = \u52d5\u7684 DynamicRangeBuilder.name = \u52d5\u7684\u7bc4\u56f2
{ "pile_set_name": "Github" }
/* * drivers/net/phy/lxt.c * * Driver for Intel LXT PHYs * * Author: Andy Fleming * * Copyright (c) 2004 Freescale Semiconductor, Inc. * * 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. * */ #include <linux/kernel.h> #include <linux/string.h> #include <linux/errno.h> #include <linux/unistd.h> #include <linux/interrupt.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/skbuff.h> #include <linux/spinlock.h> #include <linux/mm.h> #include <linux/module.h> #include <linux/mii.h> #include <linux/ethtool.h> #include <linux/phy.h> #include <asm/io.h> #include <asm/irq.h> #include <asm/uaccess.h> /* The Level one LXT970 is used by many boards */ #define MII_LXT970_IER 17 /* Interrupt Enable Register */ #define MII_LXT970_IER_IEN 0x0002 #define MII_LXT970_ISR 18 /* Interrupt Status Register */ #define MII_LXT970_CONFIG 19 /* Configuration Register */ /* ------------------------------------------------------------------------- */ /* The Level one LXT971 is used on some of my custom boards */ /* register definitions for the 971 */ #define MII_LXT971_IER 18 /* Interrupt Enable Register */ #define MII_LXT971_IER_IEN 0x00f2 #define MII_LXT971_ISR 19 /* Interrupt Status Register */ /* register definitions for the 973 */ #define MII_LXT973_PCR 16 /* Port Configuration Register */ #define PCR_FIBER_SELECT 1 MODULE_DESCRIPTION("Intel LXT PHY driver"); MODULE_AUTHOR("Andy Fleming"); MODULE_LICENSE("GPL"); static int lxt970_ack_interrupt(struct phy_device *phydev) { int err; err = phy_read(phydev, MII_BMSR); if (err < 0) return err; err = phy_read(phydev, MII_LXT970_ISR); if (err < 0) return err; return 0; } static int lxt970_config_intr(struct phy_device *phydev) { int err; if (phydev->interrupts == PHY_INTERRUPT_ENABLED) err = phy_write(phydev, MII_LXT970_IER, MII_LXT970_IER_IEN); else err = phy_write(phydev, MII_LXT970_IER, 0); return err; } static int lxt970_config_init(struct phy_device *phydev) { int err; err = phy_write(phydev, MII_LXT970_CONFIG, 0); return err; } static int lxt971_ack_interrupt(struct phy_device *phydev) { int err = phy_read(phydev, MII_LXT971_ISR); if (err < 0) return err; return 0; } static int lxt971_config_intr(struct phy_device *phydev) { int err; if (phydev->interrupts == PHY_INTERRUPT_ENABLED) err = phy_write(phydev, MII_LXT971_IER, MII_LXT971_IER_IEN); else err = phy_write(phydev, MII_LXT971_IER, 0); return err; } /* * A2 version of LXT973 chip has an ERRATA: it randomly return the contents * of the previous even register when you read a odd register regularly */ static int lxt973a2_update_link(struct phy_device *phydev) { int status; int control; int retry = 8; /* we try 8 times */ /* Do a fake read */ status = phy_read(phydev, MII_BMSR); if (status < 0) return status; control = phy_read(phydev, MII_BMCR); if (control < 0) return control; do { /* Read link and autonegotiation status */ status = phy_read(phydev, MII_BMSR); } while (status >= 0 && retry-- && status == control); if (status < 0) return status; if ((status & BMSR_LSTATUS) == 0) phydev->link = 0; else phydev->link = 1; return 0; } static int lxt973a2_read_status(struct phy_device *phydev) { int adv; int err; int lpa; int lpagb = 0; /* Update the link, but return if there was an error */ err = lxt973a2_update_link(phydev); if (err) return err; if (AUTONEG_ENABLE == phydev->autoneg) { int retry = 1; adv = phy_read(phydev, MII_ADVERTISE); if (adv < 0) return adv; do { lpa = phy_read(phydev, MII_LPA); if (lpa < 0) return lpa; /* If both registers are equal, it is suspect but not * impossible, hence a new try */ } while (lpa == adv && retry--); lpa &= adv; phydev->speed = SPEED_10; phydev->duplex = DUPLEX_HALF; phydev->pause = phydev->asym_pause = 0; if (lpagb & (LPA_1000FULL | LPA_1000HALF)) { phydev->speed = SPEED_1000; if (lpagb & LPA_1000FULL) phydev->duplex = DUPLEX_FULL; } else if (lpa & (LPA_100FULL | LPA_100HALF)) { phydev->speed = SPEED_100; if (lpa & LPA_100FULL) phydev->duplex = DUPLEX_FULL; } else { if (lpa & LPA_10FULL) phydev->duplex = DUPLEX_FULL; } if (phydev->duplex == DUPLEX_FULL) { phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0; phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0; } } else { int bmcr = phy_read(phydev, MII_BMCR); if (bmcr < 0) return bmcr; if (bmcr & BMCR_FULLDPLX) phydev->duplex = DUPLEX_FULL; else phydev->duplex = DUPLEX_HALF; if (bmcr & BMCR_SPEED1000) phydev->speed = SPEED_1000; else if (bmcr & BMCR_SPEED100) phydev->speed = SPEED_100; else phydev->speed = SPEED_10; phydev->pause = phydev->asym_pause = 0; } return 0; } static int lxt973_probe(struct phy_device *phydev) { int val = phy_read(phydev, MII_LXT973_PCR); if (val & PCR_FIBER_SELECT) { /* * If fiber is selected, then the only correct setting * is 100Mbps, full duplex, and auto negotiation off. */ val = phy_read(phydev, MII_BMCR); val |= (BMCR_SPEED100 | BMCR_FULLDPLX); val &= ~BMCR_ANENABLE; phy_write(phydev, MII_BMCR, val); /* Remember that the port is in fiber mode. */ phydev->priv = lxt973_probe; } else { phydev->priv = NULL; } return 0; } static int lxt973_config_aneg(struct phy_device *phydev) { /* Do nothing if port is in fiber mode. */ return phydev->priv ? 0 : genphy_config_aneg(phydev); } static struct phy_driver lxt97x_driver[] = { { .phy_id = 0x78100000, .name = "LXT970", .phy_id_mask = 0xfffffff0, .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = lxt970_config_init, .config_aneg = genphy_config_aneg, .read_status = genphy_read_status, .ack_interrupt = lxt970_ack_interrupt, .config_intr = lxt970_config_intr, .driver = { .owner = THIS_MODULE,}, }, { .phy_id = 0x001378e0, .name = "LXT971", .phy_id_mask = 0xfffffff0, .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_aneg = genphy_config_aneg, .read_status = genphy_read_status, .ack_interrupt = lxt971_ack_interrupt, .config_intr = lxt971_config_intr, .driver = { .owner = THIS_MODULE,}, }, { .phy_id = 0x00137a10, .name = "LXT973-A2", .phy_id_mask = 0xffffffff, .features = PHY_BASIC_FEATURES, .flags = 0, .probe = lxt973_probe, .config_aneg = lxt973_config_aneg, .read_status = lxt973a2_read_status, .driver = { .owner = THIS_MODULE,}, }, { .phy_id = 0x00137a10, .name = "LXT973", .phy_id_mask = 0xfffffff0, .features = PHY_BASIC_FEATURES, .flags = 0, .probe = lxt973_probe, .config_aneg = lxt973_config_aneg, .read_status = genphy_read_status, .driver = { .owner = THIS_MODULE,}, } }; module_phy_driver(lxt97x_driver); static struct mdio_device_id __maybe_unused lxt_tbl[] = { { 0x78100000, 0xfffffff0 }, { 0x001378e0, 0xfffffff0 }, { 0x00137a10, 0xfffffff0 }, { } }; MODULE_DEVICE_TABLE(mdio, lxt_tbl);
{ "pile_set_name": "Github" }
maintainers: - github: poscat0x04 update_on: - source: aur aur: post_build: aur_post_build pre_build: aur_pre_build repo_depends: - ats2-postiats
{ "pile_set_name": "Github" }