text
stringlengths
2
99.9k
meta
dict
--- CGI-Kwiki-0.18/lib/CGI/Kwiki/Privacy.pm.orig 2003-08-25 15:45:08.000000000 -0500 +++ CGI-Kwiki-0.18/lib/CGI/Kwiki/Privacy.pm 2004-04-04 14:41:30.000000000 -0500 @@ -96,6 +96,9 @@ # Name of the current script sub script { my $script = $0; + if ($script eq '/dev/null' or $script eq '-e') { # probably mod_perl + $script = Apache->request->filename; + } $script =~ s/.*[\\\/]//; return $script; }
{ "pile_set_name": "Github" }
// // NGRPropertyValidator.m // NGRValidator // // Created by Patryk Kaczmarek on 23.12.2014. // // #import "NGRPropertyValidator.h" #import "NGRValidationRule.h" #import "NSObject+NGRValidator.h" #import "NSArray+NGRValidator.h" #import "NSString+NGRValidator.h" #import "NSError+NGRValidator.h" NSUInteger const NGRPropertyValidatorDefaultPriority = 100; NGRMsgKey *const NGRErrorUnexpectedClass = (NGRMsgKey *)@"NGRErrorUnexpectedClass"; @interface NGRPropertyValidator () @property (strong, nonatomic, readwrite) NSMutableArray *scenarios; @property (strong, nonatomic) NSString *localizedPropertyName; @property (assign, nonatomic) BOOL isRequired; @property (assign, nonatomic) BOOL allowEmptyProperty; @property (copy, nonatomic, readwrite) NGRPropertyValidatorCondition condition; @end @implementation NGRPropertyValidator #pragma mark - Initializers - (instancetype)initWithProperty:(NSString *)property { self = [super init]; if (self) { _property = property; _priority = NGRPropertyValidatorDefaultPriority; _messages = [[NGRMessages alloc] init]; _validationRules = [NSMutableArray array]; _isRequired = NO; _allowEmptyProperty = NO; _condition = NULL; } return self; } #pragma mark - Public - (NSError *)simpleValidationOfValue:(nullable id)value { return [self validateValue:value usingSimpleValidation:YES]; } - (NSArray<NSError *> *)complexValidationOfValue:(nullable id)value { return [self validateValue:value usingSimpleValidation:NO]; } - (void)validateClass:(Class)aClass withName:(NSString *)name validationBlock:(NGRValidationBlock)block { __weak typeof(self) weakSelf = self; [self addValidatonBlockWithName:name block:^NGRMsgKey *(id value) { BOOL isValueAllowedToBeEmpty = weakSelf.allowEmptyProperty && [value ngr_isCountable] && [value ngr_isEmpty]; BOOL doesValueExistAndIsNotRequired = !weakSelf.isRequired && !value; if (value && aClass && ![value isKindOfClass:aClass]) { return NGRErrorUnexpectedClass; } else if (isValueAllowedToBeEmpty || doesValueExistAndIsNotRequired) { return nil; } return block(value); }]; } - (NGRPropertyValidator *(^)(NSArray *))onScenarios { return ^(NSArray *scenarios){ self.scenarios = [scenarios mutableCopy]; return self; }; } - (NGRPropertyValidator *(^)(NGRPropertyValidatorCondition))when { return ^(NGRPropertyValidatorCondition condition){ self.condition = condition; return self; }; } - (NGRPropertyValidator *(^)(NSUInteger))order { return ^(NSUInteger priority){ _priority = priority; return self; }; } - (NGRPropertyValidator *(^)(NSString * _Nullable))localizedName { return ^(NSString *message) { self.localizedPropertyName = message; return self; }; } - (NGRPropertyValidator *(^)())required { return ^() { self.isRequired = YES; [self validateClass:nil withName:@"required" validationBlock:^NGRMsgKey *(id value) { BOOL doesValueExist = value && ![value isKindOfClass:[NSNull class]]; if (!doesValueExist || [value ngr_isEmpty]) { return MSGNil; } return nil; }]; return self; }; } - (NGRPropertyValidator *(^)())allowEmpty { return ^() { self.allowEmptyProperty = YES; return self; }; } #pragma mark - Private - (id)validateValue:(id)value usingSimpleValidation:(BOOL)simpleValidation { if (![self shouldValidate]) { return nil; } NSMutableArray *array = [NSMutableArray array]; for (NGRValidationRule *validationRule in self.validationRules) { NGRMsgKey *errorKey = validationRule.validationBlock(value); if ([errorKey isEqualToString:NGRErrorUnexpectedClass]) { NSAssert(NO, @"Value \"%@\" for \"%@\" parameter is wrong kind of class", value, self.property); } else if (errorKey) { if (simpleValidation) { return [self errorWithErrorKey:errorKey]; } else { [array addObject:[self errorWithErrorKey:errorKey]]; } } } return simpleValidation ? nil : [array copy]; } - (void)addValidatonBlockWithName:(NSString *)name block:(NGRMsgKey *(^)(id))block { NGRValidationRule *validatorRule = [[NGRValidationRule alloc] initWithName:name block:block]; [self.validationRules addObject:validatorRule]; } - (NSError *)errorWithErrorKey:(NGRMsgKey *)key { NSDictionary *messages; if ([self.delegate respondsToSelector:@selector(validationErrorMessagesByPropertyKey)]) { messages = [self.delegate validationErrorMessagesByPropertyKey]; } NSString *customDescription = messages[self.property][key]; if (customDescription) { return [NSError ngr_errorWithDescription:customDescription propertyName:self.property]; } NSString *property = self.property ?: @"Validated property"; NSString *propertyName = (self.localizedPropertyName) ?: [property ngr_stringByCapitalizeFirstLetter]; NSString *space = propertyName.length > 0 ? @" " : @""; NSString *description = [NSString stringWithFormat:@"%@%@%@", propertyName, space, [self.messages messageForKey:key]]; return [NSError ngr_errorWithDescription:description propertyName:self.property]; } - (BOOL)shouldValidate { BOOL conditionsApply = !self.condition || self.condition(); BOOL scenariosApply = !self.scenarios || !self.scenario || [self.scenarios ngr_containsString:self.scenario]; return conditionsApply && scenariosApply; } #pragma mark - Debugging - (NSString *)description { NSString *scenarios = [self.scenarios componentsJoinedByString:@","]; return [NSString stringWithFormat:@"<%@: %p, property name: %@, scenario: %@, scenarios(%lu): %@, rules(%lu): %@>", NSStringFromClass([self class]), self, self.property, self.scenario, (unsigned long)[self.scenarios count], scenarios, (unsigned long)[self.validationRules count], [self validatorsDescription]]; } - (NSString *)validatorsDescription { NSMutableString *validators = [NSMutableString string]; for (NGRValidationRule *rule in self.validationRules) { BOOL isLastRule = [rule isEqual:self.validationRules.lastObject]; [validators appendFormat:@"%@%@", rule.name, isLastRule ? @"" : @", "]; } return [validators copy]; } @end
{ "pile_set_name": "Github" }
#import <Foundation/Foundation.h> @interface PodsDummy_Pods_AFNetworking : NSObject @end @implementation PodsDummy_Pods_AFNetworking @end
{ "pile_set_name": "Github" }
/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TRINITYSERVER_MOVEPLINE_H #define TRINITYSERVER_MOVEPLINE_H #include "Spline.h" #include "MoveSplineInitArgs.h" #include <G3D/Vector3.h> namespace WorldPackets { namespace Movement { class CommonMovement; class MonsterMove; } } namespace Movement { struct Location : public Vector3 { Location() : orientation(0) { } Location(float x, float y, float z, float o) : Vector3(x, y, z), orientation(o) { } Location(Vector3 const& v) : Vector3(v), orientation(0) { } Location(Vector3 const& v, float o) : Vector3(v), orientation(o) { } float orientation; }; // MoveSpline represents smooth catmullrom or linear curve and point that moves belong it // curve can be cyclic - in this case movement will be cyclic // point can have vertical acceleration motion component (used in fall, parabolic movement) class TC_GAME_API MoveSpline { friend class WorldPackets::Movement::CommonMovement; friend class WorldPackets::Movement::MonsterMove; public: typedef Spline<int32> MySpline; enum UpdateResult { Result_None = 0x01, Result_Arrived = 0x02, Result_NextCycle = 0x04, Result_NextSegment = 0x08 }; protected: MySpline spline; FacingInfo facing; uint32 m_Id; MoveSplineFlag splineflags; int32 time_passed; // currently duration mods are unused, but its _currently_ //float duration_mod; //float duration_mod_next; float vertical_acceleration; float initialOrientation; int32 effect_start_time; int32 point_Idx; int32 point_Idx_offset; Optional<SpellEffectExtraData> spell_effect_extra; void init_spline(MoveSplineInitArgs const& args); protected: MySpline::ControlArray const& getPath() const { return spline.getPoints(); } Location computePosition(int32 time_point, int32 point_index) const; void computeParabolicElevation(int32 time_point, float& el) const; void computeFallElevation(int32 time_point, float& el) const; UpdateResult _updateState(int32& ms_time_diff); int32 next_timestamp() const { return spline.length(point_Idx + 1); } int32 segment_time_elapsed() const { return next_timestamp() - time_passed; } int32 timeElapsed() const { return Duration() - time_passed; } int32 timePassed() const { return time_passed; } public: int32 Duration() const { return spline.length(); } MySpline const& _Spline() const { return spline; } int32 _currentSplineIdx() const { return point_Idx; } void _Finalize(); void _Interrupt() { splineflags.done = true; } public: void Initialize(MoveSplineInitArgs const&); bool Initialized() const { return !spline.empty(); } MoveSpline(); template<class UpdateHandler> void updateState(int32 difftime, UpdateHandler& handler) { ASSERT(Initialized()); do handler(_updateState(difftime)); while (difftime > 0); } void updateState(int32 difftime) { ASSERT(Initialized()); do _updateState(difftime); while (difftime > 0); } Location ComputePosition() const; Location ComputePosition(int32 time_offset) const; uint32 GetId() const { return m_Id; } bool Finalized() const { return splineflags.done; } bool isCyclic() const { return splineflags.cyclic; } bool isFalling() const { return splineflags.falling; } Vector3 const& FinalDestination() const { return Initialized() ? spline.getPoint(spline.last()) : Vector3::zero(); } Vector3 const& CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx + 1) : Vector3::zero(); } int32 currentPathIdx() const; bool onTransport; bool splineIsFacingOnly; std::string ToString() const; }; } #endif // TRINITYSERVER_MOVEPLINE_H
{ "pile_set_name": "Github" }
/// @ref gtx_extended_min_max /// @file glm/gtx/extended_min_max.inl namespace glm { template <typename T> GLM_FUNC_QUALIFIER T min( T const & x, T const & y, T const & z) { return glm::min(glm::min(x, y), z); } template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> min ( C<T> const & x, typename C<T>::T const & y, typename C<T>::T const & z ) { return glm::min(glm::min(x, y), z); } template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> min ( C<T> const & x, C<T> const & y, C<T> const & z ) { return glm::min(glm::min(x, y), z); } template <typename T> GLM_FUNC_QUALIFIER T min ( T const & x, T const & y, T const & z, T const & w ) { return glm::min(glm::min(x, y), glm::min(z, w)); } template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> min ( C<T> const & x, typename C<T>::T const & y, typename C<T>::T const & z, typename C<T>::T const & w ) { return glm::min(glm::min(x, y), glm::min(z, w)); } template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> min ( C<T> const & x, C<T> const & y, C<T> const & z, C<T> const & w ) { return glm::min(glm::min(x, y), glm::min(z, w)); } template <typename T> GLM_FUNC_QUALIFIER T max( T const & x, T const & y, T const & z) { return glm::max(glm::max(x, y), z); } template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> max ( C<T> const & x, typename C<T>::T const & y, typename C<T>::T const & z ) { return glm::max(glm::max(x, y), z); } template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> max ( C<T> const & x, C<T> const & y, C<T> const & z ) { return glm::max(glm::max(x, y), z); } template <typename T> GLM_FUNC_QUALIFIER T max ( T const & x, T const & y, T const & z, T const & w ) { return glm::max(glm::max(x, y), glm::max(z, w)); } template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> max ( C<T> const & x, typename C<T>::T const & y, typename C<T>::T const & z, typename C<T>::T const & w ) { return glm::max(glm::max(x, y), glm::max(z, w)); } template <typename T, template <typename> class C> GLM_FUNC_QUALIFIER C<T> max ( C<T> const & x, C<T> const & y, C<T> const & z, C<T> const & w ) { return glm::max(glm::max(x, y), glm::max(z, w)); } }//namespace glm
{ "pile_set_name": "Github" }
// Copyright 2015 go-swagger maintainers // // 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 swag import ( "unicode" ) var nameReplaceTable = map[rune]string{ '@': "At ", '&': "And ", '|': "Pipe ", '$': "Dollar ", '!': "Bang ", '-': "", '_': "", } type ( splitter struct { postSplitInitialismCheck bool initialisms []string } splitterOption func(*splitter) *splitter ) // split calls the splitter; splitter provides more control and post options func split(str string) []string { lexems := newSplitter().split(str) result := make([]string, 0, len(lexems)) for _, lexem := range lexems { result = append(result, lexem.GetOriginal()) } return result } func (s *splitter) split(str string) []nameLexem { return s.toNameLexems(str) } func newSplitter(options ...splitterOption) *splitter { splitter := &splitter{ postSplitInitialismCheck: false, initialisms: initialisms, } for _, option := range options { splitter = option(splitter) } return splitter } // withPostSplitInitialismCheck allows to catch initialisms after main split process func withPostSplitInitialismCheck(s *splitter) *splitter { s.postSplitInitialismCheck = true return s } type ( initialismMatch struct { start, end int body []rune complete bool } initialismMatches []*initialismMatch ) func (s *splitter) toNameLexems(name string) []nameLexem { nameRunes := []rune(name) matches := s.gatherInitialismMatches(nameRunes) return s.mapMatchesToNameLexems(nameRunes, matches) } func (s *splitter) gatherInitialismMatches(nameRunes []rune) initialismMatches { matches := make(initialismMatches, 0) for currentRunePosition, currentRune := range nameRunes { newMatches := make(initialismMatches, 0, len(matches)) // check current initialism matches for _, match := range matches { if keepCompleteMatch := match.complete; keepCompleteMatch { newMatches = append(newMatches, match) continue } // drop failed match currentMatchRune := match.body[currentRunePosition-match.start] if !s.initialismRuneEqual(currentMatchRune, currentRune) { continue } // try to complete ongoing match if currentRunePosition-match.start == len(match.body)-1 { // we are close; the next step is to check the symbol ahead // if it is a small letter, then it is not the end of match // but beginning of the next word if currentRunePosition < len(nameRunes)-1 { nextRune := nameRunes[currentRunePosition+1] if newWord := unicode.IsLower(nextRune); newWord { // oh ok, it was the start of a new word continue } } match.complete = true match.end = currentRunePosition } newMatches = append(newMatches, match) } // check for new initialism matches for _, initialism := range s.initialisms { initialismRunes := []rune(initialism) if s.initialismRuneEqual(initialismRunes[0], currentRune) { newMatches = append(newMatches, &initialismMatch{ start: currentRunePosition, body: initialismRunes, complete: false, }) } } matches = newMatches } return matches } func (s *splitter) mapMatchesToNameLexems(nameRunes []rune, matches initialismMatches) []nameLexem { nameLexems := make([]nameLexem, 0) var lastAcceptedMatch *initialismMatch for _, match := range matches { if !match.complete { continue } if firstMatch := lastAcceptedMatch == nil; firstMatch { nameLexems = append(nameLexems, s.breakCasualString(nameRunes[:match.start])...) nameLexems = append(nameLexems, s.breakInitialism(string(match.body))) lastAcceptedMatch = match continue } if overlappedMatch := match.start <= lastAcceptedMatch.end; overlappedMatch { continue } middle := nameRunes[lastAcceptedMatch.end+1 : match.start] nameLexems = append(nameLexems, s.breakCasualString(middle)...) nameLexems = append(nameLexems, s.breakInitialism(string(match.body))) lastAcceptedMatch = match } // we have not found any accepted matches if lastAcceptedMatch == nil { return s.breakCasualString(nameRunes) } if lastAcceptedMatch.end+1 != len(nameRunes) { rest := nameRunes[lastAcceptedMatch.end+1:] nameLexems = append(nameLexems, s.breakCasualString(rest)...) } return nameLexems } func (s *splitter) initialismRuneEqual(a, b rune) bool { return a == b } func (s *splitter) breakInitialism(original string) nameLexem { return newInitialismNameLexem(original, original) } func (s *splitter) breakCasualString(str []rune) []nameLexem { segments := make([]nameLexem, 0) currentSegment := "" addCasualNameLexem := func(original string) { segments = append(segments, newCasualNameLexem(original)) } addInitialismNameLexem := func(original, match string) { segments = append(segments, newInitialismNameLexem(original, match)) } addNameLexem := func(original string) { if s.postSplitInitialismCheck { for _, initialism := range s.initialisms { if upper(initialism) == upper(original) { addInitialismNameLexem(original, initialism) return } } } addCasualNameLexem(original) } for _, rn := range string(str) { if replace, found := nameReplaceTable[rn]; found { if currentSegment != "" { addNameLexem(currentSegment) currentSegment = "" } if replace != "" { addNameLexem(replace) } continue } if !unicode.In(rn, unicode.L, unicode.M, unicode.N, unicode.Pc) { if currentSegment != "" { addNameLexem(currentSegment) currentSegment = "" } continue } if unicode.IsUpper(rn) { if currentSegment != "" { addNameLexem(currentSegment) } currentSegment = "" } currentSegment += string(rn) } if currentSegment != "" { addNameLexem(currentSegment) } return segments }
{ "pile_set_name": "Github" }
require 'rubygems.rb' if defined?(Gem)
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jena.atlas.io; import static java.lang.String.format ; import java.io.IOException ; import java.io.OutputStream ; import java.io.PrintStream ; import java.io.Writer ; import org.apache.jena.atlas.lib.Closeable ; /** A writer that records what the current indentation level is, and * uses that to insert a prefix at each line. * It can also insert line numbers at the beginning of lines. */ public class IndentedWriter extends AWriterBase implements AWriter, Closeable { /** Stdout wrapped in an IndentedWriter - no line numbers */ public static final IndentedWriter stdout = new IndentedWriter(System.out) ; /** Stderr wrapped in an IndentedWriter - no line numbers */ public static final IndentedWriter stderr = new IndentedWriter(System.err) ; static { stdout.setFlushOnNewline(true) ; stderr.setFlushOnNewline(true) ; } // Note cases:if (!flatMode) // 1/ incIndent - decIndent with no output should not cause any padding // 2/ newline() then no text, then finish should not cause a line number. protected Writer out = null ; protected static final int INDENT = 2 ; // Configuration. protected int unitIndent = INDENT ; private char padChar = ' ' ; private String padString = null ; private String linePrefix = null ; protected boolean lineNumbers = false ; protected boolean flatMode = false ; private boolean flushOnNewline = false ; // Internal state. protected boolean startingNewLine = true ; private String endOfLineMarker = null ; protected int currentIndent = 0 ; protected int column = 0 ; protected int row = 1 ; /** Construct a UTF8 IndentedWriter around an OutputStream */ public IndentedWriter(OutputStream outStream) { this(outStream, false) ; } /** Construct a UTF8 IndentedWriter around an OutputStream */ public IndentedWriter(OutputStream outStream, boolean withLineNumbers) { this(makeWriter(outStream), withLineNumbers) ; } /** Create an independent copy of the {@code IndentedWriter}. * Changes to the configuration of the copy will not affect the original {@code IndentedWriter}. * This include indentation level. * <br/>Row and column counters are reset. * <br/>Indent is initially. zero. * <br/>They do share the underlying output {@link Writer}. * @param other * @return IndentedWriter */ public static IndentedWriter clone(IndentedWriter other) { IndentedWriter dup = new IndentedWriter(other.out); dup.unitIndent = other.unitIndent; dup.padChar = other.padChar; dup.padString = other.padString; dup.linePrefix = other.linePrefix; dup.lineNumbers = other.lineNumbers; dup.flatMode = other.flatMode; dup.flushOnNewline = other.flushOnNewline; return dup; } private static Writer makeWriter(OutputStream out) { // return BufferingWriter.create(out) ; return IO.asBufferedUTF8(out) ; } /** Using Writers directly is discouraged */ protected IndentedWriter(Writer writer) { this(writer, false) ; } /** Using Writers directly is discouraged */ protected IndentedWriter(Writer writer, boolean withLineNumbers) { out = writer ; lineNumbers = withLineNumbers ; startingNewLine = true ; } @Override public void print(String str) { if ( str == null ) str = "null" ; if ( false ) { // Don't check for embedded newlines. write$(str) ; return ; } for ( int i = 0 ; i < str.length() ; i++ ) printOneChar(str.charAt(i)) ; } @Override public void printf(String formatStr, Object... args) { print(format(formatStr, args)) ; } @Override public void print(char ch) { printOneChar(ch) ; } public void print(Object obj) { print(String.valueOf(obj)); } @Override public void println(String str) { print(str) ; newline() ; } public void println(char ch) { print(ch) ; newline() ; } public void println(Object obj) { print(String.valueOf(obj)); newline(); } @Override public void println() { newline() ; } @Override public void print(char[] cbuf) { for ( char aCbuf : cbuf ) { printOneChar(aCbuf) ; } } /** Print a string N times */ public void print(String s, int n) { for ( int i = 0 ; i < n ; i++ ) print(s) ; } /** Print a char N times */ public void print(char ch, int n) { lineStart() ; for ( int i = 0 ; i < n ; i++ ) printOneChar(ch) ; } private char lastChar = '\0' ; // Worker private void printOneChar(char ch) { // Turn \r\n into a single newline call. // Assumes we don't get \r\r\n etc if ( ch == '\n' && lastChar == '\r' ) { lastChar = ch ; return ; } lineStart() ; lastChar = ch ; // newline if ( ch == '\n' || ch == '\r' ) { newline() ; return ; } write$(ch) ; column += 1 ; } private void write$(char ch) { try { out.write(ch) ; } catch (IOException ex) { IO.exception(ex); } } private void write$(String s) { try { out.write(s) ; } catch (IOException ex) { IO.exception(ex); } } public void newline() { lineStart() ; if ( endOfLineMarker != null ) print(endOfLineMarker) ; if ( !flatMode ) write$('\n') ; startingNewLine = true ; row++ ; column = 0 ; // Note that PrintWriters do not autoflush by default // so if layered over a PrintWriter, need to flush that as well. if ( flushOnNewline ) flush() ; } private boolean atStartOfLine() { return column <= currentIndent ; } public void ensureStartOfLine() { if ( !atStartOfLine() ) newline() ; } @Override public void close() { IO.close(out) ; } @Override public void flush() { IO.flush(out); } /** Pad to the indent (if we are before it) */ public void pad() { if ( startingNewLine && currentIndent > 0 ) lineStart() ; padInternal() ; } /** Pad to a given number of columns EXCLUDING the indent. * * @param col Column number (first column is 1). */ public void pad(int col) { pad(col, false) ; } /** Pad to a given number of columns maybe including the indent. * * @param col Column number (first column is 1). * @param absoluteColumn Whether to include the indent */ public void pad(int col, boolean absoluteColumn) { // Make absolute if ( !absoluteColumn ) col = col + currentIndent ; int spaces = col - column ; for ( int i = 0 ; i < spaces ; i++ ) { write$(' ') ; // Always a space. column++ ; } } private void padInternal() { if ( padString == null ) { for ( int i = column ; i < currentIndent ; i++ ) { write$(padChar) ; column++ ; } } else { for ( int i = column ; i < currentIndent ; i += padString.length() ) { write$(padString) ; column += padString.length() ; } } } /** Get row/line (counts from 1) */ public int getRow() { return row ; } /** Get the absolute column. * This is the location where the next character on the line will be printed. * The IndentedWriter may not yet have padded to this place. */ public int getCol() { if ( currentIndent > column ) return currentIndent ; return column ; } /** Get indent from the left hand edge */ public int getAbsoluteIndent() { return currentIndent ; } /** Set indent from the left hand edge */ public void setAbsoluteIndent(int x) { currentIndent = x ; } /** Position past current indent */ public int getCurrentOffset() { int x = getCol() - getAbsoluteIndent() ; if ( x >= 0 ) return x ; // At start of line somehow. return 0 ; } public boolean hasLineNumbers() { return lineNumbers ; } public void setLineNumbers(boolean lineNumbers) { this.lineNumbers = lineNumbers ; } public String getEndOfLineMarker() { return endOfLineMarker ; } /** Set the marker included at end of line - set to null for "none". Usually used for debugging. */ public void setEndOfLineMarker(String marker) { endOfLineMarker = marker ; } /** Flat mode - print without NL, for a more compact representation*/ public boolean inFlatMode() { return flatMode ; } /** Flat mode - print without NL, for a more compact representation*/ public void setFlatMode(boolean flatMode) { this.flatMode = flatMode ; } /** Flush on newline **/ public boolean getFlushOnNewline() { return flushOnNewline; } /** Flush on newline in this code. * This is set for {@link IndentedWriter#stdout} and {@link IndentedWriter#stderr} * but not by default otherwise. The underlying output, if it is a {@link PrintStream} * may also have a flush on newline as well (e.g {@link System#out}). */ public void setFlushOnNewline(boolean flushOnNewline) { this.flushOnNewline = flushOnNewline; } public char getPadChar() { return padChar ; } public void setPadChar(char ch) { this.padChar = ch ; } public String getPadString() { return padString ; } public void setPadString(String str) { this.padString = str ; unitIndent = str.length(); } /** Initial string printed at the start of each line : defaults to no string. */ public String getLinePrefix() { return linePrefix ; } /** Set the initial string printed at the start of each line. */ public void setLinePrefix(String str) { this.linePrefix = str ; } public void incIndent() { incIndent(unitIndent) ; } public void incIndent(int x) { currentIndent += x ; } public void decIndent() { decIndent(unitIndent) ; } public void decIndent(int x) { currentIndent -= x ; } public void setUnitIndent(int x) { unitIndent = x ; } public int getUnitIndent() { return unitIndent ; } public boolean atLineStart() { return startingNewLine ; } // A line is prefix?number?content. private void lineStart() { if ( flatMode ) { if ( startingNewLine && row > 1 ) // Space between each line. write$(' ') ; startingNewLine = false ; return ; } // Need to do its just before we append anything, not after a NL, // so that a final blank does not cause a prefix or line number. if ( startingNewLine ) { if ( linePrefix != null ) write$(linePrefix) ; insertLineNumber() ; } padInternal() ; startingNewLine = false ; } private int widthLineNumber = 3 ; /** Width of the number field */ public int getNumberWidth() { return widthLineNumber ; } /** Set the width of the number field. * There is also a single space after the number not included in this setting. */ public void setNumberWidth(int widthOfNumbers) { widthLineNumber = widthOfNumbers ; } private void insertLineNumber() { if ( !lineNumbers ) return ; String s = Integer.toString(row) ; for ( int i = 0 ; i < widthLineNumber - s.length() ; i++ ) write$(' ') ; write$(s) ; write$(' ') ; } @Override public String toString() { return String.format("Indent = %d : Row = %d : Col = %d", currentIndent, row, column) ; } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- /** * Copyright (c) Codice Foundation * * This 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 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 Lesser General Public License for more details. A copy of the GNU Lesser General Public License is distributed along with this program and can be found at * <http://www.gnu.org/licenses/lgpl.html>. * **/ --> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> <reference id="securityLogger" interface="ddf.security.audit.SecurityLogger" /> <bean id="securityPlugin" class="org.codice.ddf.catalog.security.logging.SecurityLoggingPlugin"> <property name="securityLogger" ref="securityLogger" /> </bean> <service ref="securityPlugin" auto-export="interfaces" ranking="0"/> </blueprint>
{ "pile_set_name": "Github" }
// -*- C++ -*- // Copyright (C) 2005, 2006 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the terms // of the GNU General Public License as published by the Free Software // Foundation; either version 2, or (at your option) any later // version. // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // You should have received a copy of the GNU General Public License // along with this library; see the file COPYING. If not, write to // the Free Software Foundation, 59 Temple Place - Suite 330, Boston, // MA 02111-1307, USA. // As a special exception, you may use this file as part of a free // software library without restriction. Specifically, if other files // instantiate templates or use macros or inline functions from this // file, or you compile this file and link it with other files to // produce an executable, this file does not by itself cause the // resulting executable to be covered by the GNU General Public // License. This exception does not however invalidate any other // reasons why the executable file might be covered by the GNU General // Public License. // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. // Permission to use, copy, modify, sell, and distribute this software // is hereby granted without fee, provided that the above copyright // notice appears in all copies, and that both that copyright notice // and this permission notice appear in supporting documentation. None // of the above authors, nor IBM Haifa Research Laboratories, make any // representation about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. /** * @file traits.hpp * Contains an implementation class for tree-like classes. */ #ifndef PB_DS_NODE_AND_IT_TRAITS_HPP #define PB_DS_NODE_AND_IT_TRAITS_HPP #include <ext/pb_ds/detail/types_traits.hpp> #include <ext/pb_ds/detail/bin_search_tree_/traits.hpp> #include <ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp> #include <ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp> namespace pb_ds { namespace detail { template<typename Key, typename Data, class Cmp_Fn, template<typename Const_Node_Iterator, class Node_Iterator, class Cmp_Fn_, class Allocator> class Node_Update, class Tag, class Allocator> struct tree_traits; template<typename Key, typename Data, class E_Access_Traits, template<typename Const_Node_Iterator, class Node_Iterator, class E_Access_Traits_, class Allocator> class Node_Update, class Tag, class Allocator> struct trie_traits; } // namespace detail } // namespace pb_ds #include <ext/pb_ds/detail/rb_tree_map_/traits.hpp> #include <ext/pb_ds/detail/splay_tree_/traits.hpp> #include <ext/pb_ds/detail/ov_tree_map_/traits.hpp> #include <ext/pb_ds/detail/pat_trie_/traits.hpp> #endif // #ifndef PB_DS_NODE_AND_IT_TRAITS_HPP
{ "pile_set_name": "Github" }
{ "name": "beep-boop", "version": "1.2.3", "repository" : "git@github.com:substack/beep-boop.git" }
{ "pile_set_name": "Github" }
/* * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 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 com.google.samples.apps.iosched.shared.util import androidx.lifecycle.LiveData import androidx.lifecycle.MediatorLiveData import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.delay import kotlinx.coroutines.isActive import kotlinx.coroutines.launch /** * LiveData that runs a transformation [block] every interval and also whenever a source * LiveData changes. */ class IntervalMediatorLiveData<in P, T>( source: LiveData<P>, dispatcher: CoroutineDispatcher = Dispatchers.Default, private val intervalMs: Long, private val block: (P?) -> T? ) : MediatorLiveData<T>() { private val intervalScope = CoroutineScope(dispatcher + SupervisorJob()) // Nullable because sometimes onInactive is called without onActive first. private var intervalJob: Job? = null private var lastEmitted: P? = null init { addSource(source) { lastEmitted = it // We're on the main thread, so use a coroutine in case the transformation is expensive. intervalScope.launch { postValue(block(lastEmitted)) } } } override fun onActive() { super.onActive() // Loop until canceled. intervalJob = intervalScope.launch { while (isActive) { delay(intervalMs) postValue(block(lastEmitted)) } } } override fun onInactive() { super.onInactive() intervalJob?.cancel() intervalJob = null } }
{ "pile_set_name": "Github" }
package org.broadinstitute.hellbender.utils.codecs.sampileup; /** * Simple representation of a single base with associated quality from a SAM pileup * * @author Daniel Gomez-Sanchez (magicDGS) */ public class SAMPileupElement { /** * The first base */ private final byte base; /** * Base quality for the first base */ private final byte baseQuality; SAMPileupElement(final byte base, final byte baseQuality) { this.base = base; this.baseQuality = baseQuality; } /** * Get the base */ public byte getBase() { return base; } /** * Get the quality */ public byte getBaseQuality() { return baseQuality; } }
{ "pile_set_name": "Github" }
/* * This software Copyright by the RPTools.net development team, and * licensed under the Affero GPL Version 3 or, at your option, any later * version. * * MapTool Source 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. * * You should have received a copy of the GNU Affero General Public * License * along with this source Code. If not, please visit * <http://www.gnu.org/licenses/> and specifically the Affero license * text at <http://www.gnu.org/licenses/agpl.html>. */ package net.rptools.maptool.client; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import org.junit.jupiter.api.Test; public class AppConstantsTest { private File dir = new File("Somedir"); @Test public void propertyFilterMatch() { assertTrue(AppConstants.CAMPAIGN_PROPERTIES_FILE_FILTER.accept(dir, "a.mtprops")); } @Test public void propertyFilterNoMatch() { assertFalse(AppConstants.CAMPAIGN_PROPERTIES_FILE_FILTER.accept(dir, "a.something")); } }
{ "pile_set_name": "Github" }
/*! * body-parser * Copyright(c) 2014-2015 Douglas Christopher Wilson * MIT Licensed */ 'use strict' /** * Module dependencies. */ var bytes = require('bytes') var debug = require('debug')('body-parser:raw') var read = require('../read') var typeis = require('type-is') /** * Module exports. */ module.exports = raw /** * Create a middleware to parse raw bodies. * * @param {object} [options] * @return {function} * @api public */ function raw (options) { var opts = options || {} var inflate = opts.inflate !== false var limit = typeof opts.limit !== 'number' ? bytes.parse(opts.limit || '100kb') : opts.limit var type = opts.type || 'application/octet-stream' var verify = opts.verify || false if (verify !== false && typeof verify !== 'function') { throw new TypeError('option verify must be function') } // create the appropriate type checking function var shouldParse = typeof type !== 'function' ? typeChecker(type) : type function parse (buf) { return buf } return function rawParser (req, res, next) { if (req._body) { debug('body already parsed') next() return } req.body = req.body || {} // skip requests without bodies if (!typeis.hasBody(req)) { debug('skip empty body') next() return } debug('content-type %j', req.headers['content-type']) // determine if request should be parsed if (!shouldParse(req)) { debug('skip parsing') next() return } // read read(req, res, next, parse, debug, { encoding: null, inflate: inflate, limit: limit, verify: verify }) } } /** * Get the simple type checker. * * @param {string} type * @return {function} */ function typeChecker (type) { return function checkType (req) { return Boolean(typeis(req, type)) } }
{ "pile_set_name": "Github" }
/* * JPEG 2000 DSP functions * Copyright (c) 2007 Kamil Nowosad * Copyright (c) 2013 Nicolas Bertrand <nicoinattendu@gmail.com> * * This file is part of FFmpeg. * * FFmpeg 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. * * FFmpeg 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 FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_JPEG2000DSP_H #define AVCODEC_JPEG2000DSP_H #include <stdint.h> #include "jpeg2000dwt.h" typedef struct Jpeg2000DSPContext { void (*mct_decode[FF_DWT_NB])(void *src0, void *src1, void *src2, int csize); } Jpeg2000DSPContext; void ff_jpeg2000dsp_init(Jpeg2000DSPContext *c); void ff_jpeg2000dsp_init_x86(Jpeg2000DSPContext *c); #endif /* AVCODEC_JPEG2000DSP_H */
{ "pile_set_name": "Github" }
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.nineoldandroids.animation; import android.content.Context; import android.content.res.Resources.NotFoundException; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.util.AttributeSet; import android.util.TypedValue; import android.util.Xml; import android.view.animation.AnimationUtils; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.util.ArrayList; /** * This class is used to instantiate animator XML files into Animator objects. * <p> * For performance reasons, inflation relies heavily on pre-processing of * XML files that is done at build time. Therefore, it is not currently possible * to use this inflater with an XmlPullParser over a plain XML file at runtime; * it only works with an XmlPullParser returned from a compiled resource (R. * <em>something</em> file.) */ public class AnimatorInflater { private static final int[] AnimatorSet = new int[] { /* 0 */ android.R.attr.ordering, }; private static final int AnimatorSet_ordering = 0; private static final int[] PropertyAnimator = new int[] { /* 0 */ android.R.attr.propertyName, }; private static final int PropertyAnimator_propertyName = 0; private static final int[] Animator = new int[] { /* 0 */ android.R.attr.interpolator, /* 1 */ android.R.attr.duration, /* 2 */ android.R.attr.startOffset, /* 3 */ android.R.attr.repeatCount, /* 4 */ android.R.attr.repeatMode, /* 5 */ android.R.attr.valueFrom, /* 6 */ android.R.attr.valueTo, /* 7 */ android.R.attr.valueType, }; private static final int Animator_interpolator = 0; private static final int Animator_duration = 1; private static final int Animator_startOffset = 2; private static final int Animator_repeatCount = 3; private static final int Animator_repeatMode = 4; private static final int Animator_valueFrom = 5; private static final int Animator_valueTo = 6; private static final int Animator_valueType = 7; /** * These flags are used when parsing AnimatorSet objects */ private static final int TOGETHER = 0; //private static final int SEQUENTIALLY = 1; /** * Enum values used in XML attributes to indicate the value for mValueType */ private static final int VALUE_TYPE_FLOAT = 0; //private static final int VALUE_TYPE_INT = 1; //private static final int VALUE_TYPE_COLOR = 4; //private static final int VALUE_TYPE_CUSTOM = 5; /** * Loads an {@link com.nineoldandroids.animation.Animator} object from a resource * * @param context Application context used to access resources * @param id The resource id of the animation to load * @return The animator object reference by the specified id * @throws android.content.res.Resources.NotFoundException when the animation cannot be loaded */ public static Animator loadAnimator(Context context, int id) throws NotFoundException { XmlResourceParser parser = null; try { parser = context.getResources().getAnimation(id); return createAnimatorFromXml(context, parser); } catch (XmlPullParserException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } catch (IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { if (parser != null) parser.close(); } } private static Animator createAnimatorFromXml(Context c, XmlPullParser parser) throws XmlPullParserException, IOException { return createAnimatorFromXml(c, parser, Xml.asAttributeSet(parser), null, 0); } private static Animator createAnimatorFromXml(Context c, XmlPullParser parser, AttributeSet attrs, AnimatorSet parent, int sequenceOrdering) throws XmlPullParserException, IOException { Animator anim = null; ArrayList<Animator> childAnims = null; // Make sure we are on a start tag. int type; int depth = parser.getDepth(); while (((type=parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) { if (type != XmlPullParser.START_TAG) { continue; } String name = parser.getName(); if (name.equals("objectAnimator")) { anim = loadObjectAnimator(c, attrs); } else if (name.equals("animator")) { anim = loadAnimator(c, attrs, null); } else if (name.equals("set")) { anim = new AnimatorSet(); TypedArray a = c.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/AnimatorSet); TypedValue orderingValue = new TypedValue(); a.getValue(/*com.android.internal.R.styleable.*/AnimatorSet_ordering, orderingValue); int ordering = orderingValue.type == TypedValue.TYPE_INT_DEC ? orderingValue.data : TOGETHER; createAnimatorFromXml(c, parser, attrs, (AnimatorSet) anim, ordering); a.recycle(); } else { throw new RuntimeException("Unknown animator name: " + parser.getName()); } if (parent != null) { if (childAnims == null) { childAnims = new ArrayList<Animator>(); } childAnims.add(anim); } } if (parent != null && childAnims != null) { Animator[] animsArray = new Animator[childAnims.size()]; int index = 0; for (Animator a : childAnims) { animsArray[index++] = a; } if (sequenceOrdering == TOGETHER) { parent.playTogether(animsArray); } else { parent.playSequentially(animsArray); } } return anim; } private static ObjectAnimator loadObjectAnimator(Context context, AttributeSet attrs) throws NotFoundException { ObjectAnimator anim = new ObjectAnimator(); loadAnimator(context, attrs, anim); TypedArray a = context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/PropertyAnimator); String propertyName = a.getString(/*com.android.internal.R.styleable.*/PropertyAnimator_propertyName); anim.setPropertyName(propertyName); a.recycle(); return anim; } /** * Creates a new animation whose parameters come from the specified context and * attributes set. * * @param context the application environment * @param attrs the set of attributes holding the animation parameters */ private static ValueAnimator loadAnimator(Context context, AttributeSet attrs, ValueAnimator anim) throws NotFoundException { TypedArray a = context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/Animator); long duration = a.getInt(/*com.android.internal.R.styleable.*/Animator_duration, 0); long startDelay = a.getInt(/*com.android.internal.R.styleable.*/Animator_startOffset, 0); int valueType = a.getInt(/*com.android.internal.R.styleable.*/Animator_valueType, VALUE_TYPE_FLOAT); if (anim == null) { anim = new ValueAnimator(); } //TypeEvaluator evaluator = null; int valueFromIndex = /*com.android.internal.R.styleable.*/Animator_valueFrom; int valueToIndex = /*com.android.internal.R.styleable.*/Animator_valueTo; boolean getFloats = (valueType == VALUE_TYPE_FLOAT); TypedValue tvFrom = a.peekValue(valueFromIndex); boolean hasFrom = (tvFrom != null); int fromType = hasFrom ? tvFrom.type : 0; TypedValue tvTo = a.peekValue(valueToIndex); boolean hasTo = (tvTo != null); int toType = hasTo ? tvTo.type : 0; if ((hasFrom && (fromType >= TypedValue.TYPE_FIRST_COLOR_INT) && (fromType <= TypedValue.TYPE_LAST_COLOR_INT)) || (hasTo && (toType >= TypedValue.TYPE_FIRST_COLOR_INT) && (toType <= TypedValue.TYPE_LAST_COLOR_INT))) { // special case for colors: ignore valueType and get ints getFloats = false; anim.setEvaluator(new ArgbEvaluator()); } if (getFloats) { float valueFrom; float valueTo; if (hasFrom) { if (fromType == TypedValue.TYPE_DIMENSION) { valueFrom = a.getDimension(valueFromIndex, 0f); } else { valueFrom = a.getFloat(valueFromIndex, 0f); } if (hasTo) { if (toType == TypedValue.TYPE_DIMENSION) { valueTo = a.getDimension(valueToIndex, 0f); } else { valueTo = a.getFloat(valueToIndex, 0f); } anim.setFloatValues(valueFrom, valueTo); } else { anim.setFloatValues(valueFrom); } } else { if (toType == TypedValue.TYPE_DIMENSION) { valueTo = a.getDimension(valueToIndex, 0f); } else { valueTo = a.getFloat(valueToIndex, 0f); } anim.setFloatValues(valueTo); } } else { int valueFrom; int valueTo; if (hasFrom) { if (fromType == TypedValue.TYPE_DIMENSION) { valueFrom = (int) a.getDimension(valueFromIndex, 0f); } else if ((fromType >= TypedValue.TYPE_FIRST_COLOR_INT) && (fromType <= TypedValue.TYPE_LAST_COLOR_INT)) { valueFrom = a.getColor(valueFromIndex, 0); } else { valueFrom = a.getInt(valueFromIndex, 0); } if (hasTo) { if (toType == TypedValue.TYPE_DIMENSION) { valueTo = (int) a.getDimension(valueToIndex, 0f); } else if ((toType >= TypedValue.TYPE_FIRST_COLOR_INT) && (toType <= TypedValue.TYPE_LAST_COLOR_INT)) { valueTo = a.getColor(valueToIndex, 0); } else { valueTo = a.getInt(valueToIndex, 0); } anim.setIntValues(valueFrom, valueTo); } else { anim.setIntValues(valueFrom); } } else { if (hasTo) { if (toType == TypedValue.TYPE_DIMENSION) { valueTo = (int) a.getDimension(valueToIndex, 0f); } else if ((toType >= TypedValue.TYPE_FIRST_COLOR_INT) && (toType <= TypedValue.TYPE_LAST_COLOR_INT)) { valueTo = a.getColor(valueToIndex, 0); } else { valueTo = a.getInt(valueToIndex, 0); } anim.setIntValues(valueTo); } } } anim.setDuration(duration); anim.setStartDelay(startDelay); if (a.hasValue(/*com.android.internal.R.styleable.*/Animator_repeatCount)) { anim.setRepeatCount( a.getInt(/*com.android.internal.R.styleable.*/Animator_repeatCount, 0)); } if (a.hasValue(/*com.android.internal.R.styleable.*/Animator_repeatMode)) { anim.setRepeatMode( a.getInt(/*com.android.internal.R.styleable.*/Animator_repeatMode, ValueAnimator.RESTART)); } //if (evaluator != null) { // anim.setEvaluator(evaluator); //} final int resID = a.getResourceId(/*com.android.internal.R.styleable.*/Animator_interpolator, 0); if (resID > 0) { anim.setInterpolator(AnimationUtils.loadInterpolator(context, resID)); } a.recycle(); return anim; } }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "WinRenderer.h" #include "RenderCapture.h" #include "RenderFactory.h" #include "RenderFlags.h" #include "rendering/dx/RenderContext.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" #include "utils/log.h" #include "windowing/GraphicContext.h" #include "windowing/WinSystem.h" #include "windows/RendererDXVA.h" #include "windows/RendererShaders.h" #include "windows/RendererSoftware.h" struct render_details { using map = std::map<RenderMethod, int>; using weights_fn = std::function<void(map&, const VideoPicture&)>; using create_fn = std::function<CRendererBase*(CVideoSettings&)>; RenderMethod method; std::string name; create_fn create; weights_fn weights; template<class T> constexpr static render_details get(RenderMethod method, const std::string& name) { return { method, name, T::Create, T::GetWeight }; } }; static std::vector<render_details> RenderMethodDetails = { render_details::get<CRendererSoftware>(RENDER_SW, "Software"), render_details::get<CRendererShaders>(RENDER_PS, "Pixel Shaders"), render_details::get<CRendererDXVA>(RENDER_DXVA, "DXVA"), }; CBaseRenderer* CWinRenderer::Create(CVideoBuffer*) { return new CWinRenderer(); } bool CWinRenderer::Register() { VIDEOPLAYER::CRendererFactory::RegisterRenderer("default", Create); return true; } CWinRenderer::CWinRenderer() { m_format = AV_PIX_FMT_NONE; PreInit(); } CWinRenderer::~CWinRenderer() { CWinRenderer::UnInit(); } CRendererBase* CWinRenderer::SelectRenderer(const VideoPicture& picture) { int iRequestedMethod = CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_VIDEOPLAYER_RENDERMETHOD); CLog::LogF(LOGDEBUG, "requested render method: %d", iRequestedMethod); std::map<RenderMethod, int> weights; for (auto& details : RenderMethodDetails) details.weights(weights, picture); RenderMethod method; switch (iRequestedMethod) { case RENDER_METHOD_SOFTWARE: if (weights[RENDER_SW]) { method = RENDER_SW; break; } // fallback to PS case RENDER_METHOD_D3D_PS: if (weights[RENDER_PS]) { method = RENDER_PS; break; } //fallback to DXVA case RENDER_METHOD_DXVA: if (weights[RENDER_DXVA]) { method = RENDER_DXVA; break; } // fallback to AUTO case RENDER_METHOD_AUTO: default: { const auto it = std::max_element(weights.begin(), weights.end(), [](auto& w1, auto& w2) { return w1.second < w2.second; }); if (it != weights.end()) { method = it->first; break; } // there is no elements in weights, so no renderer which supports incoming video buffer CLog::LogF(LOGERROR, "unable to select render method for video buffer"); return nullptr; } } const auto it = std::find_if(RenderMethodDetails.begin(), RenderMethodDetails.end(), [method](render_details& d) { return d.method == method; }); if (it != RenderMethodDetails.end()) { CLog::LogF(LOGDEBUG, "selected render method: {}", it->name); return it->create(m_videoSettings); } // something goes really wrong return nullptr; } CRect CWinRenderer::GetScreenRect() const { CRect screenRect(0.f, 0.f, static_cast<float>(CServiceBroker::GetWinSystem()->GetGfxContext().GetWidth()), static_cast<float>(CServiceBroker::GetWinSystem()->GetGfxContext().GetHeight())); switch (CServiceBroker::GetWinSystem()->GetGfxContext().GetStereoMode()) { case RENDER_STEREO_MODE_SPLIT_HORIZONTAL: screenRect.y2 *= 2; break; case RENDER_STEREO_MODE_SPLIT_VERTICAL: screenRect.x2 *= 2; break; default: break; } return screenRect; } bool CWinRenderer::Configure(const VideoPicture &picture, float fps, unsigned int orientation) { m_sourceWidth = picture.iWidth; m_sourceHeight = picture.iHeight; m_renderOrientation = orientation; m_fps = fps; m_iFlags = GetFlagsChromaPosition(picture.chroma_position) | GetFlagsColorMatrix(picture.color_space, picture.iWidth, picture.iHeight) | GetFlagsColorPrimaries(picture.color_primaries) | GetFlagsStereoMode(picture.stereoMode); m_format = picture.videoBuffer->GetFormat(); // calculate the input frame aspect ratio CalculateFrameAspectRatio(picture.iDisplayWidth, picture.iDisplayHeight); SetViewMode(m_videoSettings.m_ViewMode); ManageRenderArea(); m_renderer.reset(SelectRenderer(picture)); if (!m_renderer || !m_renderer->Configure(picture, fps, orientation)) { m_renderer.reset(); return false; } m_bConfigured = true; return true; } int CWinRenderer::NextBuffer() const { return m_renderer->NextBuffer(); } void CWinRenderer::AddVideoPicture(const VideoPicture &picture, int index) { m_renderer->AddVideoPicture(picture, index); } void CWinRenderer::Update() { if (!m_bConfigured) return; ManageRenderArea(); m_renderer->ManageTextures(); } void CWinRenderer::RenderUpdate(int index, int index2, bool clear, unsigned int flags, unsigned int alpha) { if (!m_bConfigured) return; if (clear) CServiceBroker::GetWinSystem()->GetGfxContext().Clear(DX::Windowing()->UseLimitedColor() ? 0x101010 : 0); DX::Windowing()->SetAlphaBlendEnable(alpha < 255); ManageRenderArea(); m_renderer->Render(index, index2, DX::Windowing()->GetBackBuffer(), m_sourceRect, m_destRect, GetScreenRect(), flags); DX::Windowing()->SetAlphaBlendEnable(true); } bool CWinRenderer::RenderCapture(CRenderCapture* capture) { if (!m_bConfigured) return false; capture->BeginRender(); if (capture->GetState() != CAPTURESTATE_FAILED) { const CRect destRect(0, 0, static_cast<float>(capture->GetWidth()), static_cast<float>(capture->GetHeight())); m_renderer->Render(capture->GetTarget(), m_sourceRect, destRect, GetScreenRect()); capture->EndRender(); return true; } return false; } void CWinRenderer::SetBufferSize(int numBuffers) { if (!m_bConfigured) return; m_renderer->SetBufferSize(numBuffers); } void CWinRenderer::PreInit() { CSingleLock lock(CServiceBroker::GetWinSystem()->GetGfxContext()); m_bConfigured = false; UnInit(); } void CWinRenderer::UnInit() { CSingleLock lock(CServiceBroker::GetWinSystem()->GetGfxContext()); m_renderer.reset(); m_bConfigured = false; } bool CWinRenderer::Flush(bool saveBuffers) { if (!m_bConfigured) return false; return m_renderer->Flush(saveBuffers); } bool CWinRenderer::Supports(ERENDERFEATURE feature) { if(feature == RENDERFEATURE_BRIGHTNESS) return true; if(feature == RENDERFEATURE_CONTRAST) return true; if (feature == RENDERFEATURE_STRETCH || feature == RENDERFEATURE_NONLINSTRETCH || feature == RENDERFEATURE_ZOOM || feature == RENDERFEATURE_VERTICAL_SHIFT || feature == RENDERFEATURE_PIXEL_RATIO || feature == RENDERFEATURE_ROTATION || feature == RENDERFEATURE_POSTPROCESS || feature == RENDERFEATURE_TONEMAP) return true; return false; } bool CWinRenderer::Supports(ESCALINGMETHOD method) { if (!m_bConfigured) return false; return m_renderer->Supports(method); } bool CWinRenderer::WantsDoublePass() { if (!m_bConfigured) return false; return m_renderer->WantsDoublePass(); } bool CWinRenderer::ConfigChanged(const VideoPicture& picture) { if (!m_bConfigured) return true; return picture.videoBuffer->GetFormat() != m_format; } CRenderInfo CWinRenderer::GetRenderInfo() { if (!m_bConfigured) return {}; return m_renderer->GetRenderInfo(); } void CWinRenderer::ReleaseBuffer(int idx) { if (!m_bConfigured) return; m_renderer->ReleaseBuffer(idx); } bool CWinRenderer::NeedBuffer(int idx) { if (!m_bConfigured) return false; return m_renderer->NeedBuffer(idx); }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #pragma once #include "RenderBoxModelObject.h" #include "RenderText.h" #include "TextFlags.h" #include <wtf/IsoMalloc.h> #include <wtf/TypeCasts.h> namespace WebCore { class HitTestRequest; class HitTestResult; class RootInlineBox; // InlineBox represents a rectangle that occurs on a line. It corresponds to // some RenderObject (i.e., it represents a portion of that RenderObject). class InlineBox { WTF_MAKE_ISO_ALLOCATED(InlineBox); public: virtual ~InlineBox(); void assertNotDeleted() const; virtual void deleteLine() = 0; virtual void extractLine() = 0; virtual void attachLine() = 0; virtual bool isLineBreak() const { return renderer().isLineBreak(); } WEBCORE_EXPORT virtual void adjustPosition(float dx, float dy); void adjustLogicalPosition(float deltaLogicalLeft, float deltaLogicalTop) { if (isHorizontal()) adjustPosition(deltaLogicalLeft, deltaLogicalTop); else adjustPosition(deltaLogicalTop, deltaLogicalLeft); } void adjustLineDirectionPosition(float delta) { if (isHorizontal()) adjustPosition(delta, 0); else adjustPosition(0, delta); } void adjustBlockDirectionPosition(float delta) { if (isHorizontal()) adjustPosition(0, delta); else adjustPosition(delta, 0); } virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) = 0; virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction) = 0; #if ENABLE(TREE_DEBUGGING) void showNodeTreeForThis() const; void showLineTreeForThis() const; virtual void outputLineTreeAndMark(WTF::TextStream&, const InlineBox* markedBox, int depth) const; virtual void outputLineBox(WTF::TextStream&, bool mark, int depth) const; virtual const char* boxName() const; #endif bool behavesLikeText() const { return m_bitfields.behavesLikeText(); } void setBehavesLikeText(bool behavesLikeText) { m_bitfields.setBehavesLikeText(behavesLikeText); } virtual bool isInlineElementBox() const { return false; } virtual bool isInlineFlowBox() const { return false; } virtual bool isInlineTextBox() const { return false; } virtual bool isRootInlineBox() const { return false; } virtual bool isSVGInlineTextBox() const { return false; } virtual bool isSVGInlineFlowBox() const { return false; } virtual bool isSVGRootInlineBox() const { return false; } bool hasVirtualLogicalHeight() const { return m_bitfields.hasVirtualLogicalHeight(); } void setHasVirtualLogicalHeight() { m_bitfields.setHasVirtualLogicalHeight(true); } virtual float virtualLogicalHeight() const { ASSERT_NOT_REACHED(); return 0; } bool isHorizontal() const { return m_bitfields.isHorizontal(); } void setIsHorizontal(bool isHorizontal) { m_bitfields.setIsHorizontal(isHorizontal); } virtual FloatRect calculateBoundaries() const { ASSERT_NOT_REACHED(); return FloatRect(); } bool isConstructed() { return m_bitfields.constructed(); } virtual void setConstructed() { m_bitfields.setConstructed(true); } void setExtracted(bool extracted = true) { m_bitfields.setExtracted(extracted); } void setIsFirstLine(bool firstLine) { m_bitfields.setFirstLine(firstLine); } bool isFirstLine() const { return m_bitfields.firstLine(); } void removeFromParent(); InlineBox* nextOnLine() const { return m_nextOnLine; } InlineBox* previousOnLine() const { return m_previousOnLine; } void setNextOnLine(InlineBox* next) { ASSERT(m_parent || !next); m_nextOnLine = next; } void setPreviousOnLine(InlineBox* previous) { ASSERT(m_parent || !previous); m_previousOnLine = previous; } bool nextOnLineExists() const; bool previousOnLineExists() const; virtual bool isLeaf() const { return true; } InlineBox* nextLeafOnLine() const; InlineBox* previousLeafOnLine() const; // Helper functions for editing and hit-testing code. // FIXME: These two functions should be moved to RenderedPosition once the code to convert between // Position and inline box, offset pair is moved to RenderedPosition. InlineBox* nextLeafOnLineIgnoringLineBreak() const; InlineBox* previousLeafOnLineIgnoringLineBreak() const; // FIXME: Hide this once all callers are using tighter types. RenderObject& renderer() const { return m_renderer; } InlineFlowBox* parent() const { assertNotDeleted(); ASSERT_WITH_SECURITY_IMPLICATION(!m_hasBadParent); return m_parent; } void setParent(InlineFlowBox* par) { m_parent = par; } const RootInlineBox& root() const; RootInlineBox& root(); // x() is the left side of the box in the containing block's coordinate system. void setX(float x) { m_topLeft.setX(x); } float x() const { return m_topLeft.x(); } float left() const { return m_topLeft.x(); } // y() is the top side of the box in the containing block's coordinate system. void setY(float y) { m_topLeft.setY(y); } float y() const { return m_topLeft.y(); } float top() const { return m_topLeft.y(); } const FloatPoint& topLeft() const { return m_topLeft; } float width() const { return isHorizontal() ? logicalWidth() : logicalHeight(); } float height() const { return isHorizontal() ? logicalHeight() : logicalWidth(); } FloatSize size() const { return FloatSize(width(), height()); } float right() const { return left() + width(); } float bottom() const { return top() + height(); } // The logicalLeft position is the left edge of the line box in a horizontal line and the top edge in a vertical line. float logicalLeft() const { return isHorizontal() ? m_topLeft.x() : m_topLeft.y(); } float logicalRight() const { return logicalLeft() + logicalWidth(); } void setLogicalLeft(float left) { if (isHorizontal()) setX(left); else setY(left); } // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line. float logicalTop() const { return isHorizontal() ? m_topLeft.y() : m_topLeft.x(); } float logicalBottom() const { return logicalTop() + logicalHeight(); } void setLogicalTop(float top) { if (isHorizontal()) setY(top); else setX(top); } // The logical width is our extent in the line's overall inline direction, i.e., width for horizontal text and height for vertical text. void setLogicalWidth(float w) { m_logicalWidth = w; } float logicalWidth() const { return m_logicalWidth; } // The logical height is our extent in the block flow direction, i.e., height for horizontal text and width for vertical text. float logicalHeight() const; FloatRect logicalFrameRect() const { return isHorizontal() ? FloatRect(m_topLeft.x(), m_topLeft.y(), m_logicalWidth, logicalHeight()) : FloatRect(m_topLeft.y(), m_topLeft.x(), m_logicalWidth, logicalHeight()); } FloatRect frameRect() const { return FloatRect(topLeft(), size()); } WEBCORE_EXPORT virtual int baselinePosition(FontBaseline baselineType) const; WEBCORE_EXPORT virtual LayoutUnit lineHeight() const; WEBCORE_EXPORT virtual int caretMinOffset() const; WEBCORE_EXPORT virtual int caretMaxOffset() const; unsigned char bidiLevel() const { return m_bitfields.bidiEmbeddingLevel(); } void setBidiLevel(unsigned char level) { m_bitfields.setBidiEmbeddingLevel(level); } TextDirection direction() const { return bidiLevel() % 2 ? TextDirection::RTL : TextDirection::LTR; } bool isLeftToRightDirection() const { return direction() == TextDirection::LTR; } int caretLeftmostOffset() const { return isLeftToRightDirection() ? caretMinOffset() : caretMaxOffset(); } int caretRightmostOffset() const { return isLeftToRightDirection() ? caretMaxOffset() : caretMinOffset(); } virtual void clearTruncation() { } bool isDirty() const { return m_bitfields.dirty(); } virtual void markDirty(bool dirty = true) { m_bitfields.setDirty(dirty); } WEBCORE_EXPORT virtual void dirtyLineBoxes(); WEBCORE_EXPORT virtual RenderObject::HighlightState selectionState(); WEBCORE_EXPORT virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth) const; // visibleLeftEdge, visibleRightEdge are in the parent's coordinate system. WEBCORE_EXPORT virtual float placeEllipsisBox(bool ltr, float visibleLeftEdge, float visibleRightEdge, float ellipsisWidth, float &truncatedWidth, bool&); #if !ASSERT_WITH_SECURITY_IMPLICATION_DISABLED void setHasBadParent(); void invalidateParentChildList(); #endif bool visibleToHitTesting() const { return renderer().style().visibility() == Visibility::Visible && renderer().style().pointerEvents() != PointerEvents::None; } const RenderStyle& lineStyle() const { return m_bitfields.firstLine() ? renderer().firstLineStyle() : renderer().style(); } VerticalAlign verticalAlign() const { return lineStyle().verticalAlign(); } // Use with caution! The type is not checked! RenderBoxModelObject* boxModelObject() const { if (!is<RenderText>(m_renderer)) return &downcast<RenderBoxModelObject>(m_renderer); return nullptr; } FloatPoint locationIncludingFlipping() const; void flipForWritingMode(FloatRect&) const; FloatPoint flipForWritingMode(const FloatPoint&) const; void flipForWritingMode(LayoutRect&) const; LayoutPoint flipForWritingMode(const LayoutPoint&) const; bool knownToHaveNoOverflow() const { return m_bitfields.knownToHaveNoOverflow(); } void clearKnownToHaveNoOverflow(); bool dirOverride() const { return m_bitfields.dirOverride(); } void setDirOverride(bool dirOverride) { m_bitfields.setDirOverride(dirOverride); } void setExpansion(float newExpansion) { m_logicalWidth -= m_expansion; m_expansion = newExpansion; m_logicalWidth += m_expansion; } void setExpansionWithoutGrowing(float newExpansion) { ASSERT(!m_expansion); m_expansion = newExpansion; } float expansion() const { return m_expansion; } void setHasHyphen(bool hasHyphen) { m_bitfields.setHasEllipsisBoxOrHyphen(hasHyphen); } void setCanHaveLeftExpansion(bool canHaveLeftExpansion) { m_bitfields.setHasSelectedChildrenOrCanHaveLeftExpansion(canHaveLeftExpansion); } void setCanHaveRightExpansion(bool canHaveRightExpansion) { m_bitfields.setCanHaveRightExpansion(canHaveRightExpansion); } void setForceRightExpansion() { m_bitfields.setForceRightExpansion(true); } void setForceLeftExpansion() { m_bitfields.setForceLeftExpansion(true); } private: InlineBox* m_nextOnLine { nullptr }; // The next element on the same line as us. InlineBox* m_previousOnLine { nullptr }; // The previous element on the same line as us. InlineFlowBox* m_parent { nullptr }; // The box that contains us. RenderObject& m_renderer; private: float m_logicalWidth { 0 }; float m_expansion { 0 }; FloatPoint m_topLeft; #define ADD_BOOLEAN_BITFIELD(name, Name) \ private:\ unsigned m_##name : 1;\ public:\ bool name() const { return m_##name; }\ void set##Name(bool name) { m_##name = name; }\ class InlineBoxBitfields { public: explicit InlineBoxBitfields(bool firstLine = false, bool constructed = false, bool dirty = false, bool extracted = false, bool isHorizontal = true) : m_firstLine(firstLine) , m_constructed(constructed) , m_bidiEmbeddingLevel(0) , m_dirty(dirty) , m_extracted(extracted) , m_hasVirtualLogicalHeight(false) , m_isHorizontal(isHorizontal) , m_endsWithBreak(false) , m_hasSelectedChildrenOrCanHaveLeftExpansion(false) , m_canHaveRightExpansion(false) , m_knownToHaveNoOverflow(true) , m_hasEllipsisBoxOrHyphen(false) , m_dirOverride(false) , m_behavesLikeText(false) , m_forceRightExpansion(false) , m_forceLeftExpansion(false) , m_determinedIfNextOnLineExists(false) , m_nextOnLineExists(false) { } // Some of these bits are actually for subclasses and moved here to compact the structures. // for this class ADD_BOOLEAN_BITFIELD(firstLine, FirstLine); ADD_BOOLEAN_BITFIELD(constructed, Constructed); private: unsigned m_bidiEmbeddingLevel : 6; // The maximium bidi level is 62: http://unicode.org/reports/tr9/#Explicit_Levels_and_Directions public: unsigned char bidiEmbeddingLevel() const { return m_bidiEmbeddingLevel; } void setBidiEmbeddingLevel(unsigned char bidiEmbeddingLevel) { m_bidiEmbeddingLevel = bidiEmbeddingLevel; } ADD_BOOLEAN_BITFIELD(dirty, Dirty); ADD_BOOLEAN_BITFIELD(extracted, Extracted); ADD_BOOLEAN_BITFIELD(hasVirtualLogicalHeight, HasVirtualLogicalHeight); ADD_BOOLEAN_BITFIELD(isHorizontal, IsHorizontal); // for RootInlineBox ADD_BOOLEAN_BITFIELD(endsWithBreak, EndsWithBreak); // Whether the line ends with a <br>. // shared between RootInlineBox and InlineTextBox ADD_BOOLEAN_BITFIELD(hasSelectedChildrenOrCanHaveLeftExpansion, HasSelectedChildrenOrCanHaveLeftExpansion); ADD_BOOLEAN_BITFIELD(canHaveRightExpansion, CanHaveRightExpansion); ADD_BOOLEAN_BITFIELD(knownToHaveNoOverflow, KnownToHaveNoOverflow); ADD_BOOLEAN_BITFIELD(hasEllipsisBoxOrHyphen, HasEllipsisBoxOrHyphen); // for InlineTextBox ADD_BOOLEAN_BITFIELD(dirOverride, DirOverride); ADD_BOOLEAN_BITFIELD(behavesLikeText, BehavesLikeText); // Whether or not this object represents text with a non-zero height. Includes non-image list markers, text boxes, br. ADD_BOOLEAN_BITFIELD(forceRightExpansion, ForceRightExpansion); ADD_BOOLEAN_BITFIELD(forceLeftExpansion, ForceLeftExpansion); private: mutable unsigned m_determinedIfNextOnLineExists : 1; public: bool determinedIfNextOnLineExists() const { return m_determinedIfNextOnLineExists; } void setDeterminedIfNextOnLineExists(bool determinedIfNextOnLineExists) const { m_determinedIfNextOnLineExists = determinedIfNextOnLineExists; } private: mutable unsigned m_nextOnLineExists : 1; public: bool nextOnLineExists() const { return m_nextOnLineExists; } void setNextOnLineExists(bool nextOnLineExists) const { m_nextOnLineExists = nextOnLineExists; } }; #undef ADD_BOOLEAN_BITFIELD InlineBoxBitfields m_bitfields; protected: explicit InlineBox(RenderObject& renderer) : m_renderer(renderer) { } InlineBox(RenderObject& renderer, FloatPoint topLeft, float logicalWidth, bool firstLine, bool constructed, bool dirty, bool extracted, bool isHorizontal, InlineBox* next, InlineBox* previous, InlineFlowBox* parent) : m_nextOnLine(next) , m_previousOnLine(previous) , m_parent(parent) , m_renderer(renderer) , m_logicalWidth(logicalWidth) , m_topLeft(topLeft) , m_bitfields(firstLine, constructed, dirty, extracted, isHorizontal) { } // For RootInlineBox bool endsWithBreak() const { return m_bitfields.endsWithBreak(); } void setEndsWithBreak(bool endsWithBreak) { m_bitfields.setEndsWithBreak(endsWithBreak); } bool hasEllipsisBox() const { return m_bitfields.hasEllipsisBoxOrHyphen(); } bool hasSelectedChildren() const { return m_bitfields.hasSelectedChildrenOrCanHaveLeftExpansion(); } void setHasSelectedChildren(bool hasSelectedChildren) { m_bitfields.setHasSelectedChildrenOrCanHaveLeftExpansion(hasSelectedChildren); } void setHasEllipsisBox(bool hasEllipsisBox) { m_bitfields.setHasEllipsisBoxOrHyphen(hasEllipsisBox); } // For InlineTextBox bool hasHyphen() const { return m_bitfields.hasEllipsisBoxOrHyphen(); } bool canHaveLeftExpansion() const { return m_bitfields.hasSelectedChildrenOrCanHaveLeftExpansion(); } bool canHaveRightExpansion() const { return m_bitfields.canHaveRightExpansion(); } bool forceRightExpansion() const { return m_bitfields.forceRightExpansion(); } bool forceLeftExpansion() const { return m_bitfields.forceLeftExpansion(); } // For InlineFlowBox and InlineTextBox bool extracted() const { return m_bitfields.extracted(); } protected: #if !ASSERT_WITH_SECURITY_IMPLICATION_DISABLED private: static constexpr unsigned deletionSentinelNotDeletedValue = 0xF0F0F0F0U; static constexpr unsigned deletionSentinelDeletedValue = 0xF0DEADF0U; unsigned m_deletionSentinel { deletionSentinelNotDeletedValue }; bool m_hasBadParent { false }; protected: bool m_isEverInChildList { true }; #endif }; #if ASSERT_WITH_SECURITY_IMPLICATION_DISABLED inline InlineBox::~InlineBox() { } inline void InlineBox::assertNotDeleted() const { } #endif } // namespace WebCore #define SPECIALIZE_TYPE_TRAITS_INLINE_BOX(ToValueTypeName, predicate) \ SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToValueTypeName) \ static bool isType(const WebCore::InlineBox& box) { return box.predicate; } \ SPECIALIZE_TYPE_TRAITS_END() #if ENABLE(TREE_DEBUGGING) // Outside the WebCore namespace for ease of invocation from the debugger. void showNodeTree(const WebCore::InlineBox*); void showLineTree(const WebCore::InlineBox*); #endif
{ "pile_set_name": "Github" }
# Copyright (C) 2017 Johnny Vestergaard <jkv@unixcluster.dk> # # 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/>. import os import csv import logging import json from heralding.reporting.base_logger import BaseLogger logger = logging.getLogger(__name__) class FileLogger(BaseLogger): def __init__(self, session_csv_logfile, sessions_json_logfile, auth_logfile): super().__init__() self.auth_log_filehandler = None self.auth_log_writer = None self.session_csv_log_filehandler = None self.session_csv_log_writer = None self.session_json_log_filehandler = None if auth_logfile != "": # Setup CSV logging for auth attempts auth_field_names = [ 'timestamp', 'auth_id', 'session_id', 'source_ip', 'source_port', 'destination_ip', 'destination_port', 'protocol', 'username', 'password', 'password_hash' ] self.auth_log_filehandler, self.auth_log_writer = self.setup_csv_files( auth_logfile, auth_field_names) logger.info( 'File logger: Using %s to log authentication attempts in CSV format.', auth_logfile) if session_csv_logfile != "": # Setup CSV logging for sessions session_field_names = [ 'timestamp', 'duration', 'session_id', 'source_ip', 'source_port', 'destination_ip', 'destination_port', 'protocol', 'num_auth_attempts' ] self.session_csv_log_filehandler, self.session_csv_log_writer = self.setup_csv_files( session_csv_logfile, session_field_names) logger.info( 'File logger: Using %s to log unified session data in CSV format.', session_csv_logfile) if sessions_json_logfile != "": # Setup json logging for logging complete sessions if not os.path.isfile(sessions_json_logfile): self.session_json_log_filehandler = open( sessions_json_logfile, 'w', encoding='utf-8') else: self.session_json_log_filehandler = open( sessions_json_logfile, 'a', encoding='utf-8') logger.info( 'File logger: Using %s to log complete session data in JSON format.', sessions_json_logfile) def setup_csv_files(self, filename, field_names): handler = writer = None if not os.path.isfile(filename): handler = open(filename, 'w', encoding='utf-8') else: handler = open(filename, 'a', encoding='utf-8') writer = csv.DictWriter( handler, fieldnames=field_names, extrasaction='ignore') # empty file, write csv header if os.path.getsize(filename) == 0: writer.writeheader() handler.flush() return handler, writer def loggerStopped(self): for handler in [ self.auth_log_filehandler, self.session_csv_log_filehandler, self.session_json_log_filehandler ]: if handler != None: handler.flush() handler.close() def handle_auth_log(self, data): # for now this logger only handles authentication attempts where we are able # to log both username and password if self.auth_log_filehandler != None: if 'username' in data and 'password' in data: self.auth_log_writer.writerow(data) # meh self.auth_log_filehandler.flush() def handle_session_log(self, data): if data['session_ended']: if self.session_csv_log_filehandler != None: self.session_csv_log_writer.writerow(data) self.session_csv_log_filehandler.flush() if self.session_json_log_filehandler != None: self.session_json_log_filehandler.write(json.dumps(data) + "\n") self.session_json_log_filehandler.flush()
{ "pile_set_name": "Github" }
{ "cells": [ { "cell_type": "markdown", "metadata": { "graffitiCellId": "id_pmse2pa" }, "source": [ "### Loops\n", "\n", "Often it is useful to extend your functionality beyond just one value. One of the most common ways to do this is with loops.\n", "\n", "An example of looking at a whole bunch of values related to what you saw in the last notebook is shown below." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "graffitiCellId": "id_75b5a5a" }, "outputs": [], "source": [ "y = seq(1,100, by = 1)" ] }, { "cell_type": "markdown", "metadata": { "graffitiCellId": "id_5oshvum" }, "source": [ "#### Example 1\n", "\n", "Imagine you want to create a variable x that holds all of the values in y that are divisible by 4. \n", "\n", "<span class=\"graffiti-highlight graffiti-id_5oshvum-id_6lhhg7v\"><i></i>Click here for an example of building a loop.</span>\n", "\n", "Try to solve yourself in the cell below." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "graffitiCellId": "id_qx3oakg" }, "outputs": [], "source": [ "# create a variable x that holds \n", "# all the values of y that are divisible by 4\n" ] }, { "cell_type": "markdown", "metadata": { "graffitiCellId": "id_ee8hwpt" }, "source": [ "#### Example 2\n", "\n", "Now given a number z, can you find the factorial of z?\n", "\n", "For example z = 3, then 3! = `3*2*1` = 6\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "graffitiCellId": "id_1wat7a9" }, "outputs": [], "source": [ "# code your solution to finding the factorial here\n", "\n", "z = # enter number here\n", "factorial.result = # the ending factorial value should be stored in this\n" ] }, { "cell_type": "markdown", "metadata": { "graffitiCellId": "id_idj3b8x" }, "source": [ "<span class=\"graffiti-highlight graffiti-id_ee8hwpt-id_0612lx0\"><i></i>Click here for video solution.</span>" ] } ], "metadata": { "graffiti": { "dataDir": "../../../jupytergraffiti_data/", "firstAuthorId": "12024648559", "id": "id_rwlrb72", "language": "EN" }, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.6" } }, "nbformat": 4, "nbformat_minor": 2 }
{ "pile_set_name": "Github" }
<?php /** * @package Joomla.Platform * @subpackage HTTP * * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * HTTP transport class for using cURL. * * @package Joomla.Platform * @subpackage HTTP * @since 11.3 */ class JHttpTransportCurl implements JHttpTransport { /** * @var JRegistry The client options. * @since 11.3 */ protected $options; /** * Constructor. CURLOPT_FOLLOWLOCATION must be disabled when open_basedir or safe_mode are enabled. * * @param JRegistry $options Client options object. * * @see http://www.php.net/manual/en/function.curl-setopt.php * @since 11.3 * @throws RuntimeException */ public function __construct(JRegistry $options) { if (!function_exists('curl_init') || !is_callable('curl_init')) { throw new RuntimeException('Cannot use a cURL transport when curl_init() is not available.'); } $this->options = $options; } /** * Send a request to the server and return a JHttpResponse object with the response. * * @param string $method The HTTP method for sending the request. * @param JUri $uri The URI to the resource to request. * @param mixed $data Either an associative array or a string to be sent with the request. * @param array $headers An array of request headers to send with the request. * @param integer $timeout Read timeout in seconds. * @param string $userAgent The optional user agent string to send with the request. * * @return JHttpResponse * * @since 11.3 */ public function request($method, JUri $uri, $data = null, array $headers = null, $timeout = null, $userAgent = null) { // Setup the cURL handle. $ch = curl_init(); // Set the request method. $options[CURLOPT_CUSTOMREQUEST] = strtoupper($method); // Don't wait for body when $method is HEAD $options[CURLOPT_NOBODY] = ($method === 'HEAD'); // Initialize the certificate store $options[CURLOPT_CAINFO] = $this->options->get('curl.certpath', __DIR__ . '/cacert.pem'); // If data exists let's encode it and make sure our Content-type header is set. if (isset($data)) { // If the data is a scalar value simply add it to the cURL post fields. if (is_scalar($data) || (isset($headers['Content-Type']) && strpos($headers['Content-Type'], 'multipart/form-data') === 0)) { $options[CURLOPT_POSTFIELDS] = $data; } // Otherwise we need to encode the value first. else { $options[CURLOPT_POSTFIELDS] = http_build_query($data); } if (!isset($headers['Content-Type'])) { $headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8'; } // Add the relevant headers. if (is_scalar($options[CURLOPT_POSTFIELDS])) { $headers['Content-Length'] = strlen($options[CURLOPT_POSTFIELDS]); } } // Build the headers string for the request. $headerArray = array(); if (isset($headers)) { foreach ($headers as $key => $value) { $headerArray[] = $key . ': ' . $value; } // Add the headers string into the stream context options array. $options[CURLOPT_HTTPHEADER] = $headerArray; } // If an explicit timeout is given user it. if (isset($timeout)) { $options[CURLOPT_TIMEOUT] = (int) $timeout; $options[CURLOPT_CONNECTTIMEOUT] = (int) $timeout; } // If an explicit user agent is given use it. if (isset($userAgent)) { $options[CURLOPT_USERAGENT] = $userAgent; } // Set the request URL. $options[CURLOPT_URL] = (string) $uri; // We want our headers. :-) $options[CURLOPT_HEADER] = true; // Return it... echoing it would be tacky. $options[CURLOPT_RETURNTRANSFER] = true; // Override the Expect header to prevent cURL from confusing itself in its own stupidity. // Link: http://the-stickman.com/web-development/php-and-curl-disabling-100-continue-header/ $options[CURLOPT_HTTPHEADER][] = 'Expect:'; // Follow redirects. $options[CURLOPT_FOLLOWLOCATION] = (bool) $this->options->get('follow_location', true); // Set the cURL options. curl_setopt_array($ch, $options); // Execute the request and close the connection. $content = curl_exec($ch); // Check if the content is a string. If it is not, it must be an error. if (!is_string($content)) { $message = curl_error($ch); if (empty($message)) { // Error but nothing from cURL? Create our own $message = 'No HTTP response received'; } throw new RuntimeException($message); } // Get the request information. $info = curl_getinfo($ch); // Close the connection. curl_close($ch); return $this->getResponse($content, $info); } /** * Method to get a response object from a server response. * * @param string $content The complete server response, including headers * as a string if the response has no errors. * @param array $info The cURL request information. * * @return JHttpResponse * * @since 11.3 * @throws UnexpectedValueException */ protected function getResponse($content, $info) { // Create the response object. $return = new JHttpResponse; // Get the number of redirects that occurred. $redirects = isset($info['redirect_count']) ? $info['redirect_count'] : 0; /* * Split the response into headers and body. If cURL encountered redirects, the headers for the redirected requests will * also be included. So we split the response into header + body + the number of redirects and only use the last two * sections which should be the last set of headers and the actual body. */ $response = explode("\r\n\r\n", $content, 2 + $redirects); // Set the body for the response. $return->body = array_pop($response); // Get the last set of response headers as an array. $headers = explode("\r\n", array_pop($response)); // Get the response code from the first offset of the response headers. preg_match('/[0-9]{3}/', array_shift($headers), $matches); $code = count($matches) ? $matches[0] : null; if (is_numeric($code)) { $return->code = (int) $code; } // No valid response code was detected. else { throw new UnexpectedValueException('No HTTP response code found.'); } // Add the response headers to the response object. foreach ($headers as $header) { $pos = strpos($header, ':'); $return->headers[trim(substr($header, 0, $pos))] = trim(substr($header, ($pos + 1))); } return $return; } /** * Method to check if HTTP transport cURL is available for use * * @return boolean true if available, else false * * @since 12.1 */ static public function isSupported() { return function_exists('curl_version') && curl_version(); } }
{ "pile_set_name": "Github" }
stderr 0 stderr 1 stderr 2 stderr 3 stderr 4 stderr 5 stderr 6 stderr 7 stderr 8 stderr 9
{ "pile_set_name": "Github" }
# translation of sl.po to Slovenian # Slovenian translation of Icewm # Copyright (C) 2003,2004 Free Software Foundation, Inc. # Jernej Kovacic <jkovacic AT email DOT si>, 2004 # Jernej Kovacic <jkovacic AT email DOT si>, 2004 # Jernej Kovacic <jkovacic AT email DOT si>, 2004 # Jernej Kovacic <jkovacic AT email DOT si>, 2004 # Jernej Kovacic <jkovacic AT email DOT si>, 2004 # Jernej Kovacic <jkovacic AT email DOT si>, 2004 # Jernej Kovacic <jkovacic AT email DOT si>, 2004 # Jernej Kovacic <jkovacic AT email DOT si>, 2004 # Jernej Kovacic <jkovacic AT email DOT si>, 2004 # Jernej Kovacic <jkovacic AT email DOT si>, 2004 # Jernej Kovacic <jkovacic AT email DOT si>, 2004 # Jernej Kovacic <jkovacic AT email DOT si>, 2004 # Jernej Kovacic <jkovacic@email.si>, 2003 # Jernej Kovacic <jkovacic AT email DOT si>, 2004 msgid "" msgstr "" "Project-Id-Version: sl\n" "Report-Msgid-Bugs-To: https://github.com/bbidulock/icewm/issues\n" "POT-Creation-Date: 2020-09-23 01:18+0200\n" "PO-Revision-Date: 2004-10-03 21:56+0200\n" "Last-Translator: Jernej Kovacic <jkovacic AT email DOT si>\n" "Language-Team: Slovenian <translator-team-sl@lists.sourceforge.net>\n" "Language: sl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.0\n" #: src/aapm.cc:186 src/aapm.cc:465 src/aapm.cc:686 src/aapm.cc:810 msgid " - Power" msgstr " - Napajanje" #: src/aapm.cc:188 src/aapm.cc:468 src/aapm.cc:689 msgid "P" msgstr "P" #: src/aapm.cc:192 src/aapm.cc:442 src/aapm.cc:669 src/aapm.cc:778 msgid " - Charging" msgstr " - Polnim" #: src/aapm.cc:194 src/aapm.cc:444 src/aapm.cc:671 msgid "C" msgstr "C" #: src/aapm.cc:446 msgid " - Full" msgstr "" #: src/aapm.cc:992 #, c-format msgid "power:\t%s" msgstr "" #: src/aclock.cc:173 msgid "CLOCK" msgstr "" #: src/aclock.cc:178 msgid "Date" msgstr "" #: src/aclock.cc:179 src/themes.cc:78 msgid "Default" msgstr "Privzeto" #: src/aclock.cc:180 src/acpustatus.cc:663 src/amailbox.cc:979 #: src/amemstatus.cc:265 msgid "_Disable" msgstr "" #: src/aclock.cc:181 msgid "_UTC" msgstr "" #: src/acpustatus.cc:298 #, fuzzy, c-format msgid "CPU %s Load: %3.2f %3.2f %3.2f, %u" msgstr "Obremenitev CPE: %3.2f %3.2f %3.2f, %u procesov." #: src/acpustatus.cc:304 #, c-format msgid "" "\n" "Ram (free): %5.3f (%.3f) G" msgstr "" #: src/acpustatus.cc:309 #, c-format msgid "" "\n" "Swap (free): %.3f (%.3f) G" msgstr "" #: src/acpustatus.cc:315 #, c-format msgid "" "\n" "ACPI Temp: " msgstr "" #: src/acpustatus.cc:334 src/acpustatus.cc:374 #, c-format msgid "" "\n" "CPU Freq: %.3fGHz" msgstr "" #: src/acpustatus.cc:351 src/acpustatus.cc:658 msgid "CPU" msgstr "" #: src/acpustatus.cc:351 #, fuzzy msgid "Load: " msgstr "Obremenitev CPE" #: src/acpustatus.cc:366 #, c-format msgid "" "\n" "Ram (user): %5.3f (%.3f) G" msgstr "" #. TRANSLATORS: Please translate the string "C" into "Celsius Temperature" in your language. #. TRANSLATORS: Please make sure the translated string could be shown in your non-utf8 locale. #: src/acpustatus.cc:432 msgid "°C" msgstr "" #: src/acpustatus.cc:659 #, c-format msgid "CPU%d" msgstr "" #: src/acpustatus.cc:665 msgid "_Combine" msgstr "" #: src/acpustatus.cc:667 msgid "_Separate" msgstr "" #: src/amailbox.cc:62 #, c-format msgid "Invalid mailbox protocol: \"%s\"" msgstr "Neveljaven protokol elektronske pošte: \"%s\"" #: src/amailbox.cc:64 #, c-format msgid "Invalid mailbox path: \"%s\"" msgstr "Neveljavna pot do poštnega predala: \"%s\"" #: src/amailbox.cc:133 #, c-format msgid "DNS name lookup failed for %s" msgstr "" #: src/amailbox.cc:149 #, fuzzy, c-format msgid "Invalid mailbox port: \"%s\"" msgstr "Neveljavna pot do poštnega predala: \"%s\"" #: src/amailbox.cc:307 #, fuzzy, c-format msgid "Could not connect to %s: %s" msgstr "Ne morem se povezati s strežnikom YIFF: %s" #: src/amailbox.cc:325 #, fuzzy, c-format msgid "Failed to find %s command" msgstr "Neuspešna izvedba %s: %s" #: src/amailbox.cc:353 src/yapp.cc:417 #, fuzzy, c-format msgid "Failed to execute %s" msgstr "Neuspešno odpiranje %s: %s" #: src/amailbox.cc:437 #, c-format msgid "Write to socket failed: %s" msgstr "" #: src/amailbox.cc:683 #, c-format msgid "Using MailBox \"%s\"\n" msgstr "Uporabljam poštni predal \"%s\"\n" #: src/amailbox.cc:816 msgid "Suspended" msgstr "" #: src/amailbox.cc:820 msgid "Error checking mailbox." msgstr "Napaka pri preverjanju elektronske pošte." #: src/amailbox.cc:827 #, fuzzy, c-format msgid "%ld mail message, %ld unread." msgstr "%ld sporočilo." #: src/amailbox.cc:828 #, fuzzy, c-format msgid "%ld mail messages, %ld unread." msgstr "%ld sporočil." #: src/amailbox.cc:834 #, c-format msgid "%ld mail message." msgstr "%ld sporočilo." #: src/amailbox.cc:835 #, c-format msgid "%ld mail messages." msgstr "%ld sporočil." #: src/amailbox.cc:976 msgid "MAIL" msgstr "" #: src/amailbox.cc:978 msgid "_Check" msgstr "" #: src/amailbox.cc:980 msgid "_Suspend" msgstr "" #: src/amemstatus.cc:145 msgid "GB" msgstr "" #: src/amemstatus.cc:149 #, fuzzy msgid "MB" msgstr "M" #: src/amemstatus.cc:153 msgid "kB" msgstr "" #: src/amemstatus.cc:157 msgid "bytes" msgstr "" #: src/amemstatus.cc:177 msgid "Memory Total: " msgstr "" #: src/amemstatus.cc:178 msgid "Free: " msgstr "" #: src/amemstatus.cc:179 msgid "Cached: " msgstr "" #: src/amemstatus.cc:180 msgid "Buffers: " msgstr "" #: src/amemstatus.cc:181 msgid "User: " msgstr "" #: src/amemstatus.cc:263 msgid "MEM" msgstr "" #: src/apppstatus.cc:231 #, c-format msgid "" "Interface %s:\n" " Current rate (in/out):\t%li %s/%li %s\n" " Current average (in/out):\t%lli %s/%lli %s\n" " Transferred (in/out):\t%lli %s/%lli %s\n" " Online time:\t%ld:%02ld:%02ld%s%s" msgstr "" "Vmesnik %s:\n" " Trenutna hitrost (notri/ven):\t%li %s/%li %s\n" " Trenutno povprečje (notri/ven):\t%lli %s/%lli %s\n" " Preneseno (notri/ven):\t%lli %s/%lli %s\n" " Čas priklopa:\t%ld:%02ld:%02ld%s%s" #: src/apppstatus.cc:243 msgid "" "\n" " Caller id:\t" msgstr "" "\n" " Identifikator klicalca:\t" #: src/apppstatus.cc:679 msgid "NET" msgstr "" #: src/aworkspaces.cc:593 src/wmstatus.cc:204 msgid "Workspace: " msgstr "Delovna površina: " #: src/icehelp.cc:1220 msgid "Back" msgstr "Nazaj" #: src/icehelp.cc:1220 msgid "Alt+Left" msgstr "Alt+Levo" #: src/icehelp.cc:1222 msgid "Forward" msgstr "Naprej" #: src/icehelp.cc:1222 msgid "Alt+Right" msgstr "Alt+Desno" #: src/icehelp.cc:1225 msgid "Previous" msgstr "Prejšnji" #: src/icehelp.cc:1226 msgid "Next" msgstr "Naslednji" #: src/icehelp.cc:1228 msgid "Contents" msgstr "Vsebina" #: src/icehelp.cc:1229 msgid "Index" msgstr "Stvarno kazalo" #: src/icehelp.cc:1232 src/icesame.cc:62 src/iceview.cc:68 src/wmbutton.cc:127 msgid "Close" msgstr "Zapri" #: src/icehelp.cc:1232 src/icesame.cc:62 src/iceview.cc:68 msgid "Ctrl+Q" msgstr "Ctrl+Q" #: src/icehelp.cc:1237 msgid "Icewm(1)" msgstr "" #: src/icehelp.cc:1239 msgid "Icewmbg(1)" msgstr "" #: src/icehelp.cc:1241 msgid "Icesound(1)" msgstr "" #: src/icehelp.cc:1243 msgid "FAQ" msgstr "" #: src/icehelp.cc:1245 msgid "Manual" msgstr "" #: src/icehelp.cc:1247 msgid "Support" msgstr "" #: src/icehelp.cc:1249 #, fuzzy msgid "Theme Howto" msgstr "Avtor teme:" #: src/icehelp.cc:1251 msgid "Website" msgstr "" #: src/icehelp.cc:1253 msgid "Github" msgstr "" #: src/icehelp.cc:1956 #, fuzzy msgid "Unsupported protocol." msgstr "Nepodprt vmesnik: %s." #: src/icehelp.cc:1981 #, c-format msgid "Invalid path: %s\n" msgstr "Neveljavna pot: %s\n" #: src/icehelp.cc:2004 msgid "Path does not refer to a file." msgstr "" #: src/icehelp.cc:2009 msgid "Failed to open file for reading." msgstr "" #: src/icehelp.cc:2038 #, fuzzy msgid "Failed to create a temporary file" msgstr "Neuspešna izdelava anonimne cevi: %s" #: src/icehelp.cc:2131 #, c-format msgid "Failed to execute system(%s) (%d)" msgstr "" #: src/icehelp.cc:2154 #, fuzzy, c-format msgid "Failed to decompress %s" msgstr "Neuspešno odpiranje %s: %s" #: src/icehelp.cc:2162 msgid "Could not locate curl or wget in PATH" msgstr "" #: src/icehelp.cc:2166 msgid "Unsafe characters in URL" msgstr "" #: src/icehelp.cc:2203 #, c-format msgid "" "Usage: %s [OPTIONS] [ FILENAME | URL ]\n" "\n" "IceHelp is a very simple HTML browser for the IceWM window manager.\n" "It can display a HTML document from file, or browse a website.\n" "It remembers visited pages in a history, which is navigable\n" "by key bindings and a context menu (right mouse click).\n" "It neither supports rendering of images nor JavaScript.\n" "If no file or URL is given it will display the IceWM Manual\n" "from %s.\n" "\n" "Options:\n" " -d, --display=NAME NAME of the X server to use.\n" " --sync Synchronize X11 commands.\n" "\n" " -B Display the IceWM icewmbg manpage.\n" " -b, --bugs Display the IceWM bug reports (primitively).\n" " -f, --faq Display the IceWM FAQ and Howto.\n" " -g Display the IceWM Github website.\n" " -i, --icewm Display the IceWM icewm manpage.\n" " -m, --manual Display the IceWM Manual (default).\n" " -s Display the IceWM icesound manpage.\n" " -t, --theme Display the IceWM themes Howto.\n" " -w, --website Display the IceWM website.\n" "\n" " -V, --version Prints version information and exits.\n" " -h, --help Prints this usage screen and exits.\n" "\n" "Environment variables:\n" " DISPLAY=NAME Name of the X server to use.\n" "\n" "To report bugs, support requests, comments please visit:\n" "%s\n" "\n" msgstr "" #: src/icehelp.cc:2282 #, fuzzy, c-format msgid "Ignoring option '%s'" msgstr "Neznano dejanje: `%s'" #: src/icelist.cc:60 msgid "List View" msgstr "Seznamski pogled" #: src/icelist.cc:61 msgid "Icon View" msgstr "Ikonski pogled" #: src/icelist.cc:65 msgid "Open" msgstr "Odpri" #: src/icesame.cc:57 msgid "Undo" msgstr "Prekliči" #: src/icesame.cc:57 msgid "Ctrl+Z" msgstr "Ctrl+z" #: src/icesame.cc:59 msgid "New" msgstr "Nov" #: src/icesame.cc:59 msgid "Ctrl+N" msgstr "Ctrl+N" #: src/icesame.cc:60 msgid "Restart" msgstr "Zaženi znova" #: src/icesame.cc:60 msgid "Ctrl+R" msgstr "Ctrl+R" #: src/icesame.cc:65 msgid "Same Game" msgstr "Ista igra" #: src/icesh.cc:74 msgid "For help please consult the man page icesh(1).\n" msgstr "" #: src/icesh.cc:1571 #, c-format msgid "Named symbols of the domain `%s' (numeric range: %ld-%ld):\n" msgstr "Poimenovani simboli domene `%s' (številski razpon: %ld-%ld):\n" #: src/icesh.cc:1719 #, fuzzy, c-format msgid "Workspace out of range: %ld" msgstr "Delovna površina izven področja: %d" #: src/icesh.cc:1740 #, c-format msgid "Invalid workspace name: `%s'" msgstr "Neveljavno ime delovne površine: `%s'" #: src/icesh.cc:2017 msgid "GNOME window state" msgstr "stanje Gnomovega okna" #: src/icesh.cc:2018 msgid "GNOME window hint" msgstr "nasvet Gnomovega okna" #: src/icesh.cc:2019 msgid "GNOME window layer" msgstr "sloj Gnomovega okna" #: src/icesh.cc:2020 msgid "IceWM tray option" msgstr "izbira IceWM-ovegapladnja" #: src/icesh.cc:2021 msgid "Gravity symbols" msgstr "" #: src/icesh.cc:2022 #, fuzzy #| msgid "Favorite applications" msgid "Motif functions" msgstr "Priljubljeni programi" #: src/icesh.cc:2023 #, fuzzy #| msgid "Favorite applications" msgid "Motif decorations" msgstr "Priljubljeni programi" #: src/icesh.cc:2024 #, fuzzy #| msgid "GNOME window state" msgid "EWMH window state" msgstr "stanje Gnomovega okna" #: src/icesh.cc:2106 src/icesh.cc:2179 #, c-format msgid "workspace #%d: `%s'\n" msgstr "delovna površina #%d: `%s'\n" #: src/icesh.cc:2415 src/icesh.cc:3587 src/icesh.cc:3601 src/icesh.cc:4072 #, fuzzy, c-format #| msgid "Invalid argument: `%s'." msgid "Invalid state: `%s'." msgstr "Neveljaven argument %s'." #: src/icesh.cc:3240 #, c-format msgid "Cannot get geometry of window 0x%lx" msgstr "" #: src/icesh.cc:3265 #, fuzzy, c-format #| msgid "Invalid argument: `%s'." msgid "Invalid Xinerama: `%s'." msgstr "Neveljaven argument %s'." #: src/icesh.cc:3315 #, c-format msgid "Action `%s' requires at least %d arguments." msgstr "Dejanje `%s' zahteva vsaj %d argumentov." #: src/icesh.cc:3325 #, c-format msgid "Invalid expression: `%s'" msgstr "Neveljaven izraz: `%s'" #: src/icesh.cc:3336 src/icesound.cc:799 src/icewmhint.cc:36 src/wmapp.cc:1118 #: src/yxapp.cc:1047 #, c-format msgid "Can't open display: %s. X must be running and $DISPLAY set." msgstr "" "Ne morem odpreti prikaza: %s. X mora teči in $DISPLAY mora biti nastavljen." #: src/icesh.cc:3349 #, fuzzy, c-format #| msgid "Invalid argument: `%s'." msgid "Invalid argument: `%s'" msgstr "Neveljaven argument %s'." #: src/icesh.cc:3384 msgid "No windows found." msgstr "" #: src/icesh.cc:3399 msgid "No actions specified." msgstr "Nobeno dejanje ni določeno." #: src/icesh.cc:3504 #, c-format msgid "Invalid window identifier: `%s'" msgstr "Neveljaven identifikator okna: `%s'" #: src/icesh.cc:3521 #, fuzzy, c-format #| msgid "Invalid argument: `%s'." msgid "Invalid PID: `%s'" msgstr "Neveljaven argument %s'." #: src/icesh.cc:3557 #, fuzzy, c-format #| msgid "Invalid argument: `%s'." msgid "Invalid layer: `%s'." msgstr "Neveljaven argument %s'." #: src/icesh.cc:4393 #, c-format msgid "Unknown action: `%s'" msgstr "Neznano dejanje: `%s'" #: src/iceskt.cc:42 #, c-format msgid "Socket error: %d" msgstr "Napaka priključka :%d" #: src/icesm.cc:69 msgid "" " -c, --config=FILE Let IceWM load preferences from FILE.\n" " -t, --theme=FILE Let IceWM load the theme from FILE.\n" "\n" " -d, --display=NAME Use NAME to connect to the X server.\n" " -a, --alpha Use a 32-bit visual for translucency.\n" " --sync Synchronize communication with X11 server.\n" "\n" " -i, --icewm=FILE Use FILE as the IceWM window manager.\n" " -o, --output=FILE Redirect all output to FILE.\n" "\n" " -b, --nobg Do not start icewmbg.\n" " -n, --notray Do not start icewmtray.\n" " -s, --sound Also start icesound.\n" msgstr "" #: src/icesm.cc:85 msgid "" "\n" "Debugging options:\n" " -v, --valgrind Let \"/usr/bin/valgrind\" run icewm.\n" " Thoroughly examines the execution of icewm.\n" " -g, --catchsegv Let \"/usr/bin/catchsegv\" run icewm.\n" " Gives a backtrace if icewm segfaults.\n" msgstr "" #: src/icesm.cc:188 #, fuzzy, c-format msgid "Unknown option '%s'" msgstr "Neznano dejanje: `%s'" #: src/icesm.cc:452 src/icesm.cc:612 #, fuzzy, c-format #| msgid "Restart" msgid "restart %s." msgstr "Zaženi znova" #: src/icesm.cc:458 #, c-format msgid "%s exited with status %d." msgstr "" #: src/icesm.cc:464 src/icesm.cc:618 #, c-format msgid "%s was killed by signal %d." msgstr "" #: src/icesm.cc:503 msgid "" " IceWM crashed for the second time in 10 seconds. \n" " Do you wish to:\n" "\n" "\t1: Restart IceWM?\n" "\t2: Abort this session?\n" "\t3: Run a terminal?\n" msgstr "" #: src/icesm.cc:509 #, fuzzy #| msgid "IceWM tray option" msgid "IceWM crash response" msgstr "izbira IceWM-ovegapladnja" #: src/icesound.cc:216 src/icesound.cc:324 src/icesound.cc:484 #, c-format msgid "Playing sample #%d (%s)" msgstr "Predvajam vzorec #%d (%s)" #: src/icesound.cc:334 #, c-format msgid "%s: Invalid number of channels" msgstr "" #: src/icesound.cc:340 src/icesound.cc:345 msgid "Could not set OSS channels" msgstr "" #: src/icesound.cc:350 src/icesound.cc:378 msgid "Could not sync OSS" msgstr "" #: src/icesound.cc:362 msgid "OSS write failed" msgstr "" #: src/icesound.cc:366 #, c-format msgid "OSS incomplete write (%d/%d)" msgstr "" #: src/icesound.cc:373 #, fuzzy msgid "Could not post OSS" msgstr "Ne morem naložiti nabora pisav \"%s\"." #: src/icesound.cc:402 #, fuzzy, c-format msgid "Could not open OSS device %s" msgstr "Ne najdem zemljevida točk %s" #: src/icesound.cc:407 msgid "Could not set OSS stereo" msgstr "" #: src/icesound.cc:412 msgid "Could not reset OSS DSP" msgstr "" #: src/icesound.cc:417 msgid "Could not set OSS format" msgstr "" #: src/icesound.cc:504 #, c-format msgid "ao_open_live failed with %d" msgstr "" #: src/icesound.cc:515 msgid "ao_play failed" msgstr "" #: src/icesound.cc:681 #, c-format msgid "Unrecognized option: %s\n" msgstr "Neprepoznana izbira: %s\n" #: src/icesound.cc:684 src/icesound.cc:977 #, c-format msgid "Unrecognized argument: %s\n" msgstr "Neprepoznan argument: %s\n" #: src/icesound.cc:693 #, fuzzy, c-format msgid "" "Usage: %s [OPTION]...\n" "\n" "Plays audio files on GUI events raised by IceWM.\n" "The currently configured sound interfaces are: %s.\n" "Icesound will choose the first of these which is usable.\n" "\n" "Options:\n" "\n" " -d, --display=DISPLAY X11 display used by IceWM (default: $DISPLAY).\n" "\n" " -s, --sample-dir=DIR Specifies a directory with sound files.\n" " Default is $HOME/.config/icewm/sounds.\n" "\n" " -i, --interface=LIST Specifies audio output interfaces. One or more of:\n" " %s separated by commas.\n" "\n" " -D, --device=DEVICE Backwards compatibility only: the default device. \n" " Please prefer one of the -A/-O/-S options.\n" "\n" " -O, --oss=DEVICE Specifies the OSS device (default: \"%s\").\n" "\n" " -A, --alsa=DEVICE Specifies the ALSA device (default: \"%s\").\n" "\n" " -z, --snooze=millisecs Specifies the snooze interval between sound events\n" " in milliseconds. Default is 500 milliseconds.\n" "\n" " -p, --play=sound Plays the given sound (name or number) and exits.\n" "\n" " -l, --list-files Lists the available sound file paths and exits.\n" "\n" " --list-sounds Lists the supported sound filenames and exits.\n" "\n" " --list-interfaces Lists the supported audio interfaces and exits.\n" "\n" " -v, --verbose Be verbose and print out each sound event.\n" "\n" " -V, --version Prints version information and exits.\n" "\n" " -h, --help Prints this help screen and exits.\n" "\n" "Return values:\n" "\n" " 0 Success.\n" " 1 General error.\n" " 2 Command line error.\n" " 3 Subsystems error (ie cannot connect to server).\n" "\n" msgstr "" "Uporaba: %s [IZBIRE]...\n" "\n" "Predvaja zvočne datoteke ob dogodkih IceWMovega grafičnega uporabniškega " "vmesnika.\n" "\n" "Izbire:\n" "\n" "-d, --display=PRIKAZ Prikaz, ki ga uporablja IceWM (privzeto: " "$DISPLAY).\n" "-s, --sample-dir=IMENIK Določi imenik, ki vsebuje\n" " zvočne datoteke (t.j. ~/.icewm/sounds).\n" "-i, --interface=TARČA Določi tarčo zvočnega vmesnika izhoda,\n" " npr. ALSA, OSS, YIFF, ESD\n" "-D, --device=NAPRAVA (ALSA OSS) določi digitalni signalni\n" " procesor (privzeto (ALSA) default (OSS) /dev/" "dsp).\n" "-S, --server=NASLOV:VRATA (ESD in YIFF) določi naslov strežnika in\n" " številko vrat (privzeto localhost:16001 za " "ESD\n" " in localhost:9433 za YIFF).\n" "-m, --audio-mode[=NAČIN] (samo YIFF) določi zvočni način (pustite\n" " prazno, če želite seznam).\n" "--audio-mode-auto (samo YIFF) sproti spremeni zvočni način na\n" " najboljše ujemanje zvočnega vzorca (lahko " "povzroči\n" " težave z ostalimi odjemalci Y, prepiše\n" " --audio-mode).\n" "\n" "-v, --verbose Razvlečen izpis (izpiše vsak zvočni dogodek " "na\n" " stdout).\n" "-V, --version Izpiše podatke o različici in konča.\n" "-h, --help Izpiše (to) zaslonsko pomoč in konča.\n" "\n" "Vrnjene vrednosti:\n" "\n" "0 Uspešno.\n" "1 Splošna napaka.\n" "2 Napaka v ukazni vrstici.\n" "3 Napaka podsistema (npr. neuspešna povezava s strežnikom).\n" "\n" #: src/icesound.cc:784 #, c-format msgid "No audio for %s" msgstr "" #: src/icesound.cc:861 msgid "Could not get GUI event property" msgstr "" #: src/icesound.cc:865 #, c-format msgid "Received invalid GUI event %d" msgstr "" #: src/icesound.cc:869 #, c-format msgid "Received GUI event %s" msgstr "" #: src/icesound.cc:883 #, c-format msgid "Too quick; ignoring %s." msgstr "" #: src/icesound.cc:887 #, c-format msgid "Support for the %s interface not compiled." msgstr "Podpora za vmesnik %s ni prevedena." #: src/icesound.cc:920 #, c-format msgid "Unsupported interface: %s." msgstr "Nepodprt vmesnik: %s." #: src/icesound.cc:929 #, c-format msgid "Using %s audio." msgstr "" #: src/icesound.cc:933 #, fuzzy, c-format msgid "Failed to connect to audio interfaces %s." msgstr "Neuspešno odpiranje %s: %s" #: src/icesound.cc:945 #, fuzzy, c-format msgid "Received signal %s: Terminating..." msgstr "Prejel signal %d: končujem..." #: src/icetray.cc:231 msgid "" " -n, --notify Notify parent process by sending signal USR1.\n" " --display=NAME Use NAME to connect to the X server.\n" " --sync Synchronize communication with X11 server.\n" "\n" " -c, --config=FILE Load preferences from FILE.\n" " -t, --theme=FILE Load the theme from FILE.\n" msgstr "" #: src/iceview.cc:64 msgid "Hex View" msgstr "Pogled v šestnajstiškem načinu" #: src/iceview.cc:64 msgid "Ctrl+H" msgstr "Ctrl+H" #: src/iceview.cc:65 msgid "Expand Tabs" msgstr "Razširi uhlje" #: src/iceview.cc:65 msgid "Ctrl+T" msgstr "Ctrl+T" #: src/iceview.cc:66 msgid "Wrap Lines" msgstr "Prelom vrstic" #: src/iceview.cc:66 msgid "Ctrl+W" msgstr "Ctrl+W" #: src/icewmbg.cc:74 #, fuzzy, c-format msgid "Failed to load image '%s'." msgstr "Neuspešno odpiranje %s: %s" #: src/icewmbg.cc:881 #, fuzzy msgid "" "Usage: icewmbg [OPTIONS]\n" "Where multiple values can be given they are separated by commas.\n" "When image is a directory then all images from that directory are used.\n" "\n" "Options:\n" " -p, --replace Replace an existing icewmbg.\n" " -q, --quit Tell the running icewmbg to quit.\n" " -r, --restart Tell the running icewmbg to restart itself.\n" " -u, --shuffle Shuffle/reshuffle the list of background images.\n" "\n" " -c, --config=FILE Load preferences from FILE.\n" " -t, --theme=NAME Load the theme with name NAME.\n" "\n" " -i, --image=FILE(S) Load background image(s) from FILE(S).\n" " -k, --color=NAME(S) Use background color(s) from NAME(S).\n" "\n" " -s, --semis=FILE(S) Load transparency image(s) from FILE(S).\n" " -x, --trans=NAME(S) Use transparency color(s) from NAME(S).\n" "\n" " -e, --center=0/1 Disable/Enable centering background.\n" " -a, --scaled=0/1 Disable/Enable scaling background.\n" " -m, --multi=0/1 Disable/Enable multihead background.\n" " -y, --cycle=SECONDS Cycle backgrounds every SECONDS.\n" "\n" " --display=NAME Use NAME to connect to the X server.\n" " --sync Synchronize communication with X11 server.\n" "\n" " -h, --help Print this usage screen and exit.\n" " -V, --version Prints version information and exits.\n" "\n" "Loads desktop background according to preferences file:\n" " DesktopBackgroundCenter - Display desktop background centered\n" " DesktopBackgroundScaled - Display desktop background scaled\n" " DesktopBackgroundColor - Desktop background color(s)\n" " DesktopBackgroundImage - Desktop background image(s)\n" " ShuffleBackgroundImages - Shuffle the list of background images\n" " SupportSemitransparency - Support for semitransparent terminals\n" " DesktopTransparencyColor - Semitransparency background color(s)\n" " DesktopTransparencyImage - Semitransparency background image(s)\n" " DesktopBackgroundMultihead - One background over all monitors\n" " CycleBackgroundsPeriod - Seconds between cycling over backgrounds\n" "\n" " center:0 scaled:0 = tiled\n" " center:1 scaled:0 = centered\n" " center:1 scaled:1 = fill one dimension and keep aspect ratio\n" " center:0 scaled:1 = fill both dimensions and keep aspect ratio\n" "\n" msgstr "" "Uporaba: icewmbg [ -r | -q ]\n" " -r Ponoven zagon icewmbg\n" " -q Končaj icewmbg\n" "Naloži ozadje namizja v skladu z datoteko prednastavitev\n" " DesktopBackgroundCenter - Prikaži ozadje namizja usredinjeno, ne zloženo\n" " SupportSemitransparency - Podpora polprosojnih terminalov\n" " DesktopBackgroundColor - Barva ozadja namizja\n" " DesktopBackgroundImage - Slika ozadja namizja\n" " DesktopTransparencyColor - Barva oznanitve polprosojnih oken\n" " DesktopTransparencyImage - Slika oznanitve polprosojnih oken\n" #: src/icewmbg.cc:1096 msgid "Cannot start, because another icewmbg is still running." msgstr "" #: src/icewmhint.cc:19 #, fuzzy msgid "Usage: icewmhint class.instance option arg\n" msgstr "Uporaba: icewmhint [primer.razreda] izbira argument\n" #: src/icewmhint.cc:56 #, c-format msgid "Out of memory (len=%d)." msgstr "Ni dovolj pomnilnika (dolžina=%d)." #: src/misc.cc:73 src/misc.cc:85 msgid "Warning: " msgstr "Opozorilo: " #: src/misc.cc:379 #, c-format msgid "" "Usage: %s [OPTIONS]\n" "Options:\n" "%s\n" " -C, --copying Prints license information and exits.\n" " -V, --version Prints version information and exits.\n" " -h, --help Prints this usage screen and exits.\n" "\n" msgstr "" #: src/movesize.cc:875 #, c-format msgid "Unknown direction in move/resize request: %d" msgstr "Neznana smer pri zhtevi premika/spremembe velikosti: %d" #: src/wmabout.cc:23 src/wmabout.cc:25 msgid "(C)" msgstr "(C)" #: src/wmabout.cc:31 msgid "Theme:" msgstr "Tema:" #: src/wmabout.cc:32 msgid "Theme Description:" msgstr "Opis teme:" #: src/wmabout.cc:33 msgid "Theme Author:" msgstr "Avtor teme:" #: src/wmabout.cc:37 msgid "CodeSet:" msgstr "" #: src/wmabout.cc:38 msgid "Language:" msgstr "" #: src/wmabout.cc:64 msgid "icewm - About" msgstr "O IceWM" #: src/wmapp.cc:79 #, fuzzy msgid "A window manager is already running, use --replace to replace it" msgstr "Drug upravljalnik oken že teče, končujem..." #: src/wmapp.cc:97 #, c-format msgid "Failed to become the owner of the %s selection" msgstr "" #: src/wmapp.cc:101 msgid "Waiting to replace the old window manager" msgstr "" #: src/wmapp.cc:106 msgid "done." msgstr "" #: src/wmapp.cc:418 msgid "_Logout" msgstr "_Odjava" #: src/wmapp.cc:419 msgid "_Cancel logout" msgstr "Prekli_c odjave" #: src/wmapp.cc:424 msgid "Lock _Workstation" msgstr "_Zakleni delovno postajo" #: src/wmapp.cc:426 src/wmdialog.cc:72 msgid "Re_boot" msgstr "Ponoven _zagon sistema" #: src/wmapp.cc:428 src/wmdialog.cc:73 msgid "Shut_down" msgstr "Zaustavitev _sistema" #. TRANSLATORS: This means "energy saving mode" or "suspended system". Not "interrupt". Not "hibernate". #: src/wmapp.cc:430 src/wmdialog.cc:69 msgid "_Sleep mode" msgstr "" #: src/wmapp.cc:435 msgid "Restart _Icewm" msgstr "Ponoven zagon _IceWM" #: src/wmapp.cc:437 msgid "Restart _Xterm" msgstr "Ponoven zagon _Xterma" #: src/wmapp.cc:447 msgid "_Menu" msgstr "_Menu" #: src/wmapp.cc:448 msgid "_Above Dock" msgstr "Nad sid_rom" #: src/wmapp.cc:449 msgid "_Dock" msgstr "_Zasidraj" #: src/wmapp.cc:450 msgid "_OnTop" msgstr "Na _vrh" #: src/wmapp.cc:451 msgid "_Normal" msgstr "_Običajno" #: src/wmapp.cc:452 msgid "_Below" msgstr "_Spodaj" #: src/wmapp.cc:453 msgid "D_esktop" msgstr "_Namizje" #: src/wmapp.cc:488 src/wmwinlist.cc:359 msgid "_Restore" msgstr "O_bnovi" #: src/wmapp.cc:490 msgid "_Move" msgstr "P_restavi" #: src/wmapp.cc:492 msgid "_Size" msgstr "Velikos_t" #: src/wmapp.cc:494 src/wmwinlist.cc:360 msgid "Mi_nimize" msgstr "Poma_njšaj" #: src/wmapp.cc:496 src/wmwinlist.cc:361 msgid "Ma_ximize" msgstr "R_azpni" #: src/wmapp.cc:497 src/wmwinlist.cc:362 #, fuzzy #| msgid "Maximize" msgid "Maximize_Vert" msgstr "Razpni" #: src/wmapp.cc:498 src/wmwinlist.cc:363 #, fuzzy #| msgid "Maximize" msgid "MaximizeHori_z" msgstr "Razpni" #: src/wmapp.cc:501 src/wmwinlist.cc:364 msgid "_Fullscreen" msgstr "_Celoten zaslon" #: src/wmapp.cc:504 src/wmwinlist.cc:366 msgid "_Hide" msgstr "S_krij" #: src/wmapp.cc:506 src/wmwinlist.cc:367 msgid "Roll_up" msgstr "Navz_gor" #: src/wmapp.cc:513 msgid "R_aise" msgstr "_Dvigni" #: src/wmapp.cc:515 src/wmwinlist.cc:369 msgid "_Lower" msgstr "_Spusti" #: src/wmapp.cc:517 src/wmwinlist.cc:370 msgid "La_yer" msgstr "S_loj" #: src/wmapp.cc:521 src/wmwinlist.cc:372 msgid "Move _To" msgstr "Prestavi _v" #: src/wmapp.cc:522 src/wmwinlist.cc:373 msgid "Occupy _All" msgstr "Za_sedi vse" #: src/wmapp.cc:528 msgid "Limit _Workarea" msgstr "_Omeji delovno površino" #: src/wmapp.cc:532 src/wmwinlist.cc:374 msgid "Tray _icon" msgstr "Pladenj z _ikonami" #: src/wmapp.cc:537 src/wmwinlist.cc:389 src/wmwinlist.cc:397 msgid "_Close" msgstr "_Zapri" #: src/wmapp.cc:539 src/wmwinlist.cc:391 msgid "_Kill Client" msgstr "_Ubij odjemalca" #: src/wmapp.cc:542 src/wmdialog.cc:74 src/wmwinmenu.cc:130 msgid "_Window list" msgstr "_Seznam oken" #: src/wmapp.cc:575 msgid "Another window manager already running, exiting..." msgstr "Drug upravljalnik oken že teče, končujem..." #: src/wmapp.cc:647 #, c-format msgid "" "Could not restart: %s\n" "Does $PATH lead to %s?" msgstr "" "Ne morem ponovno zagnati: %s\n" "Ali je %s v spremenljivki $PATH?" #: src/wmapp.cc:816 msgid "Kill IceWM, replace with Xterm" msgstr "" #: src/wmapp.cc:1119 src/yxapp.cc:1048 msgid "<none>" msgstr "<brez>" #: src/wmapp.cc:1458 msgid "" " --client-id=ID Client id to use when contacting session manager.\n" msgstr "" #: src/wmapp.cc:1464 msgid "" "\n" " --debug Print generic debug messages.\n" " --debug-z Print debug messages regarding window stacking.\n" msgstr "" #: src/wmapp.cc:1472 msgid "" "\n" " -a, --alpha Use a 32-bit visual for translucency.\n" " -c, --config=FILE Load preferences from FILE.\n" " -t, --theme=FILE Load theme from FILE.\n" " -s, --splash=IMAGE Briefly show IMAGE on startup.\n" " -p, --postpreferences Print preferences after all processing.\n" " --trace=conf,icon Trace paths used to load configuration.\n" msgstr "" #: src/wmapp.cc:1481 #, fuzzy, c-format msgid "" "Usage: %s [OPTIONS]\n" "Starts the IceWM window manager.\n" "\n" "Options:\n" " -d, --display=NAME NAME of the X server to use.\n" "%s --sync Synchronize X11 commands.\n" "%s\n" " -V, --version Prints version information and exits.\n" " -h, --help Prints this usage screen and exits.\n" "%s\n" " --replace Replace an existing window manager.\n" " -r, --restart Tell the running icewm to restart itself.\n" "\n" " --configured Print the compile time configuration.\n" " --directories Print the configuration directories.\n" " -l, --list-themes Print a list of all available themes.\n" "\n" "Environment variables:\n" " ICEWM_PRIVCFG=PATH Directory for user configuration files,\n" " \"$XDG_CONFIG_HOME/icewm\" if exists or\n" " \"$HOME/.icewm\" by default.\n" " DISPLAY=NAME Name of the X server to use.\n" " MAIL=URL Location of your mailbox.\n" "\n" "To report bugs, support requests, comments please visit:\n" "%s\n" "\n" msgstr "" "Uporaba: %s [MOŽNOSTI]\n" "Zažene okenski upravljalnik IceWM.\n" "\n" "Možnosti:\n" " --display=IME IME uporabljenga strežnika X.\n" "%s --sync Sinhronizacija ukazov X11.\n" "\n" " -c, --config=DATOTEKA Naloži prednastavitve iz DATOTEKE.\n" " -t, --theme=DATOTEKA Naloži temo iz DATOTEKE.\n" " -n, --no-configure Ne upoštevaj prednastavitvene datoteke.\n" "\n" " -v, --version Izpiši podatke o različici in končaj.\n" " -h, --help Izpiši ta zaslon o uporabi in končaj.\n" "%s --restart Ne uporabljajte. To je notranja zastavica.\n" "\n" "Spremenljivke okolja:\n" " ICEWM_PRIVCFG=PATH Imenik za uporabnikove zasebne nastavitvene datoteke,\n" " privzeto je \"$HOME/.icewm/\".\n" " DISPLAY=NAME Ime uporabljenega strežnika X, privzeto je odvisno od " "Xlib.\n" " MAIL=URL Lokacija vašega poštnega predala. Če je schema " "izpuščena,\n" " se privzame lokalna schema \"file\".\n" "\n" "Sporočanje hroščev, zahteve za podporo, komentarji, ... na https://ice-wm." "org/\n" #: src/wmapp.cc:1543 #, c-format msgid "%s configuration directories:\n" msgstr "" #: src/wmapp.cc:1622 #, fuzzy, c-format msgid "%s configured options:%s\n" msgstr "Neprepoznana izbira: %s\n" #: src/wmapp.cc:1706 #, fuzzy, c-format msgid "Unrecognized option '%s'." msgstr "Neprepoznana izbira: %s\n" #: src/wmapp.cc:1757 msgid "Confirm Logout" msgstr "Potrdi odjavo" #: src/wmapp.cc:1758 msgid "" "Logout will close all active applications.\n" "Proceed?" msgstr "" "Ob odjavi se bodo zaprli vsi aktivni programi.\n" "Naj nadaljujem?" #: src/wmbutton.cc:85 msgid "Raise/Lower" msgstr "Spusti/Znižaj" #: src/wmbutton.cc:90 msgid "Hide" msgstr "Skrij" #: src/wmbutton.cc:96 msgid "Restore" msgstr "Obnovi" #: src/wmbutton.cc:100 msgid "Maximize" msgstr "Razpni" #: src/wmbutton.cc:106 msgid "Minimize" msgstr "Pomanjšaj" #: src/wmbutton.cc:112 msgid "Rolldown" msgstr "Spravi navzdol" #: src/wmbutton.cc:115 msgid "Rollup" msgstr "Spravi navzgor" #: src/wmconfig.cc:39 #, fuzzy, c-format msgid "Failed to load theme %s" msgstr "Neuspešno odpiranje %s: %s" #: src/wmconfig.cc:104 #, fuzzy, c-format msgid "Unknown value '%s' for option '%s'." msgstr "Neznano dejanje: `%s'" #: src/wmconfig.cc:112 #, fuzzy, c-format msgid "Unable to create directory %s" msgstr "Neuspešna izdelava procesa potomca: %s" #: src/wmconfig.cc:139 src/wmprog.cc:567 src/wmprog.cc:689 src/wmprog.cc:693 #, c-format msgid "Unable to write to %s" msgstr "" #: src/wmconfig.cc:175 src/wmprog.cc:697 #, fuzzy, c-format msgid "Unable to rename %s to %s" msgstr "Neuspešno odpiranje %s: %s" #: src/wmdialog.cc:67 #, fuzzy msgid "Loc_k Workstation" msgstr "_Zakleni delovno postajo" #: src/wmdialog.cc:70 src/ymsgbox.cc:36 msgid "_Cancel" msgstr "_Prekliči" #. TRANSLATORS: This appears in a group with others items, so please make the hotkeys unique in the set: # T_ile Horizontally, Ca_scade, _Arrange, _Minimize All, _Hide All, _Undo, Arrange _Icons, _Windows, _Refresh, _About, _Logout #: src/wmdialog.cc:71 src/wmprog.cc:847 src/wmprog.cc:849 src/wmtaskbar.cc:257 #: src/wmtaskbar.cc:259 msgid "_Logout..." msgstr "_Odjava..." #: src/wmdialog.cc:75 msgid "_Restart icewm" msgstr "Po_noven zagon IceWM" #. TRANSLATORS: This appears in a group with others items, so please make the hotkeys unique in the set: # T_ile Horizontally, Ca_scade, _Arrange, _Minimize All, _Hide All, _Undo, Arrange _Icons, _Windows, _Refresh, _About, _Logout #: src/wmdialog.cc:76 src/wmprog.cc:808 src/wmtaskbar.cc:252 msgid "_About" msgstr "O pro_gramu" #: src/wmframe.cc:1370 msgid "Kill Client: " msgstr "Prekini odjemalca: " #: src/wmframe.cc:1377 msgid "" "WARNING! All unsaved changes will be lost when\n" "this client is killed. Do you wish to proceed?" msgstr "" "OPOZORILO! Vse neshranjene spremebe se bodo ob prekinitvi\n" "tega odjemalca izgubile. Ali želite nadaljevati?" #: src/wmmgr.cc:3278 msgid "Missing program setxkbmap" msgstr "" #: src/wmmgr.cc:3279 msgid "For keyboard switching, please install setxkbmap." msgstr "" #: src/wmoption.cc:260 #, c-format msgid "Unknown window option: %s" msgstr "Neznana okenska izbira: %s" #: src/wmoption.cc:331 #, fuzzy, c-format msgid "Syntax error in window options on line %d of %s" msgstr "Skladenjska napaka v okenskih izbirah" #: src/wmprog.cc:395 msgid "_Click to focus" msgstr "" #: src/wmprog.cc:396 msgid "_Explicit focus" msgstr "" #: src/wmprog.cc:397 msgid "_Sloppy mouse focus" msgstr "" #: src/wmprog.cc:398 msgid "S_trict mouse focus" msgstr "" #: src/wmprog.cc:399 msgid "_Quiet sloppy focus" msgstr "" #: src/wmprog.cc:400 msgid "Custo_m" msgstr "" #: src/wmprog.cc:487 #, fuzzy #| msgid "Favorite applications" msgid "Save Modifications" msgstr "Priljubljeni programi" #: src/wmprog.cc:720 msgid "_Manual" msgstr "" #: src/wmprog.cc:721 msgid "_Icewm(1)" msgstr "" #: src/wmprog.cc:722 msgid "Icewm_Bg(1)" msgstr "" #: src/wmprog.cc:723 msgid "Ice_Sound(1)" msgstr "" #: src/wmprog.cc:785 msgid "Programs" msgstr "Programi" #: src/wmprog.cc:790 msgid "_Run..." msgstr "P_oženi..." #. TRANSLATORS: This appears in a group with others items, so please make the hotkeys unique in the set: # T_ile Horizontally, Ca_scade, _Arrange, _Minimize All, _Hide All, _Undo, Arrange _Icons, _Windows, _Refresh, _About, _Logout #: src/wmprog.cc:795 src/wmtaskbar.cc:247 msgid "_Windows" msgstr "_Okna" #: src/wmprog.cc:814 msgid "_Help" msgstr "Po_moč" #: src/wmprog.cc:825 msgid "_Focus" msgstr "" #: src/wmprog.cc:830 msgid "_Preferences" msgstr "" #: src/wmprog.cc:836 msgid "_Themes" msgstr "_Teme" #: src/wmprog.cc:841 msgid "Se_ttings" msgstr "" #: src/wmsession.cc:220 src/wmsession.cc:236 src/wmsession.cc:246 #, c-format msgid "Session Manager: Unknown line %s" msgstr "Upravljalnik sej: neznana vrstica %s" #. TRANSLATORS: This appears in a group with others items, so please make the hotkeys unique in the set: # T_ile Horizontally, Ca_scade, _Arrange, _Minimize All, _Hide All, _Undo, Arrange _Icons, _Windows, _Refresh, _About, _Logout #: src/wmtaskbar.cc:229 src/wmwinlist.cc:376 src/wmwinlist.cc:409 msgid "Tile _Vertically" msgstr "Zloži na_vpično" #. TRANSLATORS: This appears in a group with others items, so please make the hotkeys unique in the set: # T_ile Horizontally, Ca_scade, _Arrange, _Minimize All, _Hide All, _Undo, Arrange _Icons, _Windows, _Refresh, _About, _Logout #: src/wmtaskbar.cc:231 src/wmwinlist.cc:377 src/wmwinlist.cc:410 msgid "T_ile Horizontally" msgstr "Zlož_i vodoravno" #. TRANSLATORS: This appears in a group with others items, so please make the hotkeys unique in the set: # T_ile Horizontally, Ca_scade, _Arrange, _Minimize All, _Hide All, _Undo, Arrange _Icons, _Windows, _Refresh, _About, _Logout #: src/wmtaskbar.cc:233 src/wmwinlist.cc:378 src/wmwinlist.cc:411 msgid "Ca_scade" msgstr "_Kaskadno" #. TRANSLATORS: This appears in a group with others items, so please make the hotkeys unique in the set: # T_ile Horizontally, Ca_scade, _Arrange, _Minimize All, _Hide All, _Undo, Arrange _Icons, _Windows, _Refresh, _About, _Logout #: src/wmtaskbar.cc:235 src/wmwinlist.cc:379 src/wmwinlist.cc:412 msgid "_Arrange" msgstr "_Razporedi" #. TRANSLATORS: This appears in a group with others items, so please make the hotkeys unique in the set: # T_ile Horizontally, Ca_scade, _Arrange, _Minimize All, _Hide All, _Undo, Arrange _Icons, _Windows, _Refresh, _About, _Logout #: src/wmtaskbar.cc:237 src/wmwinlist.cc:381 src/wmwinlist.cc:413 msgid "_Minimize All" msgstr "Poma_njšaj vse" #. TRANSLATORS: This appears in a group with others items, so please make the hotkeys unique in the set: # T_ile Horizontally, Ca_scade, _Arrange, _Minimize All, _Hide All, _Undo, Arrange _Icons, _Windows, _Refresh, _About, _Logout #: src/wmtaskbar.cc:239 src/wmwinlist.cc:382 src/wmwinlist.cc:414 msgid "_Hide All" msgstr "Skri_j vse" #. TRANSLATORS: This appears in a group with others items, so please make the hotkeys unique in the set: # T_ile Horizontally, Ca_scade, _Arrange, _Minimize All, _Hide All, _Undo, Arrange _Icons, _Windows, _Refresh, _About, _Logout #: src/wmtaskbar.cc:241 src/wmwinlist.cc:383 src/wmwinlist.cc:415 msgid "_Undo" msgstr "P_rekliči" #. TRANSLATORS: This appears in a group with others items, so please make the hotkeys unique in the set: # T_ile Horizontally, Ca_scade, _Arrange, _Minimize All, _Hide All, _Undo, Arrange _Icons, _Windows, _Refresh, _About, _Logout #: src/wmtaskbar.cc:244 msgid "Arrange _Icons" msgstr "Razporedi _ikone" #. TRANSLATORS: This appears in a group with others items, so please make the hotkeys unique in the set: # T_ile Horizontally, Ca_scade, _Arrange, _Minimize All, _Hide All, _Undo, Arrange _Icons, _Windows, _Refresh, _About, _Logout #: src/wmtaskbar.cc:250 msgid "_Refresh" msgstr "Os_veži" #: src/wmtaskbar.cc:323 src/wmtaskbar.cc:962 #, fuzzy #| msgid "Task Bar" msgid "Hide Taskbar" msgstr "Opravilna vrstica" #: src/wmtaskbar.cc:346 #, fuzzy #| msgid "Favorite applications" msgid "Favorite Applications" msgstr "Priljubljeni programi" #: src/wmtaskbar.cc:367 #, fuzzy #| msgid "Window list menu" msgid "Window List Menu" msgstr "Menu s seznamom oken" #: src/wmtaskbar.cc:376 msgid "Show Desktop" msgstr "Prikaži namizje" #: src/wmtaskbar.cc:962 #, fuzzy #| msgid "Task Bar" msgid "Show Taskbar" msgstr "Opravilna vrstica" #: src/wmwinlist.cc:45 msgid "All Workspaces" msgstr "Vse delovne površine" #: src/wmwinlist.cc:365 msgid "_Show" msgstr "Pri_kaži" #: src/wmwinlist.cc:368 #, fuzzy #| msgid "R_aise" msgid "_Raise" msgstr "_Dvigni" #: src/wmwinlist.cc:389 msgid "Del" msgstr "Izbriši" #: src/wmwinlist.cc:393 msgid "_Terminate Process" msgstr "_Prekini proces" #: src/wmwinlist.cc:394 msgid "Kill _Process" msgstr "Ubij _proces" #: src/wmwinlist.cc:429 src/wmwinlist.cc:430 msgid "Window list" msgstr "Seznam oken" #: src/wmwinmenu.cc:121 #, c-format msgid "%lu. Workspace %-.32s" msgstr "%lu. Delovna površina %-.32s" #: src/yapp.cc:295 #, c-format msgid "%s: select failed" msgstr "" #: src/yconfig.cc:107 #, c-format msgid "Unknown key name %s in %s" msgstr "Nezano ključno ime %s v %s" #: src/yconfig.cc:129 src/yconfig.cc:142 src/yconfig.cc:156 #, fuzzy, c-format #| msgid "Bad argument: %s for %s" msgid "Bad argument: %s for %s [%d,%d]" msgstr "Slab argument: %s za %s" #: src/yconfig.cc:193 #, c-format msgid "Bad option: %s" msgstr "Slaba izbira: %s" #: src/ycursor.cc:114 #, c-format msgid "Loading of pixmap \"%s\" failed: %s" msgstr "Nalaganje bitne slike \"%s\" ni uspelo: %s" #: src/ycursor.cc:141 #, c-format msgid "Loading of pixmap \"%s\" failed" msgstr "Nalaganje slike \"%s\" ni uspelo" #: src/ycursor.cc:174 #, c-format msgid "Invalid cursor pixmap: \"%s\" contains too much unique colors" msgstr "Neveljavna slika kurzorja: \"%s\" vsebuje preveč edinstvenih barv" #: src/ycursor.cc:196 #, c-format msgid "BUG? Imlib was able to read \"%s\"" msgstr "Hrošč? Imlib je lahko prebral \"%s\"" #: src/ycursor.cc:222 #, c-format msgid "BUG? Malformed XPM header but Imlib was able to parse \"%s\"" msgstr "Hrošč? Popačeno zaglavje XPM, vendar je Imlib lahko razčlenil \"%s\"" #: src/ycursor.cc:230 #, c-format msgid "BUG? Unexpected end of XPM file but Imlib was able to parse \"%s\"" msgstr "" "Hrošč? Nepričakovan konec datoteke XPM, vendar je Imlib lahko razčlenil \"%s" "\"" #: src/ycursor.cc:233 #, fuzzy, c-format msgid "BUG? Unexpected character but Imlib was able to parse \"%s\"" msgstr "Hrošč? Nepričakovan znak, vendar je Imlib lahko razčlenil \"%s\"" #: src/yfontcore.cc:72 src/yfontxft.cc:157 #, c-format msgid "Could not load font \"%s\"." msgstr "Nisem mogel naložiti pisave \"%s\"." #: src/yfontcore.cc:75 src/yfontcore.cc:123 src/yfontxft.cc:180 #, c-format msgid "Loading of fallback font \"%s\" failed." msgstr "Nalaganje nadomestne pisave \"%s\" ni uspelo." #: src/yfontcore.cc:116 #, c-format msgid "Could not load fontset \"%s\"." msgstr "Ne morem naložiti nabora pisav \"%s\"." #: src/yfontcore.cc:128 #, c-format msgid "Missing codesets for fontset \"%s\":" msgstr "Manjkajoči nabori znakov za nabor pisav \"%s\":" #: src/yinput.cc:18 msgid "_Copy" msgstr "Pr_epiši" #: src/yinput.cc:18 msgid "Ctrl+C" msgstr "Ctrl+C" #: src/yinput.cc:19 msgid "Cu_t" msgstr "I_zreži" #: src/yinput.cc:19 msgid "Ctrl+X" msgstr "Ctrl+X" #: src/yinput.cc:20 msgid "_Paste" msgstr "_Prilepi" #: src/yinput.cc:20 msgid "Ctrl+V" msgstr "Ctrl+V" #: src/yinput.cc:21 msgid "Paste _Selection" msgstr "Prilepi _izbiro" #: src/yinput.cc:21 #, fuzzy msgid "Ctrl+P" msgstr "Ctrl+Q" #: src/yinput.cc:23 msgid "Select _All" msgstr "Izberi _vse" #: src/yinput.cc:23 msgid "Ctrl+A" msgstr "Ctrl+A" #: src/ylocale.cc:55 #, fuzzy msgid "Locale not supported by C library or Xlib. Falling back to 'C' locale'." msgstr "Knjižnica C ne podpira tega jezikovnega okolja. Vključujem okolje 'C'." #: src/ylocale.cc:94 msgid "" "Failed to determinate the current locale's codeset. Assuming ISO-8859-1.\n" msgstr "" "Določitev nabora znakov za trenutni locale ni uspela. Predpostavljam, da je " "ISO-8859-1.\n" #: src/ylocale.cc:127 src/ylocale.cc:135 #, c-format msgid "iconv doesn't supply (sufficient) %s to %s converters." msgstr "iconv pretvornikom %2$s ne ponuja (zadostnega) %1$s." #: src/ylocale.cc:235 #, c-format msgid "Invalid multibyte string \"%s\": %s" msgstr "Neveljaven večzložni niz \"%s\": %s" #: src/ymsgbox.cc:33 msgid "_OK" msgstr "_V redu" #: src/ypaths.cc:94 #, c-format msgid "Image not readable: %s" msgstr "" #: src/ypaths.cc:117 #, fuzzy, c-format msgid "Could not find image %s" msgstr "Ne najdem zemljevida točk %s" #: src/ysmapp.cc:98 msgid "$USER or $LOGNAME not set?" msgstr "Spremenljivka $USER ali $LOGNAME ni nastavljena?" #: src/yurl.cc:145 #, fuzzy, c-format msgid "Failed to parse URL \"%s\"." msgstr "Neuspešno odpiranje %s: %s" #: src/yurl.cc:161 #, c-format msgid "Incomplete hex escape in URL at position %d." msgstr "" #: src/yurl.cc:168 #, c-format msgid "Invalid hex escape in URL at position %d." msgstr "" #: src/yxapp.cc:1008 msgid "" " -d, --display=NAME NAME of the X server to use.\n" " --sync Synchronize X11 commands.\n" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Graphics #: src/fdospecgen.h:43 msgid "2DGraphics" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Graphics #: src/fdospecgen.h:45 msgid "3DGraphics" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Settings or Utility #: src/fdospecgen.h:47 src/fdospecgen.h:49 msgid "Accessibility" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:51 msgid "Accessories" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:53 msgid "ActionGame" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:55 msgid "Adult" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:57 msgid "AdventureGame" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:59 msgid "Amusement" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:61 #, fuzzy #| msgid "Same Game" msgid "ArcadeGame" msgstr "Ista igra" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Utility #: src/fdospecgen.h:63 msgid "Archiving" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:65 msgid "Art" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:67 msgid "ArtificialIntelligence" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:69 msgid "Astronomy" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:71 msgid "Audio" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:73 msgid "AudioVideo" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Audio or Video or AudioVideo #: src/fdospecgen.h:75 msgid "AudioVideoEditing" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:77 msgid "Biology" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:79 msgid "BlocksGame" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:81 msgid "BoardGame" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Development #: src/fdospecgen.h:83 msgid "Building" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Utility #: src/fdospecgen.h:85 msgid "Calculator" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office #: src/fdospecgen.h:87 msgid "Calendar" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:89 msgid "CardGame" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office #: src/fdospecgen.h:91 msgid "Chart" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network #: src/fdospecgen.h:93 msgid "Chat" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:95 msgid "Chemistry" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Utility #: src/fdospecgen.h:97 msgid "Clock" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Utility;Archiving #: src/fdospecgen.h:99 msgid "Compression" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:101 msgid "ComputerScience" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:103 msgid "Construction" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office #: src/fdospecgen.h:105 msgid "ContactManagement" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:107 msgid "Core" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:109 msgid "DataVisualization" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office or Development or AudioVideo #: src/fdospecgen.h:111 msgid "Database" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Development #: src/fdospecgen.h:113 msgid "Debugger" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Settings #: src/fdospecgen.h:115 #, fuzzy #| msgid "D_esktop" msgid "DesktopSettings" msgstr "_Namizje" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:117 msgid "Development" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network #: src/fdospecgen.h:119 msgid "Dialup" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office or TextTools #: src/fdospecgen.h:121 msgid "Dictionary" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: AudioVideo #: src/fdospecgen.h:123 msgid "DiscBurning" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:125 msgid "Documentation" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:127 msgid "Economy" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:129 msgid "Editors" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:131 msgid "Education" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:133 msgid "Electricity" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:135 msgid "Electronics" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office or Network #: src/fdospecgen.h:137 msgid "Email" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: System or Game #: src/fdospecgen.h:139 msgid "Emulator" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:141 msgid "Engineering" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network #: src/fdospecgen.h:143 msgid "Feed" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: System;FileTools #: src/fdospecgen.h:145 msgid "FileManager" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Utility or System #: src/fdospecgen.h:147 msgid "FileTools" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network #: src/fdospecgen.h:149 msgid "FileTransfer" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: System #: src/fdospecgen.h:151 msgid "Filesystem" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office #: src/fdospecgen.h:153 #, fuzzy #| msgid "Cancel" msgid "Finance" msgstr "Prekliči" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office #: src/fdospecgen.h:155 msgid "FlowChart" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Development #: src/fdospecgen.h:157 msgid "GUIDesigner" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:159 #, fuzzy #| msgid "Same Game" msgid "Game" msgstr "Ista igra" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:161 msgid "Geography" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:163 msgid "Geology" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:165 msgid "Geoscience" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:167 msgid "Graphics" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network or Audio #: src/fdospecgen.h:169 msgid "HamRadio" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Settings #: src/fdospecgen.h:171 msgid "HardwareSettings" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:173 msgid "History" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:175 msgid "Humanities" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Development #: src/fdospecgen.h:177 #, fuzzy #| msgid "KDE" msgid "IDE" msgstr "KDE" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network #: src/fdospecgen.h:179 msgid "IRCClient" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:181 #, fuzzy #| msgid "_Terminate Process" msgid "ImageProcessing" msgstr "_Prekini proces" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network #: src/fdospecgen.h:183 msgid "InstantMessaging" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:185 msgid "KidsGame" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:187 msgid "Languages" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:189 msgid "Literature" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:191 msgid "LogicGame" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science or Utility #: src/fdospecgen.h:193 msgid "Maps" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:195 msgid "Math" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:197 msgid "MedicalSoftware" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: AudioVideo;Audio #: src/fdospecgen.h:199 msgid "Midi" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: AudioVideo;Audio #: src/fdospecgen.h:201 msgid "Mixer" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: System or Network #: src/fdospecgen.h:203 msgid "Monitor" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:205 msgid "Motif" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:207 msgid "Multimedia" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: AudioVideo or Education #: src/fdospecgen.h:209 msgid "Music" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:211 msgid "Network" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network #: src/fdospecgen.h:213 msgid "News" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education;Math or Science;Math #: src/fdospecgen.h:215 msgid "NumericalAnalysis" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Graphics;Scanning #: src/fdospecgen.h:217 msgid "OCR" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:219 msgid "Office" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:221 msgid "Other" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network #: src/fdospecgen.h:223 msgid "P2P" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office #: src/fdospecgen.h:225 msgid "PDA" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Settings #: src/fdospecgen.h:227 msgid "PackageManager" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education;ComputerScience or Science;ComputerScience #: src/fdospecgen.h:229 msgid "ParallelComputing" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Graphics or Office #: src/fdospecgen.h:231 msgid "Photography" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:233 msgid "Physics" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Audio or Video or AudioVideo #: src/fdospecgen.h:235 msgid "Player" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office #: src/fdospecgen.h:237 msgid "Presentation" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Settings;HardwareSettings #: src/fdospecgen.h:239 msgid "Printing" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Development #: src/fdospecgen.h:241 msgid "Profiling" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office or Development #: src/fdospecgen.h:243 msgid "ProjectManagement" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Graphics or Office #: src/fdospecgen.h:245 msgid "Publishing" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Graphics;2DGraphics #: src/fdospecgen.h:247 msgid "RasterGraphics" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Audio or Video or AudioVideo #: src/fdospecgen.h:249 msgid "Recorder" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network #: src/fdospecgen.h:251 msgid "RemoteAccess" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Development #: src/fdospecgen.h:253 msgid "RevisionControl" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:255 msgid "Robotics" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:257 msgid "RolePlaying" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Graphics #: src/fdospecgen.h:259 msgid "Scanning" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:261 msgid "Science" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:263 msgid "Screensavers" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Settings or System #: src/fdospecgen.h:265 msgid "Security" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: AudioVideo;Audio #: src/fdospecgen.h:267 msgid "Sequencer" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:269 msgid "Settings" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:271 msgid "Shooter" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:273 msgid "Simulation" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science or Utility #: src/fdospecgen.h:275 msgid "Spirituality" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Education or Science #: src/fdospecgen.h:277 msgid "Sports" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:279 msgid "SportsGame" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office #: src/fdospecgen.h:281 msgid "Spreadsheet" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Game #: src/fdospecgen.h:283 #, fuzzy #| msgid "Same Game" msgid "StrategyGame" msgstr "Ista igra" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:285 msgid "System" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: AudioVideo;Video #: src/fdospecgen.h:287 msgid "TV" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network #: src/fdospecgen.h:289 msgid "Telephony" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Utility #: src/fdospecgen.h:291 msgid "TelephonyTools" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: System #: src/fdospecgen.h:293 msgid "TerminalEmulator" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Utility #: src/fdospecgen.h:295 msgid "TextEditor" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Utility #: src/fdospecgen.h:297 msgid "TextTools" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Development #: src/fdospecgen.h:299 msgid "Translation" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: AudioVideo;Audio #: src/fdospecgen.h:301 msgid "Tuner" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:303 msgid "Utility" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Graphics;2DGraphics #: src/fdospecgen.h:305 msgid "VectorGraphics" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:307 msgid "Video" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network #: src/fdospecgen.h:309 msgid "VideoConference" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Graphics or Office #: src/fdospecgen.h:311 msgid "Viewer" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. #: src/fdospecgen.h:313 msgid "WINE" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network #: src/fdospecgen.h:315 msgid "WebBrowser" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Network or Development #: src/fdospecgen.h:317 msgid "WebDevelopment" msgstr "" #. TRANSLATORS: This is a menu category name from freedesktop.org. Please add spaces as needed but no double-quotes. Context: Office #: src/fdospecgen.h:319 msgid "WordProcessor" msgstr "" #~ msgid "Unable to get current font path." #~ msgstr "Ne morem dobiti trenutne poti do pisav." #~ msgid "Unexpected format of ICEWM_FONT_PATH property" #~ msgstr "Nepričakovana oblika lastnosti ICEWM_FONT_PATH" #~ msgid "Task Bar" #~ msgstr "Opravilna vrstica" #~ msgid "_License" #~ msgstr "_Dovoljenje" #, fuzzy #~ msgid "" #~ "Usage: %s [OPTIONS] ACTIONS\n" #~ "\n" #~ "Options:\n" #~ " -d, -display DISPLAY Connects to the X server specified by " #~ "DISPLAY.\n" #~ " Default: $DISPLAY or :0.0 when not set.\n" #~ " -w, -window WINDOW_ID Specifies the window to manipulate. " #~ "Special\n" #~ " identifiers are `root' for the root window " #~ "and\n" #~ " `focus' for the currently focused window.\n" #~ " -c, -class WM_CLASS Window management class of the window(s) " #~ "to\n" #~ " manipulate. If WM_CLASS contains a period, " #~ "only\n" #~ " windows with exactly the same WM_CLASS " #~ "property\n" #~ " are matched. If there is no period, windows " #~ "of\n" #~ " the same class and windows of the same " #~ "instance\n" #~ " (aka. `-name') are selected.\n" #~ "\n" #~ "Actions:\n" #~ " setIconTitle TITLE Set the icon title.\n" #~ " setWindowTitle TITLE Set the window title.\n" #~ " setGeometry geometry Set the window geometry\n" #~ " setState MASK STATE Set the GNOME window state to STATE.\n" #~ " Only the bits selected by MASK are " #~ "affected.\n" #~ " STATE and MASK are expressions of the " #~ "domain\n" #~ " `GNOME window state'.\n" #~ " toggleState STATE Toggle the GNOME window state bits " #~ "specified by\n" #~ " the STATE expression.\n" #~ " setHints HINTS Set the GNOME window hints to HINTS.\n" #~ " setLayer LAYER Moves the window to another GNOME window " #~ "layer.\n" #~ " setWorkspace WORKSPACE Moves the window to another workspace. " #~ "Select\n" #~ " the root window to change the current " #~ "workspace.\n" #~ " Select 0xFFFFFFFF or \"All\" for all " #~ "workspaces.\n" #~ " listWorkspaces Lists the names of all workspaces.\n" #~ " setTrayOption TRAYOPTION Set the IceWM tray option hint.\n" #~ " logout Tell IceWM to logout.\n" #~ " reboot Tell IceWM to reboot.\n" #~ " shutdown Tell IceWM to shutdown.\n" #~ " cancel Tell IceWM to cancel the logout/reboot/" #~ "shutdown.\n" #~ " about Tell IceWM to show the about window.\n" #~ " windowlist Tell IceWM to show the window list.\n" #~ " restart Tell IceWM to restart.\n" #~ " suspend Tell IceWM to suspend.\n" #~ "\n" #~ "Expressions:\n" #~ " Expressions are list of symbols of one domain concatenated by `+' or " #~ "`|':\n" #~ "\n" #~ " EXPRESSION ::= SYMBOL | EXPRESSION ( `+' | `|' ) SYMBOL\n" #~ "\n" #~ msgstr "" #~ "Uporaba: %s [IZBIRE] DEJANJA\n" #~ "\n" #~ "Izbire:\n" #~ " -display PRIKAZ Povezava na strežnik X, ki je določen v " #~ "PRIKAZ.\n" #~ " Privzeto: $DISPLAY ali :0.0, ko ni " #~ "nastavljeno.\n" #~ " -window ID_OKNA Določi okno, na katerem se bo izvedlo " #~ "dejanje. Posebna\n" #~ " identifikatorja sta `root' za korensko okno " #~ "in\n" #~ "\t\t\t `focus' za trenutno aktivno okno.\n" #~ " -class RAZRED_UO Razred okenskega upravljanja okna " #~ "(oken) \t \t \t Če RAZRED_UO vsebuje piko, \t " #~ "\t to velja samo za okna z natanko enako lastnostjo RAZRED_UO" #~ "\t\t\t Če ni pike, bodo izbrana okna\t\t\t z istim razredom in " #~ "isto instanco\t\t\t (znano tudi kot `-name')\n" #~ "Dejanja:\n" #~ " setIconTitle NASLOV Nastavi naslov ikone.\n" #~ " setWindowTitle NASLOV Nastavi naslov okna.\n" #~ " setGeometry geometrija Nastavi geometrijo okna setState MASKA " #~ "STANJE Nastavi stanje Gnomovega okna na STANJE.\n" #~ " \t\t\t Deluje le na bitih, ki so izbrani v MASKA.\n" #~ " STANJE in MASKA izražata domeno\n" #~ " `Gnomovega stanja okna'.\n" #~ " toggleState STANJE Nastavi bite stanja Gnomovega okna, kot\n" #~ " je določeno v izrazu STANJE.\n" #~ " setHints NASVETI Nastavi nasvete Gnomovega okna na " #~ "vrednost NASVETI.\n" #~ " setLayer PLAST Premakne okno v drugo plast Gnomovega " #~ "okna.\n" #~ " setWorkspace DEL_POVRŠINA Premakne okno na drugo delovno površino. " #~ "Izberite\n" #~ " \t\t\t korensko okno, če želite spremeniti trenutno delovno " #~ "površino.\n" #~ " listWorkspaces \t Izpiše imena vseh delovnih površin.\n" #~ " setTrayOption IZB_PLADNJA Nastavi nasvet izbir IceWMovega pladnja.\n" #~ "\n" #~ "Izrazi:\n" #~ " Izrazi so seznami simbolov neke domene, speti z znakoma `+' ali `|':\n" #~ "\n" #~ " IZRAZ ::= SIMBOL | IZRAZ ( `+' | `|' ) SIMBOL\n" #~ "\n" #~ msgid "Can't connect to ESound daemon: %s" #~ msgstr "Ne morem se povezati z demonom ESound: %s" #~ msgid "Error <%d> while uploading `%s:%s'" #~ msgstr "Napaka <%d> med nalaganjem na strežnik: '%s:%s'" #~ msgid "Sample <%d> uploaded as `%s:%s'" #~ msgstr "Vzorec <%d> naložen na strežnik kot `%s:%s'" #, fuzzy #~ msgid "Playing sample #%d: %d" #~ msgstr "Predvajam vzorec #%d" #~ msgid "Usage error: " #~ msgstr "Napaka pri uporabi: " #, fuzzy #~ msgid "Out of memory for image %s" #~ msgstr "Ni dovolj pomnilnika za bitno sliko \"%s\"" #~ msgid "_Minimize" #~ msgstr "Po_manjšaj" #~ msgid "Missing command argument" #~ msgstr "Manjkajo ukazni argumenti" #, fuzzy #~ msgid "Bad argument %d to command '%s'" #~ msgstr "Slab argument: %s za %s" #, fuzzy #~ msgid "Error at %s '%s'" #~ msgstr "Napaka v ključu %s" #, fuzzy #~ msgid "Unexepected menu keyword: '%s'" #~ msgstr "Nepričakovana ključna beseda: %s" #, fuzzy #~ msgid "Error at menuprog '%s'" #~ msgstr "Napaka v programu %s" #, fuzzy #~ msgid "Error at %s: '%s'" #~ msgstr "Napaka v ključu %s" #, fuzzy #~ msgid "Unknown keyword '%s'" #~ msgstr "Neznano dejanje: `%s'" #, fuzzy #~ msgid "Error at keyword '%s' for %s" #~ msgstr "Napaka v ključu %s" #~ msgid "\"%s\" contains no scheme description" #~ msgstr "\"%s\" ne vsebuje opisa sheme" #~ msgid "\"%s\" doesn't describe a common internet scheme" #~ msgstr "\"%s\" ne opisuje običajne internetne sheme" #~ msgid "Out of memory for pixmap \"%s\"" #~ msgstr "Ni dovolj pomnilnika za bitno sliko \"%s\"" #~ msgid "Out of memory for window options" #~ msgstr "Ni dovolj pomnilnika za okenske izbire" #~ msgid "Error in window option: %s" #~ msgstr "Napaka v okenski izbiri: %s" #~ msgid "" #~ "Usage: %s FILENAME\n" #~ "\n" #~ "A very simple HTML browser displaying the document specified by " #~ "FILENAME.\n" #~ "\n" #~ msgstr "" #~ "Uporaba: %s IME_DATOTEKE\n" #~ "\n" #~ "Preprost HTML brskalnik, ki prikaže dokument IME_DATOTEKE.\n" #~ "\n" #~ msgid "No such device: %s" #~ msgstr "Ni takšne naprave: %s" #~ msgid "Can't change to audio mode `%s'." #~ msgstr "Ne morem preklopiti v zvočni način `%s'." #~ msgid "" #~ "Audio mode switch detected, initial audio mode `%s' no longer in effect." #~ msgstr "" #~ "Zaznano stikalo za zvočni način, prvotni zvočni način `%s' ni več " #~ "aktualen." #~ msgid "Audio mode switch detected, automatic audio mode changing disabled." #~ msgstr "" #~ "Zaznano stikalo za zvočni način, samodejna menjava zvočnega načina " #~ "izklopljena." #~ msgid "Overriding previous audio mode `%s'." #~ msgstr "Prepisujem prejšnji zvočni način `%s'." #~ msgid "Multiple sound interfaces given." #~ msgstr "Podanih je več zvočnih vmesnikov." #~ msgid "Received signal %d: Reloading samples..." #~ msgstr "Prejel signal %d: znova nalagam vzorce..." #~ msgid "Message Loop: select failed (errno=%d)" #~ msgstr "Sporočilna zanka: izbira ni uspela (errno=%d)" #~ msgid "Argument required for %s switch" #~ msgstr "Obvezen argument ob izbiri %s" #~ msgid "Loading of image \"%s\" failed" #~ msgstr "Nalaganje slike \"%s\" ni uspelo" #~ msgid "Imlib: Acquisition of X pixmap failed" #~ msgstr "Imlib: zajemanje bitne slike X ni uspelo" #~ msgid "Imlib: Imlib image to X pixmap mapping failed" #~ msgstr "Imlib: prerisovanje Imlibove slike v bitno sliko X ni uspelo" #~ msgid "" #~ "Using fallback mechanism to convert pixels (depth: %d; masks (red/green/" #~ "blue): %0*x/%0*x/%0*x)" #~ msgstr "" #~ "Uporabljam nadomestni mehanizem za pretvorbo točk (globina: %d; maske " #~ "(rdeče/zeleno/modro): %0*x/%0*x/%0*x" #~ msgid "%s:%d: %d bit visuals are not supported (yet)" #~ msgstr "%s%d: %d-bitne slike (še) niso podprte" #, fuzzy #~ msgid "Multiple references for gradient '%s' in theme '%s'." #~ msgstr "Večkraten napotek za gradient \"%s\"" #, fuzzy #~ msgid "Unknown gradient name '%s' in theme '%s'." #~ msgstr "Neznano ime gradienta: %s" #~ msgid "Bad Look name" #~ msgstr "Slabo ime izgleda" #~ msgid "" #~ "%s: unrecognized option `%s'\n" #~ "Try `%s --help' for more information.\n" #~ msgstr "" #~ "%s: neprepoznana izbira `%s'\n" #~ "Za več informacij poskusite z `%s --help'.\n" #~ msgid "Loading image %s failed" #~ msgstr "Nalaganje slike %s ni uspelo" #~ msgid "Bad argument %d" #~ msgstr "Slab argument %d" #, fuzzy #~ msgid "Out of memory for image: %s" #~ msgstr "Ni dovolj pomnilnika za bitno sliko \"%s\"" #, fuzzy #~ msgid "Could not find image: %s" #~ msgstr "Ne najdem zemljevida točk %s" #~ msgid "Invalid path: " #~ msgstr "Neveljavna pot: " #~ msgid "" #~ "Interface %s:\n" #~ " Current rate (in/out):\t%li %s/%li %s\n" #~ " Current average (in/out):\t%lli %s/%lli %s\n" #~ " Total average (in/out):\t%li %s/%li %s\n" #~ " Transferred (in/out):\t%lli %s/%lli %s\n" #~ " Online time:\t%ld:%02ld:%02ld%s%s" #~ msgstr "" #~ "Vmesnik %s:\n" #~ " Trenutna hitrost (notri/ven):\t%li %s/%li %s\n" #~ " Trenutno povprečje (notri/ven):\t%lli %s/%lli %s\n" #~ " Skupno povprečje (notri/ven):\t%li %s/%li %s\n" #~ " Preneseno (notri/ven):\t%lli %s/%lli %s\n" #~ " Čas priklopa:\t%ld:%02ld:%02ld%s%s" #, fuzzy #~ msgid "" #~ " Usage: %s [OPTION]...\n" #~ " \n" #~ " Plays audio files on GUI events raised by IceWM.\n" #~ " \n" #~ " Options:\n" #~ " \n" #~ " -d, --display=DISPLAY Display used by IceWM " #~ "(default: $DISPLAY).\n" #~ " -s, --sample-dir=DIR Specifies the directory which " #~ "contains\n" #~ " the sound files (ie ~/.icewm/sounds).\n" #~ " -i, --interface=TARGET Specifies the sound output " #~ "target\n" #~ " interface, one of OSS, YIFF, ESD\n" #~ " -D, --device=DEVICE (OSS only) specifies the " #~ "digital signal\n" #~ " processor (default /dev/dsp).\n" #~ " -S, --server=ADDR:PORT (ESD and YIFF) specifies server " #~ "address and\n" #~ " port number (default localhost:16001 for ESD\n" #~ " and localhost:9433 for YIFF).\n" #~ " -m, --audio-mode[=MODE] (YIFF only) specifies the " #~ "Audio mode (leave\n" #~ " blank to get a list).\n" #~ " --audio-mode-auto (YIFF only) change Audio mode on " #~ "the fly to\n" #~ " best match sample's Audio (can cause\n" #~ " problems with other Y clients, overrides\n" #~ " --audio-mode).\n" #~ " \n" #~ " -v, --verbose Be verbose (prints out each " #~ "sound event to\n" #~ " stdout).\n" #~ " -V, --version Prints version information and " #~ "exits.\n" #~ " -h, --help Prints (this) help screen and " #~ "exits.\n" #~ " \n" #~ " Return values:\n" #~ " \n" #~ " 0 Success.\n" #~ " 1 General error.\n" #~ " 2 Command line error.\n" #~ " 3 Subsystems error (ie cannot connect to server).\n" #~ "\n" #~ msgstr "" #~ "Uporaba: %s [IZBIRE]...\n" #~ "\n" #~ "Predvaja zvočne datoteke ob dogodkih IceWMovega grafičnega uporabniškega " #~ "vmesnika.\n" #~ "\n" #~ "Izbire:\n" #~ "\n" #~ " -d, --display=PRIKAZ Prikaz, ki ga uporablja IceWM (privzeto: " #~ "$DISPLAY).\n" #~ " -s, --sample-dir=IMENIK Določi imenik, ki vsebuje\n" #~ " zvočne datoteke (t.j. ~/.icewm/sounds).\n" #~ " -i, --interface=TARČA Določi tarčo zvočnega vmesnika izhoda,\n" #~ " npr. OSS, YIFF, ESD\n" #~ " -D, --device=NAPRAVA (samo OSS) določi digitalni signalni\n" #~ " procesor (privzeto /dev/dsp).\n" #~ " -S, --server=NASLOV:VRATA\t(ESD in YIFF) določi naslov strežnika in\n" #~ " številko vrat (privzeto localhost:16001 " #~ "za ESD\n" #~ "\t\t\t\tin localhost:9433 za YIFF).\n" #~ " -m, --audio-mode[=NAČIN] (samo YIFF) določi zvočni način (pustite\n" #~ " prazno, če želite seznam).\n" #~ " --audio-mode-auto \t(samo YIFF) sproti spremeni zvočni način na\n" #~ " najboljše ujemanje zvočnega vzorca (lahko " #~ "povzroči\n" #~ " težave z ostalimi odjemalci Y, prepiše\n" #~ " --audio-mode).\n" #~ "\n" #~ " -v, --verbose Razvlečen izpis (izpiše vsak zvočni " #~ "dogodek na\n" #~ " stdout).\n" #~ " -V, --version Izpiše podatke o različici in konča.\n" #~ " -h, --help Izpiše (to) zaslonsko pomoč in konča.\n" #~ "\n" #~ "Vrnjene vrednosti:\n" #~ "\n" #~ " 0 Uspešno.\n" #~ " 1 Splošna napaka.\n" #~ " 2 Napaka v ukazni vrstici.\n" #~ " 3 Napaka podsistema (npr. neuspešna povezava s strežnikom).\n" #~ "\n" #~ msgid "" #~ "Usage: icewmbg [ -r | -q ]\n" #~ " -r Restart icewmbg\n" #~ " -q Quit icewmbg\n" #~ "Loads desktop background according to preferences file\n" #~ " DesktopBackgroundCenter - Display desktop background centered, not " #~ "tiled\n" #~ " SupportSemitransparency - Support for semitransparent terminals\n" #~ " DesktopBackgroundColor - Desktop background color\n" #~ " DesktopBackgroundImage - Desktop background image\n" #~ " DesktopTransparencyColor - Color to announce for semi-transparent " #~ "windows\n" #~ " DesktopTransparencyImage - Image to announce for semi-transparent " #~ "windows\n" #~ msgstr "" #~ "Uporaba: icewmbg [ -r | -q ]\n" #~ " -r Ponoven zagon icewmbg\n" #~ " -q Končaj icewmbg\n" #~ "Naloži ozadje namizja v skladu z datoteko prednastavitev\n" #~ " DesktopBackgroundCenter - Prikaži ozadje namizja usredinjeno, ne " #~ "zloženo\n" #~ " SupportSemitransparency - Podpora polprosojnih terminalov\n" #~ " DesktopBackgroundColor - Barva ozadja namizja\n" #~ " DesktopBackgroundImage - Slika ozadja namizja\n" #~ " DesktopTransparencyColor - Barva oznanitve polprosojnih oken\n" #~ " DesktopTransparencyImage - Slika oznanitve polprosojnih oken\n" #~ msgid "Could not find pixel map %s" #~ msgstr "Ne najdem zemljevida točk %s" #~ msgid "Out of memory for pixel map %s" #~ msgstr "Zmanjkalo je pomnilnika za zemljevid točk %s" #~ msgid "Out of memory for RGB pixel buffer %s" #~ msgstr "Zmanjkalo je pomnilnika za medpomnilnik točk RGB: %s" #~ msgid "Could not find RGB pixel buffer %s" #~ msgstr "Ne najdem medpomnilnika za točk RGB: %s" #~ msgid " processes." #~ msgstr " procesov" #~ msgid "program label expected" #~ msgstr "Pričakovana oznaka programa" #~ msgid "icon name expected" #~ msgstr "pričakovano ime ikone" #~ msgid "window management class expected" #~ msgstr "pričakovan razred okenskega upravljalnika" #~ msgid "menu caption expected" #~ msgstr "pričakovana oznaka menija" #~ msgid "opening curly expected" #~ msgstr "pričakovano uvodno kodranje" #~ msgid "action name expected" #~ msgstr "pričakovano ime dejanja" #~ msgid "unknown action" #~ msgstr "Neznano dejanje" #~ msgid "Not a regular file: %s" #~ msgstr "Ni regularna datoteka: %s" #~ msgid "Pair of hexadecimal digits expected" #~ msgstr "Pričakovan je par šestnajstiških števk" #~ msgid "Unexpected identifier" #~ msgstr "Nepričakovan identifikator" #~ msgid "Identifier expected" #~ msgstr "Pričakovan je identifikator" #~ msgid "Separator expected" #~ msgstr "Pričakovano je ločilo" #~ msgid "Invalid token" #~ msgstr "Neveljaven žeton" #~ msgid "Not a hexadecimal number: %c%c (in \"%s\")" #~ msgstr "Ni šestnajstiško število: %c%c (v \"%s\")" #~ msgid "/proc/apm - unknown format (%d)" #~ msgstr "/proc/apm - neznan zapis (%d)" #~ msgid "stat:\tuser = %i, nice = %i, sys = %i, idle = %i" #~ msgstr "stat:\tuser = %i, nice = %i, sys = %i, idle = %i" #~ msgid "bars:\tuser = %i, nice = %i, sys = %i (h = %i)\n" #~ msgstr "stolpci:\tuser = %i, nice = %i, sys = %i (h = %i)\n" #~ msgid "cpu: %d %d %d %d %d %d %d" #~ msgstr "CPE: %d %d %d %d %d %d %d" #~ msgid "kstat finds too many cpus: should be %d" #~ msgstr "kstat najde preveč procesorjev: moralo bi jih biti %d" #~ msgid "%s@%d: %s\n" #~ msgstr "%s@%d: %s\n" #~ msgid "XQueryTree failed for window 0x%x" #~ msgstr "XQueryTree ni uspel za okno 0x%x" #~ msgid "Compiled with DEBUG flag. Debugging messages will be printed." #~ msgstr "" #~ "Prevedeno z zastavico DEBUG. Izpisovala se bodo razhroščevalna sporočila." #~ msgid "_No icon" #~ msgstr "_Brez ikon" #~ msgid "_Minimized" #~ msgstr "Po_manjšano" #~ msgid "_Exclusive" #~ msgstr "Izk_ljučevalno" #~ msgid "X error %s(0x%lX): %s" #~ msgstr "Napaka X %s(0x%lX): %s" #~ msgid "Forking failed (errno=%d)" #~ msgstr "Sistemski klic fork ni uspel (errno=%d)" #~ msgid "Failed to create anonymous pipe (errno=%d)." #~ msgstr "Izdelava anonimne cevi ni uspela (errno=%d)." #~ msgid "Invalid cursor pixmap: \"%s\" contains too many unique colors" #~ msgstr "Neveljavna slika kurzorja: \"%s\" vsebuje preveč edinstvenih barv" #~ msgid "Failed to duplicate file descriptor: %s" #~ msgstr "Neuspešna podvojitev datotečnega opisnika: %s" #~ msgid "%s:%d: Failed to copy drawable 0x%x to pixel buffer" #~ msgstr "" #~ "%s:%d: Prepisovanje risljivega 0x%x v točkovni medpomnilnik ni uspelo" #~ msgid "%s:%d: Failed to copy drawable 0x%x to pixel buffer (%d:%d-%dx%d" #~ msgstr "" #~ "%s:%d: Prepisovanje risljivega 0x%x v točkovni medpomnilnik ni uspelo (%d:" #~ "%d-%dx%d" #~ msgid "TOO MANY ICE CONNECTIONS -- not supported" #~ msgstr "PREVEČ POVEZAV ICE -- ni podprto" #~ msgid "Session Manager: IceAddConnectionWatch failed." #~ msgstr "Upravljalnik sej: IceAddConnectionWatch ni uspel." #~ msgid "Session Manager: Init error: %s" #~ msgstr "Upravljalnik sej: napaka Inita: %s" #~ msgid "" #~ "# preferences(%s) - generated by genpref\n" #~ "\n" #~ msgstr "" #~ "# preference (%s) - narejene od genpref\n" #~ "\n" #~ msgid "" #~ "# NOTE: All settings are commented out by default, be sure to\n" #~ "# uncomment them if you change them!\n" #~ "\n" #~ msgstr "" #~ "# OPOMBA: vse nastavitve so privzeto zakomentirane, če jih\n" #~ " # spremenite, jih odkomentirajte!\n" #~ "\n" #~ msgid "" #~ "Usage: icewmbg [OPTION]... pixmap1 [pixmap2]...\n" #~ "Changes desktop background on workspace switches.\n" #~ "The first pixmap is used as a default one.\n" #~ "\n" #~ "-s, --semitransparency Enable support for semi-transparent terminals\n" #~ msgstr "" #~ "Uporaba: icewmbg [IZBIRA]... slika1 [slika2]...\n" #~ "S stikalom delovne površine spremeni ozadje namizja.\n" #~ "Privzeto se uporabi prva bitna slika.\n" #~ "\n" #~ "-s, --semitransparency Omogoči podporo za polprosojne terminale\n" #~ msgid "" #~ "Window %p has no XA_ICEWM_PID property. Export the LD_PRELOAD variable to " #~ "preload the preice library." #~ msgstr "" #~ "Okno %p nima lastnosti XA_ICEWM_PID. Nastavite spremenljivko LD_PRELOAD, " #~ "prednaložila knjižnico preice." #~ msgid "Obsolete option: %s" #~ msgstr "Zastarela izbira: %s" #~ msgid "Gnome" #~ msgstr "Gnome" #~ msgid "Gnome User Apps" #~ msgstr "Uporabniški programi Gnoma" #~ msgid "Resource allocation for rotated string \"%s\" (%dx%d px) failed" #~ msgstr "Dodelitev sredstev za rotirajoči niz \"%s\" (%dx%d px) ni uspela" #~ msgid "CPU Load: %3.2f %3.2f %3.2f, %d processes." #~ msgstr "Obremenitev CPE: %3.2f %3.2f %3.2f, %d procesov."
{ "pile_set_name": "Github" }
// Copyright (c) 2011-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_WALLETMODEL_H #define BITCOIN_QT_WALLETMODEL_H #include <chainparams.h> #include <interfaces/wallet.h> #if defined(HAVE_CONFIG_H) #include <config/bitcoin-config.h> #endif #ifdef ENABLE_BIP70 #include <qt/paymentrequestplus.h> #endif #include <qt/walletmodeltransaction.h> #include <support/allocators/secure.h> #include <QObject> #include <memory> #include <vector> class AddressTableModel; class OptionsModel; class PlatformStyle; class RecentRequestsTableModel; class TransactionTableModel; class WalletModelTransaction; class CCoinControl; class CKeyID; class COutPoint; class COutput; class CPubKey; namespace interfaces { class Node; } // namespace interfaces QT_BEGIN_NAMESPACE class QTimer; QT_END_NAMESPACE class SendCoinsRecipient { public: explicit SendCoinsRecipient() : amount(), fSubtractFeeFromAmount(false), nVersion(SendCoinsRecipient::CURRENT_VERSION) {} explicit SendCoinsRecipient(const QString &addr, const QString &_label, const Amount _amount, const QString &_message) : address(addr), label(_label), amount(_amount), message(_message), fSubtractFeeFromAmount(false), nVersion(SendCoinsRecipient::CURRENT_VERSION) {} // If from an unauthenticated payment request, this is used for storing the // addresses, e.g. address-A<br />address-B<br />address-C. // Info: As we don't need to process addresses in here when using payment // requests, we can abuse it for displaying an address list. // TOFO: This is a hack, should be replaced with a cleaner solution! QString address; QString label; Amount amount; // If from a payment request, this is used for storing the memo QString message; #ifdef ENABLE_BIP70 // If from a payment request, paymentRequest.IsInitialized() will be true PaymentRequestPlus paymentRequest; #else // If building with BIP70 is disabled, keep the payment request around as // serialized string to ensure load/store is lossless std::string sPaymentRequest; #endif // Empty if no authentication or invalid signature/cert/etc. QString authenticatedMerchant; // memory only bool fSubtractFeeFromAmount; static const int CURRENT_VERSION = 1; int nVersion; ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream &s, Operation ser_action) { std::string sAddress = address.toStdString(); std::string sLabel = label.toStdString(); std::string sMessage = message.toStdString(); #ifdef ENABLE_BIP70 std::string sPaymentRequest; if (!ser_action.ForRead() && paymentRequest.IsInitialized()) { paymentRequest.SerializeToString(&sPaymentRequest); } #endif std::string sAuthenticatedMerchant = authenticatedMerchant.toStdString(); READWRITE(this->nVersion); READWRITE(sAddress); READWRITE(sLabel); READWRITE(amount); READWRITE(sMessage); READWRITE(sPaymentRequest); READWRITE(sAuthenticatedMerchant); if (ser_action.ForRead()) { address = QString::fromStdString(sAddress); label = QString::fromStdString(sLabel); message = QString::fromStdString(sMessage); #ifdef ENABLE_BIP70 if (!sPaymentRequest.empty()) { paymentRequest.parse(QByteArray::fromRawData( sPaymentRequest.data(), sPaymentRequest.size())); } #endif authenticatedMerchant = QString::fromStdString(sAuthenticatedMerchant); } } }; /** Interface to Bitcoin wallet from Qt view code. */ class WalletModel : public QObject { Q_OBJECT public: explicit WalletModel(std::unique_ptr<interfaces::Wallet> wallet, interfaces::Node &node, const PlatformStyle *platformStyle, OptionsModel *optionsModel, QObject *parent = nullptr); ~WalletModel(); // Returned by sendCoins enum StatusCode { OK, InvalidAmount, InvalidAddress, AmountExceedsBalance, AmountWithFeeExceedsBalance, DuplicateAddress, // Error returned when wallet is still locked TransactionCreationFailed, AbsurdFee, PaymentRequestExpired }; enum EncryptionStatus { // !wallet->IsCrypted() Unencrypted, // wallet->IsCrypted() && wallet->IsLocked() Locked, // wallet->IsCrypted() && !wallet->IsLocked() Unlocked }; OptionsModel *getOptionsModel(); AddressTableModel *getAddressTableModel(); TransactionTableModel *getTransactionTableModel(); RecentRequestsTableModel *getRecentRequestsTableModel(); EncryptionStatus getEncryptionStatus() const; // Check address for validity bool validateAddress(const QString &address); // Return status record for SendCoins, contains error id + information struct SendCoinsReturn { SendCoinsReturn(StatusCode _status = OK, QString _reasonCommitFailed = "") : status(_status), reasonCommitFailed(_reasonCommitFailed) {} StatusCode status; QString reasonCommitFailed; }; // prepare transaction for getting txfee before sending coins SendCoinsReturn prepareTransaction(WalletModelTransaction &transaction, const CCoinControl &coinControl); // Send coins to a list of recipients SendCoinsReturn sendCoins(WalletModelTransaction &transaction); // Wallet encryption bool setWalletEncrypted(bool encrypted, const SecureString &passphrase); // Passphrase only needed when unlocking bool setWalletLocked(bool locked, const SecureString &passPhrase = SecureString()); bool changePassphrase(const SecureString &oldPass, const SecureString &newPass); // RAI object for unlocking wallet, returned by requestUnlock() class UnlockContext { public: UnlockContext(WalletModel *wallet, bool valid, bool relock); ~UnlockContext(); bool isValid() const { return valid; } // Copy operator and constructor transfer the context UnlockContext(const UnlockContext &obj) { CopyFrom(obj); } UnlockContext &operator=(const UnlockContext &rhs) { CopyFrom(rhs); return *this; } private: WalletModel *wallet; bool valid; // mutable, as it can be set to false by copying mutable bool relock; void CopyFrom(const UnlockContext &rhs); }; UnlockContext requestUnlock(); void loadReceiveRequests(std::vector<std::string> &vReceiveRequests); bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest); static bool isWalletEnabled(); bool privateKeysDisabled() const; bool canGetAddresses() const; interfaces::Node &node() const { return m_node; } interfaces::Wallet &wallet() const { return *m_wallet; } const CChainParams &getChainParams() const; QString getWalletName() const; QString getDisplayName() const; bool isMultiwallet(); AddressTableModel *getAddressTableModel() const { return addressTableModel; } private: std::unique_ptr<interfaces::Wallet> m_wallet; std::unique_ptr<interfaces::Handler> m_handler_unload; std::unique_ptr<interfaces::Handler> m_handler_status_changed; std::unique_ptr<interfaces::Handler> m_handler_address_book_changed; std::unique_ptr<interfaces::Handler> m_handler_transaction_changed; std::unique_ptr<interfaces::Handler> m_handler_show_progress; std::unique_ptr<interfaces::Handler> m_handler_watch_only_changed; std::unique_ptr<interfaces::Handler> m_handler_can_get_addrs_changed; interfaces::Node &m_node; bool fHaveWatchOnly; bool fForceCheckBalanceChanged{false}; // Wallet has an options model for wallet-specific options (transaction fee, // for example) OptionsModel *optionsModel; AddressTableModel *addressTableModel; TransactionTableModel *transactionTableModel; RecentRequestsTableModel *recentRequestsTableModel; // Cache some values to be able to detect changes interfaces::WalletBalances m_cached_balances; EncryptionStatus cachedEncryptionStatus; int cachedNumBlocks; QTimer *pollTimer; void subscribeToCoreSignals(); void unsubscribeFromCoreSignals(); void checkBalanceChanged(const interfaces::WalletBalances &new_balances); Q_SIGNALS: // Signal that balance in wallet changed void balanceChanged(const interfaces::WalletBalances &balances); // Encryption status of wallet changed void encryptionStatusChanged(); // Signal emitted when wallet needs to be unlocked // It is valid behaviour for listeners to keep the wallet locked after this // signal; this means that the unlocking failed or was cancelled. void requireUnlock(); // Fired when a message should be reported to the user void message(const QString &title, const QString &message, unsigned int style); // Coins sent: from wallet, to recipient, in (serialized) transaction: void coinsSent(WalletModel *wallet, SendCoinsRecipient recipient, QByteArray transaction); // Show progress dialog e.g. for rescan void showProgress(const QString &title, int nProgress); // Watch-only address added void notifyWatchonlyChanged(bool fHaveWatchonly); // Signal that wallet is about to be removed void unload(); // Notify that there are now keys in the keypool void canGetAddressesChanged(); public Q_SLOTS: /** Wallet status might have changed. */ void updateStatus(); /** New transaction, or transaction changed status. */ void updateTransaction(); /** New, updated or removed address book entry. */ void updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status); /** Watch-only added. */ void updateWatchOnlyFlag(bool fHaveWatchonly); /** * Current, immature or unconfirmed balance might have changed - emit * 'balanceChanged' if so. */ void pollBalanceChanged(); }; #endif // BITCOIN_QT_WALLETMODEL_H
{ "pile_set_name": "Github" }
package moa.classifiers.rules.core.splitcriteria; import moa.classifiers.core.splitcriteria.SplitCriterion; public interface AMRulesSplitCriterion extends SplitCriterion{ public double[] computeBranchSplitMerits(double[][] postSplitDists); public double getMeritOfSplit(double[] preSplitDist, double[][] postSplitDists); public double getRangeOfMerit(double[] preSplitDist); }
{ "pile_set_name": "Github" }
package graphql import ( "fmt" "sort" . "github.com/playlyfe/go-graphql/language" ) type Schema struct { Document *Document QueryRoot *ObjectTypeDefinition MutationRoot *ObjectTypeDefinition } const INTROSPECTION_SCHEMA = ` scalar String scalar Boolean scalar Int scalar Float scalar ID type __Schema { types: [__Type!]! queryType: __Type! mutationType: __Type directives: [__Directive!]! } type __Type { kind: __TypeKind! name: String description: String # OBJECT and INTERFACE only fields(includeDeprecated: Boolean = false): [__Field!] # OBJECT only interfaces: [__Type!] # INTERFACE and UNION only possibleTypes: [__Type!] # ENUM only enumValues(includeDeprecated: Boolean = false): [__EnumValue!] # INPUT_OBJECT only inputFields: [__InputValue!] # NON_NULL and LIST only ofType: __Type } type __Field { name: String! description: String args: [__InputValue!]! type: __Type! isDeprecated: Boolean! deprecationReason: String } type __InputValue { name: String! description: String type: __Type! defaultValue: String } type __EnumValue { name: String! description: String isDeprecated: Boolean! deprecationReason: String } enum __TypeKind { SCALAR OBJECT INTERFACE UNION ENUM INPUT_OBJECT LIST NON_NULL } type __Directive { name: String! description: String args: [__InputValue!]! onOperation: Boolean! onFragment: Boolean! onField: Boolean! } ` func (executor *Executor) introspectType(params *ResolveParams, typeValue interface{}, d ...int) map[string]interface{} { depth := 0 if len(d) > 0 { depth = d[0] } depth += 1 if depth > 10 { return nil } schema := executor.Schema.Document typeIndex := schema.TypeIndex switch ttype := typeValue.(type) { case *NonNullType: return map[string]interface{}{ "kind": "NON_NULL", "ofType": executor.introspectType(params, ttype.Type, depth), } case *ListType: return map[string]interface{}{ "kind": "LIST", "ofType": executor.introspectType(params, ttype.Type, depth), } case *NamedType: return executor.introspectType(params, ttype.Name.Value, depth) case string: typeInfo := map[string]interface{}{ "name": ttype, } typeValue := typeIndex[ttype] switch __type := typeValue.(type) { case *ScalarTypeDefinition: typeInfo["kind"] = "SCALAR" typeInfo["description"] = __type.Description case *ObjectTypeDefinition: typeInfo["kind"] = "OBJECT" typeInfo["description"] = __type.Description case *InputObjectTypeDefinition: typeInfo["kind"] = "INPUT_OBJECT" typeInfo["description"] = __type.Description inputFields := []map[string]interface{}{} for _, inputValueDefinition := range __type.Fields { defaultValue, err := executor.valueFromAST(params.Context, inputValueDefinition.DefaultValue, executor.resolveNamedType(inputValueDefinition.Type), nil, nil) if err != nil { panic(err) } inputFields = append(inputFields, map[string]interface{}{ "name": inputValueDefinition.Name.Value, "description": inputValueDefinition.Description, "type": executor.introspectType(params, inputValueDefinition.Type, depth), "defaultValue": defaultValue, }) } typeInfo["inputFields"] = inputFields case *InterfaceTypeDefinition: typeInfo["kind"] = "INTERFACE" typeInfo["description"] = __type.Description possibleTypes := []map[string]interface{}{} for _, objectType := range schema.PossibleTypesIndex[__type.Name.Value] { possibleTypes = append(possibleTypes, executor.introspectType(params, objectType.Name.Value, depth)) } typeInfo["possibleTypes"] = possibleTypes case *UnionTypeDefinition: typeInfo["kind"] = "UNION" typeInfo["description"] = __type.Description possibleTypes := []map[string]interface{}{} for _, objectType := range schema.PossibleTypesIndex[__type.Name.Value] { possibleTypes = append(possibleTypes, executor.introspectType(params, objectType.Name.Value, depth)) } typeInfo["possibleTypes"] = possibleTypes case *EnumTypeDefinition: typeInfo["kind"] = "ENUM" typeInfo["description"] = __type.Description default: panic(fmt.Sprintf("Unknown Type %s", ttype)) } return typeInfo default: return nil } } func typenameResolver(typename string) func(params *ResolveParams) (interface{}, error) { return func(params *ResolveParams) (interface{}, error) { return typename, nil } } func NewSchema(schemaDefinition string, queryRoot string, mutationRoot string) (*Schema, map[string]interface{}, error) { parser := &Parser{} schema := &Schema{} resolvers := map[string]interface{}{} ast, err := parser.Parse(&ParseParams{ Source: schemaDefinition + INTROSPECTION_SCHEMA, }) if err != nil { return nil, nil, err } for _, definition := range ast.Definitions { switch operationDefinition := definition.(type) { case *ObjectTypeDefinition: if operationDefinition.Name.Value == queryRoot { schema.QueryRoot = operationDefinition } else if operationDefinition.Name.Value == mutationRoot { schema.MutationRoot = operationDefinition } resolvers[operationDefinition.Name.Value+"/__typename"] = typenameResolver(operationDefinition.Name.Value) } } if schema.QueryRoot == nil { return nil, nil, &GraphQLError{ Message: "The QueryRoot could not be found", } } // Add implict fields to query root schemaField := &FieldDefinition{ Name: &Name{ Value: "__schema", }, Description: "The GraphQL schema", Type: &NonNullType{ Type: &NamedType{ Name: &Name{ Value: "__Schema", }, }, }, Arguments: []*InputValueDefinition{}, ArgumentIndex: map[string]*InputValueDefinition{}, } nameArgument := &InputValueDefinition{ Name: &Name{ Value: "name", }, Description: "The name of the Type being inspected", Type: &NonNullType{ Type: &NamedType{ Name: &Name{ Value: "String", }, }, }, } typeField := &FieldDefinition{ Name: &Name{ Value: "__type", }, Description: "GraphQL Type introspection information", Arguments: []*InputValueDefinition{ nameArgument, }, ArgumentIndex: map[string]*InputValueDefinition{ "name": nameArgument, }, Type: &NamedType{ Name: &Name{ Value: "__Type", }, }, } schema.QueryRoot.FieldIndex["__schema"] = schemaField schema.QueryRoot.Fields = append(schema.QueryRoot.Fields, schemaField) schema.QueryRoot.FieldIndex["__type"] = typeField schema.QueryRoot.Fields = append(schema.QueryRoot.Fields, typeField) resolvers[queryRoot+"/__schema"] = func(params *ResolveParams) (interface{}, error) { executor := params.Executor result := map[string]interface{}{ "queryType": executor.introspectType(params, queryRoot), "directives": []map[string]interface{}{ { "name": "skip", "description": "Conditionally exclude a field or fragment during execution", "args": []map[string]interface{}{ { "name": "if", "description": "The condition value", "type": map[string]interface{}{ "kind": "NON_NULL", "ofType": map[string]interface{}{ "kind": "SCALAR", "name": "Boolean", "description": "A boolean value representing `true` or `false`", }, }, }, }, "onOperation": false, "onField": true, "onFragment": true, }, { "name": "include", "description": "Conditionally include a field or fragment during execution", "args": []map[string]interface{}{ { "name": "if", "description": "The condition value", "type": map[string]interface{}{ "kind": "NON_NULL", "ofType": map[string]interface{}{ "kind": "SCALAR", "name": "Boolean", "description": "A boolean value representing `true` or `false`", }, }, }, }, "onOperation": false, "onField": true, "onFragment": true, }, }, } //TODO: better handling for empty mutationRoot if schema.MutationRoot != nil { result["mutationType"] = executor.introspectType(params, mutationRoot) } return result, nil } resolvers["__Schema/types"] = func(params *ResolveParams) (interface{}, error) { types := []map[string]interface{}{} typeNames := []string{} for typeName, _ := range params.Schema.TypeIndex { typeNames = append(typeNames, typeName) } sort.Strings(typeNames) for _, typeName := range typeNames { if typeName == "__Schema" || typeName == "__Type" || typeName == "__Field" || typeName == "__InputValue" || typeName == "__EnumValue" || typeName == "__TypeKind" || typeName == "__Directive" { continue } types = append(types, params.Executor.introspectType(params, typeName)) } return types, nil } resolvers[queryRoot+"/__type"] = func(params *ResolveParams) (interface{}, error) { return params.Executor.introspectType(params, params.Args["name"]), nil } resolvers["__Type/fields"] = func(params *ResolveParams) (interface{}, error) { executor := params.Executor if typeInfo, ok := params.Source.(map[string]interface{}); ok { typeName := typeInfo["name"].(string) if typeInfo["kind"] == "OBJECT" { __type := params.Schema.TypeIndex[typeName].(*ObjectTypeDefinition) fields := []map[string]interface{}{} includeDeprecated := params.Args["includeDeprecated"].(bool) for _, fieldDefinition := range __type.Fields { if !includeDeprecated && fieldDefinition.IsDeprecated { continue } if typeName == queryRoot { fieldName := fieldDefinition.Name.Value if fieldName == "__schema" || fieldName == "__type" { continue } } args := []map[string]interface{}{} for _, inputValueDefinition := range fieldDefinition.Arguments { defaultValue, err := executor.valueFromAST(params.Context, inputValueDefinition.DefaultValue, executor.resolveNamedType(inputValueDefinition.Type), nil, nil) if err != nil { return nil, err } args = append(args, map[string]interface{}{ "name": inputValueDefinition.Name.Value, "description": inputValueDefinition.Description, "type": executor.introspectType(params, inputValueDefinition.Type), "defaultValue": defaultValue, }) } fields = append(fields, map[string]interface{}{ "name": fieldDefinition.Name.Value, "description": fieldDefinition.Description, "args": args, "type": executor.introspectType(params, fieldDefinition.Type), "isDeprecated": fieldDefinition.IsDeprecated, "deprecationReason": fieldDefinition.DeprecationReason, }) } return fields, nil } else if typeInfo["kind"] == "INTERFACE" { __type := params.Schema.TypeIndex[typeName].(*InterfaceTypeDefinition) fields := []map[string]interface{}{} includeDeprecated := params.Args["includeDeprecated"].(bool) for _, fieldDefinition := range __type.Fields { if !includeDeprecated && fieldDefinition.IsDeprecated { continue } args := []map[string]interface{}{} for _, inputValueDefinition := range fieldDefinition.Arguments { defaultValue, err := executor.valueFromAST(params.Context, inputValueDefinition.DefaultValue, executor.resolveNamedType(inputValueDefinition.Type), nil, nil) if err != nil { return nil, err } args = append(args, map[string]interface{}{ "name": inputValueDefinition.Name.Value, "description": inputValueDefinition.Description, "type": executor.introspectType(params, inputValueDefinition.Type), "defaultValue": defaultValue, }) } fields = append(fields, map[string]interface{}{ "name": fieldDefinition.Name.Value, "description": fieldDefinition.Description, "args": args, "type": executor.introspectType(params, fieldDefinition.Type), "isDeprecated": fieldDefinition.IsDeprecated, "deprecationReason": fieldDefinition.DeprecationReason, }) } return fields, nil } } return nil, nil } resolvers["__Type/interfaces"] = func(params *ResolveParams) (interface{}, error) { if typeInfo, ok := params.Source.(map[string]interface{}); ok { if typeName, ok := typeInfo["name"].(string); ok { __type := params.Schema.ObjectTypeIndex[typeName] if __type != nil { interfaceTypes := []map[string]interface{}{} if __type.Interfaces != nil { for _, namedType := range __type.Interfaces { interfaceTypes = append(interfaceTypes, params.Executor.introspectType(params, namedType.Name.Value)) } } return interfaceTypes, nil } } } return nil, nil } resolvers["__Type/enumValues"] = func(params *ResolveParams) (interface{}, error) { if typeInfo, ok := params.Source.(map[string]interface{}); ok { typeName := typeInfo["name"].(string) if typeInfo["kind"] == "ENUM" { __type := params.Schema.TypeIndex[typeName].(*EnumTypeDefinition) includeDeprecated := params.Args["includeDeprecated"].(bool) enumValues := []map[string]interface{}{} for _, enumValue := range __type.Values { if !includeDeprecated && enumValue.IsDeprecated { continue } enumValues = append(enumValues, map[string]interface{}{ "name": enumValue.Name.Value, "description": enumValue.Description, "isDeprecated": enumValue.IsDeprecated, "deprecationReason": enumValue.DeprecationReason, }) } return enumValues, nil } } return nil, nil } schema.Document = ast return schema, resolvers, nil }
{ "pile_set_name": "Github" }
/* * wpa_supplicant - DPP * Copyright (c) 2017, Qualcomm Atheros, Inc. * Copyright (c) 2018-2019, The Linux Foundation * * This software may be distributed under the terms of the BSD license. * See README for more details. */ #include "utils/includes.h" #include "utils/common.h" #include "utils/eloop.h" #include "utils/ip_addr.h" #include "common/dpp.h" #include "common/gas.h" #include "common/gas_server.h" #include "rsn_supp/wpa.h" #include "rsn_supp/pmksa_cache.h" #include "wpa_supplicant_i.h" #include "config.h" #include "driver_i.h" #include "offchannel.h" #include "gas_query.h" #include "bss.h" #include "scan.h" #include "notify.h" #include "dpp_supplicant.h" static int wpas_dpp_listen_start(struct wpa_supplicant *wpa_s, unsigned int freq); static void wpas_dpp_reply_wait_timeout(void *eloop_ctx, void *timeout_ctx); static void wpas_dpp_auth_success(struct wpa_supplicant *wpa_s, int initiator); static void wpas_dpp_tx_status(struct wpa_supplicant *wpa_s, unsigned int freq, const u8 *dst, const u8 *src, const u8 *bssid, const u8 *data, size_t data_len, enum offchannel_send_action_result result); static void wpas_dpp_init_timeout(void *eloop_ctx, void *timeout_ctx); static int wpas_dpp_auth_init_next(struct wpa_supplicant *wpa_s); static void wpas_dpp_tx_pkex_status(struct wpa_supplicant *wpa_s, unsigned int freq, const u8 *dst, const u8 *src, const u8 *bssid, const u8 *data, size_t data_len, enum offchannel_send_action_result result); static const u8 broadcast[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; /* Use a hardcoded Transaction ID 1 in Peer Discovery frames since there is only * a single transaction in progress at any point in time. */ static const u8 TRANSACTION_ID = 1; /** * wpas_dpp_qr_code - Parse and add DPP bootstrapping info from a QR Code * @wpa_s: Pointer to wpa_supplicant data * @cmd: DPP URI read from a QR Code * Returns: Identifier of the stored info or -1 on failure */ int wpas_dpp_qr_code(struct wpa_supplicant *wpa_s, const char *cmd) { struct dpp_bootstrap_info *bi; struct dpp_authentication *auth = wpa_s->dpp_auth; bi = dpp_add_qr_code(wpa_s->dpp, cmd); if (!bi) return -1; if (auth && auth->response_pending && dpp_notify_new_qr_code(auth, bi) == 1) { wpa_printf(MSG_DEBUG, "DPP: Sending out pending authentication response"); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d", MAC2STR(auth->peer_mac_addr), auth->curr_freq, DPP_PA_AUTHENTICATION_RESP); offchannel_send_action(wpa_s, auth->curr_freq, auth->peer_mac_addr, wpa_s->own_addr, broadcast, wpabuf_head(auth->resp_msg), wpabuf_len(auth->resp_msg), 500, wpas_dpp_tx_status, 0); } return bi->id; } static void wpas_dpp_auth_resp_retry_timeout(void *eloop_ctx, void *timeout_ctx) { struct wpa_supplicant *wpa_s = eloop_ctx; struct dpp_authentication *auth = wpa_s->dpp_auth; if (!auth || !auth->resp_msg) return; wpa_printf(MSG_DEBUG, "DPP: Retry Authentication Response after timeout"); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d", MAC2STR(auth->peer_mac_addr), auth->curr_freq, DPP_PA_AUTHENTICATION_RESP); offchannel_send_action(wpa_s, auth->curr_freq, auth->peer_mac_addr, wpa_s->own_addr, broadcast, wpabuf_head(auth->resp_msg), wpabuf_len(auth->resp_msg), 500, wpas_dpp_tx_status, 0); } static void wpas_dpp_auth_resp_retry(struct wpa_supplicant *wpa_s) { struct dpp_authentication *auth = wpa_s->dpp_auth; unsigned int wait_time, max_tries; if (!auth || !auth->resp_msg) return; if (wpa_s->dpp_resp_max_tries) max_tries = wpa_s->dpp_resp_max_tries; else max_tries = 5; auth->auth_resp_tries++; if (auth->auth_resp_tries >= max_tries) { wpa_printf(MSG_INFO, "DPP: No confirm received from initiator - stopping exchange"); offchannel_send_action_done(wpa_s); dpp_auth_deinit(wpa_s->dpp_auth); wpa_s->dpp_auth = NULL; return; } if (wpa_s->dpp_resp_retry_time) wait_time = wpa_s->dpp_resp_retry_time; else wait_time = 1000; wpa_printf(MSG_DEBUG, "DPP: Schedule retransmission of Authentication Response frame in %u ms", wait_time); eloop_cancel_timeout(wpas_dpp_auth_resp_retry_timeout, wpa_s, NULL); eloop_register_timeout(wait_time / 1000, (wait_time % 1000) * 1000, wpas_dpp_auth_resp_retry_timeout, wpa_s, NULL); } static void wpas_dpp_try_to_connect(struct wpa_supplicant *wpa_s) { wpa_printf(MSG_DEBUG, "DPP: Trying to connect to the new network"); wpa_s->disconnected = 0; wpa_s->reassociate = 1; wpa_s->scan_runs = 0; wpa_s->normal_scans = 0; wpa_supplicant_cancel_sched_scan(wpa_s); wpa_supplicant_req_scan(wpa_s, 0, 0); } static void wpas_dpp_tx_status(struct wpa_supplicant *wpa_s, unsigned int freq, const u8 *dst, const u8 *src, const u8 *bssid, const u8 *data, size_t data_len, enum offchannel_send_action_result result) { const char *res_txt; struct dpp_authentication *auth = wpa_s->dpp_auth; res_txt = result == OFFCHANNEL_SEND_ACTION_SUCCESS ? "SUCCESS" : (result == OFFCHANNEL_SEND_ACTION_NO_ACK ? "no-ACK" : "FAILED"); wpa_printf(MSG_DEBUG, "DPP: TX status: freq=%u dst=" MACSTR " result=%s", freq, MAC2STR(dst), res_txt); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX_STATUS "dst=" MACSTR " freq=%u result=%s", MAC2STR(dst), freq, res_txt); if (!wpa_s->dpp_auth) { wpa_printf(MSG_DEBUG, "DPP: Ignore TX status since there is no ongoing authentication exchange"); return; } #ifdef CONFIG_DPP2 if (auth->connect_on_tx_status) { wpa_printf(MSG_DEBUG, "DPP: Try to connect after completed configuration result"); wpas_dpp_try_to_connect(wpa_s); dpp_auth_deinit(wpa_s->dpp_auth); wpa_s->dpp_auth = NULL; return; } #endif /* CONFIG_DPP2 */ if (wpa_s->dpp_auth->remove_on_tx_status) { wpa_printf(MSG_DEBUG, "DPP: Terminate authentication exchange due to an earlier error"); eloop_cancel_timeout(wpas_dpp_init_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_dpp_reply_wait_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_dpp_auth_resp_retry_timeout, wpa_s, NULL); offchannel_send_action_done(wpa_s); dpp_auth_deinit(wpa_s->dpp_auth); wpa_s->dpp_auth = NULL; return; } if (wpa_s->dpp_auth_ok_on_ack) wpas_dpp_auth_success(wpa_s, 1); if (!is_broadcast_ether_addr(dst) && result != OFFCHANNEL_SEND_ACTION_SUCCESS) { wpa_printf(MSG_DEBUG, "DPP: Unicast DPP Action frame was not ACKed"); if (auth->waiting_auth_resp) { /* In case of DPP Authentication Request frame, move to * the next channel immediately. */ offchannel_send_action_done(wpa_s); wpas_dpp_auth_init_next(wpa_s); return; } if (auth->waiting_auth_conf) { wpas_dpp_auth_resp_retry(wpa_s); return; } } if (!is_broadcast_ether_addr(dst) && auth->waiting_auth_resp && result == OFFCHANNEL_SEND_ACTION_SUCCESS) { /* Allow timeout handling to stop iteration if no response is * received from a peer that has ACKed a request. */ auth->auth_req_ack = 1; } if (!wpa_s->dpp_auth_ok_on_ack && wpa_s->dpp_auth->neg_freq > 0 && wpa_s->dpp_auth->curr_freq != wpa_s->dpp_auth->neg_freq) { wpa_printf(MSG_DEBUG, "DPP: Move from curr_freq %u MHz to neg_freq %u MHz for response", wpa_s->dpp_auth->curr_freq, wpa_s->dpp_auth->neg_freq); offchannel_send_action_done(wpa_s); wpas_dpp_listen_start(wpa_s, wpa_s->dpp_auth->neg_freq); } if (wpa_s->dpp_auth_ok_on_ack) wpa_s->dpp_auth_ok_on_ack = 0; } static void wpas_dpp_reply_wait_timeout(void *eloop_ctx, void *timeout_ctx) { struct wpa_supplicant *wpa_s = eloop_ctx; struct dpp_authentication *auth = wpa_s->dpp_auth; unsigned int freq; struct os_reltime now, diff; unsigned int wait_time, diff_ms; if (!auth || !auth->waiting_auth_resp) return; wait_time = wpa_s->dpp_resp_wait_time ? wpa_s->dpp_resp_wait_time : 2000; os_get_reltime(&now); os_reltime_sub(&now, &wpa_s->dpp_last_init, &diff); diff_ms = diff.sec * 1000 + diff.usec / 1000; wpa_printf(MSG_DEBUG, "DPP: Reply wait timeout - wait_time=%u diff_ms=%u", wait_time, diff_ms); if (auth->auth_req_ack && diff_ms >= wait_time) { /* Peer ACK'ed Authentication Request frame, but did not reply * with Authentication Response frame within two seconds. */ wpa_printf(MSG_INFO, "DPP: No response received from responder - stopping initiation attempt"); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_AUTH_INIT_FAILED); offchannel_send_action_done(wpa_s); wpas_dpp_listen_stop(wpa_s); dpp_auth_deinit(auth); wpa_s->dpp_auth = NULL; return; } if (diff_ms >= wait_time) { /* Authentication Request frame was not ACK'ed and no reply * was receiving within two seconds. */ wpa_printf(MSG_DEBUG, "DPP: Continue Initiator channel iteration"); offchannel_send_action_done(wpa_s); wpas_dpp_listen_stop(wpa_s); wpas_dpp_auth_init_next(wpa_s); return; } /* Driver did not support 2000 ms long wait_time with TX command, so * schedule listen operation to continue waiting for the response. * * DPP listen operations continue until stopped, so simply schedule a * new call to this function at the point when the two second reply * wait has expired. */ wait_time -= diff_ms; freq = auth->curr_freq; if (auth->neg_freq > 0) freq = auth->neg_freq; wpa_printf(MSG_DEBUG, "DPP: Continue reply wait on channel %u MHz for %u ms", freq, wait_time); wpa_s->dpp_in_response_listen = 1; wpas_dpp_listen_start(wpa_s, freq); eloop_register_timeout(wait_time / 1000, (wait_time % 1000) * 1000, wpas_dpp_reply_wait_timeout, wpa_s, NULL); } static void wpas_dpp_set_testing_options(struct wpa_supplicant *wpa_s, struct dpp_authentication *auth) { #ifdef CONFIG_TESTING_OPTIONS if (wpa_s->dpp_config_obj_override) auth->config_obj_override = os_strdup(wpa_s->dpp_config_obj_override); if (wpa_s->dpp_discovery_override) auth->discovery_override = os_strdup(wpa_s->dpp_discovery_override); if (wpa_s->dpp_groups_override) auth->groups_override = os_strdup(wpa_s->dpp_groups_override); auth->ignore_netaccesskey_mismatch = wpa_s->dpp_ignore_netaccesskey_mismatch; #endif /* CONFIG_TESTING_OPTIONS */ } static void wpas_dpp_init_timeout(void *eloop_ctx, void *timeout_ctx) { struct wpa_supplicant *wpa_s = eloop_ctx; if (!wpa_s->dpp_auth) return; wpa_printf(MSG_DEBUG, "DPP: Retry initiation after timeout"); wpas_dpp_auth_init_next(wpa_s); } static int wpas_dpp_auth_init_next(struct wpa_supplicant *wpa_s) { struct dpp_authentication *auth = wpa_s->dpp_auth; const u8 *dst; unsigned int wait_time, max_wait_time, freq, max_tries, used; struct os_reltime now, diff; wpa_s->dpp_in_response_listen = 0; if (!auth) return -1; if (auth->freq_idx == 0) os_get_reltime(&wpa_s->dpp_init_iter_start); if (auth->freq_idx >= auth->num_freq) { auth->num_freq_iters++; if (wpa_s->dpp_init_max_tries) max_tries = wpa_s->dpp_init_max_tries; else max_tries = 5; if (auth->num_freq_iters >= max_tries || auth->auth_req_ack) { wpa_printf(MSG_INFO, "DPP: No response received from responder - stopping initiation attempt"); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_AUTH_INIT_FAILED); eloop_cancel_timeout(wpas_dpp_reply_wait_timeout, wpa_s, NULL); offchannel_send_action_done(wpa_s); dpp_auth_deinit(wpa_s->dpp_auth); wpa_s->dpp_auth = NULL; return -1; } auth->freq_idx = 0; eloop_cancel_timeout(wpas_dpp_init_timeout, wpa_s, NULL); if (wpa_s->dpp_init_retry_time) wait_time = wpa_s->dpp_init_retry_time; else wait_time = 10000; os_get_reltime(&now); os_reltime_sub(&now, &wpa_s->dpp_init_iter_start, &diff); used = diff.sec * 1000 + diff.usec / 1000; if (used > wait_time) wait_time = 0; else wait_time -= used; wpa_printf(MSG_DEBUG, "DPP: Next init attempt in %u ms", wait_time); eloop_register_timeout(wait_time / 1000, (wait_time % 1000) * 1000, wpas_dpp_init_timeout, wpa_s, NULL); return 0; } freq = auth->freq[auth->freq_idx++]; auth->curr_freq = freq; if (is_zero_ether_addr(auth->peer_bi->mac_addr)) dst = broadcast; else dst = auth->peer_bi->mac_addr; wpa_s->dpp_auth_ok_on_ack = 0; eloop_cancel_timeout(wpas_dpp_reply_wait_timeout, wpa_s, NULL); wait_time = wpa_s->max_remain_on_chan; max_wait_time = wpa_s->dpp_resp_wait_time ? wpa_s->dpp_resp_wait_time : 2000; if (wait_time > max_wait_time) wait_time = max_wait_time; wait_time += 10; /* give the driver some extra time to complete */ eloop_register_timeout(wait_time / 1000, (wait_time % 1000) * 1000, wpas_dpp_reply_wait_timeout, wpa_s, NULL); wait_time -= 10; if (auth->neg_freq > 0 && freq != auth->neg_freq) { wpa_printf(MSG_DEBUG, "DPP: Initiate on %u MHz and move to neg_freq %u MHz for response", freq, auth->neg_freq); } wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d", MAC2STR(dst), freq, DPP_PA_AUTHENTICATION_REQ); auth->auth_req_ack = 0; os_get_reltime(&wpa_s->dpp_last_init); return offchannel_send_action(wpa_s, freq, dst, wpa_s->own_addr, broadcast, wpabuf_head(auth->req_msg), wpabuf_len(auth->req_msg), wait_time, wpas_dpp_tx_status, 0); } int wpas_dpp_auth_init(struct wpa_supplicant *wpa_s, const char *cmd) { const char *pos; struct dpp_bootstrap_info *peer_bi, *own_bi = NULL; struct dpp_authentication *auth; u8 allowed_roles = DPP_CAPAB_CONFIGURATOR; unsigned int neg_freq = 0; int tcp = 0; #ifdef CONFIG_DPP2 int tcp_port = DPP_TCP_PORT; struct hostapd_ip_addr ipaddr; char *addr; #endif /* CONFIG_DPP2 */ wpa_s->dpp_gas_client = 0; pos = os_strstr(cmd, " peer="); if (!pos) return -1; pos += 6; peer_bi = dpp_bootstrap_get_id(wpa_s->dpp, atoi(pos)); if (!peer_bi) { wpa_printf(MSG_INFO, "DPP: Could not find bootstrapping info for the identified peer"); return -1; } #ifdef CONFIG_DPP2 pos = os_strstr(cmd, " tcp_port="); if (pos) { pos += 10; tcp_port = atoi(pos); } addr = get_param(cmd, " tcp_addr="); if (addr) { int res; res = hostapd_parse_ip_addr(addr, &ipaddr); os_free(addr); if (res) return -1; tcp = 1; } #endif /* CONFIG_DPP2 */ pos = os_strstr(cmd, " own="); if (pos) { pos += 5; own_bi = dpp_bootstrap_get_id(wpa_s->dpp, atoi(pos)); if (!own_bi) { wpa_printf(MSG_INFO, "DPP: Could not find bootstrapping info for the identified local entry"); return -1; } if (peer_bi->curve != own_bi->curve) { wpa_printf(MSG_INFO, "DPP: Mismatching curves in bootstrapping info (peer=%s own=%s)", peer_bi->curve->name, own_bi->curve->name); return -1; } } pos = os_strstr(cmd, " role="); if (pos) { pos += 6; if (os_strncmp(pos, "configurator", 12) == 0) allowed_roles = DPP_CAPAB_CONFIGURATOR; else if (os_strncmp(pos, "enrollee", 8) == 0) allowed_roles = DPP_CAPAB_ENROLLEE; else if (os_strncmp(pos, "either", 6) == 0) allowed_roles = DPP_CAPAB_CONFIGURATOR | DPP_CAPAB_ENROLLEE; else goto fail; } pos = os_strstr(cmd, " netrole="); if (pos) { pos += 9; wpa_s->dpp_netrole_ap = os_strncmp(pos, "ap", 2) == 0; } pos = os_strstr(cmd, " neg_freq="); if (pos) neg_freq = atoi(pos + 10); if (!tcp && wpa_s->dpp_auth) { eloop_cancel_timeout(wpas_dpp_init_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_dpp_reply_wait_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_dpp_auth_resp_retry_timeout, wpa_s, NULL); offchannel_send_action_done(wpa_s); dpp_auth_deinit(wpa_s->dpp_auth); wpa_s->dpp_auth = NULL; } auth = dpp_auth_init(wpa_s, peer_bi, own_bi, allowed_roles, neg_freq, wpa_s->hw.modes, wpa_s->hw.num_modes); if (!auth) goto fail; wpas_dpp_set_testing_options(wpa_s, auth); if (dpp_set_configurator(wpa_s->dpp, wpa_s, auth, cmd) < 0) { dpp_auth_deinit(auth); goto fail; } auth->neg_freq = neg_freq; if (!is_zero_ether_addr(peer_bi->mac_addr)) os_memcpy(auth->peer_mac_addr, peer_bi->mac_addr, ETH_ALEN); #ifdef CONFIG_DPP2 if (tcp) return dpp_tcp_init(wpa_s->dpp, auth, &ipaddr, tcp_port); #endif /* CONFIG_DPP2 */ wpa_s->dpp_auth = auth; return wpas_dpp_auth_init_next(wpa_s); fail: return -1; } struct wpas_dpp_listen_work { unsigned int freq; unsigned int duration; struct wpabuf *probe_resp_ie; }; static void wpas_dpp_listen_work_free(struct wpas_dpp_listen_work *lwork) { if (!lwork) return; os_free(lwork); } static void wpas_dpp_listen_work_done(struct wpa_supplicant *wpa_s) { struct wpas_dpp_listen_work *lwork; if (!wpa_s->dpp_listen_work) return; lwork = wpa_s->dpp_listen_work->ctx; wpas_dpp_listen_work_free(lwork); radio_work_done(wpa_s->dpp_listen_work); wpa_s->dpp_listen_work = NULL; } static void dpp_start_listen_cb(struct wpa_radio_work *work, int deinit) { struct wpa_supplicant *wpa_s = work->wpa_s; struct wpas_dpp_listen_work *lwork = work->ctx; if (deinit) { if (work->started) { wpa_s->dpp_listen_work = NULL; wpas_dpp_listen_stop(wpa_s); } wpas_dpp_listen_work_free(lwork); return; } wpa_s->dpp_listen_work = work; wpa_s->dpp_pending_listen_freq = lwork->freq; if (wpa_drv_remain_on_channel(wpa_s, lwork->freq, wpa_s->max_remain_on_chan) < 0) { wpa_printf(MSG_DEBUG, "DPP: Failed to request the driver to remain on channel (%u MHz) for listen", lwork->freq); wpa_s->dpp_listen_freq = 0; wpas_dpp_listen_work_done(wpa_s); wpa_s->dpp_pending_listen_freq = 0; return; } wpa_s->off_channel_freq = 0; wpa_s->roc_waiting_drv_freq = lwork->freq; } static int wpas_dpp_listen_start(struct wpa_supplicant *wpa_s, unsigned int freq) { struct wpas_dpp_listen_work *lwork; if (wpa_s->dpp_listen_work) { wpa_printf(MSG_DEBUG, "DPP: Reject start_listen since dpp_listen_work already exists"); return -1; } if (wpa_s->dpp_listen_freq) wpas_dpp_listen_stop(wpa_s); wpa_s->dpp_listen_freq = freq; lwork = os_zalloc(sizeof(*lwork)); if (!lwork) return -1; lwork->freq = freq; if (radio_add_work(wpa_s, freq, "dpp-listen", 0, dpp_start_listen_cb, lwork) < 0) { wpas_dpp_listen_work_free(lwork); return -1; } return 0; } int wpas_dpp_listen(struct wpa_supplicant *wpa_s, const char *cmd) { int freq; freq = atoi(cmd); if (freq <= 0) return -1; if (os_strstr(cmd, " role=configurator")) wpa_s->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR; else if (os_strstr(cmd, " role=enrollee")) wpa_s->dpp_allowed_roles = DPP_CAPAB_ENROLLEE; else wpa_s->dpp_allowed_roles = DPP_CAPAB_CONFIGURATOR | DPP_CAPAB_ENROLLEE; wpa_s->dpp_qr_mutual = os_strstr(cmd, " qr=mutual") != NULL; wpa_s->dpp_netrole_ap = os_strstr(cmd, " netrole=ap") != NULL; if (wpa_s->dpp_listen_freq == (unsigned int) freq) { wpa_printf(MSG_DEBUG, "DPP: Already listening on %u MHz", freq); return 0; } return wpas_dpp_listen_start(wpa_s, freq); } void wpas_dpp_listen_stop(struct wpa_supplicant *wpa_s) { wpa_s->dpp_in_response_listen = 0; if (!wpa_s->dpp_listen_freq) return; wpa_printf(MSG_DEBUG, "DPP: Stop listen on %u MHz", wpa_s->dpp_listen_freq); wpa_drv_cancel_remain_on_channel(wpa_s); wpa_s->dpp_listen_freq = 0; wpas_dpp_listen_work_done(wpa_s); } void wpas_dpp_cancel_remain_on_channel_cb(struct wpa_supplicant *wpa_s, unsigned int freq) { wpas_dpp_listen_work_done(wpa_s); if (wpa_s->dpp_auth && wpa_s->dpp_in_response_listen) { unsigned int new_freq; /* Continue listen with a new remain-on-channel */ if (wpa_s->dpp_auth->neg_freq > 0) new_freq = wpa_s->dpp_auth->neg_freq; else new_freq = wpa_s->dpp_auth->curr_freq; wpa_printf(MSG_DEBUG, "DPP: Continue wait on %u MHz for the ongoing DPP provisioning session", new_freq); wpas_dpp_listen_start(wpa_s, new_freq); return; } if (wpa_s->dpp_listen_freq) { /* Continue listen with a new remain-on-channel */ wpas_dpp_listen_start(wpa_s, wpa_s->dpp_listen_freq); } } static void wpas_dpp_rx_auth_req(struct wpa_supplicant *wpa_s, const u8 *src, const u8 *hdr, const u8 *buf, size_t len, unsigned int freq) { const u8 *r_bootstrap, *i_bootstrap; u16 r_bootstrap_len, i_bootstrap_len; struct dpp_bootstrap_info *own_bi = NULL, *peer_bi = NULL; if (!wpa_s->dpp) return; wpa_printf(MSG_DEBUG, "DPP: Authentication Request from " MACSTR, MAC2STR(src)); r_bootstrap = dpp_get_attr(buf, len, DPP_ATTR_R_BOOTSTRAP_KEY_HASH, &r_bootstrap_len); if (!r_bootstrap || r_bootstrap_len != SHA256_MAC_LEN) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_FAIL "Missing or invalid required Responder Bootstrapping Key Hash attribute"); return; } wpa_hexdump(MSG_MSGDUMP, "DPP: Responder Bootstrapping Key Hash", r_bootstrap, r_bootstrap_len); i_bootstrap = dpp_get_attr(buf, len, DPP_ATTR_I_BOOTSTRAP_KEY_HASH, &i_bootstrap_len); if (!i_bootstrap || i_bootstrap_len != SHA256_MAC_LEN) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_FAIL "Missing or invalid required Initiator Bootstrapping Key Hash attribute"); return; } wpa_hexdump(MSG_MSGDUMP, "DPP: Initiator Bootstrapping Key Hash", i_bootstrap, i_bootstrap_len); /* Try to find own and peer bootstrapping key matches based on the * received hash values */ dpp_bootstrap_find_pair(wpa_s->dpp, i_bootstrap, r_bootstrap, &own_bi, &peer_bi); if (!own_bi) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_FAIL "No matching own bootstrapping key found - ignore message"); return; } if (wpa_s->dpp_auth) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_FAIL "Already in DPP authentication exchange - ignore new one"); return; } wpa_s->dpp_gas_client = 0; wpa_s->dpp_auth_ok_on_ack = 0; wpa_s->dpp_auth = dpp_auth_req_rx(wpa_s, wpa_s->dpp_allowed_roles, wpa_s->dpp_qr_mutual, peer_bi, own_bi, freq, hdr, buf, len); if (!wpa_s->dpp_auth) { wpa_printf(MSG_DEBUG, "DPP: No response generated"); return; } wpas_dpp_set_testing_options(wpa_s, wpa_s->dpp_auth); if (dpp_set_configurator(wpa_s->dpp, wpa_s, wpa_s->dpp_auth, wpa_s->dpp_configurator_params) < 0) { dpp_auth_deinit(wpa_s->dpp_auth); wpa_s->dpp_auth = NULL; return; } os_memcpy(wpa_s->dpp_auth->peer_mac_addr, src, ETH_ALEN); if (wpa_s->dpp_listen_freq && wpa_s->dpp_listen_freq != wpa_s->dpp_auth->curr_freq) { wpa_printf(MSG_DEBUG, "DPP: Stop listen on %u MHz to allow response on the request %u MHz", wpa_s->dpp_listen_freq, wpa_s->dpp_auth->curr_freq); wpas_dpp_listen_stop(wpa_s); } wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d", MAC2STR(src), wpa_s->dpp_auth->curr_freq, DPP_PA_AUTHENTICATION_RESP); offchannel_send_action(wpa_s, wpa_s->dpp_auth->curr_freq, src, wpa_s->own_addr, broadcast, wpabuf_head(wpa_s->dpp_auth->resp_msg), wpabuf_len(wpa_s->dpp_auth->resp_msg), 500, wpas_dpp_tx_status, 0); } static void wpas_dpp_start_gas_server(struct wpa_supplicant *wpa_s) { /* TODO: stop wait and start ROC */ } static struct wpa_ssid * wpas_dpp_add_network(struct wpa_supplicant *wpa_s, struct dpp_authentication *auth) { struct wpa_ssid *ssid; #ifdef CONFIG_DPP2 if (auth->akm == DPP_AKM_SAE) { #ifdef CONFIG_SAE struct wpa_driver_capa capa; int res; res = wpa_drv_get_capa(wpa_s, &capa); if (res == 0 && !(capa.key_mgmt & WPA_DRIVER_CAPA_KEY_MGMT_SAE) && !(wpa_s->drv_flags & WPA_DRIVER_FLAGS_SAE)) { wpa_printf(MSG_DEBUG, "DPP: SAE not supported by the driver"); return NULL; } #else /* CONFIG_SAE */ wpa_printf(MSG_DEBUG, "DPP: SAE not supported in the build"); return NULL; #endif /* CONFIG_SAE */ } #endif /* CONFIG_DPP2 */ ssid = wpa_config_add_network(wpa_s->conf); if (!ssid) return NULL; wpas_notify_network_added(wpa_s, ssid); wpa_config_set_network_defaults(ssid); ssid->disabled = 1; ssid->ssid = os_malloc(auth->ssid_len); if (!ssid->ssid) goto fail; os_memcpy(ssid->ssid, auth->ssid, auth->ssid_len); ssid->ssid_len = auth->ssid_len; if (auth->connector) { ssid->key_mgmt = WPA_KEY_MGMT_DPP; ssid->ieee80211w = MGMT_FRAME_PROTECTION_REQUIRED; ssid->dpp_connector = os_strdup(auth->connector); if (!ssid->dpp_connector) goto fail; } if (auth->c_sign_key) { ssid->dpp_csign = os_malloc(wpabuf_len(auth->c_sign_key)); if (!ssid->dpp_csign) goto fail; os_memcpy(ssid->dpp_csign, wpabuf_head(auth->c_sign_key), wpabuf_len(auth->c_sign_key)); ssid->dpp_csign_len = wpabuf_len(auth->c_sign_key); } if (auth->net_access_key) { ssid->dpp_netaccesskey = os_malloc(wpabuf_len(auth->net_access_key)); if (!ssid->dpp_netaccesskey) goto fail; os_memcpy(ssid->dpp_netaccesskey, wpabuf_head(auth->net_access_key), wpabuf_len(auth->net_access_key)); ssid->dpp_netaccesskey_len = wpabuf_len(auth->net_access_key); ssid->dpp_netaccesskey_expiry = auth->net_access_key_expiry; } if (!auth->connector || dpp_akm_psk(auth->akm) || dpp_akm_sae(auth->akm)) { if (!auth->connector) ssid->key_mgmt = 0; if (dpp_akm_psk(auth->akm)) ssid->key_mgmt |= WPA_KEY_MGMT_PSK | WPA_KEY_MGMT_PSK_SHA256 | WPA_KEY_MGMT_FT_PSK; if (dpp_akm_sae(auth->akm)) ssid->key_mgmt |= WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_FT_SAE; ssid->ieee80211w = MGMT_FRAME_PROTECTION_OPTIONAL; if (auth->passphrase[0]) { if (wpa_config_set_quoted(ssid, "psk", auth->passphrase) < 0) goto fail; wpa_config_update_psk(ssid); ssid->export_keys = 1; } else { ssid->psk_set = auth->psk_set; os_memcpy(ssid->psk, auth->psk, PMK_LEN); } } return ssid; fail: wpas_notify_network_removed(wpa_s, ssid); wpa_config_remove_network(wpa_s->conf, ssid->id); return NULL; } static int wpas_dpp_process_config(struct wpa_supplicant *wpa_s, struct dpp_authentication *auth) { struct wpa_ssid *ssid; if (wpa_s->conf->dpp_config_processing < 1) return 0; ssid = wpas_dpp_add_network(wpa_s, auth); if (!ssid) return -1; wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_NETWORK_ID "%d", ssid->id); if (wpa_s->conf->dpp_config_processing == 2) ssid->disabled = 0; #ifndef CONFIG_NO_CONFIG_WRITE if (wpa_s->conf->update_config && wpa_config_write(wpa_s->confname, wpa_s->conf)) wpa_printf(MSG_DEBUG, "DPP: Failed to update configuration"); #endif /* CONFIG_NO_CONFIG_WRITE */ if (wpa_s->conf->dpp_config_processing < 2) return 0; #ifdef CONFIG_DPP2 if (auth->peer_version >= 2) { wpa_printf(MSG_DEBUG, "DPP: Postpone connection attempt to wait for completion of DPP Configuration Result"); auth->connect_on_tx_status = 1; return 0; } #endif /* CONFIG_DPP2 */ wpas_dpp_try_to_connect(wpa_s); return 0; } static int wpas_dpp_handle_config_obj(struct wpa_supplicant *wpa_s, struct dpp_authentication *auth) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_RECEIVED); if (auth->ssid_len) wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONFOBJ_SSID "%s", wpa_ssid_txt(auth->ssid, auth->ssid_len)); if (auth->connector) { /* TODO: Save the Connector and consider using a command * to fetch the value instead of sending an event with * it. The Connector could end up being larger than what * most clients are ready to receive as an event * message. */ wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONNECTOR "%s", auth->connector); } if (auth->c_sign_key) { char *hex; size_t hexlen; hexlen = 2 * wpabuf_len(auth->c_sign_key) + 1; hex = os_malloc(hexlen); if (hex) { wpa_snprintf_hex(hex, hexlen, wpabuf_head(auth->c_sign_key), wpabuf_len(auth->c_sign_key)); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_C_SIGN_KEY "%s", hex); os_free(hex); } } if (auth->net_access_key) { char *hex; size_t hexlen; hexlen = 2 * wpabuf_len(auth->net_access_key) + 1; hex = os_malloc(hexlen); if (hex) { wpa_snprintf_hex(hex, hexlen, wpabuf_head(auth->net_access_key), wpabuf_len(auth->net_access_key)); if (auth->net_access_key_expiry) wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_NET_ACCESS_KEY "%s %lu", hex, (long unsigned) auth->net_access_key_expiry); else wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_NET_ACCESS_KEY "%s", hex); os_free(hex); } } return wpas_dpp_process_config(wpa_s, auth); } static void wpas_dpp_gas_resp_cb(void *ctx, const u8 *addr, u8 dialog_token, enum gas_query_result result, const struct wpabuf *adv_proto, const struct wpabuf *resp, u16 status_code) { struct wpa_supplicant *wpa_s = ctx; const u8 *pos; struct dpp_authentication *auth = wpa_s->dpp_auth; int res; enum dpp_status_error status = DPP_STATUS_CONFIG_REJECTED; wpa_s->dpp_gas_dialog_token = -1; if (!auth || !auth->auth_success) { wpa_printf(MSG_DEBUG, "DPP: No matching exchange in progress"); return; } if (result != GAS_QUERY_SUCCESS || !resp || status_code != WLAN_STATUS_SUCCESS) { wpa_printf(MSG_DEBUG, "DPP: GAS query did not succeed"); goto fail; } wpa_hexdump_buf(MSG_DEBUG, "DPP: Configuration Response adv_proto", adv_proto); wpa_hexdump_buf(MSG_DEBUG, "DPP: Configuration Response (GAS response)", resp); if (wpabuf_len(adv_proto) != 10 || !(pos = wpabuf_head(adv_proto)) || pos[0] != WLAN_EID_ADV_PROTO || pos[1] != 8 || pos[3] != WLAN_EID_VENDOR_SPECIFIC || pos[4] != 5 || WPA_GET_BE24(&pos[5]) != OUI_WFA || pos[8] != 0x1a || pos[9] != 1) { wpa_printf(MSG_DEBUG, "DPP: Not a DPP Advertisement Protocol ID"); goto fail; } if (dpp_conf_resp_rx(auth, resp) < 0) { wpa_printf(MSG_DEBUG, "DPP: Configuration attempt failed"); goto fail; } res = wpas_dpp_handle_config_obj(wpa_s, auth); if (res < 0) goto fail; status = DPP_STATUS_OK; #ifdef CONFIG_TESTING_OPTIONS if (dpp_test == DPP_TEST_REJECT_CONFIG) { wpa_printf(MSG_INFO, "DPP: TESTING - Reject Config Object"); status = DPP_STATUS_CONFIG_REJECTED; } #endif /* CONFIG_TESTING_OPTIONS */ fail: if (status != DPP_STATUS_OK) wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_FAILED); #ifdef CONFIG_DPP2 if (auth->peer_version >= 2 && auth->conf_resp_status == DPP_STATUS_OK) { struct wpabuf *msg; wpa_printf(MSG_DEBUG, "DPP: Send DPP Configuration Result"); msg = dpp_build_conf_result(auth, status); if (!msg) goto fail2; wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d", MAC2STR(addr), auth->curr_freq, DPP_PA_CONFIGURATION_RESULT); offchannel_send_action(wpa_s, auth->curr_freq, addr, wpa_s->own_addr, broadcast, wpabuf_head(msg), wpabuf_len(msg), 500, wpas_dpp_tx_status, 0); wpabuf_free(msg); /* This exchange will be terminated in the TX status handler */ return; } fail2: #endif /* CONFIG_DPP2 */ dpp_auth_deinit(wpa_s->dpp_auth); wpa_s->dpp_auth = NULL; } static void wpas_dpp_start_gas_client(struct wpa_supplicant *wpa_s) { struct dpp_authentication *auth = wpa_s->dpp_auth; struct wpabuf *buf; char json[100]; int res; wpa_s->dpp_gas_client = 1; os_snprintf(json, sizeof(json), "{\"name\":\"Test\"," "\"wi-fi_tech\":\"infra\"," "\"netRole\":\"%s\"}", wpa_s->dpp_netrole_ap ? "ap" : "sta"); #ifdef CONFIG_TESTING_OPTIONS if (dpp_test == DPP_TEST_INVALID_CONFIG_ATTR_OBJ_CONF_REQ) { wpa_printf(MSG_INFO, "DPP: TESTING - invalid Config Attr"); json[29] = 'k'; /* replace "infra" with "knfra" */ } #endif /* CONFIG_TESTING_OPTIONS */ wpa_printf(MSG_DEBUG, "DPP: GAS Config Attributes: %s", json); offchannel_send_action_done(wpa_s); wpas_dpp_listen_stop(wpa_s); buf = dpp_build_conf_req(auth, json); if (!buf) { wpa_printf(MSG_DEBUG, "DPP: No configuration request data available"); return; } wpa_printf(MSG_DEBUG, "DPP: GAS request to " MACSTR " (freq %u MHz)", MAC2STR(auth->peer_mac_addr), auth->curr_freq); res = gas_query_req(wpa_s->gas, auth->peer_mac_addr, auth->curr_freq, 1, buf, wpas_dpp_gas_resp_cb, wpa_s); if (res < 0) { wpa_msg(wpa_s, MSG_DEBUG, "GAS: Failed to send Query Request"); wpabuf_free(buf); } else { wpa_printf(MSG_DEBUG, "DPP: GAS query started with dialog token %u", res); wpa_s->dpp_gas_dialog_token = res; } } static void wpas_dpp_auth_success(struct wpa_supplicant *wpa_s, int initiator) { wpa_printf(MSG_DEBUG, "DPP: Authentication succeeded"); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_AUTH_SUCCESS "init=%d", initiator); #ifdef CONFIG_TESTING_OPTIONS if (dpp_test == DPP_TEST_STOP_AT_AUTH_CONF) { wpa_printf(MSG_INFO, "DPP: TESTING - stop at Authentication Confirm"); if (wpa_s->dpp_auth->configurator) { /* Prevent GAS response */ wpa_s->dpp_auth->auth_success = 0; } return; } #endif /* CONFIG_TESTING_OPTIONS */ if (wpa_s->dpp_auth->configurator) wpas_dpp_start_gas_server(wpa_s); else wpas_dpp_start_gas_client(wpa_s); } static void wpas_dpp_rx_auth_resp(struct wpa_supplicant *wpa_s, const u8 *src, const u8 *hdr, const u8 *buf, size_t len, unsigned int freq) { struct dpp_authentication *auth = wpa_s->dpp_auth; struct wpabuf *msg; wpa_printf(MSG_DEBUG, "DPP: Authentication Response from " MACSTR " (freq %u MHz)", MAC2STR(src), freq); if (!auth) { wpa_printf(MSG_DEBUG, "DPP: No DPP Authentication in progress - drop"); return; } if (!is_zero_ether_addr(auth->peer_mac_addr) && os_memcmp(src, auth->peer_mac_addr, ETH_ALEN) != 0) { wpa_printf(MSG_DEBUG, "DPP: MAC address mismatch (expected " MACSTR ") - drop", MAC2STR(auth->peer_mac_addr)); return; } eloop_cancel_timeout(wpas_dpp_reply_wait_timeout, wpa_s, NULL); if (auth->curr_freq != freq && auth->neg_freq == freq) { wpa_printf(MSG_DEBUG, "DPP: Responder accepted request for different negotiation channel"); auth->curr_freq = freq; } eloop_cancel_timeout(wpas_dpp_init_timeout, wpa_s, NULL); msg = dpp_auth_resp_rx(auth, hdr, buf, len); if (!msg) { if (auth->auth_resp_status == DPP_STATUS_RESPONSE_PENDING) { wpa_printf(MSG_DEBUG, "DPP: Start wait for full response"); offchannel_send_action_done(wpa_s); wpas_dpp_listen_start(wpa_s, auth->curr_freq); return; } wpa_printf(MSG_DEBUG, "DPP: No confirm generated"); return; } os_memcpy(auth->peer_mac_addr, src, ETH_ALEN); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d", MAC2STR(src), auth->curr_freq, DPP_PA_AUTHENTICATION_CONF); offchannel_send_action(wpa_s, auth->curr_freq, src, wpa_s->own_addr, broadcast, wpabuf_head(msg), wpabuf_len(msg), 500, wpas_dpp_tx_status, 0); wpabuf_free(msg); wpa_s->dpp_auth_ok_on_ack = 1; } static void wpas_dpp_rx_auth_conf(struct wpa_supplicant *wpa_s, const u8 *src, const u8 *hdr, const u8 *buf, size_t len) { struct dpp_authentication *auth = wpa_s->dpp_auth; wpa_printf(MSG_DEBUG, "DPP: Authentication Confirmation from " MACSTR, MAC2STR(src)); if (!auth) { wpa_printf(MSG_DEBUG, "DPP: No DPP Authentication in progress - drop"); return; } if (os_memcmp(src, auth->peer_mac_addr, ETH_ALEN) != 0) { wpa_printf(MSG_DEBUG, "DPP: MAC address mismatch (expected " MACSTR ") - drop", MAC2STR(auth->peer_mac_addr)); return; } if (dpp_auth_conf_rx(auth, hdr, buf, len) < 0) { wpa_printf(MSG_DEBUG, "DPP: Authentication failed"); return; } wpas_dpp_auth_success(wpa_s, 0); } #ifdef CONFIG_DPP2 static void wpas_dpp_config_result_wait_timeout(void *eloop_ctx, void *timeout_ctx) { struct wpa_supplicant *wpa_s = eloop_ctx; struct dpp_authentication *auth = wpa_s->dpp_auth; if (!auth || !auth->waiting_conf_result) return; wpa_printf(MSG_DEBUG, "DPP: Timeout while waiting for Configuration Result"); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_FAILED); dpp_auth_deinit(auth); wpa_s->dpp_auth = NULL; } static void wpas_dpp_rx_conf_result(struct wpa_supplicant *wpa_s, const u8 *src, const u8 *hdr, const u8 *buf, size_t len) { struct dpp_authentication *auth = wpa_s->dpp_auth; enum dpp_status_error status; wpa_printf(MSG_DEBUG, "DPP: Configuration Result from " MACSTR, MAC2STR(src)); if (!auth || !auth->waiting_conf_result) { wpa_printf(MSG_DEBUG, "DPP: No DPP Configuration waiting for result - drop"); return; } if (os_memcmp(src, auth->peer_mac_addr, ETH_ALEN) != 0) { wpa_printf(MSG_DEBUG, "DPP: MAC address mismatch (expected " MACSTR ") - drop", MAC2STR(auth->peer_mac_addr)); return; } status = dpp_conf_result_rx(auth, hdr, buf, len); offchannel_send_action_done(wpa_s); wpas_dpp_listen_stop(wpa_s); if (status == DPP_STATUS_OK) wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_SENT); else wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_FAILED); dpp_auth_deinit(auth); wpa_s->dpp_auth = NULL; eloop_cancel_timeout(wpas_dpp_config_result_wait_timeout, wpa_s, NULL); } static int wpas_dpp_process_conf_obj(void *ctx, struct dpp_authentication *auth) { struct wpa_supplicant *wpa_s = ctx; return wpas_dpp_handle_config_obj(wpa_s, auth); } #endif /* CONFIG_DPP2 */ static void wpas_dpp_rx_peer_disc_resp(struct wpa_supplicant *wpa_s, const u8 *src, const u8 *buf, size_t len) { struct wpa_ssid *ssid; const u8 *connector, *trans_id, *status; u16 connector_len, trans_id_len, status_len; struct dpp_introduction intro; struct rsn_pmksa_cache_entry *entry; struct os_time now; struct os_reltime rnow; os_time_t expiry; unsigned int seconds; enum dpp_status_error res; wpa_printf(MSG_DEBUG, "DPP: Peer Discovery Response from " MACSTR, MAC2STR(src)); if (is_zero_ether_addr(wpa_s->dpp_intro_bssid) || os_memcmp(src, wpa_s->dpp_intro_bssid, ETH_ALEN) != 0) { wpa_printf(MSG_DEBUG, "DPP: Not waiting for response from " MACSTR " - drop", MAC2STR(src)); return; } offchannel_send_action_done(wpa_s); for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) { if (ssid == wpa_s->dpp_intro_network) break; } if (!ssid || !ssid->dpp_connector || !ssid->dpp_netaccesskey || !ssid->dpp_csign) { wpa_printf(MSG_DEBUG, "DPP: Profile not found for network introduction"); return; } trans_id = dpp_get_attr(buf, len, DPP_ATTR_TRANSACTION_ID, &trans_id_len); if (!trans_id || trans_id_len != 1) { wpa_printf(MSG_DEBUG, "DPP: Peer did not include Transaction ID"); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_INTRO "peer=" MACSTR " fail=missing_transaction_id", MAC2STR(src)); goto fail; } if (trans_id[0] != TRANSACTION_ID) { wpa_printf(MSG_DEBUG, "DPP: Ignore frame with unexpected Transaction ID %u", trans_id[0]); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_INTRO "peer=" MACSTR " fail=transaction_id_mismatch", MAC2STR(src)); goto fail; } status = dpp_get_attr(buf, len, DPP_ATTR_STATUS, &status_len); if (!status || status_len != 1) { wpa_printf(MSG_DEBUG, "DPP: Peer did not include Status"); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_INTRO "peer=" MACSTR " fail=missing_status", MAC2STR(src)); goto fail; } if (status[0] != DPP_STATUS_OK) { wpa_printf(MSG_DEBUG, "DPP: Peer rejected network introduction: Status %u", status[0]); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_INTRO "peer=" MACSTR " status=%u", MAC2STR(src), status[0]); goto fail; } connector = dpp_get_attr(buf, len, DPP_ATTR_CONNECTOR, &connector_len); if (!connector) { wpa_printf(MSG_DEBUG, "DPP: Peer did not include its Connector"); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_INTRO "peer=" MACSTR " fail=missing_connector", MAC2STR(src)); goto fail; } res = dpp_peer_intro(&intro, ssid->dpp_connector, ssid->dpp_netaccesskey, ssid->dpp_netaccesskey_len, ssid->dpp_csign, ssid->dpp_csign_len, connector, connector_len, &expiry); if (res != DPP_STATUS_OK) { wpa_printf(MSG_INFO, "DPP: Network Introduction protocol resulted in failure"); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_INTRO "peer=" MACSTR " fail=peer_connector_validation_failed", MAC2STR(src)); goto fail; } entry = os_zalloc(sizeof(*entry)); if (!entry) goto fail; os_memcpy(entry->aa, src, ETH_ALEN); os_memcpy(entry->pmkid, intro.pmkid, PMKID_LEN); os_memcpy(entry->pmk, intro.pmk, intro.pmk_len); entry->pmk_len = intro.pmk_len; entry->akmp = WPA_KEY_MGMT_DPP; if (expiry) { os_get_time(&now); seconds = expiry - now.sec; } else { seconds = 86400 * 7; } os_get_reltime(&rnow); entry->expiration = rnow.sec + seconds; entry->reauth_time = rnow.sec + seconds; entry->network_ctx = ssid; wpa_sm_pmksa_cache_add_entry(wpa_s->wpa, entry); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_INTRO "peer=" MACSTR " status=%u", MAC2STR(src), status[0]); wpa_printf(MSG_DEBUG, "DPP: Try connection again after successful network introduction"); if (wpa_supplicant_fast_associate(wpa_s) != 1) { wpa_supplicant_cancel_sched_scan(wpa_s); wpa_supplicant_req_scan(wpa_s, 0, 0); } fail: os_memset(&intro, 0, sizeof(intro)); } static int wpas_dpp_allow_ir(struct wpa_supplicant *wpa_s, unsigned int freq) { int i, j; if (!wpa_s->hw.modes) return -1; for (i = 0; i < wpa_s->hw.num_modes; i++) { struct hostapd_hw_modes *mode = &wpa_s->hw.modes[i]; for (j = 0; j < mode->num_channels; j++) { struct hostapd_channel_data *chan = &mode->channels[j]; if (chan->freq != (int) freq) continue; if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR | HOSTAPD_CHAN_RADAR)) continue; return 1; } } wpa_printf(MSG_DEBUG, "DPP: Frequency %u MHz not supported or does not allow PKEX initiation in the current channel list", freq); return 0; } static int wpas_dpp_pkex_next_channel(struct wpa_supplicant *wpa_s, struct dpp_pkex *pkex) { if (pkex->freq == 2437) pkex->freq = 5745; else if (pkex->freq == 5745) pkex->freq = 5220; else if (pkex->freq == 5220) pkex->freq = 60480; else return -1; /* no more channels to try */ if (wpas_dpp_allow_ir(wpa_s, pkex->freq) == 1) { wpa_printf(MSG_DEBUG, "DPP: Try to initiate on %u MHz", pkex->freq); return 0; } /* Could not use this channel - try the next one */ return wpas_dpp_pkex_next_channel(wpa_s, pkex); } static void wpas_dpp_pkex_retry_timeout(void *eloop_ctx, void *timeout_ctx) { struct wpa_supplicant *wpa_s = eloop_ctx; struct dpp_pkex *pkex = wpa_s->dpp_pkex; if (!pkex || !pkex->exchange_req) return; if (pkex->exch_req_tries >= 5) { if (wpas_dpp_pkex_next_channel(wpa_s, pkex) < 0) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_FAIL "No response from PKEX peer"); dpp_pkex_free(pkex); wpa_s->dpp_pkex = NULL; return; } pkex->exch_req_tries = 0; } pkex->exch_req_tries++; wpa_printf(MSG_DEBUG, "DPP: Retransmit PKEX Exchange Request (try %u)", pkex->exch_req_tries); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d", MAC2STR(broadcast), pkex->freq, DPP_PA_PKEX_EXCHANGE_REQ); offchannel_send_action(wpa_s, pkex->freq, broadcast, wpa_s->own_addr, broadcast, wpabuf_head(pkex->exchange_req), wpabuf_len(pkex->exchange_req), pkex->exch_req_wait_time, wpas_dpp_tx_pkex_status, 0); } static void wpas_dpp_tx_pkex_status(struct wpa_supplicant *wpa_s, unsigned int freq, const u8 *dst, const u8 *src, const u8 *bssid, const u8 *data, size_t data_len, enum offchannel_send_action_result result) { const char *res_txt; struct dpp_pkex *pkex = wpa_s->dpp_pkex; res_txt = result == OFFCHANNEL_SEND_ACTION_SUCCESS ? "SUCCESS" : (result == OFFCHANNEL_SEND_ACTION_NO_ACK ? "no-ACK" : "FAILED"); wpa_printf(MSG_DEBUG, "DPP: TX status: freq=%u dst=" MACSTR " result=%s (PKEX)", freq, MAC2STR(dst), res_txt); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX_STATUS "dst=" MACSTR " freq=%u result=%s", MAC2STR(dst), freq, res_txt); if (!pkex) { wpa_printf(MSG_DEBUG, "DPP: Ignore TX status since there is no ongoing PKEX exchange"); return; } if (pkex->failed) { wpa_printf(MSG_DEBUG, "DPP: Terminate PKEX exchange due to an earlier error"); if (pkex->t > pkex->own_bi->pkex_t) pkex->own_bi->pkex_t = pkex->t; dpp_pkex_free(pkex); wpa_s->dpp_pkex = NULL; return; } if (pkex->exch_req_wait_time && pkex->exchange_req) { /* Wait for PKEX Exchange Response frame and retry request if * no response is seen. */ eloop_cancel_timeout(wpas_dpp_pkex_retry_timeout, wpa_s, NULL); eloop_register_timeout(pkex->exch_req_wait_time / 1000, (pkex->exch_req_wait_time % 1000) * 1000, wpas_dpp_pkex_retry_timeout, wpa_s, NULL); } } static void wpas_dpp_rx_pkex_exchange_req(struct wpa_supplicant *wpa_s, const u8 *src, const u8 *buf, size_t len, unsigned int freq) { struct wpabuf *msg; unsigned int wait_time; wpa_printf(MSG_DEBUG, "DPP: PKEX Exchange Request from " MACSTR, MAC2STR(src)); /* TODO: Support multiple PKEX codes by iterating over all the enabled * values here */ if (!wpa_s->dpp_pkex_code || !wpa_s->dpp_pkex_bi) { wpa_printf(MSG_DEBUG, "DPP: No PKEX code configured - ignore request"); return; } if (wpa_s->dpp_pkex) { /* TODO: Support parallel operations */ wpa_printf(MSG_DEBUG, "DPP: Already in PKEX session - ignore new request"); return; } wpa_s->dpp_pkex = dpp_pkex_rx_exchange_req(wpa_s, wpa_s->dpp_pkex_bi, wpa_s->own_addr, src, wpa_s->dpp_pkex_identifier, wpa_s->dpp_pkex_code, buf, len); if (!wpa_s->dpp_pkex) { wpa_printf(MSG_DEBUG, "DPP: Failed to process the request - ignore it"); return; } msg = wpa_s->dpp_pkex->exchange_resp; wait_time = wpa_s->max_remain_on_chan; if (wait_time > 2000) wait_time = 2000; wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d", MAC2STR(src), freq, DPP_PA_PKEX_EXCHANGE_RESP); offchannel_send_action(wpa_s, freq, src, wpa_s->own_addr, broadcast, wpabuf_head(msg), wpabuf_len(msg), wait_time, wpas_dpp_tx_pkex_status, 0); } static void wpas_dpp_rx_pkex_exchange_resp(struct wpa_supplicant *wpa_s, const u8 *src, const u8 *buf, size_t len, unsigned int freq) { struct wpabuf *msg; unsigned int wait_time; wpa_printf(MSG_DEBUG, "DPP: PKEX Exchange Response from " MACSTR, MAC2STR(src)); /* TODO: Support multiple PKEX codes by iterating over all the enabled * values here */ if (!wpa_s->dpp_pkex || !wpa_s->dpp_pkex->initiator || wpa_s->dpp_pkex->exchange_done) { wpa_printf(MSG_DEBUG, "DPP: No matching PKEX session"); return; } eloop_cancel_timeout(wpas_dpp_pkex_retry_timeout, wpa_s, NULL); wpa_s->dpp_pkex->exch_req_wait_time = 0; msg = dpp_pkex_rx_exchange_resp(wpa_s->dpp_pkex, src, buf, len); if (!msg) { wpa_printf(MSG_DEBUG, "DPP: Failed to process the response"); return; } wpa_printf(MSG_DEBUG, "DPP: Send PKEX Commit-Reveal Request to " MACSTR, MAC2STR(src)); wait_time = wpa_s->max_remain_on_chan; if (wait_time > 2000) wait_time = 2000; wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d", MAC2STR(src), freq, DPP_PA_PKEX_COMMIT_REVEAL_REQ); offchannel_send_action(wpa_s, freq, src, wpa_s->own_addr, broadcast, wpabuf_head(msg), wpabuf_len(msg), wait_time, wpas_dpp_tx_pkex_status, 0); wpabuf_free(msg); } static struct dpp_bootstrap_info * wpas_dpp_pkex_finish(struct wpa_supplicant *wpa_s, const u8 *peer, unsigned int freq) { struct dpp_bootstrap_info *bi; bi = dpp_pkex_finish(wpa_s->dpp, wpa_s->dpp_pkex, peer, freq); if (!bi) return NULL; wpa_s->dpp_pkex = NULL; return bi; } static void wpas_dpp_rx_pkex_commit_reveal_req(struct wpa_supplicant *wpa_s, const u8 *src, const u8 *hdr, const u8 *buf, size_t len, unsigned int freq) { struct wpabuf *msg; unsigned int wait_time; struct dpp_pkex *pkex = wpa_s->dpp_pkex; wpa_printf(MSG_DEBUG, "DPP: PKEX Commit-Reveal Request from " MACSTR, MAC2STR(src)); if (!pkex || pkex->initiator || !pkex->exchange_done) { wpa_printf(MSG_DEBUG, "DPP: No matching PKEX session"); return; } msg = dpp_pkex_rx_commit_reveal_req(pkex, hdr, buf, len); if (!msg) { wpa_printf(MSG_DEBUG, "DPP: Failed to process the request"); if (pkex->failed) { wpa_printf(MSG_DEBUG, "DPP: Terminate PKEX exchange"); if (pkex->t > pkex->own_bi->pkex_t) pkex->own_bi->pkex_t = pkex->t; dpp_pkex_free(wpa_s->dpp_pkex); wpa_s->dpp_pkex = NULL; } return; } wpa_printf(MSG_DEBUG, "DPP: Send PKEX Commit-Reveal Response to " MACSTR, MAC2STR(src)); wait_time = wpa_s->max_remain_on_chan; if (wait_time > 2000) wait_time = 2000; wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d", MAC2STR(src), freq, DPP_PA_PKEX_COMMIT_REVEAL_RESP); offchannel_send_action(wpa_s, freq, src, wpa_s->own_addr, broadcast, wpabuf_head(msg), wpabuf_len(msg), wait_time, wpas_dpp_tx_pkex_status, 0); wpabuf_free(msg); wpas_dpp_pkex_finish(wpa_s, src, freq); } static void wpas_dpp_rx_pkex_commit_reveal_resp(struct wpa_supplicant *wpa_s, const u8 *src, const u8 *hdr, const u8 *buf, size_t len, unsigned int freq) { int res; struct dpp_bootstrap_info *bi; struct dpp_pkex *pkex = wpa_s->dpp_pkex; char cmd[500]; wpa_printf(MSG_DEBUG, "DPP: PKEX Commit-Reveal Response from " MACSTR, MAC2STR(src)); if (!pkex || !pkex->initiator || !pkex->exchange_done) { wpa_printf(MSG_DEBUG, "DPP: No matching PKEX session"); return; } res = dpp_pkex_rx_commit_reveal_resp(pkex, hdr, buf, len); if (res < 0) { wpa_printf(MSG_DEBUG, "DPP: Failed to process the response"); return; } bi = wpas_dpp_pkex_finish(wpa_s, src, freq); if (!bi) return; os_snprintf(cmd, sizeof(cmd), " peer=%u %s", bi->id, wpa_s->dpp_pkex_auth_cmd ? wpa_s->dpp_pkex_auth_cmd : ""); wpa_printf(MSG_DEBUG, "DPP: Start authentication after PKEX with parameters: %s", cmd); if (wpas_dpp_auth_init(wpa_s, cmd) < 0) { wpa_printf(MSG_DEBUG, "DPP: Authentication initialization failed"); return; } } void wpas_dpp_rx_action(struct wpa_supplicant *wpa_s, const u8 *src, const u8 *buf, size_t len, unsigned int freq) { u8 crypto_suite; enum dpp_public_action_frame_type type; const u8 *hdr; unsigned int pkex_t; if (len < DPP_HDR_LEN) return; if (WPA_GET_BE24(buf) != OUI_WFA || buf[3] != DPP_OUI_TYPE) return; hdr = buf; buf += 4; len -= 4; crypto_suite = *buf++; type = *buf++; len -= 2; wpa_printf(MSG_DEBUG, "DPP: Received DPP Public Action frame crypto suite %u type %d from " MACSTR " freq=%u", crypto_suite, type, MAC2STR(src), freq); if (crypto_suite != 1) { wpa_printf(MSG_DEBUG, "DPP: Unsupported crypto suite %u", crypto_suite); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_RX "src=" MACSTR " freq=%u type=%d ignore=unsupported-crypto-suite", MAC2STR(src), freq, type); return; } wpa_hexdump(MSG_MSGDUMP, "DPP: Received message attributes", buf, len); if (dpp_check_attrs(buf, len) < 0) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_RX "src=" MACSTR " freq=%u type=%d ignore=invalid-attributes", MAC2STR(src), freq, type); return; } wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_RX "src=" MACSTR " freq=%u type=%d", MAC2STR(src), freq, type); switch (type) { case DPP_PA_AUTHENTICATION_REQ: wpas_dpp_rx_auth_req(wpa_s, src, hdr, buf, len, freq); break; case DPP_PA_AUTHENTICATION_RESP: wpas_dpp_rx_auth_resp(wpa_s, src, hdr, buf, len, freq); break; case DPP_PA_AUTHENTICATION_CONF: wpas_dpp_rx_auth_conf(wpa_s, src, hdr, buf, len); break; case DPP_PA_PEER_DISCOVERY_RESP: wpas_dpp_rx_peer_disc_resp(wpa_s, src, buf, len); break; case DPP_PA_PKEX_EXCHANGE_REQ: wpas_dpp_rx_pkex_exchange_req(wpa_s, src, buf, len, freq); break; case DPP_PA_PKEX_EXCHANGE_RESP: wpas_dpp_rx_pkex_exchange_resp(wpa_s, src, buf, len, freq); break; case DPP_PA_PKEX_COMMIT_REVEAL_REQ: wpas_dpp_rx_pkex_commit_reveal_req(wpa_s, src, hdr, buf, len, freq); break; case DPP_PA_PKEX_COMMIT_REVEAL_RESP: wpas_dpp_rx_pkex_commit_reveal_resp(wpa_s, src, hdr, buf, len, freq); break; #ifdef CONFIG_DPP2 case DPP_PA_CONFIGURATION_RESULT: wpas_dpp_rx_conf_result(wpa_s, src, hdr, buf, len); break; #endif /* CONFIG_DPP2 */ default: wpa_printf(MSG_DEBUG, "DPP: Ignored unsupported frame subtype %d", type); break; } if (wpa_s->dpp_pkex) pkex_t = wpa_s->dpp_pkex->t; else if (wpa_s->dpp_pkex_bi) pkex_t = wpa_s->dpp_pkex_bi->pkex_t; else pkex_t = 0; if (pkex_t >= PKEX_COUNTER_T_LIMIT) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_PKEX_T_LIMIT "id=0"); wpas_dpp_pkex_remove(wpa_s, "*"); } } static struct wpabuf * wpas_dpp_gas_req_handler(void *ctx, const u8 *sa, const u8 *query, size_t query_len) { struct wpa_supplicant *wpa_s = ctx; struct dpp_authentication *auth = wpa_s->dpp_auth; struct wpabuf *resp; wpa_printf(MSG_DEBUG, "DPP: GAS request from " MACSTR, MAC2STR(sa)); if (!auth || !auth->auth_success || os_memcmp(sa, auth->peer_mac_addr, ETH_ALEN) != 0) { wpa_printf(MSG_DEBUG, "DPP: No matching exchange in progress"); return NULL; } wpa_hexdump(MSG_DEBUG, "DPP: Received Configuration Request (GAS Query Request)", query, query_len); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_REQ_RX "src=" MACSTR, MAC2STR(sa)); resp = dpp_conf_req_rx(auth, query, query_len); if (!resp) wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_FAILED); auth->conf_resp = resp; return resp; } static void wpas_dpp_gas_status_handler(void *ctx, struct wpabuf *resp, int ok) { struct wpa_supplicant *wpa_s = ctx; struct dpp_authentication *auth = wpa_s->dpp_auth; if (!auth) { wpabuf_free(resp); return; } if (auth->conf_resp != resp) { wpa_printf(MSG_DEBUG, "DPP: Ignore GAS status report (ok=%d) for unknown response", ok); wpabuf_free(resp); return; } wpa_printf(MSG_DEBUG, "DPP: Configuration exchange completed (ok=%d)", ok); eloop_cancel_timeout(wpas_dpp_reply_wait_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_dpp_auth_resp_retry_timeout, wpa_s, NULL); #ifdef CONFIG_DPP2 if (ok && auth->peer_version >= 2 && auth->conf_resp_status == DPP_STATUS_OK) { wpa_printf(MSG_DEBUG, "DPP: Wait for Configuration Result"); auth->waiting_conf_result = 1; auth->conf_resp = NULL; wpabuf_free(resp); eloop_cancel_timeout(wpas_dpp_config_result_wait_timeout, wpa_s, NULL); eloop_register_timeout(2, 0, wpas_dpp_config_result_wait_timeout, wpa_s, NULL); return; } #endif /* CONFIG_DPP2 */ offchannel_send_action_done(wpa_s); wpas_dpp_listen_stop(wpa_s); if (ok) wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_SENT); else wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_CONF_FAILED); dpp_auth_deinit(wpa_s->dpp_auth); wpa_s->dpp_auth = NULL; wpabuf_free(resp); } int wpas_dpp_configurator_sign(struct wpa_supplicant *wpa_s, const char *cmd) { struct dpp_authentication *auth; int ret = -1; char *curve = NULL; auth = os_zalloc(sizeof(*auth)); if (!auth) return -1; curve = get_param(cmd, " curve="); wpas_dpp_set_testing_options(wpa_s, auth); if (dpp_set_configurator(wpa_s->dpp, wpa_s, auth, cmd) == 0 && dpp_configurator_own_config(auth, curve, 0) == 0) ret = wpas_dpp_handle_config_obj(wpa_s, auth); dpp_auth_deinit(auth); os_free(curve); return ret; } static void wpas_dpp_tx_introduction_status(struct wpa_supplicant *wpa_s, unsigned int freq, const u8 *dst, const u8 *src, const u8 *bssid, const u8 *data, size_t data_len, enum offchannel_send_action_result result) { const char *res_txt; res_txt = result == OFFCHANNEL_SEND_ACTION_SUCCESS ? "SUCCESS" : (result == OFFCHANNEL_SEND_ACTION_NO_ACK ? "no-ACK" : "FAILED"); wpa_printf(MSG_DEBUG, "DPP: TX status: freq=%u dst=" MACSTR " result=%s (DPP Peer Discovery Request)", freq, MAC2STR(dst), res_txt); wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX_STATUS "dst=" MACSTR " freq=%u result=%s", MAC2STR(dst), freq, res_txt); /* TODO: Time out wait for response more quickly in error cases? */ } int wpas_dpp_check_connect(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, struct wpa_bss *bss) { struct os_time now; struct wpabuf *msg; unsigned int wait_time; const u8 *rsn; struct wpa_ie_data ied; if (!(ssid->key_mgmt & WPA_KEY_MGMT_DPP) || !bss) return 0; /* Not using DPP AKM - continue */ rsn = wpa_bss_get_ie(bss, WLAN_EID_RSN); if (rsn && wpa_parse_wpa_ie(rsn, 2 + rsn[1], &ied) == 0 && !(ied.key_mgmt & WPA_KEY_MGMT_DPP)) return 0; /* AP does not support DPP AKM - continue */ if (wpa_sm_pmksa_exists(wpa_s->wpa, bss->bssid, ssid)) return 0; /* PMKSA exists for DPP AKM - continue */ if (!ssid->dpp_connector || !ssid->dpp_netaccesskey || !ssid->dpp_csign) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_MISSING_CONNECTOR "missing %s", !ssid->dpp_connector ? "Connector" : (!ssid->dpp_netaccesskey ? "netAccessKey" : "C-sign-key")); return -1; } os_get_time(&now); if (ssid->dpp_netaccesskey_expiry && (os_time_t) ssid->dpp_netaccesskey_expiry < now.sec) { wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_MISSING_CONNECTOR "netAccessKey expired"); return -1; } wpa_printf(MSG_DEBUG, "DPP: Starting network introduction protocol to derive PMKSA for " MACSTR, MAC2STR(bss->bssid)); msg = dpp_alloc_msg(DPP_PA_PEER_DISCOVERY_REQ, 5 + 4 + os_strlen(ssid->dpp_connector)); if (!msg) return -1; #ifdef CONFIG_TESTING_OPTIONS if (dpp_test == DPP_TEST_NO_TRANSACTION_ID_PEER_DISC_REQ) { wpa_printf(MSG_INFO, "DPP: TESTING - no Transaction ID"); goto skip_trans_id; } if (dpp_test == DPP_TEST_INVALID_TRANSACTION_ID_PEER_DISC_REQ) { wpa_printf(MSG_INFO, "DPP: TESTING - invalid Transaction ID"); wpabuf_put_le16(msg, DPP_ATTR_TRANSACTION_ID); wpabuf_put_le16(msg, 0); goto skip_trans_id; } #endif /* CONFIG_TESTING_OPTIONS */ /* Transaction ID */ wpabuf_put_le16(msg, DPP_ATTR_TRANSACTION_ID); wpabuf_put_le16(msg, 1); wpabuf_put_u8(msg, TRANSACTION_ID); #ifdef CONFIG_TESTING_OPTIONS skip_trans_id: if (dpp_test == DPP_TEST_NO_CONNECTOR_PEER_DISC_REQ) { wpa_printf(MSG_INFO, "DPP: TESTING - no Connector"); goto skip_connector; } if (dpp_test == DPP_TEST_INVALID_CONNECTOR_PEER_DISC_REQ) { char *connector; wpa_printf(MSG_INFO, "DPP: TESTING - invalid Connector"); connector = dpp_corrupt_connector_signature( ssid->dpp_connector); if (!connector) { wpabuf_free(msg); return -1; } wpabuf_put_le16(msg, DPP_ATTR_CONNECTOR); wpabuf_put_le16(msg, os_strlen(connector)); wpabuf_put_str(msg, connector); os_free(connector); goto skip_connector; } #endif /* CONFIG_TESTING_OPTIONS */ /* DPP Connector */ wpabuf_put_le16(msg, DPP_ATTR_CONNECTOR); wpabuf_put_le16(msg, os_strlen(ssid->dpp_connector)); wpabuf_put_str(msg, ssid->dpp_connector); #ifdef CONFIG_TESTING_OPTIONS skip_connector: #endif /* CONFIG_TESTING_OPTIONS */ /* TODO: Timeout on AP response */ wait_time = wpa_s->max_remain_on_chan; if (wait_time > 2000) wait_time = 2000; wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d", MAC2STR(bss->bssid), bss->freq, DPP_PA_PEER_DISCOVERY_REQ); offchannel_send_action(wpa_s, bss->freq, bss->bssid, wpa_s->own_addr, broadcast, wpabuf_head(msg), wpabuf_len(msg), wait_time, wpas_dpp_tx_introduction_status, 0); wpabuf_free(msg); /* Request this connection attempt to terminate - new one will be * started when network introduction protocol completes */ os_memcpy(wpa_s->dpp_intro_bssid, bss->bssid, ETH_ALEN); wpa_s->dpp_intro_network = ssid; return 1; } int wpas_dpp_pkex_add(struct wpa_supplicant *wpa_s, const char *cmd) { struct dpp_bootstrap_info *own_bi; const char *pos, *end; unsigned int wait_time; pos = os_strstr(cmd, " own="); if (!pos) return -1; pos += 5; own_bi = dpp_bootstrap_get_id(wpa_s->dpp, atoi(pos)); if (!own_bi) { wpa_printf(MSG_DEBUG, "DPP: Identified bootstrap info not found"); return -1; } if (own_bi->type != DPP_BOOTSTRAP_PKEX) { wpa_printf(MSG_DEBUG, "DPP: Identified bootstrap info not for PKEX"); return -1; } wpa_s->dpp_pkex_bi = own_bi; own_bi->pkex_t = 0; /* clear pending errors on new code */ os_free(wpa_s->dpp_pkex_identifier); wpa_s->dpp_pkex_identifier = NULL; pos = os_strstr(cmd, " identifier="); if (pos) { pos += 12; end = os_strchr(pos, ' '); if (!end) return -1; wpa_s->dpp_pkex_identifier = os_malloc(end - pos + 1); if (!wpa_s->dpp_pkex_identifier) return -1; os_memcpy(wpa_s->dpp_pkex_identifier, pos, end - pos); wpa_s->dpp_pkex_identifier[end - pos] = '\0'; } pos = os_strstr(cmd, " code="); if (!pos) return -1; os_free(wpa_s->dpp_pkex_code); wpa_s->dpp_pkex_code = os_strdup(pos + 6); if (!wpa_s->dpp_pkex_code) return -1; if (os_strstr(cmd, " init=1")) { struct dpp_pkex *pkex; struct wpabuf *msg; wpa_printf(MSG_DEBUG, "DPP: Initiating PKEX"); dpp_pkex_free(wpa_s->dpp_pkex); wpa_s->dpp_pkex = dpp_pkex_init(wpa_s, own_bi, wpa_s->own_addr, wpa_s->dpp_pkex_identifier, wpa_s->dpp_pkex_code); pkex = wpa_s->dpp_pkex; if (!pkex) return -1; msg = pkex->exchange_req; wait_time = wpa_s->max_remain_on_chan; if (wait_time > 2000) wait_time = 2000; pkex->freq = 2437; wpa_msg(wpa_s, MSG_INFO, DPP_EVENT_TX "dst=" MACSTR " freq=%u type=%d", MAC2STR(broadcast), pkex->freq, DPP_PA_PKEX_EXCHANGE_REQ); offchannel_send_action(wpa_s, pkex->freq, broadcast, wpa_s->own_addr, broadcast, wpabuf_head(msg), wpabuf_len(msg), wait_time, wpas_dpp_tx_pkex_status, 0); if (wait_time == 0) wait_time = 2000; pkex->exch_req_wait_time = wait_time; pkex->exch_req_tries = 1; } /* TODO: Support multiple PKEX info entries */ os_free(wpa_s->dpp_pkex_auth_cmd); wpa_s->dpp_pkex_auth_cmd = os_strdup(cmd); return 1; } int wpas_dpp_pkex_remove(struct wpa_supplicant *wpa_s, const char *id) { unsigned int id_val; if (os_strcmp(id, "*") == 0) { id_val = 0; } else { id_val = atoi(id); if (id_val == 0) return -1; } if ((id_val != 0 && id_val != 1) || !wpa_s->dpp_pkex_code) return -1; /* TODO: Support multiple PKEX entries */ os_free(wpa_s->dpp_pkex_code); wpa_s->dpp_pkex_code = NULL; os_free(wpa_s->dpp_pkex_identifier); wpa_s->dpp_pkex_identifier = NULL; os_free(wpa_s->dpp_pkex_auth_cmd); wpa_s->dpp_pkex_auth_cmd = NULL; wpa_s->dpp_pkex_bi = NULL; /* TODO: Remove dpp_pkex only if it is for the identified PKEX code */ dpp_pkex_free(wpa_s->dpp_pkex); wpa_s->dpp_pkex = NULL; return 0; } void wpas_dpp_stop(struct wpa_supplicant *wpa_s) { dpp_auth_deinit(wpa_s->dpp_auth); wpa_s->dpp_auth = NULL; dpp_pkex_free(wpa_s->dpp_pkex); wpa_s->dpp_pkex = NULL; if (wpa_s->dpp_gas_client && wpa_s->dpp_gas_dialog_token >= 0) gas_query_stop(wpa_s->gas, wpa_s->dpp_gas_dialog_token); } int wpas_dpp_init(struct wpa_supplicant *wpa_s) { struct dpp_global_config config; u8 adv_proto_id[7]; adv_proto_id[0] = WLAN_EID_VENDOR_SPECIFIC; adv_proto_id[1] = 5; WPA_PUT_BE24(&adv_proto_id[2], OUI_WFA); adv_proto_id[5] = DPP_OUI_TYPE; adv_proto_id[6] = 0x01; if (gas_server_register(wpa_s->gas_server, adv_proto_id, sizeof(adv_proto_id), wpas_dpp_gas_req_handler, wpas_dpp_gas_status_handler, wpa_s) < 0) return -1; os_memset(&config, 0, sizeof(config)); config.msg_ctx = wpa_s; config.cb_ctx = wpa_s; #ifdef CONFIG_DPP2 config.process_conf_obj = wpas_dpp_process_conf_obj; #endif /* CONFIG_DPP2 */ wpa_s->dpp = dpp_global_init(&config); return wpa_s->dpp ? 0 : -1; } void wpas_dpp_deinit(struct wpa_supplicant *wpa_s) { #ifdef CONFIG_TESTING_OPTIONS os_free(wpa_s->dpp_config_obj_override); wpa_s->dpp_config_obj_override = NULL; os_free(wpa_s->dpp_discovery_override); wpa_s->dpp_discovery_override = NULL; os_free(wpa_s->dpp_groups_override); wpa_s->dpp_groups_override = NULL; wpa_s->dpp_ignore_netaccesskey_mismatch = 0; #endif /* CONFIG_TESTING_OPTIONS */ if (!wpa_s->dpp) return; dpp_global_clear(wpa_s->dpp); eloop_cancel_timeout(wpas_dpp_pkex_retry_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_dpp_reply_wait_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_dpp_init_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_dpp_auth_resp_retry_timeout, wpa_s, NULL); #ifdef CONFIG_DPP2 eloop_cancel_timeout(wpas_dpp_config_result_wait_timeout, wpa_s, NULL); dpp_pfs_free(wpa_s->dpp_pfs); wpa_s->dpp_pfs = NULL; #endif /* CONFIG_DPP2 */ offchannel_send_action_done(wpa_s); wpas_dpp_listen_stop(wpa_s); wpas_dpp_stop(wpa_s); wpas_dpp_pkex_remove(wpa_s, "*"); os_memset(wpa_s->dpp_intro_bssid, 0, ETH_ALEN); os_free(wpa_s->dpp_configurator_params); wpa_s->dpp_configurator_params = NULL; } #ifdef CONFIG_DPP2 int wpas_dpp_controller_start(struct wpa_supplicant *wpa_s, const char *cmd) { struct dpp_controller_config config; const char *pos; os_memset(&config, 0, sizeof(config)); if (cmd) { pos = os_strstr(cmd, " tcp_port="); if (pos) { pos += 10; config.tcp_port = atoi(pos); } } config.configurator_params = wpa_s->dpp_configurator_params; return dpp_controller_start(wpa_s->dpp, &config); } #endif /* CONFIG_DPP2 */
{ "pile_set_name": "Github" }
// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 7A1869691597900300526B20 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A1869681597900300526B20 /* UIKit.framework */; }; 7A18696B1597900300526B20 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A18696A1597900300526B20 /* Foundation.framework */; }; 7A18696D1597900300526B20 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A18696C1597900300526B20 /* CoreGraphics.framework */; }; 7A1869731597900300526B20 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7A1869711597900300526B20 /* InfoPlist.strings */; }; 7A1869751597900300526B20 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A1869741597900300526B20 /* main.m */; }; 7A1869791597900300526B20 /* MJAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A1869781597900300526B20 /* MJAppDelegate.m */; }; 7A18697C1597900300526B20 /* MJViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A18697B1597900300526B20 /* MJViewController.m */; }; 7A18697F1597900300526B20 /* MJViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7A18697D1597900300526B20 /* MJViewController.xib */; }; 7A469E131597903B00BA5F2E /* MJPopupBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A469E101597903B00BA5F2E /* MJPopupBackgroundView.m */; }; 7A469E141597903B00BA5F2E /* UIViewController+MJPopupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A469E121597903B00BA5F2E /* UIViewController+MJPopupViewController.m */; }; 7A469E19159790A000BA5F2E /* MJDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A469E17159790A000BA5F2E /* MJDetailViewController.m */; }; 7A469E1A159790A000BA5F2E /* MJDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7A469E18159790A000BA5F2E /* MJDetailViewController.xib */; }; 7A469E1C1597914000BA5F2E /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A469E1B1597914000BA5F2E /* QuartzCore.framework */; }; 7A469E21159793BE00BA5F2E /* MJSecondDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A469E1F159793BE00BA5F2E /* MJSecondDetailViewController.m */; }; 7A469E22159793BE00BA5F2E /* MJSecondDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7A469E20159793BE00BA5F2E /* MJSecondDetailViewController.xib */; }; 7ACBD91A16BC60C4005F5EAB /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7ACBD91916BC60C4005F5EAB /* Default-568h@2x.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 7A1869641597900300526B20 /* MJPopupViewControllerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MJPopupViewControllerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7A1869681597900300526B20 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 7A18696A1597900300526B20 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 7A18696C1597900300526B20 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 7A1869701597900300526B20 /* MJPopupViewControllerDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "MJPopupViewControllerDemo-Info.plist"; sourceTree = "<group>"; }; 7A1869721597900300526B20 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 7A1869741597900300526B20 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; 7A1869761597900300526B20 /* MJPopupViewControllerDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MJPopupViewControllerDemo-Prefix.pch"; sourceTree = "<group>"; }; 7A1869771597900300526B20 /* MJAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MJAppDelegate.h; sourceTree = "<group>"; }; 7A1869781597900300526B20 /* MJAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MJAppDelegate.m; sourceTree = "<group>"; }; 7A18697A1597900300526B20 /* MJViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MJViewController.h; sourceTree = "<group>"; }; 7A18697B1597900300526B20 /* MJViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MJViewController.m; sourceTree = "<group>"; }; 7A18697E1597900300526B20 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MJViewController.xib; sourceTree = "<group>"; }; 7A469E0F1597903B00BA5F2E /* MJPopupBackgroundView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJPopupBackgroundView.h; sourceTree = "<group>"; }; 7A469E101597903B00BA5F2E /* MJPopupBackgroundView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJPopupBackgroundView.m; sourceTree = "<group>"; }; 7A469E111597903B00BA5F2E /* UIViewController+MJPopupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+MJPopupViewController.h"; sourceTree = "<group>"; }; 7A469E121597903B00BA5F2E /* UIViewController+MJPopupViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+MJPopupViewController.m"; sourceTree = "<group>"; }; 7A469E16159790A000BA5F2E /* MJDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJDetailViewController.h; sourceTree = "<group>"; }; 7A469E17159790A000BA5F2E /* MJDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJDetailViewController.m; sourceTree = "<group>"; }; 7A469E18159790A000BA5F2E /* MJDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MJDetailViewController.xib; sourceTree = "<group>"; }; 7A469E1B1597914000BA5F2E /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 7A469E1E159793BE00BA5F2E /* MJSecondDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MJSecondDetailViewController.h; sourceTree = "<group>"; }; 7A469E1F159793BE00BA5F2E /* MJSecondDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJSecondDetailViewController.m; sourceTree = "<group>"; }; 7A469E20159793BE00BA5F2E /* MJSecondDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MJSecondDetailViewController.xib; sourceTree = "<group>"; }; 7ACBD91916BC60C4005F5EAB /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 7A1869611597900300526B20 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 7A469E1C1597914000BA5F2E /* QuartzCore.framework in Frameworks */, 7A1869691597900300526B20 /* UIKit.framework in Frameworks */, 7A18696B1597900300526B20 /* Foundation.framework in Frameworks */, 7A18696D1597900300526B20 /* CoreGraphics.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 7A1869591597900300526B20 = { isa = PBXGroup; children = ( 7A18696E1597900300526B20 /* MJPopupViewControllerDemo */, 7A1869671597900300526B20 /* Frameworks */, 7A1869651597900300526B20 /* Products */, ); sourceTree = "<group>"; }; 7A1869651597900300526B20 /* Products */ = { isa = PBXGroup; children = ( 7A1869641597900300526B20 /* MJPopupViewControllerDemo.app */, ); name = Products; sourceTree = "<group>"; }; 7A1869671597900300526B20 /* Frameworks */ = { isa = PBXGroup; children = ( 7A469E1B1597914000BA5F2E /* QuartzCore.framework */, 7A1869681597900300526B20 /* UIKit.framework */, 7A18696A1597900300526B20 /* Foundation.framework */, 7A18696C1597900300526B20 /* CoreGraphics.framework */, ); name = Frameworks; sourceTree = "<group>"; }; 7A18696E1597900300526B20 /* MJPopupViewControllerDemo */ = { isa = PBXGroup; children = ( 7A469E0E1597903B00BA5F2E /* Source */, 7A469E1D159793B100BA5F2E /* RootViewController */, 7A469E23159793D500BA5F2E /* DetailViewController */, 7A469E24159793E500BA5F2E /* SecondDetailViewController */, 7A1869771597900300526B20 /* MJAppDelegate.h */, 7A1869781597900300526B20 /* MJAppDelegate.m */, 7A18696F1597900300526B20 /* Supporting Files */, ); path = MJPopupViewControllerDemo; sourceTree = "<group>"; }; 7A18696F1597900300526B20 /* Supporting Files */ = { isa = PBXGroup; children = ( 7ACBD91916BC60C4005F5EAB /* Default-568h@2x.png */, 7A1869701597900300526B20 /* MJPopupViewControllerDemo-Info.plist */, 7A1869711597900300526B20 /* InfoPlist.strings */, 7A1869741597900300526B20 /* main.m */, 7A1869761597900300526B20 /* MJPopupViewControllerDemo-Prefix.pch */, ); name = "Supporting Files"; sourceTree = "<group>"; }; 7A469E0E1597903B00BA5F2E /* Source */ = { isa = PBXGroup; children = ( 7A469E0F1597903B00BA5F2E /* MJPopupBackgroundView.h */, 7A469E101597903B00BA5F2E /* MJPopupBackgroundView.m */, 7A469E111597903B00BA5F2E /* UIViewController+MJPopupViewController.h */, 7A469E121597903B00BA5F2E /* UIViewController+MJPopupViewController.m */, ); name = Source; path = ../../Source; sourceTree = "<group>"; }; 7A469E1D159793B100BA5F2E /* RootViewController */ = { isa = PBXGroup; children = ( 7A18697A1597900300526B20 /* MJViewController.h */, 7A18697B1597900300526B20 /* MJViewController.m */, 7A18697D1597900300526B20 /* MJViewController.xib */, ); name = RootViewController; sourceTree = "<group>"; }; 7A469E23159793D500BA5F2E /* DetailViewController */ = { isa = PBXGroup; children = ( 7A469E16159790A000BA5F2E /* MJDetailViewController.h */, 7A469E17159790A000BA5F2E /* MJDetailViewController.m */, 7A469E18159790A000BA5F2E /* MJDetailViewController.xib */, ); name = DetailViewController; sourceTree = "<group>"; }; 7A469E24159793E500BA5F2E /* SecondDetailViewController */ = { isa = PBXGroup; children = ( 7A469E1E159793BE00BA5F2E /* MJSecondDetailViewController.h */, 7A469E1F159793BE00BA5F2E /* MJSecondDetailViewController.m */, 7A469E20159793BE00BA5F2E /* MJSecondDetailViewController.xib */, ); name = SecondDetailViewController; sourceTree = "<group>"; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 7A1869631597900300526B20 /* MJPopupViewControllerDemo */ = { isa = PBXNativeTarget; buildConfigurationList = 7A1869821597900300526B20 /* Build configuration list for PBXNativeTarget "MJPopupViewControllerDemo" */; buildPhases = ( 7A1869601597900300526B20 /* Sources */, 7A1869611597900300526B20 /* Frameworks */, 7A1869621597900300526B20 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = MJPopupViewControllerDemo; productName = MJPopupViewControllerDemo; productReference = 7A1869641597900300526B20 /* MJPopupViewControllerDemo.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 7A18695B1597900300526B20 /* Project object */ = { isa = PBXProject; attributes = { CLASSPREFIX = MJ; LastUpgradeCheck = 0430; }; buildConfigurationList = 7A18695E1597900300526B20 /* Build configuration list for PBXProject "MJPopupViewControllerDemo" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 7A1869591597900300526B20; productRefGroup = 7A1869651597900300526B20 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 7A1869631597900300526B20 /* MJPopupViewControllerDemo */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 7A1869621597900300526B20 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 7A1869731597900300526B20 /* InfoPlist.strings in Resources */, 7A18697F1597900300526B20 /* MJViewController.xib in Resources */, 7A469E1A159790A000BA5F2E /* MJDetailViewController.xib in Resources */, 7A469E22159793BE00BA5F2E /* MJSecondDetailViewController.xib in Resources */, 7ACBD91A16BC60C4005F5EAB /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 7A1869601597900300526B20 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 7A1869751597900300526B20 /* main.m in Sources */, 7A1869791597900300526B20 /* MJAppDelegate.m in Sources */, 7A18697C1597900300526B20 /* MJViewController.m in Sources */, 7A469E131597903B00BA5F2E /* MJPopupBackgroundView.m in Sources */, 7A469E141597903B00BA5F2E /* UIViewController+MJPopupViewController.m in Sources */, 7A469E19159790A000BA5F2E /* MJDetailViewController.m in Sources */, 7A469E21159793BE00BA5F2E /* MJSecondDetailViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 7A1869711597900300526B20 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( 7A1869721597900300526B20 /* en */, ); name = InfoPlist.strings; sourceTree = "<group>"; }; 7A18697D1597900300526B20 /* MJViewController.xib */ = { isa = PBXVariantGroup; children = ( 7A18697E1597900300526B20 /* en */, ); name = MJViewController.xib; sourceTree = "<group>"; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 7A1869801597900300526B20 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_32_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.0; SDKROOT = iphoneos; }; name = Debug; }; 7A1869811597900300526B20 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_32_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; 7A1869831597900300526B20 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = ( "$(ARCHS_STANDARD_32_BIT)", armv6, ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MJPopupViewControllerDemo/MJPopupViewControllerDemo-Prefix.pch"; INFOPLIST_FILE = "MJPopupViewControllerDemo/MJPopupViewControllerDemo-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 4.0; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Debug; }; 7A1869841597900300526B20 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = ( "$(ARCHS_STANDARD_32_BIT)", armv6, ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MJPopupViewControllerDemo/MJPopupViewControllerDemo-Prefix.pch"; INFOPLIST_FILE = "MJPopupViewControllerDemo/MJPopupViewControllerDemo-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 4.0; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 7A18695E1597900300526B20 /* Build configuration list for PBXProject "MJPopupViewControllerDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 7A1869801597900300526B20 /* Debug */, 7A1869811597900300526B20 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 7A1869821597900300526B20 /* Build configuration list for PBXNativeTarget "MJPopupViewControllerDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 7A1869831597900300526B20 /* Debug */, 7A1869841597900300526B20 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 7A18695B1597900300526B20 /* Project object */; }
{ "pile_set_name": "Github" }
php ======== ## frameworks [21 Best PHP Frameworks 2014](http://webdesignmoo.com/2014/21-best-php-frameworks-2014/) [Top 10 PHP frameworks for 2014](http://www.catswhocode.com/blog/top-10-php-frameworks-for-2014) ## articles [多线程下的fork及写时复制导致的性能问题](http://blogread.cn/it/article/7192?f=wb) ## lib http://flysystem.thephpleague.com/ Flysystem is a filesystem abstraction which allows you to easily swap out a local filesystem for a remote one. ### uuid https://github.com/ivanakimov/hashids.php ### log
{ "pile_set_name": "Github" }
(function(exports) { // shim layer with setTimeout fallback window.requestAnimFrame = (function(){ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(/* function */ callback, /* DOMElement */ element){ window.setTimeout(callback, 1000 / 60); }; })(); /** * Canvas-based renderer */ var CanvasRenderer = function(game) { this.game = game; this.canvas = document.getElementById('canvas'); this.context = this.canvas.getContext('2d'); }; CanvasRenderer.prototype.render = function() { this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); var objects = this.game.state.objects; // Render the game state for (var i in objects) { var o = objects[i]; if (o.dead) { // TODO: render animation. if (o.type == 'player') { console.log('player', o.id, 'died'); } } if (o.r > 0) { this.renderObject_(o); } } var ctx = this; requestAnimFrame(function() { ctx.render.call(ctx); }); }; CanvasRenderer.prototype.renderObject_ = function(obj) { var ctx = this.context; ctx.fillStyle = (obj.type == "player" ? 'green' : 'red'); ctx.beginPath(); ctx.arc(obj.x, obj.y, obj.r, 0, 2 * Math.PI, true); ctx.closePath(); ctx.fill(); if (obj.type == 'player') { ctx.font = "8pt monospace"; ctx.fillStyle = 'black'; ctx.textAlign = 'center'; ctx.fillText(obj.id, obj.x, obj.y); } }; exports.Renderer = CanvasRenderer; })(window);
{ "pile_set_name": "Github" }
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ The workbench module provides classes for interfacing with `connectome workbench <https://www.humanconnectome.org/software/connectome-workbench>`_ tools. Connectome Workbench is an open source, freely available visualization and discovery tool used to map neuroimaging data, especially data generated by the Human Connectome Project. """ import os import re from ... import logging from ...utils.filemanip import split_filename from ..base import CommandLine, PackageInfo iflogger = logging.getLogger("nipype.interface") class Info(PackageInfo): """Handle Connectome Workbench version information.""" version_cmd = "wb_command -version" @staticmethod def parse_version(raw_info): m = re.search(r"\nVersion (\S+)", raw_info) return m.groups()[0] if m else None class WBCommand(CommandLine): """Base support for workbench commands.""" @property def version(self): return Info.version() def _gen_filename(self, name, outdir=None, suffix="", ext=None): """Generate a filename based on the given parameters. The filename will take the form: <basename><suffix><ext>. Parameters ---------- name : str Filename to base the new filename on. suffix : str Suffix to add to the `basename`. (defaults is '' ) ext : str Extension to use for the new filename. Returns ------- fname : str New filename based on given parameters. """ if not name: raise ValueError("Cannot generate filename - filename not set") _, fname, fext = split_filename(name) if ext is None: ext = fext if outdir is None: outdir = "." return os.path.join(outdir, fname + suffix + ext)
{ "pile_set_name": "Github" }
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alibaba.jstorm.transactional.spout; import com.alibaba.jstorm.transactional.state.ITransactionStateOperator; import backtype.storm.topology.IRichSpout; public interface ITransactionSpoutExecutor extends IRichSpout, ITransactionStateOperator { }
{ "pile_set_name": "Github" }
/*- * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" __FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c 189381 2009-03-05 00:31:48Z kientzle $"); static unsigned char archive[] = { 31,157,144,'0','n',4,132,'!',3,6,140,26,'8','n',228,16,19,195,160,'A',26, '1',202,144,'q','h','p','F',25,28,20,'a','X',196,152,145,' ',141,25,2,'k', 192,160,'A',163,163,201,135,29,'c',136,'<',201,'2','c','A',147,'.',0,12,20, 248,178,165,205,155,20,27,226,220,201,243,166,152,147,'T',164,4,'I',194,164, 136,148,16,'H',1,'(',']',202,180,169,211,167,'P',163,'J',157,'J',181,170, 213,171,'X',179,'j',221,202,181,171,215,175,'L',1}; DEFINE_TEST(test_read_format_cpio_svr4c_Z) { struct archive_entry *ae; struct archive *a; /* printf("Archive address: start=%X, end=%X\n", archive, archive+sizeof(archive)); */ assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); failure("archive_filter_name(a, 0)=\"%s\"", archive_filter_name(a, 0)); assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_COMPRESS); failure("archive_format_name(a)=\"%s\"", archive_format_name(a)); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_CRC); assertEqualInt(archive_entry_is_encrypted(ae), 0); assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); }
{ "pile_set_name": "Github" }
Universidad Nacional Experimental Politécnica Antonio José de Sucre
{ "pile_set_name": "Github" }
<!doctype html> <!--[if IE 7 ]> <html lang="en-gb" class="isie ie7 oldie no-js"> <![endif]--> <!--[if IE 8 ]> <html lang="en-gb" class="isie ie8 oldie no-js"> <![endif]--> <!--[if IE 9 ]> <html lang="en-gb" class="isie ie9 no-js"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en-gb" class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <!--[if lt IE 9]> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <![endif]--> <title>Webthemez - Single page website</title> <meta name="description" content=""> <meta name="author" content="webthemez"> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!--[if lte IE 8]> <script type="text/javascript" src="http://explorercanvas.googlecode.com/svn/trunk/excanvas.js"></script> <![endif]--> <link rel="stylesheet" href="css/bootstrap.min.css" /> <link rel="stylesheet" type="text/css" href="css/isotope.css" media="screen" /> <link rel="stylesheet" href="js/fancybox/jquery.fancybox.css" type="text/css" media="screen" /> <link rel="stylesheet" type="text/css" href="css/da-slider.css" /> <link rel="stylesheet" href="css/styles.css"/> <!-- Font Awesome --> <link href="font/css/font-awesome.min.css" rel="stylesheet"> </head> <body> <header class="header"> <div class="container"> <nav class="navbar navbar-inverse" role="navigation"> <div class="navbar-header"> <button type="button" id="nav-toggle" class="navbar-toggle" data-toggle="collapse" data-target="#main-nav"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="#" class="navbar-brand scroll-top logo"><b>Green</b>Corp</a> </div> <!--/.navbar-header--> <div id="main-nav" class="collapse navbar-collapse"> <ul class="nav navbar-nav" id="mainNav"> <li class="active"><a href="#home" class="scroll-link">Home</a></li> <li><a href="#aboutUs" class="scroll-link">About Us</a></li> <li><a href="#services" class="scroll-link">Services</a></li> <li><a href="#portfolio" class="scroll-link">Portfolio</a></li> <li><a href="#team" class="scroll-link">Team</a></li> <li><a href="#contactUs" class="scroll-link">Contact Us</a></li> </ul> </div> <!--/.navbar-collapse--> </nav> <!--/.navbar--> </div> <!--/.container--> </header> <!--/.header--> <div id="#top"></div> <section id="home"> <div id="myCarousel" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ol class="carousel-indicators"> <li data-target="#myCarousel" data-slide-to="0" class=""></li> <li data-target="#myCarousel" data-slide-to="1" class="active"></li> <li data-target="#myCarousel" data-slide-to="2" class=""></li> </ol> <div class="carousel-inner"> <div class="item"> <img data-src="images/chess-2.jpg" alt="First slide" src="images/chess-2.jpg" /> <div class="container"> <div class="carousel-caption"> <h1>Responsive Website</h1> <h3>Its a Single Page Responsive Website.</h3> <!--<p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a></p>--> </div> </div> </div> <div class="item active"> <img data-src="images/apple.jpg" alt="Second slide" src="images/apple.jpg"> <div class="container"> <div class="carousel-caption"> <h1>Mulit device compatability</h1> <h3>Its a Responsive website with mulit device compatability</h3> <!--<p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a></p>--> </div> </div> </div> <div class="item"> <img data-src="images/windmills.jpg" alt="Third slide" src="images/windmills.jpg"> <div class="container"> <div class="carousel-caption"> <h1 id="">Technologies Include</h1> <h3>Technologies: Bootstrap, HTML5, CSS3 and jQuery.</h3> <!--<p><a class="btn btn-lg btn-primary" href="#" role="button">Browse gallery</a></p>--> </div> </div> </div> </div> <a class="left carousel-control" href="#myCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a> <a class="right carousel-control" href="#myCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a> </div> <div class="actionPanel"> <div class="container"> <div class="row"> <div class="col-sm-9 "> <h3>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum..</h3> </div> <div class="col-sm-3 "> <a href="#" class="btn btn-extra-large btn-primary spclBtn">Start Now!</a> </div> </div> </div> </div> </section> <section id="aboutUs" class="page-section darkBg pDark pdingBtm30"> <div class="container"> <div class="heading text-center"> <!-- Heading --> <h2>About Us</h2> <p>At lorem ipsum available, but the majority have suffered alteration humour or randomised</p> </div> <div class="row"> <div class="col-md-4 col-sm-4"> <h3><i class="fa fa-desktop color"></i> &nbsp; What we do?</h3> <!-- Paragraph --> <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit occaecat cupidatat non id est laborum.</p> </div> <div class="col-md-4 col-sm-4"> <!-- Heading --> <h3><i class="fa fa-cloud color"></i> &nbsp;Why choose us?</h3> <!-- Paragraph --> <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit occaecat cupidatat non id est laborum.</p> </div> <div class="col-md-4 col-sm-4"> <!-- Heading --> <h3><i class="fa fa-home color"></i> &nbsp;Where are we?</h3> <!-- Paragraph --> <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit occaecat cupidatat non id est laborum.</p> </div> </div> </div> <!--/.container--> </section> <section id="services" class="page-section"> <div class="container"> <div class="heading text-center"> <!-- Heading --> <h2>Services</h2> <p>At lorem Ipsum available, but the majority have suffered alteration in some form by injected humour.</p> </div> <div class="row"> <!-- item --> <div class="col-md-4 text-center"> <i class="fa fa-arrows fa-2x circle"></i> <h3>Responsive <span class="id-color">Design</span></h3> <p>Nullam ac rhoncus sapien, non gravida purus. Alinon elit imperdiet congue. Integer elit imperdiet congue.</p> </div><!-- end: --> <!-- item --> <div class="col-md-4 text-center"> <i class="fa fa-css3 fa-2x circle"></i> <h3>HTML5/CSS3 <span class="id-color">Dev</span></h3> <p>Nullam ac rhoncus sapien, non gravida purus. Alinon elit imperdiet congue. Integer elit imperdiet congue.</p> </div><!-- end: --> <!-- item --> <div class="col-md-4 text-center"> <i class="fa fa-lightbulb-o fa-2x circle"></i> <h3>JavaScript <span class="id-color">jQuery</span></h3> <p>Nullam ac rhoncus sapien, non gravida purus. Alinon elit imperdiet congue. Integer ultricies sed elit impe.</p> </div><!-- end: --> <!-- item --> <div class="col-md-4 text-center"> <i class="fa fa-globe fa-2x circle"></i> <h3>Web <span class="id-color">Designing</span></h3> <p>Nullam ac rhoncus sapien, non gravida purus. Alinon elit imperdiet congue. Integer elit imperdiet conempus.</p> </div><!-- end:--> <!-- item --> <div class="col-md-4 text-center"> <i class="fa fa-desktop fa-2x circle"></i> <h3>Wordpress <span class="id-color">Dev</span></h3> <p>Nullam ac rhoncus sapien, non gravida purus. Alinon elit imperdiet congue. Integer ultricies sed elit imperdiet congue. Integer ultricies sed ligula eget tempus.</p> </div><!-- end: --> <!-- item --> <div class="col-md-4 text-center"> <i class="fa fa-tablet fa-2x circle"></i> <h3>Mobile <span class="id-color">Dev</span></h3> <p>Nullam ac rhoncus sapien, non gravida purus. Alinon elit imperdiet congue. Integer elit imperdiet congue. Integer ultricies sed ultricies sed ligula eget tempus.</p> </div><!-- end:--> </div> </div> <!--/.container--> </section> <section id="portfolio" class="page-section section appear clearfix"> <div class="container"> <div class="heading text-center"> <!-- Heading --> <h2>Portfolio</h2> <p>At lorem Ipsum available, but the majority have suffered alteration in some form by injected humour.</p> </div> <div class="row"> <nav id="filter" class="col-md-12 text-center"> <ul> <li><a href="#" class="current btn-theme btn-small" data-filter="*">All</a></li> <li><a href="#" class="btn-theme btn-small" data-filter=".webdesign" >Web Design</a></li> <li><a href="#" class="btn-theme btn-small" data-filter=".photography">Photography</a></li> <li ><a href="#" class="btn-theme btn-small" data-filter=".print">Print</a></li> </ul> </nav> <div class="col-md-12"> <div class="row"> <div class="portfolio-items isotopeWrapper clearfix" id="3"> <article class="col-md-4 isotopeItem webdesign"> <div class="portfolio-item"> <img src="images/portfolio/img1.jpg" alt="" /> <div class="portfolio-desc align-center"> <div class="folio-info"> <a href="images/portfolio/img1.jpg" class="fancybox"><h5>Project Name</h5> <i class="fa fa-plus-circle fa-2x"></i></a> </div> </div> </div> </article> <article class="col-md-4 isotopeItem photography"> <div class="portfolio-item"> <img src="images/portfolio/img2.jpg" alt="" /> <div class="portfolio-desc align-center"> <div class="folio-info"> <a href="images/portfolio/img2.jpg" class="fancybox"><h5>Project Name</h5> <i class="fa fa-plus-circle fa-2x"></i></a> </div> </div> </div> </article> <article class="col-md-4 isotopeItem photography"> <div class="portfolio-item"> <img src="images/portfolio/img3.jpg" alt="" /> <div class="portfolio-desc align-center"> <div class="folio-info"> <a href="images/portfolio/img3.jpg" class="fancybox"><h5>Project Name</h5> <i class="fa fa-plus-circle fa-2x"></i></a> </div> </div> </div> </article> <article class="col-md-4 isotopeItem print"> <div class="portfolio-item"> <img src="images/portfolio/img4.jpg" alt="" /> <div class="portfolio-desc align-center"> <div class="folio-info"> <a href="images/portfolio/img4.jpg" class="fancybox"><h5>Project Name</h5> <i class="fa fa-plus-circle fa-2x"></i></a> </div> </div> </div> </article> <article class="col-md-4 isotopeItem photography"> <div class="portfolio-item"> <img src="images/portfolio/img5.jpg" alt="" /> <div class="portfolio-desc align-center"> <div class="folio-info"> <a href="images/portfolio/img5.jpg" class="fancybox"><h5>Project Name</h5> <i class="fa fa-plus-circle fa-2x"></i></a> </div> </div> </div> </article> <article class="col-md-4 isotopeItem webdesign"> <div class="portfolio-item"> <img src="images/portfolio/img6.jpg" alt="" /> <div class="portfolio-desc align-center"> <div class="folio-info"> <a href="images/portfolio/img6.jpg" class="fancybox"><h5>Project Name</h5> <i class="fa fa-plus-circle fa-2x"></i></a> </div> </div> </div> </article> <article class="col-md-4 isotopeItem print"> <div class="portfolio-item"> <img src="images/portfolio/img7.jpg" alt="" /> <div class="portfolio-desc align-center"> <div class="folio-info"> <a href="images/portfolio/img7.jpg" class="fancybox"><h5>Project Name</h5> <i class="fa fa-plus-circle fa-2x"></i></a> </div> </div> </div> </article> <article class="col-md-4 isotopeItem photography"> <div class="portfolio-item"> <img src="images/portfolio/img8.jpg" alt="" /> <div class="portfolio-desc align-center"> <div class="folio-info"> <a href="images/portfolio/img8.jpg" class="fancybox"><h5>Project Name</h5> <i class="fa fa-plus-circle fa-2x"></i></a> </div> </div> </div> </article> <article class="col-md-4 isotopeItem print"> <div class="portfolio-item"> <img src="images/portfolio/img9.jpg" alt="" /> <div class="portfolio-desc align-center"> <div class="folio-info"> <a href="images/portfolio/img9.jpg" class="fancybox"><h5>Project Name</h5> <i class="fa fa-plus-circle fa-2x"></i></a> </div> </div> </div> </article> </div> </div> </div> </div> </div> </section> <section id="team" class="page-section"> <div class="container"> <div class="heading text-center"> <!-- Heading --> <h2>Our Team</h2> <p>At variations of passages of Lorem Ipsum available, but the majority have suffered alteration..</p> </div> <!-- Team Member's Details --> <div class="team-content"> <div class="row"> <div class="col-md-3 col-sm-6 col-xs-6"> <!-- Team Member --> <div class="team-member pDark"> <!-- Image Hover Block --> <div class="member-img"> <!-- Image --> <img class="img-responsive" src="images/photo-1.jpg" alt=""> </div> <!-- Member Details --> <h3>John Doe</h3> <!-- Designation --> <span class="pos">CEO</span> <div class="team-socials"> <a href="#"><i class="fa fa-facebook"></i></a> <a href="#"><i class="fa fa-google-plus"></i></a> <a href="#"><i class="fa fa-twitter"></i></a> </div> </div> </div> <div class="col-md-3 col-sm-6 col-xs-6"> <!-- Team Member --> <div class="team-member pDark"> <!-- Image Hover Block --> <div class="member-img"> <!-- Image --> <img class="img-responsive" src="images/photo-2.jpg" alt=""> </div> <!-- Member Details --> <h3>Larry Doe</h3> <!-- Designation --> <span class="pos">Art Director</span> <div class="team-socials"> <a href="#"><i class="fa fa-facebook"></i></a> <a href="#"><i class="fa fa-google-plus"></i></a> <a href="#"><i class="fa fa-twitter"></i></a> </div> </div> </div> <div class="col-md-3 col-sm-6 col-xs-6"> <!-- Team Member --> <div class="team-member pDark"> <!-- Image Hover Block --> <div class="member-img"> <!-- Image --> <img class="img-responsive" src="images/photo-3.jpg" alt=""> </div> <!-- Member Details --> <h3>Ranith Kays</h3> <!-- Designation --> <span class="pos">Manager</span> <div class="team-socials"> <a href="#"><i class="fa fa-facebook"></i></a> <a href="#"><i class="fa fa-google-plus"></i></a> <a href="#"><i class="fa fa-twitter"></i></a> </div> </div> </div> <div class="col-md-3 col-sm-6 col-xs-6"> <!-- Team Member --> <div class="team-member pDark"> <!-- Image Hover Block --> <div class="member-img"> <!-- Image --> <img class="img-responsive" src="images/photo-4.jpg" alt=""> </div> <!-- Member Details --> <h3>Joan Ray</h3> <!-- Designation --> <span class="pos">Creative</span> <div class="team-socials"> <a href="#"><i class="fa fa-facebook"></i></a> <a href="#"><i class="fa fa-google-plus"></i></a> <a href="#"><i class="fa fa-twitter"></i></a> </div> </div> </div> </div> </div> </div> <!--/.container--> </section> <section id="contactUs" class="page-section"> <div class="container"> <div class="row"> <div class="heading text-center"> <!-- Heading --> <h2>Contact Us</h2> <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered.</p> </div> </div> <div class="row mrgn30"> <div class="col-sm-4"> <h4>Address:</h4> <address> WebThemez Company<br> 134 Stilla. Tae., 414515<br> Leorislon, SA 02434-34534 USA <br> </address> <h4>Phone:</h4> <address> 12345-49589-2<br> </address> </div> <form method="post" action="" id="contactfrm" role="form"> <div class="col-sm-4"> <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" name="name" id="name" placeholder="Enter name" title="Please enter your name (at least 2 characters)"> </div> <div class="form-group"> <label for="email">Email</label> <input type="email" class="form-control" name="email" id="email" placeholder="Enter email" title="Please enter a valid email address"> </div> <div class="form-group"> <label for="phone">Phone</label> <input name="phone" class="form-control required digits" type="tel" id="phone" size="30" value="" placeholder="Enter email phone" title="Please enter a valid phone number (at least 10 characters)"> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label for="comments">Comments</label> <textarea name="comment" class="form-control" id="comments" cols="3" rows="5" placeholder="Enter your message…" title="Please enter your message (at least 10 characters)"></textarea> </div> <button name="submit" type="submit" class="btn btn-lg btn-primary" id="submit"> Submit</button> <div class="result"></div> </div> </form> </div> </div> <!--/.container--> </section> <section class="maps"> <iframe src="http://maps.google.com/maps?f=q&t=m&z=15&ll=-7.269152,112.733127&output=embed" width="100%" height="250" frameborder="0"></iframe> </section> <footer class="page-section"> <div class="container"> <div class="row"> <div class="col-md-4 col-sm-6 about"> <a href="#" class="logoDark"><h4>WebThemez</h4></a> <p>Lorem ipsum dolor amet, consectetur adipiscing elit. Aenean leo lectus sollicitudin convallis eget libero. Aliquam laoreet tellus ut libero semper, egestas velit malesuada. Sed non risus eget dolor amet vestibulum ullamcorper. Integer feugiat molestie.</p> <ul class="socialIcons"> <li><a href="#" class="fbIcon" target="_blank"><i class="fa fa-facebook-square fa-lg""></i></a></li> <li><a href="#" class="twitterIcon" target="_blank"><i class="fa fa-twitter-square fa-lg""></i></a></li> <li><a href="#" class="googleIcon" target="_blank"><i class="fa fa-google-plus-square fa-lg""></i></a></li> <li><a href="#" class="pinterest" target="_blank"><i class="fa fa-pinterest-square fa-lg""></i></a></li> </ul> </div> <div class="col-md-4 col-sm-6 twitter"> <h4>Latest Tweets</h4> <ul> <li><a href="#">@John Doe</a> Lorem ipsum dolor amet, consectetur adipiscing elit. Aenean leo lectus sollicitudin eget libero.<br><span>2 minutes ago</span></li> <li><a href="#">@John Doe</a> Lorem ipsum dolor amet, consectetur adipiscing elit. Aenean leo lectus sollicitudin eget libero.<br><span>About an hour ago</span></li> </ul> </div> <div class="col-md-4 contact"> <h4>Contact Info</h4> <p>Lorem ipsum dolor amet, consectetur adipiscing ipsum dolor.</p> <ul> <li><i class="fa fa-phone"></i>1-123-345-6789</li> <li><a href="#"><i class="fa fa-envelope-o"></i> contact@webthemez.com</a></li> <li><i class="fa fa-flag"></i>123 Smith Drive, Baltimore, MD 21212</li> </ul> </div> </div><!-- END Row --> </div> </footer> <!--/.page-section--> <section class="copyright"> <div class="container"> <div class="row"> <div class="col-sm-12"> <div class="pull-left copyRights">Copyright 2014 All Rights Reserved</div> <div class="pull-right webThemez">Template by <a href="http://webThemez.com"> WebThemez.com</a></div> </div> </div> <!-- / .row --> </div> </section> <a href="#top" class="topHome"><i class="fa fa-chevron-up fa-2x"></i></a> <!--[if lte IE 8]><script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><![endif]--> <script src="js/modernizr-latest.js"></script> <script src="js/jquery-1.8.2.min.js" type="text/javascript"></script> <script src="js/bootstrap.min.js" type="text/javascript"></script> <script src="js/jquery.isotope.min.js" type="text/javascript"></script> <script src="js/fancybox/jquery.fancybox.pack.js" type="text/javascript"></script> <script src="js/jquery.nav.js" type="text/javascript"></script> <script src="js/jquery.cslider.js" type="text/javascript"></script> <script src="js/custom.js" type="text/javascript"></script> </body> </html>
{ "pile_set_name": "Github" }
package logrus import ( "bytes" "fmt" "sort" "strings" "sync" "time" ) const ( nocolor = 0 red = 31 green = 32 yellow = 33 blue = 36 gray = 37 ) var ( baseTimestamp time.Time emptyFieldMap FieldMap ) func init() { baseTimestamp = time.Now() } // TextFormatter formats logs into text type TextFormatter struct { // Set to true to bypass checking for a TTY before outputting colors. ForceColors bool // Force disabling colors. DisableColors bool // Disable timestamp logging. useful when output is redirected to logging // system that already adds timestamps. DisableTimestamp bool // Enable logging the full timestamp when a TTY is attached instead of just // the time passed since beginning of execution. FullTimestamp bool // TimestampFormat to use for display when a full timestamp is printed TimestampFormat string // The fields are sorted by default for a consistent output. For applications // that log extremely frequently and don't use the JSON formatter this may not // be desired. DisableSorting bool // Disables the truncation of the level text to 4 characters. DisableLevelTruncation bool // QuoteEmptyFields will wrap empty fields in quotes if true QuoteEmptyFields bool // Whether the logger's out is to a terminal isTerminal bool // FieldMap allows users to customize the names of keys for default fields. // As an example: // formatter := &TextFormatter{ // FieldMap: FieldMap{ // FieldKeyTime: "@timestamp", // FieldKeyLevel: "@level", // FieldKeyMsg: "@message"}} FieldMap FieldMap sync.Once } func (f *TextFormatter) init(entry *Entry) { if entry.Logger != nil { f.isTerminal = checkIfTerminal(entry.Logger.Out) } } // Format renders a single log entry func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { prefixFieldClashes(entry.Data, f.FieldMap) keys := make([]string, 0, len(entry.Data)) for k := range entry.Data { keys = append(keys, k) } if !f.DisableSorting { sort.Strings(keys) } var b *bytes.Buffer if entry.Buffer != nil { b = entry.Buffer } else { b = &bytes.Buffer{} } f.Do(func() { f.init(entry) }) isColored := (f.ForceColors || f.isTerminal) && !f.DisableColors timestampFormat := f.TimestampFormat if timestampFormat == "" { timestampFormat = defaultTimestampFormat } if isColored { f.printColored(b, entry, keys, timestampFormat) } else { if !f.DisableTimestamp { f.appendKeyValue(b, f.FieldMap.resolve(FieldKeyTime), entry.Time.Format(timestampFormat)) } f.appendKeyValue(b, f.FieldMap.resolve(FieldKeyLevel), entry.Level.String()) if entry.Message != "" { f.appendKeyValue(b, f.FieldMap.resolve(FieldKeyMsg), entry.Message) } for _, key := range keys { f.appendKeyValue(b, key, entry.Data[key]) } } b.WriteByte('\n') return b.Bytes(), nil } func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) { var levelColor int switch entry.Level { case DebugLevel: levelColor = gray case WarnLevel: levelColor = yellow case ErrorLevel, FatalLevel, PanicLevel: levelColor = red default: levelColor = blue } levelText := strings.ToUpper(entry.Level.String()) if !f.DisableLevelTruncation { levelText = levelText[0:4] } if f.DisableTimestamp { fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m %-44s ", levelColor, levelText, entry.Message) } else if !f.FullTimestamp { fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, int(entry.Time.Sub(baseTimestamp)/time.Second), entry.Message) } else { fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message) } for _, k := range keys { v := entry.Data[k] fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k) f.appendValue(b, v) } } func (f *TextFormatter) needsQuoting(text string) bool { if f.QuoteEmptyFields && len(text) == 0 { return true } for _, ch := range text { if !((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '-' || ch == '.' || ch == '_' || ch == '/' || ch == '@' || ch == '^' || ch == '+') { return true } } return false } func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) { if b.Len() > 0 { b.WriteByte(' ') } b.WriteString(key) b.WriteByte('=') f.appendValue(b, value) } func (f *TextFormatter) appendValue(b *bytes.Buffer, value interface{}) { stringVal, ok := value.(string) if !ok { stringVal = fmt.Sprint(value) } if !f.needsQuoting(stringVal) { b.WriteString(stringVal) } else { b.WriteString(fmt.Sprintf("%q", stringVal)) } }
{ "pile_set_name": "Github" }
--- title: Image.Click Event (Outlook Forms Script) ms.prod: outlook ms.assetid: 59ac08ce-2527-6cfb-ac0b-66322bc10e9f ms.date: 06/08/2017 --- # Image.Click Event (Outlook Forms Script) Occurs when the user clicks inside the control. ## Syntax _expression_. **Click** _expression_A variable that represents an **Image** object. ## Remarks The following are examples of actions that initiate the **Click** event of the specified control: - Clicking a blank area of a form or a disabled control (other than a list box) on the form. - Clicking a control with the left mouse button (left-clicking). - Pressing a control's accelerator key. Left-clicking changes the value of a control, thus it initiates the **Click** event. Right-clicking does not change the value of the control, so it does not initiate the **Click** event.
{ "pile_set_name": "Github" }
/** * [TRIfA], Java part of Tox Reference Implementation for Android * Copyright (C) 2017 Zoff <zoff@zoff.cc> * <p> * 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. * <p> * 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. * <p> * You should have received a copy of the GNU General Public License * along with this program; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ package com.zoffcc.applications.trifa; import android.content.Context; import androidx.recyclerview.widget.RecyclerView; import android.util.Log; import android.view.View; import com.luseen.autolinklibrary.AutoLinkMode; import com.luseen.autolinklibrary.EmojiTextViewLinks; public class MessageListHolder_error extends RecyclerView.ViewHolder { private static final String TAG = "trifa.MessageListHolder"; private Message message; EmojiTextViewLinks textView; public MessageListHolder_error(View itemView, Context c) { super(itemView); Log.i(TAG, "MessageListHolder"); Context context = c; textView = (EmojiTextViewLinks) itemView.findViewById(R.id.m_text); textView.addAutoLinkMode(AutoLinkMode.MODE_URL); } public void bindMessageList(Message m) { // Log.i(TAG, "bindMessageList"); } }
{ "pile_set_name": "Github" }
/* GIO - GLib Input, Output and Streaming Library * * Copyright © 2009 Codethink Limited * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2 of the licence 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, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * Authors: Ryan Lortie <desrt@desrt.ca> */ #ifndef __G_UNIX_FD_LIST_H__ #define __G_UNIX_FD_LIST_H__ #include <gio/gio.h> G_BEGIN_DECLS #define G_TYPE_UNIX_FD_LIST (g_unix_fd_list_get_type ()) #define G_UNIX_FD_LIST(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ G_TYPE_UNIX_FD_LIST, GUnixFDList)) #define G_UNIX_FD_LIST_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ G_TYPE_UNIX_FD_LIST, GUnixFDListClass)) #define G_IS_UNIX_FD_LIST(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ G_TYPE_UNIX_FD_LIST)) #define G_IS_UNIX_FD_LIST_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ G_TYPE_UNIX_FD_LIST)) #define G_UNIX_FD_LIST_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ G_TYPE_UNIX_FD_LIST, GUnixFDListClass)) typedef struct _GUnixFDListPrivate GUnixFDListPrivate; typedef struct _GUnixFDListClass GUnixFDListClass; struct _GUnixFDListClass { GObjectClass parent_class; /*< private >*/ /* Padding for future expansion */ void (*_g_reserved1) (void); void (*_g_reserved2) (void); void (*_g_reserved3) (void); void (*_g_reserved4) (void); void (*_g_reserved5) (void); }; struct _GUnixFDList { GObject parent_instance; GUnixFDListPrivate *priv; }; GType g_unix_fd_list_get_type (void) G_GNUC_CONST; GUnixFDList * g_unix_fd_list_new (void); GUnixFDList * g_unix_fd_list_new_from_array (const gint *fds, gint n_fds); gint g_unix_fd_list_append (GUnixFDList *list, gint fd, GError **error); gint g_unix_fd_list_get_length (GUnixFDList *list); gint g_unix_fd_list_get (GUnixFDList *list, gint index_, GError **error); const gint * g_unix_fd_list_peek_fds (GUnixFDList *list, gint *length); gint * g_unix_fd_list_steal_fds (GUnixFDList *list, gint *length); G_END_DECLS #endif /* __G_UNIX_FD_LIST_H__ */
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.Drawing; using System.Drawing.Drawing2D; using System.ComponentModel; namespace WeifenLuo.WinFormsUI.Docking { partial class DockPanel { private sealed class SplitterDragHandler : DragHandler { private class SplitterOutline { public SplitterOutline() { m_dragForm = new DragForm(); SetDragForm(Rectangle.Empty); DragForm.BackColor = Color.Black; DragForm.Opacity = 0.7; DragForm.Show(false); } DragForm m_dragForm; private DragForm DragForm { get { return m_dragForm; } } public void Show(Rectangle rect) { SetDragForm(rect); } public void Close() { DragForm.Close(); } private void SetDragForm(Rectangle rect) { DragForm.Bounds = rect; if (rect == Rectangle.Empty) DragForm.Region = new Region(Rectangle.Empty); else if (DragForm.Region != null) DragForm.Region = null; } } public SplitterDragHandler(DockPanel dockPanel) : base(dockPanel) { } public new ISplitterDragSource DragSource { get { return base.DragSource as ISplitterDragSource; } private set { base.DragSource = value; } } private SplitterOutline m_outline; private SplitterOutline Outline { get { return m_outline; } set { m_outline = value; } } private Rectangle m_rectSplitter; private Rectangle RectSplitter { get { return m_rectSplitter; } set { m_rectSplitter = value; } } public void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter) { DragSource = dragSource; RectSplitter = rectSplitter; if (!BeginDrag()) { DragSource = null; return; } Outline = new SplitterOutline(); Outline.Show(rectSplitter); DragSource.BeginDrag(rectSplitter); } protected override void OnDragging() { Outline.Show(GetSplitterOutlineBounds(Control.MousePosition)); } protected override void OnEndDrag(bool abort) { DockPanel.SuspendLayout(true); Outline.Close(); if (!abort) DragSource.MoveSplitter(GetMovingOffset(Control.MousePosition)); DragSource.EndDrag(); DockPanel.ResumeLayout(true, true); } private int GetMovingOffset(Point ptMouse) { Rectangle rect = GetSplitterOutlineBounds(ptMouse); if (DragSource.IsVertical) return rect.X - RectSplitter.X; else return rect.Y - RectSplitter.Y; } private Rectangle GetSplitterOutlineBounds(Point ptMouse) { Rectangle rectLimit = DragSource.DragLimitBounds; Rectangle rect = RectSplitter; if (rectLimit.Width <= 0 || rectLimit.Height <= 0) return rect; if (DragSource.IsVertical) { rect.X += ptMouse.X - StartMousePosition.X; rect.Height = rectLimit.Height; } else { rect.Y += ptMouse.Y - StartMousePosition.Y; rect.Width = rectLimit.Width; } if (rect.Left < rectLimit.Left) rect.X = rectLimit.X; if (rect.Top < rectLimit.Top) rect.Y = rectLimit.Y; if (rect.Right > rectLimit.Right) rect.X -= rect.Right - rectLimit.Right; if (rect.Bottom > rectLimit.Bottom) rect.Y -= rect.Bottom - rectLimit.Bottom; return rect; } } private SplitterDragHandler m_splitterDragHandler = null; private SplitterDragHandler GetSplitterDragHandler() { if (m_splitterDragHandler == null) m_splitterDragHandler = new SplitterDragHandler(this); return m_splitterDragHandler; } internal void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter) { GetSplitterDragHandler().BeginDrag(dragSource, rectSplitter); } } }
{ "pile_set_name": "Github" }
# MUI_EXTRAPAGES.nsh # By Red Wine Jan 2007 !verbose push !verbose 3 !ifndef _MUI_EXTRAPAGES_NSH !define _MUI_EXTRAPAGES_NSH !ifmacrondef MUI_EXTRAPAGE_README & MUI_PAGE_README & MUI_UNPAGE_README & ReadmeLangStrings !macro MUI_EXTRAPAGE_README UN ReadmeFile !verbose push !verbose 3 !define MUI_PAGE_HEADER_TEXT "$(${UN}ReadmeHeader)" !define MUI_PAGE_HEADER_SUBTEXT "$(${UN}ReadmeSubHeader)" !define MUI_LICENSEPAGE_TEXT_TOP "$(${UN}ReadmeTextTop)" !define MUI_LICENSEPAGE_TEXT_BOTTOM "$(${UN}ReadmeTextBottom)" !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)" !insertmacro MUI_${UN}PAGE_LICENSE "${ReadmeFile}" !verbose pop !macroend !define ReadmeRun "!insertmacro MUI_EXTRAPAGE_README" !macro MUI_PAGE_README ReadmeFile !verbose push !verbose 3 ${ReadmeRun} "" "${ReadmeFile}" !verbose pop !macroend !macro MUI_UNPAGE_README ReadmeFile !verbose push !verbose 3 ${ReadmeRun} "UN" "${ReadmeFile}" !verbose pop !macroend !macro ReadmeLangStrings UN MUI_LANG ReadmeHeader ReadmeSubHeader ReadmeTextTop ReadmeTextBottom !verbose push !verbose 3 LangString ${UN}ReadmeHeader ${MUI_LANG} "${ReadmeHeader}" LangString ${UN}ReadmeSubHeader ${MUI_LANG} "${ReadmeSubHeader}" LangString ${UN}ReadmeTextTop ${MUI_LANG} "${ReadmeTextTop}" LangString ${UN}ReadmeTextBottom ${MUI_LANG} "${ReadmeTextBottom}" !verbose pop !macroend !define ReadmeLanguage `!insertmacro ReadmeLangStrings ""` !define Un.ReadmeLanguage `!insertmacro ReadmeLangStrings "UN"` !endif !endif !verbose pop
{ "pile_set_name": "Github" }
// errorcheck // 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. // Verify that large integer constant expressions cause overflow. // Does not compile. package main const ( A int = 1 B byte; // ERROR "type without expr|expected .=." ) const LargeA = 1000000000000000000 const LargeB = LargeA * LargeA * LargeA const LargeC = LargeB * LargeB * LargeB // GC_ERROR "constant multiplication overflow" const AlsoLargeA = LargeA << 400 << 400 >> 400 >> 400 // GC_ERROR "constant shift overflow"
{ "pile_set_name": "Github" }
# First some @modifier mappings. Internally, the modifier is signaled by # replacing '_' in the locale name with a unique identifying character. # For example, internally we map "ca_ES@euro" to "caeES". This allows for # smaller code and easier processing of locale names. @euro e @cyrillic c #--------------------------------------------------------------------------- # Next, set to {y}es to enable and {n}o to disable the UTF-8 and the 8-bit # codeset locales. Of course, you must have built the c8tables.h and # the wctables.h files appropriately. UTF-8 yes 8-BIT yes #--------------------------------------------------------------------------- # Now the locales af_ZA ISO-8859-1 af_ZA.UTF-8 UTF-8 am_ET UTF-8 ar_AE ISO-8859-6 ar_AE.UTF-8 UTF-8 ar_BH ISO-8859-6 ar_BH.UTF-8 UTF-8 ar_DZ ISO-8859-6 ar_DZ.UTF-8 UTF-8 ar_EG ISO-8859-6 ar_EG.UTF-8 UTF-8 ar_IN UTF-8 ar_IQ ISO-8859-6 ar_IQ.UTF-8 UTF-8 ar_JO ISO-8859-6 ar_JO.UTF-8 UTF-8 ar_KW ISO-8859-6 ar_KW.UTF-8 UTF-8 ar_LB ISO-8859-6 ar_LB.UTF-8 UTF-8 ar_LY ISO-8859-6 ar_LY.UTF-8 UTF-8 ar_MA ISO-8859-6 ar_MA.UTF-8 UTF-8 ar_OM ISO-8859-6 ar_OM.UTF-8 UTF-8 ar_QA ISO-8859-6 ar_QA.UTF-8 UTF-8 ar_SA ISO-8859-6 ar_SA.UTF-8 UTF-8 ar_SD ISO-8859-6 ar_SD.UTF-8 UTF-8 ar_SY ISO-8859-6 ar_SY.UTF-8 UTF-8 ar_TN ISO-8859-6 ar_TN.UTF-8 UTF-8 ar_YE ISO-8859-6 ar_YE.UTF-8 UTF-8 # az_AZ ISO-8859-9E az_AZ ISO-8859-9 az_AZ.UTF-8 UTF-8 be_BY CP1251 be_BY.UTF-8 UTF-8 bg_BG CP1251 bg_BG.UTF-8 UTF-8 bn_BD UTF-8 bn_IN UTF-8 br_FR ISO-8859-1 br_FR.UTF-8 UTF-8 bs_BA ISO-8859-2 bs_BA.UTF-8 UTF-8 ca_ES ISO-8859-1 ca_ES.UTF-8 UTF-8 ca_ES.UTF-8@euro UTF-8 ca_ES@euro ISO-8859-15 cs_CZ ISO-8859-2 cs_CZ.UTF-8 UTF-8 cy_GB ISO-8859-14 cy_GB.UTF-8 UTF-8 da_DK ISO-8859-1 da_DK.UTF-8 UTF-8 de_AT ISO-8859-1 de_AT.UTF-8 UTF-8 de_AT.UTF-8@euro UTF-8 de_AT@euro ISO-8859-15 de_BE ISO-8859-1 de_BE.UTF-8 UTF-8 de_BE.UTF-8@euro UTF-8 de_BE@euro ISO-8859-15 de_CH ISO-8859-1 de_CH.UTF-8 UTF-8 de_DE ISO-8859-1 de_DE.UTF-8 UTF-8 de_DE.UTF-8@euro UTF-8 de_DE@euro ISO-8859-15 de_LU ISO-8859-1 de_LU.UTF-8 UTF-8 de_LU.UTF-8@euro UTF-8 de_LU@euro ISO-8859-15 el_GR ISO-8859-7 el_GR.UTF-8 UTF-8 en_AU ISO-8859-1 en_AU.UTF-8 UTF-8 en_BW ISO-8859-1 en_BW.UTF-8 UTF-8 en_CA ISO-8859-1 en_CA.UTF-8 UTF-8 en_DK ISO-8859-1 en_DK.UTF-8 UTF-8 en_GB ISO-8859-1 en_GB.UTF-8 UTF-8 en_HK ISO-8859-1 en_HK.UTF-8 UTF-8 en_IE ISO-8859-1 en_IE.UTF-8 UTF-8 en_IE.UTF-8@euro UTF-8 en_IE@euro ISO-8859-15 en_IN UTF-8 en_NZ ISO-8859-1 en_NZ.UTF-8 UTF-8 en_PH ISO-8859-1 en_PH.UTF-8 UTF-8 en_SG ISO-8859-1 en_SG.UTF-8 UTF-8 en_US ISO-8859-1 en_US.UTF-8 UTF-8 en_ZA ISO-8859-1 en_ZA.UTF-8 UTF-8 en_ZW ISO-8859-1 en_ZW.UTF-8 UTF-8 eo_EO.UTF-8 UTF-8 es_AR ISO-8859-1 es_AR.UTF-8 UTF-8 es_BO ISO-8859-1 es_BO.UTF-8 UTF-8 es_CL ISO-8859-1 es_CL.UTF-8 UTF-8 es_CO ISO-8859-1 es_CO.UTF-8 UTF-8 es_CR ISO-8859-1 es_CR.UTF-8 UTF-8 es_DO ISO-8859-1 es_DO.UTF-8 UTF-8 es_EC ISO-8859-1 es_EC.UTF-8 UTF-8 es_ES ISO-8859-1 es_ES.UTF-8 UTF-8 es_ES.UTF-8@euro UTF-8 es_ES@euro ISO-8859-15 es_GT ISO-8859-1 es_GT.UTF-8 UTF-8 es_HN ISO-8859-1 es_HN.UTF-8 UTF-8 es_MX ISO-8859-1 es_MX.UTF-8 UTF-8 es_NI ISO-8859-1 es_NI.UTF-8 UTF-8 es_PA ISO-8859-1 es_PA.UTF-8 UTF-8 es_PE ISO-8859-1 es_PE.UTF-8 UTF-8 es_PR ISO-8859-1 es_PR.UTF-8 UTF-8 es_PY ISO-8859-1 es_PY.UTF-8 UTF-8 es_SV ISO-8859-1 es_SV.UTF-8 UTF-8 es_US ISO-8859-1 es_US.UTF-8 UTF-8 es_UY ISO-8859-1 es_UY.UTF-8 UTF-8 es_VE ISO-8859-1 es_VE.UTF-8 UTF-8 et_EE ISO-8859-1 et_EE.UTF-8 UTF-8 eu_ES ISO-8859-1 eu_ES.UTF-8 UTF-8 eu_ES.UTF-8@euro UTF-8 eu_ES@euro ISO-8859-15 fa_IR UTF-8 fa_IR.UTF-8 UTF-8 fi_FI ISO-8859-1 fi_FI.UTF-8 UTF-8 fi_FI.UTF-8@euro UTF-8 fi_FI@euro ISO-8859-15 fo_FO ISO-8859-1 fo_FO.UTF-8 UTF-8 fr_BE ISO-8859-1 fr_BE.UTF-8 UTF-8 fr_BE.UTF-8@euro UTF-8 fr_BE@euro ISO-8859-15 fr_CA ISO-8859-1 fr_CA.UTF-8 UTF-8 fr_CH ISO-8859-1 fr_CH.UTF-8 UTF-8 fr_FR ISO-8859-1 fr_FR.UTF-8 UTF-8 fr_FR.UTF-8@euro UTF-8 fr_FR@euro ISO-8859-15 fr_LU ISO-8859-1 fr_LU.UTF-8 UTF-8 fr_LU.UTF-8@euro UTF-8 fr_LU@euro ISO-8859-15 ga_IE ISO-8859-1 ga_IE.UTF-8 UTF-8 ga_IE.UTF-8@euro UTF-8 ga_IE@euro ISO-8859-15 gd_GB ISO-8859-15 gd_GB.UTF-8 UTF-8 gl_ES ISO-8859-1 gl_ES.UTF-8 UTF-8 gl_ES.UTF-8@euro UTF-8 gl_ES@euro ISO-8859-15 gv_GB ISO-8859-1 gv_GB.UTF-8 UTF-8 he_IL ISO-8859-8 he_IL.UTF-8 UTF-8 hi_IN UTF-8 hi_IN.UTF-8 UTF-8 hr_HR ISO-8859-2 hr_HR.UTF-8 UTF-8 hu_HU ISO-8859-2 hu_HU.UTF-8 UTF-8 hy_AM ARMSCII-8 hy_AM.UTF-8 UTF-8 id_ID ISO-8859-1 id_ID.UTF-8 UTF-8 is_IS ISO-8859-1 is_IS.UTF-8 UTF-8 it_CH ISO-8859-1 it_CH.UTF-8 UTF-8 it_IT ISO-8859-1 it_IT.UTF-8 UTF-8 it_IT.UTF-8@euro UTF-8 it_IT@euro ISO-8859-15 iw_IL ISO-8859-8 iw_IL.UTF-8 UTF-8 ja_JP.UTF-8 UTF-8 ka_GE GEORGIAN-PS ka_GE.UTF-8 UTF-8 kl_GL ISO-8859-1 kl_GL.UTF-8 UTF-8 ko_KR.UTF-8 UTF-8 kw_GB ISO-8859-1 kw_GB.UTF-8 UTF-8 lt_LT ISO-8859-13 lt_LT.UTF-8 UTF-8 lv_LV ISO-8859-13 lv_LV.UTF-8 UTF-8 mi_NZ ISO-8859-13 mi_NZ.UTF-8 UTF-8 mk_MK ISO-8859-5 mk_MK.UTF-8 UTF-8 mr_IN UTF-8 mr_IN.UTF-8 UTF-8 ms_MY ISO-8859-1 ms_MY.UTF-8 UTF-8 mt_MT ISO-8859-3 mt_MT.UTF-8 UTF-8 nl_BE ISO-8859-1 nl_BE.UTF-8 UTF-8 nl_BE.UTF-8@euro UTF-8 nl_BE@euro ISO-8859-15 nl_NL ISO-8859-1 nl_NL.UTF-8 UTF-8 nl_NL.UTF-8@euro UTF-8 nl_NL@euro ISO-8859-15 nn_NO ISO-8859-1 nn_NO.UTF-8 UTF-8 no_NO ISO-8859-1 no_NO.UTF-8 UTF-8 oc_FR ISO-8859-1 oc_FR.UTF-8 UTF-8 pl_PL ISO-8859-2 pl_PL.UTF-8 UTF-8 pt_BR ISO-8859-1 pt_BR.UTF-8 UTF-8 pt_PT ISO-8859-1 pt_PT.UTF-8 UTF-8 pt_PT.UTF-8@euro UTF-8 pt_PT@euro ISO-8859-15 ro_RO ISO-8859-2 ro_RO.UTF-8 UTF-8 ru_RU ISO-8859-5 ru_RU.KOI8-R KOI8-R ru_RU.UTF-8 UTF-8 ru_UA KOI8-U ru_UA.UTF-8 UTF-8 se_NO UTF-8 sk_SK ISO-8859-2 sk_SK.UTF-8 UTF-8 sl_SI ISO-8859-2 sl_SI.UTF-8 UTF-8 sq_AL ISO-8859-1 sq_AL.UTF-8 UTF-8 sr_YU ISO-8859-2 sr_YU.UTF-8 UTF-8 sr_YU.UTF-8@cyrillic UTF-8 sr_YU@cyrillic ISO-8859-5 sv_FI ISO-8859-1 sv_FI.UTF-8 UTF-8 sv_FI.UTF-8@euro UTF-8 sv_FI@euro ISO-8859-15 sv_SE ISO-8859-1 sv_SE.UTF-8 UTF-8 ta_IN UTF-8 te_IN UTF-8 tg_TJ KOI8-T tg_TJ.UTF-8 UTF-8 th_TH TIS-620 th_TH.UTF-8 UTF-8 ti_ER UTF-8 ti_ET UTF-8 tl_PH ISO-8859-1 tl_PH.UTF-8 UTF-8 tr_TR ISO-8859-9 tr_TR.UTF-8 UTF-8 # tt_RU TATAR-CYR tt_RU.UTF-8 UTF-8 uk_UA KOI8-U uk_UA.UTF-8 UTF-8 ur_PK UTF-8 uz_UZ ISO-8859-1 uz_UZ.UTF-8 UTF-8 vi_VN UTF-8 vi_VN.UTF-8 UTF-8 wa_BE ISO-8859-1 wa_BE.UTF-8 UTF-8 wa_BE@euro ISO-8859-15 yi_US CP1255 yi_US.UTF-8 UTF-8 zh_CN.UTF-8 UTF-8 zh_HK.UTF-8 UTF-8 zh_SG UTF-8 zh_TW.UTF-8 UTF-8 # The following are standard locales, but we currently don't support # the necessary multibyte encodings. # ja_JP.EUC-JP EUC-JP # ko_KR.EUC-KR EUC-KR # zh_CN GB2312 # zh_CN.GB18030 GB18030 # zh_CN.GBK GBK # zh_TW.EUC-TW EUC-TW # zh_HK BIG5-HKSCS # zh_TW BIG5
{ "pile_set_name": "Github" }
/* * Copyright 2018 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _VEGA20_HWMGR_H_ #define _VEGA20_HWMGR_H_ #include "hwmgr.h" #include "smu11_driver_if.h" #include "ppatomfwctrl.h" #define VEGA20_MAX_HARDWARE_POWERLEVELS 2 #define WaterMarksExist 1 #define WaterMarksLoaded 2 #define VG20_PSUEDO_NUM_GFXCLK_DPM_LEVELS 8 #define VG20_PSUEDO_NUM_SOCCLK_DPM_LEVELS 8 #define VG20_PSUEDO_NUM_DCEFCLK_DPM_LEVELS 8 #define VG20_PSUEDO_NUM_UCLK_DPM_LEVELS 4 //OverDriver8 macro defs #define AVFS_CURVE 0 #define OD8_HOTCURVE_TEMPERATURE 85 #define VG20_CLOCK_MAX_DEFAULT 0xFFFF typedef uint32_t PP_Clock; enum { GNLD_DPM_PREFETCHER = 0, GNLD_DPM_GFXCLK, GNLD_DPM_UCLK, GNLD_DPM_SOCCLK, GNLD_DPM_UVD, GNLD_DPM_VCE, GNLD_ULV, GNLD_DPM_MP0CLK, GNLD_DPM_LINK, GNLD_DPM_DCEFCLK, GNLD_DS_GFXCLK, GNLD_DS_SOCCLK, GNLD_DS_LCLK, GNLD_PPT, GNLD_TDC, GNLD_THERMAL, GNLD_GFX_PER_CU_CG, GNLD_RM, GNLD_DS_DCEFCLK, GNLD_ACDC, GNLD_VR0HOT, GNLD_VR1HOT, GNLD_FW_CTF, GNLD_LED_DISPLAY, GNLD_FAN_CONTROL, GNLD_DIDT, GNLD_GFXOFF, GNLD_CG, GNLD_DPM_FCLK, GNLD_DS_FCLK, GNLD_DS_MP1CLK, GNLD_DS_MP0CLK, GNLD_XGMI, GNLD_ECC, GNLD_FEATURES_MAX }; #define GNLD_DPM_MAX (GNLD_DPM_DCEFCLK + 1) #define SMC_DPM_FEATURES 0x30F struct smu_features { bool supported; bool enabled; bool allowed; uint32_t smu_feature_id; uint64_t smu_feature_bitmap; }; struct vega20_performance_level { uint32_t soc_clock; uint32_t gfx_clock; uint32_t mem_clock; }; struct vega20_bacos { uint32_t baco_flags; /* struct vega20_performance_level performance_level; */ }; struct vega20_uvd_clocks { uint32_t vclk; uint32_t dclk; }; struct vega20_vce_clocks { uint32_t evclk; uint32_t ecclk; }; struct vega20_power_state { uint32_t magic; struct vega20_uvd_clocks uvd_clks; struct vega20_vce_clocks vce_clks; uint16_t performance_level_count; bool dc_compatible; uint32_t sclk_threshold; struct vega20_performance_level performance_levels[VEGA20_MAX_HARDWARE_POWERLEVELS]; }; struct vega20_dpm_level { bool enabled; uint32_t value; uint32_t param1; }; #define VEGA20_MAX_DEEPSLEEP_DIVIDER_ID 5 #define MAX_REGULAR_DPM_NUMBER 16 #define MAX_PCIE_CONF 2 #define VEGA20_MINIMUM_ENGINE_CLOCK 2500 struct vega20_max_sustainable_clocks { PP_Clock display_clock; PP_Clock phy_clock; PP_Clock pixel_clock; PP_Clock uclock; PP_Clock dcef_clock; PP_Clock soc_clock; }; struct vega20_dpm_state { uint32_t soft_min_level; uint32_t soft_max_level; uint32_t hard_min_level; uint32_t hard_max_level; }; struct vega20_single_dpm_table { uint32_t count; struct vega20_dpm_state dpm_state; struct vega20_dpm_level dpm_levels[MAX_REGULAR_DPM_NUMBER]; }; struct vega20_odn_dpm_control { uint32_t count; uint32_t entries[MAX_REGULAR_DPM_NUMBER]; }; struct vega20_pcie_table { uint16_t count; uint8_t pcie_gen[MAX_PCIE_CONF]; uint8_t pcie_lane[MAX_PCIE_CONF]; uint32_t lclk[MAX_PCIE_CONF]; }; struct vega20_dpm_table { struct vega20_single_dpm_table soc_table; struct vega20_single_dpm_table gfx_table; struct vega20_single_dpm_table mem_table; struct vega20_single_dpm_table eclk_table; struct vega20_single_dpm_table vclk_table; struct vega20_single_dpm_table dclk_table; struct vega20_single_dpm_table dcef_table; struct vega20_single_dpm_table pixel_table; struct vega20_single_dpm_table display_table; struct vega20_single_dpm_table phy_table; struct vega20_single_dpm_table fclk_table; struct vega20_pcie_table pcie_table; }; #define VEGA20_MAX_LEAKAGE_COUNT 8 struct vega20_leakage_voltage { uint16_t count; uint16_t leakage_id[VEGA20_MAX_LEAKAGE_COUNT]; uint16_t actual_voltage[VEGA20_MAX_LEAKAGE_COUNT]; }; struct vega20_display_timing { uint32_t min_clock_in_sr; uint32_t num_existing_displays; }; struct vega20_dpmlevel_enable_mask { uint32_t uvd_dpm_enable_mask; uint32_t vce_dpm_enable_mask; uint32_t samu_dpm_enable_mask; uint32_t sclk_dpm_enable_mask; uint32_t mclk_dpm_enable_mask; }; struct vega20_vbios_boot_state { uint8_t uc_cooling_id; uint16_t vddc; uint16_t vddci; uint16_t mvddc; uint16_t vdd_gfx; uint32_t gfx_clock; uint32_t mem_clock; uint32_t soc_clock; uint32_t dcef_clock; uint32_t eclock; uint32_t dclock; uint32_t vclock; uint32_t fclock; }; #define DPMTABLE_OD_UPDATE_SCLK 0x00000001 #define DPMTABLE_OD_UPDATE_MCLK 0x00000002 #define DPMTABLE_UPDATE_SCLK 0x00000004 #define DPMTABLE_UPDATE_MCLK 0x00000008 #define DPMTABLE_OD_UPDATE_VDDC 0x00000010 #define DPMTABLE_OD_UPDATE_SCLK_MASK 0x00000020 #define DPMTABLE_OD_UPDATE_MCLK_MASK 0x00000040 // To determine if sclk and mclk are in overdrive state #define SCLK_MASK_OVERDRIVE_ENABLED 0x00000008 #define MCLK_MASK_OVERDRIVE_ENABLED 0x00000010 #define SOCCLK_OVERDRIVE_ENABLED 0x00000020 struct vega20_smc_state_table { uint32_t soc_boot_level; uint32_t gfx_boot_level; uint32_t dcef_boot_level; uint32_t mem_boot_level; uint32_t uvd_boot_level; uint32_t vce_boot_level; uint32_t gfx_max_level; uint32_t mem_max_level; uint8_t vr_hot_gpio; uint8_t ac_dc_gpio; uint8_t therm_out_gpio; uint8_t therm_out_polarity; uint8_t therm_out_mode; PPTable_t pp_table; Watermarks_t water_marks_table; AvfsDebugTable_t avfs_debug_table; AvfsFuseOverride_t avfs_fuse_override_table; SmuMetrics_t smu_metrics; DriverSmuConfig_t driver_smu_config; DpmActivityMonitorCoeffInt_t dpm_activity_monitor_coeffint; OverDriveTable_t overdrive_table; }; struct vega20_mclk_latency_entries { uint32_t frequency; uint32_t latency; }; struct vega20_mclk_latency_table { uint32_t count; struct vega20_mclk_latency_entries entries[MAX_REGULAR_DPM_NUMBER]; }; struct vega20_registry_data { uint64_t disallowed_features; uint8_t ac_dc_switch_gpio_support; uint8_t acg_loop_support; uint8_t clock_stretcher_support; uint8_t db_ramping_support; uint8_t didt_mode; uint8_t didt_support; uint8_t edc_didt_support; uint8_t force_dpm_high; uint8_t fuzzy_fan_control_support; uint8_t mclk_dpm_key_disabled; uint8_t od_state_in_dc_support; uint8_t pcie_lane_override; uint8_t pcie_speed_override; uint32_t pcie_clock_override; uint8_t pcie_dpm_key_disabled; uint8_t dcefclk_dpm_key_disabled; uint8_t prefetcher_dpm_key_disabled; uint8_t quick_transition_support; uint8_t regulator_hot_gpio_support; uint8_t master_deep_sleep_support; uint8_t gfx_clk_deep_sleep_support; uint8_t sclk_deep_sleep_support; uint8_t lclk_deep_sleep_support; uint8_t dce_fclk_deep_sleep_support; uint8_t sclk_dpm_key_disabled; uint8_t sclk_throttle_low_notification; uint8_t skip_baco_hardware; uint8_t socclk_dpm_key_disabled; uint8_t sq_ramping_support; uint8_t tcp_ramping_support; uint8_t td_ramping_support; uint8_t dbr_ramping_support; uint8_t gc_didt_support; uint8_t psm_didt_support; uint8_t thermal_support; uint8_t fw_ctf_enabled; uint8_t led_dpm_enabled; uint8_t fan_control_support; uint8_t ulv_support; uint8_t od8_feature_enable; uint8_t disable_water_mark; uint8_t disable_workload_policy; uint32_t force_workload_policy_mask; uint8_t disable_3d_fs_detection; uint8_t disable_pp_tuning; uint8_t disable_xlpp_tuning; uint32_t perf_ui_tuning_profile_turbo; uint32_t perf_ui_tuning_profile_powerSave; uint32_t perf_ui_tuning_profile_xl; uint16_t zrpm_stop_temp; uint16_t zrpm_start_temp; uint32_t stable_pstate_sclk_dpm_percentage; uint8_t fps_support; uint8_t vr0hot; uint8_t vr1hot; uint8_t disable_auto_wattman; uint32_t auto_wattman_debug; uint32_t auto_wattman_sample_period; uint32_t fclk_gfxclk_ratio; uint8_t auto_wattman_threshold; uint8_t log_avfs_param; uint8_t enable_enginess; uint8_t custom_fan_support; uint8_t disable_pcc_limit_control; uint8_t gfxoff_controlled_by_driver; }; struct vega20_odn_clock_voltage_dependency_table { uint32_t count; struct phm_ppt_v1_clock_voltage_dependency_record entries[MAX_REGULAR_DPM_NUMBER]; }; struct vega20_odn_dpm_table { struct vega20_odn_dpm_control control_gfxclk_state; struct vega20_odn_dpm_control control_memclk_state; struct phm_odn_clock_levels odn_core_clock_dpm_levels; struct phm_odn_clock_levels odn_memory_clock_dpm_levels; struct vega20_odn_clock_voltage_dependency_table vdd_dependency_on_sclk; struct vega20_odn_clock_voltage_dependency_table vdd_dependency_on_mclk; struct vega20_odn_clock_voltage_dependency_table vdd_dependency_on_socclk; uint32_t odn_mclk_min_limit; }; struct vega20_odn_fan_table { uint32_t target_fan_speed; uint32_t target_temperature; uint32_t min_performance_clock; uint32_t min_fan_limit; bool force_fan_pwm; }; struct vega20_odn_temp_table { uint16_t target_operating_temp; uint16_t default_target_operating_temp; uint16_t operating_temp_min_limit; uint16_t operating_temp_max_limit; uint16_t operating_temp_step; }; struct vega20_odn_data { uint32_t apply_overdrive_next_settings_mask; uint32_t overdrive_next_state; uint32_t overdrive_next_capabilities; uint32_t odn_sclk_dpm_enable_mask; uint32_t odn_mclk_dpm_enable_mask; struct vega20_odn_dpm_table odn_dpm_table; struct vega20_odn_fan_table odn_fan_table; struct vega20_odn_temp_table odn_temp_table; }; enum OD8_FEATURE_ID { OD8_GFXCLK_LIMITS = 1 << 0, OD8_GFXCLK_CURVE = 1 << 1, OD8_UCLK_MAX = 1 << 2, OD8_POWER_LIMIT = 1 << 3, OD8_ACOUSTIC_LIMIT_SCLK = 1 << 4, //FanMaximumRpm OD8_FAN_SPEED_MIN = 1 << 5, //FanMinimumPwm OD8_TEMPERATURE_FAN = 1 << 6, //FanTargetTemperature OD8_TEMPERATURE_SYSTEM = 1 << 7, //MaxOpTemp OD8_MEMORY_TIMING_TUNE = 1 << 8, OD8_FAN_ZERO_RPM_CONTROL = 1 << 9 }; enum OD8_SETTING_ID { OD8_SETTING_GFXCLK_FMIN = 0, OD8_SETTING_GFXCLK_FMAX, OD8_SETTING_GFXCLK_FREQ1, OD8_SETTING_GFXCLK_VOLTAGE1, OD8_SETTING_GFXCLK_FREQ2, OD8_SETTING_GFXCLK_VOLTAGE2, OD8_SETTING_GFXCLK_FREQ3, OD8_SETTING_GFXCLK_VOLTAGE3, OD8_SETTING_UCLK_FMAX, OD8_SETTING_POWER_PERCENTAGE, OD8_SETTING_FAN_ACOUSTIC_LIMIT, OD8_SETTING_FAN_MIN_SPEED, OD8_SETTING_FAN_TARGET_TEMP, OD8_SETTING_OPERATING_TEMP_MAX, OD8_SETTING_AC_TIMING, OD8_SETTING_FAN_ZERO_RPM_CONTROL, OD8_SETTING_COUNT }; struct vega20_od8_single_setting { uint32_t feature_id; int32_t min_value; int32_t max_value; int32_t current_value; int32_t default_value; }; struct vega20_od8_settings { uint32_t overdrive8_capabilities; struct vega20_od8_single_setting od8_settings_array[OD8_SETTING_COUNT]; }; struct vega20_hwmgr { struct vega20_dpm_table dpm_table; struct vega20_dpm_table golden_dpm_table; struct vega20_registry_data registry_data; struct vega20_vbios_boot_state vbios_boot_state; struct vega20_mclk_latency_table mclk_latency_table; struct vega20_max_sustainable_clocks max_sustainable_clocks; struct vega20_leakage_voltage vddc_leakage; uint32_t vddc_control; struct pp_atomfwctrl_voltage_table vddc_voltage_table; uint32_t mvdd_control; struct pp_atomfwctrl_voltage_table mvdd_voltage_table; uint32_t vddci_control; struct pp_atomfwctrl_voltage_table vddci_voltage_table; uint32_t active_auto_throttle_sources; struct vega20_bacos bacos; /* ---- General data ---- */ uint8_t need_update_dpm_table; bool cac_enabled; bool battery_state; bool is_tlu_enabled; bool avfs_exist; uint32_t low_sclk_interrupt_threshold; uint32_t total_active_cus; uint32_t water_marks_bitmap; struct vega20_display_timing display_timing; /* ---- Vega20 Dyn Register Settings ---- */ uint32_t debug_settings; uint32_t lowest_uclk_reserved_for_ulv; uint32_t gfxclk_average_alpha; uint32_t socclk_average_alpha; uint32_t uclk_average_alpha; uint32_t gfx_activity_average_alpha; uint32_t display_voltage_mode; uint32_t dcef_clk_quad_eqn_a; uint32_t dcef_clk_quad_eqn_b; uint32_t dcef_clk_quad_eqn_c; uint32_t disp_clk_quad_eqn_a; uint32_t disp_clk_quad_eqn_b; uint32_t disp_clk_quad_eqn_c; uint32_t pixel_clk_quad_eqn_a; uint32_t pixel_clk_quad_eqn_b; uint32_t pixel_clk_quad_eqn_c; uint32_t phy_clk_quad_eqn_a; uint32_t phy_clk_quad_eqn_b; uint32_t phy_clk_quad_eqn_c; /* ---- Thermal Temperature Setting ---- */ struct vega20_dpmlevel_enable_mask dpm_level_enable_mask; /* ---- Power Gating States ---- */ bool uvd_power_gated; bool vce_power_gated; bool samu_power_gated; bool need_long_memory_training; /* Internal settings to apply the application power optimization parameters */ bool apply_optimized_settings; uint32_t disable_dpm_mask; /* ---- Overdrive next setting ---- */ struct vega20_odn_data odn_data; bool gfxclk_overdrive; bool memclk_overdrive; /* ---- Overdrive8 Setting ---- */ struct vega20_od8_settings od8_settings; /* ---- Workload Mask ---- */ uint32_t workload_mask; /* ---- SMU9 ---- */ uint32_t smu_version; struct smu_features smu_features[GNLD_FEATURES_MAX]; struct vega20_smc_state_table smc_state_table; /* ---- Gfxoff ---- */ bool gfxoff_allowed; uint32_t counter_gfxoff; unsigned long metrics_time; SmuMetrics_t metrics_table; bool pcie_parameters_override; uint32_t pcie_gen_level1; uint32_t pcie_width_level1; bool is_custom_profile_set; }; #define VEGA20_DPM2_NEAR_TDP_DEC 10 #define VEGA20_DPM2_ABOVE_SAFE_INC 5 #define VEGA20_DPM2_BELOW_SAFE_INC 20 #define VEGA20_DPM2_LTA_WINDOW_SIZE 7 #define VEGA20_DPM2_LTS_TRUNCATE 0 #define VEGA20_DPM2_TDP_SAFE_LIMIT_PERCENT 80 #define VEGA20_DPM2_MAXPS_PERCENT_M 90 #define VEGA20_DPM2_MAXPS_PERCENT_H 90 #define VEGA20_DPM2_PWREFFICIENCYRATIO_MARGIN 50 #define VEGA20_DPM2_SQ_RAMP_MAX_POWER 0x3FFF #define VEGA20_DPM2_SQ_RAMP_MIN_POWER 0x12 #define VEGA20_DPM2_SQ_RAMP_MAX_POWER_DELTA 0x15 #define VEGA20_DPM2_SQ_RAMP_SHORT_TERM_INTERVAL_SIZE 0x1E #define VEGA20_DPM2_SQ_RAMP_LONG_TERM_INTERVAL_RATIO 0xF #define VEGA20_VOLTAGE_CONTROL_NONE 0x0 #define VEGA20_VOLTAGE_CONTROL_BY_GPIO 0x1 #define VEGA20_VOLTAGE_CONTROL_BY_SVID2 0x2 #define VEGA20_VOLTAGE_CONTROL_MERGED 0x3 /* To convert to Q8.8 format for firmware */ #define VEGA20_Q88_FORMAT_CONVERSION_UNIT 256 #define VEGA20_UNUSED_GPIO_PIN 0x7F #define VEGA20_THERM_OUT_MODE_DISABLE 0x0 #define VEGA20_THERM_OUT_MODE_THERM_ONLY 0x1 #define VEGA20_THERM_OUT_MODE_THERM_VRHOT 0x2 #define PPVEGA20_VEGA20DISPLAYVOLTAGEMODE_DFLT 0xffffffff #define PPREGKEY_VEGA20QUADRATICEQUATION_DFLT 0xffffffff #define PPVEGA20_VEGA20GFXCLKAVERAGEALPHA_DFLT 25 /* 10% * 255 = 25 */ #define PPVEGA20_VEGA20SOCCLKAVERAGEALPHA_DFLT 25 /* 10% * 255 = 25 */ #define PPVEGA20_VEGA20UCLKCLKAVERAGEALPHA_DFLT 25 /* 10% * 255 = 25 */ #define PPVEGA20_VEGA20GFXACTIVITYAVERAGEALPHA_DFLT 25 /* 10% * 255 = 25 */ #define PPVEGA20_VEGA20LOWESTUCLKRESERVEDFORULV_DFLT 0xffffffff #define PPVEGA20_VEGA20DISPLAYVOLTAGEMODE_DFLT 0xffffffff #define PPREGKEY_VEGA20QUADRATICEQUATION_DFLT 0xffffffff #define VEGA20_UMD_PSTATE_GFXCLK_LEVEL 0x3 #define VEGA20_UMD_PSTATE_SOCCLK_LEVEL 0x3 #define VEGA20_UMD_PSTATE_MCLK_LEVEL 0x2 #define VEGA20_UMD_PSTATE_UVDCLK_LEVEL 0x3 #define VEGA20_UMD_PSTATE_VCEMCLK_LEVEL 0x3 #endif /* _VEGA20_HWMGR_H_ */
{ "pile_set_name": "Github" }
/* * Copyright (c) 2009-2016 Petri Lehtinen <petri@digip.org> * * Jansson is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. */ #include <jansson.h> #include "util.h" static void test_misc(void) { json_t *array, *five, *seven, *value; size_t i; array = json_array(); five = json_integer(5); seven = json_integer(7); if(!array) fail("unable to create array"); if(!five || !seven) fail("unable to create integer"); if(json_array_size(array) != 0) fail("empty array has nonzero size"); if(!json_array_append(array, NULL)) fail("able to append NULL"); if(json_array_append(array, five)) fail("unable to append"); if(json_array_size(array) != 1) fail("wrong array size"); value = json_array_get(array, 0); if(!value) fail("unable to get item"); if(value != five) fail("got wrong value"); if(json_array_append(array, seven)) fail("unable to append value"); if(json_array_size(array) != 2) fail("wrong array size"); value = json_array_get(array, 1); if(!value) fail("unable to get item"); if(value != seven) fail("got wrong value"); if(json_array_set(array, 0, seven)) fail("unable to set value"); if(!json_array_set(array, 0, NULL)) fail("able to set NULL"); if(json_array_size(array) != 2) fail("wrong array size"); value = json_array_get(array, 0); if(!value) fail("unable to get item"); if(value != seven) fail("got wrong value"); if(json_array_get(array, 2) != NULL) fail("able to get value out of bounds"); if(!json_array_set(array, 2, seven)) fail("able to set value out of bounds"); for(i = 2; i < 30; i++) { if(json_array_append(array, seven)) fail("unable to append value"); if(json_array_size(array) != i + 1) fail("wrong array size"); } for(i = 0; i < 30; i++) { value = json_array_get(array, i); if(!value) fail("unable to get item"); if(value != seven) fail("got wrong value"); } if(json_array_set_new(array, 15, json_integer(123))) fail("unable to set new value"); value = json_array_get(array, 15); if(!json_is_integer(value) || json_integer_value(value) != 123) fail("json_array_set_new works incorrectly"); if(!json_array_set_new(array, 15, NULL)) fail("able to set_new NULL value"); if(json_array_append_new(array, json_integer(321))) fail("unable to append new value"); value = json_array_get(array, json_array_size(array) - 1); if(!json_is_integer(value) || json_integer_value(value) != 321) fail("json_array_append_new works incorrectly"); if(!json_array_append_new(array, NULL)) fail("able to append_new NULL value"); json_decref(five); json_decref(seven); json_decref(array); } static void test_insert(void) { json_t *array, *five, *seven, *eleven, *value; int i; array = json_array(); five = json_integer(5); seven = json_integer(7); eleven = json_integer(11); if(!array) fail("unable to create array"); if(!five || !seven || !eleven) fail("unable to create integer"); if(!json_array_insert(array, 1, five)) fail("able to insert value out of bounds"); if(json_array_insert(array, 0, five)) fail("unable to insert value in an empty array"); if(json_array_get(array, 0) != five) fail("json_array_insert works incorrectly"); if(json_array_size(array) != 1) fail("array size is invalid after insertion"); if(json_array_insert(array, 1, seven)) fail("unable to insert value at the end of an array"); if(json_array_get(array, 0) != five) fail("json_array_insert works incorrectly"); if(json_array_get(array, 1) != seven) fail("json_array_insert works incorrectly"); if(json_array_size(array) != 2) fail("array size is invalid after insertion"); if(json_array_insert(array, 1, eleven)) fail("unable to insert value in the middle of an array"); if(json_array_get(array, 0) != five) fail("json_array_insert works incorrectly"); if(json_array_get(array, 1) != eleven) fail("json_array_insert works incorrectly"); if(json_array_get(array, 2) != seven) fail("json_array_insert works incorrectly"); if(json_array_size(array) != 3) fail("array size is invalid after insertion"); if(json_array_insert_new(array, 2, json_integer(123))) fail("unable to insert value in the middle of an array"); value = json_array_get(array, 2); if(!json_is_integer(value) || json_integer_value(value) != 123) fail("json_array_insert_new works incorrectly"); if(json_array_size(array) != 4) fail("array size is invalid after insertion"); for(i = 0; i < 20; i++) { if(json_array_insert(array, 0, seven)) fail("unable to insert value at the begining of an array"); } for(i = 0; i < 20; i++) { if(json_array_get(array, i) != seven) fail("json_aray_insert works incorrectly"); } if(json_array_size(array) != 24) fail("array size is invalid after loop insertion"); json_decref(five); json_decref(seven); json_decref(eleven); json_decref(array); } static void test_remove(void) { json_t *array, *five, *seven; int i; array = json_array(); five = json_integer(5); seven = json_integer(7); if(!array) fail("unable to create array"); if(!five) fail("unable to create integer"); if(!seven) fail("unable to create integer"); if(!json_array_remove(array, 0)) fail("able to remove an unexisting index"); if(json_array_append(array, five)) fail("unable to append"); if(!json_array_remove(array, 1)) fail("able to remove an unexisting index"); if(json_array_remove(array, 0)) fail("unable to remove"); if(json_array_size(array) != 0) fail("array size is invalid after removing"); if(json_array_append(array, five) || json_array_append(array, seven) || json_array_append(array, five) || json_array_append(array, seven)) fail("unable to append"); if(json_array_remove(array, 2)) fail("unable to remove"); if(json_array_size(array) != 3) fail("array size is invalid after removing"); if(json_array_get(array, 0) != five || json_array_get(array, 1) != seven || json_array_get(array, 2) != seven) fail("remove works incorrectly"); json_decref(array); array = json_array(); for(i = 0; i < 4; i++) { json_array_append(array, five); json_array_append(array, seven); } if(json_array_size(array) != 8) fail("unable to append 8 items to array"); /* Remove an element from a "full" array. */ json_array_remove(array, 5); json_decref(five); json_decref(seven); json_decref(array); } static void test_clear(void) { json_t *array, *five, *seven; int i; array = json_array(); five = json_integer(5); seven = json_integer(7); if(!array) fail("unable to create array"); if(!five || !seven) fail("unable to create integer"); for(i = 0; i < 10; i++) { if(json_array_append(array, five)) fail("unable to append"); } for(i = 0; i < 10; i++) { if(json_array_append(array, seven)) fail("unable to append"); } if(json_array_size(array) != 20) fail("array size is invalid after appending"); if(json_array_clear(array)) fail("unable to clear"); if(json_array_size(array) != 0) fail("array size is invalid after clearing"); json_decref(five); json_decref(seven); json_decref(array); } static void test_extend(void) { json_t *array1, *array2, *five, *seven; int i; array1 = json_array(); array2 = json_array(); five = json_integer(5); seven = json_integer(7); if(!array1 || !array2) fail("unable to create array"); if(!five || !seven) fail("unable to create integer"); for(i = 0; i < 10; i++) { if(json_array_append(array1, five)) fail("unable to append"); } for(i = 0; i < 10; i++) { if(json_array_append(array2, seven)) fail("unable to append"); } if(json_array_size(array1) != 10 || json_array_size(array2) != 10) fail("array size is invalid after appending"); if(json_array_extend(array1, array2)) fail("unable to extend"); for(i = 0; i < 10; i++) { if(json_array_get(array1, i) != five) fail("invalid array contents after extending"); } for(i = 10; i < 20; i++) { if(json_array_get(array1, i) != seven) fail("invalid array contents after extending"); } json_decref(five); json_decref(seven); json_decref(array1); json_decref(array2); } static void test_circular() { json_t *array1, *array2; /* the simple cases are checked */ array1 = json_array(); if(!array1) fail("unable to create array"); if(json_array_append(array1, array1) == 0) fail("able to append self"); if(json_array_insert(array1, 0, array1) == 0) fail("able to insert self"); if(json_array_append_new(array1, json_true())) fail("failed to append true"); if(json_array_set(array1, 0, array1) == 0) fail("able to set self"); json_decref(array1); /* create circular references */ array1 = json_array(); array2 = json_array(); if(!array1 || !array2) fail("unable to create array"); if(json_array_append(array1, array2) || json_array_append(array2, array1)) fail("unable to append"); /* circularity is detected when dumping */ if(json_dumps(array1, 0) != NULL) fail("able to dump circulars"); /* decref twice to deal with the circular references */ json_decref(array1); json_decref(array2); json_decref(array1); } static void test_array_foreach() { size_t index; json_t *array1, *array2, *value; array1 = json_pack("[sisisi]", "foo", 1, "bar", 2, "baz", 3); array2 = json_array(); json_array_foreach(array1, index, value) { json_array_append(array2, value); } if(!json_equal(array1, array2)) fail("json_array_foreach failed to iterate all elements"); json_decref(array1); json_decref(array2); } static void run_tests() { test_misc(); test_insert(); test_remove(); test_clear(); test_extend(); test_circular(); test_array_foreach(); }
{ "pile_set_name": "Github" }
// Copyright 2016 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 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le riscv64 package unix const isBigEndian = false
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportHeight="24.0" android:viewportWidth="24.0"> <path android:fillColor="#ffb701" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,5c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM12,19.2c-2.5,0 -4.71,-1.28 -6,-3.22 0.03,-1.99 4,-3.08 6,-3.08 1.99,0 5.97,1.09 6,3.08 -1.29,1.94 -3.5,3.22 -6,3.22z" /> </vector>
{ "pile_set_name": "Github" }
/* sc520cdp.c -- MTD map driver for AMD SC520 Customer Development Platform * * Copyright (C) 2001 Sysgo Real-Time Solutions GmbH * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * * The SC520CDP is an evaluation board for the Elan SC520 processor available * from AMD. It has two banks of 32-bit Flash ROM, each 8 Megabytes in size, * and up to 512 KiB of 8-bit DIL Flash ROM. * For details see http://www.amd.com/products/epd/desiging/evalboards/18.elansc520/520_cdp_brief/index.html */ #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> #include <asm/io.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/concat.h> /* ** The Embedded Systems BIOS decodes the first FLASH starting at ** 0x8400000. This is a *terrible* place for it because accessing ** the flash at this location causes the A22 address line to be high ** (that's what 0x8400000 binary's ought to be). But this is the highest ** order address line on the raw flash devices themselves!! ** This causes the top HALF of the flash to be accessed first. Beyond ** the physical limits of the flash, the flash chip aliases over (to ** 0x880000 which causes the bottom half to be accessed. This splits the ** flash into two and inverts it! If you then try to access this from another ** program that does NOT do this insanity, then you *will* access the ** first half of the flash, but not find what you expect there. That ** stuff is in the *second* half! Similarly, the address used by the ** BIOS for the second FLASH bank is also quite a bad choice. ** If REPROGRAM_PAR is defined below (the default), then this driver will ** choose more useful addresses for the FLASH banks by reprogramming the ** responsible PARxx registers in the SC520's MMCR region. This will ** cause the settings to be incompatible with the BIOS's settings, which ** shouldn't be a problem since you are running Linux, (i.e. the BIOS is ** not much use anyway). However, if you need to be compatible with ** the BIOS for some reason, just undefine REPROGRAM_PAR. */ #define REPROGRAM_PAR #ifdef REPROGRAM_PAR /* These are the addresses we want.. */ #define WINDOW_ADDR_0 0x08800000 #define WINDOW_ADDR_1 0x09000000 #define WINDOW_ADDR_2 0x09800000 /* .. and these are the addresses the BIOS gives us */ #define WINDOW_ADDR_0_BIOS 0x08400000 #define WINDOW_ADDR_1_BIOS 0x08c00000 #define WINDOW_ADDR_2_BIOS 0x09400000 #else #define WINDOW_ADDR_0 0x08400000 #define WINDOW_ADDR_1 0x08C00000 #define WINDOW_ADDR_2 0x09400000 #endif #define WINDOW_SIZE_0 0x00800000 #define WINDOW_SIZE_1 0x00800000 #define WINDOW_SIZE_2 0x00080000 static struct map_info sc520cdp_map[] = { { .name = "SC520CDP Flash Bank #0", .size = WINDOW_SIZE_0, .bankwidth = 4, .phys = WINDOW_ADDR_0 }, { .name = "SC520CDP Flash Bank #1", .size = WINDOW_SIZE_1, .bankwidth = 4, .phys = WINDOW_ADDR_1 }, { .name = "SC520CDP DIL Flash", .size = WINDOW_SIZE_2, .bankwidth = 1, .phys = WINDOW_ADDR_2 }, }; #define NUM_FLASH_BANKS ARRAY_SIZE(sc520cdp_map) static struct mtd_info *mymtd[NUM_FLASH_BANKS]; static struct mtd_info *merged_mtd; #ifdef REPROGRAM_PAR /* ** The SC520 MMCR (memory mapped control register) region resides ** at 0xFFFEF000. The 16 Programmable Address Region (PAR) registers ** are at offset 0x88 in the MMCR: */ #define SC520_MMCR_BASE 0xFFFEF000 #define SC520_MMCR_EXTENT 0x1000 #define SC520_PAR(x) ((0x88/sizeof(unsigned long)) + (x)) #define NUM_SC520_PAR 16 /* total number of PAR registers */ /* ** The highest three bits in a PAR register determine what target ** device is controlled by this PAR. Here, only ROMCS? and BOOTCS ** devices are of interest. */ #define SC520_PAR_BOOTCS (0x4<<29) #define SC520_PAR_ROMCS0 (0x5<<29) #define SC520_PAR_ROMCS1 (0x6<<29) #define SC520_PAR_TRGDEV (0x7<<29) /* ** Bits 28 thru 26 determine some attributes for the ** region controlled by the PAR. (We only use non-cacheable) */ #define SC520_PAR_WRPROT (1<<26) /* write protected */ #define SC520_PAR_NOCACHE (1<<27) /* non-cacheable */ #define SC520_PAR_NOEXEC (1<<28) /* code execution denied */ /* ** Bit 25 determines the granularity: 4K or 64K */ #define SC520_PAR_PG_SIZ4 (0<<25) #define SC520_PAR_PG_SIZ64 (1<<25) /* ** Build a value to be written into a PAR register. ** We only need ROM entries, 64K page size: */ #define SC520_PAR_ENTRY(trgdev, address, size) \ ((trgdev) | SC520_PAR_NOCACHE | SC520_PAR_PG_SIZ64 | \ (address) >> 16 | (((size) >> 16) - 1) << 14) struct sc520_par_table { unsigned long trgdev; unsigned long new_par; unsigned long default_address; }; static const struct sc520_par_table par_table[NUM_FLASH_BANKS] = { { /* Flash Bank #0: selected by ROMCS0 */ SC520_PAR_ROMCS0, SC520_PAR_ENTRY(SC520_PAR_ROMCS0, WINDOW_ADDR_0, WINDOW_SIZE_0), WINDOW_ADDR_0_BIOS }, { /* Flash Bank #1: selected by ROMCS1 */ SC520_PAR_ROMCS1, SC520_PAR_ENTRY(SC520_PAR_ROMCS1, WINDOW_ADDR_1, WINDOW_SIZE_1), WINDOW_ADDR_1_BIOS }, { /* DIL (BIOS) Flash: selected by BOOTCS */ SC520_PAR_BOOTCS, SC520_PAR_ENTRY(SC520_PAR_BOOTCS, WINDOW_ADDR_2, WINDOW_SIZE_2), WINDOW_ADDR_2_BIOS } }; static void sc520cdp_setup_par(void) { unsigned long __iomem *mmcr; unsigned long mmcr_val; int i, j; /* map in SC520's MMCR area */ mmcr = ioremap_nocache(SC520_MMCR_BASE, SC520_MMCR_EXTENT); if(!mmcr) { /* ioremap_nocache failed: skip the PAR reprogramming */ /* force physical address fields to BIOS defaults: */ for(i = 0; i < NUM_FLASH_BANKS; i++) sc520cdp_map[i].phys = par_table[i].default_address; return; } /* ** Find the PARxx registers that are responsible for activating ** ROMCS0, ROMCS1 and BOOTCS. Reprogram each of these with a ** new value from the table. */ for(i = 0; i < NUM_FLASH_BANKS; i++) { /* for each par_table entry */ for(j = 0; j < NUM_SC520_PAR; j++) { /* for each PAR register */ mmcr_val = readl(&mmcr[SC520_PAR(j)]); /* if target device field matches, reprogram the PAR */ if((mmcr_val & SC520_PAR_TRGDEV) == par_table[i].trgdev) { writel(par_table[i].new_par, &mmcr[SC520_PAR(j)]); break; } } if(j == NUM_SC520_PAR) { /* no matching PAR found: try default BIOS address */ printk(KERN_NOTICE "Could not find PAR responsible for %s\n", sc520cdp_map[i].name); printk(KERN_NOTICE "Trying default address 0x%lx\n", par_table[i].default_address); sc520cdp_map[i].phys = par_table[i].default_address; } } iounmap(mmcr); } #endif static int __init init_sc520cdp(void) { int i, devices_found = 0; #ifdef REPROGRAM_PAR /* reprogram PAR registers so flash appears at the desired addresses */ sc520cdp_setup_par(); #endif for (i = 0; i < NUM_FLASH_BANKS; i++) { printk(KERN_NOTICE "SC520 CDP flash device: 0x%Lx at 0x%Lx\n", (unsigned long long)sc520cdp_map[i].size, (unsigned long long)sc520cdp_map[i].phys); sc520cdp_map[i].virt = ioremap_nocache(sc520cdp_map[i].phys, sc520cdp_map[i].size); if (!sc520cdp_map[i].virt) { printk("Failed to ioremap_nocache\n"); return -EIO; } simple_map_init(&sc520cdp_map[i]); mymtd[i] = do_map_probe("cfi_probe", &sc520cdp_map[i]); if(!mymtd[i]) mymtd[i] = do_map_probe("jedec_probe", &sc520cdp_map[i]); if(!mymtd[i]) mymtd[i] = do_map_probe("map_rom", &sc520cdp_map[i]); if (mymtd[i]) { mymtd[i]->owner = THIS_MODULE; ++devices_found; } else { iounmap(sc520cdp_map[i].virt); } } if(devices_found >= 2) { /* Combine the two flash banks into a single MTD device & register it: */ merged_mtd = mtd_concat_create(mymtd, 2, "SC520CDP Flash Banks #0 and #1"); if(merged_mtd) mtd_device_register(merged_mtd, NULL, 0); } if(devices_found == 3) /* register the third (DIL-Flash) device */ mtd_device_register(mymtd[2], NULL, 0); return(devices_found ? 0 : -ENXIO); } static void __exit cleanup_sc520cdp(void) { int i; if (merged_mtd) { mtd_device_unregister(merged_mtd); mtd_concat_destroy(merged_mtd); } if (mymtd[2]) mtd_device_unregister(mymtd[2]); for (i = 0; i < NUM_FLASH_BANKS; i++) { if (mymtd[i]) map_destroy(mymtd[i]); if (sc520cdp_map[i].virt) { iounmap(sc520cdp_map[i].virt); sc520cdp_map[i].virt = NULL; } } } module_init(init_sc520cdp); module_exit(cleanup_sc520cdp); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Sysgo Real-Time Solutions GmbH"); MODULE_DESCRIPTION("MTD map driver for AMD SC520 Customer Development Platform");
{ "pile_set_name": "Github" }
// Copyright 2016 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef HIGHWAYHASH_VECTOR256_H_ #define HIGHWAYHASH_VECTOR256_H_ // Defines SIMD vector classes ("V4x64U") with overloaded arithmetic operators: // const V4x64U masked_sum = (a + b) & m; // This is shorter and more readable than compiler intrinsics: // const __m256i masked_sum = _mm256_and_si256(_mm256_add_epi64(a, b), m); // There is typically no runtime cost for these abstractions. // // The naming convention is VNxBBT where N is the number of lanes, BB the // number of bits per lane and T is the lane type: unsigned integer (U), // signed integer (I), or floating-point (F). // WARNING: this is a "restricted" header because it is included from // translation units compiled with different flags. This header and its // dependencies must not define any function unless it is static inline and/or // within namespace HH_TARGET_NAME. See arch_specific.h for details. #include <stddef.h> #include <stdint.h> #include "highwayhash/arch_specific.h" #include "highwayhash/compiler_specific.h" // For auto-dependency generation, we need to include all headers but not their // contents (otherwise compilation fails because -mavx2 is not specified). #ifndef HH_DISABLE_TARGET_SPECIFIC // (This include cannot be moved within a namespace due to conflicts with // other system headers; see the comment in hh_sse41.h.) #include <immintrin.h> namespace highwayhash { // To prevent ODR violations when including this from multiple translation // units (TU) that are compiled with different flags, the contents must reside // in a namespace whose name is unique to the TU. NOTE: this behavior is // incompatible with precompiled modules and requires textual inclusion instead. namespace HH_TARGET_NAME { // Primary template for 256-bit AVX2 vectors; only specializations are used. template <typename T> class V256 {}; template <> class V256<uint8_t> { public: using Intrinsic = __m256i; using T = uint8_t; static constexpr size_t N = 32; // Leaves v_ uninitialized - typically used for output parameters. HH_INLINE V256() {} // Broadcasts i to all lanes. HH_INLINE explicit V256(T i) : v_(_mm256_broadcastb_epi8(_mm_cvtsi32_si128(i))) {} // Copy from other vector. HH_INLINE explicit V256(const V256& other) : v_(other.v_) {} template <typename U> HH_INLINE explicit V256(const V256<U>& other) : v_(other) {} HH_INLINE V256& operator=(const V256& other) { v_ = other.v_; return *this; } // Convert from/to intrinsics. HH_INLINE V256(const Intrinsic& v) : v_(v) {} HH_INLINE V256& operator=(const Intrinsic& v) { v_ = v; return *this; } HH_INLINE operator Intrinsic() const { return v_; } // There are no greater-than comparison instructions for unsigned T. HH_INLINE V256 operator==(const V256& other) const { return V256(_mm256_cmpeq_epi8(v_, other.v_)); } HH_INLINE V256& operator+=(const V256& other) { v_ = _mm256_add_epi8(v_, other.v_); return *this; } HH_INLINE V256& operator-=(const V256& other) { v_ = _mm256_sub_epi8(v_, other.v_); return *this; } HH_INLINE V256& operator&=(const V256& other) { v_ = _mm256_and_si256(v_, other.v_); return *this; } HH_INLINE V256& operator|=(const V256& other) { v_ = _mm256_or_si256(v_, other.v_); return *this; } HH_INLINE V256& operator^=(const V256& other) { v_ = _mm256_xor_si256(v_, other.v_); return *this; } private: Intrinsic v_; }; template <> class V256<uint16_t> { public: using Intrinsic = __m256i; using T = uint16_t; static constexpr size_t N = 16; // Leaves v_ uninitialized - typically used for output parameters. HH_INLINE V256() {} // Lane 0 (p_0) is the lowest. HH_INLINE V256(T p_F, T p_E, T p_D, T p_C, T p_B, T p_A, T p_9, T p_8, T p_7, T p_6, T p_5, T p_4, T p_3, T p_2, T p_1, T p_0) : v_(_mm256_set_epi16(p_F, p_E, p_D, p_C, p_B, p_A, p_9, p_8, p_7, p_6, p_5, p_4, p_3, p_2, p_1, p_0)) {} // Broadcasts i to all lanes. HH_INLINE explicit V256(T i) : v_(_mm256_broadcastw_epi16(_mm_cvtsi32_si128(i))) {} // Copy from other vector. HH_INLINE explicit V256(const V256& other) : v_(other.v_) {} template <typename U> HH_INLINE explicit V256(const V256<U>& other) : v_(other) {} HH_INLINE V256& operator=(const V256& other) { v_ = other.v_; return *this; } // Convert from/to intrinsics. HH_INLINE V256(const Intrinsic& v) : v_(v) {} HH_INLINE V256& operator=(const Intrinsic& v) { v_ = v; return *this; } HH_INLINE operator Intrinsic() const { return v_; } // There are no greater-than comparison instructions for unsigned T. HH_INLINE V256 operator==(const V256& other) const { return V256(_mm256_cmpeq_epi16(v_, other.v_)); } HH_INLINE V256& operator+=(const V256& other) { v_ = _mm256_add_epi16(v_, other.v_); return *this; } HH_INLINE V256& operator-=(const V256& other) { v_ = _mm256_sub_epi16(v_, other.v_); return *this; } HH_INLINE V256& operator&=(const V256& other) { v_ = _mm256_and_si256(v_, other.v_); return *this; } HH_INLINE V256& operator|=(const V256& other) { v_ = _mm256_or_si256(v_, other.v_); return *this; } HH_INLINE V256& operator^=(const V256& other) { v_ = _mm256_xor_si256(v_, other.v_); return *this; } HH_INLINE V256& operator<<=(const int count) { v_ = _mm256_slli_epi16(v_, count); return *this; } HH_INLINE V256& operator>>=(const int count) { v_ = _mm256_srli_epi16(v_, count); return *this; } private: Intrinsic v_; }; template <> class V256<uint32_t> { public: using Intrinsic = __m256i; using T = uint32_t; static constexpr size_t N = 8; // Leaves v_ uninitialized - typically used for output parameters. HH_INLINE V256() {} // Lane 0 (p_0) is the lowest. HH_INLINE V256(T p_7, T p_6, T p_5, T p_4, T p_3, T p_2, T p_1, T p_0) : v_(_mm256_set_epi32(p_7, p_6, p_5, p_4, p_3, p_2, p_1, p_0)) {} // Broadcasts i to all lanes. HH_INLINE explicit V256(T i) : v_(_mm256_broadcastd_epi32(_mm_cvtsi32_si128(i))) {} // Copy from other vector. HH_INLINE explicit V256(const V256& other) : v_(other.v_) {} template <typename U> HH_INLINE explicit V256(const V256<U>& other) : v_(other) {} HH_INLINE V256& operator=(const V256& other) { v_ = other.v_; return *this; } // Convert from/to intrinsics. HH_INLINE V256(const Intrinsic& v) : v_(v) {} HH_INLINE V256& operator=(const Intrinsic& v) { v_ = v; return *this; } HH_INLINE operator Intrinsic() const { return v_; } // There are no greater-than comparison instructions for unsigned T. HH_INLINE V256 operator==(const V256& other) const { return V256(_mm256_cmpeq_epi32(v_, other.v_)); } HH_INLINE V256& operator+=(const V256& other) { v_ = _mm256_add_epi32(v_, other.v_); return *this; } HH_INLINE V256& operator-=(const V256& other) { v_ = _mm256_sub_epi32(v_, other.v_); return *this; } HH_INLINE V256& operator&=(const V256& other) { v_ = _mm256_and_si256(v_, other.v_); return *this; } HH_INLINE V256& operator|=(const V256& other) { v_ = _mm256_or_si256(v_, other.v_); return *this; } HH_INLINE V256& operator^=(const V256& other) { v_ = _mm256_xor_si256(v_, other.v_); return *this; } HH_INLINE V256& operator<<=(const int count) { v_ = _mm256_slli_epi32(v_, count); return *this; } HH_INLINE V256& operator>>=(const int count) { v_ = _mm256_srli_epi32(v_, count); return *this; } private: Intrinsic v_; }; template <> class V256<uint64_t> { public: using Intrinsic = __m256i; using T = uint64_t; static constexpr size_t N = 4; // Leaves v_ uninitialized - typically used for output parameters. HH_INLINE V256() {} // Lane 0 (p_0) is the lowest. HH_INLINE V256(T p_3, T p_2, T p_1, T p_0) : v_(_mm256_set_epi64x(p_3, p_2, p_1, p_0)) {} // Broadcasts i to all lanes. HH_INLINE explicit V256(T i) : v_(_mm256_broadcastq_epi64(_mm_cvtsi64_si128(i))) {} // Copy from other vector. HH_INLINE explicit V256(const V256& other) : v_(other.v_) {} template <typename U> HH_INLINE explicit V256(const V256<U>& other) : v_(other) {} HH_INLINE V256& operator=(const V256& other) { v_ = other.v_; return *this; } // Convert from/to intrinsics. HH_INLINE V256(const Intrinsic& v) : v_(v) {} HH_INLINE V256& operator=(const Intrinsic& v) { v_ = v; return *this; } HH_INLINE operator Intrinsic() const { return v_; } // There are no greater-than comparison instructions for unsigned T. HH_INLINE V256 operator==(const V256& other) const { return V256(_mm256_cmpeq_epi64(v_, other.v_)); } HH_INLINE V256& operator+=(const V256& other) { v_ = _mm256_add_epi64(v_, other.v_); return *this; } HH_INLINE V256& operator-=(const V256& other) { v_ = _mm256_sub_epi64(v_, other.v_); return *this; } HH_INLINE V256& operator&=(const V256& other) { v_ = _mm256_and_si256(v_, other.v_); return *this; } HH_INLINE V256& operator|=(const V256& other) { v_ = _mm256_or_si256(v_, other.v_); return *this; } HH_INLINE V256& operator^=(const V256& other) { v_ = _mm256_xor_si256(v_, other.v_); return *this; } HH_INLINE V256& operator<<=(const int count) { v_ = _mm256_slli_epi64(v_, count); return *this; } HH_INLINE V256& operator>>=(const int count) { v_ = _mm256_srli_epi64(v_, count); return *this; } private: Intrinsic v_; }; template <> class V256<float> { public: using Intrinsic = __m256; using T = float; static constexpr size_t N = 8; // Leaves v_ uninitialized - typically used for output parameters. HH_INLINE V256() {} // Lane 0 (p_0) is the lowest. HH_INLINE V256(T p_7, T p_6, T p_5, T p_4, T p_3, T p_2, T p_1, T p_0) : v_(_mm256_set_ps(p_7, p_6, p_5, p_4, p_3, p_2, p_1, p_0)) {} // Broadcasts to all lanes. HH_INLINE explicit V256(T f) : v_(_mm256_set1_ps(f)) {} // Copy from other vector. HH_INLINE explicit V256(const V256& other) : v_(other.v_) {} template <typename U> HH_INLINE explicit V256(const V256<U>& other) : v_(other) {} HH_INLINE V256& operator=(const V256& other) { v_ = other.v_; return *this; } // Convert from/to intrinsics. HH_INLINE V256(const Intrinsic& v) : v_(v) {} HH_INLINE V256& operator=(const Intrinsic& v) { v_ = v; return *this; } HH_INLINE operator Intrinsic() const { return v_; } HH_INLINE V256 operator==(const V256& other) const { return V256(_mm256_cmp_ps(v_, other.v_, 0)); } HH_INLINE V256 operator<(const V256& other) const { return V256(_mm256_cmp_ps(v_, other.v_, 1)); } HH_INLINE V256 operator>(const V256& other) const { return V256(_mm256_cmp_ps(other.v_, v_, 1)); } HH_INLINE V256& operator*=(const V256& other) { v_ = _mm256_mul_ps(v_, other.v_); return *this; } HH_INLINE V256& operator/=(const V256& other) { v_ = _mm256_div_ps(v_, other.v_); return *this; } HH_INLINE V256& operator+=(const V256& other) { v_ = _mm256_add_ps(v_, other.v_); return *this; } HH_INLINE V256& operator-=(const V256& other) { v_ = _mm256_sub_ps(v_, other.v_); return *this; } HH_INLINE V256& operator&=(const V256& other) { v_ = _mm256_and_ps(v_, other.v_); return *this; } HH_INLINE V256& operator|=(const V256& other) { v_ = _mm256_or_ps(v_, other.v_); return *this; } HH_INLINE V256& operator^=(const V256& other) { v_ = _mm256_xor_ps(v_, other.v_); return *this; } private: Intrinsic v_; }; template <> class V256<double> { public: using Intrinsic = __m256d; using T = double; static constexpr size_t N = 4; // Leaves v_ uninitialized - typically used for output parameters. HH_INLINE V256() {} // Lane 0 (p_0) is the lowest. HH_INLINE V256(T p_3, T p_2, T p_1, T p_0) : v_(_mm256_set_pd(p_3, p_2, p_1, p_0)) {} // Broadcasts to all lanes. HH_INLINE explicit V256(T f) : v_(_mm256_set1_pd(f)) {} // Copy from other vector. HH_INLINE explicit V256(const V256& other) : v_(other.v_) {} template <typename U> HH_INLINE explicit V256(const V256<U>& other) : v_(other) {} HH_INLINE V256& operator=(const V256& other) { v_ = other.v_; return *this; } // Convert from/to intrinsics. HH_INLINE V256(const Intrinsic& v) : v_(v) {} HH_INLINE V256& operator=(const Intrinsic& v) { v_ = v; return *this; } HH_INLINE operator Intrinsic() const { return v_; } HH_INLINE V256 operator==(const V256& other) const { return V256(_mm256_cmp_pd(v_, other.v_, 0)); } HH_INLINE V256 operator<(const V256& other) const { return V256(_mm256_cmp_pd(v_, other.v_, 1)); } HH_INLINE V256 operator>(const V256& other) const { return V256(_mm256_cmp_pd(other.v_, v_, 1)); } HH_INLINE V256& operator*=(const V256& other) { v_ = _mm256_mul_pd(v_, other.v_); return *this; } HH_INLINE V256& operator/=(const V256& other) { v_ = _mm256_div_pd(v_, other.v_); return *this; } HH_INLINE V256& operator+=(const V256& other) { v_ = _mm256_add_pd(v_, other.v_); return *this; } HH_INLINE V256& operator-=(const V256& other) { v_ = _mm256_sub_pd(v_, other.v_); return *this; } HH_INLINE V256& operator&=(const V256& other) { v_ = _mm256_and_pd(v_, other.v_); return *this; } HH_INLINE V256& operator|=(const V256& other) { v_ = _mm256_or_pd(v_, other.v_); return *this; } HH_INLINE V256& operator^=(const V256& other) { v_ = _mm256_xor_pd(v_, other.v_); return *this; } private: Intrinsic v_; }; // Nonmember functions for any V256 via member functions. template <typename T> HH_INLINE V256<T> operator*(const V256<T>& left, const V256<T>& right) { V256<T> t(left); return t *= right; } template <typename T> HH_INLINE V256<T> operator/(const V256<T>& left, const V256<T>& right) { V256<T> t(left); return t /= right; } template <typename T> HH_INLINE V256<T> operator+(const V256<T>& left, const V256<T>& right) { V256<T> t(left); return t += right; } template <typename T> HH_INLINE V256<T> operator-(const V256<T>& left, const V256<T>& right) { V256<T> t(left); return t -= right; } template <typename T> HH_INLINE V256<T> operator&(const V256<T>& left, const V256<T>& right) { V256<T> t(left); return t &= right; } template <typename T> HH_INLINE V256<T> operator|(const V256<T> left, const V256<T>& right) { V256<T> t(left); return t |= right; } template <typename T> HH_INLINE V256<T> operator^(const V256<T>& left, const V256<T>& right) { V256<T> t(left); return t ^= right; } template <typename T> HH_INLINE V256<T> operator<<(const V256<T>& v, const int count) { V256<T> t(v); return t <<= count; } template <typename T> HH_INLINE V256<T> operator>>(const V256<T>& v, const int count) { V256<T> t(v); return t >>= count; } // We do not provide operator<<(V, __m128i) because it has 4 cycle latency // (to broadcast the shift count). It is faster to use sllv_epi64 etc. instead. using V32x8U = V256<uint8_t>; using V16x16U = V256<uint16_t>; using V8x32U = V256<uint32_t>; using V4x64U = V256<uint64_t>; using V8x32F = V256<float>; using V4x64F = V256<double>; // Load/Store for any V256. // We differentiate between targets' vector types via template specialization. // Calling Load<V>(floats) is more natural than Load(V8x32F(), floats) and may // generate better code in unoptimized builds. Only declare the primary // templates to avoid needing mutual exclusion with vector128. template <class V> HH_INLINE V Load(const typename V::T* const HH_RESTRICT from); template <class V> HH_INLINE V LoadUnaligned(const typename V::T* const HH_RESTRICT from); template <> HH_INLINE V32x8U Load(const V32x8U::T* const HH_RESTRICT from) { const __m256i* const HH_RESTRICT p = reinterpret_cast<const __m256i*>(from); return V32x8U(_mm256_load_si256(p)); } template <> HH_INLINE V16x16U Load(const V16x16U::T* const HH_RESTRICT from) { const __m256i* const HH_RESTRICT p = reinterpret_cast<const __m256i*>(from); return V16x16U(_mm256_load_si256(p)); } template <> HH_INLINE V8x32U Load(const V8x32U::T* const HH_RESTRICT from) { const __m256i* const HH_RESTRICT p = reinterpret_cast<const __m256i*>(from); return V8x32U(_mm256_load_si256(p)); } template <> HH_INLINE V4x64U Load(const V4x64U::T* const HH_RESTRICT from) { const __m256i* const HH_RESTRICT p = reinterpret_cast<const __m256i*>(from); return V4x64U(_mm256_load_si256(p)); } template <> HH_INLINE V8x32F Load(const V8x32F::T* const HH_RESTRICT from) { return V8x32F(_mm256_load_ps(from)); } template <> HH_INLINE V4x64F Load(const V4x64F::T* const HH_RESTRICT from) { return V4x64F(_mm256_load_pd(from)); } template <> HH_INLINE V32x8U LoadUnaligned(const V32x8U::T* const HH_RESTRICT from) { const __m256i* const HH_RESTRICT p = reinterpret_cast<const __m256i*>(from); return V32x8U(_mm256_loadu_si256(p)); } template <> HH_INLINE V16x16U LoadUnaligned(const V16x16U::T* const HH_RESTRICT from) { const __m256i* const HH_RESTRICT p = reinterpret_cast<const __m256i*>(from); return V16x16U(_mm256_loadu_si256(p)); } template <> HH_INLINE V8x32U LoadUnaligned(const V8x32U::T* const HH_RESTRICT from) { const __m256i* const HH_RESTRICT p = reinterpret_cast<const __m256i*>(from); return V8x32U(_mm256_loadu_si256(p)); } template <> HH_INLINE V4x64U LoadUnaligned(const V4x64U::T* const HH_RESTRICT from) { const __m256i* const HH_RESTRICT p = reinterpret_cast<const __m256i*>(from); return V4x64U(_mm256_loadu_si256(p)); } template <> HH_INLINE V8x32F LoadUnaligned(const V8x32F::T* const HH_RESTRICT from) { return V8x32F(_mm256_loadu_ps(from)); } template <> HH_INLINE V4x64F LoadUnaligned(const V4x64F::T* const HH_RESTRICT from) { return V4x64F(_mm256_loadu_pd(from)); } // "to" must be vector-aligned. template <typename T> HH_INLINE void Store(const V256<T>& v, T* const HH_RESTRICT to) { _mm256_store_si256(reinterpret_cast<__m256i * HH_RESTRICT>(to), v); } HH_INLINE void Store(const V256<float>& v, float* const HH_RESTRICT to) { _mm256_store_ps(to, v); } HH_INLINE void Store(const V256<double>& v, double* const HH_RESTRICT to) { _mm256_store_pd(to, v); } template <typename T> HH_INLINE void StoreUnaligned(const V256<T>& v, T* const HH_RESTRICT to) { _mm256_storeu_si256(reinterpret_cast<__m256i * HH_RESTRICT>(to), v); } HH_INLINE void StoreUnaligned(const V256<float>& v, float* const HH_RESTRICT to) { _mm256_storeu_ps(to, v); } HH_INLINE void StoreUnaligned(const V256<double>& v, double* const HH_RESTRICT to) { _mm256_storeu_pd(to, v); } // Writes directly to (aligned) memory, bypassing the cache. This is useful for // data that will not be read again in the near future. template <typename T> HH_INLINE void Stream(const V256<T>& v, T* const HH_RESTRICT to) { _mm256_stream_si256(reinterpret_cast<__m256i * HH_RESTRICT>(to), v); } HH_INLINE void Stream(const V256<float>& v, float* const HH_RESTRICT to) { _mm256_stream_ps(to, v); } HH_INLINE void Stream(const V256<double>& v, double* const HH_RESTRICT to) { _mm256_stream_pd(to, v); } // Miscellaneous functions. template <typename T> HH_INLINE V256<T> RotateLeft(const V256<T>& v, const int count) { constexpr size_t num_bits = sizeof(T) * 8; return (v << count) | (v >> (num_bits - count)); } template <typename T> HH_INLINE V256<T> AndNot(const V256<T>& neg_mask, const V256<T>& values) { return V256<T>(_mm256_andnot_si256(neg_mask, values)); } template <> HH_INLINE V256<float> AndNot(const V256<float>& neg_mask, const V256<float>& values) { return V256<float>(_mm256_andnot_ps(neg_mask, values)); } template <> HH_INLINE V256<double> AndNot(const V256<double>& neg_mask, const V256<double>& values) { return V256<double>(_mm256_andnot_pd(neg_mask, values)); } HH_INLINE V8x32F Select(const V8x32F& a, const V8x32F& b, const V8x32F& mask) { return V8x32F(_mm256_blendv_ps(a, b, mask)); } HH_INLINE V4x64F Select(const V4x64F& a, const V4x64F& b, const V4x64F& mask) { return V4x64F(_mm256_blendv_pd(a, b, mask)); } // Min/Max HH_INLINE V32x8U Min(const V32x8U& v0, const V32x8U& v1) { return V32x8U(_mm256_min_epu8(v0, v1)); } HH_INLINE V32x8U Max(const V32x8U& v0, const V32x8U& v1) { return V32x8U(_mm256_max_epu8(v0, v1)); } HH_INLINE V16x16U Min(const V16x16U& v0, const V16x16U& v1) { return V16x16U(_mm256_min_epu16(v0, v1)); } HH_INLINE V16x16U Max(const V16x16U& v0, const V16x16U& v1) { return V16x16U(_mm256_max_epu16(v0, v1)); } HH_INLINE V8x32U Min(const V8x32U& v0, const V8x32U& v1) { return V8x32U(_mm256_min_epu32(v0, v1)); } HH_INLINE V8x32U Max(const V8x32U& v0, const V8x32U& v1) { return V8x32U(_mm256_max_epu32(v0, v1)); } HH_INLINE V8x32F Min(const V8x32F& v0, const V8x32F& v1) { return V8x32F(_mm256_min_ps(v0, v1)); } HH_INLINE V8x32F Max(const V8x32F& v0, const V8x32F& v1) { return V8x32F(_mm256_max_ps(v0, v1)); } HH_INLINE V4x64F Min(const V4x64F& v0, const V4x64F& v1) { return V4x64F(_mm256_min_pd(v0, v1)); } HH_INLINE V4x64F Max(const V4x64F& v0, const V4x64F& v1) { return V4x64F(_mm256_max_pd(v0, v1)); } } // namespace HH_TARGET_NAME } // namespace highwayhash #endif // HH_DISABLE_TARGET_SPECIFIC #endif // HIGHWAYHASH_VECTOR256_H_
{ "pile_set_name": "Github" }
/* Copyright (c) 2003, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. * Copyright (c) 2007-2020, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** * \file tortls_nss.c * \brief Wrapper functions to present a consistent interface to * TLS and SSL X.509 functions from NSS. **/ #include "orconfig.h" #define TORTLS_PRIVATE #define TOR_X509_PRIVATE #ifdef _WIN32 #include <winsock2.h> #include <ws2tcpip.h> #endif #include "lib/crypt_ops/crypto_cipher.h" #include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_dh.h" #include "lib/crypt_ops/crypto_util.h" #include "lib/crypt_ops/crypto_nss_mgt.h" #include "lib/string/printf.h" #include "lib/tls/x509.h" #include "lib/tls/x509_internal.h" #include "lib/tls/tortls.h" #include "lib/tls/tortls_st.h" #include "lib/tls/tortls_internal.h" #include "lib/tls/nss_countbytes.h" #include "lib/log/util_bug.h" DISABLE_GCC_WARNING("-Wstrict-prototypes") #include <prio.h> // For access to rar sockets. #include <private/pprio.h> #include <ssl.h> #include <sslt.h> #include <sslproto.h> #include <certt.h> ENABLE_GCC_WARNING("-Wstrict-prototypes") static SECStatus always_accept_cert_cb(void *, PRFileDesc *, PRBool, PRBool); MOCK_IMPL(void, try_to_extract_certs_from_tls,(int severity, tor_tls_t *tls, tor_x509_cert_impl_t **cert_out, tor_x509_cert_impl_t **id_cert_out)) { tor_assert(tls); tor_assert(cert_out); tor_assert(id_cert_out); (void) severity; *cert_out = *id_cert_out = NULL; CERTCertificate *peer = SSL_PeerCertificate(tls->ssl); if (!peer) return; *cert_out = peer; /* Now owns pointer. */ CERTCertList *chain = SSL_PeerCertificateChain(tls->ssl); CERTCertListNode *c = CERT_LIST_HEAD(chain); for (; !CERT_LIST_END(c, chain); c = CERT_LIST_NEXT(c)) { if (CERT_CompareCerts(c->cert, peer) == PR_FALSE) { *id_cert_out = CERT_DupCertificate(c->cert); break; } } CERT_DestroyCertList(chain); } static bool we_like_ssl_cipher(SSLCipherAlgorithm ca) { switch (ca) { case ssl_calg_null: return false; case ssl_calg_rc4: return false; case ssl_calg_rc2: return false; case ssl_calg_des: return false; case ssl_calg_3des: return false; /* ???? */ case ssl_calg_idea: return false; case ssl_calg_fortezza: return false; case ssl_calg_camellia: return false; case ssl_calg_seed: return false; case ssl_calg_aes: return true; case ssl_calg_aes_gcm: return true; case ssl_calg_chacha20: return true; default: return true; } } static bool we_like_ssl_kea(SSLKEAType kt) { switch (kt) { case ssl_kea_null: return false; case ssl_kea_rsa: return false; /* ??? */ case ssl_kea_fortezza: return false; case ssl_kea_ecdh_psk: return false; case ssl_kea_dh_psk: return false; case ssl_kea_dh: return true; case ssl_kea_ecdh: return true; case ssl_kea_tls13_any: return true; case ssl_kea_size: return true; /* prevent a warning. */ default: return true; } } static bool we_like_mac_algorithm(SSLMACAlgorithm ma) { switch (ma) { case ssl_mac_null: return false; case ssl_mac_md5: return false; case ssl_hmac_md5: return false; case ssl_mac_sha: return true; case ssl_hmac_sha: return true; case ssl_hmac_sha256: return true; case ssl_mac_aead: return true; case ssl_hmac_sha384: return true; default: return true; } } static bool we_like_auth_type(SSLAuthType at) { switch (at) { case ssl_auth_null: return false; case ssl_auth_rsa_decrypt: return false; case ssl_auth_dsa: return false; case ssl_auth_kea: return false; case ssl_auth_ecdsa: return true; case ssl_auth_ecdh_rsa: return true; case ssl_auth_ecdh_ecdsa: return true; case ssl_auth_rsa_sign: return true; case ssl_auth_rsa_pss: return true; case ssl_auth_psk: return true; case ssl_auth_tls13_any: return true; case ssl_auth_size: return true; /* prevent a warning. */ default: return true; } } /** * Return true iff this ciphersuite will be hit by a mozilla bug 1312976, * which makes TLS key exporters not work with TLS 1.2 non-SHA256 * ciphersuites. **/ static bool ciphersuite_has_nss_export_bug(const SSLCipherSuiteInfo *info) { /* For more information on the bug, see https://bugzilla.mozilla.org/show_bug.cgi?id=1312976 */ /* This bug only exists in TLS 1.2. */ if (info->authType == ssl_auth_tls13_any) return false; /* Sadly, there's no way to get this information from the * CipherSuiteInfo object itself other than by looking at the * name. */ if (strstr(info->cipherSuiteName, "_SHA384") || strstr(info->cipherSuiteName, "_SHA512")) { return true; } return false; } tor_tls_context_t * tor_tls_context_new(crypto_pk_t *identity, unsigned int key_lifetime, unsigned flags, int is_client) { SECStatus s; tor_assert(identity); tor_tls_init(); tor_tls_context_t *ctx = tor_malloc_zero(sizeof(tor_tls_context_t)); ctx->refcnt = 1; if (! is_client) { if (tor_tls_context_init_certificates(ctx, identity, key_lifetime, flags) < 0) { goto err; } } { /* Create the "model" PRFileDesc that we will use to base others on. */ PRFileDesc *tcp = PR_NewTCPSocket(); if (!tcp) goto err; ctx->ctx = SSL_ImportFD(NULL, tcp); if (!ctx->ctx) { PR_Close(tcp); goto err; } } // Configure the certificate. if (!is_client) { s = SSL_ConfigServerCert(ctx->ctx, ctx->my_link_cert->cert, (SECKEYPrivateKey *) crypto_pk_get_nss_privkey(ctx->link_key), NULL, /* ExtraServerCertData */ 0 /* DataLen */); if (s != SECSuccess) goto err; } // We need a certificate from the other side. if (is_client) { // XXXX does this do anything? s = SSL_OptionSet(ctx->ctx, SSL_REQUIRE_CERTIFICATE, PR_TRUE); if (s != SECSuccess) goto err; } // Always accept other side's cert; we'll check it ourselves in goofy // tor ways. s = SSL_AuthCertificateHook(ctx->ctx, always_accept_cert_cb, NULL); // We allow simultaneous read and write. s = SSL_OptionSet(ctx->ctx, SSL_ENABLE_FDX, PR_TRUE); if (s != SECSuccess) goto err; // XXXX SSL_ROLLBACK_DETECTION?? // XXXX SSL_ENABLE_ALPN?? // Force client-mode or server_mode. s = SSL_OptionSet(ctx->ctx, is_client ? SSL_HANDSHAKE_AS_CLIENT : SSL_HANDSHAKE_AS_SERVER, PR_TRUE); if (s != SECSuccess) goto err; // Disable everything before TLS 1.0; support everything else. { SSLVersionRange vrange; memset(&vrange, 0, sizeof(vrange)); s = SSL_VersionRangeGetSupported(ssl_variant_stream, &vrange); if (s != SECSuccess) goto err; if (vrange.min < SSL_LIBRARY_VERSION_TLS_1_0) vrange.min = SSL_LIBRARY_VERSION_TLS_1_0; s = SSL_VersionRangeSet(ctx->ctx, &vrange); if (s != SECSuccess) goto err; } // Only support strong ciphers. { const PRUint16 *ciphers = SSL_GetImplementedCiphers(); const PRUint16 n_ciphers = SSL_GetNumImplementedCiphers(); PRUint16 i; for (i = 0; i < n_ciphers; ++i) { SSLCipherSuiteInfo info; memset(&info, 0, sizeof(info)); s = SSL_GetCipherSuiteInfo(ciphers[i], &info, sizeof(info)); if (s != SECSuccess) goto err; if (BUG(info.cipherSuite != ciphers[i])) goto err; int disable = info.effectiveKeyBits < 128 || info.macBits < 128 || !we_like_ssl_cipher(info.symCipher) || !we_like_ssl_kea(info.keaType) || !we_like_mac_algorithm(info.macAlgorithm) || !we_like_auth_type(info.authType)/* Requires NSS 3.24 */; if (ciphersuite_has_nss_export_bug(&info)) { /* SSL_ExportKeyingMaterial will fail; we can't use this cipher. */ disable = 1; } s = SSL_CipherPrefSet(ctx->ctx, ciphers[i], disable ? PR_FALSE : PR_TRUE); if (s != SECSuccess) goto err; } } // Only use DH and ECDH keys once. s = SSL_OptionSet(ctx->ctx, SSL_REUSE_SERVER_ECDHE_KEY, PR_FALSE); if (s != SECSuccess) goto err; // don't cache sessions. s = SSL_OptionSet(ctx->ctx, SSL_NO_CACHE, PR_TRUE); if (s != SECSuccess) goto err; // Enable DH. s = SSL_OptionSet(ctx->ctx, SSL_ENABLE_SERVER_DHE, PR_TRUE); if (s != SECSuccess) goto err; // Set DH and ECDH groups. SSLNamedGroup groups[] = { ssl_grp_ec_curve25519, ssl_grp_ec_secp256r1, ssl_grp_ec_secp224r1, ssl_grp_ffdhe_2048, }; s = SSL_NamedGroupConfig(ctx->ctx, groups, ARRAY_LENGTH(groups)); if (s != SECSuccess) goto err; // These features are off by default, so we don't need to disable them: // Session tickets // Renegotiation // Compression goto done; err: tor_tls_context_decref(ctx); ctx = NULL; done: return ctx; } void tor_tls_context_impl_free_(tor_tls_context_impl_t *ctx) { if (!ctx) return; PR_Close(ctx); } void tor_tls_get_state_description(tor_tls_t *tls, char *buf, size_t sz) { (void)tls; (void)buf; (void)sz; // AFAICT, NSS doesn't expose its internal state. buf[0]=0; } void tor_tls_init(void) { tor_nss_countbytes_init(); } void tls_log_errors(tor_tls_t *tls, int severity, int domain, const char *doing) { /* This implementation is a little different for NSS than it is for OpenSSL -- it logs the last error whether anything actually failed or not. So we have to only call it when something has gone wrong and we have a real error to report. */ (void)tls; PRErrorCode code = PORT_GetError(); if (tls) tls->last_error = code; const char *addr = tls ? tls->address : NULL; const char *string = PORT_ErrorToString(code); const char *name = PORT_ErrorToName(code); char buf[16]; if (!string) string = "<unrecognized>"; if (!name) { tor_snprintf(buf, sizeof(buf), "%d", code); name = buf; } const char *with = addr ? " with " : ""; addr = addr ? addr : ""; if (doing) { log_fn(severity, domain, "TLS error %s while %s%s%s: %s", name, doing, with, addr, string); } else { log_fn(severity, domain, "TLS error %s%s%s: %s", name, string, with, addr); } } const char * tor_tls_get_last_error_msg(const tor_tls_t *tls) { IF_BUG_ONCE(!tls) { return NULL; } if (tls->last_error == 0) { return NULL; } return PORT_ErrorToString((PRErrorCode)tls->last_error); } tor_tls_t * tor_tls_new(tor_socket_t sock, int is_server) { (void)sock; tor_tls_context_t *ctx = tor_tls_context_get(is_server); PRFileDesc *tcp = NULL; if (SOCKET_OK(sock)) { tcp = PR_ImportTCPSocket(sock); } else { tcp = PR_NewTCPSocket(); } if (!tcp) return NULL; PRFileDesc *count = tor_wrap_prfiledesc_with_byte_counter(tcp); if (! count) return NULL; PRFileDesc *ssl = SSL_ImportFD(ctx->ctx, count); if (!ssl) { PR_Close(tcp); return NULL; } /* even if though the socket is already nonblocking, we need to tell NSS * about the fact, so that it knows what to do when it says EAGAIN. */ PRSocketOptionData data; data.option = PR_SockOpt_Nonblocking; data.value.non_blocking = 1; if (PR_SetSocketOption(ssl, &data) != PR_SUCCESS) { PR_Close(ssl); return NULL; } tor_tls_t *tls = tor_malloc_zero(sizeof(tor_tls_t)); tls->magic = TOR_TLS_MAGIC; tls->context = ctx; tor_tls_context_incref(ctx); tls->ssl = ssl; tls->socket = sock; tls->state = TOR_TLS_ST_HANDSHAKE; tls->isServer = !!is_server; if (!is_server) { /* Set a random SNI */ char *fake_hostname = crypto_random_hostname(4,25, "www.",".com"); SSL_SetURL(tls->ssl, fake_hostname); tor_free(fake_hostname); } SECStatus s = SSL_ResetHandshake(ssl, is_server ? PR_TRUE : PR_FALSE); if (s != SECSuccess) { tls_log_errors(tls, LOG_WARN, LD_CRYPTO, "resetting handshake state"); } return tls; } void tor_tls_set_renegotiate_callback(tor_tls_t *tls, void (*cb)(tor_tls_t *, void *arg), void *arg) { tor_assert(tls); (void)cb; (void)arg; /* We don't support renegotiation-based TLS with NSS. */ } /** * Tell the TLS library that the underlying socket for <b>tls</b> has been * closed, and the library should not attempt to free that socket itself. */ void tor_tls_release_socket(tor_tls_t *tls) { if (! tls) return; /* NSS doesn't have the equivalent of BIO_NO_CLOSE. If you replace the * fd with something that's invalid, it causes a memory leak in PR_Close. * * If there were a way to put the PRFileDesc into the CLOSED state, that * would prevent it from closing its fd -- but there doesn't seem to be a * supported way to do that either. * * So instead: we make a new sacrificial socket, and replace the original * socket with that one. This seems to be the best we can do, until we * redesign the mainloop code enough to make this function unnecessary. */ tor_socket_t sock = tor_open_socket_nonblocking(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (! SOCKET_OK(sock)) { log_warn(LD_NET, "Out of sockets when trying to shut down an NSS " "connection"); return; } PRFileDesc *tcp = PR_GetIdentitiesLayer(tls->ssl, PR_NSPR_IO_LAYER); if (BUG(! tcp)) { tor_close_socket(sock); return; } PR_ChangeFileDescNativeHandle(tcp, sock); /* Tell our socket accounting layer that we don't own this socket any more: * NSS is about to free it for us. */ tor_release_socket_ownership(sock); } void tor_tls_impl_free_(tor_tls_impl_t *tls) { // XXXX This will close the underlying fd, which our OpenSSL version does // not do! if (!tls) return; PR_Close(tls); } int tor_tls_peer_has_cert(tor_tls_t *tls) { CERTCertificate *cert = SSL_PeerCertificate(tls->ssl); int result = (cert != NULL); CERT_DestroyCertificate(cert); return result; } MOCK_IMPL(tor_x509_cert_t *, tor_tls_get_peer_cert,(tor_tls_t *tls)) { CERTCertificate *cert = SSL_PeerCertificate(tls->ssl); if (cert) return tor_x509_cert_new(cert); else return NULL; } MOCK_IMPL(tor_x509_cert_t *, tor_tls_get_own_cert,(tor_tls_t *tls)) { tor_assert(tls); CERTCertificate *cert = SSL_LocalCertificate(tls->ssl); if (cert) return tor_x509_cert_new(cert); else return NULL; } MOCK_IMPL(int, tor_tls_read, (tor_tls_t *tls, char *cp, size_t len)) { tor_assert(tls); tor_assert(cp); tor_assert(len < INT_MAX); PRInt32 rv = PR_Read(tls->ssl, cp, (int)len); // log_debug(LD_NET, "PR_Read(%zu) returned %d", n, (int)rv); if (rv > 0) { return rv; } if (rv == 0) return TOR_TLS_CLOSE; PRErrorCode err = PORT_GetError(); if (err == PR_WOULD_BLOCK_ERROR) { return TOR_TLS_WANTREAD; // XXXX ???? } else { tls_log_errors(tls, LOG_NOTICE, LD_CRYPTO, "reading"); // XXXX return TOR_TLS_ERROR_MISC; // ???? } } int tor_tls_write(tor_tls_t *tls, const char *cp, size_t n) { tor_assert(tls); tor_assert(cp || n == 0); tor_assert(n < INT_MAX); PRInt32 rv = PR_Write(tls->ssl, cp, (int)n); // log_debug(LD_NET, "PR_Write(%zu) returned %d", n, (int)rv); if (rv > 0) { return rv; } if (rv == 0) return TOR_TLS_ERROR_MISC; PRErrorCode err = PORT_GetError(); if (err == PR_WOULD_BLOCK_ERROR) { return TOR_TLS_WANTWRITE; // XXXX ???? } else { tls_log_errors(tls, LOG_NOTICE, LD_CRYPTO, "writing"); // XXXX return TOR_TLS_ERROR_MISC; // ???? } } int tor_tls_handshake(tor_tls_t *tls) { tor_assert(tls); tor_assert(tls->state == TOR_TLS_ST_HANDSHAKE); SECStatus s = SSL_ForceHandshake(tls->ssl); if (s == SECSuccess) { tls->state = TOR_TLS_ST_OPEN; log_debug(LD_NET, "SSL handshake is supposedly complete."); return tor_tls_finish_handshake(tls); } if (PORT_GetError() == PR_WOULD_BLOCK_ERROR) return TOR_TLS_WANTREAD; /* XXXX What about wantwrite? */ return TOR_TLS_ERROR_MISC; // XXXX } int tor_tls_finish_handshake(tor_tls_t *tls) { tor_assert(tls); // We don't need to do any of the weird handshake nonsense stuff on NSS, // since we only support recent handshakes. return TOR_TLS_DONE; } void tor_tls_unblock_renegotiation(tor_tls_t *tls) { tor_assert(tls); /* We don't support renegotiation with NSS. */ } void tor_tls_block_renegotiation(tor_tls_t *tls) { tor_assert(tls); /* We don't support renegotiation with NSS. */ } void tor_tls_assert_renegotiation_unblocked(tor_tls_t *tls) { tor_assert(tls); /* We don't support renegotiation with NSS. */ } int tor_tls_get_pending_bytes(tor_tls_t *tls) { tor_assert(tls); int n = SSL_DataPending(tls->ssl); if (n < 0) { tls_log_errors(tls, LOG_WARN, LD_CRYPTO, "looking up pending bytes"); return 0; } return (int)n; } size_t tor_tls_get_forced_write_size(tor_tls_t *tls) { tor_assert(tls); /* NSS doesn't have the same "forced write" restriction as openssl. */ return 0; } void tor_tls_get_n_raw_bytes(tor_tls_t *tls, size_t *n_read, size_t *n_written) { tor_assert(tls); tor_assert(n_read); tor_assert(n_written); uint64_t r, w; if (tor_get_prfiledesc_byte_counts(tls->ssl, &r, &w) < 0) { *n_read = *n_written = 0; return; } *n_read = (size_t)(r - tls->last_read_count); *n_written = (size_t)(w - tls->last_write_count); tls->last_read_count = r; tls->last_write_count = w; } int tor_tls_get_buffer_sizes(tor_tls_t *tls, size_t *rbuf_capacity, size_t *rbuf_bytes, size_t *wbuf_capacity, size_t *wbuf_bytes) { tor_assert(tls); tor_assert(rbuf_capacity); tor_assert(rbuf_bytes); tor_assert(wbuf_capacity); tor_assert(wbuf_bytes); /* This is an acceptable way to say "we can't measure this." */ return -1; } MOCK_IMPL(double, tls_get_write_overhead_ratio, (void)) { /* XXX We don't currently have a way to measure this in NSS; we could do that * XXX with a PRIO layer, but it'll take a little coding. */ return 0.95; } int tor_tls_used_v1_handshake(tor_tls_t *tls) { tor_assert(tls); /* We don't support or allow the V1 handshake with NSS. */ return 0; } int tor_tls_server_got_renegotiate(tor_tls_t *tls) { tor_assert(tls); return 0; /* We don't support renegotiation with NSS */ } MOCK_IMPL(int, tor_tls_cert_matches_key,(const tor_tls_t *tls, const struct tor_x509_cert_t *cert)) { tor_assert(cert); tor_assert(cert->cert); int rv = 0; tor_x509_cert_t *peercert = tor_tls_get_peer_cert((tor_tls_t *)tls); if (!peercert || !peercert->cert) goto done; CERTSubjectPublicKeyInfo *peer_info = &peercert->cert->subjectPublicKeyInfo; CERTSubjectPublicKeyInfo *cert_info = &cert->cert->subjectPublicKeyInfo; /* NSS stores the `len` field in bits, instead of bytes, for the * `subjectPublicKey` field in CERTSubjectPublicKeyInfo, but * `SECITEM_ItemsAreEqual()` compares the two bitstrings using a length field * defined in bytes. * * We convert the `len` field from bits to bytes, do our comparison with * `SECITEM_ItemsAreEqual()`, and reset the length field from bytes to bits * again. * * See also NSS's own implementation of `SECKEY_CopySubjectPublicKeyInfo()` * in seckey.c in the NSS source tree. This function also does the conversion * between bits and bytes. */ const unsigned int peer_info_orig_len = peer_info->subjectPublicKey.len; const unsigned int cert_info_orig_len = cert_info->subjectPublicKey.len; /* We convert the length from bits to bytes, but instead of using NSS's * `DER_ConvertBitString()` macro on both of peer_info->subjectPublicKey and * cert_info->subjectPublicKey, we have to do the conversion explicitly since * both of the two subjectPublicKey fields are allowed to point to the same * memory address. Otherwise, the bits to bytes conversion would potentially * be applied twice, which would lead to us comparing too few of the bytes * when we call SECITEM_ItemsAreEqual(), which would be catastrophic. */ peer_info->subjectPublicKey.len = ((peer_info_orig_len + 7) >> 3); cert_info->subjectPublicKey.len = ((cert_info_orig_len + 7) >> 3); rv = SECOID_CompareAlgorithmID(&peer_info->algorithm, &cert_info->algorithm) == 0 && SECITEM_ItemsAreEqual(&peer_info->subjectPublicKey, &cert_info->subjectPublicKey); /* Convert from bytes back to bits. */ peer_info->subjectPublicKey.len = peer_info_orig_len; cert_info->subjectPublicKey.len = cert_info_orig_len; done: tor_x509_cert_free(peercert); return rv; } MOCK_IMPL(int, tor_tls_get_tlssecrets,(tor_tls_t *tls, uint8_t *secrets_out)) { tor_assert(tls); tor_assert(secrets_out); /* There's no way to get this information out of NSS. */ return -1; } MOCK_IMPL(int, tor_tls_export_key_material,(tor_tls_t *tls, uint8_t *secrets_out, const uint8_t *context, size_t context_len, const char *label)) { tor_assert(tls); tor_assert(secrets_out); tor_assert(context); tor_assert(label); tor_assert(strlen(label) <= UINT_MAX); tor_assert(context_len <= UINT_MAX); SECStatus s; /* Make sure that the error code is set here, so that we can be sure that * any error code set after a failure was in fact caused by * SSL_ExportKeyingMaterial. */ PR_SetError(PR_UNKNOWN_ERROR, 0); s = SSL_ExportKeyingMaterial(tls->ssl, label, (unsigned)strlen(label), PR_TRUE, context, (unsigned)context_len, secrets_out, DIGEST256_LEN); if (s != SECSuccess) { tls_log_errors(tls, LOG_WARN, LD_CRYPTO, "exporting key material for a TLS handshake"); } return (s == SECSuccess) ? 0 : -1; } const char * tor_tls_get_ciphersuite_name(tor_tls_t *tls) { tor_assert(tls); SSLChannelInfo channel_info; SSLCipherSuiteInfo cipher_info; memset(&channel_info, 0, sizeof(channel_info)); memset(&cipher_info, 0, sizeof(cipher_info)); SECStatus s = SSL_GetChannelInfo(tls->ssl, &channel_info, sizeof(channel_info)); if (s != SECSuccess) return NULL; s = SSL_GetCipherSuiteInfo(channel_info.cipherSuite, &cipher_info, sizeof(cipher_info)); if (s != SECSuccess) return NULL; return cipher_info.cipherSuiteName; } /** The group we should use for ecdhe when none was selected. */ #define SEC_OID_TOR_DEFAULT_ECDHE_GROUP SEC_OID_ANSIX962_EC_PRIME256V1 int evaluate_ecgroup_for_tls(const char *ecgroup) { SECOidTag tag; if (!ecgroup) tag = SEC_OID_TOR_DEFAULT_ECDHE_GROUP; else if (!strcasecmp(ecgroup, "P256")) tag = SEC_OID_ANSIX962_EC_PRIME256V1; else if (!strcasecmp(ecgroup, "P224")) tag = SEC_OID_SECG_EC_SECP224R1; else return 0; /* I don't think we need any additional tests here for NSS */ (void) tag; return 1; } static SECStatus always_accept_cert_cb(void *arg, PRFileDesc *ssl, PRBool checkSig, PRBool isServer) { (void)arg; (void)ssl; (void)checkSig; (void)isServer; return SECSuccess; }
{ "pile_set_name": "Github" }
#include "swstring.h" /* * Copyright 2010 Sven Vermeulen. * Subject to the GNU Public License, version 3. */ /** * zero_string - Empty the given string and fill it up with 0x00's. * * @param buffer Pointer to the string, should be non-NULL. * @param numlen Length of the buffer. If 0 or lower, the length of the buffer * is calculated using strlen(). */ void zero_string(char * buffer, size_t numlen) { assert(buffer != NULL); if (numlen <= 0) numlen = strlen(buffer); memset(buffer, 0x00, numlen); }; /** * swstrlen - Return the length of the string as an integer * * swstrlen supports stringlength checks on NULL as well - it returns * it as 0. */ int swstrlen(const char * buffer) { if (buffer == NULL) return 0; else return buffer[0] == '\0' ? 0 : strlen(buffer); }; /** * substitute_variable - Substitute variable in string with proper value * * For safety measures, length of $value needs to be 1023 or less. */ char * substitute_variable(const char * buffer, const char * prevar, const char * postvar, const char * varname, const char * value) { char * posptr = NULL; char * tmpptr = NULL; char * newbfr = NULL; int found = 0; // Get lengths int l_varname = swstrlen(varname); int l_buffer = swstrlen(buffer); int l_prevar = swstrlen(prevar); int l_postvar = swstrlen(postvar); int l_value = swstrlen(value); // Verify that the lengths aren't unusually large or small... if ((l_varname == 0) || (l_varname > l_buffer - l_prevar - l_postvar)) return NULL; if (l_value > 1023) return NULL; // Allocate room for filled in string newbfr = (char *) calloc(sizeof(char), l_buffer - l_prevar - l_postvar - l_varname + l_value + 1); if (prevar != NULL) { posptr = strstr(buffer, prevar); while(posptr != NULL) { if (strncmp(posptr + l_prevar, varname, l_varname) == 0) { strncpy(newbfr, buffer, l_buffer - swstrlen(posptr)); // First part strcat(newbfr, value); // Add value if (postvar != NULL) { tmpptr = strstr(posptr + l_prevar, postvar); strcat(newbfr, tmpptr + l_postvar); } else { strcat(newbfr, posptr + l_prevar + l_varname); }; found++; }; tmpptr = strstr(posptr + l_prevar, prevar); posptr = tmpptr; }; } else { posptr = strstr(buffer, varname); while(posptr != NULL) { strncpy(newbfr, buffer, l_buffer - swstrlen(posptr)); // First part strcat(newbfr, value); // Add value if (postvar != NULL) { tmpptr = strstr(posptr + l_varname, postvar); strcat(newbfr, tmpptr + l_postvar); } else { strcat(newbfr, posptr + l_varname); }; found++; tmpptr = strstr(posptr + l_varname, varname); posptr = tmpptr; }; }; if (found > 0) { return newbfr; } else { free(newbfr); return NULL; }; };
{ "pile_set_name": "Github" }
<annotation> <folder>widerface</folder> <filename>23--Shoppers_23_Shoppers_Shoppers_23_529.jpg</filename> <source> <database>wider face Database</database> <annotation>PASCAL VOC2007</annotation> <image>flickr</image> <flickrid>-1</flickrid> </source> <owner> <flickrid>yanyu</flickrid> <name>yanyu</name> </owner> <size> <width>1024</width> <height>679</height> <depth>3</depth> </size> <segmented>0</segmented> <object> <name>face</name> <pose>Unspecified</pose> <truncated>1</truncated> <difficult>0</difficult> <bndbox> <xmin>392</xmin> <ymin>20</ymin> <xmax>516</xmax> <ymax>146</ymax> </bndbox> <lm> <x1>429.281</x1> <y1>88.625</y1> <x2>480.062</x2> <y2>58.156</y2> <x3>471.469</x3> <y3>101.906</y3> <x4>455.062</x4> <y4>116.75</y4> <x5>492.562</x5> <y5>96.438</y5> <visible>0</visible> <blur>0.61</blur> </lm> <has_lm>1</has_lm> </object> <object> <name>face</name> <pose>Unspecified</pose> <truncated>1</truncated> <difficult>0</difficult> <bndbox> <xmin>770</xmin> <ymin>96</ymin> <xmax>898</xmax> <ymax>230</ymax> </bndbox> <lm> <x1>788.781</x1> <y1>149.0</y1> <x2>842.781</x2> <y2>159.969</y2> <x3>798.906</x3> <y3>186.969</y3> <x4>794.688</x4> <y4>194.562</y4> <x5>835.188</x5> <y5>200.469</y5> <visible>0</visible> <blur>0.66</blur> </lm> <has_lm>1</has_lm> </object> </annotation>
{ "pile_set_name": "Github" }
using System.Threading.Tasks; using CommandDotNet.TestTools.Scenarios; using Xunit; using Xunit.Abstractions; namespace CommandDotNet.Tests.FeatureTests.ParseDirective { public class ParseReporter_Structure_Tests { public ParseReporter_Structure_Tests(ITestOutputHelper output) { Ambient.Output = output; } [Fact] public void Includes_Operands_Options_InheritedOptions_And_Operands_AreCalled_Arguments() { new AppRunner<App>() .UseParseDirective() .Verify(new Scenario { When = {Args = "[parse] Do"}, Then = { Output = @"command: Do arguments: operand1 <Text> value: inputs: default: options: option1 <Text> value: inputs: default: iOption1 <Text> value: inputs: default: Parse usage: [parse:t:raw] to include token transformations. 't' to include token transformations. 'raw' to include command line as passed to this process. " } }); } public class App { public Task<int> Interceptor(InterceptorExecutionDelegate next, [Option] string iOption1) => next(); public void Do([Operand] string operand1, [Option] string option1) { } } } }
{ "pile_set_name": "Github" }
{ pkgs ? import <nixpkgs> {} , stdenv ? pkgs.stdenv }: let gopkg = { name, rootPackagePath, src }: stdenv.mkDerivation { inherit name src; installPhase = '' mkdir -p $out/src/${rootPackagePath} cp -r * $out/src/${rootPackagePath}/ ''; }; websocket = gopkg { name = "go.net"; rootPackagePath = "code.google.com/p/go.net"; src = pkgs.fetchhg { url = https://code.google.com/p/go.net; tag = "bc411e2ac33f"; }; }; gcfg = gopkg { name = "gcfg"; rootPackagePath = "code.google.com/p/gcfg"; src = pkgs.fetchgit { url = https://code.google.com/p/gcfg/; rev = "4bedf9880f04908ce2c654950503e40563291f52"; }; }; uuid = gopkg { name = "uuid"; rootPackagePath = "code.google.com/p/go-uuid"; src = pkgs.fetchhg { url = https://code.google.com/p/go-uuid/; tag = "5fac954758f5"; }; }; in stdenv.mkDerivation { name = "zed-0.3"; src = ./.; buildInputs = [ pkgs.go ]; GOPATH = "${websocket}:${gcfg}:${uuid}"; buildPhase = '' go build ''; installPhase = '' mkdir -p $out/bin cp zed $out/bin/ ''; }
{ "pile_set_name": "Github" }
// Copyright 2015 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 prometheus import ( "fmt" "math" "runtime" "sort" "sync" "sync/atomic" "time" "github.com/golang/protobuf/proto" dto "github.com/prometheus/client_model/go" ) // A Histogram counts individual observations from an event or sample stream in // configurable buckets. Similar to a summary, it also provides a sum of // observations and an observation count. // // On the Prometheus server, quantiles can be calculated from a Histogram using // the histogram_quantile function in the query language. // // Note that Histograms, in contrast to Summaries, can be aggregated with the // Prometheus query language (see the documentation for detailed // procedures). However, Histograms require the user to pre-define suitable // buckets, and they are in general less accurate. The Observe method of a // Histogram has a very low performance overhead in comparison with the Observe // method of a Summary. // // To create Histogram instances, use NewHistogram. type Histogram interface { Metric Collector // Observe adds a single observation to the histogram. Observe(float64) } // bucketLabel is used for the label that defines the upper bound of a // bucket of a histogram ("le" -> "less or equal"). const bucketLabel = "le" // DefBuckets are the default Histogram buckets. The default buckets are // tailored to broadly measure the response time (in seconds) of a network // service. Most likely, however, you will be required to define buckets // customized to your use case. var ( DefBuckets = []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10} errBucketLabelNotAllowed = fmt.Errorf( "%q is not allowed as label name in histograms", bucketLabel, ) ) // LinearBuckets creates 'count' buckets, each 'width' wide, where the lowest // bucket has an upper bound of 'start'. The final +Inf bucket is not counted // and not included in the returned slice. The returned slice is meant to be // used for the Buckets field of HistogramOpts. // // The function panics if 'count' is zero or negative. func LinearBuckets(start, width float64, count int) []float64 { if count < 1 { panic("LinearBuckets needs a positive count") } buckets := make([]float64, count) for i := range buckets { buckets[i] = start start += width } return buckets } // ExponentialBuckets creates 'count' buckets, where the lowest bucket has an // upper bound of 'start' and each following bucket's upper bound is 'factor' // times the previous bucket's upper bound. The final +Inf bucket is not counted // and not included in the returned slice. The returned slice is meant to be // used for the Buckets field of HistogramOpts. // // The function panics if 'count' is 0 or negative, if 'start' is 0 or negative, // or if 'factor' is less than or equal 1. func ExponentialBuckets(start, factor float64, count int) []float64 { if count < 1 { panic("ExponentialBuckets needs a positive count") } if start <= 0 { panic("ExponentialBuckets needs a positive start value") } if factor <= 1 { panic("ExponentialBuckets needs a factor greater than 1") } buckets := make([]float64, count) for i := range buckets { buckets[i] = start start *= factor } return buckets } // HistogramOpts bundles the options for creating a Histogram metric. It is // mandatory to set Name to a non-empty string. All other fields are optional // and can safely be left at their zero value, although it is strongly // encouraged to set a Help string. type HistogramOpts struct { // Namespace, Subsystem, and Name are components of the fully-qualified // name of the Histogram (created by joining these components with // "_"). Only Name is mandatory, the others merely help structuring the // name. Note that the fully-qualified name of the Histogram must be a // valid Prometheus metric name. Namespace string Subsystem string Name string // Help provides information about this Histogram. // // Metrics with the same fully-qualified name must have the same Help // string. Help string // ConstLabels are used to attach fixed labels to this metric. Metrics // with the same fully-qualified name must have the same label names in // their ConstLabels. // // ConstLabels are only used rarely. In particular, do not use them to // attach the same labels to all your metrics. Those use cases are // better covered by target labels set by the scraping Prometheus // server, or by one specific metric (e.g. a build_info or a // machine_role metric). See also // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels-not-static-scraped-labels ConstLabels Labels // Buckets defines the buckets into which observations are counted. Each // element in the slice is the upper inclusive bound of a bucket. The // values must be sorted in strictly increasing order. There is no need // to add a highest bucket with +Inf bound, it will be added // implicitly. The default value is DefBuckets. Buckets []float64 } // NewHistogram creates a new Histogram based on the provided HistogramOpts. It // panics if the buckets in HistogramOpts are not in strictly increasing order. // // The returned implementation also implements ExemplarObserver. It is safe to // perform the corresponding type assertion. Exemplars are tracked separately // for each bucket. func NewHistogram(opts HistogramOpts) Histogram { return newHistogram( NewDesc( BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), opts.Help, nil, opts.ConstLabels, ), opts, ) } func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogram { if len(desc.variableLabels) != len(labelValues) { panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, labelValues)) } for _, n := range desc.variableLabels { if n == bucketLabel { panic(errBucketLabelNotAllowed) } } for _, lp := range desc.constLabelPairs { if lp.GetName() == bucketLabel { panic(errBucketLabelNotAllowed) } } if len(opts.Buckets) == 0 { opts.Buckets = DefBuckets } h := &histogram{ desc: desc, upperBounds: opts.Buckets, labelPairs: makeLabelPairs(desc, labelValues), counts: [2]*histogramCounts{{}, {}}, now: time.Now, } for i, upperBound := range h.upperBounds { if i < len(h.upperBounds)-1 { if upperBound >= h.upperBounds[i+1] { panic(fmt.Errorf( "histogram buckets must be in increasing order: %f >= %f", upperBound, h.upperBounds[i+1], )) } } else { if math.IsInf(upperBound, +1) { // The +Inf bucket is implicit. Remove it here. h.upperBounds = h.upperBounds[:i] } } } // Finally we know the final length of h.upperBounds and can make buckets // for both counts as well as exemplars: h.counts[0].buckets = make([]uint64, len(h.upperBounds)) h.counts[1].buckets = make([]uint64, len(h.upperBounds)) h.exemplars = make([]atomic.Value, len(h.upperBounds)+1) h.init(h) // Init self-collection. return h } type histogramCounts struct { // sumBits contains the bits of the float64 representing the sum of all // observations. sumBits and count have to go first in the struct to // guarantee alignment for atomic operations. // http://golang.org/pkg/sync/atomic/#pkg-note-BUG sumBits uint64 count uint64 buckets []uint64 } type histogram struct { // countAndHotIdx enables lock-free writes with use of atomic updates. // The most significant bit is the hot index [0 or 1] of the count field // below. Observe calls update the hot one. All remaining bits count the // number of Observe calls. Observe starts by incrementing this counter, // and finish by incrementing the count field in the respective // histogramCounts, as a marker for completion. // // Calls of the Write method (which are non-mutating reads from the // perspective of the histogram) swap the hot–cold under the writeMtx // lock. A cooldown is awaited (while locked) by comparing the number of // observations with the initiation count. Once they match, then the // last observation on the now cool one has completed. All cool fields must // be merged into the new hot before releasing writeMtx. // // Fields with atomic access first! See alignment constraint: // http://golang.org/pkg/sync/atomic/#pkg-note-BUG countAndHotIdx uint64 selfCollector desc *Desc writeMtx sync.Mutex // Only used in the Write method. // Two counts, one is "hot" for lock-free observations, the other is // "cold" for writing out a dto.Metric. It has to be an array of // pointers to guarantee 64bit alignment of the histogramCounts, see // http://golang.org/pkg/sync/atomic/#pkg-note-BUG. counts [2]*histogramCounts upperBounds []float64 labelPairs []*dto.LabelPair exemplars []atomic.Value // One more than buckets (to include +Inf), each a *dto.Exemplar. now func() time.Time // To mock out time.Now() for testing. } func (h *histogram) Desc() *Desc { return h.desc } func (h *histogram) Observe(v float64) { h.observe(v, h.findBucket(v)) } func (h *histogram) ObserveWithExemplar(v float64, e Labels) { i := h.findBucket(v) h.observe(v, i) h.updateExemplar(v, i, e) } func (h *histogram) Write(out *dto.Metric) error { // For simplicity, we protect this whole method by a mutex. It is not in // the hot path, i.e. Observe is called much more often than Write. The // complication of making Write lock-free isn't worth it, if possible at // all. h.writeMtx.Lock() defer h.writeMtx.Unlock() // Adding 1<<63 switches the hot index (from 0 to 1 or from 1 to 0) // without touching the count bits. See the struct comments for a full // description of the algorithm. n := atomic.AddUint64(&h.countAndHotIdx, 1<<63) // count is contained unchanged in the lower 63 bits. count := n & ((1 << 63) - 1) // The most significant bit tells us which counts is hot. The complement // is thus the cold one. hotCounts := h.counts[n>>63] coldCounts := h.counts[(^n)>>63] // Await cooldown. for count != atomic.LoadUint64(&coldCounts.count) { runtime.Gosched() // Let observations get work done. } his := &dto.Histogram{ Bucket: make([]*dto.Bucket, len(h.upperBounds)), SampleCount: proto.Uint64(count), SampleSum: proto.Float64(math.Float64frombits(atomic.LoadUint64(&coldCounts.sumBits))), } var cumCount uint64 for i, upperBound := range h.upperBounds { cumCount += atomic.LoadUint64(&coldCounts.buckets[i]) his.Bucket[i] = &dto.Bucket{ CumulativeCount: proto.Uint64(cumCount), UpperBound: proto.Float64(upperBound), } if e := h.exemplars[i].Load(); e != nil { his.Bucket[i].Exemplar = e.(*dto.Exemplar) } } // If there is an exemplar for the +Inf bucket, we have to add that bucket explicitly. if e := h.exemplars[len(h.upperBounds)].Load(); e != nil { b := &dto.Bucket{ CumulativeCount: proto.Uint64(count), UpperBound: proto.Float64(math.Inf(1)), Exemplar: e.(*dto.Exemplar), } his.Bucket = append(his.Bucket, b) } out.Histogram = his out.Label = h.labelPairs // Finally add all the cold counts to the new hot counts and reset the cold counts. atomic.AddUint64(&hotCounts.count, count) atomic.StoreUint64(&coldCounts.count, 0) for { oldBits := atomic.LoadUint64(&hotCounts.sumBits) newBits := math.Float64bits(math.Float64frombits(oldBits) + his.GetSampleSum()) if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) { atomic.StoreUint64(&coldCounts.sumBits, 0) break } } for i := range h.upperBounds { atomic.AddUint64(&hotCounts.buckets[i], atomic.LoadUint64(&coldCounts.buckets[i])) atomic.StoreUint64(&coldCounts.buckets[i], 0) } return nil } // findBucket returns the index of the bucket for the provided value, or // len(h.upperBounds) for the +Inf bucket. func (h *histogram) findBucket(v float64) int { // TODO(beorn7): For small numbers of buckets (<30), a linear search is // slightly faster than the binary search. If we really care, we could // switch from one search strategy to the other depending on the number // of buckets. // // Microbenchmarks (BenchmarkHistogramNoLabels): // 11 buckets: 38.3 ns/op linear - binary 48.7 ns/op // 100 buckets: 78.1 ns/op linear - binary 54.9 ns/op // 300 buckets: 154 ns/op linear - binary 61.6 ns/op return sort.SearchFloat64s(h.upperBounds, v) } // observe is the implementation for Observe without the findBucket part. func (h *histogram) observe(v float64, bucket int) { // We increment h.countAndHotIdx so that the counter in the lower // 63 bits gets incremented. At the same time, we get the new value // back, which we can use to find the currently-hot counts. n := atomic.AddUint64(&h.countAndHotIdx, 1) hotCounts := h.counts[n>>63] if bucket < len(h.upperBounds) { atomic.AddUint64(&hotCounts.buckets[bucket], 1) } for { oldBits := atomic.LoadUint64(&hotCounts.sumBits) newBits := math.Float64bits(math.Float64frombits(oldBits) + v) if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) { break } } // Increment count last as we take it as a signal that the observation // is complete. atomic.AddUint64(&hotCounts.count, 1) } // updateExemplar replaces the exemplar for the provided bucket. With empty // labels, it's a no-op. It panics if any of the labels is invalid. func (h *histogram) updateExemplar(v float64, bucket int, l Labels) { if l == nil { return } e, err := newExemplar(v, h.now(), l) if err != nil { panic(err) } h.exemplars[bucket].Store(e) } // HistogramVec is a Collector that bundles a set of Histograms that all share the // same Desc, but have different values for their variable labels. This is used // if you want to count the same thing partitioned by various dimensions // (e.g. HTTP request latencies, partitioned by status code and method). Create // instances with NewHistogramVec. type HistogramVec struct { *metricVec } // NewHistogramVec creates a new HistogramVec based on the provided HistogramOpts and // partitioned by the given label names. func NewHistogramVec(opts HistogramOpts, labelNames []string) *HistogramVec { desc := NewDesc( BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), opts.Help, labelNames, opts.ConstLabels, ) return &HistogramVec{ metricVec: newMetricVec(desc, func(lvs ...string) Metric { return newHistogram(desc, opts, lvs...) }), } } // GetMetricWithLabelValues returns the Histogram for the given slice of label // values (same order as the VariableLabels in Desc). If that combination of // label values is accessed for the first time, a new Histogram is created. // // It is possible to call this method without using the returned Histogram to only // create the new Histogram but leave it at its starting value, a Histogram without // any observations. // // Keeping the Histogram for later use is possible (and should be considered if // performance is critical), but keep in mind that Reset, DeleteLabelValues and // Delete can be used to delete the Histogram from the HistogramVec. In that case, the // Histogram will still exist, but it will not be exported anymore, even if a // Histogram with the same label values is created later. See also the CounterVec // example. // // An error is returned if the number of label values is not the same as the // number of VariableLabels in Desc (minus any curried labels). // // Note that for more than one label value, this method is prone to mistakes // caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as // an alternative to avoid that type of mistake. For higher label numbers, the // latter has a much more readable (albeit more verbose) syntax, but it comes // with a performance overhead (for creating and processing the Labels map). // See also the GaugeVec example. func (v *HistogramVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) { metric, err := v.metricVec.getMetricWithLabelValues(lvs...) if metric != nil { return metric.(Observer), err } return nil, err } // GetMetricWith returns the Histogram for the given Labels map (the label names // must match those of the VariableLabels in Desc). If that label map is // accessed for the first time, a new Histogram is created. Implications of // creating a Histogram without using it and keeping the Histogram for later use // are the same as for GetMetricWithLabelValues. // // An error is returned if the number and names of the Labels are inconsistent // with those of the VariableLabels in Desc (minus any curried labels). // // This method is used for the same purpose as // GetMetricWithLabelValues(...string). See there for pros and cons of the two // methods. func (v *HistogramVec) GetMetricWith(labels Labels) (Observer, error) { metric, err := v.metricVec.getMetricWith(labels) if metric != nil { return metric.(Observer), err } return nil, err } // WithLabelValues works as GetMetricWithLabelValues, but panics where // GetMetricWithLabelValues would have returned an error. Not returning an // error allows shortcuts like // myVec.WithLabelValues("404", "GET").Observe(42.21) func (v *HistogramVec) WithLabelValues(lvs ...string) Observer { h, err := v.GetMetricWithLabelValues(lvs...) if err != nil { panic(err) } return h } // With works as GetMetricWith but panics where GetMetricWithLabels would have // returned an error. Not returning an error allows shortcuts like // myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21) func (v *HistogramVec) With(labels Labels) Observer { h, err := v.GetMetricWith(labels) if err != nil { panic(err) } return h } // CurryWith returns a vector curried with the provided labels, i.e. the // returned vector has those labels pre-set for all labeled operations performed // on it. The cardinality of the curried vector is reduced accordingly. The // order of the remaining labels stays the same (just with the curried labels // taken out of the sequence – which is relevant for the // (GetMetric)WithLabelValues methods). It is possible to curry a curried // vector, but only with labels not yet used for currying before. // // The metrics contained in the HistogramVec are shared between the curried and // uncurried vectors. They are just accessed differently. Curried and uncurried // vectors behave identically in terms of collection. Only one must be // registered with a given registry (usually the uncurried version). The Reset // method deletes all metrics, even if called on a curried vector. func (v *HistogramVec) CurryWith(labels Labels) (ObserverVec, error) { vec, err := v.curryWith(labels) if vec != nil { return &HistogramVec{vec}, err } return nil, err } // MustCurryWith works as CurryWith but panics where CurryWith would have // returned an error. func (v *HistogramVec) MustCurryWith(labels Labels) ObserverVec { vec, err := v.CurryWith(labels) if err != nil { panic(err) } return vec } type constHistogram struct { desc *Desc count uint64 sum float64 buckets map[float64]uint64 labelPairs []*dto.LabelPair } func (h *constHistogram) Desc() *Desc { return h.desc } func (h *constHistogram) Write(out *dto.Metric) error { his := &dto.Histogram{} buckets := make([]*dto.Bucket, 0, len(h.buckets)) his.SampleCount = proto.Uint64(h.count) his.SampleSum = proto.Float64(h.sum) for upperBound, count := range h.buckets { buckets = append(buckets, &dto.Bucket{ CumulativeCount: proto.Uint64(count), UpperBound: proto.Float64(upperBound), }) } if len(buckets) > 0 { sort.Sort(buckSort(buckets)) } his.Bucket = buckets out.Histogram = his out.Label = h.labelPairs return nil } // NewConstHistogram returns a metric representing a Prometheus histogram with // fixed values for the count, sum, and bucket counts. As those parameters // cannot be changed, the returned value does not implement the Histogram // interface (but only the Metric interface). Users of this package will not // have much use for it in regular operations. However, when implementing custom // Collectors, it is useful as a throw-away metric that is generated on the fly // to send it to Prometheus in the Collect method. // // buckets is a map of upper bounds to cumulative counts, excluding the +Inf // bucket. // // NewConstHistogram returns an error if the length of labelValues is not // consistent with the variable labels in Desc or if Desc is invalid. func NewConstHistogram( desc *Desc, count uint64, sum float64, buckets map[float64]uint64, labelValues ...string, ) (Metric, error) { if desc.err != nil { return nil, desc.err } if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil { return nil, err } return &constHistogram{ desc: desc, count: count, sum: sum, buckets: buckets, labelPairs: makeLabelPairs(desc, labelValues), }, nil } // MustNewConstHistogram is a version of NewConstHistogram that panics where // NewConstMetric would have returned an error. func MustNewConstHistogram( desc *Desc, count uint64, sum float64, buckets map[float64]uint64, labelValues ...string, ) Metric { m, err := NewConstHistogram(desc, count, sum, buckets, labelValues...) if err != nil { panic(err) } return m } type buckSort []*dto.Bucket func (s buckSort) Len() int { return len(s) } func (s buckSort) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s buckSort) Less(i, j int) bool { return s[i].GetUpperBound() < s[j].GetUpperBound() }
{ "pile_set_name": "Github" }
#import <VVBasics/VVBasics.h> #import "VVBuffer.h" /// Convenience class i've been using lately to pass around groups of VVBuffers. this is a relatively new class, we'll see how it goes... /** \ingroup VVBufferPool */ @interface VVBufferAggregate : NSObject { OSSpinLock planeLock; VVBuffer *planes[4]; } /// inits a VVBufferAggregate, retaining the passed buffer in the first plane - (id) initWithBuffer:(VVBuffer *)r; /// inits a VVBufferAggregate, retaining the passed buffers in the first two planes - (id) initWithBuffers:(VVBuffer *)r :(VVBuffer *)g; /// inits a VVBufferAggregate, retaining the passed buffers in the first three planes - (id) initWithBuffers:(VVBuffer *)r :(VVBuffer *)g :(VVBuffer *)b; /// inits a VVBufferAggregate, retaining the passed buffers in each of the four planes - (id) initWithBuffers:(VVBuffer *)r :(VVBuffer *)g :(VVBuffer *)b :(VVBuffer *)a; - (void) generalInit; /// safely returns a retained instance of the buffer in the first plane - (VVBuffer *) copyR; /// safely returns a retained instance of the buffer in the second plane - (VVBuffer *) copyG; /// safely returns a retained instance of the buffer in the third plane - (VVBuffer *) copyB; /// safely returns a retained instance of the buffer in the last plane - (VVBuffer *) copyA; /// safely returns a retained instance of the buffer in the plane at the supplied index - (VVBuffer *) copyBufferAtIndex:(int)i; /// safely inserts the supplied buffer into the plane at the given index - (void) insertBuffer:(VVBuffer *)n atIndex:(int)i; @end
{ "pile_set_name": "Github" }
// HashCon.cpp #include "StdAfx.h" #include "../../../Common/IntToString.h" #include "ConsoleClose.h" #include "HashCon.h" static const wchar_t *kEmptyFileAlias = L"[Content]"; static const char *kScanningMessage = "Scanning"; static HRESULT CheckBreak2() { return NConsoleClose::TestBreakSignal() ? E_ABORT : S_OK; } HRESULT CHashCallbackConsole::CheckBreak() { return CheckBreak2(); } HRESULT CHashCallbackConsole::StartScanning() { if (PrintHeaders && _so) *_so << kScanningMessage << endl; if (NeedPercents()) { _percent.ClearCurState(); _percent.Command = "Scan"; } return CheckBreak2(); } HRESULT CHashCallbackConsole::ScanProgress(const CDirItemsStat &st, const FString &path, bool /* isDir */) { if (NeedPercents()) { _percent.Files = st.NumDirs + st.NumFiles + st.NumAltStreams; _percent.Completed = st.GetTotalBytes(); _percent.FileName = fs2us(path); _percent.Print(); } return CheckBreak2(); } HRESULT CHashCallbackConsole::ScanError(const FString &path, DWORD systemError) { return ScanError_Base(path, systemError); } void Print_DirItemsStat(AString &s, const CDirItemsStat &st); HRESULT CHashCallbackConsole::FinishScanning(const CDirItemsStat &st) { if (NeedPercents()) { _percent.ClosePrint(true); _percent.ClearCurState(); } if (PrintHeaders && _so) { Print_DirItemsStat(_s, st); *_so << _s << endl << endl; } return CheckBreak2(); } HRESULT CHashCallbackConsole::SetNumFiles(UInt64 /* numFiles */) { return CheckBreak2(); } HRESULT CHashCallbackConsole::SetTotal(UInt64 size) { if (NeedPercents()) { _percent.Total = size; _percent.Print(); } return CheckBreak2(); } HRESULT CHashCallbackConsole::SetCompleted(const UInt64 *completeValue) { if (completeValue && NeedPercents()) { _percent.Completed = *completeValue; _percent.Print(); } return CheckBreak2(); } static void AddMinuses(AString &s, unsigned num) { for (unsigned i = 0; i < num; i++) s += '-'; } static void AddSpaces_if_Positive(AString &s, int num) { for (int i = 0; i < num; i++) s.Add_Space(); } static void SetSpacesAndNul(char *s, unsigned num) { for (unsigned i = 0; i < num; i++) s[i] = ' '; s[num] = 0; } static const unsigned kSizeField_Len = 13; static const unsigned kNameField_Len = 12; static const unsigned kHashColumnWidth_Min = 4 * 2; static unsigned GetColumnWidth(unsigned digestSize) { unsigned width = digestSize * 2; return width < kHashColumnWidth_Min ? kHashColumnWidth_Min: width; } void CHashCallbackConsole::PrintSeparatorLine(const CObjectVector<CHasherState> &hashers) { _s.Empty(); for (unsigned i = 0; i < hashers.Size(); i++) { if (i != 0) _s.Add_Space(); const CHasherState &h = hashers[i]; AddMinuses(_s, GetColumnWidth(h.DigestSize)); } if (PrintSize) { _s.Add_Space(); AddMinuses(_s, kSizeField_Len); } if (PrintName) { AddSpacesBeforeName(); AddMinuses(_s, kNameField_Len); } *_so << _s << endl; } HRESULT CHashCallbackConsole::BeforeFirstFile(const CHashBundle &hb) { if (PrintHeaders && _so) { _s.Empty(); ClosePercents_for_so(); FOR_VECTOR (i, hb.Hashers) { if (i != 0) _s.Add_Space(); const CHasherState &h = hb.Hashers[i]; _s += h.Name; AddSpaces_if_Positive(_s, (int)GetColumnWidth(h.DigestSize) - (int)h.Name.Len()); } if (PrintSize) { _s.Add_Space(); const AString s2 = "Size"; AddSpaces_if_Positive(_s, (int)kSizeField_Len - (int)s2.Len()); _s += s2; } if (PrintName) { AddSpacesBeforeName(); _s += "Name"; } *_so << _s << endl; PrintSeparatorLine(hb.Hashers); } return CheckBreak2(); } HRESULT CHashCallbackConsole::OpenFileError(const FString &path, DWORD systemError) { return OpenFileError_Base(path, systemError); } HRESULT CHashCallbackConsole::GetStream(const wchar_t *name, bool /* isFolder */) { _fileName = name; if (NeedPercents()) { if (PrintNameInPercents) { _percent.FileName.Empty(); if (name) _percent.FileName = name; } _percent.Print(); } return CheckBreak2(); } void CHashCallbackConsole::PrintResultLine(UInt64 fileSize, const CObjectVector<CHasherState> &hashers, unsigned digestIndex, bool showHash) { ClosePercents_for_so(); _s.Empty(); FOR_VECTOR (i, hashers) { const CHasherState &h = hashers[i]; char s[k_HashCalc_DigestSize_Max * 2 + 64]; s[0] = 0; if (showHash) AddHashHexToString(s, h.Digests[digestIndex], h.DigestSize); SetSpacesAndNul(s + strlen(s), (int)GetColumnWidth(h.DigestSize) - (int)strlen(s)); if (i != 0) _s.Add_Space(); _s += s; } if (PrintSize) { _s.Add_Space(); char s[kSizeField_Len + 32]; char *p = s; if (showHash) { p = s + kSizeField_Len; ConvertUInt64ToString(fileSize, p); int numSpaces = kSizeField_Len - (int)strlen(p); if (numSpaces > 0) { p -= (unsigned)numSpaces; for (unsigned i = 0; i < (unsigned)numSpaces; i++) p[i] = ' '; } } else SetSpacesAndNul(s, kSizeField_Len); _s += p; } if (PrintName) AddSpacesBeforeName(); *_so << _s; } HRESULT CHashCallbackConsole::SetOperationResult(UInt64 fileSize, const CHashBundle &hb, bool showHash) { if (_so) { PrintResultLine(fileSize, hb.Hashers, k_HashCalc_Index_Current, showHash); if (PrintName) { if (_fileName.IsEmpty()) *_so << kEmptyFileAlias; else *_so << _fileName; } *_so << endl; } if (NeedPercents()) { _percent.Files++; _percent.Print(); } return CheckBreak2(); } static const char *k_DigestTitles[] = { " : " , " for data: " , " for data and names: " , " for streams and names: " }; static void PrintSum(CStdOutStream &so, const CHasherState &h, unsigned digestIndex) { so << h.Name; { AString temp; AddSpaces_if_Positive(temp, 6 - (int)h.Name.Len()); so << temp; } so << k_DigestTitles[digestIndex]; char s[k_HashCalc_DigestSize_Max * 2 + 64]; s[0] = 0; AddHashHexToString(s, h.Digests[digestIndex], h.DigestSize); so << s << endl; } void PrintHashStat(CStdOutStream &so, const CHashBundle &hb) { FOR_VECTOR (i, hb.Hashers) { const CHasherState &h = hb.Hashers[i]; PrintSum(so, h, k_HashCalc_Index_DataSum); if (hb.NumFiles != 1 || hb.NumDirs != 0) PrintSum(so, h, k_HashCalc_Index_NamesSum); if (hb.NumAltStreams != 0) PrintSum(so, h, k_HashCalc_Index_StreamsSum); so << endl; } } void CHashCallbackConsole::PrintProperty(const char *name, UInt64 value) { char s[32]; s[0] = ':'; s[1] = ' '; ConvertUInt64ToString(value, s + 2); *_so << name << s << endl; } HRESULT CHashCallbackConsole::AfterLastFile(const CHashBundle &hb) { ClosePercents2(); if (PrintHeaders && _so) { PrintSeparatorLine(hb.Hashers); PrintResultLine(hb.FilesSize, hb.Hashers, k_HashCalc_Index_DataSum, true); *_so << endl << endl; if (hb.NumFiles != 1 || hb.NumDirs != 0) { if (hb.NumDirs != 0) PrintProperty("Folders", hb.NumDirs); PrintProperty("Files", hb.NumFiles); } PrintProperty("Size", hb.FilesSize); if (hb.NumAltStreams != 0) { PrintProperty("Alternate streams", hb.NumAltStreams); PrintProperty("Alternate streams size", hb.AltStreamsSize); } *_so << endl; PrintHashStat(*_so, hb); } return S_OK; }
{ "pile_set_name": "Github" }
caption: tm-cancel-tiddler created: 20140226193622350 es-title: Mensaje: tm-cancel-tiddler modified: 20160416050616634 tags: Messages navigator-message title: WidgetMessage: tm-cancel-tiddler type: text/vnd.tiddlywiki El mensaje `tm-cancel-tiddler` cancela la edición de un tiddler y abandona los cambios realizados en el borrador. Requiere de las siguientes propiedades del objeto `event`: |!Nombre |!Descripción | |param |Título del tiddler cuya edición se cancela | |tiddlerTitle |Título alternativo usado si no se especifica ''param'' (asignado automáticamente por ButtonWidget) | Este mensaje lo genera normalmente ButtonWidget y lo procesa NavigatorWidget.
{ "pile_set_name": "Github" }
using System; using System.Windows; namespace ConfuserEx { public partial class App : Application { } }
{ "pile_set_name": "Github" }
// Module included in the following assemblies: // // assembly-tls-sidecar.adoc [id='proc-configuring-tls-sidecar-{context}'] = Configuring TLS sidecar .Prerequisites * A Kubernetes cluster * A running Cluster Operator .Procedure . Edit the `tlsSidecar` property in the `Kafka` resource. For example: + [source,yaml,subs=attributes+] ---- apiVersion: {KafkaApiVersion} kind: Kafka metadata: name: my-cluster spec: kafka: # ... zookeeper: # ... entityOperator: # ... tlsSidecar: resources: requests: cpu: 200m memory: 64Mi limits: cpu: 500m memory: 128Mi # ... cruiseControl: # ... tlsSidecar: resources: requests: cpu: 200m memory: 64Mi limits: cpu: 500m memory: 128Mi # ... ---- + . Create or update the resource. + This can be done using `kubectl apply`: [source,shell,subs=+quotes] kubectl apply -f _your-file_
{ "pile_set_name": "Github" }
# get current files directory path QMLC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" export LD_LIBRARY_PATH=$QMLC_DIR/qmcloader:$QMLC_DIR/qmccompiler:$QMLC_DIR/../qtbase/lib:$LD_LIBRARY_PATH export PATH=$QMLC_DIR/../qtbase/bin:$QMLC_DIR/qmc:$QMLC_DIR/tools/qmcloader/:$PATH
{ "pile_set_name": "Github" }
package command import ( "crypto/rand" "encoding/base64" "fmt" "strings" "github.com/mitchellh/cli" ) // KeygenCommand is a Command implementation that generates an encryption // key for use in `serf agent`. type KeygenCommand struct { Ui cli.Ui } var _ cli.Command = &KeygenCommand{} func (c *KeygenCommand) Run(_ []string) int { key := make([]byte, 16) n, err := rand.Reader.Read(key) if err != nil { c.Ui.Error(fmt.Sprintf("Error reading random data: %s", err)) return 1 } if n != 16 { c.Ui.Error(fmt.Sprintf("Couldn't read enough entropy. Generate more entropy!")) return 1 } c.Ui.Output(base64.StdEncoding.EncodeToString(key)) return 0 } func (c *KeygenCommand) Synopsis() string { return "Generates a new encryption key" } func (c *KeygenCommand) Help() string { helpText := ` Usage: serf keygen Generates a new encryption key that can be used to configure the agent to encrypt traffic. The output of this command is already in the proper format that the agent expects. ` return strings.TrimSpace(helpText) }
{ "pile_set_name": "Github" }
# This file is distributed under the same license as the Django package. # msgid "" msgstr "" "Project-Id-Version: Django\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2011-03-15 13:15-0400\n" "PO-Revision-Date: 2011-03-04 18:46+0000\n" "Last-Translator: Jannis <jannis@leidel.info>\n" "Language-Team: Panjabi (Punjabi) <None>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: pa\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" #: wizard.py:176 msgid "" "We apologize, but your form has expired. Please continue filling out the " "form from this page." msgstr ""
{ "pile_set_name": "Github" }
#!/usr/bin/env python """ detector.py is an out-of-the-box windowed detector callable from the command line. By default it configures and runs the Caffe reference ImageNet model. Note that this model was trained for image classification and not detection, and finetuning for detection can be expected to improve results. The selective_search_ijcv_with_python code required for the selective search proposal mode is available at https://github.com/sergeyk/selective_search_ijcv_with_python TODO: - batch up image filenames as well: don't want to load all of them into memory - come up with a batching scheme that preserved order / keeps a unique ID """ import numpy as np import pandas as pd import os import argparse import time import caffe CROP_MODES = ['list', 'selective_search'] COORD_COLS = ['ymin', 'xmin', 'ymax', 'xmax'] def main(argv): pycaffe_dir = os.path.dirname(__file__) parser = argparse.ArgumentParser() # Required arguments: input and output. parser.add_argument( "input_file", help="Input txt/csv filename. If .txt, must be list of filenames.\ If .csv, must be comma-separated file with header\ 'filename, xmin, ymin, xmax, ymax'" ) parser.add_argument( "output_file", help="Output h5/csv filename. Format depends on extension." ) # Optional arguments. parser.add_argument( "--model_def", default=os.path.join(pycaffe_dir, "../models/bvlc_reference_caffenet/deploy.prototxt"), help="Model definition file." ) parser.add_argument( "--pretrained_model", default=os.path.join(pycaffe_dir, "../models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel"), help="Trained model weights file." ) parser.add_argument( "--crop_mode", default="selective_search", choices=CROP_MODES, help="How to generate windows for detection." ) parser.add_argument( "--gpu", action='store_true', help="Switch for gpu computation." ) parser.add_argument( "--mean_file", default=os.path.join(pycaffe_dir, 'caffe/imagenet/ilsvrc_2012_mean.npy'), help="Data set image mean of H x W x K dimensions (numpy array). " + "Set to '' for no mean subtraction." ) parser.add_argument( "--input_scale", type=float, help="Multiply input features by this scale to finish preprocessing." ) parser.add_argument( "--raw_scale", type=float, default=255.0, help="Multiply raw input by this scale before preprocessing." ) parser.add_argument( "--channel_swap", default='2,1,0', help="Order to permute input channels. The default converts " + "RGB -> BGR since BGR is the Caffe default by way of OpenCV." ) parser.add_argument( "--context_pad", type=int, default='16', help="Amount of surrounding context to collect in input window." ) args = parser.parse_args() mean, channel_swap = None, None if args.mean_file: mean = np.load(args.mean_file) if mean.shape[1:] != (1, 1): mean = mean.mean(1).mean(1) if args.channel_swap: channel_swap = [int(s) for s in args.channel_swap.split(',')] if args.gpu: caffe.set_mode_gpu() print("GPU mode") else: caffe.set_mode_cpu() print("CPU mode") # Make detector. detector = caffe.Detector(args.model_def, args.pretrained_model, mean=mean, input_scale=args.input_scale, raw_scale=args.raw_scale, channel_swap=channel_swap, context_pad=args.context_pad) # Load input. t = time.time() print("Loading input...") if args.input_file.lower().endswith('txt'): with open(args.input_file) as f: inputs = [_.strip() for _ in f.readlines()] elif args.input_file.lower().endswith('csv'): inputs = pd.read_csv(args.input_file, sep=',', dtype={'filename': str}) inputs.set_index('filename', inplace=True) else: raise Exception("Unknown input file type: not in txt or csv.") # Detect. if args.crop_mode == 'list': # Unpack sequence of (image filename, windows). images_windows = [ (ix, inputs.iloc[np.where(inputs.index == ix)][COORD_COLS].values) for ix in inputs.index.unique() ] detections = detector.detect_windows(images_windows) else: detections = detector.detect_selective_search(inputs) print("Processed {} windows in {:.3f} s.".format(len(detections), time.time() - t)) # Collect into dataframe with labeled fields. df = pd.DataFrame(detections) df.set_index('filename', inplace=True) df[COORD_COLS] = pd.DataFrame( data=np.vstack(df['window']), index=df.index, columns=COORD_COLS) del(df['window']) # Save results. t = time.time() if args.output_file.lower().endswith('csv'): # csv # Enumerate the class probabilities. class_cols = ['class{}'.format(x) for x in range(NUM_OUTPUT)] df[class_cols] = pd.DataFrame( data=np.vstack(df['feat']), index=df.index, columns=class_cols) df.to_csv(args.output_file, cols=COORD_COLS + class_cols) else: # h5 df.to_hdf(args.output_file, 'df', mode='w') print("Saved to {} in {:.3f} s.".format(args.output_file, time.time() - t)) if __name__ == "__main__": import sys main(sys.argv)
{ "pile_set_name": "Github" }
# richard -- video index system # Copyright (C) 2012, 2013, 2014, 2015 richard contributors. See AUTHORS. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import datetime import json from functools import partial from imp import reload from django.contrib.auth.models import User from django.test import TestCase from django.utils.encoding import smart_text from rest_framework.authtoken.models import Token from . import factories from richard.videos.models import Video from richard.videos import urls as video_urls_module class TestNoAPI(TestCase): def test_api_disabled(self): """Test that disabled api kicks up 404""" with self.settings(API=False): reload(video_urls_module) vid = factories.VideoFactory(state=Video.STATE_LIVE) # anonymous user resp = self.client.get('/api/v2/video/%d/' % vid.pk, {'format': 'json'}) assert resp.status_code == 404 reload(video_urls_module) class TestAPIBase(TestCase): def setUp(self): """Create superuser with API key.""" super(TestAPIBase, self).setUp() user = User.objects.create_superuser( username='api_user', email='api@example.com', password='password') user.save() token = Token.objects.create(user=user) token.save() headers = { 'HTTP_AUTHORIZATION': 'Token {0}'.format(token.key) } self.auth_post = partial(self.client.post, **headers) self.auth_put = partial(self.client.put, **headers) self.auth_get = partial(self.client.get, **headers) class TestCategoryAPI(TestAPIBase): def test_get_category_list(self): """Test that a category can be retrieved.""" factories.CategoryFactory.create_batch(size=3) resp = self.client.get('/api/v2/category/', {'format': 'json'}) assert resp.status_code == 200 content = json.loads(smart_text(resp.content)) assert len(content['results']) == 3 def test_get_category(self): """Test that a category can be retrieved.""" cat = factories.CategoryFactory() resp = self.client.get('/api/v2/category/%s/' % cat.slug, {'format': 'json'}) assert resp.status_code == 200 content = json.loads(smart_text(resp.content)) assert content['title'] == cat.title class TestSpeakerAPI(TestAPIBase): def test_get_speakers_list(self): """Test that a list of speakers can be retrieved.""" factories.SpeakerFactory(name=u'Guido van Rossum') factories.SpeakerFactory(name=u'Raymond Hettinger') resp = self.client.get('/api/v2/speaker/', {'format': 'json'}) assert resp.status_code == 200 content = json.loads(smart_text(resp.content)) assert len(content['results']) == 2 names = set([result['name'] for result in content['results']]) assert names == set([u'Guido van Rossum', u'Raymond Hettinger']) class TestAPI(TestAPIBase): def test_get_video(self): """Test that a video can be retrieved.""" vid = factories.VideoFactory(state=Video.STATE_LIVE) # anonymous user resp = self.client.get('/api/v2/video/%d/' % vid.pk, {'format': 'json'}) assert resp.status_code == 200 assert json.loads(smart_text(resp.content))['title'] == vid.title # authenticated user resp = self.auth_get('/api/v2/video/%d/' % vid.pk, {'format': 'json'}) assert resp.status_code == 200 assert json.loads(smart_text(resp.content))['title'] == vid.title def test_get_video_data(self): cat = factories.CategoryFactory(title=u'Foo Title') vid = factories.VideoFactory(title=u'Foo Bar', category=cat, state=Video.STATE_LIVE) t = factories.TagFactory(tag=u'tag') vid.tags = [t] s = factories.SpeakerFactory(name=u'Jim') vid.speakers = [s] resp = self.client.get('/api/v2/video/%d/' % vid.pk, {'format': 'json'}) assert resp.status_code == 200 content = json.loads(smart_text(resp.content)) assert content['title'] == vid.title assert content['slug'] == 'foo-bar' # This should be the category title--not api url assert content['category'] == cat.title # This should be the tag--not api url assert content['tags'] == [t.tag] # This should be the speaker name--not api url assert content['speakers'] == [s.name] def test_only_live_videos_for_anonymous_users(self): """Test that not authenticated users can't see draft videos.""" vid_live = factories.VideoFactory(state=Video.STATE_LIVE, title=u'Foo') factories.VideoFactory(state=Video.STATE_DRAFT, title=u'Bar') resp = self.client.get('/api/v2/video/', content_type='application/json') data = json.loads(smart_text(resp.content)) assert len(data['results']) == 1 assert data['results'][0]['title'] == vid_live.title def test_all_videos_for_admins(self): """Test that admins can see all videos.""" factories.VideoFactory(state=Video.STATE_LIVE, title=u'Foo') factories.VideoFactory(state=Video.STATE_DRAFT, title=u'Bar') resp = self.auth_get('/api/v2/video/', content_type='application/json') data = json.loads(smart_text(resp.content)) assert len(data['results']) == 2 def test_videos_by_tag(self): tag1 = factories.TagFactory(tag='boat') v1 = factories.VideoFactory(state=Video.STATE_LIVE, title=u'Foo1') v1.tags = [tag1] v1.save() v2 = factories.VideoFactory(state=Video.STATE_LIVE, title=u'Foo2') v2.tags = [tag1] v2.save() factories.VideoFactory(state=Video.STATE_LIVE, title=u'Foo3') resp = self.auth_get('/api/v2/video/?tag=boat', content_type='application/json') data = json.loads(smart_text(resp.content)) assert len(data['results']) == 2 def test_videos_by_speaker(self): speaker1 = factories.SpeakerFactory(name=u'webber') v1 = factories.VideoFactory(state=Video.STATE_LIVE, title=u'Foo1') v1.speakers = [speaker1] v1.save() v2 = factories.VideoFactory(state=Video.STATE_LIVE, title=u'Foo2') v2.speakers = [speaker1] v2.save() factories.VideoFactory(state=Video.STATE_LIVE, title=u'Foo3') # Filter by full name. resp = self.auth_get('/api/v2/video/?speaker=webber', content_type='application/json') data = json.loads(smart_text(resp.content)) assert len(data['results']) == 2 # Filter by partial name. resp = self.auth_get('/api/v2/video/?speaker=web', content_type='application/json') data = json.loads(smart_text(resp.content)) assert len(data['results']) == 2 def test_videos_by_category(self): cat1 = factories.CategoryFactory(slug="pycon-us-2014") cat2 = factories.CategoryFactory(slug="scipy-2013") factories.VideoFactory(state=Video.STATE_LIVE, title=u'Foo1', category=cat1) factories.VideoFactory(state=Video.STATE_LIVE, title=u'Foo2', category=cat1) factories.VideoFactory(state=Video.STATE_LIVE, title=u'Foo3', category=cat2) resp = self.auth_get('/api/v2/video/?category=pycon-us-2014', content_type='application/json') data = json.loads(smart_text(resp.content)) assert len(data['results']) == 2 def test_videos_by_order(self): factories.VideoFactory(state=Video.STATE_LIVE, title=u'FooC', recorded=datetime.datetime(2014, 1, 1, 10, 0)) factories.VideoFactory(state=Video.STATE_LIVE, title=u'FooA', recorded=datetime.datetime(2013, 1, 1, 10, 0)) factories.VideoFactory(state=Video.STATE_LIVE, title=u'FooB', recorded=datetime.datetime(2014, 2, 1, 10, 0)) # Filter by title. resp = self.auth_get('/api/v2/video/?ordering=title', content_type='application/json') data = json.loads(smart_text(resp.content)) assert [v['title'] for v in data['results']] == [u'FooA', u'FooB', u'FooC'] # Filter by recorded. resp = self.auth_get('/api/v2/video/?ordering=recorded', content_type='application/json') data = json.loads(smart_text(resp.content)) assert [v['title'] for v in data['results']] == [u'FooA', u'FooC', u'FooB'] # Filter by added (reverse order). resp = self.auth_get('/api/v2/video/?ordering=-added', content_type='application/json') data = json.loads(smart_text(resp.content)) assert [v['title'] for v in data['results']] == [u'FooB', u'FooA', u'FooC'] class TestVideoPostAPI(TestAPIBase): def test_post_video(self): """Test that authenticated user can create videos.""" cat = factories.CategoryFactory() lang = factories.LanguageFactory(name='English') data = {'title': 'Creating delicious APIs for Django apps since 2010.', 'language': lang.name, 'category': cat.title, 'speakers': ['Guido'], 'tags': ['django', 'api'], 'state': Video.STATE_LIVE} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 201 assert json.loads(smart_text(resp.content))['title'] == data['title'] vid = Video.objects.get(title=data['title']) assert vid.title == data['title'] assert vid.slug == u'creating-delicious-apis-for-django-apps-since-201' assert list(vid.speakers.values_list('name', flat=True)) == ['Guido'] assert ( sorted(vid.tags.values_list('tag', flat=True)) == [u'api', u'django'] ) def test_post_video_no_title(self): """Test that no title throws an error.""" cat = factories.CategoryFactory() data = {'title': '', 'category': cat.title, 'state': Video.STATE_LIVE} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 400 def test_post_with_bad_state(self): """Test that a bad state is rejected""" cat = factories.CategoryFactory() data = {'title': 'test1', 'category': cat.title, 'state': 0} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 400 def test_post_with_used_slug(self): """Test that already used slug creates second video with new slug.""" cat = factories.CategoryFactory() lang = factories.LanguageFactory() factories.VideoFactory(title=u'test1', slug='test1') data = {'title': 'test1', 'category': cat.title, 'language': lang.name, 'state': Video.STATE_DRAFT, 'slug': 'test1'} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 201 def test_put(self): """Test that passing in an id, but no slug with a PUT works.""" cat = factories.CategoryFactory() lang = factories.LanguageFactory() vid = factories.VideoFactory(title=u'test1') data = {'id': vid.pk, 'title': vid.title, 'category': cat.title, 'language': lang.name, 'speakers': ['Guido'], 'tags': ['foo'], 'state': Video.STATE_DRAFT} resp = self.auth_put('/api/v2/video/%d/' % vid.pk, json.dumps(data), content_type='application/json') assert resp.status_code == 200 # Get the video from the db and compare data. vid = Video.objects.get(pk=vid.pk) assert vid.title == u'test1' assert vid.slug == u'test1' assert list(vid.speakers.values_list('name', flat=True)) == ['Guido'] assert list(vid.tags.values_list('tag', flat=True)) == ['foo'] def test_put_fails_with_live_videos(self): """Test that passing in an id, but no slug with a PUT works.""" cat = factories.CategoryFactory() lang = factories.LanguageFactory() vid = factories.VideoFactory(title=u'test1', category=cat, language=lang, state=Video.STATE_LIVE) data = {'id': vid.pk, 'title': 'new title', 'category': cat.title, 'language': lang.name, 'speakers': ['Guido'], 'tags': ['foo'], 'state': Video.STATE_DRAFT} resp = self.auth_put('/api/v2/video/%d/' % vid.pk, json.dumps(data), content_type='application/json') assert resp.status_code == 403 def test_post_with_tag_name(self): """Test that you can post video with url tags or real tags""" cat = factories.CategoryFactory() lang = factories.LanguageFactory() footag = u'footag' data = { 'title': 'test1', 'category': cat.title, 'language': lang.name, 'state': Video.STATE_DRAFT, 'tags': [footag], } resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 201 # Verify the tag vid = Video.objects.get(title=data['title']) assert vid.tags.values_list('tag', flat=True)[0] == footag def test_post_with_bad_tag_string(self): cat = factories.CategoryFactory() data = {'title': 'test1', 'category': cat.title, 'state': Video.STATE_DRAFT} data.update({'tags': ['']}) resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 400 data.update({'tags': ['/api/v2/tag/1']}) resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 400 def test_post_with_speaker_name(self): """Test that you can post videos with speaker names""" cat = factories.CategoryFactory() lang = factories.LanguageFactory() fooperson = u'Carl' data = { 'title': 'test1', 'category': cat.title, 'language': lang.name, 'state': Video.STATE_DRAFT, 'speakers': [fooperson], } resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 201 # Verify the speaker vid = Video.objects.get(title=data['title']) assert vid.speakers.values_list('name', flat=True)[0] == fooperson def test_post_with_speaker_with_extra_spaces(self): """Test that you can post videos with speaker names""" cat = factories.CategoryFactory() lang = factories.LanguageFactory() fooperson = u' Carl ' data = { 'title': 'test1', 'category': cat.title, 'language': lang.name, 'state': Video.STATE_DRAFT, 'speakers': [fooperson], } resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 201 # Verify the speaker vid = Video.objects.get(title=data['title']) assert vid.speakers.values_list('name', flat=True)[0] == fooperson.strip() def test_post_with_bad_speaker_string(self): cat = factories.CategoryFactory() data = {'title': 'test1', 'category': cat.title, 'state': Video.STATE_DRAFT} data.update({'speakers': ['']}) resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 400 data.update({'speakers': ['/api/v2/speaker/1']}) resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 400 def test_post_with_category_title(self): """Test that a category title works""" cat = factories.CategoryFactory(title=u'testcat') lang = factories.LanguageFactory(name='English') data = {'title': 'test1', 'language': lang.name, 'category': cat.title, 'state': Video.STATE_DRAFT, 'slug': 'foo'} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 201 def test_post_with_no_category(self): """Test that lack of category is rejected""" data = {'title': 'test1', 'state': Video.STATE_DRAFT} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 400 def test_post_with_bad_language(self): """Test that a bad state is rejected""" cat = factories.CategoryFactory(title=u'testcat') data = {'title': 'test1', 'category': cat.title, 'state': Video.STATE_DRAFT, 'language': 'lolcats'} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 400 def test_post_video_no_data(self): """Test that an attempt to create a video without data is rejected.""" data = {} resp = self.auth_post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 400 def test_post_video_not_authenticated(self): """Test that not authenticated users can't write.""" cat = factories.CategoryFactory() data = {'title': 'Creating delicious APIs since 2010.', 'category': cat.title, 'state': Video.STATE_LIVE} resp = self.client.post('/api/v2/video/', json.dumps(data), content_type='application/json') assert resp.status_code == 401
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="CppParser"> <UniqueIdentifier>{feecc8db-2005-4073-9897-134f1a5d368a}</UniqueIdentifier> </Filter> <Filter Include="CppParser\Header Files"> <UniqueIdentifier>{3c5eba58-096c-4762-85a4-aaff4c2e8381}</UniqueIdentifier> </Filter> <Filter Include="CppParser\Source Files"> <UniqueIdentifier>{f14475b1-6e34-42e2-af85-c755f0403f00}</UniqueIdentifier> </Filter> <Filter Include="Symbol Table"> <UniqueIdentifier>{dbdd5689-6624-4e94-8ebd-062e4a684ee9}</UniqueIdentifier> </Filter> <Filter Include="Symbol Table\Header Files"> <UniqueIdentifier>{d7f7e09b-4763-4c55-ad39-64cc1b503b0c}</UniqueIdentifier> </Filter> <Filter Include="Symbol Table\Source Files"> <UniqueIdentifier>{cfb18d98-526d-4fbb-914d-6173fe628512}</UniqueIdentifier> </Filter> <Filter Include="Attributes"> <UniqueIdentifier>{708ccd1c-e0d9-4542-aedf-f66534174914}</UniqueIdentifier> </Filter> <Filter Include="Attributes\Header Files"> <UniqueIdentifier>{c6bd7ea6-a4e1-412b-b625-9ebcee5d8a0f}</UniqueIdentifier> </Filter> <Filter Include="Attributes\Source Files"> <UniqueIdentifier>{0773da68-de87-49ec-bd41-ad958eaccbd9}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> <ClInclude Include="include\Poco\CppParser\CppParser.h"> <Filter>CppParser\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\CppToken.h"> <Filter>CppParser\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\Parser.h"> <Filter>CppParser\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\Tokenizer.h"> <Filter>CppParser\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\Utility.h"> <Filter>CppParser\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\BuiltIn.h"> <Filter>Symbol Table\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\Decl.h"> <Filter>Symbol Table\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\Enum.h"> <Filter>Symbol Table\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\EnumValue.h"> <Filter>Symbol Table\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\Function.h"> <Filter>Symbol Table\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\NameSpace.h"> <Filter>Symbol Table\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\Parameter.h"> <Filter>Symbol Table\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\Struct.h"> <Filter>Symbol Table\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\Symbol.h"> <Filter>Symbol Table\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\TypeDef.h"> <Filter>Symbol Table\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\Variable.h"> <Filter>Symbol Table\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\Attributes.h"> <Filter>Attributes\Header Files</Filter> </ClInclude> <ClInclude Include="include\Poco\CppParser\AttributesParser.h"> <Filter>Attributes\Header Files</Filter> </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="src\CppToken.cpp"> <Filter>CppParser\Source Files</Filter> </ClCompile> <ClCompile Include="src\Parser.cpp"> <Filter>CppParser\Source Files</Filter> </ClCompile> <ClCompile Include="src\Tokenizer.cpp"> <Filter>CppParser\Source Files</Filter> </ClCompile> <ClCompile Include="src\Utility.cpp"> <Filter>CppParser\Source Files</Filter> </ClCompile> <ClCompile Include="src\BuiltIn.cpp"> <Filter>Symbol Table\Source Files</Filter> </ClCompile> <ClCompile Include="src\Decl.cpp"> <Filter>Symbol Table\Source Files</Filter> </ClCompile> <ClCompile Include="src\Enum.cpp"> <Filter>Symbol Table\Source Files</Filter> </ClCompile> <ClCompile Include="src\EnumValue.cpp"> <Filter>Symbol Table\Source Files</Filter> </ClCompile> <ClCompile Include="src\Function.cpp"> <Filter>Symbol Table\Source Files</Filter> </ClCompile> <ClCompile Include="src\NameSpace.cpp"> <Filter>Symbol Table\Source Files</Filter> </ClCompile> <ClCompile Include="src\Parameter.cpp"> <Filter>Symbol Table\Source Files</Filter> </ClCompile> <ClCompile Include="src\Struct.cpp"> <Filter>Symbol Table\Source Files</Filter> </ClCompile> <ClCompile Include="src\Symbol.cpp"> <Filter>Symbol Table\Source Files</Filter> </ClCompile> <ClCompile Include="src\TypeDef.cpp"> <Filter>Symbol Table\Source Files</Filter> </ClCompile> <ClCompile Include="src\Variable.cpp"> <Filter>Symbol Table\Source Files</Filter> </ClCompile> <ClCompile Include="src\Attributes.cpp"> <Filter>Attributes\Source Files</Filter> </ClCompile> <ClCompile Include="src\AttributesParser.cpp"> <Filter>Attributes\Source Files</Filter> </ClCompile> </ItemGroup> <ItemGroup> <ResourceCompile Include="..\DLLVersion.rc" /> </ItemGroup> </Project>
{ "pile_set_name": "Github" }
// Copyright Aleksey Gurtovoy 2001-2004 // Copyright David Abrahams 2001-2002 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // Preprocessed version of "boost/mpl/aux_/iter_fold_if_impl.hpp" header // -- DO NOT modify by hand! namespace boost { namespace mpl { namespace aux { template< typename Iterator, typename State > struct iter_fold_if_null_step { typedef State state; typedef Iterator iterator; }; template< bool > struct iter_fold_if_step_impl { template< typename Iterator , typename State , typename StateOp , typename IteratorOp > struct result_ { typedef typename apply2< StateOp,State,Iterator >::type state; typedef typename IteratorOp::type iterator; }; }; template<> struct iter_fold_if_step_impl<false> { template< typename Iterator , typename State , typename StateOp , typename IteratorOp > struct result_ { typedef State state; typedef Iterator iterator; }; }; template< typename Iterator , typename State , typename ForwardOp , typename Predicate > struct iter_fold_if_forward_step { typedef typename apply2< Predicate,State,Iterator >::type not_last; typedef typename iter_fold_if_step_impl< BOOST_MPL_AUX_MSVC_VALUE_WKND(not_last)::value >::template result_< Iterator,State,ForwardOp, mpl::next<Iterator> > impl_; typedef typename impl_::state state; typedef typename impl_::iterator iterator; }; template< typename Iterator , typename State , typename BackwardOp , typename Predicate > struct iter_fold_if_backward_step { typedef typename apply2< Predicate,State,Iterator >::type not_last; typedef typename iter_fold_if_step_impl< BOOST_MPL_AUX_MSVC_VALUE_WKND(not_last)::value >::template result_< Iterator,State,BackwardOp, identity<Iterator> > impl_; typedef typename impl_::state state; typedef typename impl_::iterator iterator; }; template< typename Iterator , typename State , typename ForwardOp , typename ForwardPredicate , typename BackwardOp , typename BackwardPredicate > struct iter_fold_if_impl { private: typedef iter_fold_if_null_step< Iterator,State > forward_step0; typedef iter_fold_if_forward_step< typename forward_step0::iterator, typename forward_step0::state, ForwardOp, ForwardPredicate > forward_step1; typedef iter_fold_if_forward_step< typename forward_step1::iterator, typename forward_step1::state, ForwardOp, ForwardPredicate > forward_step2; typedef iter_fold_if_forward_step< typename forward_step2::iterator, typename forward_step2::state, ForwardOp, ForwardPredicate > forward_step3; typedef iter_fold_if_forward_step< typename forward_step3::iterator, typename forward_step3::state, ForwardOp, ForwardPredicate > forward_step4; typedef typename if_< typename forward_step4::not_last , iter_fold_if_impl< typename forward_step4::iterator , typename forward_step4::state , ForwardOp , ForwardPredicate , BackwardOp , BackwardPredicate > , iter_fold_if_null_step< typename forward_step4::iterator , typename forward_step4::state > >::type backward_step4; typedef iter_fold_if_backward_step< typename forward_step3::iterator, typename backward_step4::state, BackwardOp, BackwardPredicate > backward_step3; typedef iter_fold_if_backward_step< typename forward_step2::iterator, typename backward_step3::state, BackwardOp, BackwardPredicate > backward_step2; typedef iter_fold_if_backward_step< typename forward_step1::iterator, typename backward_step2::state, BackwardOp, BackwardPredicate > backward_step1; typedef iter_fold_if_backward_step< typename forward_step0::iterator, typename backward_step1::state, BackwardOp, BackwardPredicate > backward_step0; public: typedef typename backward_step0::state state; typedef typename backward_step4::iterator iterator; }; }}}
{ "pile_set_name": "Github" }
{ "_args": [ [ { "name": "mime-db", "raw": "mime-db@~1.33.0", "rawSpec": "~1.33.0", "scope": null, "spec": ">=1.33.0 <1.34.0", "type": "range" }, "/Users/pwittroc/Projects/kubebuilder/src/github.com/kubernetes-sigs/kubebuilder/docs/book/node_modules/mime-types" ] ], "_from": "mime-db@>=1.33.0 <1.34.0", "_id": "mime-db@1.33.0", "_inCache": true, "_installable": true, "_location": "/mime-db", "_nodeVersion": "6.13.0", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/mime-db_1.33.0_1518757820140_0.8293249007794938" }, "_npmUser": { "email": "doug@somethingdoug.com", "name": "dougwilson" }, "_npmVersion": "5.6.0", "_phantomChildren": {}, "_requested": { "name": "mime-db", "raw": "mime-db@~1.33.0", "rawSpec": "~1.33.0", "scope": null, "spec": ">=1.33.0 <1.34.0", "type": "range" }, "_requiredBy": [ "/mime-types" ], "_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", "_shasum": "a3492050a5cb9b63450541e39d9788d2272783db", "_shrinkwrap": null, "_spec": "mime-db@~1.33.0", "_where": "/Users/pwittroc/Projects/kubebuilder/src/github.com/kubernetes-sigs/kubebuilder/docs/book/node_modules/mime-types", "bugs": { "url": "https://github.com/jshttp/mime-db/issues" }, "contributors": [ { "email": "doug@somethingdoug.com", "name": "Douglas Christopher Wilson" }, { "email": "me@jongleberry.com", "name": "Jonathan Ong", "url": "http://jongleberry.com" }, { "email": "robert@broofa.com", "name": "Robert Kieffer", "url": "http://github.com/broofa" } ], "dependencies": {}, "description": "Media Type Database", "devDependencies": { "bluebird": "3.5.1", "co": "4.6.0", "cogent": "1.0.1", "csv-parse": "1.3.1", "eslint": "3.19.0", "eslint-config-standard": "10.2.1", "eslint-plugin-import": "2.8.0", "eslint-plugin-node": "5.2.1", "eslint-plugin-promise": "3.6.0", "eslint-plugin-standard": "3.0.1", "gnode": "0.1.2", "mocha": "1.21.5", "nyc": "11.4.1", "raw-body": "2.3.2", "stream-to-array": "2.3.0" }, "directories": {}, "dist": { "fileCount": 6, "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", "shasum": "a3492050a5cb9b63450541e39d9788d2272783db", "tarball": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", "unpackedSize": 168885 }, "engines": { "node": ">= 0.6" }, "files": [ "HISTORY.md", "LICENSE", "README.md", "db.json", "index.js" ], "gitHead": "e7c849b1c70ff745a4ae456a0cd5e6be8b05c2fb", "homepage": "https://github.com/jshttp/mime-db#readme", "keywords": [ "mime", "db", "type", "types", "database", "charset", "charsets" ], "license": "MIT", "maintainers": [ { "email": "doug@somethingdoug.com", "name": "dougwilson" }, { "email": "jonathanrichardong@gmail.com", "name": "jongleberry" } ], "name": "mime-db", "optionalDependencies": {}, "readme": "ERROR: No README data found!", "repository": { "type": "git", "url": "git+https://github.com/jshttp/mime-db.git" }, "scripts": { "build": "node scripts/build", "fetch": "gnode scripts/fetch-apache && gnode scripts/fetch-iana && gnode scripts/fetch-nginx", "lint": "eslint .", "test": "mocha --reporter spec --bail --check-leaks test/", "test-cov": "nyc --reporter=html --reporter=text npm test", "test-travis": "nyc --reporter=text npm test", "update": "npm run fetch && npm run build" }, "version": "1.33.0" }
{ "pile_set_name": "Github" }
# # Copyright 2011 Facebook # # 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. """Miscellaneous network utility code.""" import concurrent.futures import errno import os import sys import socket import ssl import stat from tornado.concurrent import dummy_executor, run_on_executor from tornado.ioloop import IOLoop from tornado.platform.auto import set_close_exec from tornado.util import Configurable, errno_from_exception import typing from typing import List, Callable, Any, Type, Dict, Union, Tuple, Awaitable if typing.TYPE_CHECKING: from asyncio import Future # noqa: F401 # Note that the naming of ssl.Purpose is confusing; the purpose # of a context is to authentiate the opposite side of the connection. _client_ssl_defaults = ssl.create_default_context(ssl.Purpose.SERVER_AUTH) _server_ssl_defaults = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) if hasattr(ssl, "OP_NO_COMPRESSION"): # See netutil.ssl_options_to_context _client_ssl_defaults.options |= ssl.OP_NO_COMPRESSION _server_ssl_defaults.options |= ssl.OP_NO_COMPRESSION # ThreadedResolver runs getaddrinfo on a thread. If the hostname is unicode, # getaddrinfo attempts to import encodings.idna. If this is done at # module-import time, the import lock is already held by the main thread, # leading to deadlock. Avoid it by caching the idna encoder on the main # thread now. u"foo".encode("idna") # For undiagnosed reasons, 'latin1' codec may also need to be preloaded. u"foo".encode("latin1") # These errnos indicate that a non-blocking operation must be retried # at a later time. On most platforms they're the same value, but on # some they differ. _ERRNO_WOULDBLOCK = (errno.EWOULDBLOCK, errno.EAGAIN) if hasattr(errno, "WSAEWOULDBLOCK"): _ERRNO_WOULDBLOCK += (errno.WSAEWOULDBLOCK,) # type: ignore # Default backlog used when calling sock.listen() _DEFAULT_BACKLOG = 128 def bind_sockets( port: int, address: str = None, family: socket.AddressFamily = socket.AF_UNSPEC, backlog: int = _DEFAULT_BACKLOG, flags: int = None, reuse_port: bool = False, ) -> List[socket.socket]: """Creates listening sockets bound to the given port and address. Returns a list of socket objects (multiple sockets are returned if the given address maps to multiple IP addresses, which is most common for mixed IPv4 and IPv6 use). Address may be either an IP address or hostname. If it's a hostname, the server will listen on all IP addresses associated with the name. Address may be an empty string or None to listen on all available interfaces. Family may be set to either `socket.AF_INET` or `socket.AF_INET6` to restrict to IPv4 or IPv6 addresses, otherwise both will be used if available. The ``backlog`` argument has the same meaning as for `socket.listen() <socket.socket.listen>`. ``flags`` is a bitmask of AI_* flags to `~socket.getaddrinfo`, like ``socket.AI_PASSIVE | socket.AI_NUMERICHOST``. ``reuse_port`` option sets ``SO_REUSEPORT`` option for every socket in the list. If your platform doesn't support this option ValueError will be raised. """ if reuse_port and not hasattr(socket, "SO_REUSEPORT"): raise ValueError("the platform doesn't support SO_REUSEPORT") sockets = [] if address == "": address = None if not socket.has_ipv6 and family == socket.AF_UNSPEC: # Python can be compiled with --disable-ipv6, which causes # operations on AF_INET6 sockets to fail, but does not # automatically exclude those results from getaddrinfo # results. # http://bugs.python.org/issue16208 family = socket.AF_INET if flags is None: flags = socket.AI_PASSIVE bound_port = None unique_addresses = set() # type: set for res in sorted( socket.getaddrinfo(address, port, family, socket.SOCK_STREAM, 0, flags), key=lambda x: x[0], ): if res in unique_addresses: continue unique_addresses.add(res) af, socktype, proto, canonname, sockaddr = res if ( sys.platform == "darwin" and address == "localhost" and af == socket.AF_INET6 and sockaddr[3] != 0 ): # Mac OS X includes a link-local address fe80::1%lo0 in the # getaddrinfo results for 'localhost'. However, the firewall # doesn't understand that this is a local address and will # prompt for access (often repeatedly, due to an apparent # bug in its ability to remember granting access to an # application). Skip these addresses. continue try: sock = socket.socket(af, socktype, proto) except socket.error as e: if errno_from_exception(e) == errno.EAFNOSUPPORT: continue raise set_close_exec(sock.fileno()) if os.name != "nt": try: sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) except socket.error as e: if errno_from_exception(e) != errno.ENOPROTOOPT: # Hurd doesn't support SO_REUSEADDR. raise if reuse_port: sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) if af == socket.AF_INET6: # On linux, ipv6 sockets accept ipv4 too by default, # but this makes it impossible to bind to both # 0.0.0.0 in ipv4 and :: in ipv6. On other systems, # separate sockets *must* be used to listen for both ipv4 # and ipv6. For consistency, always disable ipv4 on our # ipv6 sockets and use a separate ipv4 socket when needed. # # Python 2.x on windows doesn't have IPPROTO_IPV6. if hasattr(socket, "IPPROTO_IPV6"): sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1) # automatic port allocation with port=None # should bind on the same port on IPv4 and IPv6 host, requested_port = sockaddr[:2] if requested_port == 0 and bound_port is not None: sockaddr = tuple([host, bound_port] + list(sockaddr[2:])) sock.setblocking(False) sock.bind(sockaddr) bound_port = sock.getsockname()[1] sock.listen(backlog) sockets.append(sock) return sockets if hasattr(socket, "AF_UNIX"): def bind_unix_socket( file: str, mode: int = 0o600, backlog: int = _DEFAULT_BACKLOG ) -> socket.socket: """Creates a listening unix socket. If a socket with the given name already exists, it will be deleted. If any other file with that name exists, an exception will be raised. Returns a socket object (not a list of socket objects like `bind_sockets`) """ sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) set_close_exec(sock.fileno()) try: sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) except socket.error as e: if errno_from_exception(e) != errno.ENOPROTOOPT: # Hurd doesn't support SO_REUSEADDR raise sock.setblocking(False) try: st = os.stat(file) except OSError as err: if errno_from_exception(err) != errno.ENOENT: raise else: if stat.S_ISSOCK(st.st_mode): os.remove(file) else: raise ValueError("File %s exists and is not a socket", file) sock.bind(file) os.chmod(file, mode) sock.listen(backlog) return sock def add_accept_handler( sock: socket.socket, callback: Callable[[socket.socket, Any], None] ) -> Callable[[], None]: """Adds an `.IOLoop` event handler to accept new connections on ``sock``. When a connection is accepted, ``callback(connection, address)`` will be run (``connection`` is a socket object, and ``address`` is the address of the other end of the connection). Note that this signature is different from the ``callback(fd, events)`` signature used for `.IOLoop` handlers. A callable is returned which, when called, will remove the `.IOLoop` event handler and stop processing further incoming connections. .. versionchanged:: 5.0 The ``io_loop`` argument (deprecated since version 4.1) has been removed. .. versionchanged:: 5.0 A callable is returned (``None`` was returned before). """ io_loop = IOLoop.current() removed = [False] def accept_handler(fd: socket.socket, events: int) -> None: # More connections may come in while we're handling callbacks; # to prevent starvation of other tasks we must limit the number # of connections we accept at a time. Ideally we would accept # up to the number of connections that were waiting when we # entered this method, but this information is not available # (and rearranging this method to call accept() as many times # as possible before running any callbacks would have adverse # effects on load balancing in multiprocess configurations). # Instead, we use the (default) listen backlog as a rough # heuristic for the number of connections we can reasonably # accept at once. for i in range(_DEFAULT_BACKLOG): if removed[0]: # The socket was probably closed return try: connection, address = sock.accept() except socket.error as e: # _ERRNO_WOULDBLOCK indicate we have accepted every # connection that is available. if errno_from_exception(e) in _ERRNO_WOULDBLOCK: return # ECONNABORTED indicates that there was a connection # but it was closed while still in the accept queue. # (observed on FreeBSD). if errno_from_exception(e) == errno.ECONNABORTED: continue raise set_close_exec(connection.fileno()) callback(connection, address) def remove_handler() -> None: io_loop.remove_handler(sock) removed[0] = True io_loop.add_handler(sock, accept_handler, IOLoop.READ) return remove_handler def is_valid_ip(ip: str) -> bool: """Returns ``True`` if the given string is a well-formed IP address. Supports IPv4 and IPv6. """ if not ip or "\x00" in ip: # getaddrinfo resolves empty strings to localhost, and truncates # on zero bytes. return False try: res = socket.getaddrinfo( ip, 0, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, socket.AI_NUMERICHOST ) return bool(res) except socket.gaierror as e: if e.args[0] == socket.EAI_NONAME: return False raise return True class Resolver(Configurable): """Configurable asynchronous DNS resolver interface. By default, a blocking implementation is used (which simply calls `socket.getaddrinfo`). An alternative implementation can be chosen with the `Resolver.configure <.Configurable.configure>` class method:: Resolver.configure('tornado.netutil.ThreadedResolver') The implementations of this interface included with Tornado are * `tornado.netutil.DefaultExecutorResolver` * `tornado.netutil.BlockingResolver` (deprecated) * `tornado.netutil.ThreadedResolver` (deprecated) * `tornado.netutil.OverrideResolver` * `tornado.platform.twisted.TwistedResolver` * `tornado.platform.caresresolver.CaresResolver` .. versionchanged:: 5.0 The default implementation has changed from `BlockingResolver` to `DefaultExecutorResolver`. """ @classmethod def configurable_base(cls) -> Type["Resolver"]: return Resolver @classmethod def configurable_default(cls) -> Type["Resolver"]: return DefaultExecutorResolver def resolve( self, host: str, port: int, family: socket.AddressFamily = socket.AF_UNSPEC ) -> Awaitable[List[Tuple[int, Any]]]: """Resolves an address. The ``host`` argument is a string which may be a hostname or a literal IP address. Returns a `.Future` whose result is a list of (family, address) pairs, where address is a tuple suitable to pass to `socket.connect <socket.socket.connect>` (i.e. a ``(host, port)`` pair for IPv4; additional fields may be present for IPv6). If a ``callback`` is passed, it will be run with the result as an argument when it is complete. :raises IOError: if the address cannot be resolved. .. versionchanged:: 4.4 Standardized all implementations to raise `IOError`. .. versionchanged:: 6.0 The ``callback`` argument was removed. Use the returned awaitable object instead. """ raise NotImplementedError() def close(self) -> None: """Closes the `Resolver`, freeing any resources used. .. versionadded:: 3.1 """ pass def _resolve_addr( host: str, port: int, family: socket.AddressFamily = socket.AF_UNSPEC ) -> List[Tuple[int, Any]]: # On Solaris, getaddrinfo fails if the given port is not found # in /etc/services and no socket type is given, so we must pass # one here. The socket type used here doesn't seem to actually # matter (we discard the one we get back in the results), # so the addresses we return should still be usable with SOCK_DGRAM. addrinfo = socket.getaddrinfo(host, port, family, socket.SOCK_STREAM) results = [] for fam, socktype, proto, canonname, address in addrinfo: results.append((fam, address)) return results class DefaultExecutorResolver(Resolver): """Resolver implementation using `.IOLoop.run_in_executor`. .. versionadded:: 5.0 """ async def resolve( self, host: str, port: int, family: socket.AddressFamily = socket.AF_UNSPEC ) -> List[Tuple[int, Any]]: result = await IOLoop.current().run_in_executor( None, _resolve_addr, host, port, family ) return result class ExecutorResolver(Resolver): """Resolver implementation using a `concurrent.futures.Executor`. Use this instead of `ThreadedResolver` when you require additional control over the executor being used. The executor will be shut down when the resolver is closed unless ``close_resolver=False``; use this if you want to reuse the same executor elsewhere. .. versionchanged:: 5.0 The ``io_loop`` argument (deprecated since version 4.1) has been removed. .. deprecated:: 5.0 The default `Resolver` now uses `.IOLoop.run_in_executor`; use that instead of this class. """ def initialize( self, executor: concurrent.futures.Executor = None, close_executor: bool = True ) -> None: self.io_loop = IOLoop.current() if executor is not None: self.executor = executor self.close_executor = close_executor else: self.executor = dummy_executor self.close_executor = False def close(self) -> None: if self.close_executor: self.executor.shutdown() self.executor = None # type: ignore @run_on_executor def resolve( self, host: str, port: int, family: socket.AddressFamily = socket.AF_UNSPEC ) -> List[Tuple[int, Any]]: return _resolve_addr(host, port, family) class BlockingResolver(ExecutorResolver): """Default `Resolver` implementation, using `socket.getaddrinfo`. The `.IOLoop` will be blocked during the resolution, although the callback will not be run until the next `.IOLoop` iteration. .. deprecated:: 5.0 The default `Resolver` now uses `.IOLoop.run_in_executor`; use that instead of this class. """ def initialize(self) -> None: # type: ignore super(BlockingResolver, self).initialize() class ThreadedResolver(ExecutorResolver): """Multithreaded non-blocking `Resolver` implementation. Requires the `concurrent.futures` package to be installed (available in the standard library since Python 3.2, installable with ``pip install futures`` in older versions). The thread pool size can be configured with:: Resolver.configure('tornado.netutil.ThreadedResolver', num_threads=10) .. versionchanged:: 3.1 All ``ThreadedResolvers`` share a single thread pool, whose size is set by the first one to be created. .. deprecated:: 5.0 The default `Resolver` now uses `.IOLoop.run_in_executor`; use that instead of this class. """ _threadpool = None # type: ignore _threadpool_pid = None # type: int def initialize(self, num_threads: int = 10) -> None: # type: ignore threadpool = ThreadedResolver._create_threadpool(num_threads) super(ThreadedResolver, self).initialize( executor=threadpool, close_executor=False ) @classmethod def _create_threadpool( cls, num_threads: int ) -> concurrent.futures.ThreadPoolExecutor: pid = os.getpid() if cls._threadpool_pid != pid: # Threads cannot survive after a fork, so if our pid isn't what it # was when we created the pool then delete it. cls._threadpool = None if cls._threadpool is None: cls._threadpool = concurrent.futures.ThreadPoolExecutor(num_threads) cls._threadpool_pid = pid return cls._threadpool class OverrideResolver(Resolver): """Wraps a resolver with a mapping of overrides. This can be used to make local DNS changes (e.g. for testing) without modifying system-wide settings. The mapping can be in three formats:: { # Hostname to host or ip "example.com": "127.0.1.1", # Host+port to host+port ("login.example.com", 443): ("localhost", 1443), # Host+port+address family to host+port ("login.example.com", 443, socket.AF_INET6): ("::1", 1443), } .. versionchanged:: 5.0 Added support for host-port-family triplets. """ def initialize(self, resolver: Resolver, mapping: dict) -> None: self.resolver = resolver self.mapping = mapping def close(self) -> None: self.resolver.close() def resolve( self, host: str, port: int, family: socket.AddressFamily = socket.AF_UNSPEC ) -> Awaitable[List[Tuple[int, Any]]]: if (host, port, family) in self.mapping: host, port = self.mapping[(host, port, family)] elif (host, port) in self.mapping: host, port = self.mapping[(host, port)] elif host in self.mapping: host = self.mapping[host] return self.resolver.resolve(host, port, family) # These are the keyword arguments to ssl.wrap_socket that must be translated # to their SSLContext equivalents (the other arguments are still passed # to SSLContext.wrap_socket). _SSL_CONTEXT_KEYWORDS = frozenset( ["ssl_version", "certfile", "keyfile", "cert_reqs", "ca_certs", "ciphers"] ) def ssl_options_to_context( ssl_options: Union[Dict[str, Any], ssl.SSLContext] ) -> ssl.SSLContext: """Try to convert an ``ssl_options`` dictionary to an `~ssl.SSLContext` object. The ``ssl_options`` dictionary contains keywords to be passed to `ssl.wrap_socket`. In Python 2.7.9+, `ssl.SSLContext` objects can be used instead. This function converts the dict form to its `~ssl.SSLContext` equivalent, and may be used when a component which accepts both forms needs to upgrade to the `~ssl.SSLContext` version to use features like SNI or NPN. """ if isinstance(ssl_options, ssl.SSLContext): return ssl_options assert isinstance(ssl_options, dict) assert all(k in _SSL_CONTEXT_KEYWORDS for k in ssl_options), ssl_options # Can't use create_default_context since this interface doesn't # tell us client vs server. context = ssl.SSLContext(ssl_options.get("ssl_version", ssl.PROTOCOL_SSLv23)) if "certfile" in ssl_options: context.load_cert_chain( ssl_options["certfile"], ssl_options.get("keyfile", None) ) if "cert_reqs" in ssl_options: context.verify_mode = ssl_options["cert_reqs"] if "ca_certs" in ssl_options: context.load_verify_locations(ssl_options["ca_certs"]) if "ciphers" in ssl_options: context.set_ciphers(ssl_options["ciphers"]) if hasattr(ssl, "OP_NO_COMPRESSION"): # Disable TLS compression to avoid CRIME and related attacks. # This constant depends on openssl version 1.0. # TODO: Do we need to do this ourselves or can we trust # the defaults? context.options |= ssl.OP_NO_COMPRESSION return context def ssl_wrap_socket( socket: socket.socket, ssl_options: Union[Dict[str, Any], ssl.SSLContext], server_hostname: str = None, **kwargs: Any ) -> ssl.SSLSocket: """Returns an ``ssl.SSLSocket`` wrapping the given socket. ``ssl_options`` may be either an `ssl.SSLContext` object or a dictionary (as accepted by `ssl_options_to_context`). Additional keyword arguments are passed to ``wrap_socket`` (either the `~ssl.SSLContext` method or the `ssl` module function as appropriate). """ context = ssl_options_to_context(ssl_options) if ssl.HAS_SNI: # In python 3.4, wrap_socket only accepts the server_hostname # argument if HAS_SNI is true. # TODO: add a unittest (python added server-side SNI support in 3.4) # In the meantime it can be manually tested with # python3 -m tornado.httpclient https://sni.velox.ch return context.wrap_socket(socket, server_hostname=server_hostname, **kwargs) else: return context.wrap_socket(socket, **kwargs)
{ "pile_set_name": "Github" }
specific_include_rules = { "run_all_unittests\.cc": [ "+mojo/edk/embedder/embedder.h", "+ui/base/resource/resource_bundle.h", "+ui/base/ui_base_paths.h", ], }
{ "pile_set_name": "Github" }
<?xml version="1.0" ?> <InviwoWorkspace version="2"> <InviwoSetup> <Modules> <Module name="Core" version="0"> <Processors> <Processor content="org.inviwo.Image.outport.metasource" /> <Processor content="org.inviwo.Image.outport.metasink" /> <Processor content="org.inviwo.CompositeProcessor" /> <Processor content="org.inviwo.Mesh.outport.metasink" /> <Processor content="org.inviwo.Mesh.outport.metasource" /> <Processor content="org.inviwo.Volume.outport.metasink" /> <Processor content="org.inviwo.Volume.outport.metasource" /> <Processor content="org.inviwo.Volume.shared_ptr.vector.outport.metasink" /> <Processor content="org.inviwo.Volume.shared_ptr.vector.outport.metasource" /> <Processor content="org.inviwo.Buffer.outport.metasink" /> <Processor content="org.inviwo.Buffer.outport.metasource" /> <Processor content="org.inviwo.LightSource.outport.metasink" /> <Processor content="org.inviwo.LightSource.outport.metasource" /> <Processor content="org.inviwo.FLOAT32.outport.metasink" /> <Processor content="org.inviwo.FLOAT32.outport.metasource" /> <Processor content="org.inviwo.FLOAT32.vector.outport.metasink" /> <Processor content="org.inviwo.FLOAT32.vector.outport.metasource" /> <Processor content="org.inviwo.Vec2FLOAT32.outport.metasink" /> <Processor content="org.inviwo.Vec2FLOAT32.outport.metasource" /> <Processor content="org.inviwo.Vec2FLOAT32.vector.outport.metasink" /> <Processor content="org.inviwo.Vec2FLOAT32.vector.outport.metasource" /> <Processor content="org.inviwo.Vec3FLOAT32.outport.metasink" /> <Processor content="org.inviwo.Vec3FLOAT32.outport.metasource" /> <Processor content="org.inviwo.Vec3FLOAT32.vector.outport.metasink" /> <Processor content="org.inviwo.Vec3FLOAT32.vector.outport.metasource" /> <Processor content="org.inviwo.Vec4FLOAT32.outport.metasink" /> <Processor content="org.inviwo.Vec4FLOAT32.outport.metasource" /> <Processor content="org.inviwo.Vec4FLOAT32.vector.outport.metasink" /> <Processor content="org.inviwo.Vec4FLOAT32.vector.outport.metasource" /> <Processor content="org.inviwo.FLOAT64.outport.metasink" /> <Processor content="org.inviwo.FLOAT64.outport.metasource" /> <Processor content="org.inviwo.FLOAT64.vector.outport.metasink" /> <Processor content="org.inviwo.FLOAT64.vector.outport.metasource" /> <Processor content="org.inviwo.Vec2FLOAT64.outport.metasink" /> <Processor content="org.inviwo.Vec2FLOAT64.outport.metasource" /> <Processor content="org.inviwo.Vec2FLOAT64.vector.outport.metasink" /> <Processor content="org.inviwo.Vec2FLOAT64.vector.outport.metasource" /> <Processor content="org.inviwo.Vec3FLOAT64.outport.metasink" /> <Processor content="org.inviwo.Vec3FLOAT64.outport.metasource" /> <Processor content="org.inviwo.Vec3FLOAT64.vector.outport.metasink" /> <Processor content="org.inviwo.Vec3FLOAT64.vector.outport.metasource" /> <Processor content="org.inviwo.Vec4FLOAT64.outport.metasink" /> <Processor content="org.inviwo.Vec4FLOAT64.outport.metasource" /> <Processor content="org.inviwo.Vec4FLOAT64.vector.outport.metasink" /> <Processor content="org.inviwo.Vec4FLOAT64.vector.outport.metasource" /> <Processor content="org.inviwo.INT32.outport.metasink" /> <Processor content="org.inviwo.INT32.outport.metasource" /> <Processor content="org.inviwo.INT32.vector.outport.metasink" /> <Processor content="org.inviwo.INT32.vector.outport.metasource" /> <Processor content="org.inviwo.Vec2INT32.outport.metasink" /> <Processor content="org.inviwo.Vec2INT32.outport.metasource" /> <Processor content="org.inviwo.Vec2INT32.vector.outport.metasink" /> <Processor content="org.inviwo.Vec2INT32.vector.outport.metasource" /> <Processor content="org.inviwo.Vec3INT32.outport.metasink" /> <Processor content="org.inviwo.Vec3INT32.outport.metasource" /> <Processor content="org.inviwo.Vec3INT32.vector.outport.metasink" /> <Processor content="org.inviwo.Vec3INT32.vector.outport.metasource" /> <Processor content="org.inviwo.Vec4INT32.outport.metasink" /> <Processor content="org.inviwo.Vec4INT32.outport.metasource" /> <Processor content="org.inviwo.Vec4INT32.vector.outport.metasink" /> <Processor content="org.inviwo.Vec4INT32.vector.outport.metasource" /> <Processor content="org.inviwo.UINT32.outport.metasink" /> <Processor content="org.inviwo.UINT32.outport.metasource" /> <Processor content="org.inviwo.UINT32.vector.outport.metasink" /> <Processor content="org.inviwo.UINT32.vector.outport.metasource" /> <Processor content="org.inviwo.Vec2UINT32.outport.metasink" /> <Processor content="org.inviwo.Vec2UINT32.outport.metasource" /> <Processor content="org.inviwo.Vec2UINT32.vector.outport.metasink" /> <Processor content="org.inviwo.Vec2UINT32.vector.outport.metasource" /> <Processor content="org.inviwo.Vec3UINT32.outport.metasink" /> <Processor content="org.inviwo.Vec3UINT32.outport.metasource" /> <Processor content="org.inviwo.Vec3UINT32.vector.outport.metasink" /> <Processor content="org.inviwo.Vec3UINT32.vector.outport.metasource" /> <Processor content="org.inviwo.Vec4UINT32.outport.metasink" /> <Processor content="org.inviwo.Vec4UINT32.outport.metasource" /> <Processor content="org.inviwo.Vec4UINT32.vector.outport.metasink" /> <Processor content="org.inviwo.Vec4UINT32.vector.outport.metasource" /> <Processor content="org.inviwo.INT64.outport.metasink" /> <Processor content="org.inviwo.INT64.outport.metasource" /> <Processor content="org.inviwo.INT64.vector.outport.metasink" /> <Processor content="org.inviwo.INT64.vector.outport.metasource" /> <Processor content="org.inviwo.Vec2INT64.outport.metasink" /> <Processor content="org.inviwo.Vec2INT64.outport.metasource" /> <Processor content="org.inviwo.Vec2INT64.vector.outport.metasink" /> <Processor content="org.inviwo.Vec2INT64.vector.outport.metasource" /> <Processor content="org.inviwo.Vec3INT64.outport.metasink" /> <Processor content="org.inviwo.Vec3INT64.outport.metasource" /> <Processor content="org.inviwo.Vec3INT64.vector.outport.metasink" /> <Processor content="org.inviwo.Vec3INT64.vector.outport.metasource" /> <Processor content="org.inviwo.Vec4INT64.outport.metasink" /> <Processor content="org.inviwo.Vec4INT64.outport.metasource" /> <Processor content="org.inviwo.Vec4INT64.vector.outport.metasink" /> <Processor content="org.inviwo.Vec4INT64.vector.outport.metasource" /> <Processor content="org.inviwo.UINT64.outport.metasink" /> <Processor content="org.inviwo.UINT64.outport.metasource" /> <Processor content="org.inviwo.UINT64.vector.outport.metasink" /> <Processor content="org.inviwo.UINT64.vector.outport.metasource" /> <Processor content="org.inviwo.Vec2UINT64.outport.metasink" /> <Processor content="org.inviwo.Vec2UINT64.outport.metasource" /> <Processor content="org.inviwo.Vec2UINT64.vector.outport.metasink" /> <Processor content="org.inviwo.Vec2UINT64.vector.outport.metasource" /> <Processor content="org.inviwo.Vec3UINT64.outport.metasink" /> <Processor content="org.inviwo.Vec3UINT64.outport.metasource" /> <Processor content="org.inviwo.Vec3UINT64.vector.outport.metasink" /> <Processor content="org.inviwo.Vec3UINT64.vector.outport.metasource" /> <Processor content="org.inviwo.Vec4UINT64.outport.metasink" /> <Processor content="org.inviwo.Vec4UINT64.outport.metasource" /> <Processor content="org.inviwo.Vec4UINT64.vector.outport.metasink" /> <Processor content="org.inviwo.Vec4UINT64.vector.outport.metasource" /> <Processor content="org.inviwo.CompositeProcessorCdevinviwoinviwodataworkspacescompositesVolumeRaycasterCompositeinv" /> </Processors> </Module> <Module name="OpenGL" version="0"> <Processors> <Processor content="org.inviwo.CanvasGL" /> </Processors> </Module> <Module name="Base" version="4"> <Processors> <Processor content="org.inviwo.ConvexHull2DProcessor" /> <Processor content="org.inviwo.CubeProxyGeometry" /> <Processor content="org.inviwo.Diffuselightsource" /> <Processor content="org.inviwo.Directionallightsource" /> <Processor content="org.inviwo.DistanceTransformRAM" /> <Processor content="org.inviwo.GeometrySource" /> <Processor content="org.inviwo.HeightFieldMapper" /> <Processor content="org.inviwo.ImageExport" /> <Processor content="org.inviwo.ImageInformation" /> <Processor content="org.inviwo.ImageSnapshot" /> <Processor content="org.inviwo.ImageSource" /> <Processor content="org.inviwo.ImageSourceSeries" /> <Processor content="org.inviwo.ImageStackVolumeSource" /> <Processor content="org.inviwo.LayerDistanceTransformRAM" /> <Processor content="org.inviwo.MeshClipping" /> <Processor content="org.inviwo.MeshColorFromNormals" /> <Processor content="org.inviwo.MeshCreator" /> <Processor content="org.inviwo.MeshInformation" /> <Processor content="org.inviwo.MeshMapping" /> <Processor content="org.inviwo.MeshPlaneClipping" /> <Processor content="org.inviwo.NoiseProcessor" /> <Processor content="org.inviwo.PixelToBufferProcessor" /> <Processor content="org.inviwo.Pointlightsource" /> <Processor content="org.inviwo.OrdinalPropertyAnimator" /> <Processor content="org.inviwo.Spotlightsource" /> <Processor content="org.inviwo.SurfaceExtraction" /> <Processor content="org.inviwo.VolumeBoundaryPlanes" /> <Processor content="org.inviwo.VolumeSource" /> <Processor content="org.inviwo.VolumeExport" /> <Processor content="org.inviwo.BasisTransformGeometry" /> <Processor content="org.inviwo.BasisTransformVolume" /> <Processor content="org.inviwo.TrianglesToWireframe" /> <Processor content="org.inviwo.TransformMesh" /> <Processor content="org.inviwo.TransformVolume" /> <Processor content="org.inviwo.VolumeConverter" /> <Processor content="org.inviwo.WorldTransformMeshDeprecated" /> <Processor content="org.inviwo.WorldTransformVolumeDeprecated" /> <Processor content="org.inviwo.VolumeSlice" /> <Processor content="org.inviwo.VolumeSubsample" /> <Processor content="org.inviwo.VolumeSubset" /> <Processor content="org.inviwo.ImageContourProcessor" /> <Processor content="org.inviwo.VolumeVectorSource" /> <Processor content="org.inviwo.TimeStepSelector" /> <Processor content="org.inviwo.ImageTimeStepSelector" /> <Processor content="org.inviwo.MeshTimeStepSelector" /> <Processor content="org.inviwo.VolumeBoundingBox" /> <Processor content="org.inviwo.SingleVoxel" /> <Processor content="org.inviwo.StereoCameraSyncer" /> <Processor content="org.inviwo.VolumeToSpatialSampler" /> <Processor content="org.inviwo.OrientationIndicator" /> <Processor content="org.inviwo.PixelValue" /> <Processor content="org.inviwo.VolumeSequenceToSpatial4DSampler" /> <Processor content="org.inviwo.VolumeGradientCPUProcessor" /> <Processor content="org.inviwo.VolumeCurlCPUProcessor" /> <Processor content="org.inviwo.VolumeDivergenceCPUProcessor" /> <Processor content="org.inviwo.VolumeLaplacianProcessor" /> <Processor content="org.inviwo.MeshExport" /> <Processor content="org.inviwo.RandomMeshGenerator" /> <Processor content="org.inviwo.RandomSphereGenerator" /> <Processor content="org.inviwo.NoiseVolumeProcessor" /> <Processor content="org.inviwo.BufferToMeshProcessor" /> <Processor content="org.inviwo.ImageToSpatialSampler" /> <Processor content="org.inviwo.CameraFrustum" /> <Processor content="org.inviwo.VolumeSequenceSingleTimestepSampler" /> <Processor content="org.inviwo.VolumeCreator" /> <Processor content="org.inviwo.MeshConverter" /> <Processor content="org.inviwo.VolumeInformation" /> <Processor content="org.inviwo.TFSelector" /> <Processor content="org.inviwo.VolumeShifter" /> <Processor content="org.inviwo.Volume.InputSelector" /> <Processor content="org.inviwo.Mesh.InputSelector" /> <Processor content="org.inviwo.Image.InputSelector" /> </Processors> </Module> <Module name="BrushingAndLinking" version="0"> <Processors> <Processor content="org.inviwo.BrushingAndLinkingProcessor" /> </Processors> </Module> <Module name="BaseGL" version="4"> <Processors> <Processor content="org.inviwo.AxisAlignedCutPlane" /> <Processor content="org.inviwo.Background" /> <Processor content="org.inviwo.CubeRenderer" /> <Processor content="org.inviwo.DrawLines" /> <Processor content="org.inviwo.DrawPoints" /> <Processor content="org.inviwo.EmbeddedVolumeSlice" /> <Processor content="org.inviwo.EntryExitPoints" /> <Processor content="org.inviwo.FirstIVWProcessor" /> <Processor content="org.inviwo.GeometryEntryExitPoints" /> <Processor content="org.inviwo.HeightFieldRenderGL" /> <Processor content="org.inviwo.ImageCompositeProcessorGL" /> <Processor content="org.inviwo.ImageLayoutGL" /> <Processor content="org.inviwo.ImageMixer" /> <Processor content="org.inviwo.ImageOverlayGL" /> <Processor content="org.inviwo.ISORaycaster" /> <Processor content="org.inviwo.Jacobian2D" /> <Processor content="org.inviwo.LightingRaycaster" /> <Processor content="org.inviwo.LightVolumeGL" /> <Processor content="org.inviwo.LineRenderer" /> <Processor content="org.inviwo.Mesh2DRenderProcessorGL" /> <Processor content="org.inviwo.GeometryPicking" /> <Processor content="org.inviwo.GeometryRenderGL" /> <Processor content="org.inviwo.MultichannelRaycaster" /> <Processor content="org.inviwo.PointRenderer" /> <Processor content="org.inviwo.RedGreenProcessor" /> <Processor content="org.inviwo.SphereRenderer" /> <Processor content="org.inviwo.TubeRendering" /> <Processor content="org.inviwo.VolumeRaycaster" /> <Processor content="org.inviwo.VolumeSliceGL" /> <Processor content="org.inviwo.FindEdges" /> <Processor content="org.inviwo.ImageBinary" /> <Processor content="org.inviwo.ImageChannelCombine" /> <Processor content="org.inviwo.ImageChannelSelect" /> <Processor content="org.inviwo.ImageGamma" /> <Processor content="org.inviwo.ImageGradient" /> <Processor content="org.inviwo.ImageGrayscale" /> <Processor content="org.inviwo.ImageHighPass" /> <Processor content="org.inviwo.ImageInvert" /> <Processor content="org.inviwo.ImageLayer" /> <Processor content="org.inviwo.ImageLowPass" /> <Processor content="org.inviwo.ImageMapping" /> <Processor content="org.inviwo.ImageNormalization" /> <Processor content="org.inviwo.ImageResample" /> <Processor content="org.inviwo.ImageScaling" /> <Processor content="org.inviwo.ImageSubsetGL" /> <Processor content="org.inviwo.SplitImage" /> <Processor content="org.inviwo.VectorMagnitude" /> <Processor content="org.inviwo.VolumeBinary" /> <Processor content="org.inviwo.VolumeCombiner" /> <Processor content="org.inviwo.VolumeDiff" /> <Processor content="org.inviwo.VolumeGradientMagnitude" /> <Processor content="org.inviwo.VolumeGradient" /> <Processor content="org.inviwo.VolumeLowPass" /> <Processor content="org.inviwo.VolumeMapping" /> <Processor content="org.inviwo.VolumeMerger" /> <Processor content="org.inviwo.VolumeShader" /> </Processors> </Module> <Module name="CImg" version="0" /> <Module name="QtWidgets" version="0" /> <Module name="assimp" version="0" /> <Module name="OpenGLQt" version="0" /> <Module name="JSON" version="0" /> <Module name="DataFrame" version="0"> <Processors> <Processor content="org.inviwo.CSVSource" /> <Processor content="org.inviwo.DataFrameJoin" /> <Processor content="org.inviwo.DataFrameSource" /> <Processor content="org.inviwo.DataFrameExporter" /> <Processor content="org.inviwo.DataFrameFloat32Converter" /> <Processor content="org.inviwo.ImageToDataFrame" /> <Processor content="org.inviwo.SyntheticDataFrame" /> <Processor content="org.inviwo.VolumeToDataFrame" /> <Processor content="org.inviwo.VolumeSequenceToDataFrame" /> <Processor content="org.inviwo.DataFrame.outport.metasink" /> <Processor content="org.inviwo.DataFrame.outport.metasource" /> </Processors> </Module> <Module name="Python3" version="0"> <Processors> <Processor content="org.inviwo.FlickrImport" /> <Processor content="org.inviwo.PythonExample" /> <Processor content="org.inviwo.VolumeTest" /> <Processor content="org.inviwo.NumPyVolume" /> <Processor content="org.inviwo.NumpyMandelbrot" /> <Processor content="org.inviwo.NumPyMeshCreateTest" /> <Processor content="org.inviwo.PythonScriptProcessor" /> </Processors> </Module> <Module name="EigenUtils" version="0"> <Processors> <Processor content="org.inviwo.EigenMatrixToImage" /> <Processor content="org.inviwo.EigenMix" /> <Processor content="org.inviwo.EigenNormalize" /> <Processor content="org.inviwo.TestMatrix" /> <Processor content="EigenMatrixXf.outport.metasink" /> <Processor content="EigenMatrixXf.outport.metasource" /> </Processors> </Module> <Module name="FontRendering" version="3"> <Processors> <Processor content="org.inviwo.TextOverlayGL" /> </Processors> </Module> <Module name="Nifti" version="0" /> <Module name="Plotting" version="1"> <Processors> <Processor content="org.inviwo.DataFrameColumnToColorVector" /> </Processors> </Module> <Module name="UserInterfaceGL" version="0"> <Processors> <Processor content="org.inviwo.CameraWidget" /> <Processor content="org.inviwo.CropWidget" /> <Processor content="org.inviwo.GLUIProcessor" /> <Processor content="org.inviwo.PresentationProcessor" /> <Processor content="org.inviwo.GLUITestProcessor" /> </Processors> </Module> <Module name="PlottingGL" version="2"> <Processors> <Processor content="org.inviwo.AxisRenderProcessor" /> <Processor content="org.inviwo.ColorScaleLegend" /> <Processor content="org.inviwo.ImagePlotProcessor" /> <Processor content="org.inviwo.ParallelCoordinates" /> <Processor content="org.inviwo.PersistenceDiagramPlotProcessor" /> <Processor content="org.inviwo.ScatterPlotMatrixProcessor" /> <Processor content="org.inviwo.ScatterPlotProcessor" /> <Processor content="org.inviwo.VolumeAxis" /> </Processors> </Module> <Module name="png" version="0" /> <Module name="PostProcessing" version="0"> <Processors> <Processor content="org.inviwo.DepthOfField" /> <Processor content="org.inviwo.SSAO" /> <Processor content="org.inviwo.FXAA" /> <Processor content="org.inviwo.Fog" /> <Processor content="org.inviwo.Tonemapping" /> <Processor content="org.inviwo.HdrBloom" /> <Processor content="org.inviwo.ImageBrightnessContrast" /> <Processor content="org.inviwo.ImageEdgeDarken" /> <Processor content="org.inviwo.DepthDarkening" /> <Processor content="org.inviwo.ImageHueSaturationLuminance" /> <Processor content="org.inviwo.ImageFilter" /> <Processor content="org.inviwo.ImageOpacity" /> </Processors> </Module> <Module name="PVM" version="0" /> <Module name="Python3Qt" version="0" /> <Module name="VectorFieldVisualization" version="4"> <Processors> <Processor content="org.inviwo.RBFVectorFieldGenerator2D" /> <Processor content="org.inviwo.RBFBased3DVectorFieldGenerator" /> <Processor content="org.inviwo.SeedPointGenerator3D" /> <Processor content="org.inviwo.SeedPointsFromMask" /> <Processor content="org.inviwo.StreamLinesDeprecated" /> <Processor content="org.inviwo.PathLinesDeprecated" /> <Processor content="org.inviwo.StreamRibbonsDeprecated" /> <Processor content="org.inviwo.IntegralLineVectorToMesh" /> <Processor content="org.inviwo.Seed3Dto4D" /> <Processor content="org.inviwo.StreamLines2D" /> <Processor content="org.inviwo.StreamLines3D" /> <Processor content="org.inviwo.PathLines3D" /> <Processor content="org.inviwo.SeedsFromMaskSequence" /> <Processor content="org.inviwo.DiscardShortLines" /> <Processor content="org.inviwo.SeedPointGenerator2D" /> <Processor content="org.inviwo.IntegralLineSetSelector" /> <Processor content="org.inviwo.IntegralLineSet.outport.metasink" /> <Processor content="org.inviwo.IntegralLineSet.outport.metasource" /> </Processors> </Module> <Module name="VectorFieldVisualizationGL" version="1"> <Processors> <Processor content="org.inviwo.LorenzSystem" /> <Processor content="org.inviwo.VectorFieldGenerator2D" /> <Processor content="org.inviwo.VectorFieldGenerator3D" /> <Processor content="org.inviwo.LIC2D" /> <Processor content="org.inviwo.HedgeHog2D" /> <Processor content="org.inviwo.Vector2DMagnitude" /> <Processor content="org.inviwo.Vector2DCurl" /> <Processor content="org.inviwo.Vector2DDivergence" /> <Processor content="org.inviwo.LIC3D" /> <Processor content="org.inviwo.Vector3DCurl" /> <Processor content="org.inviwo.Vector3DDivergence" /> <Processor content="org.inviwo.TMIP" /> <Processor content="org.inviwo.VectorFieldGenerator4D" /> <Processor content="org.inviwo.StreamParticles" /> </Processors> </Module> <Module name="WebBrowser" version="0"> <Processors> <Processor content="org.inviwo.webbrowser" /> </Processors> </Module> </Modules> </InviwoSetup> <ProcessorNetwork> <ProcessorNetworkVersion content="17" /> <Processors> <Processor type="org.inviwo.NumPyMeshCreateTest" identifier="Num Py Mesh Create Test" displayName="NumPy Mesh Create Test"> <PortGroups> <PortGroup content="default" key="mesh" /> </PortGroups> <OutPorts> <OutPort type="org.inviwo.Mesh.outport" identifier="mesh" id="ref2" /> </OutPorts> <MetaDataMap> <MetaDataItem type="org.inviwo.ProcessorMetaData" key="org.inviwo.ProcessorMetaData"> <position x="50" y="250" /> <visibility content="1" /> <selection content="0" /> </MetaDataItem> </MetaDataMap> </Processor> <Processor type="org.inviwo.Background" identifier="Background" displayName="Background"> <PortGroups> <PortGroup content="default" key="inport" /> <PortGroup content="default" key="outport" /> </PortGroups> <InPorts> <InPort type="org.inviwo.Image.inport" identifier="inport" id="ref0" /> </InPorts> <OutPorts> <OutPort type="org.inviwo.Image.outport" identifier="outport" id="ref1" /> </OutPorts> <Properties> <Property type="org.inviwo.OptionPropertyEnumInt" identifier="backgroundStyle" /> <Property type="org.inviwo.FloatVec4Property" identifier="bgColor1"> <semantics semantics="Color" /> <value x="1" y="1" z="1" w="1" /> </Property> <Property type="org.inviwo.FloatVec4Property" identifier="bgColor2"> <semantics semantics="Color" /> <value x="0" y="0" z="0" w="1" /> </Property> <Property type="org.inviwo.IntVec2Property" identifier="checkerBoardSize"> <visible content="0" /> </Property> <Property type="org.inviwo.ButtonProperty" identifier="switchColors" /> <Property type="org.inviwo.OptionPropertyEnumInt" identifier="blendMode" /> </Properties> <MetaDataMap> <MetaDataItem type="org.inviwo.ProcessorMetaData" key="org.inviwo.ProcessorMetaData"> <position x="50" y="400" /> <visibility content="1" /> <selection content="0" /> </MetaDataItem> </MetaDataMap> </Processor> <Processor type="org.inviwo.GeometryRenderGL" identifier="Mesh Renderer" displayName="Mesh Renderer"> <PortGroups> <PortGroup content="default" key="geometry" /> <PortGroup content="default" key="image" /> <PortGroup content="default" key="imageInport" /> </PortGroups> <InPorts> <InPort type="org.inviwo.Mesh.flat.multi.inport" identifier="geometry" id="ref3" /> <InPort type="org.inviwo.Image.inport" identifier="imageInport" /> </InPorts> <OutPorts> <OutPort type="org.inviwo.Image.outport" identifier="image" id="ref4" /> </OutPorts> <Properties> <Property type="org.inviwo.CameraProperty" identifier="camera"> <Properties> <Property type="org.inviwo.OptionPropertyString" identifier="cameraType" /> <Property type="org.inviwo.ButtonGroupProperty" identifier="actions" /> <Property type="org.inviwo.FloatVec3RefProperty" identifier="lookFrom"> <semantics semantics="Default" /> <MetaDataMap> <MetaDataItem type="org.inviwo.StringStringStdUnorderedMapMetaData" key="SavedState" /> </MetaDataMap> </Property> <Property type="org.inviwo.FloatVec3RefProperty" identifier="lookTo" /> <Property type="org.inviwo.FloatVec3RefProperty" identifier="lookUp" /> <Property type="org.inviwo.FloatRefProperty" identifier="aspectRatio" /> <Property type="org.inviwo.FloatRefProperty" identifier="near" /> <Property type="org.inviwo.FloatRefProperty" identifier="far" /> <Property type="org.inviwo.FloatRefProperty" identifier="fov"> <minvalue content="10" /> </Property> <Property type="org.inviwo.CompositeProperty" identifier="settings"> <Properties> <Property type="org.inviwo.ButtonProperty" identifier="setNearFarButton" /> <Property type="org.inviwo.ButtonProperty" identifier="setLookRangesButton" /> <Property type="org.inviwo.BoolProperty" identifier="updateNearFar" /> <Property type="org.inviwo.BoolProperty" identifier="updateLookRanges" /> <Property type="org.inviwo.FloatProperty" identifier="fittingRatio" /> </Properties> </Property> </Properties> <collapsed content="1" /> <Camera type="PerspectiveCamera"> <lookFrom x="-1.1014755" y="-1.8609421" z="2.7157915" /> <lookTo x="-0.26626539" y="0.11066628" z="-0.13178881" /> <lookUp x="0.2161299" y="-0.81752419" z="-0.53379959" /> <near content="0.1" /> <far content="100" /> <aspectRatio content="1" /> <fov content="60" /> </Camera> </Property> <Property type="org.inviwo.CompositeProperty" identifier="geometry"> <Properties> <Property type="org.inviwo.OptionPropertyInt" identifier="cullFace" /> <Property type="org.inviwo.BoolProperty" identifier="enableDepthTest_"> <value content="0" /> </Property> <Property type="org.inviwo.BoolProperty" identifier="overrideColorBuffer" /> <Property type="org.inviwo.FloatVec4Property" identifier="overrideColor"> <visible content="0" /> </Property> </Properties> </Property> <Property type="org.inviwo.SimpleLightingProperty" identifier="lighting"> <Properties> <Property type="org.inviwo.OptionPropertyInt" identifier="shadingMode"> <selectedIdentifier content="none" /> </Property> <Property type="org.inviwo.OptionPropertyInt" identifier="referenceFrame" /> <Property type="org.inviwo.FloatVec3Property" identifier="lightPosition" /> <Property type="org.inviwo.FloatVec3Property" identifier="lightColorAmbient" /> <Property type="org.inviwo.FloatVec3Property" identifier="lightColorDiffuse" /> <Property type="org.inviwo.FloatVec3Property" identifier="lightColorSpecular" /> <Property type="org.inviwo.FloatProperty" identifier="materialShininess" /> <Property type="org.inviwo.BoolProperty" identifier="applyLightAttenuation" /> <Property type="org.inviwo.FloatVec3Property" identifier="lightAttenuation" /> </Properties> </Property> <Property type="org.inviwo.CameraTrackball" identifier="trackball"> <Properties> <Property type="org.inviwo.OptionPropertyInt" identifier="trackballMethod" /> <Property type="org.inviwo.FloatProperty" identifier="sensitivity" /> <Property type="org.inviwo.FloatProperty" identifier="movementSpeed" /> <Property type="org.inviwo.BoolProperty" identifier="fixUp" /> <Property type="org.inviwo.OptionPropertyInt" identifier="worldUp" /> <Property type="org.inviwo.FloatVec3Property" identifier="customWup" /> <Property type="org.inviwo.FloatProperty" identifier="verticalAngleLimit" /> <Property type="org.inviwo.BoolProperty" identifier="handleEvents" /> <Property type="org.inviwo.BoolProperty" identifier="allowHorizontalPanning" /> <Property type="org.inviwo.BoolProperty" identifier="allowVerticalPanning" /> <Property type="org.inviwo.BoolProperty" identifier="boundedPanning" /> <Property type="org.inviwo.BoolProperty" identifier="allowZoom" /> <Property type="org.inviwo.BoolProperty" identifier="allowWheelZoom" /> <Property type="org.inviwo.BoolProperty" identifier="boundedZooming" /> <Property type="org.inviwo.BoolProperty" identifier="allowHorziontalRotation" /> <Property type="org.inviwo.BoolProperty" identifier="allowVerticalRotation" /> <Property type="org.inviwo.BoolProperty" identifier="allowViewAxisRotation" /> <Property type="org.inviwo.BoolProperty" identifier="allowRecenterView" /> <Property type="org.inviwo.BoolProperty" identifier="animate" /> <Property type="org.inviwo.EventProperty" identifier="mouseRecenterFocusPoint"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="wheelZoom"> <visible content="0" /> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="trackballRotate"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="mouseZoom"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="trackballPan"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="mouseReset"> <visible content="0" /> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="moveUp"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="moveDown"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="moveForward"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="moveBackward"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="moveLeft"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="moveRight"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="stepRotateUp"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="stepRotateDown"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="stepRotateLeft"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="stepRotateRight"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="stepZoomIn"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="stepZoomOut"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="stepPanUp"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="stepPanDown"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="stepPanLeft"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="stepPanRight"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="touchGesture"> <visible content="0" /> <Event /> </Property> </Properties> </Property> <Property type="org.inviwo.CompositeProperty" identifier="layers"> <Properties> <Property type="org.inviwo.BoolProperty" identifier="colorLayer" /> <Property type="org.inviwo.BoolProperty" identifier="texCoordLayer" /> <Property type="org.inviwo.BoolProperty" identifier="normalsLayer" /> <Property type="org.inviwo.BoolProperty" identifier="viewNormalsLayer" /> </Properties> </Property> </Properties> <MetaDataMap> <MetaDataItem type="org.inviwo.ProcessorMetaData" key="org.inviwo.ProcessorMetaData"> <position x="50" y="325" /> <visibility content="1" /> <selection content="0" /> </MetaDataItem> </MetaDataMap> </Processor> <Processor type="org.inviwo.CanvasGL" identifier="Canvas" displayName="Canvas"> <PortGroups> <PortGroup content="default" key="inport" /> </PortGroups> <InPorts> <InPort type="org.inviwo.Image.inport" identifier="inport" id="ref5" /> </InPorts> <Properties> <Property type="org.inviwo.CompositeProperty" identifier="inputSize"> <Properties> <Property type="org.inviwo.IntSize2Property" identifier="dimensions"> <MetaDataMap> <MetaDataItem type="org.inviwo.StringStringStdUnorderedMapMetaData" key="SavedState" /> </MetaDataMap> </Property> <Property type="org.inviwo.BoolProperty" identifier="enableCustomInputDimensions"> <value content="1" /> </Property> <Property type="org.inviwo.IntSize2Property" identifier="customInputDimensions"> <visible content="1" /> <readonly content="1" /> </Property> <Property type="org.inviwo.BoolProperty" identifier="keepAspectRatio"> <visible content="1" /> </Property> <Property type="org.inviwo.FloatProperty" identifier="aspectRatioScaling"> <visible content="1" /> <value content="2" /> </Property> </Properties> </Property> <Property type="org.inviwo.IntVec2Property" identifier="position"> <MetaDataMap> <MetaDataItem type="org.inviwo.StringStringStdUnorderedMapMetaData" key="SavedState" /> </MetaDataMap> <value x="1154" y="518" /> </Property> <Property type="org.inviwo.OptionPropertyEnumChar" identifier="visibleLayer" /> <Property type="org.inviwo.IntProperty" identifier="colorLayer_"> <displayName content="Color Layer ID" /> <semantics semantics="Default" /> <usageMode content="1" /> <visible content="0" /> <readonly content="0" /> <minConstraint content="0" /> <maxConstraint content="0" /> <minvalue content="0" /> <maxvalue content="0" /> <increment content="1" /> <value content="0" /> </Property> <Property type="org.inviwo.DirectoryProperty" identifier="layerDir"> <absolutePath content="" /> <workspaceRelativePath content="" /> <ivwdataRelativePath content="" /> <selectedExtension> <extension content="*" /> <description content="All Files" /> </selectedExtension> <acceptMode content="0" /> <fileMode content="4" /> </Property> <Property type="org.inviwo.OptionPropertyFileExtension" identifier="fileExt" /> <Property type="org.inviwo.ButtonProperty" identifier="saveLayer" /> <Property type="org.inviwo.ButtonProperty" identifier="saveLayerToFile" /> <Property type="org.inviwo.BoolProperty" identifier="fullscreen" /> <Property type="org.inviwo.EventProperty" identifier="fullscreenEvent"> <Event /> </Property> <Property type="org.inviwo.EventProperty" identifier="saveLayerEvent"> <Event /> </Property> <Property type="org.inviwo.BoolProperty" identifier="allowContextMenu" /> <Property type="org.inviwo.BoolProperty" identifier="evaluateWhenHidden" /> </Properties> <MetaDataMap> <MetaDataItem type="org.inviwo.ProcessorMetaData" key="org.inviwo.ProcessorMetaData"> <position x="50" y="475" /> <visibility content="1" /> <selection content="1" /> </MetaDataItem> <MetaDataItem type="org.inviwo.ProcessorWidgetMetaData" key="org.inviwo.ProcessorWidgetMetaData"> <position x="1154" y="518" /> <dimensions x="128" y="128" /> <visibility content="1" /> </MetaDataItem> </MetaDataMap> </Processor> </Processors> <Connections> <Connection> <OutPort type="org.inviwo.Mesh.outport" identifier="mesh" reference="ref2" /> <InPort type="org.inviwo.Mesh.flat.multi.inport" identifier="geometry" reference="ref3" /> </Connection> <Connection> <OutPort type="org.inviwo.Image.outport" identifier="image" reference="ref4" /> <InPort type="org.inviwo.Image.inport" identifier="inport" reference="ref0" /> </Connection> <Connection> <OutPort type="org.inviwo.Image.outport" identifier="outport" reference="ref1" /> <InPort type="org.inviwo.Image.inport" identifier="inport" reference="ref5" /> </Connection> </Connections> </ProcessorNetwork> <PortInspectors /> <WorkspaceAnnotations> <Properties> <Property type="org.inviwo.StringProperty" identifier="title" /> <Property type="org.inviwo.StringProperty" identifier="author" /> <Property type="org.inviwo.StringProperty" identifier="tags" /> <Property type="org.inviwo.StringProperty" identifier="categories" /> <Property type="org.inviwo.StringProperty" identifier="description" /> </Properties> <Canvases> <CanvasImage> <name content="Canvas" /> <size x="256" y="256" /> <base64 content="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" /> </CanvasImage> </Canvases> <Network> <name content="Network" /> <size x="256" y="256" /> <base64 content="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" /> </Network> </WorkspaceAnnotations> </InviwoWorkspace>
{ "pile_set_name": "Github" }
#!/bin/bash if [[ `uname -a` = *"Darwin"* ]]; then echo "It seems you are running on Mac. This script does not work on Mac. See https://github.com/grpc/grpc-go/issues/2047" exit 1 fi set -ex # Exit on error; debugging enabled. set -o pipefail # Fail a pipe if any sub-command fails. die() { echo "$@" >&2 exit 1 } fail_on_output() { tee /dev/stderr | (! read) } # Check to make sure it's safe to modify the user's git repo. git status --porcelain | fail_on_output # Undo any edits made by this script. cleanup() { git reset --hard HEAD } trap cleanup EXIT PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}" if [[ "$1" = "-install" ]]; then # Check for module support if go help mod >& /dev/null; then # Install the pinned versions as defined in module tools. pushd ./test/tools go install \ golang.org/x/lint/golint \ golang.org/x/tools/cmd/goimports \ honnef.co/go/tools/cmd/staticcheck \ github.com/client9/misspell/cmd/misspell \ github.com/golang/protobuf/protoc-gen-go popd else # Ye olde `go get` incantation. # Note: this gets the latest version of all tools (vs. the pinned versions # with Go modules). go get -u \ golang.org/x/lint/golint \ golang.org/x/tools/cmd/goimports \ honnef.co/go/tools/cmd/staticcheck \ github.com/client9/misspell/cmd/misspell \ github.com/golang/protobuf/protoc-gen-go fi if [[ -z "${VET_SKIP_PROTO}" ]]; then if [[ "${TRAVIS}" = "true" ]]; then PROTOBUF_VERSION=3.3.0 PROTOC_FILENAME=protoc-${PROTOBUF_VERSION}-linux-x86_64.zip pushd /home/travis wget https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/${PROTOC_FILENAME} unzip ${PROTOC_FILENAME} bin/protoc --version popd elif ! which protoc > /dev/null; then die "Please install protoc into your path" fi fi exit 0 elif [[ "$#" -ne 0 ]]; then die "Unknown argument(s): $*" fi # - Ensure all source files contain a copyright message. (! git grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO NOT EDIT" -- '*.go') # - Make sure all tests in grpc and grpc/test use leakcheck via Teardown. (! grep 'func Test[^(]' *_test.go) (! grep 'func Test[^(]' test/*.go) # - Do not import x/net/context. (! git grep -l 'x/net/context' -- "*.go") # - Do not import math/rand for real library code. Use internal/grpcrand for # thread safety. git grep -l '"math/rand"' -- "*.go" 2>&1 | (! grep -v '^examples\|^stress\|grpcrand\|^benchmark\|wrr_test') # - Ensure all ptypes proto packages are renamed when importing. (! git grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/" -- "*.go") # - Check imports that are illegal in appengine (until Go 1.11). # TODO: Remove when we drop Go 1.10 support go list -f {{.Dir}} ./... | xargs go run test/go_vet/vet.go # - gofmt, goimports, golint (with exceptions for generated code), go vet. gofmt -s -d -l . 2>&1 | fail_on_output goimports -l . 2>&1 | (! grep -vE "(_mock|\.pb)\.go") golint ./... 2>&1 | (! grep -vE "(_mock|\.pb)\.go:") go vet -all ./... misspell -error . # - Check that generated proto files are up to date. if [[ -z "${VET_SKIP_PROTO}" ]]; then PATH="/home/travis/bin:${PATH}" make proto && \ git status --porcelain 2>&1 | fail_on_output || \ (git status; git --no-pager diff; exit 1) fi # - Check that our module is tidy. if go help mod >& /dev/null; then go mod tidy && \ git status --porcelain 2>&1 | fail_on_output || \ (git status; git --no-pager diff; exit 1) fi # - Collection of static analysis checks # # TODO(dfawley): don't use deprecated functions in examples or first-party # plugins. SC_OUT="$(mktemp)" staticcheck -go 1.9 -checks 'inherit,-ST1015' ./... > "${SC_OUT}" || true # Error if anything other than deprecation warnings are printed. (! grep -v "is deprecated:.*SA1019" "${SC_OUT}") # Only ignore the following deprecated types/fields/functions. (! grep -Fv '.HandleResolvedAddrs .HandleSubConnStateChange .HeaderMap .NewAddress .NewServiceConfig .Metadata is deprecated: use Attributes .Type is deprecated: use Attributes .UpdateBalancerState balancer.Picker grpc.CallCustomCodec grpc.Code grpc.Compressor grpc.Decompressor grpc.MaxMsgSize grpc.MethodConfig grpc.NewGZIPCompressor grpc.NewGZIPDecompressor grpc.RPCCompressor grpc.RPCDecompressor grpc.RoundRobin grpc.ServiceConfig grpc.WithBalancer grpc.WithBalancerName grpc.WithCompressor grpc.WithDecompressor grpc.WithDialer grpc.WithMaxMsgSize grpc.WithServiceConfig grpc.WithTimeout http.CloseNotifier info.SecurityVersion naming.Resolver naming.Update naming.Watcher resolver.Backend resolver.GRPCLB' "${SC_OUT}" )
{ "pile_set_name": "Github" }
<% if issues && issues.any? %> <% form_tag({}) do %> <table class="gt-table issues"> <thead><tr> <th>#</th> <th><%=l(:field_project)%></th> <th><%=l(:field_tracker)%></th> <th><%=l(:field_subject)%></th> </tr></thead> <tbody> <% for issue in issues %> <tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %>"> <td class="id"> <%= check_box_tag("ids[]", issue.id, false, :style => 'display:none;') %> <%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %> </td> <td class="project"><%= link_to(h(issue.project), :controller => 'projects', :action => 'show', :id => issue.project) %></td> <td class="tracker"><%=h issue.tracker %></td> <td class="subject"> <%= link_to h(truncate(issue.subject, :length => 60)), {:controller => 'issues', :action => 'show', :id => issue}, :class => "fancyframe" %> (<%=h issue.status %>) </td> </tr> <% end %> </tbody> </table> <% end %> <% else %> <p class="nodata"><%= l(:label_no_data) %></p> <% end %>
{ "pile_set_name": "Github" }
var test = require('tap').test; var fs = require('fs'); var check = require('../'); var src = '<html></html>'; test('html', function (t) { var err = check(src, 'foo.js'); t.ok(err); t.equal(err.line, 1); t.equal(err.column, 1); t.equal(err.message, 'Unexpected token'); t.ok(/foo.js:1/.test(err), 'foo.js:1'); t.end(); });
{ "pile_set_name": "Github" }
/* -*- coding: utf-8 -*- // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. */ #include "config.h" #include <sys/wait.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <paths.h> #if defined HAVE_POSIX_SPAWN || defined HAVE_POSIX_SPAWNP #include <spawn.h> #endif // ..:: environment access fixer - begin ::.. #ifdef HAVE_NSGETENVIRON #include <crt_externs.h> #else extern char **environ; #endif char **get_environ() { #ifdef HAVE_NSGETENVIRON return *_NSGetEnviron(); #else return environ; #endif } // ..:: environment access fixer - end ::.. // ..:: test fixtures - begin ::.. static char const *cwd = NULL; static FILE *fd = NULL; static int need_comma = 0; void expected_out_open(const char *expected) { cwd = getcwd(NULL, 0); fd = fopen(expected, "w"); if (!fd) { perror("fopen"); exit(EXIT_FAILURE); } fprintf(fd, "[\n"); need_comma = 0; } void expected_out_close() { fprintf(fd, "]\n"); fclose(fd); fd = NULL; free((void *)cwd); cwd = NULL; } void expected_out(const char *file) { if (need_comma) fprintf(fd, ",\n"); else need_comma = 1; fprintf(fd, "{\n"); fprintf(fd, " \"directory\": \"%s\",\n", cwd); fprintf(fd, " \"command\": \"cc -c %s\",\n", file); fprintf(fd, " \"file\": \"%s/%s\"\n", cwd, file); fprintf(fd, "}\n"); } void create_source(char *file) { FILE *fd = fopen(file, "w"); if (!fd) { perror("fopen"); exit(EXIT_FAILURE); } fprintf(fd, "typedef int score;\n"); fclose(fd); } typedef void (*exec_fun)(); void wait_for(pid_t child) { int status; if (-1 == waitpid(child, &status, 0)) { perror("wait"); exit(EXIT_FAILURE); } if (WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE) { fprintf(stderr, "children process has non zero exit code\n"); exit(EXIT_FAILURE); } } #define FORK(FUNC) \ { \ pid_t child = fork(); \ if (-1 == child) { \ perror("fork"); \ exit(EXIT_FAILURE); \ } else if (0 == child) { \ FUNC fprintf(stderr, "children process failed to exec\n"); \ exit(EXIT_FAILURE); \ } else { \ wait_for(child); \ } \ } // ..:: test fixtures - end ::.. #ifdef HAVE_EXECV void call_execv() { char *const file = "execv.c"; char *const compiler = "/usr/bin/cc"; char *const argv[] = {"cc", "-c", file, 0}; expected_out(file); create_source(file); FORK(execv(compiler, argv);) } #endif #ifdef HAVE_EXECVE void call_execve() { char *const file = "execve.c"; char *const compiler = "/usr/bin/cc"; char *const argv[] = {compiler, "-c", file, 0}; char *const envp[] = {"THIS=THAT", 0}; expected_out(file); create_source(file); FORK(execve(compiler, argv, envp);) } #endif #ifdef HAVE_EXECVP void call_execvp() { char *const file = "execvp.c"; char *const compiler = "cc"; char *const argv[] = {compiler, "-c", file, 0}; expected_out(file); create_source(file); FORK(execvp(compiler, argv);) } #endif #ifdef HAVE_EXECVP2 void call_execvP() { char *const file = "execv_p.c"; char *const compiler = "cc"; char *const argv[] = {compiler, "-c", file, 0}; expected_out(file); create_source(file); FORK(execvP(compiler, _PATH_DEFPATH, argv);) } #endif #ifdef HAVE_EXECVPE void call_execvpe() { char *const file = "execvpe.c"; char *const compiler = "cc"; char *const argv[] = {"/usr/bin/cc", "-c", file, 0}; char *const envp[] = {"THIS=THAT", 0}; expected_out(file); create_source(file); FORK(execvpe(compiler, argv, envp);) } #endif #ifdef HAVE_EXECT void call_exect() { char *const file = "exect.c"; char *const compiler = "/usr/bin/cc"; char *const argv[] = {compiler, "-c", file, 0}; char *const envp[] = {"THIS=THAT", 0}; expected_out(file); create_source(file); FORK(exect(compiler, argv, envp);) } #endif #ifdef HAVE_EXECL void call_execl() { char *const file = "execl.c"; char *const compiler = "/usr/bin/cc"; expected_out(file); create_source(file); FORK(execl(compiler, "cc", "-c", file, (char *)0);) } #endif #ifdef HAVE_EXECLP void call_execlp() { char *const file = "execlp.c"; char *const compiler = "cc"; expected_out(file); create_source(file); FORK(execlp(compiler, compiler, "-c", file, (char *)0);) } #endif #ifdef HAVE_EXECLE void call_execle() { char *const file = "execle.c"; char *const compiler = "/usr/bin/cc"; char *const envp[] = {"THIS=THAT", 0}; expected_out(file); create_source(file); FORK(execle(compiler, compiler, "-c", file, (char *)0, envp);) } #endif #ifdef HAVE_POSIX_SPAWN void call_posix_spawn() { char *const file = "posix_spawn.c"; char *const compiler = "cc"; char *const argv[] = {compiler, "-c", file, 0}; expected_out(file); create_source(file); pid_t child; if (0 != posix_spawn(&child, "/usr/bin/cc", 0, 0, argv, get_environ())) { perror("posix_spawn"); exit(EXIT_FAILURE); } wait_for(child); } #endif #ifdef HAVE_POSIX_SPAWNP void call_posix_spawnp() { char *const file = "posix_spawnp.c"; char *const compiler = "cc"; char *const argv[] = {compiler, "-c", file, 0}; expected_out(file); create_source(file); pid_t child; if (0 != posix_spawnp(&child, "cc", 0, 0, argv, get_environ())) { perror("posix_spawnp"); exit(EXIT_FAILURE); } wait_for(child); } #endif int main(int argc, char *const argv[]) { if (argc != 2) exit(EXIT_FAILURE); expected_out_open(argv[1]); #ifdef HAVE_EXECV call_execv(); #endif #ifdef HAVE_EXECVE call_execve(); #endif #ifdef HAVE_EXECVP call_execvp(); #endif #ifdef HAVE_EXECVP2 call_execvP(); #endif #ifdef HAVE_EXECVPE call_execvpe(); #endif #ifdef HAVE_EXECT call_exect(); #endif #ifdef HAVE_EXECL call_execl(); #endif #ifdef HAVE_EXECLP call_execlp(); #endif #ifdef HAVE_EXECLE call_execle(); #endif #ifdef HAVE_POSIX_SPAWN call_posix_spawn(); #endif #ifdef HAVE_POSIX_SPAWNP call_posix_spawnp(); #endif expected_out_close(); return 0; }
{ "pile_set_name": "Github" }
<?php namespace Bolt\Tests\Twig; use Bolt\EventListener\ConfigListener; use Bolt\Tests\BoltUnitTest; use Bolt\Twig\Extension\BoltExtension; use Bolt\Twig\SetcontentTokenParser; use Bolt\Twig\SwitchTokenParser; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\HttpKernelInterface; /** * Class to test src/Twig/Extension/BoltExtension. * * @author Ross Riley <riley.ross@gmail.com> * @author Gawain Lynch <gawain.lynch@gmail.com> */ class BoltExtensionTest extends BoltUnitTest { public function testTwigInterface() { $app = $this->getApp(); $twig = new BoltExtension($app['storage.lazy'], $app['config'], $app['paths'], $app['query']); $this->assertGreaterThan(0, $twig->getFunctions()); $this->assertGreaterThan(0, $twig->getFilters()); $this->assertGreaterThan(0, $twig->getTests()); $this->assertEquals('Bolt', $twig->getName()); } public function testGetGlobals() { $app = $this->getApp(); $request = Request::createFromGlobals(); $app['request'] = $request; $app['request_stack']->push($request); // Call the event listener that adds the globals $event = new GetResponseEvent($app['kernel'], $request, HttpKernelInterface::MASTER_REQUEST); (new ConfigListener($app))->onRequest($event); $response = $app['twig']->getGlobals(); $this->assertArrayHasKey('bolt_name', $response); $this->assertArrayHasKey('bolt_version', $response); $this->assertArrayHasKey('frontend', $response); $this->assertArrayHasKey('backend', $response); $this->assertArrayHasKey('async', $response); $this->assertArrayHasKey('paths', $response); $this->assertArrayHasKey('theme', $response); $this->assertArrayHasKey('user', $response); $this->assertArrayHasKey('users', $response); $this->assertArrayHasKey('config', $response); $this->assertNotNull($response['config']); } public function testGetGlobalsSafe() { $app = $this->getApp(); $request = Request::createFromGlobals(); $app['request'] = $request; $app['request_stack']->push($request); $twig = new BoltExtension($app['storage.lazy'], $app['config'], $app['paths'], $app['query']); $result = $twig->getGlobals(); $this->assertArrayHasKey('config', $result); $this->assertNull($result['users']); } public function testGetGlobalsExceptionalExceptionIsExceptional() { $app = $this->getApp(); $users = $this->getMockUsers(['getCurrentUser']); $users ->expects($this->atLeastOnce()) ->method('getCurrentUser') ->will($this->throwException(new \Exception())); $this->setService('users', $users); $request = Request::createFromGlobals(); $app['request'] = $request; $app['request_stack']->push($request); // Call the event listener that adds the globals $event = new GetResponseEvent($app['kernel'], $request, HttpKernelInterface::MASTER_REQUEST); (new ConfigListener($app))->onRequest($event); $result = $app['twig']->getGlobals(); $this->assertArrayHasKey('user', $result); $this->assertArrayHasKey('users', $result); $this->assertNull($result['user']); $this->assertNull($result['users']); } public function testGetTokenParsers() { $app = $this->getApp(); $twig = new BoltExtension($app['storage.lazy'], $app['config'], $app['paths'], $app['query']); $result = $twig->getTokenParsers(); $this->assertInstanceOf(SetcontentTokenParser::class, $result[0]); $this->assertInstanceOf(SwitchTokenParser::class, $result[1]); } }
{ "pile_set_name": "Github" }
set(CTEST_SOURCE_DIRECTORY "@CMAKE_SOURCE_DIR@") set(CTEST_BINARY_DIRECTORY "@CMAKE_BINARY_DIR@") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") set(CTEST_BUILD_NAME "@BUILDNAME@") set(CTEST_SITE "@SITE@") set(MODEL Experimental) if(${CTEST_SCRIPT_ARG} MATCHES Nightly) set(MODEL Nightly) elseif(${CTEST_SCRIPT_ARG} MATCHES Continuous) set(MODEL Continuous) endif() find_program(CTEST_HG_COMMAND NAMES hg) set(CTEST_UPDATE_COMMAND "${CTEST_HG_COMMAND}") ctest_start(${MODEL} ${CTEST_SOURCE_DIRECTORY} ${CTEST_BINARY_DIRECTORY}) ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}") ctest_submit(PARTS Update Notes) # to get CTEST_PROJECT_SUBPROJECTS definition: include("${CTEST_SOURCE_DIRECTORY}/CTestConfig.cmake") foreach(subproject ${CTEST_PROJECT_SUBPROJECTS}) message("") message("Process ${subproject}") set_property(GLOBAL PROPERTY SubProject ${subproject}) set_property(GLOBAL PROPERTY Label ${subproject}) ctest_configure(BUILD ${CTEST_BINARY_DIRECTORY} SOURCE ${CTEST_SOURCE_DIRECTORY} ) ctest_submit(PARTS Configure) set(CTEST_BUILD_TARGET "Build${subproject}") message("Build ${CTEST_BUILD_TARGET}") ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) # builds target ${CTEST_BUILD_TARGET} ctest_submit(PARTS Build) ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" INCLUDE_LABEL "${subproject}" ) # runs only tests that have a LABELS property matching "${subproject}" ctest_coverage(BUILD "${CTEST_BINARY_DIRECTORY}" LABELS "${subproject}" ) ctest_submit(PARTS Test) endforeach()
{ "pile_set_name": "Github" }
// Copyright 2011 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // See: http://code.google.com/p/v8/issues/detail?id=1365 // Check that builtin methods are passed undefined as the receiver // when called as functions through variables. // Flags: --allow-natives-syntax // Global variable. var valueOf = Object.prototype.valueOf; var hasOwnProperty = Object.prototype.hasOwnProperty; function callGlobalValueOf() { valueOf(); } function callGlobalHasOwnProperty() { valueOf(); } assertEquals(Object.prototype, Object.prototype.valueOf()); assertThrows(callGlobalValueOf); assertThrows(callGlobalHasOwnProperty); %OptimizeFunctionOnNextCall(Object.prototype.valueOf); Object.prototype.valueOf(); assertEquals(Object.prototype, Object.prototype.valueOf()); assertThrows(callGlobalValueOf); assertThrows(callGlobalHasOwnProperty); function CheckExceptionCallLocal() { var valueOf = Object.prototype.valueOf; var hasOwnProperty = Object.prototype.hasOwnProperty; var exception = false; try { valueOf(); } catch(e) { exception = true; } assertTrue(exception); exception = false; try { hasOwnProperty(); } catch(e) { exception = true; } assertTrue(exception); } CheckExceptionCallLocal(); function CheckExceptionCallParameter(f) { var exception = false; try { f(); } catch(e) { exception = true; } assertTrue(exception); } CheckExceptionCallParameter(Object.prototype.valueOf); CheckExceptionCallParameter(Object.prototype.hasOwnProperty); function CheckPotentiallyShadowedByEval() { var exception = false; try { eval("hasOwnProperty('x')"); } catch(e) { exception = true; } assertTrue(exception); } CheckPotentiallyShadowedByEval();
{ "pile_set_name": "Github" }
#region Copyright // Copyright 2017 Gigya Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. #endregion using System; namespace Gigya.Microdot.ServiceProxy { public static class ServiceProxyExtensions { public static string GetServiceName(this Type serviceInterfaceType) { var assemblyName = serviceInterfaceType.Assembly.GetName().Name; var endIndex = assemblyName.IndexOf(".Interface", StringComparison.OrdinalIgnoreCase); if (endIndex <= 0) return GetServiceNameFromTypeName(serviceInterfaceType.Name) ?? serviceInterfaceType.FullName.Replace('+', '-'); var startIndex = assemblyName.Substring(0, endIndex).LastIndexOf(".", StringComparison.OrdinalIgnoreCase) + 1; var length = endIndex - startIndex; return assemblyName.Substring(startIndex, length); } private static string GetServiceNameFromTypeName(string typeName) { // if typeName is starts with 'I' letter and the following letter is an upper-case letter, // then it represents an interface name, like 'IDemoService', and the 'I' letter should be ignored. if (typeName.Length > 1 && typeName[0] == 'I' && typeName[1] >= 'A' && typeName[1] <= 'Z') typeName = typeName.Substring(1); if (typeName.EndsWith("Service")) return typeName; else return null; } } }
{ "pile_set_name": "Github" }
DOMAIN = WINGs CATALOGS = @WINGSMOFILES@ CLEANFILES = $(CATALOGS) $(DOMAIN).pot EXTRA_DIST = bg.po ca.po cs.po de.po fr.po fy.po hu.po nl.po sk.po # WUtil files: POTFILES = \ $(top_srcdir)/WINGs/array.c \ $(top_srcdir)/WINGs/bagtree.c \ $(top_srcdir)/WINGs/data.c \ $(top_srcdir)/WINGs/error.c \ $(top_srcdir)/WINGs/findfile.c \ $(top_srcdir)/WINGs/handlers.c \ $(top_srcdir)/WINGs/hashtable.c \ $(top_srcdir)/WINGs/memory.c \ $(top_srcdir)/WINGs/menuparser.c \ $(top_srcdir)/WINGs/menuparser_macros.c \ $(top_srcdir)/WINGs/misc.c \ $(top_srcdir)/WINGs/notification.c \ $(top_srcdir)/WINGs/proplist.c \ $(top_srcdir)/WINGs/string.c \ $(top_srcdir)/WINGs/tree.c \ $(top_srcdir)/WINGs/userdefaults.c \ $(top_srcdir)/WINGs/usleep.c \ $(top_srcdir)/WINGs/wapplication.c \ $(top_srcdir)/WINGs/wutil.c # WINGs files: POTFILES += \ $(top_srcdir)/WINGs/configuration.c \ $(top_srcdir)/WINGs/dragcommon.c \ $(top_srcdir)/WINGs/dragdestination.c \ $(top_srcdir)/WINGs/dragsource.c \ $(top_srcdir)/WINGs/selection.c \ $(top_srcdir)/WINGs/wappresource.c \ $(top_srcdir)/WINGs/wballoon.c \ $(top_srcdir)/WINGs/wbox.c \ $(top_srcdir)/WINGs/wbrowser.c \ $(top_srcdir)/WINGs/wbutton.c \ $(top_srcdir)/WINGs/wcolor.c \ $(top_srcdir)/WINGs/wcolorpanel.c \ $(top_srcdir)/WINGs/wcolorwell.c \ $(top_srcdir)/WINGs/wevent.c \ $(top_srcdir)/WINGs/wfilepanel.c \ $(top_srcdir)/WINGs/wframe.c \ $(top_srcdir)/WINGs/wfont.c \ $(top_srcdir)/WINGs/wfontpanel.c \ $(top_srcdir)/WINGs/widgets.c \ $(top_srcdir)/WINGs/winputmethod.c \ $(top_srcdir)/WINGs/wlabel.c \ $(top_srcdir)/WINGs/wlist.c \ $(top_srcdir)/WINGs/wmenuitem.c \ $(top_srcdir)/WINGs/wmisc.c \ $(top_srcdir)/WINGs/wpanel.c \ $(top_srcdir)/WINGs/wpixmap.c \ $(top_srcdir)/WINGs/wpopupbutton.c \ $(top_srcdir)/WINGs/wprogressindicator.c \ $(top_srcdir)/WINGs/wruler.c \ $(top_srcdir)/WINGs/wscroller.c \ $(top_srcdir)/WINGs/wscrollview.c \ $(top_srcdir)/WINGs/wslider.c \ $(top_srcdir)/WINGs/wsplitview.c \ $(top_srcdir)/WINGs/wtabview.c \ $(top_srcdir)/WINGs/wtext.c \ $(top_srcdir)/WINGs/wtextfield.c \ $(top_srcdir)/WINGs/wview.c \ $(top_srcdir)/WINGs/wwindow.c SUFFIXES = .po .mo .po.mo: $(AM_V_GEN)$(MSGFMT) -c -o $@ $< all-local: $(CATALOGS) .PHONY: update-lang if HAVE_XGETTEXT update-lang: $(DOMAIN).pot $(AM_V_GEN)$(top_srcdir)/script/generate-po-from-template.sh \ -n "$(PACKAGE_NAME)" -v "$(PACKAGE_VERSION)" -b "$(PACKAGE_BUGREPORT)" \ -t "$(DOMAIN).pot" "$(srcdir)/$(PO).po" $(DOMAIN).pot: $(POTFILES) $(AM_V_GEN)$(XGETTEXT) --default-domain=$(DOMAIN) \ --add-comments --keyword=_ --keyword=N_ $(POTFILES) @if cmp -s $(DOMAIN).po $(DOMAIN).pot; then \ rm -f $(DOMAIN).po; \ else \ mv -f $(DOMAIN).po $(DOMAIN).pot; \ fi endif install-data-local: $(CATALOGS) $(mkinstalldirs) $(DESTDIR)$(localedir) for n in $(CATALOGS) __DuMmY ; do \ if test "$$n" -a "$$n" != "__DuMmY" ; then \ l=`basename $$n .mo`; \ $(mkinstalldirs) $(DESTDIR)$(localedir)/$$l/LC_MESSAGES; \ $(INSTALL_DATA) -m 644 $$n $(DESTDIR)$(localedir)/$$l/LC_MESSAGES/$(DOMAIN).mo; \ fi; \ done uninstall-local: for n in $(CATALOGS) ; do \ l=`basename $$n .mo`; \ rm -f $(DESTDIR)$(localedir)/$$l/LC_MESSAGES/$(DOMAIN).mo; \ done # Create a 'silent rule' for our make check the same way automake does AM_V_CHKTRANS = $(am__v_CHKTRANS_$(V)) am__v_CHKTRANS_ = $(am__v_CHKTRANS_$(AM_DEFAULT_VERBOSITY)) am__v_CHKTRANS_0 = @echo " CHK translations" ; am__v_CHKTRANS_1 = # 'make check' will make sure the tranlation sources are in line with the compiled source check-local: $(AM_V_CHKTRANS)$(top_srcdir)/script/check-translation-sources.sh \ "$(srcdir)" -s "$(top_srcdir)/WINGs/Makefile.am"
{ "pile_set_name": "Github" }
// This file was GENERATED by command: // pump.py gtest-tuple.h.pump // DO NOT EDIT BY HAND!!! // Copyright 2009 Google Inc. // All Rights Reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: wan@google.com (Zhanyong Wan) // Implements a subset of TR1 tuple needed by Google Test and Google Mock. #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_ #include <utility> // For ::std::pair. // The compiler used in Symbian has a bug that prevents us from declaring the // tuple template as a friend (it complains that tuple is redefined). This // hack bypasses the bug by declaring the members that should otherwise be // private as public. // Sun Studio versions < 12 also have the above bug. #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) # define GTEST_DECLARE_TUPLE_AS_FRIEND_ public: #else # define GTEST_DECLARE_TUPLE_AS_FRIEND_ \ template <GTEST_10_TYPENAMES_(U)> friend class tuple; \ private: #endif // Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict // with our own definitions. Therefore using our own tuple does not work on // those compilers. #if defined(_MSC_VER) && _MSC_VER >= 1600 /* 1600 is Visual Studio 2010 */ # error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \ GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers." #endif // GTEST_n_TUPLE_(T) is the type of an n-tuple. #define GTEST_0_TUPLE_(T) tuple<> #define GTEST_1_TUPLE_(T) tuple<T##0, void, void, void, void, void, void, \ void, void, void> #define GTEST_2_TUPLE_(T) tuple<T##0, T##1, void, void, void, void, void, \ void, void, void> #define GTEST_3_TUPLE_(T) tuple<T##0, T##1, T##2, void, void, void, void, \ void, void, void> #define GTEST_4_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, void, void, void, \ void, void, void> #define GTEST_5_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, void, void, \ void, void, void> #define GTEST_6_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, void, \ void, void, void> #define GTEST_7_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \ void, void, void> #define GTEST_8_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \ T##7, void, void> #define GTEST_9_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \ T##7, T##8, void> #define GTEST_10_TUPLE_(T) tuple<T##0, T##1, T##2, T##3, T##4, T##5, T##6, \ T##7, T##8, T##9> // GTEST_n_TYPENAMES_(T) declares a list of n typenames. #define GTEST_0_TYPENAMES_(T) #define GTEST_1_TYPENAMES_(T) typename T##0 #define GTEST_2_TYPENAMES_(T) typename T##0, typename T##1 #define GTEST_3_TYPENAMES_(T) typename T##0, typename T##1, typename T##2 #define GTEST_4_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3 #define GTEST_5_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4 #define GTEST_6_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5 #define GTEST_7_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5, typename T##6 #define GTEST_8_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5, typename T##6, typename T##7 #define GTEST_9_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5, typename T##6, \ typename T##7, typename T##8 #define GTEST_10_TYPENAMES_(T) typename T##0, typename T##1, typename T##2, \ typename T##3, typename T##4, typename T##5, typename T##6, \ typename T##7, typename T##8, typename T##9 // In theory, defining stuff in the ::std namespace is undefined // behavior. We can do this as we are playing the role of a standard // library vendor. namespace std { namespace tr1 { template <typename T0 = void, typename T1 = void, typename T2 = void, typename T3 = void, typename T4 = void, typename T5 = void, typename T6 = void, typename T7 = void, typename T8 = void, typename T9 = void> class tuple; // Anything in namespace gtest_internal is Google Test's INTERNAL // IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code. namespace gtest_internal { // ByRef<T>::type is T if T is a reference; otherwise it's const T&. template <typename T> struct ByRef { typedef const T& type; }; // NOLINT template <typename T> struct ByRef<T&> { typedef T& type; }; // NOLINT // A handy wrapper for ByRef. #define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef<T>::type // AddRef<T>::type is T if T is a reference; otherwise it's T&. This // is the same as tr1::add_reference<T>::type. template <typename T> struct AddRef { typedef T& type; }; // NOLINT template <typename T> struct AddRef<T&> { typedef T& type; }; // NOLINT // A handy wrapper for AddRef. #define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef<T>::type // A helper for implementing get<k>(). template <int k> class Get; // A helper for implementing tuple_element<k, T>. kIndexValid is true // iff k < the number of fields in tuple type T. template <bool kIndexValid, int kIndex, class Tuple> struct TupleElement; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 0, GTEST_10_TUPLE_(T) > { typedef T0 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 1, GTEST_10_TUPLE_(T) > { typedef T1 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 2, GTEST_10_TUPLE_(T) > { typedef T2 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 3, GTEST_10_TUPLE_(T) > { typedef T3 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 4, GTEST_10_TUPLE_(T) > { typedef T4 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 5, GTEST_10_TUPLE_(T) > { typedef T5 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 6, GTEST_10_TUPLE_(T) > { typedef T6 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 7, GTEST_10_TUPLE_(T) > { typedef T7 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 8, GTEST_10_TUPLE_(T) > { typedef T8 type; }; template <GTEST_10_TYPENAMES_(T)> struct TupleElement<true, 9, GTEST_10_TUPLE_(T) > { typedef T9 type; }; } // namespace gtest_internal template <> class tuple<> { public: tuple() {} tuple(const tuple& /* t */) {} tuple& operator=(const tuple& /* t */) { return *this; } }; template <GTEST_1_TYPENAMES_(T)> class GTEST_1_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_() {} explicit tuple(GTEST_BY_REF_(T0) f0) : f0_(f0) {} tuple(const tuple& t) : f0_(t.f0_) {} template <GTEST_1_TYPENAMES_(U)> tuple(const GTEST_1_TUPLE_(U)& t) : f0_(t.f0_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_1_TYPENAMES_(U)> tuple& operator=(const GTEST_1_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_1_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_1_TUPLE_(U)& t) { f0_ = t.f0_; return *this; } T0 f0_; }; template <GTEST_2_TYPENAMES_(T)> class GTEST_2_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1) : f0_(f0), f1_(f1) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_) {} template <GTEST_2_TYPENAMES_(U)> tuple(const GTEST_2_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_) {} template <typename U0, typename U1> tuple(const ::std::pair<U0, U1>& p) : f0_(p.first), f1_(p.second) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_2_TYPENAMES_(U)> tuple& operator=(const GTEST_2_TUPLE_(U)& t) { return CopyFrom(t); } template <typename U0, typename U1> tuple& operator=(const ::std::pair<U0, U1>& p) { f0_ = p.first; f1_ = p.second; return *this; } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_2_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_2_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; return *this; } T0 f0_; T1 f1_; }; template <GTEST_3_TYPENAMES_(T)> class GTEST_3_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2) : f0_(f0), f1_(f1), f2_(f2) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {} template <GTEST_3_TYPENAMES_(U)> tuple(const GTEST_3_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_3_TYPENAMES_(U)> tuple& operator=(const GTEST_3_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_3_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_3_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; return *this; } T0 f0_; T1 f1_; T2 f2_; }; template <GTEST_4_TYPENAMES_(T)> class GTEST_4_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3) : f0_(f0), f1_(f1), f2_(f2), f3_(f3) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {} template <GTEST_4_TYPENAMES_(U)> tuple(const GTEST_4_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_4_TYPENAMES_(U)> tuple& operator=(const GTEST_4_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_4_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_4_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; }; template <GTEST_5_TYPENAMES_(T)> class GTEST_5_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_) {} template <GTEST_5_TYPENAMES_(U)> tuple(const GTEST_5_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_5_TYPENAMES_(U)> tuple& operator=(const GTEST_5_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_5_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_5_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; }; template <GTEST_6_TYPENAMES_(T)> class GTEST_6_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {} template <GTEST_6_TYPENAMES_(U)> tuple(const GTEST_6_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_6_TYPENAMES_(U)> tuple& operator=(const GTEST_6_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_6_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_6_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; }; template <GTEST_7_TYPENAMES_(T)> class GTEST_7_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5), f6_(f6) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {} template <GTEST_7_TYPENAMES_(U)> tuple(const GTEST_7_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_7_TYPENAMES_(U)> tuple& operator=(const GTEST_7_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_7_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_7_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; f6_ = t.f6_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; T6 f6_; }; template <GTEST_8_TYPENAMES_(T)> class GTEST_8_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {} template <GTEST_8_TYPENAMES_(U)> tuple(const GTEST_8_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_8_TYPENAMES_(U)> tuple& operator=(const GTEST_8_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_8_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_8_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; f6_ = t.f6_; f7_ = t.f7_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; T6 f6_; T7 f7_; }; template <GTEST_9_TYPENAMES_(T)> class GTEST_9_TUPLE_(T) { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7, GTEST_BY_REF_(T8) f8) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {} template <GTEST_9_TYPENAMES_(U)> tuple(const GTEST_9_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_9_TYPENAMES_(U)> tuple& operator=(const GTEST_9_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_9_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_9_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; f6_ = t.f6_; f7_ = t.f7_; f8_ = t.f8_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; T6 f6_; T7 f7_; T8 f8_; }; template <GTEST_10_TYPENAMES_(T)> class tuple { public: template <int k> friend class gtest_internal::Get; tuple() : f0_(), f1_(), f2_(), f3_(), f4_(), f5_(), f6_(), f7_(), f8_(), f9_() {} explicit tuple(GTEST_BY_REF_(T0) f0, GTEST_BY_REF_(T1) f1, GTEST_BY_REF_(T2) f2, GTEST_BY_REF_(T3) f3, GTEST_BY_REF_(T4) f4, GTEST_BY_REF_(T5) f5, GTEST_BY_REF_(T6) f6, GTEST_BY_REF_(T7) f7, GTEST_BY_REF_(T8) f8, GTEST_BY_REF_(T9) f9) : f0_(f0), f1_(f1), f2_(f2), f3_(f3), f4_(f4), f5_(f5), f6_(f6), f7_(f7), f8_(f8), f9_(f9) {} tuple(const tuple& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {} template <GTEST_10_TYPENAMES_(U)> tuple(const GTEST_10_TUPLE_(U)& t) : f0_(t.f0_), f1_(t.f1_), f2_(t.f2_), f3_(t.f3_), f4_(t.f4_), f5_(t.f5_), f6_(t.f6_), f7_(t.f7_), f8_(t.f8_), f9_(t.f9_) {} tuple& operator=(const tuple& t) { return CopyFrom(t); } template <GTEST_10_TYPENAMES_(U)> tuple& operator=(const GTEST_10_TUPLE_(U)& t) { return CopyFrom(t); } GTEST_DECLARE_TUPLE_AS_FRIEND_ template <GTEST_10_TYPENAMES_(U)> tuple& CopyFrom(const GTEST_10_TUPLE_(U)& t) { f0_ = t.f0_; f1_ = t.f1_; f2_ = t.f2_; f3_ = t.f3_; f4_ = t.f4_; f5_ = t.f5_; f6_ = t.f6_; f7_ = t.f7_; f8_ = t.f8_; f9_ = t.f9_; return *this; } T0 f0_; T1 f1_; T2 f2_; T3 f3_; T4 f4_; T5 f5_; T6 f6_; T7 f7_; T8 f8_; T9 f9_; }; // 6.1.3.2 Tuple creation functions. // Known limitations: we don't support passing an // std::tr1::reference_wrapper<T> to make_tuple(). And we don't // implement tie(). inline tuple<> make_tuple() { return tuple<>(); } template <GTEST_1_TYPENAMES_(T)> inline GTEST_1_TUPLE_(T) make_tuple(const T0& f0) { return GTEST_1_TUPLE_(T)(f0); } template <GTEST_2_TYPENAMES_(T)> inline GTEST_2_TUPLE_(T) make_tuple(const T0& f0, const T1& f1) { return GTEST_2_TUPLE_(T)(f0, f1); } template <GTEST_3_TYPENAMES_(T)> inline GTEST_3_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2) { return GTEST_3_TUPLE_(T)(f0, f1, f2); } template <GTEST_4_TYPENAMES_(T)> inline GTEST_4_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3) { return GTEST_4_TUPLE_(T)(f0, f1, f2, f3); } template <GTEST_5_TYPENAMES_(T)> inline GTEST_5_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4) { return GTEST_5_TUPLE_(T)(f0, f1, f2, f3, f4); } template <GTEST_6_TYPENAMES_(T)> inline GTEST_6_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5) { return GTEST_6_TUPLE_(T)(f0, f1, f2, f3, f4, f5); } template <GTEST_7_TYPENAMES_(T)> inline GTEST_7_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5, const T6& f6) { return GTEST_7_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6); } template <GTEST_8_TYPENAMES_(T)> inline GTEST_8_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7) { return GTEST_8_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7); } template <GTEST_9_TYPENAMES_(T)> inline GTEST_9_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7, const T8& f8) { return GTEST_9_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8); } template <GTEST_10_TYPENAMES_(T)> inline GTEST_10_TUPLE_(T) make_tuple(const T0& f0, const T1& f1, const T2& f2, const T3& f3, const T4& f4, const T5& f5, const T6& f6, const T7& f7, const T8& f8, const T9& f9) { return GTEST_10_TUPLE_(T)(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9); } // 6.1.3.3 Tuple helper classes. template <typename Tuple> struct tuple_size; template <GTEST_0_TYPENAMES_(T)> struct tuple_size<GTEST_0_TUPLE_(T) > { static const int value = 0; }; template <GTEST_1_TYPENAMES_(T)> struct tuple_size<GTEST_1_TUPLE_(T) > { static const int value = 1; }; template <GTEST_2_TYPENAMES_(T)> struct tuple_size<GTEST_2_TUPLE_(T) > { static const int value = 2; }; template <GTEST_3_TYPENAMES_(T)> struct tuple_size<GTEST_3_TUPLE_(T) > { static const int value = 3; }; template <GTEST_4_TYPENAMES_(T)> struct tuple_size<GTEST_4_TUPLE_(T) > { static const int value = 4; }; template <GTEST_5_TYPENAMES_(T)> struct tuple_size<GTEST_5_TUPLE_(T) > { static const int value = 5; }; template <GTEST_6_TYPENAMES_(T)> struct tuple_size<GTEST_6_TUPLE_(T) > { static const int value = 6; }; template <GTEST_7_TYPENAMES_(T)> struct tuple_size<GTEST_7_TUPLE_(T) > { static const int value = 7; }; template <GTEST_8_TYPENAMES_(T)> struct tuple_size<GTEST_8_TUPLE_(T) > { static const int value = 8; }; template <GTEST_9_TYPENAMES_(T)> struct tuple_size<GTEST_9_TUPLE_(T) > { static const int value = 9; }; template <GTEST_10_TYPENAMES_(T)> struct tuple_size<GTEST_10_TUPLE_(T) > { static const int value = 10; }; template <int k, class Tuple> struct tuple_element { typedef typename gtest_internal::TupleElement< k < (tuple_size<Tuple>::value), k, Tuple>::type type; }; #define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type // 6.1.3.4 Element access. namespace gtest_internal { template <> class Get<0> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple)) Field(Tuple& t) { return t.f0_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(0, Tuple)) ConstField(const Tuple& t) { return t.f0_; } }; template <> class Get<1> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple)) Field(Tuple& t) { return t.f1_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(1, Tuple)) ConstField(const Tuple& t) { return t.f1_; } }; template <> class Get<2> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple)) Field(Tuple& t) { return t.f2_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(2, Tuple)) ConstField(const Tuple& t) { return t.f2_; } }; template <> class Get<3> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple)) Field(Tuple& t) { return t.f3_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(3, Tuple)) ConstField(const Tuple& t) { return t.f3_; } }; template <> class Get<4> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple)) Field(Tuple& t) { return t.f4_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(4, Tuple)) ConstField(const Tuple& t) { return t.f4_; } }; template <> class Get<5> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple)) Field(Tuple& t) { return t.f5_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(5, Tuple)) ConstField(const Tuple& t) { return t.f5_; } }; template <> class Get<6> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple)) Field(Tuple& t) { return t.f6_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(6, Tuple)) ConstField(const Tuple& t) { return t.f6_; } }; template <> class Get<7> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple)) Field(Tuple& t) { return t.f7_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(7, Tuple)) ConstField(const Tuple& t) { return t.f7_; } }; template <> class Get<8> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple)) Field(Tuple& t) { return t.f8_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(8, Tuple)) ConstField(const Tuple& t) { return t.f8_; } }; template <> class Get<9> { public: template <class Tuple> static GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple)) Field(Tuple& t) { return t.f9_; } // NOLINT template <class Tuple> static GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(9, Tuple)) ConstField(const Tuple& t) { return t.f9_; } }; } // namespace gtest_internal template <int k, GTEST_10_TYPENAMES_(T)> GTEST_ADD_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T))) get(GTEST_10_TUPLE_(T)& t) { return gtest_internal::Get<k>::Field(t); } template <int k, GTEST_10_TYPENAMES_(T)> GTEST_BY_REF_(GTEST_TUPLE_ELEMENT_(k, GTEST_10_TUPLE_(T))) get(const GTEST_10_TUPLE_(T)& t) { return gtest_internal::Get<k>::ConstField(t); } // 6.1.3.5 Relational operators // We only implement == and !=, as we don't have a need for the rest yet. namespace gtest_internal { // SameSizeTuplePrefixComparator<k, k>::Eq(t1, t2) returns true if the // first k fields of t1 equals the first k fields of t2. // SameSizeTuplePrefixComparator(k1, k2) would be a compiler error if // k1 != k2. template <int kSize1, int kSize2> struct SameSizeTuplePrefixComparator; template <> struct SameSizeTuplePrefixComparator<0, 0> { template <class Tuple1, class Tuple2> static bool Eq(const Tuple1& /* t1 */, const Tuple2& /* t2 */) { return true; } }; template <int k> struct SameSizeTuplePrefixComparator<k, k> { template <class Tuple1, class Tuple2> static bool Eq(const Tuple1& t1, const Tuple2& t2) { return SameSizeTuplePrefixComparator<k - 1, k - 1>::Eq(t1, t2) && ::std::tr1::get<k - 1>(t1) == ::std::tr1::get<k - 1>(t2); } }; } // namespace gtest_internal template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)> inline bool operator==(const GTEST_10_TUPLE_(T)& t, const GTEST_10_TUPLE_(U)& u) { return gtest_internal::SameSizeTuplePrefixComparator< tuple_size<GTEST_10_TUPLE_(T) >::value, tuple_size<GTEST_10_TUPLE_(U) >::value>::Eq(t, u); } template <GTEST_10_TYPENAMES_(T), GTEST_10_TYPENAMES_(U)> inline bool operator!=(const GTEST_10_TUPLE_(T)& t, const GTEST_10_TUPLE_(U)& u) { return !(t == u); } // 6.1.4 Pairs. // Unimplemented. } // namespace tr1 } // namespace std #undef GTEST_0_TUPLE_ #undef GTEST_1_TUPLE_ #undef GTEST_2_TUPLE_ #undef GTEST_3_TUPLE_ #undef GTEST_4_TUPLE_ #undef GTEST_5_TUPLE_ #undef GTEST_6_TUPLE_ #undef GTEST_7_TUPLE_ #undef GTEST_8_TUPLE_ #undef GTEST_9_TUPLE_ #undef GTEST_10_TUPLE_ #undef GTEST_0_TYPENAMES_ #undef GTEST_1_TYPENAMES_ #undef GTEST_2_TYPENAMES_ #undef GTEST_3_TYPENAMES_ #undef GTEST_4_TYPENAMES_ #undef GTEST_5_TYPENAMES_ #undef GTEST_6_TYPENAMES_ #undef GTEST_7_TYPENAMES_ #undef GTEST_8_TYPENAMES_ #undef GTEST_9_TYPENAMES_ #undef GTEST_10_TYPENAMES_ #undef GTEST_DECLARE_TUPLE_AS_FRIEND_ #undef GTEST_BY_REF_ #undef GTEST_ADD_REF_ #undef GTEST_TUPLE_ELEMENT_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
{ "pile_set_name": "Github" }
// Copyright 2011 Google Inc. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package uuid import ( "crypto/md5" "crypto/sha1" "hash" ) // Well known Name Space IDs and UUIDs var ( NameSpace_DNS = Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") NameSpace_URL = Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8") NameSpace_OID = Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8") NameSpace_X500 = Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8") NIL = Parse("00000000-0000-0000-0000-000000000000") ) // NewHash returns a new UUID derived from the hash of space concatenated with // data generated by h. The hash should be at least 16 byte in length. The // first 16 bytes of the hash are used to form the UUID. The version of the // UUID will be the lower 4 bits of version. NewHash is used to implement // NewMD5 and NewSHA1. func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { h.Reset() h.Write(space) h.Write([]byte(data)) s := h.Sum(nil) uuid := make([]byte, 16) copy(uuid, s) uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant return uuid } // NewMD5 returns a new MD5 (Version 3) UUID based on the // supplied name space and data. // // NewHash(md5.New(), space, data, 3) func NewMD5(space UUID, data []byte) UUID { return NewHash(md5.New(), space, data, 3) } // NewSHA1 returns a new SHA1 (Version 5) UUID based on the // supplied name space and data. // // NewHash(sha1.New(), space, data, 5) func NewSHA1(space UUID, data []byte) UUID { return NewHash(sha1.New(), space, data, 5) }
{ "pile_set_name": "Github" }
// //Copyright (C) 2015 LunarG, Inc. // //All rights reserved. // //Redistribution and use in source and binary forms, with or without //modification, are permitted provided that the following conditions //are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // // Neither the name of 3Dlabs Inc. Ltd. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS //"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS //FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE //COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, //INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, //BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER //CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT //LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE //POSSIBILITY OF SUCH DAMAGE. // #include "SPVRemapper.h" #include "doc.h" #if !defined (use_cpp11) // ... not supported before C++11 #else // defined (use_cpp11) #include <algorithm> #include <cassert> #include "../glslang/Include/Common.h" namespace spv { // By default, just abort on error. Can be overridden via RegisterErrorHandler spirvbin_t::errorfn_t spirvbin_t::errorHandler = [](const std::string&) { exit(5); }; // By default, eat log messages. Can be overridden via RegisterLogHandler spirvbin_t::logfn_t spirvbin_t::logHandler = [](const std::string&) { }; // This can be overridden to provide other message behavior if needed void spirvbin_t::msg(int minVerbosity, int indent, const std::string& txt) const { if (verbose >= minVerbosity) logHandler(std::string(indent, ' ') + txt); } // hash opcode, with special handling for OpExtInst std::uint32_t spirvbin_t::asOpCodeHash(unsigned word) { const spv::Op opCode = asOpCode(word); std::uint32_t offset = 0; switch (opCode) { case spv::OpExtInst: offset += asId(word + 4); break; default: break; } return opCode * 19 + offset; // 19 = small prime } spirvbin_t::range_t spirvbin_t::literalRange(spv::Op opCode) const { static const int maxCount = 1<<30; switch (opCode) { case spv::OpTypeFloat: // fall through... case spv::OpTypePointer: return range_t(2, 3); case spv::OpTypeInt: return range_t(2, 4); // TODO: case spv::OpTypeImage: // TODO: case spv::OpTypeSampledImage: case spv::OpTypeSampler: return range_t(3, 8); case spv::OpTypeVector: // fall through case spv::OpTypeMatrix: // ... case spv::OpTypePipe: return range_t(3, 4); case spv::OpConstant: return range_t(3, maxCount); default: return range_t(0, 0); } } spirvbin_t::range_t spirvbin_t::typeRange(spv::Op opCode) const { static const int maxCount = 1<<30; if (isConstOp(opCode)) return range_t(1, 2); switch (opCode) { case spv::OpTypeVector: // fall through case spv::OpTypeMatrix: // ... case spv::OpTypeSampler: // ... case spv::OpTypeArray: // ... case spv::OpTypeRuntimeArray: // ... case spv::OpTypePipe: return range_t(2, 3); case spv::OpTypeStruct: // fall through case spv::OpTypeFunction: return range_t(2, maxCount); case spv::OpTypePointer: return range_t(3, 4); default: return range_t(0, 0); } } spirvbin_t::range_t spirvbin_t::constRange(spv::Op opCode) const { static const int maxCount = 1<<30; switch (opCode) { case spv::OpTypeArray: // fall through... case spv::OpTypeRuntimeArray: return range_t(3, 4); case spv::OpConstantComposite: return range_t(3, maxCount); default: return range_t(0, 0); } } // Is this an opcode we should remove when using --strip? bool spirvbin_t::isStripOp(spv::Op opCode) const { switch (opCode) { case spv::OpSource: case spv::OpSourceExtension: case spv::OpName: case spv::OpMemberName: case spv::OpLine: return true; default: return false; } } bool spirvbin_t::isFlowCtrl(spv::Op opCode) const { switch (opCode) { case spv::OpBranchConditional: case spv::OpBranch: case spv::OpSwitch: case spv::OpLoopMerge: case spv::OpSelectionMerge: case spv::OpLabel: case spv::OpFunction: case spv::OpFunctionEnd: return true; default: return false; } } bool spirvbin_t::isTypeOp(spv::Op opCode) const { switch (opCode) { case spv::OpTypeVoid: case spv::OpTypeBool: case spv::OpTypeInt: case spv::OpTypeFloat: case spv::OpTypeVector: case spv::OpTypeMatrix: case spv::OpTypeImage: case spv::OpTypeSampler: case spv::OpTypeArray: case spv::OpTypeRuntimeArray: case spv::OpTypeStruct: case spv::OpTypeOpaque: case spv::OpTypePointer: case spv::OpTypeFunction: case spv::OpTypeEvent: case spv::OpTypeDeviceEvent: case spv::OpTypeReserveId: case spv::OpTypeQueue: case spv::OpTypeSampledImage: case spv::OpTypePipe: return true; default: return false; } } bool spirvbin_t::isConstOp(spv::Op opCode) const { switch (opCode) { case spv::OpConstantNull: error("unimplemented constant type"); case spv::OpConstantSampler: error("unimplemented constant type"); case spv::OpConstantTrue: case spv::OpConstantFalse: case spv::OpConstantComposite: case spv::OpConstant: return true; default: return false; } } const auto inst_fn_nop = [](spv::Op, unsigned) { return false; }; const auto op_fn_nop = [](spv::Id&) { }; // g++ doesn't like these defined in the class proper in an anonymous namespace. // Dunno why. Also MSVC doesn't like the constexpr keyword. Also dunno why. // Defining them externally seems to please both compilers, so, here they are. const spv::Id spirvbin_t::unmapped = spv::Id(-10000); const spv::Id spirvbin_t::unused = spv::Id(-10001); const int spirvbin_t::header_size = 5; spv::Id spirvbin_t::nextUnusedId(spv::Id id) { while (isNewIdMapped(id)) // search for an unused ID ++id; return id; } spv::Id spirvbin_t::localId(spv::Id id, spv::Id newId) { assert(id != spv::NoResult && newId != spv::NoResult); if (id >= idMapL.size()) idMapL.resize(id+1, unused); if (newId != unmapped && newId != unused) { if (isOldIdUnused(id)) error(std::string("ID unused in module: ") + std::to_string(id)); if (!isOldIdUnmapped(id)) error(std::string("ID already mapped: ") + std::to_string(id) + " -> " + std::to_string(localId(id))); if (isNewIdMapped(newId)) error(std::string("ID already used in module: ") + std::to_string(newId)); msg(4, 4, std::string("map: ") + std::to_string(id) + " -> " + std::to_string(newId)); setMapped(newId); largestNewId = std::max(largestNewId, newId); } return idMapL[id] = newId; } // Parse a literal string from the SPIR binary and return it as an std::string // Due to C++11 RValue references, this doesn't copy the result string. std::string spirvbin_t::literalString(unsigned word) const { std::string literal; literal.reserve(16); const char* bytes = reinterpret_cast<const char*>(spv.data() + word); while (bytes && *bytes) literal += *bytes++; return literal; } void spirvbin_t::applyMap() { msg(3, 2, std::string("Applying map: ")); // Map local IDs through the ID map process(inst_fn_nop, // ignore instructions [this](spv::Id& id) { id = localId(id); assert(id != unused && id != unmapped); } ); } // Find free IDs for anything we haven't mapped void spirvbin_t::mapRemainder() { msg(3, 2, std::string("Remapping remainder: ")); spv::Id unusedId = 1; // can't use 0: that's NoResult spirword_t maxBound = 0; for (spv::Id id = 0; id < idMapL.size(); ++id) { if (isOldIdUnused(id)) continue; // Find a new mapping for any used but unmapped IDs if (isOldIdUnmapped(id)) localId(id, unusedId = nextUnusedId(unusedId)); if (isOldIdUnmapped(id)) error(std::string("old ID not mapped: ") + std::to_string(id)); // Track max bound maxBound = std::max(maxBound, localId(id) + 1); } bound(maxBound); // reset header ID bound to as big as it now needs to be } void spirvbin_t::stripDebug() { if ((options & STRIP) == 0) return; // build local Id and name maps process( [&](spv::Op opCode, unsigned start) { // remember opcodes we want to strip later if (isStripOp(opCode)) stripInst(start); return true; }, op_fn_nop); } void spirvbin_t::buildLocalMaps() { msg(2, 2, std::string("build local maps: ")); mapped.clear(); idMapL.clear(); // preserve nameMap, so we don't clear that. fnPos.clear(); fnPosDCE.clear(); fnCalls.clear(); typeConstPos.clear(); typeConstPosR.clear(); entryPoint = spv::NoResult; largestNewId = 0; idMapL.resize(bound(), unused); int fnStart = 0; spv::Id fnRes = spv::NoResult; // build local Id and name maps process( [&](spv::Op opCode, unsigned start) { // remember opcodes we want to strip later if ((options & STRIP) && isStripOp(opCode)) stripInst(start); if (opCode == spv::Op::OpName) { const spv::Id target = asId(start+1); const std::string name = literalString(start+2); nameMap[name] = target; } else if (opCode == spv::Op::OpFunctionCall) { ++fnCalls[asId(start + 3)]; } else if (opCode == spv::Op::OpEntryPoint) { entryPoint = asId(start + 2); } else if (opCode == spv::Op::OpFunction) { if (fnStart != 0) error("nested function found"); fnStart = start; fnRes = asId(start + 2); } else if (opCode == spv::Op::OpFunctionEnd) { assert(fnRes != spv::NoResult); if (fnStart == 0) error("function end without function start"); fnPos[fnRes] = range_t(fnStart, start + asWordCount(start)); fnStart = 0; } else if (isConstOp(opCode)) { assert(asId(start + 2) != spv::NoResult); typeConstPos.insert(start); typeConstPosR[asId(start + 2)] = start; } else if (isTypeOp(opCode)) { assert(asId(start + 1) != spv::NoResult); typeConstPos.insert(start); typeConstPosR[asId(start + 1)] = start; } return false; }, [this](spv::Id& id) { localId(id, unmapped); } ); } // Validate the SPIR header void spirvbin_t::validate() const { msg(2, 2, std::string("validating: ")); if (spv.size() < header_size) error("file too short: "); if (magic() != spv::MagicNumber) error("bad magic number"); // field 1 = version // field 2 = generator magic // field 3 = result <id> bound if (schemaNum() != 0) error("bad schema, must be 0"); } int spirvbin_t::processInstruction(unsigned word, instfn_t instFn, idfn_t idFn) { const auto instructionStart = word; const unsigned wordCount = asWordCount(instructionStart); const spv::Op opCode = asOpCode(instructionStart); const int nextInst = word++ + wordCount; if (nextInst > int(spv.size())) error("spir instruction terminated too early"); // Base for computing number of operands; will be updated as more is learned unsigned numOperands = wordCount - 1; if (instFn(opCode, instructionStart)) return nextInst; // Read type and result ID from instruction desc table if (spv::InstructionDesc[opCode].hasType()) { idFn(asId(word++)); --numOperands; } if (spv::InstructionDesc[opCode].hasResult()) { idFn(asId(word++)); --numOperands; } // Extended instructions: currently, assume everything is an ID. // TODO: add whatever data we need for exceptions to that if (opCode == spv::OpExtInst) { word += 2; // instruction set, and instruction from set numOperands -= 2; for (unsigned op=0; op < numOperands; ++op) idFn(asId(word++)); // ID return nextInst; } // Store IDs from instruction in our map for (int op = 0; numOperands > 0; ++op, --numOperands) { switch (spv::InstructionDesc[opCode].operands.getClass(op)) { case spv::OperandId: idFn(asId(word++)); break; case spv::OperandVariableIds: for (unsigned i = 0; i < numOperands; ++i) idFn(asId(word++)); return nextInst; case spv::OperandVariableLiterals: // for clarity // if (opCode == spv::OpDecorate && asDecoration(word - 1) == spv::DecorationBuiltIn) { // ++word; // --numOperands; // } // word += numOperands; return nextInst; case spv::OperandVariableLiteralId: while (numOperands > 0) { ++word; // immediate idFn(asId(word++)); // ID numOperands -= 2; } return nextInst; case spv::OperandLiteralString: { const int stringWordCount = literalStringWords(literalString(word)); word += stringWordCount; numOperands -= (stringWordCount-1); // -1 because for() header post-decrements break; } // Execution mode might have extra literal operands. Skip them. case spv::OperandExecutionMode: return nextInst; // Single word operands we simply ignore, as they hold no IDs case spv::OperandLiteralNumber: case spv::OperandSource: case spv::OperandExecutionModel: case spv::OperandAddressing: case spv::OperandMemory: case spv::OperandStorage: case spv::OperandDimensionality: case spv::OperandSamplerAddressingMode: case spv::OperandSamplerFilterMode: case spv::OperandSamplerImageFormat: case spv::OperandImageChannelOrder: case spv::OperandImageChannelDataType: case spv::OperandImageOperands: case spv::OperandFPFastMath: case spv::OperandFPRoundingMode: case spv::OperandLinkageType: case spv::OperandAccessQualifier: case spv::OperandFuncParamAttr: case spv::OperandDecoration: case spv::OperandBuiltIn: case spv::OperandSelect: case spv::OperandLoop: case spv::OperandFunction: case spv::OperandMemorySemantics: case spv::OperandMemoryAccess: case spv::OperandScope: case spv::OperandGroupOperation: case spv::OperandKernelEnqueueFlags: case spv::OperandKernelProfilingInfo: case spv::OperandCapability: ++word; break; default: assert(0 && "Unhandled Operand Class"); break; } } return nextInst; } // Make a pass over all the instructions and process them given appropriate functions spirvbin_t& spirvbin_t::process(instfn_t instFn, idfn_t idFn, unsigned begin, unsigned end) { // For efficiency, reserve name map space. It can grow if needed. nameMap.reserve(32); // If begin or end == 0, use defaults begin = (begin == 0 ? header_size : begin); end = (end == 0 ? unsigned(spv.size()) : end); // basic parsing and InstructionDesc table borrowed from SpvDisassemble.cpp... unsigned nextInst = unsigned(spv.size()); for (unsigned word = begin; word < end; word = nextInst) nextInst = processInstruction(word, instFn, idFn); return *this; } // Apply global name mapping to a single module void spirvbin_t::mapNames() { static const std::uint32_t softTypeIdLimit = 3011; // small prime. TODO: get from options static const std::uint32_t firstMappedID = 3019; // offset into ID space for (const auto& name : nameMap) { std::uint32_t hashval = 1911; for (const char c : name.first) hashval = hashval * 1009 + c; if (isOldIdUnmapped(name.second)) localId(name.second, nextUnusedId(hashval % softTypeIdLimit + firstMappedID)); } } // Map fn contents to IDs of similar functions in other modules void spirvbin_t::mapFnBodies() { static const std::uint32_t softTypeIdLimit = 19071; // small prime. TODO: get from options static const std::uint32_t firstMappedID = 6203; // offset into ID space // Initial approach: go through some high priority opcodes first and assign them // hash values. spv::Id fnId = spv::NoResult; std::vector<unsigned> instPos; instPos.reserve(unsigned(spv.size()) / 16); // initial estimate; can grow if needed. // Build local table of instruction start positions process( [&](spv::Op, unsigned start) { instPos.push_back(start); return true; }, op_fn_nop); // Window size for context-sensitive canonicalization values // Empirical best size from a single data set. TODO: Would be a good tunable. // We essentially perform a little convolution around each instruction, // to capture the flavor of nearby code, to hopefully match to similar // code in other modules. static const unsigned windowSize = 2; for (unsigned entry = 0; entry < unsigned(instPos.size()); ++entry) { const unsigned start = instPos[entry]; const spv::Op opCode = asOpCode(start); if (opCode == spv::OpFunction) fnId = asId(start + 2); if (opCode == spv::OpFunctionEnd) fnId = spv::NoResult; if (fnId != spv::NoResult) { // if inside a function if (spv::InstructionDesc[opCode].hasResult()) { const unsigned word = start + (spv::InstructionDesc[opCode].hasType() ? 2 : 1); const spv::Id resId = asId(word); std::uint32_t hashval = fnId * 17; // small prime for (unsigned i = entry-1; i >= entry-windowSize; --i) { if (asOpCode(instPos[i]) == spv::OpFunction) break; hashval = hashval * 30103 + asOpCodeHash(instPos[i]); // 30103 = semiarbitrary prime } for (unsigned i = entry; i <= entry + windowSize; ++i) { if (asOpCode(instPos[i]) == spv::OpFunctionEnd) break; hashval = hashval * 30103 + asOpCodeHash(instPos[i]); // 30103 = semiarbitrary prime } if (isOldIdUnmapped(resId)) localId(resId, nextUnusedId(hashval % softTypeIdLimit + firstMappedID)); } } } spv::Op thisOpCode(spv::OpNop); std::unordered_map<int, int> opCounter; int idCounter(0); fnId = spv::NoResult; process( [&](spv::Op opCode, unsigned start) { switch (opCode) { case spv::OpFunction: // Reset counters at each function idCounter = 0; opCounter.clear(); fnId = asId(start + 2); break; case spv::OpImageSampleImplicitLod: case spv::OpImageSampleExplicitLod: case spv::OpImageSampleDrefImplicitLod: case spv::OpImageSampleDrefExplicitLod: case spv::OpImageSampleProjImplicitLod: case spv::OpImageSampleProjExplicitLod: case spv::OpImageSampleProjDrefImplicitLod: case spv::OpImageSampleProjDrefExplicitLod: case spv::OpDot: case spv::OpCompositeExtract: case spv::OpCompositeInsert: case spv::OpVectorShuffle: case spv::OpLabel: case spv::OpVariable: case spv::OpAccessChain: case spv::OpLoad: case spv::OpStore: case spv::OpCompositeConstruct: case spv::OpFunctionCall: ++opCounter[opCode]; idCounter = 0; thisOpCode = opCode; break; default: thisOpCode = spv::OpNop; } return false; }, [&](spv::Id& id) { if (thisOpCode != spv::OpNop) { ++idCounter; const std::uint32_t hashval = opCounter[thisOpCode] * thisOpCode * 50047 + idCounter + fnId * 117; if (isOldIdUnmapped(id)) localId(id, nextUnusedId(hashval % softTypeIdLimit + firstMappedID)); } }); } // EXPERIMENTAL: forward IO and uniform load/stores into operands // This produces invalid Schema-0 SPIRV void spirvbin_t::forwardLoadStores() { idset_t fnLocalVars; // set of function local vars idmap_t idMap; // Map of load result IDs to what they load // EXPERIMENTAL: Forward input and access chain loads into consumptions process( [&](spv::Op opCode, unsigned start) { // Add inputs and uniforms to the map if ((opCode == spv::OpVariable && asWordCount(start) == 4) && (spv[start+3] == spv::StorageClassUniform || spv[start+3] == spv::StorageClassUniformConstant || spv[start+3] == spv::StorageClassInput)) fnLocalVars.insert(asId(start+2)); if (opCode == spv::OpAccessChain && fnLocalVars.count(asId(start+3)) > 0) fnLocalVars.insert(asId(start+2)); if (opCode == spv::OpLoad && fnLocalVars.count(asId(start+3)) > 0) { idMap[asId(start+2)] = asId(start+3); stripInst(start); } return false; }, [&](spv::Id& id) { if (idMap.find(id) != idMap.end()) id = idMap[id]; } ); // EXPERIMENTAL: Implicit output stores fnLocalVars.clear(); idMap.clear(); process( [&](spv::Op opCode, unsigned start) { // Add inputs and uniforms to the map if ((opCode == spv::OpVariable && asWordCount(start) == 4) && (spv[start+3] == spv::StorageClassOutput)) fnLocalVars.insert(asId(start+2)); if (opCode == spv::OpStore && fnLocalVars.count(asId(start+1)) > 0) { idMap[asId(start+2)] = asId(start+1); stripInst(start); } return false; }, op_fn_nop); process( inst_fn_nop, [&](spv::Id& id) { if (idMap.find(id) != idMap.end()) id = idMap[id]; } ); strip(); // strip out data we decided to eliminate } // optimize loads and stores void spirvbin_t::optLoadStore() { idset_t fnLocalVars; // candidates for removal (only locals) idmap_t idMap; // Map of load result IDs to what they load blockmap_t blockMap; // Map of IDs to blocks they first appear in int blockNum = 0; // block count, to avoid crossing flow control // Find all the function local pointers stored at most once, and not via access chains process( [&](spv::Op opCode, unsigned start) { const int wordCount = asWordCount(start); // Count blocks, so we can avoid crossing flow control if (isFlowCtrl(opCode)) ++blockNum; // Add local variables to the map if ((opCode == spv::OpVariable && spv[start+3] == spv::StorageClassFunction && asWordCount(start) == 4)) { fnLocalVars.insert(asId(start+2)); return true; } // Ignore process vars referenced via access chain if ((opCode == spv::OpAccessChain || opCode == spv::OpInBoundsAccessChain) && fnLocalVars.count(asId(start+3)) > 0) { fnLocalVars.erase(asId(start+3)); idMap.erase(asId(start+3)); return true; } if (opCode == spv::OpLoad && fnLocalVars.count(asId(start+3)) > 0) { const spv::Id varId = asId(start+3); // Avoid loads before stores if (idMap.find(varId) == idMap.end()) { fnLocalVars.erase(varId); idMap.erase(varId); } // don't do for volatile references if (wordCount > 4 && (spv[start+4] & spv::MemoryAccessVolatileMask)) { fnLocalVars.erase(varId); idMap.erase(varId); } // Handle flow control if (blockMap.find(varId) == blockMap.end()) { blockMap[varId] = blockNum; // track block we found it in. } else if (blockMap[varId] != blockNum) { fnLocalVars.erase(varId); // Ignore if crosses flow control idMap.erase(varId); } return true; } if (opCode == spv::OpStore && fnLocalVars.count(asId(start+1)) > 0) { const spv::Id varId = asId(start+1); if (idMap.find(varId) == idMap.end()) { idMap[varId] = asId(start+2); } else { // Remove if it has more than one store to the same pointer fnLocalVars.erase(varId); idMap.erase(varId); } // don't do for volatile references if (wordCount > 3 && (spv[start+3] & spv::MemoryAccessVolatileMask)) { fnLocalVars.erase(asId(start+3)); idMap.erase(asId(start+3)); } // Handle flow control if (blockMap.find(varId) == blockMap.end()) { blockMap[varId] = blockNum; // track block we found it in. } else if (blockMap[varId] != blockNum) { fnLocalVars.erase(varId); // Ignore if crosses flow control idMap.erase(varId); } return true; } return false; }, // If local var id used anywhere else, don't eliminate [&](spv::Id& id) { if (fnLocalVars.count(id) > 0) { fnLocalVars.erase(id); idMap.erase(id); } } ); process( [&](spv::Op opCode, unsigned start) { if (opCode == spv::OpLoad && fnLocalVars.count(asId(start+3)) > 0) idMap[asId(start+2)] = idMap[asId(start+3)]; return false; }, op_fn_nop); // Chase replacements to their origins, in case there is a chain such as: // 2 = store 1 // 3 = load 2 // 4 = store 3 // 5 = load 4 // We want to replace uses of 5 with 1. for (const auto& idPair : idMap) { spv::Id id = idPair.first; while (idMap.find(id) != idMap.end()) // Chase to end of chain id = idMap[id]; idMap[idPair.first] = id; // replace with final result } // Remove the load/store/variables for the ones we've discovered process( [&](spv::Op opCode, unsigned start) { if ((opCode == spv::OpLoad && fnLocalVars.count(asId(start+3)) > 0) || (opCode == spv::OpStore && fnLocalVars.count(asId(start+1)) > 0) || (opCode == spv::OpVariable && fnLocalVars.count(asId(start+2)) > 0)) { stripInst(start); return true; } return false; }, [&](spv::Id& id) { if (idMap.find(id) != idMap.end()) id = idMap[id]; } ); strip(); // strip out data we decided to eliminate } // remove bodies of uncalled functions void spirvbin_t::dceFuncs() { msg(3, 2, std::string("Removing Dead Functions: ")); // TODO: There are more efficient ways to do this. bool changed = true; while (changed) { changed = false; for (auto fn = fnPos.begin(); fn != fnPos.end(); ) { if (fn->first == entryPoint) { // don't DCE away the entry point! ++fn; continue; } const auto call_it = fnCalls.find(fn->first); if (call_it == fnCalls.end() || call_it->second == 0) { changed = true; stripRange.push_back(fn->second); fnPosDCE.insert(*fn); // decrease counts of called functions process( [&](spv::Op opCode, unsigned start) { if (opCode == spv::Op::OpFunctionCall) { const auto call_it = fnCalls.find(asId(start + 3)); if (call_it != fnCalls.end()) { if (--call_it->second <= 0) fnCalls.erase(call_it); } } return true; }, op_fn_nop, fn->second.first, fn->second.second); fn = fnPos.erase(fn); } else ++fn; } } } // remove unused function variables + decorations void spirvbin_t::dceVars() { msg(3, 2, std::string("DCE Vars: ")); std::unordered_map<spv::Id, int> varUseCount; // Count function variable use process( [&](spv::Op opCode, unsigned start) { if (opCode == spv::OpVariable) { ++varUseCount[asId(start+2)]; return true; } else if (opCode == spv::OpEntryPoint) { const int wordCount = asWordCount(start); for (int i = 4; i < wordCount; i++) { ++varUseCount[asId(start+i)]; } return true; } else return false; }, [&](spv::Id& id) { if (varUseCount[id]) ++varUseCount[id]; } ); // Remove single-use function variables + associated decorations and names process( [&](spv::Op opCode, unsigned start) { if ((opCode == spv::OpVariable && varUseCount[asId(start+2)] == 1) || (opCode == spv::OpDecorate && varUseCount[asId(start+1)] == 1) || (opCode == spv::OpName && varUseCount[asId(start+1)] == 1)) { stripInst(start); } return true; }, op_fn_nop); } // remove unused types void spirvbin_t::dceTypes() { std::vector<bool> isType(bound(), false); // for speed, make O(1) way to get to type query (map is log(n)) for (const auto typeStart : typeConstPos) isType[asTypeConstId(typeStart)] = true; std::unordered_map<spv::Id, int> typeUseCount; // Count total type usage process(inst_fn_nop, [&](spv::Id& id) { if (isType[id]) ++typeUseCount[id]; } ); // Remove types from deleted code for (const auto& fn : fnPosDCE) process(inst_fn_nop, [&](spv::Id& id) { if (isType[id]) --typeUseCount[id]; }, fn.second.first, fn.second.second); // Remove single reference types for (const auto typeStart : typeConstPos) { const spv::Id typeId = asTypeConstId(typeStart); if (typeUseCount[typeId] == 1) { --typeUseCount[typeId]; stripInst(typeStart); } } } #ifdef NOTDEF bool spirvbin_t::matchType(const spirvbin_t::globaltypes_t& globalTypes, spv::Id lt, spv::Id gt) const { // Find the local type id "lt" and global type id "gt" const auto lt_it = typeConstPosR.find(lt); if (lt_it == typeConstPosR.end()) return false; const auto typeStart = lt_it->second; // Search for entry in global table const auto gtype = globalTypes.find(gt); if (gtype == globalTypes.end()) return false; const auto& gdata = gtype->second; // local wordcount and opcode const int wordCount = asWordCount(typeStart); const spv::Op opCode = asOpCode(typeStart); // no type match if opcodes don't match, or operand count doesn't match if (opCode != opOpCode(gdata[0]) || wordCount != opWordCount(gdata[0])) return false; const unsigned numOperands = wordCount - 2; // all types have a result const auto cmpIdRange = [&](range_t range) { for (int x=range.first; x<std::min(range.second, wordCount); ++x) if (!matchType(globalTypes, asId(typeStart+x), gdata[x])) return false; return true; }; const auto cmpConst = [&]() { return cmpIdRange(constRange(opCode)); }; const auto cmpSubType = [&]() { return cmpIdRange(typeRange(opCode)); }; // Compare literals in range [start,end) const auto cmpLiteral = [&]() { const auto range = literalRange(opCode); return std::equal(spir.begin() + typeStart + range.first, spir.begin() + typeStart + std::min(range.second, wordCount), gdata.begin() + range.first); }; assert(isTypeOp(opCode) || isConstOp(opCode)); switch (opCode) { case spv::OpTypeOpaque: // TODO: disable until we compare the literal strings. case spv::OpTypeQueue: return false; case spv::OpTypeEvent: // fall through... case spv::OpTypeDeviceEvent: // ... case spv::OpTypeReserveId: return false; // for samplers, we don't handle the optional parameters yet case spv::OpTypeSampler: return cmpLiteral() && cmpConst() && cmpSubType() && wordCount == 8; default: return cmpLiteral() && cmpConst() && cmpSubType(); } } // Look for an equivalent type in the globalTypes map spv::Id spirvbin_t::findType(const spirvbin_t::globaltypes_t& globalTypes, spv::Id lt) const { // Try a recursive type match on each in turn, and return a match if we find one for (const auto& gt : globalTypes) if (matchType(globalTypes, lt, gt.first)) return gt.first; return spv::NoType; } #endif // NOTDEF // Return start position in SPV of given type. error if not found. unsigned spirvbin_t::typePos(spv::Id id) const { const auto tid_it = typeConstPosR.find(id); if (tid_it == typeConstPosR.end()) error("type ID not found"); return tid_it->second; } // Hash types to canonical values. This can return ID collisions (it's a bit // inevitable): it's up to the caller to handle that gracefully. std::uint32_t spirvbin_t::hashType(unsigned typeStart) const { const unsigned wordCount = asWordCount(typeStart); const spv::Op opCode = asOpCode(typeStart); switch (opCode) { case spv::OpTypeVoid: return 0; case spv::OpTypeBool: return 1; case spv::OpTypeInt: return 3 + (spv[typeStart+3]); case spv::OpTypeFloat: return 5; case spv::OpTypeVector: return 6 + hashType(typePos(spv[typeStart+2])) * (spv[typeStart+3] - 1); case spv::OpTypeMatrix: return 30 + hashType(typePos(spv[typeStart+2])) * (spv[typeStart+3] - 1); case spv::OpTypeImage: return 120 + hashType(typePos(spv[typeStart+2])) + spv[typeStart+3] + // dimensionality spv[typeStart+4] * 8 * 16 + // depth spv[typeStart+5] * 4 * 16 + // arrayed spv[typeStart+6] * 2 * 16 + // multisampled spv[typeStart+7] * 1 * 16; // format case spv::OpTypeSampler: return 500; case spv::OpTypeSampledImage: return 502; case spv::OpTypeArray: return 501 + hashType(typePos(spv[typeStart+2])) * spv[typeStart+3]; case spv::OpTypeRuntimeArray: return 5000 + hashType(typePos(spv[typeStart+2])); case spv::OpTypeStruct: { std::uint32_t hash = 10000; for (unsigned w=2; w < wordCount; ++w) hash += w * hashType(typePos(spv[typeStart+w])); return hash; } case spv::OpTypeOpaque: return 6000 + spv[typeStart+2]; case spv::OpTypePointer: return 100000 + hashType(typePos(spv[typeStart+3])); case spv::OpTypeFunction: { std::uint32_t hash = 200000; for (unsigned w=2; w < wordCount; ++w) hash += w * hashType(typePos(spv[typeStart+w])); return hash; } case spv::OpTypeEvent: return 300000; case spv::OpTypeDeviceEvent: return 300001; case spv::OpTypeReserveId: return 300002; case spv::OpTypeQueue: return 300003; case spv::OpTypePipe: return 300004; case spv::OpConstantNull: return 300005; case spv::OpConstantSampler: return 300006; case spv::OpConstantTrue: return 300007; case spv::OpConstantFalse: return 300008; case spv::OpConstantComposite: { std::uint32_t hash = 300011 + hashType(typePos(spv[typeStart+1])); for (unsigned w=3; w < wordCount; ++w) hash += w * hashType(typePos(spv[typeStart+w])); return hash; } case spv::OpConstant: { std::uint32_t hash = 400011 + hashType(typePos(spv[typeStart+1])); for (unsigned w=3; w < wordCount; ++w) hash += w * spv[typeStart+w]; return hash; } default: error("unknown type opcode"); return 0; } } void spirvbin_t::mapTypeConst() { globaltypes_t globalTypeMap; msg(3, 2, std::string("Remapping Consts & Types: ")); static const std::uint32_t softTypeIdLimit = 3011; // small prime. TODO: get from options static const std::uint32_t firstMappedID = 8; // offset into ID space for (auto& typeStart : typeConstPos) { const spv::Id resId = asTypeConstId(typeStart); const std::uint32_t hashval = hashType(typeStart); if (isOldIdUnmapped(resId)) localId(resId, nextUnusedId(hashval % softTypeIdLimit + firstMappedID)); } } // Strip a single binary by removing ranges given in stripRange void spirvbin_t::strip() { if (stripRange.empty()) // nothing to do return; // Sort strip ranges in order of traversal std::sort(stripRange.begin(), stripRange.end()); // Allocate a new binary big enough to hold old binary // We'll step this iterator through the strip ranges as we go through the binary auto strip_it = stripRange.begin(); int strippedPos = 0; for (unsigned word = 0; word < unsigned(spv.size()); ++word) { if (strip_it != stripRange.end() && word >= strip_it->second) ++strip_it; if (strip_it == stripRange.end() || word < strip_it->first || word >= strip_it->second) spv[strippedPos++] = spv[word]; } spv.resize(strippedPos); stripRange.clear(); buildLocalMaps(); } // Strip a single binary by removing ranges given in stripRange void spirvbin_t::remap(std::uint32_t opts) { options = opts; // Set up opcode tables from SpvDoc spv::Parameterize(); validate(); // validate header buildLocalMaps(); msg(3, 4, std::string("ID bound: ") + std::to_string(bound())); strip(); // strip out data we decided to eliminate if (options & OPT_LOADSTORE) optLoadStore(); if (options & OPT_FWD_LS) forwardLoadStores(); if (options & DCE_FUNCS) dceFuncs(); if (options & DCE_VARS) dceVars(); if (options & DCE_TYPES) dceTypes(); if (options & MAP_TYPES) mapTypeConst(); if (options & MAP_NAMES) mapNames(); if (options & MAP_FUNCS) mapFnBodies(); mapRemainder(); // map any unmapped IDs applyMap(); // Now remap each shader to the new IDs we've come up with strip(); // strip out data we decided to eliminate } // remap from a memory image void spirvbin_t::remap(std::vector<std::uint32_t>& in_spv, std::uint32_t opts) { spv.swap(in_spv); remap(opts); spv.swap(in_spv); } } // namespace SPV #endif // defined (use_cpp11)
{ "pile_set_name": "Github" }
/* * Copyright 2011-2016 Blender Foundation * * 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. */ CCL_NAMESPACE_BEGIN /* Most of the code is based on the supplemental implementations from * https://eheitzresearch.wordpress.com/240-2/. */ /* === GGX Microfacet distribution functions === */ /* Isotropic GGX microfacet distribution */ ccl_device_forceinline float D_ggx(float3 wm, float alpha) { wm.z *= wm.z; alpha *= alpha; float tmp = (1.0f - wm.z) + alpha * wm.z; return alpha / max(M_PI_F * tmp * tmp, 1e-7f); } /* Anisotropic GGX microfacet distribution */ ccl_device_forceinline float D_ggx_aniso(const float3 wm, const float2 alpha) { float slope_x = -wm.x / alpha.x; float slope_y = -wm.y / alpha.y; float tmp = wm.z * wm.z + slope_x * slope_x + slope_y * slope_y; return 1.0f / max(M_PI_F * tmp * tmp * alpha.x * alpha.y, 1e-7f); } /* Sample slope distribution (based on page 14 of the supplemental implementation). */ ccl_device_forceinline float2 mf_sampleP22_11(const float cosI, const float randx, const float randy) { if (cosI > 0.9999f || fabsf(cosI) < 1e-6f) { const float r = sqrtf(randx / max(1.0f - randx, 1e-7f)); const float phi = M_2PI_F * randy; return make_float2(r * cosf(phi), r * sinf(phi)); } const float sinI = safe_sqrtf(1.0f - cosI * cosI); const float tanI = sinI / cosI; const float projA = 0.5f * (cosI + 1.0f); if (projA < 0.0001f) return make_float2(0.0f, 0.0f); const float A = 2.0f * randx * projA / cosI - 1.0f; float tmp = A * A - 1.0f; if (fabsf(tmp) < 1e-7f) return make_float2(0.0f, 0.0f); tmp = 1.0f / tmp; const float D = safe_sqrtf(tanI * tanI * tmp * tmp - (A * A - tanI * tanI) * tmp); const float slopeX2 = tanI * tmp + D; const float slopeX = (A < 0.0f || slopeX2 > 1.0f / tanI) ? (tanI * tmp - D) : slopeX2; float U2; if (randy >= 0.5f) U2 = 2.0f * (randy - 0.5f); else U2 = 2.0f * (0.5f - randy); const float z = (U2 * (U2 * (U2 * 0.27385f - 0.73369f) + 0.46341f)) / (U2 * (U2 * (U2 * 0.093073f + 0.309420f) - 1.0f) + 0.597999f); const float slopeY = z * sqrtf(1.0f + slopeX * slopeX); if (randy >= 0.5f) return make_float2(slopeX, slopeY); else return make_float2(slopeX, -slopeY); } /* Visible normal sampling for the GGX distribution * (based on page 7 of the supplemental implementation). */ ccl_device_forceinline float3 mf_sample_vndf(const float3 wi, const float2 alpha, const float randx, const float randy) { const float3 wi_11 = normalize(make_float3(alpha.x * wi.x, alpha.y * wi.y, wi.z)); const float2 slope_11 = mf_sampleP22_11(wi_11.z, randx, randy); const float3 cossin_phi = safe_normalize(make_float3(wi_11.x, wi_11.y, 0.0f)); const float slope_x = alpha.x * (cossin_phi.x * slope_11.x - cossin_phi.y * slope_11.y); const float slope_y = alpha.y * (cossin_phi.y * slope_11.x + cossin_phi.x * slope_11.y); kernel_assert(isfinite(slope_x)); return normalize(make_float3(-slope_x, -slope_y, 1.0f)); } /* === Phase functions: Glossy and Glass === */ /* Phase function for reflective materials. */ ccl_device_forceinline float3 mf_sample_phase_glossy(const float3 wi, float3 *weight, const float3 wm) { return -wi + 2.0f * wm * dot(wi, wm); } ccl_device_forceinline float3 mf_eval_phase_glossy(const float3 w, const float lambda, const float3 wo, const float2 alpha) { if (w.z > 0.9999f) return make_float3(0.0f, 0.0f, 0.0f); const float3 wh = normalize(wo - w); if (wh.z < 0.0f) return make_float3(0.0f, 0.0f, 0.0f); float pArea = (w.z < -0.9999f) ? 1.0f : lambda * w.z; const float dotW_WH = dot(-w, wh); if (dotW_WH < 0.0f) return make_float3(0.0f, 0.0f, 0.0f); float phase = max(0.0f, dotW_WH) * 0.25f / max(pArea * dotW_WH, 1e-7f); if (alpha.x == alpha.y) phase *= D_ggx(wh, alpha.x); else phase *= D_ggx_aniso(wh, alpha); return make_float3(phase, phase, phase); } /* Phase function for dielectric transmissive materials, including both reflection and refraction * according to the dielectric fresnel term. */ ccl_device_forceinline float3 mf_sample_phase_glass( const float3 wi, const float eta, const float3 wm, const float randV, bool *outside) { float cosI = dot(wi, wm); float f = fresnel_dielectric_cos(cosI, eta); if (randV < f) { *outside = true; return -wi + 2.0f * wm * cosI; } *outside = false; float inv_eta = 1.0f / eta; float cosT = -safe_sqrtf(1.0f - (1.0f - cosI * cosI) * inv_eta * inv_eta); return normalize(wm * (cosI * inv_eta + cosT) - wi * inv_eta); } ccl_device_forceinline float3 mf_eval_phase_glass(const float3 w, const float lambda, const float3 wo, const bool wo_outside, const float2 alpha, const float eta) { if (w.z > 0.9999f) return make_float3(0.0f, 0.0f, 0.0f); float pArea = (w.z < -0.9999f) ? 1.0f : lambda * w.z; float v; if (wo_outside) { const float3 wh = normalize(wo - w); if (wh.z < 0.0f) return make_float3(0.0f, 0.0f, 0.0f); const float dotW_WH = dot(-w, wh); v = fresnel_dielectric_cos(dotW_WH, eta) * max(0.0f, dotW_WH) * D_ggx(wh, alpha.x) * 0.25f / (pArea * dotW_WH); } else { float3 wh = normalize(wo * eta - w); if (wh.z < 0.0f) wh = -wh; const float dotW_WH = dot(-w, wh), dotWO_WH = dot(wo, wh); if (dotW_WH < 0.0f) return make_float3(0.0f, 0.0f, 0.0f); float temp = dotW_WH + eta * dotWO_WH; v = (1.0f - fresnel_dielectric_cos(dotW_WH, eta)) * max(0.0f, dotW_WH) * max(0.0f, -dotWO_WH) * D_ggx(wh, alpha.x) / (pArea * temp * temp); } return make_float3(v, v, v); } /* === Utility functions for the random walks === */ /* Smith Lambda function for GGX (based on page 12 of the supplemental implementation). */ ccl_device_forceinline float mf_lambda(const float3 w, const float2 alpha) { if (w.z > 0.9999f) return 0.0f; else if (w.z < -0.9999f) return -0.9999f; const float inv_wz2 = 1.0f / max(w.z * w.z, 1e-7f); const float2 wa = make_float2(w.x, w.y) * alpha; float v = sqrtf(1.0f + dot(wa, wa) * inv_wz2); if (w.z <= 0.0f) v = -v; return 0.5f * (v - 1.0f); } /* Height distribution CDF (based on page 4 of the supplemental implementation). */ ccl_device_forceinline float mf_invC1(const float h) { return 2.0f * saturate(h) - 1.0f; } ccl_device_forceinline float mf_C1(const float h) { return saturate(0.5f * (h + 1.0f)); } /* Masking function (based on page 16 of the supplemental implementation). */ ccl_device_forceinline float mf_G1(const float3 w, const float C1, const float lambda) { if (w.z > 0.9999f) return 1.0f; if (w.z < 1e-5f) return 0.0f; return powf(C1, lambda); } /* Sampling from the visible height distribution (based on page 17 of the supplemental * implementation). */ ccl_device_forceinline bool mf_sample_height( const float3 w, float *h, float *C1, float *G1, float *lambda, const float U) { if (w.z > 0.9999f) return false; if (w.z < -0.9999f) { *C1 *= U; *h = mf_invC1(*C1); *G1 = mf_G1(w, *C1, *lambda); } else if (fabsf(w.z) >= 0.0001f) { if (U > 1.0f - *G1) return false; if (*lambda >= 0.0f) { *C1 = 1.0f; } else { *C1 *= powf(1.0f - U, -1.0f / *lambda); } *h = mf_invC1(*C1); *G1 = mf_G1(w, *C1, *lambda); } return true; } /* === PDF approximations for the different phase functions. === * As explained in bsdf_microfacet_multi_impl.h, using approximations with MIS still produces an * unbiased result. */ /* Approximation for the albedo of the single-scattering GGX distribution, * the missing energy is then approximated as a diffuse reflection for the PDF. */ ccl_device_forceinline float mf_ggx_albedo(float r) { float albedo = 0.806495f * expf(-1.98712f * r * r) + 0.199531f; albedo -= ((((((1.76741f * r - 8.43891f) * r + 15.784f) * r - 14.398f) * r + 6.45221f) * r - 1.19722f) * r + 0.027803f) * r + 0.00568739f; return saturate(albedo); } ccl_device_inline float mf_ggx_transmission_albedo(float a, float ior) { if (ior < 1.0f) { ior = 1.0f / ior; } a = saturate(a); ior = clamp(ior, 1.0f, 3.0f); float I_1 = 0.0476898f * expf(-0.978352f * (ior - 0.65657f) * (ior - 0.65657f)) - 0.033756f * ior + 0.993261f; float R_1 = (((0.116991f * a - 0.270369f) * a + 0.0501366f) * a - 0.00411511f) * a + 1.00008f; float I_2 = (((-2.08704f * ior + 26.3298f) * ior - 127.906f) * ior + 292.958f) * ior - 287.946f + 199.803f / (ior * ior) - 101.668f / (ior * ior * ior); float R_2 = ((((5.3725f * a - 24.9307f) * a + 22.7437f) * a - 3.40751f) * a + 0.0986325f) * a + 0.00493504f; return saturate(1.0f + I_2 * R_2 * 0.0019127f - (1.0f - I_1) * (1.0f - R_1) * 9.3205f); } ccl_device_forceinline float mf_ggx_pdf(const float3 wi, const float3 wo, const float alpha) { float D = D_ggx(normalize(wi + wo), alpha); float lambda = mf_lambda(wi, make_float2(alpha, alpha)); float singlescatter = 0.25f * D / max((1.0f + lambda) * wi.z, 1e-7f); float multiscatter = wo.z * M_1_PI_F; float albedo = mf_ggx_albedo(alpha); return albedo * singlescatter + (1.0f - albedo) * multiscatter; } ccl_device_forceinline float mf_ggx_aniso_pdf(const float3 wi, const float3 wo, const float2 alpha) { float D = D_ggx_aniso(normalize(wi + wo), alpha); float lambda = mf_lambda(wi, alpha); float singlescatter = 0.25f * D / max((1.0f + lambda) * wi.z, 1e-7f); float multiscatter = wo.z * M_1_PI_F; float albedo = mf_ggx_albedo(sqrtf(alpha.x * alpha.y)); return albedo * singlescatter + (1.0f - albedo) * multiscatter; } ccl_device_forceinline float mf_glass_pdf(const float3 wi, const float3 wo, const float alpha, const float eta) { bool reflective = (wi.z * wo.z > 0.0f); float wh_len; float3 wh = normalize_len(wi + (reflective ? wo : (wo * eta)), &wh_len); if (wh.z < 0.0f) wh = -wh; float3 r_wi = (wi.z < 0.0f) ? -wi : wi; float lambda = mf_lambda(r_wi, make_float2(alpha, alpha)); float D = D_ggx(wh, alpha); float fresnel = fresnel_dielectric_cos(dot(r_wi, wh), eta); float multiscatter = fabsf(wo.z * M_1_PI_F); if (reflective) { float singlescatter = 0.25f * D / max((1.0f + lambda) * r_wi.z, 1e-7f); float albedo = mf_ggx_albedo(alpha); return fresnel * (albedo * singlescatter + (1.0f - albedo) * multiscatter); } else { float singlescatter = fabsf(dot(r_wi, wh) * dot(wo, wh) * D * eta * eta / max((1.0f + lambda) * r_wi.z * wh_len * wh_len, 1e-7f)); float albedo = mf_ggx_transmission_albedo(alpha, eta); return (1.0f - fresnel) * (albedo * singlescatter + (1.0f - albedo) * multiscatter); } } /* === Actual random walk implementations === */ /* One version of mf_eval and mf_sample per phase function. */ #define MF_NAME_JOIN(x, y) x##_##y #define MF_NAME_EVAL(x, y) MF_NAME_JOIN(x, y) #define MF_FUNCTION_FULL_NAME(prefix) MF_NAME_EVAL(prefix, MF_PHASE_FUNCTION) #define MF_PHASE_FUNCTION glass #define MF_MULTI_GLASS #include "kernel/closure/bsdf_microfacet_multi_impl.h" #define MF_PHASE_FUNCTION glossy #define MF_MULTI_GLOSSY #include "kernel/closure/bsdf_microfacet_multi_impl.h" ccl_device void bsdf_microfacet_multi_ggx_blur(ShaderClosure *sc, float roughness) { MicrofacetBsdf *bsdf = (MicrofacetBsdf *)sc; bsdf->alpha_x = fmaxf(roughness, bsdf->alpha_x); bsdf->alpha_y = fmaxf(roughness, bsdf->alpha_y); } /* === Closure implementations === */ /* Multiscattering GGX Glossy closure */ ccl_device int bsdf_microfacet_multi_ggx_common_setup(MicrofacetBsdf *bsdf) { bsdf->alpha_x = clamp(bsdf->alpha_x, 1e-4f, 1.0f); bsdf->alpha_y = clamp(bsdf->alpha_y, 1e-4f, 1.0f); bsdf->extra->color = saturate3(bsdf->extra->color); bsdf->extra->cspec0 = saturate3(bsdf->extra->cspec0); return SD_BSDF | SD_BSDF_HAS_EVAL | SD_BSDF_NEEDS_LCG; } ccl_device int bsdf_microfacet_multi_ggx_setup(MicrofacetBsdf *bsdf) { if (is_zero(bsdf->T)) bsdf->T = make_float3(1.0f, 0.0f, 0.0f); bsdf->type = CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID; return bsdf_microfacet_multi_ggx_common_setup(bsdf); } ccl_device int bsdf_microfacet_multi_ggx_fresnel_setup(MicrofacetBsdf *bsdf, const ShaderData *sd) { if (is_zero(bsdf->T)) bsdf->T = make_float3(1.0f, 0.0f, 0.0f); bsdf->type = CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID; bsdf_microfacet_fresnel_color(sd, bsdf); return bsdf_microfacet_multi_ggx_common_setup(bsdf); } ccl_device int bsdf_microfacet_multi_ggx_refraction_setup(MicrofacetBsdf *bsdf) { bsdf->alpha_y = bsdf->alpha_x; bsdf->type = CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID; return bsdf_microfacet_multi_ggx_common_setup(bsdf); } ccl_device float3 bsdf_microfacet_multi_ggx_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf, ccl_addr_space uint *lcg_state) { *pdf = 0.0f; return make_float3(0.0f, 0.0f, 0.0f); } ccl_device float3 bsdf_microfacet_multi_ggx_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf, ccl_addr_space uint *lcg_state) { const MicrofacetBsdf *bsdf = (const MicrofacetBsdf *)sc; if (bsdf->alpha_x * bsdf->alpha_y < 1e-7f) { return make_float3(0.0f, 0.0f, 0.0f); } bool use_fresnel = (bsdf->type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID); bool is_aniso = (bsdf->alpha_x != bsdf->alpha_y); float3 X, Y, Z; Z = bsdf->N; if (is_aniso) make_orthonormals_tangent(Z, bsdf->T, &X, &Y); else make_orthonormals(Z, &X, &Y); float3 localI = make_float3(dot(I, X), dot(I, Y), dot(I, Z)); float3 localO = make_float3(dot(omega_in, X), dot(omega_in, Y), dot(omega_in, Z)); if (is_aniso) *pdf = mf_ggx_aniso_pdf(localI, localO, make_float2(bsdf->alpha_x, bsdf->alpha_y)); else *pdf = mf_ggx_pdf(localI, localO, bsdf->alpha_x); return mf_eval_glossy(localI, localO, true, bsdf->extra->color, bsdf->alpha_x, bsdf->alpha_y, lcg_state, bsdf->ior, use_fresnel, bsdf->extra->cspec0); } ccl_device int bsdf_microfacet_multi_ggx_sample(KernelGlobals *kg, const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf, ccl_addr_space uint *lcg_state) { const MicrofacetBsdf *bsdf = (const MicrofacetBsdf *)sc; float3 X, Y, Z; Z = bsdf->N; if (bsdf->alpha_x * bsdf->alpha_y < 1e-7f) { *omega_in = 2 * dot(Z, I) * Z - I; *pdf = 1e6f; *eval = make_float3(1e6f, 1e6f, 1e6f); #ifdef __RAY_DIFFERENTIALS__ *domega_in_dx = (2 * dot(Z, dIdx)) * Z - dIdx; *domega_in_dy = (2 * dot(Z, dIdy)) * Z - dIdy; #endif return LABEL_REFLECT | LABEL_SINGULAR; } bool use_fresnel = (bsdf->type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID); bool is_aniso = (bsdf->alpha_x != bsdf->alpha_y); if (is_aniso) make_orthonormals_tangent(Z, bsdf->T, &X, &Y); else make_orthonormals(Z, &X, &Y); float3 localI = make_float3(dot(I, X), dot(I, Y), dot(I, Z)); float3 localO; *eval = mf_sample_glossy(localI, &localO, bsdf->extra->color, bsdf->alpha_x, bsdf->alpha_y, lcg_state, bsdf->ior, use_fresnel, bsdf->extra->cspec0); if (is_aniso) *pdf = mf_ggx_aniso_pdf(localI, localO, make_float2(bsdf->alpha_x, bsdf->alpha_y)); else *pdf = mf_ggx_pdf(localI, localO, bsdf->alpha_x); *eval *= *pdf; *omega_in = X * localO.x + Y * localO.y + Z * localO.z; #ifdef __RAY_DIFFERENTIALS__ *domega_in_dx = (2 * dot(Z, dIdx)) * Z - dIdx; *domega_in_dy = (2 * dot(Z, dIdy)) * Z - dIdy; #endif return LABEL_REFLECT | LABEL_GLOSSY; } /* Multiscattering GGX Glass closure */ ccl_device int bsdf_microfacet_multi_ggx_glass_setup(MicrofacetBsdf *bsdf) { bsdf->alpha_x = clamp(bsdf->alpha_x, 1e-4f, 1.0f); bsdf->alpha_y = bsdf->alpha_x; bsdf->ior = max(0.0f, bsdf->ior); bsdf->extra->color = saturate3(bsdf->extra->color); bsdf->type = CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID; return SD_BSDF | SD_BSDF_HAS_EVAL | SD_BSDF_NEEDS_LCG; } ccl_device int bsdf_microfacet_multi_ggx_glass_fresnel_setup(MicrofacetBsdf *bsdf, const ShaderData *sd) { bsdf->alpha_x = clamp(bsdf->alpha_x, 1e-4f, 1.0f); bsdf->alpha_y = bsdf->alpha_x; bsdf->ior = max(0.0f, bsdf->ior); bsdf->extra->color = saturate3(bsdf->extra->color); bsdf->extra->cspec0 = saturate3(bsdf->extra->cspec0); bsdf->type = CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID; bsdf_microfacet_fresnel_color(sd, bsdf); return SD_BSDF | SD_BSDF_HAS_EVAL | SD_BSDF_NEEDS_LCG; } ccl_device float3 bsdf_microfacet_multi_ggx_glass_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf, ccl_addr_space uint *lcg_state) { const MicrofacetBsdf *bsdf = (const MicrofacetBsdf *)sc; if (bsdf->alpha_x * bsdf->alpha_y < 1e-7f) { return make_float3(0.0f, 0.0f, 0.0f); } float3 X, Y, Z; Z = bsdf->N; make_orthonormals(Z, &X, &Y); float3 localI = make_float3(dot(I, X), dot(I, Y), dot(I, Z)); float3 localO = make_float3(dot(omega_in, X), dot(omega_in, Y), dot(omega_in, Z)); *pdf = mf_glass_pdf(localI, localO, bsdf->alpha_x, bsdf->ior); return mf_eval_glass(localI, localO, false, bsdf->extra->color, bsdf->alpha_x, bsdf->alpha_y, lcg_state, bsdf->ior, false, bsdf->extra->color); } ccl_device float3 bsdf_microfacet_multi_ggx_glass_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf, ccl_addr_space uint *lcg_state) { const MicrofacetBsdf *bsdf = (const MicrofacetBsdf *)sc; if (bsdf->alpha_x * bsdf->alpha_y < 1e-7f) { return make_float3(0.0f, 0.0f, 0.0f); } bool use_fresnel = (bsdf->type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID); float3 X, Y, Z; Z = bsdf->N; make_orthonormals(Z, &X, &Y); float3 localI = make_float3(dot(I, X), dot(I, Y), dot(I, Z)); float3 localO = make_float3(dot(omega_in, X), dot(omega_in, Y), dot(omega_in, Z)); *pdf = mf_glass_pdf(localI, localO, bsdf->alpha_x, bsdf->ior); return mf_eval_glass(localI, localO, true, bsdf->extra->color, bsdf->alpha_x, bsdf->alpha_y, lcg_state, bsdf->ior, use_fresnel, bsdf->extra->cspec0); } ccl_device int bsdf_microfacet_multi_ggx_glass_sample(KernelGlobals *kg, const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf, ccl_addr_space uint *lcg_state) { const MicrofacetBsdf *bsdf = (const MicrofacetBsdf *)sc; float3 X, Y, Z; Z = bsdf->N; if (bsdf->alpha_x * bsdf->alpha_y < 1e-7f) { float3 R, T; #ifdef __RAY_DIFFERENTIALS__ float3 dRdx, dRdy, dTdx, dTdy; #endif bool inside; float fresnel = fresnel_dielectric(bsdf->ior, Z, I, &R, &T, #ifdef __RAY_DIFFERENTIALS__ dIdx, dIdy, &dRdx, &dRdy, &dTdx, &dTdy, #endif &inside); *pdf = 1e6f; *eval = make_float3(1e6f, 1e6f, 1e6f); if (randu < fresnel) { *omega_in = R; #ifdef __RAY_DIFFERENTIALS__ *domega_in_dx = dRdx; *domega_in_dy = dRdy; #endif return LABEL_REFLECT | LABEL_SINGULAR; } else { *omega_in = T; #ifdef __RAY_DIFFERENTIALS__ *domega_in_dx = dTdx; *domega_in_dy = dTdy; #endif return LABEL_TRANSMIT | LABEL_SINGULAR; } } bool use_fresnel = (bsdf->type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID); make_orthonormals(Z, &X, &Y); float3 localI = make_float3(dot(I, X), dot(I, Y), dot(I, Z)); float3 localO; *eval = mf_sample_glass(localI, &localO, bsdf->extra->color, bsdf->alpha_x, bsdf->alpha_y, lcg_state, bsdf->ior, use_fresnel, bsdf->extra->cspec0); *pdf = mf_glass_pdf(localI, localO, bsdf->alpha_x, bsdf->ior); *eval *= *pdf; *omega_in = X * localO.x + Y * localO.y + Z * localO.z; if (localO.z * localI.z > 0.0f) { #ifdef __RAY_DIFFERENTIALS__ *domega_in_dx = (2 * dot(Z, dIdx)) * Z - dIdx; *domega_in_dy = (2 * dot(Z, dIdy)) * Z - dIdy; #endif return LABEL_REFLECT | LABEL_GLOSSY; } else { #ifdef __RAY_DIFFERENTIALS__ float cosI = dot(Z, I); float dnp = max(sqrtf(1.0f - (bsdf->ior * bsdf->ior * (1.0f - cosI * cosI))), 1e-7f); *domega_in_dx = -(bsdf->ior * dIdx) + ((bsdf->ior - bsdf->ior * bsdf->ior * cosI / dnp) * dot(dIdx, Z)) * Z; *domega_in_dy = -(bsdf->ior * dIdy) + ((bsdf->ior - bsdf->ior * bsdf->ior * cosI / dnp) * dot(dIdy, Z)) * Z; #endif return LABEL_TRANSMIT | LABEL_GLOSSY; } } CCL_NAMESPACE_END
{ "pile_set_name": "Github" }
/* * Copyright (C) 2002-2015 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "SDL/SDL_version.h" // On all platforms, if SDL 2.0 is used then we don't support physical CD-ROMs. #if !SDL_VERSION_ATLEAST(2,0,0) #if defined (WIN32) // ***************************************************************** // Windows IOCTL functions (not suitable for 95/98/Me) // ***************************************************************** #include <windows.h> #include <io.h> #if (defined (_MSC_VER)) || (defined __MINGW64_VERSION_MAJOR) #include <ntddcdrm.h> // Ioctl stuff #include <winioctl.h> // Ioctl stuff #else #include "ddk/ntddcdrm.h" // Ioctl stuff #endif #include <mmsystem.h> #include "cdrom.h" // for a more sophisticated implementation of the mci cdda functionality // see the SDL sources, which the mci_ functions are based on /* General ioctl() CD-ROM command function */ bool CDROM_Interface_Ioctl::mci_CDioctl(UINT msg, DWORD flags, void *arg) { MCIERROR mci_error = mciSendCommand(mci_devid, msg, flags, (DWORD_PTR)arg); if (mci_error!=MMSYSERR_NOERROR) { char error[256]; mciGetErrorString(mci_error, error, 256); LOG_MSG("mciSendCommand() error: %s", error); return true; } return false; } bool CDROM_Interface_Ioctl::mci_CDOpen(char drive) { MCI_OPEN_PARMS mci_open; MCI_SET_PARMS mci_set; char device[3]; DWORD flags; /* Open the requested device */ mci_open.lpstrDeviceType = (LPCSTR) MCI_DEVTYPE_CD_AUDIO; device[0] = drive; device[1] = ':'; device[2] = '\0'; mci_open.lpstrElementName = device; flags = (MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID|MCI_OPEN_SHAREABLE|MCI_OPEN_ELEMENT); if (mci_CDioctl(MCI_OPEN, flags, &mci_open)) { flags &= ~MCI_OPEN_SHAREABLE; if (mci_CDioctl(MCI_OPEN, flags, &mci_open)) { return true; } } mci_devid = mci_open.wDeviceID; /* Set the minute-second-frame time format */ mci_set.dwTimeFormat = MCI_FORMAT_MSF; mci_CDioctl(MCI_SET, MCI_SET_TIME_FORMAT, &mci_set); return false; } bool CDROM_Interface_Ioctl::mci_CDClose(void) { return mci_CDioctl(MCI_CLOSE, MCI_WAIT, NULL); } bool CDROM_Interface_Ioctl::mci_CDPlay(int start, int length) { DWORD flags = MCI_FROM | MCI_TO | MCI_NOTIFY; MCI_PLAY_PARMS mci_play; mci_play.dwCallback = 0; int m, s, f; FRAMES_TO_MSF(start, &m, &s, &f); mci_play.dwFrom = MCI_MAKE_MSF(m, s, f); FRAMES_TO_MSF(start+length, &m, &s, &f); mci_play.dwTo = MCI_MAKE_MSF(m, s, f); return mci_CDioctl(MCI_PLAY, flags, &mci_play); } bool CDROM_Interface_Ioctl::mci_CDPause(void) { return mci_CDioctl(MCI_PAUSE, MCI_WAIT, NULL); } bool CDROM_Interface_Ioctl::mci_CDResume(void) { return mci_CDioctl(MCI_RESUME, MCI_WAIT, NULL); } bool CDROM_Interface_Ioctl::mci_CDStop(void) { return mci_CDioctl(MCI_STOP, MCI_WAIT, NULL); } int CDROM_Interface_Ioctl::mci_CDStatus(void) { int status; MCI_STATUS_PARMS mci_status; DWORD flags = MCI_STATUS_ITEM | MCI_WAIT; mci_status.dwItem = MCI_STATUS_MODE; if (mci_CDioctl(MCI_STATUS, flags, &mci_status)) { status = -1; } else { switch (mci_status.dwReturn) { case MCI_MODE_NOT_READY: case MCI_MODE_OPEN: status = 0; break; case MCI_MODE_STOP: status = 1; break; case MCI_MODE_PLAY: status = 2; break; case MCI_MODE_PAUSE: status = 3; break; default: status = -1; break; } } return status; } bool CDROM_Interface_Ioctl::mci_CDPosition(int *position) { *position = 0; DWORD flags = MCI_STATUS_ITEM | MCI_WAIT; MCI_STATUS_PARMS mci_status; mci_status.dwItem = MCI_STATUS_MODE; if (mci_CDioctl(MCI_STATUS, flags, &mci_status)) return true; switch (mci_status.dwReturn) { case MCI_MODE_NOT_READY: case MCI_MODE_OPEN: case MCI_MODE_STOP: return true; // not ready/undefined status case MCI_MODE_PLAY: case MCI_MODE_PAUSE: mci_status.dwItem = MCI_STATUS_POSITION; if (!mci_CDioctl(MCI_STATUS, flags, &mci_status)) { *position = MSF_TO_FRAMES( MCI_MSF_MINUTE(mci_status.dwReturn), MCI_MSF_SECOND(mci_status.dwReturn), MCI_MSF_FRAME(mci_status.dwReturn)); } return false; // no error, position read default: break; } return false; } CDROM_Interface_Ioctl::dxPlayer CDROM_Interface_Ioctl::player = { NULL, NULL, NULL, {0}, 0, 0, 0, false, false, false, {0} }; CDROM_Interface_Ioctl::CDROM_Interface_Ioctl(cdioctl_cdatype ioctl_cda) { pathname[0] = 0; hIOCTL = INVALID_HANDLE_VALUE; memset(&oldLeadOut,0,sizeof(oldLeadOut)); cdioctl_cda_selected = ioctl_cda; } CDROM_Interface_Ioctl::~CDROM_Interface_Ioctl() { StopAudio(); if (use_mciplay) mci_CDStop(); Close(); if (use_mciplay) mci_CDClose(); } bool CDROM_Interface_Ioctl::GetUPC(unsigned char& attr, char* upc) { // FIXME : To Do return true; } bool CDROM_Interface_Ioctl::GetAudioTracks(int& stTrack, int& endTrack, TMSF& leadOut) { CDROM_TOC toc; DWORD byteCount; BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_TOC, NULL, 0, &toc, sizeof(toc), &byteCount,NULL); if (!bStat) return false; stTrack = toc.FirstTrack; endTrack = toc.LastTrack; leadOut.min = toc.TrackData[endTrack].Address[1]; leadOut.sec = toc.TrackData[endTrack].Address[2]; leadOut.fr = toc.TrackData[endTrack].Address[3]; if ((use_mciplay || use_dxplay) && (!track_start_valid)) { Bits track_num = 0; // get track start address of all tracks for (Bits i=toc.FirstTrack; i<=toc.LastTrack+1; i++) { if (((toc.TrackData[i].Control&1)==0) || (i==toc.LastTrack+1)) { track_start[track_num] = MSF_TO_FRAMES(toc.TrackData[track_num].Address[1],toc.TrackData[track_num].Address[2],toc.TrackData[track_num].Address[3])-150; track_start[track_num] += 150; track_num++; } } track_start_first = 0; track_start_last = track_num-1; track_start_valid = true; } return true; } bool CDROM_Interface_Ioctl::GetAudioTrackInfo(int track, TMSF& start, unsigned char& attr) { CDROM_TOC toc; DWORD byteCount; BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_TOC, NULL, 0, &toc, sizeof(toc), &byteCount,NULL); if (!bStat) return false; attr = (toc.TrackData[track-1].Control << 4) & 0xEF; start.min = toc.TrackData[track-1].Address[1]; start.sec = toc.TrackData[track-1].Address[2]; start.fr = toc.TrackData[track-1].Address[3]; return true; } bool CDROM_Interface_Ioctl::GetAudioTracksAll(void) { if (track_start_valid) return true; CDROM_TOC toc; DWORD byteCount; BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_TOC, NULL, 0, &toc, sizeof(toc), &byteCount,NULL); if (!bStat) return false; Bits track_num = 0; // get track start address of all tracks for (Bits i=toc.FirstTrack; i<=toc.LastTrack+1; i++) { if (((toc.TrackData[i].Control&1)==0) || (i==toc.LastTrack+1)) { track_start[track_num] = MSF_TO_FRAMES(toc.TrackData[track_num].Address[1],toc.TrackData[track_num].Address[2],toc.TrackData[track_num].Address[3])-150; track_start[track_num] += 150; track_num++; } } track_start_first = 0; track_start_last = track_num-1; track_start_valid = true; return true; } bool CDROM_Interface_Ioctl::GetAudioSub(unsigned char& attr, unsigned char& track, unsigned char& index, TMSF& relPos, TMSF& absPos) { if (use_dxplay) { track = 1; FRAMES_TO_MSF(player.currFrame + 150, &absPos.min, &absPos.sec, &absPos.fr); FRAMES_TO_MSF(player.currFrame + 150, &relPos.min, &relPos.sec, &relPos.fr); if (GetAudioTracksAll()) { // get track number from current frame for (int i=track_start_first; i<=track_start_last; i++) { if ((player.currFrame + 150<track_start[i+1]) && (player.currFrame + 150>=track_start[i])) { // track found, calculate relative position track = i; FRAMES_TO_MSF(player.currFrame + 150-track_start[i],&relPos.min,&relPos.sec,&relPos.fr); break; } } } return true; } CDROM_SUB_Q_DATA_FORMAT insub; SUB_Q_CHANNEL_DATA sub; DWORD byteCount; insub.Format = IOCTL_CDROM_CURRENT_POSITION; BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_Q_CHANNEL, &insub, sizeof(insub), &sub, sizeof(sub), &byteCount,NULL); if (!bStat) return false; attr = (sub.CurrentPosition.Control << 4) & 0xEF; track = sub.CurrentPosition.TrackNumber; index = sub.CurrentPosition.IndexNumber; relPos.min = sub.CurrentPosition.TrackRelativeAddress[1]; relPos.sec = sub.CurrentPosition.TrackRelativeAddress[2]; relPos.fr = sub.CurrentPosition.TrackRelativeAddress[3]; absPos.min = sub.CurrentPosition.AbsoluteAddress[1]; absPos.sec = sub.CurrentPosition.AbsoluteAddress[2]; absPos.fr = sub.CurrentPosition.AbsoluteAddress[3]; if (use_mciplay) { int cur_pos; if (!mci_CDPosition(&cur_pos)) { // absolute position read, try to calculate the track-relative position if (GetAudioTracksAll()) { for (int i=track_start_first; i<=track_start_last; i++) { if ((cur_pos<track_start[i+1]) && (cur_pos>=track_start[i])) { // track found, calculate relative position FRAMES_TO_MSF(cur_pos-track_start[i],&relPos.min,&relPos.sec,&relPos.fr); break; } } } FRAMES_TO_MSF(cur_pos,&absPos.min,&absPos.sec,&absPos.fr); } } return true; } bool CDROM_Interface_Ioctl::GetAudioStatus(bool& playing, bool& pause) { if (use_mciplay) { int status = mci_CDStatus(); if (status<0) return false; playing = (status==2); pause = (status==3); return true; } if (use_dxplay) { playing = player.isPlaying; pause = player.isPaused; return true; } CDROM_SUB_Q_DATA_FORMAT insub; SUB_Q_CHANNEL_DATA sub; DWORD byteCount; insub.Format = IOCTL_CDROM_CURRENT_POSITION; BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_Q_CHANNEL, &insub, sizeof(insub), &sub, sizeof(sub), &byteCount,NULL); if (!bStat) return false; playing = (sub.CurrentPosition.Header.AudioStatus == AUDIO_STATUS_IN_PROGRESS); pause = (sub.CurrentPosition.Header.AudioStatus == AUDIO_STATUS_PAUSED); return true; } bool CDROM_Interface_Ioctl::GetMediaTrayStatus(bool& mediaPresent, bool& mediaChanged, bool& trayOpen) { // Seems not possible to get this values using ioctl... int track1,track2; TMSF leadOut; // If we can read, there's a media mediaPresent = GetAudioTracks(track1, track2, leadOut), trayOpen = !mediaPresent; mediaChanged = (oldLeadOut.min!=leadOut.min) || (oldLeadOut.sec!=leadOut.sec) || (oldLeadOut.fr!=leadOut.fr); if (mediaChanged) { Close(); if (use_mciplay) mci_CDClose(); // Open new medium Open(); if (cdioctl_cda_selected == CDIOCTL_CDA_MCI) { // check this (what to do if cd is ejected): use_mciplay = false; if (!mci_CDOpen(pathname[4])) use_mciplay = true; } track_start_valid = false; } // Save old values oldLeadOut.min = leadOut.min; oldLeadOut.sec = leadOut.sec; oldLeadOut.fr = leadOut.fr; // always success return true; } bool CDROM_Interface_Ioctl::PlayAudioSector (unsigned long start,unsigned long len) { if (use_mciplay) { if (!mci_CDPlay(start+150, len)) return true; if (!mci_CDPlay(start+150, len-1)) return true; return false; } if (use_dxplay) { SDL_mutexP(player.mutex); player.cd = this; player.currFrame = start; player.targetFrame = start + len; player.isPlaying = true; player.isPaused = false; SDL_mutexV(player.mutex); return true; } CDROM_PLAY_AUDIO_MSF audio; DWORD byteCount; // Start unsigned long addr = start + 150; audio.StartingF = (UCHAR)(addr%75); addr/=75; audio.StartingS = (UCHAR)(addr%60); audio.StartingM = (UCHAR)(addr/60); // End addr = start + len + 150; audio.EndingF = (UCHAR)(addr%75); addr/=75; audio.EndingS = (UCHAR)(addr%60); audio.EndingM = (UCHAR)(addr/60); BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_PLAY_AUDIO_MSF, &audio, sizeof(audio), NULL, 0, &byteCount,NULL); return bStat>0; } bool CDROM_Interface_Ioctl::PauseAudio(bool resume) { if (use_mciplay) { if (resume) { if (!mci_CDResume()) return true; } else { if (!mci_CDPause()) return true; } return false; } if (use_dxplay) { player.isPaused = !resume; return true; } BOOL bStat; DWORD byteCount; if (resume) bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_RESUME_AUDIO, NULL, 0, NULL, 0, &byteCount,NULL); else bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_PAUSE_AUDIO, NULL, 0, NULL, 0, &byteCount,NULL); return bStat>0; } bool CDROM_Interface_Ioctl::StopAudio(void) { if (use_mciplay) { if (!mci_CDStop()) return true; return false; } if (use_dxplay) { player.isPlaying = false; player.isPaused = false; return true; } BOOL bStat; DWORD byteCount; bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_STOP_AUDIO, NULL, 0, NULL, 0, &byteCount,NULL); return bStat>0; } void CDROM_Interface_Ioctl::ChannelControl(TCtrl ctrl) { player.ctrlUsed = (ctrl.out[0]!=0 || ctrl.out[1]!=1 || ctrl.vol[0]<0xfe || ctrl.vol[1]<0xfe); player.ctrlData = ctrl; } bool CDROM_Interface_Ioctl::LoadUnloadMedia(bool unload) { BOOL bStat; DWORD byteCount; if (unload) bStat = DeviceIoControl(hIOCTL,IOCTL_STORAGE_EJECT_MEDIA, NULL, 0, NULL, 0, &byteCount,NULL); else bStat = DeviceIoControl(hIOCTL,IOCTL_STORAGE_LOAD_MEDIA, NULL, 0, NULL, 0, &byteCount,NULL); track_start_valid = false; return bStat>0; } bool CDROM_Interface_Ioctl::ReadSector(Bit8u *buffer, bool raw, unsigned long sector) { BOOL bStat; DWORD byteCount = 0; Bitu buflen = raw ? RAW_SECTOR_SIZE : COOKED_SECTOR_SIZE; if (!raw) { // Cooked int success = 0; DWORD newPos = SetFilePointer(hIOCTL, sector*COOKED_SECTOR_SIZE, 0, FILE_BEGIN); if (newPos != 0xFFFFFFFF) success = ReadFile(hIOCTL, buffer, buflen, &byteCount, NULL); bStat = (success!=0); } else { // Raw RAW_READ_INFO in; in.DiskOffset.LowPart = sector*COOKED_SECTOR_SIZE; in.DiskOffset.HighPart = 0; in.SectorCount = 1; in.TrackMode = CDDA; bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_RAW_READ, &in, sizeof(in), buffer, buflen, &byteCount,NULL); } return (byteCount==buflen) && (bStat>0); } bool CDROM_Interface_Ioctl::ReadSectors(PhysPt buffer, bool raw, unsigned long sector, unsigned long num) { BOOL bStat; DWORD byteCount = 0; Bitu buflen = raw ? num*RAW_SECTOR_SIZE : num*COOKED_SECTOR_SIZE; Bit8u* bufdata = new Bit8u[buflen]; if (!raw) { // Cooked int success = 0; DWORD newPos = SetFilePointer(hIOCTL, sector*COOKED_SECTOR_SIZE, 0, FILE_BEGIN); if (newPos != 0xFFFFFFFF) success = ReadFile(hIOCTL, bufdata, buflen, &byteCount, NULL); bStat = (success!=0); } else { // Raw RAW_READ_INFO in; in.DiskOffset.LowPart = sector*COOKED_SECTOR_SIZE; in.DiskOffset.HighPart = 0; in.SectorCount = num; in.TrackMode = CDDA; bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_RAW_READ, &in, sizeof(in), bufdata, buflen, &byteCount,NULL); } MEM_BlockWrite(buffer,bufdata,buflen); delete[] bufdata; return (byteCount==buflen) && (bStat>0); } void CDROM_Interface_Ioctl::dx_CDAudioCallBack(Bitu len) { len *= 4; // 16 bit, stereo if (!len) return; if (!player.isPlaying || player.isPaused) { player.channel->AddSilence(); return; } SDL_mutexP(player.mutex); while (player.bufLen < (Bits)len) { bool success; if (player.targetFrame > player.currFrame) success = player.cd->ReadSector(&player.buffer[player.bufLen], true, player.currFrame); else success = false; if (success) { player.currFrame++; player.bufLen += RAW_SECTOR_SIZE; } else { memset(&player.buffer[player.bufLen], 0, len - player.bufLen); player.bufLen = len; player.isPlaying = false; } } SDL_mutexV(player.mutex); if (player.ctrlUsed) { Bit16s sample0,sample1; Bit16s * samples=(Bit16s *)&player.buffer; for (Bitu pos=0;pos<len/4;pos++) { sample0=samples[pos*2+player.ctrlData.out[0]]; sample1=samples[pos*2+player.ctrlData.out[1]]; samples[pos*2+0]=(Bit16s)(sample0*player.ctrlData.vol[0]/255.0); samples[pos*2+1]=(Bit16s)(sample1*player.ctrlData.vol[1]/255.0); } } player.channel->AddSamples_s16(len/4,(Bit16s *)player.buffer); memmove(player.buffer, &player.buffer[len], player.bufLen - len); player.bufLen -= len; } bool CDROM_Interface_Ioctl::SetDevice(char* path, int forceCD) { mci_devid = 0; use_mciplay = false; use_dxplay = false; track_start_valid = false; if (GetDriveType(path)==DRIVE_CDROM) { char letter [3] = { 0, ':', 0 }; letter[0] = path[0]; strcpy(pathname,"\\\\.\\"); strcat(pathname,letter); if (Open()) { if (cdioctl_cda_selected == CDIOCTL_CDA_MCI) { // check if MCI-interface can be used for cd audio if (!mci_CDOpen(path[0])) use_mciplay = true; } if (!use_mciplay) { if (cdioctl_cda_selected == CDIOCTL_CDA_DX) { // use direct sector access for cd audio routines player.mutex = SDL_CreateMutex(); if (!player.channel) { player.channel = MIXER_AddChannel(&dx_CDAudioCallBack, 44100, "CDAUDIO"); } player.channel->Enable(true); use_dxplay = true; } } return true; }; } return false; } bool CDROM_Interface_Ioctl::Open(void) { hIOCTL = CreateFile(pathname, // drive to open GENERIC_READ, // read access FILE_SHARE_READ | // share mode FILE_SHARE_WRITE, NULL, // default security attributes OPEN_EXISTING, // disposition 0, // file attributes NULL); // do not copy file attributes return (hIOCTL!=INVALID_HANDLE_VALUE); } void CDROM_Interface_Ioctl::Close(void) { CloseHandle(hIOCTL); } #endif #endif // SDL_VERSION_ATLEAST(2,0,0)
{ "pile_set_name": "Github" }
SHELL_DIR=$(cd "$(dirname "$0")"; pwd) GAME_PROJECT_DIR=$1 SELECTED_PLUGINS=(${2//:/ }) # if project path is end with '/', delete it END_CHAR=${GAME_PROJECT_DIR:$((${#GAME_PROJECT_DIR}-1)):1} if [ ${END_CHAR} = "/" ]; then GAME_PROJECT_DIR=${GAME_PROJECT_DIR%/} fi # check the game project path if [ -d "${GAME_PROJECT_DIR}" -a -f "${GAME_PROJECT_DIR}/AndroidManifest.xml" ]; then echo "Game project path : ${GAME_PROJECT_DIR}" echo "selected plugins : ${SELECTED_PLUGINS[@]}" else echo "Game project path is wrong.(Not an android project directory)" exit 1 fi getPathForSystem() { START_WITH_CYGWIN=`echo $1 | grep '^/cygdrive/'` if [ -z "${START_WITH_CYGWIN}" ]; then echo "$1" else RET=${START_WITH_CYGWIN#/cygdrive/} RET=${RET/\//:/} echo "${RET}" fi } pushd ${SHELL_DIR}/../ source ./config.sh # check publish directory if [ -d "${TARGET_ROOT}" ]; then # add protocols name to build export NEED_PUBLISH="protocols":$2 # Modify mk file MK_FILE_PATH="${GAME_PROJECT_DIR}"/jni/Android.mk ${SHELL_DIR}/modifyMk.sh "${MK_FILE_PATH}" # Modify Application.mk file (add stl & rtti configuration) APP_MK_FILE_PATH="${GAME_PROJECT_DIR}"/jni/Application.mk ${SHELL_DIR}/modifyAppMk.sh "${APP_MK_FILE_PATH}" # Combin ForRes directory to the res directory of game project GAME_RES_DIR="${GAME_PROJECT_DIR}"/res ${SHELL_DIR}/modifyRes.sh "${GAME_RES_DIR}" # get system dir SYS_TARGET_ROOT=$(getPathForSystem ${TARGET_ROOT}) SYS_SHELL_DIR=$(getPathForSystem ${SHELL_DIR}) SYS_PROJ_DIR=$(getPathForSystem ${GAME_PROJECT_DIR}) # Modify .project file (link publish directory to the game project) PROJECT_FILE_PATH="${SYS_PROJ_DIR}"/.project python ${SYS_SHELL_DIR}/modifyProject.py "${PROJECT_FILE_PATH}" "${SYS_TARGET_ROOT}" # Modify .classpath file (link jar files for game project) CLASSPATH_FILE="${SYS_PROJ_DIR}"/.classpath python ${SYS_SHELL_DIR}/modifyClassPath.py "${CLASSPATH_FILE}" "${NEED_PUBLISH}" "${SYS_TARGET_ROOT}" # Modify AndroidManifest.xml file (add permission & add activity info) MANIFEST_FILE="${SYS_PROJ_DIR}"/AndroidManifest.xml python ${SYS_SHELL_DIR}/modifyManifest.py "${MANIFEST_FILE}" "$2" "${SYS_TARGET_ROOT}" else echo "PLZ run the publish.sh script first" popd exit 1 fi popd exit 0
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0 /* * ucall support. A ucall is a "hypercall to userspace". * * Copyright (C) 2018, Red Hat, Inc. */ #include "kvm_util.h" #define UCALL_PIO_PORT ((uint16_t)0x1000) void ucall_init(struct kvm_vm *vm, void *arg) { } void ucall_uninit(struct kvm_vm *vm) { } void ucall(uint64_t cmd, int nargs, ...) { struct ucall uc = { .cmd = cmd, }; va_list va; int i; nargs = nargs <= UCALL_MAX_ARGS ? nargs : UCALL_MAX_ARGS; va_start(va, nargs); for (i = 0; i < nargs; ++i) uc.args[i] = va_arg(va, uint64_t); va_end(va); asm volatile("in %[port], %%al" : : [port] "d" (UCALL_PIO_PORT), "D" (&uc) : "rax", "memory"); } uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc) { struct kvm_run *run = vcpu_state(vm, vcpu_id); struct ucall ucall = {}; if (run->exit_reason == KVM_EXIT_IO && run->io.port == UCALL_PIO_PORT) { struct kvm_regs regs; vcpu_regs_get(vm, vcpu_id, &regs); memcpy(&ucall, addr_gva2hva(vm, (vm_vaddr_t)regs.rdi), sizeof(ucall)); vcpu_run_complete_io(vm, vcpu_id); if (uc) memcpy(uc, &ucall, sizeof(ucall)); } return ucall.cmd; }
{ "pile_set_name": "Github" }
<html> <head> <title>Functional</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="theme/style.css" type="text/css"> </head> <body> <table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2"> <tr> <td width="10"> </td> <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Functional</b></font> </td> <td width="112"><a href="http://spirit.sf.net"><img src="theme/spirit.gif" width="112" height="48" align="right" border="0"></a></td> </tr> </table> <br> <table border="0"> <tr> <td width="10"></td> <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="parametric_parsers.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="phoenix.html"><img src="theme/r_arr.gif" border="0"></a></td> </tr> </table> <p>If you look more closely, you'll notice that Spirit is all about composition of <i>parser functions</i>. A parser is just a function that accepts a scanner and returns a match. Parser <i>functions</i> are composed to form increasingly complex <i>higher order forms</i>. Notice too that the parser, albeit an object, is immutable and constant. All primitive and composite parser objects are <tt>const</tt>. The parse member function is even declared as <tt>const</tt>:</p> <pre> <code><span class=keyword>template </span><span class=special>&lt;</span><span class=keyword>typename </span><span class=identifier>ScannerT</span><span class=special>&gt; </span><span class=keyword>typename </span><span class=identifier>parser_result</span><span class=special>&lt;</span><span class=identifier>self_t</span><span class=special>, </span><span class=identifier>ScannerT</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=identifier>parse</span><span class=special>(</span><span class=identifier>ScannerT </span><span class=keyword>const</span><span class=special>&amp; </span><span class=identifier>scan</span><span class=special>) </span><span class=keyword>const</span><span class=special>;</span></code></pre> <p> In all accounts, this looks and feels a lot like <b>Functional Programming</b>. And indeed it is. Spirit is by all means an application of Functional programming in the imperative C++ domain. In Haskell, for example, there is what are called <a href="references.html#combinators">parser combinators</a> which are strikingly similar to the approach taken by Spirit- parser functions which are composed using various operators to create higher order parser functions that model a top-down recursive descent parser. Those smart Haskell folks have been doing this way before Spirit.</p> <p> Functional style programming (or FP) libraries are gaining momentum in the C++ community. Certainly, we'll see more of FP in Spirit now and in the future. Actually, if one looks more closely, even the C++ standard library has an FP flavor. Stealthily beneath the core of the standard C++ library, a closer look into STL gives us a glimpse of a truly FP paradigm already in place. It is obvious that the authors of STL know and practice FP.</p> <h2>Semantic Actions in the FP Perspective</h2> <h3>STL style FP</h3> <p> A more obvious application of STL-style FP in Spirit is the semantic action. What is STL-style FP? It is primarily the use of functors that can be composed to form higher order functors.</p> <table width="80%" border="0" align="center"> <tr> <td class="note_box"> <img src="theme/note.gif" width="16" height="16"> <strong>Functors</strong><br> <br> A Function Object, or Functor is simply any object that can be called as if it is a function. An ordinary function is a function object, and so is a function pointer; more generally, so is an object of a class that defines operator(). </td> </tr> </table> <p> This STL-style FP can be seen everywhere these days. The following example is taken from <a href="http://www.sgi.com/tech/stl/">SGI's Standard Template Library Programmer's Guide</a>:</p> <pre> <code><span class=comment>// Computes sin(x)/(x + DBL_MIN) for each element of a range. </span><span class=identifier>transform</span><span class=special>(</span><span class=identifier>first</span><span class=special>, </span><span class=identifier>last</span><span class=special>, </span><span class=identifier>first</span><span class=special>, </span><span class=identifier>compose2</span><span class=special>(</span><span class=identifier>divides</span><span class=special>&lt;</span><span class=keyword>double</span><span class=special>&gt;(), </span><span class=identifier>ptr_fun</span><span class=special>(</span><span class=identifier>sin</span><span class=special>), </span><span class=identifier>bind2nd</span><span class=special>(</span><span class=identifier>plus</span><span class=special>&lt;</span><span class=keyword>double</span><span class=special>&gt;(), </span><span class=identifier>DBL_MIN</span><span class=special>)));</span></code></pre> <p align="left"> Really, this is just <i>currying</i> in FP terminology.</p> <table width="80%" border="0" align="center"> <tr> <td class="note_box"> <img src="theme/lens.gif" width="15" height="16"> <strong>Currying</strong><br> <br> What is &quot;currying&quot;, and where does it come from?<br> <br> Currying has its origins in the mathematical study of functions. It was observed by Frege in 1893 that it suffices to restrict attention to functions of a single argument. For example, for any two parameter function <tt>f(x,y)</tt>, there is a one parameter function <tt>f'</tt> such that <tt>f'(x)</tt> is a function that can be applied to y to give <tt>(f'(x))(y) = f (x,y)</tt>. This corresponds to the well known fact that the sets <tt>(AxB -&gt; C)</tt> and <tt>(A -&gt; (B -&gt; C))</tt> are isomorphic, where <tt>&quot;x&quot;</tt> is cartesian product and <tt>&quot;-&gt;&quot;</tt> is function space. In functional programming, function application is denoted by juxtaposition, and assumed to associate to the left, so that the equation above becomes <tt>f' x y = f(x,y)</tt>. </td> </tr> </table> <p> In the context of Spirit, the same FP style functor composition may be applied to semantic actions. <a href="../example/fundamental/full_calc.cpp">full_calc.cpp</a> is a good example. Here's a snippet from that sample:</p> <pre> <code><span class=identifier>expression </span><span class=special>= </span><span class=identifier>term </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=special>(</span><span class=literal>'+' </span><span class=special>&gt;&gt; </span><span class=identifier>term</span><span class=special>)[</span><span class=identifier>make_op</span><span class=special>(</span><span class=identifier>plus</span><span class=special>&lt;</span><span class=keyword>long</span><span class=special>&gt;(), </span><span class=identifier>self</span><span class=special>.</span><span class=identifier>eval</span><span class=special>)] </span><span class=special>| </span><span class=special>(</span><span class=literal>'-' </span><span class=special>&gt;&gt; </span><span class=identifier>term</span><span class=special>)[</span><span class=identifier>make_op</span><span class=special>(</span><span class=identifier>minus</span><span class=special>&lt;</span><span class=keyword>long</span><span class=special>&gt;(), </span><span class=identifier>self</span><span class=special>.</span><span class=identifier>eval</span><span class=special>)] </span><span class=special>) </span><span class=special>;</span></code></pre> <p> <img height="16" width="15" src="theme/lens.gif"> The full source code can be <a href="../example/fundamental/full_calc.cpp">viewed here</a>. This is part of the Spirit distribution.</p> <h3>Boost style FP</h3> <p> Boost takes the FP paradigm further. There are libraries in boost that focus specifically on Function objects and higher-order programming.</p> <table width="90%" border="0" align="center"> <tr> <td class="table_title" colspan="14"> Boost FP libraries </td> </tr> <tr> <td class="table_cells"><a href="http://www.boost.org/libs/bind/bind.html">bind</a> and <a href="http://www.boost.org/libs/bind/mem_fn.html">mem_fn</a></td> <td class="table_cells">Generalized binders for function/object/pointers and member functions, from Peter Dimov</td> </tr> <td class="table_cells"><a href="http://www.boost.org/libs/function/index.html">function</a></td> <td class="table_cells">Function object wrappers for deferred calls or callbacks, from Doug Gregor</td> </tr> <td class="table_cells"><a href="http://www.boost.org/libs/functional/index.html">functional</a></td> <td class="table_cells">Enhanced function object adaptors, from Mark Rodgers</td> </tr> <td class="table_cells"><a href="http://www.boost.org/libs/lambda/index.html">lambda</a></td> <td class="table_cells">Define small unnamed function objects at the actual call site, and more, from Jaakko Järvi and Gary Powell</td> </tr> <td class="table_cells"><a href="http://www.boost.org/libs/bind/ref.html">ref</a></td> <td class="table_cells">A utility library for passing references to generic functions, from Jaako Järvi, Peter Dimov, Doug Gregor, and Dave Abrahams</td> </tr> </table> <p> The following is an example that uses boost <strong>Bind</strong> to use a member function as a Spirit semantic action. You can see this example in full in the file<a href="../example/fundamental/bind.cpp"> bind.cpp</a>.</p> <pre> <code><span class=keyword>class </span><span class=identifier>list_parser </span><span class=special>{ </span><span class=keyword>public</span><span class=special>: </span><span class=keyword>typedef </span><span class=identifier>list_parser </span><span class=identifier>self_t</span><span class=special>; </span><span class=keyword>bool </span><span class=identifier>parse</span><span class=special>(</span><span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>str</span><span class=special>) </span><span class=special>{ </span><span class=keyword>return </span><span class=identifier>spirit</span><span class=special>::</span><span class=identifier>parse</span><span class=special>(</span><span class=identifier>str</span><span class=special>, </span><span class=comment>// Begin grammar </span><span class=special>( </span><span class=identifier>real_p </span><span class=special>[ </span><span class=identifier>bind</span><span class=special>(&amp;</span><span class=identifier>self_t</span><span class=special>::</span><span class=identifier>add</span><span class=special>, </span><span class=keyword>this</span><span class=special>, </span><span class=identifier>_1</span><span class=special>) </span><span class=special>] </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=literal>',' </span><span class=special>&gt;&gt; </span><span class=identifier>real_p </span><span class=special>[ </span><span class=identifier>bind</span><span class=special>(&amp;</span><span class=identifier>self_t</span><span class=special>::</span><span class=identifier>add</span><span class=special>, </span><span class=keyword>this</span><span class=special>, </span><span class=identifier>_1</span><span class=special>) </span><span class=special>] </span><span class=special>) </span><span class=special>) </span><span class=special>, </span><span class=comment>// End grammar </span><span class=identifier>space_p</span><span class=special>).</span><span class=identifier>full</span><span class=special>; </span><span class=special>} </span><span class=keyword>void </span><span class=identifier>add</span><span class=special>(</span><span class=keyword>double </span><span class=identifier>n</span><span class=special>) </span><span class=special>{ </span><span class=identifier>v</span><span class=special>.</span><span class=identifier>push_back</span><span class=special>(</span><span class=identifier>n</span><span class=special>); </span><span class=special>} </span><span class=identifier>vector</span><span class=special>&lt;</span><span class=keyword>double</span><span class=special>&gt; </span><span class=identifier>v</span><span class=special>; </span><span class=special>}; </span></code></pre> <p> <img height="16" width="15" src="theme/lens.gif"> The full source code can be <a href="../example/fundamental/bind.cpp">viewed here</a>. This is part of the Spirit distribution.</p> <p>This parser parses a comma separated list of real numbers and stores them in a vector&lt;double&gt;. Boost.bind creates a Spirit conforming semantic action from the <tt>list_parser</tt>'s member function <tt>add</tt>.</p> <h3>Lambda and Phoenix</h3> <p> There's a library, authored by yours truly, named <a href="../phoenix/index.html">Phoenix</a>. While this is not officially part of the Spirit distribution, this library has been used extensively to experiment on advanced FP techniques in C++. This library is highly influenced by <a href="http://www.cc.gatech.edu/%7Eyannis/fc%2B%2B/">FC++</a> and boost Lambda (<a href="http://www.boost.org/libs/lambda/index.html">BLL</a>).</p> <table width="80%" border="0" align="center"> <tr> <td class="note_box"> <b><img src="theme/lens.gif" width="15" height="16"> BLL</b><br> <br> In as much as Phoenix is influenced by boost Lambda (<a href="http://www.boost.org/libs/lambda/index.html">BLL</a>), Phoenix innovations such as local variables, local functions and adaptable closures, in turn influenced BLL. Currently, BLL is very similar to Phoenix. Most importantly, BLL incorporated Phoenix's adaptable closures. In the future, Spirit will fully support BLL. </td> </tr> </table> <p> Phoenix allows one to write semantic actions inline in C++ through lambda (an unnamed function) expressions. Here's a snippet from the <a href="../example/fundamental/phoenix_calc.cpp">phoenix_calc.cpp</a> example:</p> <pre> <code><span class=identifier>expression </span><span class=special>= </span><span class=identifier>term</span><span class=special>[</span><span class=identifier>expression</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=special>(</span><span class=literal>'+' </span><span class=special>&gt;&gt; </span><span class=identifier>term</span><span class=special>[</span><span class=identifier>expression</span><span class=special>.</span><span class=identifier>val </span><span class=special>+= </span><span class=identifier>arg1</span><span class=special>]) </span><span class=special>| </span><span class=special>(</span><span class=literal>'-' </span><span class=special>&gt;&gt; </span><span class=identifier>term</span><span class=special>[</span><span class=identifier>expression</span><span class=special>.</span><span class=identifier>val </span><span class=special>-= </span><span class=identifier>arg1</span><span class=special>]) </span><span class=special>) </span><span class=special>; </span><span class=identifier>term </span><span class=special>= </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>term</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] </span><span class=special>&gt;&gt; </span><span class=special>*( </span><span class=special>(</span><span class=literal>'*' </span><span class=special>&gt;&gt; </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>term</span><span class=special>.</span><span class=identifier>val </span><span class=special>*= </span><span class=identifier>arg1</span><span class=special>]) </span><span class=special>| </span><span class=special>(</span><span class=literal>'/' </span><span class=special>&gt;&gt; </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>term</span><span class=special>.</span><span class=identifier>val </span><span class=special>/= </span><span class=identifier>arg1</span><span class=special>]) </span><span class=special>) </span><span class=special>; </span><span class=identifier>factor </span><span class=special>= </span><span class=identifier>ureal_p</span><span class=special>[</span><span class=identifier>factor</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] </span><span class=special>| </span><span class=literal>'(' </span><span class=special>&gt;&gt; </span><span class=identifier>expression</span><span class=special>[</span><span class=identifier>factor</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>] </span><span class=special>&gt;&gt; </span><span class=literal>')' </span><span class=special>| </span><span class=special>(</span><span class=literal>'-' </span><span class=special>&gt;&gt; </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>factor</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=special>-</span><span class=identifier>arg1</span><span class=special>]) </span><span class=special>| </span><span class=special>(</span><span class=literal>'+' </span><span class=special>&gt;&gt; </span><span class=identifier>factor</span><span class=special>[</span><span class=identifier>factor</span><span class=special>.</span><span class=identifier>val </span><span class=special>= </span><span class=identifier>arg1</span><span class=special>]) </span><span class=special>;</span></code></pre> <p> <img height="16" width="15" src="theme/lens.gif"> The full source code can be <a href="../example/fundamental/phoenix_calc.cpp">viewed here</a>. This is part of the Spirit distribution.</p> <p>You do not have to worry about the details for now. There is a lot going on here that needs to be explained. The succeeding chapters will be enlightening.</p> <p>Notice the use of lambda expressions such as:</p> <pre> <code><span class=identifier>expression</span><span class=special>.</span><span class=identifier>val </span><span class=special>+= </span><span class=identifier>arg1</span></code></pre> <table width="80%" border="0" align="center"> <tr> <td class="note_box"> <b><img src="theme/lens.gif" width="15" height="16"> <a name="lambda"></a>Lambda Expressions?</b><br> <br> Lambda expressions are actually unnamed partially applied functions where placeholders (e.g. arg1, arg2) are provided in place of some of the arguments. The reason this is called a lambda expression is that traditionally, such placeholders are written using the Greek letter lambda <img src="theme/lambda.png" width="15" height="22">.</td> </tr> </table> <p>where <tt>expression.val</tt> is a closure variable of the expression rule (see <a href="closures.html">Closures</a>). <code><span class=identifier><tt>arg1</tt></span></code> is a placeholder for the first argument that the semantic action will receive (see <a href="../phoenix/doc/place_holders.html">Phoenix Place-holders</a>). In Boost.Lambda (BLL), this corresponds to <tt>_1</tt>. </p> <table border="0"> <tr> <td width="10"></td> <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="parametric_parsers.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="30"><a href="phoenix.html"><img src="theme/r_arr.gif" border="0"></a></td> </tr> </table> <br> <hr size="1"> <p class="copyright">Copyright &copy; 1998-2003 Joel de Guzman<br> <br> <font size="2">Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)</font></p> <p class="copyright">&nbsp;</p> </body> </html>
{ "pile_set_name": "Github" }
define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var DocCommentHighlightRules = function() { this.$rules = { "start" : [ { token : "comment.doc.tag", regex : "@[\\w\\d_]+" // TODO: fix email addresses }, DocCommentHighlightRules.getTagRule(), { defaultToken : "comment.doc", caseInsensitive: true }] }; }; oop.inherits(DocCommentHighlightRules, TextHighlightRules); DocCommentHighlightRules.getTagRule = function(start) { return { token : "comment.doc.tag.storage.type", regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b" }; }; DocCommentHighlightRules.getStartRule = function(start) { return { token : "comment.doc", // doc comment regex : "\\/\\*(?=\\*)", next : start }; }; DocCommentHighlightRules.getEndRule = function (start) { return { token : "comment.doc", // closing comment regex : "\\*\\/", next : start }; }; exports.DocCommentHighlightRules = DocCommentHighlightRules; }); define("ace/mode/c_cpp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var cFunctions = exports.cFunctions = "\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\b"; var c_cppHighlightRules = function() { var keywordControls = ( "break|case|continue|default|do|else|for|goto|if|_Pragma|" + "return|switch|while|catch|operator|try|throw|using" ); var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); var storageModifiers = ( "const|extern|register|restrict|static|volatile|inline|private|" + "protected|public|friend|explicit|virtual|export|mutable|typename|" + "constexpr|new|delete|alignas|alignof|decltype|noexcept|thread_local" ); var keywordOperators = ( "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|" + "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace" ); var builtinConstants = ( "NULL|true|false|TRUE|FALSE|nullptr" ); var keywordMapper = this.$keywords = this.createKeywordMapper({ "keyword.control" : keywordControls, "storage.type" : storageType, "storage.modifier" : storageModifiers, "keyword.operator" : keywordOperators, "variable.language": "this", "constant.language": builtinConstants }, "identifier"); var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b"; var escapeRe = /\\(?:['"?\\abfnrtv]|[0-7]{1,3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}U[a-fA-F\d]{8}|.)/.source; var formatRe = "%" + /(\d+\$)?/.source // field (argument #) + /[#0\- +']*/.source // flags + /[,;:_]?/.source // separator character (AltiVec) + /((-?\d+)|\*(-?\d+\$)?)?/.source // minimum field width + /(\.((-?\d+)|\*(-?\d+\$)?)?)?/.source // precision + /(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)?/.source // length modifier + /(\[[^"\]]+\]|[diouxXDOUeEfFgGaACcSspn%])/.source; // conversion type this.$rules = { "start" : [ { token : "comment", regex : "//$", next : "start" }, { token : "comment", regex : "//", next : "singleLineComment" }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // multi line comment regex : "\\/\\*", next : "comment" }, { token : "string", // character regex : "'(?:" + escapeRe + "|.)?'" }, { token : "string.start", regex : '"', stateName: "qqstring", next: [ { token: "string", regex: /\\\s*$/, next: "qqstring" }, { token: "constant.language.escape", regex: escapeRe }, { token: "constant.language.escape", regex: formatRe }, { token: "string.end", regex: '"|$', next: "start" }, { defaultToken: "string"} ] }, { token : "string.start", regex : 'R"\\(', stateName: "rawString", next: [ { token: "string.end", regex: '\\)"', next: "start" }, { defaultToken: "string"} ] }, { token : "constant.numeric", // hex regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" }, { token : "keyword", // pre-compiler directives regex : "#\\s*(?:include|import|pragma|line|define|undef)\\b", next : "directive" }, { token : "keyword", // special case pre-compiler directive regex : "#\\s*(?:endif|if|ifdef|else|elif|ifndef)\\b" }, { token : "support.function.C99.c", regex : cFunctions }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*" }, { token : "keyword.operator", regex : /--|\+\+|<<=|>>=|>>>=|<>|&&|\|\||\?:|[*%\/+\-&\^|~!<>=]=?/ }, { token : "punctuation.operator", regex : "\\?|\\:|\\,|\\;|\\." }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "singleLineComment" : [ { token : "comment", regex : /\\$/, next : "singleLineComment" }, { token : "comment", regex : /$/, next : "start" }, { defaultToken: "comment" } ], "directive" : [ { token : "constant.other.multiline", regex : /\\/ }, { token : "constant.other.multiline", regex : /.*\\/ }, { token : "constant.other", regex : "\\s*<.+?>", next : "start" }, { token : "constant.other", // single line regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]', next : "start" }, { token : "constant.other", // single line regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']", next : "start" }, { token : "constant.other", regex : /[^\\\/]+/, next : "start" } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); this.normalizeRules(); }; oop.inherits(c_cppHighlightRules, TextHighlightRules); exports.c_cppHighlightRules = c_cppHighlightRules; }); define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { "use strict"; var Range = require("../range").Range; var MatchingBraceOutdent = function() {}; (function() { this.checkOutdent = function(line, input) { if (! /^\s+$/.test(line)) return false; return /^\s*\}/.test(input); }; this.autoOutdent = function(doc, row) { var line = doc.getLine(row); var match = line.match(/^(\s*\})/); if (!match) return 0; var column = match[1].length; var openBracePos = doc.findMatchingBracket({row: row, column: column}); if (!openBracePos || openBracePos.row == row) return 0; var indent = this.$getIndent(doc.getLine(openBracePos.row)); doc.replace(new Range(row, 0, row, column-1), indent); }; this.$getIndent = function(line) { return line.match(/^\s*/)[0]; }; }).call(MatchingBraceOutdent.prototype); exports.MatchingBraceOutdent = MatchingBraceOutdent; }); define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var Range = require("../../range").Range; var BaseFoldMode = require("./fold_mode").FoldMode; var FoldMode = exports.FoldMode = function(commentRegex) { if (commentRegex) { this.foldingStartMarker = new RegExp( this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) ); this.foldingStopMarker = new RegExp( this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) ); } }; oop.inherits(FoldMode, BaseFoldMode); (function() { this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; this._getFoldWidgetBase = this.getFoldWidget; this.getFoldWidget = function(session, foldStyle, row) { var line = session.getLine(row); if (this.singleLineBlockCommentRe.test(line)) { if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) return ""; } var fw = this._getFoldWidgetBase(session, foldStyle, row); if (!fw && this.startRegionRe.test(line)) return "start"; // lineCommentRegionStart return fw; }; this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { var line = session.getLine(row); if (this.startRegionRe.test(line)) return this.getCommentRegionBlock(session, line, row); var match = line.match(this.foldingStartMarker); if (match) { var i = match.index; if (match[1]) return this.openingBracketBlock(session, match[1], row, i); var range = session.getCommentFoldRange(row, i + match[0].length, 1); if (range && !range.isMultiLine()) { if (forceMultiline) { range = this.getSectionRange(session, row); } else if (foldStyle != "all") range = null; } return range; } if (foldStyle === "markbegin") return; var match = line.match(this.foldingStopMarker); if (match) { var i = match.index + match[0].length; if (match[1]) return this.closingBracketBlock(session, match[1], row, i); return session.getCommentFoldRange(row, i, -1); } }; this.getSectionRange = function(session, row) { var line = session.getLine(row); var startIndent = line.search(/\S/); var startRow = row; var startColumn = line.length; row = row + 1; var endRow = row; var maxRow = session.getLength(); while (++row < maxRow) { line = session.getLine(row); var indent = line.search(/\S/); if (indent === -1) continue; if (startIndent > indent) break; var subRange = this.getFoldWidgetRange(session, "all", row); if (subRange) { if (subRange.start.row <= startRow) { break; } else if (subRange.isMultiLine()) { row = subRange.end.row; } else if (startIndent == indent) { break; } } endRow = row; } return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); }; this.getCommentRegionBlock = function(session, line, row) { var startColumn = line.search(/\s*$/); var maxRow = session.getLength(); var startRow = row; var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; var depth = 1; while (++row < maxRow) { line = session.getLine(row); var m = re.exec(line); if (!m) continue; if (m[1]) depth--; else depth++; if (!depth) break; } var endRow = row; if (endRow > startRow) { return new Range(startRow, startColumn, endRow, line.length); } }; }).call(FoldMode.prototype); }); define("ace/mode/c_cpp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/c_cpp_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Range = require("../range").Range; var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = c_cppHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; var endState = tokenizedLine.state; if (tokens.length && tokens[tokens.length-1].type == "comment") { return indent; } if (state == "start") { var match = line.match(/^.*[\{\(\[]\s*$/); if (match) { indent += tab; } } else if (state == "doc-start") { if (endState == "start") { return ""; } var match = line.match(/^\s*(\/?)\*/); if (match) { if (match[1]) { indent += " "; } indent += "* "; } } return indent; }; this.checkOutdent = function(state, line, input) { return this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, doc, row) { this.$outdent.autoOutdent(doc, row); }; this.$id = "ace/mode/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; }); (function() { window.require(["ace/mode/c_cpp"], function(m) { if (typeof module == "object" && typeof exports == "object" && module) { module.exports = m; } }); })();
{ "pile_set_name": "Github" }
{% set version = "1.4.2" %} {% set name = "BSgenome.Mmulatta.UCSC.rheMac8" %} {% set bioc = "3.11" %} package: name: 'bioconductor-{{ name|lower }}' version: '{{ version }}' source: url: - 'https://bioconductor.org/packages/{{ bioc }}/data/annotation/src/contrib/{{ name }}_{{ version }}.tar.gz' - 'https://bioarchive.galaxyproject.org/{{ name }}_{{ version }}.tar.gz' - 'https://depot.galaxyproject.org/software/bioconductor-{{ name|lower }}/bioconductor-{{ name|lower }}_{{ version }}_src_all.tar.gz' md5: e9ad1f70f652c62554e2c5af7638c015 build: number: 4 rpaths: - lib/R/lib/ - lib/ noarch: generic requirements: host: - 'bioconductor-bsgenome >=1.56.0,<1.57.0' - r-base run: - 'bioconductor-bsgenome >=1.56.0,<1.57.0' - r-base - curl test: commands: - '$R -e "library(''{{ name }}'')"' about: home: 'https://bioconductor.org/packages/{{ bioc }}/data/annotation/html/{{ name }}.html' license: Artistic-2.0 summary: 'Full genome sequences for Macaca mulatta (UCSC version rheMac8)' description: 'Full genome sequences for Macaca mulatta (Rhesus) as provided by UCSC (rheMac8, Nov. 2015) and stored in Biostrings objects.'
{ "pile_set_name": "Github" }
;;; calc-misc.el --- miscellaneous functions for Calc ;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004 ;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. ;; Author: David Gillespie <daveg@synaptics.com> ;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com> ;; This file is part of GNU Emacs. ;; GNU Emacs 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. ;; GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: ;;; Code: ;; This file is autoloaded from calc.el. (require 'calc) (require 'calc-macs) ;; Declare functions which are defined elsewhere. (declare-function calc-do-keypad "calc-keypd" (&optional full-display interactive)) (declare-function calc-inv-hyp-prefix-help "calc-help" ()) (declare-function calc-inverse-prefix-help "calc-help" ()) (declare-function calc-hyperbolic-prefix-help "calc-help" ()) (declare-function calc-explain-why "calc-stuff" (why &optional more)) (declare-function calc-clear-command-flag "calc-ext" (f)) (declare-function calc-roll-down-with-selections "calc-sel" (n m)) (declare-function calc-roll-up-with-selections "calc-sel" (n m)) (declare-function calc-last-args "calc-undo" (n)) (declare-function calc-is-inverse "calc-ext" ()) (declare-function calc-do-prefix-help "calc-ext" (msgs group key)) (declare-function math-objvecp "calc-ext" (a)) (declare-function math-known-scalarp "calc-arith" (a &optional assume-scalar)) (declare-function math-vectorp "calc-ext" (a)) (declare-function math-matrixp "calc-ext" (a)) (declare-function math-trunc-special "calc-arith" (a prec)) (declare-function math-trunc-fancy "calc-arith" (a)) (declare-function math-floor-special "calc-arith" (a prec)) (declare-function math-floor-fancy "calc-arith" (a)) (declare-function math-square-matrixp "calc-ext" (a)) (declare-function math-matrix-inv-raw "calc-mtx" (m)) (declare-function math-known-matrixp "calc-arith" (a)) (declare-function math-mod-fancy "calc-arith" (a b)) (declare-function math-pow-of-zero "calc-arith" (a b)) (declare-function math-pow-zero "calc-arith" (a b)) (declare-function math-pow-fancy "calc-arith" (a b)) (declare-function calc-locate-cursor-element "calc-yank" (pt)) ;;;###autoload (defun calc-dispatch-help (arg) "C-x* is a prefix key sequence; follow it with one of these letters: For turning Calc on and off: C calc. Start the Calculator in a window at the bottom of the screen. O calc-other-window. Start the Calculator but don't select its window. B calc-big-or-small. Control whether to use the full Emacs screen for Calc. Q quick-calc. Use the Calculator in the minibuffer. K calc-keypad. Start the Calculator in keypad mode (X window system only). E calc-embedded. Use the Calculator on a formula in this editing buffer. J calc-embedded-select. Like E, but select appropriate half of => or :=. W calc-embedded-word. Like E, but activate a single word, i.e., a number. Z calc-user-invocation. Invoke Calc in the way you defined with `Z I' cmd. X calc-quit. Turn Calc off. For moving data into and out of Calc: G calc-grab-region. Grab the region defined by mark and point into Calc. R calc-grab-rectangle. Grab the rectangle defined by mark, point into Calc. : calc-grab-sum-down. Grab a rectangle and sum the columns. _ calc-grab-sum-across. Grab a rectangle and sum the rows. Y calc-copy-to-buffer. Copy a value from the stack into the editing buffer. For use with Embedded mode: A calc-embedded-activate. Find and activate all :='s and =>'s in buffer. D calc-embedded-duplicate. Make a copy of this formula and select it. F calc-embedded-new-formula. Insert a new formula at current point. N calc-embedded-next. Advance cursor to next known formula in buffer. P calc-embedded-previous. Advance cursor to previous known formula. U calc-embedded-update-formula. Re-evaluate formula at point. ` calc-embedded-edit. Use calc-edit to edit formula at point. Documentation: I calc-info. Read the Calculator manual in the Emacs Info system. T calc-tutorial. Run the Calculator Tutorial using the Emacs Info system. S calc-summary. Read the Summary from the Calculator manual in Info. Miscellaneous: L calc-load-everything. Load all parts of the Calculator into memory. M read-kbd-macro. Read a region of keystroke names as a keyboard macro. 0 (zero) calc-reset. Reset Calc stack and modes to default state. Press `*' twice (`C-x * *') to turn Calc on or off using the same Calc user interface as before (either C-x * C or C-x * K; initially C-x * C). " (interactive "P") (calc-check-defines) (if calc-dispatch-help (progn (save-window-excursion (describe-function 'calc-dispatch-help) (let ((win (get-buffer-window "*Help*"))) (if win (let (key) (select-window win) (while (progn (message "Calc options: Calc, Keypad, ... %s" "press SPC, DEL to scroll, C-g to cancel") (memq (car (setq key (calc-read-key t))) '(? ?\C-h ?\C-? ?\C-v ?\M-v))) (condition-case err (if (memq (car key) '(? ?\C-v)) (scroll-up) (scroll-down)) (error (beep)))) (calc-unread-command (cdr key)))))) (calc-do-dispatch nil)) (let ((calc-dispatch-help t)) (calc-do-dispatch arg)))) ;;;###autoload (defun calc-big-or-small (arg) "Toggle Calc between full-screen and regular mode." (interactive "P") (let ((cwin (get-buffer-window "*Calculator*")) (twin (get-buffer-window "*Calc Trail*")) (kwin (get-buffer-window "*Calc Keypad*"))) (if cwin (setq calc-full-mode (if kwin (and twin (window-full-width-p twin)) (window-full-height-p cwin)))) (setq calc-full-mode (if arg (> (prefix-numeric-value arg) 0) (not calc-full-mode))) (if kwin (progn (calc-quit) (calc-do-keypad calc-full-mode nil)) (if cwin (progn (calc-quit) (calc nil calc-full-mode nil)))) (message (if calc-full-mode "Now using full screen for Calc" "Now using partial screen for Calc")))) ;;;###autoload (defun calc-other-window (&optional interactive) "Invoke the Calculator in another window." (interactive "p") (if (memq major-mode '(calc-mode calc-trail-mode)) (progn (other-window 1) (if (memq major-mode '(calc-mode calc-trail-mode)) (other-window 1))) (if (get-buffer-window "*Calculator*") (calc-quit) (let ((win (selected-window))) (calc nil win interactive))))) ;;;###autoload (defun another-calc () "Create another, independent Calculator buffer." (interactive) (if (eq major-mode 'calc-mode) (mapc (function (lambda (v) (set-default v (symbol-value v)))) calc-local-var-list)) (set-buffer (generate-new-buffer "*Calculator*")) (pop-to-buffer (current-buffer)) (calc-mode)) ;;;###autoload (defun calc-info () "Run the Emacs Info system on the Calculator documentation." (interactive) (select-window (get-largest-window)) (info "Calc")) ;;;###autoload (defun calc-info-goto-node (node) "Go to a node in the Calculator info documentation." (interactive) (select-window (get-largest-window)) (info (concat "(Calc)" node))) ;;;###autoload (defun calc-tutorial () "Run the Emacs Info system on the Calculator Tutorial." (interactive) (if (get-buffer-window "*Calculator*") (calc-quit)) (calc-info-goto-node "Interactive Tutorial") (calc-other-window) (message "Welcome to the Calc Tutorial!")) ;;;###autoload (defun calc-info-summary () "Run the Emacs Info system on the Calculator Summary." (interactive) (calc-info-goto-node "Summary")) ;;;###autoload (defun calc-help () (interactive) (let ((msgs '("Press `h' for complete help; press `?' repeatedly for a summary" "Letter keys: Negate; Precision; Yank; Why; Xtended cmd; Quit" "Letter keys: SHIFT + Undo, reDo; Keep-args; Inverse, Hyperbolic" "Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB" "Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi" "Letter keys: SHIFT + Num-eval; More-recn; eXec-kbd-macro" "Other keys: +, -, *, /, ^, \\ (int div), : (frac div)" "Other keys: & (1/x), | (concat), % (modulo), ! (factorial)" "Other keys: ' (alg-entry), = (eval), ` (edit); M-RET (last-args)" "Other keys: SPC/RET (enter/dup), LFD (over); < > (scroll horiz)" "Other keys: DEL (drop), M-DEL (drop-above); { } (scroll vert)" "Other keys: TAB (swap/roll-dn), M-TAB (roll-up)" "Other keys: [ , ; ] (vector), ( , ) (complex), ( ; ) (polar)" "Prefix keys: Algebra, Binary/business, Convert, Display" "Prefix keys: Functions, Graphics, Help, J (select)" "Prefix keys: Kombinatorics/statistics, Modes, Store/recall" "Prefix keys: Trail/time, Units/statistics, Vector/matrix" "Prefix keys: Z (user), SHIFT + Z (define)" "Prefix keys: prefix + ? gives further help for that prefix" " Calc by Dave Gillespie, daveg@synaptics.com"))) (if calc-full-help-flag msgs (if (or calc-inverse-flag calc-hyperbolic-flag) (if calc-inverse-flag (if calc-hyperbolic-flag (calc-inv-hyp-prefix-help) (calc-inverse-prefix-help)) (calc-hyperbolic-prefix-help)) (setq calc-help-phase (if (eq this-command last-command) (% (1+ calc-help-phase) (1+ (length msgs))) 0)) (let ((msg (nth calc-help-phase msgs))) (message "%s" (if msg (concat msg ":" (make-string (- (apply 'max (mapcar 'length msgs)) (length msg)) 32) " [?=MORE]") ""))))))) ;;;; Stack and buffer management. ;; The variable calc-last-why-command is set in calc-do-handly-whys ;; and used in calc-why (in calc-stuff.el). (defvar calc-last-why-command) ;;;###autoload (defun calc-do-handle-whys () (setq calc-why (sort calc-next-why (function (lambda (x y) (and (eq (car x) '*) (not (eq (car y) '*)))))) calc-next-why nil) (if (and calc-why (or (eq calc-auto-why t) (and (eq (car (car calc-why)) '*) calc-auto-why))) (progn (require 'calc-ext) (calc-explain-why (car calc-why) (if (eq calc-auto-why t) (cdr calc-why) (if calc-auto-why (eq (car (nth 1 calc-why)) '*)))) (setq calc-last-why-command this-command) (calc-clear-command-flag 'clear-message)))) ;;;###autoload (defun calc-record-why (&rest stuff) (if (eq (car stuff) 'quiet) (setq stuff (cdr stuff)) (if (and (symbolp (car stuff)) (cdr stuff) (or (Math-objectp (nth 1 stuff)) (and (Math-vectorp (nth 1 stuff)) (math-constp (nth 1 stuff))) (math-infinitep (nth 1 stuff)))) (setq stuff (cons '* stuff)) (if (and (stringp (car stuff)) (string-match "\\`\\*" (car stuff))) (setq stuff (cons '* (cons (substring (car stuff) 1) (cdr stuff))))))) (setq calc-next-why (cons stuff calc-next-why)) nil) ;; True if A is a constant or vector of constants. [P x] [Public] ;;;###autoload (defun math-constp (a) (or (Math-scalarp a) (and (memq (car a) '(sdev intv mod vec)) (progn (while (and (setq a (cdr a)) (or (Math-scalarp (car a)) ; optimization (math-constp (car a))))) (null a))))) ;;;###autoload (defun calc-roll-down-stack (n &optional m) (if (< n 0) (calc-roll-up-stack (- n) m) (if (or (= n 0) (> n (calc-stack-size))) (setq n (calc-stack-size))) (or m (setq m 1)) (and (> n 1) (< m n) (if (and calc-any-selections (not calc-use-selections)) (calc-roll-down-with-selections n m) (calc-pop-push-list n (append (calc-top-list m 1) (calc-top-list (- n m) (1+ m)))))))) ;;;###autoload (defun calc-roll-up-stack (n &optional m) (if (< n 0) (calc-roll-down-stack (- n) m) (if (or (= n 0) (> n (calc-stack-size))) (setq n (calc-stack-size))) (or m (setq m 1)) (and (> n 1) (< m n) (if (and calc-any-selections (not calc-use-selections)) (calc-roll-up-with-selections n m) (calc-pop-push-list n (append (calc-top-list (- n m) 1) (calc-top-list m (- n m -1)))))))) ;;;###autoload (defun calc-do-refresh () (if calc-hyperbolic-flag (progn (setq calc-display-dirty t) nil) (calc-refresh) t)) ;;;###autoload (defun calc-record-list (vals &optional prefix) (while vals (or (eq (car vals) 'top-of-stack) (progn (calc-record (car vals) prefix) (setq prefix "..."))) (setq vals (cdr vals)))) ;;;###autoload (defun calc-last-args-stub (arg) (interactive "p") (require 'calc-ext) (calc-last-args arg)) ;;;###autoload (defun calc-power (arg) (interactive "P") (calc-slow-wrapper (if (and (featurep 'calc-ext) (calc-is-inverse)) (calc-binary-op "root" 'calcFunc-nroot arg nil nil) (calc-binary-op "^" 'calcFunc-pow arg nil nil '^)))) ;;;###autoload (defun calc-mod (arg) (interactive "P") (calc-slow-wrapper (calc-binary-op "%" 'calcFunc-mod arg nil nil '%))) ;;;###autoload (defun calc-inv (arg) (interactive "P") (calc-slow-wrapper (calc-unary-op "inv" 'calcFunc-inv arg))) ;;;###autoload (defun calc-percent () (interactive) (calc-slow-wrapper (calc-pop-push-record-list 1 "%" (list (list 'calcFunc-percent (calc-top-n 1)))))) ;;;###autoload (defun calc-over (n) (interactive "P") (if n (calc-enter (- (prefix-numeric-value n))) (calc-enter -2))) ;;;###autoload (defun calc-pop-above (n) (interactive "P") (if n (calc-pop (- (prefix-numeric-value n))) (calc-pop -2))) ;;;###autoload (defun calc-roll-down (n) (interactive "P") (calc-wrapper (let ((nn (prefix-numeric-value n))) (cond ((null n) (calc-roll-down-stack 2)) ((> nn 0) (calc-roll-down-stack nn)) ((= nn 0) (calc-pop-push-list (calc-stack-size) (reverse (calc-top-list (calc-stack-size))))) (t (calc-roll-down-stack (calc-stack-size) (- nn))))))) ;;;###autoload (defun calc-roll-up (n) (interactive "P") (calc-wrapper (let ((nn (prefix-numeric-value n))) (cond ((null n) (calc-roll-up-stack 3)) ((> nn 0) (calc-roll-up-stack nn)) ((= nn 0) (calc-pop-push-list (calc-stack-size) (reverse (calc-top-list (calc-stack-size))))) (t (calc-roll-up-stack (calc-stack-size) (- nn))))))) ;;;###autoload (defun calc-transpose-lines (&optional arg) "Transpose previous line and current line. With argument ARG, move previous line past ARG lines. With argument 0, switch line point is in with line mark is in." (interactive "p") (setq arg (or arg 1)) (let (bot-line mid-line end-line old-top-list new-top-list bot-cell mid-cell prev-mid-cell post-mid-cell post-bot-cell) (calc-wrapper (when (eq major-mode 'calc-mode) (cond ;; exchange point and mark ((= 0 arg) (setq bot-line (calc-locate-cursor-element (point)) mid-line (mark)) (if mid-line (setq mid-line (calc-locate-cursor-element mid-line) end-line (1+ mid-line)) (error "No mark set")) (if (< bot-line mid-line) (let ((temp mid-line)) (setq mid-line bot-line bot-line temp)))) ;; move bot-line to mid-line that is above bot-line on stack (that is ;; to say mid-line displayed below bot-line in *Calculator* buffer) ((> arg 0) (setq bot-line (1+ (calc-locate-cursor-element (point))) mid-line (- bot-line arg) end-line mid-line)) ;; move bot-line to mid-line that is above bot-line on stack (that is ;; to say mid-line displayed below bot-line in *Calculator* buffer) ((< arg 0) (setq mid-line (1+ (calc-locate-cursor-element (point))) bot-line (- mid-line arg) end-line bot-line))) (calc-check-stack bot-line) (if (= 0 mid-line) (error "Can't transpose beyond top")) (setq old-top-list (nreverse (calc-top-list bot-line))) ;; example: (arg = 2) ;; old-top-list = ;; 1 <-- top of stack (bottom of *Calculator* buffer) ;; 2 ;; 3 <-- mid-line = 3 ;; 4 <-- point ;; 5 <-- bot-line = 5 (dotimes (i mid-line) (setq mid-cell old-top-list old-top-list (cdr old-top-list)) (setcdr mid-cell new-top-list) (setq new-top-list mid-cell)) ;; example follow-up: ;; old-top-list = ;; 4 ;; 5 ;; new-top-list = ;; 3 <-- mid-cell ;; 2 ;; 1 (setq prev-mid-cell old-top-list) (dotimes (i (- bot-line mid-line)) (setq bot-cell old-top-list old-top-list (cdr old-top-list)) (setcdr bot-cell new-top-list) (setq new-top-list bot-cell)) (setq post-mid-cell (cdr mid-cell) post-bot-cell (cdr bot-cell)) ;; example follow-up: ;; new-top-list = ;; 5 <-- bot-cell ;; 4 <-- prev-mid-cell & post-bot-cell ;; 3 <-- mid-cell ;; 2 <-- post-mid-cell ;; 1 (cond ((= 0 arg); swap bot and mid (setcdr mid-cell post-bot-cell) (setcdr bot-cell post-mid-cell) (setcdr prev-mid-cell bot-cell) ;; example follow-up: ;; 3 <-- mid-cell ;; 4 <-- post-bot-cell & prev-mid-cell ;; 5 <-- bot-cell ;; 2 <-- post-mid-cell ;; 1 (setq new-top-list mid-cell)) ((< 0 arg) ; move bot just after mid (setcdr mid-cell bot-cell) (setcdr bot-cell post-mid-cell) ;; example follow-up: ;; new-top-list = ;; 4 <-- post-bot-cell ;; 3 <-- mid-cell ;; 5 <-- bot-cell ;; 2 <-- post-mid-cell ;; 1 (setq new-top-list post-bot-cell)) ((> 0 arg) ; move mid just before bot (setcdr mid-cell bot-cell) (setcdr prev-mid-cell post-mid-cell) ;; example follow-up: ;; new-top-list = ;; 3 <-- mid-cell ;; 5 <-- bot-cell ;; 4 <-- prev-mid-cell ;; 2 <-- post-mid-cell ;; 1 (setq new-top-list mid-cell))) (calc-pop-push-list bot-line new-top-list))) (calc-cursor-stack-index (1- end-line)))) ;;; Other commands. ;;;###autoload (defun calc-num-prefix-name (n) (cond ((eq n '-) "- ") ((equal n '(4)) "C-u ") ((consp n) (format "%d " (car n))) ((integerp n) (format "%d " n)) (t ""))) ;;;###autoload (defun calc-missing-key (n) "This is a placeholder for a command which needs to be loaded from calc-ext. When this key is used, calc-ext (the Calculator extensions module) will be loaded and the keystroke automatically re-typed." (interactive "P") (require 'calc-ext) (if (keymapp (key-binding (char-to-string last-command-event))) (message "%s%c-" (calc-num-prefix-name n) last-command-event)) (calc-unread-command) (setq prefix-arg n)) ;;;###autoload (defun calc-shift-Y-prefix-help () (interactive) (require 'calc-ext) (calc-do-prefix-help calc-Y-help-msgs "other" ?Y)) ;;;###autoload (defun calcDigit-letter () (interactive) (if (calc-minibuffer-contains "[-+]?\\(1[1-9]\\|[2-9][0-9]\\)#.*") (progn (setq last-command-event (upcase last-command-event)) (calcDigit-key)) (calcDigit-nondigit))) ;; A Lisp version of temp_minibuffer_message from minibuf.c. ;;;###autoload (defun calc-temp-minibuffer-message (m) (let ((savemax (point-max))) (save-excursion (goto-char (point-max)) (insert m)) (let ((okay nil)) (unwind-protect (progn (sit-for 2) (identity 1) ; this forces a call to QUIT; in bytecode.c. (setq okay t)) (progn (delete-region savemax (point-max)) (or okay (abort-recursive-edit))))))) (put 'math-with-extra-prec 'lisp-indent-hook 1) ;; Concatenate two vectors, or a vector and an object. [V O O] [Public] ;;;###autoload (defun math-concat (v1 v2) (if (stringp v1) (concat v1 v2) (require 'calc-ext) (if (and (or (math-objvecp v1) (math-known-scalarp v1)) (or (math-objvecp v2) (math-known-scalarp v2))) (append (if (and (math-vectorp v1) (or (math-matrixp v1) (not (math-matrixp v2)))) v1 (list 'vec v1)) (if (and (math-vectorp v2) (or (math-matrixp v2) (not (math-matrixp v1)))) (cdr v2) (list v2))) (list '| v1 v2)))) ;; True if A is zero. Works for un-normalized values. [P n] [Public] ;;;###autoload (defun math-zerop (a) (if (consp a) (cond ((memq (car a) '(bigpos bigneg)) (while (eq (car (setq a (cdr a))) 0)) (null a)) ((memq (car a) '(frac float polar mod)) (math-zerop (nth 1 a))) ((eq (car a) 'cplx) (and (math-zerop (nth 1 a)) (math-zerop (nth 2 a)))) ((eq (car a) 'hms) (and (math-zerop (nth 1 a)) (math-zerop (nth 2 a)) (math-zerop (nth 3 a))))) (eq a 0))) ;; True if A is real and negative. [P n] [Public] ;;;###autoload (defun math-negp (a) (if (consp a) (cond ((eq (car a) 'bigpos) nil) ((eq (car a) 'bigneg) (cdr a)) ((memq (car a) '(float frac)) (Math-integer-negp (nth 1 a))) ((eq (car a) 'hms) (if (math-zerop (nth 1 a)) (if (math-zerop (nth 2 a)) (math-negp (nth 3 a)) (math-negp (nth 2 a))) (math-negp (nth 1 a)))) ((eq (car a) 'date) (math-negp (nth 1 a))) ((eq (car a) 'intv) (or (math-negp (nth 3 a)) (and (math-zerop (nth 3 a)) (memq (nth 1 a) '(0 2))))) ((equal a '(neg (var inf var-inf))) t)) (< a 0))) ;; True if A is a negative number or an expression the starts with '-'. ;;;###autoload (defun math-looks-negp (a) ; [P x] [Public] (or (Math-negp a) (eq (car-safe a) 'neg) (and (memq (car-safe a) '(* /)) (or (math-looks-negp (nth 1 a)) (math-looks-negp (nth 2 a)))) (and (eq (car-safe a) '-) (math-looks-negp (nth 1 a))))) ;; True if A is real and positive. [P n] [Public] ;;;###autoload (defun math-posp (a) (if (consp a) (cond ((eq (car a) 'bigpos) (cdr a)) ((eq (car a) 'bigneg) nil) ((memq (car a) '(float frac)) (Math-integer-posp (nth 1 a))) ((eq (car a) 'hms) (if (math-zerop (nth 1 a)) (if (math-zerop (nth 2 a)) (math-posp (nth 3 a)) (math-posp (nth 2 a))) (math-posp (nth 1 a)))) ((eq (car a) 'date) (math-posp (nth 1 a))) ((eq (car a) 'mod) (not (math-zerop (nth 1 a)))) ((eq (car a) 'intv) (or (math-posp (nth 2 a)) (and (math-zerop (nth 2 a)) (memq (nth 1 a) '(0 1))))) ((equal a '(var inf var-inf)) t)) (> a 0))) ;;;###autoload (defalias 'math-fixnump 'integerp) ;;;###autoload (defalias 'math-fixnatnump 'natnump) ;; True if A is an even integer. [P R R] [Public] ;;;###autoload (defun math-evenp (a) (if (consp a) (and (memq (car a) '(bigpos bigneg)) (= (% (nth 1 a) 2) 0)) (= (% a 2) 0))) ;; Compute A / 2, for small or big integer A. [I i] ;; If A is negative, type of truncation is undefined. ;;;###autoload (defun math-div2 (a) (if (consp a) (if (cdr a) (math-normalize (cons (car a) (math-div2-bignum (cdr a)))) 0) (/ a 2))) ;;;###autoload (defun math-div2-bignum (a) ; [l l] (if (cdr a) (cons (+ (/ (car a) 2) (* (% (nth 1 a) 2) (/ math-bignum-digit-size 2))) (math-div2-bignum (cdr a))) (list (/ (car a) 2)))) ;; Reject an argument to a calculator function. [Public] ;;;###autoload (defun math-reject-arg (&optional a p option) (if option (calc-record-why option p a) (if p (calc-record-why p a))) (signal 'wrong-type-argument (and a (if p (list p a) (list a))))) ;; Coerce A to be an integer (by truncation toward zero). [I N] [Public] ;; The variable math-trunc-prec is local to math-trunc, but used by ;; math-trunc-fancy in calc-arith.el, which is called by math-trunc. ;;;###autoload (defun math-trunc (a &optional math-trunc-prec) (cond (math-trunc-prec (require 'calc-ext) (math-trunc-special a math-trunc-prec)) ((Math-integerp a) a) ((Math-looks-negp a) (math-neg (math-trunc (math-neg a)))) ((eq (car a) 'float) (math-scale-int (nth 1 a) (nth 2 a))) (t (require 'calc-ext) (math-trunc-fancy a)))) ;;;###autoload (defalias 'calcFunc-trunc 'math-trunc) ;; Coerce A to be an integer (by truncation toward minus infinity). [I N] ;; The variable math-floor-prec is local to math-floor, but used by ;; math-floor-fancy in calc-arith.el, which is called by math-floor. ;;;###autoload (defun math-floor (a &optional math-floor-prec) ; [Public] (cond (math-floor-prec (require 'calc-ext) (math-floor-special a math-floor-prec)) ((Math-integerp a) a) ((Math-messy-integerp a) (math-trunc a)) ((Math-realp a) (if (Math-negp a) (math-add (math-trunc a) -1) (math-trunc a))) (t (require 'calc-ext) (math-floor-fancy a)))) ;;;###autoload (defalias 'calcFunc-floor 'math-floor) ;;;###autoload (defun math-imod (a b) ; [I I I] [Public] (if (and (not (consp a)) (not (consp b))) (if (= b 0) (math-reject-arg a "*Division by zero") (% a b)) (cdr (math-idivmod a b)))) ;;;###autoload (defun calcFunc-inv (m) (if (Math-vectorp m) (progn (require 'calc-ext) (if (math-square-matrixp m) (or (math-with-extra-prec 2 (math-matrix-inv-raw m)) (math-reject-arg m "*Singular matrix")) (math-reject-arg m 'square-matrixp))) (if (and (require 'calc-arith) (math-known-matrixp m)) (math-pow m -1) (math-div 1 m)))) ;;;###autoload (defun math-do-working (msg arg) (or executing-kbd-macro (progn (calc-set-command-flag 'clear-message) (if math-working-step (if math-working-step-2 (setq msg (format "[%d/%d] %s" math-working-step math-working-step-2 msg)) (setq msg (format "[%d] %s" math-working-step msg)))) (message "Working... %s = %s" msg (math-showing-full-precision (math-format-number arg)))))) ;; Compute A modulo B, defined in terms of truncation toward minus infinity. ;;;###autoload (defun math-mod (a b) ; [R R R] [Public] (cond ((and (Math-zerop a) (not (eq (car-safe a) 'mod))) a) ((Math-zerop b) (math-reject-arg a "*Division by zero")) ((and (Math-natnump a) (Math-natnump b)) (math-imod a b)) ((and (Math-anglep a) (Math-anglep b)) (math-sub a (math-mul (math-floor (math-div a b)) b))) (t (require 'calc-ext) (math-mod-fancy a b)))) ;;; General exponentiation. ;;;###autoload (defun math-pow (a b) ; [O O N] [Public] (cond ((equal b '(var nan var-nan)) b) ((Math-zerop a) (if (and (Math-scalarp b) (Math-posp b)) (if (math-floatp b) (math-float a) a) (require 'calc-ext) (math-pow-of-zero a b))) ((or (eq a 1) (eq b 1)) a) ((or (equal a '(float 1 0)) (equal b '(float 1 0))) a) ((Math-zerop b) (if (Math-scalarp a) (if (or (math-floatp a) (math-floatp b)) '(float 1 0) 1) (require 'calc-ext) (math-pow-zero a b))) ((and (Math-integerp b) (or (Math-numberp a) (Math-vectorp a))) (if (and (equal a '(float 1 1)) (integerp b)) (math-make-float 1 b) (math-with-extra-prec 2 (math-ipow a b)))) (t (require 'calc-ext) (math-pow-fancy a b)))) ;;;###autoload (defun math-ipow (a n) ; [O O I] [Public] (cond ((Math-integer-negp n) (math-ipow (math-div 1 a) (Math-integer-neg n))) ((not (consp n)) (if (and (Math-ratp a) (> n 20)) (math-iipow-show a n) (math-iipow a n))) ((math-evenp n) (math-ipow (math-mul a a) (math-div2 n))) (t (math-mul a (math-ipow (math-mul a a) (math-div2 (math-add n -1))))))) (defun math-iipow (a n) ; [O O S] (cond ((= n 0) 1) ((= n 1) a) ((= (% n 2) 0) (math-iipow (math-mul a a) (/ n 2))) (t (math-mul a (math-iipow (math-mul a a) (/ n 2)))))) (defun math-iipow-show (a n) ; [O O S] (math-working "pow" a) (let ((val (cond ((= n 0) 1) ((= n 1) a) ((= (% n 2) 0) (math-iipow-show (math-mul a a) (/ n 2))) (t (math-mul a (math-iipow-show (math-mul a a) (/ n 2))))))) (math-working "pow" val) val)) ;;;###autoload (defun math-read-radix-digit (dig) ; [D S; Z S] (if (> dig ?9) (if (< dig ?A) nil (- dig 55)) (if (>= dig ?0) (- dig ?0) nil))) ;;; Bug reporting ;;;###autoload (defun report-calc-bug () "Report a bug in Calc, the GNU Emacs calculator. Prompts for bug subject. Leaves you in a mail buffer." (interactive) (let ((reporter-prompt-for-summary-p t)) (reporter-submit-bug-report calc-bug-address "Calc" nil nil nil "Please describe exactly what actions triggered the bug and the precise symptoms of the bug. If possible, include a backtrace by doing 'M-x toggle-debug-on-error', then reproducing the bug. " ))) ;;;###autoload (defalias 'calc-report-bug 'report-calc-bug) (provide 'calc-misc) ;; Local variables: ;; generated-autoload-file: "calc-loaddefs.el" ;; End: ;; arch-tag: 7984d9d0-62e5-41dc-afb8-e904b975f250 ;;; calc-misc.el ends here
{ "pile_set_name": "Github" }
;;; shm-type.el --- Type info for nodes ;; Copyright (c) 2014 Chris Done. All rights reserved. ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; This file 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/>. ;;; Code: (require 'shm-layout) (defun shm/type-of-node () (interactive) (let ((current (shm-current-node))) (cond ((or (string= (shm-node-type-name current) "Exp") (string= (shm-node-type-name current) "Decl") (string= (shm-node-type-name current) "Pat") (string= (shm-node-type-name current) "QOp")) (let ((type-info (shm-node-type-info current))) (if type-info (shm-present-type-info current type-info) (if (and shm-type-info-fallback-to-ghci (fboundp 'haskell-process-do-type)) (haskell-process-do-type) (error "Unable to get type information for that node."))))) ((and (string= (shm-node-type-name current) "Name") (let ((parent-name (shm-node-type-name (cdr (shm-node-parent (shm-current-node-pair)))))) (or (string= parent-name "Match") (string= parent-name "Decl")))) (let* ((node (cdr (shm-node-parent (shm-current-node-pair)))) (type-info (shm-node-type-info node))) (if type-info (shm-present-type-info node type-info) (if (and shm-type-info-fallback-to-ghci (fboundp 'haskell-process-do-type)) (haskell-process-do-type) (error "Unable to get type information for that node (tried the whole decl, too)."))))) (t (error "Not an expression, operator, pattern binding or declaration."))))) (defun shm-present-type-info (node info) "Present type info to the user." (let ((info. (concat (shm-kill-node 'buffer-substring-no-properties node nil t) " :: " info))) (if shm-use-presentation-mode (if (fboundp 'haskell-present) (haskell-present "SHM-Node" nil info.) (message "%s" info)) (message "%s" info)))) (defun shm-type-of-region (beg end) "Get a type for the region." (let ((types (shm-types-at-point beg))) (loop for type in types do (when (and (= (elt type 0) beg) (= (elt type 1) end)) (return (elt type 2)))))) (defun shm-types-at-point (point) "Get a list of spans and types for the current point." (save-excursion (goto-char point) (let ((line (line-number-at-pos)) (col (1+ (current-column))) (file-name (buffer-file-name))) (cond (shm-use-hdevtools (shm-parse-hdevtools-type-info (with-temp-buffer (call-process "hdevtools" nil t nil "type" "-g" "-fdefer-type-errors" file-name (number-to-string line) (number-to-string col)) (buffer-string)))))))) (defun shm-parse-hdevtools-type-info (string) "Parse type information from the output of hdevtools." (let ((lines (split-string string "\n+"))) (loop for line in lines while (string-match "\\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) \"\\(.+\\)\"$" line) do (goto-char (point-min)) collect (let ((start-line (string-to-number (match-string 1 line))) (end-line (string-to-number (match-string 3 line)))) (vector (progn (forward-line (1- start-line)) (+ (line-beginning-position) (1- (string-to-number (match-string 2 line))))) (progn (when (/= start-line end-line) (forward-line (1- (- start-line end-line)))) (+ (line-beginning-position) (1- (string-to-number (match-string 4 line))))) (match-string 5 line)))))) (defun shm-node-type-info (node) "Get the type of the given node." (shm-type-of-region (shm-node-start node) (shm-node-end node))) (provide 'shm-type)
{ "pile_set_name": "Github" }
var convert = require('./convert'); module.exports = convert('repeat', require('../repeat'));
{ "pile_set_name": "Github" }
# coding: utf-8 """ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F401 from petstore_api.api_client import ApiClient, Endpoint from petstore_api.model_utils import ( # noqa: F401 check_allowed_values, check_validations, date, datetime, file_type, none_type, validate_and_convert_types ) from petstore_api.model.client import Client class FakeClassnameTags123Api(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client def __test_classname( self, client, **kwargs ): """To test class name in snake case # noqa: E501 To test class name in snake case # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.test_classname(client, async_req=True) >>> result = thread.get() Args: client (Client): client model Keyword Args: _return_http_data_only (bool): response data without head status code and headers. Default is True. _preload_content (bool): if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. _request_timeout (float/tuple): timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None. _check_input_type (bool): specifies if type checking should be done one the data sent to the server. Default is True. _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. async_req (bool): execute request asynchronously Returns: Client If the method is called asynchronously, returns the request thread. """ kwargs['async_req'] = kwargs.get( 'async_req', False ) kwargs['_return_http_data_only'] = kwargs.get( '_return_http_data_only', True ) kwargs['_preload_content'] = kwargs.get( '_preload_content', True ) kwargs['_request_timeout'] = kwargs.get( '_request_timeout', None ) kwargs['_check_input_type'] = kwargs.get( '_check_input_type', True ) kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) kwargs['_host_index'] = kwargs.get('_host_index') kwargs['client'] = \ client return self.call_with_http_info(**kwargs) self.test_classname = Endpoint( settings={ 'response_type': (Client,), 'auth': [ 'api_key_query' ], 'endpoint_path': '/fake_classname_test', 'operation_id': 'test_classname', 'http_method': 'PATCH', 'servers': None, }, params_map={ 'all': [ 'client', ], 'required': [ 'client', ], 'nullable': [ ], 'enum': [ ], 'validation': [ ] }, root_map={ 'validations': { }, 'allowed_values': { }, 'openapi_types': { 'client': (Client,), }, 'attribute_map': { }, 'location_map': { 'client': 'body', }, 'collection_format_map': { } }, headers_map={ 'accept': [ 'application/json' ], 'content_type': [ 'application/json' ] }, api_client=api_client, callable=__test_classname )
{ "pile_set_name": "Github" }
import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; it('renders without crashing', () => { const div = document.createElement('div'); ReactDOM.render(<App />, div); });
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <custom-sql> <sql id="com.liferay.chat.service.persistence.EntryFinder.findByEmptyContent"> <![CDATA[ SELECT {Chat_Entry.*} FROM Chat_Entry WHERE (fromUserId = ?) AND (toUserId = ?) AND (content = '' OR content IS NULL) ORDER BY createDate DESC ]]> </sql> <sql id="com.liferay.chat.service.persistence.EntryFinder.findByNew"> <![CDATA[ SELECT {Chat_Entry.*} FROM Chat_Entry WHERE ( (fromUserId = ?) OR (toUserId = ?) ) AND (flag = ?) ORDER BY createDate DESC ]]> </sql> <sql id="com.liferay.chat.service.persistence.EntryFinder.findByOld"> <![CDATA[ SELECT {Chat_Entry.*} FROM Chat_Entry WHERE (createDate < ?) ORDER BY createDate DESC ]]> </sql> <sql id="com.liferay.chat.service.persistence.StatusFinder.findByModifiedDate"> <![CDATA[ SELECT Chat_Status.awake AS awake, User_.firstName AS firstName, Group_.groupId as groupId, User_.lastName AS lastName, User_.middleName AS middleName, User_.portraitId AS portraitId, User_.screenName AS screenName, User_.userId AS userId, User_.uuid_ AS userUuid FROM Chat_Status INNER JOIN User_ ON (User_.userId = Chat_Status.userId) INNER JOIN Group_ ON ( (Group_.classPK = User_.userId) AND (Group_.companyId = User_.companyId) ) WHERE (Group_.classNameId = ?) AND (User_.companyId = ?) AND (User_.userId != ?) AND (Chat_Status.modifiedDate > ?) AND (Chat_Status.online_ = [$TRUE$]) ORDER BY Chat_Status.awake ASC, User_.firstName ASC, User_.middleName ASC, User_.lastName ASC ]]> </sql> <sql id="com.liferay.chat.service.persistence.StatusFinder.findBySocialRelationTypes"> <![CDATA[ SELECT DISTINCT Chat_Status.awake AS awake, User_.firstName AS firstName, Group_.groupId as groupId, User_.lastName AS lastName, User_.middleName AS middleName, User_.portraitId AS portraitId, User_.screenName AS screenName, User_.userId AS userId, User_.uuid_ AS userUuid FROM Chat_Status INNER JOIN User_ ON (User_.userId = Chat_Status.userId) INNER JOIN Group_ ON ( (Group_.classPK = User_.userId) AND (Group_.companyId = User_.companyId) ) INNER JOIN SocialRelation ON (SocialRelation.userId2 = User_.userId) WHERE (Group_.classNameId = ?) AND (SocialRelation.userId1 = ?) AND [$SOCIAL_RELATION_TYPES$] (User_.companyId = ?) AND (User_.userId != ?) AND (Chat_Status.modifiedDate > ?) AND (Chat_Status.online_ = [$TRUE$]) ORDER BY Chat_Status.awake ASC, User_.firstName ASC, User_.middleName ASC, User_.lastName ASC ]]> </sql> <sql id="com.liferay.chat.service.persistence.StatusFinder.findByUsersGroups"> <![CDATA[ SELECT DISTINCT Chat_Status.awake AS awake, User_.firstName AS firstName, Group_.groupId as groupId, User_.lastName AS lastName, User_.middleName AS middleName, User_.portraitId AS portraitId, User_.screenName AS screenName, User_.userId AS userId, User_.uuid_ AS userUuid FROM Chat_Status INNER JOIN User_ ON (User_.userId = Chat_Status.userId) INNER JOIN Users_Groups ON (Users_Groups.userId = User_.userId) INNER JOIN Group_ ON ( (Group_.classPK = User_.userId) AND (Group_.companyId = User_.companyId) ) WHERE (Group_.classNameId = ?) AND (User_.companyId = ?) AND (User_.userId != ?) AND (Users_Groups.groupId IN ( SELECT Users_Groups.groupId FROM Users_Groups [$USERS_GROUPS_JOIN$] WHERE (userId = ?) [$USERS_GROUPS_WHERE$] ) ) AND (Chat_Status.modifiedDate > ?) AND (Chat_Status.online_ = [$TRUE$]) ORDER BY Chat_Status.awake ASC, User_.firstName ASC, User_.middleName ASC, User_.lastName ASC ]]> </sql> </custom-sql>
{ "pile_set_name": "Github" }
OpenGL Tutorial #28. Project Name: David Nikdel & Jeff Molofee's OpenGL Bezier Tutorial Project Description: Learn How To Create And Manipulate Textured Bezier Surfaces Authors Name: David Nikdel Authors Web Site: nehe.gamedev.net COPYRIGHT AND DISCLAIMER: (c)2000 Jeff Molofee If you plan to put this program on your web page or a cdrom of any sort, let me know via email, I'm curious to see where it ends up :) If you use the code for your own projects please give the author credit.
{ "pile_set_name": "Github" }
{ "_from": "jsprim@^1.2.2", "_id": "jsprim@1.4.1", "_inBundle": false, "_integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", "_location": "/jsprim", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "jsprim@^1.2.2", "name": "jsprim", "escapedName": "jsprim", "rawSpec": "^1.2.2", "saveSpec": null, "fetchSpec": "^1.2.2" }, "_requiredBy": [ "/http-signature", "/loggly/http-signature" ], "_resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "_shasum": "313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2", "_spec": "jsprim@^1.2.2", "_where": "D:\\server\\node_modules\\http-signature", "bugs": { "url": "https://github.com/joyent/node-jsprim/issues" }, "bundleDependencies": false, "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", "json-schema": "0.2.3", "verror": "1.10.0" }, "deprecated": false, "description": "utilities for primitive JavaScript types", "engines": [ "node >=0.6.0" ], "homepage": "https://github.com/joyent/node-jsprim#readme", "license": "MIT", "main": "./lib/jsprim.js", "name": "jsprim", "repository": { "type": "git", "url": "git://github.com/joyent/node-jsprim.git" }, "version": "1.4.1" }
{ "pile_set_name": "Github" }
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build go1.5 package cancellable import ( "net/http" "github.com/docker/engine-api/client/transport" ) func canceler(client transport.Sender, req *http.Request) func() { // TODO(djd): Respect any existing value of req.Cancel. ch := make(chan struct{}) req.Cancel = ch return func() { close(ch) } }
{ "pile_set_name": "Github" }