text
stringlengths 2
100k
| meta
dict |
---|---|
/* crypto/sha/sha.h */
/* Copyright (C) 1995-1998 Eric Young ([email protected])
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young ([email protected]).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson ([email protected]).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young ([email protected])"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson ([email protected])"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#ifndef HEADER_SHA_H
#define HEADER_SHA_H
#include <openssl/e_os2.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1))
#error SHA is disabled.
#endif
#if defined(OPENSSL_FIPS)
#define FIPS_SHA_SIZE_T size_t
#endif
/*
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* ! SHA_LONG has to be at least 32 bits wide. If it's wider, then !
* ! SHA_LONG_LOG2 has to be defined along. !
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*/
#if defined(__LP32__)
#define SHA_LONG unsigned long
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
#define SHA_LONG unsigned long
#define SHA_LONG_LOG2 3
#else
#define SHA_LONG unsigned int
#endif
#define SHA_LBLOCK 16
#define SHA_CBLOCK (SHA_LBLOCK*4) /* SHA treats input data as a
* contiguous array of 32 bit
* wide big-endian values. */
#define SHA_LAST_BLOCK (SHA_CBLOCK-8)
#define SHA_DIGEST_LENGTH 20
typedef struct SHAstate_st
{
SHA_LONG h0,h1,h2,h3,h4;
SHA_LONG Nl,Nh;
SHA_LONG data[SHA_LBLOCK];
unsigned int num;
} SHA_CTX;
#ifndef OPENSSL_NO_SHA0
#ifdef OPENSSL_FIPS
int private_SHA_Init(SHA_CTX *c);
#endif
int SHA_Init(SHA_CTX *c);
int SHA_Update(SHA_CTX *c, const void *data, size_t len);
int SHA_Final(unsigned char *md, SHA_CTX *c);
unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md);
void SHA_Transform(SHA_CTX *c, const unsigned char *data);
#endif
#ifndef OPENSSL_NO_SHA1
#ifdef OPENSSL_FIPS
int private_SHA1_Init(SHA_CTX *c);
#endif
int SHA1_Init(SHA_CTX *c);
int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
int SHA1_Final(unsigned char *md, SHA_CTX *c);
unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md);
void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
#endif
#define SHA256_CBLOCK (SHA_LBLOCK*4) /* SHA-256 treats input data as a
* contiguous array of 32 bit
* wide big-endian values. */
#define SHA224_DIGEST_LENGTH 28
#define SHA256_DIGEST_LENGTH 32
typedef struct SHA256state_st
{
SHA_LONG h[8];
SHA_LONG Nl,Nh;
SHA_LONG data[SHA_LBLOCK];
unsigned int num,md_len;
} SHA256_CTX;
#ifndef OPENSSL_NO_SHA256
#ifdef OPENSSL_FIPS
int private_SHA224_Init(SHA256_CTX *c);
int private_SHA256_Init(SHA256_CTX *c);
#endif
int SHA224_Init(SHA256_CTX *c);
int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
int SHA224_Final(unsigned char *md, SHA256_CTX *c);
unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md);
int SHA256_Init(SHA256_CTX *c);
int SHA256_Update(SHA256_CTX *c, const void *data, size_t len);
int SHA256_Final(unsigned char *md, SHA256_CTX *c);
unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md);
void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
#endif
#define SHA384_DIGEST_LENGTH 48
#define SHA512_DIGEST_LENGTH 64
#ifndef OPENSSL_NO_SHA512
/*
* Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64
* being exactly 64-bit wide. See Implementation Notes in sha512.c
* for further details.
*/
#define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a
* contiguous array of 64 bit
* wide big-endian values. */
#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
#define SHA_LONG64 unsigned __int64
#define U64(C) C##UI64
#elif defined(__arch64__)
#define SHA_LONG64 unsigned long
#define U64(C) C##UL
#else
#define SHA_LONG64 unsigned long long
#define U64(C) C##ULL
#endif
typedef struct SHA512state_st
{
SHA_LONG64 h[8];
SHA_LONG64 Nl,Nh;
union {
SHA_LONG64 d[SHA_LBLOCK];
unsigned char p[SHA512_CBLOCK];
} u;
unsigned int num,md_len;
} SHA512_CTX;
#endif
#ifndef OPENSSL_NO_SHA512
#ifdef OPENSSL_FIPS
int private_SHA384_Init(SHA512_CTX *c);
int private_SHA512_Init(SHA512_CTX *c);
#endif
int SHA384_Init(SHA512_CTX *c);
int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
int SHA384_Final(unsigned char *md, SHA512_CTX *c);
unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md);
int SHA512_Init(SHA512_CTX *c);
int SHA512_Update(SHA512_CTX *c, const void *data, size_t len);
int SHA512_Final(unsigned char *md, SHA512_CTX *c);
unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md);
void SHA512_Transform(SHA512_CTX *c, const unsigned char *data);
#endif
#ifdef __cplusplus
}
#endif
#endif
| {
"pile_set_name": "Github"
} |
Title
=====
[WARNING] Lorem ipsum dolor sit amet
Title
=====
| {
"pile_set_name": "Github"
} |
Car 0.00 0 1.4585490162160735 592.31 173.42 618.51 199.32 1.5673753473727416 1.6565004803897285 3.8833994103000546 -0.35 1.71 48.26 1.451296760437578 0.9863426
Van 0.54 1 1.6876738602903227 0.00 169.10 132.04 290.47 2.2698288778891182 1.8648580262517167 5.1070176752448555 -11.81 2.10 14.28 0.9966666522497802 0.9596992
Van 0.00 1 1.921264306702886 396.67 163.82 457.97 214.66 2.1584335896303273 1.872026840791626 5.045941509136605 -9.10 1.95 36.31 1.6757025154835063 0.99742496
DontCare -1 -1 1.4942497769978385 478.31 167.73 535.64 199.02 1.4503368515340995 1.6733578138710403 4.04206867714981 -1000 -1000 -1000 2.2796479403952867 0.93517053
DontCare -1 -1 1.5772093875010054 553.31 169.81 579.39 190.69 1.523153646272273 1.596797245806589 3.645091967783966 -1000 -1000 -1000 2.3626075508984536 0.9999826
DontCare -1 -1 1.6944604376938681 286.65 180.23 354.40 195.90 1.4475711960165214 1.689387101000681 4.533778803549804 -1000 -1000 -1000 2.4798586010913164 0.7483073
| {
"pile_set_name": "Github"
} |
/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "IGListBindingSectionController.h"
#import <IGListKit/IGListAssert.h>
#import <IGListKit/IGListDiffable.h>
#import <IGListKit/IGListDiff.h>
#import <IGListKit/IGListBindable.h>
#import <IGListKit/IGListAdapterUpdater.h>
#import "IGListArrayUtilsInternal.h"
typedef NS_ENUM(NSInteger, IGListDiffingSectionState) {
IGListDiffingSectionStateIdle = 0,
IGListDiffingSectionStateUpdateQueued,
IGListDiffingSectionStateUpdateApplied
};
@interface IGListBindingSectionController()
@property (nonatomic, strong, readwrite) NSArray<id<IGListDiffable>> *viewModels;
@property (nonatomic, strong) id object;
@property (nonatomic, assign) IGListDiffingSectionState state;
@end
@implementation IGListBindingSectionController
#pragma mark - Public API
- (void)updateAnimated:(BOOL)animated completion:(void (^)(BOOL))completion {
IGAssertMainThread();
if (self.state != IGListDiffingSectionStateIdle) {
if (completion != nil) {
completion(NO);
}
return;
}
self.state = IGListDiffingSectionStateUpdateQueued;
__block IGListIndexSetResult *result = nil;
__block NSArray<id<IGListDiffable>> *oldViewModels = nil;
id<IGListCollectionContext> collectionContext = self.collectionContext;
[self.collectionContext performBatchAnimated:animated updates:^(id<IGListBatchContext> batchContext) {
if (self.state != IGListDiffingSectionStateUpdateQueued) {
return;
}
oldViewModels = self.viewModels;
id<IGListDiffable> object = self.object;
IGAssert(object != nil, @"Expected IGListBindingSectionController object to be non-nil before updating.");
NSArray *newViewModels = [self.dataSource sectionController:self viewModelsForObject:object];
self.viewModels = objectsWithDuplicateIdentifiersRemoved(newViewModels);
result = IGListDiff(oldViewModels, self.viewModels, IGListDiffEquality);
[result.updates enumerateIndexesUsingBlock:^(NSUInteger oldUpdatedIndex, BOOL *stop) {
id identifier = [oldViewModels[oldUpdatedIndex] diffIdentifier];
const NSInteger indexAfterUpdate = [result newIndexForIdentifier:identifier];
if (indexAfterUpdate != NSNotFound) {
UICollectionViewCell<IGListBindable> *cell = [collectionContext cellForItemAtIndex:oldUpdatedIndex
sectionController:self];
[cell bindViewModel:self.viewModels[indexAfterUpdate]];
}
}];
[batchContext deleteInSectionController:self atIndexes:result.deletes];
[batchContext insertInSectionController:self atIndexes:result.inserts];
for (IGListMoveIndex *move in result.moves) {
[batchContext moveInSectionController:self fromIndex:move.from toIndex:move.to];
}
self.state = IGListDiffingSectionStateUpdateApplied;
} completion:^(BOOL finished) {
self.state = IGListDiffingSectionStateIdle;
if (completion != nil) {
completion(YES);
}
}];
}
#pragma mark - IGListSectionController Overrides
- (NSInteger)numberOfItems {
return self.viewModels.count;
}
- (CGSize)sizeForItemAtIndex:(NSInteger)index {
return [self.dataSource sectionController:self sizeForViewModel:self.viewModels[index] atIndex:index];
}
- (UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index {
id<IGListDiffable> viewModel = self.viewModels[index];
UICollectionViewCell<IGListBindable> *cell = [self.dataSource sectionController:self cellForViewModel:viewModel atIndex:index];
[cell bindViewModel:viewModel];
return cell;
}
- (void)didUpdateToObject:(id)object {
id oldObject = self.object;
self.object = object;
if (oldObject == nil) {
self.viewModels = [self.dataSource sectionController:self viewModelsForObject:object];
} else {
IGAssert([oldObject isEqualToDiffableObject:object],
@"Unequal objects %@ and %@ will cause IGListBindingSectionController to reload the entire section",
oldObject, object);
[self updateAnimated:YES completion:nil];
}
}
- (void)didSelectItemAtIndex:(NSInteger)index {
[self.selectionDelegate sectionController:self didSelectItemAtIndex:index viewModel:self.viewModels[index]];
}
- (void)didDeselectItemAtIndex:(NSInteger)index {
id<IGListBindingSectionControllerSelectionDelegate> selectionDelegate = self.selectionDelegate;
if ([selectionDelegate respondsToSelector:@selector(sectionController:didDeselectItemAtIndex:viewModel:)]) {
[selectionDelegate sectionController:self didDeselectItemAtIndex:index viewModel:self.viewModels[index]];
}
}
- (void)didHighlightItemAtIndex:(NSInteger)index {
id<IGListBindingSectionControllerSelectionDelegate> selectionDelegate = self.selectionDelegate;
if ([selectionDelegate respondsToSelector:@selector(sectionController:didHighlightItemAtIndex:viewModel:)]) {
[selectionDelegate sectionController:self didHighlightItemAtIndex:index viewModel:self.viewModels[index]];
}
}
- (void)didUnhighlightItemAtIndex:(NSInteger)index {
id<IGListBindingSectionControllerSelectionDelegate> selectionDelegate = self.selectionDelegate;
if ([selectionDelegate respondsToSelector:@selector(sectionController:didUnhighlightItemAtIndex:viewModel:)]) {
[selectionDelegate sectionController:self didUnhighlightItemAtIndex:index viewModel:self.viewModels[index]];
}
}
@end
| {
"pile_set_name": "Github"
} |
package sockets
import (
"net"
"net/url"
"os"
"strings"
"golang.org/x/net/proxy"
)
// GetProxyEnv allows access to the uppercase and the lowercase forms of
// proxy-related variables. See the Go specification for details on these
// variables. https://golang.org/pkg/net/http/
func GetProxyEnv(key string) string {
proxyValue := os.Getenv(strings.ToUpper(key))
if proxyValue == "" {
return os.Getenv(strings.ToLower(key))
}
return proxyValue
}
// DialerFromEnvironment takes in a "direct" *net.Dialer and returns a
// proxy.Dialer which will route the connections through the proxy using the
// given dialer.
func DialerFromEnvironment(direct *net.Dialer) (proxy.Dialer, error) {
allProxy := GetProxyEnv("all_proxy")
if len(allProxy) == 0 {
return direct, nil
}
proxyURL, err := url.Parse(allProxy)
if err != nil {
return direct, err
}
proxyFromURL, err := proxy.FromURL(proxyURL, direct)
if err != nil {
return direct, err
}
noProxy := GetProxyEnv("no_proxy")
if len(noProxy) == 0 {
return proxyFromURL, nil
}
perHost := proxy.NewPerHost(proxyFromURL, direct)
perHost.AddFromString(noProxy)
return perHost, nil
}
| {
"pile_set_name": "Github"
} |
class Netcat < Formula
desc "Utility for managing network connections"
homepage "http://netcat.sourceforge.net/"
url "https://downloads.sourceforge.net/project/netcat/netcat/0.7.1/netcat-0.7.1.tar.bz2"
sha256 "b55af0bbdf5acc02d1eb6ab18da2acd77a400bafd074489003f3df09676332bb"
bottle do
cellar :any
sha256 "7ae495a909a2a25f6d8314857009a475034994234186682cc8dace4ea3c40b0c" => :yosemite
sha256 "fcdf724d792f286ff086a53f214b26eb2ebf61d6430e0f9305bf274b5faf85a5" => :mavericks
sha256 "d30aa6a393e3b6b28542e1d2a79252cda875e9a0dc817ad6b4920385669a2aaa" => :mountain_lion
end
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--mandir=#{man}",
"--infodir=#{info}"
system "make", "install"
end
test do
assert_match "HTTP/1.0", pipe_output("#{bin}/nc www.google.com 80", "GET / HTTP/1.0\r\n\r\n")
end
end
| {
"pile_set_name": "Github"
} |
--
DELETE FROM `gossip_menu` WHERE `entry` IN (9578) AND `text_id`=12927;
INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES
(9578, 12927);
| {
"pile_set_name": "Github"
} |
var group__power =
[
[ "arm_power_f32", "group__power.html#ga993c00dd7f661d66bdb6e58426e893aa", null ],
[ "arm_power_q15", "group__power.html#ga7050c04b7515e01a75c38f1abbaf71ba", null ],
[ "arm_power_q31", "group__power.html#ga0b93d31bb5b5ed214c2b94d8a7744cd2", null ],
[ "arm_power_q7", "group__power.html#gaf969c85c5655e3d72d7b99ff188f92c9", null ]
]; | {
"pile_set_name": "Github"
} |
/*=============================================================================
Copyright (c) 2006 Tobias Schwinger
http://spirit.sourceforge.net/
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#if !defined(BOOST_SPIRIT_DEBUG_TYPEOF_HPP)
#define BOOST_SPIRIT_DEBUG_TYPEOF_HPP
#include <boost/typeof/typeof.hpp>
#include <boost/spirit/home/classic/namespace.hpp>
#include <boost/spirit/home/classic/core/typeof.hpp>
namespace boost { namespace spirit {
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
// debug_node.hpp
template<typename ContextT> struct parser_context_linker;
template<typename ScannerT> struct scanner_context_linker;
template<typename ContextT> struct closure_context_linker;
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
}} // namespace BOOST_SPIRIT_CLASSIC_NS
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
// debug_node.hpp
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::parser_context_linker,1)
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::scanner_context_linker,1)
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::closure_context_linker,1)
#endif
| {
"pile_set_name": "Github"
} |
<?php
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
/**
* class ilObjectDataCache
*
* @author Stefan Meyer <[email protected]>
* @version $Id$
*
* This class caches some properties of the object_data table. Like title description owner obj_id
*
*/
class ilObjectDataCache
{
public $db = null;
public $reference_cache = array();
public $object_data_cache = array();
public $description_trans = array();
public function __construct()
{
global $DIC;
$ilDB = $DIC->database();
$this->db = $ilDB;
}
public function deleteCachedEntry($a_obj_id)
{
unset($this->object_data_cache[$a_obj_id]);
}
public function lookupObjId($a_ref_id)
{
if (!$this->__isReferenceCached($a_ref_id)) {
//echo"-objidmissed-$a_ref_id-";
$obj_id = $this->__storeReference($a_ref_id);
$this->__storeObjectData($obj_id);
}
return (int) @$this->reference_cache[$a_ref_id];
}
public function lookupTitle($a_obj_id)
{
if (!$this->__isObjectCached($a_obj_id)) {
$this->__storeObjectData($a_obj_id);
}
return @$this->object_data_cache[$a_obj_id]['title'];
}
public function lookupType($a_obj_id)
{
if (!$this->__isObjectCached($a_obj_id)) {
//echo"-typemissed-$a_obj_id-";
$this->__storeObjectData($a_obj_id);
}
return @$this->object_data_cache[$a_obj_id]['type'];
}
public function lookupOwner($a_obj_id)
{
if (!$this->__isObjectCached($a_obj_id)) {
$this->__storeObjectData($a_obj_id);
}
return @$this->object_data_cache[$a_obj_id]['owner'];
}
public function lookupDescription($a_obj_id)
{
if (!$this->__isObjectCached($a_obj_id)) {
$this->__storeObjectData($a_obj_id);
}
return @$this->object_data_cache[$a_obj_id]['description'];
}
public function lookupLastUpdate($a_obj_id)
{
if (!$this->__isObjectCached($a_obj_id)) {
$this->__storeObjectData($a_obj_id);
}
return @$this->object_data_cache[$a_obj_id]['last_update'];
}
/**
* Check if supports centralized offline handling and is offline
* @param $a_obj_id
* @return bool
*/
public function lookupOfflineStatus($a_obj_id)
{
if (!$this->__isObjectCached($a_obj_id)) {
$this->__storeObjectData($a_obj_id);
}
return (bool) $this->object_data_cache[$a_obj_id]['offline'];
}
// PRIVATE
/**
* checks whether an reference id is already in cache or not
*
* @access private
* @param int $a_ref_id reference id
* @return boolean
*/
public function __isReferenceCached($a_ref_id)
{
#return false;
#static $cached = 0;
#static $not_cached = 0;
if (@$this->reference_cache[$a_ref_id]) {
#echo "Reference ". ++$cached ."cached<br>";
return true;
}
#echo "Reference ". ++$not_cached ." not cached<br>";
return false;
}
/**
* checks whether an object is aleady in cache or not
*
* @access private
* @param int $a_obj_id object id
* @return boolean
*/
public function __isObjectCached($a_obj_id)
{
static $cached = 0;
static $not_cached = 0;
if (@$this->object_data_cache[$a_obj_id]) {
#echo "Object ". ++$cached ."cached<br>";
return true;
}
#echo "Object ". ++$not_cached ." not cached<br>";
return false;
}
/**
* Stores Reference in cache.
* Maybe it could be useful to find all references of that object andd store them also in the cache.
* But this would be an extra query.
*
* @access private
* @param int $a_ref_id reference id
* @return int $obj_id
*/
public function __storeReference($a_ref_id)
{
$ilDB = $this->db;
$query = "SELECT obj_id FROM object_reference WHERE ref_id = " . $ilDB->quote($a_ref_id, 'integer');
$res = $this->db->query($query);
while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
$this->reference_cache[$a_ref_id] = $row['obj_id'];
}
return (int) @$this->reference_cache[$a_ref_id];
}
/**
* Stores object data in cache
*
* @access private
* @param int $a_obj_id object id
* @return bool
*/
public function __storeObjectData($a_obj_id, $a_lang = "")
{
global $DIC;
$ilDB = $this->db;
$objDefinition = $DIC["objDefinition"];
$ilUser = $DIC["ilUser"];
if (is_object($ilUser) && $a_lang == "") {
$a_lang = $ilUser->getLanguage();
}
$query = "SELECT * FROM object_data WHERE obj_id = " .
$ilDB->quote($a_obj_id, 'integer');
$res = $this->db->query($query);
while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
$this->object_data_cache[$a_obj_id]['title'] = $row->title;
$this->object_data_cache[$a_obj_id]['description'] = $row->description;
$this->object_data_cache[$a_obj_id]['type'] = $row->type;
$this->object_data_cache[$a_obj_id]['owner'] = $row->owner;
$this->object_data_cache[$a_obj_id]['last_update'] = $row->last_update;
$this->object_data_cache[$a_obj_id]['offline'] = $row->offline;
if (is_object($objDefinition)) {
$translation_type = $objDefinition->getTranslationType($row->type);
}
if ($translation_type == "db") {
if (!$this->trans_loaded[$a_obj_id]) {
$q = "SELECT title,description FROM object_translation " .
"WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
"AND lang_code = " . $ilDB->quote($a_lang, 'text') . " " .
"AND NOT lang_default = 1";
$r = $ilDB->query($q);
$row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
if ($row) {
$this->object_data_cache[$a_obj_id]['title'] = $row->title;
$this->object_data_cache[$a_obj_id]['description'] = $row->description;
$this->description_trans[] = $a_obj_id;
}
$this->trans_loaded[$a_obj_id] = true;
}
}
}
return true;
}
public function isTranslatedDescription($a_obj_id)
{
return (is_array($this->description_trans) &&
in_array($a_obj_id, $this->description_trans));
}
/**
* Stores object data in cache
*
* @access private
* @param int $a_obj_id object id
* @return bool
*/
public function preloadObjectCache($a_obj_ids, $a_lang = "")
{
global $DIC;
$ilDB = $this->db;
$objDefinition = $DIC["objDefinition"];
$ilUser = $DIC["ilUser"];
if (is_object($ilUser) && $a_lang == "") {
$a_lang = $ilUser->getLanguage();
}
if (!is_array($a_obj_ids)) {
return;
}
if (count($a_obj_ids) == 0) {
return;
}
$query = "SELECT * FROM object_data " .
"WHERE " . $ilDB->in('obj_id', $a_obj_ids, false, 'integer');
$res = $ilDB->query($query);
$db_trans = array();
while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
// this if fixes #9960
if (!$this->trans_loaded[$row->obj_id]) {
$this->object_data_cache[$row->obj_id]['title'] = $row->title;
$this->object_data_cache[$row->obj_id]['description'] = $row->description;
}
$this->object_data_cache[$row->obj_id]['type'] = $row->type;
$this->object_data_cache[$row->obj_id]['owner'] = $row->owner;
$this->object_data_cache[$row->obj_id]['last_update'] = $row->last_update;
$this->object_data_cache[$row->obj_id]['offline'] = $row->offline;
if (is_object($objDefinition)) {
$translation_type = $objDefinition->getTranslationType($row->type);
}
if ($translation_type == "db") {
$db_trans[$row->obj_id] = $row->obj_id;
}
}
if (count($db_trans) > 0) {
$this->preloadTranslations($db_trans, $a_lang);
}
}
/**
* Preload translation informations
*
* @param array $a_obj_ids array of object ids
*/
public function preloadTranslations($a_obj_ids, $a_lang)
{
$ilDB = $this->db;
$obj_ids = array();
foreach ($a_obj_ids as $id) {
// do not load an id more than one time
if (!$this->trans_loaded[$id]) {
$obj_ids[] = $id;
$this->trans_loaded[$id] = true;
}
}
if (count($obj_ids) > 0) {
$q = "SELECT obj_id, title, description FROM object_translation " .
"WHERE " . $ilDB->in('obj_id', $obj_ids, false, 'integer') . " " .
"AND lang_code = " . $ilDB->quote($a_lang, 'text') . " " .
"AND NOT lang_default = 1";
$r = $ilDB->query($q);
while ($row2 = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
$this->object_data_cache[$row2->obj_id]['title'] = $row2->title;
$this->object_data_cache[$row2->obj_id]['description'] = $row2->description;
$this->description_trans[] = $row2->obj_id;
}
}
}
public function preloadReferenceCache($a_ref_ids, $a_incl_obj = true)
{
$ilDB = $this->db;
if (!is_array($a_ref_ids)) {
return;
}
if (count($a_ref_ids) == 0) {
return;
}
$query = "SELECT ref_id, obj_id FROM object_reference " .
"WHERE " . $ilDB->in('ref_id', $a_ref_ids, false, 'integer');
$res = $ilDB->query($query);
$obj_ids = array();
while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
$this->reference_cache[$row['ref_id']] = $row['obj_id'];
//echo "<br>store_ref-".$row['ref_id']."-".$row['obj_id']."-";
$obj_ids[] = $row['obj_id'];
}
if ($a_incl_obj) {
$this->preloadObjectCache($obj_ids);
}
}
}
| {
"pile_set_name": "Github"
} |
import Footer from './Footer';
import Nav from './Nav';
import Layout from './Layout';
export default {
Nav,
Layout,
Footer
};
| {
"pile_set_name": "Github"
} |
# JOE syntax highlight file for Javascript
# A (deterministic) state machine which performs lexical analysis of C.
# (This is the "assembly language" of syntax highlighting. A separate
# program could be used to convert a regular expression NFA syntax into this
# format).
# Each state begins with ':<name> <color-name>'
# <color-name> is the color used for characters eaten by the state
# (really a symbol for a user definable color).
# The first state defined is the initial state.
# Within a state, define transitions (jumps) to other states. Each
# jump has the form: <character-list> <target-state> [<option>s]
# There are two ways to specify <character-list>s, either * for any
# character not otherwise specified, or a literal list of characters within
# quotes (ranges and escape sequences allows). When the next character
# matches any in the list, a jump to the target-state is taken and the
# character is eaten (we advance to the next character of the file to be
# colored).
#
# The * transition should be the first transition specified in the state.
#
# There are several options:
# noeat do not eat the character, instead feed it to the next state
# (this tends to make the states smaller, but be careful: you
# can make infinite loops).
#
# recolor=-N Recolor the past N characters with the color of the
# target-state. For example once /* is recognized as the
# start of C comment, you want to color the /* with the C
# comment color.
#
# buffer start copying characters to a buffer, beginning with this
# one (it's ok, to not terminate buffering with a matching
# 'strings' option- the buffer is limited to leading 19
# characters).
#
# strings A list of strings follows. If the buffer matches any of the
# given strings, a jump to the target-state in the string list
# is taken instead of the normal jump.
#
# istrings Same as strings, but case is ignored.
#
# The format of the string list is:
#
# "string" <target-state>
# "string" <target-state>
# done
#
# Weirdness: only states have colors, not transitions. This means that you
# sometimes have to make dummy states with '* next-state noeat' just to get
# a color specification.
# Define no. sync lines
# You can say:
# -200 means 200 lines
# - means always start parsing from beginning of file when we lose sync
# if nothing is specified, the default is -50
# Define colors
#
# bold inverse blink dim underline
# white cyan magenta blue yellow green red black
# bg_white bg_cyan bg_magenta bg_blue bg_yellow bg_green bg_red bg_black
-3000
# Blank characters are outputted in this colour
=Background white bg_000
# Comments
=Comment fg_411
# Most operators
=Special fg_033
# Another class of operators
=Special2 green
# Operators that have a "=" in them
=AssignColor fg_251
# Numeric constants
=Numeric fg_315
# Errors in numeric constants
=InvalidNumber fg_500 bg_542
# Numeric suffixes (U,L,F)
=NumericSuffix fg_415
# String2 constants
=String2 fg_024
=String2Content fg_035
# String1 constants
=String1 fg_021
=String1Content fg_052
# When "\n" is met in a string
=AbruptStringTermination YELLOW bg_100
# Reserved words
=Keyword WHITE
# All other identifiers
=Identifier fg_333
# All unrecognized content
=Mystery fg_500 bg_542
=Regex yellow
########################
# The rules begin here.
:newline Background
* idle noeat
" \t
" newline
# All following states are for when we're not in a preprocessor line
:idle Mystery
* idle
"()?~" special recolor=-1
":[]{},;" special2 recolor=-1
"!<>" maybe_comp recolor=-1
"=" maybe_comp_eq recolor=-1
"-+*%&|^" maybe_op_assign recolor=-1
" \t
" space recolor=-1
"/" slash recolor=-1
"0" first_digit_0 recolor=-1
"1-9" first_digit recolor=-1
"." period recolor=-1
"\"" string2begin recolor=-1 noeat
"'" string1begin recolor=-1 noeat
"a-zA-Z_" ident recolor=-1 buffer
"\n" newline
:space Background
* idle noeat
# Delimiters
:special Special
* idle noeat
:special2 Special2
* idle noeat
:period Special
* idle noeat
"0-9" float recolor=-2
:slash Special
* idle noeat
"*" comment recolor=-2 # "/*"
"/" line_comment recolor=-2 # "//"
"=" was_op_assign recolor=-2 # "/="
"^" regex recolor=-2
"\\" regex_escape recolor=-2
"[" regex_range recolor=-2
:regex Regex
* regex
"\\" regex_escape
"[" regex_range
"/" regex_suffix
"\n" newline
:regex_escape Regex
* regex
:regex_range Regex
* regex_range
"\\" regex_range_escape
"]" regex
"\n" newline
:regex_range_escape Regex
* regex_range
:regex_suffix Regex
* idle noeat
"gi" regex_suffix
# "==" vs "="
:maybe_comp_eq AssignColor
* idle noeat
"=" was_comp recolor=-2
# "<=", ">=", "==", "!="
:maybe_comp Special
* idle noeat
"=" was_comp recolor=-2
:was_comp Special
* idle noeat
# "+=", "-=", "*=", "/=", "%=", "&=", "|="
:maybe_op_assign Special
* idle noeat
"=" was_op_assign recolor=-2
:was_op_assign AssignColor
* idle noeat
# Comments
:comment Comment
* comment
"*" maybe_end_comment
:maybe_end_comment Comment
* comment
"/" idle
"*" maybe_end_comment
:line_comment Comment
* line_comment
"\\" line_comment_escape
"\n" newline
:line_comment_escape Comment
* line_comment
# Numeric constants
:first_digit_0 Numeric
* first_digit noeat
"xX" hex_first
:first_digit Numeric
* number_before_e noeat
:hex_first Numeric
* end_number_suffix noeat recolor=-2
"0-9A-Fa-f" hex
"." hexfloat
:hex Numeric
* end_int noeat
"0-9A-Fa-f" hex
"." hexfloat
"pP" epart
:hexfloat Numeric
* end_number_suffix noeat recolor=-2
"0-9A-Fa-f" hexfloat
"pP" epart
:number_before_e Numeric
* end_int noeat
"0-9" number_before_e
"." float
"eE" epart
:float Numeric
* end_float noeat
"eE" epart
"0-9" float
:epart Numeric
* enum_first noeat
"-+" enum_first
:enum_first Numeric
* end_number_suffix noeat recolor=-2
"0-9" enum
:enum Numeric
* end_float noeat
"0-9" enum
:end_float NumericSuffix
* end_number_suffix noeat
"fFlL" end_number_suffix #f, #l
:end_int NumericSuffix
* end_number_suffix noeat
"uU" int_suffix_u #u
"lL" int_suffix_l #l
:int_suffix_u NumericSuffix
* end_number_suffix noeat
"lL" int_suffix_ul #ul
:int_suffix_ul NumericSuffix
* end_number_suffix noeat
"lL" end_number_suffix #ull
:int_suffix_l NumericSuffix
* end_number_suffix noeat
"uU" end_number_suffix #lu
"lL" int_suffix_ll #ll
:int_suffix_ll NumericSuffix
* end_number_suffix noeat
"uU" end_number_suffix #llu
:end_number_suffix InvalidNumber
* idle noeat
"a-zA-Z_0-9" end_number_suffix
# String2s
:string2begin String2
* string2
:string2end String2
* idle noeat
:string2 String2Content
* string2
"\"" string2end recolor=-1
"\\" string2_escape
"\n" invalid_string_char_flush recolor=-2
:string2_escape String2Content
* string2
"\n" string2
"
" string2_escape_ignore noeat
:string2_escape_ignore Background
* string2_escape
# Chars
:string1begin String1
* string1
:string1end String1
* idle
:string1 String1Content
* string1
"'" string1end noeat
"\\" string1_escape
"\n" invalid_string_char_flush recolor=-2
:string1_escape String1Content
* string1
"\n" string1
"
" string1_escape_ignore noeat
:string1_escape_ignore Background
* string1_escape
# This is if a "\n" is met inside a string2 or string1 constant.
# It serves two purposes:
# Helps getting back in sync
# Minimizes terminal traffic when entering strings
:invalid_string_char_flush AbruptStringTermination
* newline noeat
# Special identifiers
:ident Identifier
* idle noeat strings
"abstract" kw
"boolean" kw
"break" kw
"byte" kw
"case" kw
"catch" kw
"char" kw
"class" kw
"const" kw
"continue" kw
"default" kw
"do" kw
"double" kw
"else" kw
"extends" kw
"false" kw
"final" kw
"finally" kw
"float" kw
"for" kw
"function" kw
"goto" kw
"if" kw
"implements" kw
"import" kw
"in" kw
"instanceof" kw
"int" kw
"interface" kw
"long" kw
"native" kw
"new" kw
"null" kw
"package" kw
"private" kw
"protected" kw
"public" kw
"return" kw
"short" kw
"static" kw
"super" kw
"switch" kw
"synchronized" kw
"this" kw
"throw" kw
"throws" kw
"transient" kw
"true" kw
"try" kw
"val" kw
"var" kw
"while" kw
"with" kw
done
"a-zA-Z0-9_" ident
:kw Keyword
* idle noeat
| {
"pile_set_name": "Github"
} |
# Faker::Music::GratefulDead
```ruby
Faker::Music::GratefulDead.player #=> "Jerry Garcia"
Faker::Music::GratefulDead.song #=> "Cassidy"
```
| {
"pile_set_name": "Github"
} |
#if LESSTHAN_NET35
extern alias nunitlinq;
#endif
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using NUnit.Framework;
using Theraot;
using Theraot.Collections;
using Theraot.Core;
namespace Tests.Theraot.Collections
{
[TestFixture]
internal class ExtensionsGroupProgressiveBy
{
public static void AssertException<T>(Action action) where T : Exception
{
if (action == null)
{
throw new ArgumentNullException(nameof(action));
}
try
{
action();
Assert.Fail();
}
catch (T)
{
// Empty
}
catch (Exception exception)
{
No.Op(exception);
Assert.Fail("Expected: " + typeof(T).Name);
}
}
[Test]
public void GroupProgressiveByArgumentNullTest()
{
string[] data = { "2", "1", "5", "3", "4" };
// GroupProgressiveBy<string,string> (Func<string, string>)
AssertException<ArgumentNullException>(() => ((IEnumerable<string>)null).GroupProgressiveBy(x => "test"));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy<string, string>(null));
// GroupProgressiveBy<string,string> (Func<string, string>, IEqualityComparer<string>)
AssertException<ArgumentNullException>(() => ((IEnumerable<string>)null).GroupProgressiveBy(x => "test", EqualityComparer<string>.Default));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy(null, EqualityComparer<string>.Default));
// GroupProgressiveBy<string,string,string> (Func<string, string>, Func<string, string>)
AssertException<ArgumentNullException>(() => ((IEnumerable<string>)null).GroupProgressiveBy(x => "test", x => "test"));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy<string, string, string>(null, x => "test"));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy(x => "test", (Func<string, string>)null));
// GroupProgressiveBy<string,string,string> (Func<string, string>, Func<string, string>, IEqualityComparer<string>)
AssertException<ArgumentNullException>(() => ((IEnumerable<string>)null).GroupProgressiveBy(x => "test", x => "test", EqualityComparer<string>.Default));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy(null, x => "test", EqualityComparer<string>.Default));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy(x => "test", (Func<string, string>)null, EqualityComparer<string>.Default));
// GroupProgressiveBy<string,string,string> (Func<string, string>, Func<string, IEnumerable<string>, string>)
AssertException<ArgumentNullException>(() => ((IEnumerable<string>)null).GroupProgressiveBy(x => "test", (x, y) => "test"));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy<string, string, string>(null, (x, y) => "test"));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy(x => "test", (Func<string, IEnumerable<string>, string>)null));
// GroupProgressiveBy<string,string,string,string> (Func<string, string>, Func<string, string>, Func<string, IEnumerable<string>, string>)
AssertException<ArgumentNullException>(() => ((IEnumerable<string>)null).GroupProgressiveBy(x => "test", x => "test", (x, y) => "test"));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy<string, string, string, string>(null, x => "test", (x, y) => "test"));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy<string, string, string, string>(x => "test", null, (x, y) => "test"));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy<string, string, string, string>(x => "test", x => "test", null));
// GroupProgressiveBy<string,string,string> (Func<string, string>, Func<string, IEnumerable<string>, string>, IEqualityComparer<string>)
AssertException<ArgumentNullException>(() => ((IEnumerable<string>)null).GroupProgressiveBy(x => "test", (x, y) => "test", EqualityComparer<string>.Default));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy(null, (x, y) => "test", EqualityComparer<string>.Default));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy(x => "test", (Func<string, IEnumerable<string>, string>)null, EqualityComparer<string>.Default));
// GroupProgressiveBy<string,string,string,string> (Func<string, string>, Func<string, string>, Func<string, IEnumerable<string>, string>, IEqualityComparer<string>)
AssertException<ArgumentNullException>(() => ((IEnumerable<string>)null).GroupProgressiveBy(x => "test", x => "test", (x, y) => "test", EqualityComparer<string>.Default));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy(null, x => "test", (x, y) => "test", EqualityComparer<string>.Default));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy<string, string, string, string>(x => "test", null, (x, y) => "test", EqualityComparer<string>.Default));
AssertException<ArgumentNullException>(() => data.GroupProgressiveBy<string, string, string, string>(x => "test", x => "test", null, EqualityComparer<string>.Default));
}
[Test]
public void GroupProgressiveByIsDeferred()
{
var src = new IterateAndCount(10);
var a = src.GroupProgressiveBy(i => i > 5, null);
var b = src.GroupProgressiveBy(i => i > 5, j => "str: " + j.ToString(CultureInfo.InvariantCulture), null);
var c = src.GroupProgressiveBy(i => i > 5, (key, group) => StringEx.Concat(group.ToArray()), null);
var d = src.GroupProgressiveBy(i => i > 5, j => j + 1, (key, group) => StringEx.Concat(group.ToArray()), null);
Assert.AreEqual(src.Total, 0);
a.Consume();
b.Consume();
c.Consume();
d.Consume();
Assert.AreEqual(src.Total, 40);
}
[Test]
public void GroupProgressiveByIsDeferredToGetEnumerator()
{
var src = new IterateAndCount(10);
var a = src.GroupProgressiveBy(i => i > 5, null);
Assert.AreEqual(src.Total, 0);
using (var enumerator = a.GetEnumerator())
{
// GroupProgressiveBy is truly deferred
GC.KeepAlive(enumerator);
Assert.AreEqual(src.Total, 0);
}
Assert.AreEqual(src.Total, 0);
using (var enumerator = a.GetEnumerator())
{
// GroupProgressiveBy is truly deferred
GC.KeepAlive(enumerator);
Assert.AreEqual(src.Total, 0);
}
Assert.AreEqual(src.Total, 0);
}
[Test]
public void GroupProgressiveByLastNullGroup()
{
var values = new List<Data>
{
new Data(0, "a"),
new Data(1, "a"),
new Data(2, "b"),
new Data(3, "b"),
new Data(4, null)
};
var groups = values.GroupProgressiveBy(d => d.String);
var count = 0;
foreach (var group in groups)
{
switch (group.Key)
{
case "a":
Assert.IsTrue(group.Select(item => item.Number).ToArray().SetEquals(new[] { 0, 1 }));
break;
case "b":
Assert.IsTrue(group.Select(item => item.Number).ToArray().SetEquals(new[] { 2, 3 }));
break;
case null:
Assert.IsTrue(group.Select(item => item.Number).ToArray().SetEquals(new[] { 4 }));
break;
default:
Assert.Fail();
break;
}
count++;
}
Assert.AreEqual(3, count);
}
[Test]
public void GroupProgressiveByOverloadA()
{
var src = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var r = src.GroupProgressiveBy(i => i > 5, null);
var rArray = r.ToArray();
Assert.AreEqual(rArray.Length, 2);
var index = 0;
var first = true;
foreach (var g in rArray)
{
Assert.AreEqual(g.Key, !first);
var count = 0;
foreach (var item in g)
{
Assert.AreEqual(item, index + 1);
index++;
count++;
}
Assert.AreEqual(count, 5);
first = false;
}
Assert.AreEqual(index, 10);
}
[Test]
public void GroupProgressiveByOverloadAEx()
{
var src = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var r = src.GroupProgressiveBy(i => i > 5, null);
var rArray = r.ToArray();
Assert.AreEqual(rArray.Length, 2);
var first = true;
foreach (var g in rArray)
{
Assert.AreEqual(g.Key, !first);
Assert.AreEqual(g.Count(), 5);
first = false;
}
}
[Test]
public void GroupProgressiveByOverloadB()
{
var src = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var r = src.GroupProgressiveBy(i => i > 5, j => "str: " + j.ToString(CultureInfo.InvariantCulture), null);
var rArray = r.ToArray();
Assert.AreEqual(rArray.Length, 2);
var index = 0;
var first = true;
foreach (var g in rArray)
{
Assert.AreEqual(g.Key, !first);
var count = 0;
foreach (var item in g)
{
Assert.AreEqual(item, "str: " + (index + 1).ToString(CultureInfo.InvariantCulture));
index++;
count++;
}
Assert.AreEqual(count, 5);
first = false;
}
Assert.AreEqual(index, 10);
}
[Test]
public void GroupProgressiveByOverloadBEx()
{
var src = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var r = src.GroupProgressiveBy(i => i > 5, j => "str: " + j.ToString(CultureInfo.InvariantCulture), null);
var rArray = r.ToArray();
Assert.AreEqual(rArray.Length, 2);
var first = true;
foreach (var g in rArray)
{
Assert.AreEqual(g.Key, !first);
Assert.AreEqual(g.Count(), 5);
first = false;
}
}
[Test]
public void GroupProgressiveByOverloadC()
{
var src = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var r = src.GroupProgressiveBy(i => i > 5, (key, group) => StringEx.Concat(group.ToArray()), null);
var rArray = r.ToArray();
Assert.AreEqual(rArray.Length, 2);
Assert.AreEqual(rArray[0], "12345");
Assert.AreEqual(rArray[1], "678910");
}
[Test]
public void GroupProgressiveByOverloadD()
{
var src = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var r = src.GroupProgressiveBy(i => i > 5, j => j + 1, (key, group) => StringEx.Concat(group.ToArray()), null);
var rArray = r.ToArray();
Assert.AreEqual(rArray.Length, 2);
Assert.AreEqual(rArray[0], "23456");
Assert.AreEqual(rArray[1], "7891011");
}
[Test]
public void GroupProgressiveByOverloadDEx()
{
var src = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var r = src.GroupProgressiveBy(i => i > 5, FuncHelper.GetIdentityFunc<int>(), (key, group) => StringEx.Concat(group.ToArray()), null);
var rArray = r.ToArray();
Assert.AreEqual(rArray.Length, 2);
Assert.AreEqual(rArray[0], "12345");
Assert.AreEqual(rArray[1], "678910");
}
public class IterateAndCount : IEnumerable<int>
{
private readonly int _count;
public IterateAndCount(int count)
{
_count = count;
}
public int Total { get; private set; }
public IEnumerator<int> GetEnumerator()
{
for (var index = 0; index < _count; index++)
{
Total += 1;
yield return Total;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
private sealed class Data
{
public readonly int Number;
public readonly string String;
public Data(int number, string str)
{
Number = number;
String = str;
}
}
}
} | {
"pile_set_name": "Github"
} |
# client/server clipboard application
# ---------------------------------------------------
# (c) Stacom softwaredevelopment 2002
# Freiburg, Germany,
# [email protected]
# ----------------------------------
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# ----------------------------------
# Tested under:
# win NT 4.0 (client)
# Linix (server, client)
# ----------------------------------
# howto start:
# 1) configure server socket data
# 2) start server: >wish vmClip.tcl -server
# 3) start client: >wish vmClip.tcl -client <addrOfClient>
#
# hoto use
# select on client machine text
# press send button of widget
# ...
namespace eval CNF {
variable serverAdr "192.168.0.6"
variable port "9010"
}
package require Tk
proc serverConnect {cid addr port} {
puts "$cid: calling from $addr"
fconfigure $cid -translation binary
fileevent $cid readable "serverData $cid"
}
proc serverData {cid} {
puts "serverData: called from $cid [eof $cid]"
if {[eof $cid]} {
puts "client died ..."
close $cid
}
set lLen [read $cid 4]
binary scan $lLen "I" lLenStr
if {[info exists lLenStr] == 0} {
puts "client died ..."
close $cid
return
}
set lMsg [read $cid $lLenStr]
showData $lMsg
clipboard clear
clipboard append $lMsg
}
proc showData {msg} {
puts "show data:$msg"
set lWn ".text"
if {[string length $msg] == 0} {
return
}
if {[winfo exists $lWn]} {
destroy $lWn
}
set lText [text $lWn -width 30 -heigh 5 -wrap none]
$lText insert end $msg
pack $lText -fill both -expand yes
wm title . vmClipboard
}
proc openClient {addr} {
global gCltSock
wm geometry . +0+0
if {[catch {set gCltSock [socket $addr $::CNF::port]} lErrMsg]} {
error "error connecting to server ($lErrMsg)"
}
fconfigure $gCltSock -translation binary
button .b -command "sendText .t" -text "to $addr" -relief solid
pack .b -side bottom
wm title . "Clipboard $addr"
}
proc sendText {twidget} {
global gCltSock
set lRc [catch {set lClipboardContence [selection get -selection CLIPBOARD]}]
if {$lRc} {
return
}
set lMsg $lClipboardContence
set lDataToSend [binary format "I" [string length $lMsg] ]
append lDataToSend $lMsg
puts -nonewline $gCltSock $lDataToSend
flush $gCltSock
}
# eval cmd line arguments
if {$argc == 0} {
error "need cmd line -client or -server (got:$argv)"
} elseif {[lindex $argv 0] == "-client"} {
set lServerAdr [lindex $argv 1]
openClient $lServerAdr
} elseif {[lindex $argv 0] == "-server"} {
set gServerSock [socket -server serverConnect -myaddr $::CNF::serverAdr $::CNF::port]
}
| {
"pile_set_name": "Github"
} |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.impala.testutil;
import org.apache.impala.authorization.NoopAuthorizationFactory;
import org.apache.impala.authorization.NoopAuthorizationFactory.NoopAuthorizationManager;
import org.apache.impala.catalog.Catalog;
import org.apache.impala.common.ImpalaException;
import org.apache.impala.service.CatalogOpExecutor;
import org.apache.impala.service.Frontend;
import org.apache.impala.thrift.TCatalogUpdateResult;
import org.apache.impala.thrift.TCopyTestCaseReq;
import org.apache.impala.thrift.TDdlExecResponse;
import org.apache.impala.thrift.TQueryCtx;
import org.apache.impala.thrift.TQueryOptions;
/**
* A util class that loads a given testcase file into an in-memory Catalog
* and runs EXPLAIN on the testcase query statement. The catalog is backed by a
* transient HMS instanced based on derby DB.
*
* Runs in a standalone mode without having to start the Impala cluster.
* Expects the testcase path as the only argument.
* Ex: ...PlannerTestCaseLoader hdfs:///tmp/impala-testcase-data-9642a6f6...
*
* Full command example using maven-exec plugin (for an Impala DEV environment):
*
* mvn install exec:java -Dexec.classpathScope="test" \
* -Dexec.mainClass="org.apache.impala.testutil.PlannerTestCaseLoader" \
* -Dexec.args="/tmp/impala-testcase-data-9642a6f6-6a0b-48b2-a61f-f7ce55b92fee"
*
* Running through Maven is just for convenience. Can also be invoked directly using the
* Java binary by setting appropriate classpath.
*
*/
public class PlannerTestCaseLoader implements AutoCloseable {
private final CatalogOpExecutor catalogOpExecutor_;
private final ImpaladTestCatalog catalog_;
private final Frontend frontend_;
public PlannerTestCaseLoader() throws ImpalaException {
catalog_ = new ImpaladTestCatalog(
CatalogServiceTestCatalog.createTransientTestCatalog());
frontend_ = new Frontend(new NoopAuthorizationFactory(), catalog_);
catalogOpExecutor_ = new CatalogOpExecutor(catalog_.getSrcCatalog(),
new NoopAuthorizationFactory().getAuthorizationConfig(),
new NoopAuthorizationManager());
}
public Catalog getSrcCatalog() { return catalog_.getSrcCatalog(); }
/**
* Loads the testcase from a given path and returns the EXPLAIN string for the
* testcase query statement.
*/
public String loadTestCase(String testCasePath) throws Exception {
String stmt = catalogOpExecutor_.copyTestCaseData(new TCopyTestCaseReq(testCasePath),
new TDdlExecResponse(new TCatalogUpdateResult()));
TQueryCtx queryCtx = TestUtils.createQueryContext(
new TQueryOptions().setPlanner_testcase_mode(true));
queryCtx.client_request.setStmt(stmt);
return frontend_.getExplainString(queryCtx);
}
@Override
public void close() {
getSrcCatalog().close();
}
public static void main(String[] args) throws Exception {
if (args.length != 1) {
throw new IllegalArgumentException(String.format("Incorrect number of args. " +
"Expected 1 argument, found %d. Valid usage: PlannerTestCaseLoader " +
"<testcase path>", args.length));
}
try (PlannerTestCaseLoader testCaseLoader = new PlannerTestCaseLoader()) {
System.out.println(testCaseLoader.loadTestCase(args[0]));
}
System.exit(0);
}
}
| {
"pile_set_name": "Github"
} |
// Protocol Buffers for Go with Gadgets
//
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
// http://github.com/gogo/protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// 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 castvalue
type MyWilson Wilson
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ldml SYSTEM "../../common/dtd/ldml.dtd">
<!-- Copyright © 1991-2013 Unicode, Inc.
CLDR data files are interpreted according to the LDML specification (http://unicode.org/reports/tr35/)
For terms of use, see http://www.unicode.org/copyright.html
-->
<ldml>
<identity>
<version number="$Revision: 9876 $"/>
<generation date="$Date: 2014-03-05 23:14:25 -0600 (Wed, 05 Mar 2014) $"/>
<language type="haw"/>
</identity>
<localeDisplayNames>
<languages>
<language type="ar">ʻAlapia</language>
<language type="cy">Wale</language>
<language type="da">Kenemaka</language>
<language type="de">Kelemānia</language>
<language type="el">Helene</language>
<language type="en">Pelekānia</language>
<language type="en_AU">Pelekāne Nū Hōlani</language>
<language type="en_CA">Pelekāne Kanakā</language>
<language type="en_GB">Pelekānia Pekekāne</language>
<language type="en_US">Pelekānia ʻAmelika</language>
<language type="es">Paniolo</language>
<language type="fj">Pīkī</language>
<language type="fr">Palani</language>
<language type="fr_CA">Palani Kanakā</language>
<language type="fr_CH">Kuikilani</language>
<language type="ga">ʻAiliki</language>
<language type="gsw">Kuikilani Kelemānia</language>
<language type="haw">ʻŌlelo Hawaiʻi</language>
<language type="he">Hebera</language>
<language type="it">ʻĪkālia</language>
<language type="ja">Kepanī</language>
<language type="ko">Kōlea</language>
<language type="la">Lākina</language>
<language type="mi">Māori</language>
<language type="nl">Hōlani</language>
<language type="pt">Pukikī</language>
<language type="pt_BR">Pukikī Palakila</language>
<language type="ru">Lūkia</language>
<language type="sm">Kāmoa</language>
<language type="sv">Kuekene</language>
<language type="to">Tonga</language>
<language type="ty">Polapola</language>
<language type="und">ʻIke ʻole ‘ia a kūpono ʻole paha ka ʻōlelo</language>
<language type="vi">Wiekanama</language>
<language type="zh">Pākē</language>
<language type="zh_Hans">Pākē Hoʻomaʻalahi ʻia</language>
<language type="zh_Hant">Pākē Kuʻuna</language>
</languages>
<territories>
<territory type="AU">Nūhōlani</territory>
<territory type="CA">Kanakā</territory>
<territory type="CN">Kina</territory>
<territory type="DE">Kelemānia</territory>
<territory type="DK">Kenemaka</territory>
<territory type="ES">Kepania</territory>
<territory type="FR">Palani</territory>
<territory type="GB">Aupuni Mōʻī Hui Pū ʻIa</territory>
<territory type="GR">Helene</territory>
<territory type="IE">ʻIlelani</territory>
<territory type="IL">ʻIseraʻela</territory>
<territory type="IN">ʻĪnia</territory>
<territory type="IT">ʻĪkālia</territory>
<territory type="JP">Iāpana</territory>
<territory type="MX">Mekiko</territory>
<territory type="NL">Hōlani</territory>
<territory type="NZ">Aotearoa</territory>
<territory type="PH">ʻĀina Pilipino</territory>
<territory type="RU">Lūkia</territory>
<territory type="US">ʻAmelika Hui Pū ʻIa</territory>
</territories>
<measurementSystemNames>
<measurementSystemName type="metric">Mekalika</measurementSystemName>
<measurementSystemName type="US">ʻAmelika Hui Pū ʻIa</measurementSystemName>
</measurementSystemNames>
</localeDisplayNames>
<characters>
<exemplarCharacters>[a ā e ē i ī o ō u ū h k l m n p w ʻ]</exemplarCharacters>
<exemplarCharacters type="auxiliary">[b c d f g j q r s t v x y z]</exemplarCharacters>
<exemplarCharacters type="index" draft="unconfirmed">[A E I O U B C D F G H J K L M N P Q R S T V W ʻ X Y Z]</exemplarCharacters>
</characters>
<dates>
<calendars>
<calendar type="generic">
<dateFormats>
<dateFormatLength type="full">
<dateFormat>
<pattern draft="contributed">EEEE, d MMMM y G</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="long">
<dateFormat>
<pattern draft="contributed">d MMMM y G</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="medium">
<dateFormat>
<pattern draft="contributed">d MMM y G</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="short">
<dateFormat>
<pattern numbers="M=romanlow" draft="contributed">d/M/yy GGGGG</pattern>
</dateFormat>
</dateFormatLength>
</dateFormats>
</calendar>
<calendar type="gregorian">
<months>
<monthContext type="format">
<monthWidth type="abbreviated">
<month type="1">Ian.</month>
<month type="2">Pep.</month>
<month type="3">Mal.</month>
<month type="4">ʻAp.</month>
<month type="5">Mei</month>
<month type="6">Iun.</month>
<month type="7">Iul.</month>
<month type="8">ʻAu.</month>
<month type="9">Kep.</month>
<month type="10">ʻOk.</month>
<month type="11">Now.</month>
<month type="12">Kek.</month>
</monthWidth>
<monthWidth type="wide">
<month type="1">Ianuali</month>
<month type="2">Pepeluali</month>
<month type="3">Malaki</month>
<month type="4">ʻApelila</month>
<month type="5">Mei</month>
<month type="6">Iune</month>
<month type="7">Iulai</month>
<month type="8">ʻAukake</month>
<month type="9">Kepakemapa</month>
<month type="10">ʻOkakopa</month>
<month type="11">Nowemapa</month>
<month type="12">Kekemapa</month>
</monthWidth>
</monthContext>
</months>
<days>
<dayContext type="format">
<dayWidth type="abbreviated">
<day type="sun">LP</day>
<day type="mon">P1</day>
<day type="tue">P2</day>
<day type="wed">P3</day>
<day type="thu">P4</day>
<day type="fri">P5</day>
<day type="sat">P6</day>
</dayWidth>
<dayWidth type="wide">
<day type="sun">Lāpule</day>
<day type="mon">Poʻakahi</day>
<day type="tue">Poʻalua</day>
<day type="wed">Poʻakolu</day>
<day type="thu">Poʻahā</day>
<day type="fri">Poʻalima</day>
<day type="sat">Poʻaono</day>
</dayWidth>
</dayContext>
</days>
<dateFormats>
<dateFormatLength type="full">
<dateFormat>
<pattern draft="contributed">EEEE, d MMMM y</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="long">
<dateFormat>
<pattern draft="contributed">d MMMM y</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="medium">
<dateFormat>
<pattern draft="contributed">d MMM y</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="short">
<dateFormat>
<pattern numbers="M=romanlow" draft="contributed">d/M/yy</pattern>
</dateFormat>
</dateFormatLength>
</dateFormats>
<timeFormats>
<timeFormatLength type="full">
<timeFormat>
<pattern draft="contributed">h:mm:ss a zzzz</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="long">
<timeFormat>
<pattern draft="contributed">h:mm:ss a z</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="medium">
<timeFormat>
<pattern draft="contributed">h:mm:ss a</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="short">
<timeFormat>
<pattern draft="contributed">h:mm a</pattern>
</timeFormat>
</timeFormatLength>
</timeFormats>
<dateTimeFormats>
<availableFormats>
<dateFormatItem id="Ed" draft="contributed">E d</dateFormatItem>
<dateFormatItem id="Gy" draft="contributed">y G</dateFormatItem>
<dateFormatItem id="GyMMM" draft="contributed">MMM y G</dateFormatItem>
<dateFormatItem id="GyMMMd" draft="contributed">d MMM y G</dateFormatItem>
<dateFormatItem id="GyMMMEd" draft="contributed">E, d MMM y G</dateFormatItem>
<dateFormatItem id="Md" draft="contributed">d/M</dateFormatItem>
<dateFormatItem id="MEd" draft="contributed">E, d/M</dateFormatItem>
<dateFormatItem id="MMMd" draft="contributed">d MMM</dateFormatItem>
<dateFormatItem id="MMMEd" draft="contributed">E, d MMM</dateFormatItem>
<dateFormatItem id="yM" draft="contributed">M/y</dateFormatItem>
<dateFormatItem id="yMd" draft="contributed">d/M/y</dateFormatItem>
<dateFormatItem id="yMEd" draft="contributed">E, d/M/y</dateFormatItem>
<dateFormatItem id="yMMM" draft="contributed">MMM y</dateFormatItem>
<dateFormatItem id="yMMMd" draft="contributed">d MMM y</dateFormatItem>
<dateFormatItem id="yMMMEd" draft="contributed">E, d MMM y</dateFormatItem>
</availableFormats>
</dateTimeFormats>
</calendar>
</calendars>
<timeZoneNames>
<zone type="Pacific/Honolulu">
<short>
<generic>HST</generic>
<standard>HST</standard>
<daylight>HDT</daylight>
</short>
</zone>
<metazone type="Alaska">
<short>
<generic>AKT</generic>
<standard>AKST</standard>
<daylight>AKDT</daylight>
</short>
</metazone>
<metazone type="Hawaii_Aleutian">
<short>
<generic>HAT</generic>
<standard>HAST</standard>
<daylight>HADT</daylight>
</short>
</metazone>
</timeZoneNames>
</dates>
<numbers>
<currencyFormats numberSystem="latn">
<currencyFormatLength>
<currencyFormat type="standard">
<pattern>¤#,##0.00</pattern>
</currencyFormat>
<currencyFormat type="accounting">
<pattern>¤#,##0.00;(¤#,##0.00)</pattern>
</currencyFormat>
</currencyFormatLength>
</currencyFormats>
<currencies>
<currency type="USD">
<symbol>$</symbol>
</currency>
</currencies>
</numbers>
<units>
<unitLength type="long">
<unit type="duration-day">
<unitPattern count="one">{0} lā</unitPattern>
<unitPattern count="other">{0} lā</unitPattern>
</unit>
<unit type="duration-hour">
<unitPattern count="one">{0} hola</unitPattern>
<unitPattern count="other">{0} hola</unitPattern>
</unit>
<unit type="duration-minute">
<unitPattern count="one">{0} minuke</unitPattern>
<unitPattern count="other">{0} minuke</unitPattern>
</unit>
<unit type="duration-month">
<unitPattern count="one">{0} mahina</unitPattern>
<unitPattern count="other">{0} mahina</unitPattern>
</unit>
<unit type="duration-second">
<unitPattern count="one">{0} kekona</unitPattern>
<unitPattern count="other">{0} kekona</unitPattern>
</unit>
<unit type="duration-week">
<unitPattern count="one">{0} pule</unitPattern>
<unitPattern count="other">{0} pule</unitPattern>
</unit>
<unit type="duration-year">
<unitPattern count="one">{0} makahiki</unitPattern>
<unitPattern count="other">{0} makahiki</unitPattern>
</unit>
</unitLength>
<unitLength type="narrow">
<unit type="temperature-celsius">
<unitPattern count="one">{0}°C</unitPattern>
<unitPattern count="other">{0}°C</unitPattern>
</unit>
<unit type="temperature-fahrenheit">
<unitPattern count="one">{0}°</unitPattern>
<unitPattern count="other">{0}°</unitPattern>
</unit>
</unitLength>
</units>
</ldml>
| {
"pile_set_name": "Github"
} |
OpenIDE-Module-Short-Description=\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3UI
CTL_TimelineAction=\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3
CTL_TimelineTopComponent=\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3
CTL_TimelineWindowAction=\u6642\u7cfb\u5217
!HINT_TimelineTopComponent=
TimelineTopComponent.enableButton.text=
TimelineTopComponent.closeButton.toolTipText=\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3\u3092\u9589\u3058\u308b
TimelineTopComponent.enableTimelineButton.text=\u6642\u7cfb\u5217\u3092\u6709\u52b9\u5316
TimelineTopComponent.playButton.toolTipText=\u30d7\u30ec\u30a4
# TimelineTopComponent.playButton.intevalNotSet=Cannot animate timeline without an animation interval. Set one before clicking play button
CustomBoundsDialog.labelStartDate.text=\u958b\u59cb:
CustomBoundsDialog.labelIntervalDate.text=\u9593\u9694
CustomBoundsDialog.labelMinDate.text=\u6700\u5c0f:
CustomBoundsDialog.labelMaxDate.text=\u6700\u5927:
CustomBoundsDialog.resetDefaultsDate.text=\u898f\u5b9a\u5024\u306b\u623b\u3059
CustomBoundsDialog.labelEndDate.text=\u7d42\u4e86:
CustomBoundsDialog.labelBounds.text=\u7bc4\u56f2
CustomBoundsDialog.titleHeader.title=\u6642\u9593\u306e\u7bc4\u56f2\u3068\u9593\u9694\u3092\u5909\u66f4
CustomBoundsDialog.titleHeader.description=\u6642\u7cfb\u5217\u306e\u7bc4\u56f2\u3084\u9593\u9694\u3092\u8a2d\u5b9a\u3059\u308b\u3002\u7bc4\u56f2\u306f\u4e0a\u9650\u53ca\u3073\u4e0b\u9650\u306e\u5024\u3067\u3059\u3002\u9593\u9694\u306f\u73fe\u5728\u9078\u629e\u3055\u308c\u3066\u3044\u308b\u6642\u9593\u30a6\u30a3\u30f3\u30c9\u30a6\u3067\u3059\u3002
CustomBoundsDialog.title = \u6642\u9593\u306e\u7bc4\u56f2\u3068\u9593\u9694\u3092\u5909\u66f4
CustomBoundsDialog.FormatValidator.date = \u65e5\u4ed8\u306f{0}\u3068\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3055\u308c\u3066\u3044\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
CustomBoundsDialog.FormatValidator.double = \u6709\u52b9\u306a\u500d\u7cbe\u5ea6\u6d6e\u52d5\u5c0f\u6570\u70b9\u6570\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002
CustomBoundsDialog.TimeValidator = \u4e0b\u9650\u306f\u4e0a\u9650\u3092\u8d85\u3048\u308b\u3053\u3068\u306f\u3042\u308a\u307e\u305b\u3093\u3002
CustomBoundsDialog.TimeValidator.min = \u5024\u306f\u5c11\u306a\u304f\u3068\u3082\u4e0b\u9650\u4ee5\u4e0a\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002
CustomBoundsDialog.TimeValidator.max = \u5024\u306f\u4e0a\u9650\u3092\u8d85\u3048\u308b\u3053\u3068\u306f\u3042\u308a\u307e\u305b\u3093\u3002
TimelineTopComponent.charts.disable = \u7121\u52b9\u5316
TimelineTopComponent.settings.setCustomBounds = \u7bc4\u56f2\u306e\u8a2d\u5b9a...
TimelineTopComponent.charts.empty = \u56f3\u8868\u306a\u3057...
TimelineTopComponent.disabledTimelineLabel.text=\u6642\u7cfb\u5217\u3092\u7121\u52b9\u5316\u3002\u30b0\u30e9\u30d5\u306f\u52d5\u7684\u3067\u3042\u308a\u307e\u305b\u3093\u3002
PlaySettingsDialog.headerTitle.title=\u52d5\u753b\u8a2d\u5b9a
PlaySettingsDialog.headerTitle.description=\u52d5\u753b\u306e\u901f\u5ea6\u3068\u30b9\u30c6\u30c3\u30d7\u3092\u8a2d\u5b9a
PlaySettingsDialog.labelDelay.text=\u9045\u5ef6:
PlaySettingsDialog.labelStepSize.text=\u30b9\u30c6\u30c3\u30d7\u30b5\u30a4\u30ba:
PlaySettingsDialog.labelPerc.text=%
PlaySettingsDialog.labelMs.text=ms
PlaySettingsDialog.labelMode.text=\u30e2\u30fc\u30c9
PlaySettingsDialog.oneBoundRadio.text=\u7247\u5074\u7bc4\u56f2
PlaySettingsDialog.twoBoundsRadio.text=\u4e21\u5074\u7bc4\u56f2
PlaySettingsDialog.labelSpeed.text=\u901f\u5ea6
PlaySettingsDialog.backwardCheckbox.text=\u9006\u65b9\u5411
PlaySettingsDialog.title = \u52d5\u753b\u8a2d\u5b9a
TimelineTopComponent.settings.setPlaySettings = \u518d\u751f\u306e\u8a2d\u5b9a...
TimelineTooltip.min = \u958b\u59cb
TimelineTooltip.max = \u7d42\u4e86
TimelineTooltip.position = \u73fe\u5728\u306e\u4f4d\u7f6e\u306f
TimelineTooltip.chart = \u73fe\u5728\u306e\u5024\u306f
TimelineTopComponent.settings.setTimeFormat = \u6642\u9593\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u8a2d\u5b9a...
TimeFormatDialog.title = \u6642\u9593\u30d5\u30a9\u30fc\u30de\u30c3\u30c8
TimelineTopComponent.enableTimelineButton.toolTipText=\u6642\u9593\u5225\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u306e\u305f\u3081\u6642\u7cfb\u5217\u3092\u6709\u52b9\u5316
TimelineTopComponent.disableButon.toolTipText=\u6642\u7cfb\u5217\u3092\u7121\u52b9\u5316
TimeFormatDialog.headerTitle.title=\u6642\u9593\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u8a2d\u5b9a
TimeFormatDialog.headerTitle.description=\u6642\u9593\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u8a2d\u5b9a\u3059\u308b
TimeFormatDialog.numericRadio.text=\u6570\u5024
TimeFormatDialog.dateRadio.text=\u65e5\u4ed8
# TimeFormatDialog.dateTimeRadio.text=Datetime
| {
"pile_set_name": "Github"
} |
<?xml version='1.0' encoding='UTF-8'?>
<resources xmlns:tools="http://schemas.android.com/tools">
<!--Mode names-->
<string name="mode_easy">عادی</string>
<string name="mode_tag_only">فقط تگ</string>
<string name="mode_indoor">داخلی</string>
<string name="mode_correct">حالت C</string>
<!--Dialogs-->
<string name="transfer_download_current_dialog_title">احتیاط! </string>
<string name="transfer_download_current_dialog_message">تغییراتی انجام دادهاید. میخواهید بهجای دورریختن، آنها را آپلود کنید؟ </string>
<string name="transfer_download_current_upload">آپلود</string>
<string name="transfer_download_current_download">دور بریز و دانلود کن</string>
<string name="transfer_download_current_back">برگشت (کاری نکن)</string>
<string name="upload_problem_title">نمیتوان آپلود کرد</string>
<string name="upload_problem_message">همه یا بخشی از داده آپلود نشد. بعداً تلاش کنید.</string>
<string name="bad_request_message">API با خطا پاسخ داد. لطفاً دادهٔ خود را ذخیره کنید و این مسئله را گزارش دهید:\n\n</string>
<string name="upload_conflict_title">تداخل در آپلود</string>
<string name="upload_conflict_message_version">%1$s \nروی دستگاه شما نسخهٔ %2$d است \nو روی کارساز نسخهٔ %3$d است</string>
<string name="upload_conflict_message_deleted">%1$s \nروی دستگاه شما نسخهٔ %2$d است \nو روی کارساز حذف شده است</string>
<string name="upload_conflict_message_referential">%1$s \nروی دستگاه شما حذف شده است \nاما در کارساز به آن ارجاع وجود دارد</string>
<string name="upload_conflict_message_already_deleted">%1$s \nقبلاً از روی کارساز حذف شده است</string>
<string name="use_local_version">از نسخهٔ من استفاده کن</string>
<string name="use_server_version">از نسخهٔ کارساز استفاده کن</string>
<string name="no_login_data_title">احراز هویت ناموفق بود</string>
<string name="no_login_data_message">اگر از OAuth استفاده میکنید، احتمالاً با باگ مواجه شدهاید؛ لطفاً یک گزارش مشکل بفرستید. اگر از نام کاربری و گذرواژه استفاده میکنید (توصیه نمیشود) لطفاً ببینید درست وارد شده باشند.</string>
<string name="no_connection_title">اتصالی با کارساز برقرار نیست</string>
<string name="no_connection_message">هماکنون نمیتوان به کارساز OSM متصل شد. لطفاً اتصال اینترنتی خود را بررسی کنید یا بعداً دوباره تلاش کنید. </string>
<string name="ssl_handshake_failed">نمیتوان به کارساز OSM متصل شد زیرا HTTPS negotiation ناموفق بود. در تنظیمات API یک اتصال رمزنشده را امتحان کنید.</string>
<string name="wrong_login_data_title">احراز هویت ناموفق بود</string>
<string name="wrong_login_data_message">اگر از OAuth استفاده میکنید، دوباره احراز هویت کنید و مجدداً تلاش نمایید. اگر از نام کاربری و گذرواژه استفاده میکنید (توصیه نمیشود) لطفاً ببینید درست وارد شده باشند.</string>
<string name="wrong_login_data_re_authenticate">احراز هویت مجدد</string>
<string name="forbidden_login_title">ورود ممنوع</string>
<string name="not_found_title">عنصر یافت نشد</string>
<string name="not_found_message">API عنصر یا بستهٔ تغییری با شناسهٔ مشخصشده پیدا نکرد.<br><br></string>
<string name="unknown_error_title">خطای ناشناخته</string>
<string name="unknown_error_message">کد خطای بازگرداندهشده از API یا پیام را نمیتوان پردازش کرد.<br><br></string>
<string name="no_data_title">بدون داده</string>
<string name="no_data_message">منبع پیکربندیشده برای داده اینجا را پوشش نمیدهد.</string>
<string name="required_feature_missing_title">کمبود جزء یا غیرفعالبودن آن</string>
<string name="required_feature_missing_message">این قابلیت وابسته به یکی از اجزای سیستم است که وجود ندارد یا غیرفعال است.</string>
<string name="go_to_openstreetmap">برو به openstreetmap.org</string>
<string name="data_conflict_title">تداخل نسخه</string>
<string name="data_conflict_message">دادهای که دانلود میشود با ویرایشهای شما تداخل دارد. لطفاً پیش از تلاش مجدد، دادهٔ خود را آپلود کنید.</string>
<string name="invalid_bounding_box_title">کادر محصورکنندهٔ نامعتبر</string>
<string name="invalid_bounding_box_message">محدودهٔ انتخابی مطابق با محدودیتهای API نیست. لطفاً محدودهٔ دیگری انتخاب کنید.</string>
<string name="bounding_box_too_large_title">محدودهٔ دانلود خیلی بزرگ</string>
<string name="bounding_box_too_large_message">محدودهای که میخواهید دانلود کنید خیلی بزرگ است یا دربردارندهٔ دادهٔ زیادی است.\n\nلطفاً بیشتر زوم کنید و دوباره تلاش نمایید.</string>
<string name="api_offline_title">API آفلاین</string>
<string name="api_offline_message">API هماکنون آفلاین است. نوشتن یا دریافت داده ممکن نیست.</string>
<string name="out_of_memory_title">کبود حافظه</string>
<string name="out_of_memory_message">Vespucci نمیتواند دادهٔ درخواستی را بار کند. لطفاً مجدداً برنامه را شروع کنید و محدودهٔ کوچکتری را بار نمایید.</string>
<string name="out_of_memory_dirty_message">Vespucci نمیتواند دادهٔ درخواستی را بار کند. لطفاً ویرایشهای خود را ذخیره کنید، برنامه را مجدداً شروع کنید و محدودهٔ کوچکتری را بار نمایید.</string>
<string name="invalid_data_received_title">دریافت دادهٔ نامعتبر</string>
<string name="invalid_data_received_message">اگر خودتان مسبب خطا نبودهاید، لطفاً یک گزارش خطا بفرستید.</string>
<string name="invalid_data_read_title">خوانش پروندهٔ نامعتبر</string>
<string name="invalid_data_read_message">برای آگاهی از قالبهای پشتیبانیشدهٔ پرونده و فیلدهای لازم، مستندات را ببینید.</string>
<string name="file_write_failed_title">ناتوان از نوشتن در پرونده</string>
<string name="file_write_failed_message">Vespucci نمیتواند پرونده را تغییر دهد یا ذخیره کند.</string>
<string name="applying_osc_failed_title">بهکارگیری پروندهٔ OSC ناموفق بود</string>
<string name="applying_osc_failed_message">به احتمال زیاد همهٔ دادهٔ اصلی را، که برای بهکاربستن تغییرات نیاز است، بار نکردهاید.</string>
<!---->
<string name="welcome_title">خوش آمدید</string>
<string name="welcome_message">سپاس که Vespucci را نصب کردید.\n<br><br>پیش از آغاز، نیاز است سه چیز را بدانید:\n<ul><li> با زدن روی نماد قفل در گوشهٔ بالا چپ بین حالتهای قفل (ویرایش غیرفعال) و قفلنشده جابهجا میشوید،</li><li> برای ویرایش OpenStreetMap لازم است ابتدا دادهٔ محدودهٔ موردنظر خود را دانلود کنید (قبل از دانلود زوم کنید)،</li><li> برای افزودن چیز جدید: روی دکمهٔ بزرگ سبزرنگ بزنید و چیزی را که میخواهید بیفزایید انتخاب کنید. سپس مکان موردنظر خود را لمس کنید تا در آنجا قرارش دهید.</li></ul>\nاکنون همه چیز آماده است. نقشه بکشید و خوش بگذرانید!</string>
<string name="welcome_message_fullscreen">\n<br><br>دستگاه شما «کلیدهای نرم» دارد که از دید پنهان هستند. انگشت را از پایین به بالا بکشید تا دوباره نمایان شوند.</string>
<string name="read_introduction">خواندن معرفی</string>
<string name="upgrade_title">این نسخهٔ تازهای از Vespucci است</string>
<string name="upgrade_message">قابلیتها و رفتارهای جدید در یادداشتهای انتشار، ذکر شده است.</string>
<string name="read_upgrade">دربارهٔ نسخهٔ تازه بخوانید</string>
<string name="progress_title">بارکردن</string>
<string name="progress_message">بارکردن داده در حافظه… </string>
<string name="progress_download_message">دانلود داده از کارساز...</string>
<string name="progress_general_title">لطفاً صبر کنید</string>
<string name="progress_deleting_message">حذف… </string>
<string name="progress_searching_message">جستجو… </string>
<string name="progress_saving_message">ذخیرهسازی… </string>
<string name="progress_uploading_message">آپلود...</string>
<string name="progress_preset_message">دانلود پیشتنظیم...</string>
<string name="progress_running_message">اجرا...</string>
<string name="progress_oauth">بارکردن حساب شما در openstreetmap.org برای احراز هویت OAuth...</string>
<string name="progress_building_imagery_database">ساخت پایگاهدادهٔ تصاویر...</string>
<string name="progress_query_oam">پرسوجو از OAM...</string>
<string name="progress_pruning">در حال هرس...</string>
<!--Confirm upload dialog-->
<string name="changes_deleted">«%1$s» حذف شد</string>
<string name="changes_changed">«%1$s» تغییر کرد</string>
<string name="changes_created">«%1$s» ایجاد شد</string>
<string name="confirm_upload_title">آپلود تغییرات</string>
<plurals name="confirm_upload_text">
<item quantity="one">این تغییر آپلود شود؟</item>
<item quantity="other">این %1$d تغییر آپلود شود؟</item>
</plurals>
<string name="confirm_upload_edits_page">تغییرات</string>
<string name="upload_comment_label">توضیح:</string>
<string name="upload_source_label">منبع: </string>
<string name="upload_close_open_changeset_label">ابتدا بستهٔ تغییر باز را ببند:</string>
<string name="upload_close_changeset_label">بستن بستهٔ تغییر:</string>
<string name="upload_request_review_label">درخواست بازبینی:</string>
<!---->
<string name="upload_gpx_description_label">توضیحات</string>
<string name="upload_gpx_tags_label">تگها</string>
<string name="upload_gpx_visibility_label">نمایانی</string>
<string name="upload_validation_error_empty_comment">توضیح نباید خالی باشد</string>
<string name="upload_validation_error_empty_source">منبع نباید خالی باشد</string>
<!--task fragment-->
<string name="openstreetbug_new_title">یادداشت جدید</string>
<string name="openstreetbug_new_bug">گزارش مسئله</string>
<string name="openstreetbug_bug_title">مسئله</string>
<string name="openstreetbug_new_nodeway">ایجاد گره/راه</string>
<string name="openstreetbug_edit_title">ویرایش یادداشت</string>
<string name="openstreetbug_comment_label">نظر: </string>
<string name="openstreetbug_commit_ok">تغییرات وظیفه ذخیره شد</string>
<string name="openstreetbug_commit_fail">ذخیرهسازی تغییرات وظیفه ناموفق بود</string>
<string name="openstreetbug_unknown_task_type">نوع ناشناخته از وظیفه</string>
<string name="openstreetbug_not_supported">%1$s پشتیبانی نمیشود.</string>
<string name="note_description">یادداشت: %1$s - %2$s</string>
<string name="bug_description">%1$s: %2$s - %3$s</string>
<string name="bug_description_2">%1$s: %2$s %3$s - %4$s</string>
<string name="generic_bug">باگ</string>
<string name="osmose_bug">Osmose</string>
<string name="custom_bug">سفارشی</string>
<string name="bug_long_description_1">%1$s: %2$s<br><br>%3$s<br><br>%4$s<br></string>
<string name="bug_long_description_2"><br>آخرین بهروزرسانی:<br>%1$s<br>id: %2$d</string>
<string name="bug_element_1">%1$s (دانلود نشده) #%2$d</string>
<string name="bug_element_2">%1$s %2$s</string>
<string name="maproulette_task_title">وظیفهٔ مپرولت</string>
<string name="maproulette_task_coords">Lat %1$4g, Lon %2$4g</string>
<string name="maproulette_task_explanations">توضیحات</string>
<string name="maproulette_task_set_apikey">تنظیم کلید API برای مپیلاری</string>
<string name="maproulette_task_apikey_not_set">ذخیرهسازی کلید API مپرولت ناموفق بود</string>
<string name="maproulette_task_disable">غیرفعال</string>
<string name="maproulette_task_apikey_set">کلید API مپرولت ذخیره شد</string>
<string name="maproulette_task_no_apikey">کلید API مپرولت وجود ندارد</string>
<!--Unsaved data dialog-->
<string name="unsaved_data_title">احتیاط! </string>
<string name="unsaved_data_message">اگر ادامه دهید تغییرات ذخیرهنشدهتان از بین میرود.</string>
<string name="unsaved_data_proceed">دورانداختن و ادامه</string>
<!--Imagery offset dialog-->
<string name="imagery_offset_title">آفست تصویر</string>
<string name="imagery_offset_description">شرح</string>
<string name="imagery_offset_not_found">تا شعاع ۱۰کیلومتری آفستی یافت نشد! </string>
<string name="imagery_offset_author">تنظیمکننده</string>
<string name="imagery_offset_offset">آفست</string>
<string name="imagery_offset_date">تاریخ ایجاد</string>
<string name="imagery_offset_zoom">زوم</string>
<string name="imagery_offset_distance">مسافت</string>
<string name="zoom_and_offset">زوم %1$d آفست %2$s/%3$s</string>
<string name="set_position_datum_label">مبنای Geodetic</string>
<string name="WGS84">WGS84</string>
<string name="tag_editor_name_suggestion">پیشنهاد نام</string>
<!--Search/Find dialog-->
<string name="tag_editor_name_suggestion_overwrite_message">این پیشنهاد مقادیر محبوبتر را جانشین برخی از مقدارهای تگ میکند.</string>
<string name="search_results_title">نتایج جستجو</string>
<string name="search_online">جستجوی آنلاین</string>
<string name="find_message">ورود متن جستجو</string>
<string name="geocoder_prompt">با</string>
<string name="geocoder_limit_label">در دید</string>
<!--Search objects dialog-->
<string name="search_objects_title">جستجوی اشیا</string>
<string name="search_objects_hint">یک عبارت جستجو/پالایهٔ JOSM وارد کنید</string>
<string name="search_objects_unsupported">عبارت پشتیبانینشده «%1$s»</string>
<!---->
<string name="preset_search_hint">جستجوی پیشتنظیم</string>
<string name="preset_autopreset">پیشتنظیم خودکار</string>
<string name="search">جستجو</string>
<string name="no_valid_preset">پیشتنظیم معتبری نیست!</string>
<string name="save_file">ذخیره در</string>
<string name="existing_track_title">دادهٔ رد GPX موجود است</string>
<string name="existing_track_message">از قبل دادهٔ رد GPX دارید. میتوانید لغو کنید و ابتدا آن را ذخیره نمایید.</string>
<string name="delete_tags">واقعاً همهٔ تگهای «%1$s» را حذف میکنید؟</string>
<!--element information dialog-->
<string name="element_information">اطلاعات عنصر</string>
<string name="id">شناسه</string>
<string name="nodes">گره</string>
<string name="relation_membership">عضویت رابطه</string>
<string name="problem">مشکل</string>
<string name="members">عضوها</string>
<string name="closed">بسته</string>
<string name="version">نسخه</string>
<string name="length_m">طول (متر)</string>
<string name="not_downloaded">دانلود نشده</string>
<string name="empty_role">نقش تهی</string>
<string name="last_edited">آخرین ویرایش</string>
<string name="original">اولیه</string>
<string name="current">کنونی</string>
<string name="goto_element">برو به عنصر</string>
<!--GeoJSON feature display dialog-->
<string name="feature_information">اطلاعات GeoJSON feature</string>
<string name="copy_properties">کپی خصوصیتها</string>
<!--API/Data layer info dialog-->
<string name="data_in_memory">داده در حافظه</string>
<string name="total">کل</string>
<string name="changed">تغییریافته</string>
<string name="ways">راه</string>
<!--Tile layer info dialog-->
<string name="attribution">انتساب</string>
<!--Too much data dialog-->
<string name="too_much_data_title">دادهٔ خیلی زیادی بار شده!</string>
<string name="too_much_data_message">شما %1$d گره بار کردهاید که از محدودیت پیکربندیشده فراتر رفتهاست. این مسئله سبب کُندی خواهد شد و اگر دادهٔ بیشتری بیفزایید احتمال دارد برای ذخیرهسازی وضعیت با مشکلاتی مواجه شوید.</string>
<string name="upload_data_now">آپلود تغییرات</string>
<string name="prune_data_now">هرس داده</string>
<!---->
<string name="error">خطا</string>
<string name="warning">هشدار</string>
<string name="minor_issue">مسئلهٔ کوچک</string>
<string name="unknown_error_level">کد خطای ناشناخته</string>
<!--hidden object warning dialog-->
<string name="attached_object_warning_title">این کنش بر اشیای پنهان متصل اثرگذار است!</string>
<string name="attached_object_warning_message">شیء تغییریافته به عناصر پنهانی متصل است که همراه با آن تغییر میکنند.</string>
<!--This concerns a shown message that should be shown every time-->
<string name="attached_object_warning_continue">خب، باز هم نشان بده</string>
<!--This concerns a shown message that should only be shown once-->
<string name="attached_object_warning_stop">خب، دیگر نشان نده</string>
<!--debug dialog-->
<string name="send_debug_information">ارسال اطلاعات اشکالزدایی</string>
<!--JS console dialog-->
<string name="evaluate">ارزیابی</string>
<string name="js_console_msg_live">حالت زنده!</string>
<string name="js_console_msg_debug">حالت اشکالزدایی!</string>
<string name="js_console_input_hint">جاوااسکریپت را اینجا بنویسید</string>
<string name="js_console_output_hint">خروجی اینجا ظاهر میشود</string>
<!--Validator dialogs-->
<string name="validator_title">مجموعهٔ قواعد %1$s اعتبارسنج</string>
<string name="resurvey_entries">بازنقشهبرداری</string>
<string name="edit_resurvey_title">ویرایش مدخل بازنقشهبرداری</string>
<string name="add_resurvey_title">افزودن مدخل بازنقشهبرداری</string>
<string name="check_entries">بررسی</string>
<string name="edit_check_title">ویرایش مدخل بررسی</string>
<string name="add_check_title">افزودن مدخل بررسی</string>
<string name="max_age">بیشینهٔ عمر</string>
<string name="age">عمر</string>
<string name="check_opt">لازم\nاختیاری</string>
<string name="check_optional">اختیاریِ لازم</string>
<string name="add_resurvey_entry">افزودن مدخل بازنقشهبرداری</string>
<string name="add_check_entry">افزودن مدخل بررسی</string>
<!--Empty relation dialog-->
<string name="empty_relation_title">رابطهٔ تهی</string>
<string name="empty_relation_message">رابطهٔ %1$s هیچ عضوی ندارد.\n\nاگر به همین شکل رهایش کنید، در Vespucci قابلویرایش نخواهد بود.</string>
<string name="add_members">افزودن عضوها</string>
<string name="leave_empty">تهی بماند</string>
<!--GPX waypoint dialog-->
<string name="waypoint_title">نقطهٔ بینراهی GPX</string>
<string name="waypoint_description">نقطهٔ بینراهی: %1$s</string>
<string name="description">توضیح</string>
<string name="created">تاریخ ایجاد</string>
<string name="altitude">ارتفاع</string>
<string name="create_osm_object">ساخت شیء OSM</string>
<string name="create_osm_object_search">ساخت شیء OSM از طریق جستجوی پیشتنظیم</string>
<!--Custom imagery dialogs-->
<string name="custom_layer_title">تصویر سفارشی</string>
<string name="oam_layer_title">تصویر OAM </string>
<string name="wms_endpoints_title">WMS Endpoints</string>
<string name="edit_layer_title">ویرایش مدخل لایه</string>
<string name="add_layer_title">افزودن مدخل لایه</string>
<string name="select_layer_title">انتخاب لایه</string>
<string name="overlay">رولایه</string>
<string name="coverage">پوشش</string>
<string name="coverage_top">بالا</string>
<string name="coverage_left">چپ</string>
<string name="coverage_right">راست</string>
<string name="coverage_bottom">پایین</string>
<string name="toast_invalid_box">کادر نامعتبر یا ناقص</string>
<string name="delete_layer">لایه حذف شود؟</string>
<string name="delete_endpoint">endpoint حذف شود؟</string>
<string name="add_wms_endpoint_title">افزودن WMS endpoint</string>
<string name="edit_wms_endpoint_title">اصلاح WMS endpoint</string>
<string name="add_imagery_from_wms_endpoint">افزودن تصویر از WMS</string>
<!--Layer style dialog-->
<string name="layer_style_title">سبک لایه</string>
<string name="layer_style_stroke_width">پهنای خط دور</string>
<string name="layer_style_color">رنگ</string>
<string name="layer_style_label">برچسب</string>
<string name="json_object_not_displayed">شیء JSON (نمایش نیافته)</string>
<string name="json_array_not_displayed">آرایهٔ JSON (نمایش نیافته)</string>
<!--Layer dialog-->
<string name="layer_geojson">GeoJSON</string>
<string name="layer_mapillary">مپیلاری</string>
<string name="layer_grid">شبکه</string>
<string name="layer_gpx">GPX</string>
<string name="layer_photos">عکسها</string>
<string name="layer_tasks">وظیفهها</string>
<string name="layer_data">دادهٔ OSM</string>
<string name="layer_data_name">دادهٔ %1$s</string>
<string name="layer_flush_tile_cache">پاکسازی نهانگاه کاشی</string>
<string name="layer_change_style">تغییر سبک</string>
<string name="layer_select_imagery">انتخاب تصویر</string>
<string name="layer_category_all">همه</string>
<string name="layer_category_photo">تصویر هوایی</string>
<string name="layer_category_historicphoto">تصویر هوایی تاریخگذشته</string>
<string name="layer_category_map">نقشه</string>
<string name="layer_category_historicmap">نقشهٔ تاریخگذشته</string>
<string name="layer_category_osmbasedmap">نقشهٔ OSM-پایه</string>
<string name="layer_category_qa">تضمین کیفیت</string>
<string name="layer_category_other">سایر</string>
<!--Layer info dialog-->
<string name="layer_info_min_zoom">کمینهٔ زوم</string>
<string name="layer_info_max_zoom">بیشینهٔ زوم</string>
<string name="layer_info_start_date">تاریخ آغاز</string>
<string name="layer_info_end_date">تاریخ پایان</string>
<string name="layer_info_terms">مقررات</string>
<string name="layer_info_privacy_policy">سیاست حریم خصوصی</string>
<!--Photo viewer-->
<string name="photo_viewer_delete_title">حذف عکس</string>
<string name="photo_viewer_delete_button">حذف همیشگی</string>
<string name="photo_viewer_goto">برو به عکس</string>
<string name="photo_viewer_label">نمایشگر عکس</string>
<string name="mapillary_viewer_label">نمایشگر مپیلاری</string>
<!--API info dialog-->
<string name="api_info_bounds">کادر محصورکننده</string>
<string name="api_info_latest_date">آخرین تاریخ شامل شده</string>
<string name="api_info_attribution">انتساب</string>
<string name="api_info_mapsplit_source">منبع فقط خواندنی MapSplit</string>
<!--Undo - Redo dialog-->
<string name="checkpoints">نقاط بازگشت</string>
<string name="undo_redo_title">واگرد - ازنو</string>
<string name="undo_redo_one">فقط نقطهٔ انتخابشده (ناامن)</string>
<string name="undo_all">واگردانی همهٔ نقاط بعدی (امن)</string>
<string name="redo_all">انجام دوبارهٔ همهٔ نقاط قبلی (امن)</string>
<!--Undo location not in view dialog-->
<string name="undo_location_title">مکان واگرد خارج از دید است</string>
<string name="undo_location_text">مکانی که واگرد میشود در دید نیست.</string>
<string name="undo_location_undo_anyway">واگرد</string>
<string name="undo_location_zoom">زوم روی مکان، سپس واگرد</string>
<!--Feedback activity-->
<string name="feedback_with_displayname">با نام نمایشی شما در OpenStreetMap فرستاده شود</string>
<string name="feedback_displayname_hint">نام نمایشی OpenStreetMap هنوز دریافت نشده</string>
<string name="feedback_title">بازخورد به توسعهدهندگان</string>
<!--BoxPicker-->
<string name="boxpicker_firsttimetitle">دانلود دادهٔ OpenStreetMap</string>
<!--Clear/Reset GPX Track-->
<string name="clear_track_description">ردگیری را متوقف و همهٔ نقاط ذخیرهشدهٔ رد را حذف کن. این کار برگشتپذیر نیست.</string>
<!--Tips-->
<string name="tip_title">آیا میدانستید؟</string>
<string name="tip_check_label">نکات اختیاری را دیگر نشان نده</string>
<string name="tip_undo">نگهداشتن دکمهٔ واگرد، همهٔ نقاط بازگشت واگرد/ازنو را نمایش میدهد.</string>
<string name="tip_imagery_privacy">لایههای پسزمینه و رولایه از منابع ثالث فراهم شده. با استفاده از هر لایه، آدرس شبکهٔ شما و اطلاعات تقریبی از منطقهای که مشاهده میکنید برای ارائهدهنده ارسال میشود.<p>اگر ارائهدهنده دربارهٔ سیاست حریم خصوصیاش چیزی فراهم کرده باشد، میتوانید آن را در کادر لایه » اطلاعات مشاهده کنید.</string>
<string name="tip_pan_and_zoom_auto_download">قابلیت «دانلود خودکار همزمان با جابهجایی و زوم» را باید با احتیاط به کار برد زیرا بهطور بالقوه میتواند به API اوپناستریتمپ و نیز به دستگاه شما فشار زیادی وارد کند. <p> میتوان با استفاده از منبع دادهٔ آفلاین از واردآمدن فشار بر کارسازهای API پیشگیری کرد.</string>
<string name="tip_locked_mode">در حالت قفل نمیتوانید ویرایش کنید، اما با لمس طولانی یک شیء، جزئیاتی از آن نمایش مییابد.</string>
<string name="tip_longpress_simple_mode">در حالت آسان لمس طولانی کاری نمیکند. اگر میخواهید با لمس طولانی چیزهایی ایجاد کنید، حالت آسان را در منوی اصلی خاموش نمایید.</string>
<!--NumberPicker-->
<string name="plus_sign">+</string>
<string name="minus_sign">-</string>
<string name="digit_one">1</string>
<!--NotificationChannels-->
<string name="default_channel_name">پیشفرض وسپوچی</string>
<string name="default_channel_description">کانال اعلان پیشفرض</string>
<string name="qa_channel_name">Vespucci QA</string>
<string name="qa_channel_description">کانال هشدار تضمین کیفیت برای وظیفهها و مشکلات داده</string>
<!--Toaster-->
<string name="toast_permission_denied">اجازه داده نشد %1$s</string>
<string name="toast_name_empty">نامی برگزینید</string>
<string name="toast_url_empty">یک URL وارد کنید</string>
<string name="toast_min_zoom">زوم کمینه را کمتر از بیشینه تنظیم کنید</string>
<string name="toast_no_changes">هنوز چیزی را تغییر ندادهاید...</string>
<string name="toast_jpeg_not_transparent">فایلهای JPEG شفاف نیستند و نمیشود برای رولایه استفاده شوند.</string>
<string name="toast_unsaved_changes">ابتدا تغییرات ذخیرهنشدهٔ خود را آپلود کنید.</string>
<string name="clear_anyway">در هر صورت پاک شود؟</string>
<string name="toast_upload_success">در کارساز OSM آپلود شد.</string>
<string name="toast_not_in_edit_range">برای ویرایش لطفاً زوم کنید (کلیدهای ↑/↓ صدا یا lens/shift)</string>
<string name="toast_unlock_to_edit">برای ویرایش قفل را باز کنید</string>
<string name="toast_save_done">ذخیره شد</string>
<string name="toast_save_failed">نمیتوان ذخیره کرد</string>
<string name="toast_export_failed">نمیتوان برونبرد کرد</string>
<string name="toast_export_success">به %1$s برونبرد شد</string>
<string name="toast_preset_overwrote_tags">توجه - پیشتنظیم تگ(ها) را بَرنویسی کرد</string>
<string name="toast_merge_overwrote_tags">توجه - کنش تگ(ها) را بَرنویسی کرد</string>
<string name="toast_cant_autoapply_preset">این پیشتنظیم را نمیتوان بهطور خودکار به کار برد</string>
<string name="toast_oneway_reversed">خیابانی یکطرفه یا راهی با تگهای وابسته به جهت را معکوس نمودید. لطفاً تگها را بررسی و در صورت نیاز آنها را اصلاح نمایید.</string>
<string name="toast_merge_tag_conflict">عناصری را ادغام کردید که مقدار تگهایشان، مفاهیم وابسته به جهت آنها یا نقشی که در یک رابطه میگیرند، با هم تداخل دارد. لطفاً تگها و نقشها را بررسی و در صورت نیاز آنها را اصلاح کنید.</string>
<string name="toast_potential_merge_tag_conflict">تلاش میکنید عناصری را ادغام نمایید که مقدار تگهایشان با هم تداخل دارد.\n\nلطفاً تگها را بررسی کنید و پیش از تلاش مجدد آنها را اصلاح نمایید.</string>
<string name="toast_state_file_failed">پروندهٔ state غیرقابلخواندن یا خراب
</string>
<string name="toast_way_nodes_moved">%1$d گره در راهِ جابهجاشده</string>
<plurals name="toast_unread_mail">
<item quantity="one">یک پیام نخوانده دارید</item>
<item quantity="other">%1$d پیام نخوانده دارید</item>
</plurals>
<string name="read_mail">خواندن</string>
<string name="toast_photo_indexing_started">پویش عکسهای زمینمرجع آغاز شد</string>
<string name="toast_photo_indexing_finished">پویش عکسهای زمینمرجع پایان یافت</string>
<string name="toast_download_failed">دانلود با کد خطای %1$d شکست خورد، پیام %2$s</string>
<string name="toast_unsurveyed_road">جادهٔ نقشهبردارینشده</string>
<string name="toast_noname">جاده نام یا ref ندارد</string>
<string name="toast_notype">نوع رابطه مشخص نشده</string>
<string name="toast_untagged_way">راه بیتگ</string>
<string name="toast_untagged_relation">رابطهٔ بیتگ</string>
<string name="toast_unconnected_end_node">گره نزدیک عنصری است که میتواند به آن متصل شود</string>
<string name="toast_degenerate_way">راه مسدود شده</string>
<!---->
<string name="toast_oauth_retry">پس از اینکه اجازه دادید OAuth به حساب OSMتان دسترسی داشته باشد دوباره برای آپلود تلاش کنید.</string>
<string name="toast_oauth">لطفاً دسترسی به حساب OSM خود را برای OAuth مجاز کنید.</string>
<string name="toast_no_oauth">برای API کنونی هیچ پیکربندی OAuth انجام نشده است. لطفاً نام کاربری و گذرواژه را تنظیم کنید.</string>
<string name="toast_oauth_not_enabled">OAuth برای API کنونی فعال نشده است.</string>
<string name="toast_oauth_timeout">هنگام دستدهی برای احراز هویت، مهلت پایان یافت. لطفاً مجدداً تلاش کنید.</string>
<string name="toast_oauth_communication">هنگام دستدهی برای احراز هویت، خطای ارتباطی رخ داد. لطفاً مجدداً تلاش کنید.</string>
<string name="toast_oauth_handshake_failed">دستدهی با OAuth ناموفق بود: %1$s</string>
<string name="toast_timeout">پایان مهلت از سمت کارساز</string>
<string name="coordinates_out_of_range">طول جغرافیایی باید بین -180°/+180° باشد، عرض جغرافیایی بین -85°/85°</string>
<string name="toast_nothing_found">چیزی پیدا نشد</string>
<string name="toast_statesave_failed">ذخیرهسازی وضعیت کنونی ناموفق بود!\nاین خطایی مهلک است. در حال تلاش برای نوشتن پروندهای که بتوانید با JOSM بازیابیاش کنید.</string>
<string name="toast_missing_filemanager">لطفاً برنامهای برای مدیریت پروندهها نصب کنید.</string>
<string name="toast_outside_of_download">برای ویرایش این محدوده دادهٔ بیشتری دانلود کنید.</string>
<string name="toast_file_not_found">%1$s پیدا نشد.</string>
<plurals name="toast_imported_track_points">
<item quantity="one">%1$d نقطهٔ رد و 1 نقطهٔ بینراهی GPX درونبرد شد.</item>
<item quantity="other">%1$d نقطهٔ رد و %2$d نقطهٔ بینراهی GPX درونبرد شد.</item>
</plurals>
<string name="toast_unknown_voice_command">ببخشید، هماکنون %1$s فهمیده نشد</string>
<string name="toast_inconsistent_state">وضعیت ناپایدار تشخیص داده شد. لطفاً گزارش خطا را بفرستید.</string>
<string name="toast_camera_error">اجرای برنامهٔ دوربین ناموفق بود: %1$s</string>
<string name="toast_no_voice">امکاناتی برای تشخیص گفتار وجود ندارد</string>
<string name="toast_storage_error">وسپوچی نمیتواند %1$s را بنویسد.\n ممکن است بهسبب مجوزهای ناکافی یا مسئلهای فنی در دستگاهتان باشد.</string>
<string name="toast_no_suitable_storage">سیستم مکان مناسبی برای پایگاهدادهٔ کاشی برنگرداند.</string>
<string name="toast_min_one_preset">دستکم باید یک پیشتنظیم انتخاب شده باشد!</string>
<string name="toast_min_one_geocoder">دستکم باید یک زمینکدیاب (geocoder) انتخاب شده باشد!</string>
<string name="toast_used_backup">پروندهٔ وضعیت خراب است. درعوض، پروندهٔ پشتیبان به کار رفت.</string>
<string name="toast_used_bug_backup">پروندهٔ وضعیت باگ خراب است. درعوض، پروندهٔ پشتیبان به کار رفت.</string>
<string name="toast_split_from">راه from دو نیم شد</string>
<string name="toast_split_via">راه via دو نیم شد</string>
<string name="toast_split_from_and_via">راه from و via دو نیم شدند</string>
<string name="toast_split_to">راه to دو نیم شد</string>
<string name="toast_tile_database_issue_short">مسئله با پایگاهدادهٔ کاشی</string>
<string name="toast_tile_database_issue">مسئلهای جدی مربوط به پایگاهدادهٔ کاشی نقشه وجود دارد \n%1$s\nلطفاً پرسشهای رایج را در https://vespucci.io مطالعه کنید.</string>
<string name="toast_invalid_apiurl">API URL نامعتبر</string>
<string name="toast_invalid_readonlyurl">ReadOnly API URL نامعتبر</string>
<string name="toast_invalid_notesurl">API URL یادداشتها نامعتبر است</string>
<string name="toast_invalid_preseturl">URL پیشتنظیم نامعتبر است</string>
<string name="toast_invalid_filter_regexp">عبارت باقاعده در پالایه با key=\\"%1$s\\" value=\\"%2$s\\" نامعتبر است</string>
<string name="toast_error_accessing_photo">دسترسی به عکس %1$s ممکن نیست</string>
<string name="toast_security_error_accessing_photo">دسترسی به عکس %1$s مجاز نیست</string>
<string name="toast_no_voice_recognition">امکانات تشخیص گفتار یافت نشد</string>
<string name="toast_no_coverage">%1$s اینجا را پوشش نمیدهد</string>
<string name="toast_file_exists">پروندهٔ %1$s وجود دارد.</string>
<string name="toast_needs_resurvey">شیء ممکن است تاریخگذشته باشد</string>
<string name="toast_missing_key">کمبود کلید %1$s </string>
<string name="toast_invalid_object">شیء نامعتبر</string>
<string name="toast_openinghours_invalid">مقدار ساعت کاری برای %1$s نامعتبر است</string>
<string name="toast_openinghours_autocorrected">مقدار ساعت کاری برای %1$s بهطور خودکار درست شد</string>
<string name="toast_exit_multiselect">برای خروج، فضایی خالی را دو بار پیاپی لمس کنید یا روی → بزنید</string>
<string name="toast_exit_actionmode">برای ذخیره و خروج روی → بزنید</string>
<string name="toast_abort_actionmode">برای لغو روی → بزنید</string>
<string name="toast_null_island">لطفاً در 0°/0° (جزیرهٔ پوچ) عنصری اضافه نکنید</string>
<string name="toast_string_too_long">رشته بسیار طولانی است (%1$d نویسه). کوتاه شد!</string>
<string name="toast_illegal_operation">کنش غیرمجاز: %1$s</string>
<string name="toast_preset_creation_failed">ساخت پیشتنظیم \"%1$s\": %2$s ناموفق بود</string>
<string name="toast_imperial_units">کمبود یکاهای امپراطوری</string>
<string name="toast_server_connection_failed">نمیتوان به کارساز متصل شد: %1$s</string>
<string name="toast_flus_all_caches">این کار همهٔ نهانگاههای کاشی را پاکسازی میکند!</string>
<string name="toast_applied_offset">آفست تصویر به کار گرفته شد.</string>
<string name="toast_unsupported_format">قالب پشتیبانینشده: %1$s</string>
<string name="toast_returning_less_than_found">در حال برگرداندن %1$d مدخل از %2$d یافته</string>
<string name="toast_not_mbtiles">پرونده در قالب MBTiles نیست</string>
<string name="toast_using_network_location">استفاده از مکان شبکه</string>
<string name="toast_using_gps_location">استفاده از مکان GPS/GNSS</string>
<string name="toast_using_gps_disabled_tracking_stopped">موقعیتیابی GPS/GNSS خاموش شد، ردیابی GPX متوقف شد</string>
<string name="toast_remote_nmea_connection">اتصال راه دور NMEA از/به %1$s</string>
<string name="toast_remote_nmea_connection_closed">اتصال راه دور NMEA بسته شد</string>
<string name="toast_tags_copied">تگها در بریدهدادن کپی شد</string>
<string name="toast_tags_cut">تگها به بریدهدادن انتقال یافت</string>
<string name="toast_properties_copied">خصوصیتها به بریدهدان کپی شد</string>
<string name="toast_task_conflict">%1$s روی کارساز تغییر کرده است. ابتدا آپلود و سپس مجدداً دانلود کنید.</string>
<string name="toast_move_note_warning">فقط یادداشتهای تازه را میتوان جابهجا کرد</string>
<string name="toast_task_layer_disabled">لایهٔ وظیفه غیرفعال شد</string>
<string name="toast_unable_to_create_task_layer">ایجاد لایهٔ وظیفه ناموفق بود</string>
<string name="toast_merged">ادغام شد</string>
<string name="toast_invalid_style_file">پروندهٔ سبک %1$s قالب نامعتبر دارد</string>
<string name="toast_no_geometry">هندسهای برای عنصر یافت نشد</string>
<string name="toast_added_api_entry_for">مدخل API برای %1$s افزوده شد</string>
<string name="toast_updated">%1$s بهروز شد</string>
<string name="toast_cannot_resume_download_of">نمیتوان دانلود %1$s را از سر گرفت</string>
<string name="toast_device_not_found_for">دستگاه برای %1$s یافت نشد</string>
<string name="toast_file_already_exists">پروندهٔ %1$s وجود دارد</string>
<string name="toast_file_error_for">خطای پرونده برای %1$s</string>
<string name="toast_error_reading">خطا هنگام خوانش %1$s</string>
<string name="toast_http_data_error_for">خطای دادهٔ HTTP برای %1$s</string>
<string name="toast_error_insufficient_space_for">برای %1$s فضای دستگاه کافی نیست</string>
<string name="toast_error_too_many_redirects_for">تغییرمسیرهای خیلی زیاد برای %1$s</string>
<string name="toast_error_too_unhandled_http_code_for">کد HTTP مهارنشده برای %1$s</string>
<string name="toast_unknown_error_for">خطای ناشناخته برای %1$s</string>
<string name="toast_download_started">دانلود %1$s آغاز شد</string>
<string name="toast_phone_number_reformatted">شمارهتلفن مجدداً قالبدهی شد</string>
<string name="toast_members_not_downloaded">برخی از عضوهای رابطه دانلود نشده است</string>
<string name="toast_restart_required">برای بهکارگیری تغییرات باید وسپوچی را مجدداً شروع کنید</string>
<string name="toast_unable_to_open_offline_data">ناتوان از بازکردن دادهٔ آفلاین %1$s %2$s</string>
<string name="toast_no_usable_location">هیچ مکانی قابل استفاده نیست</string>
<plurals name="added_required_elements">
<item quantity="one">عنصر ضروری افزوده شد</item>
<item quantity="other">%1$d عنصر ضروری افزوده شد</item>
</plurals>
<string name="toast_out_of_memory">حافظه پر شد!</string>
<string name="toast_egm_installed">EGM دانلود و نصب شد</string>
<string name="toast_invalid_number_format">قالب نامعتبر عدد %1$s</string>
<string name="toast_error_downloading_mapillary_image">خطا هنگام دانلود تصویر مپیلاری %1$s</string>
<string name="toast_error_downloading_mapillary_sequences">خطا هنگام دانلود دنبالههای مپیلاری %1$s</string>
<!--Error messages-->
<string name="error_mapsplit_missing_zoom">برای منابع MapSplit باید زوم کمینه و بیشینه تنظیم شده باشد</string>
<string name="error_pbf_no_version">پروندهٔ PBF اطلاعات نسخه ندارد</string>
<string name="error_pbf_unknown_relation_member_type">نوع ناشناختهٔ %1$s برای عضو رابطه</string>
<!--Some generic labels/buttons-->
<string name="yes">بله</string>
<string name="no">خير</string>
<string name="okay">تأیید</string>
<string name="cancel">لغو</string>
<string name="dismiss">رهاکردن</string>
<string name="done">تمام</string>
<string name="locked">قفل</string>
<string name="next">بعدی</string>
<string name="apply">بهکارگیری</string>
<string name="set">تنظیم</string>
<string name="replace">جانشینی</string>
<string name="save">ذخیره</string>
<string name="save_and_set">ذخیره و تنظیم</string>
<string name="back">عقب</string>
<string name="forward">جلو</string>
<string name="keep">حفظ</string>
<string name="enable">فعال</string>
<string name="disable">غیرفعال</string>
<string name="clear">پاکسازی</string>
<string name="discard">دورانداختن</string>
<string name="retry">تلاش مجدد</string>
<string name="prune">هرس</string>
<string name="check">بررسی</string>
<!--Read a file-->
<string name="read">خواندن</string>
<string name="overwrite">بَرنویسی</string>
<string name="share">همرسانی</string>
<string name="share_position">همرسانی موقعیت</string>
<string name="share_on_openstreetmap">همرسانی در OpenStreetMap</string>
<string name="min">کمینه</string>
<string name="max">بیشینه</string>
<string name="geojson_object">%1$s (%2$s)</string>
<string name="none">هیچ</string>
<!--Dialog for back button-->
<string name="exit_title">خروج از وسپوچی</string>
<string name="exit_text">واقعاً خارج میشوید؟</string>
<string name="pause_exit_text">ردگیری را نگه میدارید و خارج میشوید؟</string>
<!--Strings in PorpertyEditor-->
<string name="key">کليد</string>
<string name="Key">کلید</string>
<string name="value">مقدار</string>
<string name="Value">مقدار</string>
<string name="multiselect_header_short">مقدار (%1$d)</string>
<string name="multiselect_header_long">مقدارها (برای %1$d عنصر)</string>
<string name="link_mapfeatures">https://wiki.openstreetmap.org/wiki/Fa:Map_Features</string>
<string name="tag_menu_address">افزودن تگهای نشانی</string>
<string name="tag_menu_sourcesurvey">بررسی میدانی</string>
<string name="tag_menu_preset">پیشتنظیمها</string>
<string name="tag_menu_apply_preset">بهکارگیری پیشتنظیم</string>
<string name="tag_menu_apply_preset_with_optional">بهکارگیری پیشتنظیم با کلیدهای اختیاری</string>
<string name="tag_menu_revert">واگرد</string>
<string name="tag_menu_mapfeatures">ویکی عارضهٔ نقشه</string>
<string name="tag_menu_addtorelation">افزودن به رابطه</string>
<string name="tag_menu_resetMRU">بازنشانی پیشتنظیمها</string>
<string name="tag_menu_reset_address_prediction">بازنشانی پیشبینی نشانی</string>
<string name="tag_menu_exit_no_save">خروج\nبدون ذخیرهسازی</string>
<string name="tag_menu_delete_unassociated_tags">حذف تگهای ناوابسته</string>
<string name="tag_menu_top">پیمایش به بالا</string>
<string name="tag_menu_bottom">پیمایش به پایین</string>
<string name="tag_value_hint">مقداری بنویسید</string>
<string name="tag_autocomplete_value_hint">برای مقداردهی، بنویسید یا لمس کنید</string>
<string name="tag_autocomplete_name_hint">برای پیشنهادهای نام، بنویسید یا لمس کنید</string>
<string name="tag_tap_to_edit_hint">لمس برای ویرایش</string>
<string name="tag_multi_value_hint">چندین مقدار</string>
<string name="tag_dialog_value_hint">لمس برای مقدارها</string>
<string name="tag_action_tag_title">تگ(ها) انتخاب شد</string>
<string name="tag_action_members_title">عضو(ها) انتخاب شد</string>
<string name="tag_action_parents_title">رابطه(ها) انتخاب شد</string>
<string name="tag_additional_properties">خصوصیات بیشتر</string>
<string name="tag_details">جزئیات</string>
<string name="tag_not_set">تنظیم نشده</string>
<string name="tag_menu_move_up">برو بالا</string>
<string name="tag_menu_move_top">برو ابتدا</string>
<string name="tag_menu_move_down">برو پایین</string>
<string name="tag_menu_move_bottom">برو انتها</string>
<string name="tag_menu_sort">مرتبسازی</string>
<string name="tag_menu_reverse_order">ترتیب برعکس</string>
<string name="tag_menu_download">دانلود</string>
<string name="tag_menu_js_console">JS console</string>
<string name="menu_up">عقب</string>
<string name="menu_top">ابتدا</string>
<string name="menu_select_all">انتخاب همه</string>
<string name="menu_deselect_all">انتخاب هیچ</string>
<string name="menu_preset_help">راهنمای پیشتنظیم</string>
<string name="internationalized_hint">%1$s (%2$s)</string>
<string name="tag_menu_i18n">افزودن تگهای زبان</string>
<string name="tag_restriction_header">مقدار</string>
<string name="tag_restriction_when">چه زمانی</string>
<string name="tag_restriction_and">و</string>
<string name="tag_restriction_add_restriction">افزودن محدودیت</string>
<string name="tag_restriction_add_simple_condition">افزودن شرط ساده</string>
<string name="tag_restriction_add_expression">افزودن عبارت</string>
<string name="tag_restriction_add_opening_hours">افزودن ساعت کار</string>
<string name="tag_restriction_value_hint">محدودیت شرطی</string>
<string name="ugly_checkgroup_hint">%1$s، …</string>
<string name="tag_form_unknown_element">عنصر ناشناخته (پیشتنظیمی یافت نشد)</string>
<string name="tag_form_untagged_element">عنصر بیتگ</string>
<!--Custom preset creation-->
<string name="tag_menu_create_preset">ساخت پیشتنظیم سفارشی</string>
<string name="create_preset_title">نام پیشتنظیم سفارشی</string>
<string name="create_preset_default_name">سفارشی %1$s</string>
<!--Strings in Box/LocationPicker-->
<string name="location_choose_radius">انتخاب شعاع:</string>
<string name="location_default_radius">300 متر</string>
<string name="location_radius">%1$d متر</string>
<string name="location_last_text">آخرین مکان:</string>
<string name="location_current_text">مکان کنونی:</string>
<string name="location_text_unknown">نامشخص</string>
<string name="location_last_text_parameterized">آخرین مکان: %1$s</string>
<string name="location_current_text_parameterized">مکان کنونی: %1$s</string>
<string name="location_text_metadata_location">\nLat %1$4g, Lon %2$4g\n%3$s %4$s پیش</string>
<string name="location_text_metadata_accuracy">صحت %1$2.0f متر، </string>
<string name="location_text_metadata">(%1$s%2$s)</string>
<string name="location_coordinates_text">از مختصات:</string>
<string name="location_lat_label">عرض:</string>
<string name="location_lon_label">طول:</string>
<string name="location_search_label">جستجو:</string>
<string name="location_load_button">بارکردن</string>
<string name="location_load_dismiss">برو به نقشه</string>
<string name="location_nan_title">ورودی خطادار!</string>
<string name="location_nan_message">لطفاً مختصات را در قالب اعشاری وارد کنید ( مثال: 52.333572,8.741185 ). عرض باید بین -85.0 و +85.0 باشد، طول بین -175.0 و +175.0.</string>
<string name="location_olc">OLC</string>
<!--Strings in barometer calibration-->
<string name="barometer_calibration_label">استفاده</string>
<string name="barometer_calibration_current_height">ارتفاع کنونی (متر)</string>
<string name="barometer_calibration_current_reference_pressure">فشار مرجع کنونی (hPa)</string>
<string name="barometer_calibration_gps">GNSS</string>
<string name="barometer_calibration_calibrate">کالیبرهکردن</string>
<!--Strings in postition info-->
<string name="position_info_title">اطلاعات موقعیت کنونی</string>
<string name="position_info_hdop">HDOP</string>
<string name="position_info_altitude">ارتفاع</string>
<string name="position_info_geoid_height">ارتفاع بر فراز زمینوار (ژئوئید)</string>
<string name="position_info_barometric_height">ارتفاع فشارسنجشی</string>
<string name="position_info_geoid_correction">تصحیح ژئوئید</string>
<string name="position_info_ellipsoid_height">ارتفاع بر فراز بیضیوار</string>
<!--Strings in DownloadActivity-->
<string name="download_files_title">دانلود پروندهها</string>
<string name="allow_all_networks">اجازه به همهٔ شبکهها</string>
<!--Strings in Go to coordinates-->
<string name="go_to_coordinates_title">برو به مختصات</string>
<string name="go_to_coordinates_hint">مختصات یا کد OLC وارد کنید</string>
<string name="unparseable_coordinates">مختصات ناخوانا</string>
<string name="network_required">برای جستجوی مکان به شبکه نیاز است</string>
<string name="no_nominatim_server">کارساز پیکربندیشدهای برای Nominatim یافت نشد</string>
<string name="no_nominatim_result">کارساز Nominatim، %1$s را نیافت</string>
<!--Menu-->
<string name="menu_move">جابهجایی</string>
<string name="menu_edit">ويرايش</string>
<string name="menu_add">جديد</string>
<string name="menu_config">ترجیحات</string>
<string name="menu_find">یافتن</string>
<string name="menu_help">راهنما</string>
<string name="menu_view">نما</string>
<string name="menu_erase">پاککردن گره</string>
<string name="menu_set_position">موقعیت</string>
<string name="menu_split">دونیمکردن</string>
<string name="menu_remove_node_from_way">حذف گره از راه</string>
<string name="menu_extract">استخراج گره</string>
<string name="menu_append">ادامهدادن</string>
<string name="menu_relation">ساخت رابطه</string>
<string name="menu_edit_relation">ویرایش رابطه</string>
<string name="menu_add_relation_member">افزودن عضو</string>
<string name="menu_select_relation_members">انتخاب عضوها</string>
<string name="menu_tag">ویرایش تگها</string>
<string name="menu_openstreetbug">افزودن یادداشت</string>
<string name="menu_easyedit">ویرایش آسان</string>
<string name="menu_camera">دوربین</string>
<string name="menu_gps">GPS/GNSS…</string>
<string name="menu_gps_show">نمایش مکان</string>
<string name="menu_gps_follow">دنبالکردن مکان</string>
<string name="menu_gps_goto">برو به مکان کنونی</string>
<string name="menu_gps_goto_coordinates">برو به مختصات...</string>
<string name="menu_gps_goto_last_edit">برو به آخرین ویرایش</string>
<string name="menu_gps_position_info">اطلاعات موقعیت کنونی</string>
<string name="menu_gps_start">آغاز رد GPX</string>
<string name="menu_gps_pause">نگهداشتن رد GPX</string>
<string name="menu_gps_clear">پاکسازی رد GPX و نقاط بینراهی آن</string>
<string name="menu_gps_track_managment">مدیریت رد GPX...</string>
<string name="menu_gps_upload">آپلود رد GPX</string>
<string name="menu_gps_export">برونبرد رد GPX</string>
<string name="menu_gps_import">درونبرد رد GPX</string>
<string name="menu_gps_goto_start">برو به ابتدای رد GPX</string>
<string name="menu_gps_goto_first_waypoint">برو به اولین نقطهٔ بینراهی</string>
<string name="menu_enable_gps_autodownload">دانلود خودکار مکانمحور</string>
<string name="menu_enable_pan_and_zoom_auto_download">دانلود خودکار با جابهجایی و زوم</string>
<string name="menu_transfer">دادهرسانی...</string>
<string name="menu_transfer_download_current">دانلود نمای کنونی</string>
<string name="menu_transfer_download_replace">پاکسازی و دانلود نمای کنونی</string>
<string name="menu_transfer_load_current">بارکردن نمای کنونی</string>
<string name="menu_transfer_load_replace">پاکسازی و بارکردن نمای کنونی</string>
<string name="menu_transfer_upload">آپلود داده در کارساز OSM</string>
<string name="menu_transfer_update">بهروزرسانی داده</string>
<string name="menu_transfer_close_changeset">بستن بستهٔ تغییر جاری</string>
<string name="menu_transfer_file">پرونده...</string>
<string name="menu_transfer_export">برونبرد تغییرات به پروندهٔ OSC</string>
<string name="menu_transfer_apply_osc_file">بهکارگیری تغییرات از پروندهٔ OSC</string>
<string name="menu_transfer_read_file">خواندن از پروندهٔ JOSM...</string>
<string name="menu_transfer_read_pbf_file">خواندن از پروندهٔ PBF</string>
<string name="menu_transfer_save_file">ذخیره در پروندهٔ JOSM...</string>
<string name="menu_transfer_download_msf">دانلود داده برای استفادهٔ آفلاین...</string>
<string name="menu_transfer_bugs">وظیفهها...</string>
<string name="menu_transfer_bugs_download_current">دانلود وظیفههای نمای کنونی</string>
<string name="menu_transfer_bugs_upload">آپلود همه</string>
<string name="menu_transfer_bugs_upload_long">آپلود همهٔ وظیفهها</string>
<string name="menu_transfer_bugs_clear">پاکسازی</string>
<string name="menu_transfer_bugs_clear_long">پاکسازی وظیفهها</string>
<string name="menu_transfer_autodownload_long">دانلود خودکار وظیفهها</string>
<string name="menu_transfer_save_notes_all">ذخیرهسازی همهٔ یادداشتها...</string>
<string name="menu_transfer_save_notes_new_and_changed">ذخیرهسازی یادداشتهای جدید و تغییرکرده...</string>
<string name="menu_transfer_read_custom_bugs">بارکردن وظیفههای سفارشی...</string>
<string name="menu_transfer_write_custom_bugs">ذخیرهسازی وظیفههای سفارشی باز...</string>
<string name="menu_save">ذخیره در قالب پرونده</string>
<string name="menu_join">پیوند</string>
<string name="menu_unjoin">جداسازی</string>
<string name="menu_copy">کپی</string>
<string name="menu_cut">برش</string>
<string name="menu_paste">درج</string>
<string name="menu_paste_tags">درج تگها</string>
<string name="menu_paste_from_clipboard">درج از بریدهدادن</string>
<string name="menu_zoom_to_selection">زوم روی انتخاب</string>
<string name="menu_rotate">چرخش</string>
<string name="menu_orthogonalize">قائمهکردن</string>
<string name="menu_straighten">راستکردن</string>
<string name="menu_circulize">چیدن روی دایره</string>
<string name="menu_split_polygon">تقسیم به دو چندضلعی</string>
<string name="menu_unjoin_dissimilar">جداسازی ناهمسانها</string>
<string name="menu_extract_segment">استخراج پاره</string>
<string name="menu_newnode_gps">گره جدید در موقعیت GPS</string>
<string name="menu_extend_selection">گسترش انتخاب</string>
<string name="menu_information">اطلاعات</string>
<string name="menu_voice_commands">فرمانهای صوتی</string>
<string name="menu_upload_element">آپلود عنصر</string>
<string name="menu_upload_elements">آپلود عنصرها</string>
<string name="menu_set_name">تنظیم نام</string>
<string name="menu_tools">ابزارها...</string>
<string name="menu_tools_imagery">دیگر ابزارهای تصویر...</string>
<string name="menu_tools_add_imagery_from_oam">افزودن تصویر از OAM</string>
<string name="menu_tools_flush_all_tile_caches">پاکسازی همهٔ نهانگاههای کاشی</string>
<string name="menu_tools_background_properties">خصوصیات پسزمینه</string>
<string name="menu_tools_update_imagery_configuration">بهروزرسانی پیکربندی</string>
<string name="menu_tools_update_imagery_configuration_eli">بهروزرسانی پیکربندی از ELI</string>
<string name="menu_tools_zoom_to_layer_extent">زوم به گسترهٔ لایهٔ پسزمینه</string>
<string name="menu_tools_clear_clipboard">پاکسازی بریدهدان</string>
<string name="menu_tools_calibrate_height">حسگر فشار را واسنجی کنید</string>
<string name="menu_tools_install_egm">نصب EGM</string>
<string name="menu_tools_remove_egm">حذف EGM</string>
<!---->
<string name="menu_simple_actions">حالت ساده</string>
<string name="menu_feedback">بازخورد</string>
<string name="menu_preset_feedback">بازخورد دربارهٔ پیشتنظیم</string>
<string name="menu_privacy">حریم خصوصی</string>
<!--Background alignment-->
<string name="menu_tools_background_align">ترازکردن پسزمینه</string>
<string name="menu_tools_background_align_reset">بازنشانی</string>
<string name="menu_tools_background_align_zero">صفر</string>
<string name="menu_tools_background_align_retrieve_from_db">از پایگاهداده</string>
<string name="menu_tools_background_align_retrieve_from_device">از دستگاه</string>
<string name="menu_tools_background_align_save_db">ذخیره در پایگاهداده</string>
<string name="menu_tools_background_align_save_device">ذخیره در دستگاه</string>
<string name="menu_tools_background_align_apply2all">بهکارگیری (همهٔ زومها)</string>
<string name="min_max_zoom">%1$d - %2$d</string>
<string name="distance_meter">%1$.2f متر</string>
<string name="distance_km">%1$.3f کیلومتر</string>
<!--Menus in layers dialog-->
<string name="menu_layers">لایهها...</string>
<string name="menu_layers_load_geojson">افزودن لایهٔ GeoJSON</string>
<string name="menu_layers_add_backgroundlayer">افزودن لایهٔ تصویر پسزمینه</string>
<string name="menu_layers_add_overlaylayer">افزودن لایهٔ تصویر رو</string>
<string name="menu_layers_add_tasklayer">فعالسازی لایهٔ وظیفه</string>
<string name="menu_layers_add_grid">فعالسازی شبکه</string>
<string name="menu_layers_add_photolayer">فعالسازی لایهٔ عکس</string>
<string name="menu_layers_enable_mapillary_layer">فعالسازی لایهٔ مپیلاری</string>
<string name="menu_layers_configure">پیکربندی...</string>
<!---->
<string name="menu_tools_apply_local_offset">بهکارگیری آفست ذخیرهشده بر تصویر</string>
<string name="menu_tools_background_contrast">پادنمایی</string>
<string name="menu_tools_oauth_reset">بازنشانی OAuth</string>
<string name="menu_tools_oauth_authorisation">احراز هویت OAuth</string>
<string name="menu_enable_tagfilter">پالایهٔ تگ</string>
<string name="menu_enable_presetfilter">پالایهٔ پیشتنظیم</string>
<string name="preset_menu_waynodes">شامل گرههای راه</string>
<string name="preset_menu_invert">برعکسکردن پالایهها</string>
<!--element action mode menu-->
<string name="menu_tags">خصوصیات</string>
<!--Text should be as short as possible-->
<string name="menu_history">تاریخچه</string>
<string name="menu_merge">پیوند</string>
<string name="menu_reverse">معکوسکردن</string>
<string name="notreversable_description">این راه برعکس نمیشود زیرا با مشخصههای وابسته به جهت تگگذاری شده است. برعکسکردنش تگگذاری را خراب میکند.</string>
<string name="reverse_anyway">بههرحال برعکس شود</string>
<string name="deleteway_description">در حال حذف یک راه هستید.\n\nمیتوانید همهٔ گرهها را نگه دارید یا آنهایی را حذف کنید که فقط متعلق به این راهاند و بیتگ هستند.</string>
<string name="deleteway_relation_description">در حال حذف یک راه هستید که عضوی از یک یا چند رابطه است. حذف اینگونه راهها که رابطهای بر آنها سوار است، میتواند render را نامعتبر کند.</string>
<string name="deleteway_nodesnotdownloaded_description">راه شامل گرههایی است که بیرون از محدودهٔ دانلودشده قرار دارند و بنابراین حذفش میتواند منجر به وضعیتی ناپایدار شود. پیش از تلاش مجدد، تمام راه را دانلود کنید.</string>
<string name="deleteway_wayonly">فقط حذف راه</string>
<string name="deleteway_wayandnodes">حذف راه</string>
<string name="deletenode_relation_description">در حال حذف یک گره هستید که عضوی از یک یا چند رابطه است. حذف اینگونه گرهها که رابطهای بر آنها سوار است، میتواند render را نامعتبر کند.</string>
<string name="deletenode">حذف گره</string>
<!--EasyEdit context menus-->
<string name="split_context_title">دو نیم کردن...</string>
<string name="split_all_ways">... همهٔ راهها</string>
<string name="merge_context_title">ادغام با …</string>
<string name="merge_with_all_ways">… همهٔ راههای نزدیک</string>
<string name="merge_with_all_nodes">… همهٔ گرههای نزدیک</string>
<string name="delete_note_description">حذف یادداشت برگشتپذیر نیست!</string>
<string name="delete_note">حذف یادداشت</string>
<!--EasyEdit action mode titles-->
<string name="actionmode_wayselect">راه انتخاب شد</string>
<string name="actionmode_nodeselect">گره انتخاب شد</string>
<string name="actionmode_relationselect">رابطه انتخاب شد</string>
<string name="actionmode_createpath">ایجاد مسیر</string>
<string name="actionmode_multiselect">انتخاب چندتایی</string>
<string name="actionmode_newnoteselect">یادداشت جدید انتخاب شد</string>
<!--EasyEdit action mode sub-titles-->
<string name="actionmode_closed_way_split_1">دونیمکردن راه بسته، گره اول</string>
<string name="actionmode_closed_way_split_2">دونیمکردن راه بسته، گره دوم</string>
<string name="actionmode_restriction">افزودن محدودیت گردش</string>
<string name="actionmode_restriction_restart_from">پارهٔ from را دوباره انتخاب کنید</string>
<string name="actionmode_restriction_select_from">پارهٔ from را انتخاب کنید</string>
<string name="actionmode_restriction_via">عنصر/پارهٔ via را بیفزایید</string>
<string name="actionmode_restriction_restart_via">پارهٔ via را دوباره انتخاب کنید</string>
<string name="actionmode_restriction_to">پارهٔ to را بیفزایید</string>
<string name="actionmode_restriction_restart_to">پارهٔ to را دوباره انتخاب کنید</string>
<string name="actionmode_restriction_split_from">پارهٔ from را دو نیم کنید</string>
<string name="actionmode_restriction_split_via">پارهٔ via را دو نیم کنید</string>
<string name="actionmode_extract_segment_select">انتخاب پاره</string>
<string name="actionmode_extract_segment_set_tags">تنظیم تگها</string>
<plurals name="actionmode_object_count">
<item quantity="one">1 شیء</item>
<item quantity="other">%1$d شیء</item>
</plurals>
<string name="actionmode_rotateway">چرخش راه</string>
<!--Simple Action Mode-->
<string name="menu_add_node">افزودن گره</string>
<string name="simple_add_node">موقعیت موردنظر از صفحه را لمس کنید</string>
<string name="menu_add_node_tags">افزودن گره تگدار</string>
<string name="menu_add_way">افزودن راه</string>
<string name="simple_add_way">موقعیت موردنظر از صفحه را لمس کنید</string>
<string name="menu_add_map_note">افزودن یادداشت نقشه</string>
<string name="simple_add_note">موقعیت موردنظر از صفحه را لمس کنید</string>
<string name="menu_paste_object">درج شیء</string>
<string name="simple_paste">موقعیت موردنظر از صفحه را لمس کنید</string>
<string name="menu_paste_multiple">درج چندینباره</string>
<string name="simple_paste_multiple">موقعیت موردنظر از صفحه را لمس کنید</string>
<!--Preferences-->
<string name="config_backgroundLayer_title">پسزمینهٔ نقشه</string>
<string name="config_backgroundLayer_summary">پسزمینهٔ کاشی-پایهٔ نقشه</string>
<string name="config_overlayLayer_title">رولایهٔ نقشه</string>
<string name="config_overlayLayer_summary">رولایهٔ کاشی-پایهٔ نقشه</string>
<string name="config_customlayers_title">لایههای سفارشی</string>
<string name="config_customlayers_summary">لایههایی را که در پیکربندی پیشفرض نیستند، پیکربندی کنید.</string>
<string name="config_scale_title">نمایش مقیاس</string>
<string name="config_scale_summary">نوع مقیاس نمایشیافته بر نقشه.</string>
<string name="config_mapProfile_title">سبک داده</string>
<string name="config_mapProfile_summary">سبک لایهٔ داده را انتخاب کنید.</string>
<string name="config_enableOpenStreetBugs_title">نمایش وظیفهها</string>
<string name="config_enableOpenStreetBugs_summary">نمایش، ویرایش و ایجاد یادداشتها، باگها و وظیفهها.</string>
<string name="config_enablePhotoLayer_title">فعالسازی لایهٔ عکس</string>
<string name="config_enablePhotoLayer_summary">نمایش عکسهای زمینمرجع.</string>
<string name="config_enableKeepScreenOn_title">روشنماندن صفحه</string>
<string name="config_enableKeepScreenOn_summary">نمیگذارد برای ذخیرهٔ نیرو صفحه خاموش شود.</string>
<string name="config_largeDragArea_title">فضای بزرگ برای کشیدن گره</string>
<string name="config_largeDragArea_summary">فضایی بزرگتر برای جابهجاکردن گره در اختیارتان میگذارد.</string>
<string name="config_advancedprefs">ترجیحات پیشرفته</string>
<string name="config_moreprefs">تنظیمات بیشتر...</string>
<string name="config_presetbutton_title">پیشتنظیمها</string>
<string name="config_presetbutton_summary">افزودن و فعالسازی پیشتنظیمهای سازگار با JOSM</string>
<string name="config_built_in_preset">پیشتنظیم توکار</string>
<!--Validator preferences-->
<string name="config_validatorprefs_title">تنظیمات اعتبارسنج</string>
<string name="config_validatorprefs_summary">قواعد اعتبارسنجی را پیکربندی کنید.</string>
<string name="config_connectedNodeTolerance_title">تابآوری نقطهٔ اتصال</string>
<string name="config_connectedNodeTolerance_summary">اگر فاصلهٔ گره پایانی معبری تا معبر دیگر کمتر از این مقدار (به متر) باشد، باید به آن متصل شود</string>
<!--opening hours templates-->
<string name="config_opening_hours_title">الگوهای ساعت کاری</string>
<string name="config_opening_hours_summary">الگوهای ساعت کاری را بار، ذخیره و حذف کنید</string>
<!--these are no longer on the prefs page, but are used as menu entries-->
<string name="config_licensebutton_title">سازندگان و پروانهها</string>
<string name="config_debugbutton_title">اشکالزدایی</string>
<string name="config_category_info">درباره</string>
<!--Advanced preferences-->
<!--User Interface Settings-->
<string name="config_category_view">تنظیمات واسط کاربری</string>
<string name="config_category_view_summary">گزینههای پیکربندی چیدمان و نمایش.</string>
<string name="config_iconbutton_title">نمایش نماد گرهها</string>
<string name="config_iconbutton_summary">روی گرهها نماد جورترین پیشتنظیم را نشان بده.</string>
<string name="config_showWayIcons_title">نمایش نماد نقاط توجه (POI) روی ساختمانها</string>
<string name="config_showWayIcons_summary">روی ساختمانها نماد جورترین پیشتنظیم را نشان بده.</string>
<string name="config_tagFormEnabled_title">نمایش فرم تگنویسی</string>
<string name="config_tagFormEnabled_summary">فرم تگنویسی را برای ویرایش نشان بده.</string>
<string name="config_showCameraAction_title">نمایش کنش دوربین</string>
<string name="config_showCameraAction_summary">نماد دوربین را در نوار کنش نشان بده.</string>
<string name="config_useInternalPhotoViewer_title">استفاده از نمایشگر عکس توکار</string>
<string name="config_useInternalPhotoViewer_summary">نمایشگر عکس توکار را به کار ببر. اگر خاموش باشد نمایشگر خارجی استفاده میشود.</string>
<string name="config_followGPSbutton_title">چیدمان دکمهٔ «دنبالکردن موقعیت»</string>
<string name="config_followGPSbutton_summary">جایی که دکمهٔ «دنبالکردن موقعیت» قرار میگیرد.</string>
<string name="config_alwaysDrawBoundingBoxes_title">همیشه محدودههای دانلودنشده را تاریک کن</string>
<string name="config_alwaysDrawBoundingBoxes_summary">در حالت قفل، محدودههای دانلودنشده را تاریک میکند.</string>
<string name="config_fullscreenMode_title">حالت تمامصفحه</string>
<string name="config_fullscreenMode_summary">رفتار در دستگاههای دارای کلیدهای «نرم».</string>
<string name="config_map_orientation_title">جهت صفحهٔ نقشه</string>
<string name="config_map_orientation_summary">رفتار صفحهٔ نقشه با تغییرکردن جهت دستگاه.</string>
<string name="config_showTolerance_title">نمایش هاله</string>
<string name="config_showTolerance_summary">محدودهای دور عنصر برای انتخاب آن نمایش میدهد (فضای انتخاب).</string>
<string name="config_use_back_for_undo_title">استفاده از دکمهٔ عقب برای واگرد</string>
<string name="config_use_back_for_undo_summary">در نمای اصلی ویرایش، برای برگرداندن ویرایش دکمهٔ عقب را بزنید.</string>
<string name="config_enableLightTheme_title">پوستهٔ روشن</string>
<string name="config_enableLightTheme_summary">زمینههای روشن و سفید.</string>
<string name="config_splitActionBarEnabled_title">فعالسازی نوار کنش دوبخشی</string>
<string name="config_splitActionBarEnabled_summary">میتوانید نوار کنش را دو بخش کنید. کاربرد وابسته به دستگاه است. نیازمند راهاندازی مجدد وسپوچی و اندروید ۴.۰ یا بالاتر.</string>
<string name="config_maxInlineValues_title">بیشترین تعداد مقادیر درخط</string>
<string name="config_maxInlineValues_summary">بیشترین تعداد مقادیر که در فرم خصوصیتها نمایان باشد.</string>
<string name="config_maxInlineValues_current">%1$d مقدار</string>
<string name="config_autoLockDelay_title">مدت انتظار پیش از قفلشدن خودکار</string>
<string name="config_autoLockDelay_summary">تعداد ثانیههای انتظار پیش از قفلشدن خودکار. 0 آن را غیرفعال میکند.</string>
<string name="config_autoLockDelay_current">%1$d ثانیه</string>
<string name="config_enableAntiAliasing_title">فعالسازی ضدپلّگی</string>
<string name="config_enableAntiAliasing_summary">خطها را هموارتر میکند.</string>
<string name="config_enableHwAcceleration_title">فعالسازی شتابدهی سختافزاری</string>
<string name="config_enableHwAcceleration_summary">اگر و هرجا پشتیبانی شود، امکان استفاده از شتابدهی سختافزاری را فراهم میکند. در حال حاضر تنظیم این گزینه تأثیری ندارد.</string>
<string name="config_maxStrokeWidth_title">بیشینهٔ پهنای خط</string>
<string name="config_maxStrokeWidth_summary">راهی را ضخیمتر از این رسم نکن.</string>
<string name="config_maxStrokeWidth_current">%1$d پیکسل</string>
<string name="config_uploadOk_title">آپلود در انتظار - مناسب</string>
<string name="config_uploadOk_summary">در محدودیت زیر مشخص کنید کدام آپلودهای در انتظار، مناسب دانسته شود</string>
<string name="config_upload_current">%1$d شیء</string>
<string name="config_uploadWarn_title">آپلود در انتظار - هشدار</string>
<string name="config_uploadWarn_summary">در محدودیت زیر مشخص کنید برای کدام آپلودهای در انتظار، هشدار داده شود</string>
<string name="config_dataWarn_title">هشدار دادهٔ خیلی زیاد</string>
<string name="config_dataWarn_summary">محدودیتی (بر حسب تعداد گره) تعیین کنید که از آنجا به بعد دربارهٔ بارشدن دادهٔ بسیار زیاد هشدار دهیم.</string>
<!--Data and Editing Settings-->
<string name="config_category_editing">تنظیمات داده و ویرایش</string>
<string name="config_category_editing_summary">دانلود خودکار، ذخیرهسازی و تنظیمات اعلان.</string>
<string name="config_forceContextMenu_title">نمایش همیشگی منوی زمینه</string>
<string name="config_forceContextMenu_summary">همیشه اگر انتخاب مبهم است منوی زمینه را نشان بده.</string>
<string name="config_address_tags">تگهای نشانی</string>
<string name="config_address_tags_summary">تگهایی که برای پیشبینی نشانی به کار میرود.</string>
<string name="config_enableNameSuggestions_title">فعالسازی پیشنهادهای نام</string>
<string name="config_enableNameSuggestions_summary">پیشنهادهای تگ نام را فعال کنید.</string>
<string name="config_enableNameSuggestionsPresets_title">فعالسازی پیشتنظیمهای پیشنهاد نام</string>
<string name="config_enableNameSuggestionsPresets_summary">هنگامی که پیشنهاد نام انتخاب شد بهطور خودکار پیشتنظیم را بیفزا.</string>
<string name="config_autoApplyPreset_title">فعالسازی بهکارگیری خودکار پیشتنظیم</string>
<string name="config_autoApplyPreset_summary">هنگامی که ویرایشگر خصوصیت آغاز میشود بهطور خودکار پیشتنظیم را به کار ببر.</string>
<string name="config_generateAlerts_title">تولید اعلانها</string>
<string name="config_generateAlerts_summary">برای دادهٔ مشکلدار یا یادداشتها اعلان تولید کن</string>
<string name="config_groupAlertsOnly_title">فقط هشدار صوتی گروهی</string>
<string name="config_groupAlertsOnly_summary">فقط برای گروه اعلانها یک بار هشدار (صوتی) بده</string>
<string name="config_notificationCacheSize_title">بیشینهٔ تعداد اعلانهای نمایشیافته</string>
<string name="config_notificationCacheSize_summary">بیشترین تعداد اعلانهای نمایشیافته برای هر نوع (کمترین 1).</string>
<string name="config_notificationCacheSize_current">%1$d اعلان</string>
<string name="config_maxAlertDistance_title">بیشینهٔ مسافت برای اعلان</string>
<string name="config_maxAlertDistance_summary">دورترین مسافتی که مشکل یا یادداشت میتواند از موقعیت کنونی داشته باشد تا برایش اعلان تولید شود.</string>
<string name="config_maxAlertDistance_current">%1$d متر</string>
<string name="config_closeChangesetOnSave_title">بستن بستههای تغییر</string>
<string name="config_closeChangesetOnSave_summary">بهطور پیشفرض هنگام ذخیرهسازی، بستههای تغییر را ببند.</string>
<string name="config_enableAutoPresets_title">فعالسازی تولید خودکار پیشتنظیم</string>
<string name="config_enableAutoPresets_summary">ساخت پیشتنظیم از taginfo مجاز باشد.</string>
<string name="config_orthogonalizeThreshold_title">آستانهٔ قائمگی</string>
<string name="config_orthogonalizeThreshold_summary">آستانه قائمهبودن (به درجه) که زاویههای فراتر از آن نادیده گرفته میشوند</string>
<string name="config_orthogonalizeThreshold_current">%1$d°</string>
<string name="config_autoformatPhoneNumbers_title">قالبدهی خودکار شمارهتلفنها</string>
<string name="config_autoformatPhoneNumbers_summary">قالبدهی خودکار شمارهتلفنها را فعال میکند</string>
<!--Auto-download settings-->
<string name="config_category_auto_download">تنظیمات دانلود خودکار</string>
<string name="config_category_auto_download_summary">تنظیمات دانلود خودکار داده و وظیفه</string>
<string name="config_extTriggeredDownloadRadius_title">شعاع دانلود</string>
<string name="config_extTriggeredDownloadRadius_summary">شعاع دانلود (به متر) برای وقتی که از بیرون برنامه فرمان دانلود صادر میشود. 0 فقط مرکزیت نقشه را تنظیم میکند (بدون دانلود).</string>
<string name="config_downloadRadius_current">%1$d متر</string>
<string name="config_maxDownloadSpeed_title">بیشینهٔ سرعت دانلود خودکار</string>
<string name="config_maxDownloadSpeed_summary">محدودیتی (به کیلومتر/ساعت) که برای بیش از آن، دانلودِ خوکار لغو میشود.</string>
<string name="config_downloadSpeed_current">%1$d km/h</string>
<string name="config_autoPruneNodeLimit_title">حد هرس خودکار</string>
<string name="config_autoPruneNodeLimit_summary">شمار گرههای مقیم در حافظه که با رسیدن به این تعداد، هرس انجام میشود.</string>
<string name="config_autoPruneNodeLimit_current">%1$d گره</string>
<string name="config_panAndZoomLimit_title">محدودیت زوم</string>
<string name="config_panAndZoomLimit_summary">کمینهٔ سطح زوم که هنگام جابهجایی و زوم، دانلود خودکار انجام شود.</string>
<string name="config_panAndZoomLimit_current">%1$d</string>
<string name="config_bugFilter_title">پالایهٔ وظیفه</string>
<string name="config_bugFilter_summary">انتخاب کنید چه عنصرهایی در لایهٔ یادداشتها، باگها و وظیفه نمایش یابند.</string>
<string name="config_bugDownloadRadius_title">شعاع دانلود وظیفه</string>
<string name="config_bugDownloadRadius_summary">شعاع دانلود وظیفه (به متر).</string>
<string name="config_maxBugDownloadSpeed_title">بیشینهٔ سرعت دانلود خودکار وظیفه</string>
<string name="config_maxBugDownloadSpeed_summary">محدودیتی (به کیلومتر بر ساعت) که برای فراتر از آن دانلود خودکار باگها و وظیفه لغو میشود.</string>
<!--Location Settings-->
<string name="config_category_gps">تنظیمات مکان</string>
<string name="config_category_gps_summary">پارامترهای GPS/GNSS و سایر ارائهدهندگان مکان.</string>
<string name="config_gps_source_title">منبع GPS/GNSS</string>
<string name="config_gps_source_summary">منبع بهروزرسانیهای مکانی GPS/GNSS.</string>
<string name="config_gps_source_tcp_title">منبع شبکهٔ NMEA</string>
<string name="config_gps_source_tcp_summary">نشانی منبع TCP NMEA در قالب host:port.</string>
<string name="config_gps_interval_title">کمترین دورهٔ GPS/GNSS</string>
<string name="config_gps_interval_summary">کمترین دورهٔ زمانی برای اعلانهای مکانی GPS/GNSS، به میلیثانیه. مقدارهای کمتر مصرف باتری را افزایش میدهد.</string>
<string name="config_gps_interval_current">%1$d میلیثانیه</string>
<string name="config_gps_distance_title">کمترین مسافت GPS/GNSS</string>
<string name="config_gps_distance_summary">کمترین مسافت میان اعلانهای GPS/GNSS، به متر. مقدارهای کمتر مصرف باتری را افزایش میدهد.</string>
<string name="config_gps_distance_current">%1$d متر</string>
<string name="config_leaveGpsDisabled_title">GPS/GNSS خاموش بماند</string>
<string name="config_leaveGpsDisabled_summary">برای روشنکردن GPS/GNSS درخواست نکن.</string>
<string name="config_gps_network_title">برگشت به مکان شبکه</string>
<string name="config_gps_network_summary">اگر موقعیتیابی GPS/GNSS در دسترس نیست یا خاموش است، به ارائهدهندهٔ شبکه برگرد.</string>
<string name="config_gnssTimeToStale_title">کهنهشدن مکان پس از</string>
<string name="config_gnssTimeToStale_summary">عمری (به ثانیه) که از یک موقعیت مکانی باید بگذرد تا کهنه تلقی شود.</string>
<string name="config_gnssTimeToStale_current">%1$d ثانیه</string>
<string name="config_useBarometricHeight_title">استفاده از ارتفاع فشارسنجشی</string>
<string name="config_useBarometricHeight_summary">برای مقادیر ارتفاع در ردها از حسگر فشار هوا (در صورت وجود) استفاده میکند.</string>
<!--Server Settings-->
<string name="config_category_server">تنظیمات کارساز</string>
<string name="config_category_server_summary">OSM API و پیکربندی سایر کارسازها.</string>
<string name="config_apibutton_title">OSM API URL</string>
<string name="config_apibutton_summary">اینجا میتوانید API URL غیراستاندارد تنظیم کنید. معمولاً نباید تغییر کند!</string>
<string name="config_loginbutton_title">حساب کاربری</string>
<string name="config_username_summary">فقط اگر از OAuth استفاده نمیکنید، برای آپلود دادهٔ OSM به پیکربندی نیاز دارید. در https://www.openstreetmap.org/user/new برای خود حساب کاربری بسازید.</string>
<string name="config_offsetServer_title">کارساز آفست</string>
<string name="config_offsetServer_summary">URL به کارساز آفست تصویر.</string>
<string name="config_osmoseServer_title">کارساز OSMOSE</string>
<string name="config_osmoseServer_summary">URL برای کارساز OSMOSE.</string>
<string name="config_geocoderbutton_title">پیکربندی زمینکدیابها</string>
<string name="config_geocoderbutton_summary">زمینکدیابها را که برای قابلیت جستجو به کار میروند، بیفزایید، بویرایید یا حذف کنید.</string>
<!--Layer download and storage-->
<string name="config_category_layers">دانلود لایه و محل ذخیره</string>
<string name="config_category_layers_summary">ذخیرهگاه و دانلود تصویر پسزمینهٔ مبتنی بر کاشی</string>
<string name="config_maxTileDownloadThreads_title">بیشینهٔ تعداد ریسههای دانلود</string>
<string name="config_maxTileDownloadThreads_summary">بیشترین تعداد ریسهها برای دانلود کاشیها.</string>
<string name="config_downLoadThreads_current">%1$d ریسه</string>
<string name="config_tileCacheSize_title">اندازهٔ نهانگاه کاشی</string>
<string name="config_tileCacheSize_summary">فضای ذخیرهٔ کل که برای نگهداشتن کاشیها در حافظهٔ نهان مصرف شده، به مگابایت.</string>
<string name="config_tileCache_current">%1$d MB</string>
<string name="config_mapillaryCacheSize_title">اندازهٔ نهانگاه مپیلاری</string>
<string name="config_mapillaryCacheSize_summary">فضای ذخیرهٔ کل که برای نگهداشتن تصاویر مپیلاری در حافظهٔ نهان مصرف شده، به مگابایت.</string>
<!--Miscellaneous-->
<string name="config_category_misc">سایر</string>
<string name="pref_enable_acra">گزارش فروپاشیهای برنامه</string>
<string name="pref_acra_enabled">گزارشگری فروپاشی فعال است</string>
<string name="pref_acra_disabled">گزارشگری فروپاشی غیرفعال است</string>
<string name="config_showStats_title">نمایش آمار</string>
<string name="config_showStats_summary">آمار داده و FPS را در گوشهٔ چپ پایین نشان میدهد.</string>
<!--Experimental-->
<string name="config_category_experimental">آزمایشی</string>
<string name="config_js_console_title">فعالسازی JS console</string>
<string name="config_js_console_summary">JS console را در حالت «زنده» در اختیارتان میگذارد.</string>
<string name="config_voiceCommandsEnabled_title">فعالسازی فرمانهای صوتی</string>
<string name="config_voiceCommandsEnabled_summary">پشتیبانی از فرمانهای صوتی را فعال میکند.</string>
<!---->
<string name="manage_apis">مدیریت APIها</string>
<string name="config_api_url_title">API URL</string>
<string name="config_api_oauth_title">استفاده از OAuth</string>
<string name="listedit_enable_oauth">فعالسازی OAuth</string>
<string name="config_username_title">نام کاربری OSM</string>
<string name="config_password_title">گذرواژهٔ OSM</string>
<string name="config_password_summary">با گذرواژهٔ ویکی اشتباه نگیرید. به یاد بسپارید: گذرواژه در قالب متن ساده ذخیره و منتقل میشود!</string>
<string name="manage_presets">مدیریت پیشتنظیمها</string>
<string name="listedit_use_translations">استفاده از ترجمهها</string>
<string name="manage_geocoders">مدیریت زمینکدیابها</string>
<!--preset downloader messages-->
<string name="preset_update">بهروزرسانی پیشتنظیم</string>
<string name="preset_download_successful">پیشتنظیم دانلود شد</string>
<string name="preset_download_failed">دانلود پروندهٔ پیشتنظیم ناموفق بود. پیشتنظیم کار نخواهد کرد.</string>
<string name="preset_download_parse_failed">پروندهٔ پیشتنظیم نامعتبر است. پیشتنظیم کار نخواهد کرد.</string>
<string name="preset_download_missing_images">پروندهٔ پیشتنظیم دانلود شد. البته چند نماد ناموجود دانلود نشد.</string>
<string name="preset_download_title">دانلودکنندهٔ پیشتنظیم</string>
<!--url handler activity-->
<string name="urldialog_add_preset">افزودن پیشتنظیم</string>
<string name="urldialog_preset_exists">این پیشتنظیم از قبل وجود دارد</string>
<string name="urldialog_preset_download_successful">پیشتنظیم دانلود شد.</string>
<string name="urldialog_api_exists">یک API با این نشانی از قبل وجود دارد. البته، میتوانید یکی دیگر بیفزایید (مثلاً برای جابهجایی آسان بین حسابها).</string>
<string name="urldialog_add_api">افزودن API</string>
<string name="urldialog_nodata_text">URL پیکربندی حاوی دادهٔ معتبر نیست.</string>
<string name="urldialog_add_geocoder">افزودن زمینکدیاب</string>
<!--API configuration-->
<string name="api_name">نام API</string>
<string name="api_url">API URL</string>
<string name="readonly_url">API URL فقط خواندنی (اختیاری)</string>
<string name="notes_url">API URL یادداشتها (اختیاری)</string>
<string name="copy_of">کپی از %1$s</string>
<!--common terms-->
<string name="add">افزودن</string>
<string name="edit">ویرایش</string>
<string name="delete">حذف</string>
<string name="name">نام</string>
<string name="url">URL</string>
<string name="default_">پیشفرض</string>
<string name="regular_expression">عبارت باقاعده</string>
<string name="state">وضعیت</string>
<!---->
<string name="empty_list">بدون مدخل</string>
<string name="geocoder_type">نوع زمینکدیاب</string>
<!--"default" is a reserved Java keyword…-->
<string name="preset">پیشتنظیم</string>
<string name="api">API</string>
<string name="undo">واگرد</string>
<string name="redo">ازنو</string>
<string name="undo_nothing">چیزی برای واگرد نیست</string>
<string name="tracking_active_title">سرویس پسزمینهٔ وسپوچی</string>
<string name="tracking_active_title_short">سرویس پسزمینه فعال است</string>
<string name="tracking_active_text">در حال ضبط رد GPS یا دانلود خودکار</string>
<string name="tracking_long_text">وسپوچی در حال ضبط رد GPX یا در حال دانلود خودکار است. برای خروج کامل، دکمهٔ زیر یا دکمهٔ برگشت برنامه را بزنید.</string>
<string name="gps_failure">فعالسازی GPS ناموفق بود</string>
<!--element description-->
<string name="address_housenumber">نشانی %1$s</string>
<string name="address_housenumber_street">نشانی %1$s %2$s</string>
<!--undo actions - give a description of the action, in infinitive, to display in strings like "Undo: actionname" or "Redo: actionname"-->
<string name="undo_action_movenode">گره جابهجا شد</string>
<string name="undo_action_moveway">راه جابهجا شد</string>
<string name="undo_action_moveobjects">اشیا جابهجا شد</string>
<string name="undo_action_add">درج</string>
<string name="undo_action_append">ادامهدادن راه</string>
<string name="undo_action_deletenode">حذف گره</string>
<string name="undo_action_deleteway">حذف راه</string>
<string name="undo_action_delete_objects">اشیا حذف شد</string>
<string name="undo_action_split_ways">راهها دو نیم شد</string>
<string name="undo_action_split_way">راه دو نیم شد</string>
<string name="undo_action_merge_ways">ادغام راه</string>
<string name="undo_action_reverse_way">برعکسکردن راه</string>
<string name="undo_action_set_tags">تگگذاری</string>
<string name="undo_action_join">پیونددادن</string>
<string name="undo_action_unjoin_ways">جداسازی راه</string>
<string name="undo_action_create_relation">ساخت رابطه</string>
<string name="undo_action_delete_relation">حذف رابطه</string>
<string name="undo_action_update_relations">بهروزآوری رابطه</string>
<string name="undo_action_cut">برش</string>
<string name="undo_action_paste">درج</string>
<string name="undo_action_rotateway">چرخش راه</string>
<string name="undo_action_orthogonalize">قائمهکردن راه</string>
<string name="undo_action_circulize">چینش دایرهوار</string>
<string name="undo_action_fix_conflict">حل تداخل</string>
<string name="undo_action_extract_node">استخراج گره</string>
<string name="undo_action_apply_osc">بهکارگیری پروندهٔ OSC</string>
<string name="undo_action_remove_node_from_way">حذف گره از راه</string>
<string name="undo_action_extract_segment">استخراج پاره</string>
<!--ACRA-->
<string name="crash_dialog_text">وسپوچی در آخرین اجرای خود فروپاشید یا با مسئلهای جدی مواجه شد.\n\nلطفاْ با زدن روی «تأیید» و فرستادن گزارش خطا کمک کنید.\n</string>
<string name="crash_dialog_comment_prompt">اگر فکر میکنید اطلاعات دیگری نیز کمککننده است، آن را بنویسید و اگر بازخورد ما را میخواهید نام کاربری خود در OSM را بنویسید (اختیاری).\n\nسپاس.</string>
<string name="report_success">گزارش شد.</string>
<string name="report_failure">فرستادن گزارش ناموفق بود.</string>
<!--Exceptions messages-->
<string name="exception_too_many_nodes">این کنش راهی با گرههای بسیار خواهد ساخت.</string>
<!--Notifications-->
<string name="alert_data_issue">مسئله در دادهٔ OSM یافت شد</string>
<string name="alert_note">یادداشت OSM در نزدیکی یافت شد</string>
<string name="alert_bug">باگ OSM در نزدیکی یافت شد</string>
<string name="alert_distance_direction">در %1$d متر %2$s</string>
<string name="bearing_ne">NE ↗</string>
<string name="bearing_e">E →</string>
<string name="bearing_se">SE ↘</string>
<string name="bearing_s">S ↓</string>
<string name="bearing_sw">SW ↙</string>
<string name="bearing_w">W ←</string>
<string name="bearing_nw">NW ↖</string>
<string name="bearing_n">N ↑</string>
<!--Misc relation related stuff-->
<string name="role">نقش</string>
<string name="role_lc">نقش</string>
<string name="membership_relation_heading">عضو رابطه</string>
<string name="relation">رابطه</string>
<string name="relations">رابطه</string>
<string name="position">موقعیت</string>
<string name="type">نوع</string>
<string name="object">شیء</string>
<string name="deleterelation_relation_description">در حال حذف یک رابطه هستید که عضوی از یک یا چند رابطه است. حذف اینگونه رابطهها که رابطهای بر آنها سوار است، میتواند render را نامعتبر کند.</string>
<string name="deleterelation">حذف رابطه</string>
<string name="delete_from_relation_description">در حال حذف این عنصر از یک رابطه هستید.</string>
<string name="unset_relation_type">رابطهٔ بدون نوع</string>
<!--Things-->
<string name="bridge">پل</string>
<string name="tunnel">تونل</string>
<!--time and distance-->
<plurals name="days">
<item quantity="one">1 روز</item>
<item quantity="other">%1$d روز</item>
</plurals>
<plurals name="hours">
<item quantity="one">1 ساعت</item>
<item quantity="other">%1$d ساعت</item>
</plurals>
<plurals name="minutes">
<item quantity="one">1 دقیقه</item>
<item quantity="other">%1$d دقیقه</item>
</plurals>
<plurals name="seconds">
<item quantity="one">1 ثانیه</item>
<item quantity="other">%1$d ثانیه</item>
</plurals>
<plurals name="km">
<item quantity="one">1 کیلومتر</item>
<item quantity="other">%1$d کیلومتر</item>
</plurals>
<plurals name="meters">
<item quantity="one">1 متر</item>
<item quantity="other">%1$d متر</item>
</plurals>
<!--Help system-->
<string name="toast_nohelp">این راهنما ندارد.</string>
</resources>
| {
"pile_set_name": "Github"
} |
require 'forwardable'
class LimitedURI
extend Forwardable
def_delegators :@uri, :scheme, :host, :port, :port=, :path, :query, :query=, :to_s
def initialize(uri)
@uri = uri
end
def ==(other)
to_s == other.to_s
end
def self.parse(uri)
return uri if uri.is_a? LimitedURI
return new(uri) if uri.is_a? URI
return new(URI.parse(uri)) if uri.is_a? String
raise URI::InvalidURIError
end
end
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2017, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
const React = require('react');
const ReactDOM = require('react-dom');
const expect = require('expect');
const QueryToolbar = require('../QueryToolbar');
describe('QueryToolbar component', () => {
beforeEach((done) => {
document.body.innerHTML = '<div id="container"></div>';
setTimeout(done);
});
afterEach((done) => {
ReactDOM.unmountComponentAtNode(document.getElementById("container"));
document.body.innerHTML = '';
setTimeout(done);
});
it('QueryToolbar rendering with defaults', () => {
ReactDOM.render(<QueryToolbar />, document.getElementById("container"));
const container = document.getElementById('container');
const el = container.querySelector('.query-toolbar');
expect(el).toExist();
});
it('QueryToolbar check empty filter warning', () => {
ReactDOM.render(<QueryToolbar emptyFilterWarning allowEmptyFilter spatialField={{}} crossLayerFilter={{attribute: "ATTR", operation: undefined}}/>, document.getElementById("container"));
const container = document.getElementById('container');
const el = container.querySelector('#query-toolbar-query.showWarning');
expect(el).toExist();
ReactDOM.render(<QueryToolbar emptyFilterWarning allowEmptyFilter spatialField={{}} crossLayerFilter={{attribute: "ATTR", operation: "INTERSECT"}}/>, document.getElementById("container"));
expect(container.querySelector('#query-toolbar-query.showWarning')).toNotExist();
expect(container.querySelector('#query-toolbar-query')).toExist();
ReactDOM.render(<QueryToolbar emptyFilterWarning allowEmptyFilter spatialField={{geometry: {}}} crossLayerFilter={{attribute: "ATTR", operation: undefined}}/>, document.getElementById("container"));
expect(container.querySelector('#query-toolbar-query.showWarning')).toNotExist();
});
describe('advancedToolbar', () => {
const VALID_FILTERS = [
// spatial only
{
groupFields: [],
spatialPanelExpanded: true,
spatialField: {
attribute: "the_geom",
geometry: {
"some": "geometry"
}
}
},
// spatial different
{
groupFields: [],
spatialPanelExpanded: true,
spatialField: {
attribute: "the_geom",
geometry: {
"some": "OTHER_geometry"
}
}
}];
const checkButtonsEnabledCondition = (container) => (apply, save, discard, reset) => {
return expect(!container.querySelector("button#query-toolbar-query").disabled).toBe(!!apply, `expected apply to be ${apply ? 'enabled' : 'disabled'}`)
&& expect(!container.querySelector("button#query-toolbar-save").disabled).toBe(!!save, `expected save to be ${save ? 'enabled' : 'disabled'}`)
&& expect(!container.querySelector("button#query-toolbar-discard").disabled).toBe(!!discard, `expected discard to be ${discard ? 'enabled' : 'disabled'}`)
&& expect(!container.querySelector("button#reset").disabled).toBe(!!reset, `expected reset to be ${reset ? 'enabled' : 'disabled'}`);
};
it('defaults', () => {
ReactDOM.render(<QueryToolbar />, document.getElementById("container"));
const container = document.getElementById('container');
expect(container.querySelectorAll('button').length).toBe(2);
ReactDOM.render(<QueryToolbar advancedToolbar />, document.getElementById("container"));
const buttons = [...container.querySelectorAll('button')];
expect(buttons.length).toBe(4);
expect(buttons.filter(({ disabled }) => disabled).length).toBe(4);
});
it('apply button is enabled when valid', () => {
const container = document.getElementById('container');
ReactDOM.render(<QueryToolbar advancedToolbar {...VALID_FILTERS[0]} />, document.getElementById("container"));
checkButtonsEnabledCondition(container)(true, false, false, false);
});
it('save and reset enabled when the current filter is applied', () => {
const container = document.getElementById('container');
ReactDOM.render(<QueryToolbar advancedToolbar {...VALID_FILTERS[0]} appliedFilter={VALID_FILTERS[0]} />, document.getElementById("container"));
const buttons = [...container.querySelectorAll('button')];
expect(buttons.length).toBe(4);
checkButtonsEnabledCondition(container)(false, true, false, true);
});
it('apply and reset enabled when the current filter is different from applied', () => {
const container = document.getElementById('container');
ReactDOM.render(<QueryToolbar advancedToolbar {...VALID_FILTERS[1]} appliedFilter={VALID_FILTERS[0]} />, document.getElementById("container"));
const buttons = [...container.querySelectorAll('button')];
expect(buttons.length).toBe(4);
checkButtonsEnabledCondition(container)(true, false, false, true);
});
it('restore enabled when applied a filter different from saved one, not yet saved', () => {
const container = document.getElementById('container');
ReactDOM.render(<QueryToolbar advancedToolbar
{...VALID_FILTERS[0]}
appliedFilter={VALID_FILTERS[0]}
storedFilter={VALID_FILTERS[1]}
/>, document.getElementById("container"));
const buttons = [...container.querySelectorAll('button')];
expect(buttons.length).toBe(4);
checkButtonsEnabledCondition(container)(false, true, true, true);
});
it('saved filter with no changes has only reset enabled', () => {
const container = document.getElementById('container');
ReactDOM.render(<QueryToolbar advancedToolbar
{...VALID_FILTERS[0]}
appliedFilter={VALID_FILTERS[0]}
storedFilter={VALID_FILTERS[0]}
/>, document.getElementById("container"));
const buttons = [...container.querySelectorAll('button')];
expect(buttons.length).toBe(4);
checkButtonsEnabledCondition(container)(false, false, false, true);
});
});
});
| {
"pile_set_name": "Github"
} |
# -*- coding: utf-8 -*-
# name: apl2
# contributor: Yesudeep Mangalapilly <[email protected]>
# key: apl2
# --
;;; `(file-name-nondirectory (buffer-file-name (current-buffer)))` --- ${1:Short description.}
;;
;; Copyright ${2:`(nth 5 (decode-time))`} ${3: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.
;;
;; Author: ${4:`user-mail-address`} (${5:`(user-full-name)`})
;;; Commentary:
;;
;; $6
;;; Code:
;;
$0
;;; `(file-name-nondirectory (buffer-file-name (current-buffer)))` ends here
| {
"pile_set_name": "Github"
} |
function Map() {
var struct = function(key, value) {
this.key = key;
this.value = value;
}
var put = function(key, value) {
for (var i = 0; i < this.arr.length; i++) {
if (this.arr[i].key === key) {
this.arr[i].value = value;
return;
}
}
this.arr[this.arr.length] = new struct(key, value);
}
var get = function(key) {
for (var i = 0; i < this.arr.length; i++) {
if (this.arr[i].key === key) {
return this.arr[i].value;
}
}
return null;
}
var remove = function(key) {
var v;
for (var i = 0; i < this.arr.length; i++) {
v = this.arr.pop();
if (v.key === key) {
continue;
}
this.arr.unshift(v);
}
}
var size = function() {
return this.arr.length;
}
var isEmpty = function() {
return this.arr.length <= 0;
}
this.arr = new Array();
this.get = get;
this.put = put;
this.remove = remove;
this.size = size;
this.isEmpty = isEmpty;
}
module.exports = {
Map: Map
} | {
"pile_set_name": "Github"
} |
/*
* This file is part of the Bus Pirate project (http://code.google.com/p/the-bus-pirate/).
*
* Initial written by Chris van Dongen, 2010.
*
* To the extent possible under law, the project has
* waived all copyright and related or neighboring rights to Bus Pirate.
*
* For details see: http://creativecommons.org/publicdomain/zero/1.0/.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#include "base.h"
#include "basic.h"
#include "AUXpin.h"
#include "busPirateCore.h"
#include "procMenu.h"
#include "bitbang.h"
extern struct _bpConfig bpConfig;
extern struct _modeConfig modeConfig;
extern struct _command bpCommand;
extern proto protos[MAXPROTO];
#ifdef BP_USE_BASIC
int vars[26]; // var a-z
int stack_[GOSUBMAX]; // max 5 gosubs
struct forloop forloops[FORMAX]; // max 2 nested forloop
int pc; //programcounter
int fors; // current for
int gosubs; // current gosubs
int datapos; // read pointer.
char *tokens[NUMTOKEN+1]=
{ STAT_LET, //0x80
STAT_IF, //0x81
STAT_THEN, //0x82
STAT_ELSE, //0x83
STAT_GOTO, //0x84
STAT_GOSUB, //0x85
STAT_RETURN, //0x86
STAT_REM, //0x87
STAT_PRINT, //0x88
STAT_INPUT, //0x89
STAT_FOR, //0x8A
STAT_TO, //0x8b
STAT_NEXT, //0x8c
STAT_READ, //0x8d
STAT_DATA, //0x8e
STAT_STARTR, //0x8f
STAT_START, //0x90
STAT_STOPR, //0x91
STAT_STOP, //0x92
STAT_SEND, //0x93
STAT_RECEIVE, //0x94
STAT_CLK, //0x95
STAT_DAT, //0x96
STAT_BITREAD, //0x97
STAT_ADC, //0x98
STAT_AUXPIN, //0x99
STAT_PSU, //0x9a
STAT_PULLUP, //0x9b
STAT_DELAY, //0x9c
STAT_AUX, //0x9d
STAT_FREQ, //0x9e
STAT_DUTY, //0x9f
STAT_MACRO, //0xA0
STAT_END, //0xa1
};
// insert your favarite basicprogram here:
unsigned char pgmspace[PGMSIZE]; /*={ // 1kb basic memory
// basic basic test :D
#ifdef BASICTEST
TOK_LEN+10, 0, 100, TOK_REM, 'b', 'a', 's', 'i', 'c', 't', 'e', 's', 't',
TOK_LEN+ 7, 0, 110, TOK_LET, 'A', '=', 'C', '+', '1', '6',
TOK_LEN+ 6, 0, 120, TOK_FOR, 'B', '=', '1', TOK_TO, '3',
TOK_LEN+ 6, 0, 125, TOK_FOR, 'D', '=', '0', TOK_TO, '1',
TOK_LEN+23, 0, 130, TOK_PRINT, '\"', 'A', '=', '\"', ';', 'A', ';', '\"', ' ', 'B', '=', '\"', ';', 'B', ';', '\"', ' ', 'D', '=', '\"', ';', 'D', //';',
TOK_LEN+ 2, 0, 135, TOK_NEXT, 'D',
TOK_LEN+ 2, 0, 140, TOK_NEXT, 'B',
TOK_LEN+12, 0, 200, TOK_INPUT, '\"', 'E', 'n', 't', 'e', 'r', ' ', 'C', '\"', ',','C',
TOK_LEN+ 2, 0, 201, TOK_READ, 'C',
TOK_LEN+ 5, 0, 202, TOK_GOSUB, '1', '0', '0', '0',
TOK_LEN+ 2, 0, 203, TOK_READ, 'C',
TOK_LEN+ 5, 0, 204, TOK_GOSUB, '1', '0', '0', '0',
TOK_LEN+ 2, 0, 205, TOK_READ, 'C',
TOK_LEN+ 5, 0, 206, TOK_GOSUB, '1', '0', '0', '0',
TOK_LEN+ 2, 0, 207, TOK_READ, 'C',
TOK_LEN+ 5, 0, 210, TOK_GOSUB, '1', '0', '0', '0',
TOK_LEN+26, 0, 220, TOK_IF, 'C', '=', '2', '0', TOK_THEN, TOK_PRINT, '\"', 'C', '=', '2', '0', '!', '!', '\"', ';', TOK_ELSE, TOK_PRINT, '\"', 'C', '!', '=', '2', '0', '"', ';',
TOK_LEN+ 1, 0, 230, TOK_END,
TOK_LEN+ 7, 3, 232, TOK_PRINT, '\"', 'C', '=', '\"', ';', 'C',
TOK_LEN+ 1, 3, 242, TOK_RETURN,
TOK_LEN+ 6, 7, 208, TOK_DATA, '1', ',', '2', ',', '3',
TOK_LEN+ 3, 7, 218, TOK_DATA, '2', '0',
TOK_LEN+ 1, 255, 255, TOK_END,
#endif
// I2C basic test (24lc02)
#ifdef BASICTEST_I2C
TOK_LEN+18, 0, 100, TOK_REM, 'I', '2', 'C', ' ', 't', 'e', 's', 't', ' ', '(', '2', '4', 'l', 'c', '0', '2', ')',
TOK_LEN+ 2, 0, 110, TOK_PULLUP, '1',
TOK_LEN+ 2, 0, 120, TOK_PSU, '1',
TOK_LEN+ 4, 0, 130, TOK_DELAY, '2', '5', '5',
TOK_LEN+ 1, 0, 140, TOK_STOP,
TOK_LEN+ 5, 0, 150, TOK_GOSUB, '1', '0', '0', '0',
TOK_LEN+ 1, 0, 200, TOK_START,
TOK_LEN+ 4, 0, 210, TOK_SEND, '1', '6', '0',
TOK_LEN+ 2, 0, 220, TOK_SEND, '0',
TOK_LEN+ 6, 0, 230, TOK_FOR, 'A', '=', '1', TOK_TO, '8',
TOK_LEN+ 2, 0, 240, TOK_READ, 'B',
TOK_LEN+ 2, 0, 250, TOK_SEND, 'B',
TOK_LEN+ 2, 0, 200, TOK_NEXT, 'A',
TOK_LEN+ 1, 1, 4, TOK_STOP,
TOK_LEN+ 4, 1, 14, TOK_DELAY, '2', '5', '5',
TOK_LEN+ 5, 1, 24, TOK_GOSUB, '1', '0', '0', '0',
TOK_LEN+ 2, 1, 34, TOK_PSU, '0',
TOK_LEN+ 2, 1, 44, TOK_PULLUP, '0',
TOK_LEN+ 1, 1, 54, TOK_END,
TOK_LEN+13, 3, 232, TOK_REM, 'D', 'u', 'm', 'p', ' ', '8', ' ', 'b', 'y', 't', 'e', 's',
TOK_LEN+ 1, 3, 242, TOK_START,
TOK_LEN+ 4, 3, 252, TOK_SEND, '1', '6', '0',
TOK_LEN+ 2, 4, 6, TOK_SEND, '0',
TOK_LEN+ 1, 4, 16, TOK_START,
TOK_LEN+ 4, 4, 26, TOK_SEND, '1', '6', '1',
TOK_LEN+ 7, 4, 36, TOK_PRINT, TOK_RECEIVE, ';', '"', ' ', '"', ';',
TOK_LEN+ 7, 4, 46, TOK_PRINT, TOK_RECEIVE, ';', '"', ' ', '"', ';',
TOK_LEN+ 7, 4, 56, TOK_PRINT, TOK_RECEIVE, ';', '"', ' ', '"', ';',
TOK_LEN+ 7, 4, 66, TOK_PRINT, TOK_RECEIVE, ';', '"', ' ', '"', ';',
TOK_LEN+ 7, 4, 76, TOK_PRINT, TOK_RECEIVE, ';', '"', ' ', '"', ';',
TOK_LEN+ 7, 4, 86, TOK_PRINT, TOK_RECEIVE, ';', '"', ' ', '"', ';',
TOK_LEN+ 7, 4, 96, TOK_PRINT, TOK_RECEIVE, ';', '"', ' ', '"', ';',
TOK_LEN+ 2, 4, 106, TOK_PRINT, TOK_RECEIVE,
TOK_LEN+ 1, 4, 116, TOK_STOP,
TOK_LEN+ 1, 4, 116, TOK_RETURN,
TOK_LEN+16, 7, 208, TOK_DATA, '2', '5' ,'5', ',', '2', '5' ,'5', ',','2', '5' ,'5', ',','2', '5' ,'5',
TOK_LEN+16, 7, 218, TOK_DATA, '2', '5' ,'5', ',', '2', '5' ,'5', ',','2', '5' ,'5', ',','2', '5' ,'5',
#endif
// UART test (serial rfid reader from seed)
#ifdef BASICTEST_UART
TOK_LEN+15, 0, 100, TOK_REM, 'U', 'A', 'R', 'T', ' ', 't', 'e', 's', 't', ' ', 'r', 'f', 'i', 'd',
TOK_LEN+ 2, 0, 110, TOK_PSU, '1',
TOK_LEN+ 4, 0, 120, TOK_DELAY, '2', '5', '5',
TOK_LEN+ 5, 0, 130, TOK_GOSUB, '1', '0', '0', '0',
TOK_LEN+ 3, 0, 135, TOK_DELAY, '1', '0',
//TOK_LEN+12, 0, 140, TOK_IF, TOK_RECEIVE, '!', '=', '5', '2', TOK_THEN, TOK_GOTO, '2', '0', '2', '0',
//TOK_LEN+ 2, 0, 145, TOK_DELAY, '1',
//TOK_LEN+12, 0, 150, TOK_IF, TOK_RECEIVE, '!', '=', '5', '4', TOK_THEN, TOK_GOTO, '2', '0', '2', '0',
//TOK_LEN+ 2, 0, 155, TOK_DELAY, '1',
//TOK_LEN+12, 0, 160, TOK_IF, TOK_RECEIVE, '!', '=', '4', '8', TOK_THEN, TOK_GOTO, '2', '0', '2', '0',
//TOK_LEN+ 2, 0, 165, TOK_DELAY, '1',
//TOK_LEN+12, 0, 170, TOK_IF, TOK_RECEIVE, '!', '=', '4', '8', TOK_THEN, TOK_GOTO, '2', '0', '2', '0',
//TOK_LEN+ 2, 0, 175, TOK_DELAY, '1',
//TOK_LEN+12, 0, 180, TOK_IF, TOK_RECEIVE, '!', '=', '5', '4', TOK_THEN, TOK_GOTO, '2', '0', '2', '0',
//TOK_LEN+ 2, 0, 185, TOK_DELAY, '1',
//TOK_LEN+12, 0, 190, TOK_IF, TOK_RECEIVE, '!', '=', '5', '3', TOK_THEN, TOK_GOTO, '2', '0', '2', '0',
//TOK_LEN+ 2, 0, 195, TOK_DELAY, '1',
//TOK_LEN+12, 0, 200, TOK_IF, TOK_RECEIVE, '!', '=', '5', '5', TOK_THEN, TOK_GOTO, '2', '0', '2', '0',
//TOK_LEN+ 2, 0, 205, TOK_DELAY, '1',
//TOK_LEN+12, 0, 210, TOK_IF, TOK_RECEIVE, '!', '=', '5', '5', TOK_THEN, TOK_GOTO, '2', '0', '2', '0',
//TOK_LEN+ 2, 0, 215, TOK_DELAY, '1',
//TOK_LEN+12, 0, 220, TOK_IF, TOK_RECEIVE, '!', '=', '5', '7', TOK_THEN, TOK_GOTO, '2', '0', '2', '0',
//TOK_LEN+ 2, 0, 225, TOK_DELAY, '1',
//TOK_LEN+12, 0, 230, TOK_IF, TOK_RECEIVE, '!', '=', '5', '4', TOK_THEN, TOK_GOTO, '2', '0', '2', '0',
//TOK_LEN+ 2, 0, 235, TOK_DELAY, '1',
//TOK_LEN+12, 0, 240, TOK_IF, TOK_RECEIVE, '!', '=', '6', '7', TOK_THEN, TOK_GOTO, '2', '0', '2', '0',
//TOK_LEN+ 2, 0, 245, TOK_DELAY, '1',
//TOK_LEN+12, 0, 250, TOK_IF, TOK_RECEIVE, '!', '=', '5', '0', TOK_THEN, TOK_GOTO, '2', '0', '2', '0',
TOK_LEN+ 6, 0, 140, TOK_PRINT, TOK_RECEIVE, '"', ' ', '"', ';',
//TOK_LEN+ 3, 0, 145, TOK_DELAY, '5', '0',
TOK_LEN+ 6, 0, 150, TOK_PRINT, TOK_RECEIVE, '"', ' ', '"', ';',
//TOK_LEN+ 3, 0, 155, TOK_DELAY, '5', '0',
TOK_LEN+ 6, 0, 160, TOK_PRINT, TOK_RECEIVE, '"', ' ', '"', ';',
//TOK_LEN+ 3, 0, 165, TOK_DELAY, '5', '0',
TOK_LEN+ 6, 0, 170, TOK_PRINT, TOK_RECEIVE, '"', ' ', '"', ';',
//TOK_LEN+ 3, 0, 175, TOK_DELAY, '5', '0',
TOK_LEN+ 6, 0, 180, TOK_PRINT, TOK_RECEIVE, '"', ' ', '"', ';',
//TOK_LEN+ 3, 0, 185, TOK_DELAY, '5', '0',
TOK_LEN+ 6, 0, 190, TOK_PRINT, TOK_RECEIVE, '"', ' ', '"', ';',
//TOK_LEN+ 3, 0, 195, TOK_DELAY, '5', '0',
TOK_LEN+ 6, 0, 200, TOK_PRINT, TOK_RECEIVE, '"', ' ', '"', ';',
//TOK_LEN+ 3, 0, 205, TOK_DELAY, '5', '0',
TOK_LEN+ 6, 0, 210, TOK_PRINT, TOK_RECEIVE, '"', ' ', '"', ';',
//TOK_LEN+ 3, 0, 215, TOK_DELAY, '5', '0',
TOK_LEN+ 6, 0, 220, TOK_PRINT, TOK_RECEIVE, '"', ' ', '"', ';',
//TOK_LEN+ 3, 0, 225, TOK_DELAY, '5', '0',
TOK_LEN+ 6, 0, 230, TOK_PRINT, TOK_RECEIVE, '"', ' ', '"', ';',
//TOK_LEN+ 3, 0, 235, TOK_DELAY, '5', '0',
TOK_LEN+ 6, 0, 240, TOK_PRINT, TOK_RECEIVE, '"', ' ', '"', ';',
//TOK_LEN+ 3, 0, 245, TOK_DELAY, '5', '0',
TOK_LEN+ 6, 0, 250, TOK_PRINT, TOK_RECEIVE, '"', ' ', '"', ';',
//TOK_LEN+ 5, 1, 4, TOK_GOTO, '2', '0', '0', '0',
TOK_LEN+ 4, 1, 14, TOK_GOTO, '1', '3', '0',
TOK_LEN+13, 3, 232, TOK_REM, 'W', 'a', 'i', 't', ' ', 'f', 'o', 'r', ' ', 'S', 'T', 'X',
TOK_LEN+ 4, 3, 242, TOK_LET, 'A', '=', TOK_RECEIVE,
TOK_LEN+12, 3, 252, TOK_IF, 'A', '=', '2', TOK_THEN, TOK_RETURN, TOK_ELSE, TOK_GOTO, '1', '0', '1', '0',
//TOK_LEN+ 8, 7, 208, TOK_PRINT, '"', 'V', 'A', 'L', 'I', 'D', '"',
//TOK_LEN+ 4, 7, 218, TOK_GOTO, '1', '3', '0',
//TOK_LEN+10, 7, 228, TOK_PRINT, '"', 'I', 'N', 'V', 'A', 'L', 'I', 'D', '"',
//TOK_LEN+ 4, 7, 238, TOK_GOTO, '1', '3', '0',
#endif
// raw3wire test (atiny85)
#ifdef BASICTEST_R3W
TOK_LEN+22, 0, 10, TOK_REM, 'r', '2', 'w', 'i', 'r', 'e', ' ', 't', 'e', 's', 't', ' ', '(', 'a', 't', 'i', 'n', 'y', '8', '5', ')',
TOK_LEN+ 2, 0, 100, TOK_PULLUP, '1',
TOK_LEN+ 2, 0, 110, TOK_CLK, '0',
TOK_LEN+ 2, 0, 120, TOK_DAT, '0',
TOK_LEN+ 2, 0, 130, TOK_AUX, '0',
TOK_LEN+ 2, 0, 140, TOK_PSU, '1',
TOK_LEN+ 4, 0, 150, TOK_DELAY, '2', '5', '5',
TOK_LEN+ 1, 0, 160, TOK_STARTR,
TOK_LEN+ 7, 0, 170, TOK_LET, 'A', '=', TOK_SEND, '1', '7', '2',
TOK_LEN+ 6, 0, 180, TOK_LET, 'B', '=', TOK_SEND, '8', '3',
TOK_LEN+ 5, 0, 190, TOK_LET, 'C', '=', TOK_SEND, '0',
TOK_LEN+ 5, 0, 200, TOK_LET, 'D', '=', TOK_SEND, '0',
TOK_LEN+ 8, 0, 210, TOK_IF, 'C', '!', '=', '8', '3', TOK_THEN, TOK_END,
TOK_LEN+15, 0, 220, TOK_PRINT, '"', 'F', 'O', 'U', 'N', 'D', ' ', 'D', 'E', 'V', 'I', 'C', 'E', '"',
TOK_LEN+13, 0, 230, TOK_PRINT, '"', 'd', 'e', 'v', 'i', 'c', 'e', 'I', 'D', ':', '"', ';',
TOK_LEN+ 6, 0, 240, TOK_LET, 'A', '=', TOK_SEND, '4', '8',
TOK_LEN+ 5, 0, 250, TOK_LET, 'B', '=', TOK_SEND, '0',
TOK_LEN+ 5, 1, 4, TOK_LET, 'C', '=', TOK_SEND, '0',
TOK_LEN+ 5, 1, 14, TOK_LET, 'D', '=', TOK_SEND, '0',
TOK_LEN+ 7, 1, 24, TOK_PRINT, 'D', ';', '"', ' ', '"', ';',
TOK_LEN+ 6, 1, 34, TOK_LET, 'A', '=', TOK_SEND, '4', '8',
TOK_LEN+ 5, 1, 44, TOK_LET, 'B', '=', TOK_SEND, '0',
TOK_LEN+ 5, 1, 54, TOK_LET, 'C', '=', TOK_SEND, '1',
TOK_LEN+ 5, 1, 64, TOK_LET, 'D', '=', TOK_SEND, '0',
TOK_LEN+ 7, 1, 74, TOK_PRINT, 'D', ';', '"', ' ', '"', ';',
TOK_LEN+ 6, 1, 84, TOK_LET, 'A', '=', TOK_SEND, '4', '8',
TOK_LEN+ 5, 1, 94, TOK_LET, 'B', '=', TOK_SEND, '0',
TOK_LEN+ 5, 1, 104, TOK_LET, 'C', '=', TOK_SEND, '2',
TOK_LEN+ 5, 1, 114, TOK_LET, 'D', '=', TOK_SEND, '0',
TOK_LEN+ 2, 1, 124, TOK_PRINT, 'D',
TOK_LEN+14, 1, 134, TOK_PRINT, '"', 'd', 'e', 'v', 'i', 'c', 'e', ' ', 'i', 's', ' ', '"', ';',
TOK_LEN+ 6, 1, 84, TOK_LET, 'A', '=', TOK_SEND, '8', '8',
TOK_LEN+ 5, 1, 94, TOK_LET, 'B', '=', TOK_SEND, '0',
TOK_LEN+ 5, 1, 104, TOK_LET, 'C', '=', TOK_SEND, '2',
TOK_LEN+ 5, 1, 114, TOK_LET, 'D', '=', TOK_SEND, '0',
TOK_LEN+26, 1, 124, TOK_IF, 'D', '=', '3', TOK_THEN, TOK_PRINT, '"', 'U', 'N', 'L', 'O', 'C', 'K', 'E', 'D', '"', TOK_ELSE, TOK_PRINT, '"', 'L', 'O', 'C', 'K', 'E', 'D','"',
TOK_LEN+ 1, 1, 134, TOK_END,
#endif
#ifdef BASICTEST_PIC10
TOK_LEN+15, 0, 100, TOK_REM, 'P', 'R', 'O', 'G', 'R', 'A', 'M', ' ', 'P', 'I', 'C', '1', '0', 'F',
TOK_LEN+ 7, 0, 110, TOK_FOR, 'A', '=', '1', TOK_TO, '2', '4',
TOK_LEN+ 1, 0, 120, TOK_START,
TOK_LEN+ 2, 0, 130, TOK_SEND, '2',
TOK_LEN+ 1, 0, 140, TOK_STOP,
TOK_LEN+ 2, 0, 150, TOK_READ, 'B',
TOK_LEN+ 2, 0, 160, TOK_SEND, 'B',
TOK_LEN+ 1, 0, 170, TOK_START,
TOK_LEN+ 2, 0, 180, TOK_SEND, '8',
TOK_LEN+ 2, 0, 190, TOK_DELAY, '2',
TOK_LEN+ 3, 0, 200, TOK_SEND, '1', '4',
TOK_LEN+ 2, 0, 210, TOK_SEND, '6',
TOK_LEN+ 1, 0, 210, TOK_STOP,
TOK_LEN+ 2, 0, 220, TOK_NEXT, 'A',
TOK_LEN+ 1, 0, 230, TOK_START,
TOK_LEN+ 9, 0, 240, TOK_FOR, 'A', '=', '2', '5', TOK_TO, '5', '1', '2',
TOK_LEN+ 2, 0, 250, TOK_SEND, '6',
TOK_LEN+ 2, 1, 4, TOK_NEXT, 'A',
TOK_LEN+ 2, 1, 14, TOK_SEND, '2',
TOK_LEN+ 1, 1, 24, TOK_STOP,
TOK_LEN+ 2, 1, 34, TOK_READ, 'B',
TOK_LEN+ 2, 1, 44, TOK_SEND, 'B',
TOK_LEN+ 1, 1, 54, TOK_START,
TOK_LEN+ 2, 1, 64, TOK_SEND, '8',
TOK_LEN+ 2, 1, 74, TOK_DELAY, '2',
TOK_LEN+ 3, 1, 84, TOK_SEND, '1', '4',
TOK_LEN+ 1, 1, 94, TOK_STOP,
TOK_LEN+ 1, 1, 104, TOK_END,
//TOK_LEN+11, 3, 232, TOK_REM, 'C', 'O', 'N', 'F', 'I', 'G', 'W', 'O', 'R', 'D',
TOK_LEN+ 5, 3, 232, TOK_DATA, '4', '0', '7', '5',
//TOK_LEN+ 5, 7, 208, TOK_REM, 'M', 'A', 'I', 'N',
TOK_LEN+26, 7, 208, TOK_DATA, '3', '7', ',', '1', '0', '2', '9', ',', '2', '5', '7', '3', ',', '3', '3', '2', '2', ',', '4', '9', ',', '3', '3', '2', '7',
TOK_LEN+26, 7, 218, TOK_DATA, '5', '0', ',', '7', '5', '3', ',', '2', '5', '7', '0', ',', '2', '0', '4', '8', ',', '7', '5', '4', ',', '2', '5', '7', '0',
TOK_LEN+25, 7, 228, TOK_DATA, '2', '5', '6', '7', ',', '3', '2', '6', '4', ',', '2', ',', '3', '0', '7', '2', ',', '3', '8', ',', '3', '3', '2', '3',
TOK_LEN+21, 7, 238, TOK_DATA, '6', ',', '3', '0', '7', '6', ',', '4', '2', '2', ',', '2', '3', '0', '7', ',', '2', '5', '7', '9',
//TOK_LEN+ 7,11, 184, TOK_REM, 'O', 'S', 'C', 'C', 'A', 'L',
TOK_LEN+ 5,11, 184, TOK_DATA, '3', '0', '9', '6',
// data statements and rems aren't mixing well!
#endif
#ifdef BASICTEST_PIC10_2
TOK_LEN+12, 0, 100, TOK_REM, 'D', 'U', 'M', 'P', ' ', 'P', 'I', 'C', '1', '0', 'F',
TOK_LEN+ 8, 0, 110, TOK_FOR, 'A', '=', '1', TOK_TO, '5', '1', '8',
TOK_LEN+ 1, 0, 120, TOK_START,
TOK_LEN+ 2, 0, 130, TOK_SEND, '4',
TOK_LEN+ 1, 0, 140, TOK_STOP,
TOK_LEN+ 7, 0, 150, TOK_PRINT, TOK_RECEIVE, ';', '"', ',', '"', ';',
TOK_LEN+ 1, 0, 160, TOK_START,
TOK_LEN+ 2, 0, 170, TOK_SEND, '6',
TOK_LEN+ 2, 0, 180, TOK_NEXT, 'A',
TOK_LEN+ 1, 0, 190, TOK_END,
#endif
0x00,0x00,
};
*/
// basicinterpreter starts here
void handleelse(void)
{ if(pgmspace[pc]==TOK_ELSE)
{ pc++;
while(pgmspace[pc]<=TOK_LEN)
{ pc++;
}
}
}
int searchlineno(unsigned int line)
{ int i;
int len;
int lineno;
i=0;
//bpWintdec(line);
//UART1TX('?');
while(1)
{ if(pgmspace[i]<=TOK_LEN)
{ return -1;
}
len=pgmspace[i]-TOK_LEN;
lineno=(pgmspace[i+1]<<8)+pgmspace[i+2];
// if(i>PGMSIZE)
// { return -1;
// }
if(line==lineno)
{ return i;
}
i+=len+3;
//bpWintdec(i); bpSP;
//bpWintdec(lineno); bpSP;
}
return -1;
}
int getnumvar(void)
{ int temp;
temp=0;
if((pgmspace[pc]=='('))
{
pc++;
temp=assign();
// temp=evaluate();
if((pgmspace[pc]==')'))
{ pc++;
}
}
else if((pgmspace[pc]>='A')&&(pgmspace[pc]<='Z'))
{ //bpWstring("var ");
//bpWhex(pgmspace[pc]);
//bpSP;
return vars[pgmspace[pc++]-'A']; //increment pc
}
else if(pgmspace[pc]>TOKENS) // looks for tokens like aux, clk and dat
{ switch(pgmspace[pc++]) // increment pc
{ case TOK_RECEIVE: //temp=protoread();
temp=protos[bpConfig.busMode].protocol_read();
break;
case TOK_SEND: //temp=protoread();
temp=protos[bpConfig.busMode].protocol_send(assign());
break;
case TOK_AUX: //temp=protogetaux();
temp=bpAuxRead();
break;
case TOK_DAT: //temp=protogetdat();
temp=protos[bpConfig.busMode].protocol_dats();
break;
case TOK_BITREAD: //temp=protobitr();
temp=protos[bpConfig.busMode].protocol_bitr();
break;
case TOK_PSU: temp=BP_VREGEN; //modeConfig.vregEN;
break;
#ifndef BUSPIRATEV1A
case TOK_PULLUP: temp=(~BP_PULLUP); //modeConfig.pullupEN;
break;
#endif
case TOK_ADC: //temp=bpADC(BP_ADC_PROBE);
ADCON(); // turn ADC ON
temp=bpADC(BP_ADC_PROBE);
ADCOFF(); // turn ADC OFF
// temp=1234;
break;
default: temp=0;
}
}
else
{ while((pgmspace[pc]>='0')&&(pgmspace[pc]<='9'))
{ temp*=10;
temp+=pgmspace[pc]-'0';
pc++;
}
}
//bpWstring("int ");
//bpWinthex(temp);
//bpSP;
return temp;
}
int getmultdiv(void)
{ int temp;
temp=getnumvar();
while (1) {
if((pgmspace[pc]!='*')&&(pgmspace[pc]!='/')&&(pgmspace[pc]!='&')&&(pgmspace[pc]!='|'))
{ return temp;
}
else // assume operand
{ //bpWstring("op ");
//UART1TX(pgmspace[pc]);
//bpSP;
switch(pgmspace[pc++])
{ case '*': //UART1TX('*');
temp*=getnumvar();
break;
case '/': //UART1TX('/');
temp/=getnumvar();
break;
case '&': //UART1TX('/');
temp&=getnumvar();
break;
case '|': //UART1TX('/');
temp|=getnumvar();
break;
default: break;
}
}
}
}
int assign(void)
{ unsigned int temp;
//pc+=2;
temp=getmultdiv();
while (1) {
if((pgmspace[pc]!='-')&&(pgmspace[pc]!='+')&&(pgmspace[pc]!='<')&&(pgmspace[pc]!='>')&&(pgmspace[pc]!='='))
{ return temp;
}
else // assume operand
{ //bpWstring("op ");
//UART1TX(pgmspace[pc]);
//bpSP;
switch(pgmspace[pc++])
{ case '-': //UART1TX('-');
temp-=getmultdiv();
break;
case '+': //UART1TX('+');
temp+=getmultdiv();
break;
case '>': //UART1TX('+');
if(pgmspace[pc+1]=='=')
{ temp=(temp>=getmultdiv()?1:0);
pc++;
}
else
{ temp=(temp>getmultdiv()?1:0);
}
break;
case '<': //UART1TX('+');
if(pgmspace[pc+1]=='>')
{ temp=(temp!=getmultdiv()?1:0);
pc++;
}
else if(pgmspace[pc+1]=='=')
{ temp=(temp<=getmultdiv()?1:0);
pc++;
}
else
{ temp=(temp<getmultdiv()?1:0);
}
break;
case '=': //UART1TX('+');
temp=(temp==getmultdiv()?1:0);
default: break;
}
}
}
}
/*
int evaluate(void)
{ int left;
int right;
int i;
char op[2]; // operand
left=vars[pgmspace[pc++]-'A'];
i=0;
while((!((pgmspace[pc]>='A')&&(pgmspace[pc]<='Z')))&&(!((pgmspace[pc]>='0')&&(pgmspace[pc]<='9'))))
{ op[i]=pgmspace[pc++];
i++;
}
right=assign();
//bpSP;
//bpWinthex(left); bpSP;
//UART1TX(op[0]);
//UART1TX(op[1]); bpSP;
//bpWinthex(right); bpSP;
switch (op[0])
{ case '=': return (left==right);
case '>': if(op[1]=='=')
{ return (left>=right);
}
else
{ return (left>right);
}
case '<': if(op[1]=='=')
{ return (left<=right);
}
else
{ return (left<right);
}
case '!': if(op[1]=='=')
{ return (left!=right);
}
default: return 0;
}
return 0;
}
*/
void interpreter(void)
{ int len;
unsigned int lineno;
int i;
// int pc; //became global
int stop;
int pcupdated;
int ifstat;
int temp;
// init
pc=0;
stop=0;
pcupdated=0;
ifstat=0;
fors=0;
gosubs=0;
datapos=0;
lineno=0;
bpConfig.quiet=1; // turn echoing off
for(i=0; i<26; i++) vars[i]=0;
while(!stop)
{ if(!ifstat)
{ if(pgmspace[pc]<TOK_LEN)
{ stop=NOLEN;
break;
}
len=pgmspace[pc]-TOK_LEN;
lineno=((pgmspace[pc+1]<<8)|pgmspace[pc+2]);
/* bpBR;
bpWintdec(pc);
bpSP;
bpWintdec(lineno);
bpSP;
bpWdec(len);
bpSP; */
}
ifstat=0;
switch(pgmspace[pc+3]) // first token
{ case TOK_LET: //bpWstring(STAT_LET);
//bpSP;
//for(i=4; i<len+3; i++)
//{ UART1TX(pgmspace[pc+i]);
//}
pcupdated=1;
pc+=6; // 4(len lineno lineno token) +2 ("A=")
vars[pgmspace[pc-2]-0x41]=assign();
handleelse();
//bpBR;
break;
case TOK_IF: //bpWstring(STAT_IF);
//bpSP;
//i=4;
//while(pgmspace[pc+i]<0x80)
//{ UART1TX(pgmspace[pc+i]); // print if condition
// i++;
//}
//bpSP;
//if(pgmspace[pc+i]==TOK_THEN)
//{ bpWstring(STAT_THEN);
// bpSP;
// i++;
// while((pgmspace[pc+i]!=TOK_ELSE)&&(i<len))
// { UART1TX(pgmspace[pc+i]);
// i++;
// }
//}
//if(pgmspace[pc+i]==TOK_ELSE)
//{ bpWstring(STAT_ELSE);
// bpSP;
// i++;
// for( ; i<len+3; i++)
// { UART1TX(pgmspace[pc+i]);
// }
//}
pcupdated=1;
pc+=4;
//temp=pc;
//if(evaluate())
if(assign())
{ //bpWline("TRUE"); // execute statement then
if(pgmspace[pc++]==TOK_THEN)
{ //bpWstring ("THEN");
ifstat=1;
pc-=3; // simplest way (for now)
}
}
else
{ //bpWline("FALSE");
while((pgmspace[pc]!=TOK_ELSE)&&(pgmspace[pc]<=TOK_LEN))
{ pc++;
}
if(pgmspace[pc]==TOK_ELSE)
{ //bpWstring ("ELSE");
ifstat=1;
pc-=2; // simplest way (for now)
}
}
//bpWstring(" endif ");
break;
case TOK_GOTO: //bpWstring(STAT_GOTO);
//bpSP;
//for(i=4; i<len+3; i++)
//{ UART1TX(pgmspace[pc+i]);
//}
pcupdated=1;
pc+=4;
//bpConfig.quiet=0;
temp=searchlineno(assign());
//bpSP; bpWintdec(temp); bpSP;
if(temp!=-1)
{ pc=temp;
}
else
{ stop=GOTOERROR;
}
//bpConfig.quiet=1;
break;
case TOK_GOSUB: //bpWstring(STAT_GOSUB);
//bpSP;
//for(i=4; i<len+3; i++)
//{ UART1TX(pgmspace[pc+i]);
//}
pcupdated=1;
pc+=4;
if(gosubs<GOSUBMAX)
{ stack_[gosubs]=pc+len-1;
gosubs++;
temp=searchlineno(assign());
//bpSP; bpWinthex(temp); bpSP;
if(temp!=-1)
{ pc=temp;
}
else
{ stop=GOTOERROR;
}
}
else
{ stop=STACKERROR;
}
//bpBR;
break;
case TOK_RETURN: bpWstring(STAT_RETURN);
pcupdated=1;
if(gosubs)
{ pc=stack_[--gosubs];
}
else
{ stop=RETURNERROR;
}
//bpBR
break;
case TOK_REM: //bpWstring(STAT_REM);
//bpSP;
//for(i=4; i<len+3; i++)
//{ UART1TX(pgmspace[pc+i]);
//}
//bpBR;
pcupdated=1;
pc+=len+3;
break;
case TOK_PRINT: //bpWstring(STAT_PRINT);
//bpSP;
//for(i=4; i<len+3; i++)
//{ UART1TX(pgmspace[pc+i]);
//}
pcupdated=1;
pc+=4;
while((pgmspace[pc]<TOK_LEN)&&(pgmspace[pc]!=TOK_ELSE))
{ if(pgmspace[pc]=='\"') // is it a string?
{ pc++;
while(pgmspace[pc]!='\"')
{ bpConfig.quiet=0;
UART1TX(pgmspace[pc++]);
bpConfig.quiet=1;
}
pc++;
}
else if(((pgmspace[pc]>='A')&&(pgmspace[pc]<='Z'))||((pgmspace[pc]>=TOKENS)&&(pgmspace[pc]<TOK_LEN)))
{ temp=assign();
bpConfig.quiet=0;
bpWintdec(temp);
bpConfig.quiet=1;
}
else if(pgmspace[pc]==';') // spacer
{ pc++;
}
}
if(pgmspace[pc-1]!=';')
{ bpConfig.quiet=0;
bpBR;
bpConfig.quiet=1;
}
handleelse();
break;
case TOK_INPUT: //bpWstring(STAT_INPUT);
//bpSP;
//for(i=4; i<len+3; i++)
//{ UART1TX(pgmspace[pc+i]);
//}
pcupdated=1;
bpConfig.quiet=0; // print prompt
pc+=4;
if(pgmspace[pc]=='\"') // is it a string?
{ pc++;
while(pgmspace[pc]!='\"')
{ UART1TX(pgmspace[pc++]);
}
pc++;
}
if(pgmspace[pc]==',')
{ pc++;
}
else
{ stop=SYNTAXERROR;
}
vars[pgmspace[pc]-'A']=getnumber(0, 0, 0x7FFF, 0);
pc++;
handleelse();
bpConfig.quiet=1;
break;
case TOK_FOR: //bpWstring(STAT_FOR);
//bpSP;
//i=0;
//while(pgmspace[pc+4+i]<0x80)
//{ UART1TX(pgmspace[pc+4+i]); // print for condition
// i++;
//}
//bpSP;
//if(pgmspace[pc+4+i]==TOK_TO)
//{ bpWstring(STAT_TO);
// bpSP;
//}
//i++;
//while(len>(1+i))
//{ UART1TX(pgmspace[pc+4+i]); // print to
// i++;
//}
pcupdated=1;
pc+=4;
if(fors<FORMAX)
{ fors++;
}
else
{ stop=FORERROR; // to many nested fors
}
forloops[fors].var=(pgmspace[pc++]-'A')+1;
if(pgmspace[pc]=='=')
{ pc++;
vars[(forloops[fors].var)-1]=assign();
}
else
{ stop=SYNTAXERROR;
}
if(pgmspace[pc++]==TOK_TO)
{ //bpWstring(STAT_TO);
forloops[fors].to=assign();
}
else
{ stop=SYNTAXERROR;
}
if(pgmspace[pc]>=TOK_LEN)
{ forloops[fors].forstart=pc;
}
else
{ stop=SYNTAXERROR;
}
//bpSP;
//bpWinthex(forloops[fors].var); bpSP;
//bpWinthex(forloops[fors].to); bpSP;
//bpWinthex(forloops[fors].forstart); bpSP;
//bpBR;
handleelse();
break;
case TOK_NEXT: //bpWstring(STAT_NEXT);
//bpSP;
//for(i=4; i<len+3; i++)
//{ UART1TX(pgmspace[pc+i]);
//}
pcupdated=1;
pc+=4;
temp=(pgmspace[pc++]-'A')+1;
stop=NEXTERROR;
for(i=0; i<=fors; i++)
{ if(forloops[i].var==temp)
{ if(vars[temp-1]<forloops[i].to)
{ vars[temp-1]++;
pc=forloops[i].forstart;
}
else
{ fors--;
}
stop=0;
}
}
handleelse();
break;
case TOK_READ: pcupdated=1;
pc+=4;
if(datapos==0)
{ i=0;
while((pgmspace[i+3]!=TOK_DATA)&&(pgmspace[i]!=0x00))
{ i+=(pgmspace[i]-TOK_LEN)+3;
//bpWinthex(i); bpSP;
}
//bpWinthex(pgmspace[i]);
if(pgmspace[i])
{ datapos=i+4;
}
else
{ stop=DATAERROR;
}
}
//bpWstring("datapos ");
//bpWinthex(datapos); bpSP;
//UART1TX(pgmspace[datapos]); bpSP;
temp=pc;
pc=datapos;
vars[pgmspace[temp]-'A']=getnumvar();
datapos=pc;
pc=temp+1;
if(pgmspace[datapos]==',')
{ datapos++;
}
if(pgmspace[datapos]>TOK_LEN)
{ if(pgmspace[datapos+3]!=TOK_DATA)
{ datapos=0; // rolover
}
else
{ datapos+=4;
}
}
handleelse();
break;
case TOK_DATA: pcupdated=1;
pc+=len+3;
break;
// buspirate subs
case TOK_START: pcupdated=1;
pc+=4;
protos[bpConfig.busMode].protocol_start();
handleelse();
//protostart();
break;
case TOK_STARTR: pcupdated=1;
pc+=4;
protos[bpConfig.busMode].protocol_startR();
//protostartr();
handleelse();
break;
case TOK_STOP: pcupdated=1;
pc+=4;
protos[bpConfig.busMode].protocol_stop();
//protostop();
handleelse();
break;
case TOK_STOPR: pcupdated=1;
pc+=4;
protos[bpConfig.busMode].protocol_stopR();
//protostopr();
handleelse();
break;
case TOK_SEND: pcupdated=1;
pc+=4;
//protowrite(getnumvar());
protos[bpConfig.busMode].protocol_send((int)assign());
handleelse();
break;
case TOK_AUX: pcupdated=1;
pc+=4;
if(assign())
{ //protoauxh();
bpAuxHigh();
}
else
{ //protoauxl();
bpAuxLow();
}
handleelse();
break;
case TOK_PSU: pcupdated=1;
pc+=4;
if(assign())
{ //protopsuon();
BP_VREG_ON();
//modeConfig.vregEN=1;
}
else
{ //protopsuoff();
BP_VREG_OFF();
//modeConfig.vregEN=0;
}
handleelse();
break;
case TOK_AUXPIN: pcupdated=1;
pc+=4;
if(assign())
{ modeConfig.altAUX=1;
}
else
{ modeConfig.altAUX=1;
}
handleelse();
break;
case TOK_FREQ: pcupdated=1;
pc+=4;
PWMfreq=assign();
if(PWMfreq<0) PWMfreq=0;
if(PWMfreq>4000) PWMfreq=4000;
if(PWMduty<2) PWMduty=2;
if(PWMduty>99) PWMduty=99;
updatePWM();
handleelse();
break;
case TOK_DUTY: pcupdated=1;
pc+=4;
PWMduty=assign();
if(PWMfreq<0) PWMfreq=0;
if(PWMfreq>4000) PWMfreq=4000;
if(PWMduty<2) PWMduty=2;
if(PWMduty>99) PWMduty=99;
updatePWM();
handleelse();
break;
case TOK_DAT: pcupdated=1;
pc+=4;
if(assign())
{ //protodath();
protos[bpConfig.busMode].protocol_dath();
}
else
{ //protodatl();
protos[bpConfig.busMode].protocol_datl();
}
handleelse();
break;
case TOK_CLK: pcupdated=1;
pc+=4;
switch(assign())
{ case 0: //protoclkl();
protos[bpConfig.busMode].protocol_clkl();
break;
case 1: //protoclkh();
protos[bpConfig.busMode].protocol_clkh();
break;
case 2: //protoclk();
protos[bpConfig.busMode].protocol_clk();
break;
}
handleelse();
break;
case TOK_PULLUP: pcupdated=1;
pc+=4;
#ifndef BUSPIRATEV1A
//#if(0)
if(assign())
{ //protopullupon();
BP_PULLUP_ON();
//modeConfig.pullupEN=1;
}
else
{ //protopullupoff();
BP_PULLUP_OFF();
//modeConfig.pullupEN=0;
}
#else
pc+=len-1; // fail silently
#endif
handleelse();
break;
case TOK_DELAY: pcupdated=1;
pc+=4;
temp=assign();
bpDelayMS(temp);
handleelse();
break;
case TOK_MACRO: pcupdated=1;
pc+=4;
temp=assign();
protos[bpConfig.busMode].protocol_macro(temp);
handleelse();
break;
case TOK_END: //bpWstring(STAT_END);
stop=1;
break;
default: stop=SYNTAXERROR;
break;
}
if(!pcupdated)
{ pc+=len+3;
//bpBR;
}
pcupdated=0;
}
bpConfig.quiet=0; // display on
if(stop!=NOERROR)
{ //bpWstring("Error(");
BPMSG1047;
bpWintdec(stop);
//bpWstring(") @line:");
BPMSG1048;
bpWintdec(lineno);
//bpWstring(" @pgmspace:");
BPMSG1049;
bpWintdec(pc);
bpBR;
}
//bpWinthex(vars[0]); bpSP;
//bpWinthex(vars[1]); bpSP;
//bpWinthex(vars[2]); bpSP;
}
void printstat(char *s)
{ bpSP;
bpWstring(s);
bpSP;
}
void list(void)
{ unsigned char c;
unsigned int lineno;
pc=0;
while(pgmspace[pc])
{ c=pgmspace[pc];
if(c<TOK_LET)
{ UART1TX(c);
}
else if(c>TOK_LEN)
{ bpBR;
//bpWintdec(pc); bpSP;
lineno=(pgmspace[pc+1]<<8)+pgmspace[pc+2];
pc+=2;
bpWintdec(lineno);
bpSP;
}
else
{ bpSP;
bpWstring(tokens[c-TOKENS]);
bpSP;
}
pc++;
}
bpBR;
bpWintdec(pc-1);
//bpWline(" bytes.");
BPMSG1050;
}
int compare(char *p)
{ int oldstart;
oldstart=cmdstart;
while(*p)
{ if(*p!=cmdbuf[cmdstart])
{ cmdstart=oldstart;
return 0;
}
cmdstart=(cmdstart+1)&CMDLENMSK;
p++;
}
return 1;
}
unsigned char gettoken(void)
{ int i;
for(i=0; i<NUMTOKEN; i++)
{ if(compare(tokens[i]))
{ return TOKENS+i;
}
}
return 0;
}
void basiccmdline(void)
{ int i, j, temp;
int pos, end, len, string;
unsigned char line[35];
unsigned int lineno1, lineno2;
//convert to everyhting to uppercase
for(i=cmdstart; i!=cmdend; )
{ if((cmdbuf[i]>='a')&&(cmdbuf[i]<='z')) cmdbuf[i]&=0xDF;
i++;
i&=CMDLENMSK;
}
i=0;
// command or a new line?
if((cmdbuf[cmdstart]>='0')&&(cmdbuf[cmdstart]<='9'))
{ //bpWline("new line");
for(i=0; i<35; i++)
{ line[i]=0;
}
temp=getint();
line[1]=temp>>8;
line[2]=temp&0xFF;
//bpWstring("search for line ");
//bpWintdec(temp); bpBR;
pos=searchlineno(temp);
//bpWstring("pos=");
//bpWintdec(pos); bpSP;
if(pos!=-1) // if it already exist remove it first
{ //bpWstring("replace/remove line @");
//bpWintdec(pos); bpBR
len=(pgmspace[pos]-TOK_LEN)+3;
//bpWstring("pos=");
//bpWintdec(pos); bpSP;
for(i=pos; i<PGMSIZE-len; i++)
{ pgmspace[i]=pgmspace[i+len]; // move everyhting from pos len bytes down
}
//bpWstring("i=");
//bpWintdec(i); bpBR;
for( ; i<PGMSIZE; i++)
{ pgmspace[i]=0x00;
}
}
i=3;
string=0;
consumewhitechars();
while(cmdstart!=cmdend)
{ if(!string)
{ consumewhitechars();
}
if(!string)
{ temp=gettoken();
}
else
{ temp=0;
}
if(temp)
{ line[i]=temp;
if(temp==TOK_REM) string=1; // allow spaces in rem statement
}
else
{ if(cmdbuf[cmdstart]=='"') string^=0x01;
line[i]=cmdbuf[cmdstart];
cmdstart=(cmdstart+1)&CMDLENMSK;
}
i++;
if(i>35)
{ //bpWline("Too long!");
BPMSG1051;
return;
}
}
//bpWstring("i=");
//bpWintdec(i); bpSP;
if(i==3) return; // no need to insert an empty line
if(i==4) return; // no need to insert an empty line
line[0]=TOK_LEN+(i-4);
//UART1TX('[');
//for(i=0; i<35; i++)
//{ UART1TX(line[i]);
//}
//UART1TX(']');
i=0;
end=0;
pos=0;
while(!end)
{ if(pgmspace[i]>TOK_LEN) // valid line
{ len=pgmspace[i]-TOK_LEN;
//bpWstring("len=");
//bpWintdec(len); bpSP;
lineno1=(pgmspace[i+1]<<8)+pgmspace[i+2];
lineno2=(line[1]<<8)+line[2];
if(lineno1<lineno2)
{ pos=i+len+3;
//bpWstring("pos=");
//bpWintdec(pos); bpSP;
}
i+=(len+3);
}
else
{ end=i; // we found the end! YaY!
}
temp=(pgmspace[i+1]<<8)+pgmspace[i+2];
//bpWstring("#");
//bpWintdec(temp); bpSP;
//bpWstring("i=");
//bpWintdec(i); bpSP;
}
//bpWstring("pos=");
//bpWintdec(pos); bpSP;
//bpWstring("end=");
//bpWintdec(end);
//bpBR;
temp=(line[0]-TOK_LEN)+3;
//for(i=end+temp; i>=pos; i--)
for(i=end; i>=pos; i--)
{ pgmspace[i+temp]=pgmspace[i]; // move every thing from pos temp
}
for(i=0; i<temp; i++) // insert line
{ pgmspace[pos+i]=line[i];
}
//cmdstart=cmdend;
}
else
{ if(compare("RUN"))
{ interpreter();
bpBR;
}
else if(compare("LIST"))
{ list();
}
else if(compare("EXIT"))
{ bpConfig.basic=0;
}
#ifdef BP_USE_BASICI2C
else if(compare("FORMAT"))
{ format();
}
else if(compare("SAVE"))
{ save();
}
else if(compare("LOAD"))
{ load();
}
#endif
else if(compare("DEBUG"))
{ for(i=0; i<PGMSIZE; i+=16)
{ for(j=0; j<16; j++)
{ bpWhex(pgmspace[i+j]); bpSP;
}
}
}
else if(compare("NEW"))
{ initpgmspace();
}
else
{ //bpWline("Syntax error");
BPMSG1052;
}
}
// cmdstart=cmdend;
}
void initpgmspace(void)
{ int i;
for(i=0; i<PGMSIZE ;i++)
{ pgmspace[i]=0;
}
pgmspace[0]=TOK_LEN+1;
pgmspace[1]=0xFF;
pgmspace[2]=0xFF;
pgmspace[3]=TOK_END;
}
#ifdef BP_USE_BASICI2C
// i2c eeprom interaction
// need to incorperate it in bitbang or r2wire!
// CvD: I stole most off it from bitbang.c/h
#define BASSDA 1
#define BASSCL 2
#define BASI2CCLK 100
#define EEP24LC256
#ifdef EEP24LC256
#define I2CADDR 0xA0
#define EEPROMSIZE 0x8000
#define EEPROMPAGE 64
#endif
//globals
int eeprom_lastprog;
unsigned int eeprom_lastmem;
void HIZbbL(unsigned int pins, int delay)
{ IOLAT &=(~pins); //pins to 0
IODIR &=(~pins);//direction to output
bpDelayUS(delay);//delay
}
void HIZbbH(unsigned int pins, int delay)
{ IODIR |= pins;//open collector output high
bpDelayUS(delay);//delay
}
unsigned char HIZbbR(unsigned int pin)
{ IODIR |= pin; //pin as input
Nop();
Nop();
Nop();
if(IOPOR & pin) return 1; else return 0; //clear all but pin bit and return result
}
void basi2cstart(void)
{ HIZbbH((BASSDA|BASSCL), BASI2CCLK); // both hi
HIZbbL(BASSDA, BASI2CCLK); // data down
HIZbbL(BASSCL, BASI2CCLK); // clk down
HIZbbH(BASSDA, BASI2CCLK); // data up
}
void basi2cstop(void)
{ HIZbbL((BASSDA|BASSCL), BASI2CCLK);
HIZbbH(BASSCL, BASI2CCLK);
HIZbbH(BASSDA, BASI2CCLK);
}
unsigned char basi2cread(int ack)
{ int i;
unsigned char c;
c=0;
HIZbbR(BASSDA);
for(i=0; i<8; i++)
{ HIZbbL(BASSCL, BASI2CCLK/5);
HIZbbH(BASSCL, BASI2CCLK);
c<<=1;
c|=HIZbbR(BASSDA);
HIZbbL(BASSCL, BASI2CCLK);
}
if(ack)
{ HIZbbL(BASSDA, BASI2CCLK/5);
}
HIZbbH(BASSCL, BASI2CCLK);
HIZbbL(BASSCL, BASI2CCLK);
return c;
}
int basi2cwrite(unsigned char c)
{ int i;
unsigned char mask;
mask=0x80;
for(i=0; i<8; i++)
{ if(c&mask)
{ HIZbbH(BASSDA, BASI2CCLK/5);
//bpWstring("W1");
}
else
{ HIZbbL(BASSDA, BASI2CCLK/5);
//bpWstring("W0");
}
HIZbbH(BASSCL, BASI2CCLK);
HIZbbL(BASSCL, BASI2CCLK);
mask>>=1;
}
HIZbbH(BASSCL, BASI2CCLK);
i=HIZbbR(BASSDA);
HIZbbL(BASSCL, BASI2CCLK);
return (i^0x01);
}
int checkeeprom(void)
{ // just to be sure
basi2cstop();
basi2cstop();
basi2cstart();
if(!basi2cwrite(I2CADDR))
{ //bpWline("No EEPROM");
BPMSG1053;
return 0;
}
basi2cwrite(0x00);
basi2cwrite(0x00);
basi2cstart();
if(basi2cread(1)==0x00) // check for any data
{ bpWline("No EEPROM"); // if 0 prolly no pullup and eeprom (PROLLY!)
BPMSG1053;
return 0;
}
basi2cstop();
return 1;
}
void format(void)
{ int i,j;
basi2cstop();
basi2cstart();
if(!basi2cwrite(I2CADDR))
{ //bpWline("No EEPROM");
BPMSG1053;
return;
}
basi2cstop();
//bpWstring("Erasing");
BPMSG1054;
for(i=0; i<EEPROMSIZE; i+=EEPROMPAGE)
{ basi2cstart();
basi2cwrite(I2CADDR);
basi2cwrite((i>>8));
basi2cwrite((i&0x0FF));
for(j=0; j<EEPROMPAGE; j++)
{ basi2cwrite(0xFF);
}
basi2cstop();
UART1TX('.');
waiteeprom();
}
//bpWline("done");
BPMSG1055;
}
void waiteeprom(void)
{ int wait;
wait=1;
while(wait)
{ basi2cstart();
wait=basi2cwrite(I2CADDR);
basi2cstop();
}
}
void save(void)
{ int i,j;
int slot;
consumewhitechars();
slot=getint();
if(slot==0)
{ //bpWline("Syntax error");
BPMSG1052;
return;
}
//bpWstring("Saving to slot ");
BPMSG1056;
bpWdec(slot);
bpBR;
if(slot>(EEPROMSIZE/PGMSIZE))
{ //bpWline("Invalid slot");
BPMSG1057;
return;
}
if(!checkeeprom())
{ return;
}
slot*=PGMSIZE;
basi2cstop();
basi2cwrite(I2CADDR);
basi2cwrite(slot>>8);
basi2cwrite(slot&0x0FF);
basi2cstart();
basi2cwrite(I2CADDR+1);
slot*=EEPROMPAGE;
for(i=0; i<PGMSIZE; i+=EEPROMPAGE) // we assume that pgmsize is dividable by eeprompage
{ basi2cstart();
basi2cwrite(I2CADDR);
basi2cwrite((slot+i)>>8);
basi2cwrite((slot+i)&0x0FF);
for(j=0; j<EEPROMPAGE; j++)
{ basi2cwrite(pgmspace[i+j]);
}
basi2cstop();
UART1TX('.');
waiteeprom();
}
}
void load(void)
{ int i;
int slot;
consumewhitechars();
slot=getint();
if(slot==0)
{ //bpWline("Syntax error");
BPMSG1052;
return;
}
//bpWstring("Loading from slot ");
BPMSG1058;
bpWdec(slot);
bpBR;
if(slot>(EEPROMSIZE/PGMSIZE))
{ //bpWline("Invalid slot");
BPMSG1057;
return;
}
if(!checkeeprom())
{ return;
}
slot*=PGMSIZE;
basi2cstop();
basi2cwrite(I2CADDR);
basi2cwrite(slot>>8);
basi2cwrite(slot&0x0FF);
basi2cstart();
basi2cwrite(I2CADDR+1);
for(i=0; i<PGMSIZE; i++)
{ if(!(i%EEPROMPAGE)) UART1TX('.'); // pure estetic
pgmspace[i]=basi2cread(1);
}
}
#endif // BP_USE_BASICI2C
#endif // BP_USE_BASIC
| {
"pile_set_name": "Github"
} |
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::readFieldsFunctionObject
Description
FunctionObject wrapper around readFields to allow them to be created via
the functions entry within controlDict.
SourceFiles
readFieldsFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef readFieldsFunctionObject_H
#define readFieldsFunctionObject_H
#include "readFields.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<readFields>
readFieldsFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
| {
"pile_set_name": "Github"
} |
using System;
using System.Runtime.Serialization;
namespace VersionTolerantSerializationTestLib
{
[Serializable]
public class Address
{
private string Street = "v5-Street";
private string City = "v5-City";
private string CountryCode = "v5-CountryCode";
[OptionalField (VersionAdded = 4)]
private string PostCode;
[OptionalField (VersionAdded = 5)]
private string AreaCode = "5";
public override string ToString () {
return String.Format ("v5 obj {0} {1} {2}", Street, City, CountryCode);
}
}
}
| {
"pile_set_name": "Github"
} |
nothing here
| {
"pile_set_name": "Github"
} |
/* -*- mode: c++ -------*- */
| {
"pile_set_name": "Github"
} |
console = {
log: function (string) {
window.webkit.messageHandlers.OOXX.postMessage({className: 'Console', functionName: 'log', data: string});
}
} | {
"pile_set_name": "Github"
} |
#python
import k3d
import testing
setup = testing.setup_mesh_modifier_test("PolyCube", "CUDATransformPointsAsynchronous")
selection = k3d.geometry.selection.create(0)
selection.points = k3d.geometry.point_selection.create(selection, 1)
setup.modifier.mesh_selection = selection
setup.modifier.input_matrix = k3d.translate3(k3d.vector3(0, 0, 1))
testing.require_valid_mesh(setup.document, setup.modifier.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.TransformPoints", 1)
| {
"pile_set_name": "Github"
} |
package io.iohk.ethereum.crypto.zksnark
import akka.util.ByteString
import io.iohk.ethereum.crypto.zksnark.BN128.Point
import io.iohk.ethereum.crypto.zksnark.FiniteField.Ops._
/**
* Barreto–Naehrig curve over some finite field
* Curve equation:
* Y^2^ = X^3^ + b, where "b" is a constant number belonging to corresponding specific field
*
* Code of curve arithmetic has been ported from:
* <a href="https://github.com/scipr-lab/libff/blob/master/libff/algebra/curves/alt_bn128/alt_bn128_g1.cpp">bn128cpp</a>
* and
* <a href="https://github.com/ethereum/ethereumj/blob/develop/ethereumj-core/src/main/java/org/ethereum/crypto/zksnark/BN128.java">
* bn128java
* </a>
*
* */
sealed abstract class BN128[T: FiniteField] {
val zero = Point(FiniteField[T].zero, FiniteField[T].zero, FiniteField[T].zero)
def Fp_B: T
protected def createPointOnCurve(x: T, y: T): Option[Point[T]] = {
if (x.isZero() && y.isZero())
Some(zero)
else {
val point = Point(x, y, FiniteField[T].one)
Some(point).filter(isValidPoint)
}
}
def toAffineCoordinates(p1: Point[T]): Point[T] = {
if (p1.isZero)
Point(zero.x, FiniteField[T].one, zero.z)
else {
val zInv = p1.z.inversed()
val zInvSquared = zInv.squared()
val zInvMul = zInv * zInvSquared
val ax = p1.x * zInvSquared
val ay = p1.y * zInvMul
Point(ax, ay, FiniteField[T].one)
}
}
def toEthNotation(p1: Point[T]): Point[T] = {
val affine = toAffineCoordinates(p1)
if (affine.isZero)
zero
else
affine
}
/**
* Point is on curve when its coordinates (x, y) satisfy curve equation which in jacobian coordinates becomes
* Y^2^ = X^3^ + b * Z^6^
* */
def isOnCurve(p1: Point[T]): Boolean = {
if (p1.isZero)
true
else {
val z6 = (p1.z.squared() * p1.z).squared()
val l = p1.y.squared()
val r = (p1.x.squared() * p1.x) + (Fp_B * z6)
l == r
}
}
def add(p1: Point[T], p2: Point[T]): Point[T] = {
if (p1.isZero)
p2
else if (p2.isZero)
p1
else {
val z1Squared = p1.z.squared()
val z2Squared = p2.z.squared()
val u1 = p1.x * z2Squared
val u2 = p2.x * z1Squared
val z1Cubed = p1.z * z1Squared
val z2Cubed = p2.z * z2Squared
val s1 = p1.y * z2Cubed
val s2 = p2.y * z1Cubed
if (u1 == u2 && s1 == s2) {
dbl(p1)
} else {
val h = u2 - u1
val i = h.doubled().squared()
val j = h * i
val r = (s2 - s1).doubled()
val v = u1 * i
val zz = (p1.z + p2.z).squared() - z1Squared - z2Squared
val x3 = r.squared() - j - v.doubled()
val y3 = r * (v - x3) - (s1 * j).doubled()
val z3 = zz * h
Point(x3, y3, z3)
}
}
}
def dbl(p1: Point[T]): Point[T] ={
if (p1.isZero)
p1
else {
val a = p1.x.squared()
val b = p1.y.squared()
val c = b.squared()
val d = ((p1.x + b).squared() - a - c).doubled()
val e = a + a + a
val f = e.squared()
val x3 = f - (d + d)
val y3 = e * (d - x3) - c.doubled().doubled().doubled()
val z3 = (p1.y * p1.z).doubled()
Point(x3, y3, z3)
}
}
/**
* Multiplication by scalar n is just addition n times e.g n * P = P + P + .. n times.
* Faster algorithm is used here, which is known as:
* <a href=https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication#Double-and-add>Double-and-add</a>
*
* */
def mul(p1: Point[T], s: BigInt): Point[T] = {
if (s == 0 || p1.isZero)
zero
else {
var i = s.bitLength - 1
var result = zero
while (i >= 0) {
result = dbl(result)
if (s.testBit(i)) {
result = add(result, p1)
}
i = i - 1
}
result
}
}
def isValidPoint(p1: Point[T]): Boolean =
p1.isValid && isOnCurve(p1)
}
object BN128Fp extends BN128[Fp] {
val Fp_B = Fp.B_Fp
def createPoint(xx: ByteString, yy: ByteString): Option[Point[Fp]] = {
val x = Fp(xx)
val y = Fp(yy)
createPointOnCurve(x, y)
}
}
object BN128Fp2 extends BN128[Fp2] {
val Fp_B = Fp2.B_Fp2
def createPoint(a: ByteString, b: ByteString, c: ByteString, d: ByteString): Option[Point[Fp2]] = {
val x = Fp2(a, b)
val y = Fp2(c, d)
createPointOnCurve(x, y)
}
}
object BN128 {
case class Point[T: FiniteField](x: T, y: T, z: T) {
def isZero: Boolean = z.isZero()
def isValid: Boolean =
x.isValid() && y.isValid() && z.isValid()
}
case class BN128G1(p: Point[Fp])
object BN128G1 {
/**
* Constructs valid element of subgroup `G1`
* To be valid element of subgroup, elements needs to be valid point (have valid coordinates in Fp_2 and to be on curve
* Bn128 in Fp
* @return [[scala.None]] if element is invald group element, [[io.iohk.ethereum.crypto.zksnark.BN128.BN128G1]]
*/
def apply(xx: ByteString, yy: ByteString): Option[BN128G1] = {
// Every element of our Fp is also element of subgroup G1
BN128Fp.createPoint(xx, yy).map(new BN128G1(_))
}
}
case class BN128G2(p: Point[Fp2])
object BN128G2 {
import BN128Fp2._
/**
* "r" order of cyclic subgroup
*/
val R = BigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617")
private val negOneModR = (-BigInt(1)).mod(R)
private def isGroupElement(p: Point[Fp2]): Boolean = {
add(mul(p, negOneModR), p).isZero // -1 * p + p == 0
}
/**
* Constructs valid element of subgroup `G2`
* To be valid element of subgroup, elements needs to be valid point (have valid coordinates in Fp_2 and to be on curve
* Bn128 in Fp_2) and fullfill the equation `-1 * p + p == 0`
* @return [[scala.None]] if element is invald group element, [[io.iohk.ethereum.crypto.zksnark.BN128.BN128G2]]
*/
def apply(a: ByteString, b: ByteString, c: ByteString, d: ByteString): Option[BN128G2] = {
createPoint(a ,b, c, d).flatMap{ point =>
if(isGroupElement(point))
Some(BN128G2(point))
else
None
}
}
def mulByP(p: Point[Fp2]): Point[Fp2] = {
val rx = Fp2.TWIST_MUL_BY_P_X * Fp2.frobeniusMap(p.x, 1)
val ry = Fp2.TWIST_MUL_BY_P_Y * Fp2.frobeniusMap(p.y, 1)
val rz = Fp2.frobeniusMap(p.z, 1 )
Point(rx, ry, rz)
}
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.zjw.apporder.MyLinearLayout
android:id="@+id/myLayout"
android:layout_width="wrap_content"
android:layout_height="300dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true">
<RelativeLayout
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/button"
android:layout_width="50dp"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark"
android:text="点我"
android:textSize="20sp" />
<GridLayout
android:id="@+id/gridLayout"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/button"
android:background="@android:color/holo_red_light" />
</RelativeLayout>
</com.zjw.apporder.MyLinearLayout>
</RelativeLayout> | {
"pile_set_name": "Github"
} |
make = "Canon"
model = "Canon PowerShot D10"
clean_make = "Canon"
clean_model = "PowerShot D10"
blackpoint = 0
whitepoint = 4095
color_matrix = [9427, -3036, -959, -2581, 10671, 1911, -1039, 1982, 4430]
color_pattern = "GBRG"
crops = [22,80,8,25]
filesize = 18763488
raw_width = 4104
raw_height = 3048
blackareav = [4074, 30]
| {
"pile_set_name": "Github"
} |
/***************************************************************************
* This file is part of the CuteReport project *
* Copyright (C) 2012-2015 by Alexander Mikhalov *
* [email protected] *
* *
** GNU General Public License Usage **
* *
* This library is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
***************************************************************************/
#include "optionsdialogprinterpage.h"
#include "ui_optionsdialogprinterpage.h"
#include "printerinterface.h"
#include "reportcore.h"
#include "core.h"
#include "propertyeditor.h"
#include <QMenu>
OptionsDialogPrinterPage::OptionsDialogPrinterPage(CuteDesigner::Core *core) :
OptionsDialogPageInterface(core),
ui(new Ui::OptionsDialogPrinterPage)
, m_core(core)
{
ui->setupUi(this);
QMenu * menu = new QMenu(ui->bAdd);
foreach (CuteReport::ReportPluginInterface* module, m_core->reportCore()->modules(CuteReport::PrinterModule)) {
QAction * action = new QAction(module->moduleShortName(), menu);
action->setData(module->moduleFullName());
connect(action, SIGNAL(triggered()), this, SLOT(setNewObject()));
menu->addAction(action);
}
ui->bAdd->setMenu(menu);
updateObjectList();
connect(ui->bDelete, SIGNAL(clicked()), this, SLOT(deleteCurrent()));
connect(ui->bDefault, SIGNAL(clicked()), this, SLOT(setDefault()));
connect(ui->bResetDefault, SIGNAL(clicked()), this, SLOT(clearDefault()));
connect(ui->objectList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(listIndexChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
}
OptionsDialogPrinterPage::~OptionsDialogPrinterPage()
{
delete ui;
}
void OptionsDialogPrinterPage::activate()
{
}
void OptionsDialogPrinterPage::deactivate()
{
// if (m_currentModule) {
// m_core->settings()->setValue("CuteReport/PrimaryPrinter", m_currentModule->moduleFullName());
//// m_currentModule->helper()->save();
// m_core->settings()->setValue(QString("CuteReport/Printer_%1_options").arg(m_currentModule->moduleFullName()), m_core->reportCore()->moduleOptionsStr(m_currentModule)) ;
// }
}
QListWidgetItem * OptionsDialogPrinterPage::createButton(QListWidget * listWidget)
{
QListWidgetItem *configButton = new QListWidgetItem(listWidget);
configButton->setIcon(QIcon(":/images/printer_96x96.png"));
configButton->setText(tr("Printer"));
configButton->setTextAlignment(Qt::AlignHCenter);
configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
return configButton;
}
void OptionsDialogPrinterPage::listIndexChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous)
{
Q_UNUSED(previous)
if (!current) {
delete m_currentHelper;
return;
}
QString objectName = current->text(0);
CuteReport::PrinterInterface * object = m_core->reportCore()->printer(objectName);
if (!object)
return;
if (m_currentHelper) {
CuteReport::PrinterHelperInterface * helper = qobject_cast<CuteReport::PrinterHelperInterface*>(m_currentHelper.data());
if (helper)
helper->save();
}
delete m_currentHelper;
m_currentHelper = object->helper();
if (!m_currentHelper) {
PropertyEditor::EditorWidget * editor = m_core->createPropertyEditor(this);
editor->setObject(object);
m_currentHelper = editor;
}
if (m_currentHelper)
ui->helperLayout->addWidget(m_currentHelper);
ui->objectType->setText(object->moduleFullName());
}
void OptionsDialogPrinterPage::setNewObject()
{
QAction * action = qobject_cast<QAction*>(sender());
Q_ASSERT(action);
QString moduleName = action->data().toString();
CuteReport::PrinterInterface * object = m_core->reportCore()->createPrinterObject(moduleName);
if (!object)
return;
object->setObjectName(CuteReport::ReportCore::uniqueName(object, object->objectName(), m_core->reportCore()));
m_core->reportCore()->setPrinter(object);
updateObjectList();
}
void OptionsDialogPrinterPage::deleteCurrent()
{
if (!ui->objectList->currentItem())
return;
QString name = ui->objectList->currentItem()->text(0);
m_core->reportCore()->deletePrinter(name);
updateObjectList();
}
void OptionsDialogPrinterPage::setDefault()
{
if (!ui->objectList->currentItem())
return;
QString name = ui->objectList->currentItem()->text(0);
m_core->reportCore()->setDefaultPrinter(name);
ui->leDefault->setText(m_core->reportCore()->defaultPrinterName());
}
void OptionsDialogPrinterPage::clearDefault()
{
m_core->reportCore()->setDefaultPrinter(QString());
ui->leDefault->setText(m_core->reportCore()->defaultPrinterName());
}
void OptionsDialogPrinterPage::updateObjectList()
{
ui->objectList->clear();
QStringList nameList = m_core->reportCore()->printerNameList();
qSort(nameList);
foreach (const QString &name, nameList)
ui->objectList->addTopLevelItem(new QTreeWidgetItem ( ui->objectList, QStringList() << name));
ui->leDefault->setText(m_core->reportCore()->defaultPrinterName());
}
| {
"pile_set_name": "Github"
} |
/*
* handling of SHELL32.DLL OLE-Objects
*
* Copyright 1997 Marcus Meissner
* Copyright 1998 Juergen Schmied <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wine/config.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COBJMACROS
#define NONAMELESSUNION
#include <windef.h>
#include <winbase.h>
#include <shellapi.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <debughlp.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include "shell32_main.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
extern INT WINAPI SHStringFromGUIDW(REFGUID guid, LPWSTR lpszDest, INT cchMax); /* shlwapi.24 */
/**************************************************************************
* Default ClassFactory types
*/
typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown* pUnkOuter, REFIID riid, LPVOID* ppvObject);
#ifndef __REACTOS__
static IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, REFIID riidInst);
/* this table contains all CLSIDs of shell32 objects */
static const struct {
REFIID clsid;
LPFNCREATEINSTANCE lpfnCI;
} InterfaceTable[] = {
{&CLSID_ApplicationAssociationRegistration, ApplicationAssociationRegistration_Constructor},
{&CLSID_AutoComplete, IAutoComplete_Constructor},
{&CLSID_ControlPanel, IControlPanel_Constructor},
{&CLSID_DragDropHelper, IDropTargetHelper_Constructor},
{&CLSID_FolderShortcut, FolderShortcut_Constructor},
{&CLSID_MyComputer, ISF_MyComputer_Constructor},
{&CLSID_MyDocuments, MyDocuments_Constructor},
{&CLSID_NetworkPlaces, ISF_NetworkPlaces_Constructor},
{&CLSID_Printers, Printers_Constructor},
{&CLSID_QueryAssociations, QueryAssociations_Constructor},
{&CLSID_RecycleBin, RecycleBin_Constructor},
{&CLSID_ShellDesktop, ISF_Desktop_Constructor},
{&CLSID_ShellFSFolder, IFSFolder_Constructor},
{&CLSID_ShellItem, IShellItem_Constructor},
{&CLSID_ShellLink, IShellLink_Constructor},
{&CLSID_UnixDosFolder, UnixDosFolder_Constructor},
{&CLSID_UnixFolder, UnixFolder_Constructor},
{&CLSID_ExplorerBrowser,ExplorerBrowser_Constructor},
{&CLSID_KnownFolderManager, KnownFolderManager_Constructor},
{&CLSID_Shell, IShellDispatch_Constructor},
{NULL, NULL}
};
#endif /* !__REACTOS__ */
/*************************************************************************
* SHCoCreateInstance [SHELL32.102]
*
* Equivalent to CoCreateInstance. Under Windows 9x this function could sometimes
* use the shell32 built-in "mini-COM" without the need to load ole32.dll - see
* SHLoadOLE for details.
*
* Under wine if a "LoadWithoutCOM" value is present or the object resides in
* shell32.dll the function will load the object manually without the help of ole32
*
* NOTES
* exported by ordinal
*
* SEE ALSO
* CoCreateInstance, SHLoadOLE
*/
HRESULT WINAPI SHCoCreateInstance(
LPCWSTR aclsid,
const CLSID *clsid,
LPUNKNOWN pUnkOuter,
REFIID refiid,
LPVOID *ppv)
{
DWORD hres;
CLSID iid;
const CLSID * myclsid = clsid;
WCHAR sKeyName[MAX_PATH];
static const WCHAR sCLSID[] = {'C','L','S','I','D','\\','\0'};
WCHAR sClassID[60];
static const WCHAR sInProcServer32[] = {'\\','I','n','p','r','o','c','S','e','r','v','e','r','3','2','\0'};
static const WCHAR sLoadWithoutCOM[] = {'L','o','a','d','W','i','t','h','o','u','t','C','O','M','\0'};
WCHAR sDllPath[MAX_PATH];
HKEY hKey = 0;
DWORD dwSize;
IClassFactory * pcf = NULL;
if(!ppv) return E_POINTER;
*ppv=NULL;
/* if the clsid is a string, convert it */
if (!clsid)
{
if (!aclsid) return REGDB_E_CLASSNOTREG;
SHCLSIDFromStringW(aclsid, &iid);
myclsid = &iid;
}
TRACE("(%p,%s,unk:%p,%s,%p)\n",
aclsid,shdebugstr_guid(myclsid),pUnkOuter,shdebugstr_guid(refiid),ppv);
if (SUCCEEDED(DllGetClassObject(myclsid, &IID_IClassFactory,(LPVOID*)&pcf)))
{
hres = IClassFactory_CreateInstance(pcf, pUnkOuter, refiid, ppv);
IClassFactory_Release(pcf);
goto end;
}
/* we look up the dll path in the registry */
SHStringFromGUIDW(myclsid, sClassID, sizeof(sClassID)/sizeof(WCHAR));
lstrcpyW(sKeyName, sCLSID);
lstrcatW(sKeyName, sClassID);
lstrcatW(sKeyName, sInProcServer32);
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, sKeyName, 0, KEY_READ, &hKey))
return E_ACCESSDENIED;
/* if a special registry key is set, we load a shell extension without help of OLE32 */
if (!SHQueryValueExW(hKey, sLoadWithoutCOM, 0, 0, 0, 0))
{
/* load an external dll without ole32 */
HANDLE hLibrary;
typedef HRESULT (CALLBACK *DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv);
DllGetClassObjectFunc DllGetClassObject;
dwSize = sizeof(sDllPath);
SHQueryValueExW(hKey, NULL, 0,0, sDllPath, &dwSize );
if ((hLibrary = LoadLibraryExW(sDllPath, 0, LOAD_WITH_ALTERED_SEARCH_PATH)) == 0) {
ERR("couldn't load InprocServer32 dll %s\n", debugstr_w(sDllPath));
hres = E_ACCESSDENIED;
goto end;
} else if (!(DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject"))) {
ERR("couldn't find function DllGetClassObject in %s\n", debugstr_w(sDllPath));
FreeLibrary( hLibrary );
hres = E_ACCESSDENIED;
goto end;
} else if (FAILED(hres = DllGetClassObject(myclsid, &IID_IClassFactory, (LPVOID*)&pcf))) {
TRACE("GetClassObject failed 0x%08x\n", hres);
goto end;
}
hres = IClassFactory_CreateInstance(pcf, pUnkOuter, refiid, ppv);
IClassFactory_Release(pcf);
} else {
/* load an external dll in the usual way */
hres = CoCreateInstance(myclsid, pUnkOuter, CLSCTX_INPROC_SERVER, refiid, ppv);
}
end:
if (hKey) RegCloseKey(hKey);
if(hres!=S_OK)
{
ERR("failed (0x%08x) to create CLSID:%s IID:%s\n",
hres, shdebugstr_guid(myclsid), shdebugstr_guid(refiid));
ERR("class not found in registry\n");
}
TRACE("-- instance: %p\n",*ppv);
return hres;
}
#ifndef __REACTOS__
/*************************************************************************
* DllGetClassObject [SHELL32.@]
* SHDllGetClassObject [SHELL32.128]
*/
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
{
IClassFactory * pcf = NULL;
HRESULT hres;
int i;
TRACE("CLSID:%s,IID:%s\n",shdebugstr_guid(rclsid),shdebugstr_guid(iid));
if (!ppv) return E_INVALIDARG;
*ppv = NULL;
/* search our internal interface table */
for(i=0;InterfaceTable[i].clsid;i++) {
if(IsEqualIID(InterfaceTable[i].clsid, rclsid)) {
TRACE("index[%u]\n", i);
pcf = IDefClF_fnConstructor(InterfaceTable[i].lpfnCI, NULL, NULL);
break;
}
}
if (!pcf) {
FIXME("failed for CLSID=%s\n", shdebugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
}
hres = IClassFactory_QueryInterface(pcf, iid, ppv);
IClassFactory_Release(pcf);
TRACE("-- pointer to class factory: %p\n",*ppv);
return hres;
}
#endif
/*************************************************************************
* SHCLSIDFromString [SHELL32.147]
*
* Under Windows 9x this was an ANSI version of CLSIDFromString. It also allowed
* to avoid dependency on ole32.dll (see SHLoadOLE for details).
*
* Under Windows NT/2000/XP this is equivalent to CLSIDFromString
*
* NOTES
* exported by ordinal
*
* SEE ALSO
* CLSIDFromString, SHLoadOLE
*/
DWORD WINAPI SHCLSIDFromStringA (LPCSTR clsid, CLSID *id)
{
WCHAR buffer[40];
TRACE("(%p(%s) %p)\n", clsid, clsid, id);
if (!MultiByteToWideChar( CP_ACP, 0, clsid, -1, buffer, sizeof(buffer)/sizeof(WCHAR) ))
return CO_E_CLASSSTRING;
return CLSIDFromString( buffer, id );
}
DWORD WINAPI SHCLSIDFromStringW (LPCWSTR clsid, CLSID *id)
{
TRACE("(%p(%s) %p)\n", clsid, debugstr_w(clsid), id);
return CLSIDFromString(clsid, id);
}
DWORD WINAPI SHCLSIDFromStringAW (LPCVOID clsid, CLSID *id)
{
if (SHELL_OsIsUnicode())
return SHCLSIDFromStringW (clsid, id);
return SHCLSIDFromStringA (clsid, id);
}
/*************************************************************************
* SHGetMalloc [SHELL32.@]
*
* Equivalent to CoGetMalloc(MEMCTX_TASK, ...). Under Windows 9x this function
* could use the shell32 built-in "mini-COM" without the need to load ole32.dll -
* see SHLoadOLE for details.
*
* PARAMS
* lpmal [O] Destination for IMalloc interface.
*
* RETURNS
* Success: S_OK. lpmal contains the shells IMalloc interface.
* Failure. An HRESULT error code.
*
* SEE ALSO
* CoGetMalloc, SHLoadOLE
*/
HRESULT WINAPI SHGetMalloc(LPMALLOC *lpmal)
{
TRACE("(%p)\n", lpmal);
return CoGetMalloc(MEMCTX_TASK, lpmal);
}
/*************************************************************************
* SHAlloc [SHELL32.196]
*
* Equivalent to CoTaskMemAlloc. Under Windows 9x this function could use
* the shell32 built-in "mini-COM" without the need to load ole32.dll -
* see SHLoadOLE for details.
*
* NOTES
* exported by ordinal
*
* SEE ALSO
* CoTaskMemAlloc, SHLoadOLE
*/
LPVOID WINAPI SHAlloc(SIZE_T len)
{
LPVOID ret;
ret = CoTaskMemAlloc(len);
TRACE("%u bytes at %p\n",len, ret);
return ret;
}
/*************************************************************************
* SHFree [SHELL32.195]
*
* Equivalent to CoTaskMemFree. Under Windows 9x this function could use
* the shell32 built-in "mini-COM" without the need to load ole32.dll -
* see SHLoadOLE for details.
*
* NOTES
* exported by ordinal
*
* SEE ALSO
* CoTaskMemFree, SHLoadOLE
*/
void WINAPI SHFree(LPVOID pv)
{
TRACE("%p\n",pv);
CoTaskMemFree(pv);
}
#ifndef __REACTOS__
/*************************************************************************
* SHGetDesktopFolder [SHELL32.@]
*/
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
{
HRESULT hres;
TRACE("(%p)\n", psf);
if(!psf) return E_INVALIDARG;
*psf = NULL;
hres = ISF_Desktop_Constructor(NULL, &IID_IShellFolder, (LPVOID*)psf);
TRACE("-- %p->(%p) 0x%08x\n", psf, *psf, hres);
return hres;
}
#endif
/**************************************************************************
* Default ClassFactory Implementation
*
* SHCreateDefClassObject
*
* NOTES
* Helper function for dlls without their own classfactory.
* A generic classfactory is returned.
* When the CreateInstance of the cf is called the callback is executed.
*/
typedef struct
{
IClassFactory IClassFactory_iface;
LONG ref;
CLSID *rclsid;
LPFNCREATEINSTANCE lpfnCI;
const IID * riidInst;
LONG * pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */
} IDefClFImpl;
static inline IDefClFImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, IDefClFImpl, IClassFactory_iface);
}
#ifndef __REACTOS__
static const IClassFactoryVtbl dclfvt;
/**************************************************************************
* IDefClF_fnConstructor
*/
static IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, REFIID riidInst)
{
IDefClFImpl* lpclf;
lpclf = HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl));
lpclf->ref = 1;
lpclf->IClassFactory_iface.lpVtbl = &dclfvt;
lpclf->lpfnCI = lpfnCI;
lpclf->pcRefDll = pcRefDll;
if (pcRefDll) InterlockedIncrement(pcRefDll);
lpclf->riidInst = riidInst;
TRACE("(%p)%s\n",lpclf, shdebugstr_guid(riidInst));
return (LPCLASSFACTORY)lpclf;
}
/**************************************************************************
* IDefClF_fnQueryInterface
*/
static HRESULT WINAPI IDefClF_fnQueryInterface(
LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
{
IDefClFImpl *This = impl_from_IClassFactory(iface);
TRACE("(%p)->(%s)\n",This,shdebugstr_guid(riid));
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory)) {
*ppvObj = This;
InterlockedIncrement(&This->ref);
return S_OK;
}
TRACE("-- E_NOINTERFACE\n");
return E_NOINTERFACE;
}
/******************************************************************************
* IDefClF_fnAddRef
*/
static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface)
{
IDefClFImpl *This = impl_from_IClassFactory(iface);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%u)\n", This, refCount - 1);
return refCount;
}
/******************************************************************************
* IDefClF_fnRelease
*/
static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
{
IDefClFImpl *This = impl_from_IClassFactory(iface);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%u)\n", This, refCount + 1);
if (!refCount)
{
if (This->pcRefDll) InterlockedDecrement(This->pcRefDll);
TRACE("-- destroying IClassFactory(%p)\n",This);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return refCount;
}
/******************************************************************************
* IDefClF_fnCreateInstance
*/
static HRESULT WINAPI IDefClF_fnCreateInstance(
LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
{
IDefClFImpl *This = impl_from_IClassFactory(iface);
TRACE("%p->(%p,%s,%p)\n",This,pUnkOuter,shdebugstr_guid(riid),ppvObject);
*ppvObject = NULL;
if ( This->riidInst==NULL ||
IsEqualCLSID(riid, This->riidInst) ||
IsEqualCLSID(riid, &IID_IUnknown) )
{
return This->lpfnCI(pUnkOuter, riid, ppvObject);
}
ERR("unknown IID requested %s\n",shdebugstr_guid(riid));
return E_NOINTERFACE;
}
/******************************************************************************
* IDefClF_fnLockServer
*/
static HRESULT WINAPI IDefClF_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
{
IDefClFImpl *This = impl_from_IClassFactory(iface);
TRACE("%p->(0x%x), not implemented\n",This, fLock);
return E_NOTIMPL;
}
static const IClassFactoryVtbl dclfvt =
{
IDefClF_fnQueryInterface,
IDefClF_fnAddRef,
IDefClF_fnRelease,
IDefClF_fnCreateInstance,
IDefClF_fnLockServer
};
/******************************************************************************
* SHCreateDefClassObject [SHELL32.70]
*/
HRESULT WINAPI SHCreateDefClassObject(
REFIID riid,
LPVOID* ppv,
LPFNCREATEINSTANCE lpfnCI, /* [in] create instance callback entry */
LPDWORD pcRefDll, /* [in/out] ref count of the dll */
REFIID riidInst) /* [in] optional interface to the instance */
{
IClassFactory * pcf;
TRACE("%s %p %p %p %s\n",
shdebugstr_guid(riid), ppv, lpfnCI, pcRefDll, shdebugstr_guid(riidInst));
if (! IsEqualCLSID(riid, &IID_IClassFactory) ) return E_NOINTERFACE;
if (! (pcf = IDefClF_fnConstructor(lpfnCI, (PLONG)pcRefDll, riidInst))) return E_OUTOFMEMORY;
*ppv = pcf;
return S_OK;
}
#endif /* !__REACTOS__ */
/*************************************************************************
* DragAcceptFiles [SHELL32.@]
*/
void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
{
LONG exstyle;
if( !IsWindow(hWnd) ) return;
exstyle = GetWindowLongPtrA(hWnd,GWL_EXSTYLE);
if (b)
exstyle |= WS_EX_ACCEPTFILES;
else
exstyle &= ~WS_EX_ACCEPTFILES;
SetWindowLongPtrA(hWnd,GWL_EXSTYLE,exstyle);
}
/*************************************************************************
* DragFinish [SHELL32.@]
*/
void WINAPI DragFinish(HDROP h)
{
TRACE("\n");
GlobalFree(h);
}
/*************************************************************************
* DragQueryPoint [SHELL32.@]
*/
BOOL WINAPI DragQueryPoint(HDROP hDrop, POINT *p)
{
DROPFILES *lpDropFileStruct;
BOOL bRet;
TRACE("\n");
lpDropFileStruct = GlobalLock(hDrop);
*p = lpDropFileStruct->pt;
bRet = lpDropFileStruct->fNC;
GlobalUnlock(hDrop);
return bRet;
}
/*************************************************************************
* DragQueryFileA [SHELL32.@]
* DragQueryFile [SHELL32.@]
*/
UINT WINAPI DragQueryFileA(
HDROP hDrop,
UINT lFile,
LPSTR lpszFile,
UINT lLength)
{
LPSTR lpDrop;
UINT i = 0;
DROPFILES *lpDropFileStruct = GlobalLock(hDrop);
TRACE("(%p, %x, %p, %u)\n", hDrop,lFile,lpszFile,lLength);
if(!lpDropFileStruct) goto end;
lpDrop = (LPSTR) lpDropFileStruct + lpDropFileStruct->pFiles;
if(lpDropFileStruct->fWide) {
LPWSTR lpszFileW = NULL;
if(lpszFile && lFile != 0xFFFFFFFF) {
lpszFileW = HeapAlloc(GetProcessHeap(), 0, lLength*sizeof(WCHAR));
if(lpszFileW == NULL) {
goto end;
}
}
i = DragQueryFileW(hDrop, lFile, lpszFileW, lLength);
if(lpszFileW) {
WideCharToMultiByte(CP_ACP, 0, lpszFileW, -1, lpszFile, lLength, 0, NULL);
HeapFree(GetProcessHeap(), 0, lpszFileW);
}
goto end;
}
while (i++ < lFile)
{
while (*lpDrop++); /* skip filename */
if (!*lpDrop)
{
i = (lFile == 0xFFFFFFFF) ? i : 0;
goto end;
}
}
i = strlen(lpDrop);
if (!lpszFile ) goto end; /* needed buffer size */
lstrcpynA (lpszFile, lpDrop, lLength);
end:
GlobalUnlock(hDrop);
return i;
}
/*************************************************************************
* DragQueryFileW [SHELL32.@]
*/
UINT WINAPI DragQueryFileW(
HDROP hDrop,
UINT lFile,
LPWSTR lpszwFile,
UINT lLength)
{
LPWSTR lpwDrop;
UINT i = 0;
DROPFILES *lpDropFileStruct = GlobalLock(hDrop);
TRACE("(%p, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength);
if(!lpDropFileStruct) goto end;
lpwDrop = (LPWSTR) ((LPSTR)lpDropFileStruct + lpDropFileStruct->pFiles);
if(lpDropFileStruct->fWide == FALSE) {
LPSTR lpszFileA = NULL;
if(lpszwFile && lFile != 0xFFFFFFFF) {
lpszFileA = HeapAlloc(GetProcessHeap(), 0, lLength);
if(lpszFileA == NULL) {
goto end;
}
}
i = DragQueryFileA(hDrop, lFile, lpszFileA, lLength);
if(lpszFileA) {
MultiByteToWideChar(CP_ACP, 0, lpszFileA, -1, lpszwFile, lLength);
HeapFree(GetProcessHeap(), 0, lpszFileA);
}
goto end;
}
i = 0;
while (i++ < lFile)
{
while (*lpwDrop++); /* skip filename */
if (!*lpwDrop)
{
i = (lFile == 0xFFFFFFFF) ? i : 0;
goto end;
}
}
i = strlenW(lpwDrop);
if ( !lpszwFile) goto end; /* needed buffer size */
lstrcpynW (lpszwFile, lpwDrop, lLength);
end:
GlobalUnlock(hDrop);
return i;
}
/*************************************************************************
* SHPropStgCreate [SHELL32.685]
*/
HRESULT WINAPI SHPropStgCreate(IPropertySetStorage *psstg, REFFMTID fmtid,
const CLSID *pclsid, DWORD grfFlags, DWORD grfMode,
DWORD dwDisposition, IPropertyStorage **ppstg, UINT *puCodePage)
{
PROPSPEC prop;
PROPVARIANT ret;
HRESULT hres;
TRACE("%p %s %s %x %x %x %p %p\n", psstg, debugstr_guid(fmtid), debugstr_guid(pclsid),
grfFlags, grfMode, dwDisposition, ppstg, puCodePage);
hres = IPropertySetStorage_Open(psstg, fmtid, grfMode, ppstg);
switch(dwDisposition) {
case CREATE_ALWAYS:
if(SUCCEEDED(hres)) {
IPropertyStorage_Release(*ppstg);
hres = IPropertySetStorage_Delete(psstg, fmtid);
if(FAILED(hres))
return hres;
hres = E_FAIL;
}
case OPEN_ALWAYS:
case CREATE_NEW:
if(FAILED(hres))
hres = IPropertySetStorage_Create(psstg, fmtid, pclsid,
grfFlags, grfMode, ppstg);
case OPEN_EXISTING:
if(FAILED(hres))
return hres;
if(puCodePage) {
prop.ulKind = PRSPEC_PROPID;
prop.u.propid = PID_CODEPAGE;
hres = IPropertyStorage_ReadMultiple(*ppstg, 1, &prop, &ret);
if(FAILED(hres) || ret.vt!=VT_I2)
*puCodePage = 0;
else
*puCodePage = ret.u.iVal;
}
}
return S_OK;
}
/*************************************************************************
* SHPropStgReadMultiple [SHELL32.688]
*/
HRESULT WINAPI SHPropStgReadMultiple(IPropertyStorage *pps, UINT uCodePage,
ULONG cpspec, const PROPSPEC *rgpspec, PROPVARIANT *rgvar)
{
STATPROPSETSTG stat;
HRESULT hres;
FIXME("%p %u %u %p %p\n", pps, uCodePage, cpspec, rgpspec, rgvar);
memset(rgvar, 0, cpspec*sizeof(PROPVARIANT));
hres = IPropertyStorage_ReadMultiple(pps, cpspec, rgpspec, rgvar);
if(FAILED(hres))
return hres;
if(!uCodePage) {
PROPSPEC prop;
PROPVARIANT ret;
prop.ulKind = PRSPEC_PROPID;
prop.u.propid = PID_CODEPAGE;
hres = IPropertyStorage_ReadMultiple(pps, 1, &prop, &ret);
if(FAILED(hres) || ret.vt!=VT_I2)
return S_OK;
uCodePage = ret.u.iVal;
}
hres = IPropertyStorage_Stat(pps, &stat);
if(FAILED(hres))
return S_OK;
/* TODO: do something with codepage and stat */
return S_OK;
}
/*************************************************************************
* SHPropStgWriteMultiple [SHELL32.689]
*/
HRESULT WINAPI SHPropStgWriteMultiple(IPropertyStorage *pps, UINT *uCodePage,
ULONG cpspec, const PROPSPEC *rgpspec, PROPVARIANT *rgvar, PROPID propidNameFirst)
{
STATPROPSETSTG stat;
UINT codepage;
HRESULT hres;
FIXME("%p %p %u %p %p %d\n", pps, uCodePage, cpspec, rgpspec, rgvar, propidNameFirst);
hres = IPropertyStorage_Stat(pps, &stat);
if(FAILED(hres))
return hres;
if(uCodePage && *uCodePage)
codepage = *uCodePage;
else {
PROPSPEC prop;
PROPVARIANT ret;
prop.ulKind = PRSPEC_PROPID;
prop.u.propid = PID_CODEPAGE;
hres = IPropertyStorage_ReadMultiple(pps, 1, &prop, &ret);
if(FAILED(hres))
return hres;
if(ret.vt!=VT_I2 || !ret.u.iVal)
return E_FAIL;
codepage = ret.u.iVal;
if(uCodePage)
*uCodePage = codepage;
}
/* TODO: do something with codepage and stat */
hres = IPropertyStorage_WriteMultiple(pps, cpspec, rgpspec, rgvar, propidNameFirst);
return hres;
}
/*************************************************************************
* SHCreateQueryCancelAutoPlayMoniker [SHELL32.@]
*/
HRESULT WINAPI SHCreateQueryCancelAutoPlayMoniker(IMoniker **moniker)
{
TRACE("%p\n", moniker);
if (!moniker) return E_INVALIDARG;
return CreateClassMoniker(&CLSID_QueryCancelAutoPlay, moniker);
}
| {
"pile_set_name": "Github"
} |
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
class Google_Service_CloudTrace_StackFrame extends Google_Model
{
public $columnNumber;
protected $fileNameType = 'Google_Service_CloudTrace_TruncatableString';
protected $fileNameDataType = '';
protected $functionNameType = 'Google_Service_CloudTrace_TruncatableString';
protected $functionNameDataType = '';
public $lineNumber;
protected $loadModuleType = 'Google_Service_CloudTrace_Module';
protected $loadModuleDataType = '';
protected $originalFunctionNameType = 'Google_Service_CloudTrace_TruncatableString';
protected $originalFunctionNameDataType = '';
protected $sourceVersionType = 'Google_Service_CloudTrace_TruncatableString';
protected $sourceVersionDataType = '';
public function setColumnNumber($columnNumber)
{
$this->columnNumber = $columnNumber;
}
public function getColumnNumber()
{
return $this->columnNumber;
}
/**
* @param Google_Service_CloudTrace_TruncatableString
*/
public function setFileName(Google_Service_CloudTrace_TruncatableString $fileName)
{
$this->fileName = $fileName;
}
/**
* @return Google_Service_CloudTrace_TruncatableString
*/
public function getFileName()
{
return $this->fileName;
}
/**
* @param Google_Service_CloudTrace_TruncatableString
*/
public function setFunctionName(Google_Service_CloudTrace_TruncatableString $functionName)
{
$this->functionName = $functionName;
}
/**
* @return Google_Service_CloudTrace_TruncatableString
*/
public function getFunctionName()
{
return $this->functionName;
}
public function setLineNumber($lineNumber)
{
$this->lineNumber = $lineNumber;
}
public function getLineNumber()
{
return $this->lineNumber;
}
/**
* @param Google_Service_CloudTrace_Module
*/
public function setLoadModule(Google_Service_CloudTrace_Module $loadModule)
{
$this->loadModule = $loadModule;
}
/**
* @return Google_Service_CloudTrace_Module
*/
public function getLoadModule()
{
return $this->loadModule;
}
/**
* @param Google_Service_CloudTrace_TruncatableString
*/
public function setOriginalFunctionName(Google_Service_CloudTrace_TruncatableString $originalFunctionName)
{
$this->originalFunctionName = $originalFunctionName;
}
/**
* @return Google_Service_CloudTrace_TruncatableString
*/
public function getOriginalFunctionName()
{
return $this->originalFunctionName;
}
/**
* @param Google_Service_CloudTrace_TruncatableString
*/
public function setSourceVersion(Google_Service_CloudTrace_TruncatableString $sourceVersion)
{
$this->sourceVersion = $sourceVersion;
}
/**
* @return Google_Service_CloudTrace_TruncatableString
*/
public function getSourceVersion()
{
return $this->sourceVersion;
}
}
| {
"pile_set_name": "Github"
} |
package test
public object Usage {
public fun f() {
ClassA().meth1()
}
}
| {
"pile_set_name": "Github"
} |
{ ***************************************************************************
Copyright (c) 2016-2020 Kike Pérez
Unit : Quick.Logger
Description : Threadsafe Multi Log File, Console, Email, etc...
Author : Kike Pérez
Version : 1.42
Created : 12/10/2017
Modified : 25/04/2020
This file is part of QuickLogger: https://github.com/exilon/QuickLogger
Needed libraries:
QuickLib (https://github.com/exilon/QuickLib)
***************************************************************************
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.
*************************************************************************** }
unit Quick.Logger;
{$i QuickLib.inc}
{.$DEFINE LOGGER_DEBUG}
{.$DEFINE LOGGER_DEBUG2}
interface
uses
{$IFDEF MSWINDOWS}
Windows,
{$IFDEF DELPHIXE7_UP}
{$ELSE}
SyncObjs,
{$ENDIF}
{$ENDIF}
Quick.Logger.Intf,
Quick.JSON.Utils,
Quick.Json.Serializer,
Classes,
Types,
SysUtils,
DateUtils,
{$IFDEF FPC}
fpjson,
fpjsonrtti,
{$IFDEF LINUX}
SyncObjs,
{$ENDIF}
Quick.Files,
Generics.Collections,
{$ELSE}
System.IOUtils,
System.Generics.Collections,
{$IFDEF DELPHIXE8_UP}
System.JSON,
{$ELSE}
Data.DBXJSON,
{$ENDIF}
{$ENDIF}
Quick.Threads,
Quick.Commons,
Quick.SysInfo;
const
QLVERSION = '1.42';
type
TEventType = (etHeader, etInfo, etSuccess, etWarning, etError, etCritical, etException, etDebug, etTrace, etDone, etCustom1, etCustom2);
TLogLevel = set of TEventType;
{$IFDEF DELPHIXE7_UP}
TEventTypeNames = array of string;
{$ELSE}
TEventTypeNames = array[0..11] of string;
{$ENDIF}
ELogger = class(Exception);
ELoggerInitializationError = class(Exception);
ELoggerLoadProviderError = class(Exception);
ELoggerSaveProviderError = class(Exception);
const
LOG_ONLYERRORS = [etHeader,etInfo,etError,etCritical,etException];
LOG_ERRORSANDWARNINGS = [etHeader,etInfo,etWarning,etError,etCritical,etException];
LOG_BASIC = [etInfo,etSuccess,etWarning,etError,etCritical,etException];
LOG_ALL = [etHeader,etInfo,etSuccess,etDone,etWarning,etError,etCritical,etException,etCustom1,etCustom2];
LOG_TRACE = [etHeader,etInfo,etSuccess,etDone,etWarning,etError,etCritical,etException,etTrace];
LOG_DEBUG = [etHeader,etInfo,etSuccess,etDone,etWarning,etError,etCritical,etException,etTrace,etDebug];
LOG_VERBOSE : TLogLevel = [Low(TEventType)..high(TEventType)];
{$IFDEF DELPHIXE7_UP}
DEF_EVENTTYPENAMES : TEventTypeNames = ['','INFO','SUCC','WARN','ERROR','CRITICAL','EXCEPT','DEBUG','TRACE','DONE','CUST1','CUST2'];
{$ELSE}
DEF_EVENTTYPENAMES : TEventTypeNames = ('','INFO','SUCC','WARN','ERROR','CRITICAL','EXCEPT','DEBUG','TRACE','DONE','CUST1','CUST2');
{$ENDIF}
HTMBR = '<BR>';
DEF_QUEUE_SIZE = 10;
DEF_QUEUE_PUSH_TIMEOUT = 1500;
DEF_QUEUE_POP_TIMEOUT = 200;
DEF_WAIT_FLUSH_LOG = 30;
DEF_USER_AGENT = 'Quick.Logger Agent';
type
TLogProviderStatus = (psNone, psStopped, psInitializing, psRunning, psDraining, psStopping, psRestarting);
{$IFNDEF FPC}
{$IF Defined(NEXTGEN) OR Defined(OSX) OR Defined(LINUX)}
TSystemTime = TDateTime;
{$ENDIF}
{$ENDIF}
TLogInfoField = (iiAppName, iiHost, iiUserName, iiEnvironment, iiPlatform, iiOSVersion, iiExceptionInfo, iiExceptionStackTrace, iiThreadId, iiProcessId);
TIncludedLogInfo = set of TLogInfoField;
TProviderErrorEvent = procedure(const aProviderName, aError : string) of object;
TLogItem = class
private
fEventType : TEventType;
fMsg : string;
fEventDate : TDateTime;
fThreadId : DWORD;
public
constructor Create;
property EventType : TEventType read fEventType write fEventType;
property Msg : string read fMsg write fMsg;
property EventDate : TDateTime read fEventDate write fEventDate;
property ThreadId : DWORD read fThreadId write fThreadId;
function EventTypeName : string;
function Clone : TLogItem; virtual;
end;
TLogExceptionItem = class(TLogItem)
private
fException : string;
fStackTrace : string;
public
property Exception : string read fException write fException;
property StackTrace : string read fStackTrace write fStackTrace;
function Clone : TLogItem; override;
end;
TLogQueue = class(TThreadedQueueList<TLogItem>);
ILogTags = interface
['{046ED03D-9EE0-49BC-BBD7-FA108EA1E0AA}']
function GetTag(const aKey : string) : string;
procedure SetTag(const aKey : string; const aValue : string);
function TryGetValue(const aKey : string; out oValue : string) : Boolean;
procedure Add(const aKey, aValue : string);
property Items[const Key: string]: string read GetTag write SetTag; default;
end;
ILogProvider = interface
['{0E50EA1E-6B69-483F-986D-5128DA917ED8}']
procedure Init;
procedure Restart;
//procedure Flush;
procedure Stop;
procedure Drain;
procedure EnQueueItem(cLogItem : TLogItem);
procedure WriteLog(cLogItem : TLogItem);
function IsQueueable : Boolean;
procedure IncAndCheckErrors;
function Status : TLogProviderStatus;
procedure SetStatus(cStatus : TLogProviderStatus);
procedure SetLogTags(cLogTags : ILogTags);
function IsSendLimitReached(cEventType : TEventType): Boolean;
function GetLogLevel : TLogLevel;
function IsEnabled : Boolean;
function GetVersion : string;
function GetName : string;
function GetQueuedLogItems : Integer;
{$IF DEFINED(DELPHIXE7_UP) AND NOT DEFINED(NEXTGEN)}
function ToJson(aIndent : Boolean = True) : string;
procedure FromJson(const aJson : string);
procedure SaveToFile(const aJsonFile : string);
procedure LoadFromFile(const aJsonFile : string);
{$ENDIF}
end;
IRotable = interface
['{EF5E004F-C7BE-4431-8065-6081FEB3FC65}']
procedure RotateLog;
end;
TThreadLog = class(TThread)
private
fLogQueue : TLogQueue;
fProvider : ILogProvider;
public
constructor Create;
destructor Destroy; override;
property LogQueue : TLogQueue read fLogQueue write fLogQueue;
property Provider : ILogProvider read fProvider write fProvider;
procedure Execute; override;
end;
TSendLimitTimeRange = (slNoLimit, slByDay, slByHour, slByMinute, slBySecond);
TLogSendLimit = class
private
fCurrentNumSent : Integer;
fFirstSent : TDateTime;
fLastSent : TDateTime;
fTimeRange : TSendLimitTimeRange;
fLimitEventTypes : TLogLevel;
fNumBlocked : Int64;
fMaxSent: Integer;
public
constructor Create;
property TimeRange : TSendLimitTimeRange read fTimeRange write fTimeRange;
property LimitEventTypes : TLogLevel read fLimitEventTypes write fLimitEventTypes;
property MaxSent : Integer read fMaxSent write fMaxSent;
function IsLimitReached(cEventType : TEventType): Boolean;
end;
{$IFDEF FPC}
TQueueErrorEvent = procedure(const msg : string) of object;
TFailToLogEvent = procedure(const aProviderName : string) of object;
TStartEvent = procedure(const aProviderName : string) of object;
TRestartEvent = procedure(const aProviderName : string) of object;
TCriticalErrorEvent = procedure(const aProviderName, ErrorMessage : string) of object;
TSendLimitsEvent = procedure(const aProviderName : string) of object;
TStatusChangedEvent = procedure(aProviderName : string; status : TLogProviderStatus) of object;
{$ELSE}
TQueueErrorEvent = reference to procedure(const msg : string);
TFailToLogEvent = reference to procedure(const aProviderName : string);
TStartEvent = reference to procedure(const aProviderName : string);
TRestartEvent = reference to procedure(const aProviderName : string);
TCriticalErrorEvent = reference to procedure(const aProviderName, ErrorMessage : string);
TSendLimitsEvent = reference to procedure(const aProviderName : string);
TStatusChangedEvent = reference to procedure(aProviderName : string; status : TLogProviderStatus);
{$ENDIF}
TJsonOutputOptions = class
private
fUseUTCTime : Boolean;
fTimeStampName : string;
public
property UseUTCTime : Boolean read fUseUTCTime write fUseUTCTime;
property TimeStampName : string read fTimeStampName write fTimeStampName;
end;
TLogTags = class(TInterfacedObject,ILogTags)
private
fTags : TDictionary<string,string>;
function GetTag(const aKey : string) : string;
procedure SetTag(const aKey : string; const aValue : string);
public
constructor Create;
destructor Destroy; override;
property Items[const Key: string]: string read GetTag write SetTag; default;
function TryGetValue(const aKey : string; out oValue : string) : Boolean;
procedure Add(const aKey, aValue : string);
end;
TLogProviderBase = class(TInterfacedObject,ILogProvider)
protected
fThreadLog : TThreadLog;
private
fName : string;
fLogQueue : TLogQueue;
fLogLevel : TLogLevel;
fFormatSettings : TFormatSettings;
fEnabled : Boolean;
fTimePrecission : Boolean;
fFails : Integer;
fRestartTimes : Integer;
fFailsToRestart : Integer;
fMaxFailsToRestart : Integer;
fMaxFailsToStop : Integer;
fUsesQueue : Boolean;
fStatus : TLogProviderStatus;
fAppName : string;
fEnvironment : string;
fPlatformInfo : string;
fEventTypeNames : TEventTypeNames;
fSendLimits : TLogSendLimit;
fOnFailToLog: TFailToLogEvent;
fOnRestart: TRestartEvent;
fOnCriticalError : TCriticalErrorEvent;
fOnStatusChanged : TStatusChangedEvent;
fOnQueueError: TQueueErrorEvent;
fOnSendLimits: TSendLimitsEvent;
fIncludedInfo : TIncludedLogInfo;
fIncludedTags : TArray<string>;
fSystemInfo : TSystemInfo;
fCustomMsgOutput : Boolean;
fOnNotifyError : TProviderErrorEvent;
procedure SetTimePrecission(Value : Boolean);
procedure SetEnabled(aValue : Boolean);
function GetQueuedLogItems : Integer;
procedure EnQueueItem(cLogItem : TLogItem);
function GetEventTypeName(cEventType : TEventType) : string;
procedure SetEventTypeName(cEventType: TEventType; const cValue : string);
function IsSendLimitReached(cEventType : TEventType): Boolean;
procedure SetMaxFailsToRestart(const Value: Integer);
protected
fJsonOutputOptions : TJsonOutputOptions;
fCustomTags : ILogTags;
fCustomFormatOutput : string;
function LogItemToLine(cLogItem : TLogItem; aShowTimeStamp, aShowEventTypes : Boolean) : string; overload;
function LogItemToJsonObject(cLogItem: TLogItem): TJSONObject; overload;
function LogItemToJson(cLogItem : TLogItem) : string; overload;
function LogItemToHtml(cLogItem: TLogItem): string;
function LogItemToText(cLogItem: TLogItem): string;
function LogItemToFormat(cLogItem : TLogItem) : string;
{$IFDEF DELPHIXE8_UP}
function LogItemToFormat2(cLogItem : TLogItem) : string;
{$ENDIF}
function ResolveFormatVariable(const cToken : string; cLogItem: TLogItem) : string;
procedure IncAndCheckErrors;
procedure SetStatus(cStatus : TLogProviderStatus);
procedure SetLogTags(cLogTags : ILogTags);
function GetLogLevel : TLogLevel;
property SystemInfo : TSystemInfo read fSystemInfo;
procedure NotifyError(const aError : string);
public
constructor Create; virtual;
destructor Destroy; override;
procedure Init; virtual;
procedure Restart; virtual; abstract;
procedure Stop; virtual;
procedure Drain;
procedure WriteLog(cLogItem : TLogItem); virtual; abstract;
function IsQueueable : Boolean;
property Name : string read fName write fName;
property LogLevel : TLogLevel read fLogLevel write fLogLevel;
{$IFDEF DELPHIXE7_UP}[TNotSerializableProperty]{$ENDIF}
property FormatSettings : TFormatSettings read fFormatSettings write fFormatSettings;
property TimePrecission : Boolean read fTimePrecission write SetTimePrecission;
{$IFDEF DELPHIXE7_UP}[TNotSerializableProperty]{$ENDIF}
property Fails : Integer read fFails write fFails;
property MaxFailsToRestart : Integer read fMaxFailsToRestart write SetMaxFailsToRestart;
property MaxFailsToStop : Integer read fMaxFailsToStop write fMaxFailsToStop;
property CustomMsgOutput : Boolean read fCustomMsgOutput write fCustomMsgOutput;
property CustomFormatOutput : string read fCustomFormatOutput write fCustomFormatOutput;
property OnFailToLog : TFailToLogEvent read fOnFailToLog write fOnFailToLog;
property OnRestart : TRestartEvent read fOnRestart write fOnRestart;
property OnQueueError : TQueueErrorEvent read fOnQueueError write fOnQueueError;
property OnCriticalError : TCriticalErrorEvent read fOnCriticalError write fOnCriticalError;
property OnStatusChanged : TStatusChangedEvent read fOnStatusChanged write fOnStatusChanged;
property OnSendLimits : TSendLimitsEvent read fOnSendLimits write fOnSendLimits;
{$IFDEF DELPHIXE7_UP}[TNotSerializableProperty]{$ENDIF}
property QueueCount : Integer read GetQueuedLogItems;
property UsesQueue : Boolean read fUsesQueue write fUsesQueue;
property Enabled : Boolean read fEnabled write SetEnabled;
property EventTypeName[cEventType : TEventType] : string read GetEventTypeName write SetEventTypeName;
property SendLimits : TLogSendLimit read fSendLimits write fSendLimits;
property AppName : string read fAppName write fAppName;
property Environment : string read fEnvironment write fEnvironment;
property PlatformInfo : string read fPlatformInfo write fPlatformInfo;
property IncludedInfo : TIncludedLogInfo read fIncludedInfo write fIncludedInfo;
property IncludedTags : TArray<string> read fIncludedTags write fIncludedTags;
function Status : TLogProviderStatus;
function StatusAsString : string; overload;
class function StatusAsString(cStatus : TLogProviderStatus) : string; overload;
function GetVersion : string;
function IsEnabled : Boolean;
function GetName : string;
{$IF DEFINED(DELPHIXE7_UP) AND NOT DEFINED(NEXTGEN)}
function ToJson(aIndent : Boolean = True) : string;
procedure FromJson(const aJson : string);
procedure SaveToFile(const aJsonFile : string);
procedure LoadFromFile(const aJsonFile : string);
{$ENDIF}
end;
{$IF DEFINED(DELPHIXE7_UP) AND NOT DEFINED(NEXTGEN)}
TLogProviderList = class(TList<ILogProvider>)
public
function ToJson(aIndent : Boolean = True) : string;
procedure FromJson(const aJson : string);
procedure LoadFromFile(const aJsonFile : string);
procedure SaveToFile(const aJsonFile : string);
end;
{$ELSE}
TLogProviderList = TList<ILogProvider>;
{$ENDIF}
TThreadProviderLog = class(TThread)
private
fLogQueue : TLogQueue;
fProviders : TLogProviderList;
public
constructor Create;
destructor Destroy; override;
property LogQueue : TLogQueue read fLogQueue write fLogQueue;
property Providers : TLogProviderList read fProviders write fProviders;
procedure Execute; override;
end;
TLogger = class(TInterfacedObject,ILogger)
private
fThreadProviderLog : TThreadProviderLog;
fLogQueue : TLogQueue;
fProviders : TLogProviderList;
fCustomTags : ILogTags;
fWaitForFlushBeforeExit : Integer;
fOnQueueError: TQueueErrorEvent;
fOwnErrorsProvider : TLogProviderBase;
fOnProviderError : TProviderErrorEvent;
function GetQueuedLogItems : Integer;
procedure EnQueueItem(cEventDate : TSystemTime; const cMsg : string; cEventType : TEventType); overload;
procedure EnQueueItem(cEventDate : TSystemTime; const cMsg : string; const cException, cStackTrace : string; cEventType : TEventType); overload;
procedure EnQueueItem(cLogItem : TLogItem); overload;
procedure OnGetHandledException(E : Exception);
procedure OnGetRuntimeError(const ErrorName : string; ErrorCode : Byte; ErrorPtr : Pointer);
procedure OnGetUnhandledException(ExceptObject: TObject; ExceptAddr: Pointer);
procedure NotifyProviderError(const aProviderName, aError : string);
procedure SetOwnErrorsProvider(const Value: TLogProviderBase);
{$IFNDEF FPC}
procedure OnProviderListNotify(Sender: TObject; const Item: ILogProvider; Action: TCollectionNotification);
{$ELSE}
procedure OnProviderListNotify(ASender: TObject; constref AItem: ILogProvider; AAction: TCollectionNotification);
{$ENDIF}
public
constructor Create;
destructor Destroy; override;
property Providers : TLogProviderList read fProviders write fProviders;
property RedirectOwnErrorsToProvider : TLogProviderBase read fOwnErrorsProvider write SetOwnErrorsProvider;
property WaitForFlushBeforeExit : Integer read fWaitForFlushBeforeExit write fWaitForFlushBeforeExit;
property OnProviderError : TProviderErrorEvent read fOnProviderError write fOnProviderError;
property QueueCount : Integer read GetQueuedLogItems;
property OnQueueError : TQueueErrorEvent read fOnQueueError write fOnQueueError;
property CustomTags : ILogTags read fCustomTags;
function ProvidersQueueCount : Integer;
function IsQueueEmpty : Boolean;
class function GetVersion : string;
procedure Add(const cMsg : string; cEventType : TEventType); overload;
procedure Add(const cMsg, cException, cStackTrace : string; cEventType : TEventType); overload;
procedure Add(const cMsg : string; cValues : array of {$IFDEF FPC}const{$ELSE}TVarRec{$ENDIF}; cEventType : TEventType); overload;
//simplify logging add
procedure Info(const cMsg : string); overload;
procedure Info(const cMsg : string; cValues : array of const); overload;
procedure Warn(const cMsg : string); overload;
procedure Warn(const cMsg : string; cValues : array of const); overload;
procedure Error(const cMsg : string); overload;
procedure Error(const cMsg : string; cValues : array of const); overload;
procedure Critical(const cMsg : string); overload;
procedure Critical(const cMsg : string; cValues : array of const); overload;
procedure Succ(const cMsg : string); overload;
procedure Succ(const cMsg : string; cValues : array of const); overload;
procedure Done(const cMsg : string); overload;
procedure Done(const cMsg : string; cValues : array of const); overload;
procedure Debug(const cMsg : string); overload;
procedure Debug(const cMsg : string; cValues : array of const); overload;
procedure Trace(const cMsg : string); overload;
procedure Trace(const cMsg : string; cValues : array of const); overload;
procedure &Except(const cMsg : string); overload;
procedure &Except(const cMsg : string; cValues : array of const); overload;
procedure &Except(const cMsg, cException, cStackTrace : string); overload;
procedure &Except(const cMsg : string; cValues: array of const; const cException, cStackTrace: string); overload;
end;
procedure Log(const cMsg : string; cEventType : TEventType); overload;
procedure Log(const cMsg : string; cValues : array of {$IFDEF FPC}const{$ELSE}TVarRec{$ENDIF}; cEventType : TEventType); overload;
var
Logger : TLogger;
GlobalLoggerHandledException : procedure(E : Exception) of object;
GlobalLoggerRuntimeError : procedure(const ErrorName : string; ErrorCode : Byte; ErrorPtr : Pointer) of object;
GlobalLoggerUnhandledException : procedure(ExceptObject: TObject; ExceptAddr: Pointer) of object;
implementation
{$IFNDEF MSWINDOWS}
procedure GetLocalTime(var vlocaltime : TDateTime);
begin
vlocaltime := Now();
end;
{$ENDIF}
procedure Log(const cMsg : string; cEventType : TEventType); overload;
begin
Logger.Add(cMsg,cEventType);
end;
procedure Log(const cMsg : string; cValues : array of {$IFDEF FPC}const{$ELSE}TVarRec{$ENDIF}; cEventType : TEventType); overload;
begin
Logger.Add(cMsg,cValues,cEventType);
end;
{ TLoggerProviderBase }
constructor TLogProviderBase.Create;
begin
fName := Self.ClassName;
fFormatSettings.DateSeparator := '/';
fFormatSettings.TimeSeparator := ':';
fFormatSettings.ShortDateFormat := 'DD-MM-YYY HH:NN:SS';
fFormatSettings.ShortTimeFormat := 'HH:NN:SS';
fStatus := psNone;
fTimePrecission := False;
fSendLimits := TLogSendLimit.Create;
{$IFDEF DELPHIXE7_UP}
fIncludedTags := [];
{$ELSE}
fIncludedTags := nil;
{$ENDIF}
fFails := 0;
fRestartTimes := 0;
fMaxFailsToRestart := 2;
fMaxFailsToStop := 0;
fFailsToRestart := fMaxFailsToRestart - 1;
fEnabled := False;
fUsesQueue := True;
fEventTypeNames := DEF_EVENTTYPENAMES;
fLogQueue := TLogQueue.Create(DEF_QUEUE_SIZE,DEF_QUEUE_PUSH_TIMEOUT,DEF_QUEUE_POP_TIMEOUT);
fEnvironment := '';
fPlatformInfo := '';
fIncludedInfo := [iiAppName,iiHost];
fSystemInfo := Quick.SysInfo.SystemInfo;
fJsonOutputOptions := TJsonOutputOptions.Create;
fJsonOutputOptions.UseUTCTime := False;
fJsonOutputOptions.TimeStampName := 'timestamp';
fAppName := fSystemInfo.AppName;
end;
destructor TLogProviderBase.Destroy;
begin
{$IFDEF LOGGER_DEBUG}
Writeln(Format('destroy object: %s',[Self.ClassName]));
{$ENDIF}
if Assigned(fLogQueue) then fLogQueue.Free;
if Assigned(fSendLimits) then fSendLimits.Free;
if Assigned(fJsonOutputOptions) then fJsonOutputOptions.Free;
inherited;
end;
procedure TLogProviderBase.Drain;
begin
//no receive more logs
SetStatus(TLogProviderStatus.psDraining);
fEnabled := False;
while fLogQueue.QueueSize > 0 do
begin
fLogQueue.PopItem.Free;
Sleep(0);
end;
SetStatus(TLogProviderStatus.psStopped);
//NotifyError(Format('Provider stopped!',[fMaxFailsToStop]));
end;
procedure TLogProviderBase.IncAndCheckErrors;
begin
Inc(fFails);
if Assigned(fOnFailToLog) then fOnFailToLog(fName);
if (fMaxFailsToStop > 0) and (fFails > fMaxFailsToStop) then
begin
//flush queue and stop provider from receiving new items
{$IFDEF LOGGER_DEBUG}
Writeln(Format('drain: %s (%d)',[Self.ClassName,fFails]));
{$ENDIF}
Drain;
NotifyError(Format('Max fails (%d) to Stop reached! It will be Drained & Stopped now!',[fMaxFailsToStop]));
if Assigned(fOnCriticalError) then fOnCriticalError(fName,'Max fails to Stop reached!');
end
else if fFailsToRestart = 0 then
begin
//try to restart provider
{$IFDEF LOGGER_DEBUG}
Writeln(Format('restart: %s (%d)',[Self.ClassName,fFails]));
{$ENDIF}
NotifyError(Format('Max fails (%d) to Restart reached! Restarting...',[fMaxFailsToRestart]));
SetStatus(TLogProviderStatus.psRestarting);
try
Restart;
except
on E : Exception do
begin
NotifyError(Format('Failed to restart: %s',[e.Message]));
//set as running to try again
SetStatus(TLogProviderStatus.psRunning);
Exit;
end;
end;
Inc(fRestartTimes);
NotifyError(Format('Provider Restarted. This occurs for %d time(s)',[fRestartTimes]));
fFailsToRestart := fMaxFailsToRestart-1;
if Assigned(fOnRestart) then fOnRestart(fName);
end
else
begin
Dec(fFailsToRestart);
NotifyError(Format('Failed %d time(s). Fails to restart %d/%d',[fFails,fFailsToRestart,fMaxFailsToRestart]));
end;
end;
function TLogProviderBase.Status : TLogProviderStatus;
begin
Result := fStatus;
end;
function TLogProviderBase.StatusAsString : string;
begin
Result := StatusAsString(fStatus);
end;
class function TLogProviderBase.StatusAsString(cStatus : TLogProviderStatus) : string;
const
{$IFDEF DELPHIXE7_UP}
LogProviderStatusStr : array of string = ['Nothing','Stopped','Initializing','Running','Draining','Stopping','Restarting'];
{$ELSE}
LogProviderStatusStr : array[0..6] of string = ('Nothing','Stopped','Initializing','Running','Draining','Stopping','Restarting');
{$ENDIF}
begin
Result := LogProviderStatusStr[Integer(cStatus)];
end;
procedure TLogProviderBase.Init;
begin
if not(fStatus in [psNone,psStopped,psRestarting]) then Exit;
{$IFDEF LOGGER_DEBUG}
Writeln(Format('init thread: %s',[Self.ClassName]));
{$ENDIF}
SetStatus(TLogProviderStatus.psInitializing);
if fUsesQueue then
begin
if not Assigned(fThreadLog) then
begin
fThreadLog := TThreadLog.Create;
fThreadLog.LogQueue := fLogQueue;
fThreadLog.Provider := Self;
fThreadLog.Start;
end;
end;
SetStatus(TLogProviderStatus.psRunning);
fEnabled := True;
end;
function TLogProviderBase.IsQueueable: Boolean;
begin
Result := (fUsesQueue) and (Assigned(fThreadLog));
end;
function TLogProviderBase.IsSendLimitReached(cEventType : TEventType): Boolean;
begin
Result := fSendLimits.IsLimitReached(cEventType);
if Result and Assigned(fOnSendLimits) then fOnSendLimits(fName);
end;
function TLogProviderBase.LogItemToJsonObject(cLogItem: TLogItem): TJSONObject;
var
tagName : string;
tagValue : string;
begin
Result := TJSONObject.Create;
if fJsonOutputOptions.UseUTCTime then Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}(fJsonOutputOptions.TimeStampName,DateTimeToJsonDate(LocalTimeToUTC(cLogItem.EventDate)))
else Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}(fJsonOutputOptions.TimeStampName,DateTimeToJsonDate(cLogItem.EventDate));
Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('type',EventTypeName[cLogItem.EventType]);
if iiHost in fIncludedInfo then Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('host',SystemInfo.HostName);
if iiAppName in fIncludedInfo then Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('application',fAppName);
if iiEnvironment in fIncludedInfo then Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('environment',fEnvironment);
if iiPlatform in fIncludedInfo then Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('platform',fPlatformInfo);
if iiOSVersion in fIncludedInfo then Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('OS',SystemInfo.OSVersion);
if iiUserName in fIncludedInfo then Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('user',SystemInfo.UserName);
if iiThreadId in IncludedInfo then Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('threadid',cLogItem.ThreadId.ToString);
if iiProcessId in IncludedInfo then Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('pid',SystemInfo.ProcessId.ToString);
if cLogItem is TLogExceptionItem then
begin
if iiExceptionInfo in fIncludedInfo then Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('exception',TLogExceptionItem(cLogItem).Exception);
if iiExceptionStackTrace in fIncludedInfo then Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('stacktrace',TLogExceptionItem(cLogItem).StackTrace);
end;
Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('message',cLogItem.Msg);
Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}('level',Integer(cLogItem.EventType).ToString);
for tagName in IncludedTags do
begin
if fCustomTags.TryGetValue(tagName,tagValue) then Result.{$IFDEF FPC}Add{$ELSE}AddPair{$ENDIF}(tagName,tagValue);
end;
end;
function TLogProviderBase.LogItemToLine(cLogItem : TLogItem; aShowTimeStamp, aShowEventTypes : Boolean) : string;
var
tagName : string;
tagValue : string;
begin
Result := '';
if aShowTimeStamp then Result := DateTimeToStr(cLogItem.EventDate,FormatSettings);
if aShowEventTypes then Result := Format('%s [%s]',[Result,EventTypeName[cLogItem.EventType]]);
Result := Result + ' ' + cLogItem.Msg;
if iiThreadId in IncludedInfo then Result := Format('%s [ThreadId: %d]',[Result,cLogItem.ThreadId]);
if iiProcessId in IncludedInfo then Result := Format('%s [PID: %d]',[Result,SystemInfo.ProcessId]);
for tagName in IncludedTags do
begin
if fCustomTags.TryGetValue(tagName,tagValue) then Result := Format('%s [%s: %s]',[Result,tagName,tagValue]);
end;
end;
function TLogProviderBase.LogItemToJson(cLogItem: TLogItem): string;
var
json : TJSONObject;
begin
json := LogItemToJsonObject(cLogItem);
try
{$IFDEF DELPHIXE7_UP}
Result := json.ToJSON
{$ELSE}
{$IFDEF FPC}
Result := json.AsJSON;
{$ELSE}
Result := json.ToString;
{$ENDIF}
{$ENDIF}
finally
json.Free;
end;
end;
function TLogProviderBase.ResolveFormatVariable(const cToken : string; cLogItem: TLogItem) : string;
begin
//try process token as tag
if not fCustomTags.TryGetValue(cToken,Result) then
begin
//try process token as variable
if cToken = 'DATETIME' then Result := DateTimeToStr(cLogItem.EventDate,FormatSettings)
else if cToken = 'DATE' then Result := DateToStr(cLogItem.EventDate)
else if cToken = 'TIME' then Result := TimeToStr(cLogItem.EventDate)
else if cToken = 'LEVEL' then Result := cLogItem.EventTypeName
else if cToken = 'LEVELINT' then Result := Integer(cLogItem.EventType).ToString
else if cToken = 'MESSAGE' then Result := cLogItem.Msg
else if cToken = 'ENVIRONMENT' then Result := Self.Environment
else if cToken = 'PLATFORM' then Result := Self.PlatformInfo
else if cToken = 'APPNAME' then Result := Self.AppName
else if cToken = 'APPVERSION' then Result := Self.SystemInfo.AppVersion
else if cToken = 'APPPATH' then Result := Self.SystemInfo.AppPath
else if cToken = 'HOSTNAME' then Result := Self.SystemInfo.HostName
else if cToken = 'USERNAME' then Result := Self.SystemInfo.UserName
else if cToken = 'OSVERSION' then Result := Self.SystemInfo.OsVersion
else if cToken = 'CPUCORES' then Result := Self.SystemInfo.CPUCores.ToString
else if cToken = 'THREADID' then Result := cLogItem.ThreadId.ToString
else Result := '%error%';
end;
end;
{$IFDEF DELPHIXE8_UP}
function TLogProviderBase.LogItemToFormat2(cLogItem: TLogItem): string;
var
line : string;
newline : string;
token : string;
tokrep : string;
begin
if CustomFormatOutput.IsEmpty then Exit(cLogItem.Msg);
//resolve log format
Result := '';
for line in fCustomFormatOutput.Split([sLineBreak]) do
begin
newline := line;
repeat
token := GetSubString(newline,'%{','}');
if not token.IsEmpty then
begin
tokrep := ResolveFormatVariable(token.ToUpper,cLogItem);
//replace token
newline := StringReplace(newline,'%{'+token+'}',tokrep,[rfReplaceAll]);
end;
until token.IsEmpty;
Result := Result + newline;
end;
end;
{$ENDIF}
function TLogProviderBase.LogItemToFormat(cLogItem: TLogItem): string;
var
idx : Integer;
st : Integer;
et : Integer;
token : string;
begin
if CustomFormatOutput.IsEmpty then Exit(cLogItem.Msg);
//resolve log format
Result := '';
idx := 1;
st := 0;
while st < fCustomFormatOutput.Length - 1 do
begin
if (fCustomFormatOutput[st] = '%') and (fCustomFormatOutput[st+1] = '{') then
begin
et := st + 2;
while et < fCustomFormatOutput.Length do
begin
Inc(et);
if fCustomFormatOutput[et] = '}' then
begin
Result := Result + Copy(fCustomFormatOutput,idx,st-idx);
token := Copy(fCustomFormatOutput,st + 2,et-st-2);
Result := Result + ResolveFormatVariable(token,cLogItem);
idx := et + 1;
st := idx;
Break;
end;
end;
end
else Inc(st);
end;
if et < st then Result := Result + Copy(fCustomFormatOutput,et+1,st-et + 1);
end;
function TLogProviderBase.LogItemToHtml(cLogItem: TLogItem): string;
var
msg : TStringList;
tagName : string;
tagValue : string;
begin
msg := TStringList.Create;
try
msg.Add('<html><body>');
msg.Add(Format('<B>EventDate:</B> %s%s',[DateTimeToStr(cLogItem.EventDate,FormatSettings),HTMBR]));
msg.Add(Format('<B>Type:</B> %s%s',[EventTypeName[cLogItem.EventType],HTMBR]));
if iiAppName in IncludedInfo then msg.Add(Format('<B>Application:</B> %s%s',[SystemInfo.AppName,HTMBR]));
if iiHost in IncludedInfo then msg.Add(Format('<B>Host:</B> %s%s ',[SystemInfo.HostName,HTMBR]));
if iiUserName in IncludedInfo then msg.Add(Format('<B>User:</B> %s%s',[SystemInfo.UserName,HTMBR]));
if iiOSVersion in IncludedInfo then msg.Add(Format('<B>OS:</B> %s%s',[SystemInfo.OsVersion,HTMBR]));
if iiEnvironment in IncludedInfo then msg.Add(Format('<B>Environment:</B> %s%s',[Environment,HTMBR]));
if iiPlatform in IncludedInfo then msg.Add(Format('<B>Platform:</B> %s%s',[PlatformInfo,HTMBR]));
if iiThreadId in IncludedInfo then msg.Add(Format('<B>ThreadId:</B> %d',[cLogItem.ThreadId]));
if iiProcessId in IncludedInfo then msg.Add(Format('<B>PID:</B> %d',[SystemInfo.ProcessId]));
for tagName in IncludedTags do
begin
if fCustomTags.TryGetValue(tagName,tagValue) then msg.Add(Format('<B>%s</B> %s',[tagName,tagValue]));
end;
msg.Add(Format('<B>Message:</B> %s%s',[cLogItem.Msg,HTMBR]));
msg.Add('</body></html>');
Result := msg.Text;
finally
msg.Free;
end;
end;
function TLogProviderBase.LogItemToText(cLogItem: TLogItem): string;
var
msg : TStringList;
tagName : string;
tagValue : string;
begin
msg := TStringList.Create;
try
msg.Add(Format('EventDate: %s',[DateTimeToStr(cLogItem.EventDate,FormatSettings)]));
msg.Add(Format('Type: %s',[EventTypeName[cLogItem.EventType]]));
if iiAppName in IncludedInfo then msg.Add(Format('Application: %s',[SystemInfo.AppName]));
if iiHost in IncludedInfo then msg.Add(Format('Host: %s',[SystemInfo.HostName]));
if iiUserName in IncludedInfo then msg.Add(Format('User: %s',[SystemInfo.UserName]));
if iiOSVersion in IncludedInfo then msg.Add(Format('OS: %s',[SystemInfo.OsVersion]));
if iiEnvironment in IncludedInfo then msg.Add(Format('Environment: %s',[Environment]));
if iiPlatform in IncludedInfo then msg.Add(Format('Platform: %s',[PlatformInfo]));
if iiThreadId in IncludedInfo then msg.Add(Format('ThreadId: %d',[cLogItem.ThreadId]));
if iiProcessId in IncludedInfo then msg.Add(Format('PID: %d',[SystemInfo.ProcessId]));
for tagName in IncludedTags do
begin
if fCustomTags.TryGetValue(tagName,tagValue) then msg.Add(Format('%s: %s',[tagName,tagValue]));
end;
msg.Add(Format('Message: %s',[cLogItem.Msg]));
Result := msg.Text;
finally
msg.Free;
end;
end;
procedure TLogProviderBase.NotifyError(const aError: string);
begin
if Assigned(fOnNotifyError) then fOnNotifyError(fName,aError);
end;
procedure TLogProviderBase.Stop;
begin
if (fStatus = psStopped) or (fStatus = psStopping) then Exit;
{$IFDEF LOGGER_DEBUG}
Writeln(Format('stopping thread: %s',[Self.ClassName]));
{$ENDIF}
fEnabled := False;
SetStatus(TLogProviderStatus.psStopping);
if Assigned(fThreadLog) then
begin
if not fThreadLog.Terminated then
begin
fThreadLog.Terminate;
fThreadLog.WaitFor;
end;
fThreadLog.Free;
fThreadLog := nil;
end;
SetStatus(TLogProviderStatus.psStopped);
{$IFDEF LOGGER_DEBUG}
Writeln(Format('stopped thread: %s',[Self.ClassName]));
{$ENDIF}
end;
{$IF DEFINED(DELPHIXE7_UP) AND NOT DEFINED(NEXTGEN)}
function TLogProviderBase.ToJson(aIndent : Boolean = True) : string;
var
serializer : TJsonSerializer;
begin
serializer := TJsonSerializer.Create(slPublicProperty);
try
Result := serializer.ObjectToJson(Self,aIndent);
finally
serializer.Free;
end;
end;
procedure TLogProviderBase.FromJson(const aJson: string);
var
serializer : TJsonSerializer;
begin
serializer := TJsonSerializer.Create(slPublicProperty);
try
Self := TLogProviderBase(serializer.JsonToObject(Self,aJson));
if fEnabled then Self.Restart;
finally
serializer.Free;
end;
end;
procedure TLogProviderBase.SaveToFile(const aJsonFile : string);
var
json : TStringList;
begin
json := TStringList.Create;
try
json.Text := Self.ToJson;
json.SaveToFile(aJsonFile);
finally
json.Free;
end;
end;
procedure TLogProviderBase.LoadFromFile(const aJsonFile : string);
var
json : TStringList;
begin
json := TStringList.Create;
try
json.LoadFromFile(aJsonFile);
Self.FromJson(json.Text);
finally
json.Free;
end;
end;
{$ENDIF}
procedure TLogProviderBase.EnQueueItem(cLogItem : TLogItem);
begin
if fLogQueue.PushItem(cLogItem) <> TWaitResult.wrSignaled then
begin
FreeAndNil(cLogItem);
if Assigned(fOnQueueError) then fOnQueueError(Format('Logger provider "%s" insertion timeout!',[Self.ClassName]));
//raise ELogger.Create(Format('Logger provider "%s" insertion timeout!',[Self.ClassName]));
{$IFDEF LOGGER_DEBUG}
Writeln(Format('insertion timeout: %s',[Self.ClassName]));
{$ENDIF}
{$IFDEF LOGGER_DEBUG2}
end else Writeln(Format('pushitem %s (queue: %d): %s',[Self.ClassName,fLogQueue.QueueSize,cLogItem.fMsg]));
{$ELSE}
end;
{$ENDIF}
end;
function TLogProviderBase.GetEventTypeName(cEventType: TEventType): string;
begin
Result := fEventTypeNames[Integer(cEventType)];
end;
procedure TLogProviderBase.SetEventTypeName(cEventType: TEventType; const cValue : string);
begin
fEventTypeNames[Integer(cEventType)] := cValue;
end;
procedure TLogProviderBase.SetLogTags(cLogTags: ILogTags);
begin
fCustomTags := cLogTags;
end;
procedure TLogProviderBase.SetMaxFailsToRestart(const Value: Integer);
begin
if Value > 0 then fMaxFailsToRestart := Value
else fMaxFailsToRestart := 1;
fFailsToRestart := fMaxFailsToRestart-1;
end;
function TLogProviderBase.GetQueuedLogItems: Integer;
begin
Result := fLogQueue.QueueSize;
end;
function TLogProviderBase.GetVersion: string;
begin
Result := QLVERSION;
end;
procedure TLogProviderBase.SetEnabled(aValue: Boolean);
var
errormsg : string;
begin
if (aValue <> fEnabled) then
begin
if aValue then
begin
try
Init;
except
on E : Exception do
begin
errormsg := Format('LoggerProvider "%s" initialization error (%s)',[Self.Name,e.Message]);
NotifyError(errormsg);
if Assigned(fOnCriticalError) then fOnCriticalError(Self.Name,errormsg);
// else raise ELoggerInitializationError.Create(errormsg);
end;
end;
end
else Stop;
end;
end;
procedure TLogProviderBase.SetStatus(cStatus: TLogProviderStatus);
begin
fStatus := cStatus;
if Assigned(OnStatusChanged) then OnStatusChanged(fName,cStatus);
end;
procedure TLogProviderBase.SetTimePrecission(Value: Boolean);
begin
fTimePrecission := Value;
if fTimePrecission then fFormatSettings.ShortDateFormat := StringReplace(fFormatSettings.ShortDateFormat,'HH:NN:SS','HH:NN:SS.ZZZ',[rfIgnoreCase])
else if fFormatSettings.ShortDateFormat.Contains('ZZZ') then fFormatSettings.ShortDateFormat := StringReplace(fFormatSettings.ShortDateFormat,'HH:NN:SS.ZZZ','HH:NN:SS',[rfIgnoreCase]);
end;
function TLogProviderBase.GetLogLevel : TLogLevel;
begin
Result := fLogLevel;
end;
function TLogProviderBase.GetName: string;
begin
Result := fName;
end;
function TLogProviderBase.IsEnabled : Boolean;
begin
Result := fEnabled;
end;
{ TThreadLog }
constructor TThreadLog.Create;
begin
inherited Create(True);
FreeOnTerminate := False;
end;
destructor TThreadLog.Destroy;
begin
{$IFDEF LOGGER_DEBUG}
Writeln(Format('destroy thread: %s',[TLogProviderBase(fProvider).ClassName]));
{$ENDIF}
fProvider := nil;
inherited;
end;
procedure TThreadLog.Execute;
var
logitem : TLogItem;
qSize : Integer;
begin
//call interface provider to writelog
fProvider.SetStatus(psRunning);
while (not Terminated) or (fLogQueue.QueueSize > 0) do
begin
if fLogQueue.PopItem(qSize,logitem) = TWaitResult.wrSignaled then
begin
{$IFDEF LOGGER_DEBUG2}
Writeln(Format('popitem logger: %s',[logitem.Msg]));
{$ENDIF}
if logitem <> nil then
begin
try
try
if fProvider.Status = psRunning then
begin
//Writelog if not Send limitable or not limit reached
if not fProvider.IsSendLimitReached(logitem.EventType) then fProvider.WriteLog(logitem);
end;
except
on E : Exception do
begin
{$IFDEF LOGGER_DEBUG}
Writeln(Format('fail: %s (%d)',[TLogProviderBase(fProvider).ClassName,TLogProviderBase(fProvider).Fails + 1]));
{$ENDIF}
TLogProviderBase(fProvider).NotifyError(e.message);
//check if there are many errors and needs to restart or stop provider
if not Terminated then fProvider.IncAndCheckErrors;
end;
end;
finally
logitem.Free;
end;
end;
end;
{$IFDEF DELPHIXE7_UP}
{$ELSE}
{$IFNDEF LINUX}
ProcessMessages;
{$ENDIF}
{$ENDIF}
end;
//fProvider := nil;
{$IFDEF LOGGER_DEBUG}
Writeln(Format('terminate thread: %s',[TLogProviderBase(fProvider).ClassName]));
{$ENDIF}
end;
{ TThreadProviderLog }
constructor TThreadProviderLog.Create;
begin
inherited Create(True);
FreeOnTerminate := False;
end;
destructor TThreadProviderLog.Destroy;
var
IProvider : ILogProvider;
begin
//finalizes main queue
if Assigned(fLogQueue) then fLogQueue.Free;
//release providers
if Assigned(fProviders) then
begin
for IProvider in fProviders do IProvider.Stop;
IProvider := nil;
fProviders.Free;
end;
inherited;
end;
procedure TThreadProviderLog.Execute;
var
provider : ILogProvider;
logitem : TLogItem;
qSize : Integer;
begin
//send log items to all providers
while (not Terminated) or (fLogQueue.QueueSize > 0) do
begin
try
if fLogQueue.PopItem(qSize,logitem) = TWaitResult.wrSignaled then
begin
if logitem <> nil then
begin
//send log item to all providers
{$IFDEF LOGGER_DEBUG2}
Writeln(Format('popitem %s: %s',[Self.ClassName,logitem.Msg]));
{$ENDIF}
try
for provider in fProviders do
begin
//send LogItem to provider if Provider Enabled and accepts LogLevel
if (provider.IsEnabled) and (logitem.EventType in provider.GetLogLevel) then
begin
if provider.IsQueueable then provider.EnQueueItem(logitem.Clone)
else
begin
try
provider.WriteLog(logitem);
except
on E : Exception do
begin
{$IFDEF LOGGER_DEBUG}
Writeln(Format('fail: %s (%d)',[TLogProviderBase(provider).ClassName,TLogProviderBase(provider).Fails + 1]));
{$ENDIF}
TLogProviderBase(provider).NotifyError(e.message);
//try to restart provider
if not Terminated then provider.IncAndCheckErrors;
end;
end;
end;
end;
end;
finally
logitem.Free;
provider := nil;
end;
end;
end;
{$IFDEF DELPHIXE7_UP}
{$ELSE}
{$IFNDEF LINUX}
ProcessMessages;
{$ENDIF}
{$ENDIF}
except
on E : Exception do
begin
//if e.ClassType <> EMonitorLockException then raise ELogger.Create(Format('Error reading Queue Log : %s',[e.Message]));
end;
end;
end;
end;
{ TLogItem }
constructor TLogItem.Create;
begin
inherited;
fEventDate := Now();
fEventType := TEventType.etInfo;
fMsg := '';
end;
function TLogItem.EventTypeName : string;
begin
Result := DEF_EVENTTYPENAMES[Integer(fEventType)];
end;
function TLogItem.Clone : TLogItem;
begin
Result := TLogItem.Create;
Result.EventType := Self.EventType;
Result.EventDate := Self.EventDate;
Result.ThreadId := Self.ThreadId;
Result.Msg := Self.Msg;
end;
{ TLogItemException }
function TLogExceptionItem.Clone : TLogItem;
begin
Result := TLogExceptionItem.Create;
Result.EventType := Self.EventType;
Result.EventDate := Self.EventDate;
Result.Msg := Self.Msg;
TLogExceptionItem(Result).Exception := Self.Exception;
end;
{ TLogger }
constructor TLogger.Create;
begin
inherited;
GlobalLoggerHandledException := OnGetHandledException;
GlobalLoggerRuntimeError := OnGetRuntimeError;
GlobalLoggerUnhandledException := OnGetUnhandledException;
fWaitForFlushBeforeExit := DEF_WAIT_FLUSH_LOG;
fLogQueue := TLogQueue.Create(DEF_QUEUE_SIZE,DEF_QUEUE_PUSH_TIMEOUT,DEF_QUEUE_POP_TIMEOUT);
fCustomTags := TLogTags.Create;
fProviders := TLogProviderList.Create;
fProviders.OnNotify := OnProviderListNotify;
fThreadProviderLog := TThreadProviderLog.Create;
fThreadProviderLog.LogQueue := fLogQueue;
fThreadProviderLog.Providers := fProviders;
fThreadProviderLog.Start;
end;
destructor TLogger.Destroy;
var
FinishTime : TDateTime;
begin
GlobalLoggerHandledException := nil;
GlobalLoggerRuntimeError := nil;
GlobalLoggerUnhandledException := nil;
FinishTime := Now();
//wait for main queue and all providers queues finish to flush or max time reached
try
while (not Self.IsQueueEmpty) and (SecondsBetween(Now(),FinishTime) < fWaitForFlushBeforeExit) do
begin
{$IFDEF MSWINDOWS}
ProcessMessages;
{$ELSE}
Sleep(250);
{$ENDIF}
end;
except
{$IFDEF LOGGER_DEBUG}
Writeln(Format('fail waiting for flush: %s',[provider.GetName]));
{$ENDIF}
end;
//finalize queue thread
fThreadProviderLog.Terminate;
fThreadProviderLog.WaitFor;
fThreadProviderLog.Free;
//if Assigned(fProviders) then fProviders.Free;
//Sleep(1500);
inherited;
end;
function TLogger.GetQueuedLogItems : Integer;
begin
Result := fLogQueue.QueueSize;
end;
class function TLogger.GetVersion: string;
begin
Result := QLVERSION;
end;
function TLogger.IsQueueEmpty: Boolean;
begin
Result := (QueueCount = 0) and (ProvidersQueueCount = 0);
end;
procedure TLogger.Add(const cMsg : string; cEventType : TEventType);
var
SystemTime : TSystemTime;
begin
{$IFDEF FPCLINUX}
DateTimeToSystemTime(Now(),SystemTime);
{$ELSE}
GetLocalTime(SystemTime);
{$ENDIF}
Self.EnQueueItem(SystemTime,cMsg,cEventType);
end;
procedure TLogger.Add(const cMsg, cException, cStackTrace : string; cEventType : TEventType);
var
SystemTime : TSystemTime;
begin
{$IFDEF FPCLINUX}
DateTimeToSystemTime(Now(),SystemTime);
{$ELSE}
GetLocalTime(SystemTime);
{$ENDIF}
Self.EnQueueItem(SystemTime,cMsg,cException,cStackTrace,cEventType);
end;
procedure TLogger.Add(const cMsg : string; cValues : array of {$IFDEF FPC}const{$ELSE}TVarRec{$ENDIF}; cEventType : TEventType);
var
SystemTime : TSystemTime;
begin
{$IFDEF FPCLINUX}
DateTimeToSystemTime(Now(),SystemTime);
{$ELSE}
GetLocalTime(SystemTime);
{$ENDIF}
Self.EnQueueItem(SystemTime,Format(cMsg,cValues),cEventType);
end;
procedure TLogger.EnQueueItem(cEventDate : TSystemTime; const cMsg : string; cEventType : TEventType);
var
logitem : TLogItem;
begin
logitem := TLogItem.Create;
logitem.EventType := cEventType;
logitem.Msg := cMsg;
{$IF DEFINED(NEXTGEN) OR DEFINED(OSX) OR DEFINED(DELPHILINUX)}
logitem.EventDate := cEventDate;
{$ELSE}
logitem.EventDate := SystemTimeToDateTime(cEventDate);
{$ENDIF}
Self.EnQueueItem(logitem);
end;
procedure TLogger.EnQueueItem(cEventDate : TSystemTime; const cMsg : string; const cException, cStackTrace : string; cEventType : TEventType);
var
logitem : TLogExceptionItem;
begin
logitem := TLogExceptionItem.Create;
logitem.EventType := cEventType;
logitem.Msg := cMsg;
logitem.Exception := cException;
logitem.StackTrace := cStackTrace;
{$IF DEFINED(NEXTGEN) OR DEFINED(OSX) OR DEFINED(DELPHILINUX)}
logitem.EventDate := cEventDate;
{$ELSE}
logitem.EventDate := SystemTimeToDateTime(cEventDate);
{$ENDIF}
Self.EnQueueItem(logitem);
end;
procedure TLogger.EnQueueItem(cLogItem : TLogItem);
begin
{$IFDEF MSWINDOWS}
cLogItem.ThreadId := GetCurrentThreadId;
{$ELSE}
cLogItem.ThreadId := TThread.CurrentThread.ThreadID;
{$ENDIF}
if fLogQueue.PushItem(cLogItem) <> TWaitResult.wrSignaled then
begin
FreeAndNil(cLogItem);
if Assigned(fOnQueueError) then fOnQueueError('Logger insertion timeout!');
//raise ELogger.Create('Logger insertion timeout!');
{$IFDEF LOGGER_DEBUG}
Writeln(Format('insertion timeout: %s',[Self.ClassName]));
{$ENDIF}
{$IFDEF LOGGER_DEBUG2}
end else Writeln(Format('pushitem logger (queue: %d): %s',[fLogQueue.QueueSize,cMsg]));
{$ELSE}
end;
{$ENDIF}
end;
procedure TLogger.Info(const cMsg: string);
begin
Self.Add(cMsg,TEventType.etInfo);
end;
procedure TLogger.Info(const cMsg: string; cValues: array of const);
begin
Self.Add(cMsg,cValues,TEventType.etInfo);
end;
procedure TLogger.Critical(const cMsg: string);
begin
Self.Add(cMsg,TEventType.etCritical);
end;
procedure TLogger.Critical(const cMsg: string; cValues: array of const);
begin
Self.Add(cMsg,cValues,TEventType.etCritical);
end;
procedure TLogger.Succ(const cMsg: string);
begin
Self.Add(cMsg,TEventType.etSuccess);
end;
procedure TLogger.Succ(const cMsg: string; cValues: array of const);
begin
Self.Add(cMsg,cValues,TEventType.etSuccess);
end;
procedure TLogger.Warn(const cMsg: string);
begin
Self.Add(cMsg,TEventType.etWarning);
end;
procedure TLogger.Warn(const cMsg: string; cValues: array of const);
begin
Self.Add(cMsg,cValues,TEventType.etWarning);
end;
procedure TLogger.Debug(const cMsg: string);
begin
Self.Add(cMsg,TEventType.etDebug);
end;
procedure TLogger.Debug(const cMsg: string; cValues: array of const);
begin
Self.Add(cMsg,cValues,TEventType.etDebug);
end;
procedure TLogger.Trace(const cMsg: string);
begin
Self.Add(cMsg,TEventType.etTrace);
end;
procedure TLogger.Trace(const cMsg: string; cValues: array of const);
begin
Self.Add(cMsg,cValues,TEventType.etTrace);
end;
procedure TLogger.Done(const cMsg: string);
begin
Self.Add(cMsg,TEventType.etDone);
end;
procedure TLogger.Done(const cMsg: string; cValues: array of const);
begin
Self.Add(cMsg,cValues,TEventType.etDone);
end;
procedure TLogger.Error(const cMsg: string);
begin
Self.Add(cMsg,TEventType.etError);
end;
procedure TLogger.Error(const cMsg: string; cValues: array of const);
begin
Self.Add(cMsg,cValues,TEventType.etError);
end;
procedure TLogger.&Except(const cMsg : string);
begin
Self.Add(cMsg,TEventType.etException);
end;
procedure TLogger.&Except(const cMsg: string; cValues: array of const);
begin
Self.Add(cMsg,cValues,TEventType.etException);
end;
procedure TLogger.&Except(const cMsg, cException, cStackTrace: string);
begin
Self.Add(cMsg,cException,cStackTrace,TEventType.etException);
end;
procedure TLogger.&Except(const cMsg : string; cValues: array of const; const cException, cStackTrace: string);
begin
Self.Add(Format(cMsg,cValues),cException,cStackTrace,TEventType.etException);
end;
procedure TLogger.OnGetHandledException(E : Exception);
var
SystemTime : TSystemTime;
begin
{$IFDEF FPCLINUX}
DateTimeToSystemTime(Now(),SystemTime);
{$ELSE}
GetLocalTime(SystemTime);
{$ENDIF}
{$IFDEF FPC}
Self.EnQueueItem(SystemTime,Format('(%s) : %s',[E.ClassName,E.Message]),E.ClassName,'',etException);
{$ELSE}
Self.EnQueueItem(SystemTime,Format('(%s) : %s',[E.ClassName,E.Message]),E.ClassName,E.StackTrace,etException);
{$ENDIF}
end;
procedure TLogger.OnGetRuntimeError(const ErrorName : string; ErrorCode : Byte; ErrorPtr : Pointer);
var
SystemTime : TSystemTime;
begin
{$IFDEF FPCLINUX}
DateTimeToSystemTime(Now(),SystemTime);
{$ELSE}
GetLocalTime(SystemTime);
{$ENDIF}
Self.EnQueueItem(SystemTime,Format('Runtime error %d (%s) risen at $%X',[Errorcode,errorname,Integer(ErrorPtr)]),'RuntimeError','',etException);
end;
procedure TLogger.OnGetUnhandledException(ExceptObject : TObject; ExceptAddr : Pointer);
var
SystemTime : TSystemTime;
begin
{$IFDEF FPCLINUX}
DateTimeToSystemTime(Now(),SystemTime);
{$ELSE}
GetLocalTime(SystemTime);
{$ENDIF}
if ExceptObject is Exception then Self.EnQueueItem(SystemTime,Format('Unhandled Exception (%s) : %s',[Exception(ExceptObject).ClassName,Exception(ExceptObject).Message]),
Exception(ExceptObject).ClassName,
{$IFDEF FPC}'',{$ELSE}Exception(ExceptObject).StackTrace,{$ENDIF}
etException)
else Self.EnQueueItem(SystemTime,Format('Unhandled Exception (%s) at $%X',[ExceptObject.ClassName,Integer(ExceptAddr)]),'Exception','',etException);
end;
{$IFNDEF FPC}
procedure TLogger.OnProviderListNotify(Sender: TObject; const Item: ILogProvider; Action: TCollectionNotification);
begin
if Action = TCollectionNotification.cnAdded then Item.SetLogTags(fCustomTags);
end;
{$ELSE}
procedure TLogger.OnProviderListNotify(ASender: TObject; constref AItem: ILogProvider; AAction: TCollectionNotification);
begin
if AAction = TCollectionNotification.cnAdded then AItem.SetLogTags(fCustomTags);
end;
{$ENDIF}
function TLogger.ProvidersQueueCount: Integer;
var
provider : ILogProvider;
begin
Result := 0;
for provider in fProviders do
begin
Result := Result + provider.GetQueuedLogItems;
end;
end;
procedure TLogger.NotifyProviderError(const aProviderName, aError: string);
var
logitem : TLogItem;
begin
if Assigned(fOwnErrorsProvider) then
begin
logitem := TLogItem.Create;
logitem.EventType := etError;
logitem.EventDate := Now();
logitem.Msg := Format('LOGGER "%s": %s',[aProviderName,aError]);
fOwnErrorsProvider.EnQueueItem(logitem);
end;
if Assigned(fOnProviderError) then fOnProviderError(aProviderName,aError);
end;
procedure TLogger.SetOwnErrorsProvider(const Value: TLogProviderBase);
var
provider : ILogProvider;
begin
fOwnErrorsProvider := Value;
for provider in fProviders do
begin
//redirect provider errors to logger
TLogProviderBase(provider).fOnNotifyError := NotifyProviderError;
end;
end;
{ TLogSendLimit }
constructor TLogSendLimit.Create;
begin
inherited;
fTimeRange := slNoLimit;
fMaxSent := 0;
fNumBlocked := 0;
fFirstSent := 0;
fLastSent := 0;
fCurrentNumSent := 0;
end;
function TLogSendLimit.IsLimitReached(cEventType : TEventType): Boolean;
var
reset : Boolean;
begin
//check sent number in range
if (fTimeRange = slNoLimit) or (not (cEventType in fLimitEventTypes)) then
begin
fLastSent := Now();
Result := False;
Exit;
end;
if fCurrentNumSent < fMaxSent then
begin
Inc(fCurrentNumSent);
fLastSent := Now();
if fFirstSent = 0 then fFirstSent := Now();
Result := False;
end
else
begin
reset := False;
case fTimeRange of
slByDay : if HoursBetween(Now(),fFirstSent) > 24 then reset := True;
slByHour : if MinutesBetween(Now(),fFirstSent) > 60 then reset := True;
slByMinute : if SecondsBetween(Now(),fFirstSent) > 60 then reset := True;
slBySecond : if MilliSecondsBetween(Now(),fFirstSent) > 999 then reset := True;
end;
if reset then
begin
fCurrentNumSent := 0;
fFirstSent := Now();
Inc(fCurrentNumSent);
fLastSent := Now();
Result := False;
end
else
begin
Inc(fNumBlocked);
Result := True;
end;
end;
end;
{ TLogProviderList }
{$IF DEFINED(DELPHIXE7_UP) AND NOT DEFINED(NEXTGEN)}
function TLogProviderList.ToJson(aIndent : Boolean = True) : string;
var
iprovider : ILogProvider;
begin
Result := '{';
for iprovider in Self do
begin
Result := Result + '"' + iprovider.GetName + '": ';
Result := Result + iprovider.ToJson(False);
Result := Result + ',';
end;
if Result.EndsWith(',') then Result := RemoveLastChar(Result);
Result := Result + '}';
if aIndent then Result := TJsonUtils.JsonFormat(Result);
end;
procedure TLogProviderList.FromJson(const aJson : string);
var
iprovider : ILogProvider;
jobject : TJSONObject;
jvalue : TJSONValue;
begin
try
jobject := TJSONObject.ParseJSONValue(aJson) as TJSONObject;
try
for iprovider in Self do
begin
jvalue := jobject.GetValue(iprovider.GetName);
iprovider.FromJson(jvalue.ToJSON);
end;
finally
jobject.Free;
end;
except
on E : Exception do
begin
if iprovider <> nil then raise ELoggerLoadProviderError.CreateFmt('Error loading provider "%s" from json: %s',[iprovider.GetName,e.message])
else raise ELoggerLoadProviderError.CreateFmt('Error loading providers from json: %s',[e.message]);
end;
end;
end;
procedure TLogProviderList.LoadFromFile(const aJsonFile : string);
var
json : TStringList;
begin
json := TStringList.Create;
try
json.LoadFromFile(aJsonFile);
Self.FromJson(json.Text);
finally
json.Free;
end;
end;
procedure TLogProviderList.SaveToFile(const aJsonFile : string);
var
json : TStringList;
begin
json := TStringList.Create;
try
json.Text := Self.ToJson;
json.SaveToFile(aJsonFile);
finally
json.Free;
end;
end;
{$ENDIF}
{ TLogTags }
constructor TLogTags.Create;
begin
fTags := TDictionary<string,string>.Create;
end;
destructor TLogTags.Destroy;
begin
fTags.Free;
inherited;
end;
procedure TLogTags.Add(const aKey, aValue: string);
begin
fTags.Add(aKey.ToUpper,aValue);
end;
function TLogTags.GetTag(const aKey: string): string;
begin
if not fTags.TryGetValue(aKey,Result) then raise Exception.CreateFmt('Log Tag "%s" not found!',[aKey]);
end;
procedure TLogTags.SetTag(const aKey, aValue: string);
begin
fTags.AddOrSetValue(aKey.ToUpper,aValue);
end;
function TLogTags.TryGetValue(const aKey : string; out oValue : string) : Boolean;
begin
Result := fTags.TryGetValue(aKey.ToUpper,oValue);
end;
initialization
Logger := TLogger.Create;
finalization
Logger.Free;
end.
| {
"pile_set_name": "Github"
} |
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.language.process;
/**
* <p>This interface provides NFKC normalization of Strings through the underlying linguistics library.</p>
*
* @author Mathias Mølster Lidal
*/
public interface Normalizer {
/**
* NFKC normalizes a String.
*
* @param input the string to normalize
* @return the normalized string
* @throws ProcessingException if underlying library throws an Exception
*/
String normalize(String input);
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_13) on Mon Aug 24 03:38:05 CEST 2009 -->
<TITLE>
MonoExceptionClause.data_union.ByValue
</TITLE>
<META NAME="date" CONTENT="2009-08-24">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="MonoExceptionClause.data_union.ByValue";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../com/nativelibs4java/mono/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.ByReference.html" title="class in com.nativelibs4java.mono"><B>PREV CLASS</B></A>
<A HREF="../../../com/nativelibs4java/mono/MonoLibrary.html" title="interface in com.nativelibs4java.mono"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?com/nativelibs4java/mono/MonoExceptionClause.data_union.ByValue.html" target="_top"><B>FRAMES</B></A>
<A HREF="MonoExceptionClause.data_union.ByValue.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_com.nativelibs4java.mono.MonoExceptionClause.data_union">NESTED</A> | <A HREF="#fields_inherited_from_class_com.nativelibs4java.mono.MonoExceptionClause.data_union">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#methods_inherited_from_class_com.nativelibs4java.mono.MonoExceptionClause.data_union">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | METHOD</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.nativelibs4java.mono</FONT>
<BR>
Class MonoExceptionClause.data_union.ByValue</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true" title="class or interface in com.sun.jna">com.sun.jna.Structure</A>
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Union.html?is-external=true" title="class or interface in com.sun.jna">com.sun.jna.Union</A>
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true" title="class or interface in com.ochafik.lang.jnaerator.runtime">com.ochafik.lang.jnaerator.runtime.Union</A><<A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.html" title="class in com.nativelibs4java.mono">MonoExceptionClause.data_union</A>,<A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.ByValue.html" title="class in com.nativelibs4java.mono">MonoExceptionClause.data_union.ByValue</A>,<A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.ByReference.html" title="class in com.nativelibs4java.mono">MonoExceptionClause.data_union.ByReference</A>>
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.html" title="class in com.nativelibs4java.mono">com.nativelibs4java.mono.MonoExceptionClause.data_union</A>
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.nativelibs4java.mono.MonoExceptionClause.data_union.ByValue</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/StructureType.html?is-external=true" title="class or interface in com.ochafik.lang.jnaerator.runtime">StructureType</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/StructureTypeDependent.html?is-external=true" title="class or interface in com.ochafik.lang.jnaerator.runtime">StructureTypeDependent</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.ByValue.html?is-external=true" title="class or interface in com.sun.jna">Structure.ByValue</A></DD>
</DL>
<DL>
<DT><B>Enclosing class:</B><DD><A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.html" title="class in com.nativelibs4java.mono">MonoExceptionClause.data_union</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public static class <B>MonoExceptionClause.data_union.ByValue</B><DT>extends <A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.html" title="class in com.nativelibs4java.mono">MonoExceptionClause.data_union</A><DT>implements <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.ByValue.html?is-external=true" title="class or interface in com.sun.jna">Structure.ByValue</A></DL>
</PRE>
<P>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<A NAME="nested_class_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Nested Class Summary</B></FONT></TH>
</TR>
</TABLE>
<A NAME="nested_classes_inherited_from_class_com.nativelibs4java.mono.MonoExceptionClause.data_union"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Nested classes/interfaces inherited from class com.nativelibs4java.mono.<A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.html" title="class in com.nativelibs4java.mono">MonoExceptionClause.data_union</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.ByReference.html" title="class in com.nativelibs4java.mono">MonoExceptionClause.data_union.ByReference</A>, <A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.ByValue.html" title="class in com.nativelibs4java.mono">MonoExceptionClause.data_union.ByValue</A></CODE></TD>
</TR>
</TABLE>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_com.nativelibs4java.mono.MonoExceptionClause.data_union"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Fields inherited from class com.nativelibs4java.mono.<A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.html" title="class in com.nativelibs4java.mono">MonoExceptionClause.data_union</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.html#catch_class">catch_class</A>, <A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.html#filter_offset">filter_offset</A></CODE></TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_com.sun.jna.Structure"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Fields inherited from class com.sun.jna.<A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true" title="class or interface in com.sun.jna">Structure</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#ALIGN_DEFAULT" title="class or interface in com.sun.jna">ALIGN_DEFAULT</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#ALIGN_GNUC" title="class or interface in com.sun.jna">ALIGN_GNUC</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#ALIGN_MSVC" title="class or interface in com.sun.jna">ALIGN_MSVC</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#ALIGN_NONE" title="class or interface in com.sun.jna">ALIGN_NONE</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#CALCULATE_SIZE" title="class or interface in com.sun.jna">CALCULATE_SIZE</A></CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.ByValue.html#MonoExceptionClause.data_union.ByValue()">MonoExceptionClause.data_union.ByValue</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_com.nativelibs4java.mono.MonoExceptionClause.data_union"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class com.nativelibs4java.mono.<A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.html" title="class in com.nativelibs4java.mono">MonoExceptionClause.data_union</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.html#newByReference()">newByReference</A>, <A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.html#newByValue()">newByValue</A>, <A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.html#newInstance()">newInstance</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_com.ochafik.lang.jnaerator.runtime.Union"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class com.ochafik.lang.jnaerator.runtime.<A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true" title="class or interface in com.ochafik.lang.jnaerator.runtime">Union</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true#byReference()" title="class or interface in com.ochafik.lang.jnaerator.runtime">byReference</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true#byValue()" title="class or interface in com.ochafik.lang.jnaerator.runtime">byValue</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true#clone()" title="class or interface in com.ochafik.lang.jnaerator.runtime">clone</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true#read()" title="class or interface in com.ochafik.lang.jnaerator.runtime">read</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true#readDependency()" title="class or interface in com.ochafik.lang.jnaerator.runtime">readDependency</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true#setDependency(com.ochafik.lang.jnaerator.runtime.StructureType)" title="class or interface in com.ochafik.lang.jnaerator.runtime">setDependency</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true#setupClone(T)" title="class or interface in com.ochafik.lang.jnaerator.runtime">setupClone</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true#toArray()" title="class or interface in com.ochafik.lang.jnaerator.runtime">toArray</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true#toArray(int)" title="class or interface in com.ochafik.lang.jnaerator.runtime">toArray</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true#toArray(com.sun.jna.Structure[])" title="class or interface in com.ochafik.lang.jnaerator.runtime">toArray</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true#useMemory(com.sun.jna.Pointer)" title="class or interface in com.ochafik.lang.jnaerator.runtime">useMemory</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/Union.html?is-external=true#write()" title="class or interface in com.ochafik.lang.jnaerator.runtime">write</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_com.sun.jna.Union"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class com.sun.jna.<A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Union.html?is-external=true" title="class or interface in com.sun.jna">Union</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Union.html?is-external=true#getNativeAlignment(java.lang.Class, java.lang.Object, boolean)" title="class or interface in com.sun.jna">getNativeAlignment</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Union.html?is-external=true#getTypedValue(java.lang.Class)" title="class or interface in com.sun.jna">getTypedValue</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Union.html?is-external=true#readField(java.lang.String)" title="class or interface in com.sun.jna">readField</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Union.html?is-external=true#setType(java.lang.Class)" title="class or interface in com.sun.jna">setType</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Union.html?is-external=true#setTypedValue(java.lang.Object)" title="class or interface in com.sun.jna">setTypedValue</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Union.html?is-external=true#writeField(java.lang.String)" title="class or interface in com.sun.jna">writeField</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Union.html?is-external=true#writeField(java.lang.String, java.lang.Object)" title="class or interface in com.sun.jna">writeField</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_com.sun.jna.Structure"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class com.sun.jna.<A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true" title="class or interface in com.sun.jna">Structure</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#allocateMemory()" title="class or interface in com.sun.jna">allocateMemory</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#allocateMemory(int)" title="class or interface in com.sun.jna">allocateMemory</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#autoRead()" title="class or interface in com.sun.jna">autoRead</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#autoWrite()" title="class or interface in com.sun.jna">autoWrite</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#cacheTypeInfo(com.sun.jna.Pointer)" title="class or interface in com.sun.jna">cacheTypeInfo</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#clear()" title="class or interface in com.sun.jna">clear</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#ensureAllocated()" title="class or interface in com.sun.jna">ensureAllocated</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#equals(java.lang.Object)" title="class or interface in com.sun.jna">equals</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#getAutoRead()" title="class or interface in com.sun.jna">getAutoRead</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#getAutoWrite()" title="class or interface in com.sun.jna">getAutoWrite</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#getBitsAnnotation(java.lang.reflect.Field)" title="class or interface in com.sun.jna">getBitsAnnotation</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#getFieldOrder()" title="class or interface in com.sun.jna">getFieldOrder</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#getPointer()" title="class or interface in com.sun.jna">getPointer</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#getStructAlignment()" title="class or interface in com.sun.jna">getStructAlignment</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#hashCode()" title="class or interface in com.sun.jna">hashCode</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#newInstance(java.lang.Class)" title="class or interface in com.sun.jna">newInstance</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#setAlignType(int)" title="class or interface in com.sun.jna">setAlignType</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#setAutoRead(boolean)" title="class or interface in com.sun.jna">setAutoRead</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#setAutoSynch(boolean)" title="class or interface in com.sun.jna">setAutoSynch</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#setAutoWrite(boolean)" title="class or interface in com.sun.jna">setAutoWrite</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#setFieldOrder(java.lang.String[])" title="class or interface in com.sun.jna">setFieldOrder</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#setTypeMapper(com.sun.jna.TypeMapper)" title="class or interface in com.sun.jna">setTypeMapper</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#size()" title="class or interface in com.sun.jna">size</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#sortFields(java.lang.reflect.Field[], java.lang.String[])" title="class or interface in com.sun.jna">sortFields</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#toString()" title="class or interface in com.sun.jna">toString</A>, <A HREF="https://jna.dev.java.net/javadoc/com/sun/jna/Structure.html?is-external=true#useMemory(com.sun.jna.Pointer, int)" title="class or interface in com.sun.jna">useMemory</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>finalize, getClass, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_com.ochafik.lang.jnaerator.runtime.StructureType"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from interface com.ochafik.lang.jnaerator.runtime.<A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/StructureType.html?is-external=true" title="class or interface in com.ochafik.lang.jnaerator.runtime">StructureType</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/StructureType.html?is-external=true#getPointer()" title="class or interface in com.ochafik.lang.jnaerator.runtime">getPointer</A>, <A HREF="http://jnaerator.googlecode.com/svn/trunk/doc/com/ochafik/lang/jnaerator/runtime/StructureType.html?is-external=true#size()" title="class or interface in com.ochafik.lang.jnaerator.runtime">size</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="MonoExceptionClause.data_union.ByValue()"><!-- --></A><H3>
MonoExceptionClause.data_union.ByValue</H3>
<PRE>
public <B>MonoExceptionClause.data_union.ByValue</B>()</PRE>
<DL>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../com/nativelibs4java/mono/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../com/nativelibs4java/mono/MonoExceptionClause.data_union.ByReference.html" title="class in com.nativelibs4java.mono"><B>PREV CLASS</B></A>
<A HREF="../../../com/nativelibs4java/mono/MonoLibrary.html" title="interface in com.nativelibs4java.mono"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?com/nativelibs4java/mono/MonoExceptionClause.data_union.ByValue.html" target="_top"><B>FRAMES</B></A>
<A HREF="MonoExceptionClause.data_union.ByValue.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_com.nativelibs4java.mono.MonoExceptionClause.data_union">NESTED</A> | <A HREF="#fields_inherited_from_class_com.nativelibs4java.mono.MonoExceptionClause.data_union">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#methods_inherited_from_class_com.nativelibs4java.mono.MonoExceptionClause.data_union">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | METHOD</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.polyfill.io/v1/polyfill.js?features=Element.prototype.closest"></script>
<style>
.voter {
font-family: 'DejaVu Sans Mono', 'Lucida Console', 'Menlo', 'Monaco', monospace;
font-size: 18px;
}
.up,
.down {
cursor: pointer;
color: blue;
font-weight: bold;
}
</style>
</head>
<body>
<div id="voter" class="voter">
<span class="down">—</span>
<span class="vote">0</span>
<span class="up">+</span>
</div>
<script>
function Voter(options) {
// ... ваш код
}
var voter = new Voter({
elem: document.getElementById('voter')
});
voter.setVote(1);
</script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
# Copyright 2012 OpenStack Foundation
#
# 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.
from oslo_utils import timeutils
import sqlalchemy
from sqlalchemy.ext.hybrid import hybrid_property
from keystone.common import sql
from keystone import exception
from keystone.trust.backends import base
# The maximum number of iterations that will be attempted for optimistic
# locking on consuming a limited-use trust.
MAXIMUM_CONSUME_ATTEMPTS = 10
class TrustModel(sql.ModelBase, sql.ModelDictMixinWithExtras):
__tablename__ = 'trust'
attributes = ['id', 'trustor_user_id', 'trustee_user_id',
'project_id', 'impersonation', 'expires_at',
'remaining_uses', 'deleted_at', 'redelegated_trust_id',
'redelegation_count']
id = sql.Column(sql.String(64), primary_key=True)
# user id of owner
trustor_user_id = sql.Column(sql.String(64), nullable=False,)
# user_id of user allowed to consume this preauth
trustee_user_id = sql.Column(sql.String(64), nullable=False)
project_id = sql.Column(sql.String(64))
impersonation = sql.Column(sql.Boolean, nullable=False)
deleted_at = sql.Column(sql.DateTime)
_expires_at = sql.Column('expires_at', sql.DateTime)
expires_at_int = sql.Column(sql.DateTimeInt(), nullable=True)
remaining_uses = sql.Column(sql.Integer, nullable=True)
redelegated_trust_id = sql.Column(sql.String(64), nullable=True)
redelegation_count = sql.Column(sql.Integer, nullable=True)
extra = sql.Column(sql.JsonBlob())
__table_args__ = (sql.UniqueConstraint(
'trustor_user_id', 'trustee_user_id', 'project_id',
'impersonation', 'expires_at',
name='duplicate_trust_constraint'),)
@hybrid_property
def expires_at(self):
return self.expires_at_int or self._expires_at
@expires_at.setter
def expires_at(self, value):
self._expires_at = value
self.expires_at_int = value
class TrustRole(sql.ModelBase):
__tablename__ = 'trust_role'
attributes = ['trust_id', 'role_id']
trust_id = sql.Column(sql.String(64), primary_key=True, nullable=False)
role_id = sql.Column(sql.String(64), primary_key=True, nullable=False)
class Trust(base.TrustDriverBase):
@sql.handle_conflicts(conflict_type='trust')
def create_trust(self, trust_id, trust, roles):
with sql.session_for_write() as session:
ref = TrustModel.from_dict(trust)
ref['id'] = trust_id
if ref.get('expires_at') and ref['expires_at'].tzinfo is not None:
ref['expires_at'] = timeutils.normalize_time(ref['expires_at'])
session.add(ref)
added_roles = []
for role in roles:
trust_role = TrustRole()
trust_role.trust_id = trust_id
trust_role.role_id = role['id']
added_roles.append({'id': role['id']})
session.add(trust_role)
trust_dict = ref.to_dict()
trust_dict['roles'] = added_roles
return trust_dict
def _add_roles(self, trust_id, session, trust_dict):
roles = []
for role in session.query(TrustRole).filter_by(trust_id=trust_id):
roles.append({'id': role.role_id})
trust_dict['roles'] = roles
def consume_use(self, trust_id):
for attempt in range(MAXIMUM_CONSUME_ATTEMPTS):
with sql.session_for_write() as session:
try:
query_result = (session.query(TrustModel.remaining_uses).
filter_by(id=trust_id).
filter_by(deleted_at=None).one())
except sql.NotFound:
raise exception.TrustNotFound(trust_id=trust_id)
remaining_uses = query_result.remaining_uses
if remaining_uses is None:
# unlimited uses, do nothing
break
elif remaining_uses > 0:
# NOTE(morganfainberg): use an optimistic locking method
# to ensure we only ever update a trust that has the
# expected number of remaining uses.
rows_affected = (
session.query(TrustModel).
filter_by(id=trust_id).
filter_by(deleted_at=None).
filter_by(remaining_uses=remaining_uses).
update({'remaining_uses': (remaining_uses - 1)},
synchronize_session=False))
if rows_affected == 1:
# Successfully consumed a single limited-use trust.
# Since trust_id is the PK on the Trust table, there is
# no case we should match more than 1 row in the
# update. We either update 1 row or 0 rows.
break
else:
raise exception.TrustUseLimitReached(trust_id=trust_id)
else:
# NOTE(morganfainberg): In the case the for loop is not prematurely
# broken out of, this else block is executed. This means the trust
# was not unlimited nor was it consumed (we hit the maximum
# iteration limit). This is just an indicator that we were unable
# to get the optimistic lock rather than silently failing or
# incorrectly indicating a trust was consumed.
raise exception.TrustConsumeMaximumAttempt(trust_id=trust_id)
def get_trust(self, trust_id, deleted=False):
with sql.session_for_read() as session:
query = session.query(TrustModel).filter_by(id=trust_id)
if not deleted:
query = query.filter_by(deleted_at=None)
ref = query.first()
if ref is None:
raise exception.TrustNotFound(trust_id=trust_id)
if ref.expires_at is not None and not deleted:
now = timeutils.utcnow()
if now > ref.expires_at:
raise exception.TrustNotFound(trust_id=trust_id)
# Do not return trusts that can't be used anymore
if ref.remaining_uses is not None and not deleted:
if ref.remaining_uses <= 0:
raise exception.TrustNotFound(trust_id=trust_id)
trust_dict = ref.to_dict()
self._add_roles(trust_id, session, trust_dict)
return trust_dict
def list_trusts(self):
with sql.session_for_read() as session:
trusts = session.query(TrustModel).filter_by(deleted_at=None)
return [trust_ref.to_dict() for trust_ref in trusts]
def list_trusts_for_trustee(self, trustee_user_id):
with sql.session_for_read() as session:
trusts = (session.query(TrustModel).
filter_by(deleted_at=None).
filter_by(trustee_user_id=trustee_user_id))
return [trust_ref.to_dict() for trust_ref in trusts]
def list_trusts_for_trustor(self, trustor_user_id):
with sql.session_for_read() as session:
trusts = (session.query(TrustModel).
filter_by(deleted_at=None).
filter_by(trustor_user_id=trustor_user_id))
return [trust_ref.to_dict() for trust_ref in trusts]
@sql.handle_conflicts(conflict_type='trust')
def delete_trust(self, trust_id):
with sql.session_for_write() as session:
trust_ref = session.query(TrustModel).get(trust_id)
if not trust_ref:
raise exception.TrustNotFound(trust_id=trust_id)
trust_ref.deleted_at = timeutils.utcnow()
def delete_trusts_for_project(self, project_id):
with sql.session_for_write() as session:
query = session.query(TrustModel)
trusts = query.filter_by(project_id=project_id)
for trust_ref in trusts:
trust_ref.deleted_at = timeutils.utcnow()
def flush_expired_and_soft_deleted_trusts(self, project_id=None,
trustor_user_id=None,
trustee_user_id=None,
date=None):
with sql.session_for_write() as session:
query = session.query(TrustModel)
query = query.\
filter(sqlalchemy.or_(TrustModel.deleted_at.isnot(None),
sqlalchemy.and_(
TrustModel.expires_at.isnot(None),
TrustModel.expires_at < date)))
if project_id:
query = query.filter_by(project_id=project_id)
if trustor_user_id:
query = query.filter_by(trustor_user_id=trustor_user_id)
if trustee_user_id:
query = query.filter_by(trustee_user_id=trustee_user_id)
query.delete(synchronize_session=False)
session.flush()
| {
"pile_set_name": "Github"
} |
int printf(char *fmt);
int main() {
char a; a= 'fred';
}
| {
"pile_set_name": "Github"
} |
// +build freebsd,cgo
package mount
/*
#include <sys/mount.h>
*/
import "C"
const (
// RDONLY will mount the filesystem as read-only.
RDONLY = C.MNT_RDONLY
// NOSUID will not allow set-user-identifier or set-group-identifier bits to
// take effect.
NOSUID = C.MNT_NOSUID
// NOEXEC will not allow execution of any binaries on the mounted file system.
NOEXEC = C.MNT_NOEXEC
// SYNCHRONOUS will allow any I/O to the file system to be done synchronously.
SYNCHRONOUS = C.MNT_SYNCHRONOUS
// NOATIME will not update the file access time when reading from a file.
NOATIME = C.MNT_NOATIME
)
// These flags are unsupported.
const (
BIND = 0
DIRSYNC = 0
MANDLOCK = 0
NODEV = 0
NODIRATIME = 0
UNBINDABLE = 0
RUNBINDABLE = 0
PRIVATE = 0
RPRIVATE = 0
SHARED = 0
RSHARED = 0
SLAVE = 0
RSLAVE = 0
RBIND = 0
RELATIME = 0
REMOUNT = 0
STRICTATIME = 0
mntDetach = 0
)
| {
"pile_set_name": "Github"
} |
name=Deathgrip
image=https://magiccards.info/scans/en/5e/16.jpg
value=3.534
rarity=U
type=Enchantment
cost={B}{B}
ability={B}{B}: Counter target green spell.
timing=enchantment
oracle={B}{B}: Counter target green spell.
| {
"pile_set_name": "Github"
} |
# mach: crisv3 crisv8 crisv10 crisv32
# output: ffffff00\nffff0000\n0\nbb113344\n
# Test generic "move Ps,Rd" and "move Rs,Pd" insns; the ones with
# functionality common to all models.
.include "testutils.inc"
start
moveq -1,r3
clear.b r3
checkr3 ffffff00
moveq -1,r3
clear.w r3
checkr3 ffff0000
moveq -1,r3
clear.d r3
checkr3 0
moveq -1,r3
move.d 0xbb113344,r4
setf zcvn
move r4,srp
move srp,r3
test_cc 1 1 1 1
checkr3 bb113344
quit
| {
"pile_set_name": "Github"
} |
# Go to http://wiki.merbivore.com/pages/init-rb
::Gem.clear_paths; ::Gem.path.unshift(File.dirname(__FILE__) + "/../gems/")
require 'config/dependencies.rb'
use_test :rspec
use_template_engine :erb
Merb::Config.use do |c|
c[:use_mutex] = false
c[:session_store] = 'cookie' # can also be 'memory', 'memcache', 'container', 'datamapper
# cookie session store configuration
c[:session_secret_key] = 'aac0966e584824077b8c4e0442dca5a97f91d007' # required for cookie session store
# c[:session_id_key] = '_session_id' # cookie session id key, defaults to "_session_id"
end
Merb::BootLoader.before_app_loads do
# This will get executed after dependencies have been loaded but before your app's classes have loaded.
end
Merb::BootLoader.after_app_loads do
# This will get executed after your app's classes have been loaded.
end
| {
"pile_set_name": "Github"
} |
extern crate pushrod;
extern crate sdl2;
use pushrod::render::engine::Engine;
use pushrod::render::widget::Widget;
use pushrod::render::widget_config::{CONFIG_BORDER_WIDTH, CONFIG_COLOR_BORDER};
use pushrod::render::{make_points, make_size};
use pushrod::widgets::push_button_widget::PushButtonWidget;
use sdl2::pixels::Color;
/*
* This demo just tests the rendering functionality of the `BaseWidget`. It only tests the
* render portion of the library, nothing else.
*/
pub fn main() {
let sdl_context = sdl2::init().unwrap();
let video_subsystem = sdl_context.video().unwrap();
let window = video_subsystem
.window("pushrod-render push button demo", 400, 100)
.position_centered()
.opengl()
.build()
.unwrap();
let mut engine = Engine::new(400, 100, 30);
let mut button1 = PushButtonWidget::new(
make_points(20, 20),
make_size(360, 60),
String::from("Click me!"),
40,
);
button1.set_color(CONFIG_COLOR_BORDER, Color::RGB(0, 0, 0));
button1.set_numeric(CONFIG_BORDER_WIDTH, 2);
button1.on_click(|_x, _widgets, _layouts| {
eprintln!("Click me clicked!");
});
engine.add_widget(Box::new(button1), String::from("button1"));
engine.run(sdl_context, window);
}
| {
"pile_set_name": "Github"
} |
/*
Copyright (C) 2004, 2005 Mario Lang <[email protected]>
Copyright (C) 2003-2009 Paul Brossier <[email protected]>
This file is part of aubio.
aubio is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
aubio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with aubio. If not, see <http://www.gnu.org/licenses/>.
*/
#include "aubio_priv.h"
#include "fvec.h"
#include "pitch/pitchschmitt.h"
smpl_t aubio_schmittS16LE (aubio_pitchschmitt_t * p, uint_t nframes,
signed short int *indata);
struct _aubio_pitchschmitt_t
{
uint_t blockSize;
uint_t rate;
signed short int *schmittBuffer;
signed short int *schmittPointer;
signed short int *buf;
};
aubio_pitchschmitt_t *
new_aubio_pitchschmitt (uint_t size)
{
aubio_pitchschmitt_t *p = AUBIO_NEW (aubio_pitchschmitt_t);
p->blockSize = size;
p->schmittBuffer = AUBIO_ARRAY (signed short int, p->blockSize);
p->buf = AUBIO_ARRAY (signed short int, p->blockSize);
p->schmittPointer = p->schmittBuffer;
return p;
}
void
aubio_pitchschmitt_do (aubio_pitchschmitt_t * p, const fvec_t * input,
fvec_t * output)
{
uint_t j;
for (j = 0; j < input->length; j++) {
p->buf[j] = input->data[j] * 32768.;
}
output->data[0] = aubio_schmittS16LE (p, input->length, p->buf);
}
smpl_t
aubio_schmittS16LE (aubio_pitchschmitt_t * p, uint_t nframes,
signed short int *indata)
{
uint_t i, j;
uint_t blockSize = p->blockSize;
signed short int *schmittBuffer = p->schmittBuffer;
signed short int *schmittPointer = p->schmittPointer;
smpl_t period = 0., trigfact = 0.6;
for (i = 0; i < nframes; i++) {
*schmittPointer++ = indata[i];
if (schmittPointer - schmittBuffer >= (sint_t) blockSize) {
sint_t endpoint, startpoint, t1, t2, A1, A2, tc, schmittTriggered;
schmittPointer = schmittBuffer;
for (j = 0, A1 = 0, A2 = 0; j < blockSize; j++) {
if (schmittBuffer[j] > 0 && A1 < schmittBuffer[j])
A1 = schmittBuffer[j];
if (schmittBuffer[j] < 0 && A2 < -schmittBuffer[j])
A2 = -schmittBuffer[j];
}
t1 = (sint_t) (A1 * trigfact + 0.5);
t2 = -(sint_t) (A2 * trigfact + 0.5);
startpoint = 0;
for (j = 1; j < blockSize && schmittBuffer[j] <= t1; j++);
for ( ; j < blockSize - 1 && !(schmittBuffer[j] >= t2 &&
schmittBuffer[j + 1] < t2); j++);
startpoint = j;
schmittTriggered = 0;
endpoint = startpoint + 1;
for (j = startpoint, tc = 0; j < blockSize; j++) {
if (!schmittTriggered) {
schmittTriggered = (schmittBuffer[j] >= t1);
} else if (schmittBuffer[j] >= t2 && schmittBuffer[j + 1] < t2) {
endpoint = j;
tc++;
schmittTriggered = 0;
}
}
if ((endpoint > startpoint) && (tc > 0)) {
period = (smpl_t) (endpoint - startpoint) / tc;
}
}
}
p->schmittBuffer = schmittBuffer;
p->schmittPointer = schmittPointer;
return period;
}
void
del_aubio_pitchschmitt (aubio_pitchschmitt_t * p)
{
AUBIO_FREE (p->schmittBuffer);
AUBIO_FREE (p->buf);
AUBIO_FREE (p);
}
| {
"pile_set_name": "Github"
} |
<html>
<head><title>监控信息</title>
<body>
<table border="1">
<tr><td>服务器名称</td><td>{{hostname}}</td></tr>
<tr><td>开机时间</td><td>{{boot_time}}</td></tr>
<tr><td>cpu个数</td><td>{{cpu_count}}</td></tr>
<tr><td>cpu利用率</td><td>{{cpu_percent}}</td></tr>
<tr><td>内存总量</td><td>{{mem_percent}}</td></tr>
<tr><td>内存利用率</td><td>{{mem_total}}</td></tr>
<tr><td>内存已用空间</td><td>{{mem_used}}</td></tr>
<tr><td>内存可用空间</td><td>{{mem_free}}</td></tr>
<tr><td>磁盘空间总量</td><td>{{disk_total}}</td></tr>
<tr><td>磁盘空间利用率</td><td>{{disk_percent}}</td></tr>
<tr><td>磁盘已用空间</td><td>{{disk_used}}</td></tr>
<tr><td>磁盘可用空间</td><td>{{disk_free}}</td></tr>
</table>
</body>
</html>
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_08) on Tue Jun 03 16:15:28 GMT-05:00 2008 -->
<TITLE>
Uses of Class soot.jimple.toolkits.annotation.callgraph.CallGraphInfo (Soot API)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Uses of Class soot.jimple.toolkits.annotation.callgraph.CallGraphInfo (Soot API)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../soot/jimple/toolkits/annotation/callgraph/CallGraphInfo.html" title="class in soot.jimple.toolkits.annotation.callgraph"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?soot/jimple/toolkits/annotation/callgraph//class-useCallGraphInfo.html" target="_top"><B>FRAMES</B></A>
<A HREF="CallGraphInfo.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>soot.jimple.toolkits.annotation.callgraph.CallGraphInfo</B></H2>
</CENTER>
No usage of soot.jimple.toolkits.annotation.callgraph.CallGraphInfo
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../soot/jimple/toolkits/annotation/callgraph/CallGraphInfo.html" title="class in soot.jimple.toolkits.annotation.callgraph"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?soot/jimple/toolkits/annotation/callgraph//class-useCallGraphInfo.html" target="_top"><B>FRAMES</B></A>
<A HREF="CallGraphInfo.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| {
"pile_set_name": "Github"
} |
package com.droidquest.items;
import com.droidquest.Room;
import com.droidquest.devices.StormShield;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
public class GateKeeper extends Item {
int behavior = 0;
// 0= pause
// 1= Go to trash, delete F-12, delete StormShield
private int goToX = 2 * 28 + 14;
private int goToY = 8 * 32;
public GateKeeper(int X, int Y, Room r) {
x = X;
y = Y;
room = r;
width = 52;
height = 38;
grabbable = false;
GenerateIcons();
}
public void GenerateIcons() {
icons = new ImageIcon[1];
icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR));
Graphics g;
try {
g = icons[0].getImage().getGraphics();
}
catch (NullPointerException e) {
System.out.println("Could not get Graphics pointer to " + getClass() + " Image");
return;
}
Graphics2D g2 = (Graphics2D) g;
Color transparent = new Color(0, 0, 0, 0);
g2.setBackground(transparent);
g2.clearRect(0, 0, width, height);
g.setColor(Color.white);
g.fillRect(4, 0, 12, 14);
g.fillRect(0, 2, 20, 10);
g.fillRect(20, 4, 8, 6);
g.fillRect(24, 8, 24, 20);
g.fillRect(48, 12, 4, 16);
g.fillRect(32, 6, 12, 32);
g.fillRect(28, 34, 20, 2);
g.fillRect(24, 36, 28, 2);
g.setColor(Color.black);
g.fillRect(8, 2, 4, 10);
g.fillRect(4, 4, 12, 6);
g.fillRect(0, 6, 4, 2);
g.fillRect(20, 6, 4, 2);
g.fillRect(28, 18, 4, 2);
g.fillRect(32, 16, 4, 2);
g.fillRect(36, 18, 4, 2);
g.fillRect(40, 16, 4, 2);
g.fillRect(44, 18, 4, 2);
currentIcon = icons[0].getImage();
}
public void Animate() {
if (behavior == 1) {
if (x != goToX || y != goToY) {
if (x != goToX) {
int diff = Math.abs(goToX - x);
int dir = diff / (goToX - x);
if (diff > 2) {
diff = 2;
}
moveRight(diff * dir);
}
if (y != goToY) {
int diff = Math.abs(goToY - y);
int dir = diff / (goToY - y);
if (diff > 2) {
diff = 2;
}
moveDown(diff * dir);
}
}
else {
behavior = 0;
level.items.removeElement(carrying);
carrying = null;
StormShield ss = null;
for (int a = 0; a < level.items.size(); a++) {
Item item = level.items.elementAt(a);
if (item.getClass().toString().endsWith("StormShield")) {
ss = (StormShield) item;
}
}
if (ss != null) {
ss.SetRoom(null); // Removes wires
level.items.removeElement(ss);
}
room.SetMaterial(7, 7, 21);
}
}
}
}
| {
"pile_set_name": "Github"
} |
; PR1117
; RUN: not llvm-as %s -o /dev/null 2>&1 | grep "invalid cast opcode for cast from"
@X = constant i8* trunc (i64 0 to i8*)
| {
"pile_set_name": "Github"
} |
// Copyright ©2016 The go-hep Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gen // import "go-hep.org/x/hep/brio/cmd/brio-gen/internal/gen"
import (
"bytes"
"fmt"
"go/format"
"go/types"
"log"
"strings"
"golang.org/x/tools/go/packages"
)
var (
binMa *types.Interface // encoding.BinaryMarshaler
binUn *types.Interface // encoding.BinaryUnmarshaler
)
// Generator holds the state of the generation.
type Generator struct {
buf *bytes.Buffer
pkg *types.Package
// set of imported packages.
// usually: "encoding/binary", "math"
imps map[string]int
Verbose bool // enable verbose mode
}
// NewGenerator returns a new code generator for package p,
// where p is the package's import path.
func NewGenerator(p string) (*Generator, error) {
pkg, err := importPkg(p)
if err != nil {
return nil, err
}
return &Generator{
buf: new(bytes.Buffer),
pkg: pkg,
imps: map[string]int{"encoding/binary": 1},
}, nil
}
func (g *Generator) printf(format string, args ...interface{}) {
fmt.Fprintf(g.buf, format, args...)
}
func (g *Generator) Generate(typeName string) {
scope := g.pkg.Scope()
obj := scope.Lookup(typeName)
if obj == nil {
log.Fatalf("no such type %q in package %q\n", typeName, g.pkg.Path()+"/"+g.pkg.Name())
}
tn, ok := obj.(*types.TypeName)
if !ok {
log.Fatalf("%q is not a type (%v)\n", typeName, obj)
}
typ, ok := tn.Type().Underlying().(*types.Struct)
if !ok {
log.Fatalf("%q is not a named struct (%v)\n", typeName, tn)
}
if g.Verbose {
log.Printf("typ: %+v\n", typ)
}
g.genMarshal(typ, typeName)
g.genUnmarshal(typ, typeName)
}
func (g *Generator) genMarshal(t types.Type, typeName string) {
g.printf(`// MarshalBinary implements encoding.BinaryMarshaler
func (o *%[1]s) MarshalBinary() (data []byte, err error) {
var buf [8]byte
`,
typeName,
)
typ := t.Underlying().(*types.Struct)
for i := 0; i < typ.NumFields(); i++ {
ft := typ.Field(i)
g.genMarshalType(ft.Type(), "o."+ft.Name())
}
g.printf("return data, err\n}\n\n")
}
func (g *Generator) genMarshalType(t types.Type, n string) {
if types.Implements(t, binMa) || types.Implements(types.NewPointer(t), binMa) {
g.printf("{\nsub, err := %s.MarshalBinary()\n", n)
g.printf("if err != nil {\nreturn nil, err\n}\n")
g.printf("binary.LittleEndian.PutUint64(buf[:8], uint64(len(sub)))\n")
g.printf("data = append(data, buf[:8]...)\n")
g.printf("data = append(data, sub...)\n")
g.printf("}\n")
return
}
ut := t.Underlying()
switch ut := ut.(type) {
case *types.Basic:
switch kind := ut.Kind(); kind {
case types.Bool:
g.printf("switch %s {\ncase false:\n data = append(data, uint8(0))\n", n)
g.printf("default:\ndata = append(data, uint8(1))\n}\n")
case types.Uint:
g.printf("binary.LittleEndian.PutUint64(buf[:8], uint64(%s))\n", n)
g.printf("data = append(data, buf[:8]...)\n")
case types.Uint8:
g.printf("data = append(data, byte(%s))\n", n)
case types.Uint16:
g.printf(
"binary.LittleEndian.PutUint16(buf[:2], uint16(%s))\n",
n,
)
g.printf("data = append(data, buf[:2]...)\n")
case types.Uint32:
g.printf(
"binary.LittleEndian.PutUint32(buf[:4], uint32(%s))\n",
n,
)
g.printf("data = append(data, buf[:4]...)\n")
case types.Uint64:
g.printf(
"binary.LittleEndian.PutUint64(buf[:8], uint64(%s))\n",
n,
)
g.printf("data = append(data, buf[:8]...)\n")
case types.Int:
g.printf(
"binary.LittleEndian.PutUint64(buf[:8], uint64(%s))\n",
n,
)
g.printf("data = append(data, buf[:8]...)\n")
case types.Int8:
g.printf("data = append(data, byte(%s))\n", n)
case types.Int16:
g.printf(
"binary.LittleEndian.PutUint16(buf[:2], uint16(%s))\n",
n,
)
g.printf("data = append(data, buf[:2]...)\n")
case types.Int32:
g.printf(
"binary.LittleEndian.PutUint32(buf[:4], uint32(%s))\n",
n,
)
g.printf("data = append(data, buf[:4]...)\n")
case types.Int64:
g.printf(
"binary.LittleEndian.PutUint64(buf[:8], uint64(%s))\n",
n,
)
g.printf("data = append(data, buf[:8]...)\n")
case types.Float32:
g.imps["math"] = 1
g.printf(
"binary.LittleEndian.PutUint32(buf[:4], math.Float32bits(%s))\n",
n,
)
g.printf("data = append(data, buf[:4]...)\n")
case types.Float64:
g.imps["math"] = 1
g.printf(
"binary.LittleEndian.PutUint64(buf[:8], math.Float64bits(%s))\n",
n,
)
g.printf("data = append(data, buf[:8]...)\n")
case types.Complex64:
g.imps["math"] = 1
g.printf(
"binary.LittleEndian.PutUint64(buf[:4], math.Float32bits(real(%s)))\n",
n,
)
g.printf("data = append(data, buf[:4]...)\n")
g.printf(
"binary.LittleEndian.PutUint64(buf[:4], math.Float32bits(imag(%s)))\n",
n,
)
g.printf("data = append(data, buf[:4]...)\n")
case types.Complex128:
g.imps["math"] = 1
g.printf(
"binary.LittleEndian.PutUint64(buf[:8], math.Float64bits(real(%s)))\n",
n,
)
g.printf("data = append(data, buf[:8]...)\n")
g.printf(
"binary.LittleEndian.PutUint64(buf[:8], math.Float64bits(imag(%s)))\n",
n,
)
g.printf("data = append(data, buf[:8]...)\n")
case types.String:
g.printf(
"binary.LittleEndian.PutUint64(buf[:8], uint64(len(%s)))\n",
n,
)
g.printf("data = append(data, buf[:8]...)\n")
g.printf("data = append(data, []byte(%s)...)\n", n)
default:
log.Fatalf("unhandled type: %v (underlying: %v)\n", t, ut)
}
case *types.Struct:
switch t.(type) {
case *types.Named:
g.printf("{\nsub, err := %s.MarshalBinary()\n", n)
g.printf("if err != nil {\nreturn nil, err\n}\n")
g.printf("binary.LittleEndian.PutUint64(buf[:8], uint64(len(sub)))\n")
g.printf("data = append(data, buf[:8]...)\n")
g.printf("data = append(data, sub...)\n")
g.printf("}\n")
default:
// un-named
for i := 0; i < ut.NumFields(); i++ {
elem := ut.Field(i)
g.genMarshalType(elem.Type(), n+"."+elem.Name())
}
}
case *types.Array:
if isByteType(ut.Elem()) {
g.printf("data = append(data, %s[:]...)\n", n)
} else {
g.printf("for i := range %s {\n", n)
if _, ok := ut.Elem().(*types.Pointer); ok {
g.printf("o := %s[i]\n", n)
} else {
g.printf("o := &%s[i]\n", n)
}
g.genMarshalType(ut.Elem(), "o")
g.printf("}\n")
}
case *types.Slice:
g.printf(
"binary.LittleEndian.PutUint64(buf[:8], uint64(len(%s)))\n",
n,
)
g.printf("data = append(data, buf[:8]...)\n")
if isByteType(ut.Elem()) {
g.printf("data = append(data, %s...)\n", n)
} else {
g.printf("for i := range %s {\n", n)
if _, ok := ut.Elem().(*types.Pointer); ok {
g.printf("o := %s[i]\n", n)
} else {
g.printf("o := &%s[i]\n", n)
}
g.genMarshalType(ut.Elem(), "o")
g.printf("}\n")
}
case *types.Pointer:
g.printf("{\n")
g.printf("v := *%s\n", n)
g.genMarshalType(ut.Elem(), "v")
g.printf("}\n")
case *types.Interface:
log.Fatalf("marshal interface not supported (type=%v)\n", t)
default:
log.Fatalf("unhandled type: %v (underlying: %v)\n", t, ut)
}
}
func (g *Generator) genUnmarshal(t types.Type, typeName string) {
g.printf(`// UnmarshalBinary implements encoding.BinaryUnmarshaler
func (o *%[1]s) UnmarshalBinary(data []byte) (err error) {
`,
typeName,
)
typ := t.Underlying().(*types.Struct)
for i := 0; i < typ.NumFields(); i++ {
ft := typ.Field(i)
g.genUnmarshalType(ft.Type(), "o."+ft.Name())
}
g.printf("_ = data\n")
g.printf("return err\n}\n\n")
}
func (g *Generator) genUnmarshalType(t types.Type, n string) {
if types.Implements(t, binUn) || types.Implements(types.NewPointer(t), binUn) {
g.printf("{\n")
g.printf("n := int(binary.LittleEndian.Uint64(data[:8]))\n")
g.printf("data = data[8:]\n")
g.printf("err = %s.UnmarshalBinary(data[:n])\n", n)
g.printf("if err != nil {\nreturn err\n}\n")
g.printf("data = data[n:]\n")
g.printf("}\n")
return
}
tn := types.TypeString(t, types.RelativeTo(g.pkg))
ut := t.Underlying()
switch ut := ut.(type) {
case *types.Basic:
switch kind := ut.Kind(); kind {
case types.Bool:
g.printf("switch data[i] {\ncase 0:\n%s = false\n", n)
g.printf("default:\n%s = true\n}\n", n)
g.printf("data = data[1:]\n")
case types.Uint:
g.printf("%s = %s(binary.LittleEndian.Uint64(data[:8]))\n", n, tn)
g.printf("data = data[8:]\n")
case types.Uint8:
g.printf("%s = %s(data[0])\n", n, tn)
g.printf("data = data[1:]\n")
case types.Uint16:
g.printf("%s = %s(binary.LittleEndian.Uint16(data[:2]))\n", n, tn)
g.printf("data = data[2:]\n")
case types.Uint32:
g.printf("%s = %s(binary.LittleEndian.Uint32(data[:4]))\n", n, tn)
g.printf("data = data[4:]\n")
case types.Uint64:
g.printf("%s = %s(binary.LittleEndian.Uint64(data[:8]))\n", n, tn)
g.printf("data = data[8:]\n")
case types.Int:
g.printf("%s = %s(binary.LittleEndian.Uint64(data[:8]))\n", n, tn)
g.printf("data = data[8:]\n")
case types.Int8:
g.printf("%s = %s(data[0])\n", n, tn)
g.printf("data = data[1:]\n")
case types.Int16:
g.printf("%s = %s(binary.LittleEndian.Uint16(data[:2]))\n", n, tn)
g.printf("data = data[2:]\n")
case types.Int32:
g.printf("%s = %s(binary.LittleEndian.Uint32(data[:4]))\n", n, tn)
g.printf("data = data[4:]\n")
case types.Int64:
g.printf("%s = %s(binary.LittleEndian.Uint64(data[:8]))\n", n, tn)
g.printf("data = data[8:]\n")
case types.Float32:
g.imps["math"] = 1
g.printf("%s = %s(math.Float32frombits(binary.LittleEndian.Uint32(data[:4])))\n", n, tn)
g.printf("data = data[4:]\n")
case types.Float64:
g.imps["math"] = 1
g.printf("%s = %s(math.Float64frombits(binary.LittleEndian.Uint64(data[:8])))\n", n, tn)
g.printf("data = data[8:]\n")
case types.Complex64:
g.imps["math"] = 1
g.printf("%s = %s(complex(math.Float32frombits(binary.LittleEndian.Uint32(data[:4])), math.Float32frombits(binary.LittleEndian.Uint32(data[4:8]))))\n", n, tn)
g.printf("data = data[8:]\n")
case types.Complex128:
g.imps["math"] = 1
g.printf("%s = %s(complex(math.Float64frombits(binary.LittleEndian.Uint64(data[:8])), math.Float64frombits(binary.LittleEndian.Uint64(data[8:16]))))\n", n, tn)
g.printf("data = data[16:]\n")
case types.String:
g.printf("{\n")
g.printf("n := int(binary.LittleEndian.Uint64(data[:8]))\n")
g.printf("data = data[8:]\n")
g.printf("%s = %s(data[:n])\n", n, tn)
g.printf("data = data[n:]\n")
g.printf("}\n")
default:
log.Fatalf("unhandled type: %v (underlying: %v)\n", t, ut)
}
case *types.Struct:
switch t.(type) {
case *types.Named:
g.printf("{\n")
g.printf("n := int(binary.LittleEndian.Uint64(data[:8]))\n")
g.printf("data = data[8:]\n")
g.printf("err = %s.UnmarshalBinary(data[:n])\n", n)
g.printf("if err != nil {\nreturn err\n}\n")
g.printf("data = data[n:]\n")
g.printf("}\n")
default:
// un-named.
for i := 0; i < ut.NumFields(); i++ {
elem := ut.Field(i)
g.genUnmarshalType(elem.Type(), n+"."+elem.Name())
}
}
case *types.Array:
if isByteType(ut.Elem()) {
g.printf("copy(%s[:], data[:n])\n", n)
g.printf("data = data[n:]\n")
} else {
g.printf("for i := range %s {\n", n)
nn := n + "[i]"
if pt, ok := ut.Elem().(*types.Pointer); ok {
g.printf("var oi %s\n", qualTypeName(pt.Elem(), g.pkg))
nn = "oi"
}
if _, ok := ut.Elem().Underlying().(*types.Struct); ok {
g.printf("oi := &%s[i]\n", n)
nn = "oi"
}
g.genUnmarshalType(ut.Elem(), nn)
if _, ok := ut.Elem().(*types.Pointer); ok {
g.printf("%s[i] = oi\n", n)
}
g.printf("}\n")
}
case *types.Slice:
g.printf("{\n")
g.printf("n := int(binary.LittleEndian.Uint64(data[:8]))\n")
g.printf("%[1]s = make([]%[2]s, n)\n", n, qualTypeName(ut.Elem(), g.pkg))
g.printf("data = data[8:]\n")
if isByteType(ut.Elem()) {
g.printf("%[1]s = append(%[1]s, data[:n]...)\n", n)
g.printf("data = data[n:]\n")
} else {
g.printf("for i := range %s {\n", n)
nn := n + "[i]"
if pt, ok := ut.Elem().(*types.Pointer); ok {
g.printf("var oi %s\n", qualTypeName(pt.Elem(), g.pkg))
nn = "oi"
}
if _, ok := ut.Elem().Underlying().(*types.Struct); ok {
g.printf("oi := &%s[i]\n", n)
nn = "oi"
}
g.genUnmarshalType(ut.Elem(), nn)
if _, ok := ut.Elem().(*types.Pointer); ok {
g.printf("%s[i] = oi\n", n)
}
g.printf("}\n")
}
g.printf("}\n")
case *types.Pointer:
g.printf("{\n")
elt := ut.Elem()
g.printf("var v %s\n", qualTypeName(elt, g.pkg))
g.genUnmarshalType(elt, "v")
g.printf("%s = &v\n\n", n)
g.printf("}\n")
case *types.Interface:
log.Fatalf("marshal interface not supported (type=%v)\n", t)
default:
log.Fatalf("unhandled type: %v (underlying: %v)\n", t, ut)
}
}
func isByteType(t types.Type) bool {
b, ok := t.Underlying().(*types.Basic)
if !ok {
return false
}
return b.Kind() == types.Byte
}
func qualTypeName(t types.Type, pkg *types.Package) string {
n := types.TypeString(t, types.RelativeTo(pkg))
i := strings.LastIndex(n, "/")
if i < 0 {
return n
}
return string(n[i+1:])
}
func (g *Generator) Format() ([]byte, error) {
buf := new(bytes.Buffer)
buf.WriteString(fmt.Sprintf(`// DO NOT EDIT; automatically generated by %[1]s
package %[2]s
import (
"encoding/binary"
`,
"brio-gen",
g.pkg.Name(),
))
for k := range g.imps {
fmt.Fprintf(buf, "%q\n", k)
}
fmt.Fprintf(buf, ")\n\n")
buf.Write(g.buf.Bytes())
src, err := format.Source(buf.Bytes())
if err != nil {
log.Printf("=== error ===\n%s\n", buf.Bytes())
}
return src, err
}
func importPkg(p string) (*types.Package, error) {
cfg := &packages.Config{Mode: packages.NeedTypes | packages.NeedTypesInfo | packages.NeedTypesSizes | packages.NeedDeps}
pkgs, err := packages.Load(cfg, p)
if err != nil {
return nil, fmt.Errorf("could not load package %q: %w", p, err)
}
return pkgs[0].Types, nil
}
func init() {
pkg, err := importPkg("encoding")
if err != nil {
log.Fatalf("error finding package \"encoding\": %v\n", err)
}
o := pkg.Scope().Lookup("BinaryMarshaler")
if o == nil {
log.Fatalf("could not find interface encoding.BinaryMarshaler\n")
}
binMa = o.(*types.TypeName).Type().Underlying().(*types.Interface)
o = pkg.Scope().Lookup("BinaryUnmarshaler")
if o == nil {
log.Fatalf("could not find interface encoding.BinaryUnmarshaler\n")
}
binUn = o.(*types.TypeName).Type().Underlying().(*types.Interface)
}
| {
"pile_set_name": "Github"
} |
This is to explore common versioning issues with persisted events when using
event sourcing with ncqrs.
Run CreateEventStore.sql script to your local SQL database. Update the connection
strings when needed.
* AppV1 is the base app, run this first to create a person with an "old" event.
* AppV2 represents a common refactoring change to namespaces but does not alter
the events themselves, only their names.
This is to test that the old events can de-serialize correctly despite the
namespace change.
* AppV3 represents a change to the event, this would be considered a new
version of the event.
This is to ensure that if fields are added and remove convertors can be used
to reformat the old events to match the new event.
NOTE: When changing an event, semantic changes should be a new event, this is
just to ensure ncqrs can handle such changes correctly.
See, http://bloggingabout.net/blogs/vagif/archive/2010/05/28/is-event-versioning-as-costly-as-sql-schema-versioning.aspx | {
"pile_set_name": "Github"
} |
package template
// Test in which replacement has a different type.
const shouldFail = "int is not a safe replacement for string"
func before() interface{} { return "three" }
func after() interface{} { return 3 }
| {
"pile_set_name": "Github"
} |
.my-copyright {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
margin-bottom: 15px;
color: #999999;
font-size: 28px;
text-align: center;
&__link {
display: inline-block;
vertical-align: top;
position: relative;
font-size: 28px;
color: #6190e8;
}
&__text {
padding: 0 0.34em;
font-size: 24px;
}
}
| {
"pile_set_name": "Github"
} |
class Solution {
public List<Integer> topKFrequent(int[] nums, int k) {
// build hash map : character and how often it appears
HashMap<Integer, Integer> count = new HashMap();
for (int n: nums) {
count.put(n, count.getOrDefault(n, 0) + 1);
}
// init heap 'the less frequent element first'
PriorityQueue<Integer> heap =
new PriorityQueue<Integer>((n1, n2) -> count.get(n1) - count.get(n2));
// keep k top frequent elements in the heap
for (int n: count.keySet()) {
heap.add(n);
if (heap.size() > k)
heap.poll();
}
// build output list
List<Integer> top_k = new LinkedList();
while (!heap.isEmpty())
top_k.add(heap.poll());
Collections.reverse(top_k);
return top_k;
}
}
| {
"pile_set_name": "Github"
} |
{
"id": "5541a522-603c-47ad-91fc-a4b1d163081b",
"name": "DotNetCoreCLI",
"friendlyName": ".NET Core",
"description": "Build, test, package, or publish a dotnet application, or run a custom dotnet command",
"author": "Microsoft Corporation",
"helpUrl": "https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli",
"helpMarkDown": "[Learn more about this task](https://go.microsoft.com/fwlink/?linkid=832194) or [see the .NET Core documentation](https://docs.microsoft.com/dotnet/core/)",
"category": "Build",
"visibility": [
"Build",
"Release"
],
"runsOn": [
"Agent"
],
"demands": [],
"version": {
"Major": 2,
"Minor": 175,
"Patch": 0
},
"minimumAgentVersion": "2.115.0",
"instanceNameFormat": "dotnet $(command)",
"groups": [
{
"name": "restoreAuth",
"displayName": "Feeds and authentication",
"isExpanded": true,
"visibleRule": "command = restore"
},
{
"name": "restoreAdvanced",
"displayName": "Advanced",
"isExpanded": false,
"visibleRule": "command = restore"
},
{
"name": "pushAuth",
"displayName": "Destination feed and authentication",
"isExpanded": true,
"visibleRule": "command = push"
},
{
"name": "pushAdvanced",
"displayName": "Advanced",
"isExpanded": false,
"visibleRule": "command = push"
},
{
"name": "packOptions",
"displayName": "Pack options",
"isExpanded": false,
"visibleRule": "command = pack"
},
{
"name": "packAdvanced",
"displayName": "Advanced",
"isExpanded": false,
"visibleRule": "command = pack"
},
{
"name": "generalAdvanced",
"displayName": "Advanced",
"isExpanded": false,
"visibleRule": "command != pack && command != push && command != restore"
}
],
"inputs": [
{
"name": "command",
"type": "pickList",
"label": "Command",
"defaultValue": "build",
"required": true,
"helpMarkDown": "The dotnet command to run. Select 'Custom' to add arguments or use a command not listed here.",
"options": {
"build": "build",
"push": "nuget push",
"pack": "pack",
"publish": "publish",
"restore": "restore",
"run": "run",
"test": "test",
"custom": "custom"
},
"properties": {
"EditableOptions": "False"
}
},
{
"name": "publishWebProjects",
"type": "boolean",
"visibleRule": "command = publish",
"label": "Publish web projects",
"defaultValue": "true",
"required": true,
"helpMarkDown": "If true, the task will try to find the web projects in the repository and run the publish command on them. Web projects are identified by presence of either a web.config file or wwwroot folder in the directory."
},
{
"name": "projects",
"type": "multiLine",
"label": "Path to project(s)",
"defaultValue": "",
"visibleRule": "command = build || command = restore || command = run || command = test || command = custom || publishWebProjects = false",
"required": false,
"helpMarkDown": "The path to the csproj file(s) to use. You can use wildcards (e.g. **/*.csproj for all .csproj files in all subfolders). **This field follows glob pattern, and is run against root of the repository at all times irrespective of Working Directory.**"
},
{
"name": "custom",
"type": "string",
"label": "Custom command",
"defaultValue": "",
"helpMarkDown": "The command to pass to dotnet.exe for execution.",
"required": true,
"visibleRule": "command = custom"
},
{
"name": "arguments",
"type": "string",
"label": "Arguments",
"defaultValue": "",
"visibleRule": "command = build || command = publish || command = run || command = test || command = custom",
"required": false,
"helpMarkDown": "Arguments to the selected command. For example, build configuration, output folder, runtime. The arguments depend on the command selected."
},
{
"name": "restoreArguments",
"type": "string",
"label": "Arguments",
"defaultValue": "",
"visibleRule": "command = restore",
"required": false,
"helpMarkDown": "Write the additional arguments to be passed to **restore** command."
},
{
"name": "publishTestResults",
"type": "boolean",
"label": "Publish test results and code coverage",
"defaultValue": "true",
"visibleRule": "command = test",
"required": false,
"helpMarkDown": "Enabling this option will generate a test results TRX file in `$(Agent.TempDirectory)` and results will be published to the server. <br>This option appends `--logger trx --results-directory $(Agent.TempDirectory)` to the command line arguments. <br><br>Code coverage can be collected by adding `--collect \"Code coverage\"` option to the command line arguments. This is currently only available on the Windows platform."
},
{
"name": "testRunTitle",
"type": "string",
"label": "Test run title",
"defaultValue": "",
"visibleRule": "command = test",
"required": false,
"helpMarkDown": "Provide a name for the test run."
},
{
"name": "zipAfterPublish",
"type": "boolean",
"visibleRule": "command = publish",
"label": "Zip published projects",
"defaultValue": "true",
"required": false,
"helpMarkDown": "If true, folder created by the publish command will be zipped."
},
{
"name": "modifyOutputPath",
"type": "boolean",
"visibleRule": "command = publish",
"label": "Add project's folder name to publish path",
"defaultValue": "true",
"required": false,
"helpMarkDown": "If true, folders created by the publish command will have project's folder name prefixed to their folder names when output path is specified explicitly in arguments. This is useful if you want to publish multiple projects to the same folder."
},
{
"name": "selectOrConfig",
"aliases": [
"feedsToUse"
],
"type": "radio",
"label": "Feeds to use",
"defaultValue": "select",
"helpMarkDown": "You can either select a feed from Azure Artifacts and/or NuGet.org here, or commit a nuget.config file to your source code repository and set its path here.",
"required": "true",
"options": {
"select": "Feed(s) I select here",
"config": "Feeds in my NuGet.config"
},
"groupName": "restoreAuth"
},
{
"name": "feedRestore",
"aliases": [
"vstsFeed"
],
"type": "pickList",
"label": "Use packages from this Azure Artifacts feed",
"defaultValue": "",
"helpMarkDown": "Include the selected feed in the generated NuGet.config. You must have Azure Artifacts installed and licensed to select a feed here.",
"required": "false",
"groupName": "restoreAuth",
"visibleRule": "selectOrConfig = select",
"properties": {
"EditableOptions": "True"
}
},
{
"name": "includeNuGetOrg",
"type": "boolean",
"label": "Use packages from NuGet.org",
"defaultValue": "true",
"helpMarkDown": "Include NuGet.org in the generated NuGet.config.",
"required": "false",
"groupName": "restoreAuth",
"visibleRule": "selectOrConfig = select"
},
{
"name": "nugetConfigPath",
"type": "filePath",
"label": "Path to NuGet.config",
"defaultValue": "",
"helpMarkDown": "The NuGet.config in your repository that specifies the feeds from which to restore packages.",
"required": "false",
"groupName": "restoreAuth",
"visibleRule": "selectOrConfig = config"
},
{
"name": "externalEndpoints",
"aliases": [
"externalFeedCredentials"
],
"type": "connectedService:ExternalNuGetFeed",
"label": "Credentials for feeds outside this organization/collection",
"required": false,
"helpMarkDown": "Credentials to use for external registries located in the selected NuGet.config. For feeds in this organization/collection, leave this blank; the build’s credentials are used automatically.",
"properties": {
"EditableOptions": "False",
"MultiSelectFlatList": "True"
},
"groupName": "restoreAuth",
"visibleRule": "selectOrConfig = config"
},
{
"name": "noCache",
"type": "boolean",
"label": "Disable local cache",
"defaultValue": "false",
"helpMarkDown": "Prevents NuGet from using packages from local machine caches.",
"required": "false",
"groupName": "restoreAdvanced"
},
{
"name": "packagesDirectory",
"aliases": [
"restoreDirectory"
],
"type": "string",
"label": "Destination directory",
"defaultValue": "",
"helpMarkDown": "Specifies the folder in which packages are installed. If no folder is specified, packages are restored into the default NuGet package cache.",
"required": "false",
"groupName": "restoreAdvanced"
},
{
"name": "verbosityRestore",
"type": "pickList",
"label": "Verbosity",
"defaultValue": "Detailed",
"helpMarkDown": "Specifies the amount of detail displayed in the output.",
"required": "false",
"groupName": "restoreAdvanced",
"options": {
"-": "-",
"Quiet": "Quiet",
"Minimal": "Minimal",
"Normal": "Normal",
"Detailed": "Detailed",
"Diagnostic": "Diagnostic"
}
},
{
"name": "searchPatternPush",
"aliases": [
"packagesToPush"
],
"type": "filePath",
"label": "Path to NuGet package(s) to publish",
"defaultValue": "$(Build.ArtifactStagingDirectory)/*.nupkg",
"helpMarkDown": "The pattern to match or path to nupkg files to be uploaded. Multiple patterns can be separated by a semicolon.",
"required": true,
"visibleRule": "command = push"
},
{
"name": "nuGetFeedType",
"type": "radio",
"label": "Target feed location",
"required": true,
"defaultValue": "internal",
"options": {
"internal": "This organization/collection",
"external": "External NuGet server (including other organizations/collections)"
},
"visibleRule": "command = push"
},
{
"name": "feedPublish",
"aliases": [
"publishVstsFeed"
],
"type": "pickList",
"label": "Target feed",
"defaultValue": "",
"required": true,
"helpMarkDown": "Select a feed hosted in this organization. You must have Azure Artifacts installed and licensed to select a feed here.",
"visibleRule": "command = push && nuGetFeedType = internal"
},
{
"name": "publishPackageMetadata",
"groupName": "pushAdvanced",
"type": "boolean",
"label": "Publish pipeline metadata",
"defaultValue": true,
"helpMarkDown": "Associate this build/release pipeline’s metadata (run #, source code information) with the package",
"visibleRule": "command = push && nuGetFeedType = internal"
},
{
"name": "externalEndpoint",
"aliases": [
"publishFeedCredentials"
],
"type": "connectedService:ExternalNuGetFeed",
"label": "NuGet server",
"required": true,
"helpMarkDown": "The NuGet service connection that contains the external NuGet server’s credentials.",
"visibleRule": "command = push && nuGetFeedType = external"
},
{
"name": "searchPatternPack",
"aliases": [
"packagesToPack"
],
"type": "filePath",
"label": "Path to csproj or nuspec file(s) to pack",
"defaultValue": "**/*.csproj",
"helpMarkDown": "Pattern to search for csproj or nuspec files to pack.\n\nYou can separate multiple patterns with a semicolon, and you can make a pattern negative by prefixing it with '!'. Example: `**/*.csproj;!**/*.Tests.csproj`",
"required": true,
"visibleRule": "command = pack"
},
{
"name": "configurationToPack",
"aliases": [
"configuration"
],
"type": "string",
"label": "Configuration to Package",
"defaultValue": "$(BuildConfiguration)",
"helpMarkDown": "When using a csproj file this specifies the configuration to package",
"required": false,
"visibleRule": "command = pack"
},
{
"name": "outputDir",
"aliases": [
"packDirectory"
],
"type": "filePath",
"label": "Package Folder",
"defaultValue": "$(Build.ArtifactStagingDirectory)",
"helpMarkDown": "Folder where packages will be created. If empty, packages will be created alongside the csproj file.",
"required": false,
"visibleRule": "command = pack"
},
{
"name": "nobuild",
"type": "boolean",
"label": "Do not build",
"defaultValue": "false",
"helpMarkDown": "Don't build the project before packing. Corresponds to the --no-build command line parameter.",
"required": false,
"visibleRule": "command = pack"
},
{
"name": "includesymbols",
"type": "boolean",
"label": "Include Symbols",
"defaultValue": "false",
"helpMarkDown": "Additionally creates symbol NuGet packages. Corresponds to the --include-symbols command line parameter.",
"required": false,
"visibleRule": "command = pack"
},
{
"name": "includesource",
"type": "boolean",
"label": "Include Source",
"defaultValue": "false",
"helpMarkDown": "Includes source code in the package. Corresponds to the --include-source command line parameter.",
"required": false,
"visibleRule": "command = pack"
},
{
"name": "versioningScheme",
"type": "pickList",
"label": "Automatic package versioning",
"defaultValue": "off",
"helpMarkDown": "Cannot be used with include referenced projects. If you choose 'Use the date and time', this will generate a [SemVer](http://semver.org/spec/v1.0.0.html)-compliant version formatted as `X.Y.Z-ci-datetime` where you choose X, Y, and Z.\n\nIf you choose 'Use an environment variable', you must select an environment variable and ensure it contains the version number you want to use.\n\nIf you choose 'Use the build number', this will use the build number to version your package. **Note:** Under Options set the build number format to be '[$(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)](https://go.microsoft.com/fwlink/?LinkID=627416)'.",
"required": true,
"groupName": "packOptions",
"options": {
"off": "Off",
"byPrereleaseNumber": "Use the date and time",
"byEnvVar": "Use an environment variable",
"byBuildNumber": "Use the build number"
}
},
{
"name": "versionEnvVar",
"type": "string",
"label": "Environment variable",
"defaultValue": "",
"helpMarkDown": "Enter the variable name without $, $env, or %.",
"required": true,
"groupName": "packOptions",
"visibleRule": "versioningScheme = byEnvVar"
},
{
"name": "requestedMajorVersion",
"aliases": [
"majorVersion"
],
"type": "string",
"label": "Major",
"defaultValue": "1",
"helpMarkDown": "The 'X' in version [X.Y.Z](http://semver.org/spec/v1.0.0.html)",
"required": true,
"groupName": "packOptions",
"visibleRule": "versioningScheme = byPrereleaseNumber"
},
{
"name": "requestedMinorVersion",
"aliases": [
"minorVersion"
],
"type": "string",
"label": "Minor",
"defaultValue": "0",
"helpMarkDown": "The 'Y' in version [X.Y.Z](http://semver.org/spec/v1.0.0.html)",
"required": true,
"groupName": "packOptions",
"visibleRule": "versioningScheme = byPrereleaseNumber"
},
{
"name": "requestedPatchVersion",
"aliases": [
"patchVersion"
],
"type": "string",
"label": "Patch",
"defaultValue": "0",
"helpMarkDown": "The 'Z' in version [X.Y.Z](http://semver.org/spec/v1.0.0.html)",
"required": true,
"groupName": "packOptions",
"visibleRule": "versioningScheme = byPrereleaseNumber"
},
{
"name": "buildProperties",
"type": "string",
"label": "Additional build properties",
"defaultValue": "",
"required": false,
"helpMarkDown": "Specifies a list of token = value pairs, separated by semicolons, where each occurrence of $token$ in the .nuspec file will be replaced with the given value. Values can be strings in quotation marks.",
"groupName": "packAdvanced"
},
{
"name": "verbosityPack",
"type": "pickList",
"label": "Verbosity",
"defaultValue": "Detailed",
"helpMarkDown": "Specifies the amount of detail displayed in the output.",
"required": "false",
"groupName": "packAdvanced",
"options": {
"-": "-",
"Quiet": "Quiet",
"Minimal": "Minimal",
"Normal": "Normal",
"Detailed": "Detailed",
"Diagnostic": "Diagnostic"
}
},
{
"name": "workingDirectory",
"type": "filePath",
"label": "Working directory",
"helpMarkDown": "Current working directory where the script is run. Empty is the root of the repo (build) or artifacts (release), which is $(System.DefaultWorkingDirectory). The project search pattern is **NOT** relative to working directory.",
"required": "false",
"groupName": "generalAdvanced",
"visibleRule": "command != restore && command != push && command != pack"
}
],
"dataSourceBindings": [
{
"target": "feedRestore",
"endpointId": "tfs:feed",
"endpointUrl": "{{endpoint.url}}/_apis/packaging/feeds",
"resultSelector": "jsonpath:$.value[*]",
"resultTemplate": "{ \"Value\" : \"{{#if project}}{{{project.id}}}\\/{{/if}}{{{id}}}\", \"DisplayValue\" : \"{{{name}}}\" }"
},
{
"target": "feedPublish",
"endpointId": "tfs:feed",
"endpointUrl": "{{endpoint.url}}/_apis/packaging/feeds",
"resultSelector": "jsonpath:$.value[*]",
"resultTemplate": "{ \"Value\" : \"{{#if project}}{{{project.id}}}\\/{{/if}}{{{id}}}\", \"DisplayValue\" : \"{{{name}}}\" }"
}
],
"execution": {
"Node": {
"target": "dotnetcore.js",
"argumentFormat": ""
}
},
"messages": {
"BuildIdentityPermissionsHint": "For internal feeds, make sure the build service identity '%s' [%s] has access to the feed.",
"CouldNotSetCodePaging": "Could not set the code paging of due to following error: %s",
"Error_AutomaticallyVersionReleases": "Autoversion: Getting version number from build option is not supported in releases",
"Error_CommandNotRecognized": "The command %s was not recognized.",
"Error_NoSourceSpecifiedForPush": "No source was specified for push",
"Error_NoValueFoundForEnvVar": "No value was found for the provided environment variable.",
"Error_NoVersionFoundInBuildNumber": "Could not find version number data in the following environment variable: BUILD_BUILDNUMBER. The value of the variable should contain a substring with the following formats: X.Y.Z or X.Y.Z.A where A, X, Y, and Z are positive integers.",
"Error_PackageFailure": "An error occurred while trying to pack the files.",
"Error_PushNotARegularFile": "%s is not a file. Check the 'Path/Pattern to nupkg' property of the task.",
"Info_AttemptingToPackFile": "Attempting to pack file: ",
"Info_NoPackagesMatchedTheSearchPattern": "No packages matched the search pattern.",
"Info_NoFilesMatchedTheSearchPattern": "No files matched the search pattern.",
"PackagesFailedToInstall": "Packages failed to restore",
"PackagesFailedToPublish": "Packages failed to publish",
"PackagesInstalledSuccessfully": "Packages were restored successfully",
"PackagesPublishedSuccessfully": "Packages were published successfully",
"UnknownFeedType": "Unknown feed type '%s'",
"Warning_AutomaticallyVersionReferencedProjects": "The automatic package versioning and include referenced projects options do not work together. Referenced projects will not inherit the custom version provided by the automatic versioning settings.",
"Warning_MoreThanOneVersionInBuildNumber": "Found more than one instance of version data in BUILD_BUILDNUMBER.Assuming first instance is version.",
"dotnetCommandFailed": "Dotnet command failed with non-zero exit code on the following projects : %s",
"noProjectFilesFound": "Project file(s) matching the specified pattern were not found.",
"noPublishFolderFoundToZip": "A publish folder could not be found to zip for project file: %s.",
"noWebProjectFound": "No web project was found in the repository. Web projects are identified by presence of either a web.config file, wwwroot folder in the directory, or by the usage of Microsoft.Net.Web.Sdk in your project file. You can set Publish web projects property to false (publishWebProjects: false in yml) if your project doesn't follow this convention or if you want to publish projects other than web projects.",
"zipFailed": "Zip failed with error: %s",
"Error_ApiKeyNotSupported": "DotNetCore currently does not support using an encrypted Api Key.",
"Error_ExpectedConfigurationElement": "Invalid xml. Expected element named 'configuration'.",
"Error_NoMatchingFilesFoundForPattern": "No matching files were found with search pattern: %s",
"Error_NoUrlWasFoundWhichMatches": "No download URL was found for %s",
"Error_NoVersionWasFoundWhichMatches": "No version was found which matches the input %s",
"Error_NuGetToolInstallerFailer": "Tool install failed: %s",
"Info_AvailableVersions": "The available versions are: %s",
"Info_ExpectBehaviorChangeWhenUsingVersionQuery": "You are using a query match on the version string. Behavior changes or breaking changes might occur as NuGet updates to a new version.",
"Info_MatchingUrlWasFoundSettingAuth": "Using authentication information for the following URI: ",
"Info_ResolvedToolFromCache": "Resolved from tool cache: %s",
"Info_SavingTempConfig": "Saving NuGet.config to a temporary config file.",
"Info_UsingToolPath": "Using tool path: %s",
"Info_UsingVersion": "Using version: %s",
"NGCommon_AddingSources": "Setting credentials in NuGet.config",
"NGCommon_AreaNotFoundInSps": "Unable to locate the '%s' [%s] area. The service containing that area may not be available in your region.",
"NGCommon_DetectedNuGetExtensionsPath": "Detected NuGet extensions loader path (NUGET_EXTENSIONS_PATH environment variable): %s",
"NGCommon_DetectedNuGetVersion": "Detected NuGet version %s / %s",
"NGCommon_IgnoringNuGetExtensionsPath": "Detected NuGet extensions loader path (NUGET_EXTENSIONS_PATH environment variable). Extensions are ignored when using the built-in NuGet client",
"NGCommon_NoSourcesFoundInConfig": "No package sources were found in the NuGet.config file at %s",
"NGCommon_NuGetConfigIsInvalid": "The NuGet.config at %s is invalid.",
"NGCommon_NuGetConfigIsPackagesConfig": "Expected a NuGet.config file at %s, but its contents appear to be a packages.config. Check the settings for the %s task and confirm you selected NuGet.config rather than packages.config.",
"NGCommon_RemovingSources": "Preparing to set credentials in NuGet.config",
"NGCommon_SpsNotFound": "Unable to find the '%s' [%s] area. There may be a problem with your Team Foundation Server installation.",
"NGCommon_UnabletoDetectNuGetVersion": "Unknown NuGet version selected.",
"NGCommon_UnableToFindTool": "Unable to find tool %s",
"Warning_SessionCreationFailed": "Could not create provenance session: %s",
"Warning_UpdatingNuGetVersion": "Updating version of NuGet.exe to %s from %s. Behavior changes or breaking changes might occur as NuGet updates to a new version. If this is not desired, deselect the 'Check for Latest Version' option in the task.",
"NetCore3Update": "Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x (3.1) SDK/Runtime along with 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions. \nSome commonly encountered changes are: \nIf you're using `Publish` command with -o or --Output argument, you will see that the output folder is now being created at root directory rather than Project File's directory. To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting",
"DeprecatedDotnet2_2_And_3_0": "Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version."
}
}
| {
"pile_set_name": "Github"
} |
// +build codegen
package api
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNonHTMLDocGen(t *testing.T) {
doc := "Testing 1 2 3"
expected := "// Testing 1 2 3\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
func TestListsHTMLDocGen(t *testing.T) {
doc := "<ul><li>Testing 1 2 3</li> <li>FooBar</li></ul>"
expected := "// * Testing 1 2 3\n// * FooBar\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
doc = "<ul> <li>Testing 1 2 3</li> <li>FooBar</li> </ul>"
expected = "// * Testing 1 2 3\n// * FooBar\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
// Test leading spaces
doc = " <ul> <li>Testing 1 2 3</li> <li>FooBar</li> </ul>"
doc = docstring(doc)
assert.Equal(t, expected, doc)
// Paragraph check
doc = "<ul> <li> <p>Testing 1 2 3</p> </li><li> <p>FooBar</p></li></ul>"
expected = "// * Testing 1 2 3\n// \n// * FooBar\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
func TestInlineCodeHTMLDocGen(t *testing.T) {
doc := "<ul> <li><code>Testing</code>: 1 2 3</li> <li>FooBar</li> </ul>"
expected := "// * Testing: 1 2 3\n// * FooBar\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
func TestInlineCodeInParagraphHTMLDocGen(t *testing.T) {
doc := "<p><code>Testing</code>: 1 2 3</p>"
expected := "// Testing: 1 2 3\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
func TestEmptyPREInlineCodeHTMLDocGen(t *testing.T) {
doc := "<pre><code>Testing</code></pre>"
expected := "// Testing\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
func TestParagraph(t *testing.T) {
doc := "<p>Testing 1 2 3</p>"
expected := "// Testing 1 2 3\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
func TestComplexListParagraphCode(t *testing.T) {
doc := "<ul> <li><p><code>FOO</code> Bar</p></li><li><p><code>Xyz</code> ABC</p></li></ul>"
expected := "// * FOO Bar\n// \n// * Xyz ABC\n"
doc = docstring(doc)
assert.Equal(t, expected, doc)
}
| {
"pile_set_name": "Github"
} |
package ioprogress
import (
"io"
"time"
)
// Reader is an implementation of io.Reader that draws the progress of
// reading some data.
type Reader struct {
// Reader is the underlying reader to read from
Reader io.Reader
// Size is the total size of the data coming out of the reader.
Size int64
// DrawFunc is the callback to invoke to draw the progress bar. By
// default, this will be DrawTerminal(os.Stdout).
//
// DrawInterval is the minimum time to wait between reads to update the
// progress bar.
DrawFunc DrawFunc
DrawInterval time.Duration
progress int64
lastDraw time.Time
}
// Read reads from the underlying reader and invokes the DrawFunc if
// appropriate. The DrawFunc is executed when there is data that is
// read (progress is made) and at least DrawInterval time has passed.
func (r *Reader) Read(p []byte) (int, error) {
// If we haven't drawn before, initialize the progress bar
if r.lastDraw.IsZero() {
r.initProgress()
}
// Read from the underlying source
n, err := r.Reader.Read(p)
// Always increment the progress even if there was an error
r.progress += int64(n)
// If we don't have any errors, then draw the progress. If we are
// at the end of the data, then finish the progress.
if err == nil {
// Only draw if we read data or we've never read data before (to
// initialize the progress bar).
if n > 0 {
r.drawProgress()
}
}
if err == io.EOF {
r.finishProgress()
}
return n, err
}
func (r *Reader) drawProgress() {
// If we've drawn before, then make sure that the draw interval
// has passed before we draw again.
interval := r.DrawInterval
if interval == 0 {
interval = time.Second
}
if !r.lastDraw.IsZero() {
nextDraw := r.lastDraw.Add(interval)
if time.Now().Before(nextDraw) {
return
}
}
// Draw
f := r.drawFunc()
f(r.progress, r.Size)
// Record this draw so that we don't draw again really quickly
r.lastDraw = time.Now()
}
func (r *Reader) finishProgress() {
f := r.drawFunc()
f(r.progress, r.Size)
// Print a newline
f(-1, -1)
// Reset lastDraw so we don't finish again
var zeroDraw time.Time
r.lastDraw = zeroDraw
}
func (r *Reader) initProgress() {
var zeroDraw time.Time
r.lastDraw = zeroDraw
r.drawProgress()
r.lastDraw = zeroDraw
}
func (r *Reader) drawFunc() DrawFunc {
if r.DrawFunc == nil {
return defaultDrawFunc
}
return r.DrawFunc
}
| {
"pile_set_name": "Github"
} |
#include "cs.h"
/* compute the etree of A (using triu(A), or A'A without forming A'A */
csi *cs_etree (const cs *A, csi ata)
{
csi i, k, p, m, n, inext, *Ap, *Ai, *w, *parent, *ancestor, *prev ;
if (!CS_CSC (A)) return (NULL) ; /* check inputs */
m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ;
parent = cs_malloc (n, sizeof (csi)) ; /* allocate result */
w = cs_malloc (n + (ata ? m : 0), sizeof (csi)) ; /* get workspace */
if (!w || !parent) return (cs_idone (parent, NULL, w, 0)) ;
ancestor = w ; prev = w + n ;
if (ata) for (i = 0 ; i < m ; i++) prev [i] = -1 ;
for (k = 0 ; k < n ; k++)
{
parent [k] = -1 ; /* node k has no parent yet */
ancestor [k] = -1 ; /* nor does k have an ancestor */
for (p = Ap [k] ; p < Ap [k+1] ; p++)
{
i = ata ? (prev [Ai [p]]) : (Ai [p]) ;
for ( ; i != -1 && i < k ; i = inext) /* traverse from i to k */
{
inext = ancestor [i] ; /* inext = ancestor of i */
ancestor [i] = k ; /* path compression */
if (inext == -1) parent [i] = k ; /* no anc., parent is k */
}
if (ata) prev [Ai [p]] = k ;
}
}
return (cs_idone (parent, NULL, w, 1)) ;
}
| {
"pile_set_name": "Github"
} |
/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
/*This file is prepared for Doxygen automatic documentation generation.*/
/*! \file *********************************************************************
*
* \brief Strings and integers print module for debug purposes.
*
* - Compiler: IAR EWAVR32 and GNU GCC for AVR32
* - Supported devices: All AVR32 devices with a USART module can be used.
*
* \author Atmel Corporation: http://www.atmel.com \n
* Support and FAQ: http://support.atmel.no/
*
******************************************************************************/
/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an Atmel
* AVR product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*
*/
#ifndef _PRINT_FUNCS_H_
#define _PRINT_FUNCS_H_
#include <avr32/io.h>
#include "board.h"
/*! \name USART Settings for the Debug Module
*/
//! @{
#if BOARD == EVK1100
# define DBG_USART (&AVR32_USART1)
# define DBG_USART_RX_PIN AVR32_USART1_RXD_0_0_PIN
# define DBG_USART_RX_FUNCTION AVR32_USART1_RXD_0_0_FUNCTION
# define DBG_USART_TX_PIN AVR32_USART1_TXD_0_0_PIN
# define DBG_USART_TX_FUNCTION AVR32_USART1_TXD_0_0_FUNCTION
# define DBG_USART_BAUDRATE 57600
#elif BOARD == EVK1101
# define DBG_USART (&AVR32_USART1)
# define DBG_USART_RX_PIN AVR32_USART1_RXD_0_0_PIN
# define DBG_USART_RX_FUNCTION AVR32_USART1_RXD_0_0_FUNCTION
# define DBG_USART_TX_PIN AVR32_USART1_TXD_0_0_PIN
# define DBG_USART_TX_FUNCTION AVR32_USART1_TXD_0_0_FUNCTION
# define DBG_USART_BAUDRATE 57600
#elif BOARD == UC3C_EK
# define DBG_USART (&AVR32_USART2)
# define DBG_USART_RX_PIN AVR32_USART2_RXD_0_1_PIN
# define DBG_USART_RX_FUNCTION AVR32_USART2_RXD_0_1_FUNCTION
# define DBG_USART_TX_PIN AVR32_USART2_TXD_0_1_PIN
# define DBG_USART_TX_FUNCTION AVR32_USART2_TXD_0_1_FUNCTION
# define DBG_USART_BAUDRATE 57600
#elif BOARD == EVK1104
# define DBG_USART (&AVR32_USART1)
# define DBG_USART_RX_PIN AVR32_USART1_RXD_0_0_PIN
# define DBG_USART_RX_FUNCTION AVR32_USART1_RXD_0_0_FUNCTION
# define DBG_USART_TX_PIN AVR32_USART1_TXD_0_0_PIN
# define DBG_USART_TX_FUNCTION AVR32_USART1_TXD_0_0_FUNCTION
# define DBG_USART_BAUDRATE 57600
#elif BOARD == EVK1105
# define DBG_USART (&AVR32_USART0)
# define DBG_USART_RX_PIN AVR32_USART0_RXD_0_0_PIN
# define DBG_USART_RX_FUNCTION AVR32_USART0_RXD_0_0_FUNCTION
# define DBG_USART_TX_PIN AVR32_USART0_TXD_0_0_PIN
# define DBG_USART_TX_FUNCTION AVR32_USART0_TXD_0_0_FUNCTION
# define DBG_USART_BAUDRATE 57600
#elif BOARD == STK1000
# define DBG_USART (&AVR32_USART1)
# define DBG_USART_RX_PIN AVR32_USART1_RXD_0_PIN
# define DBG_USART_RX_FUNCTION AVR32_USART1_RXD_0_FUNCTION
# define DBG_USART_TX_PIN AVR32_USART1_TXD_0_PIN
# define DBG_USART_TX_FUNCTION AVR32_USART1_TXD_0_FUNCTION
# define DBG_USART_BAUDRATE 115200
#elif BOARD == NGW100
# define DBG_USART (&AVR32_USART1)
# define DBG_USART_RX_PIN AVR32_USART1_RXD_0_PIN
# define DBG_USART_RX_FUNCTION AVR32_USART1_RXD_0_FUNCTION
# define DBG_USART_TX_PIN AVR32_USART1_TXD_0_PIN
# define DBG_USART_TX_FUNCTION AVR32_USART1_TXD_0_FUNCTION
# define DBG_USART_BAUDRATE 115200
#elif BOARD == STK600_RCUC3L0
# define DBG_USART (&AVR32_USART1)
# define DBG_USART_RX_PIN AVR32_USART1_RXD_0_1_PIN
# define DBG_USART_RX_FUNCTION AVR32_USART1_RXD_0_1_FUNCTION
// For the RX pin, connect STK600.PORTE.PE3 to STK600.RS232 SPARE.RXD
# define DBG_USART_TX_PIN AVR32_USART1_TXD_0_1_PIN
# define DBG_USART_TX_FUNCTION AVR32_USART1_TXD_0_1_FUNCTION
// For the TX pin, connect STK600.PORTE.PE2 to STK600.RS232 SPARE.TXD
# define DBG_USART_BAUDRATE 57600
# define DBG_USART_CLOCK_MASK AVR32_USART1_CLK_PBA
#elif BOARD == UC3L_EK
# define DBG_USART (&AVR32_USART3)
# define DBG_USART_RX_PIN AVR32_USART3_RXD_0_0_PIN
# define DBG_USART_RX_FUNCTION AVR32_USART3_RXD_0_0_FUNCTION
# define DBG_USART_TX_PIN AVR32_USART3_TXD_0_0_PIN
# define DBG_USART_TX_FUNCTION AVR32_USART3_TXD_0_0_FUNCTION
# define DBG_USART_BAUDRATE 57600
# define DBG_USART_CLOCK_MASK AVR32_USART3_CLK_PBA
#elif BOARD == ARDUINO
# define DBG_USART (&AVR32_USART1)
# define DBG_USART_RX_PIN AVR32_USART1_RXD_0_0_PIN
# define DBG_USART_RX_FUNCTION AVR32_USART1_RXD_0_0_FUNCTION
# define DBG_USART_TX_PIN AVR32_USART1_TXD_0_0_PIN
# define DBG_USART_TX_FUNCTION AVR32_USART1_TXD_0_0_FUNCTION
# define DBG_USART_BAUDRATE 57600
# define DBG_USART_CLOCK_MASK AVR32_USART1_CLK_PBA
#endif
#if !defined(DBG_USART) || \
!defined(DBG_USART_RX_PIN) || \
!defined(DBG_USART_RX_FUNCTION) || \
!defined(DBG_USART_TX_PIN) || \
!defined(DBG_USART_TX_FUNCTION) || \
!defined(DBG_USART_BAUDRATE)
# error The USART configuration to use for debug on your board is missing
#endif
//! @}
/*! \name VT100 Common Commands
*/
//! @{
#define CLEARSCR "\x1B[2J\x1B[;H" //!< Clear screen.
#define CLEAREOL "\x1B[K" //!< Clear end of line.
#define CLEAREOS "\x1B[J" //!< Clear end of screen.
#define CLEARLCR "\x1B[0K" //!< Clear line cursor right.
#define CLEARLCL "\x1B[1K" //!< Clear line cursor left.
#define CLEARELN "\x1B[2K" //!< Clear entire line.
#define CLEARCDW "\x1B[0J" //!< Clear cursor down.
#define CLEARCUP "\x1B[1J" //!< Clear cursor up.
#define GOTOYX "\x1B[%.2d;%.2dH" //!< Set cursor to (y, x).
#define INSERTMOD "\x1B[4h" //!< Insert mode.
#define OVERWRITEMOD "\x1B[4l" //!< Overwrite mode.
#define DELAFCURSOR "\x1B[K" //!< Erase from cursor to end of line.
#define CRLF "\r\n" //!< Carriage Return + Line Feed.
//! @}
/*! \name VT100 Cursor Commands
*/
//! @{
#define CURSON "\x1B[?25h" //!< Show cursor.
#define CURSOFF "\x1B[?25l" //!< Hide cursor.
//! @}
/*! \name VT100 Character Commands
*/
//! @{
#define NORMAL "\x1B[0m" //!< Normal.
#define BOLD "\x1B[1m" //!< Bold.
#define UNDERLINE "\x1B[4m" //!< Underline.
#define BLINKING "\x1B[5m" //!< Blink.
#define INVVIDEO "\x1B[7m" //!< Inverse video.
//! @}
/*! \name VT100 Color Commands
*/
//! @{
#define CL_BLACK "\033[22;30m" //!< Black.
#define CL_RED "\033[22;31m" //!< Red.
#define CL_GREEN "\033[22;32m" //!< Green.
#define CL_BROWN "\033[22;33m" //!< Brown.
#define CL_BLUE "\033[22;34m" //!< Blue.
#define CL_MAGENTA "\033[22;35m" //!< Magenta.
#define CL_CYAN "\033[22;36m" //!< Cyan.
#define CL_GRAY "\033[22;37m" //!< Gray.
#define CL_DARKGRAY "\033[01;30m" //!< Dark gray.
#define CL_LIGHTRED "\033[01;31m" //!< Light red.
#define CL_LIGHTGREEN "\033[01;32m" //!< Light green.
#define CL_YELLOW "\033[01;33m" //!< Yellow.
#define CL_LIGHTBLUE "\033[01;34m" //!< Light blue.
#define CL_LIGHTMAGENTA "\033[01;35m" //!< Light magenta.
#define CL_LIGHTCYAN "\033[01;36m" //!< Light cyan.
#define CL_WHITE "\033[01;37m" //!< White.
//! @}
/*! \brief Sets up DBG_USART with 8N1 at DBG_USART_BAUDRATE.
*
* \param pba_hz PBA clock frequency (Hz).
*/
extern void init_dbg_rs232(long pba_hz);
/*! \brief Sets up DBG_USART with 8N1 at a given baud rate.
*
* \param baudrate Baud rate to set DBG_USART to.
* \param pba_hz PBA clock frequency (Hz).
*/
extern void init_dbg_rs232_ex(unsigned long baudrate, long pba_hz);
/*! \brief Prints a string of characters to DBG_USART.
*
* \param str The string of characters to print.
*/
extern void print_dbg(const char *str);
/*! \brief Prints a character to DBG_USART.
*
* \param c The character to print.
*/
extern void print_dbg_char(int c);
/*! \brief Prints an integer to DBG_USART in a decimal representation.
*
* \param n The integer to print.
*/
extern void print_dbg_ulong(unsigned long n);
/*! \brief Prints a char to DBG_USART in an hexadecimal representation.
*
* \param n The char to print.
*/
extern void print_dbg_char_hex(unsigned char n);
/*! \brief Prints a short integer to DBG_USART in an hexadecimal representation.
*
* \param n The short integer to print.
*/
extern void print_dbg_short_hex(unsigned short n);
/*! \brief Prints an integer to DBG_USART in an hexadecimal representation.
*
* \param n The integer to print.
*/
extern void print_dbg_hex(unsigned long n);
/*! \brief Prints a string of characters to a given USART.
*
* \param usart Base address of the USART instance to print to.
* \param str The string of characters to print.
*/
extern void print(volatile avr32_usart_t *usart, const char *str);
/*! \brief Prints a character to a given USART.
*
* \param usart Base address of the USART instance to print to.
* \param c The character to print.
*/
extern void print_char(volatile avr32_usart_t *usart, int c);
/*! \brief Prints an integer to a given USART in a decimal representation.
*
* \param usart Base address of the USART instance to print to.
* \param n The integer to print.
*/
extern void print_ulong(volatile avr32_usart_t *usart, unsigned long n);
/*! \brief Prints a char to a given USART in an hexadecimal representation.
*
* \param usart Base address of the USART instance to print to.
* \param n The char to print.
*/
extern void print_char_hex(volatile avr32_usart_t *usart, unsigned char n);
/*! \brief Prints a short integer to a given USART in an hexadecimal
* representation.
*
* \param usart Base address of the USART instance to print to.
* \param n The short integer to print.
*/
extern void print_short_hex(volatile avr32_usart_t *usart, unsigned short n);
/*! \brief Prints an integer to a given USART in an hexadecimal representation.
*
* \param usart Base address of the USART instance to print to.
* \param n The integer to print.
*/
extern void print_hex(volatile avr32_usart_t *usart, unsigned long n);
#endif // _PRINT_FUNCS_H_
| {
"pile_set_name": "Github"
} |
import * as WS from 'ws';
import * as url from 'url';
import { Server as HttpServer } from 'http';
export type IWebsocketVerifyClient = (info: {origin: any, secure: any, req: any}, cb: (done: boolean) => any) => any;
export class WebsocketInstance {
instance: WS.Server;
constructor(verifyClient?: IWebsocketVerifyClient) {
this.instance = new WS.Server({
noServer: true,
verifyClient: (info, cb) => {
if (verifyClient) {
return verifyClient(info, cb);
} else {
return cb(true);
}
}
});
}
broadcast(data) {
return this.instance
.clients
.forEach(client => {
if (client.readyState == WS.OPEN) {
client.send(JSON.stringify(data, null, 2));
}
});
}
}
export class WebsocketServers {
servers: {[path: string]: WebsocketInstance} = {};
constructor(private httpServer: HttpServer) {
this.httpServer.on('upgrade', (request, socket, head) => {
const urlParsed = url.parse(request.url);
const pathname = urlParsed.pathname;
if (this.servers[pathname] && this.servers[pathname].instance) {
this.servers[pathname].instance.handleUpgrade(request, socket, head, ws => {
this.servers[pathname].instance.emit('connection', ws, request);
});
}
});
}
get(endpoint: string) {
return this.servers[endpoint];
}
register(endpoint: string, verifyClient?: IWebsocketVerifyClient): WebsocketInstance {
this.servers[endpoint] = new WebsocketInstance(verifyClient);
return this.servers[endpoint];
}
close() {
Object.keys(this.servers).forEach(path => {
this.servers[path].instance.clients.forEach(client =>
client.terminate()
);
});
}
} | {
"pile_set_name": "Github"
} |
/*
* This file is part of Openrouteservice.
*
* Openrouteservice is free software; you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library;
* if not, see <https://www.gnu.org/licenses/>.
*/
package org.heigit.ors.api.requests.common;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonValue;
import org.heigit.ors.exceptions.ParameterValueException;
import io.swagger.annotations.ApiModel;
import static org.heigit.ors.api.errors.GenericErrorCodes.INVALID_PARAMETER_VALUE;
public class APIEnums {
@ApiModel(value = "Specify which type of border crossing to avoid")
public enum AvoidBorders {
ALL("all"),
CONTROLLED("controlled"),
NONE("none");
private final String value;
AvoidBorders(String value) {
this.value = value;
}
@JsonCreator
public static AvoidBorders forValue(String v) throws ParameterValueException {
for (AvoidBorders enumItem : AvoidBorders.values()) {
if (enumItem.value.equals(v))
return enumItem;
}
throw new ParameterValueException(INVALID_PARAMETER_VALUE, "avoid_borders", v);
}
@Override
@JsonValue
public String toString() {
return value;
}
}
@ApiModel(value = "Specify which extra info items to include in the response")
public enum ExtraInfo {
STEEPNESS("steepness"),
SUITABILITY("suitability"),
SURFACE("surface"),
WAY_CATEGORY("waycategory"),
WAY_TYPE("waytype"),
TOLLWAYS("tollways"),
TRAIL_DIFFICULTY("traildifficulty"),
OSM_ID("osmid"),
ROAD_ACCESS_RESTRICTIONS("roadaccessrestrictions"),
COUNTRY_INFO("countryinfo"),
GREEN("green"),
NOISE("noise");
private final String value;
ExtraInfo(String value) {
this.value = value;
}
@JsonCreator
public static ExtraInfo forValue(String v) throws ParameterValueException {
for (ExtraInfo enumItem : ExtraInfo.values()) {
if (enumItem.value.equals(v))
return enumItem;
}
throw new ParameterValueException(INVALID_PARAMETER_VALUE, "extra_info", v);
}
@Override
@JsonValue
public String toString() {
return value;
}
}
@ApiModel
public enum RouteResponseType {
GPX("gpx"),
JSON("json"),
GEOJSON("geojson");
private final String value;
RouteResponseType(String value) {
this.value = value;
}
@JsonCreator
public static RouteResponseType forValue(String v) throws ParameterValueException {
for (RouteResponseType enumItem : RouteResponseType.values()) {
if (enumItem.value.equals(v))
return enumItem;
}
throw new ParameterValueException(INVALID_PARAMETER_VALUE, "format", v);
}
@Override
@JsonValue
public String toString() {
return value;
}
}
@ApiModel
public enum MatrixResponseType {
JSON("json");
private final String value;
MatrixResponseType(String value) {
this.value = value;
}
@JsonCreator
public static MatrixResponseType forValue(String v) throws ParameterValueException {
for (MatrixResponseType enumItem : MatrixResponseType.values()) {
if (enumItem.value.equals(v))
return enumItem;
}
throw new ParameterValueException(INVALID_PARAMETER_VALUE, "format", v);
}
@Override
@JsonValue
public String toString() {
return value;
}
}
@ApiModel
public enum VehicleType {
HGV("hgv"),
BUS("bus"),
AGRICULTURAL("agricultural"),
DELIVERY("delivery"),
FORESTRY("forestry"),
GOODS("goods"),
@JsonIgnore UNKNOWN("unknown");
private final String value;
VehicleType(String value) {
this.value = value;
}
@JsonCreator
public static VehicleType forValue(String v) throws ParameterValueException {
for (VehicleType enumItem : VehicleType.values()) {
if (enumItem.value.equals(v))
return enumItem;
}
throw new ParameterValueException(INVALID_PARAMETER_VALUE, "vehicle_type", v);
}
@Override
@JsonValue
public String toString() {
return value;
}
}
@ApiModel
public enum AvoidFeatures {
HIGHWAYS("highways"),
TOLLWAYS("tollways"),
FERRIES("ferries"),
FORDS("fords"),
STEPS("steps");
private final String value;
AvoidFeatures(String value) {
this.value = value;
}
@JsonCreator
public static AvoidFeatures forValue(String v) throws ParameterValueException {
for (AvoidFeatures enumItem : AvoidFeatures.values()) {
if (enumItem.value.equals(v))
return enumItem;
}
throw new ParameterValueException(INVALID_PARAMETER_VALUE, "avoid_features", v);
}
@Override
@JsonValue
public String toString() {
return value;
}
}
@ApiModel(value = "Preference", description = "Specifies the route preference")
public enum RoutePreference {
FASTEST("fastest"),
SHORTEST("shortest"),
RECOMMENDED("recommended");
private final String value;
RoutePreference(String value) {
this.value = value;
}
@JsonCreator
public static RoutePreference forValue(String v) throws ParameterValueException {
for (RoutePreference enumItem : RoutePreference.values()) {
if (enumItem.value.equals(v))
return enumItem;
}
throw new ParameterValueException(INVALID_PARAMETER_VALUE, "preference", v);
}
@Override
@JsonValue
public String toString() {
return value;
}
}
public enum Profile {
DRIVING_CAR("driving-car"),
DRIVING_HGV("driving-hgv"),
CYCLING_REGULAR("cycling-regular"),
CYCLING_ROAD("cycling-road"),
CYCLING_MOUNTAIN("cycling-mountain"),
CYCLING_ELECTRIC("cycling-electric"),
FOOT_WALKING("foot-walking"),
FOOT_HIKING("foot-hiking"),
WHEELCHAIR("wheelchair");
private final String value;
Profile(String value) {
this.value = value;
}
@JsonCreator
public static Profile forValue(String v) throws ParameterValueException {
for (Profile enumItem : Profile.values()) {
if (enumItem.value.equals(v))
return enumItem;
}
throw new ParameterValueException(INVALID_PARAMETER_VALUE, "profile", v);
}
@Override
@JsonValue
public String toString() {
return value;
}
}
public enum Units {
METRES("m"),
KILOMETRES("km"),
MILES("mi");
private final String value;
Units(String value) {
this.value = value;
}
@JsonCreator
public static Units forValue(String v) throws ParameterValueException {
v = v.toLowerCase();
for (Units enumItem : Units.values()) {
if (enumItem.value.equals(v))
return enumItem;
}
throw new ParameterValueException(INVALID_PARAMETER_VALUE, "units", v);
}
@Override
@JsonValue
public String toString() {
return value;
}
}
public enum Languages {
DE("de"),
DE_DE("de-de"),
EN("en"),
EN_US("en-us"),
ES("es"),
ES_ES("es-es"),
FR("fr"),
FR_FR("fr-fr"),
GR("gr"),
GR_GR("gr-gr"),
HE("he"),
HE_IL("he-il"),
HU("hu"),
HU_HU("hu-hu"),
ID("id"),
ID_ID("id-id"),
IT("it"),
IT_IT("it-it"),
NE("ne"),
NE_NP("ne-np"),
NL("nl"),
NL_NL("nl-nl"),
PL("pl"),
PL_PL("pl-pl"),
PT("pt"),
PT_PT("pt-pt"),
RU("ru"),
RU_RU("ru-ru"),
ZH("zh"),
ZH_CN("zh-cn");
private final String value;
Languages(String value) {
this.value = value;
}
@JsonCreator
public static Languages forValue(String v) throws ParameterValueException {
for (Languages enumItem : Languages.values()) {
if (enumItem.value.equalsIgnoreCase(v))
return enumItem;
}
throw new ParameterValueException(INVALID_PARAMETER_VALUE, "language", v);
}
@Override
@JsonValue
public String toString() {
return value;
}
}
public enum InstructionsFormat {
HTML("html"),
TEXT("text");
private final String value;
InstructionsFormat(String value) {
this.value = value;
}
@JsonCreator
public static InstructionsFormat forValue(String v) throws ParameterValueException {
for (InstructionsFormat enumItem : InstructionsFormat.values()) {
if (enumItem.value.equals(v))
return enumItem;
}
throw new ParameterValueException(INVALID_PARAMETER_VALUE, "instructions_format", v);
}
@Override
@JsonValue
public String toString() {
return value;
}
}
public enum Attributes {
AVERAGE_SPEED("avgspeed"),
DETOUR_FACTOR("detourfactor"),
ROUTE_PERCENTAGE("percentage");
private final String value;
Attributes(String value) {
this.value = value;
}
@JsonCreator
public static Attributes forValue(String v) throws ParameterValueException {
for (Attributes enumItem : Attributes.values()) {
if (enumItem.value.equals(v))
return enumItem;
}
throw new ParameterValueException(INVALID_PARAMETER_VALUE, "attributes", v);
}
@Override
@JsonValue
public String toString() {
return value;
}
}
}
| {
"pile_set_name": "Github"
} |
define(function (require) {
var Group = require('zrender/container/Group');
var componentUtil = require('../util/component');
var clazzUtil = require('../util/clazz');
var Component = function () {
/**
* @type {module:zrender/container/Group}
* @readOnly
*/
this.group = new Group();
/**
* @type {string}
* @readOnly
*/
this.uid = componentUtil.getUID('viewComponent');
};
Component.prototype = {
constructor: Component,
init: function (ecModel, api) {},
render: function (componentModel, ecModel, api, payload) {},
dispose: function () {}
};
var componentProto = Component.prototype;
componentProto.updateView
= componentProto.updateLayout
= componentProto.updateVisual
= function (seriesModel, ecModel, api, payload) {
// Do nothing;
};
// Enable Component.extend.
clazzUtil.enableClassExtend(Component);
// Enable capability of registerClass, getClass, hasClass, registerSubTypeDefaulter and so on.
clazzUtil.enableClassManagement(Component, {registerWhenExtend: true});
return Component;
}); | {
"pile_set_name": "Github"
} |
:pserver:[email protected]:/sources/backbone
| {
"pile_set_name": "Github"
} |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"\ua3b8\ua111",
"\ua06f\ua2d2"
],
"DAY": [
"\ua46d\ua18f\ua44d",
"\ua18f\ua282\ua2cd",
"\ua18f\ua282\ua44d",
"\ua18f\ua282\ua315",
"\ua18f\ua282\ua1d6",
"\ua18f\ua282\ua26c",
"\ua18f\ua282\ua0d8"
],
"MONTH": [
"\ua2cd\ua1aa",
"\ua44d\ua1aa",
"\ua315\ua1aa",
"\ua1d6\ua1aa",
"\ua26c\ua1aa",
"\ua0d8\ua1aa",
"\ua3c3\ua1aa",
"\ua246\ua1aa",
"\ua22c\ua1aa",
"\ua2b0\ua1aa",
"\ua2b0\ua2aa\ua1aa",
"\ua2b0\ua44b\ua1aa"
],
"SHORTDAY": [
"\ua46d\ua18f",
"\ua18f\ua2cd",
"\ua18f\ua44d",
"\ua18f\ua315",
"\ua18f\ua1d6",
"\ua18f\ua26c",
"\ua18f\ua0d8"
],
"SHORTMONTH": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12"
],
"fullDate": "y MMMM d, EEEE",
"longDate": "y MMMM d",
"medium": "y MMM d HH:mm:ss",
"mediumDate": "y MMM d",
"mediumTime": "HH:mm:ss",
"short": "y-MM-dd HH:mm",
"shortDate": "y-MM-dd",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "\u00a5",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "\u00a4\u00a0-",
"negSuf": "",
"posPre": "\u00a4\u00a0",
"posSuf": ""
}
]
},
"id": "ii-cn",
"pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | {
"pile_set_name": "Github"
} |
// Copyright 2005,2006,2007 Markus Schordan, Gergo Barany
// $Id: pag_support.h,v 1.4 2008-08-23 13:46:48 gergo Exp $
#ifndef H_PAG_SUPPORT
#define H_PAG_SUPPORT
unsigned long synttype_hash(void *);
int syntax_eq(void *, void *);
void syntax_mcopy(void *, void *);
void syntaxdummy(void *);
#ifdef __cplusplus
extern "C"
#endif
void syntax_init(void);
#ifdef __cplusplus
extern "C" {
#endif
extern int syntaxtype;
extern int e_syntaxtype;
#ifdef __cplusplus
}
#endif
#include "syn_typedefs.h"
#ifdef __cplusplus
extern "C"
#endif
const char *basic_type_name(const void *);
// GB (2008-06-04): If an analyzer prefix is set, include the header that
// redefines prefixed support function names to the actual unprefixed names.
#if PREFIX_SET
#include "prefixed_support_funcs.h"
#endif
#endif
| {
"pile_set_name": "Github"
} |
<cib crm_feature_set="3.0.7" validate-with="pacemaker-3.0" admin_epoch="1" epoch="36" num_updates="4" cib-last-written="Wed Sep 4 14:06:37 2013" update-origin="18node1" update-client="crm_resource" have-quorum="1" dc-uuid="3">
<configuration>
<crm_config>
<cluster_property_set id="cib-bootstrap-options">
<nvpair id="cts-stonith-enabled" name="stonith-enabled" value="1"/>
<nvpair id="cts-start-failure-is-fatal" name="start-failure-is-fatal" value="false"/>
<nvpair id="cts-pe-input-series-max" name="pe-input-series-max" value="5000"/>
<nvpair id="cts-shutdown-escalation" name="shutdown-escalation" value="5min"/>
<nvpair id="cts-batch-limit" name="batch-limit" value="10"/>
<nvpair id="cts-dc-deadtime" name="dc-deadtime" value="5s"/>
<nvpair id="cts-no-quorum-policy" name="no-quorum-policy" value="stop"/>
<nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.1.11-1.fc18-3e081d7"/>
<nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="corosync"/>
</cluster_property_set>
</crm_config>
<nodes>
<node id="1" uname="18node1"/>
<node id="2" uname="18node2"/>
<node id="3" uname="18node3"/>
</nodes>
<op_defaults>
<meta_attributes id="op_defaults-meta_attributes">
<nvpair id="op_defaults-timeout" name="timeout" value="90s"/>
</meta_attributes>
</op_defaults>
<resources>
<primitive id="Fencing" class="stonith" type="fence_xvm">
<meta_attributes id="Fencing-meta">
<nvpair id="Fencing-migration-threshold" name="migration-threshold" value="5"/>
</meta_attributes>
<instance_attributes id="Fencing-params">
<nvpair id="Fencing-delay" name="delay" value="0"/>
</instance_attributes>
<operations>
<op id="Fencing-monitor-120s" interval="120s" name="monitor" timeout="120s"/>
<op id="Fencing-stop-0" interval="0" name="stop" timeout="60s"/>
<op id="Fencing-start-0" interval="0" name="start" timeout="60s"/>
</operations>
</primitive>
<primitive id="FencingPass" class="stonith" type="fence_dummy">
<instance_attributes id="FencingPass-params">
<nvpair id="FencingPass-delay" name="delay" value="20"/>
<nvpair id="FencingPass-random_sleep_range" name="random_sleep_range" value="10"/>
<nvpair id="FencingPass-pcmk_host_list" name="pcmk_host_list" value="18node2"/>
<nvpair id="FencingPass-mode" name="mode" value="pass"/>
</instance_attributes>
</primitive>
<primitive id="FencingFail" class="stonith" type="fence_dummy">
<instance_attributes id="FencingFail-params">
<nvpair id="FencingFail-delay" name="delay" value="20"/>
<nvpair id="FencingFail-random_sleep_range" name="random_sleep_range" value="30"/>
<nvpair id="FencingFail-pcmk_host_list" name="pcmk_host_list" value="18node1 18node3"/>
<nvpair id="FencingFail-mode" name="mode" value="fail"/>
</instance_attributes>
</primitive>
<primitive id="rsc_18node1" class="ocf" type="IPaddr2" provider="heartbeat">
<instance_attributes id="rsc_18node1-params">
<nvpair id="rsc_18node1-ip" name="ip" value="192.168.122.84"/>
<nvpair id="rsc_18node1-cidr_netmask" name="cidr_netmask" value="32"/>
</instance_attributes>
<operations>
<op id="rsc_18node1-monitor-5s" interval="5s" name="monitor"/>
</operations>
</primitive>
<primitive id="rsc_18node2" class="ocf" type="IPaddr2" provider="heartbeat">
<instance_attributes id="rsc_18node2-params">
<nvpair id="rsc_18node2-ip" name="ip" value="192.168.122.85"/>
<nvpair id="rsc_18node2-cidr_netmask" name="cidr_netmask" value="32"/>
</instance_attributes>
<operations>
<op id="rsc_18node2-monitor-5s" interval="5s" name="monitor"/>
</operations>
</primitive>
<primitive id="rsc_18node3" class="ocf" type="IPaddr2" provider="heartbeat">
<instance_attributes id="rsc_18node3-params">
<nvpair id="rsc_18node3-ip" name="ip" value="192.168.122.86"/>
<nvpair id="rsc_18node3-cidr_netmask" name="cidr_netmask" value="32"/>
</instance_attributes>
<operations>
<op id="rsc_18node3-monitor-5s" interval="5s" name="monitor"/>
</operations>
</primitive>
<primitive id="migrator" class="ocf" type="Dummy" provider="pacemaker">
<meta_attributes id="migrator-meta">
<nvpair id="migrator-allow-migrate" name="allow-migrate" value="1"/>
<nvpair id="migrator-resource-stickiness" name="resource-stickiness" value="1"/>
</meta_attributes>
<operations>
<op id="migrator-monitor-P10S" interval="P10S" name="monitor"/>
</operations>
</primitive>
<clone id="Connectivity">
<meta_attributes id="Connectivity-meta">
<nvpair id="Connectivity-globally-unique" name="globally-unique" value="false"/>
</meta_attributes>
<primitive id="ping-1" class="ocf" type="ping" provider="pacemaker">
<instance_attributes id="ping-1-params">
<nvpair id="ping-1-debug" name="debug" value="true"/>
<nvpair id="ping-1-host_list" name="host_list" value="192.168.122.80"/>
<nvpair id="ping-1-name" name="name" value="connected"/>
</instance_attributes>
<operations>
<op id="ping-1-monitor-60s" interval="60s" name="monitor"/>
</operations>
</primitive>
</clone>
<clone id="master-1">
<meta_attributes id="master-1-meta">
<nvpair id="master-1-promotable" name="promotable" value="true"/>
<nvpair id="master-1-promoted-node-max" name="promoted-node-max" value="1"/>
<nvpair id="master-1-clone-max" name="clone-max" value="3"/>
<nvpair id="master-1-promoted-max" name="promoted-max" value="1"/>
<nvpair id="master-1-clone-node-max" name="clone-node-max" value="1"/>
</meta_attributes>
<primitive id="stateful-1" class="ocf" type="Stateful" provider="pacemaker">
<operations>
<op id="stateful-1-monitor-15s" interval="15s" name="monitor" timeout="60s"/>
<op id="stateful-1-monitor-16s" interval="16s" role="Master" name="monitor" timeout="60s"/>
</operations>
</primitive>
</clone>
<group id="group-1">
<primitive id="r192.168.122.87" class="ocf" type="IPaddr2" provider="heartbeat">
<instance_attributes id="r192.168.122.87-params">
<nvpair id="r192.168.122.87-ip" name="ip" value="192.168.122.87"/>
<nvpair id="r192.168.122.87-cidr_netmask" name="cidr_netmask" value="32"/>
</instance_attributes>
<operations>
<op id="r192.168.122.87-monitor-5s" interval="5s" name="monitor"/>
</operations>
</primitive>
<primitive id="r192.168.122.88" class="ocf" type="IPaddr2" provider="heartbeat">
<instance_attributes id="r192.168.122.88-params">
<nvpair id="r192.168.122.88-ip" name="ip" value="192.168.122.88"/>
<nvpair id="r192.168.122.88-cidr_netmask" name="cidr_netmask" value="32"/>
</instance_attributes>
<operations>
<op id="r192.168.122.88-monitor-5s" interval="5s" name="monitor"/>
</operations>
</primitive>
<primitive id="r192.168.122.89" class="ocf" type="IPaddr2" provider="heartbeat">
<instance_attributes id="r192.168.122.89-params">
<nvpair id="r192.168.122.89-ip" name="ip" value="192.168.122.89"/>
<nvpair id="r192.168.122.89-cidr_netmask" name="cidr_netmask" value="32"/>
</instance_attributes>
<operations>
<op id="r192.168.122.89-monitor-5s" interval="5s" name="monitor"/>
</operations>
</primitive>
</group>
<primitive id="lsb-dummy" class="lsb" type="/usr/share/pacemaker/tests/cts/LSBDummy">
<operations>
<op id="lsb-dummy-monitor-5s" interval="5s" name="monitor"/>
</operations>
</primitive>
</resources>
<constraints>
<rsc_location id="prefer-18node1" rsc="rsc_18node1">
<rule id="prefer-18node1-r" score="100" boolean-op="and">
<expression id="prefer-18node1-e" attribute="#uname" operation="eq" value="18node1"/>
</rule>
</rsc_location>
<rsc_location id="prefer-18node2" rsc="rsc_18node2">
<rule id="prefer-18node2-r" score="100" boolean-op="and">
<expression id="prefer-18node2-e" attribute="#uname" operation="eq" value="18node2"/>
</rule>
</rsc_location>
<rsc_location id="prefer-18node3" rsc="rsc_18node3">
<rule id="prefer-18node3-r" score="100" boolean-op="and">
<expression id="prefer-18node3-e" attribute="#uname" operation="eq" value="18node3"/>
</rule>
</rsc_location>
<rsc_location id="prefer-connected" rsc="master-1">
<rule id="connected" score="-INFINITY" boolean-op="or">
<expression id="m1-connected-1" attribute="connected" operation="lt" value="1"/>
<expression id="m1-connected-2" attribute="connected" operation="not_defined"/>
</rule>
</rsc_location>
<rsc_order id="group-1-after-master-1" first="master-1" then="group-1" kind="Mandatory" first-action="promote" then-action="start"/>
<rsc_colocation id="group-1-with-master-1" rsc="group-1" with-rsc="master-1" score="INFINITY" with-rsc-role="Master"/>
<rsc_order id="lsb-dummy-after-group-1" first="group-1" then="lsb-dummy" kind="Mandatory" first-action="start" then-action="start"/>
<rsc_colocation id="lsb-dummy-with-group-1" rsc="lsb-dummy" with-rsc="group-1" score="INFINITY"/>
</constraints>
<fencing-topology>
<fencing-level id="cts-18node1.1" index="1" target="18node1" devices="FencingFail"/>
<fencing-level id="cts-18node1.2" index="2" target="18node1" devices="Fencing"/>
<fencing-level id="cts-18node2.1" index="1" target="18node2" devices="FencingPass,Fencing"/>
<fencing-level id="cts-18node3.1" index="1" target="18node3" devices="FencingFail"/>
<fencing-level id="cts-18node3.2" index="2" target="18node3" devices="Fencing"/>
</fencing-topology>
</configuration>
<status>
<node_state id="1" uname="18node1" in_ccm="true" crmd="online" join="member" expected="member" crm-debug-origin="do_update_resource">
<transient_attributes id="1">
<instance_attributes id="status-1">
<nvpair id="status-1-probe_complete" name="probe_complete" value="true"/>
<nvpair id="status-1-connected" name="connected" value="1"/>
<nvpair id="status-1-master-stateful-1" name="master-stateful-1" value="10"/>
</instance_attributes>
</transient_attributes>
<lrm id="1">
<lrm_resources>
<lrm_resource id="lsb-dummy" type="/usr/share/pacemaker/tests/cts/LSBDummy" class="lsb">
<lrm_rsc_op id="lsb-dummy_last_0" operation_key="lsb-dummy_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="61:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;61:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="126" rc-code="0" op-status="0" interval="0" last-run="1378339584" last-rc-change="1378339584" exec-time="33" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
<lrm_rsc_op id="lsb-dummy_monitor_5000" operation_key="lsb-dummy_monitor_5000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="62:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;62:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="129" rc-code="0" op-status="0" interval="5000" last-rc-change="1378339584" exec-time="21" queue-time="0" op-digest="8f6a313464b7f9e3a31cb448458b700e"/>
</lrm_resource>
<lrm_resource id="FencingFail" type="fence_dummy" class="stonith">
<lrm_rsc_op id="FencingFail_last_0" operation_key="FencingFail_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="27:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;27:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="134" rc-code="0" op-status="0" interval="0" last-run="1378339595" last-rc-change="1378339595" exec-time="1" queue-time="0" op-digest="5e62ce197b9fbd863ed25f7e27cb1c52"/>
</lrm_resource>
<lrm_resource id="FencingPass" type="fence_dummy" class="stonith">
<lrm_rsc_op id="FencingPass_last_0" operation_key="FencingPass_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="20:17:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;20:17:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="97" rc-code="0" op-status="0" interval="0" last-run="1378339553" last-rc-change="1378339553" exec-time="27112" queue-time="0" op-digest="d61011437d4d28d16fbcbaa519c4c826"/>
</lrm_resource>
<lrm_resource id="Fencing" type="fence_xvm" class="stonith">
<lrm_rsc_op id="Fencing_last_0" operation_key="Fencing_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="17:13:7:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:7;17:13:7:b39aace0-7880-42dc-bf88-a569319bb584" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1378339516" last-rc-change="1378339516" exec-time="7" queue-time="0" op-digest="208febaab0d91bc529d468f4bec44d73"/>
</lrm_resource>
<lrm_resource id="r192.168.122.87" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="r192.168.122.87_last_0" operation_key="r192.168.122.87_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="50:18:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;50:18:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="108" rc-code="0" op-status="0" interval="0" last-run="1378339581" last-rc-change="1378339581" exec-time="94" queue-time="0" op-digest="1f9cf34fdfbf3f26a102a160cbc32cee"/>
<lrm_rsc_op id="r192.168.122.87_monitor_5000" operation_key="r192.168.122.87_monitor_5000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="52:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;52:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="112" rc-code="0" op-status="0" interval="5000" last-rc-change="1378339583" exec-time="167" queue-time="0" op-digest="6d2f4d76c27ffeff21fcdee7a268e130"/>
</lrm_resource>
<lrm_resource id="r192.168.122.89" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="r192.168.122.89_last_0" operation_key="r192.168.122.89_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="55:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;55:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="120" rc-code="0" op-status="0" interval="0" last-run="1378339584" last-rc-change="1378339584" exec-time="97" queue-time="0" op-digest="c944796c1b514fc9ff85720a2686ea5b"/>
<lrm_rsc_op id="r192.168.122.89_monitor_5000" operation_key="r192.168.122.89_monitor_5000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="56:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;56:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="124" rc-code="0" op-status="0" interval="5000" last-rc-change="1378339584" exec-time="90" queue-time="0" op-digest="909846037fdae734796dab3967f9be98"/>
</lrm_resource>
<lrm_resource id="rsc_18node1" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="rsc_18node1_last_0" operation_key="rsc_18node1_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="39:13:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;39:13:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="74" rc-code="0" op-status="0" interval="0" last-run="1378339519" last-rc-change="1378339519" exec-time="84" queue-time="0" op-digest="bf35e29e5fd031da0437b6dbc9ebb74b"/>
<lrm_rsc_op id="rsc_18node1_monitor_5000" operation_key="rsc_18node1_monitor_5000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="40:13:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;40:13:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="77" rc-code="0" op-status="0" interval="5000" last-rc-change="1378339519" exec-time="45" queue-time="0" op-digest="d9bbed54d4fa7eb5d6857c5d3dece704"/>
</lrm_resource>
<lrm_resource id="rsc_18node2" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="rsc_18node2_last_0" operation_key="rsc_18node2_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="21:13:7:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:7;21:13:7:b39aace0-7880-42dc-bf88-a569319bb584" call-id="21" rc-code="7" op-status="0" interval="0" last-run="1378339516" last-rc-change="1378339516" exec-time="184" queue-time="0" op-digest="5ab425702de20e415276371af97f8566"/>
</lrm_resource>
<lrm_resource id="ping-1" type="ping" class="ocf" provider="pacemaker">
<lrm_rsc_op id="ping-1_last_0" operation_key="ping-1_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="51:13:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;51:13:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="70" rc-code="0" op-status="0" interval="0" last-run="1378339518" last-rc-change="1378339518" exec-time="2148" queue-time="0" op-digest="a53fc9fb0118a43d3be0fceaf2348d38"/>
<lrm_rsc_op id="ping-1_monitor_60000" operation_key="ping-1_monitor_60000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="52:13:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;52:13:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="81" rc-code="0" op-status="0" interval="60000" last-rc-change="1378339520" exec-time="2055" queue-time="0" op-digest="6b1eba5fe19d16fa21bf0501bbe5c0cd"/>
</lrm_resource>
<lrm_resource id="rsc_18node3" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="rsc_18node3_last_0" operation_key="rsc_18node3_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="22:13:7:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:7;22:13:7:b39aace0-7880-42dc-bf88-a569319bb584" call-id="25" rc-code="7" op-status="0" interval="0" last-run="1378339516" last-rc-change="1378339516" exec-time="190" queue-time="0" op-digest="19b33c0194f91788ea954e69150d9178"/>
</lrm_resource>
<lrm_resource id="stateful-1" type="Stateful" class="ocf" provider="pacemaker">
<lrm_rsc_op id="stateful-1_last_0" operation_key="stateful-1_promote_0" operation="promote" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="38:18:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;38:18:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="103" rc-code="0" op-status="0" interval="0" last-run="1378339581" last-rc-change="1378339581" exec-time="44" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
<lrm_rsc_op id="stateful-1_monitor_16000" operation_key="stateful-1_monitor_16000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="39:18:8:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:8;39:18:8:b39aace0-7880-42dc-bf88-a569319bb584" call-id="106" rc-code="8" op-status="0" interval="16000" last-rc-change="1378339581" exec-time="47" queue-time="0" op-digest="873ed4f07792aa8ff18f3254244675ea"/>
</lrm_resource>
<lrm_resource id="r192.168.122.88" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="r192.168.122.88_last_0" operation_key="r192.168.122.88_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="53:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;53:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="114" rc-code="0" op-status="0" interval="0" last-run="1378339583" last-rc-change="1378339583" exec-time="221" queue-time="0" op-digest="0ad87a820b9cba1ae10ab7f9e9221f43"/>
<lrm_rsc_op id="r192.168.122.88_monitor_5000" operation_key="r192.168.122.88_monitor_5000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="54:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;54:0:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="118" rc-code="0" op-status="0" interval="5000" last-rc-change="1378339584" exec-time="77" queue-time="0" op-digest="1f4490da6297c7cc6470ce31eeb4957a"/>
</lrm_resource>
<lrm_resource id="migrator" type="Dummy" class="ocf" provider="pacemaker">
<lrm_rsc_op id="migrator_last_0" operation_key="migrator_migrate_from_0" operation="migrate_from" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="87:16:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;87:16:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="94" rc-code="0" op-status="0" interval="0" last-run="1378339553" last-rc-change="1378339553" exec-time="31" queue-time="0" migrate_source="18node2" migrate_target="18node1" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" state op_sleep " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
<lrm_rsc_op id="migrator_monitor_10000" operation_key="migrator_monitor_10000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="32:17:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;32:17:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="99" rc-code="0" op-status="0" interval="10000" last-rc-change="1378339553" exec-time="47" queue-time="1" op-digest="8f6a313464b7f9e3a31cb448458b700e"/>
</lrm_resource>
<lrm_resource id="remote1" type="remote" class="ocf" provider="pacemaker">
<lrm_rsc_op id="remote1_last_0" operation_key="remote1_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="74:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;74:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="2" rc-code="0" op-status="0" interval="0" op-digest="83190b903c8e0e440bfe3488502a0cd6"/>
<lrm_rsc_op id="remote1_monitor_60000" operation_key="remote1_monitor_60000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="75:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;75:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="3" rc-code="0" op-status="0" interval="60000" op-digest="c8c7547494dec1b4b349955b2db56fad"/>
</lrm_resource>
</lrm_resources>
</lrm>
</node_state>
<node_state id="2" uname="18node2" in_ccm="false" crmd="offline" join="down" expected="member" crm-debug-origin="do_state_transition">
<transient_attributes id="2">
<instance_attributes id="status-2">
<nvpair id="status-2-probe_complete" name="probe_complete" value="true"/>
<nvpair id="status-2-shutdown" name="shutdown" value="1378339553"/>
</instance_attributes>
</transient_attributes>
<lrm id="2">
<lrm_resources>
<lrm_resource id="lsb-dummy" type="/usr/share/pacemaker/tests/cts/LSBDummy" class="lsb">
<lrm_rsc_op id="lsb-dummy_last_0" operation_key="lsb-dummy_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="75:16:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;75:16:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="193" rc-code="0" op-status="0" interval="0" last-run="1378339553" last-rc-change="1378339553" exec-time="65" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
<lrm_rsc_op id="lsb-dummy_monitor_5000" operation_key="lsb-dummy_monitor_5000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="62:0:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;62:0:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="159" rc-code="0" op-status="0" interval="5000" last-rc-change="1378339340" exec-time="20" queue-time="0" op-digest="8f6a313464b7f9e3a31cb448458b700e"/>
</lrm_resource>
<lrm_resource id="FencingFail" type="fence_dummy" class="stonith">
<lrm_rsc_op id="FencingFail_last_0" operation_key="FencingFail_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="36:13:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;36:13:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="181" rc-code="0" op-status="0" interval="0" last-run="1378339518" last-rc-change="1378339518" exec-time="0" queue-time="0" op-digest="5e62ce197b9fbd863ed25f7e27cb1c52"/>
</lrm_resource>
<lrm_resource id="FencingPass" type="fence_dummy" class="stonith">
<lrm_rsc_op id="FencingPass_last_0" operation_key="FencingPass_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="23:16:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;23:16:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="184" rc-code="0" op-status="0" interval="0" last-run="1378339553" last-rc-change="1378339553" exec-time="0" queue-time="0" op-digest="d61011437d4d28d16fbcbaa519c4c826"/>
</lrm_resource>
<lrm_resource id="Fencing" type="fence_xvm" class="stonith">
<lrm_rsc_op id="Fencing_last_0" operation_key="Fencing_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="22:9:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;22:9:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="174" rc-code="0" op-status="0" interval="0" last-run="1378339466" last-rc-change="1378339466" exec-time="93" queue-time="0" op-digest="208febaab0d91bc529d468f4bec44d73"/>
</lrm_resource>
<lrm_resource id="r192.168.122.87" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="r192.168.122.87_last_0" operation_key="r192.168.122.87_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="58:17:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;58:17:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="221" rc-code="0" op-status="0" interval="0" last-run="1378339553" last-rc-change="1378339553" exec-time="48" queue-time="0" op-digest="1f9cf34fdfbf3f26a102a160cbc32cee"/>
<lrm_rsc_op id="r192.168.122.87_monitor_5000" operation_key="r192.168.122.87_monitor_5000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="52:0:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;52:0:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="142" rc-code="0" op-status="0" interval="5000" last-rc-change="1378339340" exec-time="105" queue-time="0" op-digest="6d2f4d76c27ffeff21fcdee7a268e130"/>
</lrm_resource>
<lrm_resource id="r192.168.122.89" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="r192.168.122.89_last_0" operation_key="r192.168.122.89_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="64:17:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;64:17:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="205" rc-code="0" op-status="0" interval="0" last-run="1378339553" last-rc-change="1378339553" exec-time="146" queue-time="0" op-digest="c944796c1b514fc9ff85720a2686ea5b"/>
<lrm_rsc_op id="r192.168.122.89_monitor_5000" operation_key="r192.168.122.89_monitor_5000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="56:0:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;56:0:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="154" rc-code="0" op-status="0" interval="5000" last-rc-change="1378339340" exec-time="64" queue-time="0" op-digest="909846037fdae734796dab3967f9be98"/>
</lrm_resource>
<lrm_resource id="rsc_18node1" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="rsc_18node1_last_0" operation_key="rsc_18node1_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="38:4:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;38:4:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="165" rc-code="0" op-status="0" interval="0" last-run="1378339375" last-rc-change="1378339375" exec-time="100" queue-time="0" op-digest="bf35e29e5fd031da0437b6dbc9ebb74b"/>
</lrm_resource>
<lrm_resource id="rsc_18node2" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="rsc_18node2_last_0" operation_key="rsc_18node2_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="29:16:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;29:16:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="187" rc-code="0" op-status="0" interval="0" last-run="1378339553" last-rc-change="1378339553" exec-time="113" queue-time="0" op-digest="5ab425702de20e415276371af97f8566"/>
<lrm_rsc_op id="rsc_18node2_monitor_5000" operation_key="rsc_18node2_monitor_5000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="42:10:0:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:0;42:10:0:926066cc-bc50-4d89-857c-c851891d599e" call-id="77" rc-code="0" op-status="0" interval="5000" last-rc-change="1378339095" exec-time="42" queue-time="1" op-digest="3c1c6f0057a1eeea9c65740335f392e6"/>
</lrm_resource>
<lrm_resource id="ping-1" type="ping" class="ocf" provider="pacemaker">
<lrm_rsc_op id="ping-1_last_0" operation_key="ping-1_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="35:17:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;35:17:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="209" rc-code="0" op-status="0" interval="0" last-run="1378339553" last-rc-change="1378339553" exec-time="99" queue-time="0" op-digest="a53fc9fb0118a43d3be0fceaf2348d38"/>
<lrm_rsc_op id="ping-1_monitor_60000" operation_key="ping-1_monitor_60000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="52:10:0:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:0;52:10:0:926066cc-bc50-4d89-857c-c851891d599e" call-id="81" rc-code="0" op-status="0" interval="60000" last-rc-change="1378339096" exec-time="2050" queue-time="0" op-digest="6b1eba5fe19d16fa21bf0501bbe5c0cd"/>
</lrm_resource>
<lrm_resource id="rsc_18node3" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="rsc_18node3_last_0" operation_key="rsc_18node3_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="42:18:0:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:0;42:18:0:926066cc-bc50-4d89-857c-c851891d599e" call-id="114" rc-code="0" op-status="0" interval="0" last-run="1378339252" last-rc-change="1378339252" exec-time="111" queue-time="0" op-digest="19b33c0194f91788ea954e69150d9178"/>
</lrm_resource>
<lrm_resource id="stateful-1" type="Stateful" class="ocf" provider="pacemaker">
<lrm_rsc_op id="stateful-1_last_0" operation_key="stateful-1_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="47:17:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;47:17:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="230" rc-code="0" op-status="0" interval="0" last-run="1378339553" last-rc-change="1378339553" exec-time="86" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
<lrm_rsc_op id="stateful-1_monitor_16000" operation_key="stateful-1_monitor_16000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="39:23:8:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:8;39:23:8:926066cc-bc50-4d89-857c-c851891d599e" call-id="136" rc-code="8" op-status="0" interval="16000" last-rc-change="1378339338" exec-time="39" queue-time="0" op-digest="873ed4f07792aa8ff18f3254244675ea"/>
</lrm_resource>
<lrm_resource id="r192.168.122.88" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="r192.168.122.88_last_0" operation_key="r192.168.122.88_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="61:17:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;61:17:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="216" rc-code="0" op-status="0" interval="0" last-run="1378339553" last-rc-change="1378339553" exec-time="35" queue-time="0" op-digest="0ad87a820b9cba1ae10ab7f9e9221f43"/>
<lrm_rsc_op id="r192.168.122.88_monitor_5000" operation_key="r192.168.122.88_monitor_5000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="54:0:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;54:0:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="148" rc-code="0" op-status="0" interval="5000" last-rc-change="1378339340" exec-time="77" queue-time="0" op-digest="1f4490da6297c7cc6470ce31eeb4957a"/>
</lrm_resource>
<lrm_resource id="migrator" type="Dummy" class="ocf" provider="pacemaker">
<lrm_rsc_op id="migrator_last_0" operation_key="migrator_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="29:17:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;29:17:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="202" rc-code="0" op-status="0" interval="0" last-run="1378339553" last-rc-change="1378339553" exec-time="53" queue-time="0" migrate_source="18node2" migrate_target="18node1" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" state op_sleep " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
<lrm_rsc_op id="migrator_monitor_10000" operation_key="migrator_monitor_10000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="32:22:0:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:0;32:22:0:926066cc-bc50-4d89-857c-c851891d599e" call-id="126" rc-code="0" op-status="0" interval="10000" last-rc-change="1378339310" exec-time="26" queue-time="0" op-digest="8f6a313464b7f9e3a31cb448458b700e"/>
</lrm_resource>
</lrm_resources>
</lrm>
</node_state>
<node_state id="3" uname="18node3" in_ccm="true" crmd="online" join="member" expected="member" crm-debug-origin="do_update_resource">
<transient_attributes id="3">
<instance_attributes id="status-3">
<nvpair id="status-3-probe_complete" name="probe_complete" value="true"/>
<nvpair id="status-3-connected" name="connected" value="1"/>
<nvpair id="status-3-master-stateful-1" name="master-stateful-1" value="5"/>
</instance_attributes>
</transient_attributes>
<lrm id="3">
<lrm_resources>
<lrm_resource id="lsb-dummy" type="/usr/share/pacemaker/tests/cts/LSBDummy" class="lsb">
<lrm_rsc_op id="lsb-dummy_last_0" operation_key="lsb-dummy_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="31:18:7:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:7;31:18:7:926066cc-bc50-4d89-857c-c851891d599e" call-id="65" rc-code="7" op-status="0" interval="0" last-run="1378321253" last-rc-change="1378321253" exec-time="72" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
</lrm_resource>
<lrm_resource id="FencingFail" type="fence_dummy" class="stonith">
<lrm_rsc_op id="FencingFail_last_0" operation_key="FencingFail_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="28:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;28:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="141" rc-code="0" op-status="0" interval="0" last-run="1378321596" last-rc-change="1378321596" exec-time="30117" queue-time="0" op-digest="5e62ce197b9fbd863ed25f7e27cb1c52"/>
</lrm_resource>
<lrm_resource id="FencingPass" type="fence_dummy" class="stonith">
<lrm_rsc_op id="FencingPass_last_0" operation_key="FencingPass_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="21:11:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;21:11:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="116" rc-code="0" op-status="0" interval="0" last-run="1378321472" last-rc-change="1378321472" exec-time="0" queue-time="0" op-digest="d61011437d4d28d16fbcbaa519c4c826"/>
</lrm_resource>
<lrm_resource id="Fencing" type="fence_xvm" class="stonith">
<lrm_rsc_op id="Fencing_last_0" operation_key="Fencing_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="23:9:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;23:9:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="109" rc-code="0" op-status="0" interval="0" last-run="1378321467" last-rc-change="1378321467" exec-time="22" queue-time="0" op-digest="208febaab0d91bc529d468f4bec44d73"/>
<lrm_rsc_op id="Fencing_monitor_120000" operation_key="Fencing_monitor_120000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="30:10:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;30:10:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="113" rc-code="0" op-status="0" interval="120000" last-rc-change="1378321468" exec-time="8" queue-time="0" op-digest="9731ce90bfa3793cc401111d1df271d2"/>
</lrm_resource>
<lrm_resource id="r192.168.122.87" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="r192.168.122.87_last_0" operation_key="r192.168.122.87_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="28:18:7:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:7;28:18:7:926066cc-bc50-4d89-857c-c851891d599e" call-id="43" rc-code="7" op-status="0" interval="0" last-run="1378321251" last-rc-change="1378321251" exec-time="109" queue-time="0" op-digest="1f9cf34fdfbf3f26a102a160cbc32cee"/>
</lrm_resource>
<lrm_resource id="r192.168.122.89" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="r192.168.122.89_last_0" operation_key="r192.168.122.89_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="30:18:7:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:7;30:18:7:926066cc-bc50-4d89-857c-c851891d599e" call-id="61" rc-code="7" op-status="0" interval="0" last-run="1378321253" last-rc-change="1378321253" exec-time="138" queue-time="0" op-digest="c944796c1b514fc9ff85720a2686ea5b"/>
</lrm_resource>
<lrm_resource id="rsc_18node1" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="rsc_18node1_last_0" operation_key="rsc_18node1_stop_0" operation="stop" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="38:13:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;38:13:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="126" rc-code="0" op-status="0" interval="0" last-run="1378321519" last-rc-change="1378321519" exec-time="98" queue-time="0" op-digest="bf35e29e5fd031da0437b6dbc9ebb74b"/>
</lrm_resource>
<lrm_resource id="rsc_18node2" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="rsc_18node2_last_0" operation_key="rsc_18node2_stop_0" operation="stop" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="31:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;31:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="138" rc-code="0" op-status="0" interval="0" last-run="1378321596" last-rc-change="1378321596" exec-time="120" queue-time="0" op-digest="5ab425702de20e415276371af97f8566"/>
<lrm_rsc_op id="rsc_18node2_monitor_5000" operation_key="rsc_18node2_monitor_5000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="26:17:0:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:0;26:17:0:b39aace0-7880-42dc-bf88-a569319bb584" call-id="133" rc-code="0" op-status="0" interval="5000" last-rc-change="1378321554" exec-time="53" queue-time="0" op-digest="3c1c6f0057a1eeea9c65740335f392e6"/>
</lrm_resource>
<lrm_resource id="rsc_18node3" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="rsc_18node3_last_0" operation_key="rsc_18node3_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="43:18:0:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:0;43:18:0:926066cc-bc50-4d89-857c-c851891d599e" call-id="74" rc-code="0" op-status="0" interval="0" last-run="1378321254" last-rc-change="1378321254" exec-time="64" queue-time="0" op-digest="19b33c0194f91788ea954e69150d9178"/>
<lrm_rsc_op id="rsc_18node3_monitor_5000" operation_key="rsc_18node3_monitor_5000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="44:18:0:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:0;44:18:0:926066cc-bc50-4d89-857c-c851891d599e" call-id="77" rc-code="0" op-status="0" interval="5000" last-rc-change="1378321254" exec-time="39" queue-time="0" op-digest="b893d13b762f3758920817a68b61eef4"/>
</lrm_resource>
<lrm_resource id="ping-1" type="ping" class="ocf" provider="pacemaker">
<lrm_rsc_op id="ping-1_last_0" operation_key="ping-1_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="51:18:0:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:0;51:18:0:926066cc-bc50-4d89-857c-c851891d599e" call-id="70" rc-code="0" op-status="0" interval="0" last-run="1378321253" last-rc-change="1378321253" exec-time="2058" queue-time="0" op-digest="a53fc9fb0118a43d3be0fceaf2348d38"/>
<lrm_rsc_op id="ping-1_monitor_60000" operation_key="ping-1_monitor_60000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="52:18:0:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:0;52:18:0:926066cc-bc50-4d89-857c-c851891d599e" call-id="81" rc-code="0" op-status="0" interval="60000" last-rc-change="1378321255" exec-time="2050" queue-time="0" op-digest="6b1eba5fe19d16fa21bf0501bbe5c0cd"/>
</lrm_resource>
<lrm_resource id="stateful-1" type="Stateful" class="ocf" provider="pacemaker">
<lrm_rsc_op id="stateful-1_last_0" operation_key="stateful-1_start_0" operation="start" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="50:19:0:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:0;50:19:0:926066cc-bc50-4d89-857c-c851891d599e" call-id="85" rc-code="0" op-status="0" interval="0" last-run="1378321298" last-rc-change="1378321298" exec-time="52" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
<lrm_rsc_op id="stateful-1_monitor_15000" operation_key="stateful-1_monitor_15000" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="52:20:0:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:0;52:20:0:926066cc-bc50-4d89-857c-c851891d599e" call-id="88" rc-code="0" op-status="0" interval="15000" last-rc-change="1378321298" exec-time="17" queue-time="0" op-digest="873ed4f07792aa8ff18f3254244675ea"/>
</lrm_resource>
<lrm_resource id="r192.168.122.88" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="r192.168.122.88_last_0" operation_key="r192.168.122.88_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="29:18:7:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:7;29:18:7:926066cc-bc50-4d89-857c-c851891d599e" call-id="57" rc-code="7" op-status="0" interval="0" last-run="1378321253" last-rc-change="1378321253" exec-time="145" queue-time="0" op-digest="0ad87a820b9cba1ae10ab7f9e9221f43"/>
</lrm_resource>
<lrm_resource id="migrator" type="Dummy" class="ocf" provider="pacemaker">
<lrm_rsc_op id="migrator_last_0" operation_key="migrator_monitor_0" operation="monitor" crm-debug-origin="build_active_RAs" crm_feature_set="3.0.7" transition-key="25:18:7:926066cc-bc50-4d89-857c-c851891d599e" transition-magic="0:7;25:18:7:926066cc-bc50-4d89-857c-c851891d599e" call-id="29" rc-code="7" op-status="0" interval="0" last-run="1378321251" last-rc-change="1378321251" exec-time="66" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" state op_sleep " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
</lrm_resource>
<lrm_resource id="remote1" type="remote" class="ocf" provider="pacemaker">
<lrm_rsc_op id="remote1_last_0" operation_key="remote1_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="20:1:7:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:7;20:1:7:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="3" rc-code="7" op-status="0" interval="0" op-digest="83190b903c8e0e440bfe3488502a0cd6"/>
</lrm_resource>
</lrm_resources>
</lrm>
</node_state>
<node_state remote_node="true" id="remote1" uname="remote1" crm-debug-origin="do_update_resource">
<lrm id="remote1">
<lrm_resources>
<lrm_resource id="rsc_18node1" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="rsc_18node1_last_0" operation_key="rsc_18node1_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="18:10:7:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:7;18:10:7:b39aace0-7880-42dc-bf88-a569319bb584" call-id="5" rc-code="7" op-status="0" interval="0" last-run="1378339468" last-rc-change="1378339468" exec-time="82" queue-time="0" op-digest="bf35e29e5fd031da0437b6dbc9ebb74b"/>
</lrm_resource>
<lrm_resource id="rsc_18node2" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="rsc_18node2_last_0" operation_key="rsc_18node2_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="32:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;32:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="16" rc-code="0" op-status="0" interval="0" last-run="1378339596" last-rc-change="1378339596" exec-time="49" queue-time="0" op-digest="5ab425702de20e415276371af97f8566"/>
<lrm_rsc_op id="rsc_18node2_monitor_5000" operation_key="rsc_18node2_monitor_5000" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="33:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;33:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="19" rc-code="0" op-status="0" interval="5000" last-rc-change="1378339596" exec-time="24" queue-time="0" op-digest="3c1c6f0057a1eeea9c65740335f392e6"/>
</lrm_resource>
<lrm_resource id="rsc_18node3" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="rsc_18node3_last_0" operation_key="rsc_18node3_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="20:10:7:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:7;20:10:7:b39aace0-7880-42dc-bf88-a569319bb584" call-id="13" rc-code="7" op-status="0" interval="0" last-run="1378339468" last-rc-change="1378339468" exec-time="38" queue-time="0" op-digest="19b33c0194f91788ea954e69150d9178"/>
</lrm_resource>
<lrm_resource id="migrator" type="Dummy" class="ocf" provider="pacemaker">
<lrm_rsc_op id="migrator_last_0" operation_key="migrator_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="21:10:7:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:7;21:10:7:b39aace0-7880-42dc-bf88-a569319bb584" call-id="17" rc-code="7" op-status="0" interval="0" last-run="1378339469" last-rc-change="1378339469" exec-time="11" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8" op-force-restart=" state op_sleep " op-restart-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
</lrm_resource>
<lrm_resource id="ping-1" type="ping" class="ocf" provider="pacemaker">
<lrm_rsc_op id="ping-1_last_0" operation_key="ping-1_start_0" operation="start" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="42:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:0;42:1:0:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="6" rc-code="0" op-status="0" interval="0" last-run="1378339595" last-rc-change="1378339595" exec-time="2087" queue-time="0" op-digest="a53fc9fb0118a43d3be0fceaf2348d38"/>
</lrm_resource>
<lrm_resource id="stateful-1" type="Stateful" class="ocf" provider="pacemaker">
<lrm_rsc_op id="stateful-1_last_0" operation_key="stateful-1_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="23:10:7:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:7;23:10:7:b39aace0-7880-42dc-bf88-a569319bb584" call-id="27" rc-code="7" op-status="0" interval="0" last-run="1378339469" last-rc-change="1378339469" exec-time="9" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
</lrm_resource>
<lrm_resource id="r192.168.122.87" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="r192.168.122.87_last_0" operation_key="r192.168.122.87_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="24:10:7:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:7;24:10:7:b39aace0-7880-42dc-bf88-a569319bb584" call-id="31" rc-code="7" op-status="0" interval="0" last-run="1378339470" last-rc-change="1378339470" exec-time="81" queue-time="0" op-digest="1f9cf34fdfbf3f26a102a160cbc32cee"/>
</lrm_resource>
<lrm_resource id="r192.168.122.88" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="r192.168.122.88_last_0" operation_key="r192.168.122.88_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="25:10:7:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:7;25:10:7:b39aace0-7880-42dc-bf88-a569319bb584" call-id="35" rc-code="7" op-status="0" interval="0" last-run="1378339470" last-rc-change="1378339470" exec-time="33" queue-time="0" op-digest="0ad87a820b9cba1ae10ab7f9e9221f43"/>
</lrm_resource>
<lrm_resource id="r192.168.122.89" type="IPaddr2" class="ocf" provider="heartbeat">
<lrm_rsc_op id="r192.168.122.89_last_0" operation_key="r192.168.122.89_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="26:10:7:b39aace0-7880-42dc-bf88-a569319bb584" transition-magic="0:7;26:10:7:b39aace0-7880-42dc-bf88-a569319bb584" call-id="39" rc-code="7" op-status="0" interval="0" last-run="1378339470" last-rc-change="1378339470" exec-time="35" queue-time="0" op-digest="c944796c1b514fc9ff85720a2686ea5b"/>
</lrm_resource>
<lrm_resource id="lsb-dummy" type="/usr/share/pacemaker/tests/cts/LSBDummy" class="lsb">
<lrm_rsc_op id="lsb-dummy_last_0" operation_key="lsb-dummy_monitor_0" operation="monitor" crm-debug-origin="do_update_resource" crm_feature_set="3.0.7" transition-key="22:1:7:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" transition-magic="0:7;22:1:7:0bfdf3b8-2fd3-483e-a4da-60cb59b14678" call-id="10" rc-code="7" op-status="0" interval="0" last-run="1378339595" last-rc-change="1378339595" exec-time="16" queue-time="0" op-digest="f2317cad3d54cec5d7d7aa7d0bf35cf8"/>
</lrm_resource>
</lrm_resources>
</lrm>
<transient_attributes id="remote1">
<instance_attributes id="status-remote1">
<nvpair id="status-remote1-probe_complete" name="probe_complete" value="true"/>
</instance_attributes>
</transient_attributes>
</node_state>
</status>
</cib>
| {
"pile_set_name": "Github"
} |
@import '~antd/es/style/themes/default.less';
.menu {
:global(.anticon) {
margin-right: 8px;
}
:global(.ant-dropdown-menu-item) {
min-width: 160px;
}
}
.dropDown {
line-height: @layout-header-height;
vertical-align: top;
cursor: pointer;
> span {
font-size: 16px !important;
transform: none !important;
svg {
position: relative;
top: -1px;
}
}
}
| {
"pile_set_name": "Github"
} |
45e617ca0c551f70d2d87313149a302ee4d4ba1b
19e7fc6f552ea199ea735b234ad1eecaca168dad
669c5c3ccd1ec54c7abc07278f0b08022e360c47
d33f54935b473edbfe1a49823b2a5bcf71c17d7e
6d1a47ee6554323a11fc5555ba21e02104ec30fa
605505b8bf167aad873fc700b02cc5a7389d7fe7
66b809792ad1cf9461f4592acf1cdd9111bf9ae6
a74ebc167a8f087aa9bfee250f6faa51ef05a378
f5ac779c8fd506e7d4b72b70331623042a807a6b
f6e73c88c7c971054ff3065507f1ab40df2c9b0b
c484869ce4b6c8c25a7ffe04cea6425831c45716
41eeac3a00971ccd5c04a9cabc10257278b45bd3
b3b0e5f685bce3e22943ad2fe292cb7aa64d4c50
3e0c142d6b656c490c28e0910628db5886dfc143
8ea8f206100a73b3ec47069633989e8b4b8046b6
d49bcc5e710bdae7746b79a6bfe8ce16b8ff84cb
3a9d4ea8d1056d50dbbe294987bfe2e7050e7fb0
3f1ffb5ee5dd6712999ca82371bf8b755c8a873f
fdbf978badb738bf7d5d05e1ccb30433e14a5ebc
751f21767211f5ad256dbe30fc3e1efd74485eba
804a40acf2689f3ad9bfeb7cd74f75b2a6d2b021
6eb4a83502ea3063a3c6171a71ec3216eb9ec6ce
fd7af0fcb483c2e308c453519156df31e9e1dce6
d3e07951977b2da99aa402aead708c90ff1f5a69
846cdb8cd32cac0bd6d739746f9368850ff5228d
7a80ecbebc8cf06bc77513380c64600ba9f1856b
51c9abcc5455c4c8d7e45fd25a2fa8657974227f
1d5f3ecdea636e837cedd0a21d7a73203071f4c2
9b5a8ef9cc1b9b3eaf2abdcd15a057502a7c1641
f02c6df5dd2a92a2637e5a0ce493a8cf79a0c351
0f8d41ec2ed3a7f7d0d28fe1c167b6480f80de3f
5675bfba9c4ae9e8d3fff00cb64074c131698d38
23c3868e904f76d3421a98d0d6944b30e09c3014
56c83a9bd7e4296fcef9f8eb336145e7956c87c8
422fafa3a87a7d6d2ca3c2197955df7b1e58efb8
1f484b74a3c0cd79d39efb6c9af5644f50054cd4
c4070d1ad35070c8df2914bf56ad554e18af4961
7a85595ecf040a310f5d3d2098ec4e40cfd704ff
70e9078f9d2df6dfb394a5016b5f6581b810e7a6
868573a9235d35cabe6f4d48aaa3589d289389a2
651bc9a1eea9e886f9c56a791e6f2a1263502cab
14ad09321b977ee738a1df59710ab765053f40ea
84ce13d3196800ed6c9643e808f47cc96f67e20c
40400734f766444779bd907aa7fc5cf375b5ba74
9de46ff09d575ee46ebc7ecaebe9e3cc368f9fc9
292ab2dcb3af0efe8e0b36b480fb914b2f763b6a
e7610aad54003b0cc78ca2f2f0ca51d6250e9dca
b0eea95e442ebc75f73b1f979de0494b33a831ff
ce79d1bee06b42a5d710baaec7bea519236749ba
69784162aeab9a6bbcdc1e1f502524eb796e70d2
5353af393112e6e5eda99bf19e0b02c36bfe3559
ab7ab346296d5c306e642590b21417d634c8abeb
1169569d23a1e028d9c6f6e0c4d1ffe6532d0d60
213480254030b94a10a3cae35dff7e9645f68be7
9a74e4b3a46ac1cc603502d2ef10768ceccb2d8f
3898d60b41ba2665f4e694f06d263fe558db97c5
3b403369fb1600f2cc6072585e439e92f7de096c
191ab40fd464a5b80b287e848f1a4ad7fcd572ae
8a5946cce468518feb9442cd2b9d09a801abbfb4
d9841ef6e14d1a6a369501402bf8fe5b607db0be
6d949fdfa29140662634aaf3fdc3657c99d278e1
cb7a464aa8d58f26f6561c32ef4a1464c583a7ca
3c8a6029e9a695a414a75ac3d06fd92809bd52c2
f348b1aec4cafc3fc004003458ce65636991d712
f7d9159b6f3eeff0cfc6626d665bc781a2b012df
eaaffa6ae25fdccda2bcb7dfaf205da41129548b
83e3de6d96b4f6b0309d0722e3196970de829b52
bd547812018e59be543d9742b01431eb2e5e2641
6db7f00564d28a5a236ee38a00da9405409357af
d3a0b7d4a07b89555c77f1f1425f7469df884088
7ae69340fbaada0e9017bd453dface505d397877
797dc9a1b70942b920f03e525fae0682aa05d394
3425969c064e382dfb0187be2876bb65b31419bf
fa965b0099cacbf64d428d267f13dcc21bb37ede
2e6324d71eed1573d2bc30a09f41e1204c38187d
fb550cc228b6a4fb2a254a782a0d5a5b3b96d8b2
f314c2e8f63d9662e63e803f6457a1708684a6d7
2f0a064230d406c9133def6d2a65830fd2c65f6a
78acd95139f4162a610dbd2d1dcbfd0c3ab99684
e0f41b99481a5822254d94c8b538eb51b106189e
48bd2075313b1731938ee82282dc2562fbaa6cb1
ebb450393809f657f1ab77b4582e0c4758f7b50d
fc07cb8e43a9901eb8cd779b5646d34477155cea
d1d7bc9ed506b364f7713e19a35692bad50c3304
6515109c55fd0673332c302f9cb68f9c2567457c
5fa1f033e64d3ca1e0e6d4afaa3e1cd5ede3c5b7
c608f2b7b0b893e8dcc092ecfcc8bd715f86fbc7
77025a5f4d714918ca22e92387ae7395be17ba65
2d767d0ede311cf3a853e90d18f50ae102358590
0c487d16c2bebb200342f1a7599799a858505b93
| {
"pile_set_name": "Github"
} |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
druid.metadata.storage.type=mysql
druid.metadata.storage.connector.connectURI=jdbc:mysql://localhost:3306/druid
druid.metadata.storage.connector.createTables=true
druid.metadata.storage.connector.password=diurd
druid.metadata.storage.connector.user=druid
druid.metadata.storage.tables.base=druid
druid.metadata.storage.tables.segments=druid_segments
druid.metadata.storage.tables.rules=druid_rules
druid.metadata.storage.tables.config=druid_config
druid.metadata.storage.tables.tasks=druid_tasks
druid.metadata.storage.tables.taskLog=druid_taskLog
druid.metadata.storage.tables.taskLock=druid_taskLock
druid.indexer.storage.type=metadata
druid.publish.type=metadata
druid.extensions.coordinates=["org.apache.druid.extensions:mysql-metadata-storage"]
leave.me.alone=xxx
| {
"pile_set_name": "Github"
} |
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- INJECT TEMPLATES. We can't put those safely and cleanly elsewhere (e.g. .hbs file) -->
<div id="templates_container" style="display:none">
<script type="text/x-handlebars-template" id="start_tmpl">
<div id="start" class="node start">
<i class="fa fa-play"></i>
<!-- <input required pattern="([a-zA-Z_]([\-_a-zA-Z0-9])*){1,39}" id="start_name" data-toggle="tooltip" class="editable" value="Start" placeholder="Start">
-->
</div>
</script>
<script type="text/x-handlebars-template" id="end_tmpl">
<div id="end" class="node end">
<i class="fa fa-stop"></i>
<!-- <input required pattern="([a-zA-Z_]([\-_a-zA-Z0-9])*){1,39}" id="start_name" data-toggle="tooltip" title="{{name}}" class="editable" value="End" placeholder="End"> -->
</div>
</script>
<script type="text/x-handlebars-template" id="dummy_tmpl">
<div id="{{id}}" data-type="" data-from="{{from}}" data-to="{{to}}" class="node branch">
<div class="dummyAction">{{label}}</div>
<!--input required disabled pattern="([a-zA-Z_]([\-_a-zA-Z0-9])*){1,39}" id="{{id}}_name" data-toggle="tooltip" title="{{name}}" class="{{dynClass}}" value="{{label}}" placeholder="Action Name">
<div class="node_actions node_left" onclick="{{delCallbackAsStr}}"><i class="fa fa-trash-o"></i></div-->
</div>
</script>
<script id="action_tmpl" type="text/x-handlebars-template">
<div id="{{id}}" class="node action_node {{classNames}} infoBackGround ">
<div class="node_actions node_left" onclick="{{delCallbackAsStr}}">
<i class="fa fa-trash-o"></i>
</div>
<div class="action_node_data">
<i class="fa fa-{{icon}}"></i>
<input required pattern="([a-zA-Z_]([\-_a-zA-Z0-9])*){1,39}" id="{{id}}_name" data-toggle="tooltip" title="{{name}}" class="editable" value="{{name}}" placeholder="Action Name">
</div>
<div class=" action_node_button">
<a data-toggle="modal" data-target="#sparkProperties">
<i class="fa fa-2x fa-cog node_properties" node_action="{{type}}" nodeId="{{id}}_name" onclick="{{modalCallbackHandler}}"></i>
</a>
</div>
</div>
</script>
<script id="notification" type="text/x-handlebars-template">
<div id="" class="notification">
<div class='alert alert-info'> <a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a> {{message}}</div>
</div>
</script>
<script id="fork_tmpl" type="text/x-handlebars-template">
<div id="fork_{{id}}" class="node fork control_flow_node" data-node-type="fork">
<i class="fa fa-sitemap"></i>
<br/>
<div class="node_actions node_left" onclick="{{delCallbackAsStr}}">
<i class="fa fa-trash-o"></i>
</div>
<input id="fork_{{id}}_name" required pattern="([a-zA-Z_]([\-_a-zA-Z0-9])*){1,39}" data-toggle="tooltip" title="{{name}}" class="editable" value="fork" placeholder="fork">
<div id="{{id}}_po" class="node_actions node_bottom" onclick="{{forkAddCallbackAsStr}}">
<i class="fa fa-plus"></i>
</div>
</div>
<div id="join_{{id}}" class="node join control_flow_node">
<i class="fa fa-sitemap fa-rotate-180"></i>
<br/>
<input required pattern="([a-zA-Z_]([\-_a-zA-Z0-9])*){1,39}" id="join_{{id}}_name" data-toggle="tooltip" title="{{name}}" class="editable" value="join" placeholder="join">
</div>
</script>
<script id="kill_tmpl" type="text/x-handlebars-template">
<div id="kill_{{id}}" class="node killNode">
<i class="fa fa-stop redColor"></i>
<input required pattern="([a-zA-Z_]([\-_a-zA-Z0-9])*){1,39}" data-toggle="tooltip" title="{{name}}" class="editable" value="{{name}}" placeholder="End">
</div>
</script>
<script id="condition_tmpl" type="text/x-handlebars-template">
<div id="{{id}}" class="node">
<input required pattern="([a-zA-Z_]([\-_a-zA-Z0-9])*){1,39}" name="{{id}}_name" data-toggle="tooltip" title="{{name}}" class="editable" value="{{name}}" placeholder="End">
</div>
</script>
<script id="decision_tmpl" type="text/x-handlebars-template">
<div id="decision_{{id}}" class="node decision_node control_flow_node {{classNames}} " data-node-type="decision">
<br/>
<div class="node_actions node_left" onclick="{{delCallbackAsStr}}">
<i class="fa fa-trash-o"></i>
</div> <!--input type="hidden" id="fork_{{id}}_name" required pattern="([a-zA-Z_]([\-_a-zA-Z0-9])*){1,39}" data-toggle="tooltip" title="{{name}}" class="editable" value="fork" placeholder="fork"-->
<div id="{{id}}_po" class="node_actions node_bottom decisionSplit" onclick="{{forkAddCallbackAsStr}}">
<i class="fa fa-plus"></i>
</div>
<div class=" action_node_button decisionNodeHandler">
<a data-toggle="modal" data-target="#sparkProperties">
<i class="fa fa-2x fa-cog node_properties" node_action="{{type}}" nodeId="decision_{{id}}" onclick="{{modalCallbackHandler}}"></i>
</a>
</div>
</div>
<div id="condJoin_{{id}}" class="node join control_flow_node condJoin">
<br/>
<!--input type="hidden" required pattern="([a-zA-Z_]([\-_a-zA-Z0-9])*){1,39}" id="join_{{id}}_name" data-toggle="tooltip" title="{{name}}" class="editable" value="join" placeholder="join"-->
</div>
<!--div id="{{id}}" class="node decision_node control_flow_node {{classNames}} ">
<div class="content">
<div class="node_actions node_left" onclick="{{delCallbackAsStr}}">
<i class="fa fa-trash-o"></i>
</div>
<div id="{{id}}_po" class="node_actions node_bottom action_node_button" >
<i class="fa fa-share-alt fa-rotate-90" node_action="{{type}}" nodeId={{id}}_name onclick="{{caseAddCallbackAsStr}}"></i>
</div>
<input type="hidden" class="decisionBox" required pattern="([a-zA-Z_]([\-_a-zA-Z0-9])*){1,39}" id="{{id}}_name" data-toggle="tooltip" title="{{name}}" class="editable" placeholder="Action Name" >
<div class=" action_node_button decisionNodeHandler">
<a data-toggle="modal" data-target="#sparkProperties">
<i class="fa fa-2x fa-cog node_properties" node_action="{{type}}" nodeId="{{id}}_name" onclick="{{modalCallbackHandler}}"></i>
</a>
</div>
</div>
</div-->
</script>
<script id="actions_list_tmpl" type="text/x-handlebars-template">
<h4>Control Flow Nodes</h4>
<ul class="actions_list_left control_flow">
<li onclick="{{onClick}}" data-name="fork" data-type="fork" class="dr_action _fork enabled"> <i class="fa fa-sitemap"></i> Fork </li>
<li onclick="{{onClick}}" class="dr_action switch enabled" data-name="Decision" data-type="decision"> <i class="fa fa-sliders"></i> Decision </li>
</ul>
<div class="clearfix"></div>
<h4>Action Nodes</h4>
<ul class="actions_list_left">
<li onclick="{{onClick}}" class="dr_action enabled" data-name="Hive" data-type="hive"> <i class="fa fa-cog"></i> Hive </li>
<li onclick="{{onClick}}" class="dr_action disabled hide" data-name="Hive" data-type="hive2"> <i class="fa fa-cog"></i> Hive2</li>
<li onclick="{{onClick}}" class="dr_action enabled" data-name="Sqoop" data-type="sqoop"> <i class="fa fa-database"></i> Sqoop </li>
<li onclick="{{onClick}}" class="dr_action enabled" data-name="Pig" data-type="pig"> <i class="fa fa-product-hunt"></i> Pig </li>
<li onclick="{{onClick}}" class="dr_action disabled hide" data-name="HDFS" data-type="hdfs"> <i class="fa fa-copy"></i> HDFS </li>
<li onclick="{{onClick}}" class="dr_action enabled" data-name="Java" data-type="java"> <i class="fa fa-code"></i> Java </li>
<li onclick="{{onClick}}" class="dr_action enabled" data-name="Shell" data-type="shell"> <i class="fa fa-terminal"></i> Shell </li>
<li class="dr_action disabled hide" data-name="distcp" data-type="distcp"> <i class="fa fa-clone"></i> distcp </li>
<li onclick="{{onClick}}" class="dr_action hide" data-name="MR" data-type="mr"> <i class="fa fa-asterisk"></i> MapRed </li>
<li class="dr_action disabled hide" data-name="SSH" data-type="ssh"> <i class="fa fa-terminal"></i> SSH </li>
<li onclick="{{onClick}}" class="dr_action enabled" data-name="Spark" data-type="spark"> <i class="fa fa-star"></i> Spark </li>
<li class="dr_action disabled hide" data-name="Stream" data-type="stream"> <i class="fa fa-exchange"></i> Stream </li>
<li class="dr_action disabled hide" data-name="Email" data-type="email"> <i class="fa fa-envelope"></i> Email </li>
</ul>
<div class="clearfix"></div>
</script>
</div> | {
"pile_set_name": "Github"
} |
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2019 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
#ifndef JOBVIEWWIDGET_H
#define JOBVIEWWIDGET_H
#include <QFrame>
namespace Ui {
class JobViewWidget;
}
class JobViewWidget : public QFrame
{
Q_OBJECT
public:
explicit JobViewWidget(QString title, QString icon, int capabilities, QWidget *parent = nullptr);
~JobViewWidget();
void setSuspended(bool suspended);
void setInfoMessage(QString message);
void setDescriptionField(uint number, QString name, QString value);
void clearDescriptionField(uint number);
void setPercent(uint percent);
signals:
void terminate();
void suspend();
private slots:
void on_pauseButton_clicked();
void on_cancelButton_clicked();
private:
Ui::JobViewWidget *ui;
};
#endif // JOBVIEWWIDGET_H
| {
"pile_set_name": "Github"
} |
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* 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.
*/
#ifndef MBED_SLEEP_API_H
#define MBED_SLEEP_API_H
#include "device.h"
#if DEVICE_SLEEP
#ifdef __cplusplus
extern "C" {
#endif
/** Send the microcontroller to sleep
*
* The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
* system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
* dynamic power used by the processor, memory systems and buses. The processor, peripheral and
* memory state are maintained, and the peripherals continue to work and can generate interrupts.
*
* The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
*
* @note
* The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
* Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
* able to access the LocalFileSystem
*/
void sleep(void);
/** Send the microcontroller to deep sleep
*
* This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
* has the same sleep features as sleep plus it powers down peripherals and clocks. All state
* is still maintained.
*
* The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
*
* @note
* The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
* Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
* able to access the LocalFileSystem
*/
void deepsleep(void);
#ifdef __cplusplus
}
#endif
#endif
#endif
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python
# Copyright (c) 2015 The Khronos Group Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and/or associated documentation files (the
# "Materials"), to deal in the Materials without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Materials, and to
# permit persons to whom the Materials are furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Materials.
#
# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
"""
Generator for tex-2d* and tex-3d* tests.
This file needs to be run in its folder.
"""
import os
import os.path
import sys
_LICENSE = """<!--
Copyright (c) 2015 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-->
"""
_DO_NOT_EDIT_WARNING = """<!--
This file is auto-generated from py/tex_image_test_generator.py
DO NOT EDIT!
-->
"""
_ELEMENT_TYPES = [
'canvas',
'canvas-sub-rectangle',
'image',
'image-data',
'svg-image',
'video',
'webgl-canvas',
'image-bitmap-from-image-data',
'image-bitmap-from-image',
'image-bitmap-from-video',
'image-bitmap-from-canvas',
'image-bitmap-from-blob',
'image-bitmap-from-image-bitmap'
]
_FORMATS_TYPES_WEBGL1 = [
{'internal_format': 'RGB', 'format': 'RGB', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'RGB', 'format': 'RGB', 'type': 'UNSIGNED_SHORT_5_6_5' },
{'internal_format': 'RGBA', 'format': 'RGBA', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'RGBA', 'format': 'RGBA', 'type': 'UNSIGNED_SHORT_4_4_4_4' },
{'internal_format': 'RGBA', 'format': 'RGBA', 'type': 'UNSIGNED_SHORT_5_5_5_1' },
]
_FORMATS_TYPES_WEBGL2 = [
{'internal_format': 'R8', 'format': 'RED', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'R16F', 'format': 'RED', 'type': 'HALF_FLOAT' },
{'internal_format': 'R16F', 'format': 'RED', 'type': 'FLOAT' },
{'internal_format': 'R32F', 'format': 'RED', 'type': 'FLOAT' },
{'internal_format': 'R8UI', 'format': 'RED_INTEGER', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'RG8', 'format': 'RG', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'RG16F', 'format': 'RG', 'type': 'HALF_FLOAT' },
{'internal_format': 'RG16F', 'format': 'RG', 'type': 'FLOAT' },
{'internal_format': 'RG32F', 'format': 'RG', 'type': 'FLOAT' },
{'internal_format': 'RG8UI', 'format': 'RG_INTEGER', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'RGB8', 'format': 'RGB', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'SRGB8', 'format': 'RGB', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'RGB565', 'format': 'RGB', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'RGB565', 'format': 'RGB', 'type': 'UNSIGNED_SHORT_5_6_5' },
{'internal_format': 'R11F_G11F_B10F', 'format': 'RGB', 'type': 'UNSIGNED_INT_10F_11F_11F_REV' },
{'internal_format': 'R11F_G11F_B10F', 'format': 'RGB', 'type': 'HALF_FLOAT' },
{'internal_format': 'R11F_G11F_B10F', 'format': 'RGB', 'type': 'FLOAT' },
{'internal_format': 'RGB9_E5', 'format': 'RGB', 'type': 'HALF_FLOAT' },
{'internal_format': 'RGB9_E5', 'format': 'RGB', 'type': 'FLOAT' },
{'internal_format': 'RGB16F', 'format': 'RGB', 'type': 'HALF_FLOAT' },
{'internal_format': 'RGB16F', 'format': 'RGB', 'type': 'FLOAT' },
{'internal_format': 'RGB32F', 'format': 'RGB', 'type': 'FLOAT' },
{'internal_format': 'RGB8UI', 'format': 'RGB_INTEGER', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'RGBA8', 'format': 'RGBA', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'SRGB8_ALPHA8', 'format': 'RGBA', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'RGB5_A1', 'format': 'RGBA', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'RGB5_A1', 'format': 'RGBA', 'type': 'UNSIGNED_SHORT_5_5_5_1' },
{'internal_format': 'RGBA4', 'format': 'RGBA', 'type': 'UNSIGNED_BYTE' },
{'internal_format': 'RGBA4', 'format': 'RGBA', 'type': 'UNSIGNED_SHORT_4_4_4_4' },
{'internal_format': 'RGBA16F', 'format': 'RGBA', 'type': 'HALF_FLOAT' },
{'internal_format': 'RGBA16F', 'format': 'RGBA', 'type': 'FLOAT' },
{'internal_format': 'RGBA32F', 'format': 'RGBA', 'type': 'FLOAT' },
{'internal_format': 'RGBA8UI', 'format': 'RGBA_INTEGER', 'type': 'UNSIGNED_BYTE' },
]
def GenerateFilename(dimension, element_type, internal_format, format, type):
"""Generate test filename."""
filename = ("tex-" + dimension + "d-" +
internal_format + "-" + format + "-" + type + ".html")
return filename.lower()
def WriteTest(filename, dimension, element_type, internal_format, format, type, default_context_version):
"""Write one test."""
file = open(filename, "wb")
file.write(_LICENSE)
file.write(_DO_NOT_EDIT_WARNING)
code = """
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../js/js-test-pre.js"></script>
<script src="../../../js/webgl-test-utils.js"></script>
<script src="../../../js/tests/tex-image-and-sub-image-utils.js"></script>"""
if element_type == 'image-bitmap-from-image-data' or element_type == 'image-bitmap-from-image' or \
element_type == 'image-bitmap-from-video' or element_type == 'image-bitmap-from-canvas' or \
element_type == 'image-bitmap-from-blob' or element_type == 'image-bitmap-from-image-bitmap':
code += """
<script src="../../../js/tests/tex-image-and-sub-image-with-image-bitmap-utils.js"></script>"""
code += """
<script src="../../../js/tests/tex-image-and-sub-image-%(dimension)sd-with-%(element_type)s.js"></script>
</head>
<body>"""
if element_type == 'image-data':
code += """
<canvas id="texcanvas" width="2" height="2"></canvas>"""
code += """
<canvas id="example" width="32" height="32"></canvas>"""
code += """
<div id="description"></div>
<div id="console"></div>
<script>
"use strict";
function testPrologue(gl) {
return true;
}
generateTest("%(internal_format)s", "%(format)s", "%(type)s", testPrologue, "../../../resources/", %(default_context_version)s)();
</script>
</body>
</html>
"""
file.write(code % {
'dimension': dimension,
'element_type': element_type,
'internal_format': internal_format,
'format': format,
'type': type,
'default_context_version': default_context_version,
})
file.close()
def GenerateTests(test_dir, test_cases, dimension, default_context_version):
test_dir_template = test_dir + '/%s'
for element_type in _ELEMENT_TYPES:
os.chdir(test_dir_template % element_type.replace('-', '_'))
if dimension == '3':
# Assume we write 2D tests first.
index_file = open("00_test_list.txt", "ab")
else:
index_file = open("00_test_list.txt", "wb")
for tex_info in test_cases:
internal_format = tex_info['internal_format']
format = tex_info['format']
type = tex_info['type']
filename = GenerateFilename(dimension, element_type, internal_format, format, type)
index_file.write(filename)
index_file.write('\n')
WriteTest(filename, dimension, element_type, internal_format, format, type, default_context_version)
index_file.close();
def main(argv):
"""This is the main function."""
py_dir = os.path.dirname(os.path.realpath(__file__))
GenerateTests(os.path.realpath(py_dir + '/../conformance/textures'), _FORMATS_TYPES_WEBGL1, '2', '1')
GenerateTests(os.path.realpath(py_dir + '/../conformance2/textures'), _FORMATS_TYPES_WEBGL2, '2', '2')
GenerateTests(os.path.realpath(py_dir + '/../conformance2/textures'), _FORMATS_TYPES_WEBGL2, '3', '2')
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
| {
"pile_set_name": "Github"
} |
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/PTPopupWebView.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "PTPopupWebView"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-PTPopupWebView_Tests
PODS_ROOT = ${SRCROOT}/Pods | {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>UnivariateStatistic (Apache Commons Math 3.3 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="UnivariateStatistic (Apache Commons Math 3.3 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/UnivariateStatistic.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/apache/commons/math3/stat/descriptive/SynchronizedSummaryStatistics.html" title="class in org.apache.commons.math3.stat.descriptive"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../../org/apache/commons/math3/stat/descriptive/WeightedEvaluation.html" title="interface in org.apache.commons.math3.stat.descriptive"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/math3/stat/descriptive/UnivariateStatistic.html" target="_top">Frames</a></li>
<li><a href="UnivariateStatistic.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.commons.math3.stat.descriptive</div>
<h2 title="Interface UnivariateStatistic" class="title">Interface UnivariateStatistic</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><a href="../../../../../../org/apache/commons/math3/util/MathArrays.Function.html" title="interface in org.apache.commons.math3.util">MathArrays.Function</a></dd>
</dl>
<dl>
<dt>All Known Subinterfaces:</dt>
<dd><a href="../../../../../../org/apache/commons/math3/stat/descriptive/StorelessUnivariateStatistic.html" title="interface in org.apache.commons.math3.stat.descriptive">StorelessUnivariateStatistic</a></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../../../org/apache/commons/math3/stat/descriptive/AbstractStorelessUnivariateStatistic.html" title="class in org.apache.commons.math3.stat.descriptive">AbstractStorelessUnivariateStatistic</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/AbstractUnivariateStatistic.html" title="class in org.apache.commons.math3.stat.descriptive">AbstractUnivariateStatistic</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/moment/GeometricMean.html" title="class in org.apache.commons.math3.stat.descriptive.moment">GeometricMean</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/moment/Kurtosis.html" title="class in org.apache.commons.math3.stat.descriptive.moment">Kurtosis</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/rank/Max.html" title="class in org.apache.commons.math3.stat.descriptive.rank">Max</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/moment/Mean.html" title="class in org.apache.commons.math3.stat.descriptive.moment">Mean</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/rank/Median.html" title="class in org.apache.commons.math3.stat.descriptive.rank">Median</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/rank/Min.html" title="class in org.apache.commons.math3.stat.descriptive.rank">Min</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/rank/Percentile.html" title="class in org.apache.commons.math3.stat.descriptive.rank">Percentile</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/summary/Product.html" title="class in org.apache.commons.math3.stat.descriptive.summary">Product</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/moment/SecondMoment.html" title="class in org.apache.commons.math3.stat.descriptive.moment">SecondMoment</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/moment/SemiVariance.html" title="class in org.apache.commons.math3.stat.descriptive.moment">SemiVariance</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/moment/Skewness.html" title="class in org.apache.commons.math3.stat.descriptive.moment">Skewness</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/moment/StandardDeviation.html" title="class in org.apache.commons.math3.stat.descriptive.moment">StandardDeviation</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/summary/Sum.html" title="class in org.apache.commons.math3.stat.descriptive.summary">Sum</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/summary/SumOfLogs.html" title="class in org.apache.commons.math3.stat.descriptive.summary">SumOfLogs</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/summary/SumOfSquares.html" title="class in org.apache.commons.math3.stat.descriptive.summary">SumOfSquares</a>, <a href="../../../../../../org/apache/commons/math3/stat/descriptive/moment/Variance.html" title="class in org.apache.commons.math3.stat.descriptive.moment">Variance</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="strong">UnivariateStatistic</span>
extends <a href="../../../../../../org/apache/commons/math3/util/MathArrays.Function.html" title="interface in org.apache.commons.math3.util">MathArrays.Function</a></pre>
<div class="block">Base interface implemented by all statistics.</div>
<dl><dt><span class="strong">Version:</span></dt>
<dd>$Id: UnivariateStatistic.java 1416643 2012-12-03 19:37:14Z tn $</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../org/apache/commons/math3/stat/descriptive/UnivariateStatistic.html" title="interface in org.apache.commons.math3.stat.descriptive">UnivariateStatistic</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/descriptive/UnivariateStatistic.html#copy()">copy</a></strong>()</code>
<div class="block">Returns a copy of the statistic with the same internal state.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/descriptive/UnivariateStatistic.html#evaluate(double[])">evaluate</a></strong>(double[] values)</code>
<div class="block">Returns the result of evaluating the statistic over the input array.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/stat/descriptive/UnivariateStatistic.html#evaluate(double[], int, int)">evaluate</a></strong>(double[] values,
int begin,
int length)</code>
<div class="block">Returns the result of evaluating the statistic over the specified entries
in the input array.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="evaluate(double[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>evaluate</h4>
<pre>double evaluate(double[] values)
throws <a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></pre>
<div class="block">Returns the result of evaluating the statistic over the input array.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/util/MathArrays.Function.html#evaluate(double[])">evaluate</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/util/MathArrays.Function.html" title="interface in org.apache.commons.math3.util">MathArrays.Function</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>values</code> - input array</dd>
<dt><span class="strong">Returns:</span></dt><dd>the value of the statistic applied to the input array</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></code> - if values is null</dd></dl>
</li>
</ul>
<a name="evaluate(double[], int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>evaluate</h4>
<pre>double evaluate(double[] values,
int begin,
int length)
throws <a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></pre>
<div class="block">Returns the result of evaluating the statistic over the specified entries
in the input array.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/util/MathArrays.Function.html#evaluate(double[], int, int)">evaluate</a></code> in interface <code><a href="../../../../../../org/apache/commons/math3/util/MathArrays.Function.html" title="interface in org.apache.commons.math3.util">MathArrays.Function</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>values</code> - the input array</dd><dd><code>begin</code> - the index of the first element to include</dd><dd><code>length</code> - the number of elements to include</dd>
<dt><span class="strong">Returns:</span></dt><dd>the value of the statistic applied to the included array entries</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/MathIllegalArgumentException.html" title="class in org.apache.commons.math3.exception">MathIllegalArgumentException</a></code> - if values is null or the indices are invalid</dd></dl>
</li>
</ul>
<a name="copy()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>copy</h4>
<pre><a href="../../../../../../org/apache/commons/math3/stat/descriptive/UnivariateStatistic.html" title="interface in org.apache.commons.math3.stat.descriptive">UnivariateStatistic</a> copy()</pre>
<div class="block">Returns a copy of the statistic with the same internal state.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>a copy of the statistic</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/UnivariateStatistic.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/apache/commons/math3/stat/descriptive/SynchronizedSummaryStatistics.html" title="class in org.apache.commons.math3.stat.descriptive"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../../org/apache/commons/math3/stat/descriptive/WeightedEvaluation.html" title="interface in org.apache.commons.math3.stat.descriptive"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/math3/stat/descriptive/UnivariateStatistic.html" target="_top">Frames</a></li>
<li><a href="UnivariateStatistic.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2003–2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="alpha"/>
<persistence-unit name="bravo" transaction-type="JTA">
<description>Persistence unit example2 for the unittest</description>
<provider>bravo.persistence.provider</provider>
<jta-data-source>bravo/jtaDS</jta-data-source>
<non-jta-data-source>bravo/nonJtaDS</non-jta-data-source>
<mapping-file>bravoMappingFile1.xml</mapping-file>
<mapping-file>bravoMappingFile2.xml</mapping-file>
<jar-file>bravoJarFile1.jar</jar-file>
<jar-file>bravoJarFile2.jar</jar-file>
<class>bravoClass1</class>
<class>bravoClass2</class>
<exclude-unlisted-classes/>
<properties>
<property name="some.prop" value="prop.value"/>
<property name="some.other.prop" value="another.prop.value"/>
</properties>
</persistence-unit>
<persistence-unit name="charlie" transaction-type="RESOURCE_LOCAL">
<description>Persistence unit example3 for the unittest</description>
<provider>charlie.persistence.provider</provider>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
<persistence-unit name="delta" transaction-type="RESOURCE_LOCAL">
<description>Persistence unit example3 for the unittest</description>
<provider>delta.persistence.provider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
</persistence-unit>
</persistence> | {
"pile_set_name": "Github"
} |
/* udis86 - libudis86/syn-intel.c
*
* Copyright (c) 2002-2013 Vivek Thampi
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "types.h"
#include "extern.h"
#include "decode.h"
#include "itab.h"
#include "syn.h"
#include "udint.h"
/* -----------------------------------------------------------------------------
* opr_cast() - Prints an operand cast.
* -----------------------------------------------------------------------------
*/
static void
opr_cast(struct ud* u, struct ud_operand* op)
{
if (u->br_far) {
ud_asmprintf(u, "far ");
}
switch(op->size) {
case 8: ud_asmprintf(u, "byte " ); break;
case 16: ud_asmprintf(u, "word " ); break;
case 32: ud_asmprintf(u, "dword "); break;
case 64: ud_asmprintf(u, "qword "); break;
case 80: ud_asmprintf(u, "tword "); break;
case 128: ud_asmprintf(u, "oword "); break;
case 256: ud_asmprintf(u, "yword "); break;
default: break;
}
}
/* -----------------------------------------------------------------------------
* gen_operand() - Generates assembly output for each operand.
* -----------------------------------------------------------------------------
*/
static void gen_operand(struct ud* u, struct ud_operand* op, int syn_cast)
{
switch(op->type) {
case UD_OP_REG:
ud_asmprintf(u, "%s", ud_reg_tab[op->base - UD_R_AL]);
break;
case UD_OP_MEM:
if (syn_cast) {
opr_cast(u, op);
}
ud_asmprintf(u, "[");
if (u->pfx_seg) {
ud_asmprintf(u, "%s:", ud_reg_tab[u->pfx_seg - UD_R_AL]);
}
if (op->base) {
ud_asmprintf(u, "%s", ud_reg_tab[op->base - UD_R_AL]);
}
if (op->index) {
ud_asmprintf(u, "%s%s", op->base != UD_NONE? "+" : "",
ud_reg_tab[op->index - UD_R_AL]);
if (op->scale) {
ud_asmprintf(u, "*%d", op->scale);
}
}
if (op->offset != 0) {
ud_syn_print_mem_disp(u, op, (op->base != UD_NONE ||
op->index != UD_NONE) ? 1 : 0);
}
ud_asmprintf(u, "]");
break;
case UD_OP_IMM:
ud_syn_print_imm(u, op);
break;
case UD_OP_JIMM:
ud_syn_print_addr(u, ud_syn_rel_target(u, op));
break;
case UD_OP_PTR:
switch (op->size) {
case 32:
ud_asmprintf(u, "word 0x%x:0x%x", op->lval.ptr.seg,
op->lval.ptr.off & 0xFFFF);
break;
case 48:
ud_asmprintf(u, "dword 0x%x:0x%x", op->lval.ptr.seg,
op->lval.ptr.off);
break;
}
break;
case UD_OP_CONST:
if (syn_cast) opr_cast(u, op);
ud_asmprintf(u, "%d", op->lval.udword);
break;
default: return;
}
}
/* =============================================================================
* translates to intel syntax
* =============================================================================
*/
extern void
ud_translate_intel(struct ud* u)
{
/* check if P_OSO prefix is used */
if (!P_OSO(u->itab_entry->prefix) && u->pfx_opr) {
switch (u->dis_mode) {
case 16: ud_asmprintf(u, "o32 "); break;
case 32:
case 64: ud_asmprintf(u, "o16 "); break;
}
}
/* check if P_ASO prefix was used */
if (!P_ASO(u->itab_entry->prefix) && u->pfx_adr) {
switch (u->dis_mode) {
case 16: ud_asmprintf(u, "a32 "); break;
case 32: ud_asmprintf(u, "a16 "); break;
case 64: ud_asmprintf(u, "a32 "); break;
}
}
if (u->pfx_seg &&
u->operand[0].type != UD_OP_MEM &&
u->operand[1].type != UD_OP_MEM ) {
ud_asmprintf(u, "%s ", ud_reg_tab[u->pfx_seg - UD_R_AL]);
}
if (u->pfx_lock) {
ud_asmprintf(u, "lock ");
}
if (u->pfx_rep) {
ud_asmprintf(u, "rep ");
} else if (u->pfx_repe) {
ud_asmprintf(u, "repe ");
} else if (u->pfx_repne) {
ud_asmprintf(u, "repne ");
}
/* print the instruction mnemonic */
ud_asmprintf(u, "%s", ud_lookup_mnemonic(u->mnemonic));
if (u->operand[0].type != UD_NONE) {
int cast = 0;
ud_asmprintf(u, " ");
if (u->operand[0].type == UD_OP_MEM) {
if (u->operand[1].type == UD_OP_IMM ||
u->operand[1].type == UD_OP_CONST ||
u->operand[1].type == UD_NONE ||
(u->operand[0].size != u->operand[1].size)) {
cast = 1;
} else if (u->operand[1].type == UD_OP_REG &&
u->operand[1].base == UD_R_CL) {
switch (u->mnemonic) {
case UD_Ircl:
case UD_Irol:
case UD_Iror:
case UD_Ircr:
case UD_Ishl:
case UD_Ishr:
case UD_Isar:
cast = 1;
break;
default: break;
}
}
}
gen_operand(u, &u->operand[0], cast);
}
if (u->operand[1].type != UD_NONE) {
int cast = 0;
ud_asmprintf(u, ", ");
if (u->operand[1].type == UD_OP_MEM &&
u->operand[0].size != u->operand[1].size &&
!ud_opr_is_sreg(&u->operand[0])) {
cast = 1;
}
gen_operand(u, &u->operand[1], cast);
}
if (u->operand[2].type != UD_NONE) {
int cast = 0;
ud_asmprintf(u, ", ");
if (u->operand[2].type == UD_OP_MEM &&
u->operand[2].size != u->operand[1].size) {
cast = 1;
}
gen_operand(u, &u->operand[2], cast);
}
if (u->operand[3].type != UD_NONE) {
ud_asmprintf(u, ", ");
gen_operand(u, &u->operand[3], 0);
}
}
/*
vim: set ts=2 sw=2 expandtab
*/
| {
"pile_set_name": "Github"
} |
package com.viadee.sonarquest.services;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.viadee.sonarquest.constants.AdventureState;
import com.viadee.sonarquest.constants.QuestState;
import com.viadee.sonarquest.constants.SkillType;
import com.viadee.sonarquest.entities.Adventure;
import com.viadee.sonarquest.entities.Artefact;
import com.viadee.sonarquest.entities.Participation;
import com.viadee.sonarquest.entities.Quest;
import com.viadee.sonarquest.entities.Skill;
import com.viadee.sonarquest.entities.Task;
import com.viadee.sonarquest.entities.User;
import com.viadee.sonarquest.interfaces.UserGratification;
@Service
public class GratificationService implements UserGratification {
private static final Logger LOGGER = LoggerFactory.getLogger(GratificationService.class);
private final UserService userService;
private final LevelService levelService;
public GratificationService(UserService userService, LevelService levelService) {
this.userService = userService;
this.levelService = levelService;
}
@Override
@Transactional
public synchronized void rewardUserForSolvingTask(final Task task) {
LOGGER.debug("Task ID {} has changed the status from OPEN to SOLVED, rewarding users...", task.getId());
final Participation participation = task.getParticipation();
if (participation != null) {
final User user = participation.getUser();
LOGGER.info("Task {} solved - Rewarding userID {} with {} gold and {} xp",
task.getKey(), user.getId(), task.getGold(), task.getXp());
user.addXp(task.getXp());
user.addGold(task.getGold());
addSkillReward(user);
user.setLevel(levelService.getLevelByUserXp(user.getXp()));
userService.save(user);
} else {
LOGGER.info("No SQUser participations found for task {}, so no rewards are paid out", task.getKey());
}
}
private void rewardUserForSolvingAdventure(final User user, final Adventure adventure) {
if (adventure.getStatus() != AdventureState.SOLVED) {
LOGGER.info("Adventure {} solved - Rewarding userID {} with {} gold and {} xp",
adventure.getId(), user.getId(), adventure.getGold(), adventure.getXp());
user.addGold(adventure.getGold());
user.addXp(adventure.getXp());
user.setLevel(levelService.getLevelByUserXp(user.getXp()));
userService.save(user);
} else {
LOGGER.warn("Adventure with ID {} is called for rewarding but is already solved. No rewards will be paid out.",
adventure.getId());
}
}
@Override
@Transactional
public void rewardUsersForSolvingQuest(final Quest quest) {
if (quest.getStatus() != QuestState.SOLVED) {
final List<Participation> participations = quest.getParticipations();
// First, find all Users only once that participated
Set<User> usersThatTookPart = new HashSet<>();
for (Participation participation : participations) {
usersThatTookPart.add(participation.getUser());
}
LOGGER.info("A Quest has been solved by the following user IDs: {} and now the quest reward will be paid out to everyone.",
(Object) usersThatTookPart.stream().map(User::getId).toArray());
// Now, reward them
for (User user : usersThatTookPart) {
rewardQuestParticipation(quest, user);
}
} else {
LOGGER.warn("Quest with ID {} is called for rewarding but is already solved. No rewards will be paid out.",
quest.getId());
}
}
@Override
public void rewardUsersForSolvingAdventure(final Adventure adventure) {
final List<User> users = adventure.getUsers();
users.forEach(user -> rewardUserForSolvingAdventure(user, adventure));
}
private void rewardQuestParticipation(Quest quest, User user) {
LOGGER.info("Rewarding participation in solving quest {} - Rewarding userID {} with {} gold and {} xp",
quest.getId(), user.getId(), quest.getGold(), quest.getXp());
user.addGold(quest.getGold());
user.addXp(quest.getXp());
user.setLevel(levelService.getLevelByUserXp(user.getXp()));
userService.save(user);
}
private User addSkillReward(final User user) {
final User rewardedUser = user;
final List<Skill> avatarClassSkills = rewardedUser.getAvatarClass().getSkills();
final List<Skill> artefactSkills = rewardedUser.getArtefacts().stream()
.map(Artefact::getSkills)
.flatMap(Collection::stream)
.collect(Collectors.toList());
final List<Skill> totalSkills = new ArrayList<>();
totalSkills.addAll(avatarClassSkills);
totalSkills.addAll(artefactSkills);
final Long extraGold = totalSkills.stream()
.filter(skill -> skill.getType().equals(SkillType.GOLD))
.mapToLong(Skill::getValue)
.sum();
final Long extraXP = totalSkills.stream()
.filter(skill -> skill.getType().equals(SkillType.XP))
.mapToLong(Skill::getValue)
.sum();
LOGGER.info("Adding skill rewards to user ID {} - extra gold {} and extra xp {}",
user.getId(), extraGold, extraXP);
rewardedUser.addGold(extraGold);
rewardedUser.addXp(extraXP);
return rewardedUser;
}
}
| {
"pile_set_name": "Github"
} |
test:
@node_modules/.bin/tape test.js
.PHONY: test
| {
"pile_set_name": "Github"
} |
// Code generated by smithy-go-codegen DO NOT EDIT.
package appstream
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/retry"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/appstream/types"
smithy "github.com/awslabs/smithy-go"
"github.com/awslabs/smithy-go/middleware"
smithyhttp "github.com/awslabs/smithy-go/transport/http"
)
// Deletes the specified image builder and releases the capacity.
func (c *Client) DeleteImageBuilder(ctx context.Context, params *DeleteImageBuilderInput, optFns ...func(*Options)) (*DeleteImageBuilderOutput, error) {
stack := middleware.NewStack("DeleteImageBuilder", smithyhttp.NewStackRequest)
options := c.options.Copy()
for _, fn := range optFns {
fn(&options)
}
addawsAwsjson11_serdeOpDeleteImageBuilderMiddlewares(stack)
awsmiddleware.AddRequestInvocationIDMiddleware(stack)
smithyhttp.AddContentLengthMiddleware(stack)
AddResolveEndpointMiddleware(stack, options)
v4.AddComputePayloadSHA256Middleware(stack)
retry.AddRetryMiddlewares(stack, options)
addHTTPSignerV4Middleware(stack, options)
awsmiddleware.AddAttemptClockSkewMiddleware(stack)
addClientUserAgent(stack)
smithyhttp.AddErrorCloseResponseBodyMiddleware(stack)
smithyhttp.AddCloseResponseBodyMiddleware(stack)
addOpDeleteImageBuilderValidationMiddleware(stack)
stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteImageBuilder(options.Region), middleware.Before)
addRequestIDRetrieverMiddleware(stack)
addResponseErrorMiddleware(stack)
for _, fn := range options.APIOptions {
if err := fn(stack); err != nil {
return nil, err
}
}
handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack)
result, metadata, err := handler.Handle(ctx, params)
if err != nil {
return nil, &smithy.OperationError{
ServiceID: ServiceID,
OperationName: "DeleteImageBuilder",
Err: err,
}
}
out := result.(*DeleteImageBuilderOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteImageBuilderInput struct {
// The name of the image builder.
Name *string
}
type DeleteImageBuilderOutput struct {
// Information about the image builder.
ImageBuilder *types.ImageBuilder
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
}
func addawsAwsjson11_serdeOpDeleteImageBuilderMiddlewares(stack *middleware.Stack) {
stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteImageBuilder{}, middleware.After)
stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteImageBuilder{}, middleware.After)
}
func newServiceMetadataMiddleware_opDeleteImageBuilder(region string) awsmiddleware.RegisterServiceMetadata {
return awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "appstream",
OperationName: "DeleteImageBuilder",
}
}
| {
"pile_set_name": "Github"
} |
apiVersion: v1
description: Shared Configurable Helpers test-01
name: ibm-sch-test01
version: 1.2.6
| {
"pile_set_name": "Github"
} |
"use strict";var exports=module.exports={};
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.storages = exports.purgeStoredState = exports.persistStore = exports.getStoredState = exports.createTransform = exports.createPersistor = exports.autoRehydrate = undefined;
var _asyncLocalStorage = require('./defaults/asyncLocalStorage.js');
var _asyncLocalStorage2 = _interopRequireDefault(_asyncLocalStorage);
var _autoRehydrate = require('./autoRehydrate.js');
var _autoRehydrate2 = _interopRequireDefault(_autoRehydrate);
var _createPersistor = require('./createPersistor.js');
var _createPersistor2 = _interopRequireDefault(_createPersistor);
var _createTransform = require('./createTransform.js');
var _createTransform2 = _interopRequireDefault(_createTransform);
var _getStoredState = require('./getStoredState.js');
var _getStoredState2 = _interopRequireDefault(_getStoredState);
var _persistStore = require('./persistStore.js');
var _persistStore2 = _interopRequireDefault(_persistStore);
var _purgeStoredState = require('./purgeStoredState.js');
var _purgeStoredState2 = _interopRequireDefault(_purgeStoredState);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var storageDeprecatedMessage = function storageDeprecatedMessage(type) {
return '\n To import async' + type + 'Storage please import from \'redux-persist/storages\'. For Example:\n `import { async' + type + 'Storage } from \'redux-persist/storages\'`\n or `var async' + type + 'Storage = require(\'redux-persist/storages\').async' + type + 'Storage`\n';
};
var storages = {
asyncLocalStorage: (0, _asyncLocalStorage2.default)('local', { deprecated: storageDeprecatedMessage('Local') }),
asyncSessionStorage: (0, _asyncLocalStorage2.default)('session', { deprecated: storageDeprecatedMessage('Session') })
};
exports.autoRehydrate = _autoRehydrate2.default;
exports.createPersistor = _createPersistor2.default;
exports.createTransform = _createTransform2.default;
exports.getStoredState = _getStoredState2.default;
exports.persistStore = _persistStore2.default;
exports.purgeStoredState = _purgeStoredState2.default;
exports.storages = storages;
//# sourceMappingURL=data:application/json;charset=utf-8;base64;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbInN0b3JhZ2VEZXByZWNhdGVkTWVzc2FnZSIsInR5cGUiLCJzdG9yYWdlcyIsImFzeW5jTG9jYWxTdG9yYWdlIiwiZGVwcmVjYXRlZCIsImFzeW5jU2Vzc2lvblN0b3JhZ2UiLCJhdXRvUmVoeWRyYXRlIiwiY3JlYXRlUGVyc2lzdG9yIiwiY3JlYXRlVHJhbnNmb3JtIiwiZ2V0U3RvcmVkU3RhdGUiLCJwZXJzaXN0U3RvcmUiLCJwdXJnZVN0b3JlZFN0YXRlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUE7Ozs7QUFFQTs7OztBQUNBOzs7O0FBQ0E7Ozs7QUFDQTs7OztBQUNBOzs7O0FBQ0E7Ozs7OztBQUVBLElBQUlBLDJCQUEyQixTQUFTQSx3QkFBVCxDQUFrQ0MsSUFBbEMsRUFBd0M7QUFDckUsU0FBTyx3QkFBd0JBLElBQXhCLEdBQStCLHdGQUEvQixHQUEwSEEsSUFBMUgsR0FBaUksNkRBQWpJLEdBQWlNQSxJQUFqTSxHQUF3TSxxREFBeE0sR0FBZ1FBLElBQWhRLEdBQXVRLFlBQTlRO0FBQ0QsQ0FGRDs7QUFJQSxJQUFJQyxXQUFXO0FBQ2JDLHFCQUFtQixpQ0FBd0IsT0FBeEIsRUFBaUMsRUFBRUMsWUFBWUoseUJBQXlCLE9BQXpCLENBQWQsRUFBakMsQ0FETjtBQUViSyx1QkFBcUIsaUNBQXdCLFNBQXhCLEVBQW1DLEVBQUVELFlBQVlKLHlCQUF5QixTQUF6QixDQUFkLEVBQW5DO0FBRlIsQ0FBZjs7UUFLU00sYTtRQUFlQyxlO1FBQWlCQyxlO1FBQWlCQyxjO1FBQWdCQyxZO1FBQWNDLGdCO1FBQWtCVCxRLEdBQUFBLFEiLCJmaWxlIjoidW5rbm93biIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBjcmVhdGVBc3luY0xvY2FsU3RvcmFnZSBmcm9tICcuL2RlZmF1bHRzL2FzeW5jTG9jYWxTdG9yYWdlJztcblxuaW1wb3J0IGF1dG9SZWh5ZHJhdGUgZnJvbSAnLi9hdXRvUmVoeWRyYXRlJztcbmltcG9ydCBjcmVhdGVQZXJzaXN0b3IgZnJvbSAnLi9jcmVhdGVQZXJzaXN0b3InO1xuaW1wb3J0IGNyZWF0ZVRyYW5zZm9ybSBmcm9tICcuL2NyZWF0ZVRyYW5zZm9ybSc7XG5pbXBvcnQgZ2V0U3RvcmVkU3RhdGUgZnJvbSAnLi9nZXRTdG9yZWRTdGF0ZSc7XG5pbXBvcnQgcGVyc2lzdFN0b3JlIGZyb20gJy4vcGVyc2lzdFN0b3JlJztcbmltcG9ydCBwdXJnZVN0b3JlZFN0YXRlIGZyb20gJy4vcHVyZ2VTdG9yZWRTdGF0ZSc7XG5cbnZhciBzdG9yYWdlRGVwcmVjYXRlZE1lc3NhZ2UgPSBmdW5jdGlvbiBzdG9yYWdlRGVwcmVjYXRlZE1lc3NhZ2UodHlwZSkge1xuICByZXR1cm4gJ1xcbiAgVG8gaW1wb3J0IGFzeW5jJyArIHR5cGUgKyAnU3RvcmFnZSBwbGVhc2UgaW1wb3J0IGZyb20gXFwncmVkdXgtcGVyc2lzdC9zdG9yYWdlc1xcJy4gRm9yIEV4YW1wbGU6XFxuICBgaW1wb3J0IHsgYXN5bmMnICsgdHlwZSArICdTdG9yYWdlIH0gZnJvbSBcXCdyZWR1eC1wZXJzaXN0L3N0b3JhZ2VzXFwnYFxcbiAgb3IgYHZhciBhc3luYycgKyB0eXBlICsgJ1N0b3JhZ2UgPSByZXF1aXJlKFxcJ3JlZHV4LXBlcnNpc3Qvc3RvcmFnZXNcXCcpLmFzeW5jJyArIHR5cGUgKyAnU3RvcmFnZWBcXG4nO1xufTtcblxudmFyIHN0b3JhZ2VzID0ge1xuICBhc3luY0xvY2FsU3RvcmFnZTogY3JlYXRlQXN5bmNMb2NhbFN0b3JhZ2UoJ2xvY2FsJywgeyBkZXByZWNhdGVkOiBzdG9yYWdlRGVwcmVjYXRlZE1lc3NhZ2UoJ0xvY2FsJykgfSksXG4gIGFzeW5jU2Vzc2lvblN0b3JhZ2U6IGNyZWF0ZUFzeW5jTG9jYWxTdG9yYWdlKCdzZXNzaW9uJywgeyBkZXByZWNhdGVkOiBzdG9yYWdlRGVwcmVjYXRlZE1lc3NhZ2UoJ1Nlc3Npb24nKSB9KVxufTtcblxuZXhwb3J0IHsgYXV0b1JlaHlkcmF0ZSwgY3JlYXRlUGVyc2lzdG9yLCBjcmVhdGVUcmFuc2Zvcm0sIGdldFN0b3JlZFN0YXRlLCBwZXJzaXN0U3RvcmUsIHB1cmdlU3RvcmVkU3RhdGUsIHN0b3JhZ2VzIH07Il19 | {
"pile_set_name": "Github"
} |
/******************************************************************************
* $Id: cplgetsymbol.cpp 13271 2007-12-06 04:44:19Z warmerdam $
*
* Project: Common Portability Library
* Purpose: Fetch a function pointer from a shared library / DLL.
* Author: Frank Warmerdam, [email protected]
*
******************************************************************************
* Copyright (c) 1999, Frank Warmerdam
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
****************************************************************************/
#include "cpl_conv.h"
CPL_CVSID("$Id: cplgetsymbol.cpp 13271 2007-12-06 04:44:19Z warmerdam $");
/* ==================================================================== */
/* Unix Implementation */
/* ==================================================================== */
#if defined(HAVE_DLFCN_H)
#define GOT_GETSYMBOL
#include <dlfcn.h>
/************************************************************************/
/* CPLGetSymbol() */
/************************************************************************/
/**
* Fetch a function pointer from a shared library / DLL.
*
* This function is meant to abstract access to shared libraries and
* DLLs and performs functions similar to dlopen()/dlsym() on Unix and
* LoadLibrary() / GetProcAddress() on Windows.
*
* If no support for loading entry points from a shared library is available
* this function will always return NULL. Rules on when this function
* issues a CPLError() or not are not currently well defined, and will have
* to be resolved in the future.
*
* Currently CPLGetSymbol() doesn't try to:
* <ul>
* <li> prevent the reference count on the library from going up
* for every request, or given any opportunity to unload
* the library.
* <li> Attempt to look for the library in non-standard
* locations.
* <li> Attempt to try variations on the symbol name, like
* pre-prending or post-pending an underscore.
* </ul>
*
* Some of these issues may be worked on in the future.
*
* @param pszLibrary the name of the shared library or DLL containing
* the function. May contain path to file. If not system supplies search
* paths will be used.
* @param pszSymbolName the name of the function to fetch a pointer to.
* @return A pointer to the function if found, or NULL if the function isn't
* found, or the shared library can't be loaded.
*/
void *CPLGetSymbol( const char * pszLibrary, const char * pszSymbolName )
{
void *pLibrary;
void *pSymbol;
pLibrary = dlopen(pszLibrary, RTLD_LAZY);
if( pLibrary == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"%s", dlerror() );
return NULL;
}
pSymbol = dlsym( pLibrary, pszSymbolName );
#if (defined(__APPLE__) && defined(__MACH__))
/* On mach-o systems, C symbols have a leading underscore and depending
* on how dlcompat is configured it may or may not add the leading
* underscore. So if dlsym() fails add an underscore and try again.
*/
if( pSymbol == NULL )
{
char withUnder[strlen(pszSymbolName) + 2];
withUnder[0] = '_'; withUnder[1] = 0;
strcat(withUnder, pszSymbolName);
pSymbol = dlsym( pLibrary, withUnder );
}
#endif
if( pSymbol == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"%s", dlerror() );
return NULL;
}
return( pSymbol );
}
#endif /* def __unix__ && defined(HAVE_DLFCN_H) */
/* ==================================================================== */
/* Windows Implementation */
/* ==================================================================== */
#if defined(WIN32) && !defined(WIN32CE)
#define GOT_GETSYMBOL
#include <windows.h>
/************************************************************************/
/* CPLGetSymbol() */
/************************************************************************/
void *CPLGetSymbol( const char * pszLibrary, const char * pszSymbolName )
{
void *pLibrary;
void *pSymbol;
pLibrary = LoadLibrary(pszLibrary);
if( pLibrary == NULL )
{
LPVOID lpMsgBuf = NULL;
int nLastError = GetLastError();
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, nLastError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0, NULL );
CPLError( CE_Failure, CPLE_AppDefined,
"Can't load requested DLL: %s\n%d: %s",
pszLibrary, nLastError, (const char *) lpMsgBuf );
return NULL;
}
pSymbol = (void *) GetProcAddress( (HINSTANCE) pLibrary, pszSymbolName );
if( pSymbol == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Can't find requested entry point: %s\n", pszSymbolName );
return NULL;
}
return( pSymbol );
}
#endif /* def _WIN32 */
/* ==================================================================== */
/* Windows CE Implementation */
/* ==================================================================== */
#if defined(WIN32CE)
#define GOT_GETSYMBOL
#include "cpl_win32ce_api.h"
/************************************************************************/
/* CPLGetSymbol() */
/************************************************************************/
void *CPLGetSymbol( const char * pszLibrary, const char * pszSymbolName )
{
void *pLibrary;
void *pSymbol;
pLibrary = CE_LoadLibraryA(pszLibrary);
if( pLibrary == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Can't load requested DLL: %s", pszLibrary );
return NULL;
}
pSymbol = (void *) CE_GetProcAddressA( (HINSTANCE) pLibrary, pszSymbolName );
if( pSymbol == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Can't find requested entry point: %s\n", pszSymbolName );
return NULL;
}
return( pSymbol );
}
#endif /* def WIN32CE */
/* ==================================================================== */
/* Dummy implementation. */
/* ==================================================================== */
#ifndef GOT_GETSYMBOL
/************************************************************************/
/* CPLGetSymbol() */
/* */
/* Dummy implementation. */
/************************************************************************/
void *CPLGetSymbol(const char *pszLibrary, const char *pszEntryPoint)
{
CPLDebug( "CPL",
"CPLGetSymbol(%s,%s) called. Failed as this is stub"
" implementation.", pszLibrary, pszEntryPoint );
return NULL;
}
#endif
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Qt 4.6: application.qrc Example File (mainwindows/application/application.qrc)</title>
<link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="functions.html"><font color="#004faf">All Functions</font></a> · <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">application.qrc Example File<br /><span class="small-subtitle">mainwindows/application/application.qrc</span>
</h1>
<pre> <!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>images/copy.png</file>
<file>images/cut.png</file>
<file>images/new.png</file>
<file>images/open.png</file>
<file>images/paste.png</file>
<file>images/save.png</file>
</qresource>
</RCC></pre>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="40%" align="right"><div align="right">Qt 4.6.0</div></td>
</tr></table></div></address></body>
</html>
| {
"pile_set_name": "Github"
} |
// Copyright (C) 2004-2006 The Trustees of Indiana University.
// 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)
// Authors: Douglas Gregor
// Andrew Lumsdaine
#ifndef BOOST_GRAPH_LOCAL_SUBGRAPH_HPP
#define BOOST_GRAPH_LOCAL_SUBGRAPH_HPP
#ifndef BOOST_GRAPH_USE_MPI
#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
#endif
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/filtered_graph.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/graph/parallel/container_traits.hpp>
namespace boost {
namespace graph { namespace detail {
// Optionally, virtually derive from a base class
template<bool Derive, typename Base> struct derive_from_if;
template<typename Base> struct derive_from_if<true, Base> : virtual Base {};
template<typename Base> struct derive_from_if<false, Base> {};
template<typename NewBase, typename Tag, typename OldBase = NewBase>
struct derive_from_if_tag_is :
derive_from_if<(is_base_and_derived<OldBase, Tag>::value
|| is_same<OldBase, Tag>::value),
NewBase>
{
};
} } // end namespace graph::detail
template<typename DistributedGraph>
class is_local_edge
{
public:
typedef bool result_type;
typedef typename graph_traits<DistributedGraph>::edge_descriptor
argument_type;
is_local_edge() : g(0) {}
is_local_edge(DistributedGraph& g) : g(&g), owner(get(vertex_owner, g)) {}
// Since either the source or target vertex must be local, the
// equivalence of their owners indicates a local edge.
result_type operator()(const argument_type& e) const
{ return get(owner, source(e, *g)) == get(owner, target(e, *g)); }
private:
DistributedGraph* g;
typename property_map<DistributedGraph, vertex_owner_t>::const_type owner;
};
template<typename DistributedGraph>
class is_local_vertex
{
public:
typedef bool result_type;
typedef typename graph_traits<DistributedGraph>::vertex_descriptor
argument_type;
is_local_vertex() : g(0) {}
is_local_vertex(DistributedGraph& g) : g(&g), owner(get(vertex_owner, g)) { }
// Since either the source or target vertex must be local, the
// equivalence of their owners indicates a local edge.
result_type operator()(const argument_type& v) const
{
return get(owner, v) == process_id(process_group(*g));
}
private:
DistributedGraph* g;
typename property_map<DistributedGraph, vertex_owner_t>::const_type owner;
};
template<typename DistributedGraph>
class local_subgraph
: public filtered_graph<DistributedGraph,
is_local_edge<DistributedGraph>,
is_local_vertex<DistributedGraph> >
{
typedef filtered_graph<DistributedGraph,
is_local_edge<DistributedGraph>,
is_local_vertex<DistributedGraph> >
inherited;
typedef typename graph_traits<DistributedGraph>::traversal_category
inherited_category;
public:
struct traversal_category :
graph::detail::derive_from_if_tag_is<incidence_graph_tag,
inherited_category>,
graph::detail::derive_from_if_tag_is<adjacency_graph_tag,
inherited_category>,
graph::detail::derive_from_if_tag_is<vertex_list_graph_tag,
inherited_category>,
graph::detail::derive_from_if_tag_is<edge_list_graph_tag,
inherited_category>,
graph::detail::derive_from_if_tag_is<vertex_list_graph_tag,
inherited_category,
distributed_vertex_list_graph_tag>,
graph::detail::derive_from_if_tag_is<edge_list_graph_tag,
inherited_category,
distributed_edge_list_graph_tag>
{ };
local_subgraph(DistributedGraph& g)
: inherited(g,
is_local_edge<DistributedGraph>(g),
is_local_vertex<DistributedGraph>(g)),
g(g)
{
}
// Distributed Container
typedef typename boost::graph::parallel::process_group_type<DistributedGraph>::type
process_group_type;
process_group_type& process_group()
{
using boost::graph::parallel::process_group;
return process_group(g);
}
const process_group_type& process_group() const
{
using boost::graph::parallel::process_group;
return boost::graph::parallel::process_group(g);
}
DistributedGraph& base() { return g; }
const DistributedGraph& base() const { return g; }
private:
DistributedGraph& g;
};
template<typename DistributedGraph, typename PropertyTag>
class property_map<local_subgraph<DistributedGraph>, PropertyTag>
: public property_map<DistributedGraph, PropertyTag> { };
template<typename DistributedGraph, typename PropertyTag>
class property_map<local_subgraph<const DistributedGraph>, PropertyTag>
{
public:
typedef typename property_map<DistributedGraph, PropertyTag>::const_type
type;
typedef type const_type;
};
template<typename PropertyTag, typename DistributedGraph>
inline typename property_map<local_subgraph<DistributedGraph>, PropertyTag>::type
get(PropertyTag p, local_subgraph<DistributedGraph>& g)
{ return get(p, g.base()); }
template<typename PropertyTag, typename DistributedGraph>
inline typename property_map<local_subgraph<DistributedGraph>, PropertyTag>
::const_type
get(PropertyTag p, const local_subgraph<DistributedGraph>& g)
{ return get(p, g.base()); }
template<typename DistributedGraph>
inline local_subgraph<DistributedGraph>
make_local_subgraph(DistributedGraph& g)
{ return local_subgraph<DistributedGraph>(g); }
} // end namespace boost
#endif // BOOST_GRAPH_LOCAL_SUBGRAPH_HPP
| {
"pile_set_name": "Github"
} |
<?php
namespace App\Admin\Extensions\Tools;
use Encore\Admin\Grid\Tools\BatchAction;
class MarkedAsRead extends BatchAction
{
public function script()
{
return <<<EOT
$('{$this->getElementClass()}').on('click', function() {
console.log(selectedRows());
});
EOT;
}
}
| {
"pile_set_name": "Github"
} |
package uk.ac.ebi.interpro.scan.persistence;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.transaction.annotation.Transactional;
import uk.ac.ebi.interpro.scan.model.FingerPrintsMatch;
import uk.ac.ebi.interpro.scan.model.Match;
import uk.ac.ebi.interpro.scan.model.Protein;
import uk.ac.ebi.interpro.scan.model.Signature;
import uk.ac.ebi.interpro.scan.model.raw.PrintsRawMatch;
import uk.ac.ebi.interpro.scan.model.raw.RawProtein;
import uk.ac.ebi.interpro.scan.model.helper.SignatureModelHolder;
import uk.ac.ebi.interpro.scan.util.Utilities;
import java.util.*;
/**
* @author Phil Jones, EMBL-EBI
* @version $Id$
* @since 1.0
*/
public class PrintsFilteredMatchDAOImpl extends FilteredMatchDAOImpl<PrintsRawMatch, FingerPrintsMatch> {
private static final Logger LOGGER = LogManager.getLogger(PrintsFilteredMatchDAOImpl.class.getName());
/**
* Sets the class of the model that the DOA instance handles.
* Note that this has been set up to use constructor injection
* because it makes it easy to sub-class GenericDAOImpl in a robust
* manner.
* <p/>
* Model class specific sub-classes should define a no-argument constructor
* that calls this constructor with the appropriate class.
*/
public PrintsFilteredMatchDAOImpl() {
super(FingerPrintsMatch.class);
}
/**
* This is the method that should be implemented by specific FilteredMatchDAOImpl's to
* persist filtered matches.
*
* @param filteredProteins being the Collection of filtered RawProtein objects to persist
* @param modelIdToSignatureMap a Map of signature accessions to Signature objects.
* @param proteinIdToProteinMap a Map of Protein IDs to Protein objects
*/
@Override
@Transactional
public void persist(Collection<RawProtein<PrintsRawMatch>> filteredProteins, Map<String, SignatureModelHolder> modelIdToSignatureMap, Map<String, Protein> proteinIdToProteinMap) {
for (RawProtein<PrintsRawMatch> rawProtein : filteredProteins) {
Protein protein = proteinIdToProteinMap.get(rawProtein.getProteinIdentifier());
if (protein == null) {
throw new IllegalStateException("Cannot store match to a protein that is not in database " +
"[protein ID= " + rawProtein.getProteinIdentifier() + "]");
}
Set<FingerPrintsMatch.FingerPrintsLocation> locations = null;
String currentSignatureAc = null;
SignatureModelHolder holder = null;
Signature currentSignature = null;
PrintsRawMatch lastRawMatch = null;
// Need the matches sorted correctly so locations are grouped in the same match.
final TreeSet<PrintsRawMatch> sortedMatches = new TreeSet<PrintsRawMatch>(PRINTS_RAW_MATCH_COMPARATOR);
sortedMatches.addAll(rawProtein.getMatches());
FingerPrintsMatch match = null;
String signatureLibraryKey = null;
Set <Match> proteinMatches = new HashSet<>();
for (PrintsRawMatch rawMatch : sortedMatches) {
if (rawMatch == null) {
continue;
}
if (currentSignatureAc == null || !currentSignatureAc.equals(rawMatch.getModelId())) {
if (currentSignatureAc != null) {
// Not the first (because the currentSignatureAc is not null)
if (match != null) {
//entityManager.persist(match); // Persist the previous one...
}
match = new FingerPrintsMatch(currentSignature, currentSignatureAc, lastRawMatch.getEvalue(), lastRawMatch.getGraphscan(), locations);
//protein.addMatch(match); // Sets the protein on the match.
proteinMatches.add(match);
}
// Reset everything
locations = new HashSet<FingerPrintsMatch.FingerPrintsLocation>();
currentSignatureAc = rawMatch.getModelId();
holder = modelIdToSignatureMap.get(currentSignatureAc);
currentSignature = holder.getSignature();
if (currentSignature == null) {
throw new IllegalStateException("Cannot find PRINTS signature " + currentSignatureAc + " in the database.");
}
}
locations.add(
new FingerPrintsMatch.FingerPrintsLocation(
rawMatch.getLocationStart(),
boundedLocationEnd(protein, rawMatch),
rawMatch.getPvalue(),
rawMatch.getScore(),
rawMatch.getMotifNumber()
)
);
lastRawMatch = rawMatch;
if(signatureLibraryKey == null){
signatureLibraryKey = currentSignature.getSignatureLibraryRelease().getLibrary().getName();
}
}
// Don't forget the last one!
if (lastRawMatch != null) {
match = new FingerPrintsMatch(currentSignature, currentSignatureAc, lastRawMatch.getEvalue(), lastRawMatch.getGraphscan(), locations);
//protein.addMatch(match); // Sets the protein on the match.
proteinMatches.add(match);
//entityManager.persist(match);
}
final String dbKey = Long.toString(protein.getId()) + signatureLibraryKey;
//Utilities.verboseLog(1100, "persisted matches in kvstore for key: " + dbKey);
if (proteinMatches != null && ! proteinMatches.isEmpty()) {
//Utilities.verboseLog(1100, "persisted matches in kvstore for key: " + dbKey + " : " + proteinMatches.size());
for(Match i5Match: proteinMatches){
//try update with cross refs etc
updateMatch(i5Match);
}
matchDAO.persist(dbKey, proteinMatches);
}
}
}
public static final Comparator<PrintsRawMatch> PRINTS_RAW_MATCH_COMPARATOR = new Comparator<PrintsRawMatch>() {
/**
* This comparator is CRITICAL to the working of PRINTS post-processing, so it has been defined
* here rather than being the 'natural ordering' of PrintsRawMatch objects so it is not
* accidentally modified 'out of context'.
*
* Sorts the raw matches by:
*
* evalue (best first)
* model accession
* motif number (ascending)
* location start
* location end
*
* @param o1 the first PrintsRawMatch to be compared.
* @param o2 the second PrintsRawMatch to be compared.
* @return a negative integer, zero, or a positive integer as the
* first PrintsRawMatch is less than, equal to, or greater than the
* second PrintsRawMatch.
*/
@Override
public int compare(PrintsRawMatch o1, PrintsRawMatch o2) {
int comparison = o1.getSequenceIdentifier().compareTo(o2.getSequenceIdentifier());
if (comparison == 0) {
if (o1.getEvalue() < o2.getEvalue()) comparison = -1;
else if (o1.getEvalue() > o2.getEvalue()) comparison = 1;
}
if (comparison == 0) {
comparison = o1.getModelId().compareTo(o2.getModelId());
}
if (comparison == 0) {
if (o1.getMotifNumber() < o2.getMotifNumber()) comparison = -1;
else if (o1.getMotifNumber() > o2.getMotifNumber()) comparison = 1;
}
if (comparison == 0) {
if (o1.getLocationStart() < o2.getLocationStart()) comparison = -1;
else if (o1.getLocationStart() > o2.getLocationStart()) comparison = 1;
}
if (comparison == 0) {
if (o1.getLocationEnd() < o2.getLocationEnd()) comparison = -1;
else if (o1.getLocationEnd() > o2.getLocationEnd()) comparison = 1;
}
return comparison;
}
};
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright: JessMA Open Source ([email protected])
*
* Author : Bruce Liang
* Website : https://github.com/ldcsaa
* Project : https://github.com/ldcsaa/HP-Socket
* Blog : http://www.cnblogs.com/ldcsaa
* Wiki : http://www.oschina.net/p/hp-socket
* QQ Group : 44636872, 75375912
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "stdafx.h"
| {
"pile_set_name": "Github"
} |
{
"checksum": "47c64556f92189712e9ba2ae0b485d62",
"roots": {
"bookmark_bar": {
"children": [ {
"children": [ {
"date_added": "12949698950422234",
"id": "5",
"name": "Bookmark Manager",
"type": "url",
"url": "chrome-extension://eemcgdkfndhakfknompkggombfjjjeno/main.html#3"
} ],
"date_added": "12949698938004572",
"date_modified": "12949698958396466",
"id": "3",
"name": "Folder A",
"type": "folder"
} ],
"date_added": "0",
"date_modified": "0",
"id": "1",
"name": "Bookmarks Bar",
"type": "folder"
},
"other": {
"children": [ {
"children": [ {
"date_added": "12949698958396466",
"id": "6",
"name": "Get started with Google Chrome",
"type": "url",
"url": "http://tools.google.com/chrome/intl/en/welcome.html"
} ],
"date_added": "12949698944107898",
"date_modified": "12949698961627573",
"id": "4",
"name": "Folder B",
"type": "folder"
} ],
"date_added": "0",
"date_modified": "0",
"id": "2",
"name": "Other Bookmarks",
"type": "folder"
}
},
"version": 1
}
| {
"pile_set_name": "Github"
} |
# no testsuite password
# root password: rootF00barbaz
# myuser password: myuserF00barbaz
user foo, in group users (only in /etc/group)
user foo, in group tty (only in /etc/gshadow)
user foo, in group floppy
user foo, admin of group disk
user foo, admin and member of group fax
user foo, admin and member of group cdrom (only in /etc/gshadow)
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env bash
# NodeOS
#
# Copyright (c) 2013-2017 Jacob Groundwater, Jesús Leganés-Combarro 'piranna'
# and other contributors
#
# MIT License
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <DEVICE> <ROOTFS> <USERSFS>"
exit 10
fi
DEVICE=$1
PARTITION=${DEVICE}2
BOOTFS=$2
USERSFS=$3
# Copy bootfs & usersfs partition images on USB device
SIZE_BOOTFS=$(stat -L -c%s "$BOOTFS")
SIZE_BOOTFS=$(($SIZE_BOOTFS/512))
dd if=$BOOTFS of=$DEVICE &&
dd if=$USERSFS of=$DEVICE seek=$SIZE_BOOTFS || exit 11
sync
# Create new partition for usersfs on USB device
cat resources/fdisk-installUSB.txt | fdisk $DEVICE || exit 12
sync
# Resize usersfs partition to fill remaining free space
e2fsck -f -y $PARTITION
resize2fs -p $PARTITION || exit 13
sync
| {
"pile_set_name": "Github"
} |
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// hdIHandle.cpp - Base class for all Handles
//
//////////////////////////////////////////////////////////////////////////
#include "pgAdmin3.h"
// wxWindows headers
#include <wx/wx.h>
// App headers
#include "hotdraw/handles/hdIHandle.h"
#include "hotdraw/utilities/hdPoint.h"
hdIHandle::hdIHandle(hdIFigure *owner)
{
figureOwner = owner;
}
hdIHandle::~hdIHandle()
{
}
hdIFigure *hdIHandle::getOwner()
{
return figureOwner;
}
hdRect &hdIHandle::getDisplayBox(int posIdx)
{
hdPoint p = locate(posIdx);
displayBox.width = 0;
displayBox.height = 0;
displayBox.SetPosition(p);
displayBox.Inflate(size, size);
return displayBox;
}
bool hdIHandle::containsPoint(int posIdx, int x, int y)
{
return getDisplayBox(posIdx).Contains(x, y);
}
| {
"pile_set_name": "Github"
} |
.umb-insert-code-boxes {
display: flex;
flex-direction: column;
}
.umb-insert-code-box {
border: 1px solid @gray-10;
padding: 15px 20px;
margin-bottom: 10px;
border-radius: 3px;
text-align: left;
}
.umb-insert-code-box:hover,
.umb-insert-code-box.-selected {
background-color: @ui-option-hover;
color: @ui-action-type-hover;
}
.umb-insert-code-box__title {
font-size: 15px;
margin-bottom: 5px;
font-weight: bold;
line-height: 1;
}
.umb-insert-code-box__description {
font-size: 13px;
line-height: 1.6em;
}
.umb-insert-code-box__check {
width: 18px;
height: 18px;
background: @gray-10;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
float: left;
margin-right: 5px;
margin-top: 1px;
}
.umb-insert-code-box__check--checked {
background: @green;
color: @white;
}
| {
"pile_set_name": "Github"
} |
/* You can add global styles to this file, and also import other style files */
| {
"pile_set_name": "Github"
} |
#!/usr/bin/python
# __________ __ ___.
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
#
# Copyright (c) 2012 Dominik Riebeling
#
# All files in this archive are subject to the GNU General Public License.
# See the file COPYING in the source tree root for full license agreement.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
'''Scrape files from a git repository.
This module provides functions to get a subset of files from a git repository.
The files to retrieve can be specified, and the git tree to work on can be
specified. That way arbitrary trees can be retrieved (like a subset of files
for a given tag).
Retrieved files can be packaged into a bzip2 compressed tarball or stored in a
given folder for processing afterwards.
Calls git commands directly for maximum compatibility.
'''
import re
import subprocess
import os
import tarfile
import tempfile
import shutil
def get_refs(repo):
'''Get dict matching refs to hashes from repository pointed to by repo.
@param repo Path to repository root.
@return Dict matching hashes to each ref.
'''
print("Getting list of refs")
output = subprocess.Popen(
["git", "show-ref", "--abbrev"],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=repo)
cmdout = output.communicate()
refs = dict()
if len(cmdout[1]) > 0:
print("An error occured!\n")
print(cmdout[1])
return refs
for line in cmdout:
regex = re.findall(b'([a-f0-9]+)\\s+(\\S+)', line)
for r in regex:
# ref is the key, hash its value.
refs[r[1].decode()] = r[0].decode()
return refs
def get_lstree(repo, start, filterlist=None):
'''Get recursive list of tree objects for a given tree.
@param repo Path to repository root.
@param start Hash identifying the tree.
@param filterlist List of paths to retrieve objecs hashes for.
An empty list will retrieve all paths.
@return Dict mapping filename to blob hash
'''
if filterlist is None:
filterlist = list()
output = subprocess.Popen(
["git", "ls-tree", "-r", start],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=repo)
cmdout = output.communicate()
objects = dict()
if len(cmdout[1]) > 0:
print("An error occured!\n")
print(cmdout[1])
return objects
for line in cmdout[0].decode().split('\n'):
regex = re.findall(b'([0-9]+)\\s+([a-z]+)\\s+([0-9a-f]+)\\s+(.*)',
line.encode())
for rf in regex:
# filter
add = False
for f in filterlist:
if rf[3].decode().find(f) == 0:
add = True
# If two files have the same content they have the same hash, so
# the filename has to be used as key.
if len(filterlist) == 0 or add == True:
if rf[3] in objects:
print("FATAL: key already exists in dict!")
return {}
objects[rf[3].decode()] = rf[2].decode()
return objects
def get_file_timestamp(repo, tree, filename):
'''Get timestamp for a file.
@param repo Path to repository root.
@param tree Hash of tree to use.
@param filename Filename in tree
@return Timestamp as string.
'''
output = subprocess.Popen(
["git", "log", "--format=%ai", "-n", "1", tree, filename],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=repo)
cmdout = output.communicate()
return cmdout[0].decode().rstrip()
def get_object(repo, blob, destfile):
'''Get an identified object from the repository.
@param repo Path to repository root.
@param blob hash for blob to retrieve.
@param destfile filename for blob output.
@return True if file was successfully written, False on error.
'''
output = subprocess.Popen(
["git", "cat-file", "-p", blob],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=repo)
cmdout = output.communicate()
# make sure output path exists
if len(cmdout[1]) > 0:
print("An error occured!\n")
print(cmdout[1])
return False
if not os.path.exists(os.path.dirname(destfile)):
os.makedirs(os.path.dirname(destfile))
f = open(destfile, 'wb')
f.write(cmdout[0])
f.close()
return True
def describe_treehash(repo, treehash):
'''Retrieve output of git-describe for a given hash.
@param repo Path to repository root.
@param treehash Hash identifying the tree / commit to describe.
@return Description string.
'''
output = subprocess.Popen(
["git", "describe", treehash],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=repo)
cmdout = output.communicate()
if len(cmdout[1]) > 0:
print("An error occured!\n")
print(cmdout[1])
return ""
return cmdout[0].rstrip()
def scrape_files(repo, treehash, filelist, dest=None, timestamp_files=None):
'''Scrape list of files from repository.
@param repo Path to repository root.
@param treehash Hash identifying the tree.
@param filelist List of files to get from repository.
@param dest Destination path for files. Files will get retrieved with full
path from the repository, and the folder structure will get
created below dest as necessary.
@param timestamp_files List of files to also get the last modified date.
WARNING: this is SLOW!
@return Destination path, filename:timestamp dict.
'''
print("Scraping files from repository")
if timestamp_files is None:
timestamp_files = list()
if dest is None:
dest = tempfile.mkdtemp()
treeobjects = get_lstree(repo, treehash, filelist)
timestamps = {}
for obj in treeobjects:
get_object(repo, treeobjects[obj], os.path.join(dest, obj))
for f in timestamp_files:
if obj.find(f) == 0:
timestamps[obj] = get_file_timestamp(repo, treehash, obj)
return [dest, timestamps]
def archive_files(repo, treehash, filelist, basename, tmpfolder=None,
archive="tbz"):
'''Archive list of files into tarball.
@param repo Path to repository root.
@param treehash Hash identifying the tree.
@param filelist List of files to archive. All files in the archive if left
empty.
@param basename Basename (including path) of output file. Will get used as
basename inside of the archive as well (i.e. no tarbomb).
@param tmpfolder Folder to put intermediate files in. If no folder is given
a temporary one will get used.
@param archive Type of archive to create. Supported values are "tbz" and
"7z". The latter requires the 7z binary available in the
system's path.
@return Output filename.
'''
if tmpfolder is None:
temp_remove = True
tmpfolder = tempfile.mkdtemp()
else:
temp_remove = False
workfolder = scrape_files(
repo, treehash, filelist, os.path.join(tmpfolder, basename))[0]
if basename == "":
return ""
print("Archiving files from repository")
if archive == "7z":
outfile = basename + ".7z"
output = subprocess.Popen(
["7z", "a", os.path.join(os.getcwd(), basename + ".7z"), basename],
cwd=tmpfolder, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output.communicate()
elif archive == "tbz":
outfile = basename + ".tar.bz2"
tf = tarfile.open(outfile, "w:bz2")
tf.add(workfolder, basename)
tf.close()
else:
print("Files not archived")
if tmpfolder != workfolder:
shutil.rmtree(workfolder)
if temp_remove:
shutil.rmtree(tmpfolder)
return outfile
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.