text
stringlengths
2
100k
meta
dict
# pop3.tcl -- # # POP3 mail client package, written in pure Tcl. # Some concepts borrowed from "frenchie", a POP3 # mail client utility written by Scott Beasley. # # Copyright (c) 2000 by Ajuba Solutions. # portions Copyright (c) 2000 by Scott Beasley # portions Copyright (c) 2010-2012 Andreas Kupries # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # RCS: @(#) $Id: pop3.tcl,v 1.38 2012/01/10 20:02:22 andreas_kupries Exp $ package require Tcl 8.4 package require cmdline package require log package provide pop3 1.9 namespace eval ::pop3 { # The state variable remembers information about the open pop3 # connection. It is indexed by channel id. The information is # a keyed list, with keys "msex" and "retr_mode". The value # associated with "msex" is boolean, a true value signals that the # server at the other end is MS Exchange. The value associated # with "retr_mode" is one of {retr, list, slow}. # The value of "msex" influences how the translation for the # channel is set and is determined by the contents of the received # greeting. The value of "retr_mode" is initially "retr" and # completely determined by the first call to [retrieve]. For "list" # the system will use LIST before RETR to retrieve the message size. # The state can be influenced by options given to "open". variable state array set state {} } # ::pop3::config -- # # Retrieve configuration of pop3 connection # # Arguments: # chan The channel, returned by ::pop3::open # # Results: # A serialized array. proc ::pop3::config {chan} { variable state return $state($chan) } # ::pop3::close -- # # Close the connection to the POP3 server. # # Arguments: # chan The channel, returned by ::pop3::open # # Results: # None. proc ::pop3::close {chan} { variable state catch {::pop3::send $chan "QUIT"} unset state($chan) ::close $chan return } # ::pop3::delete -- # # Delete messages on the POP3 server. # # Arguments: # chan The channel, returned by ::pop3::open # start The first message to delete in the range. # May be "next" (the next message after the last # one seen, see ::pop3::last), "start" (aka 1), # "end" (the last message in the spool, for # deleting only the last message). # end (optional, defaults to -1) The last message # to delete in the range. May be "last" # (the last message viewed), "end" (the last # message in the spool), or "-1" (the default, # any negative number means delete only # one message). # # Results: # None. # May throw errors from the server. proc ::pop3::delete {chan start {end -1}} { variable state array set cstate $state($chan) set count $cstate(limit) set last 0 catch {set last [::pop3::last $chan]} if {![string is integer $start]} { if {[string match $start "next"]} { set start $last incr start } elseif {$start == "start"} { set start 1 } elseif {$start == "end"} { set start $count } else { error "POP3 Deletion error: Bad start index $start" } } if {$start == 0} { set start 1 } if {![string is integer $end]} { if {$end == "end"} { set end $count } elseif {$end == "last"} { set end $last } else { error "POP3 Deletion error: Bad end index $end" } } elseif {$end < 0} { set end $start } if {$end > $count} { set end $count } for {set index $start} {$index <= $end} {incr index} { if {[catch {::pop3::send $chan "DELE $index"} errorStr]} { error "POP3 DELETE ERROR: $errorStr" } } return {} } # ::pop3::last -- # # Gets the index of the last email read from the server. # Note, some POP3 servers do not support this feature, # in which case the value returned may always be zero, # or an error may be thrown. # # Arguments: # chan The channel, returned by ::pop3::open # # Results: # The index of the last email message read, which may # be zero if none have been read or if the server does # not support this feature. # Server errors may be thrown, including some cases # when the LAST command is not supported. proc ::pop3::last {chan} { if {[catch { set resultStr [::pop3::send $chan "LAST"] } errorStr]} { error "POP3 LAST ERROR: $errorStr" } return [string trim $resultStr] } # ::pop3::list -- # # Returns "scan listing" of the mailbox. If parameter msg # is defined, then the listing only for the given message # is returned. # # Arguments: # chan The channel open to the POP3 server. # msg The message number (optional). # # Results: # If msg parameter is not given, Tcl list of scan listings in # the maildrop is returned. In case msg parameter is given, # a list of length one containing the specified message listing # is returned. proc ::pop3::list {chan {msg ""}} { global PopErrorNm PopErrorStr debug if {$msg == ""} { if {[catch {::pop3::send $chan "LIST"} errorStr]} { error "POP3 LIST ERROR: $errorStr" } set msgBuffer [RetrSlow $chan] } else { # argument msg given, single-line response expected if {[catch {expr {0 + $msg}}]} { error "POP3 LIST ERROR: malformed message number '$msg'" } else { set msgBuffer [string trim [::pop3::send $chan "LIST $msg"]] } } return $msgBuffer } # pop3::open -- # # Opens a connection to a POP3 mail server. # # Arguments: # args A list of options and values, possibly empty, # followed by the regular arguments, i.e. host, user, # passwd and port. The latter is optional. # # host The name or IP address of the POP3 server host. # user The username to use when logging into the server. # passwd The password to use when logging into the server. # port (optional) The socket port to connect to, defaults # to port 110, the POP standard port address. # # Results: # The connection channel (a socket). # May throw errors from the server. proc ::pop3::open {args} { variable state array set cstate {socketcmd ::socket msex 0 retr_mode retr limit {} stls 0 tls-callback {}} log::log debug "pop3::open | [join $args]" while {[set err [cmdline::getopt args { msex.arg retr-mode.arg socketcmd.arg stls.arg tls-callback.arg } opt arg]]} { if {$err < 0} { return -code error "::pop3::open : $arg" } switch -exact -- $opt { msex { if {![string is boolean $arg]} { return -code error \ ":pop3::open : Argument to -msex has to be boolean" } set cstate(msex) $arg } retr-mode { switch -exact -- $arg { retr - list - slow { set cstate(retr_mode) $arg } default { return -code error \ ":pop3::open : Argument to -retr-mode has to be one of retr, list or slow" } } } socketcmd { set cstate(socketcmd) $arg } stls { if {![string is boolean $arg]} { return -code error \ ":pop3::open : Argument to -tls has to be boolean" } set cstate(stls) $arg } tls-callback { set cstate(tls-callback) $arg } default { # Can't happen } } } if {[llength $args] > 4} { return -code error "To many arguments to ::pop3::open" } if {[llength $args] < 3} { return -code error "Not enough arguments to ::pop3::open" } foreach {host user password port} $args break if {$port == {}} { if {([lindex $cstate(socketcmd) 0] eq "tls::socket") || ([lindex $cstate(socketcmd) 0] eq "::tls::socket")} { # Standard port for SSL-based pop3 connections. set port 995 } else { # Standard port for any other type of connection. set port 110 } } log::log debug "pop3::open | protocol, connect to $host $port" # Argument processing is finally complete, now open the channel set chan [eval [linsert $cstate(socketcmd) end $host $port]] fconfigure $chan -buffering none log::log debug "pop3::open | connect on $chan" if {$cstate(msex)} { # We are talking to MS Exchange. Work around its quirks. fconfigure $chan -translation binary } else { fconfigure $chan -translation {binary crlf} } log::log debug "pop3::open | wait for greeting" if {[catch {::pop3::send $chan {}} errorStr]} { ::close $chan return -code error "POP3 CONNECT ERROR: $errorStr" } if {0} { # -FUTURE- Identify MS Exchange servers set cstate(msex) 1 # We are talking to MS Exchange. Work around its quirks. fconfigure $chan -translation binary } if {$cstate(stls)} { log::log debug "pop3::open | negotiating TLS on $chan" if {[catch { set capa [::pop3::capa $chan] log::log debug "pop3::open | Server $chan can $capa" } errorStr]} { close $chan return -code error "POP3 CONNECT/STLS ERROR: $errorStr" } if { [lsearch -exact $capa STLS] == -1} { log::log debug "pop3::open | Server $chan can't STLS" close $chan return -code error "POP CONNECT ERROR: STLS requested but not supported by server" } log::log debug "pop3::open | server can TLS on $chan" if {[catch { ::pop3::send $chan "STLS" } errorStr]} { close $chan return -code error "POP3 STLS ERROR: $errorStr" } package require tls log::log debug "pop3::open | tls::import $chan" # Explicitly disable ssl2 and only allow ssl3 and tlsv1. Although the defaults # will work with most servers, ssl2 is really, really old and is deprecated. if {$cstate(tls-callback) ne ""} { set newchan [tls::import $chan -ssl2 0 -ssl3 1 -tls1 1 -cipher SSLv3,TLSv1 -command $cstate(tls-callback)] } else { set newchan [tls::import $chan -ssl2 0 -ssl3 1 -tls1 1 -cipher SSLv3,TLSv1] } if {[catch { log::log debug "pop3::open | tls::handshake $chan" tls::handshake $chan } errorStr]} { close $chan return -code error "POP3 CONNECT/TLS HANDSHAKE ERROR: $errorStr" } array set security [tls::status $chan] set sbits 0 if { [info exists security(sbits)] } { set sbits $security(sbits) } if { $sbits == 0 } { close $chan return -code error "POP3 CONNECT/TLS: TLS Requested but not available" } elseif { $sbits < 128 } { close $chan return -code error "POP3 CONNECT/TLS: TLS Requested but insufficient (<128bits): $sbits" } log::log debug "pop3::open | $chan now in $sbits bit TLS mode ($security(cipher))" } log::log debug "pop3::open | authenticate $user (*password not shown*)" if {[catch { ::pop3::send $chan "USER $user" ::pop3::send $chan "PASS $password" } errorStr]} { ::close $chan return -code error "POP3 LOGIN ERROR: $errorStr" } # [ 833486 ] Can't delete messages one at a time ... # Remember the number of messages in the maildrop at the beginning # of the session. This gives us the highest possible number for # message ids later. Note that this number must not be affected # when deleting mails later. While the number of messages drops # down the limit for the message id's stays the same. The messages # are not renumbered before the session actually closed. set cstate(limit) [lindex [::pop3::status $chan] 0] # Remember the state. set state($chan) [array get cstate] log::log debug "pop3::open | ok ($chan)" return $chan } # ::pop3::retrieve -- # # Retrieve email message(s) from the server. # # Arguments: # chan The channel, returned by ::pop3::open # start The first message to retrieve in the range. # May be "next" (the next message after the last # one seen, see ::pop3::last), "start" (aka 1), # "end" (the last message in the spool, for # retrieving only the last message). # end (optional, defaults to -1) The last message # to retrieve in the range. May be "last" # (the last message viewed), "end" (the last # message in the spool), or "-1" (the default, # any negative number means retrieve only # one message). # # Results: # A list containing all of the messages retrieved. # May throw errors from the server. proc ::pop3::retrieve {chan start {end -1}} { variable state array set cstate $state($chan) set count $cstate(limit) set last 0 catch {set last [::pop3::last $chan]} if {![string is integer $start]} { if {[string match $start "next"]} { set start $last incr start } elseif {$start == "start"} { set start 1 } elseif {$start == "end"} { set start $count } else { error "POP3 Retrieval error: Bad start index $start" } } if {$start == 0} { set start 1 } if {![string is integer $end]} { if {$end == "end"} { set end $count } elseif {$end == "last"} { set end $last } else { error "POP3 Retrieval error: Bad end index $end" } } elseif {$end < 0} { set end $start } if {$end > $count} { set end $count } set result {} ::log::log debug "pop3 $chan retrieve $start -- $end" for {set index $start} {$index <= $end} {incr index} { switch -exact -- $cstate(retr_mode) { retr { set sizeStr [::pop3::send $chan "RETR $index"] ::log::log debug "pop3 $chan retrieve ($sizeStr)" if {[scan $sizeStr {%d %s} size dummy] < 1} { # The server did not deliver the size information. # Switch our mode to "list" and use the slow # method this time. The next call will use LIST before # RETR to get the size information. If even that fails # the system will fall back to slow mode all the time. ::log::log debug "pop3 $chan retrieve - no size information, go slow" set cstate(retr_mode) list set state($chan) [array get cstate] # Retrieve in slow motion. set msgBuffer [RetrSlow $chan] } else { ::log::log debug "pop3 $chan retrieve - size information present, use fast mode" set msgBuffer [RetrFast $chan $size] } } list { set sizeStr [::pop3::send $chan "LIST $index"] if {[scan $sizeStr {%d %d %s} dummy size dummy] < 2} { # Not even LIST generates the necessary size information. # Switch to full slow mode and don't bother anymore. set cstate(retr_mode) slow set state($chan) [array get cstate] ::pop3::send $chan "RETR $index" # Retrieve in slow motion. set msgBuffer [RetrSlow $chan] } else { # Ignore response of RETR, already know the size # through LIST ::pop3::send $chan "RETR $index" set msgBuffer [RetrFast $chan $size] } } slow { # Retrieve in slow motion. ::pop3::send $chan "RETR $index" set msgBuffer [RetrSlow $chan] } } lappend result $msgBuffer } return $result } # ::pop3::RetrFast -- # # Fast retrieval of a message from the pop3 server. # Internal helper to prevent code bloat in "pop3::retrieve" # # Arguments: # chan The channel to read the message from. # # Results: # The text of the retrieved message. proc ::pop3::RetrFast {chan size} { set msgBuffer [read $chan $size] foreach line [split $msgBuffer \n] { ::log::log debug "pop3 $chan fast <$line>" } # There is a small discrepance in counting octets we have to be # aware of. 'size' is #octets before transmission, i.e. can be # with one eol character, CR or LF. The channel system in binary # mode counts every character, and the protocol specified CRLF as # eol, so for every line in the message we read that many # characters _less_. Another factor which can cause a miscount is # the ".-stuffing performed by the sender. I.e. what we got now is # not necessarily the complete message. We have to perform slow # reads to get the remainder of the message. This has another # complication. We cannot simply check for a line containing the # terminating signature, simply because the point where the # message was broken in two might just be in between the dots of a # "\r\n..\r\n" sequence. We have to make sure that we do not # misinterpret the second part of this sequence as terminator. # Another possibility: "\r\n.\r\n" is broken just after the dot. # Then we have to ensure to not to miss the terminator entirely. # Sometimes the gets returns nothing, need to get the real # terminating "." / " if {[string equal [string range $msgBuffer end-3 end] "\n.\r\n"]} { # Complete terminator found. Remove it from the message buffer. ::log::log debug "pop3 $chan /5__" set msgBuffer [string range $msgBuffer 0 end-3] } elseif {[string equal [string range $msgBuffer end-2 end] "\n.\r"]} { # Complete terminator found. Remove it from the message buffer. # Also perform an empty read to remove the missing '\n' from # the channel. If we don't do this all following commands will # run into off-by-one (character) problems. ::log::log debug "pop3 $chan /4__" set msgBuffer [string range $msgBuffer 0 end-2] while {[read $chan 1] != "\n"} {} } elseif {[string equal [string range $msgBuffer end-1 end] "\n."]} { # \n. at the end of the fast buffer. # Can be \n.\r\n = Terminator # or \n..\r\n = dot-stuffed single . log::log debug "pop3 $chan /check for cut .. or terminator sequence" # Idle until non-empty line encountered. while {[set line [gets $chan]] == ""} {} if {"$line" == "\r"} { # Terminator already found. Note that we have to # remove the partial terminator sequence from the # message buffer. ::log::log debug "pop3 $chan /3__ <$line>" set msgBuffer [string range $msgBuffer 0 end-1] } else { # Append line and look for the real terminator append msgBuffer $line ::log::log debug "pop3 $chan ____ <$line>" while {[set line [gets $chan]] != ".\r"} { ::log::log debug "pop3 $chan ____ <$line>" append msgBuffer $line } ::log::log debug "pop3 $chan /2__ <$line>" } } elseif {[string equal [string index $msgBuffer end] \n]} { # Line terminator (\n) found. The remainder of the mail has to # consist of true lines we can read directly. while {![string equal [set line [gets $chan]] ".\r"]} { ::log::log debug "pop3 $chan ____ <$line>" append msgBuffer $line } ::log::log debug "pop3 $chan /1__ <$line>" } else { # Incomplete line at the end of the buffer. We complete it in # a single read, and then handle the remainder like the case # before, where we had a complete line at the end of the # buffer. set line [gets $chan] ::log::log debug "pop3 $chan /1a_ <$line>" append msgBuffer $line ::log::log debug "pop3 $chan /1b_" while {![string equal [set line [gets $chan]] ".\r"]} { ::log::log debug "pop3 $chan ____ <$line>" append msgBuffer $line } ::log::log debug "pop3 $chan /1c_ <$line>" } ::log::log debug "pop3 $chan done" # Map both cr+lf and cr to lf to simulate auto EOL translation, then # unstuff .-stuffed lines. return [string map [::list \n.. \n.] [string map [::list \r \n] [string map [::list \r\n \n] $msgBuffer]]] } # ::pop3::RetrSlow -- # # Slow retrieval of a message from the pop3 server. # Internal helper to prevent code bloat in "pop3::retrieve" # # Arguments: # chan The channel to read the message from. # # Results: # The text of the retrieved message. proc ::pop3::RetrSlow {chan} { set msgBuffer "" while {1} { set line [string trimright [gets $chan] \r] ::log::log debug "pop3 $chan slow $line" # End of the message is a line with just "." if {$line == "."} { break } elseif {[string index $line 0] == "."} { set line [string range $line 1 end] } append msgBuffer $line "\n" } return $msgBuffer } # ::pop3::send -- # # Send a command string to the POP3 server. This is an # internal function, but may be used in rare cases. # # Arguments: # chan The channel open to the POP3 server. # cmdstring POP3 command string # # Results: # Result string from the POP3 server, except for the +OK tag. # Errors from the POP3 server are thrown. proc ::pop3::send {chan cmdstring} { global PopErrorNm PopErrorStr debug if {$cmdstring != {}} { ::log::log debug "pop3 $chan >>> $cmdstring" puts $chan $cmdstring } set popRet [string trim [gets $chan]] ::log::log debug "pop3 $chan <<< $popRet" if {[string first "+OK" $popRet] == -1} { error [string range $popRet 4 end] } return [string range $popRet 3 end] } # ::pop3::status -- # # Get the status of the mail spool on the POP3 server. # # Arguments: # chan The channel, returned by ::pop3::open # # Results: # A list containing two elements, {msgCount octetSize}, # where msgCount is the number of messages in the spool # and octetSize is the size (in octets, or 8 bytes) of # the entire spool. proc ::pop3::status {chan} { if {[catch {set statusStr [::pop3::send $chan "STAT"]} errorStr]} { error "POP3 STAT ERROR: $errorStr" } # Dig the sent size and count info out. set rawStatus [split [string trim $statusStr]] return [::list [lindex $rawStatus 0] [lindex $rawStatus 1]] } # ::pop3::top -- # # Optional POP3 command (see RFC1939). Retrieves message header # and given number of lines from the message body. # # Arguments: # chan The channel open to the POP3 server. # msg The message number to be retrieved. # n Number of lines returned from the message body. # # Results: # Text (with newlines) from the server. # Errors from the POP3 server are thrown. proc ::pop3::top {chan msg n} { global PopErrorNm PopErrorStr debug if {[catch {::pop3::send $chan "TOP $msg $n"} errorStr]} { error "POP3 TOP ERROR: $errorStr" } return [RetrSlow $chan] } # ::pop3::uidl -- # # Returns "uid listing" of the mailbox. If parameter msg # is defined, then the listing only for the given message # is returned. # # Arguments: # chan The channel open to the POP3 server. # msg The message number (optional). # # Results: # If msg parameter is not given, Tcl list of uid listings in # the maildrop is returned. In case msg parameter is given, # a list of length one containing the uid of the specified # message listing is returned. proc ::pop3::uidl {chan {msg ""}} { if {$msg == ""} { if {[catch {::pop3::send $chan "UIDL"} errorStr]} { error "POP3 UIDL ERROR: $errorStr" } set msgBuffer [RetrSlow $chan] } else { # argument msg given, single-line response expected if {[catch {expr {0 + $msg}}]} { error "POP3 UIDL ERROR: malformed message number '$msg'" } else { set msgBuffer [string trim [::pop3::send $chan "UIDL $msg"]] } } return $msgBuffer } # ::pop3::capa -- # # Returns "capabilities" of the server. # # Arguments: # chan The channel open to the POP3 server. # # Results: # A Tcl list with the capabilities of the server. # UIDL, TOP, STLS are typical capabilities. proc ::pop3::capa {chan} { global PopErrorNm PopErrorStr debug if {[catch {::pop3::send $chan "CAPA"} errorStr]} { error "POP3 CAPA ERROR: $errorStr" } set msgBuffer [string map {\r {}} [RetrSlow $chan]] return [split $msgBuffer \n] }
{ "pile_set_name": "Github" }
# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py # RUN: llvm-mca -mtriple=i686-unknown-unknown -mcpu=x86-64 -instruction-tables < %s | FileCheck %s aaa aad aad $7 aam aam $7 aas bound %bx, (%eax) bound %ebx, (%eax) daa das into leave salc # CHECK: Instruction Info: # CHECK-NEXT: [1]: #uOps # CHECK-NEXT: [2]: Latency # CHECK-NEXT: [3]: RThroughput # CHECK-NEXT: [4]: MayLoad # CHECK-NEXT: [5]: MayStore # CHECK-NEXT: [6]: HasSideEffects (U) # CHECK: [1] [2] [3] [4] [5] [6] Instructions: # CHECK-NEXT: 1 100 0.33 aaa # CHECK-NEXT: 1 100 0.33 aad # CHECK-NEXT: 1 100 0.33 aad $7 # CHECK-NEXT: 1 100 0.33 aam # CHECK-NEXT: 1 100 0.33 aam $7 # CHECK-NEXT: 1 100 0.33 aas # CHECK-NEXT: 1 100 0.33 U bound %bx, (%eax) # CHECK-NEXT: 1 100 0.33 U bound %ebx, (%eax) # CHECK-NEXT: 1 100 0.33 daa # CHECK-NEXT: 1 100 0.33 das # CHECK-NEXT: 1 100 0.33 U into # CHECK-NEXT: 3 7 0.67 * leave # CHECK-NEXT: 1 1 0.33 U salc # CHECK: Resources: # CHECK-NEXT: [0] - SBDivider # CHECK-NEXT: [1] - SBFPDivider # CHECK-NEXT: [2] - SBPort0 # CHECK-NEXT: [3] - SBPort1 # CHECK-NEXT: [4] - SBPort4 # CHECK-NEXT: [5] - SBPort5 # CHECK-NEXT: [6.0] - SBPort23 # CHECK-NEXT: [6.1] - SBPort23 # CHECK: Resource pressure per iteration: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6.0] [6.1] # CHECK-NEXT: - - 4.67 4.67 - 4.67 0.50 0.50 # CHECK: Resource pressure by instruction: # CHECK-NEXT: [0] [1] [2] [3] [4] [5] [6.0] [6.1] Instructions: # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - aaa # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - aad # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - aad $7 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - aam # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - aam $7 # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - aas # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - bound %bx, (%eax) # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - bound %ebx, (%eax) # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - daa # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - das # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - into # CHECK-NEXT: - - 0.67 0.67 - 0.67 0.50 0.50 leave # CHECK-NEXT: - - 0.33 0.33 - 0.33 - - salc
{ "pile_set_name": "Github" }
function cleanimg=deislands3d(img,sizelim) % % cleanimg=deislands3d(img,sizelim) % % remove isolated islands for 3D image (for each slice) % % author: Qianqian Fang (fangq<at> nmr.mgh.harvard.edu) % % input: % img: a 3D volumetric image % sizelim: maximum island size (in pixels) for each x/y/z slice % % output: % cleanimg: 3D image after removing the islands % % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net) % maxisland=-1; if(nargin==2) maxisland=sizelim; end for i=1:size(img,1) if(mod(i,10)==0) fprintf(1,'processing slice x=%d\n',i); end img(i,:,:)=deislands2d(img(i,:,:),maxisland); end for i=1:size(img,2) if(mod(i,10)==0) fprintf(1,'processing slice y=%d\n',i); end img(:,i,:)=deislands2d(img(:,i,:),maxisland); end for i=1:size(img,3) if(mod(i,10)==0) fprintf(1,'processing slice z=%d\n',i); end img(:,:,i)=deislands2d(img(:,:,i),maxisland); end cleanimg=img;
{ "pile_set_name": "Github" }
/* ### * IP: GHIDRA * * 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 ghidra.app.util.bin.format.pdb2.pdbreader.type; import ghidra.app.util.bin.format.pdb2.pdbreader.*; /** * This class represents various flavors of Static Member type. * <P> * Note: we do not necessarily understand each of these data type classes. Refer to the * base class for more information. */ public abstract class AbstractStaticMemberMsType extends AbstractMsType implements MsTypeField { protected ClassFieldMsAttributes attribute; protected RecordNumber fieldTypeRecordNumber; protected String name; /** * Constructor for this type. * @param pdb {@link AbstractPdb} to which this type belongs. * @param reader {@link PdbByteReader} from which this type is deserialized. */ public AbstractStaticMemberMsType(AbstractPdb pdb, PdbByteReader reader) { super(pdb, reader); } @Override public String getName() { return name; } @Override public void emit(StringBuilder builder, Bind bind) { // No API for this. builder.append(name); pdb.getTypeRecord(fieldTypeRecordNumber).emit(builder, Bind.NONE); StringBuilder myBuilder = new StringBuilder(); myBuilder.append(attribute); myBuilder.append(": "); builder.insert(0, myBuilder); } }
{ "pile_set_name": "Github" }
#!/usr/bin/env python import glob import os import sys # usage: parse_peer_log <path-to-libtorrent-peer-logs> log_files = [] for p in glob.iglob(os.path.join(sys.argv[1], '*.log')): name = os.path.split(p)[1] if name == 'main_session.log': continue print name f = open(p, 'r') out_file = p + '.dat' log_files.append(out_file) out = open(out_file, 'w+') uploaded_blocks = 0; downloaded_blocks = 0; for l in f: t = l.split(': ')[0].split('.')[0] log_line = False if ' ==> PIECE' in l: uploaded_blocks+= 1 log_line = True if ' <== PIECE' in l: downloaded_blocks+= 1 log_line = True if log_line: print >>out, '%s\t%d\t%d' % (t, uploaded_blocks, downloaded_blocks) out.close() f.close() out = open('peers.gnuplot', 'wb') print >>out, "set term png size 1200,700" print >>out, 'set xrange [0:*]' print >>out, 'set xlabel "time"' print >>out, 'set ylabel "blocks"' print >>out, 'set key box' print >>out, 'set xdata time' print >>out, 'set timefmt "%H:%M:%S"' print >>out, 'set title "uploaded blocks"' print >>out, 'set output "peers_upload.png"' print >>out, 'plot', first = True for n in log_files: if not first: print >>out, ',', first = False print >>out, ' "%s" using 1:2 title "%s" with steps' % (n, os.path.split(n)[1].split('.log')[0]), print >>out, '' print >>out, 'set title "downloaded blocks"' print >>out, 'set output "peers_download.png"' print >>out, 'plot', first = True for n in log_files: if not first: print >>out, ',', first = False print >>out, ' "%s" using 1:3 title "%s" with steps' % (n, os.path.split(n)[1].split('.log')[0]), print >>out, '' out.close() os.system('gnuplot peers.gnuplot');
{ "pile_set_name": "Github" }
{ "type": "bundle", "id": "bundle--ac3869b9-5a29-40fd-9085-8be10ed7bf2c", "spec_version": "2.0", "objects": [ { "created_by_ref": "identity--c78cb6e5-0c4b-4611-8297-d1b8b55e40b5", "object_marking_refs": [ "marking-definition--fa42a846-8d90-4e51-bc29-71d5b4802168" ], "source_ref": "intrusion-set--32bca8ff-d900-4877-aa65-d70baa041b74", "target_ref": "attack-pattern--58a3e6aa-4453-4cc8-a51f-4befe80b31a8", "external_references": [ { "source_name": "Symantec Leafminer July 2018", "description": "Symantec Security Response. (2018, July 25). Leafminer: New Espionage Campaigns Targeting Middle Eastern Regions. Retrieved August 28, 2018.", "url": "https://www.symantec.com/blogs/threat-intelligence/leafminer-espionage-middle-east" } ], "description": "[Leafminer](https://attack.mitre.org/groups/G0077) used several tools for retrieving login and password information, including LaZagne.(Citation: Symantec Leafminer July 2018)", "relationship_type": "uses", "id": "relationship--5d3f58bf-2192-46f9-bba3-27e917b75df6", "type": "relationship", "modified": "2020-03-19T23:18:35.459Z", "created": "2020-03-19T23:18:35.459Z" } ] }
{ "pile_set_name": "Github" }
//===- AliasSetTracker.cpp - Alias Sets Tracker implementation-------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements the AliasSetTracker and AliasSet classes. // //===----------------------------------------------------------------------===// #include "llvm/Analysis/AliasSetTracker.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/GuardUtils.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/MemoryLocation.h" #include "llvm/Analysis/MemorySSA.h" #include "llvm/Config/llvm-config.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Function.h" #include "llvm/IR/InstIterator.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Module.h" #include "llvm/IR/PatternMatch.h" #include "llvm/IR/Value.h" #include "llvm/InitializePasses.h" #include "llvm/Pass.h" #include "llvm/Support/AtomicOrdering.h" #include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" #include <cassert> #include <cstdint> #include <vector> using namespace llvm; static cl::opt<unsigned> SaturationThreshold("alias-set-saturation-threshold", cl::Hidden, cl::init(250), cl::desc("The maximum number of pointers may-alias " "sets may contain before degradation")); /// mergeSetIn - Merge the specified alias set into this alias set. /// void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST) { assert(!AS.Forward && "Alias set is already forwarding!"); assert(!Forward && "This set is a forwarding set!!"); bool WasMustAlias = (Alias == SetMustAlias); // Update the alias and access types of this set... Access |= AS.Access; Alias |= AS.Alias; if (Alias == SetMustAlias) { // Check that these two merged sets really are must aliases. Since both // used to be must-alias sets, we can just check any pointer from each set // for aliasing. AliasAnalysis &AA = AST.getAliasAnalysis(); PointerRec *L = getSomePointer(); PointerRec *R = AS.getSomePointer(); // If the pointers are not a must-alias pair, this set becomes a may alias. if (AA.alias(MemoryLocation(L->getValue(), L->getSize(), L->getAAInfo()), MemoryLocation(R->getValue(), R->getSize(), R->getAAInfo())) != MustAlias) Alias = SetMayAlias; } if (Alias == SetMayAlias) { if (WasMustAlias) AST.TotalMayAliasSetSize += size(); if (AS.Alias == SetMustAlias) AST.TotalMayAliasSetSize += AS.size(); } bool ASHadUnknownInsts = !AS.UnknownInsts.empty(); if (UnknownInsts.empty()) { // Merge call sites... if (ASHadUnknownInsts) { std::swap(UnknownInsts, AS.UnknownInsts); addRef(); } } else if (ASHadUnknownInsts) { UnknownInsts.insert(UnknownInsts.end(), AS.UnknownInsts.begin(), AS.UnknownInsts.end()); AS.UnknownInsts.clear(); } AS.Forward = this; // Forward across AS now... addRef(); // AS is now pointing to us... // Merge the list of constituent pointers... if (AS.PtrList) { SetSize += AS.size(); AS.SetSize = 0; *PtrListEnd = AS.PtrList; AS.PtrList->setPrevInList(PtrListEnd); PtrListEnd = AS.PtrListEnd; AS.PtrList = nullptr; AS.PtrListEnd = &AS.PtrList; assert(*AS.PtrListEnd == nullptr && "End of list is not null?"); } if (ASHadUnknownInsts) AS.dropRef(AST); } void AliasSetTracker::removeAliasSet(AliasSet *AS) { if (AliasSet *Fwd = AS->Forward) { Fwd->dropRef(*this); AS->Forward = nullptr; } else // Update TotalMayAliasSetSize only if not forwarding. if (AS->Alias == AliasSet::SetMayAlias) TotalMayAliasSetSize -= AS->size(); AliasSets.erase(AS); // If we've removed the saturated alias set, set saturated marker back to // nullptr and ensure this tracker is empty. if (AS == AliasAnyAS) { AliasAnyAS = nullptr; assert(AliasSets.empty() && "Tracker not empty"); } } void AliasSet::removeFromTracker(AliasSetTracker &AST) { assert(RefCount == 0 && "Cannot remove non-dead alias set from tracker!"); AST.removeAliasSet(this); } void AliasSet::addPointer(AliasSetTracker &AST, PointerRec &Entry, LocationSize Size, const AAMDNodes &AAInfo, bool KnownMustAlias, bool SkipSizeUpdate) { assert(!Entry.hasAliasSet() && "Entry already in set!"); // Check to see if we have to downgrade to _may_ alias. if (isMustAlias()) if (PointerRec *P = getSomePointer()) { if (!KnownMustAlias) { AliasAnalysis &AA = AST.getAliasAnalysis(); AliasResult Result = AA.alias( MemoryLocation(P->getValue(), P->getSize(), P->getAAInfo()), MemoryLocation(Entry.getValue(), Size, AAInfo)); if (Result != MustAlias) { Alias = SetMayAlias; AST.TotalMayAliasSetSize += size(); } assert(Result != NoAlias && "Cannot be part of must set!"); } else if (!SkipSizeUpdate) P->updateSizeAndAAInfo(Size, AAInfo); } Entry.setAliasSet(this); Entry.updateSizeAndAAInfo(Size, AAInfo); // Add it to the end of the list... ++SetSize; assert(*PtrListEnd == nullptr && "End of list is not null?"); *PtrListEnd = &Entry; PtrListEnd = Entry.setPrevInList(PtrListEnd); assert(*PtrListEnd == nullptr && "End of list is not null?"); // Entry points to alias set. addRef(); if (Alias == SetMayAlias) AST.TotalMayAliasSetSize++; } void AliasSet::addUnknownInst(Instruction *I, AliasAnalysis &AA) { if (UnknownInsts.empty()) addRef(); UnknownInsts.emplace_back(I); // Guards are marked as modifying memory for control flow modelling purposes, // but don't actually modify any specific memory location. using namespace PatternMatch; bool MayWriteMemory = I->mayWriteToMemory() && !isGuard(I) && !(I->use_empty() && match(I, m_Intrinsic<Intrinsic::invariant_start>())); if (!MayWriteMemory) { Alias = SetMayAlias; Access |= RefAccess; return; } // FIXME: This should use mod/ref information to make this not suck so bad Alias = SetMayAlias; Access = ModRefAccess; } /// aliasesPointer - If the specified pointer "may" (or must) alias one of the /// members in the set return the appropriate AliasResult. Otherwise return /// NoAlias. /// AliasResult AliasSet::aliasesPointer(const Value *Ptr, LocationSize Size, const AAMDNodes &AAInfo, AliasAnalysis &AA) const { if (AliasAny) return MayAlias; if (Alias == SetMustAlias) { assert(UnknownInsts.empty() && "Illegal must alias set!"); // If this is a set of MustAliases, only check to see if the pointer aliases // SOME value in the set. PointerRec *SomePtr = getSomePointer(); assert(SomePtr && "Empty must-alias set??"); return AA.alias(MemoryLocation(SomePtr->getValue(), SomePtr->getSize(), SomePtr->getAAInfo()), MemoryLocation(Ptr, Size, AAInfo)); } // If this is a may-alias set, we have to check all of the pointers in the set // to be sure it doesn't alias the set... for (iterator I = begin(), E = end(); I != E; ++I) if (AliasResult AR = AA.alias( MemoryLocation(Ptr, Size, AAInfo), MemoryLocation(I.getPointer(), I.getSize(), I.getAAInfo()))) return AR; // Check the unknown instructions... if (!UnknownInsts.empty()) { for (unsigned i = 0, e = UnknownInsts.size(); i != e; ++i) if (auto *Inst = getUnknownInst(i)) if (isModOrRefSet( AA.getModRefInfo(Inst, MemoryLocation(Ptr, Size, AAInfo)))) return MayAlias; } return NoAlias; } bool AliasSet::aliasesUnknownInst(const Instruction *Inst, AliasAnalysis &AA) const { if (AliasAny) return true; assert(Inst->mayReadOrWriteMemory() && "Instruction must either read or write memory."); for (unsigned i = 0, e = UnknownInsts.size(); i != e; ++i) { if (auto *UnknownInst = getUnknownInst(i)) { const auto *C1 = dyn_cast<CallBase>(UnknownInst); const auto *C2 = dyn_cast<CallBase>(Inst); if (!C1 || !C2 || isModOrRefSet(AA.getModRefInfo(C1, C2)) || isModOrRefSet(AA.getModRefInfo(C2, C1))) return true; } } for (iterator I = begin(), E = end(); I != E; ++I) if (isModOrRefSet(AA.getModRefInfo( Inst, MemoryLocation(I.getPointer(), I.getSize(), I.getAAInfo())))) return true; return false; } Instruction* AliasSet::getUniqueInstruction() { if (AliasAny) // May have collapses alias set return nullptr; if (begin() != end()) { if (!UnknownInsts.empty()) // Another instruction found return nullptr; if (std::next(begin()) != end()) // Another instruction found return nullptr; Value *Addr = begin()->getValue(); assert(!Addr->user_empty() && "where's the instruction which added this pointer?"); if (std::next(Addr->user_begin()) != Addr->user_end()) // Another instruction found -- this is really restrictive // TODO: generalize! return nullptr; return cast<Instruction>(*(Addr->user_begin())); } if (1 != UnknownInsts.size()) return nullptr; return cast<Instruction>(UnknownInsts[0]); } void AliasSetTracker::clear() { // Delete all the PointerRec entries. for (PointerMapType::iterator I = PointerMap.begin(), E = PointerMap.end(); I != E; ++I) I->second->eraseFromList(); PointerMap.clear(); // The alias sets should all be clear now. AliasSets.clear(); } /// mergeAliasSetsForPointer - Given a pointer, merge all alias sets that may /// alias the pointer. Return the unified set, or nullptr if no set that aliases /// the pointer was found. MustAliasAll is updated to true/false if the pointer /// is found to MustAlias all the sets it merged. AliasSet *AliasSetTracker::mergeAliasSetsForPointer(const Value *Ptr, LocationSize Size, const AAMDNodes &AAInfo, bool &MustAliasAll) { AliasSet *FoundSet = nullptr; AliasResult AllAR = MustAlias; for (iterator I = begin(), E = end(); I != E;) { iterator Cur = I++; if (Cur->Forward) continue; AliasResult AR = Cur->aliasesPointer(Ptr, Size, AAInfo, AA); if (AR == NoAlias) continue; AllAR = AliasResult(AllAR & AR); // Possible downgrade to May/Partial, even No if (!FoundSet) { // If this is the first alias set ptr can go into, remember it. FoundSet = &*Cur; } else { // Otherwise, we must merge the sets. FoundSet->mergeSetIn(*Cur, *this); } } MustAliasAll = (AllAR == MustAlias); return FoundSet; } AliasSet *AliasSetTracker::findAliasSetForUnknownInst(Instruction *Inst) { AliasSet *FoundSet = nullptr; for (iterator I = begin(), E = end(); I != E;) { iterator Cur = I++; if (Cur->Forward || !Cur->aliasesUnknownInst(Inst, AA)) continue; if (!FoundSet) { // If this is the first alias set ptr can go into, remember it. FoundSet = &*Cur; } else { // Otherwise, we must merge the sets. FoundSet->mergeSetIn(*Cur, *this); } } return FoundSet; } AliasSet &AliasSetTracker::getAliasSetFor(const MemoryLocation &MemLoc) { Value * const Pointer = const_cast<Value*>(MemLoc.Ptr); const LocationSize Size = MemLoc.Size; const AAMDNodes &AAInfo = MemLoc.AATags; AliasSet::PointerRec &Entry = getEntryFor(Pointer); if (AliasAnyAS) { // At this point, the AST is saturated, so we only have one active alias // set. That means we already know which alias set we want to return, and // just need to add the pointer to that set to keep the data structure // consistent. // This, of course, means that we will never need a merge here. if (Entry.hasAliasSet()) { Entry.updateSizeAndAAInfo(Size, AAInfo); assert(Entry.getAliasSet(*this) == AliasAnyAS && "Entry in saturated AST must belong to only alias set"); } else { AliasAnyAS->addPointer(*this, Entry, Size, AAInfo); } return *AliasAnyAS; } bool MustAliasAll = false; // Check to see if the pointer is already known. if (Entry.hasAliasSet()) { // If the size changed, we may need to merge several alias sets. // Note that we can *not* return the result of mergeAliasSetsForPointer // due to a quirk of alias analysis behavior. Since alias(undef, undef) // is NoAlias, mergeAliasSetsForPointer(undef, ...) will not find the // the right set for undef, even if it exists. if (Entry.updateSizeAndAAInfo(Size, AAInfo)) mergeAliasSetsForPointer(Pointer, Size, AAInfo, MustAliasAll); // Return the set! return *Entry.getAliasSet(*this)->getForwardedTarget(*this); } if (AliasSet *AS = mergeAliasSetsForPointer(Pointer, Size, AAInfo, MustAliasAll)) { // Add it to the alias set it aliases. AS->addPointer(*this, Entry, Size, AAInfo, MustAliasAll); return *AS; } // Otherwise create a new alias set to hold the loaded pointer. AliasSets.push_back(new AliasSet()); AliasSets.back().addPointer(*this, Entry, Size, AAInfo, true); return AliasSets.back(); } void AliasSetTracker::add(Value *Ptr, LocationSize Size, const AAMDNodes &AAInfo) { addPointer(MemoryLocation(Ptr, Size, AAInfo), AliasSet::NoAccess); } void AliasSetTracker::add(LoadInst *LI) { if (isStrongerThanMonotonic(LI->getOrdering())) return addUnknown(LI); addPointer(MemoryLocation::get(LI), AliasSet::RefAccess); } void AliasSetTracker::add(StoreInst *SI) { if (isStrongerThanMonotonic(SI->getOrdering())) return addUnknown(SI); addPointer(MemoryLocation::get(SI), AliasSet::ModAccess); } void AliasSetTracker::add(VAArgInst *VAAI) { addPointer(MemoryLocation::get(VAAI), AliasSet::ModRefAccess); } void AliasSetTracker::add(AnyMemSetInst *MSI) { addPointer(MemoryLocation::getForDest(MSI), AliasSet::ModAccess); } void AliasSetTracker::add(AnyMemTransferInst *MTI) { addPointer(MemoryLocation::getForDest(MTI), AliasSet::ModAccess); addPointer(MemoryLocation::getForSource(MTI), AliasSet::RefAccess); } void AliasSetTracker::addUnknown(Instruction *Inst) { if (isa<DbgInfoIntrinsic>(Inst)) return; // Ignore DbgInfo Intrinsics. if (auto *II = dyn_cast<IntrinsicInst>(Inst)) { // These intrinsics will show up as affecting memory, but they are just // markers. switch (II->getIntrinsicID()) { default: break; // FIXME: Add lifetime/invariant intrinsics (See: PR30807). case Intrinsic::assume: case Intrinsic::sideeffect: return; } } if (!Inst->mayReadOrWriteMemory()) return; // doesn't alias anything if (AliasSet *AS = findAliasSetForUnknownInst(Inst)) { AS->addUnknownInst(Inst, AA); return; } AliasSets.push_back(new AliasSet()); AliasSets.back().addUnknownInst(Inst, AA); } void AliasSetTracker::add(Instruction *I) { // Dispatch to one of the other add methods. if (LoadInst *LI = dyn_cast<LoadInst>(I)) return add(LI); if (StoreInst *SI = dyn_cast<StoreInst>(I)) return add(SI); if (VAArgInst *VAAI = dyn_cast<VAArgInst>(I)) return add(VAAI); if (AnyMemSetInst *MSI = dyn_cast<AnyMemSetInst>(I)) return add(MSI); if (AnyMemTransferInst *MTI = dyn_cast<AnyMemTransferInst>(I)) return add(MTI); // Handle all calls with known mod/ref sets genericall if (auto *Call = dyn_cast<CallBase>(I)) if (Call->onlyAccessesArgMemory()) { auto getAccessFromModRef = [](ModRefInfo MRI) { if (isRefSet(MRI) && isModSet(MRI)) return AliasSet::ModRefAccess; else if (isModSet(MRI)) return AliasSet::ModAccess; else if (isRefSet(MRI)) return AliasSet::RefAccess; else return AliasSet::NoAccess; }; ModRefInfo CallMask = createModRefInfo(AA.getModRefBehavior(Call)); // Some intrinsics are marked as modifying memory for control flow // modelling purposes, but don't actually modify any specific memory // location. using namespace PatternMatch; if (Call->use_empty() && match(Call, m_Intrinsic<Intrinsic::invariant_start>())) CallMask = clearMod(CallMask); for (auto IdxArgPair : enumerate(Call->args())) { int ArgIdx = IdxArgPair.index(); const Value *Arg = IdxArgPair.value(); if (!Arg->getType()->isPointerTy()) continue; MemoryLocation ArgLoc = MemoryLocation::getForArgument(Call, ArgIdx, nullptr); ModRefInfo ArgMask = AA.getArgModRefInfo(Call, ArgIdx); ArgMask = intersectModRef(CallMask, ArgMask); if (!isNoModRef(ArgMask)) addPointer(ArgLoc, getAccessFromModRef(ArgMask)); } return; } return addUnknown(I); } void AliasSetTracker::add(BasicBlock &BB) { for (auto &I : BB) add(&I); } void AliasSetTracker::add(const AliasSetTracker &AST) { assert(&AA == &AST.AA && "Merging AliasSetTracker objects with different Alias Analyses!"); // Loop over all of the alias sets in AST, adding the pointers contained // therein into the current alias sets. This can cause alias sets to be // merged together in the current AST. for (const AliasSet &AS : AST) { if (AS.Forward) continue; // Ignore forwarding alias sets // If there are any call sites in the alias set, add them to this AST. for (unsigned i = 0, e = AS.UnknownInsts.size(); i != e; ++i) if (auto *Inst = AS.getUnknownInst(i)) add(Inst); // Loop over all of the pointers in this alias set. for (AliasSet::iterator ASI = AS.begin(), E = AS.end(); ASI != E; ++ASI) addPointer( MemoryLocation(ASI.getPointer(), ASI.getSize(), ASI.getAAInfo()), (AliasSet::AccessLattice)AS.Access); } } void AliasSetTracker::addAllInstructionsInLoopUsingMSSA() { assert(MSSA && L && "MSSA and L must be available"); for (const BasicBlock *BB : L->blocks()) if (auto *Accesses = MSSA->getBlockAccesses(BB)) for (auto &Access : *Accesses) if (auto *MUD = dyn_cast<MemoryUseOrDef>(&Access)) add(MUD->getMemoryInst()); } // deleteValue method - This method is used to remove a pointer value from the // AliasSetTracker entirely. It should be used when an instruction is deleted // from the program to update the AST. If you don't use this, you would have // dangling pointers to deleted instructions. // void AliasSetTracker::deleteValue(Value *PtrVal) { // First, look up the PointerRec for this pointer. PointerMapType::iterator I = PointerMap.find_as(PtrVal); if (I == PointerMap.end()) return; // Noop // If we found one, remove the pointer from the alias set it is in. AliasSet::PointerRec *PtrValEnt = I->second; AliasSet *AS = PtrValEnt->getAliasSet(*this); // Unlink and delete from the list of values. PtrValEnt->eraseFromList(); if (AS->Alias == AliasSet::SetMayAlias) { AS->SetSize--; TotalMayAliasSetSize--; } // Stop using the alias set. AS->dropRef(*this); PointerMap.erase(I); } // copyValue - This method should be used whenever a preexisting value in the // program is copied or cloned, introducing a new value. Note that it is ok for // clients that use this method to introduce the same value multiple times: if // the tracker already knows about a value, it will ignore the request. // void AliasSetTracker::copyValue(Value *From, Value *To) { // First, look up the PointerRec for this pointer. PointerMapType::iterator I = PointerMap.find_as(From); if (I == PointerMap.end()) return; // Noop assert(I->second->hasAliasSet() && "Dead entry?"); AliasSet::PointerRec &Entry = getEntryFor(To); if (Entry.hasAliasSet()) return; // Already in the tracker! // getEntryFor above may invalidate iterator \c I, so reinitialize it. I = PointerMap.find_as(From); // Add it to the alias set it aliases... AliasSet *AS = I->second->getAliasSet(*this); AS->addPointer(*this, Entry, I->second->getSize(), I->second->getAAInfo(), true, true); } AliasSet &AliasSetTracker::mergeAllAliasSets() { assert(!AliasAnyAS && (TotalMayAliasSetSize > SaturationThreshold) && "Full merge should happen once, when the saturation threshold is " "reached"); // Collect all alias sets, so that we can drop references with impunity // without worrying about iterator invalidation. std::vector<AliasSet *> ASVector; ASVector.reserve(SaturationThreshold); for (iterator I = begin(), E = end(); I != E; I++) ASVector.push_back(&*I); // Copy all instructions and pointers into a new set, and forward all other // sets to it. AliasSets.push_back(new AliasSet()); AliasAnyAS = &AliasSets.back(); AliasAnyAS->Alias = AliasSet::SetMayAlias; AliasAnyAS->Access = AliasSet::ModRefAccess; AliasAnyAS->AliasAny = true; for (auto Cur : ASVector) { // If Cur was already forwarding, just forward to the new AS instead. AliasSet *FwdTo = Cur->Forward; if (FwdTo) { Cur->Forward = AliasAnyAS; AliasAnyAS->addRef(); FwdTo->dropRef(*this); continue; } // Otherwise, perform the actual merge. AliasAnyAS->mergeSetIn(*Cur, *this); } return *AliasAnyAS; } AliasSet &AliasSetTracker::addPointer(MemoryLocation Loc, AliasSet::AccessLattice E) { AliasSet &AS = getAliasSetFor(Loc); AS.Access |= E; if (!AliasAnyAS && (TotalMayAliasSetSize > SaturationThreshold)) { // The AST is now saturated. From here on, we conservatively consider all // pointers to alias each-other. return mergeAllAliasSets(); } return AS; } //===----------------------------------------------------------------------===// // AliasSet/AliasSetTracker Printing Support //===----------------------------------------------------------------------===// void AliasSet::print(raw_ostream &OS) const { OS << " AliasSet[" << (const void*)this << ", " << RefCount << "] "; OS << (Alias == SetMustAlias ? "must" : "may") << " alias, "; switch (Access) { case NoAccess: OS << "No access "; break; case RefAccess: OS << "Ref "; break; case ModAccess: OS << "Mod "; break; case ModRefAccess: OS << "Mod/Ref "; break; default: llvm_unreachable("Bad value for Access!"); } if (Forward) OS << " forwarding to " << (void*)Forward; if (!empty()) { OS << "Pointers: "; for (iterator I = begin(), E = end(); I != E; ++I) { if (I != begin()) OS << ", "; I.getPointer()->printAsOperand(OS << "("); if (I.getSize() == LocationSize::unknown()) OS << ", unknown)"; else OS << ", " << I.getSize() << ")"; } } if (!UnknownInsts.empty()) { OS << "\n " << UnknownInsts.size() << " Unknown instructions: "; for (unsigned i = 0, e = UnknownInsts.size(); i != e; ++i) { if (i) OS << ", "; if (auto *I = getUnknownInst(i)) { if (I->hasName()) I->printAsOperand(OS); else I->print(OS); } } } OS << "\n"; } void AliasSetTracker::print(raw_ostream &OS) const { OS << "Alias Set Tracker: " << AliasSets.size(); if (AliasAnyAS) OS << " (Saturated)"; OS << " alias sets for " << PointerMap.size() << " pointer values.\n"; for (const AliasSet &AS : *this) AS.print(OS); OS << "\n"; } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void AliasSet::dump() const { print(dbgs()); } LLVM_DUMP_METHOD void AliasSetTracker::dump() const { print(dbgs()); } #endif //===----------------------------------------------------------------------===// // ASTCallbackVH Class Implementation //===----------------------------------------------------------------------===// void AliasSetTracker::ASTCallbackVH::deleted() { assert(AST && "ASTCallbackVH called with a null AliasSetTracker!"); AST->deleteValue(getValPtr()); // this now dangles! } void AliasSetTracker::ASTCallbackVH::allUsesReplacedWith(Value *V) { AST->copyValue(getValPtr(), V); } AliasSetTracker::ASTCallbackVH::ASTCallbackVH(Value *V, AliasSetTracker *ast) : CallbackVH(V), AST(ast) {} AliasSetTracker::ASTCallbackVH & AliasSetTracker::ASTCallbackVH::operator=(Value *V) { return *this = ASTCallbackVH(V, AST); } //===----------------------------------------------------------------------===// // AliasSetPrinter Pass //===----------------------------------------------------------------------===// namespace { class AliasSetPrinter : public FunctionPass { AliasSetTracker *Tracker; public: static char ID; // Pass identification, replacement for typeid AliasSetPrinter() : FunctionPass(ID) { initializeAliasSetPrinterPass(*PassRegistry::getPassRegistry()); } void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); AU.addRequired<AAResultsWrapperPass>(); } bool runOnFunction(Function &F) override { auto &AAWP = getAnalysis<AAResultsWrapperPass>(); Tracker = new AliasSetTracker(AAWP.getAAResults()); errs() << "Alias sets for function '" << F.getName() << "':\n"; for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) Tracker->add(&*I); Tracker->print(errs()); delete Tracker; return false; } }; } // end anonymous namespace char AliasSetPrinter::ID = 0; INITIALIZE_PASS_BEGIN(AliasSetPrinter, "print-alias-sets", "Alias Set Printer", false, true) INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass) INITIALIZE_PASS_END(AliasSetPrinter, "print-alias-sets", "Alias Set Printer", false, true)
{ "pile_set_name": "Github" }
/* * sst.c - Intel SST Driver for audio engine * * Copyright (C) 2008-14 Intel Corp * Authors: Vinod Koul <[email protected]> * Harsha Priya <[email protected]> * Dharageswari R <[email protected]> * KP Jeeja <[email protected]> * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #include <linux/module.h> #include <linux/fs.h> #include <linux/interrupt.h> #include <linux/firmware.h> #include <linux/pm_runtime.h> #include <linux/pm_qos.h> #include <linux/async.h> #include <linux/acpi.h> #include <sound/core.h> #include <sound/soc.h> #include <asm/platform_sst_audio.h> #include "../sst-mfld-platform.h" #include "sst.h" #include "../../common/sst-dsp.h" MODULE_AUTHOR("Vinod Koul <[email protected]>"); MODULE_AUTHOR("Harsha Priya <[email protected]>"); MODULE_DESCRIPTION("Intel (R) SST(R) Audio Engine Driver"); MODULE_LICENSE("GPL v2"); static inline bool sst_is_process_reply(u32 msg_id) { return ((msg_id & PROCESS_MSG) ? true : false); } static inline bool sst_validate_mailbox_size(unsigned int size) { return ((size <= SST_MAILBOX_SIZE) ? true : false); } static irqreturn_t intel_sst_interrupt_mrfld(int irq, void *context) { union interrupt_reg_mrfld isr; union ipc_header_mrfld header; union sst_imr_reg_mrfld imr; struct ipc_post *msg = NULL; unsigned int size = 0; struct intel_sst_drv *drv = (struct intel_sst_drv *) context; irqreturn_t retval = IRQ_HANDLED; /* Interrupt arrived, check src */ isr.full = sst_shim_read64(drv->shim, SST_ISRX); if (isr.part.done_interrupt) { /* Clear done bit */ spin_lock(&drv->ipc_spin_lock); header.full = sst_shim_read64(drv->shim, drv->ipc_reg.ipcx); header.p.header_high.part.done = 0; sst_shim_write64(drv->shim, drv->ipc_reg.ipcx, header.full); /* write 1 to clear status register */; isr.part.done_interrupt = 1; sst_shim_write64(drv->shim, SST_ISRX, isr.full); spin_unlock(&drv->ipc_spin_lock); /* we can send more messages to DSP so trigger work */ queue_work(drv->post_msg_wq, &drv->ipc_post_msg_wq); retval = IRQ_HANDLED; } if (isr.part.busy_interrupt) { /* message from dsp so copy that */ spin_lock(&drv->ipc_spin_lock); imr.full = sst_shim_read64(drv->shim, SST_IMRX); imr.part.busy_interrupt = 1; sst_shim_write64(drv->shim, SST_IMRX, imr.full); spin_unlock(&drv->ipc_spin_lock); header.full = sst_shim_read64(drv->shim, drv->ipc_reg.ipcd); if (sst_create_ipc_msg(&msg, header.p.header_high.part.large)) { drv->ops->clear_interrupt(drv); return IRQ_HANDLED; } if (header.p.header_high.part.large) { size = header.p.header_low_payload; if (sst_validate_mailbox_size(size)) { memcpy_fromio(msg->mailbox_data, drv->mailbox + drv->mailbox_recv_offset, size); } else { dev_err(drv->dev, "Mailbox not copied, payload size is: %u\n", size); header.p.header_low_payload = 0; } } msg->mrfld_header = header; msg->is_process_reply = sst_is_process_reply(header.p.header_high.part.msg_id); spin_lock(&drv->rx_msg_lock); list_add_tail(&msg->node, &drv->rx_list); spin_unlock(&drv->rx_msg_lock); drv->ops->clear_interrupt(drv); retval = IRQ_WAKE_THREAD; } return retval; } static irqreturn_t intel_sst_irq_thread_mrfld(int irq, void *context) { struct intel_sst_drv *drv = (struct intel_sst_drv *) context; struct ipc_post *__msg, *msg = NULL; unsigned long irq_flags; spin_lock_irqsave(&drv->rx_msg_lock, irq_flags); if (list_empty(&drv->rx_list)) { spin_unlock_irqrestore(&drv->rx_msg_lock, irq_flags); return IRQ_HANDLED; } list_for_each_entry_safe(msg, __msg, &drv->rx_list, node) { list_del(&msg->node); spin_unlock_irqrestore(&drv->rx_msg_lock, irq_flags); if (msg->is_process_reply) drv->ops->process_message(msg); else drv->ops->process_reply(drv, msg); if (msg->is_large) kfree(msg->mailbox_data); kfree(msg); spin_lock_irqsave(&drv->rx_msg_lock, irq_flags); } spin_unlock_irqrestore(&drv->rx_msg_lock, irq_flags); return IRQ_HANDLED; } static int sst_save_dsp_context_v2(struct intel_sst_drv *sst) { int ret = 0; ret = sst_prepare_and_post_msg(sst, SST_TASK_ID_MEDIA, IPC_CMD, IPC_PREP_D3, PIPE_RSVD, 0, NULL, NULL, true, true, false, true); if (ret < 0) { dev_err(sst->dev, "not suspending FW!!, Err: %d\n", ret); return -EIO; } return 0; } static struct intel_sst_ops mrfld_ops = { .interrupt = intel_sst_interrupt_mrfld, .irq_thread = intel_sst_irq_thread_mrfld, .clear_interrupt = intel_sst_clear_intr_mrfld, .start = sst_start_mrfld, .reset = intel_sst_reset_dsp_mrfld, .post_message = sst_post_message_mrfld, .process_reply = sst_process_reply_mrfld, .save_dsp_context = sst_save_dsp_context_v2, .alloc_stream = sst_alloc_stream_mrfld, .post_download = sst_post_download_mrfld, }; int sst_driver_ops(struct intel_sst_drv *sst) { switch (sst->dev_id) { case SST_MRFLD_PCI_ID: case SST_BYT_ACPI_ID: case SST_CHV_ACPI_ID: sst->tstamp = SST_TIME_STAMP_MRFLD; sst->ops = &mrfld_ops; return 0; default: dev_err(sst->dev, "SST Driver capablities missing for dev_id: %x", sst->dev_id); return -EINVAL; }; } void sst_process_pending_msg(struct work_struct *work) { struct intel_sst_drv *ctx = container_of(work, struct intel_sst_drv, ipc_post_msg_wq); ctx->ops->post_message(ctx, NULL, false); } static int sst_workqueue_init(struct intel_sst_drv *ctx) { INIT_LIST_HEAD(&ctx->memcpy_list); INIT_LIST_HEAD(&ctx->rx_list); INIT_LIST_HEAD(&ctx->ipc_dispatch_list); INIT_LIST_HEAD(&ctx->block_list); INIT_WORK(&ctx->ipc_post_msg_wq, sst_process_pending_msg); init_waitqueue_head(&ctx->wait_queue); ctx->post_msg_wq = create_singlethread_workqueue("sst_post_msg_wq"); if (!ctx->post_msg_wq) return -EBUSY; return 0; } static void sst_init_locks(struct intel_sst_drv *ctx) { mutex_init(&ctx->sst_lock); spin_lock_init(&ctx->rx_msg_lock); spin_lock_init(&ctx->ipc_spin_lock); spin_lock_init(&ctx->block_lock); } int sst_alloc_drv_context(struct intel_sst_drv **ctx, struct device *dev, unsigned int dev_id) { *ctx = devm_kzalloc(dev, sizeof(struct intel_sst_drv), GFP_KERNEL); if (!(*ctx)) return -ENOMEM; (*ctx)->dev = dev; (*ctx)->dev_id = dev_id; return 0; } EXPORT_SYMBOL_GPL(sst_alloc_drv_context); int sst_context_init(struct intel_sst_drv *ctx) { int ret = 0, i; if (!ctx->pdata) return -EINVAL; if (!ctx->pdata->probe_data) return -EINVAL; memcpy(&ctx->info, ctx->pdata->probe_data, sizeof(ctx->info)); ret = sst_driver_ops(ctx); if (ret != 0) return -EINVAL; sst_init_locks(ctx); sst_set_fw_state_locked(ctx, SST_RESET); /* pvt_id 0 reserved for async messages */ ctx->pvt_id = 1; ctx->stream_cnt = 0; ctx->fw_in_mem = NULL; /* we use memcpy, so set to 0 */ ctx->use_dma = 0; ctx->use_lli = 0; if (sst_workqueue_init(ctx)) return -EINVAL; ctx->mailbox_recv_offset = ctx->pdata->ipc_info->mbox_recv_off; ctx->ipc_reg.ipcx = SST_IPCX + ctx->pdata->ipc_info->ipc_offset; ctx->ipc_reg.ipcd = SST_IPCD + ctx->pdata->ipc_info->ipc_offset; dev_info(ctx->dev, "Got drv data max stream %d\n", ctx->info.max_streams); for (i = 1; i <= ctx->info.max_streams; i++) { struct stream_info *stream = &ctx->streams[i]; memset(stream, 0, sizeof(*stream)); stream->pipe_id = PIPE_RSVD; mutex_init(&stream->lock); } /* Register the ISR */ ret = devm_request_threaded_irq(ctx->dev, ctx->irq_num, ctx->ops->interrupt, ctx->ops->irq_thread, 0, SST_DRV_NAME, ctx); if (ret) goto do_free_mem; dev_dbg(ctx->dev, "Registered IRQ %#x\n", ctx->irq_num); /* default intr are unmasked so set this as masked */ sst_shim_write64(ctx->shim, SST_IMRX, 0xFFFF0038); ctx->qos = devm_kzalloc(ctx->dev, sizeof(struct pm_qos_request), GFP_KERNEL); if (!ctx->qos) { ret = -ENOMEM; goto do_free_mem; } pm_qos_add_request(ctx->qos, PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE); dev_dbg(ctx->dev, "Requesting FW %s now...\n", ctx->firmware_name); ret = request_firmware_nowait(THIS_MODULE, true, ctx->firmware_name, ctx->dev, GFP_KERNEL, ctx, sst_firmware_load_cb); if (ret) { dev_err(ctx->dev, "Firmware download failed:%d\n", ret); goto do_free_mem; } sst_register(ctx->dev); return 0; do_free_mem: destroy_workqueue(ctx->post_msg_wq); return ret; } EXPORT_SYMBOL_GPL(sst_context_init); void sst_context_cleanup(struct intel_sst_drv *ctx) { pm_runtime_get_noresume(ctx->dev); pm_runtime_disable(ctx->dev); sst_unregister(ctx->dev); sst_set_fw_state_locked(ctx, SST_SHUTDOWN); flush_scheduled_work(); destroy_workqueue(ctx->post_msg_wq); pm_qos_remove_request(ctx->qos); kfree(ctx->fw_sg_list.src); kfree(ctx->fw_sg_list.dst); ctx->fw_sg_list.list_len = 0; kfree(ctx->fw_in_mem); ctx->fw_in_mem = NULL; sst_memcpy_free_resources(ctx); ctx = NULL; } EXPORT_SYMBOL_GPL(sst_context_cleanup); static inline void sst_save_shim64(struct intel_sst_drv *ctx, void __iomem *shim, struct sst_shim_regs64 *shim_regs) { unsigned long irq_flags; spin_lock_irqsave(&ctx->ipc_spin_lock, irq_flags); shim_regs->imrx = sst_shim_read64(shim, SST_IMRX); shim_regs->csr = sst_shim_read64(shim, SST_CSR); spin_unlock_irqrestore(&ctx->ipc_spin_lock, irq_flags); } static inline void sst_restore_shim64(struct intel_sst_drv *ctx, void __iomem *shim, struct sst_shim_regs64 *shim_regs) { unsigned long irq_flags; /* * we only need to restore IMRX for this case, rest will be * initialize by FW or driver when firmware is loaded */ spin_lock_irqsave(&ctx->ipc_spin_lock, irq_flags); sst_shim_write64(shim, SST_IMRX, shim_regs->imrx); sst_shim_write64(shim, SST_CSR, shim_regs->csr); spin_unlock_irqrestore(&ctx->ipc_spin_lock, irq_flags); } void sst_configure_runtime_pm(struct intel_sst_drv *ctx) { pm_runtime_set_autosuspend_delay(ctx->dev, SST_SUSPEND_DELAY); pm_runtime_use_autosuspend(ctx->dev); /* * For acpi devices, the actual physical device state is * initially active. So change the state to active before * enabling the pm */ if (!acpi_disabled) pm_runtime_set_active(ctx->dev); pm_runtime_enable(ctx->dev); if (acpi_disabled) pm_runtime_set_active(ctx->dev); else pm_runtime_put_noidle(ctx->dev); sst_save_shim64(ctx, ctx->shim, ctx->shim_regs64); } EXPORT_SYMBOL_GPL(sst_configure_runtime_pm); static int intel_sst_runtime_suspend(struct device *dev) { int ret = 0; struct intel_sst_drv *ctx = dev_get_drvdata(dev); if (ctx->sst_state == SST_RESET) { dev_dbg(dev, "LPE is already in RESET state, No action\n"); return 0; } /* save fw context */ if (ctx->ops->save_dsp_context(ctx)) return -EBUSY; /* Move the SST state to Reset */ sst_set_fw_state_locked(ctx, SST_RESET); synchronize_irq(ctx->irq_num); flush_workqueue(ctx->post_msg_wq); ctx->ops->reset(ctx); /* save the shim registers because PMC doesn't save state */ sst_save_shim64(ctx, ctx->shim, ctx->shim_regs64); return ret; } static int intel_sst_suspend(struct device *dev) { struct intel_sst_drv *ctx = dev_get_drvdata(dev); struct sst_fw_save *fw_save; int i, ret = 0; /* check first if we are already in SW reset */ if (ctx->sst_state == SST_RESET) return 0; /* * check if any stream is active and running * they should already by suspend by soc_suspend */ for (i = 1; i <= ctx->info.max_streams; i++) { struct stream_info *stream = &ctx->streams[i]; if (stream->status == STREAM_RUNNING) { dev_err(dev, "stream %d is running, cant susupend, abort\n", i); return -EBUSY; } } synchronize_irq(ctx->irq_num); flush_workqueue(ctx->post_msg_wq); /* Move the SST state to Reset */ sst_set_fw_state_locked(ctx, SST_RESET); /* tell DSP we are suspending */ if (ctx->ops->save_dsp_context(ctx)) return -EBUSY; /* save the memories */ fw_save = kzalloc(sizeof(*fw_save), GFP_KERNEL); if (!fw_save) return -ENOMEM; fw_save->iram = kzalloc(ctx->iram_end - ctx->iram_base, GFP_KERNEL); if (!fw_save->iram) { ret = -ENOMEM; goto iram; } fw_save->dram = kzalloc(ctx->dram_end - ctx->dram_base, GFP_KERNEL); if (!fw_save->dram) { ret = -ENOMEM; goto dram; } fw_save->sram = kzalloc(SST_MAILBOX_SIZE, GFP_KERNEL); if (!fw_save->sram) { ret = -ENOMEM; goto sram; } fw_save->ddr = kzalloc(ctx->ddr_end - ctx->ddr_base, GFP_KERNEL); if (!fw_save->ddr) { ret = -ENOMEM; goto ddr; } memcpy32_fromio(fw_save->iram, ctx->iram, ctx->iram_end - ctx->iram_base); memcpy32_fromio(fw_save->dram, ctx->dram, ctx->dram_end - ctx->dram_base); memcpy32_fromio(fw_save->sram, ctx->mailbox, SST_MAILBOX_SIZE); memcpy32_fromio(fw_save->ddr, ctx->ddr, ctx->ddr_end - ctx->ddr_base); ctx->fw_save = fw_save; ctx->ops->reset(ctx); return 0; ddr: kfree(fw_save->sram); sram: kfree(fw_save->dram); dram: kfree(fw_save->iram); iram: kfree(fw_save); return ret; } static int intel_sst_resume(struct device *dev) { struct intel_sst_drv *ctx = dev_get_drvdata(dev); struct sst_fw_save *fw_save = ctx->fw_save; int ret = 0; struct sst_block *block; if (!fw_save) return 0; sst_set_fw_state_locked(ctx, SST_FW_LOADING); /* we have to restore the memory saved */ ctx->ops->reset(ctx); ctx->fw_save = NULL; memcpy32_toio(ctx->iram, fw_save->iram, ctx->iram_end - ctx->iram_base); memcpy32_toio(ctx->dram, fw_save->dram, ctx->dram_end - ctx->dram_base); memcpy32_toio(ctx->mailbox, fw_save->sram, SST_MAILBOX_SIZE); memcpy32_toio(ctx->ddr, fw_save->ddr, ctx->ddr_end - ctx->ddr_base); kfree(fw_save->sram); kfree(fw_save->dram); kfree(fw_save->iram); kfree(fw_save->ddr); kfree(fw_save); block = sst_create_block(ctx, 0, FW_DWNL_ID); if (block == NULL) return -ENOMEM; /* start and wait for ack */ ctx->ops->start(ctx); ret = sst_wait_timeout(ctx, block); if (ret) { dev_err(ctx->dev, "fw download failed %d\n", ret); /* FW download failed due to timeout */ ret = -EBUSY; } else { sst_set_fw_state_locked(ctx, SST_FW_RUNNING); } sst_free_block(ctx, block); return ret; } const struct dev_pm_ops intel_sst_pm = { .suspend = intel_sst_suspend, .resume = intel_sst_resume, .runtime_suspend = intel_sst_runtime_suspend, }; EXPORT_SYMBOL_GPL(intel_sst_pm);
{ "pile_set_name": "Github" }
/* -*- Mode: js; js-indent-level: 2; -*- */ /////////////////////////////////////////////////////////////////////////////// this.sourceMap = { SourceMapConsumer: require('source-map/source-map-consumer').SourceMapConsumer, SourceMapGenerator: require('source-map/source-map-generator').SourceMapGenerator, SourceNode: require('source-map/source-node').SourceNode };
{ "pile_set_name": "Github" }
#include "graph_algorithm/plugin_graph_algorithm.h" #include "hal_core/utilities/log.h" namespace hal { extern std::unique_ptr<BasePluginInterface> create_plugin_instance() { return std::make_unique<plugin_graph_algorithm>(); } std::string plugin_graph_algorithm::get_name() const { return std::string("graph_algorithm"); } std::string plugin_graph_algorithm::get_version() const { return std::string("0.1"); } } // namespace hal
{ "pile_set_name": "Github" }
from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, Optional, Tuple, Union import opentracing from django.conf import settings from prices import MoneyRange, TaxedMoney, TaxedMoneyRange from saleor.product.models import Collection, Product, ProductVariant from ...core.utils import to_local_currency from ...discount import DiscountInfo from ...discount.utils import calculate_discounted_price from ...plugins.manager import get_plugins_manager from ...warehouse.availability import ( are_all_product_variants_in_stock, is_product_in_stock, ) from .. import ProductAvailabilityStatus if TYPE_CHECKING: # flake8: noqa from ...plugins.manager import PluginsManager @dataclass class ProductAvailability: on_sale: bool price_range: Optional[TaxedMoneyRange] price_range_undiscounted: Optional[TaxedMoneyRange] discount: Optional[TaxedMoney] price_range_local_currency: Optional[TaxedMoneyRange] discount_local_currency: Optional[TaxedMoneyRange] @dataclass class VariantAvailability: on_sale: bool price: TaxedMoney price_undiscounted: TaxedMoney discount: Optional[TaxedMoney] price_local_currency: Optional[TaxedMoney] discount_local_currency: Optional[TaxedMoney] def get_product_availability_status( product: "Product", country: str ) -> ProductAvailabilityStatus: is_visible = product.is_visible are_all_variants_in_stock = are_all_product_variants_in_stock(product, country) is_in_stock = is_product_in_stock(product, country) requires_variants = product.product_type.has_variants if not product.is_published: return ProductAvailabilityStatus.NOT_PUBLISHED if requires_variants and not product.variants.exists(): # We check the requires_variants flag here in order to not show this # status with product types that don't require variants, as in that # case variants are hidden from the UI and user doesn't manage them. return ProductAvailabilityStatus.VARIANTS_MISSSING if not is_in_stock: return ProductAvailabilityStatus.OUT_OF_STOCK if not are_all_variants_in_stock: return ProductAvailabilityStatus.LOW_STOCK if not is_visible and product.publication_date is not None: return ProductAvailabilityStatus.NOT_YET_AVAILABLE return ProductAvailabilityStatus.READY_FOR_PURCHASE def _get_total_discount_from_range( undiscounted: TaxedMoneyRange, discounted: TaxedMoneyRange ) -> Optional[TaxedMoney]: """Calculate the discount amount between two TaxedMoneyRange. Subtract two prices and return their total discount, if any. Otherwise, it returns None. """ return _get_total_discount(undiscounted.start, discounted.start) def _get_total_discount( undiscounted: TaxedMoney, discounted: TaxedMoney ) -> Optional[TaxedMoney]: """Calculate the discount amount between two TaxedMoney. Subtract two prices and return their total discount, if any. Otherwise, it returns None. """ if undiscounted > discounted: return undiscounted - discounted return None def _get_product_price_range( discounted: Union[MoneyRange, TaxedMoneyRange], undiscounted: Union[MoneyRange, TaxedMoneyRange], local_currency: Optional[str] = None, ) -> Tuple[TaxedMoneyRange, TaxedMoney]: price_range_local = None discount_local_currency = None if local_currency: price_range_local = to_local_currency(discounted, local_currency) undiscounted_local = to_local_currency(undiscounted, local_currency) if undiscounted_local and undiscounted_local.start > price_range_local.start: discount_local_currency = undiscounted_local.start - price_range_local.start return price_range_local, discount_local_currency def get_variant_price( *, variant: ProductVariant, product: Product, collections: Iterable[Collection], discounts: Iterable[DiscountInfo] ): return calculate_discounted_price( product=product, price=variant.price, collections=collections, discounts=discounts, ) def get_product_price_range( *, product: Product, variants: Iterable[ProductVariant], collections: Iterable[Collection], discounts: Iterable[DiscountInfo] ) -> Optional[MoneyRange]: with opentracing.global_tracer().start_active_span("get_product_price_range"): if variants: prices = [ get_variant_price( variant=variant, product=product, collections=collections, discounts=discounts, ) for variant in variants ] return MoneyRange(min(prices), max(prices)) return None def get_product_availability( *, product: Product, variants: Iterable[ProductVariant], collections: Iterable[Collection], discounts: Iterable[DiscountInfo], country: Optional[str] = None, local_currency: Optional[str] = None, plugins: Optional["PluginsManager"] = None, ) -> ProductAvailability: with opentracing.global_tracer().start_active_span("get_product_availability"): if not plugins: plugins = get_plugins_manager() discounted = None discounted_net_range = get_product_price_range( product=product, variants=variants, collections=collections, discounts=discounts, ) if discounted_net_range is not None: discounted = TaxedMoneyRange( start=plugins.apply_taxes_to_product( product, discounted_net_range.start, country ), stop=plugins.apply_taxes_to_product( product, discounted_net_range.stop, country ), ) undiscounted = None undiscounted_net_range = get_product_price_range( product=product, variants=variants, collections=collections, discounts=[] ) if undiscounted_net_range is not None: undiscounted = TaxedMoneyRange( start=plugins.apply_taxes_to_product( product, undiscounted_net_range.start, country ), stop=plugins.apply_taxes_to_product( product, undiscounted_net_range.stop, country ), ) discount = None price_range_local = None discount_local_currency = None if undiscounted_net_range is not None and discounted_net_range is not None: discount = _get_total_discount_from_range(undiscounted, discounted) price_range_local, discount_local_currency = _get_product_price_range( discounted, undiscounted, local_currency ) is_on_sale = product.is_visible and discount is not None return ProductAvailability( on_sale=is_on_sale, price_range=discounted, price_range_undiscounted=undiscounted, discount=discount, price_range_local_currency=price_range_local, discount_local_currency=discount_local_currency, ) def get_variant_availability( variant: ProductVariant, product: Product, collections: Iterable[Collection], discounts: Iterable[DiscountInfo], country: Optional[str] = None, local_currency: Optional[str] = None, plugins: Optional["PluginsManager"] = None, ) -> VariantAvailability: with opentracing.global_tracer().start_active_span("get_variant_availability"): if not plugins: plugins = get_plugins_manager() discounted = plugins.apply_taxes_to_product( product, get_variant_price( variant=variant, product=product, collections=collections, discounts=discounts, ), country, ) undiscounted = plugins.apply_taxes_to_product( product, get_variant_price( variant=variant, product=product, collections=collections, discounts=[] ), country, ) discount = _get_total_discount(undiscounted, discounted) if country is None: country = settings.DEFAULT_COUNTRY if local_currency: price_local_currency = to_local_currency(discounted, local_currency) discount_local_currency = to_local_currency(discount, local_currency) else: price_local_currency = None discount_local_currency = None is_on_sale = product.is_visible and discount is not None return VariantAvailability( on_sale=is_on_sale, price=discounted, price_undiscounted=undiscounted, discount=discount, price_local_currency=price_local_currency, discount_local_currency=discount_local_currency, )
{ "pile_set_name": "Github" }
/* Github Theme Updater */ .plugin-update-tr .update-message-gtu { font-weight:bold; margin:5px; padding:3px 5px; border-width:1px; border-style:solid; -moz-border-radius:5px; -khtml-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; background:#fffbe4; background:-moz-linear-gradient(bottom, #FFEFDC, #FFFCEC); background:-webkit-gradient(linear, left bottom, left top, from(#FFEFDC), to(#FFFCEC)); border-color:#D7CBBB; } .plugin-update-tr .update-error { border-color:#B89FA0; background: #D7C3C4; background:-moz-linear-gradient(bottom, #D7C3C4, #FFEAEA); background:-webkit-gradient(linear, left bottom, left top, from(#D7C3C4), to(#FFEAEA)); color:#650000; } .plugin-update-tr .update-error a { color: #650000; text-decoration:underline; } .plugin-update-tr .update-error .error { color:#BC0B0B; } .plugin-update-tr .update-ok { font-weight:normal; border-color:#B0C5B3; background: #CBD8CC; background:-moz-linear-gradient(bottom, #CBD6CC, #F5FFF6); background:-webkit-gradient(linear, left bottom, left top, from(#CBD6CC), to(#F5FFF6)); } .plugin-update-tr .update-ok a { font-weight:bold; }
{ "pile_set_name": "Github" }
#!/bin/bash # exit with nonzero exit code if anything fails set -e # Get the current branch name CURRENT_BRANCH=`git symbolic-ref -q --short HEAD` IS_SSH=`git remote get-url origin | grep -qE '^git'; echo $?` REMOTE=`[ "$IS_SSH" = "0" ] && echo "[email protected]:appnexus/lucid.git" || echo "https://github.com/appnexus/lucid.git"` # Only run this script if we're on `master` if [ "$CURRENT_BRANCH" = "master" ]; then cd ./dist/docs git init # The first and only commit to this new Git repo contains all the # files present with the commit message "Deploy to GitHub Pages". git add . git commit -m "Deploy to GitHub Pages" # Force push from the current repo's master branch to the remote # repo's gh-pages branch. (All previous history on the gh-pages branch # will be lost, since we are overwriting it.) We redirect any output to # /dev/null to hide any sensitive credential data that might otherwise be exposed. git push --force --quiet "$REMOTE" master:gh-pages > /dev/null 2>&1 fi
{ "pile_set_name": "Github" }
const baseConfig = require('../../jest/base.config.js') const { name } = require('./package') module.exports = { ...baseConfig, displayName: name, name: name, testMatch: [`${__dirname}/**/*/?(*.)+(spec|test).js`] }
{ "pile_set_name": "Github" }
# Feature Engineering ## General + [Basic Feature Engineering With Time Series Data in Python](http://machinelearningmastery.com/basic-feature-engineering-time-series-data-python/) + [Zillow Prize - EDA, Data Cleaning & Feature Engineering](https://www.kaggle.com/lauracozma/eda-data-cleaning-feature-engineering) + [Feature-wise transformations](https://distill.pub/2018/feature-wise-transformations) + [tsfresh](https://tsfresh.readthedocs.io/en/latest/text/introduction.html) - tsfresh is used to to extract characteristics from time series + [featuretools](https://github.com/featuretools/featuretools/) - an open source python framework for automated feature engineering + [5 Steps to correctly prepare your data for your machine learning model](https://towardsdatascience.com/5-steps-to-correctly-prep-your-data-for-your-machine-learning-model-c06c24762b73?gi=6b4a6895ab1) + [scikit learn's SelectKBest](https://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.SelectKBest.html) + [mlbox's Feature selection](https://mlbox.readthedocs.io/en/latest/features.html) + Chi2 test: Feature selection: [Quora](https://www.quora.com/How-is-chi-test-used-for-feature-selection-in-machine-learning) | [NLP Stanford Group](https://nlp.stanford.edu/IR-book/html/htmledition/feature-selectionchi2-feature-selection-1.html) | [Learn for Master](http://www.learn4master.com/machine-learning/chi-square-test-for-feature-selection) + [Accelerating TSNE with GPUs: From hours to seconds](https://www.linkedin.com/posts/montrealai_machinelearning-datavisualization-datascience-activity-6628828524566331392-Cua_) + [Feature Engineering and Feature Selection](https://media.licdn.com/dms/document/C511FAQF45u2wk4WYKQ/feedshare-document-pdf-analyzed/0?e=1570834800&v=beta&t=lNVqtm3JJYvvPHpsl0uc6mZJjVGWgJ8Toz29tNJA4GI) [deadlink] + [Hands-on Guide to Automated Feature Engineering - Prateek Joshi](https://www.linkedin.com/posts/vipulppatel_hands-on-guide-to-automated-feature-engineering-ugcPost-6612564773705924608-Utyb) + [Feature Engineering and Selection](https://www.linkedin.com/posts/nabihbawazir_feature-engineering-and-selection-ugcPost-6603534412548280320-XTIX) + [What is feature engineering and why do we need it?](https://www.linkedin.com/posts/srivatsan-srinivasan-b8131b_datascience-machinelearning-ml-activity-6623556433189363712-O7c4) + [FEATURE-ENGINE: AN OPEN SOURCE PYTHON PACKAGE TO CREATE REPRODUCIBLE FEATURE ENGINEERING STEPS AND SMOOTH MODEL DEPLOYMENT](https://www.trainindata.com/feature-engine) + [Feature Engineering with Tidyverse](https://www.datasciencecentral.com/profiles/blogs/feature-engineering-with-tidyverse) [LinkedIn Post](https://www.linkedin.com/posts/data-science-central_feature-engineering-with-tidyverse-activity-6645714064209166337-4szB) + [ML topics expanded by Chris Albon](https://chrisalbon.com/#machine_learning) - look for topics: Feature Engineering • Feature Selection + [Feature Engineering: Data scientist's Secret Sauce](https://www.linkedin.com/posts/vincentg_feature-engineering-data-scientists-secret-activity-6657351483786358784-L7Mc) - [Python Feature Engineering Cookbook by Dr Soledad Galli](https://www.linkedin.com/posts/ajitjaokar_python-feature-engineering-cookbook-activity-6671226001567100928-Wfxn) - [How to Use Polynomial Feature Transforms for Machine Learning](https://machinelearningmastery.com/polynomial-features-transforms-for-machine-learning/) - [Transforming Quantitative Data to Qualitative Data](https://www.linkedin.com/feed/update/urn:li:activity:6674858845854019584/) ## Dimensionality Reduction - [Feature engineering and Dimensionality reduction](https://towardsdatascience.com/dimensionality-reduction-for-machine-learning-80a46c2ebb7e) - [Seven Techniques for Data Dimensionality Reduction](https://www.kdnuggets.com/2015/05/7-methods-data-dimensionality-reduction.html) - [Linear Discriminant Analysis is a simple yet intuitive technique. At it's first description it is very similar to PCA. In PCA to find the eigen value and eigen factors we use covariance matrix](https://www.youtube.com/watch?v=D2HArUvOQaw&feature=youtu.be) | [Other PCA tutorials](https://youtu.be/D2HArUvOQaw) - [Principal Component Analysis for Dimensionality Reduction in Python](https://www.linkedin.com/posts/jasonbrownlee_principal-component-analysis-for-dimensionality-activity-6664240738139799552-gCqp) - Principal Component Analysis is a beautiful tool: [original thread](https://www.facebook.com/groups/mathfordatascience/permalink/1178371322496956/?__cft__[0]=AZUKcr9SXK7J6g5tJgW9ItNFc6z7qNJWmThqcyh-aCjwjRrVJ6ecPBdFIRUwOCLXNAnOf5W9v1-ZlKaLjeJ4bo1wH2mYXLTCOBcAvjy5_JL7ggNubGZoApyTcHjXdeA0j4wTGNcjdbtfd0xoPdBjkRCJ5nbXGlpQm_lpwkcfIusz8g&__tn__=%2CO%2CP-R) | [video](https://www.youtube.com/watch?v=otv4AUIp9HQ&feature=youtu.be) - [Lecture 38 Principal Component Analysis](https://www.youtube.com/watch?v=C6fH5Nfoj40&feature=youtu.be) - Kernel PCA methods - Notable papers are: - [Nonlinear Component Analysis as a Kernel Eigenvalue Problem](https://www.face-rec.org/algorithms/Kernel/kernelPCA_scholkopf.pdf) - [Kernel PCA for novelty detection](https://www.researchgate.net/publication/222828640_Kernel_PCA_for_novelty_detection) - Additional resources: - [Section 3.3.3 for the equivalent kernel of linear regression in Bishop](http://users.isr.ist.utl.pt/~wurmd/Livros/school/Bishop%20-%20Pattern%20Recognition%20And%20Machine%20Learning%20-%20Springer%20%202006.pdf) - [A short introduction to the kernel trick on Medium](https://medium.com/@zxr.nju/what-is-the-kernel-trick-why-is-it-important-98a98db0961d) - [A mini lecture on the kernel trick](https://www.youtube.com/watch?v=JiM_LXpAtLc) - [Kernel PCA Notebook](https://scikit-learn.org/stable/auto_examples/decomposition/plot_kernel_pca.html#sphx-glr-auto-examples-decomposition-plot-kernel-pca-py) - [Kernel Interpolation for Scalable Structured Gaussian Processes](https://arxiv.org/abs/1503.01057) # Contributing Contributions are very welcome, please share back with the wider community (and get credited for it)! Please have a look at the [CONTRIBUTING](../CONTRIBUTING.md) guidelines, also have a read about our [licensing](../LICENSE.md) policy. --- Back to [Data page (table of contents)](README.md)</br> Back to [main page (table of contents)](../README.md)
{ "pile_set_name": "Github" }
rows = {[2.191019e+002 1.961306e+002 1.911369e+002 1.881406e+002 1.861431e+002 1.841456e+002 1.841456e+002 1.841456e+002 1.851444e+002 1.871419e+002 1.911369e+002 1.941331e+002 1.971294e+002 2.011244e+002 2.051194e+002 2.091144e+002 2.141081e+002 2.181031e+002 2.240956e+002 2.290894e+002 2.350819e+002 2.410744e+002 2.470669e+002 2.540581e+002 2.610494e+002 2.680406e+002 2.760306e+002 2.820231e+002 2.890144e+002 2.960056e+002 3.029969e+002 3.099881e+002 3.159806e+002 3.289644e+002 3.359556e+002 3.419481e+002 3.479406e+002 3.549319e+002 3.609244e+002 3.729094e+002 3.779031e+002 3.838956e+002 3.888894e+002 3.938831e+002 3.978781e+002 4.018731e+002 4.058681e+002 4.108619e+002 4.128594e+002 4.138581e+002 4.158556e+002 4.158556e+002 4.178531e+002 4.188519e+002 4.188519e+002 4.198506e+002 4.188519e+002 4.188519e+002 4.188519e+002 4.188519e+002 4.178531e+002 4.168544e+002 4.168544e+002 4.158556e+002 4.158556e+002 4.148569e+002 4.148569e+002 4.148569e+002 4.158556e+002 4.158556e+002 4.168544e+002 4.188519e+002 4.198506e+002 4.208494e+002 4.238456e+002 4.248444e+002 4.258431e+002 4.278406e+002 4.288394e+002 4.298381e+002 4.298381e+002 4.298381e+002 4.298381e+002 4.298381e+002 4.298381e+002 4.298381e+002 4.288394e+002 4.278406e+002 4.268419e+002 ]; }; cols = {[2.801506e+002 3.151069e+002 3.290894e+002 3.440706e+002 3.530594e+002 3.700381e+002 3.790269e+002 3.880156e+002 3.970044e+002 4.129844e+002 4.259681e+002 4.319606e+002 4.359556e+002 4.399506e+002 4.429469e+002 4.459431e+002 4.479406e+002 4.489394e+002 4.489394e+002 4.479406e+002 4.459431e+002 4.439456e+002 4.399506e+002 4.359556e+002 4.309619e+002 4.259681e+002 4.199756e+002 4.139831e+002 4.079906e+002 4.019981e+002 3.960056e+002 3.890144e+002 3.820231e+002 3.670419e+002 3.590519e+002 3.520606e+002 3.440706e+002 3.360806e+002 3.280906e+002 3.131094e+002 3.061181e+002 2.991269e+002 2.931344e+002 2.871419e+002 2.811494e+002 2.761556e+002 2.721606e+002 2.651694e+002 2.631719e+002 2.611744e+002 2.591769e+002 2.581781e+002 2.581781e+002 2.591769e+002 2.601756e+002 2.621731e+002 2.651694e+002 2.691644e+002 2.731594e+002 2.791519e+002 2.861431e+002 2.951319e+002 3.041206e+002 3.151069e+002 3.270919e+002 3.400756e+002 3.690394e+002 3.830219e+002 3.980031e+002 4.129844e+002 4.279656e+002 4.559306e+002 4.689144e+002 4.818981e+002 5.028719e+002 5.118606e+002 5.198506e+002 5.308369e+002 5.338331e+002 5.358306e+002 5.378281e+002 5.388269e+002 5.378281e+002 5.368294e+002 5.358306e+002 5.338331e+002 5.318356e+002 5.288394e+002 5.268419e+002 ]; };
{ "pile_set_name": "Github" }
/** * Licensed to Big Data Genomics (BDG) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The BDG 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.bdgenomics.mango.cli import org.bdgenomics.mango.converters.{ GA4GHutil, SearchFeaturesRequestGA4GH, SearchReadsRequestGA4GH, SearchVariantsRequestGA4GH } import org.bdgenomics.mango.models.LazyMaterialization import org.bdgenomics.mango.util.MangoFunSuite import org.scalatra.{ NotFound, Ok } import org.scalatra.test.scalatest.ScalatraSuite import net.liftweb.json._ import org.junit.Test @org.junit.runner.RunWith(value = classOf[org.scalatestplus.junit.JUnitRunner]) class VizReadsSuite extends MangoFunSuite with ScalatraSuite { implicit val formats = DefaultFormats val bamFile = resourcePath("mouse_chrM.bam") val genomeFile = resourcePath("mm10.genome") val vcfFile = resourcePath("truetest.genotypes.vcf") val featureFile = resourcePath("smalltest.bed") val coverageFile = resourcePath("mouse_chrM.coverage.bed") // exampleFiles val chr17bam = examplePath("chr17.7500000-7515000.sam") val chr17Reference = examplePath("hg19.17.2bit") val chr17Vcf = examplePath("ALL.chr17.7500000-7515000.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf") val bamKey = LazyMaterialization.filterKeyFromFile(bamFile) val featureKey = LazyMaterialization.filterKeyFromFile(featureFile) val vcfKey = LazyMaterialization.filterKeyFromFile(vcfFile) val coverageKey = LazyMaterialization.filterKeyFromFile(coverageFile) val args = new VizReadsArgs() args.readsPaths = bamFile args.genomePath = genomeFile args.variantsPaths = vcfFile args.featurePaths = featureFile args.coveragePaths = coverageFile args.testMode = true // header for JSON POSTs val requestHeader = Map("Content-Type" -> "application/json") sparkTest("Should pass for discovery mode") { addServlet(classOf[VizServlet], "/*") val args = new VizReadsArgs() args.discoveryMode = true args.genomePath = genomeFile args.featurePaths = featureFile args.variantsPaths = vcfFile args.coveragePaths = coverageFile args.testMode = true implicit val vizReads = runVizReads(args) val body = SearchFeaturesRequestGA4GH(featureKey, "null", 200, "chrM", 0, 2000).toByteArray() post("/features/search", body, requestHeader) { assert(status == Ok("").status.code) } get("/quit") { assert(status == Ok("").status.code) } } sparkTest("Should get browser and overall template information") { get("/browser") { val args = response.getContent() val browserArgs = parse(args).extract[BrowserArgs] assert(browserArgs.twoBitUrl == "http://hgdownload.cse.ucsc.edu/goldenPath/mm10/bigZips/mm10.2bit") assert(browserArgs.genes == Some("REFSEQ_REQUEST")) assert(browserArgs.reads == None) assert(browserArgs.variants.isDefined) assert(browserArgs.variants.get.head._2.split(",").deep == Array("NA00001", "NA00002", "NA00003").deep) assert(browserArgs.features.isDefined) assert(browserArgs.features.get.head._2 == false) assert(browserArgs.features.get.last._2 == true) } get("/overall") { val args = response.getContent() val map = parse(args).extract[Map[String, String]] val discoveryRegions = map("regions").split(",") assert(discoveryRegions.length == 1) // one region at the beginning of chrM assert(map("dictionary").split(",").length == 66) // should be 66 chromosomes } } /** Reads tests **/ sparkTest("should return reads") { implicit val vizReads = runVizReads(args) val body = SearchReadsRequestGA4GH("null", 200, Array(bamKey), "chrM", 1, 2).toByteArray() post("/reads/search", body, requestHeader) { assert(status == Ok("").status.code) val parsedData = GA4GHutil.stringToSearchReadsResponse(response.getContent()) .getAlignmentsList assert(parsedData.size == 9) } } sparkTest("Should throw error when reads do not exist") { val newArgs = new VizReadsArgs() newArgs.genomePath = genomeFile newArgs.testMode = true implicit val vizReads = runVizReads(newArgs) val body = SearchReadsRequestGA4GH("null", 200, Array(bamKey), "chrM", 1, 100).toByteArray() post("/reads/search", body, requestHeader) { assert(status == NotFound().status.code) } } sparkTest("Reads should throw NotFound error on invalid reference") { implicit val VizReads = runVizReads(args) val body = SearchReadsRequestGA4GH("null", 200, Array(bamKey), "fakeChr", 1, 100).toByteArray() post("/reads/search", body, requestHeader) { assert(status == NotFound().status.code) } } sparkTest("should not return reads with invalid key") { implicit val vizReads = runVizReads(args) val body = SearchReadsRequestGA4GH("null", 200, Array("invalidKey"), "chrM", 1, 100).toByteArray() post("/reads/search", body, requestHeader) { assert(status == Ok("").status.code) } } /** Variants tests **/ sparkTest("/variants/:key/:ref") { val args = new VizReadsArgs() args.genomePath = genomeFile args.variantsPaths = vcfFile args.testMode = true implicit val vizReads = runVizReads(args) val body = SearchVariantsRequestGA4GH(vcfKey, "null", 200, "chrM", Array(), 0, 100).toByteArray() post("/variants/search", body, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToVariantServiceResponse(response.getContent()) .getVariantsList assert(json.size == 7) assert(json.get(0).getStart == 9) assert(json.get(0).getCallsCount == 3) } } sparkTest("should not return variants with invalid key") { implicit val VizReads = runVizReads(args) val body = SearchVariantsRequestGA4GH("invalidKey", "null", 200, "chrM", Array(), 0, 100).toByteArray() post("/variants/search", body, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToVariantServiceResponse(response.getContent()) .getVariantsList assert(json.size == 0) } } sparkTest("Should throw error when variants do not exist") { val newArgs = new VizReadsArgs() newArgs.genomePath = genomeFile newArgs.testMode = true implicit val VizReads = runVizReads(newArgs) val body = SearchVariantsRequestGA4GH("invalidKey", "null", 200, "chrM", Array(), 0, 100).toByteArray() post("/variants/search", body, requestHeader) { assert(status == NotFound().status.code) } } /** Feature Tests **/ sparkTest("/features/:key/:ref") { implicit val vizReads = runVizReads(args) val body = SearchFeaturesRequestGA4GH(featureKey, "null", 200, "chrM", 0, 1200).toByteArray() post("/features/search", body, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToSearchFeaturesResponse(response.getContent()) .getFeaturesList assert(json.size == 2) } } sparkTest("should not return features with invalid key") { implicit val VizReads = runVizReads(args) val body = SearchFeaturesRequestGA4GH("invalidKey", "null", 200, "chrM", 0, 100).toByteArray() post("/features/search", body, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToSearchFeaturesResponse(response.getContent()) .getFeaturesList assert(json.size == 0) } } sparkTest("Should throw error when features do not exist") { val newArgs = new VizReadsArgs() newArgs.genomePath = genomeFile newArgs.testMode = true implicit val VizReads = runVizReads(newArgs) val body = SearchFeaturesRequestGA4GH("invalidKey", "null", 200, "chrM", 0, 100).toByteArray() post("/features/search", body, requestHeader) { assert(status == NotFound().status.code) } } sparkTest("Features should throw out of bounds error on invalid reference") { implicit val VizReads = runVizReads(args) val body = SearchFeaturesRequestGA4GH(featureKey, "null", 200, "fakeChr", 0, 100).toByteArray() post("/features/search", body, requestHeader) { assert(status == NotFound().status.code) } } /** Coverage Tests **/ sparkTest("gets coverage from feature endpoint") { val newArgs = new VizReadsArgs() newArgs.genomePath = genomeFile newArgs.coveragePaths = coverageFile newArgs.testMode = true implicit val vizReads = runVizReads(newArgs) val body = SearchFeaturesRequestGA4GH(coverageKey, "null", 200, "chrM", 0, 1200).toByteArray() post("/features/search", body, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToSearchFeaturesResponse(response.getContent()) .getFeaturesList assert(json.size == 1200) } } sparkTest("should not return coverage with invalid key") { implicit val VizReads = runVizReads(args) val body = SearchFeaturesRequestGA4GH("invalidKey", "null", 200, "chrM", 0, 1200).toByteArray() post("/features/search", body, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToSearchFeaturesResponse(response.getContent()) .getFeaturesList assert(json.size == 0) } } sparkTest("Should return coverage and features") { val newArgs = new VizReadsArgs() newArgs.genomePath = genomeFile newArgs.coveragePaths = coverageFile newArgs.featurePaths = featureFile newArgs.testMode = true implicit val VizReads = runVizReads(newArgs) val coverageBody = SearchFeaturesRequestGA4GH(coverageKey, "null", 200, "chrM", 0, 1200).toByteArray() post("/features/search", coverageBody, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToSearchFeaturesResponse(response.getContent()) .getFeaturesList assert(json.size == 1200) } val featureBody = SearchFeaturesRequestGA4GH(featureKey, "null", 200, "chrM", 0, 1200).toByteArray() post("/features/search", featureBody, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToSearchFeaturesResponse(response.getContent()) .getFeaturesList assert(json.size == 2) } } sparkTest("gets genes") { implicit val vizReads = runVizReads(args) val featureBody = SearchFeaturesRequestGA4GH(VizReads.GENES_REQUEST, "null", 200, "chr1", 4773199, 4783199).toByteArray() post("/features/search", featureBody, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToSearchFeaturesResponse(response.getContent()) .getFeaturesList assert(json.size == 3) } } sparkTest("Coverage should throw out of bounds error on invalid reference") { implicit val VizReads = runVizReads(args) val coverageBody = SearchFeaturesRequestGA4GH(coverageKey, "null", 200, "fakeChr", 0, 1200).toByteArray() post("/features/search", coverageBody, requestHeader) { assert(status == NotFound().status.code) } } sparkTest("Should trigger requests for http files") { val args = new VizReadsArgs() args.genomePath = genomeFile args.testMode = true args.variantsPaths = "http://s3.amazonaws.com/1000genomes/phase1/analysis_results/integrated_call_sets/ALL.chr1.integrated_phase1_v3.20101123.snps_indels_svs.genotypes.vcf.gz" val vcfKey = LazyMaterialization.filterKeyFromFile(args.variantsPaths) implicit val VizReads = runVizReads(args) val variantsBody = SearchVariantsRequestGA4GH(vcfKey, "null", 200, "chr1", Array(), 169327640, 169332871).toByteArray() post("/variants/search", variantsBody, requestHeader) { assert(status == Ok().status.code) val json = GA4GHutil.stringToVariantServiceResponse(response.getContent()) .getVariantsList assert(json.size == 61) } } /** Example files **/ sparkTest("should run example files") { val args = new VizReadsArgs() args.readsPaths = chr17bam args.genomePath = genomeFile args.variantsPaths = chr17Vcf args.testMode = true implicit val VizReads = runVizReads(args) val exBamKey = LazyMaterialization.filterKeyFromFile(chr17bam) val exVcfKey = LazyMaterialization.filterKeyFromFile(chr17Vcf) // no data val variantsBody = SearchVariantsRequestGA4GH(exVcfKey, "null", 200, "chr1", Array(), 7500000, 7510100).toByteArray() post("/variants/search", variantsBody, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToVariantServiceResponse(response.getContent()) .getVariantsList assert(json.size == 0) } // generate requests for regions not in data bounds val readsBody1 = SearchReadsRequestGA4GH("null", 200, Array(exBamKey), "chr17", 1, 100).toByteArray() val variantsBody1 = SearchVariantsRequestGA4GH(exVcfKey, "null", 200, "chr17", Array(), 1, 100).toByteArray() post("/reads/search", readsBody1, requestHeader) { assert(status == Ok("").status.code) } post("/variants/search", variantsBody1, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToVariantServiceResponse(response.getContent()) .getVariantsList assert(json.size == 0) } // form request bodies to send to post val readsBody2 = SearchReadsRequestGA4GH("null", 200, Array(exBamKey), "chr17", 7500000, 7510100).toByteArray() val variantsBody2 = SearchVariantsRequestGA4GH(exVcfKey, "null", 200, "chr17", Array(), 7500000, 7510100).toByteArray() post("/reads/search", readsBody2, requestHeader) { assert(status == Ok("").status.code) } post("/variants/search", variantsBody2, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToVariantServiceResponse(response.getContent()) .getVariantsList assert(json.size == 289) } val variantsBody3 = SearchVariantsRequestGA4GH(exVcfKey, "null", 400, "chr17", Array("HG00096", "HG00097", "HG00099", "HG00100", "HG00101"), 40603901, 40604000).toByteArray() post("/variants/search", variantsBody3, requestHeader) { assert(status == Ok("").status.code) val json = GA4GHutil.stringToVariantServiceResponse(response.getContent()) .getVariantsList assert(json.size == 0) } } }
{ "pile_set_name": "Github" }
ION BUFFER SHARING UTILITY ========================== File: ion_test.sh : Utility to test ION driver buffer sharing mechanism. Author: Pintu Kumar <[email protected]> Introduction: ------------- This is a test utility to verify ION buffer sharing in user space between 2 independent processes. It uses unix domain socket (with SCM_RIGHTS) as IPC to transfer an FD to another process to share the same buffer. This utility demonstrates how ION buffer sharing can be implemented between two user space processes, using various heap types. The following heap types are supported by ION driver. ION_HEAP_TYPE_SYSTEM (0) ION_HEAP_TYPE_SYSTEM_CONTIG (1) ION_HEAP_TYPE_CARVEOUT (2) ION_HEAP_TYPE_CHUNK (3) ION_HEAP_TYPE_DMA (4) By default only the SYSTEM and SYSTEM_CONTIG heaps are supported. Each heap is associated with the respective heap id. This utility is designed in the form of client/server program. The server part (ionapp_export) is the exporter of the buffer. It is responsible for creating an ION client, allocating the buffer based on the heap id, writing some data to this buffer and then exporting the FD (associated with this buffer) to another process using socket IPC. This FD is called as buffer FD (which is different than the ION client FD). The client part (ionapp_import) is the importer of the buffer. It retrives the FD from the socket data and installs into its address space. This new FD internally points to the same kernel buffer. So first it reads the data that is stored in this buffer and prints it. Then it writes the different size of data (it could be different data) to the same buffer. Finally the buffer FD must be closed by both the exporter and importer. Thus the same kernel buffer is shared among two user space processes using ION driver and only one time allocation. Prerequisite: ------------- This utility works only if /dev/ion interface is present. The following configs needs to be enabled in kernel to include ion driver. CONFIG_ANDROID=y CONFIG_STAGING=y CONFIG_ION=y CONFIG_ION_SYSTEM_HEAP=y This utility requires to be run as root user. Compile and test: ----------------- This utility is made to be run as part of kselftest framework in kernel. To compile and run using kselftest you can simply do the following from the kernel top directory. linux$ make TARGETS=android kselftest Or you can also use: linux$ make -C tools/testing/selftests TARGETS=android run_tests Using the selftest it can directly execute the ion_test.sh script to test the buffer sharing using ion system heap. Currently the heap size is hard coded as just 10 bytes inside this script. You need to be a root user to run under selftest. You can also compile and test manually using the following steps: ion$ make These will generate 2 executable: ionapp_export, ionapp_import Now you can run the export and import manually by specifying the heap type and the heap size. You can also directly execute the shell script to run the test automatically. Simply use the following command to run the test. ion$ sudo ./ion_test.sh Test Results: ------------- The utility is verified on Ubuntu-32 bit system with Linux Kernel 4.14. Here is the snapshot of the test result using kselftest. linux# make TARGETS=android kselftest heap_type: 0, heap_size: 10 -------------------------------------- heap type: 0 heap id: 1 heap name: ion_system_heap -------------------------------------- Fill buffer content: 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd Sharing fd: 6, Client fd: 5 <ion_close_buffer_fd>: buffer release successfully.... Received buffer fd: 4 Read buffer content: 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 Fill buffer content: 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd <ion_close_buffer_fd>: buffer release successfully.... ion_test.sh: heap_type: 0 - [PASS] ion_test.sh: done
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 211c7771a0840b04ab0f2d11942ecc28 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
import unittest from cloudinary.cache import responsive_breakpoints_cache from cloudinary.cache.adapter.key_value_cache_adapter import KeyValueCacheAdapter from cloudinary.cache.storage.file_system_key_value_storage import FileSystemKeyValueStorage from test.cache.storage.dummy_cache_storage import DummyCacheStorage from test.helper_test import UNIQUE_TEST_ID class ResponsiveBreakpointsCacheTest(unittest.TestCase): public_id = UNIQUE_TEST_ID breakpoints = [100, 200, 300, 399] def setUp(self): self.cache = responsive_breakpoints_cache.instance self.cache.set_cache_adapter(KeyValueCacheAdapter(DummyCacheStorage())) def test_rb_cache_set_get(self): self.cache.set(self.public_id, self.breakpoints) res = self.cache.get(self.public_id) self.assertEqual(self.breakpoints, res) def test_rb_cache_set_invalid_breakpoints(self): with self.assertRaises(ValueError): self.cache.set(self.public_id, "Not breakpoints at all") def test_rb_cache_delete(self): self.cache.set(self.public_id, self.breakpoints) self.cache.delete(self.public_id) res = self.cache.get(self.public_id) self.assertIsNone(res) def test_rb_cache_flush_all(self): self.cache.set(self.public_id, self.breakpoints) self.cache.flush_all() res = self.cache.get(self.public_id) self.assertIsNone(res) def test_rb_cache_disabled(self): self.cache._cache_adapter = None self.assertFalse(self.cache.enabled) self.assertFalse(self.cache.set(self.public_id, self.breakpoints)) self.assertIsNone(self.cache.get(self.public_id)) self.assertFalse(self.cache.delete(self.public_id)) self.assertFalse(self.cache.flush_all()) def test_rb_cache_filesystem_storage(self): self.cache.set_cache_adapter(KeyValueCacheAdapter(FileSystemKeyValueStorage(None))) res = None try: self.cache.set(self.public_id, self.breakpoints) res = self.cache.get(self.public_id) finally: self.cache.delete(self.public_id) self.assertEqual(self.breakpoints, res)
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ProjectModuleManager"> <modules> <module fileurl="file://$PROJECT_DIR$/modules/tip/modules_tip.iml" filepath="$PROJECT_DIR$/modules/tip/modules_tip.iml" group="modules" /> <module fileurl="file://$PROJECT_DIR$/project_root.iml" filepath="$PROJECT_DIR$/project_root.iml" /> </modules> </component> </project>
{ "pile_set_name": "Github" }
/** * DSS - Digital Signature Services * Copyright (C) 2015 European Commission, provided under the CEF programme * * This file is part of the "DSS - Digital Signature Services" project. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package eu.europa.esig.dss.cades.validation; import eu.europa.esig.dss.model.DSSDocument; import eu.europa.esig.dss.model.FileDocument; public class DSS1871Test extends AbstractCAdESTestValidation { @Override protected DSSDocument getSignedDocument() { return new FileDocument("src/test/resources/validation/wrongContentHints.p7m"); } // @Override // protected void checkSigningCertificateValue(DiagnosticData diagnosticData) { // SignatureWrapper signature = diagnosticData.getSignatureById(diagnosticData.getFirstSignatureId()); // assertTrue(signature.isSigningCertificateReferencePresent()); // assertTrue(signature.isDigestValuePresent()); // assertTrue(signature.isDigestValueMatch()); // } }
{ "pile_set_name": "Github" }
<super> <meta> <artist>groovitude</artist> <title>A-Punk Chorus</title> <beats_in_measure>4</beats_in_measure> <BPM>168</BPM> <key>D</key> <YouTubeID>Xo9x2mA53ms</YouTubeID> <sections> <_Chorus> <global_start>61.73</global_start> <section_duration>8.56</section_duration> <active_start>1.43</active_start> <active_stop>7.13</active_stop> </_Chorus> </sections> </meta> <sections> <_Chorus> <segment> <instrument/> <rhythm/> <notes> <note> <start_beat_abs>0</start_beat_abs> <start_measure>1</start_measure> <start_beat>1</start_beat> <note_length>0.5</note_length> <scale_degree>7</scale_degree> <octave>0</octave> <isRest>0</isRest> </note> <note> <start_beat_abs>0.5</start_beat_abs> <start_measure>1</start_measure> <start_beat>1.5</start_beat> <note_length>1</note_length> <scale_degree>1</scale_degree> <octave>1</octave> <isRest>0</isRest> </note> <note> <start_beat_abs>1.5</start_beat_abs> <start_measure>1</start_measure> <start_beat>2.5</start_beat> <note_length>1</note_length> <scale_degree>1</scale_degree> <octave>1</octave> <isRest>0</isRest> </note> <note> <start_beat_abs>2.5</start_beat_abs> <start_measure>1</start_measure> <start_beat>3.5</start_beat> <note_length>0.5</note_length> <scale_degree>1</scale_degree> <octave>1</octave> <isRest>0</isRest> </note> <note> <start_beat_abs>3</start_beat_abs> <start_measure>1</start_measure> <start_beat>4</start_beat> <note_length>0.5</note_length> <scale_degree>1</scale_degree> <octave>1</octave> <isRest>0</isRest> </note> <note> <start_beat_abs>3.5</start_beat_abs> <start_measure>1</start_measure> <start_beat>4.5</start_beat> <note_length>1</note_length> <scale_degree>1</scale_degree> <octave>1</octave> <isRest>0</isRest> </note> <note> <start_beat_abs>4.5</start_beat_abs> <start_measure>2</start_measure> <start_beat>1.5</start_beat> <note_length>1</note_length> <scale_degree>5</scale_degree> <octave>0</octave> <isRest>0</isRest> </note> <note> <start_beat_abs>5.5</start_beat_abs> <start_measure>2</start_measure> <start_beat>2.5</start_beat> <note_length>1</note_length> <scale_degree>5</scale_degree> <octave>0</octave> <isRest>0</isRest> </note> <note> <start_beat_abs>6.5</start_beat_abs> <start_measure>2</start_measure> <start_beat>3.5</start_beat> <note_length>0.5</note_length> <scale_degree>5</scale_degree> <octave>0</octave> <isRest>0</isRest> </note> <note> <start_beat_abs>7</start_beat_abs> <start_measure>2</start_measure> <start_beat>4</start_beat> <note_length>1</note_length> <scale_degree>5</scale_degree> <octave>0</octave> <isRest>0</isRest> </note> <note> <start_beat_abs>8</start_beat_abs> <start_measure>3</start_measure> <start_beat>1</start_beat> <note_length>2</note_length> <scale_degree>6</scale_degree> <octave>0</octave> <isRest>0</isRest> </note> </notes> <chords> <chord> <sd>1</sd> <fb/> <sec/> <sus/> <pedal/> <alternate/> <borrowed/> <chord_duration>4</chord_duration> <start_measure>1</start_measure> <start_beat>1</start_beat> <start_beat_abs>0</start_beat_abs> <isRest>0</isRest> </chord> <chord> <sd>5</sd> <fb/> <sec/> <sus/> <pedal/> <alternate/> <borrowed/> <chord_duration>4</chord_duration> <start_measure>2</start_measure> <start_beat>1</start_beat> <start_beat_abs>4</start_beat_abs> <isRest>0</isRest> </chord> <chord> <sd>4</sd> <fb/> <sec/> <sus/> <pedal/> <alternate/> <borrowed/> <chord_duration>4</chord_duration> <start_measure>3</start_measure> <start_beat>1</start_beat> <start_beat_abs>8</start_beat_abs> <isRest>0</isRest> </chord> <chord> <sd>5</sd> <fb/> <sec/> <sus/> <pedal/> <alternate/> <borrowed/> <chord_duration>4</chord_duration> <start_measure>4</start_measure> <start_beat>1</start_beat> <start_beat_abs>12</start_beat_abs> <isRest>0</isRest> </chord> </chords> <numMeasures>4</numMeasures> </segment> </_Chorus> </sections> </super>
{ "pile_set_name": "Github" }
{ "name": "methods", "description": "HTTP methods that node supports", "version": "1.1.1", "contributors": [ { "name": "Douglas Christopher Wilson", "email": "[email protected]" }, { "name": "Jonathan Ong", "email": "[email protected]", "url": "http://jongleberry.com" }, { "name": "TJ Holowaychuk", "email": "[email protected]", "url": "http://tjholowaychuk.com" } ], "license": "MIT", "repository": { "type": "git", "url": "https://github.com/jshttp/methods" }, "devDependencies": { "istanbul": "0.3", "mocha": "1" }, "files": [ "index.js", "HISTORY.md", "LICENSE" ], "engines": { "node": ">= 0.6" }, "scripts": { "test": "mocha --reporter spec", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot", "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot" }, "browser": { "http": false }, "keywords": [ "http", "methods" ], "gitHead": "6293c6b27c5fb963acf67a347af80ad2ebd7247f", "bugs": { "url": "https://github.com/jshttp/methods/issues" }, "homepage": "https://github.com/jshttp/methods", "_id": "[email protected]", "_shasum": "17ea6366066d00c58e375b8ec7dfd0453c89822a", "_from": "methods@~1.1.1", "_npmVersion": "1.4.28", "_npmUser": { "name": "dougwilson", "email": "[email protected]" }, "maintainers": [ { "name": "tjholowaychuk", "email": "[email protected]" }, { "name": "jonathanong", "email": "[email protected]" }, { "name": "jongleberry", "email": "[email protected]" }, { "name": "dougwilson", "email": "[email protected]" } ], "dist": { "shasum": "17ea6366066d00c58e375b8ec7dfd0453c89822a", "tarball": "http://registry.npmjs.org/methods/-/methods-1.1.1.tgz" }, "directories": {}, "_resolved": "https://registry.npmjs.org/methods/-/methods-1.1.1.tgz", "readme": "ERROR: No README data found!" }
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title> Options Alerts screen </title> </head> <body bgcolor="#ffffff"> <h1>Options Alerts screen</h1> <p> This screen allows you to configure the alerts options: <h3>Merge related alerts in report</h3> If selected then related issues will be merged in any reports generated.<br> This will significantly reduce the size of the report as duplicated information will be removed. <h3>Max alert instances in report</h3> The maximum number of alert instances to include in a report.<br> A value of zero is treated as unlimited. <h3>Alert overrides file</h3> The full name of a properties file that specifies any <a href="../../../start/concepts/alerts.html#alertoverrides">alert overrides</a> that you want to apply. <h2>See also</h2> <table> <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td> <a href="../../overview.html">UI Overview</a></td><td>for an overview of the user interface</td></tr> <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td> <a href="options.html">Options dialogs</a></td><td>for details of the other Options dialog screens</td></tr> </table> </body> </html>
{ "pile_set_name": "Github" }
/** * Copyright (c) 2015-present, Parse, LLC. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN /** PFSQLiteStatement is sqlite3_stmt wrapper class. */ typedef struct sqlite3_stmt sqlite3_stmt; @interface PFSQLiteStatement : NSObject @property (nullable, nonatomic, assign, readonly) sqlite3_stmt *sqliteStatement; @property (nonatomic, strong, readonly) dispatch_queue_t databaseQueue; - (instancetype)initWithStatement:(sqlite3_stmt *)stmt queue:(dispatch_queue_t)databaseQueue; - (BOOL)close; - (BOOL)reset; @end NS_ASSUME_NONNULL_END
{ "pile_set_name": "Github" }
/// Copyright (c) 2009 Microsoft Corporation /// /// 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 Microsoft 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. ES5Harness.registerTest( { id: "15.4.4.21-7-8", path: "TestCases/chapter15/15.4/15.4.4/15.4.4.21/15.4.4.21-7-8.js", description: "Array.prototype.reduce returns initialValue if 'length' is 0 and initialValue is present (subclassed Array, length overridden with [])", test: function testcase() { foo.prototype = new Array(1, 2, 3); function foo() {} var f = new foo(); f.length = []; // objects inherit the default valueOf method of the Object object; // that simply returns the itself. Since the default valueOf() method // does not return a primitive value, ES next tries to convert the object // to a number by calling its toString() method and converting the // resulting string to a number. // // The toString( ) method on Array converts the array elements to strings, // then returns the result of concatenating these strings, with commas in // between. An array with no elements converts to the empty string, which // converts to the number 0. If an array has a single element that is a // number n, the array converts to a string representation of n, which is // then converted back to n itself. If an array contains more than one element, // or if its one element is not a number, the array converts to NaN. function cb(){} try { if(f.reduce(cb,1) === 1) return true; } catch (e) { } }, precondition: function prereq() { return fnExists(Array.prototype.reduce); } });
{ "pile_set_name": "Github" }
{ "args": ["src", "--out-dir", "lib"] }
{ "pile_set_name": "Github" }
using Microsoft.AspNetCore.Mvc.ModelBinding; namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.SymbolApiResponseMetadataProviderTest { [ProducesErrorResponseType(typeof(ModelStateDictionary))] public class GetErrorResponseType_ReturnsTypeDefinedAtActionController { [ProducesErrorResponseType(typeof(GetErrorResponseType_ReturnsTypeDefinedAtActionModel))] public void Action() { } } public class GetErrorResponseType_ReturnsTypeDefinedAtActionModel { } }
{ "pile_set_name": "Github" }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Collections.Generic; using System.Text; using Microsoft.Research.AbstractDomains.Expressions; using System.Diagnostics; using Microsoft.Research.AbstractDomains.Numerical; using System.Diagnostics.Contracts; using Microsoft.Research.DataStructures; using System.Linq; namespace Microsoft.Research.AbstractDomains { /// <summary> /// Some helper method for the abstract domains /// </summary> public static class AbstractDomainsHelper { [Pure] public static bool TryTrivialLessEqual<This>(This left, This right, out bool result) where This : IAbstractDomain { Contract.Ensures(Contract.Result<bool>() || !left.IsTop); Contract.Ensures(Contract.Result<bool>() || !right.IsTop); if (object.ReferenceEquals(left, right)) { result = true; return true; } if (left.IsBottom) { result = true; return true; } else if (left.IsTop) { result = right.IsTop; return true; } else if (right.IsBottom) { result = false; // At this point we already know that it is false return true; } else if (right.IsTop) { result = true; return true; } else { result = false; // no matter what return false; } } [Pure] public static bool TryTrivialJoin<This>(This left, This right, out This result) where This : class, IAbstractDomain { Contract.Requires(left != null); Contract.Requires(right != null); Contract.Ensures(!Contract.Result<bool>() || (Contract.ValueAtReturn(out result) != null)); if (object.ReferenceEquals(left, right)) { result = left; return true; } if (left.IsBottom) { result = right; return true; } else if (left.IsTop) { result = left; return true; } else if (right.IsBottom) { result = left; return true; } else if (right.IsTop) { result = right; return true; } else { result = default(This); return false; } } [Pure] public static bool TryTrivialJoinRefinedWithEmptyArrays<AD, Variable, Expression>( ArraySegmentation<AD, Variable, Expression> left, ArraySegmentation<AD, Variable, Expression> right, out ArraySegmentation<AD, Variable, Expression> result) where AD : class, IAbstractDomainForArraySegmentationAbstraction<AD, Variable> { Contract.Requires(left != null); Contract.Requires(right != null); Contract.Ensures(!Contract.Result<bool>() || (Contract.ValueAtReturn(out result) != null)); // IsEmptyArray may determine that a segmentation is bottom, so it is more precise if we perform this check before if (left.IsEmptyArray) { result = right; return true; } if (right.IsEmptyArray) { result = left; return true; } if (TryTrivialJoin(left, right, out result)) { return true; } result = default(ArraySegmentation<AD, Variable, Expression>); return false; } public static bool TryTrivialMeet<This>(This left, This right, out This result) where This : class, IAbstractDomain { Contract.Requires(left != null); Contract.Requires(right != null); Contract.Ensures(!Contract.Result<bool>() || (Contract.ValueAtReturn(out result) != null)); if (object.ReferenceEquals(left, right)) { result = left; return true; } if (left.IsBottom) { result = left; return true; } else if (left.IsTop) { result = right; return true; } else if (right.IsBottom) { result = right; return true; } else if (right.IsTop) { result = left; return true; } else { result = default(This); return false; } } /// <summary> /// Tries to get a threshod from the booleand guard <code>guard</code> /// </summary> public static bool TryToGetAThreshold<Variable, Expression>(Expression exp, out List<int> thresholds, IExpressionDecoder<Variable, Expression> decoder) { var searchForAThreshold = new GetAThresholdVisitor<Variable, Expression>(decoder); if (searchForAThreshold.Visit(exp, Void.Value) && searchForAThreshold.Thresholds.Count == 1) { // We do not want the thresholds to be too much, as it may slow down the analysis, // so we consider them relevant when they are only one var t = searchForAThreshold.Thresholds[0]; thresholds = new List<int>() { t, t + 1, t - 1 }; return t != 0; } else { thresholds = null; return false; } } } public static class CommonChecks { /// <summary> /// Checks if <code>e1 \leq e2</code> is always true. /// It can use some bound information from the oracledomain /// </summary> public static FlatAbstractDomain<bool> CheckLessEqualThan<Variable, Expression>( Expression e1, Expression e2, INumericalAbstractDomainQuery<Variable, Expression> oracleDomain, IExpressionDecoder<Variable, Expression> decoder) { Polynomial<Variable, Expression> leq; // Try to see if it holds using the oracleDomain if (Polynomial<Variable, Expression>.TryToPolynomialForm(ExpressionOperator.LessEqualThan, e1, e2, decoder, out leq)) { if (leq.Degree == 0) { // If it is a constant var leftConstant = leq.Left[0].K; var rightConstant = leq.Right[0].K; if (leftConstant <= rightConstant) { return CheckOutcome.True; } else if (leftConstant > rightConstant) { return CheckOutcome.False; } else { return CheckOutcome.Top; } } else if (leq.Degree == 1) { Variable x; Rational k1, k2; if (leq.TryMatch_k1XLessThank2(out k1, out x, out k2)) { // Very easy for the moment if (k1 == -1) { // -1 * x <= k2 var b = oracleDomain.BoundsFor(x); if (!b.IsTop && -b.LowerBound <= k2) { return CheckOutcome.True; } } } /* We do not care at the moment, it can be refined if we want */ /* else if (PolynomialHelper.Match_k1XLessEqualThank2(leq, out k1, out x, out k2)) { return CheckOutcome.Top; } */ } } return CheckOutcome.Top; } /// <summary> /// Checks if <code>e1 \lt e2 </code> is always true. /// </summary> /// It can use some bound information from the oracledomain #if SUBPOLY_ONLY internal #else public #endif static FlatAbstractDomain<bool> CheckLessThan<Variable, Expression>(Expression e1, Expression e2, INumericalAbstractDomainQuery<Variable, Expression> oracleDomain, IExpressionDecoder<Variable, Expression> decoder) { Contract.Ensures(Contract.Result<FlatAbstractDomain<bool>>() != null); Polynomial<Variable, Expression> ltPol; if (Polynomial<Variable, Expression>.TryToPolynomialForm(ExpressionOperator.LessThan, e1, e2, decoder, out ltPol)) { if (ltPol.Degree == 0) { // If it is a constant var leftConstant = ltPol.Left[0].K; var rightConstant = ltPol.Right[0].K; if (leftConstant < rightConstant) { return CheckOutcome.True; } else if (leftConstant >= rightConstant) { return CheckOutcome.False; } } else if (ltPol.Degree == 1) { Variable x; Rational k1, k2; if (ltPol.TryMatch_k1XLessThank2(out k1, out x, out k2) && k1 == -1) { // -1 * x < k2 var b = oracleDomain.BoundsFor(x); if (!b.IsTop && -b.LowerBound < k2) { return CheckOutcome.True; } } } } return CheckOutcome.Top; } static public FlatAbstractDomain<bool> CheckGreaterEqualThanZero<Variable, Expression>(Expression e, IExpressionDecoder<Variable, Expression> decoder) { var anIntervalDomain = new IntervalEnvironment<Variable, Expression>(decoder, VoidLogger.Log); return anIntervalDomain.CheckIfGreaterEqualThanZero(e); } /// <summary> /// If the expression is an equality or disequality, see it the two operands are the same symbolic value /// </summary> static public bool CheckTrivialEquality<Variable, Expression>(Expression exp, IExpressionDecoder<Variable, Expression> decoder) { var op = decoder.OperatorFor(exp); switch (op) { case ExpressionOperator.Equal: case ExpressionOperator.Equal_Obj: { // Is the case that left == right ? var left = decoder.LeftExpressionFor(exp); var right = decoder.RightExpressionFor(exp); if (op == ExpressionOperator.Equal && (decoder.IsNaN(left) || decoder.IsNaN(right))) { return false; } if (left.Equals(right) || decoder.UnderlyingVariable(left).Equals(decoder.UnderlyingVariable(right))) { // left == right return true; } else { var strippedLeft = decoder.Stripped(left); var strippedRight = decoder.Stripped(right); return strippedLeft.Equals(strippedRight) || decoder.UnderlyingVariable(strippedLeft).Equals(decoder.UnderlyingVariable(strippedRight)); } } case ExpressionOperator.NotEqual: { // Is the case that (x == x) != 0 ? int value; var left = decoder.LeftExpressionFor(exp); if (decoder.OperatorFor(left) == ExpressionOperator.Equal && decoder.IsConstantInt(decoder.RightExpressionFor(exp), out value) && value == 0) { return decoder.LeftExpressionFor(left).Equals(decoder.RightExpressionFor(left)); } return false; } default: return false; } } static public bool CheckTrivialEquality<Variable, Expression>(Expression e1, Expression e2, IExpressionDecoder<Variable, Expression> decoder, out FlatAbstractDomain<bool> outcome) { if (decoder.UnderlyingVariable(e1).Equals(decoder.UnderlyingVariable(e2))) { outcome = CheckOutcome.True; return true; } int v1, v2; if (decoder.IsConstantInt(e1, out v1) && decoder.IsConstantInt(e2, out v2)) { outcome = v1 == v2 ? CheckOutcome.True : CheckOutcome.False; return true; } outcome = CheckOutcome.Top; return false; } } #region Visitors for the expressions abstract public class GenericExpressionVisitor<In, Out, Variable, Expression> { #region Object invariant [ContractInvariantMethod] private void ObjectInvariant() { Contract.Invariant(decoder != null); } #endregion #region Private state private IExpressionDecoder<Variable, Expression> decoder; #endregion #region Protected state protected IExpressionDecoder<Variable, Expression> Decoder { get { Contract.Ensures(Contract.Result<IExpressionDecoder<Variable, Expression>>() != null); return decoder; } } #endregion #region Constructor public GenericExpressionVisitor(IExpressionDecoder<Variable, Expression> decoder) { Contract.Requires(decoder != null); this.decoder = decoder; } #endregion abstract protected Out Default(In data); virtual public Out Visit(Expression exp, In data) { Contract.Requires(exp != null); Contract.Ensures(Contract.Result<Out>() != null); var op = decoder.OperatorFor(exp); switch (op) { #region All the cases case ExpressionOperator.Addition_Overflow: return VisitAddition_Overflow(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.Addition: return VisitAddition(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.And: return VisitAnd(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.Constant: return VisitConstant(exp, data); case ExpressionOperator.ConvertToInt8: return VisitConvertToInt8(decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.ConvertToInt32: return VisitConvertToInt32(decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.ConvertToUInt8: return VisitConvertToUInt8(decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.ConvertToUInt16: return VisitConvertToUInt16(decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.ConvertToFloat32: return VisitConvertToFloat32(decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.ConvertToFloat64: return VisitConvertToFloat64(decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.ConvertToUInt32: return VisitConvertToUInt32(decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.Division: return VisitDivision(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.Equal: case ExpressionOperator.Equal_Obj: // we want to handle cases as "(a <= b) == 0" rewritten to "a > b" return DispatchVisitEqual(op, decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.GreaterEqualThan: return VisitGreaterEqualThan(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.GreaterEqualThan_Un: return VisitGreaterEqualThan_Un(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.GreaterThan: return VisitGreaterThan(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.GreaterThan_Un: return VisitGreaterThan_Un(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.LessEqualThan: return DispatchCompare(VisitLessEqualThan, decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.LessEqualThan_Un: return DispatchCompare(VisitLessEqualThan_Un, decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.LessThan: return DispatchCompare(VisitLessThan, decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.LessThan_Un: return DispatchCompare(VisitLessThan_Un, decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.LogicalAnd: return VisitLogicalAnd(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.LogicalNot: return VisitLogicalNot(decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.LogicalOr: return VisitLogicalOr(decoder.Disjunctions(exp), exp, data); case ExpressionOperator.Modulus: return VisitModulus(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.Multiplication: return VisitMultiplication(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.Multiplication_Overflow: return VisitMultiplication_Overflow(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.Not: return DispatchVisitNot(decoder.LeftExpressionFor(exp), data); case ExpressionOperator.NotEqual: return VisitNotEqual(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.Or: return VisitOr(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.ShiftLeft: return VisitShiftLeft(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.ShiftRight: return VisitShiftRight(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.SizeOf: return VisitSizeOf(exp, data); case ExpressionOperator.Subtraction: return VisitSubtraction(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.Subtraction_Overflow: return VisitSubtraction_Overflow(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.UnaryMinus: return VisitUnaryMinus(decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.Unknown: return VisitUnknown(exp, data); case ExpressionOperator.WritableBytes: return VisitWritableBytes(decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.Variable: return VisitVariable(decoder.UnderlyingVariable(exp), exp, data); case ExpressionOperator.Xor: return VisitXor(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); default: Contract.Assert(false); throw new AbstractInterpretationException("I do not know this expression symbol " + decoder.OperatorFor(exp)); #endregion } } private Out DispatchVisitEqual(ExpressionOperator eqKind, Expression left, Expression right, Expression original, In data) { Contract.Requires(eqKind == ExpressionOperator.Equal || eqKind == ExpressionOperator.Equal_Obj); Contract.Requires(left != null); Contract.Requires(right != null); // Try matching ==(RelOp(l1, l2), right), RelOp is a relation operator and right is a constant var op = decoder.OperatorFor(left); if (op == ExpressionOperator.Equal || op == ExpressionOperator.Equal_Obj || op.IsGreaterEqualThan() || op.IsGreaterThan() || op.IsLessEqualThan() || op.IsLessThan()) { bool shouldnegate; if (this.TryPolarity(right, data, out shouldnegate)) { if (shouldnegate) { return DispatchVisitNot(left, data); } else { return Visit(left, data); } } if (this.TryPolarity(left, data, out shouldnegate)) { if (shouldnegate) { return DispatchVisitNot(right, data); } else { return Visit(right, data); } } } // visit "left == right" if (eqKind == ExpressionOperator.Equal) { return VisitEqual(left, right, original, data); } else { Contract.Assert(eqKind == ExpressionOperator.Equal_Obj); return VisitEqual_Obj(left, right, original, data); } } virtual protected bool TryPolarity(Expression exp, In data, out bool shouldNegate) { Contract.Requires(exp != null); if (decoder.IsConstant(exp)) { int intValue; if (decoder.TryValueOf<Int32>(exp, ExpressionType.Int32, out intValue)) { shouldNegate = intValue == 0; return true; } bool boolValue; if (decoder.TryValueOf<bool>(exp, ExpressionType.Bool, out boolValue)) { shouldNegate = boolValue; return true; } } shouldNegate = default(bool); return false; } private Out DispatchVisitNot(Expression exp, In data) { Contract.Requires(exp != null); switch (decoder.OperatorFor(exp)) { case ExpressionOperator.GreaterEqualThan: case ExpressionOperator.GreaterEqualThan_Un: // !(a >= b) = a < b return DispatchCompare(VisitLessThan, decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.GreaterThan: // !(a > b) = a <= b return DispatchCompare(VisitLessEqualThan, decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.GreaterThan_Un: // !(a > b) = a <= b return DispatchCompare(VisitLessEqualThan_Un, decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); case ExpressionOperator.LessEqualThan: // !(a <= b) = b < a return DispatchCompare(VisitLessThan, decoder.RightExpressionFor(exp), decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.LessEqualThan_Un: // !(a <= b) = b < a return DispatchCompare(VisitLessThan_Un, decoder.RightExpressionFor(exp), decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.LessThan: // !(a < b) = b <= a return DispatchCompare(VisitLessEqualThan, decoder.RightExpressionFor(exp), decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.LessThan_Un: // !(a < b) = b <= a return DispatchCompare(VisitLessEqualThan_Un, decoder.RightExpressionFor(exp), decoder.LeftExpressionFor(exp), exp, data); case ExpressionOperator.Equal: case ExpressionOperator.Equal_Obj: // !(a == b) = a != b return VisitNotEqual(decoder.LeftExpressionFor(exp), decoder.RightExpressionFor(exp), exp, data); default: return VisitNot(exp, data); } } protected delegate Out CompareVisitor(Expression left, Expression right, Expression original, In data); /// <summary> /// Factors out some code so that for instance a - b \leq 0, becomes a \leq b /// </summary> virtual protected Out DispatchCompare(CompareVisitor cmp, Expression left, Expression right, Expression original, In data) { Contract.Requires(cmp != null); if (decoder.IsConstant(left) && decoder.OperatorFor(right) == ExpressionOperator.Subtraction) { Int32 value; if (decoder.TryValueOf<Int32>(left, ExpressionType.Int32, out value) && value == 0) { return cmp(decoder.RightExpressionFor(right), decoder.LeftExpressionFor(right), right, data); } else { return cmp(left, right, original, data); } } if (decoder.IsConstant(right) && decoder.OperatorFor(left) == ExpressionOperator.Subtraction) { Int32 value; if (decoder.TryValueOf<Int32>(right, ExpressionType.Int32, out value) && value == 0) { return cmp(decoder.LeftExpressionFor(left), decoder.RightExpressionFor(left), left, data); } else { return cmp(left, right, original, data); } } return cmp(left, right, original, data); } #region The default Visitors virtual public Out VisitAddition(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitAddition_Overflow(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return VisitAddition(left, right, original, data); } virtual public Out VisitAnd(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitConstant(Expression left, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitConvertToInt8(Expression left, Expression original, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitConvertToInt32(Expression left, Expression original, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitConvertToUInt8(Expression left, Expression original, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitConvertToUInt16(Expression left, Expression original, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitConvertToUInt32(Expression left, Expression original, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitConvertToFloat32(Expression left, Expression original, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitConvertToFloat64(Expression left, Expression original, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitDivision(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitEqual(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitEqual_Obj(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitGreaterEqualThan(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return DispatchCompare(VisitLessEqualThan, right, left, original, data); } virtual public Out VisitGreaterEqualThan_Un(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return DispatchCompare(VisitLessEqualThan_Un, right, left, original, data); } virtual public Out VisitGreaterThan(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return DispatchCompare(VisitLessThan, right, left, original, data); } virtual public Out VisitGreaterThan_Un(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); // Since there is no cne instruction, ECMA-335 §III.1.5 makes a note that cgt.un may // be used instead for the specific case where the right-hand-side is null. If the // right side is null, we treat the instruction as a "not equal" instruction for // improved results from the static checker. if (decoder.IsNull(right)) return VisitNotEqual(left, right, original, data); return DispatchCompare(VisitLessThan_Un, right, left, original, data); } virtual public Out VisitLessEqualThan(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } /// <summary> /// Default: dispatch to VisitLessEqualThan /// </summary> virtual public Out VisitLessEqualThan_Un(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return VisitLessEqualThan(left, right, original, data); } virtual public Out VisitLessThan(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } /// <summary> /// Default: dispatch to VisistLessThan /// </summary> virtual public Out VisitLessThan_Un(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return VisitLessThan(left, right, original, data); } virtual public Out VisitLogicalAnd(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitLogicalNot(Expression left, Expression original, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitLogicalOr(IEnumerable<Expression> disjunctions, Expression original, In data) { Contract.Requires(disjunctions != null); return Default(data); } virtual public Out VisitModulus(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitMultiplication(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitMultiplication_Overflow(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return VisitMultiplication(left, right, original, data); } virtual public Out VisitNot(Expression left, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitNotEqual(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitOr(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitShiftLeft(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitShiftRight(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitSizeOf(Expression left, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitSubtraction(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } virtual public Out VisitSubtraction_Overflow(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return VisitSubtraction(left, right, original, data); } virtual public Out VisitUnaryMinus(Expression left, Expression original, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitUnknown(Expression left, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitVariable(Variable variable, Expression original, In data) { return Default(data); } virtual public Out VisitWritableBytes(Expression left, Expression wholeExpression, In data) { Contract.Requires(left != null); return Default(data); } virtual public Out VisitXor(Expression left, Expression right, Expression original, In data) { Contract.Requires(left != null); Contract.Requires(right != null); return Default(data); } #endregion } abstract public class GenericNormalizingExpressionVisitor<Data, Variable, Expression> : GenericExpressionVisitor<Data, Data, Variable, Expression> { public GenericNormalizingExpressionVisitor(IExpressionDecoder<Variable, Expression> decoder) : base(decoder) { } /// <summary> /// a \geq b ==> b \leq a /// </summary> sealed public override Data VisitGreaterEqualThan(Expression left, Expression right, Expression original, Data data) { return VisitLessEqualThan(right, left, original, data); } /// <summary> /// a \gt b ==> b \lt a /// </summary> sealed public override Data VisitGreaterThan(Expression left, Expression right, Expression original, Data data) { return VisitLessThan(right, left, original, data); } } abstract public class GenericTypeExpressionVisitor<Variable, Expression, In, Out> { [ContractInvariantMethod] private void ObjectInvariant() { Contract.Invariant(decoder != null); } private IExpressionDecoder<Variable, Expression> decoder; protected IExpressionDecoder<Variable, Expression> Decoder { get { Contract.Ensures(Contract.Result<IExpressionDecoder<Variable, Expression>>() != null); return decoder; } } public GenericTypeExpressionVisitor(IExpressionDecoder<Variable, Expression> decoder) { Contract.Requires(decoder != null); this.decoder = decoder; } virtual public Out Visit(Expression exp, In input) { Contract.Requires(exp != null); switch (decoder.TypeOf(exp)) { case ExpressionType.Bool: return VisitBool(exp, input); case ExpressionType.Float32: return VisitFloat32(exp, input); case ExpressionType.Float64: return VisitFloat64(exp, input); case ExpressionType.Int8: return VisitInt8(exp, input); case ExpressionType.Int16: return VisitInt16(exp, input); case ExpressionType.Int32: return VisitInt32(exp, input); case ExpressionType.Int64: return VisitInt64(exp, input); case ExpressionType.String: return VisitString(exp, input); case ExpressionType.UInt8: return VisitUInt8(exp, input); case ExpressionType.UInt16: return VisitUInt16(exp, input); case ExpressionType.UInt32: return VisitUInt32(exp, input); case ExpressionType.Unknown: return Default(exp); default: throw new AbstractInterpretationException("Unknown type for expressions " + decoder.TypeOf(exp)); } } virtual public Out VisitFloat64(Expression exp, In input) { return Default(exp); } virtual public Out VisitFloat32(Expression exp, In input) { return Default(exp); } virtual public Out VisitBool(Expression/*!*/ exp, In/*!*/ input) { return Default(exp); } virtual public Out VisitInt8(Expression/*!*/ exp, In/*!*/ input) { return Default(exp); } virtual public Out VisitInt16(Expression/*!*/ exp, In/*!*/ input) { return Default(exp); } virtual public Out VisitInt32(Expression/*!*/ exp, In/*!*/ input) { return Default(exp); } virtual public Out VisitInt64(Expression/*!*/ exp, In/*!*/ input) { return Default(exp); } virtual public Out VisitString(Expression/*!*/ exp, In/*!*/ input) { return Default(exp); } virtual public Out VisitUInt8(Expression/*!*/ exp, In/*!*/ input) { return Default(exp); } virtual public Out VisitUInt16(Expression/*!*/ exp, In/*!*/ input) { return Default(exp); } virtual public Out VisitUInt32(Expression/*!*/ exp, In/*!*/ input) { return Default(exp); } public abstract Out Default(Expression exp); } abstract public class TestTrueVisitor<AbstractDomain, Variable, Expression> : GenericNormalizingExpressionVisitor<AbstractDomain, Variable, Expression> where AbstractDomain : IAbstractDomainForEnvironments<Variable, Expression> { #region Constants private const int MAXDISJUNCTS = 4; #endregion #region Private state private TestFalseVisitor<AbstractDomain, Variable, Expression> falseVisitor; private AbstractDomain result; #endregion protected TestTrueVisitor(IExpressionDecoder<Variable, Expression> decoder) : base(decoder) { } #region Protected internal TestFalseVisitor<AbstractDomain, Variable, Expression> FalseVisitor { get { return falseVisitor; } set { // this.trueVisitor == null Contract.Requires(value != null); Contract.Assume(falseVisitor == null, "Why are you setting twice the false visitor?"); // let's leave it as a runtime check falseVisitor = value; } } #endregion #region TO BE OVERRIDDEN! abstract override public AbstractDomain VisitEqual(Expression left, Expression right, Expression original, AbstractDomain data); abstract public override AbstractDomain VisitLessEqualThan(Expression left, Expression right, Expression original, AbstractDomain data); abstract public override AbstractDomain VisitLessThan(Expression left, Expression right, Expression original, AbstractDomain data); abstract public override AbstractDomain VisitNotEqual(Expression left, Expression right, Expression original, AbstractDomain data); abstract public override AbstractDomain VisitVariable(Variable var, Expression original, AbstractDomain data); #endregion protected override AbstractDomain Default(AbstractDomain data) { return data; } public override AbstractDomain VisitLogicalAnd(Expression left, Expression right, Expression original, AbstractDomain data) { var isLeftAVar = this.Decoder.IsVariable(left); var isLeftAConst = this.Decoder.IsConstant(left); var isRightAVar = this.Decoder.IsVariable(right); var isRightAConst = this.Decoder.IsConstant(right); if ((isLeftAVar && isRightAConst) || (isLeftAConst && isRightAVar)) { result = data; } else { var cloned = (AbstractDomain)data.Clone(); cloned = (AbstractDomain)cloned.TestTrue(left); cloned = (AbstractDomain)cloned.TestTrue(right); result = cloned; } return result; } public override AbstractDomain VisitConstant(Expression left, AbstractDomain data) { bool success; Int32 v; #region [[0]] == \bot, [[1]] == state if (this.Decoder.TryValueOf<bool>(left, ExpressionType.Bool, out success)) { if (success == false) { result = (AbstractDomain)data.Bottom; } else { result = data; } } else if (this.Decoder.TryValueOf<Int32>(left, ExpressionType.Int32, out v)) { if (v != 0) { result = data; } else { result = (AbstractDomain)data.Bottom; } } else { result = data; } #endregion return result; } public override AbstractDomain VisitConvertToInt32(Expression left, Expression original, AbstractDomain data) { return Visit(left, data); } public override AbstractDomain VisitConvertToUInt8(Expression left, Expression original, AbstractDomain data) { return Visit(left, data); } public override AbstractDomain VisitConvertToUInt16(Expression left, Expression original, AbstractDomain data) { return Visit(left, data); } public override AbstractDomain VisitConvertToUInt32(Expression left, Expression original, AbstractDomain data) { return Visit(left, data); } public override AbstractDomain VisitNot(Expression left, AbstractDomain data) { return this.FalseVisitor.Visit(left, data); } public override AbstractDomain VisitLogicalOr(IEnumerable<Expression> disjuncts, Expression original, AbstractDomain data) { if (disjuncts.Count() > MAXDISJUNCTS) { return data; } var immutable = (AbstractDomain)data.Clone(); var r = data; var first = true; foreach (var dis in disjuncts) { if (first) { r = (AbstractDomain)data.TestTrue(dis); first = false; } else { var tmp = ((AbstractDomain)immutable.Clone()).TestTrue(dis); r = (AbstractDomain)r.Join(tmp); } if (r.IsTop) { break; } } return (result = r); } protected override bool TryPolarity(Expression exp, AbstractDomain data, out bool shouldNegate) { if (base.TryPolarity(exp, data, out shouldNegate)) { return true; } var tryTautology = data.CheckIfHolds(exp); if (tryTautology.IsNormal()) { shouldNegate = tryTautology.IsFalse(); return true; } // shouldNegate already set by base.TryPolarity return false; } } abstract internal class TestFalseVisitor<AbstractDomain, Variable, Expression> : GenericNormalizingExpressionVisitor<AbstractDomain, Variable, Expression> where AbstractDomain : IAbstractDomainForEnvironments<Variable, Expression> { #region protected state private TestTrueVisitor<AbstractDomain, Variable, Expression> trueVisitor; #endregion #region Constructor protected TestFalseVisitor(IExpressionDecoder<Variable, Expression> decoder) : base(decoder) { } #endregion /// <summary> /// The visitor for the positive case /// </summary> internal TestTrueVisitor<AbstractDomain, Variable, Expression> TrueVisitor { get { Contract.Ensures(Contract.Result<TestTrueVisitor<AbstractDomain, Variable, Expression>>() != null); Contract.Assume(trueVisitor != null); // F: When calling this method, the visitor should have already been set return trueVisitor; } set { Contract.Assume(trueVisitor == null, "Why are you setting twice the true visitor?"); trueVisitor = value; } } #region TO BE OVERRIDDEN! abstract public override AbstractDomain VisitVariable(Variable variable, Expression original, AbstractDomain data); #endregion protected override AbstractDomain Default(AbstractDomain data) { return data; } public override AbstractDomain VisitEqual(Expression left, Expression right, Expression original, AbstractDomain data) { Int32 value; // !((a relop b) == 0) => a reolpb if (this.Decoder.TryValueOf<Int32>(right, ExpressionType.Int32, out value) && value == 0) if (!this.Decoder.IsConstant(left) && !this.Decoder.IsVariable(left) && !this.Decoder.IsUnaryExpression(left)) { return this.TrueVisitor.Visit(left, data); } // !(a == b) -> a != b return this.TrueVisitor.VisitNotEqual(left, right, original, data); } public override AbstractDomain VisitLessEqualThan(Expression left, Expression right, Expression original, AbstractDomain data) { // !(a <= b) -> a > b -> b < a return this.TrueVisitor.VisitLessThan(right, left, original, data); } public override AbstractDomain VisitLessEqualThan_Un(Expression left, Expression right, Expression original, AbstractDomain data) { return this.TrueVisitor.VisitLessThan_Un(right, left, original, data); } public override AbstractDomain VisitLessThan(Expression left, Expression right, Expression original, AbstractDomain data) { // !(a < b) -> a >= b -> b <= a return this.TrueVisitor.VisitLessEqualThan(right, left, original, data); } public override AbstractDomain VisitLessThan_Un(Expression left, Expression right, Expression original, AbstractDomain data) { return this.TrueVisitor.VisitLessEqualThan_Un(right, left, original, data); } public override AbstractDomain VisitNot(Expression left, AbstractDomain data) { // !(!a) -> a return this.TrueVisitor.Visit(left, data); } public override AbstractDomain VisitNotEqual(Expression left, Expression right, Expression original, AbstractDomain data) { // ! (a != b) -> a == b return this.TrueVisitor.VisitEqual(left, right, original, data); } public override AbstractDomain VisitLogicalAnd(Expression leftGuard, Expression rightGuard, Expression original, AbstractDomain data) { // ! (a && b) -> !a || !b IAbstractDomainForEnvironments<Variable, Expression>/*!*/ leftDomain, rightDomain; AbstractDomain/*!*/ result; var isLeftAVar = this.Decoder.IsVariable(leftGuard); var isLeftAConst = this.Decoder.IsConstant(leftGuard); var isRightAVar = this.Decoder.IsVariable(rightGuard); var isRightAConst = this.Decoder.IsConstant(rightGuard); if ((isLeftAVar && isRightAConst) || (isLeftAConst && isRightAVar)) { result = data; } else if (this.Decoder.TypeOf(leftGuard) == ExpressionType.Bool && this.Decoder.TypeOf(rightGuard) == ExpressionType.Bool) { // Use de morgan laws leftDomain = data.TestFalse(leftGuard); rightDomain = data.TestFalse(rightGuard); result = (AbstractDomain)leftDomain.Join(rightDomain); } else { result = data; } return result; } public override AbstractDomain VisitConstant(Expression guard, AbstractDomain data) { AbstractDomain result; bool b; Int32 v; if (this.Decoder.TryValueOf<bool>(guard, ExpressionType.Bool, out b)) { if (!b) { result = data; } else { result = (AbstractDomain)data.Bottom; } } else if (this.Decoder.TryValueOf<Int32>(guard, ExpressionType.Int32, out v)) { if (v == 0) { result = data; } else { result = (AbstractDomain)data.Bottom; } } else { result = data; } return result; } public override AbstractDomain VisitConvertToInt32(Expression left, Expression original, AbstractDomain data) { return this.Visit(left, data); } public override AbstractDomain VisitConvertToUInt8(Expression left, Expression original, AbstractDomain data) { return this.Visit(left, data); } public override AbstractDomain VisitConvertToUInt16(Expression left, Expression original, AbstractDomain data) { return this.Visit(left, data); } public override AbstractDomain VisitConvertToUInt32(Expression left, Expression original, AbstractDomain data) { return this.Visit(left, data); } public override AbstractDomain VisitLogicalOr(IEnumerable<Expression> disjuncts, Expression original, AbstractDomain data) { // ! (a || b) -> !a && !b var result = (AbstractDomain)data.Clone(); foreach (var dis in disjuncts) { result = (AbstractDomain)result.TestFalse(dis); } return result; } } /// <summary> /// The base class to be used as starting point in the implementation of CheckIfHolds in the abstract domains /// </summary> abstract public class CheckIfHoldsVisitor<AbstractDomain, Variable, Expression> : GenericNormalizingExpressionVisitor<FlatAbstractDomain<bool>, Variable, Expression> where AbstractDomain : INumericalAbstractDomain<Variable, Expression> { private AbstractDomain domain; protected AbstractDomain Domain { get { Contract.Ensures(Contract.Result<AbstractDomain>() != null); return domain; } } public CheckIfHoldsVisitor(IExpressionDecoder<Variable, Expression> decoder) : base(decoder) { Contract.Requires(decoder != null); } /// <summary> /// The entry point for checking if the expression <code>exp</code> holds in the state <code>domain</code> /// </summary> public FlatAbstractDomain<bool> Visit(Expression exp, AbstractDomain domain) { Contract.Requires(exp != null); Contract.Requires(domain != null); Contract.Ensures(Contract.Result<FlatAbstractDomain<bool>>() != null); this.domain = domain; var result = base.Visit(exp, CheckOutcome.Top); return result; } #region To be implemented by the client public override FlatAbstractDomain<bool> VisitEqual(Expression left, Expression right, Expression original, FlatAbstractDomain<bool> data) { var leftType = this.Decoder.TypeOf(left); var rightType = this.Decoder.TypeOf(right); // if they are not floats, and Var(left).Equals(Var(right)) if (!leftType.IsFloatingPointType() && !rightType.IsFloatingPointType()) { if (left.Equals(right) // We check for expression equality as the WP may have generated the same expression || this.Decoder.UnderlyingVariable(left).Equals(this.Decoder.UnderlyingVariable(right))) { return CheckOutcome.True; } } return CheckOutcome.Top; } public abstract override FlatAbstractDomain<bool> VisitEqual_Obj(Expression left, Expression right, Expression original, FlatAbstractDomain<bool> data); public abstract override FlatAbstractDomain<bool> VisitLessEqualThan(Expression left, Expression right, Expression original, FlatAbstractDomain<bool> data); public abstract override FlatAbstractDomain<bool> VisitLessThan(Expression left, Expression right, Expression original, FlatAbstractDomain<bool> data); #endregion #region Some standard implementations public override FlatAbstractDomain<bool> VisitAddition(Expression left, Expression right, Expression original, FlatAbstractDomain<bool> data) { return this.Domain.CheckIfNonZero(original); } public override FlatAbstractDomain<bool> VisitLogicalAnd(Expression left, Expression right, Expression original, FlatAbstractDomain<bool> data) { var resultLeft = Visit(left, data); // false && X == false if (resultLeft.IsFalse()) { return resultLeft; } var resultRight = Visit(right, data); // top && false == resultRight == true && resultRight if (resultRight.IsFalse() || (resultLeft.IsTrue() && resultRight.IsNormal())) { return resultRight; } return CheckOutcome.Top; } public override FlatAbstractDomain<bool> VisitLogicalOr(IEnumerable<Expression> disjuncts, Expression original, FlatAbstractDomain<bool> data) { var allBottoms = true; foreach (var dis in disjuncts) { var outcome = Visit(dis, data); if (outcome.IsTrue()) { return outcome; } if (outcome.IsFalse() || outcome.IsTop) { allBottoms = false; continue; } } return allBottoms ? CheckOutcome.Bottom : CheckOutcome.Top; /* var resultLeft = Visit(left, data); if (resultLeft.IsTrue()) { return resultLeft; } var resultRight = Visit(right, data); if (resultLeft.IsFalse()) { return resultRight; } if (resultLeft.IsBottom) { return resultRight; } if (resultRight.IsBottom) { return resultLeft; } if (resultLeft.IsTop) { return resultRight; } if (resultRight.IsTop) { return resultLeft; } return new FlatAbstractDomain<bool>(resultLeft.BoxedElement || resultRight.BoxedElement); */ } public override FlatAbstractDomain<bool> VisitConstant(Expression left, FlatAbstractDomain<bool> data) { var value = new IntervalEnvironment<Variable, Expression>.EvalConstantVisitor(this.Decoder).Visit(left, new IntervalEnvironment<Variable, Expression>(this.Decoder, VoidLogger.Log)); Contract.Assert(!value.IsBottom); if (value.IsTop) { return CheckOutcome.Top; } Rational v; if (value.TryGetSingletonValue(out v)) { if (v.IsNotZero) { return CheckOutcome.True; } else { return CheckOutcome.False; } } // We can return Top if for instance left is -oo or +oo (doubles) return CheckOutcome.Top; } public override FlatAbstractDomain<bool> VisitDivision(Expression left, Expression right, Expression original, FlatAbstractDomain<bool> data) { return this.Visit(left, data); } public override FlatAbstractDomain<bool> VisitModulus(Expression left, Expression right, Expression original, FlatAbstractDomain<bool> data) { return this.Domain.CheckIfNonZero(original); } public override FlatAbstractDomain<bool> VisitMultiplication(Expression left, Expression right, Expression original, FlatAbstractDomain<bool> data) { return this.Domain.CheckIfNonZero(original); } public override FlatAbstractDomain<bool> VisitSubtraction(Expression left, Expression right, Expression original, FlatAbstractDomain<bool> data) { return this.Domain.CheckIfNonZero(original); } public override FlatAbstractDomain<bool> VisitNot(Expression left, FlatAbstractDomain<bool> data) { var leftHolds = this.Visit(left, data); if (leftHolds.IsNormal()) { return new FlatAbstractDomain<bool>(!leftHolds.BoxedElement); } else { return leftHolds; } } public override FlatAbstractDomain<bool> VisitUnaryMinus(Expression left, Expression original, FlatAbstractDomain<bool> data) { return this.Domain.CheckIfNonZero(left); } public override FlatAbstractDomain<bool> VisitXor(Expression left, Expression right, Expression original, FlatAbstractDomain<bool> data) { return this.Domain.CheckIfNonZero(original); } protected override FlatAbstractDomain<bool> Default(FlatAbstractDomain<bool> data) { return CheckOutcome.Top; } #endregion } internal class Void { static public Void Value { get { return new Void(); } } } internal class GetAThresholdVisitor<Variable, Expression> : GenericExpressionVisitor<Void, bool, Variable, Expression> { private List<int> thresholds; public List<int> Thresholds { get { return thresholds; } } public GetAThresholdVisitor(IExpressionDecoder<Variable, Expression> decoder) : base(decoder) { thresholds = new List<int>(); } public override bool VisitConstant(Expression left, Void data) { int v; if (this.Decoder.IsConstantInt(left, out v)) { thresholds.Add(v); return true; } else { return false; } } public override bool VisitConvertToInt32(Expression left, Expression original, Void data) { return this.Visit(left, data); } public override bool VisitConvertToUInt16(Expression left, Expression original, Void data) { return this.Visit(left, data); } public override bool VisitConvertToUInt32(Expression left, Expression original, Void data) { return this.Visit(left, data); } public override bool VisitConvertToUInt8(Expression left, Expression original, Void data) { return this.Visit(left, data); } public override bool VisitEqual(Expression left, Expression right, Expression original, Void data) { return this.VisitBinary(left, right, data); } public override bool VisitNotEqual(Expression left, Expression right, Expression original, Void data) { return this.VisitBinary(left, right, data); } public override bool VisitGreaterEqualThan(Expression left, Expression right, Expression original, Void data) { return this.VisitBinary(left, right, data); } public override bool VisitGreaterThan(Expression left, Expression right, Expression original, Void data) { return this.VisitBinary(left, right, data); } public override bool VisitLessEqualThan(Expression left, Expression right, Expression original, Void data) { return this.VisitBinary(left, right, data); } public override bool VisitLessThan(Expression left, Expression right, Expression original, Void data) { return this.VisitBinary(left, right, data); } protected override bool Default(Void data) { return false; } private bool VisitBinary(Expression left, Expression right, Void data) { bool b1 = this.Visit(left, data); bool b2 = this.Visit(right, data); return b1 || b2; } } #endregion }
{ "pile_set_name": "Github" }
package Paws::ApiGateway::CreateModel; use Moose; has ContentType => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'contentType', required => 1); has Description => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'description'); has Name => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'name', required => 1); has RestApiId => (is => 'ro', isa => 'Str', traits => ['ParamInURI'], uri_name => 'restapi_id', required => 1); has Schema => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'schema'); use MooseX::ClassAttribute; class_has _api_call => (isa => 'Str', is => 'ro', default => 'CreateModel'); class_has _api_uri => (isa => 'Str', is => 'ro', default => '/restapis/{restapi_id}/models'); class_has _api_method => (isa => 'Str', is => 'ro', default => 'POST'); class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::ApiGateway::Model'); 1; ### main pod documentation begin ### =head1 NAME Paws::ApiGateway::CreateModel - Arguments for method CreateModel on L<Paws::ApiGateway> =head1 DESCRIPTION This class represents the parameters used for calling the method CreateModel on the L<Amazon API Gateway|Paws::ApiGateway> service. Use the attributes of this class as arguments to method CreateModel. You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to CreateModel. =head1 SYNOPSIS my $apigateway = Paws->service('ApiGateway'); my $Model = $apigateway->CreateModel( ContentType => 'MyString', Name => 'MyString', RestApiId => 'MyString', Description => 'MyString', # OPTIONAL Schema => 'MyString', # OPTIONAL ); # Results: my $ContentType = $Model->ContentType; my $Description = $Model->Description; my $Id = $Model->Id; my $Name = $Model->Name; my $Schema = $Model->Schema; # Returns a L<Paws::ApiGateway::Model> object. Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object. For the AWS API documentation, see L<https://docs.aws.amazon.com/goto/WebAPI/apigateway/CreateModel> =head1 ATTRIBUTES =head2 B<REQUIRED> ContentType => Str [Required] The content-type for the model. =head2 Description => Str The description of the model. =head2 B<REQUIRED> Name => Str [Required] The name of the model. Must be alphanumeric. =head2 B<REQUIRED> RestApiId => Str [Required] The RestApi identifier under which the Model will be created. =head2 Schema => Str The schema for the model. For C<application/json> models, this should be JSON schema draft 4 (https://tools.ietf.org/html/draft-zyp-json-schema-04) model. =head1 SEE ALSO This class forms part of L<Paws>, documenting arguments for method CreateModel in L<Paws::ApiGateway> =head1 BUGS and CONTRIBUTIONS The source code is located here: L<https://github.com/pplu/aws-sdk-perl> Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> =cut
{ "pile_set_name": "Github" }
package ru.surfstudio.android.core.mvi.sample.ui.screen.reducer_based.kitties import android.content.Context import android.content.Intent import ru.surfstudio.android.core.ui.navigation.activity.route.ActivityRoute internal class KittiesActivityRoute : ActivityRoute() { override fun prepareIntent(context: Context?): Intent = Intent(context, KittiesActivityView::class.java) }
{ "pile_set_name": "Github" }
defmodule Blockchain.MempoolTest do use ExUnit.Case, async: false alias Blockchain.{Mempool, Block} test "handle_call mine_data add data to pool and start mining" do data = "foo" {:reply, response, new_state} = Mempool.handle_call({:mine, data}, nil, {[], {}}) assert response == :ok {pool, {ref, pid, block}} = new_state Process.monitor(pid) assert pool == [data] assert block.data == data receive do mess -> assert {:DOWN, ^ref, :process, ^pid, :normal} = mess end end test "handle_call mine_data do not change state if data already in pool" do data = "foo" state = {[data], {}} {:reply, response, new_state} = Mempool.handle_call({:mine, data}, nil, state) assert response == {:error, :already_in_pool} assert new_state == state end test "handle_call mine_data only add to pool if mining in progress" do data = "foo" pool = ["bar"] mining = {"some_ref", "some_pid", "block_candidate"} {:reply, response, new_state} = Mempool.handle_call({:mine, data}, nil, {pool, mining}) assert response == :ok assert new_state == {pool ++ [data], mining} end test "handle_call block_mined remove mined block data from the pool" do data = "foo" pool = ["bar", data] b = Block.generate_next_block(data) {:reply, response, new_state} = Mempool.handle_call({:block_mined, b}, nil, {pool, {}}) assert response == :ok {pool, {}} = new_state assert pool == ["bar"] end test "handle_call block_mined stop block mining if block number matches" do data = "foobar" {:reply, :ok, {[^data], {ref, pid, block} = mining} = state} = Mempool.handle_call({:mine, data}, nil, {[], {}}) mref = Process.monitor(pid) {:reply, response, new_state} = Mempool.handle_call({:block_mined, block}, nil, state) assert response == :ok assert new_state == {[], mining} for r <- [mref, ref] do receive do mess -> assert {:DOWN, ^r, :process, ^pid, :killed} = mess end end end test "handle_info DOWN clean up mining state" do data = "foobar" {:reply, :ok, {[^data], {ref, pid, _block}} = state} = Mempool.handle_call({:mine, data}, nil, {[], {}}) {:noreply, {_pool, mining}} = Mempool.handle_info({:DOWN, ref, :process, pid, :normal}, state) assert mining == {} end test "handle_info DOWN start mining next block in pool" do data1 = "foobar1" data2 = "foobar2" {:reply, :ok, {[^data1], {ref, pid, _block}} = state} = Mempool.handle_call({:mine, data1}, nil, {[], {}}) {:reply, :ok, {[^data1, ^data2], {_ref, _pid, _block}} = state} = Mempool.handle_call({:mine, data2}, nil, state) {:noreply, {_pool, mining}} = Mempool.handle_info({:DOWN, ref, :process, pid, :normal}, state) assert {_ref, _pid, %Block{data: ^data2}} = mining end end
{ "pile_set_name": "Github" }
/* * ADE7854/58/68/78 Polyphase Multifunction Energy Metering IC Driver (SPI Bus) * * Copyright 2010 Analog Devices Inc. * * Licensed under the GPL-2 or later. */ #include <linux/device.h> #include <linux/kernel.h> #include <linux/spi/spi.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/iio/iio.h> #include "ade7854.h" static int ade7854_spi_write_reg_8(struct device *dev, u16 reg_address, u8 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); struct spi_transfer xfer = { .tx_buf = st->tx, .bits_per_word = 8, .len = 4, }; mutex_lock(&st->buf_lock); st->tx[0] = ADE7854_WRITE_REG; st->tx[1] = (reg_address >> 8) & 0xFF; st->tx[2] = reg_address & 0xFF; st->tx[3] = value & 0xFF; ret = spi_sync_transfer(st->spi, &xfer, 1); mutex_unlock(&st->buf_lock); return ret; } static int ade7854_spi_write_reg_16(struct device *dev, u16 reg_address, u16 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); struct spi_transfer xfer = { .tx_buf = st->tx, .bits_per_word = 8, .len = 5, }; mutex_lock(&st->buf_lock); st->tx[0] = ADE7854_WRITE_REG; st->tx[1] = (reg_address >> 8) & 0xFF; st->tx[2] = reg_address & 0xFF; st->tx[3] = (value >> 8) & 0xFF; st->tx[4] = value & 0xFF; ret = spi_sync_transfer(st->spi, &xfer, 1); mutex_unlock(&st->buf_lock); return ret; } static int ade7854_spi_write_reg_24(struct device *dev, u16 reg_address, u32 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); struct spi_transfer xfer = { .tx_buf = st->tx, .bits_per_word = 8, .len = 6, }; mutex_lock(&st->buf_lock); st->tx[0] = ADE7854_WRITE_REG; st->tx[1] = (reg_address >> 8) & 0xFF; st->tx[2] = reg_address & 0xFF; st->tx[3] = (value >> 16) & 0xFF; st->tx[4] = (value >> 8) & 0xFF; st->tx[5] = value & 0xFF; ret = spi_sync_transfer(st->spi, &xfer, 1); mutex_unlock(&st->buf_lock); return ret; } static int ade7854_spi_write_reg_32(struct device *dev, u16 reg_address, u32 value) { int ret; struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); struct spi_transfer xfer = { .tx_buf = st->tx, .bits_per_word = 8, .len = 7, }; mutex_lock(&st->buf_lock); st->tx[0] = ADE7854_WRITE_REG; st->tx[1] = (reg_address >> 8) & 0xFF; st->tx[2] = reg_address & 0xFF; st->tx[3] = (value >> 24) & 0xFF; st->tx[4] = (value >> 16) & 0xFF; st->tx[5] = (value >> 8) & 0xFF; st->tx[6] = value & 0xFF; ret = spi_sync_transfer(st->spi, &xfer, 1); mutex_unlock(&st->buf_lock); return ret; } static int ade7854_spi_read_reg_8(struct device *dev, u16 reg_address, u8 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); int ret; struct spi_transfer xfers[] = { { .tx_buf = st->tx, .bits_per_word = 8, .len = 3, }, { .rx_buf = st->rx, .bits_per_word = 8, .len = 1, } }; mutex_lock(&st->buf_lock); st->tx[0] = ADE7854_READ_REG; st->tx[1] = (reg_address >> 8) & 0xFF; st->tx[2] = reg_address & 0xFF; ret = spi_sync_transfer(st->spi, xfers, ARRAY_SIZE(xfers)); if (ret) { dev_err(&st->spi->dev, "problem when reading 8 bit register 0x%02X", reg_address); goto error_ret; } *val = st->rx[0]; error_ret: mutex_unlock(&st->buf_lock); return ret; } static int ade7854_spi_read_reg_16(struct device *dev, u16 reg_address, u16 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); int ret; struct spi_transfer xfers[] = { { .tx_buf = st->tx, .bits_per_word = 8, .len = 3, }, { .rx_buf = st->rx, .bits_per_word = 8, .len = 2, } }; mutex_lock(&st->buf_lock); st->tx[0] = ADE7854_READ_REG; st->tx[1] = (reg_address >> 8) & 0xFF; st->tx[2] = reg_address & 0xFF; ret = spi_sync_transfer(st->spi, xfers, ARRAY_SIZE(xfers)); if (ret) { dev_err(&st->spi->dev, "problem when reading 16 bit register 0x%02X", reg_address); goto error_ret; } *val = be16_to_cpup((const __be16 *)st->rx); error_ret: mutex_unlock(&st->buf_lock); return ret; } static int ade7854_spi_read_reg_24(struct device *dev, u16 reg_address, u32 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); int ret; struct spi_transfer xfers[] = { { .tx_buf = st->tx, .bits_per_word = 8, .len = 3, }, { .rx_buf = st->rx, .bits_per_word = 8, .len = 3, } }; mutex_lock(&st->buf_lock); st->tx[0] = ADE7854_READ_REG; st->tx[1] = (reg_address >> 8) & 0xFF; st->tx[2] = reg_address & 0xFF; ret = spi_sync_transfer(st->spi, xfers, ARRAY_SIZE(xfers)); if (ret) { dev_err(&st->spi->dev, "problem when reading 24 bit register 0x%02X", reg_address); goto error_ret; } *val = (st->rx[0] << 16) | (st->rx[1] << 8) | st->rx[2]; error_ret: mutex_unlock(&st->buf_lock); return ret; } static int ade7854_spi_read_reg_32(struct device *dev, u16 reg_address, u32 *val) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); int ret; struct spi_transfer xfers[] = { { .tx_buf = st->tx, .bits_per_word = 8, .len = 3, }, { .rx_buf = st->rx, .bits_per_word = 8, .len = 4, } }; mutex_lock(&st->buf_lock); st->tx[0] = ADE7854_READ_REG; st->tx[1] = (reg_address >> 8) & 0xFF; st->tx[2] = reg_address & 0xFF; ret = spi_sync_transfer(st->spi, xfers, ARRAY_SIZE(xfers)); if (ret) { dev_err(&st->spi->dev, "problem when reading 32 bit register 0x%02X", reg_address); goto error_ret; } *val = be32_to_cpup((const __be32 *)st->rx); error_ret: mutex_unlock(&st->buf_lock); return ret; } static int ade7854_spi_probe(struct spi_device *spi) { int ret; struct ade7854_state *st; struct iio_dev *indio_dev; indio_dev = iio_device_alloc(sizeof(*st)); if (indio_dev == NULL) return -ENOMEM; st = iio_priv(indio_dev); spi_set_drvdata(spi, indio_dev); st->read_reg_8 = ade7854_spi_read_reg_8; st->read_reg_16 = ade7854_spi_read_reg_16; st->read_reg_24 = ade7854_spi_read_reg_24; st->read_reg_32 = ade7854_spi_read_reg_32; st->write_reg_8 = ade7854_spi_write_reg_8; st->write_reg_16 = ade7854_spi_write_reg_16; st->write_reg_24 = ade7854_spi_write_reg_24; st->write_reg_32 = ade7854_spi_write_reg_32; st->irq = spi->irq; st->spi = spi; ret = ade7854_probe(indio_dev, &spi->dev); if (ret) iio_device_free(indio_dev); return 0; } static int ade7854_spi_remove(struct spi_device *spi) { ade7854_remove(spi_get_drvdata(spi)); return 0; } static const struct spi_device_id ade7854_id[] = { { "ade7854", 0 }, { "ade7858", 0 }, { "ade7868", 0 }, { "ade7878", 0 }, { } }; MODULE_DEVICE_TABLE(spi, ade7854_id); static struct spi_driver ade7854_driver = { .driver = { .name = "ade7854", .owner = THIS_MODULE, }, .probe = ade7854_spi_probe, .remove = ade7854_spi_remove, .id_table = ade7854_id, }; module_spi_driver(ade7854_driver); MODULE_AUTHOR("Barry Song <[email protected]>"); MODULE_DESCRIPTION("Analog Devices ADE7854/58/68/78 SPI Driver"); MODULE_LICENSE("GPL v2");
{ "pile_set_name": "Github" }
# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-09-20 23:55+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <[email protected]>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" "Language: \n" #: applet.js:152 msgid "Bumblebee program not installed" msgstr "" #: applet.js:152 msgid "" "You appear to be missing some of the required programs for 'bumblebee' to " "switch graphics processors using NVIDIA Optimus." msgstr "" #: applet.js:152 msgid "Please read the help file." msgstr "" #: applet.js:172 msgid "Waiting for Bumblebee" msgstr "" #: applet.js:232 msgid "Open nVidia Settings Program" msgstr "" #: applet.js:238 msgid "Open Power Statistics" msgstr "" #: applet.js:244 msgid "Open System Monitor" msgstr "" #: applet.js:253 msgid "Housekeeping and System Sub Menu" msgstr "" #: applet.js:256 msgid "View the Changelog" msgstr "" #: applet.js:262 msgid "Open the Help file" msgstr "" #: applet.js:278 msgid "Launch programs using the nVidia Graphics Processor" msgstr "" #: applet.js:359 msgid "NVidia based GPU is Off" msgstr "" #: applet.js:384 msgid "NVidia based GPU is On and Core Temperature is" msgstr "" #: applet.js:392 msgid "Err" msgstr "" #: applet.js:393 msgid "" "Bumblebee is not set up correctly - are bbswitch, bumblebee and nvidia " "drivers installed?" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->showGpuTemp->description msgid "Show GPU Temperature as well as icon" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->showGpuTemp->tooltip msgid "" "Available in Horizontal and Vertical Panels. Display is in Degrees " "Centigrade." msgstr "" #. bumblebee@pdcurtis->settings-schema.json->head2->description msgid "Programs settings for Optimus" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->commandString2->description msgid "Command String for Program 2" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->commandString2->tooltip #. bumblebee@pdcurtis->settings-schema.json->commandString3->tooltip #. bumblebee@pdcurtis->settings-schema.json->commandString1->tooltip #. bumblebee@pdcurtis->settings-schema.json->commandString4->tooltip #. bumblebee@pdcurtis->settings-schema.json->commandString5->tooltip msgid "" "Put the command string to run the program here starting with optirun or " "primusrun" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->commandString3->description msgid "Command String for Program 3" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->commandString1->description msgid "Command String for Program 1" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->head->description msgid "General Settings for the nVidia Monitoring Applet" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->commandString4->description msgid "Command String for Program 4" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->commandString5->description msgid "Command String for Program 5" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->description4->description msgid "Display Name of Program 4 to be run using Optimus technology" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->description4->tooltip #. bumblebee@pdcurtis->settings-schema.json->description5->tooltip #. bumblebee@pdcurtis->settings-schema.json->description2->tooltip #. bumblebee@pdcurtis->settings-schema.json->description3->tooltip msgid "" "Put the name of the program here or none if you do not want it displayed" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->description5->description msgid "Display Name of Program 5 to be run using Optimus technology" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->description2->description msgid "Display Name of Program 2 to be run using Optimus technology" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->description3->description msgid "Display Name of Program 3 to be run using Optimus technology" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->description1->description msgid "Display Name of Program 1 to be run using Optimus technology" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->description1->tooltip msgid "" "Put the name of the program here or null if you do not want it displayed" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->refreshInterval- #. spinner->description msgid "Refresh Interval for Display:" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->refreshInterval-spinner->tooltip msgid "" "Increase or decrease this spinner value to change the refresh interval - use" " a slow refresh if you have a slow machine" msgstr "" #. bumblebee@pdcurtis->settings-schema.json->refreshInterval-spinner->units msgid "seconds" msgstr "" #. bumblebee@pdcurtis->metadata.json->description msgid "" "Displays Status of Bumblebee and nVidia GPU Temperature with associated " "support functions including starting selected programs with optirun or " "primusrun" msgstr "" #. bumblebee@pdcurtis->metadata.json->name msgid "Bumblebee Status with NVidia Temperature Display" msgstr ""
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?><%@ page language="java" pageEncoding="utf-8" contentType="text/xml;charset=utf-8" %><%@ page import="java.util.Iterator" %><%@ page import="java.util.ArrayList" %><%@ page import="java.util.Map" %><%@ page import="java.util.Enumeration" %><%@ page import="org.archive.wayback.core.CaptureSearchResult" %><%@ page import="org.archive.wayback.core.CaptureSearchResults" %><%@ page import="org.archive.wayback.core.SearchResults" %><%@ page import="org.archive.wayback.core.UIResults" %><%@ page import="org.archive.wayback.core.WaybackRequest" %><%@ page import="org.archive.wayback.requestparser.OpenSearchRequestParser" %><%@ page import="org.archive.wayback.util.StringFormatter" %><% UIResults uiResults = UIResults.extractCaptureQuery(request); WaybackRequest wbRequest = uiResults.getWbRequest(); StringFormatter fmt = wbRequest.getFormatter(); CaptureSearchResults results = uiResults.getCaptureResults(); Iterator<CaptureSearchResult> itr = results.iterator(); String staticPrefix = uiResults.getStaticPrefix(); String queryPrefix = uiResults.getQueryPrefix(); String replayPrefix = uiResults.getReplayPrefix(); String searchString = wbRequest.getRequestUrl(); long firstResult = results.getFirstReturned(); long shownResultCount = results.getReturnedCount(); long lastResult = results.getReturnedCount() + firstResult; long resultCount = results.getMatchingCount(); String searchTerms = ""; Map<String,String[]> queryMap = request.getParameterMap(); String arr[] = queryMap.get(OpenSearchRequestParser.SEARCH_QUERY); if(arr != null && arr.length > 1) { searchTerms = arr[0]; } %> <rss version="2.0" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title><%= fmt.format("PathQuery.rssResultsTitle") %></title> <link><%= queryPrefix %>></link> <description><%= fmt.format("PathQueryClassic.searchedFor",fmt.escapeHtml(searchString)) %></description> <opensearch:totalResults><%= resultCount %></opensearch:totalResults> <opensearch:startIndex><%= firstResult %></opensearch:startIndex> <opensearch:itemsPerPage><%= shownResultCount %></opensearch:itemsPerPage> <atom:link rel="search" type="application/opensearchdescription+xml" href="<%= staticPrefix %>/opensearchdescription.xml"/> <opensearch:Query role="request" searchTerms="<%= fmt.escapeHtml(searchTerms) %>" startPage="<%= wbRequest.getPageNum() %>" /> <% while(itr.hasNext()) { %> <item> <% CaptureSearchResult result = itr.next(); String replayUrl = fmt.escapeHtml(uiResults.resultToReplayUrl(result)); String prettyDate = fmt.escapeHtml( fmt.format("MetaReplay.captureDateDisplay",result.getCaptureDate())); String requestUrl = fmt.escapeHtml(wbRequest.getRequestUrl()); %> <title><%= prettyDate %></title> <link><%= replayUrl %></link> <description><%= requestUrl %></description> </item> <% } %> </channel> </rss>
{ "pile_set_name": "Github" }
{%- if cookiecutter.use_sentry_for_error_reporting.lower() == 'y' %} {%- raw %}{% load raven %}{% endraw %} {%- endif %} {% raw %}{% load static i18n %}<!DOCTYPE html> {% get_current_language as LANGUAGE_CODE %} <html lang="{{ LANGUAGE_CODE }}"> <head> <meta charset="utf-8"> <link rel="icon" type="image/x-icon" href="{% static 'images/favicon.png' %}"> <title>{% block title %}{% endraw %}{{ cookiecutter.project_name }}{% raw %}{% endblock title %}</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="version" content="{{ site_info.RELEASE_VERSION }}"> <meta name="description" content="{% block meta_description %}{% endblock meta_description %}"> {% endraw %}{%- if cookiecutter.use_sentry_for_error_reporting.lower() == 'y' %} {% raw %}{% if site_info.IS_RAVEN_INSTALLED %} <script>Raven.config('{% sentry_public_dsn %}').install()</script> {% endif %}{% endraw %} {%- endif %}{% raw %} {% block css %} <link href="{% static 'css/normalize.css' %}" rel="stylesheet"> <link href="{% static 'css/main.css' %}" rel="stylesheet"> {% endblock css %} {% block head_extras %}{% endblock %} </head> <body class="{% block body_classes %}{% endblock body_classes %} "> <!--[if lt IE 8]> <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> {% block header %} <h1>{% endraw %}{{ cookiecutter.project_name }}{% raw %}</h1> {% endblock header %} {% block content %} <p>Coming soon!</p> {% endblock content %} {% block footer %} {% endblock footer %} <!-- Le javascript ================================================== --> {# Placed at the end of the document so the pages load faster #} {% block js %} <!-- place project specific Javascript in this file --> <script src="{% static 'js/main.js' %}"></script> {% endblock js %} </body> </html>{% endraw %}
{ "pile_set_name": "Github" }
/*************************************************************************/ /* shape_2d_sw.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "shape_2d_sw.h" #include "core/math/geometry_2d.h" #include "core/sort_array.h" void Shape2DSW::configure(const Rect2 &p_aabb) { aabb = p_aabb; configured = true; for (Map<ShapeOwner2DSW *, int>::Element *E = owners.front(); E; E = E->next()) { ShapeOwner2DSW *co = (ShapeOwner2DSW *)E->key(); co->_shape_changed(); } } Vector2 Shape2DSW::get_support(const Vector2 &p_normal) const { Vector2 res[2]; int amnt; get_supports(p_normal, res, amnt); return res[0]; } void Shape2DSW::add_owner(ShapeOwner2DSW *p_owner) { Map<ShapeOwner2DSW *, int>::Element *E = owners.find(p_owner); if (E) { E->get()++; } else { owners[p_owner] = 1; } } void Shape2DSW::remove_owner(ShapeOwner2DSW *p_owner) { Map<ShapeOwner2DSW *, int>::Element *E = owners.find(p_owner); ERR_FAIL_COND(!E); E->get()--; if (E->get() == 0) { owners.erase(E); } } bool Shape2DSW::is_owner(ShapeOwner2DSW *p_owner) const { return owners.has(p_owner); } const Map<ShapeOwner2DSW *, int> &Shape2DSW::get_owners() const { return owners; } Shape2DSW::Shape2DSW() { custom_bias = 0; configured = false; } Shape2DSW::~Shape2DSW() { ERR_FAIL_COND(owners.size()); } /*********************************************************/ /*********************************************************/ /*********************************************************/ void LineShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const { r_amount = 0; } bool LineShape2DSW::contains_point(const Vector2 &p_point) const { return normal.dot(p_point) < d; } bool LineShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const { Vector2 segment = p_begin - p_end; real_t den = normal.dot(segment); //printf("den is %i\n",den); if (Math::abs(den) <= CMP_EPSILON) { return false; } real_t dist = (normal.dot(p_begin) - d) / den; //printf("dist is %i\n",dist); if (dist < -CMP_EPSILON || dist > (1.0 + CMP_EPSILON)) { return false; } r_point = p_begin + segment * -dist; r_normal = normal; return true; } real_t LineShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const { return 0; } void LineShape2DSW::set_data(const Variant &p_data) { ERR_FAIL_COND(p_data.get_type() != Variant::ARRAY); Array arr = p_data; ERR_FAIL_COND(arr.size() != 2); normal = arr[0]; d = arr[1]; configure(Rect2(Vector2(-1e4, -1e4), Vector2(1e4 * 2, 1e4 * 2))); } Variant LineShape2DSW::get_data() const { Array arr; arr.resize(2); arr[0] = normal; arr[1] = d; return arr; } /*********************************************************/ /*********************************************************/ /*********************************************************/ void RayShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const { r_amount = 1; if (p_normal.y > 0) { *r_supports = Vector2(0, length); } else { *r_supports = Vector2(); } } bool RayShape2DSW::contains_point(const Vector2 &p_point) const { return false; } bool RayShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const { return false; //rays can't be intersected } real_t RayShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const { return 0; //rays are mass-less } void RayShape2DSW::set_data(const Variant &p_data) { Dictionary d = p_data; length = d["length"]; slips_on_slope = d["slips_on_slope"]; configure(Rect2(0, 0, 0.001, length)); } Variant RayShape2DSW::get_data() const { Dictionary d; d["length"] = length; d["slips_on_slope"] = slips_on_slope; return d; } /*********************************************************/ /*********************************************************/ /*********************************************************/ void SegmentShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const { if (Math::abs(p_normal.dot(n)) > _SEGMENT_IS_VALID_SUPPORT_THRESHOLD) { r_supports[0] = a; r_supports[1] = b; r_amount = 2; return; } real_t dp = p_normal.dot(b - a); if (dp > 0) { *r_supports = b; } else { *r_supports = a; } r_amount = 1; } bool SegmentShape2DSW::contains_point(const Vector2 &p_point) const { return false; } bool SegmentShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const { if (!Geometry2D::segment_intersects_segment(p_begin, p_end, a, b, &r_point)) { return false; } if (n.dot(p_begin) > n.dot(a)) { r_normal = n; } else { r_normal = -n; } return true; } real_t SegmentShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const { return p_mass * ((a * p_scale).distance_squared_to(b * p_scale)) / 12; } void SegmentShape2DSW::set_data(const Variant &p_data) { ERR_FAIL_COND(p_data.get_type() != Variant::RECT2); Rect2 r = p_data; a = r.position; b = r.size; n = (b - a).tangent(); Rect2 aabb; aabb.position = a; aabb.expand_to(b); if (aabb.size.x == 0) { aabb.size.x = 0.001; } if (aabb.size.y == 0) { aabb.size.y = 0.001; } configure(aabb); } Variant SegmentShape2DSW::get_data() const { Rect2 r; r.position = a; r.size = b; return r; } /*********************************************************/ /*********************************************************/ /*********************************************************/ void CircleShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const { r_amount = 1; *r_supports = p_normal * radius; } bool CircleShape2DSW::contains_point(const Vector2 &p_point) const { return p_point.length_squared() < radius * radius; } bool CircleShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const { Vector2 line_vec = p_end - p_begin; real_t a, b, c; a = line_vec.dot(line_vec); b = 2 * p_begin.dot(line_vec); c = p_begin.dot(p_begin) - radius * radius; real_t sqrtterm = b * b - 4 * a * c; if (sqrtterm < 0) { return false; } sqrtterm = Math::sqrt(sqrtterm); real_t res = (-b - sqrtterm) / (2 * a); if (res < 0 || res > 1 + CMP_EPSILON) { return false; } r_point = p_begin + line_vec * res; r_normal = r_point.normalized(); return true; } real_t CircleShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const { real_t a = radius * p_scale.x; real_t b = radius * p_scale.y; return p_mass * (a * a + b * b) / 4; } void CircleShape2DSW::set_data(const Variant &p_data) { ERR_FAIL_COND(!p_data.is_num()); radius = p_data; configure(Rect2(-radius, -radius, radius * 2, radius * 2)); } Variant CircleShape2DSW::get_data() const { return radius; } /*********************************************************/ /*********************************************************/ /*********************************************************/ void RectangleShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const { for (int i = 0; i < 2; i++) { Vector2 ag; ag[i] = 1.0; real_t dp = ag.dot(p_normal); if (Math::abs(dp) < _SEGMENT_IS_VALID_SUPPORT_THRESHOLD) { continue; } real_t sgn = dp > 0 ? 1.0 : -1.0; r_amount = 2; r_supports[0][i] = half_extents[i] * sgn; r_supports[0][i ^ 1] = half_extents[i ^ 1]; r_supports[1][i] = half_extents[i] * sgn; r_supports[1][i ^ 1] = -half_extents[i ^ 1]; return; } /* USE POINT */ r_amount = 1; r_supports[0] = Vector2( (p_normal.x < 0) ? -half_extents.x : half_extents.x, (p_normal.y < 0) ? -half_extents.y : half_extents.y); } bool RectangleShape2DSW::contains_point(const Vector2 &p_point) const { float x = p_point.x; float y = p_point.y; float edge_x = half_extents.x; float edge_y = half_extents.y; return (x >= -edge_x) && (x < edge_x) && (y >= -edge_y) && (y < edge_y); } bool RectangleShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const { return get_aabb().intersects_segment(p_begin, p_end, &r_point, &r_normal); } real_t RectangleShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const { Vector2 he2 = half_extents * 2 * p_scale; return p_mass * he2.dot(he2) / 12.0; } void RectangleShape2DSW::set_data(const Variant &p_data) { ERR_FAIL_COND(p_data.get_type() != Variant::VECTOR2); half_extents = p_data; configure(Rect2(-half_extents, half_extents * 2.0)); } Variant RectangleShape2DSW::get_data() const { return half_extents; } /*********************************************************/ /*********************************************************/ /*********************************************************/ void CapsuleShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const { Vector2 n = p_normal; real_t d = n.y; if (Math::abs(d) < (1.0 - _SEGMENT_IS_VALID_SUPPORT_THRESHOLD)) { // make it flat n.y = 0.0; n.normalize(); n *= radius; r_amount = 2; r_supports[0] = n; r_supports[0].y += height * 0.5; r_supports[1] = n; r_supports[1].y -= height * 0.5; } else { real_t h = (d > 0) ? height : -height; n *= radius; n.y += h * 0.5; r_amount = 1; *r_supports = n; } } bool CapsuleShape2DSW::contains_point(const Vector2 &p_point) const { Vector2 p = p_point; p.y = Math::abs(p.y); p.y -= height * 0.5; if (p.y < 0) { p.y = 0; } return p.length_squared() < radius * radius; } bool CapsuleShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const { real_t d = 1e10; Vector2 n = (p_end - p_begin).normalized(); bool collided = false; //try spheres for (int i = 0; i < 2; i++) { Vector2 begin = p_begin; Vector2 end = p_end; real_t ofs = (i == 0) ? -height * 0.5 : height * 0.5; begin.y += ofs; end.y += ofs; Vector2 line_vec = end - begin; real_t a, b, c; a = line_vec.dot(line_vec); b = 2 * begin.dot(line_vec); c = begin.dot(begin) - radius * radius; real_t sqrtterm = b * b - 4 * a * c; if (sqrtterm < 0) { continue; } sqrtterm = Math::sqrt(sqrtterm); real_t res = (-b - sqrtterm) / (2 * a); if (res < 0 || res > 1 + CMP_EPSILON) { continue; } Vector2 point = begin + line_vec * res; Vector2 pointf(point.x, point.y - ofs); real_t pd = n.dot(pointf); if (pd < d) { r_point = pointf; r_normal = point.normalized(); d = pd; collided = true; } } Vector2 rpos, rnorm; if (Rect2(Point2(-radius, -height * 0.5), Size2(radius * 2.0, height)).intersects_segment(p_begin, p_end, &rpos, &rnorm)) { real_t pd = n.dot(rpos); if (pd < d) { r_point = rpos; r_normal = rnorm; d = pd; collided = true; } } //return get_aabb().intersects_segment(p_begin,p_end,&r_point,&r_normal); return collided; //todo } real_t CapsuleShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const { Vector2 he2 = Vector2(radius * 2, height + radius * 2) * p_scale; return p_mass * he2.dot(he2) / 12.0; } void CapsuleShape2DSW::set_data(const Variant &p_data) { ERR_FAIL_COND(p_data.get_type() != Variant::ARRAY && p_data.get_type() != Variant::VECTOR2); if (p_data.get_type() == Variant::ARRAY) { Array arr = p_data; ERR_FAIL_COND(arr.size() != 2); height = arr[0]; radius = arr[1]; } else { Point2 p = p_data; radius = p.x; height = p.y; } Point2 he(radius, height * 0.5 + radius); configure(Rect2(-he, he * 2)); } Variant CapsuleShape2DSW::get_data() const { return Point2(height, radius); } /*********************************************************/ /*********************************************************/ /*********************************************************/ void ConvexPolygonShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const { int support_idx = -1; real_t d = -1e10; for (int i = 0; i < point_count; i++) { //test point real_t ld = p_normal.dot(points[i].pos); if (ld > d) { support_idx = i; d = ld; } //test segment if (points[i].normal.dot(p_normal) > _SEGMENT_IS_VALID_SUPPORT_THRESHOLD) { r_amount = 2; r_supports[0] = points[i].pos; r_supports[1] = points[(i + 1) % point_count].pos; return; } } ERR_FAIL_COND(support_idx == -1); r_amount = 1; r_supports[0] = points[support_idx].pos; } bool ConvexPolygonShape2DSW::contains_point(const Vector2 &p_point) const { bool out = false; bool in = false; for (int i = 0; i < point_count; i++) { real_t d = points[i].normal.dot(p_point) - points[i].normal.dot(points[i].pos); if (d > 0) { out = true; } else { in = true; } } return in != out; } bool ConvexPolygonShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const { Vector2 n = (p_end - p_begin).normalized(); real_t d = 1e10; bool inters = false; for (int i = 0; i < point_count; i++) { //hmm.. no can do.. /* if (d.dot(points[i].normal)>=0) continue; */ Vector2 res; if (!Geometry2D::segment_intersects_segment(p_begin, p_end, points[i].pos, points[(i + 1) % point_count].pos, &res)) { continue; } real_t nd = n.dot(res); if (nd < d) { d = nd; r_point = res; r_normal = points[i].normal; inters = true; } } if (inters) { if (n.dot(r_normal) > 0) { r_normal = -r_normal; } } //return get_aabb().intersects_segment(p_begin,p_end,&r_point,&r_normal); return inters; //todo } real_t ConvexPolygonShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const { Rect2 aabb; aabb.position = points[0].pos * p_scale; for (int i = 0; i < point_count; i++) { aabb.expand_to(points[i].pos * p_scale); } return p_mass * aabb.size.dot(aabb.size) / 12.0; } void ConvexPolygonShape2DSW::set_data(const Variant &p_data) { ERR_FAIL_COND(p_data.get_type() != Variant::PACKED_VECTOR2_ARRAY && p_data.get_type() != Variant::PACKED_FLOAT32_ARRAY); if (points) { memdelete_arr(points); } points = nullptr; point_count = 0; if (p_data.get_type() == Variant::PACKED_VECTOR2_ARRAY) { Vector<Vector2> arr = p_data; ERR_FAIL_COND(arr.size() == 0); point_count = arr.size(); points = memnew_arr(Point, point_count); const Vector2 *r = arr.ptr(); for (int i = 0; i < point_count; i++) { points[i].pos = r[i]; } for (int i = 0; i < point_count; i++) { Vector2 p = points[i].pos; Vector2 pn = points[(i + 1) % point_count].pos; points[i].normal = (pn - p).tangent().normalized(); } } else { Vector<real_t> dvr = p_data; point_count = dvr.size() / 4; ERR_FAIL_COND(point_count == 0); points = memnew_arr(Point, point_count); const real_t *r = dvr.ptr(); for (int i = 0; i < point_count; i++) { int idx = i << 2; points[i].pos.x = r[idx + 0]; points[i].pos.y = r[idx + 1]; points[i].normal.x = r[idx + 2]; points[i].normal.y = r[idx + 3]; } } ERR_FAIL_COND(point_count == 0); Rect2 aabb; aabb.position = points[0].pos; for (int i = 1; i < point_count; i++) { aabb.expand_to(points[i].pos); } configure(aabb); } Variant ConvexPolygonShape2DSW::get_data() const { Vector<Vector2> dvr; dvr.resize(point_count); for (int i = 0; i < point_count; i++) { dvr.set(i, points[i].pos); } return dvr; } ConvexPolygonShape2DSW::ConvexPolygonShape2DSW() { points = nullptr; point_count = 0; } ConvexPolygonShape2DSW::~ConvexPolygonShape2DSW() { if (points) { memdelete_arr(points); } } ////////////////////////////////////////////////// void ConcavePolygonShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const { real_t d = -1e10; int idx = -1; for (int i = 0; i < points.size(); i++) { real_t ld = p_normal.dot(points[i]); if (ld > d) { d = ld; idx = i; } } r_amount = 1; ERR_FAIL_COND(idx == -1); *r_supports = points[idx]; } bool ConcavePolygonShape2DSW::contains_point(const Vector2 &p_point) const { return false; //sorry } bool ConcavePolygonShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const { uint32_t *stack = (uint32_t *)alloca(sizeof(int) * bvh_depth); enum { TEST_AABB_BIT = 0, VISIT_LEFT_BIT = 1, VISIT_RIGHT_BIT = 2, VISIT_DONE_BIT = 3, VISITED_BIT_SHIFT = 29, NODE_IDX_MASK = (1 << VISITED_BIT_SHIFT) - 1, VISITED_BIT_MASK = ~NODE_IDX_MASK, }; Vector2 n = (p_end - p_begin).normalized(); real_t d = 1e10; bool inters = false; /* for(int i=0;i<bvh_depth;i++) stack[i]=0; */ int level = 0; const Segment *segmentptr = &segments[0]; const Vector2 *pointptr = &points[0]; const BVH *bvhptr = &bvh[0]; stack[0] = 0; while (true) { uint32_t node = stack[level] & NODE_IDX_MASK; const BVH &bvh = bvhptr[node]; bool done = false; switch (stack[level] >> VISITED_BIT_SHIFT) { case TEST_AABB_BIT: { bool valid = bvh.aabb.intersects_segment(p_begin, p_end); if (!valid) { stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node; } else { if (bvh.left < 0) { const Segment &s = segmentptr[bvh.right]; Vector2 a = pointptr[s.points[0]]; Vector2 b = pointptr[s.points[1]]; Vector2 res; if (Geometry2D::segment_intersects_segment(p_begin, p_end, a, b, &res)) { real_t nd = n.dot(res); if (nd < d) { d = nd; r_point = res; r_normal = (b - a).tangent().normalized(); inters = true; } } stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node; } else { stack[level] = (VISIT_LEFT_BIT << VISITED_BIT_SHIFT) | node; } } } continue; case VISIT_LEFT_BIT: { stack[level] = (VISIT_RIGHT_BIT << VISITED_BIT_SHIFT) | node; stack[level + 1] = bvh.left | TEST_AABB_BIT; level++; } continue; case VISIT_RIGHT_BIT: { stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node; stack[level + 1] = bvh.right | TEST_AABB_BIT; level++; } continue; case VISIT_DONE_BIT: { if (level == 0) { done = true; break; } else { level--; } } continue; } if (done) { break; } } if (inters) { if (n.dot(r_normal) > 0) { r_normal = -r_normal; } } return inters; } int ConcavePolygonShape2DSW::_generate_bvh(BVH *p_bvh, int p_len, int p_depth) { if (p_len == 1) { bvh_depth = MAX(p_depth, bvh_depth); bvh.push_back(*p_bvh); return bvh.size() - 1; } //else sort best Rect2 global_aabb = p_bvh[0].aabb; for (int i = 1; i < p_len; i++) { global_aabb = global_aabb.merge(p_bvh[i].aabb); } if (global_aabb.size.x > global_aabb.size.y) { SortArray<BVH, BVH_CompareX> sort; sort.sort(p_bvh, p_len); } else { SortArray<BVH, BVH_CompareY> sort; sort.sort(p_bvh, p_len); } int median = p_len / 2; BVH node; node.aabb = global_aabb; int node_idx = bvh.size(); bvh.push_back(node); int l = _generate_bvh(p_bvh, median, p_depth + 1); int r = _generate_bvh(&p_bvh[median], p_len - median, p_depth + 1); bvh.write[node_idx].left = l; bvh.write[node_idx].right = r; return node_idx; } void ConcavePolygonShape2DSW::set_data(const Variant &p_data) { ERR_FAIL_COND(p_data.get_type() != Variant::PACKED_VECTOR2_ARRAY && p_data.get_type() != Variant::PACKED_FLOAT32_ARRAY); Rect2 aabb; if (p_data.get_type() == Variant::PACKED_VECTOR2_ARRAY) { Vector<Vector2> p2arr = p_data; int len = p2arr.size(); ERR_FAIL_COND(len % 2); segments.clear(); points.clear(); bvh.clear(); bvh_depth = 1; if (len == 0) { configure(aabb); return; } const Vector2 *arr = p2arr.ptr(); Map<Point2, int> pointmap; for (int i = 0; i < len; i += 2) { Point2 p1 = arr[i]; Point2 p2 = arr[i + 1]; int idx_p1, idx_p2; if (pointmap.has(p1)) { idx_p1 = pointmap[p1]; } else { idx_p1 = pointmap.size(); pointmap[p1] = idx_p1; } if (pointmap.has(p2)) { idx_p2 = pointmap[p2]; } else { idx_p2 = pointmap.size(); pointmap[p2] = idx_p2; } Segment s; s.points[0] = idx_p1; s.points[1] = idx_p2; segments.push_back(s); } points.resize(pointmap.size()); aabb.position = pointmap.front()->key(); for (Map<Point2, int>::Element *E = pointmap.front(); E; E = E->next()) { aabb.expand_to(E->key()); points.write[E->get()] = E->key(); } Vector<BVH> main_vbh; main_vbh.resize(segments.size()); for (int i = 0; i < main_vbh.size(); i++) { main_vbh.write[i].aabb.position = points[segments[i].points[0]]; main_vbh.write[i].aabb.expand_to(points[segments[i].points[1]]); main_vbh.write[i].left = -1; main_vbh.write[i].right = i; } _generate_bvh(main_vbh.ptrw(), main_vbh.size(), 1); } else { //dictionary with arrays } configure(aabb); } Variant ConcavePolygonShape2DSW::get_data() const { Vector<Vector2> rsegments; int len = segments.size(); rsegments.resize(len * 2); Vector2 *w = rsegments.ptrw(); for (int i = 0; i < len; i++) { w[(i << 1) + 0] = points[segments[i].points[0]]; w[(i << 1) + 1] = points[segments[i].points[1]]; } return rsegments; } void ConcavePolygonShape2DSW::cull(const Rect2 &p_local_aabb, Callback p_callback, void *p_userdata) const { uint32_t *stack = (uint32_t *)alloca(sizeof(int) * bvh_depth); enum { TEST_AABB_BIT = 0, VISIT_LEFT_BIT = 1, VISIT_RIGHT_BIT = 2, VISIT_DONE_BIT = 3, VISITED_BIT_SHIFT = 29, NODE_IDX_MASK = (1 << VISITED_BIT_SHIFT) - 1, VISITED_BIT_MASK = ~NODE_IDX_MASK, }; /* for(int i=0;i<bvh_depth;i++) stack[i]=0; */ if (segments.size() == 0 || points.size() == 0 || bvh.size() == 0) { return; } int level = 0; const Segment *segmentptr = &segments[0]; const Vector2 *pointptr = &points[0]; const BVH *bvhptr = &bvh[0]; stack[0] = 0; while (true) { uint32_t node = stack[level] & NODE_IDX_MASK; const BVH &bvh = bvhptr[node]; switch (stack[level] >> VISITED_BIT_SHIFT) { case TEST_AABB_BIT: { bool valid = p_local_aabb.intersects(bvh.aabb); if (!valid) { stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node; } else { if (bvh.left < 0) { const Segment &s = segmentptr[bvh.right]; Vector2 a = pointptr[s.points[0]]; Vector2 b = pointptr[s.points[1]]; SegmentShape2DSW ss(a, b, (b - a).tangent().normalized()); p_callback(p_userdata, &ss); stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node; } else { stack[level] = (VISIT_LEFT_BIT << VISITED_BIT_SHIFT) | node; } } } continue; case VISIT_LEFT_BIT: { stack[level] = (VISIT_RIGHT_BIT << VISITED_BIT_SHIFT) | node; stack[level + 1] = bvh.left | TEST_AABB_BIT; level++; } continue; case VISIT_RIGHT_BIT: { stack[level] = (VISIT_DONE_BIT << VISITED_BIT_SHIFT) | node; stack[level + 1] = bvh.right | TEST_AABB_BIT; level++; } continue; case VISIT_DONE_BIT: { if (level == 0) { return; } else { level--; } } continue; } } }
{ "pile_set_name": "Github" }
<?php /** * inoERP * * @copyright 2014 Nishit R. Das * @license https://www.mozilla.org/MPL/2.0/ * @link http://inoideas.org * @source code https://github.com/inoerp/inoERP */ /** * inv_intorg_transfer_header * Contains all the inv_intorg_transfer_header information, such as - item_id_m, order_number, from_org_id, to_org_id, etc. * */ class inv_intorg_transfer_header extends dbObject { public static $table_name = "inv_intorg_transfer_header"; public static $dependent_classes = ['inv_intorg_transfer_line']; public static $primary_column = "inv_intorg_transfer_header_id"; public static $primary_column2 = "order_number"; public static $key_column = 'from_org_id'; public static $module = "inv"; //same as gl_journal_source public static $gl_journal_category = "INV_RECEIVING"; public static $system_info = [ 'name' => 'InterOrg Transfer', 'number' => '2134', 'description' => 'Inventory InterOrg Transfer', 'version' => '0.1.1', 'db_version' => '1001', 'mod_version' => '1.1.1', 'dependent_class' => array('inv_intorg_transfer_line'), 'primary_entity_cb' => '', 'module_name' => 'inv', 'weight' => 6 ]; public static $transaction_type_id_a = [ '18' => 'Direct Inter-Org', '19' => 'In-transit Inter-Org', ]; public $action_a = [ 'SHIP' => 'Ship Lines', 'GENERATE_DOC' => 'Generate Shipping Documents', ]; public $field_a = [ 'inv_intorg_transfer_header_id', 'order_number', 'comment', 'from_org_id', 'transaction_type_id', 'to_org_id', 'status', 'transfer_to_gl', 'transaction_date', 'carrier', 'vehicle_number', 'waybill', 'created_by', 'creation_date', 'last_update_by', 'last_update_date', ]; //variables used for showing data public $initial_search = [ 'inv_intorg_transfer_header_id', 'order_number', 'comment', ]; public $column = [ 'inv_intorg_transfer_header_id', 'order_number', 'comment', 'from_org_id', 'transaction_type_id', 'to_org_id', 'status', 'transfer_to_gl', 'transaction_date', 'carrier', 'vehicle_number', 'waybill', 'created_by', 'creation_date', 'last_update_by', 'last_update_date', ]; public $fields_inForm_notInDataBase = [ "from_org", 'to_org', ]; public $requiredField = [ 'from_org_id', 'transaction_type_id', 'to_org_id', ]; public $search = [ '_show_view_path' => 1, ]; public $pageTitle = " Inter Org Transfer "; //page Title public $option_lists = [ 'inv_transaction_class' => 'TRANSACTION_TYPE_CLASS' ]; public $inv_intorg_transfer_header_id; public $order_number; public $comment; public $from_org_id; public $transaction_type_id; public $to_org_id; public $status; public $transfer_to_gl; public $transaction_date; public $carrier; public $vehicle_number; public $waybill; public $created_by; public $creation_date; public $last_update_by; public $last_update_date; public $action; // public function _before_save() { // if (($this->action == 'multi_interorg_transfer')) { // echo "<br> Starting interorg_transfer."; // pa($_POST); // return 10; // } // } public function _after_save() { if ((!empty($this->inv_intorg_transfer_header_id)) && empty($this->order_number)) { $this->order_number = $this->from_org_id . '-' . $this->inv_intorg_transfer_header_id; echo '<br/> System created order number is ' . $this->order_number; $this->save(); } } } ?>
{ "pile_set_name": "Github" }
import Dispatch /// A view of a byte buffer of a numeric values. /// /// The elements generated are the concatenation of the bytes in the base /// buffer. public struct DataGenerator<T: UnsignedIntegerType>: GeneratorType { private var bytes: FlattenGenerator<DataRegions.Generator> private init(_ bytes: FlattenCollection<DataRegions>) { self.bytes = bytes.generate() } private init(_ bytes: FlattenGenerator<DataRegions.Generator>) { self.bytes = bytes.generate() } private mutating func nextByte() -> UInt8? { return bytes.next() } /// Advance to the next element and return it, or `nil` if no next /// element exists. /// /// - Requires: No preceding call to `self.next()` has returned `nil`. public mutating func next() -> T? { return (0 ..< sizeof(T)).reduce(T.allZeros) { (current, byteIdx) -> T? in guard let current = current, byte = nextByte() else { return nil } return current | numericCast(byte.toUIntMax() << UIntMax(byteIdx * 8)) } } } extension DataGenerator: SequenceType { /// Restart enumeration of the data. public func generate() -> DataGenerator<T> { return DataGenerator(bytes) } } extension Data: SequenceType { /// Return a *generator* over the `T`s that comprise this *data*. public func generate() -> DataGenerator<T> { return DataGenerator(bytes) } }
{ "pile_set_name": "Github" }
/* * Zed Attack Proxy (ZAP) and its related class files. * * ZAP is an HTTP/HTTPS proxy for assessing web application security. * * Copyright 2013 The ZAP Development Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.zaproxy.zap.extension.autoupdate; import org.zaproxy.zap.control.AddOnCollection; public interface CheckForUpdateCallback { /** * Called when the check for updates finishes without {@link #insecureUrl(String, Exception) * insecure URL errors}. * * @param aoc the latest {@code AddOnCollection}, or {@code null} if not obtained (e.g. I/O * errors). */ void gotLatestData(AddOnCollection aoc); void insecureUrl(String url, Exception cause); }
{ "pile_set_name": "Github" }
/* Copyright (C) 2011 Jan Källman * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html * * All code and executables are provided "as is" with no warranty either express or implied. * The author accepts no liability for any damage or loss of business that this product may cause. * * Code change notes: * * Author Change Date ******************************************************************************* * Mats Alm Added 2013-12-03 *******************************************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using OfficeOpenXml.FormulaParsing.ExpressionGraph; namespace OfficeOpenXml.FormulaParsing.Excel.Functions.Math { public class Cosh : ExcelFunction { public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context) { ValidateArguments(arguments, 1); var arg = ArgToDecimal(arguments, 0); return CreateResult(System.Math.Cosh(arg), DataType.Decimal); } } }
{ "pile_set_name": "Github" }
/* * This file is part of the OregonCore 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 <https://www.gnu.org/licenses/>. */ /* ScriptData SDName: Boss_Highlord_Mograine SD%Complete: 100 SDComment: SCRIPT OBSOLETE SDCategory: Naxxramas EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" //All horsemen #define SPELL_SHIELDWALL 29061 #define SPELL_BESERK 26662 // highlord mograine #define SPELL_MARK_OF_MOGRAINE 28834 #define SPELL_RIGHTEOUS_FIRE 28882 // Applied as a 25% chance on melee hit to proc. me->GetVictim() #define SAY_TAUNT1 "Enough prattling. Let them come! We shall grind their bones to dust." #define SAY_TAUNT2 "Conserve your anger! Harness your rage! You will all have outlets for your frustration soon enough." #define SAY_TAUNT3 "Life is meaningless. It is in death that we are truly tested." #define SAY_AGGRO1 "You seek death?" #define SAY_AGGRO2 "None shall pass!" #define SAY_AGGRO3 "Be still!" #define SAY_SLAY1 "You will find no peace in death." #define SAY_SLAY2 "The master's will is done." #define SAY_SPECIAL "Bow to the might of the Highlord!" #define SAY_DEATH "I... am... released! Perhaps it's not too late to - noo! I need... more time..." #define SOUND_TAUNT1 8842 #define SOUND_TAUNT2 8843 #define SOUND_TAUNT3 8844 #define SOUND_AGGRO1 8835 #define SOUND_AGGRO2 8836 #define SOUND_AGGRO3 8837 #define SOUND_SLAY1 8839 #define SOUND_SLAY2 8840 #define SOUND_SPECIAL 8841 #define SOUND_DEATH 8838 #define SPIRIT_OF_MOGRAINE 16775 struct boss_highlord_mograineAI : public ScriptedAI { boss_highlord_mograineAI(Creature* c) : ScriptedAI(c) {} uint32 Mark_Timer; uint32 RighteousFire_Timer; bool ShieldWall1; bool ShieldWall2; void Reset() { Mark_Timer = 20000; // First Horsemen Mark is applied at 20 sec. RighteousFire_Timer = 2000; // applied approx 1 out of 4 attacks ShieldWall1 = true; ShieldWall2 = true; } void InitialYell() { if (!me->IsInCombat()) { switch (rand() % 3) { case 0: me->MonsterYell(SAY_AGGRO1, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_AGGRO1); break; case 1: me->MonsterYell(SAY_AGGRO2, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_AGGRO2); break; case 2: me->MonsterYell(SAY_AGGRO3, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_AGGRO3); break; } } } void KilledUnit() { switch (rand() % 2) { case 0: me->MonsterYell(SAY_SLAY1, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_SLAY1); break; case 1: me->MonsterYell(SAY_SLAY2, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_SLAY2); break; } } void JustDied(Unit*) { me->MonsterYell(SAY_DEATH, LANG_UNIVERSAL, 0); DoPlaySoundToSet(me, SOUND_DEATH); } void EnterCombat(Unit*) { InitialYell(); } void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; // Mark of Mograine if (Mark_Timer <= diff) { DoCastVictim(SPELL_MARK_OF_MOGRAINE); Mark_Timer = 12000; } else Mark_Timer -= diff; // Shield Wall - All 4 horsemen will shield wall at 50% hp and 20% hp for 20 seconds if (ShieldWall1 && HealthBelowPct(50)) { if (ShieldWall1) { DoCast(me, SPELL_SHIELDWALL); ShieldWall1 = false; } } if (ShieldWall2 && HealthBelowPct(20)) { if (ShieldWall2) { DoCast(me, SPELL_SHIELDWALL); ShieldWall2 = false; } } // Righteous Fire if (RighteousFire_Timer <= diff) { if (rand() % 4 == 1) // 1/4 DoCastVictim(SPELL_RIGHTEOUS_FIRE); RighteousFire_Timer = 2000; } else RighteousFire_Timer -= diff; DoMeleeAttackIfReady(); } }; CreatureAI* GetAI_boss_highlord_mograine(Creature* pCreature) { return new boss_highlord_mograineAI (pCreature); } void AddSC_boss_highlord_mograine() { Script* newscript; newscript = new Script; newscript->Name = "boss_highlord_mograine"; newscript->GetAI = &GetAI_boss_highlord_mograine; newscript->RegisterSelf(); }
{ "pile_set_name": "Github" }
LIBRARY gui_plugin EXPORTS plugin_init
{ "pile_set_name": "Github" }
comment_char % escape_char / % This file is part of the GNU C Library and contains locale data. % The Free Software Foundation does not claim any copyright interest % in the locale data contained in this file. The foregoing does not % affect the license of the GNU C Library as a whole. It does not % exempt you from the conditions of the license if your use would % otherwise be governed by that license. % ChangeLog % 0.4 (2005-10-13): % 2005-10-12 Dwayne Bailey <[email protected]> % - Added 'Charset: UTF-8' information % - Update contact information % - Allign spellings of month and weekday names with Dept. of % Art and Culture's: Multilingual Mathematics Dictionary % 0.3 (2005-06-21): % 2005-06-21 Dwayne Bailey <[email protected]> % - Corrected short month names to correspond to long % month names (missed in 2004-02-27 corrections) % 0.2 (2004-11-08): % 2004-11-08 Dwayne Bailey <[email protected]> % - Changed all contact information % - d_t_fmt, date_fmt changed %d to %-e % - Remove .* from yes/noexpr % - Convert all to <UNNNN> syntax % 2004-03-30 Dwayne Bailey <[email protected]> % - Added country_ab2/3, country_num % 2004-02-27 Dwayne Bailey <[email protected]> % - Correct capatilisation of lang_name % - Validated and corrected bad month names % 0.1 (2004-02-24): % - Initial Tswana locale for South Africa % by Zuza Software Foundation LC_IDENTIFICATION title "Tswana locale for South Africa" source "Zuza Software Foundation (Translate.org.za)" address "PO Box 28364, Sunnyside, 0132, South Africa" contact "Dwayne Bailey" email "[email protected]" tel "" fax "" language "Tswana" territory "South Africa" revision "0.4" date "2005-10-13" category "i18n:2012";LC_IDENTIFICATION category "i18n:2012";LC_CTYPE category "i18n:2012";LC_COLLATE category "i18n:2012";LC_TIME category "i18n:2012";LC_NUMERIC category "i18n:2012";LC_MONETARY category "i18n:2012";LC_MESSAGES category "i18n:2012";LC_PAPER category "i18n:2012";LC_NAME category "i18n:2012";LC_ADDRESS category "i18n:2012";LC_TELEPHONE category "i18n:2012";LC_MEASUREMENT END LC_IDENTIFICATION LC_CTYPE % Use the characters described in the charmap file "i18n.tgz" copy "i18n" translit_start include "translit_combining";"" translit_end END LC_CTYPE LC_COLLATE % Copy the template from ISO/IEC 14651 i.e. % use the rules there when making ordered lists of words. copy "iso14651_t1" END LC_COLLATE LC_MONETARY copy "en_ZA" END LC_MONETARY LC_NUMERIC copy "en_ZA" END LC_NUMERIC LC_TIME % abday - The abbreviations for the week days: abday "Tsh";"Mos";"Bed";"Rar";"Ne";"Tlh";"Mat" % day - The full names of the week days: day "laTshipi";/ "Mosupologo";/ "Labobedi";/ "Laboraro";/ "Labone";/ "Labotlhano";/ "Lamatlhatso" % abmon - The abbreviations for the months abmon "Fer";"Tlh";/ "Mop";"Mor";/ "Mot";"See";/ "Phu";"Pha";/ "Lwe";"Dip";/ "Ngw";"Sed" % mon - The full names of the months mon "Ferikgong";/ "Tlhakole";/ "Mopitlwe";/ "Moranang";/ "Motsheganong";/ "Seetebosigo";/ "Phukwi";/ "Phatwe";/ "Lwetse";/ "Diphalane";/ "Ngwanatsele";/ "Sedimonthole" % Abreviated date and time representation to be referenced by the "%c" field descriptor - d_t_fmt "%a %-e %b %Y %T %Z" % % "%a" (short weekday name), % "%-e" (day of month as a decimal number), % "%b" (short month name), % "%Y" (year with century as a decimal number), % "%T" (24-hour clock time in format HH:MM:SS), % "%Z" (Time zone name) % Date representation to be referenced by the "%x" field descriptor - d_fmt "%d//%m//%Y" % "%d/%m/%Y", day/month/year as decimal numbers (01/01/2000). % Time representation to be referenced by the "%X" field descriptor - t_fmt "%T" % "%T" (24-hour clock time in format HH:MM:SS) % Define representation of ante meridiem and post meridiem strings - am_pm "";"" % The "" mean 'default to "AM" and "PM". % Define time representation in 12-hour format with "am_pm", to be referenced by the "%r" t_fmt_ampm "" % The "" means that this format is not supported. % Date representation not described in ISO/IEC 14652. Comes out as - % "%a %b %-e %H:%M:%S %Z %Y" which is default "date" command output date_fmt "%a %b %-e %H:%M:%S %Z %Y" % % %a - abbreviated weekday name, % %b - abreviated month name, % %-e - day of month as a decimal number with leading space (1 to 31), % %H - hour (24-hour clock) as a decimal number (00 to 23), % %M - minute as a decimal number (00 to 59), % %S - seconds as a decimal number (00 to 59), % %Z - time-zone name, % %Y - year with century as a decimal number,e.g. 2001. week 7;19971130;1 END LC_TIME LC_MESSAGES yesexpr "^[+1yYeE]" noexpr "^[-0nN]" END LC_MESSAGES LC_PAPER copy "en_ZA" END LC_PAPER LC_TELEPHONE copy "en_ZA" END LC_TELEPHONE LC_MEASUREMENT copy "en_ZA" END LC_MEASUREMENT LC_NAME % Format for addressing a person. name_fmt "%d%t%g%t%m%t%f" % "Salutation", % "Empty string, or <Space>", % "First given name", % "Empty string, or <Space>", % "Middle names", % "Empty string, or <Space>", % "Clan names" % FIXME - define all the following name_* % General salutation for any sex % name_gen "" % Salutation for unmarried females - "" % name_miss "" % Salutation for males - "" % name_mr "" % Salutation for married females - "" % name_mrs "" % Salutation valid for all females - "" (no term) % name_ms "" END LC_NAME LC_ADDRESS % Country name in Tswana country_name "Aforika Borwa" % Abbreviated country postal name country_post "ZA" % UN Geneve 1949:68 Distinguishing signs of vehicles in international traffic % http://www.unece.org/trans/conventn/disting-signs-5-2001.pdf country_car "ZA" % FIXME define the following correctly % country_isbn "" % Language name in Tswana lang_name "Setswana" % ISO 639 two and three letter language names % see http://www.loc.gov/standards/iso639-2/englangn.html lang_ab "tn" lang_term "tsn" lang_lib "tsn" % Representation of postal addresses (minus the addressee's name) in South % Africa. (Ignored for now) postal_fmt "%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N" % "%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N", which gives - % "firm name", % "end of line", % "C/O address", % "end of line", % "department name", % "Building name", % "end of line", % "street or block name", % "space", % "house number or designation", % "space", % "floor number", % "space", % "room number, door designation", % "end of line", % "postal code", % "space", % "town, city", % "end of line", % "country designation for the <country_post> keyword", % "end of line % % ISO 3166 country number and 2 and 3 letter abreviations % http://www.unicode.org/onlinedat/countries.html country_ab2 "ZA" country_ab3 "ZAF" country_num 710 END LC_ADDRESS
{ "pile_set_name": "Github" }
class Scout::Realtime::Disk < Scout::Realtime::Metric include Scout::Realtime::MultiAggregator FIELDS = {:size => {'label'=>'Disk Size', 'units'=>'GB', 'precision'=>0}, :used => {'label'=>'Disk Space Used', 'units'=>'GB', 'precision'=>0}, :avail => {'label'=>'Disk Space Available', 'units'=>'GB', 'precision'=>0}, :used_percent => {'label'=>'Disk Capacity', 'units'=>'%', 'precision'=>0}, :utilization => {'label'=>'Utilization', 'units'=>'%', 'precision'=>0}, :await => {'label'=>'I/O Wait', 'units'=>'ms', 'precision'=>1}, :wps => {'label'=>'Writes/sec', 'precision'=>0}, :rps_kb => {'label'=>'Read kBps', 'units'=>'kB/s', 'precision'=>1}, :average_queue_length => {'label'=>'Average Queue Size', 'precision'=>1}, :wps_kb => {'label'=>'Write kBps', 'units'=>'kB/s', 'precision'=>1}, :rps => {'label'=>'Reads/sec', 'precision'=> 0} } def initialize @collector = ServerMetrics::Disk.new(:ttl => Scout::Realtime::Main::TTL) super end end
{ "pile_set_name": "Github" }
/*********************************************************************************** * * Copyright (c) 2015 Kamil Baczkowicz * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * Contributors: * * Kamil Baczkowicz - initial API and implementation and/or initial documentation * */ package pl.baczkowicz.mqttspy.ui.controllers.edit; import java.io.File; import java.net.URL; import java.util.ResourceBundle; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.geometry.Pos; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn.CellEditEvent; import javafx.scene.control.TableView; import javafx.scene.control.TextField; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.TextFieldTableCell; import javafx.scene.layout.AnchorPane; import javafx.util.Callback; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import pl.baczkowicz.mqttspy.common.generated.PublicationDetails; import pl.baczkowicz.mqttspy.configuration.ConfiguredMqttConnectionDetails; import pl.baczkowicz.mqttspy.configuration.generated.UserInterfaceMqttConnectionDetails; import pl.baczkowicz.mqttspy.ui.controllers.EditMqttConnectionController; import pl.baczkowicz.spy.common.generated.ScriptDetails; import pl.baczkowicz.spy.ui.properties.BackgroundScriptProperties; import pl.baczkowicz.spy.ui.properties.BaseTopicProperty; import pl.baczkowicz.spy.ui.utils.DialogFactory; /** * Controller for editing a single connection - publications tab. */ @SuppressWarnings({"unchecked", "rawtypes"}) public class EditConnectionPublicationsController extends AnchorPane implements Initializable, IEditConnectionSubController { private final static Logger logger = LoggerFactory.getLogger(EditConnectionPublicationsController.class); /** The parent controller. */ private EditMqttConnectionController parent; // Action buttons @FXML private Button removePublicationButton; @FXML private Button removeScriptButton; // Pubs / subs @FXML private TextField publicationScriptsText; // Tables @FXML private TableView<BaseTopicProperty> publicationsTable; @FXML private TableView<BackgroundScriptProperties> backgroundPublicationScriptsTable; @FXML private TableColumn<BaseTopicProperty, String> publicationTopicColumn; // Background publication scripts @FXML private TableColumn<BackgroundScriptProperties, String> publicationScriptColumn; @FXML private TableColumn<BackgroundScriptProperties, Boolean> publicationAutoStartColumn; @FXML private TableColumn<BackgroundScriptProperties, Boolean> publicationRepeatColumn; // Other fields private final ChangeListener basicOnChangeListener = new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { onChange(); } }; // =============================== // === Initialisation ============ // =============================== public void initialize(URL location, ResourceBundle resources) { // Publication topics publicationTopicColumn.setCellValueFactory(new PropertyValueFactory<BaseTopicProperty, String>("topic")); publicationTopicColumn.setCellFactory(TextFieldTableCell.<BaseTopicProperty>forTableColumn()); publicationTopicColumn.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<BaseTopicProperty, String>>() { @Override public void handle(CellEditEvent<BaseTopicProperty, String> event) { BaseTopicProperty p = event.getRowValue(); String newValue = event.getNewValue(); p.topicProperty().set(newValue); logger.debug("New value = {}", publicationsTable.getSelectionModel().getSelectedItem().topicProperty().getValue()); onChange(); } }); // Publication scripts publicationScriptsText.textProperty().addListener(basicOnChangeListener); publicationAutoStartColumn.setCellValueFactory(new PropertyValueFactory<BackgroundScriptProperties, Boolean>("autoStart")); publicationAutoStartColumn.setCellFactory(new Callback<TableColumn<BackgroundScriptProperties, Boolean>, TableCell<BackgroundScriptProperties, Boolean>>() { public TableCell<BackgroundScriptProperties, Boolean> call( TableColumn<BackgroundScriptProperties, Boolean> p) { final TableCell<BackgroundScriptProperties, Boolean> cell = new TableCell<BackgroundScriptProperties, Boolean>() { @Override public void updateItem(final Boolean item, boolean empty) { super.updateItem(item, empty); if (!isEmpty()) { final BackgroundScriptProperties shownItem = getTableView().getItems().get(getIndex()); CheckBox box = new CheckBox(); box.selectedProperty().bindBidirectional(shownItem.autoStartProperty()); box.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { logger.info("New value = {} {}", shownItem.scriptProperty().getValue(), shownItem.autoStartProperty().getValue()); onChange(); } }); setGraphic(box); } else { setGraphic(null); } } }; cell.setAlignment(Pos.CENTER); return cell; } }); publicationRepeatColumn.setCellValueFactory(new PropertyValueFactory<BackgroundScriptProperties, Boolean>("repeat")); publicationRepeatColumn.setCellFactory(new Callback<TableColumn<BackgroundScriptProperties, Boolean>, TableCell<BackgroundScriptProperties, Boolean>>() { public TableCell<BackgroundScriptProperties, Boolean> call( TableColumn<BackgroundScriptProperties, Boolean> p) { final TableCell<BackgroundScriptProperties, Boolean> cell = new TableCell<BackgroundScriptProperties, Boolean>() { @Override public void updateItem(final Boolean item, boolean empty) { super.updateItem(item, empty); if (!isEmpty()) { final BackgroundScriptProperties shownItem = getTableView().getItems().get(getIndex()); CheckBox box = new CheckBox(); box.selectedProperty().bindBidirectional(shownItem.repeatProperty()); box.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { logger.info("New value = {} {}", shownItem.scriptProperty().getValue(), shownItem.repeatProperty().getValue()); onChange(); } }); setGraphic(box); } else { setGraphic(null); } } }; cell.setAlignment(Pos.CENTER); return cell; } }); publicationScriptColumn.setCellValueFactory(new PropertyValueFactory<BackgroundScriptProperties, String>("script")); publicationScriptColumn.setCellFactory(TextFieldTableCell.<BackgroundScriptProperties>forTableColumn()); publicationScriptColumn.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<BackgroundScriptProperties, String>>() { @Override public void handle(CellEditEvent<BackgroundScriptProperties, String> event) { String newValue = event.getNewValue(); final File scriptFile = new File(newValue); if (!newValue.isEmpty() && !scriptFile.exists()) { DialogFactory.createExceptionDialog( "File does not exist", "Could not locate the specified file - please check the name and the path.", "File named " + scriptFile.getName() + " does not exist at " + scriptFile.getAbsolutePath() + "!"); event.consume(); // TODO: clear the content backgroundPublicationScriptsTable.getSelectionModel().getSelectedItem().scriptProperty().setValue(""); } else { BackgroundScriptProperties p = event.getRowValue(); p.scriptProperty().set(newValue); logger.debug("New value = {}", backgroundPublicationScriptsTable.getSelectionModel().getSelectedItem().scriptProperty().getValue()); onChange(); } } }); } public void init() { // Nothing to do } // =============================== // === FXML ====================== // =============================== @FXML private void addPublication() { final BaseTopicProperty item = new BaseTopicProperty("/samplePublication/"); publicationsTable.getItems().add(item); onChange(); } @FXML private void addScript() { final BackgroundScriptProperties item = new BackgroundScriptProperties("put your script location here...", false, false); backgroundPublicationScriptsTable.getItems().add(item); onChange(); } @FXML private void removePublication() { final BaseTopicProperty item = publicationsTable.getSelectionModel().getSelectedItem(); if (item != null) { publicationsTable.getItems().remove(item); onChange(); } } @FXML private void removeScript() { final BackgroundScriptProperties item = backgroundPublicationScriptsTable.getSelectionModel().getSelectedItem(); if (item != null) { backgroundPublicationScriptsTable.getItems().remove(item); onChange(); } } // =============================== // === Logic ===================== // =============================== public void onChange() { parent.onChange(); } @Override public UserInterfaceMqttConnectionDetails readValues(final UserInterfaceMqttConnectionDetails connection) { // Publications topics for (final BaseTopicProperty publicationDetails : publicationsTable.getItems()) { final PublicationDetails newPublicationDetails = new PublicationDetails(); newPublicationDetails.setTopic(publicationDetails.topicProperty().getValue()); connection.getPublication().add(newPublicationDetails); } // Publication scripts connection.setPublicationScripts(publicationScriptsText.getText()); for (final BackgroundScriptProperties scriptDetails : backgroundPublicationScriptsTable.getItems()) { final ScriptDetails newScriptDetails = new ScriptDetails(); newScriptDetails.setFile(scriptDetails.scriptProperty().getValue()); newScriptDetails.setAutoStart(scriptDetails.autoStartProperty().getValue()); newScriptDetails.setRepeat(scriptDetails.repeatProperty().getValue()); connection.getBackgroundScript().add(newScriptDetails); } return connection; } @Override public void displayConnectionDetails(final ConfiguredMqttConnectionDetails connection) { // Publications topics removePublicationButton.setDisable(true); publicationsTable.getItems().clear(); for (final PublicationDetails pub : connection.getPublication()) { publicationsTable.getItems().add(new BaseTopicProperty(pub.getTopic())); } publicationsTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { removePublicationButton.setDisable(false); } }); // Publication scripts publicationScriptsText.setText(connection.getPublicationScripts()); removeScriptButton.setDisable(true); backgroundPublicationScriptsTable.getItems().clear(); for (final ScriptDetails script : connection.getBackgroundScript()) { backgroundPublicationScriptsTable.getItems().add(new BackgroundScriptProperties(script.getFile(), script.isAutoStart(), script.isRepeat())); } backgroundPublicationScriptsTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { removeScriptButton.setDisable(false); } }); } // =============================== // === Setters and getters ======= // =============================== @Override public void setParent(final EditMqttConnectionController controller) { this.parent = controller; } }
{ "pile_set_name": "Github" }
/* * test_051_braid.h * * Notes: * - The character array should be derived from the filename (by convention) * - Comments are not allowed in the char array, but gcode comments are OK e.g. (g0 test) Search for ********************************* to get to the uncommented code N4 (S8000)\n\ N5 (M3)\n\ N6 G92X0.327Y-33.521Z-1.000\n\ N7 G0Z4.000\n\ N8 F1800.0\n\ N9 G1 X0.327Y-33.521\n\ (Questionable???) N10 G1Z-1.000\n\ N11 X0.654Y-33.526\n\ N12 X0.980Y-33.534\n\ N13 X1.304Y-33.546\n\ N14 X1.626Y-33.562\n\ N15 X1.946Y-33.580\n\ N16 X2.262Y-33.602\n\ N17 X2.574Y-33.628\n\ N18 X2.882Y-33.656\n\ N19 X3.185Y-33.688\n\ N20 X3.483Y-33.724\n\ N21 X3.775Y-33.762\n\ N22 X4.060Y-33.805\n\ N23 X4.339Y-33.850\n\ N24 X4.610Y-33.898\n\ N25 X4.874Y-33.950\n\ N26 X5.130Y-34.005\n\ N27 X5.376Y-34.064\n\ N28 X5.614Y-34.125\n\ N29 X5.842Y-34.190\n\ N30 X6.060Y-34.257\n\ N31 X6.268Y-34.328\n\ N32 X6.466Y-34.402\n\ N33 X6.652Y-34.479\n\ N34 X6.827Y-34.559\n\ N35 X6.990Y-34.642\n\ N36 X7.141Y-34.728\n\ N37 X7.280Y-34.817\n\ N38 X7.407Y-34.909\n\ N39 X7.521Y-35.003\n\ N40 X7.621Y-35.101\n\ N41 X7.709Y-35.201\n\ N42 X7.783Y-35.304\n\ N43 X7.843Y-35.410\n\ N44 X7.890Y-35.518\n\ N45 X7.923Y-35.629\n\ N46 X7.942Y-35.743\n\ N47 X7.946Y-35.859\n\ N48 X7.937Y-35.977\n\ N49 X7.914Y-36.098\n\ N50 X7.876Y-36.221\n\ N51 X7.824Y-36.347\n\ N52 X7.758Y-36.475\n\ N53 X7.677Y-36.605\n\ N54 X7.583Y-36.738\n\ N55 X7.474Y-36.872\n\ N56 X7.352Y-37.009\n\ N57 X7.216Y-37.148\n\ N58 X7.066Y-37.289\n\ N59 X6.903Y-37.431\n\ N60 X6.536Y-37.722\n\ N61 X6.333Y-37.870\n\ N62 X6.118Y-38.020\n\ N63 X5.650Y-38.324\n\ N64 X5.399Y-38.479\n\ N65 X5.135Y-38.635\n\ N66 X4.576Y-38.951\n\ N67 X3.334Y-39.598\n\ N68 X2.971Y-39.776\n\ N69 X2.599Y-39.955\n\ N70 X1.828Y-40.317\n\ N71 X0.193Y-41.050\n\ N72 X-3.302Y-42.537\n\ N73 X-3.747Y-42.723\n\ N74 X-4.191Y-42.908\n\ N75 X-5.074Y-43.278\n\ N76 X-6.803Y-44.012\n\ N77 X-9.961Y-45.432\n\ N78 X-10.315Y-45.603\n\ N79 X-10.659Y-45.773\n\ N80 X-11.312Y-46.107\n\ N81 X-11.620Y-46.272\n\ N82 X-11.915Y-46.434\n\ N83 X-12.466Y-46.753\n\ N84 X-12.720Y-46.909\n\ N85 X-12.960Y-47.063\n\ N86 X-13.186Y-47.214\n\ N87 X-13.396Y-47.364\n\ N88 X-13.591Y-47.510\n\ N89 X-13.770Y-47.654\n\ N90 X-13.933Y-47.796\n\ N91 X-14.080Y-47.935\n\ N92 X-14.211Y-48.071\n\ N93 X-14.326Y-48.204\n\ N94 X-14.424Y-48.334\n\ N95 X-14.505Y-48.462\n\ N96 X-14.570Y-48.586\n\ N97 X-14.618Y-48.707\n\ N98 X-14.649Y-48.825\n\ N99 X-14.663Y-48.940\n\ N100 X-14.661Y-49.052\n\ N101 X-14.642Y-49.160\n\ N102 X-14.607Y-49.265\n\ N103 X-14.556Y-49.366\n\ N104 X-14.488Y-49.464\n\ N105 X-14.404Y-49.559\n\ N106 X-14.305Y-49.649\n\ N107 X-14.190Y-49.737\n\ N108 X-14.068Y-49.815\n\ N109 X-13.934Y-49.889\n\ N110 X-13.787Y-49.961\n\ N111 X-13.628Y-50.029\n\ N112 X-13.456Y-50.094\n\ N113 X-13.273Y-50.155\n\ N114 X-13.078Y-50.213\n\ N115 X-12.872Y-50.267\n\ N116 X-12.655Y-50.318\n\ N117 X-12.428Y-50.366\n\ N118 X-12.190Y-50.410\n\ N119 X-11.944Y-50.450\n\ N120 X-11.688Y-50.487\n\ N121 X-11.423Y-50.520\n\ N122 X-11.150Y-50.549\n\ N123 X-10.870Y-50.575\n\ N124 X-10.582Y-50.597\n\ N125 X-10.287Y-50.616\n\ N126 X-9.987Y-50.630\n\ N127 X-9.680Y-50.641\n\ N128 X-9.368Y-50.649\n\ N129 X-9.052Y-50.652\n\ N130 X-8.732Y-50.652\n\ N131 X-8.408Y-50.648\n\ N132 X-8.081Y-50.640\n\ N133 X-7.751Y-50.628\n\ N134 X-7.420Y-50.613\n\ N135 X-7.087Y-50.594\n\ N136 X-6.754Y-50.571\n\ N137 X-6.420Y-50.544\n\ N138 X-6.087Y-50.513\n\ N139 X-5.754Y-50.479\n\ N140 X-5.424Y-50.441\n\ N141 X-5.095Y-50.399\n\ N142 X-4.769Y-50.353\n\ N143 X-4.446Y-50.304\n\ N144 X-4.127Y-50.250\n\ N145 X-3.812Y-50.193\n\ N146 X-3.198Y-50.068\n\ N147 X-2.899Y-50.000\n\ N148 X-2.606Y-49.928\n\ N149 X-2.321Y-49.852\n\ N150 X-2.043Y-49.773\n\ N151 X-1.773Y-49.690\n\ N152 X-1.511Y-49.603\n\ N153 X-1.015Y-49.419\n\ N154 X-0.781Y-49.322\n\ N155 X-0.557Y-49.221\n\ N156 X-0.343Y-49.116\n\ N157 X-0.141Y-49.009\n\ N158 X0.050Y-48.897\n\ N159 X0.230Y-48.783\n\ N160 X0.398Y-48.664\n\ N161 X0.553Y-48.543\n\ N162 X0.696Y-48.418\n\ N163 X0.826Y-48.290\n\ N164 X0.943Y-48.159\n\ N165 X1.046Y-48.024\n\ N166 X1.136Y-47.887\n\ N167 X1.213Y-47.746\n\ N168 X1.275Y-47.602\n\ N169 X1.323Y-47.455\n\ N170 X1.357Y-47.308\n\ N171 X1.377Y-47.159\n\ N172 X1.383Y-47.006\n\ N173 X1.375Y-46.851\n\ N174 X1.353Y-46.693\n\ N175 X1.317Y-46.532\n\ N176 X1.267Y-46.369\n\ N177 X1.203Y-46.203\n\ N178 X1.126Y-46.035\n\ N179 X1.034Y-45.864\n\ N180 X0.929Y-45.691\n\ N181 X0.810Y-45.515\n\ N182 X0.677Y-45.338\n\ N183 X0.531Y-45.157\n\ N184 X0.199Y-44.791\n\ N185 X0.014Y-44.604\n\ N186 X-0.184Y-44.416\n\ N187 X-0.617Y-44.033\n\ N188 X-1.624Y-43.245\n\ N189 X-1.903Y-43.044\n\ N190 X-2.193Y-42.841\n\ N191 X-2.801Y-42.432\n\ N192 X-4.125Y-41.596\n\ N193 X-4.475Y-41.384\n\ N194 X-4.833Y-41.171\n\ N195 X-5.567Y-40.743\n\ N196 X-7.098Y-39.876\n\ N197 X-10.296Y-38.118\n\ N198 X-10.698Y-37.897\n\ N199 X-11.099Y-37.676\n\ N200 X-11.894Y-37.235\n\ N201 X-13.448Y-36.356\n\ N202 X-13.825Y-36.137\n\ N203 X-14.197Y-35.919\n\ N204 X-14.923Y-35.485\n\ N205 X-16.288Y-34.625\n\ N206 X-16.636Y-34.395\n\ N207 X-16.973Y-34.165\n\ N208 X-17.613Y-33.711\n\ N209 X-17.915Y-33.486\n\ N210 X-18.204Y-33.262\n\ N211 X-18.743Y-32.821\n\ N212 X-18.992Y-32.602\n\ N213 X-19.227Y-32.386\n\ N214 X-19.447Y-32.171\n\ N215 X-19.652Y-31.959\n\ N216 X-19.843Y-31.749\n\ N217 X-20.017Y-31.540\n\ N218 X-20.176Y-31.335\n\ N219 X-20.320Y-31.131\n\ N220 X-20.447Y-30.930\n\ N221 X-20.558Y-30.731\n\ N222 X-20.653Y-30.535\n\ N223 X-20.731Y-30.341\n\ N224 X-20.793Y-30.150\n\ N225 X-20.838Y-29.961\n\ N226 X-20.867Y-29.776\n\ N227 X-20.879Y-29.593\n\ N228 X-20.875Y-29.413\n\ N229 X-20.854Y-29.236\n\ N230 X-20.817Y-29.062\n\ N231 X-20.764Y-28.891\n\ N232 X-20.695Y-28.723\n\ N233 X-20.610Y-28.559\n\ N234 X-20.510Y-28.397\n\ N235 X-20.394Y-28.239\n\ N236 X-20.263Y-28.084\n\ N237 X-20.117Y-27.932\n\ N238 X-19.957Y-27.784\n\ N239 X-19.782Y-27.639\n\ N240 X-19.594Y-27.498\n\ N241 X-19.392Y-27.360\n\ N242 X-19.177Y-27.226\n\ N243 X-18.950Y-27.095\n\ N244 X-18.710Y-26.968\n\ N245 X-18.459Y-26.845\n\ N246 X-18.197Y-26.725\n\ N247 X-17.924Y-26.609\n\ N248 X-17.641Y-26.497\n\ N249 X-17.349Y-26.389\n\ N250 X-16.737Y-26.183\n\ N251 X-16.419Y-26.086\n\ N252 X-16.094Y-25.993\n\ N253 X-15.763Y-25.904\n\ N254 X-15.426Y-25.818\n\ N255 X-15.083Y-25.737\n\ N256 X-14.736Y-25.660\n\ N257 X-14.030Y-25.516\n\ N258 X-13.672Y-25.451\n\ N259 X-13.313Y-25.389\n\ N260 X-12.953Y-25.332\n\ N261 X-12.591Y-25.278\n\ N262 X-12.230Y-25.228\n\ N263 X-11.870Y-25.182\n\ N264 X-11.511Y-25.140\n\ N265 X-11.155Y-25.103\n\ N266 X-10.824Y-25.071\n\ N267 X-10.497Y-25.043\n\ N268 X-10.173Y-25.018\n\ N269 X-9.853Y-24.996\n\ N270 X-9.538Y-24.978\n\ N271 X-9.228Y-24.964\n\ N272 X-8.924Y-24.952\n\ N273 X-8.625Y-24.944\n\ N274 X-8.334Y-24.940\n\ N275 X-8.049Y-24.939\n\ N276 X-7.772Y-24.941\n\ N277 X-7.504Y-24.946\n\ N278 X-7.243Y-24.955\n\ N279 X-6.992Y-24.967\n\ N280 X-6.750Y-24.982\n\ N281 X-6.518Y-25.000\n\ N282 X-6.295Y-25.022\n\ N283 X-6.084Y-25.047\n\ N284 X-5.883Y-25.075\n\ N285 X-5.694Y-25.106\n\ N286 X-5.517Y-25.140\n\ N287 X-5.351Y-25.177\n\ N288 X-5.197Y-25.217\n\ N289 X-5.057Y-25.260\n\ N290 X-4.928Y-25.306\n\ N291 X-4.813Y-25.355\n\ N292 X-4.711Y-25.407\n\ N293 X-4.623Y-25.461\n\ N294 X-4.548Y-25.518\n\ N295 X-4.487Y-25.578\n\ N296 X-4.439Y-25.641\n\ N297 X-4.406Y-25.707\n\ N298 X-4.387Y-25.775\n\ N299 X-4.382Y-25.845\n\ N300 X-4.392Y-25.918\n\ N301 X-4.416Y-25.994\n\ N302 X-4.454Y-26.072\n\ N303 X-4.506Y-26.152\n\ N304 X-4.572Y-26.235\n\ N305 X-4.653Y-26.320\n\ N306 X-4.748Y-26.407\n\ N307 X-4.857Y-26.496\n\ N308 X-4.980Y-26.588\n\ N309 X-5.117Y-26.681\n\ N310 X-5.267Y-26.777\n\ N311 X-5.431Y-26.874\n\ N312 X-5.798Y-27.074\n\ N313 X-6.001Y-27.177\n\ N314 X-6.216Y-27.282\n\ N315 X-6.683Y-27.496\n\ N316 X-7.755Y-27.942\n\ N317 X-8.049Y-28.057\n\ N318 X-8.353Y-28.173\n\ N319 X-8.990Y-28.409\n\ N320 X-10.362Y-28.891\n\ N321 X-10.753Y-29.024\n\ N322 X-11.151Y-29.158\n\ N323 X-11.968Y-29.428\n\ N324 X-13.658Y-29.973\n\ N325 X-17.113Y-31.067\n\ N326 X-17.538Y-31.202\n\ N327 X-17.959Y-31.337\n\ N328 X-18.788Y-31.604\n\ N329 X-20.370Y-32.127\n\ N330 X-20.746Y-32.255\n\ N331 X-21.113Y-32.382\n\ N332 X-21.817Y-32.631\n\ N333 X-23.093Y-33.111\n\ N334 X-23.381Y-33.226\n\ N335 X-23.656Y-33.339\n\ N336 X-24.164Y-33.560\n\ N337 X-24.397Y-33.667\n\ N338 X-24.615Y-33.772\n\ N339 X-25.005Y-33.974\n\ N340 X-25.177Y-34.072\n\ N341 X-25.332Y-34.167\n\ N342 X-25.472Y-34.259\n\ N100 G92 X-25.177Y-34.072 Z-1.000 (TEMP, REMOVE LATER)\n\ */ /***************************************************************************/ /***************************************************************************/ /***************************************************************************/ /***************************************************************************/ const char test_braid[] PROGMEM = "\ N1 T1M6\n\ N2 G17\n\ N3 G21\n\ N8 F1800\n\ N9 G1\n\ N100 G92 X-25.177Y-34.072 Z-1.000 (TEMP, REMOVE LATER)\n\ N343 X-25.595Y-34.349\n\ N344 X-25.701Y-34.436\n\ N345 X-25.791Y-34.520\n\ N346 X-25.864Y-34.601\n\ N347 X-25.920Y-34.679\n\ N348 X-25.960Y-34.754\n\ N349 X-25.982Y-34.826\n\ N350 X-25.987Y-34.895\n\ N351 X-25.976Y-34.961\n\ N352 X-25.948Y-35.023\n\ N353 X-25.903Y-35.082\n\ N354 X-25.841Y-35.138\n\ N355 X-25.763Y-35.190\n\ N356 X-25.669Y-35.239\n\ N357 X-25.559Y-35.284\n\ N358 X-25.433Y-35.325\n\ N359 X-25.291Y-35.363\n\ N360 X-25.134Y-35.397\n\ N361 X-24.963Y-35.428\n\ N362 X-24.777Y-35.455\n\ N363 X-24.577Y-35.477\n\ N364 X-24.367Y-35.496\n\ N365 X-24.144Y-35.511\n\ N366 X-23.909Y-35.522\n\ N367 X-23.661Y-35.529\n\ N368 X-23.403Y-35.532\n\ N369 X-23.133Y-35.532\n\ N370 X-22.853Y-35.527\n\ /N2518 G0X0.327Y-33.521Z-1.000\n\ N2519 M30"; /* N371 X-22.563Y-35.519\n\ N372 X-22.263Y-35.506\n\ N373 X-21.955Y-35.490\n\ N374 X-21.638Y-35.470\n\ N375 X-21.313Y-35.445\n\ N376 X-20.981Y-35.416\n\ N377 X-20.643Y-35.384\n\ N378 X-20.299Y-35.347\n\ N379 X-19.949Y-35.306\n\ N380 X-19.595Y-35.261\n\ N381 X-19.237Y-35.212\n\ N382 X-18.875Y-35.158\n\ N383 X-18.511Y-35.101\n\ N384 X-18.145Y-35.039 N385 X-17.777Y-34.973 N386 X-17.041Y-34.829 N387 X-16.673Y-34.751 N388 X-16.306Y-34.668 N389 X-15.580Y-34.491 N390 X-15.222Y-34.396 N391 X-14.867Y-34.297 N392 X-14.172Y-34.086 N393 X-13.833Y-33.975 N394 X-13.501Y-33.859 N395 X-13.176Y-33.740 N396 X-12.858Y-33.616 N397 X-12.548Y-33.488 N398 X-12.248Y-33.357 N399 X-11.675Y-33.082 N400 X-11.404Y-32.938 N401 X-11.144Y-32.791 N402 X-10.896Y-32.639 N403 X-10.659Y-32.484 N404 X-10.435Y-32.326 N405 X-10.223Y-32.163 N406 X-10.025Y-31.997 N407 X-9.840Y-31.827 N408 X-9.669Y-31.653 N409 X-9.512Y-31.476 N410 X-9.370Y-31.295 N411 X-9.242Y-31.111 N412 X-9.130Y-30.923 N413 X-9.033Y-30.732 N414 X-8.951Y-30.538 N415 X-8.885Y-30.340 N416 X-8.835Y-30.139 N417 X-8.801Y-29.934 N418 X-8.782Y-29.727 N419 X-8.780Y-29.517 N420 X-8.794Y-29.303 N421 X-8.825Y-29.087 N422 X-8.871Y-28.867 N423 X-8.934Y-28.645 N424 X-9.006Y-28.435 N425 X-9.093Y-28.223 N426 X-9.194Y-28.008 N427 X-9.308Y-27.792 N428 X-9.435Y-27.573 N429 X-9.577Y-27.352 N430 X-9.898Y-26.903 N431 X-10.078Y-26.676 N432 X-10.271Y-26.446 N433 X-10.693Y-25.982 N434 X-10.922Y-25.748 N435 X-11.162Y-25.511 N436 X-11.675Y-25.034 N437 X-11.948Y-24.793 N438 X-12.230Y-24.550 N439 X-12.824Y-24.061 N440 X-14.114Y-23.068 N441 X-17.000Y-21.038 N442 X-17.380Y-20.782 N443 X-17.762Y-20.525 N444 X-18.532Y-20.010 N445 X-20.077Y-18.979 N446 X-20.462Y-18.721 N447 X-20.845Y-18.464 N448 X-21.602Y-17.949 N449 X-23.072Y-16.925 N450 X-23.427Y-16.671 N451 X-23.776Y-16.417 N452 X-24.454Y-15.911 N453 X-25.717Y-14.911 N454 X-26.011Y-14.664 N455 X-26.295Y-14.418 N456 X-26.833Y-13.930 N457 X-27.086Y-13.688 N458 X-27.328Y-13.447 N459 X-27.777Y-12.971 N460 X-28.000Y-12.715 N461 X-28.209Y-12.461 N462 X-28.404Y-12.210 N463 X-28.583Y-11.961 N464 X-28.746Y-11.713 N465 X-28.894Y-11.469 N466 X-29.026Y-11.226 N467 X-29.142Y-10.986 N468 X-29.242Y-10.749 N469 X-29.325Y-10.514 N470 X-29.391Y-10.281 N471 X-29.441Y-10.052 N472 X-29.475Y-9.825 N473 X-29.491Y-9.601 N474 X-29.491Y-9.380 N475 X-29.475Y-9.162 N476 X-29.441Y-8.947 N477 X-29.391Y-8.735 N478 X-29.325Y-8.526 N479 X-29.242Y-8.320 N480 X-29.144Y-8.118 N481 X-29.029Y-7.919 N482 X-28.899Y-7.723 N483 X-28.753Y-7.531 N484 X-28.592Y-7.342 N485 X-28.416Y-7.156 N486 X-28.226Y-6.974 N487 X-28.022Y-6.796 N488 X-27.804Y-6.621 N489 X-27.572Y-6.450 N490 X-27.071Y-6.119 N491 X-26.802Y-5.959 N492 X-26.522Y-5.803 N493 X-25.929Y-5.502 N494 X-25.617Y-5.358 N495 X-25.296Y-5.217 N496 X-24.628Y-4.948 N497 X-24.283Y-4.819 N498 X-23.930Y-4.694 N499 X-23.207Y-4.457 N500 X-22.838Y-4.344 N501 X-22.465Y-4.236 N502 X-21.707Y-4.031 N503 X-21.325Y-3.935 N504 X-20.941Y-3.842 N505 X-20.170Y-3.670 N506 X-19.786Y-3.590 N507 X-19.402Y-3.515 N508 X-18.642Y-3.375 N509 X-18.266Y-3.312 N510 X-17.894Y-3.252 N511 X-17.527Y-3.197 N512 X-17.164Y-3.145 N513 X-16.808Y-3.098 N514 X-16.459Y-3.055 N515 X-16.116Y-3.015 N516 X-15.781Y-2.980 N517 X-15.477Y-2.951 N518 X-15.179Y-2.925 N519 X-14.891Y-2.902 N520 X-14.611Y-2.883 N521 X-14.340Y-2.867 N522 X-14.078Y-2.855 N523 X-13.827Y-2.845 N524 X-13.586Y-2.839 N525 X-13.355Y-2.837 N526 X-13.136Y-2.837 N527 X-12.929Y-2.841 N528 X-12.733Y-2.848 N529 X-12.549Y-2.858 N530 X-12.378Y-2.871 N531 X-12.220Y-2.888 N532 X-12.074Y-2.907 N533 X-11.942Y-2.929 N534 X-11.823Y-2.955 N535 X-11.717Y-2.983 N536 X-11.626Y-3.014 N537 X-11.548Y-3.048 N538 X-11.484Y-3.084 N539 X-11.435Y-3.124 N540 X-11.400Y-3.166 N541 X-11.379Y-3.210 N542 X-11.372Y-3.258 N543 X-11.380Y-3.308 N544 X-11.403Y-3.360 N545 X-11.440Y-3.415 N546 X-11.491Y-3.472 N547 X-11.556Y-3.532 N548 X-11.636Y-3.594 N549 X-11.729Y-3.658 N550 X-11.837Y-3.724 N551 X-11.959Y-3.793 N552 X-12.094Y-3.863 N553 X-12.242Y-3.936 N554 X-12.404Y-4.010 N555 X-12.767Y-4.165 N556 X-12.967Y-4.245 N557 X-13.179Y-4.327 N558 X-13.639Y-4.495 N559 X-14.691Y-4.850 N560 X-14.979Y-4.942 N561 X-15.277Y-5.036 N562 X-15.897Y-5.225 N563 X-17.230Y-5.617 N564 X-20.146Y-6.431 N565 X-20.516Y-6.532 N566 X-20.887Y-6.634 N567 X-21.630Y-6.837 N568 X-23.106Y-7.241 N569 X-25.895Y-8.028 N570 X-26.218Y-8.123 N571 X-26.535Y-8.218 N572 X-27.145Y-8.403 N573 X-28.260Y-8.760 N574 X-28.514Y-8.846 N575 X-28.759Y-8.930 N576 X-29.214Y-9.095 N577 X-29.425Y-9.175 N578 X-29.624Y-9.253 N579 X-29.986Y-9.404 N580 X-30.149Y-9.477 N581 X-30.298Y-9.548 N582 X-30.435Y-9.617 N583 X-30.559Y-9.684 N584 X-30.669Y-9.749 N585 X-30.766Y-9.812 N586 X-30.849Y-9.872 N587 X-30.918Y-9.931 N588 X-30.974Y-9.987 N589 X-31.016Y-10.041 N590 X-31.043Y-10.092 N591 X-31.057Y-10.141 N592 X-31.057Y-10.188 N593 X-31.043Y-10.232 N594 X-31.015Y-10.273 N595 X-30.972Y-10.312 N596 X-30.916Y-10.349 N597 X-30.847Y-10.382 N598 X-30.763Y-10.413 N599 X-30.666Y-10.441 N600 X-30.556Y-10.466 N601 X-30.432Y-10.489 N602 X-30.295Y-10.508 N603 X-30.146Y-10.525 N604 X-29.984Y-10.539 N605 X-29.809Y-10.549 N606 X-29.622Y-10.557 N607 X-29.424Y-10.562 N608 X-29.214Y-10.563 N609 X-28.992Y-10.562 N610 X-28.760Y-10.557 N611 X-28.517Y-10.549 N612 X-28.242Y-10.537 N613 X-27.955Y-10.521 N614 X-27.657Y-10.501 N615 X-27.349Y-10.477 N616 X-27.031Y-10.450 N617 X-26.703Y-10.418 N618 X-26.366Y-10.383 N619 X-26.021Y-10.343 N620 X-25.668Y-10.300 N621 X-25.308Y-10.253 N622 X-24.568Y-10.146 N623 X-24.191Y-10.086 N624 X-23.808Y-10.023 N625 X-23.032Y-9.883 N626 X-22.640Y-9.807 N627 X-22.245Y-9.728 N628 X-21.453Y-9.556 N629 X-21.057Y-9.463 N630 X-20.662Y-9.367 N631 X-19.876Y-9.162 N632 X-19.487Y-9.054 N633 X-19.101Y-8.941 N634 X-18.343Y-8.704 N635 X-17.972Y-8.579 N636 X-17.606Y-8.450 N637 X-16.896Y-8.180 N638 X-16.552Y-8.040 N639 X-16.217Y-7.895 N640 X-15.574Y-7.594 N641 X-15.268Y-7.438 N642 X-14.972Y-7.277 N643 X-14.414Y-6.946 N644 X-14.153Y-6.774 N645 X-13.905Y-6.599 N646 X-13.669Y-6.420 N647 X-13.447Y-6.237 N648 X-13.239Y-6.051 N649 X-13.044Y-5.862 N650 X-12.864Y-5.669 N651 X-12.699Y-5.472 N652 X-12.549Y-5.272 N653 X-12.414Y-5.069 N654 X-12.294Y-4.862 N655 X-12.190Y-4.652 N656 X-12.102Y-4.439 N657 X-12.030Y-4.223 N658 X-11.975Y-4.003 N659 X-11.935Y-3.781 N660 X-11.911Y-3.555 N661 X-11.904Y-3.327 N662 X-11.914Y-3.096 N663 X-11.939Y-2.862 N664 X-11.981Y-2.625 N665 X-12.038Y-2.386 N666 X-12.112Y-2.144 N667 X-12.202Y-1.899 N668 X-12.300Y-1.669 N669 X-12.412Y-1.436 N670 X-12.537Y-1.201 N671 X-12.675Y-0.965 N672 X-12.826Y-0.726 N673 X-12.990Y-0.486 N674 X-13.355Y0.001 N675 X-13.555Y0.246 N676 X-13.768Y0.494 N677 X-14.226Y0.993 N678 X-15.266Y2.009 N679 X-15.550Y2.266 N680 X-15.842Y2.524 N681 X-16.451Y3.043 N682 X-17.752Y4.093 N683 X-20.572Y6.219 N684 X-20.935Y6.486 N685 X-21.298Y6.753 N686 X-22.024Y7.287 N687 X-23.456Y8.353 N688 X-23.807Y8.618 N689 X-24.154Y8.883 N690 X-24.835Y9.411 N691 X-26.125Y10.458 N692 X-26.431Y10.717 N693 X-26.728Y10.975 N694 X-27.297Y11.489 N695 X-27.568Y11.744 N696 X-27.830Y11.997 N697 X-28.322Y12.500 N698 X-28.552Y12.749 N699 X-28.771Y12.997 N700 X-28.978Y13.243 N701 X-29.174Y13.487 N702 X-29.357Y13.729 N703 X-29.528Y13.970 N704 X-29.686Y14.209 N705 X-29.831Y14.446 N706 X-29.974Y14.700 N707 X-30.101Y14.953 N708 X-30.212Y15.202 N709 X-30.307Y15.449 N710 X-30.385Y15.694 N711 X-30.447Y15.936 N712 X-30.492Y16.175 N713 X-30.521Y16.411 N714 X-30.532Y16.644 N715 X-30.527Y16.874 N716 X-30.505Y17.102 N717 X-30.466Y17.326 N718 X-30.411Y17.547 N719 X-30.338Y17.765 N720 X-30.249Y17.980 N721 X-30.144Y18.191 N722 X-30.022Y18.399 N723 X-29.884Y18.603 N724 X-29.730Y18.805 N725 X-29.561Y19.002 N726 X-29.376Y19.196 N727 X-29.176Y19.386 N728 X-28.962Y19.573 N729 X-28.733Y19.756 N730 X-28.490Y19.935 N731 X-28.233Y20.111 N732 X-27.964Y20.282 N733 X-27.681Y20.450 N734 X-27.386Y20.614 N735 X-27.080Y20.774 N736 X-26.434Y21.081 N737 X-26.096Y21.229 N738 X-25.748Y21.373 N739 X-25.025Y21.648 N740 X-24.652Y21.780 N741 X-24.272Y21.907 N742 X-23.493Y22.149 N743 X-23.095Y22.264 N744 X-22.693Y22.375 N745 X-21.877Y22.583 N746 X-21.466Y22.681 N747 X-21.053Y22.775 N748 X-20.223Y22.949 N749 X-19.809Y23.030 N750 X-19.396Y23.107 N751 X-18.575Y23.247 N752 X-18.169Y23.311 N753 X-17.767Y23.371 N754 X-16.977Y23.478 N755 X-16.591Y23.525 N756 X-16.211Y23.568 N757 X-15.838Y23.606 N758 X-15.473Y23.641 N759 X-15.116Y23.671 N760 X-14.769Y23.698 N761 X-14.430Y23.720 N762 X-14.102Y23.739 N763 X-13.791Y23.753 N764 X-13.490Y23.763 N765 X-13.200Y23.769 N766 X-12.922Y23.772 N767 X-12.657Y23.771 N768 X-12.404Y23.766 N769 X-12.164Y23.758 N770 X-11.937Y23.746 N771 X-11.724Y23.730 N772 X-11.525Y23.711 N773 X-11.340Y23.688 N774 X-11.171Y23.662 N775 X-11.016Y23.633 N776 X-10.876Y23.600 N777 X-10.752Y23.564 N778 X-10.643Y23.524 N779 X-10.549Y23.481 N780 X-10.472Y23.435 N781 X-10.411Y23.386 N782 X-10.365Y23.334 N783 X-10.336Y23.279 N784 X-10.323Y23.221 N785 X-10.326Y23.161 N786 X-10.344Y23.097 N787 X-10.379Y23.030 N788 X-10.430Y22.961 N789 X-10.497Y22.889 N790 X-10.579Y22.815 N791 X-10.676Y22.738 N792 X-10.789Y22.659 N793 X-10.917Y22.577 N794 X-11.060Y22.493 N795 X-11.217Y22.407 N796 X-11.389Y22.318 N797 X-11.773Y22.135 N798 X-11.985Y22.041 N799 X-12.210Y21.945 N800 X-12.697Y21.747 N801 X-12.958Y21.645 N802 X-13.230Y21.542 N803 X-13.806Y21.331 N804 X-15.066Y20.894 N805 X-15.401Y20.782 N806 X-15.742Y20.670 N807 X-16.442Y20.441 N808 X-17.896Y19.977 N809 X-20.868Y19.035 N810 X-21.208Y18.926 N811 X-21.545Y18.817 N812 X-22.208Y18.600 N813 X-23.472Y18.173 N814 X-23.772Y18.068 N815 X-24.066Y17.964 N816 X-24.629Y17.759 N817 X-25.650Y17.361 N818 X-25.881Y17.265 N819 X-26.101Y17.170 N820 X-26.509Y16.984 N821 X-26.696Y16.893 N822 X-26.871Y16.804 N823 X-27.184Y16.631 N824 X-27.322Y16.547 N825 X-27.447Y16.465 N826 X-27.559Y16.385 N827 X-27.658Y16.306 N828 X-27.743Y16.230 N829 X-27.815Y16.156 N830 X-27.873Y16.084 N831 X-27.917Y16.014 N832 X-27.947Y15.946 N833 X-27.963Y15.880 N834 X-27.965Y15.817 N835 X-27.953Y15.756 N836 X-27.927Y15.697 N837 X-27.887Y15.641 N838 X-27.832Y15.588 N839 X-27.764Y15.537 N840 X-27.681Y15.488 N841 X-27.585Y15.442 N842 X-27.475Y15.399 N843 X-27.351Y15.358 N844 X-27.214Y15.321 N845 X-27.063Y15.286 N846 X-26.899Y15.253 N847 X-26.723Y15.224 N848 X-26.533Y15.198 N849 X-26.332Y15.174 N850 X-26.118Y15.154 N851 X-25.892Y15.136 N852 X-25.654Y15.122 N853 X-25.405Y15.110 N854 X-25.145Y15.102 N855 X-24.875Y15.097 N856 X-24.594Y15.095 N857 X-24.304Y15.096 N858 X-24.004Y15.100 N859 X-23.694Y15.107 N860 X-23.377Y15.118 N861 X-23.051Y15.132 N862 X-22.717Y15.149 N863 X-22.376Y15.170 N864 X-21.998Y15.196 N865 X-21.613Y15.226 N866 X-21.221Y15.260 N867 X-20.822Y15.298 N868 X-20.418Y15.340 N869 X-20.010Y15.385 N870 X-19.180Y15.489 N871 X-18.761Y15.547 N872 X-18.339Y15.609 N873 X-17.492Y15.744 N874 X-17.067Y15.818 N875 X-16.644Y15.896 N876 X-15.800Y16.064 N877 X-15.382Y16.154 N878 X-14.967Y16.248 N879 X-14.150Y16.448 N880 X-13.749Y16.554 N881 X-13.354Y16.664 N882 X-12.583Y16.895 N883 X-12.209Y17.017 N884 X-11.844Y17.142 N885 X-11.140Y17.405 N886 X-10.803Y17.542 N887 X-10.477Y17.683 N888 X-9.858Y17.975 N889 X-9.566Y18.127 N890 X-9.287Y18.283 N891 X-9.021Y18.442 N892 X-8.768Y18.604 N893 X-8.529Y18.771 N894 X-8.305Y18.940 N895 X-8.094Y19.113 N896 X-7.899Y19.290 N897 X-7.718Y19.470 N898 X-7.553Y19.653 N899 X-7.403Y19.839 N900 X-7.270Y20.029 N901 X-7.152Y20.221 N902 X-7.050Y20.417 N903 X-6.965Y20.616 N904 X-6.895Y20.818 N905 X-6.843Y21.023 N906 X-6.806Y21.230 N907 X-6.787Y21.441 N908 X-6.783Y21.654 N909 X-6.796Y21.870 N910 X-6.826Y22.088 N911 X-6.872Y22.309 N912 X-6.933Y22.532 N913 X-7.011Y22.758 N914 X-7.104Y22.986 N915 X-7.213Y23.217 N916 X-7.338Y23.449 N917 X-7.477Y23.684 N918 X-7.631Y23.921 N919 X-7.982Y24.401 N920 X-8.165Y24.627 N921 X-8.360Y24.855 N922 X-8.782Y25.315 N923 X-9.751Y26.251 N924 X-10.017Y26.488 N925 X-10.291Y26.726 N926 X-10.863Y27.204 N927 X-12.089Y28.170 N928 X-12.409Y28.413 N929 X-12.734Y28.657 N930 X-13.395Y29.145 N931 X-14.749Y30.124 N932 X-17.457Y32.077 N933 X-17.785Y32.320 N934 X-18.108Y32.561 N935 X-18.740Y33.042 N936 X-19.930Y33.994 N937 X-20.210Y34.229 N938 X-20.481Y34.463 N939 X-20.997Y34.927 N940 X-21.240Y35.157 N941 X-21.474Y35.386 N942 X-21.910Y35.838 N943 X-22.111Y36.062 N944 X-22.302Y36.284 N945 X-22.480Y36.505 N946 X-22.646Y36.723 N947 X-22.800Y36.940 N948 X-22.941Y37.155 N949 X-23.069Y37.367 N950 X-23.183Y37.578 N951 X-23.285Y37.786 N952 X-23.373Y37.993 N953 X-23.447Y38.197 N954 X-23.507Y38.398 N955 X-23.553Y38.598 N956 X-23.585Y38.795 N957 X-23.602Y38.989 N958 X-23.606Y39.181 N959 X-23.593Y39.386 N960 X-23.563Y39.588 N961 X-23.516Y39.787 N962 X-23.452Y39.983 N963 X-23.372Y40.175 N964 X-23.274Y40.364 N965 X-23.160Y40.550 N966 X-23.029Y40.732 N967 X-22.882Y40.910 N968 X-22.719Y41.086 N969 X-22.539Y41.257 N970 X-22.344Y41.425 N971 X-22.134Y41.589 N972 X-21.908Y41.749 N973 X-21.668Y41.906 N974 X-21.413Y42.059 N975 X-21.144Y42.208 N976 X-20.862Y42.353 N977 X-20.566Y42.494 N978 X-20.257Y42.631 N979 X-19.937Y42.763 N980 X-19.604Y42.892 N981 X-18.906Y43.138 N982 X-18.542Y43.254 N983 X-18.168Y43.366 N984 X-17.785Y43.474 N985 X-17.394Y43.578 N986 X-16.995Y43.678 N987 X-16.589Y43.773 N988 X-15.758Y43.950 N989 X-15.335Y44.033 N990 X-14.908Y44.111 N991 X-14.476Y44.184 N992 X-14.042Y44.253 N993 X-13.606Y44.318 N994 X-13.168Y44.379 N995 X-12.289Y44.486 N996 X-11.851Y44.534 N997 X-11.414Y44.576 N998 X-10.978Y44.615 N999 X-10.546Y44.649 N1000 X-10.116Y44.679 N1001 X-9.691Y44.704 N1002 X-9.271Y44.726 N1003 X-8.856Y44.742 N1004 X-8.447Y44.755 N1005 X-8.044Y44.763 N1006 X-7.650Y44.767 N1007 X-7.263Y44.766 N1008 X-6.885Y44.762 N1009 X-6.516Y44.753 N1010 X-6.157Y44.740 N1011 X-5.808Y44.723 N1012 X-5.471Y44.702 N1013 X-5.145Y44.676 N1014 X-4.830Y44.647 N1015 X-4.529Y44.613 N1016 X-4.240Y44.576 N1017 X-3.965Y44.535 N1018 X-3.703Y44.489 N1019 X-3.456Y44.440 N1020 X-3.227Y44.388 N1021 X-3.013Y44.332 N1022 X-2.813Y44.273 N1023 X-2.629Y44.210 N1024 X-2.459Y44.144 N1025 X-2.305Y44.074 N1026 X-2.167Y44.001 N1027 X-2.044Y43.925 N1028 X-1.938Y43.845 N1029 X-1.847Y43.762 N1030 X-1.773Y43.675 N1031 X-1.715Y43.586 N1032 X-1.673Y43.494 N1033 X-1.647Y43.398 N1034 X-1.638Y43.299 N1035 X-1.645Y43.198 N1036 X-1.667Y43.094 N1037 X-1.706Y42.987 N1038 X-1.761Y42.877 N1039 X-1.832Y42.765 N1040 X-1.918Y42.650 N1041 X-2.019Y42.532 N1042 X-2.135Y42.412 N1043 X-2.267Y42.290 N1044 X-2.412Y42.166 N1045 X-2.572Y42.039 N1046 X-2.934Y41.779 N1047 X-3.134Y41.646 N1048 X-3.347Y41.511 N1049 X-3.810Y41.235 N1050 X-4.059Y41.095 N1051 X-4.319Y40.953 N1052 X-4.869Y40.664 N1053 X-6.076Y40.071 N1054 X-8.785Y38.840 N1055 X-9.139Y38.683 N1056 X-9.494Y38.526 N1057 X-10.205Y38.212 N1058 X-11.612Y37.583 N1059 X-14.215Y36.343 N1060 X-14.490Y36.201 N1061 X-14.756Y36.061 N1062 X-15.263Y35.782 N1063 X-15.503Y35.645 N1064 X-15.734Y35.508 N1065 X-16.165Y35.239 N1066 X-16.365Y35.106 N1067 X-16.553Y34.975 N1068 X-16.730Y34.845 N1069 X-16.895Y34.717 N1070 X-17.049Y34.590 N1071 X-17.190Y34.465 N1072 X-17.318Y34.341 N1073 X-17.434Y34.219 N1074 X-17.537Y34.099 N1075 X-17.626Y33.981 N1076 X-17.702Y33.865 N1077 X-17.764Y33.751 N1078 X-17.813Y33.639 N1079 X-17.847Y33.528 N1080 X-17.868Y33.420 N1081 X-17.875Y33.315 N1082 X-17.867Y33.211 N1083 X-17.845Y33.110 N1084 X-17.809Y33.011 N1085 X-17.759Y32.914 N1086 X-17.695Y32.820 N1087 X-17.616Y32.728 N1088 X-17.523Y32.639 N1089 X-17.417Y32.552 N1090 X-17.296Y32.468 N1091 X-17.162Y32.387 N1092 X-17.014Y32.308 N1093 X-16.852Y32.232 N1094 X-16.677Y32.159 N1095 X-16.489Y32.089 N1096 X-16.288Y32.021 N1097 X-16.075Y31.956 N1098 X-15.849Y31.895 N1099 X-15.611Y31.836 N1100 X-15.361Y31.780 N1101 X-15.099Y31.727 N1102 X-14.827Y31.677 N1103 X-14.543Y31.631 N1104 X-14.250Y31.587 N1105 X-13.946Y31.547 N1106 X-13.632Y31.509 N1107 X-13.309Y31.475 N1108 X-12.977Y31.444 N1109 X-12.637Y31.417 N1110 X-12.289Y31.392 N1111 X-11.933Y31.371 N1112 X-11.570Y31.353 N1113 X-11.201Y31.338 N1114 X-10.825Y31.327 N1115 X-10.444Y31.319 N1116 X-10.058Y31.314 N1117 X-9.667Y31.313 N1118 X-9.273Y31.315 N1119 X-8.874Y31.320 N1120 X-8.473Y31.329 N1121 X-8.069Y31.341 N1122 X-7.630Y31.358 N1123 X-7.188Y31.379 N1124 X-6.746Y31.404 N1125 X-6.303Y31.433 N1126 X-5.861Y31.466 N1127 X-5.421Y31.503 N1128 X-4.982Y31.544 N1129 X-4.546Y31.589 N1130 X-4.113Y31.638 N1131 X-3.684Y31.691 N1132 X-3.260Y31.748 N1133 X-2.841Y31.809 N1134 X-2.428Y31.873 N1135 X-2.021Y31.942 N1136 X-1.231Y32.091 N1137 X-0.848Y32.171 N1138 X-0.475Y32.255 N1139 X-0.110Y32.343 N1140 X0.243Y32.434 N1141 X0.587Y32.530 N1142 X0.919Y32.629 N1143 X1.547Y32.838 N1144 X1.842Y32.948 N1145 X2.124Y33.061 N1146 X2.392Y33.178 N1147 X2.647Y33.299 N1148 X2.887Y33.423 N1149 X3.112Y33.550 N1150 X3.323Y33.681 N1151 X3.518Y33.815 N1152 X3.698Y33.952 N1153 X3.862Y34.092 N1154 X4.010Y34.236 N1155 X4.142Y34.383 N1156 X4.257Y34.533 N1157 X4.356Y34.685 N1158 X4.439Y34.841 N1159 X4.505Y35.000 N1160 X4.554Y35.161 N1161 X4.586Y35.325 N1162 X4.602Y35.492 N1163 X4.602Y35.662 N1164 X4.584Y35.834 N1165 X4.551Y36.008 N1166 X4.501Y36.185 N1167 X4.435Y36.364 N1168 X4.353Y36.546 N1169 X4.255Y36.730 N1170 X4.142Y36.916 N1171 X4.014Y37.104 N1172 X3.871Y37.294 N1173 X3.713Y37.486 N1174 X3.356Y37.876 N1175 X3.157Y38.073 N1176 X2.944Y38.272 N1177 X2.483Y38.675 N1178 X1.425Y39.496 N1179 X1.155Y39.690 N1180 X0.877Y39.885 N1181 X0.300Y40.277 N1182 X-0.925Y41.070 N1183 X-3.540Y42.667 N1184 X-3.871Y42.867 N1185 X-4.202Y43.066 N1186 X-4.858Y43.463 N1187 X-6.136Y44.252 N1188 X-6.444Y44.447 N1189 X-6.748Y44.642 N1190 X-7.337Y45.028 N1191 X-8.430Y45.788 N1192 X-8.682Y45.975 N1193 X-8.926Y46.161 N1194 X-9.383Y46.527 N1195 X-9.596Y46.708 N1196 X-9.799Y46.887 N1197 X-10.170Y47.241 N1198 X-10.337Y47.415 N1199 X-10.493Y47.587 N1200 X-10.636Y47.757 N1201 X-10.766Y47.925 N1202 X-10.884Y48.091 N1203 X-10.988Y48.255 N1204 X-11.078Y48.416 N1205 X-11.155Y48.576 N1206 X-11.218Y48.733 N1207 X-11.267Y48.888 N1208 X-11.301Y49.040 N1209 X-11.322Y49.190 N1210 X-11.328Y49.337 N1211 X-11.319Y49.482 N1212 X-11.296Y49.624 N1213 X-11.259Y49.763 N1214 X-11.207Y49.900 N1215 X-11.140Y50.033 N1216 X-11.059Y50.164 N1217 X-10.963Y50.293 N1218 X-10.853Y50.418 N1219 X-10.729Y50.540 N1220 X-10.591Y50.659 N1221 X-10.439Y50.775 N1222 X-10.276Y50.886 N1223 X-10.100Y50.994 N1224 X-9.912Y51.098 N1225 X-9.710Y51.200 N1226 X-9.496Y51.298 N1227 X-9.270Y51.394 N1228 X-8.783Y51.574 N1229 X-8.522Y51.660 N1230 X-8.250Y51.742 N1231 X-7.968Y51.821 N1232 X-7.675Y51.897 N1233 X-7.372Y51.969 N1234 X-7.059Y52.038 N1235 X-6.407Y52.165 N1236 X-6.068Y52.223 N1237 X-5.722Y52.278 N1238 X-5.368Y52.330 N1239 X-5.006Y52.378 N1240 X-4.639Y52.422 N1241 X-4.265Y52.463 N1242 X-3.886Y52.500 N1243 X-3.501Y52.533 N1244 X-3.112Y52.563 N1245 X-2.719Y52.590 N1246 X-2.322Y52.613 N1247 X-1.923Y52.632 N1248 X-1.521Y52.647 N1249 X-1.116Y52.659 N1250 X-0.711Y52.667 N1251 X-0.304Y52.672 N1252 X0.103Y52.673 N1253 X0.510Y52.670 N1254 X0.916Y52.664 N1255 X1.321Y52.654 N1256 X1.724Y52.640 N1257 X2.125Y52.623 N1258 X2.524Y52.602 N1259 X2.919Y52.577 N1260 X3.310Y52.549 N1261 X3.696Y52.517 N1262 X4.078Y52.481 N1263 X4.455Y52.442 N1264 X4.826Y52.400 N1265 X5.190Y52.354 N1266 X5.548Y52.304 N1267 X5.898Y52.251 N1268 X6.241Y52.194 N1269 X6.576Y52.134 N1270 X6.902Y52.070 N1271 X7.219Y52.003 N1272 X7.526Y51.933 N1273 X7.824Y51.859 N1274 X8.389Y51.701 N1275 X8.656Y51.617 N1276 X8.911Y51.530 N1277 X9.154Y51.439 N1278 X9.386Y51.346 N1279 X9.606Y51.249 N1280 X9.814Y51.149 N1281 X10.009Y51.046 N1282 X10.191Y50.939 N1283 X10.374Y50.821 N1284 X10.541Y50.698 N1285 X10.693Y50.573 N1286 X10.829Y50.444 N1287 X10.948Y50.311 N1288 X11.052Y50.175 N1289 X11.139Y50.036 N1290 X11.209Y49.894 N1291 X11.263Y49.748 N1292 X11.301Y49.600 N1293 X11.323Y49.448 N1294 X11.327Y49.293 N1295 X11.316Y49.136 N1296 X11.288Y48.975 N1297 X11.245Y48.812 N1298 X11.185Y48.646 N1299 X11.109Y48.478 N1300 X11.018Y48.307 N1301 X10.912Y48.133 N1302 X10.790Y47.957 N1303 X10.654Y47.779 N1304 X10.503Y47.598 N1305 X10.159Y47.230 N1306 X9.967Y47.043 N1307 X9.762Y46.854 N1308 X9.314Y46.470 N1309 X8.282Y45.681 N1310 X7.999Y45.480 N1311 X7.707Y45.278 N1312 X7.098Y44.870 N1313 X5.798Y44.041 N1314 X3.014Y42.350 N1315 X2.662Y42.138 N1316 X2.311Y41.925 N1317 X1.617Y41.500 N1318 X0.273Y40.654 N1319 X-0.049Y40.444 N1320 X-0.365Y40.234 N1321 X-0.975Y39.817 N1322 X-2.088Y38.994 N1323 X-2.324Y38.805 N1324 X-2.551Y38.617 N1325 X-2.974Y38.245 N1326 X-3.170Y38.061 N1327 X-3.354Y37.878 N1328 X-3.687Y37.516 N1329 X-3.836Y37.338 N1330 X-3.972Y37.162 N1331 X-4.096Y36.987 N1332 X-4.206Y36.813 N1333 X-4.304Y36.642 N1334 X-4.388Y36.473 N1335 X-4.459Y36.305 N1336 X-4.515Y36.139 N1337 X-4.558Y35.976 N1338 X-4.587Y35.815 N1339 X-4.602Y35.655 N1340 X-4.603Y35.498 N1341 X-4.589Y35.343 N1342 X-4.561Y35.191 N1343 X-4.519Y35.041 N1344 X-4.462Y34.893 N1345 X-4.391Y34.748 N1346 X-4.306Y34.605 N1347 X-4.207Y34.465 N1348 X-4.094Y34.327 N1349 X-3.967Y34.192 N1350 X-3.826Y34.060 N1351 X-3.671Y33.930 N1352 X-3.503Y33.803 N1353 X-3.321Y33.679 N1354 X-3.126Y33.558 N1355 X-2.919Y33.440 N1356 X-2.698Y33.324 N1357 X-2.466Y33.212 N1358 X-2.221Y33.102 N1359 X-1.697Y32.893 N1360 X-1.418Y32.792 N1361 X-1.128Y32.695 N1362 X-0.828Y32.601 N1363 X-0.518Y32.510 N1364 X-0.198Y32.422 N1365 X0.131Y32.338 N1366 X0.814Y32.178 N1367 X1.168Y32.104 N1368 X1.529Y32.032 N1369 X1.897Y31.964 N1370 X2.271Y31.899 N1371 X2.651Y31.838 N1372 X3.037Y31.780 N1373 X3.822Y31.674 N1374 X4.221Y31.626 N1375 X4.622Y31.581 N1376 X5.027Y31.540 N1377 X5.434Y31.502 N1378 X5.842Y31.468 N1379 X6.252Y31.437 N1380 X6.662Y31.410 N1381 X7.072Y31.386 N1382 X7.515Y31.363 N1383 X7.957Y31.345 N1384 X8.398Y31.331 N1385 X8.835Y31.321 N1386 X9.269Y31.315 N1387 X9.699Y31.313 N1388 X10.123Y31.315 N1389 X10.543Y31.321 N1390 X10.956Y31.330 N1391 X11.362Y31.344 N1392 X11.761Y31.362 N1393 X12.152Y31.383 N1394 X12.534Y31.409 N1395 X12.907Y31.438 N1396 X13.269Y31.471 N1397 X13.622Y31.508 N1398 X13.963Y31.549 N1399 X14.293Y31.593 N1400 X14.611Y31.641 N1401 X14.916Y31.693 N1402 X15.209Y31.749 N1403 X15.487Y31.808 N1404 X15.753Y31.870 N1405 X16.003Y31.936 N1406 X16.240Y32.006 N1407 X16.461Y32.079 N1408 X16.667Y32.155 N1409 X16.858Y32.235 N1410 X17.033Y32.318 N1411 X17.191Y32.404 N1412 X17.334Y32.493 N1413 X17.460Y32.586 N1414 X17.570Y32.681 N1415 X17.662Y32.780 N1416 X17.739Y32.881 N1417 X17.798Y32.986 N1418 X17.840Y33.093 N1419 X17.866Y33.203 N1420 X17.875Y33.316 N1421 X17.867Y33.431 N1422 X17.842Y33.549 N1423 X17.801Y33.670 N1424 X17.743Y33.793 N1425 X17.669Y33.918 N1426 X17.579Y34.045 N1427 X17.473Y34.175 N1428 X17.352Y34.307 N1429 X17.215Y34.441 N1430 X17.063Y34.577 N1431 X16.897Y34.715 N1432 X16.522Y34.997 N1433 X16.314Y35.140 N1434 X16.093Y35.285 N1435 X15.614Y35.580 N1436 X15.357Y35.729 N1437 X15.089Y35.879 N1438 X14.522Y36.184 N1439 X13.280Y36.806 N1440 X12.957Y36.960 N1441 X12.628Y37.115 N1442 X11.954Y37.427 N1443 X10.561Y38.054 N1444 X7.746Y39.303 N1445 X7.404Y39.457 N1446 X7.067Y39.611 N1447 X6.409Y39.915 N1448 X5.172Y40.511 N1449 X4.883Y40.657 N1450 X4.603Y40.802 N1451 X4.074Y41.087 N1452 X3.825Y41.227 N1453 X3.588Y41.365 N1454 X3.148Y41.636 N1455 X2.947Y41.769 N1456 X2.760Y41.900 N1457 X2.585Y42.029 N1458 X2.425Y42.156 N1459 X2.278Y42.280 N1460 X2.146Y42.402 N1461 X2.028Y42.522 N1462 X1.926Y42.639 N1463 X1.839Y42.754 N1464 X1.767Y42.866 N1465 X1.711Y42.976 N1466 X1.671Y43.083 N1467 X1.646Y43.187 N1468 X1.638Y43.289 N1469 X1.645Y43.387 N1470 X1.669Y43.483 N1471 X1.709Y43.576 N1472 X1.765Y43.665 N1473 X1.838Y43.752 N1474 X1.926Y43.835 N1475 X2.030Y43.915 N1476 X2.150Y43.992 N1477 X2.286Y44.065 N1478 X2.438Y44.135 N1479 X2.605Y44.202 N1480 X2.787Y44.265 N1481 X2.984Y44.324 N1482 X3.195Y44.380 N1483 X3.421Y44.433 N1484 X3.661Y44.481 N1485 X3.915Y44.526 N1486 X4.182Y44.568 N1487 X4.443Y44.603 N1488 X4.714Y44.635 N1489 X4.996Y44.663 N1490 X5.289Y44.688 N1491 X5.591Y44.710 N1492 X5.902Y44.728 N1493 X6.223Y44.743 N1494 X6.552Y44.754 N1495 X6.890Y44.762 N1496 X7.235Y44.766 N1497 X7.587Y44.767 N1498 X7.946Y44.764 N1499 X8.311Y44.758 N1500 X8.683Y44.748 N1501 X9.059Y44.735 N1502 X9.440Y44.717 N1503 X9.826Y44.697 N1504 X10.216Y44.672 N1505 X10.608Y44.644 N1506 X11.004Y44.613 N1507 X11.401Y44.578 N1508 X11.800Y44.539 N1509 X12.602Y44.450 N1510 X13.003Y44.400 N1511 X13.403Y44.347 N1512 X13.803Y44.289 N1513 X14.201Y44.229 N1514 X14.596Y44.164 N1515 X14.990Y44.096 N1516 X15.766Y43.949 N1517 X16.148Y43.870 N1518 X16.525Y43.787 N1519 X17.263Y43.611 N1520 X17.623Y43.518 N1521 X17.976Y43.421 N1522 X18.661Y43.217 N1523 X18.991Y43.109 N1524 X19.313Y42.999 N1525 X19.626Y42.884 N1526 X19.929Y42.767 N1527 X20.223Y42.645 N1528 X20.506Y42.521 N1529 X21.041Y42.262 N1530 X21.292Y42.127 N1531 X21.531Y41.990 N1532 X21.758Y41.849 N1533 X21.974Y41.704 N1534 X22.176Y41.557 N1535 X22.366Y41.407 N1536 X22.544Y41.253 N1537 X22.708Y41.097 N1538 X22.859Y40.937 N1539 X22.996Y40.775 N1540 X23.119Y40.609 N1541 X23.229Y40.441 N1542 X23.325Y40.269 N1543 X23.407Y40.095 N1544 X23.475Y39.919 N1545 X23.529Y39.739 N1546 X23.571Y39.541 N1547 X23.597Y39.341 N1548 X23.606Y39.137 N1549 X23.599Y38.930 N1550 X23.575Y38.721 N1551 X23.534Y38.508 N1552 X23.477Y38.293 N1553 X23.404Y38.075 N1554 X23.315Y37.855 N1555 X23.211Y37.632 N1556 X23.091Y37.406 N1557 X22.955Y37.178 N1558 X22.805Y36.948 N1559 X22.640Y36.716 N1560 X22.268Y36.244 N1561 X22.061Y36.005 N1562 X21.841Y35.765 N1563 X21.364Y35.278 N1564 X20.274Y34.284 N1565 X19.975Y34.031 N1566 X19.668Y33.778 N1567 X19.029Y33.267 N1568 X17.670Y32.234 N1569 X17.316Y31.974 N1570 X16.959Y31.713 N1571 X16.236Y31.190 N1572 X14.771Y30.140 N1573 X14.405Y29.877 N1574 X14.040Y29.614 N1575 X13.319Y29.089 N1576 X11.923Y28.043 N1577 X11.588Y27.783 N1578 X11.260Y27.524 N1579 X10.626Y27.008 N1580 X10.322Y26.752 N1581 X10.027Y26.497 N1582 X9.467Y25.990 N1583 X9.203Y25.738 N1584 X8.951Y25.488 N1585 X8.482Y24.992 N1586 X8.266Y24.747 N1587 X8.064Y24.503 N1588 X7.700Y24.021 N1589 X7.550Y23.799 N1590 X7.412Y23.578 N1591 X7.288Y23.359 N1592 X7.177Y23.143 N1593 X7.079Y22.928 N1594 X6.995Y22.715 N1595 X6.925Y22.504 N1596 X6.868Y22.295 N1597 X6.826Y22.089 N1598 X6.798Y21.884 N1599 X6.784Y21.682 N1600 X6.785Y21.483 N1601 X6.800Y21.285 N1602 X6.829Y21.091 N1603 X6.873Y20.898 N1604 X6.931Y20.708 N1605 X7.003Y20.521 N1606 X7.090Y20.336 N1607 X7.191Y20.154 N1608 X7.306Y19.975 N1609 X7.434Y19.799 N1610 X7.577Y19.625 N1611 X7.733Y19.454 N1612 X7.903Y19.286 N1613 X8.085Y19.121 N1614 X8.281Y18.959 N1615 X8.489Y18.800 N1616 X8.710Y18.644 N1617 X8.943Y18.491 N1618 X9.188Y18.341 N1619 X9.711Y18.051 N1620 X9.989Y17.910 N1621 X10.278Y17.773 N1622 X10.884Y17.508 N1623 X11.201Y17.381 N1624 X11.527Y17.257 N1625 X12.203Y17.019 N1626 X12.552Y16.905 N1627 X12.908Y16.795 N1628 X13.639Y16.584 N1629 X14.012Y16.484 N1630 X14.390Y16.387 N1631 X15.159Y16.204 N1632 X15.548Y16.118 N1633 X15.940Y16.035 N1634 X16.729Y15.880 N1635 X17.126Y15.808 N1636 X17.522Y15.739 N1637 X18.315Y15.612 N1638 X18.709Y15.554 N1639 X19.102Y15.499 N1640 X19.492Y15.448 N1641 X19.879Y15.401 N1642 X20.263Y15.357 N1643 X20.642Y15.316 N1644 X21.017Y15.279 N1645 X21.387Y15.245 N1646 X21.744Y15.215 N1647 X22.095Y15.189 N1648 X22.440Y15.166 N1649 X22.778Y15.146 N1650 X23.109Y15.129 N1651 X23.431Y15.116 N1652 X23.746Y15.106 N1653 X24.052Y15.099 N1654 X24.349Y15.095 N1655 X24.636Y15.095 N1656 X24.914Y15.097 N1657 X25.181Y15.103 N1658 X25.438Y15.112 N1659 X25.684Y15.123 N1660 X25.919Y15.138 N1661 X26.142Y15.156 N1662 X26.354Y15.177 N1663 X26.553Y15.200 N1664 X26.740Y15.227 N1665 X26.914Y15.256 N1666 X27.076Y15.288 N1667 X27.225Y15.323 N1668 X27.360Y15.361 N1669 X27.482Y15.402 N1670 X27.591Y15.445 N1671 X27.686Y15.491 N1672 X27.767Y15.539 N1673 X27.835Y15.590 N1674 X27.888Y15.643 N1675 X27.928Y15.699 N1676 X27.954Y15.757 N1677 X27.965Y15.818 N1678 X27.963Y15.881 N1679 X27.947Y15.946 N1680 X27.917Y16.014 N1681 X27.873Y16.083 N1682 X27.816Y16.155 N1683 X27.744Y16.229 N1684 X27.660Y16.305 N1685 X27.562Y16.382 N1686 X27.451Y16.462 N1687 X27.327Y16.544 N1688 X27.042Y16.712 N1689 X26.881Y16.799 N1690 X26.707Y16.887 N1691 X26.326Y17.069 N1692 X26.118Y17.162 N1693 X25.900Y17.256 N1694 X25.433Y17.449 N1695 X24.385Y17.849 N1696 X21.934Y18.690 N1697 X21.575Y18.807 N1698 X21.212Y18.925 N1699 X20.474Y19.161 N1700 X18.977Y19.635 N1701 X16.040Y20.572 N1702 X15.691Y20.686 N1703 X15.348Y20.800 N1704 X14.684Y21.024 N1705 X13.458Y21.457 N1706 X13.176Y21.562 N1707 X12.904Y21.666 N1708 X12.396Y21.868 N1709 X12.159Y21.966 N1710 X11.936Y22.063 N1711 X11.528Y22.250 N1712 X11.345Y22.340 N1713 X11.176Y22.429 N1714 X11.022Y22.515 N1715 X10.882Y22.599 N1716 X10.757Y22.681 N1717 X10.648Y22.760 N1718 X10.554Y22.836 N1719 X10.476Y22.910 N1720 X10.413Y22.982 N1721 X10.367Y23.051 N1722 X10.337Y23.117 N1723 X10.323Y23.180 N1724 X10.325Y23.240 N1725 X10.344Y23.298 N1726 X10.379Y23.352 N1727 X10.430Y23.403 N1728 X10.497Y23.452 N1729 X10.580Y23.497 N1730 X10.680Y23.538 N1731 X10.795Y23.577 N1732 X10.926Y23.612 N1733 X11.072Y23.644 N1734 X11.233Y23.673 N1735 X11.410Y23.698 N1736 X11.601Y23.719 N1737 X11.807Y23.737 N1738 X12.027Y23.751 N1739 X12.260Y23.762 N1740 X12.507Y23.769 N1741 X12.767Y23.772 N1742 X13.040Y23.771 N1743 X13.325Y23.767 N1744 X13.601Y23.760 N1745 X13.887Y23.749 N1746 X14.182Y23.734 N1747 X14.486Y23.717 N1748 X14.799Y23.696 N1749 X15.120Y23.671 N1750 X15.448Y23.643 N1751 X15.784Y23.612 N1752 X16.126Y23.577 N1753 X16.475Y23.538 N1754 X16.829Y23.496 N1755 X17.188Y23.450 N1756 X17.552Y23.401 N1757 X17.921Y23.348 N1758 X18.667Y23.232 N1759 X19.045Y23.169 N1760 X19.424Y23.102 N1761 X20.187Y22.957 N1762 X20.569Y22.879 N1763 X20.951Y22.797 N1764 X21.712Y22.623 N1765 X22.090Y22.531 N1766 X22.466Y22.435 N1767 X23.208Y22.232 N1768 X23.574Y22.125 N1769 X23.935Y22.015 N1770 X24.641Y21.784 N1771 X24.985Y21.663 N1772 X25.323Y21.538 N1773 X25.977Y21.279 N1774 X26.292Y21.144 N1775 X26.599Y21.006 N1776 X27.186Y20.719 N1777 X27.465Y20.571 N1778 X27.734Y20.419 N1779 X27.993Y20.264 N1780 X28.241Y20.106 N1781 X28.477Y19.944 N1782 X28.702Y19.779 N1783 X29.116Y19.440 N1784 X29.305Y19.266 N1785 X29.481Y19.088 N1786 X29.644Y18.908 N1787 X29.794Y18.724 N1788 X29.930Y18.538 N1789 X30.053Y18.349 N1790 X30.162Y18.156 N1791 X30.258Y17.961 N1792 X30.339Y17.763 N1793 X30.406Y17.563 N1794 X30.459Y17.359 N1795 X30.498Y17.153 N1796 X30.522Y16.944 N1797 X30.532Y16.733 N1798 X30.528Y16.519 N1799 X30.510Y16.303 N1800 X30.474Y16.066 N1801 X30.421Y15.826 N1802 X30.352Y15.583 N1803 X30.266Y15.337 N1804 X30.164Y15.089 N1805 X30.046Y14.839 N1806 X29.912Y14.586 N1807 X29.762Y14.330 N1808 X29.597Y14.073 N1809 X29.417Y13.813 N1810 X29.014Y13.287 N1811 X28.791Y13.021 N1812 X28.555Y12.753 N1813 X28.044Y12.211 N1814 X27.769Y11.938 N1815 X27.483Y11.663 N1816 X26.879Y11.109 N1817 X25.553Y9.985 N1818 X22.573Y7.693 N1819 X22.183Y7.405 N1820 X21.791Y7.116 N1821 X21.005Y6.537 N1822 X19.442Y5.382 N1823 X19.058Y5.094 N1824 X18.678Y4.806 N1825 X17.931Y4.232 N1826 X16.513Y3.095 N1827 X16.178Y2.813 N1828 X15.852Y2.532 N1829 X15.229Y1.974 N1830 X14.933Y1.697 N1831 X14.649Y1.422 N1832 X14.115Y0.876 N1833 X13.867Y0.606 N1834 X13.632Y0.337 N1835 X13.411Y0.071 N1836 X13.204Y-0.194 N1837 X13.010Y-0.457 N1838 X12.832Y-0.717 N1839 X12.668Y-0.976 N1840 X12.520Y-1.232 N1841 X12.395Y-1.469 N1842 X12.284Y-1.703 N1843 X12.188Y-1.936 N1844 X12.105Y-2.167 N1845 X12.036Y-2.395 N1846 X11.982Y-2.621 N1847 X11.942Y-2.844 N1848 X11.916Y-3.065 N1849 X11.905Y-3.284 N1850 X11.908Y-3.500 N1851 X11.926Y-3.713 N1852 X11.959Y-3.924 N1853 X12.005Y-4.132 N1854 X12.067Y-4.338 N1855 X12.142Y-4.540 N1856 X12.232Y-4.740 N1857 X12.336Y-4.937 N1858 X12.453Y-5.131 N1859 X12.584Y-5.322 N1860 X12.729Y-5.510 N1861 X12.887Y-5.695 N1862 X13.059Y-5.877 N1863 X13.243Y-6.055 N1864 X13.439Y-6.231 N1865 X13.648Y-6.403 N1866 X13.869Y-6.572 N1867 X14.101Y-6.738 N1868 X14.345Y-6.901 N1869 X14.599Y-7.060 N1870 X14.864Y-7.216 N1871 X15.423Y-7.518 N1872 X15.717Y-7.664 N1873 X16.020Y-7.806 N1874 X16.650Y-8.080 N1875 X16.976Y-8.212 N1876 X17.309Y-8.340 N1877 X17.994Y-8.586 N1878 X18.344Y-8.704 N1879 X18.700Y-8.818 N1880 X19.423Y-9.035 N1881 X20.902Y-9.426 N1882 X21.276Y-9.515 N1883 X21.650Y-9.600 N1884 X22.396Y-9.759 N1885 X22.767Y-9.833 N1886 X23.137Y-9.903 N1887 X23.868Y-10.033 N1888 X24.228Y-10.092 N1889 X24.584Y-10.148 N1890 X24.936Y-10.200 N1891 X25.282Y-10.249 N1892 X25.622Y-10.294 N1893 X25.956Y-10.336 N1894 X26.604Y-10.408 N1895 X26.910Y-10.438 N1896 X27.208Y-10.465 N1897 X27.498Y-10.489 N1898 X27.779Y-10.509 N1899 X28.051Y-10.527 N1900 X28.313Y-10.540 N1901 X28.565Y-10.551 N1902 X28.807Y-10.558 N1903 X29.038Y-10.562 N1904 X29.258Y-10.563 N1905 X29.466Y-10.561 N1906 X29.663Y-10.556 N1907 X29.848Y-10.547 N1908 X30.020Y-10.536 N1909 X30.180Y-10.522 N1910 X30.327Y-10.504 N1911 X30.462Y-10.484 N1912 X30.583Y-10.461 N1913 X30.690Y-10.435 N1914 X30.784Y-10.406 N1915 X30.865Y-10.374 N1916 X30.932Y-10.340 N1917 X30.984Y-10.303 N1918 X31.023Y-10.263 N1919 X31.048Y-10.221 N1920 X31.058Y-10.176 N1921 X31.055Y-10.128 N1922 X31.037Y-10.078 N1923 X31.006Y-10.026 N1924 X30.960Y-9.971 N1925 X30.900Y-9.914 N1926 X30.827Y-9.855 N1927 X30.739Y-9.794 N1928 X30.638Y-9.730 N1929 X30.524Y-9.664 N1930 X30.396Y-9.596 N1931 X30.255Y-9.527 N1932 X30.100Y-9.455 N1933 X29.754Y-9.306 N1934 X29.562Y-9.228 N1935 X29.359Y-9.149 N1936 X28.917Y-8.986 N1937 X27.902Y-8.642 N1938 X27.624Y-8.553 N1939 X27.336Y-8.462 N1940 X26.734Y-8.278 N1941 X25.440Y-7.896 N1942 X22.592Y-7.100 N1943 X22.191Y-6.990 N1944 X21.787Y-6.879 N1945 X20.978Y-6.659 N1946 X19.371Y-6.218 N1947 X18.976Y-6.109 N1948 X18.584Y-6.000 N1949 X17.814Y-5.783 N1950 X16.349Y-5.360 N1951 X16.002Y-5.257 N1952 X15.664Y-5.155 N1953 X15.016Y-4.954 N1954 X14.708Y-4.856 N1955 X14.410Y-4.759 N1956 X13.850Y-4.569 N1957 X13.589Y-4.477 N1958 X13.340Y-4.387 N1959 X12.883Y-4.212 N1960 X12.675Y-4.127 N1961 X12.482Y-4.045 N1962 X12.140Y-3.886 N1963 X11.991Y-3.810 N1964 X11.859Y-3.737 N1965 X11.741Y-3.665 N1966 X11.640Y-3.597 N1967 X11.555Y-3.531 N1968 X11.486Y-3.467 N1969 X11.433Y-3.406 N1970 X11.397Y-3.348 N1971 X11.377Y-3.293 N1972 X11.373Y-3.241 N1973 X11.386Y-3.191 N1974 X11.415Y-3.145 N1975 X11.460Y-3.101 N1976 X11.522Y-3.061 N1977 X11.600Y-3.024 N1978 X11.694Y-2.990 N1979 X11.803Y-2.959 N1980 X11.928Y-2.932 N1981 X12.068Y-2.908 N1982 X12.223Y-2.887 N1983 X12.393Y-2.870 N1984 X12.578Y-2.856 N1985 X12.776Y-2.846 N1986 X12.989Y-2.840 N1987 X13.214Y-2.837 N1988 X13.453Y-2.838 N1989 X13.704Y-2.842 N1990 X13.967Y-2.850 N1991 X14.242Y-2.862 N1992 X14.527Y-2.878 N1993 X14.824Y-2.897 N1994 X15.130Y-2.921 N1995 X15.425Y-2.946 N1996 X15.727Y-2.975 N1997 X16.037Y-3.007 N1998 X16.353Y-3.042 N1999 X16.676Y-3.081 N2000 X17.005Y-3.124 N2001 X17.678Y-3.219 N2002 X18.021Y-3.272 N2003 X18.368Y-3.329 N2004 X19.071Y-3.452 N2005 X19.426Y-3.519 N2006 X19.783Y-3.590 N2007 X20.499Y-3.742 N2008 X20.857Y-3.823 N2009 X21.214Y-3.908 N2010 X21.925Y-4.088 N2011 X22.277Y-4.183 N2012 X22.626Y-4.282 N2013 X23.314Y-4.491 N2014 X23.652Y-4.600 N2015 X23.984Y-4.713 N2016 X24.632Y-4.949 N2017 X24.947Y-5.073 N2018 X25.254Y-5.199 N2019 X25.846Y-5.463 N2020 X26.129Y-5.600 N2021 X26.404Y-5.740 N2022 X26.669Y-5.884 N2023 X26.925Y-6.031 N2024 X27.170Y-6.181 N2025 X27.405Y-6.334 N2026 X27.842Y-6.650 N2027 X28.043Y-6.813 N2028 X28.232Y-6.979 N2029 X28.409Y-7.149 N2030 X28.573Y-7.321 N2031 X28.725Y-7.496 N2032 X28.863Y-7.674 N2033 X28.989Y-7.855 N2034 X29.101Y-8.039 N2035 X29.199Y-8.226 N2036 X29.283Y-8.416 N2037 X29.353Y-8.609 N2038 X29.409Y-8.804 N2039 X29.451Y-9.002 N2040 X29.479Y-9.203 N2041 X29.492Y-9.406 N2042 X29.491Y-9.612 N2043 X29.475Y-9.820 N2044 X29.445Y-10.031 N2045 X29.401Y-10.244 N2046 X29.342Y-10.459 N2047 X29.269Y-10.677 N2048 X29.181Y-10.897 N2049 X29.080Y-11.119 N2050 X28.964Y-11.344 N2051 X28.823Y-11.589 N2052 X28.666Y-11.837 N2053 X28.493Y-12.087 N2054 X28.305Y-12.340 N2055 X28.102Y-12.594 N2056 X27.883Y-12.851 N2057 X27.403Y-13.370 N2058 X27.142Y-13.632 N2059 X26.868Y-13.897 N2060 X26.281Y-14.430 N2061 X24.969Y-15.514 N2062 X24.615Y-15.788 N2063 X24.252Y-16.064 N2064 X23.501Y-16.617 N2065 X21.917Y-17.734 N2066 X18.570Y-19.985 N2067 X18.148Y-20.266 N2068 X17.729Y-20.547 N2069 X16.897Y-21.108 N2070 X15.285Y-22.222 N2071 X14.896Y-22.498 N2072 X14.515Y-22.774 N2073 X13.775Y-23.321 N2074 X12.409Y-24.400 N2075 X12.095Y-24.666 N2076 X11.792Y-24.930 N2077 X11.223Y-25.453 N2078 X10.958Y-25.712 N2079 X10.707Y-25.968 N2080 X10.246Y-26.475 N2081 X10.038Y-26.725 N2082 X9.845Y-26.973 N2083 X9.667Y-27.218 N2084 X9.505Y-27.461 N2085 X9.359Y-27.702 N2086 X9.229Y-27.940 N2087 X9.115Y-28.175 N2088 X9.017Y-28.407 N2089 X8.938Y-28.632 N2090 X8.874Y-28.855 N2091 X8.827Y-29.074 N2092 X8.796Y-29.291 N2093 X8.781Y-29.505 N2094 X8.782Y-29.716 N2095 X8.799Y-29.923 N2096 X8.833Y-30.128 N2097 X8.882Y-30.329 N2098 X8.947Y-30.527 N2099 X9.028Y-30.722 N2100 X9.125Y-30.914 N2101 X9.236Y-31.102 N2102 X9.363Y-31.286 N2103 X9.505Y-31.467 N2104 X9.661Y-31.645 N2105 X9.832Y-31.819 N2106 X10.016Y-31.989 N2107 X10.214Y-32.155 N2108 X10.425Y-32.318 N2109 X10.649Y-32.477 N2110 X10.885Y-32.633 N2111 X11.393Y-32.932 N2112 X11.664Y-33.076 N2113 X11.945Y-33.215 N2114 X12.536Y-33.483 N2115 X12.846Y-33.611 N2116 X13.163Y-33.735 N2117 X13.821Y-33.971 N2118 X14.160Y-34.082 N2119 X14.504Y-34.190 N2120 X15.209Y-34.393 N2121 X15.568Y-34.488 N2122 X15.930Y-34.579 N2123 X16.661Y-34.748 N2124 X17.029Y-34.827 N2125 X17.397Y-34.901 N2126 X17.766Y-34.971 N2127 X18.134Y-35.037 N2128 X18.501Y-35.099 N2129 X18.865Y-35.157 N2130 X19.585Y-35.260 N2131 X19.940Y-35.305 N2132 X20.290Y-35.346 N2133 X20.634Y-35.383 N2134 X20.973Y-35.416 N2135 X21.305Y-35.444 N2136 X21.630Y-35.469 N2137 X21.947Y-35.490 N2138 X22.256Y-35.506 N2139 X22.556Y-35.519 N2140 X22.847Y-35.527 N2141 X23.128Y-35.532 N2142 X23.398Y-35.532 N2143 X23.657Y-35.529 N2144 X23.904Y-35.522 N2145 X24.140Y-35.511 N2146 X24.363Y-35.496 N2147 X24.559Y-35.479 N2148 X24.745Y-35.459 N2149 X24.918Y-35.435 N2150 X25.079Y-35.408 N2151 X25.228Y-35.378 N2152 X25.364Y-35.345 N2153 X25.487Y-35.309 N2154 X25.597Y-35.269 N2155 X25.694Y-35.227 N2156 X25.777Y-35.182 N2157 X25.847Y-35.133 N2158 X25.902Y-35.082 N2159 X25.944Y-35.028 N2160 X25.972Y-34.972 N2161 X25.986Y-34.912 N2162 X25.986Y-34.850 N2163 X25.971Y-34.785 N2164 X25.942Y-34.717 N2165 X25.899Y-34.647 N2166 X25.842Y-34.575 N2167 X25.771Y-34.499 N2168 X25.685Y-34.422 N2169 X25.586Y-34.342 N2170 X25.472Y-34.260 N2171 X25.345Y-34.175 N2172 X25.204Y-34.088 N2173 X24.883Y-33.909 N2174 X24.702Y-33.815 N2175 X24.509Y-33.720 N2176 X24.085Y-33.525 N2177 X23.855Y-33.424 N2178 X23.613Y-33.321 N2179 X23.095Y-33.112 N2180 X21.933Y-32.673 N2181 X19.198Y-31.738 N2182 X12.952Y-29.747 N2183 X12.533Y-29.612 N2184 X12.117Y-29.477 N2185 X11.302Y-29.208 N2186 X9.752Y-28.680 N2187 X9.384Y-28.550 N2188 X9.026Y-28.422 N2189 X8.340Y-28.168 N2190 X7.104Y-27.677 N2191 X6.826Y-27.559 N2192 X6.561Y-27.442 N2193 X6.073Y-27.213 N2194 X5.850Y-27.102 N2195 X5.643Y-26.992 N2196 X5.272Y-26.780 N2197 X5.111Y-26.677 N2198 X4.965Y-26.577 N2199 X4.835Y-26.479 N2200 X4.721Y-26.383 N2201 X4.623Y-26.290 N2202 X4.542Y-26.199 N2203 X4.478Y-26.112 N2204 X4.430Y-26.026 N2205 X4.398Y-25.944 N2206 X4.384Y-25.865 N2207 X4.385Y-25.788 N2208 X4.403Y-25.714 N2209 X4.438Y-25.644 N2210 X4.489Y-25.576 N2211 X4.556Y-25.512 N2212 X4.639Y-25.450 N2213 X4.738Y-25.392 N2214 X4.852Y-25.337 N2215 X4.981Y-25.286 N2216 X5.126Y-25.238 N2217 X5.285Y-25.193 N2218 X5.458Y-25.152 N2219 X5.646Y-25.115 N2220 X5.847Y-25.080 N2221 X6.061Y-25.050 N2222 X6.287Y-25.023 N2223 X6.527Y-25.000 N2224 X6.777Y-24.980 N2225 X7.040Y-24.964 N2226 X7.313Y-24.952 N2227 X7.596Y-24.944 N2228 X7.889Y-24.939 N2229 X8.191Y-24.939 N2230 X8.502Y-24.942 N2231 X8.820Y-24.949 N2232 X9.146Y-24.960 N2233 X9.478Y-24.975 N2234 X9.817Y-24.994 N2235 X10.161Y-25.017 N2236 X10.510Y-25.044 N2237 X10.839Y-25.072 N2238 X11.171Y-25.104 N2239 X11.506Y-25.140 N2240 X11.842Y-25.179 N2241 X12.180Y-25.221 N2242 X12.519Y-25.267 N2243 X13.196Y-25.370 N2244 X13.534Y-25.427 N2245 X13.870Y-25.487 N2246 X14.204Y-25.550 N2247 X14.535Y-25.617 N2248 X14.864Y-25.688 N2249 X15.188Y-25.762 N2250 X15.824Y-25.920 N2251 X16.134Y-26.004 N2252 X16.438Y-26.092 N2253 X16.736Y-26.183 N2254 X17.027Y-26.277 N2255 X17.311Y-26.375 N2256 X17.587Y-26.476 N2257 X18.113Y-26.689 N2258 X18.362Y-26.800 N2259 X18.602Y-26.914 N2260 X18.832Y-27.032 N2261 X19.052Y-27.152 N2262 X19.260Y-27.276 N2263 X19.457Y-27.403 N2264 X19.643Y-27.534 N2265 X19.817Y-27.667 N2266 X19.979Y-27.803 N2267 X20.128Y-27.943 N2268 X20.264Y-28.085 N2269 X20.387Y-28.230 N2270 X20.497Y-28.379 N2271 X20.594Y-28.530 N2272 X20.676Y-28.684 N2273 X20.745Y-28.840 N2274 X20.800Y-29.000 N2275 X20.841Y-29.162 N2276 X20.867Y-29.327 N2277 X20.879Y-29.494 N2278 X20.876Y-29.664 N2279 X20.859Y-29.837 N2280 X20.828Y-30.012 N2281 X20.781Y-30.189 N2282 X20.721Y-30.369 N2283 X20.645Y-30.551 N2284 X20.556Y-30.735 N2285 X20.452Y-30.922 N2286 X20.333Y-31.110 N2287 X20.201Y-31.301 N2288 X20.055Y-31.494 N2289 X19.894Y-31.688 N2290 X19.721Y-31.885 N2291 X19.533Y-32.084 N2292 X19.120Y-32.486 N2293 X18.893Y-32.690 N2294 X18.655Y-32.896 N2295 X18.142Y-33.311 N2296 X17.874Y-33.517 N2297 X17.595Y-33.724 N2298 X17.007Y-34.142 N2299 X15.720Y-34.991 N2300 X12.798Y-36.727 N2301 X12.410Y-36.947 N2302 X12.018Y-37.167 N2303 X11.225Y-37.607 N2304 X9.621Y-38.487 N2305 X6.455Y-40.236 N2306 X6.074Y-40.452 N2307 X5.697Y-40.668 N2308 X4.960Y-41.096 N2309 X3.566Y-41.941 N2310 X3.237Y-42.149 N2311 X2.916Y-42.356 N2312 X2.302Y-42.766 N2313 X1.194Y-43.568 N2314 X0.944Y-43.764 N2315 X0.706Y-43.959 N2316 X0.264Y-44.342 N2317 X0.062Y-44.531 N2318 X-0.128Y-44.718 N2319 X-0.469Y-45.085 N2320 X-0.620Y-45.266 N2321 X-0.758Y-45.444 N2322 X-0.882Y-45.620 N2323 X-0.993Y-45.794 N2324 X-1.090Y-45.965 N2325 X-1.173Y-46.134 N2326 X-1.243Y-46.301 N2327 X-1.298Y-46.465 N2328 X-1.342Y-46.640 N2329 X-1.371Y-46.812 N2330 X-1.382Y-46.980 N2331 X-1.378Y-47.146 N2332 X-1.357Y-47.308 N2333 X-1.320Y-47.467 N2334 X-1.267Y-47.622 N2335 X-1.198Y-47.775 N2336 X-1.114Y-47.923 N2337 X-1.014Y-48.068 N2338 X-0.899Y-48.210 N2339 X-0.769Y-48.348 N2340 X-0.625Y-48.482 N2341 X-0.466Y-48.612 N2342 X-0.293Y-48.739 N2343 X-0.107Y-48.862 N2344 X0.093Y-48.981 N2345 X0.305Y-49.097 N2346 X0.530Y-49.208 N2347 X0.766Y-49.315 N2348 X1.014Y-49.419 N2349 X1.273Y-49.518 N2350 X1.822Y-49.705 N2351 X2.110Y-49.792 N2352 X2.407Y-49.875 N2353 X2.713Y-49.954 N2354 X3.026Y-50.029 N2355 X3.346Y-50.100 N2356 X3.672Y-50.166 N2357 X4.004Y-50.229 N2358 X4.341Y-50.287 N2359 X4.683Y-50.340 N2360 X5.028Y-50.390 N2361 X5.376Y-50.435 N2362 X5.727Y-50.476 N2363 X6.080Y-50.513 N2364 X6.433Y-50.545 N2365 X6.787Y-50.573 N2366 X7.141Y-50.597 N2367 X7.494Y-50.617 N2368 X7.845Y-50.632 N2369 X8.194Y-50.643 N2370 X8.540Y-50.650 N2371 X8.882Y-50.652 N2372 X9.220Y-50.651 N2373 X9.553Y-50.645 N2374 X9.881Y-50.635 N2375 X10.202Y-50.620 N2376 X10.516Y-50.602 N2377 X10.823Y-50.579 N2378 X11.122Y-50.552 N2379 X11.412Y-50.521 N2380 X11.693Y-50.486 N2381 X11.964Y-50.447 N2382 X12.225Y-50.404 N2383 X12.475Y-50.356 N2384 X12.714Y-50.305 N2385 X12.941Y-50.250 N2386 X13.155Y-50.191 N2387 X13.357Y-50.128 N2388 X13.546Y-50.061 N2389 X13.721Y-49.990 N2390 X13.882Y-49.916 N2391 X14.020Y-49.843 N2392 X14.144Y-49.767 N2393 X14.256Y-49.688 N2394 X14.355Y-49.605 N2395 X14.441Y-49.520 N2396 X14.513Y-49.431 N2397 X14.571Y-49.340 N2398 X14.615Y-49.245 N2399 X14.645Y-49.148 N2400 X14.662Y-49.048 N2401 X14.664Y-48.944 N2402 X14.651Y-48.838 N2403 X14.625Y-48.730 N2404 X14.584Y-48.618 N2405 X14.529Y-48.504 N2406 X14.459Y-48.387 N2407 X14.376Y-48.268 N2408 X14.278Y-48.146 N2409 X14.166Y-48.022 N2410 X14.040Y-47.896 N2411 X13.900Y-47.767 N2412 X13.747Y-47.635 N2413 X13.399Y-47.366 N2414 X13.206Y-47.228 N2415 X12.999Y-47.088 N2416 X12.548Y-46.803 N2417 X11.504Y-46.209 N2418 X11.215Y-46.057 N2419 X10.916Y-45.902 N2420 X10.287Y-45.589 N2421 X8.923Y-44.948 N2422 X5.870Y-43.614 N2423 X5.468Y-43.444 N2424 X5.063Y-43.274 N2425 X4.246Y-42.931 N2426 X2.603Y-42.244 N2427 X-0.599Y-40.871 N2428 X-1.025Y-40.682 N2429 X-1.444Y-40.493 N2430 X-2.257Y-40.118 N2431 X-3.764Y-39.380 N2432 X-4.113Y-39.199 N2433 X-4.450Y-39.019 N2434 X-5.084Y-38.665 N2435 X-5.380Y-38.490 N2436 X-5.662Y-38.317 N2437 X-6.181Y-37.977 N2438 X-6.417Y-37.810 N2439 X-6.637Y-37.645 N2440 X-6.841Y-37.483 N2441 X-7.028Y-37.322 N2442 X-7.199Y-37.165 N2443 X-7.352Y-37.009 N2444 X-7.488Y-36.856 N2445 X-7.607Y-36.706 N2446 X-7.708Y-36.559 N2447 X-7.791Y-36.414 N2448 X-7.856Y-36.272 N2449 X-7.904Y-36.133 N2450 X-7.934Y-35.997 N2451 X-7.946Y-35.864 N2452 X-7.941Y-35.734 N2453 X-7.918Y-35.608 N2454 X-7.877Y-35.484 N2455 X-7.819Y-35.364 N2456 X-7.744Y-35.247 N2457 X-7.652Y-35.134 N2458 X-7.543Y-35.024 N2459 X-7.418Y-34.918 N2460 X-7.277Y-34.815 N2461 X-7.121Y-34.716 N2462 X-6.949Y-34.620 N2463 X-6.762Y-34.528 N2464 X-6.560Y-34.440 N2465 X-6.345Y-34.356 N2466 X-6.116Y-34.276 N2467 X-5.874Y-34.199 N2468 X-5.620Y-34.127 N2469 X-5.353Y-34.058 N2470 X-5.076Y-33.993 N2471 X-4.787Y-33.933 N2472 X-4.489Y-33.876 N2473 X-4.181Y-33.824 N2474 X-3.864Y-33.775 N2475 X-3.539Y-33.731 N2476 X-3.207Y-33.691 N2477 X-2.867Y-33.655 N2478 X-2.522Y-33.623 N2479 X-2.172Y-33.596 N2480 X-1.817Y-33.572 N2481 X-1.458Y-33.553 N2482 X-1.096Y-33.538 N2483 X-0.732Y-33.528 N2484 X-0.366Y-33.521 N2485 X0.000Y-33.519 N2486 G0Z4.000 N2487 G0X37.560Y12.327Z6.000 N2488 G1Z-1.000 N2489 G1Y0.876 N2490 X49.011 N2491 Y12.327 N2492 X37.560 N2493 G0Z4.000 N2494 G0Y0.876 N2495 G1Z-1.000 N2496 G1Y-10.575 N2497 X49.011 N2498 Y0.876 N2499 X37.560 N2500 G0Z4.000 N2501 G0X49.011Y12.327 N2502 G1Z-1.000 N2503 G1X52.084Y15.011 N2504 G0Z4.000 N2505 G0X49.011Y0.876 N2506 G1Z-1.000 N2507 G1X52.084Y6.213 N2508 Y15.011 N2509 X43.286 N2510 X37.560Y12.327 N2511 G0Z4.000 N2512 G0X49.011Y-10.575 N2513 G1Z-1.000 N2514 G1X52.084Y-2.585 N2515 Y6.213 N2516 X49.011Y0.876 N2517 G0Z4.000 */
{ "pile_set_name": "Github" }
package org.solovyev.android.checkout; import android.util.Log; import javax.annotation.Nonnull; import javax.annotation.concurrent.ThreadSafe; /** * Default logger implementation that logs to Android Log */ @ThreadSafe class DefaultLogger implements Logger { private boolean mEnabled = BuildConfig.DEBUG; @Override public void e(@Nonnull String tag, @Nonnull String msg) { if (mEnabled) { Log.e(tag, msg); } } @Override public void w(@Nonnull String tag, @Nonnull String msg) { if (mEnabled) { Log.w(tag, msg); } } @Override public void i(@Nonnull String tag, @Nonnull String msg) { if (mEnabled) { Log.i(tag, msg); } } @Override public void d(@Nonnull String tag, @Nonnull String msg) { if (mEnabled) { Log.d(tag, msg); } } @Override public void v(@Nonnull String tag, @Nonnull String msg) { if (mEnabled) { Log.v(tag, msg); } } @Override public void e(@Nonnull String tag, @Nonnull String msg, @Nonnull Throwable e) { if (mEnabled) { Log.e(tag, msg, e); } } @Override public void w(@Nonnull String tag, @Nonnull String msg, @Nonnull Throwable e) { if (mEnabled) { Log.w(tag, msg, e); } } @Override public void i(@Nonnull String tag, @Nonnull String msg, @Nonnull Throwable e) { if (mEnabled) { Log.i(tag, msg, e); } } @Override public void d(@Nonnull String tag, @Nonnull String msg, @Nonnull Throwable e) { if (mEnabled) { Log.d(tag, msg, e); } } @Override public void v(@Nonnull String tag, @Nonnull String msg, @Nonnull Throwable e) { if (mEnabled) { Log.v(tag, msg, e); } } public void setEnabled(boolean enabled) { mEnabled = enabled; } }
{ "pile_set_name": "Github" }
// * ================================= * // * Petal // * http://shakrmedia.github.io/petal // * Copyright 2015-2019 Shakr Media Co., Ltd. // * // * typography.less - text styles // * ================================= * // import dependencies @import (reference) 'variables.less'; @import (reference) 'mixins.less'; // headers h1,h2,h3,h4,h5,h6 { margin-top: 0; margin-bottom: 0.5em; small { color: @gray; font-size: 0.7em; font-weight: normal; text-transform: none; letter-spacing: 0; } } h1 { font-weight: @header-font-weight; font-size: 3rem; } h2 { font-weight: @header-font-weight; font-size: 2rem; } h3 { font-weight: @header-font-weight; font-size: 1.5rem; } h4 { font-weight: @header-font-weight; font-size: 1.25rem; small { font-size: 0.8em; } } h5 { font-weight: @header-font-weight; font-size: 1rem; small { font-size: 0.9em; } } h6 { font-weight: @header-font-weight; font-size: 0.9rem; small { font-size: 0.9em; } } h3,h4,h5,h6 { & when (@header-uppercase = true) { text-transform: uppercase; letter-spacing: @header-letter-spacing; } } // case stylization overrides .uppercase { text-transform: uppercase; letter-spacing: @header-letter-spacing; } .keepcase { text-transform: none; letter-spacing: 0; } // paragraph p { line-height: @paragraph-line-height; margin-top: 0; margin-bottom: 1em; } // code blocks code { margin: 0 1px; padding: 1px 5px; background-color: fadeout(#eee,50%); font-family: @monospace-font, monospace; font-size: 0.9em; letter-spacing: 0; text-transform: none; .dark-override({ background-color: fadeout(#fff,90%); }); } pre { padding: 0; margin: 0; background-color: #f0f0f0; .dark-override({ background-color: fadeout(#fff,90%); }); } pre code { background-color: #f0f0f0; padding: 15px; .dark-override({ background-color: fadeout(#fff,90%); }); } // blockquote blockquote { .colorset(@primary-accent-color); border-left: 2px solid @color-l1; padding-left: 20px; margin-left: 20px; } // lists ol, ul { margin: 0 0 1em 0; padding: 0 0 0 2em; } li { margin-top: 0; margin-bottom: 0.5em; } // links a { color: @link-text-color; text-decoration: none; &:hover { text-decoration: underline; } } // horizontal divider hr { height: 1px; margin-top: 20px; margin-bottom: 20px; border: none; background-color: #ddd; .dark-override({ background-color: #333; }); }
{ "pile_set_name": "Github" }
<?php namespace Doctrine\DBAL\Exception; /** * Base class for all constraint violation related errors detected in the driver. */ class ConstraintViolationException extends ServerException { }
{ "pile_set_name": "Github" }
// linux/mksysnum.pl -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build ppc64le,linux package unix const ( SYS_RESTART_SYSCALL = 0 SYS_EXIT = 1 SYS_FORK = 2 SYS_READ = 3 SYS_WRITE = 4 SYS_OPEN = 5 SYS_CLOSE = 6 SYS_WAITPID = 7 SYS_CREAT = 8 SYS_LINK = 9 SYS_UNLINK = 10 SYS_EXECVE = 11 SYS_CHDIR = 12 SYS_TIME = 13 SYS_MKNOD = 14 SYS_CHMOD = 15 SYS_LCHOWN = 16 SYS_BREAK = 17 SYS_OLDSTAT = 18 SYS_LSEEK = 19 SYS_GETPID = 20 SYS_MOUNT = 21 SYS_UMOUNT = 22 SYS_SETUID = 23 SYS_GETUID = 24 SYS_STIME = 25 SYS_PTRACE = 26 SYS_ALARM = 27 SYS_OLDFSTAT = 28 SYS_PAUSE = 29 SYS_UTIME = 30 SYS_STTY = 31 SYS_GTTY = 32 SYS_ACCESS = 33 SYS_NICE = 34 SYS_FTIME = 35 SYS_SYNC = 36 SYS_KILL = 37 SYS_RENAME = 38 SYS_MKDIR = 39 SYS_RMDIR = 40 SYS_DUP = 41 SYS_PIPE = 42 SYS_TIMES = 43 SYS_PROF = 44 SYS_BRK = 45 SYS_SETGID = 46 SYS_GETGID = 47 SYS_SIGNAL = 48 SYS_GETEUID = 49 SYS_GETEGID = 50 SYS_ACCT = 51 SYS_UMOUNT2 = 52 SYS_LOCK = 53 SYS_IOCTL = 54 SYS_FCNTL = 55 SYS_MPX = 56 SYS_SETPGID = 57 SYS_ULIMIT = 58 SYS_OLDOLDUNAME = 59 SYS_UMASK = 60 SYS_CHROOT = 61 SYS_USTAT = 62 SYS_DUP2 = 63 SYS_GETPPID = 64 SYS_GETPGRP = 65 SYS_SETSID = 66 SYS_SIGACTION = 67 SYS_SGETMASK = 68 SYS_SSETMASK = 69 SYS_SETREUID = 70 SYS_SETREGID = 71 SYS_SIGSUSPEND = 72 SYS_SIGPENDING = 73 SYS_SETHOSTNAME = 74 SYS_SETRLIMIT = 75 SYS_GETRLIMIT = 76 SYS_GETRUSAGE = 77 SYS_GETTIMEOFDAY = 78 SYS_SETTIMEOFDAY = 79 SYS_GETGROUPS = 80 SYS_SETGROUPS = 81 SYS_SELECT = 82 SYS_SYMLINK = 83 SYS_OLDLSTAT = 84 SYS_READLINK = 85 SYS_USELIB = 86 SYS_SWAPON = 87 SYS_REBOOT = 88 SYS_READDIR = 89 SYS_MMAP = 90 SYS_MUNMAP = 91 SYS_TRUNCATE = 92 SYS_FTRUNCATE = 93 SYS_FCHMOD = 94 SYS_FCHOWN = 95 SYS_GETPRIORITY = 96 SYS_SETPRIORITY = 97 SYS_PROFIL = 98 SYS_STATFS = 99 SYS_FSTATFS = 100 SYS_IOPERM = 101 SYS_SOCKETCALL = 102 SYS_SYSLOG = 103 SYS_SETITIMER = 104 SYS_GETITIMER = 105 SYS_STAT = 106 SYS_LSTAT = 107 SYS_FSTAT = 108 SYS_OLDUNAME = 109 SYS_IOPL = 110 SYS_VHANGUP = 111 SYS_IDLE = 112 SYS_VM86 = 113 SYS_WAIT4 = 114 SYS_SWAPOFF = 115 SYS_SYSINFO = 116 SYS_IPC = 117 SYS_FSYNC = 118 SYS_SIGRETURN = 119 SYS_CLONE = 120 SYS_SETDOMAINNAME = 121 SYS_UNAME = 122 SYS_MODIFY_LDT = 123 SYS_ADJTIMEX = 124 SYS_MPROTECT = 125 SYS_SIGPROCMASK = 126 SYS_CREATE_MODULE = 127 SYS_INIT_MODULE = 128 SYS_DELETE_MODULE = 129 SYS_GET_KERNEL_SYMS = 130 SYS_QUOTACTL = 131 SYS_GETPGID = 132 SYS_FCHDIR = 133 SYS_BDFLUSH = 134 SYS_SYSFS = 135 SYS_PERSONALITY = 136 SYS_AFS_SYSCALL = 137 SYS_SETFSUID = 138 SYS_SETFSGID = 139 SYS__LLSEEK = 140 SYS_GETDENTS = 141 SYS__NEWSELECT = 142 SYS_FLOCK = 143 SYS_MSYNC = 144 SYS_READV = 145 SYS_WRITEV = 146 SYS_GETSID = 147 SYS_FDATASYNC = 148 SYS__SYSCTL = 149 SYS_MLOCK = 150 SYS_MUNLOCK = 151 SYS_MLOCKALL = 152 SYS_MUNLOCKALL = 153 SYS_SCHED_SETPARAM = 154 SYS_SCHED_GETPARAM = 155 SYS_SCHED_SETSCHEDULER = 156 SYS_SCHED_GETSCHEDULER = 157 SYS_SCHED_YIELD = 158 SYS_SCHED_GET_PRIORITY_MAX = 159 SYS_SCHED_GET_PRIORITY_MIN = 160 SYS_SCHED_RR_GET_INTERVAL = 161 SYS_NANOSLEEP = 162 SYS_MREMAP = 163 SYS_SETRESUID = 164 SYS_GETRESUID = 165 SYS_QUERY_MODULE = 166 SYS_POLL = 167 SYS_NFSSERVCTL = 168 SYS_SETRESGID = 169 SYS_GETRESGID = 170 SYS_PRCTL = 171 SYS_RT_SIGRETURN = 172 SYS_RT_SIGACTION = 173 SYS_RT_SIGPROCMASK = 174 SYS_RT_SIGPENDING = 175 SYS_RT_SIGTIMEDWAIT = 176 SYS_RT_SIGQUEUEINFO = 177 SYS_RT_SIGSUSPEND = 178 SYS_PREAD64 = 179 SYS_PWRITE64 = 180 SYS_CHOWN = 181 SYS_GETCWD = 182 SYS_CAPGET = 183 SYS_CAPSET = 184 SYS_SIGALTSTACK = 185 SYS_SENDFILE = 186 SYS_GETPMSG = 187 SYS_PUTPMSG = 188 SYS_VFORK = 189 SYS_UGETRLIMIT = 190 SYS_READAHEAD = 191 SYS_PCICONFIG_READ = 198 SYS_PCICONFIG_WRITE = 199 SYS_PCICONFIG_IOBASE = 200 SYS_MULTIPLEXER = 201 SYS_GETDENTS64 = 202 SYS_PIVOT_ROOT = 203 SYS_MADVISE = 205 SYS_MINCORE = 206 SYS_GETTID = 207 SYS_TKILL = 208 SYS_SETXATTR = 209 SYS_LSETXATTR = 210 SYS_FSETXATTR = 211 SYS_GETXATTR = 212 SYS_LGETXATTR = 213 SYS_FGETXATTR = 214 SYS_LISTXATTR = 215 SYS_LLISTXATTR = 216 SYS_FLISTXATTR = 217 SYS_REMOVEXATTR = 218 SYS_LREMOVEXATTR = 219 SYS_FREMOVEXATTR = 220 SYS_FUTEX = 221 SYS_SCHED_SETAFFINITY = 222 SYS_SCHED_GETAFFINITY = 223 SYS_TUXCALL = 225 SYS_IO_SETUP = 227 SYS_IO_DESTROY = 228 SYS_IO_GETEVENTS = 229 SYS_IO_SUBMIT = 230 SYS_IO_CANCEL = 231 SYS_SET_TID_ADDRESS = 232 SYS_FADVISE64 = 233 SYS_EXIT_GROUP = 234 SYS_LOOKUP_DCOOKIE = 235 SYS_EPOLL_CREATE = 236 SYS_EPOLL_CTL = 237 SYS_EPOLL_WAIT = 238 SYS_REMAP_FILE_PAGES = 239 SYS_TIMER_CREATE = 240 SYS_TIMER_SETTIME = 241 SYS_TIMER_GETTIME = 242 SYS_TIMER_GETOVERRUN = 243 SYS_TIMER_DELETE = 244 SYS_CLOCK_SETTIME = 245 SYS_CLOCK_GETTIME = 246 SYS_CLOCK_GETRES = 247 SYS_CLOCK_NANOSLEEP = 248 SYS_SWAPCONTEXT = 249 SYS_TGKILL = 250 SYS_UTIMES = 251 SYS_STATFS64 = 252 SYS_FSTATFS64 = 253 SYS_RTAS = 255 SYS_SYS_DEBUG_SETCONTEXT = 256 SYS_MIGRATE_PAGES = 258 SYS_MBIND = 259 SYS_GET_MEMPOLICY = 260 SYS_SET_MEMPOLICY = 261 SYS_MQ_OPEN = 262 SYS_MQ_UNLINK = 263 SYS_MQ_TIMEDSEND = 264 SYS_MQ_TIMEDRECEIVE = 265 SYS_MQ_NOTIFY = 266 SYS_MQ_GETSETATTR = 267 SYS_KEXEC_LOAD = 268 SYS_ADD_KEY = 269 SYS_REQUEST_KEY = 270 SYS_KEYCTL = 271 SYS_WAITID = 272 SYS_IOPRIO_SET = 273 SYS_IOPRIO_GET = 274 SYS_INOTIFY_INIT = 275 SYS_INOTIFY_ADD_WATCH = 276 SYS_INOTIFY_RM_WATCH = 277 SYS_SPU_RUN = 278 SYS_SPU_CREATE = 279 SYS_PSELECT6 = 280 SYS_PPOLL = 281 SYS_UNSHARE = 282 SYS_SPLICE = 283 SYS_TEE = 284 SYS_VMSPLICE = 285 SYS_OPENAT = 286 SYS_MKDIRAT = 287 SYS_MKNODAT = 288 SYS_FCHOWNAT = 289 SYS_FUTIMESAT = 290 SYS_NEWFSTATAT = 291 SYS_UNLINKAT = 292 SYS_RENAMEAT = 293 SYS_LINKAT = 294 SYS_SYMLINKAT = 295 SYS_READLINKAT = 296 SYS_FCHMODAT = 297 SYS_FACCESSAT = 298 SYS_GET_ROBUST_LIST = 299 SYS_SET_ROBUST_LIST = 300 SYS_MOVE_PAGES = 301 SYS_GETCPU = 302 SYS_EPOLL_PWAIT = 303 SYS_UTIMENSAT = 304 SYS_SIGNALFD = 305 SYS_TIMERFD_CREATE = 306 SYS_EVENTFD = 307 SYS_SYNC_FILE_RANGE2 = 308 SYS_FALLOCATE = 309 SYS_SUBPAGE_PROT = 310 SYS_TIMERFD_SETTIME = 311 SYS_TIMERFD_GETTIME = 312 SYS_SIGNALFD4 = 313 SYS_EVENTFD2 = 314 SYS_EPOLL_CREATE1 = 315 SYS_DUP3 = 316 SYS_PIPE2 = 317 SYS_INOTIFY_INIT1 = 318 SYS_PERF_EVENT_OPEN = 319 SYS_PREADV = 320 SYS_PWRITEV = 321 SYS_RT_TGSIGQUEUEINFO = 322 SYS_FANOTIFY_INIT = 323 SYS_FANOTIFY_MARK = 324 SYS_PRLIMIT64 = 325 SYS_SOCKET = 326 SYS_BIND = 327 SYS_CONNECT = 328 SYS_LISTEN = 329 SYS_ACCEPT = 330 SYS_GETSOCKNAME = 331 SYS_GETPEERNAME = 332 SYS_SOCKETPAIR = 333 SYS_SEND = 334 SYS_SENDTO = 335 SYS_RECV = 336 SYS_RECVFROM = 337 SYS_SHUTDOWN = 338 SYS_SETSOCKOPT = 339 SYS_GETSOCKOPT = 340 SYS_SENDMSG = 341 SYS_RECVMSG = 342 SYS_RECVMMSG = 343 SYS_ACCEPT4 = 344 SYS_NAME_TO_HANDLE_AT = 345 SYS_OPEN_BY_HANDLE_AT = 346 SYS_CLOCK_ADJTIME = 347 SYS_SYNCFS = 348 SYS_SENDMMSG = 349 SYS_SETNS = 350 SYS_PROCESS_VM_READV = 351 SYS_PROCESS_VM_WRITEV = 352 SYS_FINIT_MODULE = 353 SYS_KCMP = 354 SYS_SCHED_SETATTR = 355 SYS_SCHED_GETATTR = 356 SYS_RENAMEAT2 = 357 SYS_SECCOMP = 358 SYS_GETRANDOM = 359 SYS_MEMFD_CREATE = 360 SYS_BPF = 361 SYS_EXECVEAT = 362 SYS_SWITCH_ENDIAN = 363 SYS_USERFAULTFD = 364 SYS_MEMBARRIER = 365 SYS_MLOCK2 = 378 SYS_COPY_FILE_RANGE = 379 SYS_PREADV2 = 380 SYS_PWRITEV2 = 381 SYS_KEXEC_FILE_LOAD = 382 SYS_STATX = 383 SYS_PKEY_ALLOC = 384 SYS_PKEY_FREE = 385 SYS_PKEY_MPROTECT = 386 )
{ "pile_set_name": "Github" }
//上传预览 .layui-upload-file,.layui-btn~.fsh-upload-preview{ margin-top: 10px; } .fsh-upload-preview { > .item { position: relative; float: left; margin-right: 10px; margin-bottom: 10px; img { display: inline-block; width: auto; height:200px; min-width:200px; } .icon-error{ display: block; position: absolute; right: -3px; top: -12px; width: 18px; height: 18px; background-color: #666; border-radius: 100%; color: #fff; padding: 3px; text-align: center; font-weight: 700; font-size: 14px; line-height: 22px; } } } //标签 .fsh-form-label{ .layui-input-inline{ width: 100px; } } .fsh-labels{ span{ display: inline-block; padding: 8px 16px; background: #FFEAB4; color: #F5B100; font-size: 14px; position: relative; } } //表单下label的**** .layui-form-label { i:not(.iconfont) { color: red; margin-right: 10px; font-style: normal; } } .fsh-form-lg{ max-width: 900px; h2{ margin-bottom: 20px; line-height: 40px; padding-bottom: 10px; color: #393D49; font-size: 28px; font-weight: 300; text-align: center; } .layui-form-label{ width: 150px; } .layui-input-block { margin-left: 180px; } }
{ "pile_set_name": "Github" }
# Copyright 2019 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # pylint: disable=W0401,W0614 from telemetry import story from telemetry.page import page as page_module from telemetry.page import shared_page_state class SkiaMobilePage(page_module.Page): def __init__(self, url, page_set): super(SkiaMobilePage, self).__init__( url=url, name=url, page_set=page_set, shared_page_state_class=shared_page_state.SharedMobilePageState) self.archive_data_file = 'data/skia_slashdot_mobile.json' def RunNavigateSteps(self, action_runner): action_runner.Navigate(self.url) action_runner.Wait(15) class SkiaSlashdotMobilePageSet(story.StorySet): """ Pages designed to represent the median, not highly optimized web """ def __init__(self): super(SkiaSlashdotMobilePageSet, self).__init__( archive_data_file='data/skia_slashdot_mobile.json') urls_list = [ # go/skia-skps-3-2019 'http://slashdot.org', ] for url in urls_list: self.AddStory(SkiaMobilePage(url, self))
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading; namespace UnrealEngine { class Args { private Dictionary<string, string> args = new Dictionary<string, string>(); public Args(string arg) { if (arg != null) { string[] splitted = arg.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); foreach (string str in splitted) { int equalsIndex = str.IndexOf('='); if (equalsIndex > 0) { string key = str.Substring(0, equalsIndex).Trim(); string value = str.Substring(equalsIndex + 1).Trim(); if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value)) { args[key] = value; } } } } } public string this[string key] { get { return GetString(key); } } public bool Contains(string key) { return args.ContainsKey(key); } public string GetString(string key) { string value; args.TryGetValue(key, out value); return value; } public bool GetBool(string key) { string valueStr; bool value; if (args.TryGetValue(key, out valueStr) && bool.TryParse(valueStr, out value)) { return value; } return false; } public int GetInt32(string key) { string valueStr; int value; if (args.TryGetValue(key, out valueStr) && int.TryParse(valueStr, out value)) { return value; } return 0; } public long GetInt64(string key) { string valueStr; long value; if (args.TryGetValue(key, out valueStr) && long.TryParse(valueStr, out value)) { return value; } return 0; } } static class GameThreadHelper { public delegate void FSimpleDelegate(); class CallbackInfo { public FSimpleDelegate Callback; public AutoResetEvent WaitHandle; } private static Queue<CallbackInfo> callbacks = new Queue<CallbackInfo>(); //private static FSimpleDelegate tickCallback; //private static AutoResetEvent waitHandle; public delegate bool FTickerDelegate(float deltaTime); private delegate void Del_AddStaticTicker(FTickerDelegate func, float delay); private static Del_AddStaticTicker addStaticTicker; private static FTickerDelegate ticker; private delegate Runtime.csbool Del_IsInGameThread(); private static Del_IsInGameThread isInGameThread; private static uint lastRuntimeCounter; public static FSimpleDelegate OnRuntimeChanged; public static void Init(IntPtr addTickerAddr, IntPtr isInGameThreadAddr, FSimpleDelegate onRuntimeChanged) { isInGameThread = (Del_IsInGameThread)Marshal.GetDelegateForFunctionPointer(isInGameThreadAddr, typeof(Del_IsInGameThread)); Debug.Assert(IsInGameThread(), "USharp should only be loaded from the game thread"); addStaticTicker = (Del_AddStaticTicker)Marshal.GetDelegateForFunctionPointer(addTickerAddr, typeof(Del_AddStaticTicker)); ticker = Tick; addStaticTicker(ticker, 0.0f); OnRuntimeChanged = onRuntimeChanged; } public static bool IsInGameThread() { return isInGameThread(); } private static unsafe bool Tick(float deltaTime) { if (lastRuntimeCounter != SharedRuntimeState.Instance->RuntimeCounter) { if (SharedRuntimeState.IsActiveRuntime || SharedRuntimeState.Instance->IsActiveRuntimeComplete != 0) { lastRuntimeCounter = SharedRuntimeState.Instance->RuntimeCounter; Debug.Assert(SharedRuntimeState.Instance->NextRuntime != EDotNetRuntime.None, "RuntimeCounter changed but NextRuntime is not assigned"); OnRuntimeChanged(); } else if (SharedRuntimeState.Instance->NextRuntime == EDotNetRuntime.None) { // Runtime swapping likely failed, update our counter lastRuntimeCounter = SharedRuntimeState.Instance->RuntimeCounter; } } else if (SharedRuntimeState.Instance->Reload && SharedRuntimeState.IsActiveRuntime) { OnRuntimeChanged(); } lock (callbacks) { while (callbacks.Count > 0) { CallbackInfo callbackInfo = callbacks.Dequeue(); callbackInfo.Callback(); callbackInfo.WaitHandle.Set(); } } return true; } public static void Run(FSimpleDelegate callback) { if (IsInGameThread()) { callback(); } else { CallbackInfo callbackInfo = new CallbackInfo() { Callback = callback, WaitHandle = new AutoResetEvent(false) }; lock (callbacks) { callbacks.Enqueue(callbackInfo); } callbackInfo.WaitHandle.WaitOne(Timeout.Infinite); callbackInfo.WaitHandle.Close(); } } } /// <summary> /// Runtime state shared between multiple runtimes. /// This should only be accessed on the game thread. /// </summary> [StructLayout(LayoutKind.Sequential)] internal unsafe struct SharedRuntimeState { /// <summary> /// The runtimes which were chosen to be loaded /// </summary> EDotNetRuntime DesiredRuntimes; /// <summary> /// The runtimes which have initialized /// </summary> EDotNetRuntime InitializedRuntimes; /// <summary> /// The runtimes which have fully loaded /// </summary> EDotNetRuntime LoadedRuntimes; /// <summary> /// The currently active runtime which is responsible for everything USharp related /// </summary> public EDotNetRuntime ActiveRuntime; /// <summary> /// The next runtime to use as the active runtime on the next hotreload /// </summary> public EDotNetRuntime NextRuntime; /// <summary> /// Used when switching the active runtime. Set the <see cref="NextRuntime"/> value and after the /// active runtime has fully unloaded set <see cref="IsActiveRuntimeComplete"/> to true. /// </summary> public int IsActiveRuntimeComplete; /// <summary> /// The number of times the runtime has been swapped /// </summary> public uint RuntimeCounter; /// <summary> /// If true the active runtime should reload when possible /// </summary> public UnrealEngine.Runtime.csbool Reload; /// <summary> /// The name of the platform / OS (windows, mac, ps4, etc) /// </summary> public IntPtr PlatformName; /// <summary> /// Length of the current data /// </summary> int HotReloadDataLen; /// <summary> /// Length of the memory which may be larger than the current data length /// </summary> int HotReloadDataLenInMemory; /// <summary> /// HotReload data which is used between the unloading/reloading appdomain /// </summary> IntPtr HotReloadData; /// <summary> /// Length of the current data /// </summary> int HotReloadAssemblyPathsLen; /// <summary> /// Length of the memory which may be larger than the current data length /// </summary> int HotReloadAssemblyPathsLenInMemory; IntPtr HotReloadAssemblyPaths; IntPtr MallocFuncPtr; IntPtr ReallocFuncPtr; IntPtr FreeFuncPtr; IntPtr MessageBoxPtr; IntPtr LogPtr; int StructSize; public static MallocDel Malloc; public static ReallocDel Realloc; public static FreeDel Free; public static MessageBoxDel MessageBox; public static LogMsgDel LogMsg; public delegate IntPtr MallocDel(IntPtr count, uint alignment = 0); public delegate IntPtr ReallocDel(IntPtr original, IntPtr count, uint alignment = 0); public delegate void FreeDel(IntPtr original); public delegate void MessageBoxDel([MarshalAs(UnmanagedType.LPStr)] string text, [MarshalAs(UnmanagedType.LPStr)] string title); public delegate void LogMsgDel(byte verbosity, [MarshalAs(UnmanagedType.LPStr)] string message); /// <summary> /// True if the currently executing code is the active runtime /// </summary> public static bool IsActiveRuntime { get { return CurrentRuntime == Instance->ActiveRuntime; } } /// <summary> /// The runtime for the currently executing code. /// Note that this is different to <see cref="ActiveRuntime"/> /// </summary> public static readonly EDotNetRuntime CurrentRuntime; static SharedRuntimeState() { if (Runtime.AssemblyContext.IsMono) { CurrentRuntime = EDotNetRuntime.Mono; } else if (Runtime.AssemblyContext.IsCoreCLR) { CurrentRuntime = EDotNetRuntime.CoreCLR; } else { CurrentRuntime = EDotNetRuntime.CLR; } } public static bool Initialized { get { return Address != IntPtr.Zero; } } static IntPtr Address; internal static SharedRuntimeState* Instance { get { return (SharedRuntimeState*)Address; } } public static void Initialize(IntPtr address) { Address = address; Debug.Assert( Instance->MallocFuncPtr != IntPtr.Zero && Instance->ReallocFuncPtr != IntPtr.Zero && Instance->FreeFuncPtr != IntPtr.Zero && Instance->MessageBoxPtr != IntPtr.Zero && Instance->LogPtr != IntPtr.Zero && Instance->StructSize == Marshal.SizeOf(typeof(SharedRuntimeState))); Malloc = (MallocDel)Marshal.GetDelegateForFunctionPointer(Instance->MallocFuncPtr, typeof(MallocDel)); Realloc = (ReallocDel)Marshal.GetDelegateForFunctionPointer(Instance->ReallocFuncPtr, typeof(ReallocDel)); Free = (FreeDel)Marshal.GetDelegateForFunctionPointer(Instance->FreeFuncPtr, typeof(FreeDel)); MessageBox = (MessageBoxDel)Marshal.GetDelegateForFunctionPointer(Instance->MessageBoxPtr, typeof(MessageBoxDel)); LogMsg = (LogMsgDel)Marshal.GetDelegateForFunctionPointer(Instance->LogPtr, typeof(LogMsgDel)); } public static bool HaveMultipleRuntimesInitialized() { return HasMoreThanOneFlag(Instance->InitializedRuntimes); } public static bool HaveMultipleRuntimesLoaded() { return HasMoreThanOneFlag(Instance->LoadedRuntimes); } private static bool HasMoreThanOneFlag(EDotNetRuntime flags) { return (flags & (flags - 1)) != 0;// has more than 1 flag } public static bool IsRuntimeInitialized(EDotNetRuntime runtime) { return (Instance->InitializedRuntimes & runtime) == runtime; } public static bool IsRuntimeLoaded(EDotNetRuntime runtime) { return (Instance->LoadedRuntimes & runtime) == runtime; } public static EDotNetRuntime GetInitializedRuntimes() { return Instance->InitializedRuntimes; } public static EDotNetRuntime GetLoadedRuntimes() { return Instance->LoadedRuntimes; } public static byte[] GetHotReloadData() { return GetData(Instance->HotReloadData, Instance->HotReloadDataLen); } public static string[] GetHotReloadAssemblyPaths() { byte[] buffer = GetData(Instance->HotReloadAssemblyPaths, Instance->HotReloadAssemblyPathsLen); if (buffer != null && buffer.Length > 0) { string[] result; using (BinaryReader reader = new BinaryReader(new MemoryStream(buffer))) { int count = reader.ReadInt32(); result = new string[count]; for (int i = 0; i < count; i++) { result[i] = reader.ReadString(); } } return result; } return new string[0]; } public static void SetHotReloadData(byte[] data) { SetData(data, &Instance->HotReloadData, &Instance->HotReloadDataLenInMemory, &Instance->HotReloadDataLen); } public static void SetHotReloadAssemblyPaths(string[] assemblyPaths) { using (MemoryStream stream = new MemoryStream()) using (BinaryWriter writer = new BinaryWriter(stream)) { if (assemblyPaths == null) { writer.Write((int)0); } else { writer.Write((int)assemblyPaths.Length); foreach (string assemblyPath in assemblyPaths) { writer.Write(assemblyPath == null ? string.Empty : assemblyPath); } } writer.Flush(); SetData(stream.ToArray(), &Instance->HotReloadAssemblyPaths, &Instance->HotReloadAssemblyPathsLenInMemory, &Instance->HotReloadAssemblyPathsLen); } } private static byte[] GetData(IntPtr dataPtr, int dataLen) { byte[] result = new byte[dataLen]; if (dataPtr != IntPtr.Zero) { Marshal.Copy(dataPtr, result, 0, dataLen); } return result; } private static void SetData(byte[] data, IntPtr* dataPtr, int* dataLenInMemory, int* dataLen) { if (data != null && data.Length > 0) { if (*dataPtr == IntPtr.Zero) { *dataPtr = Malloc((IntPtr)data.Length); *dataLenInMemory = data.Length; } else if (*dataLenInMemory < data.Length) { *dataPtr = Realloc(*dataPtr, (IntPtr)data.Length); *dataLenInMemory = data.Length; } Debug.Assert(*dataPtr != IntPtr.Zero); *dataLen = data.Length; Marshal.Copy(data, 0, *dataPtr, data.Length); } else if (*dataPtr != IntPtr.Zero) { *dataLen = 0; } } public static string GetRuntimeInfo(bool loadedRuntimesInfo) { string info = string.Empty; if (CurrentRuntime == EDotNetRuntime.Mono) { info = "Mono"; } else if (CurrentRuntime == EDotNetRuntime.CoreCLR) { info = "CoreCLR"; } else { info = "CLR"; } if (loadedRuntimesInfo) { if (HaveMultipleRuntimesLoaded()) { info += " (" + GetLoadedRuntimes().ToString() + " are loaded)"; } } else { if (HaveMultipleRuntimesInitialized()) { info += " (" + GetInitializedRuntimes().ToString() + " are initialized)"; } } return info; } public static string GetPlatformName() { return Marshal.PtrToStringAnsi(Instance->PlatformName); } public static void Log(byte verbosity, string message) { LogMsg(verbosity, message); } public static void Log(string message) { Log(5, message); } public static void LogWarning(string message) { Log(3, message); } public static void LogError(string message) { Log(2, message); } } [Flags] internal enum EDotNetRuntime : int { None = 0x00000000, /// <summary> /// .NET Framework /// </summary> CLR = 0x00000001, /// <summary> /// Mono /// </summary> Mono = 0x00000002, /// <summary> /// .NET Core /// </summary> CoreCLR = 0x00000004 } } namespace UnrealEngine.Runtime { /// <summary> /// Used for bool interop between C# and C++ /// </summary> [StructLayout(LayoutKind.Sequential)] public struct csbool { private int val; public bool Value { get { return val != 0; } set { val = value ? 1 : 0; } } public csbool(int value) { val = value == 0 ? 0 : 1; } public csbool(bool value) { val = value ? 1 : 0; } public static implicit operator csbool(bool value) { return new csbool(value); } public static implicit operator bool(csbool value) { return value.Value; } public override string ToString() { return Value.ToString(); } } // BoolInteropNotes: // Any structs which we want to pass between managed and native code with bools needs to be properly converted // due to sizeof(bool) being implementation defined. // // Keep this list up to date and check functions are using the proper conversions // FImplementedInterface // FModuleStatus // FCopyPropertiesForUnrelatedObjectsParams }
{ "pile_set_name": "Github" }
// Rewrite of the Troll Warlord Battle Trance ability // Author: Pizzalol // Date: 09.03.2015. "troll_warlord_battle_trance_datadriven" { // General //------------------------------------------------------------------------------------------------------------- "BaseClass" "ability_datadriven" "AbilityType" "DOTA_ABILITY_TYPE_ULTIMATE" "AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_NO_TARGET | DOTA_ABILITY_BEHAVIOR_IMMEDIATE" "MaxLevel" "3" "FightRecapLevel" "2" "AbilityTextureName" "troll_warlord_battle_trance" // Precache //------------------------------------------------------------------------------------------------------------- "precache" { "soundfile" "soundevents/game_sounds_heroes/game_sounds_troll_warlord.vsndevts" "particle" "particles/units/heroes/hero_troll_warlord/troll_warlord_battletrance_buff.vpcf" } // Casting //------------------------------------------------------------------------------------------------------------- "AbilityCastPoint" "0.0 0.0 0.0" // Time //------------------------------------------------------------------------------------------------------------- "AbilityCooldown" "30" // Cost //------------------------------------------------------------------------------------------------------------- "AbilityManaCost" "75 75 75" // Special //------------------------------------------------------------------------------------------------------------- "AbilitySpecial" { "01" { "var_type" "FIELD_FLOAT" "trance_duration" "7.0" } "02" { "var_type" "FIELD_INTEGER" "attack_speed" "60 120 180" } } "OnSpellStart" { "FireSound" { "EffectName" "Hero_TrollWarlord.BattleTrance.Cast" "Target" "CASTER" } "FireSound" { "EffectName" "Hero_TrollWarlord.BattleTrance.Cast.Team" "Target" "CASTER" } "ActOnTargets" { "Target" { "Center" "CASTER" "Radius" "GLOBAL" "Teams" "DOTA_UNIT_TARGET_TEAM_FRIENDLY" "Types" "DOTA_UNIT_TARGET_HERO" } "Action" { "ApplyModifier" { "ModifierName" "modifier_battle_trance_datadriven" "Target" "TARGET" "Duration" "%trance_duration" } } } } "Modifiers" { "modifier_battle_trance_datadriven" { "IsBuff" "1" "IsPurgable" "0" "EffectName" "particles/units/heroes/hero_troll_warlord/troll_warlord_battletrance_buff.vpcf" "EffectAttachType" "follow_origin" "Properties" { "MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT" "%attack_speed" } } } }
{ "pile_set_name": "Github" }
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * 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 . */ module ooo { module vba { module word { constants WdCursorMovement { const long wdCursorMovementLogical = 0; const long wdCursorMovementVisual = 1; }; }; }; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
{ "pile_set_name": "Github" }
/* --------------------------------------------------------------------------- Open Asset Import Library (assimp) --------------------------------------------------------------------------- Copyright (c) 2006-2017, assimp team All rights reserved. Redistribution and use of this software 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 the assimp team, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of the assimp team. 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. --------------------------------------------------------------------------- */ #include "UnitTestPCH.h" #include "AbstractImportExportBase.h" #include <assimp/Importer.hpp> #include <assimp/postprocess.h> using namespace Assimp; class utBVHImportExport : public AbstractImportExportBase { public: virtual bool importerTest() { Assimp::Importer importer; const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/BVH/01_01.bvh", aiProcess_ValidateDataStructure ); return nullptr != scene; } }; TEST_F( utBVHImportExport, importBlenFromFileTest ) { EXPECT_TRUE( importerTest() ); }
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; using Windows.ApplicationModel; using Windows.Storage; using Windows.Storage.Streams; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; namespace BaseballSimulatorApp.Common { /// <summary> /// SuspensionManager captures global session state to simplify process lifetime management /// for an application. Note that session state will be automatically cleared under a variety /// of conditions and should only be used to store information that would be convenient to /// carry across sessions, but that should be discarded when an application crashes or is /// upgraded. /// </summary> internal sealed class SuspensionManager { private static Dictionary<string, object> _sessionState = new Dictionary<string, object>(); private static List<Type> _knownTypes = new List<Type>(); private const string sessionStateFilename = "_sessionState.xml"; /// <summary> /// Provides access to global session state for the current session. This state is /// serialized by <see cref="SaveAsync"/> and restored by /// <see cref="RestoreAsync"/>, so values must be serializable by /// <see cref="DataContractSerializer"/> and should be as compact as possible. Strings /// and other self-contained data types are strongly recommended. /// </summary> public static Dictionary<string, object> SessionState { get { return _sessionState; } } /// <summary> /// List of custom types provided to the <see cref="DataContractSerializer"/> when /// reading and writing session state. Initially empty, additional types may be /// added to customize the serialization process. /// </summary> public static List<Type> KnownTypes { get { return _knownTypes; } } /// <summary> /// Save the current <see cref="SessionState"/>. Any <see cref="Frame"/> instances /// registered with <see cref="RegisterFrame"/> will also preserve their current /// navigation stack, which in turn gives their active <see cref="Page"/> an opportunity /// to save its state. /// </summary> /// <returns>An asynchronous task that reflects when session state has been saved.</returns> public static async Task SaveAsync() { try { // Save the navigation state for all registered frames foreach (var weakFrameReference in _registeredFrames) { Frame frame; if (weakFrameReference.TryGetTarget(out frame)) { SaveFrameNavigationState(frame); } } // Serialize the session state synchronously to avoid asynchronous access to shared // state MemoryStream sessionData = new MemoryStream(); DataContractSerializer serializer = new DataContractSerializer(typeof(Dictionary<string, object>), _knownTypes); serializer.WriteObject(sessionData, _sessionState); // Get an output stream for the SessionState file and write the state asynchronously StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(sessionStateFilename, CreationCollisionOption.ReplaceExisting); using (Stream fileStream = await file.OpenStreamForWriteAsync()) { sessionData.Seek(0, SeekOrigin.Begin); await sessionData.CopyToAsync(fileStream); await fileStream.FlushAsync(); } } catch (Exception e) { throw new SuspensionManagerException(e); } } /// <summary> /// Restores previously saved <see cref="SessionState"/>. Any <see cref="Frame"/> instances /// registered with <see cref="RegisterFrame"/> will also restore their prior navigation /// state, which in turn gives their active <see cref="Page"/> an opportunity restore its /// state. /// </summary> /// <returns>An asynchronous task that reflects when session state has been read. The /// content of <see cref="SessionState"/> should not be relied upon until this task /// completes.</returns> public static async Task RestoreAsync() { _sessionState = new Dictionary<String, Object>(); try { // Get the input stream for the SessionState file StorageFile file = await ApplicationData.Current.LocalFolder.GetFileAsync(sessionStateFilename); using (IInputStream inStream = await file.OpenSequentialReadAsync()) { // Deserialize the Session State DataContractSerializer serializer = new DataContractSerializer(typeof(Dictionary<string, object>), _knownTypes); _sessionState = (Dictionary<string, object>)serializer.ReadObject(inStream.AsStreamForRead()); } // Restore any registered frames to their saved state foreach (var weakFrameReference in _registeredFrames) { Frame frame; if (weakFrameReference.TryGetTarget(out frame)) { frame.ClearValue(FrameSessionStateProperty); RestoreFrameNavigationState(frame); } } } catch (Exception e) { throw new SuspensionManagerException(e); } } private static DependencyProperty FrameSessionStateKeyProperty = DependencyProperty.RegisterAttached("_FrameSessionStateKey", typeof(String), typeof(SuspensionManager), null); private static DependencyProperty FrameSessionStateProperty = DependencyProperty.RegisterAttached("_FrameSessionState", typeof(Dictionary<String, Object>), typeof(SuspensionManager), null); private static List<WeakReference<Frame>> _registeredFrames = new List<WeakReference<Frame>>(); /// <summary> /// Registers a <see cref="Frame"/> instance to allow its navigation history to be saved to /// and restored from <see cref="SessionState"/>. Frames should be registered once /// immediately after creation if they will participate in session state management. Upon /// registration if state has already been restored for the specified key /// the navigation history will immediately be restored. Subsequent invocations of /// <see cref="RestoreAsync"/> will also restore navigation history. /// </summary> /// <param name="frame">An instance whose navigation history should be managed by /// <see cref="SuspensionManager"/></param> /// <param name="sessionStateKey">A unique key into <see cref="SessionState"/> used to /// store navigation-related information.</param> public static void RegisterFrame(Frame frame, String sessionStateKey) { if (frame.GetValue(FrameSessionStateKeyProperty) != null) { throw new InvalidOperationException("Frames can only be registered to one session state key"); } if (frame.GetValue(FrameSessionStateProperty) != null) { throw new InvalidOperationException("Frames must be either be registered before accessing frame session state, or not registered at all"); } // Use a dependency property to associate the session key with a frame, and keep a list of frames whose // navigation state should be managed frame.SetValue(FrameSessionStateKeyProperty, sessionStateKey); _registeredFrames.Add(new WeakReference<Frame>(frame)); // Check to see if navigation state can be restored RestoreFrameNavigationState(frame); } /// <summary> /// Disassociates a <see cref="Frame"/> previously registered by <see cref="RegisterFrame"/> /// from <see cref="SessionState"/>. Any navigation state previously captured will be /// removed. /// </summary> /// <param name="frame">An instance whose navigation history should no longer be /// managed.</param> public static void UnregisterFrame(Frame frame) { // Remove session state and remove the frame from the list of frames whose navigation // state will be saved (along with any weak references that are no longer reachable) SessionState.Remove((String)frame.GetValue(FrameSessionStateKeyProperty)); _registeredFrames.RemoveAll((weakFrameReference) => { Frame testFrame; return !weakFrameReference.TryGetTarget(out testFrame) || testFrame == frame; }); } /// <summary> /// Provides storage for session state associated with the specified <see cref="Frame"/>. /// Frames that have been previously registered with <see cref="RegisterFrame"/> have /// their session state saved and restored automatically as a part of the global /// <see cref="SessionState"/>. Frames that are not registered have transient state /// that can still be useful when restoring pages that have been discarded from the /// navigation cache. /// </summary> /// <remarks>Apps may choose to rely on <see cref="LayoutAwarePage"/> to manage /// page-specific state instead of working with frame session state directly.</remarks> /// <param name="frame">The instance for which session state is desired.</param> /// <returns>A collection of state subject to the same serialization mechanism as /// <see cref="SessionState"/>.</returns> public static Dictionary<String, Object> SessionStateForFrame(Frame frame) { var frameState = (Dictionary<String, Object>)frame.GetValue(FrameSessionStateProperty); if (frameState == null) { var frameSessionKey = (String)frame.GetValue(FrameSessionStateKeyProperty); if (frameSessionKey != null) { // Registered frames reflect the corresponding session state if (!_sessionState.ContainsKey(frameSessionKey)) { _sessionState[frameSessionKey] = new Dictionary<String, Object>(); } frameState = (Dictionary<String, Object>)_sessionState[frameSessionKey]; } else { // Frames that aren't registered have transient state frameState = new Dictionary<String, Object>(); } frame.SetValue(FrameSessionStateProperty, frameState); } return frameState; } private static void RestoreFrameNavigationState(Frame frame) { var frameState = SessionStateForFrame(frame); if (frameState.ContainsKey("Navigation")) { frame.SetNavigationState((String)frameState["Navigation"]); } } private static void SaveFrameNavigationState(Frame frame) { var frameState = SessionStateForFrame(frame); frameState["Navigation"] = frame.GetNavigationState(); } } public class SuspensionManagerException : Exception { public SuspensionManagerException() { } public SuspensionManagerException(Exception e) : base("SuspensionManager failed", e) { } } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> </Project>
{ "pile_set_name": "Github" }
{ "pile_set_name": "Github" }
/* * Copyright 2020 Red Hat, Inc. and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.optaplanner.core.impl.score.inliner; import java.math.BigDecimal; import java.util.function.Consumer; import org.optaplanner.core.api.score.Score; import org.optaplanner.core.impl.score.director.InnerScoreDirector; @FunctionalInterface public interface BigDecimalWeightedScoreImpacter extends WeightedScoreImpacter { /** * @param matchWeight never null * @param scoreConsumer null if {@link InnerScoreDirector#isConstraintMatchEnabled()} is false * @return never null */ UndoScoreImpacter impactScore(BigDecimal matchWeight, Consumer<Score<?>> scoreConsumer); }
{ "pile_set_name": "Github" }
/** * This Source Code Form is subject to the terms of the Mozilla Public License, * v. 2.0. If a copy of the MPL was not distributed with this file, You can * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. * * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS * graphic logo is a trademark of OpenMRS Inc. */ package org.openmrs.api.handler; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Date; import org.junit.jupiter.api.Test; import org.openmrs.Person; import org.openmrs.User; /** * Tests the {@link PersonUnvoidHandler} class. */ public class PersonUnvoidHandlerTest { /** * @see PersonUnvoidHandler#handle(Person,User,Date,String) */ @Test public void handle_shouldUnsetThePersonVoidedBit() { UnvoidHandler<Person> handler = new PersonUnvoidHandler(); Person person = new Person(); person.setPersonVoided(true); // make sure personVoided is set handler.handle(person, null, null, null); assertFalse(person.getPersonVoided()); } /** * @see PersonUnvoidHandler#handle(Person,User,Date,String) */ @Test public void handle_shouldUnsetThePersonVoider() { UnvoidHandler<Person> handler = new PersonUnvoidHandler(); Person person = new Person(); person.setPersonVoided(true); person.setPersonVoidedBy(new User(1)); handler.handle(person, null, null, null); assertNull(person.getPersonVoidedBy()); } /** * @see PersonUnvoidHandler#handle(Person,User,Date,String) */ @Test public void handle_shouldUnsetThePersonDateVoided() { UnvoidHandler<Person> handler = new PersonUnvoidHandler(); Person person = new Person(); person.setPersonVoided(true); person.setPersonDateVoided(new Date()); handler.handle(person, null, null, null); assertNull(person.getPersonDateVoided()); } /** * @see PersonUnvoidHandler#handle(Person,User,Date,String) */ @Test public void handle_shouldUnsetThePersonVoidReason() { UnvoidHandler<Person> handler = new PersonUnvoidHandler(); Person person = new Person(); person.setPersonVoided(true); person.setPersonVoidReason("SOME REASON"); handler.handle(person, null, null, null); assertNull(person.getPersonVoidReason()); } /** * @see PersonUnvoidHandler#handle(Person,User,Date,String) */ @Test public void handle_shouldOnlyActOnAlreadyVoidedObjects() { UnvoidHandler<Person> handler = new PersonUnvoidHandler(); Person person = new Person(); person.setPersonVoided(false); handler.handle(person, null, null, "SOME REASON"); assertNull(person.getPersonVoidReason()); } /** * @see PersonUnvoidHandler#handle(Person,User,Date,String) */ @Test public void handle_shouldNotActOnObjectsWithADifferentPersonDateVoided() { Date d = new Date(new Date().getTime() - 1000); // a time that isn't right now UnvoidHandler<Person> handler = new PersonUnvoidHandler(); Person person = new Person(); person.setPersonVoided(true); person.setPersonDateVoided(d); handler.handle(person, null, new Date(), "SOME REASON"); assertTrue(person.getPersonVoided()); } }
{ "pile_set_name": "Github" }
<snippet> <content><![CDATA[ <a class="btn btn-large btn-block btn-warning" href="#" role="button">button</a> ]]></content> <tabTrigger>bs3-block-link-button:warning</tabTrigger> </snippet>
{ "pile_set_name": "Github" }
package Paws::Kendra::UpdateDataSource; use Moose; has Configuration => (is => 'ro', isa => 'Paws::Kendra::DataSourceConfiguration'); has Description => (is => 'ro', isa => 'Str'); has Id => (is => 'ro', isa => 'Str', required => 1); has IndexId => (is => 'ro', isa => 'Str', required => 1); has Name => (is => 'ro', isa => 'Str'); has RoleArn => (is => 'ro', isa => 'Str'); has Schedule => (is => 'ro', isa => 'Str'); use MooseX::ClassAttribute; class_has _api_call => (isa => 'Str', is => 'ro', default => 'UpdateDataSource'); class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::API::Response'); class_has _result_key => (isa => 'Str', is => 'ro'); 1; ### main pod documentation begin ### =head1 NAME Paws::Kendra::UpdateDataSource - Arguments for method UpdateDataSource on L<Paws::Kendra> =head1 DESCRIPTION This class represents the parameters used for calling the method UpdateDataSource on the L<AWSKendraFrontendService|Paws::Kendra> service. Use the attributes of this class as arguments to method UpdateDataSource. You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to UpdateDataSource. =head1 SYNOPSIS my $kendra = Paws->service('Kendra'); $kendra->UpdateDataSource( Id => 'MyDataSourceId', IndexId => 'MyIndexId', Configuration => { DatabaseConfiguration => { ColumnConfiguration => { ChangeDetectingColumns => [ 'MyColumnName', ... # min: 1, max: 100 ], # min: 1, max: 5 DocumentDataColumnName => 'MyColumnName', # min: 1, max: 100 DocumentIdColumnName => 'MyColumnName', # min: 1, max: 100 DocumentTitleColumnName => 'MyColumnName', # min: 1, max: 100 FieldMappings => [ { DataSourceFieldName => 'MyDataSourceFieldName', # min: 1, max: 100 IndexFieldName => 'MyIndexFieldName', # min: 1, max: 30 DateFieldFormat => 'MyDataSourceDateFieldFormat', # min: 4, max: 40; OPTIONAL }, ... ], # min: 1, max: 100; OPTIONAL }, ConnectionConfiguration => { DatabaseHost => 'MyDatabaseHost', # min: 1, max: 253 DatabaseName => 'MyDatabaseName', # min: 1, max: 100 DatabasePort => 1, # min: 1, max: 65535 SecretArn => 'MySecretArn', # min: 1, max: 1284 TableName => 'MyTableName', # min: 1, max: 100 }, DatabaseEngineType => 'RDS_AURORA_MYSQL' , # values: RDS_AURORA_MYSQL, RDS_AURORA_POSTGRESQL, RDS_MYSQL, RDS_POSTGRESQL AclConfiguration => { AllowedGroupsColumnName => 'MyColumnName', # min: 1, max: 100 }, # OPTIONAL VpcConfiguration => { SecurityGroupIds => [ 'MyVpcSecurityGroupId', ... # min: 1, max: 200 ], # min: 1, max: 10 SubnetIds => [ 'MySubnetId', ... # min: 1, max: 200 ], # min: 1, max: 6 }, # OPTIONAL }, # OPTIONAL S3Configuration => { BucketName => 'MyS3BucketName', # min: 3, max: 63 AccessControlListConfiguration => { KeyPath => 'MyS3ObjectKey', # min: 1, max: 1024; OPTIONAL }, # OPTIONAL DocumentsMetadataConfiguration => { S3Prefix => 'MyS3ObjectKey', # min: 1, max: 1024; OPTIONAL }, # OPTIONAL ExclusionPatterns => [ 'MyDataSourceInclusionsExclusionsStringsMember', ... # min: 1, max: 50 ], # max: 100; OPTIONAL InclusionPrefixes => [ 'MyDataSourceInclusionsExclusionsStringsMember', ... # min: 1, max: 50 ], # max: 100; OPTIONAL }, # OPTIONAL SharePointConfiguration => { SecretArn => 'MySecretArn', # min: 1, max: 1284 SharePointVersion => 'SHAREPOINT_ONLINE', # values: SHAREPOINT_ONLINE Urls => [ 'MyUrl', ... # min: 1, max: 2048 ], # min: 1, max: 100 CrawlAttachments => 1, # OPTIONAL DocumentTitleFieldName => 'MyDataSourceFieldName', # min: 1, max: 100 FieldMappings => [ { DataSourceFieldName => 'MyDataSourceFieldName', # min: 1, max: 100 IndexFieldName => 'MyIndexFieldName', # min: 1, max: 30 DateFieldFormat => 'MyDataSourceDateFieldFormat', # min: 4, max: 40; OPTIONAL }, ... ], # min: 1, max: 100; OPTIONAL VpcConfiguration => { SecurityGroupIds => [ 'MyVpcSecurityGroupId', ... # min: 1, max: 200 ], # min: 1, max: 10 SubnetIds => [ 'MySubnetId', ... # min: 1, max: 200 ], # min: 1, max: 6 }, # OPTIONAL }, # OPTIONAL }, # OPTIONAL Description => 'MyDescription', # OPTIONAL Name => 'MyDataSourceName', # OPTIONAL RoleArn => 'MyRoleArn', # OPTIONAL Schedule => 'MyScanSchedule', # OPTIONAL ); Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object. For the AWS API documentation, see L<https://docs.aws.amazon.com/goto/WebAPI/kendra/UpdateDataSource> =head1 ATTRIBUTES =head2 Configuration => L<Paws::Kendra::DataSourceConfiguration> =head2 Description => Str The new description for the data source. =head2 B<REQUIRED> Id => Str The unique identifier of the data source to update. =head2 B<REQUIRED> IndexId => Str The identifier of the index that contains the data source to update. =head2 Name => Str The name of the data source to update. The name of the data source can't be updated. To rename a data source you must delete the data source and re-create it. =head2 RoleArn => Str The Amazon Resource Name (ARN) of the new role to use when the data source is accessing resources on your behalf. =head2 Schedule => Str The new update schedule for the data source. =head1 SEE ALSO This class forms part of L<Paws>, documenting arguments for method UpdateDataSource in L<Paws::Kendra> =head1 BUGS and CONTRIBUTIONS The source code is located here: L<https://github.com/pplu/aws-sdk-perl> Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> =cut
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <title>Функция T.INV (СТЬЮДЕНТ.ОБР)</title> <meta charset="utf-8" /> <meta name="description" content="" /> <link type="text/css" rel="stylesheet" href="../editor.css" /> </head> <body> <div class="mainpart"> <h1>Функция T.INV (СТЬЮДЕНТ.ОБР)</h1> <p>Функция <b>T.INV</b> - это одна из статистических функций. Возвращает левостороннее обратное t-распределение Стьюдента.</p> <p>Синтаксис функции <b>T.INV</b>:</p> <p style="text-indent: 150px;"><b><em>T.INV(probability, deg-freedom)</em></b></p> <p><em>где</em></p> <p style="text-indent: 50px;"><b><em>probability</em></b> - вероятность, связанная с t-распределением Стьюдента. Числовое значение больше 0, но меньше 1.</p> <p style="text-indent: 50px;"><b><em>deg-freedom</em></b> - число степеней свободы; целое число большее или равное 1.</p> <p>Эти аргументы можно ввести вручную или использовать в качестве аргументов ссылки на ячейки.</p> <p>Чтобы применить функцию <b>T.INV</b>,</p> <ol> <li>выделите ячейку, в которой требуется отобразить результат,</li> <li>щелкните по значку <b>Вставить функцию</b> <img alt="Значок Вставить функцию" src="../images/insertfunction.png" />, расположенному на верхней панели инструментов, <br />или щелкните правой кнопкой мыши по выделенной ячейке и выберите в меню команду <b>Вставить функцию</b>, <br />или щелкните по значку <img alt="Значок Функция" src="../images/function.png" /> перед строкой формул, </li> <li>выберите из списка группу функций <b>Статистические</b>,</li> <li>щелкните по функции <b>T.INV</b>,</li> <li>введите требуемые аргументы, разделяя их запятыми,</li> <li>нажмите клавишу <b>Enter</b>.</li> </ol> <p>Результат будет отображен в выбранной ячейке.</p> <p style="text-indent: 150px;"><img alt="Функция T.INV" src="../images/t-inv.png" /></p> </div> </body> </html>
{ "pile_set_name": "Github" }
/* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package v1 // Clones the given selector and returns a new selector with the given key and value added. // Returns the given selector, if labelKey is empty. func CloneSelectorAndAddLabel(selector *LabelSelector, labelKey, labelValue string) *LabelSelector { if labelKey == "" { // Don't need to add a label. return selector } // Clone. newSelector := selector.DeepCopy() if newSelector.MatchLabels == nil { newSelector.MatchLabels = make(map[string]string) } newSelector.MatchLabels[labelKey] = labelValue return newSelector } // AddLabelToSelector returns a selector with the given key and value added to the given selector's MatchLabels. func AddLabelToSelector(selector *LabelSelector, labelKey, labelValue string) *LabelSelector { if labelKey == "" { // Don't need to add a label. return selector } if selector.MatchLabels == nil { selector.MatchLabels = make(map[string]string) } selector.MatchLabels[labelKey] = labelValue return selector } // SelectorHasLabel checks if the given selector contains the given label key in its MatchLabels func SelectorHasLabel(selector *LabelSelector, labelKey string) bool { return len(selector.MatchLabels[labelKey]) > 0 }
{ "pile_set_name": "Github" }
{-# LANGUAGE OverloadedStrings #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.Kinesis.Types -- Copyright : (c) 2013-2018 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay <[email protected]> -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- module Network.AWS.Kinesis.Types ( -- * Service Configuration kinesis -- * Errors , _KMSInvalidStateException , _KMSThrottlingException , _ExpiredIteratorException , _InvalidArgumentException , _KMSOptInRequired , _ProvisionedThroughputExceededException , _KMSNotFoundException , _ExpiredNextTokenException , _KMSDisabledException , _ResourceNotFoundException , _KMSAccessDeniedException , _LimitExceededException , _ResourceInUseException -- * EncryptionType , EncryptionType (..) -- * MetricsName , MetricsName (..) -- * ScalingType , ScalingType (..) -- * ShardIteratorType , ShardIteratorType (..) -- * StreamStatus , StreamStatus (..) -- * EnhancedMetrics , EnhancedMetrics , enhancedMetrics , emShardLevelMetrics -- * EnhancedMonitoringOutput , EnhancedMonitoringOutput , enhancedMonitoringOutput , emoDesiredShardLevelMetrics , emoCurrentShardLevelMetrics , emoStreamName -- * HashKeyRange , HashKeyRange , hashKeyRange , hkrStartingHashKey , hkrEndingHashKey -- * PutRecordsRequestEntry , PutRecordsRequestEntry , putRecordsRequestEntry , prreExplicitHashKey , prreData , prrePartitionKey -- * PutRecordsResultEntry , PutRecordsResultEntry , putRecordsResultEntry , prreSequenceNumber , prreErrorCode , prreErrorMessage , prreShardId -- * Record , Record , record , rEncryptionType , rApproximateArrivalTimestamp , rSequenceNumber , rData , rPartitionKey -- * SequenceNumberRange , SequenceNumberRange , sequenceNumberRange , snrEndingSequenceNumber , snrStartingSequenceNumber -- * Shard , Shard , shard , sAdjacentParentShardId , sParentShardId , sShardId , sHashKeyRange , sSequenceNumberRange -- * StreamDescription , StreamDescription , streamDescription , sdEncryptionType , sdKeyId , sdStreamName , sdStreamARN , sdStreamStatus , sdShards , sdHasMoreShards , sdRetentionPeriodHours , sdStreamCreationTimestamp , sdEnhancedMonitoring -- * StreamDescriptionSummary , StreamDescriptionSummary , streamDescriptionSummary , sdsEncryptionType , sdsKeyId , sdsStreamName , sdsStreamARN , sdsStreamStatus , sdsRetentionPeriodHours , sdsStreamCreationTimestamp , sdsEnhancedMonitoring , sdsOpenShardCount -- * Tag , Tag , tag , tagValue , tagKey ) where import Network.AWS.Kinesis.Types.Product import Network.AWS.Kinesis.Types.Sum import Network.AWS.Lens import Network.AWS.Prelude import Network.AWS.Sign.V4 -- | API version @2013-12-02@ of the Amazon Kinesis SDK configuration. kinesis :: Service kinesis = Service { _svcAbbrev = "Kinesis" , _svcSigner = v4 , _svcPrefix = "kinesis" , _svcVersion = "2013-12-02" , _svcEndpoint = defaultEndpoint kinesis , _svcTimeout = Just 70 , _svcCheck = statusSuccess , _svcError = parseJSONError "Kinesis" , _svcRetry = retry } where retry = Exponential { _retryBase = 5.0e-2 , _retryGrowth = 2 , _retryAttempts = 5 , _retryCheck = check } check e | has (hasCode "ThrottledException" . hasStatus 400) e = Just "throttled_exception" | has (hasStatus 429) e = Just "too_many_requests" | has (hasCode "ThrottlingException" . hasStatus 400) e = Just "throttling_exception" | has (hasCode "Throttling" . hasStatus 400) e = Just "throttling" | has (hasStatus 504) e = Just "gateway_timeout" | has (hasCode "RequestThrottledException" . hasStatus 400) e = Just "request_throttled_exception" | has (hasStatus 502) e = Just "bad_gateway" | has (hasStatus 503) e = Just "service_unavailable" | has (hasStatus 500) e = Just "general_server_error" | has (hasStatus 509) e = Just "limit_exceeded" | otherwise = Nothing -- | The request was rejected because the state of the specified resource isn't valid for this request. For more information, see <http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html How Key State Affects Use of a Customer Master Key> in the /AWS Key Management Service Developer Guide/ . -- -- _KMSInvalidStateException :: AsError a => Getting (First ServiceError) a ServiceError _KMSInvalidStateException = _MatchServiceError kinesis "KMSInvalidStateException" -- | The request was denied due to request throttling. For more information about throttling, see <http://docs.aws.amazon.com/kms/latest/developerguide/limits.html#requests-per-second Limits> in the /AWS Key Management Service Developer Guide/ . -- -- _KMSThrottlingException :: AsError a => Getting (First ServiceError) a ServiceError _KMSThrottlingException = _MatchServiceError kinesis "KMSThrottlingException" -- | The provided iterator exceeds the maximum age allowed. -- -- _ExpiredIteratorException :: AsError a => Getting (First ServiceError) a ServiceError _ExpiredIteratorException = _MatchServiceError kinesis "ExpiredIteratorException" -- | A specified parameter exceeds its restrictions, is not supported, or can't be used. For more information, see the returned message. -- -- _InvalidArgumentException :: AsError a => Getting (First ServiceError) a ServiceError _InvalidArgumentException = _MatchServiceError kinesis "InvalidArgumentException" -- | The AWS access key ID needs a subscription for the service. -- -- _KMSOptInRequired :: AsError a => Getting (First ServiceError) a ServiceError _KMSOptInRequired = _MatchServiceError kinesis "KMSOptInRequired" -- | The request rate for the stream is too high, or the requested data is too large for the available throughput. Reduce the frequency or size of your requests. For more information, see <http://docs.aws.amazon.com/kinesis/latest/dev/service-sizes-and-limits.html Streams Limits> in the /Amazon Kinesis Data Streams Developer Guide/ , and <http://docs.aws.amazon.com/general/latest/gr/api-retries.html Error Retries and Exponential Backoff in AWS> in the /AWS General Reference/ . -- -- _ProvisionedThroughputExceededException :: AsError a => Getting (First ServiceError) a ServiceError _ProvisionedThroughputExceededException = _MatchServiceError kinesis "ProvisionedThroughputExceededException" -- | The request was rejected because the specified entity or resource can't be found. -- -- _KMSNotFoundException :: AsError a => Getting (First ServiceError) a ServiceError _KMSNotFoundException = _MatchServiceError kinesis "KMSNotFoundException" -- | The pagination token passed to the @ListShards@ operation is expired. For more information, see 'ListShardsInput$NextToken' . -- -- _ExpiredNextTokenException :: AsError a => Getting (First ServiceError) a ServiceError _ExpiredNextTokenException = _MatchServiceError kinesis "ExpiredNextTokenException" -- | The request was rejected because the specified customer master key (CMK) isn't enabled. -- -- _KMSDisabledException :: AsError a => Getting (First ServiceError) a ServiceError _KMSDisabledException = _MatchServiceError kinesis "KMSDisabledException" -- | The requested resource could not be found. The stream might not be specified correctly. -- -- _ResourceNotFoundException :: AsError a => Getting (First ServiceError) a ServiceError _ResourceNotFoundException = _MatchServiceError kinesis "ResourceNotFoundException" -- | The ciphertext references a key that doesn't exist or that you don't have access to. -- -- _KMSAccessDeniedException :: AsError a => Getting (First ServiceError) a ServiceError _KMSAccessDeniedException = _MatchServiceError kinesis "KMSAccessDeniedException" -- | The requested resource exceeds the maximum number allowed, or the number of concurrent stream requests exceeds the maximum number allowed. -- -- _LimitExceededException :: AsError a => Getting (First ServiceError) a ServiceError _LimitExceededException = _MatchServiceError kinesis "LimitExceededException" -- | The resource is not available for this operation. For successful operation, the resource must be in the @ACTIVE@ state. -- -- _ResourceInUseException :: AsError a => Getting (First ServiceError) a ServiceError _ResourceInUseException = _MatchServiceError kinesis "ResourceInUseException"
{ "pile_set_name": "Github" }
<annotation> <folder>imagesRaw</folder> <filename>2017-12-24 09:15:01.439396.jpg</filename> <path>/Users/abell/Development/other.nyc/Camera/imagesRaw/2017-12-24 09:15:01.439396.jpg</path> <source> <database>Unknown</database> </source> <size> <width>352</width> <height>240</height> <depth>3</depth> </size> <segmented>0</segmented> <object> <name>pedestrian</name> <pose>Unspecified</pose> <truncated>0</truncated> <difficult>0</difficult> <bndbox> <xmin>260</xmin> <ymin>160</ymin> <xmax>268</xmax> <ymax>183</ymax> </bndbox> </object> <object> <name>car</name> <pose>Unspecified</pose> <truncated>0</truncated> <difficult>0</difficult> <bndbox> <xmin>203</xmin> <ymin>146</ymin> <xmax>222</xmax> <ymax>163</ymax> </bndbox> </object> </annotation>
{ "pile_set_name": "Github" }
#!/bin/bash set -x echo '' > `docker inspect --format='{{.LogPath}}' $1`
{ "pile_set_name": "Github" }
@RUN: llvm-mc -triple arm-unknown-linux -filetype=obj %s | llvm-objdump -d - | FileCheck %s .text b l0 .inst 0xffffffff l0: @CHECK: 0: 00 00 00 ea b #0 <l0> @CHECK-NEXT: 4: ff ff ff ff <unknown>
{ "pile_set_name": "Github" }
import { addons } from "@storybook/addons"; addons.setConfig({ enableShortcuts: false, });
{ "pile_set_name": "Github" }
# These are supported funding model platforms patreon: 2m0sql custom: ['https://paypal.me/PGoodhall']
{ "pile_set_name": "Github" }
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("LanguageServer")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("88ed0ea0-f179-400e-af26-3e4ef8c697da")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")]
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 47fb8cfee60176b4ba98c86cb0642786 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
// // GHTestCase.h // GHUnit // // Created by Gabriel Handford on 1/21/09. // Copyright 2009. All rights reserved. // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without // restriction, including without limitation the rights to use, // copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // // // Portions of this file fall under the following license, marked with: // GTM_BEGIN : GTM_END // // Copyright 2008 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy // of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations under // the License. // #import "GHTestMacros.h" #import "GHTest.h" // Log to your test case logger. // For example, GHTestLog(@"Some debug info, %@", obj) #define GHTestLog(...) [self log:[NSString stringWithFormat:__VA_ARGS__, nil]] /*! The base class for a test case. @code @interface MyTest : GHTestCase {} @end @implementation MyTest // Run before each test method - (void)setUp { } // Run after each test method - (void)tearDown { } // Run before the tests are run for this class - (void)setUpClass { } // Run before the tests are run for this class - (void)tearDownClass { } // Tests are prefixed by 'test' and contain no arguments and no return value - (void)testA { GHTestLog(@"Log with a test with the GHTestLog(...) for test specific logging."); } // Another test; Tests are run in lexical order - (void)testB { } // Override any exceptions; By default exceptions are raised, causing a test failure - (void)failWithException:(NSException *)exception { } @end @endcode */ @interface GHTestCase : NSObject { id<GHTestCaseLogWriter> logWriter_; // weak SEL currentSelector_; } //! The current test selector @property (assign, nonatomic) SEL currentSelector; @property (assign, nonatomic) id<GHTestCaseLogWriter> logWriter; // GTM_BEGIN //! Run before each test method - (void)setUp; //! Run after each test method - (void)tearDown; /*! By default exceptions are raised, causing a test failure @brief Override any exceptions @param exception Exception that was raised by test */ - (void)failWithException:(NSException*)exception; // GTM_END //! Run before the tests (once per test case) - (void)setUpClass; //! Run after the tests (once per test case) - (void)tearDownClass; /*! Whether to run the tests on a separate thread. Override this method in your test case to override the default. Default is NO, tests are run on a separate thread by default. @result If YES runs on the main thread */ - (BOOL)shouldRunOnMainThread; //! Any special handling of exceptions after they are thrown; By default logs stack trace to standard out. - (void)handleException:(NSException *)exception; /*! Log a message, which notifies the log delegate. This is not meant to be used directly, see GHTestLog(...) macro. @param message */ - (void)log:(NSString *)message; @end
{ "pile_set_name": "Github" }
/* * Copyright (C) 2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // DO NOT EDIT THIS FILE. It is automatically generated from generate-enum-with-guard.json // by the script: JavaScriptCore/replay/scripts/CodeGeneratorReplayInputs.py #ifndef generate_enum_with_guard_json_TestReplayInputs_h #define generate_enum_with_guard_json_TestReplayInputs_h #if ENABLE(WEB_REPLAY) #include "InternalNamespaceHeaderIncludeDummy.h" #include <platform/ExternalNamespaceHeaderIncludeDummy.h> namespace Test { enum PlatformWheelPhase : uint64_t; } namespace WebCore { class PlatformWheelEvent; } namespace Test { class HandleWheelEvent; } // namespace Test namespace JSC { template<> struct TEST_EXPORT_MACRO InputTraits<Test::HandleWheelEvent> { static InputQueue queue() { return InputQueue::EventLoopInput; } static const String& type(); static void encode(JSC::EncodedValue&, const Test::HandleWheelEvent&); static bool decode(JSC::EncodedValue&, std::unique_ptr<Test::HandleWheelEvent>&); }; #if ENABLE(DUMMY_FEATURE) template<> struct TEST_EXPORT_MACRO EncodingTraits<Test::PlatformWheelPhase> { typedef Test::PlatformWheelPhase DecodedType; static EncodedValue encodeValue(const Test::PlatformWheelPhase& value); static bool decodeValue(EncodedValue&, Test::PlatformWheelPhase& value); }; #endif // ENABLE(DUMMY_FEATURE) } // namespace JSC namespace Test { class HandleWheelEvent : public EventLoopInput<HandleWheelEvent> { public: TEST_EXPORT_MACRO HandleWheelEvent(std::unique_ptr<PlatformWheelEvent> platformEvent, PlatformWheelPhase phase); virtual ~HandleWheelEvent(); // EventLoopInput API void dispatch(ReplayController&) final; const PlatformWheelEvent& platformEvent() const { return *m_platformEvent; } PlatformWheelPhase phase() const { return m_phase; } private: std::unique_ptr<PlatformWheelEvent> m_platformEvent; PlatformWheelPhase m_phase; }; } // namespace Test SPECIALIZE_TYPE_TRAITS_BEGIN(Test::HandleWheelEvent) static bool isType(const NondeterministicInputBase& input) { return input.type() == InputTraits<Test::HandleWheelEvent>::type(); } SPECIALIZE_TYPE_TRAITS_END() #define TEST_REPLAY_INPUT_NAMES_FOR_EACH(macro) \ macro(HandleWheelEvent) \ \ // end of TEST_REPLAY_INPUT_NAMES_FOR_EACH #endif // ENABLE(WEB_REPLAY) #endif // generate-enum-with-guard.json-TestReplayInputs_h
{ "pile_set_name": "Github" }
<!-- ~ Copyright 2017 Google Inc. ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> </resources>
{ "pile_set_name": "Github" }
//! moment.js locale configuration //! locale : thai (th) //! author : Kridsada Thanabulpong : https://github.com/sirn (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../moment')) : typeof define === 'function' && define.amd ? define(['moment'], factory) : factory(global.moment) }(this, function (moment) { 'use strict'; var th = moment.defineLocale('th', { months : 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split('_'), monthsShort : 'มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา'.split('_'), weekdays : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'), weekdaysShort : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference weekdaysMin : 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'), longDateFormat : { LT : 'H นาฬิกา m นาที', LTS : 'LT s วินาที', L : 'YYYY/MM/DD', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY เวลา LT', LLLL : 'วันddddที่ D MMMM YYYY เวลา LT' }, meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/, isPM: function (input) { return input === 'หลังเที่ยง'; }, meridiem : function (hour, minute, isLower) { if (hour < 12) { return 'ก่อนเที่ยง'; } else { return 'หลังเที่ยง'; } }, calendar : { sameDay : '[วันนี้ เวลา] LT', nextDay : '[พรุ่งนี้ เวลา] LT', nextWeek : 'dddd[หน้า เวลา] LT', lastDay : '[เมื่อวานนี้ เวลา] LT', lastWeek : '[วัน]dddd[ที่แล้ว เวลา] LT', sameElse : 'L' }, relativeTime : { future : 'อีก %s', past : '%sที่แล้ว', s : 'ไม่กี่วินาที', m : '1 นาที', mm : '%d นาที', h : '1 ชั่วโมง', hh : '%d ชั่วโมง', d : '1 วัน', dd : '%d วัน', M : '1 เดือน', MM : '%d เดือน', y : '1 ปี', yy : '%d ปี' } }); return th; }));
{ "pile_set_name": "Github" }
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magento.com for more information. * * @category Mage * @package Mage_Adminhtml * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Adminhtml customer view wishlist block * * @category Mage * @package Mage_Adminhtml * @author Magento Core Team <[email protected]> */ class Mage_Adminhtml_Block_Customer_Edit_Tab_View_Wishlist extends Mage_Adminhtml_Block_Widget_Grid { /** * Initial settings * * @return void */ public function __construct() { parent::__construct(); $this->setId('customer_view_wishlist_grid'); $this->setSortable(false); $this->setPagerVisibility(false); $this->setFilterVisibility(false); $this->setEmptyText(Mage::helper('customer')->__("There are no items in customer's wishlist at the moment")); } /** * Prepare collection * * @return $this */ protected function _prepareCollection() { $collection = Mage::getModel('wishlist/item')->getCollection() ->addCustomerIdFilter(Mage::registry('current_customer')->getId()) ->addDaysInWishlist(true) ->addStoreData() ->setInStockFilter(true); $this->setCollection($collection); return parent::_prepareCollection(); } /** * Prepare columns * * @return $this */ protected function _prepareColumns() { $this->addColumn('product_id', array( 'header' => Mage::helper('customer')->__('Product ID'), 'index' => 'product_id', 'type' => 'number', 'width' => '100px' )); $this->addColumn('product_name', array( 'header' => Mage::helper('customer')->__('Product Name'), 'index' => 'product_name', 'renderer' => 'adminhtml/customer_edit_tab_view_grid_renderer_item' )); if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('store', array( 'header' => Mage::helper('customer')->__('Added From'), 'index' => 'store_id', 'type' => 'store', 'width' => '160px', )); } $this->addColumn('added_at', array( 'header' => Mage::helper('customer')->__('Date Added'), 'index' => 'added_at', 'type' => 'date', 'width' => '140px', )); $this->addColumn('days', array( 'header' => Mage::helper('customer')->__('Days in Wishlist'), 'index' => 'days_in_wishlist', 'type' => 'number', 'width' => '140px', )); return parent::_prepareColumns(); } /** * Get headers visibility * * @return bool */ public function getHeadersVisibility() { return ($this->getCollection()->getSize() > 0); } /** * Get row url * * @param Mage_Wishlist_Model_Item $row * @return string */ public function getRowUrl($row) { return $this->getUrl('*/catalog_product/edit', array('id' => $row->getProductId())); } }
{ "pile_set_name": "Github" }
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "p\u00fchap\u00e4ev", "esmasp\u00e4ev", "teisip\u00e4ev", "kolmap\u00e4ev", "neljap\u00e4ev", "reede", "laup\u00e4ev" ], "ERANAMES": [ "enne meie aega", "meie aja j\u00e4rgi" ], "ERAS": [ "e.m.a.", "m.a.j." ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "jaanuar", "veebruar", "m\u00e4rts", "aprill", "mai", "juuni", "juuli", "august", "september", "oktoober", "november", "detsember" ], "SHORTDAY": [ "P", "E", "T", "K", "N", "R", "L" ], "SHORTMONTH": [ "jaan", "veebr", "m\u00e4rts", "apr", "mai", "juuni", "juuli", "aug", "sept", "okt", "nov", "dets" ], "STANDALONEMONTH": [ "jaanuar", "veebruar", "m\u00e4rts", "aprill", "mai", "juuni", "juuli", "august", "september", "oktoober", "november", "detsember" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "EEEE, d. MMMM y", "longDate": "d. MMMM y", "medium": "d. MMM y H:mm.ss", "mediumDate": "d. MMM y", "mediumTime": "H:mm.ss", "short": "dd.MM.yy H:mm", "shortDate": "dd.MM.yy", "shortTime": "H:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20ac", "DECIMAL_SEP": ",", "GROUP_SEP": "\u00a0", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "et", "localeID": "et", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
{ "pile_set_name": "Github" }
/* * sd.c Copyright (C) 1992 Drew Eckhardt * Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale * * Linux scsi disk driver * Initial versions: Drew Eckhardt * Subsequent revisions: Eric Youngdale * Modification history: * - Drew Eckhardt <[email protected]> original * - Eric Youngdale <[email protected]> add scatter-gather, multiple * outstanding request, and other enhancements. * Support loadable low-level scsi drivers. * - Jirka Hanika <[email protected]> support more scsi disks using * eight major numbers. * - Richard Gooch <[email protected]> support devfs. * - Torben Mathiasen <[email protected]> Resource allocation fixes in * sd_init and cleanups. * - Alex Davis <[email protected]> Fix problem where partition info * not being read in sd_open. Fix problem where removable media * could be ejected after sd_open. * - Douglas Gilbert <[email protected]> cleanup for lk 2.5.x * - Badari Pulavarty <[email protected]>, Matthew Wilcox * <[email protected]>, Kurt Garloff <[email protected]>: * Support 32k/1M disks. * * Logging policy (needs CONFIG_SCSI_LOGGING defined): * - setting up transfer: SCSI_LOG_HLQUEUE levels 1 and 2 * - end of transfer (bh + scsi_lib): SCSI_LOG_HLCOMPLETE level 1 * - entering sd_ioctl: SCSI_LOG_IOCTL level 1 * - entering other commands: SCSI_LOG_HLQUEUE level 3 * Note: when the logging level is set by the user, it must be greater * than the level indicated above to trigger output. */ #include <linux/module.h> #include <linux/fs.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/bio.h> #include <linux/genhd.h> #include <linux/hdreg.h> #include <linux/errno.h> #include <linux/idr.h> #include <linux/interrupt.h> #include <linux/init.h> #include <linux/blkdev.h> #include <linux/blkpg.h> #include <linux/delay.h> #include <linux/mutex.h> #include <linux/string_helpers.h> #include <linux/async.h> #include <asm/uaccess.h> #include <asm/unaligned.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_dbg.h> #include <scsi/scsi_device.h> #include <scsi/scsi_driver.h> #include <scsi/scsi_eh.h> #include <scsi/scsi_host.h> #include <scsi/scsi_ioctl.h> #include <scsi/scsicam.h> #include "sd.h" #include "scsi_logging.h" MODULE_AUTHOR("Eric Youngdale"); MODULE_DESCRIPTION("SCSI disk (sd) driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK0_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK1_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK2_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK3_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK4_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK5_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK6_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK7_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK8_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK9_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK10_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK11_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK12_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK13_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK14_MAJOR); MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_DISK15_MAJOR); MODULE_ALIAS_SCSI_DEVICE(TYPE_DISK); MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD); MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC); #if !defined(CONFIG_DEBUG_BLOCK_EXT_DEVT) #define SD_MINORS 16 #else #define SD_MINORS 0 #endif static int sd_revalidate_disk(struct gendisk *); static int sd_probe(struct device *); static int sd_remove(struct device *); static void sd_shutdown(struct device *); static int sd_suspend(struct device *, pm_message_t state); static int sd_resume(struct device *); static void sd_rescan(struct device *); static int sd_done(struct scsi_cmnd *); static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer); static void scsi_disk_release(struct device *cdev); static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *); static void sd_print_result(struct scsi_disk *, int); static DEFINE_SPINLOCK(sd_index_lock); static DEFINE_IDA(sd_index_ida); /* This semaphore is used to mediate the 0->1 reference get in the * face of object destruction (i.e. we can't allow a get on an * object after last put) */ static DEFINE_MUTEX(sd_ref_mutex); struct kmem_cache *sd_cdb_cache; mempool_t *sd_cdb_pool; static const char *sd_cache_types[] = { "write through", "none", "write back", "write back, no read (daft)" }; static ssize_t sd_store_cache_type(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int i, ct = -1, rcd, wce, sp; struct scsi_disk *sdkp = to_scsi_disk(dev); struct scsi_device *sdp = sdkp->device; char buffer[64]; char *buffer_data; struct scsi_mode_data data; struct scsi_sense_hdr sshdr; int len; if (sdp->type != TYPE_DISK) /* no cache control on RBC devices; theoretically they * can do it, but there's probably so many exceptions * it's not worth the risk */ return -EINVAL; for (i = 0; i < ARRAY_SIZE(sd_cache_types); i++) { const int len = strlen(sd_cache_types[i]); if (strncmp(sd_cache_types[i], buf, len) == 0 && buf[len] == '\n') { ct = i; break; } } if (ct < 0) return -EINVAL; rcd = ct & 0x01 ? 1 : 0; wce = ct & 0x02 ? 1 : 0; if (scsi_mode_sense(sdp, 0x08, 8, buffer, sizeof(buffer), SD_TIMEOUT, SD_MAX_RETRIES, &data, NULL)) return -EINVAL; len = min_t(size_t, sizeof(buffer), data.length - data.header_length - data.block_descriptor_length); buffer_data = buffer + data.header_length + data.block_descriptor_length; buffer_data[2] &= ~0x05; buffer_data[2] |= wce << 2 | rcd; sp = buffer_data[0] & 0x80 ? 1 : 0; if (scsi_mode_select(sdp, 1, sp, 8, buffer_data, len, SD_TIMEOUT, SD_MAX_RETRIES, &data, &sshdr)) { if (scsi_sense_valid(&sshdr)) sd_print_sense_hdr(sdkp, &sshdr); return -EINVAL; } revalidate_disk(sdkp->disk); return count; } static ssize_t sd_store_manage_start_stop(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct scsi_disk *sdkp = to_scsi_disk(dev); struct scsi_device *sdp = sdkp->device; if (!capable(CAP_SYS_ADMIN)) return -EACCES; sdp->manage_start_stop = simple_strtoul(buf, NULL, 10); return count; } static ssize_t sd_store_allow_restart(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct scsi_disk *sdkp = to_scsi_disk(dev); struct scsi_device *sdp = sdkp->device; if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (sdp->type != TYPE_DISK) return -EINVAL; sdp->allow_restart = simple_strtoul(buf, NULL, 10); return count; } static ssize_t sd_show_cache_type(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_disk *sdkp = to_scsi_disk(dev); int ct = sdkp->RCD + 2*sdkp->WCE; return snprintf(buf, 40, "%s\n", sd_cache_types[ct]); } static ssize_t sd_show_fua(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_disk *sdkp = to_scsi_disk(dev); return snprintf(buf, 20, "%u\n", sdkp->DPOFUA); } static ssize_t sd_show_manage_start_stop(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_disk *sdkp = to_scsi_disk(dev); struct scsi_device *sdp = sdkp->device; return snprintf(buf, 20, "%u\n", sdp->manage_start_stop); } static ssize_t sd_show_allow_restart(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_disk *sdkp = to_scsi_disk(dev); return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart); } static ssize_t sd_show_protection_type(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_disk *sdkp = to_scsi_disk(dev); return snprintf(buf, 20, "%u\n", sdkp->protection_type); } static ssize_t sd_show_app_tag_own(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_disk *sdkp = to_scsi_disk(dev); return snprintf(buf, 20, "%u\n", sdkp->ATO); } static ssize_t sd_show_thin_provisioning(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_disk *sdkp = to_scsi_disk(dev); return snprintf(buf, 20, "%u\n", sdkp->thin_provisioning); } static struct device_attribute sd_disk_attrs[] = { __ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type, sd_store_cache_type), __ATTR(FUA, S_IRUGO, sd_show_fua, NULL), __ATTR(allow_restart, S_IRUGO|S_IWUSR, sd_show_allow_restart, sd_store_allow_restart), __ATTR(manage_start_stop, S_IRUGO|S_IWUSR, sd_show_manage_start_stop, sd_store_manage_start_stop), __ATTR(protection_type, S_IRUGO, sd_show_protection_type, NULL), __ATTR(app_tag_own, S_IRUGO, sd_show_app_tag_own, NULL), __ATTR(thin_provisioning, S_IRUGO, sd_show_thin_provisioning, NULL), __ATTR_NULL, }; static struct class sd_disk_class = { .name = "scsi_disk", .owner = THIS_MODULE, .dev_release = scsi_disk_release, .dev_attrs = sd_disk_attrs, }; static struct scsi_driver sd_template = { .owner = THIS_MODULE, .gendrv = { .name = "sd", .probe = sd_probe, .remove = sd_remove, .suspend = sd_suspend, .resume = sd_resume, .shutdown = sd_shutdown, }, .rescan = sd_rescan, .done = sd_done, }; /* * Device no to disk mapping: * * major disc2 disc p1 * |............|.............|....|....| <- dev_t * 31 20 19 8 7 4 3 0 * * Inside a major, we have 16k disks, however mapped non- * contiguously. The first 16 disks are for major0, the next * ones with major1, ... Disk 256 is for major0 again, disk 272 * for major1, ... * As we stay compatible with our numbering scheme, we can reuse * the well-know SCSI majors 8, 65--71, 136--143. */ static int sd_major(int major_idx) { switch (major_idx) { case 0: return SCSI_DISK0_MAJOR; case 1 ... 7: return SCSI_DISK1_MAJOR + major_idx - 1; case 8 ... 15: return SCSI_DISK8_MAJOR + major_idx - 8; default: BUG(); return 0; /* shut up gcc */ } } static struct scsi_disk *__scsi_disk_get(struct gendisk *disk) { struct scsi_disk *sdkp = NULL; if (disk->private_data) { sdkp = scsi_disk(disk); if (scsi_device_get(sdkp->device) == 0) get_device(&sdkp->dev); else sdkp = NULL; } return sdkp; } static struct scsi_disk *scsi_disk_get(struct gendisk *disk) { struct scsi_disk *sdkp; mutex_lock(&sd_ref_mutex); sdkp = __scsi_disk_get(disk); mutex_unlock(&sd_ref_mutex); return sdkp; } static struct scsi_disk *scsi_disk_get_from_dev(struct device *dev) { struct scsi_disk *sdkp; mutex_lock(&sd_ref_mutex); sdkp = dev_get_drvdata(dev); if (sdkp) sdkp = __scsi_disk_get(sdkp->disk); mutex_unlock(&sd_ref_mutex); return sdkp; } static void scsi_disk_put(struct scsi_disk *sdkp) { struct scsi_device *sdev = sdkp->device; mutex_lock(&sd_ref_mutex); put_device(&sdkp->dev); scsi_device_put(sdev); mutex_unlock(&sd_ref_mutex); } static void sd_prot_op(struct scsi_cmnd *scmd, unsigned int dif) { unsigned int prot_op = SCSI_PROT_NORMAL; unsigned int dix = scsi_prot_sg_count(scmd); if (scmd->sc_data_direction == DMA_FROM_DEVICE) { if (dif && dix) prot_op = SCSI_PROT_READ_PASS; else if (dif && !dix) prot_op = SCSI_PROT_READ_STRIP; else if (!dif && dix) prot_op = SCSI_PROT_READ_INSERT; } else { if (dif && dix) prot_op = SCSI_PROT_WRITE_PASS; else if (dif && !dix) prot_op = SCSI_PROT_WRITE_INSERT; else if (!dif && dix) prot_op = SCSI_PROT_WRITE_STRIP; } scsi_set_prot_op(scmd, prot_op); scsi_set_prot_type(scmd, dif); } /** * sd_prepare_discard - unmap blocks on thinly provisioned device * @rq: Request to prepare * * Will issue either UNMAP or WRITE SAME(16) depending on preference * indicated by target device. **/ static int sd_prepare_discard(struct request *rq) { struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); struct bio *bio = rq->bio; sector_t sector = bio->bi_sector; unsigned int num = bio_sectors(bio); if (sdkp->device->sector_size == 4096) { sector >>= 3; num >>= 3; } rq->cmd_type = REQ_TYPE_BLOCK_PC; rq->timeout = SD_TIMEOUT; memset(rq->cmd, 0, rq->cmd_len); if (sdkp->unmap) { char *buf = kmap_atomic(bio_page(bio), KM_USER0); rq->cmd[0] = UNMAP; rq->cmd[8] = 24; rq->cmd_len = 10; /* Ensure that data length matches payload */ rq->__data_len = bio->bi_size = bio->bi_io_vec->bv_len = 24; put_unaligned_be16(6 + 16, &buf[0]); put_unaligned_be16(16, &buf[2]); put_unaligned_be64(sector, &buf[8]); put_unaligned_be32(num, &buf[16]); kunmap_atomic(buf, KM_USER0); } else { rq->cmd[0] = WRITE_SAME_16; rq->cmd[1] = 0x8; /* UNMAP */ put_unaligned_be64(sector, &rq->cmd[2]); put_unaligned_be32(num, &rq->cmd[10]); rq->cmd_len = 16; } return BLKPREP_OK; } /** * sd_init_command - build a scsi (read or write) command from * information in the request structure. * @SCpnt: pointer to mid-level's per scsi command structure that * contains request and into which the scsi command is written * * Returns 1 if successful and 0 if error (or cannot be done now). **/ static int sd_prep_fn(struct request_queue *q, struct request *rq) { struct scsi_cmnd *SCpnt; struct scsi_device *sdp = q->queuedata; struct gendisk *disk = rq->rq_disk; struct scsi_disk *sdkp; sector_t block = blk_rq_pos(rq); sector_t threshold; unsigned int this_count = blk_rq_sectors(rq); int ret, host_dif; unsigned char protect; /* * Discard request come in as REQ_TYPE_FS but we turn them into * block PC requests to make life easier. */ if (blk_discard_rq(rq)) ret = sd_prepare_discard(rq); if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { ret = scsi_setup_blk_pc_cmnd(sdp, rq); goto out; } else if (rq->cmd_type != REQ_TYPE_FS) { ret = BLKPREP_KILL; goto out; } ret = scsi_setup_fs_cmnd(sdp, rq); if (ret != BLKPREP_OK) goto out; SCpnt = rq->special; sdkp = scsi_disk(disk); /* from here on until we're complete, any goto out * is used for a killable error condition */ ret = BLKPREP_KILL; SCSI_LOG_HLQUEUE(1, scmd_printk(KERN_INFO, SCpnt, "sd_init_command: block=%llu, " "count=%d\n", (unsigned long long)block, this_count)); if (!sdp || !scsi_device_online(sdp) || block + blk_rq_sectors(rq) > get_capacity(disk)) { SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, "Finishing %u sectors\n", blk_rq_sectors(rq))); SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, "Retry with 0x%p\n", SCpnt)); goto out; } if (sdp->changed) { /* * quietly refuse to do anything to a changed disc until * the changed bit has been reset */ /* printk("SCSI disk has been changed. Prohibiting further I/O.\n"); */ goto out; } /* * Some SD card readers can't handle multi-sector accesses which touch * the last one or two hardware sectors. Split accesses as needed. */ threshold = get_capacity(disk) - SD_LAST_BUGGY_SECTORS * (sdp->sector_size / 512); if (unlikely(sdp->last_sector_bug && block + this_count > threshold)) { if (block < threshold) { /* Access up to the threshold but not beyond */ this_count = threshold - block; } else { /* Access only a single hardware sector */ this_count = sdp->sector_size / 512; } } SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, "block=%llu\n", (unsigned long long)block)); /* * If we have a 1K hardware sectorsize, prevent access to single * 512 byte sectors. In theory we could handle this - in fact * the scsi cdrom driver must be able to handle this because * we typically use 1K blocksizes, and cdroms typically have * 2K hardware sectorsizes. Of course, things are simpler * with the cdrom, since it is read-only. For performance * reasons, the filesystems should be able to handle this * and not force the scsi disk driver to use bounce buffers * for this. */ if (sdp->sector_size == 1024) { if ((block & 1) || (blk_rq_sectors(rq) & 1)) { scmd_printk(KERN_ERR, SCpnt, "Bad block number requested\n"); goto out; } else { block = block >> 1; this_count = this_count >> 1; } } if (sdp->sector_size == 2048) { if ((block & 3) || (blk_rq_sectors(rq) & 3)) { scmd_printk(KERN_ERR, SCpnt, "Bad block number requested\n"); goto out; } else { block = block >> 2; this_count = this_count >> 2; } } if (sdp->sector_size == 4096) { if ((block & 7) || (blk_rq_sectors(rq) & 7)) { scmd_printk(KERN_ERR, SCpnt, "Bad block number requested\n"); goto out; } else { block = block >> 3; this_count = this_count >> 3; } } if (rq_data_dir(rq) == WRITE) { if (!sdp->writeable) { goto out; } SCpnt->cmnd[0] = WRITE_6; SCpnt->sc_data_direction = DMA_TO_DEVICE; if (blk_integrity_rq(rq) && sd_dif_prepare(rq, block, sdp->sector_size) == -EIO) goto out; } else if (rq_data_dir(rq) == READ) { SCpnt->cmnd[0] = READ_6; SCpnt->sc_data_direction = DMA_FROM_DEVICE; } else { scmd_printk(KERN_ERR, SCpnt, "Unknown command %x\n", rq->cmd_flags); goto out; } SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, "%s %d/%u 512 byte blocks.\n", (rq_data_dir(rq) == WRITE) ? "writing" : "reading", this_count, blk_rq_sectors(rq))); /* Set RDPROTECT/WRPROTECT if disk is formatted with DIF */ host_dif = scsi_host_dif_capable(sdp->host, sdkp->protection_type); if (host_dif) protect = 1 << 5; else protect = 0; if (host_dif == SD_DIF_TYPE2_PROTECTION) { SCpnt->cmnd = mempool_alloc(sd_cdb_pool, GFP_ATOMIC); if (unlikely(SCpnt->cmnd == NULL)) { ret = BLKPREP_DEFER; goto out; } SCpnt->cmd_len = SD_EXT_CDB_SIZE; memset(SCpnt->cmnd, 0, SCpnt->cmd_len); SCpnt->cmnd[0] = VARIABLE_LENGTH_CMD; SCpnt->cmnd[7] = 0x18; SCpnt->cmnd[9] = (rq_data_dir(rq) == READ) ? READ_32 : WRITE_32; SCpnt->cmnd[10] = protect | (blk_fua_rq(rq) ? 0x8 : 0); /* LBA */ SCpnt->cmnd[12] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; SCpnt->cmnd[13] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; SCpnt->cmnd[14] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; SCpnt->cmnd[15] = sizeof(block) > 4 ? (unsigned char) (block >> 32) & 0xff : 0; SCpnt->cmnd[16] = (unsigned char) (block >> 24) & 0xff; SCpnt->cmnd[17] = (unsigned char) (block >> 16) & 0xff; SCpnt->cmnd[18] = (unsigned char) (block >> 8) & 0xff; SCpnt->cmnd[19] = (unsigned char) block & 0xff; /* Expected Indirect LBA */ SCpnt->cmnd[20] = (unsigned char) (block >> 24) & 0xff; SCpnt->cmnd[21] = (unsigned char) (block >> 16) & 0xff; SCpnt->cmnd[22] = (unsigned char) (block >> 8) & 0xff; SCpnt->cmnd[23] = (unsigned char) block & 0xff; /* Transfer length */ SCpnt->cmnd[28] = (unsigned char) (this_count >> 24) & 0xff; SCpnt->cmnd[29] = (unsigned char) (this_count >> 16) & 0xff; SCpnt->cmnd[30] = (unsigned char) (this_count >> 8) & 0xff; SCpnt->cmnd[31] = (unsigned char) this_count & 0xff; } else if (block > 0xffffffff) { SCpnt->cmnd[0] += READ_16 - READ_6; SCpnt->cmnd[1] = protect | (blk_fua_rq(rq) ? 0x8 : 0); SCpnt->cmnd[2] = sizeof(block) > 4 ? (unsigned char) (block >> 56) & 0xff : 0; SCpnt->cmnd[3] = sizeof(block) > 4 ? (unsigned char) (block >> 48) & 0xff : 0; SCpnt->cmnd[4] = sizeof(block) > 4 ? (unsigned char) (block >> 40) & 0xff : 0; SCpnt->cmnd[5] = sizeof(block) > 4 ? (unsigned char) (block >> 32) & 0xff : 0; SCpnt->cmnd[6] = (unsigned char) (block >> 24) & 0xff; SCpnt->cmnd[7] = (unsigned char) (block >> 16) & 0xff; SCpnt->cmnd[8] = (unsigned char) (block >> 8) & 0xff; SCpnt->cmnd[9] = (unsigned char) block & 0xff; SCpnt->cmnd[10] = (unsigned char) (this_count >> 24) & 0xff; SCpnt->cmnd[11] = (unsigned char) (this_count >> 16) & 0xff; SCpnt->cmnd[12] = (unsigned char) (this_count >> 8) & 0xff; SCpnt->cmnd[13] = (unsigned char) this_count & 0xff; SCpnt->cmnd[14] = SCpnt->cmnd[15] = 0; } else if ((this_count > 0xff) || (block > 0x1fffff) || scsi_device_protection(SCpnt->device) || SCpnt->device->use_10_for_rw) { if (this_count > 0xffff) this_count = 0xffff; SCpnt->cmnd[0] += READ_10 - READ_6; SCpnt->cmnd[1] = protect | (blk_fua_rq(rq) ? 0x8 : 0); SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; SCpnt->cmnd[3] = (unsigned char) (block >> 16) & 0xff; SCpnt->cmnd[4] = (unsigned char) (block >> 8) & 0xff; SCpnt->cmnd[5] = (unsigned char) block & 0xff; SCpnt->cmnd[6] = SCpnt->cmnd[9] = 0; SCpnt->cmnd[7] = (unsigned char) (this_count >> 8) & 0xff; SCpnt->cmnd[8] = (unsigned char) this_count & 0xff; } else { if (unlikely(blk_fua_rq(rq))) { /* * This happens only if this drive failed * 10byte rw command with ILLEGAL_REQUEST * during operation and thus turned off * use_10_for_rw. */ scmd_printk(KERN_ERR, SCpnt, "FUA write on READ/WRITE(6) drive\n"); goto out; } SCpnt->cmnd[1] |= (unsigned char) ((block >> 16) & 0x1f); SCpnt->cmnd[2] = (unsigned char) ((block >> 8) & 0xff); SCpnt->cmnd[3] = (unsigned char) block & 0xff; SCpnt->cmnd[4] = (unsigned char) this_count; SCpnt->cmnd[5] = 0; } SCpnt->sdb.length = this_count * sdp->sector_size; /* If DIF or DIX is enabled, tell HBA how to handle request */ if (host_dif || scsi_prot_sg_count(SCpnt)) sd_prot_op(SCpnt, host_dif); /* * We shouldn't disconnect in the middle of a sector, so with a dumb * host adapter, it's safe to assume that we can at least transfer * this many bytes between each connect / disconnect. */ SCpnt->transfersize = sdp->sector_size; SCpnt->underflow = this_count << 9; SCpnt->allowed = SD_MAX_RETRIES; /* * This indicates that the command is ready from our end to be * queued. */ ret = BLKPREP_OK; out: return scsi_prep_return(q, rq, ret); } /** * sd_open - open a scsi disk device * @inode: only i_rdev member may be used * @filp: only f_mode and f_flags may be used * * Returns 0 if successful. Returns a negated errno value in case * of error. * * Note: This can be called from a user context (e.g. fsck(1) ) * or from within the kernel (e.g. as a result of a mount(1) ). * In the latter case @inode and @filp carry an abridged amount * of information as noted above. **/ static int sd_open(struct block_device *bdev, fmode_t mode) { struct scsi_disk *sdkp = scsi_disk_get(bdev->bd_disk); struct scsi_device *sdev; int retval; if (!sdkp) return -ENXIO; SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_open\n")); sdev = sdkp->device; /* * If the device is in error recovery, wait until it is done. * If the device is offline, then disallow any access to it. */ retval = -ENXIO; if (!scsi_block_when_processing_errors(sdev)) goto error_out; if (sdev->removable || sdkp->write_prot) check_disk_change(bdev); /* * If the drive is empty, just let the open fail. */ retval = -ENOMEDIUM; if (sdev->removable && !sdkp->media_present && !(mode & FMODE_NDELAY)) goto error_out; /* * If the device has the write protect tab set, have the open fail * if the user expects to be able to write to the thing. */ retval = -EROFS; if (sdkp->write_prot && (mode & FMODE_WRITE)) goto error_out; /* * It is possible that the disk changing stuff resulted in * the device being taken offline. If this is the case, * report this to the user, and don't pretend that the * open actually succeeded. */ retval = -ENXIO; if (!scsi_device_online(sdev)) goto error_out; if (!sdkp->openers++ && sdev->removable) { if (scsi_block_when_processing_errors(sdev)) scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT); } return 0; error_out: scsi_disk_put(sdkp); return retval; } /** * sd_release - invoked when the (last) close(2) is called on this * scsi disk. * @inode: only i_rdev member may be used * @filp: only f_mode and f_flags may be used * * Returns 0. * * Note: may block (uninterruptible) if error recovery is underway * on this disk. **/ static int sd_release(struct gendisk *disk, fmode_t mode) { struct scsi_disk *sdkp = scsi_disk(disk); struct scsi_device *sdev = sdkp->device; SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n")); if (!--sdkp->openers && sdev->removable) { if (scsi_block_when_processing_errors(sdev)) scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW); } /* * XXX and what if there are packets in flight and this close() * XXX is followed by a "rmmod sd_mod"? */ scsi_disk_put(sdkp); return 0; } static int sd_getgeo(struct block_device *bdev, struct hd_geometry *geo) { struct scsi_disk *sdkp = scsi_disk(bdev->bd_disk); struct scsi_device *sdp = sdkp->device; struct Scsi_Host *host = sdp->host; int diskinfo[4]; /* default to most commonly used values */ diskinfo[0] = 0x40; /* 1 << 6 */ diskinfo[1] = 0x20; /* 1 << 5 */ diskinfo[2] = sdkp->capacity >> 11; /* override with calculated, extended default, or driver values */ if (host->hostt->bios_param) host->hostt->bios_param(sdp, bdev, sdkp->capacity, diskinfo); else scsicam_bios_param(bdev, sdkp->capacity, diskinfo); geo->heads = diskinfo[0]; geo->sectors = diskinfo[1]; geo->cylinders = diskinfo[2]; return 0; } /** * sd_ioctl - process an ioctl * @inode: only i_rdev/i_bdev members may be used * @filp: only f_mode and f_flags may be used * @cmd: ioctl command number * @arg: this is third argument given to ioctl(2) system call. * Often contains a pointer. * * Returns 0 if successful (some ioctls return postive numbers on * success as well). Returns a negated errno value in case of error. * * Note: most ioctls are forward onto the block subsystem or further * down in the scsi subsystem. **/ static int sd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { struct gendisk *disk = bdev->bd_disk; struct scsi_device *sdp = scsi_disk(disk)->device; void __user *p = (void __user *)arg; int error; SCSI_LOG_IOCTL(1, printk("sd_ioctl: disk=%s, cmd=0x%x\n", disk->disk_name, cmd)); /* * If we are in the middle of error recovery, don't let anyone * else try and use this device. Also, if error recovery fails, it * may try and take the device offline, in which case all further * access to the device is prohibited. */ error = scsi_nonblockable_ioctl(sdp, cmd, p, (mode & FMODE_NDELAY) != 0); if (!scsi_block_when_processing_errors(sdp) || !error) return error; /* * Send SCSI addressing ioctls directly to mid level, send other * ioctls to block level and then onto mid level if they can't be * resolved. */ switch (cmd) { case SCSI_IOCTL_GET_IDLUN: case SCSI_IOCTL_GET_BUS_NUMBER: return scsi_ioctl(sdp, cmd, p); default: error = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, p); if (error != -ENOTTY) return error; } return scsi_ioctl(sdp, cmd, p); } static void set_media_not_present(struct scsi_disk *sdkp) { sdkp->media_present = 0; sdkp->capacity = 0; sdkp->device->changed = 1; } /** * sd_media_changed - check if our medium changed * @disk: kernel device descriptor * * Returns 0 if not applicable or no change; 1 if change * * Note: this function is invoked from the block subsystem. **/ static int sd_media_changed(struct gendisk *disk) { struct scsi_disk *sdkp = scsi_disk(disk); struct scsi_device *sdp = sdkp->device; struct scsi_sense_hdr *sshdr = NULL; int retval; SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_media_changed\n")); if (!sdp->removable) return 0; /* * If the device is offline, don't send any commands - just pretend as * if the command failed. If the device ever comes back online, we * can deal with it then. It is only because of unrecoverable errors * that we would ever take a device offline in the first place. */ if (!scsi_device_online(sdp)) { set_media_not_present(sdkp); retval = 1; goto out; } /* * Using TEST_UNIT_READY enables differentiation between drive with * no cartridge loaded - NOT READY, drive with changed cartridge - * UNIT ATTENTION, or with same cartridge - GOOD STATUS. * * Drives that auto spin down. eg iomega jaz 1G, will be started * by sd_spinup_disk() from sd_revalidate_disk(), which happens whenever * sd_revalidate() is called. */ retval = -ENODEV; if (scsi_block_when_processing_errors(sdp)) { sshdr = kzalloc(sizeof(*sshdr), GFP_KERNEL); retval = scsi_test_unit_ready(sdp, SD_TIMEOUT, SD_MAX_RETRIES, sshdr); } /* * Unable to test, unit probably not ready. This usually * means there is no disc in the drive. Mark as changed, * and we will figure it out later once the drive is * available again. */ if (retval || (scsi_sense_valid(sshdr) && /* 0x3a is medium not present */ sshdr->asc == 0x3a)) { set_media_not_present(sdkp); retval = 1; goto out; } /* * For removable scsi disk we have to recognise the presence * of a disk in the drive. This is kept in the struct scsi_disk * struct and tested at open ! Daniel Roche ([email protected]) */ sdkp->media_present = 1; retval = sdp->changed; sdp->changed = 0; out: if (retval != sdkp->previous_state) sdev_evt_send_simple(sdp, SDEV_EVT_MEDIA_CHANGE, GFP_KERNEL); sdkp->previous_state = retval; kfree(sshdr); return retval; } static int sd_sync_cache(struct scsi_disk *sdkp) { int retries, res; struct scsi_device *sdp = sdkp->device; struct scsi_sense_hdr sshdr; if (!scsi_device_online(sdp)) return -ENODEV; for (retries = 3; retries > 0; --retries) { unsigned char cmd[10] = { 0 }; cmd[0] = SYNCHRONIZE_CACHE; /* * Leave the rest of the command zero to indicate * flush everything. */ res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr, SD_TIMEOUT, SD_MAX_RETRIES, NULL); if (res == 0) break; } if (res) { sd_print_result(sdkp, res); if (driver_byte(res) & DRIVER_SENSE) sd_print_sense_hdr(sdkp, &sshdr); } if (res) return -EIO; return 0; } static void sd_prepare_flush(struct request_queue *q, struct request *rq) { rq->cmd_type = REQ_TYPE_BLOCK_PC; rq->timeout = SD_TIMEOUT; rq->cmd[0] = SYNCHRONIZE_CACHE; rq->cmd_len = 10; } static void sd_rescan(struct device *dev) { struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); if (sdkp) { revalidate_disk(sdkp->disk); scsi_disk_put(sdkp); } } #ifdef CONFIG_COMPAT /* * This gets directly called from VFS. When the ioctl * is not recognized we go back to the other translation paths. */ static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device; /* * If we are in the middle of error recovery, don't let anyone * else try and use this device. Also, if error recovery fails, it * may try and take the device offline, in which case all further * access to the device is prohibited. */ if (!scsi_block_when_processing_errors(sdev)) return -ENODEV; if (sdev->host->hostt->compat_ioctl) { int ret; ret = sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg); return ret; } /* * Let the static ioctl translation table take care of it. */ return -ENOIOCTLCMD; } #endif static const struct block_device_operations sd_fops = { .owner = THIS_MODULE, .open = sd_open, .release = sd_release, .locked_ioctl = sd_ioctl, .getgeo = sd_getgeo, #ifdef CONFIG_COMPAT .compat_ioctl = sd_compat_ioctl, #endif .media_changed = sd_media_changed, .revalidate_disk = sd_revalidate_disk, }; static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) { u64 start_lba = blk_rq_pos(scmd->request); u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); u64 bad_lba; int info_valid; if (!blk_fs_request(scmd->request)) return 0; info_valid = scsi_get_sense_info_fld(scmd->sense_buffer, SCSI_SENSE_BUFFERSIZE, &bad_lba); if (!info_valid) return 0; if (scsi_bufflen(scmd) <= scmd->device->sector_size) return 0; if (scmd->device->sector_size < 512) { /* only legitimate sector_size here is 256 */ start_lba <<= 1; end_lba <<= 1; } else { /* be careful ... don't want any overflows */ u64 factor = scmd->device->sector_size / 512; do_div(start_lba, factor); do_div(end_lba, factor); } /* The bad lba was reported incorrectly, we have no idea where * the error is. */ if (bad_lba < start_lba || bad_lba >= end_lba) return 0; /* This computation should always be done in terms of * the resolution of the device's medium. */ return (bad_lba - start_lba) * scmd->device->sector_size; } /** * sd_done - bottom half handler: called when the lower level * driver has completed (successfully or otherwise) a scsi command. * @SCpnt: mid-level's per command structure. * * Note: potentially run from within an ISR. Must not block. **/ static int sd_done(struct scsi_cmnd *SCpnt) { int result = SCpnt->result; unsigned int good_bytes = result ? 0 : scsi_bufflen(SCpnt); struct scsi_sense_hdr sshdr; struct scsi_disk *sdkp = scsi_disk(SCpnt->request->rq_disk); int sense_valid = 0; int sense_deferred = 0; if (result) { sense_valid = scsi_command_normalize_sense(SCpnt, &sshdr); if (sense_valid) sense_deferred = scsi_sense_is_deferred(&sshdr); } #ifdef CONFIG_SCSI_LOGGING SCSI_LOG_HLCOMPLETE(1, scsi_print_result(SCpnt)); if (sense_valid) { SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt, "sd_done: sb[respc,sk,asc," "ascq]=%x,%x,%x,%x\n", sshdr.response_code, sshdr.sense_key, sshdr.asc, sshdr.ascq)); } #endif if (driver_byte(result) != DRIVER_SENSE && (!sense_valid || sense_deferred)) goto out; switch (sshdr.sense_key) { case HARDWARE_ERROR: case MEDIUM_ERROR: good_bytes = sd_completed_bytes(SCpnt); break; case RECOVERED_ERROR: good_bytes = scsi_bufflen(SCpnt); break; case NO_SENSE: /* This indicates a false check condition, so ignore it. An * unknown amount of data was transferred so treat it as an * error. */ scsi_print_sense("sd", SCpnt); SCpnt->result = 0; memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); break; case ABORTED_COMMAND: if (sshdr.asc == 0x10) { /* DIF: Disk detected corruption */ scsi_print_result(SCpnt); scsi_print_sense("sd", SCpnt); good_bytes = sd_completed_bytes(SCpnt); } break; case ILLEGAL_REQUEST: if (sshdr.asc == 0x10) { /* DIX: HBA detected corruption */ scsi_print_result(SCpnt); scsi_print_sense("sd", SCpnt); good_bytes = sd_completed_bytes(SCpnt); } break; default: break; } out: if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt)) sd_dif_complete(SCpnt, good_bytes); if (scsi_host_dif_capable(sdkp->device->host, sdkp->protection_type) == SD_DIF_TYPE2_PROTECTION && SCpnt->cmnd != SCpnt->request->cmd) mempool_free(SCpnt->cmnd, sd_cdb_pool); return good_bytes; } static int media_not_present(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) { if (!scsi_sense_valid(sshdr)) return 0; /* not invoked for commands that could return deferred errors */ if (sshdr->sense_key != NOT_READY && sshdr->sense_key != UNIT_ATTENTION) return 0; if (sshdr->asc != 0x3A) /* medium not present */ return 0; set_media_not_present(sdkp); return 1; } /* * spinup disk - called only in sd_revalidate_disk() */ static void sd_spinup_disk(struct scsi_disk *sdkp) { unsigned char cmd[10]; unsigned long spintime_expire = 0; int retries, spintime; unsigned int the_result; struct scsi_sense_hdr sshdr; int sense_valid = 0; spintime = 0; /* Spin up drives, as required. Only do this at boot time */ /* Spinup needs to be done for module loads too. */ do { retries = 0; do { cmd[0] = TEST_UNIT_READY; memset((void *) &cmd[1], 0, 9); the_result = scsi_execute_req(sdkp->device, cmd, DMA_NONE, NULL, 0, &sshdr, SD_TIMEOUT, SD_MAX_RETRIES, NULL); /* * If the drive has indicated to us that it * doesn't have any media in it, don't bother * with any more polling. */ if (media_not_present(sdkp, &sshdr)) return; if (the_result) sense_valid = scsi_sense_valid(&sshdr); retries++; } while (retries < 3 && (!scsi_status_is_good(the_result) || ((driver_byte(the_result) & DRIVER_SENSE) && sense_valid && sshdr.sense_key == UNIT_ATTENTION))); if ((driver_byte(the_result) & DRIVER_SENSE) == 0) { /* no sense, TUR either succeeded or failed * with a status error */ if(!spintime && !scsi_status_is_good(the_result)) { sd_printk(KERN_NOTICE, sdkp, "Unit Not Ready\n"); sd_print_result(sdkp, the_result); } break; } /* * The device does not want the automatic start to be issued. */ if (sdkp->device->no_start_on_add) break; if (sense_valid && sshdr.sense_key == NOT_READY) { if (sshdr.asc == 4 && sshdr.ascq == 3) break; /* manual intervention required */ if (sshdr.asc == 4 && sshdr.ascq == 0xb) break; /* standby */ if (sshdr.asc == 4 && sshdr.ascq == 0xc) break; /* unavailable */ /* * Issue command to spin up drive when not ready */ if (!spintime) { sd_printk(KERN_NOTICE, sdkp, "Spinning up disk..."); cmd[0] = START_STOP; cmd[1] = 1; /* Return immediately */ memset((void *) &cmd[2], 0, 8); cmd[4] = 1; /* Start spin cycle */ if (sdkp->device->start_stop_pwr_cond) cmd[4] |= 1 << 4; scsi_execute_req(sdkp->device, cmd, DMA_NONE, NULL, 0, &sshdr, SD_TIMEOUT, SD_MAX_RETRIES, NULL); spintime_expire = jiffies + 100 * HZ; spintime = 1; } /* Wait 1 second for next try */ msleep(1000); printk("."); /* * Wait for USB flash devices with slow firmware. * Yes, this sense key/ASC combination shouldn't * occur here. It's characteristic of these devices. */ } else if (sense_valid && sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x28) { if (!spintime) { spintime_expire = jiffies + 5 * HZ; spintime = 1; } /* Wait 1 second for next try */ msleep(1000); } else { /* we don't understand the sense code, so it's * probably pointless to loop */ if(!spintime) { sd_printk(KERN_NOTICE, sdkp, "Unit Not Ready\n"); sd_print_sense_hdr(sdkp, &sshdr); } break; } } while (spintime && time_before_eq(jiffies, spintime_expire)); if (spintime) { if (scsi_status_is_good(the_result)) printk("ready\n"); else printk("not responding...\n"); } } /* * Determine whether disk supports Data Integrity Field. */ void sd_read_protection_type(struct scsi_disk *sdkp, unsigned char *buffer) { struct scsi_device *sdp = sdkp->device; u8 type; if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) return; type = ((buffer[12] >> 1) & 7) + 1; /* P_TYPE 0 = Type 1 */ if (type == sdkp->protection_type || !sdkp->first_scan) return; sdkp->protection_type = type; if (type > SD_DIF_TYPE3_PROTECTION) { sd_printk(KERN_ERR, sdkp, "formatted with unsupported " \ "protection type %u. Disabling disk!\n", type); sdkp->capacity = 0; return; } if (scsi_host_dif_capable(sdp->host, type)) sd_printk(KERN_NOTICE, sdkp, "Enabling DIF Type %u protection\n", type); else sd_printk(KERN_NOTICE, sdkp, "Disabling DIF Type %u protection\n", type); } static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp, struct scsi_sense_hdr *sshdr, int sense_valid, int the_result) { sd_print_result(sdkp, the_result); if (driver_byte(the_result) & DRIVER_SENSE) sd_print_sense_hdr(sdkp, sshdr); else sd_printk(KERN_NOTICE, sdkp, "Sense not available.\n"); /* * Set dirty bit for removable devices if not ready - * sometimes drives will not report this properly. */ if (sdp->removable && sense_valid && sshdr->sense_key == NOT_READY) sdp->changed = 1; /* * We used to set media_present to 0 here to indicate no media * in the drive, but some drives fail read capacity even with * media present, so we can't do that. */ sdkp->capacity = 0; /* unknown mapped to zero - as usual */ } #define RC16_LEN 32 #if RC16_LEN > SD_BUF_SIZE #error RC16_LEN must not be more than SD_BUF_SIZE #endif static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, unsigned char *buffer) { unsigned char cmd[16]; struct scsi_sense_hdr sshdr; int sense_valid = 0; int the_result; int retries = 3; unsigned int alignment; unsigned long long lba; unsigned sector_size; do { memset(cmd, 0, 16); cmd[0] = SERVICE_ACTION_IN; cmd[1] = SAI_READ_CAPACITY_16; cmd[13] = RC16_LEN; memset(buffer, 0, RC16_LEN); the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, buffer, RC16_LEN, &sshdr, SD_TIMEOUT, SD_MAX_RETRIES, NULL); if (media_not_present(sdkp, &sshdr)) return -ENODEV; if (the_result) { sense_valid = scsi_sense_valid(&sshdr); if (sense_valid && sshdr.sense_key == ILLEGAL_REQUEST && (sshdr.asc == 0x20 || sshdr.asc == 0x24) && sshdr.ascq == 0x00) /* Invalid Command Operation Code or * Invalid Field in CDB, just retry * silently with RC10 */ return -EINVAL; } retries--; } while (the_result && retries); if (the_result) { sd_printk(KERN_NOTICE, sdkp, "READ CAPACITY(16) failed\n"); read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result); return -EINVAL; } sector_size = get_unaligned_be32(&buffer[8]); lba = get_unaligned_be64(&buffer[0]); sd_read_protection_type(sdkp, buffer); if ((sizeof(sdkp->capacity) == 4) && (lba >= 0xffffffffULL)) { sd_printk(KERN_ERR, sdkp, "Too big for this kernel. Use a " "kernel compiled with support for large block " "devices.\n"); sdkp->capacity = 0; return -EOVERFLOW; } /* Logical blocks per physical block exponent */ sdkp->hw_sector_size = (1 << (buffer[13] & 0xf)) * sector_size; /* Lowest aligned logical block */ alignment = ((buffer[14] & 0x3f) << 8 | buffer[15]) * sector_size; blk_queue_alignment_offset(sdp->request_queue, alignment); if (alignment && sdkp->first_scan) sd_printk(KERN_NOTICE, sdkp, "physical block alignment offset: %u\n", alignment); if (buffer[14] & 0x80) { /* TPE */ struct request_queue *q = sdp->request_queue; sdkp->thin_provisioning = 1; q->limits.discard_granularity = sdkp->hw_sector_size; q->limits.max_discard_sectors = 0xffffffff; if (buffer[14] & 0x40) /* TPRZ */ q->limits.discard_zeroes_data = 1; queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); } sdkp->capacity = lba + 1; return sector_size; } static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, unsigned char *buffer) { unsigned char cmd[16]; struct scsi_sense_hdr sshdr; int sense_valid = 0; int the_result; int retries = 3; sector_t lba; unsigned sector_size; do { cmd[0] = READ_CAPACITY; memset(&cmd[1], 0, 9); memset(buffer, 0, 8); the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, buffer, 8, &sshdr, SD_TIMEOUT, SD_MAX_RETRIES, NULL); if (media_not_present(sdkp, &sshdr)) return -ENODEV; if (the_result) sense_valid = scsi_sense_valid(&sshdr); retries--; } while (the_result && retries); if (the_result) { sd_printk(KERN_NOTICE, sdkp, "READ CAPACITY failed\n"); read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result); return -EINVAL; } sector_size = get_unaligned_be32(&buffer[4]); lba = get_unaligned_be32(&buffer[0]); if ((sizeof(sdkp->capacity) == 4) && (lba == 0xffffffff)) { sd_printk(KERN_ERR, sdkp, "Too big for this kernel. Use a " "kernel compiled with support for large block " "devices.\n"); sdkp->capacity = 0; return -EOVERFLOW; } sdkp->capacity = lba + 1; sdkp->hw_sector_size = sector_size; return sector_size; } static int sd_try_rc16_first(struct scsi_device *sdp) { if (sdp->scsi_level > SCSI_SPC_2) return 1; if (scsi_device_protection(sdp)) return 1; return 0; } /* * read disk capacity */ static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer) { int sector_size; struct scsi_device *sdp = sdkp->device; sector_t old_capacity = sdkp->capacity; if (sd_try_rc16_first(sdp)) { sector_size = read_capacity_16(sdkp, sdp, buffer); if (sector_size == -EOVERFLOW) goto got_data; if (sector_size == -ENODEV) return; if (sector_size < 0) sector_size = read_capacity_10(sdkp, sdp, buffer); if (sector_size < 0) return; } else { sector_size = read_capacity_10(sdkp, sdp, buffer); if (sector_size == -EOVERFLOW) goto got_data; if (sector_size < 0) return; if ((sizeof(sdkp->capacity) > 4) && (sdkp->capacity > 0xffffffffULL)) { int old_sector_size = sector_size; sd_printk(KERN_NOTICE, sdkp, "Very big device. " "Trying to use READ CAPACITY(16).\n"); sector_size = read_capacity_16(sdkp, sdp, buffer); if (sector_size < 0) { sd_printk(KERN_NOTICE, sdkp, "Using 0xffffffff as device size\n"); sdkp->capacity = 1 + (sector_t) 0xffffffff; sector_size = old_sector_size; goto got_data; } } } /* Some devices are known to return the total number of blocks, * not the highest block number. Some devices have versions * which do this and others which do not. Some devices we might * suspect of doing this but we don't know for certain. * * If we know the reported capacity is wrong, decrement it. If * we can only guess, then assume the number of blocks is even * (usually true but not always) and err on the side of lowering * the capacity. */ if (sdp->fix_capacity || (sdp->guess_capacity && (sdkp->capacity & 0x01))) { sd_printk(KERN_INFO, sdkp, "Adjusting the sector count " "from its reported value: %llu\n", (unsigned long long) sdkp->capacity); --sdkp->capacity; } got_data: if (sector_size == 0) { sector_size = 512; sd_printk(KERN_NOTICE, sdkp, "Sector size 0 reported, " "assuming 512.\n"); } if (sector_size != 512 && sector_size != 1024 && sector_size != 2048 && sector_size != 4096 && sector_size != 256) { sd_printk(KERN_NOTICE, sdkp, "Unsupported sector size %d.\n", sector_size); /* * The user might want to re-format the drive with * a supported sectorsize. Once this happens, it * would be relatively trivial to set the thing up. * For this reason, we leave the thing in the table. */ sdkp->capacity = 0; /* * set a bogus sector size so the normal read/write * logic in the block layer will eventually refuse any * request on this device without tripping over power * of two sector size assumptions */ sector_size = 512; } blk_queue_logical_block_size(sdp->request_queue, sector_size); { char cap_str_2[10], cap_str_10[10]; u64 sz = (u64)sdkp->capacity << ilog2(sector_size); string_get_size(sz, STRING_UNITS_2, cap_str_2, sizeof(cap_str_2)); string_get_size(sz, STRING_UNITS_10, cap_str_10, sizeof(cap_str_10)); if (sdkp->first_scan || old_capacity != sdkp->capacity) { sd_printk(KERN_NOTICE, sdkp, "%llu %d-byte logical blocks: (%s/%s)\n", (unsigned long long)sdkp->capacity, sector_size, cap_str_10, cap_str_2); if (sdkp->hw_sector_size != sector_size) sd_printk(KERN_NOTICE, sdkp, "%u-byte physical blocks\n", sdkp->hw_sector_size); } } /* Rescale capacity to 512-byte units */ if (sector_size == 4096) sdkp->capacity <<= 3; else if (sector_size == 2048) sdkp->capacity <<= 2; else if (sector_size == 1024) sdkp->capacity <<= 1; else if (sector_size == 256) sdkp->capacity >>= 1; blk_queue_physical_block_size(sdp->request_queue, sdkp->hw_sector_size); sdkp->device->sector_size = sector_size; } /* called with buffer of length 512 */ static inline int sd_do_mode_sense(struct scsi_device *sdp, int dbd, int modepage, unsigned char *buffer, int len, struct scsi_mode_data *data, struct scsi_sense_hdr *sshdr) { return scsi_mode_sense(sdp, dbd, modepage, buffer, len, SD_TIMEOUT, SD_MAX_RETRIES, data, sshdr); } /* * read write protect setting, if possible - called only in sd_revalidate_disk() * called with buffer of length SD_BUF_SIZE */ static void sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) { int res; struct scsi_device *sdp = sdkp->device; struct scsi_mode_data data; int old_wp = sdkp->write_prot; set_disk_ro(sdkp->disk, 0); if (sdp->skip_ms_page_3f) { sd_printk(KERN_NOTICE, sdkp, "Assuming Write Enabled\n"); return; } if (sdp->use_192_bytes_for_3f) { res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 192, &data, NULL); } else { /* * First attempt: ask for all pages (0x3F), but only 4 bytes. * We have to start carefully: some devices hang if we ask * for more than is available. */ res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 4, &data, NULL); /* * Second attempt: ask for page 0 When only page 0 is * implemented, a request for page 3F may return Sense Key * 5: Illegal Request, Sense Code 24: Invalid field in * CDB. */ if (!scsi_status_is_good(res)) res = sd_do_mode_sense(sdp, 0, 0, buffer, 4, &data, NULL); /* * Third attempt: ask 255 bytes, as we did earlier. */ if (!scsi_status_is_good(res)) res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 255, &data, NULL); } if (!scsi_status_is_good(res)) { sd_printk(KERN_WARNING, sdkp, "Test WP failed, assume Write Enabled\n"); } else { sdkp->write_prot = ((data.device_specific & 0x80) != 0); set_disk_ro(sdkp->disk, sdkp->write_prot); if (sdkp->first_scan || old_wp != sdkp->write_prot) { sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", sdkp->write_prot ? "on" : "off"); sd_printk(KERN_DEBUG, sdkp, "Mode Sense: %02x %02x %02x %02x\n", buffer[0], buffer[1], buffer[2], buffer[3]); } } } /* * sd_read_cache_type - called only from sd_revalidate_disk() * called with buffer of length SD_BUF_SIZE */ static void sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) { int len = 0, res; struct scsi_device *sdp = sdkp->device; int dbd; int modepage; struct scsi_mode_data data; struct scsi_sense_hdr sshdr; int old_wce = sdkp->WCE; int old_rcd = sdkp->RCD; int old_dpofua = sdkp->DPOFUA; if (sdp->skip_ms_page_8) goto defaults; if (sdp->type == TYPE_RBC) { modepage = 6; dbd = 8; } else { modepage = 8; dbd = 0; } /* cautiously ask */ res = sd_do_mode_sense(sdp, dbd, modepage, buffer, 4, &data, &sshdr); if (!scsi_status_is_good(res)) goto bad_sense; if (!data.header_length) { modepage = 6; sd_printk(KERN_ERR, sdkp, "Missing header in MODE_SENSE response\n"); } /* that went OK, now ask for the proper length */ len = data.length; /* * We're only interested in the first three bytes, actually. * But the data cache page is defined for the first 20. */ if (len < 3) goto bad_sense; if (len > 20) len = 20; /* Take headers and block descriptors into account */ len += data.header_length + data.block_descriptor_length; if (len > SD_BUF_SIZE) goto bad_sense; /* Get the data */ res = sd_do_mode_sense(sdp, dbd, modepage, buffer, len, &data, &sshdr); if (scsi_status_is_good(res)) { int offset = data.header_length + data.block_descriptor_length; if (offset >= SD_BUF_SIZE - 2) { sd_printk(KERN_ERR, sdkp, "Malformed MODE SENSE response\n"); goto defaults; } if ((buffer[offset] & 0x3f) != modepage) { sd_printk(KERN_ERR, sdkp, "Got wrong page\n"); goto defaults; } if (modepage == 8) { sdkp->WCE = ((buffer[offset + 2] & 0x04) != 0); sdkp->RCD = ((buffer[offset + 2] & 0x01) != 0); } else { sdkp->WCE = ((buffer[offset + 2] & 0x01) == 0); sdkp->RCD = 0; } sdkp->DPOFUA = (data.device_specific & 0x10) != 0; if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { sd_printk(KERN_NOTICE, sdkp, "Uses READ/WRITE(6), disabling FUA\n"); sdkp->DPOFUA = 0; } if (sdkp->first_scan || old_wce != sdkp->WCE || old_rcd != sdkp->RCD || old_dpofua != sdkp->DPOFUA) sd_printk(KERN_NOTICE, sdkp, "Write cache: %s, read cache: %s, %s\n", sdkp->WCE ? "enabled" : "disabled", sdkp->RCD ? "disabled" : "enabled", sdkp->DPOFUA ? "supports DPO and FUA" : "doesn't support DPO or FUA"); return; } bad_sense: if (scsi_sense_valid(&sshdr) && sshdr.sense_key == ILLEGAL_REQUEST && sshdr.asc == 0x24 && sshdr.ascq == 0x0) /* Invalid field in CDB */ sd_printk(KERN_NOTICE, sdkp, "Cache data unavailable\n"); else sd_printk(KERN_ERR, sdkp, "Asking for cache data failed\n"); defaults: sd_printk(KERN_ERR, sdkp, "Assuming drive cache: write through\n"); sdkp->WCE = 0; sdkp->RCD = 0; sdkp->DPOFUA = 0; } /* * The ATO bit indicates whether the DIF application tag is available * for use by the operating system. */ void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer) { int res, offset; struct scsi_device *sdp = sdkp->device; struct scsi_mode_data data; struct scsi_sense_hdr sshdr; if (sdp->type != TYPE_DISK) return; if (sdkp->protection_type == 0) return; res = scsi_mode_sense(sdp, 1, 0x0a, buffer, 36, SD_TIMEOUT, SD_MAX_RETRIES, &data, &sshdr); if (!scsi_status_is_good(res) || !data.header_length || data.length < 6) { sd_printk(KERN_WARNING, sdkp, "getting Control mode page failed, assume no ATO\n"); if (scsi_sense_valid(&sshdr)) sd_print_sense_hdr(sdkp, &sshdr); return; } offset = data.header_length + data.block_descriptor_length; if ((buffer[offset] & 0x3f) != 0x0a) { sd_printk(KERN_ERR, sdkp, "ATO Got wrong page\n"); return; } if ((buffer[offset + 5] & 0x80) == 0) return; sdkp->ATO = 1; return; } /** * sd_read_block_limits - Query disk device for preferred I/O sizes. * @disk: disk to query */ static void sd_read_block_limits(struct scsi_disk *sdkp) { struct request_queue *q = sdkp->disk->queue; unsigned int sector_sz = sdkp->device->sector_size; char *buffer; /* Block Limits VPD */ buffer = scsi_get_vpd_page(sdkp->device, 0xb0); if (buffer == NULL) return; blk_queue_io_min(sdkp->disk->queue, get_unaligned_be16(&buffer[6]) * sector_sz); blk_queue_io_opt(sdkp->disk->queue, get_unaligned_be32(&buffer[12]) * sector_sz); /* Thin provisioning enabled and page length indicates TP support */ if (sdkp->thin_provisioning && buffer[3] == 0x3c) { unsigned int lba_count, desc_count, granularity; lba_count = get_unaligned_be32(&buffer[20]); desc_count = get_unaligned_be32(&buffer[24]); if (lba_count) { q->limits.max_discard_sectors = lba_count * sector_sz >> 9; if (desc_count) sdkp->unmap = 1; } granularity = get_unaligned_be32(&buffer[28]); if (granularity) q->limits.discard_granularity = granularity * sector_sz; if (buffer[32] & 0x80) q->limits.discard_alignment = get_unaligned_be32(&buffer[32]) & ~(1 << 31); } kfree(buffer); } /** * sd_read_block_characteristics - Query block dev. characteristics * @disk: disk to query */ static void sd_read_block_characteristics(struct scsi_disk *sdkp) { char *buffer; u16 rot; /* Block Device Characteristics VPD */ buffer = scsi_get_vpd_page(sdkp->device, 0xb1); if (buffer == NULL) return; rot = get_unaligned_be16(&buffer[4]); if (rot == 1) queue_flag_set_unlocked(QUEUE_FLAG_NONROT, sdkp->disk->queue); kfree(buffer); } static int sd_try_extended_inquiry(struct scsi_device *sdp) { /* * Although VPD inquiries can go to SCSI-2 type devices, * some USB ones crash on receiving them, and the pages * we currently ask for are for SPC-3 and beyond */ if (sdp->scsi_level > SCSI_SPC_2) return 1; return 0; } /** * sd_revalidate_disk - called the first time a new disk is seen, * performs disk spin up, read_capacity, etc. * @disk: struct gendisk we care about **/ static int sd_revalidate_disk(struct gendisk *disk) { struct scsi_disk *sdkp = scsi_disk(disk); struct scsi_device *sdp = sdkp->device; unsigned char *buffer; unsigned ordered; SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_revalidate_disk\n")); /* * If the device is offline, don't try and read capacity or any * of the other niceties. */ if (!scsi_device_online(sdp)) goto out; buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL); if (!buffer) { sd_printk(KERN_WARNING, sdkp, "sd_revalidate_disk: Memory " "allocation failure.\n"); goto out; } sd_spinup_disk(sdkp); /* * Without media there is no reason to ask; moreover, some devices * react badly if we do. */ if (sdkp->media_present) { sd_read_capacity(sdkp, buffer); if (sd_try_extended_inquiry(sdp)) { sd_read_block_limits(sdkp); sd_read_block_characteristics(sdkp); } sd_read_write_protect_flag(sdkp, buffer); sd_read_cache_type(sdkp, buffer); sd_read_app_tag_own(sdkp, buffer); } sdkp->first_scan = 0; /* * We now have all cache related info, determine how we deal * with ordered requests. Note that as the current SCSI * dispatch function can alter request order, we cannot use * QUEUE_ORDERED_TAG_* even when ordered tag is supported. */ if (sdkp->WCE) ordered = sdkp->DPOFUA ? QUEUE_ORDERED_DRAIN_FUA : QUEUE_ORDERED_DRAIN_FLUSH; else ordered = QUEUE_ORDERED_DRAIN; blk_queue_ordered(sdkp->disk->queue, ordered, sd_prepare_flush); set_capacity(disk, sdkp->capacity); kfree(buffer); out: return 0; } /** * sd_format_disk_name - format disk name * @prefix: name prefix - ie. "sd" for SCSI disks * @index: index of the disk to format name for * @buf: output buffer * @buflen: length of the output buffer * * SCSI disk names starts at sda. The 26th device is sdz and the * 27th is sdaa. The last one for two lettered suffix is sdzz * which is followed by sdaaa. * * This is basically 26 base counting with one extra 'nil' entry * at the beggining from the second digit on and can be * determined using similar method as 26 base conversion with the * index shifted -1 after each digit is computed. * * CONTEXT: * Don't care. * * RETURNS: * 0 on success, -errno on failure. */ static int sd_format_disk_name(char *prefix, int index, char *buf, int buflen) { const int base = 'z' - 'a' + 1; char *begin = buf + strlen(prefix); char *end = buf + buflen; char *p; int unit; p = end - 1; *p = '\0'; unit = base; do { if (p == begin) return -EINVAL; *--p = 'a' + (index % unit); index = (index / unit) - 1; } while (index >= 0); memmove(begin, p, end - p); memcpy(buf, prefix, strlen(prefix)); return 0; } /* * The asynchronous part of sd_probe */ static void sd_probe_async(void *data, async_cookie_t cookie) { struct scsi_disk *sdkp = data; struct scsi_device *sdp; struct gendisk *gd; u32 index; struct device *dev; sdp = sdkp->device; gd = sdkp->disk; index = sdkp->index; dev = &sdp->sdev_gendev; if (index < SD_MAX_DISKS) { gd->major = sd_major((index & 0xf0) >> 4); gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); gd->minors = SD_MINORS; } gd->fops = &sd_fops; gd->private_data = &sdkp->driver; gd->queue = sdkp->device->request_queue; /* defaults, until the device tells us otherwise */ sdp->sector_size = 512; sdkp->capacity = 0; sdkp->media_present = 1; sdkp->write_prot = 0; sdkp->WCE = 0; sdkp->RCD = 0; sdkp->ATO = 0; sdkp->first_scan = 1; sd_revalidate_disk(gd); blk_queue_prep_rq(sdp->request_queue, sd_prep_fn); gd->driverfs_dev = &sdp->sdev_gendev; gd->flags = GENHD_FL_EXT_DEVT | GENHD_FL_DRIVERFS; if (sdp->removable) gd->flags |= GENHD_FL_REMOVABLE; dev_set_drvdata(dev, sdkp); add_disk(gd); sd_dif_config_host(sdkp); sd_revalidate_disk(gd); sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", sdp->removable ? "removable " : ""); put_device(&sdkp->dev); } /** * sd_probe - called during driver initialization and whenever a * new scsi device is attached to the system. It is called once * for each scsi device (not just disks) present. * @dev: pointer to device object * * Returns 0 if successful (or not interested in this scsi device * (e.g. scanner)); 1 when there is an error. * * Note: this function is invoked from the scsi mid-level. * This function sets up the mapping between a given * <host,channel,id,lun> (found in sdp) and new device name * (e.g. /dev/sda). More precisely it is the block device major * and minor number that is chosen here. * * Assume sd_attach is not re-entrant (for time being) * Also think about sd_attach() and sd_remove() running coincidentally. **/ static int sd_probe(struct device *dev) { struct scsi_device *sdp = to_scsi_device(dev); struct scsi_disk *sdkp; struct gendisk *gd; u32 index; int error; error = -ENODEV; if (sdp->type != TYPE_DISK && sdp->type != TYPE_MOD && sdp->type != TYPE_RBC) goto out; SCSI_LOG_HLQUEUE(3, sdev_printk(KERN_INFO, sdp, "sd_attach\n")); error = -ENOMEM; sdkp = kzalloc(sizeof(*sdkp), GFP_KERNEL); if (!sdkp) goto out; gd = alloc_disk(SD_MINORS); if (!gd) goto out_free; do { if (!ida_pre_get(&sd_index_ida, GFP_KERNEL)) goto out_put; spin_lock(&sd_index_lock); error = ida_get_new(&sd_index_ida, &index); spin_unlock(&sd_index_lock); } while (error == -EAGAIN); if (error) goto out_put; error = sd_format_disk_name("sd", index, gd->disk_name, DISK_NAME_LEN); if (error) goto out_free_index; sdkp->device = sdp; sdkp->driver = &sd_template; sdkp->disk = gd; sdkp->index = index; sdkp->openers = 0; sdkp->previous_state = 1; if (!sdp->request_queue->rq_timeout) { if (sdp->type != TYPE_MOD) blk_queue_rq_timeout(sdp->request_queue, SD_TIMEOUT); else blk_queue_rq_timeout(sdp->request_queue, SD_MOD_TIMEOUT); } device_initialize(&sdkp->dev); sdkp->dev.parent = &sdp->sdev_gendev; sdkp->dev.class = &sd_disk_class; dev_set_name(&sdkp->dev, dev_name(&sdp->sdev_gendev)); if (device_add(&sdkp->dev)) goto out_free_index; get_device(&sdp->sdev_gendev); get_device(&sdkp->dev); /* prevent release before async_schedule */ async_schedule(sd_probe_async, sdkp); return 0; out_free_index: spin_lock(&sd_index_lock); ida_remove(&sd_index_ida, index); spin_unlock(&sd_index_lock); out_put: put_disk(gd); out_free: kfree(sdkp); out: return error; } /** * sd_remove - called whenever a scsi disk (previously recognized by * sd_probe) is detached from the system. It is called (potentially * multiple times) during sd module unload. * @sdp: pointer to mid level scsi device object * * Note: this function is invoked from the scsi mid-level. * This function potentially frees up a device name (e.g. /dev/sdc) * that could be re-used by a subsequent sd_probe(). * This function is not called when the built-in sd driver is "exit-ed". **/ static int sd_remove(struct device *dev) { struct scsi_disk *sdkp; async_synchronize_full(); sdkp = dev_get_drvdata(dev); blk_queue_prep_rq(sdkp->device->request_queue, scsi_prep_fn); device_del(&sdkp->dev); del_gendisk(sdkp->disk); sd_shutdown(dev); mutex_lock(&sd_ref_mutex); dev_set_drvdata(dev, NULL); put_device(&sdkp->dev); mutex_unlock(&sd_ref_mutex); return 0; } /** * scsi_disk_release - Called to free the scsi_disk structure * @dev: pointer to embedded class device * * sd_ref_mutex must be held entering this routine. Because it is * called on last put, you should always use the scsi_disk_get() * scsi_disk_put() helpers which manipulate the semaphore directly * and never do a direct put_device. **/ static void scsi_disk_release(struct device *dev) { struct scsi_disk *sdkp = to_scsi_disk(dev); struct gendisk *disk = sdkp->disk; spin_lock(&sd_index_lock); ida_remove(&sd_index_ida, sdkp->index); spin_unlock(&sd_index_lock); disk->private_data = NULL; put_disk(disk); put_device(&sdkp->device->sdev_gendev); kfree(sdkp); } static int sd_start_stop_device(struct scsi_disk *sdkp, int start) { unsigned char cmd[6] = { START_STOP }; /* START_VALID */ struct scsi_sense_hdr sshdr; struct scsi_device *sdp = sdkp->device; int res; if (start) cmd[4] |= 1; /* START */ if (sdp->start_stop_pwr_cond) cmd[4] |= start ? 1 << 4 : 3 << 4; /* Active or Standby */ if (!scsi_device_online(sdp)) return -ENODEV; res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr, SD_TIMEOUT, SD_MAX_RETRIES, NULL); if (res) { sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n"); sd_print_result(sdkp, res); if (driver_byte(res) & DRIVER_SENSE) sd_print_sense_hdr(sdkp, &sshdr); } return res; } /* * Send a SYNCHRONIZE CACHE instruction down to the device through * the normal SCSI command structure. Wait for the command to * complete. */ static void sd_shutdown(struct device *dev) { struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); if (!sdkp) return; /* this can happen */ if (sdkp->WCE) { sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); sd_sync_cache(sdkp); } if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) { sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); sd_start_stop_device(sdkp, 0); } scsi_disk_put(sdkp); } static int sd_suspend(struct device *dev, pm_message_t mesg) { struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); int ret = 0; if (!sdkp) return 0; /* this can happen */ if (sdkp->WCE) { sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); ret = sd_sync_cache(sdkp); if (ret) goto done; } if ((mesg.event & PM_EVENT_SLEEP) && sdkp->device->manage_start_stop) { sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); ret = sd_start_stop_device(sdkp, 0); } done: scsi_disk_put(sdkp); return ret; } static int sd_resume(struct device *dev) { struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); int ret = 0; if (!sdkp->device->manage_start_stop) goto done; sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); ret = sd_start_stop_device(sdkp, 1); done: scsi_disk_put(sdkp); return ret; } /** * init_sd - entry point for this driver (both when built in or when * a module). * * Note: this function registers this driver with the scsi mid-level. **/ static int __init init_sd(void) { int majors = 0, i, err; SCSI_LOG_HLQUEUE(3, printk("init_sd: sd driver entry point\n")); for (i = 0; i < SD_MAJORS; i++) if (register_blkdev(sd_major(i), "sd") == 0) majors++; if (!majors) return -ENODEV; err = class_register(&sd_disk_class); if (err) goto err_out; err = scsi_register_driver(&sd_template.gendrv); if (err) goto err_out_class; sd_cdb_cache = kmem_cache_create("sd_ext_cdb", SD_EXT_CDB_SIZE, 0, 0, NULL); if (!sd_cdb_cache) { printk(KERN_ERR "sd: can't init extended cdb cache\n"); goto err_out_class; } sd_cdb_pool = mempool_create_slab_pool(SD_MEMPOOL_SIZE, sd_cdb_cache); if (!sd_cdb_pool) { printk(KERN_ERR "sd: can't init extended cdb pool\n"); goto err_out_cache; } return 0; err_out_cache: kmem_cache_destroy(sd_cdb_cache); err_out_class: class_unregister(&sd_disk_class); err_out: for (i = 0; i < SD_MAJORS; i++) unregister_blkdev(sd_major(i), "sd"); return err; } /** * exit_sd - exit point for this driver (when it is a module). * * Note: this function unregisters this driver from the scsi mid-level. **/ static void __exit exit_sd(void) { int i; SCSI_LOG_HLQUEUE(3, printk("exit_sd: exiting sd driver\n")); mempool_destroy(sd_cdb_pool); kmem_cache_destroy(sd_cdb_cache); scsi_unregister_driver(&sd_template.gendrv); class_unregister(&sd_disk_class); for (i = 0; i < SD_MAJORS; i++) unregister_blkdev(sd_major(i), "sd"); } module_init(init_sd); module_exit(exit_sd); static void sd_print_sense_hdr(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) { sd_printk(KERN_INFO, sdkp, ""); scsi_show_sense_hdr(sshdr); sd_printk(KERN_INFO, sdkp, ""); scsi_show_extd_sense(sshdr->asc, sshdr->ascq); } static void sd_print_result(struct scsi_disk *sdkp, int result) { sd_printk(KERN_INFO, sdkp, ""); scsi_show_result(result); }
{ "pile_set_name": "Github" }
const getFileMenu = [ { icon: 'photo', title: 'Images', to: { path: '/media', query: { type: 'image' } }, }, { icon: 'videocam', title: 'Video', to: { path: '/media', query: { type: 'video' } }, }, { icon: 'volume_down', title: 'Audio', to: { path: '/media', query: { type: 'audio' } }, }, { icon: 'insert_drive_file', title: 'Document', to: { path: '/media', query: { type: 'doc' } }, }, ] const Items = [ { uuid: 'a32c4aec-54de-4ff4-b165-8571ae805598', fileName: '.DS_Store', fileType: false, path: 'static/.DS_Store', fullPath: '/Users/michael/themeforest/vue-material-admin/static/.DS_Store', ext: '', dir: 'static', ctime: '2018-04-08T09:15:19.307Z', size: 12292, }, { uuid: 'a30f71db-7dcf-4467-978f-e32841d47825', fileName: '.gitkeep', fileType: false, path: 'static/.gitkeep', fullPath: '/Users/michael/themeforest/vue-material-admin/static/.gitkeep', ext: '', dir: 'static', ctime: '2018-03-14T09:21:32.010Z', size: 0, }, { uuid: 'ca1bf511-a44e-4663-8b68-323419236ddf', fileName: 'google.png', fileType: 'image/png', path: 'static/avatar/google.png', fullPath: '/Users/michael/themeforest/vue-material-admin/static/avatar/google.png', ext: '.png', dir: 'static/avatar', ctime: '2018-04-08T08:31:07.808Z', size: 12734, }, { uuid: '0693e01e-926c-4c95-818b-3f9b6d5413e7', fileName: 'hangouts.png', fileType: 'image/png', path: 'static/avatar/hangouts.png', fullPath: '/Users/michael/themeforest/vue-material-admin/static/avatar/hangouts.png', ext: '.png', dir: 'static/avatar', ctime: '2018-04-08T08:31:10.010Z', size: 15266, }, { uuid: '53d3ba9d-90f2-4a60-af86-04679321f551', fileName: 'inbox.png', fileType: 'image/png', path: 'static/avatar/inbox.png', fullPath: '/Users/michael/themeforest/vue-material-admin/static/avatar/inbox.png', ext: '.png', dir: 'static/avatar', ctime: '2018-04-08T08:31:13.303Z', size: 22444, }, { uuid: 'ef6397dd-ca99-459f-9694-bf9475359a51', fileName: 'keep.png', fileType: 'image/png', path: 'static/avatar/keep.png', fullPath: '/Users/michael/themeforest/vue-material-admin/static/avatar/keep.png', ext: '.png', dir: 'static/avatar', ctime: '2018-04-08T08:31:15.534Z', size: 2146, }, { uuid: 'e6dcaede-1c87-4052-a4e9-f894809d5984', fileName: 'messenger.png', fileType: 'image/png', path: 'static/avatar/messenger.png', fullPath: '/Users/michael/themeforest/vue-material-admin/static/avatar/messenger.png', ext: '.png', dir: 'static/avatar', ctime: '2018-04-08T08:31:24.183Z', size: 7006, }, { uuid: '78a63d97-c763-4fa4-883f-8f9ed4425a6a', fileName: '1.jpg', fileType: 'image/jpeg', path: 'static/bg/1.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/1.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.070Z', size: 275608, }, { uuid: '29245130-ec05-4bf1-90ea-06574faa9bda', fileName: '10.jpg', fileType: 'image/jpeg', path: 'static/bg/10.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/10.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.096Z', size: 283680, }, { uuid: '83c2cfc6-80c2-4bc0-af02-4b2e6a94a2d3', fileName: '11.jpg', fileType: 'image/jpeg', path: 'static/bg/11.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/11.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.100Z', size: 99467, }, { uuid: '71fa31b2-4463-4c4c-baf2-719cd89ab15a', fileName: '12.jpg', fileType: 'image/jpeg', path: 'static/bg/12.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/12.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.103Z', size: 82253, }, { uuid: '74db5dd4-f60d-415a-b6f7-3107ce2e5cda', fileName: '13.jpg', fileType: 'image/jpeg', path: 'static/bg/13.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/13.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:41:46.865Z', size: 103275, }, { uuid: '54dc3e30-a9c8-4a68-9f9b-b070f5a5fea4', fileName: '14.jpg', fileType: 'image/jpeg', path: 'static/bg/14.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/14.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.111Z', size: 103446, }, { uuid: 'c2c9104b-8a26-4bce-b942-7104e57687b7', fileName: '15.jpg', fileType: 'image/jpeg', path: 'static/bg/15.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/15.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.119Z', size: 105339, }, { uuid: '6b608ce9-e35b-4dfb-87cb-f4ca19102996', fileName: '16.jpg', fileType: 'image/jpeg', path: 'static/bg/16.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/16.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.122Z', size: 88580, }, { uuid: 'a9b26177-5927-44a5-8b7c-4cad8425e9a5', fileName: '17.jpg', fileType: 'image/jpeg', path: 'static/bg/17.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/17.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.125Z', size: 98465, }, { uuid: 'f1168479-113a-4f8a-a014-45ff6351941e', fileName: '18.jpg', fileType: 'image/jpeg', path: 'static/bg/18.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/18.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.128Z', size: 100565, }, { uuid: 'd1cd7b81-b301-425f-89d1-e0cbf2f7a0cb', fileName: '19.jpg', fileType: 'image/jpeg', path: 'static/bg/19.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/19.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.138Z', size: 39500, }, { uuid: 'c9ebff9b-651a-43c8-8e8a-028bb69b00ef', fileName: '2.jpg', fileType: 'image/jpeg', path: 'static/bg/2.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/2.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.075Z', size: 268438, }, { uuid: 'fa673c64-e747-4279-8574-be153c106ede', fileName: '20.jpg', fileType: 'image/jpeg', path: 'static/bg/20.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/20.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.143Z', size: 104204, }, { uuid: '74e2ab71-4261-4fa9-b2e7-4844ef9f1d58', fileName: '21.jpg', fileType: 'image/jpeg', path: 'static/bg/21.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/21.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:41:54.525Z', size: 91890, }, { uuid: '5fb2fed2-fc86-4bd5-9144-7d36b3dacd60', fileName: '22.jpg', fileType: 'image/jpeg', path: 'static/bg/22.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/22.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.150Z', size: 104620, }, { uuid: '8d6cdfc5-e69a-44d2-b6e3-4265b4b87cc1', fileName: '23.jpg', fileType: 'image/jpeg', path: 'static/bg/23.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/23.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.157Z', size: 103130, }, { uuid: 'd733c863-b5ed-46b2-9eb2-42eb9fa285fa', fileName: '24.jpg', fileType: 'image/jpeg', path: 'static/bg/24.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/24.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.159Z', size: 105835, }, { uuid: 'f9c7064e-2542-473f-9b4d-98d122ef4364', fileName: '25.jpg', fileType: 'image/jpeg', path: 'static/bg/25.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/25.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.162Z', size: 95075, }, { uuid: 'e2ea7604-a86d-4fef-bb20-40fae6bb7ce0', fileName: '26.jpg', fileType: 'image/jpeg', path: 'static/bg/26.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/26.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.166Z', size: 104342, }, { uuid: 'f7570a47-938c-4e9c-aba6-a82f30b7bef5', fileName: '27.jpg', fileType: 'image/jpeg', path: 'static/bg/27.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/27.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.168Z', size: 90063, }, { uuid: '4dc41162-89b5-499b-b702-cf951a04841e', fileName: '28.jpg', fileType: 'image/jpeg', path: 'static/bg/28.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/28.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.171Z', size: 132461, }, { uuid: 'ed316744-39c6-4de3-a346-4436d080291a', fileName: '29.jpg', fileType: 'image/jpeg', path: 'static/bg/29.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/29.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.173Z', size: 121466, }, { uuid: 'af9acc25-694a-4656-a790-584129b21cc4', fileName: '3.jpg', fileType: 'image/jpeg', path: 'static/bg/3.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/3.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.077Z', size: 308780, }, { uuid: 'c2be3695-f084-4a41-bc0b-79062e4eefe0', fileName: '30.jpg', fileType: 'image/jpeg', path: 'static/bg/30.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/30.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.176Z', size: 125198, }, { uuid: '708a5185-2de7-4477-ac84-d99f434fa7cc', fileName: '31.jpg', fileType: 'image/jpeg', path: 'static/bg/31.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/31.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.179Z', size: 292495, }, { uuid: 'c9782516-bd3d-4ca6-9397-91b806d4d5aa', fileName: '32.jpg', fileType: 'image/jpeg', path: 'static/bg/32.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/32.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.186Z', size: 278854, }, { uuid: '00ac4093-8202-408e-8b88-a33313d39e6b', fileName: '33.jpg', fileType: 'image/jpeg', path: 'static/bg/33.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/33.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.196Z', size: 296287, }, { uuid: '9d3ed291-8706-4d1c-b37a-9da33f808622', fileName: '34.jpg', fileType: 'image/jpeg', path: 'static/bg/34.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/34.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.199Z', size: 298335, }, { uuid: '38cfc863-13f1-4ab6-acd1-2f403b77f539', fileName: '35.jpg', fileType: 'image/jpeg', path: 'static/bg/35.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/35.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.204Z', size: 285123, }, { uuid: '1cbde33c-6ef6-45e6-930a-94bfae6a4b4d', fileName: '36.jpg', fileType: 'image/jpeg', path: 'static/bg/36.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/36.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.207Z', size: 294032, }, { uuid: 'c4835081-6414-4e23-ae05-6b23997a4f6f', fileName: '37.jpg', fileType: 'image/jpeg', path: 'static/bg/37.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/37.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.210Z', size: 261250, }, { uuid: '16647278-2e36-4285-8347-7aeab0fbf468', fileName: '38.jpg', fileType: 'image/jpeg', path: 'static/bg/38.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/38.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.214Z', size: 292620, }, { uuid: 'e8047c06-fca2-4405-8823-d5497c788362', fileName: '39.jpg', fileType: 'image/jpeg', path: 'static/bg/39.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/39.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.217Z', size: 290569, }, { uuid: 'd69f047b-8ebf-4d3d-b436-09bbbf6cba4b', fileName: '4.jpg', fileType: 'image/jpeg', path: 'static/bg/4.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/4.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.080Z', size: 287013, }, { uuid: 'ad16609e-154b-401d-835f-bbcb6f4a496b', fileName: '40.jpg', fileType: 'image/jpeg', path: 'static/bg/40.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/40.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.219Z', size: 297662, }, { uuid: '8c4cf24d-de27-4aea-abca-f38865cc9239', fileName: '5.jpg', fileType: 'image/jpeg', path: 'static/bg/5.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/5.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.083Z', size: 318957, }, { uuid: '88a031a1-323d-4ca6-9115-61762dbdffe9', fileName: '6.jpg', fileType: 'image/jpeg', path: 'static/bg/6.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/6.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:41:50.063Z', size: 287785, }, { uuid: '5e42c142-b511-4a11-bdaf-ae85ac8417c6', fileName: '7.jpg', fileType: 'image/jpeg', path: 'static/bg/7.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/7.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.089Z', size: 285392, }, { uuid: '5194e91c-5975-40a4-9353-83055b0c8cbb', fileName: '8.jpg', fileType: 'image/jpeg', path: 'static/bg/8.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/8.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.091Z', size: 272918, }, { uuid: 'c5f859ed-012c-48d3-a037-bf164f8b0c84', fileName: '9.jpg', fileType: 'image/jpeg', path: 'static/bg/9.jpg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/bg/9.jpg', ext: '.jpg', dir: 'static/bg', ctime: '2018-03-30T08:40:27.094Z', size: 285242, }, { uuid: 'b83f94eb-3fa4-474f-8b09-91ec5b9e67da', fileName: '403.svg', fileType: 'image/svg+xml', path: 'static/error/403.svg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/error/403.svg', ext: '.svg', dir: 'static/error', ctime: '2018-03-30T06:10:45.825Z', size: 55336, }, { uuid: '7b93354a-fc3c-45ae-890a-8bcb5c294f55', fileName: '404.svg', fileType: 'image/svg+xml', path: 'static/error/404.svg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/error/404.svg', ext: '.svg', dir: 'static/error', ctime: '2018-03-30T06:10:45.814Z', size: 88876, }, { uuid: 'd2b741d4-206d-4be5-819d-3a00fd6895f0', fileName: '500.svg', fileType: 'image/svg+xml', path: 'static/error/500.svg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/error/500.svg', ext: '.svg', dir: 'static/error', ctime: '2018-03-30T06:10:45.818Z', size: 88720, }, { uuid: 'cf1cd0df-861e-4216-beba-c5fa266081dd', fileName: 'google.svg', fileType: 'image/svg+xml', path: 'static/google.svg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/google.svg', ext: '.svg', dir: 'static', ctime: '2018-03-30T06:10:12.693Z', size: 1574, }, { uuid: 'd145ac45-57b4-4754-a058-79bf42bb2963', fileName: 'manifest.json', fileType: 'application/json', path: 'static/manifest.json', fullPath: '/Users/michael/themeforest/vue-material-admin/static/manifest.json', ext: '.json', dir: 'static', ctime: '2018-03-14T09:21:32.018Z', size: 303, }, { uuid: '8b2ca729-a2eb-4950-855d-1dd3ce831765', fileName: 'robots.txt', fileType: 'text/plain', path: 'static/robots.txt', fullPath: '/Users/michael/themeforest/vue-material-admin/static/robots.txt', ext: '.txt', dir: 'static', ctime: '2018-03-14T09:21:32.021Z', size: 23, }, { uuid: 'e5a6e6f5-a9c8-49be-b2e2-c5074f4fa6c2', fileName: 'sitemap.xml', fileType: 'application/xml', path: 'static/sitemap.xml', fullPath: '/Users/michael/themeforest/vue-material-admin/static/sitemap.xml', ext: '.xml', dir: 'static', ctime: '2018-03-14T09:21:32.019Z', size: 15488, }, { uuid: '7cf65477-4aad-45de-924c-a38ded2471ef', fileName: 'v.png', fileType: 'image/png', path: 'static/v.png', fullPath: '/Users/michael/themeforest/vue-material-admin/static/v.png', ext: '.png', dir: 'static', ctime: '2018-03-14T09:21:32.023Z', size: 5674, }, { uuid: '5d333a3d-9140-4b8c-9ae3-9a8a96f0309e', fileName: 'v.svg', fileType: 'image/svg+xml', path: 'static/v.svg', fullPath: '/Users/michael/themeforest/vue-material-admin/static/v.svg', ext: '.svg', dir: 'static', ctime: '2018-03-14T09:21:32.017Z', size: 538, }, ] const getFile = limit => { return limit ? Items.slice(0, limit) : Items } export { getFileMenu, getFile }
{ "pile_set_name": "Github" }
import UIKit /// This delegate forces popover presentation even on iPhone / in compact size classes class ForcePopoverPresenter: NSObject, UIPopoverPresentationControllerDelegate { @objc static let presenter = ForcePopoverPresenter() fileprivate static let verticalPadding: CGFloat = 10 /// Configures a view controller to use a popover presentation style @objc static func configurePresentationControllerForViewController(_ controller: UIViewController, presentingFromView sourceView: UIView) { controller.modalPresentationStyle = .popover let presentationController = controller.popoverPresentationController presentationController?.permittedArrowDirections = .any presentationController?.sourceView = sourceView // Outset the source rect vertically to push the popover up / down a little // when displayed. Otherwise, when presented from a navigation controller // the top of the popover lines up perfectly with the bottom of the // navigation controller and looks a little odd presentationController?.sourceRect = sourceView.bounds.insetBy(dx: 0, dy: -verticalPadding) presentationController?.delegate = ForcePopoverPresenter.presenter controller.view.sizeToFit() } func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle { return .none } }
{ "pile_set_name": "Github" }
Highcharts.chart('container', { chart: { type: 'column', options3d: { enabled: true, alpha: 15, beta: 15, viewDistance: 25, depth: 40 } }, title: { text: 'Total fruit consumption, grouped by gender' }, xAxis: { categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'], labels: { skew3d: true, style: { fontSize: '16px' } } }, yAxis: { allowDecimals: false, min: 0, title: { text: 'Number of fruits', skew3d: true } }, tooltip: { headerFormat: '<b>{point.key}</b><br>', pointFormat: '<span style="color:{series.color}">\u25CF</span> {series.name}: {point.y} / {point.stackTotal}' }, plotOptions: { column: { stacking: 'normal', depth: 40 } }, series: [{ name: 'John', data: [5, 3, 4, 7, 2], stack: 'male' }, { name: 'Joe', data: [3, 4, 4, 2, 5], stack: 'male' }, { name: 'Jane', data: [2, 5, 6, 2, 1], stack: 'female' }, { name: 'Janet', data: [3, 0, 4, 4, 3], stack: 'female' }] });
{ "pile_set_name": "Github" }
<?php /** * @package admin * @subpackage jauthdb_admin * @author Laurent Jouanneau * @copyright 2009-2013 Laurent Jouanneau * @link http://jelix.org * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public Licence */ class passwordCtrl extends jController { public $sensitiveParameters = array('pwd', 'pwd_confirm'); public $pluginParams=array( '*' =>array('jacl2.rights.or'=>array('auth.users.change.password','auth.user.change.password')), ); protected function isPersonalView() { return !jAcl2::check('auth.users.change.password'); } function index(){ $login = $this->param('j_user_login'); if($login === null){ $rep = $this->getResponse('redirect'); $rep->action = 'master_admin~default:index'; return $rep; } $personalView = $this->isPersonalView(); if ($personalView && $login != jAuth::getUserSession()->login) { jMessage::add(jLocale::get('jacl2~errors.action.right.needed'), 'error'); $rep = $this->getResponse('redirect'); $rep->action = 'master_admin~default:index'; return $rep; } $rep = $this->getResponse('html'); $tpl = new jTpl(); $tpl->assign('id', $login); $tpl->assign('randomPwd', jAuth::getRandomPassword()); $tpl->assign('personalview', $personalView); if ($personalView) $tpl->assign('viewaction', 'user:index'); else $tpl->assign('viewaction', 'default:view'); $rep->body->assign('MAIN', $tpl->fetch('password_change')); return $rep; } /** * */ function update(){ $login = $this->param('j_user_login'); $pwd = $this->param('pwd'); $pwdconf = $this->param('pwd_confirm'); $rep = $this->getResponse('redirect'); $personalView = $this->isPersonalView(); if ($personalView && $login != jAuth::getUserSession()->login) { jMessage::add(jLocale::get('jacl2~errors.action.right.needed'), 'error'); $rep->action = 'master_admin~default:index'; return $rep; } if (trim($pwd) == '' || $pwd != $pwdconf) { jMessage::add(jLocale::get('crud.message.bad.password'), 'error'); $rep->action = 'password:index'; $rep->params['j_user_login'] = $login; return $rep; } if(jAuth::changePassword($login, $pwd)) { jMessage::add(jLocale::get('crud.message.change.password.ok', $login), 'notice'); if ($personalView) $rep->action = 'user:index'; else $rep->action = 'default:view'; $rep->params['j_user_login'] = $login; return $rep; } else{ jMessage::add(jLocale::get('crud.message.change.password.notok'), 'error'); $rep->action = 'password:index'; $rep->params['j_user_login'] = $login; } return $rep; } }
{ "pile_set_name": "Github" }
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow * @format */ 'use strict'; const AnimatedValue = require('./nodes/AnimatedValue'); const NativeAnimatedHelper = require('./NativeAnimatedHelper'); const ReactNative = require('../Renderer/shims/ReactNative'); const invariant = require('invariant'); const {shouldUseNativeDriver} = require('./NativeAnimatedHelper'); export type Mapping = {[key: string]: Mapping, ...} | AnimatedValue; export type EventConfig = { listener?: ?Function, useNativeDriver: boolean, }; function attachNativeEvent( viewRef: any, eventName: string, argMapping: $ReadOnlyArray<?Mapping>, ): {detach: () => void} { // Find animated values in `argMapping` and create an array representing their // key path inside the `nativeEvent` object. Ex.: ['contentOffset', 'x']. const eventMappings = []; const traverse = (value, path) => { if (value instanceof AnimatedValue) { value.__makeNative(); eventMappings.push({ nativeEventPath: path, animatedValueTag: value.__getNativeTag(), }); } else if (typeof value === 'object') { for (const key in value) { traverse(value[key], path.concat(key)); } } }; invariant( argMapping[0] && argMapping[0].nativeEvent, 'Native driven events only support animated values contained inside `nativeEvent`.', ); // Assume that the event containing `nativeEvent` is always the first argument. traverse(argMapping[0].nativeEvent, []); const viewTag = ReactNative.findNodeHandle(viewRef); if (viewTag != null) { eventMappings.forEach(mapping => { NativeAnimatedHelper.API.addAnimatedEventToView( viewTag, eventName, mapping, ); }); } return { detach() { if (viewTag != null) { eventMappings.forEach(mapping => { NativeAnimatedHelper.API.removeAnimatedEventFromView( viewTag, eventName, mapping.animatedValueTag, ); }); } }, }; } function validateMapping(argMapping, args) { const validate = (recMapping, recEvt, key) => { if (recMapping instanceof AnimatedValue) { invariant( typeof recEvt === 'number', 'Bad mapping of event key ' + key + ', should be number but got ' + typeof recEvt, ); return; } if (typeof recEvt === 'number') { invariant( recMapping instanceof AnimatedValue, 'Bad mapping of type ' + typeof recMapping + ' for key ' + key + ', event value must map to AnimatedValue', ); return; } invariant( typeof recMapping === 'object', 'Bad mapping of type ' + typeof recMapping + ' for key ' + key, ); invariant( typeof recEvt === 'object', 'Bad event of type ' + typeof recEvt + ' for key ' + key, ); for (const mappingKey in recMapping) { validate(recMapping[mappingKey], recEvt[mappingKey], mappingKey); } }; invariant( args.length >= argMapping.length, 'Event has less arguments than mapping', ); argMapping.forEach((mapping, idx) => { validate(mapping, args[idx], 'arg' + idx); }); } class AnimatedEvent { _argMapping: $ReadOnlyArray<?Mapping>; _listeners: Array<Function> = []; _callListeners: Function; _attachedEvent: ?{detach: () => void, ...}; __isNative: boolean; constructor(argMapping: $ReadOnlyArray<?Mapping>, config: EventConfig) { this._argMapping = argMapping; if (config == null) { console.warn('Animated.event now requires a second argument for options'); config = {useNativeDriver: false}; } if (config.listener) { this.__addListener(config.listener); } this._callListeners = this._callListeners.bind(this); this._attachedEvent = null; this.__isNative = shouldUseNativeDriver(config); } __addListener(callback: Function): void { this._listeners.push(callback); } __removeListener(callback: Function): void { this._listeners = this._listeners.filter(listener => listener !== callback); } __attach(viewRef: any, eventName: string) { invariant( this.__isNative, 'Only native driven events need to be attached.', ); this._attachedEvent = attachNativeEvent( viewRef, eventName, this._argMapping, ); } __detach(viewTag: any, eventName: string) { invariant( this.__isNative, 'Only native driven events need to be detached.', ); this._attachedEvent && this._attachedEvent.detach(); } __getHandler(): any | ((...args: any) => void) { if (this.__isNative) { if (__DEV__) { let validatedMapping = false; return (...args: any) => { if (!validatedMapping) { validateMapping(this._argMapping, args); validatedMapping = true; } this._callListeners(...args); }; } else { return this._callListeners; } } let validatedMapping = false; return (...args: any) => { if (__DEV__ && !validatedMapping) { validateMapping(this._argMapping, args); validatedMapping = true; } const traverse = (recMapping, recEvt, key) => { if (recMapping instanceof AnimatedValue) { if (typeof recEvt === 'number') { recMapping.setValue(recEvt); } } else if (typeof recMapping === 'object') { for (const mappingKey in recMapping) { /* $FlowFixMe(>=0.120.0) This comment suppresses an error found * when Flow v0.120 was deployed. To see the error, delete this * comment and run Flow. */ traverse(recMapping[mappingKey], recEvt[mappingKey], mappingKey); } } }; this._argMapping.forEach((mapping, idx) => { traverse(mapping, args[idx], 'arg' + idx); }); this._callListeners(...args); }; } _callListeners(...args: any) { this._listeners.forEach(listener => listener(...args)); } } module.exports = {AnimatedEvent, attachNativeEvent};
{ "pile_set_name": "Github" }
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // TTS api test for Chrome on ChromeOS. // browser_tests.exe --gtest_filter="TtsApiTest.*" chrome.test.runTests([ function testQueueInterrupt() { // In this test, two utterances are queued, and then a third // interrupts. The first gets interrupted, the second never gets spoken // at all. The test expectations in tts_extension_apitest.cc ensure that // the first call to tts.speak keeps going until it's interrupted. var callbacks = 0; chrome.tts.speak( 'text 1', { 'enqueue': true, 'onEvent': function(event) { chrome.test.assertEq('interrupted', event.type); callbacks++; } }, function() { chrome.test.assertNoLastError(); callbacks++; }); chrome.tts.speak( 'text 2', { 'enqueue': true, 'onEvent': function(event) { chrome.test.assertEq('cancelled', event.type); callbacks++; } }, function() { chrome.test.assertNoLastError(); callbacks++; }); chrome.tts.speak( 'text 3', { 'enqueue': false, 'onEvent': function(event) { chrome.test.assertEq('end', event.type); callbacks++; if (callbacks == 6) { chrome.test.succeed(); } else { chrome.test.fail(); } } }, function() { chrome.test.assertNoLastError(); callbacks++; }); } ]);
{ "pile_set_name": "Github" }
function varargout = threads(varargin) %VL_THREADS Control VLFeat computational threads % [NUM,MAXNUM] = VL_THREADS() returns the current number of % computational threads NUM and the maximum possible number MAXNUM. % % VL_THREADS(NUM) sets the current number of threads to the % specified value. NUM = VL_THREADS(NUM) does the same, but returns % the *previous* number of computational threads as well. % % See also: VL_HELP(). [varargout{1:nargout}] = vl_threads(varargin{:});
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>SchemeUserState</key> <dict> <key>备课代码-01-GCD的基本使用.xcscheme</key> <dict> <key>orderHint</key> <integer>0</integer> </dict> </dict> </dict> </plist>
{ "pile_set_name": "Github" }
#ifndef PQCLEAN_SPHINCSSHAKE256128SROBUST_CLEAN_FORS_H #define PQCLEAN_SPHINCSSHAKE256128SROBUST_CLEAN_FORS_H #include <stdint.h> #include "hash_state.h" #include "params.h" /** * Signs a message m, deriving the secret key from sk_seed and the FTS address. * Assumes m contains at least PQCLEAN_SPHINCSSHAKE256128SROBUST_CLEAN_FORS_HEIGHT * PQCLEAN_SPHINCSSHAKE256128SROBUST_CLEAN_FORS_TREES bits. */ void PQCLEAN_SPHINCSSHAKE256128SROBUST_CLEAN_fors_sign( unsigned char *sig, unsigned char *pk, const unsigned char *m, const unsigned char *sk_seed, const unsigned char *pub_seed, const uint32_t fors_addr[8], const hash_state *hash_state_seeded); /** * Derives the FORS public key from a signature. * This can be used for verification by comparing to a known public key, or to * subsequently verify a signature on the derived public key. The latter is the * typical use-case when used as an FTS below an OTS in a hypertree. * Assumes m contains at least PQCLEAN_SPHINCSSHAKE256128SROBUST_CLEAN_FORS_HEIGHT * PQCLEAN_SPHINCSSHAKE256128SROBUST_CLEAN_FORS_TREES bits. */ void PQCLEAN_SPHINCSSHAKE256128SROBUST_CLEAN_fors_pk_from_sig( unsigned char *pk, const unsigned char *sig, const unsigned char *m, const unsigned char *pub_seed, const uint32_t fors_addr[8], const hash_state *hash_state_seeded); #endif
{ "pile_set_name": "Github" }
/* * lis3lv02d_spi - SPI glue layer for lis3lv02d * * Copyright (c) 2009 Daniel Mack <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * publishhed by the Free Software Foundation. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/err.h> #include <linux/input.h> #include <linux/interrupt.h> #include <linux/workqueue.h> #include <linux/spi/spi.h> #include <linux/pm.h> #include <linux/of.h> #include <linux/of_platform.h> #include <linux/of_device.h> #include "lis3lv02d.h" #define DRV_NAME "lis3lv02d_spi" #define LIS3_SPI_READ 0x80 static int lis3_spi_read(struct lis3lv02d *lis3, int reg, u8 *v) { struct spi_device *spi = lis3->bus_priv; int ret = spi_w8r8(spi, reg | LIS3_SPI_READ); if (ret < 0) return -EINVAL; *v = (u8) ret; return 0; } static int lis3_spi_write(struct lis3lv02d *lis3, int reg, u8 val) { u8 tmp[2] = { reg, val }; struct spi_device *spi = lis3->bus_priv; return spi_write(spi, tmp, sizeof(tmp)); } static int lis3_spi_init(struct lis3lv02d *lis3) { u8 reg; int ret; /* power up the device */ ret = lis3->read(lis3, CTRL_REG1, &reg); if (ret < 0) return ret; reg |= CTRL1_PD0 | CTRL1_Xen | CTRL1_Yen | CTRL1_Zen; return lis3->write(lis3, CTRL_REG1, reg); } static union axis_conversion lis3lv02d_axis_normal = { .as_array = { 1, 2, 3 } }; #ifdef CONFIG_OF static const struct of_device_id lis302dl_spi_dt_ids[] = { { .compatible = "st,lis302dl-spi" }, {} }; MODULE_DEVICE_TABLE(of, lis302dl_spi_dt_ids); #endif static int lis302dl_spi_probe(struct spi_device *spi) { int ret; spi->bits_per_word = 8; spi->mode = SPI_MODE_0; ret = spi_setup(spi); if (ret < 0) return ret; lis3_dev.bus_priv = spi; lis3_dev.init = lis3_spi_init; lis3_dev.read = lis3_spi_read; lis3_dev.write = lis3_spi_write; lis3_dev.irq = spi->irq; lis3_dev.ac = lis3lv02d_axis_normal; lis3_dev.pdata = spi->dev.platform_data; #ifdef CONFIG_OF if (of_match_device(lis302dl_spi_dt_ids, &spi->dev)) { lis3_dev.of_node = spi->dev.of_node; ret = lis3lv02d_init_dt(&lis3_dev); if (ret) return ret; } #endif spi_set_drvdata(spi, &lis3_dev); return lis3lv02d_init_device(&lis3_dev); } static int lis302dl_spi_remove(struct spi_device *spi) { struct lis3lv02d *lis3 = spi_get_drvdata(spi); lis3lv02d_joystick_disable(lis3); lis3lv02d_poweroff(lis3); return lis3lv02d_remove_fs(&lis3_dev); } #ifdef CONFIG_PM_SLEEP static int lis3lv02d_spi_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); struct lis3lv02d *lis3 = spi_get_drvdata(spi); if (!lis3->pdata || !lis3->pdata->wakeup_flags) lis3lv02d_poweroff(&lis3_dev); return 0; } static int lis3lv02d_spi_resume(struct device *dev) { struct spi_device *spi = to_spi_device(dev); struct lis3lv02d *lis3 = spi_get_drvdata(spi); if (!lis3->pdata || !lis3->pdata->wakeup_flags) lis3lv02d_poweron(lis3); return 0; } #endif static SIMPLE_DEV_PM_OPS(lis3lv02d_spi_pm, lis3lv02d_spi_suspend, lis3lv02d_spi_resume); static struct spi_driver lis302dl_spi_driver = { .driver = { .name = DRV_NAME, .pm = &lis3lv02d_spi_pm, .of_match_table = of_match_ptr(lis302dl_spi_dt_ids), }, .probe = lis302dl_spi_probe, .remove = lis302dl_spi_remove, }; module_spi_driver(lis302dl_spi_driver); MODULE_AUTHOR("Daniel Mack <[email protected]>"); MODULE_DESCRIPTION("lis3lv02d SPI glue layer"); MODULE_LICENSE("GPL"); MODULE_ALIAS("spi:" DRV_NAME);
{ "pile_set_name": "Github" }
.text .global dsofn4 .type dsofn4,@function dsofn4: lapc _GLOBAL_OFFSET_TABLE_,$r0 addo.w expobj:GOT16,$r0,$acr bsr dsofn4:PLT nop .Lfe1: .size dsofn4,.Lfe1-dsofn4
{ "pile_set_name": "Github" }
#include <signal.h> #include "syscall.h" int sigpending(sigset_t *set) { return syscall(SYS_rt_sigpending, set, _NSIG/8); }
{ "pile_set_name": "Github" }
【 文献号 】1-3920 【原文出处】中国体育报 【原刊地名】京 【原刊期号】19950629 【原刊页号】⑴ 【分 类 号】G8 【分 类 名】体育 【 作 者 】李铁映 【复印期号】199507 【 标 题 】为大力增强全国人民的体魄而奋斗 ――李铁映同志在颁布实施《全民健身计划纲要》动员大会上的讲话 【 正 文 】 同志们、朋友们: 经国务院批准,《全民健身计划纲要》正式颁布实施了。这个计划是一个由国家领导、社会支持、全民参与,有目标、有任务、有措施的 体育健身计划,是与实现社会主义现代化目标相配套的社会系统工程和面向21世纪的发展战略规划。《全民健身计划纲要》的产生,是我国 社会生活中的一件大事,是一项功在当代、利在千秋的伟大事业。它充分反映了我们党和国家全心全意为人民服务的根本宗旨,集中表达了全 国各族人民要求发展体育事业、增强人民体质的共同愿望。我相信通过宣传、推广、实施全民健身计划,对于提高中华民族整体素质,建立科 学、文明、健康的生活方式,促进社会安定团结,推动社会主义精神文明和物质文明建设都将产生积极作用和深远影响。 邓小平同志曾明确指出,体育方面主要是群众体育,体委应该主要在这方面搞好。1993年江泽民总书记“发展体育运动,为建设有中 国特色的社会主义服务”的题词,明确提出了体育工作要为党的基本路线服务、为社会主义建设事业服务、为人民服务的宗旨。在今年3月全 国人大八届三次会议上,李鹏总理在《政府工作报告》中也强调:“体育工作要坚持群众体育和竞技体育协调发展的方针,把发展群众体育, 推行全民健身计划,普遍增强国民体质作为重点。”进一步明确了新时期体育工作的发展方向和重点。国家体委按照党的十四大和十四届三中 全会的精神,在总结四十多年群体工作经验的基础上,适应建立社会主义市场经济体制的要求,制定了全民健身计划,与之相配套的还有奥运 争光计划。这两个计划是新的历史时期发展体育事业的重大战略举措,为体育事业的发展勾画了一个比较清晰的蓝图。两个计划的关系是相辅 相成,相互促进的,体现了普及与提高的辩证统一。全民健身计划是国富民强的基础,奥运争光计划是综合国力的重要体现。实施两个计划, 将更有力地促进体育事业健康发展。 我国体育事业的发展规模和发展水平是举世瞩目的。但是,我国经济建设和社会发展对人民的整体素质提出了新的更高要求,人民的健康 状况还不能适应社会主义现代化建设的需要。社会成员的体育意识和健康意识还不够强,经常参加体育锻炼的人数还不够多,社会各方面对国 民体质建设的投入较少,群众进行体育锻炼的场地设施和其它物质条件还明显不足,适应社会主义市场经济体制要求、依托社会的全民健身管 理体制和运行机制还在探索之中,有待于进一步完善。国务院批准颁布实施《全民健身计划纲要》正是为了更好地解决这些问题。 经过近两年广泛征求意见、反复修改制定的《全民健身计划纲要》,是集中了几十年群体工作的经验和广大群众的智慧而产生的。它是一 个战略方针,提出了全民健身总的目标和任务,原则上确定了实施的对策和步骤。全民健身计划的重点在基层,需要各地在实施这个战略方针 的过程中,不断加以完善和创造。有了一个好的计划,关键在于贯彻、落实。将宏伟的目标变为现实,把战略方针付诸实际行动,必须付出艰 苦的努力,做大量扎实细致的工作。下面我就实施《全民健身计划纲要》提出几点要求: 一、提高认识,转变观念。 在我国,提高全民素质,培养和造就人才,一直是中国共产党领导下的革命和建设的重要经验。全民健身能给亿万人民带来健康,全民健 身关系到民族的振兴,人民的幸福。各级政府特别是体育部门,一定要不断加深对体育的认识,努力增强贯彻实施《全民健身计划纲要》的自 觉性,把它作为一件大事抓好。 随着社会经济的发展和人们生活水平的提高,人们越来越重视对体育的投入。为健康投资已成为一种现代意识、时代潮流。目前,我国群 众的体育健身意识还需要增强。在对全国100个国有企业的调查中,仅有百分之十点四的人参加体育锻炼,人们对体育的认识,还需要在观 念上进行转化。物质条件好了,精神生活丰富了,还得有健康的体魄,生活才能幸福美满。要认识到体育不仅是消费,也是一种重要的社会和 个人健康投资。应该鼓励和提倡这种观念。为广大人民群众创造更好的条件,发动全国人民参加体育锻炼,为全民族具有健康的体魄、坚强的 体质而奋斗,应该成为各级政府、各级体育部门和社会各界神圣的职责。 二、在改革体制、转换机制上下功夫。 改革是体育事业发展的动力。不解放思想大胆改革,全民健身计划就不能很好落实。要努力探索与社会主义市场经济相适应、符合现代体 育发展规律、不断满足广大人民群众日益增长的健身需求的新路子。目前的体育管理体制,还有许多地方不适应体育事业发展的要求,要转变 体育行政部门的职能,加强宏观调控,从“办体育”向“管体育”转变。要切实抓好基层的全民健身工作,坚持社会化方向,充分发挥群众社 团的作用,吸引更多的群众投身到体育活动中去,形成一种社会化的人民群众积极参与的体制和运行机制。 三、狠抓队伍建设、提高体育工作者的素质。 在当前建立社会主义市场经济体制的新形势下,体育工作比过去复杂得多,涉及的领域越来越广,对体育工作者的要求也越来越高。要适 应新形势,必须努力提高体育队伍的素质。因此要加强干部的培训工作,就贯彻《全民健身计划纲要》,举办各级体育干部的专题培训班,通 过学习和实践,提高理论、知识水平和工作能力,造就一支高素质的体育干部队伍,保证全民健身计划的贯彻落实,推动体育事业全面发展。 四、加强体育场馆建设和管理,坚持面向社会、面向群众开放。 体育场馆设施是贯彻全民健身计划的物质保障。我国的体育场馆虽然有很大发展,但只有人均0.5平方米,与发达的西方国家相比差距 很大。现有的体育场馆,由于管理体制问题,不少场馆还是按过去计划经济的一套办,不能很好地向社会开放,有的场馆则变成了家具城,不 能充分利用现有体育设施资源。当务之急是改革现有体育场地的管理体制和管理办法,尽快向全社会开放,面向社会,面向群众,充分发挥它 的功能和效率,为广大群众参与健身活动创造良好的环境和条件。一定要在一、二年之内使所有的场馆真正向社会开放。 五、领导重视,广泛发动,全面落实。 贯彻实施《全民健身计划纲要》决不是体育部门一家的事。应在国务院领导下,由国家体委会同有关部门、各群众组织和社会团体共同推 行。各级政府、各有关部门、群众组织和社会团体要高度重视,加强领导,广泛宣传发动,全面贯彻落实。要因地制宜,从实际出发,采取群 众喜爱的多种形式;要抓好试点,探索路子,发挥各自的优势,创造性地工作。 同志们,一项提高中华民族身体素质的伟大工程已经开始启动。时代和人民赋予我们历史使命,要通过我们艰苦努力,把中华民族的整体 素质提高到一个新水平,使中华民族以强健的体魄、昂扬的斗志,自立于21世纪的世界民族之林。让我们紧密团结在以江泽民同志为核心的 党中央周围,以邓小平同志建设有中国特色的社会主义理论和党的基本路线为指导,艰苦奋斗,拼搏开拓,为增强人民体质而奋斗,为中华民 族的繁荣昌盛做出我们应有的贡献!
{ "pile_set_name": "Github" }
$OpenBSD$ +----------------------------------------------------------------------- | Running ${FULLPKGNAME} on OpenBSD +----------------------------------------------------------------------- OpenJazz ======== OpenJazz requires the original game files from Jazz Jackrabbit to work properly. These can come from an original CD or from GOG.com. If using the GOG.com version, you must extract the files from setup_jazz_jackrabbit_2.0hf_(16882).exe using the innoextract package. The files will be in a directory named app. You must keep this directory, though it can be renamed and moved to a location of your choosing, and you can delete everything else that is extracted from the exe, such as the tmp directory.
{ "pile_set_name": "Github" }
# Translation of Odoo Server. # This file contains the translation of the following modules: # * base_import_module # # Translators: # Martin Trigaux, 2020 # Hamid Darabi, 2020 # Hamed Mohammadi <[email protected]>, 2020 # msgid "" msgstr "" "Project-Id-Version: Odoo Server saas~12.5\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-08-26 08:16+0000\n" "PO-Revision-Date: 2019-08-26 09:09+0000\n" "Last-Translator: Hamed Mohammadi <[email protected]>, 2020\n" "Language-Team: Persian (https://www.transifex.com/odoo/teams/41243/fa/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Language: fa\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. module: base_import_module #: model_terms:ir.ui.view,arch_db:base_import_module.view_base_module_import msgid "Cancel" msgstr "لغو" #. module: base_import_module #: model_terms:ir.ui.view,arch_db:base_import_module.view_base_module_import msgid "Close" msgstr "بستن" #. module: base_import_module #: code:addons/base_import_module/controllers/main.py:0 #, python-format msgid "Could not select database '%s'" msgstr "" #. module: base_import_module #: model:ir.model.fields,field_description:base_import_module.field_base_import_module__create_uid msgid "Created by" msgstr "ایجاد شده توسط" #. module: base_import_module #: model:ir.model.fields,field_description:base_import_module.field_base_import_module__create_date msgid "Created on" msgstr "ایجاد شده در" #. module: base_import_module #: model:ir.model.fields,field_description:base_import_module.field_base_import_module__display_name msgid "Display Name" msgstr "نام نمایشی" #. module: base_import_module #: code:addons/base_import_module/models/ir_module.py:0 #, python-format msgid "File '%s' exceed maximum allowed file size" msgstr "" #. module: base_import_module #: model:ir.model.fields,field_description:base_import_module.field_base_import_module__force msgid "Force init" msgstr "" #. module: base_import_module #: model:ir.model.fields,help:base_import_module.field_base_import_module__force msgid "" "Force init mode even if installed. (will update `noupdate='1'` records)" msgstr "" #. module: base_import_module #: model:ir.model.fields,field_description:base_import_module.field_base_import_module__id msgid "ID" msgstr "شناسه" #. module: base_import_module #: model_terms:ir.ui.view,arch_db:base_import_module.view_base_module_import msgid "Import App" msgstr "" #. module: base_import_module #: model:ir.model.fields,field_description:base_import_module.field_base_import_module__import_message msgid "Import Message" msgstr "" #. module: base_import_module #: model:ir.actions.act_window,name:base_import_module.action_view_base_module_import #: model:ir.model,name:base_import_module.model_base_import_module #: model:ir.ui.menu,name:base_import_module.menu_view_base_module_import #: model_terms:ir.ui.view,arch_db:base_import_module.view_base_module_import msgid "Import Module" msgstr "" #. module: base_import_module #: model_terms:ir.ui.view,arch_db:base_import_module.view_base_module_import msgid "Import module" msgstr "درونش ماژول" #. module: base_import_module #: model:ir.model.fields,field_description:base_import_module.field_ir_module_module__imported msgid "Imported Module" msgstr "" #. module: base_import_module #: model:ir.model.fields,field_description:base_import_module.field_base_import_module____last_update msgid "Last Modified on" msgstr "آخرین تغییر در" #. module: base_import_module #: model:ir.model.fields,field_description:base_import_module.field_base_import_module__write_uid msgid "Last Updated by" msgstr "آخرین تغییر توسط" #. module: base_import_module #: model:ir.model.fields,field_description:base_import_module.field_base_import_module__write_date msgid "Last Updated on" msgstr "آخرین به روز رسانی در" #. module: base_import_module #: model:ir.model,name:base_import_module.model_ir_module_module msgid "Module" msgstr "ماژول" #. module: base_import_module #: model:ir.model.fields,field_description:base_import_module.field_base_import_module__module_file msgid "Module .ZIP file" msgstr "پرونده ZIP. پیمانه" #. module: base_import_module #: code:addons/base_import_module/models/ir_module.py:0 #, python-format msgid "No file sent." msgstr "" #. module: base_import_module #: model_terms:ir.ui.view,arch_db:base_import_module.view_base_module_import msgid "Note: you can only import data modules (.xml files and static assets)" msgstr "" #. module: base_import_module #: code:addons/base_import_module/controllers/main.py:0 #, python-format msgid "Only administrators can upload a module" msgstr "" #. module: base_import_module #: code:addons/base_import_module/models/ir_module.py:0 #, python-format msgid "Only zip files are supported." msgstr "" #. module: base_import_module #: model_terms:ir.ui.view,arch_db:base_import_module.view_base_module_import msgid "Open Modules" msgstr "" #. module: base_import_module #: model_terms:ir.ui.view,arch_db:base_import_module.view_base_module_import msgid "Select module package to import (.zip file):" msgstr "" #. module: base_import_module #: model:ir.model.fields,field_description:base_import_module.field_base_import_module__state msgid "Status" msgstr "وضعیت" #. module: base_import_module #: code:addons/base_import_module/models/ir_module.py:0 #, python-format msgid "Studio customizations require Studio" msgstr "" #. module: base_import_module #: code:addons/base_import_module/models/ir_module.py:0 #, python-format msgid "Studio customizations require the Odoo Studio app." msgstr "" #. module: base_import_module #: code:addons/base_import_module/models/ir_module.py:0 #, python-format msgid "" "Unmet module dependencies: \n" "\n" " - %s" msgstr "" #. module: base_import_module #: model:ir.model,name:base_import_module.model_ir_ui_view msgid "View" msgstr "نما" #. module: base_import_module #: model:ir.model.fields.selection,name:base_import_module.selection__base_import_module__state__done msgid "done" msgstr "انجام شد" #. module: base_import_module #: model:ir.model.fields.selection,name:base_import_module.selection__base_import_module__state__init msgid "init" msgstr ""
{ "pile_set_name": "Github" }
//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // <complex> // template<class T> // T // real(const complex<T>& x); #include <complex> #include <cassert> template <class T> void test() { std::complex<T> z(1.5, 2.5); assert(real(z) == 1.5); } int main(int, char**) { test<float>(); test<double>(); test<long double>(); return 0; }
{ "pile_set_name": "Github" }
#include "p2p/Signable.hxx" using namespace p2p; using namespace s2c; s2c::SignatureStruct * Signable::sign(const std::vector<resip::Data> &signableData) { SignatureStruct *sig = new SignatureStruct; sig->mAlgorithm = new SignatureAndHashAlgorithmStruct(); sig->mIdentity = new SignerIdentityStruct(); sig->mIdentity->mIdentityType = signer_identity_peer; return sig; }
{ "pile_set_name": "Github" }
// Copyright 2013 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 or at // https://developers.google.com/open-source/licenses/bsd. package httputil import ( "github.com/golang/gddo/httputil/header" "net/http" "strings" ) // NegotiateContentEncoding returns the best offered content encoding for the // request's Accept-Encoding header. If two offers match with equal weight and // then the offer earlier in the list is preferred. If no offers are // acceptable, then "" is returned. func NegotiateContentEncoding(r *http.Request, offers []string) string { bestOffer := "identity" bestQ := -1.0 specs := header.ParseAccept(r.Header, "Accept-Encoding") for _, offer := range offers { for _, spec := range specs { if spec.Q > bestQ && (spec.Value == "*" || spec.Value == offer) { bestQ = spec.Q bestOffer = offer } } } if bestQ == 0 { bestOffer = "" } return bestOffer } // NegotiateContentType returns the best offered content type for the request's // Accept header. If two offers match with equal weight, then the more specific // offer is preferred. For example, text/* trumps */*. If two offers match // with equal weight and specificity, then the offer earlier in the list is // preferred. If no offers match, then defaultOffer is returned. func NegotiateContentType(r *http.Request, offers []string, defaultOffer string) string { bestOffer := defaultOffer bestQ := -1.0 bestWild := 3 specs := header.ParseAccept(r.Header, "Accept") for _, offer := range offers { for _, spec := range specs { switch { case spec.Q == 0.0: // ignore case spec.Q < bestQ: // better match found case spec.Value == "*/*": if spec.Q > bestQ || bestWild > 2 { bestQ = spec.Q bestWild = 2 bestOffer = offer } case strings.HasSuffix(spec.Value, "/*"): if strings.HasPrefix(offer, spec.Value[:len(spec.Value)-1]) && (spec.Q > bestQ || bestWild > 1) { bestQ = spec.Q bestWild = 1 bestOffer = offer } default: if spec.Value == offer && (spec.Q > bestQ || bestWild > 0) { bestQ = spec.Q bestWild = 0 bestOffer = offer } } } } return bestOffer }
{ "pile_set_name": "Github" }