text
stringlengths 2
100k
| meta
dict |
---|---|
//
// Copyright (C) OpenSim Ltd.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 2
// of the 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 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 __INET_SIGNAL_H
#define __INET_SIGNAL_H
#include "inet/common/INETDefs.h"
namespace inet {
namespace physicallayer {
class INET_API Signal : public cPacket
{
public:
explicit Signal(const char *name=nullptr, short kind=0, int64_t bitLength=0);
Signal(const Signal& other);
virtual Signal *dup() const override { return new Signal(*this); }
};
} // namespace physicallayer
} // namespace inet
#endif // ifndef __INET_SIGNAL_H
| {
"pile_set_name": "Github"
} |
/* SCCS Id: @(#)dprintf.c 3.1 94/01/29 */
/* Copyright (c) Jon W{tte, 1993. */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
#include "macwin.h"
static Boolean
KeyDown (unsigned short code) {
unsigned char keys [16];
GetKeys ((void *) keys);
return ((keys [code >> 3] >> (code & 7)) & 1) != 0;
}
void
dprintf (char *format, ...)
{
char buffer [500];
va_list list;
int doit;
#define DO_DEBUGSTR 1
#define DO_PLINE 2
if (flags.debug) {
doit = 0;
if (macFlags.hasDebugger && KeyDown (0x39)) { /* Caps Lock */
doit = DO_DEBUGSTR;
} else if (KeyDown (0x3B) && iflags.window_inited && /* Control */
(WIN_MESSAGE != -1) && theWindows [WIN_MESSAGE].its_window) {
doit = DO_PLINE;
}
if (doit) {
va_start (list, format);
vsprintf (&buffer [1], format, list);
va_end (list) ;
if (doit == DO_DEBUGSTR) {
buffer [0] = strlen (&buffer [1]);
DebugStr ((uchar *) buffer);
} else if (doit == DO_PLINE)
pline ("%s", &buffer [1]);
}
}
}
| {
"pile_set_name": "Github"
} |
module Data02Lib where
{-@ data Pair = P { pX :: Nat, pY :: {v:Nat | pX < v} } @-}
data Pair = P { pX :: Int, pY :: Int }
{-@ test1 :: Pair -> TT @-}
test1 (P a b) = a < b
{-@ test2 :: Nat -> Pair @-}
test2 x = P x (x + 1)
| {
"pile_set_name": "Github"
} |
:pserver:[email protected]:/cvsroot
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2010-2013, 2016-2019 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
* not be construed as granting a license to any other intellectual
* property including but not limited to intellectual property relating
* to a hardware implementation of the functionality of the software
* licensed hereunder. You may use the software subject to the license
* terms below provided that you ensure that this notice is replicated
* unmodified and in its entirety in all distributions of the software,
* modified or unmodified, in source code or in binary form.
*
* Copyright (c) 2001-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "arch/arm/tlb.hh"
#include <memory>
#include <string>
#include <vector>
#include "arch/arm/faults.hh"
#include "arch/arm/pagetable.hh"
#include "arch/arm/stage2_lookup.hh"
#include "arch/arm/stage2_mmu.hh"
#include "arch/arm/system.hh"
#include "arch/arm/table_walker.hh"
#include "arch/arm/utility.hh"
#include "base/inifile.hh"
#include "base/str.hh"
#include "base/trace.hh"
#include "cpu/base.hh"
#include "cpu/thread_context.hh"
#include "debug/Checkpoint.hh"
#include "debug/TLB.hh"
#include "debug/TLBVerbose.hh"
#include "mem/packet_access.hh"
#include "mem/page_table.hh"
#include "mem/request.hh"
#include "params/ArmTLB.hh"
#include "sim/full_system.hh"
#include "sim/process.hh"
#include "sim/pseudo_inst.hh"
using namespace std;
using namespace ArmISA;
TLB::TLB(const ArmTLBParams *p)
: BaseTLB(p), table(new TlbEntry[p->size]), size(p->size),
isStage2(p->is_stage2), stage2Req(false), stage2DescReq(false), _attr(0),
directToStage2(false), tableWalker(p->walker), stage2Tlb(NULL),
stage2Mmu(NULL), test(nullptr), rangeMRU(1),
aarch64(false), aarch64EL(EL0), isPriv(false), isSecure(false),
isHyp(false), asid(0), vmid(0), hcr(0), dacr(0),
miscRegValid(false), miscRegContext(0), curTranType(NormalTran)
{
const ArmSystem *sys = dynamic_cast<const ArmSystem *>(p->sys);
tableWalker->setTlb(this);
// Cache system-level properties
haveLPAE = tableWalker->haveLPAE();
haveVirtualization = tableWalker->haveVirtualization();
haveLargeAsid64 = tableWalker->haveLargeAsid64();
if (sys)
m5opRange = sys->m5opRange();
}
TLB::~TLB()
{
delete[] table;
}
void
TLB::init()
{
if (stage2Mmu && !isStage2)
stage2Tlb = stage2Mmu->stage2Tlb();
}
void
TLB::setMMU(Stage2MMU *m, MasterID master_id)
{
stage2Mmu = m;
tableWalker->setMMU(m, master_id);
}
bool
TLB::translateFunctional(ThreadContext *tc, Addr va, Addr &pa)
{
updateMiscReg(tc);
if (directToStage2) {
assert(stage2Tlb);
return stage2Tlb->translateFunctional(tc, va, pa);
}
TlbEntry *e = lookup(va, asid, vmid, isHyp, isSecure, true, false,
aarch64 ? aarch64EL : EL1);
if (!e)
return false;
pa = e->pAddr(va);
return true;
}
Fault
TLB::finalizePhysical(const RequestPtr &req,
ThreadContext *tc, Mode mode) const
{
const Addr paddr = req->getPaddr();
if (m5opRange.contains(paddr)) {
uint8_t func;
PseudoInst::decodeAddrOffset(paddr - m5opRange.start(), func);
req->setLocalAccessor(
[func, mode](ThreadContext *tc, PacketPtr pkt) -> Cycles
{
uint64_t ret;
PseudoInst::pseudoInst<PseudoInstABI>(tc, func, ret);
if (mode == Read)
pkt->setLE(ret);
return Cycles(1);
}
);
}
return NoFault;
}
TlbEntry*
TLB::lookup(Addr va, uint16_t asn, uint8_t vmid, bool hyp, bool secure,
bool functional, bool ignore_asn, ExceptionLevel target_el)
{
TlbEntry *retval = NULL;
// Maintaining LRU array
int x = 0;
while (retval == NULL && x < size) {
if ((!ignore_asn && table[x].match(va, asn, vmid, hyp, secure, false,
target_el)) ||
(ignore_asn && table[x].match(va, vmid, hyp, secure, target_el))) {
// We only move the hit entry ahead when the position is higher
// than rangeMRU
if (x > rangeMRU && !functional) {
TlbEntry tmp_entry = table[x];
for (int i = x; i > 0; i--)
table[i] = table[i - 1];
table[0] = tmp_entry;
retval = &table[0];
} else {
retval = &table[x];
}
break;
}
++x;
}
DPRINTF(TLBVerbose, "Lookup %#x, asn %#x -> %s vmn 0x%x hyp %d secure %d "
"ppn %#x size: %#x pa: %#x ap:%d ns:%d nstid:%d g:%d asid: %d "
"el: %d\n",
va, asn, retval ? "hit" : "miss", vmid, hyp, secure,
retval ? retval->pfn : 0, retval ? retval->size : 0,
retval ? retval->pAddr(va) : 0, retval ? retval->ap : 0,
retval ? retval->ns : 0, retval ? retval->nstid : 0,
retval ? retval->global : 0, retval ? retval->asid : 0,
retval ? retval->el : 0);
return retval;
}
// insert a new TLB entry
void
TLB::insert(Addr addr, TlbEntry &entry)
{
DPRINTF(TLB, "Inserting entry into TLB with pfn:%#x size:%#x vpn: %#x"
" asid:%d vmid:%d N:%d global:%d valid:%d nc:%d xn:%d"
" ap:%#x domain:%#x ns:%d nstid:%d isHyp:%d\n", entry.pfn,
entry.size, entry.vpn, entry.asid, entry.vmid, entry.N,
entry.global, entry.valid, entry.nonCacheable, entry.xn,
entry.ap, static_cast<uint8_t>(entry.domain), entry.ns, entry.nstid,
entry.isHyp);
if (table[size - 1].valid)
DPRINTF(TLB, " - Replacing Valid entry %#x, asn %d vmn %d ppn %#x "
"size: %#x ap:%d ns:%d nstid:%d g:%d isHyp:%d el: %d\n",
table[size-1].vpn << table[size-1].N, table[size-1].asid,
table[size-1].vmid, table[size-1].pfn << table[size-1].N,
table[size-1].size, table[size-1].ap, table[size-1].ns,
table[size-1].nstid, table[size-1].global, table[size-1].isHyp,
table[size-1].el);
//inserting to MRU position and evicting the LRU one
for (int i = size - 1; i > 0; --i)
table[i] = table[i-1];
table[0] = entry;
inserts++;
ppRefills->notify(1);
}
void
TLB::printTlb() const
{
int x = 0;
TlbEntry *te;
DPRINTF(TLB, "Current TLB contents:\n");
while (x < size) {
te = &table[x];
if (te->valid)
DPRINTF(TLB, " * %s\n", te->print());
++x;
}
}
void
TLB::flushAllSecurity(bool secure_lookup, ExceptionLevel target_el,
bool ignore_el)
{
DPRINTF(TLB, "Flushing all TLB entries (%s lookup)\n",
(secure_lookup ? "secure" : "non-secure"));
int x = 0;
TlbEntry *te;
while (x < size) {
te = &table[x];
const bool el_match = ignore_el ?
true : te->checkELMatch(target_el);
if (te->valid && secure_lookup == !te->nstid &&
(te->vmid == vmid || secure_lookup) && el_match) {
DPRINTF(TLB, " - %s\n", te->print());
te->valid = false;
flushedEntries++;
}
++x;
}
flushTlb++;
// If there's a second stage TLB (and we're not it) then flush it as well
// if we're currently in hyp mode
if (!isStage2 && isHyp) {
stage2Tlb->flushAllSecurity(secure_lookup, EL1, true);
}
}
void
TLB::flushAllNs(ExceptionLevel target_el, bool ignore_el)
{
bool hyp = target_el == EL2;
DPRINTF(TLB, "Flushing all NS TLB entries (%s lookup)\n",
(hyp ? "hyp" : "non-hyp"));
int x = 0;
TlbEntry *te;
while (x < size) {
te = &table[x];
const bool el_match = ignore_el ?
true : te->checkELMatch(target_el);
if (te->valid && te->nstid && te->isHyp == hyp && el_match) {
DPRINTF(TLB, " - %s\n", te->print());
flushedEntries++;
te->valid = false;
}
++x;
}
flushTlb++;
// If there's a second stage TLB (and we're not it) then flush it as well
if (!isStage2 && !hyp) {
stage2Tlb->flushAllNs(EL1, true);
}
}
void
TLB::flushMvaAsid(Addr mva, uint64_t asn, bool secure_lookup,
ExceptionLevel target_el)
{
DPRINTF(TLB, "Flushing TLB entries with mva: %#x, asid: %#x "
"(%s lookup)\n", mva, asn, (secure_lookup ?
"secure" : "non-secure"));
_flushMva(mva, asn, secure_lookup, false, target_el);
flushTlbMvaAsid++;
}
void
TLB::flushAsid(uint64_t asn, bool secure_lookup, ExceptionLevel target_el)
{
DPRINTF(TLB, "Flushing TLB entries with asid: %#x (%s lookup)\n", asn,
(secure_lookup ? "secure" : "non-secure"));
int x = 0 ;
TlbEntry *te;
while (x < size) {
te = &table[x];
if (te->valid && te->asid == asn && secure_lookup == !te->nstid &&
(te->vmid == vmid || secure_lookup) &&
te->checkELMatch(target_el)) {
te->valid = false;
DPRINTF(TLB, " - %s\n", te->print());
flushedEntries++;
}
++x;
}
flushTlbAsid++;
}
void
TLB::flushMva(Addr mva, bool secure_lookup, ExceptionLevel target_el)
{
DPRINTF(TLB, "Flushing TLB entries with mva: %#x (%s lookup)\n", mva,
(secure_lookup ? "secure" : "non-secure"));
_flushMva(mva, 0xbeef, secure_lookup, true, target_el);
flushTlbMva++;
}
void
TLB::_flushMva(Addr mva, uint64_t asn, bool secure_lookup,
bool ignore_asn, ExceptionLevel target_el)
{
TlbEntry *te;
// D5.7.2: Sign-extend address to 64 bits
mva = sext<56>(mva);
bool hyp = target_el == EL2;
te = lookup(mva, asn, vmid, hyp, secure_lookup, false, ignore_asn,
target_el);
while (te != NULL) {
if (secure_lookup == !te->nstid) {
DPRINTF(TLB, " - %s\n", te->print());
te->valid = false;
flushedEntries++;
}
te = lookup(mva, asn, vmid, hyp, secure_lookup, false, ignore_asn,
target_el);
}
}
void
TLB::flushIpaVmid(Addr ipa, bool secure_lookup, ExceptionLevel target_el)
{
assert(!isStage2);
stage2Tlb->_flushMva(ipa, 0xbeef, secure_lookup, true, target_el);
}
void
TLB::drainResume()
{
// We might have unserialized something or switched CPUs, so make
// sure to re-read the misc regs.
miscRegValid = false;
}
void
TLB::takeOverFrom(BaseTLB *_otlb)
{
TLB *otlb = dynamic_cast<TLB*>(_otlb);
/* Make sure we actually have a valid type */
if (otlb) {
_attr = otlb->_attr;
haveLPAE = otlb->haveLPAE;
directToStage2 = otlb->directToStage2;
stage2Req = otlb->stage2Req;
stage2DescReq = otlb->stage2DescReq;
/* Sync the stage2 MMU if they exist in both
* the old CPU and the new
*/
if (!isStage2 &&
stage2Tlb && otlb->stage2Tlb) {
stage2Tlb->takeOverFrom(otlb->stage2Tlb);
}
} else {
panic("Incompatible TLB type!");
}
}
void
TLB::regStats()
{
BaseTLB::regStats();
instHits
.name(name() + ".inst_hits")
.desc("ITB inst hits")
;
instMisses
.name(name() + ".inst_misses")
.desc("ITB inst misses")
;
instAccesses
.name(name() + ".inst_accesses")
.desc("ITB inst accesses")
;
readHits
.name(name() + ".read_hits")
.desc("DTB read hits")
;
readMisses
.name(name() + ".read_misses")
.desc("DTB read misses")
;
readAccesses
.name(name() + ".read_accesses")
.desc("DTB read accesses")
;
writeHits
.name(name() + ".write_hits")
.desc("DTB write hits")
;
writeMisses
.name(name() + ".write_misses")
.desc("DTB write misses")
;
writeAccesses
.name(name() + ".write_accesses")
.desc("DTB write accesses")
;
hits
.name(name() + ".hits")
.desc("DTB hits")
;
misses
.name(name() + ".misses")
.desc("DTB misses")
;
accesses
.name(name() + ".accesses")
.desc("DTB accesses")
;
flushTlb
.name(name() + ".flush_tlb")
.desc("Number of times complete TLB was flushed")
;
flushTlbMva
.name(name() + ".flush_tlb_mva")
.desc("Number of times TLB was flushed by MVA")
;
flushTlbMvaAsid
.name(name() + ".flush_tlb_mva_asid")
.desc("Number of times TLB was flushed by MVA & ASID")
;
flushTlbAsid
.name(name() + ".flush_tlb_asid")
.desc("Number of times TLB was flushed by ASID")
;
flushedEntries
.name(name() + ".flush_entries")
.desc("Number of entries that have been flushed from TLB")
;
alignFaults
.name(name() + ".align_faults")
.desc("Number of TLB faults due to alignment restrictions")
;
prefetchFaults
.name(name() + ".prefetch_faults")
.desc("Number of TLB faults due to prefetch")
;
domainFaults
.name(name() + ".domain_faults")
.desc("Number of TLB faults due to domain restrictions")
;
permsFaults
.name(name() + ".perms_faults")
.desc("Number of TLB faults due to permissions restrictions")
;
instAccesses = instHits + instMisses;
readAccesses = readHits + readMisses;
writeAccesses = writeHits + writeMisses;
hits = readHits + writeHits + instHits;
misses = readMisses + writeMisses + instMisses;
accesses = readAccesses + writeAccesses + instAccesses;
}
void
TLB::regProbePoints()
{
ppRefills.reset(new ProbePoints::PMU(getProbeManager(), "Refills"));
}
Fault
TLB::translateSe(const RequestPtr &req, ThreadContext *tc, Mode mode,
Translation *translation, bool &delay, bool timing)
{
updateMiscReg(tc);
Addr vaddr_tainted = req->getVaddr();
Addr vaddr = 0;
if (aarch64)
vaddr = purifyTaggedAddr(vaddr_tainted, tc, aarch64EL, (TCR)ttbcr,
mode==Execute);
else
vaddr = vaddr_tainted;
Request::Flags flags = req->getFlags();
bool is_fetch = (mode == Execute);
bool is_write = (mode == Write);
if (!is_fetch) {
if (sctlr.a || !(flags & AllowUnaligned)) {
if (vaddr & mask(flags & AlignmentMask)) {
// LPAE is always disabled in SE mode
return std::make_shared<DataAbort>(
vaddr_tainted,
TlbEntry::DomainType::NoAccess, is_write,
ArmFault::AlignmentFault, isStage2,
ArmFault::VmsaTran);
}
}
}
Addr paddr;
Process *p = tc->getProcessPtr();
if (!p->pTable->translate(vaddr, paddr))
return std::make_shared<GenericPageTableFault>(vaddr_tainted);
req->setPaddr(paddr);
return finalizePhysical(req, tc, mode);
}
Fault
TLB::checkPermissions(TlbEntry *te, const RequestPtr &req, Mode mode)
{
// a data cache maintenance instruction that operates by MVA does
// not generate a Data Abort exeception due to a Permission fault
if (req->isCacheMaintenance()) {
return NoFault;
}
Addr vaddr = req->getVaddr(); // 32-bit don't have to purify
Request::Flags flags = req->getFlags();
bool is_fetch = (mode == Execute);
bool is_write = (mode == Write);
bool is_priv = isPriv && !(flags & UserMode);
// Get the translation type from the actuall table entry
ArmFault::TranMethod tranMethod = te->longDescFormat ? ArmFault::LpaeTran
: ArmFault::VmsaTran;
// If this is the second stage of translation and the request is for a
// stage 1 page table walk then we need to check the HCR.PTW bit. This
// allows us to generate a fault if the request targets an area marked
// as a device or strongly ordered.
if (isStage2 && req->isPTWalk() && hcr.ptw &&
(te->mtype != TlbEntry::MemoryType::Normal)) {
return std::make_shared<DataAbort>(
vaddr, te->domain, is_write,
ArmFault::PermissionLL + te->lookupLevel,
isStage2, tranMethod);
}
// Generate an alignment fault for unaligned data accesses to device or
// strongly ordered memory
if (!is_fetch) {
if (te->mtype != TlbEntry::MemoryType::Normal) {
if (vaddr & mask(flags & AlignmentMask)) {
alignFaults++;
return std::make_shared<DataAbort>(
vaddr, TlbEntry::DomainType::NoAccess, is_write,
ArmFault::AlignmentFault, isStage2,
tranMethod);
}
}
}
if (te->nonCacheable) {
// Prevent prefetching from I/O devices.
if (req->isPrefetch()) {
// Here we can safely use the fault status for the short
// desc. format in all cases
return std::make_shared<PrefetchAbort>(
vaddr, ArmFault::PrefetchUncacheable,
isStage2, tranMethod);
}
}
if (!te->longDescFormat) {
switch ((dacr >> (static_cast<uint8_t>(te->domain) * 2)) & 0x3) {
case 0:
domainFaults++;
DPRINTF(TLB, "TLB Fault: Data abort on domain. DACR: %#x"
" domain: %#x write:%d\n", dacr,
static_cast<uint8_t>(te->domain), is_write);
if (is_fetch) {
// Use PC value instead of vaddr because vaddr might
// be aligned to cache line and should not be the
// address reported in FAR
return std::make_shared<PrefetchAbort>(
req->getPC(),
ArmFault::DomainLL + te->lookupLevel,
isStage2, tranMethod);
} else
return std::make_shared<DataAbort>(
vaddr, te->domain, is_write,
ArmFault::DomainLL + te->lookupLevel,
isStage2, tranMethod);
case 1:
// Continue with permissions check
break;
case 2:
panic("UNPRED domain\n");
case 3:
return NoFault;
}
}
// The 'ap' variable is AP[2:0] or {AP[2,1],1b'0}, i.e. always three bits
uint8_t ap = te->longDescFormat ? te->ap << 1 : te->ap;
uint8_t hap = te->hap;
if (sctlr.afe == 1 || te->longDescFormat)
ap |= 1;
bool abt;
bool isWritable = true;
// If this is a stage 2 access (eg for reading stage 1 page table entries)
// then don't perform the AP permissions check, we stil do the HAP check
// below.
if (isStage2) {
abt = false;
} else {
switch (ap) {
case 0:
DPRINTF(TLB, "Access permissions 0, checking rs:%#x\n",
(int)sctlr.rs);
if (!sctlr.xp) {
switch ((int)sctlr.rs) {
case 2:
abt = is_write;
break;
case 1:
abt = is_write || !is_priv;
break;
case 0:
case 3:
default:
abt = true;
break;
}
} else {
abt = true;
}
break;
case 1:
abt = !is_priv;
break;
case 2:
abt = !is_priv && is_write;
isWritable = is_priv;
break;
case 3:
abt = false;
break;
case 4:
panic("UNPRED premissions\n");
case 5:
abt = !is_priv || is_write;
isWritable = false;
break;
case 6:
case 7:
abt = is_write;
isWritable = false;
break;
default:
panic("Unknown permissions %#x\n", ap);
}
}
bool hapAbt = is_write ? !(hap & 2) : !(hap & 1);
bool xn = te->xn || (isWritable && sctlr.wxn) ||
(ap == 3 && sctlr.uwxn && is_priv);
if (is_fetch && (abt || xn ||
(te->longDescFormat && te->pxn && is_priv) ||
(isSecure && te->ns && scr.sif))) {
permsFaults++;
DPRINTF(TLB, "TLB Fault: Prefetch abort on permission check. AP:%d "
"priv:%d write:%d ns:%d sif:%d sctlr.afe: %d \n",
ap, is_priv, is_write, te->ns, scr.sif,sctlr.afe);
// Use PC value instead of vaddr because vaddr might be aligned to
// cache line and should not be the address reported in FAR
return std::make_shared<PrefetchAbort>(
req->getPC(),
ArmFault::PermissionLL + te->lookupLevel,
isStage2, tranMethod);
} else if (abt | hapAbt) {
permsFaults++;
DPRINTF(TLB, "TLB Fault: Data abort on permission check. AP:%d priv:%d"
" write:%d\n", ap, is_priv, is_write);
return std::make_shared<DataAbort>(
vaddr, te->domain, is_write,
ArmFault::PermissionLL + te->lookupLevel,
isStage2 | !abt, tranMethod);
}
return NoFault;
}
Fault
TLB::checkPermissions64(TlbEntry *te, const RequestPtr &req, Mode mode,
ThreadContext *tc)
{
assert(aarch64);
// A data cache maintenance instruction that operates by VA does
// not generate a Permission fault unless:
// * It is a data cache invalidate (dc ivac) which requires write
// permissions to the VA, or
// * It is executed from EL0
if (req->isCacheClean() && aarch64EL != EL0 && !isStage2) {
return NoFault;
}
Addr vaddr_tainted = req->getVaddr();
Addr vaddr = purifyTaggedAddr(vaddr_tainted, tc, aarch64EL, (TCR)ttbcr,
mode==Execute);
Request::Flags flags = req->getFlags();
bool is_fetch = (mode == Execute);
// Cache clean operations require read permissions to the specified VA
bool is_write = !req->isCacheClean() && mode == Write;
bool is_atomic = req->isAtomic();
bool is_priv M5_VAR_USED = isPriv && !(flags & UserMode);
updateMiscReg(tc, curTranType);
// If this is the second stage of translation and the request is for a
// stage 1 page table walk then we need to check the HCR.PTW bit. This
// allows us to generate a fault if the request targets an area marked
// as a device or strongly ordered.
if (isStage2 && req->isPTWalk() && hcr.ptw &&
(te->mtype != TlbEntry::MemoryType::Normal)) {
return std::make_shared<DataAbort>(
vaddr_tainted, te->domain, is_write,
ArmFault::PermissionLL + te->lookupLevel,
isStage2, ArmFault::LpaeTran);
}
// Generate an alignment fault for unaligned accesses to device or
// strongly ordered memory
if (!is_fetch) {
if (te->mtype != TlbEntry::MemoryType::Normal) {
if (vaddr & mask(flags & AlignmentMask)) {
alignFaults++;
return std::make_shared<DataAbort>(
vaddr_tainted,
TlbEntry::DomainType::NoAccess,
is_atomic ? false : is_write,
ArmFault::AlignmentFault, isStage2,
ArmFault::LpaeTran);
}
}
}
if (te->nonCacheable) {
// Prevent prefetching from I/O devices.
if (req->isPrefetch()) {
// Here we can safely use the fault status for the short
// desc. format in all cases
return std::make_shared<PrefetchAbort>(
vaddr_tainted,
ArmFault::PrefetchUncacheable,
isStage2, ArmFault::LpaeTran);
}
}
uint8_t ap = 0x3 & (te->ap); // 2-bit access protection field
bool grant = false;
uint8_t xn = te->xn;
uint8_t pxn = te->pxn;
bool r = !is_write && !is_fetch;
bool w = is_write;
bool x = is_fetch;
// grant_read is used for faults from an atomic instruction that
// both reads and writes from a memory location. From a ISS point
// of view they count as read if a read to that address would have
// generated the fault; they count as writes otherwise
bool grant_read = true;
DPRINTF(TLBVerbose, "Checking permissions: ap:%d, xn:%d, pxn:%d, r:%d, "
"w:%d, x:%d\n", ap, xn, pxn, r, w, x);
if (isStage2) {
assert(ArmSystem::haveVirtualization(tc) && aarch64EL != EL2);
// In stage 2 we use the hypervisor access permission bits.
// The following permissions are described in ARM DDI 0487A.f
// D4-1802
uint8_t hap = 0x3 & te->hap;
grant_read = hap & 0x1;
if (is_fetch) {
// sctlr.wxn overrides the xn bit
grant = !sctlr.wxn && !xn;
} else if (is_write) {
grant = hap & 0x2;
} else { // is_read
grant = grant_read;
}
} else {
switch (aarch64EL) {
case EL0:
{
grant_read = ap & 0x1;
uint8_t perm = (ap << 2) | (xn << 1) | pxn;
switch (perm) {
case 0:
case 1:
case 8:
case 9:
grant = x;
break;
case 4:
case 5:
grant = r || w || (x && !sctlr.wxn);
break;
case 6:
case 7:
grant = r || w;
break;
case 12:
case 13:
grant = r || x;
break;
case 14:
case 15:
grant = r;
break;
default:
grant = false;
}
}
break;
case EL1:
{
if (checkPAN(tc, ap, req, mode)) {
grant = false;
grant_read = false;
break;
}
uint8_t perm = (ap << 2) | (xn << 1) | pxn;
switch (perm) {
case 0:
case 2:
grant = r || w || (x && !sctlr.wxn);
break;
case 1:
case 3:
case 4:
case 5:
case 6:
case 7:
// regions that are writeable at EL0 should not be
// executable at EL1
grant = r || w;
break;
case 8:
case 10:
case 12:
case 14:
grant = r || x;
break;
case 9:
case 11:
case 13:
case 15:
grant = r;
break;
default:
grant = false;
}
}
break;
case EL2:
if (hcr.e2h && checkPAN(tc, ap, req, mode)) {
grant = false;
grant_read = false;
break;
}
M5_FALLTHROUGH;
case EL3:
{
uint8_t perm = (ap & 0x2) | xn;
switch (perm) {
case 0:
grant = r || w || (x && !sctlr.wxn) ;
break;
case 1:
grant = r || w;
break;
case 2:
grant = r || x;
break;
case 3:
grant = r;
break;
default:
grant = false;
}
}
break;
}
}
if (!grant) {
if (is_fetch) {
permsFaults++;
DPRINTF(TLB, "TLB Fault: Prefetch abort on permission check. "
"AP:%d priv:%d write:%d ns:%d sif:%d "
"sctlr.afe: %d\n",
ap, is_priv, is_write, te->ns, scr.sif, sctlr.afe);
// Use PC value instead of vaddr because vaddr might be aligned to
// cache line and should not be the address reported in FAR
return std::make_shared<PrefetchAbort>(
req->getPC(),
ArmFault::PermissionLL + te->lookupLevel,
isStage2, ArmFault::LpaeTran);
} else {
permsFaults++;
DPRINTF(TLB, "TLB Fault: Data abort on permission check. AP:%d "
"priv:%d write:%d\n", ap, is_priv, is_write);
return std::make_shared<DataAbort>(
vaddr_tainted, te->domain,
(is_atomic && !grant_read) ? false : is_write,
ArmFault::PermissionLL + te->lookupLevel,
isStage2, ArmFault::LpaeTran);
}
}
return NoFault;
}
bool
TLB::checkPAN(ThreadContext *tc, uint8_t ap, const RequestPtr &req, Mode mode)
{
// The PAN bit has no effect on:
// 1) Instruction accesses.
// 2) Data Cache instructions other than DC ZVA
// 3) Address translation instructions, other than ATS1E1RP and
// ATS1E1WP when ARMv8.2-ATS1E1 is implemented. (Unimplemented in
// gem5)
// 4) Unprivileged instructions (Unimplemented in gem5)
AA64MMFR1 mmfr1 = tc->readMiscReg(MISCREG_ID_AA64MMFR1_EL1);
if (mmfr1.pan && cpsr.pan && (ap & 0x1) && mode != Execute &&
(!req->isCacheMaintenance() ||
(req->getFlags() & Request::CACHE_BLOCK_ZERO))) {
return true;
} else {
return false;
}
}
Fault
TLB::translateMmuOff(ThreadContext *tc, const RequestPtr &req, Mode mode,
TLB::ArmTranslationType tranType, Addr vaddr, bool long_desc_format)
{
bool is_fetch = (mode == Execute);
req->setPaddr(vaddr);
// When the MMU is off the security attribute corresponds to the
// security state of the processor
if (isSecure)
req->setFlags(Request::SECURE);
// @todo: double check this (ARM ARM issue C B3.2.1)
if (long_desc_format || sctlr.tre == 0 || nmrr.ir0 == 0 ||
nmrr.or0 == 0 || prrr.tr0 != 0x2) {
if (!req->isCacheMaintenance()) {
req->setFlags(Request::UNCACHEABLE);
}
req->setFlags(Request::STRICT_ORDER);
}
// Set memory attributes
TlbEntry temp_te;
temp_te.ns = !isSecure;
if (isStage2 || hcr.dc == 0 || isSecure ||
(isHyp && !(tranType & S1CTran))) {
temp_te.mtype = is_fetch ? TlbEntry::MemoryType::Normal
: TlbEntry::MemoryType::StronglyOrdered;
temp_te.innerAttrs = 0x0;
temp_te.outerAttrs = 0x0;
temp_te.shareable = true;
temp_te.outerShareable = true;
} else {
temp_te.mtype = TlbEntry::MemoryType::Normal;
temp_te.innerAttrs = 0x3;
temp_te.outerAttrs = 0x3;
temp_te.shareable = false;
temp_te.outerShareable = false;
}
temp_te.setAttributes(long_desc_format);
DPRINTF(TLBVerbose, "(No MMU) setting memory attributes: shareable: "
"%d, innerAttrs: %d, outerAttrs: %d, isStage2: %d\n",
temp_te.shareable, temp_te.innerAttrs, temp_te.outerAttrs,
isStage2);
setAttr(temp_te.attributes);
return testTranslation(req, mode, TlbEntry::DomainType::NoAccess);
}
Fault
TLB::translateMmuOn(ThreadContext* tc, const RequestPtr &req, Mode mode,
Translation *translation, bool &delay, bool timing,
bool functional, Addr vaddr,
ArmFault::TranMethod tranMethod)
{
TlbEntry *te = NULL;
bool is_fetch = (mode == Execute);
TlbEntry mergeTe;
Request::Flags flags = req->getFlags();
Addr vaddr_tainted = req->getVaddr();
Fault fault = getResultTe(&te, req, tc, mode, translation, timing,
functional, &mergeTe);
// only proceed if we have a valid table entry
if ((te == NULL) && (fault == NoFault)) delay = true;
// If we have the table entry transfer some of the attributes to the
// request that triggered the translation
if (te != NULL) {
// Set memory attributes
DPRINTF(TLBVerbose,
"Setting memory attributes: shareable: %d, innerAttrs: %d, "
"outerAttrs: %d, mtype: %d, isStage2: %d\n",
te->shareable, te->innerAttrs, te->outerAttrs,
static_cast<uint8_t>(te->mtype), isStage2);
setAttr(te->attributes);
if (te->nonCacheable && !req->isCacheMaintenance())
req->setFlags(Request::UNCACHEABLE);
// Require requests to be ordered if the request goes to
// strongly ordered or device memory (i.e., anything other
// than normal memory requires strict order).
if (te->mtype != TlbEntry::MemoryType::Normal)
req->setFlags(Request::STRICT_ORDER);
Addr pa = te->pAddr(vaddr);
req->setPaddr(pa);
if (isSecure && !te->ns) {
req->setFlags(Request::SECURE);
}
if ((!is_fetch) && (vaddr & mask(flags & AlignmentMask)) &&
(te->mtype != TlbEntry::MemoryType::Normal)) {
// Unaligned accesses to Device memory should always cause an
// abort regardless of sctlr.a
alignFaults++;
bool is_write = (mode == Write);
return std::make_shared<DataAbort>(
vaddr_tainted,
TlbEntry::DomainType::NoAccess, is_write,
ArmFault::AlignmentFault, isStage2,
tranMethod);
}
// Check for a trickbox generated address fault
if (fault == NoFault)
fault = testTranslation(req, mode, te->domain);
}
if (fault == NoFault) {
// Don't try to finalize a physical address unless the
// translation has completed (i.e., there is a table entry).
return te ? finalizePhysical(req, tc, mode) : NoFault;
} else {
return fault;
}
}
Fault
TLB::translateFs(const RequestPtr &req, ThreadContext *tc, Mode mode,
Translation *translation, bool &delay, bool timing,
TLB::ArmTranslationType tranType, bool functional)
{
// No such thing as a functional timing access
assert(!(timing && functional));
updateMiscReg(tc, tranType);
Addr vaddr_tainted = req->getVaddr();
Addr vaddr = 0;
if (aarch64)
vaddr = purifyTaggedAddr(vaddr_tainted, tc, aarch64EL, (TCR)ttbcr,
mode==Execute);
else
vaddr = vaddr_tainted;
Request::Flags flags = req->getFlags();
bool is_fetch = (mode == Execute);
bool is_write = (mode == Write);
bool long_desc_format = aarch64 || longDescFormatInUse(tc);
ArmFault::TranMethod tranMethod = long_desc_format ? ArmFault::LpaeTran
: ArmFault::VmsaTran;
DPRINTF(TLBVerbose,
"CPSR is priv:%d UserMode:%d secure:%d S1S2NsTran:%d\n",
isPriv, flags & UserMode, isSecure, tranType & S1S2NsTran);
DPRINTF(TLB, "translateFs addr %#x, mode %d, st2 %d, scr %#x sctlr %#x "
"flags %#lx tranType 0x%x\n", vaddr_tainted, mode, isStage2,
scr, sctlr, flags, tranType);
if ((req->isInstFetch() && (!sctlr.i)) ||
((!req->isInstFetch()) && (!sctlr.c))){
if (!req->isCacheMaintenance()) {
req->setFlags(Request::UNCACHEABLE);
}
req->setFlags(Request::STRICT_ORDER);
}
if (!is_fetch) {
if (sctlr.a || !(flags & AllowUnaligned)) {
if (vaddr & mask(flags & AlignmentMask)) {
alignFaults++;
return std::make_shared<DataAbort>(
vaddr_tainted,
TlbEntry::DomainType::NoAccess, is_write,
ArmFault::AlignmentFault, isStage2,
tranMethod);
}
}
}
// If guest MMU is off or hcr.vm=0 go straight to stage2
if ((isStage2 && !hcr.vm) || (!isStage2 && !sctlr.m)) {
return translateMmuOff(tc, req, mode, tranType, vaddr,
long_desc_format);
} else {
DPRINTF(TLBVerbose, "Translating %s=%#x context=%d\n",
isStage2 ? "IPA" : "VA", vaddr_tainted, asid);
// Translation enabled
return translateMmuOn(tc, req, mode, translation, delay, timing,
functional, vaddr, tranMethod);
}
}
Fault
TLB::translateAtomic(const RequestPtr &req, ThreadContext *tc, Mode mode,
TLB::ArmTranslationType tranType)
{
updateMiscReg(tc, tranType);
if (directToStage2) {
assert(stage2Tlb);
return stage2Tlb->translateAtomic(req, tc, mode, tranType);
}
bool delay = false;
Fault fault;
if (FullSystem)
fault = translateFs(req, tc, mode, NULL, delay, false, tranType);
else
fault = translateSe(req, tc, mode, NULL, delay, false);
assert(!delay);
return fault;
}
Fault
TLB::translateFunctional(const RequestPtr &req, ThreadContext *tc, Mode mode,
TLB::ArmTranslationType tranType)
{
updateMiscReg(tc, tranType);
if (directToStage2) {
assert(stage2Tlb);
return stage2Tlb->translateFunctional(req, tc, mode, tranType);
}
bool delay = false;
Fault fault;
if (FullSystem)
fault = translateFs(req, tc, mode, NULL, delay, false, tranType, true);
else
fault = translateSe(req, tc, mode, NULL, delay, false);
assert(!delay);
return fault;
}
void
TLB::translateTiming(const RequestPtr &req, ThreadContext *tc,
Translation *translation, Mode mode, TLB::ArmTranslationType tranType)
{
updateMiscReg(tc, tranType);
if (directToStage2) {
assert(stage2Tlb);
stage2Tlb->translateTiming(req, tc, translation, mode, tranType);
return;
}
assert(translation);
translateComplete(req, tc, translation, mode, tranType, isStage2);
}
Fault
TLB::translateComplete(const RequestPtr &req, ThreadContext *tc,
Translation *translation, Mode mode, TLB::ArmTranslationType tranType,
bool callFromS2)
{
bool delay = false;
Fault fault;
if (FullSystem)
fault = translateFs(req, tc, mode, translation, delay, true, tranType);
else
fault = translateSe(req, tc, mode, translation, delay, true);
DPRINTF(TLBVerbose, "Translation returning delay=%d fault=%d\n", delay, fault !=
NoFault);
// If we have a translation, and we're not in the middle of doing a stage
// 2 translation tell the translation that we've either finished or its
// going to take a while. By not doing this when we're in the middle of a
// stage 2 translation we prevent marking the translation as delayed twice,
// one when the translation starts and again when the stage 1 translation
// completes.
if (translation && (callFromS2 || !stage2Req || req->hasPaddr() || fault != NoFault)) {
if (!delay)
translation->finish(fault, req, tc, mode);
else
translation->markDelayed();
}
return fault;
}
Port *
TLB::getTableWalkerPort()
{
return &stage2Mmu->getDMAPort();
}
void
TLB::updateMiscReg(ThreadContext *tc, ArmTranslationType tranType)
{
// check if the regs have changed, or the translation mode is different.
// NOTE: the tran type doesn't affect stage 2 TLB's as they only handle
// one type of translation anyway
if (miscRegValid && miscRegContext == tc->contextId() &&
((tranType == curTranType) || isStage2)) {
return;
}
DPRINTF(TLBVerbose, "TLB variables changed!\n");
cpsr = tc->readMiscReg(MISCREG_CPSR);
// Dependencies: SCR/SCR_EL3, CPSR
isSecure = inSecureState(tc) &&
!(tranType & HypMode) && !(tranType & S1S2NsTran);
aarch64EL = tranTypeEL(cpsr, tranType);
aarch64 = isStage2 ?
ELIs64(tc, EL2) :
ELIs64(tc, aarch64EL == EL0 ? EL1 : aarch64EL);
if (aarch64) { // AArch64
// determine EL we need to translate in
switch (aarch64EL) {
case EL0:
case EL1:
{
sctlr = tc->readMiscReg(MISCREG_SCTLR_EL1);
ttbcr = tc->readMiscReg(MISCREG_TCR_EL1);
uint64_t ttbr_asid = ttbcr.a1 ?
tc->readMiscReg(MISCREG_TTBR1_EL1) :
tc->readMiscReg(MISCREG_TTBR0_EL1);
asid = bits(ttbr_asid,
(haveLargeAsid64 && ttbcr.as) ? 63 : 55, 48);
}
break;
case EL2:
sctlr = tc->readMiscReg(MISCREG_SCTLR_EL2);
ttbcr = tc->readMiscReg(MISCREG_TCR_EL2);
asid = -1;
break;
case EL3:
sctlr = tc->readMiscReg(MISCREG_SCTLR_EL3);
ttbcr = tc->readMiscReg(MISCREG_TCR_EL3);
asid = -1;
break;
}
hcr = tc->readMiscReg(MISCREG_HCR_EL2);
scr = tc->readMiscReg(MISCREG_SCR_EL3);
isPriv = aarch64EL != EL0;
if (haveVirtualization) {
vmid = bits(tc->readMiscReg(MISCREG_VTTBR_EL2), 55, 48);
isHyp = aarch64EL == EL2;
isHyp |= tranType & HypMode;
isHyp &= (tranType & S1S2NsTran) == 0;
isHyp &= (tranType & S1CTran) == 0;
// Work out if we should skip the first stage of translation and go
// directly to stage 2. This value is cached so we don't have to
// compute it for every translation.
stage2Req = isStage2 ||
(hcr.vm && !isHyp && !isSecure &&
!(tranType & S1CTran) && (aarch64EL < EL2) &&
!(tranType & S1E1Tran)); // <--- FIX THIS HACK
stage2DescReq = isStage2 || (hcr.vm && !isHyp && !isSecure &&
(aarch64EL < EL2));
directToStage2 = !isStage2 && stage2Req && !sctlr.m;
} else {
vmid = 0;
isHyp = false;
directToStage2 = false;
stage2Req = false;
stage2DescReq = false;
}
} else { // AArch32
sctlr = tc->readMiscReg(snsBankedIndex(MISCREG_SCTLR, tc,
!isSecure));
ttbcr = tc->readMiscReg(snsBankedIndex(MISCREG_TTBCR, tc,
!isSecure));
scr = tc->readMiscReg(MISCREG_SCR);
isPriv = cpsr.mode != MODE_USER;
if (longDescFormatInUse(tc)) {
uint64_t ttbr_asid = tc->readMiscReg(
snsBankedIndex(ttbcr.a1 ? MISCREG_TTBR1 :
MISCREG_TTBR0,
tc, !isSecure));
asid = bits(ttbr_asid, 55, 48);
} else { // Short-descriptor translation table format in use
CONTEXTIDR context_id = tc->readMiscReg(snsBankedIndex(
MISCREG_CONTEXTIDR, tc,!isSecure));
asid = context_id.asid;
}
prrr = tc->readMiscReg(snsBankedIndex(MISCREG_PRRR, tc,
!isSecure));
nmrr = tc->readMiscReg(snsBankedIndex(MISCREG_NMRR, tc,
!isSecure));
dacr = tc->readMiscReg(snsBankedIndex(MISCREG_DACR, tc,
!isSecure));
hcr = tc->readMiscReg(MISCREG_HCR);
if (haveVirtualization) {
vmid = bits(tc->readMiscReg(MISCREG_VTTBR), 55, 48);
isHyp = cpsr.mode == MODE_HYP;
isHyp |= tranType & HypMode;
isHyp &= (tranType & S1S2NsTran) == 0;
isHyp &= (tranType & S1CTran) == 0;
if (isHyp) {
sctlr = tc->readMiscReg(MISCREG_HSCTLR);
}
// Work out if we should skip the first stage of translation and go
// directly to stage 2. This value is cached so we don't have to
// compute it for every translation.
stage2Req = hcr.vm && !isStage2 && !isHyp && !isSecure &&
!(tranType & S1CTran);
stage2DescReq = hcr.vm && !isStage2 && !isHyp && !isSecure;
directToStage2 = stage2Req && !sctlr.m;
} else {
vmid = 0;
stage2Req = false;
isHyp = false;
directToStage2 = false;
stage2DescReq = false;
}
}
miscRegValid = true;
miscRegContext = tc->contextId();
curTranType = tranType;
}
ExceptionLevel
TLB::tranTypeEL(CPSR cpsr, ArmTranslationType type)
{
switch (type) {
case S1E0Tran:
case S12E0Tran:
return EL0;
case S1E1Tran:
case S12E1Tran:
return EL1;
case S1E2Tran:
return EL2;
case S1E3Tran:
return EL3;
case NormalTran:
case S1CTran:
case S1S2NsTran:
case HypMode:
return currEL(cpsr);
default:
panic("Unknown translation mode!\n");
}
}
Fault
TLB::getTE(TlbEntry **te, const RequestPtr &req, ThreadContext *tc, Mode mode,
Translation *translation, bool timing, bool functional,
bool is_secure, TLB::ArmTranslationType tranType)
{
// In a 2-stage system, the IPA->PA translation can be started via this
// call so make sure the miscRegs are correct.
if (isStage2) {
updateMiscReg(tc, tranType);
}
bool is_fetch = (mode == Execute);
bool is_write = (mode == Write);
Addr vaddr_tainted = req->getVaddr();
Addr vaddr = 0;
ExceptionLevel target_el = aarch64 ? aarch64EL : EL1;
if (aarch64) {
vaddr = purifyTaggedAddr(vaddr_tainted, tc, target_el, (TCR)ttbcr,
mode==Execute);
} else {
vaddr = vaddr_tainted;
}
*te = lookup(vaddr, asid, vmid, isHyp, is_secure, false, false, target_el);
if (*te == NULL) {
if (req->isPrefetch()) {
// if the request is a prefetch don't attempt to fill the TLB or go
// any further with the memory access (here we can safely use the
// fault status for the short desc. format in all cases)
prefetchFaults++;
return std::make_shared<PrefetchAbort>(
vaddr_tainted, ArmFault::PrefetchTLBMiss, isStage2);
}
if (is_fetch)
instMisses++;
else if (is_write)
writeMisses++;
else
readMisses++;
// start translation table walk, pass variables rather than
// re-retreaving in table walker for speed
DPRINTF(TLB, "TLB Miss: Starting hardware table walker for %#x(%d:%d)\n",
vaddr_tainted, asid, vmid);
Fault fault;
fault = tableWalker->walk(req, tc, asid, vmid, isHyp, mode,
translation, timing, functional, is_secure,
tranType, stage2DescReq);
// for timing mode, return and wait for table walk,
if (timing || fault != NoFault) {
return fault;
}
*te = lookup(vaddr, asid, vmid, isHyp, is_secure, false, false, target_el);
if (!*te)
printTlb();
assert(*te);
} else {
if (is_fetch)
instHits++;
else if (is_write)
writeHits++;
else
readHits++;
}
return NoFault;
}
Fault
TLB::getResultTe(TlbEntry **te, const RequestPtr &req,
ThreadContext *tc, Mode mode,
Translation *translation, bool timing, bool functional,
TlbEntry *mergeTe)
{
Fault fault;
if (isStage2) {
// We are already in the stage 2 TLB. Grab the table entry for stage
// 2 only. We are here because stage 1 translation is disabled.
TlbEntry *s2Te = NULL;
// Get the stage 2 table entry
fault = getTE(&s2Te, req, tc, mode, translation, timing, functional,
isSecure, curTranType);
// Check permissions of stage 2
if ((s2Te != NULL) && (fault == NoFault)) {
if (aarch64)
fault = checkPermissions64(s2Te, req, mode, tc);
else
fault = checkPermissions(s2Te, req, mode);
}
*te = s2Te;
return fault;
}
TlbEntry *s1Te = NULL;
Addr vaddr_tainted = req->getVaddr();
// Get the stage 1 table entry
fault = getTE(&s1Te, req, tc, mode, translation, timing, functional,
isSecure, curTranType);
// only proceed if we have a valid table entry
if ((s1Te != NULL) && (fault == NoFault)) {
// Check stage 1 permissions before checking stage 2
if (aarch64)
fault = checkPermissions64(s1Te, req, mode, tc);
else
fault = checkPermissions(s1Te, req, mode);
if (stage2Req & (fault == NoFault)) {
Stage2LookUp *s2Lookup = new Stage2LookUp(this, stage2Tlb, *s1Te,
req, translation, mode, timing, functional, curTranType);
fault = s2Lookup->getTe(tc, mergeTe);
if (s2Lookup->isComplete()) {
*te = mergeTe;
// We've finished with the lookup so delete it
delete s2Lookup;
} else {
// The lookup hasn't completed, so we can't delete it now. We
// get round this by asking the object to self delete when the
// translation is complete.
s2Lookup->setSelfDelete();
}
} else {
// This case deals with an S1 hit (or bypass), followed by
// an S2 hit-but-perms issue
if (isStage2) {
DPRINTF(TLBVerbose, "s2TLB: reqVa %#x, reqPa %#x, fault %p\n",
vaddr_tainted, req->hasPaddr() ? req->getPaddr() : ~0, fault);
if (fault != NoFault) {
ArmFault *armFault = reinterpret_cast<ArmFault *>(fault.get());
armFault->annotate(ArmFault::S1PTW, false);
armFault->annotate(ArmFault::OVA, vaddr_tainted);
}
}
*te = s1Te;
}
}
return fault;
}
void
TLB::setTestInterface(SimObject *_ti)
{
if (!_ti) {
test = nullptr;
} else {
TlbTestInterface *ti(dynamic_cast<TlbTestInterface *>(_ti));
fatal_if(!ti, "%s is not a valid ARM TLB tester\n", _ti->name());
test = ti;
}
}
Fault
TLB::testTranslation(const RequestPtr &req, Mode mode,
TlbEntry::DomainType domain)
{
if (!test || !req->hasSize() || req->getSize() == 0 ||
req->isCacheMaintenance()) {
return NoFault;
} else {
return test->translationCheck(req, isPriv, mode, domain);
}
}
Fault
TLB::testWalk(Addr pa, Addr size, Addr va, bool is_secure, Mode mode,
TlbEntry::DomainType domain, LookupLevel lookup_level)
{
if (!test) {
return NoFault;
} else {
return test->walkCheck(pa, size, va, is_secure, isPriv, mode,
domain, lookup_level);
}
}
ArmISA::TLB *
ArmTLBParams::create()
{
return new ArmISA::TLB(this);
}
| {
"pile_set_name": "Github"
} |
/*
Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd)
Copyright (C) 2014 Bad Juju Games, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Contact us at [email protected].
*/
#include "Common.h"
#include "UploadProgPage.h"
#include "UploadForm.h"
#include "MainApp.h"
#include "Managers.h"
///////////////////////////////////////////////////////////////////////////////
/// Class UploadProgPage
///////////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( UploadProgPage, BasePage )
EVT_BUTTON( wxID_ANY, UploadProgPage::onButClick )
EVT_CHECKBOX( wxID_ANY, UploadProgPage::onChecked )
END_EVENT_TABLE()
UploadProgPage::UploadProgPage(wxWindow* parent)
: BasePage(parent, wxID_ANY, wxDefaultPosition, wxSize( 400,100 ), wxTAB_TRAVERSAL)
, m_llTotalUpload(0)
{
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 5, 1, 0, 0 );
fgSizer1->AddGrowableCol( 0 );
fgSizer1->AddGrowableRow( 3 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
m_staticText3 = new gcStaticText( this, wxID_ANY, Managers::GetString(L"#UDF_ETIME"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
bSizer5->Add( m_staticText3, 0, wxALIGN_BOTTOM|wxTOP|wxRIGHT|wxLEFT, 5 );
m_labTimeLeft = new gcStaticText( this, wxID_ANY, Managers::GetString(L"#UDF_NOTSTARTED"), wxDefaultPosition, wxDefaultSize, 0 );
m_labTimeLeft->Wrap( -1 );
bSizer5->Add( m_labTimeLeft, 0, wxALIGN_BOTTOM|wxTOP|wxRIGHT, 5 );
m_pbProgress = new gcULProgressBar( this, wxID_ANY );
m_cbDeleteMcf = new gcCheckBox( this, wxID_ANY, Managers::GetString(L"#UDF_DELETE"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbDeleteMcf->SetValue( true );
m_cbDeleteMcf->SetToolTip( Managers::GetString(L"#UDF_DELETE_TOOLTIP") );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
bSizer4->Add( 0, 0, 1, wxEXPAND, 5 );
m_butPause = new gcButton( this, wxID_ANY, Managers::GetString(L"#PAUSE"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_butPause, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
m_butCancel = new gcButton( this, wxID_ANY, Managers::GetString(L"#CANCEL"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_butCancel, 0, wxALL, 5 );
fgSizer1->Add( bSizer5, 1, wxEXPAND, 5 );
fgSizer1->Add( m_pbProgress, 0, wxALL|wxEXPAND, 5 );
fgSizer1->Add( m_cbDeleteMcf, 0, wxLEFT|wxEXPAND, 5);
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( bSizer4, 1, wxEXPAND, 5 );
this->SetSizer( fgSizer1 );
this->Layout();
m_bDone = false;
gcFrame* par = dynamic_cast<gcFrame*>(GetParent());
if (par)
par->setProgressState(gcFrame::P_NORMAL);
}
UploadProgPage::~UploadProgPage()
{
dispose();
}
void UploadProgPage::dispose()
{
if (!GetUploadMng())
return;
auto info = GetUploadMng()->findItem(m_uiUploadHash);
if (info)
{
info->getActionEvent() -= guiDelegate(this, &UploadProgPage::onAction);
info->getUploadProgressEvent() -= guiDelegate(this, &UploadProgPage::onProgress);
info->getErrorEvent() -= guiDelegate(this, &UploadProgPage::onError);
info->getCompleteEvent() -= guiDelegate(this, &UploadProgPage::onComplete);
}
}
void UploadProgPage::setInfo(DesuraId id, gcRefPtr<UserCore::Item::ItemInfoI> pItemInfo, uint32 hash, uint32 start)
{
BasePage::setInfo(id, pItemInfo);
m_iStart = start;
m_uiUploadHash = hash;
}
void UploadProgPage::run()
{
if (!GetUploadMng())
return;
auto info = GetUploadMng()->findItem(m_uiUploadHash);
gcAssert(info);
info->getActionEvent() += guiDelegate(this, &UploadProgPage::onAction);
info->getUploadProgressEvent() += guiDelegate(this, &UploadProgPage::onProgress);
info->getErrorEvent() += guiDelegate(this, &UploadProgPage::onError);
info->getCompleteEvent() += guiDelegate(this, &UploadProgPage::onComplete);
info->setStart(m_iStart);
if (info->isPaused())
info->unpause();
info->start();
m_cbDeleteMcf->SetValue(info->shouldDelMcf());
}
void UploadProgPage::onButClick( wxCommandEvent& event )
{
auto info = GetUploadMng()->findItem(m_uiUploadHash);
gcAssert(info);
if (event.GetId() == m_butPause->GetId())
{
if (info->isPaused())
info->unpause();
else
info->pause();
}
else if (event.GetId() == m_butCancel->GetId())
{
if (!info->isPaused())
{
GetUploadMng()->removeUpload(info->getKey());
UTIL::FS::delFile(info->getFile());
}
UploadMCFForm* temp = dynamic_cast<UploadMCFForm*>(GetParent());
if (temp)
temp->setTrueClose();
GetParent()->Close();
}
else
{
event.Skip();
}
}
void UploadProgPage::onChecked(wxCommandEvent& event)
{
if (!GetUploadMng())
return;
auto info = GetUploadMng()->findItem(m_uiUploadHash);
gcAssert(info);
info->setDelMcf(m_cbDeleteMcf->GetValue());
}
void UploadProgPage::onAction()
{
auto info = GetUploadMng()->findItem(m_uiUploadHash);
gcFrame* par = dynamic_cast<gcFrame*>(GetParent());
if (!info->isPaused())
{
m_butPause->SetLabel(Managers::GetString(L"#PAUSE"));
m_butCancel->SetLabel(Managers::GetString(L"#CANCEL"));
if (par)
par->setProgressState(gcFrame::P_NORMAL);
}
else
{
m_butPause->SetLabel(Managers::GetString(L"#RESUME"));
m_butCancel->SetLabel(Managers::GetString(L"#CLOSE"));
if (par)
par->setProgressState(gcFrame::P_PAUSED);
}
m_cbDeleteMcf->SetValue(info->shouldDelMcf());
Refresh();
m_cbDeleteMcf->Refresh();
}
void UploadProgPage::onComplete(uint32& status)
{
gcFrame* par = dynamic_cast<gcFrame*>(GetParent());
if (par)
par->setProgressState(gcFrame::P_NONE);
UploadMCFForm* temp = dynamic_cast<UploadMCFForm*>(GetParent());
if (temp)
temp->setTrueClose();
std::string done = UTIL::MISC::niceSizeStr(m_llTotalUpload, true);
std::string total = UTIL::MISC::niceSizeStr(m_llTotalUpload);
m_pbProgress->setCaption(gcString(Managers::GetString("#PROGRESS_INFO"), done, total));
m_pbProgress->setProgress(100);
m_pbProgress->setMileStone();
m_staticText3->SetLabel(Managers::GetString(L"#UDF_COMPLETE"));
m_labTimeLeft->SetLabel(wxT(""));
m_butPause->Enable(false);
m_butCancel->SetLabel(Managers::GetString(L"#CLOSE"));
m_bDone = true;
this->Show();
}
void UploadProgPage::onError(gcException& e)
{
gcFrame* par = dynamic_cast<gcFrame*>(GetParent());
if (par)
par->setProgressState(gcFrame::P_ERROR);
gcErrorBox(GetParent(), "#UDF_ERRTITLE", "#UDF_ERROR", e);
if (GetUploadMng())
{
auto info = GetUploadMng()->findItem(m_uiUploadHash);
if (info)
info->nonBlockStop();
}
UploadMCFForm* temp = dynamic_cast<UploadMCFForm*>(GetParent());
if (temp)
temp->setTrueClose();
GetParent()->Close();
}
void UploadProgPage::onProgress(UserCore::Misc::UploadInfo& info)
{
if (info.milestone)
{
m_pbProgress->setMileStone();
m_pbProgress->Update();
#ifdef NIX
Refresh(false);
#endif
return;
}
m_llTotalUpload = info.totalAmmount;
std::string done = UTIL::MISC::niceSizeStr(info.doneAmmount, true);
std::string total = UTIL::MISC::niceSizeStr(info.totalAmmount);
m_pbProgress->setCaption(gcString(Managers::GetString("#PROGRESS_INFO"), done, total));
if (info.paused)
{
m_labTimeLeft->SetLabel(Managers::GetString(L"#UDF_UNKNOWNPAUSE"));
m_pbProgress->revertMileStone();
return;
}
std::string lab = UTIL::MISC::genTimeString(info.hour, info.min, info.rate);
m_labTimeLeft->SetLabel(lab);
m_pbProgress->setProgress(info.percent);
gcFrame* par = dynamic_cast<gcFrame*>(GetParent());
if (par)
par->setProgress(info.percent);
#ifdef NIX
Refresh(false);
#endif
Update();
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright(C) 2016,2017, Imagination Technologies Limited and/or its
* affiliated group companies.
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*
*/
#include "board.h"
#include "periph/gpio.h"
extern void dummy(void);
void board_init(void)
{
/* Turn off all LED's */
gpio_init(LED1_PIN, GPIO_OUT);
gpio_init(LED2_PIN, GPIO_OUT);
LED1_OFF;
LED2_OFF;
/* initialize the CPU */
cpu_init();
/* Stop the linker from throwing away the PIC32 config register settings */
dummy();
}
| {
"pile_set_name": "Github"
} |
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "vb-failures", "failures\vb-failures.vbproj", "{F199991B-6C8E-4AB0-9AAA-703CD4897700}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "vb-money", "money\vb-money.vbproj", "{95394B96-A794-48EA-9879-0E4EC79C5724}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "vb-syntax", "syntax\vb-syntax.vbproj", "{6BEF566A-2691-4EE8-91AF-0390CCCDDAF1}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{F199991B-6C8E-4AB0-9AAA-703CD4897700}.Debug.ActiveCfg = Debug|.NET
{F199991B-6C8E-4AB0-9AAA-703CD4897700}.Debug.Build.0 = Debug|.NET
{F199991B-6C8E-4AB0-9AAA-703CD4897700}.Release.ActiveCfg = Release|.NET
{F199991B-6C8E-4AB0-9AAA-703CD4897700}.Release.Build.0 = Release|.NET
{95394B96-A794-48EA-9879-0E4EC79C5724}.Debug.ActiveCfg = Debug|.NET
{95394B96-A794-48EA-9879-0E4EC79C5724}.Debug.Build.0 = Debug|.NET
{95394B96-A794-48EA-9879-0E4EC79C5724}.Release.ActiveCfg = Release|.NET
{95394B96-A794-48EA-9879-0E4EC79C5724}.Release.Build.0 = Release|.NET
{6BEF566A-2691-4EE8-91AF-0390CCCDDAF1}.Debug.ActiveCfg = Debug|.NET
{6BEF566A-2691-4EE8-91AF-0390CCCDDAF1}.Debug.Build.0 = Debug|.NET
{6BEF566A-2691-4EE8-91AF-0390CCCDDAF1}.Release.ActiveCfg = Release|.NET
{6BEF566A-2691-4EE8-91AF-0390CCCDDAF1}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal
| {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.druid.segment.column;
import org.apache.druid.segment.ColumnValueSelector;
import org.apache.druid.segment.NilColumnValueSelector;
import org.apache.druid.segment.data.ReadableOffset;
import org.apache.druid.segment.vector.NilVectorSelector;
import org.apache.druid.segment.vector.ReadableVectorOffset;
import org.apache.druid.segment.vector.VectorObjectSelector;
import javax.annotation.Nullable;
public class UnknownTypeComplexColumn implements ComplexColumn
{
private static final UnknownTypeComplexColumn INSTANCE = new UnknownTypeComplexColumn();
public static UnknownTypeComplexColumn instance()
{
return INSTANCE;
}
@Override
public Class<?> getClazz()
{
return ComplexColumn.class;
}
@Override
public String getTypeName()
{
return "UNKNOWN_COMPLEX_COLUMN_TYPE";
}
@Nullable
@Override
public Object getRowValue(int rowNum)
{
return null;
}
@Override
public int getLength()
{
return 0;
}
@Override
public void close()
{
}
@Override
public ColumnValueSelector<?> makeColumnValueSelector(ReadableOffset offset)
{
return NilColumnValueSelector.instance();
}
@Override
public VectorObjectSelector makeVectorObjectSelector(ReadableVectorOffset offset)
{
return NilVectorSelector.create(offset);
}
}
| {
"pile_set_name": "Github"
} |
// RUN: rm -rf %t
// RUN: %clang_cc1 -objcmt-migrate-property-dot-syntax -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
@class NSString;
// rdar://19140267
@protocol NSObject
@property (readonly, copy) NSString *description;
@end
// rdar://18498572
@interface NSObject <NSObject> @end
@interface P : NSObject
{
P* obj;
int i1, i2, i3;
}
@property int count;
@property (copy) P* PropertyReturnsPObj;
- (P*) MethodReturnsPObj;
@end
P* fun();
@implementation P
- (int) Meth : (P*)array {
[obj setCount : 100];
[(P*)0 setCount : [array count]];
[[obj PropertyReturnsPObj] setCount : [array count]];
[obj setCount : (i1+i2*i3 - 100)];
return [obj count] -
[(P*)0 count] + [array count] +
[fun() count] -
[[obj PropertyReturnsPObj] count] +
[self->obj count];
}
- (P*) MethodReturnsPObj { return 0; }
- (NSString *)description { return [super description]; }
@end
// rdar://19140267
@interface Sub : P
@end
@implementation Sub
- (int) Meth : (P*)array {
[super setCount : 100];
[super setCount : [array count]];
[[super PropertyReturnsPObj] setCount : [array count]];
[super setCount : (i1+i2*i3 - 100)];
return [super count] -
[(P*)0 count] + [array count] +
[fun() count] -
[[super PropertyReturnsPObj] count] +
[self->obj count];
}
@end
@interface Rdar19038838
@property id newItem; // should be marked objc_method_family(none), but isn't.
@end
id testRdar19038838(Rdar19038838 *obj) {
return [obj newItem];
}
// rdar://19381786
@interface rdar19381786 : NSObject
{
rdar19381786* obj;
}
@property int count;
@end
@protocol PR
@property int count;
@end
@implementation rdar19381786
-(void)test:(id)some : (id<PR>)qsome : (SEL)selsome
{
[obj setCount : 100];
[some setCount : [some count]];
[qsome setCount : [qsome count]];
}
@end
// rdar://19140114
int NSOnState;
int ArrNSOnState[4];
@interface rdar19140114 : NSObject
{
rdar19140114* menuItem;
}
@property int state;
@end
@implementation rdar19140114
- (void) Meth {
[menuItem setState:NSOnState];
[menuItem setState :NSOnState];
[menuItem setState :ArrNSOnState[NSOnState]];
[menuItem setState : NSOnState];
[menuItem setState: NSOnState];
[menuItem setState: NSOnState];
[menuItem setState : NSOnState];
}
@end
| {
"pile_set_name": "Github"
} |
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!11 &1
AudioManager:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Volume: 1
Rolloff Scale: 1
Doppler Factor: 1
Default Speaker Mode: 2
m_SampleRate: 0
m_DSPBufferSize: 1024
m_VirtualVoiceCount: 512
m_RealVoiceCount: 32
m_SpatializerPlugin:
m_AmbisonicDecoderPlugin:
m_DisableAudio: 0
m_VirtualizeEffects: 1
m_RequestedDSPBufferSize: 1024
| {
"pile_set_name": "Github"
} |
#!/usr/bin/python
import datetime
import itertools
import os
import time
import unittest
try:
import autotest.common as common # pylint: disable=W0611
except ImportError:
import common # pylint: disable=W0611
from autotest.client.shared.test_utils import mock
from autotest.tko import utils
class get_timestamp_test(unittest.TestCase):
def test_zero_time(self):
date = utils.get_timestamp({"key": "0"}, "key")
timezone = datetime.timedelta(seconds=time.timezone)
utc_date = date + timezone
# should be equal to epoch, i.e. Jan 1, 1970
self.assertEquals(utc_date.year, 1970)
self.assertEquals(utc_date.month, 1)
self.assertEquals(utc_date.day, 1)
self.assertEquals(utc_date.hour, 0)
self.assertEquals(utc_date.minute, 0)
self.assertEquals(utc_date.second, 0)
self.assertEquals(utc_date.microsecond, 0)
def test_returns_none_on_missing_value(self):
date = utils.get_timestamp({}, "missing_key")
self.assertEquals(date, None)
def test_fails_on_non_integer_values(self):
self.assertRaises(ValueError, utils.get_timestamp,
{"key": "zero"}, "key")
def test_date_can_be_string_or_integer(self):
int_times = [1, 12, 123, 1234, 12345, 123456]
str_times = [str(t) for t in int_times]
for int_t, str_t in itertools.izip(int_times, str_times):
date_int = utils.get_timestamp({"key": int_t}, "key")
date_str = utils.get_timestamp({"key": str_t}, "key")
self.assertEquals(date_int, date_str)
class find_toplevel_job_dir_test(unittest.TestCase):
def setUp(self):
self.god = mock.mock_god()
self.god.stub_function(os.path, "exists")
def tearDown(self):
self.god.unstub_all()
def test_start_is_toplevel(self):
jobdir = "/results/job1"
os.path.exists.expect_call(
jobdir + "/.autoserv_execute").and_return(True)
self.assertEqual(utils.find_toplevel_job_dir(jobdir), jobdir)
def test_parent_is_toplevel(self):
jobdir = "/results/job2"
os.path.exists.expect_call(
jobdir + "/sub/.autoserv_execute").and_return(False)
os.path.exists.expect_call(
jobdir + "/.autoserv_execute").and_return(True)
self.assertEqual(utils.find_toplevel_job_dir(jobdir + "/sub"), jobdir)
def test_grandparent_is_toplevel(self):
jobdir = "/results/job3"
os.path.exists.expect_call(
jobdir + "/sub/sub/.autoserv_execute").and_return(False)
os.path.exists.expect_call(
jobdir + "/sub/.autoserv_execute").and_return(False)
os.path.exists.expect_call(
jobdir + "/.autoserv_execute").and_return(True)
self.assertEqual(utils.find_toplevel_job_dir(jobdir + "/sub/sub"),
jobdir)
def test_root_is_toplevel(self):
jobdir = "/results/job4"
os.path.exists.expect_call(
jobdir + "/.autoserv_execute").and_return(False)
os.path.exists.expect_call(
"/results/.autoserv_execute").and_return(False)
os.path.exists.expect_call("/.autoserv_execute").and_return(True)
self.assertEqual(utils.find_toplevel_job_dir(jobdir), "/")
def test_no_toplevel(self):
jobdir = "/results/job5"
os.path.exists.expect_call(
jobdir + "/.autoserv_execute").and_return(False)
os.path.exists.expect_call(
"/results/.autoserv_execute").and_return(False)
os.path.exists.expect_call("/.autoserv_execute").and_return(False)
self.assertEqual(utils.find_toplevel_job_dir(jobdir), None)
class drop_redundant_messages(unittest.TestCase):
def test_empty_set(self):
self.assertEqual(utils.drop_redundant_messages(set()), set())
def test_singleton(self):
self.assertEqual(utils.drop_redundant_messages(set(["abc"])),
set(["abc"]))
def test_distinct_messages(self):
self.assertEqual(utils.drop_redundant_messages(set(["abc", "def"])),
set(["abc", "def"]))
def test_one_unique_message(self):
self.assertEqual(
utils.drop_redundant_messages(set(["abc", "abcd", "abcde"])),
set(["abcde"]))
def test_some_unique_some_not(self):
self.assertEqual(
utils.drop_redundant_messages(set(["abc", "def", "abcdef",
"defghi", "cd"])),
set(["abcdef", "defghi"]))
if __name__ == "__main__":
unittest.main()
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4AC09AFC-9E15-49BA-9200-C20EBD180927}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SilverlightApplication1</RootNamespace>
<AssemblyName>SilverlightApplication1</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>SilverlightApplication1.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>SilverlightApplication1.App</SilverlightAppEntry>
<TestPageFileName>SilverlightApplication1TestPage.html</TestPageFileName>
<CreateTestPage>true</CreateTestPage>
<ValidateXaml>true</ValidateXaml>
<EnableOutOfBrowser>false</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
<UsePlatformExtensions>false</UsePlatformExtensions>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<LinkedServerProject>
</LinkedServerProject>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
to set the TargetFrameworkVersion to v3.5 -->
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Windows.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Browser" />
<Reference Include="Telerik.Windows.Controls">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Data">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Data.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Input">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.Input.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.GridView">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.GridView.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="App_SL.xaml.cs">
<DependentUpon>App_SL.xaml</DependentUpon>
</Compile>
<Compile Include="Club.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="MyViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App_SL.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="Readme.md" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project> | {
"pile_set_name": "Github"
} |
Существуют ли ортогональные кососимметричные матрицы <script type="math/tex">2019 \times 2019</script>? А <script type="math/tex">2018 \times 2018</script>?
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>VSTS DemoGenerator: VstsDemoBuilder.RouteConfig Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">VSTS DemoGenerator
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespace_vsts_demo_builder.html">VstsDemoBuilder</a></li><li class="navelem"><a class="el" href="class_vsts_demo_builder_1_1_route_config.html">RouteConfig</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-static-methods">Static Public Member Functions</a> |
<a href="class_vsts_demo_builder_1_1_route_config-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">VstsDemoBuilder.RouteConfig Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a7ef2583f903b80260413a0d34a0c04fe"><td class="memItemLeft" align="right" valign="top"><a id="a7ef2583f903b80260413a0d34a0c04fe"></a>
static void </td><td class="memItemRight" valign="bottom"><b>RegisterRoutes</b> (RouteCollection routes)</td></tr>
<tr class="separator:a7ef2583f903b80260413a0d34a0c04fe"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>D:/Canarys/Projects/DemoGeneratorOauth/VstsDemoBuilder/App_Start/RouteConfig.cs</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
| {
"pile_set_name": "Github"
} |
d916f8a397ea74a1521ece71b9ae611c70de1a65
| {
"pile_set_name": "Github"
} |
---
title: "System.ServiceModel.ComIntegration.ComIntegrationTxProxyTxCommitted"
ms.date: "03/30/2017"
ms.assetid: f9f5d2aa-04db-4d4d-b802-3bf5d4626e59
---
# System.ServiceModel.ComIntegration.ComIntegrationTxProxyTxCommitted
System.ServiceModel.ComIntegration.ComIntegrationTxProxyTxCommitted
## Description
ComPlus: Transaction committed.
## See also
- [Tracing](index.md)
- [Using Tracing to Troubleshoot Your Application](using-tracing-to-troubleshoot-your-application.md)
- [Administration and Diagnostics](../index.md)
| {
"pile_set_name": "Github"
} |
cxd2820r: by default SNR output is scaled to full 0-65535 range;
output in dBx10 can be enabled through a module parameter;
Signed-off-by: Gianluca Gennari <[email protected]>
---
drivers/media/dvb-frontends/cxd2820r_core.c | 4 ++++
drivers/media/dvb-frontends/cxd2820r_priv.h | 1 +
drivers/media/dvb-frontends/cxd2820r_t.c | 27 ++++++++++++++++++++++-
drivers/media/dvb-frontends/cxd2820r_t2.c | 31 ++++++++++++++++++++++++++-
4 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c
index 9b658c1..35477aa 100644
--- a/drivers/media/dvb-frontends/cxd2820r_core.c
+++ b/drivers/media/dvb-frontends/cxd2820r_core.c
@@ -21,6 +21,10 @@
#include "cxd2820r_priv.h"
+int cxd2820r_snrdb;
+module_param_named(snrdb,cxd2820r_snrdb, int, 0644);
+MODULE_PARM_DESC(snrdb, "Turn on/off SNR output in dBx10 (default:off).");
+
/* write multiple registers */
static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg,
u8 *val, int len)
diff --git a/drivers/media/dvb-frontends/cxd2820r_priv.h b/drivers/media/dvb-frontends/cxd2820r_priv.h
index 7ff5f60..f742169 100644
--- a/drivers/media/dvb-frontends/cxd2820r_priv.h
+++ b/drivers/media/dvb-frontends/cxd2820r_priv.h
@@ -55,6 +55,7 @@ struct cxd2820r_priv {
/* cxd2820r_core.c */
extern int cxd2820r_debug;
+extern int cxd2820r_snrdb;
int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio);
diff --git a/drivers/media/dvb-frontends/cxd2820r_t.c b/drivers/media/dvb-frontends/cxd2820r_t.c
index fa184ca..4268c53 100644
--- a/drivers/media/dvb-frontends/cxd2820r_t.c
+++ b/drivers/media/dvb-frontends/cxd2820r_t.c
@@ -317,7 +317,7 @@ int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr)
struct cxd2820r_priv *priv = fe->demodulator_priv;
int ret;
u8 buf[2];
- u16 tmp;
+ u16 tmp, max_snr;
/* report SNR in dB * 10 */
ret = cxd2820r_rd_regs(priv, 0x00028, buf, sizeof(buf));
@@ -332,6 +332,31 @@ int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr)
else
*snr = 0;
+ if (cxd2820r_snrdb)
+ goto db_out;
+
+ /* scale SNR to full range */
+ ret = cxd2820r_rd_regs(priv, 0x0002f, buf, 1);
+ if (ret)
+ goto error;
+
+ switch ((buf[0] >> 6) & 0x03) {
+ case 0: /* QPSK */
+ max_snr = 230;
+ break;
+ case 1: /* QAM_16 */
+ max_snr = 260;
+ break;
+ case 2: /* QAM_64 */
+ default:
+ max_snr = 290;
+ break;
+ }
+
+ *snr = (*snr >= max_snr) ? 0xffff : (0xffff / max_snr) * *snr;
+ dev_dbg(&priv->i2c->dev, "%s: SNR=%d val=%04x", __func__, *snr, tmp);
+ return ret;
+db_out:
dev_dbg(&priv->i2c->dev, "%s: dBx10=%d val=%04x\n", __func__, *snr,
tmp);
diff --git a/drivers/media/dvb-frontends/cxd2820r_t2.c b/drivers/media/dvb-frontends/cxd2820r_t2.c
index 2ba130e..bfa8441 100644
--- a/drivers/media/dvb-frontends/cxd2820r_t2.c
+++ b/drivers/media/dvb-frontends/cxd2820r_t2.c
@@ -368,7 +368,7 @@ int cxd2820r_read_snr_t2(struct dvb_frontend *fe, u16 *snr)
struct cxd2820r_priv *priv = fe->demodulator_priv;
int ret;
u8 buf[2];
- u16 tmp;
+ u16 tmp, max_snr;
/* report SNR in dB * 10 */
ret = cxd2820r_rd_regs(priv, 0x02028, buf, sizeof(buf));
@@ -383,6 +383,36 @@ int cxd2820r_read_snr_t2(struct dvb_frontend *fe, u16 *snr)
else
*snr = 0;
+ if (cxd2820r_snrdb)
+ goto db_out;
+
+ /* scale SNR to full range */
+ ret = cxd2820r_rd_regs(priv, 0x0205d, buf, 1);
+ if (ret)
+ goto error;
+
+ switch (buf[0] & 0x07) {
+ /* FIXME: check the values */
+ case 0: /* QPSK */
+ max_snr = 170;
+ break;
+ case 1: /* QAM_16 */
+ max_snr = 200;
+ break;
+ case 2: /* QAM_64 */
+ max_snr = 230;
+ break;
+ case 3: /* QAM_256 */
+ default:
+ max_snr = 260;
+ break;
+ }
+
+ *snr = (*snr >= max_snr) ? 0xffff : (0xffff / max_snr) * *snr;
+ dev_dbg(&priv->i2c->dev, "%s: SNR=%d val=%04x", __func__, *snr, tmp);
+ return ret;
+db_out:
+
dev_dbg(&priv->i2c->dev, "%s: dBx10=%d val=%04x\n", __func__, *snr,
tmp);
--
1.7.9.5
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2002-2018 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.security.config.annotation.web.configurers.oauth2.client;
import java.util.Map;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.security.config.annotation.web.HttpSecurityBuilder;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.oauth2.client.InMemoryOAuth2AuthorizedClientService;
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientService;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.client.web.AuthenticatedPrincipalOAuth2AuthorizedClientRepository;
import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository;
import org.springframework.util.StringUtils;
/**
* Utility methods for the OAuth 2.0 Client {@link AbstractHttpConfigurer}'s.
*
* @author Joe Grandja
* @since 5.1
*/
final class OAuth2ClientConfigurerUtils {
private OAuth2ClientConfigurerUtils() {
}
static <B extends HttpSecurityBuilder<B>> ClientRegistrationRepository getClientRegistrationRepository(B builder) {
ClientRegistrationRepository clientRegistrationRepository = builder
.getSharedObject(ClientRegistrationRepository.class);
if (clientRegistrationRepository == null) {
clientRegistrationRepository = getClientRegistrationRepositoryBean(builder);
builder.setSharedObject(ClientRegistrationRepository.class, clientRegistrationRepository);
}
return clientRegistrationRepository;
}
private static <B extends HttpSecurityBuilder<B>> ClientRegistrationRepository getClientRegistrationRepositoryBean(
B builder) {
return builder.getSharedObject(ApplicationContext.class).getBean(ClientRegistrationRepository.class);
}
static <B extends HttpSecurityBuilder<B>> OAuth2AuthorizedClientRepository getAuthorizedClientRepository(
B builder) {
OAuth2AuthorizedClientRepository authorizedClientRepository = builder
.getSharedObject(OAuth2AuthorizedClientRepository.class);
if (authorizedClientRepository == null) {
authorizedClientRepository = getAuthorizedClientRepositoryBean(builder);
if (authorizedClientRepository == null) {
authorizedClientRepository = new AuthenticatedPrincipalOAuth2AuthorizedClientRepository(
getAuthorizedClientService((builder)));
}
builder.setSharedObject(OAuth2AuthorizedClientRepository.class, authorizedClientRepository);
}
return authorizedClientRepository;
}
private static <B extends HttpSecurityBuilder<B>> OAuth2AuthorizedClientRepository getAuthorizedClientRepositoryBean(
B builder) {
Map<String, OAuth2AuthorizedClientRepository> authorizedClientRepositoryMap = BeanFactoryUtils
.beansOfTypeIncludingAncestors(builder.getSharedObject(ApplicationContext.class),
OAuth2AuthorizedClientRepository.class);
if (authorizedClientRepositoryMap.size() > 1) {
throw new NoUniqueBeanDefinitionException(OAuth2AuthorizedClientRepository.class,
authorizedClientRepositoryMap.size(),
"Expected single matching bean of type '" + OAuth2AuthorizedClientRepository.class.getName()
+ "' but found " + authorizedClientRepositoryMap.size() + ": "
+ StringUtils.collectionToCommaDelimitedString(authorizedClientRepositoryMap.keySet()));
}
return (!authorizedClientRepositoryMap.isEmpty() ? authorizedClientRepositoryMap.values().iterator().next()
: null);
}
private static <B extends HttpSecurityBuilder<B>> OAuth2AuthorizedClientService getAuthorizedClientService(
B builder) {
OAuth2AuthorizedClientService authorizedClientService = getAuthorizedClientServiceBean(builder);
if (authorizedClientService == null) {
authorizedClientService = new InMemoryOAuth2AuthorizedClientService(
getClientRegistrationRepository(builder));
}
return authorizedClientService;
}
private static <B extends HttpSecurityBuilder<B>> OAuth2AuthorizedClientService getAuthorizedClientServiceBean(
B builder) {
Map<String, OAuth2AuthorizedClientService> authorizedClientServiceMap = BeanFactoryUtils
.beansOfTypeIncludingAncestors(builder.getSharedObject(ApplicationContext.class),
OAuth2AuthorizedClientService.class);
if (authorizedClientServiceMap.size() > 1) {
throw new NoUniqueBeanDefinitionException(OAuth2AuthorizedClientService.class,
authorizedClientServiceMap.size(),
"Expected single matching bean of type '" + OAuth2AuthorizedClientService.class.getName()
+ "' but found " + authorizedClientServiceMap.size() + ": "
+ StringUtils.collectionToCommaDelimitedString(authorizedClientServiceMap.keySet()));
}
return (!authorizedClientServiceMap.isEmpty() ? authorizedClientServiceMap.values().iterator().next() : null);
}
}
| {
"pile_set_name": "Github"
} |
####################################
# Akka Actor Reference Config File #
####################################
# This is the reference config file that contains all the default settings.
# Make your edits/overrides in your application.conf.
# Akka version, checked against the runtime version of Akka. Loaded from generated conf file.
include "version"
akka {
# Home directory of Akka, modules in the deploy directory will be loaded
home = ""
# Loggers to register at boot time (akka.event.Logging$DefaultLogger logs
# to STDOUT)
loggers = ["akka.event.Logging$DefaultLogger"]
# Filter of log events that is used by the LoggingAdapter before
# publishing log events to the eventStream. It can perform
# fine grained filtering based on the log source. The default
# implementation filters on the `loglevel`.
# FQCN of the LoggingFilter. The Class of the FQCN must implement
# akka.event.LoggingFilter and have a public constructor with
# (akka.actor.ActorSystem.Settings, akka.event.EventStream) parameters.
logging-filter = "akka.event.DefaultLoggingFilter"
# Specifies the default loggers dispatcher
loggers-dispatcher = "akka.actor.default-dispatcher"
# Loggers are created and registered synchronously during ActorSystem
# start-up, and since they are actors, this timeout is used to bound the
# waiting time
logger-startup-timeout = 5s
# Log level used by the configured loggers (see "loggers") as soon
# as they have been started; before that, see "stdout-loglevel"
# Options: OFF, ERROR, WARNING, INFO, DEBUG
loglevel = "INFO"
# Log level for the very basic logger activated during ActorSystem startup.
# This logger prints the log messages to stdout (System.out).
# Options: OFF, ERROR, WARNING, INFO, DEBUG
stdout-loglevel = "WARNING"
# Log the complete configuration at INFO level when the actor system is started.
# This is useful when you are uncertain of what configuration is used.
log-config-on-start = off
# Log at info level when messages are sent to dead letters.
# Possible values:
# on: all dead letters are logged
# off: no logging of dead letters
# n: positive integer, number of dead letters that will be logged
log-dead-letters = 10
# Possibility to turn off logging of dead letters while the actor system
# is shutting down. Logging is only done when enabled by 'log-dead-letters'
# setting.
log-dead-letters-during-shutdown = on
# List FQCN of extensions which shall be loaded at actor system startup.
# Library extensions are regular extensions that are loaded at startup and are
# available for third party library authors to enable auto-loading of extensions when
# present on the classpath. This is done by appending entries:
# 'library-extensions += "Extension"' in the library `reference.conf`.
#
# Should not be set by end user applications in 'application.conf', use the extensions property for that
#
library-extensions = ${?akka.library-extensions} []
# List FQCN of extensions which shall be loaded at actor system startup.
# Should be on the format: 'extensions = ["foo", "bar"]' etc.
# See the Akka Documentation for more info about Extensions
extensions = []
# Toggles whether threads created by this ActorSystem should be daemons or not
daemonic = off
# JVM shutdown, System.exit(-1), in case of a fatal error,
# such as OutOfMemoryError
jvm-exit-on-fatal-error = on
actor {
# FQCN of the ActorRefProvider to be used; the below is the built-in default,
# another one is akka.remote.RemoteActorRefProvider in the akka-remote bundle.
provider = "akka.actor.LocalActorRefProvider"
# The guardian "/user" will use this class to obtain its supervisorStrategy.
# It needs to be a subclass of akka.actor.SupervisorStrategyConfigurator.
# In addition to the default there is akka.actor.StoppingSupervisorStrategy.
guardian-supervisor-strategy = "akka.actor.DefaultSupervisorStrategy"
# Timeout for ActorSystem.actorOf
creation-timeout = 20s
# Serializes and deserializes (non-primitive) messages to ensure immutability,
# this is only intended for testing.
serialize-messages = off
# Serializes and deserializes creators (in Props) to ensure that they can be
# sent over the network, this is only intended for testing. Purely local deployments
# as marked with deploy.scope == LocalScope are exempt from verification.
serialize-creators = off
# Timeout for send operations to top-level actors which are in the process
# of being started. This is only relevant if using a bounded mailbox or the
# CallingThreadDispatcher for a top-level actor.
unstarted-push-timeout = 10s
typed {
# Default timeout for typed actor methods with non-void return type
timeout = 5s
}
# Mapping between ´deployment.router' short names to fully qualified class names
router.type-mapping {
from-code = "akka.routing.NoRouter"
round-robin-pool = "akka.routing.RoundRobinPool"
round-robin-group = "akka.routing.RoundRobinGroup"
random-pool = "akka.routing.RandomPool"
random-group = "akka.routing.RandomGroup"
balancing-pool = "akka.routing.BalancingPool"
smallest-mailbox-pool = "akka.routing.SmallestMailboxPool"
broadcast-pool = "akka.routing.BroadcastPool"
broadcast-group = "akka.routing.BroadcastGroup"
scatter-gather-pool = "akka.routing.ScatterGatherFirstCompletedPool"
scatter-gather-group = "akka.routing.ScatterGatherFirstCompletedGroup"
tail-chopping-pool = "akka.routing.TailChoppingPool"
tail-chopping-group = "akka.routing.TailChoppingGroup"
consistent-hashing-pool = "akka.routing.ConsistentHashingPool"
consistent-hashing-group = "akka.routing.ConsistentHashingGroup"
}
deployment {
# deployment id pattern - on the format: /parent/child etc.
default {
# The id of the dispatcher to use for this actor.
# If undefined or empty the dispatcher specified in code
# (Props.withDispatcher) is used, or default-dispatcher if not
# specified at all.
dispatcher = ""
# The id of the mailbox to use for this actor.
# If undefined or empty the default mailbox of the configured dispatcher
# is used or if there is no mailbox configuration the mailbox specified
# in code (Props.withMailbox) is used.
# If there is a mailbox defined in the configured dispatcher then that
# overrides this setting.
mailbox = ""
# routing (load-balance) scheme to use
# - available: "from-code", "round-robin", "random", "smallest-mailbox",
# "scatter-gather", "broadcast"
# - or: Fully qualified class name of the router class.
# The class must extend akka.routing.CustomRouterConfig and
# have a public constructor with com.typesafe.config.Config
# and optional akka.actor.DynamicAccess parameter.
# - default is "from-code";
# Whether or not an actor is transformed to a Router is decided in code
# only (Props.withRouter). The type of router can be overridden in the
# configuration; specifying "from-code" means that the values specified
# in the code shall be used.
# In case of routing, the actors to be routed to can be specified
# in several ways:
# - nr-of-instances: will create that many children
# - routees.paths: will route messages to these paths using ActorSelection,
# i.e. will not create children
# - resizer: dynamically resizable number of routees as specified in
# resizer below
router = "from-code"
# number of children to create in case of a router;
# this setting is ignored if routees.paths is given
nr-of-instances = 1
# within is the timeout used for routers containing future calls
within = 5 seconds
# number of virtual nodes per node for consistent-hashing router
virtual-nodes-factor = 10
tail-chopping-router {
# interval is duration between sending message to next routee
interval = 10 milliseconds
}
routees {
# Alternatively to giving nr-of-instances you can specify the full
# paths of those actors which should be routed to. This setting takes
# precedence over nr-of-instances
paths = []
}
# To use a dedicated dispatcher for the routees of the pool you can
# define the dispatcher configuration inline with the property name
# 'pool-dispatcher' in the deployment section of the router.
# For example:
# pool-dispatcher {
# fork-join-executor.parallelism-min = 5
# fork-join-executor.parallelism-max = 5
# }
# Routers with dynamically resizable number of routees; this feature is
# enabled by including (parts of) this section in the deployment
resizer {
enabled = off
# The fewest number of routees the router should ever have.
lower-bound = 1
# The most number of routees the router should ever have.
# Must be greater than or equal to lower-bound.
upper-bound = 10
# Threshold used to evaluate if a routee is considered to be busy
# (under pressure). Implementation depends on this value (default is 1).
# 0: number of routees currently processing a message.
# 1: number of routees currently processing a message has
# some messages in mailbox.
# > 1: number of routees with at least the configured pressure-threshold
# messages in their mailbox. Note that estimating mailbox size of
# default UnboundedMailbox is O(N) operation.
pressure-threshold = 1
# Percentage to increase capacity whenever all routees are busy.
# For example, 0.2 would increase 20% (rounded up), i.e. if current
# capacity is 6 it will request an increase of 2 more routees.
rampup-rate = 0.2
# Minimum fraction of busy routees before backing off.
# For example, if this is 0.3, then we'll remove some routees only when
# less than 30% of routees are busy, i.e. if current capacity is 10 and
# 3 are busy then the capacity is unchanged, but if 2 or less are busy
# the capacity is decreased.
# Use 0.0 or negative to avoid removal of routees.
backoff-threshold = 0.3
# Fraction of routees to be removed when the resizer reaches the
# backoffThreshold.
# For example, 0.1 would decrease 10% (rounded up), i.e. if current
# capacity is 9 it will request an decrease of 1 routee.
backoff-rate = 0.1
# Number of messages between resize operation.
# Use 1 to resize before each message.
messages-per-resize = 10
}
# Routers with dynamically resizable number of routees based on
# performance metrics.
# This feature is enabled by including (parts of) this section in
# the deployment, cannot be enabled together with default resizer.
optimal-size-exploring-resizer {
enabled = off
# The fewest number of routees the router should ever have.
lower-bound = 1
# The most number of routees the router should ever have.
# Must be greater than or equal to lower-bound.
upper-bound = 10
# probability of doing a ramping down when all routees are busy
# during exploration.
chance-of-ramping-down-when-full = 0.2
# Interval between each resize attempt
action-interval = 5s
# If the routees have not been fully utilized (i.e. all routees busy)
# for such length, the resizer will downsize the pool.
downsize-after-underutilized-for = 72h
# Duration exploration, the ratio between the largest step size and
# current pool size. E.g. if the current pool size is 50, and the
# explore-step-size is 0.1, the maximum pool size change during
# exploration will be +- 5
explore-step-size = 0.1
# Probabily of doing an exploration v.s. optmization.
chance-of-exploration = 0.4
# When downsizing after a long streak of underutilization, the resizer
# will downsize the pool to the highest utiliziation multiplied by a
# a downsize rasio. This downsize ratio determines the new pools size
# in comparison to the highest utilization.
# E.g. if the highest utilization is 10, and the down size ratio
# is 0.8, the pool will be downsized to 8
downsize-ratio = 0.8
# When optimizing, the resizer only considers the sizes adjacent to the
# current size. This number indicates how many adjacent sizes to consider.
optimization-range = 16
# The weight of the latest metric over old metrics when collecting
# performance metrics.
# E.g. if the last processing speed is 10 millis per message at pool
# size 5, and if the new processing speed collected is 6 millis per
# message at pool size 5. Given a weight of 0.3, the metrics
# representing pool size 5 will be 6 * 0.3 + 10 * 0.7, i.e. 8.8 millis
# Obviously, this number should be between 0 and 1.
weight-of-latest-metric = 0.5
}
}
/IO-DNS/inet-address {
mailbox = "unbounded"
router = "consistent-hashing-pool"
nr-of-instances = 4
}
}
default-dispatcher {
# Must be one of the following
# Dispatcher, PinnedDispatcher, or a FQCN to a class inheriting
# MessageDispatcherConfigurator with a public constructor with
# both com.typesafe.config.Config parameter and
# akka.dispatch.DispatcherPrerequisites parameters.
# PinnedDispatcher must be used together with executor=thread-pool-executor.
type = "Dispatcher"
# Which kind of ExecutorService to use for this dispatcher
# Valid options:
# - "default-executor" requires a "default-executor" section
# - "fork-join-executor" requires a "fork-join-executor" section
# - "thread-pool-executor" requires a "thread-pool-executor" section
# - A FQCN of a class extending ExecutorServiceConfigurator
executor = "default-executor"
# This will be used if you have set "executor = "default-executor"".
# If an ActorSystem is created with a given ExecutionContext, this
# ExecutionContext will be used as the default executor for all
# dispatchers in the ActorSystem configured with
# executor = "default-executor". Note that "default-executor"
# is the default value for executor, and therefore used if not
# specified otherwise. If no ExecutionContext is given,
# the executor configured in "fallback" will be used.
default-executor {
fallback = "fork-join-executor"
}
# This will be used if you have set "executor = "fork-join-executor""
# Underlying thread pool implementation is scala.concurrent.forkjoin.ForkJoinPool
fork-join-executor {
# Min number of threads to cap factor-based parallelism number to
parallelism-min = 8
# The parallelism factor is used to determine thread pool size using the
# following formula: ceil(available processors * factor). Resulting size
# is then bounded by the parallelism-min and parallelism-max values.
parallelism-factor = 3.0
# Max number of threads to cap factor-based parallelism number to
parallelism-max = 64
# Setting to "FIFO" to use queue like peeking mode which "poll" or "LIFO" to use stack
# like peeking mode which "pop".
task-peeking-mode = "FIFO"
}
# This will be used if you have set "executor = "thread-pool-executor""
# Underlying thread pool implementation is java.util.concurrent.ThreadPoolExecutor
thread-pool-executor {
# Keep alive time for threads
keep-alive-time = 60s
# Define a fixed thread pool size with this property. The corePoolSize
# and the maximumPoolSize of the ThreadPoolExecutor will be set to this
# value, if it is defined. Then the other pool-size properties will not
# be used.
#
# Valid values are: `off` or a positive integer.
fixed-pool-size = off
# Min number of threads to cap factor-based corePoolSize number to
core-pool-size-min = 8
# The core-pool-size-factor is used to determine corePoolSize of the
# ThreadPoolExecutor using the following formula:
# ceil(available processors * factor).
# Resulting size is then bounded by the core-pool-size-min and
# core-pool-size-max values.
core-pool-size-factor = 3.0
# Max number of threads to cap factor-based corePoolSize number to
core-pool-size-max = 64
# Minimum number of threads to cap factor-based maximumPoolSize number to
max-pool-size-min = 8
# The max-pool-size-factor is used to determine maximumPoolSize of the
# ThreadPoolExecutor using the following formula:
# ceil(available processors * factor)
# The maximumPoolSize will not be less than corePoolSize.
# It is only used if using a bounded task queue.
max-pool-size-factor = 3.0
# Max number of threads to cap factor-based maximumPoolSize number to
max-pool-size-max = 64
# Specifies the bounded capacity of the task queue (< 1 == unbounded)
task-queue-size = -1
# Specifies which type of task queue will be used, can be "array" or
# "linked" (default)
task-queue-type = "linked"
# Allow core threads to time out
allow-core-timeout = on
}
# How long time the dispatcher will wait for new actors until it shuts down
shutdown-timeout = 1s
# Throughput defines the number of messages that are processed in a batch
# before the thread is returned to the pool. Set to 1 for as fair as possible.
throughput = 5
# Throughput deadline for Dispatcher, set to 0 or negative for no deadline
throughput-deadline-time = 0ms
# For BalancingDispatcher: If the balancing dispatcher should attempt to
# schedule idle actors using the same dispatcher when a message comes in,
# and the dispatchers ExecutorService is not fully busy already.
attempt-teamwork = on
# If this dispatcher requires a specific type of mailbox, specify the
# fully-qualified class name here; the actually created mailbox will
# be a subtype of this type. The empty string signifies no requirement.
mailbox-requirement = ""
}
default-mailbox {
# FQCN of the MailboxType. The Class of the FQCN must have a public
# constructor with
# (akka.actor.ActorSystem.Settings, com.typesafe.config.Config) parameters.
mailbox-type = "akka.dispatch.UnboundedMailbox"
# If the mailbox is bounded then it uses this setting to determine its
# capacity. The provided value must be positive.
# NOTICE:
# Up to version 2.1 the mailbox type was determined based on this setting;
# this is no longer the case, the type must explicitly be a bounded mailbox.
mailbox-capacity = 1000
# If the mailbox is bounded then this is the timeout for enqueueing
# in case the mailbox is full. Negative values signify infinite
# timeout, which should be avoided as it bears the risk of dead-lock.
mailbox-push-timeout-time = 10s
# For Actor with Stash: The default capacity of the stash.
# If negative (or zero) then an unbounded stash is used (default)
# If positive then a bounded stash is used and the capacity is set using
# the property
stash-capacity = -1
}
mailbox {
# Mapping between message queue semantics and mailbox configurations.
# Used by akka.dispatch.RequiresMessageQueue[T] to enforce different
# mailbox types on actors.
# If your Actor implements RequiresMessageQueue[T], then when you create
# an instance of that actor its mailbox type will be decided by looking
# up a mailbox configuration via T in this mapping
requirements {
"akka.dispatch.UnboundedMessageQueueSemantics" =
akka.actor.mailbox.unbounded-queue-based
"akka.dispatch.BoundedMessageQueueSemantics" =
akka.actor.mailbox.bounded-queue-based
"akka.dispatch.DequeBasedMessageQueueSemantics" =
akka.actor.mailbox.unbounded-deque-based
"akka.dispatch.UnboundedDequeBasedMessageQueueSemantics" =
akka.actor.mailbox.unbounded-deque-based
"akka.dispatch.BoundedDequeBasedMessageQueueSemantics" =
akka.actor.mailbox.bounded-deque-based
"akka.dispatch.MultipleConsumerSemantics" =
akka.actor.mailbox.unbounded-queue-based
"akka.dispatch.ControlAwareMessageQueueSemantics" =
akka.actor.mailbox.unbounded-control-aware-queue-based
"akka.dispatch.UnboundedControlAwareMessageQueueSemantics" =
akka.actor.mailbox.unbounded-control-aware-queue-based
"akka.dispatch.BoundedControlAwareMessageQueueSemantics" =
akka.actor.mailbox.bounded-control-aware-queue-based
"akka.event.LoggerMessageQueueSemantics" =
akka.actor.mailbox.logger-queue
}
unbounded-queue-based {
# FQCN of the MailboxType, The Class of the FQCN must have a public
# constructor with (akka.actor.ActorSystem.Settings,
# com.typesafe.config.Config) parameters.
mailbox-type = "akka.dispatch.UnboundedMailbox"
}
bounded-queue-based {
# FQCN of the MailboxType, The Class of the FQCN must have a public
# constructor with (akka.actor.ActorSystem.Settings,
# com.typesafe.config.Config) parameters.
mailbox-type = "akka.dispatch.BoundedMailbox"
}
unbounded-deque-based {
# FQCN of the MailboxType, The Class of the FQCN must have a public
# constructor with (akka.actor.ActorSystem.Settings,
# com.typesafe.config.Config) parameters.
mailbox-type = "akka.dispatch.UnboundedDequeBasedMailbox"
}
bounded-deque-based {
# FQCN of the MailboxType, The Class of the FQCN must have a public
# constructor with (akka.actor.ActorSystem.Settings,
# com.typesafe.config.Config) parameters.
mailbox-type = "akka.dispatch.BoundedDequeBasedMailbox"
}
unbounded-control-aware-queue-based {
# FQCN of the MailboxType, The Class of the FQCN must have a public
# constructor with (akka.actor.ActorSystem.Settings,
# com.typesafe.config.Config) parameters.
mailbox-type = "akka.dispatch.UnboundedControlAwareMailbox"
}
bounded-control-aware-queue-based {
# FQCN of the MailboxType, The Class of the FQCN must have a public
# constructor with (akka.actor.ActorSystem.Settings,
# com.typesafe.config.Config) parameters.
mailbox-type = "akka.dispatch.BoundedControlAwareMailbox"
}
# The LoggerMailbox will drain all messages in the mailbox
# when the system is shutdown and deliver them to the StandardOutLogger.
# Do not change this unless you know what you are doing.
logger-queue {
mailbox-type = "akka.event.LoggerMailboxType"
}
}
debug {
# enable function of Actor.loggable(), which is to log any received message
# at DEBUG level, see the “Testing Actor Systems” section of the Akka
# Documentation at http://akka.io/docs
receive = off
# enable DEBUG logging of all AutoReceiveMessages (Kill, PoisonPill et.c.)
autoreceive = off
# enable DEBUG logging of actor lifecycle changes
lifecycle = off
# enable DEBUG logging of all LoggingFSMs for events, transitions and timers
fsm = off
# enable DEBUG logging of subscription changes on the eventStream
event-stream = off
# enable DEBUG logging of unhandled messages
unhandled = off
# enable WARN logging of misconfigured routers
router-misconfiguration = off
}
# Entries for pluggable serializers and their bindings.
serializers {
java = "akka.serialization.JavaSerializer"
bytes = "akka.serialization.ByteArraySerializer"
}
# Class to Serializer binding. You only need to specify the name of an
# interface or abstract base class of the messages. In case of ambiguity it
# is using the most specific configured class, or giving a warning and
# choosing the “first” one.
#
# To disable one of the default serializers, assign its class to "none", like
# "java.io.Serializable" = none
serialization-bindings {
"[B" = bytes
"java.io.Serializable" = java
}
# Log warnings when the default Java serialization is used to serialize messages.
# The default serializer uses Java serialization which is not very performant and should not
# be used in production environments unless you don't care about performance. In that case
# you can turn this off.
warn-about-java-serializer-usage = on
# To be used with the above warn-about-java-serializer-usage
# When warn-about-java-serializer-usage = on, and this warn-on-no-serialization-verification = off,
# warnings are suppressed for classes extending NoSerializationVerificationNeeded
# to reduce noize.
warn-on-no-serialization-verification = on
# Configuration namespace of serialization identifiers.
# Each serializer implementation must have an entry in the following format:
# `akka.actor.serialization-identifiers."FQCN" = ID`
# where `FQCN` is fully qualified class name of the serializer implementation
# and `ID` is globally unique serializer identifier number.
# Identifier values from 0 to 16 are reserved for Akka internal usage.
serialization-identifiers {
"akka.serialization.JavaSerializer" = 1
"akka.serialization.ByteArraySerializer" = 4
}
# Configuration items which are used by the akka.actor.ActorDSL._ methods
dsl {
# Maximum queue size of the actor created by newInbox(); this protects
# against faulty programs which use select() and consistently miss messages
inbox-size = 1000
# Default timeout to assume for operations like Inbox.receive et al
default-timeout = 5s
}
}
# Used to set the behavior of the scheduler.
# Changing the default values may change the system behavior drastically so make
# sure you know what you're doing! See the Scheduler section of the Akka
# Documentation for more details.
scheduler {
# The LightArrayRevolverScheduler is used as the default scheduler in the
# system. It does not execute the scheduled tasks on exact time, but on every
# tick, it will run everything that is (over)due. You can increase or decrease
# the accuracy of the execution timing by specifying smaller or larger tick
# duration. If you are scheduling a lot of tasks you should consider increasing
# the ticks per wheel.
# Note that it might take up to 1 tick to stop the Timer, so setting the
# tick-duration to a high value will make shutting down the actor system
# take longer.
tick-duration = 10ms
# The timer uses a circular wheel of buckets to store the timer tasks.
# This should be set such that the majority of scheduled timeouts (for high
# scheduling frequency) will be shorter than one rotation of the wheel
# (ticks-per-wheel * ticks-duration)
# THIS MUST BE A POWER OF TWO!
ticks-per-wheel = 512
# This setting selects the timer implementation which shall be loaded at
# system start-up.
# The class given here must implement the akka.actor.Scheduler interface
# and offer a public constructor which takes three arguments:
# 1) com.typesafe.config.Config
# 2) akka.event.LoggingAdapter
# 3) java.util.concurrent.ThreadFactory
implementation = akka.actor.LightArrayRevolverScheduler
# When shutting down the scheduler, there will typically be a thread which
# needs to be stopped, and this timeout determines how long to wait for
# that to happen. In case of timeout the shutdown of the actor system will
# proceed without running possibly still enqueued tasks.
shutdown-timeout = 5s
}
io {
# By default the select loops run on dedicated threads, hence using a
# PinnedDispatcher
pinned-dispatcher {
type = "PinnedDispatcher"
executor = "thread-pool-executor"
thread-pool-executor.allow-core-timeout = off
}
tcp {
# The number of selectors to stripe the served channels over; each of
# these will use one select loop on the selector-dispatcher.
nr-of-selectors = 1
# Maximum number of open channels supported by this TCP module; there is
# no intrinsic general limit, this setting is meant to enable DoS
# protection by limiting the number of concurrently connected clients.
# Also note that this is a "soft" limit; in certain cases the implementation
# will accept a few connections more or a few less than the number configured
# here. Must be an integer > 0 or "unlimited".
max-channels = 256000
# When trying to assign a new connection to a selector and the chosen
# selector is at full capacity, retry selector choosing and assignment
# this many times before giving up
selector-association-retries = 10
# The maximum number of connection that are accepted in one go,
# higher numbers decrease latency, lower numbers increase fairness on
# the worker-dispatcher
batch-accept-limit = 10
# The number of bytes per direct buffer in the pool used to read or write
# network data from the kernel.
direct-buffer-size = 128 KiB
# The maximal number of direct buffers kept in the direct buffer pool for
# reuse.
direct-buffer-pool-limit = 1000
# The duration a connection actor waits for a `Register` message from
# its commander before aborting the connection.
register-timeout = 5s
# The maximum number of bytes delivered by a `Received` message. Before
# more data is read from the network the connection actor will try to
# do other work.
# The purpose of this setting is to impose a smaller limit than the
# configured receive buffer size. When using value 'unlimited' it will
# try to read all from the receive buffer.
max-received-message-size = unlimited
# Enable fine grained logging of what goes on inside the implementation.
# Be aware that this may log more than once per message sent to the actors
# of the tcp implementation.
trace-logging = off
# Fully qualified config path which holds the dispatcher configuration
# to be used for running the select() calls in the selectors
selector-dispatcher = "akka.io.pinned-dispatcher"
# Fully qualified config path which holds the dispatcher configuration
# for the read/write worker actors
worker-dispatcher = "akka.actor.default-dispatcher"
# Fully qualified config path which holds the dispatcher configuration
# for the selector management actors
management-dispatcher = "akka.actor.default-dispatcher"
# Fully qualified config path which holds the dispatcher configuration
# on which file IO tasks are scheduled
file-io-dispatcher = "akka.actor.default-dispatcher"
# The maximum number of bytes (or "unlimited") to transfer in one batch
# when using `WriteFile` command which uses `FileChannel.transferTo` to
# pipe files to a TCP socket. On some OS like Linux `FileChannel.transferTo`
# may block for a long time when network IO is faster than file IO.
# Decreasing the value may improve fairness while increasing may improve
# throughput.
file-io-transferTo-limit = 512 KiB
# The number of times to retry the `finishConnect` call after being notified about
# OP_CONNECT. Retries are needed if the OP_CONNECT notification doesn't imply that
# `finishConnect` will succeed, which is the case on Android.
finish-connect-retries = 5
# On Windows connection aborts are not reliably detected unless an OP_READ is
# registered on the selector _after_ the connection has been reset. This
# workaround enables an OP_CONNECT which forces the abort to be visible on Windows.
# Enabling this setting on other platforms than Windows will cause various failures
# and undefined behavior.
# Possible values of this key are on, off and auto where auto will enable the
# workaround if Windows is detected automatically.
windows-connection-abort-workaround-enabled = off
}
udp {
# The number of selectors to stripe the served channels over; each of
# these will use one select loop on the selector-dispatcher.
nr-of-selectors = 1
# Maximum number of open channels supported by this UDP module Generally
# UDP does not require a large number of channels, therefore it is
# recommended to keep this setting low.
max-channels = 4096
# The select loop can be used in two modes:
# - setting "infinite" will select without a timeout, hogging a thread
# - setting a positive timeout will do a bounded select call,
# enabling sharing of a single thread between multiple selectors
# (in this case you will have to use a different configuration for the
# selector-dispatcher, e.g. using "type=Dispatcher" with size 1)
# - setting it to zero means polling, i.e. calling selectNow()
select-timeout = infinite
# When trying to assign a new connection to a selector and the chosen
# selector is at full capacity, retry selector choosing and assignment
# this many times before giving up
selector-association-retries = 10
# The maximum number of datagrams that are read in one go,
# higher numbers decrease latency, lower numbers increase fairness on
# the worker-dispatcher
receive-throughput = 3
# The number of bytes per direct buffer in the pool used to read or write
# network data from the kernel.
direct-buffer-size = 128 KiB
# The maximal number of direct buffers kept in the direct buffer pool for
# reuse.
direct-buffer-pool-limit = 1000
# Enable fine grained logging of what goes on inside the implementation.
# Be aware that this may log more than once per message sent to the actors
# of the tcp implementation.
trace-logging = off
# Fully qualified config path which holds the dispatcher configuration
# to be used for running the select() calls in the selectors
selector-dispatcher = "akka.io.pinned-dispatcher"
# Fully qualified config path which holds the dispatcher configuration
# for the read/write worker actors
worker-dispatcher = "akka.actor.default-dispatcher"
# Fully qualified config path which holds the dispatcher configuration
# for the selector management actors
management-dispatcher = "akka.actor.default-dispatcher"
}
udp-connected {
# The number of selectors to stripe the served channels over; each of
# these will use one select loop on the selector-dispatcher.
nr-of-selectors = 1
# Maximum number of open channels supported by this UDP module Generally
# UDP does not require a large number of channels, therefore it is
# recommended to keep this setting low.
max-channels = 4096
# The select loop can be used in two modes:
# - setting "infinite" will select without a timeout, hogging a thread
# - setting a positive timeout will do a bounded select call,
# enabling sharing of a single thread between multiple selectors
# (in this case you will have to use a different configuration for the
# selector-dispatcher, e.g. using "type=Dispatcher" with size 1)
# - setting it to zero means polling, i.e. calling selectNow()
select-timeout = infinite
# When trying to assign a new connection to a selector and the chosen
# selector is at full capacity, retry selector choosing and assignment
# this many times before giving up
selector-association-retries = 10
# The maximum number of datagrams that are read in one go,
# higher numbers decrease latency, lower numbers increase fairness on
# the worker-dispatcher
receive-throughput = 3
# The number of bytes per direct buffer in the pool used to read or write
# network data from the kernel.
direct-buffer-size = 128 KiB
# The maximal number of direct buffers kept in the direct buffer pool for
# reuse.
direct-buffer-pool-limit = 1000
# Enable fine grained logging of what goes on inside the implementation.
# Be aware that this may log more than once per message sent to the actors
# of the tcp implementation.
trace-logging = off
# Fully qualified config path which holds the dispatcher configuration
# to be used for running the select() calls in the selectors
selector-dispatcher = "akka.io.pinned-dispatcher"
# Fully qualified config path which holds the dispatcher configuration
# for the read/write worker actors
worker-dispatcher = "akka.actor.default-dispatcher"
# Fully qualified config path which holds the dispatcher configuration
# for the selector management actors
management-dispatcher = "akka.actor.default-dispatcher"
}
dns {
# Fully qualified config path which holds the dispatcher configuration
# for the manager and resolver router actors.
# For actual router configuration see akka.actor.deployment./IO-DNS/*
dispatcher = "akka.actor.default-dispatcher"
# Name of the subconfig at path akka.io.dns, see inet-address below
resolver = "inet-address"
inet-address {
# Must implement akka.io.DnsProvider
provider-object = "akka.io.InetAddressDnsProvider"
# These TTLs are set to default java 6 values
positive-ttl = 30s
negative-ttl = 10s
# How often to sweep out expired cache entries.
# Note that this interval has nothing to do with TTLs
cache-cleanup-interval = 120s
}
}
}
} | {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <ignite/binary/binary_raw_reader.h>
#include <ignite/thin/cache/cache_peek_mode.h>
#include <ignite/impl/thin/writable.h>
#include <ignite/impl/thin/readable.h>
#include "impl/response_status.h"
#include "impl/data_channel.h"
#include "impl/message.h"
namespace ignite
{
namespace impl
{
namespace thin
{
/**
* Message flags.
*/
struct Flag
{
enum Type
{
/** Failure flag. */
FAILURE = 1,
/** Affinity topology change flag. */
AFFINITY_TOPOLOGY_CHANGED = 1 << 1,
};
};
CachePartitionsRequest::CachePartitionsRequest(const std::vector<int32_t>& cacheIds) :
cacheIds(cacheIds)
{
// No-op.
}
void CachePartitionsRequest::Write(binary::BinaryWriterImpl& writer, const ProtocolVersion&) const
{
writer.WriteInt32(static_cast<int32_t>(cacheIds.size()));
for (size_t i = 0; i < cacheIds.size(); ++i)
writer.WriteInt32(cacheIds[i]);
}
GetOrCreateCacheWithNameRequest::GetOrCreateCacheWithNameRequest(const std::string& name) :
name(name)
{
// No-op.
}
void GetOrCreateCacheWithNameRequest::Write(binary::BinaryWriterImpl& writer, const ProtocolVersion&) const
{
writer.WriteString(name);
}
CreateCacheWithNameRequest::CreateCacheWithNameRequest(const std::string& name) :
name(name)
{
// No-op.
}
void CreateCacheWithNameRequest::Write(binary::BinaryWriterImpl& writer, const ProtocolVersion&) const
{
writer.WriteString(name);
}
Response::Response():
flags(),
status(ResponseStatus::FAILED)
{
// No-op.
}
Response::~Response()
{
// No-op.
}
void Response::Read(binary::BinaryReaderImpl& reader, const ProtocolVersion& ver)
{
if (ver >= DataChannel::VERSION_1_4_0)
{
flags = reader.ReadInt16();
if (IsAffinityTopologyChanged())
topologyVersion.Read(reader);
if (!IsFailure())
{
status = ResponseStatus::SUCCESS;
ReadOnSuccess(reader, ver);
return;
}
}
status = reader.ReadInt32();
if (status == ResponseStatus::SUCCESS)
ReadOnSuccess(reader, ver);
else
reader.ReadString(error);
}
bool Response::IsAffinityTopologyChanged() const
{
return (flags & Flag::AFFINITY_TOPOLOGY_CHANGED) != 0;
}
bool Response::IsFailure() const
{
return (flags & Flag::FAILURE) != 0;
}
ClientCacheNodePartitionsResponse::ClientCacheNodePartitionsResponse(
std::vector<NodePartitions>& nodeParts):
nodeParts(nodeParts)
{
// No-op.
}
ClientCacheNodePartitionsResponse::~ClientCacheNodePartitionsResponse()
{
// No-op.
}
void ClientCacheNodePartitionsResponse::ReadOnSuccess(
binary::BinaryReaderImpl& reader, const ProtocolVersion&)
{
int32_t num = reader.ReadInt32();
nodeParts.clear();
nodeParts.resize(static_cast<size_t>(num));
for (int32_t i = 0; i < num; ++i)
nodeParts[i].Read(reader);
}
CachePartitionsResponse::CachePartitionsResponse(std::vector<PartitionAwarenessGroup>& groups) :
groups(groups)
{
// No-op.
}
CachePartitionsResponse::~CachePartitionsResponse()
{
// No-op.
}
void CachePartitionsResponse::ReadOnSuccess(binary::BinaryReaderImpl& reader, const ProtocolVersion&)
{
topologyVersion.Read(reader);
int32_t groupsNum = reader.ReadInt32();
groups.clear();
groups.resize(static_cast<size_t>(groupsNum));
for (int32_t i = 0; i < groupsNum; ++i)
groups[i].Read(reader);
}
CacheValueResponse::CacheValueResponse(Readable& value) :
value(value)
{
// No-op.
}
CacheValueResponse::~CacheValueResponse()
{
// No-op.
}
void CacheValueResponse::ReadOnSuccess(binary::BinaryReaderImpl& reader, const ProtocolVersion&)
{
value.Read(reader);
}
void BinaryTypeGetRequest::Write(binary::BinaryWriterImpl& writer, const ProtocolVersion&) const
{
writer.WriteInt32(typeId);
}
void BinaryTypePutRequest::Write(binary::BinaryWriterImpl& writer, const ProtocolVersion&) const
{
writer.WriteInt32(snapshot.GetTypeId());
writer.WriteString(snapshot.GetTypeName());
// Affinity Key Field name.
writer.WriteNull();
const binary::Snap::FieldMap& fields = snapshot.GetFieldMap();
writer.WriteInt32(static_cast<int32_t>(fields.size()));
for (binary::Snap::FieldMap::const_iterator it = fields.begin(); it != fields.end(); ++it)
{
writer.WriteString(it->first);
writer.WriteInt32(it->second.GetTypeId());
writer.WriteInt32(it->second.GetFieldId());
}
// Is enum: always false for now as we do not support enums.
writer.WriteBool(false);
// Schemas. Compact schema is not supported for now.
writer.WriteInt32(0);
}
void BinaryTypeGetResponse::ReadOnSuccess(binary::BinaryReaderImpl& reader, const ProtocolVersion&)
{
int32_t typeId = reader.ReadInt32();
std::string typeName;
reader.ReadString(typeName);
// Unused for now.
std::string affKeyFieldNameUnused;
reader.ReadString(affKeyFieldNameUnused);
snapshot = binary::SPSnap(new binary::Snap(typeName, typeId));
int32_t fieldsNum = reader.ReadInt32();
for (int32_t i = 0; i < fieldsNum; ++i)
{
std::string fieldName;
reader.ReadString(fieldName);
int32_t fieldTypeId = reader.ReadInt32();
int32_t fieldId = reader.ReadInt32();
snapshot.Get()->AddField(fieldId, fieldName, fieldTypeId);
}
// Check if the type is enum.
bool isEnum = reader.ReadBool();
if (isEnum)
throw IgniteError(IgniteError::IGNITE_ERR_BINARY, "Enum types is not supported.");
// Ignoring schemas for now.
}
void DestroyCacheRequest::Write(binary::BinaryWriterImpl& writer, const ProtocolVersion&) const
{
writer.WriteInt32(cacheId);
}
void GetCacheNamesResponse::ReadOnSuccess(binary::BinaryReaderImpl& reader, const ProtocolVersion&)
{
int32_t len = reader.ReadInt32();
cacheNames.reserve(static_cast<size_t>(len));
for (int32_t i = 0; i < len; i++)
{
std::string res;
reader.ReadString(res);
cacheNames.push_back(res);
}
}
void BoolResponse::ReadOnSuccess(binary::BinaryReaderImpl& reader, const ProtocolVersion&)
{
value = reader.ReadBool();
}
CacheGetSizeRequest::CacheGetSizeRequest(int32_t cacheId, bool binary, int32_t peekModes) :
CacheRequest<RequestType::CACHE_GET_SIZE>(cacheId, binary),
peekModes(peekModes)
{
// No-op.
}
void CacheGetSizeRequest::Write(binary::BinaryWriterImpl& writer, const ProtocolVersion& ver) const
{
CacheRequest<RequestType::CACHE_GET_SIZE>::Write(writer, ver);
if (peekModes & ignite::thin::cache::CachePeekMode::ALL)
{
// Size.
writer.WriteInt32(1);
writer.WriteInt8(0);
return;
}
interop::InteropOutputStream* stream = writer.GetStream();
// Reserve size.
int32_t sizePos = stream->Reserve(4);
if (peekModes & ignite::thin::cache::CachePeekMode::NEAR_CACHE)
stream->WriteInt8(1);
if (peekModes & ignite::thin::cache::CachePeekMode::PRIMARY)
stream->WriteInt8(2);
if (peekModes & ignite::thin::cache::CachePeekMode::BACKUP)
stream->WriteInt8(3);
if (peekModes & ignite::thin::cache::CachePeekMode::ONHEAP)
stream->WriteInt8(4);
if (peekModes & ignite::thin::cache::CachePeekMode::OFFHEAP)
stream->WriteInt8(5);
int32_t size = stream->Position() - sizePos - 4;
stream->WriteInt32(sizePos, size);
stream->Synchronize();
}
void Int64Response::ReadOnSuccess(binary::BinaryReaderImpl& reader, const ProtocolVersion&)
{
value = reader.ReadInt64();
}
void Int32Response::ReadOnSuccess(binary::BinaryReaderImpl& reader, const ProtocolVersion&)
{
value = reader.ReadInt32();
}
}
}
}
| {
"pile_set_name": "Github"
} |
#include "layout.h"
#include "../vgmstream.h"
#include "../coding/coding.h"
void render_vgmstream_aax(sample * buffer, int32_t sample_count, VGMSTREAM * vgmstream) {
int samples_written=0;
aax_codec_data *data = vgmstream->codec_data;
while (samples_written<sample_count) {
int samples_to_do;
int samples_this_block = data->sample_counts[data->current_segment];
if (vgmstream->loop_flag && vgmstream_do_loop(vgmstream)) {
int i;
data->current_segment = data->loop_segment;
reset_vgmstream(data->adxs[data->current_segment]);
/* carry over the history from the loop point */
if (data->loop_segment > 0)
{
for (i=0;i<data->adxs[0]->channels;i++)
{
data->adxs[data->loop_segment]->ch[i].adpcm_history1_32 =
data->adxs[data->loop_segment-1]->ch[i].adpcm_history1_32;
data->adxs[data->loop_segment]->ch[i].adpcm_history2_32 =
data->adxs[data->loop_segment-1]->ch[i].adpcm_history2_32;
}
}
vgmstream->samples_into_block = 0;
continue;
}
samples_to_do = vgmstream_samples_to_do(samples_this_block, 1, vgmstream);
/*printf("samples_to_do=%d,samples_this_block=%d,samples_written=%d,sample_count=%d\n",samples_to_do,samples_this_block,samples_written,sample_count);*/
if (samples_written+samples_to_do > sample_count)
samples_to_do=sample_count-samples_written;
if (samples_to_do == 0)
{
int i;
data->current_segment++;
/*printf("advance to %d at %d samples\n",data->current_segment,vgmstream->current_sample);*/
reset_vgmstream(data->adxs[data->current_segment]);
/* carry over the history from the previous segment */
for (i=0;i<data->adxs[0]->channels;i++)
{
data->adxs[data->current_segment]->ch[i].adpcm_history1_32 =
data->adxs[data->current_segment-1]->ch[i].adpcm_history1_32;
data->adxs[data->current_segment]->ch[i].adpcm_history2_32 =
data->adxs[data->current_segment-1]->ch[i].adpcm_history2_32;
}
vgmstream->samples_into_block = 0;
continue;
}
render_vgmstream(&buffer[samples_written*data->adxs[data->current_segment]->channels],
samples_to_do,data->adxs[data->current_segment]);
samples_written += samples_to_do;
vgmstream->current_sample += samples_to_do;
vgmstream->samples_into_block+=samples_to_do;
}
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* @package FrameworkOnFramework
* @subpackage model
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
/**
* FrameworkOnFramework model behavior class
*
* @package FrameworkOnFramework
* @since 2.1
*/
class FOFModelBehaviorEmptynonzero extends FOFModelBehavior
{
/**
* This event runs when we are building the query used to fetch a record
* list in a model
*
* @param FOFModel &$model The model which calls this event
* @param FOFDatabaseQuery &$query The query being built
*
* @return void
*/
public function onBeforeBuildQuery(&$model, &$query)
{
$model->setState('_emptynonzero', '1');
}
}
| {
"pile_set_name": "Github"
} |
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.facebook.samples.AdUnitsSample.fragments.NativeAdRecyclerFragment"
>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp"
/>
</LinearLayout>
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Tests\Http\RememberMe;
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
use Symfony\Component\Security\Core\Authentication\Token\Token;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices;
class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
$this->markTestSkipped('The "HttpFoundation" component is not available');
}
}
public function testAutoLoginReturnsNullWhenNoCookie()
{
$service = $this->getService(null, array('name' => 'foo'));
$this->assertNull($service->autoLogin(new Request()));
}
public function testAutoLoginThrowsExceptionOnInvalidCookie()
{
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => false, 'remember_me_parameter' => 'foo'));
$request = new Request;
$request->request->set('foo', 'true');
$request->cookies->set('foo', 'foo');
$this->assertNull($service->autoLogin($request));
$this->assertTrue($request->attributes->get(RememberMeServicesInterface::COOKIE_ATTR_NAME)->isCleared());
}
public function testAutoLoginThrowsExceptionOnNonExistentUser()
{
$userProvider = $this->getProvider();
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
$request = new Request;
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
$userProvider
->expects($this->once())
->method('loadUserByUsername')
->will($this->throwException(new UsernameNotFoundException('user not found')))
;
$this->assertNull($service->autoLogin($request));
$this->assertTrue($request->attributes->get(RememberMeServicesInterface::COOKIE_ATTR_NAME)->isCleared());
}
public function testAutoLoginDoesNotAcceptCookieWithInvalidHash()
{
$userProvider = $this->getProvider();
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
$request = new Request;
$request->cookies->set('foo', base64_encode('class:'.base64_encode('foouser').':123456789:fooHash'));
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$user
->expects($this->once())
->method('getPassword')
->will($this->returnValue('foopass'))
;
$userProvider
->expects($this->once())
->method('loadUserByUsername')
->with($this->equalTo('foouser'))
->will($this->returnValue($user))
;
$this->assertNull($service->autoLogin($request));
$this->assertTrue($request->attributes->get(RememberMeServicesInterface::COOKIE_ATTR_NAME)->isCleared());
}
public function testAutoLoginDoesNotAcceptAnExpiredCookie()
{
$userProvider = $this->getProvider();
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
$request = new Request;
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() - 1, 'foopass'));
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$user
->expects($this->once())
->method('getPassword')
->will($this->returnValue('foopass'))
;
$userProvider
->expects($this->once())
->method('loadUserByUsername')
->with($this->equalTo('foouser'))
->will($this->returnValue($user))
;
$this->assertNull($service->autoLogin($request));
$this->assertTrue($request->attributes->get(RememberMeServicesInterface::COOKIE_ATTR_NAME)->isCleared());
}
public function testAutoLogin()
{
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$user
->expects($this->once())
->method('getRoles')
->will($this->returnValue(array('ROLE_FOO')))
;
$user
->expects($this->once())
->method('getPassword')
->will($this->returnValue('foopass'))
;
$userProvider = $this->getProvider();
$userProvider
->expects($this->once())
->method('loadUserByUsername')
->with($this->equalTo('foouser'))
->will($this->returnValue($user))
;
$service = $this->getService($userProvider, array('name' => 'foo', 'always_remember_me' => true, 'lifetime' => 3600));
$request = new Request;
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
$returnedToken = $service->autoLogin($request);
$this->assertInstanceOf('Symfony\Component\Security\Core\Authentication\Token\RememberMeToken', $returnedToken);
$this->assertSame($user, $returnedToken->getUser());
$this->assertEquals('fookey', $returnedToken->getKey());
}
public function testLogout()
{
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
$request = new Request();
$response = new Response();
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$service->logout($request, $response, $token);
$cookie = $request->attributes->get(RememberMeServicesInterface::COOKIE_ATTR_NAME);
$this->assertTrue($cookie->isCleared());
$this->assertEquals('/', $cookie->getPath());
$this->assertNull($cookie->getDomain());
}
public function testLoginFail()
{
$service = $this->getService(null, array('name' => 'foo', 'path' => '/foo', 'domain' => 'foodomain.foo'));
$request = new Request();
$response = new Response();
$service->loginFail($request, $response);
$cookie = $request->attributes->get(RememberMeServicesInterface::COOKIE_ATTR_NAME);
$this->assertTrue($cookie->isCleared());
$this->assertEquals('/foo', $cookie->getPath());
$this->assertEquals('foodomain.foo', $cookie->getDomain());
}
public function testLoginSuccessIgnoresTokensWhichDoNotContainAnUserInterfaceImplementation()
{
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true));
$request = new Request;
$response = new Response;
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$token
->expects($this->once())
->method('getUser')
->will($this->returnValue('foo'))
;
$cookies = $response->headers->getCookies();
$this->assertCount(0, $cookies);
$service->loginSuccess($request, $response, $token);
$cookies = $response->headers->getCookies();
$this->assertCount(0, $cookies);
}
public function testLoginSuccess()
{
$service = $this->getService(null, array('name' => 'foo', 'domain' => 'myfoodomain.foo', 'path' => '/foo/path', 'secure' => true, 'httponly' => true, 'lifetime' => 3600, 'always_remember_me' => true));
$request = new Request;
$response = new Response;
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
$user
->expects($this->once())
->method('getPassword')
->will($this->returnValue('foopass'))
;
$user
->expects($this->once())
->method('getUsername')
->will($this->returnValue('foouser'))
;
$token
->expects($this->atLeastOnce())
->method('getUser')
->will($this->returnValue($user))
;
$cookies = $response->headers->getCookies();
$this->assertCount(0, $cookies);
$service->loginSuccess($request, $response, $token);
$cookies = $response->headers->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
$cookie = $cookies['myfoodomain.foo']['/foo/path']['foo'];
$this->assertFalse($cookie->isCleared());
$this->assertTrue($cookie->isSecure());
$this->assertTrue($cookie->isHttpOnly());
$this->assertTrue($cookie->getExpiresTime() > time() + 3590 && $cookie->getExpiresTime() < time() + 3610);
$this->assertEquals('myfoodomain.foo', $cookie->getDomain());
$this->assertEquals('/foo/path', $cookie->getPath());
}
protected function getCookie($class, $username, $expires, $password)
{
$service = $this->getService();
$r = new \ReflectionMethod($service, 'generateCookieValue');
$r->setAccessible(true);
return $r->invoke($service, $class, $username, $expires, $password);
}
protected function encodeCookie(array $parts)
{
$service = $this->getService();
$r = new \ReflectionMethod($service, 'encodeCookie');
$r->setAccessible(true);
return $r->invoke($service, $parts);
}
protected function getService($userProvider = null, $options = array(), $logger = null)
{
if (null === $userProvider) {
$userProvider = $this->getProvider();
}
$service = new TokenBasedRememberMeServices(array($userProvider), 'fookey', 'fookey', $options, $logger);
return $service;
}
protected function getProvider()
{
$provider = $this->getMock('Symfony\Component\Security\Core\User\UserProviderInterface');
$provider
->expects($this->any())
->method('supportsClass')
->will($this->returnValue(true))
;
return $provider;
}
}
| {
"pile_set_name": "Github"
} |
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/ads/googleads/v0/enums/manager_link_status.proto
package enums // import "google.golang.org/genproto/googleapis/ads/googleads/v0/enums"
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// Possible statuses of a link.
type ManagerLinkStatusEnum_ManagerLinkStatus int32
const (
// Not specified.
ManagerLinkStatusEnum_UNSPECIFIED ManagerLinkStatusEnum_ManagerLinkStatus = 0
// Used for return value only. Represents value unknown in this version.
ManagerLinkStatusEnum_UNKNOWN ManagerLinkStatusEnum_ManagerLinkStatus = 1
// Indicates current in-effect relationship
ManagerLinkStatusEnum_ACTIVE ManagerLinkStatusEnum_ManagerLinkStatus = 2
// Indicates terminated relationship
ManagerLinkStatusEnum_INACTIVE ManagerLinkStatusEnum_ManagerLinkStatus = 3
// Indicates relationship has been requested by manager, but the client
// hasn't accepted yet.
ManagerLinkStatusEnum_PENDING ManagerLinkStatusEnum_ManagerLinkStatus = 4
// Relationship was requested by the manager, but the client has refused.
ManagerLinkStatusEnum_REFUSED ManagerLinkStatusEnum_ManagerLinkStatus = 5
// Indicates relationship has been requested by manager, but manager
// canceled it.
ManagerLinkStatusEnum_CANCELED ManagerLinkStatusEnum_ManagerLinkStatus = 6
)
var ManagerLinkStatusEnum_ManagerLinkStatus_name = map[int32]string{
0: "UNSPECIFIED",
1: "UNKNOWN",
2: "ACTIVE",
3: "INACTIVE",
4: "PENDING",
5: "REFUSED",
6: "CANCELED",
}
var ManagerLinkStatusEnum_ManagerLinkStatus_value = map[string]int32{
"UNSPECIFIED": 0,
"UNKNOWN": 1,
"ACTIVE": 2,
"INACTIVE": 3,
"PENDING": 4,
"REFUSED": 5,
"CANCELED": 6,
}
func (x ManagerLinkStatusEnum_ManagerLinkStatus) String() string {
return proto.EnumName(ManagerLinkStatusEnum_ManagerLinkStatus_name, int32(x))
}
func (ManagerLinkStatusEnum_ManagerLinkStatus) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_manager_link_status_669823d66709486a, []int{0, 0}
}
// Container for enum describing possible status of a manager and client link.
type ManagerLinkStatusEnum struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ManagerLinkStatusEnum) Reset() { *m = ManagerLinkStatusEnum{} }
func (m *ManagerLinkStatusEnum) String() string { return proto.CompactTextString(m) }
func (*ManagerLinkStatusEnum) ProtoMessage() {}
func (*ManagerLinkStatusEnum) Descriptor() ([]byte, []int) {
return fileDescriptor_manager_link_status_669823d66709486a, []int{0}
}
func (m *ManagerLinkStatusEnum) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ManagerLinkStatusEnum.Unmarshal(m, b)
}
func (m *ManagerLinkStatusEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ManagerLinkStatusEnum.Marshal(b, m, deterministic)
}
func (dst *ManagerLinkStatusEnum) XXX_Merge(src proto.Message) {
xxx_messageInfo_ManagerLinkStatusEnum.Merge(dst, src)
}
func (m *ManagerLinkStatusEnum) XXX_Size() int {
return xxx_messageInfo_ManagerLinkStatusEnum.Size(m)
}
func (m *ManagerLinkStatusEnum) XXX_DiscardUnknown() {
xxx_messageInfo_ManagerLinkStatusEnum.DiscardUnknown(m)
}
var xxx_messageInfo_ManagerLinkStatusEnum proto.InternalMessageInfo
func init() {
proto.RegisterType((*ManagerLinkStatusEnum)(nil), "google.ads.googleads.v0.enums.ManagerLinkStatusEnum")
proto.RegisterEnum("google.ads.googleads.v0.enums.ManagerLinkStatusEnum_ManagerLinkStatus", ManagerLinkStatusEnum_ManagerLinkStatus_name, ManagerLinkStatusEnum_ManagerLinkStatus_value)
}
func init() {
proto.RegisterFile("google/ads/googleads/v0/enums/manager_link_status.proto", fileDescriptor_manager_link_status_669823d66709486a)
}
var fileDescriptor_manager_link_status_669823d66709486a = []byte{
// 320 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xd1, 0x4a, 0xf3, 0x30,
0x1c, 0xc5, 0xbf, 0x76, 0x9f, 0x53, 0x32, 0xc1, 0x58, 0xd0, 0xbb, 0x5d, 0x6c, 0x0f, 0x90, 0x16,
0xbc, 0x10, 0xe2, 0x55, 0xd6, 0x66, 0xa3, 0x38, 0x63, 0x71, 0xae, 0x82, 0x14, 0x46, 0xb4, 0x25,
0x8c, 0xad, 0xc9, 0x58, 0xb6, 0x3d, 0x85, 0x4f, 0xe1, 0xa5, 0x8f, 0xe2, 0xa3, 0xe8, 0x4b, 0x48,
0x92, 0x6d, 0x37, 0x43, 0x6f, 0xc2, 0xf9, 0xe7, 0x9c, 0x5f, 0xf8, 0xe7, 0x80, 0x6b, 0xa1, 0x94,
0x98, 0x57, 0x21, 0x2f, 0x75, 0xe8, 0xa4, 0x51, 0x9b, 0x28, 0xac, 0xe4, 0xba, 0xd6, 0x61, 0xcd,
0x25, 0x17, 0xd5, 0x72, 0x32, 0x9f, 0xca, 0xd9, 0x44, 0xaf, 0xf8, 0x6a, 0xad, 0xd1, 0x62, 0xa9,
0x56, 0x2a, 0x68, 0xbb, 0x34, 0xe2, 0xa5, 0x46, 0x7b, 0x10, 0x6d, 0x22, 0x64, 0xc1, 0xee, 0x9b,
0x07, 0x2e, 0xee, 0x1c, 0x3c, 0x9c, 0xca, 0xd9, 0xc8, 0xa2, 0x54, 0xae, 0xeb, 0xae, 0x06, 0xe7,
0x07, 0x46, 0x70, 0x06, 0x5a, 0x63, 0x36, 0xca, 0x68, 0x9c, 0xf6, 0x53, 0x9a, 0xc0, 0x7f, 0x41,
0x0b, 0x1c, 0x8f, 0xd9, 0x2d, 0xbb, 0x7f, 0x62, 0xd0, 0x0b, 0x00, 0x68, 0x92, 0xf8, 0x31, 0xcd,
0x29, 0xf4, 0x83, 0x53, 0x70, 0x92, 0xb2, 0xed, 0xd4, 0x30, 0xb1, 0x8c, 0xb2, 0x24, 0x65, 0x03,
0xf8, 0xdf, 0x0c, 0x0f, 0xb4, 0x3f, 0x1e, 0xd1, 0x04, 0x1e, 0x99, 0x5c, 0x4c, 0x58, 0x4c, 0x87,
0x34, 0x81, 0xcd, 0xde, 0xb7, 0x07, 0x3a, 0xaf, 0xaa, 0x46, 0x7f, 0x2e, 0xdd, 0xbb, 0x3c, 0x58,
0x2c, 0x33, 0x7f, 0xcd, 0xbc, 0xe7, 0xde, 0x16, 0x14, 0x6a, 0xce, 0xa5, 0x40, 0x6a, 0x29, 0x42,
0x51, 0x49, 0xdb, 0xc4, 0xae, 0xb6, 0xc5, 0x54, 0xff, 0xd2, 0xe2, 0x8d, 0x3d, 0xdf, 0xfd, 0xc6,
0x80, 0x90, 0x0f, 0xbf, 0x3d, 0x70, 0x4f, 0x91, 0x52, 0x23, 0x27, 0x8d, 0xca, 0x23, 0x64, 0xda,
0xd1, 0x9f, 0x3b, 0xbf, 0x20, 0xa5, 0x2e, 0xf6, 0x7e, 0x91, 0x47, 0x85, 0xf5, 0xbf, 0xfc, 0x8e,
0xbb, 0xc4, 0x98, 0x94, 0x1a, 0xe3, 0x7d, 0x02, 0xe3, 0x3c, 0xc2, 0xd8, 0x66, 0x5e, 0x9a, 0x76,
0xb1, 0xab, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd6, 0x9e, 0xae, 0xdd, 0xdd, 0x01, 0x00, 0x00,
}
| {
"pile_set_name": "Github"
} |
// Boost.Geometry (aka GGL, Generic Geometry Library)
// This file is manually converted from PROJ4
// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// This file is converted from PROJ4, http://trac.osgeo.org/proj
// PROJ4 is originally written by Gerald Evenden (then of the USGS)
// PROJ4 is maintained by Frank Warmerdam
// PROJ4 is converted to Geometry Library by Barend Gehrels (Geodan, Amsterdam)
// Original copyright notice:
// 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.
#ifndef BOOST_GEOMETRY_PROJECTIONS_IMPL_ADJLON_HPP
#define BOOST_GEOMETRY_PROJECTIONS_IMPL_ADJLON_HPP
#include <boost/math/constants/constants.hpp>
#include <boost/geometry/util/math.hpp>
namespace boost { namespace geometry { namespace projections
{
namespace detail
{
/* reduce argument to range +/- PI */
template <typename T>
inline T adjlon (T lon)
{
if (geometry::math::abs(lon) <= boost::math::constants::pi<T>())
{
return lon;
}
/* adjust to 0..2pi rad */
lon += boost::math::constants::pi<T>();
/* remove integral # of 'revolutions'*/
lon -= boost::math::constants::two_pi<T>() *
std::floor(lon / boost::math::constants::two_pi<T>());
/* adjust back to -pi..pi rad */
lon -= boost::math::constants::pi<T>();
return lon;
}
} // namespace detail
}}} // namespace boost::geometry::projections
#endif // BOOST_GEOMETRY_PROJECTIONS_IMPL_ADJLON_HPP
| {
"pile_set_name": "Github"
} |
<?php
$searchHistoryMaxCount = 256; // max count of entries in download history
$HTTPTimeoutPerSite = 5; // in sec
| {
"pile_set_name": "Github"
} |
---
code: true
type: page
title: scrollProfiles
---
# scrollProfiles
Moves a result set cursor forward, created by a [searchProfiles](/core/2/api/controllers/security/search-profiles) query with the `scroll` argument provided.
Results returned by a `scrollProfiles` request reflect the state of the index at the time of the initial search request, like a fixed snapshot. Subsequent changes to documents do not affect the scroll results.
---
## Query Syntax
### HTTP
```http
URL: http://kuzzle:7512/profiles/_scroll/<scrollId>[?scroll=<time to live>]
Method: GET
```
### Other protocols
```js
{
"controller": "security",
"action": "scrollProfiles",
"scrollId": "<scrollId>",
"scroll": "<time to live>"
}
```
---
## Arguments
- `scrollId`: cursor unique identifier, obtained by either a searchProfiles or a scrollProfiles query
### Optional:
- `scroll`: refresh the cursor duration, using the [time to live](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/common-options.html#time-units) syntax.
---
## Response
Returns a paginated search result set, with the following properties:
- `hits`: array of found profiles. Each document has the following properties:
- `_id`: profile unique identifier
- `_source`: profile definition
- `scrollId`: identifier to the next page of result. Can be different than the previous one(s)
- `total`: total number of found profiles. Usually greater than the number of profiles in a result page
```js
{
"status": 200,
"error": null,
"action": "scrollProfiles",
"controller": "security",
"requestId": "<unique request identifier>",
"result": {
"scrollId": "<new scroll id>",
"hits": [
{
"_id": "profile1",
"_source": {
"rateLimit": 0,
"policies": [
// list of policies
]
}
},
{
"_id": "profile2",
"_source": {
"rateLimit": 50,
"policies": [
// list of policies
]
}
}
],
"total": 42
}
}
```
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2018 Adobe
*
* 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 'grid-base.less';
@import 'grid.less';
@import 'structure.less';
| {
"pile_set_name": "Github"
} |
--TEST--
Disable functions - filename regexp
--SKIPIF--
<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
--INI--
sp.configuration_file={PWD}/config/config_disabled_functions_filename_r.ini
--FILE--
<?php
system("echo 42");
shell_exec("echo 43");
?>
--EXPECTF--
42
Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'shell_exec' in %a/disabled_functions_filename_r.php on line 3 | {
"pile_set_name": "Github"
} |
// not used
| {
"pile_set_name": "Github"
} |
#! /bin/sh
exec xdelta_gui "$1"
| {
"pile_set_name": "Github"
} |
define( [
"./class2type"
], function( class2type ) {
"use strict";
return class2type.hasOwnProperty;
} );
| {
"pile_set_name": "Github"
} |
import { Injectable } from '@angular/core';
import { NotificationService } from '@app/notification';
import { Language } from '@data/poe/schema';
import { ItemClipboardResultCode, ItemClipboardService } from '@shared/module/poe/item/clipboard';
import { ItemProcessorService } from '@shared/module/poe/item/processor';
import { Observable, of, throwError } from 'rxjs';
import { mergeMap } from 'rxjs/operators';
import { EvaluateFeatureSettings } from '../evaluate-feature-settings';
import { EvaluateWindowService } from './evaluate-window.service';
@Injectable({
providedIn: 'root'
})
export class EvaluateService {
constructor(
private readonly clipboard: ItemClipboardService,
private readonly window: EvaluateWindowService,
private readonly itemProcessor: ItemProcessorService,
private readonly notification: NotificationService) { }
public evaluate(settings: EvaluateFeatureSettings, language?: Language): Observable<void> {
return this.clipboard.copy().pipe(
mergeMap(({ code, item }) => {
switch (code) {
case ItemClipboardResultCode.Success:
this.itemProcessor.process(item, {
normalizeQuality: settings.evaluateItemSearchPropertyNormalizeQuality
});
return this.window.open({ item, settings, language });
case ItemClipboardResultCode.Empty:
this.notification.show('clipboard.empty');
break;
case ItemClipboardResultCode.ParserError:
this.notification.show('clipboard.parser-error');
break;
default:
return throwError(`code: '${code}' out of range`);
}
return of(null);
})
);
}
}
| {
"pile_set_name": "Github"
} |
.. _archived-gps-failsafe:
======================
Archived: GPS Failsafe
======================
This page covers the set-up and testing of the GPS failsafe.
.. warning::
**ARCHIVED ARTICLE**
The GPS Failsafe was merged into/replaced by the :ref:`EKF / DCM Check & Failsafe <ekf-inav-failsafe>` in Copter 3.3.
Overview
========
The GPS Failsafe is enabled by default but you can enable or disable it
on the Mission Planner's Standard Parameter List, by set the
FS_GPS_ENABLE parameter to 0 (Disable) or 1 (Land) or 2 (switch to
AltHold). It is highly recommended to leave it enabled and no known
reason why it should ever be disabled.
If you lose GPS lock or experience a GPS Glitch for 5 seconds while in a
mode that requires the GPS (Auto, Guided, Loiter, RTL, Circle, Position
or Drift) mode it will initiate a Land (or AltHold if FS_GPS_ENABLE is
set to 2).
.. image:: ../images/GPSFailsafeAltHold2.png
:target: ../_images/GPSFailsafeAltHold2.png
Additional information on the GPS failsafe and Glitch protection can be
found :ref:`here <gps-failsafe-glitch-protection>`.
Video
=====
Below is a video of a simulated GPS Failure resulting in the copter
Landing.
.. youtube:: sqofSFd0MuU
:width: 100%
| {
"pile_set_name": "Github"
} |
module.exports = ComChangeUserPacket;
function ComChangeUserPacket(options) {
options = options || {};
this.command = 0x11;
this.user = options.user;
this.scrambleBuff = options.scrambleBuff;
this.database = options.database;
this.charsetNumber = options.charsetNumber;
}
ComChangeUserPacket.prototype.parse = function(parser) {
this.command = parser.parseUnsignedNumber(1);
this.user = parser.parseNullTerminatedString();
this.scrambleBuff = parser.parseLengthCodedBuffer();
this.database = parser.parseNullTerminatedString();
this.charsetNumber = parser.parseUnsignedNumber(1);
};
ComChangeUserPacket.prototype.write = function(writer) {
writer.writeUnsignedNumber(1, this.command);
writer.writeNullTerminatedString(this.user);
writer.writeLengthCodedBuffer(this.scrambleBuff);
writer.writeNullTerminatedString(this.database);
writer.writeUnsignedNumber(2, this.charsetNumber);
};
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
require File.expand_path('../helper', __FILE__)
require 'thread'
class TestRakeMultiTask < Rake::TestCase
include Rake
include Rake::DSL
def setup
super
Task.clear
@runs = Array.new
@mutex = Mutex.new
end
def teardown
Rake.application.thread_pool.join
super
end
def add_run(obj)
@mutex.synchronize do
@runs << obj
end
end
def test_running_multitasks
task :a do 3.times do |i| add_run("A#{i}"); sleep 0.01; end end
task :b do 3.times do |i| add_run("B#{i}"); sleep 0.01; end end
multitask :both => [:a, :b]
Task[:both].invoke
assert_equal 6, @runs.size
assert @runs.index("A0") < @runs.index("A1")
assert @runs.index("A1") < @runs.index("A2")
assert @runs.index("B0") < @runs.index("B1")
assert @runs.index("B1") < @runs.index("B2")
end
def test_all_multitasks_wait_on_slow_prerequisites
task :slow do 3.times do |i| add_run("S#{i}"); sleep 0.05 end end
task :a => [:slow] do 3.times do |i| add_run("A#{i}"); sleep 0.01 end end
task :b => [:slow] do 3.times do |i| add_run("B#{i}"); sleep 0.01 end end
multitask :both => [:a, :b]
Task[:both].invoke
assert_equal 9, @runs.size
assert @runs.index("S0") < @runs.index("S1")
assert @runs.index("S1") < @runs.index("S2")
assert @runs.index("S2") < @runs.index("A0")
assert @runs.index("S2") < @runs.index("B0")
assert @runs.index("A0") < @runs.index("A1")
assert @runs.index("A1") < @runs.index("A2")
assert @runs.index("B0") < @runs.index("B1")
assert @runs.index("B1") < @runs.index("B2")
end
def test_multitasks_with_parameters
task :a, [:arg] do |t, args| add_run(args[:arg]) end
multitask :b, [:arg] => [:a] do |t, args| add_run(args[:arg] + 'mt') end
Task[:b].invoke "b"
assert @runs[0] == "b"
assert @runs[1] == "bmt"
end
end
| {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.admin.controller;
import org.apache.dubbo.admin.AbstractSpringIntegrationTest;
import org.apache.dubbo.admin.common.util.Constants;
import org.apache.dubbo.admin.model.dto.ConfigDTO;
import org.apache.dubbo.admin.service.ProviderService;
import org.junit.After;
import org.junit.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;
public class ManagementControllerTest extends AbstractSpringIntegrationTest {
private final String env = "whatever";
@MockBean
private ProviderService providerService;
@After
public void tearDown() throws Exception {
if (zkClient.checkExists().forPath("/dubbo") != null) {
zkClient.delete().deletingChildrenIfNeeded().forPath("/dubbo");
}
}
@Test
public void shouldCreateGlobalConfig() throws Exception {
ConfigDTO configDTO = new ConfigDTO();
configDTO.setKey(Constants.GLOBAL_CONFIG);
configDTO.setConfig("key1=val1\nkey2=val2");
ResponseEntity<Boolean> responseEntity = restTemplate.postForEntity(
url("/api/{env}/manage/config"), configDTO, Boolean.class, env
);
assertEquals(responseEntity.getStatusCode(), HttpStatus.CREATED);
assertEquals(responseEntity.getBody(), true);
byte[] bytes = zkClient.getData().forPath(getPath("dubbo"));
String config = new String(bytes);
assertEquals(configDTO.getConfig(), config);
zkClient.delete().forPath(getPath("dubbo"));
}
@Test
public void shouldCreateApplicationConfig() throws Exception {
String uuid = UUID.randomUUID().toString();
String application = "dubbo-admin" + uuid;
ConfigDTO configDTO = new ConfigDTO();
configDTO.setKey(application);
configDTO.setConfig("key1=val1\nkey2=val2");
ResponseEntity<Boolean> responseEntity = restTemplate.postForEntity(
url("/api/{env}/manage/config"), configDTO, Boolean.class, env
);
assertEquals(responseEntity.getStatusCode(), HttpStatus.CREATED);
assertEquals(responseEntity.getBody(), true);
byte[] bytes = zkClient.getData().forPath(getPath(application));
String config = new String(bytes);
assertEquals(configDTO.getConfig(), config);
}
@Test
public void shouldThrowWhenUpdateNonExistedConfigKey() {
ConfigDTO configDTO = new ConfigDTO();
configDTO.setKey(Constants.GLOBAL_CONFIG);
configDTO.setConfig("key1=val1\nkey2=val2");
ResponseEntity<Void> responseEntity = restTemplate.exchange(
url("/api/{env}/manage/config/{key}"), HttpMethod.PUT,
new HttpEntity<>(configDTO), Void.class, env, "non-existed"
);
assertEquals(responseEntity.getStatusCode(), HttpStatus.NOT_FOUND);
}
@Test
public void shouldUpdateConfigSpecifiedKey() throws Exception {
String key = "shouldUpdateConfigSpecifiedKey";
ConfigDTO configDTO = new ConfigDTO();
configDTO.setKey(key);
configDTO.setConfig("key1=val1\nkey2=val2");
restTemplate.postForEntity(url("/api/{env}/manage/config"), configDTO, Boolean.class, env);
configDTO.setConfig("key1=updatedVal1\nkey2=updatedVal2");
ResponseEntity<Void> responseEntity = restTemplate.exchange(
url("/api/{env}/manage/config/{key}"), HttpMethod.PUT,
new HttpEntity<>(configDTO), Void.class, env, key
);
assertEquals(responseEntity.getStatusCode(), HttpStatus.OK);
byte[] bytes = zkClient.getData().forPath(getPath(key));
String config = new String(bytes);
assertEquals("key1=updatedVal1\nkey2=updatedVal2", config);
}
@Test
public void shouldGetAllConfig() throws Exception {
int num = 20;
List<ConfigDTO> configDTOs = new ArrayList<>(num);
for (int i = 0; i < num; i++) {
ConfigDTO configDTO = new ConfigDTO();
configDTO.setKey("key" + i);
configDTO.setConfig("key1=val1\nkey2=val2");
configDTOs.add(configDTO);
String path = getPath(configDTO.getKey());
if (zkClient.checkExists().forPath(path) == null) {
zkClient.create().creatingParentsIfNeeded().forPath(path);
}
zkClient.setData().forPath(path, configDTO.getConfig().getBytes());
}
when(providerService.findApplications())
.thenReturn(configDTOs.stream().map(ConfigDTO::getKey).collect(Collectors.toSet()));
ResponseEntity<List<ConfigDTO>> responseEntity = restTemplate.exchange(
url("/api/{env}/manage/config/{key}"), HttpMethod.GET,
null, new ParameterizedTypeReference<List<ConfigDTO>>() {
}, env, "*"
);
assertEquals(responseEntity.getStatusCode(), HttpStatus.OK);
assertThat(responseEntity.getBody(), hasSize(num));
}
@Test
public void shouldDeleteConfig() throws Exception {
int num = 20;
List<ConfigDTO> configDTOs = new ArrayList<>(num);
for (int i = 0; i < num; i++) {
ConfigDTO configDTO = new ConfigDTO();
configDTO.setKey("shouldDeleteConfigKey" + i);
configDTO.setConfig("key1=val1\nkey2=val2");
configDTOs.add(configDTO);
String path = getPath(configDTO.getKey());
if (zkClient.checkExists().forPath(path) == null) {
zkClient.create().creatingParentsIfNeeded().forPath(path);
}
zkClient.setData().forPath(path, configDTO.getConfig().getBytes());
}
when(providerService.findApplications())
.thenReturn(configDTOs.stream().map(ConfigDTO::getKey).collect(Collectors.toSet()));
restTemplate.delete(url("/api/{env}/manage/config/{key}"), env, "shouldDeleteConfigKey1");
ResponseEntity<List<ConfigDTO>> responseEntity = restTemplate.exchange(
url("/api/{env}/manage/config/{key}"), HttpMethod.GET,
null, new ParameterizedTypeReference<List<ConfigDTO>>() {
}, env, "*"
);
assertEquals(responseEntity.getStatusCode(), HttpStatus.OK);
assertThat(responseEntity.getBody(), hasSize(num - 1));
restTemplate.delete(url("/api/{env}/manage/config/{key}"), env, "shouldDeleteConfigKey10");
responseEntity = restTemplate.exchange(
url("/api/{env}/manage/config/{key}"), HttpMethod.GET,
null, new ParameterizedTypeReference<List<ConfigDTO>>() {
}, env, "*"
);
assertEquals(responseEntity.getStatusCode(), HttpStatus.OK);
assertThat(responseEntity.getBody(), hasSize(num - 2));
}
private String getPath(String key) {
return "/dubbo/" + Constants.CONFIG_KEY + Constants.PATH_SEPARATOR + key + Constants.PATH_SEPARATOR
+ Constants.DUBBO_PROPERTY;
}
}
| {
"pile_set_name": "Github"
} |
/* ===========================================================
* JFreeChart : a free chart library for the Java(tm) platform
* ===========================================================
*
* (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
*
* Project Info: http://www.jfree.org/jfreechart/index.html
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* ----------------------
* XYImageAnnotation.java
* ----------------------
* (C) Copyright 2003-2008, by Object Refinery Limited and Contributors.
*
* Original Author: David Gilbert (for Object Refinery Limited);
* Contributor(s): Mike Harris;
*
* Changes:
* --------
* 01-Dec-2003 : Version 1 (DG);
* 21-Jan-2004 : Update for renamed method in ValueAxis (DG);
* 18-May-2004 : Fixed bug with plot orientation (DG);
* 29-Sep-2004 : Now extends AbstractXYAnnotation, with modified draw()
* method signature and updated equals() method (DG);
* ------------- JFREECHART 1.0.x ---------------------------------------------
* 01-Dec-2006 : Added anchor attribute (see patch 1584860 from
* Mike Harris) (DG);
*/
package org.jfree.chart.annotations;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import org.jfree.chart.axis.AxisLocation;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.PlotRenderingInfo;
import org.jfree.chart.plot.XYPlot;
import org.jfree.ui.RectangleAnchor;
import org.jfree.ui.RectangleEdge;
import org.jfree.util.ObjectUtilities;
import org.jfree.util.PublicCloneable;
/**
* An annotation that allows an image to be placed at some location on
* an {@link XYPlot}.
*
* TODO: implement serialization properly (image is not serializable).
*/
public class XYImageAnnotation extends AbstractXYAnnotation
implements Cloneable, PublicCloneable, Serializable {
/** For serialization. */
private static final long serialVersionUID = -4364694501921559958L;
/** The x-coordinate (in data space). */
private double x;
/** The y-coordinate (in data space). */
private double y;
/** The image. */
private transient Image image;
/**
* The image anchor point.
*
* @since 1.0.4
*/
private RectangleAnchor anchor;
/**
* Creates a new annotation to be displayed at the specified (x, y)
* location.
*
* @param x the x-coordinate (in data space).
* @param y the y-coordinate (in data space).
* @param image the image (<code>null</code> not permitted).
*/
public XYImageAnnotation(double x, double y, Image image) {
this(x, y, image, RectangleAnchor.CENTER);
}
/**
* Creates a new annotation to be displayed at the specified (x, y)
* location.
*
* @param x the x-coordinate (in data space).
* @param y the y-coordinate (in data space).
* @param image the image (<code>null</code> not permitted).
* @param anchor the image anchor (<code>null</code> not permitted).
*
* @since 1.0.4
*/
public XYImageAnnotation(double x, double y, Image image,
RectangleAnchor anchor) {
if (image == null) {
throw new IllegalArgumentException("Null 'image' argument.");
}
if (anchor == null) {
throw new IllegalArgumentException("Null 'anchor' argument.");
}
this.x = x;
this.y = y;
this.image = image;
this.anchor = anchor;
}
/**
* Returns the x-coordinate (in data space) for the annotation.
*
* @return The x-coordinate.
*
* @since 1.0.4
*/
public double getX() {
return this.x;
}
/**
* Returns the y-coordinate (in data space) for the annotation.
*
* @return The y-coordinate.
*
* @since 1.0.4
*/
public double getY() {
return this.y;
}
/**
* Returns the image for the annotation.
*
* @return The image.
*
* @since 1.0.4
*/
public Image getImage() {
return this.image;
}
/**
* Returns the image anchor for the annotation.
*
* @return The image anchor.
*
* @since 1.0.4
*/
public RectangleAnchor getImageAnchor() {
return this.anchor;
}
/**
* Draws the annotation. This method is called by the drawing code in the
* {@link XYPlot} class, you don't normally need to call this method
* directly.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param dataArea the data area.
* @param domainAxis the domain axis.
* @param rangeAxis the range axis.
* @param rendererIndex the renderer index.
* @param info if supplied, this info object will be populated with
* entity information.
*/
public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea,
ValueAxis domainAxis, ValueAxis rangeAxis,
int rendererIndex,
PlotRenderingInfo info) {
PlotOrientation orientation = plot.getOrientation();
AxisLocation domainAxisLocation = plot.getDomainAxisLocation();
AxisLocation rangeAxisLocation = plot.getRangeAxisLocation();
RectangleEdge domainEdge
= Plot.resolveDomainAxisLocation(domainAxisLocation, orientation);
RectangleEdge rangeEdge
= Plot.resolveRangeAxisLocation(rangeAxisLocation, orientation);
float j2DX
= (float) domainAxis.valueToJava2D(this.x, dataArea, domainEdge);
float j2DY
= (float) rangeAxis.valueToJava2D(this.y, dataArea, rangeEdge);
float xx = 0.0f;
float yy = 0.0f;
if (orientation == PlotOrientation.HORIZONTAL) {
xx = j2DY;
yy = j2DX;
}
else if (orientation == PlotOrientation.VERTICAL) {
xx = j2DX;
yy = j2DY;
}
int w = this.image.getWidth(null);
int h = this.image.getHeight(null);
Rectangle2D imageRect = new Rectangle2D.Double(0, 0, w, h);
Point2D anchorPoint = RectangleAnchor.coordinates(imageRect,
this.anchor);
xx = xx - (float) anchorPoint.getX();
yy = yy - (float) anchorPoint.getY();
g2.drawImage(this.image, (int) xx, (int) yy, null);
String toolTip = getToolTipText();
String url = getURL();
if (toolTip != null || url != null) {
addEntity(info, new Rectangle2D.Float(xx, yy, w, h), rendererIndex,
toolTip, url);
}
}
/**
* Tests this object for equality with an arbitrary object.
*
* @param obj the object (<code>null</code> permitted).
*
* @return A boolean.
*/
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
// now try to reject equality...
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof XYImageAnnotation)) {
return false;
}
XYImageAnnotation that = (XYImageAnnotation) obj;
if (this.x != that.x) {
return false;
}
if (this.y != that.y) {
return false;
}
if (!ObjectUtilities.equal(this.image, that.image)) {
return false;
}
if (!this.anchor.equals(that.anchor)) {
return false;
}
// seems to be the same...
return true;
}
/**
* Returns a hash code for this object.
*
* @return A hash code.
*/
public int hashCode() {
return this.image.hashCode();
}
/**
* Returns a clone of the annotation.
*
* @return A clone.
*
* @throws CloneNotSupportedException if the annotation can't be cloned.
*/
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
/**
* Provides serialization support.
*
* @param stream the output stream.
*
* @throws IOException if there is an I/O error.
*/
private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
//SerialUtilities.writeImage(this.image, stream);
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
//this.image = SerialUtilities.readImage(stream);
}
}
| {
"pile_set_name": "Github"
} |
## Square Otto specific rules ##
## https://square.github.io/otto/ ##
-keepattributes *Annotation*
-keepclassmembers class ** {
@com.squareup.otto.Subscribe public *;
@com.squareup.otto.Produce public *;
}
| {
"pile_set_name": "Github"
} |
{
"name": "andreaskoch/dockerized-magento",
"description": "Dockerized Magento Community Edition 1.9.x",
"license": "BSD-3-Clause",
"homepage": "https://github.com/andreaskoch/dockerized-magento",
"require": {
"avstudnitz/scopehint": "^0.6",
"tim-reynolds/magento-qconfig": "1.0",
"aoepeople/aoe_scheduler": "^1",
"aschroder/smtp_pro": "^2",
"gordonlesti/lesti_fpc": "^1",
"jeroenvermeulen/solarium": "v1.6.9-beta",
"aydin-hassan/magento-core-composer-installer": "*",
"colinmollenhour/modman": "*",
"theseer/autoload": "*",
"magento/core": "^1.9"
},
"require-dev": {
"aoepeople/aoe_profiler": "v0.3.0",
"aoepeople/aoe_templatehints": "^0.4"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.firegento.com"
}
],
"extra": {
"magento-root-dir": "web",
"auto-append-gitignore": true
},
"config": {
"discard-changes": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-install-cmd": [
],
"post-update-cmd": [
]
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2014 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.
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('embedder.html', {}, function () {});
});
| {
"pile_set_name": "Github"
} |
/* TA-LIB Copyright (c) 1999-2007, Mario Fortier
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* - Neither name of author nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* REGENTS 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.
*/
/*********************************************************************
* This file contains only TA functions starting with the letter 'D' *
*********************************************************************/
#include <stddef.h>
#include "ta_abstract.h"
#include "ta_def_ui.h"
/* Follow the 3 steps defined below for adding a new TA Function to this
* file.
*/
/****************************************************************************
* Step 1 - Define here the interface to your TA functions with
* the macro DEF_FUNCTION.
*
****************************************************************************/
/* DEMA BEGIN */
static const TA_InputParameterInfo *TA_DEMA_Inputs[] =
{
&TA_DEF_UI_Input_Real,
NULL
};
static const TA_OutputParameterInfo *TA_DEMA_Outputs[] =
{
&TA_DEF_UI_Output_Real,
NULL
};
static const TA_OptInputParameterInfo *TA_DEMA_OptInputs[] =
{ &TA_DEF_UI_TimePeriod_30_MINIMUM2,
NULL
};
DEF_FUNCTION( DEMA, /* name */
TA_GroupId_OverlapStudies, /* groupId */
"Double Exponential Moving Average", /* hint */
"Dema", /* CamelCase name */
TA_FUNC_FLG_OVERLAP /* flags */
);
/* DEMA END */
/* DIV BEGIN */
DEF_MATH_BINARY_OPERATOR( DIV, "Vector Arithmetic Div", "Div" )
/* DIV END */
/* DX BEGIN */
static const TA_InputParameterInfo *TA_DX_Inputs[] =
{
&TA_DEF_UI_Input_Price_HLC,
NULL
};
static const TA_OutputParameterInfo *TA_DX_Outputs[] =
{
&TA_DEF_UI_Output_Real,
NULL
};
static const TA_OptInputParameterInfo *TA_DX_OptInputs[] =
{ &TA_DEF_UI_TimePeriod_14_MINIMUM2,
NULL
};
DEF_FUNCTION( DX, /* name */
TA_GroupId_MomentumIndicators, /* groupId */
"Directional Movement Index", /* hint */
"Dx", /* CamelCase name */
TA_FUNC_FLG_UNST_PER /* flags */
);
/* DX END */
/****************************************************************************
* Step 2 - Add your TA function to the table.
* Keep in alphabetical order. Must be NULL terminated.
****************************************************************************/
const TA_FuncDef *TA_DEF_TableD[] =
{
ADD_TO_TABLE(DEMA),
ADD_TO_TABLE(DIV),
ADD_TO_TABLE(DX),
NULL
};
/* Do not modify the following line. */
const unsigned int TA_DEF_TableDSize =
((sizeof(TA_DEF_TableD)/sizeof(TA_FuncDef *))-1);
/****************************************************************************
* Step 3 - Make sure "gen_code" is executed for generating all other
* source files derived from this one.
* You can then re-compile the library as usual and you are done!
****************************************************************************/
| {
"pile_set_name": "Github"
} |
package base
import (
"runtime"
"strings"
)
// GetInvokerLocation 用于获得调用位置。
func GetInvokerLocation(skipNumber int) (funcPath string, fileName string, line int) {
pc, file, line, ok := runtime.Caller(skipNumber)
if !ok {
return "", "", -1
}
if index := strings.LastIndex(file, "/"); index > 0 {
fileName = file[index+1 : len(file)]
}
funcPtr := runtime.FuncForPC(pc)
if funcPtr != nil {
funcPath = funcPtr.Name()
}
return funcPath, fileName, line
}
| {
"pile_set_name": "Github"
} |
// Tests that a closure which requires mutable access to the referent
// of an `&mut` requires a "unique" borrow -- that is, the variable to
// be borrowed (here, `x`) will not be borrowed *mutably*, but
// may be *immutable*, but we cannot allow
// multiple borrows.
fn get(x: &isize) -> isize {
*x
}
fn set(x: &mut isize) -> isize {
*x
}
fn a(x: &mut isize) {
let c1 = || get(x);
let c2 = || get(x);
c1();
c2();
}
fn b(x: &mut isize) {
let c1 = || get(x);
let c2 = || set(x); //~ ERROR closure requires unique access to `x`
c1;
}
fn c(x: &mut isize) {
let c1 = || get(x);
let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x`
c1;
}
fn d(x: &mut isize) {
let c1 = || set(x);
let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time
c1;
}
fn e(x: &'static mut isize) {
let c1 = |y: &'static mut isize| x = y;
//~^ ERROR cannot assign to `x`, as it is not declared as mutable
c1;
}
fn f(x: &'static mut isize) {
let c1 = || x = panic!(); // OK assignment is unreachable.
c1;
}
fn main() {
}
| {
"pile_set_name": "Github"
} |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<title>Relevant Standards - Apache HTTP Server Version 2.4</title>
<link href="../style/css/manual-zip.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-zip-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
<script src="../style/scripts/prettify.min.js" type="text/javascript">
</script>
</head>
<body id="manual-page"><div id="page-header">
<p class="menu"><a href="../mod/index.html">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
<p class="apache">Apache HTTP Server Version 2.4</p>
<img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="./index.html"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
<div id="path">
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../index.html">Version 2.4</a> > <a href="./index.html">Miscellaneous Documentation</a></div><div id="page-content"><div id="preamble"><h1>Relevant Standards</h1>
<p>This page documents all the relevant standards that the
Apache HTTP Server follows, along with brief descriptions.</p>
<p>In addition to the information listed below, the following resources
should be consulted:</p>
<ul>
<li>
<a href="http://purl.org/NET/http-errata">
http://purl.org/NET/http-errata</a> - HTTP/1.1 Specification Errata
</li>
<li>
<a href="http://www.rfc-editor.org/errata.php">
http://www.rfc-editor.org/errata.php</a> - RFC Errata
</li>
<li>
<a href="http://ftp.ics.uci.edu/pub/ietf/http/#RFC">
http://ftp.ics.uci.edu/pub/ietf/http/#RFC</a> - A pre-compiled list
of HTTP related RFCs
</li>
</ul>
<div class="warning"><h3>Notice</h3>
<p>This document is not yet complete.</p>
</div>
</div>
<div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#http_recommendations">HTTP Recommendations</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#html_recommendations">HTML Recommendations</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#authentication">Authentication</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#language_country_codes">Language/Country Codes</a></li>
</ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="http_recommendations" id="http_recommendations">HTTP Recommendations</a></h2>
<p>Regardless of what modules are compiled and used, Apache as a
basic web server complies with the following IETF recommendations:</p>
<dl>
<dt><a href="http://www.rfc-editor.org/rfc/rfc1945.txt">RFC 1945</a>
(Informational)</dt>
<dd>The Hypertext Transfer Protocol (HTTP) is an application-level
protocol with the lightness and speed necessary for distributed,
collaborative, hypermedia information systems. This documents
HTTP/1.0.</dd>
<dt><a href="http://www.rfc-editor.org/rfc/rfc2616.txt">RFC 2616</a>
(Standards Track)</dt>
<dd>The Hypertext Transfer Protocol (HTTP) is an
application-level protocol for distributed, collaborative,
hypermedia information systems. This documents HTTP/1.1.</dd>
<dt><a href="http://www.rfc-editor.org/rfc/rfc2396.txt">RFC 2396</a>
(Standards Track)</dt>
<dd>A Uniform Resource Identifier (URI) is a compact string of
characters for identifying an abstract or physical resource.</dd>
<dt><a href="http://www.rfc-editor.org/rfc/rfc4346.txt">RFC 4346</a>
(Standards Track)</dt>
<dd>The TLS protocol provides communications security over the
Internet. It provides encryption, and is designed to prevent
eavesdropping, tampering, and message forgery.</dd>
</dl>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="html_recommendations" id="html_recommendations">HTML Recommendations</a></h2>
<p>Regarding the Hypertext Markup Language, Apache complies with
the following IETF and W3C recommendations:</p>
<dl>
<dt><a href="http://www.rfc-editor.org/rfc/rfc2854.txt">RFC 2854</a>
(Informational)</dt>
<dd>This document summarizes the history of HTML development,
and defines the "text/html" MIME type by pointing to the relevant
W3C recommendations.</dd>
<dt><a href="http://www.w3.org/TR/html401">HTML 4.01 Specification</a>
(<a href="http://www.w3.org/MarkUp/html4-updates/errata">Errata</a>)
</dt>
<dd>This specification defines the HyperText Markup Language (HTML),
the publishing language of the World Wide Web. This specification
defines HTML 4.01, which is a subversion of HTML 4.</dd>
<dt><a href="http://www.w3.org/TR/REC-html32">HTML 3.2 Reference
Specification</a></dt>
<dd>The HyperText Markup Language (HTML) is a simple markup language
used to create hypertext documents that are portable from one
platform to another. HTML documents are SGML documents.</dd>
<dt><a href="http://www.w3.org/TR/xhtml11/">XHTML 1.1 -
Module-based XHTML</a>
(<a href="http://www.w3.org/MarkUp/2009/xhtml11-2nd-edition-errata.html">Errata</a>)
</dt>
<dd>This Recommendation defines a new XHTML document type
that is based upon the module framework and modules defined in
Modularization of XHTML.</dd>
<dt><a href="http://www.w3.org/TR/xhtml1">XHTML 1.0 The
Extensible HyperText Markup Language (Second Edition)</a>
(<a href="http://www.w3.org/2002/08/REC-xhtml1-20020801-errata/">Errata</a>)
</dt>
<dd>This specification defines the Second Edition of XHTML 1.0,
a reformulation of HTML 4 as an XML 1.0 application, and three
DTDs corresponding to the ones defined by HTML 4.</dd>
</dl>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="authentication" id="authentication">Authentication</a></h2>
<p>Concerning the different methods of authentication, Apache
follows the following IETF recommendations:</p>
<dl>
<dt><a href="http://www.rfc-editor.org/rfc/rfc2617.txt">RFC 2617</a>
(Standards Track)</dt>
<dd>"HTTP/1.0", includes the specification for a Basic
Access Authentication scheme.</dd>
</dl>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="language_country_codes" id="language_country_codes">Language/Country Codes</a></h2>
<p>The following links document ISO and other language and country
code information:</p>
<dl>
<dt><a href="http://www.loc.gov/standards/iso639-2/">ISO 639-2</a></dt>
<dd>ISO 639 provides two sets of language codes, one as a two-letter
code set (639-1) and another as a three-letter code set (this part
of ISO 639) for the representation of names of languages.</dd>
<dt><a href="http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html">
ISO 3166-1</a></dt>
<dd>These pages document the country names (official short names
in English) in alphabetical order as given in ISO 3166-1 and the
corresponding ISO 3166-1-alpha-2 code elements.</dd>
<dt><a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">BCP 47</a>
(Best Current Practice),
<a href="http://www.rfc-editor.org/rfc/rfc3066.txt">RFC 3066</a></dt>
<dd>This document describes a language tag for use in cases where
it is desired to indicate the language used in an information
object, how to register values for use in this language tag,
and a construct for matching such language tags.</dd>
<dt><a href="http://www.rfc-editor.org/rfc/rfc3282.txt">RFC 3282</a>
(Standards Track)</dt>
<dd>This document defines a "Content-language:" header, for use in
cases where one desires to indicate the language of something that
has RFC 822-like headers, like MIME body parts or Web documents,
and an "Accept-Language:" header for use in cases where one wishes
to indicate one's preferences with regard to language.</dd>
</dl>
</div></div>
<div id="footer">
<p class="apache">Copyright 2015 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="../mod/index.html">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
prettyPrint();
}
//--><!]]></script>
</body></html>
| {
"pile_set_name": "Github"
} |
package me.jbusdriver.mvp.bean
/**
* Created by Administrator on 2017/7/29.
*/
data class SearchWord(val query: String)
@Deprecated("not use ")
data class CollectErrorEvent(val key: String, val msg: String)
//config
data class PageChangeEvent(val mode: Int)
class MenuChangeEvent
class CategoryChangeEvent
data class BackUpEvent(var path: String, var total: Int, var index: Int)
| {
"pile_set_name": "Github"
} |
// Icon Sizes
// -------------------------
/* makes the font 33% larger relative to the icon container */
.#{$fa-css-prefix}-lg {
font-size: (4em / 3);
line-height: (3em / 4);
vertical-align: -15%;
}
.#{$fa-css-prefix}-2x { font-size: 2em; }
.#{$fa-css-prefix}-3x { font-size: 3em; }
.#{$fa-css-prefix}-4x { font-size: 4em; }
.#{$fa-css-prefix}-5x { font-size: 5em; }
| {
"pile_set_name": "Github"
} |
import { Editor } from 'mobiledoc-kit';
import Helpers from '../test-helpers';
const { test, module } = Helpers;
const cards = [{
name: 'my-card',
type: 'dom',
render() {},
edit() {}
}];
const atoms = [{
name: 'my-atom',
type: 'dom',
render() {
return document.createTextNode('my-atom');
}
}];
let editor, editorElement;
module('Acceptance: Cursor Position', {
beforeEach() {
editorElement = $('#editor')[0];
},
afterEach() {
if (editor) { editor.destroy(); }
}
});
test('cursor in a markup section reports its position correctly', assert => {
let mobiledoc = Helpers.mobiledoc.build(({post, markupSection, marker}) => {
return post([markupSection('p', [marker('abc')])]);
});
editor = new Editor({mobiledoc});
editor.render(editorElement);
Helpers.dom.moveCursorTo(editor, editorElement.firstChild.firstChild, 1);
let { range } = editor;
assert.ok(range.head.section === editor.post.sections.head,
'Cursor is positioned on first section');
assert.equal(range.head.offset, 1,
'Cursor is positioned at offset 1');
});
test('cursor blank section reports its position correctly', (assert) => {
let mobiledoc = Helpers.mobiledoc.build(({post, markupSection}) => {
return post([markupSection('p')]);
});
editor = new Editor({mobiledoc});
editor.render(editorElement);
Helpers.dom.moveCursorTo(editor, editorElement.firstChild.firstChild, 0);
let { range } = editor;
assert.positionIsEqual(range.head, editor.post.sections.head.headPosition());
});
test('cursor moved left from section after card is reported as on the card with offset 1', (assert) => {
// Cannot actually move a cursor, so just emulate what things looks like after
// the arrow key is pressed
let mobiledoc = Helpers.mobiledoc.build(({post, markupSection, cardSection}) => {
return post([cardSection('my-card'), markupSection('p')]);
});
editor = new Editor({mobiledoc, cards});
editor.render(editorElement);
Helpers.dom.moveCursorTo(editor, editorElement.firstChild.lastChild, 1);
let { range } = editor;
assert.positionIsEqual(range.head, editor.post.sections.head.toPosition(1));
});
test('cursor moved up from end of section after card is reported as on the card with offset 1', (assert) => {
// Cannot actually move a cursor, so just emulate what things looks like after
// the arrow key is pressed
let mobiledoc = Helpers.mobiledoc.build(({post, markupSection, cardSection}) => {
return post([
cardSection('my-card'),
markupSection('p')
]);
});
editor = new Editor({mobiledoc, cards});
editor.render(editorElement);
Helpers.dom.moveCursorTo(editor, editorElement.firstChild.lastChild, 0);
let { range } = editor;
assert.positionIsEqual(range.head, editor.post.sections.head.tailPosition());
});
test('cursor moved right from end of section before card is reported as on the card with offset 0', (assert) => {
// Cannot actually move a cursor, so just emulate what things looks like after
// the arrow key is pressed
let mobiledoc = Helpers.mobiledoc.build(({post, markupSection, cardSection}) => {
return post([markupSection('p'), cardSection('my-card')]);
});
editor = new Editor({mobiledoc, cards});
editor.render(editorElement);
Helpers.dom.moveCursorTo(editor, editorElement.lastChild.firstChild, 0);
let { range } = editor;
assert.positionIsEqual(range.head, editor.post.sections.tail.headPosition());
});
test('cursor moved right from end of section before card is reported as on the card with offset 0', (assert) => {
// Cannot actually move a cursor, so just emulate what things looks like after
// the arrow key is pressed
let mobiledoc = Helpers.mobiledoc.build(({post, markupSection, cardSection}) => {
return post([markupSection('p'), cardSection('my-card')]);
});
editor = new Editor({mobiledoc, cards});
editor.render(editorElement);
Helpers.dom.moveCursorTo(editor, editorElement.lastChild.firstChild, 1);
let { range } = editor;
assert.positionIsEqual(range.head, editor.post.sections.tail.headPosition());
});
test('cursor focused on card wrapper with 2 offset', (assert) => {
// Cannot actually move a cursor, so just emulate what things looks like after
// the arrow key is pressed
let mobiledoc = Helpers.mobiledoc.build(({post, markupSection, cardSection}) => {
return post([markupSection('p'), cardSection('my-card')]);
});
editor = new Editor({mobiledoc, cards});
editor.render(editorElement);
// We need to create a selection starting from the markup section's node
// in order for the tail to end up focused on a div instead of a text node
// This only happens in Firefox
Helpers.dom.moveCursorTo(editor, editorElement.firstChild.firstChild, 0,
editorElement.lastChild, 2);
let { range } = editor;
assert.positionIsEqual(range.tail, editor.post.sections.tail.tailPosition());
});
// This can happen when using arrow+shift keys to select left across a card
test('cursor focused on card wrapper with 0 offset', (assert) => {
// Cannot actually move a cursor, so just emulate what things looks like after
// the arrow key is pressed
let mobiledoc = Helpers.mobiledoc.build(({post, markupSection, cardSection}) => {
return post([markupSection('p'), cardSection('my-card')]);
});
editor = new Editor({mobiledoc, cards});
editor.render(editorElement);
// We need to create a selection starting from the markup section's node
// in order for the tail to end up focused on a div instead of a text node
Helpers.dom.moveCursorTo(editor, editorElement.firstChild.firstChild, 0,
editorElement.lastChild, 0);
let { range } = editor;
assert.positionIsEqual(range.tail, editor.post.sections.tail.headPosition());
});
// see https://github.com/bustle/mobiledoc-kit/issues/215
test('selecting the entire editor element reports a selection range of the entire post', (assert) => {
let mobiledoc = Helpers.mobiledoc.build(({post, markupSection, marker}) => {
return post([
markupSection('p', [marker('abc')]),
markupSection('p', [marker('1234')])
]);
});
editor = new Editor({mobiledoc});
editor.render(editorElement);
Helpers.dom.moveCursorTo(editor, editorElement, 0,
editorElement, editorElement.childNodes.length);
let { range } = editor;
assert.positionIsEqual(range.head, editor.post.sections.head.headPosition());
assert.positionIsEqual(range.tail, editor.post.sections.tail.tailPosition());
});
test('when at the head of an atom', assert => {
let mobiledoc = Helpers.mobiledoc.build(({post, markupSection, marker, atom}) => {
return post([markupSection('p', [
marker('aa'), atom('my-atom'), marker('cc')
])]);
});
editor = new Editor({mobiledoc, atoms});
editor.render(editorElement);
let atomWrapper = editor.post.sections.head.markers.objectAt(1).renderNode.element;
// Before zwnj
//
Helpers.dom.moveCursorTo(editor, atomWrapper.firstChild, 0);
let range = editor.range;
let positionBeforeAtom = editor.post.sections.head.toPosition('aa'.length);
assert.positionIsEqual(range.head, positionBeforeAtom);
// After zwnj
//
Helpers.dom.moveCursorTo(editor, atomWrapper.firstChild, 1);
range = editor.range;
assert.positionIsEqual(range.head, positionBeforeAtom);
// On wrapper
//
[0, 1].forEach(index => {
Helpers.dom.moveCursorTo(editor, atomWrapper, index);
range = editor.range;
assert.positionIsEqual(range.head, positionBeforeAtom);
});
// text node before wrapper
Helpers.dom.moveCursorTo(editor, atomWrapper.previousSibling, 2);
range = editor.range;
assert.positionIsEqual(range.head, positionBeforeAtom);
});
test('when at the tail of an atom', assert => {
let mobiledoc = Helpers.mobiledoc.build(({post, markupSection, marker, atom}) => {
return post([markupSection('p', [
marker('aa'), atom('my-atom'), marker('cc')
])]);
});
editor = new Editor({mobiledoc, atoms});
editor.render(editorElement);
let atomWrapper = editor.post.sections.head.markers.objectAt(1).renderNode.element;
let positionAfterAtom = editor.post.sections.head.toPosition('aa'.length + 1);
// Before zwnj
//
Helpers.dom.moveCursorTo(editor, atomWrapper.lastChild, 0);
let range = editor.range;
assert.positionIsEqual(range.head, positionAfterAtom);
// After zwnj
//
Helpers.dom.moveCursorTo(editor, atomWrapper.lastChild, 1);
range = editor.range;
assert.positionIsEqual(range.head, positionAfterAtom);
// On wrapper
//
[2, 3].forEach(index => {
Helpers.dom.moveCursorTo(editor, atomWrapper, index);
range = editor.range;
assert.positionIsEqual(range.head, positionAfterAtom);
});
// After wrapper
//
Helpers.dom.moveCursorTo(editor, atomWrapper.nextSibling, 0);
range = editor.range;
assert.positionIsEqual(range.head, positionAfterAtom);
});
| {
"pile_set_name": "Github"
} |
package main
import (
"fmt"
"os"
"github.com/pengwynn/flint/flint"
)
func main() {
app := flint.NewApp()
if err := app.Run(os.Args); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
| {
"pile_set_name": "Github"
} |
*STON-Text support
fromSton: stonReader
"Overwritten to get back the standard object behavior"
stonReader parseNamedInstVarsFor: self | {
"pile_set_name": "Github"
} |
<?php
/*
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC. All rights reserved. |
| |
| This work is published under the GNU AGPLv3 license with some |
| permitted exceptions and without any warranty. For full license |
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
class CRM_Export_StateMachine_Standalone extends CRM_Core_StateMachine {
/**
* Class constructor.
*
* @param object $controller
* @param \const|int $action
*/
public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$this->_pages = [
'CRM_Export_Form_Select' => NULL,
'CRM_Export_Form_Map' => NULL,
];
$this->addSequentialPages($this->_pages, $action);
}
/**
* @todo So far does nothing.
*
* @return string
*/
public function getTaskFormName() {
return '';
}
/**
* @todo not sure if this is needed
*/
public function shouldReset() {
return FALSE;
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners android:radius="10dp"/>
<solid android:color="#9D303132"/>
</shape>
| {
"pile_set_name": "Github"
} |
//
// ViewController.swift
// Grouping Tasks Together
//
// Created by Vandad Nahavandipoor on 7/3/14.
// Copyright (c) 2014 Pixolity Ltd. All rights reserved.
//
// These example codes are written for O'Reilly's iOS 8 Swift Programming Cookbook
// If you use these solutions in your apps, you can give attribution to
// Vandad Nahavandipoor for his work. Feel free to visit my blog
// at http://vandadnp.wordpress.com for daily tips and tricks in Swift
// and Objective-C and various other programming languages.
//
// You can purchase "iOS 8 Swift Programming Cookbook" from
// the following URL:
// http://shop.oreilly.com/product/0636920034254.do
//
// If you have any questions, you can contact me directly
// at [email protected]
// Similarly, if you find an error in these sample codes, simply
// report them to O'Reilly at the following URL:
// http://www.oreilly.com/catalog/errata.csp?isbn=0636920034254
import UIKit
class ViewController: UIViewController {
func reloadTableView(){
/* Reload the table view here */
print(__FUNCTION__)
}
func reloadScrollView(){
/* Do the work here */
print(__FUNCTION__)
}
func reloadImageView(){
/* Reload the image view here */
print(__FUNCTION__)
}
override func viewDidLoad() {
super.viewDidLoad()
let taskGroup = dispatch_group_create()
let mainQueue = dispatch_get_main_queue()
/* Reload the table view on the main queue */
dispatch_group_async(taskGroup, mainQueue, {[weak self] in
self!.reloadTableView()
});
/* Reload the scroll view on the main queue */
dispatch_group_async(taskGroup, mainQueue, {[weak self] in
self!.reloadScrollView()
});
/* Reload the image view on the main queue */
dispatch_group_async(taskGroup, mainQueue, {[weak self] in
self!.reloadImageView()
});
/* At the end when we are done, dispatch the following block */
dispatch_group_notify(taskGroup, mainQueue, {[weak self] in
/* Do some processing here */
let controller = UIAlertController(title: "Finished",
message: "All tasks are finished",
preferredStyle: .Alert)
controller.addAction(UIAlertAction(title: "OK",
style: .Default,
handler: nil))
self!.presentViewController(controller, animated: true, completion: nil)
});
}
}
| {
"pile_set_name": "Github"
} |
package jsoniter
import (
"math"
"strconv"
)
var intDigits []int8
const uint32SafeToMultiply10 = uint32(0xffffffff)/10 - 1
const uint64SafeToMultiple10 = uint64(0xffffffffffffffff)/10 - 1
func init() {
intDigits = make([]int8, 256)
for i := 0; i < len(intDigits); i++ {
intDigits[i] = invalidCharForNumber
}
for i := int8('0'); i <= int8('9'); i++ {
intDigits[i] = i - int8('0')
}
}
// ReadUint read uint
func (iter *Iterator) ReadUint() uint {
if strconv.IntSize == 32 {
return uint(iter.ReadUint32())
}
return uint(iter.ReadUint64())
}
// ReadInt read int
func (iter *Iterator) ReadInt() int {
if strconv.IntSize == 32 {
return int(iter.ReadInt32())
}
return int(iter.ReadInt64())
}
// ReadInt8 read int8
func (iter *Iterator) ReadInt8() (ret int8) {
c := iter.nextToken()
if c == '-' {
val := iter.readUint32(iter.readByte())
if val > math.MaxInt8+1 {
iter.ReportError("ReadInt8", "overflow: "+strconv.FormatInt(int64(val), 10))
return
}
return -int8(val)
}
val := iter.readUint32(c)
if val > math.MaxInt8 {
iter.ReportError("ReadInt8", "overflow: "+strconv.FormatInt(int64(val), 10))
return
}
return int8(val)
}
// ReadUint8 read uint8
func (iter *Iterator) ReadUint8() (ret uint8) {
val := iter.readUint32(iter.nextToken())
if val > math.MaxUint8 {
iter.ReportError("ReadUint8", "overflow: "+strconv.FormatInt(int64(val), 10))
return
}
return uint8(val)
}
// ReadInt16 read int16
func (iter *Iterator) ReadInt16() (ret int16) {
c := iter.nextToken()
if c == '-' {
val := iter.readUint32(iter.readByte())
if val > math.MaxInt16+1 {
iter.ReportError("ReadInt16", "overflow: "+strconv.FormatInt(int64(val), 10))
return
}
return -int16(val)
}
val := iter.readUint32(c)
if val > math.MaxInt16 {
iter.ReportError("ReadInt16", "overflow: "+strconv.FormatInt(int64(val), 10))
return
}
return int16(val)
}
// ReadUint16 read uint16
func (iter *Iterator) ReadUint16() (ret uint16) {
val := iter.readUint32(iter.nextToken())
if val > math.MaxUint16 {
iter.ReportError("ReadUint16", "overflow: "+strconv.FormatInt(int64(val), 10))
return
}
return uint16(val)
}
// ReadInt32 read int32
func (iter *Iterator) ReadInt32() (ret int32) {
c := iter.nextToken()
if c == '-' {
val := iter.readUint32(iter.readByte())
if val > math.MaxInt32+1 {
iter.ReportError("ReadInt32", "overflow: "+strconv.FormatInt(int64(val), 10))
return
}
return -int32(val)
}
val := iter.readUint32(c)
if val > math.MaxInt32 {
iter.ReportError("ReadInt32", "overflow: "+strconv.FormatInt(int64(val), 10))
return
}
return int32(val)
}
// ReadUint32 read uint32
func (iter *Iterator) ReadUint32() (ret uint32) {
return iter.readUint32(iter.nextToken())
}
func (iter *Iterator) readUint32(c byte) (ret uint32) {
ind := intDigits[c]
if ind == 0 {
iter.assertInteger()
return 0 // single zero
}
if ind == invalidCharForNumber {
iter.ReportError("readUint32", "unexpected character: "+string([]byte{byte(ind)}))
return
}
value := uint32(ind)
if iter.tail-iter.head > 10 {
i := iter.head
ind2 := intDigits[iter.buf[i]]
if ind2 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value
}
i++
ind3 := intDigits[iter.buf[i]]
if ind3 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value*10 + uint32(ind2)
}
//iter.head = i + 1
//value = value * 100 + uint32(ind2) * 10 + uint32(ind3)
i++
ind4 := intDigits[iter.buf[i]]
if ind4 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value*100 + uint32(ind2)*10 + uint32(ind3)
}
i++
ind5 := intDigits[iter.buf[i]]
if ind5 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value*1000 + uint32(ind2)*100 + uint32(ind3)*10 + uint32(ind4)
}
i++
ind6 := intDigits[iter.buf[i]]
if ind6 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value*10000 + uint32(ind2)*1000 + uint32(ind3)*100 + uint32(ind4)*10 + uint32(ind5)
}
i++
ind7 := intDigits[iter.buf[i]]
if ind7 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value*100000 + uint32(ind2)*10000 + uint32(ind3)*1000 + uint32(ind4)*100 + uint32(ind5)*10 + uint32(ind6)
}
i++
ind8 := intDigits[iter.buf[i]]
if ind8 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value*1000000 + uint32(ind2)*100000 + uint32(ind3)*10000 + uint32(ind4)*1000 + uint32(ind5)*100 + uint32(ind6)*10 + uint32(ind7)
}
i++
ind9 := intDigits[iter.buf[i]]
value = value*10000000 + uint32(ind2)*1000000 + uint32(ind3)*100000 + uint32(ind4)*10000 + uint32(ind5)*1000 + uint32(ind6)*100 + uint32(ind7)*10 + uint32(ind8)
iter.head = i
if ind9 == invalidCharForNumber {
iter.assertInteger()
return value
}
}
for {
for i := iter.head; i < iter.tail; i++ {
ind = intDigits[iter.buf[i]]
if ind == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value
}
if value > uint32SafeToMultiply10 {
value2 := (value << 3) + (value << 1) + uint32(ind)
if value2 < value {
iter.ReportError("readUint32", "overflow")
return
}
value = value2
continue
}
value = (value << 3) + (value << 1) + uint32(ind)
}
if !iter.loadMore() {
iter.assertInteger()
return value
}
}
}
// ReadInt64 read int64
func (iter *Iterator) ReadInt64() (ret int64) {
c := iter.nextToken()
if c == '-' {
val := iter.readUint64(iter.readByte())
if val > math.MaxInt64+1 {
iter.ReportError("ReadInt64", "overflow: "+strconv.FormatUint(uint64(val), 10))
return
}
return -int64(val)
}
val := iter.readUint64(c)
if val > math.MaxInt64 {
iter.ReportError("ReadInt64", "overflow: "+strconv.FormatUint(uint64(val), 10))
return
}
return int64(val)
}
// ReadUint64 read uint64
func (iter *Iterator) ReadUint64() uint64 {
return iter.readUint64(iter.nextToken())
}
func (iter *Iterator) readUint64(c byte) (ret uint64) {
ind := intDigits[c]
if ind == 0 {
iter.assertInteger()
return 0 // single zero
}
if ind == invalidCharForNumber {
iter.ReportError("readUint64", "unexpected character: "+string([]byte{byte(ind)}))
return
}
value := uint64(ind)
if iter.tail-iter.head > 10 {
i := iter.head
ind2 := intDigits[iter.buf[i]]
if ind2 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value
}
i++
ind3 := intDigits[iter.buf[i]]
if ind3 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value*10 + uint64(ind2)
}
//iter.head = i + 1
//value = value * 100 + uint32(ind2) * 10 + uint32(ind3)
i++
ind4 := intDigits[iter.buf[i]]
if ind4 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value*100 + uint64(ind2)*10 + uint64(ind3)
}
i++
ind5 := intDigits[iter.buf[i]]
if ind5 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value*1000 + uint64(ind2)*100 + uint64(ind3)*10 + uint64(ind4)
}
i++
ind6 := intDigits[iter.buf[i]]
if ind6 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value*10000 + uint64(ind2)*1000 + uint64(ind3)*100 + uint64(ind4)*10 + uint64(ind5)
}
i++
ind7 := intDigits[iter.buf[i]]
if ind7 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value*100000 + uint64(ind2)*10000 + uint64(ind3)*1000 + uint64(ind4)*100 + uint64(ind5)*10 + uint64(ind6)
}
i++
ind8 := intDigits[iter.buf[i]]
if ind8 == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value*1000000 + uint64(ind2)*100000 + uint64(ind3)*10000 + uint64(ind4)*1000 + uint64(ind5)*100 + uint64(ind6)*10 + uint64(ind7)
}
i++
ind9 := intDigits[iter.buf[i]]
value = value*10000000 + uint64(ind2)*1000000 + uint64(ind3)*100000 + uint64(ind4)*10000 + uint64(ind5)*1000 + uint64(ind6)*100 + uint64(ind7)*10 + uint64(ind8)
iter.head = i
if ind9 == invalidCharForNumber {
iter.assertInteger()
return value
}
}
for {
for i := iter.head; i < iter.tail; i++ {
ind = intDigits[iter.buf[i]]
if ind == invalidCharForNumber {
iter.head = i
iter.assertInteger()
return value
}
if value > uint64SafeToMultiple10 {
value2 := (value << 3) + (value << 1) + uint64(ind)
if value2 < value {
iter.ReportError("readUint64", "overflow")
return
}
value = value2
continue
}
value = (value << 3) + (value << 1) + uint64(ind)
}
if !iter.loadMore() {
iter.assertInteger()
return value
}
}
}
func (iter *Iterator) assertInteger() {
if iter.head < len(iter.buf) && iter.buf[iter.head] == '.' {
iter.ReportError("assertInteger", "can not decode float as int")
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build amd64,darwin
package unix
import (
"syscall"
)
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
func setTimespec(sec, nsec int64) Timespec {
return Timespec{Sec: sec, Nsec: nsec}
}
func setTimeval(sec, usec int64) Timeval {
return Timeval{Sec: sec, Usec: int32(usec)}
}
//sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error)
func Gettimeofday(tv *Timeval) (err error) {
// The tv passed to gettimeofday must be non-nil
// but is otherwise unused. The answers come back
// in the two registers.
sec, usec, err := gettimeofday(tv)
tv.Sec = sec
tv.Usec = usec
return err
}
func SetKevent(k *Kevent_t, fd, mode, flags int) {
k.Ident = uint64(fd)
k.Filter = int16(mode)
k.Flags = uint16(flags)
}
func (iov *Iovec) SetLen(length int) {
iov.Len = uint64(length)
}
func (msghdr *Msghdr) SetControllen(length int) {
msghdr.Controllen = uint32(length)
}
func (msghdr *Msghdr) SetIovlen(length int) {
msghdr.Iovlen = int32(length)
}
func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
// of darwin/amd64 the syscall is called sysctl instead of __sysctl.
const SYS___SYSCTL = SYS_SYSCTL
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
compatible = "xiaomi,mir3g-v2", "mediatek,mt7621-soc";
model = "Xiaomi Mi Router 3G v2";
aliases {
led-boot = &led_status_yellow;
led-failsafe = &led_status_yellow;
led-running = &led_status_blue;
led-upgrade = &led_status_yellow;
};
chosen {
bootargs = "console=ttyS0,115200n8";
};
leds {
compatible = "gpio-leds";
led_status_blue: status_blue {
label = "mir3gv2:blue:status";
gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
};
led_status_yellow: status_yellow {
label = "mir3gv2:yellow:status";
gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
};
&spi0 {
status = "okay";
m25p80@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <80000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "u-boot-env";
reg = <0x30000 0x10000>;
read-only;
};
partition@40000 {
label = "Bdata";
reg = <0x40000 0x10000>;
read-only;
};
factory: partition@50000 {
label = "factory";
reg = <0x50000 0x10000>;
read-only;
};
partition@60000 {
label = "crash";
reg = <0x60000 0x10000>;
read-only;
};
partition@70000 {
label = "cfg_bak";
reg = <0x70000 0x10000>;
read-only;
};
partition@80000 {
label = "overlay";
reg = <0x80000 0x100000>;
read-only;
};
firmware: partition@180000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x180000 0xe80000>;
};
};
};
};
&pcie {
status = "okay";
};
&pcie0 {
wifi@0,0 {
compatible = "pci14c3,7662";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x8000>;
ieee80211-freq-limit = <5000000 6000000>;
};
};
&pcie1 {
wifi@0,0 {
compatible = "pci14c3,7603";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0000>;
ieee80211-freq-limit = <2400000 2500000>;
};
};
ðernet {
mtd-mac-address = <&factory 0xe000>;
mediatek,portmap = "llllw";
};
&state_default {
gpio {
ralink,group = "jtag", "uart2", "uart3", "wdt";
ralink,function = "gpio";
};
};
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) STMicroelectronics 2020
*/
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/pinctrl/consumer.h>
#include <linux/regmap.h>
#include <linux/reset.h>
/* FMC2 Controller Registers */
#define FMC2_BCR1 0x0
#define FMC2_BTR1 0x4
#define FMC2_BCR(x) ((x) * 0x8 + FMC2_BCR1)
#define FMC2_BTR(x) ((x) * 0x8 + FMC2_BTR1)
#define FMC2_PCSCNTR 0x20
#define FMC2_BWTR1 0x104
#define FMC2_BWTR(x) ((x) * 0x8 + FMC2_BWTR1)
/* Register: FMC2_BCR1 */
#define FMC2_BCR1_CCLKEN BIT(20)
#define FMC2_BCR1_FMC2EN BIT(31)
/* Register: FMC2_BCRx */
#define FMC2_BCR_MBKEN BIT(0)
#define FMC2_BCR_MUXEN BIT(1)
#define FMC2_BCR_MTYP GENMASK(3, 2)
#define FMC2_BCR_MWID GENMASK(5, 4)
#define FMC2_BCR_FACCEN BIT(6)
#define FMC2_BCR_BURSTEN BIT(8)
#define FMC2_BCR_WAITPOL BIT(9)
#define FMC2_BCR_WAITCFG BIT(11)
#define FMC2_BCR_WREN BIT(12)
#define FMC2_BCR_WAITEN BIT(13)
#define FMC2_BCR_EXTMOD BIT(14)
#define FMC2_BCR_ASYNCWAIT BIT(15)
#define FMC2_BCR_CPSIZE GENMASK(18, 16)
#define FMC2_BCR_CBURSTRW BIT(19)
#define FMC2_BCR_NBLSET GENMASK(23, 22)
/* Register: FMC2_BTRx/FMC2_BWTRx */
#define FMC2_BXTR_ADDSET GENMASK(3, 0)
#define FMC2_BXTR_ADDHLD GENMASK(7, 4)
#define FMC2_BXTR_DATAST GENMASK(15, 8)
#define FMC2_BXTR_BUSTURN GENMASK(19, 16)
#define FMC2_BTR_CLKDIV GENMASK(23, 20)
#define FMC2_BTR_DATLAT GENMASK(27, 24)
#define FMC2_BXTR_ACCMOD GENMASK(29, 28)
#define FMC2_BXTR_DATAHLD GENMASK(31, 30)
/* Register: FMC2_PCSCNTR */
#define FMC2_PCSCNTR_CSCOUNT GENMASK(15, 0)
#define FMC2_PCSCNTR_CNTBEN(x) BIT((x) + 16)
#define FMC2_MAX_EBI_CE 4
#define FMC2_MAX_BANKS 5
#define FMC2_BCR_CPSIZE_0 0x0
#define FMC2_BCR_CPSIZE_128 0x1
#define FMC2_BCR_CPSIZE_256 0x2
#define FMC2_BCR_CPSIZE_512 0x3
#define FMC2_BCR_CPSIZE_1024 0x4
#define FMC2_BCR_MWID_8 0x0
#define FMC2_BCR_MWID_16 0x1
#define FMC2_BCR_MTYP_SRAM 0x0
#define FMC2_BCR_MTYP_PSRAM 0x1
#define FMC2_BCR_MTYP_NOR 0x2
#define FMC2_BXTR_EXTMOD_A 0x0
#define FMC2_BXTR_EXTMOD_B 0x1
#define FMC2_BXTR_EXTMOD_C 0x2
#define FMC2_BXTR_EXTMOD_D 0x3
#define FMC2_BCR_NBLSET_MAX 0x3
#define FMC2_BXTR_ADDSET_MAX 0xf
#define FMC2_BXTR_ADDHLD_MAX 0xf
#define FMC2_BXTR_DATAST_MAX 0xff
#define FMC2_BXTR_BUSTURN_MAX 0xf
#define FMC2_BXTR_DATAHLD_MAX 0x3
#define FMC2_BTR_CLKDIV_MAX 0xf
#define FMC2_BTR_DATLAT_MAX 0xf
#define FMC2_PCSCNTR_CSCOUNT_MAX 0xff
enum stm32_fmc2_ebi_bank {
FMC2_EBI1 = 0,
FMC2_EBI2,
FMC2_EBI3,
FMC2_EBI4,
FMC2_NAND
};
enum stm32_fmc2_ebi_register_type {
FMC2_REG_BCR = 1,
FMC2_REG_BTR,
FMC2_REG_BWTR,
FMC2_REG_PCSCNTR
};
enum stm32_fmc2_ebi_transaction_type {
FMC2_ASYNC_MODE_1_SRAM = 0,
FMC2_ASYNC_MODE_1_PSRAM,
FMC2_ASYNC_MODE_A_SRAM,
FMC2_ASYNC_MODE_A_PSRAM,
FMC2_ASYNC_MODE_2_NOR,
FMC2_ASYNC_MODE_B_NOR,
FMC2_ASYNC_MODE_C_NOR,
FMC2_ASYNC_MODE_D_NOR,
FMC2_SYNC_READ_SYNC_WRITE_PSRAM,
FMC2_SYNC_READ_ASYNC_WRITE_PSRAM,
FMC2_SYNC_READ_SYNC_WRITE_NOR,
FMC2_SYNC_READ_ASYNC_WRITE_NOR
};
enum stm32_fmc2_ebi_buswidth {
FMC2_BUSWIDTH_8 = 8,
FMC2_BUSWIDTH_16 = 16
};
enum stm32_fmc2_ebi_cpsize {
FMC2_CPSIZE_0 = 0,
FMC2_CPSIZE_128 = 128,
FMC2_CPSIZE_256 = 256,
FMC2_CPSIZE_512 = 512,
FMC2_CPSIZE_1024 = 1024
};
struct stm32_fmc2_ebi {
struct device *dev;
struct clk *clk;
struct regmap *regmap;
u8 bank_assigned;
u32 bcr[FMC2_MAX_EBI_CE];
u32 btr[FMC2_MAX_EBI_CE];
u32 bwtr[FMC2_MAX_EBI_CE];
u32 pcscntr;
};
/*
* struct stm32_fmc2_prop - STM32 FMC2 EBI property
* @name: the device tree binding name of the property
* @bprop: indicate that it is a boolean property
* @mprop: indicate that it is a mandatory property
* @reg_type: the register that have to be modified
* @reg_mask: the bit that have to be modified in the selected register
* in case of it is a boolean property
* @reset_val: the default value that have to be set in case the property
* has not been defined in the device tree
* @check: this callback ckecks that the property is compliant with the
* transaction type selected
* @calculate: this callback is called to calculate for exemple a timing
* set in nanoseconds in the device tree in clock cycles or in
* clock period
* @set: this callback applies the values in the registers
*/
struct stm32_fmc2_prop {
const char *name;
bool bprop;
bool mprop;
int reg_type;
u32 reg_mask;
u32 reset_val;
int (*check)(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop, int cs);
u32 (*calculate)(struct stm32_fmc2_ebi *ebi, int cs, u32 setup);
int (*set)(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup);
};
static int stm32_fmc2_ebi_check_mux(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs)
{
u32 bcr;
regmap_read(ebi->regmap, FMC2_BCR(cs), &bcr);
if (bcr & FMC2_BCR_MTYP)
return 0;
return -EINVAL;
}
static int stm32_fmc2_ebi_check_waitcfg(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs)
{
u32 bcr, val = FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_NOR);
regmap_read(ebi->regmap, FMC2_BCR(cs), &bcr);
if ((bcr & FMC2_BCR_MTYP) == val && bcr & FMC2_BCR_BURSTEN)
return 0;
return -EINVAL;
}
static int stm32_fmc2_ebi_check_sync_trans(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs)
{
u32 bcr;
regmap_read(ebi->regmap, FMC2_BCR(cs), &bcr);
if (bcr & FMC2_BCR_BURSTEN)
return 0;
return -EINVAL;
}
static int stm32_fmc2_ebi_check_async_trans(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs)
{
u32 bcr;
regmap_read(ebi->regmap, FMC2_BCR(cs), &bcr);
if (!(bcr & FMC2_BCR_BURSTEN) || !(bcr & FMC2_BCR_CBURSTRW))
return 0;
return -EINVAL;
}
static int stm32_fmc2_ebi_check_cpsize(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs)
{
u32 bcr, val = FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_PSRAM);
regmap_read(ebi->regmap, FMC2_BCR(cs), &bcr);
if ((bcr & FMC2_BCR_MTYP) == val && bcr & FMC2_BCR_BURSTEN)
return 0;
return -EINVAL;
}
static int stm32_fmc2_ebi_check_address_hold(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs)
{
u32 bcr, bxtr, val = FIELD_PREP(FMC2_BXTR_ACCMOD, FMC2_BXTR_EXTMOD_D);
regmap_read(ebi->regmap, FMC2_BCR(cs), &bcr);
if (prop->reg_type == FMC2_REG_BWTR)
regmap_read(ebi->regmap, FMC2_BWTR(cs), &bxtr);
else
regmap_read(ebi->regmap, FMC2_BTR(cs), &bxtr);
if ((!(bcr & FMC2_BCR_BURSTEN) || !(bcr & FMC2_BCR_CBURSTRW)) &&
((bxtr & FMC2_BXTR_ACCMOD) == val || bcr & FMC2_BCR_MUXEN))
return 0;
return -EINVAL;
}
static int stm32_fmc2_ebi_check_clk_period(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs)
{
u32 bcr, bcr1;
regmap_read(ebi->regmap, FMC2_BCR(cs), &bcr);
if (cs)
regmap_read(ebi->regmap, FMC2_BCR1, &bcr1);
else
bcr1 = bcr;
if (bcr & FMC2_BCR_BURSTEN && (!cs || !(bcr1 & FMC2_BCR1_CCLKEN)))
return 0;
return -EINVAL;
}
static int stm32_fmc2_ebi_check_cclk(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs)
{
if (cs)
return -EINVAL;
return stm32_fmc2_ebi_check_sync_trans(ebi, prop, cs);
}
static u32 stm32_fmc2_ebi_ns_to_clock_cycles(struct stm32_fmc2_ebi *ebi,
int cs, u32 setup)
{
unsigned long hclk = clk_get_rate(ebi->clk);
unsigned long hclkp = NSEC_PER_SEC / (hclk / 1000);
return DIV_ROUND_UP(setup * 1000, hclkp);
}
static u32 stm32_fmc2_ebi_ns_to_clk_period(struct stm32_fmc2_ebi *ebi,
int cs, u32 setup)
{
u32 nb_clk_cycles = stm32_fmc2_ebi_ns_to_clock_cycles(ebi, cs, setup);
u32 bcr, btr, clk_period;
regmap_read(ebi->regmap, FMC2_BCR1, &bcr);
if (bcr & FMC2_BCR1_CCLKEN || !cs)
regmap_read(ebi->regmap, FMC2_BTR1, &btr);
else
regmap_read(ebi->regmap, FMC2_BTR(cs), &btr);
clk_period = FIELD_GET(FMC2_BTR_CLKDIV, btr) + 1;
return DIV_ROUND_UP(nb_clk_cycles, clk_period);
}
static int stm32_fmc2_ebi_get_reg(int reg_type, int cs, u32 *reg)
{
switch (reg_type) {
case FMC2_REG_BCR:
*reg = FMC2_BCR(cs);
break;
case FMC2_REG_BTR:
*reg = FMC2_BTR(cs);
break;
case FMC2_REG_BWTR:
*reg = FMC2_BWTR(cs);
break;
case FMC2_REG_PCSCNTR:
*reg = FMC2_PCSCNTR;
break;
default:
return -EINVAL;
}
return 0;
}
static int stm32_fmc2_ebi_set_bit_field(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 reg;
int ret;
ret = stm32_fmc2_ebi_get_reg(prop->reg_type, cs, ®);
if (ret)
return ret;
regmap_update_bits(ebi->regmap, reg, prop->reg_mask,
setup ? prop->reg_mask : 0);
return 0;
}
static int stm32_fmc2_ebi_set_trans_type(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 bcr_mask, bcr = FMC2_BCR_WREN;
u32 btr_mask, btr = 0;
u32 bwtr_mask, bwtr = 0;
bwtr_mask = FMC2_BXTR_ACCMOD;
btr_mask = FMC2_BXTR_ACCMOD;
bcr_mask = FMC2_BCR_MUXEN | FMC2_BCR_MTYP | FMC2_BCR_FACCEN |
FMC2_BCR_WREN | FMC2_BCR_WAITEN | FMC2_BCR_BURSTEN |
FMC2_BCR_EXTMOD | FMC2_BCR_CBURSTRW;
switch (setup) {
case FMC2_ASYNC_MODE_1_SRAM:
bcr |= FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_SRAM);
/*
* MUXEN = 0, MTYP = 0, FACCEN = 0, BURSTEN = 0, WAITEN = 0,
* WREN = 1, EXTMOD = 0, CBURSTRW = 0, ACCMOD = 0
*/
break;
case FMC2_ASYNC_MODE_1_PSRAM:
/*
* MUXEN = 0, MTYP = 1, FACCEN = 0, BURSTEN = 0, WAITEN = 0,
* WREN = 1, EXTMOD = 0, CBURSTRW = 0, ACCMOD = 0
*/
bcr |= FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_PSRAM);
break;
case FMC2_ASYNC_MODE_A_SRAM:
/*
* MUXEN = 0, MTYP = 0, FACCEN = 0, BURSTEN = 0, WAITEN = 0,
* WREN = 1, EXTMOD = 1, CBURSTRW = 0, ACCMOD = 0
*/
bcr |= FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_SRAM);
bcr |= FMC2_BCR_EXTMOD;
btr |= FIELD_PREP(FMC2_BXTR_ACCMOD, FMC2_BXTR_EXTMOD_A);
bwtr |= FIELD_PREP(FMC2_BXTR_ACCMOD, FMC2_BXTR_EXTMOD_A);
break;
case FMC2_ASYNC_MODE_A_PSRAM:
/*
* MUXEN = 0, MTYP = 1, FACCEN = 0, BURSTEN = 0, WAITEN = 0,
* WREN = 1, EXTMOD = 1, CBURSTRW = 0, ACCMOD = 0
*/
bcr |= FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_PSRAM);
bcr |= FMC2_BCR_EXTMOD;
btr |= FIELD_PREP(FMC2_BXTR_ACCMOD, FMC2_BXTR_EXTMOD_A);
bwtr |= FIELD_PREP(FMC2_BXTR_ACCMOD, FMC2_BXTR_EXTMOD_A);
break;
case FMC2_ASYNC_MODE_2_NOR:
/*
* MUXEN = 0, MTYP = 2, FACCEN = 1, BURSTEN = 0, WAITEN = 0,
* WREN = 1, EXTMOD = 0, CBURSTRW = 0, ACCMOD = 0
*/
bcr |= FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_NOR);
bcr |= FMC2_BCR_FACCEN;
break;
case FMC2_ASYNC_MODE_B_NOR:
/*
* MUXEN = 0, MTYP = 2, FACCEN = 1, BURSTEN = 0, WAITEN = 0,
* WREN = 1, EXTMOD = 1, CBURSTRW = 0, ACCMOD = 1
*/
bcr |= FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_NOR);
bcr |= FMC2_BCR_FACCEN | FMC2_BCR_EXTMOD;
btr |= FIELD_PREP(FMC2_BXTR_ACCMOD, FMC2_BXTR_EXTMOD_B);
bwtr |= FIELD_PREP(FMC2_BXTR_ACCMOD, FMC2_BXTR_EXTMOD_B);
break;
case FMC2_ASYNC_MODE_C_NOR:
/*
* MUXEN = 0, MTYP = 2, FACCEN = 1, BURSTEN = 0, WAITEN = 0,
* WREN = 1, EXTMOD = 1, CBURSTRW = 0, ACCMOD = 2
*/
bcr |= FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_NOR);
bcr |= FMC2_BCR_FACCEN | FMC2_BCR_EXTMOD;
btr |= FIELD_PREP(FMC2_BXTR_ACCMOD, FMC2_BXTR_EXTMOD_C);
bwtr |= FIELD_PREP(FMC2_BXTR_ACCMOD, FMC2_BXTR_EXTMOD_C);
break;
case FMC2_ASYNC_MODE_D_NOR:
/*
* MUXEN = 0, MTYP = 2, FACCEN = 1, BURSTEN = 0, WAITEN = 0,
* WREN = 1, EXTMOD = 1, CBURSTRW = 0, ACCMOD = 3
*/
bcr |= FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_NOR);
bcr |= FMC2_BCR_FACCEN | FMC2_BCR_EXTMOD;
btr |= FIELD_PREP(FMC2_BXTR_ACCMOD, FMC2_BXTR_EXTMOD_D);
bwtr |= FIELD_PREP(FMC2_BXTR_ACCMOD, FMC2_BXTR_EXTMOD_D);
break;
case FMC2_SYNC_READ_SYNC_WRITE_PSRAM:
/*
* MUXEN = 0, MTYP = 1, FACCEN = 0, BURSTEN = 1, WAITEN = 0,
* WREN = 1, EXTMOD = 0, CBURSTRW = 1, ACCMOD = 0
*/
bcr |= FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_PSRAM);
bcr |= FMC2_BCR_BURSTEN | FMC2_BCR_CBURSTRW;
break;
case FMC2_SYNC_READ_ASYNC_WRITE_PSRAM:
/*
* MUXEN = 0, MTYP = 1, FACCEN = 0, BURSTEN = 1, WAITEN = 0,
* WREN = 1, EXTMOD = 0, CBURSTRW = 0, ACCMOD = 0
*/
bcr |= FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_PSRAM);
bcr |= FMC2_BCR_BURSTEN;
break;
case FMC2_SYNC_READ_SYNC_WRITE_NOR:
/*
* MUXEN = 0, MTYP = 2, FACCEN = 1, BURSTEN = 1, WAITEN = 0,
* WREN = 1, EXTMOD = 0, CBURSTRW = 1, ACCMOD = 0
*/
bcr |= FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_NOR);
bcr |= FMC2_BCR_FACCEN | FMC2_BCR_BURSTEN | FMC2_BCR_CBURSTRW;
break;
case FMC2_SYNC_READ_ASYNC_WRITE_NOR:
/*
* MUXEN = 0, MTYP = 2, FACCEN = 1, BURSTEN = 1, WAITEN = 0,
* WREN = 1, EXTMOD = 0, CBURSTRW = 0, ACCMOD = 0
*/
bcr |= FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_NOR);
bcr |= FMC2_BCR_FACCEN | FMC2_BCR_BURSTEN;
break;
default:
/* Type of transaction not supported */
return -EINVAL;
}
if (bcr & FMC2_BCR_EXTMOD)
regmap_update_bits(ebi->regmap, FMC2_BWTR(cs),
bwtr_mask, bwtr);
regmap_update_bits(ebi->regmap, FMC2_BTR(cs), btr_mask, btr);
regmap_update_bits(ebi->regmap, FMC2_BCR(cs), bcr_mask, bcr);
return 0;
}
static int stm32_fmc2_ebi_set_buswidth(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 val;
switch (setup) {
case FMC2_BUSWIDTH_8:
val = FIELD_PREP(FMC2_BCR_MWID, FMC2_BCR_MWID_8);
break;
case FMC2_BUSWIDTH_16:
val = FIELD_PREP(FMC2_BCR_MWID, FMC2_BCR_MWID_16);
break;
default:
/* Buswidth not supported */
return -EINVAL;
}
regmap_update_bits(ebi->regmap, FMC2_BCR(cs), FMC2_BCR_MWID, val);
return 0;
}
static int stm32_fmc2_ebi_set_cpsize(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 val;
switch (setup) {
case FMC2_CPSIZE_0:
val = FIELD_PREP(FMC2_BCR_CPSIZE, FMC2_BCR_CPSIZE_0);
break;
case FMC2_CPSIZE_128:
val = FIELD_PREP(FMC2_BCR_CPSIZE, FMC2_BCR_CPSIZE_128);
break;
case FMC2_CPSIZE_256:
val = FIELD_PREP(FMC2_BCR_CPSIZE, FMC2_BCR_CPSIZE_256);
break;
case FMC2_CPSIZE_512:
val = FIELD_PREP(FMC2_BCR_CPSIZE, FMC2_BCR_CPSIZE_512);
break;
case FMC2_CPSIZE_1024:
val = FIELD_PREP(FMC2_BCR_CPSIZE, FMC2_BCR_CPSIZE_1024);
break;
default:
/* Cpsize not supported */
return -EINVAL;
}
regmap_update_bits(ebi->regmap, FMC2_BCR(cs), FMC2_BCR_CPSIZE, val);
return 0;
}
static int stm32_fmc2_ebi_set_bl_setup(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 val;
val = min_t(u32, setup, FMC2_BCR_NBLSET_MAX);
val = FIELD_PREP(FMC2_BCR_NBLSET, val);
regmap_update_bits(ebi->regmap, FMC2_BCR(cs), FMC2_BCR_NBLSET, val);
return 0;
}
static int stm32_fmc2_ebi_set_address_setup(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 bcr, bxtr, reg;
u32 val = FIELD_PREP(FMC2_BXTR_ACCMOD, FMC2_BXTR_EXTMOD_D);
int ret;
ret = stm32_fmc2_ebi_get_reg(prop->reg_type, cs, ®);
if (ret)
return ret;
regmap_read(ebi->regmap, FMC2_BCR(cs), &bcr);
if (prop->reg_type == FMC2_REG_BWTR)
regmap_read(ebi->regmap, FMC2_BWTR(cs), &bxtr);
else
regmap_read(ebi->regmap, FMC2_BTR(cs), &bxtr);
if ((bxtr & FMC2_BXTR_ACCMOD) == val || bcr & FMC2_BCR_MUXEN)
val = clamp_val(setup, 1, FMC2_BXTR_ADDSET_MAX);
else
val = min_t(u32, setup, FMC2_BXTR_ADDSET_MAX);
val = FIELD_PREP(FMC2_BXTR_ADDSET, val);
regmap_update_bits(ebi->regmap, reg, FMC2_BXTR_ADDSET, val);
return 0;
}
static int stm32_fmc2_ebi_set_address_hold(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 val, reg;
int ret;
ret = stm32_fmc2_ebi_get_reg(prop->reg_type, cs, ®);
if (ret)
return ret;
val = clamp_val(setup, 1, FMC2_BXTR_ADDHLD_MAX);
val = FIELD_PREP(FMC2_BXTR_ADDHLD, val);
regmap_update_bits(ebi->regmap, reg, FMC2_BXTR_ADDHLD, val);
return 0;
}
static int stm32_fmc2_ebi_set_data_setup(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 val, reg;
int ret;
ret = stm32_fmc2_ebi_get_reg(prop->reg_type, cs, ®);
if (ret)
return ret;
val = clamp_val(setup, 1, FMC2_BXTR_DATAST_MAX);
val = FIELD_PREP(FMC2_BXTR_DATAST, val);
regmap_update_bits(ebi->regmap, reg, FMC2_BXTR_DATAST, val);
return 0;
}
static int stm32_fmc2_ebi_set_bus_turnaround(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 val, reg;
int ret;
ret = stm32_fmc2_ebi_get_reg(prop->reg_type, cs, ®);
if (ret)
return ret;
val = setup ? min_t(u32, setup - 1, FMC2_BXTR_BUSTURN_MAX) : 0;
val = FIELD_PREP(FMC2_BXTR_BUSTURN, val);
regmap_update_bits(ebi->regmap, reg, FMC2_BXTR_BUSTURN, val);
return 0;
}
static int stm32_fmc2_ebi_set_data_hold(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 val, reg;
int ret;
ret = stm32_fmc2_ebi_get_reg(prop->reg_type, cs, ®);
if (ret)
return ret;
if (prop->reg_type == FMC2_REG_BWTR)
val = setup ? min_t(u32, setup - 1, FMC2_BXTR_DATAHLD_MAX) : 0;
else
val = min_t(u32, setup, FMC2_BXTR_DATAHLD_MAX);
val = FIELD_PREP(FMC2_BXTR_DATAHLD, val);
regmap_update_bits(ebi->regmap, reg, FMC2_BXTR_DATAHLD, val);
return 0;
}
static int stm32_fmc2_ebi_set_clk_period(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 val;
val = setup ? clamp_val(setup - 1, 1, FMC2_BTR_CLKDIV_MAX) : 1;
val = FIELD_PREP(FMC2_BTR_CLKDIV, val);
regmap_update_bits(ebi->regmap, FMC2_BTR(cs), FMC2_BTR_CLKDIV, val);
return 0;
}
static int stm32_fmc2_ebi_set_data_latency(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 val;
val = setup > 1 ? min_t(u32, setup - 2, FMC2_BTR_DATLAT_MAX) : 0;
val = FIELD_PREP(FMC2_BTR_DATLAT, val);
regmap_update_bits(ebi->regmap, FMC2_BTR(cs), FMC2_BTR_DATLAT, val);
return 0;
}
static int stm32_fmc2_ebi_set_max_low_pulse(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup)
{
u32 old_val, new_val, pcscntr;
if (setup < 1)
return 0;
regmap_read(ebi->regmap, FMC2_PCSCNTR, &pcscntr);
/* Enable counter for the bank */
regmap_update_bits(ebi->regmap, FMC2_PCSCNTR,
FMC2_PCSCNTR_CNTBEN(cs),
FMC2_PCSCNTR_CNTBEN(cs));
new_val = min_t(u32, setup - 1, FMC2_PCSCNTR_CSCOUNT_MAX);
old_val = FIELD_GET(FMC2_PCSCNTR_CSCOUNT, pcscntr);
if (old_val && new_val > old_val)
/* Keep current counter value */
return 0;
new_val = FIELD_PREP(FMC2_PCSCNTR_CSCOUNT, new_val);
regmap_update_bits(ebi->regmap, FMC2_PCSCNTR,
FMC2_PCSCNTR_CSCOUNT, new_val);
return 0;
}
static const struct stm32_fmc2_prop stm32_fmc2_child_props[] = {
/* st,fmc2-ebi-cs-trans-type must be the first property */
{
.name = "st,fmc2-ebi-cs-transaction-type",
.mprop = true,
.set = stm32_fmc2_ebi_set_trans_type,
},
{
.name = "st,fmc2-ebi-cs-cclk-enable",
.bprop = true,
.reg_type = FMC2_REG_BCR,
.reg_mask = FMC2_BCR1_CCLKEN,
.check = stm32_fmc2_ebi_check_cclk,
.set = stm32_fmc2_ebi_set_bit_field,
},
{
.name = "st,fmc2-ebi-cs-mux-enable",
.bprop = true,
.reg_type = FMC2_REG_BCR,
.reg_mask = FMC2_BCR_MUXEN,
.check = stm32_fmc2_ebi_check_mux,
.set = stm32_fmc2_ebi_set_bit_field,
},
{
.name = "st,fmc2-ebi-cs-buswidth",
.reset_val = FMC2_BUSWIDTH_16,
.set = stm32_fmc2_ebi_set_buswidth,
},
{
.name = "st,fmc2-ebi-cs-waitpol-high",
.bprop = true,
.reg_type = FMC2_REG_BCR,
.reg_mask = FMC2_BCR_WAITPOL,
.set = stm32_fmc2_ebi_set_bit_field,
},
{
.name = "st,fmc2-ebi-cs-waitcfg-enable",
.bprop = true,
.reg_type = FMC2_REG_BCR,
.reg_mask = FMC2_BCR_WAITCFG,
.check = stm32_fmc2_ebi_check_waitcfg,
.set = stm32_fmc2_ebi_set_bit_field,
},
{
.name = "st,fmc2-ebi-cs-wait-enable",
.bprop = true,
.reg_type = FMC2_REG_BCR,
.reg_mask = FMC2_BCR_WAITEN,
.check = stm32_fmc2_ebi_check_sync_trans,
.set = stm32_fmc2_ebi_set_bit_field,
},
{
.name = "st,fmc2-ebi-cs-asyncwait-enable",
.bprop = true,
.reg_type = FMC2_REG_BCR,
.reg_mask = FMC2_BCR_ASYNCWAIT,
.check = stm32_fmc2_ebi_check_async_trans,
.set = stm32_fmc2_ebi_set_bit_field,
},
{
.name = "st,fmc2-ebi-cs-cpsize",
.check = stm32_fmc2_ebi_check_cpsize,
.set = stm32_fmc2_ebi_set_cpsize,
},
{
.name = "st,fmc2-ebi-cs-byte-lane-setup-ns",
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_bl_setup,
},
{
.name = "st,fmc2-ebi-cs-address-setup-ns",
.reg_type = FMC2_REG_BTR,
.reset_val = FMC2_BXTR_ADDSET_MAX,
.check = stm32_fmc2_ebi_check_async_trans,
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_address_setup,
},
{
.name = "st,fmc2-ebi-cs-address-hold-ns",
.reg_type = FMC2_REG_BTR,
.reset_val = FMC2_BXTR_ADDHLD_MAX,
.check = stm32_fmc2_ebi_check_address_hold,
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_address_hold,
},
{
.name = "st,fmc2-ebi-cs-data-setup-ns",
.reg_type = FMC2_REG_BTR,
.reset_val = FMC2_BXTR_DATAST_MAX,
.check = stm32_fmc2_ebi_check_async_trans,
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_data_setup,
},
{
.name = "st,fmc2-ebi-cs-bus-turnaround-ns",
.reg_type = FMC2_REG_BTR,
.reset_val = FMC2_BXTR_BUSTURN_MAX + 1,
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_bus_turnaround,
},
{
.name = "st,fmc2-ebi-cs-data-hold-ns",
.reg_type = FMC2_REG_BTR,
.check = stm32_fmc2_ebi_check_async_trans,
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_data_hold,
},
{
.name = "st,fmc2-ebi-cs-clk-period-ns",
.reset_val = FMC2_BTR_CLKDIV_MAX + 1,
.check = stm32_fmc2_ebi_check_clk_period,
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_clk_period,
},
{
.name = "st,fmc2-ebi-cs-data-latency-ns",
.check = stm32_fmc2_ebi_check_sync_trans,
.calculate = stm32_fmc2_ebi_ns_to_clk_period,
.set = stm32_fmc2_ebi_set_data_latency,
},
{
.name = "st,fmc2-ebi-cs-write-address-setup-ns",
.reg_type = FMC2_REG_BWTR,
.reset_val = FMC2_BXTR_ADDSET_MAX,
.check = stm32_fmc2_ebi_check_async_trans,
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_address_setup,
},
{
.name = "st,fmc2-ebi-cs-write-address-hold-ns",
.reg_type = FMC2_REG_BWTR,
.reset_val = FMC2_BXTR_ADDHLD_MAX,
.check = stm32_fmc2_ebi_check_address_hold,
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_address_hold,
},
{
.name = "st,fmc2-ebi-cs-write-data-setup-ns",
.reg_type = FMC2_REG_BWTR,
.reset_val = FMC2_BXTR_DATAST_MAX,
.check = stm32_fmc2_ebi_check_async_trans,
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_data_setup,
},
{
.name = "st,fmc2-ebi-cs-write-bus-turnaround-ns",
.reg_type = FMC2_REG_BWTR,
.reset_val = FMC2_BXTR_BUSTURN_MAX + 1,
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_bus_turnaround,
},
{
.name = "st,fmc2-ebi-cs-write-data-hold-ns",
.reg_type = FMC2_REG_BWTR,
.check = stm32_fmc2_ebi_check_async_trans,
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_data_hold,
},
{
.name = "st,fmc2-ebi-cs-max-low-pulse-ns",
.calculate = stm32_fmc2_ebi_ns_to_clock_cycles,
.set = stm32_fmc2_ebi_set_max_low_pulse,
},
};
static int stm32_fmc2_ebi_parse_prop(struct stm32_fmc2_ebi *ebi,
struct device_node *dev_node,
const struct stm32_fmc2_prop *prop,
int cs)
{
struct device *dev = ebi->dev;
u32 setup = 0;
if (!prop->set) {
dev_err(dev, "property %s is not well defined\n", prop->name);
return -EINVAL;
}
if (prop->check && prop->check(ebi, prop, cs))
/* Skeep this property */
return 0;
if (prop->bprop) {
bool bprop;
bprop = of_property_read_bool(dev_node, prop->name);
if (prop->mprop && !bprop) {
dev_err(dev, "mandatory property %s not defined in the device tree\n",
prop->name);
return -EINVAL;
}
if (bprop)
setup = 1;
} else {
u32 val;
int ret;
ret = of_property_read_u32(dev_node, prop->name, &val);
if (prop->mprop && ret) {
dev_err(dev, "mandatory property %s not defined in the device tree\n",
prop->name);
return ret;
}
if (ret)
setup = prop->reset_val;
else if (prop->calculate)
setup = prop->calculate(ebi, cs, val);
else
setup = val;
}
return prop->set(ebi, prop, cs, setup);
}
static void stm32_fmc2_ebi_enable_bank(struct stm32_fmc2_ebi *ebi, int cs)
{
regmap_update_bits(ebi->regmap, FMC2_BCR(cs),
FMC2_BCR_MBKEN, FMC2_BCR_MBKEN);
}
static void stm32_fmc2_ebi_disable_bank(struct stm32_fmc2_ebi *ebi, int cs)
{
regmap_update_bits(ebi->regmap, FMC2_BCR(cs), FMC2_BCR_MBKEN, 0);
}
static void stm32_fmc2_ebi_save_setup(struct stm32_fmc2_ebi *ebi)
{
unsigned int cs;
for (cs = 0; cs < FMC2_MAX_EBI_CE; cs++) {
regmap_read(ebi->regmap, FMC2_BCR(cs), &ebi->bcr[cs]);
regmap_read(ebi->regmap, FMC2_BTR(cs), &ebi->btr[cs]);
regmap_read(ebi->regmap, FMC2_BWTR(cs), &ebi->bwtr[cs]);
}
regmap_read(ebi->regmap, FMC2_PCSCNTR, &ebi->pcscntr);
}
static void stm32_fmc2_ebi_set_setup(struct stm32_fmc2_ebi *ebi)
{
unsigned int cs;
for (cs = 0; cs < FMC2_MAX_EBI_CE; cs++) {
regmap_write(ebi->regmap, FMC2_BCR(cs), ebi->bcr[cs]);
regmap_write(ebi->regmap, FMC2_BTR(cs), ebi->btr[cs]);
regmap_write(ebi->regmap, FMC2_BWTR(cs), ebi->bwtr[cs]);
}
regmap_write(ebi->regmap, FMC2_PCSCNTR, ebi->pcscntr);
}
static void stm32_fmc2_ebi_disable_banks(struct stm32_fmc2_ebi *ebi)
{
unsigned int cs;
for (cs = 0; cs < FMC2_MAX_EBI_CE; cs++) {
if (!(ebi->bank_assigned & BIT(cs)))
continue;
stm32_fmc2_ebi_disable_bank(ebi, cs);
}
}
/* NWAIT signal can not be connected to EBI controller and NAND controller */
static bool stm32_fmc2_ebi_nwait_used_by_ctrls(struct stm32_fmc2_ebi *ebi)
{
unsigned int cs;
u32 bcr;
for (cs = 0; cs < FMC2_MAX_EBI_CE; cs++) {
if (!(ebi->bank_assigned & BIT(cs)))
continue;
regmap_read(ebi->regmap, FMC2_BCR(cs), &bcr);
if ((bcr & FMC2_BCR_WAITEN || bcr & FMC2_BCR_ASYNCWAIT) &&
ebi->bank_assigned & BIT(FMC2_NAND))
return true;
}
return false;
}
static void stm32_fmc2_ebi_enable(struct stm32_fmc2_ebi *ebi)
{
regmap_update_bits(ebi->regmap, FMC2_BCR1,
FMC2_BCR1_FMC2EN, FMC2_BCR1_FMC2EN);
}
static void stm32_fmc2_ebi_disable(struct stm32_fmc2_ebi *ebi)
{
regmap_update_bits(ebi->regmap, FMC2_BCR1, FMC2_BCR1_FMC2EN, 0);
}
static int stm32_fmc2_ebi_setup_cs(struct stm32_fmc2_ebi *ebi,
struct device_node *dev_node,
u32 cs)
{
unsigned int i;
int ret;
stm32_fmc2_ebi_disable_bank(ebi, cs);
for (i = 0; i < ARRAY_SIZE(stm32_fmc2_child_props); i++) {
const struct stm32_fmc2_prop *p = &stm32_fmc2_child_props[i];
ret = stm32_fmc2_ebi_parse_prop(ebi, dev_node, p, cs);
if (ret) {
dev_err(ebi->dev, "property %s could not be set: %d\n",
p->name, ret);
return ret;
}
}
stm32_fmc2_ebi_enable_bank(ebi, cs);
return 0;
}
static int stm32_fmc2_ebi_parse_dt(struct stm32_fmc2_ebi *ebi)
{
struct device *dev = ebi->dev;
struct device_node *child;
bool child_found = false;
u32 bank;
int ret;
for_each_available_child_of_node(dev->of_node, child) {
ret = of_property_read_u32(child, "reg", &bank);
if (ret) {
dev_err(dev, "could not retrieve reg property: %d\n",
ret);
return ret;
}
if (bank >= FMC2_MAX_BANKS) {
dev_err(dev, "invalid reg value: %d\n", bank);
return -EINVAL;
}
if (ebi->bank_assigned & BIT(bank)) {
dev_err(dev, "bank already assigned: %d\n", bank);
return -EINVAL;
}
if (bank < FMC2_MAX_EBI_CE) {
ret = stm32_fmc2_ebi_setup_cs(ebi, child, bank);
if (ret) {
dev_err(dev, "setup chip select %d failed: %d\n",
bank, ret);
return ret;
}
}
ebi->bank_assigned |= BIT(bank);
child_found = true;
}
if (!child_found) {
dev_warn(dev, "no subnodes found, disable the driver.\n");
return -ENODEV;
}
if (stm32_fmc2_ebi_nwait_used_by_ctrls(ebi)) {
dev_err(dev, "NWAIT signal connected to EBI and NAND controllers\n");
return -EINVAL;
}
stm32_fmc2_ebi_enable(ebi);
return of_platform_populate(dev->of_node, NULL, NULL, dev);
}
static int stm32_fmc2_ebi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct stm32_fmc2_ebi *ebi;
struct reset_control *rstc;
int ret;
ebi = devm_kzalloc(&pdev->dev, sizeof(*ebi), GFP_KERNEL);
if (!ebi)
return -ENOMEM;
ebi->dev = dev;
ebi->regmap = device_node_to_regmap(dev->of_node);
if (IS_ERR(ebi->regmap))
return PTR_ERR(ebi->regmap);
ebi->clk = devm_clk_get(dev, NULL);
if (IS_ERR(ebi->clk))
return PTR_ERR(ebi->clk);
rstc = devm_reset_control_get(dev, NULL);
if (PTR_ERR(rstc) == -EPROBE_DEFER)
return -EPROBE_DEFER;
ret = clk_prepare_enable(ebi->clk);
if (ret)
return ret;
if (!IS_ERR(rstc)) {
reset_control_assert(rstc);
reset_control_deassert(rstc);
}
ret = stm32_fmc2_ebi_parse_dt(ebi);
if (ret)
goto err_release;
stm32_fmc2_ebi_save_setup(ebi);
platform_set_drvdata(pdev, ebi);
return 0;
err_release:
stm32_fmc2_ebi_disable_banks(ebi);
stm32_fmc2_ebi_disable(ebi);
clk_disable_unprepare(ebi->clk);
return ret;
}
static int stm32_fmc2_ebi_remove(struct platform_device *pdev)
{
struct stm32_fmc2_ebi *ebi = platform_get_drvdata(pdev);
of_platform_depopulate(&pdev->dev);
stm32_fmc2_ebi_disable_banks(ebi);
stm32_fmc2_ebi_disable(ebi);
clk_disable_unprepare(ebi->clk);
return 0;
}
static int __maybe_unused stm32_fmc2_ebi_suspend(struct device *dev)
{
struct stm32_fmc2_ebi *ebi = dev_get_drvdata(dev);
stm32_fmc2_ebi_disable(ebi);
clk_disable_unprepare(ebi->clk);
pinctrl_pm_select_sleep_state(dev);
return 0;
}
static int __maybe_unused stm32_fmc2_ebi_resume(struct device *dev)
{
struct stm32_fmc2_ebi *ebi = dev_get_drvdata(dev);
int ret;
pinctrl_pm_select_default_state(dev);
ret = clk_prepare_enable(ebi->clk);
if (ret)
return ret;
stm32_fmc2_ebi_set_setup(ebi);
stm32_fmc2_ebi_enable(ebi);
return 0;
}
static SIMPLE_DEV_PM_OPS(stm32_fmc2_ebi_pm_ops, stm32_fmc2_ebi_suspend,
stm32_fmc2_ebi_resume);
static const struct of_device_id stm32_fmc2_ebi_match[] = {
{.compatible = "st,stm32mp1-fmc2-ebi"},
{}
};
MODULE_DEVICE_TABLE(of, stm32_fmc2_ebi_match);
static struct platform_driver stm32_fmc2_ebi_driver = {
.probe = stm32_fmc2_ebi_probe,
.remove = stm32_fmc2_ebi_remove,
.driver = {
.name = "stm32_fmc2_ebi",
.of_match_table = stm32_fmc2_ebi_match,
.pm = &stm32_fmc2_ebi_pm_ops,
},
};
module_platform_driver(stm32_fmc2_ebi_driver);
MODULE_ALIAS("platform:stm32_fmc2_ebi");
MODULE_AUTHOR("Christophe Kerello <[email protected]>");
MODULE_DESCRIPTION("STMicroelectronics STM32 FMC2 ebi driver");
MODULE_LICENSE("GPL v2");
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.0.0-p451" project-jdk-type="RUBY_SDK" />
</project>
| {
"pile_set_name": "Github"
} |
///////////////////////////////////////////////////////////////////////////////
// end_matcher.hpp
//
// Copyright 2008 Eric Niebler. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_END_MATCHER_HPP_EAN_10_04_2005
#define BOOST_XPRESSIVE_DETAIL_CORE_MATCHER_END_MATCHER_HPP_EAN_10_04_2005
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/assert.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/core/quant_style.hpp>
#include <boost/xpressive/detail/core/state.hpp>
#include <boost/xpressive/detail/core/sub_match_impl.hpp>
#include <boost/xpressive/detail/core/flow_control.hpp>
namespace boost { namespace xpressive { namespace detail
{
///////////////////////////////////////////////////////////////////////////////
// end_matcher
//
struct end_matcher
: quant_style_assertion
{
template<typename BidiIter, typename Next>
static bool match(match_state<BidiIter> &state, Next const &)
{
BidiIter const tmp = state.cur_;
sub_match_impl<BidiIter> &s0 = state.sub_match(0);
BOOST_ASSERT(!s0.matched);
// SPECIAL: if there is a match context on the context stack, then
// this pattern has been nested within another. pop that context and
// continue executing.
if(0 != state.context_.prev_context_)
{
if(!pop_context_match(state))
{
return false;
}
// record the end of sub-match zero
s0.first = s0.begin_;
s0.second = tmp;
s0.matched = true;
return true;
}
else if((state.flags_.match_all_ && !state.eos()) ||
(state.flags_.match_not_null_ && state.cur_ == s0.begin_))
{
return false;
}
// record the end of sub-match zero
s0.first = s0.begin_;
s0.second = tmp;
s0.matched = true;
// Now execute any actions that have been queued
for(actionable const *actor = state.action_list_.next; 0 != actor; actor = actor->next)
{
actor->execute(state.action_args_);
}
return true;
}
};
///////////////////////////////////////////////////////////////////////////////
// independent_end_matcher
//
struct independent_end_matcher
: quant_style_assertion
{
template<typename BidiIter, typename Next>
bool match(match_state<BidiIter> &state, Next const &) const
{
// Now execute any actions that have been queued
for(actionable const *actor = state.action_list_.next; 0 != actor; actor = actor->next)
{
actor->execute(state.action_args_);
}
return true;
}
};
}}}
#endif
| {
"pile_set_name": "Github"
} |
'use strict'
const webpack = require('webpack')
const common = require('./common')
const HtmlPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const CleanPlugin = require('clean-webpack-plugin')
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
module.exports = {
entry: common.entry,
output: common.output,
plugins: [
new CleanPlugin(['dist'], {
root: common.paths.root
}),
new ExtractTextPlugin({
filename: '[name]-[hash].css'
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': '"production"'
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'react-build',
chunks: ['main'],
minChunks: ({ resource }) => (
/node_modules\/(react(-dom)?|fbjs)\//.test(resource) ||
/node_modules\/preact(-compat)?\//.test(resource)
)
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
chunks: ['main'],
minChunks: ({ resource }) => (
/node_modules/.test(resource)
)
}),
new HtmlPlugin(Object.assign({}, common.htmlPluginConfig, {
minify: { collapseWhitespace: true },
chunksSortMode: (chunk1, chunk2) => {
const order = ['react-build', 'vendor', 'main']
const left = order.indexOf(chunk1.names[0])
const right = order.indexOf(chunk2.names[0])
return left - right
}
})),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true
})
].concat(
process.env.ANALYZER ? new BundleAnalyzerPlugin() : []
),
module: {
rules: [
common.standardPreLoader,
common.jsLoader,
common.fileLoader,
common.urlLoader,
Object.assign({}, common.cssLoader, {
use: ExtractTextPlugin.extract({
fallback: common.cssLoader.use[0],
use: common.cssLoader.use.slice(1)
})
})
]
},
// resolve: common.resolve
resolve: {
alias: Object.assign({}, common.resolve.alias, {
'react': 'preact-compat',
'react-dom': 'preact-compat'
})
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- guibooks.qdoc -->
<head>
<title>Qt 4.6: Books about GUI Design</title>
<link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="functions.html"><font color="#004faf">All Functions</font></a> · <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">Books about GUI Design<br /><span class="subtitle"></span>
</h1>
<p>This is not a comprehensive list -- there are many other books worth buying. Here we mention just a few user interface books that don't gather dust on our shelves.</p>
<p><b><a href="http://www.amazon.com/gp/product/0132354160/ref=ase_trolltech/">C++ GUI Programming with Qt 4, Second Edition</a></b> by Jasmin Blanchette and Mark Summerfield, ISBN 0-13-235416-0. This is the official Qt book written by two veteran Trolls. The first edition, which is based on Qt 4.1, is <a href="http://www.qtrac.eu/C++-GUI-Programming-with-Qt-4-1st-ed.zip">available online</a>. The second edition, based on Qt 4.3, is <a href="http://www.informit.com/store/product.aspx?isbn=0132354160">also available online</a>.</p>
<p><b><a href="http://www.amazon.com/exec/obidos/ASIN/0385267746/trolltech/t">The Design of Everyday Things</a></b> by Donald Norman, ISBN 0-38526774-6, is one of the classics of human interface design. Norman shows how badly something as simple as a kitchen stove can be designed, and everyone should read it who will design a dialog box, write an error message, or design just about anything else humans are supposed to use.</p>
<a name="fowler"></a><p><b><a href="http://www.amazon.com/exec/obidos/ASIN/0070592748/trolltech/t">GUI Design Handbook</a></b> by Susan Fowler, ISBN 0-07-059274-8, is an alphabetical dictionary of widgets and other user interface elements, with comprehensive coverage of each. Each chapter covers one widget or other element, contains the most important recommendation from the Macintosh, Windows and Motif style guides, notes about common problems, comparison with other widgets that can serve some of the same roles as this one, etc.</p>
<a name="design-patterns"></a><p><b><a href="http://www.amazon.com/exec/obidos/ASIN/0201633612/103-8144203-3273444">Design Patterns - Elements of Reusable Object-Oriented Software</a></b> by Gamma, Helm, Johnson, and Vlissides, ISBN 0-201-63361-2, provides more information on the Model-View-Controller (MVC) paradigm, explaining MVC and its sub-patterns in detail.</p>
<p><b><a href="http://www.amazon.com/exec/obidos/ASIN/0201622165/trolltech/t">Macintosh Human Interface Guidelines</a></b>, Second Edition, ISBN 0-201-62216-5, is worth buying for the <i>don't</i>s alone. Even if you're not writing Macintosh software, avoiding most of what it advises against will produce more easily comprehensible software. Doing what it tells you to do may also help. This book is now available <a href="http://developer.apple.com/techpubs/mac/HIGuidelines/HIGuidelines-2.html">online</a> and there is a <a href="http://developer.apple.com/techpubs/mac/HIGOS8Guide/thig-2.html">Mac OS 8 addendum.</a></p>
<p><b><a href="http://www.amazon.com/exec/obidos/ASIN/047159900X/trolltech/t">The Microsoft Windows User Experience</a></b>, ISBN 1-55615-679-0, is Microsoft's look and feel bible. Indispensable for everyone who has customers that worship Microsoft, and it's quite good, too. It is also available <a href="http://msdn.microsoft.com/library/en-us/dnwue/html/welcome.asp">online</a>.</p>
<p><b><a href="http://www.amazon.com/exec/obidos/ASIN/047159900X/trolltech/t">The Icon Book</a></b> by William Horton, ISBN 0-471-59900-X, is perhaps the only thorough coverage of icons and icon use in software. In order for icons to be successful, people must be able to do four things with them: decode, recognize, find and activate them. This book explains these goals from scratch and how to reach them, both with single icons and icon families. Some 500 examples are scattered throughout the text.</p>
<a name="buying-these-books-from-amazon-com"></a>
<h2>Buying these Books from Amazon.com</h2>
<p>These books are made available in association with Amazon.com, our favorite online bookstore. Here is more information about <a href="http://www.amazon.com/exec/obidos/subst/help/shipping-policy.html/t">Amazon.com's shipping options</a> and its <a href="http://www.amazon.com/exec/obidos/subst/help/desk.html/t">customer service.</a> When you buy a book by following one of these links, Amazon.com gives about 15% of the purchase price to <a href="http://www.amnesty.org/">Amnesty International.</a></p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="40%" align="right"><div align="right">Qt 4.6.0</div></td>
</tr></table></div></address></body>
</html>
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2015 Nordic Semiconductor ASA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
* integrated circuit in a product or a software update for such product, must reproduce
* the above copyright notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
* used to endorse or promote products derived from this software without specific prior
* written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary or object form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* 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.
*
*/
#ifndef NRF51_DEPRECATED_H
#define NRF51_DEPRECATED_H
/*lint ++flb "Enter library region */
/* This file is given to prevent your SW from not compiling with the updates made to nrf51.h and
* nrf51_bitfields.h. The macros defined in this file were available previously. Do not use these
* macros on purpose. Use the ones defined in nrf51.h and nrf51_bitfields.h instead.
*/
/* NVMC */
/* The register ERASEPROTECTEDPAGE is called ERASEPCR0 in the documentation. */
#define ERASEPROTECTEDPAGE ERASEPCR0
/* LPCOMP */
/* The interrupt ISR was renamed. Adding old name to the macros. */
#define LPCOMP_COMP_IRQHandler LPCOMP_IRQHandler
#define LPCOMP_COMP_IRQn LPCOMP_IRQn
/* MPU */
/* The field MPU.PERR0.LPCOMP_COMP was renamed. Added into deprecated in case somebody was using the macros defined for it. */
#define MPU_PERR0_LPCOMP_COMP_Pos MPU_PERR0_LPCOMP_Pos
#define MPU_PERR0_LPCOMP_COMP_Msk MPU_PERR0_LPCOMP_Msk
#define MPU_PERR0_LPCOMP_COMP_InRegion1 MPU_PERR0_LPCOMP_InRegion1
#define MPU_PERR0_LPCOMP_COMP_InRegion0 MPU_PERR0_LPCOMP_InRegion0
/* POWER */
/* The field POWER.RAMON.OFFRAM3 was eliminated. Added into deprecated in case somebody was using the macros defined for it. */
#define POWER_RAMON_OFFRAM3_Pos (19UL)
#define POWER_RAMON_OFFRAM3_Msk (0x1UL << POWER_RAMON_OFFRAM3_Pos)
#define POWER_RAMON_OFFRAM3_RAM3Off (0UL)
#define POWER_RAMON_OFFRAM3_RAM3On (1UL)
/* The field POWER.RAMON.OFFRAM2 was eliminated. Added into deprecated in case somebody was using the macros defined for it. */
#define POWER_RAMON_OFFRAM2_Pos (18UL)
#define POWER_RAMON_OFFRAM2_Msk (0x1UL << POWER_RAMON_OFFRAM2_Pos)
#define POWER_RAMON_OFFRAM2_RAM2Off (0UL)
#define POWER_RAMON_OFFRAM2_RAM2On (1UL)
/* The field POWER.RAMON.ONRAM3 was eliminated. Added into deprecated in case somebody was using the macros defined for it. */
#define POWER_RAMON_ONRAM3_Pos (3UL)
#define POWER_RAMON_ONRAM3_Msk (0x1UL << POWER_RAMON_ONRAM3_Pos)
#define POWER_RAMON_ONRAM3_RAM3Off (0UL)
#define POWER_RAMON_ONRAM3_RAM3On (1UL)
/* The field POWER.RAMON.ONRAM2 was eliminated. Added into deprecated in case somebody was using the macros defined for it. */
#define POWER_RAMON_ONRAM2_Pos (2UL)
#define POWER_RAMON_ONRAM2_Msk (0x1UL << POWER_RAMON_ONRAM2_Pos)
#define POWER_RAMON_ONRAM2_RAM2Off (0UL)
#define POWER_RAMON_ONRAM2_RAM2On (1UL)
/* RADIO */
/* The enumerated value RADIO.TXPOWER.TXPOWER.Neg40dBm was renamed. Added into deprecated with the new macro name. */
#define RADIO_TXPOWER_TXPOWER_Neg40dBm RADIO_TXPOWER_TXPOWER_Neg30dBm
/* The name of the field SKIPADDR was corrected. Old macros added for compatibility. */
#define RADIO_CRCCNF_SKIP_ADDR_Pos RADIO_CRCCNF_SKIPADDR_Pos
#define RADIO_CRCCNF_SKIP_ADDR_Msk RADIO_CRCCNF_SKIPADDR_Msk
#define RADIO_CRCCNF_SKIP_ADDR_Include RADIO_CRCCNF_SKIPADDR_Include
#define RADIO_CRCCNF_SKIP_ADDR_Skip RADIO_CRCCNF_SKIPADDR_Skip
/* The name of the field PLLLOCK was corrected. Old macros added for compatibility. */
#define RADIO_TEST_PLL_LOCK_Pos RADIO_TEST_PLLLOCK_Pos
#define RADIO_TEST_PLL_LOCK_Msk RADIO_TEST_PLLLOCK_Msk
#define RADIO_TEST_PLL_LOCK_Disabled RADIO_TEST_PLLLOCK_Disabled
#define RADIO_TEST_PLL_LOCK_Enabled RADIO_TEST_PLLLOCK_Enabled
/* The name of the field CONSTCARRIER was corrected. Old macros added for compatibility. */
#define RADIO_TEST_CONST_CARRIER_Pos RADIO_TEST_CONSTCARRIER_Pos
#define RADIO_TEST_CONST_CARRIER_Msk RADIO_TEST_CONSTCARRIER_Msk
#define RADIO_TEST_CONST_CARRIER_Disabled RADIO_TEST_CONSTCARRIER_Disabled
#define RADIO_TEST_CONST_CARRIER_Enabled RADIO_TEST_CONSTCARRIER_Enabled
/* FICR */
/* The registers FICR.SIZERAMBLOCK0, FICR.SIZERAMBLOCK1, FICR.SIZERAMBLOCK2 and FICR.SIZERAMBLOCK3 were renamed into an array. */
#define SIZERAMBLOCK0 SIZERAMBLOCKS
#define SIZERAMBLOCK1 SIZERAMBLOCKS
#define SIZERAMBLOCK2 SIZERAMBLOCK[2] /*!< Note that this macro will disapear when SIZERAMBLOCK array is eliminated. SIZERAMBLOCK is a deprecated array. */
#define SIZERAMBLOCK3 SIZERAMBLOCK[3] /*!< Note that this macro will disapear when SIZERAMBLOCK array is eliminated. SIZERAMBLOCK is a deprecated array. */
/* The registers FICR.DEVICEID0 and FICR.DEVICEID1 were renamed into an array. */
#define DEVICEID0 DEVICEID[0]
#define DEVICEID1 DEVICEID[1]
/* The registers FICR.ER0, FICR.ER1, FICR.ER2 and FICR.ER3 were renamed into an array. */
#define ER0 ER[0]
#define ER1 ER[1]
#define ER2 ER[2]
#define ER3 ER[3]
/* The registers FICR.IR0, FICR.IR1, FICR.IR2 and FICR.IR3 were renamed into an array. */
#define IR0 IR[0]
#define IR1 IR[1]
#define IR2 IR[2]
#define IR3 IR[3]
/* The registers FICR.DEVICEADDR0 and FICR.DEVICEADDR1 were renamed into an array. */
#define DEVICEADDR0 DEVICEADDR[0]
#define DEVICEADDR1 DEVICEADDR[1]
/* PPI */
/* The tasks PPI.TASKS_CHGxEN and PPI.TASKS_CHGxDIS were renamed into an array of structs. */
#define TASKS_CHG0EN TASKS_CHG[0].EN
#define TASKS_CHG0DIS TASKS_CHG[0].DIS
#define TASKS_CHG1EN TASKS_CHG[1].EN
#define TASKS_CHG1DIS TASKS_CHG[1].DIS
#define TASKS_CHG2EN TASKS_CHG[2].EN
#define TASKS_CHG2DIS TASKS_CHG[2].DIS
#define TASKS_CHG3EN TASKS_CHG[3].EN
#define TASKS_CHG3DIS TASKS_CHG[3].DIS
/* The registers PPI.CHx_EEP and PPI.CHx_TEP were renamed into an array of structs. */
#define CH0_EEP CH[0].EEP
#define CH0_TEP CH[0].TEP
#define CH1_EEP CH[1].EEP
#define CH1_TEP CH[1].TEP
#define CH2_EEP CH[2].EEP
#define CH2_TEP CH[2].TEP
#define CH3_EEP CH[3].EEP
#define CH3_TEP CH[3].TEP
#define CH4_EEP CH[4].EEP
#define CH4_TEP CH[4].TEP
#define CH5_EEP CH[5].EEP
#define CH5_TEP CH[5].TEP
#define CH6_EEP CH[6].EEP
#define CH6_TEP CH[6].TEP
#define CH7_EEP CH[7].EEP
#define CH7_TEP CH[7].TEP
#define CH8_EEP CH[8].EEP
#define CH8_TEP CH[8].TEP
#define CH9_EEP CH[9].EEP
#define CH9_TEP CH[9].TEP
#define CH10_EEP CH[10].EEP
#define CH10_TEP CH[10].TEP
#define CH11_EEP CH[11].EEP
#define CH11_TEP CH[11].TEP
#define CH12_EEP CH[12].EEP
#define CH12_TEP CH[12].TEP
#define CH13_EEP CH[13].EEP
#define CH13_TEP CH[13].TEP
#define CH14_EEP CH[14].EEP
#define CH14_TEP CH[14].TEP
#define CH15_EEP CH[15].EEP
#define CH15_TEP CH[15].TEP
/* The registers PPI.CHG0, PPI.CHG1, PPI.CHG2 and PPI.CHG3 were renamed into an array. */
#define CHG0 CHG[0]
#define CHG1 CHG[1]
#define CHG2 CHG[2]
#define CHG3 CHG[3]
/* All bitfield macros for the CHGx registers therefore changed name. */
#define PPI_CHG0_CH15_Pos PPI_CHG_CH15_Pos
#define PPI_CHG0_CH15_Msk PPI_CHG_CH15_Msk
#define PPI_CHG0_CH15_Excluded PPI_CHG_CH15_Excluded
#define PPI_CHG0_CH15_Included PPI_CHG_CH15_Included
#define PPI_CHG0_CH14_Pos PPI_CHG_CH14_Pos
#define PPI_CHG0_CH14_Msk PPI_CHG_CH14_Msk
#define PPI_CHG0_CH14_Excluded PPI_CHG_CH14_Excluded
#define PPI_CHG0_CH14_Included PPI_CHG_CH14_Included
#define PPI_CHG0_CH13_Pos PPI_CHG_CH13_Pos
#define PPI_CHG0_CH13_Msk PPI_CHG_CH13_Msk
#define PPI_CHG0_CH13_Excluded PPI_CHG_CH13_Excluded
#define PPI_CHG0_CH13_Included PPI_CHG_CH13_Included
#define PPI_CHG0_CH12_Pos PPI_CHG_CH12_Pos
#define PPI_CHG0_CH12_Msk PPI_CHG_CH12_Msk
#define PPI_CHG0_CH12_Excluded PPI_CHG_CH12_Excluded
#define PPI_CHG0_CH12_Included PPI_CHG_CH12_Included
#define PPI_CHG0_CH11_Pos PPI_CHG_CH11_Pos
#define PPI_CHG0_CH11_Msk PPI_CHG_CH11_Msk
#define PPI_CHG0_CH11_Excluded PPI_CHG_CH11_Excluded
#define PPI_CHG0_CH11_Included PPI_CHG_CH11_Included
#define PPI_CHG0_CH10_Pos PPI_CHG_CH10_Pos
#define PPI_CHG0_CH10_Msk PPI_CHG_CH10_Msk
#define PPI_CHG0_CH10_Excluded PPI_CHG_CH10_Excluded
#define PPI_CHG0_CH10_Included PPI_CHG_CH10_Included
#define PPI_CHG0_CH9_Pos PPI_CHG_CH9_Pos
#define PPI_CHG0_CH9_Msk PPI_CHG_CH9_Msk
#define PPI_CHG0_CH9_Excluded PPI_CHG_CH9_Excluded
#define PPI_CHG0_CH9_Included PPI_CHG_CH9_Included
#define PPI_CHG0_CH8_Pos PPI_CHG_CH8_Pos
#define PPI_CHG0_CH8_Msk PPI_CHG_CH8_Msk
#define PPI_CHG0_CH8_Excluded PPI_CHG_CH8_Excluded
#define PPI_CHG0_CH8_Included PPI_CHG_CH8_Included
#define PPI_CHG0_CH7_Pos PPI_CHG_CH7_Pos
#define PPI_CHG0_CH7_Msk PPI_CHG_CH7_Msk
#define PPI_CHG0_CH7_Excluded PPI_CHG_CH7_Excluded
#define PPI_CHG0_CH7_Included PPI_CHG_CH7_Included
#define PPI_CHG0_CH6_Pos PPI_CHG_CH6_Pos
#define PPI_CHG0_CH6_Msk PPI_CHG_CH6_Msk
#define PPI_CHG0_CH6_Excluded PPI_CHG_CH6_Excluded
#define PPI_CHG0_CH6_Included PPI_CHG_CH6_Included
#define PPI_CHG0_CH5_Pos PPI_CHG_CH5_Pos
#define PPI_CHG0_CH5_Msk PPI_CHG_CH5_Msk
#define PPI_CHG0_CH5_Excluded PPI_CHG_CH5_Excluded
#define PPI_CHG0_CH5_Included PPI_CHG_CH5_Included
#define PPI_CHG0_CH4_Pos PPI_CHG_CH4_Pos
#define PPI_CHG0_CH4_Msk PPI_CHG_CH4_Msk
#define PPI_CHG0_CH4_Excluded PPI_CHG_CH4_Excluded
#define PPI_CHG0_CH4_Included PPI_CHG_CH4_Included
#define PPI_CHG0_CH3_Pos PPI_CHG_CH3_Pos
#define PPI_CHG0_CH3_Msk PPI_CHG_CH3_Msk
#define PPI_CHG0_CH3_Excluded PPI_CHG_CH3_Excluded
#define PPI_CHG0_CH3_Included PPI_CHG_CH3_Included
#define PPI_CHG0_CH2_Pos PPI_CHG_CH2_Pos
#define PPI_CHG0_CH2_Msk PPI_CHG_CH2_Msk
#define PPI_CHG0_CH2_Excluded PPI_CHG_CH2_Excluded
#define PPI_CHG0_CH2_Included PPI_CHG_CH2_Included
#define PPI_CHG0_CH1_Pos PPI_CHG_CH1_Pos
#define PPI_CHG0_CH1_Msk PPI_CHG_CH1_Msk
#define PPI_CHG0_CH1_Excluded PPI_CHG_CH1_Excluded
#define PPI_CHG0_CH1_Included PPI_CHG_CH1_Included
#define PPI_CHG0_CH0_Pos PPI_CHG_CH0_Pos
#define PPI_CHG0_CH0_Msk PPI_CHG_CH0_Msk
#define PPI_CHG0_CH0_Excluded PPI_CHG_CH0_Excluded
#define PPI_CHG0_CH0_Included PPI_CHG_CH0_Included
#define PPI_CHG1_CH15_Pos PPI_CHG_CH15_Pos
#define PPI_CHG1_CH15_Msk PPI_CHG_CH15_Msk
#define PPI_CHG1_CH15_Excluded PPI_CHG_CH15_Excluded
#define PPI_CHG1_CH15_Included PPI_CHG_CH15_Included
#define PPI_CHG1_CH14_Pos PPI_CHG_CH14_Pos
#define PPI_CHG1_CH14_Msk PPI_CHG_CH14_Msk
#define PPI_CHG1_CH14_Excluded PPI_CHG_CH14_Excluded
#define PPI_CHG1_CH14_Included PPI_CHG_CH14_Included
#define PPI_CHG1_CH13_Pos PPI_CHG_CH13_Pos
#define PPI_CHG1_CH13_Msk PPI_CHG_CH13_Msk
#define PPI_CHG1_CH13_Excluded PPI_CHG_CH13_Excluded
#define PPI_CHG1_CH13_Included PPI_CHG_CH13_Included
#define PPI_CHG1_CH12_Pos PPI_CHG_CH12_Pos
#define PPI_CHG1_CH12_Msk PPI_CHG_CH12_Msk
#define PPI_CHG1_CH12_Excluded PPI_CHG_CH12_Excluded
#define PPI_CHG1_CH12_Included PPI_CHG_CH12_Included
#define PPI_CHG1_CH11_Pos PPI_CHG_CH11_Pos
#define PPI_CHG1_CH11_Msk PPI_CHG_CH11_Msk
#define PPI_CHG1_CH11_Excluded PPI_CHG_CH11_Excluded
#define PPI_CHG1_CH11_Included PPI_CHG_CH11_Included
#define PPI_CHG1_CH10_Pos PPI_CHG_CH10_Pos
#define PPI_CHG1_CH10_Msk PPI_CHG_CH10_Msk
#define PPI_CHG1_CH10_Excluded PPI_CHG_CH10_Excluded
#define PPI_CHG1_CH10_Included PPI_CHG_CH10_Included
#define PPI_CHG1_CH9_Pos PPI_CHG_CH9_Pos
#define PPI_CHG1_CH9_Msk PPI_CHG_CH9_Msk
#define PPI_CHG1_CH9_Excluded PPI_CHG_CH9_Excluded
#define PPI_CHG1_CH9_Included PPI_CHG_CH9_Included
#define PPI_CHG1_CH8_Pos PPI_CHG_CH8_Pos
#define PPI_CHG1_CH8_Msk PPI_CHG_CH8_Msk
#define PPI_CHG1_CH8_Excluded PPI_CHG_CH8_Excluded
#define PPI_CHG1_CH8_Included PPI_CHG_CH8_Included
#define PPI_CHG1_CH7_Pos PPI_CHG_CH7_Pos
#define PPI_CHG1_CH7_Msk PPI_CHG_CH7_Msk
#define PPI_CHG1_CH7_Excluded PPI_CHG_CH7_Excluded
#define PPI_CHG1_CH7_Included PPI_CHG_CH7_Included
#define PPI_CHG1_CH6_Pos PPI_CHG_CH6_Pos
#define PPI_CHG1_CH6_Msk PPI_CHG_CH6_Msk
#define PPI_CHG1_CH6_Excluded PPI_CHG_CH6_Excluded
#define PPI_CHG1_CH6_Included PPI_CHG_CH6_Included
#define PPI_CHG1_CH5_Pos PPI_CHG_CH5_Pos
#define PPI_CHG1_CH5_Msk PPI_CHG_CH5_Msk
#define PPI_CHG1_CH5_Excluded PPI_CHG_CH5_Excluded
#define PPI_CHG1_CH5_Included PPI_CHG_CH5_Included
#define PPI_CHG1_CH4_Pos PPI_CHG_CH4_Pos
#define PPI_CHG1_CH4_Msk PPI_CHG_CH4_Msk
#define PPI_CHG1_CH4_Excluded PPI_CHG_CH4_Excluded
#define PPI_CHG1_CH4_Included PPI_CHG_CH4_Included
#define PPI_CHG1_CH3_Pos PPI_CHG_CH3_Pos
#define PPI_CHG1_CH3_Msk PPI_CHG_CH3_Msk
#define PPI_CHG1_CH3_Excluded PPI_CHG_CH3_Excluded
#define PPI_CHG1_CH3_Included PPI_CHG_CH3_Included
#define PPI_CHG1_CH2_Pos PPI_CHG_CH2_Pos
#define PPI_CHG1_CH2_Msk PPI_CHG_CH2_Msk
#define PPI_CHG1_CH2_Excluded PPI_CHG_CH2_Excluded
#define PPI_CHG1_CH2_Included PPI_CHG_CH2_Included
#define PPI_CHG1_CH1_Pos PPI_CHG_CH1_Pos
#define PPI_CHG1_CH1_Msk PPI_CHG_CH1_Msk
#define PPI_CHG1_CH1_Excluded PPI_CHG_CH1_Excluded
#define PPI_CHG1_CH1_Included PPI_CHG_CH1_Included
#define PPI_CHG1_CH0_Pos PPI_CHG_CH0_Pos
#define PPI_CHG1_CH0_Msk PPI_CHG_CH0_Msk
#define PPI_CHG1_CH0_Excluded PPI_CHG_CH0_Excluded
#define PPI_CHG1_CH0_Included PPI_CHG_CH0_Included
#define PPI_CHG2_CH15_Pos PPI_CHG_CH15_Pos
#define PPI_CHG2_CH15_Msk PPI_CHG_CH15_Msk
#define PPI_CHG2_CH15_Excluded PPI_CHG_CH15_Excluded
#define PPI_CHG2_CH15_Included PPI_CHG_CH15_Included
#define PPI_CHG2_CH14_Pos PPI_CHG_CH14_Pos
#define PPI_CHG2_CH14_Msk PPI_CHG_CH14_Msk
#define PPI_CHG2_CH14_Excluded PPI_CHG_CH14_Excluded
#define PPI_CHG2_CH14_Included PPI_CHG_CH14_Included
#define PPI_CHG2_CH13_Pos PPI_CHG_CH13_Pos
#define PPI_CHG2_CH13_Msk PPI_CHG_CH13_Msk
#define PPI_CHG2_CH13_Excluded PPI_CHG_CH13_Excluded
#define PPI_CHG2_CH13_Included PPI_CHG_CH13_Included
#define PPI_CHG2_CH12_Pos PPI_CHG_CH12_Pos
#define PPI_CHG2_CH12_Msk PPI_CHG_CH12_Msk
#define PPI_CHG2_CH12_Excluded PPI_CHG_CH12_Excluded
#define PPI_CHG2_CH12_Included PPI_CHG_CH12_Included
#define PPI_CHG2_CH11_Pos PPI_CHG_CH11_Pos
#define PPI_CHG2_CH11_Msk PPI_CHG_CH11_Msk
#define PPI_CHG2_CH11_Excluded PPI_CHG_CH11_Excluded
#define PPI_CHG2_CH11_Included PPI_CHG_CH11_Included
#define PPI_CHG2_CH10_Pos PPI_CHG_CH10_Pos
#define PPI_CHG2_CH10_Msk PPI_CHG_CH10_Msk
#define PPI_CHG2_CH10_Excluded PPI_CHG_CH10_Excluded
#define PPI_CHG2_CH10_Included PPI_CHG_CH10_Included
#define PPI_CHG2_CH9_Pos PPI_CHG_CH9_Pos
#define PPI_CHG2_CH9_Msk PPI_CHG_CH9_Msk
#define PPI_CHG2_CH9_Excluded PPI_CHG_CH9_Excluded
#define PPI_CHG2_CH9_Included PPI_CHG_CH9_Included
#define PPI_CHG2_CH8_Pos PPI_CHG_CH8_Pos
#define PPI_CHG2_CH8_Msk PPI_CHG_CH8_Msk
#define PPI_CHG2_CH8_Excluded PPI_CHG_CH8_Excluded
#define PPI_CHG2_CH8_Included PPI_CHG_CH8_Included
#define PPI_CHG2_CH7_Pos PPI_CHG_CH7_Pos
#define PPI_CHG2_CH7_Msk PPI_CHG_CH7_Msk
#define PPI_CHG2_CH7_Excluded PPI_CHG_CH7_Excluded
#define PPI_CHG2_CH7_Included PPI_CHG_CH7_Included
#define PPI_CHG2_CH6_Pos PPI_CHG_CH6_Pos
#define PPI_CHG2_CH6_Msk PPI_CHG_CH6_Msk
#define PPI_CHG2_CH6_Excluded PPI_CHG_CH6_Excluded
#define PPI_CHG2_CH6_Included PPI_CHG_CH6_Included
#define PPI_CHG2_CH5_Pos PPI_CHG_CH5_Pos
#define PPI_CHG2_CH5_Msk PPI_CHG_CH5_Msk
#define PPI_CHG2_CH5_Excluded PPI_CHG_CH5_Excluded
#define PPI_CHG2_CH5_Included PPI_CHG_CH5_Included
#define PPI_CHG2_CH4_Pos PPI_CHG_CH4_Pos
#define PPI_CHG2_CH4_Msk PPI_CHG_CH4_Msk
#define PPI_CHG2_CH4_Excluded PPI_CHG_CH4_Excluded
#define PPI_CHG2_CH4_Included PPI_CHG_CH4_Included
#define PPI_CHG2_CH3_Pos PPI_CHG_CH3_Pos
#define PPI_CHG2_CH3_Msk PPI_CHG_CH3_Msk
#define PPI_CHG2_CH3_Excluded PPI_CHG_CH3_Excluded
#define PPI_CHG2_CH3_Included PPI_CHG_CH3_Included
#define PPI_CHG2_CH2_Pos PPI_CHG_CH2_Pos
#define PPI_CHG2_CH2_Msk PPI_CHG_CH2_Msk
#define PPI_CHG2_CH2_Excluded PPI_CHG_CH2_Excluded
#define PPI_CHG2_CH2_Included PPI_CHG_CH2_Included
#define PPI_CHG2_CH1_Pos PPI_CHG_CH1_Pos
#define PPI_CHG2_CH1_Msk PPI_CHG_CH1_Msk
#define PPI_CHG2_CH1_Excluded PPI_CHG_CH1_Excluded
#define PPI_CHG2_CH1_Included PPI_CHG_CH1_Included
#define PPI_CHG2_CH0_Pos PPI_CHG_CH0_Pos
#define PPI_CHG2_CH0_Msk PPI_CHG_CH0_Msk
#define PPI_CHG2_CH0_Excluded PPI_CHG_CH0_Excluded
#define PPI_CHG2_CH0_Included PPI_CHG_CH0_Included
#define PPI_CHG3_CH15_Pos PPI_CHG_CH15_Pos
#define PPI_CHG3_CH15_Msk PPI_CHG_CH15_Msk
#define PPI_CHG3_CH15_Excluded PPI_CHG_CH15_Excluded
#define PPI_CHG3_CH15_Included PPI_CHG_CH15_Included
#define PPI_CHG3_CH14_Pos PPI_CHG_CH14_Pos
#define PPI_CHG3_CH14_Msk PPI_CHG_CH14_Msk
#define PPI_CHG3_CH14_Excluded PPI_CHG_CH14_Excluded
#define PPI_CHG3_CH14_Included PPI_CHG_CH14_Included
#define PPI_CHG3_CH13_Pos PPI_CHG_CH13_Pos
#define PPI_CHG3_CH13_Msk PPI_CHG_CH13_Msk
#define PPI_CHG3_CH13_Excluded PPI_CHG_CH13_Excluded
#define PPI_CHG3_CH13_Included PPI_CHG_CH13_Included
#define PPI_CHG3_CH12_Pos PPI_CHG_CH12_Pos
#define PPI_CHG3_CH12_Msk PPI_CHG_CH12_Msk
#define PPI_CHG3_CH12_Excluded PPI_CHG_CH12_Excluded
#define PPI_CHG3_CH12_Included PPI_CHG_CH12_Included
#define PPI_CHG3_CH11_Pos PPI_CHG_CH11_Pos
#define PPI_CHG3_CH11_Msk PPI_CHG_CH11_Msk
#define PPI_CHG3_CH11_Excluded PPI_CHG_CH11_Excluded
#define PPI_CHG3_CH11_Included PPI_CHG_CH11_Included
#define PPI_CHG3_CH10_Pos PPI_CHG_CH10_Pos
#define PPI_CHG3_CH10_Msk PPI_CHG_CH10_Msk
#define PPI_CHG3_CH10_Excluded PPI_CHG_CH10_Excluded
#define PPI_CHG3_CH10_Included PPI_CHG_CH10_Included
#define PPI_CHG3_CH9_Pos PPI_CHG_CH9_Pos
#define PPI_CHG3_CH9_Msk PPI_CHG_CH9_Msk
#define PPI_CHG3_CH9_Excluded PPI_CHG_CH9_Excluded
#define PPI_CHG3_CH9_Included PPI_CHG_CH9_Included
#define PPI_CHG3_CH8_Pos PPI_CHG_CH8_Pos
#define PPI_CHG3_CH8_Msk PPI_CHG_CH8_Msk
#define PPI_CHG3_CH8_Excluded PPI_CHG_CH8_Excluded
#define PPI_CHG3_CH8_Included PPI_CHG_CH8_Included
#define PPI_CHG3_CH7_Pos PPI_CHG_CH7_Pos
#define PPI_CHG3_CH7_Msk PPI_CHG_CH7_Msk
#define PPI_CHG3_CH7_Excluded PPI_CHG_CH7_Excluded
#define PPI_CHG3_CH7_Included PPI_CHG_CH7_Included
#define PPI_CHG3_CH6_Pos PPI_CHG_CH6_Pos
#define PPI_CHG3_CH6_Msk PPI_CHG_CH6_Msk
#define PPI_CHG3_CH6_Excluded PPI_CHG_CH6_Excluded
#define PPI_CHG3_CH6_Included PPI_CHG_CH6_Included
#define PPI_CHG3_CH5_Pos PPI_CHG_CH5_Pos
#define PPI_CHG3_CH5_Msk PPI_CHG_CH5_Msk
#define PPI_CHG3_CH5_Excluded PPI_CHG_CH5_Excluded
#define PPI_CHG3_CH5_Included PPI_CHG_CH5_Included
#define PPI_CHG3_CH4_Pos PPI_CHG_CH4_Pos
#define PPI_CHG3_CH4_Msk PPI_CHG_CH4_Msk
#define PPI_CHG3_CH4_Excluded PPI_CHG_CH4_Excluded
#define PPI_CHG3_CH4_Included PPI_CHG_CH4_Included
#define PPI_CHG3_CH3_Pos PPI_CHG_CH3_Pos
#define PPI_CHG3_CH3_Msk PPI_CHG_CH3_Msk
#define PPI_CHG3_CH3_Excluded PPI_CHG_CH3_Excluded
#define PPI_CHG3_CH3_Included PPI_CHG_CH3_Included
#define PPI_CHG3_CH2_Pos PPI_CHG_CH2_Pos
#define PPI_CHG3_CH2_Msk PPI_CHG_CH2_Msk
#define PPI_CHG3_CH2_Excluded PPI_CHG_CH2_Excluded
#define PPI_CHG3_CH2_Included PPI_CHG_CH2_Included
#define PPI_CHG3_CH1_Pos PPI_CHG_CH1_Pos
#define PPI_CHG3_CH1_Msk PPI_CHG_CH1_Msk
#define PPI_CHG3_CH1_Excluded PPI_CHG_CH1_Excluded
#define PPI_CHG3_CH1_Included PPI_CHG_CH1_Included
#define PPI_CHG3_CH0_Pos PPI_CHG_CH0_Pos
#define PPI_CHG3_CH0_Msk PPI_CHG_CH0_Msk
#define PPI_CHG3_CH0_Excluded PPI_CHG_CH0_Excluded
#define PPI_CHG3_CH0_Included PPI_CHG_CH0_Included
/*lint --flb "Leave library region" */
#endif /* NRF51_DEPRECATED_H */
| {
"pile_set_name": "Github"
} |
#File generated by Hitachi Vantara Translator for package 'org.pentaho.di.job.entries.tableexists' in locale 'it_IT'
#
#
#Tue Jun 17 15:37:33 CEST 2008
TableExists.Meta.UnableLoadXml=Impossibile caricare la job entry di tipo 'tabella esiste' dal nodo XML
JobTableExists.Tablename.Label=Nome tabella\:
TableExists.Error.RunningJobEntry=Si \u00E8 verificato un errore durante l''esecuzione di questo passo\: {0}
TableExists.Meta.UnableLoadRep=Impossibile caricare la job entry di tipo 'tabella esiste' dal repository per id_jobentry\={0}
TableExists.Error.NoConnectionDefined=Nessuna connessione di database \u00E8 stata definita.
TableExists.Log.SchemaTable=E'' stato specificato un schema\: la nuova tabella dello schema sar\u00E0 {0}
TableExists.Log.TableNotExists=La tabella [{0}] nion esiste\!
TableExists.Log.TableExists=La tabella [{0}] esiste.
TableExists.Meta.UnableSaveRep=Impossibile salvare la job entry di tipo 'tabella esiste' nel repository per id_job\={0}
JobTableExists.Title=La tabella esiste
JobTableExists.Name.Label=Nome job entry\:
JobTableExists.Schemaname.Label=Nome dello schema\:
JobTableExists.Name.Default=La tabella esiste
JobTableExists.Connection.Label=Connessione database\:
| {
"pile_set_name": "Github"
} |
<?php
namespace Orchestra\Tenanti\Tests\Unit\Console;
use Illuminate\Support\Composer;
use Mockery as m;
use Orchestra\Tenanti\Console\MigrateMakeCommand;
use Symfony\Component\Console\Exception\RuntimeException;
class MigrateMakeCommandTest extends CommandTest
{
public function testMakeWithoutAnyDrivers()
{
$tenanti = $this->app['orchestra.tenanti'];
$creator = $this->app['orchestra.tenanti.creator'];
$composer = m::mock(Composer::class);
$tenanti->shouldReceive('config')
->andReturn([]);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('missing: "driver, name"');
$this->artisan('tenanti:make');
}
public function testMakeWithOneDriverWithOneArgument()
{
$tenanti = $this->app['orchestra.tenanti'];
$writer = $this->app['Orchestra\Tenanti\Migrator\MigrationWriter'];
$composer = m::mock(Composer::class);
$composer->shouldReceive('dumpAutoloads');
$tenanti->shouldReceive('config')
->andReturn([
'tenant' => [],
]);
$factory = $this->getMockDriverFactory();
$tenanti->shouldReceive('driver')
->with('tenant')
->andReturn($factory);
$writer->shouldReceive('__invoke')->with('tenant', 'create_users_table', 'users', false)->once()
->andReturn('2014_10_12_000000_create_users_table.php');
$this->app['artisan']->add(new MigrateMakeCommand());
$this->artisan('tenanti:make', ['driver' => 'tenant', 'name' => 'create_users_table', '--table' => 'users']);
}
public function testTinkerWithOneDriverWithTwoArguments()
{
$tenanti = $this->app['orchestra.tenanti'];
$writer = $this->app['Orchestra\Tenanti\Migrator\MigrationWriter'];
$composer = m::mock(Composer::class);
$composer->shouldReceive('dumpAutoloads');
$tenanti->shouldReceive('config')
->andReturn([
'tenant1' => [],
]);
$writer->shouldReceive('__invoke')->with('tenant1', 'update_users_table', 'users', false)->once()
->andReturn('2014_10_12_000000_update_users_table.php');
$this->app['artisan']->add(new MigrateMakeCommand());
$this->artisan('tenanti:make', ['driver' => 'tenant1', 'name' => 'update_users_table', '--table' => 'users']);
}
public function testTinkerWithTwoDriversWithOneArgument()
{
$tenanti = $this->app['orchestra.tenanti'];
$writer = $this->app['Orchestra\Tenanti\Migrator\MigrationWriter'];
$composer = m::mock(Composer::class);
$composer->shouldReceive('dumpAutoloads');
$tenanti->shouldReceive('config')
->andReturn([
'tenant1' => [
],
'tenant2' => [
],
]);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('missing: "driver"');
$writer->shouldNotReceive('__invoke');
$this->app['artisan']->add(new MigrateMakeCommand());
$this->artisan('tenanti:make', ['driver' => 'add_migration']);
}
public function testTinkerWithTwoDriversWithTwoArguments()
{
$tenanti = $this->app['orchestra.tenanti'];
$writer = $this->app['Orchestra\Tenanti\Migrator\MigrationWriter'];
$composer = m::mock(Composer::class);
$composer->shouldReceive('dumpAutoloads');
$tenanti->shouldReceive('config')
->andReturn([
'tenant1' => [
],
'tenant2' => [
],
]);
$writer->shouldReceive('__invoke')->with('tenant2', 'create_users_table', 'users', true)->once()
->andReturn('2014_10_12_000000_create_users_table.php');
$this->app['artisan']->add(new MigrateMakeCommand());
$this->artisan('tenanti:make', ['driver' => 'tenant2', 'name' => 'create_users_table', '--create' => 'users']);
}
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Global</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Global</h1>
<section>
<header>
<h2></h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="createCamera"><span class="type-signature"></span>createCamera<span class="type-signature"></span></h4>
<div class="description">
Creates an instance of THREE.PerspectiveCamera
and assigns it to a scope object if not null.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="camera.js.html">camera.js</a>, <a href="camera.js.html#line11">line 11</a>
</li></ul></dd>
</dl>
<h4 class="name" id="three"><span class="type-signature"></span>three<span class="type-signature"></span></h4>
<div class="description">
Module dependencies
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="geometry_plane.js.html">geometry/plane.js</a>, <a href="geometry_plane.js.html#line6">line 6</a>
</li></ul></dd>
</dl>
<h4 class="name" id="three"><span class="type-signature"></span>three<span class="type-signature"></span></h4>
<div class="description">
Module dependencies
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="geometry_sphere.js.html">geometry/sphere.js</a>, <a href="geometry_sphere.js.html#line7">line 7</a>
</li></ul></dd>
</dl>
<h4 class="name" id="three"><span class="type-signature"></span>three<span class="type-signature"></span></h4>
<div class="description">
Module dependencies
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="geometry_cylinder.js.html">geometry/cylinder.js</a>, <a href="geometry_cylinder.js.html#line6">line 6</a>
</li></ul></dd>
</dl>
<h4 class="name" id="three"><span class="type-signature"></span>three<span class="type-signature"></span></h4>
<div class="description">
Module dependencies
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="geometry_box.js.html">geometry/box.js</a>, <a href="geometry_box.js.html#line7">line 7</a>
</li></ul></dd>
</dl>
<h4 class="name" id="three"><span class="type-signature"></span>three<span class="type-signature"></span></h4>
<div class="description">
Module dependencies
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="camera.js.html">camera.js</a>, <a href="camera.js.html#line6">line 6</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="module:axis/controls/keyboard"><span class="type-signature"></span>module:axis/controls/keyboard<span class="signature">(scope)</span><span class="type-signature"> → {KeyboardController}</span></h4>
<div class="description">
Initialize keyboard controls on Axis.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>scope</code></td>
<td class="type">
<span class="param-type">Axis</span>
</td>
<td class="description last">The axis instance</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="controls_keyboard.js.html">controls/keyboard.js</a>, <a href="controls_keyboard.js.html#line64">line 64</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">KeyboardController</span>
</dd>
</dl>
<h4 class="name" id="module:axis/controls/movement"><span class="type-signature"></span>module:axis/controls/movement<span class="signature">(scope)</span><span class="type-signature"> → {MovementController}</span></h4>
<div class="description">
Initializes movement controls on Axis.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>scope</code></td>
<td class="type">
<span class="param-type">Axis</span>
</td>
<td class="description last">The axis instance</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="controls_movement.js.html">controls/movement.js</a>, <a href="controls_movement.js.html#line63">line 63</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">MovementController</span>
</dd>
</dl>
<h4 class="name" id="module:axis/controls/orientation"><span class="type-signature"></span>module:axis/controls/orientation<span class="signature">(scope)</span><span class="type-signature"> → {OrientationController}</span></h4>
<div class="description">
Initialize orientation controls on Axis.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>scope</code></td>
<td class="type">
<span class="param-type">Axis</span>
</td>
<td class="description last">The axis instance</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="controls_orientation.js.html">controls/orientation.js</a>, <a href="controls_orientation.js.html#line73">line 73</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">OrientationController</span>
</dd>
</dl>
<h4 class="name" id="module:axis/controls/pointer"><span class="type-signature"></span>module:axis/controls/pointer<span class="signature">(scope)</span><span class="type-signature"> → {PointerController}</span></h4>
<div class="description">
Initializes pointer controls on Axis.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>scope</code></td>
<td class="type">
<span class="param-type">Axis</span>
</td>
<td class="description last">The axis instance</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="controls_pointer.js.html">controls/pointer.js</a>, <a href="controls_pointer.js.html#line63">line 63</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">PointerController</span>
</dd>
</dl>
<h4 class="name" id="module:axis/controls/touch"><span class="type-signature"></span>module:axis/controls/touch<span class="signature">(scope)</span><span class="type-signature"> → {TouchController}</span></h4>
<div class="description">
Initializes touch controls on Axis.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>scope</code></td>
<td class="type">
<span class="param-type">Axis</span>
</td>
<td class="description last">The axis instance</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="controls_touch.js.html">controls/touch.js</a>, <a href="controls_touch.js.html#line61">line 61</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TouchController</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-axis.html">axis</a></li><li><a href="module-axis_constants.html">axis/constants</a></li><li><a href="module-axis_controls_controller.html">axis/controls/controller</a></li><li><a href="module-axis_controls_keyboard.html">axis/controls/keyboard</a></li><li><a href="module-axis_controls_movement.html">axis/controls/movement</a></li><li><a href="module-axis_controls_orientation.html">axis/controls/orientation</a></li><li><a href="module-axis_controls_pointer.html">axis/controls/pointer</a></li><li><a href="module-axis_controls_touch.html">axis/controls/touch</a></li><li><a href="module-axis_projection.html">axis/projection</a></li><li><a href="module-axis_projection_flat.html">axis/projection/flat</a></li><li><a href="module-axis_state.html">axis/state</a></li><li><a href="module-scope_projection_equilinear.html">scope/projection/equilinear</a></li><li><a href="module-scope_projection_fisheye.html">scope/projection/fisheye</a></li><li><a href="module-scope_projection_tinyplanet.html">scope/projection/tinyplanet</a></li></ul><h3>Classes</h3><ul><li><a href="module-axis_controls_controller.html">axis/controls/controller</a></li><li><a href="module-axis_controls_keyboard.KeyboardController.html">KeyboardController</a></li><li><a href="module-axis_controls_movement.MovementController.html">MovementController</a></li><li><a href="module-axis_controls_orientation.OrientationController.html">OrientationController</a></li><li><a href="module-axis_controls_pointer.PointerController.html">PointerController</a></li><li><a href="module-axis_controls_touch.TouchController.html">TouchController</a></li><li><a href="module-axis_projection-Projections.html">Projections</a></li><li><a href="module-axis_state-State.html">State</a></li><li><a href="module-axis-Axis.html">Axis</a></li></ul><h3>Events</h3><ul><li><a href="module-axis_state-State.html#event:ready">ready</a></li><li><a href="module-axis_state-State.html#event:update">update</a></li><li><a href="module-axis-Axis.html#event:click">click</a></li><li><a href="module-axis-Axis.html#event:fullscreenchange">fullscreenchange</a></li><li><a href="module-axis-Axis.html#event:keydown">keydown</a></li><li><a href="module-axis-Axis.html#event:ready">ready</a></li><li><a href="module-axis-Axis.html#event:vrhmdavailable">vrhmdavailable</a></li></ul><h3>Global</h3><ul><li><a href="global.html#createCamera">createCamera</a></li><li><a href="global.html#three">three</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sat May 21 2016 16:37:36 GMT-0400 (EDT)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html> | {
"pile_set_name": "Github"
} |
const { BigNumber } = require("ethers")
const { expect } = require("chai")
const { provider, wallet, deployTestContract, getCallRevertReason } = require("./common")
describe("Bytes unit tests", function () {
this.timeout(50000);
let bytesTestContract
before(async () => {
bytesTestContract = await deployTestContract('../../build/BytesTest')
});
// read
it("should read bytes", async () => {
let r = await bytesTestContract.read("0x0102030405060708", 4, 2)
expect(r.data).equal("0x0506")
expect(r.new_offset).equal(BigNumber.from(6))
});
it("should fail to read bytes beyond range", async () => {
let {revertReason} = await getCallRevertReason( () => bytesTestContract.read("0x0102030405060708", 8, 2) )
expect(revertReason).equal("bse11")
});
it("should fail to read too many bytes", async () => {
let {revertReason} = await getCallRevertReason( () => bytesTestContract.read("0x0102030405060708", 4, 5) )
expect(revertReason).equal("bse11")
});
// types
it("should convert uint24", async () => {
const x = 0x010203;
let r = await bytesTestContract.testUInt24(x)
expect(x).equal(r.r)
expect(r.offset).equal(3)
});
it("should convert to hex", async () => {
const x = Buffer.alloc(256);
for (let b = 0; b < 255; b++) {
x[b] = b
}
let hexString = x.toString("hex").toLowerCase();
let r = await bytesTestContract.bytesToHexConvert(x);
expect(r).eq(hexString);
});
});
| {
"pile_set_name": "Github"
} |
$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1'
if (-Not (Test-Path -Path $loadEnvPath)) {
$loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1'
}
. ($loadEnvPath)
$TestRecordingFile = Join-Path $PSScriptRoot 'Get-MgUserPlannerPlanBucketTaskBoardFormat.Recording.json'
$currentPath = $PSScriptRoot
while(-not $mockingPath) {
$mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File
$currentPath = Split-Path -Path $currentPath -Parent
}
. ($mockingPath | Select-Object -First 1).FullName
Describe 'Get-MgUserPlannerPlanBucketTaskBoardFormat' {
It 'Get' -skip {
{ throw [System.NotImplementedException] } | Should -Not -Throw
}
It 'GetViaIdentity' -skip {
{ throw [System.NotImplementedException] } | Should -Not -Throw
}
}
| {
"pile_set_name": "Github"
} |
FoldingCell.swift
@IBOutlet weak public var containerViewTop: NSLayoutConstraint!
@IBOutlet weak public var foregroundViewTop: NSLayoutConstraint!
case Open
case Close
override public init(style: UITableViewCellStyle, reuseIdentifier: String?)
required public init?(coder aDecoder: NSCoder)
override public func awakeFromNib()
public func isAnimating()->Bool
public func animationDuration(itemIndex:NSInteger, type:AnimationType)-> NSTimeInterval
public class RotatedView: UIView
public class RotatedView : UIView
| {
"pile_set_name": "Github"
} |
/******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
* File Name : stm32f10x_i2c.c
* Author : MCD Application Team
* Date First Issued : 09/29/2006
* Description : This file provides all the I2C firmware functions.
********************************************************************************
* History:
* 04/02/2007: V0.2
* 02/05/2007: V0.1
* 09/29/2006: V0.01
********************************************************************************
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_i2c.h"
#include "stm32f10x_rcc.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* I2C SPE mask */
#define CR1_PE_Set ((u16)0x0001)
#define CR1_PE_Reset ((u16)0xFFFE)
/* I2C DMAEN mask */
#define CR2_DMAEN_Set ((u16)0x0800)
#define CR2_DMAEN_Reset ((u16)0xF7FF)
/* I2C LAST mask */
#define CR2_LAST_Set ((u16)0x1000)
#define CR2_LAST_Reset ((u16)0xEFFF)
/* I2C START mask */
#define CR1_START_Set ((u16)0x0100)
#define CR1_START_Reset ((u16)0xFEFF)
/* I2C STOP mask */
#define CR1_STOP_Set ((u16)0x0200)
#define CR1_STOP_Reset ((u16)0xFDFF)
/* I2C ACK mask */
#define CR1_ACK_Set ((u16)0x0400)
#define CR1_ACK_Reset ((u16)0xFBFF)
/* I2C ENGC mask */
#define CR1_ENGC_Set ((u16)0x0040)
#define CR1_ENGC_Reset ((u16)0xFFBF)
/* I2C ADD0 mask */
#define OAR1_ADD0_Set ((u16)0x0001)
#define OAR1_ADD0_Reset ((u16)0xFFFE)
/* I2C SWRST mask */
#define CR1_SWRST_Set ((u16)0x8000)
#define CR1_SWRST_Reset ((u16)0x7FFF)
/* I2C PEC mask */
#define CR1_PEC_Set ((u16)0x1000)
/* I2C ENPEC mask */
#define CR1_ENPEC_Set ((u16)0x0020)
#define CR1_ENPEC_Reset ((u16)0xFFDF)
/* I2C ENARP mask */
#define CR1_ENARP_Set ((u16)0x0010)
#define CR1_ENARP_Reset ((u16)0xFFEF)
/* I2C NOSTRETCH mask */
#define CR1_NOSTRETCH_Set ((u16)0x0080)
#define CR1_NOSTRETCH_Reset ((u16)0xFF7F)
/* I2C ENDUAL mask */
#define OAR2_ENDUAL_Set ((u16)0x0001)
#define OAR2_ENDUAL_Reset ((u16)0xFFFE)
/* I2C F/S mask */
#define CCR_FS_Set ((u16)0x8000)
/* I2C ADD2 mask */
#define OAR2_ADD2_Reset ((u16)0xFF01)
/* I2C FREQ mask */
#define CR2_FREQ_Reset ((u16)0xFFC0)
/* I2C CCR mask */
#define CCR_CCR_Set ((u16)0x0FFF)
/* I2C FLAG mask */
#define I2C_FLAG_Mask ((u32)0x00FFFFFF)
/* I2C registers Masks */
#define CR1_CLEAR_Mask ((u16)0xFBF5)
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/*******************************************************************************
* Function Name : I2C_DeInit
* Description : Deinitializes the I2Cx peripheral registers to their default
* reset values.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* Output : None
* Return : None
*******************************************************************************/
void I2C_DeInit(I2C_TypeDef* I2Cx)
{
switch (*(u32*)&I2Cx)
{
case I2C1_BASE:
/* Enable I2C1 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, ENABLE);
/* Release I2C1 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C1, DISABLE);
break;
case I2C2_BASE:
/* Enable I2C2 reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, ENABLE);
/* Release I2C2 from reset state */
RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C2, DISABLE);
break;
default:
break;
}
}
/*******************************************************************************
* Function Name : I2C_Init
* Description : Initializes the I2Cx according to the specified parameters
* in the I2C_InitStruct.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - I2C_InitStruct: pointer to a I2C_InitTypeDef structure that
* contains the configuration information for the specified
* I2C peripheral.
* Output : None
* Return : None
******************************************************************************/
void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct)
{
u16 tmpreg = 0, freqrange = 0;
u16 result = 0x04;
u32 pclk1clock = 12000000;
RCC_ClocksTypeDef RCC_Clocks;
/* Check the parameters */
assert(IS_I2C_MODE(I2C_InitStruct->I2C_Mode));
assert(IS_I2C_DUTY_CYCLE(I2C_InitStruct->I2C_DutyCycle));
assert(IS_I2C_OWN_ADDRESS1(I2C_InitStruct->I2C_OwnAddress1));
assert(IS_I2C_ACK_STATE(I2C_InitStruct->I2C_Ack));
assert(IS_I2C_ACKNOWLEDGE_ADDRESS(I2C_InitStruct->I2C_AcknowledgedAddress));
assert(IS_I2C_CLOCK_SPEED(I2C_InitStruct->I2C_ClockSpeed));
/*---------------------------- I2Cx CR2 Configuration ------------------------*/
/* Get the I2Cx CR2 value */
tmpreg = I2Cx->CR2;
/* Clear frequency FREQ[5:0] bits */
tmpreg &= CR2_FREQ_Reset;
/* Get PCLK1Clock frequency value */
RCC_GetClocksFreq(&RCC_Clocks);
pclk1clock = RCC_Clocks.PCLK1_Frequency;
/* Set frequency bits depending on PCLK1Clock value */
freqrange = (u16)(pclk1clock / 1000000);
tmpreg |= freqrange;
/* Write to I2Cx CR2 */
I2Cx->CR2 = tmpreg;
/*---------------------------- I2Cx CCR Configuration ------------------------*/
/* Disable I2Cx to configure TRISE */
I2C_Cmd(I2Cx, DISABLE);
/* Reset tmpreg value */
/* Clear F/S, DUTY and CCR[11:0] bits */
tmpreg = 0;
/* Configure speed in standard mode */
if (I2C_InitStruct->I2C_ClockSpeed <= 100000)
{
/* Standard mode speed calculate */
result = (u16)(pclk1clock / (I2C_InitStruct->I2C_ClockSpeed << 1));
/* Test if CCR value is under 0x4*/
if (result < 0x04)
{
/* Set minimum allowed value */
result = 0x04;
}
/* Set speed value for standard mode */
tmpreg |= result;
/* Set Maximum Rise Time: ((1000/(1000000000/pclk1clock))+1 */
I2Cx->TRISE = freqrange + 1;
}
/* Configure speed in fast mode */
else /*(I2C_InitStruct->I2C_ClockSpeed <= 400000)*/
{
if (I2C_InitStruct->I2C_DutyCycle == I2C_DutyCycle_2)
{
/* Fast mode speed calculate: Tlow/Thigh = 2 */
result = (u16)(pclk1clock / (I2C_InitStruct->I2C_ClockSpeed * 3));
}
else /*I2C_InitStruct->I2C_DutyCycle == I2C_DutyCycle_16_9*/
{
/* Fast mode speed calculate: Tlow/Thigh = 16/9 */
result = (u16)(pclk1clock / (I2C_InitStruct->I2C_ClockSpeed * 25));
/* Set DUTY bit */
result |= I2C_DutyCycle_16_9;
}
/* Test if CCR value is under 0x1*/
if ((result & CCR_CCR_Set) == 0)
{
/* Set minimum allowed value */
result |= (u16)0x0001;
}
/* Set speed value and set F/S bit for fast mode */
tmpreg |= result | CCR_FS_Set;
/* Set Maximum Rise Time: ((300/(1000000000/pclk1clock))+1 */
I2Cx->TRISE = (u16)(((freqrange * 300) / 1000) + 1);
}
/* Write to I2Cx CCR */
I2Cx->CCR = tmpreg;
/* Enable I2Cx */
I2C_Cmd(I2Cx, ENABLE);
/*---------------------------- I2Cx CR1 Configuration ------------------------*/
/* Get the I2Cx CR1 value */
tmpreg = I2Cx->CR1;
/* Clear ACK, SMBTYPE and SMBUS bits */
tmpreg &= CR1_CLEAR_Mask;
/* Configure I2Cx: mode and acknowledgement */
/* Set SMBTYPE and SMBUS bits according to I2C_Mode value */
/* Set ACK bit according to I2C_Ack value */
tmpreg |= (u16)((u32)I2C_InitStruct->I2C_Mode | I2C_InitStruct->I2C_Ack);
/* Write to I2Cx CR1 */
I2Cx->CR1 = tmpreg;
/*---------------------------- I2Cx OAR1 Configuration -----------------------*/
/* Set I2Cx Own Address1 and acknowledged address */
I2Cx->OAR1 = (I2C_InitStruct->I2C_AcknowledgedAddress | I2C_InitStruct->I2C_OwnAddress1);
}
/*******************************************************************************
* Function Name : I2C_StructInit
* Description : Fills each I2C_InitStruct member with its default value.
* Input : - I2C_InitStruct: pointer to a I2C_InitTypeDef structure
* which will be initialized.
* Output : None
* Return : None
*******************************************************************************/
void I2C_StructInit(I2C_InitTypeDef* I2C_InitStruct)
{
/*---------------- Reset I2C init structure parameters values ----------------*/
/* Initialize the I2C_Mode member */
I2C_InitStruct->I2C_Mode = I2C_Mode_I2C;
/* Initialize the I2C_DutyCycle member */
I2C_InitStruct->I2C_DutyCycle = I2C_DutyCycle_2;
/* Initialize the I2C_OwnAddress1 member */
I2C_InitStruct->I2C_OwnAddress1 = 0;
/* Initialize the I2C_Ack member */
I2C_InitStruct->I2C_Ack = I2C_Ack_Disable;
/* Initialize the I2C_AcknowledgedAddress member */
I2C_InitStruct->I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
/* initialize the I2C_ClockSpeed member */
I2C_InitStruct->I2C_ClockSpeed = 5000;
}
/*******************************************************************************
* Function Name : I2C_Cmd
* Description : Enables or disables the specified I2C peripheral.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - NewState: new state of the I2Cx peripheral. This parameter
* can be: ENABLE or DISABLE.
* Output : None
* Return : None
*******************************************************************************/
void I2C_Cmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the selected I2C peripheral */
I2Cx->CR1 |= CR1_PE_Set;
}
else
{
/* Disable the selected I2C peripheral */
I2Cx->CR1 &= CR1_PE_Reset;
}
}
/*******************************************************************************
* Function Name : I2C_DMACmd
* Description : Enables or disables the specified I2C DMA requests.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - NewState: new state of the I2C DMA transfer.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None
*******************************************************************************/
void I2C_DMACmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the selected I2C DMA requests */
I2Cx->CR2 |= CR2_DMAEN_Set;
}
else
{
/* Disable the selected I2C DMA requests */
I2Cx->CR2 &= CR2_DMAEN_Reset;
}
}
/*******************************************************************************
* Function Name : I2C_DMALastTransferCmd
* Description : Specifies that the next DMA transfer is the last one.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - NewState: new state of the I2C DMA last transfer.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None
*******************************************************************************/
void I2C_DMALastTransferCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Next DMA end of transfer is the last transfer */
I2Cx->CR2 |= CR2_LAST_Set;
}
else
{
/* Next DMA end of transfer is not the last transfer */
I2Cx->CR2 &= CR2_LAST_Reset;
}
}
/*******************************************************************************
* Function Name : I2C_GenerateSTART
* Description : Generates I2Cx communication START condition.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - NewState: new state of the I2C START condition generation.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None.
*******************************************************************************/
void I2C_GenerateSTART(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Generate a START condition */
I2Cx->CR1 |= CR1_START_Set;
}
else
{
/* Disable the START condition generation */
I2Cx->CR1 &= CR1_START_Reset;
}
}
/*******************************************************************************
* Function Name : I2C_GenerateSTOP
* Description : Generates I2Cx communication STOP condition.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - NewState: new state of the I2C STOP condition generation.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None.
*******************************************************************************/
void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Generate a STOP condition */
I2Cx->CR1 |= CR1_STOP_Set;
}
else
{
/* Disable the STOP condition generation */
I2Cx->CR1 &= CR1_STOP_Reset;
}
}
/*******************************************************************************
* Function Name : I2C_AcknowledgeConfig
* Description : Enables or disables the specified I2C acknowledge feature.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - NewState: new state of the I2C Acknowledgement.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None.
*******************************************************************************/
void I2C_AcknowledgeConfig(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the acknowledgement */
I2Cx->CR1 |= CR1_ACK_Set;
}
else
{
/* Disable the acknowledgement */
I2Cx->CR1 &= CR1_ACK_Reset;
}
}
/*******************************************************************************
* Function Name : I2C_OwnAddress2Config
* Description : Configures the specified I2C own address2.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - Address: specifies the 7bit I2C own address2.
* Output : None
* Return : None.
*******************************************************************************/
void I2C_OwnAddress2Config(I2C_TypeDef* I2Cx, u8 Address)
{
u16 tmpreg = 0;
/* Get the old register value */
tmpreg = I2Cx->OAR2;
/* Reset I2Cx Own address2 bit [7:1] */
tmpreg &= OAR2_ADD2_Reset;
/* Set I2Cx Own address2 */
tmpreg |= (u16)(Address & (u16)0x00FE);
/* Store the new register value */
I2Cx->OAR2 = tmpreg;
}
/*******************************************************************************
* Function Name : I2C_DualAddressCmd
* Description : Enables or disables the specified I2C dual addressing mode.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - NewState: new state of the I2C dual addressing mode.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None
*******************************************************************************/
void I2C_DualAddressCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable dual addressing mode */
I2Cx->OAR2 |= OAR2_ENDUAL_Set;
}
else
{
/* Disable dual addressing mode */
I2Cx->OAR2 &= OAR2_ENDUAL_Reset;
}
}
/*******************************************************************************
* Function Name : I2C_GeneralCallCmd
* Description : Enables or disables the specified I2C general call feature.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - NewState: new state of the I2C General call.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None
*******************************************************************************/
void I2C_GeneralCallCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable generall call */
I2Cx->CR1 |= CR1_ENGC_Set;
}
else
{
/* Disable generall call */
I2Cx->CR1 &= CR1_ENGC_Reset;
}
}
/*******************************************************************************
* Function Name : I2C_ITConfig
* Description : Enables or disables the specified I2C interrupts.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - I2C_IT: specifies the I2C interrupts sources to be enabled
* or disabled.
* This parameter can be any combination of the following values:
* - I2C_IT_BUF: Buffer interrupt mask
* - I2C_IT_EVT: Event interrupt mask
* - I2C_IT_ERR: Error interrupt mask
* - NewState: new state of the specified I2C interrupts.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None
*******************************************************************************/
void I2C_ITConfig(I2C_TypeDef* I2Cx, u16 I2C_IT, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
assert(IS_I2C_CONFIG_IT(I2C_IT));
if (NewState != DISABLE)
{
/* Enable the selected I2C interrupts */
I2Cx->CR2 |= I2C_IT;
}
else
{
/* Disable the selected I2C interrupts */
I2Cx->CR2 &= (u16)~I2C_IT;
}
}
/*******************************************************************************
* Function Name : I2C_SendData
* Description : Sends a data byte through the I2Cx peripheral.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - Data: Byte to be transmitted..
* Output : None
* Return : None
*******************************************************************************/
void I2C_SendData(I2C_TypeDef* I2Cx, u8 Data)
{
/* Write in the DR register the data to be sent */
I2Cx->DR = Data;
}
/*******************************************************************************
* Function Name : I2C_ReceiveData
* Description : Returns the most recent received data by the I2Cx peripheral.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* Output : None
* Return : The value of the received data.
*******************************************************************************/
u8 I2C_ReceiveData(I2C_TypeDef* I2Cx)
{
/* Return the data in the DR register */
return (u8)I2Cx->DR;
}
/*******************************************************************************
* Function Name : I2C_Send7bitAddress
* Description : Transmits the address byte to select the slave device.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - Address: specifies the slave address which will be transmitted
* - Direction: specifies whether the I2C device will be a
* Transmitter or a Receiver.
* This parameter can be one of the following values
* - I2C_Direction_Transmitter: Transmitter mode
* - I2C_Direction_Receiver: Receiver mode
* Output : None
* Return : None.
*******************************************************************************/
void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, u8 Address, u8 I2C_Direction)
{
/* Check the parameters */
assert(IS_I2C_DIRECTION(I2C_Direction));
/* Test on the direction to set/reset the read/write bit */
if (I2C_Direction != I2C_Direction_Transmitter)
{
/* Set the address ADD0 bit0 for read */
Address |= OAR1_ADD0_Set;
}
else
{
/* Reset the address bit0 for write */
Address &= OAR1_ADD0_Reset;
}
/* Send the address */
I2Cx->DR = Address;
}
/*******************************************************************************
* Function Name : I2C_ReadRegister
* Description : Reads the specified I2C register and returns its value.
* Input1 : - I2C_Register: specifies the register to read.
* This parameter can be one of the following values:
* - I2C_Register_CR1: CR1 register.
* - I2C_Register_CR2: CR2 register.
* - I2C_Register_OAR1: OAR1 register.
* - I2C_Register_OAR2: OAR2 register.
* - I2C_Register_DR: DR register.
* - I2C_Register_SR1: SR1 register.
* - I2C_Register_SR2: SR2 register.
* - I2C_Register_CCR: CCR register.
* - I2C_Register_TRISE: TRISE register.
* Output : None
* Return : The value of the read register.
*******************************************************************************/
u16 I2C_ReadRegister(I2C_TypeDef* I2Cx, u8 I2C_Register)
{
/* Check the parameters */
assert(IS_I2C_REGISTER(I2C_Register));
/* Return the selected register value */
return (*(u16 *)(*((u32 *)&I2Cx) + I2C_Register));
}
/*******************************************************************************
* Function Name : I2C_SoftwareResetCmd
* Description : Enables or disables the specified I2C software reset.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - NewState: new state of the I2C software reset.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None
*******************************************************************************/
void I2C_SoftwareResetCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Peripheral under reset */
I2Cx->CR1 |= CR1_SWRST_Set;
}
else
{
/* Peripheral not under reset */
I2Cx->CR1 &= CR1_SWRST_Reset;
}
}
/*******************************************************************************
* Function Name : I2C_SMBusAlertConfig
* Description : Drives the SMBusAlert pin high or low for the specified I2C.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - I2C_SMBusAlert: specifies SMBAlert pin level.
* This parameter can be one of the following values:
* - I2C_SMBusAlert_Low: SMBAlert pin driven low
* - I2C_SMBusAlert_High: SMBAlert pin driven high
* Output : None
* Return : None
*******************************************************************************/
void I2C_SMBusAlertConfig(I2C_TypeDef* I2Cx, u16 I2C_SMBusAlert)
{
/* Check the parameters */
assert(IS_I2C_SMBUS_ALERT(I2C_SMBusAlert));
if (I2C_SMBusAlert == I2C_SMBusAlert_Low)
{
/* Drive the SMBusAlert pin Low */
I2Cx->CR1 |= I2C_SMBusAlert_Low;
}
else
{
/* Drive the SMBusAlert pin High */
I2Cx->CR1 &= I2C_SMBusAlert_High;
}
}
/*******************************************************************************
* Function Name : I2C_TransmitPEC
* Description : Enables the specified I2C PEC transfer.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* Output : None
* Return : None
*******************************************************************************/
void I2C_TransmitPEC(I2C_TypeDef* I2Cx)
{
/* Enable the selected I2C PEC transmission */
I2Cx->CR1 |= CR1_PEC_Set;
}
/*******************************************************************************
* Function Name : I2C_PECPositionConfig
* Description : Selects the specified I2C PEC position.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - I2C_PECPosition: specifies the PEC position.
* This parameter can be one of the following values:
* - I2C_PECPosition_Next: PEC bit indicates that current
* byte is PEC
* - I2C_PECPosition_Current: PEC bit indicates that the
* next byte is PEC
* Output : None
* Return : None
*******************************************************************************/
void I2C_PECPositionConfig(I2C_TypeDef* I2Cx, u16 I2C_PECPosition)
{
/* Check the parameters */
assert(IS_I2C_PEC_POSITION(I2C_PECPosition));
if (I2C_PECPosition == I2C_PECPosition_Next)
{
/* PEC indicates that the next byte in shift register is PEC */
I2Cx->CR1 |= I2C_PECPosition_Next;
}
else
{
/* PEC indicates that the current byte in shift register is PEC */
I2Cx->CR1 &= I2C_PECPosition_Current;
}
}
/*******************************************************************************
* Function Name : I2C_CalculatePEC
* Description : Enables or disables the PEC value calculation of the
* transfered bytes.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - NewState: new state of the I2Cx PEC value calculation.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None
*******************************************************************************/
void I2C_CalculatePEC(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the selected I2C PEC calculation */
I2Cx->CR1 |= CR1_ENPEC_Set;
}
else
{
/* Disable the selected I2C PEC calculation */
I2Cx->CR1 &= CR1_ENPEC_Reset;
}
}
/*******************************************************************************
* Function Name : I2C_GetPEC
* Description : Returns the PEC value for the specified I2C.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* Output : None
* Return : The PEC value.
*******************************************************************************/
u8 I2C_GetPEC(I2C_TypeDef* I2Cx)
{
u8 pec;
/* Get the PEC value */
pec = (I2Cx->SR2) >> 8;
/* Return the selected I2C PEC register value */
return pec;
}
/*******************************************************************************
* Function Name : I2C_ARPCmd
* Description : Enables or disables the specified I2C ARP.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - NewState: new state of the I2Cx ARP.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None
*******************************************************************************/
void I2C_ARPCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the selected I2C ARP */
I2Cx->CR1 |= CR1_ENARP_Set;
}
else
{
/* Disable the selected I2C ARP */
I2Cx->CR1 &= CR1_ENARP_Reset;
}
}
/*******************************************************************************
* Function Name : I2C_StretchClockCmd
* Description : Enables or disables the specified I2C Clock stretching.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - NewState: new state of the I2Cx Clock stretching.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None
*******************************************************************************/
void I2C_StretchClockCmd(I2C_TypeDef* I2Cx, FunctionalState NewState)
{
/* Check the parameters */
assert(IS_FUNCTIONAL_STATE(NewState));
if (NewState == DISABLE)
{
/* Enable the selected I2C Clock stretching */
I2Cx->CR1 |= CR1_NOSTRETCH_Set;
}
else
{
/* Disable the selected I2C Clock stretching */
I2Cx->CR1 &= CR1_NOSTRETCH_Reset;
}
}
/*******************************************************************************
* Function Name : I2C_FastModeDutyCycleConfig
* Description : Selects the specified I2C fast mode duty cycle.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - I2C_DutyCycle: specifies the fast mode duty cycle.
* This parameter can be one of the following values:
* - I2C_DutyCycle_2: I2C fast mode Tlow/Thigh = 2
* - I2C_DutyCycle_16_9: I2C fast mode Tlow/Thigh = 16/9
* Output : None
* Return : None
*******************************************************************************/
void I2C_FastModeDutyCycleConfig(I2C_TypeDef* I2Cx, u16 I2C_DutyCycle)
{
/* Check the parameters */
assert(IS_I2C_DUTY_CYCLE(I2C_DutyCycle));
if (I2C_DutyCycle != I2C_DutyCycle_16_9)
{
/* I2C fast mode Tlow/Thigh=2 */
I2Cx->CCR &= I2C_DutyCycle_2;
}
else
{
/* I2C fast mode Tlow/Thigh=16/9 */
I2Cx->CCR |= I2C_DutyCycle_16_9;
}
}
/*******************************************************************************
* Function Name : I2C_GetLastEvent
* Description : Returns the Last I2C Event.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* Output : None
* Return : The last event
*******************************************************************************/
u32 I2C_GetLastEvent(I2C_TypeDef* I2Cx)
{
u32 LastEvent = 0;
u32 Flag1 = 0, Flag2 = 0;
Flag1 = I2Cx->SR1;
Flag2 = I2Cx->SR2;
Flag2 = Flag2 << 16;
/* Get the last event value from I2C status register */
LastEvent = (Flag1 | Flag2) & I2C_FLAG_Mask;
/* Return status */
return LastEvent;
}
/*******************************************************************************
* Function Name : I2C_CheckEvent
* Description : Checks whether the Last I2C Event is equal to the one passed
* as parameter.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - I2C_EVENT: specifies the event to be checked.
* This parameter can be one of the following values:
* - I2C_EVENT_SLAVE_ADDRESS_MATCHED : EV1
* - I2C_EVENT_SLAVE_BYTE_RECEIVED : EV2
* - I2C_EVENT_SLAVE_BYTE_TRANSMITTED : EV3
* - I2C_EVENT_SLAVE_ACK_FAILURE : EV3-1
* - I2C_EVENT_MASTER_MODE_SELECT : EV5
* - I2C_EVENT_MASTER_MODE_SELECTED : EV6
* - I2C_EVENT_MASTER_BYTE_RECEIVED : EV7
* - I2C_EVENT_MASTER_BYTE_TRANSMITTED : EV8
* - I2C_EVENT_MASTER_MODE_ADDRESS10 : EV9
* - I2C_EVENT_SLAVE_STOP_DETECTED : EV4
* Output : None
* Return : An ErrorStatus enumuration value:
* - SUCCESS: Last event is equal to the I2C_Event
* - ERROR: Last event is different from the I2C_Event
*******************************************************************************/
ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx, u32 I2C_EVENT)
{
u32 LastEvent = 0;
u32 Flag1 = 0, Flag2 = 0;
ErrorStatus status = ERROR;
/* Check the parameters */
assert(IS_I2C_EVENT(I2C_EVENT));
Flag1 = I2Cx->SR1;
Flag2 = I2Cx->SR2;
Flag2 = Flag2 << 16;
/* Get the last event value from I2C status register */
LastEvent = (Flag1 | Flag2) & I2C_FLAG_Mask;
/* Check whether the last event is equal to I2C_EVENT */
if (LastEvent == I2C_EVENT )
{
/* SUCCESS: last event is equal to I2C_EVENT */
status = SUCCESS;
}
else
{
/* ERROR: last event is different from I2C_EVENT */
status = ERROR;
}
/* Return status */
return status;
}
/*******************************************************************************
* Function Name : I2C_GetFlagStatus
* Description : Checks whether the specified I2C flag is set or not.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - I2C_FLAG: specifies the flag to check.
* This parameter can be one of the following values:
* - I2C_FLAG_DUALF: Dual flag (Slave mode)
* - I2C_FLAG_SMBHOST: SMBus host header (Slave mode)
* - I2C_FLAG_SMBDEFAULT: SMBus default header (Slave mode)
* - I2C_FLAG_GENCALL: General call header flag (Slave mode)
* - I2C_FLAG_TRA: Transmitter/Receiver flag
* - I2C_FLAG_BUSY: Bus busy flag
* - I2C_FLAG_MSL: Master/Slave flag
* - I2C_FLAG_SMBALERT: SMBus Alert flag
* - I2C_FLAG_TIMEOUT: Timeout or Tlow error flag
* - I2C_FLAG_PECERR: PEC error in reception flag
* - I2C_FLAG_OVR: Overrun/Underrun flag (Slave mode)
* - I2C_FLAG_AF: Acknowledge failure flag
* - I2C_FLAG_ARLO: Arbitration lost flag (Master mode)
* - I2C_FLAG_BERR: Bus error flag
* - I2C_FLAG_TXE: Data register empty flag (Transmitter)
* - I2C_FLAG_RXNE: Data register not empty (Receiver) flag
* - I2C_FLAG_STOPF: Stop detection flag (Slave mode)
* - I2C_FLAG_ADD10: 10-bit header sent flag (Master mode)
* - I2C_FLAG_BTF: Byte transfer finished flag
* - I2C_FLAG_ADDR: Address sent flag (Master mode) “ADSL”
* Address matched flag (Slave mode)”ENDAD”
* - I2C_FLAG_SB: Start bit flag (Master mode)
* Output : None
* Return : The new state of I2C_FLAG (SET or RESET).
*******************************************************************************/
FlagStatus I2C_GetFlagStatus(I2C_TypeDef* I2Cx, u32 I2C_FLAG)
{
FlagStatus bitstatus = RESET;
u32 i2cstatus = 0;
u32 Flag1 = 0, Flag2 = 0;
/* Check the parameters */
assert(IS_I2C_GET_FLAG(I2C_FLAG));
/* Read the I2Cx status register */
Flag1 = I2Cx->SR1;
Flag2 = I2Cx->SR2;
Flag2 = (Flag2 & I2C_FLAG_Mask) << 16;
/* Get the I2C status value */
i2cstatus = Flag1 | Flag2;
/* Get bit[27:0] of the flag */
I2C_FLAG &= I2C_FLAG_Mask;
/* Check the status of the specified I2C flag */
if ((i2cstatus & I2C_FLAG) != (u32)RESET)
{
/* I2C_FLAG is set */
bitstatus = SET;
}
else
{
/* I2C_FLAG is reset */
bitstatus = RESET;
}
/* Return the I2C_FLAG status */
return bitstatus;
}
/*******************************************************************************
* Function Name : I2C_ClearFlag
* Description : Clears the I2Cx's pending flags.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - I2C_FLAG: specifies the flag to clear.
* This parameter can be one of the following values:
* - I2C_FLAG_SMBALERT: SMBus Alert flag
* - I2C_FLAG_TIMEOUT: Timeout or Tlow error flag
* - I2C_FLAG_PECERR: PEC error in reception flag
* - I2C_FLAG_OVR: Overrun/Underrun flag (Slave mode)
* - I2C_FLAG_AF: Acknowledge failure flag
* - I2C_FLAG_ARLO: Arbitration lost flag (Master mode)
* - I2C_FLAG_BERR: Bus error flag
* - I2C_FLAG_STOPF: Stop detection flag (Slave mode)
* - I2C_FLAG_ADD10: 10-bit header sent flag (Master mode)
* - I2C_FLAG_BTF: Byte transfer finished flag
* - I2C_FLAG_ADDR: Address sent flag (Master mode) “ADSL”
* Address matched flag (Slave mode)”ENDAD”
* - I2C_FLAG_SB: Start bit flag (Master mode)
* Output : None
* Return : None
*******************************************************************************/
void I2C_ClearFlag(I2C_TypeDef* I2Cx, u32 I2C_FLAG)
{
u32 flagpos = 0;
u8 flagindex = 0;
/* Check the parameters */
assert(IS_I2C_CLEAR_FLAG(I2C_FLAG));
/* Get the I2C flag position */
flagpos = I2C_FLAG & I2C_FLAG_Mask;
/* Get the I2C flag index */
flagindex = I2C_FLAG >> 28;
/* Clear the flag by writing 0 */
if (flagindex == 1)
{
/* Clear the selected I2C flag */
I2Cx->SR1 &= ~flagpos;
}
/* Flags that need a read of the SR1 register to be cleared */
else if (flagindex == 2)
{
/* Read the SR1 register */
(void)I2Cx->SR1;
}
/* Flags that need a read of SR1 and a write on CR2 registers to be cleared */
else if (flagindex == 6)
{
/* Read the SR1 register */
(void)I2Cx->SR1;
/* Write on the CR1 register */
I2Cx->CR1 |= CR1_PE_Set;
}
/* Flags that need a read of SR1 and a write on CR2 registers to be cleared */
else /*flagindex == 0xA*/
{
/* Read the SR1 register */
(void)I2Cx->SR1;
/* Read the SR2 register */
(void)I2Cx->SR2;
}
}
/*******************************************************************************
* Function Name : I2C_GetITStatus
* Description : Checks whether the specified I2C interrupt has occurred or not.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - I2C_IT: specifies the interrupt source to check.
* This parameter can be one of the following values:
* - I2C_IT_SMBALERT: SMBus Alert flag
* - I2C_IT_TIMEOUT: Timeout or Tlow error flag
* - I2C_IT_PECERR: PEC error in reception flag
* - I2C_IT_OVR: Overrun/Underrun flag (Slave mode)
* - I2C_IT_AF: Acknowledge failure flag
* - I2C_IT_ARLO: Arbitration lost flag (Master mode)
* - I2C_IT_BERR: Bus error flag
* - I2C_IT_TXE: Data register empty flag (Transmitter)
* - I2C_IT_RXNE: Data register not empty (Receiver) flag
* - I2C_IT_STOPF: Stop detection flag (Slave mode)
* - I2C_IT_ADD10: 10-bit header sent flag (Master mode)
* - I2C_IT_BTF: Byte transfer finished flag
* - I2C_IT_ADDR: Address sent flag (Master mode) “ADSL”
* Address matched flag (Slave mode)”ENDAD”
* - I2C_IT_SB: Start bit flag (Master mode)
* Output : None
* Return : The new state of I2C_IT (SET or RESET).
*******************************************************************************/
ITStatus I2C_GetITStatus(I2C_TypeDef* I2Cx, u32 I2C_IT)
{
ITStatus bitstatus = RESET;
u32 i2cstatus = 0;
u32 Flag1 = 0, Flag2 = 0;
/* Check the parameters */
assert(IS_I2C_GET_IT(I2C_IT));
/* Read the I2Cx status register */
Flag1 = I2Cx->SR1;
Flag2 = I2Cx->SR2;
Flag2 = (Flag2 & I2C_FLAG_Mask) << 16;
/* Get the I2C status value */
i2cstatus = Flag1 | Flag2;
/* Get bit[27:0] of the flag */
I2C_IT &= I2C_FLAG_Mask;
/* Check the status of the specified I2C flag */
if ((i2cstatus & I2C_IT) != (u32)RESET)
{
/* I2C_IT is set */
bitstatus = SET;
}
else
{
/* I2C_IT is reset */
bitstatus = RESET;
}
/* Return the I2C_IT status */
return bitstatus;
}
/*******************************************************************************
* Function Name : I2C_ClearITPendingBit
* Description : Clears the I2Cx’s interrupt pending bits.
* Input : - I2Cx: where x can be 1 or 2 to select the I2C peripheral.
* - I2C_IT: specifies the interrupt pending to clear.
* This parameter can be one of the following values:
* - I2C_IT_SMBALERT: SMBus Alert flag
* - I2C_IT_TIMEOUT: Timeout or Tlow error flag
* - I2C_IT_PECERR: PEC error in reception flag
* - I2C_IT_OVR: Overrun/Underrun flag (Slave mode)
* - I2C_IT_AF: Acknowledge failure flag
* - I2C_IT_ARLO: Arbitration lost flag (Master mode)
* - I2C_IT_BERR: Bus error flag
* - I2C_IT_STOPF: Stop detection flag (Slave mode)
* - I2C_IT_ADD10: 10-bit header sent flag (Master mode)
* - I2C_IT_BTF: Byte transfer finished flag
* - I2C_IT_ADDR: Address sent flag (Master mode) “ADSL”
* Address matched flag (Slave mode)”ENDAD”
* - I2C_IT_SB: Start bit flag (Master mode)
* Output : None
* Return : None
*******************************************************************************/
void I2C_ClearITPendingBit(I2C_TypeDef* I2Cx, u32 I2C_IT)
{
u32 flagpos = 0;
u8 flagindex = 0;
/* Check the parameters */
assert(IS_I2C_CLEAR_IT(I2C_IT));
/* Get the I2C flag position */
flagpos = I2C_IT & I2C_FLAG_Mask;
/* Get the I2C flag index */
flagindex = I2C_IT >> 28;
/* Clear the flag by writing 0 */
if (flagindex == 1)
{
/* Clear the selected I2C flag */
I2Cx->SR1 &= ~flagpos;
}
/* Flags that need a read of the SR1 register to be cleared */
else if (flagindex == 2)
{
/* Read the SR1 register */
(void)I2Cx->SR1;
}
/* Flags that need a read of SR1 and a write on CR2 registers to be cleared */
else if (flagindex == 6)
{
/* Read the SR1 register */
(void)I2Cx->SR1;
/* Write on the CR1 register */
I2Cx->CR1 |= CR1_PE_Set;
}
/* Flags that need a read of SR1 and a write on CR2 registers to be cleared */
else /*flagindex == 0xA*/
{
/* Read the SR1 register */
(void)I2Cx->SR1;
/* Read the SR2 register */
(void)I2Cx->SR2;
}
}
/******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
| {
"pile_set_name": "Github"
} |
/*--------------------------------------------------------
EDRTEST.C -- Program using EDRLIB dynamic-link library
(c) Charles Petzold, 1998
--------------------------------------------------------*/
#include <windows.h>
#include "edrlib.h"
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("StrProg") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow (szAppName, TEXT ("DLL Demonstration Program"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL) ;
ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc ;
PAINTSTRUCT ps ;
RECT rect ;
switch (message)
{
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;
GetClientRect (hwnd, &rect) ;
EdrCenterText (hdc, &rect,
TEXT ("This string was displayed by a DLL")) ;
EndPaint (hwnd, &ps) ;
return 0 ;
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
| {
"pile_set_name": "Github"
} |
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
| {
"pile_set_name": "Github"
} |
using System;
using ObjCRuntime;
using Foundation;
namespace AppKit {
public partial class NSSliderTouchBarItem {
// If you modify, also search for other other XM_ACTIVATED_COPY and update as well
NSObject target;
Selector action;
public event EventHandler Activated {
add {
target = ActionDispatcher.SetupAction (Target, value);
action = ActionDispatcher.Action;
MarkDirty ();
Target = target;
Action = action;
}
remove {
ActionDispatcher.RemoveAction (Target, value);
target = null;
action = null;
MarkDirty ();
}
}
}
}
| {
"pile_set_name": "Github"
} |
%% -------------------------------------------------------------------
%%
%% Copyright (c) 2015 Helium Systems, Inc. All Rights Reserved.
%% Copyright (c) 2016 Christopher Meiklejohn. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You may obtain
%% a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing,
%% software distributed under the License is distributed on an
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
%% KIND, either express or implied. See the License for the
%% specific language governing permissions and limitations
%% under the License.
%%
%% -------------------------------------------------------------------
-module(partisan_sup).
-behaviour(supervisor).
-include("partisan.hrl").
-export([start_link/0]).
-export([init/1]).
-define(CHILD(I, Type, Timeout),
{I, {I, start_link, []}, permanent, Timeout, Type, [I]}).
-define(CHILD(I, Type), ?CHILD(I, Type, 5000)).
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
partisan_config:init(),
Manager = partisan_peer_service:manager(),
Children = lists:flatten(
[
?CHILD(partisan_rpc_backend, worker),
?CHILD(partisan_acknowledgement_backend, worker),
?CHILD(partisan_orchestration_backend, worker),
?CHILD(Manager, worker),
?CHILD(partisan_peer_service_events, worker),
?CHILD(partisan_plumtree_backend, worker),
?CHILD(partisan_plumtree_broadcast, worker),
?CHILD(partisan_monitor, worker)
]),
%% Run a single backend for each label.
CausalLabels = partisan_config:get(causal_labels, []),
CausalBackendFun = fun(Label) ->
{partisan_causality_backend,
{partisan_causality_backend, start_link, [Label]},
permanent, 5000, worker, [partisan_causality_backend]}
end,
CausalBackends = lists:map(CausalBackendFun, CausalLabels),
lager:info("Partisan listening on ~p:~p listen_addrs: ~p",
[partisan_config:get(peer_ip), partisan_config:get(peer_port), partisan_config:get(listen_addrs)]),
%% Open connection pool.
PoolSup = {partisan_pool_sup,
{partisan_pool_sup, start_link, []},
permanent, 20000, supervisor, [partisan_pool_sup]},
%% Initialize the connection cache supervised by the supervisor.
?CACHE = ets:new(?CACHE, [public, named_table, set, {read_concurrency, true}]),
RestartStrategy = {one_for_one, 10, 10},
{ok, {RestartStrategy, Children ++ CausalBackends ++ [PoolSup]}}. | {
"pile_set_name": "Github"
} |
:10FC000001C0DDC0112484B790E890936100109288
:10FC10006100882361F0982F9A70923041F081FF43
:10FC200002C097EF94BF282E80E0ECD0E9C185E0B8
:10FC30008093810082E08093C80088E18093C900AE
:10FC400081E08093CC0086E08093CA008EE0DAD019
:10FC5000279A84E02EE33EEF91E0309385002093D5
:10FC6000840096BBB09BFECF1F9AA8954091C80018
:10FC700047FD02C0815089F7B9D0813479F4B6D0FC
:10FC8000C82FC6D0C23811F480E004C088E0C13863
:10FC900009F083E0A4D080E1A2D0EECF823419F441
:10FCA00084E1BED0F8CF853411F485E0FACF8535F4
:10FCB00041F49CD0E82E9AD0F82EEE0CFF1CA8D070
:10FCC000EACF863519F484E0ABD0DECF843609F074
:10FCD00045C08CD0C82FD0E0DC2FCC2787D0C82BD4
:10FCE00085D0D82E5E01B39400E011E04801EFEF1B
:10FCF0008E1A9E0A7BD0F801808384018A149B04AB
:10FD0000A9F786D0F5E410E000E0DF1609F150E035
:10FD100040E063E0C70153D08701C12CDD24D394B8
:10FD2000F601419151916F0161E0C80148D00E5F29
:10FD30001F4F2297A9F750E040E065E0C7013FD090
:10FD4000AACF6081C8018E0D9F1D79D00F5F1F4F14
:10FD5000F801F395C017D107A1F79DCF843701F5BE
:10FD600045D0C82FD0E0DC2FCC2740D0C82B3ED0C8
:10FD7000D82E4ED08701F5E4DF120BC0CE0DDF1D6B
:10FD8000C80155D02CD00F5F1F4FC017D107C1F746
:10FD900082CFF80185918F0122D02197D1F77BCFB7
:10FDA000853739F435D08EE11AD086E918D089E04C
:10FDB00071CF813509F083CF88E024D080CFFC015A
:10FDC0000A0167BFE895112407B600FCFDCF6670F5
:10FDD00029F0452B19F481E187BFE89508959091AA
:10FDE000C80095FFFCCF8093CE0008958091C80095
:10FDF00087FFFCCF8091C80084FD01C0A895809149
:10FE0000CE000895E0E6F0E098E1908380830895C5
:10FE1000EDDF803219F088E0F5DFFFCF84E1DFCF3E
:10FE2000CF93C82FE3DFC150E9F7CF91F1CFF99914
:10FE3000FECF92BD81BDF89A992780B50895262FEF
:10FE4000F999FECF1FBA92BD81BD20BD0FB6F894BF
:0AFE5000FA9AF99A0FBE0196089580
:02FFFE000008F9
:040000030000FC00FD
:00000001FF
| {
"pile_set_name": "Github"
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AlbumCoverMatchGame")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AlbumCoverMatchGame")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)] | {
"pile_set_name": "Github"
} |
<snippet>
<content><![CDATA[luaj.callStaticMethod(${1:className}, ${2:methodName}, ${3:args}, ${4:sig})]]></content>
<tabTrigger>luaj.callStaticMethod(className, methodName, args, sig)</tabTrigger>
<scope>source.lua</scope>
<description>.</description>
</snippet>
| {
"pile_set_name": "Github"
} |
<?php
namespace WP_Rocket\Engine\CriticalPath;
use WP_Rocket\Admin\Options_Data;
use WP_Rocket\Event_Management\Subscriber_Interface;
use WP_Filesystem_Direct;
/**
* Critical CSS Subscriber.
*
* @since 3.3
*/
class CriticalCSSSubscriber implements Subscriber_Interface {
/**
* Instance of Critical CSS.
*
* @var Critical_CSS
*/
protected $critical_css;
/**
* Instance of options.
*
* @var Options_Data
*/
protected $options;
/**
* Instance of the filesystem handler.
*
* @var WP_Filesystem_Direct
*/
private $filesystem;
/**
* CPCSS generation and deletion service.
*
* @var ProcessorService instance for this service.
*/
private $cpcss_service;
/**
* Creates an instance of the Critical CSS Subscriber.
*
* @param CriticalCSS $critical_css Critical CSS instance.
* @param ProcessorService $cpcss_service Has the logic for cpcss generation and deletion.
* @param Options_Data $options WP Rocket options.
* @param WP_Filesystem_Direct $filesystem Instance of the filesystem handler.
*/
public function __construct( CriticalCSS $critical_css, ProcessorService $cpcss_service, Options_Data $options, $filesystem ) {
$this->critical_css = $critical_css;
$this->cpcss_service = $cpcss_service;
$this->options = $options;
$this->filesystem = $filesystem;
}
/**
* Return an array of events that this subscriber wants to listen to.
*
* @since 3.3
*
* @return array
*/
public static function get_subscribed_events() {
// phpcs:disable WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned
return [
'admin_post_rocket_generate_critical_css' => 'init_critical_css_generation',
'update_option_' . rocket_get_constant( 'WP_ROCKET_SLUG' ) => [
[ 'generate_critical_css_on_activation', 11, 2 ],
[ 'stop_process_on_deactivation', 11, 2 ],
[ 'maybe_generate_cpcss_mobile', 12, 2 ],
],
'admin_notices' => [
[ 'notice_critical_css_generation_triggered' ],
[ 'critical_css_generation_running_notice' ],
[ 'critical_css_generation_complete_notice' ],
[ 'warning_critical_css_dir_permissions' ],
],
'wp_head' => [ 'insert_load_css', PHP_INT_MAX ],
'rocket_buffer' => [
[ 'insert_critical_css_buffer', 19 ],
[ 'async_css', 32 ],
],
'switch_theme' => 'maybe_regenerate_cpcss',
'rocket_excluded_inline_js_content' => 'exclude_inline_js',
'before_delete_post' => 'delete_cpcss',
];
// phpcs:enable WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned
}
/**
* Deletes the custom CPCSS files from /posts/ folder.
*
* @since 3.6
*
* @param int $post_id Deleted post id.
*/
public function delete_cpcss( $post_id ) {
if ( ! current_user_can( 'rocket_regenerate_critical_css' ) ) {
return;
}
if ( ! $this->options->get( 'async_css', 0 ) ) {
return;
}
$post_type = get_post_type( $post_id );
$item_path = 'posts' . DIRECTORY_SEPARATOR . "{$post_type}-{$post_id}.css";
$this->cpcss_service->process_delete( $item_path );
if ( $this->options->get( 'async_css_mobile', 0 ) ) {
$mobile_item_path = 'posts' . DIRECTORY_SEPARATOR . "{$post_type}-{$post_id}-mobile.css";
$this->cpcss_service->process_delete( $mobile_item_path );
}
}
/**
* This notice is displayed when the Critical CSS Generation is triggered from a different page than
* WP Rocket settings page.
*
* @since 3.4.1
*/
public function notice_critical_css_generation_triggered() {
if ( ! current_user_can( 'rocket_regenerate_critical_css' ) ) {
return;
}
$screen = get_current_screen();
if ( 'settings_page_wprocket' === $screen->id ) {
return;
}
if ( false === get_transient( 'rocket_critical_css_generation_triggered' ) ) {
return;
}
delete_transient( 'rocket_critical_css_generation_triggered' );
$message = __( 'Critical CSS generation is currently running.', 'rocket' );
if ( current_user_can( 'rocket_manage_options' ) ) {
$message .= ' ' . sprintf(
// Translators: %1$s = opening link tag, %2$s = closing link tag.
__( 'Go to the %1$sWP Rocket settings%2$s page to track progress.', 'rocket' ),
'<a href="' . esc_url( admin_url( 'options-general.php?page=' . WP_ROCKET_PLUGIN_SLUG ) ) . '">',
'</a>'
);
}
rocket_notice_html(
[
'status' => 'info',
'message' => $message,
]
);
}
/**
* Launches the critical CSS generation from admin.
*
* @since 2.11
*
* @see CriticalCSS::process_handler()
*/
public function init_critical_css_generation() {
if (
! isset( $_GET['_wpnonce'] )
||
! wp_verify_nonce( sanitize_key( $_GET['_wpnonce'] ), 'rocket_generate_critical_css' )
) {
wp_nonce_ays( '' );
}
if ( ! current_user_can( 'rocket_regenerate_critical_css' ) ) {
wp_die();
}
$version = 'default';
if ( $this->critical_css->is_async_css_mobile() ) {
$version = 'all';
}
$this->critical_css->process_handler( $version );
if ( ! strpos( wp_get_referer(), 'wprocket' ) ) {
set_transient( 'rocket_critical_css_generation_triggered', 1 );
}
wp_safe_redirect( esc_url_raw( wp_get_referer() ) );
rocket_get_constant( 'WP_ROCKET_IS_TESTING', false ) ? wp_die() : exit;
}
/**
* Launches the critical CSS generation when activating the async CSS option.
*
* @since 2.11
*
* @param array $old_value Previous values for WP Rocket settings.
* @param array $value New values for WP Rocket settings.
*
* @see CriticalCSS::process_handler()
*/
public function generate_critical_css_on_activation( $old_value, $value ) {
if (
! isset( $old_value['async_css'], $value['async_css'] )
||
( $old_value['async_css'] === $value['async_css'] )
|| 1 !== (int) $value['async_css']
) {
return;
}
$critical_css_path = $this->critical_css->get_critical_css_path();
// Check if the CPCSS path exists and create it.
if ( ! $this->filesystem->is_dir( $critical_css_path ) ) {
rocket_mkdir_p( $critical_css_path );
}
$version = 'default';
if (
isset( $value['do_caching_mobile_files'], $value['async_css_mobile'] )
&&
(
1 === (int) $value['do_caching_mobile_files']
&&
1 === (int) $value['async_css_mobile']
)
) {
$version = 'all';
}
// Generate the CPCSS files.
$this->critical_css->process_handler( $version );
}
/**
* Maybe generate the CPCSS for Mobile.
*
* @since 3.6
*
* @param array $old_value Array of original values.
* @param array $value Array of new values.
*/
public function maybe_generate_cpcss_mobile( $old_value, $value ) {
if (
! isset( $value['async_css_mobile'] )
||
1 !== (int) $value['async_css_mobile']
) {
return;
}
if (
! isset( $value['do_caching_mobile_files'] )
||
1 !== (int) $value['do_caching_mobile_files']
) {
return;
}
if (
! isset( $old_value['async_css'], $value['async_css'] )
||
( ( $old_value['async_css'] !== $value['async_css'] ) && 1 === (int) $value['async_css'] )
||
1 !== (int) $value['async_css']
) {
return;
}
$this->critical_css->process_handler( 'mobile' );
}
/**
* Stops the critical CSS generation when deactivating the async CSS option and remove the notices.
*
* @since 2.11
*
* @param array $old_value Previous values for WP Rocket settings.
* @param array $value New values for WP Rocket settings.
*/
public function stop_process_on_deactivation( $old_value, $value ) {
if (
! empty( $_POST[ WP_ROCKET_SLUG ] ) // phpcs:ignore WordPress.Security.NonceVerification.Missing
&&
isset( $old_value['async_css'], $value['async_css'] )
&&
( $old_value['async_css'] !== $value['async_css'] )
&&
0 === (int) $value['async_css']
) {
$this->critical_css->stop_generation();
delete_transient( 'rocket_critical_css_generation_process_running' );
delete_transient( 'rocket_critical_css_generation_process_complete' );
}
}
/**
* This notice is displayed when the critical CSS generation is running.
*
* @since 2.11
*/
public function critical_css_generation_running_notice() {
if ( ! current_user_can( 'rocket_regenerate_critical_css' ) ) {
return;
}
$screen = get_current_screen();
if ( 'settings_page_wprocket' !== $screen->id ) {
return;
}
$transient = get_transient( 'rocket_critical_css_generation_process_running' );
if ( ! $transient ) {
return;
}
$success_counter = 0;
$items_message = '';
if ( ! empty( $transient['items'] ) ) {
$items_message .= '<ul>';
foreach ( $transient['items'] as $item ) {
$status_nonmobile = isset( $item['status']['nonmobile'] );
$status_mobile = $this->is_mobile_cpcss_active() ? isset( $item['status']['mobile'] ) : true;
if ( $status_nonmobile && $status_mobile ) {
$items_message .= '<li>' . $item['status']['nonmobile']['message'] . '</li>';
if ( $item['status']['nonmobile']['success'] ) {
$success_counter ++;
}
}
}
$items_message .= '</ul>';
}
if ( ! isset( $transient['total'] ) ) {
return;
}
if (
0 === $success_counter
&&
0 === $transient['total']
) {
return;
}
$message = '<p>' . sprintf(
// Translators: %1$d = number of critical CSS generated, %2$d = total number of critical CSS to generate.
__( 'Critical CSS generation is currently running: %1$d of %2$d page types completed. (Refresh this page to view progress)', 'rocket' ),
$success_counter,
$transient['total']
) . '</p>' . $items_message;
rocket_notice_html(
[
'status' => 'info',
'message' => $message,
]
);
}
/**
* This notice is displayed when the critical CSS generation is complete.
*
* @since 2.11
*/
public function critical_css_generation_complete_notice() {
if ( ! current_user_can( 'rocket_regenerate_critical_css' ) ) {
return;
}
$screen = get_current_screen();
if ( 'settings_page_wprocket' !== $screen->id ) {
return;
}
$transient = get_transient( 'rocket_critical_css_generation_process_complete' );
if ( ! $transient ) {
return;
}
$status = 'success';
$success_counter = 0;
$items_message = '';
$desktop = false;
if ( ! empty( $transient['items'] ) ) {
$items_message .= '<ul>';
foreach ( $transient['items'] as $item ) {
$status_nonmobile = isset( $item['status']['nonmobile'] );
$status_mobile = $this->is_mobile_cpcss_active() ? isset( $item['status']['mobile'] ) : true;
if ( ! $status_nonmobile || ! $status_mobile ) {
continue;
}
if ( isset( $item['status']['nonmobile']['message'] ) ) {
$desktop = true;
}
$items_message .= '<li>' . $item['status']['nonmobile']['message'] . '</li>';
if ( $item['status']['nonmobile']['success'] ) {
$success_counter ++;
}
}
$items_message .= '</ul>';
}
if ( ! $desktop || ( 0 === $success_counter && 0 === $transient['total'] ) ) {
return;
}
if ( 0 === $success_counter ) {
$status = 'error';
} elseif ( $success_counter < $transient['total'] ) {
$status = 'warning';
}
$message = '<p>' . sprintf(
// Translators: %1$d = number of critical CSS generated, %2$d = total number of critical CSS to generate.
__( 'Critical CSS generation finished for %1$d of %2$d page types.', 'rocket' ),
$success_counter,
$transient['total']
);
$message .= ' <em> (' . date_i18n( get_option( 'date_format' ) ) . ' @ ' . date_i18n( get_option( 'time_format' ) ) . ') </em></p>' . $items_message;
if ( 'error' === $status || 'warning' === $status ) {
$message .= '<p>' . __( 'Critical CSS generation encountered one or more errors.', 'rocket' ) . ' <a href="https://docs.wp-rocket.me/article/1267-troubleshooting-critical-css-generation-issues" data-beacon-article="5d5214d10428631e94f94ae6" target="_blank" rel="noreferer noopener">' . __( 'Learn more.', 'rocket' ) . '</a>';
}
rocket_notice_html(
[
'status' => $status,
'message' => $message,
]
);
delete_transient( 'rocket_critical_css_generation_process_complete' );
}
/**
* This warning is displayed when the critical CSS dir isn't writeable.
*
* @since 2.11
*/
public function warning_critical_css_dir_permissions() {
if (
current_user_can( 'rocket_manage_options' )
&&
( ! $this->filesystem->is_writable( WP_ROCKET_CRITICAL_CSS_PATH ) )
&&
( $this->options->get( 'async_css', false ) )
&&
rocket_valid_key()
) {
$boxes = get_user_meta( get_current_user_id(), 'rocket_boxes', true );
if ( in_array( __FUNCTION__, (array) $boxes, true ) ) {
return;
}
$message = rocket_notice_writing_permissions(
trim( str_replace( ABSPATH, '', WP_ROCKET_CRITICAL_CSS_PATH ), '/' )
);
rocket_notice_html(
[
'status' => 'error',
'dismissible' => '',
'message' => $message,
]
);
}
}
/**
* Insert loadCSS script in <head>.
*
* @since 2.11.2 Updated loadCSS rel=preload polyfill to version 2.0.1
* @since 2.10
*/
public function insert_load_css() {
if ( ! $this->should_async_css() ) {
return;
}
// This filter is documented in inc/classes/Buffer/class-tests.php.
$rocket_cache_search = apply_filters( 'rocket_cache_search', false );
// Don't apply on search page.
if ( is_search() && ! $rocket_cache_search ) {
return;
}
// Don't apply on 404 page.
if ( is_404() ) {
return;
}
if (
empty( $this->critical_css->get_current_page_critical_css() )
&&
empty( $this->options->get( 'critical_css', '' ) )
) {
return;
}
echo /* phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. */ <<<JS
<script>
/*! loadCSS rel=preload polyfill. [c]2017 Filament Group, Inc. MIT License */
(function(w){"use strict";if(!w.loadCSS){w.loadCSS=function(){}}
var rp=loadCSS.relpreload={};rp.support=(function(){var ret;try{ret=w.document.createElement("link").relList.supports("preload")}catch(e){ret=!1}
return function(){return ret}})();rp.bindMediaToggle=function(link){var finalMedia=link.media||"all";function enableStylesheet(){link.media=finalMedia}
if(link.addEventListener){link.addEventListener("load",enableStylesheet)}else if(link.attachEvent){link.attachEvent("onload",enableStylesheet)}
setTimeout(function(){link.rel="stylesheet";link.media="only x"});setTimeout(enableStylesheet,3000)};rp.poly=function(){if(rp.support()){return}
var links=w.document.getElementsByTagName("link");for(var i=0;i<links.length;i++){var link=links[i];if(link.rel==="preload"&&link.getAttribute("as")==="style"&&!link.getAttribute("data-loadcss")){link.setAttribute("data-loadcss",!0);rp.bindMediaToggle(link)}}};if(!rp.support()){rp.poly();var run=w.setInterval(rp.poly,500);if(w.addEventListener){w.addEventListener("load",function(){rp.poly();w.clearInterval(run)})}else if(w.attachEvent){w.attachEvent("onload",function(){rp.poly();w.clearInterval(run)})}}
if(typeof exports!=="undefined"){exports.loadCSS=loadCSS}
else{w.loadCSS=loadCSS}}(typeof global!=="undefined"?global:this))
</script>
JS;
}
/**
* Insert critical CSS before combined CSS when option is active.
*
* @since 2.11.5
*
* @param string $buffer HTML output of the page.
*
* @return string Updated HTML output
*/
public function insert_critical_css_buffer( $buffer ) {
if ( ! $this->should_async_css() ) {
return $buffer;
}
$critical_css_content = $this->critical_css->get_critical_css_content();
if ( empty( $critical_css_content ) ) {
return $buffer;
}
$critical_css_content = str_replace( '\\', '\\\\', $critical_css_content );
$buffer = preg_replace(
'#</title>#iU',
'</title><style id="rocket-critical-css">' . wp_strip_all_tags( $critical_css_content ) . '</style>',
$buffer,
1
);
return preg_replace( '#</body>#iU', $this->return_remove_cpcss_script() . '</body>', $buffer, 1 );
}
/**
* Returns JS script to remove the critical css style from frontend.
*
* @since 3.6
*
* @return string
*/
protected function return_remove_cpcss_script() {
$filename = rocket_get_constant( 'SCRIPT_DEBUG' ) ? 'cpcss-removal.js' : 'cpcss-removal.min.js';
$script = rocket_get_constant( 'WP_ROCKET_PATH' ) . "assets/js/{$filename}";
if ( ! is_readable( $script ) ) {
return '';
}
return sprintf(
'<script>%s</script>',
$this->filesystem->get_contents( $script )
);
}
/**
* Adds wprRemoveCPCSS to excluded inline JS array.
*
* @since 3.6
*
* @param array $excluded_inline Array of inline JS excluded from being combined.
*
* @return array
*/
public function exclude_inline_js( array $excluded_inline ) {
$excluded_inline[] = 'wprRemoveCPCSS';
return $excluded_inline;
}
/**
* Defer loading of CSS files.
*
* @since 2.10
*
* @param string $buffer HTML code.
*
* @return string Updated HTML code
*/
public function async_css( $buffer ) {
if ( ! $this->should_async_css() ) {
return $buffer;
}
if (
empty( $this->critical_css->get_current_page_critical_css() )
&&
empty( $this->options->get( 'critical_css', '' ) )
) {
return $buffer;
}
$excluded_css = array_flip( $this->critical_css->get_exclude_async_css() );
/**
* Filters the pattern used to get all stylesheets in the HTML.
*
* @since 2.10
*
* @param string $css_pattern Regex pattern to get all stylesheets in the HTML.
*/
$css_pattern = apply_filters(
'rocket_async_css_regex_pattern',
'/(?=<link[^>]*\s(rel\s*=\s*[\'"]stylesheet["\']))<link[^>]*\shref\s*=\s*[\'"]([^\'"]+)[\'"](.*)>/iU'
);
// Get all css files with this regex.
preg_match_all( $css_pattern, $buffer, $tags_match );
if ( ! isset( $tags_match[0] ) ) {
return $buffer;
}
$noscripts = '<noscript>';
foreach ( $tags_match[0] as $i => $tag ) {
// Strip query args.
$path = wp_parse_url( $tags_match[2][ $i ], PHP_URL_PATH );
// Check if this file should be deferred.
if ( isset( $excluded_css[ $path ] ) ) {
continue;
}
$preload = str_replace( 'stylesheet', 'preload', $tags_match[1][ $i ] );
$onload = preg_replace( '~' . preg_quote( $tags_match[3][ $i ], '~' ) . '~iU', ' data-rocket-async="style" as="style" onload=""' . $tags_match[3][ $i ] . '>', $tags_match[3][ $i ] );
$tag = str_replace( $tags_match[3][ $i ] . '>', $onload, $tag );
$tag = str_replace( $tags_match[1][ $i ], $preload, $tag );
$tag = str_replace( 'onload=""', 'onload="this.onload=null;this.rel=\'stylesheet\'"', $tag );
$tag = preg_replace( '/(id\s*=\s*[\"\'](?:[^\"\']*)*[\"\'])/i', '', $tag );
$buffer = str_replace( $tags_match[0][ $i ], $tag, $buffer );
$noscripts .= $tags_match[0][ $i ];
}
$noscripts .= '</noscript>';
return str_replace( '</body>', $noscripts . '</body>', $buffer );
}
/**
* Regenerates the CPCSS when switching theme if the option is active.
*
* @since 3.3
*/
public function maybe_regenerate_cpcss() {
if ( ! $this->options->get( 'async_css' ) ) {
return;
}
$this->critical_css->process_handler();
}
/**
* Checks if mobile CPCSS is active.
*
* @since 3.6
*
* @return boolean CPCSS active or not.
*/
private function is_mobile_cpcss_active() {
return (
$this->options->get( 'async_css', 0 )
&&
$this->options->get( 'cache_mobile', 0 )
&&
$this->options->get( 'do_caching_mobile_files', 0 )
)
&&
$this->options->get( 'async_css_mobile', 0 );
}
/**
* Checks if we should async CSS
*
* @since 3.6.2.1
*
* @return boolean
*/
private function should_async_css() {
if ( rocket_get_constant( 'DONOTROCKETOPTIMIZE' ) ) {
return false;
}
if ( ! $this->options->get( 'async_css', 0 ) ) {
return false;
}
return ! is_rocket_post_excluded_option( 'async_css' );
}
}
| {
"pile_set_name": "Github"
} |
package railo.runtime.interpreter.ref.cast;
import railo.runtime.PageContext;
import railo.runtime.exp.PageException;
import railo.runtime.interpreter.ref.Ref;
import railo.runtime.interpreter.ref.RefSupport;
import railo.runtime.interpreter.ref.var.Variable;
import railo.runtime.op.Caster;
/**
* cast
*/
public final class Casting extends RefSupport implements Ref {
private final short type;
private final String strType;
private Ref ref;
private Object val;
/**
* constructor of the class
* @param pc
* @param strType
* @param type
* @param ref
*/
public Casting(String strType,short type, Ref ref) {
this.type=type;
this.strType=strType;
this.ref=ref;
}
public Casting(String strType,short type, Object val) {
this.type=type;
this.strType=strType;
this.val=val;
}
@Override
public Object getValue(PageContext pc) throws PageException {
// if ref == null, it is val based Casting
if(ref==null) return Caster.castTo(pc,type,strType,val);
if(ref instanceof Variable && "queryColumn".equalsIgnoreCase(strType)) {
Variable var=(Variable) ref;
return Caster.castTo(pc,type,strType,var.getCollection(pc));
}
return Caster.castTo(pc,type,strType,ref.getValue(pc));
}
public Ref getRef() {
return ref;
}
public String getStringType() {
return strType;
}
public short getType() {
return type;
}
public String getTypeName() {
return "operation";
}
}
| {
"pile_set_name": "Github"
} |
# Lines starting with '#' and sections without content
# are not displayed by a call to 'details'
#
[Website]
http://www.amic.ru/news/187794/
[filters]
http://www.amic.ru/design/line_advertising.gif
[other]
# Any other details
[comments]
fanboy | {
"pile_set_name": "Github"
} |
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/core/kernels/string_to_hash_bucket_op.h"
#include "tensorflow/core/lib/hash/hash.h"
#include "tensorflow/core/platform/fingerprint.h"
#include "tensorflow/core/platform/strong_hash.h"
namespace tensorflow {
// Deprecated class. It also uses `string_tensor` as Op argument instead of
// `input`.
class LegacyStringToHashBucketOp : public OpKernel {
public:
explicit LegacyStringToHashBucketOp(OpKernelConstruction* ctx)
: OpKernel(ctx) {
OP_REQUIRES_OK(ctx, ctx->GetAttr("num_buckets", &num_buckets_));
}
void Compute(OpKernelContext* context) override {
const Tensor* input_tensor;
OP_REQUIRES_OK(context, context->input("string_tensor", &input_tensor));
const auto& input_flat = input_tensor->flat<string>();
Tensor* output_tensor = nullptr;
OP_REQUIRES_OK(context,
context->allocate_output("output", input_tensor->shape(),
&output_tensor));
auto output_flat = output_tensor->flat<int64>();
typedef decltype(input_flat.size()) Index;
for (Index i = 0; i < input_flat.size(); ++i) {
const uint64 input_hash = Hash64(input_flat(i));
const uint64 bucket_id = input_hash % num_buckets_;
// The number of buckets is always in the positive range of int64 so is
// the resulting bucket_id. Casting the bucket_id from uint64 to int64 is
// safe.
output_flat(i) = static_cast<int64>(bucket_id);
}
}
private:
int64 num_buckets_;
TF_DISALLOW_COPY_AND_ASSIGN(LegacyStringToHashBucketOp);
};
// StringToHashBucket is deprecated in favor of StringToHashBucketFast/Strong.
REGISTER_KERNEL_BUILDER(Name("StringToHashBucket").Device(DEVICE_CPU),
LegacyStringToHashBucketOp);
REGISTER_KERNEL_BUILDER(Name("StringToHashBucketFast").Device(DEVICE_CPU),
StringToHashBucketOp<Fingerprint64>);
REGISTER_KERNEL_BUILDER(Name("StringToHashBucketStrong").Device(DEVICE_CPU),
StringToKeyedHashBucketOp<StrongKeyedHash>);
} // namespace tensorflow
| {
"pile_set_name": "Github"
} |
/**
* @jsx React.DOM
*/
'use strict';
jest.dontMock('../../dist/react-simpletabs.js');
/**
* Verifies if a given rendered component
* actually contains all of the props exposed on
* PropTypes, which seems to be a best pratice.
* @param {ReactComponent} renderedComponent
* @return {bool}
*/
function usedPropsAreInPropTypes (renderedComponent) {
var propTypes = Object.keys(renderedComponent.constructor.propTypes);
return !Object.keys(renderedComponent.props).filter(function (elem) {
return !~propTypes.indexOf(elem);
}).length;
};
describe('Tabs', function() {
var React = require('react/addons');
var TU = React.addons.TestUtils;
var Tabs = require('../../dist/react-simpletabs.js');
it('should be sane', function() {
expect(Tabs).toBeDefined();
});
it('should throw if no children panels passed to Tabs', function() {
expect(function () {
TU.renderIntoDocument(<Tabs></Tabs>);
}).throws;
});
it('be renderable if panels passed to tabs', function() {
var instance = TU.renderIntoDocument(
<Tabs><Tabs.Panel></Tabs.Panel></Tabs>
);
expect(TU.isCompositeComponent(instance)).toBe(true);
});
it('should instantiate propTypes correctly', function() {
var instance = TU.renderIntoDocument(
<Tabs><Tabs.Panel></Tabs.Panel></Tabs>
);
expect(!!usedPropsAreInPropTypes(instance)).toBe(true);
});
describe('when passed className as props', function () {
it('should render extra className correctly', function() {
var instance = TU.renderIntoDocument(
<Tabs className="extra-class"><Tabs.Panel></Tabs.Panel></Tabs>
);
expect(function () {
TU.findRenderedDOMComponentWithClass(instance, 'tabs extra-class');
}).not.toThrow();
});
it('should render className as object correctly', function() {
var instance = TU.renderIntoDocument(
<Tabs className={{ tabs2: true }}><Tabs.Panel></Tabs.Panel></Tabs>
);
expect(function () {
TU.findRenderedDOMComponentWithClass(instance, 'tabs3');
}).toThrow();
expect(function () {
TU.findRenderedDOMComponentWithClass(instance, 'tabs tabs2');
}).not.toThrow();
});
it('should render className as array correctly', function() {
var instance = TU.renderIntoDocument(
<Tabs className={['extra-class']}><Tabs.Panel></Tabs.Panel></Tabs>
);
expect(function () {
TU.findRenderedDOMComponentWithClass(instance, 'tabs extra-class');
}).not.toThrow();
});
});
describe('regarding its functionality,', function() {
it('show only one panel at a time, multiple tabs', function() {
var instance = TU.renderIntoDocument(
<Tabs>
<Tabs.Panel><h1>1</h1></Tabs.Panel>
<Tabs.Panel><h1>2</h1></Tabs.Panel>
</Tabs>
);
expect(TU.scryRenderedDOMComponentsWithTag(instance, 'li').length).toEqual(2);
expect(function () {
TU.findRenderedDOMComponentWithClass(instance, 'is-active');
}).not.toThrow();
});
it('show the first panel if no active passed', function() {
var instance = TU.renderIntoDocument(
<Tabs>
<Tabs.Panel title='item1'>content1</Tabs.Panel>
<Tabs.Panel title='item2'>content2</Tabs.Panel>
</Tabs>
);
var menuItem = TU.findRenderedDOMComponentWithClass(instance, 'tabs-menu-item is-active');
var panel = TU.findRenderedDOMComponentWithClass(instance, 'tab-panel');
expect(panel.getDOMNode().children[0].innerHTML).toEqual('content1');
expect(menuItem.getDOMNode().children[0].innerHTML).toEqual('item1');
});
it('show the second panel if tabActive == 2', function() {
var instance = TU.renderIntoDocument(
<Tabs tabActive={2}>
<Tabs.Panel title='item1'>content1</Tabs.Panel>
<Tabs.Panel title='item2'>content2</Tabs.Panel>
</Tabs>
);
var menuItem = TU.findRenderedDOMComponentWithClass(instance, 'tabs-menu-item is-active');
var panel = TU.findRenderedDOMComponentWithClass(instance, 'tab-panel');
expect(panel.getDOMNode().children[0].innerHTML).toEqual('content2');
expect(menuItem.getDOMNode().children[0].innerHTML).toEqual('item2');
});
it('changes the tabActive if it receives new props', function(){
var find = TU.findRenderedDOMComponentWithClass;
var instance = React.render(
<Tabs tabActive={2}>
<Tabs.Panel title='item1'>content1</Tabs.Panel>
<Tabs.Panel title='item2'>content2</Tabs.Panel>
</Tabs>, document.body
);
var menuItem = find(instance, 'tabs-menu-item is-active');
var panel = find(instance, 'tab-panel');
expect(panel.getDOMNode().children[0].innerHTML).toEqual('content2');
expect(menuItem.getDOMNode().children[0].innerHTML).toEqual('item2');
instance = React.render(
<Tabs tabActive={1}>
<Tabs.Panel title='item1'>content1</Tabs.Panel>
<Tabs.Panel title='item2'>content2</Tabs.Panel>
</Tabs>, document.body
);
menuItem = find(instance, 'tabs-menu-item is-active');
panel = find(instance, 'tab-panel');
expect(panel.getDOMNode().children[0].innerHTML).toEqual('content1');
expect(menuItem.getDOMNode().children[0].innerHTML).toEqual('item1');
});
});
describe('onBeforeChange', function(){
var sim = TU.Simulate;
var scryClass = TU.scryRenderedDOMComponentsWithClass;
var currentPanelText = function(comp){
return scryClass(comp, 'tab-panel')[0].getDOMNode().textContent;
};
it('calls the function and then changes the tab', function(){
var indexes = [];
var spy = function(i){ indexes.push(i) };
var c = TU.renderIntoDocument(
<Tabs onBeforeChange={spy}>
<Tabs.Panel title='item1'>content1</Tabs.Panel>
<Tabs.Panel title='item2'>content2</Tabs.Panel>
</Tabs>
);
var tabsClickable = scryClass(c, 'tabs-menu-item').map(function(li){
return li.getDOMNode().firstChild; //anchor with the click handler
});
sim.click(tabsClickable[1]);
expect(currentPanelText(c)).toEqual('content2');
sim.click(tabsClickable[1]);
expect(currentPanelText(c)).toEqual('content2');
sim.click(tabsClickable[0]);
expect(currentPanelText(c)).toEqual('content1');
expect(indexes).toEqual([2,2,1]);
});
it('cancels the click by returning false', function(){
var cancel = function(){return false};
var c = TU.renderIntoDocument(
<Tabs tabActive={2} onBeforeChange={cancel}>
<Tabs.Panel title='item1'>content1</Tabs.Panel>
<Tabs.Panel title='item2'>content2</Tabs.Panel>
</Tabs>
);
var tabsClickable = scryClass(c, 'tabs-menu-item').map(function(li){
return li.getDOMNode().firstChild; //anchor with the click handler
});
expect(currentPanelText(c)).toEqual('content2');
sim.click(tabsClickable[0]);
expect(currentPanelText(c)).toEqual('content2');
});
});
});
| {
"pile_set_name": "Github"
} |
`response` object additional properties in **Express**
`body-parser` in **Express**
`cookie-session` in **Express**
Log with `morgan` in **Express**
Session handling in **Express** | {
"pile_set_name": "Github"
} |
__ARCH_BITS__ := 32
# define macros
NARROWPHASEDIR=./SpuNarrowPhaseCollisionTask
SPU_TASKFILE=$(NARROWPHASEDIR)/SpuGatheringCollisionTask
IBM_CELLSDK_VERSION := $(shell if [ -d /opt/cell ]; then echo "3.0"; fi)
ifeq ("$(IBM_CELLSDK_VERSION)","3.0")
CELL_TOP ?= /opt/cell/sdk
CELL_SYSROOT := /opt/cell/sysroot
else
CELL_TOP ?= /opt/ibm/cell-sdk/prototype
CELL_SYSROOT := $(CELL_TOP)/sysroot
endif
USE_CCACHE=ccache
RM=rm -f
OUTDIR=./out
DEBUGFLAG=-DNDEBUG
LIBOUTDIR=../../lib/ibmsdk
COLLISIONDIR=../../src/BulletCollision
MATHDIR=../../src/LinearMath
ARCHITECTUREFLAG=-m$(__ARCH_BITS__)
ifeq "$(__ARCH_BITS__)" "64"
SPU_DEFFLAGS= -DUSE_LIBSPE2 -D__SPU__ -DUSE_ADDR64
else
SPU_DEFFLAGS= -DUSE_LIBSPE2 -D__SPU__
endif
SPU_DEFFLAGS+=-DUSE_PE_BOX_BOX
SPU_GCC=$(USE_CCACHE) /usr/bin/spu-gcc
SPU_INCLUDEDIR= -Ivectormath/scalar/cpp -I. -I$(CELL_SYSROOT)/usr/spu/include -I../../src -I$(NARROWPHASEDIR)
#SPU_CFLAGS= $(DEBUGFLAG) -W -Wall -Winline -Os -c -include spu_intrinsics.h -include stdbool.h
SPU_CFLAGS= $(DEBUGFLAG) -W -Wall -Winline -O3 -mbranch-hints -fomit-frame-pointer -ftree-vectorize -finline-functions -ftree-vect-loop-version -ftree-loop-optimize -ffast-math -fno-rtti -fno-exceptions -c -include spu_intrinsics.h -include stdbool.h
SPU_LFLAGS= -Wl,-N
SPU_LIBRARIES=-lstdc++
SPU_EMBED=/usr/bin/ppu-embedspu
SPU_AR=/usr/bin/ar
SYMBOLNAME=spu_program
ifeq "$(__ARCH_BITS__)" "64"
PPU_DEFFLAGS= -DUSE_LIBSPE2 -DUSE_ADDR64
PPU_GCC=$(USE_CCACHE) /usr/bin/ppu-gcc
else
PPU_DEFFLAGS= -DUSE_LIBSPE2
PPU_GCC=$(USE_CCACHE) /usr/bin/ppu32-gcc
endif
PPU_CFLAGS= $(ARCHITECTUREFLAG) $(DEBUGFLAG) -W -Wall -Winline -O3 -c -mabi=altivec -maltivec -include altivec.h -include stdbool.h
PPU_INCLUDEDIR= -I. -I$(CELL_SYSROOT)/usr/include -I../../src -I$(NARROWPHASEDIR)
PPU_LFLAGS= $(ARCHITECTUREFLAG) -Wl,-m,elf$(__ARCH_BITS__)ppc
PPU_LIBRARIES= -lstdc++ -lsupc++ -lgcc -lgcov -lspe2 -lpthread -L../../lib/ibmsdk -lbulletcollision -lbulletdynamics -lbulletmath -L$(CELL_SYSROOT)/usr/lib$(__ARCH_BITS__) -R$(CELL_SYSROOT)/usr/lib
PPU_AR=/usr/bin/ar
MakeOut :
# rm -f -R $(OUTDIR) ; mkdir $(OUTDIR)
@echo "usage: make spu, make ppu, make all, or make clean"
# SPU
SpuTaskFile : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/SpuTaskFile.o $(SPU_TASKFILE).cpp
boxBoxDistance : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(NARROWPHASEDIR)/[email protected]
SpuFakeDma : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] [email protected]
SpuContactManifoldCollisionAlgorithm_spu : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] SpuContactManifoldCollisionAlgorithm.cpp
SpuCollisionShapes : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(NARROWPHASEDIR)/[email protected]
SpuContactResult : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(NARROWPHASEDIR)/[email protected]
#SpuGatheringCollisionTask : MakeOut
# $(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(NARROWPHASEDIR)/[email protected]
SpuGjkPairDetector: MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(NARROWPHASEDIR)/[email protected]
SpuMinkowskiPenetrationDepthSolver : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(NARROWPHASEDIR)/[email protected]
SpuVoronoiSimplexSolver : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(NARROWPHASEDIR)/[email protected]
#SpuLibspe2Support_spu : MakeOut
# $(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] SpuLibspe2Support.cpp
## SPU-Bullet
btPersistentManifold : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(COLLISIONDIR)/NarrowPhaseCollision/[email protected]
btOptimizedBvh : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(COLLISIONDIR)/CollisionShapes/[email protected]
btCollisionObject : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(COLLISIONDIR)/CollisionDispatch/[email protected]
btTriangleCallback : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(COLLISIONDIR)/CollisionShapes/[email protected]
btTriangleIndexVertexArray : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(COLLISIONDIR)/CollisionShapes/[email protected]
btStridingMeshInterface : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(COLLISIONDIR)/CollisionShapes/[email protected]
btAlignedAllocator : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] $(MATHDIR)/[email protected]
# PPU
SpuGatheringCollisionDispatcher : MakeOut
$(PPU_GCC) $(PPU_DEFFLAGS) $(PPU_CFLAGS) $(PPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] [email protected]
SequentialThreadSupport: MakeOut
$(PPU_GCC) $(PPU_DEFFLAGS) $(PPU_CFLAGS) $(PPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] [email protected]
SpuLibspe2Support: MakeOut
$(PPU_GCC) $(PPU_DEFFLAGS) $(PPU_CFLAGS) $(PPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] [email protected]
btThreadSupportInterface: MakeOut
$(PPU_GCC) $(PPU_DEFFLAGS) $(PPU_CFLAGS) $(PPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] [email protected]
SpuCollisionTaskProcess : MakeOut
$(PPU_GCC) $(PPU_DEFFLAGS) $(PPU_CFLAGS) $(PPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] [email protected]
SpuContactManifoldCollisionAlgorithm : MakeOut
$(PPU_GCC) $(PPU_DEFFLAGS) $(PPU_CFLAGS) $(PPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] [email protected]
SpuSampleTaskProcess : MakeOut
$(PPU_GCC) $(PPU_DEFFLAGS) $(PPU_CFLAGS) $(PPU_INCLUDEDIR) -o $(OUTDIR)/[email protected] [email protected]
spu : boxBoxDistance SpuFakeDma SpuContactManifoldCollisionAlgorithm_spu SpuContactResult SpuTaskFile \
SpuGjkPairDetector SpuMinkowskiPenetrationDepthSolver SpuVoronoiSimplexSolver SpuCollisionShapes \
btPersistentManifold btOptimizedBvh btCollisionObject btTriangleCallback btTriangleIndexVertexArray \
btStridingMeshInterface btAlignedAllocator
$(SPU_GCC) -o $(OUTDIR)/spuCollision.elf \
$(OUTDIR)/SpuTaskFile.o \
$(OUTDIR)/SpuFakeDma.o \
$(OUTDIR)/boxBoxDistance.o \
$(OUTDIR)/SpuContactManifoldCollisionAlgorithm_spu.o \
$(OUTDIR)/SpuContactResult.o \
$(OUTDIR)/SpuCollisionShapes.o \
$(OUTDIR)/SpuGjkPairDetector.o \
$(OUTDIR)/SpuMinkowskiPenetrationDepthSolver.o \
$(OUTDIR)/SpuVoronoiSimplexSolver.o \
$(OUTDIR)/btPersistentManifold.o \
$(OUTDIR)/btTriangleCallback.o \
$(OUTDIR)/btTriangleIndexVertexArray.o \
$(OUTDIR)/btStridingMeshInterface.o \
$(OUTDIR)/btAlignedAllocator.o \
$(SPU_LFLAGS) $(SPU_LIBRARIES)
spu-embed : spu
$(SPU_EMBED) $(ARCHITECTUREFLAG) $(SYMBOLNAME) $(OUTDIR)/spuCollision.elf $(OUTDIR)/[email protected]
$(SPU_AR) -qcs $(LIBOUTDIR)/libspu.a $(OUTDIR)/[email protected]
ppu : SpuGatheringCollisionDispatcher SpuCollisionTaskProcess btThreadSupportInterface \
SpuLibspe2Support SpuContactManifoldCollisionAlgorithm SpuSampleTaskProcess
$(PPU_AR) -qcs $(LIBOUTDIR)/bulletmultithreaded.a \
$(OUTDIR)/SpuCollisionTaskProcess.o \
$(OUTDIR)/SpuSampleTaskProcess.o \
$(OUTDIR)/SpuGatheringCollisionDispatcher.o \
$(OUTDIR)/SpuLibspe2Support.o \
$(OUTDIR)/btThreadSupportInterface.o \
$(OUTDIR)/SpuContactManifoldCollisionAlgorithm.o
all : spu-embed ppu
clean:
$(RM) $(OUTDIR)/* ; $(RM) $(LIBOUTDIR)/libspu.a ; $(RM) $(LIBOUTDIR)/bulletmultithreaded.a
| {
"pile_set_name": "Github"
} |
@noanno
class Bug1155_B() {
// Used for anonymous functions and method arguments
shared void f(Anything(Nothing) fn) {}
shared void binaryStar(String s, String* seq) {
}
shared void unaryPlus(String+ seq) {
}
shared void binaryOptStar(String s="", String* seq) {
}
shared void mva_callsite() {
Anything(String, String*) binaryStarRef = binaryStar;
f(void(String s, String* seq) {});
Anything(String+) unaryPlusRef = unaryPlus;
Anything(String=, String*) binaryOptStarRef = binaryOptStar;
// Illegal: Anything(String+) x = binaryStar;
// Legal: Anything(String, String*) y = unaryPlus;
}
} | {
"pile_set_name": "Github"
} |
from __future__ import absolute_import
import autograd.numpy as np
import matplotlib.pyplot as plt
from autograd import grad
# We could use np.tanh, but let's write our own as an example.
def tanh(x):
return (1.0 - np.exp(-x)) / (1.0 + np.exp(-x))
x = np.linspace(-7, 7, 200)
plt.plot(x, tanh(x),
x, grad(tanh)(x), # first derivative
x, grad(grad(tanh))(x), # second derivative
x, grad(grad(grad(tanh)))(x), # third derivative
x, grad(grad(grad(grad(tanh))))(x), # fourth derivative
x, grad(grad(grad(grad(grad(tanh)))))(x), # fifth derivative
x, grad(grad(grad(grad(grad(grad(tanh))))))(x)) # sixth derivative
plt.axis('off')
plt.savefig("tanh.png")
plt.show()
| {
"pile_set_name": "Github"
} |
// Copyright 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 COMPONENTS_SYNC_PREFERENCES_PREF_SERVICE_SYNCABLE_OBSERVER_H_
#define COMPONENTS_SYNC_PREFERENCES_PREF_SERVICE_SYNCABLE_OBSERVER_H_
namespace sync_preferences {
class PrefServiceSyncableObserver {
public:
// Invoked when PrefService::IsSyncing() changes.
virtual void OnIsSyncingChanged() = 0;
protected:
virtual ~PrefServiceSyncableObserver() {}
};
} // namespace sync_preferences
#endif // COMPONENTS_SYNC_PREFERENCES_PREF_SERVICE_SYNCABLE_OBSERVER_H_
| {
"pile_set_name": "Github"
} |
index_title=GRUB Boot Loader
index_add=Yeni bir önyükleme seçeneği ekleyin.
index_global=Genel Seçenekleri Düzenle
index_globalmsg=Tüm önyükleme menüsü seçeneklerine uygulanan genel önyükleme seçeneklerini düzenleyin ve GRUB'un yüklü olduğu aygıtı seçin.
index_install=GRUB'u yükle
index_installmsg=Yukarıdaki seçenekleri açılış sırasında görüntülemek için GRUB önyükleme yükleyicisini $1 üzerine kurun. Bu, LILO gibi mevcut önyükleme yükleyicilerini geçersiz kılar ve sisteminizi önyüklenemez hale getirebilir!
index_none=Hiçbir önyükleme seçeneği tanımlanmadı. Grub'u kurmadan önce en az bir tane eklediğinizden emin olun.
index_efile=$1 GRUB menü dosyası sisteminizde bulunamadı. Belki GRUB yüklü değil veya <a href='$2'>modül yapılandırması</a> yanlış.
index_epath=GRUB yürütülebilir $1 sisteminizde bulunamadı. Belki GRUB yüklü değil veya <a href='$2'>modül yapılandırması</a> yanlış.
index_return=seçenekler listesi
title_add=Önyükleme Seçeneği Ekle
title_edit=Önyükleme Seçeneğini Düzenle
title_header=Önyükleme menüsü seçenek ayrıntıları
title_title=Seçenek başlığı
title_root=Önyükleme görüntüsü bölümü
title_noverify=Bölümü bağlama ve doğrulama
title_other=Diğer cihaz dosyası
title_sel=seçilmiş
title_boot=Önyükleme için işletim sistemi
title_kernel=Çekirdek
title_kfile=Çekirdeğe giden yol
title_args=Çekirdek seçenekleri
title_initrd=İlk ramdisk dosyası
title_modules=Ekstra modüller
title_chain=Diğer İşletim Sistemleri
title_chain_def=Bölümün ilk sektöründen
title_chain_file=Chainloader dosyasından
title_makeactive=Kök bölümü etkin mi yapılıyor?
title_none1=Yok
title_none2=(önyükleme dışı menü girişi)
title_err=Önyükleme seçeneği kaydedilemedi
title_etitle=Seçenek başlığı eksik
title_eroot=Kök bölümü eksik
title_ekernel=Eksik veya geçersiz çekirdek yolu
title_echain=Eksik veya geçersiz zincir yükleyici dosyası
title_edev=Desteklenmeyen kök bölümleme aygıtı $1
title_einitrd=İlk ramdisk dosya adı eksik
title_lock=Şifre kilitlendi mi?
global_title=Global Seçenekler
global_header=Global önyükleme menüsü seçenekleri
global_default=Varsayılan önyükleme seçeneği
global_fallback=Yedek önyükleme seçeneği
global_first=Listedeki ilk
global_timeout=Varsayılan yüklemeden önce zaman aşımı
global_forever=Sonsuza kadar bekle
global_secs=saniye
global_install=GRUB'u disk/bölüme yükle
global_sel=seçilmiş
global_other=Diğer
global_password=Önyükleme parolası
global_none=Yok
global_password_file=Şifre girilirse menü dosyasını kullanın:
global_err=Global seçenekler kaydedilemedi
global_etimeout=Eksik veya geçersiz zaman aşımı
global_edev=Desteklenmeyen yükleme diski/bölümü $1
global_eother=Eksik veya geçersiz disk/bölüm
global_epassword=Eksik veya geçersiz önyükleme parolası
global_epasswordfile=Alternatif menü dosya adı eksik
install_title=GRUB'u yükle
install_err=GRUB yüklenemedi
install_efind=Menü dosyası bulunamadı
install_desc=$1 ve $3 komutlarıyla GRUB'u $1 üzerine yükleme.
install_ok=.. yükleme tamamlandı.
install_failed=.. yükleme başarısız!
log_create_title=$1 önyükleme seçeneği oluşturuldu
log_delete_title=$1 silinen önyükleme seçeneği
log_modify_title=Değiştirilmiş önyükleme seçeneği $1
log_up_title=Önyükleme seçeneği $1 taşındı
log_down_title=$1 önyükleme seçeneği taşındı
log_global=Değişen global seçenekler
log_install=Kurulu GRUB
| {
"pile_set_name": "Github"
} |
/*
* (C) Copyright 2001
* Josh Huber <[email protected]>, Mission Critical Linux, Inc.
*
* See file CREDITS for list of people who contributed to this
* 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., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
/*
* board/config.h - configuration options, board specific
*/
#ifndef __CONFIG_H
#define __CONFIG_H
#ifndef __ASSEMBLY__
#include <galileo/core.h>
#endif
#include "../board/evb64260/local.h"
/*
* High Level Configuration Options
* (easy to change)
*/
#define CONFIG_EVB64260 1 /* this is an EVB64260 board */
#define CONFIG_SYS_GT_6426x GT_64260 /* with a 64260 system controller */
#define CONFIG_SYS_TEXT_BASE 0xfff00000
#define CONFIG_SYS_LDSCRIPT "board/evb64260/u-boot.lds"
#define CONFIG_BAUDRATE 38400 /* console baudrate = 38400 */
#undef CONFIG_ECC /* enable ECC support */
/* #define CONFIG_EVB64260_750CX 1 */ /* Support the EVB-64260-750CX Board */
/* which initialization functions to call for this board */
#define CONFIG_MISC_INIT_R 1
#define CONFIG_BOARD_EARLY_INIT_F 1
#ifndef CONFIG_EVB64260_750CX
#define CONFIG_SYS_BOARD_NAME "EVB64260"
#else
#define CONFIG_SYS_BOARD_NAME "EVB64260-750CX"
#endif
#define CONFIG_SYS_HUSH_PARSER
/*
* The following defines let you select what serial you want to use
* for your console driver.
*
* what to do:
* to use the DUART, undef CONFIG_MPSC. If you have hacked a serial
* cable onto the second DUART channel, change the CONFIG_SYS_DUART port from 1
* to 0 below.
*
* to use the MPSC, #define CONFIG_MPSC. If you have wired up another
* mpsc channel, change CONFIG_MPSC_PORT to the desired value.
*/
#define CONFIG_MPSC
#define CONFIG_MPSC_PORT 0
/* define this if you want to enable GT MAC filtering */
#define CONFIG_GT_USE_MAC_HASH_TABLE
#undef CONFIG_ETHER_PORT_MII /* use RMII */
#if 1
#define CONFIG_BOOTDELAY -1 /* autoboot disabled */
#else
#define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */
#endif
#define CONFIG_ZERO_BOOTDELAY_CHECK
#undef CONFIG_BOOTARGS
#define CONFIG_BOOTCOMMAND \
"bootp && " \
"setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath " \
"ip=$ipaddr:$serverip:$gatewayip:" \
"$netmask:$hostname:eth0:none; && " \
"bootm"
#define CONFIG_LOADS_ECHO 0 /* echo off for serial download */
#define CONFIG_SYS_LOADS_BAUD_CHANGE /* allow baudrate changes */
#undef CONFIG_WATCHDOG /* watchdog disabled */
#undef CONFIG_ALTIVEC /* undef to disable */
/*
* BOOTP options
*/
#define CONFIG_BOOTP_SUBNETMASK
#define CONFIG_BOOTP_GATEWAY
#define CONFIG_BOOTP_HOSTNAME
#define CONFIG_BOOTP_BOOTPATH
#define CONFIG_BOOTP_BOOTFILESIZE
/*
* Command line configuration.
*/
#include <config_cmd_default.h>
#define CONFIG_CMD_ASKENV
/*
* Miscellaneous configurable options
*/
#define CONFIG_SYS_LONGHELP /* undef to save memory */
#define CONFIG_SYS_PROMPT "=> " /* Monitor Command Prompt */
#if defined(CONFIG_CMD_KGDB)
#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
#else
#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
#endif
#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */
#define CONFIG_SYS_MAXARGS 16 /* max number of command args */
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
#define CONFIG_SYS_MEMTEST_START 0x00400000 /* memtest works on */
#define CONFIG_SYS_MEMTEST_END 0x00C00000 /* 4 ... 12 MB in DRAM */
#define CONFIG_SYS_LOAD_ADDR 0x00300000 /* default load address */
#define CONFIG_SYS_HZ 1000 /* decr freq: 1ms ticks */
#define CONFIG_SYS_BUS_CLK 100000000 /* 100 MHz */
#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
#ifdef CONFIG_EVB64260_750CX
#define CONFIG_750CX
#define CONFIG_SYS_BROKEN_CL2
#endif
/*
* Low Level Configuration Settings
* (address mappings, register initial values, etc.)
* You should know what you are doing if you make changes here.
*/
/*-----------------------------------------------------------------------
* Definitions for initial stack pointer and data area
*/
#define CONFIG_SYS_INIT_RAM_ADDR 0x40000000
#define CONFIG_SYS_INIT_RAM_SIZE 0x1000
#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
#define CONFIG_SYS_INIT_RAM_LOCK
/*-----------------------------------------------------------------------
* Start addresses for the final memory configuration
* (Set up by the startup code)
* Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0
*/
#define CONFIG_SYS_SDRAM_BASE 0x00000000
#define CONFIG_SYS_FLASH_BASE 0xfff00000
#define CONFIG_SYS_RESET_ADDRESS 0xfff00100
#define CONFIG_SYS_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */
#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE
#define CONFIG_SYS_MALLOC_LEN (256 << 10) /* Reserve 256 kB for malloc */
/* areas to map different things with the GT in physical space */
#define CONFIG_SYS_DRAM_BANKS 4
#define CONFIG_SYS_DFL_GT_REGS 0x14000000 /* boot time GT_REGS */
/* What to put in the bats. */
#define CONFIG_SYS_MISC_REGION_BASE 0xf0000000
/* Peripheral Device section */
#define CONFIG_SYS_GT_REGS 0xf8000000
#define CONFIG_SYS_DEV_BASE 0xfc000000
#define CONFIG_SYS_DEV0_SPACE CONFIG_SYS_DEV_BASE
#define CONFIG_SYS_DEV1_SPACE (CONFIG_SYS_DEV0_SPACE + CONFIG_SYS_DEV0_SIZE)
#define CONFIG_SYS_DEV2_SPACE (CONFIG_SYS_DEV1_SPACE + CONFIG_SYS_DEV1_SIZE)
#define CONFIG_SYS_DEV3_SPACE (CONFIG_SYS_DEV2_SPACE + CONFIG_SYS_DEV2_SIZE)
#define CONFIG_SYS_DEV0_SIZE _8M /* evb64260 sram @ 0xfc00.0000 */
#define CONFIG_SYS_DEV1_SIZE _8M /* evb64260 rtc @ 0xfc80.0000 */
#define CONFIG_SYS_DEV2_SIZE _16M /* evb64260 duart @ 0xfd00.0000 */
#define CONFIG_SYS_DEV3_SIZE _16M /* evb64260 flash @ 0xfe00.0000 */
#define CONFIG_SYS_DEV0_PAR 0x20205093
#define CONFIG_SYS_DEV1_PAR 0xcfcfffff
#define CONFIG_SYS_DEV2_PAR 0xc0059bd4
#define CONFIG_SYS_8BIT_BOOT_PAR 0xc00b5e7c
#define CONFIG_SYS_32BIT_BOOT_PAR 0xc4a8241c
/* c 4 a 8 2 4 1 c */
/* 33 22|2222|22 22|111 1|11 11|1 1 | | */
/* 10 98|7654|32 10|987 6|54 32|1 098|7 654|3 210 */
/* 11|00|0100|10 10|100|0 00|10 0|100 0|001 1|100 */
/* 3| 0|.... ..| 2| 4 | 0 | 4 | 8 | 3 | 4 */
#if 0 /* Wrong?? NTL */
#define CONFIG_SYS_MPP_CONTROL_0 0x53541717 /* InitAct EOT[4] DBurst TCEn[1] */
/* DMAAck[1:0] GNT0[1:0] */
#else
#define CONFIG_SYS_MPP_CONTROL_0 0x53547777 /* InitAct EOT[4] DBurst TCEn[1] */
/* REQ0[1:0] GNT0[1:0] */
#endif
#define CONFIG_SYS_MPP_CONTROL_1 0x44009911 /* TCEn[4] TCTcnt[4] GPP[13:12] */
/* DMAReq[4] DMAAck[4] WDNMI WDE */
#if 0 /* Wrong?? NTL */
#define CONFIG_SYS_MPP_CONTROL_2 0x40091818 /* TCTcnt[0] GPP[22:21] BClkIn */
/* DMAAck[1:0] GNT1[1:0] */
#else
#define CONFIG_SYS_MPP_CONTROL_2 0x40098888 /* TCTcnt[0] */
/* GPP[22] (RS232IntB or PCI1Int) */
/* GPP[21] (RS323IntA) */
/* BClkIn */
/* REQ1[1:0] GNT1[1:0] */
#endif
#if 0 /* Wrong?? NTL */
# define CONFIG_SYS_MPP_CONTROL_3 0x00090066 /* GPP[31:29] BClkOut0 */
/* GPP[27:26] Int[1:0] */
#else
# define CONFIG_SYS_MPP_CONTROL_3 0x22090066 /* MREQ MGNT */
/* GPP[29] (PCI1Int) */
/* BClkOut0 */
/* GPP[27] (PCI0Int) */
/* GPP[26] (RtcInt or PCI1Int) */
/* CPUInt[25:24] */
#endif
# define CONFIG_SYS_SERIAL_PORT_MUX 0x00000102 /* 0=hiZ 1=MPSC0 2=ETH 0 and 2 RMII */
#if 0 /* Wrong?? - NTL */
# define CONFIG_SYS_GPP_LEVEL_CONTROL 0x000002c6
#else
# define CONFIG_SYS_GPP_LEVEL_CONTROL 0x2c600000 /* 0010 1100 0110 0000 */
/* gpp[29] */
/* gpp[27:26] */
/* gpp[22:21] */
# define CONFIG_SYS_SDRAM_CONFIG 0xd8e18200 /* 0x448 */
/* idmas use buffer 1,1
comm use buffer 0
pci use buffer 1,1
cpu use buffer 0
normal load (see also ifdef HVL)
standard SDRAM (see also ifdef REG)
non staggered refresh */
/* 31:26 25 23 20 19 18 16 */
/* 110110 00 111 0 0 00 1 */
/* refresh_count=0x200
phisical interleaving disable
virtual interleaving enable */
/* 15 14 13:0 */
/* 1 0 0x200 */
#endif
#define CONFIG_SYS_DUART_IO CONFIG_SYS_DEV2_SPACE
#define CONFIG_SYS_DUART_CHAN 1 /* channel to use for console */
#define CONFIG_SYS_INIT_CHAN1
#define CONFIG_SYS_INIT_CHAN2
#define SRAM_BASE CONFIG_SYS_DEV0_SPACE
#define SRAM_SIZE 0x00100000 /* 1 MB of sram */
/*-----------------------------------------------------------------------
* PCI stuff
*-----------------------------------------------------------------------
*/
#define PCI_HOST_ADAPTER 0 /* configure ar pci adapter */
#define PCI_HOST_FORCE 1 /* configure as pci host */
#define PCI_HOST_AUTO 2 /* detected via arbiter enable */
#define CONFIG_PCI /* include pci support */
#define CONFIG_PCI_HOST PCI_HOST_FORCE /* select pci host function */
#define CONFIG_PCI_PNP /* do pci plug-and-play */
/* PCI MEMORY MAP section */
#define CONFIG_SYS_PCI0_MEM_BASE 0x80000000
#define CONFIG_SYS_PCI0_MEM_SIZE _128M
#define CONFIG_SYS_PCI1_MEM_BASE 0x88000000
#define CONFIG_SYS_PCI1_MEM_SIZE _128M
#define CONFIG_SYS_PCI0_0_MEM_SPACE (CONFIG_SYS_PCI0_MEM_BASE)
#define CONFIG_SYS_PCI1_0_MEM_SPACE (CONFIG_SYS_PCI1_MEM_BASE)
/* PCI I/O MAP section */
#define CONFIG_SYS_PCI0_IO_BASE 0xfa000000
#define CONFIG_SYS_PCI0_IO_SIZE _16M
#define CONFIG_SYS_PCI1_IO_BASE 0xfb000000
#define CONFIG_SYS_PCI1_IO_SIZE _16M
#define CONFIG_SYS_PCI0_IO_SPACE (CONFIG_SYS_PCI0_IO_BASE)
#define CONFIG_SYS_PCI0_IO_SPACE_PCI 0x00000000
#define CONFIG_SYS_PCI1_IO_SPACE (CONFIG_SYS_PCI1_IO_BASE)
#define CONFIG_SYS_PCI1_IO_SPACE_PCI 0x00000000
/*
* NS16550 Configuration
*/
#define CONFIG_SYS_NS16550
#define CONFIG_SYS_NS16550_REG_SIZE -4
#define CONFIG_SYS_NS16550_CLK 3686400
#define CONFIG_SYS_NS16550_COM1 (CONFIG_SYS_DUART_IO + 0)
#define CONFIG_SYS_NS16550_COM2 (CONFIG_SYS_DUART_IO + 0x20)
/*----------------------------------------------------------------------
* Initial BAT mappings
*/
/* NOTES:
* 1) GUARDED and WRITE_THRU not allowed in IBATS
* 2) CACHEINHIBIT and WRITETHROUGH not allowed together in same BAT
*/
/* SDRAM */
#define CONFIG_SYS_IBAT0L (CONFIG_SYS_SDRAM_BASE | BATL_PP_RW | BATL_CACHEINHIBIT)
#define CONFIG_SYS_IBAT0U (CONFIG_SYS_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT0L (CONFIG_SYS_SDRAM_BASE | BATL_PP_RW | BATL_CACHEINHIBIT | BATL_GUARDEDSTORAGE)
#define CONFIG_SYS_DBAT0U CONFIG_SYS_IBAT0U
/* init ram */
#define CONFIG_SYS_IBAT1L (CONFIG_SYS_INIT_RAM_ADDR | BATL_PP_RW | BATL_MEMCOHERENCE)
#define CONFIG_SYS_IBAT1U (CONFIG_SYS_INIT_RAM_ADDR | BATU_BL_128K | BATU_VS | BATU_VP)
#define CONFIG_SYS_DBAT1L CONFIG_SYS_IBAT1L
#define CONFIG_SYS_DBAT1U CONFIG_SYS_IBAT1U
/* PCI0, PCI1 in one BAT */
#define CONFIG_SYS_IBAT2L BATL_NO_ACCESS
#define CONFIG_SYS_IBAT2U CONFIG_SYS_DBAT2U
#define CONFIG_SYS_DBAT2L (CONFIG_SYS_PCI0_MEM_BASE | BATL_CACHEINHIBIT | BATL_PP_RW | BATL_GUARDEDSTORAGE)
#define CONFIG_SYS_DBAT2U (CONFIG_SYS_PCI0_MEM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
/* GT regs, bootrom, all the devices, PCI I/O */
#define CONFIG_SYS_IBAT3L (CONFIG_SYS_MISC_REGION_BASE | BATL_CACHEINHIBIT | BATL_PP_RW)
#define CONFIG_SYS_IBAT3U (CONFIG_SYS_MISC_REGION_BASE | BATU_VS | BATU_VP | BATU_BL_256M)
#define CONFIG_SYS_DBAT3L (CONFIG_SYS_MISC_REGION_BASE | BATL_CACHEINHIBIT | BATL_PP_RW | BATL_GUARDEDSTORAGE)
#define CONFIG_SYS_DBAT3U CONFIG_SYS_IBAT3U
/* I2C speed and slave address (for compatability) defaults */
#define CONFIG_SYS_I2C_SPEED 400000
#define CONFIG_SYS_I2C_SLAVE 0x7F
/* I2C addresses for the two DIMM SPD chips */
#ifndef CONFIG_EVB64260_750CX
#define DIMM0_I2C_ADDR 0x56
#define DIMM1_I2C_ADDR 0x54
#else /* CONFIG_EVB64260_750CX - only has 1 DIMM */
#define DIMM0_I2C_ADDR 0x54
#define DIMM1_I2C_ADDR 0x54
#endif
/*
* For booting Linux, the board info and command line data
* have to be in the first 8 MB of memory, since this is
* the maximum mapped by the Linux kernel during initialization.
*/
#define CONFIG_SYS_BOOTMAPSZ (8<<20) /* Initial Memory map for Linux */
/*-----------------------------------------------------------------------
* FLASH organization
*/
#define CONFIG_SYS_MAX_FLASH_BANKS 2 /* max number of memory banks */
#define CONFIG_SYS_MAX_FLASH_SECT 67 /* max number of sectors on one chip */
#define CONFIG_SYS_EXTRA_FLASH_DEVICE DEVICE3 /* extra flash at device 3 */
#define CONFIG_SYS_EXTRA_FLASH_WIDTH 4 /* 32 bit */
#define CONFIG_SYS_FLASH_ERASE_TOUT 120000 /* Timeout for Flash Erase (in ms) */
#define CONFIG_SYS_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
#define CONFIG_SYS_FLASH_CFI 1
#define CONFIG_ENV_IS_IN_FLASH 1
#define CONFIG_ENV_SIZE 0x1000 /* Total Size of Environment Sector */
#define CONFIG_ENV_SECT_SIZE 0x10000
#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE+CONFIG_SYS_MONITOR_LEN-CONFIG_ENV_SECT_SIZE)
/*-----------------------------------------------------------------------
* Cache Configuration
*/
#define CONFIG_SYS_CACHELINE_SIZE 32 /* For all MPC74xx CPUs */
#if defined(CONFIG_CMD_KGDB)
#define CONFIG_SYS_CACHELINE_SHIFT 5 /* log base 2 of the above value */
#endif
/*-----------------------------------------------------------------------
* L2CR setup -- make sure this is right for your board!
* look in include/74xx_7xx.h for the defines used here
*/
#define CONFIG_SYS_L2
#ifdef CONFIG_750CX
#define L2_INIT 0
#else
#define L2_INIT (L2CR_L2SIZ_2M | L2CR_L2CLK_3 | L2CR_L2RAM_BURST | \
L2CR_L2OH_5 | L2CR_L2CTL | L2CR_L2WT)
#endif
#define L2_ENABLE (L2_INIT | L2CR_L2E)
#define CONFIG_SYS_BOARD_ASM_INIT 1
#endif /* __CONFIG_H */
| {
"pile_set_name": "Github"
} |
define( function() {
return ( /\?/ );
} );
| {
"pile_set_name": "Github"
} |
`protect begin_protected
`protect version = 1
`protect encrypt_agent = "XILINX"
`protect encrypt_agent_info = "Xilinx Encryption Tool 2014"
`protect key_keyowner = "Cadence Design Systems.", key_keyname= "cds_rsa_key", key_method = "rsa"
`protect encoding = (enctype = "BASE64", line_length = 76, bytes = 64)
`protect key_block
lz3B4KHX5z7HJK6kHiZGMmcEnUqLtTRT/n7HdY7szClNEEBtVq2UQW/wdwwMN27AnOLZPVfuS67c
Y2O4fk1xOw==
`protect key_keyowner = "Mentor Graphics Corporation", key_keyname= "MGC-VERIF-SIM-RSA-1", key_method = "rsa"
`protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128)
`protect key_block
OUoXLY9rVEqAKiJgtR19Q8FIQUm9wPmLFXF2sem6w9gJVRflCYIHWjOAqv6eppRvqeqcjaja3KKN
iRxsDXzkmdVb18CNyYXYPgZU4MySqAPoAE8BZ3alC446EKqG5bo3Faah4iFiaQ2fsSYQDhznQFWV
FIedseAJGSJjdgeT43M=
`protect key_keyowner = "Xilinx", key_keyname= "xilinx_2014_03", key_method = "rsa"
`protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256)
`protect key_block
bHuGx6phwwi065A2gw0E1Tqc2OLDUoohEHY7mOoJcUQwvr9OEJ4yz01Uls3wx2UOc24N+ANXe8aM
YdyfwspjYSBviz8nI/XUT5fPMjNbtL8HFChLorcX+K00Sc+A9m1I9+5W+Wd6GLSKBCVYKnWRn9Os
rc68y/GTowadTW08aEEccqOavDD8XG+R6gQqGpi5C8xq75oqBRmE5yNpxpBXxQRz9mmAsJcZ773H
BpObF8UUngkYlRzDjfxz3vzf6lVAPrLm55l1zEsel1LRtdqlRT8kBTrz1kke43v4c6xNv0u+i1Y0
dvxmNCEmLNrwBuVbcA8l6Jjp0k0WZScEgrEOCA==
`protect key_keyowner = "Synopsys", key_keyname= "SNPS-VCS-RSA-1", key_method = "rsa"
`protect encoding = (enctype = "BASE64", line_length = 76, bytes = 128)
`protect key_block
4sCk5d4E+rPjLUhUiUrzCNkXo2ztvWgfU4Ic3n3YDGHZzWC7cjzTKSJroiCXwtIaQEIL5FpdrGOo
eHf9JlqikZvG/pLSpSZr6BTZioOpsjgI4CJq9n0wGhpyClKm24hGzYEPH8AkBs4wVmgt4sOHvyYc
mYqTUQDFFlehrx6Wh0E=
`protect key_keyowner = "Aldec", key_keyname= "ALDEC08_001", key_method = "rsa"
`protect encoding = (enctype = "BASE64", line_length = 76, bytes = 256)
`protect key_block
cjjanW9F+fseEMt2SDd6R3KYZVrfLHKeq8ULFHbP0E7BiwY4Vkec6zVJkc5FOAAhZdR5Ywc2FOnS
jk9bJ37QuAeSdAcrSzysHiIJYxA3kbMVuIa63kiSn3dKlLmPc1gZ2/UtM3HTBff0RPQzxl944kH8
SUid8bQM/bx+7wxLnTLuo6uTok/+c8ipzvZZ5iJ9DgzZyHiiuOtKu8JWNRVw1P5d1QqQT3EZ7Q8j
fnqcUNAmoR2w1hlmAhXTJgZbpiKUcMF+Y9/twpUzFl3rdEE6PKGzb5YQ/Re4uf+MJU96/KSTzmBR
Xfe8WjI4zLk+NlEm8eNku5cgYGTA1pkwApl+6w==
`protect data_method = "AES128-CBC"
`protect encoding = (enctype = "BASE64", line_length = 76, bytes = 4112)
`protect data_block
PKlpisMKFINH4hoELw81AZ18VK2SvwsFtcxQndvji2Q812Egu8hqrmetq4S243WkBDD9FhRToFg6
onHaxQP5TKyzzRgqIZObMAE4mNLd0EGqTn3aqDGu6+Bsh/RCIfB6TL+BBUz3RFojPS3lN1n3eMrk
a93sVEpS/1D3JftFdyKbdjPhwe46LiLECdthKhiH9ZVNFCw4Ws6ZCd4/aw4VY1Hll/ZsuUnuTN6Z
Buk6q5S+1ihuZnv77eYn29yyd1+zhGh2XJ+HHt1pb/tkuTDIiYYiVeUIEI+Gqw7Xn3KbAne2513a
DuHR4xjZmugYddNEaOdyLeE4MvXdA932ThmdnrzEnPKSPfrMPicMVA8p8OGyKda3NYay7/eN6ULn
I8HkDmpm4uBro5HqFBtKSR51XEjJHFs73T9If36M29apt8KT+ZOJ14V1CMzRdq1JqoOaQIQTbcFX
MuTCFZo+102r5JB6csdLUv/tPgSHSBRizX1LySzTWNBocwi41jc4x5TFUq2NAAQOqQsV+n62GkAW
GkrzDJEuhDpBgSVtrrtq81IWTP1kSu2x5K8rCJhIqbYpXdhllqhNJEJhfQ+ozz876sz0x4OqZYMB
mJDYKLwXjXamz55S254LDxH/IgfuXZg5GfJ3GmjKIJ1JsNJeW4fk+VYbI2huKgkMvqlyORrCkbKT
pjIRMKJ8AMpeOnUzKN1cZOa0vXBve1kR6W1b2anq1FiexGEw92y71xxCUV02k5wHGJDIndnRRbFm
mO/acdyx0xcqDMIv/NQEwOVB5THL/avxp05FgqyiZhzHnp6oOWo9zre+AzPzxNDamPHHrLvWvTtL
MAM9+AhpxQUOUj6b9gaBL730L5WxnnZ5WwRDsCpCVPnUkI5+bNTrXTP+E+ru3ugtJKdFAfWe43Sv
trGWgC0cm9o2WdhvbmGgHPDpQYbLuXktH8Rw7Z78PkfTMwSu2z+bZsbHNYUmQDTKjjfFZ776QLFk
cewnTFRXvUv/3mKOtvRibJgtr+RKDI1QTl58s2vTK71sOHenFcVslJ+yR+iYlnTABhli7v3fEA0o
zrwf3folOg0LOKaAqY1Hxiz0ZY9fIRTAXYGrKK7aGyKEhcPeCPI5VZ7PfqmDoJ6Hull8GBvEsZki
Ry8PtjwTc8/2YT7yBn3l5FQAp+k8JpDiyK9wBxhXBePDUHEhM1GeB6mrld/7HI+G8FTfdxTbBcQ8
/E4qlEuZjZk4lkCIIy99WuYspwq9rgbwFdyU2ZPsvv22KsGkaaRtU2G+hxFlfYPbPq8tAfAOn0mW
8J4BtcdaV8vNGZ4WbZ+/9v3CP9GvU3zTbobTPzNYODvOcfIQ+4B7YR/GrCA0itiwQPCYT9DnIybR
iD6Y2h7LWVMR2s4pn6pIYAQVRbyuH7VAihsBRa8ZSH1FJrzaCM8JR/Lldm7d7LjhPw8gcFu7FSIC
B56OcX8lxZO3UoNx4ED67ACbS0Sme7zmJbAE6FWoIsp1mIKYWL+F0XzV6ssq4IYMmu1svTIObQCG
PBvZ85WhALHB2bGirdmKk7KurH77WvEy3JxIRZI5uOI/dWqNJggl23x61WPlREVJRYgrghybY3GW
7MxOUa/isTmUZJd/1IDDlyyILSldJ+ja7wJC4diAXqzPqNbwZNQH9z7fb93l5QZxf2A74H07OQ7H
Of6sybF72dK8Uqc8xMk54H07/RRg4s+ZQE/NVPODtcQNnFYp5DU4UiksEl4YAbUGfvzanebkBo+a
cEYgHkmg1vUJ5LI4o9fIu8DCUZQqMj7Gc0wdjMxWpYnHz5n3VWLn6L0z3RfZhObJwizudw6IiLda
wu4qx5lloc3JAxpiMvgj8+RAFyoXV7cPeskqWYhJw7yJMDN0ImtxL/QaGUkC88A7hTv8fVzsa1KP
v3vR4yWH2mwh4N8EH9JBjzkRadfSn3rP+K9a9oiSJnGPiSpFqSQBNnf0zMteUW1aQCxYqXcoJNE7
g8UOZK+e0Zs4lC52uucCXkWa85sQnFE/uRtpBItOnh4htoeZ4IdCfMlaPL9gdykOiC11WVU60SJ8
P6Ntf3oJswtwARW+jUH/kmBqxi6EiYLnHMyrrUfuPUiJUlBeHVjKHl4RW/K+OiSvATT212pxpli8
xiBK2IkO29/Q2s1Bsu1mKrF3U1ZYaaVct7TM+BMqQo3a3BLiDaS4iOQ7CspUz3wkvIiefjFyWGIb
BoXYhIteh+bzv96mCzi1xBldhE4kw3W6UBcA+MR49USlP55rHNjEhxP5Tb/zmrGrdM9L8i18bIqj
hD2ZxgCISKhtd+OgWr26n/eAjpcI+2G7tFxLHa/PLcwkHssA44ym8i6eSBa1Xd3VAvN+B99juN0+
lrmsv7wcvwZ3oo/M3IGvSnT4eDALzte570kdMS5BpYzRSMKRkrh6D8+2IbpLBpVuP3ACcv5dAL92
d5xxfteDYq2wRUSEjkbMII9WTnFAgmXPbYCVcNJ+W9tJRt6DvmJ8BlsKTl8tQ3umswo9qnHtK4Oz
CTE6yufUU+yJp0PA+z9kn2c+ub4bEFpX40+ajlVjeNo9UNEfPINS8nWKQBHDQP/LQH05O06m+V3m
lwKlbLCIHXWelkLq7N5s08kf1o25MkMYfW5PIhhdCndeohq3oh3p36zAX8MO12w9LG0kd7kitVMP
ojxfVdlfKZEJ50pC8q64KsA8hnklevE20IRcnii1kAZ0XS/qB3NAId93SH8gK/3LYKJ/Vw1Ym0Vz
UQka6+qzyILTV8124ZIUMkKRSaatE2n2NyiBLVb1rKm1kkpspgRz7eaJ29ZTYf1kHyYKwU/8vDBD
GewP3MEbA9wzSpCSWZvxhrbWEobmkbFcsZvtINmGNEqeTZd2pbHnRWQxJE+c5tGzlS9iz85nKP3i
EWq3x4iWwtxtXuInR9akhsCWuexU7bUEpED3W6Ag3wqo8z1jAyG6LHuDlQcnmx6WRyeT0BCx9X8y
3gm3FpdRiHYN5MXzF3QSywbKUCA0vmZeXIppCol4lDtwWfgSlrCP+Cjp2/T1YpQ9zWoj+Wc62nIg
1G6yFr8yNuIYXCH7IevmLg4ugDt9yhM8nzxphwc7/PdYa4c0LJ5wb1HnXuZzas6de3p4LjsB+IMI
SaH9p33tFZ59zge/QQ8plscOw0jfXUSipVbaNYtb+/p60dTZNZAkYNF4v/6pBE7CCfCx2axC5+wD
DYopuOYvmgkyNiaXewvCnwnPrLbMCtxUi15ZjFWY3GwD42927gmS9JT+ZBGH7KD4oeGDuQsKFyHU
s7tbN0HaKpvu+ZovmdrYhR1leCsda03peOzayPl8cNwmQR/Ip6atdsjE30RywLLWQmmKWLSE6I0Q
JQtLRvuXKX+EeiQrEvGu0N2hWYjAVjjSfRqSGszPCgc2yPd/ZQRDX5P8xBLfCKeX/XZEeE4HFDoA
qdExzxOg7HaFYI01RzIBDNmnEij3eqZIgvksrHbV4QPA0u0uBlID79lZYSi9T505EoYzaS1C4K7A
T89pv7SzRshmMdcuNWhMjxVkzEYo9FRR49nsIL9YBEGNW9XS73z2M642jf4V0eim8wRg5a32Vejc
CkV/fVwHhbz6qJ3+z8O895tQ2Wsriw+WPccjag0CFRor7PoYhoHigvhuS27rsFhODxi6nKa3k8SF
7Gs9CxIM8zMxK+M2+biz3AmWq3doWeR3U7y5wbMIfRXDNfmR4x4PQLbq51IFcyZlETWbQYrgdCJz
x08FSmfjcGG80I8aYSNnqIwk2JSMTqaODd/RkpVVRiV141k7wNPrvTduWHjo2puWjKNY9pMP4yy4
W9ijCwEUYPCxuuck5y/IRsIID4+dZBcTEMtjwjkYrhAatrVmW32NKdsqS+SphvtvgF1swMcIZ9Fl
JqqBh2w4ZLtYCMxyce5zll83dJ72WCFekmrnzxkvi+mItN2NK0tRI/Cpee10om1zGwAt0qfUCI/1
VuJCcNCBlY9wUui//EOTux9dWeezAwTjMZx5bkhvaifMqC0bxBlfaSxneqDBmvwDBYpb/Gh42XCX
XhWfVIArdwAp4kUTpdh8SixKzPeZayLyJ4JJxNcm181yM2v6mL29bHfp1OnBusuDd3GyK5TfQT7r
DM/ieTc11CpCC9SzgiuDWm7dch9Dz3QOnco+oRTdMRkRKlFrz0tvA9I21SaOsmZH3SlBoArTi/a3
h0LWs6Zhcrg+8Mz5ezJ2/SwWhuQ6U8JAZ13Q+VtdWtqWIAxBp93d3N1Ve8ZkCGifbV6fDA8vd3FL
J6WCMpSB0J+AuIIti5jrt8+dKgneF8L+yUpCu1KUwh1z07BdIMhl7VD3B+uVXCjwhrH2+kENPrhv
Du3oZ+2vT/hbYKXsBeNqOchm5TESP/6TBmgy9ItcFR34XSpnZ6SvWFnY16wxbKevqQXxXFfLq2L1
qoJ4kgjvxyJJVd/XhtBhxEusc03OsxnqMOMeRaP4setZ7Ac+SZn6qhVXf6S3Kza+oRe2G3LPD4NN
pX+pUJYJHXtf3DCmW/O7Y3rqgWwtBaTUQaHY9fzR1qnxUanknR9HZigbcGFnLl+7NVq5u29rc0VW
4rvS+kzUfNX3Sa+WDYtllbfqC+MO7+TYKYuf6LXhJmps71a5OeqINjTO01YV41wsPjC0SyXhOt2A
QvBUsoixDdUxiP6oavvDjkQYEmS2kHrSpyAzeaMkyeUDmx0bsOlqeEDobdKDV04tcgUcPktGS3qh
5xzfX8GgkI4gR3adFqm1zjSZ4n6j/kiZMywC9FdGKaXmoAPLNHuRG/i24iYsMWSM+6PtMxCbVWWQ
eU7zZY8dDhr6z+lC9DYsG9tQEsvrUtDL9LJ5DmEuOj9DSYdrQkvthrxLVdGJkhTyD2AmWvMp8UwO
S6i5dyAKNh1tZswNgOqZFvOie8bdRDt8ODAChHJAQV85Lwt/4D2ocFK6jNMngiCXZUri8Mvin94D
AZVdEJI9yB5J2+le8sqOiOcYge9Y9lkmWRCXgnah1w0gv7SL1ufAcAUQdLsMX0m5MKsbglQcldwr
ZQrfku9Rm6N+0CazYNzuvO2/th5Wq8pk4+gSawuLdnJLfYnxH15uuAX5eDrYiw17DPRQfaYq5yAJ
osW7NjqOPbMuhfDwrlUNIsvlrWek2gHbk422/eV8lTRx4Xizh1OGMw204/t37xkLluU9bvB3SdNF
Nzf0zzI2noQeSedv4VTbMRFgNU6/glkJ35i1WUfbadUCaM+f57dhZXwdi4pp4Cs+fTkMa66TH9HX
8j+ikGqOI2FmTx0HC9jBR+i3R2b478uKxAKJR/dNT7SO9DyD0WUImKvRqQNvENJCH6JZuInO1i4c
u/bjdTcYKViycXg6o8U6qJPIm8HqrUtlt51R78XkGr2bwRBXqz1mPUWkKbLAzEkfV57yLblryjiG
33w0OlxzIjAqNDl3zigu/8wV5QwD9YOlM/JB0BjlcJ4/CkrZuSEQpB9FtwgwkKWz8KOZf601gdzk
E4Juc80/RVA=
`protect end_protected
| {
"pile_set_name": "Github"
} |
/*
* Axelor Business Solutions
*
* Copyright (C) 2020 Axelor (<http://axelor.com>).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.axelor.apps.base.web;
import com.axelor.apps.base.db.ObjectDataConfig;
import com.axelor.apps.base.db.ObjectDataConfigExport;
import com.axelor.apps.base.db.repo.ObjectDataConfigRepository;
import com.axelor.apps.base.service.ObjectDataAnonymizeService;
import com.axelor.apps.base.service.ObjectDataExportService;
import com.axelor.exception.AxelorException;
import com.axelor.i18n.I18n;
import com.axelor.inject.Beans;
import com.axelor.meta.db.MetaFile;
import com.axelor.meta.schema.actions.ActionView;
import com.axelor.rpc.ActionRequest;
import com.axelor.rpc.ActionResponse;
import com.axelor.rpc.Context;
public class ObjectDataExportController {
public void export(ActionRequest request, ActionResponse response) throws AxelorException {
ObjectDataConfigExport objDataConfigExport =
request.getContext().asType(ObjectDataConfigExport.class);
Long objectDataconfigId = objDataConfigExport.getObjectDataConfig().getId();
ObjectDataConfig objectDataConfig =
Beans.get(ObjectDataConfigRepository.class).find(objectDataconfigId);
MetaFile dataFile =
Beans.get(ObjectDataExportService.class).export(objectDataConfig, objDataConfigExport);
if (dataFile != null) {
response.setView(
ActionView.define(I18n.get("Data"))
.add(
"html",
"ws/rest/com.axelor.meta.db.MetaFile/"
+ dataFile.getId()
+ "/content/download?v="
+ dataFile.getVersion())
.param("download", "true")
.map());
}
response.setCanClose(true);
}
public void anonymize(ActionRequest request, ActionResponse response) throws AxelorException {
Context context = request.getContext();
Long recordId = Long.parseLong(context.get("modelSelectId").toString());
Long objectDataconfigId = Long.parseLong(context.get("objectDataConfigId").toString());
ObjectDataConfig objectDataConfig =
Beans.get(ObjectDataConfigRepository.class).find(objectDataconfigId);
Beans.get(ObjectDataAnonymizeService.class).anonymize(objectDataConfig, recordId);
response.setFlash("Data anonymized successfully");
response.setCanClose(true);
}
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* Pre-transform that changes deprecated hspace and vspace attributes to CSS
*/
class HTMLPurifier_AttrTransform_ImgSpace extends HTMLPurifier_AttrTransform
{
/**
* @type string
*/
protected $attr;
/**
* @type array
*/
protected $css = array(
'hspace' => array('left', 'right'),
'vspace' => array('top', 'bottom')
);
/**
* @param string $attr
*/
public function __construct($attr)
{
$this->attr = $attr;
if (!isset($this->css[$attr])) {
trigger_error(htmlspecialchars($attr) . ' is not valid space attribute');
}
}
/**
* @param array $attr
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return array
*/
public function transform($attr, $config, $context)
{
if (!isset($attr[$this->attr])) {
return $attr;
}
$width = $this->confiscateAttr($attr, $this->attr);
// some validation could happen here
if (!isset($this->css[$this->attr])) {
return $attr;
}
$style = '';
foreach ($this->css[$this->attr] as $suffix) {
$property = "margin-$suffix";
$style .= "$property:{$width}px;";
}
$this->prependCSS($attr, $style);
return $attr;
}
}
// vim: et sw=4 sts=4
| {
"pile_set_name": "Github"
} |
<?php
namespace oasis\names\specification\ubl\schema\xsd\CommonBasicComponents_2;
/**
* @xmlNamespace urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2
* @xmlType TimingComplaintType
* @xmlName TimingComplaint
* @var oasis\names\specification\ubl\schema\xsd\CommonBasicComponents_2\TimingComplaint
*/
class TimingComplaint extends TimingComplaintType
{
} // end class TimingComplaint
| {
"pile_set_name": "Github"
} |
/*******************************************************************************
* Copyright (c) 2013-2015 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.acmeair.wxs.entities;
import java.io.Serializable;
import com.acmeair.entities.FlightSegment;
public class FlightSegmentImpl implements FlightSegment, Serializable{
private static final long serialVersionUID = 1L;
private String _id;
private String originPort;
private String destPort;
private int miles;
public FlightSegmentImpl() {
}
public FlightSegmentImpl(String flightName, String origPort, String destPort, int miles) {
this._id = flightName;
this.originPort = origPort;
this.destPort = destPort;
this.miles = miles;
}
public String getFlightName() {
return _id;
}
public void setFlightName(String flightName) {
this._id = flightName;
}
public String getOriginPort() {
return originPort;
}
public void setOriginPort(String originPort) {
this.originPort = originPort;
}
public String getDestPort() {
return destPort;
}
public void setDestPort(String destPort) {
this.destPort = destPort;
}
public int getMiles() {
return miles;
}
public void setMiles(int miles) {
this.miles = miles;
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("FlightSegment ").append(_id).append(" originating from:\"").append(originPort).append("\" arriving at:\"").append(destPort).append("\"");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
FlightSegmentImpl other = (FlightSegmentImpl) obj;
if (destPort == null) {
if (other.destPort != null)
return false;
} else if (!destPort.equals(other.destPort))
return false;
if (_id == null) {
if (other._id != null)
return false;
} else if (!_id.equals(other._id))
return false;
if (miles != other.miles)
return false;
if (originPort == null) {
if (other.originPort != null)
return false;
} else if (!originPort.equals(other.originPort))
return false;
return true;
}
} | {
"pile_set_name": "Github"
} |
# frozen_string_literal: true
RSpec.describe RuboCop::Cop::InternalAffairs::NodeTypePredicate do
subject(:cop) { described_class.new }
context 'comparison node type check' do
it 'registers an offense and auto-corrects' do
expect_offense(<<~RUBY)
node.type == :send
^^^^^^^^^^^^^^^^^^ Use `#send_type?` to check node type.
RUBY
expect_correction(<<~RUBY)
node.send_type?
RUBY
end
end
it 'does not register an offense for a predicate node type check' do
expect_no_offenses(<<~RUBY, 'example_spec.rb')
node.send_type?
RUBY
end
end
| {
"pile_set_name": "Github"
} |
-- Copyright (C) 2007, 2010 - Bit-Blot
--
-- This file is part of Aquaria.
--
-- Aquaria 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.
if not v then v = {} end
dofile("scripts/entities/breakablecommon.lua")
function init(me)
loadSound("licage-shatter")
v.commonInit(me, "breakable/suncontainer", 64, 3, 1, "licage-shatter", true, 8)
entity_scale(me, 1.65, 1.65)
end
| {
"pile_set_name": "Github"
} |
path: "tensorflow.estimator.export.PredictOutput.__metaclass__"
tf_class {
is_instance: "<type \'type\'>"
member_method {
name: "__init__"
}
member_method {
name: "mro"
}
member_method {
name: "register"
argspec: "args=[\'cls\', \'subclass\'], varargs=None, keywords=None, defaults=None"
}
}
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.