text
stringlengths
2
99.9k
meta
dict
# -*- coding: utf-8 -*- result = 'passed'
{ "pile_set_name": "Github" }
x1 DevotedAcreage:$CORN x2 DevotedAcreage:$SUGAR_BEETS x3 DevotedAcreage:$WHEAT
{ "pile_set_name": "Github" }
# Contributing Guidelines Welcome to Kubernetes. We are excited about the prospect of you joining our [community](https://github.com/kubernetes/community)! The Kubernetes community abides by the CNCF [code of conduct](code-of-conduct.md). Here is an excerpt: _As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities._ ## Getting Started We have full documentation on how to get started contributing here: - [Contributor License Agreement](https://git.k8s.io/community/CLA.md) Kubernetes projects require that you sign a Contributor License Agreement (CLA) before we can accept your pull requests - [Kubernetes Contributor Guide](http://git.k8s.io/community/contributors/guide) - Main contributor documentation, or you can just jump directly to the [contributing section](http://git.k8s.io/community/contributors/guide#contributing) - [Contributor Cheat Sheet](https://git.k8s.io/community/contributors/guide/contributor-cheatsheet.md) - Common resources for existing developers ## Mentorship - [Mentoring Initiatives](https://git.k8s.io/community/mentoring) - We have a diverse set of mentorship programs available that are always looking for volunteers! ## Contact Information - [Slack](https://kubernetes.slack.com/messages/sig-architecture) - [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-architecture)
{ "pile_set_name": "Github" }
// TODO remove file with 1.0.0 @file:Suppress("DEPRECATION", "TYPEALIAS_EXPANSION_DEPRECATION") package ch.tutteli.atrium.api.cc.infix.en_GB import ch.tutteli.atrium.api.cc.infix.en_GB.creating.list.get.builders.ListGetNullableOption import ch.tutteli.atrium.api.cc.infix.en_GB.creating.list.get.builders.ListGetOption import ch.tutteli.atrium.creating.Assert import ch.tutteli.atrium.creating.AssertionPlant import ch.tutteli.atrium.creating.SubjectProvider import ch.tutteli.atrium.domain.builders.AssertImpl /** * Makes the assertion that the given [index] is within the bounds of [Assert.subject][SubjectProvider.subject], * creates a feature assertion plant for the corresponding element and returns the newly created plant. * * @return This plant to support a fluent API. * @throws AssertionError Might throw an [AssertionError] if the given [index] is out of bound. */ @Suppress("DEPRECATION") @Deprecated( "Switch from Assert to Expect; will be removed with 1.0.0 -- see https://github.com/robstoll/atrium/releases/tag/v0.12.0#migration for migration hints and scripts.", ReplaceWith( "this.asExpect().get(index).asAssert()", "ch.tutteli.atrium.domain.builders.migration.asExpect", "ch.tutteli.atrium.domain.builders.migration.asAssert", "ch.tutteli.atrium.api.infix.en_GB.get" ) ) infix fun <E: Any, T: List<E>> Assert<T>.get(index: Int) = AssertImpl.list.get(this, index) /** * Prepares the assertion about the return value of calling [get][List.get] with the given [index]. * * @return A fluent builder to finish the assertion. */ @Deprecated( "Switch from Assert to Expect; will be removed with 1.0.0 -- see https://github.com/robstoll/atrium/releases/tag/v0.12.0#migration for migration hints and scripts.", ReplaceWith( "this.asExpect().get(ch.tutteli.atrium.api.infix.en_GB.index(index.index) { \n/* needs further adjustments, move the lambda passed to assertIt to here and remove assertIt */ \n }).asAssert()", "ch.tutteli.atrium.domain.builders.migration.asExpect", "ch.tutteli.atrium.domain.builders.migration.asAssert", "ch.tutteli.atrium.api.infix.en_GB.get", "ch.tutteli.atrium.api.infix.en_GB.index" ) ) infix fun <E : Any, T: List<E>> Assert<T>.get(index: Index): ListGetOption<E, T> = ListGetOption.create(this, index.index) /** * Makes the assertion that the given [index] is within the bounds of [Assert.subject][SubjectProvider.subject], * creates a feature assertion plant for the corresponding nullable element and returns the newly created plant. * * @return This plant to support a fluent API. * @throws AssertionError Might throw an [AssertionError] if the given [index] is out of bound. */ @Deprecated( "Switch from Assert to Expect; will be removed with 1.0.0 -- see https://github.com/robstoll/atrium/releases/tag/v0.12.0#migration for migration hints and scripts.", ReplaceWith( "this.asExpect().get(index).asAssert()", "ch.tutteli.atrium.domain.builders.migration.asExpect", "ch.tutteli.atrium.domain.builders.migration.asAssert", "ch.tutteli.atrium.api.infix.en_GB.get" ) ) @Suppress("DEPRECATION") infix fun <E, T: List<E>> Assert<T>.get(index: Int) = AssertImpl.list.getNullable(this, index) /** * Prepares the assertion about the nullable return value of calling [get][List.get] with the given [index]. * * Notice, that the corresponding element of the given [index] can be `null` even if the index is within bounds * as the [List] has a nullable element type. * * @return A fluent builder to finish the assertion. */ @Deprecated( "Switch from Assert to Expect; will be removed with 1.0.0 -- see https://github.com/robstoll/atrium/releases/tag/v0.12.0#migration for migration hints and scripts.", ReplaceWith( "this.asExpect().get(ch.tutteli.atrium.api.infix.en_GB.index(index.index) { \n/* needs further adjustments, move the lambda passed to assertIt to here and remove assertIt */ \n }).asAssert()", "ch.tutteli.atrium.domain.builders.migration.asExpect", "ch.tutteli.atrium.domain.builders.migration.asAssert", "ch.tutteli.atrium.api.infix.en_GB.get", "ch.tutteli.atrium.api.infix.en_GB.index" ) ) infix fun <E, T: List<E>> Assert<T>.get(index: Index): ListGetNullableOption<E, T> = ListGetNullableOption.create(this, index.index)
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.VisualStudio.Text; using IronPython.Hosting; namespace IronPython.EditorExtensions { public class PyErrorListCompilerSink : CompilerSink { private ITextBuffer textBuffer; public List<ValidationError> Errors { get; private set; } public PyErrorListCompilerSink(ITextBuffer textBuffer) { this.textBuffer = textBuffer; this.Errors = new List<ValidationError>(); } public override void AddError(string path, string message, string lineText, CodeSpan location, int errorCode, Severity severity) { // keep the error list under 100 items which is a reasonable number and avoids spending too much time on error processing if (Errors.Count < 100) { int startIndex, endIndex; if (location.StartLine > 0 && location.EndLine > 0) { // get the error bounds to create a span pointing to the error text so it can be navigated to later on by the Error List startIndex = textBuffer.CurrentSnapshot.GetLineFromLineNumber(location.StartLine - 1).Start.Position + location.StartColumn; endIndex = textBuffer.CurrentSnapshot.GetLineFromLineNumber(location.EndLine - 1).Start.Position + location.EndColumn; if (startIndex < endIndex && endIndex < textBuffer.CurrentSnapshot.GetText().Length) { // add the error with all its necessary information Errors.Add(new ValidationError(new Span(startIndex, endIndex - startIndex), message, GetSeverity(severity), ValidationErrorType.Syntactic)); if (Errors.Count == 100) { // add a friendly error telling the user the maximum number of errors has been reached Errors.Add(new ValidationError(new Span(startIndex, endIndex - startIndex), "The maximum number of errors or warnings has been reached.")); } } } } } private ValidationErrorSeverity GetSeverity(Severity severity) { switch (severity) { case Severity.Error: return ValidationErrorSeverity.Error; case Severity.Warning: return ValidationErrorSeverity.Warning; default: return ValidationErrorSeverity.Message; } } } }
{ "pile_set_name": "Github" }
// Common/UTFConvert.h #ifndef __COMMON_UTFCONVERT_H #define __COMMON_UTFCONVERT_H #include "MyString.h" bool ConvertUTF8ToUnicode(const AString &utfString, UString &resultString); bool ConvertUnicodeToUTF8(const UString &unicodeString, AString &resultString); #endif
{ "pile_set_name": "Github" }
<?php /** * GitHub Export Manager. * * @package WordPress_GitHub_Sync */ /** * Class WordPress_GitHub_Sync_Export */ class WordPress_GitHub_Sync_Export { /** * Option key for export user. */ const EXPORT_USER_OPTION = '_wpghs_export_user_id'; /** * Application container. * * @var WordPress_GitHub_Sync */ protected $app; /** * Initializes a new export manager. * * @param WordPress_GitHub_Sync $app Application container. */ public function __construct( WordPress_GitHub_Sync $app ) { $this->app = $app; } /** * Updates all of the current posts in the database on master. * * @return string|WP_Error */ public function full() { $posts = $this->app->database()->fetch_all_supported(); if ( is_wp_error( $posts ) ) { return $posts; } $master = $this->app->api()->fetch()->master(); if ( is_wp_error( $master ) ) { return $master; } foreach ( $posts as $post ) { $master->tree()->add_post_to_tree( $post ); } $master->set_message( apply_filters( 'wpghs_commit_msg_full', sprintf( 'Full export from WordPress at %s (%s)', site_url(), get_bloginfo( 'name' ) ) ) . $this->get_commit_msg_tag() ); $result = $this->app->api()->persist()->commit( $master ); if ( is_wp_error( $result ) ) { return $result; } return $this->update_shas( $posts ); } /** * Updates the provided post ID in master. * * @param int $post_id Post ID to update. * * @return string|WP_Error */ public function update( $post_id ) { $post = $this->app->database()->fetch_by_id( $post_id ); if ( is_wp_error( $post ) ) { return $post; } if ( 'trash' === $post->status() ) { return $this->delete( $post_id ); } $master = $this->app->api()->fetch()->master(); if ( is_wp_error( $master ) ) { return $master; } $master->tree()->add_post_to_tree( $post ); $master->set_message( apply_filters( 'wpghs_commit_msg_single', sprintf( 'Syncing %s from WordPress at %s (%s)', $post->github_path(), site_url(), get_bloginfo( 'name' ) ), $post ) . $this->get_commit_msg_tag() ); $result = $this->app->api()->persist()->commit( $master ); if ( is_wp_error( $result ) ) { return $result; } return $this->update_shas( array( $post ) ); } /** * Updates GitHub-created posts with latest WordPress data. * * @param array<WordPress_GitHub_Sync_Post> $posts Array of Posts to create. * * @return string|WP_Error */ public function new_posts( array $posts ) { $master = $this->app->api()->fetch()->master(); if ( is_wp_error( $master ) ) { return $master; } foreach ( $posts as $post ) { $master->tree()->add_post_to_tree( $post ); } $master->set_message( apply_filters( 'wpghs_commit_msg_new_posts', sprintf( 'Updating new posts from WordPress at %s (%s)', site_url(), get_bloginfo( 'name' ) ) ) . $this->get_commit_msg_tag() ); $result = $this->app->api()->persist()->commit( $master ); if ( is_wp_error( $result ) ) { return $result; } return $this->update_shas( $posts ); } /** * Deletes a provided post ID from master. * * @param int $post_id Post ID to delete. * * @return string|WP_Error */ public function delete( $post_id ) { $post = $this->app->database()->fetch_by_id( $post_id ); if ( is_wp_error( $post ) ) { return $post; } $master = $this->app->api()->fetch()->master(); if ( is_wp_error( $master ) ) { return $master; } $master->tree()->remove_post_from_tree( $post ); $master->set_message( apply_filters( 'wpghs_commit_msg_delete', sprintf( 'Deleting %s via WordPress at %s (%s)', $post->github_path(), site_url(), get_bloginfo( 'name' ) ), $post ) . $this->get_commit_msg_tag() ); $result = $this->app->api()->persist()->commit( $master ); if ( is_wp_error( $result ) ) { return $result; } return __( 'Export to GitHub completed successfully.', 'wp-github-sync' ); } /** * Use the new tree to save sha data * for all the updated posts. * * @param WordPress_GitHub_Sync_Post[] $posts Posts to fetch updated shas for. * * @return string|WP_Error */ protected function update_shas( array $posts ) { $master = $this->app->api()->fetch()->master(); $attempts = 1; while ( is_wp_error( $master ) && $attempts < 5 ) { $master = $this->app->api()->fetch()->master(); $attempts ++; } if ( is_wp_error( $master ) ) { // @todo throw a big warning! not having the latest shas is BAD // Solution: Show error message and link to kick off sha importing. return $master; } foreach ( $posts as $post ) { $blob = $master->tree()->get_blob_by_path( $post->github_path() ); if ( $blob ) { $this->app->database()->set_post_sha( $post, $blob->sha() ); } } return __( 'Export to GitHub completed successfully.', 'wp-github-sync' ); } /** * Saves the export user to the database. * * @param int $user_id User ID to export with. * * @return bool */ public function set_user( $user_id ) { return update_option( self::EXPORT_USER_OPTION, (int) $user_id ); } /** * Gets the commit message tag. * * @return string */ protected function get_commit_msg_tag() { $tag = apply_filters( 'wpghs_commit_msg_tag', 'wpghs' ); if ( ! $tag ) { throw new Exception( __( 'Commit message tag not set. Filter `wpghs_commit_msg_tag` misconfigured.', 'wp-github-sync' ) ); } return ' - ' . $tag; } }
{ "pile_set_name": "Github" }
<?xml version='1.0' encoding='utf-8'?> <document xmlns="https://code.dccouncil.us/schemas/dc-library" xmlns:codified="https://code.dccouncil.us/schemas/codified" xmlns:codify="https://code.dccouncil.us/schemas/codify" xmlns:xi="http://www.w3.org/2001/XInclude" id="D.C. Law 20-265"> <num type="law">20-265</num> <heading type="short">Federal Health Reform Implementation and Omnibus Amendment Act of 2014</heading> <meta> <effective>2015-05-02</effective> <citations> <citation type="law" url="http://lims.dccouncil.us/Download/31692/B20-0797-SignedAct.pdf">D.C. Law 20-265</citation> <citation type="register">62 DCR 1529</citation> </citations> <history url="http://lims.dccouncil.us/Legislation/B20-0797"> <narrative>Law 20-265, the “Federal Health Reform Implementation and Omnibus Amendment Act of 2014,” was introduced in Council and assigned Bill No. 20-797. The Bill was adopted on first and second readings on October 28, 2014, and November 18, 2014, respectively. Signed by the Mayor on January 25, 2015, it was assigned Act No. 20-604 and transmitted to Congress for its review. D.C. Law 20-265 became effective May 2, 2015.</narrative> </history> </meta> <section> <num>101</num> <codified:stub doc="D.C. Code" path="§31-3461"/> </section> <section> <num>201</num> <codified:stub doc="D.C. Code" path="§31-3821"/> </section> <section> <num>202</num> <codified:stub doc="D.C. Code" path="§31-3822"/> </section> </document>
{ "pile_set_name": "Github" }
/* * 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. */ package jdk.nashorn.internal.runtime.regexp.joni; import static jdk.nashorn.internal.runtime.regexp.joni.Option.isSingleline; import static jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode.isRepeatInfinite; import jdk.nashorn.internal.runtime.regexp.joni.ast.QuantifierNode; import jdk.nashorn.internal.runtime.regexp.joni.constants.AnchorType; import jdk.nashorn.internal.runtime.regexp.joni.constants.MetaChar; import jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType; import jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType; import jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages; import jdk.nashorn.internal.runtime.regexp.joni.exception.SyntaxException; import jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException; class Lexer extends ScannerSupport { protected final ScanEnvironment env; protected final Syntax syntax; // fast access to syntax protected final Token token = new Token(); // current token protected Lexer(final ScanEnvironment env, final char[] chars, final int p, final int end) { super(chars, p, end); this.env = env; this.syntax = env.syntax; } /** * @return 0: normal {n,m}, 2: fixed {n} * !introduce returnCode here */ private int fetchRangeQuantifier() { mark(); final boolean synAllow = syntax.allowInvalidInterval(); if (!left()) { if (synAllow) { return 1; /* "....{" : OK! */ } throw new SyntaxException(ERR_END_PATTERN_AT_LEFT_BRACE); } if (!synAllow) { c = peek(); if (c == ')' || c == '(' || c == '|') { throw new SyntaxException(ERR_END_PATTERN_AT_LEFT_BRACE); } } int low = scanUnsignedNumber(); if (low < 0) { throw new SyntaxException(ErrorMessages.ERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); } if (low > Config.MAX_REPEAT_NUM) { throw new SyntaxException(ErrorMessages.ERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); } boolean nonLow = false; if (p == _p) { /* can't read low */ if (syntax.allowIntervalLowAbbrev()) { low = 0; nonLow = true; } else { return invalidRangeQuantifier(synAllow); } } if (!left()) { return invalidRangeQuantifier(synAllow); } fetch(); int up; int ret = 0; if (c == ',') { final int prev = p; // ??? last up = scanUnsignedNumber(); if (up < 0) { throw new ValueException(ERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); } if (up > Config.MAX_REPEAT_NUM) { throw new ValueException(ERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE); } if (p == prev) { if (nonLow) { return invalidRangeQuantifier(synAllow); } up = QuantifierNode.REPEAT_INFINITE; /* {n,} : {n,infinite} */ } } else { if (nonLow) { return invalidRangeQuantifier(synAllow); } unfetch(); up = low; /* {n} : exact n times */ ret = 2; /* fixed */ } if (!left()) { return invalidRangeQuantifier(synAllow); } fetch(); if (syntax.opEscBraceInterval()) { if (c != syntax.metaCharTable.esc) { return invalidRangeQuantifier(synAllow); } fetch(); } if (c != '}') { return invalidRangeQuantifier(synAllow); } if (!isRepeatInfinite(up) && low > up) { throw new ValueException(ERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE); } token.type = TokenType.INTERVAL; token.setRepeatLower(low); token.setRepeatUpper(up); return ret; /* 0: normal {n,m}, 2: fixed {n} */ } private int invalidRangeQuantifier(final boolean synAllow) { if (synAllow) { restore(); return 1; } throw new SyntaxException(ERR_INVALID_REPEAT_RANGE_PATTERN); } @SuppressWarnings("fallthrough") /* \M-, \C-, \c, or \... */ private int fetchEscapedValue() { if (!left()) { throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE); } fetch(); switch(c) { case 'M': if (syntax.op2EscCapitalMBarMeta()) { if (!left()) { throw new SyntaxException(ERR_END_PATTERN_AT_META); } fetch(); if (c != '-') { throw new SyntaxException(ERR_META_CODE_SYNTAX); } if (!left()) { throw new SyntaxException(ERR_END_PATTERN_AT_META); } fetch(); if (c == syntax.metaCharTable.esc) { c = fetchEscapedValue(); } c = ((c & 0xff) | 0x80); } else { fetchEscapedValueBackSlash(); } break; case 'C': if (syntax.op2EscCapitalCBarControl()) { if (!left()) { throw new SyntaxException(ERR_END_PATTERN_AT_CONTROL); } fetch(); if (c != '-') { throw new SyntaxException(ERR_CONTROL_CODE_SYNTAX); } fetchEscapedValueControl(); } else { fetchEscapedValueBackSlash(); } break; case 'c': if (syntax.opEscCControl()) { fetchEscapedValueControl(); } /* fall through */ default: fetchEscapedValueBackSlash(); } // switch return c; // ??? } private void fetchEscapedValueBackSlash() { c = env.convertBackslashValue(c); } private void fetchEscapedValueControl() { if (!left()) { throw new SyntaxException(ERR_END_PATTERN_AT_CONTROL); } fetch(); if (c == '?') { c = 0177; } else { if (c == syntax.metaCharTable.esc) { c = fetchEscapedValue(); } c &= 0x9f; } } private void fetchTokenInCCFor_charType(final boolean flag, final int type) { token.type = TokenType.CHAR_TYPE; token.setPropCType(type); token.setPropNot(flag); } private void fetchTokenInCCFor_x() { if (!left()) { return; } final int last = p; if (peekIs('{') && syntax.opEscXBraceHex8()) { inc(); final int num = scanUnsignedHexadecimalNumber(8); if (num < 0) { throw new ValueException(ERR_TOO_BIG_WIDE_CHAR_VALUE); } if (left()) { final int c2 = peek(); if (EncodingHelper.isXDigit(c2)) { throw new ValueException(ERR_TOO_LONG_WIDE_CHAR_VALUE); } } if (p > last + 1 && left() && peekIs('}')) { inc(); token.type = TokenType.CODE_POINT; token.setCode(num); } else { /* can't read nothing or invalid format */ p = last; } } else if (syntax.opEscXHex2()) { int num = scanUnsignedHexadecimalNumber(2); if (num < 0) { throw new ValueException(ERR_TOO_BIG_NUMBER); } if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.RAW_BYTE; token.setC(num); } } private void fetchTokenInCCFor_u() { if (!left()) { return; } final int last = p; if (syntax.op2EscUHex4()) { int num = scanUnsignedHexadecimalNumber(4); if (num < 0) { throw new ValueException(ERR_TOO_BIG_NUMBER); } if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.CODE_POINT; token.setCode(num); } } private void fetchTokenInCCFor_digit() { if (syntax.opEscOctal3()) { unfetch(); final int last = p; int num = scanUnsignedOctalNumber(3); if (num < 0) { throw new ValueException(ERR_TOO_BIG_NUMBER); } if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.RAW_BYTE; token.setC(num); } } private void fetchTokenInCCFor_and() { if (syntax.op2CClassSetOp() && left() && peekIs('&')) { inc(); token.type = TokenType.CC_AND; } } protected final TokenType fetchTokenInCC() { if (!left()) { token.type = TokenType.EOT; return token.type; } fetch(); token.type = TokenType.CHAR; token.setC(c); token.escaped = false; if (c == ']') { token.type = TokenType.CC_CLOSE; } else if (c == '-') { token.type = TokenType.CC_RANGE; } else if (c == syntax.metaCharTable.esc) { if (!syntax.backSlashEscapeInCC()) { return token.type; } if (!left()) { throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE); } fetch(); token.escaped = true; token.setC(c); switch (c) { case 'w': fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD); break; case 'W': fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD); break; case 'd': fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT); break; case 'D': fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT); break; case 's': fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); break; case 'S': fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); break; case 'h': if (syntax.op2EscHXDigit()) { fetchTokenInCCFor_charType(false, CharacterType.XDIGIT); } break; case 'H': if (syntax.op2EscHXDigit()) { fetchTokenInCCFor_charType(true, CharacterType.XDIGIT); } break; case 'x': fetchTokenInCCFor_x(); break; case 'u': fetchTokenInCCFor_u(); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': fetchTokenInCCFor_digit(); break; default: unfetch(); final int num = fetchEscapedValue(); if (token.getC() != num) { token.setCode(num); token.type = TokenType.CODE_POINT; } break; } // switch } else if (c == '&') { fetchTokenInCCFor_and(); } return token.type; } private void fetchTokenFor_repeat(final int lower, final int upper) { token.type = TokenType.OP_REPEAT; token.setRepeatLower(lower); token.setRepeatUpper(upper); greedyCheck(); } private void fetchTokenFor_openBrace() { switch (fetchRangeQuantifier()) { case 0: greedyCheck(); break; case 2: if (syntax.fixedIntervalIsGreedyOnly()) { possessiveCheck(); } else { greedyCheck(); } break; default: /* 1 : normal char */ } // inner switch } private void fetchTokenFor_anchor(final int subType) { token.type = TokenType.ANCHOR; token.setAnchor(subType); } private void fetchTokenFor_xBrace() { if (!left()) { return; } final int last = p; if (peekIs('{') && syntax.opEscXBraceHex8()) { inc(); final int num = scanUnsignedHexadecimalNumber(8); if (num < 0) { throw new ValueException(ERR_TOO_BIG_WIDE_CHAR_VALUE); } if (left()) { if (EncodingHelper.isXDigit(peek())) { throw new ValueException(ERR_TOO_LONG_WIDE_CHAR_VALUE); } } if (p > last + 1 && left() && peekIs('}')) { inc(); token.type = TokenType.CODE_POINT; token.setCode(num); } else { /* can't read nothing or invalid format */ p = last; } } else if (syntax.opEscXHex2()) { int num = scanUnsignedHexadecimalNumber(2); if (num < 0) { throw new ValueException(ERR_TOO_BIG_NUMBER); } if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.RAW_BYTE; token.setC(num); } } private void fetchTokenFor_uHex() { if (!left()) { return; } final int last = p; if (syntax.op2EscUHex4()) { int num = scanUnsignedHexadecimalNumber(4); if (num < 0) { throw new ValueException(ERR_TOO_BIG_NUMBER); } if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.CODE_POINT; token.setCode(num); } } private void fetchTokenFor_digit() { unfetch(); final int last = p; final int num = scanUnsignedNumber(); if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref } else if (syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */ if (syntax.strictCheckBackref()) { if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) { throw new ValueException(ERR_INVALID_BACKREF); } } token.type = TokenType.BACKREF; token.setBackrefRef(num); return; } if (c == '8' || c == '9') { /* normal char */ // skip_backref: p = last; inc(); return; } p = last; fetchTokenFor_zero(); /* fall through */ } private void fetchTokenFor_zero() { if (syntax.opEscOctal3()) { final int last = p; int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3); if (num < 0) { throw new ValueException(ERR_TOO_BIG_NUMBER); } if (p == last) { /* can't read nothing. */ num = 0; /* but, it's not error */ } token.type = TokenType.RAW_BYTE; token.setC(num); } else if (c != '0') { inc(); } } private void fetchTokenFor_metaChars() { if (c == syntax.metaCharTable.anyChar) { token.type = TokenType.ANYCHAR; } else if (c == syntax.metaCharTable.anyTime) { fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE); } else if (c == syntax.metaCharTable.zeroOrOneTime) { fetchTokenFor_repeat(0, 1); } else if (c == syntax.metaCharTable.oneOrMoreTime) { fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE); } else if (c == syntax.metaCharTable.anyCharAnyTime) { token.type = TokenType.ANYCHAR_ANYTIME; // goto out } } protected final TokenType fetchToken() { // mark(); // out start: while(true) { if (!left()) { token.type = TokenType.EOT; return token.type; } token.type = TokenType.STRING; token.backP = p; fetch(); if (c == syntax.metaCharTable.esc && !syntax.op2IneffectiveEscape()) { // IS_MC_ESC_CODE(code, syn) if (!left()) { throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE); } token.backP = p; fetch(); token.setC(c); token.escaped = true; switch(c) { case '*': if (syntax.opEscAsteriskZeroInf()) { fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE); } break; case '+': if (syntax.opEscPlusOneInf()) { fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE); } break; case '?': if (syntax.opEscQMarkZeroOne()) { fetchTokenFor_repeat(0, 1); } break; case '{': if (syntax.opEscBraceInterval()) { fetchTokenFor_openBrace(); } break; case '|': if (syntax.opEscVBarAlt()) { token.type = TokenType.ALT; } break; case '(': if (syntax.opEscLParenSubexp()) { token.type = TokenType.SUBEXP_OPEN; } break; case ')': if (syntax.opEscLParenSubexp()) { token.type = TokenType.SUBEXP_CLOSE; } break; case 'w': if (syntax.opEscWWord()) { fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD); } break; case 'W': if (syntax.opEscWWord()) { fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD); } break; case 'b': if (syntax.opEscBWordBound()) { fetchTokenFor_anchor(AnchorType.WORD_BOUND); } break; case 'B': if (syntax.opEscBWordBound()) { fetchTokenFor_anchor(AnchorType.NOT_WORD_BOUND); } break; case '<': if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) { fetchTokenFor_anchor(AnchorType.WORD_BEGIN); } break; case '>': if (Config.USE_WORD_BEGIN_END && syntax.opEscLtGtWordBeginEnd()) { fetchTokenFor_anchor(AnchorType.WORD_END); } break; case 's': if (syntax.opEscSWhiteSpace()) { fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); } break; case 'S': if (syntax.opEscSWhiteSpace()) { fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE); } break; case 'd': if (syntax.opEscDDigit()) { fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT); } break; case 'D': if (syntax.opEscDDigit()) { fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT); } break; case 'h': if (syntax.op2EscHXDigit()) { fetchTokenInCCFor_charType(false, CharacterType.XDIGIT); } break; case 'H': if (syntax.op2EscHXDigit()) { fetchTokenInCCFor_charType(true, CharacterType.XDIGIT); } break; case 'A': if (syntax.opEscAZBufAnchor()) { fetchTokenFor_anchor(AnchorType.BEGIN_BUF); } break; case 'Z': if (syntax.opEscAZBufAnchor()) { fetchTokenFor_anchor(AnchorType.SEMI_END_BUF); } break; case 'z': if (syntax.opEscAZBufAnchor()) { fetchTokenFor_anchor(AnchorType.END_BUF); } break; case 'G': if (syntax.opEscCapitalGBeginAnchor()) { fetchTokenFor_anchor(AnchorType.BEGIN_POSITION); } break; case '`': if (syntax.op2EscGnuBufAnchor()) { fetchTokenFor_anchor(AnchorType.BEGIN_BUF); } break; case '\'': if (syntax.op2EscGnuBufAnchor()) { fetchTokenFor_anchor(AnchorType.END_BUF); } break; case 'x': fetchTokenFor_xBrace(); break; case 'u': fetchTokenFor_uHex(); break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': fetchTokenFor_digit(); break; case '0': fetchTokenFor_zero(); break; default: unfetch(); final int num = fetchEscapedValue(); /* set_raw: */ if (token.getC() != num) { token.type = TokenType.CODE_POINT; token.setCode(num); } else { /* string */ p = token.backP + 1; } break; } // switch (c) } else { token.setC(c); token.escaped = false; if (Config.USE_VARIABLE_META_CHARS && (c != MetaChar.INEFFECTIVE_META_CHAR && syntax.opVariableMetaCharacters())) { fetchTokenFor_metaChars(); break; } { switch(c) { case '.': if (syntax.opDotAnyChar()) { token.type = TokenType.ANYCHAR; } break; case '*': if (syntax.opAsteriskZeroInf()) { fetchTokenFor_repeat(0, QuantifierNode.REPEAT_INFINITE); } break; case '+': if (syntax.opPlusOneInf()) { fetchTokenFor_repeat(1, QuantifierNode.REPEAT_INFINITE); } break; case '?': if (syntax.opQMarkZeroOne()) { fetchTokenFor_repeat(0, 1); } break; case '{': if (syntax.opBraceInterval()) { fetchTokenFor_openBrace(); } break; case '|': if (syntax.opVBarAlt()) { token.type = TokenType.ALT; } break; case '(': if (peekIs('?') && syntax.op2QMarkGroupEffect()) { inc(); if (peekIs('#')) { fetch(); while (true) { if (!left()) { throw new SyntaxException(ERR_END_PATTERN_IN_GROUP); } fetch(); if (c == syntax.metaCharTable.esc) { if (left()) { fetch(); } } else { if (c == ')') { break; } } } continue start; // goto start } unfetch(); } if (syntax.opLParenSubexp()) { token.type = TokenType.SUBEXP_OPEN; } break; case ')': if (syntax.opLParenSubexp()) { token.type = TokenType.SUBEXP_CLOSE; } break; case '^': if (syntax.opLineAnchor()) { fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.BEGIN_BUF : AnchorType.BEGIN_LINE); } break; case '$': if (syntax.opLineAnchor()) { fetchTokenFor_anchor(isSingleline(env.option) ? AnchorType.END_BUF : AnchorType.END_LINE); } break; case '[': if (syntax.opBracketCC()) { token.type = TokenType.CC_CC_OPEN; } break; case ']': //if (*src > env->pattern) /* /].../ is allowed. */ //CLOSE_BRACKET_WITHOUT_ESC_WARN(env, (UChar* )"]"); break; case '#': if (Option.isExtend(env.option)) { while (left()) { fetch(); if (EncodingHelper.isNewLine(c)) { break; } } continue start; // goto start } break; case ' ': case '\t': case '\n': case '\r': case '\f': if (Option.isExtend(env.option)) { continue start; // goto start } break; default: // string break; } // switch } } break; } // while return token.type; } private void greedyCheck() { if (left() && peekIs('?') && syntax.opQMarkNonGreedy()) { fetch(); token.setRepeatGreedy(false); token.setRepeatPossessive(false); } else { possessiveCheck(); } } private void possessiveCheck() { if (left() && peekIs('+') && (syntax.op2PlusPossessiveRepeat() && token.type != TokenType.INTERVAL || syntax.op2PlusPossessiveInterval() && token.type == TokenType.INTERVAL)) { fetch(); token.setRepeatGreedy(true); token.setRepeatPossessive(true); } else { token.setRepeatGreedy(true); token.setRepeatPossessive(false); } } protected final void syntaxWarn(final String message, final char ch) { syntaxWarn(message.replace("<%n>", Character.toString(ch))); } protected final void syntaxWarn(final String message) { if (Config.USE_WARN) { env.reg.warnings.warn(message + ": /" + new String(chars, getBegin(), getEnd()) + "/"); } } }
{ "pile_set_name": "Github" }
//===- PruneEH.cpp - Pass which deletes unused exception handlers ---------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file implements a simple interprocedural pass which walks the // call-graph, turning invoke instructions into calls, iff the callee cannot // throw an exception, and marking functions 'nounwind' if they cannot throw. // It implements this as a bottom-up traversal of the call-graph. // //===----------------------------------------------------------------------===// #define DEBUG_TYPE "prune-eh" #include "llvm/Transforms/IPO.h" #include "llvm/CallGraphSCCPass.h" #include "llvm/Constants.h" #include "llvm/Function.h" #include "llvm/LLVMContext.h" #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/CFG.h" #include <algorithm> using namespace llvm; STATISTIC(NumRemoved, "Number of invokes removed"); STATISTIC(NumUnreach, "Number of noreturn calls optimized"); namespace { struct PruneEH : public CallGraphSCCPass { static char ID; // Pass identification, replacement for typeid PruneEH() : CallGraphSCCPass(ID) { initializePruneEHPass(*PassRegistry::getPassRegistry()); } // runOnSCC - Analyze the SCC, performing the transformation if possible. bool runOnSCC(CallGraphSCC &SCC); bool SimplifyFunction(Function *F); void DeleteBasicBlock(BasicBlock *BB); }; } char PruneEH::ID = 0; INITIALIZE_PASS_BEGIN(PruneEH, "prune-eh", "Remove unused exception handling info", false, false) INITIALIZE_AG_DEPENDENCY(CallGraph) INITIALIZE_PASS_END(PruneEH, "prune-eh", "Remove unused exception handling info", false, false) Pass *llvm::createPruneEHPass() { return new PruneEH(); } bool PruneEH::runOnSCC(CallGraphSCC &SCC) { SmallPtrSet<CallGraphNode *, 8> SCCNodes; CallGraph &CG = getAnalysis<CallGraph>(); bool MadeChange = false; // Fill SCCNodes with the elements of the SCC. Used for quickly // looking up whether a given CallGraphNode is in this SCC. for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) SCCNodes.insert(*I); // First pass, scan all of the functions in the SCC, simplifying them // according to what we know. for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) if (Function *F = (*I)->getFunction()) MadeChange |= SimplifyFunction(F); // Next, check to see if any callees might throw or if there are any external // functions in this SCC: if so, we cannot prune any functions in this SCC. // Definitions that are weak and not declared non-throwing might be // overridden at linktime with something that throws, so assume that. // If this SCC includes the unwind instruction, we KNOW it throws, so // obviously the SCC might throw. // bool SCCMightUnwind = false, SCCMightReturn = false; for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); (!SCCMightUnwind || !SCCMightReturn) && I != E; ++I) { Function *F = (*I)->getFunction(); if (F == 0) { SCCMightUnwind = true; SCCMightReturn = true; } else if (F->isDeclaration() || F->mayBeOverridden()) { SCCMightUnwind |= !F->doesNotThrow(); SCCMightReturn |= !F->doesNotReturn(); } else { bool CheckUnwind = !SCCMightUnwind && !F->doesNotThrow(); bool CheckReturn = !SCCMightReturn && !F->doesNotReturn(); if (!CheckUnwind && !CheckReturn) continue; // Check to see if this function performs an unwind or calls an // unwinding function. for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { if (CheckUnwind && isa<ResumeInst>(BB->getTerminator())) { // Uses unwind / resume! SCCMightUnwind = true; } else if (CheckReturn && isa<ReturnInst>(BB->getTerminator())) { SCCMightReturn = true; } // Invoke instructions don't allow unwinding to continue, so we are // only interested in call instructions. if (CheckUnwind && !SCCMightUnwind) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) if (CallInst *CI = dyn_cast<CallInst>(I)) { if (CI->doesNotThrow()) { // This call cannot throw. } else if (Function *Callee = CI->getCalledFunction()) { CallGraphNode *CalleeNode = CG[Callee]; // If the callee is outside our current SCC then we may // throw because it might. if (!SCCNodes.count(CalleeNode)) { SCCMightUnwind = true; break; } } else { // Indirect call, it might throw. SCCMightUnwind = true; break; } } if (SCCMightUnwind && SCCMightReturn) break; } } } // If the SCC doesn't unwind or doesn't throw, note this fact. if (!SCCMightUnwind || !SCCMightReturn) for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) { Attributes NewAttributes = Attribute::None; if (!SCCMightUnwind) NewAttributes |= Attribute::NoUnwind; if (!SCCMightReturn) NewAttributes |= Attribute::NoReturn; Function *F = (*I)->getFunction(); const AttrListPtr &PAL = F->getAttributes(); const AttrListPtr &NPAL = PAL.addAttr(~0, NewAttributes); if (PAL != NPAL) { MadeChange = true; F->setAttributes(NPAL); } } for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) { // Convert any invoke instructions to non-throwing functions in this node // into call instructions with a branch. This makes the exception blocks // dead. if (Function *F = (*I)->getFunction()) MadeChange |= SimplifyFunction(F); } return MadeChange; } // SimplifyFunction - Given information about callees, simplify the specified // function if we have invokes to non-unwinding functions or code after calls to // no-return functions. bool PruneEH::SimplifyFunction(Function *F) { bool MadeChange = false; for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) if (II->doesNotThrow()) { SmallVector<Value*, 8> Args(II->op_begin(), II->op_end() - 3); // Insert a call instruction before the invoke. CallInst *Call = CallInst::Create(II->getCalledValue(), Args, "", II); Call->takeName(II); Call->setCallingConv(II->getCallingConv()); Call->setAttributes(II->getAttributes()); Call->setDebugLoc(II->getDebugLoc()); // Anything that used the value produced by the invoke instruction // now uses the value produced by the call instruction. Note that we // do this even for void functions and calls with no uses so that the // callgraph edge is updated. II->replaceAllUsesWith(Call); BasicBlock *UnwindBlock = II->getUnwindDest(); UnwindBlock->removePredecessor(II->getParent()); // Insert a branch to the normal destination right before the // invoke. BranchInst::Create(II->getNormalDest(), II); // Finally, delete the invoke instruction! BB->getInstList().pop_back(); // If the unwind block is now dead, nuke it. if (pred_begin(UnwindBlock) == pred_end(UnwindBlock)) DeleteBasicBlock(UnwindBlock); // Delete the new BB. ++NumRemoved; MadeChange = true; } for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) if (CallInst *CI = dyn_cast<CallInst>(I++)) if (CI->doesNotReturn() && !isa<UnreachableInst>(I)) { // This call calls a function that cannot return. Insert an // unreachable instruction after it and simplify the code. Do this // by splitting the BB, adding the unreachable, then deleting the // new BB. BasicBlock *New = BB->splitBasicBlock(I); // Remove the uncond branch and add an unreachable. BB->getInstList().pop_back(); new UnreachableInst(BB->getContext(), BB); DeleteBasicBlock(New); // Delete the new BB. MadeChange = true; ++NumUnreach; break; } } return MadeChange; } /// DeleteBasicBlock - remove the specified basic block from the program, /// updating the callgraph to reflect any now-obsolete edges due to calls that /// exist in the BB. void PruneEH::DeleteBasicBlock(BasicBlock *BB) { assert(pred_begin(BB) == pred_end(BB) && "BB is not dead!"); CallGraph &CG = getAnalysis<CallGraph>(); CallGraphNode *CGN = CG[BB->getParent()]; for (BasicBlock::iterator I = BB->end(), E = BB->begin(); I != E; ) { --I; if (CallInst *CI = dyn_cast<CallInst>(I)) { if (!isa<IntrinsicInst>(I)) CGN->removeCallEdgeFor(CI); } else if (InvokeInst *II = dyn_cast<InvokeInst>(I)) CGN->removeCallEdgeFor(II); if (!I->use_empty()) I->replaceAllUsesWith(UndefValue::get(I->getType())); } // Get the list of successors of this block. std::vector<BasicBlock*> Succs(succ_begin(BB), succ_end(BB)); for (unsigned i = 0, e = Succs.size(); i != e; ++i) Succs[i]->removePredecessor(BB); BB->eraseFromParent(); }
{ "pile_set_name": "Github" }
#!/bin/bash # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. mkdir tmp cp a.js tmp/ start_flow . printf "\\nSubtyping over type applications of the same polymorphic type unifies their type arguments.\\n" assert_errors "$FLOW" status --strip-root printf "\\nAn upstream edit that does not touch the polymorphic type should preserve this behavior.\\n" cp tmp1/a.js a.js assert_ok "$FLOW" force-recheck --focus a.js assert_errors "$FLOW" status --strip-root assert_ok "$FLOW" stop mv tmp/a.js a.js rmdir tmp
{ "pile_set_name": "Github" }
// +build !ignore_autogenerated /* Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Code generated by deepcopy-gen. DO NOT EDIT. package v1alpha1 import ( runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumeAttachment) DeepCopyInto(out *VolumeAttachment) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) in.Status.DeepCopyInto(&out.Status) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeAttachment. func (in *VolumeAttachment) DeepCopy() *VolumeAttachment { if in == nil { return nil } out := new(VolumeAttachment) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *VolumeAttachment) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumeAttachmentList) DeepCopyInto(out *VolumeAttachmentList) { *out = *in out.TypeMeta = in.TypeMeta out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items *out = make([]VolumeAttachment, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeAttachmentList. func (in *VolumeAttachmentList) DeepCopy() *VolumeAttachmentList { if in == nil { return nil } out := new(VolumeAttachmentList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. func (in *VolumeAttachmentList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumeAttachmentSource) DeepCopyInto(out *VolumeAttachmentSource) { *out = *in if in.PersistentVolumeName != nil { in, out := &in.PersistentVolumeName, &out.PersistentVolumeName *out = new(string) **out = **in } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeAttachmentSource. func (in *VolumeAttachmentSource) DeepCopy() *VolumeAttachmentSource { if in == nil { return nil } out := new(VolumeAttachmentSource) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumeAttachmentSpec) DeepCopyInto(out *VolumeAttachmentSpec) { *out = *in in.Source.DeepCopyInto(&out.Source) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeAttachmentSpec. func (in *VolumeAttachmentSpec) DeepCopy() *VolumeAttachmentSpec { if in == nil { return nil } out := new(VolumeAttachmentSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumeAttachmentStatus) DeepCopyInto(out *VolumeAttachmentStatus) { *out = *in if in.AttachmentMetadata != nil { in, out := &in.AttachmentMetadata, &out.AttachmentMetadata *out = make(map[string]string, len(*in)) for key, val := range *in { (*out)[key] = val } } if in.AttachError != nil { in, out := &in.AttachError, &out.AttachError *out = new(VolumeError) (*in).DeepCopyInto(*out) } if in.DetachError != nil { in, out := &in.DetachError, &out.DetachError *out = new(VolumeError) (*in).DeepCopyInto(*out) } return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeAttachmentStatus. func (in *VolumeAttachmentStatus) DeepCopy() *VolumeAttachmentStatus { if in == nil { return nil } out := new(VolumeAttachmentStatus) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VolumeError) DeepCopyInto(out *VolumeError) { *out = *in in.Time.DeepCopyInto(&out.Time) return } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeError. func (in *VolumeError) DeepCopy() *VolumeError { if in == nil { return nil } out := new(VolumeError) in.DeepCopyInto(out) return out }
{ "pile_set_name": "Github" }
@import 'ej2-documenteditor/styles/document-editor/material-dark.scss';
{ "pile_set_name": "Github" }
{FORM} <form method="post" action="{FORMACTION}"> <input type="hidden" name="form[db_flag]" value="1"/> <table class="std"> <tr class="tblheader"> <td class="std" colspan="3">{TXT_DB_HEADER}</td> </tr> <tr> <td class="option">{TXT_DB_TYPE}</td> <td class="option_value" colspan="2">{VAL_DB_TYPE}</td> </tr> <tr> <td class="option">{TXT_DB_VERSION}</td> <td class="option_value" colspan="2">{VAL_DB_VERSION}</td> </tr> <!-- <tr> <td class="option">{TXT_DB_MODE} <span style="color:#FF0000;">[*]</span></td> <td class="option_value" colspan="2">{VAL_DB_MODE}</td> </tr> --> <tr> <td class="option">{TXT_DB_HOST}</td> <td class="option_value" colspan="2">{DB_HOST}</td> </tr> <tr> <td class="option">{TXT_DB_NAME}</td> <td class="option_value" colspan="2">{DB_NAME}</td> </tr> <tr> <td class="option">{TXT_DB_USER}</td> <td class="option_value" colspan="2">{DB_USER}</td> </tr> <!-- <tr> <td class="option">{TXT_DB_PASS}</td> <td class="option_value" colspan="2">{DB_PASS}</td> </tr> --> <!-- BEGIN collation_selection --> <tr> <td class="option">{TXT_COLLATION}</td> <td class="option_value" colspan="2"> <select name="collation"> <!-- BEGIN collation_item --> <option value="{VAL_COLLATION_ITEM}">{TXT_COLLATION_ITEM}</option> <!-- END collation_item --> </select> </td> </tr> <!-- END collation_selection --> <!-- BEGIN option_db_create --> <tr> <td class="option"><label for="chk_db_create">{TXT_DB_CREATE}</label></td> <td class="option_value" colspan="2"><input type="checkbox" name="form[chk_db_create]" value="1" id="chk_db_create" {DB_CREATE_CHECK}/></td> </tr> <!-- END option_db_create --> <!-- BEGIN btn_submit --> <tr> <td class="submit" colspan="3"> <div align="right"><input class="btn btn-default" type="submit" name="cmd[db]" value="{TXT_SAVE}"/></div> </td> </tr> <!-- END btn_submit --> </table> </form> {COLLATION_INFO2} </div>
{ "pile_set_name": "Github" }
/* * This file is part of gitg * * Copyright (C) 2013 - Jesse van den Kieboom * * gitg 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. * * gitg 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 gitg. If not, see <http://www.gnu.org/licenses/>. */ using Gitg.Test.Assert; class Gitg.Test.Repository : Gitg.Test.Test { protected Gitg.Repository? d_repository; private uint d_current_time; struct File { public string filename; public string? contents; } private File[] files_from_varargs(string? filename, va_list l) { File[] files = new File[] {}; while (filename != null) { string contents = l.arg(); files += File() { filename = filename, contents = contents }; filename = l.arg(); } return files; } private File[] filenames_from_varargs(string? filename, va_list l) { File[] files = new File[] {}; while (filename != null) { files += File() { filename = filename, contents = null }; filename = l.arg(); } return files; } public void assert_file_contents(string filename, string expected_contents) { var wd = d_repository.get_workdir(); Assert.assert_file_contents(Path.build_filename(wd.get_path(), filename), expected_contents); } public bool file_exists(string filename) { return d_repository.get_workdir().get_child(filename).query_exists(); } private void write_files(File[] files) { var wd = d_repository.get_workdir(); foreach (var f in files) { var fp = wd.get_child(f.filename); try { var os = fp.replace(null, false, GLib.FileCreateFlags.NONE, null); os.write(f.contents.data); os.close(); } catch (GLib.Error e) { Assert.assert_no_error(e); } } } protected void write_file(string filename, string contents) { write_files(new File[] { File() { filename = filename, contents = contents } }); } public Ggit.Signature? get_verified_committer() { try { return new Ggit.Signature("gitg tester", "[email protected]", new DateTime.from_unix_utc(d_current_time++)); } catch (Error e) { Assert.assert_no_error(e); return null; } } protected void commit(string? filename, ...) { if (d_repository == null) { return; } var files = files_from_varargs(filename, va_list()); write_files(files); // use the index to stage the files Ggit.Index index; try { index = d_repository.get_index(); } catch (GLib.Error e) { Assert.assert_no_error(e); return; } foreach (var f in files) { try { index.add_path(f.filename); } catch (GLib.Error e) { Assert.assert_no_error(e); } } Ggit.OId treeoid; try { index.write(); treeoid = index.write_tree(); } catch (GLib.Error e) { Assert.assert_no_error(e); return; } // create commit var sig = get_verified_committer(); Ggit.Tree tree; try { tree = d_repository.lookup<Ggit.Tree>(treeoid); } catch (GLib.Error e) { Assert.assert_no_error(e); return; } Ggit.OId commitoid; Ggit.Ref? head = null; Ggit.Commit? parent = null; try { head = d_repository.get_head(); parent = head.lookup() as Ggit.Commit; } catch {} try { Ggit.Commit[] parents; if (parent != null) { parents = new Ggit.Commit[] { parent }; } else { parents = new Ggit.Commit[] {}; } commitoid = d_repository.create_commit("HEAD", sig, sig, null, "commit " + filename, tree, parents); } catch (GLib.Error e) { Assert.assert_no_error(e); return; } } protected void workdir_remove(string? filename, ...) { if (d_repository == null) { return; } var files = filenames_from_varargs(filename, va_list()); var wd = d_repository.get_workdir(); foreach (var f in files) { var fs = wd.get_child(f.filename); try { fs.delete(); } catch (GLib.Error e) { Assert.assert_no_error(e); } } } protected void workdir_modify(string? filename, ...) { if (d_repository == null) { return; } var files = files_from_varargs(filename, va_list()); write_files(files); } protected void index_modify(string? filename, ...) { if (d_repository == null) { return; } var files = files_from_varargs(filename, va_list()); Ggit.OId id; Ggit.Index index; try { index = d_repository.get_index(); } catch (GLib.Error e) { Assert.assert_no_error(e); return; } // Stage modifications in the index foreach (var f in files) { try { id = d_repository.create_blob_from_buffer(f.contents.data); } catch (GLib.Error e) { Assert.assert_no_error(e); continue; } try { var entry = d_repository.create_index_entry_for_path(f.filename, id); index.add(entry); } catch (GLib.Error e) { Assert.assert_no_error(e); } } try { index.write(); } catch (GLib.Error e) { Assert.assert_no_error(e); } } protected Gitg.Branch? create_branch(string name) { try { var commit = d_repository.lookup<Gitg.Commit>(d_repository.get_head().get_target()); return d_repository.create_branch(name, commit, Ggit.CreateFlags.NONE); } catch (Error e) { Assert.assert_no_error(e); return null; } } protected void checkout_branch(string name) { try { var branch = d_repository.lookup_reference_dwim(name) as Gitg.Branch; var commit = branch.resolve().lookup() as Ggit.Commit; var tree = commit.get_tree(); var opts = new Ggit.CheckoutOptions(); opts.set_strategy(Ggit.CheckoutStrategy.SAFE); d_repository.checkout_tree(tree, opts); d_repository.set_head(branch.get_name()); } catch (Error e) { Assert.assert_no_error(e); return; } } protected override void set_up() { string wd; d_current_time = 0; try { wd = GLib.DirUtils.make_tmp("gitg-test-XXXXXX"); } catch (GLib.Error e) { Assert.assert_no_error(e); return; } var f = GLib.File.new_for_path(wd); try { d_repository = (Gitg.Repository)Ggit.Repository.init_repository(f, false); } catch (GLib.Error e) { GLib.DirUtils.remove(wd); Assert.assert_no_error(e); } } private void remove_recursively(GLib.File f) { try { var info = f.query_info("standard::*", FileQueryInfoFlags.NONE); if (info.get_file_type() == FileType.DIRECTORY) { var e = f.enumerate_children("standard::*", FileQueryInfoFlags.NONE); while ((info = e.next_file()) != null) { var c = f.get_child(info.get_name()); remove_recursively(c); } } f.delete(); } catch (Error e) { stderr.printf("Failed to remove %s: %s\n", f.get_path(), e.message); } } protected Gitg.Branch? lookup_branch(string name) { try { var ret = d_repository.lookup_reference_dwim(name) as Gitg.Branch; assert_nonnull(ret); return ret; } catch (Error e) { Assert.assert_no_error(e); } return null; } protected Gitg.Commit? lookup_commit(string name) { try { var ret = lookup_branch(name).lookup() as Gitg.Commit; assert_nonnull(ret); return ret; } catch (Error e) { Assert.assert_no_error(e); } return null; } protected override void tear_down() { if (d_repository == null) { return; } remove_recursively(d_repository.get_workdir()); d_repository = null; } } // ex:set ts=4 noet
{ "pile_set_name": "Github" }
#import "GPUImageFilter.h" @interface GPUImageZoomBlurFilter : GPUImageFilter /** A multiplier for the blur size, ranging from 0.0 on up, with a default of 1.0 */ @property (readwrite, nonatomic) CGFloat blurSize; /** The normalized center of the blur. (0.5, 0.5) by default */ @property (readwrite, nonatomic) CGPoint blurCenter; @end
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_172) on Wed Mar 13 10:37:22 EDT 2019 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>PerformanceMonitorFactory (jrugged-core 4.0.0-SNAPSHOT API)</title> <meta name="date" content="2019-03-13"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="PerformanceMonitorFactory (jrugged-core 4.0.0-SNAPSHOT API)"; } } catch(err) { } //--> var methods = {"i0":10,"i1":10,"i2":10,"i3":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/PerformanceMonitorFactory.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../org/fishwife/jrugged/RequestCounter.html" title="class in org.fishwife.jrugged"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?org/fishwife/jrugged/PerformanceMonitorFactory.html" target="_top">Frames</a></li> <li><a href="PerformanceMonitorFactory.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.fishwife.jrugged</div> <h2 title="Class PerformanceMonitorFactory" class="title">Class PerformanceMonitorFactory</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> <li> <ul class="inheritance"> <li>org.fishwife.jrugged.PerformanceMonitorFactory</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre>public class <span class="typeNameLabel">PerformanceMonitorFactory</span> extends <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> <div class="block">Factory to create new <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a> instances and keep track of them.</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../org/fishwife/jrugged/PerformanceMonitorFactory.html#PerformanceMonitorFactory--">PerformanceMonitorFactory</a></span>()</code> <div class="block">Create an empty PerformanceMonitorFactory.</div> </td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code>protected void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/fishwife/jrugged/PerformanceMonitorFactory.html#addPerformanceMonitorToMap-java.lang.String-org.fishwife.jrugged.PerformanceMonitor-">addPerformanceMonitorToMap</a></span>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name, <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged">PerformanceMonitor</a>&nbsp;performanceMonitor)</code> <div class="block">Add a <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a> to the map.</div> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code><a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged">PerformanceMonitor</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/fishwife/jrugged/PerformanceMonitorFactory.html#createPerformanceMonitor-java.lang.String-">createPerformanceMonitor</a></span>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code> <div class="block">Create a new <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a> and map it to the provided name.</div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code><a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged">PerformanceMonitor</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/fishwife/jrugged/PerformanceMonitorFactory.html#findPerformanceMonitor-java.lang.String-">findPerformanceMonitor</a></span>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</code> <div class="block">Find an existing <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a></div> </td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code><a href="http://docs.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/fishwife/jrugged/PerformanceMonitorFactory.html#getPerformanceMonitorNames--">getPerformanceMonitorNames</a></span>()</code> <div class="block">Get the <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util"><code>Set</code></a> of created performance monitor names.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> <code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="PerformanceMonitorFactory--"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>PerformanceMonitorFactory</h4> <pre>public&nbsp;PerformanceMonitorFactory()</pre> <div class="block">Create an empty PerformanceMonitorFactory.</div> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="createPerformanceMonitor-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>createPerformanceMonitor</h4> <pre>public&nbsp;<a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged">PerformanceMonitor</a>&nbsp;createPerformanceMonitor(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre> <div class="block">Create a new <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a> and map it to the provided name. If the PerformanceMonitor already exists, then the existing instance is returned.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>name</code> - the name for the <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the created <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a></dd> </dl> </li> </ul> <a name="findPerformanceMonitor-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>findPerformanceMonitor</h4> <pre>public&nbsp;<a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged">PerformanceMonitor</a>&nbsp;findPerformanceMonitor(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name)</pre> <div class="block">Find an existing <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>name</code> - the name for the <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a></dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the found <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a>, or null if it is not found.</dd> </dl> </li> </ul> <a name="getPerformanceMonitorNames--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getPerformanceMonitorNames</h4> <pre>public&nbsp;<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a>&lt;<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;getPerformanceMonitorNames()</pre> <div class="block">Get the <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util"><code>Set</code></a> of created performance monitor names.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>the <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util"><code>Set</code></a> of names.</dd> </dl> </li> </ul> <a name="addPerformanceMonitorToMap-java.lang.String-org.fishwife.jrugged.PerformanceMonitor-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>addPerformanceMonitorToMap</h4> <pre>protected&nbsp;void&nbsp;addPerformanceMonitorToMap(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;name, <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged">PerformanceMonitor</a>&nbsp;performanceMonitor)</pre> <div class="block">Add a <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a> to the map.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>name</code> - the name for the <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a></dd> <dd><code>performanceMonitor</code> - the <a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><code>PerformanceMonitor</code></a> to add.</dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/PerformanceMonitorFactory.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../org/fishwife/jrugged/PerformanceMonitor.html" title="class in org.fishwife.jrugged"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../org/fishwife/jrugged/RequestCounter.html" title="class in org.fishwife.jrugged"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?org/fishwife/jrugged/PerformanceMonitorFactory.html" target="_top">Frames</a></li> <li><a href="PerformanceMonitorFactory.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2019. All Rights Reserved.</small></p> </body> </html>
{ "pile_set_name": "Github" }
/* * S/390 integer helper routines * * Copyright (c) 2009 Ulrich Hecht * Copyright (c) 2009 Alexander Graf * * 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. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" #include "cpu.h" #include "internal.h" #include "tcg_s390x.h" #include "exec/exec-all.h" #include "qemu/host-utils.h" #include "exec/helper-proto.h" /* #define DEBUG_HELPER */ #ifdef DEBUG_HELPER #define HELPER_LOG(x...) qemu_log(x) #else #define HELPER_LOG(x...) #endif /* 64/32 -> 32 signed division */ int64_t HELPER(divs32)(CPUS390XState *env, int64_t a, int64_t b64) { int32_t ret, b = b64; int64_t q; if (b == 0) { tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC()); } ret = q = a / b; env->retxl = a % b; /* Catch non-representable quotient. */ if (ret != q) { tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC()); } return ret; } /* 64/32 -> 32 unsigned division */ uint64_t HELPER(divu32)(CPUS390XState *env, uint64_t a, uint64_t b64) { uint32_t ret, b = b64; uint64_t q; if (b == 0) { tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC()); } ret = q = a / b; env->retxl = a % b; /* Catch non-representable quotient. */ if (ret != q) { tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC()); } return ret; } /* 64/64 -> 64 signed division */ int64_t HELPER(divs64)(CPUS390XState *env, int64_t a, int64_t b) { /* Catch divide by zero, and non-representable quotient (MIN / -1). */ if (b == 0 || (b == -1 && a == (1ll << 63))) { tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC()); } env->retxl = a % b; return a / b; } /* 128 -> 64/64 unsigned division */ uint64_t HELPER(divu64)(CPUS390XState *env, uint64_t ah, uint64_t al, uint64_t b) { uint64_t ret; /* Signal divide by zero. */ if (b == 0) { tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC()); } if (ah == 0) { /* 64 -> 64/64 case */ env->retxl = al % b; ret = al / b; } else { /* ??? Move i386 idivq helper to host-utils. */ #ifdef CONFIG_INT128 __uint128_t a = ((__uint128_t)ah << 64) | al; __uint128_t q = a / b; env->retxl = a % b; ret = q; if (ret != q) { tcg_s390_program_interrupt(env, PGM_FIXPT_DIVIDE, GETPC()); } #else /* 32-bit hosts would need special wrapper functionality - just abort if we encounter such a case; it's very unlikely anyways. */ cpu_abort(env_cpu(env), "128 -> 64/64 division not implemented\n"); #endif } return ret; } uint64_t HELPER(cvd)(int32_t reg) { /* positive 0 */ uint64_t dec = 0x0c; int64_t bin = reg; int shift; if (bin < 0) { bin = -bin; dec = 0x0d; } for (shift = 4; (shift < 64) && bin; shift += 4) { dec |= (bin % 10) << shift; bin /= 10; } return dec; } uint64_t HELPER(popcnt)(uint64_t val) { /* Note that we don't fold past bytes. */ val = (val & 0x5555555555555555ULL) + ((val >> 1) & 0x5555555555555555ULL); val = (val & 0x3333333333333333ULL) + ((val >> 2) & 0x3333333333333333ULL); val = (val + (val >> 4)) & 0x0f0f0f0f0f0f0f0fULL; return val; }
{ "pile_set_name": "Github" }
/* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* There may be prolems include all of theese. Try to test in configure with ones are needed? */ /* This is needed for the definitions of strchr... on solaris */ #ifndef _m_string_h #define _m_string_h #include "my_global.h" /* HAVE_* */ #ifndef __USE_GNU #define __USE_GNU /* We want to use stpcpy */ #endif #if defined(HAVE_STRINGS_H) #include <strings.h> #endif #if defined(HAVE_STRING_H) #include <string.h> #endif /* need by my_vsnprintf */ #include <stdarg.h> /* This is needed for the definitions of bzero... on solaris */ #if defined(HAVE_STRINGS_H) #include <strings.h> #endif /* This is needed for the definitions of memcpy... on solaris */ #if defined(HAVE_MEMORY_H) && !defined(__cplusplus) #include <memory.h> #endif #if !defined(HAVE_MEMCPY) && !defined(HAVE_MEMMOVE) # define memcpy(d, s, n) bcopy ((s), (d), (n)) # define memset(A,C,B) bfill((A),(B),(C)) # define memmove(d, s, n) bmove ((d), (s), (n)) #elif defined(HAVE_MEMMOVE) # define bmove(d, s, n) memmove((d), (s), (n)) #endif /* Unixware 7 */ #if !defined(HAVE_BFILL) # define bfill(A,B,C) memset((A),(C),(B)) #endif #if !defined(bzero) && !defined(HAVE_BZERO) # define bzero(A,B) memset((A),0,(B)) #endif #if defined(__cplusplus) extern "C" { #endif /* my_str_malloc() and my_str_free() are assigned to implementations in strings/alloc.c, but can be overridden in the calling program. */ extern void *(*my_str_malloc)(size_t); extern void (*my_str_free)(void *); #if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER) #define strmov(A,B) __builtin_stpcpy((A),(B)) #elif defined(HAVE_STPCPY) #define strmov(A,B) stpcpy((A),(B)) #ifndef stpcpy extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ #endif #endif /* Declared in int2str() */ extern char _dig_vec_upper[]; extern char _dig_vec_lower[]; #ifndef strmov #define strmov_overlapp(A,B) strmov(A,B) #define strmake_overlapp(A,B,C) strmake(A,B,C) #endif /* Prototypes for string functions */ extern void bmove_upp(uchar *dst,const uchar *src,size_t len); extern void bchange(uchar *dst,size_t old_len,const uchar *src, size_t new_len,size_t tot_len); extern void strappend(char *s,size_t len,pchar fill); extern char *strend(const char *s); extern char *strcend(const char *, pchar); extern char *strfill(char * s,size_t len,pchar fill); extern char *strmake(char *dst,const char *src,size_t length); #ifndef strmov extern char *strmov(char *dst,const char *src); #else extern char *strmov_overlapp(char *dst,const char *src); #endif extern char *strnmov(char *dst, const char *src, size_t n); extern char *strcont(const char *src, const char *set); extern char *strxmov(char *dst, const char *src, ...); extern char *strxnmov(char *dst, size_t len, const char *src, ...); /* Prototypes of normal stringfunctions (with may ours) */ #ifndef HAVE_STRNLEN extern size_t strnlen(const char *s, size_t n); #endif extern int is_prefix(const char *, const char *); /* Conversion routines */ typedef enum { MY_GCVT_ARG_FLOAT, MY_GCVT_ARG_DOUBLE } my_gcvt_arg_type; double my_strtod(const char *str, char **end, int *error); double my_atof(const char *nptr); size_t my_fcvt(double x, int precision, char *to, my_bool *error); size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to, my_bool *error); #define NOT_FIXED_DEC 31 /* The longest string my_fcvt can return is 311 + "precision" bytes. Here we assume that we never cal my_fcvt() with precision >= NOT_FIXED_DEC (+ 1 byte for the terminating '\0'). */ #define FLOATING_POINT_BUFFER (311 + NOT_FIXED_DEC) /* We want to use the 'e' format in some cases even if we have enough space for the 'f' one just to mimic sprintf("%.15g") behavior for large integers, and to improve it for numbers < 10^(-4). That is, for |x| < 1 we require |x| >= 10^(-15), and for |x| > 1 we require it to be integer and be <= 10^DBL_DIG for the 'f' format to be used. We don't lose precision, but make cases like "1e200" or "0.00001" look nicer. */ #define MAX_DECPT_FOR_F_FORMAT DBL_DIG /* The maximum possible field width for my_gcvt() conversion. (DBL_DIG + 2) significant digits + sign + "." + ("e-NNN" or MAX_DECPT_FOR_F_FORMAT zeros for cases when |x|<1 and the 'f' format is used). */ #define MY_GCVT_MAX_FIELD_WIDTH (DBL_DIG + 4 + max(5, MAX_DECPT_FOR_F_FORMAT)) \ extern char *llstr(longlong value,char *buff); extern char *ullstr(longlong value,char *buff); #ifndef HAVE_STRTOUL extern long strtol(const char *str, char **ptr, int base); extern ulong strtoul(const char *str, char **ptr, int base); #endif extern char *int2str(long val, char *dst, int radix, int upcase); extern char *int10_to_str(long val,char *dst,int radix); extern char *str2int(const char *src,int radix,long lower,long upper, long *val); longlong my_strtoll10(const char *nptr, char **endptr, int *error); #if SIZEOF_LONG == SIZEOF_LONG_LONG #define ll2str(A,B,C,D) int2str((A),(B),(C),(D)) #define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C)) #undef strtoll #define strtoll(A,B,C) strtol((A),(B),(C)) #define strtoull(A,B,C) strtoul((A),(B),(C)) #ifndef HAVE_STRTOULL #define HAVE_STRTOULL #endif #ifndef HAVE_STRTOLL #define HAVE_STRTOLL #endif #else #ifdef HAVE_LONG_LONG extern char *ll2str(longlong val,char *dst,int radix, int upcase); extern char *longlong10_to_str(longlong val,char *dst,int radix); #if (!defined(HAVE_STRTOULL) || defined(NO_STRTOLL_PROTO)) extern longlong strtoll(const char *str, char **ptr, int base); extern ulonglong strtoull(const char *str, char **ptr, int base); #endif #endif #endif #define longlong2str(A,B,C) ll2str((A),(B),(C),1) #if defined(__cplusplus) } #endif /* LEX_STRING -- a pair of a C-string and its length. (it's part of the plugin API as a MYSQL_LEX_STRING) */ #include <mysql/plugin.h> typedef struct st_mysql_lex_string LEX_STRING; #define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1)) #define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1)) #define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1)) struct st_mysql_const_lex_string { const char *str; size_t length; }; typedef struct st_mysql_const_lex_string LEX_CSTRING; /* SPACE_INT is a word that contains only spaces */ #if SIZEOF_INT == 4 #define SPACE_INT 0x20202020 #elif SIZEOF_INT == 8 #define SPACE_INT 0x2020202020202020 #else #error define the appropriate constant for a word full of spaces #endif /** Skip trailing space. On most systems reading memory in larger chunks (ideally equal to the size of the chinks that the machine physically reads from memory) causes fewer memory access loops and hence increased performance. This is why the 'int' type is used : it's closest to that (according to how it's defined in C). So when we determine the amount of whitespace at the end of a string we do the following : 1. We divide the string into 3 zones : a) from the start of the string (__start) to the first multiple of sizeof(int) (__start_words) b) from the end of the string (__end) to the last multiple of sizeof(int) (__end_words) c) a zone that is aligned to sizeof(int) and can be safely accessed through an int * 2. We start comparing backwards from (c) char-by-char. If all we find is space then we continue 3. If there are elements in zone (b) we compare them as unsigned ints to a int mask (SPACE_INT) consisting of all spaces 4. Finally we compare the remaining part (a) of the string char by char. This covers for the last non-space unsigned int from 3. (if any) This algorithm works well for relatively larger strings, but it will slow the things down for smaller strings (because of the additional calculations and checks compared to the naive method). Thus the barrier of length 20 is added. @param ptr pointer to the input string @param len the length of the string @return the last non-space character */ static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len) { const uchar *end= ptr + len; if (len > 20) { const uchar *end_words= (const uchar *)(intptr) (((ulonglong)(intptr)end) / SIZEOF_INT * SIZEOF_INT); const uchar *start_words= (const uchar *)(intptr) ((((ulonglong)(intptr)ptr) + SIZEOF_INT - 1) / SIZEOF_INT * SIZEOF_INT); DBUG_ASSERT(((ulonglong)(intptr)ptr) >= SIZEOF_INT); if (end_words > ptr) { while (end > end_words && end[-1] == 0x20) end--; if (end[-1] == 0x20 && start_words < end_words) while (end > start_words && ((unsigned *)end)[-1] == SPACE_INT) end -= SIZEOF_INT; } } while (end > ptr && end[-1] == 0x20) end--; return (end); } static inline void lex_string_set(LEX_STRING *lex_str, const char *c_str) { lex_str->str= (char *) c_str; lex_str->length= strlen(c_str); } #endif
{ "pile_set_name": "Github" }
<!-- Copyright (c) Microsoft Corporation. All rights reserved. --> <UserControl x:Class="SmartDisplay.Controls.LoginPopupControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ctrl="using:SmartDisplay.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="300" d:DesignWidth="400" mc:Ignorable="d"> <Popup x:Name="PopupElement" IsLightDismissEnabled="True"> <Border x:Name="BorderElement"> <Viewbox x:Name="ViewboxElement"> <ctrl:DevicePortalLoginControl x:Name="WdpLoginControl" Background="Transparent" /> </Viewbox> </Border> </Popup> </UserControl>
{ "pile_set_name": "Github" }
var SetCache = require('./_SetCache'), arrayIncludes = require('./_arrayIncludes'), arrayIncludesWith = require('./_arrayIncludesWith'), arrayMap = require('./_arrayMap'), baseUnary = require('./_baseUnary'), cacheHas = require('./_cacheHas'); /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** * The base implementation of methods like `_.difference` without support * for excluding multiple arrays or iteratee shorthands. * * @private * @param {Array} array The array to inspect. * @param {Array} values The values to exclude. * @param {Function} [iteratee] The iteratee invoked per element. * @param {Function} [comparator] The comparator invoked per element. * @returns {Array} Returns the new array of filtered values. */ function baseDifference(array, values, iteratee, comparator) { var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length; if (!length) { return result; } if (iteratee) { values = arrayMap(values, baseUnary(iteratee)); } if (comparator) { includes = arrayIncludesWith; isCommon = false; } else if (values.length >= LARGE_ARRAY_SIZE) { includes = cacheHas; isCommon = false; values = new SetCache(values); } outer: while (++index < length) { var value = array[index], computed = iteratee == null ? value : iteratee(value); value = (comparator || value !== 0) ? value : 0; if (isCommon && computed === computed) { var valuesIndex = valuesLength; while (valuesIndex--) { if (values[valuesIndex] === computed) { continue outer; } } result.push(value); } else if (!includes(values, computed, comparator)) { result.push(value); } } return result; } module.exports = baseDifference;
{ "pile_set_name": "Github" }
form=词 tags= 青腰似诧天公富, 奔走风云。 银界无痕。 委巷穷山草木春。 玉楼不怕歌茵湿, 笑语纷纷。 须放他们。 醉里冰姿光照人。
{ "pile_set_name": "Github" }
int foo();
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; namespace YAF.Lucene.Net.Support { /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /// <summary> /// .NET Specific Helper Extensions for IEnumerable /// </summary> //Note: LUCENENET specific internal static class EnumerableExtensions { /// <summary> /// Enumerates a sequence in pairs /// </summary> /// <remarks> /// In the case of an uneven amount of elements, the list call to <paramref name="join" /> pases <code>default(T)</code> as the second parameter. /// </remarks> /// <typeparam name="T">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TOut">The type of the elements returned from <paramref name="join" />.</typeparam> /// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to enumerate in pairs.</param> /// <param name="join">A function that is invoked for each pair of elements.</param> /// <exception cref="ArgumentNullException"><paramref name="source" /> or <paramref name="join" /> is <see langword="null" />.</exception> /// <returns>A new <see cref="T:System.Collections.Generic.IEnumerable`1" /> containing the results from each pair.</returns> public static IEnumerable<TOut> InPairs<T, TOut>(this IEnumerable<T> source, Func<T, T, TOut> join) { if (source == null) throw new ArgumentNullException(nameof(source)); if (join == null) throw new ArgumentNullException(nameof(join)); using (IEnumerator<T> enumerator = source.GetEnumerator()) { while (true) { if (!enumerator.MoveNext()) yield break; T x = enumerator.Current; if (!enumerator.MoveNext()) yield return join(x, default); yield return join(x, enumerator.Current); } } } /// <summary> /// Take all but the last element of the sequence. /// </summary> /// <typeparam name="T">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">This <see cref="IEnumerable{T}"/>.</param> /// <returns>The resulting <see cref="IEnumerable{T}"/>.</returns> public static IEnumerable<T> TakeAllButLast<T>(this IEnumerable<T> source) { if (source == null) throw new ArgumentNullException(nameof(source)); return TakeAllButLastImpl(source); } private static IEnumerable<T> TakeAllButLastImpl<T>(IEnumerable<T> source) { T buffer = default; bool buffered = false; foreach (T x in source) { if (buffered) yield return buffer; buffer = x; buffered = true; } } /// <summary> /// Take all but the last <paramref name="n"/> elements of the sequence. /// </summary> /// <typeparam name="T">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">This <see cref="IEnumerable{T}"/>.</param> /// <param name="n">The number of elements at the end of the sequence to exclude.</param> /// <returns>The resulting <see cref="IEnumerable{T}"/>.</returns> public static IEnumerable<T> TakeAllButLast<T>(this IEnumerable<T> source, int n) { if (source == null) throw new ArgumentNullException("source"); if (n < 0) throw new ArgumentOutOfRangeException("n", "Argument n should be non-negative."); return TakeAllButLastImpl(source, n); } private static IEnumerable<T> TakeAllButLastImpl<T>(IEnumerable<T> source, int n) { Queue<T> buffer = new Queue<T>(n + 1); foreach (T x in source) { buffer.Enqueue(x); if (buffer.Count == n + 1) yield return buffer.Dequeue(); } } } }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2007 TopCoder Inc., All Rights Reserved. */ package com.topcoder.gui.diagramviewer.uml.auxiliaryelements; import com.topcoder.util.config.ConfigManager; import java.io.File; import java.util.Iterator; /** * <p> * A helper class to perform those common operations which are helpful for the test. * </p> * * @author TCSDEVELOPER * @version 1.0 */ public class TestHelper { /** * <p> * The sample configuration file for this component. * </p> */ public static final String CONFIG_FILE = "test_files" + File.separator + "config.xml"; /** * <p> * This private constructor prevents to create a new instance. * </p> */ private TestHelper() { // empty } /** * <p> * Uses the given file to config the configuration manager. * </p> * * @param fileName config file to set up environment * * @throws Exception when any exception occurs */ public static void loadXMLConfig(String fileName) throws Exception { clearConfig(); //set up environment ConfigManager cm = ConfigManager.getInstance(); File file = new File(fileName); cm.add(file.getCanonicalPath()); } /** * <p> * Clears all the namespaces from the configuration manager. * </p> * * @throws Exception to JUnit. */ public static void clearConfig() throws Exception { ConfigManager cm = ConfigManager.getInstance(); for (Iterator i = cm.getAllNamespaces(); i.hasNext();) { cm.removeNamespace((String) i.next()); } } /** * <p> * This method creates a Point instance defined in Diagram Interchange component. * </p> * * @param x the x-coordinate position of the point * @param y the y-coordinate position of the points * * @return the point instance defined in Diagram Interchange component with the given x and y coordinate value. */ public static com.topcoder.diagraminterchange.Point createDiagramInterchangePoint(int x, int y) { com.topcoder.diagraminterchange.Point pt = new com.topcoder.diagraminterchange.Point(); pt.setX(x); pt.setY(y); return pt; } }
{ "pile_set_name": "Github" }
The images in this folder are referenced by the following themes: jqx.ui-lightness.css, jqx.ui-darkness.css, jqx.ui-le-frog.css, jqx.ui-overcast.css, jqx-ui-redmond.css, jqx-ui-smoothness.css, jqx-ui-start.css and jqx-ui-sunny.css. The images are downloaded from http://jqueryui.com and are MIT Licensed.
{ "pile_set_name": "Github" }
/* * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javafx.scene.effect; import javafx.beans.property.DoubleProperty; import javafx.beans.property.DoublePropertyBase; import javafx.beans.property.ObjectProperty; import javafx.scene.Node; import com.sun.javafx.util.Utils; import com.sun.javafx.effect.EffectDirtyBits; import com.sun.javafx.geom.BaseBounds; import com.sun.javafx.geom.transform.BaseTransform; import com.sun.javafx.scene.BoundsAccessor; /** * A high-level effect that makes the input image appear to glow, * based on a configurable threshold. * * <p> * Example: * <pre>{@code * Image image = new Image("boat.jpg"); * ImageView imageView = new ImageView(image); * imageView.setFitWidth(200); * imageView.setPreserveRatio(true); * * imageView.setEffect(new Glow(0.8)); * }</pre> * <p> The code above applied on this image: </p> * <p> * <img src="doc-files/photo.png" alt="A photo"> * </p> * <p> produces the following: </p> * <p> * <img src="doc-files/glow.png" alt="The visual effect of Glow on photo"> * </p> * @since JavaFX 2.0 */ public class Glow extends Effect { /** * Creates a new instance of Glow with default parameters. */ public Glow() {} /** * Creates a new instance of Glow with specified level. * @param level the level value, which controls the intensity * of the glow effect */ public Glow(double level) { setLevel(level); } @Override com.sun.scenario.effect.Glow createPeer() { return new com.sun.scenario.effect.Glow(); }; /** * The input for this {@code Effect}. * If set to {@code null}, or left unspecified, a graphical image of * the {@code Node} to which the {@code Effect} is attached will be * used as the input. * @defaultValue null */ private ObjectProperty<Effect> input; public final void setInput(Effect value) { inputProperty().set(value); } public final Effect getInput() { return input == null ? null : input.get(); } public final ObjectProperty<Effect> inputProperty() { if (input == null) { input = new EffectInputProperty("input"); } return input; } @Override boolean checkChainContains(Effect e) { Effect localInput = getInput(); if (localInput == null) return false; if (localInput == e) return true; return localInput.checkChainContains(e); } /** * The level value, which controls the intensity of the glow effect. * <pre> * Min: 0.0 * Max: 1.0 * Default: 0.3 * Identity: 0.0 * </pre> * @defaultValue 0.3 */ private DoubleProperty level; public final void setLevel(double value) { levelProperty().set(value); } public final double getLevel() { return level == null ? 0.3 : level.get(); } public final DoubleProperty levelProperty() { if (level == null) { level = new DoublePropertyBase(0.3) { @Override public void invalidated() { markDirty(EffectDirtyBits.EFFECT_DIRTY); } @Override public Object getBean() { return Glow.this; } @Override public String getName() { return "level"; } }; } return level; } @Override void update() { Effect localInput = getInput(); if (localInput != null) { localInput.sync(); } com.sun.scenario.effect.Glow peer = (com.sun.scenario.effect.Glow) getPeer(); peer.setInput(localInput == null ? null : localInput.getPeer()); peer.setLevel((float)Utils.clamp(0, getLevel(), 1)); } @Override BaseBounds getBounds(BaseBounds bounds, BaseTransform tx, Node node, BoundsAccessor boundsAccessor) { return getInputBounds(bounds, tx, node, boundsAccessor, getInput()); } @Override Effect copy() { return new Glow(this.getLevel()); } }
{ "pile_set_name": "Github" }
{ "eggPlugin": { "name": "a" } }
{ "pile_set_name": "Github" }
import { expect } from "chai"; import GetGroups from "../../src/usecases/GetGroups"; import { getMockDependencies } from "../testUtils"; describe("usecase GetGroups", () => { it("returns the groups found with the specified search filters (none for now)", async () => { const deps = getMockDependencies(); const mockGroups = [] as any; deps.storages.groups.findMany.resolves(mockGroups); const getGroups = new GetGroups(deps); const groups = await getGroups.exec(); expect(groups).to.equal(mockGroups); }); });
{ "pile_set_name": "Github" }
/** * 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. * * Copyright 2012-2016 the original author or authors. */ package org.assertj.examples.conversion; import static com.google.common.collect.Lists.newArrayList; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import java.util.List; import org.assertj.examples.data.Person; import org.junit.jupiter.api.Test; /** * This class is just used to check the effect of the script that migrates JUnit assertions to AssertJ assertions. */ public class WithJunitAssertionTest { @Test public void using_various_junit_assertions() { List<String> list = newArrayList(); assertEquals("test context", 0, list .size()); assertEquals("test context",0,list.size()); assertEquals(0, list.size()); assertEquals(0,list.size()); list = newArrayList("a", "b", "c"); assertEquals("test context", 3, list.size()); assertEquals("test context",3,list.size()); assertEquals(3, list.size()); assertEquals(3,list.size()); Person joe = new Person("Joe", 39); assertEquals("test name", "Joe", joe.getName()); assertEquals("test age",39,joe.getAge()); assertEquals("Joe", joe.getName() ); assertEquals(39, joe.getAge()); assertEquals("test context", 1.0, 1.1, 0.2); assertEquals("test context",1.0,1.1,0.2); assertEquals(1.0, 1.1, 0.2); assertEquals(1.0,1.1,0.2); Object[] actual = {"a"}; Object[] expected = {"a"}; assertArrayEquals("test context", expected, actual); assertArrayEquals("test context",expected,actual); assertArrayEquals(expected, actual); assertArrayEquals(expected,actual); actual = expected; assertSame("test context", expected, actual); assertSame("test context",expected,actual); assertSame(expected, actual); assertSame(expected,actual); actual = new Object[] {"not the same"}; assertNotSame("test context", expected, actual); assertNotSame("test context",expected,actual); assertNotSame(expected, actual); assertNotSame(expected,actual); actual = null; assertNull("test context", actual); assertNull("test context",actual); assertNull( actual); assertNull(actual); actual = new Object[] {"not null"}; assertNotNull("test context", actual); assertNotNull("test context",actual); assertNotNull( actual); assertNotNull(actual); assertTrue("test context", actual != null); assertTrue("test context",actual != null); assertTrue( actual != null); assertTrue(actual != null); assertFalse("test context", actual == null); assertFalse("test context",actual == null); assertFalse( actual == null); assertFalse(actual == null); } }
{ "pile_set_name": "Github" }
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # LOCALIZATION NOTE: These strings are used for startup/profile problems and the profile manager. # Application not responding # LOCALIZATION NOTE (restartTitle, restartMessageNoUnlocker, restartMessageUnlocker, restartMessageNoUnlockerMac, restartMessageUnlockerMac): Messages displayed when the application is running but is not responding to commands. %S is the application name. restartTitle=Close %S restartMessageNoUnlocker=%S is already running, but is not responding. To open a new window, you must first close the existing %S process, or restart your system. restartMessageUnlocker=%S is already running, but is not responding. The old %S process must be closed to open a new window. restartMessageNoUnlockerMac=A copy of %S is already open. Only one copy of %S can be open at a time. restartMessageUnlockerMac=A copy of %S is already open. The running copy of %S will quit in order to open this one. # Profile manager # LOCALIZATION NOTE (profileTooltip): First %S is the profile name, second %S is the path to the profile folder. profileTooltip=Profile: ‘%S’ - Path: ‘%S’ pleaseSelectTitle=Select Profile pleaseSelect=Please select a profile to begin %S, or create a new profile. profileLockedTitle=Profile In Use profileLocked2=%S cannot use the profile “%S” because it is in use.\n\nTo continue, close the running instance of %S or choose a different profile. renameProfileTitle=Rename Profile renameProfilePrompt=Rename the profile “%S” to: profileNameInvalidTitle=Invalid profile name profileNameInvalid=The profile name “%S” is not allowed. chooseFolder=Choose Profile Folder profileNameEmpty=An empty profile name is not allowed. invalidChar=The character “%S” is not allowed in profile names. Please choose a different name. deleteTitle=Delete Profile deleteProfileConfirm=Deleting a profile will remove the profile from the list of available profiles and cannot be undone.\nYou may also choose to delete the profile data files, including your settings, certificates and other user-related data. This option will delete the folder “%S” and cannot be undone.\nWould you like to delete the profile data files? deleteFiles=Delete Files dontDeleteFiles=Don’t Delete Files profileCreationFailed=Profile couldn’t be created. Probably the chosen folder isn’t writable. profileCreationFailedTitle=Profile Creation failed profileExists=A profile with this name already exists. Please choose another name. profileExistsTitle=Profile Exists profileFinishText=Click Finish to create this new profile. profileFinishTextMac=Click Done to create this new profile. profileMissing=Your %S profile cannot be loaded. It may be missing or inaccessible. profileMissingTitle=Profile Missing # Profile reset # LOCALIZATION NOTE (resetBackupDirectory): Directory name for the profile directory backup created during reset. This directory is placed in a location users will see it (ie. their desktop). %S is the application name. resetBackupDirectory=Old %S Data
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title></title> <link href="/dist/css/ionic.css" rel="stylesheet"> <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above <link href="css/ionic.app.css" rel="stylesheet"> --> <!-- ionic/angularjs js --> <script src="/dist/js/ionic.bundle.js"></script> <!-- cordova script (this will be a 404 during development) --> <script src="cordova.js"></script> <!-- your app's js --> </head> <body ng-app="starter"> <ion-nav-view></ion-nav-view> </body> <script id="templates/browse.html" type="text/ng-template"> <ion-view view-title="Browse"> <ion-content> <h1>Browse</h1> </ion-content> </ion-view> </script> <script id="templates/login.html" type="text/ng-template"> <ion-modal-view> <ion-header-bar> <h1 class="title">Login</h1> <div class="buttons"> <button class="button button-clear" ng-click="closeLogin()">Close</button> </div> </ion-header-bar> <ion-content> <form ng-submit="doLogin()"> <div class="list"> <label class="item item-input"> <span class="input-label">Username</span> <input type="text" ng-model="loginData.username"> </label> <label class="item item-input"> <span class="input-label">Password</span> <input type="password" ng-model="loginData.password"> </label> <label class="item"> <button class="button button-block button-positive" type="submit">Log in</button> </label> </div> </form> </ion-content> </ion-modal-view> </script> <script id="templates/menu.html" type="text/ng-template"> <ion-side-menus enable-menu-with-back-views="false"> <ion-side-menu-content> <ion-nav-bar class="bar-stable"> <ion-nav-back-button> </ion-nav-back-button> <ion-nav-buttons side="left"> <button class="button button-icon button-clear ion-navicon" menu-toggle="left"> </button> </ion-nav-buttons> </ion-nav-bar> <ion-nav-view name="menuContent"></ion-nav-view> </ion-side-menu-content> <ion-side-menu side="left"> <ion-header-bar class="bar-stable"> <h1 class="title">Left</h1> </ion-header-bar> <ion-content> <ion-list> <ion-item menu-close ng-click="login()"> Login </ion-item> <ion-item menu-close href="#/app/search"> Search </ion-item> <ion-item menu-close href="#/app/browse"> Browse </ion-item> <ion-item menu-close href="#/app/playlists"> Playlists </ion-item> </ion-list> </ion-content> </ion-side-menu> </ion-side-menus> </script> <script id="templates/playlist.html" type="text/ng-template"> <ion-view view-title="Playlist"> <ion-content has-header="true"> <ion-list show-delete="false" type="card"> <ion-item class="rs-item item-icon-right" ng-repeat="contact in contacts"> <div style="display:inline"> <ion-checkbox ng-model="contact.checked" ng-checked="contact.checked"> <img ng-src={{contact.avatar}}> <p>{{contact.displayName}}</p> </ion-checkbox> <!--<p>{{contact.displayName}}</p>--> </div> <ion-option-button style="background-color: #666;" ng-click="edit(item)"> Edit </ion-option-button> <ion-delete-button ng-click="onItemDelete(item)"></ion-delete-button> </ion-item> </ion-list> </ion-content> </ion-view> </script> <script id="templates/playlists.html" type="text/ng-template"> <ion-view view-title="Playlists"> <ion-content> <ion-list> <ion-item ng-repeat="playlist in playlists" href="#/app/playlists/{{playlist.id}}"> {{playlist.title}} </ion-item> </ion-list> </ion-content> </ion-view> </script> <script id="templates/search.html" type="text/ng-template"> <ion-view view-title="Search"> <ion-content> <h1>Search</h1> </ion-content> </ion-view> </script> <script> angular.module('starter', ['ionic', 'starter.controllers']) .run(function($ionicPlatform) { $ionicPlatform.ready(function() { // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard // for form inputs) if (window.cordova && window.cordova.plugins.Keyboard) { cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); cordova.plugins.Keyboard.disableScroll(true); } if (window.StatusBar) { // org.apache.cordova.statusbar required StatusBar.styleDefault(); } }); }) .config(function($stateProvider, $urlRouterProvider) { $stateProvider .state('app', { url: '/app', abstract: true, templateUrl: 'templates/menu.html', controller: 'AppCtrl' }) .state('app.search', { url: '/search', views: { 'menuContent': { templateUrl: 'templates/search.html' } } }) .state('app.browse', { url: '/browse', views: { 'menuContent': { templateUrl: 'templates/browse.html' } } }) .state('app.playlists', { url: '/playlists', views: { 'menuContent': { templateUrl: 'templates/playlists.html', controller: 'PlaylistsCtrl' } } }) .state('app.single', { url: '/playlists/:playlistId', views: { 'menuContent': { templateUrl: 'templates/playlist.html', controller: 'PlaylistCtrl' } } }); // if none of the above states are matched, use this as the fallback $urlRouterProvider.otherwise('/app/playlists'); }); angular.module('starter.controllers', []) .controller('AppCtrl', function($scope, $ionicModal, $timeout) { // With the new view caching in Ionic, Controllers are only called // when they are recreated or on app start, instead of every page change. // To listen for when this page is active (for example, to refresh data), // listen for the $ionicView.enter event: //$scope.$on('$ionicView.enter', function(e) { //}); // Form data for the login modal $scope.loginData = {}; // Create the login modal that we will use later $ionicModal.fromTemplateUrl('templates/login.html', { scope: $scope }).then(function(modal) { $scope.modal = modal; }); // Triggered in the login modal to close it $scope.closeLogin = function() { $scope.modal.hide(); }; // Open the login modal $scope.login = function() { $scope.modal.show(); }; // Perform the login action when the user submits the login form $scope.doLogin = function() { console.log('Doing login', $scope.loginData); // Simulate a login delay. Remove this and replace with your login // code if using a login system $timeout(function() { $scope.closeLogin(); }, 1000); }; }) .controller('PlaylistsCtrl', function($scope) { $scope.playlists = [ { title: 'Reggae', id: 1 }, { title: 'Chill', id: 2 }, { title: 'Dubstep', id: 3 }, { title: 'Indie', id: 4 }, { title: 'Rap', id: 5 }, { title: 'Cowbell', id: 6 } ]; }) .controller('PlaylistCtrl', function($scope, $stateParams) { var contacts = []; contacts.push({displayName:"Item One"}); contacts.push({displayName:"Item Two"}); contacts.push({displayName:"Item Three"}); $scope.contacts = contacts; }); </script> </html>
{ "pile_set_name": "Github" }
//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2020 Marco Antognini ([email protected]), // Laurent Gomila ([email protected]) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #import <AppKit/AppKit.h> #import <Foundation/Foundation.h> //////////////////////////////////////////////////////////// /// \brief Process some application specific events /// //////////////////////////////////////////////////////////// @interface SFApplicationDelegate : NSObject <NSApplicationDelegate> //////////////////////////////////////////////////////////// /// \brief React to a termination notification /// /// Send a close message to all windows and cancel the termination. /// //////////////////////////////////////////////////////////// -(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender; //////////////////////////////////////////////////////////// /// \brief Exit the app when all windows are closed /// //////////////////////////////////////////////////////////// -(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication; @end
{ "pile_set_name": "Github" }
<# # ROB IS THIS SUPPOSED TO KEEP HISTORICAL INFORMATION? IF SO $UPDATE WILL ALWAYS BE FALSE .SYNOPSIS Adds data to the DBA database for agent job results in a server list .DESCRIPTION Connects to a server list and iterates though reading the agent job results and adds data to the DBA Database - This is run as an agent job on LD5v-SQL11n-I06 .NOTES dbareports PowerShell module (https://dbareports.io, SQLDBAWithABeard.com) Copyright (C) 2016 Rob Sewell This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. #> [CmdletBinding()] Param ( [Alias("ServerInstance", "SqlInstance")] [object]$SqlServer = "--installserver--", [object]$SqlCredential, [string]$InstallDatabase = "--installdb--", [string]$LogFileFolder = "--logdir--" ) BEGIN { # Load up shared functions $currentdir = Split-Path -Parent $MyInvocation.MyCommand.Definition . "$currentdir\shared.ps1" . "$currentdir\Write-Log.ps1" # Create Log File $Date = Get-Date -Format yyyyMMdd_HHmmss $LogFilePath = $LogFileFolder + '\' + 'dbareports_AgentJobServer_' + $Date + '.txt' try { Write-Log -path $LogFilePath -message "Agent Job Server Job started" -level info } catch { Write-error "Failed to create Log File at $LogFilePath" } # Specify table name that we'll be inserting into $table = "info.AgentJobServer" $schema = $table.Split(".")[0] $tablename = $table.Split(".")[1] # Connect to dbareports server try { Write-Log -path $LogFilePath -message "Connecting to $sqlserver" -level info $sourceserver = Connect-SqlServer -SqlServer $sqlserver -SqlCredential $SqlCredential -ErrorAction Stop } catch { Write-Log -path $LogFilePath -message "Failed to connect to $sqlserver - $_" -level Error } # Get columns automatically from the table on the SQL Server # and creates the necessary $script:datatable with it try { Write-Log -path $LogFilePath -message "Intitialising Datatable" -level info Initialize-DataTable -ErrorAction Stop } catch { Write-Log -path $LogFilePath -message "Failed to initialise Data Table - $_" -level Error } } PROCESS { try { Write-Log -path $LogFilePath -message "Getting Instances from $sqlserver" -level info $sqlservers = Get-Instances } catch { Write-Log -path $LogFilePath -message " Failed to get instances - $_" -level Error break } # Get list of all servers already in the database try { Write-Log -path $LogFilePath -message "Getting a list of servers from the dbareports database" -level info $sql = "SELECT AgentJobServerID, InstanceID FROM $table" $table = $sourceserver.Databases[$InstallDatabase].ExecuteWithResults($sql).Tables[0] Write-Log -path $LogFilePath -message "Got the list of servers from the dbareports database" -level info } catch { Write-Log -path $LogFilePath -message "Can't get server list from $InstallDatabase on $($sourceserver.name). - $_" -level Error } foreach ($sqlserver in $sqlservers) { $sqlservername = $sqlserver.ServerName $InstanceName = $sqlserver.InstanceName $InstanceId = $sqlserver.InstanceId $update = $true # Checking for existing record and setting flag $record = $table | Where-Object { $_.InstanceId -eq $InstanceID } $key = $record.AgentJobServerID if ($key.count -eq 0) { $update = $false } if ($InstanceName -eq 'MSSQLServer') { $Connection = $sqlservername } else { $Connection = "$sqlservername\$InstanceName" } # Connect to Instance try { $server = Connect-SqlServer -SqlServer $Connection Write-Log -path $LogFilePath -message "Connecting to $Connection" -level info } catch { Write-Log -path $LogFilePath -message "Failed to connect to $Connection - $_" -level Warn continue } $jobs = $server.JobServer.jobs $JobCount = $jobs.Count $successCount = ($jobs | Where-Object { $_.LastRunOutcome -eq 'Succeeded' -and $_.IsEnabled -eq $true }).Count $failedCount = ($jobs | Where-Object { $_.LastRunOutcome -eq 'Failed' -and $_.IsEnabled -eq $true }).Count $UnknownCount = ($jobs | Where-Object { $_.LastRunOutcome -eq 'Unknown' -and $_.IsEnabled -eq $true }).Count $JobsDisabled = ($jobs | Where-Object { $_.IsEnabled -eq $false }).Count try { $null = $datatable.rows.Add( $key, $(Get-Date), $InstanceId, $JobCount, $successCount, $failedCount, $JobsDisabled, $UnknownCount, $Update) } catch { Write-Log -path $LogFilePath -message "Failed to add Job to datatable - $_" -level Error Write-Log -path $LogFilePath -message "Data = $key, $(Get-Date), $InstanceId, $JobCount, $successCount, $failedCount, $JobsDisabled, $UnknownCount, $Update" -level Error continue } } $rowcount = $datatable.Rows.Count if ($rowcount -eq 0) { Write-Log -path $LogFilePath -message "No rows returned. No update required." -level info continue } try { Write-Log -path $LogFilePath -message "Attempting Import of $rowcount row(s)" -level info Write-Tvp -ErrorAction Stop Write-Log -path $LogFilePath -message "Successfully Imported $rowcount row(s) of Agent Job Server into the $InstallDatabase on $($sourceserver.name)" -level info } catch { Write-Log -path $LogFilePath -message "Bulk insert failed - $_" -level Error } } END { Write-Log -path $LogFilePath -message "Agent Job Server Finished" $sourceserver.ConnectionContext.Disconnect() }
{ "pile_set_name": "Github" }
package main import ( "bufio" "context" "flag" "fmt" "io" "log" "net/http" "strings" // We need to import libp2p's libraries that we use in this project. "github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peerstore" ma "github.com/multiformats/go-multiaddr" manet "github.com/multiformats/go-multiaddr-net" ) // Protocol defines the libp2p protocol that we will use for the libp2p proxy // service that we are going to provide. This will tag the streams used for // this service. Streams are multiplexed and their protocol tag helps // libp2p handle them to the right handler functions. const Protocol = "/proxy-example/0.0.1" // makeRandomHost creates a libp2p host with a randomly generated identity. // This step is described in depth in other tutorials. func makeRandomHost(port int) host.Host { host, err := libp2p.New(context.Background(), libp2p.ListenAddrStrings(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d", port))) if err != nil { log.Fatalln(err) } return host } // ProxyService provides HTTP proxying on top of libp2p by launching an // HTTP server which tunnels the requests to a destination peer running // ProxyService too. type ProxyService struct { host host.Host dest peer.ID proxyAddr ma.Multiaddr } // NewProxyService attaches a proxy service to the given libp2p Host. // The proxyAddr parameter specifies the address on which the // HTTP proxy server listens. The dest parameter specifies the peer // ID of the remote peer in charge of performing the HTTP requests. // // ProxyAddr/dest may be nil/"" it is not necessary that this host // provides a listening HTTP server (and instead its only function is to // perform the proxied http requests it receives from a different peer. // // The addresses for the dest peer should be part of the host's peerstore. func NewProxyService(h host.Host, proxyAddr ma.Multiaddr, dest peer.ID) *ProxyService { // We let our host know that it needs to handle streams tagged with the // protocol id that we have defined, and then handle them to // our own streamHandling function. h.SetStreamHandler(Protocol, streamHandler) fmt.Println("Proxy server is ready") fmt.Println("libp2p-peer addresses:") for _, a := range h.Addrs() { fmt.Printf("%s/ipfs/%s\n", a, peer.IDB58Encode(h.ID())) } return &ProxyService{ host: h, dest: dest, proxyAddr: proxyAddr, } } // streamHandler is our function to handle any libp2p-net streams that belong // to our protocol. The streams should contain an HTTP request which we need // to parse, make on behalf of the original node, and then write the response // on the stream, before closing it. func streamHandler(stream network.Stream) { // Remember to close the stream when we are done. defer stream.Close() // Create a new buffered reader, as ReadRequest needs one. // The buffered reader reads from our stream, on which we // have sent the HTTP request (see ServeHTTP()) buf := bufio.NewReader(stream) // Read the HTTP request from the buffer req, err := http.ReadRequest(buf) if err != nil { stream.Reset() log.Println(err) return } defer req.Body.Close() // We need to reset these fields in the request // URL as they are not maintained. req.URL.Scheme = "http" hp := strings.Split(req.Host, ":") if len(hp) > 1 && hp[1] == "443" { req.URL.Scheme = "https" } else { req.URL.Scheme = "http" } req.URL.Host = req.Host outreq := new(http.Request) *outreq = *req // We now make the request fmt.Printf("Making request to %s\n", req.URL) resp, err := http.DefaultTransport.RoundTrip(outreq) if err != nil { stream.Reset() log.Println(err) return } // resp.Write writes whatever response we obtained for our // request back to the stream. resp.Write(stream) } // Serve listens on the ProxyService's proxy address. This effectively // allows to set the listening address as http proxy. func (p *ProxyService) Serve() { _, serveArgs, _ := manet.DialArgs(p.proxyAddr) fmt.Println("proxy listening on ", serveArgs) if p.dest != "" { http.ListenAndServe(serveArgs, p) } } // ServeHTTP implements the http.Handler interface. WARNING: This is the // simplest approach to a proxy. Therefore we do not do any of the things // that should be done when implementing a reverse proxy (like handling // headers correctly). For how to do it properly, see: // https://golang.org/src/net/http/httputil/reverseproxy.go?s=3845:3920#L121 // // ServeHTTP opens a stream to the dest peer for every HTTP request. // Streams are multiplexed over single connections so, unlike connections // themselves, they are cheap to create and dispose of. func (p *ProxyService) ServeHTTP(w http.ResponseWriter, r *http.Request) { fmt.Printf("proxying request for %s to peer %s\n", r.URL, p.dest.Pretty()) // We need to send the request to the remote libp2p peer, so // we open a stream to it stream, err := p.host.NewStream(context.Background(), p.dest, Protocol) // If an error happens, we write an error for response. if err != nil { log.Println(err) http.Error(w, err.Error(), http.StatusInternalServerError) return } defer stream.Close() // r.Write() writes the HTTP request to the stream. err = r.Write(stream) if err != nil { stream.Reset() log.Println(err) http.Error(w, err.Error(), http.StatusServiceUnavailable) return } // Now we read the response that was sent from the dest // peer buf := bufio.NewReader(stream) resp, err := http.ReadResponse(buf, r) if err != nil { stream.Reset() log.Println(err) http.Error(w, err.Error(), http.StatusServiceUnavailable) return } // Copy any headers for k, v := range resp.Header { for _, s := range v { w.Header().Add(k, s) } } // Write response status and headers w.WriteHeader(resp.StatusCode) // Finally copy the body io.Copy(w, resp.Body) resp.Body.Close() } // addAddrToPeerstore parses a peer multiaddress and adds // it to the given host's peerstore, so it knows how to // contact it. It returns the peer ID of the remote peer. func addAddrToPeerstore(h host.Host, addr string) peer.ID { // The following code extracts target's the peer ID from the // given multiaddress ipfsaddr, err := ma.NewMultiaddr(addr) if err != nil { log.Fatalln(err) } pid, err := ipfsaddr.ValueForProtocol(ma.P_IPFS) if err != nil { log.Fatalln(err) } peerid, err := peer.IDB58Decode(pid) if err != nil { log.Fatalln(err) } // Decapsulate the /ipfs/<peerID> part from the target // /ip4/<a.b.c.d>/ipfs/<peer> becomes /ip4/<a.b.c.d> targetPeerAddr, _ := ma.NewMultiaddr( fmt.Sprintf("/ipfs/%s", peer.IDB58Encode(peerid))) targetAddr := ipfsaddr.Decapsulate(targetPeerAddr) // We have a peer ID and a targetAddr so we add // it to the peerstore so LibP2P knows how to contact it h.Peerstore().AddAddr(peerid, targetAddr, peerstore.PermanentAddrTTL) return peerid } const help = ` This example creates a simple HTTP Proxy using two libp2p peers. The first peer provides an HTTP server locally which tunnels the HTTP requests with libp2p to a remote peer. The remote peer performs the requests and send the sends the response back. Usage: Start remote peer first with: ./proxy Then start the local peer with: ./proxy -d <remote-peer-multiaddress> Then you can do something like: curl -x "localhost:9900" "http://ipfs.io". This proxies sends the request through the local peer, which proxies it to the remote peer, which makes it and sends the response back. ` func main() { flag.Usage = func() { fmt.Println(help) flag.PrintDefaults() } // Parse some flags destPeer := flag.String("d", "", "destination peer address") port := flag.Int("p", 9900, "proxy port") p2pport := flag.Int("l", 12000, "libp2p listen port") flag.Parse() // If we have a destination peer we will start a local server if *destPeer != "" { // We use p2pport+1 in order to not collide if the user // is running the remote peer locally on that port host := makeRandomHost(*p2pport + 1) // Make sure our host knows how to reach destPeer destPeerID := addAddrToPeerstore(host, *destPeer) proxyAddr, err := ma.NewMultiaddr(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d", *port)) if err != nil { log.Fatalln(err) } // Create the proxy service and start the http server proxy := NewProxyService(host, proxyAddr, destPeerID) proxy.Serve() // serve hangs forever } else { host := makeRandomHost(*p2pport) // In this case we only need to make sure our host // knows how to handle incoming proxied requests from // another peer. _ = NewProxyService(host, nil, "") <-make(chan struct{}) // hang forever } }
{ "pile_set_name": "Github" }
// Copyright 2018 The Prometheus 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 procfs import ( "fmt" "io/ioutil" "os" ) // ProcIO models the content of /proc/<pid>/io. type ProcIO struct { // Chars read. RChar uint64 // Chars written. WChar uint64 // Read syscalls. SyscR uint64 // Write syscalls. SyscW uint64 // Bytes read. ReadBytes uint64 // Bytes written. WriteBytes uint64 // Bytes written, but taking into account truncation. See // Documentation/filesystems/proc.txt in the kernel sources for // detailed explanation. CancelledWriteBytes int64 } // NewIO creates a new ProcIO instance from a given Proc instance. func (p Proc) NewIO() (ProcIO, error) { pio := ProcIO{} f, err := os.Open(p.path("io")) if err != nil { return pio, err } defer f.Close() data, err := ioutil.ReadAll(f) if err != nil { return pio, err } ioFormat := "rchar: %d\nwchar: %d\nsyscr: %d\nsyscw: %d\n" + "read_bytes: %d\nwrite_bytes: %d\n" + "cancelled_write_bytes: %d\n" _, err = fmt.Sscanf(string(data), ioFormat, &pio.RChar, &pio.WChar, &pio.SyscR, &pio.SyscW, &pio.ReadBytes, &pio.WriteBytes, &pio.CancelledWriteBytes) return pio, err }
{ "pile_set_name": "Github" }
# Dracula kern.vt.color.0.rgb="#000000" kern.vt.color.1.rgb="#ff5555" kern.vt.color.2.rgb="#50fa7b" kern.vt.color.3.rgb="#f1fa8c" kern.vt.color.4.rgb="#bd93f9" kern.vt.color.5.rgb="#ff79c6" kern.vt.color.6.rgb="#8be9fd" kern.vt.color.7.rgb="#f8f8f2" kern.vt.color.8.rgb="#555555" kern.vt.color.9.rgb="#ff5555" kern.vt.color.10.rgb="#50fa7b" kern.vt.color.11.rgb="#f1fa8c" kern.vt.color.12.rgb="#bd93f9" kern.vt.color.13.rgb="#ff79c6" kern.vt.color.14.rgb="#8be9fd" kern.vt.color.15.rgb="#ffffff"
{ "pile_set_name": "Github" }
```md <!-- MyComponent.stories.mdx ---> import { Story } from '@storybook/addon-docs/blocks'; <Story id="some-component--some-name" /> ```
{ "pile_set_name": "Github" }
/* * DynamicReports - Free Java reporting library for creating reports dynamically * * Copyright (C) 2010 - 2018 Ricardo Mariaca and the Dynamic Reports Contributors * * This file is part of DynamicReports. * * DynamicReports 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. * * DynamicReports 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 DynamicReports. If not, see <http://www.gnu.org/licenses/>. */ package net.sf.dynamicreports.design.definition.chart.dataset; import net.sf.dynamicreports.design.definition.expression.DRIDesignExpression; /** * <p>DRIDesignXyzChartSerie interface.</p> * * @author Ricardo Mariaca * */ public interface DRIDesignXyzChartSerie extends DRIDesignChartSerie { /** * <p>getXValueExpression.</p> * * @return a {@link net.sf.dynamicreports.design.definition.expression.DRIDesignExpression} object. */ public DRIDesignExpression getXValueExpression(); /** * <p>getYValueExpression.</p> * * @return a {@link net.sf.dynamicreports.design.definition.expression.DRIDesignExpression} object. */ public DRIDesignExpression getYValueExpression(); /** * <p>getZValueExpression.</p> * * @return a {@link net.sf.dynamicreports.design.definition.expression.DRIDesignExpression} object. */ public DRIDesignExpression getZValueExpression(); }
{ "pile_set_name": "Github" }
// // Given two 64bit ints (as an array of two 32bit ints) returns the two // added together as a 64bit int (as an array of two 32bit ints). // var x64Add = function (m, n) { m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff] n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff] var o = [0, 0, 0, 0] o[3] += m[3] + n[3] o[2] += o[3] >>> 16 o[3] &= 0xffff o[2] += m[2] + n[2] o[1] += o[2] >>> 16 o[2] &= 0xffff o[1] += m[1] + n[1] o[0] += o[1] >>> 16 o[1] &= 0xffff o[0] += m[0] + n[0] o[0] &= 0xffff return [(o[0] << 16) | o[1], (o[2] << 16) | o[3]] } // // Given two 64bit ints (as an array of two 32bit ints) returns the two // multiplied together as a 64bit int (as an array of two 32bit ints). // var x64Multiply = function (m, n) { m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff] n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff] var o = [0, 0, 0, 0] o[3] += m[3] * n[3] o[2] += o[3] >>> 16 o[3] &= 0xffff o[2] += m[2] * n[3] o[1] += o[2] >>> 16 o[2] &= 0xffff o[2] += m[3] * n[2] o[1] += o[2] >>> 16 o[2] &= 0xffff o[1] += m[1] * n[3] o[0] += o[1] >>> 16 o[1] &= 0xffff o[1] += m[2] * n[2] o[0] += o[1] >>> 16 o[1] &= 0xffff o[1] += m[3] * n[1] o[0] += o[1] >>> 16 o[1] &= 0xffff o[0] += (m[0] * n[3]) + (m[1] * n[2]) + (m[2] * n[1]) + (m[3] * n[0]) o[0] &= 0xffff return [(o[0] << 16) | o[1], (o[2] << 16) | o[3]] } // // Given a 64bit int (as an array of two 32bit ints) and an int // representing a number of bit positions, returns the 64bit int (as an // array of two 32bit ints) rotated left by that number of positions. // var x64Rotl = function (m, n) { n %= 64 if (n === 32) { return [m[1], m[0]] } else if (n < 32) { return [(m[0] << n) | (m[1] >>> (32 - n)), (m[1] << n) | (m[0] >>> (32 - n))] } else { n -= 32 return [(m[1] << n) | (m[0] >>> (32 - n)), (m[0] << n) | (m[1] >>> (32 - n))] } } // // Given a 64bit int (as an array of two 32bit ints) and an int // representing a number of bit positions, returns the 64bit int (as an // array of two 32bit ints) shifted left by that number of positions. // var x64LeftShift = function (m, n) { n %= 64 if (n === 0) { return m } else if (n < 32) { return [(m[0] << n) | (m[1] >>> (32 - n)), m[1] << n] } else { return [m[1] << (n - 32), 0] } } // // Given two 64bit ints (as an array of two 32bit ints) returns the two // xored together as a 64bit int (as an array of two 32bit ints). // var x64Xor = function (m, n) { return [m[0] ^ n[0], m[1] ^ n[1]] } // // Given a block, returns murmurHash3's final x64 mix of that block. // (`[0, h[0] >>> 1]` is a 33 bit unsigned right shift. This is the // only place where we need to right shift 64bit ints.) // var x64Fmix = function (h) { h = x64Xor(h, [0, h[0] >>> 1]) h = x64Multiply(h, [0xff51afd7, 0xed558ccd]) h = x64Xor(h, [0, h[0] >>> 1]) h = x64Multiply(h, [0xc4ceb9fe, 0x1a85ec53]) h = x64Xor(h, [0, h[0] >>> 1]) return h } // // Given a string and an optional seed as an int, returns a 128 bit // hash using the x64 flavor of MurmurHash3, as an unsigned hex. // var x64hash128 = function (key, seed) { key = key || '' seed = seed || 0 var remainder = key.length % 16 var bytes = key.length - remainder var h1 = [0, seed] var h2 = [0, seed] var k1 = [0, 0] var k2 = [0, 0] var c1 = [0x87c37b91, 0x114253d5] var c2 = [0x4cf5ad43, 0x2745937f] for (var i = 0; i < bytes; i = i + 16) { k1 = [((key.charCodeAt(i + 4) & 0xff)) | ((key.charCodeAt(i + 5) & 0xff) << 8) | ((key.charCodeAt(i + 6) & 0xff) << 16) | ((key.charCodeAt(i + 7) & 0xff) << 24), ((key.charCodeAt(i) & 0xff)) | ((key.charCodeAt(i + 1) & 0xff) << 8) | ((key.charCodeAt(i + 2) & 0xff) << 16) | ((key.charCodeAt(i + 3) & 0xff) << 24)] k2 = [((key.charCodeAt(i + 12) & 0xff)) | ((key.charCodeAt(i + 13) & 0xff) << 8) | ((key.charCodeAt(i + 14) & 0xff) << 16) | ((key.charCodeAt(i + 15) & 0xff) << 24), ((key.charCodeAt(i + 8) & 0xff)) | ((key.charCodeAt(i + 9) & 0xff) << 8) | ((key.charCodeAt(i + 10) & 0xff) << 16) | ((key.charCodeAt(i + 11) & 0xff) << 24)] k1 = x64Multiply(k1, c1) k1 = x64Rotl(k1, 31) k1 = x64Multiply(k1, c2) h1 = x64Xor(h1, k1) h1 = x64Rotl(h1, 27) h1 = x64Add(h1, h2) h1 = x64Add(x64Multiply(h1, [0, 5]), [0, 0x52dce729]) k2 = x64Multiply(k2, c2) k2 = x64Rotl(k2, 33) k2 = x64Multiply(k2, c1) h2 = x64Xor(h2, k2) h2 = x64Rotl(h2, 31) h2 = x64Add(h2, h1) h2 = x64Add(x64Multiply(h2, [0, 5]), [0, 0x38495ab5]) } k1 = [0, 0] k2 = [0, 0] switch (remainder) { case 15: k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 14)], 48)) // fallthrough case 14: k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 13)], 40)) // fallthrough case 13: k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 12)], 32)) // fallthrough case 12: k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 11)], 24)) // fallthrough case 11: k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 10)], 16)) // fallthrough case 10: k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 9)], 8)) // fallthrough case 9: k2 = x64Xor(k2, [0, key.charCodeAt(i + 8)]) k2 = x64Multiply(k2, c2) k2 = x64Rotl(k2, 33) k2 = x64Multiply(k2, c1) h2 = x64Xor(h2, k2) // fallthrough case 8: k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 7)], 56)) // fallthrough case 7: k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 6)], 48)) // fallthrough case 6: k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 5)], 40)) // fallthrough case 5: k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 4)], 32)) // fallthrough case 4: k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 3)], 24)) // fallthrough case 3: k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 2)], 16)) // fallthrough case 2: k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 1)], 8)) // fallthrough case 1: k1 = x64Xor(k1, [0, key.charCodeAt(i)]) k1 = x64Multiply(k1, c1) k1 = x64Rotl(k1, 31) k1 = x64Multiply(k1, c2) h1 = x64Xor(h1, k1) // fallthrough } h1 = x64Xor(h1, [0, key.length]) h2 = x64Xor(h2, [0, key.length]) h1 = x64Add(h1, h2) h2 = x64Add(h2, h1) h1 = x64Fmix(h1) h2 = x64Fmix(h2) h1 = x64Add(h1, h2) h2 = x64Add(h2, h1) return ('00000000' + (h1[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h1[1] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[1] >>> 0).toString(16)).slice(-8) } export default x64hash128
{ "pile_set_name": "Github" }
/*! jQuery UI - v1.11.4 - 2015-03-11 * http://jqueryui.com * Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS%2CTahoma%2CVerdana%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=ffffff&bgTextureHeader=fine_grain&bgImgOpacityHeader=15&borderColorHeader=d4d1bf&fcHeader=453821&iconColorHeader=b83400&bgColorContent=eceadf&bgTextureContent=fine_grain&bgImgOpacityContent=10&borderColorContent=d9d6c4&fcContent=1f1f1f&iconColorContent=222222&bgColorDefault=f8f7f6&bgTextureDefault=fine_grain&bgImgOpacityDefault=10&borderColorDefault=cbc7bd&fcDefault=654b24&iconColorDefault=b83400&bgColorHover=654b24&bgTextureHover=fine_grain&bgImgOpacityHover=65&borderColorHover=654b24&fcHover=ffffff&iconColorHover=ffffff&bgColorActive=eceadf&bgTextureActive=fine_grain&bgImgOpacityActive=15&borderColorActive=d9d6c4&fcActive=140f06&iconColorActive=8c291d&bgColorHighlight=f7f3de&bgTextureHighlight=fine_grain&bgImgOpacityHighlight=15&borderColorHighlight=b2a266&fcHighlight=3a3427&iconColorHighlight=3572ac&bgColorError=b83400&bgTextureError=fine_grain&bgImgOpacityError=68&borderColorError=681818&fcError=ffffff&iconColorError=fbdb93&bgColorOverlay=6e4f1c&bgTextureOverlay=diagonal_maze&bgImgOpacityOverlay=20&opacityOverlay=60&bgColorShadow=000000&bgTextureShadow=diagonal_maze&bgImgOpacityShadow=40&opacityShadow=60&thicknessShadow=5px&offsetTopShadow=0&offsetLeftShadow=-10px&cornerRadiusShadow=18px * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ /* Layout helpers ----------------------------------*/ .ui-helper-hidden { display: none; } .ui-helper-hidden-accessible { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } .ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; border-collapse: collapse; } .ui-helper-clearfix:after { clear: both; } .ui-helper-clearfix { min-height: 0; /* support: IE7 */ } .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); /* support: IE8 */ } .ui-front { z-index: 100; } /* Interaction Cues ----------------------------------*/ .ui-state-disabled { cursor: default !important; } /* Icons ----------------------------------*/ /* states and images */ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } /* Misc visuals ----------------------------------*/ /* Overlays */ .ui-widget-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; } .ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin: 2px 0 0 0; padding: .5em .5em .5em .7em; min-height: 0; /* support: IE7 */ font-size: 100%; } .ui-accordion .ui-accordion-icons { padding-left: 2.2em; } .ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; } .ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; } .ui-autocomplete { position: absolute; top: 0; left: 0; cursor: default; } .ui-button { display: inline-block; position: relative; padding: 0; line-height: normal; margin-right: .1em; cursor: pointer; vertical-align: middle; text-align: center; overflow: visible; /* removes extra width in IE */ } .ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; } /* to make room for the icon, a width needs to be set here */ .ui-button-icon-only { width: 2.2em; } /* button elements seem to need a little more width */ button.ui-button-icon-only { width: 2.4em; } .ui-button-icons-only { width: 3.4em; } button.ui-button-icons-only { width: 3.7em; } /* button text element */ .ui-button .ui-button-text { display: block; line-height: normal; } .ui-button-text-only .ui-button-text { padding: .4em 1em; } .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } /* no icon support for input elements, provide padding by default */ input.ui-button { padding: .4em 1em; } /* button icon element(s) */ .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } /* button sets */ .ui-buttonset { margin-right: 7px; } .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } /* workarounds */ /* reset extra padding in Firefox, see h5bp.com/l */ input.ui-button::-moz-focus-inner, button.ui-button::-moz-focus-inner { border: 0; padding: 0; } .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } .ui-datepicker .ui-datepicker-header { position: relative; padding: .2em 0; } .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position: absolute; top: 2px; width: 1.8em; height: 1.8em; } .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } .ui-datepicker .ui-datepicker-prev { left: 2px; } .ui-datepicker .ui-datepicker-next { right: 2px; } .ui-datepicker .ui-datepicker-prev-hover { left: 1px; } .ui-datepicker .ui-datepicker-next-hover { right: 1px; } .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } .ui-datepicker .ui-datepicker-title select { font-size: 1em; margin: 1px 0; } .ui-datepicker select.ui-datepicker-month, .ui-datepicker select.ui-datepicker-year { width: 45%; } .ui-datepicker table { width: 100%; font-size: .9em; border-collapse: collapse; margin: 0 0 .4em; } .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } .ui-datepicker td { border: 0; padding: 1px; } .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding: 0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width: auto; overflow: visible; } .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float: left; } /* with multiple calendars */ .ui-datepicker.ui-datepicker-multi { width: auto; } .ui-datepicker-multi .ui-datepicker-group { float: left; } .ui-datepicker-multi .ui-datepicker-group table { width: 95%; margin: 0 auto .4em; } .ui-datepicker-multi-2 .ui-datepicker-group { width: 50%; } .ui-datepicker-multi-3 .ui-datepicker-group { width: 33.3%; } .ui-datepicker-multi-4 .ui-datepicker-group { width: 25%; } .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width: 0; } .ui-datepicker-multi .ui-datepicker-buttonpane { clear: left; } .ui-datepicker-row-break { clear: both; width: 100%; font-size: 0; } /* RTL support */ .ui-datepicker-rtl { direction: rtl; } .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } .ui-datepicker-rtl .ui-datepicker-buttonpane { clear: right; } .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current, .ui-datepicker-rtl .ui-datepicker-group { float: right; } .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header, .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width: 0; border-left-width: 1px; } .ui-dialog { overflow: hidden; position: absolute; top: 0; left: 0; padding: .2em; outline: 0; } .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } .ui-dialog .ui-dialog-title { float: left; margin: .1em 0; white-space: nowrap; width: 90%; overflow: hidden; text-overflow: ellipsis; } .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 20px; margin: -10px 0 0 0; padding: 1px; height: 20px; } .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; } .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin-top: .5em; padding: .3em 1em .5em .4em; } .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } .ui-dialog .ui-resizable-se { width: 12px; height: 12px; right: -5px; bottom: -5px; background-position: 16px 16px; } .ui-draggable .ui-dialog-titlebar { cursor: move; } .ui-draggable-handle { -ms-touch-action: none; touch-action: none; } .ui-menu { list-style: none; padding: 0; margin: 0; display: block; outline: none; } .ui-menu .ui-menu { position: absolute; } .ui-menu .ui-menu-item { position: relative; margin: 0; padding: 3px 1em 3px .4em; cursor: pointer; min-height: 0; /* support: IE7 */ /* support: IE10, see #8844 */ list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); } .ui-menu .ui-menu-divider { margin: 5px 0; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; } .ui-menu .ui-state-focus, .ui-menu .ui-state-active { margin: -1px; } /* icon support */ .ui-menu-icons { position: relative; } .ui-menu-icons .ui-menu-item { padding-left: 2em; } /* left-aligned */ .ui-menu .ui-icon { position: absolute; top: 0; bottom: 0; left: .2em; margin: auto 0; } /* right-aligned */ .ui-menu .ui-menu-icon { left: auto; right: 0; } .ui-progressbar { height: 2em; text-align: left; overflow: hidden; } .ui-progressbar .ui-progressbar-value { margin: -1px; height: 100%; } .ui-progressbar .ui-progressbar-overlay { background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw=="); height: 100%; filter: alpha(opacity=25); /* support: IE8 */ opacity: 0.25; } .ui-progressbar-indeterminate .ui-progressbar-value { background-image: none; } .ui-resizable { position: relative; } .ui-resizable-handle { position: absolute; font-size: 0.1px; display: block; -ms-touch-action: none; touch-action: none; } .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px; } .ui-selectable { -ms-touch-action: none; touch-action: none; } .ui-selectable-helper { position: absolute; z-index: 100; border: 1px dotted black; } .ui-selectmenu-menu { padding: 0; margin: 0; position: absolute; top: 0; left: 0; display: none; } .ui-selectmenu-menu .ui-menu { overflow: auto; /* Support: IE7 */ overflow-x: hidden; padding-bottom: 1px; } .ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup { font-size: 1em; font-weight: bold; line-height: 1.5; padding: 2px 0.4em; margin: 0.5em 0 0 0; height: auto; border: 0; } .ui-selectmenu-open { display: block; } .ui-selectmenu-button { display: inline-block; overflow: hidden; position: relative; text-decoration: none; cursor: pointer; } .ui-selectmenu-button span.ui-icon { right: 0.5em; left: auto; margin-top: -8px; position: absolute; top: 50%; } .ui-selectmenu-button span.ui-selectmenu-text { text-align: left; padding: 0.4em 2.1em 0.4em 1em; display: block; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ui-slider { position: relative; text-align: left; } .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; -ms-touch-action: none; touch-action: none; } .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } /* support: IE8 - See #6727 */ .ui-slider.ui-state-disabled .ui-slider-handle, .ui-slider.ui-state-disabled .ui-slider-range { filter: inherit; } .ui-slider-horizontal { height: .8em; } .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } .ui-slider-horizontal .ui-slider-range-min { left: 0; } .ui-slider-horizontal .ui-slider-range-max { right: 0; } .ui-slider-vertical { width: .8em; height: 100px; } .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } .ui-slider-vertical .ui-slider-range-min { bottom: 0; } .ui-slider-vertical .ui-slider-range-max { top: 0; } .ui-sortable-handle { -ms-touch-action: none; touch-action: none; } .ui-spinner { position: relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; } .ui-spinner-input { border: none; background: none; color: inherit; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; } .ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; } /* more specificity required here to override default borders */ .ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* vertically center icon */ .ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } .ui-spinner-up { top: 0; } .ui-spinner-down { bottom: 0; } /* TR overrides */ .ui-spinner .ui-icon-triangle-1-s { /* need to fix icons sprite */ background-position: -65px -16px; } .ui-tabs { position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ padding: .2em; } .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 0; margin: 1px .2em 0 0; border-bottom-width: 0; padding: 0; white-space: nowrap; } .ui-tabs .ui-tabs-nav .ui-tabs-anchor { float: left; padding: .5em 1em; text-decoration: none; } .ui-tabs .ui-tabs-nav li.ui-tabs-active { margin-bottom: -1px; padding-bottom: 1px; } .ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor, .ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor, .ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor { cursor: text; } .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor { cursor: pointer; } .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } .ui-tooltip { padding: 8px; position: absolute; z-index: 9999; max-width: 300px; -webkit-box-shadow: 0 0 5px #aaa; box-shadow: 0 0 5px #aaa; } body .ui-tooltip { border-width: 2px; } /* Component containers ----------------------------------*/ .ui-widget { font-family: Trebuchet MS,Tahoma,Verdana,Arial,sans-serif; font-size: 1.1em; } .ui-widget .ui-widget { font-size: 1em; } .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS,Tahoma,Verdana,Arial,sans-serif; font-size: 1em; } .ui-widget-content { border: 1px solid #d9d6c4; background: #eceadf url("images/ui-bg_fine-grain_10_eceadf_60x60.png") 50% 50% repeat; color: #1f1f1f; } .ui-widget-content a { color: #1f1f1f; } .ui-widget-header { border: 1px solid #d4d1bf; background: #ffffff url("images/ui-bg_fine-grain_15_ffffff_60x60.png") 50% 50% repeat; color: #453821; font-weight: bold; } .ui-widget-header a { color: #453821; } /* Interaction states ----------------------------------*/ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cbc7bd; background: #f8f7f6 url("images/ui-bg_fine-grain_10_f8f7f6_60x60.png") 50% 50% repeat; font-weight: bold; color: #654b24; } .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #654b24; text-decoration: none; } .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #654b24; background: #654b24 url("images/ui-bg_fine-grain_65_654b24_60x60.png") 50% 50% repeat; font-weight: bold; color: #ffffff; } .ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited, .ui-state-focus a, .ui-state-focus a:hover, .ui-state-focus a:link, .ui-state-focus a:visited { color: #ffffff; text-decoration: none; } .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #d9d6c4; background: #eceadf url("images/ui-bg_fine-grain_15_eceadf_60x60.png") 50% 50% repeat; font-weight: bold; color: #140f06; } .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #140f06; text-decoration: none; } /* Interaction Cues ----------------------------------*/ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight { border: 1px solid #b2a266; background: #f7f3de url("images/ui-bg_fine-grain_15_f7f3de_60x60.png") 50% 50% repeat; color: #3a3427; } .ui-state-highlight a, .ui-widget-content .ui-state-highlight a, .ui-widget-header .ui-state-highlight a { color: #3a3427; } .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error { border: 1px solid #681818; background: #b83400 url("images/ui-bg_fine-grain_68_b83400_60x60.png") 50% 50% repeat; color: #ffffff; } .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; } .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; } .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); /* support: IE8 */ font-weight: normal; } .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); /* support: IE8 */ background-image: none; } .ui-state-disabled .ui-icon { filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */ } /* Icons ----------------------------------*/ /* states and images */ .ui-icon { width: 16px; height: 16px; } .ui-icon, .ui-widget-content .ui-icon { background-image: url("images/ui-icons_222222_256x240.png"); } .ui-widget-header .ui-icon { background-image: url("images/ui-icons_b83400_256x240.png"); } .ui-state-default .ui-icon { background-image: url("images/ui-icons_b83400_256x240.png"); } .ui-state-hover .ui-icon, .ui-state-focus .ui-icon { background-image: url("images/ui-icons_ffffff_256x240.png"); } .ui-state-active .ui-icon { background-image: url("images/ui-icons_8c291d_256x240.png"); } .ui-state-highlight .ui-icon { background-image: url("images/ui-icons_3572ac_256x240.png"); } .ui-state-error .ui-icon, .ui-state-error-text .ui-icon { background-image: url("images/ui-icons_fbdb93_256x240.png"); } /* positioning */ .ui-icon-blank { background-position: 16px 16px; } .ui-icon-carat-1-n { background-position: 0 0; } .ui-icon-carat-1-ne { background-position: -16px 0; } .ui-icon-carat-1-e { background-position: -32px 0; } .ui-icon-carat-1-se { background-position: -48px 0; } .ui-icon-carat-1-s { background-position: -64px 0; } .ui-icon-carat-1-sw { background-position: -80px 0; } .ui-icon-carat-1-w { background-position: -96px 0; } .ui-icon-carat-1-nw { background-position: -112px 0; } .ui-icon-carat-2-n-s { background-position: -128px 0; } .ui-icon-carat-2-e-w { background-position: -144px 0; } .ui-icon-triangle-1-n { background-position: 0 -16px; } .ui-icon-triangle-1-ne { background-position: -16px -16px; } .ui-icon-triangle-1-e { background-position: -32px -16px; } .ui-icon-triangle-1-se { background-position: -48px -16px; } .ui-icon-triangle-1-s { background-position: -64px -16px; } .ui-icon-triangle-1-sw { background-position: -80px -16px; } .ui-icon-triangle-1-w { background-position: -96px -16px; } .ui-icon-triangle-1-nw { background-position: -112px -16px; } .ui-icon-triangle-2-n-s { background-position: -128px -16px; } .ui-icon-triangle-2-e-w { background-position: -144px -16px; } .ui-icon-arrow-1-n { background-position: 0 -32px; } .ui-icon-arrow-1-ne { background-position: -16px -32px; } .ui-icon-arrow-1-e { background-position: -32px -32px; } .ui-icon-arrow-1-se { background-position: -48px -32px; } .ui-icon-arrow-1-s { background-position: -64px -32px; } .ui-icon-arrow-1-sw { background-position: -80px -32px; } .ui-icon-arrow-1-w { background-position: -96px -32px; } .ui-icon-arrow-1-nw { background-position: -112px -32px; } .ui-icon-arrow-2-n-s { background-position: -128px -32px; } .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } .ui-icon-arrow-2-e-w { background-position: -160px -32px; } .ui-icon-arrow-2-se-nw { background-position: -176px -32px; } .ui-icon-arrowstop-1-n { background-position: -192px -32px; } .ui-icon-arrowstop-1-e { background-position: -208px -32px; } .ui-icon-arrowstop-1-s { background-position: -224px -32px; } .ui-icon-arrowstop-1-w { background-position: -240px -32px; } .ui-icon-arrowthick-1-n { background-position: 0 -48px; } .ui-icon-arrowthick-1-ne { background-position: -16px -48px; } .ui-icon-arrowthick-1-e { background-position: -32px -48px; } .ui-icon-arrowthick-1-se { background-position: -48px -48px; } .ui-icon-arrowthick-1-s { background-position: -64px -48px; } .ui-icon-arrowthick-1-sw { background-position: -80px -48px; } .ui-icon-arrowthick-1-w { background-position: -96px -48px; } .ui-icon-arrowthick-1-nw { background-position: -112px -48px; } .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } .ui-icon-arrowreturn-1-w { background-position: -64px -64px; } .ui-icon-arrowreturn-1-n { background-position: -80px -64px; } .ui-icon-arrowreturn-1-e { background-position: -96px -64px; } .ui-icon-arrowreturn-1-s { background-position: -112px -64px; } .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } .ui-icon-arrow-4 { background-position: 0 -80px; } .ui-icon-arrow-4-diag { background-position: -16px -80px; } .ui-icon-extlink { background-position: -32px -80px; } .ui-icon-newwin { background-position: -48px -80px; } .ui-icon-refresh { background-position: -64px -80px; } .ui-icon-shuffle { background-position: -80px -80px; } .ui-icon-transfer-e-w { background-position: -96px -80px; } .ui-icon-transferthick-e-w { background-position: -112px -80px; } .ui-icon-folder-collapsed { background-position: 0 -96px; } .ui-icon-folder-open { background-position: -16px -96px; } .ui-icon-document { background-position: -32px -96px; } .ui-icon-document-b { background-position: -48px -96px; } .ui-icon-note { background-position: -64px -96px; } .ui-icon-mail-closed { background-position: -80px -96px; } .ui-icon-mail-open { background-position: -96px -96px; } .ui-icon-suitcase { background-position: -112px -96px; } .ui-icon-comment { background-position: -128px -96px; } .ui-icon-person { background-position: -144px -96px; } .ui-icon-print { background-position: -160px -96px; } .ui-icon-trash { background-position: -176px -96px; } .ui-icon-locked { background-position: -192px -96px; } .ui-icon-unlocked { background-position: -208px -96px; } .ui-icon-bookmark { background-position: -224px -96px; } .ui-icon-tag { background-position: -240px -96px; } .ui-icon-home { background-position: 0 -112px; } .ui-icon-flag { background-position: -16px -112px; } .ui-icon-calendar { background-position: -32px -112px; } .ui-icon-cart { background-position: -48px -112px; } .ui-icon-pencil { background-position: -64px -112px; } .ui-icon-clock { background-position: -80px -112px; } .ui-icon-disk { background-position: -96px -112px; } .ui-icon-calculator { background-position: -112px -112px; } .ui-icon-zoomin { background-position: -128px -112px; } .ui-icon-zoomout { background-position: -144px -112px; } .ui-icon-search { background-position: -160px -112px; } .ui-icon-wrench { background-position: -176px -112px; } .ui-icon-gear { background-position: -192px -112px; } .ui-icon-heart { background-position: -208px -112px; } .ui-icon-star { background-position: -224px -112px; } .ui-icon-link { background-position: -240px -112px; } .ui-icon-cancel { background-position: 0 -128px; } .ui-icon-plus { background-position: -16px -128px; } .ui-icon-plusthick { background-position: -32px -128px; } .ui-icon-minus { background-position: -48px -128px; } .ui-icon-minusthick { background-position: -64px -128px; } .ui-icon-close { background-position: -80px -128px; } .ui-icon-closethick { background-position: -96px -128px; } .ui-icon-key { background-position: -112px -128px; } .ui-icon-lightbulb { background-position: -128px -128px; } .ui-icon-scissors { background-position: -144px -128px; } .ui-icon-clipboard { background-position: -160px -128px; } .ui-icon-copy { background-position: -176px -128px; } .ui-icon-contact { background-position: -192px -128px; } .ui-icon-image { background-position: -208px -128px; } .ui-icon-video { background-position: -224px -128px; } .ui-icon-script { background-position: -240px -128px; } .ui-icon-alert { background-position: 0 -144px; } .ui-icon-info { background-position: -16px -144px; } .ui-icon-notice { background-position: -32px -144px; } .ui-icon-help { background-position: -48px -144px; } .ui-icon-check { background-position: -64px -144px; } .ui-icon-bullet { background-position: -80px -144px; } .ui-icon-radio-on { background-position: -96px -144px; } .ui-icon-radio-off { background-position: -112px -144px; } .ui-icon-pin-w { background-position: -128px -144px; } .ui-icon-pin-s { background-position: -144px -144px; } .ui-icon-play { background-position: 0 -160px; } .ui-icon-pause { background-position: -16px -160px; } .ui-icon-seek-next { background-position: -32px -160px; } .ui-icon-seek-prev { background-position: -48px -160px; } .ui-icon-seek-end { background-position: -64px -160px; } .ui-icon-seek-start { background-position: -80px -160px; } /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ .ui-icon-seek-first { background-position: -80px -160px; } .ui-icon-stop { background-position: -96px -160px; } .ui-icon-eject { background-position: -112px -160px; } .ui-icon-volume-off { background-position: -128px -160px; } .ui-icon-volume-on { background-position: -144px -160px; } .ui-icon-power { background-position: 0 -176px; } .ui-icon-signal-diag { background-position: -16px -176px; } .ui-icon-signal { background-position: -32px -176px; } .ui-icon-battery-0 { background-position: -48px -176px; } .ui-icon-battery-1 { background-position: -64px -176px; } .ui-icon-battery-2 { background-position: -80px -176px; } .ui-icon-battery-3 { background-position: -96px -176px; } .ui-icon-circle-plus { background-position: 0 -192px; } .ui-icon-circle-minus { background-position: -16px -192px; } .ui-icon-circle-close { background-position: -32px -192px; } .ui-icon-circle-triangle-e { background-position: -48px -192px; } .ui-icon-circle-triangle-s { background-position: -64px -192px; } .ui-icon-circle-triangle-w { background-position: -80px -192px; } .ui-icon-circle-triangle-n { background-position: -96px -192px; } .ui-icon-circle-arrow-e { background-position: -112px -192px; } .ui-icon-circle-arrow-s { background-position: -128px -192px; } .ui-icon-circle-arrow-w { background-position: -144px -192px; } .ui-icon-circle-arrow-n { background-position: -160px -192px; } .ui-icon-circle-zoomin { background-position: -176px -192px; } .ui-icon-circle-zoomout { background-position: -192px -192px; } .ui-icon-circle-check { background-position: -208px -192px; } .ui-icon-circlesmall-plus { background-position: 0 -208px; } .ui-icon-circlesmall-minus { background-position: -16px -208px; } .ui-icon-circlesmall-close { background-position: -32px -208px; } .ui-icon-squaresmall-plus { background-position: -48px -208px; } .ui-icon-squaresmall-minus { background-position: -64px -208px; } .ui-icon-squaresmall-close { background-position: -80px -208px; } .ui-icon-grip-dotted-vertical { background-position: 0 -224px; } .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } .ui-icon-grip-solid-vertical { background-position: -32px -224px; } .ui-icon-grip-solid-horizontal { background-position: -48px -224px; } .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } .ui-icon-grip-diagonal-se { background-position: -80px -224px; } /* Misc visuals ----------------------------------*/ /* Corner radius */ .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { border-top-left-radius: 6px; } .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { border-top-right-radius: 6px; } .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { border-bottom-left-radius: 6px; } .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { border-bottom-right-radius: 6px; } /* Overlays */ .ui-widget-overlay { background: #6e4f1c url("images/ui-bg_diagonal-maze_20_6e4f1c_10x10.png") 50% 50% repeat; opacity: .6; filter: Alpha(Opacity=60); /* support: IE8 */ } .ui-widget-shadow { margin: 0 0 0 -10px; padding: 5px; background: #000000 url("images/ui-bg_diagonal-maze_40_000000_10x10.png") 50% 50% repeat; opacity: .6; filter: Alpha(Opacity=60); /* support: IE8 */ border-radius: 18px; }
{ "pile_set_name": "Github" }
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build !gccgo #include "textflag.h" // // System calls for 386, Linux // // See ../runtime/sys_linux_386.s for the reason why we always use int 0x80 // instead of the glibc-specific "CALL 0x10(GS)". #define INVOKE_SYSCALL INT $0x80 // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. TEXT ·Syscall(SB),NOSPLIT,$0-28 JMP syscall·Syscall(SB) TEXT ·Syscall6(SB),NOSPLIT,$0-40 JMP syscall·Syscall6(SB) TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 CALL runtime·entersyscall(SB) MOVL trap+0(FP), AX // syscall entry MOVL a1+4(FP), BX MOVL a2+8(FP), CX MOVL a3+12(FP), DX MOVL $0, SI MOVL $0, DI INVOKE_SYSCALL MOVL AX, r1+16(FP) MOVL DX, r2+20(FP) CALL runtime·exitsyscall(SB) RET TEXT ·RawSyscall(SB),NOSPLIT,$0-28 JMP syscall·RawSyscall(SB) TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 JMP syscall·RawSyscall6(SB) TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 MOVL trap+0(FP), AX // syscall entry MOVL a1+4(FP), BX MOVL a2+8(FP), CX MOVL a3+12(FP), DX MOVL $0, SI MOVL $0, DI INVOKE_SYSCALL MOVL AX, r1+16(FP) MOVL DX, r2+20(FP) RET TEXT ·socketcall(SB),NOSPLIT,$0-36 JMP syscall·socketcall(SB) TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 JMP syscall·rawsocketcall(SB) TEXT ·seek(SB),NOSPLIT,$0-28 JMP syscall·seek(SB)
{ "pile_set_name": "Github" }
T1 Time-Implicit 0 2 曾经 T2 Location-Nominal 36 38 南方 T3 Location-Nominal 39 41 北方 T4 Thing-Nominal 46 48 白云 T5 Thing-Nominal 52 54 小麦 T6 Thing-Nominal 55 57 玉米 R1 Located Arg1:T4 Arg2:T3 R2 Located Arg1:T5 Arg2:T3 R3 Located Arg1:T6 Arg2:T3 T7 Location-Nominal 71 73 北方 T8 Location-Name 74 76 罗山 R4 Located Arg1:T8 Arg2:T7 T9 Thing-Nominal 94 96 群山 T10 Thing-Nominal 98 99 屏 T11 Person-Pronoun 101 102 我 T12 Location-Name 118 120 罗山 T13 Time-Explicit 122 126 六亿年前 T14 Location-Name 146 149 招远城 T15 Location-Name 156 158 罗山 T16 Person-Pronoun 202 203 我 T17 Location-Name 209 211 罗山 T18 Location-Nominal 213 221 我们所居住的城市 R5 Near Arg1:T17 Arg2:T18 T19 Person-Pronoun 237 238 我 T20 Metric 241 244 数亿年 T21 Location-Name 246 248 罗山 T22 Thing-Nominal 252 254 大书 T23 Thing-Name 255 258 半仙洞 T24 Thing-Name 259 262 玫瑰山 T25 Thing-Name 263 266 秋千柱 T26 Thing-Name 267 270 莲花盆 T27 Thing-Name 271 274 青龙峰 T28 Thing-Name 275 278 白龙峰 T29 Thing-Name 279 282 千年龟 T30 Thing-Name 283 286 藏金洞 T31 Thing-Nominal 287 290 大瀑布 T32 Metric 305 306;307 309 几 十里 T33 Location-Nominal 311 315 原始森林 R6 Located Arg1:T31 Arg2:T21 R7 Located Arg1:T30 Arg2:T21 R8 Located Arg1:T29 Arg2:T21 R9 Located Arg1:T27 Arg2:T21 R10 Located Arg1:T26 Arg2:T21 R11 Located Arg1:T25 Arg2:T21 R12 Located Arg1:T24 Arg2:T21 R13 Located Arg1:T23 Arg2:T21 R14 Located Arg1:T28 Arg2:T21 T34 Person-Pronoun 316 317 我 T35 Location-Name 325 328 地球上 T36 Thing-Nominal 332 334 动物 T37 Thing-Nominal 334 336 恐龙 T38 Thing-Nominal 337 339 剑龙 T39 Thing-Nominal 340 343 古骆驼 T40 Thing-Nominal 344 347 始祖象 T41 Thing-Nominal 348 350 古猿 T42 Thing-Nominal 351 354 古玳瑁 T43 Thing-Nominal 355 358 史前马 R15 General-Special Arg1:T37 Arg2:T36 R16 General-Special Arg1:T38 Arg2:T36 R17 General-Special Arg1:T39 Arg2:T36 R18 General-Special Arg1:T40 Arg2:T36 R19 General-Special Arg1:T41 Arg2:T36 R20 General-Special Arg1:T42 Arg2:T36 R21 General-Special Arg1:T43 Arg2:T36 T44 Person-Nominal 371 373 如来 T45 Person-Nominal 374 378 玉皇大帝 T46 Person-Nominal 379 383 王母娘娘 T47 Person-Nominal 384 388 观音菩萨 T48 Person-Pronoun 393 394 我 T49 Person-Pronoun 399 400 我 T50 Thing-Nominal 405 407 石片 T51 Thing-Nominal 411 417 地球早期生物 T52 Thing-Nominal 417 420 三叶虫 * Coreference T52 T51 T53 Location-Name 427 429 罗山 T54 Location-Pronoun 430 431 你 * Coreference T54 T53 T55 Person-Pronoun 436 437 我 T56 Location-Name 444 450 罗山森林公园 T57 Person-Pronoun 452 453 我 T58 Time-Implicit 467 469 昨天 T59 Thing-Nominal 479 481 画儿 T60 Person-Pronoun 490 491 我 T61 Thing-Name 497 500 莲花盆 T62 Thing-Nominal 514 516 楼房 T63 Thing-Nominal 521 523 巨石 T64 Thing-Nominal 528 530 花瓣 T65 Thing-Nominal 544 546 莲花 R22 Part-Whole Arg1:T64 Arg2:T61 T66 Person-Pronoun 552 553 我 T67 Thing-Nominal 559 564 观音的坐骑 * Coreference T61 T67 T68 Location-Nominal 570 572 盆顶 T69 Location-Nominal 575 577 盆底 T70 Person-Nominal 580 582 女性 T71 Thing-Nominal 588 589 腿 T72 Thing-Nominal 590 591 臀 R23 Part-Whole Arg1:T71 Arg2:T70 R24 Part-Whole Arg1:T72 Arg2:T70 T73 Thing-Nominal 592 594 压痕 R25 Located Arg1:T73 Arg2:T69 T74 Person-Pronoun 596 597 人 T75 Location-Nominal 602 604 盆中 T76 Thing-Nominal 606 608 清水 R26 Located Arg1:T76 Arg2:T75 T77 Location-Nominal 609 611 水中 T78 Thing-Nominal 616 618 小鱼 R27 Located Arg1:T78 Arg2:T77 T79 Location-Name 633 637 玫瑰山经 T80 Thing-Nominal 641 643 玫瑰 R28 Located Arg1:T80 Arg2:T79 T81 Person-Pronoun 646 647 我 T82 Time-Implicit 654 658 亿万年前 T83 Location-Pronoun 659 661 这儿 * Coreference T83 T79 T87 T84 Thing-Nominal 668 669 山 T85 Thing-Nominal 670 671 海 T86 Thing-Nominal 682 684 红花 * Coreference T80 T86 T87 Location-Nominal 680 681 山 T88 Person-Pronoun 699 700 我 T89 Location-Name 719 723 班仙古刹 T90 Thing-Nominal 726 728 古木 R29 Located Arg1:T90 Arg2:T89 T91 Thing-Nominal 731 733 怪石 R30 Located Arg1:T91 Arg2:T89 T92 Time-Implicit 742 744 当年 T93 Person-Nominal 744 748 那位大师 T94 Location-Name 755 757 石门 T95 Person-Nominal 758 760 有人 T96 Thing-Nominal 767 768 书 T97 Thing-Name 772 777 日觉观传奇 * Coreference T96 T97 T98 Location-Name 783 785 古刹 * Coreference T98 T89 T99 Location-Name 797 799 罗山 T100 Thing-Nominal 803 806 大瀑布 R31 Located Arg1:T100 Arg2:T99 T101 Location-Nominal 809 811 悬崖 T102 Thing-Nominal 813 815 银河 R32 Located Arg1:T100 Arg2:T101 T103 Thing-Nominal 819 820 珠 T104 Thing-Nominal 821 822 玉 T105 Thing-Nominal 830 834 七色彩虹 T106 Location-Nominal 842 844 悬崖 T107 Thing-Nominal 852 854 泉水 R33 Near Arg1:T107 Arg2:T106 T108 Location-Nominal 855 857 岸边 T109 Thing-Nominal 862 864 岩石 R34 Located Arg1:T109 Arg2:T108 T110 Person-Pronoun 865 866 我 T111 Person-Nominal 868 871 一丛人 T113 Thing-Nominal 902 904 裙裾 T112 Person-Nominal 893 895 道人 T114 Thing-Nominal 895 897 上衣 R35 Ownership Arg1:T112 Arg2:T114 T115 Thing-Nominal 912 913 石 T116 Person-Pronoun 915 916 我 T117 Thing-Nominal 946 948 夕阳 T118 Location-Name 954 956 罗山 T119 Thing-Nominal 965 967 袈裟 T120 Thing-Nominal 971 975 黑色大蛇 T121 Person-Pronoun 976 977 我 T122 Location-Nominal 980 982 草丛 R36 Located Arg1:T120 Arg2:T122 T123 Thing-Nominal 986 987 嘴 R37 Part-Whole Arg1:T120 Arg2:T123 T124 Thing-Nominal 998 1000 野兔 R38 Located Arg1:T124 Arg2:T123 T125 Person-Pronoun 1001 1002 我 T126 Thing-Nominal 1008 1010 冷汗 T127 Location-Nominal 1014 1017 森林里 T128 Thing-Nominal 1018 1020 野狼 T129 Thing-Nominal 1022 1024 狐狸 R39 Located Arg1:T129 Arg2:T127 R40 Located Arg1:T128 Arg2:T127 T130 Thing-Nominal 1029 1030 天 T131 Thing-Nominal 1038 1039 云 T132 Location-Nominal 1046 1048 山野 T133 Person-Pronoun 1054 1056 你们 T134 Location-Name 1080 1082 罗山 T135 Location-Name 1088 1090 罗山 T136 Location-Name 1105 1107 罗山 T137 Location-Name 1108 1110 罗山
{ "pile_set_name": "Github" }
//== TrustNonnullChecker.cpp --------- API nullability modeling -*- C++ -*--==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This checker adds nullability-related assumptions: // // 1. Methods annotated with _Nonnull // which come from system headers actually return a non-null pointer. // // 2. NSDictionary key is non-null after the keyword subscript operation // on read if and only if the resulting expression is non-null. // // 3. NSMutableDictionary index is non-null after a write operation. // //===----------------------------------------------------------------------===// #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h" #include "clang/Analysis/SelectorExtras.h" #include "clang/StaticAnalyzer/Core/Checker.h" #include "clang/StaticAnalyzer/Core/CheckerManager.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h" using namespace clang; using namespace ento; /// Records implications between symbols. /// The semantics is: /// (antecedent != 0) => (consequent != 0) /// These implications are then read during the evaluation of the assumption, /// and the appropriate antecedents are applied. REGISTER_MAP_WITH_PROGRAMSTATE(NonNullImplicationMap, SymbolRef, SymbolRef) /// The semantics is: /// (antecedent == 0) => (consequent == 0) REGISTER_MAP_WITH_PROGRAMSTATE(NullImplicationMap, SymbolRef, SymbolRef) namespace { class TrustNonnullChecker : public Checker<check::PostCall, check::PostObjCMessage, check::DeadSymbols, eval::Assume> { // Do not try to iterate over symbols with higher complexity. static unsigned constexpr ComplexityThreshold = 10; Selector ObjectForKeyedSubscriptSel; Selector ObjectForKeySel; Selector SetObjectForKeyedSubscriptSel; Selector SetObjectForKeySel; public: TrustNonnullChecker(ASTContext &Ctx) : ObjectForKeyedSubscriptSel( getKeywordSelector(Ctx, "objectForKeyedSubscript")), ObjectForKeySel(getKeywordSelector(Ctx, "objectForKey")), SetObjectForKeyedSubscriptSel( getKeywordSelector(Ctx, "setObject", "forKeyedSubscript")), SetObjectForKeySel(getKeywordSelector(Ctx, "setObject", "forKey")) {} ProgramStateRef evalAssume(ProgramStateRef State, SVal Cond, bool Assumption) const { const SymbolRef CondS = Cond.getAsSymbol(); if (!CondS || CondS->computeComplexity() > ComplexityThreshold) return State; for (auto B=CondS->symbol_begin(), E=CondS->symbol_end(); B != E; ++B) { const SymbolRef Antecedent = *B; State = addImplication(Antecedent, State, true); State = addImplication(Antecedent, State, false); } return State; } void checkPostCall(const CallEvent &Call, CheckerContext &C) const { // Only trust annotations for system headers for non-protocols. if (!Call.isInSystemHeader()) return; ProgramStateRef State = C.getState(); if (isNonNullPtr(Call, C)) if (auto L = Call.getReturnValue().getAs<Loc>()) State = State->assume(*L, /*assumption=*/true); C.addTransition(State); } void checkPostObjCMessage(const ObjCMethodCall &Msg, CheckerContext &C) const { const ObjCInterfaceDecl *ID = Msg.getReceiverInterface(); if (!ID) return; ProgramStateRef State = C.getState(); // Index to setter for NSMutableDictionary is assumed to be non-null, // as an exception is thrown otherwise. if (interfaceHasSuperclass(ID, "NSMutableDictionary") && (Msg.getSelector() == SetObjectForKeyedSubscriptSel || Msg.getSelector() == SetObjectForKeySel)) { if (auto L = Msg.getArgSVal(1).getAs<Loc>()) State = State->assume(*L, /*assumption=*/true); } // Record an implication: index is non-null if the output is non-null. if (interfaceHasSuperclass(ID, "NSDictionary") && (Msg.getSelector() == ObjectForKeyedSubscriptSel || Msg.getSelector() == ObjectForKeySel)) { SymbolRef ArgS = Msg.getArgSVal(0).getAsSymbol(); SymbolRef RetS = Msg.getReturnValue().getAsSymbol(); if (ArgS && RetS) { // Emulate an implication: the argument is non-null if // the return value is non-null. State = State->set<NonNullImplicationMap>(RetS, ArgS); // Conversely, when the argument is null, the return value // is definitely null. State = State->set<NullImplicationMap>(ArgS, RetS); } } C.addTransition(State); } void checkDeadSymbols(SymbolReaper &SymReaper, CheckerContext &C) const { ProgramStateRef State = C.getState(); State = dropDeadFromGDM<NullImplicationMap>(SymReaper, State); State = dropDeadFromGDM<NonNullImplicationMap>(SymReaper, State); C.addTransition(State); } private: /// \returns State with GDM \p MapName where all dead symbols were // removed. template <typename MapName> ProgramStateRef dropDeadFromGDM(SymbolReaper &SymReaper, ProgramStateRef State) const { for (const std::pair<SymbolRef, SymbolRef> &P : State->get<MapName>()) if (!SymReaper.isLive(P.first) || !SymReaper.isLive(P.second)) State = State->remove<MapName>(P.first); return State; } /// \returns Whether we trust the result of the method call to be /// a non-null pointer. bool isNonNullPtr(const CallEvent &Call, CheckerContext &C) const { QualType ExprRetType = Call.getResultType(); if (!ExprRetType->isAnyPointerType()) return false; if (getNullabilityAnnotation(ExprRetType) == Nullability::Nonnull) return true; // The logic for ObjC instance method calls is more complicated, // as the return value is nil when the receiver is nil. if (!isa<ObjCMethodCall>(&Call)) return false; const auto *MCall = cast<ObjCMethodCall>(&Call); const ObjCMethodDecl *MD = MCall->getDecl(); // Distrust protocols. if (isa<ObjCProtocolDecl>(MD->getDeclContext())) return false; QualType DeclRetType = MD->getReturnType(); if (getNullabilityAnnotation(DeclRetType) != Nullability::Nonnull) return false; // For class messages it is sufficient for the declaration to be // annotated _Nonnull. if (!MCall->isInstanceMessage()) return true; // Alternatively, the analyzer could know that the receiver is not null. SVal Receiver = MCall->getReceiverSVal(); ConditionTruthVal TV = C.getState()->isNonNull(Receiver); if (TV.isConstrainedTrue()) return true; return false; } /// \return Whether \p ID has a superclass by the name \p ClassName. bool interfaceHasSuperclass(const ObjCInterfaceDecl *ID, StringRef ClassName) const { if (ID->getIdentifier()->getName() == ClassName) return true; if (const ObjCInterfaceDecl *Super = ID->getSuperClass()) return interfaceHasSuperclass(Super, ClassName); return false; } /// \return a state with an optional implication added (if exists) /// from a map of recorded implications. /// If \p Negated is true, checks NullImplicationMap, and assumes /// the negation of \p Antecedent. /// Checks NonNullImplicationMap and assumes \p Antecedent otherwise. ProgramStateRef addImplication(SymbolRef Antecedent, ProgramStateRef InputState, bool Negated) const { if (!InputState) return nullptr; SValBuilder &SVB = InputState->getStateManager().getSValBuilder(); const SymbolRef *Consequent = Negated ? InputState->get<NonNullImplicationMap>(Antecedent) : InputState->get<NullImplicationMap>(Antecedent); if (!Consequent) return InputState; SVal AntecedentV = SVB.makeSymbolVal(Antecedent); ProgramStateRef State = InputState; if ((Negated && InputState->isNonNull(AntecedentV).isConstrainedTrue()) || (!Negated && InputState->isNull(AntecedentV).isConstrainedTrue())) { SVal ConsequentS = SVB.makeSymbolVal(*Consequent); State = InputState->assume(ConsequentS.castAs<DefinedSVal>(), Negated); if (!State) return nullptr; // Drop implications from the map. if (Negated) { State = State->remove<NonNullImplicationMap>(Antecedent); State = State->remove<NullImplicationMap>(*Consequent); } else { State = State->remove<NullImplicationMap>(Antecedent); State = State->remove<NonNullImplicationMap>(*Consequent); } } return State; } }; } // end empty namespace void ento::registerTrustNonnullChecker(CheckerManager &Mgr) { Mgr.registerChecker<TrustNonnullChecker>(Mgr.getASTContext()); } bool ento::shouldRegisterTrustNonnullChecker(const LangOptions &LO) { return true; }
{ "pile_set_name": "Github" }
import React from 'react' import PropTypes from 'prop-types' import CircularProgress from '@material-ui/core/CircularProgress' import { makeStyles } from '@material-ui/core/styles' import styles from './LoadingSpinner.styles' const useStyles = makeStyles(styles) function LoadingSpinner({ size }) { const classes = useStyles() return ( <div className={classes.root}> <div className={classes.progress}> <CircularProgress mode="indeterminate" size={size || 80} /> </div> </div> ) } LoadingSpinner.propTypes = { size: PropTypes.number } export default LoadingSpinner
{ "pile_set_name": "Github" }
/* * Copyright © 2014 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) 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. */ #ifndef _INTEL_GUC_FWIF_H #define _INTEL_GUC_FWIF_H #define GUC_CLIENT_PRIORITY_KMD_HIGH 0 #define GUC_CLIENT_PRIORITY_HIGH 1 #define GUC_CLIENT_PRIORITY_KMD_NORMAL 2 #define GUC_CLIENT_PRIORITY_NORMAL 3 #define GUC_CLIENT_PRIORITY_NUM 4 #define GUC_MAX_STAGE_DESCRIPTORS 1024 #define GUC_INVALID_STAGE_ID GUC_MAX_STAGE_DESCRIPTORS #define GUC_RENDER_ENGINE 0 #define GUC_VIDEO_ENGINE 1 #define GUC_BLITTER_ENGINE 2 #define GUC_VIDEOENHANCE_ENGINE 3 #define GUC_VIDEO_ENGINE2 4 #define GUC_MAX_ENGINES_NUM (GUC_VIDEO_ENGINE2 + 1) /* Work queue item header definitions */ #define WQ_STATUS_ACTIVE 1 #define WQ_STATUS_SUSPENDED 2 #define WQ_STATUS_CMD_ERROR 3 #define WQ_STATUS_ENGINE_ID_NOT_USED 4 #define WQ_STATUS_SUSPENDED_FROM_RESET 5 #define WQ_TYPE_SHIFT 0 #define WQ_TYPE_BATCH_BUF (0x1 << WQ_TYPE_SHIFT) #define WQ_TYPE_PSEUDO (0x2 << WQ_TYPE_SHIFT) #define WQ_TYPE_INORDER (0x3 << WQ_TYPE_SHIFT) #define WQ_TARGET_SHIFT 10 #define WQ_LEN_SHIFT 16 #define WQ_NO_WCFLUSH_WAIT (1 << 27) #define WQ_PRESENT_WORKLOAD (1 << 28) #define WQ_RING_TAIL_SHIFT 20 #define WQ_RING_TAIL_MAX 0x7FF /* 2^11 QWords */ #define WQ_RING_TAIL_MASK (WQ_RING_TAIL_MAX << WQ_RING_TAIL_SHIFT) #define GUC_DOORBELL_ENABLED 1 #define GUC_DOORBELL_DISABLED 0 #define GUC_STAGE_DESC_ATTR_ACTIVE BIT(0) #define GUC_STAGE_DESC_ATTR_PENDING_DB BIT(1) #define GUC_STAGE_DESC_ATTR_KERNEL BIT(2) #define GUC_STAGE_DESC_ATTR_PREEMPT BIT(3) #define GUC_STAGE_DESC_ATTR_RESET BIT(4) #define GUC_STAGE_DESC_ATTR_WQLOCKED BIT(5) #define GUC_STAGE_DESC_ATTR_PCH BIT(6) #define GUC_STAGE_DESC_ATTR_TERMINATED BIT(7) /* The guc control data is 10 DWORDs */ #define GUC_CTL_CTXINFO 0 #define GUC_CTL_CTXNUM_IN16_SHIFT 0 #define GUC_CTL_BASE_ADDR_SHIFT 12 #define GUC_CTL_ARAT_HIGH 1 #define GUC_CTL_ARAT_LOW 2 #define GUC_CTL_DEVICE_INFO 3 #define GUC_CTL_LOG_PARAMS 4 #define GUC_LOG_VALID (1 << 0) #define GUC_LOG_NOTIFY_ON_HALF_FULL (1 << 1) #define GUC_LOG_ALLOC_IN_MEGABYTE (1 << 3) #define GUC_LOG_CRASH_PAGES 1 #define GUC_LOG_CRASH_SHIFT 4 #define GUC_LOG_DPC_PAGES 7 #define GUC_LOG_DPC_SHIFT 6 #define GUC_LOG_ISR_PAGES 7 #define GUC_LOG_ISR_SHIFT 9 #define GUC_LOG_BUF_ADDR_SHIFT 12 #define GUC_CTL_PAGE_FAULT_CONTROL 5 #define GUC_CTL_WA 6 #define GUC_CTL_WA_UK_BY_DRIVER (1 << 3) #define GUC_CTL_FEATURE 7 #define GUC_CTL_VCS2_ENABLED (1 << 0) #define GUC_CTL_KERNEL_SUBMISSIONS (1 << 1) #define GUC_CTL_FEATURE2 (1 << 2) #define GUC_CTL_POWER_GATING (1 << 3) #define GUC_CTL_DISABLE_SCHEDULER (1 << 4) #define GUC_CTL_PREEMPTION_LOG (1 << 5) #define GUC_CTL_ENABLE_SLPC (1 << 7) #define GUC_CTL_RESET_ON_PREMPT_FAILURE (1 << 8) #define GUC_CTL_DEBUG 8 #define GUC_LOG_VERBOSITY_SHIFT 0 #define GUC_LOG_VERBOSITY_LOW (0 << GUC_LOG_VERBOSITY_SHIFT) #define GUC_LOG_VERBOSITY_MED (1 << GUC_LOG_VERBOSITY_SHIFT) #define GUC_LOG_VERBOSITY_HIGH (2 << GUC_LOG_VERBOSITY_SHIFT) #define GUC_LOG_VERBOSITY_ULTRA (3 << GUC_LOG_VERBOSITY_SHIFT) /* Verbosity range-check limits, without the shift */ #define GUC_LOG_VERBOSITY_MIN 0 #define GUC_LOG_VERBOSITY_MAX 3 #define GUC_LOG_VERBOSITY_MASK 0x0000000f #define GUC_LOG_DESTINATION_MASK (3 << 4) #define GUC_LOG_DISABLED (1 << 6) #define GUC_PROFILE_ENABLED (1 << 7) #define GUC_WQ_TRACK_ENABLED (1 << 8) #define GUC_ADS_ENABLED (1 << 9) #define GUC_LOG_DEFAULT_DISABLED (1 << 10) #define GUC_ADS_ADDR_SHIFT 11 #define GUC_ADS_ADDR_MASK 0xfffff800 #define GUC_CTL_RSRVD 9 #define GUC_CTL_MAX_DWORDS (SOFT_SCRATCH_COUNT - 2) /* [1..14] */ /** * DOC: GuC Firmware Layout * * The GuC firmware layout looks like this: * * +-------------------------------+ * | uc_css_header | * | | * | contains major/minor version | * +-------------------------------+ * | uCode | * +-------------------------------+ * | RSA signature | * +-------------------------------+ * | modulus key | * +-------------------------------+ * | exponent val | * +-------------------------------+ * * The firmware may or may not have modulus key and exponent data. The header, * uCode and RSA signature are must-have components that will be used by driver. * Length of each components, which is all in dwords, can be found in header. * In the case that modulus and exponent are not present in fw, a.k.a truncated * image, the length value still appears in header. * * Driver will do some basic fw size validation based on the following rules: * * 1. Header, uCode and RSA are must-have components. * 2. All firmware components, if they present, are in the sequence illustrated * in the layout table above. * 3. Length info of each component can be found in header, in dwords. * 4. Modulus and exponent key are not required by driver. They may not appear * in fw. So driver will load a truncated firmware in this case. * * HuC firmware layout is same as GuC firmware. * * HuC firmware css header is different. However, the only difference is where * the version information is saved. The uc_css_header is unified to support * both. Driver should get HuC version from uc_css_header.huc_sw_version, while * uc_css_header.guc_sw_version for GuC. */ struct uc_css_header { u32 module_type; /* header_size includes all non-uCode bits, including css_header, rsa * key, modulus key and exponent data. */ u32 header_size_dw; u32 header_version; u32 module_id; u32 module_vendor; union { struct { u8 day; u8 month; u16 year; }; u32 date; }; u32 size_dw; /* uCode plus header_size_dw */ u32 key_size_dw; u32 modulus_size_dw; u32 exponent_size_dw; union { struct { u8 hour; u8 min; u16 sec; }; u32 time; }; char username[8]; char buildnumber[12]; union { struct { u32 branch_client_version; u32 sw_version; } guc; struct { u32 sw_version; u32 reserved; } huc; }; u32 prod_preprod_fw; u32 reserved[12]; u32 header_info; } __packed; struct guc_doorbell_info { u32 db_status; u32 cookie; u32 reserved[14]; } __packed; union guc_doorbell_qw { struct { u32 db_status; u32 cookie; }; u64 value_qw; } __packed; #define GUC_NUM_DOORBELLS 256 #define GUC_DOORBELL_INVALID (GUC_NUM_DOORBELLS) #define GUC_DB_SIZE (PAGE_SIZE) #define GUC_WQ_SIZE (PAGE_SIZE * 2) /* Work item for submitting workloads into work queue of GuC. */ struct guc_wq_item { u32 header; u32 context_desc; u32 submit_element_info; u32 fence_id; } __packed; struct guc_process_desc { u32 stage_id; u64 db_base_addr; u32 head; u32 tail; u32 error_offset; u64 wq_base_addr; u32 wq_size_bytes; u32 wq_status; u32 engine_presence; u32 priority; u32 reserved[30]; } __packed; /* engine id and context id is packed into guc_execlist_context.context_id*/ #define GUC_ELC_CTXID_OFFSET 0 #define GUC_ELC_ENGINE_OFFSET 29 /* The execlist context including software and HW information */ struct guc_execlist_context { u32 context_desc; u32 context_id; u32 ring_status; u32 ring_lrca; u32 ring_begin; u32 ring_end; u32 ring_next_free_location; u32 ring_current_tail_pointer_value; u8 engine_state_submit_value; u8 engine_state_wait_value; u16 pagefault_count; u16 engine_submit_queue_count; } __packed; /* * This structure describes a stage set arranged for a particular communication * between uKernel (GuC) and Driver (KMD). Technically, this is known as a * "GuC Context descriptor" in the specs, but we use the term "stage descriptor" * to avoid confusion with all the other things already named "context" in the * driver. A static pool of these descriptors are stored inside a GEM object * (stage_desc_pool) which is held for the entire lifetime of our interaction * with the GuC, being allocated before the GuC is loaded with its firmware. */ struct guc_stage_desc { u32 sched_common_area; u32 stage_id; u32 pas_id; u8 engines_used; u64 db_trigger_cpu; u32 db_trigger_uk; u64 db_trigger_phy; u16 db_id; struct guc_execlist_context lrc[GUC_MAX_ENGINES_NUM]; u8 attribute; u32 priority; u32 wq_sampled_tail_offset; u32 wq_total_submit_enqueues; u32 process_desc; u32 wq_addr; u32 wq_size; u32 engine_presence; u8 engine_suspended; u8 reserved0[3]; u64 reserved1[1]; u64 desc_private; } __packed; /** * DOC: CTB based communication * * The CTB (command transport buffer) communication between Host and GuC * is based on u32 data stream written to the shared buffer. One buffer can * be used to transmit data only in one direction (one-directional channel). * * Current status of the each buffer is stored in the buffer descriptor. * Buffer descriptor holds tail and head fields that represents active data * stream. The tail field is updated by the data producer (sender), and head * field is updated by the data consumer (receiver):: * * +------------+ * | DESCRIPTOR | +=================+============+========+ * +============+ | | MESSAGE(s) | | * | address |--------->+=================+============+========+ * +------------+ * | head | ^-----head--------^ * +------------+ * | tail | ^---------tail-----------------^ * +------------+ * | size | ^---------------size--------------------^ * +------------+ * * Each message in data stream starts with the single u32 treated as a header, * followed by optional set of u32 data that makes message specific payload:: * * +------------+---------+---------+---------+ * | MESSAGE | * +------------+---------+---------+---------+ * | msg[0] | [1] | ... | [n-1] | * +------------+---------+---------+---------+ * | MESSAGE | MESSAGE PAYLOAD | * + HEADER +---------+---------+---------+ * | | 0 | ... | n | * +======+=====+=========+=========+=========+ * | 31:16| code| | | | * +------+-----+ | | | * | 15:5|flags| | | | * +------+-----+ | | | * | 4:0| len| | | | * +------+-----+---------+---------+---------+ * * ^-------------len-------------^ * * The message header consists of: * * - **len**, indicates length of the message payload (in u32) * - **code**, indicates message code * - **flags**, holds various bits to control message handling */ /* * Describes single command transport buffer. * Used by both guc-master and clients. */ struct guc_ct_buffer_desc { u32 addr; /* gfx address */ u64 host_private; /* host private data */ u32 size; /* size in bytes */ u32 head; /* offset updated by GuC*/ u32 tail; /* offset updated by owner */ u32 is_in_error; /* error indicator */ u32 fence; /* fence updated by GuC */ u32 status; /* status updated by GuC */ u32 owner; /* id of the channel owner */ u32 owner_sub_id; /* owner-defined field for extra tracking */ u32 reserved[5]; } __packed; /* Type of command transport buffer */ #define INTEL_GUC_CT_BUFFER_TYPE_SEND 0x0u #define INTEL_GUC_CT_BUFFER_TYPE_RECV 0x1u /* * Definition of the command transport message header (DW0) * * bit[4..0] message len (in dwords) * bit[7..5] reserved * bit[8] write fence to desc * bit[9] write status to H2G buff * bit[10] send status (via G2H) * bit[15..11] reserved * bit[31..16] action code */ #define GUC_CT_MSG_LEN_SHIFT 0 #define GUC_CT_MSG_LEN_MASK 0x1F #define GUC_CT_MSG_WRITE_FENCE_TO_DESC (1 << 8) #define GUC_CT_MSG_WRITE_STATUS_TO_BUFF (1 << 9) #define GUC_CT_MSG_SEND_STATUS (1 << 10) #define GUC_CT_MSG_ACTION_SHIFT 16 #define GUC_CT_MSG_ACTION_MASK 0xFFFF #define GUC_FORCEWAKE_RENDER (1 << 0) #define GUC_FORCEWAKE_MEDIA (1 << 1) #define GUC_POWER_UNSPECIFIED 0 #define GUC_POWER_D0 1 #define GUC_POWER_D1 2 #define GUC_POWER_D2 3 #define GUC_POWER_D3 4 /* Scheduling policy settings */ /* Reset engine upon preempt failure */ #define POLICY_RESET_ENGINE (1<<0) /* Preempt to idle on quantum expiry */ #define POLICY_PREEMPT_TO_IDLE (1<<1) #define POLICY_MAX_NUM_WI 15 #define POLICY_DEFAULT_DPC_PROMOTE_TIME_US 500000 #define POLICY_DEFAULT_EXECUTION_QUANTUM_US 1000000 #define POLICY_DEFAULT_PREEMPTION_TIME_US 500000 #define POLICY_DEFAULT_FAULT_TIME_US 250000 struct guc_policy { /* Time for one workload to execute. (in micro seconds) */ u32 execution_quantum; u32 reserved1; /* Time to wait for a preemption request to completed before issuing a * reset. (in micro seconds). */ u32 preemption_time; /* How much time to allow to run after the first fault is observed. * Then preempt afterwards. (in micro seconds) */ u32 fault_time; u32 policy_flags; u32 reserved[2]; } __packed; struct guc_policies { struct guc_policy policy[GUC_CLIENT_PRIORITY_NUM][GUC_MAX_ENGINES_NUM]; /* In micro seconds. How much time to allow before DPC processing is * called back via interrupt (to prevent DPC queue drain starving). * Typically 1000s of micro seconds (example only, not granularity). */ u32 dpc_promote_time; /* Must be set to take these new values. */ u32 is_valid; /* Max number of WIs to process per call. A large value may keep CS * idle. */ u32 max_num_work_items; u32 reserved[19]; } __packed; /* GuC MMIO reg state struct */ #define GUC_REGSET_FLAGS_NONE 0x0 #define GUC_REGSET_POWERCYCLE 0x1 #define GUC_REGSET_MASKED 0x2 #define GUC_REGSET_ENGINERESET 0x4 #define GUC_REGSET_SAVE_DEFAULT_VALUE 0x8 #define GUC_REGSET_SAVE_CURRENT_VALUE 0x10 #define GUC_REGSET_MAX_REGISTERS 25 #define GUC_MMIO_WHITE_LIST_START 0x24d0 #define GUC_MMIO_WHITE_LIST_MAX 12 #define GUC_S3_SAVE_SPACE_PAGES 10 struct guc_mmio_regset { struct __packed { u32 offset; u32 value; u32 flags; } registers[GUC_REGSET_MAX_REGISTERS]; u32 values_valid; u32 number_of_registers; } __packed; /* MMIO registers that are set as non privileged */ struct mmio_white_list { u32 mmio_start; u32 offsets[GUC_MMIO_WHITE_LIST_MAX]; u32 count; } __packed; struct guc_mmio_reg_state { struct guc_mmio_regset global_reg; struct guc_mmio_regset engine_reg[GUC_MAX_ENGINES_NUM]; struct mmio_white_list white_list[GUC_MAX_ENGINES_NUM]; } __packed; /* GuC Additional Data Struct */ struct guc_ads { u32 reg_state_addr; u32 reg_state_buffer; u32 golden_context_lrca; u32 scheduler_policies; u32 reserved0[3]; u32 eng_state_size[GUC_MAX_ENGINES_NUM]; u32 reserved2[4]; } __packed; /* GuC logging structures */ enum guc_log_buffer_type { GUC_ISR_LOG_BUFFER, GUC_DPC_LOG_BUFFER, GUC_CRASH_DUMP_LOG_BUFFER, GUC_MAX_LOG_BUFFER }; /** * DOC: GuC Log buffer Layout * * Page0 +-------------------------------+ * | ISR state header (32 bytes) | * | DPC state header | * | Crash dump state header | * Page1 +-------------------------------+ * | ISR logs | * Page9 +-------------------------------+ * | DPC logs | * Page17 +-------------------------------+ * | Crash Dump logs | * +-------------------------------+ * * Below state structure is used for coordination of retrieval of GuC firmware * logs. Separate state is maintained for each log buffer type. * read_ptr points to the location where i915 read last in log buffer and * is read only for GuC firmware. write_ptr is incremented by GuC with number * of bytes written for each log entry and is read only for i915. * When any type of log buffer becomes half full, GuC sends a flush interrupt. * GuC firmware expects that while it is writing to 2nd half of the buffer, * first half would get consumed by Host and then get a flush completed * acknowledgment from Host, so that it does not end up doing any overwrite * causing loss of logs. So when buffer gets half filled & i915 has requested * for interrupt, GuC will set flush_to_file field, set the sampled_write_ptr * to the value of write_ptr and raise the interrupt. * On receiving the interrupt i915 should read the buffer, clear flush_to_file * field and also update read_ptr with the value of sample_write_ptr, before * sending an acknowledgment to GuC. marker & version fields are for internal * usage of GuC and opaque to i915. buffer_full_cnt field is incremented every * time GuC detects the log buffer overflow. */ struct guc_log_buffer_state { u32 marker[2]; u32 read_ptr; u32 write_ptr; u32 size; u32 sampled_write_ptr; union { struct { u32 flush_to_file:1; u32 buffer_full_cnt:4; u32 reserved:27; }; u32 flags; }; u32 version; } __packed; struct guc_ctx_report { u32 report_return_status; u32 reserved1[64]; u32 affected_count; u32 reserved2[2]; } __packed; /* GuC Shared Context Data Struct */ struct guc_shared_ctx_data { u32 addr_of_last_preempted_data_low; u32 addr_of_last_preempted_data_high; u32 addr_of_last_preempted_data_high_tmp; u32 padding; u32 is_mapped_to_proxy; u32 proxy_ctx_id; u32 engine_reset_ctx_id; u32 media_reset_count; u32 reserved1[8]; u32 uk_last_ctx_switch_reason; u32 was_reset; u32 lrca_gpu_addr; u64 execlist_ctx; u32 reserved2[66]; struct guc_ctx_report preempt_ctx_report[GUC_MAX_ENGINES_NUM]; } __packed; /** * DOC: MMIO based communication * * The MMIO based communication between Host and GuC uses software scratch * registers, where first register holds data treated as message header, * and other registers are used to hold message payload. * * For Gen9+, GuC uses software scratch registers 0xC180-0xC1B8 * * +-----------+---------+---------+---------+ * | MMIO[0] | MMIO[1] | ... | MMIO[n] | * +-----------+---------+---------+---------+ * | header | optional payload | * +======+====+=========+=========+=========+ * | 31:28|type| | | | * +------+----+ | | | * | 27:16|data| | | | * +------+----+ | | | * | 15:0|code| | | | * +------+----+---------+---------+---------+ * * The message header consists of: * * - **type**, indicates message type * - **code**, indicates message code, is specific for **type** * - **data**, indicates message data, optional, depends on **code** * * The following message **types** are supported: * * - **REQUEST**, indicates Host-to-GuC request, requested GuC action code * must be priovided in **code** field. Optional action specific parameters * can be provided in remaining payload registers or **data** field. * * - **RESPONSE**, indicates GuC-to-Host response from earlier GuC request, * action response status will be provided in **code** field. Optional * response data can be returned in remaining payload registers or **data** * field. */ #define INTEL_GUC_MSG_TYPE_SHIFT 28 #define INTEL_GUC_MSG_TYPE_MASK (0xF << INTEL_GUC_MSG_TYPE_SHIFT) #define INTEL_GUC_MSG_DATA_SHIFT 16 #define INTEL_GUC_MSG_DATA_MASK (0xFFF << INTEL_GUC_MSG_DATA_SHIFT) #define INTEL_GUC_MSG_CODE_SHIFT 0 #define INTEL_GUC_MSG_CODE_MASK (0xFFFF << INTEL_GUC_MSG_CODE_SHIFT) #define __INTEL_GUC_MSG_GET(T, m) \ (((m) & INTEL_GUC_MSG_ ## T ## _MASK) >> INTEL_GUC_MSG_ ## T ## _SHIFT) #define INTEL_GUC_MSG_TO_TYPE(m) __INTEL_GUC_MSG_GET(TYPE, m) #define INTEL_GUC_MSG_TO_DATA(m) __INTEL_GUC_MSG_GET(DATA, m) #define INTEL_GUC_MSG_TO_CODE(m) __INTEL_GUC_MSG_GET(CODE, m) enum intel_guc_msg_type { INTEL_GUC_MSG_TYPE_REQUEST = 0x0, INTEL_GUC_MSG_TYPE_RESPONSE = 0xF, }; #define __INTEL_GUC_MSG_TYPE_IS(T, m) \ (INTEL_GUC_MSG_TO_TYPE(m) == INTEL_GUC_MSG_TYPE_ ## T) #define INTEL_GUC_MSG_IS_REQUEST(m) __INTEL_GUC_MSG_TYPE_IS(REQUEST, m) #define INTEL_GUC_MSG_IS_RESPONSE(m) __INTEL_GUC_MSG_TYPE_IS(RESPONSE, m) enum intel_guc_action { INTEL_GUC_ACTION_DEFAULT = 0x0, INTEL_GUC_ACTION_REQUEST_PREEMPTION = 0x2, INTEL_GUC_ACTION_REQUEST_ENGINE_RESET = 0x3, INTEL_GUC_ACTION_SAMPLE_FORCEWAKE = 0x6, INTEL_GUC_ACTION_ALLOCATE_DOORBELL = 0x10, INTEL_GUC_ACTION_DEALLOCATE_DOORBELL = 0x20, INTEL_GUC_ACTION_LOG_BUFFER_FILE_FLUSH_COMPLETE = 0x30, INTEL_GUC_ACTION_FORCE_LOG_BUFFER_FLUSH = 0x302, INTEL_GUC_ACTION_ENTER_S_STATE = 0x501, INTEL_GUC_ACTION_EXIT_S_STATE = 0x502, INTEL_GUC_ACTION_SLPC_REQUEST = 0x3003, INTEL_GUC_ACTION_AUTHENTICATE_HUC = 0x4000, INTEL_GUC_ACTION_REGISTER_COMMAND_TRANSPORT_BUFFER = 0x4505, INTEL_GUC_ACTION_DEREGISTER_COMMAND_TRANSPORT_BUFFER = 0x4506, INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING = 0x0E000, INTEL_GUC_ACTION_LIMIT }; enum intel_guc_preempt_options { INTEL_GUC_PREEMPT_OPTION_DROP_WORK_Q = 0x4, INTEL_GUC_PREEMPT_OPTION_DROP_SUBMIT_Q = 0x8, }; enum intel_guc_report_status { INTEL_GUC_REPORT_STATUS_UNKNOWN = 0x0, INTEL_GUC_REPORT_STATUS_ACKED = 0x1, INTEL_GUC_REPORT_STATUS_ERROR = 0x2, INTEL_GUC_REPORT_STATUS_COMPLETE = 0x4, }; #define GUC_LOG_CONTROL_LOGGING_ENABLED (1 << 0) #define GUC_LOG_CONTROL_VERBOSITY_SHIFT 4 #define GUC_LOG_CONTROL_VERBOSITY_MASK (0xF << GUC_LOG_CONTROL_VERBOSITY_SHIFT) #define GUC_LOG_CONTROL_DEFAULT_LOGGING (1 << 8) enum intel_guc_response_status { INTEL_GUC_RESPONSE_STATUS_SUCCESS = 0x0, INTEL_GUC_RESPONSE_STATUS_GENERIC_FAIL = 0xF000, }; #define INTEL_GUC_MSG_IS_RESPONSE_SUCCESS(m) \ (typecheck(u32, (m)) && \ ((m) & (INTEL_GUC_MSG_TYPE_MASK | INTEL_GUC_MSG_CODE_MASK)) == \ ((INTEL_GUC_MSG_TYPE_RESPONSE << INTEL_GUC_MSG_TYPE_SHIFT) | \ (INTEL_GUC_RESPONSE_STATUS_SUCCESS << INTEL_GUC_MSG_CODE_SHIFT))) /* This action will be programmed in C1BC - SOFT_SCRATCH_15_REG */ enum intel_guc_recv_message { INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED = BIT(1), INTEL_GUC_RECV_MSG_FLUSH_LOG_BUFFER = BIT(3) }; #endif
{ "pile_set_name": "Github" }
// RUN: %target-swift-frontend -disable-objc-attr-requires-foundation-module -typecheck -verify -import-cf-types -I %S/Inputs/custom-modules %s // REQUIRES: objc_interop import CoreCooling import CFAndObjC func assertUnmanaged<T>(_ t: Unmanaged<T>) {} func assertManaged<T: AnyObject>(_ t: T) {} func test0(_ fridge: CCRefrigerator) { assertManaged(fridge) } func test1(_ power: Unmanaged<CCPowerSupply>) { assertUnmanaged(power) let fridge = CCRefrigeratorCreate(power) // expected-error {{cannot convert value of type 'Unmanaged<CCPowerSupply>' to expected argument type 'CCPowerSupply!'}} assertUnmanaged(fridge) } func test2() { let fridge = CCRefrigeratorCreate(kCCPowerStandard)! assertUnmanaged(fridge) } func test3(_ fridge: CCRefrigerator) { assertManaged(fridge) } func test4() { // FIXME: this should not require a type annotation let power: CCPowerSupply = kCCPowerStandard assertManaged(power) let fridge = CCRefrigeratorCreate(power)! assertUnmanaged(fridge) } func test5() { let power: Unmanaged<CCPowerSupply> = .passUnretained(kCCPowerStandard) assertUnmanaged(power) _ = CCRefrigeratorCreate(power.takeUnretainedValue()) } func test6() { let fridge = CCRefrigeratorCreate(nil) fridge?.release() } func test7() { let value = CFBottom()! assertUnmanaged(value) } func test8(_ f: CCRefrigerator) { _ = f as CFTypeRef _ = f as AnyObject } func test9() { let fridge = CCRefrigeratorCreateMutable(kCCPowerStandard).takeRetainedValue() let constFridge: CCRefrigerator = fridge CCRefrigeratorOpen(fridge) let item = CCRefrigeratorGet(fridge, 0).takeUnretainedValue() CCRefrigeratorInsert(item, fridge) // expected-error {{cannot convert value of type 'CCItem' to expected argument type 'CCMutableRefrigerator!'}} CCRefrigeratorInsert(constFridge, item) // expected-error {{cannot convert value of type 'CCRefrigerator' to expected argument type 'CCMutableRefrigerator!'}} CCRefrigeratorInsert(fridge, item) CCRefrigeratorClose(fridge) } func testProperty(_ k: Kitchen) { k.fridge = CCRefrigeratorCreate(kCCPowerStandard).takeRetainedValue() CCRefrigeratorOpen(k.fridge) CCRefrigeratorClose(k.fridge) } func testTollFree0(_ mduct: MutableDuct) { _ = mduct as CCMutableDuct let duct = mduct as Duct _ = duct as CCDuct } func testTollFree1(_ ccmduct: CCMutableDuct) { _ = ccmduct as MutableDuct let ccduct: CCDuct = ccmduct _ = ccduct as Duct } func testChainedAliases(_ fridge: CCRefrigerator) { _ = fridge as CCRefrigerator _ = fridge as CCFridge _ = fridge as CCFridgeRef // expected-error{{'CCFridgeRef' has been renamed to 'CCFridge'}} {{17-28=CCFridge}} } func testBannedImported(_ object: CCOpaqueTypeRef) { CCRetain(object) // expected-error {{'CCRetain' is unavailable: Core Foundation objects are automatically memory managed}} expected-warning {{result of call to 'CCRetain' is unused}} CCRelease(object) // expected-error {{'CCRelease' is unavailable: Core Foundation objects are automatically memory managed}} } func testOutParametersGood() { var fridge: CCRefrigerator? CCRefrigeratorCreateIndirect(&fridge) var power: CCPowerSupply? CCRefrigeratorGetPowerSupplyIndirect(fridge!, &power) var item: Unmanaged<CCItem>? CCRefrigeratorGetItemUnaudited(fridge!, 0, &item) } func testOutParametersBad() { let fridge: CCRefrigerator? CCRefrigeratorCreateIndirect(fridge) // expected-error {{cannot convert value of type 'CCRefrigerator?' to expected argument type 'UnsafeMutablePointer<CCRefrigerator?>?'}} let power: CCPowerSupply? CCRefrigeratorGetPowerSupplyIndirect(0, power) // expected-error {{cannot convert value of type 'Int' to expected argument type 'CCRefrigerator!'}} let item: CCItem? CCRefrigeratorGetItemUnaudited(0, 0, item) // expected-error {{cannot convert value of type 'Int' to expected argument type 'CCRefrigerator!'}} } func nameCollisions() { var objc: MyProblematicObject? var cf: MyProblematicObjectRef? cf = objc // expected-error {{cannot assign value of type 'MyProblematicObject?' to type 'MyProblematicObjectRef?'}} objc = cf // expected-error {{cannot assign value of type 'MyProblematicObjectRef?' to type 'MyProblematicObject?'}} var cfAlias: MyProblematicAliasRef? cfAlias = cf // okay cf = cfAlias // okay var otherAlias: MyProblematicAlias? otherAlias = cfAlias // expected-error {{cannot assign value of type 'MyProblematicAliasRef?' (aka 'Optional<MyProblematicObjectRef>') to type 'MyProblematicAlias?' (aka 'Optional<Float>')}} cfAlias = otherAlias // expected-error {{cannot assign value of type 'MyProblematicAlias?' (aka 'Optional<Float>') to type 'MyProblematicAliasRef?' (aka 'Optional<MyProblematicObjectRef>')}} func isOptionalFloat(_: inout Optional<Float>) {} isOptionalFloat(&otherAlias) // okay var np: NotAProblem? var np2: NotAProblemRef? // expected-error{{'NotAProblemRef' has been renamed to 'NotAProblem'}} {{12-26=NotAProblem}} np = np2 np2 = np } func testNonConstVoid() { let value: Unmanaged<CFNonConstVoidRef> = CFNonConstBottom()! assertUnmanaged(value) } class NuclearFridge: CCRefrigerator {} // expected-error {{cannot inherit from Core Foundation type 'CCRefrigerator'}} extension CCRefrigerator { @objc func foo() {} // expected-error {{method cannot be marked @objc because Core Foundation types are not classes in Objective-C}} func bar() {} // okay, implicitly non-objc } protocol SwiftProto {} @objc protocol ObjCProto {} extension CCRefrigerator: ObjCProto {} // expected-error {{Core Foundation class 'CCRefrigerator' cannot conform to @objc protocol 'ObjCProto' because Core Foundation types are not classes in Objective-C}} extension CCRefrigerator: SwiftProto {}
{ "pile_set_name": "Github" }
-- -- Copyright (C) 2017-2019 Dremio Corporation -- -- 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. -- -- tpch22 using 1395599672 as a seed to the RNG select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal from ( select substring(c_phone from 1 for 2) as cntrycode, c_acctbal from cp.`tpch/customer.parquet` c where substring(c_phone from 1 for 2) in ('24', '31', '11', '16', '21', '20', '34') and c_acctbal > ( select avg(c_acctbal) from cp.`tpch/customer.parquet` where c_acctbal > 0.00 and substring(c_phone from 1 for 2) in ('24', '31', '11', '16', '21', '20', '34') ) and not exists ( select * from cp.`tpch/orders.parquet` o where o.o_custkey = c.c_custkey ) ) as custsale group by cntrycode order by cntrycode;
{ "pile_set_name": "Github" }
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package costandusagereportserviceiface provides an interface to enable mocking the AWS Cost and Usage Report Service service client // for testing your code. // // It is important to note that this interface will have breaking changes // when the service model is updated and adds new API operations, paginators, // and waiters. package costandusagereportserviceiface import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/service/costandusagereportservice" ) // CostandUsageReportServiceAPI provides an interface to enable mocking the // costandusagereportservice.CostandUsageReportService service client's API operation, // paginators, and waiters. This make unit testing your code that calls out // to the SDK's service client's calls easier. // // The best way to use this interface is so the SDK's service client's calls // can be stubbed out for unit testing your code with the SDK without needing // to inject custom request handlers into the SDK's request pipeline. // // // myFunc uses an SDK service client to make a request to // // AWS Cost and Usage Report Service. // func myFunc(svc costandusagereportserviceiface.CostandUsageReportServiceAPI) bool { // // Make svc.DeleteReportDefinition request // } // // func main() { // sess := session.New() // svc := costandusagereportservice.New(sess) // // myFunc(svc) // } // // In your _test.go file: // // // Define a mock struct to be used in your unit tests of myFunc. // type mockCostandUsageReportServiceClient struct { // costandusagereportserviceiface.CostandUsageReportServiceAPI // } // func (m *mockCostandUsageReportServiceClient) DeleteReportDefinition(input *costandusagereportservice.DeleteReportDefinitionInput) (*costandusagereportservice.DeleteReportDefinitionOutput, error) { // // mock response/functionality // } // // func TestMyFunc(t *testing.T) { // // Setup Test // mockSvc := &mockCostandUsageReportServiceClient{} // // myfunc(mockSvc) // // // Verify myFunc's functionality // } // // It is important to note that this interface will have breaking changes // when the service model is updated and adds new API operations, paginators, // and waiters. Its suggested to use the pattern above for testing, or using // tooling to generate mocks to satisfy the interfaces. type CostandUsageReportServiceAPI interface { DeleteReportDefinition(*costandusagereportservice.DeleteReportDefinitionInput) (*costandusagereportservice.DeleteReportDefinitionOutput, error) DeleteReportDefinitionWithContext(aws.Context, *costandusagereportservice.DeleteReportDefinitionInput, ...request.Option) (*costandusagereportservice.DeleteReportDefinitionOutput, error) DeleteReportDefinitionRequest(*costandusagereportservice.DeleteReportDefinitionInput) (*request.Request, *costandusagereportservice.DeleteReportDefinitionOutput) DescribeReportDefinitions(*costandusagereportservice.DescribeReportDefinitionsInput) (*costandusagereportservice.DescribeReportDefinitionsOutput, error) DescribeReportDefinitionsWithContext(aws.Context, *costandusagereportservice.DescribeReportDefinitionsInput, ...request.Option) (*costandusagereportservice.DescribeReportDefinitionsOutput, error) DescribeReportDefinitionsRequest(*costandusagereportservice.DescribeReportDefinitionsInput) (*request.Request, *costandusagereportservice.DescribeReportDefinitionsOutput) DescribeReportDefinitionsPages(*costandusagereportservice.DescribeReportDefinitionsInput, func(*costandusagereportservice.DescribeReportDefinitionsOutput, bool) bool) error DescribeReportDefinitionsPagesWithContext(aws.Context, *costandusagereportservice.DescribeReportDefinitionsInput, func(*costandusagereportservice.DescribeReportDefinitionsOutput, bool) bool, ...request.Option) error PutReportDefinition(*costandusagereportservice.PutReportDefinitionInput) (*costandusagereportservice.PutReportDefinitionOutput, error) PutReportDefinitionWithContext(aws.Context, *costandusagereportservice.PutReportDefinitionInput, ...request.Option) (*costandusagereportservice.PutReportDefinitionOutput, error) PutReportDefinitionRequest(*costandusagereportservice.PutReportDefinitionInput) (*request.Request, *costandusagereportservice.PutReportDefinitionOutput) } var _ CostandUsageReportServiceAPI = (*costandusagereportservice.CostandUsageReportService)(nil)
{ "pile_set_name": "Github" }
package db import ( "database/sql" "fmt" "strconv" "sync" "github.com/OpenBazaar/openbazaar-go/repo" ) type ModeratedDB struct { modelStore } func NewModeratedStore(db *sql.DB, lock *sync.Mutex) repo.ModeratedStore { return &ModeratedDB{modelStore{db, lock}} } func (m *ModeratedDB) Put(peerId string) error { m.lock.Lock() defer m.lock.Unlock() stmt, err := m.PrepareQuery("insert into moderatedstores(peerID) values(?)") if err != nil { return fmt.Errorf("prepare moderated store sql: %s", err.Error()) } defer stmt.Close() _, err = stmt.Exec(peerId) if err != nil { return fmt.Errorf("commit moderated store: %s", err.Error()) } return nil } func (m *ModeratedDB) Get(offsetId string, limit int) ([]string, error) { m.lock.Lock() defer m.lock.Unlock() var stm string if offsetId != "" { stm = "select peerID from moderatedstores order by rowid desc limit " + strconv.Itoa(limit) + " offset ((select coalesce(max(rowid)+1, 0) from moderatedstores)-(select rowid from moderatedstores where peerID='" + offsetId + "'))" } else { stm = "select peerID from moderatedstores order by rowid desc limit " + strconv.Itoa(limit) + " offset 0" } var ret []string rows, err := m.db.Query(stm) if err != nil { return ret, err } defer rows.Close() for rows.Next() { var peerID string err = rows.Scan(&peerID) if err != nil { log.Error(err) } ret = append(ret, peerID) } return ret, nil } func (m *ModeratedDB) Delete(follower string) error { m.lock.Lock() defer m.lock.Unlock() _, err := m.db.Exec("delete from moderatedstores where peerID=?", follower) if err != nil { log.Error(err) } return nil }
{ "pile_set_name": "Github" }
/* Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Code generated by client-gen. DO NOT EDIT. package fake import ( "context" v1alpha1 "k8s.io/api/rbac/v1alpha1" 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" ) // FakeClusterRoles implements ClusterRoleInterface type FakeClusterRoles struct { Fake *FakeRbacV1alpha1 } var clusterrolesResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "clusterroles"} var clusterrolesKind = schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Kind: "ClusterRole"} // Get takes name of the clusterRole, and returns the corresponding clusterRole object, and an error if there is any. func (c *FakeClusterRoles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterRole, err error) { obj, err := c.Fake. Invokes(testing.NewRootGetAction(clusterrolesResource, name), &v1alpha1.ClusterRole{}) if obj == nil { return nil, err } return obj.(*v1alpha1.ClusterRole), err } // List takes label and field selectors, and returns the list of ClusterRoles that match those selectors. func (c *FakeClusterRoles) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterRoleList, err error) { obj, err := c.Fake. Invokes(testing.NewRootListAction(clusterrolesResource, clusterrolesKind, opts), &v1alpha1.ClusterRoleList{}) if obj == nil { return nil, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } list := &v1alpha1.ClusterRoleList{ListMeta: obj.(*v1alpha1.ClusterRoleList).ListMeta} for _, item := range obj.(*v1alpha1.ClusterRoleList).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 clusterRoles. func (c *FakeClusterRoles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewRootWatchAction(clusterrolesResource, opts)) } // Create takes the representation of a clusterRole and creates it. Returns the server's representation of the clusterRole, and an error, if there is any. func (c *FakeClusterRoles) Create(ctx context.Context, clusterRole *v1alpha1.ClusterRole, opts v1.CreateOptions) (result *v1alpha1.ClusterRole, err error) { obj, err := c.Fake. Invokes(testing.NewRootCreateAction(clusterrolesResource, clusterRole), &v1alpha1.ClusterRole{}) if obj == nil { return nil, err } return obj.(*v1alpha1.ClusterRole), err } // Update takes the representation of a clusterRole and updates it. Returns the server's representation of the clusterRole, and an error, if there is any. func (c *FakeClusterRoles) Update(ctx context.Context, clusterRole *v1alpha1.ClusterRole, opts v1.UpdateOptions) (result *v1alpha1.ClusterRole, err error) { obj, err := c.Fake. Invokes(testing.NewRootUpdateAction(clusterrolesResource, clusterRole), &v1alpha1.ClusterRole{}) if obj == nil { return nil, err } return obj.(*v1alpha1.ClusterRole), err } // Delete takes name of the clusterRole and deletes it. Returns an error if one occurs. func (c *FakeClusterRoles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. Invokes(testing.NewRootDeleteAction(clusterrolesResource, name), &v1alpha1.ClusterRole{}) return err } // DeleteCollection deletes a collection of objects. func (c *FakeClusterRoles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { action := testing.NewRootDeleteCollectionAction(clusterrolesResource, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.ClusterRoleList{}) return err } // Patch applies the patch and returns the patched clusterRole. func (c *FakeClusterRoles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRole, err error) { obj, err := c.Fake. Invokes(testing.NewRootPatchSubresourceAction(clusterrolesResource, name, pt, data, subresources...), &v1alpha1.ClusterRole{}) if obj == nil { return nil, err } return obj.(*v1alpha1.ClusterRole), err }
{ "pile_set_name": "Github" }
import graphql from 'babel-plugin-relay/macro' import React from 'react' import {createFragmentContainer} from 'react-relay' import {UserTasksHeader_viewer} from '~/__generated__/UserTasksHeader_viewer.graphql' import DashSectionControls from '../../../../components/Dashboard/DashSectionControls' import DashSectionHeader from '../../../../components/Dashboard/DashSectionHeader' import DashFilterToggle from '../../../../components/DashFilterToggle/DashFilterToggle' import {MenuPosition} from '../../../../hooks/useCoords' import useMenu from '../../../../hooks/useMenu' import lazyPreload from '../../../../utils/lazyPreload' import styled from '@emotion/styled' import LinkButton from '~/components/LinkButton' import {PALETTE} from '~/styles/paletteV2' import Checkbox from '~/components/Checkbox' import {ICON_SIZE} from '~/styles/typographyV2' import setArchivedTasksCheckbox from '~/utils/relay/setArchivedTasksCheckbox' import useAtmosphere from '~/hooks/useAtmosphere' const UserDashTeamMenu = lazyPreload(() => import( /* webpackChunkName: 'UserDashTeamMenu' */ '../../../../components/UserDashTeamMenu' ) ) const StyledLinkButton = styled(LinkButton)({ marginLeft: 8, color: PALETTE.TEXT_GRAY, fontWeight: 600, ':hover, :focus, :active': { color: PALETTE.TEXT_MAIN } }) const StyledCheckbox = styled(Checkbox)({ fontSize: ICON_SIZE.MD24, marginRight: 8, textAlign: 'center', userSelect: 'none', width: ICON_SIZE.MD24 }) const UserTasksHeaderDashSectionControls = styled(DashSectionControls)({ justifyContent: 'flex-start', }) interface Props { viewer: UserTasksHeader_viewer } const UserTasksHeader = (props: Props) => { const atmosphere = useAtmosphere() const {viewer} = props const {menuPortal, togglePortal, originRef, menuProps} = useMenu(MenuPosition.UPPER_RIGHT, { isDropdown: true }) const {teamFilter, showArchivedTasksCheckbox} = viewer const teamFilterName = (teamFilter && teamFilter.name) || 'All teams' return ( <DashSectionHeader> <UserTasksHeaderDashSectionControls> <DashFilterToggle label='Team' onClick={togglePortal} onMouseEnter={UserDashTeamMenu.preload} ref={originRef} value={teamFilterName} iconText='group' /> {menuPortal(<UserDashTeamMenu menuProps={menuProps} viewer={viewer} />)} <StyledLinkButton onClick={() => setArchivedTasksCheckbox(atmosphere, !showArchivedTasksCheckbox)} > <StyledCheckbox active={showArchivedTasksCheckbox} /> {'Archived'} </StyledLinkButton> </UserTasksHeaderDashSectionControls> </DashSectionHeader> ) } export default createFragmentContainer(UserTasksHeader, { viewer: graphql` fragment UserTasksHeader_viewer on User { id ...UserDashTeamMenu_viewer teamFilter { id name } showArchivedTasksCheckbox } ` })
{ "pile_set_name": "Github" }
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2014 Benoit Steiner <[email protected]> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #include "main.h" #include <sstream> #include <string> #include <Eigen/CXX11/Tensor> template<int DataLayout> static void test_output_0d() { Tensor<int, 0, DataLayout> tensor; tensor() = 123; std::stringstream os; os << tensor; std::string expected("123"); VERIFY_IS_EQUAL(std::string(os.str()), expected); } template<int DataLayout> static void test_output_1d() { Tensor<int, 1, DataLayout> tensor(5); for (int i = 0; i < 5; ++i) { tensor(i) = i; } std::stringstream os; os << tensor; std::string expected("0\n1\n2\n3\n4"); VERIFY_IS_EQUAL(std::string(os.str()), expected); Eigen::Tensor<double,1,DataLayout> empty_tensor(0); std::stringstream empty_os; empty_os << empty_tensor; std::string empty_string; VERIFY_IS_EQUAL(std::string(empty_os.str()), empty_string); } template<int DataLayout> static void test_output_2d() { Tensor<int, 2, DataLayout> tensor(5, 3); for (int i = 0; i < 5; ++i) { for (int j = 0; j < 3; ++j) { tensor(i, j) = i*j; } } std::stringstream os; os << tensor; std::string expected("0 0 0\n0 1 2\n0 2 4\n0 3 6\n0 4 8"); VERIFY_IS_EQUAL(std::string(os.str()), expected); } template<int DataLayout> static void test_output_expr() { Tensor<int, 1, DataLayout> tensor1(5); Tensor<int, 1, DataLayout> tensor2(5); for (int i = 0; i < 5; ++i) { tensor1(i) = i; tensor2(i) = 7; } std::stringstream os; os << tensor1 + tensor2; std::string expected(" 7\n 8\n 9\n10\n11"); VERIFY_IS_EQUAL(std::string(os.str()), expected); } template<int DataLayout> static void test_output_string() { Tensor<std::string, 2, DataLayout> tensor(5, 3); tensor.setConstant(std::string("foo")); std::cout << tensor << std::endl; std::stringstream os; os << tensor; std::string expected("foo foo foo\nfoo foo foo\nfoo foo foo\nfoo foo foo\nfoo foo foo"); VERIFY_IS_EQUAL(std::string(os.str()), expected); } template<int DataLayout> static void test_output_const() { Tensor<int, 1, DataLayout> tensor(5); for (int i = 0; i < 5; ++i) { tensor(i) = i; } TensorMap<Tensor<const int, 1, DataLayout> > tensor_map(tensor.data(), 5); std::stringstream os; os << tensor_map; std::string expected("0\n1\n2\n3\n4"); VERIFY_IS_EQUAL(std::string(os.str()), expected); } void test_cxx11_tensor_io() { CALL_SUBTEST(test_output_0d<ColMajor>()); CALL_SUBTEST(test_output_0d<RowMajor>()); CALL_SUBTEST(test_output_1d<ColMajor>()); CALL_SUBTEST(test_output_1d<RowMajor>()); CALL_SUBTEST(test_output_2d<ColMajor>()); CALL_SUBTEST(test_output_2d<RowMajor>()); CALL_SUBTEST(test_output_expr<ColMajor>()); CALL_SUBTEST(test_output_expr<RowMajor>()); CALL_SUBTEST(test_output_string<ColMajor>()); CALL_SUBTEST(test_output_string<RowMajor>()); CALL_SUBTEST(test_output_const<ColMajor>()); CALL_SUBTEST(test_output_const<RowMajor>()); }
{ "pile_set_name": "Github" }
<?php /** * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Sales\Controller\Adminhtml\Invoice; class Grid extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoice\Grid { }
{ "pile_set_name": "Github" }
#!/usr/bin/env ruby require 'bundler/setup' require 'screen-recorder' # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. # (If you use this, don't forget to add pry to your Gemfile!) # require "pry" # Pry.start require 'irb' IRB.start(__FILE__)
{ "pile_set_name": "Github" }
package rel import ( "testing" "github.com/stretchr/testify/assert" ) func TestNullable_Scan(t *testing.T) { a := 10 v := Nullable(&a).(nullable) v.Scan(5) assert.Equal(t, *v.dest.(*int), 5) } func TestNullable(t *testing.T) { a := 10 v := Nullable(&a) assert.Equal(t, nullable{dest: &a}, v) } type customScanner int func (*customScanner) Scan(interface{}) error { return nil } func TestNullable_nullable(t *testing.T) { a := customScanner(10) v := Nullable(&a) assert.Equal(t, &a, v) } func TestNullable_ptr(t *testing.T) { var a *int v := Nullable(&a) assert.Equal(t, &a, v) } func TestNullable_notPtr(t *testing.T) { assert.Panics(t, func() { Nullable(0) }) }
{ "pile_set_name": "Github" }
////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/interprocess for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_INTERPROCESS_DETAIL_FILE_WRAPPER_HPP #define BOOST_INTERPROCESS_DETAIL_FILE_WRAPPER_HPP #ifndef BOOST_CONFIG_HPP # include <boost/config.hpp> #endif # #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif #include <boost/interprocess/detail/config_begin.hpp> #include <boost/interprocess/detail/workaround.hpp> #include <boost/interprocess/detail/os_file_functions.hpp> #include <boost/interprocess/creation_tags.hpp> #include <boost/move/utility_core.hpp> #include <boost/interprocess/creation_tags.hpp> #include <boost/interprocess/detail/simple_swap.hpp> namespace boost { namespace interprocess { namespace ipcdetail{ class file_wrapper { #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) BOOST_MOVABLE_BUT_NOT_COPYABLE(file_wrapper) #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED public: //!Default constructor. //!Represents an empty file_wrapper. file_wrapper(); //!Creates a file object with name "name" and mode "mode", with the access mode "mode" //!If the file previously exists, throws an error. file_wrapper(create_only_t, const char *name, mode_t mode, const permissions &perm = permissions()) { this->priv_open_or_create(ipcdetail::DoCreate, name, mode, perm); } //!Tries to create a file with name "name" and mode "mode", with the //!access mode "mode". If the file previously exists, it tries to open it with mode "mode". //!Otherwise throws an error. file_wrapper(open_or_create_t, const char *name, mode_t mode, const permissions &perm = permissions()) { this->priv_open_or_create(ipcdetail::DoOpenOrCreate, name, mode, perm); } //!Tries to open a file with name "name", with the access mode "mode". //!If the file does not previously exist, it throws an error. file_wrapper(open_only_t, const char *name, mode_t mode) { this->priv_open_or_create(ipcdetail::DoOpen, name, mode, permissions()); } //!Moves the ownership of "moved"'s file to *this. //!After the call, "moved" does not represent any file. //!Does not throw file_wrapper(BOOST_RV_REF(file_wrapper) moved) : m_handle(file_handle_t(ipcdetail::invalid_file())) { this->swap(moved); } //!Moves the ownership of "moved"'s file to *this. //!After the call, "moved" does not represent any file. //!Does not throw file_wrapper &operator=(BOOST_RV_REF(file_wrapper) moved) { file_wrapper tmp(boost::move(moved)); this->swap(tmp); return *this; } //!Swaps to file_wrappers. //!Does not throw void swap(file_wrapper &other); //!Erases a file from the system. //!Returns false on error. Never throws static bool remove(const char *name); //!Sets the size of the file void truncate(offset_t length); //!Closes the //!file ~file_wrapper(); //!Returns the name of the file //!used in the constructor const char *get_name() const; //!Returns the name of the file //!used in the constructor bool get_size(offset_t &size) const; //!Returns access mode //!used in the constructor mode_t get_mode() const; //!Get mapping handle //!to use with mapped_region mapping_handle_t get_mapping_handle() const; private: //!Closes a previously opened file mapping. Never throws. void priv_close(); //!Closes a previously opened file mapping. Never throws. bool priv_open_or_create(ipcdetail::create_enum_t type, const char *filename, mode_t mode, const permissions &perm); file_handle_t m_handle; mode_t m_mode; std::string m_filename; }; inline file_wrapper::file_wrapper() : m_handle(file_handle_t(ipcdetail::invalid_file())) {} inline file_wrapper::~file_wrapper() { this->priv_close(); } inline const char *file_wrapper::get_name() const { return m_filename.c_str(); } inline bool file_wrapper::get_size(offset_t &size) const { return get_file_size((file_handle_t)m_handle, size); } inline void file_wrapper::swap(file_wrapper &other) { (simple_swap)(m_handle, other.m_handle); (simple_swap)(m_mode, other.m_mode); m_filename.swap(other.m_filename); } inline mapping_handle_t file_wrapper::get_mapping_handle() const { return mapping_handle_from_file_handle(m_handle); } inline mode_t file_wrapper::get_mode() const { return m_mode; } inline bool file_wrapper::priv_open_or_create (ipcdetail::create_enum_t type, const char *filename, mode_t mode, const permissions &perm = permissions()) { m_filename = filename; if(mode != read_only && mode != read_write){ error_info err(mode_error); throw interprocess_exception(err); } //Open file existing native API to obtain the handle switch(type){ case ipcdetail::DoOpen: m_handle = open_existing_file(filename, mode); break; case ipcdetail::DoCreate: m_handle = create_new_file(filename, mode, perm); break; case ipcdetail::DoOpenOrCreate: m_handle = create_or_open_file(filename, mode, perm); break; default: { error_info err = other_error; throw interprocess_exception(err); } } //Check for error if(m_handle == invalid_file()){ error_info err = system_error_code(); throw interprocess_exception(err); } m_mode = mode; return true; } inline bool file_wrapper::remove(const char *filename) { return delete_file(filename); } inline void file_wrapper::truncate(offset_t length) { if(!truncate_file(m_handle, length)){ error_info err(system_error_code()); throw interprocess_exception(err); } } inline void file_wrapper::priv_close() { if(m_handle != invalid_file()){ close_file(m_handle); m_handle = invalid_file(); } } } //namespace ipcdetail{ } //namespace interprocess { } //namespace boost { #include <boost/interprocess/detail/config_end.hpp> #endif //BOOST_INTERPROCESS_DETAIL_FILE_WRAPPER_HPP
{ "pile_set_name": "Github" }
/* * 文 件 名: DataCleanManager.java * 描 述: 主要功能有清除内/外缓存,清除数据库,清除sharedPreference,清除files和清除自定义目录 */ package tk.woppo.sunday.util; import java.io.File; import android.content.Context; import android.os.Environment; /** * 本应用数据清除管理器 */ public class DataCleanUtil { /** * 清除本应用内部缓存(/data/data/com.xxx.xxx/cache) * * @param context */ public static void cleanInternalCache(Context context) { deleteFilesByDirectory(context.getCacheDir().getAbsoluteFile()); } /** * 清除本应用所有数据库(/data/data/com.xxx.xxx/databases) * * @param context */ public static void cleanDatabases(Context context) { deleteFilesByDirectory(new File("/data/data/" + context.getPackageName() + "/databases")); } /** * 清除本应用SharedPreference(/data/data/com.xxx.xxx/shared_prefs) * * @param context */ public static void cleanSharedPreference(Context context) { deleteFilesByDirectory(new File("/data/data/" + context.getPackageName() + "/shared_prefs")); } /** * 按名字清除本应用数据库 * * @param context * @param dbName */ public static void cleanDatabaseByName(Context context, String dbName) { context.deleteDatabase(dbName); } /** * 清除/data/data/com.xxx.xxx/files下的内容 * * @param context */ public static void cleanFiles(Context context) { deleteFilesByDirectory(context.getFilesDir()); } /** * 清除/data/data/com.xxx.xxx/files下的某文件 * * @param content * @param filePath */ public static void cleanFilesFile(Context context, String filePath) { File file = new File(context.getFilesDir() + "/" + filePath); file.delete(); } /** * 清除外部cache下的内容(/mnt/sdcard/android/data/com.xxx.xxx/cache) * * @param context */ public static void cleanExternalCache(Context context) { if (Environment.getExternalStorageState().equals( Environment.MEDIA_MOUNTED)) { deleteFilesByDirectory(context.getExternalCacheDir()); } } /** * 清除自定义路径下的文件,使用需小心,请不要误删。而且只支持目录下的文件删除 * * @param filePath */ public static void cleanCustomCache(String filePath) { deleteFilesByDirectory(new File(filePath)); } /** * 清除本应用所有的数据 * * @param context * @param filepath */ public static void cleanApplicationData(Context context, String... filepath) { cleanInternalCache(context); cleanExternalCache(context); cleanDatabases(context); cleanSharedPreference(context); cleanFiles(context); for (String filePath : filepath) { cleanCustomCache(filePath); } } /** * 删除方法 这里只会删除某个文件夹下的文件,如果传入的directory是个文件,将不做处理 * * @param directory */ private static long deleteFilesByDirectory(File directory) { long size = 0; if (directory != null && directory.exists() && directory.isDirectory()) { for (File item : directory.listFiles()) { if (item.isDirectory()) { deleteFilesByDirectory(item); } else { item.delete(); } } } return size; } }
{ "pile_set_name": "Github" }
/* * Copyright 2020 the original author or 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.data.mongodb.core; import lombok.AllArgsConstructor; import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Field; import org.springframework.data.mongodb.core.mapping.Sharded; /** * @author Christoph Strobl */ @Data @AllArgsConstructor @Sharded public class ShardedEntityWithDefaultShardKey { private @Id String id; private String country; @Field("userid") // private Integer userId; }
{ "pile_set_name": "Github" }
/* * @BEGIN LICENSE * * Psi4: an open-source quantum chemistry software package * * Copyright (c) 2007-2019 The Psi4 Developers. * * The copyrights for code used from other parties are included in * the corresponding files. * * This file is part of Psi4. * * Psi4 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, version 3. * * Psi4 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 Psi4; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * @END LICENSE */ /*! \file \brief Pople's method for solving linear equations \ingroup QT */ #include <cstdio> #include <cstdlib> #include <cmath> #include "psi4/libciomr/libciomr.h" #include "qt.h" #include "psi4/libpsi4util/PsiOutStream.h" namespace psi { /*! ** POPLE(): Uses Pople's method to iteratively solve linear equations ** Ax = b ** ** Matt Leininger, April 1998 ** ** \param A = matrix ** \param x = initially has vector b, but returns vector x. ** \param dimen = dimension of vector x. ** \param num_vecs = number of vectors x to obtain. ** \param tolerance = cutoff threshold for norm of expansion vector. ** ** Returns: 0 for success, 1 for failure ** \ingroup QT */ int pople(double **A, double *x, int dimen, int /*num_vecs*/, double tolerance, std::string out, int print_lvl) { std::shared_ptr<psi::PsiOutStream> printer = (out == "outfile" ? outfile : std::make_shared<PsiOutStream>(out)); double det, tval; double **Bmat; /* Matrix of expansion vectors */ double **Ab; /* Matrix of A x expansion vectors */ double **M; /* Pople subspace matrix */ double *n; /* overlap of b or transformed b in Ax = b with expansion vector zero */ double *r; /* residual vector */ double *b; /* b vector in Ax = b, or transformed b vector */ double *sign; /* sign array to insure diagonal element of A are positive */ double **Mtmp; /* tmp M matrix passed to flin */ int i, j, L = 0, I; double norm, rnorm = 1.0, *dotprod, *alpha; double *dvec; int llast = 0, last = 0, maxdimen; int quit = 0; maxdimen = 200; /* initialize working array */ Bmat = block_matrix(maxdimen, dimen); alpha = init_array(maxdimen); M = block_matrix(maxdimen, maxdimen); Mtmp = block_matrix(maxdimen, maxdimen); dvec = init_array(dimen); Ab = block_matrix(maxdimen, dimen); r = init_array(dimen); b = init_array(dimen); n = init_array(dimen); dotprod = init_array(maxdimen); sign = init_array(dimen); if (print_lvl > 6) { printer->Printf("\n\n Using Pople's Method for solving linear equations.\n"); printer->Printf(" --------------------------------------------------\n"); printer->Printf(" Iter Norm of Residual Vector \n"); printer->Printf(" ------ ------------------------- \n"); } norm = 0.0; for (i = 0; i < dimen; i++) norm += x[i] * x[i]; if (norm < PSI_ZERO) quit = 1; if (!quit) { for (i = 0; i < dimen; i++) { if (A[i][i] > PSI_ZERO) sign[i] = 1.0; else sign[i] = -1.0; x[i] *= sign[i]; } for (i = 0; i < dimen; i++) { Bmat[0][i] = x[i]; b[i] = x[i]; dvec[i] = sqrt(std::fabs(A[i][i])); b[i] /= dvec[i]; /* outfile->Printf("A[%d][%d] = %lf\n",i,i, A[i][i]); outfile->Printf("dvec[%d] = %lf\n",i, dvec[i]); outfile->Printf("x[%d] = %lf\n",i, x[i]); */ } if (print_lvl > 8) { printer->Printf(" A matrix in POPLE(LIBQT):\n"); print_mat(A, dimen, dimen, out); } /* Constructing P matrix */ for (i = 0; i < dimen; i++) { for (j = 0; j < dimen; j++) { if (i == j) A[i][i] = 0.0; else A[i][j] = -A[i][j] * sign[i]; } } if (print_lvl > 8) { printer->Printf(" P matrix in POPLE(LIBQT):\n"); print_mat(A, dimen, dimen, out); } /* Precondition P matrix with diagonal elements of A */ for (i = 0; i < dimen; i++) for (j = 0; j < dimen; j++) { tval = 1.0 / (dvec[j] * dvec[i]); A[i][j] *= tval; } if (print_lvl > 8) { printer->Printf(" Preconditioned P matrix in POPLE(LIBQT):\n"); print_mat(A, dimen, dimen, out); } /* for (i=0; i<dimen; i++) { for (j=0; j<dimen; j++) { if (i==j) A[i][i] = 1.0 - A[i][i]; else A[i][j] = -A[i][j]; } } */ for (i = 0; i < dimen; i++) Bmat[0][i] /= dvec[i]; // dot_arr(Bmat[0],Bmat[0],dimen,&norm); norm = C_DDOT(dimen, Bmat[0], 1, Bmat[0], 1); norm = sqrt(norm); for (i = 0; i < dimen; i++) { x[i] = Bmat[0][i]; Bmat[0][i] /= norm; } // dot_arr(Bmat[0],x,dimen,&(n[0])); n[0] = C_DDOT(dimen, Bmat[0], 1, x, 1); while (!last) { /* form A*b_i */ for (i = 0; i < dimen; i++) // dot_arr(A[i], Bmat[L], dimen, &(Ab[L][i])); Ab[L][i] = C_DDOT(dimen, A[i], 1, Bmat[L], 1); /* Construct M matrix */ /* M = delta_ij - <b_new|Ab_j> */ zero_mat(M, maxdimen, maxdimen); for (i = 0; i <= L; i++) { for (j = 0; j <= L; j++) { // dot_arr(Bmat[i], Ab[j], dimen, &(dotprod[i])); dotprod[i] = C_DDOT(dimen, Bmat[i], 1, Ab[j], 1); if (i == j) M[i][j] = 1.0 - dotprod[i]; else M[i][j] = -dotprod[i]; } } if (llast) last = llast; for (i = 0; i <= L; i++) { alpha[i] = n[i]; for (j = 0; j <= L; j++) Mtmp[i][j] = M[i][j]; } flin(Mtmp, alpha, L + 1, 1, &det); /* Need to form and backtransform x to orig basis x = D^(-1/2) x */ zero_arr(x, dimen); for (i = 0; i <= L; i++) for (I = 0; I < dimen; I++) x[I] += alpha[i] * Bmat[i][I] / dvec[I]; /* Form residual vector Ax - b = r */ zero_arr(r, dimen); for (I = 0; I < dimen; I++) for (i = 0; i <= L; i++) r[I] += alpha[i] * (Bmat[i][I] - Ab[i][I]); for (I = 0; I < dimen; I++) r[I] -= b[I]; // dot_arr(r, r, dimen, &rnorm); rnorm = C_DDOT(dimen, r, 1, r, 1); rnorm = sqrt(rnorm); if (print_lvl > 6) { printer->Printf(" %3d %10.3E\n", L + 1, rnorm); } if (L + 1 > dimen) { printer->Printf("POPLE: Too many vectors in expansion space.\n"); return 1; } /* place residual in b vector space */ if (L + 1 >= maxdimen) { printer->Printf( "POPLE (LIBQT): Number of expansion vectors exceeds" " maxdimen (%d)\n", L + 1); return 1; } for (i = 0; i < dimen; i++) Bmat[L + 1][i] = Ab[L][i]; /* for (i=0; i<dimen; i++) Bmat[L+1][i] = r[i]; for (i=0; i<dimen; i++) Bmat[L+1][i] = r[i]/(dvec[i]*dvec[i]); */ /* Schmidt orthonormalize new b vec to expansion space */ for (j = 0; j <= L; j++) { // dot_arr(Bmat[j], Bmat[L+1], dimen, &(dotprod[j])); dotprod[j] = C_DDOT(dimen, Bmat[j], 1, Bmat[L + 1], 1); for (I = 0; I < dimen; I++) Bmat[L + 1][I] -= dotprod[j] * Bmat[j][I]; } /* Normalize new expansion vector */ // dot_arr(Bmat[L+1], Bmat[L+1], dimen, &norm); norm = C_DDOT(dimen, Bmat[L + 1], 1, Bmat[L + 1], 1); norm = sqrt(norm); for (I = 0; I < dimen; I++) Bmat[L + 1][I] /= norm; /* check orthogonality of subspace */ if (false) { for (i = 0; i <= L + 1; i++) { for (j = 0; j <= i; j++) { // dot_arr(Bmat[i], Bmat[j], dimen, &tval); tval = C_DDOT(dimen, Bmat[i], 1, Bmat[j], 1); printer->Printf("Bvec[%d] * Bvec[%d] = %f\n", i, j, tval); } } } if (rnorm < tolerance) llast = last = 1; L++; } zero_arr(x, dimen); for (i = 0; i <= L; i++) for (I = 0; I < dimen; I++) x[I] += alpha[i] * Bmat[i][I]; /* Need to backtransform x to orginal basis x = D^(-1/2) x */ for (I = 0; I < dimen; I++) x[I] /= dvec[I]; } free_block(Bmat); free(alpha); free_block(M); free_block(Mtmp); free(n); free(dvec); free_block(Ab); free(r); free(b); free(dotprod); return 0; } }
{ "pile_set_name": "Github" }
%%% ==================================================================== %%% @LaTeX-style-file{ %%% author = "Mario Wolczko", %%% version = "2", %%% date = "21 May 1992", %%% time = "20:55:01 BST", %%% filename = "boxedminipage.sty", %%% email = "[email protected]", %%% codetable = "ISO/ASCII", %%% keywords = "LaTeX, minipage, framebox", %%% supported = "no", %%% docstring = "LaTeX document-style option which defines %%% the boxedminipage environment -- just like minipage, but with %%% a box around it.", %%% } %%% ==================================================================== % % This file is in the public domain % % The thickness of the rules around the box is controlled by % \fboxrule, and the distance between the rules and the edges of the % inner box is governed by \fboxsep. % % This code is based on Lamport's minipage code. % % Fixed, 7 Jun 89 by Jerry Leichter % Leave \fboxsep worth of separation at top and bottom, not just at % the sides! % \def\boxedminipage{\@ifnextchar [{\@iboxedminipage}{\@iboxedminipage[c]}} \def\@iboxedminipage[#1]#2{\leavevmode \@pboxswfalse \if #1b\vbox \else \if #1t\vtop \else \ifmmode \vcenter \else \@pboxswtrue $\vcenter \fi \fi \fi\bgroup % start of outermost vbox/vtop/vcenter \hsize #2 \hrule\@height\fboxrule \hbox\bgroup % inner hbox \vrule\@width\fboxrule \hskip\fboxsep \vbox\bgroup % innermost vbox \vskip\fboxsep \advance\hsize -2\fboxrule \advance\hsize-2\fboxsep \textwidth\hsize \columnwidth\hsize \@parboxrestore \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@ \let\@footnotetext\@mpfootnotetext \let\@listdepth\@mplistdepth \@mplistdepth\z@ \@minipagerestore\@minipagetrue \everypar{\global\@minipagefalse\everypar{}}} \def\endboxedminipage{% \par\vskip-\lastskip \ifvoid\@mpfootins\else \vskip\skip\@mpfootins\footnoterule\unvbox\@mpfootins\fi \vskip\fboxsep \egroup % ends the innermost \vbox \hskip\fboxsep \vrule\@width\fboxrule \egroup % ends the \hbox \hrule\@height\fboxrule \egroup% ends the vbox/vtop/vcenter \if@pboxsw $\fi}
{ "pile_set_name": "Github" }
package app.opass.ccip.model import com.google.gson.annotations.SerializedName data class Event( @SerializedName("display_name") val displayName: LocalizedString, @SerializedName("event_id") val eventId: String, @SerializedName("logo_url") val logoUrl: String )
{ "pile_set_name": "Github" }
--- title: Menubar (Vertical Navigation with Decorator) section: Components --- <div class="clay-site-row-spacer row"> <div class="col-md-12"> <h3>Menubar Decorated Menubar Vertical Expand Md</h3> <blockquote class="blockquote"> A pattern for collapsing vertical navigations, collapses at 767px. For vertical navigations that don't collapse use <a href="../nav/#nav-stacked">Nav Stacked</a> or <a href="../nav/#nav-nested">Nav Nested</a>. </blockquote> </div> <div class="col-md-6"> <nav class="menubar menubar-decorated menubar-transparent menubar-vertical-expand-md"> <a aria-controls="menubarVerticalMdCollapse01" aria-expanded="false" class="menubar-toggler" data-toggle="collapse" href="#menubarVerticalMdCollapse01" role="button"> Details <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </a> <div class="collapse menubar-collapse" id="menubarVerticalMdCollapse01"> <ul class="nav nav-nested"> <li class="nav-item"> <a aria-controls="menubarVerticalMdNestedCollapse01" aria-expanded="true" class="collapse-icon nav-link" data-toggle="collapse" href="#menubarVerticalMdNestedCollapse01" role="button"> Basic Information <span class="collapse-icon-closed"> <svg class="lexicon-icon lexicon-icon-caret-right" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-right" /> </svg> </span> <span class="collapse-icon-open"> <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </span> </a> <div class="collapse show" id="menubarVerticalMdNestedCollapse01"> <ul class="nav nav-stacked"> <li class="nav-item"><a class="active nav-link" href="#1">Details</a></li> <li class="nav-item"><a class="nav-link" href="#1">Categorization</a></li> <li class="nav-item"> <a aria-controls="menubarVerticalMdNestedCollapse02" aria-expanded="false" class="collapsed collapse-icon nav-link" data-toggle="collapse" href="#menubarVerticalMdNestedCollapse02" role="button"> Documents and Media <span class="collapse-icon-closed"> <svg class="lexicon-icon lexicon-icon-caret-right" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-right" /> </svg> </span> <span class="collapse-icon-open"> <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </span> </a> <div class="collapse" id="menubarVerticalMdNestedCollapse02"> <ul class="nav nav-stacked"> <li class="nav-item"><a class="nav-link" href="#1">Details</a></li> <li class="nav-item"><a class="nav-link" href="#1">Categorization</a></li> <li class="nav-item"><a class="nav-link" href="#1">Documents and Media</a></li> <li class="nav-item"><a class="nav-link" href="#1">Site Template</a></li> </ul> </div> </li> <li class="nav-item"><a class="nav-link" href="#1">Site Template</a></li> </ul> </div> </li> <li class="nav-item"> <a aria-controls="menubarVerticalMdNestedCollapse03" aria-expanded="false" class="collapsed collapse-icon nav-link" data-toggle="collapse" href="#menubarVerticalMdNestedCollapse03" role="button"> SEO <span class="collapse-icon-closed"> <svg class="lexicon-icon lexicon-icon-caret-right" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-right" /> </svg> </span> <span class="collapse-icon-open"> <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </span> </a> <div class="collapse" id="menubarVerticalMdNestedCollapse03"> <ul class="nav nav-stacked"> <li class="nav-item"><a class="nav-link" href="#1">Sitemap</a></li> <li class="nav-item"><a class="nav-link" href="#1">Robots</a></li> </ul> </div> </li> <li class="nav-item"> <a aria-controls="menubarVerticalMdNestedCollapse04" aria-expanded="false" class="collapsed collapse-icon nav-link" data-toggle="collapse" href="#menubarVerticalMdNestedCollapse04" role="button"> Advanced <span class="collapse-icon-closed"> <svg class="lexicon-icon lexicon-icon-caret-right" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-right" /> </svg> </span> <span class="collapse-icon-open"> <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </span> </a> <div class="collapse" id="menubarVerticalMdNestedCollapse04"> <ul class="nav nav-stacked"> <li class="nav-item"><a class="nav-link" href="#1">Default User Associations</a></li> <li class="nav-item"><a class="nav-link" href="#1">Staging</a></li> <li class="nav-item"><a class="nav-link" href="#1">Analytics</a></li> <li class="nav-item"><a class="nav-link" href="#1">Maps</a></li> </ul> </div> </li> </ul> </div> </nav> </div> </div> <div class="clay-site-row-spacer row"> <div class="col-md-12"> <h3>Menubar Decorated Menubar Vertical Expand Md with Buttons</h3> </div> <div class="col-md-6"> <nav class="menubar menubar-decorated menubar-transparent menubar-vertical-expand-md"> <button aria-controls="menubarVerticalMdCollapseButton01" aria-expanded="false" class="menubar-toggler" data-toggle="collapse" data-target="#menubarVerticalMdCollapseButton01" role="button"> Details <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </button> <div class="collapse menubar-collapse" id="menubarVerticalMdCollapseButton01"> <ul class="nav nav-nested"> <li class="nav-item"> <button aria-controls="menubarVerticalMdNestedCollapseButton01" aria-expanded="true" class="btn btn-unstyled collapse-icon nav-link" data-toggle="collapse" data-target="#menubarVerticalMdNestedCollapseButton01" type="button"> Basic Information <span class="collapse-icon-closed"> <svg class="lexicon-icon lexicon-icon-caret-right" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-right" /> </svg> </span> <span class="collapse-icon-open"> <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </span> </button> <div class="collapse show" id="menubarVerticalMdNestedCollapseButton01"> <ul class="nav nav-stacked"> <li class="nav-item"><a class="active nav-link" href="#1">Details</a></li> <li class="nav-item"><a class="nav-link" href="#1">Categorization</a></li> <li class="nav-item"> <button aria-controls="menubarVerticalMdNestedCollapseButton02" aria-expanded="false" class="btn btn-unstyled collapsed collapse-icon nav-link" data-toggle="collapse" data-target="#menubarVerticalMdNestedCollapseButton02" type="button"> Documents and Media <span class="collapse-icon-closed"> <svg class="lexicon-icon lexicon-icon-caret-right" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-right" /> </svg> </span> <span class="collapse-icon-open"> <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </span> </button> <div class="collapse" id="menubarVerticalMdNestedCollapseButton02"> <ul class="nav nav-stacked"> <li class="nav-item"><a class="nav-link" href="#1">Details</a></li> <li class="nav-item"><a class="nav-link" href="#1">Categorization</a></li> <li class="nav-item"><a class="nav-link" href="#1">Documents and Media</a></li> <li class="nav-item"><a class="nav-link" href="#1">Site Template</a></li> </ul> </div> </li> <li class="nav-item"><a class="nav-link" href="#1">Site Template</a></li> </ul> </div> </li> <li class="nav-item"> <button aria-controls="menubarVerticalMdNestedCollapseButton03" aria-expanded="false" class="btn btn-unstyled collapsed collapse-icon nav-link" data-toggle="collapse" data-target="#menubarVerticalMdNestedCollapseButton03" type="button"> SEO <span class="collapse-icon-closed"> <svg class="lexicon-icon lexicon-icon-caret-right" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-right" /> </svg> </span> <span class="collapse-icon-open"> <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </span> </button> <div class="collapse" id="menubarVerticalMdNestedCollapseButton03"> <ul class="nav nav-stacked"> <li class="nav-item"><a class="nav-link" href="#1">Sitemap</a></li> <li class="nav-item"><a class="nav-link" href="#1">Robots</a></li> </ul> </div> </li> <li class="nav-item"> <button aria-controls="menubarVerticalMdNestedCollapseButton04" aria-expanded="false" class="btn btn-unstyled collapsed collapse-icon nav-link" data-toggle="collapse" data-target="#menubarVerticalMdNestedCollapseButton04" type="button"> Advanced <span class="collapse-icon-closed"> <svg class="lexicon-icon lexicon-icon-caret-right" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-right" /> </svg> </span> <span class="collapse-icon-open"> <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </span> </button> <div class="collapse" id="menubarVerticalMdNestedCollapseButton04"> <ul class="nav nav-stacked"> <li class="nav-item"><a class="nav-link" href="#1">Default User Associations</a></li> <li class="nav-item"><a class="nav-link" href="#1">Staging</a></li> <li class="nav-item"><a class="nav-link" href="#1">Analytics</a></li> <li class="nav-item"><a class="nav-link" href="#1">Maps</a></li> </ul> </div> </li> </ul> </div> </nav> </div> </div> <div class="clay-site-row-spacer row"> <div class="col-md-12"> <h3>Menubar Decorated Menubar Vertical Expand Lg</h3> <blockquote class="blockquote"> Collapses at 991px </blockquote> </div> <div class="col-lg-6"> <nav class="menubar menubar-decorated menubar-transparent menubar-vertical-expand-lg"> <a aria-controls="menubarVerticalLgCollapse01" aria-expanded="false" class="menubar-toggler" data-toggle="collapse" href="#menubarVerticalLgCollapse01" role="button"> Details <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </a> <div class="collapse menubar-collapse" id="menubarVerticalLgCollapse01"> <ul class="nav nav-nested"> <li class="nav-item"> <a aria-controls="menubarVerticalLgNestedCollapse01" aria-expanded="true" class="collapse-icon nav-link" data-toggle="collapse" href="#menubarVerticalLgNestedCollapse01" role="button"> Basic Information <span class="collapse-icon-closed"> <svg class="lexicon-icon lexicon-icon-caret-right" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-right" /> </svg> </span> <span class="collapse-icon-open"> <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </span> </a> <div class="collapse show" id="menubarVerticalLgNestedCollapse01"> <ul class="nav nav-stacked"> <li class="nav-item"><a class="active nav-link" href="#1">Details</a></li> <li class="nav-item"><a class="nav-link" href="#1">Categorization</a></li> <li class="nav-item"> <a aria-controls="menubarVerticalLgNestedCollapse02" aria-expanded="false" class="collapsed collapse-icon nav-link" data-toggle="collapse" href="#menubarVerticalLgNestedCollapse02" role="button"> Documents and Media <span class="collapse-icon-closed"> <svg class="lexicon-icon lexicon-icon-caret-right" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-right" /> </svg> </span> <span class="collapse-icon-open"> <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </span> </a> <div class="collapse" id="menubarVerticalLgNestedCollapse02"> <ul class="nav nav-stacked"> <li class="nav-item"><a class="nav-link" href="#1">Details</a></li> <li class="nav-item"><a class="nav-link" href="#1">Categorization</a></li> <li class="nav-item"><a class="nav-link" href="#1">Documents and Media</a></li> <li class="nav-item"><a class="nav-link" href="#1">Site Template</a></li> </ul> </div> </li> <li class="nav-item"><a class="nav-link" href="#1">Site Template</a></li> </ul> </div> </li> <li class="nav-item"> <a aria-controls="menubarVerticalLgNestedCollapse03" aria-expanded="false" class="collapsed collapse-icon nav-link" data-toggle="collapse" href="#menubarVerticalLgNestedCollapse03" role="button"> SEO <span class="collapse-icon-closed"> <svg class="lexicon-icon lexicon-icon-caret-right" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-right" /> </svg> </span> <span class="collapse-icon-open"> <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </span> </a> <div class="collapse" id="menubarVerticalLgNestedCollapse03"> <ul class="nav nav-stacked"> <li class="nav-item"><a class="nav-link" href="#1">Sitemap</a></li> <li class="nav-item"><a class="nav-link" href="#1">Robots</a></li> </ul> </div> </li> <li class="nav-item"> <a aria-controls="menubarVerticalLgNestedCollapse04" aria-expanded="false" class="collapsed collapse-icon nav-link" data-toggle="collapse" href="#menubarVerticalLgNestedCollapse04" role="button"> Advanced <span class="collapse-icon-closed"> <svg class="lexicon-icon lexicon-icon-caret-right" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-right" /> </svg> </span> <span class="collapse-icon-open"> <svg class="lexicon-icon lexicon-icon-caret-bottom" focusable="false" role="presentation"> <use xlink:href="{{rootPath}}/images/icons/icons.svg#caret-bottom" /> </svg> </span> </a> <div class="collapse" id="menubarVerticalLgNestedCollapse04"> <ul class="nav nav-stacked"> <li class="nav-item"><a class="nav-link" href="#1">Default User Associations</a></li> <li class="nav-item"><a class="nav-link" href="#1">Staging</a></li> <li class="nav-item"><a class="nav-link" href="#1">Analytics</a></li> <li class="nav-item"><a class="nav-link" href="#1">Maps</a></li> </ul> </div> </li> </ul> </div> </nav> </div> </div>
{ "pile_set_name": "Github" }
goog.module('grrUi.cron.cron'); goog.module.declareLegacyNamespace(); const {CronJobInspectorDirective} = goog.require('grrUi.cron.cronJobInspectorDirective'); const {CronJobOverviewDirective} = goog.require('grrUi.cron.cronJobOverviewDirective'); const {CronJobRunsListDirective} = goog.require('grrUi.cron.cronJobRunsListDirective'); const {CronJobStatusIconDirective} = goog.require('grrUi.cron.cronJobStatusIconDirective'); const {CronJobsListDirective} = goog.require('grrUi.cron.cronJobsListDirective'); const {CronViewDirective} = goog.require('grrUi.cron.cronViewDirective'); const {coreModule} = goog.require('grrUi.core.core'); const {newCronJobWizardModule} = goog.require('grrUi.cron.newCronJobWizard.newCronJobWizard'); /** * Angular module for cron-related UI. */ exports.cronModule = angular.module( 'grrUi.cron', [coreModule.name, newCronJobWizardModule.name]); exports.cronModule.directive( CronJobInspectorDirective.directive_name, CronJobInspectorDirective); exports.cronModule.directive( CronJobsListDirective.directive_name, CronJobsListDirective); exports.cronModule.directive( CronJobOverviewDirective.directive_name, CronJobOverviewDirective); exports.cronModule.directive( CronJobRunsListDirective.directive_name, CronJobRunsListDirective); exports.cronModule.directive( CronJobStatusIconDirective.directive_name, CronJobStatusIconDirective); exports.cronModule.directive( CronViewDirective.directive_name, CronViewDirective);
{ "pile_set_name": "Github" }
Feature: Test Scenarios with Data Tables Scenario: Simple data table Given users are: | name | login | email | | Viktor | clicman | [email protected] | | Viktor2 | clicman2 | [email protected] |
{ "pile_set_name": "Github" }
//----------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="Akka.NET Project"> // Copyright (C) 2009-2020 Lightbend Inc. <http://www.lightbend.com> // Copyright (C) 2013-2020 .NET Foundation <https://github.com/akkadotnet/akka.net> // </copyright> //----------------------------------------------------------------------- using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("6e54ffe4-7a6a-4891-b457-c4dc4779b51a")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")]
{ "pile_set_name": "Github" }
<!-- ~ Copyright (c) 2018 Wolfram Research, Inc. All rights reserved. ~ Redistribution or use of this work in any form, with or without modification, ~ requires written permission from the copyright holder. --> <h3><a href="http://reference.wolfram.com/mathematica/ref/LeftRightArrow.html">LeftRightArrow</a></h3> <ul> <li>LeftRightArrow[<em>x</em>,<em>y</em>, <math> <ms>&#8230;</ms> </math> ] displays as <em>x</em> <math> <ms>&#8596;</ms> </math> <em>y</em> <math> <ms>&#8596;</ms> </math> <math> <ms>&#8230;</ms> </math> . </ul><p><b>Attributes:</b></p><p><b>Symbol has no options.</b></p>
{ "pile_set_name": "Github" }
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="color", parent_name="histogram2d.hoverlabel.font", **kwargs ): super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, array_ok=kwargs.pop("array_ok", True), edit_type=kwargs.pop("edit_type", "none"), role=kwargs.pop("role", "style"), **kwargs )
{ "pile_set_name": "Github" }
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?attr/colorControlNormal"> <path android:fillColor="@android:color/white" android:pathData="M21.02,5H19V2.98c0,-0.54 -0.44,-0.98 -0.98,-0.98h-0.03c-0.55,0 -0.99,0.44 -0.99,0.98V5h-2.01c-0.54,0 -0.98,0.44 -0.99,0.98v0.03c0,0.55 0.44,0.99 0.99,0.99H17v2.01c0,0.54 0.44,0.99 0.99,0.98h0.03c0.54,0 0.98,-0.44 0.98,-0.98V7h2.02c0.54,0 0.98,-0.44 0.98,-0.98v-0.04c0,-0.54 -0.44,-0.98 -0.98,-0.98zM16,9.01V8h-1.01c-0.53,0 -1.03,-0.21 -1.41,-0.58 -0.37,-0.38 -0.58,-0.88 -0.58,-1.44 0,-0.36 0.1,-0.69 0.27,-0.98H5c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-8.28c-0.3,0.17 -0.64,0.28 -1.02,0.28 -1.09,-0.01 -1.98,-0.9 -1.98,-1.99zM15.96,19H6c-0.41,0 -0.65,-0.47 -0.4,-0.8l1.98,-2.63c0.21,-0.28 0.62,-0.26 0.82,0.02L10,18l2.61,-3.48c0.2,-0.26 0.59,-0.27 0.79,-0.01l2.95,3.68c0.26,0.33 0.03,0.81 -0.39,0.81z"/> </vector>
{ "pile_set_name": "Github" }
key.store=debug.keystore key.alias=androiddebugkey key.store.password=android key.alias.password=android
{ "pile_set_name": "Github" }
import sqlite3, os from poshc2.server.Config import Database, PoshProjectDirectory from poshc2.server.database.Model import C2, Implant, NewTask def connect(): conn = sqlite3.connect(Database, check_same_thread=False) conn.text_factory = str conn.row_factory = sqlite3.Row return conn def initialise(create_database): create_implants = """CREATE TABLE IF NOT EXISTS Implants ( ImplantID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, RandomURI VARCHAR(20), URLID INTEGER, User TEXT, Hostname TEXT, IpAddress TEXT, Key TEXT, FirstSeen TEXT, LastSeen TEXT, PID TEXT, Arch TEXT, Domain TEXT, Alive TEXT, Sleep TEXT, ModsLoaded TEXT, Pivot TEXT, Label TEXT, FOREIGN KEY(URLID) REFERENCES URLs(URLID));""" create_autoruns = """CREATE TABLE AutoRuns ( TaskID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, Task TEXT);""" create_tasks = """CREATE TABLE Tasks ( TaskID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, RandomURI TEXT, Command TEXT, Output TEXT, User TEXT, SentTime TEXT, CompletedTime TEXT, ImplantID INTEGER, FOREIGN KEY(ImplantID) REFERENCES Implants(ImplantID))""" create_newtasks = """CREATE TABLE NewTasks ( TaskID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, RandomURI TEXT, Command TEXT, User TEXT);""" create_urls = """CREATE TABLE URLs ( URLID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, Name TEXT UNIQUE, URL TEXT, HostHeader TEXT, ProxyURL TEXT, ProxyUsername TEXT, ProxyPassword TEXT, CredentialExpiry TEXT);""" create_creds = """CREATE TABLE Creds ( CredID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, Domain TEXT, Username TEXT, Password TEXT, Hash TEXT);""" create_opsec_entry = """CREATE TABLE OpSec_Entry ( OpsecID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, Date TEXT, Owner TEXT, Event TEXT, Note TEXT);""" create_c2server = """CREATE TABLE C2Server ( ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, PayloadCommsHost TEXT, EncKey TEXT, DomainFrontHeader TEXT, DefaultSleep TEXT, KillDate TEXT, GET_404_Response TEXT, PoshProjectDirectory TEXT, QuickCommand TEXT, DownloadURI TEXT, ProxyURL TEXT, ProxyUser TEXT, ProxyPass TEXT, URLS TEXT, SocksURLS TEXT, Insecure TEXT, UserAgent TEXT, Referrer TEXT, Pushover_APIToken TEXT, Pushover_APIUser TEXT, EnableNotifications TEXT);""" create_c2_messages = """CREATE TABLE C2_Messages ( ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, Message TEXT, Read TEXT);""" create_power_status = """CREATE TABLE IF NOT EXISTS PowerStatus ( PowerStatusId INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, RandomURI TEXT, APMStatus TEXT, OnACPower INTEGER, Charging INTEGER, BatteryStatus TEXT, BatteryPercentLeft TEXT, ScreenLocked INTEGER, MonitorOn INTEGER, LastUpdate TEXT);""" create_hosted_files = """CREATE TABLE Hosted_Files ( ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, URI TEXT, FilePath TEXT, ContentType TEXT, Base64 TEXT, Active TEXT);""" create_database(create_urls, create_implants, create_autoruns, create_tasks, create_newtasks, create_creds, create_opsec_entry, create_c2server, create_c2_messages, create_hosted_files, create_power_status) def db_exists(conn): if not os.path.isfile(Database): return False c = conn.cursor() c.execute(f"SELECT name FROM sqlite_master WHERE type='table' AND name='PowerStatus';") result = c.fetchone() if result: return True else: return False
{ "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>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>$(PRODUCT_NAME)</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> <string>1.0</string> <key>CFBundleVersion</key> <string>1</string> </dict> </plist>
{ "pile_set_name": "Github" }
# Copyright 2017-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanying this file. This file 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. from __future__ import absolute_import
{ "pile_set_name": "Github" }
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-policy-details', templateUrl: './policy-details.component.html', styleUrls: ['./policy-details.component.css'] }) export class PolicyDetailsComponent implements OnInit { constructor() { } ngOnInit() { } }
{ "pile_set_name": "Github" }
/* Unix SMB/CIFS implementation. simple registry frontend Copyright (C) Jelmer Vernooij 2004-2007 Copyright (C) Wilco Baan Hofman 2009 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "includes.h" #include "lib/registry/registry.h" #include "lib/cmdline/popt_common.h" #include "lib/events/events.h" #include "system/time.h" #include "../libcli/smbreadline/smbreadline.h" #include "librpc/gen_ndr/ndr_security.h" #include "lib/registry/tools/common.h" #include "param/param.h" struct regshell_context { struct registry_context *registry; char *path; char *predef; struct registry_key *current; struct registry_key *root; }; static WERROR get_full_path(struct regshell_context *ctx, const char *path, char **ret_path) { const char *dir; char *tmp; char *new_path; if (path[0] == '\\') { new_path = talloc_strdup(ctx, ""); } else { new_path = talloc_strdup(ctx, ctx->path); } dir = strtok(discard_const_p(char, path), "\\"); if (dir == NULL) { *ret_path = new_path; return WERR_OK; } do { if (strcmp(dir, "..") == 0) { if (strchr(new_path, '\\')) { new_path[strrchr(new_path, '\\') - new_path] = '\0'; } else { tmp = new_path; new_path = talloc_strdup(ctx, ""); talloc_free(tmp); } continue; } if (strcmp(dir, ".") == 0) { continue; } tmp = new_path; /* No prepending a backslash */ if (strcmp(new_path, "") == 0) { new_path = talloc_strdup(ctx, dir); } else { new_path = talloc_asprintf(ctx, "%s\\%s", new_path, dir); } talloc_free(tmp); } while ((dir = strtok(NULL, "\\"))); *ret_path = new_path; return WERR_OK; } /* * * ck/cd - change key * ls - list values/keys * rmval/rm - remove value * rmkey/rmdir - remove key * mkkey/mkdir - make key * ch - change hive * info - show key info * save - save hive * print - print value * help * exit */ static WERROR cmd_info(struct regshell_context *ctx, int argc, const char **argv) { struct security_descriptor *sec_desc = NULL; time_t last_mod; WERROR error; const char *classname = NULL; NTTIME last_change; uint32_t max_subkeynamelen; uint32_t max_valnamelen; uint32_t max_valbufsize; uint32_t num_subkeys; uint32_t num_values; error = reg_key_get_info(ctx, ctx->current, &classname, &num_subkeys, &num_values, &last_change, &max_subkeynamelen, &max_valnamelen, &max_valbufsize); if (!W_ERROR_IS_OK(error)) { printf("Error getting key info: %s\n", win_errstr(error)); return error; } printf("Name: %s\n", strchr(ctx->path, '\\')?strrchr(ctx->path, '\\')+1: ctx->path); printf("Full path: %s\n", ctx->path); if (classname != NULL) printf("Key Class: %s\n", classname); last_mod = nt_time_to_unix(last_change); printf("Time Last Modified: %s", ctime(&last_mod)); printf("Number of subkeys: %d\n", num_subkeys); printf("Number of values: %d\n", num_values); if (max_valnamelen > 0) printf("Maximum value name length: %d\n", max_valnamelen); if (max_valbufsize > 0) printf("Maximum value data length: %d\n", max_valbufsize); if (max_subkeynamelen > 0) printf("Maximum sub key name length: %d\n", max_subkeynamelen); error = reg_get_sec_desc(ctx, ctx->current, &sec_desc); if (!W_ERROR_IS_OK(error)) { printf("Error getting security descriptor: %s\n", win_errstr(error)); return WERR_OK; } ndr_print_debug((ndr_print_fn_t)ndr_print_security_descriptor, "Security", sec_desc); talloc_free(sec_desc); return WERR_OK; } static WERROR cmd_predef(struct regshell_context *ctx, int argc, const char **argv) { struct registry_key *ret = NULL; if (argc < 2) { fprintf(stderr, "Usage: predef predefined-key-name\n"); } else if (!ctx) { fprintf(stderr, "No full registry loaded, no predefined keys defined\n"); } else { WERROR error = reg_get_predefined_key_by_name(ctx->registry, argv[1], &ret); if (!W_ERROR_IS_OK(error)) { fprintf(stderr, "Error opening predefined key %s: %s\n", argv[1], win_errstr(error)); return error; } ctx->predef = strupper_talloc(ctx, argv[1]); ctx->current = ret; ctx->root = ret; } return WERR_OK; } static WERROR cmd_pwd(struct regshell_context *ctx, int argc, const char **argv) { if (ctx->predef) { printf("%s\\", ctx->predef); } printf("%s\n", ctx->path); return WERR_OK; } static WERROR cmd_set(struct regshell_context *ctx, int argc, const char **argv) { struct registry_value val; WERROR error; if (argc < 4) { fprintf(stderr, "Usage: set value-name type value\n"); return WERR_INVALID_PARAM; } if (!reg_string_to_val(ctx, argv[2], argv[3], &val.data_type, &val.data)) { fprintf(stderr, "Unable to interpret data\n"); return WERR_INVALID_PARAM; } error = reg_val_set(ctx->current, argv[1], val.data_type, val.data); if (!W_ERROR_IS_OK(error)) { fprintf(stderr, "Error setting value: %s\n", win_errstr(error)); return error; } return WERR_OK; } static WERROR cmd_ck(struct regshell_context *ctx, int argc, const char **argv) { struct registry_key *nkey = NULL; char *full_path; WERROR error; if(argc == 2) { if (!W_ERROR_IS_OK(get_full_path(ctx, argv[1], &full_path))) { fprintf(stderr, "Unable to parse the supplied path\n"); return WERR_INVALID_PARAM; } error = reg_open_key(ctx->registry, ctx->root, full_path, &nkey); if(!W_ERROR_IS_OK(error)) { DEBUG(0, ("Error opening specified key: %s\n", win_errstr(error))); return error; } talloc_free(ctx->path); ctx->path = full_path; ctx->current = nkey; } printf("New path is: %s\\%s\n", ctx->predef?ctx->predef:"", ctx->path); return WERR_OK; } static WERROR cmd_print(struct regshell_context *ctx, int argc, const char **argv) { uint32_t value_type; DATA_BLOB value_data; WERROR error; if (argc != 2) { fprintf(stderr, "Usage: print <valuename>\n"); return WERR_INVALID_PARAM; } error = reg_key_get_value_by_name(ctx, ctx->current, argv[1], &value_type, &value_data); if (!W_ERROR_IS_OK(error)) { fprintf(stderr, "No such value '%s'\n", argv[1]); return error; } printf("%s\n%s\n", str_regtype(value_type), reg_val_data_string(ctx, value_type, value_data)); return WERR_OK; } static WERROR cmd_ls(struct regshell_context *ctx, int argc, const char **argv) { unsigned int i; WERROR error; uint32_t valuetype; DATA_BLOB valuedata; const char *name = NULL; for (i = 0; W_ERROR_IS_OK(error = reg_key_get_subkey_by_index(ctx, ctx->current, i, &name, NULL, NULL)); i++) { printf("K %s\n", name); } if (!W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) { fprintf(stderr, "Error occurred while browsing through keys: %s\n", win_errstr(error)); return error; } for (i = 0; W_ERROR_IS_OK(error = reg_key_get_value_by_index(ctx, ctx->current, i, &name, &valuetype, &valuedata)); i++) printf("V \"%s\" %s %s\n", name, str_regtype(valuetype), reg_val_data_string(ctx, valuetype, valuedata)); return WERR_OK; } static WERROR cmd_mkkey(struct regshell_context *ctx, int argc, const char **argv) { struct registry_key *tmp; WERROR error; if(argc < 2) { fprintf(stderr, "Usage: mkkey <keyname>\n"); return WERR_INVALID_PARAM; } error = reg_key_add_name(ctx, ctx->current, argv[1], 0, NULL, &tmp); if (!W_ERROR_IS_OK(error)) { fprintf(stderr, "Error adding new subkey '%s': %s\n", argv[1], win_errstr(error)); return error; } return WERR_OK; } static WERROR cmd_rmkey(struct regshell_context *ctx, int argc, const char **argv) { WERROR error; if(argc < 2) { fprintf(stderr, "Usage: rmkey <name>\n"); return WERR_INVALID_PARAM; } error = reg_key_del(ctx, ctx->current, argv[1]); if(!W_ERROR_IS_OK(error)) { fprintf(stderr, "Error deleting '%s'\n", argv[1]); return error; } else { fprintf(stderr, "Successfully deleted '%s'\n", argv[1]); } return WERR_OK; } static WERROR cmd_rmval(struct regshell_context *ctx, int argc, const char **argv) { WERROR error; if(argc < 2) { fprintf(stderr, "Usage: rmval <valuename>\n"); return WERR_INVALID_PARAM; } error = reg_del_value(ctx, ctx->current, argv[1]); if(!W_ERROR_IS_OK(error)) { fprintf(stderr, "Error deleting value '%s'\n", argv[1]); return error; } else { fprintf(stderr, "Successfully deleted value '%s'\n", argv[1]); } return WERR_OK; } _NORETURN_ static WERROR cmd_exit(struct regshell_context *ctx, int argc, const char **argv) { exit(0); } static WERROR cmd_help(struct regshell_context *ctx, int, const char **); static struct { const char *name; const char *alias; const char *help; WERROR (*handle)(struct regshell_context *ctx, int argc, const char **argv); } regshell_cmds[] = { {"ck", "cd", "Change current key", cmd_ck }, {"info", "i", "Show detailed information of a key", cmd_info }, {"list", "ls", "List values/keys in current key", cmd_ls }, {"print", "p", "Print value", cmd_print }, {"mkkey", "mkdir", "Make new key", cmd_mkkey }, {"rmval", "rm", "Remove value", cmd_rmval }, {"rmkey", "rmdir", "Remove key", cmd_rmkey }, {"pwd", "pwk", "Printing current key", cmd_pwd }, {"set", "update", "Update value", cmd_set }, {"help", "?", "Help", cmd_help }, {"exit", "quit", "Exit", cmd_exit }, {"predef", "predefined", "Go to predefined key", cmd_predef }, {NULL } }; static WERROR cmd_help(struct regshell_context *ctx, int argc, const char **argv) { unsigned int i; printf("Available commands:\n"); for(i = 0; regshell_cmds[i].name; i++) { printf("%s - %s\n", regshell_cmds[i].name, regshell_cmds[i].help); } return WERR_OK; } static WERROR process_cmd(struct regshell_context *ctx, char *line) { int argc; const char **argv = NULL; int ret, i; if ((ret = poptParseArgvString(line, &argc, &argv)) != 0) { fprintf(stderr, "regshell: %s\n", poptStrerror(ret)); return WERR_INVALID_PARAM; } for(i = 0; regshell_cmds[i].name; i++) { if(!strcmp(regshell_cmds[i].name, argv[0]) || (regshell_cmds[i].alias && !strcmp(regshell_cmds[i].alias, argv[0]))) { return regshell_cmds[i].handle(ctx, argc, argv); } } fprintf(stderr, "No such command '%s'\n", argv[0]); return WERR_INVALID_PARAM; } #define MAX_COMPLETIONS 100 static struct registry_key *current_key = NULL; static char **reg_complete_command(const char *text, int start, int end) { /* Complete command */ char **matches; size_t len, samelen=0; int i, count=1; matches = malloc_array_p(char *, MAX_COMPLETIONS); if (!matches) return NULL; matches[0] = NULL; len = strlen(text); for (i=0;regshell_cmds[i].handle && count < MAX_COMPLETIONS-1;i++) { if (strncmp(text, regshell_cmds[i].name, len) == 0) { matches[count] = strdup(regshell_cmds[i].name); if (!matches[count]) goto cleanup; if (count == 1) samelen = strlen(matches[count]); else while (strncmp(matches[count], matches[count-1], samelen) != 0) samelen--; count++; } } switch (count) { case 0: /* should never happen */ case 1: goto cleanup; case 2: matches[0] = strdup(matches[1]); break; default: matches[0] = strndup(matches[1], samelen); } matches[count] = NULL; return matches; cleanup: count--; while (count >= 0) { free(matches[count]); count--; } free(matches); return NULL; } static char **reg_complete_key(const char *text, int start, int end) { struct registry_key *base; const char *subkeyname; unsigned int i, j = 1; size_t len, samelen = 0; char **matches; const char *base_n = ""; TALLOC_CTX *mem_ctx; WERROR status; int ret; matches = malloc_array_p(char *, MAX_COMPLETIONS); if (!matches) return NULL; matches[0] = NULL; mem_ctx = talloc_init("completion"); base = current_key; len = strlen(text); for(i = 0; j < MAX_COMPLETIONS-1; i++) { status = reg_key_get_subkey_by_index(mem_ctx, base, i, &subkeyname, NULL, NULL); if(W_ERROR_IS_OK(status)) { if(!strncmp(text, subkeyname, len)) { matches[j] = strdup(subkeyname); j++; if (j == 1) samelen = strlen(matches[j]); else while (strncmp(matches[j], matches[j-1], samelen) != 0) samelen--; } } else if(W_ERROR_EQUAL(status, WERR_NO_MORE_ITEMS)) { break; } else { int n; printf("Error creating completion list: %s\n", win_errstr(status)); for (n = j; n >= 0; n--) { SAFE_FREE(matches[n]); } SAFE_FREE(matches); talloc_free(mem_ctx); return NULL; } } if (j == 1) { /* No matches at all */ SAFE_FREE(matches); talloc_free(mem_ctx); return NULL; } if (j == 2) { /* Exact match */ ret = asprintf(&matches[0], "%s%s", base_n, matches[1]); } else { ret = asprintf(&matches[0], "%s%s", base_n, talloc_strndup(mem_ctx, matches[1], samelen)); } talloc_free(mem_ctx); if (ret == -1) { SAFE_FREE(matches); return NULL; } matches[j] = NULL; return matches; } static char **reg_completion(const char *text, int start, int end) { smb_readline_ca_char(' '); if (start == 0) { return reg_complete_command(text, start, end); } else { return reg_complete_key(text, start, end); } } int main(int argc, const char **argv) { int opt; const char *file = NULL; poptContext pc; const char *remote = NULL; struct regshell_context *ctx; struct tevent_context *ev_ctx; bool ret = true; struct poptOption long_options[] = { POPT_AUTOHELP {"file", 'F', POPT_ARG_STRING, &file, 0, "open hive file", NULL }, {"remote", 'R', POPT_ARG_STRING, &remote, 0, "connect to specified remote server", NULL}, POPT_COMMON_SAMBA POPT_COMMON_CREDENTIALS POPT_COMMON_VERSION { NULL } }; pc = poptGetContext(argv[0], argc, argv, long_options,0); while((opt = poptGetNextOpt(pc)) != -1) { } ctx = talloc_zero(NULL, struct regshell_context); ev_ctx = s4_event_context_init(ctx); if (remote != NULL) { ctx->registry = reg_common_open_remote(remote, ev_ctx, cmdline_lp_ctx, cmdline_credentials); } else if (file != NULL) { ctx->current = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials); if (ctx->current == NULL) return 1; ctx->registry = ctx->current->context; ctx->path = talloc_strdup(ctx, ""); ctx->predef = NULL; ctx->root = ctx->current; } else { ctx->registry = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx); } if (ctx->registry == NULL) return 1; if (ctx->current == NULL) { unsigned int i; for (i = 0; (reg_predefined_keys[i].handle != 0) && (ctx->current == NULL); i++) { WERROR err; err = reg_get_predefined_key(ctx->registry, reg_predefined_keys[i].handle, &ctx->current); if (W_ERROR_IS_OK(err)) { ctx->predef = talloc_strdup(ctx, reg_predefined_keys[i].name); ctx->path = talloc_strdup(ctx, ""); ctx->root = ctx->current; break; } else { ctx->current = NULL; ctx->root = NULL; } } } if (ctx->current == NULL) { fprintf(stderr, "Unable to access any of the predefined keys\n"); return 1; } poptFreeContext(pc); while (true) { char *line, *prompt; if (asprintf(&prompt, "%s\\%s> ", ctx->predef?ctx->predef:"", ctx->path) < 0) { ret = false; break; } current_key = ctx->current; /* No way to pass a void * pointer via readline :-( */ line = smb_readline(prompt, NULL, reg_completion); if (line == NULL) { free(prompt); break; } if (line[0] != '\n') { ret = W_ERROR_IS_OK(process_cmd(ctx, line)); } free(line); free(prompt); } talloc_free(ctx); return (ret?0:1); }
{ "pile_set_name": "Github" }
import { get } from '@ember/object'; import { hash } from 'rsvp'; import Route from '@ember/routing/route'; export default Route.extend({ model(params) { const store = get(this, 'store'); const clusterStore = get(this, 'clusterStore'); return hash({ persistentVolumes: clusterStore.findAll('persistentVolume'), storageClasses: clusterStore.findAll('storageClass'), pvc: store.find('persistentVolumeClaim', params.volume_id), }); }, });
{ "pile_set_name": "Github" }
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include "tensorflow/python/framework/cpp_shape_inference.h" #include "tensorflow/core/framework/node_def.pb.h" #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/shape_inference.h" #include "tensorflow/core/framework/tensor_shape.pb.h" #include "tensorflow/core/lib/core/errors.h" #include "tensorflow/core/lib/strings/strcat.h" #include "tensorflow/python/framework/cpp_shape_inference.pb.h" #include "tensorflow/python/lib/core/py_func.h" namespace tensorflow { namespace swig { namespace { void ProtoFromShapeHandle(tensorflow::shape_inference::ShapeHandle s, tensorflow::shape_inference::InferenceContext* c, TensorShapeProto* out) { if (c->RankKnown(s)) { const int32 rank = c->Rank(s); for (int i = 0; i < rank; ++i) { shape_inference::DimensionHandle d = c->Dim(s, i); auto* out_dim = out->add_dim(); if (c->ValueKnown(d)) { out_dim->set_size(c->Value(d)); } else { out_dim->set_size(-1); } } } else { out->set_unknown_rank(true); } } Status RunCppShapeInferenceImpl( int graph_def_version, const string& serialized_node_def, const std::vector<string>& input_serialized_shapes, const std::vector<PyObject*>& input_constant_tensor_values, const std::vector<string>& input_constant_tensor_as_shape_values, std::vector<string>* output_tensor_shape_protos, string* input_tensors_needed_out) { tensorflow::NodeDef node; if (!node.ParseFromString(serialized_node_def)) { return errors::InvalidArgument( "Error parsing node_def during cpp shape inference"); } DCHECK_EQ(output_tensor_shape_protos->size(), 0); const OpRegistrationData* op_reg_data; TF_RETURN_IF_ERROR(OpRegistry::Global()->LookUp(node.op(), &op_reg_data)); if (op_reg_data->shape_inference_fn == nullptr) { return errors::InvalidArgument( "No shape inference function exists for op '", node.op(), "', did you forget to define it?"); } // Convert input shapes. std::vector<TensorShapeProto> input_shapes; std::vector< std::unique_ptr<std::vector<std::pair<TensorShapeProto, DataType>>>> input_handle_shapes_and_types; input_shapes.resize(input_serialized_shapes.size()); input_handle_shapes_and_types.resize(input_serialized_shapes.size()); CppShapeInferenceResult tmp; for (int i = 0; i < input_serialized_shapes.size(); ++i) { tmp.Clear(); if (!tmp.ParseFromString(input_serialized_shapes[i])) { return errors::InvalidArgument( "Error parsing shape proto during cpp shape inference"); } input_shapes[i].Swap(tmp.mutable_shape()); if (tmp.handle_data().is_set()) { input_handle_shapes_and_types[i].reset( new std::vector<std::pair<TensorShapeProto, DataType>>); auto& v = *input_handle_shapes_and_types[i]; for (const auto& x : tmp.handle_data().shape_and_type()) { v.emplace_back(x.shape(), x.dtype()); } } } // Convert input tensor values; std::vector<Tensor> input_tensor_values(input_constant_tensor_values.size()); std::vector<const Tensor*> input_tensors; for (int i = 0; i < input_constant_tensor_values.size(); ++i) { auto* py_val = input_constant_tensor_values[i]; if (py_val == Py_None) { input_tensors.push_back(nullptr); } else { TF_RETURN_IF_ERROR( ConvertNdarrayToTensor(py_val, &input_tensor_values[i])); input_tensors.push_back(&input_tensor_values[i]); } } // Convert input tensor-as-shape values; std::vector<TensorShapeProto> input_tensor_as_shapes_protos( input_constant_tensor_as_shape_values.size()); for (int i = 0; i < input_constant_tensor_as_shape_values.size(); ++i) { if (!input_tensor_as_shapes_protos[i].ParseFromString( input_constant_tensor_as_shape_values[i])) { return errors::InvalidArgument( "Error parsing shape proto during cpp shape inference"); } } // Run shape inference. tensorflow::shape_inference::InferenceContext c( graph_def_version, &node, op_reg_data->op_def, input_shapes, input_tensors, input_tensor_as_shapes_protos, input_handle_shapes_and_types); TF_RETURN_IF_ERROR(c.construction_status()); TF_RETURN_IF_ERROR(c.Run(op_reg_data->shape_inference_fn)); // Convert output shapes. output_tensor_shape_protos->resize(c.num_outputs()); CppShapeInferenceResult out; for (int i = 0; i < c.num_outputs(); ++i) { out.Clear(); ProtoFromShapeHandle(c.output(i), &c, out.mutable_shape()); const auto* shapes_and_types = c.output_handle_shapes_and_types(i); if (shapes_and_types != nullptr) { auto* out_handle_data = out.mutable_handle_data(); out_handle_data->set_is_set(true); for (const auto& p : *shapes_and_types) { auto* out_shape_and_type = out_handle_data->add_shape_and_type(); ProtoFromShapeHandle(p.shape, &c, out_shape_and_type->mutable_shape()); out_shape_and_type->set_dtype(p.dtype); } } CHECK(out.AppendToString(&(*output_tensor_shape_protos)[i])); } // Add info about requested inputs. CppShapeInferenceInputsNeeded needed; for (int i = 0; i < c.num_inputs(); ++i) { if (c.requested_input_tensor(i)) { needed.add_input_tensors_needed(i); } if (c.requested_input_tensor_as_partial_shape(i)) { needed.add_input_tensors_as_shapes_needed(i); } } *input_tensors_needed_out = needed.SerializeAsString(); return Status::OK(); } } // namespace std::vector<string> RunCppShapeInference( int graph_def_version, const string& serialized_node_def, const std::vector<string>& input_serialized_shapes, PyObject* input_constant_tensor_values, const std::vector<string>& input_constant_tensor_as_shape_values, TF_Status* out_status) { if (!PyList_Check(input_constant_tensor_values)) { TF_SetStatus(out_status, TF_INVALID_ARGUMENT, "Invalid python value"); return std::vector<string>(); } std::vector<PyObject*> input_constant_tensor_values_v; int cnt = PyList_Size(input_constant_tensor_values); input_constant_tensor_values_v.reserve(cnt); for (int i = 0; i < cnt; ++i) { input_constant_tensor_values_v.push_back( PyList_GetItem(input_constant_tensor_values, i)); } std::vector<string> output; string input_tensors_needed_out; tensorflow::Status status = RunCppShapeInferenceImpl( graph_def_version, serialized_node_def, input_serialized_shapes, input_constant_tensor_values_v, input_constant_tensor_as_shape_values, &output, &input_tensors_needed_out); Set_TF_Status_from_Status(out_status, status); if (!status.ok()) { return std::vector<string>(); } output.push_back(input_tensors_needed_out); return output; } } // namespace swig } // namespace tensorflow
{ "pile_set_name": "Github" }
/* Copyright 2015 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) // GroupName is the group name use in this package const GroupName = "storage.k8s.io" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } var ( // TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) localSchemeBuilder = &SchemeBuilder AddToScheme = localSchemeBuilder.AddToScheme ) // Adds the list of known types to the given scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &StorageClass{}, &StorageClassList{}, &VolumeAttachment{}, &VolumeAttachmentList{}, &CSIDriver{}, &CSIDriverList{}, &CSINode{}, &CSINodeList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil }
{ "pile_set_name": "Github" }
<!-- ~ Copyright 2019 WeBank ~ ~ 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. --> <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.3 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> <id>linkis-cs-server</id> <formats> <format>zip</format> </formats> <includeBaseDirectory>true</includeBaseDirectory> <baseDirectory>linkis-cs-server</baseDirectory> <dependencySets> <dependencySet> <!-- Enable access to all projects in the current multimodule build! <useAllReactorProjects>true</useAllReactorProjects> --> <!-- Now, select which projects to include in this module-set. --> <outputDirectory>lib</outputDirectory> <useProjectArtifact>true</useProjectArtifact> <useTransitiveDependencies>true</useTransitiveDependencies> <unpack>false</unpack> <useStrictFiltering>false</useStrictFiltering> <useTransitiveFiltering>true</useTransitiveFiltering> </dependencySet> </dependencySets> <fileSets> <fileSet> <directory>${basedir}/conf</directory> <includes> <include>*</include> </includes> <fileMode>0777</fileMode> <outputDirectory>conf</outputDirectory> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>${basedir}/bin</directory> <includes> <include>*</include> </includes> <fileMode>0777</fileMode> <outputDirectory>bin</outputDirectory> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>.</directory> <excludes> <exclude>*/**</exclude> </excludes> <outputDirectory>logs</outputDirectory> </fileSet> </fileSets> </assembly>
{ "pile_set_name": "Github" }
{ "created_at": "2015-02-27T22:29:17.088804", "description": "A Library for the iPhone to enable progressive playback of MP3 streams. Designed to work for SoundCloud.com", "fork": false, "full_name": "stigi/cocoa-soundcloud-streaming", "language": "Objective-C", "updated_at": "2015-02-27T23:44:15.605486" }
{ "pile_set_name": "Github" }
<?php /* Gibbon, Flexible & Open School System Copyright (C) 2010, Ross Parker This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ use Gibbon\Forms\Form; use Gibbon\Forms\DatabaseFormFactory; //Gibbon system-wide includes include '../../gibbon.php'; //Module includes require_once __DIR__ . '/moduleFunctions.php'; //Setup variables $output = ''; $id = $_GET['id']; $action = null; if (isset($_GET['action'])) { $action = $_GET['action']; } $category = null; if (isset($_GET['category'])) { $category = $_GET['category']; } $purpose = null; if (isset($_GET['purpose'])) { $purpose = $_GET['purpose']; } $tag = null; if (isset($_GET['tag'.$id])) { $tag = $_GET['tag'.$id]; } $gibbonYearGroupID = null; if (isset($_GET['gibbonYearGroupID'])) { $gibbonYearGroupID = $_GET['gibbonYearGroupID']; } $allowUpload = $_GET['allowUpload']; $alpha = null; if (isset($_GET['alpha'])) { $alpha = $_GET['alpha']; } if (isActionAccessible($guid, $connection2, '/modules/Planner/resources_manage_add.php') == false) { //Acess denied $output .= "<div class='error'>"; $output .= __('Your request failed because you do not have access to this action.'); $output .= '</div>'; } else { $highestAction = getHighestGroupedAction($guid, '/modules/Planner/resources_manage.php', $connection2); if ($highestAction == false) { $output .= "<div class='error'>"; $output .= __('The highest grouped action cannot be determined.'); $output .= '</div>'; } else { $output .= "<script type='text/javascript'>"; $output .= '$(document).ready(function() {'; $output .= "$('.checkall').click(function () {"; $output .= "$(this).parents('fieldset:eq(0)').find(':checkbox').attr('checked', this.checked);"; $output .= "});"; $output .= 'var options={'; $output .= 'success: function(response) {'; $output .= "tinymce.execCommand(\"mceFocus\",false,\"$id\"); tinyMCE.execCommand(\"mceInsertContent\", 0, response); formReset(); \$(\".".$id.'resourceAddSlider").slideUp();'; $output .= '}, '; $output .= "url: '".$_SESSION[$guid]['absoluteURL']."/modules/Planner/resources_add_ajaxProcess.php',"; $output .= "type: 'POST'"; $output .= '};'; $output .= "$('#".$id."ajaxForm').submit(function() {"; $output .= '$(this).ajaxSubmit(options);'; $output .= '$(".'.$id."resourceAddSlider\").html(\"<div class='resourceAddSlider'><img style='margin: 10px 0 5px 0' src='".$_SESSION[$guid]['absoluteURL'].'/themes/'.$_SESSION[$guid]['gibbonThemeName']."/img/loading.gif' alt='".__('Uploading')."' onclick='return false;' /><br/>".__('Loading').'</div>");'; $output .= 'return false;'; $output .= '});'; $output .= '});'; $output .= 'var formReset=function() {'; $output .= "$('#".$id."resourceAdd').css('display','none');"; $output .= '};'; $output .= '</script>'; $form = Form::create($id.'ajaxForm', '')->addClass('resourceQuick'); $form->setFactory(DatabaseFormFactory::create($pdo)); $form->addHiddenValue('id', $id); $form->addHiddenValue($id.'address', $_SESSION[$guid]['address']); $col = $form->addRow()->addColumn(); $col->addWebLink("<img title='".__('Close')."' src='./themes/".$_SESSION[$guid]['gibbonThemeName']."/img/iconCross.png'/>") ->onClick("formReset(); \$(\".".$id."resourceAddSlider\").slideUp();")->addClass('right'); $col->addContent(__('Add & Insert A New Resource'))->wrap('<h3 style="margin-top: 0;">', '</h3>'); $col->addContent(__('Use the form below to add a new resource to Gibbon. If the addition is successful, then it will be automatically inserted into your work above. Note that you cannot create HTML resources here (you have to go to the Planner module for that).'))->wrap('<p>', '</p>'); $form->addRow()->addSubheading(__('Resource Contents')); $types = array('File' => __('File'), 'Link' => __('Link')); $row = $form->addRow(); $row->addLabel($id.'type', __('Type')); $row->addSelect($id.'type')->fromArray($types)->required()->placeholder(); // File $form->toggleVisibilityByClass('resourceFile')->onSelect($id.'type')->when('File'); $row = $form->addRow()->addClass('resourceFile'); $row->addLabel($id.'file', __('File')); $row->addFileUpload($id.'file')->required(); // Link $form->toggleVisibilityByClass('resourceLink')->onSelect($id.'type')->when('Link'); $row = $form->addRow()->addClass('resourceLink'); $row->addLabel($id.'link', __('Link')); $row->addURL($id.'link')->maxLength(255)->required(); $form->addRow()->addSubheading(__('Resource Details')); $row = $form->addRow(); $row->addLabel($id.'name', __('Name')); $row->addTextField($id.'name')->required()->maxLength(60); $categories = getSettingByScope($connection2, 'Resources', 'categories'); $row = $form->addRow(); $row->addLabel($id.'category', __('Category')); $row->addSelect($id.'category')->fromString($categories)->required()->placeholder(); $purposesGeneral = getSettingByScope($connection2, 'Resources', 'purposesGeneral'); $purposesRestricted = ($highestAction == 'Manage Resources_all')? getSettingByScope($connection2, 'Resources', 'purposesRestricted') : ''; $row = $form->addRow(); $row->addLabel($id.'purpose', __('Purpose')); $row->addSelect($id.'purpose')->fromString($purposesGeneral)->fromString($purposesRestricted)->placeholder(); $sql = "SELECT tag as value, CONCAT(tag, ' <i>(', count, ')</i>') as name FROM gibbonResourceTag WHERE count>0 ORDER BY tag"; $row = $form->addRow()->addClass('tags'); $row->addLabel($id.'tags', __('Tags'))->description(__('Use lots of tags!')); $row->addFinder($id.'tags') ->fromQuery($pdo, $sql) ->required() ->setParameter('hintText', __('Type a tag...')) ->setParameter('allowFreeTagging', true); $row = $form->addRow(); $row->addLabel($id.'gibbonYearGroupID', __('Year Groups'))->description(__('Students year groups which may participate')); $row->addCheckboxYearGroup($id.'gibbonYearGroupID')->checkAll()->addCheckAllNone(); $row = $form->addRow(); $row->addLabel($id.'description', __('Description')); $row->addTextArea($id.'description')->setRows(8); $row = $form->addRow(); $row->addFooter(); $row->addSubmit(); $output .= $form->getOutput(); } } echo $output;
{ "pile_set_name": "Github" }
/* Copyright 2015 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package v1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) // GroupName is the group name use in this package const GroupName = "" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } var ( // We only register manually written functions here. The registration of the // generated functions takes place in the generated files. The separation // makes the code compile even when the generated files are missing. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) AddToScheme = SchemeBuilder.AddToScheme ) // Adds the list of known types to the given scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &Pod{}, &PodList{}, &PodStatusResult{}, &PodTemplate{}, &PodTemplateList{}, &ReplicationController{}, &ReplicationControllerList{}, &Service{}, &ServiceProxyOptions{}, &ServiceList{}, &Endpoints{}, &EndpointsList{}, &Node{}, &NodeList{}, &NodeProxyOptions{}, &Binding{}, &Event{}, &EventList{}, &List{}, &LimitRange{}, &LimitRangeList{}, &ResourceQuota{}, &ResourceQuotaList{}, &Namespace{}, &NamespaceList{}, &Secret{}, &SecretList{}, &ServiceAccount{}, &ServiceAccountList{}, &PersistentVolume{}, &PersistentVolumeList{}, &PersistentVolumeClaim{}, &PersistentVolumeClaimList{}, &PodAttachOptions{}, &PodLogOptions{}, &PodExecOptions{}, &PodPortForwardOptions{}, &PodProxyOptions{}, &ComponentStatus{}, &ComponentStatusList{}, &SerializedReference{}, &RangeAllocation{}, &ConfigMap{}, &ConfigMapList{}, &EphemeralContainers{}, ) // Add common types scheme.AddKnownTypes(SchemeGroupVersion, &metav1.Status{}) // Add the watch version that applies metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil }
{ "pile_set_name": "Github" }
package org.ovirt.engine.core.bll.storage.domain; import javax.inject.Inject; import org.ovirt.engine.core.bll.QueriesCommandBase; import org.ovirt.engine.core.bll.context.EngineContext; import org.ovirt.engine.core.common.queries.GetPermittedStorageDomainsByStoragePoolIdParameters; import org.ovirt.engine.core.dao.StorageDomainDao; public class GetPermittedStorageDomainsByStoragePoolIdQuery<P extends GetPermittedStorageDomainsByStoragePoolIdParameters> extends QueriesCommandBase<P> { @Inject private StorageDomainDao storageDomainDao; public GetPermittedStorageDomainsByStoragePoolIdQuery(P parameters, EngineContext engineContext) { super(parameters, engineContext); } @Override protected void executeQueryCommand() { P params = getParameters(); setReturnValue(storageDomainDao .getPermittedStorageDomainsByStoragePool(getUserID(), params.getActionGroup(), params.getStoragePoolId())); } }
{ "pile_set_name": "Github" }
package kube // _base defines settings that apply to all cloud objects _base: { name: string label: [string]: string // k8s is a set of Kubernetes-specific settings that will be merged in at // the top-level. The allowed fields are type specfic. kubernetes: {} } deployment: [Name=_]: _base & { // Allow any string, but take Name by default. name: string | *Name kind: *"deployment" | "stateful" | "daemon" replicas: int | *1 image: string // expose port defines named ports that is exposed in the service expose: port: [string]: int // port defines named ports that is not exposed in the service. port: [string]: int arg: [string]: string args: [ for k, v in arg { "-\(k)=\(v)" } ] | [...string] // Environment variables env: [string]: string envSpec: [string]: {} envSpec: { for k, v in env { "\(k)": value: v } } volume: [Name=_]: { name: string | *Name mountPath: string subPath: string | *null readOnly: *false | true kubernetes: {} } } service: [Name=_]: _base & { name: *Name | string port: [Name=_]: { name: string | *Name port: int protocol: *"TCP" | "UDP" } kubernetes: {} } configMap: [string]: { } // define services implied by deployments for k, spec in deployment if len(spec.expose.port) > 0 { service: "\(k)": { // Copy over all ports exposed from containers. for Name, Port in spec.expose.port { port: "\(Name)": { // Set default external port to Port. targetPort must be // the respective containerPort (Port) if it differs from port. port: int | *Port if port != Port { targetPort: Port } } } // Copy over the labels label: spec.label } }
{ "pile_set_name": "Github" }
This folder contains a keystore and several certificate files that are used in KeyStoresTestCase.java for testing key-store manipulation operations. test.keystore - The keystore password is 'Elytron'. The key password used for the ssmith and ca entries is 'secret'. Keystore entries ================ The ca entry was generated using the following command: keytool -genkeypair -alias ca -keystore test.keystore -dname "O=Root Certificate Authority, [email protected], C=UK, ST=Elytron, CN=Elytron CA" -ext bc=ca:true The ssmith entry was generated using the following command: keytool -genkeypair -alias ssmith -keyalg RSA -keysize 1024 -validity 365 -keystore test.keystore -dname "CN=sally smith, OU=jboss, O=red hat, L=raleigh, ST=north carolina, C=us" -keypass secret -sigalg SHA256withRSA -ext EKU=clientAuth -ext KU:critical=digitalSignature -ext SAN=email:[email protected],DNS:sallysmith.example.com test-single-cert-reply.cert =========================== This single certificate reply from a root CA was generated using the following commands: # CSR creation keytool -certreq -keystore test.keystore -alias ssmith -sigalg SHA512withRSA -dname "CN=ssmith, OU=jboss, O=red hat, L=raleigh, ST=north carolina, C=us" -keypass secret -ext EKU=clientAuth -ext KU:critical=digitalSignature -file ssmith.csr # Reply from root CA keytool -gencert -keystore test.keystore -alias ca -infile ssmith.csr -outfile test-single-cert-reply.cert test-cert-chain-reply.cert ========================== This certificate chain reply from a root CA was generated by creating a file containing both the certificate generated from the commands above and the certificate from the ca entry in the keystore. test-exported.cert ========================== This certificate was generated using the following command: keytool -exportcert -alias ssmith -keystore test.keystore -file test-exported.cert test-trusted.cert ========================== This trusted certificate was generated using the following commands with a copy of test.keystore (it's trusted because it's issued using the ca entry from test.keystore): keytool -genkeypair -alias intermediateCA -keystore test.keystore -dname "O=Intermediate Certificate Authority, [email protected], C=UK, ST=Elytron, CN=Intermediate Elytron CA" -ext bc=ca:true -validity 3650 keytool -certreq -keystore test.keystore -alias intermediateCA -dname "O=Intermediate Certificate Authority, [email protected], C=UK, ST=Elytron, CN=Intermediate Elytron CA" -ext EKU=clientAuth -ext KU:critical=digitalSignature -file intermediate.csr keytool -gencert -keystore test.keystore -alias ca -infile intermediate.csr -outfile test-trusted.cert test-untrusted.cert ========================== This untrusted certificate was generated using the following commands (it's untrusted because the issuer certificate is not present in test.keystore or in the JDK cacerts file): keytool -genkeypair -alias anotherCA -keystore example.keystore -dname "O=Another Root Certificate Authority, [email protected], C=UK, ST=Elytron, CN=Another Elytron CA" -ext bc=ca:true keytool -exportcert -alias anotherCA -keystore example.keystore -file test-untrusted.cert test-untrusted-cert-chain-reply.cert ==================================== This untrusted certificate chain reply was generated using the following commands (it's untrusted because the issuer certificate is not present in test.keystore or in the JDK cacerts file): keytool -genkeypair -alias anotherCA -keystore example.keystore -dname "O=Another Root Certificate Authority, [email protected], C=UK, ST=Elytron, CN=Another Elytron CA" -ext bc=ca:true keytool -certreq -keystore test.keystore -alias ssmith -sigalg SHA512withRSA -dname "CN=ssmith, OU=jboss, O=red hat, L=raleigh, ST=north carolina, C=us" -keypass secret -ext EKU=clientAuth -ext KU:critical=digitalSignature -file ssmith.csr keytool -gencert -keystore example.keystore -alias anotherCA -infile ssmith.csr -outfile ssmith.cert The test-untrusted-cert-chain-reply.cert file can then be created by creating a file that contains both the ssmith.cert certificate and the certificate for the anotherCA entry in the example.keystore. ############################################ IMPORTANT ######################################################## # Do not modify the following key pairs in account.keystore. They have been used as account keys with Boulder # (Let's Encrypt's testing server) to record messages sent from Boulder to our ACME client. These recorded # messages are used in AcmeClientSpiTest.java to avoid having to integrate the complex Boulder setup into the # Elytron testsuite. Key / certificate validity is not important for these tests. ############################################################################################################### account.keystore was generated using the following commands: keytool -genkeypair -alias account1v2 -keystore account.keystore -dname CN=account1v2.key -keyalg RSA -keysize 2048 -validity 3650 -keypass elytron -storepass elytron keytool -genkeypair -alias account2v2 -keystore account.keystore -dname CN=account2v2.key -keyalg RSA -keysize 2048 -validity 3650 -keypass elytron -storepass elytron keytool -genkeypair -alias account3v2 -keystore account.keystore -dname CN=account3v2.key -keyalg RSA -keysize 2048 -validity 3650 -keypass elytron -storepass elytron keytool -genkeypair -alias account4v2 -keystore account.keystore -dname CN=account4v2.key -keyalg EC -keysize 256 -validity 3650 -keypass elytron -storepass elytron keytool -genkeypair -alias account5v2 -keystore account.keystore -dname CN=account5v2.key -keyalg RSA -keysize 2048 -validity 3650 -keypass elytron -storepass elytron keytool -genkeypair -alias account6v2 -keystore account.keystore -dname CN=account6v2.key -keyalg RSA -keysize 2048 -validity 3650 -keypass elytron -storepass elytron keytool -genkeypair -alias account7v2 -keystore account.keystore -dname CN=account7v2.key -keyalg RSA -keysize 2048 -validity 3650 -keypass elytron -storepass elytron keytool -genkeypair -alias account8v2 -keystore account.keystore -dname CN=account8v2.key -keyalg RSA -keysize 2048 -validity 3650 -keypass elytron -storepass elytron keytool -genkeypair -alias account9v2 -keystore account.keystore -dname CN=account9v2.key -keyalg RSA -keysize 2048 -validity 3650 -keypass elytron -storepass elytron keytool -genkeypair -alias newKeyv2 -keystore account.keystore -dname CN=account8v2.key -keyalg RSA -keysize 2048 -validity 3650 -keypass elytron -storepass elytron keytool -genkeypair -alias newECKeyv2 -keystore account.keystore -dname CN=account8v2.key -keyalg EC -keysize 256 -validity 3650 -keypass elytron -storepass elytron keytool -genkeypair -alias invalid -keystore account.keystore -dname CN=invalid.key -keyalg RSA -keysize 2048 -validity 3650 -keypass elytron -storepass elytron The "revokeAliasV2" and "revokeWithReasonAlias" private key entries were generated by obtaining certificate chains and private keys for "account1v2" from Boulder. The keystore password is "elytron".
{ "pile_set_name": "Github" }
{ "type": "root", "children": [ { "type": "text", "value": "\n\n\n", "position": { "start": { "line": 1, "column": 27, "offset": 26 }, "end": { "line": 4, "column": 1, "offset": 29 } } }, { "type": "element", "tagName": "p", "properties": {}, "children": [] }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 4, "column": 5, "offset": 33 }, "end": { "line": 6, "column": 1, "offset": 35 } } }, { "type": "element", "tagName": "div", "properties": {}, "children": [ { "type": "element", "tagName": "p", "properties": {}, "children": [] } ], "position": { "start": { "line": 6, "column": 1, "offset": 35 }, "end": { "line": 6, "column": 16, "offset": 50 } } }, { "type": "text", "value": "\n", "position": { "start": { "line": 6, "column": 16, "offset": 50 }, "end": { "line": 7, "column": 1, "offset": 51 } } } ], "data": { "quirksMode": false }, "position": { "start": { "line": 1, "column": 1, "offset": 0 }, "end": { "line": 7, "column": 1, "offset": 51 } } }
{ "pile_set_name": "Github" }
import os import sys import shutil import requests import re import json import time import logging import uuid import anchore.anchore_auth from anchore.util import contexts # network operations _logger = logging.getLogger(__name__) def get_feed_list(): ret = {'success': False, 'status_code': 1, 'text': ""} feedurl = contexts['anchore_config']['feeds_url'] feed_timeout = contexts['anchore_config']['feeds_conn_timeout'] feed_maxretries = contexts['anchore_config']['feeds_max_retries'] baseurl = feedurl url = baseurl retlist = list() done = False while not done: record = anchore.anchore_auth.anchore_auth_get(contexts['anchore_auth'], url, timeout=feed_timeout, retries=feed_maxretries) ret.update(record) if record['success']: data = json.loads(record['text']) if data and 'feeds' in data: retlist = retlist + data['feeds'] if 'next_token' in data and data['next_token']: url = baseurl + "?next_token=" + data['next_token'] else: done = True else: done = True else: done = True return (retlist, ret) def get_group_list(feed): ret = {'success': False, 'status_code': 1, 'text': ""} feedurl = contexts['anchore_config']['feeds_url'] feed_timeout = contexts['anchore_config']['feeds_conn_timeout'] feed_maxretries = contexts['anchore_config']['feeds_max_retries'] baseurl = '/'.join([feedurl, feed]) url = baseurl retlist = list() done = False while not done: record = anchore.anchore_auth.anchore_auth_get(contexts['anchore_auth'], url, timeout=feed_timeout, retries=feed_maxretries) ret.update(record) if record['success']: data = json.loads(record['text']) retlist = retlist + data['groups'] if 'next_token' in data and data['next_token']: url = baseurl + "?next_token=" + data['next_token'] else: done = True else: done = True return (retlist, record) def get_group_data(feed, group, since="1970-01-01", uniq_key=None): feedurl = contexts['anchore_config']['feeds_url'] feed_timeout = contexts['anchore_config']['feeds_conn_timeout'] feed_maxretries = contexts['anchore_config']['feeds_max_retries'] baseurl = '/'.join([feedurl, feed, group, "?since=" + since]) url = baseurl updatetime = int(time.time()) ret = list() last_token = "" success = True done = False hashret = {} while not done: _logger.debug("data group url: " + str(url)) record = anchore.anchore_auth.anchore_auth_get(contexts['anchore_auth'], url, timeout=feed_timeout, retries=feed_maxretries) if record['success']: data = json.loads(record['text']) if 'data' in data: if not uniq_key: ret.extend(data['data']) else: for el in data['data']: for subkey in el.keys(): try: thekey = el[subkey][uniq_key] except: thekey = str(uuid.uuid4()) hashret[thekey] = el if 'next_token' in data and data['next_token']: url = baseurl + "&next_token=" + data['next_token'] if last_token == data['next_token']: done = True last_token = data['next_token'] else: done = True else: success = False done = True else: success = False if record and 'err_msg' in record: ret = record.get('err_msg') done = True if success and uniq_key and hashret: ret = hashret.values() return (success, ret) def create_feed(feed): if not feed: return (False) return (contexts['anchore_db'].create_feed(feed)) def create_feedgroup(feed, group): if not feed or not group: return (False) return (contexts['anchore_db'].create_feedgroup(feed, group)) def sync_feedmeta(default_sublist=['vulnerabilities']): ret = {'success': False, 'text': "", 'status_code': 1} try: feedmeta = load_anchore_feedmeta() feeds, record = get_feed_list() if feeds: for feedrecord in feeds: feed = feedrecord['name'] if feed not in feedmeta: feedmeta[feed] = {} feedmeta[feed].update(feedrecord) if 'groups' not in feedmeta[feed]: feedmeta[feed]['groups'] = {} if 'subscribed' not in feedmeta[feed]: if feed in default_sublist: feedmeta[feed]['subscribed'] = True else: feedmeta[feed]['subscribed'] = False rc = create_feed(feed) groups, record = get_group_list(feed) if groups: for grouprecord in groups: group = grouprecord['name'] if group not in feedmeta[feed]['groups']: feedmeta[feed]['groups'][group] = {} feedmeta[feed]['groups'][group].update(grouprecord) rc = create_feedgroup(feed, group) else: ret['text'] = "WARN: cannot get list of groups from feed: " + str(feed) ret['success'] = True ret['status_code'] = 0 else: ret['text'] = "cannot get list of feeds from service\nMessage from server: " + record['text'] return (False, ret) save_anchore_feedmeta(feedmeta) except Exception as err: import traceback traceback.print_exc() _logger.debug("exception: " + str(err)) ret['text'] = "exception: " + str(err) return (False, ret) return (True, ret) def feed_group_data_exists(feed, group, datafile): feedmeta = load_anchore_feedmeta() if feed in feedmeta.keys() and group in feedmeta[feed]['groups'].keys() and 'datafiles' in feedmeta[feed]['groups'][ group] and datafile in feedmeta[feed]['groups'][group]['datafiles']: return (True) return (False) def sync_feeds(force_since=None, do_combine=False): ret = {'success': False, 'text': "", 'status_code': 1} feedmeta = load_anchore_feedmeta() feedurl = contexts['anchore_config']['feeds_url'] try: for feed in feedmeta.keys(): if feedmeta[feed]['subscribed']: _logger.info("syncing data for subscribed feed (" + str(feed) + ") ...") groups = feedmeta[feed]['groups'].keys() if groups: for group in groups: sincets = 0 group_meta = {} if group in feedmeta[feed]['groups']: group_meta = feedmeta[feed]['groups'][group] if 'last_update' in group_meta: sincets = group_meta['last_update'] if force_since: sincets = float(force_since) if 'datafiles' not in group_meta: group_meta['datafiles'] = list() updatetime = int(time.time()) since = time.strftime("%Y-%m-%d", time.gmtime(sincets)) now = time.strftime("%Y-%m-%d", time.gmtime(updatetime)) datafilename = "data_" + since + "_to_" + now + ".json" if feed_group_data_exists(feed, group, datafilename): _logger.info("\tskipping group data: " + str(group) + ": already synced") else: _logger.info("\tsyncing group data: " + str(group) + ": ...") uniq_key = None if feed == 'packages' and group in ['npm', 'gem']: uniq_key = "name" elif feed == 'vulnerabilities': uniq_key = "Name" success, data = get_group_data(feed, group, since=since, uniq_key=uniq_key) if success: rc = save_anchore_feed_group_data(feed, group, datafilename, data) group_meta['prev_update'] = sincets group_meta['last_update'] = updatetime if datafilename not in group_meta['datafiles']: group_meta['datafiles'].append(datafilename) # finally, do any post download feed/group handler actions rc, msg = handle_anchore_feed_post(feed, group) else: if data and isinstance(data, str): err_msg = data else: err_msg = 'check --debug output and/or try again' _logger.warn("\t\tWARN: failed to download feed/group data (" + str(feed) + "/" + str( group) + "): {}".format(err_msg)) else: _logger.info("skipping data sync for unsubscribed feed (" + str(feed) + ") ...") ret['status_code'] = 0 ret['success'] = True except Exception as err: import traceback traceback.print_exc() _logger.debug("exception: " + str(err)) ret['text'] = "ERROR: " + str(err) return (False, ret) if not save_anchore_feedmeta(feedmeta): ret['text'] = "\t\tWARN: failed to store metadata on synced feed data" # if user has asked for data compress, do it now if do_combine: handle_datafile_combine() return (True, ret) def check(): if not load_anchore_feedmeta(): return (False, "feeds are not initialized: please run 'anchore feeds sync' and try again") if not load_anchore_feeds_list(): return (False, "feeds list is empty: please run 'anchore feeds sync' and try again") return (True, "success") def load_anchore_feeds_list(): ret = [] feedmeta = load_anchore_feedmeta() if feedmeta: ret = feedmeta.values() return (ret) def load_anchore_feed_groups_list(feed): ret = [] feedmeta = load_anchore_feedmeta() if feedmeta: if feed in feedmeta.keys(): ret = feedmeta[feed]['groups'].values() return (ret) def load_anchore_feed_group_datameta(feed, group): ret = {} feedmeta = load_anchore_feedmeta() if feedmeta: if feed in feedmeta.keys() and group in feedmeta[feed]['groups'].keys(): ret = feedmeta[feed]['groups'][group] return (ret) def load_anchore_feedmeta(): return (contexts['anchore_db'].load_feedmeta()) def save_anchore_feedmeta(feedmeta): return (contexts['anchore_db'].save_feedmeta(feedmeta)) def subscribe_anchore_feed(feed, user_tier=0): success = True msg = str(feed) + ": subscribed." feedmeta = load_anchore_feedmeta() if feed in feedmeta: if user_tier >= int(feedmeta[feed]['access_tier']): if not feedmeta[feed]['subscribed']: feedmeta[feed]['subscribed'] = True if not save_anchore_feedmeta(feedmeta): msg = str(feed) + ": failed to subscribe to feed (check debug output)." success = False else: msg = 'Current user does not have sufficient access tier to subscribe to feed {0}. Current tier is {1}, must be {2} to access feed'.format(feed, user_tier, feedmeta[feed]['access_tier']) success = False else: msg = "cannot find specified feed (" + str(feed) + "): please review the feeds list and try again" success = False return (success, msg) def unsubscribe_anchore_feed(feed): success = True msg = str(feed) + ": unsubscribed." feedmeta = load_anchore_feedmeta() if feed in feedmeta: if feedmeta[feed]['subscribed']: feedmeta[feed]['subscribed'] = False if not save_anchore_feedmeta(feedmeta): msg = str(feed) + ": failed to unsubscribe to feed (check debug output)." success = False else: msg = "cannot find specified feed (" + str(feed) + "): please review the feeds list and try again" success = False return (success, msg) def save_anchore_feed_group_data(feed, group, datafile, data): return (contexts['anchore_db'].save_feed_group_data(feed, group, datafile, data)) def load_anchore_feed_group_data(feed, group, datafile): return (contexts['anchore_db'].load_feed_group_data(feed, group, datafile)) def delete_anchore_feed_group_data(feed, group, datafile): return (contexts['anchore_db'].delete_feed_group_data(feed, group, datafile)) def load_anchore_feed(feed, group, ensure_unique=False): ret = {'success': False, 'msg': "", 'data': list()} datameta = {} doupdate = False feedmeta = load_anchore_feedmeta() if not feedmeta: ret['msg'] = "feed data does not exist: please sync feed data" elif feed in feedmeta and not feedmeta[feed]['subscribed']: ret['msg'] = "not currently subscribed to feed (" + str(feed) + "): please subscribe, sync, and try again" else: if feed in feedmeta and group in feedmeta[feed]['groups']: datameta = feedmeta[feed]['groups'][group] if datameta and 'datafiles' in datameta: unique_hash = {} revfiles = sorted(datameta['datafiles']) # list should be latest first revfiles.reverse() for datafile in revfiles: thelist = load_anchore_feed_group_data(feed, group, datafile) # data should be latest first thelist.reverse() if ensure_unique: for el in thelist: if isinstance(el, dict) and len(el.keys()) == 1: if feed == 'vulnerabilities': elkey = el['Vulnerability']['Name'] else: elkey = el.keys()[0] #elkey = el.keys()[0] if elkey in unique_hash: _logger.debug("FOUND duplicate entry during scan for unique data values: " + str(elkey)) else: unique_hash[elkey] = el ret['data'] = ret['data'] + thelist ret['success'] = True ret['msg'] = "success" if ret['success'] and ensure_unique: ret['data'] = unique_hash.values() else: ret['msg'] = "no data exists for given feed/group (" + str(feed) + "/" + str(group) + ")" return (ret) def delete_anchore_feed(feed): feedmeta = load_anchore_feedmeta() if feed in feedmeta.keys(): if not feedmeta[feed]['subscribed']: try: for group in feedmeta[feed]['groups'].keys(): feedmeta[feed]['groups'][group].pop('datafiles', []) feedmeta[feed]['groups'][group].pop('last_update', 0) feedmeta[feed]['groups'][group].pop('prev_update', 0) save_anchore_feedmeta(feedmeta) contexts['anchore_db'].delete_feed(feed) except Exception as err: _logger.warn("could not complete delete of feed - message from service: " + str(err)) return (True) else: _logger.warn( "skipping delete of feed that is marked as subscribed - please unsubscribe first and then retry the delete") return (True) # TODO wip def handle_anchore_feed_pre(feed): ret = True msg = "" feedmeta = load_anchore_feedmeta() if feed in feedmeta: if feed == 'vulnerabilities': if not feedmeta[feed]['subscribed']: rc, msg = subscribe_anchore_feed(feed) ret = rc return (ret, msg) def handle_anchore_feed_post(feed, group): ret = True msg = "" if feed == 'imagedata': # handler d = load_anchore_feed(feed, group) if d and d['success']: for record in d['data']: if 'redirecturl' in record.keys(): for tag in record['redirecturl'].keys(): url = record['redirecturl'][tag] imageId = tag if not contexts['anchore_db'].is_image_present(imageId): try: r = requests.get(url, timeout=10) if r.status_code == 200: data = json.loads(r.text) for imagedata in data: imagerecord = imagedata['image']['imagedata'] _logger.info("\t\tpopulating anchore DB with image data: " + imageId) contexts['anchore_db'].save_image_new(imageId, report=imagerecord) except Exception as err: _logger.error("exception: " + str(err)) ret = False msg = "failed to download/import image: " + imageId else: _logger.info("\t\tskipping: " + str(imageId) + ": already in DB") else: # no handler pass return (ret, msg) def handle_datafile_combine(): ret = True feedmeta = load_anchore_feedmeta() for feed in feedmeta.keys(): if 'groups' in feedmeta[feed] and 'subscribed' in feedmeta[feed] and feedmeta[feed]['subscribed']: _logger.info("combining data for feed ("+str(feed)+") ...") for group in feedmeta[feed]['groups']: rawdata = load_anchore_feed(feed, group, ensure_unique=False) data = rawdata['data'] uniqhash = {} uniq = list() collisions = 0 for v in data: vid = None try: if feed == 'vulnerabilities': vid = v['Vulnerability']['Name'] else: vid = v.keys()[0] except: vid = None pass if vid: if vid not in uniqhash: uniqhash[vid] = True uniq.append(v) else: collisions = collisions + 1 rawdata.clear() _logger.info("\tprocessing group data: " + str(group) + ": removed " + str(collisions) + " records as duplicate or out-of-date") # datafile updates updatetime = int(time.time()) now = time.strftime("%Y-%m-%d", time.gmtime(updatetime)) datafilename = "data_" + now + "_to_" + now + ".json" rc = save_anchore_feed_group_data(feed, group, datafilename, uniq) if rc: if 'datafiles' in feedmeta[feed]['groups'][group]: for dfile in feedmeta[feed]['groups'][group]['datafiles']: if dfile != datafilename: delete_anchore_feed_group_data(feed, group, dfile) feedmeta[feed]['groups'][group]['datafiles'] = [datafilename] save_anchore_feedmeta(feedmeta) return(ret)
{ "pile_set_name": "Github" }
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instcombine -S | FileCheck %s ; rdar://11748024 define i32 @a(i1 zeroext %x, i1 zeroext %y) { ; CHECK-LABEL: @a( ; CHECK-NEXT: [[SUB:%.*]] = select i1 [[X:%.*]], i32 2, i32 1 ; CHECK-NEXT: [[TMP1:%.*]] = zext i1 [[Y:%.*]] to i32 ; CHECK-NEXT: [[ADD:%.*]] = sub nsw i32 [[SUB]], [[TMP1]] ; CHECK-NEXT: ret i32 [[ADD]] ; %conv = zext i1 %x to i32 %conv3 = zext i1 %y to i32 %conv3.neg = sub i32 0, %conv3 %sub = add i32 %conv, 1 %add = add i32 %sub, %conv3.neg ret i32 %add } define i32 @PR30273_select(i1 %a, i1 %b) { ; CHECK-LABEL: @PR30273_select( ; CHECK-NEXT: [[ZEXT:%.*]] = zext i1 [[A:%.*]] to i32 ; CHECK-NEXT: [[SEL1:%.*]] = select i1 [[A]], i32 2, i32 1 ; CHECK-NEXT: [[SEL2:%.*]] = select i1 [[B:%.*]], i32 [[SEL1]], i32 [[ZEXT]] ; CHECK-NEXT: ret i32 [[SEL2]] ; %zext = zext i1 %a to i32 %sel1 = select i1 %a, i32 2, i32 1 %sel2 = select i1 %b, i32 %sel1, i32 %zext ret i32 %sel2 } define i32 @PR30273_zext_add(i1 %a, i1 %b) { ; CHECK-LABEL: @PR30273_zext_add( ; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[A:%.*]] to i32 ; CHECK-NEXT: [[CONV3:%.*]] = zext i1 [[B:%.*]] to i32 ; CHECK-NEXT: [[ADD:%.*]] = add nuw nsw i32 [[CONV3]], [[CONV]] ; CHECK-NEXT: ret i32 [[ADD]] ; %conv = zext i1 %a to i32 %conv3 = zext i1 %b to i32 %add = add nuw nsw i32 %conv3, %conv ret i32 %add } define i32 @PR30273_three_bools(i1 %x, i1 %y, i1 %z) { ; CHECK-LABEL: @PR30273_three_bools( ; CHECK-NEXT: [[FROMBOOL:%.*]] = zext i1 [[X:%.*]] to i32 ; CHECK-NEXT: [[ADD1:%.*]] = select i1 [[X]], i32 2, i32 1 ; CHECK-NEXT: [[SEL1:%.*]] = select i1 [[Y:%.*]], i32 [[ADD1]], i32 [[FROMBOOL]] ; CHECK-NEXT: [[ADD2:%.*]] = zext i1 [[Z:%.*]] to i32 ; CHECK-NEXT: [[SEL2:%.*]] = add nuw nsw i32 [[SEL1]], [[ADD2]] ; CHECK-NEXT: ret i32 [[SEL2]] ; %frombool = zext i1 %x to i32 %add1 = add nsw i32 %frombool, 1 %sel1 = select i1 %y, i32 %add1, i32 %frombool %add2 = add nsw i32 %sel1, 1 %sel2 = select i1 %z, i32 %add2, i32 %sel1 ret i32 %sel2 } define i32 @zext_add_scalar(i1 %x) { ; CHECK-LABEL: @zext_add_scalar( ; CHECK-NEXT: [[ADD:%.*]] = select i1 [[X:%.*]], i32 43, i32 42 ; CHECK-NEXT: ret i32 [[ADD]] ; %zext = zext i1 %x to i32 %add = add i32 %zext, 42 ret i32 %add } define <2 x i32> @zext_add_vec_splat(<2 x i1> %x) { ; CHECK-LABEL: @zext_add_vec_splat( ; CHECK-NEXT: [[ADD:%.*]] = select <2 x i1> [[X:%.*]], <2 x i32> <i32 43, i32 43>, <2 x i32> <i32 42, i32 42> ; CHECK-NEXT: ret <2 x i32> [[ADD]] ; %zext = zext <2 x i1> %x to <2 x i32> %add = add <2 x i32> %zext, <i32 42, i32 42> ret <2 x i32> %add } define <2 x i32> @zext_add_vec(<2 x i1> %x) { ; CHECK-LABEL: @zext_add_vec( ; CHECK-NEXT: [[ADD:%.*]] = select <2 x i1> [[X:%.*]], <2 x i32> <i32 43, i32 24>, <2 x i32> <i32 42, i32 23> ; CHECK-NEXT: ret <2 x i32> [[ADD]] ; %zext = zext <2 x i1> %x to <2 x i32> %add = add <2 x i32> %zext, <i32 42, i32 23> ret <2 x i32> %add } declare void @use(i64) define i64 @zext_negate(i1 %A) { ; CHECK-LABEL: @zext_negate( ; CHECK-NEXT: [[SUB:%.*]] = sext i1 [[A:%.*]] to i64 ; CHECK-NEXT: ret i64 [[SUB]] ; %ext = zext i1 %A to i64 %sub = sub i64 0, %ext ret i64 %sub } define i64 @zext_negate_extra_use(i1 %A) { ; CHECK-LABEL: @zext_negate_extra_use( ; CHECK-NEXT: [[EXT:%.*]] = zext i1 [[A:%.*]] to i64 ; CHECK-NEXT: [[SUB:%.*]] = sext i1 [[A]] to i64 ; CHECK-NEXT: call void @use(i64 [[EXT]]) ; CHECK-NEXT: ret i64 [[SUB]] ; %ext = zext i1 %A to i64 %sub = sub i64 0, %ext call void @use(i64 %ext) ret i64 %sub } define <2 x i64> @zext_negate_vec(<2 x i1> %A) { ; CHECK-LABEL: @zext_negate_vec( ; CHECK-NEXT: [[SUB:%.*]] = sext <2 x i1> [[A:%.*]] to <2 x i64> ; CHECK-NEXT: ret <2 x i64> [[SUB]] ; %ext = zext <2 x i1> %A to <2 x i64> %sub = sub <2 x i64> zeroinitializer, %ext ret <2 x i64> %sub } define <2 x i64> @zext_negate_vec_undef_elt(<2 x i1> %A) { ; CHECK-LABEL: @zext_negate_vec_undef_elt( ; CHECK-NEXT: [[SUB:%.*]] = sext <2 x i1> [[A:%.*]] to <2 x i64> ; CHECK-NEXT: ret <2 x i64> [[SUB]] ; %ext = zext <2 x i1> %A to <2 x i64> %sub = sub <2 x i64> <i64 0, i64 undef>, %ext ret <2 x i64> %sub } define i64 @zext_sub_const(i1 %A) { ; CHECK-LABEL: @zext_sub_const( ; CHECK-NEXT: [[SUB:%.*]] = select i1 [[A:%.*]], i64 41, i64 42 ; CHECK-NEXT: ret i64 [[SUB]] ; %ext = zext i1 %A to i64 %sub = sub i64 42, %ext ret i64 %sub } define i64 @zext_sub_const_extra_use(i1 %A) { ; CHECK-LABEL: @zext_sub_const_extra_use( ; CHECK-NEXT: [[EXT:%.*]] = zext i1 [[A:%.*]] to i64 ; CHECK-NEXT: [[SUB:%.*]] = select i1 [[A]], i64 41, i64 42 ; CHECK-NEXT: call void @use(i64 [[EXT]]) ; CHECK-NEXT: ret i64 [[SUB]] ; %ext = zext i1 %A to i64 %sub = sub i64 42, %ext call void @use(i64 %ext) ret i64 %sub } define <2 x i64> @zext_sub_const_vec(<2 x i1> %A) { ; CHECK-LABEL: @zext_sub_const_vec( ; CHECK-NEXT: [[SUB:%.*]] = select <2 x i1> [[A:%.*]], <2 x i64> <i64 41, i64 2>, <2 x i64> <i64 42, i64 3> ; CHECK-NEXT: ret <2 x i64> [[SUB]] ; %ext = zext <2 x i1> %A to <2 x i64> %sub = sub <2 x i64> <i64 42, i64 3>, %ext ret <2 x i64> %sub } define <2 x i64> @zext_sub_const_vec_undef_elt(<2 x i1> %A) { ; CHECK-LABEL: @zext_sub_const_vec_undef_elt( ; CHECK-NEXT: [[SUB:%.*]] = select <2 x i1> [[A:%.*]], <2 x i64> <i64 41, i64 undef>, <2 x i64> <i64 42, i64 undef> ; CHECK-NEXT: ret <2 x i64> [[SUB]] ; %ext = zext <2 x i1> %A to <2 x i64> %sub = sub <2 x i64> <i64 42, i64 undef>, %ext ret <2 x i64> %sub } define i64 @sext_negate(i1 %A) { ; CHECK-LABEL: @sext_negate( ; CHECK-NEXT: [[SUB:%.*]] = zext i1 [[A:%.*]] to i64 ; CHECK-NEXT: ret i64 [[SUB]] ; %ext = sext i1 %A to i64 %sub = sub i64 0, %ext ret i64 %sub } define i64 @sext_negate_extra_use(i1 %A) { ; CHECK-LABEL: @sext_negate_extra_use( ; CHECK-NEXT: [[EXT:%.*]] = sext i1 [[A:%.*]] to i64 ; CHECK-NEXT: [[SUB:%.*]] = zext i1 [[A]] to i64 ; CHECK-NEXT: call void @use(i64 [[EXT]]) ; CHECK-NEXT: ret i64 [[SUB]] ; %ext = sext i1 %A to i64 %sub = sub i64 0, %ext call void @use(i64 %ext) ret i64 %sub } define <2 x i64> @sext_negate_vec(<2 x i1> %A) { ; CHECK-LABEL: @sext_negate_vec( ; CHECK-NEXT: [[SUB:%.*]] = zext <2 x i1> [[A:%.*]] to <2 x i64> ; CHECK-NEXT: ret <2 x i64> [[SUB]] ; %ext = sext <2 x i1> %A to <2 x i64> %sub = sub <2 x i64> zeroinitializer, %ext ret <2 x i64> %sub } define <2 x i64> @sext_negate_vec_undef_elt(<2 x i1> %A) { ; CHECK-LABEL: @sext_negate_vec_undef_elt( ; CHECK-NEXT: [[SUB:%.*]] = zext <2 x i1> [[A:%.*]] to <2 x i64> ; CHECK-NEXT: ret <2 x i64> [[SUB]] ; %ext = sext <2 x i1> %A to <2 x i64> %sub = sub <2 x i64> <i64 0, i64 undef>, %ext ret <2 x i64> %sub } define i64 @sext_sub_const(i1 %A) { ; CHECK-LABEL: @sext_sub_const( ; CHECK-NEXT: [[SUB:%.*]] = select i1 [[A:%.*]], i64 43, i64 42 ; CHECK-NEXT: ret i64 [[SUB]] ; %ext = sext i1 %A to i64 %sub = sub i64 42, %ext ret i64 %sub } define i64 @sext_sub_const_extra_use(i1 %A) { ; CHECK-LABEL: @sext_sub_const_extra_use( ; CHECK-NEXT: [[EXT:%.*]] = sext i1 [[A:%.*]] to i64 ; CHECK-NEXT: [[SUB:%.*]] = select i1 [[A]], i64 43, i64 42 ; CHECK-NEXT: call void @use(i64 [[EXT]]) ; CHECK-NEXT: ret i64 [[SUB]] ; %ext = sext i1 %A to i64 %sub = sub i64 42, %ext call void @use(i64 %ext) ret i64 %sub } define <2 x i64> @sext_sub_const_vec(<2 x i1> %A) { ; CHECK-LABEL: @sext_sub_const_vec( ; CHECK-NEXT: [[SUB:%.*]] = select <2 x i1> [[A:%.*]], <2 x i64> <i64 43, i64 4>, <2 x i64> <i64 42, i64 3> ; CHECK-NEXT: ret <2 x i64> [[SUB]] ; %ext = sext <2 x i1> %A to <2 x i64> %sub = sub <2 x i64> <i64 42, i64 3>, %ext ret <2 x i64> %sub } define <2 x i64> @sext_sub_const_vec_undef_elt(<2 x i1> %A) { ; CHECK-LABEL: @sext_sub_const_vec_undef_elt( ; CHECK-NEXT: [[SUB:%.*]] = select <2 x i1> [[A:%.*]], <2 x i64> <i64 undef, i64 43>, <2 x i64> <i64 undef, i64 42> ; CHECK-NEXT: ret <2 x i64> [[SUB]] ; %ext = sext <2 x i1> %A to <2 x i64> %sub = sub <2 x i64> <i64 undef, i64 42>, %ext ret <2 x i64> %sub } define i8 @sext_sub(i8 %x, i1 %y) { ; CHECK-LABEL: @sext_sub( ; CHECK-NEXT: [[TMP1:%.*]] = zext i1 [[Y:%.*]] to i8 ; CHECK-NEXT: [[SUB:%.*]] = add i8 [[TMP1]], [[X:%.*]] ; CHECK-NEXT: ret i8 [[SUB]] ; %sext = sext i1 %y to i8 %sub = sub i8 %x, %sext ret i8 %sub } ; Vectors get the same transform. define <2 x i8> @sext_sub_vec(<2 x i8> %x, <2 x i1> %y) { ; CHECK-LABEL: @sext_sub_vec( ; CHECK-NEXT: [[TMP1:%.*]] = zext <2 x i1> [[Y:%.*]] to <2 x i8> ; CHECK-NEXT: [[SUB:%.*]] = add <2 x i8> [[TMP1]], [[X:%.*]] ; CHECK-NEXT: ret <2 x i8> [[SUB]] ; %sext = sext <2 x i1> %y to <2 x i8> %sub = sub <2 x i8> %x, %sext ret <2 x i8> %sub } ; NSW is preserved. define <2 x i8> @sext_sub_vec_nsw(<2 x i8> %x, <2 x i1> %y) { ; CHECK-LABEL: @sext_sub_vec_nsw( ; CHECK-NEXT: [[TMP1:%.*]] = zext <2 x i1> [[Y:%.*]] to <2 x i8> ; CHECK-NEXT: [[SUB:%.*]] = add nsw <2 x i8> [[TMP1]], [[X:%.*]] ; CHECK-NEXT: ret <2 x i8> [[SUB]] ; %sext = sext <2 x i1> %y to <2 x i8> %sub = sub nsw <2 x i8> %x, %sext ret <2 x i8> %sub } ; We favor the canonical zext+add over keeping the NUW. define i8 @sext_sub_nuw(i8 %x, i1 %y) { ; CHECK-LABEL: @sext_sub_nuw( ; CHECK-NEXT: [[TMP1:%.*]] = zext i1 [[Y:%.*]] to i8 ; CHECK-NEXT: [[SUB:%.*]] = add i8 [[TMP1]], [[X:%.*]] ; CHECK-NEXT: ret i8 [[SUB]] ; %sext = sext i1 %y to i8 %sub = sub nuw i8 %x, %sext ret i8 %sub } define i32 @sextbool_add(i1 %c, i32 %x) { ; CHECK-LABEL: @sextbool_add( ; CHECK-NEXT: [[TMP1:%.*]] = zext i1 [[C:%.*]] to i32 ; CHECK-NEXT: [[S:%.*]] = sub i32 [[X:%.*]], [[TMP1]] ; CHECK-NEXT: ret i32 [[S]] ; %b = sext i1 %c to i32 %s = add i32 %b, %x ret i32 %s } define i32 @sextbool_add_commute(i1 %c, i32 %px) { ; CHECK-LABEL: @sextbool_add_commute( ; CHECK-NEXT: [[X:%.*]] = urem i32 [[PX:%.*]], 42 ; CHECK-NEXT: [[TMP1:%.*]] = zext i1 [[C:%.*]] to i32 ; CHECK-NEXT: [[S:%.*]] = sub nsw i32 [[X]], [[TMP1]] ; CHECK-NEXT: ret i32 [[S]] ; %x = urem i32 %px, 42 ; thwart complexity-based canonicalization %b = sext i1 %c to i32 %s = add i32 %x, %b ret i32 %s } ; Negative test - extra use prevents canonicalization. declare void @use32(i32) define i32 @sextbool_add_uses(i1 %c, i32 %x) { ; CHECK-LABEL: @sextbool_add_uses( ; CHECK-NEXT: [[B:%.*]] = sext i1 [[C:%.*]] to i32 ; CHECK-NEXT: call void @use32(i32 [[B]]) ; CHECK-NEXT: [[S:%.*]] = add i32 [[B]], [[X:%.*]] ; CHECK-NEXT: ret i32 [[S]] ; %b = sext i1 %c to i32 call void @use32(i32 %b) %s = add i32 %b, %x ret i32 %s } define <4 x i32> @sextbool_add_vector(<4 x i1> %c, <4 x i32> %x) { ; CHECK-LABEL: @sextbool_add_vector( ; CHECK-NEXT: [[TMP1:%.*]] = zext <4 x i1> [[C:%.*]] to <4 x i32> ; CHECK-NEXT: [[S:%.*]] = sub <4 x i32> [[X:%.*]], [[TMP1]] ; CHECK-NEXT: ret <4 x i32> [[S]] ; %b = sext <4 x i1> %c to <4 x i32> %s = add <4 x i32> %x, %b ret <4 x i32> %s } define i32 @zextbool_sub(i1 %c, i32 %x) { ; CHECK-LABEL: @zextbool_sub( ; CHECK-NEXT: [[B:%.*]] = zext i1 [[C:%.*]] to i32 ; CHECK-NEXT: [[S:%.*]] = sub i32 [[B]], [[X:%.*]] ; CHECK-NEXT: ret i32 [[S]] ; %b = zext i1 %c to i32 %s = sub i32 %b, %x ret i32 %s } define i32 @zextbool_sub_uses(i1 %c, i32 %x) { ; CHECK-LABEL: @zextbool_sub_uses( ; CHECK-NEXT: [[B:%.*]] = zext i1 [[C:%.*]] to i32 ; CHECK-NEXT: call void @use32(i32 [[B]]) ; CHECK-NEXT: [[S:%.*]] = sub i32 [[X:%.*]], [[B]] ; CHECK-NEXT: ret i32 [[S]] ; %b = zext i1 %c to i32 call void @use32(i32 %b) %s = sub i32 %x, %b ret i32 %s } define <4 x i32> @zextbool_sub_vector(<4 x i1> %c, <4 x i32> %x) { ; CHECK-LABEL: @zextbool_sub_vector( ; CHECK-NEXT: [[B:%.*]] = zext <4 x i1> [[C:%.*]] to <4 x i32> ; CHECK-NEXT: [[S:%.*]] = sub <4 x i32> [[X:%.*]], [[B]] ; CHECK-NEXT: ret <4 x i32> [[S]] ; %b = zext <4 x i1> %c to <4 x i32> %s = sub <4 x i32> %x, %b ret <4 x i32> %s }
{ "pile_set_name": "Github" }
FROM ubuntu:20.04 RUN dpkg --add-architecture i386 RUN apt-get update RUN apt-get install -y --no-install-recommends \ gcc-multilib make libc6-dev git curl ca-certificates libc6:i386 COPY install-musl.sh / RUN sh /install-musl.sh i686 ENV PATH=$PATH:/musl-i686/bin:/rust/bin \ CC_i686_unknown_linux_musl=musl-gcc
{ "pile_set_name": "Github" }
#include <ctype.h> #include <errno.h> #include <limits.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/vfs.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <sys/mount.h> #include "fs.h" #include "debug-internal.h" #define _STR(x) #x #define STR(x) _STR(x) #ifndef SYSFS_MAGIC #define SYSFS_MAGIC 0x62656572 #endif #ifndef PROC_SUPER_MAGIC #define PROC_SUPER_MAGIC 0x9fa0 #endif #ifndef DEBUGFS_MAGIC #define DEBUGFS_MAGIC 0x64626720 #endif #ifndef TRACEFS_MAGIC #define TRACEFS_MAGIC 0x74726163 #endif #ifndef HUGETLBFS_MAGIC #define HUGETLBFS_MAGIC 0x958458f6 #endif #ifndef BPF_FS_MAGIC #define BPF_FS_MAGIC 0xcafe4a11 #endif static const char * const sysfs__fs_known_mountpoints[] = { "/sys", 0, }; static const char * const procfs__known_mountpoints[] = { "/proc", 0, }; #ifndef DEBUGFS_DEFAULT_PATH #define DEBUGFS_DEFAULT_PATH "/sys/kernel/debug" #endif static const char * const debugfs__known_mountpoints[] = { DEBUGFS_DEFAULT_PATH, "/debug", 0, }; #ifndef TRACEFS_DEFAULT_PATH #define TRACEFS_DEFAULT_PATH "/sys/kernel/tracing" #endif static const char * const tracefs__known_mountpoints[] = { TRACEFS_DEFAULT_PATH, "/sys/kernel/debug/tracing", "/tracing", "/trace", 0, }; static const char * const hugetlbfs__known_mountpoints[] = { 0, }; static const char * const bpf_fs__known_mountpoints[] = { "/sys/fs/bpf", 0, }; struct fs { const char *name; const char * const *mounts; char path[PATH_MAX]; bool found; long magic; }; enum { FS__SYSFS = 0, FS__PROCFS = 1, FS__DEBUGFS = 2, FS__TRACEFS = 3, FS__HUGETLBFS = 4, FS__BPF_FS = 5, }; #ifndef TRACEFS_MAGIC #define TRACEFS_MAGIC 0x74726163 #endif static struct fs fs__entries[] = { [FS__SYSFS] = { .name = "sysfs", .mounts = sysfs__fs_known_mountpoints, .magic = SYSFS_MAGIC, }, [FS__PROCFS] = { .name = "proc", .mounts = procfs__known_mountpoints, .magic = PROC_SUPER_MAGIC, }, [FS__DEBUGFS] = { .name = "debugfs", .mounts = debugfs__known_mountpoints, .magic = DEBUGFS_MAGIC, }, [FS__TRACEFS] = { .name = "tracefs", .mounts = tracefs__known_mountpoints, .magic = TRACEFS_MAGIC, }, [FS__HUGETLBFS] = { .name = "hugetlbfs", .mounts = hugetlbfs__known_mountpoints, .magic = HUGETLBFS_MAGIC, }, [FS__BPF_FS] = { .name = "bpf", .mounts = bpf_fs__known_mountpoints, .magic = BPF_FS_MAGIC, }, }; static bool fs__read_mounts(struct fs *fs) { bool found = false; char type[100]; FILE *fp; fp = fopen("/proc/mounts", "r"); if (fp == NULL) return NULL; while (!found && fscanf(fp, "%*s %" STR(PATH_MAX) "s %99s %*s %*d %*d\n", fs->path, type) == 2) { if (strcmp(type, fs->name) == 0) found = true; } fclose(fp); return fs->found = found; } static int fs__valid_mount(const char *fs, long magic) { struct statfs st_fs; if (statfs(fs, &st_fs) < 0) return -ENOENT; else if ((long)st_fs.f_type != magic) return -ENOENT; return 0; } static bool fs__check_mounts(struct fs *fs) { const char * const *ptr; ptr = fs->mounts; while (*ptr) { if (fs__valid_mount(*ptr, fs->magic) == 0) { fs->found = true; strcpy(fs->path, *ptr); return true; } ptr++; } return false; } static void mem_toupper(char *f, size_t len) { while (len) { *f = toupper(*f); f++; len--; } } /* * Check for "NAME_PATH" environment variable to override fs location (for * testing). This matches the recommendation in Documentation/sysfs-rules.txt * for SYSFS_PATH. */ static bool fs__env_override(struct fs *fs) { char *override_path; size_t name_len = strlen(fs->name); /* name + "_PATH" + '\0' */ char upper_name[name_len + 5 + 1]; memcpy(upper_name, fs->name, name_len); mem_toupper(upper_name, name_len); strcpy(&upper_name[name_len], "_PATH"); override_path = getenv(upper_name); if (!override_path) return false; fs->found = true; strncpy(fs->path, override_path, sizeof(fs->path)); return true; } static const char *fs__get_mountpoint(struct fs *fs) { if (fs__env_override(fs)) return fs->path; if (fs__check_mounts(fs)) return fs->path; if (fs__read_mounts(fs)) return fs->path; return NULL; } static const char *fs__mountpoint(int idx) { struct fs *fs = &fs__entries[idx]; if (fs->found) return (const char *)fs->path; return fs__get_mountpoint(fs); } static const char *mount_overload(struct fs *fs) { size_t name_len = strlen(fs->name); /* "PERF_" + name + "_ENVIRONMENT" + '\0' */ char upper_name[5 + name_len + 12 + 1]; snprintf(upper_name, name_len, "PERF_%s_ENVIRONMENT", fs->name); mem_toupper(upper_name, name_len); return getenv(upper_name) ?: *fs->mounts; } static const char *fs__mount(int idx) { struct fs *fs = &fs__entries[idx]; const char *mountpoint; if (fs__mountpoint(idx)) return (const char *)fs->path; mountpoint = mount_overload(fs); if (mount(NULL, mountpoint, fs->name, 0, NULL) < 0) return NULL; return fs__check_mounts(fs) ? fs->path : NULL; } #define FS(name, idx) \ const char *name##__mountpoint(void) \ { \ return fs__mountpoint(idx); \ } \ \ const char *name##__mount(void) \ { \ return fs__mount(idx); \ } \ \ bool name##__configured(void) \ { \ return name##__mountpoint() != NULL; \ } FS(sysfs, FS__SYSFS); FS(procfs, FS__PROCFS); FS(debugfs, FS__DEBUGFS); FS(tracefs, FS__TRACEFS); FS(hugetlbfs, FS__HUGETLBFS); FS(bpf_fs, FS__BPF_FS); int filename__read_int(const char *filename, int *value) { char line[64]; int fd = open(filename, O_RDONLY), err = -1; if (fd < 0) return -1; if (read(fd, line, sizeof(line)) > 0) { *value = atoi(line); err = 0; } close(fd); return err; } /* * Parses @value out of @filename with strtoull. * By using 0 for base, the strtoull detects the * base automatically (see man strtoull). */ int filename__read_ull(const char *filename, unsigned long long *value) { char line[64]; int fd = open(filename, O_RDONLY), err = -1; if (fd < 0) return -1; if (read(fd, line, sizeof(line)) > 0) { *value = strtoull(line, NULL, 0); if (*value != ULLONG_MAX) err = 0; } close(fd); return err; } #define STRERR_BUFSIZE 128 /* For the buffer size of strerror_r */ int filename__read_str(const char *filename, char **buf, size_t *sizep) { size_t size = 0, alloc_size = 0; void *bf = NULL, *nbf; int fd, n, err = 0; char sbuf[STRERR_BUFSIZE]; fd = open(filename, O_RDONLY); if (fd < 0) return -errno; do { if (size == alloc_size) { alloc_size += BUFSIZ; nbf = realloc(bf, alloc_size); if (!nbf) { err = -ENOMEM; break; } bf = nbf; } n = read(fd, bf + size, alloc_size - size); if (n < 0) { if (size) { pr_warning("read failed %d: %s\n", errno, strerror_r(errno, sbuf, sizeof(sbuf))); err = 0; } else err = -errno; break; } size += n; } while (n > 0); if (!err) { *sizep = size; *buf = bf; } else free(bf); close(fd); return err; } int procfs__read_str(const char *entry, char **buf, size_t *sizep) { char path[PATH_MAX]; const char *procfs = procfs__mountpoint(); if (!procfs) return -1; snprintf(path, sizeof(path), "%s/%s", procfs, entry); return filename__read_str(path, buf, sizep); } int sysfs__read_ull(const char *entry, unsigned long long *value) { char path[PATH_MAX]; const char *sysfs = sysfs__mountpoint(); if (!sysfs) return -1; snprintf(path, sizeof(path), "%s/%s", sysfs, entry); return filename__read_ull(path, value); } int sysfs__read_int(const char *entry, int *value) { char path[PATH_MAX]; const char *sysfs = sysfs__mountpoint(); if (!sysfs) return -1; snprintf(path, sizeof(path), "%s/%s", sysfs, entry); return filename__read_int(path, value); } int sysfs__read_str(const char *entry, char **buf, size_t *sizep) { char path[PATH_MAX]; const char *sysfs = sysfs__mountpoint(); if (!sysfs) return -1; snprintf(path, sizeof(path), "%s/%s", sysfs, entry); return filename__read_str(path, buf, sizep); } int sysctl__read_int(const char *sysctl, int *value) { char path[PATH_MAX]; const char *procfs = procfs__mountpoint(); if (!procfs) return -1; snprintf(path, sizeof(path), "%s/sys/%s", procfs, sysctl); return filename__read_int(path, value); }
{ "pile_set_name": "Github" }
/* * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. */ package org.hibernate.test.version.mappedsuperclass; /** * @author Andrea Boriero */ public class TestEntity extends AbstractEntity { String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Development</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{A0BA8205-F757-41C1-863D-47EB3F9BE9D3}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>Demo.Domain.Authentication</RootNamespace> <AssemblyName>Domain.Authentication</AssemblyName> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <TargetFrameworkProfile /> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Development|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Development\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Staging|AnyCPU'"> <OutputPath>bin\Staging\</OutputPath> <DefineConstants>TRACE</DefineConstants> <Optimize>true</Optimize> <DebugType>pdbonly</DebugType> <PlatformTarget>AnyCPU</PlatformTarget> <ErrorReport>prompt</ErrorReport> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Production|AnyCPU'"> <OutputPath>bin\Production\</OutputPath> <DefineConstants>TRACE</DefineConstants> <Optimize>true</Optimize> <DebugType>pdbonly</DebugType> <PlatformTarget>AnyCPU</PlatformTarget> <ErrorReport>prompt</ErrorReport> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemGroup> <Reference Include="Aggregates.NET, Version=0.3.0.517, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\..\packages\Aggregates.NET.0.3.0.517-beta\lib\net461\Aggregates.NET.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Aggregates.NET.Consumer, Version=0.3.0.517, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\..\packages\Aggregates.NET.Consumer.0.3.0.517-beta\lib\net461\Aggregates.NET.Consumer.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Aggregates.NET.Domain, Version=0.3.0.517, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\..\packages\Aggregates.NET.Domain.0.3.0.517-beta\lib\net461\Aggregates.NET.Domain.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="EventStore.ClientAPI, Version=3.9.2.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\..\packages\EventStore.Client.3.9.2\lib\net40\EventStore.ClientAPI.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Metrics, Version=0.3.7.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\..\packages\Metrics.NET.0.3.7\lib\net45\Metrics.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="NServiceBus.Callbacks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL"> <HintPath>..\..\packages\NServiceBus.Callbacks.1.0.0\lib\net452\NServiceBus.Callbacks.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="NServiceBus.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL"> <HintPath>..\..\packages\NServiceBus.6.0.0\lib\net452\NServiceBus.Core.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="System" /> <Reference Include="System.Core" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Users\Handler.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\Infrastructure\Library\Library.csproj"> <Project>{b209fcc1-8a94-42cb-9d26-bcb4ee991ffb}</Project> <Name>Library</Name> </ProjectReference> <ProjectReference Include="..\Domain.Authentication.Aggregates\Domain.Authentication.Aggregates.csproj"> <Project>{7726adc2-103d-4249-bf62-9650df467178}</Project> <Name>Domain.Authentication.Aggregates</Name> </ProjectReference> <ProjectReference Include="..\Domain.Authentication.Messages\Domain.Authentication.Messages.csproj"> <Project>{3c293825-daa0-4523-9109-cf717b0d9a00}</Project> <Name>Domain.Authentication.Messages</Name> </ProjectReference> </ItemGroup> <ItemGroup> <None Include="app.config" /> <None Include="packages.config" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>
{ "pile_set_name": "Github" }
/* * wm0010.c -- WM0010 DSP Driver * * Copyright 2012 Wolfson Microelectronics PLC. * * Authors: Mark Brown <[email protected]> * Dimitris Papastamos <[email protected]> * Scott Ling <[email protected]> * * 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. */ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/interrupt.h> #include <linux/irqreturn.h> #include <linux/init.h> #include <linux/spi/spi.h> #include <linux/firmware.h> #include <linux/delay.h> #include <linux/fs.h> #include <linux/miscdevice.h> #include <linux/gpio.h> #include <linux/regulator/consumer.h> #include <linux/mutex.h> #include <linux/workqueue.h> #include <sound/soc.h> #include <sound/wm0010.h> #define DEVICE_ID_WM0010 10 /* We only support v1 of the .dfw INFO record */ #define INFO_VERSION 1 enum dfw_cmd { DFW_CMD_FUSE = 0x01, DFW_CMD_CODE_HDR, DFW_CMD_CODE_DATA, DFW_CMD_PLL, DFW_CMD_INFO = 0xff }; struct dfw_binrec { u8 command; u32 length:24; u32 address; uint8_t data[0]; } __packed; struct dfw_inforec { u8 info_version; u8 tool_major_version; u8 tool_minor_version; u8 dsp_target; }; struct dfw_pllrec { u8 command; u32 length:24; u32 address; u32 clkctrl1; u32 clkctrl2; u32 clkctrl3; u32 ldetctrl; u32 uart_div; u32 spi_div; } __packed; static struct pll_clock_map { int max_sysclk; int max_pll_spi_speed; u32 pll_clkctrl1; } pll_clock_map[] = { /* Dividers */ { 22000000, 26000000, 0x00201f11 }, /* 2,32,2 */ { 18000000, 26000000, 0x00203f21 }, /* 2,64,4 */ { 14000000, 26000000, 0x00202620 }, /* 1,39,4 */ { 10000000, 22000000, 0x00203120 }, /* 1,50,4 */ { 6500000, 22000000, 0x00204520 }, /* 1,70,4 */ { 5500000, 22000000, 0x00103f10 }, /* 1,64,2 */ }; enum wm0010_state { WM0010_POWER_OFF, WM0010_OUT_OF_RESET, WM0010_BOOTROM, WM0010_STAGE2, WM0010_FIRMWARE, }; struct wm0010_priv { struct snd_soc_codec *codec; struct mutex lock; struct device *dev; struct wm0010_pdata pdata; int gpio_reset; int gpio_reset_value; struct regulator_bulk_data core_supplies[2]; struct regulator *dbvdd; int sysclk; enum wm0010_state state; bool boot_failed; bool ready; bool pll_running; int max_spi_freq; int board_max_spi_speed; u32 pll_clkctrl1; spinlock_t irq_lock; int irq; struct completion boot_completion; }; struct wm0010_spi_msg { struct spi_message m; struct spi_transfer t; u8 *tx_buf; u8 *rx_buf; size_t len; }; static const struct snd_soc_dapm_widget wm0010_dapm_widgets[] = { SND_SOC_DAPM_SUPPLY("CLKIN", SND_SOC_NOPM, 0, 0, NULL, 0), }; static const struct snd_soc_dapm_route wm0010_dapm_routes[] = { { "SDI2 Capture", NULL, "SDI1 Playback" }, { "SDI1 Capture", NULL, "SDI2 Playback" }, { "SDI1 Capture", NULL, "CLKIN" }, { "SDI2 Capture", NULL, "CLKIN" }, { "SDI1 Playback", NULL, "CLKIN" }, { "SDI2 Playback", NULL, "CLKIN" }, }; static const char *wm0010_state_to_str(enum wm0010_state state) { static const char * const state_to_str[] = { "Power off", "Out of reset", "Boot ROM", "Stage2", "Firmware" }; if (state < 0 || state >= ARRAY_SIZE(state_to_str)) return "null"; return state_to_str[state]; } /* Called with wm0010->lock held */ static void wm0010_halt(struct snd_soc_codec *codec) { struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec); unsigned long flags; enum wm0010_state state; /* Fetch the wm0010 state */ spin_lock_irqsave(&wm0010->irq_lock, flags); state = wm0010->state; spin_unlock_irqrestore(&wm0010->irq_lock, flags); switch (state) { case WM0010_POWER_OFF: /* If there's nothing to do, bail out */ return; case WM0010_OUT_OF_RESET: case WM0010_BOOTROM: case WM0010_STAGE2: case WM0010_FIRMWARE: /* Remember to put chip back into reset */ gpio_set_value_cansleep(wm0010->gpio_reset, wm0010->gpio_reset_value); /* Disable the regulators */ regulator_disable(wm0010->dbvdd); regulator_bulk_disable(ARRAY_SIZE(wm0010->core_supplies), wm0010->core_supplies); break; } spin_lock_irqsave(&wm0010->irq_lock, flags); wm0010->state = WM0010_POWER_OFF; spin_unlock_irqrestore(&wm0010->irq_lock, flags); } struct wm0010_boot_xfer { struct list_head list; struct snd_soc_codec *codec; struct completion *done; struct spi_message m; struct spi_transfer t; }; /* Called with wm0010->lock held */ static void wm0010_mark_boot_failure(struct wm0010_priv *wm0010) { enum wm0010_state state; unsigned long flags; spin_lock_irqsave(&wm0010->irq_lock, flags); state = wm0010->state; spin_unlock_irqrestore(&wm0010->irq_lock, flags); dev_err(wm0010->dev, "Failed to transition from `%s' state to `%s' state\n", wm0010_state_to_str(state), wm0010_state_to_str(state + 1)); wm0010->boot_failed = true; } static void wm0010_boot_xfer_complete(void *data) { struct wm0010_boot_xfer *xfer = data; struct snd_soc_codec *codec = xfer->codec; struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec); u32 *out32 = xfer->t.rx_buf; int i; if (xfer->m.status != 0) { dev_err(codec->dev, "SPI transfer failed: %d\n", xfer->m.status); wm0010_mark_boot_failure(wm0010); if (xfer->done) complete(xfer->done); return; } for (i = 0; i < xfer->t.len / 4; i++) { dev_dbg(codec->dev, "%d: %04x\n", i, out32[i]); switch (be32_to_cpu(out32[i])) { case 0xe0e0e0e0: dev_err(codec->dev, "%d: ROM error reported in stage 2\n", i); wm0010_mark_boot_failure(wm0010); break; case 0x55555555: if (wm0010->state < WM0010_STAGE2) break; dev_err(codec->dev, "%d: ROM bootloader running in stage 2\n", i); wm0010_mark_boot_failure(wm0010); break; case 0x0fed0000: dev_dbg(codec->dev, "Stage2 loader running\n"); break; case 0x0fed0007: dev_dbg(codec->dev, "CODE_HDR packet received\n"); break; case 0x0fed0008: dev_dbg(codec->dev, "CODE_DATA packet received\n"); break; case 0x0fed0009: dev_dbg(codec->dev, "Download complete\n"); break; case 0x0fed000c: dev_dbg(codec->dev, "Application start\n"); break; case 0x0fed000e: dev_dbg(codec->dev, "PLL packet received\n"); wm0010->pll_running = true; break; case 0x0fed0025: dev_err(codec->dev, "Device reports image too long\n"); wm0010_mark_boot_failure(wm0010); break; case 0x0fed002c: dev_err(codec->dev, "Device reports bad SPI packet\n"); wm0010_mark_boot_failure(wm0010); break; case 0x0fed0031: dev_err(codec->dev, "Device reports SPI read overflow\n"); wm0010_mark_boot_failure(wm0010); break; case 0x0fed0032: dev_err(codec->dev, "Device reports SPI underclock\n"); wm0010_mark_boot_failure(wm0010); break; case 0x0fed0033: dev_err(codec->dev, "Device reports bad header packet\n"); wm0010_mark_boot_failure(wm0010); break; case 0x0fed0034: dev_err(codec->dev, "Device reports invalid packet type\n"); wm0010_mark_boot_failure(wm0010); break; case 0x0fed0035: dev_err(codec->dev, "Device reports data before header error\n"); wm0010_mark_boot_failure(wm0010); break; case 0x0fed0038: dev_err(codec->dev, "Device reports invalid PLL packet\n"); break; case 0x0fed003a: dev_err(codec->dev, "Device reports packet alignment error\n"); wm0010_mark_boot_failure(wm0010); break; default: dev_err(codec->dev, "Unrecognised return 0x%x\n", be32_to_cpu(out32[i])); wm0010_mark_boot_failure(wm0010); break; } if (wm0010->boot_failed) break; } if (xfer->done) complete(xfer->done); } static void byte_swap_64(u64 *data_in, u64 *data_out, u32 len) { int i; for (i = 0; i < len / 8; i++) data_out[i] = cpu_to_be64(le64_to_cpu(data_in[i])); } static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec) { struct spi_device *spi = to_spi_device(codec->dev); struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec); struct list_head xfer_list; struct wm0010_boot_xfer *xfer; int ret; struct completion done; const struct firmware *fw; const struct dfw_binrec *rec; const struct dfw_inforec *inforec; u64 *img; u8 *out, dsp; u32 len, offset; INIT_LIST_HEAD(&xfer_list); ret = request_firmware(&fw, name, codec->dev); if (ret != 0) { dev_err(codec->dev, "Failed to request application(%s): %d\n", name, ret); return ret; } rec = (const struct dfw_binrec *)fw->data; inforec = (const struct dfw_inforec *)rec->data; offset = 0; dsp = inforec->dsp_target; wm0010->boot_failed = false; if (WARN_ON(!list_empty(&xfer_list))) return -EINVAL; init_completion(&done); /* First record should be INFO */ if (rec->command != DFW_CMD_INFO) { dev_err(codec->dev, "First record not INFO\r\n"); ret = -EINVAL; goto abort; } if (inforec->info_version != INFO_VERSION) { dev_err(codec->dev, "Unsupported version (%02d) of INFO record\r\n", inforec->info_version); ret = -EINVAL; goto abort; } dev_dbg(codec->dev, "Version v%02d INFO record found\r\n", inforec->info_version); /* Check it's a DSP file */ if (dsp != DEVICE_ID_WM0010) { dev_err(codec->dev, "Not a WM0010 firmware file.\r\n"); ret = -EINVAL; goto abort; } /* Skip the info record as we don't need to send it */ offset += ((rec->length) + 8); rec = (void *)&rec->data[rec->length]; while (offset < fw->size) { dev_dbg(codec->dev, "Packet: command %d, data length = 0x%x\r\n", rec->command, rec->length); len = rec->length + 8; xfer = kzalloc(sizeof(*xfer), GFP_KERNEL); if (!xfer) { ret = -ENOMEM; goto abort; } xfer->codec = codec; list_add_tail(&xfer->list, &xfer_list); out = kzalloc(len, GFP_KERNEL | GFP_DMA); if (!out) { ret = -ENOMEM; goto abort1; } xfer->t.rx_buf = out; img = kzalloc(len, GFP_KERNEL | GFP_DMA); if (!img) { ret = -ENOMEM; goto abort1; } xfer->t.tx_buf = img; byte_swap_64((u64 *)&rec->command, img, len); spi_message_init(&xfer->m); xfer->m.complete = wm0010_boot_xfer_complete; xfer->m.context = xfer; xfer->t.len = len; xfer->t.bits_per_word = 8; if (!wm0010->pll_running) { xfer->t.speed_hz = wm0010->sysclk / 6; } else { xfer->t.speed_hz = wm0010->max_spi_freq; if (wm0010->board_max_spi_speed && (wm0010->board_max_spi_speed < wm0010->max_spi_freq)) xfer->t.speed_hz = wm0010->board_max_spi_speed; } /* Store max usable spi frequency for later use */ wm0010->max_spi_freq = xfer->t.speed_hz; spi_message_add_tail(&xfer->t, &xfer->m); offset += ((rec->length) + 8); rec = (void *)&rec->data[rec->length]; if (offset >= fw->size) { dev_dbg(codec->dev, "All transfers scheduled\n"); xfer->done = &done; } ret = spi_async(spi, &xfer->m); if (ret != 0) { dev_err(codec->dev, "Write failed: %d\n", ret); goto abort1; } if (wm0010->boot_failed) { dev_dbg(codec->dev, "Boot fail!\n"); ret = -EINVAL; goto abort1; } } wait_for_completion(&done); ret = 0; abort1: while (!list_empty(&xfer_list)) { xfer = list_first_entry(&xfer_list, struct wm0010_boot_xfer, list); kfree(xfer->t.rx_buf); kfree(xfer->t.tx_buf); list_del(&xfer->list); kfree(xfer); } abort: release_firmware(fw); return ret; } static int wm0010_stage2_load(struct snd_soc_codec *codec) { struct spi_device *spi = to_spi_device(codec->dev); struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec); const struct firmware *fw; struct spi_message m; struct spi_transfer t; u32 *img; u8 *out; int i; int ret = 0; ret = request_firmware(&fw, "wm0010_stage2.bin", codec->dev); if (ret != 0) { dev_err(codec->dev, "Failed to request stage2 loader: %d\n", ret); return ret; } dev_dbg(codec->dev, "Downloading %zu byte stage 2 loader\n", fw->size); /* Copy to local buffer first as vmalloc causes problems for dma */ img = kzalloc(fw->size, GFP_KERNEL | GFP_DMA); if (!img) { ret = -ENOMEM; goto abort2; } out = kzalloc(fw->size, GFP_KERNEL | GFP_DMA); if (!out) { ret = -ENOMEM; goto abort1; } memcpy(img, &fw->data[0], fw->size); spi_message_init(&m); memset(&t, 0, sizeof(t)); t.rx_buf = out; t.tx_buf = img; t.len = fw->size; t.bits_per_word = 8; t.speed_hz = wm0010->sysclk / 10; spi_message_add_tail(&t, &m); dev_dbg(codec->dev, "Starting initial download at %dHz\n", t.speed_hz); ret = spi_sync(spi, &m); if (ret != 0) { dev_err(codec->dev, "Initial download failed: %d\n", ret); goto abort; } /* Look for errors from the boot ROM */ for (i = 0; i < fw->size; i++) { if (out[i] != 0x55) { dev_err(codec->dev, "Boot ROM error: %x in %d\n", out[i], i); wm0010_mark_boot_failure(wm0010); ret = -EBUSY; goto abort; } } abort: kfree(out); abort1: kfree(img); abort2: release_firmware(fw); return ret; } static int wm0010_boot(struct snd_soc_codec *codec) { struct spi_device *spi = to_spi_device(codec->dev); struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec); unsigned long flags; int ret; struct spi_message m; struct spi_transfer t; struct dfw_pllrec pll_rec; u32 *p, len; u64 *img_swap; u8 *out; int i; spin_lock_irqsave(&wm0010->irq_lock, flags); if (wm0010->state != WM0010_POWER_OFF) dev_warn(wm0010->dev, "DSP already powered up!\n"); spin_unlock_irqrestore(&wm0010->irq_lock, flags); if (wm0010->sysclk > 26000000) { dev_err(codec->dev, "Max DSP clock frequency is 26MHz\n"); ret = -ECANCELED; goto err; } mutex_lock(&wm0010->lock); wm0010->pll_running = false; dev_dbg(codec->dev, "max_spi_freq: %d\n", wm0010->max_spi_freq); ret = regulator_bulk_enable(ARRAY_SIZE(wm0010->core_supplies), wm0010->core_supplies); if (ret != 0) { dev_err(&spi->dev, "Failed to enable core supplies: %d\n", ret); mutex_unlock(&wm0010->lock); goto err; } ret = regulator_enable(wm0010->dbvdd); if (ret != 0) { dev_err(&spi->dev, "Failed to enable DBVDD: %d\n", ret); goto err_core; } /* Release reset */ gpio_set_value_cansleep(wm0010->gpio_reset, !wm0010->gpio_reset_value); spin_lock_irqsave(&wm0010->irq_lock, flags); wm0010->state = WM0010_OUT_OF_RESET; spin_unlock_irqrestore(&wm0010->irq_lock, flags); if (!wait_for_completion_timeout(&wm0010->boot_completion, msecs_to_jiffies(20))) dev_err(codec->dev, "Failed to get interrupt from DSP\n"); spin_lock_irqsave(&wm0010->irq_lock, flags); wm0010->state = WM0010_BOOTROM; spin_unlock_irqrestore(&wm0010->irq_lock, flags); ret = wm0010_stage2_load(codec); if (ret) goto abort; if (!wait_for_completion_timeout(&wm0010->boot_completion, msecs_to_jiffies(20))) dev_err(codec->dev, "Failed to get interrupt from DSP loader.\n"); spin_lock_irqsave(&wm0010->irq_lock, flags); wm0010->state = WM0010_STAGE2; spin_unlock_irqrestore(&wm0010->irq_lock, flags); /* Only initialise PLL if max_spi_freq initialised */ if (wm0010->max_spi_freq) { /* Initialise a PLL record */ memset(&pll_rec, 0, sizeof(pll_rec)); pll_rec.command = DFW_CMD_PLL; pll_rec.length = (sizeof(pll_rec) - 8); /* On wm0010 only the CLKCTRL1 value is used */ pll_rec.clkctrl1 = wm0010->pll_clkctrl1; ret = -ENOMEM; len = pll_rec.length + 8; out = kzalloc(len, GFP_KERNEL | GFP_DMA); if (!out) { dev_err(codec->dev, "Failed to allocate RX buffer\n"); goto abort; } img_swap = kzalloc(len, GFP_KERNEL | GFP_DMA); if (!img_swap) goto abort_out; /* We need to re-order for 0010 */ byte_swap_64((u64 *)&pll_rec, img_swap, len); spi_message_init(&m); memset(&t, 0, sizeof(t)); t.rx_buf = out; t.tx_buf = img_swap; t.len = len; t.bits_per_word = 8; t.speed_hz = wm0010->sysclk / 6; spi_message_add_tail(&t, &m); ret = spi_sync(spi, &m); if (ret) { dev_err(codec->dev, "First PLL write failed: %d\n", ret); goto abort_swap; } /* Use a second send of the message to get the return status */ ret = spi_sync(spi, &m); if (ret) { dev_err(codec->dev, "Second PLL write failed: %d\n", ret); goto abort_swap; } p = (u32 *)out; /* Look for PLL active code from the DSP */ for (i = 0; i < len / 4; i++) { if (*p == 0x0e00ed0f) { dev_dbg(codec->dev, "PLL packet received\n"); wm0010->pll_running = true; break; } p++; } kfree(img_swap); kfree(out); } else dev_dbg(codec->dev, "Not enabling DSP PLL."); ret = wm0010_firmware_load("wm0010.dfw", codec); if (ret != 0) goto abort; spin_lock_irqsave(&wm0010->irq_lock, flags); wm0010->state = WM0010_FIRMWARE; spin_unlock_irqrestore(&wm0010->irq_lock, flags); mutex_unlock(&wm0010->lock); return 0; abort_swap: kfree(img_swap); abort_out: kfree(out); abort: /* Put the chip back into reset */ wm0010_halt(codec); mutex_unlock(&wm0010->lock); return ret; err_core: mutex_unlock(&wm0010->lock); regulator_bulk_disable(ARRAY_SIZE(wm0010->core_supplies), wm0010->core_supplies); err: return ret; } static int wm0010_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec); switch (level) { case SND_SOC_BIAS_ON: if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE) wm0010_boot(codec); break; case SND_SOC_BIAS_PREPARE: break; case SND_SOC_BIAS_STANDBY: if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE) { mutex_lock(&wm0010->lock); wm0010_halt(codec); mutex_unlock(&wm0010->lock); } break; case SND_SOC_BIAS_OFF: break; } return 0; } static int wm0010_set_sysclk(struct snd_soc_codec *codec, int source, int clk_id, unsigned int freq, int dir) { struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec); unsigned int i; wm0010->sysclk = freq; if (freq < pll_clock_map[ARRAY_SIZE(pll_clock_map)-1].max_sysclk) { wm0010->max_spi_freq = 0; } else { for (i = 0; i < ARRAY_SIZE(pll_clock_map); i++) if (freq >= pll_clock_map[i].max_sysclk) { wm0010->max_spi_freq = pll_clock_map[i].max_pll_spi_speed; wm0010->pll_clkctrl1 = pll_clock_map[i].pll_clkctrl1; break; } } return 0; } static int wm0010_probe(struct snd_soc_codec *codec); static struct snd_soc_codec_driver soc_codec_dev_wm0010 = { .probe = wm0010_probe, .set_bias_level = wm0010_set_bias_level, .set_sysclk = wm0010_set_sysclk, .idle_bias_off = true, .dapm_widgets = wm0010_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(wm0010_dapm_widgets), .dapm_routes = wm0010_dapm_routes, .num_dapm_routes = ARRAY_SIZE(wm0010_dapm_routes), }; #define WM0010_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000) #define WM0010_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |\ SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE |\ SNDRV_PCM_FMTBIT_S32_LE) static struct snd_soc_dai_driver wm0010_dai[] = { { .name = "wm0010-sdi1", .playback = { .stream_name = "SDI1 Playback", .channels_min = 1, .channels_max = 2, .rates = WM0010_RATES, .formats = WM0010_FORMATS, }, .capture = { .stream_name = "SDI1 Capture", .channels_min = 1, .channels_max = 2, .rates = WM0010_RATES, .formats = WM0010_FORMATS, }, }, { .name = "wm0010-sdi2", .playback = { .stream_name = "SDI2 Playback", .channels_min = 1, .channels_max = 2, .rates = WM0010_RATES, .formats = WM0010_FORMATS, }, .capture = { .stream_name = "SDI2 Capture", .channels_min = 1, .channels_max = 2, .rates = WM0010_RATES, .formats = WM0010_FORMATS, }, }, }; static irqreturn_t wm0010_irq(int irq, void *data) { struct wm0010_priv *wm0010 = data; switch (wm0010->state) { case WM0010_OUT_OF_RESET: case WM0010_BOOTROM: case WM0010_STAGE2: spin_lock(&wm0010->irq_lock); complete(&wm0010->boot_completion); spin_unlock(&wm0010->irq_lock); return IRQ_HANDLED; default: return IRQ_NONE; } return IRQ_NONE; } static int wm0010_probe(struct snd_soc_codec *codec) { struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec); wm0010->codec = codec; return 0; } static int wm0010_spi_probe(struct spi_device *spi) { unsigned long gpio_flags; int ret; int trigger; int irq; struct wm0010_priv *wm0010; wm0010 = devm_kzalloc(&spi->dev, sizeof(*wm0010), GFP_KERNEL); if (!wm0010) return -ENOMEM; mutex_init(&wm0010->lock); spin_lock_init(&wm0010->irq_lock); spi_set_drvdata(spi, wm0010); wm0010->dev = &spi->dev; if (dev_get_platdata(&spi->dev)) memcpy(&wm0010->pdata, dev_get_platdata(&spi->dev), sizeof(wm0010->pdata)); init_completion(&wm0010->boot_completion); wm0010->core_supplies[0].supply = "AVDD"; wm0010->core_supplies[1].supply = "DCVDD"; ret = devm_regulator_bulk_get(wm0010->dev, ARRAY_SIZE(wm0010->core_supplies), wm0010->core_supplies); if (ret != 0) { dev_err(wm0010->dev, "Failed to obtain core supplies: %d\n", ret); return ret; } wm0010->dbvdd = devm_regulator_get(wm0010->dev, "DBVDD"); if (IS_ERR(wm0010->dbvdd)) { ret = PTR_ERR(wm0010->dbvdd); dev_err(wm0010->dev, "Failed to obtain DBVDD: %d\n", ret); return ret; } if (wm0010->pdata.gpio_reset) { wm0010->gpio_reset = wm0010->pdata.gpio_reset; if (wm0010->pdata.reset_active_high) wm0010->gpio_reset_value = 1; else wm0010->gpio_reset_value = 0; if (wm0010->gpio_reset_value) gpio_flags = GPIOF_OUT_INIT_HIGH; else gpio_flags = GPIOF_OUT_INIT_LOW; ret = devm_gpio_request_one(wm0010->dev, wm0010->gpio_reset, gpio_flags, "wm0010 reset"); if (ret < 0) { dev_err(wm0010->dev, "Failed to request GPIO for DSP reset: %d\n", ret); return ret; } } else { dev_err(wm0010->dev, "No reset GPIO configured\n"); return -EINVAL; } wm0010->state = WM0010_POWER_OFF; irq = spi->irq; if (wm0010->pdata.irq_flags) trigger = wm0010->pdata.irq_flags; else trigger = IRQF_TRIGGER_FALLING; trigger |= IRQF_ONESHOT; ret = request_threaded_irq(irq, NULL, wm0010_irq, trigger, "wm0010", wm0010); if (ret) { dev_err(wm0010->dev, "Failed to request IRQ %d: %d\n", irq, ret); return ret; } wm0010->irq = irq; ret = irq_set_irq_wake(irq, 1); if (ret) { dev_err(wm0010->dev, "Failed to set IRQ %d as wake source: %d\n", irq, ret); return ret; } if (spi->max_speed_hz) wm0010->board_max_spi_speed = spi->max_speed_hz; else wm0010->board_max_spi_speed = 0; ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_wm0010, wm0010_dai, ARRAY_SIZE(wm0010_dai)); if (ret < 0) return ret; return 0; } static int wm0010_spi_remove(struct spi_device *spi) { struct wm0010_priv *wm0010 = spi_get_drvdata(spi); snd_soc_unregister_codec(&spi->dev); gpio_set_value_cansleep(wm0010->gpio_reset, wm0010->gpio_reset_value); irq_set_irq_wake(wm0010->irq, 0); if (wm0010->irq) free_irq(wm0010->irq, wm0010); return 0; } static struct spi_driver wm0010_spi_driver = { .driver = { .name = "wm0010", }, .probe = wm0010_spi_probe, .remove = wm0010_spi_remove, }; module_spi_driver(wm0010_spi_driver); MODULE_DESCRIPTION("ASoC WM0010 driver"); MODULE_AUTHOR("Mark Brown <[email protected]>"); MODULE_LICENSE("GPL");
{ "pile_set_name": "Github" }
/** * Copyright (c) 2015-present, Parse, LLC. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import "PFTwitterAlertView.h" @interface PFTwitterAlertView () <UIAlertViewDelegate> @property (nonatomic, copy) PFTwitterAlertViewCompletion completion; @end @implementation PFTwitterAlertView ///-------------------------------------- #pragma mark - Init ///-------------------------------------- + (void)showAlertWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles completion:(PFTwitterAlertViewCompletion)completion { if ([UIAlertController class] != nil) { __block UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; void (^alertActionHandler)(UIAlertAction *) = [^(UIAlertAction *action) { if (completion) { // This block intentionally retains alertController, and releases it afterwards. if (action.style == UIAlertActionStyleCancel) { completion(NSNotFound); } else { NSUInteger index = [alertController.actions indexOfObject:action]; completion(index - 1); } } alertController = nil; } copy]; [alertController addAction:[UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:alertActionHandler]]; for (NSString *buttonTitle in otherButtonTitles) { [alertController addAction:[UIAlertAction actionWithTitle:buttonTitle style:UIAlertActionStyleDefault handler:alertActionHandler]]; } UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; UIViewController *viewController = keyWindow.rootViewController; while (viewController.presentedViewController) { viewController = viewController.presentedViewController; } [viewController presentViewController:alertController animated:YES completion:nil]; } else { #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0 __block PFTwitterAlertView *pfAlertView = [[self alloc] init]; UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil]; for (NSString *buttonTitle in otherButtonTitles) { [alertView addButtonWithTitle:buttonTitle]; } pfAlertView.completion = ^(NSUInteger index) { if (completion) { completion(index); } pfAlertView = nil; }; alertView.delegate = pfAlertView; [alertView show]; #endif } } #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0 ///-------------------------------------- #pragma mark - UIAlertViewDelegate ///-------------------------------------- - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (self.completion) { if (buttonIndex == alertView.cancelButtonIndex) { self.completion(NSNotFound); } else { self.completion(buttonIndex - 1); } } } #endif @end
{ "pile_set_name": "Github" }
### Reporting Bugs If you are reporting a bug, please consider the following questions first: * Can you reliably reproduce the bug you are reporting? Are you sure your description is accurate? * Will the Cryptocat developers be able to reproduce your bug? What information will they need? ### Proposing Enhancements If you would like to propose an enhancement, first consider: * Is your enhancement's value almost entirely subjective (change Cryptocat's color scheme to your favorite color, etc.)? If so, please do not open a new issue. * Is your enhancement only valuable to your specific use-case or would it be useful to a general base of Cryptocat users? Please do not open a new issue if the former case applies. * Can your proposed enhancement be described in concrete steps? Does it fit well with the current architecture? ### Other Issues General questions are somewhat welcome on the issue tracker, but please limit your discussions to outside the scope of your personal opinion as much as possible. Your personal views on a feature are a waste of time. Consider rather how a feature or change would affect the software's consistency and its viability towards its larger userbase.
{ "pile_set_name": "Github" }
profile: service defaultPackage: org.graalvm.demos.micronaut.service.todo --- testFramework: junit sourceLanguage: java
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "qca9563_tplink_archer-x7-v5.dtsi" / { compatible = "tplink,archer-a7-v5", "qca,qca9563"; model = "TP-Link Archer A7 v5"; }; &keys { reset { label = "Reset button"; linux,code = <KEY_RESTART>; gpios = <&gpio 11 GPIO_ACTIVE_LOW>; debounce-interval = <60>; }; }; &mtdparts { partition@0 { label = "factory-uboot"; reg = <0x000000 0x020000>; read-only; }; uboot: partition@20000 { label = "u-boot"; reg = <0x020000 0x020000>; read-only; }; partition@40000 { label = "firmware"; reg = <0x040000 0xec0000>; compatible = "denx,uimage"; }; info: partition@f40000 { label = "info"; reg = <0xf40000 0x020000>; read-only; }; config: partition@f60000 { label = "config"; reg = <0xf60000 0x050000>; read-only; }; partition@fc0000 { label = "partition-table"; reg = <0xfc0000 0x010000>; read-only; }; art: partition@ff0000 { label = "art"; reg = <0xff0000 0x010000>; read-only; }; };
{ "pile_set_name": "Github" }
;Imports of cg_camerashake: extern cgArray extern sin extern crandom extern memset ;Exports of cg_camerashake: global s_cameraShakeSet global CG_ShakeCamera global CG_StartShakeCamera global CG_ClearCameraShakes SECTION .text ;CG_ShakeCamera(int) CG_ShakeCamera: push ebp mov ebp, esp push edi push esi push ebx sub esp, 0x7c mov eax, [ebp+0x8] lea edx, [eax+eax*8] lea edx, [eax+edx*4] lea esi, [edx*4+s_cameraShakeSet] mov ebx, cgArray cvtsi2ss xmm6, dword [ebx+0x46128] divss xmm6, dword [_float_600_00000000] pxor xmm5, xmm5 movaps xmm7, xmm5 movss [ebp-0x6c], xmm5 mov edi, [ebp-0x6c] xor ecx, ecx mov edx, esi CG_ShakeCamera_30: mov eax, [ebx+0x46128] sub eax, [edx] js CG_ShakeCamera_10 cvtsi2ss xmm3, eax movss xmm4, dword [edx+0x8] ucomiss xmm3, xmm4 jb CG_ShakeCamera_20 CG_ShakeCamera_10: add ecx, 0x1 add edx, 0x24 cmp ecx, 0x4 jnz CG_ShakeCamera_30 movss xmm0, dword [ebx+0x50490] movss [ebp-0x1c], xmm0 ucomiss xmm0, xmm5 jbe CG_ShakeCamera_40 movaps xmm5, xmm0 ucomiss xmm7, xmm5 jae CG_ShakeCamera_50 CG_ShakeCamera_70: movss xmm0, dword [_float_1_00000000] minss xmm0, xmm5 movaps xmm5, xmm0 cvtss2sd xmm6, xmm6 movsd [ebp-0x30], xmm6 cvtss2sd xmm1, [esi+0x90] movsd [ebp-0x28], xmm1 movapd xmm0, xmm6 mulsd xmm0, [_double_25_13274123] addsd xmm0, xmm1 movsd [esp], xmm0 movss [ebp-0x68], xmm5 call sin fstp qword [ebp-0x40] cvtsd2ss xmm0, [ebp-0x40] mulss xmm0, [ebp-0x1c] mulss xmm0, [_float_18_00000000] movss xmm5, dword [ebp-0x68] mulss xmm0, xmm5 addss xmm0, [ebx+0x4d360] movss [ebx+0x4d360], xmm0 movsd xmm0, qword [ebp-0x30] mulsd xmm0, [_double_47_12388980] addsd xmm0, [ebp-0x28] movsd [esp], xmm0 movss [ebp-0x68], xmm5 call sin fstp qword [ebp-0x48] cvtsd2ss xmm0, [ebp-0x48] mulss xmm0, [ebp-0x1c] mulss xmm0, [_float_16_00000000] movss xmm5, dword [ebp-0x68] mulss xmm0, xmm5 addss xmm0, [ebx+0x4d364] movss [ebx+0x4d364], xmm0 movsd xmm0, qword [ebp-0x30] mulsd xmm0, [_double_37_69911184] movsd xmm1, qword [ebp-0x28] addsd xmm1, xmm0 movsd [esp], xmm1 movss [ebp-0x68], xmm5 call sin fstp qword [ebp-0x50] cvtsd2ss xmm0, [ebp-0x50] mulss xmm0, [ebp-0x1c] movss [ebp-0x1c], xmm0 mulss xmm0, [_float_10_00000000] movss xmm5, dword [ebp-0x68] mulss xmm5, xmm0 addss xmm5, [ebx+0x4d368] movss [ebx+0x4d368], xmm5 add esp, 0x7c pop ebx pop esi pop edi pop ebp ret CG_ShakeCamera_20: movss xmm0, dword [ebx+0x492e0] subss xmm0, [edx+0x10] movss xmm1, dword [ebx+0x492e4] subss xmm1, [edx+0x14] movss xmm2, dword [ebx+0x492e8] subss xmm2, [edx+0x18] mulss xmm0, xmm0 mulss xmm1, xmm1 addss xmm0, xmm1 mulss xmm2, xmm2 addss xmm0, xmm2 sqrtss xmm0, xmm0 divss xmm0, dword [edx+0xc] movss xmm1, dword [_float_1_00000000] subss xmm1, xmm0 movaps xmm0, xmm1 divss xmm3, xmm4 movss xmm1, dword [_float_1_00000000] subss xmm1, xmm3 mulss xmm1, [edx+0x4] ucomiss xmm7, xmm1 jae CG_ShakeCamera_10 ucomiss xmm0, xmm7 jb CG_ShakeCamera_60 mulss xmm0, xmm1 CG_ShakeCamera_80: movss [edx+0x1c], xmm0 movss [edx+0x20], xmm1 ucomiss xmm0, xmm5 jbe CG_ShakeCamera_10 movaps xmm5, xmm0 movss [ebp-0x6c], xmm1 mov edi, [ebp-0x6c] jmp CG_ShakeCamera_10 CG_ShakeCamera_40: mov [ebp-0x1c], edi ucomiss xmm7, xmm5 jb CG_ShakeCamera_70 CG_ShakeCamera_50: call crandom fstp dword [ebp-0x34] cvtss2sd xmm0, [ebp-0x34] mulsd xmm0, [_double_3_14159265] cvtsd2ss xmm0, xmm0 movss [esi+0x90], xmm0 add esp, 0x7c pop ebx pop esi pop edi pop ebp ret CG_ShakeCamera_60: divss xmm0, xmm1 jmp CG_ShakeCamera_80 add [eax], al ;CG_StartShakeCamera(int, float, int, float*, float) CG_StartShakeCamera: push ebp mov ebp, esp push esi push ebx mov ecx, [ebp+0x8] mov eax, [ebp+0x14] cvtsi2ss xmm4, dword [ebp+0x10] mov edx, cgArray mov esi, [edx+0x46128] movss xmm7, dword [eax] movss xmm6, dword [eax+0x4] movss xmm5, dword [eax+0x8] pxor xmm3, xmm3 ucomiss xmm3, xmm4 jb CG_StartShakeCamera_10 CG_StartShakeCamera_70: movaps xmm1, xmm3 CG_StartShakeCamera_90: lea eax, [ecx+ecx*8] lea eax, [ecx+eax*4] lea ebx, [eax*4+s_cameraShakeSet] mov edx, ebx xor ecx, ecx cvtsi2ss xmm2, esi CG_StartShakeCamera_30: mov eax, [edx] cmp esi, eax jl CG_StartShakeCamera_20 cvtsi2ss xmm0, eax addss xmm0, [edx+0x8] ucomiss xmm2, xmm0 jae CG_StartShakeCamera_20 add ecx, 0x1 add edx, 0x24 cmp ecx, 0x4 jnz CG_StartShakeCamera_30 mov eax, ebx movaps xmm2, xmm3 xor edx, edx CG_StartShakeCamera_50: movss xmm0, dword [eax+0x1c] ucomiss xmm2, xmm0 jbe CG_StartShakeCamera_40 mov ecx, edx movaps xmm2, xmm0 CG_StartShakeCamera_40: add edx, 0x1 add eax, 0x24 cmp edx, 0x4 jnz CG_StartShakeCamera_50 cmp ecx, 0x4 jz CG_StartShakeCamera_60 lea eax, [ecx+ecx*8] lea eax, [ebx+eax*4] movss xmm0, dword [ebp+0x18] movss [eax+0xc], xmm0 movss [eax+0x18], xmm5 movss [eax+0x14], xmm6 movss [eax+0x10], xmm7 mov [eax], esi movss [eax+0x8], xmm4 movss xmm0, dword [ebp+0xc] movss [eax+0x4], xmm0 movss [eax+0x20], xmm1 movss [eax+0x1c], xmm3 CG_StartShakeCamera_60: pop ebx pop esi pop ebp ret CG_StartShakeCamera_10: movss xmm0, dword [edx+0x492e0] subss xmm0, xmm7 movss xmm1, dword [edx+0x492e4] subss xmm1, xmm6 movss xmm2, dword [edx+0x492e8] subss xmm2, xmm5 mulss xmm0, xmm0 mulss xmm1, xmm1 addss xmm0, xmm1 mulss xmm2, xmm2 addss xmm0, xmm2 sqrtss xmm0, xmm0 divss xmm0, dword [ebp+0x18] movss xmm1, dword [_float_1_00000000] movaps xmm2, xmm1 subss xmm2, xmm0 movaps xmm0, xmm3 divss xmm0, xmm4 subss xmm1, xmm0 mulss xmm1, [ebp+0xc] ucomiss xmm3, xmm1 jae CG_StartShakeCamera_70 ucomiss xmm2, xmm3 jb CG_StartShakeCamera_80 movaps xmm3, xmm2 mulss xmm3, xmm1 jmp CG_StartShakeCamera_90 CG_StartShakeCamera_20: movss xmm0, dword [ebp+0x18] movss [edx+0xc], xmm0 movss [edx+0x18], xmm5 movss [edx+0x14], xmm6 movss [edx+0x10], xmm7 mov [edx], esi movss [edx+0x8], xmm4 movss xmm0, dword [ebp+0xc] movss [edx+0x4], xmm0 movss [edx+0x20], xmm1 movss [edx+0x1c], xmm3 pop ebx pop esi pop ebp ret CG_StartShakeCamera_80: movaps xmm3, xmm2 divss xmm3, xmm1 jmp CG_StartShakeCamera_90 add [eax], al ;CG_ClearCameraShakes(int) CG_ClearCameraShakes: push ebp mov ebp, esp sub esp, 0x18 mov eax, [ebp+0x8] lea edx, [eax+eax*8] lea edx, [eax+edx*4] lea edx, [edx*4+s_cameraShakeSet] mov dword [esp+0x8], 0x90 mov dword [esp+0x4], 0x0 mov [esp], edx call memset leave ret ;Initialized global or static variables of cg_camerashake: SECTION .data ;Initialized constant data of cg_camerashake: SECTION .rdata ;Zero initialized global or static variables of cg_camerashake: SECTION .bss s_cameraShakeSet: resb 0x100 ;All cstrings: SECTION .rdata ;All constant floats and doubles: SECTION .rdata _float_600_00000000: dd 0x44160000 ; 600 _float_1_00000000: dd 0x3f800000 ; 1 _double_25_13274123: dq 0x403921fb54442d18 ; 25.1327 _float_18_00000000: dd 0x41900000 ; 18 _double_47_12388980: dq 0x40478fdb9effea46 ; 47.1239 _float_16_00000000: dd 0x41800000 ; 16 _double_37_69911184: dq 0x4042d97c7f3321d2 ; 37.6991 _float_10_00000000: dd 0x41200000 ; 10 _double_3_14159265: dq 0x400921fb54442d18 ; 3.14159
{ "pile_set_name": "Github" }
<?php /** * Include files that load plugin and theme hooks * * @file load-plugin-and-theme-hooks.php * @package GravityView * @license GPL2+ * @author GravityView <[email protected]> * @link http://gravityview.co * @copyright Copyright 2015, Katz Web Services, Inc. * * @since 1.15.2 */ /** @define "GRAVITYVIEW_DIR" "../" */ $include_path = GRAVITYVIEW_DIR . 'includes/plugin-and-theme-hooks/'; // Abstract class require $include_path . 'abstract-gravityview-plugin-and-theme-hooks.php'; $plugin_hooks_files = glob( $include_path . 'class-gravityview-plugin-hooks-*.php' ); // Load all plugin files automatically foreach ( (array) $plugin_hooks_files as $plugin_hooks_file ) { include $plugin_hooks_file; } $theme_hooks_files = glob( $include_path . 'class-gravityview-theme-hooks-*.php' ); // Load all theme files automatically foreach ( (array) $theme_hooks_files as $theme_hooks_file ) { include $theme_hooks_file; }
{ "pile_set_name": "Github" }
//------------------------------------------------------------------------------ // <auto-generated> // Этот код создан программой. // Исполняемая версия:2.0.50727.5446 // // Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае // повторной генерации кода. // </auto-generated> //------------------------------------------------------------------------------ namespace VolumeLight.Properties { using System; /// <summary> /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. /// </summary> // Этот класс создан автоматически классом StronglyTypedResourceBuilder // с помощью такого средства, как ResGen или Visual Studio. // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen // с параметром /str или перестройте свой проект VS. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VolumeLight.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Перезаписывает свойство CurrentUICulture текущего потока для всех /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
{ "pile_set_name": "Github" }