text
stringlengths
2
99.9k
meta
dict
"============================================================================= " FILE: converter_remove_last_paren.vim " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> " License: MIT license {{{ " 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. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplete#filters#converter_remove_last_paren#define() abort "{{{ return s:converter endfunction"}}} let s:converter = { \ 'name' : 'converter_remove_last_paren', \ 'description' : 'remove last parenthesis', \} function! s:converter.filter(context) abort "{{{ for candidate in a:context.candidates let candidate.word = \ substitute(candidate.word, '[\[<({]$', '', '') endfor return a:context.candidates endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker
{ "pile_set_name": "Github" }
# DTTableViewManager/DTCollectionViewManager 6.0 Migration Guide DTTableViewManager and DTCollectionViewManager 6.0 are the latest major releases of UITableView/UICollectionView helper libraries for iOS and tvOS written in Swift. Following [Semantic Versioning conventions](https://semver.org), 6.0 introduces API-breaking changes. This guide is provided in order to ease the transition of existing applications using 5.x versions to the latest APIs, as well as explain the design and structure of new and updated functionality. - [Requirements](#requirements) - [Benefits of Upgrading](#benefits-of-upgrading) - [Breaking API Changes](#breaking-api-changes) - [Delegate implementations](#delegate-implementations) - [Realm storage](#realm-storage) - [Other breaking changes](#other-breaking-changes) - [New Features](#new-features) - [Backwards compatibility](#backwards-compatibility) - [Drag and Drop](#drag-and-drop) - [Improvements to events system](#improvements-to-events-system) - [Conditional mappings](#conditional-mappings) - [Improved Carthage support](#improved-carthage-support) - [Miscellaneous stuff](#miscellaneous-stuff) ## Requirements - iOS 8.0+ / tvOS 9.0+ - Xcode 8.3+/ Xcode 9.x - Swift 3.1/3.2/4.0 ## Benefits of Upgrading - **Compatibility with Xcode 8 / Xcode 9, as well as Swift 3.x/4.x**. - **Support for Drag&Drop in iOS 11**, including convenience handling for `MemoryStorage`. - **Improvements to events system** provide compile-time safety for events registration and lots of new events. - **Conditional mappings** provide a powerful way of customizing your view mappings. - **Improved Carthage support** will now include prebuilt binaries, attached via GitHub releases. ## Breaking API Changes Compared to last year's massive Swift 3 changes, this year breaking API changes are relatively small, and in most cases should not affect a lot of users, and should not require a lot of time to migrate to. ### Delegate implementations In all previous releases, `DTTableViewManager` and `DTCollectionViewManager` were objects, that implemented datasource and delegate methods. In 6.x, number of protocols implemented doubled due to Drag&Drop, which is why implementations of those protocols has been moved to those classes: - `UITableViewDataSource` -> `DTTableViewDataSource` - `UITableViewDelegate` -> `DTTableViewDelegate` - `UITableViewDragDelegate` -> `DTTableViewDragDelegate` - `UITableViewDropDelegate` -> `DTTableViewDropDelegate` - `UICollectionViewDataSource` -> `DTCollectionViewDataSource` - `UICollectionViewDelegate` -> `DTCollectionViewDelegate` - `UICollectionViewDropDelegate` -> `DTCollectionViewDropDelegate` - `UICollectionViewDragDelegate` -> `DTCollectionViewDragDelegate` As a consequence, `DTTableViewManager` and `DTCollectionViewManager` no longer implement any of those datasource and delegate methods. If you relied on this fact, or have subclasses or extensions of `DTTableViewManager` or `DTCollectionViewManager`, you should subclass or extend new classes instead. ### Realm Storage `RealmStorage` class is a `Storage` implementation for [Realm database](https://realm.io). It is great to have the ability to work independently with in-memory datasources, CoreData datasources, or Realm datasources. What's not great, is wait times if you use Carthage. `RealmSwift` framework, even in zipped prebuilt binary form, is 250 Mb in size. That's a lot even if you use some form of Carthage cache. And this penalty is applied to all `DTTableViewManager` Carthage users, even if they don't use Realm at all. So, starting with 6.0, `RealmStorage` extension will not be made available through Carthage. If you use `CocoaPods`, `RealmStorage` is still available via a subspec, and as for Carthage users - for now I can recommend only copy pasting Realm classes into your projects, and depending on Realm-Cocoa directly. If Carthage developers ever decide to implement subspec-like functionality, I'll be happy to bring those classes back. Another hope is Carthage `Ignorefile`, that is currently in development - https://github.com/Carthage/Carthage/pull/1990, if this will be implemented, `RealmStorage` will be once again made available through Carthage. ### Other breaking changes * `MemoryStorage` method `setItems(_:)`, that accepted array of arrays of items, was renamed to `setItemsForAllSections` to provide more clarity and eliminate possibility of calling `setItems(_:forSection:)` that has identical signature. * Signature of `move(_:_:)` method has been changed to make it consistent with other events. Arguments received in closure are now: `(destinationIndexPath: IndexPath, cell: T, model: T.ModelType, sourceIndexPath: IndexPath)` * `tableView(UITableView, moveRowAt: IndexPath, to: IndexPath)` no longer automatically moves items, if current storage is `MemoryStorage`. Please use `MemoryStorage` convenience method `moveItemWithoutAnimation(from:to:)` to move items manually. ## New Features ### Backwards compatibility Usually backwards compatibility is not considered a "feature", but since last year Swift 3 migration was huge and painful, maintaining backwards compatibility is actually pretty important. 6.x release contains several CI jobs setup to ensure compatibility with operating systems, Xcode releases and Swift compilers. Supported releases include: * **iOS 8.x - iOS 11.x, tvOS 9.0 - tvOS 11.x** * **Xcode 8.3, Xcode 9.0** * **Swift 3.1, 3.2, 4.0** ### Drag and Drop [Drag&Drop in iOS 11](https://developer.apple.com/ios/drag-and-drop) is a huge topic, that has 4 WWDC sessions, dedicated to it. I highly recommend checking all 4 of those sessions out before implementing support for Drag&Drop in your app. `DTTableViewManager` and `DTCollectionViewManager` gained **28** new events for Drag&Drop delegate methods. Those methods, as usual, are named almost identical to original delegate methods. There is also special support for `UITableView` and `UICollectionView` placeholders. New convenience classes `DTTableViewDropPlaceholderContext` and `DTCollectionViewDropPlaceholderContext` serve as thin wrappers around `UITableViewDropPlaceholderContext` and `UICollectionViewDropPlaceholderContext`, automatically dispatching placeholder updates to `DispatchQueue.main`, and providing automatic datasource updates if you are using `MemoryStorage` class. To demonstrate `Drag&Drop` usage with `DTTableViewManager` and `DTCollectionViewManager` there's a new example repo - [https://github.com/DenTelezhkin/DTDragAndDropExample](https://github.com/DenTelezhkin/DTDragAndDropExample), containing [Apple's sample on Drag&Drop](https://developer.apple.com/sample-code/wwdc/2017/Drag-and-Drop-in-UICollectionView-and-UITableView.zip), rewritten using `DTTableViewManager` and `DTCollectionViewManager`. ### Improvements to events system Back in 4.x release, there were only 6 events implemented. 5.x release introduced support for 37 `UITableView` events, and 27 `UICollectionView` events. 6.x release boosts this system to whole new level. `DTTableViewManager` now has **61** event, that cover all delegate and datasource protocols `UITableView` has. `DTCollectionViewManager` now has **54** events, which brings total number of events to crazy **115**, if you count events for entire system :tada:. New events include iOS 11 API, as well as some iOS 9 and iOS 10 API, that was missed or was not implemented previously. If you are afraid of perfomance hit this may imply on your app - don't worry. Both `DTTableViewManager` and `DTCollectionViewManager` intelligently tell `UITableView` and `UICollectionView` only about events and methods, that are being actually used, which means that there's no perfomance cost needed to be paid for additional events. Events system also got one really small improvement, that is partially experimental, however it may have huge impact on how events are registered. For example, if you wanted to register a cell, that uses Int as a data model, and then event that calculates estimated height for this cell, it would look similar to this: ```swift manager.register(IntCell.self) manager.estimatedHeight(for: Int.self) { _,_ in return 44 } ``` Notice that for registration we pass Cell type, and for estimated height event we are actually passing Model type instead of cell. Why is that? Well, this is actually because for estimated height calculation cell is not yet created, and we can't possibly know it's type. There's about 1/3 of events, that use the same pattern - cell is not created, therefore let's use data model. This approach, however, has a big logic problem. What happens if `IntCell` changes it's model to be `NSNumber` for example? The code will compile without issues, however event will not get triggered, because there's no event registered for NSNumber. `DTTableViewManager` and `DTCollectionViewManager` 6.x introduce a new way of registering events, that works like so: ```swift manager.configureEvents(for: IntCell.self) { cellType, modelType in manager.register(cellType) manager.estimatedHeight(for: modelType) { _,_ in return 44 } } ``` `configureEvents` is a simple method, that immediately calls closure of `(T.Type, T.ModelType.Type) -> Void`, and you can use both cellType and modelType inside this closure to register events. This way, when `IntCell` changes it's model to `NSNumber`, you don't need to change anything in event registration code, it will just work. And more importantly - this provides compile-time safety for all cell and model types, that are participating in events system. ### Conditional mappings Previously, if you needed to customize mappings based on some condition, you would use `ViewModelMappingCustomizing` protocol. For example, if you wanted to have different cell mappings for two different sections, you may have done something like this: ```swift extension MyViewController: ViewModelMappingCustomizing { func viewModelMapping(fromCandidates candidates: [ViewModelMapping], forModel model: Any) -> ViewModelMapping? { if let indexPathInSection = manager.memoryStorage.indexPath(forItem: model) { switch indexPathInSection.section { case 0: return candidates.first case 1: return candidates[1] default: return nil } return nil } } } ``` This has a lot of buggy and crashy potential. First of all, there's no indication that this model should resolve to cell - this may be a model for header or footer. Second - there's no indexPath, we have to guess from where this model is coming from. And this approach also relies on implicit order of mapping candidates, which is very unstable. Starting with 6.x, this functionality is soft-deprecated, and replaced with new, much more powerful conditional mappings. Here's how you would implement the same thing with new API: ```swift manager.register(FirstSectionCell.self) { mapping in mapping.condition = .section(0) } manager.register(SectionSectionCell.self) { mapping in mapping.condition = .section(1) } ``` Is is much simpler, and much more readable. Conditional mappings have three possible behaviors - `.none` allows mappings everywhere, `.section` allows mapping to be tied to specific section, and also there is `.custom` for everything else. For example, if want your mapping to work only for Int models, that are larger than 2, here's how you would implement it: ```swift manager.register(ComplexConditionCell.self) { mapping in mapping.condition = .custom({ indexPath, model in guard let model = model as? Int else { return false } return model > 2 }) } ``` `.custom` case has a closure of type `(IndexPath,Any) -> Bool` which allows you to customize mapping as you want. Apart from condition, you can also change `reuseIdentifier` to be used for mappings. This is rare case, however if you want for example to use different XIBs for the same cell class in different sections, you would need to do this: ```swift manager.register(NibCell.self) { mapping in mapping.condition = .section(0) mapping.reuseIdentifier = "NibCell One" } controller.manager.registerNibNamed("CustomNibCell", for: NibCell.self) { mapping in mapping.condition = .section(1) mapping.reuseIdentifier = "NibCell Two" } ``` This is needed because even though mappings are stored on `DTTableViewManager` instance, `UITableView` actually has no idea we are pulling such tricks, and when we'll try to dequeue cell based on reuseIdentifier, if we use the same reuseIdentifier, second mapping will simply be erased from `UITableView` memory. But since we are able to use two different reuseIdentifiers, we are golden :100:. ### Improved Carthage support Thanks to dropping `Realm` dependency from `DTModelStorage`, build times should be significantly faster for Carthage users. To improve this even more, starting with 6.x release, prebuilt binaries will be now made available as a part of GitHub release for `DTModelStorage`, `DTTableViewManager` and `DTCollectionViewManager`. Prebuilt binaries will only be compiled using latest version of compiler, so for example for Xcode 9.0 it will be Swift 4.0 compiler. ### Miscellaneous stuff There's quite a few of small improvements in 6.x releases, that can be useful. For example, there's a new `updateVisibleCells(_:)` method on `DTTableViewManager` and `DTCollectionViewManager`, that allows you to update only visible on screen cells, which can be a big improvement over calling `reloadData`, if your models change, but their quantity does not change. `MemoryStorage` now has `moveItemWithoutAnimation(from:to:)` method, that can be used when reordering items. There is now `DTTableViewOptionalManageable` protocol, that allows you to have outlet of `UITableView` declared as optional `UITableView?`. There's also `DTCollectionViewNonOptionalManageable` protocol for `UICollectionView!`.
{ "pile_set_name": "Github" }
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,linux package unix const ( SizeofPtr = 0x8 SizeofShort = 0x2 SizeofInt = 0x4 SizeofLong = 0x8 SizeofLongLong = 0x8 PathMax = 0x1000 ) type ( _C_short int16 _C_int int32 _C_long int64 _C_long_long int64 ) type Timespec struct { Sec int64 Nsec int64 } type Timeval struct { Sec int64 Usec int64 } type Timex struct { Modes uint32 Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 Constant int64 Precision int64 Tolerance int64 Time Timeval Tick int64 Ppsfreq int64 Jitter int64 Shift int32 Stabil int64 Jitcnt int64 Calcnt int64 Errcnt int64 Stbcnt int64 Tai int32 _ [44]byte } type Time_t int64 type Tms struct { Utime int64 Stime int64 Cutime int64 Cstime int64 } type Utimbuf struct { Actime int64 Modtime int64 } type Rusage struct { Utime Timeval Stime Timeval Maxrss int64 Ixrss int64 Idrss int64 Isrss int64 Minflt int64 Majflt int64 Nswap int64 Inblock int64 Oublock int64 Msgsnd int64 Msgrcv int64 Nsignals int64 Nvcsw int64 Nivcsw int64 } type Rlimit struct { Cur uint64 Max uint64 } type _Gid_t uint32 type Stat_t struct { Dev uint64 Ino uint64 Nlink uint64 Mode uint32 Uid uint32 Gid uint32 _ int32 Rdev uint64 Size int64 Blksize int64 Blocks int64 Atim Timespec Mtim Timespec Ctim Timespec _ [3]int64 } type StatxTimestamp struct { Sec int64 Nsec uint32 _ int32 } type Statx_t struct { Mask uint32 Blksize uint32 Attributes uint64 Nlink uint32 Uid uint32 Gid uint32 Mode uint16 _ [1]uint16 Ino uint64 Size uint64 Blocks uint64 Attributes_mask uint64 Atime StatxTimestamp Btime StatxTimestamp Ctime StatxTimestamp Mtime StatxTimestamp Rdev_major uint32 Rdev_minor uint32 Dev_major uint32 Dev_minor uint32 _ [14]uint64 } type Dirent struct { Ino uint64 Off int64 Reclen uint16 Type uint8 Name [256]int8 _ [5]byte } type Fsid struct { Val [2]int32 } type Flock_t struct { Type int16 Whence int16 Start int64 Len int64 Pid int32 _ [4]byte } type FscryptPolicy struct { Version uint8 Contents_encryption_mode uint8 Filenames_encryption_mode uint8 Flags uint8 Master_key_descriptor [8]uint8 } type FscryptKey struct { Mode uint32 Raw [64]uint8 Size uint32 } type KeyctlDHParams struct { Private int32 Prime int32 Base int32 } const ( FADV_NORMAL = 0x0 FADV_RANDOM = 0x1 FADV_SEQUENTIAL = 0x2 FADV_WILLNEED = 0x3 FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) type RawSockaddrInet4 struct { Family uint16 Port uint16 Addr [4]byte /* in_addr */ Zero [8]uint8 } type RawSockaddrInet6 struct { Family uint16 Port uint16 Flowinfo uint32 Addr [16]byte /* in6_addr */ Scope_id uint32 } type RawSockaddrUnix struct { Family uint16 Path [108]int8 } type RawSockaddrLinklayer struct { Family uint16 Protocol uint16 Ifindex int32 Hatype uint16 Pkttype uint8 Halen uint8 Addr [8]uint8 } type RawSockaddrNetlink struct { Family uint16 Pad uint16 Pid uint32 Groups uint32 } type RawSockaddrHCI struct { Family uint16 Dev uint16 Channel uint16 } type RawSockaddrL2 struct { Family uint16 Psm uint16 Bdaddr [6]uint8 Cid uint16 Bdaddr_type uint8 _ [1]byte } type RawSockaddrRFCOMM struct { Family uint16 Bdaddr [6]uint8 Channel uint8 _ [1]byte } type RawSockaddrCAN struct { Family uint16 Ifindex int32 Addr [8]byte } type RawSockaddrALG struct { Family uint16 Type [14]uint8 Feat uint32 Mask uint32 Name [64]uint8 } type RawSockaddrVM struct { Family uint16 Reserved1 uint16 Port uint32 Cid uint32 Zero [4]uint8 } type RawSockaddrXDP struct { Family uint16 Flags uint16 Ifindex uint32 Queue_id uint32 Shared_umem_fd uint32 } type RawSockaddrPPPoX [0x1e]byte type RawSockaddr struct { Family uint16 Data [14]int8 } type RawSockaddrAny struct { Addr RawSockaddr Pad [96]int8 } type _Socklen uint32 type Linger struct { Onoff int32 Linger int32 } type Iovec struct { Base *byte Len uint64 } type IPMreq struct { Multiaddr [4]byte /* in_addr */ Interface [4]byte /* in_addr */ } type IPMreqn struct { Multiaddr [4]byte /* in_addr */ Address [4]byte /* in_addr */ Ifindex int32 } type IPv6Mreq struct { Multiaddr [16]byte /* in6_addr */ Interface uint32 } type PacketMreq struct { Ifindex int32 Type uint16 Alen uint16 Address [8]uint8 } type Msghdr struct { Name *byte Namelen uint32 Iov *Iovec Iovlen uint64 Control *byte Controllen uint64 Flags int32 _ [4]byte } type Cmsghdr struct { Len uint64 Level int32 Type int32 } type Inet4Pktinfo struct { Ifindex int32 Spec_dst [4]byte /* in_addr */ Addr [4]byte /* in_addr */ } type Inet6Pktinfo struct { Addr [16]byte /* in6_addr */ Ifindex uint32 } type IPv6MTUInfo struct { Addr RawSockaddrInet6 Mtu uint32 } type ICMPv6Filter struct { Data [8]uint32 } type Ucred struct { Pid int32 Uid uint32 Gid uint32 } type TCPInfo struct { State uint8 Ca_state uint8 Retransmits uint8 Probes uint8 Backoff uint8 Options uint8 Rto uint32 Ato uint32 Snd_mss uint32 Rcv_mss uint32 Unacked uint32 Sacked uint32 Lost uint32 Retrans uint32 Fackets uint32 Last_data_sent uint32 Last_ack_sent uint32 Last_data_recv uint32 Last_ack_recv uint32 Pmtu uint32 Rcv_ssthresh uint32 Rtt uint32 Rttvar uint32 Snd_ssthresh uint32 Snd_cwnd uint32 Advmss uint32 Reordering uint32 Rcv_rtt uint32 Rcv_space uint32 Total_retrans uint32 } type CanFilter struct { Id uint32 Mask uint32 } const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c SizeofSockaddrAny = 0x70 SizeofSockaddrUnix = 0x6e SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 SizeofSockaddrL2 = 0xe SizeofSockaddrRFCOMM = 0xa SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 SizeofSockaddrXDP = 0x10 SizeofSockaddrPPPoX = 0x1e SizeofLinger = 0x8 SizeofIovec = 0x10 SizeofIPMreq = 0x8 SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 SizeofPacketMreq = 0x10 SizeofMsghdr = 0x38 SizeofCmsghdr = 0x10 SizeofInet4Pktinfo = 0xc SizeofInet6Pktinfo = 0x14 SizeofIPv6MTUInfo = 0x20 SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 SizeofCanFilter = 0x8 ) const ( NDA_UNSPEC = 0x0 NDA_DST = 0x1 NDA_LLADDR = 0x2 NDA_CACHEINFO = 0x3 NDA_PROBES = 0x4 NDA_VLAN = 0x5 NDA_PORT = 0x6 NDA_VNI = 0x7 NDA_IFINDEX = 0x8 NDA_MASTER = 0x9 NDA_LINK_NETNSID = 0xa NDA_SRC_VNI = 0xb NTF_USE = 0x1 NTF_SELF = 0x2 NTF_MASTER = 0x4 NTF_PROXY = 0x8 NTF_EXT_LEARNED = 0x10 NTF_OFFLOADED = 0x20 NTF_ROUTER = 0x80 NUD_INCOMPLETE = 0x1 NUD_REACHABLE = 0x2 NUD_STALE = 0x4 NUD_DELAY = 0x8 NUD_PROBE = 0x10 NUD_FAILED = 0x20 NUD_NOARP = 0x40 NUD_PERMANENT = 0x80 NUD_NONE = 0x0 IFA_UNSPEC = 0x0 IFA_ADDRESS = 0x1 IFA_LOCAL = 0x2 IFA_LABEL = 0x3 IFA_BROADCAST = 0x4 IFA_ANYCAST = 0x5 IFA_CACHEINFO = 0x6 IFA_MULTICAST = 0x7 IFA_FLAGS = 0x8 IFA_RT_PRIORITY = 0x9 IFA_TARGET_NETNSID = 0xa IFLA_UNSPEC = 0x0 IFLA_ADDRESS = 0x1 IFLA_BROADCAST = 0x2 IFLA_IFNAME = 0x3 IFLA_MTU = 0x4 IFLA_LINK = 0x5 IFLA_QDISC = 0x6 IFLA_STATS = 0x7 IFLA_COST = 0x8 IFLA_PRIORITY = 0x9 IFLA_MASTER = 0xa IFLA_WIRELESS = 0xb IFLA_PROTINFO = 0xc IFLA_TXQLEN = 0xd IFLA_MAP = 0xe IFLA_WEIGHT = 0xf IFLA_OPERSTATE = 0x10 IFLA_LINKMODE = 0x11 IFLA_LINKINFO = 0x12 IFLA_NET_NS_PID = 0x13 IFLA_IFALIAS = 0x14 IFLA_NUM_VF = 0x15 IFLA_VFINFO_LIST = 0x16 IFLA_STATS64 = 0x17 IFLA_VF_PORTS = 0x18 IFLA_PORT_SELF = 0x19 IFLA_AF_SPEC = 0x1a IFLA_GROUP = 0x1b IFLA_NET_NS_FD = 0x1c IFLA_EXT_MASK = 0x1d IFLA_PROMISCUITY = 0x1e IFLA_NUM_TX_QUEUES = 0x1f IFLA_NUM_RX_QUEUES = 0x20 IFLA_CARRIER = 0x21 IFLA_PHYS_PORT_ID = 0x22 IFLA_CARRIER_CHANGES = 0x23 IFLA_PHYS_SWITCH_ID = 0x24 IFLA_LINK_NETNSID = 0x25 IFLA_PHYS_PORT_NAME = 0x26 IFLA_PROTO_DOWN = 0x27 IFLA_GSO_MAX_SEGS = 0x28 IFLA_GSO_MAX_SIZE = 0x29 IFLA_PAD = 0x2a IFLA_XDP = 0x2b IFLA_EVENT = 0x2c IFLA_NEW_NETNSID = 0x2d IFLA_IF_NETNSID = 0x2e IFLA_TARGET_NETNSID = 0x2e IFLA_CARRIER_UP_COUNT = 0x2f IFLA_CARRIER_DOWN_COUNT = 0x30 IFLA_NEW_IFINDEX = 0x31 IFLA_MIN_MTU = 0x32 IFLA_MAX_MTU = 0x33 IFLA_MAX = 0x33 IFLA_INFO_KIND = 0x1 IFLA_INFO_DATA = 0x2 IFLA_INFO_XSTATS = 0x3 IFLA_INFO_SLAVE_KIND = 0x4 IFLA_INFO_SLAVE_DATA = 0x5 RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_SITE = 0xc8 RT_SCOPE_LINK = 0xfd RT_SCOPE_HOST = 0xfe RT_SCOPE_NOWHERE = 0xff RT_TABLE_UNSPEC = 0x0 RT_TABLE_COMPAT = 0xfc RT_TABLE_DEFAULT = 0xfd RT_TABLE_MAIN = 0xfe RT_TABLE_LOCAL = 0xff RT_TABLE_MAX = 0xffffffff RTA_UNSPEC = 0x0 RTA_DST = 0x1 RTA_SRC = 0x2 RTA_IIF = 0x3 RTA_OIF = 0x4 RTA_GATEWAY = 0x5 RTA_PRIORITY = 0x6 RTA_PREFSRC = 0x7 RTA_METRICS = 0x8 RTA_MULTIPATH = 0x9 RTA_FLOW = 0xb RTA_CACHEINFO = 0xc RTA_TABLE = 0xf RTA_MARK = 0x10 RTA_MFC_STATS = 0x11 RTA_VIA = 0x12 RTA_NEWDST = 0x13 RTA_PREF = 0x14 RTA_ENCAP_TYPE = 0x15 RTA_ENCAP = 0x16 RTA_EXPIRES = 0x17 RTA_PAD = 0x18 RTA_UID = 0x19 RTA_TTL_PROPAGATE = 0x1a RTA_IP_PROTO = 0x1b RTA_SPORT = 0x1c RTA_DPORT = 0x1d RTN_UNSPEC = 0x0 RTN_UNICAST = 0x1 RTN_LOCAL = 0x2 RTN_BROADCAST = 0x3 RTN_ANYCAST = 0x4 RTN_MULTICAST = 0x5 RTN_BLACKHOLE = 0x6 RTN_UNREACHABLE = 0x7 RTN_PROHIBIT = 0x8 RTN_THROW = 0x9 RTN_NAT = 0xa RTN_XRESOLVE = 0xb RTNLGRP_NONE = 0x0 RTNLGRP_LINK = 0x1 RTNLGRP_NOTIFY = 0x2 RTNLGRP_NEIGH = 0x3 RTNLGRP_TC = 0x4 RTNLGRP_IPV4_IFADDR = 0x5 RTNLGRP_IPV4_MROUTE = 0x6 RTNLGRP_IPV4_ROUTE = 0x7 RTNLGRP_IPV4_RULE = 0x8 RTNLGRP_IPV6_IFADDR = 0x9 RTNLGRP_IPV6_MROUTE = 0xa RTNLGRP_IPV6_ROUTE = 0xb RTNLGRP_IPV6_IFINFO = 0xc RTNLGRP_IPV6_PREFIX = 0x12 RTNLGRP_IPV6_RULE = 0x13 RTNLGRP_ND_USEROPT = 0x14 SizeofNlMsghdr = 0x10 SizeofNlMsgerr = 0x14 SizeofRtGenmsg = 0x1 SizeofNlAttr = 0x4 SizeofRtAttr = 0x4 SizeofIfInfomsg = 0x10 SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 SizeofNdUseroptmsg = 0x10 SizeofNdMsg = 0xc ) type NlMsghdr struct { Len uint32 Type uint16 Flags uint16 Seq uint32 Pid uint32 } type NlMsgerr struct { Error int32 Msg NlMsghdr } type RtGenmsg struct { Family uint8 } type NlAttr struct { Len uint16 Type uint16 } type RtAttr struct { Len uint16 Type uint16 } type IfInfomsg struct { Family uint8 _ uint8 Type uint16 Index int32 Flags uint32 Change uint32 } type IfAddrmsg struct { Family uint8 Prefixlen uint8 Flags uint8 Scope uint8 Index uint32 } type RtMsg struct { Family uint8 Dst_len uint8 Src_len uint8 Tos uint8 Table uint8 Protocol uint8 Scope uint8 Type uint8 Flags uint32 } type RtNexthop struct { Len uint16 Flags uint8 Hops uint8 Ifindex int32 } type NdUseroptmsg struct { Family uint8 Pad1 uint8 Opts_len uint16 Ifindex int32 Icmp_type uint8 Icmp_code uint8 Pad2 uint16 Pad3 uint32 } type NdMsg struct { Family uint8 Pad1 uint8 Pad2 uint16 Ifindex int32 State uint16 Flags uint8 Type uint8 } const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 ) type SockFilter struct { Code uint16 Jt uint8 Jf uint8 K uint32 } type SockFprog struct { Len uint16 Filter *SockFilter } type InotifyEvent struct { Wd int32 Mask uint32 Cookie uint32 Len uint32 } const SizeofInotifyEvent = 0x10 type PtraceRegs struct { R15 uint64 R14 uint64 R13 uint64 R12 uint64 Rbp uint64 Rbx uint64 R11 uint64 R10 uint64 R9 uint64 R8 uint64 Rax uint64 Rcx uint64 Rdx uint64 Rsi uint64 Rdi uint64 Orig_rax uint64 Rip uint64 Cs uint64 Eflags uint64 Rsp uint64 Ss uint64 Fs_base uint64 Gs_base uint64 Ds uint64 Es uint64 Fs uint64 Gs uint64 } type FdSet struct { Bits [16]int64 } type Sysinfo_t struct { Uptime int64 Loads [3]uint64 Totalram uint64 Freeram uint64 Sharedram uint64 Bufferram uint64 Totalswap uint64 Freeswap uint64 Procs uint16 Pad uint16 Totalhigh uint64 Freehigh uint64 Unit uint32 _ [0]int8 _ [4]byte } type Utsname struct { Sysname [65]byte Nodename [65]byte Release [65]byte Version [65]byte Machine [65]byte Domainname [65]byte } type Ustat_t struct { Tfree int32 Tinode uint64 Fname [6]int8 Fpack [6]int8 _ [4]byte } type EpollEvent struct { Events uint32 Fd int32 Pad int32 } const ( AT_EMPTY_PATH = 0x1000 AT_FDCWD = -0x64 AT_NO_AUTOMOUNT = 0x800 AT_REMOVEDIR = 0x200 AT_STATX_SYNC_AS_STAT = 0x0 AT_STATX_FORCE_SYNC = 0x2000 AT_STATX_DONT_SYNC = 0x4000 AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 AT_EACCESS = 0x200 ) type PollFd struct { Fd int32 Events int16 Revents int16 } const ( POLLIN = 0x1 POLLPRI = 0x2 POLLOUT = 0x4 POLLRDHUP = 0x2000 POLLERR = 0x8 POLLHUP = 0x10 POLLNVAL = 0x20 ) type Sigset_t struct { Val [16]uint64 } const _C__NSIG = 0x41 type SignalfdSiginfo struct { Signo uint32 Errno int32 Code int32 Pid uint32 Uid uint32 Fd int32 Tid uint32 Band uint32 Overrun uint32 Trapno uint32 Status int32 Int int32 Ptr uint64 Utime uint64 Stime uint64 Addr uint64 Addr_lsb uint16 _ uint16 Syscall int32 Call_addr uint64 Arch uint32 _ [28]uint8 } const PERF_IOC_FLAG_GROUP = 0x1 type Termios struct { Iflag uint32 Oflag uint32 Cflag uint32 Lflag uint32 Line uint8 Cc [19]uint8 Ispeed uint32 Ospeed uint32 } type Winsize struct { Row uint16 Col uint16 Xpixel uint16 Ypixel uint16 } type Taskstats struct { Version uint16 Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 Blkio_delay_total uint64 Swapin_count uint64 Swapin_delay_total uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]int8 Ac_sched uint8 Ac_pad [3]uint8 _ [4]byte Ac_uid uint32 Ac_gid uint32 Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 Ac_minflt uint64 Ac_majflt uint64 Coremem uint64 Virtmem uint64 Hiwater_rss uint64 Hiwater_vm uint64 Read_char uint64 Write_char uint64 Read_syscalls uint64 Write_syscalls uint64 Read_bytes uint64 Write_bytes uint64 Cancelled_write_bytes uint64 Nvcsw uint64 Nivcsw uint64 Ac_utimescaled uint64 Ac_stimescaled uint64 Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 Thrashing_count uint64 Thrashing_delay_total uint64 } const ( TASKSTATS_CMD_UNSPEC = 0x0 TASKSTATS_CMD_GET = 0x1 TASKSTATS_CMD_NEW = 0x2 TASKSTATS_TYPE_UNSPEC = 0x0 TASKSTATS_TYPE_PID = 0x1 TASKSTATS_TYPE_TGID = 0x2 TASKSTATS_TYPE_STATS = 0x3 TASKSTATS_TYPE_AGGR_PID = 0x4 TASKSTATS_TYPE_AGGR_TGID = 0x5 TASKSTATS_TYPE_NULL = 0x6 TASKSTATS_CMD_ATTR_UNSPEC = 0x0 TASKSTATS_CMD_ATTR_PID = 0x1 TASKSTATS_CMD_ATTR_TGID = 0x2 TASKSTATS_CMD_ATTR_REGISTER_CPUMASK = 0x3 TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4 ) type CGroupStats struct { Sleeping uint64 Running uint64 Stopped uint64 Uninterruptible uint64 Io_wait uint64 } const ( CGROUPSTATS_CMD_UNSPEC = 0x3 CGROUPSTATS_CMD_GET = 0x4 CGROUPSTATS_CMD_NEW = 0x5 CGROUPSTATS_TYPE_UNSPEC = 0x0 CGROUPSTATS_TYPE_CGROUP_STATS = 0x1 CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0 CGROUPSTATS_CMD_ATTR_FD = 0x1 ) type Genlmsghdr struct { Cmd uint8 Version uint8 Reserved uint16 } const ( CTRL_CMD_UNSPEC = 0x0 CTRL_CMD_NEWFAMILY = 0x1 CTRL_CMD_DELFAMILY = 0x2 CTRL_CMD_GETFAMILY = 0x3 CTRL_CMD_NEWOPS = 0x4 CTRL_CMD_DELOPS = 0x5 CTRL_CMD_GETOPS = 0x6 CTRL_CMD_NEWMCAST_GRP = 0x7 CTRL_CMD_DELMCAST_GRP = 0x8 CTRL_CMD_GETMCAST_GRP = 0x9 CTRL_ATTR_UNSPEC = 0x0 CTRL_ATTR_FAMILY_ID = 0x1 CTRL_ATTR_FAMILY_NAME = 0x2 CTRL_ATTR_VERSION = 0x3 CTRL_ATTR_HDRSIZE = 0x4 CTRL_ATTR_MAXATTR = 0x5 CTRL_ATTR_OPS = 0x6 CTRL_ATTR_MCAST_GROUPS = 0x7 CTRL_ATTR_OP_UNSPEC = 0x0 CTRL_ATTR_OP_ID = 0x1 CTRL_ATTR_OP_FLAGS = 0x2 CTRL_ATTR_MCAST_GRP_UNSPEC = 0x0 CTRL_ATTR_MCAST_GRP_NAME = 0x1 CTRL_ATTR_MCAST_GRP_ID = 0x2 ) type cpuMask uint64 const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x40 ) const ( BDADDR_BREDR = 0x0 BDADDR_LE_PUBLIC = 0x1 BDADDR_LE_RANDOM = 0x2 ) type PerfEventAttr struct { Type uint32 Size uint32 Config uint64 Sample uint64 Sample_type uint64 Read_format uint64 Bits uint64 Wakeup uint32 Bp_type uint32 Ext1 uint64 Ext2 uint64 Branch_sample_type uint64 Sample_regs_user uint64 Sample_stack_user uint32 Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 Sample_max_stack uint16 _ uint16 } type PerfEventMmapPage struct { Version uint32 Compat_version uint32 Lock uint32 Index uint32 Offset int64 Time_enabled uint64 Time_running uint64 Capabilities uint64 Pmc_width uint16 Time_shift uint16 Time_mult uint32 Time_offset uint64 Time_zero uint64 Size uint32 _ [948]uint8 Data_head uint64 Data_tail uint64 Data_offset uint64 Data_size uint64 Aux_head uint64 Aux_tail uint64 Aux_offset uint64 Aux_size uint64 } const ( PerfBitDisabled uint64 = CBitFieldMaskBit0 PerfBitInherit = CBitFieldMaskBit1 PerfBitPinned = CBitFieldMaskBit2 PerfBitExclusive = CBitFieldMaskBit3 PerfBitExcludeUser = CBitFieldMaskBit4 PerfBitExcludeKernel = CBitFieldMaskBit5 PerfBitExcludeHv = CBitFieldMaskBit6 PerfBitExcludeIdle = CBitFieldMaskBit7 PerfBitMmap = CBitFieldMaskBit8 PerfBitComm = CBitFieldMaskBit9 PerfBitFreq = CBitFieldMaskBit10 PerfBitInheritStat = CBitFieldMaskBit11 PerfBitEnableOnExec = CBitFieldMaskBit12 PerfBitTask = CBitFieldMaskBit13 PerfBitWatermark = CBitFieldMaskBit14 PerfBitPreciseIPBit1 = CBitFieldMaskBit15 PerfBitPreciseIPBit2 = CBitFieldMaskBit16 PerfBitMmapData = CBitFieldMaskBit17 PerfBitSampleIDAll = CBitFieldMaskBit18 PerfBitExcludeHost = CBitFieldMaskBit19 PerfBitExcludeGuest = CBitFieldMaskBit20 PerfBitExcludeCallchainKernel = CBitFieldMaskBit21 PerfBitExcludeCallchainUser = CBitFieldMaskBit22 PerfBitMmap2 = CBitFieldMaskBit23 PerfBitCommExec = CBitFieldMaskBit24 PerfBitUseClockID = CBitFieldMaskBit25 PerfBitContextSwitch = CBitFieldMaskBit26 ) const ( PERF_TYPE_HARDWARE = 0x0 PERF_TYPE_SOFTWARE = 0x1 PERF_TYPE_TRACEPOINT = 0x2 PERF_TYPE_HW_CACHE = 0x3 PERF_TYPE_RAW = 0x4 PERF_TYPE_BREAKPOINT = 0x5 PERF_COUNT_HW_CPU_CYCLES = 0x0 PERF_COUNT_HW_INSTRUCTIONS = 0x1 PERF_COUNT_HW_CACHE_REFERENCES = 0x2 PERF_COUNT_HW_CACHE_MISSES = 0x3 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 PERF_COUNT_HW_BRANCH_MISSES = 0x5 PERF_COUNT_HW_BUS_CYCLES = 0x6 PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 PERF_COUNT_HW_CACHE_L1D = 0x0 PERF_COUNT_HW_CACHE_L1I = 0x1 PERF_COUNT_HW_CACHE_LL = 0x2 PERF_COUNT_HW_CACHE_DTLB = 0x3 PERF_COUNT_HW_CACHE_ITLB = 0x4 PERF_COUNT_HW_CACHE_BPU = 0x5 PERF_COUNT_HW_CACHE_NODE = 0x6 PERF_COUNT_HW_CACHE_OP_READ = 0x0 PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 PERF_COUNT_SW_CPU_CLOCK = 0x0 PERF_COUNT_SW_TASK_CLOCK = 0x1 PERF_COUNT_SW_PAGE_FAULTS = 0x2 PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 PERF_SAMPLE_TIME = 0x4 PERF_SAMPLE_ADDR = 0x8 PERF_SAMPLE_READ = 0x10 PERF_SAMPLE_CALLCHAIN = 0x20 PERF_SAMPLE_ID = 0x40 PERF_SAMPLE_CPU = 0x80 PERF_SAMPLE_PERIOD = 0x100 PERF_SAMPLE_STREAM_ID = 0x200 PERF_SAMPLE_RAW = 0x400 PERF_SAMPLE_BRANCH_STACK = 0x800 PERF_SAMPLE_BRANCH_USER = 0x1 PERF_SAMPLE_BRANCH_KERNEL = 0x2 PERF_SAMPLE_BRANCH_HV = 0x4 PERF_SAMPLE_BRANCH_ANY = 0x8 PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 PERF_SAMPLE_BRANCH_IN_TX = 0x100 PERF_SAMPLE_BRANCH_NO_TX = 0x200 PERF_SAMPLE_BRANCH_COND = 0x400 PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 PERF_SAMPLE_BRANCH_CALL = 0x2000 PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 PERF_RECORD_MMAP = 0x1 PERF_RECORD_LOST = 0x2 PERF_RECORD_COMM = 0x3 PERF_RECORD_EXIT = 0x4 PERF_RECORD_THROTTLE = 0x5 PERF_RECORD_UNTHROTTLE = 0x6 PERF_RECORD_FORK = 0x7 PERF_RECORD_READ = 0x8 PERF_RECORD_SAMPLE = 0x9 PERF_RECORD_MMAP2 = 0xa PERF_RECORD_AUX = 0xb PERF_RECORD_ITRACE_START = 0xc PERF_RECORD_LOST_SAMPLES = 0xd PERF_RECORD_SWITCH = 0xe PERF_RECORD_SWITCH_CPU_WIDE = 0xf PERF_RECORD_NAMESPACES = 0x10 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 PERF_CONTEXT_USER = -0x200 PERF_CONTEXT_GUEST = -0x800 PERF_CONTEXT_GUEST_KERNEL = -0x880 PERF_CONTEXT_GUEST_USER = -0xa00 PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( CBitFieldMaskBit0 = 0x1 CBitFieldMaskBit1 = 0x2 CBitFieldMaskBit2 = 0x4 CBitFieldMaskBit3 = 0x8 CBitFieldMaskBit4 = 0x10 CBitFieldMaskBit5 = 0x20 CBitFieldMaskBit6 = 0x40 CBitFieldMaskBit7 = 0x80 CBitFieldMaskBit8 = 0x100 CBitFieldMaskBit9 = 0x200 CBitFieldMaskBit10 = 0x400 CBitFieldMaskBit11 = 0x800 CBitFieldMaskBit12 = 0x1000 CBitFieldMaskBit13 = 0x2000 CBitFieldMaskBit14 = 0x4000 CBitFieldMaskBit15 = 0x8000 CBitFieldMaskBit16 = 0x10000 CBitFieldMaskBit17 = 0x20000 CBitFieldMaskBit18 = 0x40000 CBitFieldMaskBit19 = 0x80000 CBitFieldMaskBit20 = 0x100000 CBitFieldMaskBit21 = 0x200000 CBitFieldMaskBit22 = 0x400000 CBitFieldMaskBit23 = 0x800000 CBitFieldMaskBit24 = 0x1000000 CBitFieldMaskBit25 = 0x2000000 CBitFieldMaskBit26 = 0x4000000 CBitFieldMaskBit27 = 0x8000000 CBitFieldMaskBit28 = 0x10000000 CBitFieldMaskBit29 = 0x20000000 CBitFieldMaskBit30 = 0x40000000 CBitFieldMaskBit31 = 0x80000000 CBitFieldMaskBit32 = 0x100000000 CBitFieldMaskBit33 = 0x200000000 CBitFieldMaskBit34 = 0x400000000 CBitFieldMaskBit35 = 0x800000000 CBitFieldMaskBit36 = 0x1000000000 CBitFieldMaskBit37 = 0x2000000000 CBitFieldMaskBit38 = 0x4000000000 CBitFieldMaskBit39 = 0x8000000000 CBitFieldMaskBit40 = 0x10000000000 CBitFieldMaskBit41 = 0x20000000000 CBitFieldMaskBit42 = 0x40000000000 CBitFieldMaskBit43 = 0x80000000000 CBitFieldMaskBit44 = 0x100000000000 CBitFieldMaskBit45 = 0x200000000000 CBitFieldMaskBit46 = 0x400000000000 CBitFieldMaskBit47 = 0x800000000000 CBitFieldMaskBit48 = 0x1000000000000 CBitFieldMaskBit49 = 0x2000000000000 CBitFieldMaskBit50 = 0x4000000000000 CBitFieldMaskBit51 = 0x8000000000000 CBitFieldMaskBit52 = 0x10000000000000 CBitFieldMaskBit53 = 0x20000000000000 CBitFieldMaskBit54 = 0x40000000000000 CBitFieldMaskBit55 = 0x80000000000000 CBitFieldMaskBit56 = 0x100000000000000 CBitFieldMaskBit57 = 0x200000000000000 CBitFieldMaskBit58 = 0x400000000000000 CBitFieldMaskBit59 = 0x800000000000000 CBitFieldMaskBit60 = 0x1000000000000000 CBitFieldMaskBit61 = 0x2000000000000000 CBitFieldMaskBit62 = 0x4000000000000000 CBitFieldMaskBit63 = 0x8000000000000000 ) type SockaddrStorage struct { Family uint16 _ [118]int8 _ uint64 } type TCPMD5Sig struct { Addr SockaddrStorage Flags uint8 Prefixlen uint8 Keylen uint16 _ uint32 Key [80]uint8 } type HDDriveCmdHdr struct { Command uint8 Number uint8 Feature uint8 Count uint8 } type HDGeometry struct { Heads uint8 Sectors uint8 Cylinders uint16 Start uint64 } type HDDriveID struct { Config uint16 Cyls uint16 Reserved2 uint16 Heads uint16 Track_bytes uint16 Sector_bytes uint16 Sectors uint16 Vendor0 uint16 Vendor1 uint16 Vendor2 uint16 Serial_no [20]uint8 Buf_type uint16 Buf_size uint16 Ecc_bytes uint16 Fw_rev [8]uint8 Model [40]uint8 Max_multsect uint8 Vendor3 uint8 Dword_io uint16 Vendor4 uint8 Capability uint8 Reserved50 uint16 Vendor5 uint8 TPIO uint8 Vendor6 uint8 TDMA uint8 Field_valid uint16 Cur_cyls uint16 Cur_heads uint16 Cur_sectors uint16 Cur_capacity0 uint16 Cur_capacity1 uint16 Multsect uint8 Multsect_valid uint8 Lba_capacity uint32 Dma_1word uint16 Dma_mword uint16 Eide_pio_modes uint16 Eide_dma_min uint16 Eide_dma_time uint16 Eide_pio uint16 Eide_pio_iordy uint16 Words69_70 [2]uint16 Words71_74 [4]uint16 Queue_depth uint16 Words76_79 [4]uint16 Major_rev_num uint16 Minor_rev_num uint16 Command_set_1 uint16 Command_set_2 uint16 Cfsse uint16 Cfs_enable_1 uint16 Cfs_enable_2 uint16 Csf_default uint16 Dma_ultra uint16 Trseuc uint16 TrsEuc uint16 CurAPMvalues uint16 Mprc uint16 Hw_config uint16 Acoustic uint16 Msrqs uint16 Sxfert uint16 Sal uint16 Spg uint32 Lba_capacity_2 uint64 Words104_125 [22]uint16 Last_lun uint16 Word127 uint16 Dlf uint16 Csfo uint16 Words130_155 [26]uint16 Word156 uint16 Words157_159 [3]uint16 Cfa_power uint16 Words161_175 [15]uint16 Words176_205 [30]uint16 Words206_254 [49]uint16 Integrity_word uint16 } type Statfs_t struct { Type int64 Bsize int64 Blocks uint64 Bfree uint64 Bavail uint64 Files uint64 Ffree uint64 Fsid Fsid Namelen int64 Frsize int64 Flags int64 Spare [4]int64 } const ( ST_MANDLOCK = 0x40 ST_NOATIME = 0x400 ST_NODEV = 0x4 ST_NODIRATIME = 0x800 ST_NOEXEC = 0x8 ST_NOSUID = 0x2 ST_RDONLY = 0x1 ST_RELATIME = 0x1000 ST_SYNCHRONOUS = 0x10 ) type TpacketHdr struct { Status uint64 Len uint32 Snaplen uint32 Mac uint16 Net uint16 Sec uint32 Usec uint32 _ [4]byte } type Tpacket2Hdr struct { Status uint32 Len uint32 Snaplen uint32 Mac uint16 Net uint16 Sec uint32 Nsec uint32 Vlan_tci uint16 Vlan_tpid uint16 _ [4]uint8 } type Tpacket3Hdr struct { Next_offset uint32 Sec uint32 Nsec uint32 Snaplen uint32 Len uint32 Status uint32 Mac uint16 Net uint16 Hv1 TpacketHdrVariant1 _ [8]uint8 } type TpacketHdrVariant1 struct { Rxhash uint32 Vlan_tci uint32 Vlan_tpid uint16 _ uint16 } type TpacketBlockDesc struct { Version uint32 To_priv uint32 Hdr [40]byte } type TpacketBDTS struct { Sec uint32 Usec uint32 } type TpacketHdrV1 struct { Block_status uint32 Num_pkts uint32 Offset_to_first_pkt uint32 Blk_len uint32 Seq_num uint64 Ts_first_pkt TpacketBDTS Ts_last_pkt TpacketBDTS } type TpacketReq struct { Block_size uint32 Block_nr uint32 Frame_size uint32 Frame_nr uint32 } type TpacketReq3 struct { Block_size uint32 Block_nr uint32 Frame_size uint32 Frame_nr uint32 Retire_blk_tov uint32 Sizeof_priv uint32 Feature_req_word uint32 } type TpacketStats struct { Packets uint32 Drops uint32 } type TpacketStatsV3 struct { Packets uint32 Drops uint32 Freeze_q_cnt uint32 } type TpacketAuxdata struct { Status uint32 Len uint32 Snaplen uint32 Mac uint16 Net uint16 Vlan_tci uint16 Vlan_tpid uint16 } const ( TPACKET_V1 = 0x0 TPACKET_V2 = 0x1 TPACKET_V3 = 0x2 ) const ( SizeofTpacketHdr = 0x20 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 SizeofTpacketStats = 0x8 SizeofTpacketStatsV3 = 0xc ) const ( NF_INET_PRE_ROUTING = 0x0 NF_INET_LOCAL_IN = 0x1 NF_INET_FORWARD = 0x2 NF_INET_LOCAL_OUT = 0x3 NF_INET_POST_ROUTING = 0x4 NF_INET_NUMHOOKS = 0x5 ) const ( NF_NETDEV_INGRESS = 0x0 NF_NETDEV_NUMHOOKS = 0x1 ) const ( NFPROTO_UNSPEC = 0x0 NFPROTO_INET = 0x1 NFPROTO_IPV4 = 0x2 NFPROTO_ARP = 0x3 NFPROTO_NETDEV = 0x5 NFPROTO_BRIDGE = 0x7 NFPROTO_IPV6 = 0xa NFPROTO_DECNET = 0xc NFPROTO_NUMPROTO = 0xd ) type Nfgenmsg struct { Nfgen_family uint8 Version uint8 Res_id uint16 } const ( NFNL_BATCH_UNSPEC = 0x0 NFNL_BATCH_GENID = 0x1 ) const ( NFT_REG_VERDICT = 0x0 NFT_REG_1 = 0x1 NFT_REG_2 = 0x2 NFT_REG_3 = 0x3 NFT_REG_4 = 0x4 NFT_REG32_00 = 0x8 NFT_REG32_01 = 0x9 NFT_REG32_02 = 0xa NFT_REG32_03 = 0xb NFT_REG32_04 = 0xc NFT_REG32_05 = 0xd NFT_REG32_06 = 0xe NFT_REG32_07 = 0xf NFT_REG32_08 = 0x10 NFT_REG32_09 = 0x11 NFT_REG32_10 = 0x12 NFT_REG32_11 = 0x13 NFT_REG32_12 = 0x14 NFT_REG32_13 = 0x15 NFT_REG32_14 = 0x16 NFT_REG32_15 = 0x17 NFT_CONTINUE = -0x1 NFT_BREAK = -0x2 NFT_JUMP = -0x3 NFT_GOTO = -0x4 NFT_RETURN = -0x5 NFT_MSG_NEWTABLE = 0x0 NFT_MSG_GETTABLE = 0x1 NFT_MSG_DELTABLE = 0x2 NFT_MSG_NEWCHAIN = 0x3 NFT_MSG_GETCHAIN = 0x4 NFT_MSG_DELCHAIN = 0x5 NFT_MSG_NEWRULE = 0x6 NFT_MSG_GETRULE = 0x7 NFT_MSG_DELRULE = 0x8 NFT_MSG_NEWSET = 0x9 NFT_MSG_GETSET = 0xa NFT_MSG_DELSET = 0xb NFT_MSG_NEWSETELEM = 0xc NFT_MSG_GETSETELEM = 0xd NFT_MSG_DELSETELEM = 0xe NFT_MSG_NEWGEN = 0xf NFT_MSG_GETGEN = 0x10 NFT_MSG_TRACE = 0x11 NFT_MSG_NEWOBJ = 0x12 NFT_MSG_GETOBJ = 0x13 NFT_MSG_DELOBJ = 0x14 NFT_MSG_GETOBJ_RESET = 0x15 NFT_MSG_MAX = 0x19 NFTA_LIST_UNPEC = 0x0 NFTA_LIST_ELEM = 0x1 NFTA_HOOK_UNSPEC = 0x0 NFTA_HOOK_HOOKNUM = 0x1 NFTA_HOOK_PRIORITY = 0x2 NFTA_HOOK_DEV = 0x3 NFT_TABLE_F_DORMANT = 0x1 NFTA_TABLE_UNSPEC = 0x0 NFTA_TABLE_NAME = 0x1 NFTA_TABLE_FLAGS = 0x2 NFTA_TABLE_USE = 0x3 NFTA_CHAIN_UNSPEC = 0x0 NFTA_CHAIN_TABLE = 0x1 NFTA_CHAIN_HANDLE = 0x2 NFTA_CHAIN_NAME = 0x3 NFTA_CHAIN_HOOK = 0x4 NFTA_CHAIN_POLICY = 0x5 NFTA_CHAIN_USE = 0x6 NFTA_CHAIN_TYPE = 0x7 NFTA_CHAIN_COUNTERS = 0x8 NFTA_CHAIN_PAD = 0x9 NFTA_RULE_UNSPEC = 0x0 NFTA_RULE_TABLE = 0x1 NFTA_RULE_CHAIN = 0x2 NFTA_RULE_HANDLE = 0x3 NFTA_RULE_EXPRESSIONS = 0x4 NFTA_RULE_COMPAT = 0x5 NFTA_RULE_POSITION = 0x6 NFTA_RULE_USERDATA = 0x7 NFTA_RULE_PAD = 0x8 NFTA_RULE_ID = 0x9 NFT_RULE_COMPAT_F_INV = 0x2 NFT_RULE_COMPAT_F_MASK = 0x2 NFTA_RULE_COMPAT_UNSPEC = 0x0 NFTA_RULE_COMPAT_PROTO = 0x1 NFTA_RULE_COMPAT_FLAGS = 0x2 NFT_SET_ANONYMOUS = 0x1 NFT_SET_CONSTANT = 0x2 NFT_SET_INTERVAL = 0x4 NFT_SET_MAP = 0x8 NFT_SET_TIMEOUT = 0x10 NFT_SET_EVAL = 0x20 NFT_SET_OBJECT = 0x40 NFT_SET_POL_PERFORMANCE = 0x0 NFT_SET_POL_MEMORY = 0x1 NFTA_SET_DESC_UNSPEC = 0x0 NFTA_SET_DESC_SIZE = 0x1 NFTA_SET_UNSPEC = 0x0 NFTA_SET_TABLE = 0x1 NFTA_SET_NAME = 0x2 NFTA_SET_FLAGS = 0x3 NFTA_SET_KEY_TYPE = 0x4 NFTA_SET_KEY_LEN = 0x5 NFTA_SET_DATA_TYPE = 0x6 NFTA_SET_DATA_LEN = 0x7 NFTA_SET_POLICY = 0x8 NFTA_SET_DESC = 0x9 NFTA_SET_ID = 0xa NFTA_SET_TIMEOUT = 0xb NFTA_SET_GC_INTERVAL = 0xc NFTA_SET_USERDATA = 0xd NFTA_SET_PAD = 0xe NFTA_SET_OBJ_TYPE = 0xf NFT_SET_ELEM_INTERVAL_END = 0x1 NFTA_SET_ELEM_UNSPEC = 0x0 NFTA_SET_ELEM_KEY = 0x1 NFTA_SET_ELEM_DATA = 0x2 NFTA_SET_ELEM_FLAGS = 0x3 NFTA_SET_ELEM_TIMEOUT = 0x4 NFTA_SET_ELEM_EXPIRATION = 0x5 NFTA_SET_ELEM_USERDATA = 0x6 NFTA_SET_ELEM_EXPR = 0x7 NFTA_SET_ELEM_PAD = 0x8 NFTA_SET_ELEM_OBJREF = 0x9 NFTA_SET_ELEM_LIST_UNSPEC = 0x0 NFTA_SET_ELEM_LIST_TABLE = 0x1 NFTA_SET_ELEM_LIST_SET = 0x2 NFTA_SET_ELEM_LIST_ELEMENTS = 0x3 NFTA_SET_ELEM_LIST_SET_ID = 0x4 NFT_DATA_VALUE = 0x0 NFT_DATA_VERDICT = 0xffffff00 NFTA_DATA_UNSPEC = 0x0 NFTA_DATA_VALUE = 0x1 NFTA_DATA_VERDICT = 0x2 NFTA_VERDICT_UNSPEC = 0x0 NFTA_VERDICT_CODE = 0x1 NFTA_VERDICT_CHAIN = 0x2 NFTA_EXPR_UNSPEC = 0x0 NFTA_EXPR_NAME = 0x1 NFTA_EXPR_DATA = 0x2 NFTA_IMMEDIATE_UNSPEC = 0x0 NFTA_IMMEDIATE_DREG = 0x1 NFTA_IMMEDIATE_DATA = 0x2 NFTA_BITWISE_UNSPEC = 0x0 NFTA_BITWISE_SREG = 0x1 NFTA_BITWISE_DREG = 0x2 NFTA_BITWISE_LEN = 0x3 NFTA_BITWISE_MASK = 0x4 NFTA_BITWISE_XOR = 0x5 NFT_BYTEORDER_NTOH = 0x0 NFT_BYTEORDER_HTON = 0x1 NFTA_BYTEORDER_UNSPEC = 0x0 NFTA_BYTEORDER_SREG = 0x1 NFTA_BYTEORDER_DREG = 0x2 NFTA_BYTEORDER_OP = 0x3 NFTA_BYTEORDER_LEN = 0x4 NFTA_BYTEORDER_SIZE = 0x5 NFT_CMP_EQ = 0x0 NFT_CMP_NEQ = 0x1 NFT_CMP_LT = 0x2 NFT_CMP_LTE = 0x3 NFT_CMP_GT = 0x4 NFT_CMP_GTE = 0x5 NFTA_CMP_UNSPEC = 0x0 NFTA_CMP_SREG = 0x1 NFTA_CMP_OP = 0x2 NFTA_CMP_DATA = 0x3 NFT_RANGE_EQ = 0x0 NFT_RANGE_NEQ = 0x1 NFTA_RANGE_UNSPEC = 0x0 NFTA_RANGE_SREG = 0x1 NFTA_RANGE_OP = 0x2 NFTA_RANGE_FROM_DATA = 0x3 NFTA_RANGE_TO_DATA = 0x4 NFT_LOOKUP_F_INV = 0x1 NFTA_LOOKUP_UNSPEC = 0x0 NFTA_LOOKUP_SET = 0x1 NFTA_LOOKUP_SREG = 0x2 NFTA_LOOKUP_DREG = 0x3 NFTA_LOOKUP_SET_ID = 0x4 NFTA_LOOKUP_FLAGS = 0x5 NFT_DYNSET_OP_ADD = 0x0 NFT_DYNSET_OP_UPDATE = 0x1 NFT_DYNSET_F_INV = 0x1 NFTA_DYNSET_UNSPEC = 0x0 NFTA_DYNSET_SET_NAME = 0x1 NFTA_DYNSET_SET_ID = 0x2 NFTA_DYNSET_OP = 0x3 NFTA_DYNSET_SREG_KEY = 0x4 NFTA_DYNSET_SREG_DATA = 0x5 NFTA_DYNSET_TIMEOUT = 0x6 NFTA_DYNSET_EXPR = 0x7 NFTA_DYNSET_PAD = 0x8 NFTA_DYNSET_FLAGS = 0x9 NFT_PAYLOAD_LL_HEADER = 0x0 NFT_PAYLOAD_NETWORK_HEADER = 0x1 NFT_PAYLOAD_TRANSPORT_HEADER = 0x2 NFT_PAYLOAD_CSUM_NONE = 0x0 NFT_PAYLOAD_CSUM_INET = 0x1 NFT_PAYLOAD_L4CSUM_PSEUDOHDR = 0x1 NFTA_PAYLOAD_UNSPEC = 0x0 NFTA_PAYLOAD_DREG = 0x1 NFTA_PAYLOAD_BASE = 0x2 NFTA_PAYLOAD_OFFSET = 0x3 NFTA_PAYLOAD_LEN = 0x4 NFTA_PAYLOAD_SREG = 0x5 NFTA_PAYLOAD_CSUM_TYPE = 0x6 NFTA_PAYLOAD_CSUM_OFFSET = 0x7 NFTA_PAYLOAD_CSUM_FLAGS = 0x8 NFT_EXTHDR_F_PRESENT = 0x1 NFT_EXTHDR_OP_IPV6 = 0x0 NFT_EXTHDR_OP_TCPOPT = 0x1 NFTA_EXTHDR_UNSPEC = 0x0 NFTA_EXTHDR_DREG = 0x1 NFTA_EXTHDR_TYPE = 0x2 NFTA_EXTHDR_OFFSET = 0x3 NFTA_EXTHDR_LEN = 0x4 NFTA_EXTHDR_FLAGS = 0x5 NFTA_EXTHDR_OP = 0x6 NFTA_EXTHDR_SREG = 0x7 NFT_META_LEN = 0x0 NFT_META_PROTOCOL = 0x1 NFT_META_PRIORITY = 0x2 NFT_META_MARK = 0x3 NFT_META_IIF = 0x4 NFT_META_OIF = 0x5 NFT_META_IIFNAME = 0x6 NFT_META_OIFNAME = 0x7 NFT_META_IIFTYPE = 0x8 NFT_META_OIFTYPE = 0x9 NFT_META_SKUID = 0xa NFT_META_SKGID = 0xb NFT_META_NFTRACE = 0xc NFT_META_RTCLASSID = 0xd NFT_META_SECMARK = 0xe NFT_META_NFPROTO = 0xf NFT_META_L4PROTO = 0x10 NFT_META_BRI_IIFNAME = 0x11 NFT_META_BRI_OIFNAME = 0x12 NFT_META_PKTTYPE = 0x13 NFT_META_CPU = 0x14 NFT_META_IIFGROUP = 0x15 NFT_META_OIFGROUP = 0x16 NFT_META_CGROUP = 0x17 NFT_META_PRANDOM = 0x18 NFT_RT_CLASSID = 0x0 NFT_RT_NEXTHOP4 = 0x1 NFT_RT_NEXTHOP6 = 0x2 NFT_RT_TCPMSS = 0x3 NFT_HASH_JENKINS = 0x0 NFT_HASH_SYM = 0x1 NFTA_HASH_UNSPEC = 0x0 NFTA_HASH_SREG = 0x1 NFTA_HASH_DREG = 0x2 NFTA_HASH_LEN = 0x3 NFTA_HASH_MODULUS = 0x4 NFTA_HASH_SEED = 0x5 NFTA_HASH_OFFSET = 0x6 NFTA_HASH_TYPE = 0x7 NFTA_META_UNSPEC = 0x0 NFTA_META_DREG = 0x1 NFTA_META_KEY = 0x2 NFTA_META_SREG = 0x3 NFTA_RT_UNSPEC = 0x0 NFTA_RT_DREG = 0x1 NFTA_RT_KEY = 0x2 NFT_CT_STATE = 0x0 NFT_CT_DIRECTION = 0x1 NFT_CT_STATUS = 0x2 NFT_CT_MARK = 0x3 NFT_CT_SECMARK = 0x4 NFT_CT_EXPIRATION = 0x5 NFT_CT_HELPER = 0x6 NFT_CT_L3PROTOCOL = 0x7 NFT_CT_SRC = 0x8 NFT_CT_DST = 0x9 NFT_CT_PROTOCOL = 0xa NFT_CT_PROTO_SRC = 0xb NFT_CT_PROTO_DST = 0xc NFT_CT_LABELS = 0xd NFT_CT_PKTS = 0xe NFT_CT_BYTES = 0xf NFT_CT_AVGPKT = 0x10 NFT_CT_ZONE = 0x11 NFT_CT_EVENTMASK = 0x12 NFTA_CT_UNSPEC = 0x0 NFTA_CT_DREG = 0x1 NFTA_CT_KEY = 0x2 NFTA_CT_DIRECTION = 0x3 NFTA_CT_SREG = 0x4 NFT_LIMIT_PKTS = 0x0 NFT_LIMIT_PKT_BYTES = 0x1 NFT_LIMIT_F_INV = 0x1 NFTA_LIMIT_UNSPEC = 0x0 NFTA_LIMIT_RATE = 0x1 NFTA_LIMIT_UNIT = 0x2 NFTA_LIMIT_BURST = 0x3 NFTA_LIMIT_TYPE = 0x4 NFTA_LIMIT_FLAGS = 0x5 NFTA_LIMIT_PAD = 0x6 NFTA_COUNTER_UNSPEC = 0x0 NFTA_COUNTER_BYTES = 0x1 NFTA_COUNTER_PACKETS = 0x2 NFTA_COUNTER_PAD = 0x3 NFTA_LOG_UNSPEC = 0x0 NFTA_LOG_GROUP = 0x1 NFTA_LOG_PREFIX = 0x2 NFTA_LOG_SNAPLEN = 0x3 NFTA_LOG_QTHRESHOLD = 0x4 NFTA_LOG_LEVEL = 0x5 NFTA_LOG_FLAGS = 0x6 NFTA_QUEUE_UNSPEC = 0x0 NFTA_QUEUE_NUM = 0x1 NFTA_QUEUE_TOTAL = 0x2 NFTA_QUEUE_FLAGS = 0x3 NFTA_QUEUE_SREG_QNUM = 0x4 NFT_QUOTA_F_INV = 0x1 NFT_QUOTA_F_DEPLETED = 0x2 NFTA_QUOTA_UNSPEC = 0x0 NFTA_QUOTA_BYTES = 0x1 NFTA_QUOTA_FLAGS = 0x2 NFTA_QUOTA_PAD = 0x3 NFTA_QUOTA_CONSUMED = 0x4 NFT_REJECT_ICMP_UNREACH = 0x0 NFT_REJECT_TCP_RST = 0x1 NFT_REJECT_ICMPX_UNREACH = 0x2 NFT_REJECT_ICMPX_NO_ROUTE = 0x0 NFT_REJECT_ICMPX_PORT_UNREACH = 0x1 NFT_REJECT_ICMPX_HOST_UNREACH = 0x2 NFT_REJECT_ICMPX_ADMIN_PROHIBITED = 0x3 NFTA_REJECT_UNSPEC = 0x0 NFTA_REJECT_TYPE = 0x1 NFTA_REJECT_ICMP_CODE = 0x2 NFT_NAT_SNAT = 0x0 NFT_NAT_DNAT = 0x1 NFTA_NAT_UNSPEC = 0x0 NFTA_NAT_TYPE = 0x1 NFTA_NAT_FAMILY = 0x2 NFTA_NAT_REG_ADDR_MIN = 0x3 NFTA_NAT_REG_ADDR_MAX = 0x4 NFTA_NAT_REG_PROTO_MIN = 0x5 NFTA_NAT_REG_PROTO_MAX = 0x6 NFTA_NAT_FLAGS = 0x7 NFTA_MASQ_UNSPEC = 0x0 NFTA_MASQ_FLAGS = 0x1 NFTA_MASQ_REG_PROTO_MIN = 0x2 NFTA_MASQ_REG_PROTO_MAX = 0x3 NFTA_REDIR_UNSPEC = 0x0 NFTA_REDIR_REG_PROTO_MIN = 0x1 NFTA_REDIR_REG_PROTO_MAX = 0x2 NFTA_REDIR_FLAGS = 0x3 NFTA_DUP_UNSPEC = 0x0 NFTA_DUP_SREG_ADDR = 0x1 NFTA_DUP_SREG_DEV = 0x2 NFTA_FWD_UNSPEC = 0x0 NFTA_FWD_SREG_DEV = 0x1 NFTA_OBJREF_UNSPEC = 0x0 NFTA_OBJREF_IMM_TYPE = 0x1 NFTA_OBJREF_IMM_NAME = 0x2 NFTA_OBJREF_SET_SREG = 0x3 NFTA_OBJREF_SET_NAME = 0x4 NFTA_OBJREF_SET_ID = 0x5 NFTA_GEN_UNSPEC = 0x0 NFTA_GEN_ID = 0x1 NFTA_GEN_PROC_PID = 0x2 NFTA_GEN_PROC_NAME = 0x3 NFTA_FIB_UNSPEC = 0x0 NFTA_FIB_DREG = 0x1 NFTA_FIB_RESULT = 0x2 NFTA_FIB_FLAGS = 0x3 NFT_FIB_RESULT_UNSPEC = 0x0 NFT_FIB_RESULT_OIF = 0x1 NFT_FIB_RESULT_OIFNAME = 0x2 NFT_FIB_RESULT_ADDRTYPE = 0x3 NFTA_FIB_F_SADDR = 0x1 NFTA_FIB_F_DADDR = 0x2 NFTA_FIB_F_MARK = 0x4 NFTA_FIB_F_IIF = 0x8 NFTA_FIB_F_OIF = 0x10 NFTA_FIB_F_PRESENT = 0x20 NFTA_CT_HELPER_UNSPEC = 0x0 NFTA_CT_HELPER_NAME = 0x1 NFTA_CT_HELPER_L3PROTO = 0x2 NFTA_CT_HELPER_L4PROTO = 0x3 NFTA_OBJ_UNSPEC = 0x0 NFTA_OBJ_TABLE = 0x1 NFTA_OBJ_NAME = 0x2 NFTA_OBJ_TYPE = 0x3 NFTA_OBJ_DATA = 0x4 NFTA_OBJ_USE = 0x5 NFTA_TRACE_UNSPEC = 0x0 NFTA_TRACE_TABLE = 0x1 NFTA_TRACE_CHAIN = 0x2 NFTA_TRACE_RULE_HANDLE = 0x3 NFTA_TRACE_TYPE = 0x4 NFTA_TRACE_VERDICT = 0x5 NFTA_TRACE_ID = 0x6 NFTA_TRACE_LL_HEADER = 0x7 NFTA_TRACE_NETWORK_HEADER = 0x8 NFTA_TRACE_TRANSPORT_HEADER = 0x9 NFTA_TRACE_IIF = 0xa NFTA_TRACE_IIFTYPE = 0xb NFTA_TRACE_OIF = 0xc NFTA_TRACE_OIFTYPE = 0xd NFTA_TRACE_MARK = 0xe NFTA_TRACE_NFPROTO = 0xf NFTA_TRACE_POLICY = 0x10 NFTA_TRACE_PAD = 0x11 NFT_TRACETYPE_UNSPEC = 0x0 NFT_TRACETYPE_POLICY = 0x1 NFT_TRACETYPE_RETURN = 0x2 NFT_TRACETYPE_RULE = 0x3 NFTA_NG_UNSPEC = 0x0 NFTA_NG_DREG = 0x1 NFTA_NG_MODULUS = 0x2 NFTA_NG_TYPE = 0x3 NFTA_NG_OFFSET = 0x4 NFT_NG_INCREMENTAL = 0x0 NFT_NG_RANDOM = 0x1 ) type RTCTime struct { Sec int32 Min int32 Hour int32 Mday int32 Mon int32 Year int32 Wday int32 Yday int32 Isdst int32 } type RTCWkAlrm struct { Enabled uint8 Pending uint8 Time RTCTime } type RTCPLLInfo struct { Ctrl int32 Value int32 Max int32 Min int32 Posmult int32 Negmult int32 Clock int64 } type BlkpgIoctlArg struct { Op int32 Flags int32 Datalen int32 Data *byte } type BlkpgPartition struct { Start int64 Length int64 Pno int32 Devname [64]uint8 Volname [64]uint8 _ [4]byte } const ( BLKPG = 0x1269 BLKPG_ADD_PARTITION = 0x1 BLKPG_DEL_PARTITION = 0x2 BLKPG_RESIZE_PARTITION = 0x3 ) const ( NETNSA_NONE = 0x0 NETNSA_NSID = 0x1 NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) type XDPRingOffset struct { Producer uint64 Consumer uint64 Desc uint64 } type XDPMmapOffsets struct { Rx XDPRingOffset Tx XDPRingOffset Fr XDPRingOffset Cr XDPRingOffset } type XDPUmemReg struct { Addr uint64 Len uint64 Size uint32 Headroom uint32 } type XDPStatistics struct { Rx_dropped uint64 Rx_invalid_descs uint64 Tx_invalid_descs uint64 } type XDPDesc struct { Addr uint64 Len uint32 Options uint32 } const ( NCSI_CMD_UNSPEC = 0x0 NCSI_CMD_PKG_INFO = 0x1 NCSI_CMD_SET_INTERFACE = 0x2 NCSI_CMD_CLEAR_INTERFACE = 0x3 NCSI_ATTR_UNSPEC = 0x0 NCSI_ATTR_IFINDEX = 0x1 NCSI_ATTR_PACKAGE_LIST = 0x2 NCSI_ATTR_PACKAGE_ID = 0x3 NCSI_ATTR_CHANNEL_ID = 0x4 NCSI_PKG_ATTR_UNSPEC = 0x0 NCSI_PKG_ATTR = 0x1 NCSI_PKG_ATTR_ID = 0x2 NCSI_PKG_ATTR_FORCED = 0x3 NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 NCSI_CHANNEL_ATTR_UNSPEC = 0x0 NCSI_CHANNEL_ATTR = 0x1 NCSI_CHANNEL_ATTR_ID = 0x2 NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 NCSI_CHANNEL_ATTR_ACTIVE = 0x7 NCSI_CHANNEL_ATTR_FORCED = 0x8 NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) type ScmTimestamping struct { Ts [3]Timespec } const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 SOF_TIMESTAMPING_RX_HARDWARE = 0x4 SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 SOF_TIMESTAMPING_SOFTWARE = 0x10 SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 SOF_TIMESTAMPING_OPT_ID = 0x80 SOF_TIMESTAMPING_TX_SCHED = 0x100 SOF_TIMESTAMPING_TX_ACK = 0x200 SOF_TIMESTAMPING_OPT_CMSG = 0x400 SOF_TIMESTAMPING_OPT_TSONLY = 0x800 SOF_TIMESTAMPING_OPT_STATS = 0x1000 SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff SCM_TSTAMP_SND = 0x0 SCM_TSTAMP_SCHED = 0x1 SCM_TSTAMP_ACK = 0x2 ) type SockExtendedErr struct { Errno uint32 Origin uint8 Type uint8 Code uint8 Pad uint8 Info uint32 Data uint32 } type FanotifyEventMetadata struct { Event_len uint32 Vers uint8 Reserved uint8 Metadata_len uint16 Mask uint64 Fd int32 Pid int32 } type FanotifyResponse struct { Fd int32 Response uint32 } const ( CRYPTO_MSG_BASE = 0x10 CRYPTO_MSG_NEWALG = 0x10 CRYPTO_MSG_DELALG = 0x11 CRYPTO_MSG_UPDATEALG = 0x12 CRYPTO_MSG_GETALG = 0x13 CRYPTO_MSG_DELRNG = 0x14 CRYPTO_MSG_GETSTAT = 0x15 ) const ( CRYPTOCFGA_UNSPEC = 0x0 CRYPTOCFGA_PRIORITY_VAL = 0x1 CRYPTOCFGA_REPORT_LARVAL = 0x2 CRYPTOCFGA_REPORT_HASH = 0x3 CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 CRYPTOCFGA_REPORT_AEAD = 0x5 CRYPTOCFGA_REPORT_COMPRESS = 0x6 CRYPTOCFGA_REPORT_RNG = 0x7 CRYPTOCFGA_REPORT_CIPHER = 0x8 CRYPTOCFGA_REPORT_AKCIPHER = 0x9 CRYPTOCFGA_REPORT_KPP = 0xa CRYPTOCFGA_REPORT_ACOMP = 0xb CRYPTOCFGA_STAT_LARVAL = 0xc CRYPTOCFGA_STAT_HASH = 0xd CRYPTOCFGA_STAT_BLKCIPHER = 0xe CRYPTOCFGA_STAT_AEAD = 0xf CRYPTOCFGA_STAT_COMPRESS = 0x10 CRYPTOCFGA_STAT_RNG = 0x11 CRYPTOCFGA_STAT_CIPHER = 0x12 CRYPTOCFGA_STAT_AKCIPHER = 0x13 CRYPTOCFGA_STAT_KPP = 0x14 CRYPTOCFGA_STAT_ACOMP = 0x15 ) type CryptoUserAlg struct { Name [64]int8 Driver_name [64]int8 Module_name [64]int8 Type uint32 Mask uint32 Refcnt uint32 Flags uint32 } type CryptoStatAEAD struct { Type [64]int8 Encrypt_cnt uint64 Encrypt_tlen uint64 Decrypt_cnt uint64 Decrypt_tlen uint64 Err_cnt uint64 } type CryptoStatAKCipher struct { Type [64]int8 Encrypt_cnt uint64 Encrypt_tlen uint64 Decrypt_cnt uint64 Decrypt_tlen uint64 Verify_cnt uint64 Sign_cnt uint64 Err_cnt uint64 } type CryptoStatCipher struct { Type [64]int8 Encrypt_cnt uint64 Encrypt_tlen uint64 Decrypt_cnt uint64 Decrypt_tlen uint64 Err_cnt uint64 } type CryptoStatCompress struct { Type [64]int8 Compress_cnt uint64 Compress_tlen uint64 Decompress_cnt uint64 Decompress_tlen uint64 Err_cnt uint64 } type CryptoStatHash struct { Type [64]int8 Hash_cnt uint64 Hash_tlen uint64 Err_cnt uint64 } type CryptoStatKPP struct { Type [64]int8 Setsecret_cnt uint64 Generate_public_key_cnt uint64 Compute_shared_secret_cnt uint64 Err_cnt uint64 } type CryptoStatRNG struct { Type [64]int8 Generate_cnt uint64 Generate_tlen uint64 Seed_cnt uint64 Err_cnt uint64 } type CryptoStatLarval struct { Type [64]int8 } type CryptoReportLarval struct { Type [64]int8 } type CryptoReportHash struct { Type [64]int8 Blocksize uint32 Digestsize uint32 } type CryptoReportCipher struct { Type [64]int8 Blocksize uint32 Min_keysize uint32 Max_keysize uint32 } type CryptoReportBlkCipher struct { Type [64]int8 Geniv [64]int8 Blocksize uint32 Min_keysize uint32 Max_keysize uint32 Ivsize uint32 } type CryptoReportAEAD struct { Type [64]int8 Geniv [64]int8 Blocksize uint32 Maxauthsize uint32 Ivsize uint32 } type CryptoReportComp struct { Type [64]int8 } type CryptoReportRNG struct { Type [64]int8 Seedsize uint32 } type CryptoReportAKCipher struct { Type [64]int8 } type CryptoReportKPP struct { Type [64]int8 } type CryptoReportAcomp struct { Type [64]int8 } const ( BPF_REG_0 = 0x0 BPF_REG_1 = 0x1 BPF_REG_2 = 0x2 BPF_REG_3 = 0x3 BPF_REG_4 = 0x4 BPF_REG_5 = 0x5 BPF_REG_6 = 0x6 BPF_REG_7 = 0x7 BPF_REG_8 = 0x8 BPF_REG_9 = 0x9 BPF_REG_10 = 0xa BPF_MAP_CREATE = 0x0 BPF_MAP_LOOKUP_ELEM = 0x1 BPF_MAP_UPDATE_ELEM = 0x2 BPF_MAP_DELETE_ELEM = 0x3 BPF_MAP_GET_NEXT_KEY = 0x4 BPF_PROG_LOAD = 0x5 BPF_OBJ_PIN = 0x6 BPF_OBJ_GET = 0x7 BPF_PROG_ATTACH = 0x8 BPF_PROG_DETACH = 0x9 BPF_PROG_TEST_RUN = 0xa BPF_PROG_GET_NEXT_ID = 0xb BPF_MAP_GET_NEXT_ID = 0xc BPF_PROG_GET_FD_BY_ID = 0xd BPF_MAP_GET_FD_BY_ID = 0xe BPF_OBJ_GET_INFO_BY_FD = 0xf BPF_PROG_QUERY = 0x10 BPF_RAW_TRACEPOINT_OPEN = 0x11 BPF_BTF_LOAD = 0x12 BPF_BTF_GET_FD_BY_ID = 0x13 BPF_TASK_FD_QUERY = 0x14 BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 BPF_MAP_TYPE_UNSPEC = 0x0 BPF_MAP_TYPE_HASH = 0x1 BPF_MAP_TYPE_ARRAY = 0x2 BPF_MAP_TYPE_PROG_ARRAY = 0x3 BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 BPF_MAP_TYPE_PERCPU_HASH = 0x5 BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 BPF_MAP_TYPE_STACK_TRACE = 0x7 BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 BPF_MAP_TYPE_LRU_HASH = 0x9 BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa BPF_MAP_TYPE_LPM_TRIE = 0xb BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc BPF_MAP_TYPE_HASH_OF_MAPS = 0xd BPF_MAP_TYPE_DEVMAP = 0xe BPF_MAP_TYPE_SOCKMAP = 0xf BPF_MAP_TYPE_CPUMAP = 0x10 BPF_MAP_TYPE_XSKMAP = 0x11 BPF_MAP_TYPE_SOCKHASH = 0x12 BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 BPF_MAP_TYPE_QUEUE = 0x16 BPF_MAP_TYPE_STACK = 0x17 BPF_PROG_TYPE_UNSPEC = 0x0 BPF_PROG_TYPE_SOCKET_FILTER = 0x1 BPF_PROG_TYPE_KPROBE = 0x2 BPF_PROG_TYPE_SCHED_CLS = 0x3 BPF_PROG_TYPE_SCHED_ACT = 0x4 BPF_PROG_TYPE_TRACEPOINT = 0x5 BPF_PROG_TYPE_XDP = 0x6 BPF_PROG_TYPE_PERF_EVENT = 0x7 BPF_PROG_TYPE_CGROUP_SKB = 0x8 BPF_PROG_TYPE_CGROUP_SOCK = 0x9 BPF_PROG_TYPE_LWT_IN = 0xa BPF_PROG_TYPE_LWT_OUT = 0xb BPF_PROG_TYPE_LWT_XMIT = 0xc BPF_PROG_TYPE_SOCK_OPS = 0xd BPF_PROG_TYPE_SK_SKB = 0xe BPF_PROG_TYPE_CGROUP_DEVICE = 0xf BPF_PROG_TYPE_SK_MSG = 0x10 BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 BPF_PROG_TYPE_LIRC_MODE2 = 0x14 BPF_PROG_TYPE_SK_REUSEPORT = 0x15 BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 BPF_CGROUP_INET_INGRESS = 0x0 BPF_CGROUP_INET_EGRESS = 0x1 BPF_CGROUP_INET_SOCK_CREATE = 0x2 BPF_CGROUP_SOCK_OPS = 0x3 BPF_SK_SKB_STREAM_PARSER = 0x4 BPF_SK_SKB_STREAM_VERDICT = 0x5 BPF_CGROUP_DEVICE = 0x6 BPF_SK_MSG_VERDICT = 0x7 BPF_CGROUP_INET4_BIND = 0x8 BPF_CGROUP_INET6_BIND = 0x9 BPF_CGROUP_INET4_CONNECT = 0xa BPF_CGROUP_INET6_CONNECT = 0xb BPF_CGROUP_INET4_POST_BIND = 0xc BPF_CGROUP_INET6_POST_BIND = 0xd BPF_CGROUP_UDP4_SENDMSG = 0xe BPF_CGROUP_UDP6_SENDMSG = 0xf BPF_LIRC_MODE2 = 0x10 BPF_FLOW_DISSECTOR = 0x11 BPF_STACK_BUILD_ID_EMPTY = 0x0 BPF_STACK_BUILD_ID_VALID = 0x1 BPF_STACK_BUILD_ID_IP = 0x2 BPF_ADJ_ROOM_NET = 0x0 BPF_HDR_START_MAC = 0x0 BPF_HDR_START_NET = 0x1 BPF_LWT_ENCAP_SEG6 = 0x0 BPF_LWT_ENCAP_SEG6_INLINE = 0x1 BPF_OK = 0x0 BPF_DROP = 0x2 BPF_REDIRECT = 0x7 BPF_SOCK_OPS_VOID = 0x0 BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 BPF_SOCK_OPS_RWND_INIT = 0x2 BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 BPF_SOCK_OPS_NEEDS_ECN = 0x6 BPF_SOCK_OPS_BASE_RTT = 0x7 BPF_SOCK_OPS_RTO_CB = 0x8 BPF_SOCK_OPS_RETRANS_CB = 0x9 BPF_SOCK_OPS_STATE_CB = 0xa BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb BPF_TCP_ESTABLISHED = 0x1 BPF_TCP_SYN_SENT = 0x2 BPF_TCP_SYN_RECV = 0x3 BPF_TCP_FIN_WAIT1 = 0x4 BPF_TCP_FIN_WAIT2 = 0x5 BPF_TCP_TIME_WAIT = 0x6 BPF_TCP_CLOSE = 0x7 BPF_TCP_CLOSE_WAIT = 0x8 BPF_TCP_LAST_ACK = 0x9 BPF_TCP_LISTEN = 0xa BPF_TCP_CLOSING = 0xb BPF_TCP_NEW_SYN_RECV = 0xc BPF_TCP_MAX_STATES = 0xd BPF_FIB_LKUP_RET_SUCCESS = 0x0 BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 BPF_FIB_LKUP_RET_PROHIBIT = 0x3 BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 BPF_FD_TYPE_TRACEPOINT = 0x1 BPF_FD_TYPE_KPROBE = 0x2 BPF_FD_TYPE_KRETPROBE = 0x3 BPF_FD_TYPE_UPROBE = 0x4 BPF_FD_TYPE_URETPROBE = 0x5 )
{ "pile_set_name": "Github" }
/* * Copyright Strimzi authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package io.strimzi.kafka.bridge.http.converter; import io.strimzi.kafka.bridge.converter.MessageConverter; import io.vertx.core.buffer.Buffer; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import io.vertx.kafka.client.consumer.KafkaConsumerRecord; import io.vertx.kafka.client.consumer.KafkaConsumerRecords; import io.vertx.kafka.client.producer.KafkaHeader; import io.vertx.kafka.client.producer.KafkaProducerRecord; import io.vertx.kafka.client.producer.impl.KafkaHeaderImpl; import javax.xml.bind.DatatypeConverter; import java.util.ArrayList; import java.util.List; public class HttpBinaryMessageConverter implements MessageConverter<byte[], byte[], Buffer, Buffer> { @Override public KafkaProducerRecord<byte[], byte[]> toKafkaRecord(String kafkaTopic, Integer partition, Buffer message) { Integer partitionFromBody = null; byte[] key = null; byte[] value = null; List<KafkaHeader> headers = new ArrayList<>(); JsonObject json = message.toJsonObject(); if (!json.isEmpty()) { if (json.containsKey("key")) { key = DatatypeConverter.parseBase64Binary(json.getString("key")); } if (json.containsKey("value")) { value = DatatypeConverter.parseBase64Binary(json.getString("value")); } if (json.containsKey("headers")) { for (Object obj: json.getJsonArray("headers")) { JsonObject jsonObject = (JsonObject) obj; headers.add(new KafkaHeaderImpl( jsonObject.getString("key"), Buffer.factory.buffer( DatatypeConverter.parseBase64Binary(jsonObject.getString("value"))))); } } if (json.containsKey("partition")) { partitionFromBody = json.getInteger("partition"); } if (partition != null && partitionFromBody != null) { throw new IllegalStateException("Partition specified in body and in request path"); } if (partition != null) { partitionFromBody = partition; } } KafkaProducerRecord<byte[], byte[]> record = KafkaProducerRecord.create(kafkaTopic, key, value, partitionFromBody); record.addHeaders(headers); return record; } @Override public List<KafkaProducerRecord<byte[], byte[]>> toKafkaRecords(String kafkaTopic, Integer partition, Buffer messages) { List<KafkaProducerRecord<byte[], byte[]>> records = new ArrayList<>(); JsonObject json = messages.toJsonObject(); JsonArray jsonArray = json.getJsonArray("records"); for (Object obj : jsonArray) { JsonObject jsonObj = (JsonObject) obj; records.add(toKafkaRecord(kafkaTopic, partition, jsonObj.toBuffer())); } return records; } @Override public Buffer toMessage(String address, KafkaConsumerRecord<byte[], byte[]> record) { throw new UnsupportedOperationException(); } @Override public Buffer toMessages(KafkaConsumerRecords<byte[], byte[]> records) { JsonArray jsonArray = new JsonArray(); for (int i = 0; i < records.size(); i++) { JsonObject jsonObject = new JsonObject(); KafkaConsumerRecord<byte[], byte[]> record = records.recordAt(i); jsonObject.put("topic", record.topic()); jsonObject.put("key", record.key() != null ? DatatypeConverter.printBase64Binary(records.recordAt(i).key()) : null); jsonObject.put("value", record.value() != null ? DatatypeConverter.printBase64Binary(records.recordAt(i).value()) : null); jsonObject.put("partition", record.partition()); jsonObject.put("offset", record.offset()); if (!record.headers().isEmpty()) { JsonArray headers = new JsonArray(); for (KafkaHeader kafkaHeader: record.headers()) { JsonObject header = new JsonObject(); header.put("key", kafkaHeader.key()); header.put("value", DatatypeConverter.printBase64Binary(kafkaHeader.value().getBytes())); headers.add(header); } jsonObject.put("headers", headers); } jsonArray.add(jsonObject); } return jsonArray.toBuffer(); } }
{ "pile_set_name": "Github" }
// Choreo version 1 actor "!target2" { channel "audio" { event speak "ep_02.sheckley_trainingnags01" { time 0.162602 2.276843 param "ep_02.sheckley_trainingnags01" fixedlength cctype "cc_master" cctoken "" } } channel "look at" { event lookat "!player" { time 0.012957 2.784807 param "!player" event_ramp { 0.4788 1.0000 2.2079 1.0000 } } } channel "move to" { } channel "gestures" { } channel "postures" { event gesture "1" { time 0.229167 2.429167 param "bg_right" absolutetags playback_time { "apex" 0.153846 "extreme" 0.292308 "loop" 0.476923 "end" 0.723077 } absolutetags shifted_time { "apex" 0.153846 "extreme" 0.292308 "loop" 0.476923 "end" 0.723077 } } } channel "facial flex" { } } scalesettings { "CChoreoView" "164" "ExpressionTool" "100" "RampTool" "74" "GestureTool" "100" "SceneRampTool" "100" } fps 60 snap off ignorePhonemes off
{ "pile_set_name": "Github" }
package org.ripple.bouncycastle.jce.interfaces; import java.security.PublicKey; import org.ripple.bouncycastle.math.ec.ECPoint; /** * interface for elliptic curve public keys. */ public interface ECPublicKey extends ECKey, PublicKey { /** * return the public point Q */ public ECPoint getQ(); }
{ "pile_set_name": "Github" }
// Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) var url = require("url") function resolveUrl(/* ...urls */) { return Array.prototype.reduce.call(arguments, function(resolved, nextUrl) { return url.resolve(resolved, nextUrl) }) } module.exports = resolveUrl
{ "pile_set_name": "Github" }
// Copyright (c) 2006, 2007 Julio M. Merino Vidal // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling // Copyright (c) 2009 Boris Schaeling // Copyright (c) 2010 Felipe Tanus, Boris Schaeling // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling // Copyright (c) 2016 Klemens D. Morgenstern // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PROCESS_POSIX_PIPE_OUT_HPP #define BOOST_PROCESS_POSIX_PIPE_OUT_HPP #include <boost/process/detail/posix/handler.hpp> #include <boost/process/detail/posix/file_descriptor.hpp> #include <unistd.h> namespace boost { namespace process { namespace detail { namespace posix { template<int p1, int p2> struct null_out : handler_base_ext { file_descriptor sink{"/dev/null", file_descriptor::write}; template <typename Executor> void on_exec_setup(Executor &e) const; }; template<> template<typename Executor> void null_out<1,-1>::on_exec_setup(Executor &e) const { if (::dup2(sink.handle(), STDOUT_FILENO) == -1) e.set_error(::boost::process::detail::get_last_error(), "dup2() failed"); } template<> template<typename Executor> void null_out<2,-1>::on_exec_setup(Executor &e) const { if (::dup2(sink.handle(), STDERR_FILENO) == -1) e.set_error(::boost::process::detail::get_last_error(), "dup2() failed"); } template<> template<typename Executor> void null_out<1,2>::on_exec_setup(Executor &e) const { if (::dup2(sink.handle(), STDOUT_FILENO) == -1) e.set_error(::boost::process::detail::get_last_error(), "dup2() failed"); if (::dup2(sink.handle(), STDERR_FILENO) == -1) e.set_error(::boost::process::detail::get_last_error(), "dup2() failed"); } }}}} #endif
{ "pile_set_name": "Github" }
/* * Copyright (C) 2011 John Crispin <blogic@openwrt.org> * Copyright (C) 2011 Andrej Vlašić <andrej.vlasic0@gmail.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. */ #ifndef _DEV_WIFI_ATHXK_H__ #define _DEV_WIFI_ATHXK_H__ extern void ltq_register_ath5k(u16 *eeprom_data, u8 *macaddr); extern void ltq_register_ath9k(u16 *eeprom_data, u8 *macaddr); #endif
{ "pile_set_name": "Github" }
/** * DummyCompleter() lets tests easily specify the results of a partial * hash completion request. */ function DummyCompleter() { this.fragments = {}; this.queries = []; this.tableName = "test-phish-simple"; } DummyCompleter.prototype = { QueryInterface: ChromeUtils.generateQI(["nsIUrlClassifierHashCompleter"]), complete(partialHash, gethashUrl, tableName, cb) { this.queries.push(partialHash); var fragments = this.fragments; var self = this; var doCallback = function() { if (self.alwaysFail) { cb.completionFinished(Cr.NS_ERROR_FAILURE); return; } if (fragments[partialHash]) { for (var i = 0; i < fragments[partialHash].length; i++) { var chunkId = fragments[partialHash][i][0]; var hash = fragments[partialHash][i][1]; cb.completionV2(hash, self.tableName, chunkId); } } cb.completionFinished(0); }; executeSoon(doCallback); }, getHash(fragment) { var converter = Cc[ "@mozilla.org/intl/scriptableunicodeconverter" ].createInstance(Ci.nsIScriptableUnicodeConverter); converter.charset = "UTF-8"; var data = converter.convertToByteArray(fragment); var ch = Cc["@mozilla.org/security/hash;1"].createInstance( Ci.nsICryptoHash ); ch.init(ch.SHA256); ch.update(data, data.length); var hash = ch.finish(false); return hash.slice(0, 32); }, addFragment(chunkId, fragment) { this.addHash(chunkId, this.getHash(fragment)); }, // This method allows the caller to generate complete hashes that match the // prefix of a real fragment, but have different complete hashes. addConflict(chunkId, fragment) { var realHash = this.getHash(fragment); var invalidHash = this.getHash("blah blah blah blah blah"); this.addHash(chunkId, realHash.slice(0, 4) + invalidHash.slice(4, 32)); }, addHash(chunkId, hash) { var partial = hash.slice(0, 4); if (this.fragments[partial]) { this.fragments[partial].push([chunkId, hash]); } else { this.fragments[partial] = [[chunkId, hash]]; } }, compareQueries(fragments) { var expectedQueries = []; for (let i = 0; i < fragments.length; i++) { expectedQueries.push(this.getHash(fragments[i]).slice(0, 4)); } Assert.equal(this.queries.length, expectedQueries.length); expectedQueries.sort(); this.queries.sort(); for (let i = 0; i < this.queries.length; i++) { Assert.equal(this.queries[i], expectedQueries[i]); } }, }; function setupCompleter(table, hits, conflicts) { var completer = new DummyCompleter(); completer.tableName = table; for (let i = 0; i < hits.length; i++) { let chunkId = hits[i][0]; let fragments = hits[i][1]; for (let j = 0; j < fragments.length; j++) { completer.addFragment(chunkId, fragments[j]); } } for (let i = 0; i < conflicts.length; i++) { let chunkId = conflicts[i][0]; let fragments = conflicts[i][1]; for (let j = 0; j < fragments.length; j++) { completer.addConflict(chunkId, fragments[j]); } } dbservice.setHashCompleter(table, completer); return completer; } function installCompleter(table, fragments, conflictFragments) { return setupCompleter(table, fragments, conflictFragments); } function installFailingCompleter(table) { var completer = setupCompleter(table, [], []); completer.alwaysFail = true; return completer; } // Helper assertion for checking dummy completer queries gAssertions.completerQueried = function(data, cb) { var completer = data[0]; completer.compareQueries(data[1]); cb(); }; function doTest(updates, assertions) { doUpdateTest(updates, assertions, runNextTest, updateError); } // Test an add of two partial urls to a fresh database function testPartialAdds() { var addUrls = ["foo.com/a", "foo.com/b", "bar.com/c"]; var update = buildPhishingUpdate([{ chunkNum: 1, urls: addUrls }], 4); var completer = installCompleter("test-phish-simple", [[1, addUrls]], []); var assertions = { tableData: "test-phish-simple;a:1", urlsExist: addUrls, completerQueried: [completer, addUrls], }; doTest([update], assertions); } function testPartialAddsWithConflicts() { var addUrls = ["foo.com/a", "foo.com/b", "bar.com/c"]; var update = buildPhishingUpdate([{ chunkNum: 1, urls: addUrls }], 4); // Each result will have both a real match and a conflict var completer = installCompleter( "test-phish-simple", [[1, addUrls]], [[1, addUrls]] ); var assertions = { tableData: "test-phish-simple;a:1", urlsExist: addUrls, completerQueried: [completer, addUrls], }; doTest([update], assertions); } // Test whether the fragmenting code does not cause duplicated completions function testFragments() { var addUrls = ["foo.com/a/b/c", "foo.net/", "foo.com/c/"]; var update = buildPhishingUpdate([{ chunkNum: 1, urls: addUrls }], 4); var completer = installCompleter("test-phish-simple", [[1, addUrls]], []); var assertions = { tableData: "test-phish-simple;a:1", urlsExist: addUrls, completerQueried: [completer, addUrls], }; doTest([update], assertions); } // Test http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec // section 6.2 example 1 function testSpecFragments() { var probeUrls = ["a.b.c/1/2.html?param=1"]; var addUrls = [ "a.b.c/1/2.html", "a.b.c/", "a.b.c/1/", "b.c/1/2.html?param=1", "b.c/1/2.html", "b.c/", "b.c/1/", "a.b.c/1/2.html?param=1", ]; var update = buildPhishingUpdate([{ chunkNum: 1, urls: addUrls }], 4); var completer = installCompleter("test-phish-simple", [[1, addUrls]], []); var assertions = { tableData: "test-phish-simple;a:1", urlsExist: probeUrls, completerQueried: [completer, addUrls], }; doTest([update], assertions); } // Test http://code.google.com/p/google-safe-browsing/wiki/Protocolv2Spec // section 6.2 example 2 function testMoreSpecFragments() { var probeUrls = ["a.b.c.d.e.f.g/1.html"]; var addUrls = [ "a.b.c.d.e.f.g/1.html", "a.b.c.d.e.f.g/", "c.d.e.f.g/1.html", "c.d.e.f.g/", "d.e.f.g/1.html", "d.e.f.g/", "e.f.g/1.html", "e.f.g/", "f.g/1.html", "f.g/", ]; var update = buildPhishingUpdate([{ chunkNum: 1, urls: addUrls }], 4); var completer = installCompleter("test-phish-simple", [[1, addUrls]], []); var assertions = { tableData: "test-phish-simple;a:1", urlsExist: probeUrls, completerQueried: [completer, addUrls], }; doTest([update], assertions); } function testFalsePositives() { var addUrls = ["foo.com/a", "foo.com/b", "bar.com/c"]; var update = buildPhishingUpdate([{ chunkNum: 1, urls: addUrls }], 4); // Each result will have no matching complete hashes and a non-matching // conflict var completer = installCompleter("test-phish-simple", [], [[1, addUrls]]); var assertions = { tableData: "test-phish-simple;a:1", urlsDontExist: addUrls, completerQueried: [completer, addUrls], }; doTest([update], assertions); } function testEmptyCompleter() { var addUrls = ["foo.com/a", "foo.com/b", "bar.com/c"]; var update = buildPhishingUpdate([{ chunkNum: 1, urls: addUrls }], 4); // Completer will never return full hashes var completer = installCompleter("test-phish-simple", [], []); var assertions = { tableData: "test-phish-simple;a:1", urlsDontExist: addUrls, completerQueried: [completer, addUrls], }; doTest([update], assertions); } function testCompleterFailure() { var addUrls = ["foo.com/a", "foo.com/b", "bar.com/c"]; var update = buildPhishingUpdate([{ chunkNum: 1, urls: addUrls }], 4); // Completer will never return full hashes var completer = installFailingCompleter("test-phish-simple"); var assertions = { tableData: "test-phish-simple;a:1", urlsDontExist: addUrls, completerQueried: [completer, addUrls], }; doTest([update], assertions); } function testMixedSizesSameDomain() { var add1Urls = ["foo.com/a"]; var add2Urls = ["foo.com/b"]; var update1 = buildPhishingUpdate([{ chunkNum: 1, urls: add1Urls }], 4); var update2 = buildPhishingUpdate([{ chunkNum: 2, urls: add2Urls }], 32); // We should only need to complete the partial hashes var completer = installCompleter("test-phish-simple", [[1, add1Urls]], []); var assertions = { tableData: "test-phish-simple;a:1-2", // both urls should match... urlsExist: add1Urls.concat(add2Urls), // ... but the completer should only be queried for the partial entry completerQueried: [completer, add1Urls], }; doTest([update1, update2], assertions); } function testMixedSizesDifferentDomains() { var add1Urls = ["foo.com/a"]; var add2Urls = ["bar.com/b"]; var update1 = buildPhishingUpdate([{ chunkNum: 1, urls: add1Urls }], 4); var update2 = buildPhishingUpdate([{ chunkNum: 2, urls: add2Urls }], 32); // We should only need to complete the partial hashes var completer = installCompleter("test-phish-simple", [[1, add1Urls]], []); var assertions = { tableData: "test-phish-simple;a:1-2", // both urls should match... urlsExist: add1Urls.concat(add2Urls), // ... but the completer should only be queried for the partial entry completerQueried: [completer, add1Urls], }; doTest([update1, update2], assertions); } function testInvalidHashSize() { var addUrls = ["foo.com/a", "foo.com/b", "bar.com/c"]; var update = buildPhishingUpdate([{ chunkNum: 1, urls: addUrls }], 12); // only 4 and 32 are legal hash sizes var addUrls2 = ["zaz.com/a", "xyz.com/b"]; var update2 = buildPhishingUpdate([{ chunkNum: 2, urls: addUrls2 }], 4); installCompleter("test-phish-simple", [[1, addUrls]], []); var assertions = { tableData: "test-phish-simple;a:2", urlsDontExist: addUrls, }; // A successful update will trigger an error doUpdateTest([update2, update], assertions, updateError, runNextTest); } function testWrongTable() { var addUrls = ["foo.com/a"]; var update = buildPhishingUpdate([{ chunkNum: 1, urls: addUrls }], 4); var completer = installCompleter( "test-malware-simple", // wrong table [[1, addUrls]], [] ); // The above installCompleter installs the completer for test-malware-simple, // we want it to be used for test-phish-simple too. dbservice.setHashCompleter("test-phish-simple", completer); var assertions = { tableData: "test-phish-simple;a:1", // The urls were added as phishing urls, but the completer is claiming // that they are malware urls, and we trust the completer in this case. // The result will be discarded, so we can only check for non-existence. urlsDontExist: addUrls, // Make sure the completer was actually queried. completerQueried: [completer, addUrls], }; doUpdateTest( [update], assertions, function() { // Give the dbservice a chance to (not) cache the result. do_timeout(3000, function() { // The miss earlier will have caused a miss to be cached. // Resetting the completer does not count as an update, // so we will not be probed again. var newCompleter = installCompleter( "test-malware-simple", [[1, addUrls]], [] ); dbservice.setHashCompleter("test-phish-simple", newCompleter); var assertions1 = { urlsDontExist: addUrls, }; checkAssertions(assertions1, runNextTest); }); }, updateError ); } function setupCachedResults(addUrls, part2) { var update = buildPhishingUpdate([{ chunkNum: 1, urls: addUrls }], 4); var completer = installCompleter("test-phish-simple", [[1, addUrls]], []); var assertions = { tableData: "test-phish-simple;a:1", // Request the add url. This should cause the completion to be cached. urlsExist: addUrls, // Make sure the completer was actually queried. completerQueried: [completer, addUrls], }; doUpdateTest( [update], assertions, function() { // Give the dbservice a chance to cache the result. do_timeout(3000, part2); }, updateError ); } function testCachedResults() { setupCachedResults(["foo.com/a"], function(add) { // This is called after setupCachedResults(). Verify that // checking the url again does not cause a completer request. // install a new completer, this one should never be queried. var newCompleter = installCompleter("test-phish-simple", [[1, []]], []); var assertions = { urlsExist: ["foo.com/a"], completerQueried: [newCompleter, []], }; checkAssertions(assertions, runNextTest); }); } function testCachedResultsWithSub() { setupCachedResults(["foo.com/a"], function() { // install a new completer, this one should never be queried. var newCompleter = installCompleter("test-phish-simple", [[1, []]], []); var removeUpdate = buildPhishingUpdate( [{ chunkNum: 2, chunkType: "s", urls: ["1:foo.com/a"] }], 4 ); var assertions = { urlsDontExist: ["foo.com/a"], completerQueried: [newCompleter, []], }; doTest([removeUpdate], assertions); }); } function testCachedResultsWithExpire() { setupCachedResults(["foo.com/a"], function() { // install a new completer, this one should never be queried. var newCompleter = installCompleter("test-phish-simple", [[1, []]], []); var expireUpdate = "n:1000\ni:test-phish-simple\nad:1\n"; var assertions = { urlsDontExist: ["foo.com/a"], completerQueried: [newCompleter, []], }; doTest([expireUpdate], assertions); }); } function testCachedResultsFailure() { var existUrls = ["foo.com/a"]; setupCachedResults(existUrls, function() { // This is called after setupCachedResults(). Verify that // checking the url again does not cause a completer request. // install a new completer, this one should never be queried. var newCompleter = installCompleter("test-phish-simple", [[1, []]], []); var assertions = { urlsExist: existUrls, completerQueried: [newCompleter, []], }; checkAssertions(assertions, function() { // Apply the update. The cached completes should be gone. doErrorUpdate( "test-phish-simple,test-malware-simple", function() { // Now the completer gets queried again. var newCompleter2 = installCompleter( "test-phish-simple", [[1, existUrls]], [] ); var assertions2 = { tableData: "test-phish-simple;a:1", urlsExist: existUrls, completerQueried: [newCompleter2, existUrls], }; checkAssertions(assertions2, runNextTest); }, updateError ); }); }); } function testErrorList() { var addUrls = ["foo.com/a", "foo.com/b", "bar.com/c"]; var update = buildPhishingUpdate([{ chunkNum: 1, urls: addUrls }], 4); // The update failure should will kill the completes, so the above // must be a prefix to get any hit at all past the update failure. var completer = installCompleter("test-phish-simple", [[1, addUrls]], []); var assertions = { tableData: "test-phish-simple;a:1", urlsExist: addUrls, // These are complete urls, and will only be completed if the // list is stale. completerQueried: [completer, addUrls], }; // Apply the update. doStreamUpdate( update, function() { // Now the test-phish-simple and test-malware-simple tables are marked // as fresh. Fake an update failure to mark them stale. doErrorUpdate( "test-phish-simple,test-malware-simple", function() { // Now the lists should be marked stale. Check assertions. checkAssertions(assertions, runNextTest); }, updateError ); }, updateError ); } // Verify that different lists (test-phish-simple, // test-malware-simple) maintain their freshness separately. function testErrorListIndependent() { var phishUrls = ["phish.com/a"]; var malwareUrls = ["attack.com/a"]; var update = buildPhishingUpdate([{ chunkNum: 1, urls: phishUrls }], 4); // These have to persist past the update failure, so they must be prefixes, // not completes. update += buildMalwareUpdate([{ chunkNum: 2, urls: malwareUrls }], 32); var completer = installCompleter("test-phish-simple", [[1, phishUrls]], []); var assertions = { tableData: "test-malware-simple;a:2\ntest-phish-simple;a:1", urlsExist: phishUrls, malwareUrlsExist: malwareUrls, // Only this phishing urls should be completed, because only the phishing // urls will be stale. completerQueried: [completer, phishUrls], }; // Apply the update. doStreamUpdate( update, function() { // Now the test-phish-simple and test-malware-simple tables are // marked as fresh. Fake an update failure to mark *just* // phishing data as stale. doErrorUpdate( "test-phish-simple", function() { // Now the lists should be marked stale. Check assertions. checkAssertions(assertions, runNextTest); }, updateError ); }, updateError ); } function run_test() { runTests([ testPartialAdds, testPartialAddsWithConflicts, testFragments, testSpecFragments, testMoreSpecFragments, testFalsePositives, testEmptyCompleter, testCompleterFailure, testMixedSizesSameDomain, testMixedSizesDifferentDomains, testInvalidHashSize, testWrongTable, testCachedResults, testCachedResultsWithSub, testCachedResultsWithExpire, testCachedResultsFailure, testErrorList, testErrorListIndependent, ]); } do_test_pending();
{ "pile_set_name": "Github" }
/** ****************************************************************************** * @file stm32h7xx_hal_hash_ex.c * @author MCD Application Team * @brief Extended HASH HAL module driver. * This file provides firmware functions to manage the following * functionalities of the HASH peripheral for SHA-224 and SHA-256 * alogrithms: * + HASH or HMAC processing in polling mode * + HASH or HMAC processing in interrupt mode * + HASH or HMAC processing in DMA mode * Additionally, this file provides functions to manage HMAC * multi-buffer DMA-based processing for MD-5, SHA-1, SHA-224 * and SHA-256. * * @verbatim =============================================================================== ##### HASH peripheral extended features ##### =============================================================================== [..] The SHA-224 and SHA-256 HASH and HMAC processing can be carried out exactly the same way as for SHA-1 or MD-5 algorithms. (#) Three modes are available. (##) Polling mode: processing APIs are blocking functions i.e. they process the data and wait till the digest computation is finished, e.g. HAL_HASHEx_xxx_Start() (##) Interrupt mode: processing APIs are not blocking functions i.e. they process the data under interrupt, e.g. HAL_HASHEx_xxx_Start_IT() (##) DMA mode: processing APIs are not blocking functions and the CPU is not used for data transfer i.e. the data transfer is ensured by DMA, e.g. HAL_HASHEx_xxx_Start_DMA(). Note that in DMA mode, a call to HAL_HASHEx_xxx_Finish() is then required to retrieve the digest. (#)Multi-buffer processing is possible in polling, interrupt and DMA modes. (##) In polling mode, only multi-buffer HASH processing is possible. API HAL_HASHEx_xxx_Accumulate() must be called for each input buffer, except for the last one. User must resort to HAL_HASHEx_xxx_Accumulate_End() to enter the last one and retrieve as well the computed digest. (##) In interrupt mode, API HAL_HASHEx_xxx_Accumulate_IT() must be called for each input buffer, except for the last one. User must resort to HAL_HASHEx_xxx_Accumulate_End_IT() to enter the last one and retrieve as well the computed digest. (##) In DMA mode, multi-buffer HASH and HMAC processing are possible. (+++) HASH processing: once initialization is done, MDMAT bit must be set thru __HAL_HASH_SET_MDMAT() macro. From that point, each buffer can be fed to the Peripheral thru HAL_HASHEx_xxx_Start_DMA() API. Before entering the last buffer, reset the MDMAT bit with __HAL_HASH_RESET_MDMAT() macro then wrap-up the HASH processing in feeding the last input buffer thru the same API HAL_HASHEx_xxx_Start_DMA(). The digest can then be retrieved with a call to API HAL_HASHEx_xxx_Finish(). (+++) HMAC processing (MD-5, SHA-1, SHA-224 and SHA-256 must all resort to extended functions): after initialization, the key and the first input buffer are entered in the Peripheral with the API HAL_HMACEx_xxx_Step1_2_DMA(). This carries out HMAC step 1 and starts step 2. The following buffers are next entered with the API HAL_HMACEx_xxx_Step2_DMA(). At this point, the HMAC processing is still carrying out step 2. Then, step 2 for the last input buffer and step 3 are carried out by a single call to HAL_HMACEx_xxx_Step2_3_DMA(). The digest can finally be retrieved with a call to API HAL_HASH_xxx_Finish() for MD-5 and SHA-1, to HAL_HASHEx_xxx_Finish() for SHA-224 and SHA-256. @endverbatim ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "stm32h7xx_hal.h" /** @addtogroup STM32H7xx_HAL_Driver * @{ */ #if defined (HASH) /** @defgroup HASHEx HASHEx * @brief HASH HAL extended module driver. * @{ */ #ifdef HAL_HASH_MODULE_ENABLED /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** @defgroup HASHEx_Exported_Functions HASH Extended Exported Functions * @{ */ /** @defgroup HASHEx_Exported_Functions_Group1 HASH extended processing functions in polling mode * @brief HASH extended processing functions using polling mode. * @verbatim =============================================================================== ##### Polling mode HASH extended processing functions ##### =============================================================================== [..] This section provides functions allowing to calculate in polling mode the hash value using one of the following algorithms: (+) SHA224 (++) HAL_HASHEx_SHA224_Start() (++) HAL_HASHEx_SHA224_Accmlt() (++) HAL_HASHEx_SHA224_Accmlt_End() (+) SHA256 (++) HAL_HASHEx_SHA256_Start() (++) HAL_HASHEx_SHA256_Accmlt() (++) HAL_HASHEx_SHA256_Accmlt_End() [..] For a single buffer to be hashed, user can resort to HAL_HASH_xxx_Start(). [..] In case of multi-buffer HASH processing (a single digest is computed while several buffers are fed to the Peripheral), the user can resort to successive calls to HAL_HASHEx_xxx_Accumulate() and wrap-up the digest computation by a call to HAL_HASHEx_xxx_Accumulate_End(). @endverbatim * @{ */ /** * @brief Initialize the HASH peripheral in SHA224 mode, next process pInBuffer then * read the computed digest. * @note Digest is available in pOutBuffer. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @param pOutBuffer pointer to the computed digest. Digest size is 28 bytes. * @param Timeout Timeout value * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout) { return HASH_Start(hhash, pInBuffer, Size, pOutBuffer, Timeout, HASH_ALGOSELECTION_SHA224); } /** * @brief If not already done, initialize the HASH peripheral in SHA224 mode then * processes pInBuffer. * @note Consecutive calls to HAL_HASHEx_SHA224_Accmlt() can be used to feed * several input buffers back-to-back to the Peripheral that will yield a single * HASH signature once all buffers have been entered. Wrap-up of input * buffers feeding and retrieval of digest is done by a call to * HAL_HASHEx_SHA224_Accmlt_End(). * @note Field hhash->Phase of HASH handle is tested to check whether or not * the Peripheral has already been initialized. * @note Digest is not retrieved by this API, user must resort to HAL_HASHEx_SHA224_Accmlt_End() * to read it, feeding at the same time the last input buffer to the Peripheral. * @note The input buffer size (in bytes) must be a multiple of 4 otherwise, the * HASH digest computation is corrupted. Only HAL_HASHEx_SHA224_Accmlt_End() is able * to manage the ending buffer with a length in bytes not a multiple of 4. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes, must be a multiple of 4. * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA224_Accmlt(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { return HASH_Accumulate(hhash, pInBuffer, Size,HASH_ALGOSELECTION_SHA224); } /** * @brief End computation of a single HASH signature after several calls to HAL_HASHEx_SHA224_Accmlt() API. * @note Digest is available in pOutBuffer. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @param pOutBuffer pointer to the computed digest. Digest size is 28 bytes. * @param Timeout Timeout value * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA224_Accmlt_End(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout) { return HASH_Start(hhash, pInBuffer, Size, pOutBuffer, Timeout, HASH_ALGOSELECTION_SHA224); } /** * @brief Initialize the HASH peripheral in SHA256 mode, next process pInBuffer then * read the computed digest. * @note Digest is available in pOutBuffer. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @param pOutBuffer pointer to the computed digest. Digest size is 32 bytes. * @param Timeout Timeout value * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout) { return HASH_Start(hhash, pInBuffer, Size, pOutBuffer, Timeout, HASH_ALGOSELECTION_SHA256); } /** * @brief If not already done, initialize the HASH peripheral in SHA256 mode then * processes pInBuffer. * @note Consecutive calls to HAL_HASHEx_SHA256_Accmlt() can be used to feed * several input buffers back-to-back to the Peripheral that will yield a single * HASH signature once all buffers have been entered. Wrap-up of input * buffers feeding and retrieval of digest is done by a call to * HAL_HASHEx_SHA256_Accmlt_End(). * @note Field hhash->Phase of HASH handle is tested to check whether or not * the Peripheral has already been initialized. * @note Digest is not retrieved by this API, user must resort to HAL_HASHEx_SHA256_Accmlt_End() * to read it, feeding at the same time the last input buffer to the Peripheral. * @note The input buffer size (in bytes) must be a multiple of 4 otherwise, the * HASH digest computation is corrupted. Only HAL_HASHEx_SHA256_Accmlt_End() is able * to manage the ending buffer with a length in bytes not a multiple of 4. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes, must be a multiple of 4. * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA256_Accmlt(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { return HASH_Accumulate(hhash, pInBuffer, Size,HASH_ALGOSELECTION_SHA256); } /** * @brief End computation of a single HASH signature after several calls to HAL_HASHEx_SHA256_Accmlt() API. * @note Digest is available in pOutBuffer. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @param pOutBuffer pointer to the computed digest. Digest size is 32 bytes. * @param Timeout Timeout value * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA256_Accmlt_End(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout) { return HASH_Start(hhash, pInBuffer, Size, pOutBuffer, Timeout, HASH_ALGOSELECTION_SHA256); } /** * @} */ /** @defgroup HASHEx_Exported_Functions_Group2 HASH extended processing functions in interrupt mode * @brief HASH extended processing functions using interrupt mode. * @verbatim =============================================================================== ##### Interruption mode HASH extended processing functions ##### =============================================================================== [..] This section provides functions allowing to calculate in interrupt mode the hash value using one of the following algorithms: (+) SHA224 (++) HAL_HASHEx_SHA224_Start_IT() (++) HAL_HASHEx_SHA224_Accmlt_IT() (++) HAL_HASHEx_SHA224_Accmlt_End_IT() (+) SHA256 (++) HAL_HASHEx_SHA256_Start_IT() (++) HAL_HASHEx_SHA256_Accmlt_IT() (++) HAL_HASHEx_SHA256_Accmlt_End_IT() @endverbatim * @{ */ /** * @brief Initialize the HASH peripheral in SHA224 mode, next process pInBuffer then * read the computed digest in interruption mode. * @note Digest is available in pOutBuffer. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @param pOutBuffer pointer to the computed digest. Digest size is 28 bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer) { return HASH_Start_IT(hhash, pInBuffer, Size, pOutBuffer,HASH_ALGOSELECTION_SHA224); } /** * @brief If not already done, initialize the HASH peripheral in SHA224 mode then * processes pInBuffer in interruption mode. * @note Consecutive calls to HAL_HASHEx_SHA224_Accmlt_IT() can be used to feed * several input buffers back-to-back to the Peripheral that will yield a single * HASH signature once all buffers have been entered. Wrap-up of input * buffers feeding and retrieval of digest is done by a call to * HAL_HASHEx_SHA224_Accmlt_End_IT(). * @note Field hhash->Phase of HASH handle is tested to check whether or not * the Peripheral has already been initialized. * @note The input buffer size (in bytes) must be a multiple of 4 otherwise, the * HASH digest computation is corrupted. Only HAL_HASHEx_SHA224_Accmlt_End_IT() is able * to manage the ending buffer with a length in bytes not a multiple of 4. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes, must be a multiple of 4. * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA224_Accmlt_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { return HASH_Accumulate_IT(hhash, pInBuffer, Size,HASH_ALGOSELECTION_SHA224); } /** * @brief End computation of a single HASH signature after several calls to HAL_HASHEx_SHA224_Accmlt_IT() API. * @note Digest is available in pOutBuffer. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @param pOutBuffer pointer to the computed digest. Digest size is 28 bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA224_Accmlt_End_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer) { return HASH_Start_IT(hhash, pInBuffer, Size, pOutBuffer,HASH_ALGOSELECTION_SHA224); } /** * @brief Initialize the HASH peripheral in SHA256 mode, next process pInBuffer then * read the computed digest in interruption mode. * @note Digest is available in pOutBuffer. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @param pOutBuffer pointer to the computed digest. Digest size is 32 bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer) { return HASH_Start_IT(hhash, pInBuffer, Size, pOutBuffer,HASH_ALGOSELECTION_SHA256); } /** * @brief If not already done, initialize the HASH peripheral in SHA256 mode then * processes pInBuffer in interruption mode. * @note Consecutive calls to HAL_HASHEx_SHA256_Accmlt_IT() can be used to feed * several input buffers back-to-back to the Peripheral that will yield a single * HASH signature once all buffers have been entered. Wrap-up of input * buffers feeding and retrieval of digest is done by a call to * HAL_HASHEx_SHA256_Accmlt_End_IT(). * @note Field hhash->Phase of HASH handle is tested to check whether or not * the Peripheral has already been initialized. * @note The input buffer size (in bytes) must be a multiple of 4 otherwise, the * HASH digest computation is corrupted. Only HAL_HASHEx_SHA256_Accmlt_End_IT() is able * to manage the ending buffer with a length in bytes not a multiple of 4. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes, must be a multiple of 4. * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA256_Accmlt_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { return HASH_Accumulate_IT(hhash, pInBuffer, Size,HASH_ALGOSELECTION_SHA256); } /** * @brief End computation of a single HASH signature after several calls to HAL_HASHEx_SHA256_Accmlt_IT() API. * @note Digest is available in pOutBuffer. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @param pOutBuffer pointer to the computed digest. Digest size is 32 bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA256_Accmlt_End_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer) { return HASH_Start_IT(hhash, pInBuffer, Size, pOutBuffer,HASH_ALGOSELECTION_SHA256); } /** * @} */ /** @defgroup HASHEx_Exported_Functions_Group3 HASH extended processing functions in DMA mode * @brief HASH extended processing functions using DMA mode. * @verbatim =============================================================================== ##### DMA mode HASH extended processing functionss ##### =============================================================================== [..] This section provides functions allowing to calculate in DMA mode the hash value using one of the following algorithms: (+) SHA224 (++) HAL_HASHEx_SHA224_Start_DMA() (++) HAL_HASHEx_SHA224_Finish() (+) SHA256 (++) HAL_HASHEx_SHA256_Start_DMA() (++) HAL_HASHEx_SHA256_Finish() [..] When resorting to DMA mode to enter the data in the Peripheral, user must resort to HAL_HASHEx_xxx_Start_DMA() then read the resulting digest with HAL_HASHEx_xxx_Finish(). [..] In case of multi-buffer HASH processing, MDMAT bit must first be set before the successive calls to HAL_HASHEx_xxx_Start_DMA(). Then, MDMAT bit needs to be reset before the last call to HAL_HASHEx_xxx_Start_DMA(). Digest is finally retrieved thanks to HAL_HASHEx_xxx_Finish(). @endverbatim * @{ */ /** * @brief Initialize the HASH peripheral in SHA224 mode then initiate a DMA transfer * to feed the input buffer to the Peripheral. * @note Once the DMA transfer is finished, HAL_HASHEx_SHA224_Finish() API must * be called to retrieve the computed digest. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { return HASH_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224); } /** * @brief Return the computed digest in SHA224 mode. * @note The API waits for DCIS to be set then reads the computed digest. * @note HAL_HASHEx_SHA224_Finish() can be used as well to retrieve the digest in * HMAC SHA224 mode. * @param hhash HASH handle. * @param pOutBuffer pointer to the computed digest. Digest size is 28 bytes. * @param Timeout Timeout value. * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA224_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout) { return HASH_Finish(hhash, pOutBuffer, Timeout); } /** * @brief Initialize the HASH peripheral in SHA256 mode then initiate a DMA transfer * to feed the input buffer to the Peripheral. * @note Once the DMA transfer is finished, HAL_HASHEx_SHA256_Finish() API must * be called to retrieve the computed digest. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { return HASH_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256); } /** * @brief Return the computed digest in SHA256 mode. * @note The API waits for DCIS to be set then reads the computed digest. * @note HAL_HASHEx_SHA256_Finish() can be used as well to retrieve the digest in * HMAC SHA256 mode. * @param hhash HASH handle. * @param pOutBuffer pointer to the computed digest. Digest size is 32 bytes. * @param Timeout Timeout value. * @retval HAL status */ HAL_StatusTypeDef HAL_HASHEx_SHA256_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout) { return HASH_Finish(hhash, pOutBuffer, Timeout); } /** * @} */ /** @defgroup HASHEx_Exported_Functions_Group4 HMAC extended processing functions in polling mode * @brief HMAC extended processing functions using polling mode. * @verbatim =============================================================================== ##### Polling mode HMAC extended processing functions ##### =============================================================================== [..] This section provides functions allowing to calculate in polling mode the HMAC value using one of the following algorithms: (+) SHA224 (++) HAL_HMACEx_SHA224_Start() (+) SHA256 (++) HAL_HMACEx_SHA256_Start() @endverbatim * @{ */ /** * @brief Initialize the HASH peripheral in HMAC SHA224 mode, next process pInBuffer then * read the computed digest. * @note Digest is available in pOutBuffer. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @param pOutBuffer pointer to the computed digest. Digest size is 28 bytes. * @param Timeout Timeout value. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout) { return HMAC_Start(hhash, pInBuffer, Size, pOutBuffer, Timeout, HASH_ALGOSELECTION_SHA224); } /** * @brief Initialize the HASH peripheral in HMAC SHA256 mode, next process pInBuffer then * read the computed digest. * @note Digest is available in pOutBuffer. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @param pOutBuffer pointer to the computed digest. Digest size is 32 bytes. * @param Timeout Timeout value. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout) { return HMAC_Start(hhash, pInBuffer, Size, pOutBuffer, Timeout, HASH_ALGOSELECTION_SHA256); } /** * @} */ /** @defgroup HASHEx_Exported_Functions_Group5 HMAC extended processing functions in interrupt mode * @brief HMAC extended processing functions using interruption mode. * @verbatim =============================================================================== ##### Interrupt mode HMAC extended processing functions ##### =============================================================================== [..] This section provides functions allowing to calculate in interrupt mode the HMAC value using one of the following algorithms: (+) SHA224 (++) HAL_HMACEx_SHA224_Start_IT() (+) SHA256 (++) HAL_HMACEx_SHA256_Start_IT() @endverbatim * @{ */ /** * @brief Initialize the HASH peripheral in HMAC SHA224 mode, next process pInBuffer then * read the computed digest in interrupt mode. * @note Digest is available in pOutBuffer. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @param pOutBuffer pointer to the computed digest. Digest size is 28 bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA224_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer) { return HMAC_Start_IT(hhash, pInBuffer, Size, pOutBuffer, HASH_ALGOSELECTION_SHA224); } /** * @brief Initialize the HASH peripheral in HMAC SHA256 mode, next process pInBuffer then * read the computed digest in interrupt mode. * @note Digest is available in pOutBuffer. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @param pOutBuffer pointer to the computed digest. Digest size is 32 bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA256_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer) { return HMAC_Start_IT(hhash, pInBuffer, Size, pOutBuffer, HASH_ALGOSELECTION_SHA256); } /** * @} */ /** @defgroup HASHEx_Exported_Functions_Group6 HMAC extended processing functions in DMA mode * @brief HMAC extended processing functions using DMA mode. * @verbatim =============================================================================== ##### DMA mode HMAC extended processing functions ##### =============================================================================== [..] This section provides functions allowing to calculate in DMA mode the HMAC value using one of the following algorithms: (+) SHA224 (++) HAL_HMACEx_SHA224_Start_DMA() (+) SHA256 (++) HAL_HMACEx_SHA256_Start_DMA() [..] When resorting to DMA mode to enter the data in the Peripheral for HMAC processing, user must resort to HAL_HMACEx_xxx_Start_DMA() then read the resulting digest with HAL_HASHEx_xxx_Finish(). @endverbatim * @{ */ /** * @brief Initialize the HASH peripheral in HMAC SHA224 mode then initiate the required * DMA transfers to feed the key and the input buffer to the Peripheral. * @note Once the DMA transfers are finished (indicated by hhash->State set back * to HAL_HASH_STATE_READY), HAL_HASHEx_SHA224_Finish() API must be called to retrieve * the computed digest. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note If MDMAT bit is set before calling this function (multi-buffer * HASH processing case), the input buffer size (in bytes) must be * a multiple of 4 otherwise, the HASH digest computation is corrupted. * For the processing of the last buffer of the thread, MDMAT bit must * be reset and the buffer length (in bytes) doesn't have to be a * multiple of 4. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224); } /** * @brief Initialize the HASH peripheral in HMAC SHA224 mode then initiate the required * DMA transfers to feed the key and the input buffer to the Peripheral. * @note Once the DMA transfers are finished (indicated by hhash->State set back * to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve * the computed digest. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note If MDMAT bit is set before calling this function (multi-buffer * HASH processing case), the input buffer size (in bytes) must be * a multiple of 4 otherwise, the HASH digest computation is corrupted. * For the processing of the last buffer of the thread, MDMAT bit must * be reset and the buffer length (in bytes) doesn't have to be a * multiple of 4. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (buffer to be hashed). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256); } /** * @} */ /** @defgroup HASHEx_Exported_Functions_Group7 Multi-buffer HMAC extended processing functions in DMA mode * @brief HMAC extended processing functions in multi-buffer DMA mode. * @verbatim =============================================================================== ##### Multi-buffer DMA mode HMAC extended processing functions ##### =============================================================================== [..] This section provides functions to manage HMAC multi-buffer DMA-based processing for MD5, SHA1, SHA224 and SHA256 algorithms. (+) MD5 (++) HAL_HMACEx_MD5_Step1_2_DMA() (++) HAL_HMACEx_MD5_Step2_DMA() (++) HAL_HMACEx_MD5_Step2_3_DMA() (+) SHA1 (++) HAL_HMACEx_SHA1_Step1_2_DMA() (++) HAL_HMACEx_SHA1_Step2_DMA() (++) HAL_HMACEx_SHA1_Step2_3_DMA() (+) SHA256 (++) HAL_HMACEx_SHA224_Step1_2_DMA() (++) HAL_HMACEx_SHA224_Step2_DMA() (++) HAL_HMACEx_SHA224_Step2_3_DMA() (+) SHA256 (++) HAL_HMACEx_SHA256_Step1_2_DMA() (++) HAL_HMACEx_SHA256_Step2_DMA() (++) HAL_HMACEx_SHA256_Step2_3_DMA() [..] User must first start-up the multi-buffer DMA-based HMAC computation in calling HAL_HMACEx_xxx_Step1_2_DMA(). This carries out HMAC step 1 and intiates step 2 with the first input buffer. [..] The following buffers are next fed to the Peripheral with a call to the API HAL_HMACEx_xxx_Step2_DMA(). There may be several consecutive calls to this API. [..] Multi-buffer DMA-based HMAC computation is wrapped up by a call to HAL_HMACEx_xxx_Step2_3_DMA(). This finishes step 2 in feeding the last input buffer to the Peripheral then carries out step 3. [..] Digest is retrieved by a call to HAL_HASH_xxx_Finish() for MD-5 or SHA-1, to HAL_HASHEx_xxx_Finish() for SHA-224 or SHA-256. [..] If only two buffers need to be consecutively processed, a call to HAL_HMACEx_xxx_Step1_2_DMA() followed by a call to HAL_HMACEx_xxx_Step2_3_DMA() is sufficient. @endverbatim * @{ */ /** * @brief MD5 HMAC step 1 completion and step 2 start in multi-buffer DMA mode. * @note Step 1 consists in writing the inner hash function key in the Peripheral, * step 2 consists in writing the message text. * @note The API carries out the HMAC step 1 then starts step 2 with * the first buffer entered to the Peripheral. DCAL bit is not automatically set after * the message buffer feeding, allowing other messages DMA transfers to occur. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note The input buffer size (in bytes) must be a multiple of 4 otherwise, the * HASH digest computation is corrupted. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (message buffer). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_MD5_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { hhash->DigestCalculationDisable = SET; return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_MD5); } /** * @brief MD5 HMAC step 2 in multi-buffer DMA mode. * @note Step 2 consists in writing the message text in the Peripheral. * @note The API carries on the HMAC step 2, applied to the buffer entered as input * parameter. DCAL bit is not automatically set after the message buffer feeding, * allowing other messages DMA transfers to occur. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note The input buffer size (in bytes) must be a multiple of 4 otherwise, the * HASH digest computation is corrupted. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (message buffer). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { if (hhash->DigestCalculationDisable != SET) { return HAL_ERROR; } return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_MD5); } /** * @brief MD5 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode. * @note Step 2 consists in writing the message text in the Peripheral, * step 3 consists in writing the outer hash function key. * @note The API wraps up the HMAC step 2 in processing the buffer entered as input * parameter (the input buffer must be the last one of the multi-buffer thread) * then carries out HMAC step 3. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note Once the DMA transfers are finished (indicated by hhash->State set back * to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve * the computed digest. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (message buffer). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { hhash->DigestCalculationDisable = RESET; return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_MD5); } /** * @brief SHA1 HMAC step 1 completion and step 2 start in multi-buffer DMA mode. * @note Step 1 consists in writing the inner hash function key in the Peripheral, * step 2 consists in writing the message text. * @note The API carries out the HMAC step 1 then starts step 2 with * the first buffer entered to the Peripheral. DCAL bit is not automatically set after * the message buffer feeding, allowing other messages DMA transfers to occur. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note The input buffer size (in bytes) must be a multiple of 4 otherwise, the * HASH digest computation is corrupted. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (message buffer). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA1_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { hhash->DigestCalculationDisable = SET; return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA1); } /** * @brief SHA1 HMAC step 2 in multi-buffer DMA mode. * @note Step 2 consists in writing the message text in the Peripheral. * @note The API carries on the HMAC step 2, applied to the buffer entered as input * parameter. DCAL bit is not automatically set after the message buffer feeding, * allowing other messages DMA transfers to occur. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note The input buffer size (in bytes) must be a multiple of 4 otherwise, the * HASH digest computation is corrupted. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (message buffer). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { if (hhash->DigestCalculationDisable != SET) { return HAL_ERROR; } return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA1); } /** * @brief SHA1 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode. * @note Step 2 consists in writing the message text in the Peripheral, * step 3 consists in writing the outer hash function key. * @note The API wraps up the HMAC step 2 in processing the buffer entered as input * parameter (the input buffer must be the last one of the multi-buffer thread) * then carries out HMAC step 3. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note Once the DMA transfers are finished (indicated by hhash->State set back * to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve * the computed digest. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (message buffer). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { hhash->DigestCalculationDisable = RESET; return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA1); } /** * @brief SHA224 HMAC step 1 completion and step 2 start in multi-buffer DMA mode. * @note Step 1 consists in writing the inner hash function key in the Peripheral, * step 2 consists in writing the message text. * @note The API carries out the HMAC step 1 then starts step 2 with * the first buffer entered to the Peripheral. DCAL bit is not automatically set after * the message buffer feeding, allowing other messages DMA transfers to occur. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note The input buffer size (in bytes) must be a multiple of 4 otherwise, the * HASH digest computation is corrupted. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (message buffer). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA224_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { hhash->DigestCalculationDisable = SET; return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224); } /** * @brief SHA224 HMAC step 2 in multi-buffer DMA mode. * @note Step 2 consists in writing the message text in the Peripheral. * @note The API carries on the HMAC step 2, applied to the buffer entered as input * parameter. DCAL bit is not automatically set after the message buffer feeding, * allowing other messages DMA transfers to occur. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note The input buffer size (in bytes) must be a multiple of 4 otherwise, the * HASH digest computation is corrupted. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (message buffer). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { if (hhash->DigestCalculationDisable != SET) { return HAL_ERROR; } return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224); } /** * @brief SHA224 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode. * @note Step 2 consists in writing the message text in the Peripheral, * step 3 consists in writing the outer hash function key. * @note The API wraps up the HMAC step 2 in processing the buffer entered as input * parameter (the input buffer must be the last one of the multi-buffer thread) * then carries out HMAC step 3. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note Once the DMA transfers are finished (indicated by hhash->State set back * to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve * the computed digest. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (message buffer). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { hhash->DigestCalculationDisable = RESET; return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA224); } /** * @brief SHA256 HMAC step 1 completion and step 2 start in multi-buffer DMA mode. * @note Step 1 consists in writing the inner hash function key in the Peripheral, * step 2 consists in writing the message text. * @note The API carries out the HMAC step 1 then starts step 2 with * the first buffer entered to the Peripheral. DCAL bit is not automatically set after * the message buffer feeding, allowing other messages DMA transfers to occur. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note The input buffer size (in bytes) must be a multiple of 4 otherwise, the * HASH digest computation is corrupted. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (message buffer). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA256_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { hhash->DigestCalculationDisable = SET; return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256); } /** * @brief SHA256 HMAC step 2 in multi-buffer DMA mode. * @note Step 2 consists in writing the message text in the Peripheral. * @note The API carries on the HMAC step 2, applied to the buffer entered as input * parameter. DCAL bit is not automatically set after the message buffer feeding, * allowing other messages DMA transfers to occur. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note The input buffer size (in bytes) must be a multiple of 4 otherwise, the * HASH digest computation is corrupted. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (message buffer). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { if (hhash->DigestCalculationDisable != SET) { return HAL_ERROR; } return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256); } /** * @brief SHA256 HMAC step 2 wrap-up and step 3 completion in multi-buffer DMA mode. * @note Step 2 consists in writing the message text in the Peripheral, * step 3 consists in writing the outer hash function key. * @note The API wraps up the HMAC step 2 in processing the buffer entered as input * parameter (the input buffer must be the last one of the multi-buffer thread) * then carries out HMAC step 3. * @note Same key is used for the inner and the outer hash functions; pointer to key and * key size are respectively stored in hhash->Init.pKey and hhash->Init.KeySize. * @note Once the DMA transfers are finished (indicated by hhash->State set back * to HAL_HASH_STATE_READY), HAL_HASHEx_SHA256_Finish() API must be called to retrieve * the computed digest. * @param hhash HASH handle. * @param pInBuffer pointer to the input buffer (message buffer). * @param Size length of the input buffer in bytes. * @retval HAL status */ HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size) { hhash->DigestCalculationDisable = RESET; return HMAC_Start_DMA(hhash, pInBuffer, Size, HASH_ALGOSELECTION_SHA256); } /** * @} */ /** * @} */ #endif /* HAL_HASH_MODULE_ENABLED */ /** * @} */ #endif /* HASH*/ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
{ "pile_set_name": "Github" }
/* Loading Spinner ================================================================================ */ /** * Loading spinner for waiting events * @param {vjs.Player|Object} player * @param {Object=} options * @class * @constructor */ vjs.LoadingSpinner = vjs.Component.extend({ /** @constructor */ init: function(player, options){ vjs.Component.call(this, player, options); // MOVING DISPLAY HANDLING TO CSS // player.on('canplay', vjs.bind(this, this.hide)); // player.on('canplaythrough', vjs.bind(this, this.hide)); // player.on('playing', vjs.bind(this, this.hide)); // player.on('seeking', vjs.bind(this, this.show)); // in some browsers seeking does not trigger the 'playing' event, // so we also need to trap 'seeked' if we are going to set a // 'seeking' event // player.on('seeked', vjs.bind(this, this.hide)); // player.on('ended', vjs.bind(this, this.hide)); // Not showing spinner on stalled any more. Browsers may stall and then not trigger any events that would remove the spinner. // Checked in Chrome 16 and Safari 5.1.2. http://help.videojs.com/discussions/problems/883-why-is-the-download-progress-showing // player.on('stalled', vjs.bind(this, this.show)); // player.on('waiting', vjs.bind(this, this.show)); } }); vjs.LoadingSpinner.prototype.createEl = function(){ return vjs.Component.prototype.createEl.call(this, 'div', { className: 'vjs-loading-spinner' }); };
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 456569c675d05804d94bbf510b956cbe timeCreated: 1456811370 licenseType: Store TextureImporter: fileIDToRecycleName: {} serializedVersion: 2 mipmaps: mipMapMode: 0 enableMipMap: 1 linearTexture: 0 correctGamma: 0 fadeOut: 0 borderMipMap: 0 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: convertToNormalMap: 0 externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 0 cubemapConvolution: 0 cubemapConvolutionSteps: 7 cubemapConvolutionExponent: 1.5 seamlessCubemap: 0 textureFormat: -1 maxTextureSize: 2048 textureSettings: filterMode: -1 aniso: -1 mipBias: -1 wrapMode: -1 nPOTScale: 1 lightmap: 0 rGBM: 0 compressionQuality: 50 allowsAlphaSplitting: 0 spriteMode: 0 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 alphaIsTransparency: 0 textureType: -1 buildTargetSettings: [] spriteSheet: sprites: [] outline: [] spritePackingTag: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
def foo[T](x: T) = x /*start*/foo[Int](3)/*end*/ //Int
{ "pile_set_name": "Github" }
//===-- MipsFixupKinds.h - Mips Specific Fixup Entries ----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSFIXUPKINDS_H #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSFIXUPKINDS_H #include "llvm/MC/MCFixup.h" namespace llvm { namespace Mips { // Although most of the current fixup types reflect a unique relocation // one can have multiple fixup types for a given relocation and thus need // to be uniquely named. // // This table *must* be in the same order of // MCFixupKindInfo Infos[Mips::NumTargetFixupKinds] // in MipsAsmBackend.cpp. // enum Fixups { // Branch fixups resulting in R_MIPS_NONE. fixup_Mips_NONE = FirstTargetFixupKind, // Branch fixups resulting in R_MIPS_16. fixup_Mips_16, // Pure 32 bit data fixup resulting in - R_MIPS_32. fixup_Mips_32, // Full 32 bit data relative data fixup resulting in - R_MIPS_REL32. fixup_Mips_REL32, // Jump 26 bit fixup resulting in - R_MIPS_26. fixup_Mips_26, // Pure upper 16 bit fixup resulting in - R_MIPS_HI16. fixup_Mips_HI16, // Pure lower 16 bit fixup resulting in - R_MIPS_LO16. fixup_Mips_LO16, // 16 bit fixup for GP offest resulting in - R_MIPS_GPREL16. fixup_Mips_GPREL16, // 16 bit literal fixup resulting in - R_MIPS_LITERAL. fixup_Mips_LITERAL, // Symbol fixup resulting in - R_MIPS_GOT16. fixup_Mips_GOT, // PC relative branch fixup resulting in - R_MIPS_PC16. fixup_Mips_PC16, // resulting in - R_MIPS_CALL16. fixup_Mips_CALL16, // resulting in - R_MIPS_GPREL32. fixup_Mips_GPREL32, // resulting in - R_MIPS_SHIFT5. fixup_Mips_SHIFT5, // resulting in - R_MIPS_SHIFT6. fixup_Mips_SHIFT6, // Pure 64 bit data fixup resulting in - R_MIPS_64. fixup_Mips_64, // resulting in - R_MIPS_TLS_GD. fixup_Mips_TLSGD, // resulting in - R_MIPS_TLS_GOTTPREL. fixup_Mips_GOTTPREL, // resulting in - R_MIPS_TLS_TPREL_HI16. fixup_Mips_TPREL_HI, // resulting in - R_MIPS_TLS_TPREL_LO16. fixup_Mips_TPREL_LO, // resulting in - R_MIPS_TLS_LDM. fixup_Mips_TLSLDM, // resulting in - R_MIPS_TLS_DTPREL_HI16. fixup_Mips_DTPREL_HI, // resulting in - R_MIPS_TLS_DTPREL_LO16. fixup_Mips_DTPREL_LO, // PC relative branch fixup resulting in - R_MIPS_PC16 fixup_Mips_Branch_PCRel, // resulting in - R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16 // R_MICROMIPS_GPREL16/R_MICROMIPS_SUB/R_MICROMIPS_HI16 fixup_Mips_GPOFF_HI, fixup_MICROMIPS_GPOFF_HI, // resulting in - R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 // R_MICROMIPS_GPREL16/R_MICROMIPS_SUB/R_MICROMIPS_LO16 fixup_Mips_GPOFF_LO, fixup_MICROMIPS_GPOFF_LO, // resulting in - R_MIPS_PAGE fixup_Mips_GOT_PAGE, // resulting in - R_MIPS_GOT_OFST fixup_Mips_GOT_OFST, // resulting in - R_MIPS_GOT_DISP fixup_Mips_GOT_DISP, // resulting in - R_MIPS_HIGHER/R_MICROMIPS_HIGHER fixup_Mips_HIGHER, fixup_MICROMIPS_HIGHER, // resulting in - R_MIPS_HIGHEST/R_MICROMIPS_HIGHEST fixup_Mips_HIGHEST, fixup_MICROMIPS_HIGHEST, // resulting in - R_MIPS_GOT_HI16 fixup_Mips_GOT_HI16, // resulting in - R_MIPS_GOT_LO16 fixup_Mips_GOT_LO16, // resulting in - R_MIPS_CALL_HI16 fixup_Mips_CALL_HI16, // resulting in - R_MIPS_CALL_LO16 fixup_Mips_CALL_LO16, // resulting in - R_MIPS_PC18_S3 fixup_MIPS_PC18_S3, // resulting in - R_MIPS_PC19_S2 fixup_MIPS_PC19_S2, // resulting in - R_MIPS_PC21_S2 fixup_MIPS_PC21_S2, // resulting in - R_MIPS_PC26_S2 fixup_MIPS_PC26_S2, // resulting in - R_MIPS_PCHI16 fixup_MIPS_PCHI16, // resulting in - R_MIPS_PCLO16 fixup_MIPS_PCLO16, // resulting in - R_MICROMIPS_26_S1 fixup_MICROMIPS_26_S1, // resulting in - R_MICROMIPS_HI16 fixup_MICROMIPS_HI16, // resulting in - R_MICROMIPS_LO16 fixup_MICROMIPS_LO16, // resulting in - R_MICROMIPS_GOT16 fixup_MICROMIPS_GOT16, // resulting in - R_MICROMIPS_PC7_S1 fixup_MICROMIPS_PC7_S1, // resulting in - R_MICROMIPS_PC10_S1 fixup_MICROMIPS_PC10_S1, // resulting in - R_MICROMIPS_PC16_S1 fixup_MICROMIPS_PC16_S1, // resulting in - R_MICROMIPS_PC26_S1 fixup_MICROMIPS_PC26_S1, // resulting in - R_MICROMIPS_PC19_S2 fixup_MICROMIPS_PC19_S2, // resulting in - R_MICROMIPS_PC18_S3 fixup_MICROMIPS_PC18_S3, // resulting in - R_MICROMIPS_PC21_S1 fixup_MICROMIPS_PC21_S1, // resulting in - R_MICROMIPS_CALL16 fixup_MICROMIPS_CALL16, // resulting in - R_MICROMIPS_GOT_DISP fixup_MICROMIPS_GOT_DISP, // resulting in - R_MICROMIPS_GOT_PAGE fixup_MICROMIPS_GOT_PAGE, // resulting in - R_MICROMIPS_GOT_OFST fixup_MICROMIPS_GOT_OFST, // resulting in - R_MICROMIPS_TLS_GD fixup_MICROMIPS_TLS_GD, // resulting in - R_MICROMIPS_TLS_LDM fixup_MICROMIPS_TLS_LDM, // resulting in - R_MICROMIPS_TLS_DTPREL_HI16 fixup_MICROMIPS_TLS_DTPREL_HI16, // resulting in - R_MICROMIPS_TLS_DTPREL_LO16 fixup_MICROMIPS_TLS_DTPREL_LO16, // resulting in - R_MICROMIPS_TLS_GOTTPREL. fixup_MICROMIPS_GOTTPREL, // resulting in - R_MICROMIPS_TLS_TPREL_HI16 fixup_MICROMIPS_TLS_TPREL_HI16, // resulting in - R_MICROMIPS_TLS_TPREL_LO16 fixup_MICROMIPS_TLS_TPREL_LO16, // resulting in - R_MIPS_SUB/R_MICROMIPS_SUB fixup_Mips_SUB, fixup_MICROMIPS_SUB, // resulting in - R_MIPS_JALR/R_MICROMIPS_JALR fixup_Mips_JALR, fixup_MICROMIPS_JALR, // Marker LastTargetFixupKind, NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind }; } // namespace Mips } // namespace llvm #endif
{ "pile_set_name": "Github" }
// // File: ert_main.cpp // // Code generated for Simulink model 'bpm_blower_2_propulsion_module'. // // Model version : 1.1142 // Simulink Coder version : 8.11 (R2016b) 25-Aug-2016 // C/C++ source code generated on : Mon Sep 23 17:47:03 2019 // // Target selection: ert.tlc // Embedded hardware selection: 32-bit Generic // Code generation objectives: Unspecified // Validation result: Not run // #include <stddef.h> #include <stdio.h> // This ert_main.c example uses printf/fflush #include "bpm_blower_2_propulsion_module.h" // Model's header file #include "rtwtypes.h" // '<Root>/battery_voltage' static real32_T bpm_blower_2_propulsion_modul_U_battery_voltage; // '<Root>/omega_B_ECI_B' static real32_T bpm_blower_2_propulsion_modul_U_omega_B_ECI_B[3]; // '<Root>/impeller_cmd' static uint8_T bpm_blower_2_propulsion_modul_U_impeller_cmd; // '<Root>/servo_cmd' static real32_T bpm_blower_2_propulsion_modul_U_servo_cmd[6]; // '<Root>/veh_cm' static real32_T bpm_blower_2_propulsion_modul_U_veh_cm[3]; // '<Root>/impeller_current' static real32_T bpm_blower_2_propulsion_modul_Y_impeller_current; // '<Root>/servo_current' static real32_T bpm_blower_2_propulsion_modul_Y_servo_current[6]; // '<Root>/torque_B' static real32_T bpm_blower_2_propulsion_modul_Y_torque_B[3]; // '<Root>/force_B' static real32_T bpm_blower_2_propulsion_modul_Y_force_B[3]; // '<Root>/motor_speed' static real32_T bpm_blower_2_propulsion_modul_Y_motor_speed; // '<Root>/nozzle_theta' static real32_T bpm_blower_2_propulsion_modul_Y_nozzle_theta[6]; // '<Root>/meas_motor_speed' static real32_T bpm_blower_2_propulsion_modul_Y_meas_motor_speed; const char *RT_MEMORY_ALLOCATION_ERROR = "memory allocation error"; // // Associating rt_OneStep with a real-time clock or interrupt service routine // is what makes the generated code "real-time". The function rt_OneStep is // always associated with the base rate of the model. Subrates are managed // by the base rate from inside the generated code. Enabling/disabling // interrupts and floating point context switches are target specific. This // example code indicates where these should take place relative to executing // the generated code step function. Overrun behavior should be tailored to // your application needs. This example simply sets an error status in the // real-time model and returns from rt_OneStep. // void rt_OneStep(RT_MODEL_bpm_blower_2_propuls_T *const bpm_blower_2_propulsion_modu_M); void rt_OneStep(RT_MODEL_bpm_blower_2_propuls_T *const bpm_blower_2_propulsion_modu_M) { static boolean_T OverrunFlag = false; // Disable interrupts here // Check for overrun if (OverrunFlag) { rtmSetErrorStatus(bpm_blower_2_propulsion_modu_M, "Overrun"); return; } OverrunFlag = true; // Save FPU context here (if necessary) // Re-enable timer or interrupt here // Set model inputs here // Step the model bpm_blower_2_propulsion_module_step(bpm_blower_2_propulsion_modu_M, bpm_blower_2_propulsion_modul_U_battery_voltage, bpm_blower_2_propulsion_modul_U_omega_B_ECI_B, bpm_blower_2_propulsion_modul_U_impeller_cmd, bpm_blower_2_propulsion_modul_U_servo_cmd, bpm_blower_2_propulsion_modul_U_veh_cm, &bpm_blower_2_propulsion_modul_Y_impeller_current, bpm_blower_2_propulsion_modul_Y_servo_current, bpm_blower_2_propulsion_modul_Y_torque_B, bpm_blower_2_propulsion_modul_Y_force_B, &bpm_blower_2_propulsion_modul_Y_motor_speed, bpm_blower_2_propulsion_modul_Y_nozzle_theta, &bpm_blower_2_propulsion_modul_Y_meas_motor_speed); // Get model outputs here // Indicate task complete OverrunFlag = false; // Disable interrupts here // Restore FPU context here (if necessary) // Enable interrupts here } // // The example "main" function illustrates what is required by your // application code to initialize, execute, and terminate the generated code. // Attaching rt_OneStep to a real-time clock is target specific. This example // illustrates how you do this relative to initializing the model. // int_T main(int_T argc, const char *argv[]) { RT_MODEL_bpm_blower_2_propuls_T *bpm_blower_2_propulsion_modu_M; // Unused arguments (void)(argc); (void)(argv); // Allocate model data bpm_blower_2_propulsion_modu_M = bpm_blower_2_propulsion_module (&bpm_blower_2_propulsion_modul_U_battery_voltage, bpm_blower_2_propulsion_modul_U_omega_B_ECI_B, &bpm_blower_2_propulsion_modul_U_impeller_cmd, bpm_blower_2_propulsion_modul_U_servo_cmd, bpm_blower_2_propulsion_modul_U_veh_cm, &bpm_blower_2_propulsion_modul_Y_impeller_current, bpm_blower_2_propulsion_modul_Y_servo_current, bpm_blower_2_propulsion_modul_Y_torque_B, bpm_blower_2_propulsion_modul_Y_force_B, &bpm_blower_2_propulsion_modul_Y_motor_speed, bpm_blower_2_propulsion_modul_Y_nozzle_theta, &bpm_blower_2_propulsion_modul_Y_meas_motor_speed); if (bpm_blower_2_propulsion_modu_M == NULL) { (void)fprintf(stderr,"Memory allocation error during model " "registration"); return(1); } if (rtmGetErrorStatus(bpm_blower_2_propulsion_modu_M) != NULL) { (void)fprintf(stderr,"Error during model registration: %s\n", rtmGetErrorStatus(bpm_blower_2_propulsion_modu_M)); // Disable rt_OneStep() here // Terminate model bpm_blower_2_propulsion_module_terminate(bpm_blower_2_propulsion_modu_M); return(1); } // Initialize model bpm_blower_2_propulsion_module_initialize(bpm_blower_2_propulsion_modu_M, &bpm_blower_2_propulsion_modul_U_battery_voltage, bpm_blower_2_propulsion_modul_U_omega_B_ECI_B, &bpm_blower_2_propulsion_modul_U_impeller_cmd, bpm_blower_2_propulsion_modul_U_servo_cmd, bpm_blower_2_propulsion_modul_U_veh_cm, &bpm_blower_2_propulsion_modul_Y_impeller_current, bpm_blower_2_propulsion_modul_Y_servo_current, bpm_blower_2_propulsion_modul_Y_torque_B, bpm_blower_2_propulsion_modul_Y_force_B, &bpm_blower_2_propulsion_modul_Y_motor_speed, bpm_blower_2_propulsion_modul_Y_nozzle_theta, &bpm_blower_2_propulsion_modul_Y_meas_motor_speed); // Attach rt_OneStep to a timer or interrupt service routine with // period 0.016 seconds (the model's base sample time) here. The // call syntax for rt_OneStep is // // rt_OneStep(bpm_blower_2_propulsion_modu_M); printf("Warning: The simulation will run forever. " "Generated ERT main won't simulate model step behavior. " "To change this behavior select the 'MAT-file logging' option.\n"); fflush((NULL)); while (rtmGetErrorStatus(bpm_blower_2_propulsion_modu_M) == (NULL)) { // Perform other application tasks here } // Disable rt_OneStep() here // Terminate model bpm_blower_2_propulsion_module_terminate(bpm_blower_2_propulsion_modu_M); return 0; } // // File trailer for generated code. // // [EOF] //
{ "pile_set_name": "Github" }
namespace Coevery.ContentManagement.Handlers { public abstract class StorageFilterBase<TPart> : IContentStorageFilter where TPart : class, IContent { protected virtual void Activated(ActivatedContentContext context, TPart instance) { } protected virtual void Activating(ActivatingContentContext context, TPart instance) { } protected virtual void Initializing(InitializingContentContext context, TPart instance) { } protected virtual void Initialized(InitializingContentContext context, TPart instance) { } protected virtual void Creating(CreateContentContext context, TPart instance) { } protected virtual void Created(CreateContentContext context, TPart instance) { } protected virtual void Loading(LoadContentContext context, TPart instance) { } protected virtual void Loaded(LoadContentContext context, TPart instance) { } protected virtual void Updating(UpdateContentContext context, TPart instance) { } protected virtual void Updated(UpdateContentContext context, TPart instance) { } protected virtual void Versioning(VersionContentContext context, TPart existing, TPart building) { } protected virtual void Versioned(VersionContentContext context, TPart existing, TPart building) { } protected virtual void Publishing(PublishContentContext context, TPart instance) { } protected virtual void Published(PublishContentContext context, TPart instance) { } protected virtual void Unpublishing(PublishContentContext context, TPart instance) { } protected virtual void Unpublished(PublishContentContext context, TPart instance) { } protected virtual void Removing(RemoveContentContext context, TPart instance) { } protected virtual void Removed(RemoveContentContext context, TPart instance) { } protected virtual void Indexing(IndexContentContext context, TPart instance) { } protected virtual void Indexed(IndexContentContext context, TPart instance) { } void IContentStorageFilter.Activated(ActivatedContentContext context) { if (context.ContentItem.Is<TPart>()) Activated(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Initializing(InitializingContentContext context) { if (context.ContentItem.Is<TPart>()) Initializing(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Initialized(InitializingContentContext context) { if (context.ContentItem.Is<TPart>()) Initialized(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Creating(CreateContentContext context) { if (context.ContentItem.Is<TPart>()) Creating(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Created(CreateContentContext context) { if (context.ContentItem.Is<TPart>()) Created(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Loading(LoadContentContext context) { if (context.ContentItem.Is<TPart>()) Loading(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Loaded(LoadContentContext context) { if (context.ContentItem.Is<TPart>()) Loaded(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Updating(UpdateContentContext context) { if (context.ContentItem.Is<TPart>()) Updating(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Updated(UpdateContentContext context) { if (context.ContentItem.Is<TPart>()) Updated(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Versioning(VersionContentContext context) { if (context.ExistingContentItem.Is<TPart>() || context.BuildingContentItem.Is<TPart>()) Versioning(context, context.ExistingContentItem.As<TPart>(), context.BuildingContentItem.As<TPart>()); } void IContentStorageFilter.Versioned(VersionContentContext context) { if (context.ExistingContentItem.Is<TPart>() || context.BuildingContentItem.Is<TPart>()) Versioned(context, context.ExistingContentItem.As<TPart>(), context.BuildingContentItem.As<TPart>()); } void IContentStorageFilter.Publishing(PublishContentContext context) { if (context.ContentItem.Is<TPart>()) Publishing(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Published(PublishContentContext context) { if (context.ContentItem.Is<TPart>()) Published(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Unpublishing(PublishContentContext context) { if (context.ContentItem.Is<TPart>()) Unpublishing(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Unpublished(PublishContentContext context) { if (context.ContentItem.Is<TPart>()) Unpublished(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Removing(RemoveContentContext context) { if (context.ContentItem.Is<TPart>()) Removing(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Removed(RemoveContentContext context) { if (context.ContentItem.Is<TPart>()) Removed(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Indexing(IndexContentContext context) { if ( context.ContentItem.Is<TPart>() ) Indexing(context, context.ContentItem.As<TPart>()); } void IContentStorageFilter.Indexed(IndexContentContext context) { if ( context.ContentItem.Is<TPart>() ) Indexed(context, context.ContentItem.As<TPart>()); } } }
{ "pile_set_name": "Github" }
 Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25122.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EvalErrors", "EvalErrors", "{632FF923-369E-4BAE-87F0-6881EFF6E164}" EndProject Project("{39E2626F-3545-4960-A6E8-258AD8476CE5}") = "EvalErrors.Packaging", "EvalErrors\EvalErrors.Packaging\EvalErrors.Packaging.androidproj", "{957B3135-D28F-465D-A8B9-E0EBCEE11085}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EvalErrors.NativeActivity", "EvalErrors\EvalErrors.NativeActivity\EvalErrors.NativeActivity.vcxproj", "{3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|ARM = Release|ARM Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Debug|ARM.ActiveCfg = Debug|ARM {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Debug|ARM.Build.0 = Debug|ARM {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Debug|ARM.Deploy.0 = Debug|ARM {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Debug|ARM64.ActiveCfg = Debug|ARM64 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Debug|ARM64.Build.0 = Debug|ARM64 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Debug|ARM64.Deploy.0 = Debug|ARM64 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Debug|x64.ActiveCfg = Debug|x64 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Debug|x64.Build.0 = Debug|x64 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Debug|x64.Deploy.0 = Debug|x64 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Debug|x86.ActiveCfg = Debug|x86 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Debug|x86.Build.0 = Debug|x86 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Debug|x86.Deploy.0 = Debug|x86 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Release|ARM.ActiveCfg = Release|ARM {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Release|ARM.Build.0 = Release|ARM {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Release|ARM.Deploy.0 = Release|ARM {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Release|ARM64.ActiveCfg = Release|ARM64 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Release|ARM64.Build.0 = Release|ARM64 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Release|ARM64.Deploy.0 = Release|ARM64 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Release|x64.ActiveCfg = Release|x64 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Release|x64.Build.0 = Release|x64 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Release|x64.Deploy.0 = Release|x64 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Release|x86.ActiveCfg = Release|x86 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Release|x86.Build.0 = Release|x86 {957B3135-D28F-465D-A8B9-E0EBCEE11085}.Release|x86.Deploy.0 = Release|x86 {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Debug|ARM.ActiveCfg = Debug|ARM {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Debug|ARM.Build.0 = Debug|ARM {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Debug|ARM64.ActiveCfg = Debug|ARM64 {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Debug|ARM64.Build.0 = Debug|ARM64 {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Debug|x64.ActiveCfg = Debug|x64 {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Debug|x64.Build.0 = Debug|x64 {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Debug|x86.ActiveCfg = Debug|x86 {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Debug|x86.Build.0 = Debug|x86 {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Release|ARM.ActiveCfg = Release|ARM {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Release|ARM.Build.0 = Release|ARM {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Release|ARM64.ActiveCfg = Release|ARM64 {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Release|ARM64.Build.0 = Release|ARM64 {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Release|x64.ActiveCfg = Release|x64 {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Release|x64.Build.0 = Release|x64 {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Release|x86.ActiveCfg = Release|x86 {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {957B3135-D28F-465D-A8B9-E0EBCEE11085} = {632FF923-369E-4BAE-87F0-6881EFF6E164} {3EAF53ED-B0CB-4507-A39B-A8E9B63A994A} = {632FF923-369E-4BAE-87F0-6881EFF6E164} EndGlobalSection EndGlobal
{ "pile_set_name": "Github" }
/* * Copyright (c) 2019 Villu Ruusmann */ package javax.xml.bind; public class DatatypeConverter { private DatatypeConverter(){ } static public int parseInt(String string){ return Integer.parseInt(string); } static public String printInt(int value){ return Integer.toString(value); } static public double parseDouble(String string){ return Double.parseDouble(string); } static public String printDouble(double value){ return Double.toString(value); } static public float parseFloat(String string){ return Float.parseFloat(string); } static public String printFloat(float value){ return Float.toString(value); } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2006-2012 Erin Catto http://www.box2d.org * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ #include <Box2D/Dynamics/Joints/b2MotorJoint.h> #include <Box2D/Dynamics/b2Body.h> #include <Box2D/Dynamics/b2TimeStep.h> // Point-to-point constraint // Cdot = v2 - v1 // = v2 + cross(w2, r2) - v1 - cross(w1, r1) // J = [-I -r1_skew I r2_skew ] // Identity used: // w k % (rx i + ry j) = w * (-ry i + rx j) // Angle constraint // Cdot = w2 - w1 // J = [0 0 -1 0 0 1] // K = invI1 + invI2 void b2MotorJointDef::Initialize(b2Body* bA, b2Body* bB) { bodyA = bA; bodyB = bB; b2Vec2 xB = bodyB->GetPosition(); linearOffset = bodyA->GetLocalPoint(xB); float32 angleA = bodyA->GetAngle(); float32 angleB = bodyB->GetAngle(); angularOffset = angleB - angleA; } b2MotorJoint::b2MotorJoint(const b2MotorJointDef* def) : b2Joint(def) { m_linearOffset = def->linearOffset; m_angularOffset = def->angularOffset; m_linearImpulse.SetZero(); m_angularImpulse = 0.0f; m_maxForce = def->maxForce; m_maxTorque = def->maxTorque; m_correctionFactor = def->correctionFactor; } void b2MotorJoint::InitVelocityConstraints(const b2SolverData& data) { m_indexA = m_bodyA->m_islandIndex; m_indexB = m_bodyB->m_islandIndex; m_localCenterA = m_bodyA->m_sweep.localCenter; m_localCenterB = m_bodyB->m_sweep.localCenter; m_invMassA = m_bodyA->m_invMass; m_invMassB = m_bodyB->m_invMass; m_invIA = m_bodyA->m_invI; m_invIB = m_bodyB->m_invI; b2Vec2 cA = data.positions[m_indexA].c; float32 aA = data.positions[m_indexA].a; b2Vec2 vA = data.velocities[m_indexA].v; float32 wA = data.velocities[m_indexA].w; b2Vec2 cB = data.positions[m_indexB].c; float32 aB = data.positions[m_indexB].a; b2Vec2 vB = data.velocities[m_indexB].v; float32 wB = data.velocities[m_indexB].w; b2Rot qA(aA), qB(aB); // Compute the effective mass matrix. m_rA = b2Mul(qA, -m_localCenterA); m_rB = b2Mul(qB, -m_localCenterB); // J = [-I -r1_skew I r2_skew] // [ 0 -1 0 1] // r_skew = [-ry; rx] // Matlab // K = [ mA+r1y^2*iA+mB+r2y^2*iB, -r1y*iA*r1x-r2y*iB*r2x, -r1y*iA-r2y*iB] // [ -r1y*iA*r1x-r2y*iB*r2x, mA+r1x^2*iA+mB+r2x^2*iB, r1x*iA+r2x*iB] // [ -r1y*iA-r2y*iB, r1x*iA+r2x*iB, iA+iB] float32 mA = m_invMassA, mB = m_invMassB; float32 iA = m_invIA, iB = m_invIB; b2Mat22 K; K.ex.x = mA + mB + iA * m_rA.y * m_rA.y + iB * m_rB.y * m_rB.y; K.ex.y = -iA * m_rA.x * m_rA.y - iB * m_rB.x * m_rB.y; K.ey.x = K.ex.y; K.ey.y = mA + mB + iA * m_rA.x * m_rA.x + iB * m_rB.x * m_rB.x; m_linearMass = K.GetInverse(); m_angularMass = iA + iB; if (m_angularMass > 0.0f) { m_angularMass = 1.0f / m_angularMass; } m_linearError = cB + m_rB - cA - m_rA - b2Mul(qA, m_linearOffset); m_angularError = aB - aA - m_angularOffset; if (data.step.warmStarting) { // Scale impulses to support a variable time step. m_linearImpulse *= data.step.dtRatio; m_angularImpulse *= data.step.dtRatio; b2Vec2 P(m_linearImpulse.x, m_linearImpulse.y); vA -= mA * P; wA -= iA * (b2Cross(m_rA, P) + m_angularImpulse); vB += mB * P; wB += iB * (b2Cross(m_rB, P) + m_angularImpulse); } else { m_linearImpulse.SetZero(); m_angularImpulse = 0.0f; } data.velocities[m_indexA].v = vA; data.velocities[m_indexA].w = wA; data.velocities[m_indexB].v = vB; data.velocities[m_indexB].w = wB; } void b2MotorJoint::SolveVelocityConstraints(const b2SolverData& data) { b2Vec2 vA = data.velocities[m_indexA].v; float32 wA = data.velocities[m_indexA].w; b2Vec2 vB = data.velocities[m_indexB].v; float32 wB = data.velocities[m_indexB].w; float32 mA = m_invMassA, mB = m_invMassB; float32 iA = m_invIA, iB = m_invIB; float32 h = data.step.dt; float32 inv_h = data.step.inv_dt; // Solve angular friction { float32 Cdot = wB - wA + inv_h * m_correctionFactor * m_angularError; float32 impulse = -m_angularMass * Cdot; float32 oldImpulse = m_angularImpulse; float32 maxImpulse = h * m_maxTorque; m_angularImpulse = b2Clamp(m_angularImpulse + impulse, -maxImpulse, maxImpulse); impulse = m_angularImpulse - oldImpulse; wA -= iA * impulse; wB += iB * impulse; } // Solve linear friction { b2Vec2 Cdot = vB + b2Cross(wB, m_rB) - vA - b2Cross(wA, m_rA) + inv_h * m_correctionFactor * m_linearError; b2Vec2 impulse = -b2Mul(m_linearMass, Cdot); b2Vec2 oldImpulse = m_linearImpulse; m_linearImpulse += impulse; float32 maxImpulse = h * m_maxForce; if (m_linearImpulse.LengthSquared() > maxImpulse * maxImpulse) { m_linearImpulse.Normalize(); m_linearImpulse *= maxImpulse; } impulse = m_linearImpulse - oldImpulse; vA -= mA * impulse; wA -= iA * b2Cross(m_rA, impulse); vB += mB * impulse; wB += iB * b2Cross(m_rB, impulse); } data.velocities[m_indexA].v = vA; data.velocities[m_indexA].w = wA; data.velocities[m_indexB].v = vB; data.velocities[m_indexB].w = wB; } bool b2MotorJoint::SolvePositionConstraints(const b2SolverData& data) { B2_NOT_USED(data); return true; } b2Vec2 b2MotorJoint::GetAnchorA() const { return m_bodyA->GetPosition(); } b2Vec2 b2MotorJoint::GetAnchorB() const { return m_bodyB->GetPosition(); } b2Vec2 b2MotorJoint::GetReactionForce(float32 inv_dt) const { return inv_dt * m_linearImpulse; } float32 b2MotorJoint::GetReactionTorque(float32 inv_dt) const { return inv_dt * m_angularImpulse; } void b2MotorJoint::SetMaxForce(float32 force) { b2Assert(b2IsValid(force) && force >= 0.0f); m_maxForce = force; } float32 b2MotorJoint::GetMaxForce() const { return m_maxForce; } void b2MotorJoint::SetMaxTorque(float32 torque) { b2Assert(b2IsValid(torque) && torque >= 0.0f); m_maxTorque = torque; } float32 b2MotorJoint::GetMaxTorque() const { return m_maxTorque; } void b2MotorJoint::SetCorrectionFactor(float32 factor) { b2Assert(b2IsValid(factor) && 0.0f <= factor && factor <= 1.0f); m_correctionFactor = factor; } float32 b2MotorJoint::GetCorrectionFactor() const { return m_correctionFactor; } void b2MotorJoint::SetLinearOffset(const b2Vec2& linearOffset) { if (linearOffset.x != m_linearOffset.x || linearOffset.y != m_linearOffset.y) { m_bodyA->SetAwake(true); m_bodyB->SetAwake(true); m_linearOffset = linearOffset; } } const b2Vec2& b2MotorJoint::GetLinearOffset() const { return m_linearOffset; } void b2MotorJoint::SetAngularOffset(float32 angularOffset) { if (angularOffset != m_angularOffset) { m_bodyA->SetAwake(true); m_bodyB->SetAwake(true); m_angularOffset = angularOffset; } } float32 b2MotorJoint::GetAngularOffset() const { return m_angularOffset; } void b2MotorJoint::Dump() { int32 indexA = m_bodyA->m_islandIndex; int32 indexB = m_bodyB->m_islandIndex; b2Log(" b2MotorJointDef jd;\n"); b2Log(" jd.bodyA = bodies[%d];\n", indexA); b2Log(" jd.bodyB = bodies[%d];\n", indexB); b2Log(" jd.collideConnected = bool(%d);\n", m_collideConnected); b2Log(" jd.linearOffset.Set(%.15lef, %.15lef);\n", m_linearOffset.x, m_linearOffset.y); b2Log(" jd.angularOffset = %.15lef;\n", m_angularOffset); b2Log(" jd.maxForce = %.15lef;\n", m_maxForce); b2Log(" jd.maxTorque = %.15lef;\n", m_maxTorque); b2Log(" jd.correctionFactor = %.15lef;\n", m_correctionFactor); b2Log(" joints[%d] = m_world->CreateJoint(&jd);\n", m_index); }
{ "pile_set_name": "Github" }
`RedirectToLogin` 组件 (`Shared/RedirectToLogin.razor`): * 管理将未经授权的用户重定向到登录页。 * 保留用户尝试访问的当前 URL,以便在身份验证成功时可以将其返回到该页。 ```razor @inject NavigationManager Navigation @using Microsoft.AspNetCore.Components.WebAssembly.Authentication @code { protected override void OnInitialized() { Navigation.NavigateTo($"authentication/login?returnUrl=" + Uri.EscapeDataString(Navigation.Uri)); } } ```
{ "pile_set_name": "Github" }
/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation version 3 as published by the Free Software Foundation. You may not use, modify or distribute this program under any other version of the GNU Affero General Public 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 Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.server; import java.io.IOException; import java.net.InetSocketAddress; import java.security.Security; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; import java.util.HashSet; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Properties; import java.util.Set; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.Lock; import config.YamlConfig; import net.server.audit.ThreadTracker; import net.server.audit.locks.MonitoredLockType; import net.server.audit.locks.MonitoredReadLock; import net.server.audit.locks.MonitoredReentrantReadWriteLock; import net.server.audit.locks.MonitoredWriteLock; import net.server.audit.locks.factory.MonitoredReadLockFactory; import net.server.audit.locks.factory.MonitoredReentrantLockFactory; import net.server.audit.locks.factory.MonitoredWriteLockFactory; import net.MapleServerHandler; import net.mina.MapleCodecFactory; import net.server.channel.Channel; import net.server.coordinator.session.MapleSessionCoordinator; import net.server.guild.MapleAlliance; import net.server.guild.MapleGuild; import net.server.guild.MapleGuildCharacter; import net.server.task.BossLogTask; import net.server.task.CharacterDiseaseTask; import net.server.task.CouponTask; import net.server.task.EventRecallCoordinatorTask; import net.server.task.DueyFredrickTask; import net.server.task.InvitationTask; import net.server.task.LoginCoordinatorTask; import net.server.task.LoginStorageTask; import net.server.task.RankingCommandTask; import net.server.task.RankingLoginTask; import net.server.task.ReleaseLockTask; import net.server.task.RespawnTask; import net.server.world.World; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.buffer.SimpleBufferAllocator; import org.apache.mina.core.filterchain.IoFilter; import org.apache.mina.core.service.IoAcceptor; import org.apache.mina.core.session.IdleStatus; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.transport.socket.nio.NioSocketAcceptor; import client.MapleClient; import client.MapleFamily; import client.MapleCharacter; import client.SkillFactory; import client.command.CommandsExecutor; import client.inventory.Item; import client.inventory.ItemFactory; import client.inventory.manipulator.MapleCashidGenerator; import client.newyear.NewYearCardRecord; import constants.inventory.ItemConstants; import constants.game.GameConstants; import constants.net.OpcodeConstants; import constants.net.ServerConstants; import java.util.TimeZone; import server.CashShop.CashItemFactory; import server.MapleSkillbookInformationProvider; import server.ThreadManager; import server.TimerManager; import server.expeditions.MapleExpeditionBossLog; import server.life.MaplePlayerNPCFactory; import server.quest.MapleQuest; import tools.AutoJCE; import tools.DatabaseConnection; import tools.FilePrinter; import tools.Pair; public class Server { private static Server instance = null; public static Server getInstance() { if (instance == null) { instance = new Server(); } return instance; } private static final Set<Integer> activeFly = new HashSet<>(); private static final Map<Integer, Integer> couponRates = new HashMap<>(30); private static final List<Integer> activeCoupons = new LinkedList<>(); private IoAcceptor acceptor; private List<Map<Integer, String>> channels = new LinkedList<>(); private List<World> worlds = new ArrayList<>(); private final Properties subnetInfo = new Properties(); private final Map<Integer, Set<Integer>> accountChars = new HashMap<>(); private final Map<Integer, Short> accountCharacterCount = new HashMap<>(); private final Map<Integer, Integer> worldChars = new HashMap<>(); private final Map<String, Integer> transitioningChars = new HashMap<>(); private List<Pair<Integer, String>> worldRecommendedList = new LinkedList<>(); private final Map<Integer, MapleGuild> guilds = new HashMap<>(100); private final Map<MapleClient, Long> inLoginState = new HashMap<>(100); private final PlayerBuffStorage buffStorage = new PlayerBuffStorage(); private final Map<Integer, MapleAlliance> alliances = new HashMap<>(100); private final Map<Integer, NewYearCardRecord> newyears = new HashMap<>(); private final List<MapleClient> processDiseaseAnnouncePlayers = new LinkedList<>(); private final List<MapleClient> registeredDiseaseAnnouncePlayers = new LinkedList<>(); private final List<List<Pair<String, Integer>>> playerRanking = new LinkedList<>(); private final Lock srvLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.SERVER); private final Lock disLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.SERVER_DISEASES); private final MonitoredReentrantReadWriteLock wldLock = new MonitoredReentrantReadWriteLock(MonitoredLockType.SERVER_WORLDS, true); private final MonitoredReadLock wldRLock = MonitoredReadLockFactory.createLock(wldLock); private final MonitoredWriteLock wldWLock = MonitoredWriteLockFactory.createLock(wldLock); private final MonitoredReentrantReadWriteLock lgnLock = new MonitoredReentrantReadWriteLock(MonitoredLockType.SERVER_LOGIN, true); private final MonitoredReadLock lgnRLock = MonitoredReadLockFactory.createLock(lgnLock); private final MonitoredWriteLock lgnWLock = MonitoredWriteLockFactory.createLock(lgnLock); private final AtomicLong currentTime = new AtomicLong(0); private long serverCurrentTime = 0; private boolean availableDeveloperRoom = false; private boolean online = false; public static long uptime = System.currentTimeMillis(); public int getCurrentTimestamp() { return (int) (Server.getInstance().getCurrentTime() - Server.uptime); } public long getCurrentTime() { // returns a slightly delayed time value, under frequency of UPDATE_INTERVAL return serverCurrentTime; } public void updateCurrentTime() { serverCurrentTime = currentTime.addAndGet(YamlConfig.config.server.UPDATE_INTERVAL); } public long forceUpdateCurrentTime() { long timeNow = System.currentTimeMillis(); serverCurrentTime = timeNow; currentTime.set(timeNow); return timeNow; } public boolean isOnline() { return online; } public List<Pair<Integer, String>> worldRecommendedList() { return worldRecommendedList; } public void setNewYearCard(NewYearCardRecord nyc) { newyears.put(nyc.getId(), nyc); } public NewYearCardRecord getNewYearCard(int cardid) { return newyears.get(cardid); } public NewYearCardRecord removeNewYearCard(int cardid) { return newyears.remove(cardid); } public void setAvailableDeveloperRoom() { availableDeveloperRoom = true; } public boolean canEnterDeveloperRoom() { return availableDeveloperRoom; } private void loadPlayerNpcMapStepFromDb() { try { List<World> wlist = this.getWorlds(); Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM playernpcs_field"); ResultSet rs = ps.executeQuery(); while(rs.next()) { int world = rs.getInt("world"), map = rs.getInt("map"), step = rs.getInt("step"), podium = rs.getInt("podium"); World w = wlist.get(world); if(w != null) w.setPlayerNpcMapData(map, step, podium); } rs.close(); ps.close(); con.close(); } catch (SQLException e) { e.printStackTrace(); } } public World getWorld(int id) { wldRLock.lock(); try { try { return worlds.get(id); } catch (IndexOutOfBoundsException e) { return null; } } finally { wldRLock.unlock(); } } public List<World> getWorlds() { wldRLock.lock(); try { return Collections.unmodifiableList(worlds); } finally { wldRLock.unlock(); } } public int getWorldsSize() { wldRLock.lock(); try { return worlds.size(); } finally { wldRLock.unlock(); } } public Channel getChannel(int world, int channel) { try { return this.getWorld(world).getChannel(channel); } catch(NullPointerException npe) { return null; } } public List<Channel> getChannelsFromWorld(int world) { try { return this.getWorld(world).getChannels(); } catch(NullPointerException npe) { return new ArrayList<>(0); } } public List<Channel> getAllChannels() { try { List<Channel> channelz = new ArrayList<>(); for (World world : this.getWorlds()) { for (Channel ch : world.getChannels()) { channelz.add(ch); } } return channelz; } catch(NullPointerException npe) { return new ArrayList<>(0); } } public Set<Integer> getOpenChannels(int world) { wldRLock.lock(); try { return new HashSet<>(channels.get(world).keySet()); } finally { wldRLock.unlock(); } } private String getIP(int world, int channel) { wldRLock.lock(); try { return channels.get(world).get(channel); } finally { wldRLock.unlock(); } } public String[] getInetSocket(int world, int channel) { try { return getIP(world, channel).split(":"); } catch (Exception e) { return null; } } private void dumpData() { wldRLock.lock(); try { System.out.println(worlds); System.out.println(channels); System.out.println(worldRecommendedList); System.out.println(); System.out.println("---------------------"); } finally { wldRLock.unlock(); } } public int addChannel(int worldid) { World world; Map<Integer, String> channelInfo; int channelid; wldRLock.lock(); try { if(worldid >= worlds.size()) return -3; channelInfo = channels.get(worldid); if(channelInfo == null) return -3; channelid = channelInfo.size(); if(channelid >= YamlConfig.config.server.CHANNEL_SIZE) return -2; channelid++; world = this.getWorld(worldid); } finally { wldRLock.unlock(); } Channel channel = new Channel(worldid, channelid, getCurrentTime()); channel.setServerMessage(YamlConfig.config.worlds.get(worldid).why_am_i_recommended); if (world.addChannel(channel)) { wldWLock.lock(); try { channelInfo.put(channelid, channel.getIP()); } finally { wldWLock.unlock(); } } return channelid; } public int addWorld() { int newWorld = initWorld(); if(newWorld > -1) { installWorldPlayerRanking(newWorld); Set<Integer> accounts; lgnRLock.lock(); try { accounts = new HashSet<>(accountChars.keySet()); } finally { lgnRLock.unlock(); } for(Integer accId : accounts) { loadAccountCharactersView(accId, 0, newWorld); } } return newWorld; } private int initWorld() { int i; wldRLock.lock(); try { i = worlds.size(); if(i >= YamlConfig.config.server.WLDLIST_SIZE) { return -1; } } finally { wldRLock.unlock(); } System.out.println("Starting world " + i); int exprate = YamlConfig.config.worlds.get(i).exp_rate; int mesorate = YamlConfig.config.worlds.get(i).meso_rate; int droprate = YamlConfig.config.worlds.get(i).drop_rate; int bossdroprate = YamlConfig.config.worlds.get(i).boss_drop_rate; int questrate = YamlConfig.config.worlds.get(i).quest_rate; int travelrate = YamlConfig.config.worlds.get(i).travel_rate; int fishingrate = YamlConfig.config.worlds.get(i).fishing_rate; int flag = YamlConfig.config.worlds.get(i).flag; String event_message = YamlConfig.config.worlds.get(i).event_message; String why_am_i_recommended = YamlConfig.config.worlds.get(i).why_am_i_recommended; World world = new World(i, flag, event_message, exprate, droprate, bossdroprate, mesorate, questrate, travelrate, fishingrate); Map<Integer, String> channelInfo = new HashMap<>(); long bootTime = getCurrentTime(); for (int j = 1; j <= YamlConfig.config.worlds.get(i).channels; j++) { int channelid = j; Channel channel = new Channel(i, channelid, bootTime); world.addChannel(channel); channelInfo.put(channelid, channel.getIP()); } boolean canDeploy; wldWLock.lock(); // thanks Ashen for noticing a deadlock issue when trying to deploy a channel try { canDeploy = world.getId() == worlds.size(); if (canDeploy) { worldRecommendedList.add(new Pair<>(i, why_am_i_recommended)); worlds.add(world); channels.add(i, channelInfo); } } finally { wldWLock.unlock(); } if (canDeploy) { world.setServerMessage(YamlConfig.config.worlds.get(i).server_message); System.out.println("Finished loading world " + i + "\r\n"); return i; } else { System.out.println("Could not load world " + i + "...\r\n"); world.shutdown(); return -2; } } public boolean removeChannel(int worldid) { //lol don't! World world; wldRLock.lock(); try { if(worldid >= worlds.size()) return false; world = worlds.get(worldid); } finally { wldRLock.unlock(); } if (world != null) { int channel = world.removeChannel(); wldWLock.lock(); try { Map<Integer, String> m = channels.get(worldid); if(m != null) m.remove(channel); } finally { wldWLock.unlock(); } return channel > -1; } return false; } public boolean removeWorld() { //lol don't! World w; int worldid; wldRLock.lock(); try { worldid = worlds.size() - 1; if(worldid < 0) { return false; } w = worlds.get(worldid); } finally { wldRLock.unlock(); } if(w == null || !w.canUninstall()) { return false; } removeWorldPlayerRanking(); w.shutdown(); wldWLock.lock(); try { if (worldid == worlds.size() - 1) { worlds.remove(worldid); channels.remove(worldid); worldRecommendedList.remove(worldid); } } finally { wldWLock.unlock(); } return true; } private void resetServerWorlds() { // thanks maple006 for noticing proprietary lists assigned to null wldWLock.lock(); try { worlds.clear(); channels.clear(); worldRecommendedList.clear(); } finally { wldWLock.unlock(); } } private static long getTimeLeftForNextHour() { Calendar nextHour = Calendar.getInstance(); nextHour.add(Calendar.HOUR, 1); nextHour.set(Calendar.MINUTE, 0); nextHour.set(Calendar.SECOND, 0); return Math.max(0, nextHour.getTimeInMillis() - System.currentTimeMillis()); } public static long getTimeLeftForNextDay() { Calendar nextDay = Calendar.getInstance(); nextDay.add(Calendar.DAY_OF_MONTH, 1); nextDay.set(Calendar.HOUR_OF_DAY, 0); nextDay.set(Calendar.MINUTE, 0); nextDay.set(Calendar.SECOND, 0); return Math.max(0, nextDay.getTimeInMillis() - System.currentTimeMillis()); } public Map<Integer, Integer> getCouponRates() { return couponRates; } public static void cleanNxcodeCoupons(Connection con) throws SQLException { if (!YamlConfig.config.server.USE_CLEAR_OUTDATED_COUPONS) return; long timeClear = System.currentTimeMillis() - 14 * 24 * 60 * 60 * 1000; PreparedStatement ps = con.prepareStatement("SELECT * FROM nxcode WHERE expiration <= ?"); ps.setLong(1, timeClear); ResultSet rs = ps.executeQuery(); if (!rs.isLast()) { PreparedStatement ps2 = con.prepareStatement("DELETE FROM nxcode_items WHERE codeid = ?"); while (rs.next()) { ps2.setInt(1, rs.getInt("id")); ps2.addBatch(); } ps2.executeBatch(); ps2.close(); ps2 = con.prepareStatement("DELETE FROM nxcode WHERE expiration <= ?"); ps2.setLong(1, timeClear); ps2.executeUpdate(); ps2.close(); } rs.close(); ps.close(); } private void loadCouponRates(Connection c) throws SQLException { PreparedStatement ps = c.prepareStatement("SELECT couponid, rate FROM nxcoupons"); ResultSet rs = ps.executeQuery(); while(rs.next()) { int cid = rs.getInt("couponid"); int rate = rs.getInt("rate"); couponRates.put(cid, rate); } rs.close(); ps.close(); } public List<Integer> getActiveCoupons() { synchronized (activeCoupons) { return activeCoupons; } } public void commitActiveCoupons() { for(World world: getWorlds()) { for(MapleCharacter chr: world.getPlayerStorage().getAllCharacters()) { if(!chr.isLoggedin()) continue; chr.updateCouponRates(); } } } public void toggleCoupon(Integer couponId) { if(ItemConstants.isRateCoupon(couponId)) { synchronized (activeCoupons) { if(activeCoupons.contains(couponId)) { activeCoupons.remove(couponId); } else { activeCoupons.add(couponId); } commitActiveCoupons(); } } } public void updateActiveCoupons() throws SQLException { synchronized (activeCoupons) { activeCoupons.clear(); Calendar c = Calendar.getInstance(); int weekDay = c.get(Calendar.DAY_OF_WEEK); int hourDay = c.get(Calendar.HOUR_OF_DAY); Connection con = null; try { con = DatabaseConnection.getConnection(); int weekdayMask = (1 << weekDay); PreparedStatement ps = con.prepareStatement("SELECT couponid FROM nxcoupons WHERE (activeday & ?) = ? AND starthour <= ? AND endhour > ?"); ps.setInt(1, weekdayMask); ps.setInt(2, weekdayMask); ps.setInt(3, hourDay); ps.setInt(4, hourDay); ResultSet rs = ps.executeQuery(); while(rs.next()) { activeCoupons.add(rs.getInt("couponid")); } rs.close(); ps.close(); con.close(); } catch (SQLException ex) { ex.printStackTrace(); try { if(con != null && !con.isClosed()) { con.close(); } } catch (SQLException ex2) { ex2.printStackTrace(); } } } } public void runAnnouncePlayerDiseasesSchedule() { List<MapleClient> processDiseaseAnnounceClients; disLock.lock(); try { processDiseaseAnnounceClients = new LinkedList<>(processDiseaseAnnouncePlayers); processDiseaseAnnouncePlayers.clear(); } finally { disLock.unlock(); } while(!processDiseaseAnnounceClients.isEmpty()) { MapleClient c = processDiseaseAnnounceClients.remove(0); MapleCharacter player = c.getPlayer(); if(player != null && player.isLoggedinWorld()) { player.announceDiseases(); player.collectDiseases(); } } disLock.lock(); try { // this is to force the system to wait for at least one complete tick before releasing disease info for the registered clients while(!registeredDiseaseAnnouncePlayers.isEmpty()) { MapleClient c = registeredDiseaseAnnouncePlayers.remove(0); processDiseaseAnnouncePlayers.add(c); } } finally { disLock.unlock(); } } public void registerAnnouncePlayerDiseases(MapleClient c) { disLock.lock(); try { registeredDiseaseAnnouncePlayers.add(c); } finally { disLock.unlock(); } } public List<Pair<String, Integer>> getWorldPlayerRanking(int worldid) { wldRLock.lock(); try { return new ArrayList<>(playerRanking.get(!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING ? worldid : 0)); } finally { wldRLock.unlock(); } } private void installWorldPlayerRanking(int worldid) { List<Pair<Integer, List<Pair<String, Integer>>>> ranking = updatePlayerRankingFromDB(worldid); if(!ranking.isEmpty()) { wldWLock.lock(); try { if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) { for(int i = playerRanking.size(); i <= worldid; i++) { playerRanking.add(new ArrayList<Pair<String, Integer>>(0)); } playerRanking.add(worldid, ranking.get(0).getRight()); } else { playerRanking.add(0, ranking.get(0).getRight()); } } finally { wldWLock.unlock(); } } } private void removeWorldPlayerRanking() { if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) { wldWLock.lock(); try { if(playerRanking.size() < worlds.size()) { return; } playerRanking.remove(playerRanking.size() - 1); } finally { wldWLock.unlock(); } } else { List<Pair<Integer, List<Pair<String, Integer>>>> ranking = updatePlayerRankingFromDB(-1 * (this.getWorldsSize() - 2)); // update ranking list wldWLock.lock(); try { playerRanking.add(0, ranking.get(0).getRight()); } finally { wldWLock.unlock(); } } } public void updateWorldPlayerRanking() { List<Pair<Integer, List<Pair<String, Integer>>>> rankUpdates = updatePlayerRankingFromDB(-1 * (this.getWorldsSize() - 1)); if(!rankUpdates.isEmpty()) { wldWLock.lock(); try { if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) { for(int i = playerRanking.size(); i <= rankUpdates.get(rankUpdates.size() - 1).getLeft(); i++) { playerRanking.add(new ArrayList<Pair<String, Integer>>(0)); } for(Pair<Integer, List<Pair<String, Integer>>> wranks : rankUpdates) { playerRanking.set(wranks.getLeft(), wranks.getRight()); } } else { playerRanking.set(0, rankUpdates.get(0).getRight()); } } finally { wldWLock.unlock(); } } } private void initWorldPlayerRanking() { if (YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) { playerRanking.add(new ArrayList<Pair<String, Integer>>(0)); } updateWorldPlayerRanking(); } private static List<Pair<Integer, List<Pair<String, Integer>>>> updatePlayerRankingFromDB(int worldid) { List<Pair<Integer, List<Pair<String, Integer>>>> rankSystem = new ArrayList<>(); List<Pair<String, Integer>> rankUpdate = new ArrayList<>(0); PreparedStatement ps = null; ResultSet rs = null; Connection con = null; try { con = DatabaseConnection.getConnection(); String worldQuery; if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) { if(worldid >= 0) { worldQuery = (" AND `characters`.`world` = " + worldid); } else { worldQuery = (" AND `characters`.`world` >= 0 AND `characters`.`world` <= " + -worldid); } } else { worldQuery = (" AND `characters`.`world` >= 0 AND `characters`.`world` <= " + Math.abs(worldid)); } ps = con.prepareStatement("SELECT `characters`.`name`, `characters`.`level`, `characters`.`world` FROM `characters` LEFT JOIN accounts ON accounts.id = characters.accountid WHERE `characters`.`gm` < 2 AND `accounts`.`banned` = '0'" + worldQuery + " ORDER BY " + (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING ? "world, " : "") + "level DESC, exp DESC, lastExpGainTime ASC LIMIT 50"); rs = ps.executeQuery(); if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) { int currentWorld = -1; while(rs.next()) { int rsWorld = rs.getInt("world"); if(currentWorld < rsWorld) { currentWorld = rsWorld; rankUpdate = new ArrayList<>(50); rankSystem.add(new Pair<>(rsWorld, rankUpdate)); } rankUpdate.add(new Pair<>(rs.getString("name"), rs.getInt("level"))); } } else { rankUpdate = new ArrayList<>(50); rankSystem.add(new Pair<>(0, rankUpdate)); while(rs.next()) { rankUpdate.add(new Pair<>(rs.getString("name"), rs.getInt("level"))); } } ps.close(); rs.close(); con.close(); } catch(SQLException ex) { ex.printStackTrace(); } finally { try { if(ps != null && !ps.isClosed()) { ps.close(); } if(rs != null && !rs.isClosed()) { rs.close(); } if(con != null && !con.isClosed()) { con.close(); } } catch (SQLException e) { e.printStackTrace(); } } return rankSystem; } public void init() { System.out.println("HeavenMS v" + ServerConstants.VERSION + " starting up.\r\n"); if(YamlConfig.config.server.SHUTDOWNHOOK) Runtime.getRuntime().addShutdownHook(new Thread(shutdown(false))); TimeZone.setDefault(TimeZone.getTimeZone(YamlConfig.config.server.TIMEZONE)); Connection c = null; try { c = DatabaseConnection.getConnection(); PreparedStatement ps = c.prepareStatement("UPDATE accounts SET loggedin = 0"); ps.executeUpdate(); ps.close(); ps = c.prepareStatement("UPDATE characters SET HasMerchant = 0"); ps.executeUpdate(); ps.close(); cleanNxcodeCoupons(c); loadCouponRates(c); updateActiveCoupons(); c.close(); } catch (SQLException sqle) { sqle.printStackTrace(); } applyAllNameChanges(); // -- name changes can be missed by INSTANT_NAME_CHANGE -- applyAllWorldTransfers(); //MaplePet.clearMissingPetsFromDb(); // thanks Optimist for noticing this taking too long to run MapleCashidGenerator.loadExistentCashIdsFromDb(); ThreadManager.getInstance().start(); initializeTimelyTasks(); // aggregated method for timely tasks thanks to lxconan long timeToTake = System.currentTimeMillis(); SkillFactory.loadAllSkills(); System.out.println("Skills loaded in " + ((System.currentTimeMillis() - timeToTake) / 1000.0) + " seconds"); timeToTake = System.currentTimeMillis(); CashItemFactory.getSpecialCashItems(); System.out.println("Items loaded in " + ((System.currentTimeMillis() - timeToTake) / 1000.0) + " seconds"); timeToTake = System.currentTimeMillis(); MapleQuest.loadAllQuest(); System.out.println("Quest loaded in " + ((System.currentTimeMillis() - timeToTake) / 1000.0) + " seconds\r\n"); NewYearCardRecord.startPendingNewYearCardRequests(); if(YamlConfig.config.server.USE_THREAD_TRACKER) ThreadTracker.getInstance().registerThreadTrackerTask(); try { Integer worldCount = Math.min(GameConstants.WORLD_NAMES.length, YamlConfig.config.server.WORLDS); for (int i = 0; i < worldCount; i++) { initWorld(); } initWorldPlayerRanking(); MaplePlayerNPCFactory.loadFactoryMetadata(); loadPlayerNpcMapStepFromDb(); } catch (Exception e) { e.printStackTrace();//For those who get errors System.out.println("[SEVERE] Syntax error in 'world.ini'."); System.exit(0); } System.out.println(); if(YamlConfig.config.server.USE_FAMILY_SYSTEM) { timeToTake = System.currentTimeMillis(); MapleFamily.loadAllFamilies(); System.out.println("Families loaded in " + ((System.currentTimeMillis() - timeToTake) / 1000.0) + " seconds\r\n"); } System.out.println(); IoBuffer.setUseDirectBuffer(false); // join IO operations performed by lxconan IoBuffer.setAllocator(new SimpleBufferAllocator()); acceptor = new NioSocketAcceptor(); acceptor.getFilterChain().addLast("codec", (IoFilter) new ProtocolCodecFilter(new MapleCodecFactory())); acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 30); acceptor.setHandler(new MapleServerHandler()); try { acceptor.bind(new InetSocketAddress(8484)); } catch (IOException ex) { ex.printStackTrace(); } System.out.println("Listening on port 8484\r\n\r\n"); System.out.println("HeavenMS is now online.\r\n"); online = true; MapleSkillbookInformationProvider.getInstance(); OpcodeConstants.generateOpcodeNames(); CommandsExecutor.getInstance(); for (Channel ch : this.getAllChannels()) { ch.reloadEventScriptManager(); } } private void initializeTimelyTasks() { TimerManager tMan = TimerManager.getInstance(); tMan.start(); tMan.register(tMan.purge(), YamlConfig.config.server.PURGING_INTERVAL);//Purging ftw... disconnectIdlesOnLoginTask(); long timeLeft = getTimeLeftForNextHour(); tMan.register(new CharacterDiseaseTask(), YamlConfig.config.server.UPDATE_INTERVAL, YamlConfig.config.server.UPDATE_INTERVAL); tMan.register(new ReleaseLockTask(), 2 * 60 * 1000, 2 * 60 * 1000); tMan.register(new CouponTask(), YamlConfig.config.server.COUPON_INTERVAL, timeLeft); tMan.register(new RankingCommandTask(), 5 * 60 * 1000, 5 * 60 * 1000); tMan.register(new RankingLoginTask(), YamlConfig.config.server.RANKING_INTERVAL, timeLeft); tMan.register(new LoginCoordinatorTask(), 60 * 60 * 1000, timeLeft); tMan.register(new EventRecallCoordinatorTask(), 60 * 60 * 1000, timeLeft); tMan.register(new LoginStorageTask(), 2 * 60 * 1000, 2 * 60 * 1000); tMan.register(new DueyFredrickTask(), 60 * 60 * 1000, timeLeft); tMan.register(new InvitationTask(), 30 * 1000, 30 * 1000); tMan.register(new RespawnTask(), YamlConfig.config.server.RESPAWN_INTERVAL, YamlConfig.config.server.RESPAWN_INTERVAL); timeLeft = getTimeLeftForNextDay(); MapleExpeditionBossLog.resetBossLogTable(); tMan.register(new BossLogTask(), 24 * 60 * 60 * 1000, timeLeft); } public static void main(String args[]) { System.setProperty("wzpath", "wz"); Security.setProperty("crypto.policy", "unlimited"); AutoJCE.removeCryptographyRestrictions(); Server.getInstance().init(); } public Properties getSubnetInfo() { return subnetInfo; } public MapleAlliance getAlliance(int id) { synchronized (alliances) { if (alliances.containsKey(id)) { return alliances.get(id); } return null; } } public void addAlliance(int id, MapleAlliance alliance) { synchronized (alliances) { if (!alliances.containsKey(id)) { alliances.put(id, alliance); } } } public void disbandAlliance(int id) { synchronized (alliances) { MapleAlliance alliance = alliances.get(id); if (alliance != null) { for (Integer gid : alliance.getGuilds()) { guilds.get(gid).setAllianceId(0); } alliances.remove(id); } } } public void allianceMessage(int id, final byte[] packet, int exception, int guildex) { MapleAlliance alliance = alliances.get(id); if (alliance != null) { for (Integer gid : alliance.getGuilds()) { if (guildex == gid) { continue; } MapleGuild guild = guilds.get(gid); if (guild != null) { guild.broadcast(packet, exception); } } } } public boolean addGuildtoAlliance(int aId, int guildId) { MapleAlliance alliance = alliances.get(aId); if (alliance != null) { alliance.addGuild(guildId); guilds.get(guildId).setAllianceId(aId); return true; } return false; } public boolean removeGuildFromAlliance(int aId, int guildId) { MapleAlliance alliance = alliances.get(aId); if (alliance != null) { alliance.removeGuild(guildId); guilds.get(guildId).setAllianceId(0); return true; } return false; } public boolean setAllianceRanks(int aId, String[] ranks) { MapleAlliance alliance = alliances.get(aId); if (alliance != null) { alliance.setRankTitle(ranks); return true; } return false; } public boolean setAllianceNotice(int aId, String notice) { MapleAlliance alliance = alliances.get(aId); if (alliance != null) { alliance.setNotice(notice); return true; } return false; } public boolean increaseAllianceCapacity(int aId, int inc) { MapleAlliance alliance = alliances.get(aId); if (alliance != null) { alliance.increaseCapacity(inc); return true; } return false; } public int createGuild(int leaderId, String name) { return MapleGuild.createGuild(leaderId, name); } public MapleGuild getGuildByName(String name) { synchronized (guilds) { for(MapleGuild mg: guilds.values()) { if(mg.getName().equalsIgnoreCase(name)) { return mg; } } return null; } } public MapleGuild getGuild(int id) { synchronized (guilds) { if (guilds.get(id) != null) { return guilds.get(id); } return null; } } public MapleGuild getGuild(int id, int world) { return getGuild(id, world, null); } public MapleGuild getGuild(int id, int world, MapleCharacter mc) { synchronized (guilds) { MapleGuild g = guilds.get(id); if (g != null) { return g; } g = new MapleGuild(id, world); if (g.getId() == -1) { return null; } if(mc != null) { MapleGuildCharacter mgc = g.getMGC(mc.getId()); if (mgc != null) { mc.setMGC(mgc); mgc.setCharacter(mc); } else { FilePrinter.printError(FilePrinter.GUILD_CHAR_ERROR, "Could not find " + mc.getName() + " when loading guild " + id + "."); } g.setOnline(mc.getId(), true, mc.getClient().getChannel()); } guilds.put(id, g); return g; } } public void setGuildMemberOnline(MapleCharacter mc, boolean bOnline, int channel) { MapleGuild g = getGuild(mc.getGuildId(), mc.getWorld(), mc); g.setOnline(mc.getId(), bOnline, channel); } public int addGuildMember(MapleGuildCharacter mgc, MapleCharacter chr) { MapleGuild g = guilds.get(mgc.getGuildId()); if (g != null) { return g.addGuildMember(mgc, chr); } return 0; } public boolean setGuildAllianceId(int gId, int aId) { MapleGuild guild = guilds.get(gId); if (guild != null) { guild.setAllianceId(aId); return true; } return false; } public void resetAllianceGuildPlayersRank(int gId) { guilds.get(gId).resetAllianceGuildPlayersRank(); } public void leaveGuild(MapleGuildCharacter mgc) { MapleGuild g = guilds.get(mgc.getGuildId()); if (g != null) { g.leaveGuild(mgc); } } public void guildChat(int gid, String name, int cid, String msg) { MapleGuild g = guilds.get(gid); if (g != null) { g.guildChat(name, cid, msg); } } public void changeRank(int gid, int cid, int newRank) { MapleGuild g = guilds.get(gid); if (g != null) { g.changeRank(cid, newRank); } } public void expelMember(MapleGuildCharacter initiator, String name, int cid) { MapleGuild g = guilds.get(initiator.getGuildId()); if (g != null) { g.expelMember(initiator, name, cid); } } public void setGuildNotice(int gid, String notice) { MapleGuild g = guilds.get(gid); if (g != null) { g.setGuildNotice(notice); } } public void memberLevelJobUpdate(MapleGuildCharacter mgc) { MapleGuild g = guilds.get(mgc.getGuildId()); if (g != null) { g.memberLevelJobUpdate(mgc); } } public void changeRankTitle(int gid, String[] ranks) { MapleGuild g = guilds.get(gid); if (g != null) { g.changeRankTitle(ranks); } } public void setGuildEmblem(int gid, short bg, byte bgcolor, short logo, byte logocolor) { MapleGuild g = guilds.get(gid); if (g != null) { g.setGuildEmblem(bg, bgcolor, logo, logocolor); } } public void disbandGuild(int gid) { synchronized (guilds) { MapleGuild g = guilds.get(gid); g.disbandGuild(); guilds.remove(gid); } } public boolean increaseGuildCapacity(int gid) { MapleGuild g = guilds.get(gid); if (g != null) { return g.increaseCapacity(); } return false; } public void gainGP(int gid, int amount) { MapleGuild g = guilds.get(gid); if (g != null) { g.gainGP(amount); } } public void guildMessage(int gid, byte[] packet) { guildMessage(gid, packet, -1); } public void guildMessage(int gid, byte[] packet, int exception) { MapleGuild g = guilds.get(gid); if(g != null) { g.broadcast(packet, exception); } } public PlayerBuffStorage getPlayerBuffStorage() { return buffStorage; } public void deleteGuildCharacter(MapleCharacter mc) { setGuildMemberOnline(mc, false, (byte) -1); if (mc.getMGC().getGuildRank() > 1) { leaveGuild(mc.getMGC()); } else { disbandGuild(mc.getMGC().getGuildId()); } } public void deleteGuildCharacter(MapleGuildCharacter mgc) { if(mgc.getCharacter() != null) setGuildMemberOnline(mgc.getCharacter(), false, (byte) -1); if (mgc.getGuildRank() > 1) { leaveGuild(mgc); } else { disbandGuild(mgc.getGuildId()); } } public void reloadGuildCharacters(int world) { World worlda = getWorld(world); for (MapleCharacter mc : worlda.getPlayerStorage().getAllCharacters()) { if (mc.getGuildId() > 0) { setGuildMemberOnline(mc, true, worlda.getId()); memberLevelJobUpdate(mc.getMGC()); } } worlda.reloadGuildSummary(); } public void broadcastMessage(int world, final byte[] packet) { for (Channel ch : getChannelsFromWorld(world)) { ch.broadcastPacket(packet); } } public void broadcastGMMessage(int world, final byte[] packet) { for (Channel ch : getChannelsFromWorld(world)) { ch.broadcastGMPacket(packet); } } public boolean isGmOnline(int world) { for (Channel ch : getChannelsFromWorld(world)) { for (MapleCharacter player : ch.getPlayerStorage().getAllCharacters()) { if (player.isGM()){ return true; } } } return false; } public void changeFly(Integer accountid, boolean canFly) { if(canFly) { activeFly.add(accountid); } else { activeFly.remove(accountid); } } public boolean canFly(Integer accountid) { return activeFly.contains(accountid); } public int getCharacterWorld(Integer chrid) { lgnRLock.lock(); try { Integer worldid = worldChars.get(chrid); return worldid != null ? worldid : -1; } finally { lgnRLock.unlock(); } } public boolean haveCharacterEntry(Integer accountid, Integer chrid) { lgnRLock.lock(); try { Set<Integer> accChars = accountChars.get(accountid); return accChars.contains(chrid); } finally { lgnRLock.unlock(); } } public short getAccountCharacterCount(Integer accountid) { lgnRLock.lock(); try { return accountCharacterCount.get(accountid); } finally { lgnRLock.unlock(); } } public short getAccountWorldCharacterCount(Integer accountid, Integer worldid) { lgnRLock.lock(); try { short count = 0; for(Integer chr : accountChars.get(accountid)) { if(worldChars.get(chr).equals(worldid)) { count++; } } return count; } finally { lgnRLock.unlock(); } } private Set<Integer> getAccountCharacterEntries(Integer accountid) { lgnRLock.lock(); try { return new HashSet<>(accountChars.get(accountid)); } finally { lgnRLock.unlock(); } } public void updateCharacterEntry(MapleCharacter chr) { MapleCharacter chrView = chr.generateCharacterEntry(); lgnWLock.lock(); try { World wserv = this.getWorld(chrView.getWorld()); if(wserv != null) wserv.registerAccountCharacterView(chrView.getAccountID(), chrView); } finally { lgnWLock.unlock(); } } public void createCharacterEntry(MapleCharacter chr) { Integer accountid = chr.getAccountID(), chrid = chr.getId(), world = chr.getWorld(); lgnWLock.lock(); try { accountCharacterCount.put(accountid, (short)(accountCharacterCount.get(accountid) + 1)); Set<Integer> accChars = accountChars.get(accountid); accChars.add(chrid); worldChars.put(chrid, world); MapleCharacter chrView = chr.generateCharacterEntry(); World wserv = this.getWorld(chrView.getWorld()); if(wserv != null) wserv.registerAccountCharacterView(chrView.getAccountID(), chrView); } finally { lgnWLock.unlock(); } } public void deleteCharacterEntry(Integer accountid, Integer chrid) { lgnWLock.lock(); try { accountCharacterCount.put(accountid, (short)(accountCharacterCount.get(accountid) - 1)); Set<Integer> accChars = accountChars.get(accountid); accChars.remove(chrid); Integer world = worldChars.remove(chrid); if(world != null) { World wserv = this.getWorld(world); if(wserv != null) wserv.unregisterAccountCharacterView(accountid, chrid); } } finally { lgnWLock.unlock(); } } public void transferWorldCharacterEntry(MapleCharacter chr, Integer toWorld) { // used before setting the new worldid on the character object lgnWLock.lock(); try { Integer chrid = chr.getId(), accountid = chr.getAccountID(), world = worldChars.get(chr.getId()); if(world != null) { World wserv = this.getWorld(world); if(wserv != null) wserv.unregisterAccountCharacterView(accountid, chrid); } worldChars.put(chrid, toWorld); MapleCharacter chrView = chr.generateCharacterEntry(); World wserv = this.getWorld(toWorld); if(wserv != null) wserv.registerAccountCharacterView(chrView.getAccountID(), chrView); } finally { lgnWLock.unlock(); } } /* public void deleteAccountEntry(Integer accountid) { is this even a thing? lgnWLock.lock(); try { accountCharacterCount.remove(accountid); accountChars.remove(accountid); } finally { lgnWLock.unlock(); } for (World wserv : this.getWorlds()) { wserv.clearAccountCharacterView(accountid); wserv.unregisterAccountStorage(accountid); } } */ public Pair<Pair<Integer, List<MapleCharacter>>, List<Pair<Integer, List<MapleCharacter>>>> loadAccountCharlist(Integer accountId, int visibleWorlds) { List<World> wlist = this.getWorlds(); if(wlist.size() > visibleWorlds) wlist = wlist.subList(0, visibleWorlds); List<Pair<Integer, List<MapleCharacter>>> accChars = new ArrayList<>(wlist.size() + 1); int chrTotal = 0; List<MapleCharacter> lastwchars = null; lgnRLock.lock(); try { for(World w : wlist) { List<MapleCharacter> wchars = w.getAccountCharactersView(accountId); if(wchars == null) { if(!accountChars.containsKey(accountId)) { accountCharacterCount.put(accountId, (short) 0); accountChars.put(accountId, new HashSet<Integer>()); // not advisable at all to write on the map on a read-protected environment } // yet it's known there's no problem since no other point in the source does } else if(!wchars.isEmpty()) { // this action. lastwchars = wchars; accChars.add(new Pair<>(w.getId(), wchars)); chrTotal += wchars.size(); } } } finally { lgnRLock.unlock(); } return new Pair<>(new Pair<>(chrTotal, lastwchars), accChars); } private static Pair<Short, List<List<MapleCharacter>>> loadAccountCharactersViewFromDb(int accId, int wlen) { short characterCount = 0; List<List<MapleCharacter>> wchars = new ArrayList<>(wlen); for(int i = 0; i < wlen; i++) wchars.add(i, new LinkedList<MapleCharacter>()); List<MapleCharacter> chars = new LinkedList<>(); int curWorld = 0; try { List<Pair<Item, Integer>> accEquips = ItemFactory.loadEquippedItems(accId, true, true); Map<Integer, List<Item>> accPlayerEquips = new HashMap<>(); for(Pair<Item, Integer> ae : accEquips) { List<Item> playerEquips = accPlayerEquips.get(ae.getRight()); if(playerEquips == null) { playerEquips = new LinkedList<>(); accPlayerEquips.put(ae.getRight(), playerEquips); } playerEquips.add(ae.getLeft()); } Connection con = DatabaseConnection.getConnection(); try (PreparedStatement ps = con.prepareStatement("SELECT * FROM characters WHERE accountid = ? ORDER BY world, id")) { ps.setInt(1, accId); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { characterCount++; int cworld = rs.getByte("world"); if(cworld >= wlen) continue; if(cworld > curWorld) { wchars.add(curWorld, chars); curWorld = cworld; chars = new LinkedList<>(); } Integer cid = rs.getInt("id"); chars.add(MapleCharacter.loadCharacterEntryFromDB(rs, accPlayerEquips.get(cid))); } } } con.close(); wchars.add(curWorld, chars); } catch (SQLException sqle) { sqle.printStackTrace(); } return new Pair<>(characterCount, wchars); } public void loadAllAccountsCharactersView() { try { Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT id FROM accounts"); ResultSet rs = ps.executeQuery(); while (rs.next()) { int accountId = rs.getInt("id"); if (isFirstAccountLogin(accountId)) { loadAccountCharactersView(accountId, 0, 0); } } rs.close(); ps.close(); con.close(); } catch (SQLException se) { se.printStackTrace(); } } private boolean isFirstAccountLogin(Integer accId) { lgnRLock.lock(); try { return !accountChars.containsKey(accId); } finally { lgnRLock.unlock(); } } private static void applyAllNameChanges() { try (Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM namechanges WHERE completionTime IS NULL")) { ResultSet rs = ps.executeQuery(); List<Pair<String, String>> changedNames = new LinkedList<Pair<String, String>>(); //logging only while(rs.next()) { con.setAutoCommit(false); int nameChangeId = rs.getInt("id"); int characterId = rs.getInt("characterId"); String oldName = rs.getString("old"); String newName = rs.getString("new"); boolean success = MapleCharacter.doNameChange(con, characterId, oldName, newName, nameChangeId); if(!success) con.rollback(); //discard changes else changedNames.add(new Pair<String, String>(oldName, newName)); con.setAutoCommit(true); } //log for(Pair<String, String> namePair : changedNames) { FilePrinter.print(FilePrinter.CHANGE_CHARACTER_NAME, "Name change applied : from \"" + namePair.getLeft() + "\" to \"" + namePair.getRight() + "\" at " + Calendar.getInstance().getTime().toString()); } } catch(SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.CHANGE_CHARACTER_NAME, e, "Failed to retrieve list of pending name changes."); } } private static void applyAllWorldTransfers() { try (Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM worldtransfers WHERE completionTime IS NULL")) { ResultSet rs = ps.executeQuery(); List<Integer> removedTransfers = new LinkedList<Integer>(); while(rs.next()) { int nameChangeId = rs.getInt("id"); int characterId = rs.getInt("characterId"); int oldWorld = rs.getInt("from"); int newWorld = rs.getInt("to"); String reason = MapleCharacter.checkWorldTransferEligibility(con, characterId, oldWorld, newWorld); //check if character is still eligible if(reason != null) { removedTransfers.add(nameChangeId); FilePrinter.print(FilePrinter.WORLD_TRANSFER, "World transfer cancelled : Character ID " + characterId + " at " + Calendar.getInstance().getTime().toString() + ", Reason : " + reason); try (PreparedStatement delPs = con.prepareStatement("DELETE FROM worldtransfers WHERE id = ?")) { delPs.setInt(1, nameChangeId); delPs.executeUpdate(); } catch(SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.WORLD_TRANSFER, e, "Failed to delete world transfer for character ID " + characterId); } } } rs.beforeFirst(); List<Pair<Integer, Pair<Integer, Integer>>> worldTransfers = new LinkedList<Pair<Integer, Pair<Integer, Integer>>>(); //logging only <charid, <oldWorld, newWorld>> while(rs.next()) { con.setAutoCommit(false); int nameChangeId = rs.getInt("id"); if(removedTransfers.contains(nameChangeId)) continue; int characterId = rs.getInt("characterId"); int oldWorld = rs.getInt("from"); int newWorld = rs.getInt("to"); boolean success = MapleCharacter.doWorldTransfer(con, characterId, oldWorld, newWorld, nameChangeId); if(!success) con.rollback(); else worldTransfers.add(new Pair<Integer, Pair<Integer, Integer>>(characterId, new Pair<Integer, Integer>(oldWorld, newWorld))); con.setAutoCommit(true); } //log for(Pair<Integer, Pair<Integer, Integer>> worldTransferPair : worldTransfers) { int charId = worldTransferPair.getLeft(); int oldWorld = worldTransferPair.getRight().getLeft(); int newWorld = worldTransferPair.getRight().getRight(); FilePrinter.print(FilePrinter.WORLD_TRANSFER, "World transfer applied : Character ID " + charId + " from World " + oldWorld + " to World " + newWorld + " at " + Calendar.getInstance().getTime().toString()); } } catch(SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.WORLD_TRANSFER, e, "Failed to retrieve list of pending world transfers."); } } public void loadAccountCharacters(MapleClient c) { Integer accId = c.getAccID(); if (!isFirstAccountLogin(accId)) { Set<Integer> accWorlds = new HashSet<>(); lgnRLock.lock(); try { for (Integer chrid : getAccountCharacterEntries(accId)) { accWorlds.add(worldChars.get(chrid)); } } finally { lgnRLock.unlock(); } int gmLevel = 0; for (Integer aw : accWorlds) { World wserv = this.getWorld(aw); if (wserv != null) { for (MapleCharacter chr : wserv.getAllCharactersView()) { if (gmLevel < chr.gmLevel()) gmLevel = chr.gmLevel(); } } } c.setGMLevel(gmLevel); return; } int gmLevel = loadAccountCharactersView(c.getAccID(), 0, 0); c.setGMLevel(gmLevel); } private int loadAccountCharactersView(Integer accId, int gmLevel, int fromWorldid) { // returns the maximum gmLevel found List<World> wlist = this.getWorlds(); Pair<Short, List<List<MapleCharacter>>> accCharacters = loadAccountCharactersViewFromDb(accId, wlist.size()); lgnWLock.lock(); try { List<List<MapleCharacter>> accChars = accCharacters.getRight(); accountCharacterCount.put(accId, accCharacters.getLeft()); Set<Integer> chars = accountChars.get(accId); if(chars == null) { chars = new HashSet<>(5); } for (int wid = fromWorldid; wid < wlist.size(); wid++) { World w = wlist.get(wid); List<MapleCharacter> wchars = accChars.get(wid); w.loadAccountCharactersView(accId, wchars); for (MapleCharacter chr : wchars) { int cid = chr.getId(); if (gmLevel < chr.gmLevel()) gmLevel = chr.gmLevel(); chars.add(cid); worldChars.put(cid, wid); } } accountChars.put(accId, chars); } finally { lgnWLock.unlock(); } return gmLevel; } public void loadAccountStorages(MapleClient c) { int accountId = c.getAccID(); Set<Integer> accWorlds = new HashSet<>(); lgnWLock.lock(); try { Set<Integer> chars = accountChars.get(accountId); for (Integer cid : chars) { Integer worldid = worldChars.get(cid); if (worldid != null) { accWorlds.add(worldid); } } } finally { lgnWLock.unlock(); } List<World> worldList = this.getWorlds(); for (Integer worldid : accWorlds) { if (worldid < worldList.size()) { World wserv = worldList.get(worldid); wserv.loadAccountStorage(accountId); } } } private static String getRemoteHost(MapleClient client) { return MapleSessionCoordinator.getSessionRemoteHost(client.getSession()); } public void setCharacteridInTransition(MapleClient client, int charId) { String remoteIp = getRemoteHost(client); lgnWLock.lock(); try { transitioningChars.put(remoteIp, charId); } finally { lgnWLock.unlock(); } } public boolean validateCharacteridInTransition(MapleClient client, int charId) { if (!YamlConfig.config.server.USE_IP_VALIDATION) { return true; } String remoteIp = getRemoteHost(client); lgnWLock.lock(); try { Integer cid = transitioningChars.remove(remoteIp); return cid != null && cid.equals(charId); } finally { lgnWLock.unlock(); } } public Integer freeCharacteridInTransition(MapleClient client) { if (!YamlConfig.config.server.USE_IP_VALIDATION) { return null; } String remoteIp = getRemoteHost(client); lgnWLock.lock(); try { return transitioningChars.remove(remoteIp); } finally { lgnWLock.unlock(); } } public boolean hasCharacteridInTransition(MapleClient client) { if (!YamlConfig.config.server.USE_IP_VALIDATION) { return true; } String remoteIp = getRemoteHost(client); lgnRLock.lock(); try { return transitioningChars.containsKey(remoteIp); } finally { lgnRLock.unlock(); } } public void registerLoginState(MapleClient c) { srvLock.lock(); try { inLoginState.put(c, System.currentTimeMillis() + 600000); } finally { srvLock.unlock(); } } public void unregisterLoginState(MapleClient c) { srvLock.lock(); try { inLoginState.remove(c); } finally { srvLock.unlock(); } } private void disconnectIdlesOnLoginState() { List<MapleClient> toDisconnect = new LinkedList<>(); srvLock.lock(); try { long timeNow = System.currentTimeMillis(); for(Entry<MapleClient, Long> mc : inLoginState.entrySet()) { if(timeNow > mc.getValue()) { toDisconnect.add(mc.getKey()); } } for(MapleClient c : toDisconnect) { inLoginState.remove(c); } } finally { srvLock.unlock(); } for (MapleClient c : toDisconnect) { // thanks Lei for pointing a deadlock issue with srvLock if(c.isLoggedIn()) { c.disconnect(false, false); } else { MapleSessionCoordinator.getInstance().closeSession(c.getSession(), true); } } } private void disconnectIdlesOnLoginTask() { TimerManager.getInstance().register(new Runnable() { @Override public void run() { disconnectIdlesOnLoginState(); } }, 300000); } public final Runnable shutdown(final boolean restart) {//no player should be online when trying to shutdown! return new Runnable() { @Override public void run() { shutdownInternal(restart); } }; } private synchronized void shutdownInternal(boolean restart) { System.out.println((restart ? "Restarting" : "Shutting down") + " the server!\r\n"); if (getWorlds() == null) return;//already shutdown for (World w : getWorlds()) { w.shutdown(); } /*for (World w : getWorlds()) { while (w.getPlayerStorage().getAllCharacters().size() > 0) { try { Thread.sleep(1000); } catch (InterruptedException ie) { System.err.println("FUCK MY LIFE"); } } } for (Channel ch : getAllChannels()) { while (ch.getConnectedClients() > 0) { try { Thread.sleep(1000); } catch (InterruptedException ie) { System.err.println("FUCK MY LIFE"); } } }*/ List<Channel> allChannels = getAllChannels(); if(YamlConfig.config.server.USE_THREAD_TRACKER) ThreadTracker.getInstance().cancelThreadTrackerTask(); for (Channel ch : allChannels) { while (!ch.finishedShutdown()) { try { Thread.sleep(1000); } catch (InterruptedException ie) { ie.printStackTrace(); System.err.println("FUCK MY LIFE"); } } } resetServerWorlds(); ThreadManager.getInstance().stop(); TimerManager.getInstance().purge(); TimerManager.getInstance().stop(); System.out.println("Worlds + Channels are offline."); acceptor.unbind(); acceptor = null; if (!restart) { // shutdown hook deadlocks if System.exit() method is used within its body chores, thanks MIKE for pointing that out new Thread(new Runnable() { @Override public void run() { System.exit(0); } }).start(); } else { System.out.println("\r\nRestarting the server....\r\n"); try { instance.finalize();//FUU I CAN AND IT'S FREE } catch (Throwable ex) { ex.printStackTrace(); } instance = null; System.gc(); getInstance().init();//DID I DO EVERYTHING?! D: } } }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2013-2015 RoboVM AB * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.bugvm.apple.corevideo; /*<imports>*/ import java.io.*; import java.nio.*; import java.util.*; import com.bugvm.objc.*; import com.bugvm.objc.annotation.*; import com.bugvm.objc.block.*; import com.bugvm.rt.*; import com.bugvm.rt.annotation.*; import com.bugvm.rt.bro.*; import com.bugvm.rt.bro.annotation.*; import com.bugvm.rt.bro.ptr.*; import com.bugvm.apple.foundation.*; import com.bugvm.apple.corefoundation.*; import com.bugvm.apple.coregraphics.*; import com.bugvm.apple.opengles.*; import com.bugvm.apple.metal.*; /*</imports>*/ /*<javadoc>*/ /*</javadoc>*/ /*<annotations>*/@Library("CoreVideo")/*</annotations>*/ /*<visibility>*/public/*</visibility>*/ class /*<name>*/CVImageBuffer/*</name>*/ extends /*<extends>*/CVBuffer/*</extends>*/ /*<implements>*//*</implements>*/ { /*<ptr>*/ /*</ptr>*/ /*<bind>*/static { Bro.bind(CVImageBuffer.class); }/*</bind>*/ /*<constants>*//*</constants>*/ /*<constructors>*//*</constructors>*/ /*<properties>*//*</properties>*/ /*<members>*//*</members>*/ /** * @since Available in iOS 4.0 and later. */ public void setAttribute(CVImageBufferAttribute attribute, CFType value, CVAttachmentMode attachmentMode) { setAttachment(attribute.value(), value, attachmentMode); } /** * @since Available in iOS 4.0 and later. */ public CFType getAttribute(CVImageBufferAttribute attribute) { return getAttachment(attribute.value()); } /** * @since Available in iOS 4.0 and later. */ public CVAttachmentMode getAttributeMode(CVImageBufferAttribute attribute) { return getAttachmentMode(attribute.value()); } /** * @since Available in iOS 4.0 and later. */ public void removeAttribute(CVImageBufferAttribute attribute) { removeAttachment(attribute.value()); } /** * @since Available in iOS 4.0 and later. */ public void removeAllAttributes() { removeAllAttachments(); } /** * @since Available in iOS 4.0 and later. */ public CVImageBufferAttributes getAttributes(CVAttachmentMode attachmentMode) { return new CVImageBufferAttributes(getAttachments(attachmentMode).as(CFDictionary.class)); } /** * @since Available in iOS 4.0 and later. */ @SuppressWarnings("unchecked") public void setAttributes(CVImageBufferAttributes attributes, CVAttachmentMode attachmentMode) { setAttachments(attributes.getDictionary().as(NSDictionary.class), attachmentMode); } /** * @since Available in iOS 4.0 and later. */ public void propagateAttributes(CVImageBuffer destinationBuffer) { propagateAttachments(destinationBuffer); } /*<methods>*/ /** * @since Available in iOS 4.0 and later. */ @Bridge(symbol="CVImageBufferGetEncodedSize", optional=true) public native @ByVal CGSize getEncodedSize(); /** * @since Available in iOS 4.0 and later. */ @Bridge(symbol="CVImageBufferGetDisplaySize", optional=true) public native @ByVal CGSize getDisplaySize(); /** * @since Available in iOS 4.0 and later. */ @Bridge(symbol="CVImageBufferGetCleanRect", optional=true) public native @ByVal CGRect getCleanRect(); /** * @since Available in iOS 4.0 and later. */ @Bridge(symbol="CVImageBufferIsFlipped", optional=true) public native boolean isFlipped(); /*</methods>*/ }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: eb322bc5933761d4fb98f8561eadae28 timeCreated: 1474289352 licenseType: Free NativeFormatImporter: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.bage; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.subject.PrincipalCollection; import org.apache.shiro.subject.Subject; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class AccountInfoController { @RequestMapping("/api1/hello") public String api1() { System.out.println("api1"); return "api1"; } @RequestMapping("/api2/hello") public String api2() { System.out.println("api1"); return "api2"; } @RequestMapping("/api3/hello") public String api3() { System.out.println("api1"); return "api3"; } @RequestMapping("/api4/hello") public String api4() { System.out.println("api4"); return "api4"; } @RequestMapping("/api5/hello") public String api5() { System.out.println("api5"); return "api5"; } @RequestMapping("/api6/hello") public String api6() { System.out.println("api6"); return "api6"; } @RequiresRoles("admin") @RequestMapping("/admin") public String admin() { String name = "World"; Subject subject = SecurityUtils.getSubject(); PrincipalCollection principalCollection = subject.getPrincipals(); if (principalCollection != null && !principalCollection.isEmpty()) { name = principalCollection.getPrimaryPrincipal().toString(); } return "admin-info" + name; } @RequiresRoles("org") @RequestMapping("/user") public String user() { String name = "World"; Subject subject = SecurityUtils.getSubject(); PrincipalCollection principalCollection = subject.getPrincipals(); if (principalCollection != null && !principalCollection.isEmpty()) { name = principalCollection.getPrimaryPrincipal().toString(); } return "org-info" + name; } }
{ "pile_set_name": "Github" }
// // DataInputStream.m // mtalk // // Created by maye on 13-10-24. // Copyright (c) 2013年 zuoye. All rights reserved. // #import "DataInputStream.h" @interface DataInputStream (PrivateMethods) - (int32_t)read; @end @implementation DataInputStream - (id)initWithData:(NSData *)aData { self = [self init]; if(self != nil){ data = [[NSData alloc] initWithData:aData]; } return self; } - (id)init{ self = [super init]; if(self != nil){ length = 0; } return self; } + (id)dataInputStreamWithData:(NSData *)aData { DataInputStream *dataInputStream = [[self alloc] initWithData:aData]; return dataInputStream ; } -(NSUInteger)getAvailabledLen{ return [data length]; } - (int32_t)read{ int8_t v; [data getBytes:&v range:NSMakeRange(length,1)]; length++; return ((int32_t)v & 0x0ff); } - (int8_t)readChar { int8_t v; [data getBytes:&v range:NSMakeRange(length,1)]; length++; return (v & 0x0ff); } - (int16_t)readShort { int32_t ch1 = [self read]; int32_t ch2 = [self read]; if ((ch1 | ch2) < 0){ @throw [NSException exceptionWithName:@"Exception" reason:@"EOFException" userInfo:nil]; } return (int16_t)((ch1 << 8) + (ch2 << 0)); } - (int32_t)readInt { int32_t ch1 = [self read]; int32_t ch2 = [self read]; int32_t ch3 = [self read]; int32_t ch4 = [self read]; if ((ch1 | ch2 | ch3 | ch4) < 0){ @throw [NSException exceptionWithName:@"Exception" reason:@"EOFException" userInfo:nil]; } return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)); } - (int64_t)readLong { int8_t ch[8]; [data getBytes:&ch range:NSMakeRange(length,8)]; length = length + 8; return (((int64_t)ch[0] << 56) + ((int64_t)(ch[1] & 255) << 48) + ((int64_t)(ch[2] & 255) << 40) + ((int64_t)(ch[3] & 255) << 32) + ((int64_t)(ch[4] & 255) << 24) + ((ch[5] & 255) << 16) + ((ch[6] & 255) << 8) + ((ch[7] & 255) << 0)); } - (NSString *)readUTF { //short utfLength = [self readShort]; int32_t utfLength = [self readInt]; NSData *d = [data subdataWithRange:NSMakeRange(length,utfLength)]; NSString *str = [[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding]; length = length + utfLength; return str; } -(NSData *)readDataWithLength:(int)len{ DDLog(@"================>>>> lenght: %ld len:%d",length,len); NSData *d =[data subdataWithRange:NSMakeRange(length, len)]; length = length +len; return d; } -(NSData *)readLeftData{ DDLog(@"=====>>> length %ld data's length %ld",length,[data length]); if ([data length]>length) { NSData *d =[data subdataWithRange:NSMakeRange(length, [data length])]; length = [data length]; return d; } return nil; } @end
{ "pile_set_name": "Github" }
#!/usr/bin/env python3 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. """ Module : this module to decode using beam search https://github.com/ThomasDelteil/HandwrittenTextRecognition_MXNet/blob/master/utils/CTCDecoder/BeamSearch.py """ from __future__ import division from __future__ import print_function import numpy as np class BeamEntry: """ information about one single beam at specific time-step """ def __init__(self): self.prTotal = 0 # blank and non-blank self.prNonBlank = 0 # non-blank self.prBlank = 0 # blank self.prText = 1 # LM score self.lmApplied = False # flag if LM was already applied to this beam self.labeling = () # beam-labeling class BeamState: """ information about the beams at specific time-step """ def __init__(self): self.entries = {} def norm(self): """ length-normalise LM score """ for (k, _) in self.entries.items(): labelingLen = len(self.entries[k].labeling) self.entries[k].prText = self.entries[k].prText ** (1.0 / (labelingLen if labelingLen else 1.0)) def sort(self): """ return beam-labelings, sorted by probability """ beams = [v for (_, v) in self.entries.items()] sortedBeams = sorted(beams, reverse=True, key=lambda x: x.prTotal*x.prText) return [x.labeling for x in sortedBeams] def applyLM(parentBeam, childBeam, classes, lm): """ calculate LM score of child beam by taking score from parent beam and bigram probability of last two chars """ if lm and not childBeam.lmApplied: c1 = classes[parentBeam.labeling[-1] if parentBeam.labeling else classes.index(' ')] # first char c2 = classes[childBeam.labeling[-1]] # second char lmFactor = 0.01 # influence of language model bigramProb = lm.getCharBigram(c1, c2) ** lmFactor # probability of seeing first and second char next to each other childBeam.prText = parentBeam.prText * bigramProb # probability of char sequence childBeam.lmApplied = True # only apply LM once per beam entry def addBeam(beamState, labeling): """ add beam if it does not yet exist """ if labeling not in beamState.entries: beamState.entries[labeling] = BeamEntry() def ctcBeamSearch(mat, classes, lm, k, beamWidth): """ beam search as described by the paper of Hwang et al. and the paper of Graves et al. """ blankIdx = len(classes) maxT, maxC = mat.shape # initialise beam state last = BeamState() labeling = () last.entries[labeling] = BeamEntry() last.entries[labeling].prBlank = 1 last.entries[labeling].prTotal = 1 # go over all time-steps for t in range(maxT): curr = BeamState() # get beam-labelings of best beams bestLabelings = last.sort()[0:beamWidth] # go over best beams for labeling in bestLabelings: # probability of paths ending with a non-blank prNonBlank = 0 # in case of non-empty beam if labeling: # probability of paths with repeated last char at the end try: prNonBlank = last.entries[labeling].prNonBlank * mat[t, labeling[-1]] except FloatingPointError: prNonBlank = 0 # probability of paths ending with a blank prBlank = (last.entries[labeling].prTotal) * mat[t, blankIdx] # add beam at current time-step if needed addBeam(curr, labeling) # fill in data curr.entries[labeling].labeling = labeling curr.entries[labeling].prNonBlank += prNonBlank curr.entries[labeling].prBlank += prBlank curr.entries[labeling].prTotal += prBlank + prNonBlank curr.entries[labeling].prText = last.entries[labeling].prText # beam-labeling not changed, therefore also LM score unchanged from curr.entries[labeling].lmApplied = True # LM already applied at previous time-step for this beam-labeling # extend current beam-labeling for c in range(maxC - 1): # add new char to current beam-labeling newLabeling = labeling + (c,) # if new labeling contains duplicate char at the end, only consider paths ending with a blank if labeling and labeling[-1] == c: prNonBlank = mat[t, c] * last.entries[labeling].prBlank else: prNonBlank = mat[t, c] * last.entries[labeling].prTotal # add beam at current time-step if needed addBeam(curr, newLabeling) # fill in data curr.entries[newLabeling].labeling = newLabeling curr.entries[newLabeling].prNonBlank += prNonBlank curr.entries[newLabeling].prTotal += prNonBlank # apply LM applyLM(curr.entries[labeling], curr.entries[newLabeling], classes, lm) # set new beam state last = curr # normalise LM scores according to beam-labeling-length last.norm() # sort by probability bestLabelings = last.sort()[:k] # get most probable labeling output = [] for bestLabeling in bestLabelings: # map labels to chars res = '' for l in bestLabeling: res += classes[l] output.append(res) return output
{ "pile_set_name": "Github" }
#ifndef HEADER_CURL_TOOL_LIBINFO_H #define HEADER_CURL_TOOL_LIBINFO_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ #include "tool_setup.h" /* global variable declarations, for libcurl run-time info */ extern curl_version_info_data *curlinfo; extern long built_in_protos; CURLcode get_libcurl_info(void); #endif /* HEADER_CURL_TOOL_LIBINFO_H */
{ "pile_set_name": "Github" }
/* C declarations for the Dylan "OLE" library. This file contains manually generated code to be included along with the automatically generated declarations. */ /* Copyright 1996 Functional Objects, Inc. All rights reserved. */ /* $Id: ole-aux.c,v 1.1 2004/03/12 00:09:39 cgay Exp $ */ /*====================================================*/ #if 0 /* for use with OleBuildVersion which is now considered obsolete. */ #include <ole2ver.h> /* OLE build version numbers -- convert from macro to variable */ const unsigned short DW_rmm = rmm; const unsigned short DW_rup = rup; #endif /* Include declarations of Dylan C-callable wrapper functions for use as inherited elements of function tables. */ #include "../com/c-com.h"
{ "pile_set_name": "Github" }
//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 // <chrono> // class year_month_weekday_last; // constexpr chrono::year year() const noexcept; // Returns: d_ #include <chrono> #include <type_traits> #include <cassert> #include "test_macros.h" int main() { using year = std::chrono::year; using month = std::chrono::month; using weekday = std::chrono::weekday; using weekday_last = std::chrono::weekday_last; using year_month_weekday_last = std::chrono::year_month_weekday_last; ASSERT_NOEXCEPT( std::declval<const year_month_weekday_last>().year()); ASSERT_SAME_TYPE(year, decltype(std::declval<const year_month_weekday_last>().year())); static_assert( year_month_weekday_last{year{}, month{}, weekday_last{weekday{}}}.year() == year{}, ""); for (int i = 1; i <= 50; ++i) { year_month_weekday_last ymwdl(year{i}, month{1}, weekday_last{weekday{}}); assert(static_cast<int>(ymwdl.year()) == i); } }
{ "pile_set_name": "Github" }
//****************************************** // GAME BOY ADVANCE MODULE //****************************************** #include "options.h" #ifdef enable_GBX /****************************************** Variables *****************************************/ char calcChecksumStr[5]; boolean readType; /****************************************** Menu *****************************************/ // GBA menu items static const char GBAMenuItem1[] PROGMEM = "Read Rom"; static const char GBAMenuItem2[] PROGMEM = "Read Save"; static const char GBAMenuItem3[] PROGMEM = "Write Save"; static const char GBAMenuItem4[] PROGMEM = "Force Savetype"; static const char GBAMenuItem5[] PROGMEM = "Flash Repro"; static const char GBAMenuItem6[] PROGMEM = "Reset"; static const char* const menuOptionsGBA[] PROGMEM = {GBAMenuItem1, GBAMenuItem2, GBAMenuItem3, GBAMenuItem4, GBAMenuItem5, GBAMenuItem6}; // Rom menu static const char GBARomItem1[] PROGMEM = "1MB"; static const char GBARomItem2[] PROGMEM = "2MB"; static const char GBARomItem3[] PROGMEM = "4MB"; static const char GBARomItem4[] PROGMEM = "8MB"; static const char GBARomItem5[] PROGMEM = "16MB"; static const char GBARomItem6[] PROGMEM = "32MB"; static const char* const romOptionsGBA[] PROGMEM = {GBARomItem1, GBARomItem2, GBARomItem3, GBARomItem4, GBARomItem5, GBARomItem6}; // Save menu static const char GBASaveItem1[] PROGMEM = "4K EEPROM"; static const char GBASaveItem2[] PROGMEM = "64K EEPROM"; static const char GBASaveItem3[] PROGMEM = "256K SRAM/FRAM"; static const char GBASaveItem4[] PROGMEM = "512K SRAM/FRAM"; static const char GBASaveItem5[] PROGMEM = "512K FLASHROM"; static const char GBASaveItem6[] PROGMEM = "1M FLASHROM"; static const char* const saveOptionsGBA[] PROGMEM = {GBASaveItem1, GBASaveItem2, GBASaveItem3, GBASaveItem4, GBASaveItem5, GBASaveItem6}; void gbaMenu() { // create menu with title and 4 options to choose from unsigned char mainMenu; // Copy menuOptions out of progmem convertPgm(menuOptionsGBA, 6); mainMenu = question_box(F("GBA Cart Reader"), menuOptions, 6, 0); // wait for user choice to come back from the question box menu switch (mainMenu) { case 0: // Read rom switch (cartSize) { case 0: // create submenu with title and 4 options to choose from unsigned char GBARomMenu; // Copy menuOptions out of progmem convertPgm(romOptionsGBA, 6); GBARomMenu = question_box(F("Select ROM size"), menuOptions, 6, 0); // wait for user choice to come back from the question box menu switch (GBARomMenu) { case 0: // 1MB cartSize = 0x100000; break; case 1: // 2MB cartSize = 0x200000; break; case 2: // 4MB cartSize = 0x400000; break; case 3: // 8MB cartSize = 0x800000; break; case 4: // 16MB cartSize = 0x1000000; break; case 5: // 32MB cartSize = 0x2000000; break; } break; case 1: // 1MB cartSize = 0x100000; break; case 4: // 4MB cartSize = 0x400000; break; case 8: // 8MB cartSize = 0x800000; break; case 16: // 16MB cartSize = 0x1000000; break; case 32: // 32MB cartSize = 0x2000000; break; } display_Clear(); // Change working dir to root sd.chdir("/"); readROM_GBA(); sd.chdir("/"); compare_checksum_GBA(); println_Msg(F("")); println_Msg(F("Press Button...")); display_Update(); wait(); break; case 1: // Read save if (saveType == 0) { // create submenu with title and 6 options to choose from unsigned char GBASaveMenu; // Copy menuOptions out of progmem convertPgm(saveOptionsGBA, 6); GBASaveMenu = question_box(F("Select save type"), menuOptions, 6, 0); // wait for user choice to come back from the question box menu switch (GBASaveMenu) { case 0: // 4K EEPROM saveType = 1; break; case 1: // 64K EEPROM saveType = 2; break; case 2: // 256K SRAM/FRAM saveType = 3; break; case 3: // 512K SRAM/FRAM saveType = 6; break; case 4: // 512K FLASH saveType = 4; break; case 5: // 1024K FLASH saveType = 5; break; } } switch (saveType) { case 1: display_Clear(); sd.chdir("/"); // 4K EEPROM readEeprom_GBA(4); setROM_GBA(); break; case 2: display_Clear(); sd.chdir("/"); // 64K EEPROM readEeprom_GBA(64); setROM_GBA(); break; case 3: display_Clear(); sd.chdir("/"); // 256K SRAM/FRAM readSRAM_GBA(1, 32768, 0); setROM_GBA(); break; case 4: display_Clear(); sd.chdir("/"); // 512K FLASH readFLASH_GBA(1, 65536, 0); setROM_GBA(); break; case 5: display_Clear(); sd.chdir("/"); // 1024K FLASH (divided into two banks) switchBank_GBA(0x0); setROM_GBA(); readFLASH_GBA(1, 65536, 0); switchBank_GBA(0x1); setROM_GBA(); readFLASH_GBA(0, 65536, 65536); setROM_GBA(); break; case 6: display_Clear(); sd.chdir("/"); // 512K SRAM/FRAM readSRAM_GBA(1, 65536, 0); setROM_GBA(); break; } println_Msg(F("")); println_Msg(F("Press Button...")); display_Update(); wait(); break; case 2: // Write save if (saveType == 0) { // create submenu with title and 6 options to choose from unsigned char GBASavesMenu; // Copy menuOptions out of progmem convertPgm(saveOptionsGBA, 6); GBASavesMenu = question_box(F("Select save type"), menuOptions, 6, 0); // wait for user choice to come back from the question box menu switch (GBASavesMenu) { case 0: // 4K EEPROM saveType = 1; break; case 1: // 64K EEPROM saveType = 2; break; case 2: // 256K SRAM/FRAM saveType = 3; break; case 3: // 512K SRAM/FRAM saveType = 6; break; case 4: // 512K FLASH saveType = 4; break; case 5: // 1024K FLASH saveType = 5; break; } } switch (saveType) { case 1: display_Clear(); sd.chdir("/"); // 4K EEPROM writeEeprom_GBA(4); writeErrors = verifyEEP_GBA(4); if (writeErrors == 0) { println_Msg(F("Verified OK")); display_Update(); } else { print_Msg(F("Error: ")); print_Msg(writeErrors); println_Msg(F(" bytes ")); print_Error(F("did not verify."), false); } setROM_GBA(); break; case 2: display_Clear(); sd.chdir("/"); // 64K EEPROM writeEeprom_GBA(64); writeErrors = verifyEEP_GBA(64); if (writeErrors == 0) { println_Msg(F("Verified OK")); display_Update(); } else { print_Msg(F("Error: ")); print_Msg(writeErrors); println_Msg(F(" bytes ")); print_Error(F("did not verify."), false); } setROM_GBA(); break; case 3: display_Clear(); // Change working dir to root sd.chdir("/"); // 256K SRAM/FRAM writeSRAM_GBA(1, 32768, 0); writeErrors = verifySRAM_GBA(32768, 0); if (writeErrors == 0) { println_Msg(F("Verified OK")); display_Update(); } else { print_Msg(F("Error: ")); print_Msg(writeErrors); println_Msg(F(" bytes ")); print_Error(F("did not verify."), false); } setROM_GBA(); break; case 4: display_Clear(); sd.chdir("/"); // 512K FLASH idFlash_GBA(); resetFLASH_GBA(); if (strcmp(flashid, "BFD4") != 0) { println_Msg(F("Flashrom Type not supported")); print_Msg(F("ID: ")); println_Msg(flashid); print_Error(F(""), true); } eraseFLASH_GBA(); if (blankcheckFLASH_GBA(65536)) { writeFLASH_GBA(1, 65536, 0); verifyFLASH_GBA(65536, 0); } else { print_Error(F("Erase failed"), false); } setROM_GBA(); break; case 5: display_Clear(); sd.chdir("/"); // 1M FLASH idFlash_GBA(); resetFLASH_GBA(); if (strcmp(flashid, "C209") != 0) { println_Msg(F("Flashrom Type not supported")); print_Msg(F("ID: ")); println_Msg(flashid); print_Error(F(""), true); } eraseFLASH_GBA(); // 131072 bytes are divided into two 65536 byte banks switchBank_GBA(0x0); setROM_GBA(); if (blankcheckFLASH_GBA(65536)) { writeFLASH_GBA(1, 65536, 0); verifyFLASH_GBA(65536, 0); } else { print_Error(F("Erase failed"), false); } switchBank_GBA(0x1); setROM_GBA(); if (blankcheckFLASH_GBA(65536)) { writeFLASH_GBA(0, 65536, 65536); verifyFLASH_GBA(65536, 65536); } else { print_Error(F("Erase failed"), false); } setROM_GBA(); break; case 6: display_Clear(); // Change working dir to root sd.chdir("/"); // 512K SRAM/FRAM writeSRAM_GBA(1, 65536, 0); writeErrors = verifySRAM_GBA(65536, 0); if (writeErrors == 0) { println_Msg(F("Verified OK")); display_Update(); } else { print_Msg(F("Error: ")); print_Msg(writeErrors); println_Msg(F(" bytes ")); print_Error(F("did not verify."), false); } setROM_GBA(); break; } println_Msg(F("")); println_Msg(F("Press Button...")); display_Update(); wait(); break; case 3: display_Clear(); // create submenu with title and 7 options to choose from unsigned char GBASaveMenu; // Copy menuOptions out of progmem convertPgm(saveOptionsGBA, 6); GBASaveMenu = question_box(F("Select save type"), menuOptions, 6, 0); // wait for user choice to come back from the question box menu switch (GBASaveMenu) { case 0: // 4K EEPROM saveType = 1; break; case 1: // 64K EEPROM saveType = 2; break; case 2: // 256K SRAM/FRAM saveType = 3; break; case 3: // 512K SRAM/FRAM saveType = 6; break; case 4: // 512K FLASH saveType = 4; break; case 5: // 1024K FLASH saveType = 5; break; } display_Clear(); break; case 4: display_Clear(); flashRepro_GBA(); println_Msg(F("")); println_Msg(F("Press Button...")); display_Update(); wait(); resetArduino(); break; case 5: resetArduino(); break; } } /****************************************** Setup *****************************************/ void setup_GBA() { setROM_GBA(); // Print start page getCartInfo_GBA(); display_Clear(); print_Msg(F("Name: ")); println_Msg(romName); print_Msg(F("Cart ID: ")); println_Msg(cartID); print_Msg(F("Rom Size: ")); if (cartSize == 0) println_Msg(F("Unknown")); else { print_Msg(cartSize); println_Msg(F("MB")); } print_Msg(F("Save: ")); switch (saveType) { case 0: println_Msg(F("Unknown")); break; case 1: println_Msg(F("4K Eeprom")); break; case 2: println_Msg(F("64K Eeprom")); break; case 3: println_Msg(F("256K Sram")); break; case 4: println_Msg(F("512K Flash")); break; case 5: println_Msg(F("1024K Flash")); break; } print_Msg(F("Checksum: ")); println_Msg(checksumStr); print_Msg(F("Version: 1.")); println_Msg(romVersion); // Wait for user input println_Msg(F("Press Button...")); display_Update(); wait(); } /****************************************** Low level functions *****************************************/ void setROM_GBA() { // CS_SRAM(PH0) DDRH |= (1 << 0); PORTH |= (1 << 0); // CS_ROM(PH3) DDRH |= (1 << 3); PORTH |= (1 << 3); // WR(PH5) DDRH |= (1 << 5); PORTH |= (1 << 5); // RD(PH6) DDRH |= (1 << 6); PORTH |= (1 << 6); // AD0-AD7 DDRF = 0xFF; // AD8-AD15 DDRK = 0xFF; // AD16-AD23 DDRC = 0xFF; // Wait delay(500); } word readWord_GBA(unsigned long myAddress) { // Set address/data ports to output DDRF = 0xFF; DDRK = 0xFF; DDRC = 0xFF; // Divide address by two to get word addressing myAddress = myAddress >> 1; // Output address to address pins, PORTF = myAddress; PORTK = myAddress >> 8; PORTC = myAddress >> 16; // Pull CS(PH3) to LOW PORTH &= ~ (1 << 3); // Set address/data ports to input PORTF = 0x0; PORTK = 0x0; DDRF = 0x0; DDRK = 0x0; // Pull RD(PH6) to LOW PORTH &= ~ (1 << 6); // Delay here or read error with repro __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t"); word myWord = (PINK << 8) | PINF; // Switch RD(PH6) to HIGH PORTH |= (1 << 6); // Switch CS_ROM(PH3) to HIGH PORTH |= (1 << 3); return myWord; } void writeWord_GBA(unsigned long myAddress, word myWord) { // Set address/data ports to output DDRF = 0xFF; DDRK = 0xFF; DDRC = 0xFF; // Divide address by two to get word addressing myAddress = myAddress >> 1; // Output address to address pins, PORTF = myAddress; PORTK = myAddress >> 8; PORTC = myAddress >> 16; // Pull CS(PH3) to LOW PORTH &= ~ (1 << 3); __asm__("nop\n\t""nop\n\t"); // Output data PORTF = myWord & 0xFF; PORTK = myWord >> 8; // Pull WR(PH5) to LOW PORTH &= ~ (1 << 5); __asm__("nop\n\t""nop\n\t"); // Switch WR(PH5) to HIGH PORTH |= (1 << 5); // Switch CS_ROM(PH3) to HIGH PORTH |= (1 << 3); } // This function swaps bit at positions p1 and p2 in an integer n word swapBits(word n, word p1, word p2) { // Move p1'th to rightmost side word bit1 = (n >> p1) & 1; // Move p2'th to rightmost side word bit2 = (n >> p2) & 1; // XOR the two bits */ word x = (bit1 ^ bit2); // Put the xor bit back to their original positions x = (x << p1) | (x << p2); // XOR 'x' with the original number so that the two sets are swapped word result = n ^ x; return result; } // Some repros have D0 and D1 switched word readWord_GAB(unsigned long myAddress) { word tempWord = swapBits(readWord_GBA(myAddress), 0, 1); return tempWord; } void writeWord_GAB(unsigned long myAddress, word myWord) { writeWord_GBA(myAddress, swapBits(myWord, 0, 1)); } byte readByte_GBA(unsigned long myAddress) { // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set data port to input DDRC = 0x0; // Output address to address pins, PORTF = myAddress; PORTK = myAddress >> 8; // Pull OE_SRAM(PH6) to LOW PORTH &= ~(1 << 6); // Pull CE_SRAM(PH0) to LOW PORTH &= ~(1 << 0); // Hold address for at least 25ns and wait 150ns before access __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t"); // Read byte byte tempByte = PINC; // Pull CE_SRAM(PH0) HIGH PORTH |= (1 << 0); // Pull OE_SRAM(PH6) HIGH PORTH |= (1 << 6); return tempByte; } void writeByte_GBA(unsigned long myAddress, byte myData) { // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set data port to output DDRC = 0xFF; // Output address to address pins PORTF = myAddress; PORTK = myAddress >> 8; // Output data to data pins PORTC = myData; // Wait till output is stable __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t"); // Pull WE_SRAM(PH5) to LOW PORTH &= ~(1 << 5); // Pull CE_SRAM(PH0) to LOW PORTH &= ~(1 << 0); // Leave WR low for at least 60ns __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t"); // Pull CE_SRAM(PH0) HIGH PORTH |= (1 << 0); // Pull WE_SRAM(PH5) HIGH PORTH |= (1 << 5); // Leave WR high for at least 50ns __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t"); } /****************************************** GBA ROM Functions *****************************************/ // Read info out of rom header void getCartInfo_GBA() { // Read Header into array for (int currWord = 0; currWord < 192; currWord += 2) { word tempWord = readWord_GBA(currWord); sdBuffer[currWord] = tempWord & 0xFF; sdBuffer[currWord + 1] = (tempWord >> 8) & 0xFF; } // Compare Nintendo logo against known checksum, 156 bytes starting at 0x04 word logoChecksum = 0; for (int currByte = 0x4; currByte < 0xA0; currByte++) { logoChecksum += sdBuffer[currByte]; } if (logoChecksum != 0x4B1B) { print_Error(F("CARTRIDGE ERROR"), false); strcpy(romName, "ERROR"); println_Msg(F("")); println_Msg(F("")); println_Msg(F("")); println_Msg(F("Press Button to")); println_Msg(F("ignore or powercycle")); println_Msg(F("to try again")); display_Update(); wait(); } else { char tempStr2[2]; char tempStr[5]; // cart not in list cartSize = 0; saveType = 0; // Get cart ID cartID[0] = char(sdBuffer[0xAC]); cartID[1] = char(sdBuffer[0xAD]); cartID[2] = char(sdBuffer[0xAE]); cartID[3] = char(sdBuffer[0xAF]); if (myFile.open("gba.txt", O_READ)) { // Loop through file while (myFile.available()) { // Read 4 bytes into String, do it one at a time so byte order doesn't get mixed up sprintf(tempStr, "%c", myFile.read()); for (byte i = 0; i < 3; i++) { sprintf(tempStr2, "%c", myFile.read()); strcat(tempStr, tempStr2); } // Check if string is a match if (strcmp(tempStr, cartID) == 0) { // Skip the , in the file myFile.seekSet(myFile.curPosition() + 1); // Read the next ascii character and subtract 48 to convert to decimal cartSize = myFile.read() - 48; // Remove leading 0 for single digit cart sizes if (cartSize != 0) { cartSize = cartSize * 10 + myFile.read() - 48; } else { cartSize = myFile.read() - 48; } // Skip the , in the file myFile.seekSet(myFile.curPosition() + 1); // Read the next ascii character and subtract 48 to convert to decimal saveType = myFile.read() - 48; } // If no match, empty string, advance by 7 and try again else { myFile.seekSet(myFile.curPosition() + 7); } } // Close the file: myFile.close(); } else { print_Error(F("GBA.txt missing"), true); } // Get name byte myByte = 0; byte myLength = 0; for (int addr = 0xA0; addr <= 0xAB; addr++) { myByte = sdBuffer[addr]; if (((char(myByte) >= 48 && char(myByte) <= 57) || (char(myByte) >= 65 && char(myByte) <= 122)) && myLength < 15) { romName[myLength] = char(myByte); myLength++; } } // Get ROM version romVersion = sdBuffer[0xBC]; // Get Checksum as string sprintf(checksumStr, "%02X", sdBuffer[0xBD]); // Calculate Checksum int calcChecksum = 0x00; for (int n = 0xA0; n < 0xBD; n++) { calcChecksum -= sdBuffer[n]; } calcChecksum = (calcChecksum - 0x19) & 0xFF; // Turn into string sprintf(calcChecksumStr, "%02X", calcChecksum); // Compare checksum if (strcmp(calcChecksumStr, checksumStr) != 0) { print_Msg(F("Result: ")); println_Msg(calcChecksumStr); print_Error(F("Checksum Error"), false); println_Msg(F("")); println_Msg(F("Press Button...")); display_Update(); wait(); } } } // Dump ROM void readROM_GBA() { // Get name, add extension and convert to char array for sd lib strcpy(fileName, romName); strcat(fileName, ".gba"); // create a new folder for the rom file EEPROM_readAnything(0, foldern); sprintf(folder, "GBA/ROM/%s/%d", romName, foldern); sd.mkdir(folder, true); sd.chdir(folder); //clear the screen display_Clear(); print_Msg(F("Saving to ")); print_Msg(folder); println_Msg(F("/...")); display_Update(); // write new folder number back to eeprom foldern = foldern + 1; EEPROM_writeAnything(0, foldern); //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { print_Error(F("Can't create file on SD"), true); } // Read rom for (int myAddress = 0; myAddress < cartSize; myAddress += 512) { // Blink led if (myAddress % 16384 == 0) PORTB ^= (1 << 4); for (int currWord = 0; currWord < 512; currWord += 2) { word tempWord = readWord_GBA(myAddress + currWord); sdBuffer[currWord] = tempWord & 0xFF; sdBuffer[currWord + 1] = (tempWord >> 8) & 0xFF; } // Write to SD myFile.write(sdBuffer, 512); } // Close the file: myFile.close(); } // Calculate the checksum of the dumped rom boolean compare_checksum_GBA () { println_Msg(F("Calculating Checksum")); display_Update(); strcpy(fileName, romName); strcat(fileName, ".gba"); // last used rom folder EEPROM_readAnything(0, foldern); sprintf(folder, "GBA/ROM/%s/%d", romName, foldern - 1); sd.chdir(folder); // If file exists if (myFile.open(fileName, O_READ)) { // Read rom header myFile.read(sdBuffer, 512); myFile.close(); // Calculate Checksum int calcChecksum = 0x00; for (int n = 0xA0; n < 0xBD; n++) { calcChecksum -= sdBuffer[n]; } calcChecksum = (calcChecksum - 0x19) & 0xFF; // Turn into string sprintf(calcChecksumStr, "%02X", calcChecksum); if (strcmp(calcChecksumStr, checksumStr) == 0) { println_Msg(F("Checksum matches")); display_Update(); return 1; } else { print_Msg(F("Result: ")); println_Msg(calcChecksumStr); print_Error(F("Checksum Error"), false); return 0; } } // Else show error else { print_Error(F("Failed to open rom"), false); return 0; } } /****************************************** GBA SRAM SAVE Functions *****************************************/ void readSRAM_GBA(boolean browseFile, unsigned long sramSize, uint32_t pos) { if (browseFile) { // Get name, add extension and convert to char array for sd lib strcpy(fileName, romName); strcat(fileName, ".srm"); // create a new folder for the save file EEPROM_readAnything(0, foldern); sprintf(folder, "GBA/SAVE/%s/%d", romName, foldern); sd.mkdir(folder, true); sd.chdir(folder); // Save location print_Msg(F("Saving to ")); print_Msg(folder); println_Msg(F("/...")); display_Update(); // write new folder number back to eeprom foldern = foldern + 1; EEPROM_writeAnything(0, foldern); } //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { print_Error(F("SD Error"), true); } // Seek to a new position in the file if (pos != 0) myFile.seekCur(pos); for (unsigned long currAddress = 0; currAddress < sramSize; currAddress += 512) { for (int c = 0; c < 512; c++) { // Read byte sdBuffer[c] = readByte_GBA(currAddress + c); } // Write sdBuffer to file myFile.write(sdBuffer, 512); } // Close the file: myFile.close(); // Signal end of process println_Msg(F("Done")); display_Update(); } void writeSRAM_GBA(boolean browseFile, unsigned long sramSize, uint32_t pos) { if (browseFile) { filePath[0] = '\0'; sd.chdir("/"); fileBrowser(F("Select srm file")); // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); display_Clear(); } //open file on sd card if (myFile.open(filePath, O_READ)) { // Seek to a new position in the file if (pos != 0) myFile.seekCur(pos); for (unsigned long currAddress = 0; currAddress < sramSize; currAddress += 512) { //fill sdBuffer myFile.read(sdBuffer, 512); for (int c = 0; c < 512; c++) { // Write byte writeByte_GBA(currAddress + c, sdBuffer[c]); } } // Close the file: myFile.close(); println_Msg(F("SRAM writing finished")); display_Update(); } else { print_Error(F("File doesnt exist"), false); } } unsigned long verifySRAM_GBA(unsigned long sramSize, uint32_t pos) { //open file on sd card if (myFile.open(filePath, O_READ)) { // Variable for errors writeErrors = 0; // Seek to a new position in the file if (pos != 0) myFile.seekCur(pos); for (unsigned long currAddress = 0; currAddress < sramSize; currAddress += 512) { //fill sdBuffer myFile.read(sdBuffer, 512); for (int c = 0; c < 512; c++) { // Read byte if (readByte_GBA(currAddress + c) != sdBuffer[c]) { writeErrors++; } } } // Close the file: myFile.close(); return writeErrors; } else { print_Error(F("Can't open file"), false); } } /****************************************** GBA FRAM SAVE Functions *****************************************/ // MB85R256 FRAM (Ferroelectric Random Access Memory) 32,768 words x 8 bits void readFRAM_GBA (unsigned long framSize) { // Output a HIGH signal on CS_ROM(PH3) WE_SRAM(PH5) PORTH |= (1 << 3) | (1 << 5); // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set data pins to input DDRC = 0x00; // Output a LOW signal on CE_SRAM(PH0) and OE_SRAM(PH6) PORTH &= ~((1 << 0) | (1 << 6)); // Get name, add extension and convert to char array for sd lib strcpy(fileName, romName); strcat(fileName, ".srm"); // create a new folder for the save file EEPROM_readAnything(0, foldern); sprintf(folder, "GBA/SAVE/%s/%d", romName, foldern); sd.mkdir(folder, true); sd.chdir(folder); // Save location print_Msg(F("Saving to ")); print_Msg(folder); println_Msg(F("/...")); display_Update(); // write new folder number back to eeprom foldern = foldern + 1; EEPROM_writeAnything(0, foldern); //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { print_Error(F("SD Error"), true); } for (unsigned long currAddress = 0; currAddress < framSize; currAddress += 512) { for (int c = 0; c < 512; c++) { // Pull OE_SRAM(PH6) HIGH PORTH |= (1 << 6); // Set address PORTF = (currAddress + c) & 0xFF; PORTK = ((currAddress + c) >> 8) & 0xFF; // Arduino running at 16Mhz -> one nop = 62.5ns // Leave CS_SRAM HIGH for at least 85ns __asm__("nop\n\t""nop\n\t"); // Pull OE_SRAM(PH6) LOW PORTH &= ~ (1 << 6); // Hold address for at least 25ns and wait 150ns before access __asm__("nop\n\t""nop\n\t""nop\n\t"); // Read byte sdBuffer[c] = PINC; } // Write sdBuffer to file myFile.write(sdBuffer, 512); } // Close the file: myFile.close(); // Signal end of process println_Msg(F("Done")); display_Update(); } // Write file to SRAM void writeFRAM_GBA (boolean browseFile, unsigned long framSize) { // Output a HIGH signal on CS_ROM(PH3) and OE_SRAM(PH6) PORTH |= (1 << 3) | (1 << 6); // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set data port to output DDRC = 0xFF; // Output a LOW signal on CE_SRAM(PH0) and WE_SRAM(PH5) PORTH &= ~((1 << 0) | (1 << 5)); if (browseFile) { filePath[0] = '\0'; sd.chdir("/"); fileBrowser(F("Select srm file")); // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); display_Clear(); } else sprintf(filePath, "%s", fileName); //open file on sd card if (myFile.open(filePath, O_READ)) { for (unsigned long currAddress = 0; currAddress < framSize; currAddress += 512) { //fill sdBuffer myFile.read(sdBuffer, 512); for (int c = 0; c < 512; c++) { // Output Data on PORTC PORTC = sdBuffer[c]; // Arduino running at 16Mhz -> one nop = 62.5ns // Data setup time 50ns __asm__("nop\n\t"); // Pull WE_SRAM (PH5) HIGH PORTH |= (1 << 5); // Set address PORTF = (currAddress + c) & 0xFF; PORTK = ((currAddress + c) >> 8) & 0xFF; // Leave WE_SRAM (PH5) HIGH for at least 85ns __asm__("nop\n\t""nop\n\t"); // Pull WE_SRAM (PH5) LOW PORTH &= ~ (1 << 5); // Hold address for at least 25ns and wait 150ns before next write __asm__("nop\n\t""nop\n\t""nop\n\t"); } } // Close the file: myFile.close(); println_Msg(F("SRAM writing finished")); display_Update(); } else { print_Error(F("File doesnt exist"), false); } } // Check if the SRAM was written without any error unsigned long verifyFRAM_GBA(unsigned long framSize) { // Output a HIGH signal on CS_ROM(PH3) WE_SRAM(PH5) PORTH |= (1 << 3) | (1 << 5); // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set data pins to input DDRC = 0x00; // Output a LOW signal on CE_SRAM(PH0) and OE_SRAM(PH6) PORTH &= ~((1 << 0) | (1 << 6)); //open file on sd card if (myFile.open(filePath, O_READ)) { // Variable for errors writeErrors = 0; for (unsigned long currAddress = 0; currAddress < framSize; currAddress += 512) { //fill sdBuffer myFile.read(sdBuffer, 512); for (int c = 0; c < 512; c++) { // Pull OE_SRAM(PH6) HIGH PORTH |= (1 << 6); // Set address PORTF = (currAddress + c) & 0xFF; PORTK = ((currAddress + c) >> 8) & 0xFF; // Arduino running at 16Mhz -> one nop = 62.5ns // Leave CS_SRAM HIGH for at least 85ns __asm__("nop\n\t""nop\n\t"); // Pull OE_SRAM(PH6) LOW PORTH &= ~ (1 << 6); // Hold address for at least 25ns and wait 150ns before access __asm__("nop\n\t""nop\n\t""nop\n\t"); // Read byte if (PINC != sdBuffer[c]) { writeErrors++; } } } // Close the file: myFile.close(); return writeErrors; } else { print_Error(F("Can't open file"), false); } } /****************************************** GBA FLASH SAVE Functions *****************************************/ // SST 39VF512 Flashrom void idFlash_GBA() { // Output a HIGH signal on CS_ROM(PH3) WE_FLASH(PH5) and OE_FLASH(PH6) PORTH |= (1 << 3) | (1 << 5) | (1 << 6); // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set data pins to output DDRC = 0xFF; // Output a LOW signal on CE_FLASH(PH0) PORTH &= ~(1 << 0); // ID command sequence writeByteFlash_GBA(0x5555, 0xaa); writeByteFlash_GBA(0x2aaa, 0x55); writeByteFlash_GBA(0x5555, 0x90); // Set data pins to input DDRC = 0x00; // Output a LOW signal on OE_FLASH(PH6) PORTH &= ~(1 << 6); // Wait 150ns before reading ID // Arduino running at 16Mhz -> one nop = 62.5ns __asm__("nop\n\t""nop\n\t""nop\n\t"); // Read the two id bytes into a string sprintf(flashid, "%02X%02X", readByteFlash_GBA(0), readByteFlash_GBA(1)); // Set CS_FLASH(PH0) high PORTH |= (1 << 0); } // Reset FLASH void resetFLASH_GBA() { // Output a HIGH signal on CS_ROM(PH3) WE_FLASH(PH5) and OE_FLASH(PH6) PORTH |= (1 << 3) | (1 << 5) | (1 << 6); // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set data pins to output DDRC = 0xFF; // Output a LOW signal on CE_FLASH(PH0) PORTH &= ~(1 << 0); // Reset command sequence writeByteFlash_GBA(0x5555, 0xAA); writeByteFlash_GBA(0x2AAA, 0x55); writeByteFlash_GBA(0x5555, 0xf0); writeByteFlash_GBA(0x5555, 0xf0); // Set CS_FLASH(PH0) high PORTH |= (1 << 0); // Wait delay(100); } byte readByteFlash_GBA(unsigned long myAddress) { // Set address PORTF = myAddress & 0xFF; PORTK = (myAddress >> 8) & 0xFF; // Wait until byte is ready to read __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t"); // Read byte byte tempByte = PINC; // Arduino running at 16Mhz -> one nop = 62.5ns __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t"); return tempByte; } void writeByteFlash_GBA(unsigned long myAddress, byte myData) { PORTF = myAddress & 0xFF; PORTK = (myAddress >> 8) & 0xFF; PORTC = myData; // Arduino running at 16Mhz -> one nop = 62.5ns // Wait till output is stable __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t"); // Switch WE_FLASH(PH5) to LOW PORTH &= ~(1 << 5); // Leave WE low for at least 40ns __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t"); // Switch WE_FLASH(PH5) to HIGH PORTH |= (1 << 5); // Leave WE high for a bit __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t"); } // Erase FLASH void eraseFLASH_GBA() { // Output a HIGH signal on CS_ROM(PH3) WE_FLASH(PH5) and OE_FLASH(PH6) PORTH |= (1 << 3) | (1 << 5) | (1 << 6); // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set data pins to output DDRC = 0xFF; // Output a LOW signal on CE_FLASH(PH0) PORTH &= ~(1 << 0); // Erase command sequence writeByteFlash_GBA(0x5555, 0xaa); writeByteFlash_GBA(0x2aaa, 0x55); writeByteFlash_GBA(0x5555, 0x80); writeByteFlash_GBA(0x5555, 0xaa); writeByteFlash_GBA(0x2aaa, 0x55); writeByteFlash_GBA(0x5555, 0x10); // Set CS_FLASH(PH0) high PORTH |= (1 << 0); // Wait until all is erased delay(500); } boolean blankcheckFLASH_GBA (unsigned long flashSize) { // Output a HIGH signal on CS_ROM(PH3) WE_FLASH(PH5) PORTH |= (1 << 3) | (1 << 5); // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set address to 0 PORTF = 0x00; PORTK = 0x00; // Set data pins to input DDRC = 0x00; // Disable Pullups //PORTC = 0x00; boolean blank = 1; // Output a LOW signal on CE_FLASH(PH0) PORTH &= ~(1 << 0); // Output a LOW signal on OE_FLASH(PH6) PORTH &= ~(1 << 6); for (unsigned long currAddress = 0; currAddress < flashSize; currAddress += 512) { // Fill buffer for (int c = 0; c < 512; c++) { // Read byte sdBuffer[c] = readByteFlash_GBA(currAddress + c); } // Check buffer for (unsigned long currByte = 0; currByte < 512; currByte++) { if (sdBuffer[currByte] != 0xFF) { currByte = 512; currAddress = flashSize; blank = 0; } } } // Set CS_FLASH(PH0) high PORTH |= (1 << 0); return blank; } // The MX29L010 is 131072 bytes in size and has 16 sectors per bank // each sector is 4096 bytes, there are 32 sectors total // therefore the bank size is 65536 bytes, so we have two banks in total void switchBank_GBA(byte bankNum) { // Output a HIGH signal on CS_ROM(PH3) WE_FLASH(PH5) and OE_FLASH(PH6) PORTH |= (1 << 3) | (1 << 5) | (1 << 6); // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set data pins to output DDRC = 0xFF; // Output a LOW signal on CE_FLASH(PH0) PORTH &= ~(1 << 0); // Switch bank command sequence writeByte_GBA(0x5555, 0xAA); writeByte_GBA(0x2AAA, 0x55); writeByte_GBA(0x5555, 0xB0); writeByte_GBA(0x0000, bankNum); // Set CS_FLASH(PH0) high PORTH |= (1 << 0); } void readFLASH_GBA (boolean browseFile, unsigned long flashSize, uint32_t pos) { // Output a HIGH signal on CS_ROM(PH3) WE_FLASH(PH5) PORTH |= (1 << 3) | (1 << 5); // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set address to 0 PORTF = 0x00; PORTK = 0x00; // Set data pins to input DDRC = 0x00; if (browseFile) { // Get name, add extension and convert to char array for sd lib strcpy(fileName, romName); strcat(fileName, ".fla"); // create a new folder for the save file EEPROM_readAnything(0, foldern); sprintf(folder, "GBA/SAVE/%s/%d", romName, foldern); sd.mkdir(folder, true); sd.chdir(folder); // Save location print_Msg(F("Saving to ")); print_Msg(folder); println_Msg(F("/...")); display_Update(); // write new folder number back to eeprom foldern = foldern + 1; EEPROM_writeAnything(0, foldern); } //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { print_Error(F("SD Error"), true); } // Seek to a new position in the file if (pos != 0) myFile.seekCur(pos); // Output a LOW signal on CE_FLASH(PH0) PORTH &= ~(1 << 0); // Output a LOW signal on OE_FLASH(PH6) PORTH &= ~(1 << 6); for (unsigned long currAddress = 0; currAddress < flashSize; currAddress += 512) { for (int c = 0; c < 512; c++) { // Read byte sdBuffer[c] = readByteFlash_GBA(currAddress + c); } // Write sdBuffer to file myFile.write(sdBuffer, 512); } myFile.close(); // Set CS_FLASH(PH0) high PORTH |= (1 << 0); // Signal end of process println_Msg(F("Done")); display_Update(); } void busyCheck_GBA(int currByte) { // Set data pins to input DDRC = 0x00; // Output a LOW signal on OE_FLASH(PH6) PORTH &= ~(1 << 6); // Read PINC while (PINC != sdBuffer[currByte]) {} // Output a HIGH signal on OE_FLASH(PH6) PORTH |= (1 << 6); // Set data pins to output DDRC = 0xFF; } void writeFLASH_GBA (boolean browseFile, unsigned long flashSize, uint32_t pos) { // Output a HIGH signal on CS_ROM(PH3) WE_FLASH(PH5) and OE_FLASH(PH6) PORTH |= (1 << 3) | (1 << 5) | (1 << 6); // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set data port to output DDRC = 0xFF; if (browseFile) { filePath[0] = '\0'; sd.chdir("/"); fileBrowser(F("Select fla file")); // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); display_Clear(); } print_Msg(F("Writing flash...")); display_Update(); //open file on sd card if (myFile.open(filePath, O_READ)) { // Seek to a new position in the file if (pos != 0) myFile.seekCur(pos); // Output a LOW signal on CE_FLASH(PH0) PORTH &= ~(1 << 0); for (unsigned long currAddress = 0; currAddress < flashSize; currAddress += 512) { //fill sdBuffer myFile.read(sdBuffer, 512); for (int c = 0; c < 512; c++) { // Write command sequence writeByteFlash_GBA(0x5555, 0xaa); writeByteFlash_GBA(0x2aaa, 0x55); writeByteFlash_GBA(0x5555, 0xa0); // Write current byte writeByteFlash_GBA(currAddress + c, sdBuffer[c]); // Wait busyCheck_GBA(c); } } // Set CS_FLASH(PH0) high PORTH |= (1 << 0); // Close the file: myFile.close(); println_Msg(F("done")); display_Update(); } else { println_Msg(F("Error")); print_Error(F("File doesnt exist"), false); } } // Check if the Flashrom was written without any error void verifyFLASH_GBA(unsigned long flashSize, uint32_t pos) { // Output a HIGH signal on CS_ROM(PH3) WE_FLASH(PH5) PORTH |= (1 << 3) | (1 << 5); // Set address ports to output DDRF = 0xFF; DDRK = 0xFF; // Set data pins to input DDRC = 0x00; // Output a LOW signal on CE_FLASH(PH0) and OE_FLASH(PH6) PORTH &= ~((1 << 0) | (1 << 6)); // Signal beginning of process print_Msg(F("Verify...")); display_Update(); unsigned long wrError = 0; //open file on sd card if (!myFile.open(filePath, O_READ)) { print_Error(F("SD Error"), true); } // Seek to a new position in the file if (pos != 0) myFile.seekCur(pos); for (unsigned long currAddress = 0; currAddress < flashSize; currAddress += 512) { myFile.read(sdBuffer, 512); for (int c = 0; c < 512; c++) { // Read byte if (sdBuffer[c] != readByteFlash_GBA(currAddress + c)) { wrError++; } } } myFile.close(); // Set CS_FLASH(PH0) high PORTH |= (1 << 0); if (wrError == 0) { println_Msg(F("OK")); } else { print_Msg(wrError); print_Error(F(" Errors"), false); } } /****************************************** GBA Eeprom SAVE Functions *****************************************/ // Write eeprom from file void writeEeprom_GBA(word eepSize) { // Launch Filebrowser filePath[0] = '\0'; sd.chdir("/"); fileBrowser(F("Select eep file")); // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); display_Clear(); print_Msg(F("Writing eeprom...")); display_Update(); //open file on sd card if (myFile.open(filePath, O_READ)) { for (word i = 0; i < eepSize * 16; i += 64) { // Fill romBuffer myFile.read(sdBuffer, 512); // Disable interrupts for more uniform clock pulses noInterrupts(); // Write 512 bytes writeBlock_EEP(i, eepSize); interrupts(); // Wait delayMicroseconds(200); } // Close the file: myFile.close(); println_Msg(F("done")); display_Update(); } else { println_Msg(F("Error")); print_Error(F("File doesnt exist"), false); } } // Read eeprom to file void readEeprom_GBA(word eepSize) { // Get name, add extension and convert to char array for sd lib strcpy(fileName, romName); strcat(fileName, ".eep"); // create a new folder for the save file EEPROM_readAnything(0, foldern); sprintf(folder, "GBA/SAVE/%s/%d", romName, foldern); sd.mkdir(folder, true); sd.chdir(folder); // Save location print_Msg(F("Saving to ")); print_Msg(folder); println_Msg(F("/...")); display_Update(); // write new folder number back to eeprom foldern = foldern + 1; EEPROM_writeAnything(0, foldern); //open file on sd card if (!myFile.open(fileName, O_RDWR | O_CREAT)) { print_Error(F("SD Error"), true); } // Each block contains 8 Bytes, so for a 8KB eeprom 1024 blocks need to be read for (word currAddress = 0; currAddress < eepSize * 16; currAddress += 64) { // Disable interrupts for more uniform clock pulses noInterrupts(); // Fill sd Buffer readBlock_EEP(currAddress, eepSize); interrupts(); // Write sdBuffer to file myFile.write(sdBuffer, 512); // Wait delayMicroseconds(200); } myFile.close(); } // Send address as bits to eeprom void send_GBA(word currAddr, word numBits) { for (word addrBit = numBits; addrBit > 0; addrBit--) { // If you want the k-th bit of n, then do // (n & ( 1 << k )) >> k if (((currAddr & ( 1 << (addrBit - 1))) >> (addrBit - 1))) { // Set A0(PF0) to High PORTF |= (1 << 0); // Set WR(PH5) to LOW PORTH &= ~ (1 << 5); // Set WR(PH5) to High PORTH |= (1 << 5); } else { // Set A0(PF0) to Low PORTF &= ~ (1 << 0); // Set WR(PH5) to LOW PORTH &= ~ (1 << 5); // Set WR(PH5) to High PORTH |= (1 << 5); } } } // Write 512K eeprom block void writeBlock_EEP(word startAddr, word eepSize) { // Setup // Set CS_ROM(PH3) WR(PH5) RD(PH6) to Output DDRH |= (1 << 3) | (1 << 5) | (1 << 6); // Set A0(PF0) to Output DDRF |= (1 << 0); // Set A23/D7(PC7) to Output DDRC |= (1 << 7); // Set CS_ROM(PH3) WR(PH5) RD(PH6) to High PORTH |= (1 << 3) | (1 << 5) | (1 << 6); // Set A0(PF0) to High PORTF |= (1 << 0); // Set A23/D7(PC7) to High PORTC |= (1 << 7); __asm__("nop\n\t""nop\n\t"); // Write 64*8=512 bytes for (word currAddr = startAddr; currAddr < startAddr + 64; currAddr++) { // Set CS_ROM(PH3) to LOW PORTH &= ~ (1 << 3); // Send write request "10" // Set A0(PF0) to High PORTF |= (1 << 0); // Set WR(PH5) to LOW PORTH &= ~ (1 << 5); // Set WR(PH5) to High PORTH |= (1 << 5); // Set A0(PF0) to LOW PORTF &= ~ (1 << 0); // Set WR(PH5) to LOW PORTH &= ~ (1 << 5); // Set WR(PH5) to High PORTH |= (1 << 5); // Send either 6 or 14 bit address if (eepSize == 4) { send_GBA(currAddr, 6); } else { send_GBA(currAddr, 14); } __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t"); // Send data for (byte currByte = 0; currByte < 8; currByte++) { send_GBA(sdBuffer[(currAddr - startAddr) * 8 + currByte], 8); } // Send stop bit // Set A0(PF0) to LOW PORTF &= ~ (1 << 0); // Set WR(PH5) to LOW PORTH &= ~ (1 << 5); // WR(PH5) to High PORTH |= (1 << 5); // Set CS_ROM(PH3) to High PORTH |= (1 << 3); // Wait until done // Set A0(PF0) to Input DDRF &= ~ (1 << 0); do { // Set CS_ROM(PH3) RD(PH6) to LOW PORTH &= ~((1 << 3) | (1 << 6)); // Set CS_ROM(PH3) RD(PH6) to High PORTH |= (1 << 3) | (1 << 6); } while ((PINF & 0x1) == 0); // Set A0(PF0) to Output DDRF |= (1 << 0); } } // Reads 512 bytes from eeprom void readBlock_EEP(word startAddress, word eepSize) { // Setup // Set CS_ROM(PH3) WR(PH5) RD(PH6) to Output DDRH |= (1 << 3) | (1 << 5) | (1 << 6); // Set A0(PF0) to Output DDRF |= (1 << 0); // Set A23/D7(PC7) to Output DDRC |= (1 << 7); // Set CS_ROM(PH3) WR(PH5) RD(PH6) to High PORTH |= (1 << 3) | (1 << 5) | (1 << 6); // Set A0(PF0) to High PORTF |= (1 << 0); // Set A23/D7(PC7) to High PORTC |= (1 << 7); __asm__("nop\n\t""nop\n\t"); // Read 64*8=512 bytes for (word currAddr = startAddress; currAddr < startAddress + 64; currAddr++) { // Set CS_ROM(PH3) to LOW PORTH &= ~ (1 << 3); // Send read request "11" // Set A0(PF0) to High PORTF |= (1 << 0); // Set WR(PH5) to LOW PORTH &= ~ (1 << 5); // Set WR(PH5) to High PORTH |= (1 << 5); // Set WR(PH5) to LOW PORTH &= ~ (1 << 5); // Set WR(PH5) to High PORTH |= (1 << 5); // Send either 6 or 14 bit address if (eepSize == 4) { send_GBA(currAddr, 6); } else { send_GBA(currAddr, 14); } // Send stop bit // Set A0(PF0) to LOW PORTF &= ~ (1 << 0); // Set WR(PH5) to LOW PORTH &= ~ (1 << 5); // WR(PH5) to High PORTH |= (1 << 5); // Set CS_ROM(PH3) to High PORTH |= (1 << 3); __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t"); // Read data // Set A0(PF0) to Input DDRF &= ~ (1 << 0); // Set CS_ROM(PH3) to low PORTH &= ~(1 << 3); // Array that holds the bits bool tempBits[65]; // Ignore the first 4 bits for (byte i = 0; i < 4; i++) { // Set RD(PH6) to LOW PORTH &= ~ (1 << 6); // Set RD(PH6) to High PORTH |= (1 << 6); } // Read the remaining 64bits into array for (byte currBit = 0; currBit < 64; currBit++) { // Set RD(PH6) to LOW PORTH &= ~ (1 << 6); // Set RD(PH6) to High PORTH |= (1 << 6); // Read bit from A0(PF0) tempBits[currBit] = (PINF & 0x1); } // Set CS_ROM(PH3) to High PORTH |= (1 << 3); // Set A0(PF0) to High PORTF |= (1 << 0); // Set A0(PF0) to Output DDRF |= (1 << 0); // OR 8 bits into one byte for a total of 8 bytes for (byte j = 0; j < 64; j += 8) { sdBuffer[((currAddr - startAddress) * 8) + (j / 8)] = tempBits[0 + j] << 7 | tempBits[1 + j] << 6 | tempBits[2 + j] << 5 | tempBits[3 + j] << 4 | tempBits[4 + j] << 3 | tempBits[5 + j] << 2 | tempBits[6 + j] << 1 | tempBits[7 + j]; } } } // Check if the SRAM was written without any error unsigned long verifyEEP_GBA(word eepSize) { unsigned long wrError = 0; //open file on sd card if (!myFile.open(filePath, O_READ)) { print_Error(F("SD Error"), true); } // Fill sd Buffer for (word currAddress = 0; currAddress < eepSize * 16; currAddress += 64) { // Disable interrupts for more uniform clock pulses noInterrupts(); readBlock_EEP(currAddress, eepSize); interrupts(); // Compare for (int currByte = 0; currByte < 512; currByte++) { if (sdBuffer[currByte] != myFile.read()) { wrError++; } } } myFile.close(); return wrError; } /****************************************** GBA REPRO Functions (32MB Intel 4000L0YBQ0 and 16MB MX29GL128E) *****************************************/ // Reset to read mode void resetIntel_GBA(unsigned long partitionSize) { for (unsigned long currPartition = 0; currPartition < cartSize; currPartition += partitionSize) { writeWord_GBA(currPartition, 0xFFFF); } } void resetMX29GL128E_GBA() { writeWord_GAB(0, 0xF0); } boolean sectorCheckMX29GL128E_GBA() { boolean sectorProtect = 0; writeWord_GAB(0xAAA, 0xAA); writeWord_GAB(0x555, 0x55); writeWord_GAB(0xAAA, 0x90); for (unsigned long currSector = 0x0; currSector < 0xFFFFFF; currSector += 0x20000) { if (readWord_GAB(currSector + 0x04) != 0x0) sectorProtect = 1; } resetMX29GL128E_GBA(); return sectorProtect; } void idFlashrom_GBA() { // Send Intel ID command to flashrom writeWord_GBA(0, 0x90); __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t"); // Read flashrom ID sprintf(flashid, "%02X%02X", ((readWord_GBA(0x2) >> 8) & 0xFF), (readWord_GBA(0x4) & 0xFF)); // Intel Strataflash if (strcmp(flashid, "8802") == 0 || (strcmp(flashid, "8816") == 0)) { cartSize = 0x2000000; } else { // Send swapped MX29GL128E/MSP55LV128 ID command to flashrom writeWord_GAB(0xAAA, 0xAA); writeWord_GAB(0x555, 0x55); writeWord_GAB(0xAAA, 0x90); __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t"); // Read flashrom ID sprintf(flashid, "%02X%02X", ((readWord_GAB(0x2) >> 8) & 0xFF), (readWord_GAB(0x2) & 0xFF)); // MX29GL128E or MSP55LV128 if (strcmp(flashid, "227E") == 0) { // MX is 0xC2 and MSP is 0x4 or 0x1 romType = (readWord_GAB(0x0) & 0xFF); cartSize = 0x1000000; resetMX29GL128E_GBA(); } else { println_Msg(flashid); print_Error(F("Unknown Flashid"), true); } } } boolean blankcheckFlashrom_GBA() { for (unsigned long currSector = 0; currSector < fileSize; currSector += 0x20000) { // Blink led PORTB ^= (1 << 4); for (unsigned long currByte = 0; currByte < 0x20000; currByte += 2) { if (readWord_GBA(currSector + currByte) != 0xFFFF) { return 0; } } } return 1; } void eraseIntel4000_GBA() { // If the game is smaller than 16Mbit only erase the needed blocks unsigned long lastBlock = 0xFFFFFF; if (fileSize < 0xFFFFFF) lastBlock = fileSize; // Erase 4 blocks with 16kwords each for (unsigned long currBlock = 0x0; currBlock < 0x1FFFF; currBlock += 0x8000) { // Unlock Block writeWord_GBA(currBlock, 0x60); writeWord_GBA(currBlock, 0xD0); // Erase Command writeWord_GBA(currBlock, 0x20); writeWord_GBA(currBlock, 0xD0); // Read the status register word statusReg = readWord_GBA(currBlock); while ((statusReg | 0xFF7F) != 0xFFFF) { statusReg = readWord_GBA(currBlock); } } // Erase 126 blocks with 64kwords each for (unsigned long currBlock = 0x20000; currBlock < lastBlock; currBlock += 0x1FFFF) { // Unlock Block writeWord_GBA(currBlock, 0x60); writeWord_GBA(currBlock, 0xD0); // Erase Command writeWord_GBA(currBlock, 0x20); writeWord_GBA(currBlock, 0xD0); // Read the status register word statusReg = readWord_GBA(currBlock); while ((statusReg | 0xFF7F) != 0xFFFF) { statusReg = readWord_GBA(currBlock); } // Blink led PORTB ^= (1 << 4); } // Erase the second chip if (fileSize > 0xFFFFFF) { // 126 blocks with 64kwords each for (unsigned long currBlock = 0x1000000; currBlock < 0x1FDFFFF; currBlock += 0x1FFFF) { // Unlock Block writeWord_GBA(currBlock, 0x60); writeWord_GBA(currBlock, 0xD0); // Erase Command writeWord_GBA(currBlock, 0x20); writeWord_GBA(currBlock, 0xD0); // Read the status register word statusReg = readWord_GBA(currBlock); while ((statusReg | 0xFF7F) != 0xFFFF) { statusReg = readWord_GBA(currBlock); } // Blink led PORTB ^= (1 << 4); } // 4 blocks with 16kword each for (unsigned long currBlock = 0x1FE0000; currBlock < 0x1FFFFFF; currBlock += 0x8000) { // Unlock Block writeWord_GBA(currBlock, 0x60); writeWord_GBA(currBlock, 0xD0); // Erase Command writeWord_GBA(currBlock, 0x20); writeWord_GBA(currBlock, 0xD0); // Read the status register word statusReg = readWord_GBA(currBlock); while ((statusReg | 0xFF7F) != 0xFFFF) { statusReg = readWord_GBA(currBlock); } // Blink led PORTB ^= (1 << 4); } } } void eraseIntel4400_GBA() { // If the game is smaller than 32Mbit only erase the needed blocks unsigned long lastBlock = 0x1FFFFFF; if (fileSize < 0x1FFFFFF) lastBlock = fileSize; // Erase 4 blocks with 16kwords each for (unsigned long currBlock = 0x0; currBlock < 0x1FFFF; currBlock += 0x8000) { // Unlock Block writeWord_GBA(currBlock, 0x60); writeWord_GBA(currBlock, 0xD0); // Erase Command writeWord_GBA(currBlock, 0x20); writeWord_GBA(currBlock, 0xD0); // Read the status register word statusReg = readWord_GBA(currBlock); while ((statusReg | 0xFF7F) != 0xFFFF) { statusReg = readWord_GBA(currBlock); } } // Erase 255 blocks with 64kwords each for (unsigned long currBlock = 0x20000; currBlock < lastBlock; currBlock += 0x1FFFF) { // Unlock Block writeWord_GBA(currBlock, 0x60); writeWord_GBA(currBlock, 0xD0); // Erase Command writeWord_GBA(currBlock, 0x20); writeWord_GBA(currBlock, 0xD0); // Read the status register word statusReg = readWord_GBA(currBlock); while ((statusReg | 0xFF7F) != 0xFFFF) { statusReg = readWord_GBA(currBlock); } // Blink led PORTB ^= (1 << 4); } /* No need to erase the second chip as max rom size is 32MB if (fileSize > 0x2000000) { // 255 blocks with 64kwords each for (unsigned long currBlock = 0x2000000; currBlock < 0x3FDFFFF; currBlock += 0x1FFFF) { // Unlock Block writeWord_GBA(currBlock, 0x60); writeWord_GBA(currBlock, 0xD0); // Erase Command writeWord_GBA(currBlock, 0x20); writeWord_GBA(currBlock, 0xD0); // Read the status register word statusReg = readWord_GBA(currBlock); while ((statusReg | 0xFF7F) != 0xFFFF) { statusReg = readWord_GBA(currBlock); } // Blink led PORTB ^= (1 << 4); } // 4 blocks with 16kword each for (unsigned long currBlock = 0x3FE0000; currBlock < 0x3FFFFFF; currBlock += 0x8000) { // Unlock Block writeWord_GBA(currBlock, 0x60); writeWord_GBA(currBlock, 0xD0); // Erase Command writeWord_GBA(currBlock, 0x20); writeWord_GBA(currBlock, 0xD0); // Read the status register word statusReg = readWord_GBA(currBlock); while ((statusReg | 0xFF7F) != 0xFFFF) { statusReg = readWord_GBA(currBlock); } // Blink led PORTB ^= (1 << 4); } }*/ } void sectorEraseMSP55LV128_GBA() { unsigned long lastSector = 0xFFFFFF; // Erase 256 sectors with 64kbytes each unsigned long currSector; for (currSector = 0x0; currSector < lastSector; currSector += 0x10000) { writeWord_GAB(0xAAA, 0xAA); writeWord_GAB(0x555, 0x55); writeWord_GAB(0xAAA, 0x80); writeWord_GAB(0xAAA, 0xAA); writeWord_GAB(0x555, 0x55); writeWord_GAB(currSector, 0x30); // Read the status register word statusReg = readWord_GAB(currSector); while ((statusReg | 0xFF7F) != 0xFFFF) { statusReg = readWord_GAB(currSector); } // Blink LED PORTB ^= (1 << 4); } } void sectorEraseMX29GL128E_GBA() { unsigned long lastSector = 0xFFFFFF; // Erase 128 sectors with 128kbytes each unsigned long currSector; for (currSector = 0x0; currSector < lastSector; currSector += 0x20000) { writeWord_GAB(0xAAA, 0xAA); writeWord_GAB(0x555, 0x55); writeWord_GAB(0xAAA, 0x80); writeWord_GAB(0xAAA, 0xAA); writeWord_GAB(0x555, 0x55); writeWord_GAB(currSector, 0x30); // Read the status register word statusReg = readWord_GAB(currSector); while ((statusReg | 0xFF7F) != 0xFFFF) { statusReg = readWord_GAB(currSector); } // Blink LED PORTB ^= (1 << 4); } } void writeIntel4000_GBA() { for (unsigned long currBlock = 0; currBlock < fileSize; currBlock += 0x20000) { // Blink led PORTB ^= (1 << 4); // Write to flashrom for (unsigned long currSdBuffer = 0; currSdBuffer < 0x20000; currSdBuffer += 512) { // Fill SD buffer myFile.read(sdBuffer, 512); // Write 32 words at a time for (int currWriteBuffer = 0; currWriteBuffer < 512; currWriteBuffer += 64) { // Unlock Block writeWord_GBA(currBlock + currSdBuffer + currWriteBuffer, 0x60); writeWord_GBA(currBlock + currSdBuffer + currWriteBuffer, 0xD0); // Buffered program command writeWord_GBA(currBlock + currSdBuffer + currWriteBuffer, 0xE8); // Check Status register word statusReg = readWord_GBA(currBlock + currSdBuffer + currWriteBuffer); while ((statusReg | 0xFF7F) != 0xFFFF) { statusReg = readWord_GBA(currBlock + currSdBuffer + currWriteBuffer); } // Write word count (minus 1) writeWord_GBA(currBlock + currSdBuffer + currWriteBuffer, 0x1F); // Write buffer for (byte currByte = 0; currByte < 64; currByte += 2) { // Join two bytes into one word word currWord = ( ( sdBuffer[currWriteBuffer + currByte + 1] & 0xFF ) << 8 ) | ( sdBuffer[currWriteBuffer + currByte] & 0xFF ); writeWord_GBA(currBlock + currSdBuffer + currWriteBuffer + currByte, currWord); } // Write Buffer to Flash writeWord_GBA(currBlock + currSdBuffer + currWriteBuffer + 62, 0xD0); // Read the status register at last written address statusReg = readWord_GBA(currBlock + currSdBuffer + currWriteBuffer + 62); while ((statusReg | 0xFF7F) != 0xFFFF) { statusReg = readWord_GBA(currBlock + currSdBuffer + currWriteBuffer + 62); } } } } } void writeMSP55LV128_GBA() { for (unsigned long currSector = 0; currSector < fileSize; currSector += 0x10000) { // Blink led PORTB ^= (1 << 4); // Write to flashrom for (unsigned long currSdBuffer = 0; currSdBuffer < 0x10000; currSdBuffer += 512) { // Fill SD buffer myFile.read(sdBuffer, 512); // Write 16 words at a time for (int currWriteBuffer = 0; currWriteBuffer < 512; currWriteBuffer += 32) { // Write Buffer command writeWord_GAB(0xAAA, 0xAA); writeWord_GAB(0x555, 0x55); writeWord_GAB(currSector, 0x25); // Write word count (minus 1) writeWord_GAB(currSector, 0xF); // Write buffer word currWord; for (byte currByte = 0; currByte < 32; currByte += 2) { // Join two bytes into one word currWord = ( ( sdBuffer[currWriteBuffer + currByte + 1] & 0xFF ) << 8 ) | ( sdBuffer[currWriteBuffer + currByte] & 0xFF ); writeWord_GBA(currSector + currSdBuffer + currWriteBuffer + currByte, currWord); } // Confirm write buffer writeWord_GAB(currSector, 0x29); // Read the status register word statusReg = readWord_GAB(currSector + currSdBuffer + currWriteBuffer + 30); while ((statusReg | 0xFF7F) != (currWord | 0xFF7F)) { statusReg = readWord_GAB(currSector + currSdBuffer + currWriteBuffer + 30); } } } } } void writeMX29GL128E_GBA() { for (unsigned long currSector = 0; currSector < fileSize; currSector += 0x20000) { // Blink led PORTB ^= (1 << 4); // Write to flashrom for (unsigned long currSdBuffer = 0; currSdBuffer < 0x20000; currSdBuffer += 512) { // Fill SD buffer myFile.read(sdBuffer, 512); // Write 32 words at a time for (int currWriteBuffer = 0; currWriteBuffer < 512; currWriteBuffer += 64) { // Write Buffer command writeWord_GAB(0xAAA, 0xAA); writeWord_GAB(0x555, 0x55); writeWord_GAB(currSector, 0x25); // Write word count (minus 1) writeWord_GAB(currSector, 0x1F); // Write buffer word currWord; for (byte currByte = 0; currByte < 64; currByte += 2) { // Join two bytes into one word currWord = ( ( sdBuffer[currWriteBuffer + currByte + 1] & 0xFF ) << 8 ) | ( sdBuffer[currWriteBuffer + currByte] & 0xFF ); writeWord_GBA(currSector + currSdBuffer + currWriteBuffer + currByte, currWord); } // Confirm write buffer writeWord_GAB(currSector, 0x29); // Read the status register word statusReg = readWord_GAB(currSector + currSdBuffer + currWriteBuffer + 62); while ((statusReg | 0xFF7F) != (currWord | 0xFF7F)) { statusReg = readWord_GAB(currSector + currSdBuffer + currWriteBuffer + 62); } } } } } boolean verifyFlashrom_GBA() { // Open file on sd card if (myFile.open(filePath, O_READ)) { writeErrors = 0; for (unsigned long currSector = 0; currSector < fileSize; currSector += 131072) { // Blink led PORTB ^= (1 << 4); for (unsigned long currSdBuffer = 0; currSdBuffer < 131072; currSdBuffer += 512) { // Fill SD buffer myFile.read(sdBuffer, 512); for (int currByte = 0; currByte < 512; currByte += 2) { // Join two bytes into one word word currWord = ( ( sdBuffer[currByte + 1] & 0xFF ) << 8 ) | ( sdBuffer[currByte] & 0xFF ); // Compare both if (readWord_GBA(currSector + currSdBuffer + currByte) != currWord) { writeErrors++; myFile.close(); return 0; } } } } // Close the file: myFile.close(); if (writeErrors == 0) { return 1; } else { return 0; } } else { print_Error(F("Can't open file"), true); return 9999; } } void flashRepro_GBA() { // Check flashrom ID's idFlashrom_GBA(); if ((strcmp(flashid, "8802") == 0) || (strcmp(flashid, "8816") == 0) || (strcmp(flashid, "227E") == 0)) { print_Msg(F("ID: ")); print_Msg(flashid); print_Msg(F(" Size: ")); print_Msg(cartSize / 0x100000); println_Msg(F("MB")); // MX29GL128E or MSP55LV128(N) if (strcmp(flashid, "227E") == 0) { // MX is 0xC2 and MSP55LV128 is 0x4 and MSP55LV128N 0x1 if (romType == 0xC2) { println_Msg(F("Macronix MX29GL128E")); } else if ((romType == 0x1) || (romType == 0x4)) { println_Msg(F("Fujitsu MSP55LV128N")); } else if ((romType == 0x89)) { println_Msg(F("Intel PC28F256M29")); } else if ((romType == 0x20)) { println_Msg(F("ST M29W128GH")); } else { print_Msg(F("romType: 0x")); println_Msg(romType, HEX); print_Error(F("Unknown manufacturer"), true); } } // Intel 4000L0YBQ0 else if (strcmp(flashid, "8802") == 0) { println_Msg(F("Intel 4000L0YBQ0")); } // Intel 4400L0ZDQ0 else if (strcmp(flashid, "8816") == 0) { println_Msg(F("Intel 4400L0ZDQ0")); } println_Msg(""); println_Msg(F("This will erase your")); println_Msg(F("Repro Cartridge.")); println_Msg(F("Please use 3.3V!")); println_Msg(""); println_Msg(F("Press Button")); display_Update(); wait(); // Launch file browser filePath[0] = '\0'; sd.chdir("/"); fileBrowser(F("Select gba file")); display_Clear(); display_Update(); // Create filepath sprintf(filePath, "%s/%s", filePath, fileName); // Open file on sd card if (myFile.open(filePath, O_READ)) { // Get rom size from file fileSize = myFile.fileSize(); print_Msg(F("File size: ")); print_Msg(fileSize / 0x100000); println_Msg(F("MB")); display_Update(); // Erase needed sectors if (strcmp(flashid, "8802") == 0) { println_Msg(F("Erasing...")); display_Update(); eraseIntel4000_GBA(); resetIntel_GBA(0x200000); } else if (strcmp(flashid, "8816") == 0) { println_Msg(F("Erasing...")); display_Update(); eraseIntel4400_GBA(); resetIntel_GBA(0x200000); } else if (strcmp(flashid, "227E") == 0) { //if (sectorCheckMX29GL128E_GBA()) { //print_Error(F("Sector Protected"), true); //} //else { println_Msg(F("Erasing...")); display_Update(); if ((romType == 0xC2) || (romType == 0x89) || (romType == 0x20)) { //MX29GL128E //PC28F256M29 (0x89) sectorEraseMX29GL128E_GBA(); } else if ((romType == 0x1) || (romType == 0x4)) { //MSP55LV128(N) sectorEraseMSP55LV128_GBA(); } //} } /* Skip blankcheck to save time print_Msg(F("Blankcheck...")); display_Update(); if (blankcheckFlashrom_GBA()) { println_Msg(F("OK")); */ //Write flashrom print_Msg(F("Writing ")); println_Msg(filePath); display_Update(); if ((strcmp(flashid, "8802") == 0) || (strcmp(flashid, "8816") == 0)) { writeIntel4000_GBA(); } else if (strcmp(flashid, "227E") == 0) { if ((romType == 0xC2) || (romType == 0x89) || (romType == 0x20)) { //MX29GL128E (0xC2) //PC28F256M29 (0x89) writeMX29GL128E_GBA(); } else if ((romType == 0x1) || (romType == 0x4)) { //MSP55LV128(N) writeMSP55LV128_GBA(); } } // Close the file: myFile.close(); // Verify print_Msg(F("Verifying...")); display_Update(); if (strcmp(flashid, "8802") == 0) { // Don't know the correct size so just take some guesses resetIntel_GBA(0x8000); delay(1000); resetIntel_GBA(0x100000); delay(1000); resetIntel_GBA(0x200000); delay(1000); } else if (strcmp(flashid, "8816") == 0) { resetIntel_GBA(0x200000); delay(1000); } else if (strcmp(flashid, "227E") == 0) { resetMX29GL128E_GBA(); delay(1000); } if (verifyFlashrom_GBA() == 1) { println_Msg(F("OK")); display_Update(); } else { print_Error(F("ERROR"), true); } /* Skipped blankcheck } else { print_Error(F("failed"), true); } */ } else { print_Error(F("Can't open file"), true); } } else { print_Msg(F("ID: ")); println_Msg(flashid); print_Error(F("Unknown Flash ID"), true); } } #endif //****************************************** // End of File //******************************************
{ "pile_set_name": "Github" }
/* * drivers/net/phy/cicada.c * * Driver for Cicada PHYs * * Author: Andy Fleming * * Copyright (c) 2004 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * */ #include <linux/kernel.h> #include <linux/string.h> #include <linux/errno.h> #include <linux/unistd.h> #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/skbuff.h> #include <linux/spinlock.h> #include <linux/mm.h> #include <linux/module.h> #include <linux/mii.h> #include <linux/ethtool.h> #include <linux/phy.h> #include <asm/io.h> #include <asm/irq.h> #include <asm/uaccess.h> /* Cicada Extended Control Register 1 */ #define MII_CIS8201_EXT_CON1 0x17 #define MII_CIS8201_EXTCON1_INIT 0x0000 /* Cicada Interrupt Mask Register */ #define MII_CIS8201_IMASK 0x19 #define MII_CIS8201_IMASK_IEN 0x8000 #define MII_CIS8201_IMASK_SPEED 0x4000 #define MII_CIS8201_IMASK_LINK 0x2000 #define MII_CIS8201_IMASK_DUPLEX 0x1000 #define MII_CIS8201_IMASK_MASK 0xf000 /* Cicada Interrupt Status Register */ #define MII_CIS8201_ISTAT 0x1a #define MII_CIS8201_ISTAT_STATUS 0x8000 #define MII_CIS8201_ISTAT_SPEED 0x4000 #define MII_CIS8201_ISTAT_LINK 0x2000 #define MII_CIS8201_ISTAT_DUPLEX 0x1000 /* Cicada Auxiliary Control/Status Register */ #define MII_CIS8201_AUX_CONSTAT 0x1c #define MII_CIS8201_AUXCONSTAT_INIT 0x0004 #define MII_CIS8201_AUXCONSTAT_DUPLEX 0x0020 #define MII_CIS8201_AUXCONSTAT_SPEED 0x0018 #define MII_CIS8201_AUXCONSTAT_GBIT 0x0010 #define MII_CIS8201_AUXCONSTAT_100 0x0008 MODULE_DESCRIPTION("Cicadia PHY driver"); MODULE_AUTHOR("Andy Fleming"); MODULE_LICENSE("GPL"); static int cis820x_config_init(struct phy_device *phydev) { int err; err = phy_write(phydev, MII_CIS8201_AUX_CONSTAT, MII_CIS8201_AUXCONSTAT_INIT); if (err < 0) return err; err = phy_write(phydev, MII_CIS8201_EXT_CON1, MII_CIS8201_EXTCON1_INIT); return err; } static int cis820x_ack_interrupt(struct phy_device *phydev) { int err = phy_read(phydev, MII_CIS8201_ISTAT); return (err < 0) ? err : 0; } static int cis820x_config_intr(struct phy_device *phydev) { int err; if(phydev->interrupts == PHY_INTERRUPT_ENABLED) err = phy_write(phydev, MII_CIS8201_IMASK, MII_CIS8201_IMASK_MASK); else err = phy_write(phydev, MII_CIS8201_IMASK, 0); return err; } /* Cicada 8201, a.k.a Vitesse VSC8201 */ static struct phy_driver cis8201_driver = { .phy_id = 0x000fc410, .name = "Cicada Cis8201", .phy_id_mask = 0x000ffff0, .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = &cis820x_config_init, .config_aneg = &genphy_config_aneg, .read_status = &genphy_read_status, .ack_interrupt = &cis820x_ack_interrupt, .config_intr = &cis820x_config_intr, .driver = { .owner = THIS_MODULE,}, }; /* Cicada 8204 */ static struct phy_driver cis8204_driver = { .phy_id = 0x000fc440, .name = "Cicada Cis8204", .phy_id_mask = 0x000fffc0, .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = &cis820x_config_init, .config_aneg = &genphy_config_aneg, .read_status = &genphy_read_status, .ack_interrupt = &cis820x_ack_interrupt, .config_intr = &cis820x_config_intr, .driver = { .owner = THIS_MODULE,}, }; static int __init cicada_init(void) { int ret; ret = phy_driver_register(&cis8204_driver); if (ret) goto err1; ret = phy_driver_register(&cis8201_driver); if (ret) goto err2; return 0; err2: phy_driver_unregister(&cis8204_driver); err1: return ret; } static void __exit cicada_exit(void) { phy_driver_unregister(&cis8204_driver); phy_driver_unregister(&cis8201_driver); } module_init(cicada_init); module_exit(cicada_exit); static struct mdio_device_id cicada_tbl[] = { { 0x000fc410, 0x000ffff0 }, { 0x000fc440, 0x000fffc0 }, { } }; MODULE_DEVICE_TABLE(mdio, cicada_tbl);
{ "pile_set_name": "Github" }
# assert-plus This library is a super small wrapper over node's assert module that has two things: (1) the ability to disable assertions with the environment variable NODE\_NDEBUG, and (2) some API wrappers for argument testing. Like `assert.string(myArg, 'myArg')`. As a simple example, most of my code looks like this: ```javascript var assert = require('assert-plus'); function fooAccount(options, callback) { assert.object(options, 'options'); assert.number(options.id, 'options.id'); assert.bool(options.isManager, 'options.isManager'); assert.string(options.name, 'options.name'); assert.arrayOfString(options.email, 'options.email'); assert.func(callback, 'callback'); // Do stuff callback(null, {}); } ``` # API All methods that *aren't* part of node's core assert API are simply assumed to take an argument, and then a string 'name' that's not a message; `AssertionError` will be thrown if the assertion fails with a message like: AssertionError: foo (string) is required at test (/home/mark/work/foo/foo.js:3:9) at Object.<anonymous> (/home/mark/work/foo/foo.js:15:1) at Module._compile (module.js:446:26) at Object..js (module.js:464:10) at Module.load (module.js:353:31) at Function._load (module.js:311:12) at Array.0 (module.js:484:10) at EventEmitter._tickCallback (node.js:190:38) from: ```javascript function test(foo) { assert.string(foo, 'foo'); } ``` There you go. You can check that arrays are of a homogeneous type with `Arrayof$Type`: ```javascript function test(foo) { assert.arrayOfString(foo, 'foo'); } ``` You can assert IFF an argument is not `undefined` (i.e., an optional arg): ```javascript assert.optionalString(foo, 'foo'); ``` Lastly, you can opt-out of assertion checking altogether by setting the environment variable `NODE_NDEBUG=1`. This is pseudo-useful if you have lots of assertions, and don't want to pay `typeof ()` taxes to v8 in production. Be advised: The standard functions re-exported from `assert` are also disabled in assert-plus if NDEBUG is specified. Using them directly from the `assert` module avoids this behavior. The complete list of APIs is: * assert.array * assert.bool * assert.buffer * assert.func * assert.number * assert.finite * assert.object * assert.string * assert.stream * assert.date * assert.regexp * assert.uuid * assert.arrayOfArray * assert.arrayOfBool * assert.arrayOfBuffer * assert.arrayOfFunc * assert.arrayOfNumber * assert.arrayOfFinite * assert.arrayOfObject * assert.arrayOfString * assert.arrayOfStream * assert.arrayOfDate * assert.arrayOfRegexp * assert.arrayOfUuid * assert.optionalArray * assert.optionalBool * assert.optionalBuffer * assert.optionalFunc * assert.optionalNumber * assert.optionalFinite * assert.optionalObject * assert.optionalString * assert.optionalStream * assert.optionalDate * assert.optionalRegexp * assert.optionalUuid * assert.optionalArrayOfArray * assert.optionalArrayOfBool * assert.optionalArrayOfBuffer * assert.optionalArrayOfFunc * assert.optionalArrayOfNumber * assert.optionalArrayOfFinite * assert.optionalArrayOfObject * assert.optionalArrayOfString * assert.optionalArrayOfStream * assert.optionalArrayOfDate * assert.optionalArrayOfRegexp * assert.optionalArrayOfUuid * assert.AssertionError * assert.fail * assert.ok * assert.equal * assert.notEqual * assert.deepEqual * assert.notDeepEqual * assert.strictEqual * assert.notStrictEqual * assert.throws * assert.doesNotThrow * assert.ifError # Installation npm install assert-plus ## License The MIT License (MIT) Copyright (c) 2012 Mark Cavage 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. ## Bugs See <https://github.com/mcavage/node-assert-plus/issues>.
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?><topic xmlns="http://wsdev.schemas.microsoft.com/authoring/2008/2"> <whitepaper_page><metadata id="56af3158-3d98-46c4-944c-cf3b3fcc2536" build_format="rfc" section_number="43.124"><title>Attribute msDS-USNLastSyncSuccess</title> <tech value="protocol" /> <index /></metadata> <section><section_contents><p>This attribute specifies the USN at which the last successful replication synchronization occurred.</p> <example><snippet>cn: ms-DS-USN-Last-Sync-Success ldapDisplayName: msDS-USNLastSyncSuccess attributeId: 1.2.840.113556.1.4.2055 attributeSyntax: 2.5.5.16 omSyntax: 65 isSingleValued: TRUE schemaIdGuid: 31f7b8b6-c9f8-4f2d-a37b-58a823030331 systemOnly: FALSE searchFlags: 0 systemFlags: FLAG_SCHEMA_BASE_OBJECT | FLAG_ATTR_NOT_REPLICATED | FLAG_ATTR_IS_OPERATIONAL</snippet></example> <p>Version-Specific Behavior: Implemented on <auto_text>windows_server_2008_r2</auto_text>, <auto_text>ad_lds_windows_7</auto_text>, <auto_text>windows_server_8</auto_text>, <auto_text>ad_lds_windows_8</auto_text>, <auto_text>winblue_server_1</auto_text>, and <auto_text>ad_lds_winblue</auto_text>.</p></section_contents></section></whitepaper_page> </topic><!--**END DO NOT MODIFY THIS SECTION**--><?PROP fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" name="Server" value="10.185.184.7"?><?PROP fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="4" name="Project" value="MS-ADLS"?><?PROP fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="6" name="TopicTitle" value="Attribute msDS-USNLastSyncSuccess [_rfc_ms-adls_attribute_msds-usnlastsyncsuccess]"?><?PROP fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="8" name="Schema" value="Protocol"?><?PROP fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="10" name="CustomField2" value=""?><?PROP fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="12" name="DocumentVersion" value="2.0"?>
{ "pile_set_name": "Github" }
<?php declare(strict_types=1); /** * This file is part of Hyperf. * * @link https://www.hyperf.io * @document https://hyperf.wiki * @contact group@hyperf.io * @license https://github.com/hyperf/hyperf/blob/master/LICENSE */ namespace Hyperf\Consul; interface HealthInterface { public function node($node, array $options = []): ConsulResponse; public function checks($service, array $options = []): ConsulResponse; public function service($service, array $options = []): ConsulResponse; public function state($state, array $options = []): ConsulResponse; }
{ "pile_set_name": "Github" }
/* Copyright 2014 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 algorithm import ( "k8s.io/api/core/v1" schedulerapi "k8s.io/kubernetes/pkg/scheduler/api" schedulercache "k8s.io/kubernetes/pkg/scheduler/cache" ) // SchedulerExtender is an interface for external processes to influence scheduling // decisions made by Kubernetes. This is typically needed for resources not directly // managed by Kubernetes. type SchedulerExtender interface { // Name returns a unique name that identifies the extender. Name() string // Filter based on extender-implemented predicate functions. The filtered list is // expected to be a subset of the supplied list. failedNodesMap optionally contains // the list of failed nodes and failure reasons. Filter(pod *v1.Pod, nodes []*v1.Node, nodeNameToInfo map[string]*schedulercache.NodeInfo, ) (filteredNodes []*v1.Node, failedNodesMap schedulerapi.FailedNodesMap, err error) // Prioritize based on extender-implemented priority functions. The returned scores & weight // are used to compute the weighted score for an extender. The weighted scores are added to // the scores computed by Kubernetes scheduler. The total scores are used to do the host selection. Prioritize(pod *v1.Pod, nodes []*v1.Node) (hostPriorities *schedulerapi.HostPriorityList, weight int, err error) // Bind delegates the action of binding a pod to a node to the extender. Bind(binding *v1.Binding) error // IsBinder returns whether this extender is configured for the Bind method. IsBinder() bool // IsInterested returns true if at least one extended resource requested by // this pod is managed by this extender. IsInterested(pod *v1.Pod) bool // ProcessPreemption returns nodes with their victim pods processed by extender based on // given: // 1. Pod to schedule // 2. Candidate nodes and victim pods (nodeToVictims) generated by previous scheduling process. // 3. nodeNameToInfo to restore v1.Node from node name if extender cache is enabled. // The possible changes made by extender may include: // 1. Subset of given candidate nodes after preemption phase of extender. // 2. A different set of victim pod for every given candidate node after preemption phase of extender. ProcessPreemption( pod *v1.Pod, nodeToVictims map[*v1.Node]*schedulerapi.Victims, nodeNameToInfo map[string]*schedulercache.NodeInfo, ) (map[*v1.Node]*schedulerapi.Victims, error) // SupportsPreemption returns if the scheduler extender support preemption or not. SupportsPreemption() bool // IsIgnorable returns true indicates scheduling should not fail when this extender // is unavailable. This gives scheduler ability to fail fast and tolerate non-critical extenders as well. IsIgnorable() bool } // ScheduleAlgorithm is an interface implemented by things that know how to schedule pods // onto machines. type ScheduleAlgorithm interface { Schedule(*v1.Pod, NodeLister) (selectedMachine string, err error) // Preempt receives scheduling errors for a pod and tries to create room for // the pod by preempting lower priority pods if possible. // It returns the node where preemption happened, a list of preempted pods, a // list of pods whose nominated node name should be removed, and error if any. Preempt(*v1.Pod, NodeLister, error) (selectedNode *v1.Node, preemptedPods []*v1.Pod, cleanupNominatedPods []*v1.Pod, err error) // Predicates() returns a pointer to a map of predicate functions. This is // exposed for testing. Predicates() map[string]FitPredicate // Prioritizers returns a slice of priority config. This is exposed for // testing. Prioritizers() []PriorityConfig }
{ "pile_set_name": "Github" }
package treap import ( "fmt" "math/rand" "testing" ) func init() { // so that every run is the same seq of rand numbers rand.Seed(0) } func StringLess(p, q interface{}) bool { return p.(string) < q.(string) } func IntLess(p, q interface{}) bool { return p.(int) < q.(int) } func TestEmpty(t *testing.T) { tree := NewTree(StringLess) if tree.Len() != 0 { t.Errorf("expected tree len 0") } x := tree.Get("asdf") if x != nil { t.Errorf("expected nil for nonexistent key") } } func TestInsert(t *testing.T) { tree := NewTree(StringLess) tree.Insert("xyz", "adsf") x := tree.Get("xyz") if x != "adsf" { t.Errorf("expected adsf, got %v", x) } } func TestFromDoc(t *testing.T) { tree := NewTree(IntLess) tree.Insert(5, "a") tree.Insert(7, "b") x := tree.Get(5) if x != "a" { t.Errorf("expected a, got %v", x) } x = tree.Get(7) if x != "b" { t.Errorf("expected b, got %v", x) } tree.Insert(2, "c") x = tree.Get(2) if x != "c" { t.Errorf("exepcted c, got %v", x) } tree.Insert(2, "d") x = tree.Get(2) if x != "d" { t.Errorf("exepcted d, got %v", x) } tree.Delete(5) if tree.Exists(5) { t.Errorf("expected 5 to be removed from tree") } } func TestBalance(t *testing.T) { tree := NewTree(IntLess) for i := 0; i < 1000; i++ { tree.Insert(i, false) } for i := 0; i < 1000; i += 50 { fmt.Printf("%d: height = %d\n", i, tree.Height(i)) } } // tests copied from petar's llrb func TestCases(t *testing.T) { tree := NewTree(IntLess) tree.Insert(1, true) tree.Insert(1, false) if tree.Len() != 1 { t.Errorf("expecting len 1") } if !tree.Exists(1) { t.Errorf("expecting to find key=1") } tree.Delete(1) if tree.Len() != 0 { t.Errorf("expecting len 0") } if tree.Exists(1) { t.Errorf("not expecting to find key=1") } tree.Delete(1) if tree.Len() != 0 { t.Errorf("expecting len 0") } if tree.Exists(1) { t.Errorf("not expecting to find key=1") } } func TestReverseInsertOrder(t *testing.T) { tree := NewTree(IntLess) n := 100 for i := 0; i < n; i++ { tree.Insert(n-i, true) } c := tree.IterKeysAscend() for j, item := 1, <-c; item != nil; j, item = j+1, <-c { if item.(int) != j { t.Fatalf("bad order") } } } func TestIterateOverlapNoFunc(t *testing.T) { tree := NewTree(IntLess) n := 100 for i := 0; i < n; i++ { tree.Insert(n-i, true) } for v := range tree.IterateOverlap(50) { t.Errorf("didn't expect to have any overlap since fn not defined: %v", v) } } type BucketKey struct { Start int64 Duration int64 } type BucketVal struct { Start int64 Duration int64 Value float64 } func BucketLess(a, b interface{}) bool { aa := a.(*BucketKey) bb := b.(*BucketKey) if aa.Start < bb.Start { return true } if aa.Start == bb.Start { return aa.Duration < bb.Duration } return false } func BucketOverlap(a, b interface{}) bool { aa := a.(*BucketKey) bb := b.(*BucketKey) return aa.Start+aa.Duration < bb.Start } func TestIterateOverlap(t *testing.T) { tree := NewOverlapTree(BucketLess, BucketOverlap) tree.Insert(&BucketKey{100, 10}, &BucketVal{100, 10, 5.0}) tree.Insert(&BucketKey{110, 10}, &BucketVal{110, 10, 6.0}) tree.Insert(&BucketKey{120, 10}, &BucketVal{120, 10, 7.0}) tree.Insert(&BucketKey{130, 10}, &BucketVal{130, 10, 8.0}) for v := range tree.IterateOverlap(&BucketKey{105, 7}) { fmt.Printf("val: %v\n", v) } } /* before: after: A B / \ / \ B C D A / \ / \ / \ D E F G E C / \ F G */ func TestLeftRotate(t *testing.T) { // create a tree by hand... a := newNode("a", "a", 1) b := newNode("b", "b", 2) c := newNode("c", "c", 3) d := newNode("d", "d", 4) e := newNode("e", "e", 5) f := newNode("f", "g", 5) g := newNode("g", "g", 5) a.left = b a.right = c b.left = d b.right = e c.left = f c.right = g x := new(Tree) root := x.leftRotate(a) if root != b { t.Errorf("expected root to be b") } if root.left != d { t.Errorf("expected root.left to be d") } if root.right != a { t.Errorf("expected root.right to be a") } if a.left != e { t.Errorf("expected a.left to be e") } if a.right != c { t.Errorf("expected a.right to be c") } if c.left != f { t.Errorf("expected c.left to be f") } if c.right != g { t.Errorf("expected c.right to be g") } } /* before: after: A C / \ / \ B C A G / \ / \ / \ D E F G B F / \ D E */ func TestRightRotate(t *testing.T) { // create a tree by hand... a := newNode("a", "a", 1) b := newNode("b", "b", 2) c := newNode("c", "c", 3) d := newNode("d", "d", 4) e := newNode("e", "e", 5) f := newNode("f", "g", 5) g := newNode("g", "g", 5) a.left = b a.right = c b.left = d b.right = e c.left = f c.right = g x := new(Tree) root := x.rightRotate(a) if root != c { t.Errorf("expected root to be c") } if root.left != a { t.Errorf("expected root.left to be a") } if root.right != g { t.Errorf("expected root.right to be g") } if a.left != b { t.Errorf("expected a.left to be b") } if a.right != f { t.Errorf("expected a.right to be f") } if b.left != d { t.Errorf("expected b.left to be d") } if b.right != e { t.Errorf("expected b.right to be e") } } func treeOfInts(ints []int) (tree *Tree) { tree = NewTree(IntLess) for _, i := range ints { tree.Insert(i, i) } return } func BenchmarkInsert(b *testing.B) { b.StopTimer() ints := rand.Perm(b.N) b.StartTimer() _ = treeOfInts(ints) } func BenchmarkDelete(b *testing.B) { b.StopTimer() ints := rand.Perm(b.N) tree := treeOfInts(ints) b.StartTimer() for i := 0; i < b.N; i++ { tree.Delete(i) } } func BenchmarkLookup(b *testing.B) { b.StopTimer() ints := rand.Perm(b.N) tree := treeOfInts(ints) b.StartTimer() for j := 0; j < 10; j++ { for i := 0; i < len(ints)/10; i++ { _ = tree.Exists(ints[i]) } } }
{ "pile_set_name": "Github" }
import Flutter import UIKit public class SwiftLightPlugin: NSObject, FlutterPlugin { public static func register(with registrar: FlutterPluginRegistrar) { let channel = FlutterMethodChannel(name: "light", binaryMessenger: registrar.messenger()) let instance = SwiftLightPlugin() registrar.addMethodCallDelegate(instance, channel: channel) } public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { result("iOS " + UIDevice.current.systemVersion) } }
{ "pile_set_name": "Github" }
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. // Package autoscaling provides the client and types for making API // requests to Auto Scaling. // // Auto Scaling is designed to automatically launch or terminate EC2 instances // based on user-defined policies, schedules, and health checks. Use this service // in conjunction with the Amazon CloudWatch and Elastic Load Balancing services. // // See https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01 for more information on this service. // // See autoscaling package documentation for more information. // https://docs.aws.amazon.com/sdk-for-go/api/service/autoscaling/ // // Using the Client // // To Auto Scaling with the SDK use the New function to create // a new service client. With that client you can make API requests to the service. // These clients are safe to use concurrently. // // See the SDK's documentation for more information on how to use the SDK. // https://docs.aws.amazon.com/sdk-for-go/api/ // // See aws.Config documentation for more information on configuring SDK clients. // https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config // // See the Auto Scaling client AutoScaling for more // information on creating client for this service. // https://docs.aws.amazon.com/sdk-for-go/api/service/autoscaling/#New package autoscaling
{ "pile_set_name": "Github" }
//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ //=============================================================================// #include "cbase.h" #include "env_headcrabcanister_shared.h" #include "mapdata_shared.h" #include "sharedInterface.h" #include "mathlib/vmatrix.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" #define ROTATION_SPEED 90.0f BEGIN_SIMPLE_DATADESC( CEnvHeadcrabCanisterShared ) DEFINE_FIELD( m_vecStartPosition, FIELD_POSITION_VECTOR ), DEFINE_FIELD( m_vecEnterWorldPosition, FIELD_POSITION_VECTOR ), DEFINE_FIELD( m_vecDirection, FIELD_VECTOR ), DEFINE_FIELD( m_vecStartAngles, FIELD_VECTOR ), DEFINE_KEYFIELD( m_flLaunchHeight, FIELD_FLOAT, "StartingHeight" ), DEFINE_KEYFIELD( m_flFlightSpeed, FIELD_FLOAT, "FlightSpeed" ), DEFINE_KEYFIELD( m_flFlightTime, FIELD_FLOAT, "FlightTime" ), DEFINE_FIELD( m_flLaunchTime, FIELD_TIME ), DEFINE_FIELD( m_flWorldEnterTime, FIELD_FLOAT ), DEFINE_FIELD( m_flInitialZSpeed, FIELD_FLOAT ), DEFINE_FIELD( m_flZAcceleration, FIELD_FLOAT ), DEFINE_FIELD( m_flHorizSpeed, FIELD_FLOAT ), DEFINE_FIELD( m_bLaunchedFromWithinWorld, FIELD_BOOLEAN ), DEFINE_FIELD( m_vecSkyboxOrigin, FIELD_VECTOR ), DEFINE_FIELD( m_vecParabolaDirection, FIELD_VECTOR ), DEFINE_FIELD( m_flSkyboxScale, FIELD_FLOAT ), DEFINE_FIELD( m_bInSkybox, FIELD_BOOLEAN ), END_DATADESC() BEGIN_NETWORK_TABLE_NOBASE( CEnvHeadcrabCanisterShared, DT_EnvHeadcrabCanisterShared ) #if !defined( CLIENT_DLL ) SendPropFloat ( SENDINFO( m_flFlightSpeed ), 0, SPROP_NOSCALE ), SendPropTime ( SENDINFO( m_flLaunchTime ) ), SendPropVector ( SENDINFO( m_vecParabolaDirection ), 0, SPROP_NOSCALE ), SendPropFloat ( SENDINFO( m_flFlightTime ), 0, SPROP_NOSCALE ), SendPropFloat ( SENDINFO( m_flWorldEnterTime ), 0, SPROP_NOSCALE ), SendPropFloat ( SENDINFO( m_flInitialZSpeed ), 0, SPROP_NOSCALE ), SendPropFloat ( SENDINFO( m_flZAcceleration ), 0, SPROP_NOSCALE ), SendPropFloat ( SENDINFO( m_flHorizSpeed ), 0, SPROP_NOSCALE ), SendPropBool ( SENDINFO( m_bLaunchedFromWithinWorld ) ), SendPropVector ( SENDINFO( m_vecStartPosition ), 0, SPROP_NOSCALE ), SendPropVector ( SENDINFO( m_vecEnterWorldPosition ), 0, SPROP_NOSCALE ), SendPropVector ( SENDINFO( m_vecDirection ), 0, SPROP_NOSCALE ), SendPropVector ( SENDINFO( m_vecStartAngles ), 0, SPROP_NOSCALE ), SendPropVector ( SENDINFO( m_vecSkyboxOrigin ), 0, SPROP_NOSCALE ), SendPropFloat ( SENDINFO( m_flSkyboxScale ), 0, SPROP_NOSCALE ), SendPropBool ( SENDINFO( m_bInSkybox ) ), #else RecvPropFloat ( RECVINFO( m_flFlightSpeed ) ), RecvPropTime ( RECVINFO( m_flLaunchTime ) ), RecvPropVector ( RECVINFO( m_vecParabolaDirection ) ), RecvPropFloat ( RECVINFO( m_flFlightTime ) ), RecvPropFloat ( RECVINFO( m_flWorldEnterTime ) ), RecvPropFloat ( RECVINFO( m_flInitialZSpeed ) ), RecvPropFloat ( RECVINFO( m_flZAcceleration ) ), RecvPropFloat ( RECVINFO( m_flHorizSpeed ) ), RecvPropBool ( RECVINFO( m_bLaunchedFromWithinWorld ) ), RecvPropVector ( RECVINFO( m_vecStartPosition ) ), RecvPropVector ( RECVINFO( m_vecEnterWorldPosition ) ), RecvPropVector ( RECVINFO( m_vecDirection ) ), RecvPropVector ( RECVINFO( m_vecStartAngles ) ), RecvPropVector ( RECVINFO( m_vecSkyboxOrigin ) ), RecvPropFloat ( RECVINFO( m_flSkyboxScale ) ), RecvPropBool ( RECVINFO( m_bInSkybox ) ), #endif END_NETWORK_TABLE() //============================================================================= // // HeadcrabCanister Functions. // //----------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------- CEnvHeadcrabCanisterShared::CEnvHeadcrabCanisterShared() { m_vecStartPosition.Init(); m_vecDirection.Init(); m_flFlightSpeed = 0.0f; // This tells the client DLL to not draw trails, etc. m_flLaunchTime = -1.0f; m_flWorldEnterTime = 0.0f; m_flFlightTime = 0.0f; m_bInSkybox = false; } //----------------------------------------------------------------------------- // Creates a headcrab canister in the world //----------------------------------------------------------------------------- void CEnvHeadcrabCanisterShared::InitInWorld( float flLaunchTime, const Vector &vecStartPosition, const QAngle &vecStartAngles, const Vector &vecDirection, const Vector &vecImpactPosition, bool bLaunchedFromWithinWorld ) { Vector vecActualStartPosition = vecStartPosition; if ( !bLaunchedFromWithinWorld ) { // Move the start position inward if it's too close Vector vecDelta; VectorSubtract( vecStartPosition, vecImpactPosition, vecDelta ); VectorNormalize( vecDelta ); VectorMA( vecImpactPosition, m_flFlightTime * m_flFlightSpeed, vecDelta, vecActualStartPosition ); } // Setup initial parametric state. m_flLaunchTime = flLaunchTime; m_vecStartPosition = vecActualStartPosition; m_vecEnterWorldPosition = vecActualStartPosition; m_vecDirection = vecDirection; m_vecStartAngles = vecStartAngles; m_flWorldEnterTime = 0.0f; m_bInSkybox = false; m_bLaunchedFromWithinWorld = bLaunchedFromWithinWorld; if ( m_bLaunchedFromWithinWorld ) { m_flSkyboxScale = 1; m_vecSkyboxOrigin = vec3_origin; float flLength = m_vecDirection.Get().AsVector2D().Length(); VectorSubtract(vecImpactPosition, vecStartPosition, m_vecParabolaDirection.GetForModify()); m_vecParabolaDirection.GetForModify().z = 0; float flTotalDistance = VectorNormalize( m_vecParabolaDirection.GetForModify() ); m_vecDirection.GetForModify().x = flLength * m_vecParabolaDirection.Get().x; m_vecDirection.GetForModify().y = flLength * m_vecParabolaDirection.Get().y; m_flHorizSpeed = flTotalDistance / m_flFlightTime; m_flWorldEnterTime = 0; float flFinalZSpeed = m_vecDirection.Get().z * m_flHorizSpeed; m_flFlightSpeed = sqrt( m_flHorizSpeed * m_flHorizSpeed + flFinalZSpeed * flFinalZSpeed ); m_flInitialZSpeed = (2.0f * ( vecImpactPosition.z - vecStartPosition.z ) - flFinalZSpeed * m_flFlightTime) / m_flFlightTime; m_flZAcceleration = (flFinalZSpeed - m_flInitialZSpeed) / m_flFlightTime; } } //----------------------------------------------------------------------------- // Creates a headcrab canister in the skybox //----------------------------------------------------------------------------- void CEnvHeadcrabCanisterShared::InitInSkybox( float flLaunchTime, const Vector &vecStartPosition, const QAngle &vecStartAngles, const Vector &vecDirection, const Vector &vecImpactPosition, const Vector &vecSkyboxOrigin, float flSkyboxScale ) { // Compute a horizontal speed (constant) m_vecParabolaDirection.Init( vecDirection.x, vecDirection.y, 0.0f ); float flLength = VectorNormalize( m_vecParabolaDirection.GetForModify() ); m_flHorizSpeed = flLength * m_flFlightSpeed; // compute total distance to travel float flTotalDistance = m_flFlightTime * m_flHorizSpeed; flTotalDistance -= vecStartPosition.AsVector2D().DistTo( vecImpactPosition.AsVector2D() ); if ( flTotalDistance <= 0.0f ) { InitInWorld( flLaunchTime, vecStartPosition, vecStartAngles, vecDirection, vecImpactPosition ); return; } // Setup initial parametric state. m_flLaunchTime = flLaunchTime; m_flWorldEnterTime = flTotalDistance / m_flHorizSpeed; m_vecSkyboxOrigin = vecSkyboxOrigin; m_flSkyboxScale = flSkyboxScale; m_vecEnterWorldPosition = vecStartPosition; m_vecDirection = vecDirection; m_vecStartAngles = vecStartAngles; m_bInSkybox = true; m_bLaunchedFromWithinWorld = false; // Compute parabolic course // Assume the x velocity remains constant. // Z moves ballistically, as if under gravity // zf + lh = zo // vf = vo + a*t // zf = zo + vo*t + 0.5 * a * t*t // a*t = vf - vo // zf = zo + vo*t + 0.5f * (vf - vo) * t // zf - zo = 0.5f *vo*t + 0.5f * vf * t // -lh - 0.5f * vf * t = 0.5f * vo * t // vo = -2.0f * lh / t - vf // a = (vf - vo) / t m_flHorizSpeed /= flSkyboxScale; VectorMA( vecSkyboxOrigin, 1.0f / m_flSkyboxScale, vecStartPosition, m_vecStartPosition.GetForModify() ); VectorMA( m_vecStartPosition.Get(), -m_flHorizSpeed * m_flWorldEnterTime, m_vecParabolaDirection, m_vecStartPosition.GetForModify() ); float flLaunchHeight = m_flLaunchHeight / flSkyboxScale; float flFinalZSpeed = m_vecDirection.Get().z * m_flFlightSpeed / flSkyboxScale; m_vecStartPosition.GetForModify().z += flLaunchHeight; m_flZAcceleration = 2.0f * ( flLaunchHeight + flFinalZSpeed * m_flWorldEnterTime ) / ( m_flWorldEnterTime * m_flWorldEnterTime ); m_flInitialZSpeed = flFinalZSpeed - m_flZAcceleration * m_flWorldEnterTime; } //----------------------------------------------------------------------------- // Convert from skybox to world //----------------------------------------------------------------------------- void CEnvHeadcrabCanisterShared::ConvertFromSkyboxToWorld() { Assert( m_bInSkybox ); m_bInSkybox = false; } //----------------------------------------------------------------------------- // Returns the time at which it enters the world //----------------------------------------------------------------------------- float CEnvHeadcrabCanisterShared::GetEnterWorldTime() const { return m_flWorldEnterTime; } //----------------------------------------------------------------------------- // Did we impact? //----------------------------------------------------------------------------- bool CEnvHeadcrabCanisterShared::DidImpact( float flTime ) const { return (flTime - m_flLaunchTime) >= m_flFlightTime; } //----------------------------------------------------------------------------- // Computes the position of the canister //----------------------------------------------------------------------------- void CEnvHeadcrabCanisterShared::GetPositionAtTime( float flTime, Vector &vecPosition, QAngle &vecAngles ) { float flDeltaTime = flTime - m_flLaunchTime; if ( flDeltaTime > m_flFlightTime ) { flDeltaTime = m_flFlightTime; } VMatrix initToWorld; if ( m_bLaunchedFromWithinWorld || m_bInSkybox ) { VectorMA( m_vecStartPosition, flDeltaTime * m_flHorizSpeed, m_vecParabolaDirection, vecPosition ); vecPosition.z += m_flInitialZSpeed * flDeltaTime + 0.5f * m_flZAcceleration * flDeltaTime * flDeltaTime; Vector vecLeft; CrossProduct( m_vecParabolaDirection, Vector( 0, 0, 1 ), vecLeft ); Vector vecForward; VectorMultiply( m_vecParabolaDirection, -1.0f, vecForward ); vecForward.z = -(m_flInitialZSpeed + m_flZAcceleration * flDeltaTime) / m_flHorizSpeed; // This is -dz/dx. VectorNormalize( vecForward ); Vector vecUp; CrossProduct( vecForward, vecLeft, vecUp ); initToWorld.SetBasisVectors( vecForward, vecLeft, vecUp ); } else { flDeltaTime -= m_flWorldEnterTime; Vector vecVelocity; VectorMultiply( m_vecDirection, m_flFlightSpeed, vecVelocity ); VectorMA( m_vecEnterWorldPosition, flDeltaTime, vecVelocity, vecPosition ); MatrixFromAngles( m_vecStartAngles.Get(), initToWorld ); } VMatrix rotation; MatrixBuildRotationAboutAxis( rotation, Vector( 1, 0, 0 ), flDeltaTime * ROTATION_SPEED ); VMatrix newAngles; MatrixMultiply( initToWorld, rotation, newAngles ); MatrixToAngles( newAngles, vecAngles ); } //----------------------------------------------------------------------------- // Are we in the skybox? //----------------------------------------------------------------------------- bool CEnvHeadcrabCanisterShared::IsInSkybox( ) { // Check to see if we are always in the world! return m_bInSkybox; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void CEnvHeadcrabCanisterShared::CalcEnterTime( const Vector &vecTriggerMins, const Vector &vecTriggerMaxs ) { /* #define HEADCRABCANISTER_TRIGGER_EPSILON 0.001f // Initialize the enter/exit fractions. float flEnterFrac = 0.0f; float flExitFrac = 1.0f; // Create an arbitrarily large end position. Vector vecEndPosition; VectorMA( m_vecStartPosition, 32000.0f, m_vecDirection, vecEndPosition ); float flFrac, flDistStart, flDistEnd; for( int iAxis = 0; iAxis < 3; iAxis++ ) { // Negative Axis flDistStart = -m_vecStartPosition[iAxis] + vecTriggerMins[iAxis]; flDistEnd = -vecEndPosition[iAxis] + vecTriggerMins[iAxis]; if ( ( flDistStart > 0.0f ) && ( flDistEnd < 0.0f ) ) { flFrac = ( flDistStart - HEADCRABCANISTER_TRIGGER_EPSILON ) / ( flDistStart - flDistEnd ); if ( flFrac > flEnterFrac ) { flEnterFrac = flFrac; } } if ( ( flDistStart < 0.0f ) && ( flDistEnd > 0.0f ) ) { flFrac = ( flDistStart + HEADCRABCANISTER_TRIGGER_EPSILON ) / ( flDistStart - flDistEnd ); if( flFrac < flExitFrac ) { flExitFrac = flFrac; } } if ( ( flDistStart > 0.0f ) && ( flDistEnd > 0.0f ) ) return; // Positive Axis flDistStart = m_vecStartPosition[iAxis] - vecTriggerMaxs[iAxis]; flDistEnd = vecEndPosition[iAxis] - vecTriggerMaxs[iAxis]; if ( ( flDistStart > 0.0f ) && ( flDistEnd < 0.0f ) ) { flFrac = ( flDistStart - HEADCRABCANISTER_TRIGGER_EPSILON ) / ( flDistStart - flDistEnd ); if ( flFrac > flEnterFrac ) { flEnterFrac = flFrac; } } if ( ( flDistStart < 0.0f ) && ( flDistEnd > 0.0f ) ) { flFrac = ( flDistStart + HEADCRABCANISTER_TRIGGER_EPSILON ) / ( flDistStart - flDistEnd ); if( flFrac < flExitFrac ) { flExitFrac = flFrac; } } if ( ( flDistStart > 0.0f ) && ( flDistEnd > 0.0f ) ) return; } // Check for intersection. if ( flExitFrac >= flEnterFrac ) { // Check to see if we start in the world or the skybox! if ( flEnterFrac == 0.0f ) { m_nLocation = HEADCRABCANISTER_LOCATION_WORLD; } else { m_nLocation = HEADCRABCANISTER_LOCATION_SKYBOX; } // Calculate the enter/exit times. Vector vecEnterPoint, vecExitPoint, vecDeltaPosition; VectorSubtract( vecEndPosition, m_vecStartPosition, vecDeltaPosition ); VectorScale( vecDeltaPosition, flEnterFrac, vecEnterPoint ); VectorScale( vecDeltaPosition, flExitFrac, vecExitPoint ); m_flWorldEnterTime = vecEnterPoint.Length() / m_flFlightSpeed; m_flWorldEnterTime += m_flLaunchTime; } */ #undef HEADCRABCANISTER_TRIGGER_EPSILON }
{ "pile_set_name": "Github" }
// Copyright 2017 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. package windows const ( MEM_COMMIT = 0x00001000 MEM_RESERVE = 0x00002000 MEM_DECOMMIT = 0x00004000 MEM_RELEASE = 0x00008000 MEM_RESET = 0x00080000 MEM_TOP_DOWN = 0x00100000 MEM_WRITE_WATCH = 0x00200000 MEM_PHYSICAL = 0x00400000 MEM_RESET_UNDO = 0x01000000 MEM_LARGE_PAGES = 0x20000000 PAGE_NOACCESS = 0x01 PAGE_READONLY = 0x02 PAGE_READWRITE = 0x04 PAGE_WRITECOPY = 0x08 PAGE_EXECUTE_READ = 0x20 PAGE_EXECUTE_READWRITE = 0x40 PAGE_EXECUTE_WRITECOPY = 0x80 )
{ "pile_set_name": "Github" }
package ioutils import ( "crypto/sha1" "encoding/hex" "math/rand" "testing" "time" ) func TestBytesPipeRead(t *testing.T) { buf := NewBytesPipe() buf.Write([]byte("12")) buf.Write([]byte("34")) buf.Write([]byte("56")) buf.Write([]byte("78")) buf.Write([]byte("90")) rd := make([]byte, 4) n, err := buf.Read(rd) if err != nil { t.Fatal(err) } if n != 4 { t.Fatalf("Wrong number of bytes read: %d, should be %d", n, 4) } if string(rd) != "1234" { t.Fatalf("Read %s, but must be %s", rd, "1234") } n, err = buf.Read(rd) if err != nil { t.Fatal(err) } if n != 4 { t.Fatalf("Wrong number of bytes read: %d, should be %d", n, 4) } if string(rd) != "5678" { t.Fatalf("Read %s, but must be %s", rd, "5679") } n, err = buf.Read(rd) if err != nil { t.Fatal(err) } if n != 2 { t.Fatalf("Wrong number of bytes read: %d, should be %d", n, 2) } if string(rd[:n]) != "90" { t.Fatalf("Read %s, but must be %s", rd, "90") } } func TestBytesPipeWrite(t *testing.T) { buf := NewBytesPipe() buf.Write([]byte("12")) buf.Write([]byte("34")) buf.Write([]byte("56")) buf.Write([]byte("78")) buf.Write([]byte("90")) if buf.buf[0].String() != "1234567890" { t.Fatalf("Buffer %q, must be %q", buf.buf[0].String(), "1234567890") } } // Write and read in different speeds/chunk sizes and check valid data is read. func TestBytesPipeWriteRandomChunks(t *testing.T) { cases := []struct{ iterations, writesPerLoop, readsPerLoop int }{ {100, 10, 1}, {1000, 10, 5}, {1000, 100, 0}, {1000, 5, 6}, {10000, 50, 25}, } testMessage := []byte("this is a random string for testing") // random slice sizes to read and write writeChunks := []int{25, 35, 15, 20} readChunks := []int{5, 45, 20, 25} for _, c := range cases { // first pass: write directly to hash hash := sha1.New() for i := 0; i < c.iterations*c.writesPerLoop; i++ { if _, err := hash.Write(testMessage[:writeChunks[i%len(writeChunks)]]); err != nil { t.Fatal(err) } } expected := hex.EncodeToString(hash.Sum(nil)) // write/read through buffer buf := NewBytesPipe() hash.Reset() done := make(chan struct{}) go func() { // random delay before read starts <-time.After(time.Duration(rand.Intn(10)) * time.Millisecond) for i := 0; ; i++ { p := make([]byte, readChunks[(c.iterations*c.readsPerLoop+i)%len(readChunks)]) n, _ := buf.Read(p) if n == 0 { break } hash.Write(p[:n]) } close(done) }() for i := 0; i < c.iterations; i++ { for w := 0; w < c.writesPerLoop; w++ { buf.Write(testMessage[:writeChunks[(i*c.writesPerLoop+w)%len(writeChunks)]]) } } buf.Close() <-done actual := hex.EncodeToString(hash.Sum(nil)) if expected != actual { t.Fatalf("BytesPipe returned invalid data. Expected checksum %v, got %v", expected, actual) } } } func BenchmarkBytesPipeWrite(b *testing.B) { testData := []byte("pretty short line, because why not?") for i := 0; i < b.N; i++ { readBuf := make([]byte, 1024) buf := NewBytesPipe() go func() { var err error for err == nil { _, err = buf.Read(readBuf) } }() for j := 0; j < 1000; j++ { buf.Write(testData) } buf.Close() } } func BenchmarkBytesPipeRead(b *testing.B) { rd := make([]byte, 512) for i := 0; i < b.N; i++ { b.StopTimer() buf := NewBytesPipe() for j := 0; j < 500; j++ { buf.Write(make([]byte, 1024)) } b.StartTimer() for j := 0; j < 1000; j++ { if n, _ := buf.Read(rd); n != 512 { b.Fatalf("Wrong number of bytes: %d", n) } } } }
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <SoundAnalysis/NSObject-Protocol.h> @protocol SNRequest <NSObject> @end
{ "pile_set_name": "Github" }
#' Parameters from Structural Models (PCA, EFA, ...) #' #' Format structural models from the \pkg{psych} or \pkg{FactoMineR} packages. #' #' @param model PCA or FA created by the \pkg{psych} or \pkg{FactoMineR} packages (e.g. through \code{psych::principal}, \code{psych::fa} or \code{psych::omega}). #' @inheritParams principal_components #' @param labels A character vector containing labels to be added to the loadings data. Usually, the question related to the item. #' @param ... Arguments passed to or from other methods. #' #' @details #' For the structural models obtained with \pkg{psych}, the following indices are present: #' \itemize{ #' \item \strong{Complexity} (\cite{Hoffman's, 1978; Pettersson and Turkheimer, 2010}) represents the number of latent components needed to account for the observed variables. Whereas a perfect simple structure solution has a complexity of 1 in that each item would only load on one factor, a solution with evenly distributed items has a complexity greater than 1. #' \item \strong{Uniqueness} represents the variance that is 'unique' to the variable and not shared with other variables. It is equal to \code{1 – communality} (variance that is shared with other variables). A uniqueness of \code{0.20} suggests that 20\% or that variable's variance is not shared with other variables in the overall factor model. The greater 'uniqueness' the lower the relevance of the variable in the factor model. #' \item \strong{MSA} represents the Kaiser-Meyer-Olkin Measure of Sampling Adequacy (\cite{Kaiser and Rice, 1974}) for each item. It indicates whether there is enough data for each factor give reliable results for the PCA. The value should be > 0.6, and desirable values are > 0.8 (\cite{Tabachnick and Fidell, 2013}). #' } #' #' @examples #' library(parameters) #' if (require("psych")) { #' # Principal Component Analysis (PCA) --------- #' pca <- psych::principal(attitude) #' model_parameters(pca) #' #' pca <- psych::principal(attitude, nfactors = 3, rotate = "none") #' model_parameters(pca, sort = TRUE, threshold = 0.2) #' #' principal_components(attitude, n = 3, sort = TRUE, threshold = 0.2) #' #' \donttest{ #' # Exploratory Factor Analysis (EFA) --------- #' efa <- psych::fa(attitude, nfactors = 3) #' model_parameters(efa, threshold = "max", sort = TRUE, labels = as.character(1:ncol(attitude))) #' } #' #' # Omega --------- #' omega <- psych::omega(mtcars, nfactors = 3) #' params <- model_parameters(omega) #' params #' summary(params) #' } #' #' # FactoMineR --------- #' \dontrun{ #' if( require("FactoMineR")) { #' model <- FactoMineR::PCA(iris[, 1:4], ncp = 2) #' model_parameters(model) #' attributes(model_parameters(model))$scores #' #' model <- FactoMineR::FAMD(iris, ncp = 2) #' model_parameters(model) #' } #' } #' @return A data frame of loadings. #' @references \itemize{ #' \item Kaiser, H.F. and Rice. J. (1974). Little jiffy, mark iv. Educational and Psychological Measurement, 34(1):111–117 #' \item Pettersson, E., \& Turkheimer, E. (2010). Item selection, evaluation, and simple structure in personality data. Journal of research in personality, 44(4), 407-420. #' \item Revelle, W. (2016). How To: Use the psych package for Factor Analysis and data reduction. #' \item Tabachnick, B. G., and Fidell, L. S. (2013). Using multivariate statistics (6th ed.). Boston: Pearson Education. #' } #' @export model_parameters.principal <- function(model, sort = FALSE, threshold = NULL, labels = NULL, ...) { # n n <- model$factors # Get summary variance <- as.data.frame(unclass(model$Vaccounted)) data_summary <- .data_frame( Component = names(variance), Eigenvalues = model$values[1:n], Variance = as.numeric(variance["Proportion Var", ]) ) if ("Cumulative Var" %in% row.names(variance)) { data_summary$Variance_Cumulative <- as.numeric(variance["Cumulative Var", ]) } else { if (ncol(variance) == 1) { data_summary$Variance_Cumulative <- as.numeric(variance["Proportion Var", ]) } else { data_summary$Variance_Cumulative <- NA } } data_summary$Variance_Proportion <- data_summary$Variance / sum(data_summary$Variance) # Get loadings loadings <- as.data.frame(unclass(model$loadings)) # Format loadings <- cbind(data.frame(Variable = row.names(loadings)), loadings) row.names(loadings) <- NULL # Labels if (!is.null(labels)) { loadings$Label <- labels loadings <- loadings[c("Variable", "Label", names(loadings)[!names(loadings) %in% c("Variable", "Label")])] loading_cols <- 3:(n + 2) } else { loading_cols <- 2:(n + 1) } # Add information loadings$Complexity <- model$complexity loadings$Uniqueness <- model$uniquenesses loadings$MSA <- attributes(model)$MSA # Add attributes attr(loadings, "summary") <- data_summary attr(loadings, "model") <- model attr(loadings, "rotation") <- model$rotation attr(loadings, "scores") <- model$scores attr(loadings, "additional_arguments") <- list(...) attr(loadings, "n") <- n attr(loadings, "type") <- model$fn attr(loadings, "loadings_columns") <- loading_cols # Sorting if (isTRUE(sort)) { loadings <- .sort_loadings(loadings) } # Replace by NA all cells below threshold if (!is.null(threshold)) { loadings <- .filter_loadings(loadings, threshold = threshold) } # Add some more attributes attr(loadings, "loadings_long") <- .long_loadings(loadings, threshold = threshold, loadings_columns = loading_cols) # here we match the original columns in the data set with the assigned components # for each variable, so we know which column in the original data set belongs # to which extracted component... attr(loadings, "closest_component") <- .closest_component(loadings, loadings_columns = loading_cols, variable_names = rownames(model$loadings)) # add class-attribute for printing if (model$fn == "principal") { class(loadings) <- unique(c("parameters_pca", "see_parameters_pca", class(loadings))) } else { class(loadings) <- unique(c("parameters_efa", "see_parameters_efa", class(loadings))) } loadings } #' @export model_parameters.fa <- model_parameters.principal #' @rdname model_parameters.principal #' @export model_parameters.omega <- function(model, ...) { # Table of omega coefficients table_om <- model$omega.group colnames(table_om) <- c("Omega_Total", "Omega_Hierarchical", "Omega_Group") table_om$Composite <- row.names(table_om) row.names(table_om) <- NULL table_om <- table_om[c("Composite", names(table_om)[names(table_om) != "Composite"])] # Get summary: Table of Variance table_var <- as.data.frame(unclass(model$omega.group)) table_var$Composite <- rownames(model$omega.group) table_var$Total <- table_var$total * 100 table_var$General <- table_var$general * 100 table_var$Group <- table_var$group * 100 table_var <- table_var[c("Composite", "Total", "General", "Group")] # colnames(table_var) <- c("Composite", "Total Variance (%)", "Variance due to General Factor (%)", "Variance due to Group Factor (%)") # cor.plot(psych::fa.sort(om), main = title) out <- table_om attr(out, "summary") <- table_var class(out) <- c("parameters_omega", class(out)) out }
{ "pile_set_name": "Github" }
/* * Analogue & Micro ASP8347 Device Tree Source * * Copyright 2008 Codehermit * * 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. */ /dts-v1/; / { model = "Analogue & Micro ASP8347E"; compatible = "analogue-and-micro,asp8347e"; #address-cells = <1>; #size-cells = <1>; aliases { ethernet0 = &enet0; ethernet1 = &enet1; serial0 = &serial0; serial1 = &serial1; }; cpus { #address-cells = <1>; #size-cells = <0>; PowerPC,8347@0 { device_type = "cpu"; reg = <0x0>; d-cache-line-size = <32>; i-cache-line-size = <32>; d-cache-size = <32768>; i-cache-size = <32768>; timebase-frequency = <0>; // from bootloader bus-frequency = <0>; // from bootloader clock-frequency = <0>; // from bootloader }; }; memory { device_type = "memory"; reg = <0x00000000 0x8000000>; // 128MB at 0 }; localbus@ff005000 { #address-cells = <2>; #size-cells = <1>; compatible = "fsl,mpc8347e-localbus", "fsl,pq2pro-localbus", "simple-bus"; reg = <0xff005000 0x1000>; interrupts = <77 0x8>; interrupt-parent = <&ipic>; ranges = < 0 0 0xf0000000 0x02000000 >; flash@0,0 { compatible = "cfi-flash"; reg = <0 0 0x02000000>; bank-width = <2>; device-width = <2>; }; }; soc8349@ff000000 { #address-cells = <1>; #size-cells = <1>; device_type = "soc"; ranges = <0x0 0xff000000 0x00100000>; reg = <0xff000000 0x00000200>; bus-frequency = <0>; wdt@200 { device_type = "watchdog"; compatible = "mpc83xx_wdt"; reg = <0x200 0x100>; }; i2c@3000 { #address-cells = <1>; #size-cells = <0>; cell-index = <0>; compatible = "fsl-i2c"; reg = <0x3000 0x100>; interrupts = <14 0x8>; interrupt-parent = <&ipic>; dfsrr; rtc@68 { compatible = "dallas,ds1374"; reg = <0x68>; }; }; i2c@3100 { #address-cells = <1>; #size-cells = <0>; cell-index = <1>; compatible = "fsl-i2c"; reg = <0x3100 0x100>; interrupts = <15 0x8>; interrupt-parent = <&ipic>; dfsrr; }; spi@7000 { cell-index = <0>; compatible = "fsl,spi"; reg = <0x7000 0x1000>; interrupts = <16 0x8>; interrupt-parent = <&ipic>; mode = "cpu"; }; dma@82a8 { #address-cells = <1>; #size-cells = <1>; compatible = "fsl,mpc8347-dma", "fsl,elo-dma"; reg = <0x82a8 4>; ranges = <0 0x8100 0x1a8>; interrupt-parent = <&ipic>; interrupts = <71 8>; cell-index = <0>; dma-channel@0 { compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel"; reg = <0 0x80>; cell-index = <0>; interrupt-parent = <&ipic>; interrupts = <71 8>; }; dma-channel@80 { compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel"; reg = <0x80 0x80>; cell-index = <1>; interrupt-parent = <&ipic>; interrupts = <71 8>; }; dma-channel@100 { compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel"; reg = <0x100 0x80>; cell-index = <2>; interrupt-parent = <&ipic>; interrupts = <71 8>; }; dma-channel@180 { compatible = "fsl,mpc8347-dma-channel", "fsl,elo-dma-channel"; reg = <0x180 0x28>; cell-index = <3>; interrupt-parent = <&ipic>; interrupts = <71 8>; }; }; /* phy type (ULPI or SERIAL) are only types supported for MPH */ /* port = 0 or 1 */ usb@22000 { compatible = "fsl-usb2-mph"; reg = <0x22000 0x1000>; #address-cells = <1>; #size-cells = <0>; interrupt-parent = <&ipic>; interrupts = <39 0x8>; phy_type = "ulpi"; port0; }; /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */ usb@23000 { compatible = "fsl-usb2-dr"; reg = <0x23000 0x1000>; #address-cells = <1>; #size-cells = <0>; interrupt-parent = <&ipic>; interrupts = <38 0x8>; dr_mode = "otg"; phy_type = "ulpi"; }; enet0: ethernet@24000 { #address-cells = <1>; #size-cells = <1>; cell-index = <0>; device_type = "network"; model = "TSEC"; compatible = "gianfar"; reg = <0x24000 0x1000>; ranges = <0x0 0x24000 0x1000>; local-mac-address = [ 00 08 e5 11 32 33 ]; interrupts = <32 0x8 33 0x8 34 0x8>; interrupt-parent = <&ipic>; tbi-handle = <&tbi0>; phy-handle = <&phy0>; linux,network-index = <0>; mdio@520 { #address-cells = <1>; #size-cells = <0>; compatible = "fsl,gianfar-mdio"; reg = <0x520 0x20>; phy0: ethernet-phy@0 { interrupt-parent = <&ipic>; interrupts = <17 0x8>; reg = <0x1>; device_type = "ethernet-phy"; }; phy1: ethernet-phy@1 { interrupt-parent = <&ipic>; interrupts = <18 0x8>; reg = <0x2>; device_type = "ethernet-phy"; }; tbi0: tbi-phy@11 { reg = <0x11>; device_type = "tbi-phy"; }; }; }; enet1: ethernet@25000 { #address-cells = <1>; #size-cells = <1>; cell-index = <1>; device_type = "network"; model = "TSEC"; compatible = "gianfar"; reg = <0x25000 0x1000>; ranges = <0x0 0x25000 0x1000>; local-mac-address = [ 00 08 e5 11 32 34 ]; interrupts = <35 0x8 36 0x8 37 0x8>; interrupt-parent = <&ipic>; tbi-handle = <&tbi1>; phy-handle = <&phy1>; linux,network-index = <1>; mdio@520 { #address-cells = <1>; #size-cells = <0>; compatible = "fsl,gianfar-tbi"; reg = <0x520 0x20>; tbi1: tbi-phy@11 { reg = <0x11>; device_type = "tbi-phy"; }; }; }; serial0: serial@4500 { cell-index = <0>; device_type = "serial"; compatible = "ns16550"; reg = <0x4500 0x100>; clock-frequency = <400000000>; interrupts = <9 0x8>; interrupt-parent = <&ipic>; }; serial1: serial@4600 { cell-index = <1>; device_type = "serial"; compatible = "ns16550"; reg = <0x4600 0x100>; clock-frequency = <400000000>; interrupts = <10 0x8>; interrupt-parent = <&ipic>; }; /* May need to remove if on a part without crypto engine */ crypto@30000 { device_type = "crypto"; model = "SEC2"; compatible = "talitos"; reg = <0x30000 0x10000>; interrupts = <11 0x8>; interrupt-parent = <&ipic>; num-channels = <4>; channel-fifo-len = <24>; exec-units-mask = <0x0000007e>; /* desc mask is for rev2.0, * we need runtime fixup for >2.0 */ descriptor-types-mask = <0x01010ebf>; }; /* IPIC * interrupts cell = <intr #, sense> * sense values match linux IORESOURCE_IRQ_* defines: * sense == 8: Level, low assertion * sense == 2: Edge, high-to-low change */ ipic: pic@700 { interrupt-controller; #address-cells = <0>; #interrupt-cells = <2>; reg = <0x700 0x100>; device_type = "ipic"; }; }; chosen { bootargs = "console=ttyS0,38400 root=/dev/mtdblock3 rootfstype=jffs2"; linux,stdout-path = &serial0; }; };
{ "pile_set_name": "Github" }
/** * * Copyright 2019 Florian Schmaus * * 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. */ /** * Provider classes for XEP-0315: Data Forms XML Element. */ package org.jivesoftware.smackx.xmlelement.provider;
{ "pile_set_name": "Github" }
/** * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.aurora.scheduler.quota; import java.util.Optional; import com.google.common.annotations.VisibleForTesting; import org.apache.aurora.scheduler.resources.ResourceBag; import org.apache.aurora.scheduler.resources.ResourceType; import static java.util.Objects.requireNonNull; import static org.apache.aurora.scheduler.resources.ResourceBag.IS_NEGATIVE; /** * Calculates and formats detailed quota comparison result. */ public class QuotaCheckResult { /** * Quota check result. */ public enum Result { /** * There is sufficient quota for the requested operation. */ SUFFICIENT_QUOTA, /** * There is not enough allocated quota for the requested operation. */ INSUFFICIENT_QUOTA } private final Optional<String> details; private final Result result; @VisibleForTesting public QuotaCheckResult(Result result) { this(result, Optional.empty()); } private QuotaCheckResult(Result result, Optional<String> details) { this.result = requireNonNull(result); this.details = requireNonNull(details); } /** * Gets quota check result. * * @return Quota check result. */ public Result getResult() { return result; } /** * Gets detailed quota violation description in case quota check fails. * * @return Quota check details. */ public Optional<String> getDetails() { return details; } static QuotaCheckResult greaterOrEqual(ResourceBag a, ResourceBag b) { StringBuilder details = new StringBuilder(); ResourceBag difference = a.subtract(b); difference.filter(IS_NEGATIVE).streamResourceVectors().forEach( entry -> addMessage(entry.getKey(), Math.abs(entry.getValue()), details)); return new QuotaCheckResult( details.length() > 0 ? Result.INSUFFICIENT_QUOTA : Result.SUFFICIENT_QUOTA, Optional.of(details.toString())); } private static void addMessage(ResourceType resourceType, Double overage, StringBuilder details) { details .append(details.length() > 0 ? "; " : "") .append(resourceType.getAuroraName()) .append(" quota exceeded by ") .append(String.format("%.2f", overage)) .append(" ") .append(resourceType.getAuroraUnit()); } }
{ "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 Systrace = require('Systrace'); const infoLog = require('infoLog'); const performanceNow = global.nativeQPLTimestamp || global.nativePerformanceNow || require('fbjs/lib/performanceNow'); type Timespan = { description?: string, totalTime?: number, startTime?: number, endTime?: number, }; let timespans: {[key: string]: Timespan} = {}; let extras: {[key: string]: any} = {}; let points: {[key: string]: number} = {}; const cookies: {[key: string]: number} = {}; const PRINT_TO_CONSOLE: false = false; // Type as false to prevent accidentally committing `true`; /** * This is meant to collect and log performance data in production, which means * it needs to have minimal overhead. */ const PerformanceLogger = { addTimespan(key: string, lengthInMs: number, description?: string) { if (timespans[key]) { if (__DEV__) { infoLog( 'PerformanceLogger: Attempting to add a timespan that already exists ', key, ); } return; } timespans[key] = { description: description, totalTime: lengthInMs, }; }, startTimespan(key: string, description?: string) { if (timespans[key]) { if (__DEV__) { infoLog( 'PerformanceLogger: Attempting to start a timespan that already exists ', key, ); } return; } timespans[key] = { description: description, startTime: performanceNow(), }; cookies[key] = Systrace.beginAsyncEvent(key); if (PRINT_TO_CONSOLE) { infoLog('PerformanceLogger.js', 'start: ' + key); } }, stopTimespan(key: string) { const timespan = timespans[key]; if (!timespan || !timespan.startTime) { if (__DEV__) { infoLog( 'PerformanceLogger: Attempting to end a timespan that has not started ', key, ); } return; } if (timespan.endTime) { if (__DEV__) { infoLog( 'PerformanceLogger: Attempting to end a timespan that has already ended ', key, ); } return; } timespan.endTime = performanceNow(); timespan.totalTime = timespan.endTime - (timespan.startTime || 0); if (PRINT_TO_CONSOLE) { infoLog('PerformanceLogger.js', 'end: ' + key); } Systrace.endAsyncEvent(key, cookies[key]); delete cookies[key]; }, clear() { timespans = {}; extras = {}; points = {}; if (PRINT_TO_CONSOLE) { infoLog('PerformanceLogger.js', 'clear'); } }, clearCompleted() { for (const key in timespans) { if (timespans[key].totalTime) { delete timespans[key]; } } extras = {}; points = {}; if (PRINT_TO_CONSOLE) { infoLog('PerformanceLogger.js', 'clearCompleted'); } }, clearExceptTimespans(keys: Array<string>) { timespans = Object.keys(timespans).reduce(function(previous, key) { if (keys.indexOf(key) !== -1) { previous[key] = timespans[key]; } return previous; }, {}); extras = {}; points = {}; if (PRINT_TO_CONSOLE) { infoLog('PerformanceLogger.js', 'clearExceptTimespans', keys); } }, currentTimestamp() { return performanceNow(); }, getTimespans() { return timespans; }, hasTimespan(key: string) { return !!timespans[key]; }, logTimespans() { for (const key in timespans) { if (timespans[key].totalTime) { infoLog(key + ': ' + timespans[key].totalTime + 'ms'); } } }, addTimespans(newTimespans: Array<number>, labels: Array<string>) { for (let ii = 0, l = newTimespans.length; ii < l; ii += 2) { const label = labels[ii / 2]; PerformanceLogger.addTimespan( label, newTimespans[ii + 1] - newTimespans[ii], label, ); } }, setExtra(key: string, value: any) { if (extras[key]) { if (__DEV__) { infoLog( 'PerformanceLogger: Attempting to set an extra that already exists ', {key, currentValue: extras[key], attemptedValue: value}, ); } return; } extras[key] = value; }, getExtras() { return extras; }, logExtras() { infoLog(extras); }, markPoint(key: string, timestamp?: number) { if (points[key]) { if (__DEV__) { infoLog( 'PerformanceLogger: Attempting to mark a point that has been already logged ', key, ); } return; } points[key] = timestamp ?? performanceNow(); }, getPoints() { return points; }, logPoints() { for (const key in points) { infoLog(key + ': ' + points[key] + 'ms'); } }, }; module.exports = PerformanceLogger;
{ "pile_set_name": "Github" }
/* TEST_OUTPUT: --- fail_compilation/fail179.d(11): Error: variable `fail179.main.px` cannot be `final`, perhaps you meant `const`? --- */ void main() { int x = 3; final px = &x; *px = 4; auto ppx = &px; **ppx = 5; }
{ "pile_set_name": "Github" }
python setup.py sdist twine upload --repository testpypi dist/*
{ "pile_set_name": "Github" }
/* eslint-disable */ require('./actions') require('./add_page') require('./checkbox_0') require('./checkbox_1') require('./close') require('./collapse') require('./dev_lg') require('./dev_md') require('./dev_sm') require('./editor') require('./elements') require('./expand') require('./gh_logo') require('./home') require('./more_vert') require('./page') require('./settings') require('./widgets')
{ "pile_set_name": "Github" }
# I2P # Copyright (C) 2009 The I2P Project # This file is distributed under the same license as the routerconsole package. # To contribute translations, see http://www.i2p2.de/newdevelopers # # Translators: # Aman Elarbi <aman.elarbi@gmail.com>, 2014 # ducki2p <ducki2p@gmail.com>, 2011 # foo <foo@bar>, 2009 # Jakob Wuhrer <pinoaffe@gmail.com>, 2016 # Jrnr601 <jerobben@gmail.com>, 2012 # Desirius <martinjefmeyers@gmail.com>, 2014 # Nathan Follens, 2015-2016,2018 # attesor <random901@zoho.com>, 2012 msgid "" msgstr "" "Project-Id-Version: I2P\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-07-17 01:33+0000\n" "PO-Revision-Date: 2018-03-04 21:03+0000\n" "Last-Translator: Aaldert Dijkstra <pe1nkx@zonnet.nl>\n" "Language-Team: Dutch (http://www.transifex.com/otf/I2P/language/nl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: nl\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "Anonymous Proxy" msgstr "Anonieme proxy" msgid "Satellite Provider" msgstr "Satellietprovider" msgid "Andorra" msgstr "Andorra" msgid "United Arab Emirates" msgstr "Verenigde Arabische Emiraten" msgid "Afghanistan" msgstr "Afghanistan" msgid "Antigua and Barbuda" msgstr "Antigua en Barbuda" msgid "Anguilla" msgstr "Anguilla" msgid "Albania" msgstr "Albanië" msgid "Armenia" msgstr "Armenië" msgid "Netherlands Antilles" msgstr "Nederlandse Antillen" msgid "Angola" msgstr "Angola" msgid "Asia/Pacific Region" msgstr "Azië/Pacifische regio" msgid "Antarctica" msgstr "Antarctica" msgid "Argentina" msgstr "Argentinië" msgid "American Samoa" msgstr "Amerikaans-Samoa" msgid "Austria" msgstr "Oostenrijk" msgid "Australia" msgstr "Australië" msgid "Aruba" msgstr "Aruba" msgid "Åland Islands" msgstr "Åland" msgid "Azerbaijan" msgstr "Azerbeidzjan" msgid "Bosnia and Herzegovina" msgstr "Bosnië en Herzegovina" msgid "Barbados" msgstr "Barbados" msgid "Bangladesh" msgstr "Bangladesh" msgid "Belgium" msgstr "België" msgid "Burkina Faso" msgstr "Burkina Faso" msgid "Bulgaria" msgstr "Bulgarije" msgid "Bahrain" msgstr "Bahrein" msgid "Burundi" msgstr "Burundi" msgid "Benin" msgstr "Benin" msgid "Saint Barthélemy" msgstr "Sint-Bartholomeus" msgid "Bermuda" msgstr "Bermuda" msgid "Brunei Darussalam" msgstr "Brunei" msgid "Bolivia" msgstr "Bolivia" msgid "Bonaire" msgstr "Bonaire" msgid "Brazil" msgstr "Brazilië" msgid "Bahamas" msgstr "Bahama’s" msgid "Bhutan" msgstr "Bhutan" msgid "Bouvet Island" msgstr "Bouveteiland" msgid "Botswana" msgstr "Botswana" msgid "Belarus" msgstr "Wit-Rusland" msgid "Belize" msgstr "Belize" msgid "Canada" msgstr "Canada" msgid "Cocos (Keeling) Islands" msgstr "Cocoseilanden (Keelingeilanden)" msgid "Congo" msgstr "Congo" msgid "Central African Republic" msgstr "Centraal-Afrikaanse Republiek" msgid "Switzerland" msgstr "Zwitserland" msgid "Cote D'Ivoire" msgstr "Ivoorkust" msgid "Cook Islands" msgstr "Cookeilanden" msgid "Chile" msgstr "Chili" msgid "Cameroon" msgstr "Kameroen" msgid "China" msgstr "China" msgid "Colombia" msgstr "Colombia" msgid "Costa Rica" msgstr "Costa Rica" msgid "Serbia and Montenegro" msgstr "Servië en Montenegro" msgid "Cuba" msgstr "Cuba" msgid "Cape Verde" msgstr "Kaapverdië" msgid "Curaçao" msgstr "Curaçao" msgid "Christmas Island" msgstr "Christmaseiland" msgid "Cyprus" msgstr "Cyprus" msgid "Czech Republic" msgstr "Tsjechië" msgid "Germany" msgstr "Duitsland" msgid "Djibouti" msgstr "Djibouti" msgid "Denmark" msgstr "Denemarken" msgid "Dominica" msgstr "Dominica" msgid "Dominican Republic" msgstr "Dominicaanse Republiek" msgid "Algeria" msgstr "Algerije" msgid "Ecuador" msgstr "Ecuador" msgid "Estonia" msgstr "Estland" msgid "Egypt" msgstr "Egypte" msgid "Western Sahara" msgstr "West-Sahara" msgid "Eritrea" msgstr "Eritrea" msgid "Spain" msgstr "Spanje" msgid "Ethiopia" msgstr "Ethiopië" msgid "European Union" msgstr "Europese Unie" msgid "Finland" msgstr "Finland" msgid "Fiji" msgstr "Fiji" msgid "Falkland Islands (Malvinas)" msgstr "Falklandeilanden" msgid "Micronesia" msgstr "Micronesië" msgid "Faroe Islands" msgstr "Faeröer" msgid "France" msgstr "Frankrijk" msgid "Gabon" msgstr "Gabon" msgid "United Kingdom" msgstr "Verenigd Koninkrijk" msgid "Grenada" msgstr "Grenada" msgid "Georgia" msgstr "Georgië" msgid "French Guiana" msgstr "Frans-Guyana" msgid "Guernsey" msgstr "Guernsey" msgid "Ghana" msgstr "Ghana" msgid "Gibraltar" msgstr "Gibraltar" msgid "Greenland" msgstr "Groenland" msgid "Gambia" msgstr "Gambia" msgid "Guinea" msgstr "Guinee" msgid "Guadeloupe" msgstr "Guadeloupe" msgid "Equatorial Guinea" msgstr "Equatoriaal-Guinea" msgid "Greece" msgstr "Griekenland" msgid "South Georgia and the South Sandwich Islands" msgstr "Zuid-Georgia en de Zuidelijke Sandwicheilanden" msgid "Guatemala" msgstr "Guatemala" msgid "Guam" msgstr "Guam" msgid "Guinea-Bissau" msgstr "Guinee-Bissau" msgid "Guyana" msgstr "Guyana" msgid "Hong Kong" msgstr "Hong Kong" msgid "Honduras" msgstr "Honduras" msgid "Croatia" msgstr "Kroatië" msgid "Haiti" msgstr "Haïti" msgid "Hungary" msgstr "Hongarije" msgid "Indonesia" msgstr "Indonesië" msgid "Ireland" msgstr "Ierland" msgid "Israel" msgstr "Israël" msgid "Isle of Man" msgstr "Man" msgid "India" msgstr "India" msgid "British Indian Ocean Territory" msgstr "Brits Territorium in de Indische Oceaan" msgid "Iraq" msgstr "Irak" msgid "Iran" msgstr "Iran" msgid "Iceland" msgstr "IJsland" msgid "Italy" msgstr "Italië" msgid "Jersey" msgstr "Jersey" msgid "Jamaica" msgstr "Jamaica" msgid "Jordan" msgstr "Jordanië" msgid "Japan" msgstr "Japan" msgid "Kenya" msgstr "Kenia" msgid "Kyrgyzstan" msgstr "Kirgizië" msgid "Cambodia" msgstr "Cambodja" msgid "Kiribati" msgstr "Kiribati" msgid "Comoros" msgstr "Comoren" msgid "Saint Kitts and Nevis" msgstr "Saint Kitts en Nevis" msgid "North Korea" msgstr "Noord-Korea" msgid "Republic of Korea" msgstr "Republiek Korea" msgid "Kuwait" msgstr "Koeweit" msgid "Cayman Islands" msgstr "Kaaimaneilanden" msgid "Kazakhstan" msgstr "Kazachstan" msgid "Lao People's Democratic Republic" msgstr "Laos" msgid "Lebanon" msgstr "Libanon" msgid "Saint Lucia" msgstr "Saint Lucia" msgid "Liechtenstein" msgstr "Liechtenstein" msgid "Sri Lanka" msgstr "Sri Lanka" msgid "Liberia" msgstr "Liberia" msgid "Lesotho" msgstr "Lesotho" msgid "Lithuania" msgstr "Litouwen" msgid "Luxembourg" msgstr "Luxemburg" msgid "Latvia" msgstr "Letland" msgid "Libya" msgstr "Libië" msgid "Morocco" msgstr "Marokko" msgid "Monaco" msgstr "Monaco" msgid "Moldova" msgstr "Moldavië" msgid "Montenegro" msgstr "Montenegro" msgid "Saint Martin" msgstr "Sint Maarten" msgid "Madagascar" msgstr "Madagaskar" msgid "Marshall Islands" msgstr "Marshalleilanden" msgid "Macedonia" msgstr "Macedonië" msgid "Mali" msgstr "Mali" msgid "Myanmar" msgstr "Myanmar" msgid "Mongolia" msgstr "Mongolië" msgid "Macau" msgstr "Macau" msgid "Northern Mariana Islands" msgstr "Noordelijke Marianen" msgid "Martinique" msgstr "Martinique" msgid "Mauritania" msgstr "Mauritanië" msgid "Montserrat" msgstr "Montserrat" msgid "Malta" msgstr "Malta" msgid "Mauritius" msgstr "Mauritius" msgid "Maldives" msgstr "Maldiven" msgid "Malawi" msgstr "Malawi" msgid "Mexico" msgstr "Mexico" msgid "Malaysia" msgstr "Maleisië" msgid "Mozambique" msgstr "Mozambique" msgid "Namibia" msgstr "Namibië" msgid "New Caledonia" msgstr "Nieuw-Caledonië" msgid "Niger" msgstr "Niger" msgid "Norfolk Island" msgstr "Norfolk" msgid "Nigeria" msgstr "Nigeria" msgid "Nicaragua" msgstr "Nicaragua" msgid "Netherlands" msgstr "Nederland" msgid "Norway" msgstr "Noorwegen" msgid "Nepal" msgstr "Nepal" msgid "Nauru" msgstr "Nauru" msgid "Niue" msgstr "Niue" msgid "New Zealand" msgstr "Nieuw-Zeeland" msgid "Oman" msgstr "Oman" msgid "Panama" msgstr "Panama" msgid "Peru" msgstr "Peru" msgid "French Polynesia" msgstr "Frans-Polynesië" msgid "Papua New Guinea" msgstr "Papoea-Nieuw-Guinea" msgid "Philippines" msgstr "Filipijnen" msgid "Pakistan" msgstr "Pakistan" msgid "Poland" msgstr "Polen" msgid "Saint Pierre and Miquelon" msgstr "Saint-Pierre en Miquelon" msgid "Pitcairn Islands" msgstr "Pitcairneilanden" msgid "Puerto Rico" msgstr "Puerto Rico" msgid "Palestinian Territory" msgstr "Palestina" msgid "Portugal" msgstr "Portugal" msgid "Palau" msgstr "Palau" msgid "Paraguay" msgstr "Paraguay" msgid "Qatar" msgstr "Qatar" msgid "Réunion" msgstr "Réunion" msgid "Romania" msgstr "Roemenië" msgid "Serbia" msgstr "Servië" msgid "Russian Federation" msgstr "Rusland" msgid "Rwanda" msgstr "Rwanda" msgid "Saudi Arabia" msgstr "Saoedi-Arabië" msgid "Solomon Islands" msgstr "Salomonseilanden" msgid "Seychelles" msgstr "Seychellen" msgid "Sudan" msgstr "Soedan" msgid "Sweden" msgstr "Zweden" msgid "Singapore" msgstr "Singapore" msgid "Saint Helena" msgstr "Sint-Helena" msgid "Slovenia" msgstr "Slovenië" msgid "Svalbard and Jan Mayen" msgstr "Spitsbergen en Jan Mayen" msgid "Slovakia" msgstr "Slowakije" msgid "Sierra Leone" msgstr "Sierra Leone" msgid "San Marino" msgstr "San Marino" msgid "Senegal" msgstr "Senegal" msgid "Somalia" msgstr "Somalië" msgid "Suriname" msgstr "Suriname" msgid "South Sudan" msgstr "Zuid-Soedan" msgid "Sao Tome and Principe" msgstr "Sao Tomé en Principe" msgid "El Salvador" msgstr "El Salvador" msgid "Sint Maarten" msgstr "Sint Maarten" msgid "Syria" msgstr "Syrië" msgid "Swaziland" msgstr "Swaziland" msgid "Turks and Caicos Islands" msgstr "Turks- en Caicoseilanden" msgid "Chad" msgstr "Tsjaad" msgid "French Southern Territories" msgstr "Franse Zuidelijke Gebieden" msgid "Togo" msgstr "Togo" msgid "Thailand" msgstr "Thailand" msgid "Tajikistan" msgstr "Tadzjikistan" msgid "Tokelau" msgstr "Tokelau" msgid "Timor-Leste" msgstr "Oost-Timor" msgid "Turkmenistan" msgstr "Turkmenistan" msgid "Tunisia" msgstr "Tunesië" msgid "Tonga" msgstr "Tonga" msgid "Turkey" msgstr "Turkije" msgid "Trinidad and Tobago" msgstr "Trinidad en Tobago" msgid "Tuvalu" msgstr "Tuvalu" msgid "Taiwan" msgstr "Taiwan" msgid "Tanzania" msgstr "Tanzanië" msgid "Ukraine" msgstr "Oekraïne" msgid "Uganda" msgstr "Oeganda" msgid "United States Minor Outlying Islands" msgstr "Kleine Pacifische eilanden van de Verenigde Staten" msgid "United States" msgstr "Verenigde Staten" msgid "Uruguay" msgstr "Uruguay" msgid "Uzbekistan" msgstr "Oezbekistan" msgid "Vatican" msgstr "Vaticaanstad" msgid "Saint Vincent and the Grenadines" msgstr "Saint Vincent en de Grenadines" msgid "Venezuela" msgstr "Venezuela" msgid "Virgin Islands" msgstr "Virgineilanden" msgid "Vietnam" msgstr "Vietnam" msgid "Vanuatu" msgstr "Vanuatu" msgid "Wallis and Futuna" msgstr "Wallis en Futuna" msgid "Samoa" msgstr "Samoa" msgid "Yemen" msgstr "Jemen" msgid "Mayotte" msgstr "Mayotte" msgid "South Africa" msgstr "Zuid-Afrika" msgid "Zambia" msgstr "Zambia" msgid "Zimbabwe" msgstr "Zimbabwe"
{ "pile_set_name": "Github" }
apiVersion: v1 clusters: - name: cluster-sslskip cluster: server: {{ kube_api.url }} insecure-skip-tls-verify: true - name: cluster-ssl cluster: certificate-authority: {{ ca_cert }} server: {{ kube_api.url }} contexts: - context: cluster: cluster-ssl user: admin_ssl name: admin@cluster-ssl - context: cluster: cluster-sslskip user: admin_ssl name: admin@cluster-sslskip current-context: admin@cluster-ssl kind: Config users: - name: admin_ssl user: client-certificate: {{ scheduler_cert }} client-key: {{ scheduler_key }}
{ "pile_set_name": "Github" }
'use strict'; var $ = require('../internals/export'); var IS_PURE = require('../internals/is-pure'); var anObject = require('../internals/an-object'); var aFunction = require('../internals/a-function'); var iterate = require('../internals/iterate'); // `Set.prototype.isSupersetOf` method // https://tc39.github.io/proposal-set-methods/#Set.prototype.isSupersetOf $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, { isSupersetOf: function isSupersetOf(iterable) { var set = anObject(this); var hasCheck = aFunction(set.has); return !iterate(iterable, function (value) { if (hasCheck.call(set, value) === false) return iterate.stop(); }).stopped; } });
{ "pile_set_name": "Github" }
/* * Samsung TV Mixer driver * * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. * * Tomasz Stanislawski, <t.stanislaws@samsung.com> * * 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 Foundiation. either version 2 of the License, * or (at your option) any later version */ #include "mixer.h" #include <linux/module.h> #include <linux/platform_device.h> #include <linux/io.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/fb.h> #include <linux/delay.h> #include <linux/pm_runtime.h> #include <linux/clk.h> MODULE_AUTHOR("Tomasz Stanislawski, <t.stanislaws@samsung.com>"); MODULE_DESCRIPTION("Samsung MIXER"); MODULE_LICENSE("GPL"); /* --------- DRIVER PARAMETERS ---------- */ static struct mxr_output_conf mxr_output_conf[] = { { .output_name = "S5P HDMI connector", .module_name = "s5p-hdmi", .cookie = 1, }, { .output_name = "S5P SDO connector", .module_name = "s5p-sdo", .cookie = 0, }, }; void mxr_get_mbus_fmt(struct mxr_device *mdev, struct v4l2_mbus_framefmt *mbus_fmt) { struct v4l2_subdev *sd; int ret; mutex_lock(&mdev->mutex); sd = to_outsd(mdev); ret = v4l2_subdev_call(sd, video, g_mbus_fmt, mbus_fmt); WARN(ret, "failed to get mbus_fmt for output %s\n", sd->name); mutex_unlock(&mdev->mutex); } void mxr_streamer_get(struct mxr_device *mdev) { mutex_lock(&mdev->mutex); ++mdev->n_streamer; mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_streamer); if (mdev->n_streamer == 1) { struct v4l2_subdev *sd = to_outsd(mdev); struct v4l2_mbus_framefmt mbus_fmt; struct mxr_resources *res = &mdev->res; int ret; if (to_output(mdev)->cookie == 0) clk_set_parent(res->sclk_mixer, res->sclk_dac); else clk_set_parent(res->sclk_mixer, res->sclk_hdmi); mxr_reg_s_output(mdev, to_output(mdev)->cookie); ret = v4l2_subdev_call(sd, video, g_mbus_fmt, &mbus_fmt); WARN(ret, "failed to get mbus_fmt for output %s\n", sd->name); ret = v4l2_subdev_call(sd, video, s_stream, 1); WARN(ret, "starting stream failed for output %s\n", sd->name); mxr_reg_set_mbus_fmt(mdev, &mbus_fmt); mxr_reg_streamon(mdev); ret = mxr_reg_wait4vsync(mdev); WARN(ret, "failed to get vsync (%d) from output\n", ret); } mutex_unlock(&mdev->mutex); mxr_reg_dump(mdev); /* FIXME: what to do when streaming fails? */ } void mxr_streamer_put(struct mxr_device *mdev) { mutex_lock(&mdev->mutex); --mdev->n_streamer; mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_streamer); if (mdev->n_streamer == 0) { int ret; struct v4l2_subdev *sd = to_outsd(mdev); mxr_reg_streamoff(mdev); /* vsync applies Mixer setup */ ret = mxr_reg_wait4vsync(mdev); WARN(ret, "failed to get vsync (%d) from output\n", ret); ret = v4l2_subdev_call(sd, video, s_stream, 0); WARN(ret, "stopping stream failed for output %s\n", sd->name); } WARN(mdev->n_streamer < 0, "negative number of streamers (%d)\n", mdev->n_streamer); mutex_unlock(&mdev->mutex); mxr_reg_dump(mdev); } void mxr_output_get(struct mxr_device *mdev) { mutex_lock(&mdev->mutex); ++mdev->n_output; mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_output); /* turn on auxiliary driver */ if (mdev->n_output == 1) v4l2_subdev_call(to_outsd(mdev), core, s_power, 1); mutex_unlock(&mdev->mutex); } void mxr_output_put(struct mxr_device *mdev) { mutex_lock(&mdev->mutex); --mdev->n_output; mxr_dbg(mdev, "%s(%d)\n", __func__, mdev->n_output); /* turn on auxiliary driver */ if (mdev->n_output == 0) v4l2_subdev_call(to_outsd(mdev), core, s_power, 0); WARN(mdev->n_output < 0, "negative number of output users (%d)\n", mdev->n_output); mutex_unlock(&mdev->mutex); } int mxr_power_get(struct mxr_device *mdev) { int ret = pm_runtime_get_sync(mdev->dev); /* returning 1 means that power is already enabled, * so zero success be returned */ if (IS_ERR_VALUE(ret)) return ret; return 0; } void mxr_power_put(struct mxr_device *mdev) { pm_runtime_put_sync(mdev->dev); } /* --------- RESOURCE MANAGEMENT -------------*/ static int mxr_acquire_plat_resources(struct mxr_device *mdev, struct platform_device *pdev) { struct resource *res; int ret; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mxr"); if (res == NULL) { mxr_err(mdev, "get memory resource failed.\n"); ret = -ENXIO; goto fail; } mdev->res.mxr_regs = ioremap(res->start, resource_size(res)); if (mdev->res.mxr_regs == NULL) { mxr_err(mdev, "register mapping failed.\n"); ret = -ENXIO; goto fail; } res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vp"); if (res == NULL) { mxr_err(mdev, "get memory resource failed.\n"); ret = -ENXIO; goto fail_mxr_regs; } mdev->res.vp_regs = ioremap(res->start, resource_size(res)); if (mdev->res.vp_regs == NULL) { mxr_err(mdev, "register mapping failed.\n"); ret = -ENXIO; goto fail_mxr_regs; } res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "irq"); if (res == NULL) { mxr_err(mdev, "get interrupt resource failed.\n"); ret = -ENXIO; goto fail_vp_regs; } ret = request_irq(res->start, mxr_irq_handler, 0, "s5p-mixer", mdev); if (ret) { mxr_err(mdev, "request interrupt failed.\n"); goto fail_vp_regs; } mdev->res.irq = res->start; return 0; fail_vp_regs: iounmap(mdev->res.vp_regs); fail_mxr_regs: iounmap(mdev->res.mxr_regs); fail: return ret; } static void mxr_resource_clear_clocks(struct mxr_resources *res) { res->mixer = ERR_PTR(-EINVAL); res->vp = ERR_PTR(-EINVAL); res->sclk_mixer = ERR_PTR(-EINVAL); res->sclk_hdmi = ERR_PTR(-EINVAL); res->sclk_dac = ERR_PTR(-EINVAL); } static void mxr_release_plat_resources(struct mxr_device *mdev) { free_irq(mdev->res.irq, mdev); iounmap(mdev->res.vp_regs); iounmap(mdev->res.mxr_regs); } static void mxr_release_clocks(struct mxr_device *mdev) { struct mxr_resources *res = &mdev->res; if (!IS_ERR(res->sclk_dac)) clk_put(res->sclk_dac); if (!IS_ERR(res->sclk_hdmi)) clk_put(res->sclk_hdmi); if (!IS_ERR(res->sclk_mixer)) clk_put(res->sclk_mixer); if (!IS_ERR(res->vp)) clk_put(res->vp); if (!IS_ERR(res->mixer)) clk_put(res->mixer); } static int mxr_acquire_clocks(struct mxr_device *mdev) { struct mxr_resources *res = &mdev->res; struct device *dev = mdev->dev; mxr_resource_clear_clocks(res); res->mixer = clk_get(dev, "mixer"); if (IS_ERR(res->mixer)) { mxr_err(mdev, "failed to get clock 'mixer'\n"); goto fail; } res->vp = clk_get(dev, "vp"); if (IS_ERR(res->vp)) { mxr_err(mdev, "failed to get clock 'vp'\n"); goto fail; } res->sclk_mixer = clk_get(dev, "sclk_mixer"); if (IS_ERR(res->sclk_mixer)) { mxr_err(mdev, "failed to get clock 'sclk_mixer'\n"); goto fail; } res->sclk_hdmi = clk_get(dev, "sclk_hdmi"); if (IS_ERR(res->sclk_hdmi)) { mxr_err(mdev, "failed to get clock 'sclk_hdmi'\n"); goto fail; } res->sclk_dac = clk_get(dev, "sclk_dac"); if (IS_ERR(res->sclk_dac)) { mxr_err(mdev, "failed to get clock 'sclk_dac'\n"); goto fail; } return 0; fail: mxr_release_clocks(mdev); return -ENODEV; } static int mxr_acquire_resources(struct mxr_device *mdev, struct platform_device *pdev) { int ret; ret = mxr_acquire_plat_resources(mdev, pdev); if (ret) goto fail; ret = mxr_acquire_clocks(mdev); if (ret) goto fail_plat; mxr_info(mdev, "resources acquired\n"); return 0; fail_plat: mxr_release_plat_resources(mdev); fail: mxr_err(mdev, "resources acquire failed\n"); return ret; } static void mxr_release_resources(struct mxr_device *mdev) { mxr_release_clocks(mdev); mxr_release_plat_resources(mdev); memset(&mdev->res, 0, sizeof(mdev->res)); mxr_resource_clear_clocks(&mdev->res); } static void mxr_release_layers(struct mxr_device *mdev) { int i; for (i = 0; i < ARRAY_SIZE(mdev->layer); ++i) if (mdev->layer[i]) mxr_layer_release(mdev->layer[i]); } static int mxr_acquire_layers(struct mxr_device *mdev, struct mxr_platform_data *pdata) { mdev->layer[0] = mxr_graph_layer_create(mdev, 0); mdev->layer[1] = mxr_graph_layer_create(mdev, 1); mdev->layer[2] = mxr_vp_layer_create(mdev, 0); if (!mdev->layer[0] || !mdev->layer[1] || !mdev->layer[2]) { mxr_err(mdev, "failed to acquire layers\n"); goto fail; } return 0; fail: mxr_release_layers(mdev); return -ENODEV; } /* ---------- POWER MANAGEMENT ----------- */ static int mxr_runtime_resume(struct device *dev) { struct mxr_device *mdev = to_mdev(dev); struct mxr_resources *res = &mdev->res; mxr_dbg(mdev, "resume - start\n"); mutex_lock(&mdev->mutex); /* turn clocks on */ clk_enable(res->mixer); clk_enable(res->vp); clk_enable(res->sclk_mixer); /* apply default configuration */ mxr_reg_reset(mdev); mxr_dbg(mdev, "resume - finished\n"); mutex_unlock(&mdev->mutex); return 0; } static int mxr_runtime_suspend(struct device *dev) { struct mxr_device *mdev = to_mdev(dev); struct mxr_resources *res = &mdev->res; mxr_dbg(mdev, "suspend - start\n"); mutex_lock(&mdev->mutex); /* turn clocks off */ clk_disable(res->sclk_mixer); clk_disable(res->vp); clk_disable(res->mixer); mutex_unlock(&mdev->mutex); mxr_dbg(mdev, "suspend - finished\n"); return 0; } static const struct dev_pm_ops mxr_pm_ops = { .runtime_suspend = mxr_runtime_suspend, .runtime_resume = mxr_runtime_resume, }; /* --------- DRIVER INITIALIZATION ---------- */ static int mxr_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct mxr_platform_data *pdata = dev->platform_data; struct mxr_device *mdev; int ret; /* mdev does not exist yet so no mxr_dbg is used */ dev_info(dev, "probe start\n"); mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); if (!mdev) { dev_err(dev, "not enough memory.\n"); ret = -ENOMEM; goto fail; } /* setup pointer to master device */ mdev->dev = dev; mutex_init(&mdev->mutex); spin_lock_init(&mdev->reg_slock); init_waitqueue_head(&mdev->event_queue); /* acquire resources: regs, irqs, clocks, regulators */ ret = mxr_acquire_resources(mdev, pdev); if (ret) goto fail_mem; /* configure resources for video output */ ret = mxr_acquire_video(mdev, mxr_output_conf, ARRAY_SIZE(mxr_output_conf)); if (ret) goto fail_resources; /* configure layers */ ret = mxr_acquire_layers(mdev, pdata); if (ret) goto fail_video; pm_runtime_enable(dev); mxr_info(mdev, "probe successful\n"); return 0; fail_video: mxr_release_video(mdev); fail_resources: mxr_release_resources(mdev); fail_mem: kfree(mdev); fail: dev_info(dev, "probe failed\n"); return ret; } static int mxr_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct mxr_device *mdev = to_mdev(dev); pm_runtime_disable(dev); mxr_release_layers(mdev); mxr_release_video(mdev); mxr_release_resources(mdev); kfree(mdev); dev_info(dev, "remove successful\n"); return 0; } static struct platform_driver mxr_driver __refdata = { .probe = mxr_probe, .remove = mxr_remove, .driver = { .name = MXR_DRIVER_NAME, .owner = THIS_MODULE, .pm = &mxr_pm_ops, } }; static int __init mxr_init(void) { int i, ret; static const char banner[] __initconst = "Samsung TV Mixer driver, " "(c) 2010-2011 Samsung Electronics Co., Ltd.\n"; pr_info("%s\n", banner); /* Loading auxiliary modules */ for (i = 0; i < ARRAY_SIZE(mxr_output_conf); ++i) request_module(mxr_output_conf[i].module_name); ret = platform_driver_register(&mxr_driver); if (ret != 0) { pr_err("s5p-tv: registration of MIXER driver failed\n"); return -ENXIO; } return 0; } module_init(mxr_init); static void __exit mxr_exit(void) { platform_driver_unregister(&mxr_driver); } module_exit(mxr_exit);
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <ContentKit/NBPhoneMetaData.h> __attribute__((visibility("hidden"))) @interface NBPhoneMetadataLA : NBPhoneMetaData { } - (id)init; @end
{ "pile_set_name": "Github" }
// run-pass // This used to generate invalid IR in that even if we took the // `false` branch we'd still try to free the Box from the other // arm. This was due to treating `*Box::new(9)` as an rvalue datum // instead of as a place. fn test(foo: bool) -> u8 { match foo { true => *Box::new(9), false => 0 } } fn main() { assert_eq!(9, test(true)); }
{ "pile_set_name": "Github" }
{ "cells": [ { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The autoreload extension is already loaded. To reload it, use:\n", " %reload_ext autoreload\n", "The autotime extension is already loaded. To reload it, use:\n", " %reload_ext autotime\n", "time: 9.2 ms\n" ] } ], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", "%load_ext autotime\n", "\n", "import numpy as np\n", "import pandas as pd\n", "import joblib\n", "\n", "import datetime\n", "import os\n", "import numpy as np\n", "import time\n", "import multiprocessing as mp\n", "import re " ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "time: 3.37 ms\n" ] } ], "source": [ "nss = [ 'article', 'user']\n", "years = range(2001,2016)\n", "\n", "\n", "samples = {}\n", "for ns in nss:\n", " for year in years:\n", " ind = os.path.join('../../data/samples', ns, 'clean', 'talk_diff_%d' % year)\n", " outd = 'comments_%s_%d' % (ns, year)\n", " samples[ind] = outd" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "../../data/samples/article/clean/talk_diff_2009\n", "../../data/samples/article/clean/talk_diff_2004\n", "../../data/samples/user/clean/talk_diff_2003\n", "../../data/samples/user/clean/talk_diff_2004\n", "../../data/samples/user/clean/talk_diff_2013\n", "../../data/samples/article/clean/talk_diff_2015\n", "../../data/samples/user/clean/talk_diff_2011\n", "../../data/samples/article/clean/talk_diff_2014\n", "../../data/samples/user/clean/talk_diff_2009\n", "../../data/samples/user/clean/talk_diff_2015\n", "../../data/samples/user/clean/talk_diff_2006\n", "../../data/samples/article/clean/talk_diff_2012\n", "../../data/samples/article/clean/talk_diff_2013\n", "../../data/samples/article/clean/talk_diff_2011\n", "../../data/samples/user/clean/talk_diff_2001\n", "../../data/samples/user/clean/talk_diff_2012\n", "../../data/samples/article/clean/talk_diff_2003\n", "../../data/samples/article/clean/talk_diff_2007\n", "../../data/samples/article/clean/talk_diff_2002\n", "../../data/samples/user/clean/talk_diff_2005\n", "../../data/samples/user/clean/talk_diff_2014\n", "../../data/samples/article/clean/talk_diff_2006\n", "../../data/samples/user/clean/talk_diff_2007\n", "../../data/samples/article/clean/talk_diff_2001\n", "../../data/samples/article/clean/talk_diff_2010\n", "../../data/samples/user/clean/talk_diff_2010\n", "../../data/samples/user/clean/talk_diff_2008\n", "../../data/samples/user/clean/talk_diff_2002\n", "../../data/samples/article/clean/talk_diff_2005\n", "../../data/samples/article/clean/talk_diff_2008\n", "time: 1h 43min 12s\n" ] } ], "source": [ "for ind, outd in samples.items():\n", " print(ind)\n", " os.system('rm -rf %s' % outd)\n", " os.system('mkdir %s' % outd)\n", " \n", " files = []\n", " for root, dirnames, filenames in os.walk(ind):\n", " for filename in filenames:\n", " if 'chunk' in filename:\n", " files.append(filename)\n", " \n", " for file in files:\n", " df = pd.read_csv(os.path.join(ind, file), sep = '\\t', encoding = 'utf-8')\n", " df = df.rename(columns={'clean_diff': 'comment',\n", " 'diff': 'raw_comment',\n", " 'rev_timestamp': 'timestamp',\n", " }\n", " )\n", " order = ['rev_id', 'comment', 'raw_comment', 'timestamp', 'page_id', 'page_title', 'user_id', 'user_text', 'bot', 'admin']\n", " df = df[order]\n", " df.to_csv(os.path.join(outd, file), sep = '\\t', index = False)\n", " \n", " os.chdir('../../data/figshare')\n", " os.system(\"tar -Pzcvf %s.tar.gz %s\" % (outd, outd))\n", " \n", " os.system(\"rm -rf %s\" % outd)\n", " " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python [default]", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.1" } }, "nbformat": 4, "nbformat_minor": 0 }
{ "pile_set_name": "Github" }
/* libSoX minimal glob for MS-Windows: (c) 2009 SoX contributors * * 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 */ #ifndef GLOB_H #define GLOB_H 1 #define GLOB_NOCHECK (16) #define GLOB_FLAGS (GLOB_NOCHECK) typedef struct glob_t { unsigned gl_pathc; char **gl_pathv; } glob_t; #ifdef __cplusplus extern "C" { #endif int glob( const char *pattern, int flags, void *unused, glob_t *pglob); void globfree( glob_t* pglob); #ifdef __cplusplus } #endif #endif /* ifndef GLOB_H */
{ "pile_set_name": "Github" }
/////////////////////////////////////////////////////////////////////////////// // Name: src/aui/floatpane.cpp // Purpose: wxaui: wx advanced user interface - docking window manager // Author: Benjamin I. Williams // Modified by: // Created: 2005-05-17 // RCS-ID: $Id$ // Copyright: (C) Copyright 2005-2006, Kirix Corporation, All Rights Reserved // Licence: wxWindows Library Licence, Version 3.1 /////////////////////////////////////////////////////////////////////////////// // ============================================================================ // declarations // ============================================================================ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #if wxUSE_AUI #include "wx/aui/framemanager.h" #include "wx/aui/floatpane.h" #include "wx/aui/dockart.h" #ifndef WX_PRECOMP #endif #ifdef __WXMSW__ #include "wx/msw/private.h" #endif IMPLEMENT_CLASS(wxAuiFloatingFrame, wxAuiFloatingFrameBaseClass) wxAuiFloatingFrame::wxAuiFloatingFrame(wxWindow* parent, wxAuiManager* owner_mgr, const wxAuiPaneInfo& pane, wxWindowID id /*= wxID_ANY*/, long style /*=wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT | wxCLIP_CHILDREN */) : wxAuiFloatingFrameBaseClass(parent, id, wxEmptyString, pane.floating_pos, pane.floating_size, style | (pane.HasCloseButton()?wxCLOSE_BOX:0) | (pane.HasMaximizeButton()?wxMAXIMIZE_BOX:0) | (pane.IsFixed()?0:wxRESIZE_BORDER) ) { m_owner_mgr = owner_mgr; m_moving = false; m_mgr.SetManagedWindow(this); m_solid_drag = true; // find out if the system supports solid window drag. // on non-msw systems, this is assumed to be the case #ifdef __WXMSW__ BOOL b = TRUE; SystemParametersInfo(38 /*SPI_GETDRAGFULLWINDOWS*/, 0, &b, 0); m_solid_drag = b ? true : false; #endif SetExtraStyle(wxWS_EX_PROCESS_IDLE); } wxAuiFloatingFrame::~wxAuiFloatingFrame() { // if we do not do this, then we can crash... if (m_owner_mgr && m_owner_mgr->m_action_window == this) { m_owner_mgr->m_action_window = NULL; } m_mgr.UnInit(); } void wxAuiFloatingFrame::SetPaneWindow(const wxAuiPaneInfo& pane) { m_pane_window = pane.window; m_pane_window->Reparent(this); wxAuiPaneInfo contained_pane = pane; contained_pane.Dock().Center().Show(). CaptionVisible(false). PaneBorder(false). Layer(0).Row(0).Position(0); // Carry over the minimum size wxSize pane_min_size = pane.window->GetMinSize(); // if the frame window's max size is greater than the min size // then set the max size to the min size as well wxSize cur_max_size = GetMaxSize(); if (cur_max_size.IsFullySpecified() && (cur_max_size.x < pane.min_size.x || cur_max_size.y < pane.min_size.y) ) { SetMaxSize(pane_min_size); } SetMinSize(pane.window->GetMinSize()); m_mgr.AddPane(m_pane_window, contained_pane); m_mgr.Update(); if (pane.min_size.IsFullySpecified()) { // because SetSizeHints() calls Fit() too (which sets the window // size to its minimum allowed), we keep the size before calling // SetSizeHints() and reset it afterwards... wxSize tmp = GetSize(); GetSizer()->SetSizeHints(this); SetSize(tmp); } SetTitle(pane.caption); if (pane.floating_size != wxDefaultSize) { SetSize(pane.floating_size); } else { wxSize size = pane.best_size; if (size == wxDefaultSize) size = pane.min_size; if (size == wxDefaultSize) size = m_pane_window->GetSize(); if (m_owner_mgr && pane.HasGripper()) { if (pane.HasGripperTop()) size.y += m_owner_mgr->m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); else size.x += m_owner_mgr->m_art->GetMetric(wxAUI_DOCKART_GRIPPER_SIZE); } SetClientSize(size); } if (pane.IsFixed()) { SetWindowStyleFlag(GetWindowStyleFlag() & ~wxRESIZE_BORDER); } } wxAuiManager* wxAuiFloatingFrame::GetOwnerManager() const { return m_owner_mgr; } void wxAuiFloatingFrame::OnSize(wxSizeEvent& WXUNUSED(event)) { if (m_owner_mgr) { m_owner_mgr->OnFloatingPaneResized(m_pane_window, GetRect()); } } void wxAuiFloatingFrame::OnClose(wxCloseEvent& evt) { if (m_owner_mgr) { m_owner_mgr->OnFloatingPaneClosed(m_pane_window, evt); } if (!evt.GetVeto()) { m_mgr.DetachPane(m_pane_window); Destroy(); } } void wxAuiFloatingFrame::OnMoveEvent(wxMoveEvent& event) { if (!m_solid_drag) { // systems without solid window dragging need to be // handled slightly differently, due to the lack of // the constant stream of EVT_MOVING events if (!isMouseDown()) return; OnMoveStart(); OnMoving(event.GetRect(), wxNORTH); m_moving = true; return; } wxRect win_rect = GetRect(); if (win_rect == m_last_rect) return; // skip the first move event if (m_last_rect.IsEmpty()) { m_last_rect = win_rect; return; } // skip if moving too fast to avoid massive redraws and // jumping hint windows if ((abs(win_rect.x - m_last_rect.x) > 3) || (abs(win_rect.y - m_last_rect.y) > 3)) { m_last3_rect = m_last2_rect; m_last2_rect = m_last_rect; m_last_rect = win_rect; return; } // prevent frame redocking during resize if (m_last_rect.GetSize() != win_rect.GetSize()) { m_last3_rect = m_last2_rect; m_last2_rect = m_last_rect; m_last_rect = win_rect; return; } wxDirection dir = wxALL; int horiz_dist = abs(win_rect.x - m_last3_rect.x); int vert_dist = abs(win_rect.y - m_last3_rect.y); if (vert_dist >= horiz_dist) { if (win_rect.y < m_last3_rect.y) dir = wxNORTH; else dir = wxSOUTH; } else { if (win_rect.x < m_last3_rect.x) dir = wxWEST; else dir = wxEAST; } m_last3_rect = m_last2_rect; m_last2_rect = m_last_rect; m_last_rect = win_rect; if (!isMouseDown()) return; if (!m_moving) { OnMoveStart(); m_moving = true; } if (m_last3_rect.IsEmpty()) return; OnMoving(event.GetRect(), dir); } void wxAuiFloatingFrame::OnIdle(wxIdleEvent& event) { if (m_moving) { if (!isMouseDown()) { m_moving = false; OnMoveFinished(); } else { event.RequestMore(); } } } void wxAuiFloatingFrame::OnMoveStart() { // notify the owner manager that the pane has started to move if (m_owner_mgr) { m_owner_mgr->OnFloatingPaneMoveStart(m_pane_window); } } void wxAuiFloatingFrame::OnMoving(const wxRect& WXUNUSED(window_rect), wxDirection dir) { // notify the owner manager that the pane is moving if (m_owner_mgr) { m_owner_mgr->OnFloatingPaneMoving(m_pane_window, dir); } m_lastDirection = dir; } void wxAuiFloatingFrame::OnMoveFinished() { // notify the owner manager that the pane has finished moving if (m_owner_mgr) { m_owner_mgr->OnFloatingPaneMoved(m_pane_window, m_lastDirection); } } void wxAuiFloatingFrame::OnActivate(wxActivateEvent& event) { if (m_owner_mgr && event.GetActive()) { m_owner_mgr->OnFloatingPaneActivated(m_pane_window); } } // utility function which determines the state of the mouse button // (independant of having a wxMouseEvent handy) - utimately a better // mechanism for this should be found (possibly by adding the // functionality to wxWidgets itself) bool wxAuiFloatingFrame::isMouseDown() { return wxGetMouseState().LeftIsDown(); } BEGIN_EVENT_TABLE(wxAuiFloatingFrame, wxAuiFloatingFrameBaseClass) EVT_SIZE(wxAuiFloatingFrame::OnSize) EVT_MOVE(wxAuiFloatingFrame::OnMoveEvent) EVT_MOVING(wxAuiFloatingFrame::OnMoveEvent) EVT_CLOSE(wxAuiFloatingFrame::OnClose) EVT_IDLE(wxAuiFloatingFrame::OnIdle) EVT_ACTIVATE(wxAuiFloatingFrame::OnActivate) END_EVENT_TABLE() #endif // wxUSE_AUI
{ "pile_set_name": "Github" }
'use strict' Walker = require './API/Walker' Runner = require './API/Runner' Swimmer = require './API/Swimmer' # ============================== # CLIENT CODE # ============================== walker = new Walker runner = new Runner swimmer = new Swimmer walker.setNextRelay runner runner.setNextRelay swimmer console.log walker.go()
{ "pile_set_name": "Github" }
/* * ngene.h: nGene PCIe bridge driver * * Copyright (C) 2005-2007 Micronas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 only, as published by the Free Software Foundation. * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA * Or, point your browser to http://www.gnu.org/copyleft/gpl.html */ #ifndef _NGENE_H_ #define _NGENE_H_ #include <linux/types.h> #include <linux/sched.h> #include <linux/interrupt.h> #include <linux/i2c.h> #include <asm/dma.h> #include <linux/scatterlist.h> #include <linux/dvb/frontend.h> #include "dmxdev.h" #include "dvbdev.h" #include "dvb_demux.h" #include "dvb_ca_en50221.h" #include "dvb_frontend.h" #include "dvb_ringbuffer.h" #include "dvb_net.h" #include "cxd2099.h" #define DEVICE_NAME "ngene" #define NGENE_VID 0x18c3 #define NGENE_PID 0x0720 #ifndef VIDEO_CAP_VC1 #define VIDEO_CAP_AVC 128 #define VIDEO_CAP_H264 128 #define VIDEO_CAP_VC1 256 #define VIDEO_CAP_WMV9 256 #define VIDEO_CAP_MPEG4 512 #endif enum STREAM { STREAM_VIDEOIN1 = 0, /* ITU656 or TS Input */ STREAM_VIDEOIN2, STREAM_AUDIOIN1, /* I2S or SPI Input */ STREAM_AUDIOIN2, STREAM_AUDIOOUT, MAX_STREAM }; enum SMODE_BITS { SMODE_AUDIO_SPDIF = 0x20, SMODE_AVSYNC = 0x10, SMODE_TRANSPORT_STREAM = 0x08, SMODE_AUDIO_CAPTURE = 0x04, SMODE_VBI_CAPTURE = 0x02, SMODE_VIDEO_CAPTURE = 0x01 }; enum STREAM_FLAG_BITS { SFLAG_CHROMA_FORMAT_2COMP = 0x01, /* Chroma Format : 2's complement */ SFLAG_CHROMA_FORMAT_OFFSET = 0x00, /* Chroma Format : Binary offset */ SFLAG_ORDER_LUMA_CHROMA = 0x02, /* Byte order: Y,Cb,Y,Cr */ SFLAG_ORDER_CHROMA_LUMA = 0x00, /* Byte order: Cb,Y,Cr,Y */ SFLAG_COLORBAR = 0x04, /* Select colorbar */ }; #define PROGRAM_ROM 0x0000 #define PROGRAM_SRAM 0x1000 #define PERIPHERALS0 0x8000 #define PERIPHERALS1 0x9000 #define SHARED_BUFFER 0xC000 #define HOST_TO_NGENE (SHARED_BUFFER+0x0000) #define NGENE_TO_HOST (SHARED_BUFFER+0x0100) #define NGENE_COMMAND (SHARED_BUFFER+0x0200) #define NGENE_COMMAND_HI (SHARED_BUFFER+0x0204) #define NGENE_STATUS (SHARED_BUFFER+0x0208) #define NGENE_STATUS_HI (SHARED_BUFFER+0x020C) #define NGENE_EVENT (SHARED_BUFFER+0x0210) #define NGENE_EVENT_HI (SHARED_BUFFER+0x0214) #define VARIABLES (SHARED_BUFFER+0x0210) #define NGENE_INT_COUNTS (SHARED_BUFFER+0x0260) #define NGENE_INT_ENABLE (SHARED_BUFFER+0x0264) #define NGENE_VBI_LINE_COUNT (SHARED_BUFFER+0x0268) #define BUFFER_GP_XMIT (SHARED_BUFFER+0x0800) #define BUFFER_GP_RECV (SHARED_BUFFER+0x0900) #define EEPROM_AREA (SHARED_BUFFER+0x0A00) #define SG_V_IN_1 (SHARED_BUFFER+0x0A80) #define SG_VBI_1 (SHARED_BUFFER+0x0B00) #define SG_A_IN_1 (SHARED_BUFFER+0x0B80) #define SG_V_IN_2 (SHARED_BUFFER+0x0C00) #define SG_VBI_2 (SHARED_BUFFER+0x0C80) #define SG_A_IN_2 (SHARED_BUFFER+0x0D00) #define SG_V_OUT (SHARED_BUFFER+0x0D80) #define SG_A_OUT2 (SHARED_BUFFER+0x0E00) #define DATA_A_IN_1 (SHARED_BUFFER+0x0E80) #define DATA_A_IN_2 (SHARED_BUFFER+0x0F00) #define DATA_A_OUT (SHARED_BUFFER+0x0F80) #define DATA_V_IN_1 (SHARED_BUFFER+0x1000) #define DATA_V_IN_2 (SHARED_BUFFER+0x2000) #define DATA_V_OUT (SHARED_BUFFER+0x3000) #define DATA_FIFO_AREA (SHARED_BUFFER+0x1000) #define TIMESTAMPS 0xA000 #define SCRATCHPAD 0xA080 #define FORCE_INT 0xA088 #define FORCE_NMI 0xA090 #define INT_STATUS 0xA0A0 #define DEV_VER 0x9004 #define FW_DEBUG_DEFAULT (PROGRAM_SRAM+0x00FF) struct SG_ADDR { u64 start; u64 curr; u16 curr_ptr; u16 elements; u32 pad[3]; } __attribute__ ((__packed__)); struct SHARED_MEMORY { /* C000 */ u32 HostToNgene[64]; /* C100 */ u32 NgeneToHost[64]; /* C200 */ u64 NgeneCommand; u64 NgeneStatus; u64 NgeneEvent; /* C210 */ u8 pad1[0xc260 - 0xc218]; /* C260 */ u32 IntCounts; u32 IntEnable; /* C268 */ u8 pad2[0xd000 - 0xc268]; } __attribute__ ((__packed__)); struct BUFFER_STREAM_RESULTS { u32 Clock; /* Stream time in 100ns units */ u16 RemainingLines; /* Remaining lines in this field. 0 for complete field */ u8 FieldCount; /* Video field number */ u8 Flags; /* Bit 7 = Done, Bit 6 = seen, Bit 5 = overflow, Bit 0 = FieldID */ u16 BlockCount; /* Audio block count (unused) */ u8 Reserved[2]; u32 DTOUpdate; } __attribute__ ((__packed__)); struct HW_SCATTER_GATHER_ELEMENT { u64 Address; u32 Length; u32 Reserved; } __attribute__ ((__packed__)); struct BUFFER_HEADER { u64 Next; struct BUFFER_STREAM_RESULTS SR; u32 Number_of_entries_1; u32 Reserved5; u64 Address_of_first_entry_1; u32 Number_of_entries_2; u32 Reserved7; u64 Address_of_first_entry_2; } __attribute__ ((__packed__)); struct EVENT_BUFFER { u32 TimeStamp; u8 GPIOStatus; u8 UARTStatus; u8 RXCharacter; u8 EventStatus; u32 Reserved[2]; } __attribute__ ((__packed__)); /* Firmware commands. */ enum OPCODES { CMD_NOP = 0, CMD_FWLOAD_PREPARE = 0x01, CMD_FWLOAD_FINISH = 0x02, CMD_I2C_READ = 0x03, CMD_I2C_WRITE = 0x04, CMD_I2C_WRITE_NOSTOP = 0x05, CMD_I2C_CONTINUE_WRITE = 0x06, CMD_I2C_CONTINUE_WRITE_NOSTOP = 0x07, CMD_DEBUG_OUTPUT = 0x09, CMD_CONTROL = 0x10, CMD_CONFIGURE_BUFFER = 0x11, CMD_CONFIGURE_FREE_BUFFER = 0x12, CMD_SPI_READ = 0x13, CMD_SPI_WRITE = 0x14, CMD_MEM_READ = 0x20, CMD_MEM_WRITE = 0x21, CMD_SFR_READ = 0x22, CMD_SFR_WRITE = 0x23, CMD_IRAM_READ = 0x24, CMD_IRAM_WRITE = 0x25, CMD_SET_GPIO_PIN = 0x26, CMD_SET_GPIO_INT = 0x27, CMD_CONFIGURE_UART = 0x28, CMD_WRITE_UART = 0x29, MAX_CMD }; enum RESPONSES { OK = 0, ERROR = 1 }; struct FW_HEADER { u8 Opcode; u8 Length; } __attribute__ ((__packed__)); struct FW_I2C_WRITE { struct FW_HEADER hdr; u8 Device; u8 Data[250]; } __attribute__ ((__packed__)); struct FW_I2C_CONTINUE_WRITE { struct FW_HEADER hdr; u8 Data[250]; } __attribute__ ((__packed__)); struct FW_I2C_READ { struct FW_HEADER hdr; u8 Device; u8 Data[252]; /* followed by two bytes of read data count */ } __attribute__ ((__packed__)); struct FW_SPI_WRITE { struct FW_HEADER hdr; u8 ModeSelect; u8 Data[250]; } __attribute__ ((__packed__)); struct FW_SPI_READ { struct FW_HEADER hdr; u8 ModeSelect; u8 Data[252]; /* followed by two bytes of read data count */ } __attribute__ ((__packed__)); struct FW_FWLOAD_PREPARE { struct FW_HEADER hdr; } __attribute__ ((__packed__)); struct FW_FWLOAD_FINISH { struct FW_HEADER hdr; u16 Address; /* address of final block */ u16 Length; } __attribute__ ((__packed__)); /* * Meaning of FW_STREAM_CONTROL::Mode bits: * Bit 7: Loopback PEXin to PEXout using TVOut channel * Bit 6: AVLOOP * Bit 5: Audio select; 0=I2S, 1=SPDIF * Bit 4: AVSYNC * Bit 3: Enable transport stream * Bit 2: Enable audio capture * Bit 1: Enable ITU-Video VBI capture * Bit 0: Enable ITU-Video capture * * Meaning of FW_STREAM_CONTROL::Control bits (see UVI1_CTL) * Bit 7: continuous capture * Bit 6: capture one field * Bit 5: capture one frame * Bit 4: unused * Bit 3: starting field; 0=odd, 1=even * Bit 2: sample size; 0=8-bit, 1=10-bit * Bit 1: data format; 0=UYVY, 1=YUY2 * Bit 0: resets buffer pointers */ enum FSC_MODE_BITS { SMODE_LOOPBACK = 0x80, SMODE_AVLOOP = 0x40, _SMODE_AUDIO_SPDIF = 0x20, _SMODE_AVSYNC = 0x10, _SMODE_TRANSPORT_STREAM = 0x08, _SMODE_AUDIO_CAPTURE = 0x04, _SMODE_VBI_CAPTURE = 0x02, _SMODE_VIDEO_CAPTURE = 0x01 }; /* Meaning of FW_STREAM_CONTROL::Stream bits: * Bit 3: Audio sample count: 0 = relative, 1 = absolute * Bit 2: color bar select; 1=color bars, 0=CV3 decoder * Bits 1-0: stream select, UVI1, UVI2, TVOUT */ struct FW_STREAM_CONTROL { struct FW_HEADER hdr; u8 Stream; /* Stream number (UVI1, UVI2, TVOUT) */ u8 Control; /* Value written to UVI1_CTL */ u8 Mode; /* Controls clock source */ u8 SetupDataLen; /* Length of setup data, MSB=1 write backwards */ u16 CaptureBlockCount; /* Blocks (a 256 Bytes) to capture per buffer for TS and Audio */ u64 Buffer_Address; /* Address of first buffer header */ u16 BytesPerVideoLine; u16 MaxLinesPerField; u16 MinLinesPerField; u16 Reserved_1; u16 BytesPerVBILine; u16 MaxVBILinesPerField; u16 MinVBILinesPerField; u16 SetupDataAddr; /* ngene relative address of setup data */ u8 SetupData[32]; /* setup data */ } __attribute__((__packed__)); #define AUDIO_BLOCK_SIZE 256 #define TS_BLOCK_SIZE 256 struct FW_MEM_READ { struct FW_HEADER hdr; u16 address; } __attribute__ ((__packed__)); struct FW_MEM_WRITE { struct FW_HEADER hdr; u16 address; u8 data; } __attribute__ ((__packed__)); struct FW_SFR_IRAM_READ { struct FW_HEADER hdr; u8 address; } __attribute__ ((__packed__)); struct FW_SFR_IRAM_WRITE { struct FW_HEADER hdr; u8 address; u8 data; } __attribute__ ((__packed__)); struct FW_SET_GPIO_PIN { struct FW_HEADER hdr; u8 select; } __attribute__ ((__packed__)); struct FW_SET_GPIO_INT { struct FW_HEADER hdr; u8 select; } __attribute__ ((__packed__)); struct FW_SET_DEBUGMODE { struct FW_HEADER hdr; u8 debug_flags; } __attribute__ ((__packed__)); struct FW_CONFIGURE_BUFFERS { struct FW_HEADER hdr; u8 config; } __attribute__ ((__packed__)); enum _BUFFER_CONFIGS { /* 4k UVI1, 4k UVI2, 2k AUD1, 2k AUD2 (standard usage) */ BUFFER_CONFIG_4422 = 0, /* 3k UVI1, 3k UVI2, 3k AUD1, 3k AUD2 (4x TS input usage) */ BUFFER_CONFIG_3333 = 1, /* 8k UVI1, 0k UVI2, 2k AUD1, 2k I2SOut (HDTV decoder usage) */ BUFFER_CONFIG_8022 = 2, BUFFER_CONFIG_FW17 = 255, /* Use new FW 17 command */ }; struct FW_CONFIGURE_FREE_BUFFERS { struct FW_HEADER hdr; u8 UVI1_BufferLength; u8 UVI2_BufferLength; u8 TVO_BufferLength; u8 AUD1_BufferLength; u8 AUD2_BufferLength; u8 TVA_BufferLength; } __attribute__ ((__packed__)); struct FW_CONFIGURE_UART { struct FW_HEADER hdr; u8 UartControl; } __attribute__ ((__packed__)); enum _UART_CONFIG { _UART_BAUDRATE_19200 = 0, _UART_BAUDRATE_9600 = 1, _UART_BAUDRATE_4800 = 2, _UART_BAUDRATE_2400 = 3, _UART_RX_ENABLE = 0x40, _UART_TX_ENABLE = 0x80, }; struct FW_WRITE_UART { struct FW_HEADER hdr; u8 Data[252]; } __attribute__ ((__packed__)); struct ngene_command { u32 in_len; u32 out_len; union { u32 raw[64]; u8 raw8[256]; struct FW_HEADER hdr; struct FW_I2C_WRITE I2CWrite; struct FW_I2C_CONTINUE_WRITE I2CContinueWrite; struct FW_I2C_READ I2CRead; struct FW_STREAM_CONTROL StreamControl; struct FW_FWLOAD_PREPARE FWLoadPrepare; struct FW_FWLOAD_FINISH FWLoadFinish; struct FW_MEM_READ MemoryRead; struct FW_MEM_WRITE MemoryWrite; struct FW_SFR_IRAM_READ SfrIramRead; struct FW_SFR_IRAM_WRITE SfrIramWrite; struct FW_SPI_WRITE SPIWrite; struct FW_SPI_READ SPIRead; struct FW_SET_GPIO_PIN SetGpioPin; struct FW_SET_GPIO_INT SetGpioInt; struct FW_SET_DEBUGMODE SetDebugMode; struct FW_CONFIGURE_BUFFERS ConfigureBuffers; struct FW_CONFIGURE_FREE_BUFFERS ConfigureFreeBuffers; struct FW_CONFIGURE_UART ConfigureUart; struct FW_WRITE_UART WriteUart; } cmd; } __attribute__ ((__packed__)); #define NGENE_INTERFACE_VERSION 0x103 #define MAX_VIDEO_BUFFER_SIZE (417792) /* 288*1440 rounded up to next page */ #define MAX_AUDIO_BUFFER_SIZE (8192) /* Gives room for about 23msec@48KHz */ #define MAX_VBI_BUFFER_SIZE (28672) /* 1144*18 rounded up to next page */ #define MAX_TS_BUFFER_SIZE (98304) /* 512*188 rounded up to next page */ #define MAX_HDTV_BUFFER_SIZE (2080768) /* 541*1920*2 rounded up to next page Max: (1920x1080i60) */ #define OVERFLOW_BUFFER_SIZE (8192) #define RING_SIZE_VIDEO 4 #define RING_SIZE_AUDIO 8 #define RING_SIZE_TS 8 #define NUM_SCATTER_GATHER_ENTRIES 8 #define MAX_DMA_LENGTH (((MAX_VIDEO_BUFFER_SIZE + MAX_VBI_BUFFER_SIZE) * \ RING_SIZE_VIDEO * 2) + \ (MAX_AUDIO_BUFFER_SIZE * RING_SIZE_AUDIO * 2) + \ (MAX_TS_BUFFER_SIZE * RING_SIZE_TS * 4) + \ (RING_SIZE_VIDEO * PAGE_SIZE * 2) + \ (RING_SIZE_AUDIO * PAGE_SIZE * 2) + \ (RING_SIZE_TS * PAGE_SIZE * 4) + \ 8 * PAGE_SIZE + OVERFLOW_BUFFER_SIZE + PAGE_SIZE) #define EVENT_QUEUE_SIZE 16 /* Gathers the current state of a single channel. */ struct SBufferHeader { struct BUFFER_HEADER ngeneBuffer; /* Physical descriptor */ struct SBufferHeader *Next; void *Buffer1; struct HW_SCATTER_GATHER_ELEMENT *scList1; void *Buffer2; struct HW_SCATTER_GATHER_ELEMENT *scList2; }; /* Sizeof SBufferHeader aligned to next 64 Bit boundary (hw restriction) */ #define SIZEOF_SBufferHeader ((sizeof(struct SBufferHeader) + 63) & ~63) enum HWSTATE { HWSTATE_STOP, HWSTATE_STARTUP, HWSTATE_RUN, HWSTATE_PAUSE, }; enum KSSTATE { KSSTATE_STOP, KSSTATE_ACQUIRE, KSSTATE_PAUSE, KSSTATE_RUN, }; struct SRingBufferDescriptor { struct SBufferHeader *Head; /* Points to first buffer in ring buffer structure*/ u64 PAHead; /* Physical address of first buffer */ u32 MemSize; /* Memory size of allocated ring buffers (needed for freeing) */ u32 NumBuffers; /* Number of buffers in the ring */ u32 Buffer1Length; /* Allocated length of Buffer 1 */ u32 Buffer2Length; /* Allocated length of Buffer 2 */ void *SCListMem; /* Memory to hold scatter gather lists for this ring */ u64 PASCListMem; /* Physical address .. */ u32 SCListMemSize; /* Size of this memory */ }; enum STREAMMODEFLAGS { StreamMode_NONE = 0, /* Stream not used */ StreamMode_ANALOG = 1, /* Analog: Stream 0,1 = Video, 2,3 = Audio */ StreamMode_TSIN = 2, /* Transport stream input (all) */ StreamMode_HDTV = 4, /* HDTV: Maximum 1920x1080p30,1920x1080i60 (only stream 0) */ StreamMode_TSOUT = 8, /* Transport stream output (only stream 3) */ }; enum BufferExchangeFlags { BEF_EVEN_FIELD = 0x00000001, BEF_CONTINUATION = 0x00000002, BEF_MORE_DATA = 0x00000004, BEF_OVERFLOW = 0x00000008, DF_SWAP32 = 0x00010000, }; typedef void *(IBufferExchange)(void *, void *, u32, u32, u32); struct MICI_STREAMINFO { IBufferExchange *pExchange; IBufferExchange *pExchangeVBI; /* Secondary (VBI, ancillary) */ u8 Stream; u8 Flags; u8 Mode; u8 Reserved; u16 nLinesVideo; u16 nBytesPerLineVideo; u16 nLinesVBI; u16 nBytesPerLineVBI; u32 CaptureLength; /* Used for audio and transport stream */ }; /****************************************************************************/ /* STRUCTS ******************************************************************/ /****************************************************************************/ /* sound hardware definition */ #define MIXER_ADDR_TVTUNER 0 #define MIXER_ADDR_LAST 0 struct ngene_channel; /*struct sound chip*/ struct mychip { struct ngene_channel *chan; struct snd_card *card; struct pci_dev *pci; struct snd_pcm_substream *substream; struct snd_pcm *pcm; unsigned long port; int irq; spinlock_t mixer_lock; spinlock_t lock; int mixer_volume[MIXER_ADDR_LAST + 1][2]; int capture_source[MIXER_ADDR_LAST + 1][2]; }; #ifdef NGENE_V4L struct ngene_overlay { int tvnorm; struct v4l2_rect w; enum v4l2_field field; struct v4l2_clip *clips; int nclips; int setup_ok; }; struct ngene_tvnorm { int v4l2_id; char *name; u16 swidth, sheight; /* scaled standard width, height */ int tuner_norm; int soundstd; }; struct ngene_vopen { struct ngene_channel *ch; enum v4l2_priority prio; int width; int height; int depth; struct videobuf_queue vbuf_q; struct videobuf_queue vbi; int fourcc; int picxcount; int resources; enum v4l2_buf_type type; const struct ngene_format *fmt; const struct ngene_format *ovfmt; struct ngene_overlay ov; }; #endif struct ngene_channel { struct device device; struct i2c_adapter i2c_adapter; struct ngene *dev; int number; int type; int mode; bool has_adapter; bool has_demux; int demod_type; int (*gate_ctrl)(struct dvb_frontend *, int); struct dvb_frontend *fe; struct dvb_frontend *fe2; struct dmxdev dmxdev; struct dvb_demux demux; struct dvb_net dvbnet; struct dmx_frontend hw_frontend; struct dmx_frontend mem_frontend; int users; struct video_device *v4l_dev; struct dvb_device *ci_dev; struct tasklet_struct demux_tasklet; struct SBufferHeader *nextBuffer; enum KSSTATE State; enum HWSTATE HWState; u8 Stream; u8 Flags; u8 Mode; IBufferExchange *pBufferExchange; IBufferExchange *pBufferExchange2; spinlock_t state_lock; u16 nLines; u16 nBytesPerLine; u16 nVBILines; u16 nBytesPerVBILine; u16 itumode; u32 Capture1Length; u32 Capture2Length; struct SRingBufferDescriptor RingBuffer; struct SRingBufferDescriptor TSRingBuffer; struct SRingBufferDescriptor TSIdleBuffer; u32 DataFormatFlags; int AudioDTOUpdated; u32 AudioDTOValue; int (*set_tone)(struct dvb_frontend *, fe_sec_tone_mode_t); u8 lnbh; /* stuff from analog driver */ int minor; struct mychip *mychip; struct snd_card *soundcard; u8 *evenbuffer; u8 dma_on; int soundstreamon; int audiomute; int soundbuffisallocated; int sndbuffflag; int tun_rdy; int dec_rdy; int tun_dec_rdy; int lastbufferflag; struct ngene_tvnorm *tvnorms; int tvnorm_num; int tvnorm; #ifdef NGENE_V4L int videousers; struct v4l2_prio_state prio; struct ngene_vopen init; int resources; struct v4l2_framebuffer fbuf; struct ngene_buffer *screen; /* overlay */ struct list_head capture; /* video capture queue */ spinlock_t s_lock; struct semaphore reslock; #endif int running; }; struct ngene_ci { struct device device; struct i2c_adapter i2c_adapter; struct ngene *dev; struct dvb_ca_en50221 *en; }; struct ngene; typedef void (rx_cb_t)(struct ngene *, u32, u8); typedef void (tx_cb_t)(struct ngene *, u32); struct ngene { int nr; struct pci_dev *pci_dev; unsigned char *iomem; /*struct i2c_adapter i2c_adapter;*/ u32 device_version; u32 fw_interface_version; u32 icounts; bool msi_enabled; bool cmd_timeout_workaround; u8 *CmdDoneByte; int BootFirmware; void *OverflowBuffer; dma_addr_t PAOverflowBuffer; void *FWInterfaceBuffer; dma_addr_t PAFWInterfaceBuffer; u8 *ngenetohost; u8 *hosttongene; struct EVENT_BUFFER EventQueue[EVENT_QUEUE_SIZE]; int EventQueueOverflowCount; int EventQueueOverflowFlag; struct tasklet_struct event_tasklet; struct EVENT_BUFFER *EventBuffer; int EventQueueWriteIndex; int EventQueueReadIndex; wait_queue_head_t cmd_wq; int cmd_done; struct semaphore cmd_mutex; struct semaphore stream_mutex; struct semaphore pll_mutex; struct semaphore i2c_switch_mutex; int i2c_current_channel; int i2c_current_bus; spinlock_t cmd_lock; struct dvb_adapter adapter[MAX_STREAM]; struct dvb_adapter *first_adapter; /* "one_adapter" modprobe opt */ struct ngene_channel channel[MAX_STREAM]; struct ngene_info *card_info; tx_cb_t *TxEventNotify; rx_cb_t *RxEventNotify; int tx_busy; wait_queue_head_t tx_wq; wait_queue_head_t rx_wq; #define UART_RBUF_LEN 4096 u8 uart_rbuf[UART_RBUF_LEN]; int uart_rp, uart_wp; #define TS_FILLER 0x6f u8 *tsout_buf; #define TSOUT_BUF_SIZE (512*188*8) struct dvb_ringbuffer tsout_rbuf; u8 *tsin_buf; #define TSIN_BUF_SIZE (512*188*8) struct dvb_ringbuffer tsin_rbuf; u8 *ain_buf; #define AIN_BUF_SIZE (128*1024) struct dvb_ringbuffer ain_rbuf; u8 *vin_buf; #define VIN_BUF_SIZE (4*1920*1080) struct dvb_ringbuffer vin_rbuf; unsigned long exp_val; int prev_cmd; struct ngene_ci ci; }; struct ngene_info { int type; #define NGENE_APP 0 #define NGENE_TERRATEC 1 #define NGENE_SIDEWINDER 2 #define NGENE_RACER 3 #define NGENE_VIPER 4 #define NGENE_PYTHON 5 #define NGENE_VBOX_V1 6 #define NGENE_VBOX_V2 7 int fw_version; bool msi_supported; char *name; int io_type[MAX_STREAM]; #define NGENE_IO_NONE 0 #define NGENE_IO_TV 1 #define NGENE_IO_HDTV 2 #define NGENE_IO_TSIN 4 #define NGENE_IO_TSOUT 8 #define NGENE_IO_AIN 16 void *fe_config[4]; void *tuner_config[4]; int (*demod_attach[4])(struct ngene_channel *); int (*tuner_attach[4])(struct ngene_channel *); u8 avf[4]; u8 msp[4]; u8 demoda[4]; u8 lnb[4]; int i2c_access; u8 ntsc; u8 tsf[4]; u8 i2s[4]; int (*gate_ctrl)(struct dvb_frontend *, int); int (*switch_ctrl)(struct ngene_channel *, int, int); }; #ifdef NGENE_V4L struct ngene_format { char *name; int fourcc; /* video4linux 2 */ int btformat; /* BT848_COLOR_FMT_* */ int format; int btswap; /* BT848_COLOR_CTL_* */ int depth; /* bit/pixel */ int flags; int hshift, vshift; /* for planar modes */ int palette; }; #define RESOURCE_OVERLAY 1 #define RESOURCE_VIDEO 2 #define RESOURCE_VBI 4 struct ngene_buffer { /* common v4l buffer stuff -- must be first */ struct videobuf_buffer vb; /* ngene specific */ const struct ngene_format *fmt; int tvnorm; int btformat; int btswap; }; #endif /* Provided by ngene-core.c */ int __devinit ngene_probe(struct pci_dev *pci_dev, const struct pci_device_id *id); void __devexit ngene_remove(struct pci_dev *pdev); void ngene_shutdown(struct pci_dev *pdev); int ngene_command(struct ngene *dev, struct ngene_command *com); int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level); void set_transfer(struct ngene_channel *chan, int state); void FillTSBuffer(void *Buffer, int Length, u32 Flags); /* Provided by ngene-i2c.c */ int ngene_i2c_init(struct ngene *dev, int dev_nr); /* Provided by ngene-dvb.c */ extern struct dvb_device ngene_dvbdev_ci; void *tsout_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags); void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags); int ngene_start_feed(struct dvb_demux_feed *dvbdmxfeed); int ngene_stop_feed(struct dvb_demux_feed *dvbdmxfeed); int my_dvb_dmx_ts_card_init(struct dvb_demux *dvbdemux, char *id, int (*start_feed)(struct dvb_demux_feed *), int (*stop_feed)(struct dvb_demux_feed *), void *priv); int my_dvb_dmxdev_ts_card_init(struct dmxdev *dmxdev, struct dvb_demux *dvbdemux, struct dmx_frontend *hw_frontend, struct dmx_frontend *mem_frontend, struct dvb_adapter *dvb_adapter); #endif /* LocalWords: Endif */
{ "pile_set_name": "Github" }
export PATH=/adt32/ant/bin:$PATH export JAVA_HOME=/Program Files (x86)/Java/jdk1.7.0_21 cd /adt32/eclipse/workspace/AppPinchZoomGestureDemo1 ant clean release
{ "pile_set_name": "Github" }
/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS Kernel Streaming * FILE: drivers/wdm/audio/backpln/portcls/pin_dmus.cpp * PURPOSE: DMus IRP Audio Pin * PROGRAMMER: Johannes Anderwald */ #include "private.hpp" #ifndef YDEBUG #define NDEBUG #endif #include <debug.h> class CPortPinDMus : public IPortPinDMus { public: STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface); STDMETHODIMP_(ULONG) AddRef() { InterlockedIncrement(&m_Ref); return m_Ref; } STDMETHODIMP_(ULONG) Release() { InterlockedDecrement(&m_Ref); if (!m_Ref) { delete this; return 0; } return m_Ref; } IMP_IPortPinDMus; IMP_IServiceSink; IMP_IMasterClock; IMP_IAllocatorMXF; CPortPinDMus(IUnknown * OuterUnknown){} virtual ~CPortPinDMus(){} protected: VOID TransferMidiDataToDMus(); VOID TransferMidiData(); IPortDMus * m_Port; IPortFilterDMus * m_Filter; KSPIN_DESCRIPTOR * m_KsPinDescriptor; PMINIPORTDMUS m_Miniport; PSERVICEGROUP m_ServiceGroup; PMXF m_Mxf; ULONGLONG m_SchedulePreFetch; NPAGED_LOOKASIDE_LIST m_LookAsideEvent; NPAGED_LOOKASIDE_LIST m_LookAsideBuffer; PMINIPORTMIDI m_MidiMiniport; PMINIPORTMIDISTREAM m_MidiStream; KSSTATE m_State; PKSDATAFORMAT m_Format; KSPIN_CONNECT * m_ConnectDetails; DMUS_STREAM_TYPE m_Capture; PDEVICE_OBJECT m_DeviceObject; IIrpQueue * m_IrpQueue; ULONG m_TotalPackets; ULONG m_PreCompleted; ULONG m_PostCompleted; ULONG m_LastTag; LONG m_Ref; }; typedef struct { DMUS_KERNEL_EVENT Event; PVOID Tag; }DMUS_KERNEL_EVENT_WITH_TAG, *PDMUS_KERNEL_EVENT_WITH_TAG; typedef struct { CPortPinDMus *Pin; PIO_WORKITEM WorkItem; KSSTATE State; }SETSTREAM_CONTEXT, *PSETSTREAM_CONTEXT; //================================================================================================================================== NTSTATUS NTAPI CPortPinDMus::GetTime(OUT REFERENCE_TIME *prtTime) { UNIMPLEMENTED; return STATUS_SUCCESS; } //================================================================================================================================== NTSTATUS NTAPI CPortPinDMus::GetMessage( OUT PDMUS_KERNEL_EVENT * ppDMKEvt) { PVOID Buffer; Buffer = ExAllocateFromNPagedLookasideList(&m_LookAsideEvent); if (!Buffer) return STATUS_INSUFFICIENT_RESOURCES; *ppDMKEvt = (PDMUS_KERNEL_EVENT)Buffer; RtlZeroMemory(Buffer, sizeof(DMUS_KERNEL_EVENT)); return STATUS_SUCCESS; } USHORT NTAPI CPortPinDMus::GetBufferSize() { return PAGE_SIZE; } NTSTATUS NTAPI CPortPinDMus::GetBuffer( OUT PBYTE * ppBuffer) { PVOID Buffer; Buffer = ExAllocateFromNPagedLookasideList(&m_LookAsideBuffer); if (!Buffer) return STATUS_INSUFFICIENT_RESOURCES; *ppBuffer = (PBYTE)Buffer; RtlZeroMemory(Buffer, PAGE_SIZE); return STATUS_SUCCESS; } NTSTATUS NTAPI CPortPinDMus::PutBuffer( IN PBYTE pBuffer) { PDMUS_KERNEL_EVENT_WITH_TAG Event = (PDMUS_KERNEL_EVENT_WITH_TAG)pBuffer; m_IrpQueue->ReleaseMappingWithTag(Event->Tag); ExFreeToNPagedLookasideList(&m_LookAsideBuffer, pBuffer); return STATUS_SUCCESS; } NTSTATUS NTAPI CPortPinDMus::SetState( IN KSSTATE State) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } NTSTATUS NTAPI CPortPinDMus::PutMessage( IN PDMUS_KERNEL_EVENT pDMKEvt) { ExFreeToNPagedLookasideList(&m_LookAsideEvent, pDMKEvt); return STATUS_SUCCESS; } NTSTATUS NTAPI CPortPinDMus::ConnectOutput( IN PMXF sinkMXF) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } NTSTATUS NTAPI CPortPinDMus::DisconnectOutput( IN PMXF sinkMXF) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } //================================================================================================================================== VOID CPortPinDMus::TransferMidiData() { NTSTATUS Status; PUCHAR Buffer; ULONG BufferSize; ULONG BytesWritten; do { Status = m_IrpQueue->GetMapping(&Buffer, &BufferSize); if (!NT_SUCCESS(Status)) { return; } if (m_Capture) { Status = m_MidiStream->Read(Buffer, BufferSize, &BytesWritten); if (!NT_SUCCESS(Status)) { DPRINT("Read failed with %x\n", Status); return; } } else { Status = m_MidiStream->Write(Buffer, BufferSize, &BytesWritten); if (!NT_SUCCESS(Status)) { DPRINT("Write failed with %x\n", Status); return; } } if (!BytesWritten) { DPRINT("Device is busy retry later\n"); return; } m_IrpQueue->UpdateMapping(BytesWritten); }while(TRUE); } VOID CPortPinDMus::TransferMidiDataToDMus() { NTSTATUS Status; PHYSICAL_ADDRESS PhysicalAddress; ULONG BufferSize, Flags; PVOID Buffer; PDMUS_KERNEL_EVENT_WITH_TAG Event, LastEvent = NULL, Root = NULL; do { m_LastTag++; Status = m_IrpQueue->GetMappingWithTag(UlongToPtr(m_LastTag), &PhysicalAddress, &Buffer, &BufferSize, &Flags); if (!NT_SUCCESS(Status)) { break; } Status = GetMessage((PDMUS_KERNEL_EVENT*)&Event); if (!NT_SUCCESS(Status)) break; //FIXME //set up struct //Event->Event.usFlags = DMUS_KEF_EVENT_COMPLETE; Event->Event.cbStruct = sizeof(DMUS_KERNEL_EVENT); Event->Event.cbEvent = (USHORT)BufferSize; Event->Event.uData.pbData = (PBYTE)Buffer; if (!Root) Root = Event; else LastEvent->Event.pNextEvt = (struct _DMUS_KERNEL_EVENT *)Event; LastEvent = Event; LastEvent->Event.pNextEvt = NULL; LastEvent->Tag = UlongToPtr(m_LastTag); }while(TRUE); if (!Root) { return; } Status = m_Mxf->PutMessage((PDMUS_KERNEL_EVENT)Root); DPRINT("Status %x\n", Status); } VOID NTAPI CPortPinDMus::RequestService() { PC_ASSERT_IRQL(DISPATCH_LEVEL); if (m_MidiStream) { TransferMidiData(); } else if (m_Mxf) { TransferMidiDataToDMus(); } } //================================================================================================================================== NTSTATUS NTAPI CPortPinDMus::QueryInterface( IN REFIID refiid, OUT PVOID* Output) { if (IsEqualGUIDAligned(refiid, IID_IIrpTarget) || IsEqualGUIDAligned(refiid, IID_IUnknown)) { *Output = PVOID(PUNKNOWN(this)); PUNKNOWN(*Output)->AddRef(); return STATUS_SUCCESS; } return STATUS_UNSUCCESSFUL; } NTSTATUS NTAPI CPortPinDMus::NewIrpTarget( OUT struct IIrpTarget **OutTarget, IN PCWSTR Name, IN PUNKNOWN Unknown, IN POOL_TYPE PoolType, IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN KSOBJECT_CREATE *CreateObject) { UNIMPLEMENTED; Irp->IoStatus.Information = 0; Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_UNSUCCESSFUL; } NTSTATUS NTAPI CPortPinDMus::DeviceIoControl( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { UNIMPLEMENTED; Irp->IoStatus.Information = 0; Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_UNSUCCESSFUL; } NTSTATUS NTAPI CPortPinDMus::Read( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); } NTSTATUS NTAPI CPortPinDMus::Write( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); } NTSTATUS NTAPI CPortPinDMus::Flush( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); } NTSTATUS NTAPI CPortPinDMus::Close( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { NTSTATUS Status; ISubdevice * SubDevice; PSUBDEVICE_DESCRIPTOR Descriptor; if (m_ServiceGroup) { m_ServiceGroup->RemoveMember(PSERVICESINK(this)); } if (m_MidiStream) { if (m_State != KSSTATE_STOP) { m_MidiStream->SetState(KSSTATE_STOP); m_State = KSSTATE_STOP; } DPRINT("Closing stream at Irql %u\n", KeGetCurrentIrql()); m_MidiStream->Release(); } Status = m_Port->QueryInterface(IID_ISubdevice, (PVOID*)&SubDevice); if (NT_SUCCESS(Status)) { Status = SubDevice->GetDescriptor(&Descriptor); if (NT_SUCCESS(Status)) { // release reference count Descriptor->Factory.Instances[m_ConnectDetails->PinId].CurrentPinInstanceCount--; } SubDevice->Release(); } if (m_Format) { FreeItem(m_Format, TAG_PORTCLASS); m_Format = NULL; } // complete the irp Irp->IoStatus.Information = 0; Irp->IoStatus.Status = STATUS_SUCCESS; IoCompleteRequest(Irp, IO_NO_INCREMENT); // destroy DMus pin m_Filter->FreePin(PPORTPINDMUS(this)); return STATUS_SUCCESS; } NTSTATUS NTAPI CPortPinDMus::QuerySecurity( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); } NTSTATUS NTAPI CPortPinDMus::SetSecurity( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { return KsDispatchInvalidDeviceRequest(DeviceObject, Irp); } BOOLEAN NTAPI CPortPinDMus::FastDeviceIoControl( IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN ULONG IoControlCode, OUT PIO_STATUS_BLOCK StatusBlock, IN PDEVICE_OBJECT DeviceObject) { return FALSE; } BOOLEAN NTAPI CPortPinDMus::FastRead( IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, IN PVOID Buffer, OUT PIO_STATUS_BLOCK StatusBlock, IN PDEVICE_OBJECT DeviceObject) { return FALSE; } BOOLEAN NTAPI CPortPinDMus::FastWrite( IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, IN PVOID Buffer, OUT PIO_STATUS_BLOCK StatusBlock, IN PDEVICE_OBJECT DeviceObject) { return FALSE; } NTSTATUS NTAPI CPortPinDMus::Init( IN PPORTDMUS Port, IN PPORTFILTERDMUS Filter, IN KSPIN_CONNECT * ConnectDetails, IN KSPIN_DESCRIPTOR * KsPinDescriptor, IN PDEVICE_OBJECT DeviceObject) { NTSTATUS Status; PKSDATAFORMAT DataFormat; DMUS_STREAM_TYPE Type; Port->AddRef(); Filter->AddRef(); m_Port = Port; m_Filter = Filter; m_KsPinDescriptor = KsPinDescriptor; m_ConnectDetails = ConnectDetails; m_DeviceObject = DeviceObject; GetDMusMiniport(Port, &m_Miniport, &m_MidiMiniport); DataFormat = (PKSDATAFORMAT)(ConnectDetails + 1); DPRINT("CPortPinDMus::Init entered\n"); m_Format = (PKSDATAFORMAT)AllocateItem(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS); if (!m_Format) return STATUS_INSUFFICIENT_RESOURCES; RtlMoveMemory(m_Format, DataFormat, DataFormat->FormatSize); if (KsPinDescriptor->Communication == KSPIN_COMMUNICATION_SINK && KsPinDescriptor->DataFlow == KSPIN_DATAFLOW_IN) { Type = DMUS_STREAM_MIDI_RENDER; } else if (KsPinDescriptor->Communication == KSPIN_COMMUNICATION_SINK && KsPinDescriptor->DataFlow == KSPIN_DATAFLOW_OUT) { Type = DMUS_STREAM_MIDI_CAPTURE; } else { DPRINT("Unexpected Communication %u DataFlow %u\n", KsPinDescriptor->Communication, KsPinDescriptor->DataFlow); DbgBreakPoint(); while(TRUE); } Status = NewIrpQueue(&m_IrpQueue); if (!NT_SUCCESS(Status)) { DPRINT("Failed to allocate IrpQueue with %x\n", Status); return Status; } if (m_MidiMiniport) { Status = m_MidiMiniport->NewStream(&m_MidiStream, NULL, NonPagedPool, ConnectDetails->PinId, Type, m_Format, &m_ServiceGroup); DPRINT("CPortPinDMus::Init Status %x\n", Status); if (!NT_SUCCESS(Status)) return Status; } else { Status = m_Miniport->NewStream(&m_Mxf, NULL, NonPagedPool, ConnectDetails->PinId, Type, m_Format, &m_ServiceGroup, PAllocatorMXF(this), PMASTERCLOCK(this),&m_SchedulePreFetch); DPRINT("CPortPinDMus::Init Status %x\n", Status); if (!NT_SUCCESS(Status)) return Status; if (Type == DMUS_STREAM_MIDI_CAPTURE) { Status = m_Mxf->ConnectOutput(PMXF(this)); if (!NT_SUCCESS(Status)) { DPRINT("IMXF_ConnectOutput failed with Status %x\n", Status); return Status; } } ExInitializeNPagedLookasideList(&m_LookAsideEvent, NULL, NULL, 0, sizeof(DMUS_KERNEL_EVENT_WITH_TAG), TAG_PORTCLASS, 0); ExInitializeNPagedLookasideList(&m_LookAsideBuffer, NULL, NULL, 0, PAGE_SIZE, TAG_PORTCLASS, 0); } if (m_ServiceGroup) { Status = m_ServiceGroup->AddMember(PSERVICESINK(this)); if (!NT_SUCCESS(Status)) { DPRINT("Failed to add pin to service group\n"); return Status; } } Status = m_IrpQueue->Init(ConnectDetails, KsPinDescriptor, 0, 0, FALSE); if (!NT_SUCCESS(Status)) { DPRINT("IrpQueue_Init failed with %x\n", Status); return Status; } m_State = KSSTATE_STOP; m_Capture = Type; return STATUS_SUCCESS; } VOID NTAPI CPortPinDMus::Notify() { m_ServiceGroup->RequestService(); } NTSTATUS NewPortPinDMus( OUT IPortPinDMus ** OutPin) { CPortPinDMus * This; This = new (NonPagedPool, TAG_PORTCLASS)CPortPinDMus(NULL); if (!This) return STATUS_INSUFFICIENT_RESOURCES; This->AddRef(); // store result *OutPin = (IPortPinDMus*)This; return STATUS_SUCCESS; }
{ "pile_set_name": "Github" }
module github.com/denis-tingajkin/go-header go 1.13 require ( github.com/fatih/color v1.9.0 github.com/sirupsen/logrus v1.6.0 github.com/stretchr/testify v1.5.1 gopkg.in/yaml.v2 v2.2.2 )
{ "pile_set_name": "Github" }
# frozen_string_literal: true module Twemoji module Utils module Unicode # Convert raw unicode to string key version. # # e.g. 🇲🇾 converts to "1f1f2-1f1fe" # # @param unicode [String] Unicode codepoint. # @param connector [String] (optional) connector to join codepoints # # @return [String] codepoints of unicode join by connector argument, defaults to "-". def self.unpack(unicode, connector: "-") unicode.split("").map { |r| "%x" % r.ord }.join(connector) end end end end
{ "pile_set_name": "Github" }
# GUI & In Web Browsers Weekly Sync 2018-10-15 - **Lead:** @olizilla - **Notetaker:** @lidel - **Attendees:** - @fsdiogo - @olizilla - @hacdias ## Goals - [Web Browsers WG](https://github.com/ipfs/in-web-browsers) - Browser developers are addressing requirements of the distributed web - Ensure smooth experience for web developers in browser contexts - Browser extension exposes IPFS features in a robust and intuitive form - [GUI WG](https://github.com/ipfs/ipfs-gui) - Core IPFS features are intuitive and accessible to all - Everyone is empowered to make great new IPFS user interfaces - The GUIs push forward understanding and adoption of IPFS ## Agenda ### Before the Sync - Write down your updates - What have you accomplished since the last Weekly? - Were there any blockers? If so, which ones? Is it still blocked? Why? - What is the next important thing you should focus on? - Read updates of others - Any there any questions, requests to communicate? ### Regular - Ask everyone to put their name into the list of attendees - Go over everyone's updates and ask if there are any questions or things to discuss - Everyone can demo something! - Ask for general questions. Could be things like: - I'm stuck with something, I don't know who to ask. Who knows who to ask? - Who can help me with xyz? ### Added - Lab Week Summary? - Priorities for GUI team ## Notes ### Team Updates - @lidel - Done (mostly before lab week): - [created cross-platform orchestration for fetching webui from ipfs during companion build](https://github.com/ipfs-shipyard/ipfs-companion/pull/590#issuecomment-426827936) - [investigated upload issues with ipfs-cluster](https://github.com/ipfs-shipyard/ipfs-companion/issues/600) - [decoupled blog.ipfs.io from ipfs.io and fixed various bugs related to IPNS and DNSLink](https://github.com/ipfs/website/issues/274#issuecomment-427210000), tl;dr being: - PR: [fix: redirect /blog to blog.ipfs.io with IPNS support](https://github.com/ipfs/website/pull/275) - PR: [fix: blog permalinks that work on IPNS](https://github.com/ipfs/blog/pull/182) - Lab Week - Next: - Go over AI from Lab Week notes - New Bugfix Beta of Companion - @fsdiogo - Done: - Add CORS config instructions to Share Files and WebUI - https://github.com/ipfs-shipyard/ipfs-share-files/pull/40 - https://github.com/ipfs-shipyard/ipfs-webui/pull/839 - Add fixed footer with code links - https://github.com/ipfs-shipyard/ipfs-webui/pull/809 - Add git revision - https://github.com/ipfs-shipyard/ipfs-webui/pull/844 - Add Web UI intro to files page - https://github.com/ipfs-shipyard/ipfs-webui/pull/847 - Glasgow Team Week ### Discussion Highlights - Plan for ipfs-desktop - focus on basics for first iteration - visual revamp / wireframes / i18n - autoupdates for ipfs-desktop AND go-ipfs shipped with it - Plan for ipfs-share-files - come up with better onboarding text - Additional work around GUI - paginated directory listing - alternative to http polling (realtime API) - in general, identify missing APIs and communicate to *-ipfs ### Action Items - @all go over backlogs and AIs from Team Week
{ "pile_set_name": "Github" }
package xyz.hisname.fireflyiii.workers import android.content.Context import androidx.preference.PreferenceManager import androidx.work.* import xyz.hisname.fireflyiii.data.local.dao.AppDatabase import xyz.hisname.fireflyiii.data.local.pref.AppPref import xyz.hisname.fireflyiii.data.remote.firefly.api.CategoryService import xyz.hisname.fireflyiii.repository.category.CategoryRepository import xyz.hisname.fireflyiii.util.network.HttpConstants import java.time.Duration import java.util.concurrent.TimeUnit class DeleteCategoryWorker(private val context: Context, workerParameters: WorkerParameters): BaseWorker(context, workerParameters) { private val categoryDao by lazy { AppDatabase.getInstance(context).categoryDataDao() } companion object { fun initPeriodicWorker(categoryId: Long, context: Context) { val categoryTag = WorkManager.getInstance(context).getWorkInfosByTag("delete_periodic_category_$categoryId").get() if (categoryTag == null || categoryTag.size == 0) { val categoryData = Data.Builder() .putLong("categoryId", categoryId) .build() val appPref = AppPref(PreferenceManager.getDefaultSharedPreferences(context)) val delay = appPref.workManagerDelay val battery = appPref.workManagerLowBattery val networkType = appPref.workManagerNetworkType val requireCharging = appPref.workManagerRequireCharging val deleteCategoryWork = PeriodicWorkRequestBuilder<DeleteCurrencyWorker>(Duration.ofMinutes(delay)) .setInputData(categoryData) .addTag("delete_periodic_category_$categoryId") .setConstraints(Constraints.Builder() .setRequiredNetworkType(networkType) .setRequiresBatteryNotLow(battery) .setRequiresCharging(requireCharging) .build()) .build() WorkManager.getInstance(context).enqueue(deleteCategoryWork) } } fun cancelWorker(categoryId: Long, context: Context){ WorkManager.getInstance(context).cancelAllWorkByTag("delete_periodic_category_$categoryId") } } override suspend fun doWork(): Result { val categoryId = inputData.getLong("categoryId", 0) val repository = CategoryRepository(categoryDao, genericService?.create(CategoryService::class.java)) return when (repository.deleteCategoryById(categoryId)) { HttpConstants.NO_CONTENT_SUCCESS -> { cancelWorker(categoryId, context) Result.success() } HttpConstants.FAILED -> { Result.retry() } else -> { Result.failure() } } } }
{ "pile_set_name": "Github" }
#!/usr/bin/env perl # ==================================================================== # Copyright (c) 2008 Andy Polyakov <appro@openssl.org> # # This module may be used under the terms of either the GNU General # Public License version 2 or later, the GNU Lesser General Public # License version 2.1 or later, the Mozilla Public License version # 1.1 or the BSD License. The exact terms of either license are # distributed along with this module. For further details see # http://www.openssl.org/~appro/camellia/. # ==================================================================== # Performance in cycles per processed byte (less is better) in # 'openssl speed ...' benchmark: # # AMD64 Core2 EM64T # -evp camellia-128-ecb 16.7 21.0 22.7 # + over gcc 3.4.6 +25% +5% 0% # # camellia-128-cbc 15.7 20.4 21.1 # # 128-bit key setup 128 216 205 cycles/key # + over gcc 3.4.6 +54% +39% +15% # # Numbers in "+" rows represent performance improvement over compiler # generated code. Key setup timings are impressive on AMD and Core2 # thanks to 64-bit operations being covertly deployed. Improvement on # EM64T, pre-Core2 Intel x86_64 CPU, is not as impressive, because it # apparently emulates some of 64-bit operations in [32-bit] microcode. $flavour = shift; $output = shift; if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/); $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; ( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or ( $xlate="${dir}../../perlasm/x86_64-xlate.pl" and -f $xlate) or die "can't locate x86_64-xlate.pl"; open OUT,"| \"$^X\" $xlate $flavour $output"; *STDOUT=*OUT; sub hi() { my $r=shift; $r =~ s/%[er]([a-d])x/%\1h/; $r; } sub lo() { my $r=shift; $r =~ s/%[er]([a-d])x/%\1l/; $r =~ s/%[er]([sd]i)/%\1l/; $r =~ s/%(r[0-9]+)[d]?/%\1b/; $r; } $t0="%eax";$t1="%ebx";$t2="%ecx";$t3="%edx"; @S=("%r8d","%r9d","%r10d","%r11d"); $i0="%esi"; $i1="%edi"; $Tbl="%rbp"; # size optimization $inp="%r12"; $out="%r13"; $key="%r14"; $keyend="%r15"; $arg0d=$win64?"%ecx":"%edi"; # const unsigned int Camellia_SBOX[4][256]; # Well, sort of... Camellia_SBOX[0][] is interleaved with [1][], # and [2][] - with [3][]. This is done to minimize code size. $SBOX1_1110=0; # Camellia_SBOX[0] $SBOX4_4404=4; # Camellia_SBOX[1] $SBOX2_0222=2048; # Camellia_SBOX[2] $SBOX3_3033=2052; # Camellia_SBOX[3] sub Camellia_Feistel { my $i=@_[0]; my $seed=defined(@_[1])?@_[1]:0; my $scale=$seed<0?-8:8; my $j=($i&1)*2; my $s0=@S[($j)%4],$s1=@S[($j+1)%4],$s2=@S[($j+2)%4],$s3=@S[($j+3)%4]; $code.=<<___; xor $s0,$t0 # t0^=key[0] xor $s1,$t1 # t1^=key[1] movz `&hi("$t0")`,$i0 # (t0>>8)&0xff movz `&lo("$t1")`,$i1 # (t1>>0)&0xff mov $SBOX3_3033($Tbl,$i0,8),$t3 # t3=SBOX3_3033[0] mov $SBOX1_1110($Tbl,$i1,8),$t2 # t2=SBOX1_1110[1] movz `&lo("$t0")`,$i0 # (t0>>0)&0xff shr \$16,$t0 movz `&hi("$t1")`,$i1 # (t1>>8)&0xff xor $SBOX4_4404($Tbl,$i0,8),$t3 # t3^=SBOX4_4404[0] shr \$16,$t1 xor $SBOX4_4404($Tbl,$i1,8),$t2 # t2^=SBOX4_4404[1] movz `&hi("$t0")`,$i0 # (t0>>24)&0xff movz `&lo("$t1")`,$i1 # (t1>>16)&0xff xor $SBOX1_1110($Tbl,$i0,8),$t3 # t3^=SBOX1_1110[0] xor $SBOX3_3033($Tbl,$i1,8),$t2 # t2^=SBOX3_3033[1] movz `&lo("$t0")`,$i0 # (t0>>16)&0xff movz `&hi("$t1")`,$i1 # (t1>>24)&0xff xor $SBOX2_0222($Tbl,$i0,8),$t3 # t3^=SBOX2_0222[0] xor $SBOX2_0222($Tbl,$i1,8),$t2 # t2^=SBOX2_0222[1] mov `$seed+($i+1)*$scale`($key),$t1 # prefetch key[i+1] mov `$seed+($i+1)*$scale+4`($key),$t0 xor $t3,$t2 # t2^=t3 ror \$8,$t3 # t3=RightRotate(t3,8) xor $t2,$s2 xor $t2,$s3 xor $t3,$s3 ___ } # void Camellia_EncryptBlock_Rounds( # int grandRounds, # const Byte plaintext[], # const KEY_TABLE_TYPE keyTable, # Byte ciphertext[]) $code=<<___; .text # V1.x API .globl Camellia_EncryptBlock .type Camellia_EncryptBlock,\@abi-omnipotent .align 16 Camellia_EncryptBlock: movl \$128,%eax subl $arg0d,%eax movl \$3,$arg0d adcl \$0,$arg0d # keyBitLength==128?3:4 jmp .Lenc_rounds .size Camellia_EncryptBlock,.-Camellia_EncryptBlock # V2 .globl Camellia_EncryptBlock_Rounds .type Camellia_EncryptBlock_Rounds,\@function,4 .align 16 .Lenc_rounds: Camellia_EncryptBlock_Rounds: push %rbx push %rbp push %r13 push %r14 push %r15 .Lenc_prologue: #mov %rsi,$inp # put away arguments mov %rcx,$out mov %rdx,$key shl \$6,%edi # process grandRounds lea .LCamellia_SBOX(%rip),$Tbl lea ($key,%rdi),$keyend mov 0(%rsi),@S[0] # load plaintext mov 4(%rsi),@S[1] mov 8(%rsi),@S[2] bswap @S[0] mov 12(%rsi),@S[3] bswap @S[1] bswap @S[2] bswap @S[3] call _x86_64_Camellia_encrypt bswap @S[0] bswap @S[1] bswap @S[2] mov @S[0],0($out) bswap @S[3] mov @S[1],4($out) mov @S[2],8($out) mov @S[3],12($out) mov 0(%rsp),%r15 mov 8(%rsp),%r14 mov 16(%rsp),%r13 mov 24(%rsp),%rbp mov 32(%rsp),%rbx lea 40(%rsp),%rsp .Lenc_epilogue: ret .size Camellia_EncryptBlock_Rounds,.-Camellia_EncryptBlock_Rounds .type _x86_64_Camellia_encrypt,\@abi-omnipotent .align 16 _x86_64_Camellia_encrypt: xor 0($key),@S[1] xor 4($key),@S[0] # ^=key[0-3] xor 8($key),@S[3] xor 12($key),@S[2] .align 16 .Leloop: mov 16($key),$t1 # prefetch key[4-5] mov 20($key),$t0 ___ for ($i=0;$i<6;$i++) { Camellia_Feistel($i,16); } $code.=<<___; lea 16*4($key),$key cmp $keyend,$key mov 8($key),$t3 # prefetch key[2-3] mov 12($key),$t2 je .Ledone and @S[0],$t0 or @S[3],$t3 rol \$1,$t0 xor $t3,@S[2] # s2^=s3|key[3]; xor $t0,@S[1] # s1^=LeftRotate(s0&key[0],1); and @S[2],$t2 or @S[1],$t1 rol \$1,$t2 xor $t1,@S[0] # s0^=s1|key[1]; xor $t2,@S[3] # s3^=LeftRotate(s2&key[2],1); jmp .Leloop .align 16 .Ledone: xor @S[2],$t0 # SwapHalf xor @S[3],$t1 xor @S[0],$t2 xor @S[1],$t3 mov $t0,@S[0] mov $t1,@S[1] mov $t2,@S[2] mov $t3,@S[3] .byte 0xf3,0xc3 # rep ret .size _x86_64_Camellia_encrypt,.-_x86_64_Camellia_encrypt # V1.x API .globl Camellia_DecryptBlock .type Camellia_DecryptBlock,\@abi-omnipotent .align 16 Camellia_DecryptBlock: movl \$128,%eax subl $arg0d,%eax movl \$3,$arg0d adcl \$0,$arg0d # keyBitLength==128?3:4 jmp .Ldec_rounds .size Camellia_DecryptBlock,.-Camellia_DecryptBlock # V2 .globl Camellia_DecryptBlock_Rounds .type Camellia_DecryptBlock_Rounds,\@function,4 .align 16 .Ldec_rounds: Camellia_DecryptBlock_Rounds: push %rbx push %rbp push %r13 push %r14 push %r15 .Ldec_prologue: #mov %rsi,$inp # put away arguments mov %rcx,$out mov %rdx,$keyend shl \$6,%edi # process grandRounds lea .LCamellia_SBOX(%rip),$Tbl lea ($keyend,%rdi),$key mov 0(%rsi),@S[0] # load plaintext mov 4(%rsi),@S[1] mov 8(%rsi),@S[2] bswap @S[0] mov 12(%rsi),@S[3] bswap @S[1] bswap @S[2] bswap @S[3] call _x86_64_Camellia_decrypt bswap @S[0] bswap @S[1] bswap @S[2] mov @S[0],0($out) bswap @S[3] mov @S[1],4($out) mov @S[2],8($out) mov @S[3],12($out) mov 0(%rsp),%r15 mov 8(%rsp),%r14 mov 16(%rsp),%r13 mov 24(%rsp),%rbp mov 32(%rsp),%rbx lea 40(%rsp),%rsp .Ldec_epilogue: ret .size Camellia_DecryptBlock_Rounds,.-Camellia_DecryptBlock_Rounds .type _x86_64_Camellia_decrypt,\@abi-omnipotent .align 16 _x86_64_Camellia_decrypt: xor 0($key),@S[1] xor 4($key),@S[0] # ^=key[0-3] xor 8($key),@S[3] xor 12($key),@S[2] .align 16 .Ldloop: mov -8($key),$t1 # prefetch key[4-5] mov -4($key),$t0 ___ for ($i=0;$i<6;$i++) { Camellia_Feistel($i,-8); } $code.=<<___; lea -16*4($key),$key cmp $keyend,$key mov 0($key),$t3 # prefetch key[2-3] mov 4($key),$t2 je .Lddone and @S[0],$t0 or @S[3],$t3 rol \$1,$t0 xor $t3,@S[2] # s2^=s3|key[3]; xor $t0,@S[1] # s1^=LeftRotate(s0&key[0],1); and @S[2],$t2 or @S[1],$t1 rol \$1,$t2 xor $t1,@S[0] # s0^=s1|key[1]; xor $t2,@S[3] # s3^=LeftRotate(s2&key[2],1); jmp .Ldloop .align 16 .Lddone: xor @S[2],$t2 xor @S[3],$t3 xor @S[0],$t0 xor @S[1],$t1 mov $t2,@S[0] # SwapHalf mov $t3,@S[1] mov $t0,@S[2] mov $t1,@S[3] .byte 0xf3,0xc3 # rep ret .size _x86_64_Camellia_decrypt,.-_x86_64_Camellia_decrypt ___ sub _saveround { my ($rnd,$key,@T)=@_; my $bias=int(@T[0])?shift(@T):0; if ($#T==3) { $code.=<<___; mov @T[1],`$bias+$rnd*8+0`($key) mov @T[0],`$bias+$rnd*8+4`($key) mov @T[3],`$bias+$rnd*8+8`($key) mov @T[2],`$bias+$rnd*8+12`($key) ___ } else { $code.=" mov @T[0],`$bias+$rnd*8+0`($key)\n"; $code.=" mov @T[1],`$bias+$rnd*8+8`($key)\n" if ($#T>=1); } } sub _loadround { my ($rnd,$key,@T)=@_; my $bias=int(@T[0])?shift(@T):0; $code.=" mov `$bias+$rnd*8+0`($key),@T[0]\n"; $code.=" mov `$bias+$rnd*8+8`($key),@T[1]\n" if ($#T>=1); } # shld is very slow on Intel EM64T family. Even on AMD it limits # instruction decode rate [because it's VectorPath] and consequently # performance... sub __rotl128 { my ($i0,$i1,$rot)=@_; if ($rot) { $code.=<<___; mov $i0,%r11 shld \$$rot,$i1,$i0 shld \$$rot,%r11,$i1 ___ } } # ... Implementing 128-bit rotate without shld gives 80% better # performance EM64T, +15% on AMD64 and only ~7% degradation on # Core2. This is therefore preferred. sub _rotl128 { my ($i0,$i1,$rot)=@_; if ($rot) { $code.=<<___; mov $i0,%r11 shl \$$rot,$i0 mov $i1,%r9 shr \$`64-$rot`,%r9 shr \$`64-$rot`,%r11 or %r9,$i0 shl \$$rot,$i1 or %r11,$i1 ___ } } { my $step=0; $code.=<<___; .globl Camellia_Ekeygen .type Camellia_Ekeygen,\@function,3 .align 16 Camellia_Ekeygen: push %rbx push %rbp push %r13 push %r14 push %r15 .Lkey_prologue: mov %rdi,$keyend # put away arguments, keyBitLength mov %rdx,$out # keyTable mov 0(%rsi),@S[0] # load 0-127 bits mov 4(%rsi),@S[1] mov 8(%rsi),@S[2] mov 12(%rsi),@S[3] bswap @S[0] bswap @S[1] bswap @S[2] bswap @S[3] ___ &_saveround (0,$out,@S); # KL<<<0 $code.=<<___; cmp \$128,$keyend # check keyBitLength je .L1st128 mov 16(%rsi),@S[0] # load 128-191 bits mov 20(%rsi),@S[1] cmp \$192,$keyend je .L1st192 mov 24(%rsi),@S[2] # load 192-255 bits mov 28(%rsi),@S[3] jmp .L1st256 .L1st192: mov @S[0],@S[2] mov @S[1],@S[3] not @S[2] not @S[3] .L1st256: bswap @S[0] bswap @S[1] bswap @S[2] bswap @S[3] ___ &_saveround (4,$out,@S); # temp storage for KR! $code.=<<___; xor 0($out),@S[1] # KR^KL xor 4($out),@S[0] xor 8($out),@S[3] xor 12($out),@S[2] .L1st128: lea .LCamellia_SIGMA(%rip),$key lea .LCamellia_SBOX(%rip),$Tbl mov 0($key),$t1 mov 4($key),$t0 ___ &Camellia_Feistel($step++); &Camellia_Feistel($step++); $code.=<<___; xor 0($out),@S[1] # ^KL xor 4($out),@S[0] xor 8($out),@S[3] xor 12($out),@S[2] ___ &Camellia_Feistel($step++); &Camellia_Feistel($step++); $code.=<<___; cmp \$128,$keyend jne .L2nd256 lea 128($out),$out # size optimization shl \$32,%r8 # @S[0]|| shl \$32,%r10 # @S[2]|| or %r9,%r8 # ||@S[1] or %r11,%r10 # ||@S[3] ___ &_loadround (0,$out,-128,"%rax","%rbx"); # KL &_saveround (2,$out,-128,"%r8","%r10"); # KA<<<0 &_rotl128 ("%rax","%rbx",15); &_saveround (4,$out,-128,"%rax","%rbx"); # KL<<<15 &_rotl128 ("%r8","%r10",15); &_saveround (6,$out,-128,"%r8","%r10"); # KA<<<15 &_rotl128 ("%r8","%r10",15); # 15+15=30 &_saveround (8,$out,-128,"%r8","%r10"); # KA<<<30 &_rotl128 ("%rax","%rbx",30); # 15+30=45 &_saveround (10,$out,-128,"%rax","%rbx"); # KL<<<45 &_rotl128 ("%r8","%r10",15); # 30+15=45 &_saveround (12,$out,-128,"%r8"); # KA<<<45 &_rotl128 ("%rax","%rbx",15); # 45+15=60 &_saveround (13,$out,-128,"%rbx"); # KL<<<60 &_rotl128 ("%r8","%r10",15); # 45+15=60 &_saveround (14,$out,-128,"%r8","%r10"); # KA<<<60 &_rotl128 ("%rax","%rbx",17); # 60+17=77 &_saveround (16,$out,-128,"%rax","%rbx"); # KL<<<77 &_rotl128 ("%rax","%rbx",17); # 77+17=94 &_saveround (18,$out,-128,"%rax","%rbx"); # KL<<<94 &_rotl128 ("%r8","%r10",34); # 60+34=94 &_saveround (20,$out,-128,"%r8","%r10"); # KA<<<94 &_rotl128 ("%rax","%rbx",17); # 94+17=111 &_saveround (22,$out,-128,"%rax","%rbx"); # KL<<<111 &_rotl128 ("%r8","%r10",17); # 94+17=111 &_saveround (24,$out,-128,"%r8","%r10"); # KA<<<111 $code.=<<___; mov \$3,%eax jmp .Ldone .align 16 .L2nd256: ___ &_saveround (6,$out,@S); # temp storage for KA! $code.=<<___; xor `4*8+0`($out),@S[1] # KA^KR xor `4*8+4`($out),@S[0] xor `5*8+0`($out),@S[3] xor `5*8+4`($out),@S[2] ___ &Camellia_Feistel($step++); &Camellia_Feistel($step++); &_loadround (0,$out,"%rax","%rbx"); # KL &_loadround (4,$out,"%rcx","%rdx"); # KR &_loadround (6,$out,"%r14","%r15"); # KA $code.=<<___; lea 128($out),$out # size optimization shl \$32,%r8 # @S[0]|| shl \$32,%r10 # @S[2]|| or %r9,%r8 # ||@S[1] or %r11,%r10 # ||@S[3] ___ &_saveround (2,$out,-128,"%r8","%r10"); # KB<<<0 &_rotl128 ("%rcx","%rdx",15); &_saveround (4,$out,-128,"%rcx","%rdx"); # KR<<<15 &_rotl128 ("%r14","%r15",15); &_saveround (6,$out,-128,"%r14","%r15"); # KA<<<15 &_rotl128 ("%rcx","%rdx",15); # 15+15=30 &_saveround (8,$out,-128,"%rcx","%rdx"); # KR<<<30 &_rotl128 ("%r8","%r10",30); &_saveround (10,$out,-128,"%r8","%r10"); # KB<<<30 &_rotl128 ("%rax","%rbx",45); &_saveround (12,$out,-128,"%rax","%rbx"); # KL<<<45 &_rotl128 ("%r14","%r15",30); # 15+30=45 &_saveround (14,$out,-128,"%r14","%r15"); # KA<<<45 &_rotl128 ("%rax","%rbx",15); # 45+15=60 &_saveround (16,$out,-128,"%rax","%rbx"); # KL<<<60 &_rotl128 ("%rcx","%rdx",30); # 30+30=60 &_saveround (18,$out,-128,"%rcx","%rdx"); # KR<<<60 &_rotl128 ("%r8","%r10",30); # 30+30=60 &_saveround (20,$out,-128,"%r8","%r10"); # KB<<<60 &_rotl128 ("%rax","%rbx",17); # 60+17=77 &_saveround (22,$out,-128,"%rax","%rbx"); # KL<<<77 &_rotl128 ("%r14","%r15",32); # 45+32=77 &_saveround (24,$out,-128,"%r14","%r15"); # KA<<<77 &_rotl128 ("%rcx","%rdx",34); # 60+34=94 &_saveround (26,$out,-128,"%rcx","%rdx"); # KR<<<94 &_rotl128 ("%r14","%r15",17); # 77+17=94 &_saveround (28,$out,-128,"%r14","%r15"); # KA<<<77 &_rotl128 ("%rax","%rbx",34); # 77+34=111 &_saveround (30,$out,-128,"%rax","%rbx"); # KL<<<111 &_rotl128 ("%r8","%r10",51); # 60+51=111 &_saveround (32,$out,-128,"%r8","%r10"); # KB<<<111 $code.=<<___; mov \$4,%eax .Ldone: mov 0(%rsp),%r15 mov 8(%rsp),%r14 mov 16(%rsp),%r13 mov 24(%rsp),%rbp mov 32(%rsp),%rbx lea 40(%rsp),%rsp .Lkey_epilogue: ret .size Camellia_Ekeygen,.-Camellia_Ekeygen ___ } @SBOX=( 112,130, 44,236,179, 39,192,229,228,133, 87, 53,234, 12,174, 65, 35,239,107,147, 69, 25,165, 33,237, 14, 79, 78, 29,101,146,189, 134,184,175,143,124,235, 31,206, 62, 48,220, 95, 94,197, 11, 26, 166,225, 57,202,213, 71, 93, 61,217, 1, 90,214, 81, 86,108, 77, 139, 13,154,102,251,204,176, 45,116, 18, 43, 32,240,177,132,153, 223, 76,203,194, 52,126,118, 5,109,183,169, 49,209, 23, 4,215, 20, 88, 58, 97,222, 27, 17, 28, 50, 15,156, 22, 83, 24,242, 34, 254, 68,207,178,195,181,122,145, 36, 8,232,168, 96,252,105, 80, 170,208,160,125,161,137, 98,151, 84, 91, 30,149,224,255,100,210, 16,196, 0, 72,163,247,117,219,138, 3,230,218, 9, 63,221,148, 135, 92,131, 2,205, 74,144, 51,115,103,246,243,157,127,191,226, 82,155,216, 38,200, 55,198, 59,129,150,111, 75, 19,190, 99, 46, 233,121,167,140,159,110,188,142, 41,245,249,182, 47,253,180, 89, 120,152, 6,106,231, 70,113,186,212, 37,171, 66,136,162,141,250, 114, 7,185, 85,248,238,172, 10, 54, 73, 42,104, 60, 56,241,164, 64, 40,211,123,187,201, 67,193, 21,227,173,244,119,199,128,158); sub S1110 { my $i=shift; $i=@SBOX[$i]; $i=$i<<24|$i<<16|$i<<8; sprintf("0x%08x",$i); } sub S4404 { my $i=shift; $i=($i<<1|$i>>7)&0xff; $i=@SBOX[$i]; $i=$i<<24|$i<<16|$i; sprintf("0x%08x",$i); } sub S0222 { my $i=shift; $i=@SBOX[$i]; $i=($i<<1|$i>>7)&0xff; $i=$i<<16|$i<<8|$i; sprintf("0x%08x",$i); } sub S3033 { my $i=shift; $i=@SBOX[$i]; $i=($i>>1|$i<<7)&0xff; $i=$i<<24|$i<<8|$i; sprintf("0x%08x",$i); } $code.=<<___; .align 64 .LCamellia_SIGMA: .long 0x3bcc908b, 0xa09e667f, 0x4caa73b2, 0xb67ae858 .long 0xe94f82be, 0xc6ef372f, 0xf1d36f1c, 0x54ff53a5 .long 0xde682d1d, 0x10e527fa, 0xb3e6c1fd, 0xb05688c2 .long 0, 0, 0, 0 .LCamellia_SBOX: ___ # tables are interleaved, remember? sub data_word { $code.=".long\t".join(',',@_)."\n"; } for ($i=0;$i<256;$i++) { &data_word(&S1110($i),&S4404($i)); } for ($i=0;$i<256;$i++) { &data_word(&S0222($i),&S3033($i)); } # void Camellia_cbc_encrypt (const void char *inp, unsigned char *out, # size_t length, const CAMELLIA_KEY *key, # unsigned char *ivp,const int enc); { $_key="0(%rsp)"; $_end="8(%rsp)"; # inp+len&~15 $_res="16(%rsp)"; # len&15 $ivec="24(%rsp)"; $_ivp="40(%rsp)"; $_rsp="48(%rsp)"; $code.=<<___; .globl Camellia_cbc_encrypt .type Camellia_cbc_encrypt,\@function,6 .align 16 Camellia_cbc_encrypt: cmp \$0,%rdx je .Lcbc_abort push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 .Lcbc_prologue: mov %rsp,%rbp sub \$64,%rsp and \$-64,%rsp # place stack frame just "above mod 1024" the key schedule, # this ensures that cache associativity suffices lea -64-63(%rcx),%r10 sub %rsp,%r10 neg %r10 and \$0x3C0,%r10 sub %r10,%rsp #add \$8,%rsp # 8 is reserved for callee's ra mov %rdi,$inp # inp argument mov %rsi,$out # out argument mov %r8,%rbx # ivp argument mov %rcx,$key # key argument mov 272(%rcx),${keyend}d # grandRounds mov %r8,$_ivp mov %rbp,$_rsp .Lcbc_body: lea .LCamellia_SBOX(%rip),$Tbl mov \$32,%ecx .align 4 .Lcbc_prefetch_sbox: mov 0($Tbl),%rax mov 32($Tbl),%rsi mov 64($Tbl),%rdi mov 96($Tbl),%r11 lea 128($Tbl),$Tbl loop .Lcbc_prefetch_sbox sub \$4096,$Tbl shl \$6,$keyend mov %rdx,%rcx # len argument lea ($key,$keyend),$keyend cmp \$0,%r9d # enc argument je .LCBC_DECRYPT and \$-16,%rdx and \$15,%rcx # length residue lea ($inp,%rdx),%rdx mov $key,$_key mov %rdx,$_end mov %rcx,$_res cmp $inp,%rdx mov 0(%rbx),@S[0] # load IV mov 4(%rbx),@S[1] mov 8(%rbx),@S[2] mov 12(%rbx),@S[3] je .Lcbc_enc_tail jmp .Lcbc_eloop .align 16 .Lcbc_eloop: xor 0($inp),@S[0] xor 4($inp),@S[1] xor 8($inp),@S[2] bswap @S[0] xor 12($inp),@S[3] bswap @S[1] bswap @S[2] bswap @S[3] call _x86_64_Camellia_encrypt mov $_key,$key # "rewind" the key bswap @S[0] mov $_end,%rdx bswap @S[1] mov $_res,%rcx bswap @S[2] mov @S[0],0($out) bswap @S[3] mov @S[1],4($out) mov @S[2],8($out) lea 16($inp),$inp mov @S[3],12($out) cmp %rdx,$inp lea 16($out),$out jne .Lcbc_eloop cmp \$0,%rcx jne .Lcbc_enc_tail mov $_ivp,$out mov @S[0],0($out) # write out IV residue mov @S[1],4($out) mov @S[2],8($out) mov @S[3],12($out) jmp .Lcbc_done .align 16 .Lcbc_enc_tail: xor %rax,%rax mov %rax,0+$ivec mov %rax,8+$ivec mov %rax,$_res .Lcbc_enc_pushf: pushfq cld mov $inp,%rsi lea 8+$ivec,%rdi .long 0x9066A4F3 # rep movsb popfq .Lcbc_enc_popf: lea $ivec,$inp lea 16+$ivec,%rax mov %rax,$_end jmp .Lcbc_eloop # one more time .align 16 .LCBC_DECRYPT: xchg $key,$keyend add \$15,%rdx and \$15,%rcx # length residue and \$-16,%rdx mov $key,$_key lea ($inp,%rdx),%rdx mov %rdx,$_end mov %rcx,$_res mov (%rbx),%rax # load IV mov 8(%rbx),%rbx jmp .Lcbc_dloop .align 16 .Lcbc_dloop: mov 0($inp),@S[0] mov 4($inp),@S[1] mov 8($inp),@S[2] bswap @S[0] mov 12($inp),@S[3] bswap @S[1] mov %rax,0+$ivec # save IV to temporary storage bswap @S[2] mov %rbx,8+$ivec bswap @S[3] call _x86_64_Camellia_decrypt mov $_key,$key # "rewind" the key mov $_end,%rdx mov $_res,%rcx bswap @S[0] mov ($inp),%rax # load IV for next iteration bswap @S[1] mov 8($inp),%rbx bswap @S[2] xor 0+$ivec,@S[0] bswap @S[3] xor 4+$ivec,@S[1] xor 8+$ivec,@S[2] lea 16($inp),$inp xor 12+$ivec,@S[3] cmp %rdx,$inp je .Lcbc_ddone mov @S[0],0($out) mov @S[1],4($out) mov @S[2],8($out) mov @S[3],12($out) lea 16($out),$out jmp .Lcbc_dloop .align 16 .Lcbc_ddone: mov $_ivp,%rdx cmp \$0,%rcx jne .Lcbc_dec_tail mov @S[0],0($out) mov @S[1],4($out) mov @S[2],8($out) mov @S[3],12($out) mov %rax,(%rdx) # write out IV residue mov %rbx,8(%rdx) jmp .Lcbc_done .align 16 .Lcbc_dec_tail: mov @S[0],0+$ivec mov @S[1],4+$ivec mov @S[2],8+$ivec mov @S[3],12+$ivec .Lcbc_dec_pushf: pushfq cld lea 8+$ivec,%rsi lea ($out),%rdi .long 0x9066A4F3 # rep movsb popfq .Lcbc_dec_popf: mov %rax,(%rdx) # write out IV residue mov %rbx,8(%rdx) jmp .Lcbc_done .align 16 .Lcbc_done: mov $_rsp,%rcx mov 0(%rcx),%r15 mov 8(%rcx),%r14 mov 16(%rcx),%r13 mov 24(%rcx),%r12 mov 32(%rcx),%rbp mov 40(%rcx),%rbx lea 48(%rcx),%rsp .Lcbc_abort: ret .size Camellia_cbc_encrypt,.-Camellia_cbc_encrypt .asciz "Camellia for x86_64 by <appro\@openssl.org>" ___ } # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, # CONTEXT *context,DISPATCHER_CONTEXT *disp) if ($win64) { $rec="%rcx"; $frame="%rdx"; $context="%r8"; $disp="%r9"; $code.=<<___; .extern __imp_RtlVirtualUnwind .type common_se_handler,\@abi-omnipotent .align 16 common_se_handler: push %rsi push %rdi push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 pushfq lea -64(%rsp),%rsp mov 120($context),%rax # pull context->Rax mov 248($context),%rbx # pull context->Rip mov 8($disp),%rsi # disp->ImageBase mov 56($disp),%r11 # disp->HandlerData mov 0(%r11),%r10d # HandlerData[0] lea (%rsi,%r10),%r10 # prologue label cmp %r10,%rbx # context->Rip<prologue label jb .Lin_prologue mov 152($context),%rax # pull context->Rsp mov 4(%r11),%r10d # HandlerData[1] lea (%rsi,%r10),%r10 # epilogue label cmp %r10,%rbx # context->Rip>=epilogue label jae .Lin_prologue lea 40(%rax),%rax mov -8(%rax),%rbx mov -16(%rax),%rbp mov -24(%rax),%r13 mov -32(%rax),%r14 mov -40(%rax),%r15 mov %rbx,144($context) # restore context->Rbx mov %rbp,160($context) # restore context->Rbp mov %r13,224($context) # restore context->R13 mov %r14,232($context) # restore context->R14 mov %r15,240($context) # restore context->R15 .Lin_prologue: mov 8(%rax),%rdi mov 16(%rax),%rsi mov %rax,152($context) # restore context->Rsp mov %rsi,168($context) # restore context->Rsi mov %rdi,176($context) # restore context->Rdi jmp .Lcommon_seh_exit .size common_se_handler,.-common_se_handler .type cbc_se_handler,\@abi-omnipotent .align 16 cbc_se_handler: push %rsi push %rdi push %rbx push %rbp push %r12 push %r13 push %r14 push %r15 pushfq lea -64(%rsp),%rsp mov 120($context),%rax # pull context->Rax mov 248($context),%rbx # pull context->Rip lea .Lcbc_prologue(%rip),%r10 cmp %r10,%rbx # context->Rip<.Lcbc_prologue jb .Lin_cbc_prologue lea .Lcbc_body(%rip),%r10 cmp %r10,%rbx # context->Rip<.Lcbc_body jb .Lin_cbc_frame_setup mov 152($context),%rax # pull context->Rsp lea .Lcbc_abort(%rip),%r10 cmp %r10,%rbx # context->Rip>=.Lcbc_abort jae .Lin_cbc_prologue # handle pushf/popf in Camellia_cbc_encrypt lea .Lcbc_enc_pushf(%rip),%r10 cmp %r10,%rbx # context->Rip<=.Lcbc_enc_pushf jbe .Lin_cbc_no_flag lea 8(%rax),%rax lea .Lcbc_enc_popf(%rip),%r10 cmp %r10,%rbx # context->Rip<.Lcbc_enc_popf jb .Lin_cbc_no_flag lea -8(%rax),%rax lea .Lcbc_dec_pushf(%rip),%r10 cmp %r10,%rbx # context->Rip<=.Lcbc_dec_pushf jbe .Lin_cbc_no_flag lea 8(%rax),%rax lea .Lcbc_dec_popf(%rip),%r10 cmp %r10,%rbx # context->Rip<.Lcbc_dec_popf jb .Lin_cbc_no_flag lea -8(%rax),%rax .Lin_cbc_no_flag: mov 48(%rax),%rax # $_rsp lea 48(%rax),%rax .Lin_cbc_frame_setup: mov -8(%rax),%rbx mov -16(%rax),%rbp mov -24(%rax),%r12 mov -32(%rax),%r13 mov -40(%rax),%r14 mov -48(%rax),%r15 mov %rbx,144($context) # restore context->Rbx mov %rbp,160($context) # restore context->Rbp mov %r12,216($context) # restore context->R12 mov %r13,224($context) # restore context->R13 mov %r14,232($context) # restore context->R14 mov %r15,240($context) # restore context->R15 .Lin_cbc_prologue: mov 8(%rax),%rdi mov 16(%rax),%rsi mov %rax,152($context) # restore context->Rsp mov %rsi,168($context) # restore context->Rsi mov %rdi,176($context) # restore context->Rdi .align 4 .Lcommon_seh_exit: mov 40($disp),%rdi # disp->ContextRecord mov $context,%rsi # context mov \$`1232/8`,%ecx # sizeof(CONTEXT) .long 0xa548f3fc # cld; rep movsq mov $disp,%rsi xor %rcx,%rcx # arg1, UNW_FLAG_NHANDLER mov 8(%rsi),%rdx # arg2, disp->ImageBase mov 0(%rsi),%r8 # arg3, disp->ControlPc mov 16(%rsi),%r9 # arg4, disp->FunctionEntry mov 40(%rsi),%r10 # disp->ContextRecord lea 56(%rsi),%r11 # &disp->HandlerData lea 24(%rsi),%r12 # &disp->EstablisherFrame mov %r10,32(%rsp) # arg5 mov %r11,40(%rsp) # arg6 mov %r12,48(%rsp) # arg7 mov %rcx,56(%rsp) # arg8, (NULL) call *__imp_RtlVirtualUnwind(%rip) mov \$1,%eax # ExceptionContinueSearch lea 64(%rsp),%rsp popfq pop %r15 pop %r14 pop %r13 pop %r12 pop %rbp pop %rbx pop %rdi pop %rsi ret .size cbc_se_handler,.-cbc_se_handler .section .pdata .align 4 .rva .LSEH_begin_Camellia_EncryptBlock_Rounds .rva .LSEH_end_Camellia_EncryptBlock_Rounds .rva .LSEH_info_Camellia_EncryptBlock_Rounds .rva .LSEH_begin_Camellia_DecryptBlock_Rounds .rva .LSEH_end_Camellia_DecryptBlock_Rounds .rva .LSEH_info_Camellia_DecryptBlock_Rounds .rva .LSEH_begin_Camellia_Ekeygen .rva .LSEH_end_Camellia_Ekeygen .rva .LSEH_info_Camellia_Ekeygen .rva .LSEH_begin_Camellia_cbc_encrypt .rva .LSEH_end_Camellia_cbc_encrypt .rva .LSEH_info_Camellia_cbc_encrypt .section .xdata .align 8 .LSEH_info_Camellia_EncryptBlock_Rounds: .byte 9,0,0,0 .rva common_se_handler .rva .Lenc_prologue,.Lenc_epilogue # HandlerData[] .LSEH_info_Camellia_DecryptBlock_Rounds: .byte 9,0,0,0 .rva common_se_handler .rva .Ldec_prologue,.Ldec_epilogue # HandlerData[] .LSEH_info_Camellia_Ekeygen: .byte 9,0,0,0 .rva common_se_handler .rva .Lkey_prologue,.Lkey_epilogue # HandlerData[] .LSEH_info_Camellia_cbc_encrypt: .byte 9,0,0,0 .rva cbc_se_handler ___ } $code =~ s/\`([^\`]*)\`/eval $1/gem; print $code; close STDOUT;
{ "pile_set_name": "Github" }
=pod =head1 NAME SSL_CTX_set_cert_store, SSL_CTX_set1_cert_store, SSL_CTX_get_cert_store - manipulate X509 certificate verification storage =head1 SYNOPSIS #include <openssl/ssl.h> void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store); void SSL_CTX_set1_cert_store(SSL_CTX *ctx, X509_STORE *store); X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx); =head1 DESCRIPTION SSL_CTX_set_cert_store() sets/replaces the certificate verification storage of B<ctx> to/with B<store>. If another X509_STORE object is currently set in B<ctx>, it will be X509_STORE_free()ed. SSL_CTX_set1_cert_store() sets/replaces the certificate verification storage of B<ctx> to/with B<store>. The B<store>'s reference count is incremented. If another X509_STORE object is currently set in B<ctx>, it will be X509_STORE_free()ed. SSL_CTX_get_cert_store() returns a pointer to the current certificate verification storage. =head1 NOTES In order to verify the certificates presented by the peer, trusted CA certificates must be accessed. These CA certificates are made available via lookup methods, handled inside the X509_STORE. From the X509_STORE the X509_STORE_CTX used when verifying certificates is created. Typically the trusted certificate store is handled indirectly via using L<SSL_CTX_load_verify_locations(3)>. Using the SSL_CTX_set_cert_store() and SSL_CTX_get_cert_store() functions it is possible to manipulate the X509_STORE object beyond the L<SSL_CTX_load_verify_locations(3)> call. Currently no detailed documentation on how to use the X509_STORE object is available. Not all members of the X509_STORE are used when the verification takes place. So will e.g. the verify_callback() be overridden with the verify_callback() set via the L<SSL_CTX_set_verify(3)> family of functions. This document must therefore be updated when documentation about the X509_STORE object and its handling becomes available. SSL_CTX_set_cert_store() does not increment the B<store>'s reference count, so it should not be used to assign an X509_STORE that is owned by another SSL_CTX. To share X509_STOREs between two SSL_CTXs, use SSL_CTX_get_cert_store() to get the X509_STORE from the first SSL_CTX, and then use SSL_CTX_set1_cert_store() to assign to the second SSL_CTX and increment the reference count of the X509_STORE. =head1 RESTRICTIONS The X509_STORE structure used by an SSL_CTX is used for verifying peer certificates and building certificate chains, it is also shared by every child SSL structure. Applications wanting finer control can use functions such as SSL_CTX_set1_verify_cert_store() instead. =head1 RETURN VALUES SSL_CTX_set_cert_store() does not return diagnostic output. SSL_CTX_set1_cert_store() does not return diagnostic output. SSL_CTX_get_cert_store() returns the current setting. =head1 SEE ALSO L<ssl(7)>, L<SSL_CTX_load_verify_locations(3)>, L<SSL_CTX_set_verify(3)> =head1 COPYRIGHT Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at L<https://www.openssl.org/source/license.html>. =cut
{ "pile_set_name": "Github" }
<!-- Description: parsed modified with 2-digit year Expect: not bozo and feed['modified_parsed'] == (2004, 1, 1, 19, 48, 21, 3, 1, 0) --> <feed version="0.3" xmlns="http://purl.org/atom/ns#"> <modified>Thu, 01 Jan 04 19:48:21 GMT</modified> </feed>
{ "pile_set_name": "Github" }
// Template for webpack.config.js in Fable projects // Find latest version in https://github.com/fable-compiler/webpack-config-template // In most cases, you'll only need to edit the CONFIG object (after dependencies) // See below if you need better fine-tuning of Webpack options // Dependencies. Also required: core-js, fable-loader, fable-compiler, @babel/core, // @babel/preset-env, babel-loader, sass, sass-loader, css-loader, style-loader, file-loader, resolve-url-loader var path = require('path'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var CopyWebpackPlugin = require('copy-webpack-plugin'); var MiniCssExtractPlugin = require('mini-css-extract-plugin'); var CONFIG = { // The tags to include the generated JS and CSS will be automatically injected in the HTML template // See https://github.com/jantimon/html-webpack-plugin indexHtmlTemplate: './src/Client/index.html', fsharpEntry: './src/Client/Client.fsproj', cssEntry: './src/Client/style.scss', outputDir: './src/Client/deploy', assetsDir: './src/Client/public', devServerPort: 8080, // When using webpack-dev-server, you may need to redirect some calls // to a external API server. See https://webpack.js.org/configuration/dev-server/#devserver-proxy devServerProxy: { // redirect requests that start with /api/ to the server on port 8085 '/api/**': { target: 'http://localhost:' + (process.env.SERVER_PROXY_PORT || "8085"), changeOrigin: true }, // redirect websocket requests that start with /socket/ to the server on the port 8085 '/socket/**': { target: 'http://localhost:' + (process.env.SERVER_PROXY_PORT || "8085"), ws: true } }, // Use babel-preset-env to generate JS compatible with most-used browsers. // More info at https://babeljs.io/docs/en/next/babel-preset-env.html babel: { presets: [ ['@babel/preset-env', { modules: false, // This adds polyfills when needed. Requires core-js dependency. // See https://babeljs.io/docs/en/babel-preset-env#usebuiltins // Note that you still need to add custom polyfills if necessary (e.g. whatwg-fetch) useBuiltIns: 'usage', corejs: 3 }] ], } } // If we're running the webpack-dev-server, assume we're in development mode var isProduction = !process.argv.find(v => v.indexOf('webpack-dev-server') !== -1); console.log('Bundling for ' + (isProduction ? 'production' : 'development') + '...'); // The HtmlWebpackPlugin allows us to use a template for the index.html page // and automatically injects <script> or <link> tags for generated bundles. var commonPlugins = [ new HtmlWebpackPlugin({ filename: 'index.html', template: resolve(CONFIG.indexHtmlTemplate) }) ]; module.exports = { // In development, split the JavaScript and CSS files in order to // have a faster HMR support. In production bundle styles together // with the code because the MiniCssExtractPlugin will extract the // CSS in a separate files. entry: isProduction ? { app: [resolve(CONFIG.fsharpEntry), resolve(CONFIG.cssEntry)] } : { app: [resolve(CONFIG.fsharpEntry)], style: [resolve(CONFIG.cssEntry)] }, // Add a hash to the output file name in production // to prevent browser caching if code changes output: { path: resolve(CONFIG.outputDir), filename: isProduction ? '[name].[hash].js' : '[name].js' }, mode: isProduction ? 'production' : 'development', devtool: isProduction ? 'source-map' : 'eval-source-map', optimization: { splitChunks: { chunks: 'all' }, }, // Besides the HtmlPlugin, we use the following plugins: // PRODUCTION // - MiniCssExtractPlugin: Extracts CSS from bundle to a different file // To minify CSS, see https://github.com/webpack-contrib/mini-css-extract-plugin#minimizing-for-production // - CopyWebpackPlugin: Copies static assets to output directory // DEVELOPMENT // - HotModuleReplacementPlugin: Enables hot reloading when code changes without refreshing plugins: isProduction ? commonPlugins.concat([ new MiniCssExtractPlugin({ filename: 'style.[hash].css' }), new CopyWebpackPlugin([{ from: resolve(CONFIG.assetsDir) }]), ]) : commonPlugins.concat([ new webpack.HotModuleReplacementPlugin(), ]), resolve: { // See https://github.com/fable-compiler/Fable/issues/1490 symlinks: false }, // Configuration for webpack-dev-server devServer: { publicPath: '/', contentBase: resolve(CONFIG.assetsDir), host: '0.0.0.0', port: CONFIG.devServerPort, proxy: CONFIG.devServerProxy, hot: true, inline: true }, // - fable-loader: transforms F# into JS // - babel-loader: transforms JS to old syntax (compatible with old browsers) // - sass-loaders: transforms SASS/SCSS into JS // - file-loader: Moves files referenced in the code (fonts, images) into output folder module: { rules: [ { test: /\.fs(x|proj)?$/, use: { loader: 'fable-loader', options: { babel: CONFIG.babel } } }, { test: /\.js$/, exclude: /node_modules/, use: { loader: 'babel-loader', options: CONFIG.babel }, }, { test: /\.(sass|scss|css)$/, use: [ isProduction ? MiniCssExtractPlugin.loader : 'style-loader', 'css-loader', { loader: 'resolve-url-loader', }, { loader: 'sass-loader', options: { implementation: require('sass') } } ], }, { test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)(\?.*)?$/, use: ['file-loader'] } ] } }; function resolve(filePath) { return path.isAbsolute(filePath) ? filePath : path.join(__dirname, filePath); }
{ "pile_set_name": "Github" }
{ "name": "aferrandini/phpqrcode", "description": "PHPQRCode porting and changed for PHP 5.3 compatibility", "keywords": ["php", "qrcode", "barcode"], "homepage": "https://github.com/aferrandini/PHPQRCode", "type": "library", "license": "MIT", "authors": [ { "name": "Ariel Ferrandini", "email": "arielferrandini@gmail.com", "homepage": "http://www.ferrandini.com/" } ], "require": { "php": ">=5.3.0" }, "autoload": { "psr-0": { "PHPQRCode": "lib/" } }, "abandoned": "endroid/qr-code" }
{ "pile_set_name": "Github" }
.php .html .txt .htm .aspx .asp .js .css .pgsql.txt .mysql.txt .pdf .cgi .inc .gif .jpg .swf .xml .cfm .xhtml .wmv .zip .axd .gz .png .doc .shtml .jsp .ico .exe .csi .inc.php .config .jpeg .ashx .log .xls .0 .old .mp3 .com .tar .ini .asa .tgz .flv .php3 .bak .rar .asmx .xlsx .page .phtml .dll .asax .1 .msg .pl .csv .css.aspx .2 .3 .ppt .nsf .bmp .sql .xml.gz .new .avi .psd .rss .5 .wav .action .db .dat .do .xsl .class .mdb .include .12 .cs .class.php .htc .mov .tpl .4 .6.12 .9 .js.php .mysql-connect .mpg .rdf .rtf .6 .ascx .mvc .1.0 .files .master .jar .vb .mp4 .local.php .fla .require .de .docx .php5 .wci .readme .7 .cfg .aspx.cs .cfc .dwt .ru .lck .gif_var_de .html_var_de .net .ttf .x-aom .jhtml .mpeg .x-fancycat .php4 .readme_var_de .vcf .x-rma .x-affiliate .x-offers .x-affiliate_var_de .x-aom_var_de .x-fancycat_var_de .x-fcomp .x-fcomp_var_de .x-giftreg .x-giftreg_var_de .x-magnifier .x-magnifier_var_de .x-offers_var_de .x-pconf .x-pconf_var_de .x-rma_var_de .x-survey .tif .dir .json .6.9 .zif .wma .8 .mid .rm .aspx.vb .tar.gz .woa .main .ram .opml .0.html .css.php .feed .lasso .6.3 .shtm .sitemap .scc .tmp .backup .sln .org .conf .mysql-query .session-start .uk .10 .14 .orig .settings.php .19 .cab .kml .pps .require-once .asx .bok .msi .01 .c .fcgi .fopen .html. .phpmailer.php .bin .htaccess .info .java .jsf .tmpl .0.2 .00 .6.19 .bat .com.html .print .resx .ics .php.php .x .data .dcr .enfinity .html.html .licx .mno .plx .vm .11 .5.php .50 .config.php .dwg .edu .search .static .wws .6.edu .bz2 .co.uk .ece .epc .getimagesize .ice .it_backup_giornaliero .it_backup_settimanale .jspa .lst .php-dist .svc .vbs .1.html .30-i486 .ai .cur .dmg .img .inf .seam .smtp.php .1-bin-linux-2.0.30-i486 .1a .34 .5.3 .7z .ajax .cfm.cfm .chm .csp .edit .file .gif.php .m3u .psp .py .sh .test .zdat .04 .2.2 .4.0 .admin .captcha.aspx .dev .eps .file-get-contents .fr .fsockopen .list .m4v .min.js .new.html .p .store .webinfo .xml.php .3.2 .5.0 .htm. .php.bak .1.1 .1c .300 .5.1 .790 .826 .bk .bsp .cms .csshandler.ashx .d .html, .htmll .idx .images .jad .master.cs .prev_next .ssf .stm .txt.gz .00.8169 .01.4511 .112 .134 .156 .2.0 .21 .24 .4.9.php .4511 .8169 .969 .web.ui.webresource.axd .as .asp.asp .au .cnf .dhtml .enu .html.old .include-once .lock .m .mysql-select-db .phps .pm .pptx .sav .sendtoafriendform .ssi .suo .vbproj .wml .xsd .025 .075 .077 .083 .13 .16 .206 .211 .246 .26.13.391n35.50.38.816 .26.24.165n35.50.24.134 .26.56.247n35.52.03.605 .27.02.940n35.49.56.075 .27.15.919n35.52.04.300 .27.29.262n35.47.15.083 .367 .3gp .40.00.573n35.42.57.445 .403 .43.58.040n35.38.35.826 .44.04.344n35.38.35.077 .44.08.714n35.39.08.499 .44.10.892n35.38.49.246 .44.27.243n35.41.29.367 .44.29.976n35.37.51.790 .44.32.445n35.36.10.206 .44.34.800n35.38.08.156 .44.37.128n35.40.54.403 .44.40.556n35.40.53.025 .44.45.013n35.38.36.211 .44.46.104n35.38.22.970 .44.48.130n35.38.25.969 .44.52.162n35.38.50.456 .44.58.315n35.38.53.455 .445 .45.01.562n35.38.38.778 .45.04.359n35.38.39.112 .45.06.789n35.38.22.556 .45.10.717n35.38.41.989 .455 .456 .499 .556 .605 .778 .816 .970 .989 .array-keys .atom .award .bkp .crt .default .eml .epl .fancybox .fil .geo .h .hmtl .html.bak .ida .implode .index.php .iso .kmz .mysql-pconnect .php.old .php.txt .rec .storefront .taf .war .xslt .1.6 .15 .23 .2a .8.1 .sponsors .a .aquery .ascx.cs .cat .contrib .ds .dwf .film .g .go .googlebook .gpx .hotelname .htm.htm .ihtml .in-array .index .ini.php .layer .maninfo .odt .price .randomhouse .read .ru-tov.html .s7 .sample .sit .src .tpl.php .trck .uguide .vorteil .wbp .2.1 .2.html .3.1 .30 .asax.vb .aspx.aspx .btr .cer .common.php .de.html .html‎ .jbf .lbi .lib.php .lnk .login .login.php .mhtml .mpl .mso .mysql-result .original .pgp .ph .php. .preview .preview-content.php .search.htm .site .text .view .0.1 .0.5 .1.2 .2.9 .3.5 .3.html .4.html .5.html .72 .web .action2 .asc .asp.bak .aspx.resx .browse .code .com_backup_giornaliero .com_backup_settimanale .csproj .dtd .en.html .ep .eu .form .html1 .inc.asp .index.html .it .nl .ogg .old.php .old2 .opendir .out .pgt .php, .php‎ .po .prt .query .rb .rhtml .ru.html .save .search.php .t .wsdl .0-to1.2.php .0.3 .03 .18 .2.6 .3.0 .3.4 .4.1 .6.1 .7.2 .templates .adp .ajax.php .apsx .asf .bck .bu .calendar .captcha .cart .com.crt .core .dict.php .dot .egov .en.php .eot .errors .f4v .fr.html .git .ht .hta .html.lck .html.printable .ini.sample .lib .lic .map .master.vb .mi .mkdir .o .p7b .pac .parse.errors .pd .pfx .php2 .php_files .phtm .png.php .portal .printable .psql .pub .q .ra .reg .restrictor.php .rpm .strpos .tcl .template .tiff .tv .us .user .06 .09 .1.3 .1.5.swf .2.3 .25 .3.3 .4.2 .6.5 .controls .acgi .alt .array-merge .back .call-user-func-array .cfml .cmd .cocomore.txt .detail .disabled .dist.php .djvu .dta .e .extract .file-put-contents .fpl .framework .fread .htm.lck .inc.js .includes .jp .jpg.html .l .letter .local .num .pem .php.sample .php} .php~ .pot .preg-match .process .ps .r .raw .rc .s .search. .server .sis .sql.gz .squery .subscribe .svg .svn .thtml .tpl.html .ua .vcs .xhtm .xml.asp .xpi .0.0 .0.4 .07 .08 .10.html .17 .2008 .2011 .22 .25.html .2ms2 .3.2.min.js .32 .33 .4.6 .5.6 .6.0 .7.1 .91 .add .array-rand .asax.cs .asax.resx .ascx.vb .aspx, .aspx. .awm .b .bhtml .bml .ca .cache .cfg.php .cn .cz .de.txt .diff .email .en .error .faces .filesize .functions.php .hml .hqx .html,404 .html.php .htmls .htx .i .idq .jpe .js.aspx .js.gz .jspf .load .media .mp2 .mspx .mv .mysql .new.php .ocx .oui .outcontrol .pad .pages .pdb .pdf. .pnp .pop_formata_viewer .popup.php .popup.pop_formata_viewer .pvk .restrictor.log .results .run .scripts .sdb .ser .shop .sitemap.xml .smi .start .ste .swf.swf .textsearch .torrent .unsubscribe .v .vbproj.webinfo .wmf .wpd .ws .xpml .y .0.8 .0.pdf .001 .1-all-languages .1.pdf .11.html .125 .20 .20.html .2007 .26.html .4.7 .45 .5.4 .6.2 .6.html .7.0 .7.3 .7.html .75.html .8.2 .8.3 .adcode .c. .getmapimage .run.adcode .skins .z .access.login .ajax.asp .app .asd .asm .assets .at .bad .bak2 .blog .casino .cc .cdr .changelang.php .children .com, .com-redirect .content .copy .count .cp .csproj.user .custom .dbf .deb .delete .details.php .dic .divx .download .download.php .downloadcirrequirements.pdf .downloadtourkitrequirements.pdf .emailcirrequirements.php .emailtourkitform.php .emailtourkitnotification.php .emailtourkitrequirements.php .epub .err .es .exclude .filemtime .fillpurposes2.php .grp .home .htlm .htm, .html- .image .inc.html .it.html .j .jnlp .js.asp .js2 .jspx .lang-en.php .link .listevents .log.0 .mbox .mc_id .menu.php .mgi .mod .net.html .news .none .off .p3p .php.htm .php.static .php1 .phpp .pop3.php .pop_3d_viewer .popup.pop_3d_viewer .prep .prg .print.html .print.php .product_details .pwd .pyc .red .registration .requirementsfeestable.php .roshani-gunewardene.com .se .sea .sema .session .setup .simplexml-load-file .sitx .smil .srv .swi .swp .sxw .tar.bz2 .tem .temp .template.php .top .txt.php .types .unlink .url .userloginpopup.php .visapopup.php .visapopupvalid.php .vspscc .vssscc .w .work .wvx .xspf .- .-110,-maria-lund-45906.-511-gl.php .-tillagg-order-85497.php .0-rc1 .0.10 .0.11 .0.328.1.php .0.329.1.php .0.330.1.php .0.6 .0.7 .0.806.1.php .0.xml .0.zip .000 .002 .02 .030-i486 .05 .07.html .1-3.2.php .1-bin-linux-2.030-i486 .1-pt_br .1.5 .1.8 .1.htm .10.10 .11.2010 .12.html .13.html .131 .132 .15.html .16.html .2-rc1 .2.5 .2.8 .2.js .2.pdf .2004 .2006 .2009 .2010 .21.html .23.html .26 .27 .27.html .29.html .31 .35 .4.2.min.js .4.4 .45.html .5.1-pt_br .5.2 .5.7 .5.7-pl1 .6-all-languages .6.14 .6.16 .6.18 .6.2-rc1 .62.html .63.html .64 .65 .66 .7-pl1 .762 .8.2.4 .8.5 .8.7 .80.html .808 .85 .9.1 .90 .92 .972 .98.html .e. .engineer .log.new .maximize .ndm .sim .services .[file .accdb .act .actions.php .admin.php .ads .alhtm .all .ani .apf .apj .ar .aral-design.com .aral-design.de .arc .array-key-exists .asp.old .asp1 .aspg .bfhtm .biminifinder .br .browser .build .buscar .categorias .categories .ccs .ch .cl .click.php .cls .cls.php .cms.ad.adserver.cls .com-tov.html .com.ar .com.br .com.htm .com.old .common .conf.php .contact.php .control .core.php .counter.php .coverfinder .create.php .cs2 .d2w .dbm .dct .dmb .doc.doc .dxf .ed .email.shtml .en.htm .engine .env .error-log .esp .ex .exc .exe, .ext .external .ficheros .fichiers .flush .fmt .fn .footer .form_jhtml .friend .g. .geo.xml .ghtml .google.com .gov .gpg .hl .href .htm.d .htm.html .htm.old .htm2 .html.orig .html.sav .html[ .html] .html_ .html_files .htmlpar .htmlprint .html} .htm~ .hts .hu .hwp .ibf .il .image.php .imagecreatetruecolor .imagejpeg .iml .imprimer .imprimer-cadre .imprimir .imprimir-marco .info.html .info.php .ini.bak .ini.default .inl .inv .join .jpg.jpg .jps .key .kit .lang .lignee .ltr .lzh .m4a .mail .manager .md5 .met .metadesc .metakeys .mht .min .mld .mobi .mobile .mv4 .n .net-tov.html .nfo .nikon .nodos .nxg .obyx .ods .old.2 .old.asp .old.html .open .opml.config .ord .org.zip .ori .partfinder .pho .php- .phpl .phpx .pix .pls .prc .pre .prhtm .print-frame .print. .print.shtml .printer .properties .propfinder .pvx .p​hp .recherche .redirect .req .roshani-gunewardene.net .roshani-m-gunewardene.com .safe .sbk .se.php .search.asp .sec .seo .serv .server.php .servlet .settings .sf .shopping_return.php .shopping_return_adsense.php .show .sht .so .sph .split .sso .stats.php .story .swd .swf.html .sys .tex .tga .thm .tlp .tml .tmp.php .touch .tsv .txt. .txt.html .ug .unternehmen .utf8 .vbproj.vspscc .vsprintf .vstemplate .vtl .wbmp .webc .webproj .wihtm .wp .wps .wri .wsc .www .xsp .xsql .zip, .zml .ztml . extrahotelero hospedaje . t. . php ., .-0.html .-bouncing .-safety-fear .0--dup.htm .0-0-0.html .0-2.html .0-4.html .0-features-print.htm .0-pl1 .0-to-1.2.php .0.0.0 .0.1.1 .0.10.html .0.11-pr1 .0.15 .0.35 .0.8.html .0.jpg .00.html .001.l.jpg .002.l.jpg .003.l.jpg .003.jpg .004.l.jpg .004.jpg .006 .006.l.jpg .01-10 .01-l.jpg .01.html .01.jpg .011 .017 .02.html .03.html .04.html .041 .05.09 .05.html .052 .06.html .062007 .070425 .08-2009 .08.2010.php .08.html .09.html .0b .1-en .1-english .1-rc1 .1.0.html .1.10 .1.2.1 .1.24-print.htm .1.9498 .1.php .1.x .10.1 .10.11 .10.2010 .10.5 .100.html .1008 .105 .1052 .10a .11-pr1 .11.5-all-languages-utf-8-only .11.6-all-languages .110607 .1132 .12.pdf .125.html .1274 .12d6 .12ea .133 .139 .13ba .13f8 .14.05 .14.html .1478 .150.html .1514 .15462.articlepk .15467.articlepk .15f4 .160 .161e .16be .1726 .175 .17cc .18.html .180 .1808 .1810 .1832 .185 .18a .19.html .191e .1958 .1994 .199c .1ade .1c2e .1c50 .1cd6 .1d8c .1e0 .1_stable .2-english .2.0.html .2.00 .2.2.html .2.2.pack.js .2.6.min.js .2.6.pack.js .2.7 .2.php .2.swf .2.tmp .2.zip .200.html .2004.html .2005 .2009.pdf .202 .205.html .20a6 .22.html .220 .24.html .246.224.125 .24stable .25.04 .25ce .2769 .28.html .2808 .29 .2abe .2b26 .2cc .2cd0 .2d1a .2de .2e4 .2e98 .2ee2 .2b .3-pl1 .3-rc1 .3.2a .3.6 .3.7-english .3.asp .3.php .30.html .308e .31.html .330 .3374 .33e0 .346a .347a .347c .3500 .3590 .35b8 .36 .37 .37.0.html .37c2 .3850 .3ea .3f54 .4-all-languages .4.10a .4.14 .4.3 .4.5 .40.html .4040 .414 .41a2 .4234 .42ba .43 .43ca .43fa .4522 .4556 .464 .46a2 .46d4 .47f6 .482623 .4884 .490 .497c .4a4 .4a84 .4b88 .4c6 .4cc .4d3c .4d6c .4fb8 .5-all-languages-utf-8-only .5-pl1 .5.1.html .5.5-pl1 .5.i .50.html .508 .50a .51 .5214 .55.html .574 .576 .5b0 .5e0 .5e5e .5_mod_for_host .6.0-pl1 .6.3-pl1 .6.3-rc1 .6.4 .608 .61.html .63 .65.html .65e .67e .698 .69a .6a0 .6ce .6d2 .6d6 .6da .6ee .6f8 .6fa .6fc .7-2.html .7-english .7.2.custom .7.5 .7.js .710 .71e .71a .732 .73c .776 .77c .7878 .78a .792 .79c .7ab6 .7ae .7af8 .7b0 .7b30 .7b5e .7c6 .7c8 .7ca .7cc .7d6 .7e6 .7f0 .7f4 .7fa .7fe .7_0_a .8.0 .8.0.html .8.23 .8.4 .8.html .802 .80a .80e .824 .830 .832 .836 .84 .84.119.131 .842 .84ca .84e .854 .856 .858 .860 .862 .866 .878 .87c .888luck.asia .88c .8990 .89e .8ae .8b0 .8c6 .8d68 .8dc .8e6 .8ec .8ee .8a .9.2 .9.6.2 .9.html .90.3 .90.html .918 .924 .94 .9498 .95 .95.html .964 .97c .984 .99 .99e .9a6 .9c .9cee .9d2 .a. .a00 .a02 .a22 .a34 .a40 .a4a .a50 .a58 .a5ca .a8a .ab60 .ac0 .ac2 .aca2 .ae2 .aefa .af54 .af90 .asc. .acquisition .appraisal .b04 .b18 .b1c .b2c .b38 .b50 .b5e .b70 .b7a .b8a .bbc .bd0 .c.r.d. .c38 .c44 .c50 .c68 .c72 .c78 .c7c .c84 .caa .cb8 .cbc .cc0 .cf4 .cf6 .commerce .corelproject .d. .d.r. .d20 .d7a .dc2 .desc. .direct .dnnwebservice .e46 .e96 .ea0 .eba .ec0 .ede .eea .ef8 .eus .f22 .f46 .f54 .fae .frk .h.i. .k.e. .k.t. .kb .l. .l.jpg .lassoapp .newconfigpossiblybroken .org.master .org.master.cs .org.sln .org.vssscc .p. .publish .sidemenu .sol.bbcredirection.page .superindian.com .t.a .t.a. .tung.php .wtc .xmlhttp ._._order ._heder.yes.html ._order .a.html .a5w .aac .access .act.php .action.php .actions .activate.php .ad.php .add.php .adenaw.com .adm .advsearch .ag.php .aj_ .all.hawaii .amaphun.com .andriy.lviv.ua .ap .api .apk .application .archiv .arj .array-map .array-values .art .artdeco .articlepk .artnet. .ascx.resx .asia .asp- .asp.lck .asp.html .asp2 .aspdonotuse .asp_ .asp_files .aspl .aspp .asps .aspx.designer.cs .aspx_files .aspxx .aspy .asxp .as​p .at.html .avatar.php .awstats .a​sp .babymhiasexy.com .backup.php .bak.php .banan.se .banner.php .barnes .basicmap.php .baut .bc .best-vpn.com .beta .biz .blackandmature.com .bmp.php .board.asd .boom .bossspy.org .buscadorpornoxxx.com .buy-here.com .buyadspace .bycategory .bylocation .bz .c.html .cache.inc.php .cache.php .car .cascinaamalia.it .cat.php .catalog .cdf .ce .cfm.bak .cfsifatest.co.uk .cfstest.co.uk .cfswf .cfx .cgis .chat .chdir .chloesworld.com .classes.php .cmp .cnt .co .co-operativebank.co.uk .co-operativebanktest.co.uk .co-operativeinsurance.co.uk .co-operativeinsurancetest.co.uk .co-operativeinvestmentstest.co.uk .co.il .colorbox-min.js .com-authorization-required.html .com-bad-request.html .com-forbidden.html .com-internal-server-error.html .com-page-not-found.html .com.au .com.php .com.ua .com_backup_ .com_files .comments .comments. .comments.php .compiler.php .conf.html .confirm.email .connect.php .console .contact .content.php .controller .controls-3.1.5.swf .cookie.js .corp .corp.footer .cqs .cron .cropcanvas.php .cropinterface.php .crx .csproj.webinfo .csr .css.lck .css.gz .cssd .csv.php .ctp .cx .cycle.all.min.js .d64 .daisy .dal .daniel .daniel-sebald.de .data.php .data_ .davis .dbml .dcf .de.jsp .default.php .del .deleted .dell .demo .desarrollo.aquihaydominios.com .dev.bka.co.nz .development .dig .display.php .dist .dk .dm .dmca-sucks.com .dms .dnn .dogpl .donothiredandobrin.com .dontcopy .downloadfreeporn.asia .du .dump .dws .dyn .ea3ny.com .easing.min.js .ebay .ebay.results.html .editingoffice.com .efacil.com.br .ehtml .emaximinternational.com .en.jsp .enn .equonix.com .es.html .es.jsp .euforyou.net .eur .excel.xml.php .exec .exp .f.l. .faucetdepot .faucetdepot.com.vbproj .faucetdepot.com.vbproj.webinfo .fb2 .fdml .feeds.php .ffa .ficken.cx .filereader .filters.php .flac .flypage .fon .forget.pass .form.php .forms .forum .found .fp7 .fr.jsp .freeasianporn.asia .freepornxxx.asia .frontpage.php .ft .ftl .fucks.nl .funzz.fr .gallery.php .garcia .gb .get .get-meta-tags .gif          .gif.count .girlvandiesuburbs.co.za .gitihost.com .glasner.ru .google .gray .gsp .guiaweb.tk .gutschein .guy .ha .hardestlist.com .hardpussy.com .hasrett.de .hawaii .header.php .henry .him .history .hlr .hm .ho .hokkaido .hold .home.php .home.test .homepage .hp .htm.bak .htm.rc .htm3 .htm5 .htm7 .htm8 .htm_ .html,, .html-0 .html-1 .html-c .html-old .html-p .html.htm .html.images .html.inc .html.none .html.pdf .html.start .html.txt .html4 .html5 .html7 .htmlbak .htmldolmetschen .html_old .htmla .htmlc .htmlfeed .htmlq .htmlu .htn .htpasswd .h​tml .iac. .ibuysss.info .iconv .idf .iframe_filtros .ignore.php .ihmtl .ihya .imp .in .inactive .inc.php.bak .inc.php3 .incest-porn.sex-startje.nl .incestporn.sex-startje.nl .incl .indiansexzite.com .indt .ini.newconfigpossiblybroken .insert .internet-taxprep.com .interpreterukraine.com .ipl .issues .itml .ixi .jhtm .job .joseph .jpf .jpg.xml .jpg[ .jpg] .js, .js.lck .jsa .jsd .jso .jsp.old .jsps .jtp .keyword .kinkywear.net .kk .knvbcommunicator.voetbalassist.nl .kokuken .ks .kutxa.net-en .lang-de.php .lang.php .langhampartners.com .lappgroup.com .last .latest .lha .links .list.includes .listminigrid .listing .lng .loc .local.cfm .location.href .log2 .lua .lynkx .maastrichtairporthotels.com .mag .mail.php .malesextoys.us .massivewankers.com .mbizgroup .mel .members .meretrizdelujo.com .messagey.com .metadata.js .meus.php .midi .milliculture.net .min_ .miss-video.com .mk.gutschein .mk.rabattlp .mkv .mmap .model-escorts.asia .modelescorts.asia .mp .mp3.html .mq4 .mreply.rc .msp .mvn .mysqli .napravlenie_asc .napravlenie_desc .nded-pga-emial .net-en .net-print.htm .net_backup_giornaliero .net_backup_settimanale .new.htm .newsletter .nexucom.com .ninwinter.net .nl.html .nonude.org .nonudes.com .nth .nz .od .offer.php .offline .ogv .ok .old.1 .old.htm .old.old .old1 .old3 .older .oliver .onedigitalcentral.com .onenettv.com .online .opensearch .org-tov.html .org.ua-tov.html .orig.html .origin.php .original.html .orlando-vacationhome.net .orlando-vacationhomes-pools.com .orlando-vacationrentals.net .osg .outbound .owen .ownhometest.co.uk .pae .page_pls_all_password .pages-medicales.com .pan .parse-url .part .pass .patch .paul .paymethods.php .pazderski.com .pazderski.net .pazderski.us .pdd .pdf.html .pdf.pdf .pdf.php .pdfx .perfect-color-world.com .petersburg-apartments-for-business.html .petersburg-apartments-for-tourists.html .petersburg-romantic-apartments.html .phdo .photo .php-------------- .php.lck .php.backup .php.html .php.inc .php.mno .php.original .php_ .php_old .phphp .phppar .phpvreor.php .php£¿ .pht .pl.html .planetcom.ca .playwithparis.com .plugins .png,bmp .popup .pornfailures.com .pornoizlee.tk .pornz.tv .posting.prep .prev .print.jsp .prl .prosdo.com .psb .publisher.php .puresolo.com .pussyjourney.com .qtgp .qxd .r. .rabattlp .rails .randomocityproductions.com .rateart.php .readfile .rec.html .redirect.php .remove .remove.php .removed .resultados .resume .rhtm .riddlesintime.com .rmvb .ro .roma .roomscity.com .roshanigunewardene.com .rpt .rsp .rss.php .rss_cars .rss_homes .rss_jobs .rtfd .rvt .s.html .sadopasion.com .safariextz .salestax.php .sc .sca-tork.com .scandir .scrollto.js .search.html .sec.cfm .section .secure .send .sent- .service .session-regenerate-id .set .sex-startje.nl .sexmeme.com .sexon.com .sexy-girls4abo.de .sfw .sgf .shipcode.php .shipdiscount.php .show.php .shtml.html .sidebar .sisx .sitemap. .skin .small-penis-humiliation.net .smiletest.co.uk .snippet.aspx .snuffx.com .sort .sortirovka_price.napravlenie_asc .sortirovka_price.napravlenie_desc .sortirovka_customers_rating.napravlenie_asc .sortirovka_customers_rating.napravlenie_desc .sortirovka_name.napravlenie_asc .sortirovka_name.napravlenie_desc .sp .sphp3 .srch .srf .srvl .st-patricks.com .sta .staged.php .staging .start.php .stat .stats .step .stml .storebanner.php .storelogo.php .storename.php .sts.php .suarez .submit .support .support.html .swf.lck .sym .system .tab- .table.html .tablesorter.min.js .tablesorter.pager.js .tatianyc.com .tb .tech .teen-shy.com .teenhardpussy.com .temp.php .templates.php .temporarily.withdrawn.html .test.cgi .test.php .tf .tg .thanks .thehotfish.com .theme .thompson .thumb.jpg .ticket.submit .tim .tk .tls .to .touch.action .trace .tracker.ashx .trade .trishasex.viedos.com .ts .tst .tvpi .txt.txt .txuri-urdin.com .ufo .ugmart.ug .ui-1.5.2 .unixteacher.org .unsharp.php .update .upgrade .v1.11.js .v2.php .vacationhomes-pools.com .var .venetian.com,prod2.venetian.com,reservations.venetian.com, .verify .video .videodeputas.com .videos-chaudes.com .viewpage__10 .vmdk .vn .voetbalassist.nl .vs .vx .vxlpub .w3m .w3x .wax .web-teck.com .webalizer .webarchive .webjockey.nl .webm .weedooz.eu .wgx .wimzi.php .wireless .wireless.action .wm .woolovers.com .working .wpl .wplus .wps.rtf .write.php .wwsec_app_priv.login .www.annuaire-vimarty.net .www.annuaire-web.info .www.kit-graphik.com .www.photo-scope.fr .xcam.at .xconf .xcwc.com .xgi .xhtml5 .xlt .xm .xml.old .xpdf .xqy .xslx .xst .xsx .xy.php .yp .ys .za .zh.html .zhtml .zip.php .{3,2048} .​htm​l
{ "pile_set_name": "Github" }
// Copyright 2017 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. #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_COLOR_SPACE_GAMUT_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_COLOR_SPACE_GAMUT_H_ #include "third_party/blink/renderer/platform/platform_export.h" struct skcms_ICCProfile; namespace blink { struct WebScreenInfo; enum class ColorSpaceGamut { // Values synced with 'Gamut' in src/tools/metrics/histograms/histograms.xml kUnknown = 0, kLessThanNTSC = 1, NTSC = 2, SRGB = 3, kAlmostP3 = 4, P3 = 5, kAdobeRGB = 6, kWide = 7, BT2020 = 8, kProPhoto = 9, kUltraWide = 10, kEnd }; namespace color_space_utilities { PLATFORM_EXPORT ColorSpaceGamut GetColorSpaceGamut(const WebScreenInfo&); ColorSpaceGamut GetColorSpaceGamut(const skcms_ICCProfile*); } // namespace color_space_utilities } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_COLOR_SPACE_GAMUT_H_
{ "pile_set_name": "Github" }
include $(top_srcdir)/glib.mk LDADD = $(top_builddir)/glib/libglib-2.0.la $(top_builddir)/gobject/libgobject-2.0.la AM_CPPFLAGS = $(gmodule_INCLUDES) $(GLIB_DEBUG_FLAGS) DEFS = -DGLIB_DISABLE_DEPRECATION_WARNINGS -DG_LOG_DOMAIN=\"GLib\" AM_CFLAGS = -g # So far, only two gtester-ified cases test_programs = \ gvalue-test \ paramspec-test \ $(NULL) # These are not yet gtester-ified, so mark them as for 'installed' only so we # don't run them under the framework. We will handle them manually below. installed_test_programs = \ deftype \ accumulator \ defaultiface \ dynamictype \ override \ singleton \ references \ $(NULL) # Don't install these ones, and keep them out of 'make check' because they take too long... noinst_PROGRAMS += \ performance \ performance-threaded \ $(NULL) # Run the 'installed' tests manually in-tree. # This will cause them to be built even if installed tests are disabled. check_PROGRAMS += $(installed_test_programs) $(installed_test_extra_programs) TESTS += $(installed_test_programs) TESTS_ENVIRONMENT = \ LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset \ MALLOC_CHECK_=2 \ MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) accumulator_SOURCES = accumulator.c testmarshal.c testmarshal.h defaultiface_SOURCES = defaultiface.c testmodule.c testmodule.h dynamictype_SOURCES = dynamictype.c testmodule.c testmodule.h if ENABLE_TIMELOOP installed_test_programs += timeloop-closure endif if CROSS_COMPILING glib_genmarshal=$(GLIB_GENMARSHAL) else glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal endif testmarshal.h: stamp-testmarshal.h @true stamp-testmarshal.h: @REBUILD@ testmarshal.list $(glib_genmarshal) $(AM_V_GEN) $(glib_genmarshal) --prefix=test_marshal $(srcdir)/testmarshal.list --header >> xgen-gmh \ && (cmp -s xgen-gmh testmarshal.h 2>/dev/null || cp xgen-gmh testmarshal.h) \ && rm -f xgen-gmh xgen-gmh~ \ && echo timestamp > $@ testmarshal.c: @REBUILD@ testmarshal.h testmarshal.list $(glib_genmarshal) $(AM_V_GEN) (echo "#include \"testmarshal.h\""; $(glib_genmarshal) --prefix=test_marshal $(srcdir)/testmarshal.list --body) >> xgen-gmc \ && cp xgen-gmc testmarshal.c \ && rm -f xgen-gmc xgen-gmc~ BUILT_SOURCES += testmarshal.h testmarshal.c CLEANFILES += stamp-testmarshal.h EXTRA_DIST += \ testcommon.h \ testmarshal.list BUILT_EXTRA_DIST += \ testmarshal.h \ testmarshal.c dist-hook: $(BUILT_EXTRA_DIST) files='$(BUILT_EXTRA_DIST)'; \ for f in $$files; do \ if test -f $$f; then d=.; else d=$(srcdir); fi; \ cp $$d/$$f $(distdir) || exit 1; done distclean-local: if test $(srcdir) = .; then :; else \ rm -f $(BUILT_EXTRA_DIST); \ fi
{ "pile_set_name": "Github" }
{ "name": "process-nextick-args", "version": "1.0.2", "description": "process.nextTick but always with args", "main": "index.js", "scripts": { "test": "node test.js" }, "repository": { "type": "git", "url": "https://github.com/calvinmetcalf/process-nextick-args.git" }, "author": "", "license": "MIT", "bugs": { "url": "https://github.com/calvinmetcalf/process-nextick-args/issues" }, "homepage": "https://github.com/calvinmetcalf/process-nextick-args", "devDependencies": { "tap": "~0.2.6" }, "readme": "process-nextick-args\n=====\n\n[![Build Status](https://travis-ci.org/calvinmetcalf/process-nextick-args.svg?branch=master)](https://travis-ci.org/calvinmetcalf/process-nextick-args)\n\n```bash\nnpm install --save process-nextick-args\n```\n\nAlways be able to pass arguments to process.nextTick, no matter the platform\n\n```js\nvar nextTick = require('process-nextick-args');\n\nnextTick(function (a, b, c) {\n console.log(a, b, c);\n}, 'step', 3, 'profit');\n```\n", "readmeFilename": "readme.md", "_id": "process-nextick-args@1.0.2", "_shasum": "8b4d3fc586668bd5b6573e732edf2b71c1c1d8aa", "_from": "process-nextick-args@~1.0.0", "_resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.2.tgz" }
{ "pile_set_name": "Github" }
// Copyright 2011 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Surrogate pair range. // U+D800 assertThrows(function(){ decodeURIComponent("%ED%A0%80"); }, URIError); // U+DBFF assertThrows(function(){ decodeURIComponent("%ED%AF%BF"); }, URIError); // U+DC00 assertThrows(function(){ decodeURIComponent("%ED%B0%80"); }, URIError); // U+DFFF assertThrows(function(){ decodeURIComponent("%ED%BF%BF"); }, URIError); // Overlong encodings // U+007F in two bytes. assertThrows(function(){ decodeURIComponent("%C1%BF"); }, URIError); // U+07FF in three bytes. assertThrows(function(){ decodeURIComponent("%E0%9F%BF"); }, URIError);
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" ?> <ldml> <identity> <version number="$Revision: 1.51 $"/> <generation date="$Date: 2009/05/05 23:06:36 $"/> <language type="gl"/> <territory type="ES"/> </identity> </ldml>
{ "pile_set_name": "Github" }
# 面向对象 # 百度翻译 -- 网页版(自动获取token,sign) import requests import js2py import json import re from traceback import print_exc class BaiduWeb(): """百度翻译网页版爬虫""" def __init__(self, query_str): self.session = requests.session() headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36", } self.session.headers = headers self.baidu_url = "https://www.baidu.com/" self.root_url = "https://fanyi.baidu.com/" self.lang_url = "https://fanyi.baidu.com/langdetect" self.trans_url = "https://fanyi.baidu.com/v2transapi" self.query_str = query_str def get_token_gtk(self): '''获取token和gtk(用于合成Sign)''' self.session.get(self.root_url) resp = self.session.get(self.root_url) html_str = resp.content.decode() token = re.findall(r"token: '(.*?)'", html_str)[0] gtk = re.findall(r"window.gtk = '(.*?)'", html_str)[0] return token,gtk def generate_sign(self,gtk): """生成sign""" # 1. 准备js编译环境 context = js2py.EvalJs() with open('.\\config\\webtrans.js', encoding='utf8') as f: js_data = f.read() js_data = re.sub("window\[l\]",'"'+gtk+'"',js_data) # js_data = re.sub("window\[l\]", "\"{}\"".format(gtk), js_data) # print(js_data) context.execute(js_data) sign = context.e(self.query_str) return sign def lang_detect(self): '''获取语言转换类型.eg: zh-->en''' lang_resp = self.session.post(self.lang_url,data={"query":self.query_str}) lang_json_str = lang_resp.content.decode() # {"error":0,"msg":"success","lan":"zh"} lan = json.loads(lang_json_str)['lan'] to = "en" if lan == "zh" else "zh" return lan,to def parse_url(self,post_data): trans_resp = self.session.post(self.trans_url,data=post_data) trans_json_str = trans_resp.content.decode() trans_json = json.loads(trans_json_str) self.result = trans_json["trans_result"]["data"][0]["dst"] def run(self): try: """实现逻辑""" # 1.获取百度的cookie,(缺乏百度首页的cookie会始终报错998) self.session.get(self.baidu_url) # 2. 获取百度翻译的token和gtk(用于合成sign) token, gtk = self.get_token_gtk() # 3. 生成sign sign = self.generate_sign(gtk) # 4. 获取语言转换类型.eg: zh-->en lan, to = self.lang_detect() # 5. 发送请求,获取响应,输出结果 post_data = { #"from": lan, "from": lan, "to": to, "query": self.query_str, "transtype": "realtime", "simple_means_flag": 3, "sign": sign, "token": token } self.parse_url(post_data) except Exception: print_exc() self.result = '网页百度:我抽风啦!' return self.result if __name__ == '__main__': webfanyi = BaiduWeb('一歩ひくと见えてくる 何かの中にどっぷり浸かっていると何がなんだか分からなくなってしまうことがある。') a = webfanyi.run() print(a)
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> <!-- ============================================================= --> <!-- Configure the Jetty Server instance with an ID "Server" --> <!-- by adding a HTTP connector. --> <!-- This configuration must be used in conjunction with jetty.xml --> <!-- ============================================================= --> <Configure id="Server" class="org.eclipse.jetty.server.Server"> <!-- =========================================================== --> <!-- Add a HTTP Connector. --> <!-- Configure an o.e.j.server.ServerConnector with a single --> <!-- HttpConnectionFactory instance using the common httpConfig --> <!-- instance defined in jetty.xml --> <!-- --> <!-- Consult the javadoc of o.e.j.server.ServerConnector and --> <!-- o.e.j.server.HttpConnectionFactory for all configuration --> <!-- that may be set here. --> <!-- =========================================================== --> <Call name="addConnector"> <Arg> <New class="org.eclipse.jetty.server.ServerConnector"> <Arg name="server"><Ref refid="Server" /></Arg> <Arg name="factories"> <Array type="org.eclipse.jetty.server.ConnectionFactory"> <Item> <New class="org.eclipse.jetty.server.HttpConnectionFactory"> <Arg name="config"><Ref refid="httpConfig" /></Arg> </New> </Item> </Array> </Arg> <Set name="host"><Property name="jetty.host" /></Set> <Set name="port"><Property name="jetty.port" default="8080" /></Set> <Set name="idleTimeout"><Property name="http.timeout" default="30000"/></Set> </New> </Arg> </Call> </Configure>
{ "pile_set_name": "Github" }
:host { .toolbar { display: flex; } .top-navigtaion { margin-left: auto; } .sidenav-container { background: #ffffff; color: inherit; height: calc(100vh - 64px); .mat-sidenav-content { overflow: hidden; } } @media screen and (max-width: 600px) { .sidenav-container { height: calc(100vh - 56px); } } @media screen and (max-width: 860px) { .top-navigtaion { display: none; } } }
{ "pile_set_name": "Github" }
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_UI_HELPLINE_H_ #define _PERF_UI_HELPLINE_H_ 1 #include <stdio.h> #include <stdarg.h> #include "../util/cache.h" struct ui_helpline { void (*pop)(void); void (*push)(const char *msg); int (*show)(const char *fmt, va_list ap); }; extern struct ui_helpline *helpline_fns; void ui_helpline__init(void); void ui_helpline__pop(void); void ui_helpline__push(const char *msg); void ui_helpline__vpush(const char *fmt, va_list ap); void ui_helpline__fpush(const char *fmt, ...); void ui_helpline__puts(const char *msg); void ui_helpline__printf(const char *fmt, ...); int ui_helpline__vshow(const char *fmt, va_list ap); extern char ui_helpline__current[512]; extern char ui_helpline__last_msg[]; #endif /* _PERF_UI_HELPLINE_H_ */
{ "pile_set_name": "Github" }
/* * Copyright (c) 2012 * MIPS Technologies, Inc., California. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``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 MIPS TECHNOLOGIES, INC. 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. * * Authors: Stanislav Ocovaj (socovaj@mips.com) * Goran Cordasic (goran@mips.com) * Djordje Pesut (djordje@mips.com) * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #define FFT_FLOAT 0 #define FFT_FIXED_32 1 #include "fft_template.c"
{ "pile_set_name": "Github" }
/*========================================================================= Program: Visualization Toolkit Module: vtkBridgeAttribute.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ /** * @class vtkBridgeAttribute * @brief Implementation of vtkGenericAttribute. * * It is just an example that show how to implement the Generic. It is also * used for testing and evaluating the Generic. * @sa * vtkGenericAttribute, vtkBridgeDataSet */ #ifndef vtkBridgeAttribute_h #define vtkBridgeAttribute_h #include "vtkBridgeExport.h" //for module export macro #include "vtkGenericAttribute.h" class vtkPointData; class vtkCellData; class vtkDataSetAttributes; class VTKTESTINGGENERICBRIDGE_EXPORT vtkBridgeAttribute : public vtkGenericAttribute { public: static vtkBridgeAttribute* New(); vtkTypeMacro(vtkBridgeAttribute, vtkGenericAttribute); void PrintSelf(ostream& os, vtkIndent indent) override; /** * Name of the attribute. (e.g. "velocity") * \post result_may_not_exist: result!=0 || result==0 */ const char* GetName() override; /** * Dimension of the attribute. (1 for scalar, 3 for velocity) * \post positive_result: result>=0 */ int GetNumberOfComponents() override; /** * Is the attribute centered either on points, cells or boundaries? * \post valid_result: (result==vtkCenteringPoints) || * (result==vtkCenteringCells) || (result==vtkCenteringBoundaries) */ int GetCentering() override; /** * Type of the attribute: scalar, vector, normal, texture coordinate, tensor * \post valid_result: (result==vtkDataSetAttributes::SCALARS) * ||(result==vtkDataSetAttributes::VECTORS) * ||(result==vtkDataSetAttributes::NORMALS) * ||(result==vtkDataSetAttributes::TCOORDS) * ||(result==vtkDataSetAttributes::TENSORS) */ int GetType() override; /** * Type of the components of the attribute: int, float, double * \post valid_result: (result==VTK_BIT) ||(result==VTK_CHAR) * ||(result==VTK_UNSIGNED_CHAR) ||(result==VTK_SHORT) * ||(result==VTK_UNSIGNED_SHORT)||(result==VTK_INT) * ||(result==VTK_UNSIGNED_INT) ||(result==VTK_LONG) * ||(result==VTK_UNSIGNED_LONG) ||(result==VTK_FLOAT) * ||(result==VTK_DOUBLE) ||(result==VTK_ID_TYPE) */ int GetComponentType() override; /** * Number of tuples. * \post valid_result: result>=0 */ vtkIdType GetSize() override; /** * Size in kibibytes (1024 bytes) taken by the attribute. */ unsigned long GetActualMemorySize() override; /** * Range of the attribute component `component'. It returns double, even if * GetType()==VTK_INT. * NOT THREAD SAFE * \pre valid_component: (component>=0)&&(component<GetNumberOfComponents()) * \post result_exists: result!=0 */ double* GetRange(int component) override; /** * Range of the attribute component `component'. * THREAD SAFE * \pre valid_component: (component>=0)&&(component<GetNumberOfComponents()) */ void GetRange(int component, double range[2]) override; /** * Return the maximum euclidean norm for the tuples. * \post positive_result: result>=0 */ double GetMaxNorm() override; /** * Attribute at all points of cell `c'. * \pre c_exists: c!=0 * \pre c_valid: !c->IsAtEnd() * \post result_exists: result!=0 * \post valid_result: sizeof(result)==GetNumberOfComponents()*c->GetCell()->GetNumberOfPoints() */ double* GetTuple(vtkGenericAdaptorCell* c) override; /** * Put attribute at all points of cell `c' in `tuple'. * \pre c_exists: c!=0 * \pre c_valid: !c->IsAtEnd() * \pre tuple_exists: tuple!=0 * \pre valid_tuple: sizeof(tuple)>=GetNumberOfComponents()*c->GetCell()->GetNumberOfPoints() */ void GetTuple(vtkGenericAdaptorCell* c, double* tuple) override; /** * Attribute at all points of cell `c'. * \pre c_exists: c!=0 * \pre c_valid: !c->IsAtEnd() * \post result_exists: result!=0 * \post valid_result: sizeof(result)==GetNumberOfComponents()*c->GetCell()->GetNumberOfPoints() */ double* GetTuple(vtkGenericCellIterator* c) override; /** * Put attribute at all points of cell `c' in `tuple'. * \pre c_exists: c!=0 * \pre c_valid: !c->IsAtEnd() * \pre tuple_exists: tuple!=0 * \pre valid_tuple: sizeof(tuple)>=GetNumberOfComponents()*c->GetCell()->GetNumberOfPoints() */ void GetTuple(vtkGenericCellIterator* c, double* tuple) override; /** * Value of the attribute at position `p'. * \pre p_exists: p!=0 * \pre p_valid: !p->IsAtEnd() * \post result_exists: result!=0 * \post valid_result_size: sizeof(result)==GetNumberOfComponents() */ double* GetTuple(vtkGenericPointIterator* p) override; /** * Put the value of the attribute at position `p' into `tuple'. * \pre p_exists: p!=0 * \pre p_valid: !p->IsAtEnd() * \pre tuple_exists: tuple!=0 * \pre valid_tuple_size: sizeof(tuple)>=GetNumberOfComponents() */ void GetTuple(vtkGenericPointIterator* p, double* tuple) override; /** * Put component `i' of the attribute at all points of cell `c' in `values'. * \pre valid_component: (i>=0) && (i<GetNumberOfComponents()) * \pre c_exists: c!=0 * \pre c_valid: !c->IsAtEnd() * \pre values_exist: values!=0 * \pre valid_values: sizeof(values)>=c->GetCell()->GetNumberOfPoints() */ void GetComponent(int i, vtkGenericCellIterator* c, double* values) override; /** * Value of the component `i' of the attribute at position `p'. * \pre valid_component: (i>=0) && (i<GetNumberOfComponents()) * \pre p_exists: p!=0 * \pre p_valid: !p->IsAtEnd() */ double GetComponent(int i, vtkGenericPointIterator* p) override; /** * Recursive duplication of `other' in `this'. * \pre other_exists: other!=0 * \pre not_self: other!=this */ void DeepCopy(vtkGenericAttribute* other) override; /** * Update `this' using fields of `other'. * \pre other_exists: other!=0 * \pre not_self: other!=this */ void ShallowCopy(vtkGenericAttribute* other) override; /** * Set the current attribute to be centered on points with attribute `i' of * `d'. * \pre d_exists: d!=0 * \pre valid_range: (i>=0) && (i<d->GetNumberOfArrays()) */ void InitWithPointData(vtkPointData* d, int i); /** * Set the current attribute to be centered on cells with attribute `i' of * `d'. * \pre d_exists: d!=0 * \pre valid_range: (i>=0) && (i<d->GetNumberOfArrays()) */ void InitWithCellData(vtkCellData* d, int i); protected: /** * Default constructor: empty attribute, not valid */ vtkBridgeAttribute(); /** * Destructor. */ ~vtkBridgeAttribute() override; /** * If size>InternalTupleCapacity, allocate enough memory. * \pre positive_size: size>0 */ void AllocateInternalTuple(int size); friend class vtkBridgeCell; // only one of them is non-null at a time. vtkPointData* Pd; vtkCellData* Cd; vtkDataSetAttributes* Data; // always not-null, equal to either on Pd or Cd int AttributeNumber; double* InternalTuple; // used by vtkBridgeCell int InternalTupleCapacity; private: vtkBridgeAttribute(const vtkBridgeAttribute&) = delete; void operator=(const vtkBridgeAttribute&) = delete; }; #endif
{ "pile_set_name": "Github" }
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build s390x,!go1.11 !arm,!amd64,!s390x gccgo appengine nacl package poly1305 // Sum generates an authenticator for msg using a one-time key and puts the // 16-byte result into out. Authenticating two different messages with the same // key allows an attacker to forge messages at will. func Sum(out *[TagSize]byte, msg []byte, key *[32]byte) { sumGeneric(out, msg, key) }
{ "pile_set_name": "Github" }
// Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. // https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_NAME_RESOLVER_H__ #define GOOGLE_PROTOBUF_COMPILER_JAVA_NAME_RESOLVER_H__ #include <map> #include <string> #include <google/protobuf/stubs/common.h> namespace google { namespace protobuf { class Descriptor; class EnumDescriptor; class FieldDescriptor; class FileDescriptor; class ServiceDescriptor; namespace compiler { namespace java { // Used to get the Java class related names for a given descriptor. It caches // the results to avoid redundant calculation across multiple name queries. // Thread-safety note: This class is *not* thread-safe. class ClassNameResolver { public: ClassNameResolver(); ~ClassNameResolver(); // Gets the unqualified outer class name for the file. string GetFileClassName(const FileDescriptor* file, bool immutable); // Gets the unqualified immutable outer class name of a file. string GetFileImmutableClassName(const FileDescriptor* file); // Gets the unqualified default immutable outer class name of a file // (converted from the proto file's name). string GetFileDefaultImmutableClassName(const FileDescriptor* file); // Check whether there is any type defined in the proto file that has // the given class name. bool HasConflictingClassName(const FileDescriptor* file, const string& classname); // Gets the name of the outer class that holds descriptor information. // Descriptors are shared between immutable messages and mutable messages. // Since both of them are generated optionally, the descriptors need to be // put in another common place. string GetDescriptorClassName(const FileDescriptor* file); // Gets the fully-qualified class name corresponding to the given descriptor. string GetClassName(const Descriptor* descriptor, bool immutable); string GetClassName(const EnumDescriptor* descriptor, bool immutable); string GetClassName(const ServiceDescriptor* descriptor, bool immutable); string GetClassName(const FileDescriptor* descriptor, bool immutable); template<class DescriptorType> string GetImmutableClassName(const DescriptorType* descriptor) { return GetClassName(descriptor, true); } template<class DescriptorType> string GetMutableClassName(const DescriptorType* descriptor) { return GetClassName(descriptor, false); } // Gets the fully qualified name of an extension identifier. string GetExtensionIdentifierName(const FieldDescriptor* descriptor, bool immutable); // Gets the fully qualified name for generated classes in Java convention. // Nested classes will be separated using '$' instead of '.' // For example: // com.package.OuterClass$OuterMessage$InnerMessage string GetJavaImmutableClassName(const Descriptor* descriptor); string GetJavaImmutableClassName(const EnumDescriptor* descriptor); private: // Get the full name of a Java class by prepending the Java package name // or outer class name. string GetClassFullName(const string& name_without_package, const FileDescriptor* file, bool immutable, bool multiple_files); // Get the Java Class style full name of a message. string GetJavaClassFullName( const string& name_without_package, const FileDescriptor* file, bool immutable); // Caches the result to provide better performance. map<const FileDescriptor*, string> file_immutable_outer_class_names_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ClassNameResolver); }; } // namespace java } // namespace compiler } // namespace protobuf } // namespace google #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_NAME_RESOLVER_H__
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <table xmlns="http://query.yahooapis.com/v1/schema/table.xsd"> <meta> <author>Jamie Matthews</author> <description>YQL table for Last.fm Group.getWeeklyArtistChart API method. Get an artist chart for a group, for a given date range. If no date range is supplied, it will return the most recent album chart for this group.</description> <documentationURL>http://www.last.fm/api/show?service=294</documentationURL> </meta> <bindings> <select itemPath="" produces="XML"> <urls> <url>http://ws.audioscrobbler.com/2.0/?method=group.getweeklyartistchart</url> </urls> <inputs> <key id="group" type="xs:string" paramType="query" required="true" /> <key id="from" type="xs:string" paramType="query" required="false" /> <key id="to" type="xs:string" paramType="query" required="false" /> <key id="api_key" type="xs:string" paramType="query" required="true" /> </inputs> </select> </bindings> </table>
{ "pile_set_name": "Github" }
{ "url": "https://schnittstellengestalter.de/", "name": "Schnittstellengestalter", "description": "Website of »Schnittstellengestalter« a user interface design agency from Berlin, Germany.", "twitter": "solemone" }
{ "pile_set_name": "Github" }
# API FAQ {#concept_761256 .concept} - [What is ECS API?](#section_2mf_wov_wfu) - [Error code InvalidDataDiskCategory.NotSupported is returned when I try to create an ECS instance. What can I do?](#section_rqe_51b_fkf) - [How can I create an ECS instance that is assigned a public IP address?](#section_iop_1gx_4ub) - [I have created an ECS instance by using an ECS API operation. Why can't the public IP address of the instance be pinged?](#section_2pr_bjo_kqj) - [The error message "The specified IP is already in use." is returned when I use an ECS API operation to bind a public IP address to my instance. What can I do?](#section_qxl_ubh_cso) - [When I modify the public bandwidth configurations of my instance by using an ECS API operation, can I specify an effective period of time for the new bandwidth configurations?](#section_opz_hdk_3ab) - [Why can't all the security group rules in a security group be displayed when I use an ECS API operation or ECS SDK to query the details of the security group?](#section_0gg_gvb_36g) - [Why does a query made by using the ECS API, ECS SDK, or Alibaba Cloud CLI return only ten entries?](#section_vto_62a_f45) ## What is ECS API? {#section_2mf_wov_wfu .section} ECS API is an open-source remote procedure call \(RPC\) API that provides API services to Alibaba Cloud users. You can use this API to manage and use ECS instances. The following figure shows the path along which a request is forwarded to call an API. For more information about how to use the ECS API, see [Quick start for ECS APIs](reseller.en-US/API Reference/Quick start for ECS APIs.md#). ![](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/614896/156808284049776_en-US.png) ## Error code InvalidDataDiskCategory.NotSupported is returned when I try to create an ECS instance. What can I do? {#section_rqe_51b_fkf .section} - Problem description: After you call the [EN-US\_TP\_9856.md\#](reseller.en-US/API Reference/Instances/RunInstances.md#) operation to create an ECS instance, the following error information is returned: ``` {#codeblock_dgs_3nb_dh9} { "Code": "InvalidDataDiskCategory.NotSupported", "Message": "Specified disk category is not supported." } ``` - Cause: The error occurred because disks of the specified category cannot be created in the specified zone. - Solution: We recommend that you call the [DescribeAvailableResource](reseller.en-US/API Reference/Regions/DescribeAvailableResource.md#) operation to view the resources available in the zone where you want to create the ECS instance and ensure that there are sufficient resources in that zone. You can also change the value of ZoneId and try again. ``` {#codeblock_70q_r18_4zf} aliyun ecs RunInstances --ImageId win2008_64_ent_r2_cn_40G_alibase_20150429.vhd --InstanceType ecs.g5.large --SecurityGroupId <TheSecuriytyGroupId> --SystemDiskCategory cloud_efficiency --ZoneId cn-hangzhou-c ``` ## How can I create an ECS instance that is assigned a public IP address? {#section_iop_1gx_4ub .section} - Method 1: Call the [EN-US\_TP\_9856.md\#](reseller.en-US/API Reference/Instances/RunInstances.md#) operation with InternetMaxBandwidthOut set to a value greater than 0 to create an ECS instance. The new ECS instance is automatically assigned a public IP address. - Method 2: Call the [EN-US\_TP\_9857.md\#](reseller.en-US/API Reference/Instances/CreateInstance.md#) operation to create an ECS instance. Then call the [EN-US\_TP\_9931.md\#](reseller.en-US/API Reference/Networks/AllocatePublicIpAddress.md#) operation to assign a public IP address to the instance. ## I have created an ECS instance by using an ECS API operation. Why can't the public IP address of the instance be pinged? {#section_2pr_bjo_kqj .section} - Problem description: The new ECS instance that you created by using an ECS API operation cannot connect to the public network, and the public IP address of the instance cannot be pinged. - Cause: You have not added a security group rule to allow the public network to access the instance. - Solution: Call the [EN-US\_TP\_9917.md\#](reseller.en-US/API Reference/Security groups/AuthorizeSecurityGroup.md#) operation to add an inbound rule to the security group to which the instance belongs to allow the public network to access the instance. For example, you can send the following request where IpProtocol is set to ICMP to call the AuthorizeSecurityGroup operation and add an inbound rule that allows the public IP address of this instance to be pinged from any other IP addresses: ``` {#codeblock_x29_ll1_ix9} https://ecs.aliyuncs.com/?Action=AuthorizeSecurityGroup &SecurityGroupId=sg-bp15ed6xe1yxeycg7*** &SourceCidrIp=0.0.0.0/0 &IpProtocol=ICMP &PortRange=-1/-1 &<Common request parameters> ``` ## The error message "The specified IP is already in use." is returned when I use an ECS API operation to bind a public IP address to my instance. What can I do? {#section_qxl_ubh_cso .section} - Problem description: When you call the [EN-US\_TP\_9931.md\#](reseller.en-US/API Reference/Networks/AllocatePublicIpAddress.md#) operation to assign the public IP address specified by IpAddress to your ECS instance, the following error information is returned: ``` {#codeblock_kep_mrx_ifa} { "Code": "IpInUse", "Message": "The specified IP is already in use." } ``` - Cause: The specified IP address is already in use. - Solution: Check whether the IP address is already in use. If yes, try another IP address. ## When I modify the public bandwidth configurations of my instance by using an ECS API operation, can I specify an effective period of time for the new bandwidth configurations? {#section_opz_hdk_3ab .section} You can call the [EN-US\_TP\_9937.md\#](reseller.en-US/API Reference/Networks/ModifyInstanceNetworkSpec.md#) operation to modify the public bandwidth configurations of your ECS instance. The new bandwidth configurations take effect on the instance immediately after the modification is completed. If you only want to temporarily modify the bandwidth configurations of your instance, set StartTime and EndTime to define an effective period of time. If you are using an Elastic IP Address, you can call the [ModifyEipAddressAttribute](../../../../reseller.en-US/API reference/EIP/ModifyEipAddressAttribute.md#) operation to make the modification but you cannot specify an effective period of time. ## Why can't all the security group rules in a security group be displayed when I use an ECS API operation or ECS SDK to query the details of the security group? {#section_0gg_gvb_36g .section} Security group rules can be distinguished by their NIC types, public NIC \(internet\) and internal NIC \(intranet\). When you call the [DescribeSecurityGroupAttribute](reseller.en-US/API Reference/Security groups/DescribeSecurityGroupAttribute.md#) operation to query the details of a security group, the NIC parameter is not required. However, if this parameter is not specified, the default value internet is used. Therefore, when you run the following CLI command to call the DescribeSecurityGroupAttribute operation, only the public security group rules, not all security group rules, in the queried security group are displayed: ``` {#codeblock_tpl_qvr_rxl} aliyun ecs DescribeSecurityGroupAttribute --SecurityGroupId <TheSecurityGroupId> --RegionId <TheRegionId> ``` If you want to view the internal security group rules in a security group \(such as internal security group rules that allow access across internal networks or that are configured for the VPN firewall of Finance Cloud\), run the following command with NicType set to intranet: ``` {#codeblock_na2_bjq_8yl} aliyun ecs DescribeSecurityGroupAttribute --SecurityGroupId <TheSecurityGroupId> --RegionId <TheRegionId> --NicType intranet ``` ## Why does a query made by using the ECS API, ECS SDK, or Alibaba Cloud CLI return only ten entries? {#section_vto_62a_f45 .section} For details, see [Why only ten entries are returned for query request by using APIs or SDK](reseller.en-US/API Reference/Appendix/Why only ten entries are returned for query request by using APIs or SDK.md#).
{ "pile_set_name": "Github" }
%module global_vars %warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK); /* memory leak when setting a ptr/ref variable */ %include std_string.i %inline %{ struct A { int x; }; std::string b; A a; A *ap; const A *cap; A &ar = a; int x; int *xp; int& c_member = x; void *vp; enum Hello { Hi, Hola }; Hello h; Hello *hp; Hello &hr = h; %}
{ "pile_set_name": "Github" }
 Type.registerNamespace("Strings"); Strings.OfficeOM = function() { }; Strings.OfficeOM.registerClass("Strings.OfficeOM"); Strings.OfficeOM.L_ShowWindowDialogNotification = "{0} 希望显示一个新窗口。"; Strings.OfficeOM.L_CannotRegisterEvent = "无法注册事件处理程序。"; Strings.OfficeOM.L_NotImplemented = "未实现函数 {0}。"; Strings.OfficeOM.L_CustomXmlOutOfDateName = "数据不是最新的"; Strings.OfficeOM.L_ActivityLimitReached = "已达到活动限制。"; Strings.OfficeOM.L_InvalidBinding = "无效的绑定"; Strings.OfficeOM.L_BindingCreationError = "绑定创建错误"; Strings.OfficeOM.L_InvalidSetRows = "指定的行无效。"; Strings.OfficeOM.L_CannotWriteToSelection = "无法写入到当前所选内容。"; Strings.OfficeOM.L_IndexOutOfRange = "索引超出范围。"; Strings.OfficeOM.L_ReadSettingsError = "读取设置错误"; Strings.OfficeOM.L_InvalidGetColumns = "指定的列无效。"; Strings.OfficeOM.L_OverwriteWorksheetData = "设置操作失败,因为提供的数据对象将覆盖或移动数据。"; Strings.OfficeOM.L_RowIndexOutOfRange = "行索引值不在允许的范围内。请使用少于行数的值(0 或更大)。"; Strings.OfficeOM.L_ColIndexOutOfRange = "列索引值不在允许的范围内。请使用少于列数的值(0 或更大)。"; Strings.OfficeOM.L_InvalidParameters = "函数 {0} 包含无效参数。"; Strings.OfficeOM.L_DialogAlreadyOpened = "操作失败,因为此外接程序已具有一个活动对话框。"; Strings.OfficeOM.L_SetDataParametersConflict = "指定的参数发生冲突。"; Strings.OfficeOM.L_DataNotMatchCoercionType = "指定的数据对象的类型与当前所选内容不兼容。"; Strings.OfficeOM.L_RunMustReturnPromise = "传递到“.run”方法的批处理函数未返回一个承诺。该函数必须返回一个承诺,以便可以在批处理操作完成时释放任何自动跟踪的对象。一般通过从“context.sync()”返回响应来返回一个承诺。"; Strings.OfficeOM.L_UnsupportedEnumerationMessage = "当前宿主应用程序中不支持枚举。"; Strings.OfficeOM.L_NewWindowCrossZoneConfigureBrowserLink = "配置浏览器"; Strings.OfficeOM.L_InvalidCoercion = "强制类型无效"; Strings.OfficeOM.L_UnsupportedDataObject = "提供的数据对象不受支持。"; Strings.OfficeOM.L_AppNameNotExist = "{0} 的加载项名称不存在。"; Strings.OfficeOM.L_AddBindingFromPromptDefaultText = "请进行选择。"; Strings.OfficeOM.L_DataNotMatchBindingType = "指定的数据对象与绑定类型不兼容。"; Strings.OfficeOM.L_InvalidFormatValue = "一个或多个格式参数具有不允许的值。请仔细检查值,然后重试。"; Strings.OfficeOM.L_OperationNotSupported = "不支持此项操作。"; Strings.OfficeOM.L_InvalidRequestContext = "不能跨不同的请求上下文使用该对象。"; Strings.OfficeOM.L_NamedItemNotFound = "已命名的项目不存在。"; Strings.OfficeOM.L_InvalidGetRows = "指定的行无效。"; Strings.OfficeOM.L_CellFormatAmountBeyondLimits = "注意: 建议由格式 API 调用设置的格式集数少于 100。"; Strings.OfficeOM.L_CustomXmlExceedQuotaName = "已达到选择限制"; Strings.OfficeOM.L_TooManyIncompleteRequests = "等待前一个调用完成。"; Strings.OfficeOM.L_SetDataIsTooLarge = "指定的数据对象太大。"; Strings.OfficeOM.L_DialogAddressNotTrusted = "指定地址未获得外接程序的信任"; Strings.OfficeOM.L_InvalidBindingOperation = "无效的绑定操作"; Strings.OfficeOM.L_APICallFailed = "API 调用失败"; Strings.OfficeOM.L_SpecifiedIdNotExist = "指定的 ID 不存在。"; Strings.OfficeOM.L_SaveSettingsError = "保存设置错误"; Strings.OfficeOM.L_InvalidSetStartRowColumn = "指定的 startRow 或 startColumn 值无效。"; Strings.OfficeOM.L_InvalidFormat = "无效的格式错误"; Strings.OfficeOM.L_InvalidArgument = "参数“{0}”不适用于这种情况、丢失或者格式不正确。"; Strings.OfficeOM.L_EventHandlerAdditionFailed = "未能添加事件处理程序。"; Strings.OfficeOM.L_InvalidAPICall = "无效的 API 调用"; Strings.OfficeOM.L_EventRegistrationError = "事件注册错误"; Strings.OfficeOM.L_CustomXmlError = "自定义 XML 错误。"; Strings.OfficeOM.L_TooManyOptionalFunction = "参数列表中的多个可选函数"; Strings.OfficeOM.L_CustomXmlExceedQuotaMessage = "XPath 将选择限制为 1024 个项目。"; Strings.OfficeOM.L_InvalidSelectionForBindingType = "不能通过当前所选内容和指定的绑定类型创建绑定。"; Strings.OfficeOM.L_OperationNotSupportedOnMatrixData = "所选内容必须采用表格格式。将数据设置为表格格式,然后再试。"; Strings.OfficeOM.L_ShowWindowDialogNotificationIgnore = "忽略"; Strings.OfficeOM.L_SliceSizeNotSupported = "指定的扇区大小不受支持。"; Strings.OfficeOM.L_EventHandlerRemovalFailed = "未能删除事件处理程序。"; Strings.OfficeOM.L_DataReadError = "数据读取错误"; Strings.OfficeOM.L_InvalidDataFormat = "指定的数据对象的格式无效。"; Strings.OfficeOM.L_RequestTimeout = "调用时间太长,无法执行。"; Strings.OfficeOM.L_GetSelectionNotSupported = "不支持当前所选内容。"; Strings.OfficeOM.L_InvalidTableOptionValue = "一个或多个表格选项参数具有不允许的值。请仔细检查值,然后重试。"; Strings.OfficeOM.L_PermissionDenied = "权限被拒绝"; Strings.OfficeOM.L_InvalidDataObject = "无效的数据对象"; Strings.OfficeOM.L_InvalidColumnsForBinding = "指定的列无效。"; Strings.OfficeOM.L_InvalidGetRowColumnCounts = "指定的 rowCount 或 columnCount 值无效。"; Strings.OfficeOM.L_OsfControlTypeNotSupported = "OsfControl 类型不受支持。"; Strings.OfficeOM.L_DialogNavigateError = "对话框导航错误"; Strings.OfficeOM.L_InvalidObjectPath = '对象路径“{0}”不适用于当前尝试执行的操作。如果跨多个 "context.sync" 调用以及在 ".run" 批处理的顺序执行之外使用该对象,请使用 "context.trackedObjects.add()" 和 "context.trackedObjects.remove()" 方法来管理该对象的生存期。'; Strings.OfficeOM.L_InternalError = "内部错误"; Strings.OfficeOM.L_CoercionTypeNotMatchBinding = "指定的强制类型与此绑定类型不兼容。"; Strings.OfficeOM.L_InValidOptionalArgument = "可选参数无效"; Strings.OfficeOM.L_InvalidNamedItemForBindingType = "指定的绑定类型与提供的已命名项目不兼容。"; Strings.OfficeOM.L_InvalidNode = "无效的节点"; Strings.OfficeOM.L_UnknownBindingType = "不支持该绑定类型。"; Strings.OfficeOM.L_EventHandlerNotExist = "找不到此绑定的指定事件处理程序。"; Strings.OfficeOM.L_NoCapability = "您没有足够的权限执行此操作。"; Strings.OfficeOM.L_SettingsCannotSave = "无法保存设置。"; Strings.OfficeOM.L_DataWriteReminder = "数据写入提醒"; Strings.OfficeOM.L_InvalidSetColumns = "指定的列无效。"; Strings.OfficeOM.L_InvalidBindingError = "无效的绑定错误"; Strings.OfficeOM.L_SelectionNotSupportCoercionType = "当前所选内容与指定强制类型不兼容。"; Strings.OfficeOM.L_FormatValueOutOfRange = "值不在允许的范围内。"; Strings.OfficeOM.L_InvalidGetStartRowColumn = "指定的 startRow 或 startColumn 值无效。"; Strings.OfficeOM.L_NetworkProblem = "网络问题"; Strings.OfficeOM.ConnectionFailureWithDetails = "请求失败,状态代码为 {0},错误代码为 {1},并显示以下错误消息: {2}"; Strings.OfficeOM.L_MissingParameter = "缺少的参数"; Strings.OfficeOM.L_NewWindowCrossZone = "浏览器的安全设置阻止创建对话框。请尝试使用其他浏览器,或 {0} 以将“{1}”和地址栏中显示的域置于同一安全区域。"; Strings.OfficeOM.L_SettingsStaleError = "设置过期错误"; Strings.OfficeOM.L_CannotNavigateTo = "该对象位于不支持导航的位置。"; Strings.OfficeOM.L_AppNotExistInitializeNotCalled = "应用程序 {0} 不存在。Microsoft.Office.WebExtension.initialize(reason) 未被调用。"; Strings.OfficeOM.L_CoercionTypeNotSupported = "不支持指定的强制类型。"; Strings.OfficeOM.L_InvalidReadForBlankRow = "指定的行是空的。"; Strings.OfficeOM.L_UnsupportedEnumeration = "不受支持的枚举"; Strings.OfficeOM.L_CloseFileBeforeRetrieve = "在检索另一个文件之前对当前文件调用 closeAsync。"; Strings.OfficeOM.L_CustomXmlOutOfDateMessage = "数据已过期。请重新检索对象。"; Strings.OfficeOM.L_NotSupportedEventType = "不支持指定的事件类型 {0}。"; Strings.OfficeOM.L_GetDataIsTooLarge = "请求的数据集太大。"; Strings.OfficeOM.L_MultipleNamedItemFound = "找到多个具有相同名称的对象。"; Strings.OfficeOM.L_InvalidCellsValue = "一个或多个单元格参数具有不允许的值。请仔细检查值,然后重试。"; Strings.OfficeOM.L_InitializeNotReady = "Office.js 尚未完全加载。请稍后再试或者确保在 Office.initialize 函数上添加初始化代码。"; Strings.OfficeOM.L_NotSupportedBindingType = "不支持指定的绑定类型 {0}。"; Strings.OfficeOM.L_ShuttingDown = "操作失败,因为服务器上的数据不是最新的。"; Strings.OfficeOM.L_FormattingReminder = "格式设置提醒"; Strings.OfficeOM.L_ConnectionFailureWithStatus = "请求失败,状态代码为 {0}。"; Strings.OfficeOM.L_DocumentReadOnly = "当前文档模式不允许所请求的操作。"; Strings.OfficeOM.L_InvalidApiCallInContext = "当前环境下发生无效的 API 呼叫。"; Strings.OfficeOM.L_ShowWindowDialogNotificationAllow = "允许"; Strings.OfficeOM.L_DataWriteError = "数据写入错误"; Strings.OfficeOM.L_FunctionCallFailed = "函数 {0} 调用失败,错误代码: {1}。"; Strings.OfficeOM.L_DataNotMatchBindingSize = "提供的数据对象与当前所选内容的大小不匹配。"; Strings.OfficeOM.L_RequestTokenUnavailable = "已限制此 API 以减慢调用频率。"; Strings.OfficeOM.L_NewWindowCrossZoneErrorString = "浏览器限制阻止创建对话框。对话框的域和外接程序宿主的域不处于同一安全区域。"; Strings.OfficeOM.L_BindingNotExist = "指定的绑定不存在。"; Strings.OfficeOM.L_DisplayDialogError = "显示对话框错误"; Strings.OfficeOM.L_SettingNameNotExist = "指定的设置名称不存在。"; Strings.OfficeOM.L_BrowserAPINotSupported = "此浏览器不支持请求的 API。"; Strings.OfficeOM.L_NonUniformPartialSetNotSupported = "当强制类型表包含合并的单元格时,坐标参数不能与该表一起使用。"; Strings.OfficeOM.L_ElementMissing = "由于缺少某些参数值,无法设置表格单元格的格式。请仔细检查参数,然后重试。"; Strings.OfficeOM.L_ValueNotLoaded = '尚未加载结果对象的值。请先调用相关请求上下文上的 "context.sync()",然后再读取值属性。'; Strings.OfficeOM.L_NavOutOfBound = "操作失败,因为索引超出范围。"; Strings.OfficeOM.L_RedundantCallbackSpecification = "不能在参数列表和可选对象中同时指定回调。"; Strings.OfficeOM.L_PropertyNotLoaded = '属性“{0}”不可用。读取属性的值之前,请先对包含对象调用 load 方法,再对关联的请求上下文调用 "context.sync()"。'; Strings.OfficeOM.L_SettingsAreStale = "无法保存设置,因为它们不是最新的。"; Strings.OfficeOM.L_MissingRequiredArguments = "缺少某些必需的参数"; Strings.OfficeOM.L_NonUniformPartialGetNotSupported = "当强制类型表包含合并的单元格时,坐标参数不能与该表一起使用。"; Strings.OfficeOM.L_OutOfRange = "超出范围"; Strings.OfficeOM.L_HostError = "主机错误"; Strings.OfficeOM.L_TooManyOptionalObjects = "参数列表中的多个可选对象"; Strings.OfficeOM.L_APINotSupported = "不支持 API"; Strings.OfficeOM.L_UserClickIgnore = "用户已选择忽略对话框。"; Strings.OfficeOM.L_BindingToMultipleSelection = "不支持非连续选择。"; Strings.OfficeOM.L_InternalErrorDescription = "发生了内部错误。"; Strings.OfficeOM.L_DataStale = "数据不是最新的"; Strings.OfficeOM.L_MemoryLimit = "超过了内存限制"; Strings.OfficeOM.L_CellDataAmountBeyondLimits = "注意: 建议表格中的单元格数少于 20,000 个单元格。"; Strings.OfficeOM.L_SelectionCannotBound = "无法绑定到当前所选内容。"; Strings.OfficeOM.L_UserNotSignedIn = "没有用户登录到 Office。"; Strings.OfficeOM.L_BadSelectorString = "传递到选择器中的字符串格式不正确或不受支持。"; Strings.OfficeOM.L_InvalidValue = "无效的值"; Strings.OfficeOM.L_DataNotMatchSelection = "提供的数据对象与当前所选内容的形状或尺寸不兼容。"; Strings.OfficeOM.L_NotSupported = "不支持函数 {0}。"; Strings.OfficeOM.L_CustomXmlNodeNotFound = "找不到指定的节点。"; Strings.OfficeOM.L_NetworkProblemRetrieveFile = "发生网络问题,无法检索该文件。"; Strings.OfficeOM.L_TooManyArguments = "参数太多"; Strings.OfficeOM.L_OperationNotSupportedOnThisBindingType = "此绑定类型上不支持操作。"; Strings.OfficeOM.L_GetDataParametersConflict = "指定的参数发生冲突。"; Strings.OfficeOM.L_FileTypeNotSupported = "不支持指定的文件类型。"; Strings.OfficeOM.L_CallbackNotAFunction = "回调必须是函数类型,而其类型为 {0}。"
{ "pile_set_name": "Github" }
/* * HP zx1 AGPGART routines. * * (c) Copyright 2002, 2003 Hewlett-Packard Development Company, L.P. * Bjorn Helgaas <bjorn.helgaas@hp.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/acpi.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/init.h> #include <linux/agp_backend.h> #include <linux/log2.h> #include <asm/acpi-ext.h> #include "agp.h" #define HP_ZX1_IOC_OFFSET 0x1000 /* ACPI reports SBA, we want IOC */ /* HP ZX1 IOC registers */ #define HP_ZX1_IBASE 0x300 #define HP_ZX1_IMASK 0x308 #define HP_ZX1_PCOM 0x310 #define HP_ZX1_TCNFG 0x318 #define HP_ZX1_PDIR_BASE 0x320 #define HP_ZX1_IOVA_BASE GB(1UL) #define HP_ZX1_IOVA_SIZE GB(1UL) #define HP_ZX1_GART_SIZE (HP_ZX1_IOVA_SIZE / 2) #define HP_ZX1_SBA_IOMMU_COOKIE 0x0000badbadc0ffeeUL #define HP_ZX1_PDIR_VALID_BIT 0x8000000000000000UL #define HP_ZX1_IOVA_TO_PDIR(va) ((va - hp_private.iova_base) >> hp_private.io_tlb_shift) #define AGP8X_MODE_BIT 3 #define AGP8X_MODE (1 << AGP8X_MODE_BIT) /* AGP bridge need not be PCI device, but DRM thinks it is. */ static struct pci_dev fake_bridge_dev; static int hp_zx1_gart_found; static struct aper_size_info_fixed hp_zx1_sizes[] = { {0, 0, 0}, /* filled in by hp_zx1_fetch_size() */ }; static struct gatt_mask hp_zx1_masks[] = { {.mask = HP_ZX1_PDIR_VALID_BIT, .type = 0} }; static struct _hp_private { volatile u8 __iomem *ioc_regs; volatile u8 __iomem *lba_regs; int lba_cap_offset; u64 *io_pdir; // PDIR for entire IOVA u64 *gatt; // PDIR just for GART (subset of above) u64 gatt_entries; u64 iova_base; u64 gart_base; u64 gart_size; u64 io_pdir_size; int io_pdir_owner; // do we own it, or share it with sba_iommu? int io_page_size; int io_tlb_shift; int io_tlb_ps; // IOC ps config int io_pages_per_kpage; } hp_private; static int __init hp_zx1_ioc_shared(void) { struct _hp_private *hp = &hp_private; printk(KERN_INFO PFX "HP ZX1 IOC: IOPDIR shared with sba_iommu\n"); /* * IOC already configured by sba_iommu module; just use * its setup. We assume: * - IOVA space is 1Gb in size * - first 512Mb is IOMMU, second 512Mb is GART */ hp->io_tlb_ps = readq(hp->ioc_regs+HP_ZX1_TCNFG); switch (hp->io_tlb_ps) { case 0: hp->io_tlb_shift = 12; break; case 1: hp->io_tlb_shift = 13; break; case 2: hp->io_tlb_shift = 14; break; case 3: hp->io_tlb_shift = 16; break; default: printk(KERN_ERR PFX "Invalid IOTLB page size " "configuration 0x%x\n", hp->io_tlb_ps); hp->gatt = NULL; hp->gatt_entries = 0; return -ENODEV; } hp->io_page_size = 1 << hp->io_tlb_shift; hp->io_pages_per_kpage = PAGE_SIZE / hp->io_page_size; hp->iova_base = readq(hp->ioc_regs+HP_ZX1_IBASE) & ~0x1; hp->gart_base = hp->iova_base + HP_ZX1_IOVA_SIZE - HP_ZX1_GART_SIZE; hp->gart_size = HP_ZX1_GART_SIZE; hp->gatt_entries = hp->gart_size / hp->io_page_size; hp->io_pdir = phys_to_virt(readq(hp->ioc_regs+HP_ZX1_PDIR_BASE)); hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)]; if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) { /* Normal case when no AGP device in system */ hp->gatt = NULL; hp->gatt_entries = 0; printk(KERN_ERR PFX "No reserved IO PDIR entry found; " "GART disabled\n"); return -ENODEV; } return 0; } static int __init hp_zx1_ioc_owner (void) { struct _hp_private *hp = &hp_private; printk(KERN_INFO PFX "HP ZX1 IOC: IOPDIR dedicated to GART\n"); /* * Select an IOV page size no larger than system page size. */ if (PAGE_SIZE >= KB(64)) { hp->io_tlb_shift = 16; hp->io_tlb_ps = 3; } else if (PAGE_SIZE >= KB(16)) { hp->io_tlb_shift = 14; hp->io_tlb_ps = 2; } else if (PAGE_SIZE >= KB(8)) { hp->io_tlb_shift = 13; hp->io_tlb_ps = 1; } else { hp->io_tlb_shift = 12; hp->io_tlb_ps = 0; } hp->io_page_size = 1 << hp->io_tlb_shift; hp->io_pages_per_kpage = PAGE_SIZE / hp->io_page_size; hp->iova_base = HP_ZX1_IOVA_BASE; hp->gart_size = HP_ZX1_GART_SIZE; hp->gart_base = hp->iova_base + HP_ZX1_IOVA_SIZE - hp->gart_size; hp->gatt_entries = hp->gart_size / hp->io_page_size; hp->io_pdir_size = (HP_ZX1_IOVA_SIZE / hp->io_page_size) * sizeof(u64); return 0; } static int __init hp_zx1_ioc_init (u64 hpa) { struct _hp_private *hp = &hp_private; hp->ioc_regs = ioremap(hpa, 1024); if (!hp->ioc_regs) return -ENOMEM; /* * If the IOTLB is currently disabled, we can take it over. * Otherwise, we have to share with sba_iommu. */ hp->io_pdir_owner = (readq(hp->ioc_regs+HP_ZX1_IBASE) & 0x1) == 0; if (hp->io_pdir_owner) return hp_zx1_ioc_owner(); return hp_zx1_ioc_shared(); } static int hp_zx1_lba_find_capability (volatile u8 __iomem *hpa, int cap) { u16 status; u8 pos, id; int ttl = 48; status = readw(hpa+PCI_STATUS); if (!(status & PCI_STATUS_CAP_LIST)) return 0; pos = readb(hpa+PCI_CAPABILITY_LIST); while (ttl-- && pos >= 0x40) { pos &= ~3; id = readb(hpa+pos+PCI_CAP_LIST_ID); if (id == 0xff) break; if (id == cap) return pos; pos = readb(hpa+pos+PCI_CAP_LIST_NEXT); } return 0; } static int __init hp_zx1_lba_init (u64 hpa) { struct _hp_private *hp = &hp_private; int cap; hp->lba_regs = ioremap(hpa, 256); if (!hp->lba_regs) return -ENOMEM; hp->lba_cap_offset = hp_zx1_lba_find_capability(hp->lba_regs, PCI_CAP_ID_AGP); cap = readl(hp->lba_regs+hp->lba_cap_offset) & 0xff; if (cap != PCI_CAP_ID_AGP) { printk(KERN_ERR PFX "Invalid capability ID 0x%02x at 0x%x\n", cap, hp->lba_cap_offset); iounmap(hp->lba_regs); return -ENODEV; } return 0; } static int hp_zx1_fetch_size(void) { int size; size = hp_private.gart_size / MB(1); hp_zx1_sizes[0].size = size; agp_bridge->current_size = (void *) &hp_zx1_sizes[0]; return size; } static int hp_zx1_configure (void) { struct _hp_private *hp = &hp_private; agp_bridge->gart_bus_addr = hp->gart_base; agp_bridge->capndx = hp->lba_cap_offset; agp_bridge->mode = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS); if (hp->io_pdir_owner) { writel(virt_to_phys(hp->io_pdir), hp->ioc_regs+HP_ZX1_PDIR_BASE); readl(hp->ioc_regs+HP_ZX1_PDIR_BASE); writel(hp->io_tlb_ps, hp->ioc_regs+HP_ZX1_TCNFG); readl(hp->ioc_regs+HP_ZX1_TCNFG); writel((unsigned int)(~(HP_ZX1_IOVA_SIZE-1)), hp->ioc_regs+HP_ZX1_IMASK); readl(hp->ioc_regs+HP_ZX1_IMASK); writel(hp->iova_base|1, hp->ioc_regs+HP_ZX1_IBASE); readl(hp->ioc_regs+HP_ZX1_IBASE); writel(hp->iova_base|ilog2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM); readl(hp->ioc_regs+HP_ZX1_PCOM); } return 0; } static void hp_zx1_cleanup (void) { struct _hp_private *hp = &hp_private; if (hp->ioc_regs) { if (hp->io_pdir_owner) { writeq(0, hp->ioc_regs+HP_ZX1_IBASE); readq(hp->ioc_regs+HP_ZX1_IBASE); } iounmap(hp->ioc_regs); } if (hp->lba_regs) iounmap(hp->lba_regs); } static void hp_zx1_tlbflush (struct agp_memory *mem) { struct _hp_private *hp = &hp_private; writeq(hp->gart_base | ilog2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM); readq(hp->ioc_regs+HP_ZX1_PCOM); } static int hp_zx1_create_gatt_table (struct agp_bridge_data *bridge) { struct _hp_private *hp = &hp_private; int i; if (hp->io_pdir_owner) { hp->io_pdir = (u64 *) __get_free_pages(GFP_KERNEL, get_order(hp->io_pdir_size)); if (!hp->io_pdir) { printk(KERN_ERR PFX "Couldn't allocate contiguous " "memory for I/O PDIR\n"); hp->gatt = NULL; hp->gatt_entries = 0; return -ENOMEM; } memset(hp->io_pdir, 0, hp->io_pdir_size); hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)]; } for (i = 0; i < hp->gatt_entries; i++) { hp->gatt[i] = (unsigned long) agp_bridge->scratch_page; } return 0; } static int hp_zx1_free_gatt_table (struct agp_bridge_data *bridge) { struct _hp_private *hp = &hp_private; if (hp->io_pdir_owner) free_pages((unsigned long) hp->io_pdir, get_order(hp->io_pdir_size)); else hp->gatt[0] = HP_ZX1_SBA_IOMMU_COOKIE; return 0; } static int hp_zx1_insert_memory (struct agp_memory *mem, off_t pg_start, int type) { struct _hp_private *hp = &hp_private; int i, k; off_t j, io_pg_start; int io_pg_count; if (type != 0 || mem->type != 0) { return -EINVAL; } io_pg_start = hp->io_pages_per_kpage * pg_start; io_pg_count = hp->io_pages_per_kpage * mem->page_count; if ((io_pg_start + io_pg_count) > hp->gatt_entries) { return -EINVAL; } j = io_pg_start; while (j < (io_pg_start + io_pg_count)) { if (hp->gatt[j]) { return -EBUSY; } j++; } if (!mem->is_flushed) { global_cache_flush(); mem->is_flushed = true; } for (i = 0, j = io_pg_start; i < mem->page_count; i++) { unsigned long paddr; paddr = page_to_phys(mem->pages[i]); for (k = 0; k < hp->io_pages_per_kpage; k++, j++, paddr += hp->io_page_size) { hp->gatt[j] = HP_ZX1_PDIR_VALID_BIT | paddr; } } agp_bridge->driver->tlb_flush(mem); return 0; } static int hp_zx1_remove_memory (struct agp_memory *mem, off_t pg_start, int type) { struct _hp_private *hp = &hp_private; int i, io_pg_start, io_pg_count; if (type != 0 || mem->type != 0) { return -EINVAL; } io_pg_start = hp->io_pages_per_kpage * pg_start; io_pg_count = hp->io_pages_per_kpage * mem->page_count; for (i = io_pg_start; i < io_pg_count + io_pg_start; i++) { hp->gatt[i] = agp_bridge->scratch_page; } agp_bridge->driver->tlb_flush(mem); return 0; } static unsigned long hp_zx1_mask_memory (struct agp_bridge_data *bridge, dma_addr_t addr, int type) { return HP_ZX1_PDIR_VALID_BIT | addr; } static void hp_zx1_enable (struct agp_bridge_data *bridge, u32 mode) { struct _hp_private *hp = &hp_private; u32 command; command = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS); command = agp_collect_device_status(bridge, mode, command); command |= 0x00000100; writel(command, hp->lba_regs+hp->lba_cap_offset+PCI_AGP_COMMAND); agp_device_command(command, (mode & AGP8X_MODE) != 0); } const struct agp_bridge_driver hp_zx1_driver = { .owner = THIS_MODULE, .size_type = FIXED_APER_SIZE, .configure = hp_zx1_configure, .fetch_size = hp_zx1_fetch_size, .cleanup = hp_zx1_cleanup, .tlb_flush = hp_zx1_tlbflush, .mask_memory = hp_zx1_mask_memory, .masks = hp_zx1_masks, .agp_enable = hp_zx1_enable, .cache_flush = global_cache_flush, .create_gatt_table = hp_zx1_create_gatt_table, .free_gatt_table = hp_zx1_free_gatt_table, .insert_memory = hp_zx1_insert_memory, .remove_memory = hp_zx1_remove_memory, .alloc_by_type = agp_generic_alloc_by_type, .free_by_type = agp_generic_free_by_type, .agp_alloc_page = agp_generic_alloc_page, .agp_alloc_pages = agp_generic_alloc_pages, .agp_destroy_page = agp_generic_destroy_page, .agp_destroy_pages = agp_generic_destroy_pages, .agp_type_to_mask_type = agp_generic_type_to_mask_type, .cant_use_aperture = true, }; static int __init hp_zx1_setup (u64 ioc_hpa, u64 lba_hpa) { struct agp_bridge_data *bridge; int error = 0; error = hp_zx1_ioc_init(ioc_hpa); if (error) goto fail; error = hp_zx1_lba_init(lba_hpa); if (error) goto fail; bridge = agp_alloc_bridge(); if (!bridge) { error = -ENOMEM; goto fail; } bridge->driver = &hp_zx1_driver; fake_bridge_dev.vendor = PCI_VENDOR_ID_HP; fake_bridge_dev.device = PCI_DEVICE_ID_HP_PCIX_LBA; bridge->dev = &fake_bridge_dev; error = agp_add_bridge(bridge); fail: if (error) hp_zx1_cleanup(); return error; } static acpi_status __init zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret) { acpi_handle handle, parent; acpi_status status; struct acpi_device_info *info; u64 lba_hpa, sba_hpa, length; int match; status = hp_acpi_csr_space(obj, &lba_hpa, &length); if (ACPI_FAILURE(status)) return AE_OK; /* keep looking for another bridge */ /* Look for an enclosing IOC scope and find its CSR space */ handle = obj; do { status = acpi_get_object_info(handle, &info); if (ACPI_SUCCESS(status)) { /* TBD check _CID also */ info->hardware_id.string[sizeof(info->hardware_id.length)-1] = '\0'; match = (strcmp(info->hardware_id.string, "HWP0001") == 0); kfree(info); if (match) { status = hp_acpi_csr_space(handle, &sba_hpa, &length); if (ACPI_SUCCESS(status)) break; else { printk(KERN_ERR PFX "Detected HP ZX1 " "AGP LBA but no IOC.\n"); return AE_OK; } } } status = acpi_get_parent(handle, &parent); handle = parent; } while (ACPI_SUCCESS(status)); if (hp_zx1_setup(sba_hpa + HP_ZX1_IOC_OFFSET, lba_hpa)) return AE_OK; printk(KERN_INFO PFX "Detected HP ZX1 %s AGP chipset " "(ioc=%llx, lba=%llx)\n", (char *)context, sba_hpa + HP_ZX1_IOC_OFFSET, lba_hpa); hp_zx1_gart_found = 1; return AE_CTRL_TERMINATE; /* we only support one bridge; quit looking */ } static int __init agp_hp_init (void) { if (agp_off) return -EINVAL; acpi_get_devices("HWP0003", zx1_gart_probe, "HWP0003", NULL); if (hp_zx1_gart_found) return 0; acpi_get_devices("HWP0007", zx1_gart_probe, "HWP0007", NULL); if (hp_zx1_gart_found) return 0; return -ENODEV; } static void __exit agp_hp_cleanup (void) { } module_init(agp_hp_init); module_exit(agp_hp_cleanup); MODULE_LICENSE("GPL and additional rights");
{ "pile_set_name": "Github" }
package thebetweenlands.common.item.misc; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import thebetweenlands.common.tile.TileEntityBarrel; public class ItemBarrel extends ItemBlock { private static final String NBT_FLUID_STACK = "bl.fluidStack"; public ItemBarrel(Block block) { super(block); } @Override public int getItemStackLimit(ItemStack stack) { return stack.getTagCompound() != null ? 1 : super.getItemStackLimit(stack); } @SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); FluidStack fluidStack = this.getFluidStack(stack); if(fluidStack != null) { tooltip.add(fluidStack.getLocalizedName() + " (" + fluidStack.amount + "mb)"); } } @Override public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) { if(super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState)) { FluidStack fluidStack = this.getFluidStack(stack); if(fluidStack != null) { TileEntity te = world.getTileEntity(pos); if(te instanceof TileEntityBarrel) { ((TileEntityBarrel) te).fill(fluidStack, true); } } return true; } return false; } public FluidStack getFluidStack(ItemStack stack) { NBTTagCompound nbt = stack.getTagCompound(); if(nbt != null && nbt.hasKey(NBT_FLUID_STACK, Constants.NBT.TAG_COMPOUND)) { return FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag(NBT_FLUID_STACK)); } return null; } public ItemStack fromBarrel(TileEntityBarrel te) { ItemStack stack = new ItemStack(this); IFluidTankProperties props = te.getTankProperties()[0]; FluidStack fluidStack = props.getContents(); if(fluidStack != null && fluidStack.amount > 0) { stack.setTagInfo(NBT_FLUID_STACK, fluidStack.writeToNBT(new NBTTagCompound())); } return stack; } }
{ "pile_set_name": "Github" }
// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build mipsle,linux package unix const ( SizeofPtr = 0x4 SizeofShort = 0x2 SizeofInt = 0x4 SizeofLong = 0x4 SizeofLongLong = 0x8 PathMax = 0x1000 ) type ( _C_short int16 _C_int int32 _C_long int32 _C_long_long int64 ) type Timespec struct { Sec int32 Nsec int32 } type Timeval struct { Sec int32 Usec int32 } type Timex struct { Modes uint32 Offset int32 Freq int32 Maxerror int32 Esterror int32 Status int32 Constant int32 Precision int32 Tolerance int32 Time Timeval Tick int32 Ppsfreq int32 Jitter int32 Shift int32 Stabil int32 Jitcnt int32 Calcnt int32 Errcnt int32 Stbcnt int32 Tai int32 _ [44]byte } const ( TIME_OK = 0x0 TIME_INS = 0x1 TIME_DEL = 0x2 TIME_OOP = 0x3 TIME_WAIT = 0x4 TIME_ERROR = 0x5 TIME_BAD = 0x5 ) type Time_t int32 type Tms struct { Utime int32 Stime int32 Cutime int32 Cstime int32 } type Utimbuf struct { Actime int32 Modtime int32 } type Rusage struct { Utime Timeval Stime Timeval Maxrss int32 Ixrss int32 Idrss int32 Isrss int32 Minflt int32 Majflt int32 Nswap int32 Inblock int32 Oublock int32 Msgsnd int32 Msgrcv int32 Nsignals int32 Nvcsw int32 Nivcsw int32 } type Rlimit struct { Cur uint64 Max uint64 } type _Gid_t uint32 type Stat_t struct { Dev uint32 Pad1 [3]int32 Ino uint64 Mode uint32 Nlink uint32 Uid uint32 Gid uint32 Rdev uint32 Pad2 [3]int32 Size int64 Atim Timespec Mtim Timespec Ctim Timespec Blksize int32 Pad4 int32 Blocks int64 Pad5 [14]int32 } type StatxTimestamp struct { Sec int64 Nsec uint32 _ int32 } type Statx_t struct { Mask uint32 Blksize uint32 Attributes uint64 Nlink uint32 Uid uint32 Gid uint32 Mode uint16 _ [1]uint16 Ino uint64 Size uint64 Blocks uint64 Attributes_mask uint64 Atime StatxTimestamp Btime StatxTimestamp Ctime StatxTimestamp Mtime StatxTimestamp Rdev_major uint32 Rdev_minor uint32 Dev_major uint32 Dev_minor uint32 _ [14]uint64 } type Dirent struct { Ino uint64 Off int64 Reclen uint16 Type uint8 Name [256]int8 _ [5]byte } type Fsid struct { Val [2]int32 } type Flock_t struct { Type int16 Whence int16 _ [4]byte Start int64 Len int64 Pid int32 _ [4]byte } type FscryptPolicy struct { Version uint8 Contents_encryption_mode uint8 Filenames_encryption_mode uint8 Flags uint8 Master_key_descriptor [8]uint8 } type FscryptKey struct { Mode uint32 Raw [64]uint8 Size uint32 } type FscryptPolicyV1 struct { Version uint8 Contents_encryption_mode uint8 Filenames_encryption_mode uint8 Flags uint8 Master_key_descriptor [8]uint8 } type FscryptPolicyV2 struct { Version uint8 Contents_encryption_mode uint8 Filenames_encryption_mode uint8 Flags uint8 _ [4]uint8 Master_key_identifier [16]uint8 } type FscryptGetPolicyExArg struct { Size uint64 Policy [24]byte } type FscryptKeySpecifier struct { Type uint32 _ uint32 U [32]byte } type FscryptAddKeyArg struct { Key_spec FscryptKeySpecifier Raw_size uint32 _ [9]uint32 } type FscryptRemoveKeyArg struct { Key_spec FscryptKeySpecifier Removal_status_flags uint32 _ [5]uint32 } type FscryptGetKeyStatusArg struct { Key_spec FscryptKeySpecifier _ [6]uint32 Status uint32 Status_flags uint32 User_count uint32 _ [13]uint32 } type KeyctlDHParams struct { Private int32 Prime int32 Base int32 } const ( FADV_NORMAL = 0x0 FADV_RANDOM = 0x1 FADV_SEQUENTIAL = 0x2 FADV_WILLNEED = 0x3 FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) type RawSockaddrInet4 struct { Family uint16 Port uint16 Addr [4]byte /* in_addr */ Zero [8]uint8 } type RawSockaddrInet6 struct { Family uint16 Port uint16 Flowinfo uint32 Addr [16]byte /* in6_addr */ Scope_id uint32 } type RawSockaddrUnix struct { Family uint16 Path [108]int8 } type RawSockaddrLinklayer struct { Family uint16 Protocol uint16 Ifindex int32 Hatype uint16 Pkttype uint8 Halen uint8 Addr [8]uint8 } type RawSockaddrNetlink struct { Family uint16 Pad uint16 Pid uint32 Groups uint32 } type RawSockaddrHCI struct { Family uint16 Dev uint16 Channel uint16 } type RawSockaddrL2 struct { Family uint16 Psm uint16 Bdaddr [6]uint8 Cid uint16 Bdaddr_type uint8 _ [1]byte } type RawSockaddrRFCOMM struct { Family uint16 Bdaddr [6]uint8 Channel uint8 _ [1]byte } type RawSockaddrCAN struct { Family uint16 Ifindex int32 Addr [16]byte } type RawSockaddrALG struct { Family uint16 Type [14]uint8 Feat uint32 Mask uint32 Name [64]uint8 } type RawSockaddrVM struct { Family uint16 Reserved1 uint16 Port uint32 Cid uint32 Zero [4]uint8 } type RawSockaddrXDP struct { Family uint16 Flags uint16 Ifindex uint32 Queue_id uint32 Shared_umem_fd uint32 } type RawSockaddrPPPoX [0x1e]byte type RawSockaddrTIPC struct { Family uint16 Addrtype uint8 Scope int8 Addr [12]byte } type RawSockaddr struct { Family uint16 Data [14]int8 } type RawSockaddrAny struct { Addr RawSockaddr Pad [96]int8 } type _Socklen uint32 type Linger struct { Onoff int32 Linger int32 } type Iovec struct { Base *byte Len uint32 } type IPMreq struct { Multiaddr [4]byte /* in_addr */ Interface [4]byte /* in_addr */ } type IPMreqn struct { Multiaddr [4]byte /* in_addr */ Address [4]byte /* in_addr */ Ifindex int32 } type IPv6Mreq struct { Multiaddr [16]byte /* in6_addr */ Interface uint32 } type PacketMreq struct { Ifindex int32 Type uint16 Alen uint16 Address [8]uint8 } type Msghdr struct { Name *byte Namelen uint32 Iov *Iovec Iovlen uint32 Control *byte Controllen uint32 Flags int32 } type Cmsghdr struct { Len uint32 Level int32 Type int32 } type Inet4Pktinfo struct { Ifindex int32 Spec_dst [4]byte /* in_addr */ Addr [4]byte /* in_addr */ } type Inet6Pktinfo struct { Addr [16]byte /* in6_addr */ Ifindex uint32 } type IPv6MTUInfo struct { Addr RawSockaddrInet6 Mtu uint32 } type ICMPv6Filter struct { Data [8]uint32 } type Ucred struct { Pid int32 Uid uint32 Gid uint32 } type TCPInfo struct { State uint8 Ca_state uint8 Retransmits uint8 Probes uint8 Backoff uint8 Options uint8 Rto uint32 Ato uint32 Snd_mss uint32 Rcv_mss uint32 Unacked uint32 Sacked uint32 Lost uint32 Retrans uint32 Fackets uint32 Last_data_sent uint32 Last_ack_sent uint32 Last_data_recv uint32 Last_ack_recv uint32 Pmtu uint32 Rcv_ssthresh uint32 Rtt uint32 Rttvar uint32 Snd_ssthresh uint32 Snd_cwnd uint32 Advmss uint32 Reordering uint32 Rcv_rtt uint32 Rcv_space uint32 Total_retrans uint32 } type CanFilter struct { Id uint32 Mask uint32 } const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c SizeofSockaddrAny = 0x70 SizeofSockaddrUnix = 0x6e SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 SizeofSockaddrL2 = 0xe SizeofSockaddrRFCOMM = 0xa SizeofSockaddrCAN = 0x18 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 SizeofSockaddrXDP = 0x10 SizeofSockaddrPPPoX = 0x1e SizeofSockaddrTIPC = 0x10 SizeofLinger = 0x8 SizeofIovec = 0x8 SizeofIPMreq = 0x8 SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 SizeofPacketMreq = 0x10 SizeofMsghdr = 0x1c SizeofCmsghdr = 0xc SizeofInet4Pktinfo = 0xc SizeofInet6Pktinfo = 0x14 SizeofIPv6MTUInfo = 0x20 SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 SizeofCanFilter = 0x8 ) const ( NDA_UNSPEC = 0x0 NDA_DST = 0x1 NDA_LLADDR = 0x2 NDA_CACHEINFO = 0x3 NDA_PROBES = 0x4 NDA_VLAN = 0x5 NDA_PORT = 0x6 NDA_VNI = 0x7 NDA_IFINDEX = 0x8 NDA_MASTER = 0x9 NDA_LINK_NETNSID = 0xa NDA_SRC_VNI = 0xb NTF_USE = 0x1 NTF_SELF = 0x2 NTF_MASTER = 0x4 NTF_PROXY = 0x8 NTF_EXT_LEARNED = 0x10 NTF_OFFLOADED = 0x20 NTF_ROUTER = 0x80 NUD_INCOMPLETE = 0x1 NUD_REACHABLE = 0x2 NUD_STALE = 0x4 NUD_DELAY = 0x8 NUD_PROBE = 0x10 NUD_FAILED = 0x20 NUD_NOARP = 0x40 NUD_PERMANENT = 0x80 NUD_NONE = 0x0 IFA_UNSPEC = 0x0 IFA_ADDRESS = 0x1 IFA_LOCAL = 0x2 IFA_LABEL = 0x3 IFA_BROADCAST = 0x4 IFA_ANYCAST = 0x5 IFA_CACHEINFO = 0x6 IFA_MULTICAST = 0x7 IFA_FLAGS = 0x8 IFA_RT_PRIORITY = 0x9 IFA_TARGET_NETNSID = 0xa IFLA_UNSPEC = 0x0 IFLA_ADDRESS = 0x1 IFLA_BROADCAST = 0x2 IFLA_IFNAME = 0x3 IFLA_MTU = 0x4 IFLA_LINK = 0x5 IFLA_QDISC = 0x6 IFLA_STATS = 0x7 IFLA_COST = 0x8 IFLA_PRIORITY = 0x9 IFLA_MASTER = 0xa IFLA_WIRELESS = 0xb IFLA_PROTINFO = 0xc IFLA_TXQLEN = 0xd IFLA_MAP = 0xe IFLA_WEIGHT = 0xf IFLA_OPERSTATE = 0x10 IFLA_LINKMODE = 0x11 IFLA_LINKINFO = 0x12 IFLA_NET_NS_PID = 0x13 IFLA_IFALIAS = 0x14 IFLA_NUM_VF = 0x15 IFLA_VFINFO_LIST = 0x16 IFLA_STATS64 = 0x17 IFLA_VF_PORTS = 0x18 IFLA_PORT_SELF = 0x19 IFLA_AF_SPEC = 0x1a IFLA_GROUP = 0x1b IFLA_NET_NS_FD = 0x1c IFLA_EXT_MASK = 0x1d IFLA_PROMISCUITY = 0x1e IFLA_NUM_TX_QUEUES = 0x1f IFLA_NUM_RX_QUEUES = 0x20 IFLA_CARRIER = 0x21 IFLA_PHYS_PORT_ID = 0x22 IFLA_CARRIER_CHANGES = 0x23 IFLA_PHYS_SWITCH_ID = 0x24 IFLA_LINK_NETNSID = 0x25 IFLA_PHYS_PORT_NAME = 0x26 IFLA_PROTO_DOWN = 0x27 IFLA_GSO_MAX_SEGS = 0x28 IFLA_GSO_MAX_SIZE = 0x29 IFLA_PAD = 0x2a IFLA_XDP = 0x2b IFLA_EVENT = 0x2c IFLA_NEW_NETNSID = 0x2d IFLA_IF_NETNSID = 0x2e IFLA_TARGET_NETNSID = 0x2e IFLA_CARRIER_UP_COUNT = 0x2f IFLA_CARRIER_DOWN_COUNT = 0x30 IFLA_NEW_IFINDEX = 0x31 IFLA_MIN_MTU = 0x32 IFLA_MAX_MTU = 0x33 IFLA_MAX = 0x35 IFLA_INFO_KIND = 0x1 IFLA_INFO_DATA = 0x2 IFLA_INFO_XSTATS = 0x3 IFLA_INFO_SLAVE_KIND = 0x4 IFLA_INFO_SLAVE_DATA = 0x5 RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_SITE = 0xc8 RT_SCOPE_LINK = 0xfd RT_SCOPE_HOST = 0xfe RT_SCOPE_NOWHERE = 0xff RT_TABLE_UNSPEC = 0x0 RT_TABLE_COMPAT = 0xfc RT_TABLE_DEFAULT = 0xfd RT_TABLE_MAIN = 0xfe RT_TABLE_LOCAL = 0xff RT_TABLE_MAX = 0xffffffff RTA_UNSPEC = 0x0 RTA_DST = 0x1 RTA_SRC = 0x2 RTA_IIF = 0x3 RTA_OIF = 0x4 RTA_GATEWAY = 0x5 RTA_PRIORITY = 0x6 RTA_PREFSRC = 0x7 RTA_METRICS = 0x8 RTA_MULTIPATH = 0x9 RTA_FLOW = 0xb RTA_CACHEINFO = 0xc RTA_TABLE = 0xf RTA_MARK = 0x10 RTA_MFC_STATS = 0x11 RTA_VIA = 0x12 RTA_NEWDST = 0x13 RTA_PREF = 0x14 RTA_ENCAP_TYPE = 0x15 RTA_ENCAP = 0x16 RTA_EXPIRES = 0x17 RTA_PAD = 0x18 RTA_UID = 0x19 RTA_TTL_PROPAGATE = 0x1a RTA_IP_PROTO = 0x1b RTA_SPORT = 0x1c RTA_DPORT = 0x1d RTN_UNSPEC = 0x0 RTN_UNICAST = 0x1 RTN_LOCAL = 0x2 RTN_BROADCAST = 0x3 RTN_ANYCAST = 0x4 RTN_MULTICAST = 0x5 RTN_BLACKHOLE = 0x6 RTN_UNREACHABLE = 0x7 RTN_PROHIBIT = 0x8 RTN_THROW = 0x9 RTN_NAT = 0xa RTN_XRESOLVE = 0xb SizeofNlMsghdr = 0x10 SizeofNlMsgerr = 0x14 SizeofRtGenmsg = 0x1 SizeofNlAttr = 0x4 SizeofRtAttr = 0x4 SizeofIfInfomsg = 0x10 SizeofIfAddrmsg = 0x8 SizeofIfaCacheinfo = 0x10 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 SizeofNdUseroptmsg = 0x10 SizeofNdMsg = 0xc ) type NlMsghdr struct { Len uint32 Type uint16 Flags uint16 Seq uint32 Pid uint32 } type NlMsgerr struct { Error int32 Msg NlMsghdr } type RtGenmsg struct { Family uint8 } type NlAttr struct { Len uint16 Type uint16 } type RtAttr struct { Len uint16 Type uint16 } type IfInfomsg struct { Family uint8 _ uint8 Type uint16 Index int32 Flags uint32 Change uint32 } type IfAddrmsg struct { Family uint8 Prefixlen uint8 Flags uint8 Scope uint8 Index uint32 } type IfaCacheinfo struct { Prefered uint32 Valid uint32 Cstamp uint32 Tstamp uint32 } type RtMsg struct { Family uint8 Dst_len uint8 Src_len uint8 Tos uint8 Table uint8 Protocol uint8 Scope uint8 Type uint8 Flags uint32 } type RtNexthop struct { Len uint16 Flags uint8 Hops uint8 Ifindex int32 } type NdUseroptmsg struct { Family uint8 Pad1 uint8 Opts_len uint16 Ifindex int32 Icmp_type uint8 Icmp_code uint8 Pad2 uint16 Pad3 uint32 } type NdMsg struct { Family uint8 Pad1 uint8 Pad2 uint16 Ifindex int32 State uint16 Flags uint8 Type uint8 } const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 ) type SockFilter struct { Code uint16 Jt uint8 Jf uint8 K uint32 } type SockFprog struct { Len uint16 Filter *SockFilter } type InotifyEvent struct { Wd int32 Mask uint32 Cookie uint32 Len uint32 } const SizeofInotifyEvent = 0x10 type PtraceRegs struct { Regs [32]uint64 Lo uint64 Hi uint64 Epc uint64 Badvaddr uint64 Status uint64 Cause uint64 } type FdSet struct { Bits [32]int32 } type Sysinfo_t struct { Uptime int32 Loads [3]uint32 Totalram uint32 Freeram uint32 Sharedram uint32 Bufferram uint32 Totalswap uint32 Freeswap uint32 Procs uint16 Pad uint16 Totalhigh uint32 Freehigh uint32 Unit uint32 _ [8]int8 } type Utsname struct { Sysname [65]byte Nodename [65]byte Release [65]byte Version [65]byte Machine [65]byte Domainname [65]byte } type Ustat_t struct { Tfree int32 Tinode uint32 Fname [6]int8 Fpack [6]int8 } type EpollEvent struct { Events uint32 PadFd int32 Fd int32 Pad int32 } const ( AT_EMPTY_PATH = 0x1000 AT_FDCWD = -0x64 AT_NO_AUTOMOUNT = 0x800 AT_REMOVEDIR = 0x200 AT_STATX_SYNC_AS_STAT = 0x0 AT_STATX_FORCE_SYNC = 0x2000 AT_STATX_DONT_SYNC = 0x4000 AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 AT_EACCESS = 0x200 ) type PollFd struct { Fd int32 Events int16 Revents int16 } const ( POLLIN = 0x1 POLLPRI = 0x2 POLLOUT = 0x4 POLLRDHUP = 0x2000 POLLERR = 0x8 POLLHUP = 0x10 POLLNVAL = 0x20 ) type Sigset_t struct { Val [32]uint32 } const _C__NSIG = 0x80 type SignalfdSiginfo struct { Signo uint32 Errno int32 Code int32 Pid uint32 Uid uint32 Fd int32 Tid uint32 Band uint32 Overrun uint32 Trapno uint32 Status int32 Int int32 Ptr uint64 Utime uint64 Stime uint64 Addr uint64 Addr_lsb uint16 _ uint16 Syscall int32 Call_addr uint64 Arch uint32 _ [28]uint8 } const PERF_IOC_FLAG_GROUP = 0x1 type Termios struct { Iflag uint32 Oflag uint32 Cflag uint32 Lflag uint32 Line uint8 Cc [23]uint8 Ispeed uint32 Ospeed uint32 } type Winsize struct { Row uint16 Col uint16 Xpixel uint16 Ypixel uint16 } type Taskstats struct { Version uint16 Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 _ [4]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 Blkio_delay_total uint64 Swapin_count uint64 Swapin_delay_total uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]int8 Ac_sched uint8 Ac_pad [3]uint8 _ [4]byte Ac_uid uint32 Ac_gid uint32 Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 Ac_minflt uint64 Ac_majflt uint64 Coremem uint64 Virtmem uint64 Hiwater_rss uint64 Hiwater_vm uint64 Read_char uint64 Write_char uint64 Read_syscalls uint64 Write_syscalls uint64 Read_bytes uint64 Write_bytes uint64 Cancelled_write_bytes uint64 Nvcsw uint64 Nivcsw uint64 Ac_utimescaled uint64 Ac_stimescaled uint64 Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 Thrashing_count uint64 Thrashing_delay_total uint64 } const ( TASKSTATS_CMD_UNSPEC = 0x0 TASKSTATS_CMD_GET = 0x1 TASKSTATS_CMD_NEW = 0x2 TASKSTATS_TYPE_UNSPEC = 0x0 TASKSTATS_TYPE_PID = 0x1 TASKSTATS_TYPE_TGID = 0x2 TASKSTATS_TYPE_STATS = 0x3 TASKSTATS_TYPE_AGGR_PID = 0x4 TASKSTATS_TYPE_AGGR_TGID = 0x5 TASKSTATS_TYPE_NULL = 0x6 TASKSTATS_CMD_ATTR_UNSPEC = 0x0 TASKSTATS_CMD_ATTR_PID = 0x1 TASKSTATS_CMD_ATTR_TGID = 0x2 TASKSTATS_CMD_ATTR_REGISTER_CPUMASK = 0x3 TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 0x4 ) type CGroupStats struct { Sleeping uint64 Running uint64 Stopped uint64 Uninterruptible uint64 Io_wait uint64 } const ( CGROUPSTATS_CMD_UNSPEC = 0x3 CGROUPSTATS_CMD_GET = 0x4 CGROUPSTATS_CMD_NEW = 0x5 CGROUPSTATS_TYPE_UNSPEC = 0x0 CGROUPSTATS_TYPE_CGROUP_STATS = 0x1 CGROUPSTATS_CMD_ATTR_UNSPEC = 0x0 CGROUPSTATS_CMD_ATTR_FD = 0x1 ) type Genlmsghdr struct { Cmd uint8 Version uint8 Reserved uint16 } const ( CTRL_CMD_UNSPEC = 0x0 CTRL_CMD_NEWFAMILY = 0x1 CTRL_CMD_DELFAMILY = 0x2 CTRL_CMD_GETFAMILY = 0x3 CTRL_CMD_NEWOPS = 0x4 CTRL_CMD_DELOPS = 0x5 CTRL_CMD_GETOPS = 0x6 CTRL_CMD_NEWMCAST_GRP = 0x7 CTRL_CMD_DELMCAST_GRP = 0x8 CTRL_CMD_GETMCAST_GRP = 0x9 CTRL_ATTR_UNSPEC = 0x0 CTRL_ATTR_FAMILY_ID = 0x1 CTRL_ATTR_FAMILY_NAME = 0x2 CTRL_ATTR_VERSION = 0x3 CTRL_ATTR_HDRSIZE = 0x4 CTRL_ATTR_MAXATTR = 0x5 CTRL_ATTR_OPS = 0x6 CTRL_ATTR_MCAST_GROUPS = 0x7 CTRL_ATTR_OP_UNSPEC = 0x0 CTRL_ATTR_OP_ID = 0x1 CTRL_ATTR_OP_FLAGS = 0x2 CTRL_ATTR_MCAST_GRP_UNSPEC = 0x0 CTRL_ATTR_MCAST_GRP_NAME = 0x1 CTRL_ATTR_MCAST_GRP_ID = 0x2 ) type cpuMask uint32 const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x20 ) const ( BDADDR_BREDR = 0x0 BDADDR_LE_PUBLIC = 0x1 BDADDR_LE_RANDOM = 0x2 ) type PerfEventAttr struct { Type uint32 Size uint32 Config uint64 Sample uint64 Sample_type uint64 Read_format uint64 Bits uint64 Wakeup uint32 Bp_type uint32 Ext1 uint64 Ext2 uint64 Branch_sample_type uint64 Sample_regs_user uint64 Sample_stack_user uint32 Clockid int32 Sample_regs_intr uint64 Aux_watermark uint32 Sample_max_stack uint16 _ uint16 } type PerfEventMmapPage struct { Version uint32 Compat_version uint32 Lock uint32 Index uint32 Offset int64 Time_enabled uint64 Time_running uint64 Capabilities uint64 Pmc_width uint16 Time_shift uint16 Time_mult uint32 Time_offset uint64 Time_zero uint64 Size uint32 _ [948]uint8 Data_head uint64 Data_tail uint64 Data_offset uint64 Data_size uint64 Aux_head uint64 Aux_tail uint64 Aux_offset uint64 Aux_size uint64 } const ( PerfBitDisabled uint64 = CBitFieldMaskBit0 PerfBitInherit = CBitFieldMaskBit1 PerfBitPinned = CBitFieldMaskBit2 PerfBitExclusive = CBitFieldMaskBit3 PerfBitExcludeUser = CBitFieldMaskBit4 PerfBitExcludeKernel = CBitFieldMaskBit5 PerfBitExcludeHv = CBitFieldMaskBit6 PerfBitExcludeIdle = CBitFieldMaskBit7 PerfBitMmap = CBitFieldMaskBit8 PerfBitComm = CBitFieldMaskBit9 PerfBitFreq = CBitFieldMaskBit10 PerfBitInheritStat = CBitFieldMaskBit11 PerfBitEnableOnExec = CBitFieldMaskBit12 PerfBitTask = CBitFieldMaskBit13 PerfBitWatermark = CBitFieldMaskBit14 PerfBitPreciseIPBit1 = CBitFieldMaskBit15 PerfBitPreciseIPBit2 = CBitFieldMaskBit16 PerfBitMmapData = CBitFieldMaskBit17 PerfBitSampleIDAll = CBitFieldMaskBit18 PerfBitExcludeHost = CBitFieldMaskBit19 PerfBitExcludeGuest = CBitFieldMaskBit20 PerfBitExcludeCallchainKernel = CBitFieldMaskBit21 PerfBitExcludeCallchainUser = CBitFieldMaskBit22 PerfBitMmap2 = CBitFieldMaskBit23 PerfBitCommExec = CBitFieldMaskBit24 PerfBitUseClockID = CBitFieldMaskBit25 PerfBitContextSwitch = CBitFieldMaskBit26 ) const ( PERF_TYPE_HARDWARE = 0x0 PERF_TYPE_SOFTWARE = 0x1 PERF_TYPE_TRACEPOINT = 0x2 PERF_TYPE_HW_CACHE = 0x3 PERF_TYPE_RAW = 0x4 PERF_TYPE_BREAKPOINT = 0x5 PERF_COUNT_HW_CPU_CYCLES = 0x0 PERF_COUNT_HW_INSTRUCTIONS = 0x1 PERF_COUNT_HW_CACHE_REFERENCES = 0x2 PERF_COUNT_HW_CACHE_MISSES = 0x3 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 0x4 PERF_COUNT_HW_BRANCH_MISSES = 0x5 PERF_COUNT_HW_BUS_CYCLES = 0x6 PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 PERF_COUNT_HW_CACHE_L1D = 0x0 PERF_COUNT_HW_CACHE_L1I = 0x1 PERF_COUNT_HW_CACHE_LL = 0x2 PERF_COUNT_HW_CACHE_DTLB = 0x3 PERF_COUNT_HW_CACHE_ITLB = 0x4 PERF_COUNT_HW_CACHE_BPU = 0x5 PERF_COUNT_HW_CACHE_NODE = 0x6 PERF_COUNT_HW_CACHE_OP_READ = 0x0 PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 PERF_COUNT_SW_CPU_CLOCK = 0x0 PERF_COUNT_SW_TASK_CLOCK = 0x1 PERF_COUNT_SW_PAGE_FAULTS = 0x2 PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 PERF_COUNT_SW_EMULATION_FAULTS = 0x8 PERF_COUNT_SW_DUMMY = 0x9 PERF_COUNT_SW_BPF_OUTPUT = 0xa PERF_SAMPLE_IP = 0x1 PERF_SAMPLE_TID = 0x2 PERF_SAMPLE_TIME = 0x4 PERF_SAMPLE_ADDR = 0x8 PERF_SAMPLE_READ = 0x10 PERF_SAMPLE_CALLCHAIN = 0x20 PERF_SAMPLE_ID = 0x40 PERF_SAMPLE_CPU = 0x80 PERF_SAMPLE_PERIOD = 0x100 PERF_SAMPLE_STREAM_ID = 0x200 PERF_SAMPLE_RAW = 0x400 PERF_SAMPLE_BRANCH_STACK = 0x800 PERF_SAMPLE_BRANCH_USER = 0x1 PERF_SAMPLE_BRANCH_KERNEL = 0x2 PERF_SAMPLE_BRANCH_HV = 0x4 PERF_SAMPLE_BRANCH_ANY = 0x8 PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 PERF_SAMPLE_BRANCH_IND_CALL = 0x40 PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 PERF_SAMPLE_BRANCH_IN_TX = 0x100 PERF_SAMPLE_BRANCH_NO_TX = 0x200 PERF_SAMPLE_BRANCH_COND = 0x400 PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 PERF_SAMPLE_BRANCH_CALL = 0x2000 PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 PERF_FORMAT_ID = 0x4 PERF_FORMAT_GROUP = 0x8 PERF_RECORD_MMAP = 0x1 PERF_RECORD_LOST = 0x2 PERF_RECORD_COMM = 0x3 PERF_RECORD_EXIT = 0x4 PERF_RECORD_THROTTLE = 0x5 PERF_RECORD_UNTHROTTLE = 0x6 PERF_RECORD_FORK = 0x7 PERF_RECORD_READ = 0x8 PERF_RECORD_SAMPLE = 0x9 PERF_RECORD_MMAP2 = 0xa PERF_RECORD_AUX = 0xb PERF_RECORD_ITRACE_START = 0xc PERF_RECORD_LOST_SAMPLES = 0xd PERF_RECORD_SWITCH = 0xe PERF_RECORD_SWITCH_CPU_WIDE = 0xf PERF_RECORD_NAMESPACES = 0x10 PERF_CONTEXT_HV = -0x20 PERF_CONTEXT_KERNEL = -0x80 PERF_CONTEXT_USER = -0x200 PERF_CONTEXT_GUEST = -0x800 PERF_CONTEXT_GUEST_KERNEL = -0x880 PERF_CONTEXT_GUEST_USER = -0xa00 PERF_FLAG_FD_NO_GROUP = 0x1 PERF_FLAG_FD_OUTPUT = 0x2 PERF_FLAG_PID_CGROUP = 0x4 PERF_FLAG_FD_CLOEXEC = 0x8 ) const ( CBitFieldMaskBit0 = 0x1 CBitFieldMaskBit1 = 0x2 CBitFieldMaskBit2 = 0x4 CBitFieldMaskBit3 = 0x8 CBitFieldMaskBit4 = 0x10 CBitFieldMaskBit5 = 0x20 CBitFieldMaskBit6 = 0x40 CBitFieldMaskBit7 = 0x80 CBitFieldMaskBit8 = 0x100 CBitFieldMaskBit9 = 0x200 CBitFieldMaskBit10 = 0x400 CBitFieldMaskBit11 = 0x800 CBitFieldMaskBit12 = 0x1000 CBitFieldMaskBit13 = 0x2000 CBitFieldMaskBit14 = 0x4000 CBitFieldMaskBit15 = 0x8000 CBitFieldMaskBit16 = 0x10000 CBitFieldMaskBit17 = 0x20000 CBitFieldMaskBit18 = 0x40000 CBitFieldMaskBit19 = 0x80000 CBitFieldMaskBit20 = 0x100000 CBitFieldMaskBit21 = 0x200000 CBitFieldMaskBit22 = 0x400000 CBitFieldMaskBit23 = 0x800000 CBitFieldMaskBit24 = 0x1000000 CBitFieldMaskBit25 = 0x2000000 CBitFieldMaskBit26 = 0x4000000 CBitFieldMaskBit27 = 0x8000000 CBitFieldMaskBit28 = 0x10000000 CBitFieldMaskBit29 = 0x20000000 CBitFieldMaskBit30 = 0x40000000 CBitFieldMaskBit31 = 0x80000000 CBitFieldMaskBit32 = 0x100000000 CBitFieldMaskBit33 = 0x200000000 CBitFieldMaskBit34 = 0x400000000 CBitFieldMaskBit35 = 0x800000000 CBitFieldMaskBit36 = 0x1000000000 CBitFieldMaskBit37 = 0x2000000000 CBitFieldMaskBit38 = 0x4000000000 CBitFieldMaskBit39 = 0x8000000000 CBitFieldMaskBit40 = 0x10000000000 CBitFieldMaskBit41 = 0x20000000000 CBitFieldMaskBit42 = 0x40000000000 CBitFieldMaskBit43 = 0x80000000000 CBitFieldMaskBit44 = 0x100000000000 CBitFieldMaskBit45 = 0x200000000000 CBitFieldMaskBit46 = 0x400000000000 CBitFieldMaskBit47 = 0x800000000000 CBitFieldMaskBit48 = 0x1000000000000 CBitFieldMaskBit49 = 0x2000000000000 CBitFieldMaskBit50 = 0x4000000000000 CBitFieldMaskBit51 = 0x8000000000000 CBitFieldMaskBit52 = 0x10000000000000 CBitFieldMaskBit53 = 0x20000000000000 CBitFieldMaskBit54 = 0x40000000000000 CBitFieldMaskBit55 = 0x80000000000000 CBitFieldMaskBit56 = 0x100000000000000 CBitFieldMaskBit57 = 0x200000000000000 CBitFieldMaskBit58 = 0x400000000000000 CBitFieldMaskBit59 = 0x800000000000000 CBitFieldMaskBit60 = 0x1000000000000000 CBitFieldMaskBit61 = 0x2000000000000000 CBitFieldMaskBit62 = 0x4000000000000000 CBitFieldMaskBit63 = 0x8000000000000000 ) type SockaddrStorage struct { Family uint16 _ [122]int8 _ uint32 } type TCPMD5Sig struct { Addr SockaddrStorage Flags uint8 Prefixlen uint8 Keylen uint16 _ uint32 Key [80]uint8 } type HDDriveCmdHdr struct { Command uint8 Number uint8 Feature uint8 Count uint8 } type HDGeometry struct { Heads uint8 Sectors uint8 Cylinders uint16 Start uint32 } type HDDriveID struct { Config uint16 Cyls uint16 Reserved2 uint16 Heads uint16 Track_bytes uint16 Sector_bytes uint16 Sectors uint16 Vendor0 uint16 Vendor1 uint16 Vendor2 uint16 Serial_no [20]uint8 Buf_type uint16 Buf_size uint16 Ecc_bytes uint16 Fw_rev [8]uint8 Model [40]uint8 Max_multsect uint8 Vendor3 uint8 Dword_io uint16 Vendor4 uint8 Capability uint8 Reserved50 uint16 Vendor5 uint8 TPIO uint8 Vendor6 uint8 TDMA uint8 Field_valid uint16 Cur_cyls uint16 Cur_heads uint16 Cur_sectors uint16 Cur_capacity0 uint16 Cur_capacity1 uint16 Multsect uint8 Multsect_valid uint8 Lba_capacity uint32 Dma_1word uint16 Dma_mword uint16 Eide_pio_modes uint16 Eide_dma_min uint16 Eide_dma_time uint16 Eide_pio uint16 Eide_pio_iordy uint16 Words69_70 [2]uint16 Words71_74 [4]uint16 Queue_depth uint16 Words76_79 [4]uint16 Major_rev_num uint16 Minor_rev_num uint16 Command_set_1 uint16 Command_set_2 uint16 Cfsse uint16 Cfs_enable_1 uint16 Cfs_enable_2 uint16 Csf_default uint16 Dma_ultra uint16 Trseuc uint16 TrsEuc uint16 CurAPMvalues uint16 Mprc uint16 Hw_config uint16 Acoustic uint16 Msrqs uint16 Sxfert uint16 Sal uint16 Spg uint32 Lba_capacity_2 uint64 Words104_125 [22]uint16 Last_lun uint16 Word127 uint16 Dlf uint16 Csfo uint16 Words130_155 [26]uint16 Word156 uint16 Words157_159 [3]uint16 Cfa_power uint16 Words161_175 [15]uint16 Words176_205 [30]uint16 Words206_254 [49]uint16 Integrity_word uint16 } type Statfs_t struct { Type int32 Bsize int32 Frsize int32 _ [4]byte Blocks uint64 Bfree uint64 Files uint64 Ffree uint64 Bavail uint64 Fsid Fsid Namelen int32 Flags int32 Spare [5]int32 _ [4]byte } const ( ST_MANDLOCK = 0x40 ST_NOATIME = 0x400 ST_NODEV = 0x4 ST_NODIRATIME = 0x800 ST_NOEXEC = 0x8 ST_NOSUID = 0x2 ST_RDONLY = 0x1 ST_RELATIME = 0x1000 ST_SYNCHRONOUS = 0x10 ) type TpacketHdr struct { Status uint32 Len uint32 Snaplen uint32 Mac uint16 Net uint16 Sec uint32 Usec uint32 } type Tpacket2Hdr struct { Status uint32 Len uint32 Snaplen uint32 Mac uint16 Net uint16 Sec uint32 Nsec uint32 Vlan_tci uint16 Vlan_tpid uint16 _ [4]uint8 } type Tpacket3Hdr struct { Next_offset uint32 Sec uint32 Nsec uint32 Snaplen uint32 Len uint32 Status uint32 Mac uint16 Net uint16 Hv1 TpacketHdrVariant1 _ [8]uint8 } type TpacketHdrVariant1 struct { Rxhash uint32 Vlan_tci uint32 Vlan_tpid uint16 _ uint16 } type TpacketBlockDesc struct { Version uint32 To_priv uint32 Hdr [40]byte } type TpacketBDTS struct { Sec uint32 Usec uint32 } type TpacketHdrV1 struct { Block_status uint32 Num_pkts uint32 Offset_to_first_pkt uint32 Blk_len uint32 Seq_num uint64 Ts_first_pkt TpacketBDTS Ts_last_pkt TpacketBDTS } type TpacketReq struct { Block_size uint32 Block_nr uint32 Frame_size uint32 Frame_nr uint32 } type TpacketReq3 struct { Block_size uint32 Block_nr uint32 Frame_size uint32 Frame_nr uint32 Retire_blk_tov uint32 Sizeof_priv uint32 Feature_req_word uint32 } type TpacketStats struct { Packets uint32 Drops uint32 } type TpacketStatsV3 struct { Packets uint32 Drops uint32 Freeze_q_cnt uint32 } type TpacketAuxdata struct { Status uint32 Len uint32 Snaplen uint32 Mac uint16 Net uint16 Vlan_tci uint16 Vlan_tpid uint16 } const ( TPACKET_V1 = 0x0 TPACKET_V2 = 0x1 TPACKET_V3 = 0x2 ) const ( SizeofTpacketHdr = 0x18 SizeofTpacket2Hdr = 0x20 SizeofTpacket3Hdr = 0x30 SizeofTpacketStats = 0x8 SizeofTpacketStatsV3 = 0xc ) const ( NF_INET_PRE_ROUTING = 0x0 NF_INET_LOCAL_IN = 0x1 NF_INET_FORWARD = 0x2 NF_INET_LOCAL_OUT = 0x3 NF_INET_POST_ROUTING = 0x4 NF_INET_NUMHOOKS = 0x5 ) const ( NF_NETDEV_INGRESS = 0x0 NF_NETDEV_NUMHOOKS = 0x1 ) const ( NFPROTO_UNSPEC = 0x0 NFPROTO_INET = 0x1 NFPROTO_IPV4 = 0x2 NFPROTO_ARP = 0x3 NFPROTO_NETDEV = 0x5 NFPROTO_BRIDGE = 0x7 NFPROTO_IPV6 = 0xa NFPROTO_DECNET = 0xc NFPROTO_NUMPROTO = 0xd ) type Nfgenmsg struct { Nfgen_family uint8 Version uint8 Res_id uint16 } const ( NFNL_BATCH_UNSPEC = 0x0 NFNL_BATCH_GENID = 0x1 ) const ( NFT_REG_VERDICT = 0x0 NFT_REG_1 = 0x1 NFT_REG_2 = 0x2 NFT_REG_3 = 0x3 NFT_REG_4 = 0x4 NFT_REG32_00 = 0x8 NFT_REG32_01 = 0x9 NFT_REG32_02 = 0xa NFT_REG32_03 = 0xb NFT_REG32_04 = 0xc NFT_REG32_05 = 0xd NFT_REG32_06 = 0xe NFT_REG32_07 = 0xf NFT_REG32_08 = 0x10 NFT_REG32_09 = 0x11 NFT_REG32_10 = 0x12 NFT_REG32_11 = 0x13 NFT_REG32_12 = 0x14 NFT_REG32_13 = 0x15 NFT_REG32_14 = 0x16 NFT_REG32_15 = 0x17 NFT_CONTINUE = -0x1 NFT_BREAK = -0x2 NFT_JUMP = -0x3 NFT_GOTO = -0x4 NFT_RETURN = -0x5 NFT_MSG_NEWTABLE = 0x0 NFT_MSG_GETTABLE = 0x1 NFT_MSG_DELTABLE = 0x2 NFT_MSG_NEWCHAIN = 0x3 NFT_MSG_GETCHAIN = 0x4 NFT_MSG_DELCHAIN = 0x5 NFT_MSG_NEWRULE = 0x6 NFT_MSG_GETRULE = 0x7 NFT_MSG_DELRULE = 0x8 NFT_MSG_NEWSET = 0x9 NFT_MSG_GETSET = 0xa NFT_MSG_DELSET = 0xb NFT_MSG_NEWSETELEM = 0xc NFT_MSG_GETSETELEM = 0xd NFT_MSG_DELSETELEM = 0xe NFT_MSG_NEWGEN = 0xf NFT_MSG_GETGEN = 0x10 NFT_MSG_TRACE = 0x11 NFT_MSG_NEWOBJ = 0x12 NFT_MSG_GETOBJ = 0x13 NFT_MSG_DELOBJ = 0x14 NFT_MSG_GETOBJ_RESET = 0x15 NFT_MSG_MAX = 0x19 NFTA_LIST_UNPEC = 0x0 NFTA_LIST_ELEM = 0x1 NFTA_HOOK_UNSPEC = 0x0 NFTA_HOOK_HOOKNUM = 0x1 NFTA_HOOK_PRIORITY = 0x2 NFTA_HOOK_DEV = 0x3 NFT_TABLE_F_DORMANT = 0x1 NFTA_TABLE_UNSPEC = 0x0 NFTA_TABLE_NAME = 0x1 NFTA_TABLE_FLAGS = 0x2 NFTA_TABLE_USE = 0x3 NFTA_CHAIN_UNSPEC = 0x0 NFTA_CHAIN_TABLE = 0x1 NFTA_CHAIN_HANDLE = 0x2 NFTA_CHAIN_NAME = 0x3 NFTA_CHAIN_HOOK = 0x4 NFTA_CHAIN_POLICY = 0x5 NFTA_CHAIN_USE = 0x6 NFTA_CHAIN_TYPE = 0x7 NFTA_CHAIN_COUNTERS = 0x8 NFTA_CHAIN_PAD = 0x9 NFTA_RULE_UNSPEC = 0x0 NFTA_RULE_TABLE = 0x1 NFTA_RULE_CHAIN = 0x2 NFTA_RULE_HANDLE = 0x3 NFTA_RULE_EXPRESSIONS = 0x4 NFTA_RULE_COMPAT = 0x5 NFTA_RULE_POSITION = 0x6 NFTA_RULE_USERDATA = 0x7 NFTA_RULE_PAD = 0x8 NFTA_RULE_ID = 0x9 NFT_RULE_COMPAT_F_INV = 0x2 NFT_RULE_COMPAT_F_MASK = 0x2 NFTA_RULE_COMPAT_UNSPEC = 0x0 NFTA_RULE_COMPAT_PROTO = 0x1 NFTA_RULE_COMPAT_FLAGS = 0x2 NFT_SET_ANONYMOUS = 0x1 NFT_SET_CONSTANT = 0x2 NFT_SET_INTERVAL = 0x4 NFT_SET_MAP = 0x8 NFT_SET_TIMEOUT = 0x10 NFT_SET_EVAL = 0x20 NFT_SET_OBJECT = 0x40 NFT_SET_POL_PERFORMANCE = 0x0 NFT_SET_POL_MEMORY = 0x1 NFTA_SET_DESC_UNSPEC = 0x0 NFTA_SET_DESC_SIZE = 0x1 NFTA_SET_UNSPEC = 0x0 NFTA_SET_TABLE = 0x1 NFTA_SET_NAME = 0x2 NFTA_SET_FLAGS = 0x3 NFTA_SET_KEY_TYPE = 0x4 NFTA_SET_KEY_LEN = 0x5 NFTA_SET_DATA_TYPE = 0x6 NFTA_SET_DATA_LEN = 0x7 NFTA_SET_POLICY = 0x8 NFTA_SET_DESC = 0x9 NFTA_SET_ID = 0xa NFTA_SET_TIMEOUT = 0xb NFTA_SET_GC_INTERVAL = 0xc NFTA_SET_USERDATA = 0xd NFTA_SET_PAD = 0xe NFTA_SET_OBJ_TYPE = 0xf NFT_SET_ELEM_INTERVAL_END = 0x1 NFTA_SET_ELEM_UNSPEC = 0x0 NFTA_SET_ELEM_KEY = 0x1 NFTA_SET_ELEM_DATA = 0x2 NFTA_SET_ELEM_FLAGS = 0x3 NFTA_SET_ELEM_TIMEOUT = 0x4 NFTA_SET_ELEM_EXPIRATION = 0x5 NFTA_SET_ELEM_USERDATA = 0x6 NFTA_SET_ELEM_EXPR = 0x7 NFTA_SET_ELEM_PAD = 0x8 NFTA_SET_ELEM_OBJREF = 0x9 NFTA_SET_ELEM_LIST_UNSPEC = 0x0 NFTA_SET_ELEM_LIST_TABLE = 0x1 NFTA_SET_ELEM_LIST_SET = 0x2 NFTA_SET_ELEM_LIST_ELEMENTS = 0x3 NFTA_SET_ELEM_LIST_SET_ID = 0x4 NFT_DATA_VALUE = 0x0 NFT_DATA_VERDICT = 0xffffff00 NFTA_DATA_UNSPEC = 0x0 NFTA_DATA_VALUE = 0x1 NFTA_DATA_VERDICT = 0x2 NFTA_VERDICT_UNSPEC = 0x0 NFTA_VERDICT_CODE = 0x1 NFTA_VERDICT_CHAIN = 0x2 NFTA_EXPR_UNSPEC = 0x0 NFTA_EXPR_NAME = 0x1 NFTA_EXPR_DATA = 0x2 NFTA_IMMEDIATE_UNSPEC = 0x0 NFTA_IMMEDIATE_DREG = 0x1 NFTA_IMMEDIATE_DATA = 0x2 NFTA_BITWISE_UNSPEC = 0x0 NFTA_BITWISE_SREG = 0x1 NFTA_BITWISE_DREG = 0x2 NFTA_BITWISE_LEN = 0x3 NFTA_BITWISE_MASK = 0x4 NFTA_BITWISE_XOR = 0x5 NFT_BYTEORDER_NTOH = 0x0 NFT_BYTEORDER_HTON = 0x1 NFTA_BYTEORDER_UNSPEC = 0x0 NFTA_BYTEORDER_SREG = 0x1 NFTA_BYTEORDER_DREG = 0x2 NFTA_BYTEORDER_OP = 0x3 NFTA_BYTEORDER_LEN = 0x4 NFTA_BYTEORDER_SIZE = 0x5 NFT_CMP_EQ = 0x0 NFT_CMP_NEQ = 0x1 NFT_CMP_LT = 0x2 NFT_CMP_LTE = 0x3 NFT_CMP_GT = 0x4 NFT_CMP_GTE = 0x5 NFTA_CMP_UNSPEC = 0x0 NFTA_CMP_SREG = 0x1 NFTA_CMP_OP = 0x2 NFTA_CMP_DATA = 0x3 NFT_RANGE_EQ = 0x0 NFT_RANGE_NEQ = 0x1 NFTA_RANGE_UNSPEC = 0x0 NFTA_RANGE_SREG = 0x1 NFTA_RANGE_OP = 0x2 NFTA_RANGE_FROM_DATA = 0x3 NFTA_RANGE_TO_DATA = 0x4 NFT_LOOKUP_F_INV = 0x1 NFTA_LOOKUP_UNSPEC = 0x0 NFTA_LOOKUP_SET = 0x1 NFTA_LOOKUP_SREG = 0x2 NFTA_LOOKUP_DREG = 0x3 NFTA_LOOKUP_SET_ID = 0x4 NFTA_LOOKUP_FLAGS = 0x5 NFT_DYNSET_OP_ADD = 0x0 NFT_DYNSET_OP_UPDATE = 0x1 NFT_DYNSET_F_INV = 0x1 NFTA_DYNSET_UNSPEC = 0x0 NFTA_DYNSET_SET_NAME = 0x1 NFTA_DYNSET_SET_ID = 0x2 NFTA_DYNSET_OP = 0x3 NFTA_DYNSET_SREG_KEY = 0x4 NFTA_DYNSET_SREG_DATA = 0x5 NFTA_DYNSET_TIMEOUT = 0x6 NFTA_DYNSET_EXPR = 0x7 NFTA_DYNSET_PAD = 0x8 NFTA_DYNSET_FLAGS = 0x9 NFT_PAYLOAD_LL_HEADER = 0x0 NFT_PAYLOAD_NETWORK_HEADER = 0x1 NFT_PAYLOAD_TRANSPORT_HEADER = 0x2 NFT_PAYLOAD_CSUM_NONE = 0x0 NFT_PAYLOAD_CSUM_INET = 0x1 NFT_PAYLOAD_L4CSUM_PSEUDOHDR = 0x1 NFTA_PAYLOAD_UNSPEC = 0x0 NFTA_PAYLOAD_DREG = 0x1 NFTA_PAYLOAD_BASE = 0x2 NFTA_PAYLOAD_OFFSET = 0x3 NFTA_PAYLOAD_LEN = 0x4 NFTA_PAYLOAD_SREG = 0x5 NFTA_PAYLOAD_CSUM_TYPE = 0x6 NFTA_PAYLOAD_CSUM_OFFSET = 0x7 NFTA_PAYLOAD_CSUM_FLAGS = 0x8 NFT_EXTHDR_F_PRESENT = 0x1 NFT_EXTHDR_OP_IPV6 = 0x0 NFT_EXTHDR_OP_TCPOPT = 0x1 NFTA_EXTHDR_UNSPEC = 0x0 NFTA_EXTHDR_DREG = 0x1 NFTA_EXTHDR_TYPE = 0x2 NFTA_EXTHDR_OFFSET = 0x3 NFTA_EXTHDR_LEN = 0x4 NFTA_EXTHDR_FLAGS = 0x5 NFTA_EXTHDR_OP = 0x6 NFTA_EXTHDR_SREG = 0x7 NFT_META_LEN = 0x0 NFT_META_PROTOCOL = 0x1 NFT_META_PRIORITY = 0x2 NFT_META_MARK = 0x3 NFT_META_IIF = 0x4 NFT_META_OIF = 0x5 NFT_META_IIFNAME = 0x6 NFT_META_OIFNAME = 0x7 NFT_META_IIFTYPE = 0x8 NFT_META_OIFTYPE = 0x9 NFT_META_SKUID = 0xa NFT_META_SKGID = 0xb NFT_META_NFTRACE = 0xc NFT_META_RTCLASSID = 0xd NFT_META_SECMARK = 0xe NFT_META_NFPROTO = 0xf NFT_META_L4PROTO = 0x10 NFT_META_BRI_IIFNAME = 0x11 NFT_META_BRI_OIFNAME = 0x12 NFT_META_PKTTYPE = 0x13 NFT_META_CPU = 0x14 NFT_META_IIFGROUP = 0x15 NFT_META_OIFGROUP = 0x16 NFT_META_CGROUP = 0x17 NFT_META_PRANDOM = 0x18 NFT_RT_CLASSID = 0x0 NFT_RT_NEXTHOP4 = 0x1 NFT_RT_NEXTHOP6 = 0x2 NFT_RT_TCPMSS = 0x3 NFT_HASH_JENKINS = 0x0 NFT_HASH_SYM = 0x1 NFTA_HASH_UNSPEC = 0x0 NFTA_HASH_SREG = 0x1 NFTA_HASH_DREG = 0x2 NFTA_HASH_LEN = 0x3 NFTA_HASH_MODULUS = 0x4 NFTA_HASH_SEED = 0x5 NFTA_HASH_OFFSET = 0x6 NFTA_HASH_TYPE = 0x7 NFTA_META_UNSPEC = 0x0 NFTA_META_DREG = 0x1 NFTA_META_KEY = 0x2 NFTA_META_SREG = 0x3 NFTA_RT_UNSPEC = 0x0 NFTA_RT_DREG = 0x1 NFTA_RT_KEY = 0x2 NFT_CT_STATE = 0x0 NFT_CT_DIRECTION = 0x1 NFT_CT_STATUS = 0x2 NFT_CT_MARK = 0x3 NFT_CT_SECMARK = 0x4 NFT_CT_EXPIRATION = 0x5 NFT_CT_HELPER = 0x6 NFT_CT_L3PROTOCOL = 0x7 NFT_CT_SRC = 0x8 NFT_CT_DST = 0x9 NFT_CT_PROTOCOL = 0xa NFT_CT_PROTO_SRC = 0xb NFT_CT_PROTO_DST = 0xc NFT_CT_LABELS = 0xd NFT_CT_PKTS = 0xe NFT_CT_BYTES = 0xf NFT_CT_AVGPKT = 0x10 NFT_CT_ZONE = 0x11 NFT_CT_EVENTMASK = 0x12 NFTA_CT_UNSPEC = 0x0 NFTA_CT_DREG = 0x1 NFTA_CT_KEY = 0x2 NFTA_CT_DIRECTION = 0x3 NFTA_CT_SREG = 0x4 NFT_LIMIT_PKTS = 0x0 NFT_LIMIT_PKT_BYTES = 0x1 NFT_LIMIT_F_INV = 0x1 NFTA_LIMIT_UNSPEC = 0x0 NFTA_LIMIT_RATE = 0x1 NFTA_LIMIT_UNIT = 0x2 NFTA_LIMIT_BURST = 0x3 NFTA_LIMIT_TYPE = 0x4 NFTA_LIMIT_FLAGS = 0x5 NFTA_LIMIT_PAD = 0x6 NFTA_COUNTER_UNSPEC = 0x0 NFTA_COUNTER_BYTES = 0x1 NFTA_COUNTER_PACKETS = 0x2 NFTA_COUNTER_PAD = 0x3 NFTA_LOG_UNSPEC = 0x0 NFTA_LOG_GROUP = 0x1 NFTA_LOG_PREFIX = 0x2 NFTA_LOG_SNAPLEN = 0x3 NFTA_LOG_QTHRESHOLD = 0x4 NFTA_LOG_LEVEL = 0x5 NFTA_LOG_FLAGS = 0x6 NFTA_QUEUE_UNSPEC = 0x0 NFTA_QUEUE_NUM = 0x1 NFTA_QUEUE_TOTAL = 0x2 NFTA_QUEUE_FLAGS = 0x3 NFTA_QUEUE_SREG_QNUM = 0x4 NFT_QUOTA_F_INV = 0x1 NFT_QUOTA_F_DEPLETED = 0x2 NFTA_QUOTA_UNSPEC = 0x0 NFTA_QUOTA_BYTES = 0x1 NFTA_QUOTA_FLAGS = 0x2 NFTA_QUOTA_PAD = 0x3 NFTA_QUOTA_CONSUMED = 0x4 NFT_REJECT_ICMP_UNREACH = 0x0 NFT_REJECT_TCP_RST = 0x1 NFT_REJECT_ICMPX_UNREACH = 0x2 NFT_REJECT_ICMPX_NO_ROUTE = 0x0 NFT_REJECT_ICMPX_PORT_UNREACH = 0x1 NFT_REJECT_ICMPX_HOST_UNREACH = 0x2 NFT_REJECT_ICMPX_ADMIN_PROHIBITED = 0x3 NFTA_REJECT_UNSPEC = 0x0 NFTA_REJECT_TYPE = 0x1 NFTA_REJECT_ICMP_CODE = 0x2 NFT_NAT_SNAT = 0x0 NFT_NAT_DNAT = 0x1 NFTA_NAT_UNSPEC = 0x0 NFTA_NAT_TYPE = 0x1 NFTA_NAT_FAMILY = 0x2 NFTA_NAT_REG_ADDR_MIN = 0x3 NFTA_NAT_REG_ADDR_MAX = 0x4 NFTA_NAT_REG_PROTO_MIN = 0x5 NFTA_NAT_REG_PROTO_MAX = 0x6 NFTA_NAT_FLAGS = 0x7 NFTA_MASQ_UNSPEC = 0x0 NFTA_MASQ_FLAGS = 0x1 NFTA_MASQ_REG_PROTO_MIN = 0x2 NFTA_MASQ_REG_PROTO_MAX = 0x3 NFTA_REDIR_UNSPEC = 0x0 NFTA_REDIR_REG_PROTO_MIN = 0x1 NFTA_REDIR_REG_PROTO_MAX = 0x2 NFTA_REDIR_FLAGS = 0x3 NFTA_DUP_UNSPEC = 0x0 NFTA_DUP_SREG_ADDR = 0x1 NFTA_DUP_SREG_DEV = 0x2 NFTA_FWD_UNSPEC = 0x0 NFTA_FWD_SREG_DEV = 0x1 NFTA_OBJREF_UNSPEC = 0x0 NFTA_OBJREF_IMM_TYPE = 0x1 NFTA_OBJREF_IMM_NAME = 0x2 NFTA_OBJREF_SET_SREG = 0x3 NFTA_OBJREF_SET_NAME = 0x4 NFTA_OBJREF_SET_ID = 0x5 NFTA_GEN_UNSPEC = 0x0 NFTA_GEN_ID = 0x1 NFTA_GEN_PROC_PID = 0x2 NFTA_GEN_PROC_NAME = 0x3 NFTA_FIB_UNSPEC = 0x0 NFTA_FIB_DREG = 0x1 NFTA_FIB_RESULT = 0x2 NFTA_FIB_FLAGS = 0x3 NFT_FIB_RESULT_UNSPEC = 0x0 NFT_FIB_RESULT_OIF = 0x1 NFT_FIB_RESULT_OIFNAME = 0x2 NFT_FIB_RESULT_ADDRTYPE = 0x3 NFTA_FIB_F_SADDR = 0x1 NFTA_FIB_F_DADDR = 0x2 NFTA_FIB_F_MARK = 0x4 NFTA_FIB_F_IIF = 0x8 NFTA_FIB_F_OIF = 0x10 NFTA_FIB_F_PRESENT = 0x20 NFTA_CT_HELPER_UNSPEC = 0x0 NFTA_CT_HELPER_NAME = 0x1 NFTA_CT_HELPER_L3PROTO = 0x2 NFTA_CT_HELPER_L4PROTO = 0x3 NFTA_OBJ_UNSPEC = 0x0 NFTA_OBJ_TABLE = 0x1 NFTA_OBJ_NAME = 0x2 NFTA_OBJ_TYPE = 0x3 NFTA_OBJ_DATA = 0x4 NFTA_OBJ_USE = 0x5 NFTA_TRACE_UNSPEC = 0x0 NFTA_TRACE_TABLE = 0x1 NFTA_TRACE_CHAIN = 0x2 NFTA_TRACE_RULE_HANDLE = 0x3 NFTA_TRACE_TYPE = 0x4 NFTA_TRACE_VERDICT = 0x5 NFTA_TRACE_ID = 0x6 NFTA_TRACE_LL_HEADER = 0x7 NFTA_TRACE_NETWORK_HEADER = 0x8 NFTA_TRACE_TRANSPORT_HEADER = 0x9 NFTA_TRACE_IIF = 0xa NFTA_TRACE_IIFTYPE = 0xb NFTA_TRACE_OIF = 0xc NFTA_TRACE_OIFTYPE = 0xd NFTA_TRACE_MARK = 0xe NFTA_TRACE_NFPROTO = 0xf NFTA_TRACE_POLICY = 0x10 NFTA_TRACE_PAD = 0x11 NFT_TRACETYPE_UNSPEC = 0x0 NFT_TRACETYPE_POLICY = 0x1 NFT_TRACETYPE_RETURN = 0x2 NFT_TRACETYPE_RULE = 0x3 NFTA_NG_UNSPEC = 0x0 NFTA_NG_DREG = 0x1 NFTA_NG_MODULUS = 0x2 NFTA_NG_TYPE = 0x3 NFTA_NG_OFFSET = 0x4 NFT_NG_INCREMENTAL = 0x0 NFT_NG_RANDOM = 0x1 ) type RTCTime struct { Sec int32 Min int32 Hour int32 Mday int32 Mon int32 Year int32 Wday int32 Yday int32 Isdst int32 } type RTCWkAlrm struct { Enabled uint8 Pending uint8 Time RTCTime } type RTCPLLInfo struct { Ctrl int32 Value int32 Max int32 Min int32 Posmult int32 Negmult int32 Clock int32 } type BlkpgIoctlArg struct { Op int32 Flags int32 Datalen int32 Data *byte } type BlkpgPartition struct { Start int64 Length int64 Pno int32 Devname [64]uint8 Volname [64]uint8 _ [4]byte } const ( BLKPG = 0x20001269 BLKPG_ADD_PARTITION = 0x1 BLKPG_DEL_PARTITION = 0x2 BLKPG_RESIZE_PARTITION = 0x3 ) const ( NETNSA_NONE = 0x0 NETNSA_NSID = 0x1 NETNSA_PID = 0x2 NETNSA_FD = 0x3 ) type XDPRingOffset struct { Producer uint64 Consumer uint64 Desc uint64 Flags uint64 } type XDPMmapOffsets struct { Rx XDPRingOffset Tx XDPRingOffset Fr XDPRingOffset Cr XDPRingOffset } type XDPUmemReg struct { Addr uint64 Len uint64 Size uint32 Headroom uint32 Flags uint32 _ [4]byte } type XDPStatistics struct { Rx_dropped uint64 Rx_invalid_descs uint64 Tx_invalid_descs uint64 } type XDPDesc struct { Addr uint64 Len uint32 Options uint32 } const ( NCSI_CMD_UNSPEC = 0x0 NCSI_CMD_PKG_INFO = 0x1 NCSI_CMD_SET_INTERFACE = 0x2 NCSI_CMD_CLEAR_INTERFACE = 0x3 NCSI_ATTR_UNSPEC = 0x0 NCSI_ATTR_IFINDEX = 0x1 NCSI_ATTR_PACKAGE_LIST = 0x2 NCSI_ATTR_PACKAGE_ID = 0x3 NCSI_ATTR_CHANNEL_ID = 0x4 NCSI_PKG_ATTR_UNSPEC = 0x0 NCSI_PKG_ATTR = 0x1 NCSI_PKG_ATTR_ID = 0x2 NCSI_PKG_ATTR_FORCED = 0x3 NCSI_PKG_ATTR_CHANNEL_LIST = 0x4 NCSI_CHANNEL_ATTR_UNSPEC = 0x0 NCSI_CHANNEL_ATTR = 0x1 NCSI_CHANNEL_ATTR_ID = 0x2 NCSI_CHANNEL_ATTR_VERSION_MAJOR = 0x3 NCSI_CHANNEL_ATTR_VERSION_MINOR = 0x4 NCSI_CHANNEL_ATTR_VERSION_STR = 0x5 NCSI_CHANNEL_ATTR_LINK_STATE = 0x6 NCSI_CHANNEL_ATTR_ACTIVE = 0x7 NCSI_CHANNEL_ATTR_FORCED = 0x8 NCSI_CHANNEL_ATTR_VLAN_LIST = 0x9 NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) type ScmTimestamping struct { Ts [3]Timespec } const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 SOF_TIMESTAMPING_RX_HARDWARE = 0x4 SOF_TIMESTAMPING_RX_SOFTWARE = 0x8 SOF_TIMESTAMPING_SOFTWARE = 0x10 SOF_TIMESTAMPING_SYS_HARDWARE = 0x20 SOF_TIMESTAMPING_RAW_HARDWARE = 0x40 SOF_TIMESTAMPING_OPT_ID = 0x80 SOF_TIMESTAMPING_TX_SCHED = 0x100 SOF_TIMESTAMPING_TX_ACK = 0x200 SOF_TIMESTAMPING_OPT_CMSG = 0x400 SOF_TIMESTAMPING_OPT_TSONLY = 0x800 SOF_TIMESTAMPING_OPT_STATS = 0x1000 SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff SCM_TSTAMP_SND = 0x0 SCM_TSTAMP_SCHED = 0x1 SCM_TSTAMP_ACK = 0x2 ) type SockExtendedErr struct { Errno uint32 Origin uint8 Type uint8 Code uint8 Pad uint8 Info uint32 Data uint32 } type FanotifyEventMetadata struct { Event_len uint32 Vers uint8 Reserved uint8 Metadata_len uint16 Mask uint64 Fd int32 Pid int32 } type FanotifyResponse struct { Fd int32 Response uint32 } const ( CRYPTO_MSG_BASE = 0x10 CRYPTO_MSG_NEWALG = 0x10 CRYPTO_MSG_DELALG = 0x11 CRYPTO_MSG_UPDATEALG = 0x12 CRYPTO_MSG_GETALG = 0x13 CRYPTO_MSG_DELRNG = 0x14 CRYPTO_MSG_GETSTAT = 0x15 ) const ( CRYPTOCFGA_UNSPEC = 0x0 CRYPTOCFGA_PRIORITY_VAL = 0x1 CRYPTOCFGA_REPORT_LARVAL = 0x2 CRYPTOCFGA_REPORT_HASH = 0x3 CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 CRYPTOCFGA_REPORT_AEAD = 0x5 CRYPTOCFGA_REPORT_COMPRESS = 0x6 CRYPTOCFGA_REPORT_RNG = 0x7 CRYPTOCFGA_REPORT_CIPHER = 0x8 CRYPTOCFGA_REPORT_AKCIPHER = 0x9 CRYPTOCFGA_REPORT_KPP = 0xa CRYPTOCFGA_REPORT_ACOMP = 0xb CRYPTOCFGA_STAT_LARVAL = 0xc CRYPTOCFGA_STAT_HASH = 0xd CRYPTOCFGA_STAT_BLKCIPHER = 0xe CRYPTOCFGA_STAT_AEAD = 0xf CRYPTOCFGA_STAT_COMPRESS = 0x10 CRYPTOCFGA_STAT_RNG = 0x11 CRYPTOCFGA_STAT_CIPHER = 0x12 CRYPTOCFGA_STAT_AKCIPHER = 0x13 CRYPTOCFGA_STAT_KPP = 0x14 CRYPTOCFGA_STAT_ACOMP = 0x15 ) type CryptoUserAlg struct { Name [64]int8 Driver_name [64]int8 Module_name [64]int8 Type uint32 Mask uint32 Refcnt uint32 Flags uint32 } type CryptoStatAEAD struct { Type [64]int8 Encrypt_cnt uint64 Encrypt_tlen uint64 Decrypt_cnt uint64 Decrypt_tlen uint64 Err_cnt uint64 } type CryptoStatAKCipher struct { Type [64]int8 Encrypt_cnt uint64 Encrypt_tlen uint64 Decrypt_cnt uint64 Decrypt_tlen uint64 Verify_cnt uint64 Sign_cnt uint64 Err_cnt uint64 } type CryptoStatCipher struct { Type [64]int8 Encrypt_cnt uint64 Encrypt_tlen uint64 Decrypt_cnt uint64 Decrypt_tlen uint64 Err_cnt uint64 } type CryptoStatCompress struct { Type [64]int8 Compress_cnt uint64 Compress_tlen uint64 Decompress_cnt uint64 Decompress_tlen uint64 Err_cnt uint64 } type CryptoStatHash struct { Type [64]int8 Hash_cnt uint64 Hash_tlen uint64 Err_cnt uint64 } type CryptoStatKPP struct { Type [64]int8 Setsecret_cnt uint64 Generate_public_key_cnt uint64 Compute_shared_secret_cnt uint64 Err_cnt uint64 } type CryptoStatRNG struct { Type [64]int8 Generate_cnt uint64 Generate_tlen uint64 Seed_cnt uint64 Err_cnt uint64 } type CryptoStatLarval struct { Type [64]int8 } type CryptoReportLarval struct { Type [64]int8 } type CryptoReportHash struct { Type [64]int8 Blocksize uint32 Digestsize uint32 } type CryptoReportCipher struct { Type [64]int8 Blocksize uint32 Min_keysize uint32 Max_keysize uint32 } type CryptoReportBlkCipher struct { Type [64]int8 Geniv [64]int8 Blocksize uint32 Min_keysize uint32 Max_keysize uint32 Ivsize uint32 } type CryptoReportAEAD struct { Type [64]int8 Geniv [64]int8 Blocksize uint32 Maxauthsize uint32 Ivsize uint32 } type CryptoReportComp struct { Type [64]int8 } type CryptoReportRNG struct { Type [64]int8 Seedsize uint32 } type CryptoReportAKCipher struct { Type [64]int8 } type CryptoReportKPP struct { Type [64]int8 } type CryptoReportAcomp struct { Type [64]int8 } const ( BPF_REG_0 = 0x0 BPF_REG_1 = 0x1 BPF_REG_2 = 0x2 BPF_REG_3 = 0x3 BPF_REG_4 = 0x4 BPF_REG_5 = 0x5 BPF_REG_6 = 0x6 BPF_REG_7 = 0x7 BPF_REG_8 = 0x8 BPF_REG_9 = 0x9 BPF_REG_10 = 0xa BPF_MAP_CREATE = 0x0 BPF_MAP_LOOKUP_ELEM = 0x1 BPF_MAP_UPDATE_ELEM = 0x2 BPF_MAP_DELETE_ELEM = 0x3 BPF_MAP_GET_NEXT_KEY = 0x4 BPF_PROG_LOAD = 0x5 BPF_OBJ_PIN = 0x6 BPF_OBJ_GET = 0x7 BPF_PROG_ATTACH = 0x8 BPF_PROG_DETACH = 0x9 BPF_PROG_TEST_RUN = 0xa BPF_PROG_GET_NEXT_ID = 0xb BPF_MAP_GET_NEXT_ID = 0xc BPF_PROG_GET_FD_BY_ID = 0xd BPF_MAP_GET_FD_BY_ID = 0xe BPF_OBJ_GET_INFO_BY_FD = 0xf BPF_PROG_QUERY = 0x10 BPF_RAW_TRACEPOINT_OPEN = 0x11 BPF_BTF_LOAD = 0x12 BPF_BTF_GET_FD_BY_ID = 0x13 BPF_TASK_FD_QUERY = 0x14 BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 BPF_MAP_TYPE_UNSPEC = 0x0 BPF_MAP_TYPE_HASH = 0x1 BPF_MAP_TYPE_ARRAY = 0x2 BPF_MAP_TYPE_PROG_ARRAY = 0x3 BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 BPF_MAP_TYPE_PERCPU_HASH = 0x5 BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 BPF_MAP_TYPE_STACK_TRACE = 0x7 BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 BPF_MAP_TYPE_LRU_HASH = 0x9 BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa BPF_MAP_TYPE_LPM_TRIE = 0xb BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc BPF_MAP_TYPE_HASH_OF_MAPS = 0xd BPF_MAP_TYPE_DEVMAP = 0xe BPF_MAP_TYPE_SOCKMAP = 0xf BPF_MAP_TYPE_CPUMAP = 0x10 BPF_MAP_TYPE_XSKMAP = 0x11 BPF_MAP_TYPE_SOCKHASH = 0x12 BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 BPF_MAP_TYPE_QUEUE = 0x16 BPF_MAP_TYPE_STACK = 0x17 BPF_PROG_TYPE_UNSPEC = 0x0 BPF_PROG_TYPE_SOCKET_FILTER = 0x1 BPF_PROG_TYPE_KPROBE = 0x2 BPF_PROG_TYPE_SCHED_CLS = 0x3 BPF_PROG_TYPE_SCHED_ACT = 0x4 BPF_PROG_TYPE_TRACEPOINT = 0x5 BPF_PROG_TYPE_XDP = 0x6 BPF_PROG_TYPE_PERF_EVENT = 0x7 BPF_PROG_TYPE_CGROUP_SKB = 0x8 BPF_PROG_TYPE_CGROUP_SOCK = 0x9 BPF_PROG_TYPE_LWT_IN = 0xa BPF_PROG_TYPE_LWT_OUT = 0xb BPF_PROG_TYPE_LWT_XMIT = 0xc BPF_PROG_TYPE_SOCK_OPS = 0xd BPF_PROG_TYPE_SK_SKB = 0xe BPF_PROG_TYPE_CGROUP_DEVICE = 0xf BPF_PROG_TYPE_SK_MSG = 0x10 BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 BPF_PROG_TYPE_LIRC_MODE2 = 0x14 BPF_PROG_TYPE_SK_REUSEPORT = 0x15 BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 BPF_CGROUP_INET_INGRESS = 0x0 BPF_CGROUP_INET_EGRESS = 0x1 BPF_CGROUP_INET_SOCK_CREATE = 0x2 BPF_CGROUP_SOCK_OPS = 0x3 BPF_SK_SKB_STREAM_PARSER = 0x4 BPF_SK_SKB_STREAM_VERDICT = 0x5 BPF_CGROUP_DEVICE = 0x6 BPF_SK_MSG_VERDICT = 0x7 BPF_CGROUP_INET4_BIND = 0x8 BPF_CGROUP_INET6_BIND = 0x9 BPF_CGROUP_INET4_CONNECT = 0xa BPF_CGROUP_INET6_CONNECT = 0xb BPF_CGROUP_INET4_POST_BIND = 0xc BPF_CGROUP_INET6_POST_BIND = 0xd BPF_CGROUP_UDP4_SENDMSG = 0xe BPF_CGROUP_UDP6_SENDMSG = 0xf BPF_LIRC_MODE2 = 0x10 BPF_FLOW_DISSECTOR = 0x11 BPF_STACK_BUILD_ID_EMPTY = 0x0 BPF_STACK_BUILD_ID_VALID = 0x1 BPF_STACK_BUILD_ID_IP = 0x2 BPF_ADJ_ROOM_NET = 0x0 BPF_HDR_START_MAC = 0x0 BPF_HDR_START_NET = 0x1 BPF_LWT_ENCAP_SEG6 = 0x0 BPF_LWT_ENCAP_SEG6_INLINE = 0x1 BPF_OK = 0x0 BPF_DROP = 0x2 BPF_REDIRECT = 0x7 BPF_SOCK_OPS_VOID = 0x0 BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 BPF_SOCK_OPS_RWND_INIT = 0x2 BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 BPF_SOCK_OPS_NEEDS_ECN = 0x6 BPF_SOCK_OPS_BASE_RTT = 0x7 BPF_SOCK_OPS_RTO_CB = 0x8 BPF_SOCK_OPS_RETRANS_CB = 0x9 BPF_SOCK_OPS_STATE_CB = 0xa BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb BPF_TCP_ESTABLISHED = 0x1 BPF_TCP_SYN_SENT = 0x2 BPF_TCP_SYN_RECV = 0x3 BPF_TCP_FIN_WAIT1 = 0x4 BPF_TCP_FIN_WAIT2 = 0x5 BPF_TCP_TIME_WAIT = 0x6 BPF_TCP_CLOSE = 0x7 BPF_TCP_CLOSE_WAIT = 0x8 BPF_TCP_LAST_ACK = 0x9 BPF_TCP_LISTEN = 0xa BPF_TCP_CLOSING = 0xb BPF_TCP_NEW_SYN_RECV = 0xc BPF_TCP_MAX_STATES = 0xd BPF_FIB_LKUP_RET_SUCCESS = 0x0 BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 BPF_FIB_LKUP_RET_PROHIBIT = 0x3 BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 BPF_FD_TYPE_TRACEPOINT = 0x1 BPF_FD_TYPE_KPROBE = 0x2 BPF_FD_TYPE_KRETPROBE = 0x3 BPF_FD_TYPE_UPROBE = 0x4 BPF_FD_TYPE_URETPROBE = 0x5 ) const ( RTNLGRP_NONE = 0x0 RTNLGRP_LINK = 0x1 RTNLGRP_NOTIFY = 0x2 RTNLGRP_NEIGH = 0x3 RTNLGRP_TC = 0x4 RTNLGRP_IPV4_IFADDR = 0x5 RTNLGRP_IPV4_MROUTE = 0x6 RTNLGRP_IPV4_ROUTE = 0x7 RTNLGRP_IPV4_RULE = 0x8 RTNLGRP_IPV6_IFADDR = 0x9 RTNLGRP_IPV6_MROUTE = 0xa RTNLGRP_IPV6_ROUTE = 0xb RTNLGRP_IPV6_IFINFO = 0xc RTNLGRP_DECnet_IFADDR = 0xd RTNLGRP_NOP2 = 0xe RTNLGRP_DECnet_ROUTE = 0xf RTNLGRP_DECnet_RULE = 0x10 RTNLGRP_NOP4 = 0x11 RTNLGRP_IPV6_PREFIX = 0x12 RTNLGRP_IPV6_RULE = 0x13 RTNLGRP_ND_USEROPT = 0x14 RTNLGRP_PHONET_IFADDR = 0x15 RTNLGRP_PHONET_ROUTE = 0x16 RTNLGRP_DCB = 0x17 RTNLGRP_IPV4_NETCONF = 0x18 RTNLGRP_IPV6_NETCONF = 0x19 RTNLGRP_MDB = 0x1a RTNLGRP_MPLS_ROUTE = 0x1b RTNLGRP_NSID = 0x1c RTNLGRP_MPLS_NETCONF = 0x1d RTNLGRP_IPV4_MROUTE_R = 0x1e RTNLGRP_IPV6_MROUTE_R = 0x1f RTNLGRP_NEXTHOP = 0x20 ) type CapUserHeader struct { Version uint32 Pid int32 } type CapUserData struct { Effective uint32 Permitted uint32 Inheritable uint32 } const ( LINUX_CAPABILITY_VERSION_1 = 0x19980330 LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) const ( LO_FLAGS_READ_ONLY = 0x1 LO_FLAGS_AUTOCLEAR = 0x4 LO_FLAGS_PARTSCAN = 0x8 LO_FLAGS_DIRECT_IO = 0x10 ) type LoopInfo struct { Number int32 Device uint32 Inode uint32 Rdevice uint32 Offset int32 Encrypt_type int32 Encrypt_key_size int32 Flags int32 Name [64]int8 Encrypt_key [32]uint8 Init [2]uint32 Reserved [4]int8 } type LoopInfo64 struct { Device uint64 Inode uint64 Rdevice uint64 Offset uint64 Sizelimit uint64 Number uint32 Encrypt_type uint32 Encrypt_key_size uint32 Flags uint32 File_name [64]uint8 Crypt_name [64]uint8 Encrypt_key [32]uint8 Init [2]uint64 } type TIPCSocketAddr struct { Ref uint32 Node uint32 } type TIPCServiceRange struct { Type uint32 Lower uint32 Upper uint32 } type TIPCServiceName struct { Type uint32 Instance uint32 Domain uint32 } type TIPCSubscr struct { Seq TIPCServiceRange Timeout uint32 Filter uint32 Handle [8]int8 } type TIPCEvent struct { Event uint32 Lower uint32 Upper uint32 Port TIPCSocketAddr S TIPCSubscr } type TIPCGroupReq struct { Type uint32 Instance uint32 Scope uint32 Flags uint32 } type TIPCSIOCLNReq struct { Peer uint32 Id uint32 Linkname [68]int8 } type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]int8 } const ( TIPC_CLUSTER_SCOPE = 0x2 TIPC_NODE_SCOPE = 0x3 ) const ( SYSLOG_ACTION_CLOSE = 0 SYSLOG_ACTION_OPEN = 1 SYSLOG_ACTION_READ = 2 SYSLOG_ACTION_READ_ALL = 3 SYSLOG_ACTION_READ_CLEAR = 4 SYSLOG_ACTION_CLEAR = 5 SYSLOG_ACTION_CONSOLE_OFF = 6 SYSLOG_ACTION_CONSOLE_ON = 7 SYSLOG_ACTION_CONSOLE_LEVEL = 8 SYSLOG_ACTION_SIZE_UNREAD = 9 SYSLOG_ACTION_SIZE_BUFFER = 10 ) const ( DEVLINK_CMD_UNSPEC = 0x0 DEVLINK_CMD_GET = 0x1 DEVLINK_CMD_SET = 0x2 DEVLINK_CMD_NEW = 0x3 DEVLINK_CMD_DEL = 0x4 DEVLINK_CMD_PORT_GET = 0x5 DEVLINK_CMD_PORT_SET = 0x6 DEVLINK_CMD_PORT_NEW = 0x7 DEVLINK_CMD_PORT_DEL = 0x8 DEVLINK_CMD_PORT_SPLIT = 0x9 DEVLINK_CMD_PORT_UNSPLIT = 0xa DEVLINK_CMD_SB_GET = 0xb DEVLINK_CMD_SB_SET = 0xc DEVLINK_CMD_SB_NEW = 0xd DEVLINK_CMD_SB_DEL = 0xe DEVLINK_CMD_SB_POOL_GET = 0xf DEVLINK_CMD_SB_POOL_SET = 0x10 DEVLINK_CMD_SB_POOL_NEW = 0x11 DEVLINK_CMD_SB_POOL_DEL = 0x12 DEVLINK_CMD_SB_PORT_POOL_GET = 0x13 DEVLINK_CMD_SB_PORT_POOL_SET = 0x14 DEVLINK_CMD_SB_PORT_POOL_NEW = 0x15 DEVLINK_CMD_SB_PORT_POOL_DEL = 0x16 DEVLINK_CMD_SB_TC_POOL_BIND_GET = 0x17 DEVLINK_CMD_SB_TC_POOL_BIND_SET = 0x18 DEVLINK_CMD_SB_TC_POOL_BIND_NEW = 0x19 DEVLINK_CMD_SB_TC_POOL_BIND_DEL = 0x1a DEVLINK_CMD_SB_OCC_SNAPSHOT = 0x1b DEVLINK_CMD_SB_OCC_MAX_CLEAR = 0x1c DEVLINK_CMD_ESWITCH_GET = 0x1d DEVLINK_CMD_ESWITCH_SET = 0x1e DEVLINK_CMD_DPIPE_TABLE_GET = 0x1f DEVLINK_CMD_DPIPE_ENTRIES_GET = 0x20 DEVLINK_CMD_DPIPE_HEADERS_GET = 0x21 DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET = 0x22 DEVLINK_CMD_MAX = 0x44 DEVLINK_PORT_TYPE_NOTSET = 0x0 DEVLINK_PORT_TYPE_AUTO = 0x1 DEVLINK_PORT_TYPE_ETH = 0x2 DEVLINK_PORT_TYPE_IB = 0x3 DEVLINK_SB_POOL_TYPE_INGRESS = 0x0 DEVLINK_SB_POOL_TYPE_EGRESS = 0x1 DEVLINK_SB_THRESHOLD_TYPE_STATIC = 0x0 DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC = 0x1 DEVLINK_ESWITCH_MODE_LEGACY = 0x0 DEVLINK_ESWITCH_MODE_SWITCHDEV = 0x1 DEVLINK_ESWITCH_INLINE_MODE_NONE = 0x0 DEVLINK_ESWITCH_INLINE_MODE_LINK = 0x1 DEVLINK_ESWITCH_INLINE_MODE_NETWORK = 0x2 DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT = 0x3 DEVLINK_ESWITCH_ENCAP_MODE_NONE = 0x0 DEVLINK_ESWITCH_ENCAP_MODE_BASIC = 0x1 DEVLINK_ATTR_UNSPEC = 0x0 DEVLINK_ATTR_BUS_NAME = 0x1 DEVLINK_ATTR_DEV_NAME = 0x2 DEVLINK_ATTR_PORT_INDEX = 0x3 DEVLINK_ATTR_PORT_TYPE = 0x4 DEVLINK_ATTR_PORT_DESIRED_TYPE = 0x5 DEVLINK_ATTR_PORT_NETDEV_IFINDEX = 0x6 DEVLINK_ATTR_PORT_NETDEV_NAME = 0x7 DEVLINK_ATTR_PORT_IBDEV_NAME = 0x8 DEVLINK_ATTR_PORT_SPLIT_COUNT = 0x9 DEVLINK_ATTR_PORT_SPLIT_GROUP = 0xa DEVLINK_ATTR_SB_INDEX = 0xb DEVLINK_ATTR_SB_SIZE = 0xc DEVLINK_ATTR_SB_INGRESS_POOL_COUNT = 0xd DEVLINK_ATTR_SB_EGRESS_POOL_COUNT = 0xe DEVLINK_ATTR_SB_INGRESS_TC_COUNT = 0xf DEVLINK_ATTR_SB_EGRESS_TC_COUNT = 0x10 DEVLINK_ATTR_SB_POOL_INDEX = 0x11 DEVLINK_ATTR_SB_POOL_TYPE = 0x12 DEVLINK_ATTR_SB_POOL_SIZE = 0x13 DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE = 0x14 DEVLINK_ATTR_SB_THRESHOLD = 0x15 DEVLINK_ATTR_SB_TC_INDEX = 0x16 DEVLINK_ATTR_SB_OCC_CUR = 0x17 DEVLINK_ATTR_SB_OCC_MAX = 0x18 DEVLINK_ATTR_ESWITCH_MODE = 0x19 DEVLINK_ATTR_ESWITCH_INLINE_MODE = 0x1a DEVLINK_ATTR_DPIPE_TABLES = 0x1b DEVLINK_ATTR_DPIPE_TABLE = 0x1c DEVLINK_ATTR_DPIPE_TABLE_NAME = 0x1d DEVLINK_ATTR_DPIPE_TABLE_SIZE = 0x1e DEVLINK_ATTR_DPIPE_TABLE_MATCHES = 0x1f DEVLINK_ATTR_DPIPE_TABLE_ACTIONS = 0x20 DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED = 0x21 DEVLINK_ATTR_DPIPE_ENTRIES = 0x22 DEVLINK_ATTR_DPIPE_ENTRY = 0x23 DEVLINK_ATTR_DPIPE_ENTRY_INDEX = 0x24 DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES = 0x25 DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES = 0x26 DEVLINK_ATTR_DPIPE_ENTRY_COUNTER = 0x27 DEVLINK_ATTR_DPIPE_MATCH = 0x28 DEVLINK_ATTR_DPIPE_MATCH_VALUE = 0x29 DEVLINK_ATTR_DPIPE_MATCH_TYPE = 0x2a DEVLINK_ATTR_DPIPE_ACTION = 0x2b DEVLINK_ATTR_DPIPE_ACTION_VALUE = 0x2c DEVLINK_ATTR_DPIPE_ACTION_TYPE = 0x2d DEVLINK_ATTR_DPIPE_VALUE = 0x2e DEVLINK_ATTR_DPIPE_VALUE_MASK = 0x2f DEVLINK_ATTR_DPIPE_VALUE_MAPPING = 0x30 DEVLINK_ATTR_DPIPE_HEADERS = 0x31 DEVLINK_ATTR_DPIPE_HEADER = 0x32 DEVLINK_ATTR_DPIPE_HEADER_NAME = 0x33 DEVLINK_ATTR_DPIPE_HEADER_ID = 0x34 DEVLINK_ATTR_DPIPE_HEADER_FIELDS = 0x35 DEVLINK_ATTR_DPIPE_HEADER_GLOBAL = 0x36 DEVLINK_ATTR_DPIPE_HEADER_INDEX = 0x37 DEVLINK_ATTR_DPIPE_FIELD = 0x38 DEVLINK_ATTR_DPIPE_FIELD_NAME = 0x39 DEVLINK_ATTR_DPIPE_FIELD_ID = 0x3a DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH = 0x3b DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE = 0x3c DEVLINK_ATTR_PAD = 0x3d DEVLINK_ATTR_ESWITCH_ENCAP_MODE = 0x3e DEVLINK_ATTR_MAX = 0x8c DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0x0 DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 0x1 DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0x0 DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY = 0x0 DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC = 0x0 DEVLINK_DPIPE_FIELD_IPV4_DST_IP = 0x0 DEVLINK_DPIPE_FIELD_IPV6_DST_IP = 0x0 DEVLINK_DPIPE_HEADER_ETHERNET = 0x0 DEVLINK_DPIPE_HEADER_IPV4 = 0x1 DEVLINK_DPIPE_HEADER_IPV6 = 0x2 )
{ "pile_set_name": "Github" }
@available(OSX 10.4, *) let DOMXPathException: String @available(OSX 10.4, *) struct DOMXPathExceptionCode : RawRepresentable, Equatable { init(_ rawValue: UInt32) init(rawValue rawValue: UInt32) var rawValue: UInt32 } var DOM_INVALID_EXPRESSION_ERR: DOMXPathExceptionCode { get } var DOM_TYPE_ERR: DOMXPathExceptionCode { get }
{ "pile_set_name": "Github" }
*> \brief \b DLANSF returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a symmetric matrix in RFP format. * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download DLANSF + dependencies *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlansf.f"> *> [TGZ]</a> *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlansf.f"> *> [ZIP]</a> *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlansf.f"> *> [TXT]</a> *> \endhtmlonly * * Definition: * =========== * * DOUBLE PRECISION FUNCTION DLANSF( NORM, TRANSR, UPLO, N, A, WORK ) * * .. Scalar Arguments .. * CHARACTER NORM, TRANSR, UPLO * INTEGER N * .. * .. Array Arguments .. * DOUBLE PRECISION A( 0: * ), WORK( 0: * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DLANSF returns the value of the one norm, or the Frobenius norm, or *> the infinity norm, or the element of largest absolute value of a *> real symmetric matrix A in RFP format. *> \endverbatim *> *> \return DLANSF *> \verbatim *> *> DLANSF = ( max(abs(A(i,j))), NORM = 'M' or 'm' *> ( *> ( norm1(A), NORM = '1', 'O' or 'o' *> ( *> ( normI(A), NORM = 'I' or 'i' *> ( *> ( normF(A), NORM = 'F', 'f', 'E' or 'e' *> *> where norm1 denotes the one norm of a matrix (maximum column sum), *> normI denotes the infinity norm of a matrix (maximum row sum) and *> normF denotes the Frobenius norm of a matrix (square root of sum of *> squares). Note that max(abs(A(i,j))) is not a matrix norm. *> \endverbatim * * Arguments: * ========== * *> \param[in] NORM *> \verbatim *> NORM is CHARACTER*1 *> Specifies the value to be returned in DLANSF as described *> above. *> \endverbatim *> *> \param[in] TRANSR *> \verbatim *> TRANSR is CHARACTER*1 *> Specifies whether the RFP format of A is normal or *> transposed format. *> = 'N': RFP format is Normal; *> = 'T': RFP format is Transpose. *> \endverbatim *> *> \param[in] UPLO *> \verbatim *> UPLO is CHARACTER*1 *> On entry, UPLO specifies whether the RFP matrix A came from *> an upper or lower triangular matrix as follows: *> = 'U': RFP A came from an upper triangular matrix; *> = 'L': RFP A came from a lower triangular matrix. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the matrix A. N >= 0. When N = 0, DLANSF is *> set to zero. *> \endverbatim *> *> \param[in] A *> \verbatim *> A is DOUBLE PRECISION array, dimension ( N*(N+1)/2 ); *> On entry, the upper (if UPLO = 'U') or lower (if UPLO = 'L') *> part of the symmetric matrix A stored in RFP format. See the *> "Notes" below for more details. *> Unchanged on exit. *> \endverbatim *> *> \param[out] WORK *> \verbatim *> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)), *> where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise, *> WORK is not referenced. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date December 2016 * *> \ingroup doubleOTHERcomputational * *> \par Further Details: * ===================== *> *> \verbatim *> *> We first consider Rectangular Full Packed (RFP) Format when N is *> even. We give an example where N = 6. *> *> AP is Upper AP is Lower *> *> 00 01 02 03 04 05 00 *> 11 12 13 14 15 10 11 *> 22 23 24 25 20 21 22 *> 33 34 35 30 31 32 33 *> 44 45 40 41 42 43 44 *> 55 50 51 52 53 54 55 *> *> *> Let TRANSR = 'N'. RFP holds AP as follows: *> For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last *> three columns of AP upper. The lower triangle A(4:6,0:2) consists of *> the transpose of the first three columns of AP upper. *> For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first *> three columns of AP lower. The upper triangle A(0:2,0:2) consists of *> the transpose of the last three columns of AP lower. *> This covers the case N even and TRANSR = 'N'. *> *> RFP A RFP A *> *> 03 04 05 33 43 53 *> 13 14 15 00 44 54 *> 23 24 25 10 11 55 *> 33 34 35 20 21 22 *> 00 44 45 30 31 32 *> 01 11 55 40 41 42 *> 02 12 22 50 51 52 *> *> Now let TRANSR = 'T'. RFP A in both UPLO cases is just the *> transpose of RFP A above. One therefore gets: *> *> *> RFP A RFP A *> *> 03 13 23 33 00 01 02 33 00 10 20 30 40 50 *> 04 14 24 34 44 11 12 43 44 11 21 31 41 51 *> 05 15 25 35 45 55 22 53 54 55 22 32 42 52 *> *> *> We then consider Rectangular Full Packed (RFP) Format when N is *> odd. We give an example where N = 5. *> *> AP is Upper AP is Lower *> *> 00 01 02 03 04 00 *> 11 12 13 14 10 11 *> 22 23 24 20 21 22 *> 33 34 30 31 32 33 *> 44 40 41 42 43 44 *> *> *> Let TRANSR = 'N'. RFP holds AP as follows: *> For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last *> three columns of AP upper. The lower triangle A(3:4,0:1) consists of *> the transpose of the first two columns of AP upper. *> For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first *> three columns of AP lower. The upper triangle A(0:1,1:2) consists of *> the transpose of the last two columns of AP lower. *> This covers the case N odd and TRANSR = 'N'. *> *> RFP A RFP A *> *> 02 03 04 00 33 43 *> 12 13 14 10 11 44 *> 22 23 24 20 21 22 *> 00 33 34 30 31 32 *> 01 11 44 40 41 42 *> *> Now let TRANSR = 'T'. RFP A in both UPLO cases is just the *> transpose of RFP A above. One therefore gets: *> *> RFP A RFP A *> *> 02 12 22 00 01 00 10 20 30 40 50 *> 03 13 23 33 11 33 11 21 31 41 51 *> 04 14 24 34 44 43 44 22 32 42 52 *> \endverbatim * * ===================================================================== DOUBLE PRECISION FUNCTION DLANSF( NORM, TRANSR, UPLO, N, A, WORK ) * * -- LAPACK computational routine (version 3.7.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * December 2016 * * .. Scalar Arguments .. CHARACTER NORM, TRANSR, UPLO INTEGER N * .. * .. Array Arguments .. DOUBLE PRECISION A( 0: * ), WORK( 0: * ) * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ONE, ZERO PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) * .. * .. Local Scalars .. INTEGER I, J, IFM, ILU, NOE, N1, K, L, LDA DOUBLE PRECISION SCALE, S, VALUE, AA, TEMP * .. * .. External Functions .. LOGICAL LSAME, DISNAN EXTERNAL LSAME, DISNAN * .. * .. External Subroutines .. EXTERNAL DLASSQ * .. * .. Intrinsic Functions .. INTRINSIC ABS, MAX, SQRT * .. * .. Executable Statements .. * IF( N.EQ.0 ) THEN DLANSF = ZERO RETURN ELSE IF( N.EQ.1 ) THEN DLANSF = ABS( A(0) ) RETURN END IF * * set noe = 1 if n is odd. if n is even set noe=0 * NOE = 1 IF( MOD( N, 2 ).EQ.0 ) $ NOE = 0 * * set ifm = 0 when form='T or 't' and 1 otherwise * IFM = 1 IF( LSAME( TRANSR, 'T' ) ) $ IFM = 0 * * set ilu = 0 when uplo='U or 'u' and 1 otherwise * ILU = 1 IF( LSAME( UPLO, 'U' ) ) $ ILU = 0 * * set lda = (n+1)/2 when ifm = 0 * set lda = n when ifm = 1 and noe = 1 * set lda = n+1 when ifm = 1 and noe = 0 * IF( IFM.EQ.1 ) THEN IF( NOE.EQ.1 ) THEN LDA = N ELSE * noe=0 LDA = N + 1 END IF ELSE * ifm=0 LDA = ( N+1 ) / 2 END IF * IF( LSAME( NORM, 'M' ) ) THEN * * Find max(abs(A(i,j))). * K = ( N+1 ) / 2 VALUE = ZERO IF( NOE.EQ.1 ) THEN * n is odd IF( IFM.EQ.1 ) THEN * A is n by k DO J = 0, K - 1 DO I = 0, N - 1 TEMP = ABS( A( I+J*LDA ) ) IF( VALUE .LT. TEMP .OR. DISNAN( TEMP ) ) $ VALUE = TEMP END DO END DO ELSE * xpose case; A is k by n DO J = 0, N - 1 DO I = 0, K - 1 TEMP = ABS( A( I+J*LDA ) ) IF( VALUE .LT. TEMP .OR. DISNAN( TEMP ) ) $ VALUE = TEMP END DO END DO END IF ELSE * n is even IF( IFM.EQ.1 ) THEN * A is n+1 by k DO J = 0, K - 1 DO I = 0, N TEMP = ABS( A( I+J*LDA ) ) IF( VALUE .LT. TEMP .OR. DISNAN( TEMP ) ) $ VALUE = TEMP END DO END DO ELSE * xpose case; A is k by n+1 DO J = 0, N DO I = 0, K - 1 TEMP = ABS( A( I+J*LDA ) ) IF( VALUE .LT. TEMP .OR. DISNAN( TEMP ) ) $ VALUE = TEMP END DO END DO END IF END IF ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR. $ ( NORM.EQ.'1' ) ) THEN * * Find normI(A) ( = norm1(A), since A is symmetric). * IF( IFM.EQ.1 ) THEN K = N / 2 IF( NOE.EQ.1 ) THEN * n is odd IF( ILU.EQ.0 ) THEN DO I = 0, K - 1 WORK( I ) = ZERO END DO DO J = 0, K S = ZERO DO I = 0, K + J - 1 AA = ABS( A( I+J*LDA ) ) * -> A(i,j+k) S = S + AA WORK( I ) = WORK( I ) + AA END DO AA = ABS( A( I+J*LDA ) ) * -> A(j+k,j+k) WORK( J+K ) = S + AA IF( I.EQ.K+K ) $ GO TO 10 I = I + 1 AA = ABS( A( I+J*LDA ) ) * -> A(j,j) WORK( J ) = WORK( J ) + AA S = ZERO DO L = J + 1, K - 1 I = I + 1 AA = ABS( A( I+J*LDA ) ) * -> A(l,j) S = S + AA WORK( L ) = WORK( L ) + AA END DO WORK( J ) = WORK( J ) + S END DO 10 CONTINUE VALUE = WORK( 0 ) DO I = 1, N-1 TEMP = WORK( I ) IF( VALUE .LT. TEMP .OR. DISNAN( TEMP ) ) $ VALUE = TEMP END DO ELSE * ilu = 1 K = K + 1 * k=(n+1)/2 for n odd and ilu=1 DO I = K, N - 1 WORK( I ) = ZERO END DO DO J = K - 1, 0, -1 S = ZERO DO I = 0, J - 2 AA = ABS( A( I+J*LDA ) ) * -> A(j+k,i+k) S = S + AA WORK( I+K ) = WORK( I+K ) + AA END DO IF( J.GT.0 ) THEN AA = ABS( A( I+J*LDA ) ) * -> A(j+k,j+k) S = S + AA WORK( I+K ) = WORK( I+K ) + S * i=j I = I + 1 END IF AA = ABS( A( I+J*LDA ) ) * -> A(j,j) WORK( J ) = AA S = ZERO DO L = J + 1, N - 1 I = I + 1 AA = ABS( A( I+J*LDA ) ) * -> A(l,j) S = S + AA WORK( L ) = WORK( L ) + AA END DO WORK( J ) = WORK( J ) + S END DO VALUE = WORK( 0 ) DO I = 1, N-1 TEMP = WORK( I ) IF( VALUE .LT. TEMP .OR. DISNAN( TEMP ) ) $ VALUE = TEMP END DO END IF ELSE * n is even IF( ILU.EQ.0 ) THEN DO I = 0, K - 1 WORK( I ) = ZERO END DO DO J = 0, K - 1 S = ZERO DO I = 0, K + J - 1 AA = ABS( A( I+J*LDA ) ) * -> A(i,j+k) S = S + AA WORK( I ) = WORK( I ) + AA END DO AA = ABS( A( I+J*LDA ) ) * -> A(j+k,j+k) WORK( J+K ) = S + AA I = I + 1 AA = ABS( A( I+J*LDA ) ) * -> A(j,j) WORK( J ) = WORK( J ) + AA S = ZERO DO L = J + 1, K - 1 I = I + 1 AA = ABS( A( I+J*LDA ) ) * -> A(l,j) S = S + AA WORK( L ) = WORK( L ) + AA END DO WORK( J ) = WORK( J ) + S END DO VALUE = WORK( 0 ) DO I = 1, N-1 TEMP = WORK( I ) IF( VALUE .LT. TEMP .OR. DISNAN( TEMP ) ) $ VALUE = TEMP END DO ELSE * ilu = 1 DO I = K, N - 1 WORK( I ) = ZERO END DO DO J = K - 1, 0, -1 S = ZERO DO I = 0, J - 1 AA = ABS( A( I+J*LDA ) ) * -> A(j+k,i+k) S = S + AA WORK( I+K ) = WORK( I+K ) + AA END DO AA = ABS( A( I+J*LDA ) ) * -> A(j+k,j+k) S = S + AA WORK( I+K ) = WORK( I+K ) + S * i=j I = I + 1 AA = ABS( A( I+J*LDA ) ) * -> A(j,j) WORK( J ) = AA S = ZERO DO L = J + 1, N - 1 I = I + 1 AA = ABS( A( I+J*LDA ) ) * -> A(l,j) S = S + AA WORK( L ) = WORK( L ) + AA END DO WORK( J ) = WORK( J ) + S END DO VALUE = WORK( 0 ) DO I = 1, N-1 TEMP = WORK( I ) IF( VALUE .LT. TEMP .OR. DISNAN( TEMP ) ) $ VALUE = TEMP END DO END IF END IF ELSE * ifm=0 K = N / 2 IF( NOE.EQ.1 ) THEN * n is odd IF( ILU.EQ.0 ) THEN N1 = K * n/2 K = K + 1 * k is the row size and lda DO I = N1, N - 1 WORK( I ) = ZERO END DO DO J = 0, N1 - 1 S = ZERO DO I = 0, K - 1 AA = ABS( A( I+J*LDA ) ) * A(j,n1+i) WORK( I+N1 ) = WORK( I+N1 ) + AA S = S + AA END DO WORK( J ) = S END DO * j=n1=k-1 is special S = ABS( A( 0+J*LDA ) ) * A(k-1,k-1) DO I = 1, K - 1 AA = ABS( A( I+J*LDA ) ) * A(k-1,i+n1) WORK( I+N1 ) = WORK( I+N1 ) + AA S = S + AA END DO WORK( J ) = WORK( J ) + S DO J = K, N - 1 S = ZERO DO I = 0, J - K - 1 AA = ABS( A( I+J*LDA ) ) * A(i,j-k) WORK( I ) = WORK( I ) + AA S = S + AA END DO * i=j-k AA = ABS( A( I+J*LDA ) ) * A(j-k,j-k) S = S + AA WORK( J-K ) = WORK( J-K ) + S I = I + 1 S = ABS( A( I+J*LDA ) ) * A(j,j) DO L = J + 1, N - 1 I = I + 1 AA = ABS( A( I+J*LDA ) ) * A(j,l) WORK( L ) = WORK( L ) + AA S = S + AA END DO WORK( J ) = WORK( J ) + S END DO VALUE = WORK( 0 ) DO I = 1, N-1 TEMP = WORK( I ) IF( VALUE .LT. TEMP .OR. DISNAN( TEMP ) ) $ VALUE = TEMP END DO ELSE * ilu=1 K = K + 1 * k=(n+1)/2 for n odd and ilu=1 DO I = K, N - 1 WORK( I ) = ZERO END DO DO J = 0, K - 2 * process S = ZERO DO I = 0, J - 1 AA = ABS( A( I+J*LDA ) ) * A(j,i) WORK( I ) = WORK( I ) + AA S = S + AA END DO AA = ABS( A( I+J*LDA ) ) * i=j so process of A(j,j) S = S + AA WORK( J ) = S * is initialised here I = I + 1 * i=j process A(j+k,j+k) AA = ABS( A( I+J*LDA ) ) S = AA DO L = K + J + 1, N - 1 I = I + 1 AA = ABS( A( I+J*LDA ) ) * A(l,k+j) S = S + AA WORK( L ) = WORK( L ) + AA END DO WORK( K+J ) = WORK( K+J ) + S END DO * j=k-1 is special :process col A(k-1,0:k-1) S = ZERO DO I = 0, K - 2 AA = ABS( A( I+J*LDA ) ) * A(k,i) WORK( I ) = WORK( I ) + AA S = S + AA END DO * i=k-1 AA = ABS( A( I+J*LDA ) ) * A(k-1,k-1) S = S + AA WORK( I ) = S * done with col j=k+1 DO J = K, N - 1 * process col j of A = A(j,0:k-1) S = ZERO DO I = 0, K - 1 AA = ABS( A( I+J*LDA ) ) * A(j,i) WORK( I ) = WORK( I ) + AA S = S + AA END DO WORK( J ) = WORK( J ) + S END DO VALUE = WORK( 0 ) DO I = 1, N-1 TEMP = WORK( I ) IF( VALUE .LT. TEMP .OR. DISNAN( TEMP ) ) $ VALUE = TEMP END DO END IF ELSE * n is even IF( ILU.EQ.0 ) THEN DO I = K, N - 1 WORK( I ) = ZERO END DO DO J = 0, K - 1 S = ZERO DO I = 0, K - 1 AA = ABS( A( I+J*LDA ) ) * A(j,i+k) WORK( I+K ) = WORK( I+K ) + AA S = S + AA END DO WORK( J ) = S END DO * j=k AA = ABS( A( 0+J*LDA ) ) * A(k,k) S = AA DO I = 1, K - 1 AA = ABS( A( I+J*LDA ) ) * A(k,k+i) WORK( I+K ) = WORK( I+K ) + AA S = S + AA END DO WORK( J ) = WORK( J ) + S DO J = K + 1, N - 1 S = ZERO DO I = 0, J - 2 - K AA = ABS( A( I+J*LDA ) ) * A(i,j-k-1) WORK( I ) = WORK( I ) + AA S = S + AA END DO * i=j-1-k AA = ABS( A( I+J*LDA ) ) * A(j-k-1,j-k-1) S = S + AA WORK( J-K-1 ) = WORK( J-K-1 ) + S I = I + 1 AA = ABS( A( I+J*LDA ) ) * A(j,j) S = AA DO L = J + 1, N - 1 I = I + 1 AA = ABS( A( I+J*LDA ) ) * A(j,l) WORK( L ) = WORK( L ) + AA S = S + AA END DO WORK( J ) = WORK( J ) + S END DO * j=n S = ZERO DO I = 0, K - 2 AA = ABS( A( I+J*LDA ) ) * A(i,k-1) WORK( I ) = WORK( I ) + AA S = S + AA END DO * i=k-1 AA = ABS( A( I+J*LDA ) ) * A(k-1,k-1) S = S + AA WORK( I ) = WORK( I ) + S VALUE = WORK( 0 ) DO I = 1, N-1 TEMP = WORK( I ) IF( VALUE .LT. TEMP .OR. DISNAN( TEMP ) ) $ VALUE = TEMP END DO ELSE * ilu=1 DO I = K, N - 1 WORK( I ) = ZERO END DO * j=0 is special :process col A(k:n-1,k) S = ABS( A( 0 ) ) * A(k,k) DO I = 1, K - 1 AA = ABS( A( I ) ) * A(k+i,k) WORK( I+K ) = WORK( I+K ) + AA S = S + AA END DO WORK( K ) = WORK( K ) + S DO J = 1, K - 1 * process S = ZERO DO I = 0, J - 2 AA = ABS( A( I+J*LDA ) ) * A(j-1,i) WORK( I ) = WORK( I ) + AA S = S + AA END DO AA = ABS( A( I+J*LDA ) ) * i=j-1 so process of A(j-1,j-1) S = S + AA WORK( J-1 ) = S * is initialised here I = I + 1 * i=j process A(j+k,j+k) AA = ABS( A( I+J*LDA ) ) S = AA DO L = K + J + 1, N - 1 I = I + 1 AA = ABS( A( I+J*LDA ) ) * A(l,k+j) S = S + AA WORK( L ) = WORK( L ) + AA END DO WORK( K+J ) = WORK( K+J ) + S END DO * j=k is special :process col A(k,0:k-1) S = ZERO DO I = 0, K - 2 AA = ABS( A( I+J*LDA ) ) * A(k,i) WORK( I ) = WORK( I ) + AA S = S + AA END DO * i=k-1 AA = ABS( A( I+J*LDA ) ) * A(k-1,k-1) S = S + AA WORK( I ) = S * done with col j=k+1 DO J = K + 1, N * process col j-1 of A = A(j-1,0:k-1) S = ZERO DO I = 0, K - 1 AA = ABS( A( I+J*LDA ) ) * A(j-1,i) WORK( I ) = WORK( I ) + AA S = S + AA END DO WORK( J-1 ) = WORK( J-1 ) + S END DO VALUE = WORK( 0 ) DO I = 1, N-1 TEMP = WORK( I ) IF( VALUE .LT. TEMP .OR. DISNAN( TEMP ) ) $ VALUE = TEMP END DO END IF END IF END IF ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN * * Find normF(A). * K = ( N+1 ) / 2 SCALE = ZERO S = ONE IF( NOE.EQ.1 ) THEN * n is odd IF( IFM.EQ.1 ) THEN * A is normal IF( ILU.EQ.0 ) THEN * A is upper DO J = 0, K - 3 CALL DLASSQ( K-J-2, A( K+J+1+J*LDA ), 1, SCALE, S ) * L at A(k,0) END DO DO J = 0, K - 1 CALL DLASSQ( K+J-1, A( 0+J*LDA ), 1, SCALE, S ) * trap U at A(0,0) END DO S = S + S * double s for the off diagonal elements CALL DLASSQ( K-1, A( K ), LDA+1, SCALE, S ) * tri L at A(k,0) CALL DLASSQ( K, A( K-1 ), LDA+1, SCALE, S ) * tri U at A(k-1,0) ELSE * ilu=1 & A is lower DO J = 0, K - 1 CALL DLASSQ( N-J-1, A( J+1+J*LDA ), 1, SCALE, S ) * trap L at A(0,0) END DO DO J = 0, K - 2 CALL DLASSQ( J, A( 0+( 1+J )*LDA ), 1, SCALE, S ) * U at A(0,1) END DO S = S + S * double s for the off diagonal elements CALL DLASSQ( K, A( 0 ), LDA+1, SCALE, S ) * tri L at A(0,0) CALL DLASSQ( K-1, A( 0+LDA ), LDA+1, SCALE, S ) * tri U at A(0,1) END IF ELSE * A is xpose IF( ILU.EQ.0 ) THEN * A**T is upper DO J = 1, K - 2 CALL DLASSQ( J, A( 0+( K+J )*LDA ), 1, SCALE, S ) * U at A(0,k) END DO DO J = 0, K - 2 CALL DLASSQ( K, A( 0+J*LDA ), 1, SCALE, S ) * k by k-1 rect. at A(0,0) END DO DO J = 0, K - 2 CALL DLASSQ( K-J-1, A( J+1+( J+K-1 )*LDA ), 1, $ SCALE, S ) * L at A(0,k-1) END DO S = S + S * double s for the off diagonal elements CALL DLASSQ( K-1, A( 0+K*LDA ), LDA+1, SCALE, S ) * tri U at A(0,k) CALL DLASSQ( K, A( 0+( K-1 )*LDA ), LDA+1, SCALE, S ) * tri L at A(0,k-1) ELSE * A**T is lower DO J = 1, K - 1 CALL DLASSQ( J, A( 0+J*LDA ), 1, SCALE, S ) * U at A(0,0) END DO DO J = K, N - 1 CALL DLASSQ( K, A( 0+J*LDA ), 1, SCALE, S ) * k by k-1 rect. at A(0,k) END DO DO J = 0, K - 3 CALL DLASSQ( K-J-2, A( J+2+J*LDA ), 1, SCALE, S ) * L at A(1,0) END DO S = S + S * double s for the off diagonal elements CALL DLASSQ( K, A( 0 ), LDA+1, SCALE, S ) * tri U at A(0,0) CALL DLASSQ( K-1, A( 1 ), LDA+1, SCALE, S ) * tri L at A(1,0) END IF END IF ELSE * n is even IF( IFM.EQ.1 ) THEN * A is normal IF( ILU.EQ.0 ) THEN * A is upper DO J = 0, K - 2 CALL DLASSQ( K-J-1, A( K+J+2+J*LDA ), 1, SCALE, S ) * L at A(k+1,0) END DO DO J = 0, K - 1 CALL DLASSQ( K+J, A( 0+J*LDA ), 1, SCALE, S ) * trap U at A(0,0) END DO S = S + S * double s for the off diagonal elements CALL DLASSQ( K, A( K+1 ), LDA+1, SCALE, S ) * tri L at A(k+1,0) CALL DLASSQ( K, A( K ), LDA+1, SCALE, S ) * tri U at A(k,0) ELSE * ilu=1 & A is lower DO J = 0, K - 1 CALL DLASSQ( N-J-1, A( J+2+J*LDA ), 1, SCALE, S ) * trap L at A(1,0) END DO DO J = 1, K - 1 CALL DLASSQ( J, A( 0+J*LDA ), 1, SCALE, S ) * U at A(0,0) END DO S = S + S * double s for the off diagonal elements CALL DLASSQ( K, A( 1 ), LDA+1, SCALE, S ) * tri L at A(1,0) CALL DLASSQ( K, A( 0 ), LDA+1, SCALE, S ) * tri U at A(0,0) END IF ELSE * A is xpose IF( ILU.EQ.0 ) THEN * A**T is upper DO J = 1, K - 1 CALL DLASSQ( J, A( 0+( K+1+J )*LDA ), 1, SCALE, S ) * U at A(0,k+1) END DO DO J = 0, K - 1 CALL DLASSQ( K, A( 0+J*LDA ), 1, SCALE, S ) * k by k rect. at A(0,0) END DO DO J = 0, K - 2 CALL DLASSQ( K-J-1, A( J+1+( J+K )*LDA ), 1, SCALE, $ S ) * L at A(0,k) END DO S = S + S * double s for the off diagonal elements CALL DLASSQ( K, A( 0+( K+1 )*LDA ), LDA+1, SCALE, S ) * tri U at A(0,k+1) CALL DLASSQ( K, A( 0+K*LDA ), LDA+1, SCALE, S ) * tri L at A(0,k) ELSE * A**T is lower DO J = 1, K - 1 CALL DLASSQ( J, A( 0+( J+1 )*LDA ), 1, SCALE, S ) * U at A(0,1) END DO DO J = K + 1, N CALL DLASSQ( K, A( 0+J*LDA ), 1, SCALE, S ) * k by k rect. at A(0,k+1) END DO DO J = 0, K - 2 CALL DLASSQ( K-J-1, A( J+1+J*LDA ), 1, SCALE, S ) * L at A(0,0) END DO S = S + S * double s for the off diagonal elements CALL DLASSQ( K, A( LDA ), LDA+1, SCALE, S ) * tri L at A(0,1) CALL DLASSQ( K, A( 0 ), LDA+1, SCALE, S ) * tri U at A(0,0) END IF END IF END IF VALUE = SCALE*SQRT( S ) END IF * DLANSF = VALUE RETURN * * End of DLANSF * END
{ "pile_set_name": "Github" }
package godo import ( "context" "net/http" ) // RegionsService is an interface for interfacing with the regions // endpoints of the DigitalOcean API // See: https://developers.digitalocean.com/documentation/v2#regions type RegionsService interface { List(context.Context, *ListOptions) ([]Region, *Response, error) } // RegionsServiceOp handles communication with the region related methods of the // DigitalOcean API. type RegionsServiceOp struct { client *Client } var _ RegionsService = &RegionsServiceOp{} // Region represents a DigitalOcean Region type Region struct { Slug string `json:"slug,omitempty"` Name string `json:"name,omitempty"` Sizes []string `json:"sizes,omitempty"` Available bool `json:"available,omitempty"` Features []string `json:"features,omitempty"` } type regionsRoot struct { Regions []Region Links *Links `json:"links"` Meta *Meta `json:"meta"` } func (r Region) String() string { return Stringify(r) } // List all regions func (s *RegionsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Region, *Response, error) { path := "v2/regions" path, err := addOptions(path, opt) if err != nil { return nil, nil, err } req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) if err != nil { return nil, nil, err } root := new(regionsRoot) resp, err := s.client.Do(ctx, req, root) if err != nil { return nil, resp, err } if l := root.Links; l != nil { resp.Links = l } if m := root.Meta; m != nil { resp.Meta = m } return root.Regions, resp, err }
{ "pile_set_name": "Github" }
<?php declare(strict_types=1); namespace Doctrine\ODM\MongoDB\Tests\Functional; use Doctrine\ODM\MongoDB\Tests\BaseTest; use Documents\Bars\Bar; use Documents\Bars\Location; class SimpleTest extends BaseTest { public function testSimple() { $bar = new Bar("Jon's Pub"); $bar->addLocation(new Location('West Nashville')); $bar->addLocation(new Location('East Nashville')); $bar->addLocation(new Location('North Nashville')); $this->dm->persist($bar); $this->dm->flush(); $this->dm->clear(); $bar = $this->dm->find(Bar::class, $bar->getId()); $locations = $bar->getLocations(); unset($locations[0]); $this->dm->flush(); $test = $this->dm->getDocumentCollection(Bar::class)->findOne(); $this->assertCount(2, $test['locations']); } }
{ "pile_set_name": "Github" }
<?php /* * Copyright 2014 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ class Google_Service_ServiceManagement_ConfigChange extends Google_Collection { protected $collection_key = 'advices'; protected $advicesType = 'Google_Service_ServiceManagement_Advice'; protected $advicesDataType = 'array'; public $changeType; public $element; public $newValue; public $oldValue; /** * @param Google_Service_ServiceManagement_Advice */ public function setAdvices($advices) { $this->advices = $advices; } /** * @return Google_Service_ServiceManagement_Advice */ public function getAdvices() { return $this->advices; } public function setChangeType($changeType) { $this->changeType = $changeType; } public function getChangeType() { return $this->changeType; } public function setElement($element) { $this->element = $element; } public function getElement() { return $this->element; } public function setNewValue($newValue) { $this->newValue = $newValue; } public function getNewValue() { return $this->newValue; } public function setOldValue($oldValue) { $this->oldValue = $oldValue; } public function getOldValue() { return $this->oldValue; } }
{ "pile_set_name": "Github" }