Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    TypeError
Message:      Couldn't cast array of type
struct<content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>>
to
{'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}], 'symlink_target': Value(dtype='string', id=None)}
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2011, in _prepare_split_single
                  writer.write_table(table)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/arrow_writer.py", line 585, in write_table
                  pa_table = table_cast(pa_table, self._schema)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2302, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2261, in cast_table_to_schema
                  arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()]
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2261, in <listcomp>
                  arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()]
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1802, in wrapper
                  return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1802, in <listcomp>
                  return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2122, in cast_array_to_feature
                  raise TypeError(f"Couldn't cast array of type\n{_short_str(array.type)}\nto\n{_short_str(feature)}")
              TypeError: Couldn't cast array of type
              struct<content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>>
              to
              {'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}], 'symlink_target': Value(dtype='string', id=None)}
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
                  parquet_operations = convert_to_parquet(builder)
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
                  builder.download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
                  self._download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
                  self._prepare_split(split_generator, **prepare_split_kwargs)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

text
string
meta
dict
using namespace std; extern int nStakeMaxAge; extern int nStakeTargetSpacing; typedef std::map<int, unsigned int> MapModifierCheckpoints; // Hard checkpoints of stake modifiers to ensure they are deterministic static std::map<int, unsigned int> mapStakeModifierCheckpoints = boost::assign::map_list_of ( 0, 0xfd11f4e7 ) ( 1, 0x2dcbe358 ) ; // Hard checkpoints of stake modifiers to ensure they are deterministic (testNet) static std::map<int, unsigned int> mapStakeModifierCheckpointsTestNet = boost::assign::map_list_of ( 0, 0x0e00670bu ) ; // Get time weight int64 GetWeight(int64 nIntervalBeginning, int64 nIntervalEnd) { // Kernel hash weight starts from 0 at the 30-day min age // this change increases active coins participating the hash and helps // to secure the network when proof-of-stake difficulty is low // // Maximum TimeWeight is 90 days. return min(nIntervalEnd - nIntervalBeginning - nStakeMinAge, (int64)nStakeMaxAge); } // Get the last stake modifier and its generation time from a given block static bool GetLastStakeModifier(const CBlockIndex* pindex, uint64& nStakeModifier, int64& nModifierTime) { if (!pindex) return error("GetLastStakeModifier: null pindex"); while (pindex && pindex->pprev && !pindex->GeneratedStakeModifier()) pindex = pindex->pprev; if (!pindex->GeneratedStakeModifier()) return error("GetLastStakeModifier: no generation at genesis block"); nStakeModifier = pindex->nStakeModifier; nModifierTime = pindex->GetBlockTime(); return true; } // Get selection interval section (in seconds) static int64 GetStakeModifierSelectionIntervalSection(int nSection) { assert (nSection >= 0 && nSection < 64); return (nModifierInterval * 63 / (63 + ((63 - nSection) * (MODIFIER_INTERVAL_RATIO - 1)))); } // Get stake modifier selection interval (in seconds) static int64 GetStakeModifierSelectionInterval() { int64 nSelectionInterval = 0; for (int nSection=0; nSection<64; nSection++) nSelectionInterval += GetStakeModifierSelectionIntervalSection(nSection); return nSelectionInterval; } // select a block from the candidate blocks in vSortedByTimestamp, excluding // already selected blocks in vSelectedBlocks, and with timestamp up to // nSelectionIntervalStop. static bool SelectBlockFromCandidates(vector<pair<int64, uint256> >& vSortedByTimestamp, map<uint256, const CBlockIndex*>& mapSelectedBlocks, int64 nSelectionIntervalStop, uint64 nStakeModifierPrev, const CBlockIndex** pindexSelected) { bool fSelected = false; uint256 hashBest = 0; *pindexSelected = (const CBlockIndex*) 0; BOOST_FOREACH(const PAIRTYPE(int64, uint256)& item, vSortedByTimestamp) { if (!mapBlockIndex.count(item.second)) return error("SelectBlockFromCandidates: failed to find block index for candidate block %s", item.second.ToString().c_str()); const CBlockIndex* pindex = mapBlockIndex[item.second]; if (fSelected && pindex->GetBlockTime() > nSelectionIntervalStop) break; if (mapSelectedBlocks.count(pindex->GetBlockHash()) > 0) continue; // compute the selection hash by hashing its proof-hash and the // previous proof-of-stake modifier uint256 hashProof = pindex->IsProofOfStake()? pindex->hashProofOfStake : pindex->GetBlockHash(); CDataStream ss(SER_GETHASH, 0); ss << hashProof << nStakeModifierPrev; uint256 hashSelection = Hash(ss.begin(), ss.end()); // the selection hash is divided by 2**32 so that proof-of-stake block // is always favored over proof-of-work block. this is to preserve // the energy efficiency property if (pindex->IsProofOfStake()) hashSelection >>= 32; if (fSelected && hashSelection < hashBest) { hashBest = hashSelection; *pindexSelected = (const CBlockIndex*) pindex; } else if (!fSelected) { fSelected = true; hashBest = hashSelection; *pindexSelected = (const CBlockIndex*) pindex; } } if (fDebug && GetBoolArg("-printstakemodifier")) printf("SelectBlockFromCandidates: selection hash=%s\n", hashBest.ToString().c_str()); return fSelected; } // Stake Modifier (hash modifier of proof-of-stake): // The purpose of stake modifier is to prevent a txout (coin) owner from // computing future proof-of-stake generated by this txout at the time // of transaction confirmation. To meet kernel protocol, the txout // must hash with a future stake modifier to generate the proof. // Stake modifier consists of bits each of which is contributed from a // selected block of a given block group in the past. // The selection of a block is based on a hash of the block's proof-hash and // the previous stake modifier. // Stake modifier is recomputed at a fixed time interval instead of every // block. This is to make it difficult for an attacker to gain control of // additional bits in the stake modifier, even after generating a chain of // blocks. bool ComputeNextStakeModifier(const CBlockIndex* pindexPrev, uint64& nStakeModifier, bool& fGeneratedStakeModifier) { nStakeModifier = 0; fGeneratedStakeModifier = false; if (!pindexPrev) { fGeneratedStakeModifier = true; return true; // genesis block's modifier is 0 } // First find current stake modifier and its generation block time // if it's not old enough, return the same stake modifier int64 nModifierTime = 0; if (!GetLastStakeModifier(pindexPrev, nStakeModifier, nModifierTime)) return error("ComputeNextStakeModifier: unable to get last modifier"); if (fDebug) { printf("ComputeNextStakeModifier: prev modifier=0x%016"PRI64x" time=%s\n", nStakeModifier, DateTimeStrFormat(nModifierTime).c_str()); } if (nModifierTime / nModifierInterval >= pindexPrev->GetBlockTime() / nModifierInterval) return true; // Sort candidate blocks by timestamp vector<pair<int64, uint256> > vSortedByTimestamp; vSortedByTimestamp.reserve(64 * nModifierInterval / nStakeTargetSpacing); int64 nSelectionInterval = GetStakeModifierSelectionInterval(); int64 nSelectionIntervalStart = (pindexPrev->GetBlockTime() / nModifierInterval) * nModifierInterval - nSelectionInterval; const CBlockIndex* pindex = pindexPrev; while (pindex && pindex->GetBlockTime() >= nSelectionIntervalStart) { vSortedByTimestamp.push_back(make_pair(pindex->GetBlockTime(), pindex->GetBlockHash())); pindex = pindex->pprev; } int nHeightFirstCandidate = pindex ? (pindex->nHeight + 1) : 0; reverse(vSortedByTimestamp.begin(), vSortedByTimestamp.end()); sort(vSortedByTimestamp.begin(), vSortedByTimestamp.end()); // Select 64 blocks from candidate blocks to generate stake modifier uint64 nStakeModifierNew = 0; int64 nSelectionIntervalStop = nSelectionIntervalStart; map<uint256, const CBlockIndex*> mapSelectedBlocks; for (int nRound=0; nRound<min(64, (int)vSortedByTimestamp.size()); nRound++) { // add an interval section to the current selection round nSelectionIntervalStop += GetStakeModifierSelectionIntervalSection(nRound); // select a block from the candidates of current round if (!SelectBlockFromCandidates(vSortedByTimestamp, mapSelectedBlocks, nSelectionIntervalStop, nStakeModifier, &pindex)) return error("ComputeNextStakeModifier: unable to select block at round %d", nRound); // write the entropy bit of the selected block nStakeModifierNew |= (((uint64)pindex->GetStakeEntropyBit()) << nRound); // add the selected block from candidates to selected list mapSelectedBlocks.insert(make_pair(pindex->GetBlockHash(), pindex)); if (fDebug && GetBoolArg("-printstakemodifier")) printf("ComputeNextStakeModifier: selected round %d stop=%s height=%d bit=%d\n", nRound, DateTimeStrFormat(nSelectionIntervalStop).c_str(), pindex->nHeight, pindex->GetStakeEntropyBit()); } // Print selection map for visualization of the selected blocks if (fDebug && GetBoolArg("-printstakemodifier")) { string strSelectionMap = ""; // '-' indicates proof-of-work blocks not selected strSelectionMap.insert(0, pindexPrev->nHeight - nHeightFirstCandidate + 1, '-'); pindex = pindexPrev; while (pindex && pindex->nHeight >= nHeightFirstCandidate) { // '=' indicates proof-of-stake blocks not selected if (pindex->IsProofOfStake()) strSelectionMap.replace(pindex->nHeight - nHeightFirstCandidate, 1, "="); pindex = pindex->pprev; } BOOST_FOREACH(const PAIRTYPE(uint256, const CBlockIndex*)& item, mapSelectedBlocks) { // 'S' indicates selected proof-of-stake blocks // 'W' indicates selected proof-of-work blocks strSelectionMap.replace(item.second->nHeight - nHeightFirstCandidate, 1, item.second->IsProofOfStake()? "S" : "W"); } printf("ComputeNextStakeModifier: selection height [%d, %d] map %s\n", nHeightFirstCandidate, pindexPrev->nHeight, strSelectionMap.c_str()); } if (fDebug) { printf("ComputeNextStakeModifier: new modifier=0x%016"PRI64x" time=%s\n", nStakeModifierNew, DateTimeStrFormat(pindexPrev->GetBlockTime()).c_str()); } nStakeModifier = nStakeModifierNew; fGeneratedStakeModifier = true; return true; } // The stake modifier used to hash for a stake kernel is chosen as the stake // modifier about a selection interval later than the coin generating the kernel static bool GetKernelStakeModifier(uint256 hashBlockFrom, uint64& nStakeModifier, int& nStakeModifierHeight, int64& nStakeModifierTime, bool fPrintProofOfStake) { nStakeModifier = 0; if (!mapBlockIndex.count(hashBlockFrom)) return error("GetKernelStakeModifier() : block not indexed"); const CBlockIndex* pindexFrom = mapBlockIndex[hashBlockFrom]; nStakeModifierHeight = pindexFrom->nHeight; nStakeModifierTime = pindexFrom->GetBlockTime(); int64 nStakeModifierSelectionInterval = GetStakeModifierSelectionInterval(); const CBlockIndex* pindex = pindexFrom; // loop to find the stake modifier later by a selection interval while (nStakeModifierTime < pindexFrom->GetBlockTime() + nStakeModifierSelectionInterval) { if (!pindex->pnext) { // reached best block; may happen if node is behind on block chain if (fPrintProofOfStake || (pindex->GetBlockTime() + nStakeMinAge - nStakeModifierSelectionInterval > GetAdjustedTime())) return error("GetKernelStakeModifier() : reached best block %s at height %d from block %s", pindex->GetBlockHash().ToString().c_str(), pindex->nHeight, hashBlockFrom.ToString().c_str()); else return false; } pindex = pindex->pnext; if (pindex->GeneratedStakeModifier()) { nStakeModifierHeight = pindex->nHeight; nStakeModifierTime = pindex->GetBlockTime(); } } nStakeModifier = pindex->nStakeModifier; return true; } // ppcoin kernel protocol // coinstake must meet hash target according to the protocol: // kernel (input 0) must meet the formula // hash(nStakeModifier + txPrev.block.nTime + txPrev.offset + txPrev.nTime + txPrev.vout.n + nTime) < bnTarget * nCoinDayWeight // this ensures that the chance of getting a coinstake is proportional to the // amount of coin age one owns. // The reason this hash is chosen is the following: // nStakeModifier: scrambles computation to make it very difficult to precompute // future proof-of-stake at the time of the coin's confirmation // txPrev.block.nTime: prevent nodes from guessing a good timestamp to // generate transaction for future advantage // txPrev.offset: offset of txPrev inside block, to reduce the chance of // nodes generating coinstake at the same time // txPrev.nTime: reduce the chance of nodes generating coinstake at the same // time // txPrev.vout.n: output number of txPrev, to reduce the chance of nodes // generating coinstake at the same time // block/tx hash should not be used here as they can be generated in vast // quantities so as to generate blocks faster, degrading the system back into // a proof-of-work situation. // bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned int nTxPrevOffset, const CTransaction& txPrev, const COutPoint& prevout, unsigned int nTimeTx, uint256& hashProofOfStake, uint256& targetProofOfStake, bool fPrintProofOfStake) { if (nTimeTx < txPrev.nTime) // Transaction timestamp violation return error("CheckStakeKernelHash() : nTime violation"); unsigned int nTimeBlockFrom = blockFrom.GetBlockTime(); if (nTimeBlockFrom + nStakeMinAge > nTimeTx) // Min age requirement return error("CheckStakeKernelHash() : min age violation"); CBigNum bnTargetPerCoinDay; bnTargetPerCoinDay.SetCompact(nBits); int64 nValueIn = txPrev.vout[prevout.n].nValue; uint256 hashBlockFrom = blockFrom.GetHash(); CBigNum bnCoinDayWeight = CBigNum(nValueIn) * GetWeight((int64)txPrev.nTime, (int64)nTimeTx) / COIN / (24 * 60 * 60); targetProofOfStake = (bnCoinDayWeight * bnTargetPerCoinDay).getuint256(); // Calculate hash CDataStream ss(SER_GETHASH, 0); uint64 nStakeModifier = 0; int nStakeModifierHeight = 0; int64 nStakeModifierTime = 0; if (!GetKernelStakeModifier(hashBlockFrom, nStakeModifier, nStakeModifierHeight, nStakeModifierTime, fPrintProofOfStake)) return false; ss << nStakeModifier; ss << nTimeBlockFrom << nTxPrevOffset << txPrev.nTime << prevout.n << nTimeTx; hashProofOfStake = Hash(ss.begin(), ss.end()); if (fPrintProofOfStake) { printf("CheckStakeKernelHash() : using modifier 0x%016"PRI64x" at height=%d timestamp=%s for block from height=%d timestamp=%s\n", nStakeModifier, nStakeModifierHeight, DateTimeStrFormat(nStakeModifierTime).c_str(), mapBlockIndex[hashBlockFrom]->nHeight, DateTimeStrFormat(blockFrom.GetBlockTime()).c_str()); printf("CheckStakeKernelHash() : check modifier=0x%016"PRI64x" nTimeBlockFrom=%u nTxPrevOffset=%u nTimeTxPrev=%u nPrevout=%u nTimeTx=%u hashProof=%s\n", nStakeModifier, nTimeBlockFrom, nTxPrevOffset, txPrev.nTime, prevout.n, nTimeTx, hashProofOfStake.ToString().c_str()); } // Now check if proof-of-stake hash meets target protocol if (CBigNum(hashProofOfStake) > bnCoinDayWeight * bnTargetPerCoinDay) return false; if (fDebug && !fPrintProofOfStake) { printf("CheckStakeKernelHash() : using modifier 0x%016"PRI64x" at height=%d timestamp=%s for block from height=%d timestamp=%s\n", nStakeModifier, nStakeModifierHeight, DateTimeStrFormat(nStakeModifierTime).c_str(), mapBlockIndex[hashBlockFrom]->nHeight, DateTimeStrFormat(blockFrom.GetBlockTime()).c_str()); printf("CheckStakeKernelHash() : pass modifier=0x%016"PRI64x" nTimeBlockFrom=%u nTxPrevOffset=%u nTimeTxPrev=%u nPrevout=%u nTimeTx=%u hashProof=%s\n", nStakeModifier, nTimeBlockFrom, nTxPrevOffset, txPrev.nTime, prevout.n, nTimeTx, hashProofOfStake.ToString().c_str()); } return true; } // Check kernel hash target and coinstake signature bool CheckProofOfStake(const CTransaction& tx, unsigned int nBits, uint256& hashProofOfStake, uint256& targetProofOfStake) { if (!tx.IsCoinStake()) return error("CheckProofOfStake() : called on non-coinstake %s", tx.GetHash().ToString().c_str()); // Kernel (input 0) must match the stake hash target per coin age (nBits) const CTxIn& txin = tx.vin[0]; // First try finding the previous transaction in database CTxDB txdb("r"); CTransaction txPrev; CTxIndex txindex; if (!txPrev.ReadFromDisk(txdb, txin.prevout, txindex)) return tx.DoS(1, error("CheckProofOfStake() : INFO: read txPrev failed")); // previous transaction not in main chain, may occur during initial download // Verify signature if (!VerifySignature(txPrev, tx, 0, true, 0)) return tx.DoS(100, error("CheckProofOfStake() : VerifySignature failed on coinstake %s", tx.GetHash().ToString().c_str())); // Read block header CBlock block; if (!block.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos, false)) return fDebug? error("CheckProofOfStake() : read block failed") : false; // unable to read block of previous transaction if (!CheckStakeKernelHash(nBits, block, txindex.pos.nTxPos - txindex.pos.nBlockPos, txPrev, txin.prevout, tx.nTime, hashProofOfStake, targetProofOfStake, fDebug)) return tx.DoS(1, error("CheckProofOfStake() : INFO: check kernel failed on coinstake %s, hashProof=%s", tx.GetHash().ToString().c_str(), hashProofOfStake.ToString().c_str())); // may occur during initial download or if behind on block chain sync return true; } // Check whether the coinstake timestamp meets protocol bool CheckCoinStakeTimestamp(int64 nTimeBlock, int64 nTimeTx) { // v0.3 protocol return (nTimeBlock == nTimeTx); } // Get stake modifier checksum unsigned int GetStakeModifierChecksum(const CBlockIndex* pindex) { assert (pindex->pprev || pindex->GetBlockHash() == (!fTestNet ? hashGenesisBlock : hashGenesisBlockTestNet)); // Hash previous checksum with flags, hashProofOfStake and nStakeModifier CDataStream ss(SER_GETHASH, 0); if (pindex->pprev) ss << pindex->pprev->nStakeModifierChecksum; ss << pindex->nFlags << pindex->hashProofOfStake << pindex->nStakeModifier; uint256 hashChecksum = Hash(ss.begin(), ss.end()); hashChecksum >>= (256 - 32); return hashChecksum.Get64(); } // Check stake modifier hard checkpoints bool CheckStakeModifierCheckpoints(int nHeight, unsigned int nStakeModifierChecksum) { MapModifierCheckpoints& checkpoints = (fTestNet ? mapStakeModifierCheckpointsTestNet : mapStakeModifierCheckpoints); if (checkpoints.count(nHeight)) return nStakeModifierChecksum == checkpoints[nHeight]; return true; }
{ "content_hash": "b885ecfd44845e0842e2b432beb6e2a2", "timestamp": "", "source": "github", "line_count": 385, "max_line_length": 255, "avg_line_length": 48.16883116883117, "alnum_prop": 0.7031544890806147, "repo_name": "Rimbit/Wallets", "id": "131c9fcb139048a4e33f895341125b826efd33b4", "size": "18814", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/kernel.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "51312" }, { "name": "C", "bytes": "32649" }, { "name": "C++", "bytes": "2557238" }, { "name": "CSS", "bytes": "1127" }, { "name": "Groff", "bytes": "12582" }, { "name": "HTML", "bytes": "50615" }, { "name": "Makefile", "bytes": "12660" }, { "name": "NSIS", "bytes": "5840" }, { "name": "Objective-C", "bytes": "747" }, { "name": "Objective-C++", "bytes": "2451" }, { "name": "Python", "bytes": "44097" }, { "name": "QMake", "bytes": "14105" }, { "name": "Shell", "bytes": "8193" } ], "symlink_target": null }
package topoos.APIAccess.Operations; import java.net.URLEncoder; /** * Class that get membership. * * Lists all users authorized in your app. Private info can be returned by using Administrator token. * Accreditation info is never returned. * * @see APIOperation * @author topoos */ public class UsersGetMembership extends APIOperation { /** The oauth_token. */ private String oauth_token; //(Required) access_token. If Administrator token is provided, then emails and other private info is returned. /** Count*/ private Integer count; //(Optional) number of elements in the page. Default is 100 users. /** Page*/ private Integer page; //(Optional) page of results requested. Default value is page 0. /*** * Instantiates a new Reset password. * * @param operationName * @param method * @param format * @param version * @param oauth_token * @param count * @param page */ public UsersGetMembership(String operationName, String method, String format, Integer version, String oauth_token, Integer count, Integer page) { super(operationName, method, format, version); this.oauth_token = oauth_token; this.count = count; this.page = page; } /* * (non-Javadoc) * * @see topoos.APIAccess.Operations.APIOperation#ValidateParams() */ @Override public boolean ValidateParams() { boolean validate = super.ValidateParams(); validate = validate && isValid(oauth_token); validate = validate && isValidorNull(APIUtils.toStringInteger(count)); validate = validate && isValidorNull(APIUtils.toStringInteger(page)); return validate; } /* * (non-Javadoc) * * @see topoos.APIAccess.Operations.APIOperation#ConcatParams() */ @Override public String ConcatParams() { // TODO Auto-generated method stub String params = null; if (this.ValidateParams()) { params = "/" + this.Version + "/users."+this.Format+"?" + "access_token="+URLEncoder.encode(oauth_token) + (count == null ? "" : "&count="+ URLEncoder.encode(APIUtils.toStringInteger(count))) + (page == null ? "" : "&page="+ URLEncoder.encode(APIUtils.toStringInteger(page))); } return params; } }
{ "content_hash": "8df3e0daa78304290914827c357155e8", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 139, "avg_line_length": 26.666666666666668, "alnum_prop": 0.6944444444444444, "repo_name": "topoos/topoos_sdk_android", "id": "0687b16d5d54d2f8155252d241e9951079875aa6", "size": "2761", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/topoos/APIAccess/Operations/UsersGetMembership.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "769441" } ], "symlink_target": null }
require 'spec_helper' module OnStomp::Connections::Serializers describe Stomp_1_0 do let(:serializer) { Stomp_1_0.new } describe "ancestors" do it "should be a kind of Stomp_1 serializer" do serializer.should be_a_kind_of(OnStomp::Connections::Serializers::Stomp_1) end end describe ".frame_to_string" do # So tests pass with Ruby 1.8.7, we need to get the headers in order let(:frame_without_body) { OnStomp::Components::Frame.new('COMMAND').tap do |f| f[:header1] = 'value 1' f[:header2] = 'value 2' f["header\nwith:specials"] = "value\nwith\nspecials" end } let(:frame_with_body) { OnStomp::Components::Frame.new('COMMAND',{},"body of message").tap do |f| f[:header1] = 'value 1' f[:header2] = 'value 2' f["header\nwith:specials"] = "value\nwith\nspecials" end } it "should convert a frame to a string with escaped headers" do serializer.frame_to_string(frame_without_body).should == "COMMAND\nheader1:value 1\nheader2:value 2\nheaderwithspecials:valuewithspecials\n\n\000" end it "should generate a content-length" do serializer.frame_to_string(frame_with_body).should == "COMMAND\nheader1:value 1\nheader2:value 2\nheaderwithspecials:valuewithspecials\ncontent-length:15\n\nbody of message\000" end end describe ".split_header" do it "should raise a malformed header error if the header line has no ':'" do lambda { serializer.split_header('header-name') }.should raise_error(OnStomp::MalformedHeaderError) end it "should return a header name / value pair" do serializer.split_header('header-name: some : value ').should == ['header-name', ' some : value '] end end end end
{ "content_hash": "38bd293cb727a5b244ad925a83c71b5c", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 133, "avg_line_length": 38.51020408163265, "alnum_prop": 0.62586115527292, "repo_name": "beni55/onstomp", "id": "f8da4b9aa63cd00fb07580b183970a163c35f0f3", "size": "1913", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "spec/onstomp/connections/serializers/stomp_1_0_spec.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "878" }, { "name": "Ruby", "bytes": "336175" } ], "symlink_target": null }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>lesniewski-mereology: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.12.2 / lesniewski-mereology - 8.8.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> lesniewski-mereology <small> 8.8.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-10-23 21:58:20 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-23 21:58:20 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.12.2 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.05.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.05.0 Official 4.05.0 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.5 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/lesniewski-mereology&quot; license: &quot;LGPL&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/LesniewskiMereology&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.8&quot; &amp; &lt; &quot;8.9~&quot;} ] tags: [ &quot;keyword: mereology&quot; &quot;keyword: protothetic&quot; &quot;keyword: ontology&quot; &quot;keyword: nominalist theory&quot; &quot;keyword: extensionality&quot; &quot;category: Mathematics/Logic/Foundations&quot; ] authors: [ &quot;Richard Dapoigny &lt;richard.dapoigny@univ-savoie.fr&gt; [https://www.researchgate.net/profile/Richard_Dapoigny]&quot; &quot;Patrick Barlatier &lt;patrick.barlatier@univ-savoie.fr&gt; [https://www.researchgate.net/profile/Patrick_Barlatier]&quot; ] bug-reports: &quot;https://github.com/coq-contribs/lesniewski-mereology/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/lesniewski-mereology.git&quot; synopsis: &quot;Knowledge-based Dependently Typed Language (KDTL)&quot; description: &quot;&quot;&quot; http://www.polytech.univ-savoie.fr/index.php?id=listic-logiciels-coq&amp;L=1 LesniewskiMereology is a Coq library created by R. Dapoigny and P. Barlatier whose purpose is to implement the alternative to Set Theory of Stanislaw Lesniewski. It is part of an on-going project using the Coq language and called KDTL (Knowledge-based Dependently Typed Language) to build an alternative to Description Logics. The developed theory is close to the analysis of Denis Mieville (1984) in his book &quot;Un developpement des systemes logiques de Stanislaw Lesniewski&quot;. It is a theoretical construct which relies on three dependent levels, logic (a.k.a. Protothetic), the Lesniewski Ontologie (LO) and mereology. Each level incorporates a minimal collection of axioms, protothetic and ontologic definitions and a set of theorems together with their intuitionist proofs.&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/lesniewski-mereology/archive/v8.8.0.tar.gz&quot; checksum: &quot;md5=24ca05ae88c1a992e3191ad0558f6e62&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-lesniewski-mereology.8.8.0 coq.8.12.2</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.12.2). The following dependencies couldn&#39;t be met: - coq-lesniewski-mereology -&gt; coq &lt; 8.9~ -&gt; ocaml &lt; 4.03.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-lesniewski-mereology.8.8.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "17e4beab298d63a929e99fc57ca49307", "timestamp": "", "source": "github", "line_count": 166, "max_line_length": 803, "avg_line_length": 48.56024096385542, "alnum_prop": 0.5835504279866022, "repo_name": "coq-bench/coq-bench.github.io", "id": "3af683e49941826189d73a90ed9874a7c8e22fce", "size": "8086", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.05.0-2.0.1/released/8.12.2/lesniewski-mereology/8.8.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": null }
Options options; Profile profile; Sockets sockets; #endif // __IALDOR_GLOBALS_H__
{ "content_hash": "18f27b34022cca1498254e5f3b93e984", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 30, "avg_line_length": 16.6, "alnum_prop": 0.7349397590361446, "repo_name": "mattpap/IAldor", "id": "45cd3a3462b61c68eb8ae6b93b1e4178bf099e44", "size": "206", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/globals.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "69526" } ], "symlink_target": null }
<!DOCTYPE animal [ <!ELEMENT animal ANY> <?ฯ an illegal char #x0e2f in PITarget ?> ]> <animal/>
{ "content_hash": "09616a63d16ac42eb802e488acc1fa4f", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 26, "avg_line_length": 17.166666666666668, "alnum_prop": 0.6213592233009708, "repo_name": "FranklinChen/hugs98-plus-Sep2006", "id": "5ce20ec658d0820b507dd9bfa1f30b3c4b32f4be", "size": "105", "binary": false, "copies": "16", "ref": "refs/heads/master", "path": "packages/HaXml/tests/xml-conformance/ibm/not-wf/P85/ibm85n120.xml", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "AMPL", "bytes": "4371" }, { "name": "Batchfile", "bytes": "7319" }, { "name": "C", "bytes": "2196193" }, { "name": "C#", "bytes": "35267" }, { "name": "C++", "bytes": "276328" }, { "name": "CSS", "bytes": "8051" }, { "name": "GDB", "bytes": "67" }, { "name": "Groff", "bytes": "7777" }, { "name": "HTML", "bytes": "2987334" }, { "name": "Haskell", "bytes": "7363914" }, { "name": "LilyPond", "bytes": "22441" }, { "name": "M", "bytes": "1151" }, { "name": "M4", "bytes": "81267" }, { "name": "Makefile", "bytes": "235831" }, { "name": "NSIS", "bytes": "8221" }, { "name": "Objective-C", "bytes": "1427" }, { "name": "R", "bytes": "40181" }, { "name": "Shell", "bytes": "111759" }, { "name": "TeX", "bytes": "148785" }, { "name": "Web Ontology Language", "bytes": "3511" }, { "name": "XQuery", "bytes": "19265" }, { "name": "XSLT", "bytes": "26542" }, { "name": "Yacc", "bytes": "41267" } ], "symlink_target": null }
import { delimiter } from '../modules/core/regex.js' import { radians } from '../utils/utils.js' import { register } from '../utils/adopter.js' import Element from '../elements/Element.js' import Point from './Point.js' function closeEnough (a, b, threshold) { return Math.abs(b - a) < (threshold || 1e-6) } export default class Matrix { constructor (...args) { this.init(...args) } static formatTransforms (o) { // Get all of the parameters required to form the matrix const flipBoth = o.flip === 'both' || o.flip === true const flipX = o.flip && (flipBoth || o.flip === 'x') ? -1 : 1 const flipY = o.flip && (flipBoth || o.flip === 'y') ? -1 : 1 const skewX = o.skew && o.skew.length ? o.skew[0] : isFinite(o.skew) ? o.skew : isFinite(o.skewX) ? o.skewX : 0 const skewY = o.skew && o.skew.length ? o.skew[1] : isFinite(o.skew) ? o.skew : isFinite(o.skewY) ? o.skewY : 0 const scaleX = o.scale && o.scale.length ? o.scale[0] * flipX : isFinite(o.scale) ? o.scale * flipX : isFinite(o.scaleX) ? o.scaleX * flipX : flipX const scaleY = o.scale && o.scale.length ? o.scale[1] * flipY : isFinite(o.scale) ? o.scale * flipY : isFinite(o.scaleY) ? o.scaleY * flipY : flipY const shear = o.shear || 0 const theta = o.rotate || o.theta || 0 const origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY) const ox = origin.x const oy = origin.y // We need Point to be invalid if nothing was passed because we cannot default to 0 here. Thats why NaN const position = new Point(o.position || o.px || o.positionX || NaN, o.py || o.positionY || NaN) const px = position.x const py = position.y const translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY) const tx = translate.x const ty = translate.y const relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY) const rx = relative.x const ry = relative.y // Populate all of the values return { scaleX, scaleY, skewX, skewY, shear, theta, rx, ry, tx, ty, ox, oy, px, py } } static fromArray (a) { return { a: a[0], b: a[1], c: a[2], d: a[3], e: a[4], f: a[5] } } static isMatrixLike (o) { return ( o.a != null || o.b != null || o.c != null || o.d != null || o.e != null || o.f != null ) } // left matrix, right matrix, target matrix which is overwritten static matrixMultiply (l, r, o) { // Work out the product directly const a = l.a * r.a + l.c * r.b const b = l.b * r.a + l.d * r.b const c = l.a * r.c + l.c * r.d const d = l.b * r.c + l.d * r.d const e = l.e + l.a * r.e + l.c * r.f const f = l.f + l.b * r.e + l.d * r.f // make sure to use local variables because l/r and o could be the same o.a = a o.b = b o.c = c o.d = d o.e = e o.f = f return o } around (cx, cy, matrix) { return this.clone().aroundO(cx, cy, matrix) } // Transform around a center point aroundO (cx, cy, matrix) { const dx = cx || 0 const dy = cy || 0 return this.translateO(-dx, -dy).lmultiplyO(matrix).translateO(dx, dy) } // Clones this matrix clone () { return new Matrix(this) } // Decomposes this matrix into its affine parameters decompose (cx = 0, cy = 0) { // Get the parameters from the matrix const a = this.a const b = this.b const c = this.c const d = this.d const e = this.e const f = this.f // Figure out if the winding direction is clockwise or counterclockwise const determinant = a * d - b * c const ccw = determinant > 0 ? 1 : -1 // Since we only shear in x, we can use the x basis to get the x scale // and the rotation of the resulting matrix const sx = ccw * Math.sqrt(a * a + b * b) const thetaRad = Math.atan2(ccw * b, ccw * a) const theta = 180 / Math.PI * thetaRad const ct = Math.cos(thetaRad) const st = Math.sin(thetaRad) // We can then solve the y basis vector simultaneously to get the other // two affine parameters directly from these parameters const lam = (a * c + b * d) / determinant const sy = ((c * sx) / (lam * a - b)) || ((d * sx) / (lam * b + a)) // Use the translations const tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy) const ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy) // Construct the decomposition and return it return { // Return the affine parameters scaleX: sx, scaleY: sy, shear: lam, rotate: theta, translateX: tx, translateY: ty, originX: cx, originY: cy, // Return the matrix parameters a: this.a, b: this.b, c: this.c, d: this.d, e: this.e, f: this.f } } // Check if two matrices are equal equals (other) { if (other === this) return true const comp = new Matrix(other) return closeEnough(this.a, comp.a) && closeEnough(this.b, comp.b) && closeEnough(this.c, comp.c) && closeEnough(this.d, comp.d) && closeEnough(this.e, comp.e) && closeEnough(this.f, comp.f) } // Flip matrix on x or y, at a given offset flip (axis, around) { return this.clone().flipO(axis, around) } flipO (axis, around) { return axis === 'x' ? this.scaleO(-1, 1, around, 0) : axis === 'y' ? this.scaleO(1, -1, 0, around) : this.scaleO(-1, -1, axis, around || axis) // Define an x, y flip point } // Initialize init (source) { const base = Matrix.fromArray([ 1, 0, 0, 1, 0, 0 ]) // ensure source as object source = source instanceof Element ? source.matrixify() : typeof source === 'string' ? Matrix.fromArray(source.split(delimiter).map(parseFloat)) : Array.isArray(source) ? Matrix.fromArray(source) : (typeof source === 'object' && Matrix.isMatrixLike(source)) ? source : (typeof source === 'object') ? new Matrix().transform(source) : arguments.length === 6 ? Matrix.fromArray([].slice.call(arguments)) : base // Merge the source matrix with the base matrix this.a = source.a != null ? source.a : base.a this.b = source.b != null ? source.b : base.b this.c = source.c != null ? source.c : base.c this.d = source.d != null ? source.d : base.d this.e = source.e != null ? source.e : base.e this.f = source.f != null ? source.f : base.f return this } inverse () { return this.clone().inverseO() } // Inverses matrix inverseO () { // Get the current parameters out of the matrix const a = this.a const b = this.b const c = this.c const d = this.d const e = this.e const f = this.f // Invert the 2x2 matrix in the top left const det = a * d - b * c if (!det) throw new Error('Cannot invert ' + this) // Calculate the top 2x2 matrix const na = d / det const nb = -b / det const nc = -c / det const nd = a / det // Apply the inverted matrix to the top right const ne = -(na * e + nc * f) const nf = -(nb * e + nd * f) // Construct the inverted matrix this.a = na this.b = nb this.c = nc this.d = nd this.e = ne this.f = nf return this } lmultiply (matrix) { return this.clone().lmultiplyO(matrix) } lmultiplyO (matrix) { const r = this const l = matrix instanceof Matrix ? matrix : new Matrix(matrix) return Matrix.matrixMultiply(l, r, this) } // Left multiplies by the given matrix multiply (matrix) { return this.clone().multiplyO(matrix) } multiplyO (matrix) { // Get the matrices const l = this const r = matrix instanceof Matrix ? matrix : new Matrix(matrix) return Matrix.matrixMultiply(l, r, this) } // Rotate matrix rotate (r, cx, cy) { return this.clone().rotateO(r, cx, cy) } rotateO (r, cx = 0, cy = 0) { // Convert degrees to radians r = radians(r) const cos = Math.cos(r) const sin = Math.sin(r) const { a, b, c, d, e, f } = this this.a = a * cos - b * sin this.b = b * cos + a * sin this.c = c * cos - d * sin this.d = d * cos + c * sin this.e = e * cos - f * sin + cy * sin - cx * cos + cx this.f = f * cos + e * sin - cx * sin - cy * cos + cy return this } // Scale matrix scale (x, y, cx, cy) { return this.clone().scaleO(...arguments) } scaleO (x, y = x, cx = 0, cy = 0) { // Support uniform scaling if (arguments.length === 3) { cy = cx cx = y y = x } const { a, b, c, d, e, f } = this this.a = a * x this.b = b * y this.c = c * x this.d = d * y this.e = e * x - cx * x + cx this.f = f * y - cy * y + cy return this } // Shear matrix shear (a, cx, cy) { return this.clone().shearO(a, cx, cy) } shearO (lx, cx = 0, cy = 0) { const { a, b, c, d, e, f } = this this.a = a + b * lx this.c = c + d * lx this.e = e + f * lx - cy * lx return this } // Skew Matrix skew (x, y, cx, cy) { return this.clone().skewO(...arguments) } skewO (x, y = x, cx = 0, cy = 0) { // support uniformal skew if (arguments.length === 3) { cy = cx cx = y y = x } // Convert degrees to radians x = radians(x) y = radians(y) const lx = Math.tan(x) const ly = Math.tan(y) const { a, b, c, d, e, f } = this this.a = a + b * lx this.b = b + a * ly this.c = c + d * lx this.d = d + c * ly this.e = e + f * lx - cy * lx this.f = f + e * ly - cx * ly return this } // SkewX skewX (x, cx, cy) { return this.skew(x, 0, cx, cy) } // SkewY skewY (y, cx, cy) { return this.skew(0, y, cx, cy) } toArray () { return [ this.a, this.b, this.c, this.d, this.e, this.f ] } // Convert matrix to string toString () { return 'matrix(' + this.a + ',' + this.b + ',' + this.c + ',' + this.d + ',' + this.e + ',' + this.f + ')' } // Transform a matrix into another matrix by manipulating the space transform (o) { // Check if o is a matrix and then left multiply it directly if (Matrix.isMatrixLike(o)) { const matrix = new Matrix(o) return matrix.multiplyO(this) } // Get the proposed transformations and the current transformations const t = Matrix.formatTransforms(o) const current = this const { x: ox, y: oy } = new Point(t.ox, t.oy).transform(current) // Construct the resulting matrix const transformer = new Matrix() .translateO(t.rx, t.ry) .lmultiplyO(current) .translateO(-ox, -oy) .scaleO(t.scaleX, t.scaleY) .skewO(t.skewX, t.skewY) .shearO(t.shear) .rotateO(t.theta) .translateO(ox, oy) // If we want the origin at a particular place, we force it there if (isFinite(t.px) || isFinite(t.py)) { const origin = new Point(ox, oy).transform(transformer) // TODO: Replace t.px with isFinite(t.px) // Doesnt work because t.px is also 0 if it wasnt passed const dx = isFinite(t.px) ? t.px - origin.x : 0 const dy = isFinite(t.py) ? t.py - origin.y : 0 transformer.translateO(dx, dy) } // Translate now after positioning transformer.translateO(t.tx, t.ty) return transformer } // Translate matrix translate (x, y) { return this.clone().translateO(x, y) } translateO (x, y) { this.e += x || 0 this.f += y || 0 return this } valueOf () { return { a: this.a, b: this.b, c: this.c, d: this.d, e: this.e, f: this.f } } } export function ctm () { return new Matrix(this.node.getCTM()) } export function screenCTM () { /* https://bugzilla.mozilla.org/show_bug.cgi?id=1344537 This is needed because FF does not return the transformation matrix for the inner coordinate system when getScreenCTM() is called on nested svgs. However all other Browsers do that */ if (typeof this.isRoot === 'function' && !this.isRoot()) { const rect = this.rect(1, 1) const m = rect.node.getScreenCTM() rect.remove() return new Matrix(m) } return new Matrix(this.node.getScreenCTM()) } register(Matrix, 'Matrix')
{ "content_hash": "767ac5b4d93047fb66e65843b887cbbc", "timestamp": "", "source": "github", "line_count": 491, "max_line_length": 110, "avg_line_length": 25.64562118126273, "alnum_prop": 0.5524142312579415, "repo_name": "wout/svg.js", "id": "406cb84ebb25eff43d2afb9a64a1bfb65cdd3264", "size": "12592", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/types/Matrix.js", "mode": "33188", "license": "mit", "language": [], "symlink_target": null }
/* Define to prevent recursive inclusion -------------------------------------*/ #ifndef STM32L4xx_HAL_RTC_EX_H #define STM32L4xx_HAL_RTC_EX_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32l4xx_hal_def.h" /** @addtogroup STM32L4xx_HAL_Driver * @{ */ /** @defgroup RTCEx RTCEx * @{ */ /* Exported types ------------------------------------------------------------*/ /** @defgroup RTCEx_Exported_Types RTCEx Exported Types * @{ */ /** @defgroup RTCEx_Tamper_structure_definition RTCEx Tamper structure definition * @{ */ typedef struct { uint32_t Tamper; /*!< Specifies the Tamper Pin. This parameter can be a value of @ref RTCEx_Tamper_Pins_Definitions */ uint32_t Interrupt; /*!< Specifies the Tamper Interrupt. This parameter can be a value of @ref RTCEx_Tamper_Interrupt_Definitions */ uint32_t Trigger; /*!< Specifies the Tamper Trigger. This parameter can be a value of @ref RTCEx_Tamper_Trigger_Definitions */ uint32_t NoErase; /*!< Specifies the Tamper no erase mode. This parameter can be a value of @ref RTCEx_Tamper_EraseBackUp_Definitions */ uint32_t MaskFlag; /*!< Specifies the Tamper Flag masking. This parameter can be a value of @ref RTCEx_Tamper_MaskFlag_Definitions */ uint32_t Filter; /*!< Specifies the TAMP Filter Tamper. This parameter can be a value of @ref RTCEx_Tamper_Filter_Definitions */ uint32_t SamplingFrequency; /*!< Specifies the sampling frequency. This parameter can be a value of @ref RTCEx_Tamper_Sampling_Frequencies_Definitions */ uint32_t PrechargeDuration; /*!< Specifies the Precharge Duration . This parameter can be a value of @ref RTCEx_Tamper_Pin_Precharge_Duration_Definitions */ uint32_t TamperPullUp; /*!< Specifies the Tamper PullUp . This parameter can be a value of @ref RTCEx_Tamper_Pull_UP_Definitions */ uint32_t TimeStampOnTamperDetection; /*!< Specifies the TimeStampOnTamperDetection. This parameter can be a value of @ref RTCEx_Tamper_TimeStampOnTamperDetection_Definitions */ } RTC_TamperTypeDef; /** * @} */ /** * @} */ /* Exported constants --------------------------------------------------------*/ /** @defgroup RTCEx_Exported_Constants RTCEx Exported Constants * @{ */ /* ========================================================================== */ /* ##### RTC TimeStamp exported constants ##### */ /* ========================================================================== */ /** @defgroup RTCEx_Time_Stamp_Edges_definitions RTCEx Time Stamp Edges Definitions * * @{ */ #define RTC_TIMESTAMPEDGE_RISING 0x00000000u #define RTC_TIMESTAMPEDGE_FALLING RTC_CR_TSEDGE /** * @} */ /** @defgroup RTCEx_TimeStamp_Pin_Selection RTCEx TimeStamp Pin Selection * @{ */ #define RTC_TIMESTAMPPIN_DEFAULT 0x00000000u /** * @} */ /* ========================================================================== */ /* ##### RTC Wake-up exported constants ##### */ /* ========================================================================== */ /** @defgroup RTCEx_Wakeup_Timer_Definitions RTCEx Wakeup Timer Definitions * @{ */ #define RTC_WAKEUPCLOCK_RTCCLK_DIV16 0x00000000u #define RTC_WAKEUPCLOCK_RTCCLK_DIV8 RTC_CR_WUCKSEL_0 #define RTC_WAKEUPCLOCK_RTCCLK_DIV4 RTC_CR_WUCKSEL_1 #define RTC_WAKEUPCLOCK_RTCCLK_DIV2 (RTC_CR_WUCKSEL_0 | RTC_CR_WUCKSEL_1) #define RTC_WAKEUPCLOCK_CK_SPRE_16BITS RTC_CR_WUCKSEL_2 #define RTC_WAKEUPCLOCK_CK_SPRE_17BITS (RTC_CR_WUCKSEL_1 | RTC_CR_WUCKSEL_2) /** * @} */ /* ========================================================================== */ /* ##### Extended RTC Peripheral Control exported constants ##### */ /* ========================================================================== */ /** @defgroup RTCEx_Smooth_calib_period_Definitions RTCEx Smooth Calib Period Definitions * @{ */ #define RTC_SMOOTHCALIB_PERIOD_32SEC 0x00000000u /*!< If RTCCLK = 32768 Hz, Smooth calibration period is 32s, else 2exp20 RTCCLK pulses */ #define RTC_SMOOTHCALIB_PERIOD_16SEC RTC_CALR_CALW16 /*!< If RTCCLK = 32768 Hz, Smooth calibration period is 16s, else 2exp19 RTCCLK pulses */ #define RTC_SMOOTHCALIB_PERIOD_8SEC RTC_CALR_CALW8 /*!< If RTCCLK = 32768 Hz, Smooth calibration period is 8s, else 2exp18 RTCCLK pulses */ /** * @} */ /** @defgroup RTCEx_Smooth_calib_Plus_pulses_Definitions RTCEx Smooth calib Plus pulses Definitions * @{ */ #define RTC_SMOOTHCALIB_PLUSPULSES_SET RTC_CALR_CALP /*!< The number of RTCCLK pulses added during a X -second window = Y - CALM[8:0] with Y = 512, 256, 128 when X = 32, 16, 8 */ #define RTC_SMOOTHCALIB_PLUSPULSES_RESET 0x00000000u /*!< The number of RTCCLK pulses subbstited during a 32-second window = CALM[8:0] */ /** * @} */ #if defined(STM32L412xx) || defined(STM32L422xx) /** @defgroup RTCEx_Smooth_Calib_Low_Power_Definitions RTCEx Smooth Calib Low Power Definitions * @{ */ #define RTC_LPCAL_SET RTC_CALR_LPCAL /*!< Calibration window is 220 ck_apre, which is the required configuration for ultra-low consumption mode. */ #define RTC_LPCAL_RESET 0x00000000u /*!< Calibration window is 220 RTCCLK, which is a high-consumption mode. This mode should be set only when less than 32s calibration window is required. */ /** * @} */ #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) */ /** @defgroup RTCEx_Calib_Output_selection_Definitions RTCEx Calib Output Selection Definitions * @{ */ #define RTC_CALIBOUTPUT_512HZ 0x00000000u #define RTC_CALIBOUTPUT_1HZ RTC_CR_COSEL /** * @} */ /** @defgroup RTCEx_Add_1_Second_Parameter_Definitions RTC Add 1 Second Parameter Definitions * @{ */ #define RTC_SHIFTADD1S_RESET 0x00000000u #define RTC_SHIFTADD1S_SET RTC_SHIFTR_ADD1S /** * @} */ /* ========================================================================== */ /* ##### RTC Tamper exported constants ##### */ /* ========================================================================== */ /** @defgroup RTCEx_Tamper_Pins_Definitions RTCEx Tamper Pins Definitions * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) #if defined(RTC_TAMPER1_SUPPORT) #define RTC_TAMPER_1 TAMP_CR1_TAMP1E #endif /* RTC_TAMPER1_SUPPORT */ #define RTC_TAMPER_2 TAMP_CR1_TAMP2E #if defined(RTC_TAMPER3_SUPPORT) #define RTC_TAMPER_3 TAMP_CR1_TAMP3E #endif /* RTC_TAMPER3_SUPPORT */ #define RTC_TAMPER_ALL (TAMP_CR1_TAMP1E | TAMP_CR1_TAMP2E) #else /* #if defined(STM32L412xx) || defined(STM32L422xx) */ #if defined(RTC_TAMPER1_SUPPORT) #define RTC_TAMPER_1 RTC_TAMPCR_TAMP1E #endif /* RTC_TAMPER1_SUPPORT */ #define RTC_TAMPER_2 RTC_TAMPCR_TAMP2E #if defined(RTC_TAMPER3_SUPPORT) #define RTC_TAMPER_3 RTC_TAMPCR_TAMP3E #endif /* RTC_TAMPER3_SUPPORT */ #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) */ /** * @} */ /** @defgroup RTCEx_Tamper_Trigger_Definitions RTCEx Tamper Triggers Definitions * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) #define RTC_TAMPERTRIGGER_RISINGEDGE 0x00u /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */ #define RTC_TAMPERTRIGGER_FALLINGEDGE 0x01u /*!< Warning : Filter must be RTC_TAMPERFILTER_DISABLE */ #define RTC_TAMPERTRIGGER_LOWLEVEL 0x02u /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */ #define RTC_TAMPERTRIGGER_HIGHLEVEL 0x03u /*!< Warning : Filter must not be RTC_TAMPERFILTER_DISABLE */ #else #define RTC_TAMPERTRIGGER_RISINGEDGE ((uint32_t)0x00000000) #define RTC_TAMPERTRIGGER_FALLINGEDGE ((uint32_t)0x00000002) #define RTC_TAMPERTRIGGER_LOWLEVEL RTC_TAMPERTRIGGER_RISINGEDGE #define RTC_TAMPERTRIGGER_HIGHLEVEL RTC_TAMPERTRIGGER_FALLINGEDGE #endif /** * @} */ /** @defgroup RTCEx_Tamper_MaskFlag_Definitions RTCEx Tamper Mask Flag Definitions * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) #define RTC_TAMPERMASK_FLAG_DISABLE 0x00u #define RTC_TAMPERMASK_FLAG_ENABLE 0x01u #else #define RTC_TAMPERMASK_FLAG_DISABLE 0x00000000u #define RTC_TAMPERMASK_FLAG_ENABLE 0x00040000u #endif /** * @} */ /** @defgroup RTCEx_Tamper_EraseBackUp_Definitions RTCEx Tamper EraseBackUp Definitions * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) #define RTC_TAMPER_ERASE_BACKUP_ENABLE 0x00u #define RTC_TAMPER_ERASE_BACKUP_DISABLE 0x01u #else #define RTC_TAMPER_ERASE_BACKUP_ENABLE 0x00000000u #define RTC_TAMPER_ERASE_BACKUP_DISABLE 0x00020000u #endif /** * @} */ /** @defgroup RTCEx_Tamper_Filter_Definitions RTCEx Tamper Filter Definitions * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) #define RTC_TAMPERFILTER_DISABLE 0x00000000U /*!< Tamper filter is disabled */ #define RTC_TAMPERFILTER_2SAMPLE TAMP_FLTCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */ #define RTC_TAMPERFILTER_4SAMPLE TAMP_FLTCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */ #define RTC_TAMPERFILTER_8SAMPLE TAMP_FLTCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level */ #else /* #if defined(STM32L412xx) || defined(STM32L422xx) */ #define RTC_TAMPERFILTER_DISABLE 0x00000000u /*!< Tamper filter is disabled */ #define RTC_TAMPERFILTER_2SAMPLE RTC_TAMPCR_TAMPFLT_0 /*!< Tamper is activated after 2 consecutive samples at the active level */ #define RTC_TAMPERFILTER_4SAMPLE RTC_TAMPCR_TAMPFLT_1 /*!< Tamper is activated after 4 consecutive samples at the active level */ #define RTC_TAMPERFILTER_8SAMPLE RTC_TAMPCR_TAMPFLT /*!< Tamper is activated after 8 consecutive samples at the active level. */ #endif /*#if defined(STM32L412xx) || defined(STM32L422xx) */ /** * @} */ /** @defgroup RTCEx_Tamper_Sampling_Frequencies_Definitions RTCEx Tamper Sampling Frequencies Definitions * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 0x00000000U /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 TAMP_FLTCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 TAMP_FLTCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 4096 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 TAMP_FLTCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 (TAMP_FLTCR_TAMPFREQ_0 | TAMP_FLTCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 1024 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 (TAMP_FLTCR_TAMPFREQ_1 | TAMP_FLTCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 512 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 TAMP_FLTCR_TAMPFREQ /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_MASK TAMP_FLTCR_TAMPFREQ /*!< Masking all bits except those of field TAMPFREQ[2:0]*/ #else /* #if defined(STM32L412xx) || defined(STM32L422xx) */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768 0x00000000u /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 32768 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384 RTC_TAMPCR_TAMPFREQ_0 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 16384 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192 RTC_TAMPCR_TAMPFREQ_1 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 8192 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096 (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_1) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 4096 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048 RTC_TAMPCR_TAMPFREQ_2 /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 2048 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024 (RTC_TAMPCR_TAMPFREQ_0 | RTC_TAMPCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 1024 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512 (RTC_TAMPCR_TAMPFREQ_1 | RTC_TAMPCR_TAMPFREQ_2) /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 512 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 RTC_TAMPCR_TAMPFREQ /*!< Each of the tamper inputs are sampled with a frequency = RTCCLK / 256 */ #define RTC_TAMPERSAMPLINGFREQ_RTCCLK_MASK RTC_TAMPCR_TAMPFREQ /*!< Masking all bits except those of field TAMPFREQ[2:0]*/ #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) */ /** * @} */ /** @defgroup RTCEx_Tamper_Pin_Precharge_Duration_Definitions RTCEx Tamper Pin Precharge Duration Definitions * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK 0x00000000U /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */ #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK TAMP_FLTCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */ #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK TAMP_FLTCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */ #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK TAMP_FLTCR_TAMPPRCH /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */ #else /* #if defined(STM32L412xx) || defined(STM32L422xx) */ #define RTC_TAMPERPRECHARGEDURATION_1RTCCLK 0x00000000u /*!< Tamper pins are pre-charged before sampling during 1 RTCCLK cycle */ #define RTC_TAMPERPRECHARGEDURATION_2RTCCLK RTC_TAMPCR_TAMPPRCH_0 /*!< Tamper pins are pre-charged before sampling during 2 RTCCLK cycles */ #define RTC_TAMPERPRECHARGEDURATION_4RTCCLK RTC_TAMPCR_TAMPPRCH_1 /*!< Tamper pins are pre-charged before sampling during 4 RTCCLK cycles */ #define RTC_TAMPERPRECHARGEDURATION_8RTCCLK RTC_TAMPCR_TAMPPRCH /*!< Tamper pins are pre-charged before sampling during 8 RTCCLK cycles */ #define RTC_TAMPERPRECHARGEDURATION_MASK RTC_TAMPCR_TAMPPRCH /*!< Masking all bits except those of field TAMPPRCH[1:0] */ #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) */ /** * @} */ /** @defgroup RTCEx_Tamper_Pull_UP_Definitions RTCEx Tamper Pull Up Definitions * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) #define RTC_TAMPER_PULLUP_ENABLE 0x00000000u /*!< Tamper pins are pre-charged before sampling */ #define RTC_TAMPER_PULLUP_DISABLE TAMP_FLTCR_TAMPPUDIS /*!< Tamper pins pre-charge is disabled */ #else #define RTC_TAMPER_PULLUP_ENABLE 0x00000000u /*!< TimeStamp on Tamper Detection event saved */ #define RTC_TAMPER_PULLUP_DISABLE RTC_TAMPCR_TAMPPUDIS /*!< TimeStamp on Tamper Detection event is not saved */ #endif /** * @} */ /** @defgroup RTCEx_Tamper_TimeStampOnTamperDetection_Definitions RTCEx Tamper TimeStamp On Tamper Detection Definitions * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE 0x00000000u /*!< TimeStamp on Tamper Detection event is not saved */ #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE RTC_CR_TAMPTS /*!< TimeStamp on Tamper Detection event saved */ #else #define RTC_TIMESTAMPONTAMPERDETECTION_DISABLE 0x00000000u /*!< TimeStamp on Tamper Detection event is not saved */ #define RTC_TIMESTAMPONTAMPERDETECTION_ENABLE RTC_TAMPCR_TAMPTS /*!< TimeStamp on Tamper Detection event saved */ #endif /** * @} */ /** @defgroup RTCEx_Tamper_Interrupt_Definitions RTC Tamper Interrupts Definitions * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) #define RTC_IT_TAMP (TAMP_IER_TAMP1IE | TAMP_IER_TAMP2IE) /*!< Enable all Tamper Interrupt */ #define RTC_IT_TAMP1 TAMP_IER_TAMP1IE /*!< Tamper 1 Interrupt */ #define RTC_IT_TAMP2 TAMP_IER_TAMP2IE /*!< Tamper 2 Interrupt */ #define RTC_IT_TAMPALL RTC_IT_TAMP #else /* #if defined(STM32L412xx) || defined(STM32L422xx) */ #define RTC_IT_TAMP RTC_TAMPCR_TAMPIE /*!< Enable all Tamper Interrupt */ #define RTC_IT_TAMP1 RTC_TAMPCR_TAMP1IE /*!< Enable Tamper 1 Interrupt */ #define RTC_IT_TAMP2 RTC_TAMPCR_TAMP2IE /*!< Enable Tamper 2 Interrupt */ #define RTC_IT_TAMP3 RTC_TAMPCR_TAMP3IE /*!< Enable Tamper 3 Interrupt */ #define RTC_IT_TAMPALL RTC_IT_TAMP #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) */ /** * @} */ /** @defgroup RTCEx_Flags RTCEx Flags * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) #define RTC_FLAG_TAMP1F TAMP_SR_TAMP1F #define RTC_FLAG_TAMP2F TAMP_SR_TAMP2F #define RTC_FLAG_TAMPALL (RTC_FLAG_TAMP1F | RTC_FLAG_TAMP2F) #else /* #if defined(STM32L412xx) || defined(STM32L422xx) */ #define RTC_FLAG_TAMP1F RTC_ISR_TAMP1F #define RTC_FLAG_TAMP2F RTC_ISR_TAMP2F #define RTC_FLAG_TAMP3F RTC_ISR_TAMP3F #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) */ /** * @} */ /* ========================================================================== */ /* ##### Extended RTC Backup registers exported constants ##### */ /* ========================================================================== */ /** @defgroup RTCEx_Backup_Data_Registers_Number_Definitions RTC Backup Data Registers Number Definitions * @{ */ #if defined(RTC_BKP_NUMBER) #define BKP_REG_NUMBER RTC_BKP_NUMBER #endif /* RTC_BKP_NUMBER */ #if defined(TAMP_BKP_NUMBER) #define BKP_REG_NUMBER TAMP_BKP_NUMBER #endif /* TAMP_BKP_NUMBER */ /** * @} */ /** @defgroup RTCEx_Backup_Data_Registers_Definitions RTCEx Backup Data Registers Definitions * @{ */ #define RTC_BKP_DR0 0x00u #define RTC_BKP_DR1 0x01u #define RTC_BKP_DR2 0x02u #define RTC_BKP_DR3 0x03u #define RTC_BKP_DR4 0x04u #define RTC_BKP_DR5 0x05u #define RTC_BKP_DR6 0x06u #define RTC_BKP_DR7 0x07u #define RTC_BKP_DR8 0x08u #define RTC_BKP_DR9 0x09u #define RTC_BKP_DR10 0x0Au #define RTC_BKP_DR11 0x0Bu #define RTC_BKP_DR12 0x0Cu #define RTC_BKP_DR13 0x0Du #define RTC_BKP_DR14 0x0Eu #define RTC_BKP_DR15 0x0Fu #define RTC_BKP_DR16 0x10u #define RTC_BKP_DR17 0x11u #define RTC_BKP_DR18 0x12u #define RTC_BKP_DR19 0x13u #define RTC_BKP_DR20 0x14u #define RTC_BKP_DR21 0x15u #define RTC_BKP_DR22 0x16u #define RTC_BKP_DR23 0x17u #define RTC_BKP_DR24 0x18u #define RTC_BKP_DR25 0x19u #define RTC_BKP_DR26 0x1Au #define RTC_BKP_DR27 0x1Bu #define RTC_BKP_DR28 0x1Cu #define RTC_BKP_DR29 0x1Du #define RTC_BKP_DR30 0x1Eu #define RTC_BKP_DR31 0x1Fu /** * @} */ /** @defgroup RTCEx_Tamper_Interrupt_Definitions RTC Tamper Interrupts Definitions * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) #define RTC_TAMPER1_INTERRUPT TAMP_IER_TAMP1IE #define RTC_TAMPER2_INTERRUPT TAMP_IER_TAMP2IE #else /* #if defined(STM32L412xx) || defined(STM32L422xx) */ #if defined(RTC_TAMPER1_SUPPORT) #define RTC_TAMPER1_INTERRUPT RTC_TAMPCR_TAMP1IE #endif /* RTC_TAMPER1_SUPPORT */ #define RTC_TAMPER2_INTERRUPT RTC_TAMPCR_TAMP2IE #if defined(RTC_TAMPER3_SUPPORT) #define RTC_TAMPER3_INTERRUPT RTC_TAMPCR_TAMP3IE #endif /* RTC_TAMPER3_SUPPORT */ #define RTC_ALL_TAMPER_INTERRUPT RTC_TAMPCR_TAMPIE #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) */ /** * @} */ /** * @} */ /* Exported macros -----------------------------------------------------------*/ /** @defgroup RTCEx_Exported_Macros RTCEx Exported Macros * @{ */ #if defined(STM32L412xx) || defined(STM32L422xx) /** @brief Clear the specified RTC pending flag. * @param __HANDLE__ specifies the RTC Handle. * @param __FLAG__ specifies the flag to check. * This parameter can be any combination of the following values: * @arg @ref RTC_CLEAR_ITSF Clear Internal Time-stamp flag * @arg @ref RTC_CLEAR_TSOVF Clear Time-stamp overflow flag * @arg @ref RTC_CLEAR_TSF Clear Time-stamp flag * @arg @ref RTC_CLEAR_WUTF Clear Wakeup timer flag * @arg @ref RTC_CLEAR_ALRBF Clear Alarm B flag * @arg @ref RTC_CLEAR_ALRAF Clear Alarm A flag * @retval None */ #define __HAL_RTC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SCR = (__FLAG__)) /** @brief Check whether the specified RTC flag is set or not. * @param __HANDLE__ specifies the RTC Handle. * @param __FLAG__ specifies the flag to check. * This parameter can be any combination of the following values: * @arg @ref RTC_FLAG_RECALPF Recalibration pending Flag * @arg @ref RTC_FLAG_INITF Initialization flag * @arg @ref RTC_FLAG_RSF Registers synchronization flag * @arg @ref RTC_FLAG_INITS Initialization status flag * @arg @ref RTC_FLAG_SHPF Shift operation pending flag * @arg @ref RTC_FLAG_WUTWF Wakeup timer write flag * @arg @ref RTC_FLAG_ALRBWF Alarm B write flag * @arg @ref RTC_FLAG_ALRAWF Alarm A write flag * @arg @ref RTC_FLAG_ITSF Internal Time-stamp flag * @arg @ref RTC_FLAG_TSOVF Time-stamp overflow flag * @arg @ref RTC_FLAG_TSF Time-stamp flag * @arg @ref RTC_FLAG_WUTF Wakeup timer flag * @arg @ref RTC_FLAG_ALRBF Alarm B flag * @arg @ref RTC_FLAG_ALRAF Alarm A flag * @retval None */ #define __HAL_RTC_GET_FLAG(__HANDLE__, __FLAG__) (((((__FLAG__)) >> 8U) == 1U) ? ((__HANDLE__)->Instance->ICSR & (1U << (((uint16_t)(__FLAG__)) & RTC_FLAG_MASK))) : \ ((__HANDLE__)->Instance->SR & (1U << (((uint16_t)(__FLAG__)) & RTC_FLAG_MASK)))) #endif /*#if defined(STM32L412xx) || defined(STM32L422xx) */ /* ---------------------------------WAKEUPTIMER---------------------------------*/ /** @defgroup RTCEx_WakeUp_Timer RTC WakeUp Timer * @{ */ /** * @brief Enable the RTC WakeUp Timer peripheral. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE)) /** * @brief Disable the RTC WakeUp Timer peripheral. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE)) /** * @brief Enable the RTC WakeUpTimer interrupt. * @param __HANDLE__ specifies the RTC handle. * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be enabled. * This parameter can be: * @arg @ref RTC_IT_WUT WakeUpTimer interrupt * @retval None */ #define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) /** * @brief Disable the RTC WakeUpTimer interrupt. * @param __HANDLE__ specifies the RTC handle. * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to be disabled. * This parameter can be: * @arg @ref RTC_IT_WUT WakeUpTimer interrupt * @retval None */ #define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) /** * @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not. * @param __HANDLE__ specifies the RTC handle. * @param __INTERRUPT__ specifies the RTC WakeUpTimer interrupt sources to check. * This parameter can be: * @arg @ref RTC_IT_WUT WakeUpTimer interrupt * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->MISR) & ((__INTERRUPT__) >> 12)) != 0U) ? 1U : 0U) #else #define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__) >> 4)) != 0U) ? 1U : 0U) #endif /** * @brief Check whether the specified RTC Wake Up timer interrupt has been enabled or not. * @param __HANDLE__ specifies the RTC handle. * @param __INTERRUPT__ specifies the RTC Wake Up timer interrupt sources to check. * This parameter can be: * @arg @ref RTC_IT_WUT WakeUpTimer interrupt * @retval None */ #define __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0U) ? 1U : 0U) /** * @brief Get the selected RTC WakeUpTimer's flag status. * @param __HANDLE__ specifies the RTC handle. * @param __FLAG__ specifies the RTC WakeUpTimer Flag is pending or not. * This parameter can be: * @arg @ref RTC_FLAG_WUTF * @arg @ref RTC_FLAG_WUTWF * @retval Flag status */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__), (__FLAG__))) #else #define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U) #endif /** * @brief Clear the RTC Wake Up timer's pending flags. * @param __HANDLE__ specifies the RTC handle. * @param __FLAG__ specifies the RTC WakeUpTimer Flag to clear. * This parameter can be: * @arg @ref RTC_FLAG_WUTF * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_CLEAR_FLAG((__HANDLE__), RTC_CLEAR_WUTF)) #else #define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) #endif /* WAKE-UP TIMER EXTI */ /* ------------------ */ /** * @brief Enable interrupt on the RTC WakeUp Timer associated Exti line. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) /** * @brief Disable interrupt on the RTC WakeUp Timer associated Exti line. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) /** * @brief Enable event on the RTC WakeUp Timer associated Exti line. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) /** * @brief Disable event on the RTC WakeUp Timer associated Exti line. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) /** * @brief Enable falling edge trigger on the RTC WakeUp Timer associated Exti line. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) /** * @brief Disable falling edge trigger on the RTC WakeUp Timer associated Exti line. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) /** * @brief Enable rising edge trigger on the RTC WakeUp Timer associated Exti line. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) /** * @brief Disable rising edge trigger on the RTC WakeUp Timer associated Exti line. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR1 &= ~(RTC_EXTI_LINE_WAKEUPTIMER_EVENT)) /** * @brief Enable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do { \ __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE(); \ __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE(); \ } while(0) /** * @brief Disable rising & falling edge trigger on the RTC WakeUp Timer associated Exti line. * This parameter can be: * @retval None */ #define __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do { \ __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE(); \ __HAL_RTC_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE(); \ } while(0) /** * @brief Check whether the RTC WakeUp Timer associated Exti line interrupt flag is set or not. * @retval Line Status. */ #define __HAL_RTC_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_WAKEUPTIMER_EVENT) /** * @brief Clear the RTC WakeUp Timer associated Exti line flag. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_WAKEUPTIMER_EVENT) /** * @brief Generate a Software interrupt on the RTC WakeUp Timer associated Exti line. * @retval None */ #define __HAL_RTC_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_WAKEUPTIMER_EVENT) /** * @} */ /* ---------------------------------TIMESTAMP---------------------------------*/ /** @defgroup RTCEx_Timestamp RTC Timestamp * @{ */ /** * @brief Enable the RTC TimeStamp peripheral. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE)) /** * @brief Disable the RTC TimeStamp peripheral. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TSE)) /** * @brief Enable the RTC TimeStamp interrupt. * @param __HANDLE__ specifies the RTC handle. * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be enabled. * This parameter can be: * @arg @ref RTC_IT_TS TimeStamp interrupt * @retval None */ #define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) /** * @brief Disable the RTC TimeStamp interrupt. * @param __HANDLE__ specifies the RTC handle. * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to be disabled. * This parameter can be: * @arg @ref RTC_IT_TS TimeStamp interrupt * @retval None */ #define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) /** * @brief Check whether the specified RTC TimeStamp interrupt has occurred or not. * @param __HANDLE__ specifies the RTC handle. * @param __INTERRUPT__ specifies the RTC TimeStamp interrupt source to check. * This parameter can be: * @arg @ref RTC_IT_TS TimeStamp interrupt * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->MISR) & ((__INTERRUPT__) >> 12)) != 0U) ? 1U : 0U) #else #define __HAL_RTC_TIMESTAMP_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & ((__INTERRUPT__) >> 4)) != 0U) ? 1U : 0U) #endif /** * @brief Check whether the specified RTC Time Stamp interrupt has been enabled or not. * @param __HANDLE__ specifies the RTC handle. * @param __INTERRUPT__ specifies the RTC Time Stamp interrupt source to check. * This parameter can be: * @arg @ref RTC_IT_TS TimeStamp interrupt * @retval None */ #define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != 0U) ? 1U : 0U) /** * @brief Get the selected RTC TimeStamp's flag status. * @param __HANDLE__ specifies the RTC handle. * @param __FLAG__ specifies the RTC TimeStamp Flag is pending or not. * This parameter can be: * @arg @ref RTC_FLAG_TSF * @arg @ref RTC_FLAG_TSOVF * @retval Flag status */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__),(__FLAG__))) #else #define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U) #endif /** * @brief Clear the RTC Time Stamp's pending flags. * @param __HANDLE__ specifies the RTC handle. * @param __FLAG__ specifies the RTC TimeStamp Flag to clear. * This parameter can be: * @arg @ref RTC_FLAG_TSF * @arg @ref RTC_FLAG_TSOVF * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_CLEAR_FLAG((__HANDLE__), (__FLAG__))) #else #define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) #endif /** * @brief Enable the RTC internal TimeStamp peripheral. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_INTERNAL_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ITSE)) /** * @brief Disable the RTC internal TimeStamp peripheral. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_INTERNAL_TIMESTAMP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ITSE)) /** * @brief Get the selected RTC Internal Time Stamp's flag status. * @param __HANDLE__ specifies the RTC handle. * @param __FLAG__ specifies the RTC Internal Time Stamp Flag is pending or not. * This parameter can be: * @arg @ref RTC_FLAG_ITSF * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__),(__FLAG__))) #else #define __HAL_RTC_INTERNAL_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U) #endif /** * @brief Clear the RTC Internal Time Stamp's pending flags. * @param __HANDLE__ specifies the RTC handle. * @param __FLAG__ specifies the RTC Internal Time Stamp Flag source to clear. * This parameter can be: * @arg @ref RTC_FLAG_ITSF * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_INTERNAL_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_CLEAR_FLAG((__HANDLE__), RTC_CLEAR_ITSF)) #else #define __HAL_RTC_INTERNAL_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) #endif #if defined(STM32L412xx) || defined(STM32L422xx) /** * @brief Enable the RTC TimeStamp on Tamper detection. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_TAMPTS_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TAMPTS)) /** * @brief Disable the RTC TimeStamp on Tamper detection. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_TAMPTS_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TAMPTS)) /** * @brief Enable the RTC Tamper detection output. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_TAMPOE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TAMPOE)) /** * @brief Disable the RTC Tamper detection output. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_TAMPOE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_TAMPOE)) /** * @} */ #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) */ /* ------------------------------Calibration----------------------------------*/ /** @defgroup RTCEx_Calibration RTC Calibration * @{ */ /** * @brief Enable the RTC calibration output. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_COE)) /** * @brief Disable the calibration output. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_COE)) /** * @brief Enable the clock reference detection. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_REFCKON)) /** * @brief Disable the clock reference detection. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_REFCKON)) /** * @brief Get the selected RTC shift operation's flag status. * @param __HANDLE__ specifies the RTC handle. * @param __FLAG__ specifies the RTC shift operation Flag is pending or not. * This parameter can be: * @arg @ref RTC_FLAG_SHPF * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (__HAL_RTC_GET_FLAG((__HANDLE__), (__FLAG__))) #else #define __HAL_RTC_SHIFT_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U) #endif /** * @} */ /* ------------------------------Tamper----------------------------------*/ /** @defgroup RTCEx_Tamper RTCEx tamper * @{ */ #if defined(RTC_TAMPER1_SUPPORT) /** * @brief Enable the RTC Tamper1 input detection. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->CR1 |= (TAMP_CR1_TAMP1E)) #else #define __HAL_RTC_TAMPER1_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP1E)) #endif /** * @brief Disable the RTC Tamper1 input detection. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->CR1 &= ~(RTC_TAMPCR_TAMP1E)) #else #define __HAL_RTC_TAMPER1_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP1E)) #endif #endif /* RTC_TAMPER1_SUPPORT */ /** * @brief Enable the RTC Tamper2 input detection. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->CR1 |= (TAMP_CR1_TAMP2E)) #else #define __HAL_RTC_TAMPER2_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP2E)) #endif /** * @brief Disable the RTC Tamper2 input detection. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->CR1 &= ~(RTC_TAMPCR_TAMP2E)) #else #define __HAL_RTC_TAMPER2_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP2E)) #endif #if defined(RTC_TAMPER3_SUPPORT) /** * @brief Enable the RTC Tamper3 input detection. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_TAMPER3_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR |= (RTC_TAMPCR_TAMP3E)) /** * @brief Disable the RTC Tamper3 input detection. * @param __HANDLE__ specifies the RTC handle. * @retval None */ #define __HAL_RTC_TAMPER3_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->TAMPCR &= ~(RTC_TAMPCR_TAMP3E)) #endif /* RTC_TAMPER3_SUPPORT */ /**************************************************************************************************/ /** * @brief Enable the TAMP Tamper interrupt. * @param __HANDLE__ specifies the RTC handle. * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be enabled. * This parameter can be any combination of the following values: * @arg RTC_IT_TAMPALL: All tampers interrupts * @arg RTC_IT_TAMP1: Tamper1 interrupt * @arg RTC_IT_TAMP2: Tamper2 interrupt * @arg RTC_IT_TAMP3: Tamper3 interrupt * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->IER |= (__INTERRUPT__)) #else #define __HAL_RTC_TAMPER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->TAMPCR |= (__INTERRUPT__)) #endif /** * @brief Disable the TAMP Tamper interrupt. * @param __HANDLE__ specifies the RTC handle. * @param __INTERRUPT__ specifies the RTC Tamper interrupt sources to be disabled. * This parameter can be any combination of the following values: * @arg RTC_IT_TAMPALL: All tampers interrupts * @arg RTC_IT_TAMP1: Tamper1 interrupt * @arg RTC_IT_TAMP2: Tamper2 interrupt * @arg RTC_IT_TAMP3: Tamper3 interrupt * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->IER &= ~(__INTERRUPT__)) #else #define __HAL_RTC_TAMPER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->TAMPCR &= ~(__INTERRUPT__)) #endif /**************************************************************************************************/ /** * @brief Check whether the specified RTC Tamper interrupt has occurred or not. * @param __HANDLE__ specifies the RTC handle. * @param __INTERRUPT__ specifies the RTC Tamper interrupt to check. * This parameter can be: * @arg RTC_IT_TAMPALL: All tampers interrupts * @arg RTC_IT_TAMP1: Tamper1 interrupt * @arg RTC_IT_TAMP2: Tamper2 interrupt * @arg RTC_IT_TAMP3: Tamper3 interrupt * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) ((((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->MISR) & (__INTERRUPT__)) != 0U) ? 1U : 0U) #else /* #if defined(STM32L412xx) || defined(STM32L422xx) */ #define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR) & (__INTERRUPT__)) != 0U) ? 1U : 0U) #endif /* #if defined(STM32L412xx) || defined(STM32L422xx) */ /** * @brief Check whether the specified RTC Tamper interrupt has been enabled or not. * @param __HANDLE__ specifies the RTC handle. * @param __INTERRUPT__ specifies the RTC Tamper interrupt source to check. * This parameter can be: * @arg RTC_IT_TAMPALL: All tampers interrupts * @arg RTC_IT_TAMP1: Tamper1 interrupt * @arg RTC_IT_TAMP2: Tamper2 interrupt * @arg RTC_IT_TAMP3: Tamper3 interrupt * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->IER) & (__INTERRUPT__)) != 0U) ? 1U : 0U) #else #define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->TAMPCR) & (__INTERRUPT__)) != 0U) ? 1U : 0U) #endif /** * @brief Get the selected RTC Tamper's flag status. * @param __HANDLE__ specifies the RTC handle. * @param __FLAG__ specifies the RTC Tamper Flag is pending or not. * This parameter can be: * @arg RTC_FLAG_TAMP1F: Tamper1 flag * @arg RTC_FLAG_TAMP2F: Tamper2 flag * @arg RTC_FLAG_TAMP3F: Tamper3 flag * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->SR) & (__FLAG__)) != 0U) #else #define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != 0U) ? 1U : 0U) #endif /** * @brief Clear the RTC Tamper's pending flags. * @param __HANDLE__ specifies the RTC handle. * @param __FLAG__ specifies the RTC Tamper Flag to clear. * This parameter can be: * @arg RTC_FLAG_TAMP1F: Tamper1 flag * @arg RTC_FLAG_TAMP2F: Tamper2 flag * @arg RTC_FLAG_TAMP3F: Tamper3 flag * @retval None */ #if defined(STM32L412xx) || defined(STM32L422xx) #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((((TAMP_TypeDef *)((uint32_t)((__HANDLE__)->Instance) + (__HANDLE__)->TampOffset))->SCR) = (__FLAG__)) #else #define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) #endif /** * @brief Enable interrupt on the RTC Tamper and Timestamp associated Exti line. * @retval None */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) /** * @brief Disable interrupt on the RTC Tamper and Timestamp associated Exti line. * @retval None */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) /** * @brief Enable event on the RTC Tamper and Timestamp associated Exti line. * @retval None */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) /** * @brief Disable event on the RTC Tamper and Timestamp associated Exti line. * @retval None */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) /** * @brief Enable falling edge trigger on the RTC Tamper and Timestamp associated Exti line. * @retval None */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) /** * @brief Disable falling edge trigger on the RTC Tamper and Timestamp associated Exti line. * @retval None */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) /** * @brief Enable rising edge trigger on the RTC Tamper and Timestamp associated Exti line. * @retval None */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) /** * @brief Disable rising edge trigger on the RTC Tamper and Timestamp associated Exti line. * @retval None */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR1 &= ~(RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT)) /** * @brief Enable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line. * @retval None */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_FALLING_EDGE() do { \ __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE(); \ __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_FALLING_EDGE(); \ } while(0) /** * @brief Disable rising & falling edge trigger on the RTC Tamper and Timestamp associated Exti line. * @retval None */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_FALLING_EDGE() do { \ __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_RISING_EDGE(); \ __HAL_RTC_TAMPER_TIMESTAMP_EXTI_DISABLE_FALLING_EDGE(); \ } while(0) /** * @brief Check whether the RTC Tamper and Timestamp associated Exti line interrupt flag is set or not. * @retval Line Status. */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) /** * @brief Clear the RTC Tamper and Timestamp associated Exti line flag. * @retval None */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) /** * @brief Generate a Software interrupt on the RTC Tamper and Timestamp associated Exti line * @retval None */ #define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT) /** * @} */ /** * @} */ /* Exported functions --------------------------------------------------------*/ /** @defgroup RTCEx_Exported_Functions RTCEx Exported Functions * @{ */ /* ========================================================================== */ /* ##### RTC TimeStamp exported functions ##### */ /* ========================================================================== */ /* RTC TimeStamp functions ****************************************************/ /** @defgroup RTCEx_Exported_Functions_Group1 Extended RTC TimeStamp functions * @{ */ HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin); HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t TimeStampEdge, uint32_t RTC_TimeStampPin); HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc); HAL_StatusTypeDef HAL_RTCEx_SetInternalTimeStamp(RTC_HandleTypeDef *hrtc); HAL_StatusTypeDef HAL_RTCEx_DeactivateInternalTimeStamp(RTC_HandleTypeDef *hrtc); HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format); void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc); void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc); HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); /** * @} */ /* ========================================================================== */ /* ##### RTC Wake-up exported functions ##### */ /* ========================================================================== */ /* RTC Wake-up functions ******************************************************/ /** @defgroup RTCEx_Exported_Functions_Group2 Extended RTC Wake-up functions * @{ */ HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); #if defined(STM32L412xx) || defined(STM32L422xx) HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock, uint32_t WakeUpAutoClr); #else HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock); #endif HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc); uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc); void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc); void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc); HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); /** * @} */ /* ========================================================================== */ /* ##### Extended RTC Peripheral Control exported functions ##### */ /* ========================================================================== */ /* Extended RTC Peripheral Control functions **********************************/ /** @defgroup RTCEx_Exported_Functions_Group3 Extended Peripheral Control functions * @{ */ HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue); #if defined(STM32L412xx) || defined(STM32L422xx) HAL_StatusTypeDef HAL_RTCEx_SetLowPowerCalib(RTC_HandleTypeDef *hrtc, uint32_t LowPowerCalib); #endif HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS); HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput); HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc); HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc); HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc); HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc); HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc); /** * @} */ /* Extended RTC features functions *******************************************/ /** @defgroup RTCEx_Exported_Functions_Group4 Extended features functions * @{ */ void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc); HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); /** * @} */ /** @defgroup RTCEx_Exported_Functions_Group5 Extended RTC Tamper functions * @{ */ HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper); HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper); HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper); #if defined(RTC_TAMPER1_SUPPORT) HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); #endif /* RTC_TAMPER1_SUPPORT */ HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); #if defined(RTC_TAMPER3_SUPPORT) HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout); #endif /* RTC_TAMPER3_SUPPORT */ #if defined(RTC_TAMPER1_SUPPORT) void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc); #endif /* RTC_TAMPER1_SUPPORT */ void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc); #if defined(RTC_TAMPER3_SUPPORT) void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc); #endif /* RTC_TAMPER3_SUPPORT */ /** * @} */ /** @defgroup RTCEx_Exported_Functions_Group6 Extended RTC Backup register functions * @{ */ void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data); uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister); /** * @} */ /** * @} */ /* Private types -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private constants ---------------------------------------------------------*/ /** @defgroup RTCEx_Private_Constants RTCEx Private Constants * @{ */ #define RTC_EXTI_LINE_TAMPER_TIMESTAMP_EVENT EXTI_IMR1_IM19 /*!< External interrupt line 19 Connected to the RTC Tamper and Time Stamp events */ #define RTC_EXTI_LINE_WAKEUPTIMER_EVENT EXTI_IMR1_IM20 /*!< External interrupt line 20 Connected to the RTC Wakeup event */ /** * @} */ /* Private macros ------------------------------------------------------------*/ /** @defgroup RTCEx_Private_Macros RTCEx Private Macros * @{ */ /** @defgroup RTCEx_IS_RTC_Definitions Private macros to check input parameters * @{ */ #define IS_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TIMESTAMPEDGE_RISING) || \ ((EDGE) == RTC_TIMESTAMPEDGE_FALLING)) #define IS_RTC_TAMPER_INTERRUPT(INTERRUPT) ((((INTERRUPT) & (uint32_t)0xFFB6FFFB) == 0x00) && ((INTERRUPT) != 0U)) #define IS_RTC_TIMESTAMP_PIN(PIN) (((PIN) == RTC_TIMESTAMPPIN_DEFAULT)) #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV16) || \ ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV8) || \ ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV4) || \ ((CLOCK) == RTC_WAKEUPCLOCK_RTCCLK_DIV2) || \ ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_16BITS) || \ ((CLOCK) == RTC_WAKEUPCLOCK_CK_SPRE_17BITS)) #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= RTC_WUTR_WUT) #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SMOOTHCALIB_PERIOD_32SEC) || \ ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_16SEC) || \ ((PERIOD) == RTC_SMOOTHCALIB_PERIOD_8SEC)) #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_SET) || \ ((PLUS) == RTC_SMOOTHCALIB_PLUSPULSES_RESET)) #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= RTC_CALR_CALM) #if defined(STM32L412xx) || defined(STM32L422xx) #define IS_RTC_LOW_POWER_CALIB(LPCAL) (((LPCAL) == RTC_LPCAL_SET) || \ ((LPCAL) == RTC_LPCAL_RESET)) #endif #if defined(STM32L412xx) || defined(STM32L422xx) #define IS_RTC_TAMPER(__TAMPER__) ((((__TAMPER__) & RTC_TAMPER_ALL) != 0x00U) && \ (((__TAMPER__) & ~RTC_TAMPER_ALL) == 0x00U)) #else #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & (uint32_t)0xFFFFFFD6) == 0x00) && ((TAMPER) != 0U)) #endif #define IS_RTC_TAMPER_TRIGGER(__TRIGGER__) (((__TRIGGER__) == RTC_TAMPERTRIGGER_RISINGEDGE) || \ ((__TRIGGER__) == RTC_TAMPERTRIGGER_FALLINGEDGE) || \ ((__TRIGGER__) == RTC_TAMPERTRIGGER_LOWLEVEL) || \ ((__TRIGGER__) == RTC_TAMPERTRIGGER_HIGHLEVEL)) #define IS_RTC_TAMPER_ERASE_MODE(__MODE__) (((__MODE__) == RTC_TAMPER_ERASE_BACKUP_ENABLE) || \ ((__MODE__) == RTC_TAMPER_ERASE_BACKUP_DISABLE)) #define IS_RTC_TAMPER_MASKFLAG_STATE(__STATE__) (((__STATE__) == RTC_TAMPERMASK_FLAG_ENABLE) || \ ((__STATE__) == RTC_TAMPERMASK_FLAG_DISABLE)) #define IS_RTC_TAMPER_FILTER(__FILTER__) (((__FILTER__) == RTC_TAMPERFILTER_DISABLE) || \ ((__FILTER__) == RTC_TAMPERFILTER_2SAMPLE) || \ ((__FILTER__) == RTC_TAMPERFILTER_4SAMPLE) || \ ((__FILTER__) == RTC_TAMPERFILTER_8SAMPLE)) #define IS_RTC_TAMPER_SAMPLING_FREQ(__FREQ__) (((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768)|| \ ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384)|| \ ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192) || \ ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096) || \ ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048) || \ ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024) || \ ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512) || \ ((__FREQ__) == RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256)) #define IS_RTC_TAMPER_PRECHARGE_DURATION(__DURATION__) (((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_1RTCCLK) || \ ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_2RTCCLK) || \ ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_4RTCCLK) || \ ((__DURATION__) == RTC_TAMPERPRECHARGEDURATION_8RTCCLK)) #define IS_RTC_TAMPER_PULLUP_STATE(__STATE__) (((__STATE__) == RTC_TAMPER_PULLUP_ENABLE) || \ ((__STATE__) == RTC_TAMPER_PULLUP_DISABLE)) #define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION) (((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_ENABLE) || \ ((DETECTION) == RTC_TIMESTAMPONTAMPERDETECTION_DISABLE)) #define IS_RTC_BKP(__BKP__) ((__BKP__) < RTC_BKP_NUMBER) #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_SHIFTADD1S_RESET) || \ ((SEL) == RTC_SHIFTADD1S_SET)) #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= RTC_SHIFTR_SUBFS) #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CALIBOUTPUT_512HZ) || \ ((OUTPUT) == RTC_CALIBOUTPUT_1HZ)) /** * @} */ /** * @} */ /** * @} */ /** * @} */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* STM32L4xx_HAL_RTC_EX_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
{ "content_hash": "30178e0eade35d2db121c96492e1faad", "timestamp": "", "source": "github", "line_count": 1468, "max_line_length": 197, "avg_line_length": 47.73978201634878, "alnum_prop": 0.5409948346222996, "repo_name": "ryankurte/stm32f4-base", "id": "818f55c9d6e276269c97b5b3328e71c7614540b2", "size": "70868", "binary": false, "copies": "11", "ref": "refs/heads/master", "path": "drivers/HAL/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rtc_ex.h", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "3602768" }, { "name": "Batchfile", "bytes": "11662" }, { "name": "C", "bytes": "81530519" }, { "name": "C++", "bytes": "709211" }, { "name": "CMake", "bytes": "23561" }, { "name": "CSS", "bytes": "7390" }, { "name": "HTML", "bytes": "2865790" }, { "name": "Makefile", "bytes": "27107" }, { "name": "Objective-C", "bytes": "20595" }, { "name": "Perl", "bytes": "17688" }, { "name": "Shell", "bytes": "12212" }, { "name": "Tcl", "bytes": "72" } ], "symlink_target": null }
// Copyright 2010-2015, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package org.mozc.android.inputmethod.japanese.ui; import org.mozc.android.inputmethod.japanese.view.SkinType; import android.graphics.drawable.Drawable; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; /** */ public class ScrollGuideViewTest extends InstrumentationTestCase { @SmallTest public void testScrollGuideViewSkin() { ScrollGuideView view = new ScrollGuideView(getInstrumentation().getTargetContext()); Drawable scrollBarDrawable = view.scrollBarDrawable; Drawable backgroundDrawable = view.getBackground(); view.setSkin(SkinType.TEST.getSkin(getInstrumentation().getTargetContext().getResources())); assertNotSame(scrollBarDrawable, view.scrollBarDrawable); assertNotSame(backgroundDrawable, view.getBackground()); } }
{ "content_hash": "db9aa82654d8812332548bc14314a3b5", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 96, "avg_line_length": 46.6078431372549, "alnum_prop": 0.7803954564577198, "repo_name": "UIKit0/mozc", "id": "6c9b2ebf7c56b1216333da64904b3dfe038e2578", "size": "2377", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "src/android/tests/src/com/google/android/inputmethod/japanese/ui/ScrollGuideViewTest.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "200335" }, { "name": "C++", "bytes": "10810098" }, { "name": "CSS", "bytes": "26088" }, { "name": "Emacs Lisp", "bytes": "80168" }, { "name": "HTML", "bytes": "266980" }, { "name": "Java", "bytes": "2751856" }, { "name": "JavaScript", "bytes": "919906" }, { "name": "Makefile", "bytes": "3754" }, { "name": "Objective-C", "bytes": "34833" }, { "name": "Objective-C++", "bytes": "227200" }, { "name": "Protocol Buffer", "bytes": "112300" }, { "name": "Python", "bytes": "1057011" }, { "name": "QMake", "bytes": "861" }, { "name": "Shell", "bytes": "9928" }, { "name": "Yacc", "bytes": "2104" } ], "symlink_target": null }
<html> <header><title>This is title</title></header> <body> Hello world </body> </html>
{ "content_hash": "af8fecfe35228c69ee423317ea496b95", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 45, "avg_line_length": 14.5, "alnum_prop": 0.6781609195402298, "repo_name": "mpmunasinghe/product-ei", "id": "cb7b041e98b75da94c26c14980110d11bd1eb47d", "size": "87", "binary": false, "copies": "30", "ref": "refs/heads/master", "path": "integration/mediation-tests/tests-other/src/test/resources/artifacts/ESB/other/index.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "85589" }, { "name": "CSS", "bytes": "195050" }, { "name": "HTML", "bytes": "43922" }, { "name": "Java", "bytes": "6632897" }, { "name": "JavaScript", "bytes": "5393945" }, { "name": "PLSQL", "bytes": "10466" }, { "name": "PLpgSQL", "bytes": "18229" }, { "name": "Ruby", "bytes": "13608" }, { "name": "Shell", "bytes": "276368" }, { "name": "XSLT", "bytes": "39758" } ], "symlink_target": null }
package overrides import ( "fmt" "github.com/golang/glog" "k8s.io/api/core/v1" utilruntime "k8s.io/apimachinery/pkg/util/runtime" kapiv1 "k8s.io/kubernetes/pkg/apis/core/v1" buildadmission "github.com/openshift/origin/pkg/build/admission" buildapi "github.com/openshift/origin/pkg/build/apis/build" overridesapi "github.com/openshift/origin/pkg/build/controller/build/apis/overrides" "github.com/openshift/origin/pkg/build/controller/build/apis/overrides/validation" "github.com/openshift/origin/pkg/build/controller/build/pluginconfig" configapi "github.com/openshift/origin/pkg/cmd/server/apis/config" ) type BuildOverrides struct { config *overridesapi.BuildOverridesConfig } // NewBuildOverrides creates a new BuildOverrides that will apply the overrides specified in the plugin config func NewBuildOverrides(pluginConfig map[string]*configapi.AdmissionPluginConfig) (BuildOverrides, error) { config := &overridesapi.BuildOverridesConfig{} err := pluginconfig.ReadPluginConfig(pluginConfig, overridesapi.BuildOverridesPlugin, config) if err != nil { return BuildOverrides{}, err } errs := validation.ValidateBuildOverridesConfig(config) if len(errs) > 0 { return BuildOverrides{}, errs.ToAggregate() } glog.V(4).Infof("Initialized build overrides plugin with config: %#v", *config) return BuildOverrides{config: config}, nil } // ApplyOverrides applies configured overrides to a build in a build pod func (b BuildOverrides) ApplyOverrides(pod *v1.Pod) error { if b.config == nil { return nil } build, version, err := buildadmission.GetBuildFromPod(pod) if err != nil { return err } glog.V(4).Infof("Applying overrides to build %s/%s", build.Namespace, build.Name) if b.config.ForcePull { if build.Spec.Strategy.DockerStrategy != nil { glog.V(5).Infof("Setting docker strategy ForcePull to true in build %s/%s", build.Namespace, build.Name) build.Spec.Strategy.DockerStrategy.ForcePull = true } if build.Spec.Strategy.SourceStrategy != nil { glog.V(5).Infof("Setting source strategy ForcePull to true in build %s/%s", build.Namespace, build.Name) build.Spec.Strategy.SourceStrategy.ForcePull = true } if build.Spec.Strategy.CustomStrategy != nil { err := applyForcePullToPod(pod) if err != nil { return err } glog.V(5).Infof("Setting custom strategy ForcePull to true in build %s/%s", build.Namespace, build.Name) build.Spec.Strategy.CustomStrategy.ForcePull = true } } // Apply label overrides for _, lbl := range b.config.ImageLabels { glog.V(5).Infof("Overriding image label %s=%s in build %s/%s", lbl.Name, lbl.Value, build.Namespace, build.Name) overrideLabel(lbl, &build.Spec.Output.ImageLabels) } if len(b.config.NodeSelector) != 0 && pod.Spec.NodeSelector == nil { pod.Spec.NodeSelector = map[string]string{} } for k, v := range b.config.NodeSelector { glog.V(5).Infof("Adding override nodeselector %s=%s to build pod %s/%s", k, v, pod.Namespace, pod.Name) pod.Spec.NodeSelector[k] = v } if len(b.config.Annotations) != 0 && pod.Annotations == nil { pod.Annotations = map[string]string{} } for k, v := range b.config.Annotations { glog.V(5).Infof("Adding override annotation %s=%s to build pod %s/%s", k, v, pod.Namespace, pod.Name) pod.Annotations[k] = v } // Override Tolerations if len(b.config.Tolerations) != 0 { glog.V(5).Infof("Overriding tolerations for pod %s/%s", pod.Namespace, pod.Name) pod.Spec.Tolerations = []v1.Toleration{} for _, toleration := range b.config.Tolerations { t := v1.Toleration{} if err := kapiv1.Convert_core_Toleration_To_v1_Toleration(&toleration, &t, nil); err != nil { err := fmt.Errorf("Unable to convert core.Toleration to v1.Toleration: %v", err) utilruntime.HandleError(err) return err } pod.Spec.Tolerations = append(pod.Spec.Tolerations, t) } } return buildadmission.SetBuildInPod(pod, build, version) } func applyForcePullToPod(pod *v1.Pod) error { for i := range pod.Spec.InitContainers { glog.V(5).Infof("Setting ImagePullPolicy to PullAlways on init container %s of pod %s/%s", pod.Spec.InitContainers[i].Name, pod.Namespace, pod.Name) pod.Spec.InitContainers[i].ImagePullPolicy = v1.PullAlways } for i := range pod.Spec.Containers { glog.V(5).Infof("Setting ImagePullPolicy to PullAlways on container %s of pod %s/%s", pod.Spec.Containers[i].Name, pod.Namespace, pod.Name) pod.Spec.Containers[i].ImagePullPolicy = v1.PullAlways } return nil } func overrideLabel(overridingLabel buildapi.ImageLabel, buildLabels *[]buildapi.ImageLabel) { found := false for i, lbl := range *buildLabels { if lbl.Name == overridingLabel.Name { glog.V(5).Infof("Replacing label %s (original value %q) with new value %q", lbl.Name, lbl.Value, overridingLabel.Value) (*buildLabels)[i] = overridingLabel found = true } } if !found { *buildLabels = append(*buildLabels, overridingLabel) } }
{ "content_hash": "b4dd2a1d66543c96bd180e3bf2ae88e5", "timestamp": "", "source": "github", "line_count": 136, "max_line_length": 150, "avg_line_length": 36.169117647058826, "alnum_prop": 0.7275869079081114, "repo_name": "sg00dwin/origin", "id": "38fbc736e499e5cdf6814eb7219480f289f4fa6b", "size": "4919", "binary": false, "copies": "8", "ref": "refs/heads/master", "path": "pkg/build/controller/build/overrides/overrides.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Awk", "bytes": "921" }, { "name": "DIGITAL Command Language", "bytes": "117" }, { "name": "Go", "bytes": "15034102" }, { "name": "Makefile", "bytes": "7677" }, { "name": "Protocol Buffer", "bytes": "561272" }, { "name": "Python", "bytes": "7834" }, { "name": "Roff", "bytes": "2049" }, { "name": "Ruby", "bytes": "363" }, { "name": "Shell", "bytes": "1504922" } ], "symlink_target": null }
package com.intellij.ui.mac.growl; import com.intellij.openapi.diagnostic.Logger; import com.intellij.ui.mac.foundation.Foundation; import com.intellij.ui.mac.foundation.ID; import com.sun.jna.Pointer; import org.jetbrains.annotations.NotNull; /** * @author spleaner */ public class Growl { private static final Logger LOG = Logger.getInstance("#com.intellij.ui.mac.Growl"); private static final String GROWL_APPLICATION_REGISTRATION_NOTIFICATION = "GrowlApplicationRegistrationNotification"; private static final String GROWL_APP_NAME = "ApplicationName"; private static final String GROWL_APP_ICON = "ApplicationIcon"; private static final String GROWL_DEFAULT_NOTIFICATIONS = "DefaultNotifications"; private static final String GROWL_ALL_NOTIFICATIONS = "AllNotifications"; private static final String GROWL_NOTIFICATION_NAME = "NotificationName"; private static final String GROWL_NOTIFICATION_TITLE = "NotificationTitle"; private static final String GROWL_NOTIFICATION_DESCRIPTION = "NotificationDescription"; private static final String GROWL_NOTIFICATION = "GrowlNotification"; private final String myProductName; private String[] myAllNotifications; private String[] myDefaultNotification; public Growl(@NotNull final String productName) { myProductName = productName; } public void register() { final ID autoReleasePool = createAutoReleasePool(); final ID applicationIcon = getApplicationIcon(); final ID defaultNotifications = fillArray(myDefaultNotification); final ID allNotifications = fillArray(myAllNotifications); final ID userDict = createDict(new String[]{GROWL_APP_NAME, GROWL_APP_ICON, GROWL_DEFAULT_NOTIFICATIONS, GROWL_ALL_NOTIFICATIONS}, new Object[]{myProductName, applicationIcon, defaultNotifications, allNotifications}); final ID center = invoke("NSDistributedNotificationCenter", "defaultCenter"); final Object notificationName = Foundation.cfString(GROWL_APPLICATION_REGISTRATION_NOTIFICATION); invoke(center, "postNotificationName:object:userInfo:deliverImmediately:", notificationName, null, userDict, true); invoke(autoReleasePool, "release"); } public void notifyGrowlOf(final String notification, final String title, final String description) { final ID autoReleasePool = createAutoReleasePool(); final ID dict = createDict(new String[]{ GROWL_NOTIFICATION_NAME, GROWL_NOTIFICATION_TITLE, GROWL_NOTIFICATION_DESCRIPTION, GROWL_APP_NAME}, new Object[]{notification, title, description, myProductName}); final ID center = invoke("NSDistributedNotificationCenter", "defaultCenter"); final Object notificationName = Foundation.cfString(GROWL_NOTIFICATION); invoke(center, "postNotificationName:object:userInfo:deliverImmediately:", notificationName, null, dict, true); invoke(autoReleasePool, "release"); } public void setAllowedNotifications(final String[] allNotifications) { myAllNotifications = allNotifications; } public void setDefaultNotifications(final String[] defaultNotification) { myDefaultNotification = defaultNotification; } private static ID createAutoReleasePool() { return invoke("NSAutoreleasePool", "new"); } private static ID fillArray(final Object[] a) { final ID result = invoke("NSMutableArray", "array"); for (Object s : a) { invoke(result, "addObject:", convertType(s)); } return result; } private static ID createDict(@NotNull final String[] keys, @NotNull final Object[] values) { final ID nsKeys = invoke("NSArray", "arrayWithObjects:", convertTypes(keys)); final ID nsData = invoke("NSArray", "arrayWithObjects:", convertTypes(values)); return invoke("NSDictionary", "dictionaryWithObjects:forKeys:", nsData, nsKeys); } private static Object convertType(final Object o) { if (o instanceof Pointer || o instanceof ID) { return o; } else if (o instanceof String) { return Foundation.cfString((String) o); } else { throw new IllegalArgumentException("Unsupported type! " + o.getClass()); } } private static Object[] convertTypes(@NotNull final Object[] v) { final Object[] result = new Object[v.length]; for (int i = 0; i < v.length; i++) { result[i] = convertType(v[i]); } return result; } private static ID getApplicationIcon() { final ID sharedApp = invoke("NSApplication", "sharedApplication"); final ID nsImage = invoke(sharedApp, "applicationIconImage"); return invoke(nsImage, "TIFFRepresentation"); } private static ID invoke(@NotNull final String className, @NotNull final String selector, Object... args) { return invoke(Foundation.getClass(className), selector, args); } private static ID invoke(@NotNull final ID id, @NotNull final String selector, Object... args) { return invoke(id, Foundation.createSelector(selector), args); } private static ID invoke(@NotNull final ID id, @NotNull final Pointer selector, Object... args) { return Foundation.invoke(id, selector, args); } }
{ "content_hash": "4ec490748a565b621622b7f1ce73efe5", "timestamp": "", "source": "github", "line_count": 125, "max_line_length": 134, "avg_line_length": 40.568, "alnum_prop": 0.7408795109445868, "repo_name": "joewalnes/idea-community", "id": "8198247e6c0220256d1d3763cd3a8ce0f0fc3215", "size": "5671", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "platform/platform-impl/src/com/intellij/ui/mac/growl/Growl.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ActionScript", "bytes": "387" }, { "name": "C", "bytes": "136045" }, { "name": "C#", "bytes": "103" }, { "name": "C++", "bytes": "40449" }, { "name": "Emacs Lisp", "bytes": "2507" }, { "name": "Erlang", "bytes": "10" }, { "name": "Groovy", "bytes": "361320" }, { "name": "Java", "bytes": "89694599" }, { "name": "JavaScript", "bytes": "978" }, { "name": "Objective-C", "bytes": "1877" }, { "name": "PHP", "bytes": "145" }, { "name": "Perl", "bytes": "6523" }, { "name": "Python", "bytes": "1699274" }, { "name": "Shell", "bytes": "6965" }, { "name": "VimL", "bytes": "5950" } ], "symlink_target": null }
<html> <head> <!-- Generated by the Spirit (http://spirit.sf.net) QuickDoc --> <title>Place holders</title> <link rel="stylesheet" href="theme/style.css" type="text/css"> <link rel="prev" href="lazy_functions.html"> <link rel="next" href="polymorphic_functions.html"> </head> <body> <table width="100%" height="48" border="0" background="theme/bkd2.gif" cellspacing="2"> <tr> <td width="10"> </td> <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Place holders</b></font> </td> <td width="112"><a href="http://spirit.sf.net"><img src="theme/spirit.gif" align="right" border="0"></a></td> </tr> </table> <br> <table border="0"> <tr> <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="lazy_functions.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="20"><a href="polymorphic_functions.html"><img src="theme/r_arr.gif" border="0"></a></td> </tr> </table> <p> So far, apart from the quick start appetizer, we presented some examples of lazy functions using the ? symbol to act as a placeholder for yet unsupplied arguments. While this is understandable and simple, it is not adequate when we are dealing with complex composition of functions in addition to binary infix, unary prefix and postfix operators.</p> <p> When an arbitrarily complex function composition has M-N = U unsupplied arguments, the ? symbol maps this onto the actual non- lazy function taking U arguments. For example:</p> <code><pre> <span class=identifier>f1</span><span class=special>(</span><span class=identifier>f2</span><span class=special>(?, </span><span class=number>2</span><span class=special>), </span><span class=identifier>f3</span><span class=special>(?, </span><span class=identifier>f4</span><span class=special>(?))) --&gt; </span><span class=identifier>unnamed_f</span><span class=special>(</span><span class=identifier>a</span><span class=special>, </span><span class=identifier>b</span><span class=special>, </span><span class=identifier>c</span><span class=special>) </span></pre></code> <p> Since there is only 1 supplied argument (N) and we are expecting 4 arguments (M), hence U = 3.</p> <p> It might not be immediately apparent how mapping takes place. It can naively be read from left to right; the first ? in our example maps to a, the second to b, and the last ? maps to c. Yet for even more complex compositions possibly with operators added in the mix, this becomes rather confusing. Also, this is not so flexible: in many occassions, we want to map two or more unknown arguments to a single place-holder.</p> <p> To avoid confusion, rather than using the ? as a symbol for unsupplied arguments, we use a more meaningful and precise representation. This is realized by supplying a numeric representation of the actual argument position (1 to N) in the resulting (right hand) function. Here's our revised example using this scheme:</p> <code><pre> <span class=identifier>f1</span><span class=special>(</span><span class=identifier>f2</span><span class=special>(</span><span class=identifier>arg1</span><span class=special>, </span><span class=number>2</span><span class=special>), </span><span class=identifier>f3</span><span class=special>(</span><span class=identifier>arg2</span><span class=special>, </span><span class=identifier>f4</span><span class=special>(</span><span class=identifier>arg3</span><span class=special>))) --&gt; </span><span class=identifier>unnamed_f</span><span class=special>(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg2</span><span class=special>, </span><span class=identifier>arg3</span><span class=special>) </span></pre></code> <p> Now, arg1, arg2 and arg3 are used as placeholders instead of ?. Take note that with this revised scheme, we can now map two or more unsupplied arguments to a single actual argument. Example:</p> <code><pre> <span class=identifier>f1</span><span class=special>(</span><span class=identifier>f2</span><span class=special>(</span><span class=identifier>arg1</span><span class=special>, </span><span class=number>2</span><span class=special>), </span><span class=identifier>f3</span><span class=special>(</span><span class=identifier>arg2</span><span class=special>, </span><span class=identifier>f4</span><span class=special>(</span><span class=identifier>arg1</span><span class=special>))) --&gt; </span><span class=identifier>unnamed_f</span><span class=special>(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg2</span><span class=special>) </span></pre></code> <p> Notice how we mapped the leftmost and the rightmost unnamed argument to arg1. Consequently, the resulting (right hand) function now expects only two arguments (arg1 and arg2) instead of three. Here are some interesting snippets where this might be useful:</p> <code><pre> <span class=identifier>plus</span><span class=special>(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg1</span><span class=special>) --&gt; </span><span class=identifier>mult_2</span><span class=special>(</span><span class=identifier>x</span><span class=special>) </span><span class=identifier>mult</span><span class=special>(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg1</span><span class=special>) --&gt; </span><span class=identifier>square</span><span class=special>(</span><span class=identifier>x</span><span class=special>) </span><span class=identifier>mult</span><span class=special>(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>mult</span><span class=special>(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg1</span><span class=special>)) --&gt; </span><span class=identifier>cube</span><span class=special>(</span><span class=identifier>x</span><span class=special>) </span></pre></code> <a name="extra_arguments"></a><h2>Extra arguments</h2><p> In C and C++, a function can have extra arguments that are not at all used by the function body itself. For instance, call-back functions may provide much more information than is actually needed at once. These extra arguments are just ignored.</p> <p> Phoenix also allows extra arguments to be passed. For example, recall our original add function:</p> <code><pre> <span class=identifier>add</span><span class=special>(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg2</span><span class=special>) </span></pre></code> <p> We know now that partially evaluating this function results to a function that expects 2 arguments. However, the framework is a bit more lenient and allows the caller to supply more arguments than is actually required. Thus, our partially evaluated plus(arg1, arg2) function actually allows 2 *or more* arguments to be passed in. For instance, with:</p> <code><pre> <span class=identifier>add</span><span class=special>(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg2</span><span class=special>)(</span><span class=number>1</span><span class=special>, </span><span class=number>2</span><span class=special>, </span><span class=number>3</span><span class=special>) </span><span class=identifier>the </span><span class=identifier>third </span><span class=identifier>argument </span><span class=literal>'3' </span><span class=identifier>is </span><span class=identifier>merely </span><span class=identifier>ignored</span><span class=special>. </span></pre></code> <p> Taking this further, in-between arguments may even be ignored. Example:</p> <code><pre> <span class=identifier>add</span><span class=special>(</span><span class=identifier>arg1</span><span class=special>, </span><span class=identifier>arg5</span><span class=special>)(</span><span class=number>1</span><span class=special>, </span><span class=number>2</span><span class=special>, </span><span class=number>3</span><span class=special>, </span><span class=number>4</span><span class=special>, </span><span class=number>5</span><span class=special>) </span></pre></code> <p> Here, arguments 2, 3, and 4 are ignored. The function add just takes in the first argument (arg1) and the fifth argument (arg5). The result is of course six (6).</p> <table width="80%" border="0" align="center"> <tr> <td class="note_box"> <img src="theme/lens.gif"></img> <b>Strict Arity</b><br><br>There are a few reasons why enforcing strict arity is not desireable. A case in point is the callback function. Typical callback functions provide more information than is actually needed. Lambda functions are often used as callbacks. </td> </tr> </table> <table border="0"> <tr> <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> <td width="30"><a href="lazy_functions.html"><img src="theme/l_arr.gif" border="0"></a></td> <td width="20"><a href="polymorphic_functions.html"><img src="theme/r_arr.gif" border="0"></a></td> </tr> </table> <br> <hr size="1"> <p class="copyright">Copyright &copy; 2001-2002 Joel de Guzman<br> <br> <font size="2">Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) </font> </p> </body> </html>
{ "content_hash": "92b0348f2c3aaedafe2458407814d427", "timestamp": "", "source": "github", "line_count": 98, "max_line_length": 747, "avg_line_length": 98.70408163265306, "alnum_prop": 0.7101209552362245, "repo_name": "Franky666/programmiersprachen-raytracer", "id": "ded4e447918983c774c579b216c5f4861f98b330", "size": "9673", "binary": false, "copies": "11", "ref": "refs/heads/master", "path": "external/boost_1_59_0/libs/spirit/classic/phoenix/doc/place_holders.html", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "905071" }, { "name": "C++", "bytes": "46207" }, { "name": "CMake", "bytes": "4419" } ], "symlink_target": null }
#ifndef FLANN_H_ #define FLANN_H_ #include "defines.h" #ifdef __cplusplus extern "C" { using namespace flann; #endif struct FLANNParameters { enum flann_algorithm_t algorithm; /* the algorithm to use */ /* search time parameters */ int checks; /* how many leafs (features) to check in one search */ float eps; /* eps parameter for eps-knn search */ int sorted; /* indicates if results returned by radius search should be sorted or not */ int max_neighbors; /* limits the maximum number of neighbors should be returned by radius search */ int cores; /* number of paralel cores to use for searching */ /* kdtree index parameters */ int trees; /* number of randomized trees to use (for kdtree) */ int leaf_max_size; /* kmeans index parameters */ int branching; /* branching factor (for kmeans tree) */ int iterations; /* max iterations to perform in one kmeans cluetering (kmeans tree) */ enum flann_centers_init_t centers_init; /* algorithm used for picking the initial cluster centers for kmeans tree */ float cb_index; /* cluster boundary index. Used when searching the kmeans tree */ /* autotuned index parameters */ float target_precision; /* precision desired (used for autotuning, -1 otherwise) */ float build_weight; /* build tree time weighting factor */ float memory_weight; /* index memory weigthing factor */ float sample_fraction; /* what fraction of the dataset to use for autotuning */ /* LSH parameters */ unsigned int table_number_; /** The number of hash tables to use */ unsigned int key_size_; /** The length of the key in the hash tables */ unsigned int multi_probe_level_; /** Number of levels to use in multi-probe LSH, 0 for standard LSH */ /* other parameters */ enum flann_log_level_t log_level; /* determines the verbosity of each flann function */ long random_seed; /* random seed to use */ }; typedef void* FLANN_INDEX; /* deprecated */ typedef void* flann_index_t; FLANN_EXPORT extern struct FLANNParameters DEFAULT_FLANN_PARAMETERS; /** Sets the log level used for all flann functions (unless specified in FLANNParameters for each call Params: level = verbosity level */ FLANN_EXPORT void flann_log_verbosity(int level); /** * Sets the distance type to use throughout FLANN. * If distance type specified is MINKOWSKI, the second argument * specifies which order the minkowski distance should have. */ FLANN_EXPORT void flann_set_distance_type(enum flann_distance_t distance_type, int order); /** Builds and returns an index. It uses autotuning if the target_precision field of index_params is between 0 and 1, or the parameters specified if it's -1. Params: dataset = pointer to a data set stored in row major order rows = number of rows (features) in the dataset cols = number of columns in the dataset (feature dimensionality) speedup = speedup over linear search, estimated if using autotuning, output parameter index_params = index related parameters flann_params = generic flann parameters Returns: the newly created index or a number <0 for error */ FLANN_EXPORT flann_index_t flann_build_index(float* dataset, int rows, int cols, float* speedup, struct FLANNParameters* flann_params); FLANN_EXPORT flann_index_t flann_build_index_float(float* dataset, int rows, int cols, float* speedup, struct FLANNParameters* flann_params); FLANN_EXPORT flann_index_t flann_build_index_double(double* dataset, int rows, int cols, float* speedup, struct FLANNParameters* flann_params); FLANN_EXPORT flann_index_t flann_build_index_byte(unsigned char* dataset, int rows, int cols, float* speedup, struct FLANNParameters* flann_params); FLANN_EXPORT flann_index_t flann_build_index_int(int* dataset, int rows, int cols, float* speedup, struct FLANNParameters* flann_params); /** * Saves the index to a file. Only the index is saved into the file, the dataset corresponding to the index is not saved. * * @param index_id The index that should be saved * @param filename The filename the index should be saved to * @return Returns 0 on success, negative value on error. */ FLANN_EXPORT int flann_save_index(flann_index_t index_id, char* filename); FLANN_EXPORT int flann_save_index_float(flann_index_t index_id, char* filename); FLANN_EXPORT int flann_save_index_double(flann_index_t index_id, char* filename); FLANN_EXPORT int flann_save_index_byte(flann_index_t index_id, char* filename); FLANN_EXPORT int flann_save_index_int(flann_index_t index_id, char* filename); /** * Loads an index from a file. * * @param filename File to load the index from. * @param dataset The dataset corresponding to the index. * @param rows Dataset tors * @param cols Dataset columns * @return */ FLANN_EXPORT flann_index_t flann_load_index(char* filename, float* dataset, int rows, int cols); FLANN_EXPORT flann_index_t flann_load_index_float(char* filename, float* dataset, int rows, int cols); FLANN_EXPORT flann_index_t flann_load_index_double(char* filename, double* dataset, int rows, int cols); FLANN_EXPORT flann_index_t flann_load_index_byte(char* filename, unsigned char* dataset, int rows, int cols); FLANN_EXPORT flann_index_t flann_load_index_int(char* filename, int* dataset, int rows, int cols); /** Builds an index and uses it to find nearest neighbors. Params: dataset = pointer to a data set stored in row major order rows = number of rows (features) in the dataset cols = number of columns in the dataset (feature dimensionality) testset = pointer to a query set stored in row major order trows = number of rows (features) in the query dataset (same dimensionality as features in the dataset) indices = pointer to matrix for the indices of the nearest neighbors of the testset features in the dataset (must have trows number of rows and nn number of columns) nn = how many nearest neighbors to return flann_params = generic flann parameters Returns: zero or -1 for error */ FLANN_EXPORT int flann_find_nearest_neighbors(float* dataset, int rows, int cols, float* testset, int trows, int* indices, float* dists, int nn, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_find_nearest_neighbors_float(float* dataset, int rows, int cols, float* testset, int trows, int* indices, float* dists, int nn, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_find_nearest_neighbors_double(double* dataset, int rows, int cols, double* testset, int trows, int* indices, double* dists, int nn, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_find_nearest_neighbors_byte(unsigned char* dataset, int rows, int cols, unsigned char* testset, int trows, int* indices, float* dists, int nn, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_find_nearest_neighbors_int(int* dataset, int rows, int cols, int* testset, int trows, int* indices, float* dists, int nn, struct FLANNParameters* flann_params); /** Searches for nearest neighbors using the index provided Params: index_id = the index (constructed previously using flann_build_index). testset = pointer to a query set stored in row major order trows = number of rows (features) in the query dataset (same dimensionality as features in the dataset) indices = pointer to matrix for the indices of the nearest neighbors of the testset features in the dataset (must have trows number of rows and nn number of columns) dists = pointer to matrix for the distances of the nearest neighbors of the testset features in the dataset (must have trows number of rows and 1 column) nn = how many nearest neighbors to return flann_params = generic flann parameters Returns: zero or a number <0 for error */ FLANN_EXPORT int flann_find_nearest_neighbors_index(flann_index_t index_id, float* testset, int trows, int* indices, float* dists, int nn, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_find_nearest_neighbors_index_float(flann_index_t index_id, float* testset, int trows, int* indices, float* dists, int nn, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_find_nearest_neighbors_index_double(flann_index_t index_id, double* testset, int trows, int* indices, double* dists, int nn, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_find_nearest_neighbors_index_byte(flann_index_t index_id, unsigned char* testset, int trows, int* indices, float* dists, int nn, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_find_nearest_neighbors_index_int(flann_index_t index_id, int* testset, int trows, int* indices, float* dists, int nn, struct FLANNParameters* flann_params); /** * Performs an radius search using an already constructed index. * * In case of radius search, instead of always returning a predetermined * number of nearest neighbours (for example the 10 nearest neighbours), the * search will return all the neighbours found within a search radius * of the query point. * * The check parameter in the FLANNParameters below sets the level of approximation * for the search by only visiting "checks" number of features in the index * (the same way as for the KNN search). A lower value for checks will give * a higher search speedup at the cost of potentially not returning all the * neighbours in the specified radius. */ FLANN_EXPORT int flann_radius_search(flann_index_t index_ptr, /* the index */ float* query, /* query point */ int* indices, /* array for storing the indices found (will be modified) */ float* dists, /* similar, but for storing distances */ int max_nn, /* size of arrays indices and dists */ float radius, /* search radius (squared radius for euclidian metric) */ struct FLANNParameters* flann_params); FLANN_EXPORT int flann_radius_search_float(flann_index_t index_ptr, /* the index */ float* query, /* query point */ int* indices, /* array for storing the indices found (will be modified) */ float* dists, /* similar, but for storing distances */ int max_nn, /* size of arrays indices and dists */ float radius, /* search radius (squared radius for euclidian metric) */ struct FLANNParameters* flann_params); FLANN_EXPORT int flann_radius_search_double(flann_index_t index_ptr, /* the index */ double* query, /* query point */ int* indices, /* array for storing the indices found (will be modified) */ double* dists, /* similar, but for storing distances */ int max_nn, /* size of arrays indices and dists */ float radius, /* search radius (squared radius for euclidian metric) */ struct FLANNParameters* flann_params); FLANN_EXPORT int flann_radius_search_byte(flann_index_t index_ptr, /* the index */ unsigned char* query, /* query point */ int* indices, /* array for storing the indices found (will be modified) */ float* dists, /* similar, but for storing distances */ int max_nn, /* size of arrays indices and dists */ float radius, /* search radius (squared radius for euclidian metric) */ struct FLANNParameters* flann_params); FLANN_EXPORT int flann_radius_search_int(flann_index_t index_ptr, /* the index */ int* query, /* query point */ int* indices, /* array for storing the indices found (will be modified) */ float* dists, /* similar, but for storing distances */ int max_nn, /* size of arrays indices and dists */ float radius, /* search radius (squared radius for euclidian metric) */ struct FLANNParameters* flann_params); /** Deletes an index and releases the memory used by it. Params: index_id = the index (constructed previously using flann_build_index). flann_params = generic flann parameters Returns: zero or a number <0 for error */ FLANN_EXPORT int flann_free_index(flann_index_t index_id, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_free_index_float(flann_index_t index_id, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_free_index_double(flann_index_t index_id, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_free_index_byte(flann_index_t index_id, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_free_index_int(flann_index_t index_id, struct FLANNParameters* flann_params); /** Clusters the features in the dataset using a hierarchical kmeans clustering approach. This is significantly faster than using a flat kmeans clustering for a large number of clusters. Params: dataset = pointer to a data set stored in row major order rows = number of rows (features) in the dataset cols = number of columns in the dataset (feature dimensionality) clusters = number of cluster to compute result = memory buffer where the output cluster centers are storred index_params = used to specify the kmeans tree parameters (branching factor, max number of iterations to use) flann_params = generic flann parameters Returns: number of clusters computed or a number <0 for error. This number can be different than the number of clusters requested, due to the way hierarchical clusters are computed. The number of clusters returned will be the highest number of the form (branch_size-1)*K+1 smaller than the number of clusters requested. */ FLANN_EXPORT int flann_compute_cluster_centers(float* dataset, int rows, int cols, int clusters, float* result, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_compute_cluster_centers_float(float* dataset, int rows, int cols, int clusters, float* result, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_compute_cluster_centers_double(double* dataset, int rows, int cols, int clusters, double* result, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_compute_cluster_centers_byte(unsigned char* dataset, int rows, int cols, int clusters, float* result, struct FLANNParameters* flann_params); FLANN_EXPORT int flann_compute_cluster_centers_int(int* dataset, int rows, int cols, int clusters, float* result, struct FLANNParameters* flann_params); #ifdef __cplusplus } #include "flann.hpp" #endif #endif /*FLANN_H_*/
{ "content_hash": "3b590282ccf6607187c66fbbf176d466", "timestamp": "", "source": "github", "line_count": 444, "max_line_length": 144, "avg_line_length": 50.810810810810814, "alnum_prop": 0.4637854609929078, "repo_name": "ppwwyyxx/panorama", "id": "90d1cf8e52fd0c6e922693d6a09ada61e84bf54c", "size": "24185", "binary": false, "copies": "37", "ref": "refs/heads/master", "path": "src/third-party/flann/flann.h", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "192479" }, { "name": "CMake", "bytes": "3061" }, { "name": "Makefile", "bytes": "2212" }, { "name": "Python", "bytes": "12572" }, { "name": "Shell", "bytes": "1468" } ], "symlink_target": null }
package request import ( "context" "testing" ) func TestCompressionDisabled(t *testing.T) { ctx := context.Background() // Default value is false. if got, want := CompressionDisabledFrom(ctx), false; got != want { t.Errorf("CompressionDisabledFrom(ctx) = %v; want = %v", got, want) } // We retrieve stored true. ctx = WithCompressionDisabled(ctx, true) if got, want := CompressionDisabledFrom(ctx), true; got != want { t.Errorf("CompressionDisabledFrom(ctx) = %v; want = %v", got, want) } // We retrieve stored false. ctx = WithCompressionDisabled(ctx, false) if got, want := CompressionDisabledFrom(ctx), false; got != want { t.Errorf("CompressionDisabledFrom(ctx) = %v; want = %v", got, want) } }
{ "content_hash": "078c00602fad6cf87ab994f2cc9f7fff", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 69, "avg_line_length": 25.03448275862069, "alnum_prop": 0.6818181818181818, "repo_name": "zhouhaibing089/kubernetes", "id": "eadd622ba372916de6990c921eb7c24633d08915", "size": "1295", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "staging/src/k8s.io/apiserver/pkg/endpoints/request/disable_compression_test.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "833" }, { "name": "C", "bytes": "3902" }, { "name": "Dockerfile", "bytes": "48607" }, { "name": "Go", "bytes": "61567505" }, { "name": "HTML", "bytes": "128" }, { "name": "Makefile", "bytes": "64401" }, { "name": "PowerShell", "bytes": "144474" }, { "name": "Python", "bytes": "23849" }, { "name": "Shell", "bytes": "1799486" }, { "name": "sed", "bytes": "1262" } ], "symlink_target": null }
package anaconda import ( "net/url" "strconv" ) type Cursor struct { Previous_cursor int64 Previous_cursor_str string Ids []int64 Next_cursor int64 Next_cursor_str string } type UserCursor struct { Previous_cursor int64 Previous_cursor_str string Next_cursor int64 Next_cursor_str string Users []User } type FriendsIdsCursor struct { Previous_cursor int64 Previous_cursor_str string Next_cursor int64 Next_cursor_str string Ids []int64 } type FriendsIdsPage struct { Ids []int64 Error error } type Friendship struct { Name string Id_str string Id int64 Connections []string Screen_name string } type FollowersPage struct { Followers []User Error error } type FriendsPage struct { Friends []User Error error } // FIXME: Might want to consolidate this with FriendsIdsPage and just // have "UserIdsPage". type FollowersIdsPage struct { Ids []int64 Error error } //GetFriendshipsNoRetweets s a collection of user_ids that the currently authenticated user does not want to receive retweets from. //It does not currently support the stringify_ids parameter func (a TwitterApi) GetFriendshipsNoRetweets() (ids []int64, err error) { response_ch := make(chan response) a.queryQueue <- query{a.baseUrl + "/friendships/no_retweets/ids.json", nil, &ids, _GET, response_ch} return ids, (<-response_ch).err } func (a TwitterApi) GetFollowersIds(v url.Values) (c Cursor, err error) { err = a.apiGet(a.baseUrl+"/followers/ids.json", v, &c) return } // Like GetFollowersIds, but returns a channel instead of a cursor and pre-fetches the remaining results // This channel is closed once all values have been fetched func (a TwitterApi) GetFollowersIdsAll(v url.Values) (result chan FollowersIdsPage) { result = make(chan FollowersIdsPage) if v == nil { v = url.Values{} } go func(a TwitterApi, v url.Values, result chan FollowersIdsPage) { // Cursor defaults to the first page ("-1") next_cursor := "-1" for { v.Set("cursor", next_cursor) c, err := a.GetFollowersIds(v) // throttledQuery() handles all rate-limiting errors // if GetFollowersList() returns an error, it must be a different kind of error result <- FollowersIdsPage{c.Ids, err} next_cursor = c.Next_cursor_str if next_cursor == "0" { close(result) break } } }(a, v, result) return result } func (a TwitterApi) GetFriendsIds(v url.Values) (c Cursor, err error) { response_ch := make(chan response) a.queryQueue <- query{a.baseUrl + "/friends/ids.json", v, &c, _GET, response_ch} return c, (<-response_ch).err } func (a TwitterApi) GetFriendshipsLookup(v url.Values) (friendships []Friendship, err error) { response_ch := make(chan response) a.queryQueue <- query{a.baseUrl + "/friendships/lookup.json", v, &friendships, _GET, response_ch} return friendships, (<-response_ch).err } func (a TwitterApi) GetFriendshipsIncoming(v url.Values) (c Cursor, err error) { response_ch := make(chan response) a.queryQueue <- query{a.baseUrl + "/friendships/incoming.json", v, &c, _GET, response_ch} return c, (<-response_ch).err } func (a TwitterApi) GetFriendshipsOutgoing(v url.Values) (c Cursor, err error) { response_ch := make(chan response) a.queryQueue <- query{a.baseUrl + "/friendships/outgoing.json", v, &c, _GET, response_ch} return c, (<-response_ch).err } func (a TwitterApi) GetFollowersList(v url.Values) (c UserCursor, err error) { response_ch := make(chan response) a.queryQueue <- query{a.baseUrl + "/followers/list.json", v, &c, _GET, response_ch} return c, (<-response_ch).err } func (a TwitterApi) GetFriendsList(v url.Values) (c UserCursor, err error) { response_ch := make(chan response) a.queryQueue <- query{a.baseUrl + "/friends/list.json", v, &c, _GET, response_ch} return c, (<-response_ch).err } // Like GetFriendsList, but returns a channel instead of a cursor and pre-fetches the remaining results // This channel is closed once all values have been fetched func (a TwitterApi) GetFriendsListAll(v url.Values) (result chan FriendsPage) { result = make(chan FriendsPage) if v == nil { v = url.Values{} } go func(a TwitterApi, v url.Values, result chan FriendsPage) { // Cursor defaults to the first page ("-1") next_cursor := "-1" for { v.Set("cursor", next_cursor) c, err := a.GetFriendsList(v) // throttledQuery() handles all rate-limiting errors // if GetFriendsListAll() returns an error, it must be a different kind of error result <- FriendsPage{c.Users, err} next_cursor = c.Next_cursor_str if next_cursor == "0" { close(result) break } } }(a, v, result) return result } // Like GetFollowersList, but returns a channel instead of a cursor and pre-fetches the remaining results // This channel is closed once all values have been fetched func (a TwitterApi) GetFollowersListAll(v url.Values) (result chan FollowersPage) { result = make(chan FollowersPage) if v == nil { v = url.Values{} } go func(a TwitterApi, v url.Values, result chan FollowersPage) { // Cursor defaults to the first page ("-1") next_cursor := "-1" for { v.Set("cursor", next_cursor) c, err := a.GetFollowersList(v) // throttledQuery() handles all rate-limiting errors // if GetFollowersList() returns an error, it must be a different kind of error result <- FollowersPage{c.Users, err} next_cursor = c.Next_cursor_str if next_cursor == "0" { close(result) break } } }(a, v, result) return result } func (a TwitterApi) GetFollowersUser(id int64, v url.Values) (c Cursor, err error) { v = cleanValues(v) v.Set("user_id", strconv.FormatInt(id, 10)) response_ch := make(chan response) a.queryQueue <- query{a.baseUrl + "/followers/ids.json", v, &c, _GET, response_ch} return c, (<-response_ch).err } // Like GetFriendsIds, but returns a channel instead of a cursor and pre-fetches the remaining results // This channel is closed once all values have been fetched func (a TwitterApi) GetFriendsIdsAll(v url.Values) (result chan FriendsIdsPage) { result = make(chan FriendsIdsPage) if v == nil { v = url.Values{} } go func(a TwitterApi, v url.Values, result chan FriendsIdsPage) { // Cursor defaults to the first page ("-1") next_cursor := "-1" for { v.Set("cursor", next_cursor) c, err := a.GetFriendsIds(v) // throttledQuery() handles all rate-limiting errors // if GetFollowersList() returns an error, it must be a different kind of error result <- FriendsIdsPage{c.Ids, err} next_cursor = c.Next_cursor_str if next_cursor == "0" { close(result) break } } }(a, v, result) return result } func (a TwitterApi) GetFriendsUser(id int64, v url.Values) (c Cursor, err error) { v = cleanValues(v) v.Set("user_id", strconv.FormatInt(id, 10)) response_ch := make(chan response) a.queryQueue <- query{a.baseUrl + "/friends/ids.json", v, &c, _GET, response_ch} return c, (<-response_ch).err } // FollowUserId follows the user with the specified userId. // This implements the /friendships/create endpoint, though the function name // uses the terminology 'follow' as this is most consistent with colloquial Twitter terminology. func (a TwitterApi) FollowUserId(userId int64, v url.Values) (user User, err error) { v = cleanValues(v) v.Set("user_id", strconv.FormatInt(userId, 10)) return a.postFriendshipsCreateImpl(v) } // FollowUserId follows the user with the specified screenname (username). // This implements the /friendships/create endpoint, though the function name // uses the terminology 'follow' as this is most consistent with colloquial Twitter terminology. func (a TwitterApi) FollowUser(screenName string) (user User, err error) { v := url.Values{} v.Set("screen_name", screenName) return a.postFriendshipsCreateImpl(v) } func (a TwitterApi) postFriendshipsCreateImpl(v url.Values) (user User, err error) { response_ch := make(chan response) a.queryQueue <- query{a.baseUrl + "/friendships/create.json", v, &user, _POST, response_ch} return user, (<-response_ch).err } // UnfollowUserId unfollows the user with the specified userId. // This implements the /friendships/destroy endpoint, though the function name // uses the terminology 'unfollow' as this is most consistent with colloquial Twitter terminology. func (a TwitterApi) UnfollowUserId(userId int64) (u User, err error) { v := url.Values{} v.Set("user_id", strconv.FormatInt(userId, 10)) // Set other values before calling this method: // page, count, include_entities response_ch := make(chan response) a.queryQueue <- query{a.baseUrl + "/friendships/destroy.json", v, &u, _POST, response_ch} return u, (<-response_ch).err } // UnfollowUser unfollows the user with the specified screenname (username) // This implements the /friendships/destroy endpoint, though the function name // uses the terminology 'unfollow' as this is most consistent with colloquial Twitter terminology. func (a TwitterApi) UnfollowUser(screenname string) (u User, err error) { v := url.Values{} v.Set("screen_name", screenname) // Set other values before calling this method: // page, count, include_entities response_ch := make(chan response) a.queryQueue <- query{a.baseUrl + "/friendships/destroy.json", v, &u, _POST, response_ch} return u, (<-response_ch).err }
{ "content_hash": "27b4e891325a25bda10579a04c63a457", "timestamp": "", "source": "github", "line_count": 301, "max_line_length": 131, "avg_line_length": 31.146179401993354, "alnum_prop": 0.70464, "repo_name": "AllanCochrane/tiltingatwindows", "id": "c887321fbed7b8463221792e794710dc5338e88d", "size": "9375", "binary": false, "copies": "16", "ref": "refs/heads/master", "path": "vendor/github.com/ChimeraCoder/anaconda/friends_followers.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Go", "bytes": "3654" } ], "symlink_target": null }
#ifndef T_FUNCTION_H #define T_FUNCTION_H #include <string> #include "thrift/compiler/parse/t_type.h" #include "thrift/compiler/parse/t_struct.h" #include "thrift/compiler/parse/t_doc.h" /** * Representation of a function. Key parts are return type, function name, * optional modifiers, and an argument list, which is implemented as a thrift * struct. * */ class t_function : public t_doc { public: t_function(t_type* returntype, std::string name, t_struct* arglist, t_type* annotations=nullptr, bool oneway=false) : returntype_(returntype), name_(name), arglist_(arglist), annotations_(annotations), oneway_(oneway) { xceptions_ = new t_struct(nullptr); if (oneway_) { if (returntype_ == nullptr || !returntype_->is_void()) { throw std::string("Oneway methods must have void return type."); } for (auto& arg : arglist_->get_members()) { t_type* type = arg->get_type(); } } } t_function(t_type* returntype, std::string name, t_struct* arglist, t_struct* xceptions, t_type* annotations=nullptr, bool oneway=false) : returntype_(returntype), name_(name), arglist_(arglist), xceptions_(xceptions), annotations_(annotations), oneway_(oneway) { if (oneway_) { if (!xceptions_->get_members().empty()) { throw std::string("Oneway methods can't throw exceptions."); } if (returntype_ == nullptr || !returntype_->is_void()) { throw std::string("Oneway methods must have void return type."); } for (auto& arg : arglist_->get_members()) { t_type* type = arg->get_type(); } } } ~t_function() {} t_type* get_returntype() const { return returntype_; } const std::string& get_name() const { return name_; } t_struct* get_arglist() const { return arglist_; } t_struct* get_xceptions() const { return xceptions_; } t_type* get_annotations() const { return annotations_; } bool is_oneway() const { return oneway_; } private: t_type* returntype_; std::string name_; t_struct* arglist_; t_struct* xceptions_; t_type* annotations_; bool oneway_; }; #endif
{ "content_hash": "e8059f54e83803cfceec9b8651e9239a", "timestamp": "", "source": "github", "line_count": 104, "max_line_length": 77, "avg_line_length": 22.278846153846153, "alnum_prop": 0.5865343116098403, "repo_name": "uber/fbthrift", "id": "e61ffef0ac341158949c988c7961cfc0982cace4", "size": "3120", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "thrift/compiler/parse/t_function.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "188545" }, { "name": "C#", "bytes": "107003" }, { "name": "C++", "bytes": "5373501" }, { "name": "D", "bytes": "667874" }, { "name": "Emacs Lisp", "bytes": "5154" }, { "name": "Erlang", "bytes": "134547" }, { "name": "Go", "bytes": "209167" }, { "name": "Haskell", "bytes": "103787" }, { "name": "Java", "bytes": "624082" }, { "name": "JavaScript", "bytes": "4220" }, { "name": "Lua", "bytes": "56935" }, { "name": "Makefile", "bytes": "31183" }, { "name": "OCaml", "bytes": "32172" }, { "name": "Objective-C", "bytes": "94908" }, { "name": "PHP", "bytes": "212169" }, { "name": "Perl", "bytes": "69158" }, { "name": "Perl6", "bytes": "1524" }, { "name": "Protocol Buffer", "bytes": "585" }, { "name": "Python", "bytes": "670664" }, { "name": "Ruby", "bytes": "323073" }, { "name": "Scala", "bytes": "1266" }, { "name": "Shell", "bytes": "21155" }, { "name": "Smalltalk", "bytes": "22812" }, { "name": "TeX", "bytes": "48707" }, { "name": "Thrift", "bytes": "101886" }, { "name": "VimL", "bytes": "2837" } ], "symlink_target": null }
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright 2010 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="true" android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/btn_bg_pressed"/> <item android:state_enabled="true" android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/btn_bg_pressed"/> <item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/btn_bg_selected"/> <item android:state_focused="false" android:state_pressed="false" android:drawable="@color/schedule_block_color_background"/> </selector>
{ "content_hash": "d4182054b3be9c8aadf99fe2a49bfbcd", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 143, "avg_line_length": 57.04545454545455, "alnum_prop": 0.7386454183266933, "repo_name": "iliasbartolini/AgileDayConferenceApp", "id": "81828bf58a36d7367394f6fd16be06dd276c9626", "size": "1255", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "AgileDayConferenceApp/res/drawable/btn_now_playing_more.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "88697" } ], "symlink_target": null }
"""Tests for iZone.""" import pytest from homeassistant import config_entries, data_entry_flow from homeassistant.components.izone.const import DISPATCH_CONTROLLER_DISCOVERED, IZONE from tests.async_mock import Mock, patch @pytest.fixture def mock_disco(): """Mock discovery service.""" disco = Mock() disco.pi_disco = Mock() disco.pi_disco.controllers = {} yield disco def _mock_start_discovery(hass, mock_disco): from homeassistant.helpers.dispatcher import async_dispatcher_send def do_disovered(*args): async_dispatcher_send(hass, DISPATCH_CONTROLLER_DISCOVERED, True) return mock_disco return do_disovered async def test_not_found(hass, mock_disco): """Test not finding iZone controller.""" with patch( "homeassistant.components.izone.config_flow.async_start_discovery_service" ) as start_disco, patch( "homeassistant.components.izone.config_flow.async_stop_discovery_service", return_value=None, ) as stop_disco: start_disco.side_effect = _mock_start_discovery(hass, mock_disco) result = await hass.config_entries.flow.async_init( IZONE, context={"source": config_entries.SOURCE_USER} ) # Confirmation form assert result["type"] == data_entry_flow.RESULT_TYPE_FORM result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT await hass.async_block_till_done() stop_disco.assert_called_once() async def test_found(hass, mock_disco): """Test not finding iZone controller.""" mock_disco.pi_disco.controllers["blah"] = object() with patch( "homeassistant.components.izone.climate.async_setup_entry", return_value=True, ) as mock_setup, patch( "homeassistant.components.izone.config_flow.async_start_discovery_service" ) as start_disco, patch( "homeassistant.components.izone.async_start_discovery_service", return_value=None, ): start_disco.side_effect = _mock_start_discovery(hass, mock_disco) result = await hass.config_entries.flow.async_init( IZONE, context={"source": config_entries.SOURCE_USER} ) # Confirmation form assert result["type"] == data_entry_flow.RESULT_TYPE_FORM result = await hass.config_entries.flow.async_configure(result["flow_id"], {}) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY await hass.async_block_till_done() mock_setup.assert_called_once()
{ "content_hash": "760d785e1684c409dc058ef88526d348", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 86, "avg_line_length": 32.5, "alnum_prop": 0.6765384615384615, "repo_name": "titilambert/home-assistant", "id": "72b80e75bcf2dfbf85a4386be4db69f3f356a9cb", "size": "2600", "binary": false, "copies": "5", "ref": "refs/heads/dev", "path": "tests/components/izone/test_config_flow.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "1488" }, { "name": "Python", "bytes": "25849092" }, { "name": "Shell", "bytes": "4410" } ], "symlink_target": null }
'use strict'; module.exports = function(name) { name = name.toLowerCase(); if (['test', 'ember', 'vendor'].indexOf(name) > -1) { return false; } if (name.indexOf('.') > -1) { return false; } if (!isNaN(parseInt(name.charAt(0), 10))) { return false; } return true; };
{ "content_hash": "7348df33c00fbd16e554902e3d087b4c", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 71, "avg_line_length": 25.454545454545453, "alnum_prop": 0.5964285714285714, "repo_name": "mattmarcum/ember-cli", "id": "0725a4bcd89be5aaf2007533e2ab04848d78b6f7", "size": "280", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "lib/utilities/valid-project-name.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "318" }, { "name": "JavaScript", "bytes": "722917" }, { "name": "PowerShell", "bytes": "526" }, { "name": "Ruby", "bytes": "219" } ], "symlink_target": null }
End of preview.

No dataset card yet

Downloads last month
4