text
stringlengths 2
100k
| meta
dict |
---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import random
import re
import string
import tempfile
import traceback
from ..files.file_manager import FileManager
from ..files.path_in_file import PathInFile
from ..users import Users
from ..useful.useful import run_cmd
class SudoList(object):
"""
Get rules and parse output from sudo -ll output
"""
def __init__(self, password='test'):
self.sudo_cmd = 'echo "{password}" | sudo -S -ll'.format(password=password)
self.sudo_dirty_check = [
'echo "{password}" | sudo -S -i'.format(password=password),
# 'sudo -i'
]
self.users = Users()
self.all_rules = []
self.ld_preload = False
def dirty_check(self):
for cmd in self.sudo_dirty_check:
if run_cmd(cmd, is_ok=True):
return 'sudo -i possible !'
def _get_user(self, user):
"""
Find a user pw object from his name
- user is a string
- u is an object
"""
for u in self.users.list:
if u.pw_name == user:
return u
return False
def rules_from_sudo_ll(self):
"""
Main function to retrieve sudoers rules from sudo -ll output
"""
sudo_list, _ = run_cmd(self.sudo_cmd)
if sudo_list:
sudo_rules = self._parse_sudo_list(sudo_list)
self._impersonate_mechanism(self.users.current.pw_name, sudo_rules, users_chain=[])
return self.all_rules
def _parse_sudo_list(self, sudo_list):
"""
Parse sudo -ll output
"""
sudoers_info = []
fm = FileManager('')
if 'LD_PRELOAD' in sudo_list:
self.ld_preload = True
user = sudo_list[sudo_list.index('User '):].split(' ')[1]
sudoers_entries = sudo_list.lower().split('sudoers entry')
for sudo_rule in sudoers_entries:
if not sudo_rule.startswith(':'):
continue
pattern = re.compile(
r"\s*" +
"runasusers:\s*(?P<runasusers>\w*)" +
"\s*" +
"(runasgroups:\s*(?P<runasgroups>\w*))*" +
"\s*" +
"(options:\s*(?P<options>[\!\w]*))*" +
"\s*" +
"(commands:\s*(?P<commands>.*))*",
re.DOTALL
)
m = pattern.search(sudo_rule)
# Default to empty string '' for values we didn't match
data = m.groupdict('')
# Remove whitespace and extra tabs from list of commands
cmds = [PathInFile(line=cmd.strip(), paths=fm.extract_paths_from_string(cmd.strip()))
for cmd in data['commands'].strip().replace('\t', '').split('\n')]
sudoers_info.append({
'users': [user],
'runas': data['runasusers'],
'directives': data['options'],
'cmds': cmds,
})
self.all_rules += sudoers_info
return sudoers_info
def _get_user_to_impersonate(self, sudo_rules):
"""
Check if in the sudo rule, user impersonation is possible (using su bin)
"""
users = []
for rules in sudo_rules:
for cmd in rules['cmds']:
for c in cmd.paths:
if c.basename == 'su':
# Do not perform further checks as it's already to impersonate root user
args = cmd.line.strip()[cmd.line.strip().index(c.basename) + len(c.basename):].strip()
if args.strip() and args.strip() not in ['root', '*']:
u = self._get_user(args.strip())
if u:
users.append(u)
return users
def _impersonate_user(self, users_chain=[]):
"""
Get the user to impersonate and return his sudo -l output
For example:
- The current user has "su" rule to impersonate user A
- The user A can impersonate user B (but the current user cannot)
- User B has root privilege
=> users_chain = ["user A", "user B"]
sudo -l return only rules concerning the user launching this command.
The trick is to use a temporary file like following:
sudo su test << 'EOF'
echo "test" | sudo -S -l
EOF
"""
data = ''
for u in users_chain:
data += "sudo su {user} << 'EOF'\n".format(user=u)
data += self.sudo_cmd + '\n'
if users_chain:
data += '\nEOF'
rand = ''.join(random.choice(string.ascii_lowercase) for i in range(10))
path = os.path.join(tempfile.gettempdir(), rand) + '.sh'
with open(path, 'w') as file:
file.write(data)
if os.path.exists(path):
out = run_cmd(cmd='chmod +x {path}'.format(path=path), is_ok=True)
if out:
out, _ = run_cmd(cmd=path)
os.remove(path)
return out
def _impersonate_mechanism(self, user, sudo_rules, users_chain=[], already_impersonated=[]):
"""
Recursive function to retrieve all sudo rules
All rules for all possible users are stored on "all_rules"
"""
for u in self._get_user_to_impersonate(sudo_rules):
if u not in already_impersonated:
sudo_list = self._impersonate_user(users_chain=[user, u])
if sudo_list:
try:
sudo_rules = self._parse_sudo_list(sudo_list)
self._impersonate_mechanism(u, sudo_rules, [user, u], already_impersonated)
except Exception:
print(traceback.format_exc())
continue
already_impersonated.append(u)
| {
"pile_set_name": "Github"
} |
package machineid
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"io"
"io/ioutil"
"os"
"os/exec"
"strings"
)
// run wraps `exec.Command` with easy access to stdout and stderr.
func run(stdout, stderr io.Writer, cmd string, args ...string) error {
c := exec.Command(cmd, args...)
c.Stdin = os.Stdin
c.Stdout = stdout
c.Stderr = stderr
return c.Run()
}
// protect calculates HMAC-SHA256 of the application ID, keyed by the machine ID and returns a hex-encoded string.
func protect(appID, id string) string {
mac := hmac.New(sha256.New, []byte(id))
mac.Write([]byte(appID))
return hex.EncodeToString(mac.Sum(nil))
}
func readFile(filename string) ([]byte, error) {
return ioutil.ReadFile(filename)
}
func trim(s string) string {
return strings.TrimSpace(strings.Trim(s, "\n"))
}
| {
"pile_set_name": "Github"
} |
export interface BmobPromise<T = any> extends Promise<BmobPromise<T>> {
}
export interface queryData {
(key: string, operator: string, val: any): object
}
export class Query {
new(params: string): void;
get: (objectId: string) => BmobPromise;
set: (filedName: string, filedValue: string) => BmobPromise;
destroy: (objectId: string) => BmobPromise;
save: (parmas?: object) => BmobPromise;
find: () => BmobPromise;
current: () => BmobPromise;
add: (key: string, val: string[]) => void;
addUnique: () => (key: string, val: string[]) => void;
remove: (key: string, val: string[]) => void;
equalTo: (key: string, operator: string, val: any) => object
or: (...args: object[]) => void;
and: (...args: object[]) => void;
select: (...args: string[]) => void;
containedIn: (key: string, val: string[]) => queryData;
notContainedIn: (key: string, val: string[]) => queryData;
exists: (key: string) => queryData;
doesNotExist: (key: string) => queryData;
limit: (params: number) => void;
skip: (params: number) => void;
order: (...args: string[]) => void;
include: (...args: string[]) => void;
count: (limit?: number) => BmobPromise;
statTo: (key: string, val: any) => object;
saveAll: (items: any[]) => BmobPromise;
updateStorage: (objectId: string) => BmobPromise;
field: (key: string, objectId: string) => object;
withinKilometers: (field: string, coordinates: string, km?: number) => object
withinGeoBox: (field: string, coordinates: string, s?: number) => object
relation: (tableName: string) => BmobPromise
}
export class User extends Query {
new(): void;
login: (username: string, password: string) => BmobPromise;
register: (params: object) => BmobPromise;
signOrLoginByMobilePhone: (phone: number, smsCode: number) => BmobPromise;
logout: () => void;
users: () => BmobPromise;
decryption: (params: object) => BmobPromise
requestOpenId: (code: any, params?: string) => BmobPromise
requestEmailVerify: (email: string) => BmobPromise
linkWith: (params: any) => BmobPromise
loginWithWeapp: (code: any, params?: string, str: string) => BmobPromise
upInfo: (params: object) => BmobPromise
openId: () => void;
auth: (params?: string) => BmobPromise
}
export interface operation {
(parmas: string, op: string): object
}
export class Relation {
new(tableName: string): void;
add: (parmas: string) => operation
}
export class Pointer {
new(tableName: string): void;
set: (objectId: string) => object
}
export interface functions {
(funName: string, parmas?: object): BmobPromise
}
export class Pay {
new(price: string, productName: string, body: any): BmobPromise
}
export class Socket {
new(id: string): void;
updateTable: (tableName: string) => void
unsubUpdateTable: (tableName: string) => void
updateRow: (tableName: string, objectId: string) => boid
unsubUpdateRow: (tableName: string, objectId: string) => boid
deleteTable: (tableName: string) => void
unsubDeleteTable: (tableName: string) => void
deleteRow: (tableName: string, objectId: string) => boid
unsubDeleteRow: (tableName: string, objectId: string) => boid
onUpdateTable: (tableName: string, data: any) => any
onUpdateRow: (tableName: string, objectId: string, data: any) => any
onUpdateTable: (tableName: string, data: any) => any
onUpdateTable: (tableName: string, objectId: string, data: any) => any
}
export class File {
new(name: string, params: any): void;
save: () => BmobPromise;
destroy: (params: string) => BmobPromise;
}
export interface Bmob {
initialize: (secretKey: string, securityCode: string, masterKey?: string) => void;
User: User;
Query: (params: string) => Query;
push: (params: object) => BmobPromise;
Pointer: (parmas: string) => Pointer;
Relation: (parmas: string) => Relation;
requestPasswordReset: (email: object) => BmobPromise;
resetPasswordBySmsCode: (smsCode: string, params: object) => BmobPromise;
updateUserPassword: (objectId: string, params: object) => BmobPromise;
timestamp: () => BmobPromise;
generateCode: (params: object) => BmobPromise;
getAccessToken: () => BmobPromise;
sendWeAppMessage: (parmas: object) => BmobPromise;
refund: (parmas: object) => BmobPromise;
notifyMsg: (parmas: object) => BmobPromise;
requestPasswordReset: (parmas: object) => BmobPromise;
checkMsg: (parmas: string) => BmobPromise;
functions: functions;
run: functions;
pay: Pay;
Socket: (id: string) => Socket;
geoPoint: (parmas: object) => object;
requestSmsCode: (parmas: object, options?: any) => BmobPromise;
verifySmsCode: (smscode: string, parmas: object, options?: any) => BmobPromise;
File: (name: string, object: any) => File
}
declare const Bmob: Bmob;
export default Bmob | {
"pile_set_name": "Github"
} |
// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#ifndef PKT_FILTER6_H
#define PKT_FILTER6_H
#include <asiolink/io_address.h>
#include <dhcp/pkt6.h>
namespace bundy {
namespace dhcp {
/// Forward declaration to the structure describing a socket.
struct SocketInfo;
/// Forward declaration to the class representing interface
class Iface;
/// @brief Abstract packet handling class for DHCPv6.
///
/// This class defines methods for performing low level operations on IPv6
/// socket:
/// - open socket,
/// - send DHCPv6 message through the socket,
/// - receive DHCPv6 through the socket.
///
/// Methods exposed by this class are called through the @c IfaceMgr only. They
/// are not meant to be called directly, except unit testing.
///
/// The @c IfaceMgr is responsible for managing the pool of sockets. In
/// particular, @c IfaceMgr detects interfaces suitable to send/receive DHCPv6
/// messages. When it intends to open a socket on a particular interface, it
/// will call the PktFilter6::openSocket. If this call is successful, the
/// structure describing a new socket is returned.
///
/// In order to send or receive a DHCPv6 message through this socket,
/// the @c IfaceMgr must use PktFilter6::send or PktFilter6::receive
/// functions of the same class that has been used to open a socket,
/// i.e. all send/receive operations should be performed using this
/// particular class.
///
/// The major motivation behind creating a separate class, to manage low level
/// operations using sockets, is to make @c IfaceMgr unit testable. By providing
/// a stub implementation of this class which mimics the behavior of the real
/// socket handling class, it is possible to simulate and test various
/// conditions. For example, the @c IfaceMgr::openSockets function will try to
/// open sockets on all available interfaces. The test doesn't have any means
/// to know which interfaces are present. In addition, even if the network
/// interface detection was implemented on the test side, there is no guarantee
/// that the particular system has sufficient number of suitable IPv6-enabled
/// interfaces available for a particular test. Moreover, the test may need
/// to tweak some of the interface configuration to cover certain test
/// scenarios. The proposed solution is to not use the actual interfaces
/// but simply create a pool of fake interfaces which configuration
/// can be freely modified by a test. This however implies that operations
/// on sockets must be simulated.
///
/// @note This class is named after @c PktFilter abstract class which exposes
/// similar interface for DHVPv4. However, the PktFilter class is devoted to
/// solve the problem of sending DHCPv4 messages to the hosts which don't have
/// an IP address yet (a.k.a. direct DHCPv4 traffic). Where required, the
/// custom implementations of @c PktFilter are provided to send and receive
/// messages through raw sockets. In order to filter out the desired traffic
/// Linux Packet Filtering or Berkeley Packet Filtering is used, hence the
/// name of the class. In case of DHCPv6 regular IPv6/UDPv6 sockets are used
/// and derived classes do not use Linux or Berkeley Packet Filtering.
class PktFilter6 {
public:
/// @brief Virtual Destructor.
virtual ~PktFilter6() { }
/// @brief Opens a socket.
///
/// This function open an IPv6 socket on an interface and binds it to a
/// specified UDP port and IPv6 address.
///
/// @param iface Interface descriptor.
/// @param addr Address on the interface to be used to send packets.
/// @param port Port number.
/// @param join_multicast A boolean parameter which indicates whether
/// socket should join All_DHCP_Relay_Agents_and_servers multicast
/// group.
///
/// @return A structure describing a primary and fallback socket.
virtual SocketInfo openSocket(const Iface& iface,
const bundy::asiolink::IOAddress& addr,
const uint16_t port,
const bool join_multicast) = 0;
/// @brief Receives DHCPv6 message on the interface.
///
/// This function receives a single DHCPv6 message through using a socket
/// open on a specified interface.
///
/// @param socket_info A structure holding socket information.
///
/// @return A pointer to received message.
virtual Pkt6Ptr receive(const SocketInfo& socket_info) = 0;
/// @brief Sends DHCPv6 message through a specified interface and socket.
///
/// This function sends a DHCPv6 message through a specified interface and
/// socket. In general, there may be multiple sockets open on a single
/// interface as a single interface may have multiple IPv6 addresses.
///
/// @param iface Interface to be used to send packet.
/// @param sockfd A socket descriptor
/// @param pkt A packet to be sent.
///
/// @return A result of sending the message. It is 0 if successful.
virtual int send(const Iface& iface, uint16_t sockfd,
const Pkt6Ptr& pkt) = 0;
/// @brief Joins IPv6 multicast group on a socket.
///
/// Socket must be created and bound to an address. Note that this
/// address is different than the multicast address. For example DHCPv6
/// server should bind its socket to link-local address (fe80::1234...)
/// and later join ff02::1:2 multicast group.
///
/// @param sock A socket descriptor (socket must be bound).
/// @param ifname An interface name (for link-scoped multicast groups).
/// @param mcast A multicast address to join (e.g. "ff02::1:2").
///
/// @return true if multicast join was successful
static bool joinMulticast(int sock, const std::string& ifname,
const std::string & mcast);
};
/// Pointer to a PktFilter object.
typedef boost::shared_ptr<PktFilter6> PktFilter6Ptr;
} // namespace bundy::dhcp
} // namespace bundy
#endif // PKT_FILTER6_H
| {
"pile_set_name": "Github"
} |
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
class LitRedstoneLamp extends RedstoneLamp{
protected $id = self::LIT_REDSTONE_LAMP;
public function getName() : string{
return "Lit Redstone Lamp";
}
public function getLightLevel() : int{
return 15;
}
}
| {
"pile_set_name": "Github"
} |
ul
li.list-item: .foo: #bar baz | {
"pile_set_name": "Github"
} |
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Server
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
require_once 'Zend/Server/Reflection/Function.php';
/**
* Test case for Zend_Server_Reflection_Function
*
* @category Zend
* @package Zend_Server
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Server
*/
class Zend_Server_Reflection_FunctionTest extends PHPUnit_Framework_TestCase
{
public function test__construct()
{
$function = new ReflectionFunction('Zend_Server_Reflection_FunctionTest_function');
$r = new Zend_Server_Reflection_Function($function);
$this->assertTrue($r instanceof Zend_Server_Reflection_Function);
$this->assertTrue($r instanceof Zend_Server_Reflection_Function_Abstract);
$params = $r->getParameters();
try {
$r = new Zend_Server_Reflection_Function($params[0]);
$this->fail('Should not be able to construct with non-function');
} catch (Exception $e) {
// do nothing
}
$r = new Zend_Server_Reflection_Function($function, 'namespace');
$this->assertEquals('namespace', $r->getNamespace());
$argv = array('string1', 'string2');
$r = new Zend_Server_Reflection_Function($function, 'namespace', $argv);
$this->assertTrue(is_array($r->getInvokeArguments()));
$this->assertTrue($argv === $r->getInvokeArguments());
$prototypes = $r->getPrototypes();
$this->assertTrue(is_array($prototypes));
$this->assertTrue(0 < count($prototypes));
}
public function test__getSet()
{
$function = new ReflectionFunction('Zend_Server_Reflection_FunctionTest_function');
$r = new Zend_Server_Reflection_Function($function);
$r->system = true;
$this->assertTrue($r->system);
}
public function testNamespace()
{
$function = new ReflectionFunction('Zend_Server_Reflection_FunctionTest_function');
$r = new Zend_Server_Reflection_Function($function, 'namespace');
$this->assertEquals('namespace', $r->getNamespace());
$r->setNamespace('framework');
$this->assertEquals('framework', $r->getNamespace());
}
public function testDescription()
{
$function = new ReflectionFunction('Zend_Server_Reflection_FunctionTest_function');
$r = new Zend_Server_Reflection_Function($function);
$this->assertContains('function for reflection', $r->getDescription());
$r->setDescription('Testing setting descriptions');
$this->assertEquals('Testing setting descriptions', $r->getDescription());
}
public function testGetPrototypes()
{
$function = new ReflectionFunction('Zend_Server_Reflection_FunctionTest_function');
$r = new Zend_Server_Reflection_Function($function);
$prototypes = $r->getPrototypes();
$this->assertTrue(is_array($prototypes));
$this->assertTrue(0 < count($prototypes));
$this->assertEquals(8, count($prototypes));
foreach ($prototypes as $p) {
$this->assertTrue($p instanceof Zend_Server_Reflection_Prototype);
}
}
public function testGetPrototypes2()
{
$function = new ReflectionFunction('Zend_Server_Reflection_FunctionTest_function2');
$r = new Zend_Server_Reflection_Function($function);
$prototypes = $r->getPrototypes();
$this->assertTrue(is_array($prototypes));
$this->assertTrue(0 < count($prototypes));
$this->assertEquals(1, count($prototypes));
foreach ($prototypes as $p) {
$this->assertTrue($p instanceof Zend_Server_Reflection_Prototype);
}
}
public function testGetInvokeArguments()
{
$function = new ReflectionFunction('Zend_Server_Reflection_FunctionTest_function');
$r = new Zend_Server_Reflection_Function($function);
$args = $r->getInvokeArguments();
$this->assertTrue(is_array($args));
$this->assertEquals(0, count($args));
$argv = array('string1', 'string2');
$r = new Zend_Server_Reflection_Function($function, null, $argv);
$args = $r->getInvokeArguments();
$this->assertTrue(is_array($args));
$this->assertEquals(2, count($args));
$this->assertTrue($argv === $args);
}
public function test__wakeup()
{
$function = new ReflectionFunction('Zend_Server_Reflection_FunctionTest_function');
$r = new Zend_Server_Reflection_Function($function);
$s = serialize($r);
$u = unserialize($s);
$this->assertTrue($u instanceof Zend_Server_Reflection_Function);
$this->assertEquals('', $u->getNamespace());
}
public function testMultipleWhitespaceBetweenDoctagsAndTypes()
{
$function = new ReflectionFunction('Zend_Server_Reflection_FunctionTest_function3');
$r = new Zend_Server_Reflection_Function($function);
$prototypes = $r->getPrototypes();
$this->assertTrue(is_array($prototypes));
$this->assertTrue(0 < count($prototypes));
$this->assertEquals(1, count($prototypes));
$proto = $prototypes[0];
$params = $proto->getParameters();
$this->assertTrue(is_array($params));
$this->assertEquals(1, count($params));
$this->assertEquals('string', $params[0]->getType());
}
/**
* @group ZF-6996
*/
public function testParameterReflectionShouldReturnTypeAndVarnameAndDescription()
{
$function = new ReflectionFunction('Zend_Server_Reflection_FunctionTest_function');
$r = new Zend_Server_Reflection_Function($function);
$prototypes = $r->getPrototypes();
$prototype = $prototypes[0];
$params = $prototype->getParameters();
$param = $params[0];
$this->assertContains('Some description', $param->getDescription(), var_export($param, 1));
}
}
/**
* Zend_Server_Reflection_FunctionTest_function
*
* Test function for reflection unit tests
*
* @param string $var1 Some description
* @param string|array $var2
* @param array $var3
* @return null|array
*/
function Zend_Server_Reflection_FunctionTest_function($var1, $var2, $var3 = null)
{
}
/**
* Zend_Server_Reflection_FunctionTest_function2
*
* Test function for reflection unit tests; test what happens when no return
* value or params specified in docblock.
*/
function Zend_Server_Reflection_FunctionTest_function2()
{
}
/**
* Zend_Server_Reflection_FunctionTest_function3
*
* @param string $var1
* @return void
*/
function Zend_Server_Reflection_FunctionTest_function3($var1)
{
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python
# See utils/checkpackagelib/readme.txt before editing this file.
from __future__ import print_function
import argparse
import inspect
import os
import re
import six
import sys
import checkpackagelib.lib_config
import checkpackagelib.lib_hash
import checkpackagelib.lib_mk
import checkpackagelib.lib_patch
VERBOSE_LEVEL_TO_SHOW_IGNORED_FILES = 3
flags = None # Command line arguments.
def parse_args():
parser = argparse.ArgumentParser()
# Do not use argparse.FileType("r") here because only files with known
# format will be open based on the filename.
parser.add_argument("files", metavar="F", type=str, nargs="*",
help="list of files")
parser.add_argument("--br2-external", "-b", dest='intree_only', action="store_false",
help="do not apply the pathname filters used for intree files")
parser.add_argument("--manual-url", action="store",
default="http://nightly.buildroot.org/",
help="default: %(default)s")
parser.add_argument("--verbose", "-v", action="count", default=0)
parser.add_argument("--quiet", "-q", action="count", default=0)
# Now the debug options in the order they are processed.
parser.add_argument("--include-only", dest="include_list", action="append",
help="run only the specified functions (debug)")
parser.add_argument("--exclude", dest="exclude_list", action="append",
help="do not run the specified functions (debug)")
parser.add_argument("--dry-run", action="store_true", help="print the "
"functions that would be called for each file (debug)")
return parser.parse_args()
CONFIG_IN_FILENAME = re.compile("Config\.\S*$")
DO_CHECK_INTREE = re.compile("|".join([
"Config.in",
"arch/",
"boot/",
"fs/",
"linux/",
"package/",
"system/",
"toolchain/",
]))
DO_NOT_CHECK_INTREE = re.compile("|".join([
"boot/barebox/barebox\.mk$",
"fs/common\.mk$",
"package/doc-asciidoc\.mk$",
"package/pkg-\S*\.mk$",
"toolchain/helpers\.mk$",
"toolchain/toolchain-external/pkg-toolchain-external\.mk$",
]))
def get_lib_from_filename(fname):
if flags.intree_only:
if DO_CHECK_INTREE.match(fname) is None:
return None
if DO_NOT_CHECK_INTREE.match(fname):
return None
else:
if os.path.basename(fname) == "external.mk" and \
os.path.exists(fname[:-2] + "desc"):
return None
if CONFIG_IN_FILENAME.search(fname):
return checkpackagelib.lib_config
if fname.endswith(".hash"):
return checkpackagelib.lib_hash
if fname.endswith(".mk"):
return checkpackagelib.lib_mk
if fname.endswith(".patch"):
return checkpackagelib.lib_patch
return None
def is_a_check_function(m):
if not inspect.isclass(m):
return False
# do not call the base class
if m.__name__.startswith("_"):
return False
if flags.include_list and m.__name__ not in flags.include_list:
return False
if flags.exclude_list and m.__name__ in flags.exclude_list:
return False
return True
def print_warnings(warnings):
# Avoid the need to use 'return []' at the end of every check function.
if warnings is None:
return 0 # No warning generated.
for level, message in enumerate(warnings):
if flags.verbose >= level:
print(message.replace("\t", "< tab >").rstrip())
return 1 # One more warning to count.
def check_file_using_lib(fname):
# Count number of warnings generated and lines processed.
nwarnings = 0
nlines = 0
lib = get_lib_from_filename(fname)
if not lib:
if flags.verbose >= VERBOSE_LEVEL_TO_SHOW_IGNORED_FILES:
print("{}: ignored".format(fname))
return nwarnings, nlines
classes = inspect.getmembers(lib, is_a_check_function)
if flags.dry_run:
functions_to_run = [c[0] for c in classes]
print("{}: would run: {}".format(fname, functions_to_run))
return nwarnings, nlines
objects = [c[1](fname, flags.manual_url) for c in classes]
for cf in objects:
nwarnings += print_warnings(cf.before())
if six.PY3:
f = open(fname, "r", errors="surrogateescape")
else:
f = open(fname, "r")
lastline = ""
for lineno, text in enumerate(f.readlines()):
nlines += 1
for cf in objects:
if cf.disable.search(lastline):
continue
nwarnings += print_warnings(cf.check_line(lineno + 1, text))
lastline = text
f.close()
for cf in objects:
nwarnings += print_warnings(cf.after())
return nwarnings, nlines
def __main__():
global flags
flags = parse_args()
if flags.intree_only:
# change all paths received to be relative to the base dir
base_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
files_to_check = [os.path.relpath(os.path.abspath(f), base_dir) for f in flags.files]
# move current dir so the script find the files
os.chdir(base_dir)
else:
files_to_check = flags.files
if len(files_to_check) == 0:
print("No files to check style")
sys.exit(1)
# Accumulate number of warnings generated and lines processed.
total_warnings = 0
total_lines = 0
for fname in files_to_check:
nwarnings, nlines = check_file_using_lib(fname)
total_warnings += nwarnings
total_lines += nlines
# The warning messages are printed to stdout and can be post-processed
# (e.g. counted by 'wc'), so for stats use stderr. Wait all warnings are
# printed, for the case there are many of them, before printing stats.
sys.stdout.flush()
if not flags.quiet:
print("{} lines processed".format(total_lines), file=sys.stderr)
print("{} warnings generated".format(total_warnings), file=sys.stderr)
if total_warnings > 0:
sys.exit(1)
__main__()
| {
"pile_set_name": "Github"
} |
/**
* Copyright 2015 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as lolex from 'lolex';
import {BASE_CID_MAX_AGE_MILLIS} from '../../src/service/cid-impl';
import {
getCookie,
getHighestAvailableDomain,
setCookie,
} from '../../src/cookies';
describes.fakeWin('test-cookies', {amp: true}, (env) => {
let win;
let clock;
let doc;
beforeEach(() => {
win = env.win;
doc = win.document;
clock = lolex.install({
target: window,
now: new Date('2018-01-01T08:00:00Z'),
});
});
afterEach(() => {
clock.uninstall();
});
it('should return null for no cookie, malformed, or not found', () => {
expect(doc.cookie).to.equal('');
expect(getCookie(win, 'c1')).to.be.null;
expect(getCookie(win, 'c1')).to.be.null;
doc.cookie = 'c1';
expect(getCookie(win, 'c1')).to.be.null;
doc.cookie = 'e2=1';
expect(getCookie(win, 'c1')).to.be.null;
});
it('should return value when found', () => {
doc.cookie = 'c1=1';
expect(getCookie(win, 'c1')).to.equal('1');
doc.cookie = ' c2 = 2 ';
expect(doc.cookie).to.equal('c1=1; c2 = 2 ');
expect(getCookie(win, 'c1')).to.equal('1');
expect(getCookie(win, 'c2')).to.equal('2');
});
it('should return value for an escaped cookie name', () => {
doc.cookie = 'c%26=1';
expect(doc.cookie).to.equal('c%26=1');
expect(getCookie(win, 'c&')).to.equal('1');
});
it('should return an unescaped value', () => {
doc.cookie = 'c1=1%26';
expect(doc.cookie).to.equal('c1=1%26');
expect(getCookie(win, 'c1')).to.equal('1&');
});
it('should write the cookie', () => {
setCookie(win, 'c&1', 'v&1', Date.now() + BASE_CID_MAX_AGE_MILLIS);
expect(doc.lastSetCookieRaw).to.equal(
'c%261=v%261; path=/; expires=Tue, 01 Jan 2019 08:00:00 GMT'
);
expect(doc.cookie).to.equal('c%261=v%261');
});
it('should respect the secure option', () => {
const date = Date.now() + BASE_CID_MAX_AGE_MILLIS;
const utcDate = new Date(date).toUTCString();
setCookie(win, 'name', 'val', date, {secure: 'true'});
expect(doc.lastSetCookieRaw).to.equal(
`name=val; path=/; expires=${utcDate}; Secure`
);
expect(doc.cookie).to.equal('name=val');
});
it('getHighestAvailableDomain without meta tag', () => {
// Proxy Origin
win.location = 'https://foo-bar.cdn.ampproject.org/c/foo.bar.com';
expect(getHighestAvailableDomain(win)).to.be.null;
win.location = 'https://bar.com';
expect(getHighestAvailableDomain(win)).to.equal('bar.com');
win.location = 'https://bar.net';
expect(getHighestAvailableDomain(win)).to.equal('bar.net');
win.location = 'https://foo.bar.com';
expect(getHighestAvailableDomain(win)).to.equal('bar.com');
doc.publicSuffixList = ['bar.com'];
win.location = 'https://bar.com';
expect(getHighestAvailableDomain(win)).to.be.null;
win.location = 'https://bar.net';
expect(getHighestAvailableDomain(win)).to.equal('bar.net');
win.location = 'https://foo.bar.com';
expect(getHighestAvailableDomain(win)).to.equal('foo.bar.com');
expect(doc.cookie).to.equal('');
// Special case, has test cookie name conflict
win.location = 'https://foo.bar.com';
doc.cookie = '-amp-cookie-test-tmp=test';
expect(getHighestAvailableDomain(win)).to.equal('foo.bar.com');
expect(doc.cookie).to.equal('-amp-cookie-test-tmp=test');
});
it('getHigestAvaibleDomain in valid meta tag', () => {
win.location = 'https://abc.foo.bar.com';
expect(getHighestAvailableDomain(win)).to.equal('bar.com');
let meta = doc.createElement('meta');
meta.setAttribute('name', 'amp-cookie-scope');
meta.setAttribute('content', 'foo.bar.com');
doc.head.appendChild(meta);
expect(getHighestAvailableDomain(win)).to.equal('foo.bar.com');
meta.remove();
win.location = 'https://abc-foo-bar.cdn.ampproject.org/c/foo.bar.com';
expect(getHighestAvailableDomain(win)).to.be.null;
meta = doc.createElement('meta');
meta.setAttribute('name', 'amp-cookie-scope');
meta.setAttribute('content', 'foo.bar.com');
doc.head.appendChild(meta);
expect(getHighestAvailableDomain(win)).to.equal('foo.bar.com');
});
it('getHigestAvaibleDomain with invalid meta tag', () => {
win.location = 'https://foo.bar.com';
expect(getHighestAvailableDomain(win)).to.equal('bar.com');
let meta = doc.createElement('meta');
meta.setAttribute('name', 'amp-cookie-scope');
meta.setAttribute('content', 'invalid.com');
doc.head.appendChild(meta);
expect(getHighestAvailableDomain(win)).to.equal('foo.bar.com');
meta.remove();
win.location = 'https://foo-bar.cdn.ampproject.org/c/foo.bar.com';
expect(getHighestAvailableDomain(win)).to.be.null;
meta = doc.createElement('meta');
meta.setAttribute('name', 'amp-cookie-scope');
meta.setAttribute('content', 'invalid.com');
doc.head.appendChild(meta);
expect(getHighestAvailableDomain(win)).to.equal('foo.bar.com');
});
it('should write the cookie to the right domain on origin', () => {
function test(url, targetDomain, opt_allowProxyOrigin) {
expect(doc.cookie).to.equal('');
win.location = url;
setCookie(win, 'c&1', 'v&1', Date.now() + BASE_CID_MAX_AGE_MILLIS, {
highestAvailableDomain: true,
allowOnProxyOrigin: opt_allowProxyOrigin,
});
expect(doc.lastSetCookieRaw).to.equal(
`c%261=v%261; path=/; domain=${targetDomain}; ` +
'expires=Tue, 01 Jan 2019 08:00:00 GMT'
);
expect(doc.cookie).to.equal('c%261=v%261');
// Erase cookie
setCookie(win, 'c&1', 'v&1', Date.now() - 1000, {
highestAvailableDomain: true,
allowOnProxyOrigin: opt_allowProxyOrigin,
});
expect(doc.cookie).to.equal('');
}
//example.com
test('https://www.example.com/test.html', 'example.com');
test('https://123.www.example.com/test.html', 'example.com');
test('https://example.com/test.html', 'example.com');
test('https://www.example.net', 'example.net');
doc.publicSuffixList = ['example.com'];
test('https://123.www.example.com/test.html', 'www.example.com');
});
it('write cookie to right domain on proxy', () => {
win.location = 'https://foo.cdn.ampproject.org/test.html';
setCookie(win, 'c&1', 'v&1', Date.now() + BASE_CID_MAX_AGE_MILLIS, {
domain: 'foo.cdn.ampproject.org',
allowOnProxyOrigin: true,
});
expect(doc.lastSetCookieRaw).to.equal(
`c%261=v%261; path=/; domain=foo.cdn.ampproject.org; ` +
'expires=Tue, 01 Jan 2019 08:00:00 GMT'
);
expect(doc.cookie).to.equal('c%261=v%261');
// Fail if allowOnProxyOrigin is false
expect(() => {
allowConsoleError(() => {
setCookie(win, 'c&1', 'v&1', Date.now() + BASE_CID_MAX_AGE_MILLIS, {});
});
}).to.throw(/Should never attempt to set cookie on proxy origin\: c\&1/);
win.location = 'https://CDN.ampproject.org/test.html';
expect(() => {
allowConsoleError(() => {
setCookie(win, 'c&1', 'v&1', Date.now() + BASE_CID_MAX_AGE_MILLIS, {});
});
}).to.throw(/Should never attempt to set cookie on proxy origin\: c\&1/);
win.location = 'https://foo.bar.cdn.ampproject.org/test.html';
expect(() => {
allowConsoleError(() => {
setCookie(win, 'c&1', 'v&1', Date.now() + BASE_CID_MAX_AGE_MILLIS, {});
});
}).to.throw(/in depth check/);
win.location = 'http://&&&.CDN.ampproject.org/test.html';
expect(() => {
allowConsoleError(() => {
setCookie(win, 'c&1', 'v&1', Date.now() + BASE_CID_MAX_AGE_MILLIS, {});
});
}).to.throw(/in depth check/);
// Can't use higestAvailableDomain when allowOnProxyOrigin
expect(() => {
allowConsoleError(() => {
setCookie(win, 'c&1', 'v&1', Date.now() + BASE_CID_MAX_AGE_MILLIS, {
allowOnProxyOrigin: true,
highestAvailableDomain: true,
});
});
}).to.throw(/specify domain explicitly/);
// Cannot write to 'ampproject.org'
setCookie(win, 'c&1', 'v&1', Date.now() + BASE_CID_MAX_AGE_MILLIS, {
domain: 'ampproject.org',
allowOnProxyOrigin: true,
});
expect(doc.lastSetCookieRaw).to.equal(
`c%261=delete; path=/; domain=ampproject.org; ` +
'expires=Thu, 01 Jan 1970 00:00:00 GMT'
);
expect(doc.cookie).to.equal('');
});
});
| {
"pile_set_name": "Github"
} |
package com.an.trailers.ui.detail.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.an.trailers.AppConstants;
import com.an.trailers.R;
import com.an.trailers.data.remote.model.Cast;
import com.an.trailers.data.remote.model.Crew;
import com.an.trailers.databinding.CreditListWithItemBinding;
import com.squareup.picasso.Picasso;
import java.util.Collections;
import java.util.List;
import static com.an.trailers.AppConstants.CREDIT_CAST;
public class CreditListAdapter extends RecyclerView.Adapter<CreditListAdapter.CustomViewHolder> {
private String type;
private Context context;
private List<Cast> casts;
private List<Crew> crews;
public CreditListAdapter(Context context, String type) {
this.type = type;
this.context = context;
this.casts = Collections.emptyList();
this.crews = Collections.emptyList();
}
public CreditListAdapter(Context context, List<Cast> casts) {
this.type = CREDIT_CAST;
this.context = context;
this.casts = casts;
this.crews = Collections.emptyList();
}
public CreditListAdapter(Context context, String type, List<Crew> crews) {
this.type = type;
this.context = context;
this.casts = Collections.emptyList();
this.crews = crews;
}
@Override
public CustomViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
CreditListWithItemBinding itemBinding = CreditListWithItemBinding.inflate(layoutInflater, parent, false);
CustomViewHolder viewHolder = new CustomViewHolder(itemBinding);
return viewHolder;
}
@Override
public void onBindViewHolder(CustomViewHolder holder, int position) {
if(isCast()) {
Cast cast = getCastItem(position);
Picasso.get().load(String.format(AppConstants.IMAGE_URL, cast.getProfilePath()))
.error(R.drawable.ic_placeholder_profile)
.into(holder.binding.profileImage);
holder.binding.txtName.setText(cast.getName());
holder.binding.txtInfo.setText(cast.getCharacter());
} else {
Crew crew = getCrewItem(position);
Picasso.get().load(String.format(AppConstants.IMAGE_URL, crew.getProfilePath()))
.error(R.drawable.ic_placeholder_profile)
.into(holder.binding.profileImage);
holder.binding.txtName.setText(crew.getName());
holder.binding.txtInfo.setText(crew.getJob());
}
}
@Override
public int getItemCount() {
if(isCast()) return casts.size();
return crews.size();
}
public Boolean isCast() {
if(type.equalsIgnoreCase(CREDIT_CAST))
return Boolean.TRUE;
return Boolean.FALSE;
}
public Cast getCastItem(int position) {
return casts.get(position);
}
public Crew getCrewItem(int position) {
return crews.get(position);
}
public class CustomViewHolder extends RecyclerView.ViewHolder {
private CreditListWithItemBinding binding;
public CustomViewHolder(CreditListWithItemBinding binding) {
super(binding.getRoot());
this.binding = binding;
}
}
}
| {
"pile_set_name": "Github"
} |
//
// main.m
// RWTFlickrSearch
//
// Created by Colin Eberhardt on 20/05/2014.
// Copyright (c) 2014 Colin Eberhardt. All rights reserved.
//
@import UIKit;
#import "RWTAppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([RWTAppDelegate class]));
}
}
| {
"pile_set_name": "Github"
} |
// XXX: For some reason, this file must not be compiled
// XXX: Ask MS why
#if 0
#pragma once
#include "DirectXHelper.h"
#include <wrl/client.h>
#include <d3d11_1.h>
#include <agile.h>
// Helper class that initializes DirectX APIs for 3D rendering.
ref class DirectXBase abstract
{
internal:
DirectXBase();
public:
virtual void Initialize(Windows::UI::Core::CoreWindow^ window, float dpi);
virtual void HandleDeviceLost();
virtual void CreateDeviceResources();
virtual void CreateWindowSizeDependentResources();
virtual void UpdateForWindowSizeChange();
virtual void ReleaseResourcesForSuspending();
virtual void Present();
virtual float ConvertDipsToPixels(float dips);
virtual void SetDpi(float dpi);
protected private:
// Direct3D Objects.
Microsoft::WRL::ComPtr<ID3D11Device1> m_d3dDevice;
Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_d3dContext;
Microsoft::WRL::ComPtr<IDXGISwapChain1> m_swapChain;
Microsoft::WRL::ComPtr<ID3D11RenderTargetView> m_renderTargetView;
Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_depthStencilView;
// Cached renderer properties.
D3D_FEATURE_LEVEL m_featureLevel;
Windows::Foundation::Size m_renderTargetSize;
Windows::Foundation::Rect m_windowBounds;
Platform::Agile<Windows::UI::Core::CoreWindow> m_window;
float m_dpi;
};
#endif // 0
| {
"pile_set_name": "Github"
} |
/**
* Copyright (C) 2014-2017 Xavier Witdouck
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zavtech.morpheus.array.mapped;
import java.io.File;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Year;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Currency;
import java.util.Date;
import java.util.TimeZone;
import java.util.UUID;
import com.zavtech.morpheus.array.Array;
import com.zavtech.morpheus.array.ArrayException;
import com.zavtech.morpheus.array.ArrayFactory;
import com.zavtech.morpheus.array.ArrayType;
import com.zavtech.morpheus.array.coding.IntCoding;
import com.zavtech.morpheus.array.coding.LongCoding;
/**
* An ArrayFactory.Constructor implementation designed to manufacture memoey mapped Morpheus Arrays.
*
* <p><strong>This is open source software released under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 License</a></strong></p>
*
* @author Xavier Witdouck
*/
public class MappedArrayConstructor implements ArrayFactory.Constructor {
private static File memoryMappedBasePath = new File(System.getProperty("morpheus.array.path", System.getProperty("user.home") + "/.morpheus/temp"));
private static final IntCoding<Year> yearCoding = new IntCoding.OfYear();
private static final IntCoding<Currency> currencyCoding = new IntCoding.OfCurrency();
private static final IntCoding<ZoneId> zoneIdCoding = IntCoding.ofZoneId();
private static final IntCoding<TimeZone> timeZoneCoding = IntCoding.ofTimeZone();
private static final LongCoding<Date> dateCoding = LongCoding.ofDate();
private static final LongCoding<Instant> instantCoding = LongCoding.ofInstant();
private static final LongCoding<LocalDate> localDateCoding = LongCoding.ofLocalDate();
private static final LongCoding<LocalTime> localTimeCoding = LongCoding.ofLocalTime();
private static final LongCoding<LocalDateTime> localDateTimeCoding = LongCoding.ofLocalDateTime();
/**
* Constructor
*/
public MappedArrayConstructor() {
super();
}
@Override()
public final <T> Array<T> apply(Class<T> type, int length, T defaultValue) {
return apply(type, length, defaultValue, null);
}
@Override
@SuppressWarnings("unchecked")
public <T> Array<T> apply(Class<T> type, int length, T defaultValue, String path) {
final File file = path == null ? randomFile(true) : createDir(new File(path));
if (type.isEnum()) {
final IntCoding<T> enumCoding = (IntCoding<T>)IntCoding.ofEnum((Class<Enum>) type);
return new MappedArrayWithIntCoding<>(length, defaultValue, enumCoding, file);
} else {
switch (ArrayType.of(type)) {
case BOOLEAN: return (Array<T>)new MappedArrayOfBooleans(length, (Boolean)defaultValue, file);
case INTEGER: return (Array<T>)new MappedArrayOfInts(length, (Integer)defaultValue, file);
case LONG: return (Array<T>)new MappedArrayOfLongs(length, (Long)defaultValue, file);
case DOUBLE: return (Array<T>)new MappedArrayOfDoubles(length, (Double)defaultValue, file);
case CURRENCY: return (Array<T>)new MappedArrayWithIntCoding<>(length, (Currency)defaultValue, currencyCoding, file);
case YEAR: return (Array<T>)new MappedArrayWithIntCoding<>(length, (Year)defaultValue, yearCoding, file);
case ZONE_ID: return (Array<T>)new MappedArrayWithIntCoding<>(length, (ZoneId)defaultValue, zoneIdCoding, file);
case TIME_ZONE: return (Array<T>)new MappedArrayWithIntCoding<>(length, (TimeZone)defaultValue, timeZoneCoding, file);
case DATE: return (Array<T>)new MappedArrayWithLongCoding<>(length, (Date)defaultValue, dateCoding, file);
case INSTANT: return (Array<T>)new MappedArrayWithLongCoding<>(length, (Instant)defaultValue, instantCoding, file);
case LOCAL_DATE: return (Array<T>)new MappedArrayWithLongCoding<>(length, (LocalDate)defaultValue, localDateCoding, file);
case LOCAL_TIME: return (Array<T>)new MappedArrayWithLongCoding<>(length, (LocalTime)defaultValue, localTimeCoding, file);
case LOCAL_DATETIME: return (Array<T>)new MappedArrayWithLongCoding<>(length, (LocalDateTime)defaultValue, localDateTimeCoding, file);
case ZONED_DATETIME: return (Array<T>)new MappedArrayOfZonedDateTimes(length, (ZonedDateTime)defaultValue, file);
default: throw new UnsupportedOperationException("Data type currently not supported for memory mapped arrays: " + type);
}
}
}
/**
* Returns a newly created random file to store an array
* @return newly created random file
*/
static File randomFile(boolean deleteOnExit) {
final File file = new File(memoryMappedBasePath, UUID.randomUUID().toString() + ".dat");
if (deleteOnExit) {
file.deleteOnExit();
}
return createDir(file);
}
/**
* Creates the directories for the mapped file if they do not already exist
* @param file the memory mapped file handle
* @return the same as arg
*/
private static File createDir(File file) {
if (!file.exists()) {
final File dir = file.getParentFile();
if (dir != null && !dir.exists()) {
if (!dir.mkdirs()) {
throw new ArrayException("Unable to create directory for memory mapped file at: " + file.getAbsolutePath());
}
}
}
return file;
}
}
| {
"pile_set_name": "Github"
} |
// Copyright Peter Dimov 2001-2002
// Copyright Aleksey Gurtovoy 2001-2004
//
// 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)
//
// Preprocessed version of "boost/mpl/arg.hpp" header
// -- DO NOT modify by hand!
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
template<> struct arg< -1 >
{
BOOST_STATIC_CONSTANT(int, value = -1);
BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
typedef U1 type;
BOOST_MPL_AUX_ASSERT_NOT_NA(type);
};
};
template<> struct arg<1>
{
BOOST_STATIC_CONSTANT(int, value = 1);
typedef arg<2> next;
BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
typedef U1 type;
BOOST_MPL_AUX_ASSERT_NOT_NA(type);
};
};
template<> struct arg<2>
{
BOOST_STATIC_CONSTANT(int, value = 2);
typedef arg<3> next;
BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
typedef U2 type;
BOOST_MPL_AUX_ASSERT_NOT_NA(type);
};
};
template<> struct arg<3>
{
BOOST_STATIC_CONSTANT(int, value = 3);
typedef arg<4> next;
BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
typedef U3 type;
BOOST_MPL_AUX_ASSERT_NOT_NA(type);
};
};
template<> struct arg<4>
{
BOOST_STATIC_CONSTANT(int, value = 4);
typedef arg<5> next;
BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
typedef U4 type;
BOOST_MPL_AUX_ASSERT_NOT_NA(type);
};
};
template<> struct arg<5>
{
BOOST_STATIC_CONSTANT(int, value = 5);
typedef arg<6> next;
BOOST_MPL_AUX_ARG_TYPEDEF(na, tag)
BOOST_MPL_AUX_ARG_TYPEDEF(na, type)
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
typedef U5 type;
BOOST_MPL_AUX_ASSERT_NOT_NA(type);
};
};
BOOST_MPL_AUX_NONTYPE_ARITY_SPEC(1,int, arg)
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
| {
"pile_set_name": "Github"
} |
/* XMRig
* Copyright 2010 Jeff Garzik <[email protected]>
* Copyright 2012-2014 pooler <[email protected]>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <[email protected]>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2018-2019 tevador <[email protected]>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <[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 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/>.
*/
#include "crypto/common/MemoryPool.h"
#include "crypto/common/VirtualMemory.h"
#include <cassert>
namespace xmrig {
constexpr size_t pageSize = 2 * 1024 * 1024;
} // namespace xmrig
xmrig::MemoryPool::MemoryPool(size_t size, bool hugePages, uint32_t node)
{
if (!size) {
return;
}
m_memory = new VirtualMemory(size * pageSize, hugePages, false, false, node);
}
xmrig::MemoryPool::~MemoryPool()
{
delete m_memory;
}
bool xmrig::MemoryPool::isHugePages(uint32_t) const
{
return m_memory && m_memory->isHugePages();
}
uint8_t *xmrig::MemoryPool::get(size_t size, uint32_t)
{
assert(!(size % pageSize));
if (!m_memory || (m_memory->size() - m_offset) < size) {
return nullptr;
}
uint8_t *out = m_memory->scratchpad() + m_offset;
m_offset += size;
++m_refs;
return out;
}
void xmrig::MemoryPool::release(uint32_t)
{
assert(m_refs > 0);
if (m_refs > 0) {
--m_refs;
}
if (m_refs == 0) {
m_offset = 0;
}
}
| {
"pile_set_name": "Github"
} |
# NGINX Homebrew Tap
This tap is designed specifically for a custom build of NGINX with more module options.
## How do I install these formule (NGINX Modules)?
Once the tap is installed, you can install `nginx-full`
with optional [additional modules](https://denji.github.io/homebrew-nginx/#modules):
brew tap denji/nginx
brew install nginx-full --with-upload-module
For a list of available configuration options run:
brew options nginx-full
brew info nginx-full
## What about conflicts?
You are free to install this version alongside a current install of NGINX from `Homebrew/homebrew` if you wish. However, they cannot be linked at the same time. To switch between them use brew's built in linking system.
brew unlink nginx
brew link nginx-full
## Documentation
`brew help`, `man brew` or check [Homebrew's documentation](https://github.com/Homebrew/brew/blob/master/docs/README.md).
## Contributing
Please see the [contributing guide](https://github.com/denji/homebrew-nginx/blob/master/.github/CONTRIBUTING.md).
## How to submit a new formula
* Fork this repository on GitHub.
* Clone to your Mac.
* Read and look at the other formule here.
* In your locally cloned `homebrew-nginx` repo, create a new branch: `git checkout --branch my_new_formula`
* Write/edit your formula (ruby file). Check [Homebrew's documentation](https://github.com/Homebrew/brew/blob/master/docs/README.md) for details.
* Test it locally! `brew install ./my-new-formula.rb`. Does it install? Note, `./<formula>.rb` will target the local file.
* `git push --set-upstream origin my-new-formula` to get it into your GitHub fork as a new branch.
* If you have to change something, add a commit and `git push`.
* On GitHub, select your new branch and then click the "Pull Request" button.
| {
"pile_set_name": "Github"
} |
---
title: Range.Columns Property (Word)
keywords: vbawd10.chm157155630
f1_keywords:
- vbawd10.chm157155630
ms.prod: word
api_name:
- Word.Range.Columns
ms.assetid: 667b808a-e885-a7b7-0a68-5b2466ddd869
ms.date: 06/08/2017
---
# Range.Columns Property (Word)
Returns a **[Columns](columns-object-word.md)** collection that represents all the table columns in the range. Read-only.
## Syntax
_expression_ . **Columns**
_expression_ A variable that represents a **[Range](range-object-word.md)** object.
## Remarks
For information about returning a single member of a collection, see [Returning an Object from a Collection](http://msdn.microsoft.com/library/28f76384-f495-9640-a7c8-10ada3fac727%28Office.15%29.aspx).
## Example
This example displays the number of columns in the first table in the active document.
```vb
If ActiveDocument.Tables.Count >= 1 Then
MsgBox ActiveDocument.Tables(1).Columns.Count
End If
```
This example sets the width of the current column to 1 inch.
```vb
If Selection.Information(wdWithInTable) = True Then
Selection.Columns.SetWidth ColumnWidth:=InchesToPoints(1), _
RulerStyle:=wdAdjustProportional
End If
```
## See also
#### Concepts
[Range Object](range-object-word.md)
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Serenity Reports</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
<!--[if IE 7]>
<link rel="stylesheet" href="font-awesome/css/font-awesome-ie7.min.css">
<![endif]--><!-- JQuery -->
<script type="text/javascript" src="scripts/jquery-1.11.1.min.js"></script><!-- Bootstrap -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script src="bootstrap/js/bootstrap.min.js"></script><link rel="stylesheet" href="css/core.css"/>
<link rel="stylesheet" href="css/link.css"/>
<link type="text/css" media="screen" href="css/screen.css" rel="Stylesheet"/><!-- JQuery-UI -->
<link type="text/css" href="jqueryui/1.11.2-start/jquery-ui.min.css" rel="Stylesheet" />
<script type="text/javascript" src="jqueryui/1.11.2-start/jquery-ui.min.js"></script><!-- DataTables -->
<link type="text/css" href="datatables/1.10.4/media/jqueryui/dataTables.jqueryui.css" rel="Stylesheet"/>
<link type="text/css" href="css/tables.css" rel="stylesheet" />
<script type="text/javascript" src="datatables/1.10.4/media/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="datatables/1.10.4/media/jqueryui/dataTables.jqueryui.min.js"></script><!-- jQplot -->
<!--[if IE]>
<script language="javascript" type="text/javascript" src="excanvas/3/excanvas.compiled.js"></script>
<![endif]--><link rel="stylesheet" type="text/css" href="jqplot/1.0.8/jquery.jqplot.min.css"/>
<script type="text/javascript" src="jqplot/1.0.8/jquery.jqplot.min.js"></script>
<script type="text/javascript" src="jqplot/1.0.8/plugins/jqplot.pieRenderer.min.js"></script>
<script class="code" type="text/javascript">$(document).ready(function () {
var test_results_plot = $.jqplot('test_results_pie_chart', [
[
['Passing', 1],
['Pending', 0],
['Ignored', 0],
['Failing', 0],
['Errors', 0],
['Compromised', 0]
]
], {
gridPadding: {top: 0, bottom: 38, left: 0, right: 0},
seriesColors: ['#30cb23',
'#a2f2f2',
'#eeeadd',
'#f8001f',
'#fc6e1f',
'fuchsia'],
seriesDefaults: {
renderer: $.jqplot.PieRenderer,
trendline: { show: false },
rendererOptions: { padding: 8, showDataLabels: true }
},
legend: {
show: true,
placement: 'outside',
rendererOptions: {
numberRows: 2
},
location: 's',
marginTop: '15px'
},
series: [
{label: '12 / 12 tests passed' },
{label: '0 / 12 tests pending'},
{label: '0 / 12 tests not executed'},
{label: '0 / 12 tests failed'},
{label: '0 / 12 errors'},
{label: '0 / 12 compromised tests'}
]
});
var weighted_test_results_plot = $.jqplot('weighted_test_results_pie_chart', [
[
['Passing', 1],
['Pending', 0],
['Ignored', 0],
['Failing', 0],
['Errors', 0],
['Compromised', 0],
]
], {
gridPadding: {top: 0, bottom: 38, left: 0, right: 0},
seriesColors: ['#30cb23',
'#a2f2f2',
'#eeeadd',
'#f8001f',
'#fc6e1f',
'mediumvioletred'],
seriesDefaults: {
renderer: $.jqplot.PieRenderer,
trendline: { show: false },
rendererOptions: { padding: 8, showDataLabels: true }
},
legend: {
show: true,
placement: 'outside',
rendererOptions: {
numberRows: 2
},
location: 's',
marginTop: '15px'
},
series: [
{label: '12 / 12 tests passed (1% of all test steps)' },
{label: '0 / 12 tests pending'},
{label: '0 / 12 tests not executed'},
{label: '0 / 12 tests failed (0% of all test steps)'},
{label: '0 / 12 errors (0% of all test steps)'}
]
});
// Results table
$('#test-results-table').DataTable({
"order": [
[ 1, "asc" ]
],
"pageLength": 100,
"lengthMenu": [ [50, 100, 200, -1] , [50, 100, 200, "All"] ]
});
// Pie charts
$('#test-results-tabs').tabs();
$('#toggleNormalPieChart').click(function () {
$("#test_results_pie_chart").toggle();
});
$('#toggleWeightedPieChart').click(function () {
$("#weighted_test_results_pie_chart").toggle();
});
})
;
</script>
</head>
<body class="results-page">
<div id="topheader">
<div id="topbanner">
<div id="logo"><a href="index.html"><img src="images/serenity-bdd-logo.png" border="0"/></a></div>
<div id="projectname-banner" style="float:right">
<span class="projectname"></span>
</div>
</div>
</div>
<div class="middlecontent">
<div id="contenttop">
<div class="middlebg">
<span class="breadcrumbs"><a href="index.html">Home</a>
> Tag
> Screenplay Pattern
</span>
</div>
<div class="rightbg"></div>
</div>
<div class="clr"></div>
<!--/* starts second table*/-->
<div>
<ul class="nav nav-tabs" role="tablist">
<li class="active">
<a href="#"><i class="fa fa-check-square-o"></i> Overall Test Results</a>
</li>
<li >
<a href="capabilities.html"><i class="fa fa-book"></i> Requirements</a>
</li>
<li >
<a href="e3a5a59a6d792683cf33d050ee0f6f92.html"><i class="fa fa-comments-o"></i> Capabilities</a>
</li>
<li >
<a href="d782c44557441225cc92a5e35bf4b23b.html"><i class="fa fa-comments-o"></i> Features</a>
</li>
</ul>
<span class="date-and-time"><a href="build-info.html"><i class="fa fa-info-circle"></i></a> Report generated 24-11-2016 14:05</span>
<br style="clear:left"/>
</div>
<div class="clr"></div>
<div id="beforetable"></div>
<div id="results-dashboard">
<div class="middlb">
<div class="table">
<h2><i class='fa fa-tags'></i> Tag: Screenplay Pattern</h2>
<table class='overview'>
<tr>
<td width="375px" valign="top">
<div class="test-count-summary">
<span class="test-count-title">12
test scenarios </span>
<div>
<span class="test-count"> |
12
<a href="d85744a3e3199b41a219101bf0d06fc9.html">passed</a>
</span>
|
<a href="9764384eb789565b075c99d4dbef6849.csv" title="Download CSV"> <i class="fa fa-download" title="Download CSV"></i></a>
</div>
</div>
<div id="test-results-tabs">
<ul>
<li><a href="#test-results-tabs-1">Test Count</a></li>
<li><a href="#test-results-tabs-2">Weighted Tests</a></li>
</ul>
<div id="test-results-tabs-1">
<table>
<tr>
<td colspan="2">
<span class="caption">Total number of tests that pass, fail, or are pending.</span>
<span class="togglePieChart" id="toggleNormalPieChart"><a href="#">Show/Hide Pie Chart</a></span>
</td>
</tr>
<tr>
<td style="vertical-align: text-top;">
<div id="test_results_pie_chart"></div>
</td>
<td class="related-tags-section">
<div>
<div>
<h4>Test Result Summary</h4>
<table class="summary-table">
<head>
<tr>
<th>Test Type</th>
<th>Total</th>
<th>Pass <i class="icon-check"/> </th>
<th>Fail <i class="icon-thumbs-down"/></th>
<th>Pending <i class="icon-calendar"/></th>
<th>Ignored <i class="icon-ban-circle"/></th>
</tr>
</head>
<body>
<tr>
<td class="summary-leading-column">Automated</td>
<td>12</td>
<td>12 (100%)</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
</tr>
<tr>
<td class="summary-leading-column">Manual</td>
<td>0</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
</tr>
<tr>
<td class="summary-leading-column">Total</td>
<td>12</td>
<td>12 (100%)</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
</tr>
<tr>
<td class="summary-leading-column">Total Duration</td>
<td colspan="5">1 minutes 34 seconds</td>
</tr>
</body>
</table>
</div> </div>
<div>
<table class="tags-summary-table">
<tr>
<td width="300px"><h3>Related Tags</h3></td>
<td width="90px" class="tag-count-header">% Passed</td>
<td width="130px" class="test-count"> </td>
<td class="tag-count-header">Test count</td>
</tr>
</table>
<table class="test-summary-table">
<tr>
<td colspan="3">
<div class="tagTypeTitle">Capabilities
</div>
</td>
</tr>
<tr>
<td class="bluetext" class="tag-title">
<span class="SUCCESS-text ellipsis">
<a href="87e4d1169cae1c74b3c8cb4a5ce2e893.html" title="Completing Todos">Completing Todos</a>
</span>
</td>
<td width="220px" class="table-figure">
<table>
<tr>
<td class="related-tag-percentage"><span title="4 out of 4 tests (46 steps) passing">100%</span></td>
<td width="150px">
<a href="87e4d1169cae1c74b3c8cb4a5ce2e893.html">
<div class="pendingbar"
title="0 out of 4 tests (0 steps) pending"
style="width: 150px;">
<div class="ignoredbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) skipped or ignored">
<div class="compromisedbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) compromised">
<div class="errorbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) broken">
<div class="failingbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) failing">
<div class="passingbar"
style="width: 150px;"
title="4 out of 4 tests (46 steps) passing">
</div>
</div>
</div>
</div>
</div>
</div>
</a>
</td>
<td class="related-tag-count"><span class="result-test-count" title="4 tests">4</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bluetext" class="tag-title">
<span class="SUCCESS-text ellipsis">
<a href="dcebe5910714db6a1ae91d443a539777.html" title="Maintain My Todo List">Maintain My Todo List</a>
</span>
</td>
<td width="220px" class="table-figure">
<table>
<tr>
<td class="related-tag-percentage"><span title="8 out of 8 tests (103 steps) passing">100%</span></td>
<td width="150px">
<a href="dcebe5910714db6a1ae91d443a539777.html">
<div class="pendingbar"
title="0 out of 8 tests (0 steps) pending"
style="width: 150px;">
<div class="ignoredbar"
style="width: 150px;"
title="0 out of 8 tests (0 steps) skipped or ignored">
<div class="compromisedbar"
style="width: 150px;"
title="0 out of 8 tests (0 steps) compromised">
<div class="errorbar"
style="width: 150px;"
title="0 out of 8 tests (0 steps) broken">
<div class="failingbar"
style="width: 150px;"
title="0 out of 8 tests (0 steps) failing">
<div class="passingbar"
style="width: 150px;"
title="8 out of 8 tests (103 steps) passing">
</div>
</div>
</div>
</div>
</div>
</div>
</a>
</td>
<td class="related-tag-count"><span class="result-test-count" title="8 tests">8</span></td>
</tr>
</table>
</td>
</tr>
</table>
<table class="test-summary-table">
<tr>
<td colspan="3">
<div class="tagTypeTitle">Features
</div>
</td>
</tr>
<tr>
<td class="bluetext" class="tag-title">
<span class="SUCCESS-text ellipsis">
<a href="a6bcbaf11189d0bcaada2a92512520f0.html" title="Toggle All Todos">Toggle All Todos</a>
</span>
</td>
<td width="220px" class="table-figure">
<table>
<tr>
<td class="related-tag-percentage"><span title="4 out of 4 tests (46 steps) passing">100%</span></td>
<td width="150px">
<a href="a6bcbaf11189d0bcaada2a92512520f0.html">
<div class="pendingbar"
title="0 out of 4 tests (0 steps) pending"
style="width: 150px;">
<div class="ignoredbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) skipped or ignored">
<div class="compromisedbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) compromised">
<div class="errorbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) broken">
<div class="failingbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) failing">
<div class="passingbar"
style="width: 150px;"
title="4 out of 4 tests (46 steps) passing">
</div>
</div>
</div>
</div>
</div>
</div>
</a>
</td>
<td class="related-tag-count"><span class="result-test-count" title="4 tests">4</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bluetext" class="tag-title">
<span class="SUCCESS-text ellipsis">
<a href="5465df97aa3c16958030988dc753eca9.html" title="Clear Completed Todos">Clear Completed Todos</a>
</span>
</td>
<td width="220px" class="table-figure">
<table>
<tr>
<td class="related-tag-percentage"><span title="3 out of 3 tests (32 steps) passing">100%</span></td>
<td width="150px">
<a href="5465df97aa3c16958030988dc753eca9.html">
<div class="pendingbar"
title="0 out of 3 tests (0 steps) pending"
style="width: 150px;">
<div class="ignoredbar"
style="width: 150px;"
title="0 out of 3 tests (0 steps) skipped or ignored">
<div class="compromisedbar"
style="width: 150px;"
title="0 out of 3 tests (0 steps) compromised">
<div class="errorbar"
style="width: 150px;"
title="0 out of 3 tests (0 steps) broken">
<div class="failingbar"
style="width: 150px;"
title="0 out of 3 tests (0 steps) failing">
<div class="passingbar"
style="width: 150px;"
title="3 out of 3 tests (32 steps) passing">
</div>
</div>
</div>
</div>
</div>
</div>
</a>
</td>
<td class="related-tag-count"><span class="result-test-count" title="3 tests">3</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bluetext" class="tag-title">
<span class="SUCCESS-text ellipsis">
<a href="e4ba99cbaff3a8ee071ebc4bc5287462.html" title="Filtering Todos">Filtering Todos</a>
</span>
</td>
<td width="220px" class="table-figure">
<table>
<tr>
<td class="related-tag-percentage"><span title="5 out of 5 tests (71 steps) passing">100%</span></td>
<td width="150px">
<a href="e4ba99cbaff3a8ee071ebc4bc5287462.html">
<div class="pendingbar"
title="0 out of 5 tests (0 steps) pending"
style="width: 150px;">
<div class="ignoredbar"
style="width: 150px;"
title="0 out of 5 tests (0 steps) skipped or ignored">
<div class="compromisedbar"
style="width: 150px;"
title="0 out of 5 tests (0 steps) compromised">
<div class="errorbar"
style="width: 150px;"
title="0 out of 5 tests (0 steps) broken">
<div class="failingbar"
style="width: 150px;"
title="0 out of 5 tests (0 steps) failing">
<div class="passingbar"
style="width: 150px;"
title="5 out of 5 tests (71 steps) passing">
</div>
</div>
</div>
</div>
</div>
</div>
</a>
</td>
<td class="related-tag-count"><span class="result-test-count" title="5 tests">5</span></td>
</tr>
</table>
</td>
</tr>
</table>
<table class="test-summary-table">
<tr>
<td colspan="3">
<div class="tagTypeTitle">Versions
</div>
</td>
</tr>
<tr>
<td class="bluetext" class="tag-title">
<span class="SUCCESS-text ellipsis">
<a href="52d003547a842cfc9a4344b98df40f64.html" title="Release-2">Release-2</a>
</span>
</td>
<td width="220px" class="table-figure">
<table>
<tr>
<td class="related-tag-percentage"><span title="12 out of 12 tests (149 steps) passing">100%</span></td>
<td width="150px">
<a href="52d003547a842cfc9a4344b98df40f64.html">
<div class="pendingbar"
title="0 out of 12 tests (0 steps) pending"
style="width: 150px;">
<div class="ignoredbar"
style="width: 150px;"
title="0 out of 12 tests (0 steps) skipped or ignored">
<div class="compromisedbar"
style="width: 150px;"
title="0 out of 12 tests (0 steps) compromised">
<div class="errorbar"
style="width: 150px;"
title="0 out of 12 tests (0 steps) broken">
<div class="failingbar"
style="width: 150px;"
title="0 out of 12 tests (0 steps) failing">
<div class="passingbar"
style="width: 150px;"
title="12 out of 12 tests (149 steps) passing">
</div>
</div>
</div>
</div>
</div>
</div>
</a>
</td>
<td class="related-tag-count"><span class="result-test-count" title="12 tests">12</span></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
<div id="test-results-tabs-2">
<table>
<tr>
<td colspan="2">
<span class="caption">Test results weighted by test size in steps (average steps per test: 12) .</span>
<span class="togglePieChart" id="toggleWeightedPieChart"><a href="#">Show/Hide Pie
Chart</a></span>
</td>
</tr>
<tr>
<td style="vertical-align: text-top;">
<div id="weighted_test_results_pie_chart"></div>
</td>
<td class="related-tags-section">
<div>
<div>
<h4>Test Result Summary</h4>
<table class="summary-table">
<head>
<tr>
<th>Test Type</th>
<th>Total</th>
<th>Pass <i class="icon-check"/> </th>
<th>Fail <i class="icon-thumbs-down"/></th>
<th>Pending <i class="icon-calendar"/></th>
<th>Ignored <i class="icon-ban-circle"/></th>
</tr>
</head>
<body>
<tr>
<td class="summary-leading-column">Automated</td>
<td>12</td>
<td>12 (100%)</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
</tr>
<tr>
<td class="summary-leading-column">Manual</td>
<td>0</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
</tr>
<tr>
<td class="summary-leading-column">Total</td>
<td>12</td>
<td>12 (100%)</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
<td>0 (0%)</td>
</tr>
<tr>
<td class="summary-leading-column">Total Duration</td>
<td colspan="5">1 minutes 34 seconds</td>
</tr>
</body>
</table>
</div> </div>
<div>
<table class="tags-summary-table">
<tr>
<td width="300px"><h3>Related Tags</h3></td>
<td width="90px" class="tag-count-header">% Passed</td>
<td width="130px" class="test-count"> </td>
<td class="tag-count-header">Test count</td>
</tr>
</table>
<table class="test-summary-table">
<tr>
<td colspan="3">
<div class="tagTypeTitle">Capabilities
</div>
</td>
</tr>
<tr>
<td class="bluetext" class="tag-title">
<span class="SUCCESS-text ellipsis">
<a href="87e4d1169cae1c74b3c8cb4a5ce2e893.html" title="Completing Todos">Completing Todos</a>
</span>
</td>
<td width="220px" class="table-figure">
<table>
<tr>
<td class="related-tag-percentage"><span title="4 out of 4 tests (46 steps) passing">100%</span></td>
<td width="150px">
<a href="87e4d1169cae1c74b3c8cb4a5ce2e893.html">
<div class="pendingbar"
title="0 out of 4 tests (0 steps) pending"
style="width: 150px;">
<div class="ignoredbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) skipped or ignored">
<div class="compromisedbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) compromised">
<div class="errorbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) broken">
<div class="failingbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) failing">
<div class="passingbar"
style="width: 150px;"
title="4 out of 4 tests (46 steps) passing">
</div>
</div>
</div>
</div>
</div>
</div>
</a>
</td>
<td class="related-tag-count"><span class="result-test-count" title="4 tests">4</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bluetext" class="tag-title">
<span class="SUCCESS-text ellipsis">
<a href="dcebe5910714db6a1ae91d443a539777.html" title="Maintain My Todo List">Maintain My Todo List</a>
</span>
</td>
<td width="220px" class="table-figure">
<table>
<tr>
<td class="related-tag-percentage"><span title="8 out of 8 tests (103 steps) passing">100%</span></td>
<td width="150px">
<a href="dcebe5910714db6a1ae91d443a539777.html">
<div class="pendingbar"
title="0 out of 8 tests (0 steps) pending"
style="width: 150px;">
<div class="ignoredbar"
style="width: 150px;"
title="0 out of 8 tests (0 steps) skipped or ignored">
<div class="compromisedbar"
style="width: 150px;"
title="0 out of 8 tests (0 steps) compromised">
<div class="errorbar"
style="width: 150px;"
title="0 out of 8 tests (0 steps) broken">
<div class="failingbar"
style="width: 150px;"
title="0 out of 8 tests (0 steps) failing">
<div class="passingbar"
style="width: 150px;"
title="8 out of 8 tests (103 steps) passing">
</div>
</div>
</div>
</div>
</div>
</div>
</a>
</td>
<td class="related-tag-count"><span class="result-test-count" title="8 tests">8</span></td>
</tr>
</table>
</td>
</tr>
</table>
<table class="test-summary-table">
<tr>
<td colspan="3">
<div class="tagTypeTitle">Features
</div>
</td>
</tr>
<tr>
<td class="bluetext" class="tag-title">
<span class="SUCCESS-text ellipsis">
<a href="a6bcbaf11189d0bcaada2a92512520f0.html" title="Toggle All Todos">Toggle All Todos</a>
</span>
</td>
<td width="220px" class="table-figure">
<table>
<tr>
<td class="related-tag-percentage"><span title="4 out of 4 tests (46 steps) passing">100%</span></td>
<td width="150px">
<a href="a6bcbaf11189d0bcaada2a92512520f0.html">
<div class="pendingbar"
title="0 out of 4 tests (0 steps) pending"
style="width: 150px;">
<div class="ignoredbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) skipped or ignored">
<div class="compromisedbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) compromised">
<div class="errorbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) broken">
<div class="failingbar"
style="width: 150px;"
title="0 out of 4 tests (0 steps) failing">
<div class="passingbar"
style="width: 150px;"
title="4 out of 4 tests (46 steps) passing">
</div>
</div>
</div>
</div>
</div>
</div>
</a>
</td>
<td class="related-tag-count"><span class="result-test-count" title="4 tests">4</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bluetext" class="tag-title">
<span class="SUCCESS-text ellipsis">
<a href="5465df97aa3c16958030988dc753eca9.html" title="Clear Completed Todos">Clear Completed Todos</a>
</span>
</td>
<td width="220px" class="table-figure">
<table>
<tr>
<td class="related-tag-percentage"><span title="3 out of 3 tests (32 steps) passing">100%</span></td>
<td width="150px">
<a href="5465df97aa3c16958030988dc753eca9.html">
<div class="pendingbar"
title="0 out of 3 tests (0 steps) pending"
style="width: 150px;">
<div class="ignoredbar"
style="width: 150px;"
title="0 out of 3 tests (0 steps) skipped or ignored">
<div class="compromisedbar"
style="width: 150px;"
title="0 out of 3 tests (0 steps) compromised">
<div class="errorbar"
style="width: 150px;"
title="0 out of 3 tests (0 steps) broken">
<div class="failingbar"
style="width: 150px;"
title="0 out of 3 tests (0 steps) failing">
<div class="passingbar"
style="width: 150px;"
title="3 out of 3 tests (32 steps) passing">
</div>
</div>
</div>
</div>
</div>
</div>
</a>
</td>
<td class="related-tag-count"><span class="result-test-count" title="3 tests">3</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bluetext" class="tag-title">
<span class="SUCCESS-text ellipsis">
<a href="e4ba99cbaff3a8ee071ebc4bc5287462.html" title="Filtering Todos">Filtering Todos</a>
</span>
</td>
<td width="220px" class="table-figure">
<table>
<tr>
<td class="related-tag-percentage"><span title="5 out of 5 tests (71 steps) passing">100%</span></td>
<td width="150px">
<a href="e4ba99cbaff3a8ee071ebc4bc5287462.html">
<div class="pendingbar"
title="0 out of 5 tests (0 steps) pending"
style="width: 150px;">
<div class="ignoredbar"
style="width: 150px;"
title="0 out of 5 tests (0 steps) skipped or ignored">
<div class="compromisedbar"
style="width: 150px;"
title="0 out of 5 tests (0 steps) compromised">
<div class="errorbar"
style="width: 150px;"
title="0 out of 5 tests (0 steps) broken">
<div class="failingbar"
style="width: 150px;"
title="0 out of 5 tests (0 steps) failing">
<div class="passingbar"
style="width: 150px;"
title="5 out of 5 tests (71 steps) passing">
</div>
</div>
</div>
</div>
</div>
</div>
</a>
</td>
<td class="related-tag-count"><span class="result-test-count" title="5 tests">5</span></td>
</tr>
</table>
</td>
</tr>
</table>
<table class="test-summary-table">
<tr>
<td colspan="3">
<div class="tagTypeTitle">Versions
</div>
</td>
</tr>
<tr>
<td class="bluetext" class="tag-title">
<span class="SUCCESS-text ellipsis">
<a href="52d003547a842cfc9a4344b98df40f64.html" title="Release-2">Release-2</a>
</span>
</td>
<td width="220px" class="table-figure">
<table>
<tr>
<td class="related-tag-percentage"><span title="12 out of 12 tests (149 steps) passing">100%</span></td>
<td width="150px">
<a href="52d003547a842cfc9a4344b98df40f64.html">
<div class="pendingbar"
title="0 out of 12 tests (0 steps) pending"
style="width: 150px;">
<div class="ignoredbar"
style="width: 150px;"
title="0 out of 12 tests (0 steps) skipped or ignored">
<div class="compromisedbar"
style="width: 150px;"
title="0 out of 12 tests (0 steps) compromised">
<div class="errorbar"
style="width: 150px;"
title="0 out of 12 tests (0 steps) broken">
<div class="failingbar"
style="width: 150px;"
title="0 out of 12 tests (0 steps) failing">
<div class="passingbar"
style="width: 150px;"
title="12 out of 12 tests (149 steps) passing">
</div>
</div>
</div>
</div>
</div>
</div>
</a>
</td>
<td class="related-tag-count"><span class="result-test-count" title="12 tests">12</span></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<div><h3>Tests</h3></div>
<div id="test_list_tests" class="table">
<div class="test-results">
<table id="test-results-table">
<thead>
<tr>
<th width="50" class="test-results-heading"> </th>
<th width="%" class="test-results-heading">Tests</th>
<th width="70" class="test-results-heading">Steps</th>
<th width="100" class="test-results-heading">Duration<br>(seconds)</th>
</tr>
</thead>
<tbody>
<tr class="test-SUCCESS">
<td><span class="summary-icon"><i class='fa fa-check-square-o success-icon ' title='SUCCESS'></i></span>
<span style="display:none">SUCCESS</span></td>
<td class="SUCCESS-text">
<div class="ellipsis">
<a href="cedac390ebf159377aaf118f6813a5d2.html" class="ellipsis" title="">
Should Be Able To Clear Completed Todos In Screenplay
<span class="related-issue-title"></span>
</a>
</div>
</td>
<td class="lightgreentext">12</td>
<td class="lightgreentext">7.73</td>
</tr>
<tr class="test-SUCCESS">
<td><span class="summary-icon"><i class='fa fa-check-square-o success-icon ' title='SUCCESS'></i></span>
<span style="display:none">SUCCESS</span></td>
<td class="SUCCESS-text">
<div class="ellipsis">
<a href="110074ded558a1786759940c8bc56401.html" class="ellipsis" title="">
Should Be Able To Quickly Complete All Todos In Screenplay
<span class="related-issue-title"></span>
</a>
</div>
</td>
<td class="lightgreentext">11</td>
<td class="lightgreentext">7.54</td>
</tr>
<tr class="test-SUCCESS">
<td><span class="summary-icon"><i class='fa fa-check-square-o success-icon ' title='SUCCESS'></i></span>
<span style="display:none">SUCCESS</span></td>
<td class="SUCCESS-text">
<div class="ellipsis">
<a href="f0cc055e5069f1374718498e13a788fe.html" class="ellipsis" title="">
Should Be Able To Remove Completed Todos In Screenplay
<span class="related-issue-title"></span>
</a>
</div>
</td>
<td class="lightgreentext">12</td>
<td class="lightgreentext">7.52</td>
</tr>
<tr class="test-SUCCESS">
<td><span class="summary-icon"><i class='fa fa-check-square-o success-icon ' title='SUCCESS'></i></span>
<span style="display:none">SUCCESS</span></td>
<td class="SUCCESS-text">
<div class="ellipsis">
<a href="68b6a301f1bb467e8050064e9b11eb2c.html" class="ellipsis" title="">
Should Be Able To Toggle Status Of All Todos In Screenplay
<span class="related-issue-title"></span>
</a>
</div>
</td>
<td class="lightgreentext">13</td>
<td class="lightgreentext">8.17</td>
</tr>
<tr class="test-SUCCESS">
<td><span class="summary-icon"><i class='fa fa-check-square-o success-icon ' title='SUCCESS'></i></span>
<span style="display:none">SUCCESS</span></td>
<td class="SUCCESS-text">
<div class="ellipsis">
<a href="7f854b0f2c07e04b82eb29b3daf846e6.html" class="ellipsis" title="">
Should Be Able To View Both Complete And Incomplete Todos
<span class="related-issue-title"></span>
</a>
</div>
</td>
<td class="lightgreentext">15</td>
<td class="lightgreentext">8.99</td>
</tr>
<tr class="test-SUCCESS">
<td><span class="summary-icon"><i class='fa fa-check-square-o success-icon ' title='SUCCESS'></i></span>
<span style="display:none">SUCCESS</span></td>
<td class="SUCCESS-text">
<div class="ellipsis">
<a href="673dafefb97e787697e624a61b543d49.html" class="ellipsis" title="">
Should Be Able To View Only Completed Todos
<span class="related-issue-title"></span>
</a>
</div>
</td>
<td class="lightgreentext">14</td>
<td class="lightgreentext">8.61</td>
</tr>
<tr class="test-SUCCESS">
<td><span class="summary-icon"><i class='fa fa-check-square-o success-icon ' title='SUCCESS'></i></span>
<span style="display:none">SUCCESS</span></td>
<td class="SUCCESS-text">
<div class="ellipsis">
<a href="71ed2e37defe0ab4fe591271902b103b.html" class="ellipsis" title="">
Should Be Able To View Only Incomplete Todos
<span class="related-issue-title"></span>
</a>
</div>
</td>
<td class="lightgreentext">14</td>
<td class="lightgreentext">8.67</td>
</tr>
<tr class="test-SUCCESS">
<td><span class="summary-icon"><i class='fa fa-check-square-o success-icon ' title='SUCCESS'></i></span>
<span style="display:none">SUCCESS</span></td>
<td class="SUCCESS-text">
<div class="ellipsis">
<a href="0aa41b8834a4847cd6edacaf4e21ac43.html" class="ellipsis" title="">
Should Be Able To View Only Not Done Todos
<span class="related-issue-title"></span>
</a>
</div>
</td>
<td class="lightgreentext">14</td>
<td class="lightgreentext">8.58</td>
</tr>
<tr class="test-SUCCESS">
<td><span class="summary-icon"><i class='fa fa-check-square-o success-icon ' title='SUCCESS'></i></span>
<span style="display:none">SUCCESS</span></td>
<td class="SUCCESS-text">
<div class="ellipsis">
<a href="f6f448c8181d29480ff0fb7809885588.html" class="ellipsis" title="">
Should Be Able To View Only Unfinished Todos
<span class="related-issue-title"></span>
</a>
</div>
</td>
<td class="lightgreentext">14</td>
<td class="lightgreentext">8.92</td>
</tr>
<tr class="test-SUCCESS">
<td><span class="summary-icon"><i class='fa fa-check-square-o success-icon ' title='SUCCESS'></i></span>
<span style="display:none">SUCCESS</span></td>
<td class="SUCCESS-text">
<div class="ellipsis">
<a href="3ca9a598288910c87ef667f6dcd112c6.html" class="ellipsis" title="">
Should Not Be Able To Clear Completed Todos If None Are Complete In Screenplay
<span class="related-issue-title"></span>
</a>
</div>
</td>
<td class="lightgreentext">8</td>
<td class="lightgreentext">5.93</td>
</tr>
<tr class="test-SUCCESS">
<td><span class="summary-icon"><i class='fa fa-check-square-o success-icon ' title='SUCCESS'></i></span>
<span style="display:none">SUCCESS</span></td>
<td class="SUCCESS-text">
<div class="ellipsis">
<a href="7322764ed08b41c34ebf5c924e176564.html" class="ellipsis" title="">
Should See How Many Items Todo When All Are Toggled To Incomplete In Screenplay
<span class="related-issue-title"></span>
</a>
</div>
</td>
<td class="lightgreentext">12</td>
<td class="lightgreentext">7.93</td>
</tr>
<tr class="test-SUCCESS">
<td><span class="summary-icon"><i class='fa fa-check-square-o success-icon ' title='SUCCESS'></i></span>
<span style="display:none">SUCCESS</span></td>
<td class="SUCCESS-text">
<div class="ellipsis">
<a href="01e358c5cf9c2dc1f9791aa71e67081b.html" class="ellipsis" title="">
Should See That There Are Zero Items Todo When All Are Toggled Complete In Screenplay
<span class="related-issue-title"></span>
</a>
</div>
</td>
<td class="lightgreentext">10</td>
<td class="lightgreentext">6.37</td>
</tr>
</tbody>
</table>
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="beforefooter"></div>
<div id="bottomfooter">
<span class="version">Serenity version 1.2.1-SNAPSHOT</span>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
{
"name": "DUBS",
"description": "Earplugs.",
"url": "https://www.getdubs.com/"
} | {
"pile_set_name": "Github"
} |
//
// Breadcrumb Variables
//
$include-html-nav-classes: $include-html-classes !default;
// We use this to set the background color for the breadcrumb container.
$crumb-bg: lighten($secondary-color, 5%) !default;
// We use these to set the padding around the breadcrumbs.
$crumb-padding: emCalc(9px) emCalc(14px) emCalc(9px) !default;
$crumb-side-padding: emCalc(12px) !default;
// We use these to control border styles.
$crumb-function-factor: 10% !default;
$crumb-border-size: 1px !default;
$crumb-border-style: solid !default;
$crumb-border-color: darken($crumb-bg, $crumb-function-factor) !default;
$crumb-radius: $global-radius !default;
// We use these to set various text styles for breadcrumbs.
$crumb-font-size: emCalc(11px) !default;
$crumb-font-color: $primary-color !default;
$crumb-font-color-current: #333 !default;
$crumb-font-color-unavailable: #999 !default;
$crumb-font-transform: uppercase !default;
$crumb-link-decor: underline !default;
// We use these to control the slash between breadcrumbs
$crumb-slash-color: #aaa !default;
$crumb-slash: "/" !default;
//
// Breakcrumb Mixins
//
// We use this mixin to create a container around our breadcrumbs
@mixin crumb-container {
display: block;
padding: $crumb-padding;
overflow: hidden;
margin-#{$default-float}: 0;
list-style: none;
border-style: $crumb-border-style;
border-width: $crumb-border-size;
// We control which background color and border come through.
background-color: $crumb-bg;
border-color: $crumb-border-color;
}
// We use this mixin to create breadcrumb styles from list items.
@mixin crumbs {
// A normal state will make the links look and act like clickable breadcrumbs.
margin: 0;
float: $default-float;
font-size: $crumb-font-size;
text-transform: $crumb-font-transform;
&:hover a, &:focus a { text-decoration: $crumb-link-decor; }
a,
span {
text-transform: $crumb-font-transform;
color: $crumb-font-color;
}
// Current is for the link of the current page
&.current {
cursor: $cursor-default-value;
color: $crumb-font-color-current;
a {
cursor: $cursor-default-value;
color: $crumb-font-color-current;
}
&:hover, &:hover a,
&:focus, &:focus a { text-decoration: none; }
}
// Unavailable removed color and link styles so it looks inactive.
&.unavailable {
color: $crumb-font-color-unavailable;
a { color: $crumb-font-color-unavailable; }
&:hover,
&:hover a,
&:focus,
a:focus {
text-decoration: none;
color: $crumb-font-color-unavailable;
cursor: $cursor-default-value;
}
}
&:before {
content: "#{$crumb-slash}";
color: $crumb-slash-color;
margin: 0 $crumb-side-padding;
position: relative;
top: 1px;
}
&:first-child:before {
content: " ";
margin: 0;
}
}
@if $include-html-nav-classes != false {
/* Breadcrumbs */
.breadcrumbs {
@include crumb-container;
@include radius($crumb-radius);
&>* {
@include crumbs;
}
}
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* Stripe Delete Invoice Item Request.
*/
namespace Omnipay\Stripe\Message;
/**
* Stripe Delete Invoice Item Request.
*
* @link https://stripe.com/docs/api#delete_invoiceitem
*/
class DeleteInvoiceItemRequest extends AbstractRequest
{
/**
* Get the invoice-item reference.
*
* @return string
*/
public function getInvoiceItemReference()
{
return $this->getParameter('invoiceItemReference');
}
/**
* Set the set invoice-item reference.
*
* @return DeleteInvoiceItemRequest provides a fluent interface.
*/
public function setInvoiceItemReference($value)
{
return $this->setParameter('invoiceItemReference', $value);
}
public function getData()
{
$this->validate('invoiceItemReference');
$data = array();
return $data;
}
public function getEndpoint()
{
return $this->endpoint.'/invoiceitems/'.$this->getInvoiceItemReference();
}
public function getHttpMethod()
{
return 'DELETE';
}
}
| {
"pile_set_name": "Github"
} |
/*************************************************************************
> File Name: listhash.c
> Author: jinshaohui
> Mail: [email protected]
> Time: 18-11-07
> Desc:
************************************************************************/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<assert.h>
#include"listhash.h"
#ifdef MEMORY_TEST
#include<mcheck.h>
#endif
hashtab * hashtab_create(int size,hash_key_func hash_value,
keycmp_func keycmp,hash_node_free_func hash_node_free)
{
hashtab * h = NULL;
int i = 0;
if ((size < 0) || (hash_value == NULL) || (keycmp == NULL))
{
return NULL;
}
h = (hashtab *)malloc(sizeof(hashtab));
if (h == NULL)
{
return NULL;
}
h->htables = (hashtab_node **)malloc(size * sizeof(hashtab_node*));
if (h->htables == NULL)
{
return NULL;
}
h->size = size;
h->nel = 0;
h->hash_value = hash_value;
h->keycmp = keycmp;
h->hash_node_free = hash_node_free;
for (i = 0; i < size; i++)
{
h->htables[i] = NULL;
}
return h;
}
void hashtab_destory(hashtab *h)
{
int i = 0;
hashtab_node * cur = NULL;
hashtab_node * tmp = NULL;
if (h == NULL)
{
return;
}
for (i = 0; i <h->size; i++)
{
cur = h->htables[i];
while (cur != NULL)
{
tmp = cur;
cur = cur->next;
h->hash_node_free(tmp);
}
h->htables[i] = NULL;
}
free(h->htables);
free(h);
return;
}
int hashtab_insert(hashtab * h,void *key,void *data)
{
unsigned int hvalue = 0;
int i = 0;
hashtab_node *cur = NULL;
hashtab_node *prev = NULL;
hashtab_node *newnode = NULL;
if ((h == NULL) || (key == NULL) || (data == NULL))
{
return 1;
}
/*获取hash 数值*/
hvalue = h->hash_value(h,key);
cur = h->htables[hvalue];
/*hash桶中元素是从小到大排列的,找到要插入的位置*/
while((cur != NULL) && (h->keycmp(h,key,cur->key) > 0))
{
prev = cur;
cur = cur->next;
}
/*如果key和当前key比对一致,直接返回,数据已经存在*/
if ((cur != NULL) && (h->keycmp(h,key,cur->key) == 0))
{
return 2;
}
newnode = (hashtab_node *)malloc(sizeof(hashtab_node));
if (newnode == NULL)
{
return 3;
}
newnode->key = key;
newnode->data = data;
if (prev == NULL)
{
newnode->next = h->htables[hvalue];
h->htables[hvalue] = newnode;
}
else
{
newnode->next = prev->next;
prev->next = newnode;
}
h->nel++;
return 0;
}
hashtab_node *hashtab_delete(hashtab *h, void *key)
{
int hvalue = 0;
int i = 0;
hashtab_node *cur = NULL;
hashtab_node *prev = NULL;
if ((h == NULL) || (key == NULL))
{
return NULL;
}
/*获取hash 数值*/
hvalue = h->hash_value(h,key);
cur = h->htables[hvalue];
/*hash桶中元素是从小到大排列的,找到要插入的位置*/
while((cur != NULL) && (h->keycmp(h,key,cur->key) >= 0))
{
if (h->keycmp(h,key,cur->key) == 0)
{
if (prev == NULL)
{
h->htables[hvalue] = cur->next;
}
else
{
prev->next = cur->next;
}
return cur;
}
prev = cur;
cur = cur->next;
}
return NULL;
}
void *hashtab_search(hashtab*h,void *key)
{
int hvalue = 0;
int i = 0;
hashtab_node *cur = NULL;
if ((h == NULL) || (key == NULL))
{
return NULL;
}
/*获取hash 数值*/
hvalue = h->hash_value(h,key);
cur = h->htables[hvalue];
/*hash桶中元素是从小到大排列的,找到要插入的位置*/
while((cur != NULL) && (h->keycmp(h,key,cur->key) >= 0))
{
if (h->keycmp(h,key,cur->key) == 0)
{
return cur->data;
}
cur = cur->next;
}
return NULL;
}
void hashtab_dump(hashtab *h)
{
int i = 0;
hashtab_node * cur = NULL;
if (h == NULL)
{
return ;
}
printf("\r\n----开始--size[%d],nel[%d]------------",h->size,h->nel);
for( i = 0; i < h->size; i ++)
{
printf("\r\n htables[%d]:",i);
cur = h->htables[i];
while((cur != NULL))
{
printf("key[%s],data[%s] ",cur->key,cur->data);
cur = cur->next;
}
}
printf("\r\n----结束--size[%d],nel[%d]------------",h->size,h->nel);
}
struct test_node
{
char key[80];
char data[80];
};
unsigned int siample_hash(const char *str)
{
register unsigned int hash = 0;
register unsigned int seed = 131;
while(*str)
{
hash = hash*seed + *str++;
}
return hash & (0x7FFFFFFF);
}
int hashtab_hvalue(hashtab *h,const void *key)
{
return (siample_hash(key) % h->size);
}
int hashtab_keycmp(hashtab *h,const void *key1,const void *key2)
{
return strcmp(key1,key2);
}
void hashtab_node_free(hashtab_node*node)
{
struct test_node * ptmp = NULL;
ptmp = container(node->key,struct test_node,key);
free(ptmp);
free(node);
}
int main ()
{
int i = 0;
int res = 0;
char *pres = NULL;
hashtab_node * node = NULL;
struct test_node *p = NULL;
hashtab *h = NULL;
#ifdef MEMORY_TEST
setenv("MALLOC_TRACE","1.txt",1);
mtrace();
#endif
h = hashtab_create(5,hashtab_hvalue,hashtab_keycmp,hashtab_node_free);
assert(h!= NULL);
while(1)
{
p = (struct test_node*)malloc(sizeof(struct test_node));
assert(p != NULL);
printf("\r\n 请输入key 和value,当可以等于\"quit\"时退出");
scanf("%s",p->key);
scanf("%s",p->data);
if(strcmp(p->key,"quit") == 0)
{
free(p);
break;
}
res = hashtab_insert(h,p->key,p->data);
if (res != 0)
{
free(p);
printf("\r\n key[%s],data[%s] insert failed %d",p->key,p->data,res);
}
else
{
printf("\r\n key[%s],data[%s] insert success %d",p->key,p->data,res);
}
}
hashtab_dump(h);
while(1)
{
p = (struct test_node*)malloc(sizeof(struct test_node));
assert(p != NULL);
printf("\r\n 请输入key 查询value的数值,当可以等于\"quit\"时退出");
scanf("%s",p->key);
if(strcmp(p->key,"quit") == 0)
{
free(p);
break;
}
pres = hashtab_search(h,p->key);
if (pres == NULL)
{
printf("\r\n key[%s] search data failed",p->key);
}
else
{
printf("\r\n key[%s],search data[%s] success",p->key,pres);
}
free(p);
}
hashtab_dump(h);
while(1)
{
p = (struct test_node*)malloc(sizeof(struct test_node));
assert(p != NULL);
printf("\r\n 请输入key 删除节点的数值,当可以等于\"quit\"时退出");
scanf("%s",p->key);
if(strcmp(p->key,"quit") == 0)
{
free(p);
break;
}
node = hashtab_delete(h,p->key);
if (node == NULL)
{
printf("\r\n key[%s] delete node failed ",p->key);
}
else
{
printf("\r\n key[%s],delete data[%s] success",node->key,node->data);
h->hash_node_free(node);
}
free(p);
hashtab_dump(h);
}
hashtab_destory(h);
#ifdef MEMORY_TEST
muntrace();
#endif
return 0;
}
| {
"pile_set_name": "Github"
} |
/*!
* jQuery UI Widget 1.10.3
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/jQuery.widget/
*/
(function( $, undefined ) {
var uuid = 0,
slice = Array.prototype.slice,
_cleanData = $.cleanData;
$.cleanData = function( elems ) {
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
try {
$( elem ).triggerHandler( "remove" );
// http://bugs.jquery.com/ticket/8235
} catch( e ) {}
}
_cleanData( elems );
};
$.widget = function( name, base, prototype ) {
var fullName, existingConstructor, constructor, basePrototype,
// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype = {},
namespace = name.split( "." )[ 0 ];
name = name.split( "." )[ 1 ];
fullName = namespace + "-" + name;
if ( !prototype ) {
prototype = base;
base = $.Widget;
}
// create selector for plugin
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
return !!$.data( elem, fullName );
};
$[ namespace ] = $[ namespace ] || {};
existingConstructor = $[ namespace ][ name ];
constructor = $[ namespace ][ name ] = function( options, element ) {
// allow instantiation without "new" keyword
if ( !this._createWidget ) {
return new constructor( options, element );
}
// allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if ( arguments.length ) {
this._createWidget( options, element );
}
};
// extend with the existing constructor to carry over any static properties
$.extend( constructor, existingConstructor, {
version: prototype.version,
// copy the object used to create the prototype in case we need to
// redefine the widget later
_proto: $.extend( {}, prototype ),
// track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors: []
});
basePrototype = new base();
// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options = $.widget.extend( {}, basePrototype.options );
$.each( prototype, function( prop, value ) {
if ( !$.isFunction( value ) ) {
proxiedPrototype[ prop ] = value;
return;
}
proxiedPrototype[ prop ] = (function() {
var _super = function() {
return base.prototype[ prop ].apply( this, arguments );
},
_superApply = function( args ) {
return base.prototype[ prop ].apply( this, args );
};
return function() {
var __super = this._super,
__superApply = this._superApply,
returnValue;
this._super = _super;
this._superApply = _superApply;
returnValue = value.apply( this, arguments );
this._super = __super;
this._superApply = __superApply;
return returnValue;
};
})();
});
constructor.prototype = $.widget.extend( basePrototype, {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
}, proxiedPrototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
widgetFullName: fullName
});
// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if ( existingConstructor ) {
$.each( existingConstructor._childConstructors, function( i, child ) {
var childPrototype = child.prototype;
// redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
});
// remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors;
} else {
base._childConstructors.push( constructor );
}
$.widget.bridge( name, constructor );
};
$.widget.extend = function( target ) {
var input = slice.call( arguments, 1 ),
inputIndex = 0,
inputLength = input.length,
key,
value;
for ( ; inputIndex < inputLength; inputIndex++ ) {
for ( key in input[ inputIndex ] ) {
value = input[ inputIndex ][ key ];
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
// Clone objects
if ( $.isPlainObject( value ) ) {
target[ key ] = $.isPlainObject( target[ key ] ) ?
$.widget.extend( {}, target[ key ], value ) :
// Don't extend strings, arrays, etc. with objects
$.widget.extend( {}, value );
// Copy everything else by reference
} else {
target[ key ] = value;
}
}
}
}
return target;
};
$.widget.bridge = function( name, object ) {
var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = slice.call( arguments, 1 ),
returnValue = this;
// allow multiple hashes to be passed on init
options = !isMethodCall && args.length ?
$.widget.extend.apply( null, [ options ].concat(args) ) :
options;
if ( isMethodCall ) {
this.each(function() {
var methodValue,
instance = $.data( this, fullName );
if ( !instance ) {
return $.error( "cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'" );
}
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
}
methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack( methodValue.get() ) :
methodValue;
return false;
}
});
} else {
this.each(function() {
var instance = $.data( this, fullName );
if ( instance ) {
instance.option( options || {} )._init();
} else {
$.data( this, fullName, new object( options, this ) );
}
});
}
return returnValue;
};
};
$.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = [];
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
disabled: false,
// callbacks
create: null
},
_createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ];
this.element = $( element );
this.uuid = uuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.options = $.widget.extend( {},
this.options,
this._getCreateOptions(),
options );
this.bindings = $();
this.hoverable = $();
this.focusable = $();
if ( element !== this ) {
$.data( element, this.widgetFullName, this );
this._on( true, this.element, {
remove: function( event ) {
if ( event.target === element ) {
this.destroy();
}
}
});
this.document = $( element.style ?
// element within the document
element.ownerDocument :
// element is window or document
element.document || element );
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
}
this._create();
this._trigger( "create", null, this._getCreateEventData() );
this._init();
},
_getCreateOptions: $.noop,
_getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,
destroy: function() {
this._destroy();
// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
.unbind( this.eventNamespace )
// 1.9 BC for #7810
// TODO remove dual storage
.removeData( this.widgetName )
.removeData( this.widgetFullName )
// support: jquery <1.6.3
// http://bugs.jquery.com/ticket/9413
.removeData( $.camelCase( this.widgetFullName ) );
this.widget()
.unbind( this.eventNamespace )
.removeAttr( "aria-disabled" )
.removeClass(
this.widgetFullName + "-disabled " +
"ui-state-disabled" );
// clean up events and states
this.bindings.unbind( this.eventNamespace );
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
},
_destroy: $.noop,
widget: function() {
return this.element;
},
option: function( key, value ) {
var options = key,
parts,
curOption,
i;
if ( arguments.length === 0 ) {
// don't return a reference to the internal hash
return $.widget.extend( {}, this.options );
}
if ( typeof key === "string" ) {
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options = {};
parts = key.split( "." );
key = parts.shift();
if ( parts.length ) {
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
for ( i = 0; i < parts.length - 1; i++ ) {
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
curOption = curOption[ parts[ i ] ];
}
key = parts.pop();
if ( value === undefined ) {
return curOption[ key ] === undefined ? null : curOption[ key ];
}
curOption[ key ] = value;
} else {
if ( value === undefined ) {
return this.options[ key ] === undefined ? null : this.options[ key ];
}
options[ key ] = value;
}
}
this._setOptions( options );
return this;
},
_setOptions: function( options ) {
var key;
for ( key in options ) {
this._setOption( key, options[ key ] );
}
return this;
},
_setOption: function( key, value ) {
this.options[ key ] = value;
if ( key === "disabled" ) {
this.widget()
.toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
.attr( "aria-disabled", value );
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
}
return this;
},
enable: function() {
return this._setOption( "disabled", false );
},
disable: function() {
return this._setOption( "disabled", true );
},
_on: function( suppressDisabledCheck, element, handlers ) {
var delegateElement,
instance = this;
// no suppressDisabledCheck flag, shuffle arguments
if ( typeof suppressDisabledCheck !== "boolean" ) {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
}
// no element argument, shuffle and use this.element
if ( !handlers ) {
handlers = element;
element = this.element;
delegateElement = this.widget();
} else {
// accept selectors, DOM elements
element = delegateElement = $( element );
this.bindings = this.bindings.add( element );
}
$.each( handlers, function( event, handler ) {
function handlerProxy() {
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if ( !suppressDisabledCheck &&
( instance.options.disabled === true ||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
return;
}
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
}
// copy the guid so direct unbinding works
if ( typeof handler !== "string" ) {
handlerProxy.guid = handler.guid =
handler.guid || handlerProxy.guid || $.guid++;
}
var match = event.match( /^(\w+)\s*(.*)$/ ),
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if ( selector ) {
delegateElement.delegate( selector, eventName, handlerProxy );
} else {
element.bind( eventName, handlerProxy );
}
});
},
_off: function( element, eventName ) {
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
element.unbind( eventName ).undelegate( eventName );
},
_delay: function( handler, delay ) {
function handlerProxy() {
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
}
var instance = this;
return setTimeout( handlerProxy, delay || 0 );
},
_hoverable: function( element ) {
this.hoverable = this.hoverable.add( element );
this._on( element, {
mouseenter: function( event ) {
$( event.currentTarget ).addClass( "ui-state-hover" );
},
mouseleave: function( event ) {
$( event.currentTarget ).removeClass( "ui-state-hover" );
}
});
},
_focusable: function( element ) {
this.focusable = this.focusable.add( element );
this._on( element, {
focusin: function( event ) {
$( event.currentTarget ).addClass( "ui-state-focus" );
},
focusout: function( event ) {
$( event.currentTarget ).removeClass( "ui-state-focus" );
}
});
},
_trigger: function( type, event, data ) {
var prop, orig,
callback = this.options[ type ];
data = data || {};
event = $.Event( event );
event.type = ( type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type ).toLowerCase();
// the original event may come from any element
// so we need to reset the target on the new event
event.target = this.element[ 0 ];
// copy original event properties over to the new event
orig = event.originalEvent;
if ( orig ) {
for ( prop in orig ) {
if ( !( prop in event ) ) {
event[ prop ] = orig[ prop ];
}
}
}
this.element.trigger( event, data );
return !( $.isFunction( callback ) &&
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
event.isDefaultPrevented() );
}
};
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
if ( typeof options === "string" ) {
options = { effect: options };
}
var hasOptions,
effectName = !options ?
method :
options === true || typeof options === "number" ?
defaultEffect :
options.effect || defaultEffect;
options = options || {};
if ( typeof options === "number" ) {
options = { duration: options };
}
hasOptions = !$.isEmptyObject( options );
options.complete = callback;
if ( options.delay ) {
element.delay( options.delay );
}
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
element[ method ]( options );
} else if ( effectName !== method && element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback );
} else {
element.queue(function( next ) {
$( this )[ method ]();
if ( callback ) {
callback.call( element[ 0 ] );
}
next();
});
}
};
});
})( jQuery );
| {
"pile_set_name": "Github"
} |
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<x-meta id="core-scaffold" label="Scaffold" isContainer group="Core">
<template>
<core-scaffold style="position: absolute; top: 0; right: 0; bottom: 0; left: 0;">
<core-header-panel navigation flex mode="seamed" style="background-color: #fff;">
<core-toolbar style="background-color: #4F7DC9 ; color: #fff;"></core-toolbar>
<core-menu valueattr="label" style="font-size: 16px;" theme="core-light-theme">
<core-item icon="settings" label="Item1"></core-item>
<core-item icon="settings" label="Item2"></core-item>
</core-menu>
</core-header-panel>
<div tool>Title</div>
</core-scaffold>
</template>
<template id="imports">
<link rel="import" href="core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
</template>
</x-meta>
<x-meta id="core-card" label="Card" isContainer group="Core">
<template>
<core-card style="position: absolute; width: 300px; height: 300px; background-color: #fff; border-radius: 2px; box-shadow: rgba(0, 0, 0, 0.098) 0px 2px 4px, rgba(0, 0, 0, 0.098) 0px 0px 3px;" layout vertical></core-card>
</template>
</x-meta>
| {
"pile_set_name": "Github"
} |
provider RACSignal {
probe next(char *signal, char *subscriber, char *valueDescription);
probe completed(char *signal, char *subscriber);
probe error(char *signal, char *subscriber, char *errorDescription);
};
| {
"pile_set_name": "Github"
} |
import {BaseParser} from '@form-create/core';
export default class Parser extends BaseParser {
render(children) {
let type = this.rule.props.type;
if (['textarea', 'search'].indexOf(type) === -1) type = 'input';
const Type = (type === 'textarea' ? 'ATextarea' : (type === 'search' ? 'AInputSearch' : 'AInput'));
return this.vNode.make(Type, this.$render.inputVData(this), [children])
}
}
| {
"pile_set_name": "Github"
} |
-- https://leetcode.com/problems/sales-analysis-iii/
-- 1AC, use avg() to calculate percentage
SELECT p.product_id,
p.product_name
FROM product p
INNER JOIN (SELECT product_id,
Avg(( sale_date BETWEEN {d'2019-01-01'} AND
{d'2019-03-31'} )
)
only_spring
FROM sales
GROUP BY product_id) os
ON p.product_id = os.product_id
WHERE os.only_spring = 1;
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PHPMailer Test</title>
</head>
<body>
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
<h1>This is a test of PHPMailer.</h1>
<div align="center">
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
</div>
<p>This example uses <strong>HTML</strong>.</p>
<p>Chinese text: 郵件內容為空</p>
<p>Russian text: Пустое тело сообщения</p>
<p>Armenian text: Հաղորդագրությունը դատարկ է</p>
<p>Czech text: Prázdné tělo zprávy</p>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
imports:
- { resource: ../config.yml }
overblog_graphql:
definitions:
class_namespace: "Overblog\\GraphQLBundle\\SchemaLanguage\\__DEFINITIONS__"
schema:
main:
query: Query
mutation: Mutation
empty:
query: Query
mappings:
types:
-
type: graphql
dir: "%kernel.project_dir%/config/schemaLanguage/mapping"
suffix: ~
services:
Overblog\GraphQLBundle\Tests\Functional\App\Resolver\NullResolverMap:
tags:
- { name: overblog_graphql.resolver_map, schema: empty }
Overblog\GraphQLBundle\Tests\Functional\App\Resolver\SchemaLanguageQueryResolverMap:
tags:
- { name: overblog_graphql.resolver_map, schema: main, priority: 10 }
Overblog\GraphQLBundle\Tests\Functional\App\Resolver\SchemaLanguageMutationResolverMap:
tags:
- { name: overblog_graphql.resolver_map, schema: main }
| {
"pile_set_name": "Github"
} |
/**********************************************************************
* LeechCraft - modular cross-platform feature rich internet client.
* Copyright (C) 2006-2014 Georg Rudoy
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
**********************************************************************/
#ifndef PLUGINS_AGGREGATOR_FEED_H
#define PLUGINS_AGGREGATOR_FEED_H
#include "interfaces/aggregator/feed.h"
#endif
| {
"pile_set_name": "Github"
} |
//
// RSBToHSV.h
// HZImageFilter
//
// Created by zz go on 2017/5/3.
// Copyright © 2017年 zzgo. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface Tool : NSObject
void RGBtoHSV( float r, float g, float b, float *h, float *s, float *v );
@end
| {
"pile_set_name": "Github"
} |
// +build !ignore_autogenerated
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by defaulter-gen. DO NOT EDIT.
package v1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&CustomResourceDefinition{}, func(obj interface{}) { SetObjectDefaults_CustomResourceDefinition(obj.(*CustomResourceDefinition)) })
scheme.AddTypeDefaultingFunc(&CustomResourceDefinitionList{}, func(obj interface{}) {
SetObjectDefaults_CustomResourceDefinitionList(obj.(*CustomResourceDefinitionList))
})
return nil
}
func SetObjectDefaults_CustomResourceDefinition(in *CustomResourceDefinition) {
SetDefaults_CustomResourceDefinition(in)
SetDefaults_CustomResourceDefinitionSpec(&in.Spec)
if in.Spec.Conversion != nil {
if in.Spec.Conversion.Webhook != nil {
if in.Spec.Conversion.Webhook.ClientConfig != nil {
if in.Spec.Conversion.Webhook.ClientConfig.Service != nil {
SetDefaults_ServiceReference(in.Spec.Conversion.Webhook.ClientConfig.Service)
}
}
}
}
}
func SetObjectDefaults_CustomResourceDefinitionList(in *CustomResourceDefinitionList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_CustomResourceDefinition(a)
}
}
| {
"pile_set_name": "Github"
} |
# encoding: utf-8
import logging
from datetime import datetime
import stat
import os
import time
from django.core.management.base import BaseCommand
from seaserv import seafile_api, ccnet_api
from seahub.repo_auto_delete.models import RepoAutoDelete
logger = logging.getLogger(__name__)
def iterate_and_del_files_recursively(repo_id, path, days):
dirents = seafile_api.list_dir_by_path(repo_id, path)
for dirent in dirents:
if stat.S_ISDIR(dirent.mode):
iterate_and_del_files_recursively(repo_id, os.path.join(path, dirent.obj_name), days)
continue
mtime = dirent.mtime
cur_time = int(time.time())
time_delta = days * 24 * 60 * 60
if cur_time - time_delta > mtime:
file_full_path = os.path.join(path, dirent.obj_name)
seafile_api.del_file(repo_id, path, dirent.obj_name, 'seafevents')
logger.info('{} of {} deleted at {}.'.format(file_full_path, repo_id, cur_time))
class Command(BaseCommand):
help = 'scan repo_files_auto_del table, and delete old files if checked true'
label = "scan_repo_files_auto_del"
def handle(self, *args, **options):
logger.debug('Start scan repo_files_auto_del...')
self.stdout.write('[%s] Start scan repo_files_auto_del...\n' % datetime.now())
try:
self.do_action(*args, **options)
except Exception as e:
logger.error(e)
self.stdout.write('[%s] Finish scan repo_files_auto_del.\n' % datetime.now())
logger.debug('Finish scan repo_files_auto_del.')
def do_action(self, *args, **options):
repo_auto_deletes = RepoAutoDelete.objects.filter(days__gt=0)
for auto_del in repo_auto_deletes:
iterate_and_del_files_recursively(auto_del.repo_id, '/', auto_del.days) | {
"pile_set_name": "Github"
} |
#pragma once
/*
Copyright 2017 Vladimir Lysyy (mrbald@github)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <boost/interprocess/containers/string.hpp>
#if BOOST_VERSION <= 106000
#include <boost/utility/string_ref.hpp>
namespace boost {
template<typename CharT, typename CharTraits>
using basic_string_view = boost::basic_string_ref<CharT,CharTraits>;
}
#else
#include <boost/utility/string_view.hpp>
#endif
#include <string>
namespace ufw {
/**
* Functor for containers transparent across `std::string`,
* `boost::container::string`, `boost::string_view`, and `char const*`.
*/
template<typename Alloc, typename Op>
struct any_str_op {
template <typename X, typename Y>
bool operator () (X&& l, Y&& r) const { return op_(view(l), view(r)); }
private:
Op op_;
using char_t = char;
using char_traits_t = std::char_traits<char_t>;
using shm_str_t = typename boost::container::basic_string<char_t, char_traits_t, Alloc>;
using std_str_t = std::basic_string<char_t, char_traits_t, std::allocator<char_t>>;
using str_view_t = boost::basic_string_view<char_t, char_traits_t>;
static str_view_t view(char_t const* x) { return {x}; }
static str_view_t view(shm_str_t const& x) { return {x.data(), x.size()}; }
static str_view_t view(std_str_t const& x) { return {x}; }
static str_view_t view(str_view_t x) { return x; }
};
template <typename Alloc>
using any_str_less = any_str_op<Alloc, std::less<void>>;
} // namespace ufw
| {
"pile_set_name": "Github"
} |
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit0494e7f9841cf6238755ade1f336fa9c
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__.'/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit0494e7f9841cf6238755ade1f336fa9c', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit0494e7f9841cf6238755ade1f336fa9c', 'loadClassLoader'));
$map = require __DIR__.'/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__.'/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__.'/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
return $loader;
}
}
| {
"pile_set_name": "Github"
} |
'***** HIGHLY EXPERIMENTAL WIP TEST OF OPENAL STREAMING *****
#Import "<std>"
#Import "<mojo>"
Using std..
Using mojo..
Global AppTitle:String="VSynth 0.01 Big Ben Release"
Global Contact:="Latest Source=github.com/nitrologic/m2"
Global About:="VSynth Control"
Global Octave1:= "Sharps= W E T Y U "
Global Octave0:= "Notes=A S D F G H J K"
Global Controls:="Reset Keys=Space,Quit=Escape"
Global OscillatorNames:=New String[]("Square","Sine","Sawtooth","Triangle","Noise")
Global EnvelopeNames:=New String[]("Plain","Punchy","SlowOut","SlowIn")
Global ArpNames:=New String[]("None","Natural","Ascending","Descending","UpDown","Random")
Alias V:Double ' Voltage(volts)
Alias F:Double ' Frequency(hz)
Alias T:Double ' Time(seconds)
Alias Note:Int
Alias K:Key
Public
Global instance:AppInstance
Global vsynth:VSynth
Global Duration:=0
Global FragmentSize:=1024
Global AudioFrequency:=44100
Const MaxPolyphony:=16
Class Envelope
Field p:V
Method On:V() Virtual
Return 1.0
End
Method Off:V() Virtual
Return 0.0
End
End
Class ADSR Extends Envelope
Field attack:T
Field decay:T
Field sustain:V
Field release:T
Method New(a:T,d:T,s:V,r:T)
attack=a
decay=d
sustain=s
release=r
End
Field t:T
Field noteOn:Bool
Method On:V() Override
If Not noteOn
t=0
noteOn=True
Endif
t+=1.0/AudioFrequency
If t<attack Return t/attack
If t-attack<decay Return 1.0-((1-sustain)*(t-attack)/decay)
Return sustain
End
Method Off:V() Override
noteOn=False
t+=1.0/AudioFrequency
If t<release
Return 1.0-t/release
Endif
Return 0.0
End
End
Class Oscillator
Field delta:T
Method Sample:V(hz:F) Virtual
Return 0
End
End
Class Sine Extends Oscillator
Method Sample:V(hz:F) Override
Local t:T=hz/AudioFrequency
delta+=t
Return Sin(Pi*delta)
End
End
Class Sawtooth Extends Oscillator
Method Sample:V(hz:F) Override
Local t:T=hz/AudioFrequency
delta+=t
Return ((delta+1) Mod 2)-1
End
End
Class Triangle Extends Oscillator
Method Sample:V(hz:F) Override
Local t:T=2*hz/AudioFrequency
delta+=t
Return (Abs(delta Mod 4)-2)-1
End
End
Class Square Extends Oscillator
Method Sample:V(hz:F) Override
Local t:T=hz/AudioFrequency
delta+=t
Return -1+2*(Int(delta)&1)
End
End
Class Noise Extends Oscillator
Field a:V
Method Sample:V(hz:F) Override
Local t:T=hz/AudioFrequency
Local delta0:=delta
delta+=t
Local f:=delta Mod 1
If Int(delta0)<>Int(delta)
a=Rnd()
Endif
Return 1-2*a '(a+f*(b-a)
End
End
Class Voice
Field oscillator:Oscillator
Field envelope:Envelope
Field noteOn:Bool
Field hz:F
Field pan:V
Field gain:V=0.12
Method SetOscillator(osc:Int)
Select osc
Case 0 oscillator=New Square
Case 1 oscillator=New Sine
Case 2 oscillator=New Sawtooth
Case 3 oscillator=New Triangle
Case 4 oscillator=New Noise
End
End
Method SetEnvelope(env:Int)
Select env
Case 0
envelope=New ADSR(0.05,1.5,0.2,0.3)
Case 1
envelope=New ADSR(0.06,0.01,0.92,0.2)
Case 2
envelope=New ADSR(0.06,2.0,0.2,1.2)
Case 3
envelope=New ADSR(0.2,0.2,0.92,0.4)
End
End
Method SetPan(value:V)
pan=value
End
Method SetGain(value:V)
gain=value
End
Method Stop()
NoteOff()
envelope.Off()
End
Method NoteOn(note:Int)
hz=440.0*Pow(2.0,(note-67.0)/12)
noteOn=True
End
Method NoteOff()
noteOn=False
End
Method Mix(buffer:Double[],samples:Int,detune:V)
Local left:=1.0
Local right:=1.0
If pan<0 right+=pan
If pan>0 left-=pan
For Local i:=0 Until samples
Local v:=oscillator.Sample(hz*detune)
Local e:V
If noteOn e=envelope.On() Else e=envelope.Off()
e*=gain
buffer[i*2+0]+=e*left*v
buffer[i*2+1]+=e*right*v
Next
End
End
Class VSynth
Field buffer:=New Double[FragmentSize*2]
Field voices:=New Stack<Voice>
Field polyList:=New List<Voice>
Field polyMap:=New Map<Int,Voice>
Field detune:V
Method New()
OpenAudio()
End
Method Detune(bend:V)
detune=bend
End
Method ClearKeys()
voices.Clear()
End
Method FillAudioBuffer:Double[](samples:Int)
For Local i:=0 Until samples
buffer[i*2+0]=0
buffer[i*2+1]=0
Next
For Local voice:=Eachin voices
voice.Mix(buffer,samples,detune)
Next
Duration+=samples
Return buffer
End
Method OpenAudio()
For Local i:=0 Until MaxPolyphony
Local tone:=New Voice
tone.SetOscillator(0)
tone.SetEnvelope(0)
polyList.AddLast(tone)
Next
New Fiber( Lambda()
Local channel:=New Channel
Local data:=New AudioData( FragmentSize,AudioFormat.Stereo16,AudioFrequency )
Local datap:=Cast<Short Ptr>( data.Data )
Repeat
Local samples:=FillAudioBuffer( FragmentSize )
For Local i:=0 Until FragmentSize*2
datap[i]=Clamp( samples[i],Double(-1.0),Double(1.0) ) * 32767.0
Next
channel.WaitQueued( 3 ) 'waits until <=3 chunks are queued
channel.Queue( data ) 'queues another chunk...
Forever
End )
End
Method NoteOn(note:Int,oscillator:Int,envelope:Int)
NoteOff(note)
If polyList.Empty Return
Local voice:=polyList.RemoveFirst()
voice.SetEnvelope(envelope)
voice.SetOscillator(oscillator)
voice.NoteOn(note)
polyMap[note]=voice
polyList.Remove(voice)
If Not voices.Contains(voice)
voices.Add(voice)
Endif
End
Method NoteOff(note:Int)
Local voice:=polyMap[note]
If voice
voice.Stop()
polyMap.Remove(note)
polyList.AddLast(voice)
Endif
End
End
Class VSynthWindow Extends Window
Const MusicKeys:=New Key[]( Key.Q,Key.A,Key.W,Key.S,Key.E,Key.D, Key.F,Key.T,Key.G,Key.Y,Key.H,Key.U,Key.J, Key.K,Key.O,Key.L,Key.P,Key.Semicolon)',Key.Apostrophe )
Field frame:Int
Field tick:Int
Field mousex:Int
Field mousey:Int
Field oscillator:Int
Field envelope:Int
Field octave:Int=5
Field pitchbend:V
Field keyNoteMap:=New Map<Key,Int>
Method New(title:String)
Super.New(title,720,560,WindowFlags.Resizable)
For Local i:=0 Until MusicKeys.Length
keyNoteMap.Set(MusicKeys[i],i-1)
Next
vsynth=New VSynth
End
Method OnRender( display:Canvas ) Override
App.RequestRender()
vsynth.Detune(Pow(2,pitchbend))
Local text:String = About+",,"+Octave1+","+Octave0+","
text+="Octave=< >="+octave
text+=",Oscillator=1-5="+OscillatorNames[oscillator]
text+=",Envelope=[]="+EnvelopeNames[envelope]
text+=",PitchBend=Mouse Wheel="+FloatString(pitchbend)
text+=",,"+Controls+",,"+Contact
Local cy:=40
For Local line:=Eachin text.Split(",")
Local cx:=50
For Local tab:=Eachin line.Split("=")
display.DrawText(tab,cx,cy)
cx+=100
Next
cy+=20
Next
End
Method KeyDown(key:Key)
Local note:=keyNoteMap[key]+octave*12
vsynth.NoteOn(note,oscillator,envelope)
End
Method KeyUp(key:Key)
Local note:=keyNoteMap[key]+octave*12
vsynth.NoteOff(note)
End
Method UpdateSequence()
frame+=1
Local t:Int=(frame/20)
If t<>tick
Local note:=((t Shr 1)&15)*3+40
If t&1
vsynth.NoteOn(note,oscillator,envelope)
Else
vsynth.NoteOff(note)
Endif
tick=t
Endif
' Print "tick d="+d
End
Function Limit:Int(value:Int, lo:Int, hi:Int)
If value<lo Return lo
If value>hi Return hi
Return value
End
Method OnKeyEvent( event:KeyEvent ) Override
Select event.Type
Case EventType.KeyDown
Select event.Key
Case Key.Key1
oscillator=0
Case Key.Key2
oscillator=1
Case Key.Key3
oscillator=2
Case Key.Key4
oscillator=3
Case Key.Key5
oscillator=4
Case Key.Escape
instance.Terminate()
Case Key.LeftBracket
envelope=Wrap(envelope-1,0,EnvelopeNames.Length)
Case Key.RightBracket
envelope=Wrap(envelope+1,0,EnvelopeNames.Length)
Case Key.Comma
octave=Clamp(octave-1,0,12)
Case Key.Period
octave=Clamp(octave+1,0,12)
Case Key.Space
vsynth.ClearKeys()
Default
KeyDown(event.Key)
End
Case EventType.KeyUp
Select event.Key
Case Key.Escape
Default
KeyUp(event.Key)
End
End
End
Method OnMouseEvent( event:MouseEvent ) Override
mousex=event.Location.X
mousey=event.Location.Y
pitchbend+=event.Wheel.Y/24.0
End
End
Function FloatString:String(value:Float,dp:Int=2)
Local sign:String
If value<0
sign="-"
value=-value
Endif
Local a:String=Int(value*(Pow(10,dp)))
Local l:=dp+1-a.Length
If l>0 a="000000".Slice(0,l)+a
Local r:=a.Length
Return sign+a.Slice(0,r-dp)+"."+a.Slice(r-dp)
End
Function Wrap:Int(value:Int,lower:Int,upper:Int)
If value<lower value=upper-1
If value>=upper value=lower
Return value
End
Function Main()
instance = New AppInstance
New VSynthWindow(AppTitle)
App.Run()
End
| {
"pile_set_name": "Github"
} |
#import <UIKit/UIKit.h>
@interface TGSecretTimerValueControllerItemView : UIView
- (instancetype)initWithFrame:(CGRect)frame dark:(bool)dark;
@property (nonatomic, strong) NSString *emptyValue;
@property (nonatomic) NSUInteger seconds;
@end
| {
"pile_set_name": "Github"
} |
#diffBar
{
width: 3%;
height: 100%;
float: left;
position:relative;
background: #DDDDDD;
}
.diffBarLineLeft, .diffBarLineRight
{
width: 50%;
float:left;
height:0px;
cursor:pointer;
}
.inView
{
background-image: url("../Content/InView.png");
background-repeat: repeat;
}
#activeBar
{
position:absolute;
top:0px;
background-color:#6699FF;
opacity:0.5;
filter:alpha(opacity='50');
}
#diffBox
{
margin-left: auto;
margin-right: auto;
border:1px solid #CCC;
}
#leftPane, #rightPane
{
float: left;
width: 50%;
}
.diffHeader
{
border-bottom:1px solid #CCC;
font-weight: bold;
padding: 2px 0px 2px 10px;
background-color: #FFFFFF;
text-align: center;
}
.diffPane
{
margin-right: 0px;
padding: 0px;
overflow: auto;
font-family: Courier New;
font-size: 1em;
}
#leftPane .diffPane{
border-right:1px solid #CCC;
}
#rightPane .diffPane{
border-left:1px solid #FFF;
}
.diffTable
{
width: 100%;
height: 100%;
}
.diffTable strong{
color:#666;
font-weight:bold;
}
.line
{
padding-left: .2em;
white-space: nowrap;
width: 100%;
}
.lineNumber
{
padding: 0 .3em;
background-color: #FFFFFF;
text-align: right;
}
.InsertedLine
{
background-color: #FFFF00;
}
.ModifiedLine
{
background-color: #DCDCFF;
}
.DeletedLine
{
background-color: #FFC864;
}
.UnchangedLine
{
background-color: #FFFFFF;
}
.ImaginaryLine
{
background-color: #C8C8C8;
}
.InsertedCharacter
{
background-color: #FFFF96;
}
.DeletedCharacter
{
background-color: #C86464;
}
.UnchangedCharacter
{
}
.ImaginaryCharacter
{
}
.clear
{
clear: both;
} | {
"pile_set_name": "Github"
} |
/*
* Copyright 2020 Justas Masiulis
*
* 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.
*/
#pragma once
#include "object.hpp"
#include "process.hpp"
#include "thread.hpp"
namespace ntw::ob {
/// \brief Extends access_builder to contain all token specific access flags.
struct token_access : access_builder<process_access> {
/// \brief Required to change the default owner, primary group, or DACL of an
/// access token. \note Corresponds to TOKEN_ADJUST_DEFAULT flag.
NTW_INLINE constexpr token_access& adjust_default() noexcept;
/// \brief Required to adjust the attributes of the groups in an access token.
/// \note Corresponds to TOKEN_ADJUST_GROUPS flag.
NTW_INLINE constexpr token_access& adjust_groups() noexcept;
/// \brief Required to adjust the session ID of an access token. The SE_TCB_NAME
/// privilege is required. \note Corresponds to TOKEN_ADJUST_SESSIONID flag.
NTW_INLINE constexpr token_access& adjust_privileges() noexcept;
/// \brief Required to adjust the session ID of an access token. The SE_TCB_NAME
/// privilege is required. \note Corresponds to TOKEN_ADJUST_SESSIONID flag.
NTW_INLINE constexpr token_access& adjust_sessionid() noexcept;
/// \brief Required to attach a primary token to a process. The
/// SE_ASSIGNPRIMARYTOKEN_NAME privilege is also required to accomplish this task.
/// \note Corresponds to TOKEN_ASSIGN_PRIMARY flag.
NTW_INLINE constexpr token_access& assign_primary() noexcept;
/// \brief Required to duplicate an access token.
/// \note Corresponds to TOKEN_DUPLICATE flag.
NTW_INLINE constexpr token_access& duplicate() noexcept;
/// \brief Combines STANDARD_RIGHTS_EXECUTE and TOKEN_IMPERSONATE.
/// \note Corresponds to TOKEN_EXECUTE flag.
NTW_INLINE constexpr token_access& execute() noexcept;
/// \brief Required to attach an impersonation access token to a process.
/// \note Corresponds to TOKEN_IMPERSONATE flag.
NTW_INLINE constexpr token_access& impersonate() noexcept;
/// \brief Required to query an access token.
/// \note Corresponds to TOKEN_QUERY flag.
NTW_INLINE constexpr token_access& query() noexcept;
/// \brief Required to query the source of an access token.
/// \note Corresponds to TOKEN_QUERY_SOURCE flag.
NTW_INLINE constexpr token_access& query_source() noexcept;
/// \brief Combines all possible access rights for a token.
/// \note Corresponds to TOKEN_ALL_ACCESS flag.
NTW_INLINE constexpr token_access& all() noexcept;
};
// forward declaration
struct privilege_with_attributes;
/// \brief Wraps LUID structure.
struct privilege : LUID {
/// \brief Constructs LUID with your given privilege value.
NTW_INLINE constexpr privilege(std::uint32_t value) noexcept : LUID{ value, 0 } {}
/// \brief Creates privilege_with_attributes and enables it.
NTW_INLINE constexpr privilege_with_attributes enable() const noexcept;
/// \brief Creates privilege_with_attributes with zeroed attributes.
NTW_INLINE constexpr privilege_with_attributes disable() const noexcept;
/// \brief Creates privilege_with_attributes and removes it.
NTW_INLINE constexpr privilege_with_attributes remove() const noexcept;
NTW_INLINE constexpr static privilege create_token() noexcept;
NTW_INLINE constexpr static privilege assign_primary_token() noexcept;
NTW_INLINE constexpr static privilege lock_memory() noexcept;
NTW_INLINE constexpr static privilege increase_qouta() noexcept;
NTW_INLINE constexpr static privilege machine_account() noexcept;
NTW_INLINE constexpr static privilege tcb() noexcept;
NTW_INLINE constexpr static privilege security() noexcept;
NTW_INLINE constexpr static privilege take_ownership() noexcept;
NTW_INLINE constexpr static privilege load_driver() noexcept;
NTW_INLINE constexpr static privilege system_profile() noexcept;
NTW_INLINE constexpr static privilege systemtime() noexcept;
NTW_INLINE constexpr static privilege prof_single_process() noexcept;
NTW_INLINE constexpr static privilege inc_base_priority() noexcept;
NTW_INLINE constexpr static privilege create_pagefile() noexcept;
NTW_INLINE constexpr static privilege create_permanent() noexcept;
NTW_INLINE constexpr static privilege backup() noexcept;
NTW_INLINE constexpr static privilege restore() noexcept;
NTW_INLINE constexpr static privilege shutdown() noexcept;
NTW_INLINE constexpr static privilege debug() noexcept;
NTW_INLINE constexpr static privilege audit() noexcept;
NTW_INLINE constexpr static privilege system_environment() noexcept;
NTW_INLINE constexpr static privilege change_notify() noexcept;
NTW_INLINE constexpr static privilege remote_shutdown() noexcept;
NTW_INLINE constexpr static privilege undock() noexcept;
NTW_INLINE constexpr static privilege sync_agent() noexcept;
NTW_INLINE constexpr static privilege enable_delegation() noexcept;
NTW_INLINE constexpr static privilege manage_volume() noexcept;
NTW_INLINE constexpr static privilege impersonate() noexcept;
NTW_INLINE constexpr static privilege create_global() noexcept;
NTW_INLINE constexpr static privilege trusted_credman_access() noexcept;
NTW_INLINE constexpr static privilege relabel() noexcept;
NTW_INLINE constexpr static privilege inc_working_set() noexcept;
NTW_INLINE constexpr static privilege time_zone() noexcept;
NTW_INLINE constexpr static privilege create_symbolic_link() noexcept;
NTW_INLINE constexpr static privilege
delegate_session_user_impersonate() noexcept;
};
/// \brief LUID_AND_ATTRIBUTES reimplementation
struct privilege_with_attributes {
privilege privilege;
std::uint32_t attributes = 0;
NTW_INLINE constexpr privilege_with_attributes& enable() noexcept;
NTW_INLINE constexpr privilege_with_attributes& remove() noexcept;
NTW_INLINE constexpr bool enabled() const noexcept;
NTW_INLINE bool removed() const noexcept;
NTW_INLINE bool enabled_by_default() const noexcept;
};
/// \brief Wrapper class around token object
// TODO open overload for threads
// TODO reset_privileges overload with old state return
// TODO NtAdjustPrivilegesToken with array of privileges instead of singular instances
template<class Handle>
struct basic_token : Handle {
using handle_type = Handle;
using access_type = token_access;
using handle_type::handle_type;
basic_token() = default;
/// \brief Opens given process token with the specified access.
template<class H>
NTW_INLINE static ntw::result<basic_token>
open(const basic_process<H>& process, token_access desired_access) noexcept;
/// \brief Opens given thread token with the specified access.
template<class H>
NTW_INLINE static ntw::result<basic_token>
open(const basic_thread<H>& thread, token_access desired_access) noexcept;
/// \brief Opens given thread token with the specified access as self.
template<class H>
NTW_INLINE static ntw::result<basic_token>
open_as_self(const basic_thread<H>& thread, token_access desired_access) noexcept;
/// \brief Resets / disables all privileges.
/// \note Acts as AdjustTokenPrivileges(handle, TRUE, ...)
NTW_INLINE status reset_privileges() const noexcept;
/// \brief Ajusts a single privilege using NtAdjustPrivilegesToken API.
/// \returns The old state of the privilege.
/// \warn MAY RETURN STATUS_NOT_ALL_ASSIGNED WHICH IS NOT TREATED AS AN ERROR.
/// \note If you don't care about old state use replace_privilege.
NTW_INLINE result<privilege_with_attributes> adjust_privilege(
privilege_with_attributes privilege) const noexcept;
/// \brief Ajusts a single privilege using NtAdjustPrivilegesToken API.
/// \warn MAY RETURN STATUS_NOT_ALL_ASSIGNED WHICH IS NOT TREATED AS AN ERROR.
/// \note If you care about old state use adjust_privilege.
NTW_INLINE status
replace_privilege(privilege_with_attributes privilege) const noexcept;
};
using token = basic_token<object>;
using token_ref = basic_token<object_ref>;
} // namespace ntw::ob
#include "impl/token.inl" | {
"pile_set_name": "Github"
} |
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2008-2013, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
*
* File GENDER.H
*
* Modification History:*
* Date Name Description
*
********************************************************************************
*/
#ifndef _GENDER
#define _GENDER
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include "unicode/locid.h"
#include "unicode/ugender.h"
#include "unicode/uobject.h"
class GenderInfoTest;
U_NAMESPACE_BEGIN
// Forward Declaration
void U_CALLCONV GenderInfo_initCache(UErrorCode &status);
/**
* GenderInfo computes the gender of a list as a whole given the gender of
* each element.
* @stable ICU 50
*/
class U_I18N_API GenderInfo : public UObject {
public:
/**
* Provides access to the predefined GenderInfo object for a given
* locale.
*
* @param locale The locale for which a <code>GenderInfo</code> object is
* returned.
* @param status Output param set to success/failure code on exit, which
* must not indicate a failure before the function call.
* @return The predefined <code>GenderInfo</code> object pointer for
* this locale. The returned object is immutable, so it is
* declared as const. Caller does not own the returned
* pointer, so it must not attempt to free it.
* @stable ICU 50
*/
static const GenderInfo* U_EXPORT2 getInstance(const Locale& locale, UErrorCode& status);
/**
* Determines the gender of a list as a whole given the gender of each
* of the elements.
*
* @param genders the gender of each element in the list.
* @param length the length of gender array.
* @param status Output param set to success/failure code on exit, which
* must not indicate a failure before the function call.
* @return the gender of the whole list.
* @stable ICU 50
*/
UGender getListGender(const UGender* genders, int32_t length, UErrorCode& status) const;
/**
* Destructor.
*
* @stable ICU 50
*/
virtual ~GenderInfo();
private:
int32_t _style;
/**
* Copy constructor. One object per locale invariant. Clients
* must never copy GenderInfo objects.
*/
GenderInfo(const GenderInfo& other);
/**
* Assignment operator. Not applicable to immutable objects.
*/
GenderInfo& operator=(const GenderInfo&);
GenderInfo();
static const GenderInfo* getNeutralInstance();
static const GenderInfo* getMixedNeutralInstance();
static const GenderInfo* getMaleTaintsInstance();
static const GenderInfo* loadInstance(const Locale& locale, UErrorCode& status);
friend class ::GenderInfoTest;
friend void U_CALLCONV GenderInfo_initCache(UErrorCode &status);
};
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif // _GENDER
//eof
| {
"pile_set_name": "Github"
} |
# DO NOT MODIFY. This file was generated by
# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go.
# A call to a write method with complicated input data.
description: "set: complex"
set: <
doc_ref_path: "projects/projectID/databases/(default)/documents/C/d"
json_data: "{\"a\": [1, 2.5], \"b\": {\"c\": [\"three\", {\"d\": true}]}}"
request: <
database: "projects/projectID/databases/(default)"
writes: <
update: <
name: "projects/projectID/databases/(default)/documents/C/d"
fields: <
key: "a"
value: <
array_value: <
values: <
integer_value: 1
>
values: <
double_value: 2.5
>
>
>
>
fields: <
key: "b"
value: <
map_value: <
fields: <
key: "c"
value: <
array_value: <
values: <
string_value: "three"
>
values: <
map_value: <
fields: <
key: "d"
value: <
boolean_value: true
>
>
>
>
>
>
>
>
>
>
>
>
>
>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>NavBar: NavBarPageListWidget Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">NavBar
</div>
<div id="projectbrief">Outlook-like navigation bar for Qt</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Properties</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#signals">Signals</a> |
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pro-methods">Protected Member Functions</a> |
<a href="#properties">Properties</a> |
<a href="class_nav_bar_page_list_widget-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">NavBarPageListWidget Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="dynheader">
Inheritance diagram for NavBarPageListWidget:</div>
<div class="dyncontent">
<div class="center"><img src="class_nav_bar_page_list_widget__inherit__graph.png" border="0" usemap="#_nav_bar_page_list_widget_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="signals"></a>
Signals</h2></td></tr>
<tr class="memitem:ad12ef3f7e5a4ac499adfa9648279f3c3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad12ef3f7e5a4ac499adfa9648279f3c3"></a>
void </td><td class="memItemRight" valign="bottom"><b>buttonVisibilityChanged</b> (int visCount)</td></tr>
<tr class="separator:ad12ef3f7e5a4ac499adfa9648279f3c3"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a70f968e4866b3acdbad307745f036abc"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a70f968e4866b3acdbad307745f036abc"></a>
 </td><td class="memItemRight" valign="bottom"><b>NavBarPageListWidget</b> (<a class="el" href="class_nav_bar.html">NavBar</a> *parent)</td></tr>
<tr class="separator:a70f968e4866b3acdbad307745f036abc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab9f269ca7dee2d1038301a8bf53a2fcf"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab9f269ca7dee2d1038301a8bf53a2fcf"></a>
void </td><td class="memItemRight" valign="bottom"><b>layoutButtons</b> (int width)</td></tr>
<tr class="separator:ab9f269ca7dee2d1038301a8bf53a2fcf"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a86a639732e78d1984c936fea9fd47689"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a86a639732e78d1984c936fea9fd47689"></a>
int </td><td class="memItemRight" valign="bottom"><b>rowHeight</b> () const </td></tr>
<tr class="separator:a86a639732e78d1984c936fea9fd47689"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aebb782ec512fec3531078077c218c2c1"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aebb782ec512fec3531078077c218c2c1"></a>
void </td><td class="memItemRight" valign="bottom"><b>setRowHeight</b> (int newHeight)</td></tr>
<tr class="separator:aebb782ec512fec3531078077c218c2c1"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:ad24f5556ff8b5381a78e88569657f7ce"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad24f5556ff8b5381a78e88569657f7ce"></a>
void </td><td class="memItemRight" valign="bottom"><b>resizeEvent</b> (QResizeEvent *e)</td></tr>
<tr class="separator:ad24f5556ff8b5381a78e88569657f7ce"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="properties"></a>
Properties</h2></td></tr>
<tr class="memitem:a6f1ede2e05a198a80a49b94a67d0da39"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6f1ede2e05a198a80a49b94a67d0da39"></a>
int </td><td class="memItemRight" valign="bottom"><b>rowHeight</b></td></tr>
<tr class="separator:a6f1ede2e05a198a80a49b94a67d0da39"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>E:/mydev/QtNavigationBar/qt-navigation-bar/src/<a class="el" href="navbarpagelistwidget_8h_source.html">navbarpagelistwidget.h</a></li>
<li>E:/mydev/QtNavigationBar/qt-navigation-bar/src/navbarpagelistwidget.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sat May 31 2014 16:59:15 for NavBar by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
| {
"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_Urlshortener_UrlHistory extends Google_Collection
{
protected $collection_key = 'items';
protected $itemsType = 'Google_Service_Urlshortener_Url';
protected $itemsDataType = 'array';
public $itemsPerPage;
public $kind;
public $nextPageToken;
public $totalItems;
/**
* @param Google_Service_Urlshortener_Url
*/
public function setItems($items)
{
$this->items = $items;
}
/**
* @return Google_Service_Urlshortener_Url
*/
public function getItems()
{
return $this->items;
}
public function setItemsPerPage($itemsPerPage)
{
$this->itemsPerPage = $itemsPerPage;
}
public function getItemsPerPage()
{
return $this->itemsPerPage;
}
public function setKind($kind)
{
$this->kind = $kind;
}
public function getKind()
{
return $this->kind;
}
public function setNextPageToken($nextPageToken)
{
$this->nextPageToken = $nextPageToken;
}
public function getNextPageToken()
{
return $this->nextPageToken;
}
public function setTotalItems($totalItems)
{
$this->totalItems = $totalItems;
}
public function getTotalItems()
{
return $this->totalItems;
}
}
| {
"pile_set_name": "Github"
} |
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string",
"metadata": {
"description": "Name of the VM"
}
},
"osType": {
"type": "string",
"defaultValue": "Linux",
"allowedValues": [
"Linux"
],
"metadata": {
"description": "Type of OS on the existing vhd"
}
},
"osDiskVhdUri": {
"type": "string",
"metadata": {
"description": "URI of the existing VHD in ARM standard or premium storage"
}
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_A1_v2",
"metadata": {
"description": "Size of the VM"
}
},
"vmDiskSizeGB": {
"type": "string",
"defaultValue": "150",
"allowedValues": [
"150",
"300"
],
"metadata": {
"description": "Diskspace size of the VM"
}
},
"existingVirtualNetworkResourceGroup":{
"type":"string",
"defaultValue":"[resourceGroup().name]",
"metadata":{
"description":"Name of the existing VNET resource group"
}
},
"existingVirtualNetworkName": {
"type": "string",
"metadata": {
"description": "Name of the existing VNET"
}
},
"subnetName": {
"type": "string",
"metadata": {
"description": "Name of the subnet in the virtual network you want to use"
}
},
"existingSecurityGroupName": {
"type": "string",
"metadata": {
"description": "Name of the network Security Group that needs to be assocated to virtual NIC. "
}
},
"dnsNameForPublicIP": {
"type": "string",
"metadata": {
"description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"variables": {
"diagStorageAccountName": "[concat(uniquestring(resourceGroup().id), 'specvm')]",
"publicIPAddressType": "Dynamic",
"subnetRef": "[resourceId(parameters('existingVirtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks/subnets', parameters('existingVirtualNetworkName'), parameters('subnetName'))]",
"nicName": "[parameters('vmName')]",
"publicIPAddressName": "[parameters('vmName')]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('diagStorageAccountName')]",
"apiVersion": "2018-02-01",
"location": "[parameters('location')]",
"sku": {
"name": "Standard_GRS"
},
"kind": "Storage",
"properties": {}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"location": "[parameters('location')]",
"tags": {
"displayName": "PublicIPAddress"
},
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
}
}
},
{
"apiVersion": "2017-03-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]"
],
"tags": {
"displayName": "NetworkInterface"
},
"properties": {
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('existingSecurityGroupName'))]"
},
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}
]
}
},
{
"type":"Microsoft.Compute/disks",
"apiVersion":"2017-03-30",
"name":"[concat(parameters('vmName'), '_OSdisk')]",
"location":"[parameters('location')]",
"properties":{
"creationData":{
"createOption":"Import",
"sourceUri":"[parameters('osDiskVhdUri')]"
},
"osType":"[parameters('osType')]"
}
},
{
"apiVersion": "2017-03-30",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('vmName')]",
"location": "[parameters('location')]",
"tags": {
"displayName": "VirtualMachine"
},
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]",
"[concat(parameters('vmName'), '_OSdisk')]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"storageProfile": {
"osDisk": {
"osType": "[parameters('osType')]",
"caching": "ReadWrite",
"managedDisk":{
"id":"[resourceId('Microsoft.Compute/disks', concat(parameters('vmName'), '_OSdisk'))]"
},
"createOption": "Attach",
"diskSizeGB": "[parameters('vmDiskSizeGB')]"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true ,
"storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('diagStorageAccountName')), '2016-01-01').primaryEndpoints.blob)]"
}
}
}
}
]
}
| {
"pile_set_name": "Github"
} |
package de.metas.util.collections;
import org.junit.Assert;
import org.junit.Test;
import de.metas.util.collections.IncludeExcludeListPredicate;
import de.metas.util.collections.IncludeExcludeListPredicate.Builder;
public class IncludeExcludeListPredicateTest
{
private IncludeExcludeListPredicate<String> includeExcludeList = null;
private final void assertAccepted(final String testItem)
{
Assert.assertTrue("Item shall be accepted: " + testItem, includeExcludeList.test(testItem));
}
private final void assertNotAccepted(final String testItem)
{
Assert.assertFalse("Item shall NOT be accepted: " + testItem, includeExcludeList.test(testItem));
}
/**
* Expectation: not matter how the include/exclude list is configured, <code>null</code> items are NOT accepted
*/
@Test
public void test_NullItemsAreNeverAccepted()
{
includeExcludeList = IncludeExcludeListPredicate.<String> builder()
.build();
assertNotAccepted(null);
}
/** Expect anything to be accepted if the list is empty */
@Test
public void test_EmptyList()
{
includeExcludeList = IncludeExcludeListPredicate.<String> builder()
.build();
assertAccepted("item1");
assertAccepted("item2");
assertAccepted("item3");
}
/**
* Case: include/exclude list has no includes defined but some items are excluded.
*
* Expectation: excluded items are NOT accepted, anything else is accepted
*/
@Test
public void test_NoIncludes_SomeExcludes()
{
includeExcludeList = IncludeExcludeListPredicate.<String> builder()
.exclude("item1")
.build();
//
assertNotAccepted("item1");
assertAccepted("item2");
assertAccepted("item3");
}
/**
* Case: include/exclude list has some includes defined but NO items are excluded.
*
* Expectation: only included items are accepted.
*/
@Test
public void test_SomeIncludes_NoExcludes()
{
includeExcludeList = IncludeExcludeListPredicate.<String> builder()
.include("item1")
.include("item2")
.include("item3")
.build();
//
assertAccepted("item1");
assertAccepted("item2");
assertAccepted("item3");
assertNotAccepted("item4");
}
/**
* Case: include/exclude list has some includes defined and also some excludes.
*
* Expectation: only included items are accepted, excluded items are always rejected, no matter if they were added to includes.
*/
@Test
public void test_SomeIncludes_SomeExcludes()
{
includeExcludeList = IncludeExcludeListPredicate.<String> builder()
.include("item1")
.include("item2")
.include("item3")
.exclude("item1")
.build();
//
assertNotAccepted("item1");
assertAccepted("item2");
assertAccepted("item3");
assertNotAccepted("item4");
}
@Test(expected = RuntimeException.class)
public void test_addNullInclude_Fails()
{
IncludeExcludeListPredicate.<String> builder()
.include(null);
}
@Test
public void test_addNullExclude_Ignored()
{
includeExcludeList = IncludeExcludeListPredicate.<String> builder()
.exclude(null)
.build();
Assert.assertSame(IncludeExcludeListPredicate.empty(), includeExcludeList);
}
/**
* Test {@link Builder#build()} and make sure it's caching the last build result and in case nothing changed, it returns it.
*/
@Test
public void test_SubsequentBuildsAreOptimized()
{
final Builder<String> builder = IncludeExcludeListPredicate.<String> builder();
// If nothing added, builder shall always return the the "empty" list.
IncludeExcludeListPredicate<String> list = builder.build();
Assert.assertSame(IncludeExcludeListPredicate.empty(), list);
// Add an item to builder.
// We expect a new list to be built.
IncludeExcludeListPredicate<String> lastList = list;
list = builder.include("item1").build();
Assert.assertNotSame(lastList, list);
// Add the same item again.
// We expect same list to be built.
lastList = list;
list = builder.include("item1").build();
Assert.assertSame(lastList, list);
// Add a new item to builder.
// We expect a new list to be built.
lastList = list;
list = builder.include("item2").build();
Assert.assertNotSame(lastList, list);
}
}
| {
"pile_set_name": "Github"
} |
////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 1993-2020 The Octave Project Developers
//
// See the file COPYRIGHT.md in the top-level directory of this
// distribution or <https://octave.org/copyright/>.
//
// This file is part of Octave.
//
// Octave 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.
//
// Octave 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 Octave; see the file COPYING. If not, see
// <https://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////
#if defined (HAVE_CONFIG_H)
# include "config.h"
#endif
#include <cassert>
#include "symrec.h"
#include "token.h"
namespace octave
{
token::token (int tv, const filepos& beg_pos, const filepos& end_pos)
: m_maybe_cmd (false), m_tspc (false), m_beg_pos (beg_pos),
m_end_pos (end_pos), m_tok_val (tv), m_type_tag (generic_token),
m_tok_info (), m_orig_text ()
{ }
token::token (int tv, bool is_kw, const filepos& beg_pos,
const filepos& end_pos)
: m_maybe_cmd (false), m_tspc (false), m_beg_pos (beg_pos),
m_end_pos (end_pos), m_tok_val (tv),
m_type_tag (is_kw ? keyword_token : generic_token), m_tok_info (),
m_orig_text ()
{ }
token::token (int tv, const char *s, const filepos& beg_pos,
const filepos& end_pos)
: m_maybe_cmd (false), m_tspc (false), m_beg_pos (beg_pos),
m_end_pos (end_pos), m_tok_val (tv), m_type_tag (string_token),
m_tok_info (s), m_orig_text ()
{ }
token::token (int tv, const std::string& s, const filepos& beg_pos,
const filepos& end_pos)
: m_maybe_cmd (false), m_tspc (false), m_beg_pos (beg_pos),
m_end_pos (end_pos), m_tok_val (tv), m_type_tag (string_token),
m_tok_info (s), m_orig_text ()
{ }
token::token (int tv, double d, const std::string& s, const filepos& beg_pos,
const filepos& end_pos)
: m_maybe_cmd (false), m_tspc (false), m_beg_pos (beg_pos),
m_end_pos (end_pos), m_tok_val (tv), m_type_tag (double_token),
m_tok_info (d), m_orig_text (s)
{ }
token::token (int tv, end_tok_type t, const filepos& beg_pos,
const filepos& end_pos)
: m_maybe_cmd (false), m_tspc (false), m_beg_pos (beg_pos),
m_end_pos (end_pos), m_tok_val (tv), m_type_tag (ettype_token),
m_tok_info (t), m_orig_text ()
{ }
token::token (int tv, const symbol_record& sr, const filepos& beg_pos,
const filepos& end_pos)
: m_maybe_cmd (false), m_tspc (false), m_beg_pos (beg_pos),
m_end_pos (end_pos), m_tok_val (tv), m_type_tag (sym_rec_token),
m_tok_info (sr), m_orig_text ()
{ }
token::token (int tv, const std::string& meth, const std::string& cls,
const filepos& beg_pos, const filepos& end_pos)
: m_maybe_cmd (false), m_tspc (false), m_beg_pos (beg_pos),
m_end_pos (end_pos), m_tok_val (tv), m_type_tag (scls_name_token),
m_tok_info (meth, cls), m_orig_text ()
{ }
token::~token (void)
{
if (m_type_tag == string_token)
delete m_tok_info.m_str;
else if (m_type_tag == sym_rec_token)
delete m_tok_info.m_sr;
else if (m_type_tag == scls_name_token)
delete m_tok_info.m_superclass_info;
}
std::string
token::text (void) const
{
assert (m_type_tag == string_token);
return *m_tok_info.m_str;
}
std::string
token::symbol_name (void) const
{
assert (m_type_tag == sym_rec_token);
return m_tok_info.m_sr->name ();
}
double
token::number (void) const
{
assert (m_type_tag == double_token);
return m_tok_info.m_num;
}
token::token_type
token::ttype (void) const
{
return m_type_tag;
}
token::end_tok_type
token::ettype (void) const
{
assert (m_type_tag == ettype_token);
return m_tok_info.m_et;
}
symbol_record
token::sym_rec (void) const
{
assert (m_type_tag == sym_rec_token);
return *m_tok_info.m_sr;
}
std::string
token::superclass_method_name (void) const
{
assert (m_type_tag == scls_name_token);
return m_tok_info.m_superclass_info->m_method_name;
}
std::string
token::superclass_class_name (void) const
{
assert (m_type_tag == scls_name_token);
return m_tok_info.m_superclass_info->m_class_name;
}
std::string
token::text_rep (void) const
{
return m_orig_text;
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package unix
import (
"syscall"
"unsafe"
)
// Unveil implements the unveil syscall.
// For more information see unveil(2).
// Note that the special case of blocking further
// unveil calls is handled by UnveilBlock.
func Unveil(path string, flags string) error {
pathPtr, err := syscall.BytePtrFromString(path)
if err != nil {
return err
}
flagsPtr, err := syscall.BytePtrFromString(flags)
if err != nil {
return err
}
_, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0)
if e != 0 {
return e
}
return nil
}
// UnveilBlock blocks future unveil calls.
// For more information see unveil(2).
func UnveilBlock() error {
// Both pointers must be nil.
var pathUnsafe, flagsUnsafe unsafe.Pointer
_, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0)
if e != 0 {
return e
}
return nil
}
| {
"pile_set_name": "Github"
} |
// Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_
#define DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_
#include "utils.h"
namespace double_conversion {
class DoubleToStringConverter {
public:
// When calling ToFixed with a double > 10^kMaxFixedDigitsBeforePoint
// or a requested_digits parameter > kMaxFixedDigitsAfterPoint then the
// function returns false.
static const int kMaxFixedDigitsBeforePoint = 60;
static const int kMaxFixedDigitsAfterPoint = 60;
// When calling ToExponential with a requested_digits
// parameter > kMaxExponentialDigits then the function returns false.
static const int kMaxExponentialDigits = 120;
// When calling ToPrecision with a requested_digits
// parameter < kMinPrecisionDigits or requested_digits > kMaxPrecisionDigits
// then the function returns false.
static const int kMinPrecisionDigits = 1;
static const int kMaxPrecisionDigits = 120;
enum Flags {
NO_FLAGS = 0,
EMIT_POSITIVE_EXPONENT_SIGN = 1,
EMIT_TRAILING_DECIMAL_POINT = 2,
EMIT_TRAILING_ZERO_AFTER_POINT = 4,
UNIQUE_ZERO = 8
};
// Flags should be a bit-or combination of the possible Flags-enum.
// - NO_FLAGS: no special flags.
// - EMIT_POSITIVE_EXPONENT_SIGN: when the number is converted into exponent
// form, emits a '+' for positive exponents. Example: 1.2e+2.
// - EMIT_TRAILING_DECIMAL_POINT: when the input number is an integer and is
// converted into decimal format then a trailing decimal point is appended.
// Example: 2345.0 is converted to "2345.".
// - EMIT_TRAILING_ZERO_AFTER_POINT: in addition to a trailing decimal point
// emits a trailing '0'-character. This flag requires the
// EXMIT_TRAILING_DECIMAL_POINT flag.
// Example: 2345.0 is converted to "2345.0".
// - UNIQUE_ZERO: "-0.0" is converted to "0.0".
//
// Infinity symbol and nan_symbol provide the string representation for these
// special values. If the string is NULL and the special value is encountered
// then the conversion functions return false.
//
// The exponent_character is used in exponential representations. It is
// usually 'e' or 'E'.
//
// When converting to the shortest representation the converter will
// represent input numbers in decimal format if they are in the interval
// [10^decimal_in_shortest_low; 10^decimal_in_shortest_high[
// (lower boundary included, greater boundary excluded).
// Example: with decimal_in_shortest_low = -6 and
// decimal_in_shortest_high = 21:
// ToShortest(0.000001) -> "0.000001"
// ToShortest(0.0000001) -> "1e-7"
// ToShortest(111111111111111111111.0) -> "111111111111111110000"
// ToShortest(100000000000000000000.0) -> "100000000000000000000"
// ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21"
//
// When converting to precision mode the converter may add
// max_leading_padding_zeroes before returning the number in exponential
// format.
// Example with max_leading_padding_zeroes_in_precision_mode = 6.
// ToPrecision(0.0000012345, 2) -> "0.0000012"
// ToPrecision(0.00000012345, 2) -> "1.2e-7"
// Similarily the converter may add up to
// max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid
// returning an exponential representation. A zero added by the
// EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit.
// Examples for max_trailing_padding_zeroes_in_precision_mode = 1:
// ToPrecision(230.0, 2) -> "230"
// ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT.
// ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT.
//
// The min_exponent_width is used for exponential representations.
// The converter adds leading '0's to the exponent until the exponent
// is at least min_exponent_width digits long.
// The min_exponent_width is clamped to 5.
// As such, the exponent may never have more than 5 digits in total.
DoubleToStringConverter(int flags,
const char* infinity_symbol,
const char* nan_symbol,
char exponent_character,
int decimal_in_shortest_low,
int decimal_in_shortest_high,
int max_leading_padding_zeroes_in_precision_mode,
int max_trailing_padding_zeroes_in_precision_mode,
int min_exponent_width = 0)
: flags_(flags),
infinity_symbol_(infinity_symbol),
nan_symbol_(nan_symbol),
exponent_character_(exponent_character),
decimal_in_shortest_low_(decimal_in_shortest_low),
decimal_in_shortest_high_(decimal_in_shortest_high),
max_leading_padding_zeroes_in_precision_mode_(
max_leading_padding_zeroes_in_precision_mode),
max_trailing_padding_zeroes_in_precision_mode_(
max_trailing_padding_zeroes_in_precision_mode),
min_exponent_width_(min_exponent_width) {
// When 'trailing zero after the point' is set, then 'trailing point'
// must be set too.
DOUBLE_CONVERSION_ASSERT(((flags & EMIT_TRAILING_DECIMAL_POINT) != 0) ||
!((flags & EMIT_TRAILING_ZERO_AFTER_POINT) != 0));
}
// Returns a converter following the EcmaScript specification.
static const DoubleToStringConverter& EcmaScriptConverter();
// Computes the shortest string of digits that correctly represent the input
// number. Depending on decimal_in_shortest_low and decimal_in_shortest_high
// (see constructor) it then either returns a decimal representation, or an
// exponential representation.
// Example with decimal_in_shortest_low = -6,
// decimal_in_shortest_high = 21,
// EMIT_POSITIVE_EXPONENT_SIGN activated, and
// EMIT_TRAILING_DECIMAL_POINT deactived:
// ToShortest(0.000001) -> "0.000001"
// ToShortest(0.0000001) -> "1e-7"
// ToShortest(111111111111111111111.0) -> "111111111111111110000"
// ToShortest(100000000000000000000.0) -> "100000000000000000000"
// ToShortest(1111111111111111111111.0) -> "1.1111111111111111e+21"
//
// Note: the conversion may round the output if the returned string
// is accurate enough to uniquely identify the input-number.
// For example the most precise representation of the double 9e59 equals
// "899999999999999918767229449717619953810131273674690656206848", but
// the converter will return the shorter (but still correct) "9e59".
//
// Returns true if the conversion succeeds. The conversion always succeeds
// except when the input value is special and no infinity_symbol or
// nan_symbol has been given to the constructor.
bool ToShortest(double value, StringBuilder* result_builder) const {
return ToShortestIeeeNumber(value, result_builder, SHORTEST);
}
// Same as ToShortest, but for single-precision floats.
bool ToShortestSingle(float value, StringBuilder* result_builder) const {
return ToShortestIeeeNumber(value, result_builder, SHORTEST_SINGLE);
}
// Computes a decimal representation with a fixed number of digits after the
// decimal point. The last emitted digit is rounded.
//
// Examples:
// ToFixed(3.12, 1) -> "3.1"
// ToFixed(3.1415, 3) -> "3.142"
// ToFixed(1234.56789, 4) -> "1234.5679"
// ToFixed(1.23, 5) -> "1.23000"
// ToFixed(0.1, 4) -> "0.1000"
// ToFixed(1e30, 2) -> "1000000000000000019884624838656.00"
// ToFixed(0.1, 30) -> "0.100000000000000005551115123126"
// ToFixed(0.1, 17) -> "0.10000000000000001"
//
// If requested_digits equals 0, then the tail of the result depends on
// the EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT.
// Examples, for requested_digits == 0,
// let EMIT_TRAILING_DECIMAL_POINT and EMIT_TRAILING_ZERO_AFTER_POINT be
// - false and false: then 123.45 -> 123
// 0.678 -> 1
// - true and false: then 123.45 -> 123.
// 0.678 -> 1.
// - true and true: then 123.45 -> 123.0
// 0.678 -> 1.0
//
// Returns true if the conversion succeeds. The conversion always succeeds
// except for the following cases:
// - the input value is special and no infinity_symbol or nan_symbol has
// been provided to the constructor,
// - 'value' > 10^kMaxFixedDigitsBeforePoint, or
// - 'requested_digits' > kMaxFixedDigitsAfterPoint.
// The last two conditions imply that the result will never contain more than
// 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters
// (one additional character for the sign, and one for the decimal point).
bool ToFixed(double value,
int requested_digits,
StringBuilder* result_builder) const;
// Computes a representation in exponential format with requested_digits
// after the decimal point. The last emitted digit is rounded.
// If requested_digits equals -1, then the shortest exponential representation
// is computed.
//
// Examples with EMIT_POSITIVE_EXPONENT_SIGN deactivated, and
// exponent_character set to 'e'.
// ToExponential(3.12, 1) -> "3.1e0"
// ToExponential(5.0, 3) -> "5.000e0"
// ToExponential(0.001, 2) -> "1.00e-3"
// ToExponential(3.1415, -1) -> "3.1415e0"
// ToExponential(3.1415, 4) -> "3.1415e0"
// ToExponential(3.1415, 3) -> "3.142e0"
// ToExponential(123456789000000, 3) -> "1.235e14"
// ToExponential(1000000000000000019884624838656.0, -1) -> "1e30"
// ToExponential(1000000000000000019884624838656.0, 32) ->
// "1.00000000000000001988462483865600e30"
// ToExponential(1234, 0) -> "1e3"
//
// Returns true if the conversion succeeds. The conversion always succeeds
// except for the following cases:
// - the input value is special and no infinity_symbol or nan_symbol has
// been provided to the constructor,
// - 'requested_digits' > kMaxExponentialDigits.
// The last condition implies that the result will never contain more than
// kMaxExponentialDigits + 8 characters (the sign, the digit before the
// decimal point, the decimal point, the exponent character, the
// exponent's sign, and at most 3 exponent digits).
bool ToExponential(double value,
int requested_digits,
StringBuilder* result_builder) const;
// Computes 'precision' leading digits of the given 'value' and returns them
// either in exponential or decimal format, depending on
// max_{leading|trailing}_padding_zeroes_in_precision_mode (given to the
// constructor).
// The last computed digit is rounded.
//
// Example with max_leading_padding_zeroes_in_precision_mode = 6.
// ToPrecision(0.0000012345, 2) -> "0.0000012"
// ToPrecision(0.00000012345, 2) -> "1.2e-7"
// Similarily the converter may add up to
// max_trailing_padding_zeroes_in_precision_mode in precision mode to avoid
// returning an exponential representation. A zero added by the
// EMIT_TRAILING_ZERO_AFTER_POINT flag is counted for this limit.
// Examples for max_trailing_padding_zeroes_in_precision_mode = 1:
// ToPrecision(230.0, 2) -> "230"
// ToPrecision(230.0, 2) -> "230." with EMIT_TRAILING_DECIMAL_POINT.
// ToPrecision(230.0, 2) -> "2.3e2" with EMIT_TRAILING_ZERO_AFTER_POINT.
// Examples for max_trailing_padding_zeroes_in_precision_mode = 3, and no
// EMIT_TRAILING_ZERO_AFTER_POINT:
// ToPrecision(123450.0, 6) -> "123450"
// ToPrecision(123450.0, 5) -> "123450"
// ToPrecision(123450.0, 4) -> "123500"
// ToPrecision(123450.0, 3) -> "123000"
// ToPrecision(123450.0, 2) -> "1.2e5"
//
// Returns true if the conversion succeeds. The conversion always succeeds
// except for the following cases:
// - the input value is special and no infinity_symbol or nan_symbol has
// been provided to the constructor,
// - precision < kMinPericisionDigits
// - precision > kMaxPrecisionDigits
// The last condition implies that the result will never contain more than
// kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the
// exponent character, the exponent's sign, and at most 3 exponent digits).
bool ToPrecision(double value,
int precision,
StringBuilder* result_builder) const;
enum DtoaMode {
// Produce the shortest correct representation.
// For example the output of 0.299999999999999988897 is (the less accurate
// but correct) 0.3.
SHORTEST,
// Same as SHORTEST, but for single-precision floats.
SHORTEST_SINGLE,
// Produce a fixed number of digits after the decimal point.
// For instance fixed(0.1, 4) becomes 0.1000
// If the input number is big, the output will be big.
FIXED,
// Fixed number of digits (independent of the decimal point).
PRECISION
};
// The maximal number of digits that are needed to emit a double in base 10.
// A higher precision can be achieved by using more digits, but the shortest
// accurate representation of any double will never use more digits than
// kBase10MaximalLength.
// Note that DoubleToAscii null-terminates its input. So the given buffer
// should be at least kBase10MaximalLength + 1 characters long.
static const int kBase10MaximalLength = 17;
// Converts the given double 'v' to digit characters. 'v' must not be NaN,
// +Infinity, or -Infinity. In SHORTEST_SINGLE-mode this restriction also
// applies to 'v' after it has been casted to a single-precision float. That
// is, in this mode static_cast<float>(v) must not be NaN, +Infinity or
// -Infinity.
//
// The result should be interpreted as buffer * 10^(point-length).
//
// The digits are written to the buffer in the platform's charset, which is
// often UTF-8 (with ASCII-range digits) but may be another charset, such
// as EBCDIC.
//
// The output depends on the given mode:
// - SHORTEST: produce the least amount of digits for which the internal
// identity requirement is still satisfied. If the digits are printed
// (together with the correct exponent) then reading this number will give
// 'v' again. The buffer will choose the representation that is closest to
// 'v'. If there are two at the same distance, than the one farther away
// from 0 is chosen (halfway cases - ending with 5 - are rounded up).
// In this mode the 'requested_digits' parameter is ignored.
// - SHORTEST_SINGLE: same as SHORTEST but with single-precision.
// - FIXED: produces digits necessary to print a given number with
// 'requested_digits' digits after the decimal point. The produced digits
// might be too short in which case the caller has to fill the remainder
// with '0's.
// Example: toFixed(0.001, 5) is allowed to return buffer="1", point=-2.
// Halfway cases are rounded towards +/-Infinity (away from 0). The call
// toFixed(0.15, 2) thus returns buffer="2", point=0.
// The returned buffer may contain digits that would be truncated from the
// shortest representation of the input.
// - PRECISION: produces 'requested_digits' where the first digit is not '0'.
// Even though the length of produced digits usually equals
// 'requested_digits', the function is allowed to return fewer digits, in
// which case the caller has to fill the missing digits with '0's.
// Halfway cases are again rounded away from 0.
// DoubleToAscii expects the given buffer to be big enough to hold all
// digits and a terminating null-character. In SHORTEST-mode it expects a
// buffer of at least kBase10MaximalLength + 1. In all other modes the
// requested_digits parameter and the padding-zeroes limit the size of the
// output. Don't forget the decimal point, the exponent character and the
// terminating null-character when computing the maximal output size.
// The given length is only used in debug mode to ensure the buffer is big
// enough.
static void DoubleToAscii(double v,
DtoaMode mode,
int requested_digits,
char* buffer,
int buffer_length,
bool* sign,
int* length,
int* point);
private:
// Implementation for ToShortest and ToShortestSingle.
bool ToShortestIeeeNumber(double value,
StringBuilder* result_builder,
DtoaMode mode) const;
// If the value is a special value (NaN or Infinity) constructs the
// corresponding string using the configured infinity/nan-symbol.
// If either of them is NULL or the value is not special then the
// function returns false.
bool HandleSpecialValues(double value, StringBuilder* result_builder) const;
// Constructs an exponential representation (i.e. 1.234e56).
// The given exponent assumes a decimal point after the first decimal digit.
void CreateExponentialRepresentation(const char* decimal_digits,
int length,
int exponent,
StringBuilder* result_builder) const;
// Creates a decimal representation (i.e 1234.5678).
void CreateDecimalRepresentation(const char* decimal_digits,
int length,
int decimal_point,
int digits_after_point,
StringBuilder* result_builder) const;
const int flags_;
const char* const infinity_symbol_;
const char* const nan_symbol_;
const char exponent_character_;
const int decimal_in_shortest_low_;
const int decimal_in_shortest_high_;
const int max_leading_padding_zeroes_in_precision_mode_;
const int max_trailing_padding_zeroes_in_precision_mode_;
const int min_exponent_width_;
DOUBLE_CONVERSION_DISALLOW_IMPLICIT_CONSTRUCTORS(DoubleToStringConverter);
};
} // namespace double_conversion
#endif // DOUBLE_CONVERSION_DOUBLE_TO_STRING_H_
| {
"pile_set_name": "Github"
} |
/*-
* Copyright (c) 2014 Michihiro NAKAJIMA
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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(S) 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 "archive_platform.h"
__FBSDID("$FreeBSD$");
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#if !defined(HAVE_ARC4RANDOM_BUF) && (!defined(_WIN32) || defined(__CYGWIN__))
#ifdef HAVE_FCNTL
#include <fcntl.h>
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
static void arc4random_buf(void *, size_t);
#endif /* HAVE_ARC4RANDOM_BUF */
#include "archive.h"
#include "archive_random_private.h"
#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__)
#include <wincrypt.h>
#endif
#ifndef O_CLOEXEC
#define O_CLOEXEC 0
#endif
/*
* Random number generator function.
* This simply calls arc4random_buf function if the platform provides it.
*/
int
archive_random(void *buf, size_t nbytes)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
HCRYPTPROV hProv;
BOOL success;
success = CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT);
if (!success && GetLastError() == (DWORD)NTE_BAD_KEYSET) {
success = CryptAcquireContext(&hProv, NULL, NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
}
if (success) {
success = CryptGenRandom(hProv, (DWORD)nbytes, (BYTE*)buf);
CryptReleaseContext(hProv, 0);
if (success)
return ARCHIVE_OK;
}
/* TODO: Does this case really happen? */
return ARCHIVE_FAILED;
#else
arc4random_buf(buf, nbytes);
return ARCHIVE_OK;
#endif
}
#if !defined(HAVE_ARC4RANDOM_BUF) && (!defined(_WIN32) || defined(__CYGWIN__))
/* $OpenBSD: arc4random.c,v 1.24 2013/06/11 16:59:50 deraadt Exp $ */
/*
* Copyright (c) 1996, David Mazieres <[email protected]>
* Copyright (c) 2008, Damien Miller <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Arc4 random number generator for OpenBSD.
*
* This code is derived from section 17.1 of Applied Cryptography,
* second edition, which describes a stream cipher allegedly
* compatible with RSA Labs "RC4" cipher (the actual description of
* which is a trade secret). The same algorithm is used as a stream
* cipher called "arcfour" in Tatu Ylonen's ssh package.
*
* RC4 is a registered trademark of RSA Laboratories.
*/
#ifdef __GNUC__
#define inline __inline
#else /* !__GNUC__ */
#define inline
#endif /* !__GNUC__ */
struct arc4_stream {
uint8_t i;
uint8_t j;
uint8_t s[256];
};
#define RANDOMDEV "/dev/urandom"
#define KEYSIZE 128
#ifdef HAVE_PTHREAD_H
static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER;
#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx);
#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx);
#else
#define _ARC4_LOCK()
#define _ARC4_UNLOCK()
#endif
static int rs_initialized;
static struct arc4_stream rs;
static pid_t arc4_stir_pid;
static int arc4_count;
static inline uint8_t arc4_getbyte(void);
static void arc4_stir(void);
static inline void
arc4_init(void)
{
int n;
for (n = 0; n < 256; n++)
rs.s[n] = n;
rs.i = 0;
rs.j = 0;
}
static inline void
arc4_addrandom(u_char *dat, int datlen)
{
int n;
uint8_t si;
rs.i--;
for (n = 0; n < 256; n++) {
rs.i = (rs.i + 1);
si = rs.s[rs.i];
rs.j = (rs.j + si + dat[n % datlen]);
rs.s[rs.i] = rs.s[rs.j];
rs.s[rs.j] = si;
}
rs.j = rs.i;
}
static void
arc4_stir(void)
{
int done, fd, i;
struct {
struct timeval tv;
pid_t pid;
u_char rnd[KEYSIZE];
} rdat;
if (!rs_initialized) {
arc4_init();
rs_initialized = 1;
}
done = 0;
fd = open(RANDOMDEV, O_RDONLY | O_CLOEXEC, 0);
if (fd >= 0) {
if (read(fd, &rdat, KEYSIZE) == KEYSIZE)
done = 1;
(void)close(fd);
}
if (!done) {
(void)gettimeofday(&rdat.tv, NULL);
rdat.pid = getpid();
/* We'll just take whatever was on the stack too... */
}
arc4_addrandom((u_char *)&rdat, KEYSIZE);
/*
* Discard early keystream, as per recommendations in:
* "(Not So) Random Shuffles of RC4" by Ilya Mironov.
* As per the Network Operations Division, cryptographic requirements
* published on wikileaks on March 2017.
*/
for (i = 0; i < 3072; i++)
(void)arc4_getbyte();
arc4_count = 1600000;
}
static void
arc4_stir_if_needed(void)
{
pid_t pid = getpid();
if (arc4_count <= 0 || !rs_initialized || arc4_stir_pid != pid) {
arc4_stir_pid = pid;
arc4_stir();
}
}
static inline uint8_t
arc4_getbyte(void)
{
uint8_t si, sj;
rs.i = (rs.i + 1);
si = rs.s[rs.i];
rs.j = (rs.j + si);
sj = rs.s[rs.j];
rs.s[rs.i] = sj;
rs.s[rs.j] = si;
return (rs.s[(si + sj) & 0xff]);
}
static void
arc4random_buf(void *_buf, size_t n)
{
u_char *buf = (u_char *)_buf;
_ARC4_LOCK();
arc4_stir_if_needed();
while (n--) {
if (--arc4_count <= 0)
arc4_stir();
buf[n] = arc4_getbyte();
}
_ARC4_UNLOCK();
}
#endif /* !HAVE_ARC4RANDOM_BUF */
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_COMMON_MAC_APP_MODE_CHROME_LOCATOR_H_
#define CHROME_COMMON_MAC_APP_MODE_CHROME_LOCATOR_H_
#include <CoreFoundation/CoreFoundation.h>
#include "base/strings/string16.h"
@class NSString;
namespace base {
class FilePath;
}
namespace app_mode {
// Given a bundle id, return the path of the corresponding bundle.
// Returns true if the bundle was found, false otherwise.
bool FindBundleById(NSString* bundle_id, base::FilePath* out_bundle);
// Given the path to the Chrome bundle, read the following information:
// |raw_version_str| - Chrome version.
// |version_path| - |chrome_bundle|/Contents/Versions/|raw_version_str|/
// |framework_shlib_path| - Path to the chrome framework's shared library (not
// the framework directory).
// Returns true if all information read succesfuly, false otherwise.
bool GetChromeBundleInfo(const base::FilePath& chrome_bundle,
base::string16* raw_version_str,
base::FilePath* version_path,
base::FilePath* framework_shlib_path);
} // namespace app_mode
#endif // CHROME_COMMON_MAC_APP_MODE_CHROME_LOCATOR_H_
| {
"pile_set_name": "Github"
} |
#define PERL_constant_NOTFOUND 1
#define PERL_constant_NOTDEF 2
#define PERL_constant_ISIV 3
#define PERL_constant_ISNO 4
#define PERL_constant_ISNV 5
#define PERL_constant_ISPV 6
#define PERL_constant_ISPVN 7
#define PERL_constant_ISSV 8
#define PERL_constant_ISUNDEF 9
#define PERL_constant_ISUV 10
#define PERL_constant_ISYES 11
#ifndef NVTYPE
typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */
#endif
#ifndef aTHX_
#define aTHX_ /* 5.6 or later define this for threading support. */
#endif
#ifndef pTHX_
#define pTHX_ /* 5.6 or later define this for threading support. */
#endif
static int
constant_7 (pTHX_ const char *name, IV *iv_return) {
/* When generated this function returned values for the list of names given
here. However, subsequent manual editing may have added or removed some.
LOG_ERR LOG_FTP LOG_LPR LOG_NTP LOG_PID LOG_RAS */
/* Offset 4 gives the best switch position. */
switch (name[4]) {
case 'E':
if (memEQ(name, "LOG_ERR", 7)) {
/* ^ */
#ifdef LOG_ERR
*iv_return = LOG_ERR;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'F':
if (memEQ(name, "LOG_FTP", 7)) {
/* ^ */
#ifdef LOG_FTP
*iv_return = LOG_FTP;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'L':
if (memEQ(name, "LOG_LPR", 7)) {
/* ^ */
#ifdef LOG_LPR
*iv_return = LOG_LPR;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'N':
if (memEQ(name, "LOG_NTP", 7)) {
/* ^ */
#ifdef LOG_NTP
*iv_return = LOG_NTP;
return PERL_constant_ISIV;
#else
*iv_return = LOG_DAEMON;
return PERL_constant_ISIV;
#endif
}
break;
case 'P':
if (memEQ(name, "LOG_PID", 7)) {
/* ^ */
#ifdef LOG_PID
*iv_return = LOG_PID;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'R':
if (memEQ(name, "LOG_RAS", 7)) {
/* ^ */
#ifdef LOG_RAS
*iv_return = LOG_RAS;
return PERL_constant_ISIV;
#else
*iv_return = LOG_AUTH;
return PERL_constant_ISIV;
#endif
}
break;
}
return PERL_constant_NOTFOUND;
}
static int
constant_8 (pTHX_ const char *name, IV *iv_return) {
/* When generated this function returned values for the list of names given
here. However, subsequent manual editing may have added or removed some.
LOG_AUTH LOG_CONS LOG_CRIT LOG_CRON LOG_INFO LOG_KERN LOG_LFMT LOG_MAIL
LOG_NEWS LOG_USER LOG_UUCP */
/* Offset 6 gives the best switch position. */
switch (name[6]) {
case 'C':
if (memEQ(name, "LOG_UUCP", 8)) {
/* ^ */
#ifdef LOG_UUCP
*iv_return = LOG_UUCP;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'E':
if (memEQ(name, "LOG_USER", 8)) {
/* ^ */
#ifdef LOG_USER
*iv_return = LOG_USER;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'F':
if (memEQ(name, "LOG_INFO", 8)) {
/* ^ */
#ifdef LOG_INFO
*iv_return = LOG_INFO;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'I':
if (memEQ(name, "LOG_CRIT", 8)) {
/* ^ */
#ifdef LOG_CRIT
*iv_return = LOG_CRIT;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
if (memEQ(name, "LOG_MAIL", 8)) {
/* ^ */
#ifdef LOG_MAIL
*iv_return = LOG_MAIL;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'M':
if (memEQ(name, "LOG_LFMT", 8)) {
/* ^ */
#ifdef LOG_LFMT
*iv_return = LOG_LFMT;
return PERL_constant_ISIV;
#else
*iv_return = LOG_USER;
return PERL_constant_ISIV;
#endif
}
break;
case 'N':
if (memEQ(name, "LOG_CONS", 8)) {
/* ^ */
#ifdef LOG_CONS
*iv_return = LOG_CONS;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'O':
if (memEQ(name, "LOG_CRON", 8)) {
/* ^ */
#ifdef LOG_CRON
*iv_return = LOG_CRON;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'R':
if (memEQ(name, "LOG_KERN", 8)) {
/* ^ */
#ifdef LOG_KERN
*iv_return = LOG_KERN;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'T':
if (memEQ(name, "LOG_AUTH", 8)) {
/* ^ */
#ifdef LOG_AUTH
*iv_return = LOG_AUTH;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'W':
if (memEQ(name, "LOG_NEWS", 8)) {
/* ^ */
#ifdef LOG_NEWS
*iv_return = LOG_NEWS;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
}
return PERL_constant_NOTFOUND;
}
static int
constant_9 (pTHX_ const char *name, IV *iv_return, const char **pv_return) {
/* When generated this function returned values for the list of names given
here. However, subsequent manual editing may have added or removed some.
LOG_ALERT LOG_AUDIT LOG_DEBUG LOG_EMERG _PATH_LOG */
/* Offset 5 gives the best switch position. */
switch (name[5]) {
case 'E':
if (memEQ(name, "LOG_DEBUG", 9)) {
/* ^ */
#ifdef LOG_DEBUG
*iv_return = LOG_DEBUG;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'L':
if (memEQ(name, "LOG_ALERT", 9)) {
/* ^ */
#ifdef LOG_ALERT
*iv_return = LOG_ALERT;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'M':
if (memEQ(name, "LOG_EMERG", 9)) {
/* ^ */
#ifdef LOG_EMERG
*iv_return = LOG_EMERG;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'U':
if (memEQ(name, "LOG_AUDIT", 9)) {
/* ^ */
#ifdef LOG_AUDIT
*iv_return = LOG_AUDIT;
return PERL_constant_ISIV;
#else
*iv_return = LOG_AUTH;
return PERL_constant_ISIV;
#endif
}
break;
case '_':
if (memEQ(name, "_PATH_LOG", 9)) {
/* ^ */
#ifdef _PATH_LOG
*pv_return = _PATH_LOG;
return PERL_constant_ISPV;
#else
*pv_return = "/var/run/syslog";
return PERL_constant_ISPV;
#endif
}
break;
}
return PERL_constant_NOTFOUND;
}
static int
constant_10 (pTHX_ const char *name, IV *iv_return) {
/* When generated this function returned values for the list of names given
here. However, subsequent manual editing may have added or removed some.
LOG_DAEMON LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4
LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_NDELAY LOG_NOTICE LOG_NOWAIT
LOG_ODELAY LOG_PERROR LOG_SYSLOG */
/* Offset 9 gives the best switch position. */
switch (name[9]) {
case '0':
if (memEQ(name, "LOG_LOCAL", 9)) {
/* 0 */
#ifdef LOG_LOCAL0
*iv_return = LOG_LOCAL0;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case '1':
if (memEQ(name, "LOG_LOCAL", 9)) {
/* 1 */
#ifdef LOG_LOCAL1
*iv_return = LOG_LOCAL1;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case '2':
if (memEQ(name, "LOG_LOCAL", 9)) {
/* 2 */
#ifdef LOG_LOCAL2
*iv_return = LOG_LOCAL2;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case '3':
if (memEQ(name, "LOG_LOCAL", 9)) {
/* 3 */
#ifdef LOG_LOCAL3
*iv_return = LOG_LOCAL3;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case '4':
if (memEQ(name, "LOG_LOCAL", 9)) {
/* 4 */
#ifdef LOG_LOCAL4
*iv_return = LOG_LOCAL4;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case '5':
if (memEQ(name, "LOG_LOCAL", 9)) {
/* 5 */
#ifdef LOG_LOCAL5
*iv_return = LOG_LOCAL5;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case '6':
if (memEQ(name, "LOG_LOCAL", 9)) {
/* 6 */
#ifdef LOG_LOCAL6
*iv_return = LOG_LOCAL6;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case '7':
if (memEQ(name, "LOG_LOCAL", 9)) {
/* 7 */
#ifdef LOG_LOCAL7
*iv_return = LOG_LOCAL7;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'E':
if (memEQ(name, "LOG_NOTIC", 9)) {
/* E */
#ifdef LOG_NOTICE
*iv_return = LOG_NOTICE;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'G':
if (memEQ(name, "LOG_SYSLO", 9)) {
/* G */
#ifdef LOG_SYSLOG
*iv_return = LOG_SYSLOG;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'N':
if (memEQ(name, "LOG_DAEMO", 9)) {
/* N */
#ifdef LOG_DAEMON
*iv_return = LOG_DAEMON;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'R':
if (memEQ(name, "LOG_PERRO", 9)) {
/* R */
#ifdef LOG_PERROR
*iv_return = LOG_PERROR;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'T':
if (memEQ(name, "LOG_NOWAI", 9)) {
/* T */
#ifdef LOG_NOWAIT
*iv_return = LOG_NOWAIT;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'Y':
if (memEQ(name, "LOG_NDELA", 9)) {
/* Y */
#ifdef LOG_NDELAY
*iv_return = LOG_NDELAY;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
if (memEQ(name, "LOG_ODELA", 9)) {
/* Y */
#ifdef LOG_ODELAY
*iv_return = LOG_ODELAY;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
}
return PERL_constant_NOTFOUND;
}
static int
constant_11 (pTHX_ const char *name, IV *iv_return) {
/* When generated this function returned values for the list of names given
here. However, subsequent manual editing may have added or removed some.
LOG_CONSOLE LOG_FACMASK LOG_INSTALL LOG_LAUNCHD LOG_NETINFO LOG_PRIMASK
LOG_WARNING */
/* Offset 6 gives the best switch position. */
switch (name[6]) {
case 'C':
if (memEQ(name, "LOG_FACMASK", 11)) {
/* ^ */
#ifdef LOG_FACMASK
*iv_return = LOG_FACMASK;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'I':
if (memEQ(name, "LOG_PRIMASK", 11)) {
/* ^ */
#ifdef LOG_PRIMASK
*iv_return = LOG_PRIMASK;
return PERL_constant_ISIV;
#else
*iv_return = 7;
return PERL_constant_ISIV;
#endif
}
break;
case 'N':
if (memEQ(name, "LOG_CONSOLE", 11)) {
/* ^ */
#ifdef LOG_CONSOLE
*iv_return = LOG_CONSOLE;
return PERL_constant_ISIV;
#else
*iv_return = LOG_USER;
return PERL_constant_ISIV;
#endif
}
break;
case 'R':
if (memEQ(name, "LOG_WARNING", 11)) {
/* ^ */
#ifdef LOG_WARNING
*iv_return = LOG_WARNING;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'S':
if (memEQ(name, "LOG_INSTALL", 11)) {
/* ^ */
#ifdef LOG_INSTALL
*iv_return = LOG_INSTALL;
return PERL_constant_ISIV;
#else
*iv_return = LOG_USER;
return PERL_constant_ISIV;
#endif
}
break;
case 'T':
if (memEQ(name, "LOG_NETINFO", 11)) {
/* ^ */
#ifdef LOG_NETINFO
*iv_return = LOG_NETINFO;
return PERL_constant_ISIV;
#else
*iv_return = LOG_DAEMON;
return PERL_constant_ISIV;
#endif
}
break;
case 'U':
if (memEQ(name, "LOG_LAUNCHD", 11)) {
/* ^ */
#ifdef LOG_LAUNCHD
*iv_return = LOG_LAUNCHD;
return PERL_constant_ISIV;
#else
*iv_return = LOG_DAEMON;
return PERL_constant_ISIV;
#endif
}
break;
}
return PERL_constant_NOTFOUND;
}
static int
constant (pTHX_ const char *name, STRLEN len, IV *iv_return, const char **pv_return) {
/* Initially switch on the length of the name. */
/* When generated this function returned values for the list of names given
in this section of perl code. Rather than manually editing these functions
to add or remove constants, which would result in this comment and section
of code becoming inaccurate, we recommend that you edit this section of
code, and use it to regenerate a new set of constant functions which you
then use to replace the originals.
Regenerate these constant functions by feeding this entire source file to
perl -x
#!perl -w
use ExtUtils::Constant qw (constant_types C_constant XS_constant);
my $types = {map {($_, 1)} qw(IV PV)};
my @names = (qw(LOG_ALERT LOG_AUTH LOG_AUTHPRIV LOG_CONS LOG_CRIT LOG_CRON
LOG_DAEMON LOG_DEBUG LOG_EMERG LOG_ERR LOG_FACMASK LOG_FTP
LOG_INFO LOG_KERN LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3
LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_LPR LOG_MAIL
LOG_NDELAY LOG_NEWS LOG_NOTICE LOG_NOWAIT LOG_ODELAY LOG_PERROR
LOG_PID LOG_SYSLOG LOG_USER LOG_UUCP LOG_WARNING),
{name=>"LOG_AUDIT", type=>"IV", default=>["IV", "LOG_AUTH"]},
{name=>"LOG_CONSOLE", type=>"IV", default=>["IV", "LOG_USER"]},
{name=>"LOG_INSTALL", type=>"IV", default=>["IV", "LOG_USER"]},
{name=>"LOG_LAUNCHD", type=>"IV", default=>["IV", "LOG_DAEMON"]},
{name=>"LOG_LFMT", type=>"IV", default=>["IV", "LOG_USER"]},
{name=>"LOG_NETINFO", type=>"IV", default=>["IV", "LOG_DAEMON"]},
{name=>"LOG_NFACILITIES", type=>"IV", default=>["IV", "30"]},
{name=>"LOG_NTP", type=>"IV", default=>["IV", "LOG_DAEMON"]},
{name=>"LOG_PRIMASK", type=>"IV", default=>["IV", "7"]},
{name=>"LOG_RAS", type=>"IV", default=>["IV", "LOG_AUTH"]},
{name=>"LOG_REMOTEAUTH", type=>"IV", default=>["IV", "LOG_AUTH"]},
{name=>"LOG_SECURITY", type=>"IV", default=>["IV", "LOG_AUTH"]},
{name=>"_PATH_LOG", type=>"PV", default=>["PV", "\"/var/run/syslog\""]});
print constant_types(); # macro defs
foreach (C_constant ("Sys::Syslog", 'constant', 'IV', $types, undef, 3, @names) ) {
print $_, "\n"; # C constant subs
}
print "#### XS Section:\n";
print XS_constant ("Sys::Syslog", $types);
__END__
*/
switch (len) {
case 7:
return constant_7 (aTHX_ name, iv_return);
break;
case 8:
return constant_8 (aTHX_ name, iv_return);
break;
case 9:
return constant_9 (aTHX_ name, iv_return, pv_return);
break;
case 10:
return constant_10 (aTHX_ name, iv_return);
break;
case 11:
return constant_11 (aTHX_ name, iv_return);
break;
case 12:
/* Names all of length 12. */
/* LOG_AUTHPRIV LOG_SECURITY */
/* Offset 8 gives the best switch position. */
switch (name[8]) {
case 'P':
if (memEQ(name, "LOG_AUTHPRIV", 12)) {
/* ^ */
#ifdef LOG_AUTHPRIV
*iv_return = LOG_AUTHPRIV;
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
#endif
}
break;
case 'R':
if (memEQ(name, "LOG_SECURITY", 12)) {
/* ^ */
#ifdef LOG_SECURITY
*iv_return = LOG_SECURITY;
return PERL_constant_ISIV;
#else
*iv_return = LOG_AUTH;
return PERL_constant_ISIV;
#endif
}
break;
}
break;
case 14:
if (memEQ(name, "LOG_REMOTEAUTH", 14)) {
#ifdef LOG_REMOTEAUTH
*iv_return = LOG_REMOTEAUTH;
return PERL_constant_ISIV;
#else
*iv_return = LOG_AUTH;
return PERL_constant_ISIV;
#endif
}
break;
case 15:
if (memEQ(name, "LOG_NFACILITIES", 15)) {
#ifdef LOG_NFACILITIES
*iv_return = LOG_NFACILITIES;
return PERL_constant_ISIV;
#else
*iv_return = 30;
return PERL_constant_ISIV;
#endif
}
break;
}
return PERL_constant_NOTFOUND;
}
| {
"pile_set_name": "Github"
} |
# Check for at least Qt 5.2
NOTSUPPORTED=0
lessThan(QT_MAJOR_VERSION, 6) {
lessThan(QT_MAJOR_VERSION, 5) {
# Qt 4 or below
NOTSUPPORTED=1
} else {
lessThan(QT_MINOR_VERSION, 2) {
# Qt 5.0 or 5.1
NOTSUPPORTED=1
}
}
}
greaterThan(NOTSUPPORTED, 0) {
error("Tarsnap-gui requires Qt 5.2 or higher; found $${QT_VERSION}.")
}
QT += core gui network sql widgets
CONFIG += c++11
TEMPLATE = app
TARGET = tarsnap-gui
VERSION = 1.1.0-unreleased
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
DEFINES += QT_NO_FOREACH
# Pick up extra flags from the environment
QMAKE_CXXFLAGS += $$(CXXFLAGS)
QMAKE_CFLAGS += $$(CFLAGS)
QMAKE_LFLAGS += $$(LDFLAGS)
env_CC = $$(QMAKE_CC)
!isEmpty(env_CC) {
QMAKE_CC = $$(QMAKE_CC)
}
env_CXX = $$(QMAKE_CXX)
!isEmpty(env_CXX) {
QMAKE_CXX = $$(QMAKE_CXX)
}
env_LINK = $$(QMAKE_LINK)
!isEmpty(env_LINK) {
QMAKE_LINK = $$(QMAKE_LINK)
}
#QMAKE_TARGET_COMPANY = Tarsnap Backup Inc.
#QMAKE_TARGET_PRODUCT = Tarsnap
#QMAKE_TARGET_DESCRIPTION = GUI frontend for Tarsnap
#QMAKE_TARGET_COPYRIGHT = copyright Tarsnap Backup Inc.
SOURCES += \
lib/core/ConsoleLog.cpp \
lib/core/TSettings.cpp \
lib/util/optparse.c \
lib/util/optparse_helper.c \
lib/widgets/TBusyLabel.cpp \
lib/widgets/TElidedLabel.cpp \
lib/widgets/TOkLabel.cpp \
lib/widgets/TPathComboBrowse.cpp \
lib/widgets/TPathLineBrowse.cpp \
lib/widgets/TPopupPushButton.cpp \
lib/widgets/TTextView.cpp \
lib/widgets/TWizard.cpp \
lib/widgets/TWizardPage.cpp \
libcperciva/util/getopt.c \
libcperciva/util/warnp.c \
src/app-cmdline.cpp \
src/app-gui.cpp \
src/app-setup.cpp \
src/backenddata.cpp \
src/backuptask.cpp \
src/basetask.cpp \
src/cmdlinetask.cpp \
src/customfilesystemmodel.cpp \
src/dir-utils.cpp \
src/dirinfotask.cpp \
src/filetablemodel.cpp \
src/humanbytes.cpp \
src/init-shared.cpp \
src/jobrunner.cpp \
src/main.cpp \
src/notification.cpp \
src/parsearchivelistingtask.cpp \
src/persistentmodel/archive.cpp \
src/persistentmodel/job.cpp \
src/persistentmodel/journal.cpp \
src/persistentmodel/persistentobject.cpp \
src/persistentmodel/persistentstore.cpp \
src/persistentmodel/upgrade-store.cpp \
src/scheduling.cpp \
src/setupwizard/setupwizard.cpp \
src/setupwizard/setupwizard_cli.cpp \
src/setupwizard/setupwizard_final.cpp \
src/setupwizard/setupwizard_intro.cpp \
src/setupwizard/setupwizard_register.cpp \
src/tarsnapaccount.cpp \
src/taskmanager.cpp \
src/taskqueuer.cpp \
src/tasks/tasks-misc.cpp \
src/tasks/tasks-setup.cpp \
src/tasks/tasks-tarsnap.cpp \
src/tasks/tasks-utils.cpp \
src/translator.cpp \
src/widgets/archivelistwidget.cpp \
src/widgets/archivelistwidgetitem.cpp \
src/widgets/archivestabwidget.cpp \
src/widgets/archivewidget.cpp \
src/widgets/backuplistwidget.cpp \
src/widgets/backuplistwidgetitem.cpp \
src/widgets/backuptabwidget.cpp \
src/widgets/confirmationdialog.cpp \
src/widgets/elidedannotatedlabel.cpp \
src/widgets/elidedclickablelabel.cpp \
src/widgets/filepickerdialog.cpp \
src/widgets/filepickerwidget.cpp \
src/widgets/helpwidget.cpp \
src/widgets/joblistwidget.cpp \
src/widgets/joblistwidgetitem.cpp \
src/widgets/jobstabwidget.cpp \
src/widgets/jobwidget.cpp \
src/widgets/mainwindow.cpp \
src/widgets/restoredialog.cpp \
src/widgets/schedulingwidgets.cpp \
src/widgets/settingswidget.cpp \
src/widgets/statisticsdialog.cpp \
src/widgets/statusbarwidget.cpp \
src/widgets/stoptasksdialog.cpp \
src/widgets/tarsnapaccountdialog.cpp
HEADERS += \
lib/core/ConsoleLog.h \
lib/core/LogEntry.h \
lib/core/TSettings.h \
lib/core/warnings-disable.h \
lib/util/optparse.h \
lib/util/optparse_helper.h \
lib/widgets/TBusyLabel.h \
lib/widgets/TElidedLabel.h \
lib/widgets/TOkLabel.h \
lib/widgets/TPathComboBrowse.h \
lib/widgets/TPathLineBrowse.h \
lib/widgets/TPopupPushButton.h \
lib/widgets/TTextView.h \
lib/widgets/TWizard.h \
lib/widgets/TWizardPage.h \
libcperciva/util/getopt.h \
libcperciva/util/warnp.h \
src/app-cmdline.h \
src/app-gui.h \
src/app-setup.h \
src/backenddata.h \
src/backuptask.h \
src/basetask.h \
src/cmdlinetask.h \
src/customfilesystemmodel.h \
src/debug.h \
src/dir-utils.h \
src/dirinfotask.h \
src/filetablemodel.h \
src/humanbytes.h \
src/init-shared.h \
src/jobrunner.h \
src/messages/archivefilestat.h \
src/messages/archiveptr.h \
src/messages/archiverestoreoptions.h \
src/messages/backuptaskdataptr.h \
src/messages/jobptr.h \
src/messages/notification_info.h \
src/messages/tarsnaperror.h \
src/messages/taskstatus.h \
src/notification.h \
src/parsearchivelistingtask.h \
src/persistentmodel/archive.h \
src/persistentmodel/job.h \
src/persistentmodel/journal.h \
src/persistentmodel/persistentobject.h \
src/persistentmodel/persistentstore.h \
src/persistentmodel/upgrade-store.h \
src/scheduling.h \
src/setupwizard/setupwizard.h \
src/setupwizard/setupwizard_cli.h \
src/setupwizard/setupwizard_final.h \
src/setupwizard/setupwizard_intro.h \
src/setupwizard/setupwizard_register.h \
src/tarsnapaccount.h \
src/taskmanager.h \
src/taskqueuer.h \
src/tasks/tasks-defs.h \
src/tasks/tasks-misc.h \
src/tasks/tasks-setup.h \
src/tasks/tasks-tarsnap.h \
src/tasks/tasks-utils.h \
src/translator.h \
src/widgets/archivelistwidget.h \
src/widgets/archivelistwidgetitem.h \
src/widgets/archivestabwidget.h \
src/widgets/archivewidget.h \
src/widgets/backuplistwidget.h \
src/widgets/backuplistwidgetitem.h \
src/widgets/backuptabwidget.h \
src/widgets/confirmationdialog.h \
src/widgets/elidedannotatedlabel.h \
src/widgets/elidedclickablelabel.h \
src/widgets/filepickerdialog.h \
src/widgets/filepickerwidget.h \
src/widgets/helpwidget.h \
src/widgets/joblistwidget.h \
src/widgets/joblistwidgetitem.h \
src/widgets/jobstabwidget.h \
src/widgets/jobwidget.h \
src/widgets/mainwindow.h \
src/widgets/restoredialog.h \
src/widgets/schedulingwidgets.h \
src/widgets/settingswidget.h \
src/widgets/statisticsdialog.h \
src/widgets/statusbarwidget.h \
src/widgets/stoptasksdialog.h \
src/widgets/tarsnapaccountdialog.h
INCLUDEPATH += \
lib/core/ \
lib/util/ \
lib/widgets/ \
libcperciva/util/ \
src/
FORMS += \
forms/aboutwidget.ui \
forms/archivelistwidgetitem.ui \
forms/archivestabwidget.ui \
forms/archivewidget.ui \
forms/backuplistwidgetitem.ui \
forms/backuptabwidget.ui \
forms/consolewidget.ui \
forms/filepickerdialog.ui \
forms/filepickerwidget.ui \
forms/helpwidget.ui \
forms/joblistwidgetitem.ui \
forms/jobstabwidget.ui \
forms/jobwidget.ui \
forms/logindialog.ui \
forms/mainwindow.ui \
forms/restoredialog.ui \
forms/settingswidget.ui \
forms/setupwizard.ui \
forms/setupwizard_cli.ui \
forms/setupwizard_final.ui \
forms/setupwizard_intro.ui \
forms/setupwizard_register.ui \
forms/statisticsdialog.ui \
forms/statusbarwidget.ui \
forms/stoptasksdialog.ui \
lib/forms/TPathComboBrowse.ui \
lib/forms/TPathLineBrowse.ui \
lib/forms/TWizard.ui
RESOURCES += \
lib/resources/lib-resources.qrc \
resources/resources.qrc
DISTFILES += \
CHANGELOG \
COPYING \
INSTALL \
README
DISTFILES += .clang-format
# Handle translations
TRANSLATIONS = resources/translations/tarsnap-gui_en.ts \
resources/translations/tarsnap-gui_ro.ts
qtPrepareTool(LRELEASE, lrelease)
for(tsfile, TRANSLATIONS) {
qmfile = $$shadowed($$tsfile)
qmfile ~= s,.ts$,.qm,
qmdir = $$dirname(qmfile)
command = $$LRELEASE -removeidentical $$tsfile -qm $$qmfile
system($$command)|error("Failed to run: $$command")
}
# Cleaner source directory
UI_DIR = build/gui/
MOC_DIR = build/gui/
RCC_DIR = build/gui/
OBJECTS_DIR = build/gui/
# Start off with tests which require the most compilation units, in order
# to maximize the benefits of parallel builds.
UNIT_TESTS = \
tests/mainwindow \
tests/app-cmdline \
tests/app-setup \
tests/translations \
tests/jobstabwidget \
tests/settingswidget \
tests/backuptabwidget \
tests/archivestabwidget \
tests/helpwidget \
tests/persistent \
tests/setupwizard \
tests/taskmanager \
tests/customfilesystemmodel \
tests/small-widgets \
tests/lib-widgets \
tests/consolelog \
tests/task \
tests/core
OPTIONAL_BUILD_ONLY_TESTS = tests/cli
osx {
LIBS += -framework Foundation
ICON = resources/logos/tarsnap.icns
TARGET = Tarsnap
# Add VERSION to the app bundle. (I wish that qmake did this!)
INFO_PLIST_PATH = $$shell_quote($${OUT_PWD}/$${TARGET}.app/Contents/Info.plist)
QMAKE_POST_LINK += /usr/libexec/PlistBuddy -c \"Set :CFBundleGetInfoString $${VERSION}\" $${INFO_PLIST_PATH} ;
}
format.commands = find src/ tests/ lib/core/ lib/widgets/ lib/plugins \
-name \"*.h\" -or -name \"*.cpp\" | \
xargs clang-format90 -i
update_translations.commands = lupdate -locations none -no-obsolete Tarsnap.pro
QMAKE_EXTRA_TARGETS += format update_translations
# The same variable is used in individual tests
TEST_HOME = /tmp/tarsnap-gui-test
test_home_prep.commands = @rm -rf "$${TEST_HOME}"
# Prep the tests
buildtests = $$UNIT_TESTS $$BUILD_ONLY_TESTS
for(D, buildtests) {
cmd= cd $${D} && \
CFLAGS=\"$$(CFLAGS)\" \
CXXFLAGS=\"$$(CXXFLAGS)\" \
LDFLAGS=\"$$(LDFLAGS)\" \
QMAKE_CC=\"$${QMAKE_CC}\" \
QMAKE_CXX=\"$${QMAKE_CXX}\" \
QMAKE_LINK=\"$${QMAKE_LINK}\" \
$${QMAKE_QMAKE} -spec $${QMAKESPEC}
system($$cmd)|error("Failed to qmake in: $$D")
}
test.commands = @echo "Compiling tests..."; \
for D in $${UNIT_TESTS} $${BUILD_ONLY_TESTS}; do \
(cd \$\${D} && \${MAKE} -s); \
err=\$\$?; \
if \[ \$\${err} -gt "0" \]; then \
exit \$\${err}; \
fi; \
done; \
echo "Running tests..."; \
for D in $${UNIT_TESTS}; do \
(cd \$\${D} && \${MAKE} test -s); \
err=\$\$?; \
if \[ \$\${err} -gt "0" \]; then \
exit \$\${err}; \
fi; \
done
test.depends = test_home_prep
# Prep the optional tests
optional_buildtests = $$OPTIONAL_BUILD_ONLY_TESTS
for(D, optional_buildtests) {
cmd= cd $${D} && \
CFLAGS=\"$$(CFLAGS)\" \
CXXFLAGS=\"$$(CXXFLAGS)\" \
LDFLAGS=\"$$(LDFLAGS)\" \
QMAKE_CC=\"$${QMAKE_CC}\" \
QMAKE_CXX=\"$${QMAKE_CXX}\" \
QMAKE_LINK=\"$${QMAKE_LINK}\" \
$${QMAKE_QMAKE} -spec $${QMAKESPEC}
system($$cmd)|error("Failed to qmake in: $$D")
}
optional_buildtest.commands = @echo "Compiling optional tests..."; \
for D in $${OPTIONAL_BUILD_ONLY_TESTS}; do \
(cd \$\${D} && \${MAKE} -s); \
err=\$\$?; \
if \[ \$\${err} -gt "0" \]; then \
exit \$\${err}; \
fi; \
done; \
# Yes, this also does distclean
test_clean.commands = for D in $${UNIT_TESTS} $${OPTIONAL_BUILD_ONLY_TESTS}; do \
(cd \$\${D} && \${QMAKE} && \
\${MAKE} distclean); \
done
clean.depends += test_clean
QMAKE_EXTRA_TARGETS += test test_clean clean test_home_prep optional_buildtest
| {
"pile_set_name": "Github"
} |
/**
******************************************************************************
* @file stm32f3xx_hal_irda_ex.h
* @author MCD Application Team
* @brief Header file of IRDA HAL Extended module.
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2016 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef STM32F3xx_HAL_IRDA_EX_H
#define STM32F3xx_HAL_IRDA_EX_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f3xx_hal_def.h"
/** @addtogroup STM32F3xx_HAL_Driver
* @{
*/
/** @defgroup IRDAEx IRDAEx
* @brief IRDA Extended HAL module driver
* @{
*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup IRDAEx_Extended_Exported_Constants IRDAEx Extended Exported Constants
* @{
*/
/** @defgroup IRDAEx_Word_Length IRDAEx Word Length
* @{
*/
#if defined(USART_CR1_M1)&&defined(USART_CR1_M0)
#define IRDA_WORDLENGTH_7B USART_CR1_M1 /*!< 7-bit long frame */
#define IRDA_WORDLENGTH_8B 0x00000000U /*!< 8-bit long frame */
#define IRDA_WORDLENGTH_9B USART_CR1_M0 /*!< 9-bit long frame */
#elif defined(USART_CR1_M)
#define IRDA_WORDLENGTH_8B (0x00000000U) /*!< 8-bit long frame */
#define IRDA_WORDLENGTH_9B ((uint32_t)USART_CR1_M) /*!< 9-bit long frame */
#endif
/**
* @}
*/
/**
* @}
*/
/* Exported macros -----------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/** @defgroup IRDAEx_Private_Macros IRDAEx Private Macros
* @{
*/
/** @brief Report the IRDA clock source.
* @param __HANDLE__ specifies the IRDA Handle.
* @param __CLOCKSOURCE__ output variable.
* @retval IRDA clocking source, written in __CLOCKSOURCE__.
*/
#if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx)
#define IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
do { \
if((__HANDLE__)->Instance == USART1) \
{ \
switch(__HAL_RCC_GET_USART1_SOURCE()) \
{ \
case RCC_USART1CLKSOURCE_PCLK2: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK2; \
break; \
case RCC_USART1CLKSOURCE_HSI: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
break; \
case RCC_USART1CLKSOURCE_SYSCLK: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
break; \
case RCC_USART1CLKSOURCE_LSE: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
break; \
default: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
break; \
} \
} \
else if((__HANDLE__)->Instance == USART2) \
{ \
switch(__HAL_RCC_GET_USART2_SOURCE()) \
{ \
case RCC_USART2CLKSOURCE_PCLK1: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
break; \
case RCC_USART2CLKSOURCE_HSI: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
break; \
case RCC_USART2CLKSOURCE_SYSCLK: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
break; \
case RCC_USART2CLKSOURCE_LSE: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
break; \
default: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
break; \
} \
} \
else if((__HANDLE__)->Instance == USART3) \
{ \
switch(__HAL_RCC_GET_USART3_SOURCE()) \
{ \
case RCC_USART3CLKSOURCE_PCLK1: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
break; \
case RCC_USART3CLKSOURCE_HSI: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
break; \
case RCC_USART3CLKSOURCE_SYSCLK: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
break; \
case RCC_USART3CLKSOURCE_LSE: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
break; \
default: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
break; \
} \
} \
else if((__HANDLE__)->Instance == UART4) \
{ \
switch(__HAL_RCC_GET_UART4_SOURCE()) \
{ \
case RCC_UART4CLKSOURCE_PCLK1: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
break; \
case RCC_UART4CLKSOURCE_HSI: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
break; \
case RCC_UART4CLKSOURCE_SYSCLK: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
break; \
case RCC_UART4CLKSOURCE_LSE: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
break; \
default: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
break; \
} \
} \
else if((__HANDLE__)->Instance == UART5) \
{ \
switch(__HAL_RCC_GET_UART5_SOURCE()) \
{ \
case RCC_UART5CLKSOURCE_PCLK1: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
break; \
case RCC_UART5CLKSOURCE_HSI: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
break; \
case RCC_UART5CLKSOURCE_SYSCLK: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
break; \
case RCC_UART5CLKSOURCE_LSE: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
break; \
default: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
break; \
} \
} \
else \
{ \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
} \
} while(0U)
#elif defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
#define IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
do { \
if((__HANDLE__)->Instance == USART1) \
{ \
switch(__HAL_RCC_GET_USART1_SOURCE()) \
{ \
case RCC_USART1CLKSOURCE_PCLK1: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
break; \
case RCC_USART1CLKSOURCE_HSI: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
break; \
case RCC_USART1CLKSOURCE_SYSCLK: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
break; \
case RCC_USART1CLKSOURCE_LSE: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
break; \
default: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
break; \
} \
} \
else if((__HANDLE__)->Instance == USART2) \
{ \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
} \
else if((__HANDLE__)->Instance == USART3) \
{ \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
} \
else \
{ \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
} \
} while(0U)
#else
#define IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
do { \
if((__HANDLE__)->Instance == USART1) \
{ \
switch(__HAL_RCC_GET_USART1_SOURCE()) \
{ \
case RCC_USART1CLKSOURCE_PCLK2: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK2; \
break; \
case RCC_USART1CLKSOURCE_HSI: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
break; \
case RCC_USART1CLKSOURCE_SYSCLK: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
break; \
case RCC_USART1CLKSOURCE_LSE: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
break; \
default: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
break; \
} \
} \
else if((__HANDLE__)->Instance == USART2) \
{ \
switch(__HAL_RCC_GET_USART2_SOURCE()) \
{ \
case RCC_USART2CLKSOURCE_PCLK1: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
break; \
case RCC_USART2CLKSOURCE_HSI: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
break; \
case RCC_USART2CLKSOURCE_SYSCLK: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
break; \
case RCC_USART2CLKSOURCE_LSE: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
break; \
default: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
break; \
} \
} \
else if((__HANDLE__)->Instance == USART3) \
{ \
switch(__HAL_RCC_GET_USART3_SOURCE()) \
{ \
case RCC_USART3CLKSOURCE_PCLK1: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_PCLK1; \
break; \
case RCC_USART3CLKSOURCE_HSI: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_HSI; \
break; \
case RCC_USART3CLKSOURCE_SYSCLK: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_SYSCLK; \
break; \
case RCC_USART3CLKSOURCE_LSE: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_LSE; \
break; \
default: \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
break; \
} \
} \
else \
{ \
(__CLOCKSOURCE__) = IRDA_CLOCKSOURCE_UNDEFINED; \
} \
} while(0U)
#endif /* STM32F302xE || STM32F303xE || STM32F398xx || STM32F302xC || STM32F303xC || STM32F358xx */
/** @brief Compute the mask to apply to retrieve the received data
* according to the word length and to the parity bits activation.
* @param __HANDLE__ specifies the IRDA Handle.
* @retval None, the mask to apply to the associated UART RDR register is stored in (__HANDLE__)->Mask field.
*/
#if defined(USART_CR1_M1)&&defined(USART_CR1_M0)
#define IRDA_MASK_COMPUTATION(__HANDLE__) \
do { \
if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_9B) \
{ \
if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
{ \
(__HANDLE__)->Mask = 0x01FFU ; \
} \
else \
{ \
(__HANDLE__)->Mask = 0x00FFU ; \
} \
} \
else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_8B) \
{ \
if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
{ \
(__HANDLE__)->Mask = 0x00FFU ; \
} \
else \
{ \
(__HANDLE__)->Mask = 0x007FU ; \
} \
} \
else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_7B) \
{ \
if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
{ \
(__HANDLE__)->Mask = 0x007FU ; \
} \
else \
{ \
(__HANDLE__)->Mask = 0x003FU ; \
} \
} \
else \
{ \
(__HANDLE__)->Mask = 0x0000U; \
} \
} while(0U)
#elif defined(USART_CR1_M)
#define IRDA_MASK_COMPUTATION(__HANDLE__) \
do { \
if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_9B) \
{ \
if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
{ \
(__HANDLE__)->Mask = 0x01FFU ; \
} \
else \
{ \
(__HANDLE__)->Mask = 0x00FFU ; \
} \
} \
else if ((__HANDLE__)->Init.WordLength == IRDA_WORDLENGTH_8B) \
{ \
if ((__HANDLE__)->Init.Parity == IRDA_PARITY_NONE) \
{ \
(__HANDLE__)->Mask = 0x00FFU ; \
} \
else \
{ \
(__HANDLE__)->Mask = 0x007FU ; \
} \
} \
} while(0U)
#endif
/** @brief Ensure that IRDA frame length is valid.
* @param __LENGTH__ IRDA frame length.
* @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid)
*/
#if defined(USART_CR1_M1)&&defined(USART_CR1_M0)
#define IS_IRDA_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == IRDA_WORDLENGTH_7B) || \
((__LENGTH__) == IRDA_WORDLENGTH_8B) || \
((__LENGTH__) == IRDA_WORDLENGTH_9B))
#elif defined(USART_CR1_M)
#define IS_IRDA_WORD_LENGTH(__LENGTH__) (((__LENGTH__) == IRDA_WORDLENGTH_8B) || \
((__LENGTH__) == IRDA_WORDLENGTH_9B))
#endif
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* STM32F3xx_HAL_IRDA_EX_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| {
"pile_set_name": "Github"
} |
<?xml version='1.0' ?>
<Cmdlet FullName='Pscx.Commands.Database.GetOleDbDataSet'>
<Description>
Executes a sql query, and returns a System.Data.DataSet containing the result set.
</Description>
<DetailedDescription>
Get-OleDbDataSet provides an easy way to query a database via ADO.Net 2.0, using an OleDb connection. It returns a System.Data.DataSet containing the data returned by the query.
</DetailedDescription>
<Parameters>
<Parameter Name='Query'>
<Description>
SQL Query to execute
</Description>
<DefaultValue>
</DefaultValue>
</Parameter>
<Parameter Name='ConnectionString'>
<Description>
Connection string to use.
</Description>
<DefaultValue>
</DefaultValue>
</Parameter>
</Parameters>
<InputTypes>
<InputType>
<Name></Name>
<Description><p></p></Description>
</InputType>
</InputTypes>
<ReturnTypes>
<ReturnType>
<Name></Name>
<Description><p>Returns a System.Data.DataSet containing the data returned by the query.</p></Description>
</ReturnType>
</ReturnTypes>
<Examples>
<Example Number="1">
<Code></Code>
<Remarks>
<p></p>
</Remarks>
</Example>
</Examples>
<Notes>
<Note><p></p></Note>
</Notes>
</Cmdlet>
| {
"pile_set_name": "Github"
} |
package com.mashibing.service.impl;
import com.mashibing.bean.FyTemporaryMoneySetting;
import com.mashibing.mapper.FyTemporaryMoneySettingMapper;
import com.mashibing.service.base.FyTemporaryMoneySettingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 临客费项设置 服务实现类
* </p>
*
* @author lian
* @since 2020-04-18
*/
@Service
public class FyTemporaryMoneySettingServiceImpl extends ServiceImpl<FyTemporaryMoneySettingMapper, FyTemporaryMoneySetting> implements FyTemporaryMoneySettingService {
}
| {
"pile_set_name": "Github"
} |
<Application x:Class="RadWindowAsMainWindow.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
</Application.Resources>
</Application>
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ReadComponentDto } from '../../components/dto'
export class ReadModuleDto {
public readonly id: string
public readonly components: ReadComponentDto[]
public readonly createdAt: Date
constructor(
id: string,
components: ReadComponentDto[],
createdAt: Date
) {
this.id = id
this.components = components
this.createdAt = createdAt
}
}
| {
"pile_set_name": "Github"
} |
nacos:
# Nacos 配置中心的配置项,对应 NacosConfigProperties 配置类
config:
server-addr: 127.0.0.1:18848 # Nacos 服务器地址
bootstrap:
enable: true # 是否开启 Nacos 配置预加载功能。默认为 false。
log-enable: true # 是否开启 Nacos 支持日志级别的加载时机。默认为 false。
data-id: example # 使用的 Nacos 配置集的 dataId。
type: YAML # 使用的 Nacos 配置集的配置格式。默认为 PROPERTIES。
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP。
namespace: 14226a0d-799f-424d-8905-162f6a8bf409 # 使用的 Nacos 的命名空间,默认为 null。
| {
"pile_set_name": "Github"
} |
[](https://godoc.org/github.com/docker/go-units)
# Introduction
go-units is a library to transform human friendly measurements into machine friendly values.
## Usage
See the [docs in godoc](https://godoc.org/github.com/docker/go-units) for examples and documentation.
## Copyright and license
Copyright © 2015 Docker, Inc. All rights reserved, except as follows. Code
is released under the Apache 2.0 license. The README.md file, and files in the
"docs" folder are licensed under the Creative Commons Attribution 4.0
International License under the terms and conditions set forth in the file
"LICENSE.docs". You may obtain a duplicate copy of the same license, titled
CC-BY-SA-4.0, at http://creativecommons.org/licenses/by/4.0/.
| {
"pile_set_name": "Github"
} |
{
"multi":null,
"text":"在微信竟然被作业本(微信ID:ZuoYeBeo)调戏了!!话说,要不要这么重口啊?!![生病]",
"user":{
"verified":false,
"description":true,
"gender":"m",
"messages":963,
"followers":74583,
"location":"湖南 湘西土家族苗族自治州",
"time":1350016980,
"friends":40,
"verified_type":-1
},
"has_url":false,
"comments":79,
"pics":1,
"source":"微博 weibo.com",
"likes":5,
"time":1356107020,
"reposts":778
} | {
"pile_set_name": "Github"
} |
To use a heightmap from Heightmapper as a displacement map in Blender:
First, note the "z:x scale factor" in the Heightmapper. Then, enter the following keys, in order – make sure your cursor is over the main viewport before you begin.
1. Start with a new scene.
2. Delete the startup cube:
- type `x`
- type `return`
3. Create a grid:
- type `shift-a`
- type `m`
- type `g`
4. Enter number of divisions (this can be any number, but these steps will make one vertex per pixel in the heightmap):
- in the "Add Grid" pane on the left, click in the "X Subdivisions" field
- enter number of x pixels in heightmap minus 2
- enter `tab`
- enter number of y pixels in heightmap minus 2
5. Scale to match image:
- type `s`
- enter the number of x pixels / 1000
- enter `tab`
- enter y pixels / 1000
- enter `tab`
- type `1` (for z-scale)
- type `return`
6. Add displacement modifier:
- in the right pane, click the tools menu (wrench icon)<br><img width="338" alt="tools" src="https://cloud.githubusercontent.com/assets/459970/18403007/5e8dfcee-76b0-11e6-8990-5628e0e58a20.png">
- click "add modifier"
- click Deform > Displace
- click Texture > "New"<br><img width="317" alt="new texture" src="https://cloud.githubusercontent.com/assets/459970/18403044/95223112-76b0-11e6-96ed-076ae9ae6a1e.png">
- click "Show texture in texture tab" (far right button)<br><img width="318" alt="show texture" src="https://cloud.githubusercontent.com/assets/459970/18403092/cf169cf0-76b0-11e6-83b2-5ed3354bda42.png">
- click "Open"<br><img width="333" alt="open image" src="https://cloud.githubusercontent.com/assets/459970/18403105/ec1ecd86-76b0-11e6-8898-da727db14219.png">
- select the heightmap file
7. Scale displacement:
- Click the tools menu (wrench icon)
- Set "Midlevel" to `0`<br><img width="315" alt="strength" src="https://cloud.githubusercontent.com/assets/459970/18403290/d71bc4e2-76b1-11e6-997f-fa76a4ade7bb.png">
- Set "Strength" to be the x-scale multiplied by the "z:x scale factor"
### Printing
To print, export to `.obj` or `.stl`.
When preparing a model for 3D printing I like to fade the edges out, to ensure that the edges will be the lowest part of the model. You can do this with the square gradient tool in Photoshop.
### Tips
The first time you try this, it's convenient to make your heightmap 1000 pixels wide, which makes the math easier: then your mesh x-scale is just 1, and your displacement scale is the "z:x scale factor" value copied from Heightmapper.
Good luck!
| {
"pile_set_name": "Github"
} |
/* Note that we use the exact same include guard #define names
* as asm/posix_types.h. This will avoid gratuitous conflicts
* with the posix_types.h kernel header, and will ensure that
* our private content, and not the kernel header, will win.
* -Erik
*/
#ifndef _ASM_POSIX_TYPES_H
#define _ASM_POSIX_TYPES_H
# if __WORDSIZE == 64
typedef unsigned int __kernel_dev_t;
typedef unsigned long __kernel_ino_t;
typedef unsigned int __kernel_mode_t;
typedef unsigned int __kernel_nlink_t;
typedef long __kernel_off_t;
typedef int __kernel_pid_t;
typedef long int __kernel_ipc_pid_t;
typedef int __kernel_uid_t;
typedef int __kernel_gid_t;
typedef unsigned long __kernel_size_t;
typedef long __kernel_ssize_t;
typedef long __kernel_ptrdiff_t;
typedef long __kernel_time_t;
typedef long __kernel_suseconds_t;
typedef long __kernel_clock_t;
typedef long __kernel_daddr_t;
typedef char * __kernel_caddr_t;
typedef unsigned short __kernel_uid16_t;
typedef unsigned short __kernel_gid16_t;
typedef int __kernel_uid32_t;
typedef int __kernel_gid32_t;
typedef __kernel_uid_t __kernel_old_uid_t;
typedef __kernel_gid_t __kernel_old_gid_t;
typedef __kernel_dev_t __kernel_old_dev_t;
typedef long long __kernel_loff_t;
#else
typedef unsigned int __kernel_dev_t;
typedef unsigned long __kernel_ino_t;
typedef unsigned int __kernel_mode_t;
/* Linux 2.4.20 include/asm-mips/posix_types.h has this:
but apparently that is an error?!?!?
*/
#if 0
typedef int __kernel_nlink_t;
#else
/* So use this instead */
typedef unsigned long __kernel_nlink_t;
#endif
typedef long __kernel_off_t;
typedef int __kernel_pid_t;
typedef long int __kernel_ipc_pid_t;
typedef int __kernel_uid_t;
typedef int __kernel_gid_t;
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
typedef long __kernel_time_t;
typedef long __kernel_suseconds_t;
typedef long __kernel_clock_t;
typedef long __kernel_daddr_t;
typedef char * __kernel_caddr_t;
typedef unsigned short __kernel_uid16_t;
typedef unsigned short __kernel_gid16_t;
typedef int __kernel_uid32_t;
typedef int __kernel_gid32_t;
typedef __kernel_uid_t __kernel_old_uid_t;
typedef __kernel_gid_t __kernel_old_gid_t;
typedef __kernel_dev_t __kernel_old_dev_t;
typedef long long __kernel_loff_t;
#endif
typedef struct {
long val[2];
} __kernel_fsid_t;
#endif /* _ASM_POSIX_TYPES_H */
| {
"pile_set_name": "Github"
} |
// Copyright Aleksey Gurtovoy 2000-2004
//
// 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)
//
// Preprocessed version of "boost/mpl/minus.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename Tag1
, typename Tag2
>
struct minus_impl
: if_c<
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
)
, aux::cast2nd_impl< minus_impl< Tag1,Tag1 >,Tag1, Tag2 >
, aux::cast1st_impl< minus_impl< Tag2,Tag2 >,Tag1, Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct minus_impl< na,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct minus_impl< na,Tag >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct minus_impl< Tag,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename T > struct minus_tag
{
typedef typename T::tag type;
};
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
, typename N3 = na, typename N4 = na, typename N5 = na
>
struct minus
: minus< minus< minus< minus< N1,N2 >, N3>, N4>, N5>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(
5
, minus
, ( N1, N2, N3, N4, N5 )
)
};
template<
typename N1, typename N2, typename N3, typename N4
>
struct minus< N1,N2,N3,N4,na >
: minus< minus< minus< N1,N2 >, N3>, N4>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
5
, minus
, ( N1, N2, N3, N4, na )
)
};
template<
typename N1, typename N2, typename N3
>
struct minus< N1,N2,N3,na,na >
: minus< minus< N1,N2 >, N3>
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
5
, minus
, ( N1, N2, N3, na, na )
)
};
template<
typename N1, typename N2
>
struct minus< N1,N2,na,na,na >
: minus_impl<
typename minus_tag<N1>::type
, typename minus_tag<N2>::type
>::template apply< N1,N2 >::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(
5
, minus
, ( N1, N2, na, na, na )
)
};
BOOST_MPL_AUX_NA_SPEC2(2, 5, minus)
}}
namespace boost { namespace mpl {
template<>
struct minus_impl< integral_c_tag,integral_c_tag >
{
template< typename N1, typename N2 > struct apply
: integral_c<
typename aux::largest_int<
typename N1::value_type
, typename N2::value_type
>::type
, ( BOOST_MPL_AUX_VALUE_WKND(N1)::value
- BOOST_MPL_AUX_VALUE_WKND(N2)::value
)
>
{
};
};
}}
| {
"pile_set_name": "Github"
} |
ul.nav ul {
list-style:none;
margin: 0;
padding: 0 0 0 25px;
}
#downloader_application form {
margin-bottom: 10px;
}
#downloader_application ul {
list-style-type: none;
}
.browser_support th {
border-bottom-width: 3px !important;
}
.support_ie {border-bottom-color: #0275BA !important;}
.support_ff {border-bottom-color: #DF7215 !important;}
.support_sf {border-bottom-color: #43B3E9 !important;}
.support_cr {border-bottom-color: #39B642 !important;}
.support_op {border-bottom-color: #C42122 !important;}
.support_nd {border-bottom-color: #8CC84B !important;}
| {
"pile_set_name": "Github"
} |
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2014 Benoit Steiner <[email protected]>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_CXX11_TENSOR_TENSOR_FUNCTORS_H
#define EIGEN_CXX11_TENSOR_TENSOR_FUNCTORS_H
namespace Eigen {
namespace internal {
/** \internal
* \brief Template functor to compute the modulo between an array and a scalar.
*/
template <typename Scalar>
struct scalar_mod_op {
EIGEN_DEVICE_FUNC scalar_mod_op(const Scalar& divisor) : m_divisor(divisor) {}
EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a) const { return a % m_divisor; }
const Scalar m_divisor;
};
template <typename Scalar>
struct functor_traits<scalar_mod_op<Scalar> >
{ enum { Cost = NumTraits<Scalar>::template Div<false>::Cost, PacketAccess = false }; };
/** \internal
* \brief Template functor to compute the modulo between 2 arrays.
*/
template <typename Scalar>
struct scalar_mod2_op {
EIGEN_EMPTY_STRUCT_CTOR(scalar_mod2_op);
EIGEN_DEVICE_FUNC inline Scalar operator() (const Scalar& a, const Scalar& b) const { return a % b; }
};
template <typename Scalar>
struct functor_traits<scalar_mod2_op<Scalar> >
{ enum { Cost = NumTraits<Scalar>::template Div<false>::Cost, PacketAccess = false }; };
template <typename Scalar>
struct scalar_fmod_op {
EIGEN_EMPTY_STRUCT_CTOR(scalar_fmod_op);
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar
operator()(const Scalar& a, const Scalar& b) const {
return numext::fmod(a, b);
}
};
template <typename Scalar>
struct functor_traits<scalar_fmod_op<Scalar> > {
enum { Cost = 13, // Reciprocal throughput of FPREM on Haswell.
PacketAccess = false };
};
/** \internal
* \brief Template functor to compute the sigmoid of a scalar
* \sa class CwiseUnaryOp, ArrayBase::sigmoid()
*/
template <typename T>
struct scalar_sigmoid_op {
EIGEN_EMPTY_STRUCT_CTOR(scalar_sigmoid_op)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(const T& x) const {
const T one = T(1);
return one / (one + numext::exp(-x));
}
template <typename Packet> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Packet packetOp(const Packet& x) const {
const Packet one = pset1<Packet>(T(1));
return pdiv(one, padd(one, pexp(pnegate(x))));
}
};
template <typename T>
struct functor_traits<scalar_sigmoid_op<T> > {
enum {
Cost = NumTraits<T>::AddCost * 2 + NumTraits<T>::MulCost * 6,
PacketAccess = packet_traits<T>::HasAdd && packet_traits<T>::HasDiv &&
packet_traits<T>::HasNegate && packet_traits<T>::HasExp
};
};
template<typename Reducer, typename Device>
struct reducer_traits {
enum {
Cost = 1,
PacketAccess = false
};
};
// Standard reduction functors
template <typename T> struct SumReducer
{
static const bool PacketAccess = packet_traits<T>::HasAdd;
static const bool IsStateful = false;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) const {
(*accum) += t;
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reducePacket(const Packet& p, Packet* accum) const {
(*accum) = padd<Packet>(*accum, p);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const {
internal::scalar_cast_op<int, T> conv;
return conv(0);
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const {
return pset1<Packet>(initialize());
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalize(const T accum) const {
return accum;
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet finalizePacket(const Packet& vaccum) const {
return vaccum;
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalizeBoth(const T saccum, const Packet& vaccum) const {
return saccum + predux(vaccum);
}
};
template <typename T, typename Device>
struct reducer_traits<SumReducer<T>, Device> {
enum {
Cost = NumTraits<T>::AddCost,
PacketAccess = PacketType<T, Device>::HasAdd
};
};
template <typename T> struct MeanReducer
{
static const bool PacketAccess = packet_traits<T>::HasAdd && !NumTraits<T>::IsInteger;
static const bool IsStateful = true;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
MeanReducer() : scalarCount_(0), packetCount_(0) { }
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) {
(*accum) += t;
scalarCount_++;
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reducePacket(const Packet& p, Packet* accum) {
(*accum) = padd<Packet>(*accum, p);
packetCount_++;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const {
internal::scalar_cast_op<int, T> conv;
return conv(0);
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const {
return pset1<Packet>(initialize());
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalize(const T accum) const {
return accum / scalarCount_;
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet finalizePacket(const Packet& vaccum) const {
return pdiv(vaccum, pset1<Packet>(packetCount_));
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalizeBoth(const T saccum, const Packet& vaccum) const {
return (saccum + predux(vaccum)) / (scalarCount_ + packetCount_ * unpacket_traits<Packet>::size);
}
protected:
DenseIndex scalarCount_;
DenseIndex packetCount_;
};
template <typename T, typename Device>
struct reducer_traits<MeanReducer<T>, Device> {
enum {
Cost = NumTraits<T>::AddCost,
PacketAccess = PacketType<T, Device>::HasAdd
};
};
template <typename T> struct MaxReducer
{
static const bool PacketAccess = packet_traits<T>::HasMax;
static const bool IsStateful = false;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) const {
if (t > *accum) { *accum = t; }
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reducePacket(const Packet& p, Packet* accum) const {
(*accum) = pmax<Packet>(*accum, p);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const {
return Eigen::NumTraits<T>::lowest();
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const {
return pset1<Packet>(initialize());
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalize(const T accum) const {
return accum;
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet finalizePacket(const Packet& vaccum) const {
return vaccum;
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalizeBoth(const T saccum, const Packet& vaccum) const {
return numext::maxi(saccum, predux_max(vaccum));
}
};
template <typename T, typename Device>
struct reducer_traits<MaxReducer<T>, Device> {
enum {
Cost = NumTraits<T>::AddCost,
PacketAccess = PacketType<T, Device>::HasMax
};
};
template <typename T> struct MinReducer
{
static const bool PacketAccess = packet_traits<T>::HasMin;
static const bool IsStateful = false;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) const {
if (t < *accum) { *accum = t; }
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reducePacket(const Packet& p, Packet* accum) const {
(*accum) = pmin<Packet>(*accum, p);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const {
return Eigen::NumTraits<T>::highest();
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const {
return pset1<Packet>(initialize());
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalize(const T accum) const {
return accum;
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet finalizePacket(const Packet& vaccum) const {
return vaccum;
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalizeBoth(const T saccum, const Packet& vaccum) const {
return numext::mini(saccum, predux_min(vaccum));
}
};
template <typename T, typename Device>
struct reducer_traits<MinReducer<T>, Device> {
enum {
Cost = NumTraits<T>::AddCost,
PacketAccess = PacketType<T, Device>::HasMin
};
};
template <typename T> struct ProdReducer
{
static const bool PacketAccess = packet_traits<T>::HasMul;
static const bool IsStateful = false;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) const {
(*accum) *= t;
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reducePacket(const Packet& p, Packet* accum) const {
(*accum) = pmul<Packet>(*accum, p);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const {
internal::scalar_cast_op<int, T> conv;
return conv(1);
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet initializePacket() const {
return pset1<Packet>(initialize());
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalize(const T accum) const {
return accum;
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet finalizePacket(const Packet& vaccum) const {
return vaccum;
}
template <typename Packet>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalizeBoth(const T saccum, const Packet& vaccum) const {
return saccum * predux_mul(vaccum);
}
};
template <typename T, typename Device>
struct reducer_traits<ProdReducer<T>, Device> {
enum {
Cost = NumTraits<T>::MulCost,
PacketAccess = PacketType<T, Device>::HasMul
};
};
struct AndReducer
{
static const bool PacketAccess = false;
static const bool IsStateful = false;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(bool t, bool* accum) const {
*accum = *accum && t;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool initialize() const {
return true;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool finalize(bool accum) const {
return accum;
}
};
template <typename Device>
struct reducer_traits<AndReducer, Device> {
enum {
Cost = 1,
PacketAccess = false
};
};
struct OrReducer {
static const bool PacketAccess = false;
static const bool IsStateful = false;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(bool t, bool* accum) const {
*accum = *accum || t;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool initialize() const {
return false;
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool finalize(bool accum) const {
return accum;
}
};
template <typename Device>
struct reducer_traits<OrReducer, Device> {
enum {
Cost = 1,
PacketAccess = false
};
};
// Argmin/Argmax reducers
template <typename T> struct ArgMaxTupleReducer
{
static const bool PacketAccess = false;
static const bool IsStateful = false;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T t, T* accum) const {
if (t.second > accum->second) { *accum = t; }
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const {
return T(0, NumTraits<typename T::second_type>::lowest());
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalize(const T& accum) const {
return accum;
}
};
template <typename T, typename Device>
struct reducer_traits<ArgMaxTupleReducer<T>, Device> {
enum {
Cost = NumTraits<T>::AddCost,
PacketAccess = false
};
};
template <typename T> struct ArgMinTupleReducer
{
static const bool PacketAccess = false;
static const bool IsStateful = false;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void reduce(const T& t, T* accum) const {
if (t.second < accum->second) { *accum = t; }
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T initialize() const {
return T(0, NumTraits<typename T::second_type>::highest());
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T finalize(const T& accum) const {
return accum;
}
};
template <typename T, typename Device>
struct reducer_traits<ArgMinTupleReducer<T>, Device> {
enum {
Cost = NumTraits<T>::AddCost,
PacketAccess = false
};
};
// Random number generation
namespace {
#ifdef __CUDA_ARCH__
__device__ int get_random_seed() {
return clock();
}
#else
static inline int get_random_seed() {
#ifdef _WIN32
SYSTEMTIME st;
GetSystemTime(&st);
return st.wSecond + 1000 * st.wMilliseconds;
#elif defined __APPLE__
return static_cast<int>(mach_absolute_time());
#else
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
return static_cast<int>(ts.tv_nsec);
#endif
}
#endif
}
#if !defined (EIGEN_USE_GPU) || !defined(__CUDACC__) || !defined(__CUDA_ARCH__)
// We're not compiling a cuda kernel
template <typename T> class UniformRandomGenerator {
public:
static const bool PacketAccess = true;
UniformRandomGenerator(bool deterministic = true) : m_deterministic(deterministic) {
if (!deterministic) {
srand(get_random_seed());
}
}
UniformRandomGenerator(const UniformRandomGenerator& other) {
m_deterministic = other.m_deterministic;
}
template<typename Index>
T operator()(Index) const {
return random<T>();
}
template<typename Index, typename PacketType>
PacketType packetOp(Index) const {
const int packetSize = internal::unpacket_traits<PacketType>::size;
EIGEN_ALIGN_MAX T values[packetSize];
for (int i = 0; i < packetSize; ++i) {
values[i] = random<T>();
}
return internal::pload<PacketType>(values);
}
private:
bool m_deterministic;
};
#if __cplusplus > 199711 || EIGEN_COMP_MSVC >= 1900
template <> class UniformRandomGenerator<float> {
public:
static const bool PacketAccess = true;
UniformRandomGenerator(bool deterministic = true) : m_deterministic(deterministic), m_generator(new std::mt19937()) {
if (!deterministic) {
m_generator->seed(get_random_seed());
}
}
UniformRandomGenerator(const UniformRandomGenerator<float>& other) {
m_generator = new std::mt19937();
m_generator->seed(other(0) * UINT_MAX);
m_deterministic = other.m_deterministic;
}
~UniformRandomGenerator() {
delete m_generator;
}
template<typename Index>
float operator()(Index) const {
return m_distribution(*m_generator);
}
template<typename Index, typename PacketType>
PacketType packetOp(Index i) const {
const int packetSize = internal::unpacket_traits<PacketType>::size;
EIGEN_ALIGN_MAX float values[packetSize];
for (int k = 0; k < packetSize; ++k) {
values[k] = this->operator()(i);
}
return internal::pload<PacketType>(values);
}
private:
UniformRandomGenerator& operator = (const UniformRandomGenerator&);
// Make sure m_deterministic comes first to match the layout of the cpu
// version of the code.
bool m_deterministic;
std::mt19937* m_generator;
mutable std::uniform_real_distribution<float> m_distribution;
};
template <> class UniformRandomGenerator<double> {
public:
static const bool PacketAccess = true;
UniformRandomGenerator(bool deterministic = true) : m_deterministic(deterministic), m_generator(new std::mt19937()) {
if (!deterministic) {
m_generator->seed(get_random_seed());
}
}
UniformRandomGenerator(const UniformRandomGenerator<double>& other) {
m_generator = new std::mt19937();
m_generator->seed(other(0) * UINT_MAX);
m_deterministic = other.m_deterministic;
}
~UniformRandomGenerator() {
delete m_generator;
}
template<typename Index>
double operator()(Index) const {
return m_distribution(*m_generator);
}
template<typename Index, typename PacketType>
PacketType packetOp(Index i) const {
const int packetSize = internal::unpacket_traits<PacketType>::size;
EIGEN_ALIGN_MAX double values[packetSize];
for (int k = 0; k < packetSize; ++k) {
values[k] = this->operator()(i);
}
return internal::pload<PacketType>(values);
}
private:
UniformRandomGenerator& operator = (const UniformRandomGenerator&);
// Make sure m_deterministic comes first to match the layout of the cpu
// version of the code.
bool m_deterministic;
std::mt19937* m_generator;
mutable std::uniform_real_distribution<double> m_distribution;
};
#endif
#else
// We're compiling a cuda kernel
template <typename T> class UniformRandomGenerator;
template <> class UniformRandomGenerator<float> {
public:
static const bool PacketAccess = true;
__device__ UniformRandomGenerator(bool deterministic = true) : m_deterministic(deterministic) {
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
__device__ UniformRandomGenerator(const UniformRandomGenerator& other) {
m_deterministic = other.m_deterministic;
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = m_deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
template<typename Index>
__device__ float operator()(Index) const {
return curand_uniform(&m_state);
}
template<typename Index, typename PacketType>
__device__ float4 packetOp(Index) const {
EIGEN_STATIC_ASSERT((is_same<PacketType, float4>::value), YOU_MADE_A_PROGRAMMING_MISTAKE);
return curand_uniform4(&m_state);
}
private:
bool m_deterministic;
mutable curandStatePhilox4_32_10_t m_state;
};
template <> class UniformRandomGenerator<double> {
public:
static const bool PacketAccess = true;
__device__ UniformRandomGenerator(bool deterministic = true) : m_deterministic(deterministic) {
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
__device__ UniformRandomGenerator(const UniformRandomGenerator& other) {
m_deterministic = other.m_deterministic;
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = m_deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
template<typename Index>
__device__ double operator()(Index) const {
return curand_uniform_double(&m_state);
}
template<typename Index, typename PacketType>
__device__ double2 packetOp(Index) const {
EIGEN_STATIC_ASSERT((is_same<PacketType, double2>::value), YOU_MADE_A_PROGRAMMING_MISTAKE);
return curand_uniform2_double(&m_state);
}
private:
bool m_deterministic;
mutable curandStatePhilox4_32_10_t m_state;
};
template <> class UniformRandomGenerator<std::complex<float> > {
public:
static const bool PacketAccess = false;
__device__ UniformRandomGenerator(bool deterministic = true) : m_deterministic(deterministic) {
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
__device__ UniformRandomGenerator(const UniformRandomGenerator& other) {
m_deterministic = other.m_deterministic;
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = m_deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
template<typename Index>
__device__ std::complex<float> operator()(Index) const {
float4 vals = curand_uniform4(&m_state);
return std::complex<float>(vals.x, vals.y);
}
private:
bool m_deterministic;
mutable curandStatePhilox4_32_10_t m_state;
};
template <> class UniformRandomGenerator<std::complex<double> > {
public:
static const bool PacketAccess = false;
__device__ UniformRandomGenerator(bool deterministic = true) : m_deterministic(deterministic) {
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
__device__ UniformRandomGenerator(const UniformRandomGenerator& other) {
m_deterministic = other.m_deterministic;
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = m_deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
template<typename Index>
__device__ std::complex<double> operator()(Index) const {
double2 vals = curand_uniform2_double(&m_state);
return std::complex<double>(vals.x, vals.y);
}
private:
bool m_deterministic;
mutable curandStatePhilox4_32_10_t m_state;
};
#endif
template <typename Scalar>
struct functor_traits<UniformRandomGenerator<Scalar> > {
enum {
// Rough estimate.
Cost = 100 * NumTraits<Scalar>::MulCost,
PacketAccess = UniformRandomGenerator<Scalar>::PacketAccess
};
};
#if (!defined (EIGEN_USE_GPU) || !defined(__CUDACC__) || !defined(__CUDA_ARCH__)) && (__cplusplus > 199711 || EIGEN_COMP_MSVC >= 1900)
// We're not compiling a cuda kernel
template <typename T> class NormalRandomGenerator {
public:
static const bool PacketAccess = true;
NormalRandomGenerator(bool deterministic = true) : m_deterministic(deterministic), m_distribution(0, 1), m_generator(new std::mt19937()) {
if (!deterministic) {
m_generator->seed(get_random_seed());
}
}
NormalRandomGenerator(const NormalRandomGenerator& other)
: m_deterministic(other.m_deterministic), m_distribution(other.m_distribution), m_generator(new std::mt19937()) {
m_generator->seed(other(0) * UINT_MAX);
}
~NormalRandomGenerator() {
delete m_generator;
}
template<typename Index>
T operator()(Index) const {
return m_distribution(*m_generator);
}
template<typename Index, typename PacketType>
PacketType packetOp(Index) const {
const int packetSize = internal::unpacket_traits<PacketType>::size;
EIGEN_ALIGN_MAX T values[packetSize];
for (int i = 0; i < packetSize; ++i) {
values[i] = m_distribution(*m_generator);
}
return internal::pload<PacketType>(values);
}
private:
// No assignment
NormalRandomGenerator& operator = (const NormalRandomGenerator&);
bool m_deterministic;
mutable std::normal_distribution<T> m_distribution;
std::mt19937* m_generator;
};
#elif defined (EIGEN_USE_GPU) && defined(__CUDACC__) && defined(__CUDA_ARCH__)
// We're compiling a cuda kernel
template <typename T> class NormalRandomGenerator;
template <> class NormalRandomGenerator<float> {
public:
static const bool PacketAccess = true;
__device__ NormalRandomGenerator(bool deterministic = true) : m_deterministic(deterministic) {
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
__device__ NormalRandomGenerator(const NormalRandomGenerator<float>& other) {
m_deterministic = other.m_deterministic;
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = m_deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
template<typename Index>
__device__ float operator()(Index) const {
return curand_normal(&m_state);
}
template<typename Index, typename PacketType>
__device__ float4 packetOp(Index) const {
EIGEN_STATIC_ASSERT((is_same<PacketType, float4>::value), YOU_MADE_A_PROGRAMMING_MISTAKE);
return curand_normal4(&m_state);
}
private:
bool m_deterministic;
mutable curandStatePhilox4_32_10_t m_state;
};
template <> class NormalRandomGenerator<double> {
public:
static const bool PacketAccess = true;
__device__ NormalRandomGenerator(bool deterministic = true) : m_deterministic(deterministic) {
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
__device__ NormalRandomGenerator(const NormalRandomGenerator<double>& other) {
m_deterministic = other.m_deterministic;
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = m_deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
template<typename Index>
__device__ double operator()(Index) const {
return curand_normal_double(&m_state);
}
template<typename Index, typename PacketType>
__device__ double2 packetOp(Index) const {
EIGEN_STATIC_ASSERT((is_same<PacketType, double2>::value), YOU_MADE_A_PROGRAMMING_MISTAKE);
return curand_normal2_double(&m_state);
}
private:
bool m_deterministic;
mutable curandStatePhilox4_32_10_t m_state;
};
template <> class NormalRandomGenerator<std::complex<float> > {
public:
static const bool PacketAccess = false;
__device__ NormalRandomGenerator(bool deterministic = true) : m_deterministic(deterministic) {
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
__device__ NormalRandomGenerator(const NormalRandomGenerator& other) {
m_deterministic = other.m_deterministic;
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = m_deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
template<typename Index>
__device__ std::complex<float> operator()(Index) const {
float4 vals = curand_normal4(&m_state);
return std::complex<float>(vals.x, vals.y);
}
private:
bool m_deterministic;
mutable curandStatePhilox4_32_10_t m_state;
};
template <> class NormalRandomGenerator<std::complex<double> > {
public:
static const bool PacketAccess = false;
__device__ NormalRandomGenerator(bool deterministic = true) : m_deterministic(deterministic) {
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
__device__ NormalRandomGenerator(const NormalRandomGenerator& other) {
m_deterministic = other.m_deterministic;
const int tid = blockIdx.x * blockDim.x + threadIdx.x;
const int seed = m_deterministic ? 0 : get_random_seed();
curand_init(seed, tid, 0, &m_state);
}
template<typename Index>
__device__ std::complex<double> operator()(Index) const {
double2 vals = curand_normal2_double(&m_state);
return std::complex<double>(vals.x, vals.y);
}
private:
bool m_deterministic;
mutable curandStatePhilox4_32_10_t m_state;
};
#else
template <typename T> class NormalRandomGenerator {
public:
static const bool PacketAccess = false;
NormalRandomGenerator(bool deterministic = true) : m_deterministic(deterministic) {}
private:
bool m_deterministic;
};
#endif
template <typename Scalar>
struct functor_traits<NormalRandomGenerator<Scalar> > {
enum {
// Rough estimate.
Cost = 100 * NumTraits<Scalar>::MulCost,
PacketAccess = NormalRandomGenerator<Scalar>::PacketAccess
};
};
template <typename T, typename Index, size_t NumDims>
class GaussianGenerator {
public:
static const bool PacketAccess = false;
EIGEN_DEVICE_FUNC GaussianGenerator(const array<T, NumDims>& means,
const array<T, NumDims>& std_devs)
: m_means(means)
{
for (size_t i = 0; i < NumDims; ++i) {
m_two_sigmas[i] = std_devs[i] * std_devs[i] * 2;
}
}
T operator()(const array<Index, NumDims>& coordinates) const {
T tmp = T(0);
for (size_t i = 0; i < NumDims; ++i) {
T offset = coordinates[i] - m_means[i];
tmp += offset * offset / m_two_sigmas[i];
}
return numext::exp(-tmp);
}
private:
array<T, NumDims> m_means;
array<T, NumDims> m_two_sigmas;
};
template <typename T, typename Index, size_t NumDims>
struct functor_traits<GaussianGenerator<T, Index, NumDims> > {
enum {
Cost = NumDims * (2 * NumTraits<T>::AddCost + NumTraits<T>::MulCost +
functor_traits<scalar_quotient_op<T, T> >::Cost) +
functor_traits<scalar_exp_op<T> >::Cost,
PacketAccess = GaussianGenerator<T, Index, NumDims>::PacketAccess
};
};
} // end namespace internal
} // end namespace Eigen
#endif // EIGEN_CXX11_TENSOR_TENSOR_FUNCTORS_H
| {
"pile_set_name": "Github"
} |
module FastlyRails
class Configuration
# 30 days
MAX_AGE_DEFAULT = '2592000'
attr_accessor :api_key, :user, :password, :max_age, :service_id, :stale_while_revalidate, :stale_if_error
attr_writer :purging_enabled
def self.max_age_default
MAX_AGE_DEFAULT
end
def initialize
@max_age = MAX_AGE_DEFAULT
@purging_enabled = true
end
def authenticatable?
!!api_key
end
def invalid_service_id?
service_id_nil? || service_id_blank?
end
def purging_enabled?
@purging_enabled
end
private
def has_credentials?
user && password
end
def service_id_nil?
service_id.nil?
end
def service_id_blank?
service_id.blank?
end
end
end
| {
"pile_set_name": "Github"
} |
config DVB_B2C2_FLEXCOP
tristate "Technisat/B2C2 FlexCopII(b) and FlexCopIII adapters"
depends on DVB_CORE && I2C
select DVB_PLL if !DVB_FE_CUSTOMISE
select DVB_STV0299 if !DVB_FE_CUSTOMISE
select DVB_MT352 if !DVB_FE_CUSTOMISE
select DVB_MT312 if !DVB_FE_CUSTOMISE
select DVB_NXT200X if !DVB_FE_CUSTOMISE
select DVB_STV0297 if !DVB_FE_CUSTOMISE
select DVB_BCM3510 if !DVB_FE_CUSTOMISE
select DVB_LGDT330X if !DVB_FE_CUSTOMISE
select DVB_S5H1420 if !DVB_FE_CUSTOMISE
select DVB_TUNER_ITD1000 if !DVB_FE_CUSTOMISE
select DVB_ISL6421 if !DVB_FE_CUSTOMISE
select DVB_CX24123 if !DVB_FE_CUSTOMISE
select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMISE
select DVB_TUNER_CX24113 if !DVB_FE_CUSTOMISE
help
Support for the digital TV receiver chip made by B2C2 Inc. included in
Technisats PCI cards and USB boxes.
Say Y if you own such a device and want to use it.
config DVB_B2C2_FLEXCOP_PCI
tristate "Technisat/B2C2 Air/Sky/Cable2PC PCI"
depends on DVB_B2C2_FLEXCOP && PCI && I2C
help
Support for the Air/Sky/CableStar2 PCI card (DVB/ATSC) by Technisat/B2C2.
Say Y if you own such a device and want to use it.
config DVB_B2C2_FLEXCOP_USB
tristate "Technisat/B2C2 Air/Sky/Cable2PC USB"
depends on DVB_B2C2_FLEXCOP && USB && I2C
help
Support for the Air/Sky/Cable2PC USB1.1 box (DVB/ATSC) by Technisat/B2C2,
Say Y if you own such a device and want to use it.
config DVB_B2C2_FLEXCOP_DEBUG
bool "Enable debug for the B2C2 FlexCop drivers"
depends on DVB_B2C2_FLEXCOP
help
Say Y if you want to enable the module option to control debug messages
of all B2C2 FlexCop drivers.
| {
"pile_set_name": "Github"
} |
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __gnu_javax_crypto_jce_mac_HMacRipeMD128Spi__
#define __gnu_javax_crypto_jce_mac_HMacRipeMD128Spi__
#pragma interface
#include <gnu/javax/crypto/jce/mac/MacAdapter.h>
extern "Java"
{
namespace gnu
{
namespace javax
{
namespace crypto
{
namespace jce
{
namespace mac
{
class HMacRipeMD128Spi;
}
}
}
}
}
}
class gnu::javax::crypto::jce::mac::HMacRipeMD128Spi : public ::gnu::javax::crypto::jce::mac::MacAdapter
{
public:
HMacRipeMD128Spi();
static ::java::lang::Class class$;
};
#endif // __gnu_javax_crypto_jce_mac_HMacRipeMD128Spi__
| {
"pile_set_name": "Github"
} |
<h2>{$kbarticle.title}</h2>
{if $kbarticle.voted}
{include file="$template/includes/alert.tpl" type="success" msg="{lang key="knowledgebaseArticleRatingThanks"}" textcenter=true}
{/if}
<blockquote>
{$kbarticle.text}
</blockquote>
<div class="hidden-print">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
{if $kbarticle.voted}{$LANG.knowledgebaserating}{else}{$LANG.knowledgebasehelpful}{/if}
</h3>
</div>
<div class="panel-body">
{if $kbarticle.voted}
{$kbarticle.useful} {$LANG.knowledgebaseratingtext} ({$kbarticle.votes} {$LANG.knowledgebasevotes})
{else}
<form action="{if $seofriendlyurls}{$WEB_ROOT}/knowledgebase/{$kbarticle.id}/{$kbarticle.urlfriendlytitle}.html{else}knowledgebase.php?action=displayarticle&id={$kbarticle.id}{/if}" method="post">
<input type="hidden" name="useful" value="vote">
<button type="submit" name="vote" value="yes" class="btn btn-success"><i class="fa fa-thumbs-o-up"></i> {$LANG.knowledgebaseyes}</button>
<button type="submit" name="vote" value="no" class="btn btn-default"><i class="fa fa-thumbs-o-down"></i> {$LANG.knowledgebaseno}</button>
</form>
{/if}
</div>
</div>
<a href="#" class="btn btn-success btn-block" onclick="window.print();return false"><i class="fa fa-print"> </i>{$LANG.knowledgebaseprint}</a>
</div>
{if $kbarticles}
<h3 class="kb-alsoread">
{$LANG.knowledgebasealsoread}
</h3>
<div class="kbarticles">
{foreach key=num item=kbarticle from=$kbarticles}
<div>
<a href="{if $seofriendlyurls}{$WEB_ROOT}/knowledgebase/{$kbarticle.id}/{$kbarticle.urlfriendlytitle}.html{else}knowledgebase.php?action=displayarticle&id={$kbarticle.id}{/if}">
<i class="glyphicon glyphicon-file"></i> {$kbarticle.title}
</a>
<p>{$kbarticle.article|truncate:100:"..."}</p>
</div>
{/foreach}
</div>
{/if}
| {
"pile_set_name": "Github"
} |
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
| {
"pile_set_name": "Github"
} |
import { AssertionError } from './AssertionError'
import { AutofixType } from './autofix'
import { LooseMock } from './mocks/looseMock'
import { StrictMock } from './mocks/strictMock'
import { Control, ValidationResult } from './validators/common'
import { toBeExhausted, toHaveBeenCalledWith } from './validators/mocks'
import { toBeRejected } from './validators/toBeRejected'
import { toEqual } from './validators/toEqual'
import { toLooseEqual } from './validators/toLooseEqual'
import { toThrow } from './validators/toThrow'
export interface ExpectationOptions {
extraMessage?: string
}
export class Expectation<T> {
constructor(
private readonly autofix: AutofixType,
private readonly actual: T,
private isNegated: boolean = false,
private options: ExpectationOptions = {},
) {}
// modifiers
get not(): this {
if (this.isNegated) {
throw new Error('Tried negating already negated expectation')
}
this.isNegated = true
return this
}
// validators
/** Does deep "smart" equality check. **Autofixes the argument**. */
toEqual(): void
/** Does deep "smart" equality check. */
toEqual(value: T): void
toEqual(value?: T) {
if (arguments.length === 0) {
toEqual(this.getControl())
} else {
toEqual(this.getControl(), value)
}
}
/** Like toEqual but without type checking. **Autofixes the argument**. */
toLooseEqual(): void
/** Like toEqual but without type checking. */
toLooseEqual(value: any): void
toLooseEqual(value?: any) {
if (arguments.length === 0) {
toLooseEqual(this.getControl())
} else {
toLooseEqual(this.getControl(), value)
}
}
toThrow(this: Expectation<() => any>, expected?: any) {
if (arguments.length === 0) {
toThrow(this.getControl())
} else {
toThrow(this.getControl(), expected)
}
}
toBeRejected(this: Expectation<Promise<any>>, expected?: any): Promise<void> {
if (arguments.length === 0) {
return toBeRejected(this.getControl())
} else {
return toBeRejected(this.getControl(), expected)
}
}
// mocks
toBeExhausted(this: Expectation<StrictMock<any, any>>) {
return toBeExhausted(this.getControl())
}
toHaveBeenCalledWith(this: Expectation<LooseMock<any[], any>>, expectedCall: any[]) {
return toHaveBeenCalledWith(this.getControl(), expectedCall)
}
// utils
private getControl(): Control<T> {
return {
actual: this.actual,
assert: this.assert.bind(this),
autofix: this.autofix.bind(this),
isNegated: this.isNegated,
}
}
private assert(result: ValidationResult) {
if (this.isNegated) {
if (result.success) {
throw new AssertionError({
message: result.negatedReason,
actual: result.actual,
expected: result.expected,
extraMessage: this.options.extraMessage,
})
}
} else {
if (!result.success) {
throw new AssertionError({
message: result.reason,
actual: result.actual,
expected: result.expected,
extraMessage: this.options.extraMessage,
})
}
}
}
}
| {
"pile_set_name": "Github"
} |
<?php
// This file was auto-generated from sdk-root/src/data/elasticmapreduce/2009-03-31/smoke.json
return ['version' => 1, 'defaultRegion' => 'us-west-2', 'testCases' => [['operationName' => 'ListClusters', 'input' => [], 'errorExpectedFromService' => \false], ['operationName' => 'DescribeCluster', 'input' => ['ClusterId' => 'fake_cluster'], 'errorExpectedFromService' => \true]]];
| {
"pile_set_name": "Github"
} |
//
// Copyright (c) 2013 Mikko Mononen [email protected]
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
#ifndef NANOVG_H
#define NANOVG_H
#ifdef __cplusplus
extern "C" {
#endif
#define NVG_PI 3.14159265358979323846264338327f
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
#endif
typedef struct NVGcontext NVGcontext;
struct NVGcolor {
union {
float rgba[4];
struct {
float r,g,b,a;
};
};
};
typedef struct NVGcolor NVGcolor;
struct NVGpaint {
float xform[6];
float extent[2];
float radius;
float feather;
NVGcolor innerColor;
NVGcolor outerColor;
int image;
};
typedef struct NVGpaint NVGpaint;
enum NVGwinding {
NVG_CCW = 1, // Winding for solid shapes
NVG_CW = 2, // Winding for holes
};
enum NVGsolidity {
NVG_SOLID = 1, // CCW
NVG_HOLE = 2, // CW
};
enum NVGlineCap {
NVG_BUTT,
NVG_ROUND,
NVG_SQUARE,
NVG_BEVEL,
NVG_MITER,
};
enum NVGalign {
// Horizontal align
NVG_ALIGN_LEFT = 1<<0, // Default, align text horizontally to left.
NVG_ALIGN_CENTER = 1<<1, // Align text horizontally to center.
NVG_ALIGN_RIGHT = 1<<2, // Align text horizontally to right.
// Vertical align
NVG_ALIGN_TOP = 1<<3, // Align text vertically to top.
NVG_ALIGN_MIDDLE = 1<<4, // Align text vertically to middle.
NVG_ALIGN_BOTTOM = 1<<5, // Align text vertically to bottom.
NVG_ALIGN_BASELINE = 1<<6, // Default, align text vertically to baseline.
};
enum NVGblendFactor {
NVG_ZERO = 1<<0,
NVG_ONE = 1<<1,
NVG_SRC_COLOR = 1<<2,
NVG_ONE_MINUS_SRC_COLOR = 1<<3,
NVG_DST_COLOR = 1<<4,
NVG_ONE_MINUS_DST_COLOR = 1<<5,
NVG_SRC_ALPHA = 1<<6,
NVG_ONE_MINUS_SRC_ALPHA = 1<<7,
NVG_DST_ALPHA = 1<<8,
NVG_ONE_MINUS_DST_ALPHA = 1<<9,
NVG_SRC_ALPHA_SATURATE = 1<<10,
};
enum NVGcompositeOperation {
NVG_SOURCE_OVER,
NVG_SOURCE_IN,
NVG_SOURCE_OUT,
NVG_ATOP,
NVG_DESTINATION_OVER,
NVG_DESTINATION_IN,
NVG_DESTINATION_OUT,
NVG_DESTINATION_ATOP,
NVG_LIGHTER,
NVG_COPY,
NVG_XOR,
};
struct NVGcompositeOperationState {
int srcRGB;
int dstRGB;
int srcAlpha;
int dstAlpha;
};
typedef struct NVGcompositeOperationState NVGcompositeOperationState;
struct NVGglyphPosition {
const char* str; // Position of the glyph in the input string.
float x; // The x-coordinate of the logical glyph position.
float minx, maxx; // The bounds of the glyph shape.
};
typedef struct NVGglyphPosition NVGglyphPosition;
struct NVGtextRow {
const char* start; // Pointer to the input text where the row starts.
const char* end; // Pointer to the input text where the row ends (one past the last character).
const char* next; // Pointer to the beginning of the next row.
float width; // Logical width of the row.
float minx, maxx; // Actual bounds of the row. Logical with and bounds can differ because of kerning and some parts over extending.
};
typedef struct NVGtextRow NVGtextRow;
enum NVGimageFlags {
NVG_IMAGE_GENERATE_MIPMAPS = 1<<0, // Generate mipmaps during creation of the image.
NVG_IMAGE_REPEATX = 1<<1, // Repeat image in X direction.
NVG_IMAGE_REPEATY = 1<<2, // Repeat image in Y direction.
NVG_IMAGE_FLIPY = 1<<3, // Flips (inverses) image in Y direction when rendered.
NVG_IMAGE_PREMULTIPLIED = 1<<4, // Image data has premultiplied alpha.
};
// Begin drawing a new frame
// Calls to nanovg drawing API should be wrapped in nvgBeginFrame() & nvgEndFrame()
// nvgBeginFrame() defines the size of the window to render to in relation currently
// set viewport (i.e. glViewport on GL backends). Device pixel ration allows to
// control the rendering on Hi-DPI devices.
// For example, GLFW returns two dimension for an opened window: window size and
// frame buffer size. In that case you would set windowWidth/Height to the window size
// devicePixelRatio to: frameBufferWidth / windowWidth.
void nvgBeginFrame(NVGcontext* ctx, int windowWidth, int windowHeight, float devicePixelRatio);
// Cancels drawing the current frame.
void nvgCancelFrame(NVGcontext* ctx);
// Ends drawing flushing remaining render state.
void nvgEndFrame(NVGcontext* ctx);
//
// Composite operation
//
// The composite operations in NanoVG are modeled after HTML Canvas API, and
// the blend func is based on OpenGL (see corresponding manuals for more info).
// The colors in the blending state have premultiplied alpha.
// Sets the composite operation. The op parameter should be one of NVGcompositeOperation.
void nvgGlobalCompositeOperation(NVGcontext* ctx, int op);
// Sets the composite operation with custom pixel arithmetic. The parameters should be one of NVGblendFactor.
void nvgGlobalCompositeBlendFunc(NVGcontext* ctx, int sfactor, int dfactor);
// Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately. The parameters should be one of NVGblendFactor.
void nvgGlobalCompositeBlendFuncSeparate(NVGcontext* ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
//
// Color utils
//
// Colors in NanoVG are stored as unsigned ints in ABGR format.
// Returns a color value from red, green, blue values. Alpha will be set to 255 (1.0f).
NVGcolor nvgRGB(unsigned char r, unsigned char g, unsigned char b);
// Returns a color value from red, green, blue values. Alpha will be set to 1.0f.
NVGcolor nvgRGBf(float r, float g, float b);
// Returns a color value from red, green, blue and alpha values.
NVGcolor nvgRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
// Returns a color value from red, green, blue and alpha values.
NVGcolor nvgRGBAf(float r, float g, float b, float a);
// Linearly interpolates from color c0 to c1, and returns resulting color value.
NVGcolor nvgLerpRGBA(NVGcolor c0, NVGcolor c1, float u);
// Sets transparency of a color value.
NVGcolor nvgTransRGBA(NVGcolor c0, unsigned char a);
// Sets transparency of a color value.
NVGcolor nvgTransRGBAf(NVGcolor c0, float a);
// Returns color value specified by hue, saturation and lightness.
// HSL values are all in range [0..1], alpha will be set to 255.
NVGcolor nvgHSL(float h, float s, float l);
// Returns color value specified by hue, saturation and lightness and alpha.
// HSL values are all in range [0..1], alpha in range [0..255]
NVGcolor nvgHSLA(float h, float s, float l, unsigned char a);
//
// State Handling
//
// NanoVG contains state which represents how paths will be rendered.
// The state contains transform, fill and stroke styles, text and font styles,
// and scissor clipping.
// Pushes and saves the current render state into a state stack.
// A matching nvgRestore() must be used to restore the state.
void nvgSave(NVGcontext* ctx);
// Pops and restores current render state.
void nvgRestore(NVGcontext* ctx);
// Resets current render state to default values. Does not affect the render state stack.
void nvgReset(NVGcontext* ctx);
//
// Render styles
//
// Fill and stroke render style can be either a solid color or a paint which is a gradient or a pattern.
// Solid color is simply defined as a color value, different kinds of paints can be created
// using nvgLinearGradient(), nvgBoxGradient(), nvgRadialGradient() and nvgImagePattern().
//
// Current render style can be saved and restored using nvgSave() and nvgRestore().
// Sets current stroke style to a solid color.
void nvgStrokeColor(NVGcontext* ctx, NVGcolor color);
// Sets current stroke style to a paint, which can be a one of the gradients or a pattern.
void nvgStrokePaint(NVGcontext* ctx, NVGpaint paint);
// Sets current fill style to a solid color.
void nvgFillColor(NVGcontext* ctx, NVGcolor color);
// Sets current fill style to a paint, which can be a one of the gradients or a pattern.
void nvgFillPaint(NVGcontext* ctx, NVGpaint paint);
// Sets the miter limit of the stroke style.
// Miter limit controls when a sharp corner is beveled.
void nvgMiterLimit(NVGcontext* ctx, float limit);
// Sets the stroke width of the stroke style.
void nvgStrokeWidth(NVGcontext* ctx, float size);
// Sets how the end of the line (cap) is drawn,
// Can be one of: NVG_BUTT (default), NVG_ROUND, NVG_SQUARE.
void nvgLineCap(NVGcontext* ctx, int cap);
// Sets how sharp path corners are drawn.
// Can be one of NVG_MITER (default), NVG_ROUND, NVG_BEVEL.
void nvgLineJoin(NVGcontext* ctx, int join);
// Sets the transparency applied to all rendered shapes.
// Already transparent paths will get proportionally more transparent as well.
void nvgGlobalAlpha(NVGcontext* ctx, float alpha);
//
// Transforms
//
// The paths, gradients, patterns and scissor region are transformed by an transformation
// matrix at the time when they are passed to the API.
// The current transformation matrix is a affine matrix:
// [sx kx tx]
// [ky sy ty]
// [ 0 0 1]
// Where: sx,sy define scaling, kx,ky skewing, and tx,ty translation.
// The last row is assumed to be 0,0,1 and is not stored.
//
// Apart from nvgResetTransform(), each transformation function first creates
// specific transformation matrix and pre-multiplies the current transformation by it.
//
// Current coordinate system (transformation) can be saved and restored using nvgSave() and nvgRestore().
// Resets current transform to a identity matrix.
void nvgResetTransform(NVGcontext* ctx);
// Premultiplies current coordinate system by specified matrix.
// The parameters are interpreted as matrix as follows:
// [a c e]
// [b d f]
// [0 0 1]
void nvgTransform(NVGcontext* ctx, float a, float b, float c, float d, float e, float f);
// Translates current coordinate system.
void nvgTranslate(NVGcontext* ctx, float x, float y);
// Rotates current coordinate system. Angle is specified in radians.
void nvgRotate(NVGcontext* ctx, float angle);
// Skews the current coordinate system along X axis. Angle is specified in radians.
void nvgSkewX(NVGcontext* ctx, float angle);
// Skews the current coordinate system along Y axis. Angle is specified in radians.
void nvgSkewY(NVGcontext* ctx, float angle);
// Scales the current coordinate system.
void nvgScale(NVGcontext* ctx, float x, float y);
// Stores the top part (a-f) of the current transformation matrix in to the specified buffer.
// [a c e]
// [b d f]
// [0 0 1]
// There should be space for 6 floats in the return buffer for the values a-f.
void nvgCurrentTransform(NVGcontext* ctx, float* xform);
// The following functions can be used to make calculations on 2x3 transformation matrices.
// A 2x3 matrix is represented as float[6].
// Sets the transform to identity matrix.
void nvgTransformIdentity(float* dst);
// Sets the transform to translation matrix matrix.
void nvgTransformTranslate(float* dst, float tx, float ty);
// Sets the transform to scale matrix.
void nvgTransformScale(float* dst, float sx, float sy);
// Sets the transform to rotate matrix. Angle is specified in radians.
void nvgTransformRotate(float* dst, float a);
// Sets the transform to skew-x matrix. Angle is specified in radians.
void nvgTransformSkewX(float* dst, float a);
// Sets the transform to skew-y matrix. Angle is specified in radians.
void nvgTransformSkewY(float* dst, float a);
// Sets the transform to the result of multiplication of two transforms, of A = A*B.
void nvgTransformMultiply(float* dst, const float* src);
// Sets the transform to the result of multiplication of two transforms, of A = B*A.
void nvgTransformPremultiply(float* dst, const float* src);
// Sets the destination to inverse of specified transform.
// Returns 1 if the inverse could be calculated, else 0.
int nvgTransformInverse(float* dst, const float* src);
// Transform a point by given transform.
void nvgTransformPoint(float* dstx, float* dsty, const float* xform, float srcx, float srcy);
// Converts degrees to radians and vice versa.
float nvgDegToRad(float deg);
float nvgRadToDeg(float rad);
//
// Images
//
// NanoVG allows you to load jpg, png, psd, tga, pic and gif files to be used for rendering.
// In addition you can upload your own image. The image loading is provided by stb_image.
// The parameter imageFlags is combination of flags defined in NVGimageFlags.
// Creates image by loading it from the disk from specified file name.
// Returns handle to the image.
int nvgCreateImage(NVGcontext* ctx, const char* filename, int imageFlags);
// Creates image by loading it from the specified chunk of memory.
// Returns handle to the image.
int nvgCreateImageMem(NVGcontext* ctx, int imageFlags, unsigned char* data, int ndata);
// Creates image from specified image data.
// Returns handle to the image.
int nvgCreateImageRGBA(NVGcontext* ctx, int w, int h, int imageFlags, const unsigned char* data);
// Updates image data specified by image handle.
void nvgUpdateImage(NVGcontext* ctx, int image, const unsigned char* data);
// Returns the dimensions of a created image.
void nvgImageSize(NVGcontext* ctx, int image, int* w, int* h);
// Deletes created image.
void nvgDeleteImage(NVGcontext* ctx, int image);
//
// Paints
//
// NanoVG supports four types of paints: linear gradient, box gradient, radial gradient and image pattern.
// These can be used as paints for strokes and fills.
// Creates and returns a linear gradient. Parameters (sx,sy)-(ex,ey) specify the start and end coordinates
// of the linear gradient, icol specifies the start color and ocol the end color.
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
NVGpaint nvgLinearGradient(NVGcontext* ctx, float sx, float sy, float ex, float ey,
NVGcolor icol, NVGcolor ocol);
// Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering
// drop shadows or highlights for boxes. Parameters (x,y) define the top-left corner of the rectangle,
// (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry
// the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient.
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
NVGpaint nvgBoxGradient(NVGcontext* ctx, float x, float y, float w, float h,
float r, float f, NVGcolor icol, NVGcolor ocol);
// Creates and returns a radial gradient. Parameters (cx,cy) specify the center, inr and outr specify
// the inner and outer radius of the gradient, icol specifies the start color and ocol the end color.
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
NVGpaint nvgRadialGradient(NVGcontext* ctx, float cx, float cy, float inr, float outr,
NVGcolor icol, NVGcolor ocol);
// Creates and returns an image patter. Parameters (ox,oy) specify the left-top location of the image pattern,
// (ex,ey) the size of one image, angle rotation around the top-left corner, image is handle to the image to render.
// The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
NVGpaint nvgImagePattern(NVGcontext* ctx, float ox, float oy, float ex, float ey,
float angle, int image, float alpha);
//
// Scissoring
//
// Scissoring allows you to clip the rendering into a rectangle. This is useful for various
// user interface cases like rendering a text edit or a timeline.
// Sets the current scissor rectangle.
// The scissor rectangle is transformed by the current transform.
void nvgScissor(NVGcontext* ctx, float x, float y, float w, float h);
// Intersects current scissor rectangle with the specified rectangle.
// The scissor rectangle is transformed by the current transform.
// Note: in case the rotation of previous scissor rect differs from
// the current one, the intersection will be done between the specified
// rectangle and the previous scissor rectangle transformed in the current
// transform space. The resulting shape is always rectangle.
void nvgIntersectScissor(NVGcontext* ctx, float x, float y, float w, float h);
// Reset and disables scissoring.
void nvgResetScissor(NVGcontext* ctx);
//
// Paths
//
// Drawing a new shape starts with nvgBeginPath(), it clears all the currently defined paths.
// Then you define one or more paths and sub-paths which describe the shape. The are functions
// to draw common shapes like rectangles and circles, and lower level step-by-step functions,
// which allow to define a path curve by curve.
//
// NanoVG uses even-odd fill rule to draw the shapes. Solid shapes should have counter clockwise
// winding and holes should have counter clockwise order. To specify winding of a path you can
// call nvgPathWinding(). This is useful especially for the common shapes, which are drawn CCW.
//
// Finally you can fill the path using current fill style by calling nvgFill(), and stroke it
// with current stroke style by calling nvgStroke().
//
// The curve segments and sub-paths are transformed by the current transform.
// Clears the current path and sub-paths.
void nvgBeginPath(NVGcontext* ctx);
// Starts new sub-path with specified point as first point.
void nvgMoveTo(NVGcontext* ctx, float x, float y);
// Adds line segment from the last point in the path to the specified point.
void nvgLineTo(NVGcontext* ctx, float x, float y);
// Adds cubic bezier segment from last point in the path via two control points to the specified point.
void nvgBezierTo(NVGcontext* ctx, float c1x, float c1y, float c2x, float c2y, float x, float y);
// Adds quadratic bezier segment from last point in the path via a control point to the specified point.
void nvgQuadTo(NVGcontext* ctx, float cx, float cy, float x, float y);
// Adds an arc segment at the corner defined by the last path point, and two specified points.
void nvgArcTo(NVGcontext* ctx, float x1, float y1, float x2, float y2, float radius);
// Closes current sub-path with a line segment.
void nvgClosePath(NVGcontext* ctx);
// Sets the current sub-path winding, see NVGwinding and NVGsolidity.
void nvgPathWinding(NVGcontext* ctx, int dir);
// Creates new circle arc shaped sub-path. The arc center is at cx,cy, the arc radius is r,
// and the arc is drawn from angle a0 to a1, and swept in direction dir (NVG_CCW, or NVG_CW).
// Angles are specified in radians.
void nvgArc(NVGcontext* ctx, float cx, float cy, float r, float a0, float a1, int dir);
// Creates new rectangle shaped sub-path.
void nvgRect(NVGcontext* ctx, float x, float y, float w, float h);
// Creates new rounded rectangle shaped sub-path.
void nvgRoundedRect(NVGcontext* ctx, float x, float y, float w, float h, float r);
// Creates new rounded rectangle shaped sub-path with varying radii for each corner.
void nvgRoundedRectVarying(NVGcontext* ctx, float x, float y, float w, float h, float radTopLeft, float radTopRight, float radBottomRight, float radBottomLeft);
// Creates new ellipse shaped sub-path.
void nvgEllipse(NVGcontext* ctx, float cx, float cy, float rx, float ry);
// Creates new circle shaped sub-path.
void nvgCircle(NVGcontext* ctx, float cx, float cy, float r);
// Fills the current path with current fill style.
void nvgFill(NVGcontext* ctx);
// Fills the current path with current stroke style.
void nvgStroke(NVGcontext* ctx);
//
// Text
//
// NanoVG allows you to load .ttf files and use the font to render text.
//
// The appearance of the text can be defined by setting the current text style
// and by specifying the fill color. Common text and font settings such as
// font size, letter spacing and text align are supported. Font blur allows you
// to create simple text effects such as drop shadows.
//
// At render time the font face can be set based on the font handles or name.
//
// Font measure functions return values in local space, the calculations are
// carried in the same resolution as the final rendering. This is done because
// the text glyph positions are snapped to the nearest pixels sharp rendering.
//
// The local space means that values are not rotated or scale as per the current
// transformation. For example if you set font size to 12, which would mean that
// line height is 16, then regardless of the current scaling and rotation, the
// returned line height is always 16. Some measures may vary because of the scaling
// since aforementioned pixel snapping.
//
// While this may sound a little odd, the setup allows you to always render the
// same way regardless of scaling. I.e. following works regardless of scaling:
//
// const char* txt = "Text me up.";
// nvgTextBounds(vg, x,y, txt, NULL, bounds);
// nvgBeginPath(vg);
// nvgRoundedRect(vg, bounds[0],bounds[1], bounds[2]-bounds[0], bounds[3]-bounds[1]);
// nvgFill(vg);
//
// Note: currently only solid color fill is supported for text.
// Creates font by loading it from the disk from specified file name.
// Returns handle to the font.
int nvgCreateFont(NVGcontext* ctx, const char* name, const char* filename);
// Creates font by loading it from the specified memory chunk.
// Returns handle to the font.
int nvgCreateFontMem(NVGcontext* ctx, const char* name, unsigned char* data, int ndata, int freeData);
// Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found.
int nvgFindFont(NVGcontext* ctx, const char* name);
// Adds a fallback font by handle.
int nvgAddFallbackFontId(NVGcontext* ctx, int baseFont, int fallbackFont);
// Adds a fallback font by name.
int nvgAddFallbackFont(NVGcontext* ctx, const char* baseFont, const char* fallbackFont);
// Sets the font size of current text style.
void nvgFontSize(NVGcontext* ctx, float size);
// Sets the blur of current text style.
void nvgFontBlur(NVGcontext* ctx, float blur);
// Sets the letter spacing of current text style.
void nvgTextLetterSpacing(NVGcontext* ctx, float spacing);
// Sets the proportional line height of current text style. The line height is specified as multiple of font size.
void nvgTextLineHeight(NVGcontext* ctx, float lineHeight);
// Sets the text align of current text style, see NVGalign for options.
void nvgTextAlign(NVGcontext* ctx, int align);
// Sets the font face based on specified id of current text style.
void nvgFontFaceId(NVGcontext* ctx, int font);
// Sets the font face based on specified name of current text style.
void nvgFontFace(NVGcontext* ctx, const char* font);
// Draws text string at specified location. If end is specified only the sub-string up to the end is drawn.
float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char* end);
// Draws multi-line text string at specified location wrapped at the specified width. If end is specified only the sub-string up to the end is drawn.
// White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered.
// Words longer than the max width are slit at nearest character (i.e. no hyphenation).
void nvgTextBox(NVGcontext* ctx, float x, float y, float breakRowWidth, const char* string, const char* end);
// Measures the specified text string. Parameter bounds should be a pointer to float[4],
// if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax]
// Returns the horizontal advance of the measured text (i.e. where the next character should drawn).
// Measured values are returned in local coordinate space.
float nvgTextBounds(NVGcontext* ctx, float x, float y, const char* string, const char* end, float* bounds);
// Measures the specified multi-text string. Parameter bounds should be a pointer to float[4],
// if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax]
// Measured values are returned in local coordinate space.
void nvgTextBoxBounds(NVGcontext* ctx, float x, float y, float breakRowWidth, const char* string, const char* end, float* bounds);
// Calculates the glyph x positions of the specified text. If end is specified only the sub-string will be used.
// Measured values are returned in local coordinate space.
int nvgTextGlyphPositions(NVGcontext* ctx, float x, float y, const char* string, const char* end, NVGglyphPosition* positions, int maxPositions);
// Returns the vertical metrics based on the current text style.
// Measured values are returned in local coordinate space.
void nvgTextMetrics(NVGcontext* ctx, float* ascender, float* descender, float* lineh);
// Breaks the specified text into lines. If end is specified only the sub-string will be used.
// White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered.
// Words longer than the max width are slit at nearest character (i.e. no hyphenation).
int nvgTextBreakLines(NVGcontext* ctx, const char* string, const char* end, float breakRowWidth, NVGtextRow* rows, int maxRows);
//
// Internal Render API
//
enum NVGtexture {
NVG_TEXTURE_ALPHA = 0x01,
NVG_TEXTURE_RGBA = 0x02,
};
struct NVGscissor {
float xform[6];
float extent[2];
};
typedef struct NVGscissor NVGscissor;
struct NVGvertex {
float x,y,u,v;
};
typedef struct NVGvertex NVGvertex;
struct NVGpath {
int first;
int count;
unsigned char closed;
int nbevel;
NVGvertex* fill;
int nfill;
NVGvertex* stroke;
int nstroke;
int winding;
int convex;
};
typedef struct NVGpath NVGpath;
struct NVGparams {
void* userPtr;
int edgeAntiAlias;
int (*renderCreate)(void* uptr);
int (*renderCreateTexture)(void* uptr, int type, int w, int h, int imageFlags, const unsigned char* data);
int (*renderDeleteTexture)(void* uptr, int image);
int (*renderUpdateTexture)(void* uptr, int image, int x, int y, int w, int h, const unsigned char* data);
int (*renderGetTextureSize)(void* uptr, int image, int* w, int* h);
void (*renderViewport)(void* uptr, int width, int height, float devicePixelRatio);
void (*renderCancel)(void* uptr);
void (*renderFlush)(void* uptr, NVGcompositeOperationState compositeOperation);
void (*renderFill)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, const float* bounds, const NVGpath* paths, int npaths);
void (*renderStroke)(void* uptr, NVGpaint* paint, NVGscissor* scissor, float fringe, float strokeWidth, const NVGpath* paths, int npaths);
void (*renderTriangles)(void* uptr, NVGpaint* paint, NVGscissor* scissor, const NVGvertex* verts, int nverts);
void (*renderDelete)(void* uptr);
};
typedef struct NVGparams NVGparams;
// Constructor and destructor, called by the render back-end.
NVGcontext* nvgCreateInternal(NVGparams* params);
void nvgDeleteInternal(NVGcontext* ctx);
NVGparams* nvgInternalParams(NVGcontext* ctx);
// Debug function to dump cached path data.
void nvgDebugDumpPathCache(NVGcontext* ctx);
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#define NVG_NOTUSED(v) for (;;) { (void)(1 ? (void)0 : ( (void)(v) ) ); break; }
#ifdef __cplusplus
}
#endif
#endif // NANOVG_H
| {
"pile_set_name": "Github"
} |
# Speechmatics in autoEdit
For sample speechmatics output see
- [`Aron_Pilhoper_ENG.mp4.1523232298328.json`](./Aron_Pilhoper_ENG.mp4.1523232298328.json)
- [`autoedit_json_expected_output.json`](./autoedit_json_expected_output.json)
- [`speechmatics_sample_output.json`](./speechmatics_sample_output.json)
You can also download the json of earlier transcription from their dashboard | {
"pile_set_name": "Github"
} |
import { SupportedProvider } from '@0x/dev-utils';
import { BigNumber, NULL_BYTES } from '@0x/utils';
import { SamplerOverrides } from '../../types';
import { ERC20BridgeSamplerContract } from '../../wrappers';
import { BalancerPoolsCache } from './balancer_utils';
import { BancorService } from './bancor_service';
import { SamplerOperations } from './sampler_operations';
import { BatchedOperation } from './types';
/**
* Generate sample amounts up to `maxFillAmount`.
*/
export function getSampleAmounts(maxFillAmount: BigNumber, numSamples: number, expBase: number = 1): BigNumber[] {
const distribution = [...Array<BigNumber>(numSamples)].map((_v, i) => new BigNumber(expBase).pow(i));
const stepSizes = distribution.map(d => d.div(BigNumber.sum(...distribution)));
const amounts = stepSizes.map((_s, i) => {
if (i === numSamples - 1) {
return maxFillAmount;
}
return maxFillAmount
.times(BigNumber.sum(...[0, ...stepSizes.slice(0, i + 1)]))
.integerValue(BigNumber.ROUND_UP);
});
return amounts;
}
type BatchedOperationResult<T> = T extends BatchedOperation<infer TResult> ? TResult : never;
/**
* Encapsulates interactions with the `ERC20BridgeSampler` contract.
*/
export class DexOrderSampler extends SamplerOperations {
constructor(
_samplerContract: ERC20BridgeSamplerContract,
private readonly _samplerOverrides?: SamplerOverrides,
provider?: SupportedProvider,
balancerPoolsCache?: BalancerPoolsCache,
getBancorServiceFn?: () => BancorService,
) {
super(_samplerContract, provider, balancerPoolsCache, getBancorServiceFn);
}
/* Type overloads for `executeAsync()`. Could skip this if we would upgrade TS. */
// prettier-ignore
public async executeAsync<
T1
>(...ops: [T1]): Promise<[
BatchedOperationResult<T1>
]>;
// prettier-ignore
public async executeAsync<
T1, T2
>(...ops: [T1, T2]): Promise<[
BatchedOperationResult<T1>,
BatchedOperationResult<T2>
]>;
// prettier-ignore
public async executeAsync<
T1, T2, T3
>(...ops: [T1, T2, T3]): Promise<[
BatchedOperationResult<T1>,
BatchedOperationResult<T2>,
BatchedOperationResult<T3>
]>;
// prettier-ignore
public async executeAsync<
T1, T2, T3, T4
>(...ops: [T1, T2, T3, T4]): Promise<[
BatchedOperationResult<T1>,
BatchedOperationResult<T2>,
BatchedOperationResult<T3>,
BatchedOperationResult<T4>
]>;
// prettier-ignore
public async executeAsync<
T1, T2, T3, T4, T5
>(...ops: [T1, T2, T3, T4, T5]): Promise<[
BatchedOperationResult<T1>,
BatchedOperationResult<T2>,
BatchedOperationResult<T3>,
BatchedOperationResult<T4>,
BatchedOperationResult<T5>
]>;
// prettier-ignore
public async executeAsync<
T1, T2, T3, T4, T5, T6
>(...ops: [T1, T2, T3, T4, T5, T6]): Promise<[
BatchedOperationResult<T1>,
BatchedOperationResult<T2>,
BatchedOperationResult<T3>,
BatchedOperationResult<T4>,
BatchedOperationResult<T5>,
BatchedOperationResult<T6>
]>;
// prettier-ignore
public async executeAsync<
T1, T2, T3, T4, T5, T6, T7
>(...ops: [T1, T2, T3, T4, T5, T6, T7]): Promise<[
BatchedOperationResult<T1>,
BatchedOperationResult<T2>,
BatchedOperationResult<T3>,
BatchedOperationResult<T4>,
BatchedOperationResult<T5>,
BatchedOperationResult<T6>,
BatchedOperationResult<T7>
]>;
// prettier-ignore
public async executeAsync<
T1, T2, T3, T4, T5, T6, T7, T8
>(...ops: [T1, T2, T3, T4, T5, T6, T7, T8]): Promise<[
BatchedOperationResult<T1>,
BatchedOperationResult<T2>,
BatchedOperationResult<T3>,
BatchedOperationResult<T4>,
BatchedOperationResult<T5>,
BatchedOperationResult<T6>,
BatchedOperationResult<T7>,
BatchedOperationResult<T8>
]>;
/**
* Run a series of operations from `DexOrderSampler.ops` in a single transaction.
*/
public async executeAsync(...ops: any[]): Promise<any[]> {
return this.executeBatchAsync(ops);
}
/**
* Run a series of operations from `DexOrderSampler.ops` in a single transaction.
* Takes an arbitrary length array, but is not typesafe.
*/
public async executeBatchAsync<T extends Array<BatchedOperation<any>>>(ops: T): Promise<any[]> {
const callDatas = ops.map(o => o.encodeCall());
const { overrides, block } = this._samplerOverrides
? this._samplerOverrides
: { overrides: undefined, block: undefined };
// All operations are NOOPs
if (callDatas.every(cd => cd === NULL_BYTES)) {
return callDatas.map((_callData, i) => ops[i].handleCallResults(NULL_BYTES));
}
// Execute all non-empty calldatas.
const rawCallResults = await this._samplerContract
.batchCall(callDatas.filter(cd => cd !== NULL_BYTES))
.callAsync({ overrides }, block);
// Return the parsed results.
let rawCallResultsIdx = 0;
return callDatas.map((callData, i) => {
const result = callData !== NULL_BYTES ? rawCallResults[rawCallResultsIdx++] : NULL_BYTES;
return ops[i].handleCallResults(result);
});
}
}
| {
"pile_set_name": "Github"
} |
# Microsoft Developer Studio Project File - Name="HookDll" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=HookDll - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "HookDll.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "HookDll.mak" CFG="HookDll - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "HookDll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "HookDll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "HookDll - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HOOKDLL_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HOOKDLL_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x813 /d "NDEBUG"
# ADD RSC /l 0x813 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
!ELSEIF "$(CFG)" == "HookDll - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HOOKDLL_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "HOOKDLL_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x813 /d "_DEBUG"
# ADD RSC /l 0x813 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "HookDll - Win32 Release"
# Name "HookDll - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\hook.c
# End Source File
# Begin Source File
SOURCE=.\log.c
# End Source File
# Begin Source File
SOURCE=.\maindll.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\hook.h
# End Source File
# Begin Source File
SOURCE=.\log.h
# End Source File
# Begin Source File
SOURCE=.\maindll.h
# End Source File
# Begin Source File
SOURCE=.\wlxloggedoutsas.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# Begin Source File
SOURCE=.\LDE32.OBJ
!IF "$(CFG)" == "HookDll - Win32 Release"
!ELSEIF "$(CFG)" == "HookDll - Win32 Debug"
!ENDIF
# End Source File
# End Target
# End Project
| {
"pile_set_name": "Github"
} |
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\base;
/**
* BootstrapInterface is the interface that should be implemented by classes who want to participate in the application bootstrap process.
*
* The main method [[bootstrap()]] will be invoked by an application at the beginning of its `init()` method.
*
* Bootstrapping classes can be registered in two approaches.
*
* The first approach is mainly used by extensions and is managed by the Composer installation process.
* You mainly need to list the bootstrapping class of your extension in the `composer.json` file like following,
*
* ```json
* {
* // ...
* "extra": {
* "bootstrap": "path\\to\\MyBootstrapClass"
* }
* }
* ```
*
* If the extension is installed, the bootstrap information will be saved in [[Application::extensions]].
*
* The second approach is used by application code which needs to register some code to be run during
* the bootstrap process. This is done by configuring the [[Application::bootstrap]] property:
*
* ```php
* return [
* // ...
* 'bootstrap' => [
* "path\\to\\MyBootstrapClass1",
* [
* 'class' => "path\\to\\MyBootstrapClass2",
* 'prop1' => 'value1',
* 'prop2' => 'value2',
* ],
* ],
* ];
* ```
*
* As you can see, you can register a bootstrapping class in terms of either a class name or a configuration class.
*
* For more details and usage information on BootstrapInterface, see the [guide article on bootstrapping applications](guide:structure-applications).
*
* @author Qiang Xue <[email protected]>
* @since 2.0
*/
interface BootstrapInterface
{
/**
* Bootstrap method to be called during application bootstrap stage.
* @param Application $app the application currently running
*/
public function bootstrap($app);
}
| {
"pile_set_name": "Github"
} |
REPLACE INTO collection_regexes (id, group_regex, regex, status, description, ordinal)
VALUES (
588,
'^alt\\.binaries\\.sounds\\.flac$',
'/^("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ \\(\\d+\\/\\d+\) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}\\[\\d+\\/(?P<match0>\\d+\\]).+www\\.EliteNZB\\.net.+[-_ ]{0,3}yEnc$/i',
1,
'"Jinsi_12187_v807.par2" [01/13] - The Elite Team Presents www.EliteNZB.net, Powered by 4UX.NL, Only The Best 4 You!!!! yEnc',
20
); | {
"pile_set_name": "Github"
} |
film.width = 960
film.height = 540
path.pathdepth.diffuse = 6
path.pathdepth.glossy = 6
path.pathdepth.specular = 12
path.pathdepth.total = 12
film.imagepipelines.0.0.type = "TONEMAP_LINEAR"
film.imagepipelines.0.1.type = "GAMMA_CORRECTION"
film.imagepipelines.0.1.value = 2.2
scene.file = "test.scn"
| {
"pile_set_name": "Github"
} |
---
name: Highcharts Demo
authors:
- Torstein Hønsi
exportInnerHTML: true
js_wrap: b
... | {
"pile_set_name": "Github"
} |
Func_f1ac6:
ld hl, Text_f1acd
call PrintText
ret
Text_f1acd:
TX_FAR _CeladonCityText10
db "@"
| {
"pile_set_name": "Github"
} |
//==------------------- findplatforms.hpp ----------------------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
bool findPlatformAndDevice(cl_device_type deviceType,
cl_platform_id &platformOut, cl_device_id &deviceOut) {
cl_uint numPlatforms;
cl_int errorCode;
errorCode = clGetPlatformIDs(0, nullptr, &numPlatforms);
if (errorCode != CL_SUCCESS) return false;
std::vector<cl_platform_id> platforms(numPlatforms);
errorCode = clGetPlatformIDs(numPlatforms, platforms.data(), nullptr);
if (errorCode != CL_SUCCESS) return false;
for (auto platform : platforms) {
cl_uint numDevices = 0;
errorCode =
clGetDeviceIDs(platform, deviceType, 0, nullptr, &numDevices);
// This has to check both codes because if a platform has 0 devices
// of deviceType, clGetPlatformIDs returns CL_DEVICE_NOT_FOUND.
// We don't want to bail yet as the next platform might have it.
// We bail out here if we see something other than those two error codes.
if (!(errorCode == CL_SUCCESS || errorCode == CL_DEVICE_NOT_FOUND))
return false;
if (numDevices) {
std::vector<cl_device_id> devices(numDevices);
errorCode = clGetDeviceIDs(platform, deviceType, numDevices,
devices.data(), nullptr);
if (errorCode != CL_SUCCESS) return false;
platformOut = platform;
deviceOut = devices[0];
return true;
}
}
return false;
}
| {
"pile_set_name": "Github"
} |
Pod::Spec.new do |s|
s.name = "Gloss"
s.version = "0.7.2"
s.summary = "A shiny JSON parsing library in Swift"
s.description = "A shiny JSON parsing library in Swift. Features include mapping JSON to objects, mapping objects to JSON, handling of nested objects and custom transformations."
s.homepage = "https://github.com/hkellaway/Gloss"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Harlan Kellaway" => "[email protected]" }
s.social_media_url = "http://twitter.com/HarlanKellaway"
s.source = { :git => "https://github.com/hkellaway/Gloss.git", :tag => s.version.to_s }
s.platforms = { :ios => "8.0", :osx => "10.9", :tvos => "9.0", :watchos => "2.0" }
s.requires_arc = true
s.source_files = 'Sources/*.{swift}'
end
| {
"pile_set_name": "Github"
} |
################################################################################
#
# libdvbsi
#
################################################################################
LIBDVBSI_VERSION = 0.3.6
LIBDVBSI_SOURCE = libdvbsi++-$(LIBDVBSI_VERSION).tar.bz2
LIBDVBSI_SITE = http://www.saftware.de/libdvbsi++
LIBDVBSI_INSTALL_STAGING = YES
LIBDVBSI_LICENSE = LGPLv2.1
LIBDVBSI_LICENSE_FILES = COPYING
# sometimes no Makefile is in the archive, just (re)generate
LIBDVBSI_AUTORECONF = YES
$(eval $(autotools-package))
| {
"pile_set_name": "Github"
} |
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Other licenses:
* -----------------------------------------------------------------------------
* Commercial licenses for this work are available. These replace the above
* ASL 2.0 and offer limited warranties, support, maintenance, and commercial
* database integrations.
*
* For more information, please visit: http://www.jooq.org/licenses
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.jooq;
import java.util.EventListener;
/**
* A listener for {@link Migration} lifecycles.
* <p>
* This is EXPERIMENTAL functionality and subject to change in future jOOQ
* versions.
*
* @author Lukas Eder
*/
@Internal
public interface MigrationListener extends EventListener {
/**
* Invoked at the start of a {@link Migration}.
*/
void migrationStart(MigrationContext ctx);
/**
* Invoked at the end of a {@link Migration}.
*/
void migrationEnd(MigrationContext ctx);
/**
* Invoked at the start of a set of {@link Queries} that describe a single version increment.
*/
void queriesStart(MigrationContext ctx);
/**
* Invoked at the end of a set of {@link Queries} that describe a single version increment.
*/
void queriesEnd(MigrationContext ctx);
/**
* Invoked at the start of an individual {@link Query}.
*/
void queryStart(MigrationContext ctx);
/**
* Invoked at the start of an individual {@link Query}.
*/
void queryEnd(MigrationContext ctx);
}
| {
"pile_set_name": "Github"
} |
/**
* Copyright 2019 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.ä
*/
'use strict';
require('module-alias/register');
const fs = require('fs');
const {join} = require('path');
const {project} = require('@lib/utils');
const yaml = require('js-yaml');
const {promisify} = require('util');
const writeFileAsync = promisify(fs.writeFile);
const {
GitHubImporter,
DEFAULT_ORGANISATION,
} = require('@lib/pipeline/gitHubImporter');
const log = require('@lib/utils/log')('Import Working Groups');
/* Path where the working group data gets imported to */
const WG_POD_PATH = 'content/amp-dev/community/working-groups';
/* Threshold for label background color from when color should switch to white */
const WG_LABEL_COLOR_THRESHOLD = 7500000;
/**
* Imports all data for a single working group and writes the results
* to the disk
* @param {GitHubImporter} client
* @param {Object} wg Repository information
* @return {Promise}
*/
async function _importWorkingGroup(client, wg) {
const name = wg.name.substr(3);
let meta = null;
try {
meta = await client.fetchFile(
'METADATA.yaml',
`${DEFAULT_ORGANISATION}/${wg.name}`
);
} catch (e) {
log.warn(`No METADATA.yaml for working group ${wg.name}`, e);
return Promise.resolve();
}
try {
meta = yaml.safeLoad(meta);
} catch (e) {
log.error(
`Failed loading ${DEFAULT_ORGANISATION}/${wg.name}/METADATA.yaml`,
e
);
return Promise.resolve();
}
let issues = (
await client._github
.repo(`${DEFAULT_ORGANISATION}/${wg.name}`)
.issuesAsync()
)[0];
issues = issues.map((issue) => {
const date = new Date(issue.created_at).toDateString();
const title = issue.title;
issue.labels = issue.labels.map((label) => {
const txtColor =
parseInt(`0x${label.color}`) < WG_LABEL_COLOR_THRESHOLD ? 'fff' : '000';
return {
'name': label.name,
'background_color': label.color,
'txt_color': txtColor,
};
});
return {
'title': title,
'html_url': issue.html_url,
'created_at': date,
'author': issue.user.login,
'number': issue.number,
'labels': issue.labels,
};
});
return Promise.all([
writeFileAsync(
join(project.paths.GROW_POD, `${WG_POD_PATH}/${name}.yaml`),
`${yaml.dump({
'$title': `Working Group: ${meta.title}`,
'$titles': {'navigation': 'Working Groups'},
})}` + `\ndata: !g.json ${WG_POD_PATH}/${name}.json`
),
writeFileAsync(
join(project.paths.GROW_POD, `${WG_POD_PATH}/${name}.json`),
JSON.stringify({
'html_url': wg.html_url,
'name': name,
'full_name': meta.title,
'facilitator': meta.facilitator,
'description': meta.description,
'issues': issues,
'members': meta.members || [],
'communication': meta.communication || [],
})
),
]).then(() => {
log.success('Imported working group data for:', wg.name);
});
}
async function importWorkingGroups() {
// Client is created here instead of module scope to prevent
// it being created when the task is only imported but never
// executed
const client = new GitHubImporter();
const repos = (
await client._github.org(DEFAULT_ORGANISATION).reposAsync(1, 100)
)[0];
log.start('Start importing Working Groups..');
return Promise.all(
repos.map((wg) => {
if (!wg.name.startsWith('wg-')) {
return Promise.resolve();
}
return _importWorkingGroup(client, wg);
})
);
}
exports.importWorkingGroups = importWorkingGroups;
| {
"pile_set_name": "Github"
} |
//===-- llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.h ----*- C++ -*--===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains support for writing line tables info into COFF files.
//
//===----------------------------------------------------------------------===//
#ifndef CODEGEN_ASMPRINTER_WINCODEVIEWLINETABLES_H__
#define CODEGEN_ASMPRINTER_WINCODEVIEWLINETABLES_H__
#include "AsmPrinterHandler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/LexicalScopes.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
namespace llvm {
/// \brief Collects and handles line tables information in a CodeView format.
class WinCodeViewLineTables : public AsmPrinterHandler {
AsmPrinter *Asm;
DebugLoc PrevInstLoc;
// For each function, store a vector of labels to its instructions, as well as
// to the end of the function.
struct FunctionInfo {
SmallVector<MCSymbol *, 10> Instrs;
MCSymbol *End;
FunctionInfo() : End(nullptr) {}
} *CurFn;
typedef DenseMap<const Function *, FunctionInfo> FnDebugInfoTy;
FnDebugInfoTy FnDebugInfo;
// Store the functions we've visited in a vector so we can maintain a stable
// order while emitting subsections.
SmallVector<const Function *, 10> VisitedFunctions;
// InstrInfoTy - Holds the Filename:LineNumber information for every
// instruction with a unique debug location.
struct InstrInfoTy {
StringRef Filename;
unsigned LineNumber;
InstrInfoTy() : LineNumber(0) {}
InstrInfoTy(StringRef Filename, unsigned LineNumber)
: Filename(Filename), LineNumber(LineNumber) {}
};
DenseMap<MCSymbol *, InstrInfoTy> InstrInfo;
// FileNameRegistry - Manages filenames observed while generating debug info
// by filtering out duplicates and bookkeeping the offsets in the string
// table to be generated.
struct FileNameRegistryTy {
SmallVector<StringRef, 10> Filenames;
struct PerFileInfo {
size_t FilenameID, StartOffset;
};
StringMap<PerFileInfo> Infos;
// The offset in the string table where we'll write the next unique
// filename.
size_t LastOffset;
FileNameRegistryTy() {
clear();
}
// Add Filename to the registry, if it was not observed before.
void add(StringRef Filename) {
if (Infos.count(Filename))
return;
size_t OldSize = Infos.size();
Infos[Filename].FilenameID = OldSize;
Infos[Filename].StartOffset = LastOffset;
LastOffset += Filename.size() + 1;
Filenames.push_back(Filename);
}
void clear() {
LastOffset = 1;
Infos.clear();
Filenames.clear();
}
} FileNameRegistry;
typedef std::map<std::pair<StringRef, StringRef>, char *>
DirAndFilenameToFilepathMapTy;
DirAndFilenameToFilepathMapTy DirAndFilenameToFilepathMap;
StringRef getFullFilepath(const MDNode *S);
void maybeRecordLocation(DebugLoc DL, const MachineFunction *MF);
void clear() {
assert(CurFn == nullptr);
FileNameRegistry.clear();
InstrInfo.clear();
}
void emitDebugInfoForFunction(const Function *GV);
public:
WinCodeViewLineTables(AsmPrinter *Asm);
~WinCodeViewLineTables() {
for (DirAndFilenameToFilepathMapTy::iterator
I = DirAndFilenameToFilepathMap.begin(),
E = DirAndFilenameToFilepathMap.end();
I != E; ++I)
free(I->second);
}
void setSymbolSize(const llvm::MCSymbol *, uint64_t) override {}
/// \brief Emit the COFF section that holds the line table information.
void endModule() override;
/// \brief Gather pre-function debug information.
void beginFunction(const MachineFunction *MF) override;
/// \brief Gather post-function debug information.
void endFunction(const MachineFunction *) override;
/// \brief Process beginning of an instruction.
void beginInstruction(const MachineInstr *MI) override;
/// \brief Process end of an instruction.
void endInstruction() override {}
};
} // End of namespace llvm
#endif
| {
"pile_set_name": "Github"
} |
:10FC000001C0DDC0112484B790E890936100109288
:10FC10006100882361F0982F9A70923041F081FF43
:10FC200002C097EF94BF282E80E0ECD0E9C185E0B8
:10FC30008093810082E08093C00088E18093C100BE
:10FC400081E08093C40086E08093C2008EE0DAD029
:10FC5000259A84E020E93FEF91E0309385002093DE
:10FC6000840096BBB09BFECF1D9AA8954091C00022
:10FC700047FD02C0815089F7B9D0813479F4B6D0FC
:10FC8000C82FC6D0C23811F480E004C088E0C13863
:10FC900009F083E0A4D080E1A2D0EECF823419F441
:10FCA00084E1BED0F8CF853411F485E0FACF8535F4
:10FCB00041F49CD0E82E9AD0F82EEE0CFF1CA8D070
:10FCC000EACF863519F484E0ABD0DECF843609F074
:10FCD00045C08CD0C82FD0E0DC2FCC2787D0C82BD4
:10FCE00085D0D82E5E01B39400E011E04801EFEF1B
:10FCF0008E1A9E0A7BD0F801808384018A149B04AB
:10FD0000A9F786D0F5E410E000E0DF1609F150E035
:10FD100040E063E0C70153D08701C12CDD24D394B8
:10FD2000F601419151916F0161E0C80148D00E5F29
:10FD30001F4F2297A9F750E040E065E0C7013FD090
:10FD4000AACF6081C8018E0D9F1D79D00F5F1F4F14
:10FD5000F801F395C017D107A1F79DCF843701F5BE
:10FD600045D0C82FD0E0DC2FCC2740D0C82B3ED0C8
:10FD7000D82E4ED08701F5E4DF120BC0CE0DDF1D6B
:10FD8000C80155D02CD00F5F1F4FC017D107C1F746
:10FD900082CFF80185918F0122D02197D1F77BCFB7
:10FDA000853739F435D08EE11AD086E918D085E050
:10FDB00071CF813509F083CF88E024D080CFFC015A
:10FDC0000A0167BFE895112407B600FCFDCF6670F5
:10FDD00029F0452B19F481E187BFE89508959091AA
:10FDE000C00095FFFCCF8093C60008958091C000AD
:10FDF00087FFFCCF8091C00084FD01C0A895809151
:10FE0000C6000895E0E6F0E098E1908380830895CD
:10FE1000EDDF803219F088E0F5DFFFCF84E1DFCF3E
:10FE2000CF93C82FE3DFC150E9F7CF91F1CFF99914
:10FE3000FECF92BD81BDF89A992780B50895262FEF
:10FE4000F999FECF92BD81BD20BD0FB6F894FA9A04
:08FE5000F99A0FBE0196089516
:02FFFE000008F9
:040000030000FC00FD
:00000001FF
| {
"pile_set_name": "Github"
} |
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{19575E10-6B8E-4CF0-B7D2-898FFF47E157}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
CHANGELOG.md = CHANGELOG.md
global.json = global.json
LICENSE.txt = LICENSE.txt
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{3FE10516-C056-4337-9C9A-5FD592430F87}"
ProjectSection(SolutionItems) = preProject
build\common.props = build\common.props
build\nuget-common.props = build\nuget-common.props
build\nuget-metadata.props = build\nuget-metadata.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "licenses", "licenses", "{4AB5950E-3FA8-4A77-A067-F325BFD80537}"
ProjectSection(SolutionItems) = preProject
Licenses\advanced-string-builder-license.txt = Licenses\advanced-string-builder-license.txt
Licenses\chakra-core-license.txt = Licenses\chakra-core-license.txt
Licenses\chakra-samples-license.txt = Licenses\chakra-samples-license.txt
Licenses\clearscript-license.txt = Licenses\clearscript-license.txt
Licenses\jint-license.txt = Licenses\jint-license.txt
Licenses\jsrt-dotnet-license.txt = Licenses\jsrt-dotnet-license.txt
Licenses\jurassic-license.txt = Licenses\jurassic-license.txt
Licenses\msie-javascript-engine-license.txt = Licenses\msie-javascript-engine-license.txt
Licenses\nil-license.txt = Licenses\nil-license.txt
Licenses\polyfills-for-old-dot-net-license.txt = Licenses\polyfills-for-old-dot-net-license.txt
Licenses\v8-license.txt = Licenses\v8-license.txt
Licenses\vroomjs-core-license.txt = Licenses\vroomjs-core-license.txt
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0C281F46-F1D2-4A1C-8560-375EDA65D680}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{53B43213-2E66-42C2-8476-600A2FD2DA75}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Core", "src\JavaScriptEngineSwitcher.Core\JavaScriptEngineSwitcher.Core.csproj", "{13559975-F99D-4B93-BF46-227C0B6E0DFB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Extensions.MsDependencyInjection", "src\JavaScriptEngineSwitcher.Extensions.MsDependencyInjection\JavaScriptEngineSwitcher.Extensions.MsDependencyInjection.csproj", "{5B693A49-BEC2-4532-ADFE-80C4AA930E27}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Msie", "src\JavaScriptEngineSwitcher.Msie\JavaScriptEngineSwitcher.Msie.csproj", "{B3C4AA95-2227-47DD-B58C-22FA589CB28D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8", "src\JavaScriptEngineSwitcher.V8\JavaScriptEngineSwitcher.V8.csproj", "{C24E1F3C-5680-463A-8703-B9F40BCDAC77}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8.Native.win-x86", "src\JavaScriptEngineSwitcher.V8.Native.win-x86\JavaScriptEngineSwitcher.V8.Native.win-x86.csproj", "{1739A011-164B-4227-B540-01BAD61F17C5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.V8.Native.win-x64", "src\JavaScriptEngineSwitcher.V8.Native.win-x64\JavaScriptEngineSwitcher.V8.Native.win-x64.csproj", "{4FB64080-817F-468A-B92C-F63B46E6D85F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Jurassic", "src\JavaScriptEngineSwitcher.Jurassic\JavaScriptEngineSwitcher.Jurassic.csproj", "{D31B5A77-8018-4D76-B372-325564385B2D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Jint", "src\JavaScriptEngineSwitcher.Jint\JavaScriptEngineSwitcher.Jint.csproj", "{22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore", "src\JavaScriptEngineSwitcher.ChakraCore\JavaScriptEngineSwitcher.ChakraCore.csproj", "{2EFFFC6B-E642-477F-B537-4241EBD93410}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.win-x86", "src\JavaScriptEngineSwitcher.ChakraCore.Native.win-x86\JavaScriptEngineSwitcher.ChakraCore.Native.win-x86.csproj", "{F676D869-5715-46B0-A118-A162D9C9DEC6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.win-x64", "src\JavaScriptEngineSwitcher.ChakraCore.Native.win-x64\JavaScriptEngineSwitcher.ChakraCore.Native.win-x64.csproj", "{D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.win-arm", "src\JavaScriptEngineSwitcher.ChakraCore.Native.win-arm\JavaScriptEngineSwitcher.ChakraCore.Native.win-arm.csproj", "{BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64", "src\JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64\JavaScriptEngineSwitcher.ChakraCore.Native.win-arm64.csproj", "{304EEE7F-005D-4335-80AB-DB29025740B1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64", "src\JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64\JavaScriptEngineSwitcher.ChakraCore.Native.linux-x64.csproj", "{FF77615B-4182-4BE7-AE2B-0F9F75198490}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64", "src\JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64\JavaScriptEngineSwitcher.ChakraCore.Native.osx-x64.csproj", "{E14C4086-9877-4658-AE39-6313039A9076}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Vroom", "src\JavaScriptEngineSwitcher.Vroom\JavaScriptEngineSwitcher.Vroom.csproj", "{238D7E69-7052-4DFC-83EF-79D3D124C12B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.NiL", "src\JavaScriptEngineSwitcher.NiL\JavaScriptEngineSwitcher.NiL.csproj", "{F0BF7975-2E8A-4EC8-8DAA-760A4302F419}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Node", "src\JavaScriptEngineSwitcher.Node\JavaScriptEngineSwitcher.Node.csproj", "{89F9DDDD-5236-4D9A-99E4-3C1358B81149}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Benchmarks", "test\JavaScriptEngineSwitcher.Benchmarks\JavaScriptEngineSwitcher.Benchmarks.csproj", "{24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JavaScriptEngineSwitcher.Tests", "test\JavaScriptEngineSwitcher.Tests\JavaScriptEngineSwitcher.Tests.csproj", "{E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{13559975-F99D-4B93-BF46-227C0B6E0DFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13559975-F99D-4B93-BF46-227C0B6E0DFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13559975-F99D-4B93-BF46-227C0B6E0DFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13559975-F99D-4B93-BF46-227C0B6E0DFB}.Release|Any CPU.Build.0 = Release|Any CPU
{5B693A49-BEC2-4532-ADFE-80C4AA930E27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B693A49-BEC2-4532-ADFE-80C4AA930E27}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B693A49-BEC2-4532-ADFE-80C4AA930E27}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5B693A49-BEC2-4532-ADFE-80C4AA930E27}.Release|Any CPU.Build.0 = Release|Any CPU
{B3C4AA95-2227-47DD-B58C-22FA589CB28D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B3C4AA95-2227-47DD-B58C-22FA589CB28D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3C4AA95-2227-47DD-B58C-22FA589CB28D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B3C4AA95-2227-47DD-B58C-22FA589CB28D}.Release|Any CPU.Build.0 = Release|Any CPU
{C24E1F3C-5680-463A-8703-B9F40BCDAC77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C24E1F3C-5680-463A-8703-B9F40BCDAC77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C24E1F3C-5680-463A-8703-B9F40BCDAC77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C24E1F3C-5680-463A-8703-B9F40BCDAC77}.Release|Any CPU.Build.0 = Release|Any CPU
{1739A011-164B-4227-B540-01BAD61F17C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1739A011-164B-4227-B540-01BAD61F17C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1739A011-164B-4227-B540-01BAD61F17C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1739A011-164B-4227-B540-01BAD61F17C5}.Release|Any CPU.Build.0 = Release|Any CPU
{4FB64080-817F-468A-B92C-F63B46E6D85F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FB64080-817F-468A-B92C-F63B46E6D85F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FB64080-817F-468A-B92C-F63B46E6D85F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FB64080-817F-468A-B92C-F63B46E6D85F}.Release|Any CPU.Build.0 = Release|Any CPU
{D31B5A77-8018-4D76-B372-325564385B2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D31B5A77-8018-4D76-B372-325564385B2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D31B5A77-8018-4D76-B372-325564385B2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D31B5A77-8018-4D76-B372-325564385B2D}.Release|Any CPU.Build.0 = Release|Any CPU
{22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA}.Release|Any CPU.Build.0 = Release|Any CPU
{2EFFFC6B-E642-477F-B537-4241EBD93410}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2EFFFC6B-E642-477F-B537-4241EBD93410}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2EFFFC6B-E642-477F-B537-4241EBD93410}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2EFFFC6B-E642-477F-B537-4241EBD93410}.Release|Any CPU.Build.0 = Release|Any CPU
{F676D869-5715-46B0-A118-A162D9C9DEC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F676D869-5715-46B0-A118-A162D9C9DEC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F676D869-5715-46B0-A118-A162D9C9DEC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F676D869-5715-46B0-A118-A162D9C9DEC6}.Release|Any CPU.Build.0 = Release|Any CPU
{D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5}.Release|Any CPU.Build.0 = Release|Any CPU
{BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812}.Release|Any CPU.Build.0 = Release|Any CPU
{FF77615B-4182-4BE7-AE2B-0F9F75198490}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF77615B-4182-4BE7-AE2B-0F9F75198490}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF77615B-4182-4BE7-AE2B-0F9F75198490}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF77615B-4182-4BE7-AE2B-0F9F75198490}.Release|Any CPU.Build.0 = Release|Any CPU
{E14C4086-9877-4658-AE39-6313039A9076}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E14C4086-9877-4658-AE39-6313039A9076}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E14C4086-9877-4658-AE39-6313039A9076}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E14C4086-9877-4658-AE39-6313039A9076}.Release|Any CPU.Build.0 = Release|Any CPU
{238D7E69-7052-4DFC-83EF-79D3D124C12B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{238D7E69-7052-4DFC-83EF-79D3D124C12B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{238D7E69-7052-4DFC-83EF-79D3D124C12B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{238D7E69-7052-4DFC-83EF-79D3D124C12B}.Release|Any CPU.Build.0 = Release|Any CPU
{F0BF7975-2E8A-4EC8-8DAA-760A4302F419}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F0BF7975-2E8A-4EC8-8DAA-760A4302F419}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F0BF7975-2E8A-4EC8-8DAA-760A4302F419}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F0BF7975-2E8A-4EC8-8DAA-760A4302F419}.Release|Any CPU.Build.0 = Release|Any CPU
{89F9DDDD-5236-4D9A-99E4-3C1358B81149}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{89F9DDDD-5236-4D9A-99E4-3C1358B81149}.Debug|Any CPU.Build.0 = Debug|Any CPU
{89F9DDDD-5236-4D9A-99E4-3C1358B81149}.Release|Any CPU.ActiveCfg = Release|Any CPU
{89F9DDDD-5236-4D9A-99E4-3C1358B81149}.Release|Any CPU.Build.0 = Release|Any CPU
{24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE}.Release|Any CPU.Build.0 = Release|Any CPU
{E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF}.Release|Any CPU.Build.0 = Release|Any CPU
{304EEE7F-005D-4335-80AB-DB29025740B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{304EEE7F-005D-4335-80AB-DB29025740B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{304EEE7F-005D-4335-80AB-DB29025740B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{304EEE7F-005D-4335-80AB-DB29025740B1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{13559975-F99D-4B93-BF46-227C0B6E0DFB} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{5B693A49-BEC2-4532-ADFE-80C4AA930E27} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{B3C4AA95-2227-47DD-B58C-22FA589CB28D} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{C24E1F3C-5680-463A-8703-B9F40BCDAC77} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{1739A011-164B-4227-B540-01BAD61F17C5} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{4FB64080-817F-468A-B92C-F63B46E6D85F} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{D31B5A77-8018-4D76-B372-325564385B2D} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{22D73C6E-5F35-497B-A93B-F9EAAAE4DDAA} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{2EFFFC6B-E642-477F-B537-4241EBD93410} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{F676D869-5715-46B0-A118-A162D9C9DEC6} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{D2B4F490-E7A6-40A8-808E-6D7A30D3EBF5} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{BB7BE2DF-C68C-4F82-8BAB-79A16D9AB812} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{FF77615B-4182-4BE7-AE2B-0F9F75198490} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{E14C4086-9877-4658-AE39-6313039A9076} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{238D7E69-7052-4DFC-83EF-79D3D124C12B} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{F0BF7975-2E8A-4EC8-8DAA-760A4302F419} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{89F9DDDD-5236-4D9A-99E4-3C1358B81149} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
{24A8F6A6-EA4E-43A6-A2D7-E1916F8CB4EE} = {53B43213-2E66-42C2-8476-600A2FD2DA75}
{E95FDEF6-18A0-4E26-8FDF-B4B590E6EDAF} = {53B43213-2E66-42C2-8476-600A2FD2DA75}
{304EEE7F-005D-4335-80AB-DB29025740B1} = {0C281F46-F1D2-4A1C-8560-375EDA65D680}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8184BE59-ACBC-4CD1-9419-D59A0FAC6131}
EndGlobalSection
EndGlobal
| {
"pile_set_name": "Github"
} |
// SL 2020-05
$$SSD1351=1
$include('../common/oled.ice')
// -------------------------
$$dofile('pre_do_doomhead.lua')
// -------------------------
algorithm oled_doomhead(
output uint1 oled_din,
output uint1 oled_clk,
output uint1 oled_cs,
output uint1 oled_dc,
output uint1 oled_rst,
) {
// write down the code for the doomhead data
$doomhead$
// palette
uint18 palette[256] = {
$$ for i=1,256 do
18h$string.format("%05x",palette_666[i]):sub(-5)$,
$$ end
};
uint3 frame = 0;
uint3 count = 0;
uint32 nfo = 0;
uint12 rand = 3137;
oledio io;
oled display(
oled_mosi :> oled_din,
oled_clk :> oled_clk,
oled_csn :> oled_cs,
oled_dc :> oled_dc,
oled_resn :> oled_rst,
io <:> io
);
// maintain low (pulses high when sending)
io.start_rect := 0;
io.next_pixel := 0;
while (1) {
uint8 u = uninitialized;
uint8 v = uninitialized;
// wait for controller to be ready
while (io.ready == 0) { }
// draw frame
nfo = doomface_nfo[frame];
io.x_start = 0;
io.x_end = (nfo[16,8]<<2)-1;
io.y_start = 0;
io.y_end = (nfo[24,8]<<2)-1;
io.start_rect = 1;
while (io.ready == 0) { }
doomhead.addr = nfo[0,16];
v = 0;
while (v < nfo[24,8]) {
uint4 repeat = uninitialized;
uint16 ptr = uninitialized;
repeat = 0;
ptr = doomhead.addr;
while (repeat < 4) { // draw line four times
u = 0;
doomhead.addr = ptr;
while (u < nfo[16,8]) {
// send pixel x4
io.color = palette[doomhead.rdata];
io.next_pixel = 1;
while (io.ready == 0) { }
io.next_pixel = 1;
while (io.ready == 0) { }
io.next_pixel = 1;
while (io.ready == 0) { }
io.next_pixel = 1;
while (io.ready == 0) { }
u = u + 1;
doomhead.addr = doomhead.addr + 1;
}
repeat = repeat + 1;
}
v = v + 1;
}
if ((count&7) == 0) {
rand = rand * 31421 + 6927;
if (rand < 2048) {
frame = 0;
} else {
if (rand < $2048+1024$) {
frame = 1;
} else {
frame = 2;
}
}
}
count = count + 1;
}
}
// -------------------------
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2019 Emeric Poupon
*
* This file is part of LMS.
*
* LMS 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.
*
* LMS 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 LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <optional>
#include <string>
#include <boost/asio/ip/address.hpp>
#include "database/User.hpp"
#include "database/Types.hpp"
namespace Database
{
class Session;
}
namespace Auth {
class IPasswordService
{
public:
virtual ~IPasswordService() = default;
// Password services
enum class PasswordCheckResult
{
Match,
Mismatch,
Throttled,
};
virtual bool isAuthModeSupported(Database::User::AuthMode authMode) const = 0;
virtual PasswordCheckResult checkUserPassword(Database::Session& session, const boost::asio::ip::address& clientAddress, const std::string& loginName, const std::string& password) = 0;
virtual Database::User::PasswordHash hashPassword(const std::string& password) const = 0;
virtual bool evaluatePasswordStrength(const std::string& loginName, const std::string& password) const = 0;
};
std::unique_ptr<IPasswordService> createPasswordService(std::size_t maxThrottlerEntryCount);
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>database-oop</artifactId>
<groupId>database-oop</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>oracle-oop</artifactId>
<properties>
<junit.version>4.11</junit.version>
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<surefire-plugin.version>2.19.1</surefire-plugin.version>
</properties>
<dependencies>
<!--单元测试-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<!--打包发布的nexus仓库地址-->
<distributionManagement>
<snapshotRepository>
<id>my-nexus-snapshots</id>
<name>User Porject Snapshot</name>
<url>http://localhost:8081/nexus/content/repositories/my-nexus-snapshots</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
<repository>
<id>my-nexus-releases</id>
<name>User Porject Release</name>
<url>http://localhost:8081/nexus/content/repositories/my-nexus-releases</url>
</repository>
</distributionManagement>
<!--设置项目编译级别等设置 start-->
<build>
<!-- 打包的时候将资源文件打进来,不写这个是不行的 -->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>src/main/resources</directory>
<!-- the list has a default value of ** -->
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<plugins>
<!--surefire-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<!--source-->
<plugin>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!--设置项目编译级别等设置 end-->
</project> | {
"pile_set_name": "Github"
} |
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import App from 'components/App';
import './index.css';
import registerServiceWorker from 'registerServiceWorker';
ReactDOM.render(
<App />,
document.getElementById('root') as HTMLElement
);
registerServiceWorker();
| {
"pile_set_name": "Github"
} |
/* termios output mode definitions. Linux/powerpc version.
Copyright (C) 2019-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C 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.
The GNU C 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 the GNU C Library. If not, see
<https://www.gnu.org/licenses/>. */
#ifndef _TERMIOS_H
# error "Never include <bits/termios-c_oflag.h> directly; use <termios.h> instead."
#endif
/* c_oflag bits */
#define OPOST 0000001
#define ONLCR 0000002
#define OLCUC 0000004
#define OCRNL 0000010
#define ONOCR 0000020
#define ONLRET 0000040
#define OFILL 00000100
#define OFDEL 00000200
#if defined __USE_MISC || defined __USE_XOPEN
# define NLDLY 00001400
# define NL0 00000000
# define NL1 00000400
# if defined __USE_MISC
# define NL2 00001000
# define NL3 00001400
# endif
# define TABDLY 00006000
# define TAB0 00000000
# define TAB1 00002000
# define TAB2 00004000
# define TAB3 00006000
# define CRDLY 00030000
# define CR0 00000000
# define CR1 00010000
# define CR2 00020000
# define CR3 00030000
# define FFDLY 00040000
# define FF0 00000000
# define FF1 00040000
# define BSDLY 00100000
# define BS0 00000000
# define BS1 00100000
#endif
#define VTDLY 00200000
#define VT0 00000000
#define VT1 00200000
#ifdef __USE_MISC
# define XTABS 00006000
#endif | {
"pile_set_name": "Github"
} |
// ***************************************************************************
// *
// * Copyright (C) 2014 International Business Machines
// * Corporation and others. All Rights Reserved.
// * Tool: org.unicode.cldr.icu.NewLdml2IcuConverter
// * Source File: <path>/icu-locale-deprecates.xml & build.xml
// *
// ***************************************************************************
sh{
"%%ALIAS"{"sr_Latn"}
}
| {
"pile_set_name": "Github"
} |
#include <ExplicitTriangulation.h>
using namespace std;
using namespace ttk;
ExplicitTriangulation::ExplicitTriangulation() {
setDebugMsgPrefix("ExplicitTriangulation");
clear();
}
ExplicitTriangulation::~ExplicitTriangulation() {
}
int ExplicitTriangulation::clear() {
AbstractTriangulation::clear();
vertexNumber_ = 0;
cellNumber_ = 0;
doublePrecision_ = false;
printMsg(
"[ExplicitTriangulation] Triangulation cleared.", debug::Priority::DETAIL);
// clear twice ??
return AbstractTriangulation::clear();
}
| {
"pile_set_name": "Github"
} |
# Event 238 - task_0
###### Version: 0
## Description
None
## Data Dictionary
|Standard Name|Field Name|Type|Description|Sample Value|
|---|---|---|---|---|
|TBD|ErrorCode|UInt32|None|`None`|
## Tags
* etw_level_Informational
* etw_task_task_0 | {
"pile_set_name": "Github"
} |
// Author: Alexander Thomson ([email protected])
#include "common/configuration.h"
#include "common/testing.h"
// common/configuration_test.conf:
// # Node<id>=<replica>:<partition>:<cores>:<host>:<port>
// node1=0:1:16:128.36.232.50:50001
// node2=0:2:16:128.36.232.50:50002
TEST(ConfigurationTest_ReadFromFile) {
Configuration config(1, "common/configuration_test.conf");
EXPECT_EQ(1, config.this_node_id);
EXPECT_EQ(2, config.all_nodes.size()); // 2 Nodes, node13 and node23.
EXPECT_EQ(1, config.all_nodes[1]->node_id);
EXPECT_EQ(50001, config.all_nodes[1]->port);
EXPECT_EQ(2, config.all_nodes[2]->node_id);
EXPECT_EQ(string("128.36.232.50"), config.all_nodes[2]->host);
END;
}
// TODO(alex): Write proper test once partitioning is implemented.
TEST(ConfigurationTest_LookupPartition) {
Configuration config(1, "common/configuration_test.conf");
EXPECT_EQ(0, config.LookupPartition(Key("0")));
END;
}
int main(int argc, char** argv) {
ConfigurationTest_ReadFromFile();
ConfigurationTest_LookupPartition();
}
| {
"pile_set_name": "Github"
} |
'use strict';
// 获取全局应用程序实例对象
var app = getApp();
// 创建页面实例对象
Page({
/**
* 页面的初始数据
*/
data: {
randomName: 'MY LOVE',
randomRemark: '你的小可爱',
soundUrl: 'https://c.jiangwenqiang.com/music/glgl.mp3'
},
inputValue: function inputValue(e) {
if (e.currentTarget.dataset.type === 'remark') {
this.setData({
randomRemark: e.detail.value
});
} else {
this.setData({
randomName: e.detail.value
});
}
},
jumpCall: function jumpCall() {
wx.navigateTo({
url: '../call/call?randomName=' + this.data.randomName + '&randomRemark=' + this.data.randomRemark + '&soundUrl=' + this.data.soundUrl + '&type=needback'
});
},
backIndex: function backIndex() {
wx.reLaunch({
url: '/pages/index/index'
});
},
getPhoneData: function getPhoneData() {
var that = this;
app.wxrequest({
url: app.data.baseDomain + '/api/phone.json',
success: function success(res) {
var index = Math.floor(Math.random() * res.data.data.length);
that.setData({
audioArr: res.data.data,
audioIndex: index,
randomName: res.data.data[index].caller_name,
randomRemark: res.data.data[index].remark,
soundUrl: res.data.data[index].url
});
}
});
},
bindPickerChange: function bindPickerChange(e) {
this.setData({
audioIndex: e.detail.value,
randomName: this.data.audioArr[e.detail.value].caller_name,
randomRemark: this.data.audioArr[e.detail.value].remark,
soundUrl: this.data.audioArr[e.detail.value].url
});
},
setRandom: function setRandom() {
var index = Math.floor(Math.random() * this.data.audioArr.length);
this.setData({
audioIndex: index,
randomName: this.data.audioArr[index].caller_name,
randomRemark: this.data.audioArr[index].remark,
soundUrl: this.data.audioArr[index].url
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function onLoad() {
this.getPhoneData();
// TODO: onLoad
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function onReady() {
// TODO: onReady
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function onShow() {
// TODO: onShow
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function onHide() {
// TODO: onHide
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function onUnload() {
// TODO: onUnload
},
onShareAppMessage: function onShareAppMessage() {
return {
title: '您有一个好友来电请接听',
path: '/pagesOne/pages/call/call?randomName=' + this.data.randomName + '&randomRemark=' + this.data.randomRemark + '&soundUrl=' + this.data.soundUrl,
imageUrl: 'https://7465-teach-1258324355.tcb.qcloud.la/image/phone.png'
};
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function onPullDownRefresh() {
// TODO: onPullDownRefresh
}
});
//# sourceMappingURL=phone.js.map
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.