text
stringlengths 2
100k
| meta
dict |
---|---|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import <SAObjects/SAAbstractItemList.h>
@interface SALocalSearchMapItemList : SAAbstractItemList
{
}
+ (id)mapItemListWithDictionary:(id)arg1 context:(id)arg2;
+ (id)mapItemList;
- (id)encodedClassName;
- (id)groupIdentifier;
@end
| {
"pile_set_name": "Github"
} |
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab ft=cpp
#include <string.h>
#include <iostream>
#include <map>
#include <expat.h>
#include "include/types.h"
#include "include/utime.h"
#include "rgw_xml.h"
XMLObjIter::
XMLObjIter()
{
}
XMLObjIter::
~XMLObjIter()
{
}
void XMLObjIter::
set(const XMLObjIter::map_iter_t &_cur, const XMLObjIter::map_iter_t &_end)
{
cur = _cur;
end = _end;
}
XMLObj *XMLObjIter::
get_next()
{
XMLObj *obj = NULL;
if (cur != end) {
obj = cur->second;
++cur;
}
return obj;
}
bool XMLObjIter::get_name(std::string& name) const
{
if (cur == end) {
return false;
}
name = cur->first;
return true;
}
ostream& operator<<(ostream &out, const XMLObj &obj) {
out << obj.obj_type << ": " << obj.data;
return out;
}
XMLObj::
~XMLObj()
{
}
bool XMLObj::
xml_start(XMLObj *parent, const char *el, const char **attr)
{
this->parent = parent;
obj_type = el;
for (int i = 0; attr[i]; i += 2) {
attr_map[attr[i]] = std::string(attr[i + 1]);
}
return true;
}
bool XMLObj::
xml_end(const char *el)
{
return true;
}
void XMLObj::
xml_handle_data(const char *s, int len)
{
data.append(s, len);
}
const std::string& XMLObj::
XMLObj::get_data() const
{
return data;
}
const std::string& XMLObj::
XMLObj::get_obj_type() const
{
return obj_type;
}
XMLObj *XMLObj::
XMLObj::get_parent()
{
return parent;
}
void XMLObj::
add_child(const std::string& el, XMLObj *obj)
{
children.insert(std::pair<std::string, XMLObj *>(el, obj));
}
bool XMLObj::
get_attr(const std::string& name, std::string& attr) const
{
const std::map<std::string, std::string>::const_iterator iter = attr_map.find(name);
if (iter == attr_map.end())
return false;
attr = iter->second;
return true;
}
XMLObjIter XMLObj::
find(const std::string& name)
{
XMLObjIter iter;
const XMLObjIter::const_map_iter_t first = children.find(name);
XMLObjIter::const_map_iter_t last;
if (first != children.end()) {
last = children.upper_bound(name);
}else
last = children.end();
iter.set(first, last);
return iter;
}
XMLObjIter XMLObj::find_first()
{
XMLObjIter iter;
const XMLObjIter::const_map_iter_t first = children.begin();
const XMLObjIter::const_map_iter_t last = children.end();
iter.set(first, last);
return iter;
}
XMLObj *XMLObj::
find_first(const std::string& name)
{
const XMLObjIter::const_map_iter_t first = children.find(name);
if (first != children.end())
return first->second;
return nullptr;
}
RGWXMLParser::
RGWXMLParser() : buf(nullptr), buf_len(0), cur_obj(nullptr), success(true), init_called(false)
{
p = XML_ParserCreate(nullptr);
}
RGWXMLParser::
~RGWXMLParser()
{
XML_ParserFree(p);
free(buf);
std::list<XMLObj *>::const_iterator iter;
for (iter = allocated_objs.begin(); iter != allocated_objs.end(); ++iter) {
XMLObj *obj = *iter;
delete obj;
}
}
void RGWXMLParser::call_xml_start(void* user_data, const char *el, const char **attr) {
RGWXMLParser *handler = static_cast<RGWXMLParser *>(user_data);
XMLObj * obj = handler->alloc_obj(el);
if (!obj) {
handler->unallocated_objs.push_back(XMLObj());
obj = &handler->unallocated_objs.back();
} else {
handler->allocated_objs.push_back(obj);
}
if (!obj->xml_start(handler->cur_obj, el, attr)) {
handler->success = false;
return;
}
if (handler->cur_obj) {
handler->cur_obj->add_child(el, obj);
} else {
handler->children.insert(std::pair<std::string, XMLObj *>(el, obj));
}
handler->cur_obj = obj;
handler->objs.push_back(obj);
}
void RGWXMLParser::call_xml_end(void* user_data, const char *el) {
RGWXMLParser *handler = static_cast<RGWXMLParser *>(user_data);
XMLObj *parent_obj = handler->cur_obj->get_parent();
if (!handler->cur_obj->xml_end(el)) {
handler->success = false;
return;
}
handler->cur_obj = parent_obj;
}
void RGWXMLParser::call_xml_handle_data(void* user_data, const char *s, int len)
{
RGWXMLParser *handler = static_cast<RGWXMLParser *>(user_data);
handler->cur_obj->xml_handle_data(s, len);
}
bool RGWXMLParser::init()
{
if (!p) {
return false;
}
init_called = true;
XML_SetElementHandler(p, RGWXMLParser::call_xml_start, RGWXMLParser::call_xml_end);
XML_SetCharacterDataHandler(p, RGWXMLParser::call_xml_handle_data);
XML_SetUserData(p, (void *)this);
return true;
}
bool RGWXMLParser::parse(const char *_buf, int len, int done)
{
ceph_assert(init_called);
int pos = buf_len;
char *tmp_buf;
tmp_buf = (char *)realloc(buf, buf_len + len);
if (tmp_buf == NULL){
free(buf);
buf = NULL;
return false;
} else {
buf = tmp_buf;
}
memcpy(&buf[buf_len], _buf, len);
buf_len += len;
success = true;
if (!XML_Parse(p, &buf[pos], len, done)) {
fprintf(stderr, "Parse error at line %d:\n%s\n",
(int)XML_GetCurrentLineNumber(p),
XML_ErrorString(XML_GetErrorCode(p)));
success = false;
}
return success;
}
void decode_xml_obj(unsigned long& val, XMLObj *obj)
{
auto& s = obj->get_data();
const char *start = s.c_str();
char *p;
errno = 0;
val = strtoul(start, &p, 10);
/* Check for various possible errors */
if ((errno == ERANGE && val == ULONG_MAX) ||
(errno != 0 && val == 0)) {
throw RGWXMLDecoder::err("failed to number");
}
if (p == start) {
throw RGWXMLDecoder::err("failed to parse number");
}
while (*p != '\0') {
if (!isspace(*p)) {
throw RGWXMLDecoder::err("failed to parse number");
}
p++;
}
}
void decode_xml_obj(long& val, XMLObj *obj)
{
const std::string s = obj->get_data();
const char *start = s.c_str();
char *p;
errno = 0;
val = strtol(start, &p, 10);
/* Check for various possible errors */
if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) ||
(errno != 0 && val == 0)) {
throw RGWXMLDecoder::err("failed to parse number");
}
if (p == start) {
throw RGWXMLDecoder::err("failed to parse number");
}
while (*p != '\0') {
if (!isspace(*p)) {
throw RGWXMLDecoder::err("failed to parse number");
}
p++;
}
}
void decode_xml_obj(long long& val, XMLObj *obj)
{
const std::string s = obj->get_data();
const char *start = s.c_str();
char *p;
errno = 0;
val = strtoll(start, &p, 10);
/* Check for various possible errors */
if ((errno == ERANGE && (val == LLONG_MAX || val == LLONG_MIN)) ||
(errno != 0 && val == 0)) {
throw RGWXMLDecoder::err("failed to parse number");
}
if (p == start) {
throw RGWXMLDecoder::err("failed to parse number");
}
while (*p != '\0') {
if (!isspace(*p)) {
throw RGWXMLDecoder::err("failed to parse number");
}
p++;
}
}
void decode_xml_obj(unsigned long long& val, XMLObj *obj)
{
const std::string s = obj->get_data();
const char *start = s.c_str();
char *p;
errno = 0;
val = strtoull(start, &p, 10);
/* Check for various possible errors */
if ((errno == ERANGE && val == ULLONG_MAX) ||
(errno != 0 && val == 0)) {
throw RGWXMLDecoder::err("failed to parse number");
}
if (p == start) {
throw RGWXMLDecoder::err("failed to parse number");
}
while (*p != '\0') {
if (!isspace(*p)) {
throw RGWXMLDecoder::err("failed to parse number");
}
p++;
}
}
void decode_xml_obj(int& val, XMLObj *obj)
{
long l;
decode_xml_obj(l, obj);
#if LONG_MAX > INT_MAX
if (l > INT_MAX || l < INT_MIN) {
throw RGWXMLDecoder::err("integer out of range");
}
#endif
val = (int)l;
}
void decode_xml_obj(unsigned& val, XMLObj *obj)
{
unsigned long l;
decode_xml_obj(l, obj);
#if ULONG_MAX > UINT_MAX
if (l > UINT_MAX) {
throw RGWXMLDecoder::err("unsigned integer out of range");
}
#endif
val = (unsigned)l;
}
void decode_xml_obj(bool& val, XMLObj *obj)
{
const std::string s = obj->get_data();
if (strncasecmp(s.c_str(), "true", 8) == 0) {
val = true;
return;
}
if (strncasecmp(s.c_str(), "false", 8) == 0) {
val = false;
return;
}
int i;
decode_xml_obj(i, obj);
val = (bool)i;
}
void decode_xml_obj(bufferlist& val, XMLObj *obj)
{
const std::string s = obj->get_data();
bufferlist bl;
bl.append(s.c_str(), s.size());
try {
val.decode_base64(bl);
} catch (buffer::error& err) {
throw RGWXMLDecoder::err("failed to decode base64");
}
}
void decode_xml_obj(utime_t& val, XMLObj *obj)
{
const std::string s = obj->get_data();
uint64_t epoch;
uint64_t nsec;
int r = utime_t::parse_date(s, &epoch, &nsec);
if (r == 0) {
val = utime_t(epoch, nsec);
} else {
throw RGWXMLDecoder::err("failed to decode utime_t");
}
}
void encode_xml(const char *name, const string& val, Formatter *f)
{
f->dump_string(name, val);
}
void encode_xml(const char *name, const char *val, Formatter *f)
{
f->dump_string(name, val);
}
void encode_xml(const char *name, bool val, Formatter *f)
{
std::string s;
if (val)
s = "True";
else
s = "False";
f->dump_string(name, s);
}
void encode_xml(const char *name, int val, Formatter *f)
{
f->dump_int(name, val);
}
void encode_xml(const char *name, long val, Formatter *f)
{
f->dump_int(name, val);
}
void encode_xml(const char *name, unsigned val, Formatter *f)
{
f->dump_unsigned(name, val);
}
void encode_xml(const char *name, unsigned long val, Formatter *f)
{
f->dump_unsigned(name, val);
}
void encode_xml(const char *name, unsigned long long val, Formatter *f)
{
f->dump_unsigned(name, val);
}
void encode_xml(const char *name, long long val, Formatter *f)
{
f->dump_int(name, val);
}
void encode_xml(const char *name, const utime_t& val, Formatter *f)
{
val.gmtime(f->dump_stream(name));
}
void encode_xml(const char *name, const bufferlist& bl, Formatter *f)
{
/* need to copy data from bl, as it is const bufferlist */
bufferlist src = bl;
bufferlist b64;
src.encode_base64(b64);
const std::string s(b64.c_str(), b64.length());
encode_xml(name, s, f);
}
| {
"pile_set_name": "Github"
} |
#pragma once
#include "../models/Metric.h"
#include "../serializer/MetricsJsonObject.h"
#include <spdlog/spdlog.h>
using namespace polycube::service::model;
class Dynmon;
class MetricsBase {
public:
explicit MetricsBase(Dynmon &parent);
~MetricsBase() = default;
virtual void update(const MetricsJsonObject &conf);
virtual MetricsJsonObject toJsonObject();
/**
* Collected metrics from the ingress dataplane path
*/
virtual std::shared_ptr<Metric> getIngressMetric(const std::string &name) = 0;
virtual std::vector<std::shared_ptr<Metric>> getIngressMetricsList() = 0;
virtual void addIngressMetric(const std::string &name, const MetricJsonObject &conf) = 0;
virtual void addIngressMetricsList(const std::vector<MetricJsonObject> &conf);
virtual void replaceIngressMetric(const std::string &name, const MetricJsonObject &conf);
virtual void delIngressMetric(const std::string &name) = 0;
virtual void delIngressMetricsList();
/**
* Collected metrics from the egress dataplane path
*/
virtual std::shared_ptr<Metric> getEgressMetric(const std::string &name) = 0;
virtual std::vector<std::shared_ptr<Metric>> getEgressMetricsList() = 0;
virtual void addEgressMetric(const std::string &name, const MetricJsonObject &conf) = 0;
virtual void addEgressMetricsList(const std::vector<MetricJsonObject> &conf);
virtual void replaceEgressMetric(const std::string &name, const MetricJsonObject &conf);
virtual void delEgressMetric(const std::string &name) = 0;
virtual void delEgressMetricsList();
std::shared_ptr<spdlog::logger> logger();
protected:
Dynmon &parent_;
};
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.dx.dex.code;
import com.android.dx.rop.code.RegisterSpecList;
import com.android.dx.rop.code.SourcePosition;
/**
* Instruction which has a single branch target.
*/
public final class TargetInsn extends FixedSizeInsn {
/** {@code non-null;} the branch target */
private CodeAddress target;
/**
* Constructs an instance. The output address of this instance is initially
* unknown ({@code -1}), and the target is initially
* {@code null}.
*
* @param opcode the opcode; one of the constants from {@link Dops}
* @param position {@code non-null;} source position
* @param registers {@code non-null;} register list, including a
* result register if appropriate (that is, registers may be either
* ins or outs)
* @param target {@code non-null;} the branch target
*/
public TargetInsn(Dop opcode, SourcePosition position,
RegisterSpecList registers, CodeAddress target) {
super(opcode, position, registers);
if (target == null) {
throw new NullPointerException("target == null");
}
this.target = target;
}
/** {@inheritDoc} */
@Override
public DalvInsn withOpcode(Dop opcode) {
return new TargetInsn(opcode, getPosition(), getRegisters(), target);
}
/** {@inheritDoc} */
@Override
public DalvInsn withRegisters(RegisterSpecList registers) {
return new TargetInsn(getOpcode(), getPosition(), registers, target);
}
/**
* Returns an instance that is just like this one, except that its
* opcode has the opposite sense (as a test; e.g. a
* {@code lt} test becomes a {@code ge}), and its branch
* target is replaced by the one given, and all set-once values
* associated with the class (such as its address) are reset.
*
* @param target {@code non-null;} the new branch target
* @return {@code non-null;} an appropriately-constructed instance
*/
public TargetInsn withNewTargetAndReversed(CodeAddress target) {
Dop opcode = getOpcode().getOppositeTest();
return new TargetInsn(opcode, getPosition(), getRegisters(), target);
}
/**
* Gets the unique branch target of this instruction.
*
* @return {@code non-null;} the branch target
*/
public CodeAddress getTarget() {
return target;
}
/**
* Gets the target address of this instruction. This is only valid
* to call if the target instruction has been assigned an address,
* and it is merely a convenient shorthand for
* {@code getTarget().getAddress()}.
*
* @return {@code >= 0;} the target address
*/
public int getTargetAddress() {
return target.getAddress();
}
/**
* Gets the branch offset of this instruction. This is only valid to
* call if both this and the target instruction each has been assigned
* an address, and it is merely a convenient shorthand for
* {@code getTargetAddress() - getAddress()}.
*
* @return the branch offset
*/
public int getTargetOffset() {
return target.getAddress() - getAddress();
}
/**
* Returns whether the target offset is known.
*
* @return {@code true} if the target offset is known or
* {@code false} if not
*/
public boolean hasTargetOffset() {
return hasAddress() && target.hasAddress();
}
/** {@inheritDoc} */
@Override
protected String argString() {
if (target == null) {
return "????";
}
return target.identifierString();
}
}
| {
"pile_set_name": "Github"
} |
[
{
"category": "``rds``",
"description": "[``botocore``] Update rds client to latest version",
"type": "api-change"
},
{
"category": "``dax``",
"description": "[``botocore``] Update dax client to latest version",
"type": "api-change"
},
{
"category": "``ecs``",
"description": "[``botocore``] Update ecs client to latest version",
"type": "api-change"
}
] | {
"pile_set_name": "Github"
} |
import React from 'react';
import PropTypes from 'prop-types';
class InputNumber extends React.Component {
constructor(props) {
super(props);
const value = Number.isNaN(parseFloat(props.value))
? props.defaultValue
: parseFloat(props.value);
this.state = {
value: value || 0,
textValue: value,
};
this.increment = this.increment.bind(this);
this.decrement = this.decrement.bind(this);
this.handleChange = this.handleChange.bind(this);
this.handleBlur = this.handleBlur.bind(this);
this.changeValue = this.changeValue.bind(this);
}
componentWillReceiveProps({value, defaultValue}) {
if (Number.isNaN(value)) {
return this.changeValue(defaultValue);
}
return this.changeValue(value, false);
}
increment() {
this.changeValue(this.state.value + this.props.step);
}
decrement() {
this.changeValue(this.state.value - this.props.step);
}
handleChange(e) {
this.changeValue(e.target.value);
}
handleBlur() {
this.setState(({value}) => ({textValue: value.toString()}));
}
changeValue(newValue, notify = true) {
const {min, max, onChange} = this.props;
// Text field is valid
if (/^-?(\d+(\.\d*)?)?$/.test(newValue)) {
this.setState({textValue: newValue});
}
// Not a number we'd like, so we don't set the new value
if (!/^-?\d+(\.\d+)?$/.test(newValue)) {
return;
}
// Good number, range validation
const value = Math.max(min, Math.min(parseFloat(newValue), max));
this.setState(() => {
if (notify || value !== newValue) {
onChange(value);
}
if (typeof newValue === 'number') {
return {value, textValue: value.toString()};
}
return {value};
});
}
render() {
const {textValue, value} = this.state;
const {className, onChange, step, min, max, controls, ...rest} = this.props;
delete rest.value;
return (
<div className={className}>
{controls && (
<button className="input-number-decrement" onClick={this.decrement}>
–
</button>
)}
<input
className="input-number"
type="text"
value={textValue}
onChange={this.handleChange}
onBlur={this.handleBlur}
{...rest}
/>
<span className="input-number-text">user{value > 1 && 's'}</span>
{controls && (
<button className="input-number-increment" onClick={this.increment}>
+
</button>
)}
</div>
);
}
}
InputNumber.propTypes = {
className: PropTypes.string,
defaultValue: PropTypes.number,
value: PropTypes.number,
step: PropTypes.number,
min: PropTypes.number,
max: PropTypes.number,
controls: PropTypes.bool,
};
InputNumber.defaultProps = {
value: 0,
step: 1,
min: -Infinity,
max: Infinity,
controls: false,
};
export default InputNumber;
| {
"pile_set_name": "Github"
} |
///*|-----------------------------------------------------------------------------
// *| This source code is provided under the Apache 2.0 license --
// *| and is provided AS IS with no warranty or guarantee of fit for purpose. --
// *| See the project's LICENSE.md for details. --
// *| Copyright (C) 2019-2020 Refinitiv. All rights reserved. --
///*|-----------------------------------------------------------------------------
#include "NiProvider.h"
#include <cstring>
using namespace thomsonreuters::ema::access;
using namespace std;
void printHelp()
{
cout << endl << "Options:\n" << " -?\tShows this usage\n"
<< " -ph Proxy host name \n"
<< " -pp Proxy port number \n"
<< " -plogin User name on proxy server \n"
<< " -ppasswd Password on proxy server \n"
<< " -pdomain Proxy Domain \n"
<< " -spTLSv1.2 enable use of cryptographic protocol TLSv1.2 used with linux encrypted connections \n"
<< " -libsslName name of the libssl.so shared library used with linux encrypted connections. \n"
<< " -libcryptoName name of the libcrypto.so shared library used with linux encrypted connections \n" << endl;
}
int main( int argc, char* argv[] )
{
try
{
OmmNiProviderConfig config;
int securityProtocol = 0;
for (int i = 0; i < argc; i++)
{
if (strcmp(argv[i], "-?") == 0)
{
printHelp();
return false;
}
else if (strcmp(argv[i], "-ph") == 0)
{
config.tunnelingProxyHostName(i < (argc - 1) ? argv[++i] : NULL);
}
else if (strcmp(argv[i], "-pp") == 0)
{
config.tunnelingProxyPort(i < (argc - 1) ? argv[++i] : NULL);
}
else if (strcmp(argv[i], "-plogin") == 0)
{
config.proxyUserName(i < (argc - 1) ? argv[++i] : NULL);
}
else if (strcmp(argv[i], "-ppasswd") == 0)
{
config.proxyPasswd(i < (argc - 1) ? argv[++i] : NULL);
}
else if (strcmp(argv[i], "-pdomain") == 0)
{
config.proxyDomain(i < (argc - 1) ? argv[++i] : NULL);
}
else if (strcmp(argv[i], "-spTLSv1.2") == 0)
{
securityProtocol |= OmmNiProviderConfig::ENC_TLSV1_2;
}
else if (strcmp(argv[i], "-libsslName") == 0)
{
config.tunnelingLibSslName(i < (argc - 1) ? argv[++i] : NULL);
}
else if (strcmp(argv[i], "-libcryptoName") == 0)
{
config.tunnelingLibCryptoName(i < (argc - 1) ? argv[++i] : NULL);
}
}
if (securityProtocol > 0)
config.tunnelingSecurityProtocol(securityProtocol);
OmmProvider provider( config.username( "user" ).providerName( "Provider_4" ) );
UInt64 ibmHandle = 5;
UInt64 triHandle = 6;
RefreshMsg refresh;
UpdateMsg update;
FieldList fieldList;
provider.submit( refresh.serviceName( "NI_PUB" ).name( "IBM.N" )
.state( OmmState::OpenEnum, OmmState::OkEnum, OmmState::NoneEnum, "UnSolicited Refresh Completed" )
.payload( fieldList
.addReal( 22, 14400, OmmReal::ExponentNeg2Enum )
.addReal( 25, 14700, OmmReal::ExponentNeg2Enum )
.addReal( 30, 9, OmmReal::Exponent0Enum )
.addReal( 31, 19, OmmReal::Exponent0Enum )
.complete() )
.complete(), ibmHandle );
provider.submit( refresh.clear().serviceName( "NI_PUB" ).name( "TRI.N" )
.state( OmmState::OpenEnum, OmmState::OkEnum, OmmState::NoneEnum, "UnSolicited Refresh Completed" )
.payload( fieldList.clear()
.addReal( 22, 4100, OmmReal::ExponentNeg2Enum )
.addReal( 25, 4200, OmmReal::ExponentNeg2Enum )
.addReal( 30, 20, OmmReal::Exponent0Enum )
.addReal( 31, 40, OmmReal::Exponent0Enum )
.complete() )
.complete(), triHandle );
sleep( 1000 );
for ( Int32 i = 0; i < 60; i++ )
{
provider.submit( update.clear().serviceName( "NI_PUB" ).name( "IBM.N" )
.payload( fieldList.clear()
.addReal( 22, 14400 + i, OmmReal::ExponentNeg2Enum )
.addReal( 30, 10 + i, OmmReal::Exponent0Enum )
.complete() ), ibmHandle );
provider.submit( update.clear().serviceName( "NI_PUB" ).name( "TRI.N" )
.payload( fieldList.clear()
.addReal( 22, 4100 + i, OmmReal::ExponentNeg2Enum )
.addReal( 30, 21 + i, OmmReal::Exponent0Enum )
.complete() ), triHandle );
sleep( 1000 );
}
}
catch ( const OmmException& excp )
{
cout << excp << endl;
}
return 0;
}
| {
"pile_set_name": "Github"
} |
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include "uv.h"
#include "task.h"
#include <string.h>
static void set_title(const char* title) {
char buffer[512];
uv_err_t err;
err = uv_get_process_title(buffer, sizeof(buffer));
ASSERT(UV_OK == err.code);
err = uv_set_process_title(title);
ASSERT(UV_OK == err.code);
err = uv_get_process_title(buffer, sizeof(buffer));
ASSERT(UV_OK == err.code);
ASSERT(strcmp(buffer, title) == 0);
}
TEST_IMPL(process_title) {
#if defined(__sun)
RETURN_SKIP("uv_(get|set)_process_title is not implemented.");
#else
/* Check for format string vulnerabilities. */
set_title("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s");
set_title("new title");
return 0;
#endif
}
| {
"pile_set_name": "Github"
} |
#include <linalg.hpp>
#include <csg.hpp>
namespace netgen
{
GeneralizedCylinder :: GeneralizedCylinder (ExplicitCurve2d & acrosssection,
Point<3> ap, Vec<3> ae1, Vec<3> ae2)
: crosssection(acrosssection)
{
planep = ap;
planee1 = ae1;
planee2 = ae2;
planee3 = Cross (planee1, planee2);
(*testout) << "Vecs = " << planee1 << " " << planee2 << " " << planee3 << endl;
};
void GeneralizedCylinder :: Project (Point<3> & p) const
{
Point<2> p2d;
double z;
p2d = Point<2> (planee1 * (p - planep), planee2 * (p - planep));
z = planee3 * (p - planep);
crosssection.Project (p2d);
p = planep + p2d(0) * planee1 + p2d(1) * planee2 + z * planee3;
}
int GeneralizedCylinder ::BoxInSolid (const BoxSphere<3> & box) const
{
Point<3> p3d;
Point<2> p2d, projp;
double t;
Vec<2> tan, n;
p3d = box.Center();
p2d = Point<2> (planee1 * (p3d - planep), planee2 * (p3d - planep));
t = crosssection.ProjectParam (p2d);
projp = crosssection.Eval (t);
tan = crosssection.EvalPrime (t);
n(0) = tan(1);
n(1) = -tan(0);
if (Dist (p2d, projp) < box.Diam()/2)
return 2;
if (n * (p2d - projp) > 0)
{
return 0;
}
return 1;
}
double GeneralizedCylinder :: CalcFunctionValue (const Point<3> & point) const
{
Point<2> p2d, projp;
double t;
Vec<2> tan, n;
p2d = Point<2> (planee1 * (point - planep), planee2 * (point - planep));
t = crosssection.ProjectParam (p2d);
projp = crosssection.Eval (t);
tan = crosssection.EvalPrime (t);
n(0) = tan(1);
n(1) = -tan(0);
n /= n.Length();
return n * (p2d - projp);
}
void GeneralizedCylinder :: CalcGradient (const Point<3> & point, Vec<3> & grad) const
{
Point<2> p2d, projp;
double t;
Vec<2> tan, n;
p2d = Point<2> (planee1 * (point - planep), planee2 * (point - planep));
t = crosssection.ProjectParam (p2d);
projp = crosssection.Eval (t);
tan = crosssection.EvalPrime (t);
n(0) = tan(1);
n(1) = -tan(0);
n /= n.Length();
grad = n(0) * planee1 + n(1) * planee2;
}
void GeneralizedCylinder :: CalcHesse (const Point<3> & point, Mat<3> & hesse) const
{
Point<2> p2d, projp;
double t, dist, val;
Point<2> curvp;
Vec<2> curvpp;
Mat<2> h2d;
Mat<3,2> vmat;
int i, j, k, l;
p2d = Point<2> (planee1 * (point - planep), planee2 * (point - planep));
t = crosssection.ProjectParam (p2d);
curvp = crosssection.CurvCircle (t);
curvpp = p2d-curvp;
dist = curvpp.Length();
curvpp /= dist;
h2d(1, 1) = (1 - curvpp(0) * curvpp(0) ) / dist;
h2d(1, 2) = h2d(2, 1) = (- curvpp(0) * curvpp(1) ) / dist;
h2d(2, 2) = (1 - curvpp(1) * curvpp(1) ) / dist;
vmat(0,0) = planee1(0);
vmat(1,0) = planee1(1);
vmat(2,0) = planee1(2);
vmat(0,1) = planee2(0);
vmat(1,1) = planee2(1);
vmat(2,1) = planee2(2);
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
{
val = 0;
for (k = 0; k < 2; k++)
for (l = 0; l < 2; l++)
val += vmat(i,k) * h2d(k,l) * vmat(j,l);
hesse(i,j) = val;
}
}
double GeneralizedCylinder :: HesseNorm () const
{
return crosssection.MaxCurvature();
}
double GeneralizedCylinder :: MaxCurvatureLoc (const Point<3> & c, double rad) const
{
Point<2> c2d = Point<2> (planee1 * (c - planep), planee2 * (c - planep));
return crosssection.MaxCurvatureLoc(c2d, rad);
}
Point<3> GeneralizedCylinder :: GetSurfacePoint () const
{
Point<2> p2d;
p2d = crosssection.Eval(0);
return planep + p2d(0) * planee1 + p2d(1) * planee2;
}
void GeneralizedCylinder :: Reduce (const BoxSphere<3> & box)
{
Point<2> c2d = Point<2> (planee1 * (box.Center() - planep),
planee2 * (box.Center() - planep));
crosssection.Reduce (c2d, box.Diam()/2);
}
void GeneralizedCylinder :: UnReduce ()
{
crosssection.UnReduce ();
}
void GeneralizedCylinder :: Print (ostream & str) const
{
str << "Generalized Cylinder" << endl;
crosssection.Print (str);
}
#ifdef MYGRAPH
void GeneralizedCylinder :: Plot (const class ROT3D & rot) const
{
Point<2> p2d;
Point<3> p, oldp;
double t, tmin, tmax, dt;
tmin = crosssection.MinParam();
tmax = crosssection.MaxParam();
dt = (tmax - tmin)/ 500;
p2d = crosssection.Eval(tmin);
p = planep + p2d(0) * planee1 + p2d(1) * planee2;
for (t = tmin; t <= tmax+dt; t += dt)
{
if (crosssection.SectionUsed (t))
MySetColor (RED);
else
MySetColor (BLUE);
oldp = p;
p2d = crosssection.Eval(t);
p = planep + p2d(0) * planee1 + p2d(1) * planee2;
MyLine3D (p, oldp, rot);
}
}
#endif
}
| {
"pile_set_name": "Github"
} |
/* eslint-env node */
module.exports = {
test_page : 'tests/index.html?hidepassed',
disable_watching : true,
launch_in_ci : [
'PhantomJS'
],
launch_in_dev: [
'PhantomJS',
'Chrome'
]
};
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env bash
# Copyright 2012 Johns Hopkins University (Author: Daniel Povey)
# Korbinian Riedhammer
# Apache 2.0
# To be run from ..
# Flat start and monophone training, with delta-delta features.
# This script applies cepstral mean normalization (per speaker).
# Begin configuration section.
nj=4
cmd=run.pl
scale_opts="--transition-scale=1.0 --acoustic-scale=0.1 --self-loop-scale=0.1"
num_iters=40 # Number of iterations of training
max_iter_inc=30 # Last iter to increase #Gauss on.
totgauss=1000 # Target #Gaussians.
boost_silence=1.0 # Factor by which to boost silence likelihoods in alignment
realign_iters="1 2 3 4 5 6 7 8 9 10 12 14 16 18 20 23 26 29 32 35 38";
config= # name of config file.
stage=-4
power=0.2 # exponent to determine number of gaussians from occurrence counts
normft2=true # typically, the tandem features will already be normalized due to pca
# End configuration section.
echo "$0 $@" # Print the command line for logging
if [ -f path.sh ]; then . ./path.sh; fi
. parse_options.sh || exit 1;
if [ $# != 4 ]; then
echo "Usage: steps/tandem/train_mono.sh [options] <data1-dir> <data2-dir> <lang-dir> <exp-dir>"
echo " e.g.: steps/tandem/train_mono.sh {mfcc,bottleneck}/data/train.1k data/lang exp/mono"
echo "main options (for others, see top of script file)"
echo " --config <config-file> # config containing options"
echo " --nj <nj> # number of parallel jobs"
echo " --cmd (utils/run.pl|utils/queue.pl <queue opts>) # how to run jobs."
echo " --normft2 (true|false) # apply CMVN to second features?"
exit 1;
fi
data1=$1
data2=$2
lang=$3
dir=$4
oov_sym=`cat $lang/oov.int` || exit 1;
mkdir -p $dir/log
echo $nj > $dir/num_jobs
cp $lang/phones.txt $dir || exit 1;
# Set up features.
sdata1=$data1/split$nj;
sdata2=$data2/split$nj;
[[ -d $sdata1 && $data1/feats.scp -ot $sdata1 ]] || split_data.sh $data1 $nj || exit 1;
[[ -d $sdata2 && $data2/feats.scp -ot $sdata2 ]] || split_data.sh $data2 $nj || exit 1;
# Use deltas on the first tream (most likely this will be MFCCs or alike)
feats1="ark,s,cs:apply-cmvn --norm-vars=false --utt2spk=ark:$sdata1/JOB/utt2spk scp:$sdata1/JOB/cmvn.scp scp:$sdata1/JOB/feats.scp ark:- | add-deltas ark:- ark:- |"
# Second stream will most likely be bottleneck or posteriors, so normalize
# if desired
feats2="scp:$sdata2/JOB/feats.scp"
if [ "$normft2" == "true" ]; then
feats2="ark,s,cs:apply-cmvn --norm-vars=false --utt2spk=ark:$sdata2/JOB/utt2spk scp:$sdata2/JOB/cmvn.scp $feats2 ark:- |"
fi
# paste features
feats="ark,s,cs:paste-feats '$feats1' '$feats2' ark:- |"
example_feats="`echo '$feats' | sed s/JOB/1/g`";
# get dimension
allfeats=$(echo $feats | sed s:JOB:..:g)
feat_dim=$(feat-to-dim --print-args=false "$allfeats" - 2> $dir/log/feat_dim)
# save stats
echo $feats > $dir/tandem
echo $normft2 > $dir/normft2
echo "$0: Initializing monophone system."
[ ! -f $lang/phones/sets.int ] && exit 1;
shared_phones_opt="--shared-phones=$lang/phones/sets.int"
if [ $stage -le -3 ]; then
# Note: JOB=. makes it use the whole set; we want that to make sure we have phoneme
$cmd JOB=1 $dir/log/init.log \
gmm-init-mono $shared_phones_opt "--train-feats=$allfeats" $lang/topo $feat_dim \
$dir/0.mdl $dir/tree || exit 1;
fi
numgauss=`gmm-info --print-args=false $dir/0.mdl | grep gaussians | awk '{print $NF}'`
incgauss=$[($totgauss-$numgauss)/$max_iter_inc] # per-iter increment for #Gauss
if [ $stage -le -2 ]; then
echo "$0: Compiling training graphs"
$cmd JOB=1:$nj $dir/log/compile_graphs.JOB.log \
compile-train-graphs --read-disambig-syms=$lang/phones/disambig.int $dir/tree $dir/0.mdl $lang/L.fst \
"ark:sym2int.pl --map-oov $oov_sym -f 2- $lang/words.txt < $sdata1/JOB/text|" \
"ark:|gzip -c >$dir/fsts.JOB.gz" || exit 1;
fi
if [ $stage -le -1 ]; then
echo "$0: Aligning data equally (pass 0)"
$cmd JOB=1:$nj $dir/log/align.0.JOB.log \
align-equal-compiled "ark:gunzip -c $dir/fsts.JOB.gz|" "$feats" ark,t:- \| \
gmm-acc-stats-ali --binary=true $dir/0.mdl "$feats" ark:- \
$dir/0.JOB.acc || exit 1;
fi
# In the following steps, the --min-gaussian-occupancy=3 option is important, otherwise
# we fail to est "rare" phones and later on, they never align properly.
if [ $stage -le 0 ]; then
gmm-est --min-gaussian-occupancy=3 --mix-up=$numgauss --power=$power \
$dir/0.mdl "gmm-sum-accs - $dir/0.*.acc|" $dir/1.mdl 2> $dir/log/update.0.log || exit 1;
rm $dir/0.*.acc
fi
beam=6 # will change to 10 below after 1st pass
# note: using slightly wider beams for WSJ vs. RM.
x=1
while [ $x -lt $num_iters ]; do
echo "$0: Pass $x"
if [ $stage -le $x ]; then
if echo $realign_iters | grep -w $x >/dev/null; then
echo "$0: Aligning data"
mdl="gmm-boost-silence --boost=$boost_silence `cat $lang/phones/optional_silence.csl` $dir/$x.mdl - |"
$cmd JOB=1:$nj $dir/log/align.$x.JOB.log \
gmm-align-compiled $scale_opts --beam=$beam --retry-beam=$[$beam*4] "$mdl" \
"ark:gunzip -c $dir/fsts.JOB.gz|" "$feats" "ark,t:|gzip -c >$dir/ali.JOB.gz" \
|| exit 1;
fi
$cmd JOB=1:$nj $dir/log/acc.$x.JOB.log \
gmm-acc-stats-ali $dir/$x.mdl "$feats" "ark:gunzip -c $dir/ali.JOB.gz|" \
$dir/$x.JOB.acc || exit 1;
$cmd $dir/log/update.$x.log \
gmm-est --write-occs=$dir/$[$x+1].occs --mix-up=$numgauss --power=$power $dir/$x.mdl \
"gmm-sum-accs - $dir/$x.*.acc|" $dir/$[$x+1].mdl || exit 1;
rm $dir/$x.mdl $dir/$x.*.acc $dir/$x.occs 2>/dev/null
fi
if [ $x -le $max_iter_inc ]; then
numgauss=$[$numgauss+$incgauss];
fi
beam=10
x=$[$x+1]
done
( cd $dir; rm final.{mdl,occs} 2>/dev/null; ln -s $x.mdl final.mdl; ln -s $x.occs final.occs )
utils/summarize_warnings.pl $dir/log
echo "Done training tandem mono-phone system in $dir"
# example of showing the alignments:
# show-alignments data/lang/phones.txt $dir/30.mdl "ark:gunzip -c $dir/ali.0.gz|" | head -4
| {
"pile_set_name": "Github"
} |
// Bordered & Pulled
// -------------------------
.@{fa-css-prefix}-border {
padding: .2em .25em .15em;
border: solid .08em @fa-border-color;
border-radius: .1em;
}
.@{fa-css-prefix}-pull-left { float: left; }
.@{fa-css-prefix}-pull-right { float: right; }
.@{fa-css-prefix} {
&.@{fa-css-prefix}-pull-left { margin-right: .3em; }
&.@{fa-css-prefix}-pull-right { margin-left: .3em; }
}
/* Deprecated as of 4.4.0 */
.pull-right { float: right; }
.pull-left { float: left; }
.@{fa-css-prefix} {
&.pull-left { margin-right: .3em; }
&.pull-right { margin-left: .3em; }
}
| {
"pile_set_name": "Github"
} |
<html>
<body>
<h1 align="center"><code>Schema.yaml</code> 詳解</h1>
<h2></h2>
<hr>
<h2>開始之前</h2>
<pre><code># Rime schema
# encoding: utf-8
</code></pre>
<h2>描述檔</h2>
<ol><li><code>name:</code> 方案的顯示名偁〔即出現於方案選單中以示人的,通常爲中文〕</li>
<li><code>schema_id:</code> 方案內部名,在代碼中引用此方案時以此名爲正,通常由英文、數字、下劃線組成</li>
<li><code>author:</code> 發明人、撰寫者。如果您對方案做出了修改,請保留原作者名,並將自己的名字加在後面</li>
<li><code>description:</code> 請簡要描述方案歷史、碼表來源、該方案規則等</li>
<li><code>dependencies:</code> 如果本方案依賴於其它方案〔通常來說會依頼其它方案做爲反查,抑或是兩種或多種方案混用時〕</li>
<li><code>version:</code> 版本號,在發佈新版前請確保已陞版本號</li>
</ol>
<ul><h4><strong>示例</strong></h4>
<pre><code>schema:
name: "蒼頡檢字法"
schema_id: cangjie6
author:
- "發明人 朱邦復先生、沈紅蓮女士"
dependencies:
- luna_pinyin
- jyutping
- zyenpheng
description: |
第六代倉頡輸入法
碼表由雪齋、惜緣和crazy4u整理
version: 0.19
</code></pre></ul>
<h2>開關</h2>
<p>通常包含以下數個:</p>
<ol><li><code>ascii_mode</code> 是中英文轉換開關。預設<code>0</code>爲中文,<code>1</code>爲英文</li>
<li><code>full_shape</code> 是全角符號/半角符號開關。注意,開啓全角時英文字母亦爲全角。<code>0</code>爲半角,<code>1</code>爲全角</li>
<li><code>extended_charset</code> 是字符集開關。<code>0</code>爲CJK基本字符集,<code>1</code>爲CJK全字符集</li>
<ul><li>僅<code>table_translator</code>可用</li></ul>
<li><code>ascii_punct</code> 是中西文標點轉換開關,<code>0</code>爲中文句讀,<code>1</code>爲西文標點。</li>
<li><code>simplification</code> 是轉化字開關。一般情況下與上同,<code>0</code>爲不開啓轉化,<code>1</code>爲轉化。</li>
<ul><li><code>simplification</code>選項名偁可自定義,亦可添加多套替換用字方案:</li></ul>
<ul><pre><code>- name: zh_cn
states: ["漢字", "汉字"]
reset: 0
</code></pre>
<p>或</p>
<pre><code>- options: [ zh_trad, zh_cn, zh_mars ]
states:
- 字型 → 漢字
- 字型 → 汉字
- 字型 → 䕼茡
reset: 0
</code></pre>
<ul>
<li><code>name</code>/<code>options</code>名:須與<code>simplifier</code>中<code>option_name</code>相同</li>
<li><code>states</code>:可不寫,如不寫則此開關存在但不可見,可由快捷鍵操作</li>
<li><code>reset</code>:設定默認狀態〔<code>reset</code>可不寫,此時切換窗口時不會重置到默認狀態〕</li>
</ul>
</ul>
<li>字符集過濾。此選項沒有默認名偁,須配合<code>charset_filter</code>使用。可單用,亦可添加多套字符集:</li>
<pre><code>- name: gbk
states: [ 增廣, 常用 ]
reset: 0
</code></pre>
或
<pre><code>- options: [ utf-8, big5hkscs, big5, gbk, gb2312 ]
states:
- 字集 → 全
- 字集 → 港臺
- 字集 → 臺
- 字集 → 大陸
- 字集 → 简体
reset: 0
</code></pre>
<ul>
<li><code>name</code>/<code>options</code>名:須與<code>charset_filter</code><code>@</code>後的tag相同</li>
<li>避免同時使用字符集過濾和<code>extended_charset</code></li>
</ul>
</ol>
<ul>
<h4><strong>示例</strong></h4>
<pre><code>switches:
- name: ascii_mode
reset: 0
states: ["中文", "西文"]
- name: full_shape
states: ["半角", "全角"]
- name: extended_charset
states: ["通用", "增廣"]
- name: simplification
states: ["漢字", "汉字"]
- name: ascii_punct
states: ["句讀", "符號"]
</code></pre></ul>
<h2>引擎</h2>
<ul><li>以下<b>加粗</b>項爲可細配者,<i>斜體</i>者爲不常用者</li>
</ul>
<p>引擎分四組:</p>
<h3>一、<code>processors</code></h3>
<ul><li>這批組件處理各類按鍵消息</li></ul>
<ol><li><code>ascii_composer</code> 處理西文模式及中西文切</li>
<li><b><code>recognizer</code></b> 與<code>matcher</code>搭配,處理符合特定規則的輸入碼,如網址、反查等<code>tags</code></li>
<li><b><code>key_binder</code></b> 在特定條件下將按鍵綁定到其他按鍵,如重定義逗號、句號爲候選翻頁、開關快捷鍵等</li>
<li><b><code>speller</code></b> 拼寫處理器,接受字符按鍵,編輯輸入</li>
<li><b><code>punctuator</code></b> 句讀處理器,將單個字符按鍵直接映射爲標點符號或文字</li>
<li><code>selector</code> 選字處理器,處理數字選字鍵〔可以換成別的哦〕、上、下候選定位、換頁</li>
<li><code>navigator</code> 處理輸入欄內的光標移動</li>
<li><code>express_editor</code> 編輯器,處理空格、回車上屏、回退鍵</li>
<li><i><code>fluid_editor</code></i> 句式編輯器,用於以空格斷詞、回車上屏的【注音】、【語句流】等輸入方案,替換<code>express_editor</code></li>
<li><i><code>chord_composer</code></i> 和絃作曲家或曰並擊處理器,用於【宮保拼音】等多鍵並擊的輸入方案</li>
<li><code>lua_processor</code> 使用<code>lua</code>自定義按鍵,後接<code>@</code>+<code>lua</code>函數名</li>
<ul><li><code>lua</code>函數名即用戶文件夾內<code>rime.lua</code>中函數名,參數爲<code>(key, env)</code></li></ul>
</ol>
<h3>二、<code>segmentors</code></h3>
<ul><li>這批組件識別不同內容類型,將輸入碼分段並加上<code>tag</code></li></ul>
<ol><li><code>ascii_segmentor</code> 標識西文段落〔譬如在西文模式下〕字母直接上屛</li>
<li><code>matcher</code> 配合<code>recognizer</code>標識符合特定規則的段落,如網址、反查等,加上特定<code>tag</code></li>
<li><b><code>abc_segmentor</code></b> 標識常規的文字段落,加上<code>abc</code>這個<code>tag</code></li>
<li><code>punct_segmentor</code> 標識句讀段落〔鍵入標點符號用〕加上<code>punct</code>這個<code>tag</code></li>
<li><code>fallback_segmentor</code> 標識其他未標識段落</li>
<li><b><code>affix_segmentor</code></b> 用戶自定義<code>tag</code></li>
<ul><li>此項可加載多個實例,後接<code>@</code>+<code>tag</code>名</li></ul>
<li><i><code>lua_segmentor</code></i> 使用<code>lua</code>自定義切分,後接<code>@</code>+<code>lua</code>函數名</li>
</ol>
<h3>三、<code>translators</code></h3>
<ul><li>這批組件翻譯特定類型的編碼段爲一組候選文字</li></ul>
<ol><li><code>echo_translator</code> 沒有其他候選字時,回顯輸入碼〔輸入碼可以<code>Shift</code>+<code>Enter</code>上屛〕</li>
<li><code>punct_translator</code> 配合<code>punct_segmentor</code>轉換標點符號</li>
<li><b><code>table_translator</code></b> 碼表翻譯器,用於倉頡、五筆等基於碼表的輸入方案</li>
- 此項可加載多個實例,後接<code>@</code>+翻譯器名〔如:<code>cangjie</code>、<code>wubi</code>等〕</li>
<li><b><code>script_translator</code></b> 腳本翻譯器,用於拼音、粵拼等基於音節表的輸入方案</li>
- 此項可加載多個實例,後接<code>@</code>+翻譯器名〔如:<code>pinyin</code>、<code>jyutping</code>等〕</li>
<li><i><code>reverse_lookup_translator</code></i> 反查翻譯器,用另一種編碼方案查碼</li>
<li><b><code>lua_translator</code></b> 使用<code>lua</code>自定義輸入,例如動態輸入當前日期、時間,後接<code>@</code>+<code>lua</code>函數名</li>
<ul><li><code>lua</code>函數名即用戶文件夾內<code>rime.lua</code>中函數名,參數爲<code>(input, seg, env)</code></li>
<li>可以<code>env.engine.context:get_option("option_name")</code>方式綁定到<code>switch</code>開關/<code>key_binder</code>快捷鍵</li></ul>
</ol>
<h3>四、<code>filters</code></h3>
<ul><li>這批組件過濾翻譯的結果</li></ul>
<ol>
<li><code>uniquifier</code> 過濾重複的候選字,有可能來自<b><code>simplifier</code></b></li>
<li><code>cjk_minifier</code> 字符集過濾〔僅用於<code>script_translator</code>,使之支援<code>extended_charset</code>開關〕</li>
<li><b><code>single_char_filter</code></b> 單字過濾器,如加載此組件,則屛敝詞典中的詞組〔僅<code>table_translator</code>有效〕</li>
<li><b><code>simplifier</code></b> 用字轉換</li>
<li><b><code>reverse_lookup_filter</code></b> 反查濾鏡,以更靈活的方式反查,Rime1.0後替代<i><code>reverse_lookup_translator</code></i></li>
<ul><li>此項可加載多個實例,後接<code>@</code>+濾鏡名〔如:<code>pinyin_lookup</code>、<code>jyutping_lookup</code>等〕</li></ul>
<li><b><code>charset_filter</code></b> 字符集過濾</li>
<ul><li>後接<code>@</code>+字符集名〔如:<code>utf-8</code>(無過濾)、<code>big5</code>、<code>big5hkscs</code>、<code>gbk</code>、<code>gb2312</code>〕</li></ul>
<li><b><code>lua_filter</code></b> 使用<code>lua</code>自定義過濾,例如過濾字符集、調整排序,後接<code>@</code>+<code>lua</code>函數名</li>
<ul><li><code>lua</code>函數名即用戶文件夾內<code>rime.lua</code>中函數名,參數爲<code>(input, env)</code></li>
<li>可以<code>env.engine.context:get_option("option_name")</code>方式綁定到<code>switch</code>開關/<code>key_binder</code>快捷鍵</li></ul>
</ol>
<ul><h4><strong>示例</strong></h4>
<p><small>cangjie6.schema.yaml</small></p>
<pre><code>engine:
processors:
- ascii_composer
- recognizer
- key_binder
- speller
- punctuator
- selector
- navigator
- express_editor
segmentors:
- ascii_segmentor
- matcher
- affix_segmentor@pinyin
- affix_segmentor@jyutping
- affix_segmentor@pinyin_lookup
- affix_segmentor@jyutping_lookup
- affix_segmentor@reverse_lookup
- abc_segmentor
- punct_segmentor
- fallback_segmentor
translators:
- punct_translator
- table_translator
- script_translator@pinyin
- script_translator@jyutping
- script_translator@pinyin_lookup
- script_translator@jyutping_lookup
- lua_translator@get_date
filters:
- simplifier@zh_simp
- uniquifier
- cjk_minifier
- charset_filter@gbk
- reverse_lookup_filter@middle_chinese
- reverse_lookup_filter@pinyin_reverse_lookup
- reverse_lookup_filter@jyutping_reverse_lookup
- lua_filter@single_char_first
</code></pre></ul>
<h2>細項配置</h2>
<ul><li>凡<code>comment_format</code>、<code>preedit_format</code>、<code>speller/algebra</code>所用之正則表達式,請參閱<a href="http://www.boost.org/doc/libs/1_49_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html">「Perl正則表達式」</a></li>
</ul>
<p><strong>引擎中所舉之加粗者均可在下方詳細描述,格式爲:</strong></p>
<pre><code>name:
branches: configurations
</code></pre>
<p>或</p>
<pre><code>name:
branches:
- configurations
</code></pre>
<h3>一、<code>speller</code></h3>
<ol><li><code>alphabet:</code> 定義本方案輸入鍵</li>
<li><code>initials:</code> 定義僅作始碼之鍵</li>
<li><code>finals:</code> 定義僅作末碼之鍵</li>
<li><code>delimiter:</code> 上屛時的音節間分音符</li>
<li><code>algebra:</code> 拼寫運算規則,由之算出的拼寫匯入<code>prism</code>中</li>
<li><code>max_code_length:</code> 形碼最大碼長,超過則頂字上屛〔<code>number</code>〕</li>
<li><code>auto_select:</code> 自動上屛〔<code>true</code>或<code>false</code>〕</li>
<li><code>auto_select_pattern:</code> 自動上屏規則,以正則表達式描述,當輸入串可以被匹配時自動頂字上屏。
<li><code>use_space:</code> 以空格作輸入碼〔<code>true</code>或<code>false</code>〕</li>
</ol>
<ul><ul><li><code>speller</code>的演算包含:</li>
<pre><code>xform --改寫〔不保留原形〕
derive --衍生〔保留原形〕
abbrev --簡拼〔出字優先級較上兩組更低〕
fuzz --畧拼〔此種簡拼僅組詞,不出單字〕
xlit --變換〔適合大量一對一變換〕
erase --刪除
</code></pre></ul></ul>
<ul><h4><strong>示例</strong></h4>
<p><small>luna_pinyin.schema.yaml</small></p>
<pre><code>speller:
alphabet: zyxwvutsrqponmlkjihgfedcba
delimiter: " '"
algebra:
- erase/^xx$/
- abbrev/^([a-z]).+$/$1/
- abbrev/^([zcs]h).+$/$1/
- derive/^([nl])ve$/$1ue/
- derive/^([jqxy])u/$1v/
- derive/un$/uen/
- derive/ui$/uei/
- derive/iu$/iou/
- derive/([aeiou])ng$/$1gn/
- derive/([dtngkhrzcs])o(u|ng)$/$1o/
- derive/ong$/on/
- derive/ao$/oa/
- derive/([iu])a(o|ng?)$/a$1$2/
</code></pre></ul>
<h3>二、<code>segmentor</code></h3>
<ul><li><code>segmentor</code>配合<code>recognizer</code>標記出<code>tag</code>。這裏會用到<code>affix_segmentor</code>和<code>abc_translator</code></li>
<li><code>tag</code>用在<code>translator</code>、<code>reverse_lookup_filter</code>、<code>simplifier</code>中用以標定各自作用範圍</li>
<li>如果不需要用到<code>extra_tags</code>則不需要單獨配置<code>segmentor</code></li>
</ul>
<ol><li><code>tag:</code> 設定其<code>tag</code></li>
<li><code>prefix:</code> 設定其前綴標識,可不塡,不塡則無前綴</li>
<li><code>suffix:</code> 設定其尾綴標識,可不塡,不塡則無尾綴</li>
<li><code>tips:</code> 設定其輸入前提示符,可不塡,不塡則無提示符</li>
<li><code>closing_tips:</code> 設定其結束輸入提示符,可不塡,不塡則無提示符</li>
<li><code>extra_tags:</code> 爲此<code>segmentor</code>所標記的段落插上其它<code>tag</code></li>
</ol>
<ul><strong>當<code>affix_segmentor</code>和<code>translator</code>重名時,兩者可併在一處配置,此處1-5條對應下面19-23條。<code>abc_segmentor</code>僅可設<code>extra_tags</code></strong></ul>
<ul><h4><strong>示例</strong></h4>
<p><small>cangjie6.schema.yaml</small></p>
<pre><code>reverse_lookup:
tag: reverse_lookup
prefix: "`"
suffix: ";"
tips: "【反查】"
closing_tips: "【蒼頡】"
extra_tags:
- pinyin_lookup
- jyutping_lookup
</code></pre></ul>
<h3>三、<code>translator</code></h3>
<ul><li>每個方案有一個主<code>translator</code>,在引擎列表中不以<code>@</code>+翻譯器名定義,在細項配置時直接以<code>translator:</code>命名。以下加粗項爲可在主<code>translator</code>中定義之項,其它可在副〔以<code>@</code>+翻譯器名命名〕<code>translator</code>中定義</li>
</ul>
<ol><li><b><code>enable_charset_filter:</code></b> 是否開啓字符集過濾〔僅<code>table_translator</code>有效。啓用<code>cjk_minifier</code>後可適用於<code>script_translator</code>〕</li>
<li><b><code>enable_encoder:</code></b> 是否開啓自動造詞〔僅<code>table_translator</code>有效〕</li>
<li><b><code>encode_commit_history:</code></b> 是否對已上屛詞自動成詞〔僅<code>table_translator</code>有效〕</li>
<li><b><code>max_phrase_length:</code></b> 最大自動成詞詞長〔僅<code>table_translator</code>有效〕</li>
<li><b><code>enable_completion:</code></b> 提前顯示尚未輸入完整碼的字〔僅<code>table_translator</code>有效〕</li>
<li><b><code>sentence_over_completion:</code></b> 在無全碼對應字而僅有逐鍵提示時也開啓智能組句〔僅<code>table_translator</code>有效〕</li>
<li><b><code>strict_spelling:</code></b> 配合<code>speller</code>中的<code>fuzz</code>規則,僅以畧拼碼組詞〔僅<code>table_translator</code>有效〕</li>
<li><b><code>disable_user_dict_for_patterns:</code></b> 禁止某些編碼錄入用戶詞典</li>
<li><b><code>enable_sentence:</code></b> 是否開啓自動造句</li>
<li><b><code>enable_user_dict:</code></b> 是否開啓用戶詞典〔用戶詞典記錄動態字詞頻、用戶詞〕</li>
<ul><li>以上選塡<code>true</code>或<code>false</code></li></ul>
<li><b><code>dictionary:</code></b> 翻譯器將調取此字典文件</li>
<li><b><code>prism:</code></b> 設定由此主翻譯器的<code>speller</code>生成的棱鏡文件名,或此副編譯器調用的棱鏡名</li>
<li><b><code>user_dict:</code></b> 設定用戶詞典名</li>
<li><b><code>db_class:</code></b> 設定用戶詞典類型,可設<code>tabledb</code>〔文本〕或<code>userdb</code>〔二進制〕</li>
<li><b><code>preedit_format:</code></b> 上屛碼自定義</li>
<li><b><code>comment_format:</code></b> 提示碼自定義</li>
<li><b><code>spelling_hints:</code></b> 設定多少字以內候選標註完整帶調拼音〔僅<code>script_translator</code>有效〕</li>
<li><b><code>initial_quality:</code></b> 設定此翻譯器出字優先級</li>
<li><code>tag:</code> 設定此翻譯器針對的<code>tag</code>。可不塡,不塡則僅針對<code>abc</code></li>
<li><code>prefix:</code> 設定此翻譯器的前綴標識,可不塡,不塡則無前綴</li>
<li><code>suffix:</code> 設定此翻譯器的尾綴標識,可不塡,不塡則無尾綴</li>
<li><code>tips:</code> 設定此翻譯器的輸入前提示符,可不塡,不塡則無提示符</li>
<li><code>closing_tips:</code> 設定此翻譯器的結束輸入提示符,可不塡,不塡則無提示符</li>
<li><code>contextual_suggestions:</code> 是否使用語言模型優化輸出結果〔需配合<code>grammar</code>使用〕</li>
<li><code>max_homophones:</code> 最大同音簇長度〔需配合<code>grammar</code>使用〕</li>
<li><code>max_homographs:</code> 最大同形簇長度〔需配合<code>grammar</code>使用〕</li>
</ol>
<ul><h4><strong>示例</strong></h4>
<p><small>cangjie6.schema.yaml 蒼頡主翻譯器</small></p>
<pre><code>translator:
dictionary: cangjie6
enable_charset_filter: true
enable_sentence: true
enable_encoder: true
encode_commit_history: true
max_phrase_length: 5
preedit_format:
- xform/^([a-z ]<em>)$/$1|\U$1\E/
- xform/(?<=[a-z])\s(?=[a-z])//
- "xlit|ABCDEFGHIJKLMNOPQRSTUVWXYZ|日月金木水火土竹戈十大中一弓人心手口尸廿山女田止卜片|"
comment_format:
- "xlit|abcdefghijklmnopqrstuvwxyz~|日月金木水火土竹戈十大中一弓人心手口尸廿山女田止卜片・|"
disable_user_dict_for_patterns:
- "^z.</em>$"
initial_quality: 0.75
</code></pre>
<p><small>cangjie6.schema.yaml 拼音副翻譯器</small></p>
<pre><code>pinyin:
tag: pinyin
dictionary: luna_pinyin
enable_charset_filter: true
prefix: 'P' #須配合recognizer
suffix: ';' #須配合recognizer
preedit_format:
- "xform/([nl])v/$1ü/"
- "xform/([nl])ue/$1üe/"
- "xform/([jqxy])v/$1u/"
tips: "【漢拼】"
closing_tips: "【蒼頡】"
</code></pre>
<p><small>pinyin_simp.schema.yaml 拼音・簡化字主翻譯器</small></p>
<pre><code>translator:
dictionary: luna_pinyin
prism: luna_pinyin_simp
preedit_format:
- xform/([nl])v/$1ü/
- xform/([nl])ue/$1üe/
- xform/([jqxy])v/$1u/
</code></pre>
<p><small>luna_pinyin.schema.yaml 朙月拼音用戶短語</small></p>
<pre><code>custom_phrase: #這是一個table_translator
dictionary: ""
user_dict: custom_phrase
db_class: tabledb
enable_sentence: false
enable_completion: false
initial_quality: 1
</code></pre></ul>
<h3>四、<code>reverse_lookup_filter</code></h3>
<ul><li>此濾鏡須掛在<code>translator</code>上,不影響該<code>translator</code>工作</li>
</ul>
<ol><li><code>tags:</code> 設定其作用範圍
<li><code>overwrite_comment:</code> 是否覆蓋其他提示
<li><code>dictionary:</code> 反查所得提示碼之碼表
<li><code>comment_format:</code> 自定義提示碼格式
</ol>
<ul><h4><strong>示例</strong></h4>
<p><small>cangjie6.schema.yaml</small></p>
<pre><code>pinyin_reverse_lookup: #該反查濾鏡名
tags: [ pinyin_lookup ] #掛在這個tag所對應的翻譯器上
overwrite_comment: true
dictionary: cangjie6 #反查所得爲蒼頡碼
comment_format:
- "xform/$/〕/"
- "xform/^/〔/"
- "xlit|abcdefghijklmnopqrstuvwxyz |日月金木水火土竹戈十大中一弓人心手口尸廿山女田止卜片、|"
</code></pre></ul>
<h3>五、<code>simplifier</code></h3>
<ol><li><code>option_name:</code> 對應<code>switches</code>中設定的切換項名</li>
<li><code>opencc_config:</code> 用字轉換配置文件</li>
<ul><li>位於:<code>rime_dir/opencc/</code>,自帶之配置文件含:</li>
<ol><li>繁轉簡〔默認〕:<code>t2s.json</code></li>
<li>繁轉臺灣:<code>t2tw.json</code></li>
<li>繁轉香港:<code>t2hk.json</code></li>
<li>簡轉繁:<code>s2t.json</code></li>
</ol></ul>
<li><code>tags:</code> 設定轉換範圍</li>
<li><code>tips:</code> 設定是否提示轉換前的字,可塡<code>none</code>〔或不塡〕、<code>char</code>〔僅對單字有效〕、<code>all</code></li>
<li><code>show_in_comment:</code> 設定是否僅將轉換結果顯示在備注中
<li><i><code>excluded_types:</code></i> 取消特定範圍〔一般爲<i><code>reverse_lookup_translator</code></i>〕轉化用字</li>
</ol>
<ul><h4><strong>示例</strong></h4>
<p><small>修改自 luna_pinyin_kunki.schema</small></p>
<pre><code>zh_tw:
option_name: zh_tw
opencc_config: t2tw.json
tags: [ abc ] #abc對應abc_segmentor
tips: none
</code></pre></ul>
<h3><i>六、<code>chord_composer</code></i></h3>
<ul><li>並擊把鍵盤分兩半,相當於兩塊鍵盤。兩邊同時擊鍵,系統默認在其中一半上按的鍵先於另一半,由此得出上屛碼</li>
</ul>
<ol><li><code>alphabet:</code> 字母表,包含用於並擊的按鍵。擊鍵雖有先後,形成並擊時,一律以字母表順序排列
<li><code>algebra:</code> 拼寫運算規則,將一組並擊編碼轉換爲拼音音節
<li><code>output_format:</code> 並擊完成後套用的式樣,追加隔音符號
<li><code>prompt_format:</code> 並擊過程中套用的式樣,加方括弧
</ol>
<ul><h4><strong>示例</strong></h4>
<p><small>combo_pinyin.schema.yaml</small></p>
<pre><code>chord_composer:
# 字母表,包含用於並擊的按鍵
# 擊鍵雖有先後,形成並擊時,一律以字母表順序排列
alphabet: "swxdecfrvgtbnjum ki,lo."
# 拼寫運算規則,將一組並擊編碼轉換爲拼音音節
algebra:
# 先將物理按鍵字符對應到宮保拼音鍵位中的拼音字母
- 'xlit|swxdecfrvgtbnjum ki,lo.|sczhlfgdbktpRiuVaNIUeoE|'
# 以下根據宮保拼音的鍵位分別變換聲母、韻母部分
# 組合聲母
- xform/^zf/zh/
- xform/^cl/ch/
- xform/^fb/m/
- xform/^ld/n/
- xform/^hg/r/
……
# 聲母獨用時補足隠含的韻母
- xform/^([bpf])$/$1u/
- xform/^([mdtnlgkh])$/$1e/
- xform/^([mdtnlgkh])$/$1e/
- xform/^([zcsr]h?)$/$1i/
# 並擊完成後套用的式樣,追加隔音符號
output_format:
- "xform/^([a-z]+)$/$1'/"
# 並擊過程中套用的式樣,加方括弧
prompt_format:
- "xform/^(.*)$/[$1]/"
</code></pre></ul>
<h3>七、<code>lua</code></h3>
<ul><li>請參攷<a href="https://github.com/hchunhui/librime-lua">hchunhui/librime-lua</a> 以尋求更多靈感。</li></ul>
<ol>
<li><code>lua_translator</code></li>
<li><code>lua_filter</code></li>
<li><code>lua_processor</code></li>
<li><code>lua_segmentor</code></li>
</ol>
<ul><h4><strong>示例</strong></h4>
<p><small>rime.lua</small></p>
<pre><code>function get_date(input, seg, env)
--- 以 show_date 爲開關名或 key_binder 中 toggle 的對象
on = env.engine.context:get_option("show_date")
if (on and input == "date") then
--- Candidate(type, start, end, text, comment)
yield(Candidate("date", seg.start, seg._end, os.date("%Y年%m月%d日"), " 日期"))
end
end
function single_char_first(input, env)
--- 以 single_char 爲開關名或 key_binder 中 toggle 的對象
on = env.engine.context:get_option("single_char")
local cache = {}
for cand in input:iter() do
if (not on or utf8.len(cand.text) == 1) then
yield(cand)
else
table.insert(cache, cand)
end
end
for i, cand in ipairs(cache) do
yield(cand)
end
end
</code></pre></ul>
<h3>八、其它</h3>
<ul><li>包括<code>recognizer</code>、<code>key_binder</code>、<code>punctuator</code>。<b>標點</b>、<b>快捷鍵</b>、<b>二三選重</b>、<b>特殊字符</b>等均於此設置</li>
</ul>
<ol><li><b><code>import_preset:</code></b> 由外部統一文件導入
<li><code>grammar:</code> 下設:
<ul><li><code>language:</code> 取值<code>zh-han[ts]-t-essay-bg[wc]</code></li>
<li><code>collocation_max_length:</code> 最大搭配長度(整句輸入可忽畧此項)</li>
<li><code>collocation_min_length:</code> 最小搭配長度(整句輸入可忽畧此項)</li>
</ul></li>
<li><code>recognizer:</code> 下設<code>patterns:</code> 配合<code>segmentor</code>的<code>prefix</code>和<code>suffix</code>完成段落劃分、<code>tag</code>分配
<ul><li>前字段可以爲以<code>affix_segmentor@someTag</code>定義的<code>Tag</code>名,或者<code>punct</code>、<code>reverse_lookup</code>兩個內設的字段。其它字段不調用輸入法引擎,輸入即輸出〔如<code>url</code>等字段〕</li></ul></li>
<li><code>key_binder:</code> 下設<code>bindings:</code> 設置功能性快捷鍵
<ul><li>每一條<code>binding</code>可能包含:<code>accept</code>實際所按之鍵、<code>send</code>輸出效果、<code>toggle</code>切換開關和<code>when</code>作用範圍〔<code>send</code>和<code>toggle</code>二選一〕</li>
<ul>
<li><code>toggle</code>可用字段包含各開關名</li>
<li><code>when</code>可用字段包含:</li>
<ul><pre><code>paging 翻䈎用
has_menu 操作候選項用
composing 操作輸入碼用
always 全域
</code></pre></ul>
<li><code>accept</code>和<code>send</code>可用字段除A-Za-z0-9外,還包含以下鍵板上實際有的鍵:</li>
<ul><pre><code>BackSpace 退格
Tab 水平定位符
Linefeed 换行
Clear 清除
Return 回車
Pause 暫停
Sys_Req 印屏
Escape 退出
Delete 刪除
Home 原位
Left 左箭頭
Up 上箭頭
Right 右箭頭
Down 下箭頭
Prior、Page_Up 上翻
Next、Page_Down 下翻
End 末位
Begin 始位
Shift_L 左Shift
Shift_R 右Shift
Control_L 左Ctrl
Control_R 右Ctrl
Meta_L 左Meta
Meta_R 右Meta
Alt_L 左Alt
Alt_R 右Alt
Super_L 左Super
Super_R 右Super
Hyper_L 左Hyper
Hyper_R 右Hyper
Caps_Lock 大寫鎖
Shift_Lock 上檔鎖
Scroll_Lock 滾動鎖
Num_Lock 小鍵板鎖
Select 選定
Print 列印
Execute 執行
Insert 插入
Undo 還原
Redo 重做
Menu 菜單
Find 蒐尋
Cancel 取消
Help 幫助
Break 中斷
space
exclam !
quotedbl "
numbersign #
dollar $
percent %
ampersand &
apostrophe '
parenleft (
parenright )
asterisk *
plus +
comma ,
minus -
period .
slash /
colon :
semicolon ;
less <
equal =
greater >
question ?
at @
bracketleft [
backslash \
bracketright ]
asciicircum ^
underscore _
grave `
braceleft {
bar |
braceright }
asciitilde ~
KP_Space 小鍵板空格
KP_Tab 小鍵板水平定位符
KP_Enter 小鍵板回車
KP_Delete 小鍵板刪除
KP_Home 小鍵板原位
KP_Left 小鍵板左箭頭
KP_Up 小鍵板上箭頭
KP_Right 小鍵板右箭頭
KP_Down 小鍵板下箭頭
KP_Prior、KP_Page_Up 小鍵板上翻
KP_Next、KP_Page_Down 小鍵板下翻
KP_End 小鍵板末位
KP_Begin 小鍵板始位
KP_Insert 小鍵板插入
KP_Equal 小鍵板等於
KP_Multiply 小鍵板乘號
KP_Add 小鍵板加號
KP_Subtract 小鍵板減號
KP_Divide 小鍵板除號
KP_Decimal 小鍵板小數點
KP_0 小鍵板0
KP_1 小鍵板1
KP_2 小鍵板2
KP_3 小鍵板3
KP_4 小鍵板4
KP_5 小鍵板5
KP_6 小鍵板6
KP_7 小鍵板7
KP_8 小鍵板8
KP_9 小鍵板9
</ul></pre></code>
</ul></ul></ul>
<li><code>editor</code>用以訂製操作鍵〔不支持<code>import_preset:</code>〕,鍵板鍵名同<code>key_binder/bindings</code>中的<code>accept</code>和<code>send</code>,效果定義如下:</li>
<ul><pre><code>confirm 上屏候選項
commit_comment 上屏候選項備注
commit_raw_input 上屏原始輸入
commit_script_text 上屏變換後輸入
commit_composition 語句流單字上屏
revert 撤消上次輸入
back 按字符回退
back_syllable 按音節回退
delete_candidate 刪除候選項
delete 向後刪除
cancel 取消輸入
noop 空
</code></pre></ul>
<li><code>punctuator:</code> 下設<code>full_shape:</code>和<code>half_shape:</code>分别控制全角模式下的符號和半角模式下的符號,另有<code>use_space:</code>空格頂字〔<code>true</code>或<code>false</code>〕
<ul><li>每條標點項可加<code>commit</code>直接上屏和<code>pair</code>交替上屏兩種模式,默認爲選單模式</li></ul>
</ol>
<ul><h4><strong>示例</strong></h4>
<p><small>修改自 cangjie6.schema.yaml</small></p>
<pre><code>key_binder:
import_preset: default
bindings:
- {accept: semicolon, send: 2, when: has_menu} #分號選第二重碼
- {accept: apostrophe, send: 3, when: has_menu} #引號選第三重碼
- {accept: "Control+1", select: .next, when: always}
- {accept: "Control+2", toggle: full_shape, when: always}
- {accept: "Control+3", toggle: simplification, when: always}
- {accept: "Control+4", toggle: extended_charset, when: always}
editor:
bindings:
Return: commit_comment
punctuator:
import_preset: symbols
half_shape:
"'": {pair: ["「", "」"]} #第一次按是「,第二次是」
"(": ["〔", "["] #彈出選單
.: {commit: "。"} #無選單,直接上屛。優先級最高
recognizer:
import_preset: default
patterns:
email: "^[a-z][-_.0-9a-z]*@.*$"
url: "^(www[.]|https?:|ftp:|mailto:).*$"
reverse_lookup: "`[a-z]*;?$"
pinyin_lookup: "`P[a-z]*;?$"
jyutping_lookup: "`J[a-z]*;?$"
pinyin: "(?<!`)P[a-z']*;?$"
jyutping: "(?<!`)J[a-z']*;?$"
punct: "/[a-z]*$" #配合symbols.yaml中的特殊字符輸入
</code></pre></ul>
<h2>其它</h2>
<ul><li>Rime還爲每個方案提供選單和一定的外觀訂製能力</li>
<li>通常情況下<code>menu</code>在<code>default.yaml</code>中定義〔或用戶修改檔<code>default.custom.yaml</code>〕,<code>style</code>在<code>squirrel.yaml</code>或<code>weasel.yaml</code>〔或用戶修改檔<code>squirrel.custom.yaml</code>或<code>weasel.custom.yaml</code>〕</li>
<h4><strong>示例</strong></h4>
<pre><code>menu:
alternative_select_labels: [ ①, ②, ③, ④, ⑤, ⑥, ⑦, ⑧, ⑨ ] # 修改候選標籤
alternative_select_keys: ASDFGHJKL #如編碼字符佔用數字鍵則須另設選字鍵
page_size: 5 #選單每䈎顯示個數
style:
font_face: "HanaMinA, HanaMinB" #字體〔小狼毫得且僅得設一個字體;鼠鬚管得設多個字體,後面的字體自動補前面字體不含的字〕
font_point: 15 #字號
label_format: '%s' # 候選標籤格式
horizontal: false #橫/直排
line_spacing: 1 #行距
inline_preedit: true #輸入碼內嵌
</code></pre></ul>
<br>
<h1 align="center"><code>Dict.yaml</code> 詳解</h1>
<h2></h2>
<hr>
<h2>開始之前</h2>
<pre><code># Rime dict
# encoding: utf-8
〔你還可以在這註釋字典來源、變動記錄等〕
</code></pre>
<h2>描述檔</h2>
<ol><li><code>name:</code> 內部字典名,也即<code>schema</code>所引用的字典名,確保與文件名相一致</li>
<li><code>version:</code> 如果發佈,請確保每次改動陞版本號</li>
</ol>
<ul><h4><strong>示例</strong></h4>
<pre><code>name: "cangjie6.extended"
version: "0.1"
</code></pre></ul>
<h2>配置</h2>
<ol><li><code>sort:</code> 字典<b>初始</b>排序,可選<code>original</code>或<code>by_weight</code></li>
<li><code>use_preset_vocabulary:</code> 是否引入「八股文」〔含字詞頻、詞庫〕</li>
<li><code>max_phrase_length:</code> 配合<code>use_preset_vocabulary:</code>,設定導入詞條最大詞長</li>
<li><code>min_phrase_weight:</code> 配合<code>use_preset_vocabulary:</code>,設定導入詞條最小詞頻</li>
<li><code>columns:</code> 定義碼表以<code>Tab</code>分隔出的各列,可設<code>text</code>【文本】、<code>code</code>【碼】、<code>weight</code>【權重】、<code>stem</code>【造詞碼】</li>
<li><code>import_tables:</code> 加載其它外部碼表</li>
<li><code>encoder:</code> 形碼造詞規則</li>
<ol type="a">
<li><code>exclude_patterns:</code></li>
<li><code>rules:</code> 可用<code>length_equal:</code>和<code>length_in_range:</code>定義。大寫字母表示字序,小寫字母表示其所跟隨的大寫字母所以表的字中的編碼序</li>
<li><code>tail_anchor:</code> 造詞碼包含結構分割符〔僅用於倉頡〕</li>
<li><code>exclude_patterns</code> 取消某編碼的造詞資格</li>
</ol></ol>
<ul><h4><strong>示例</strong></h4>
<p><small>cangjie6.extended.dict.yaml</small></p>
<pre><code>sort: by_weight
use_preset_vocabulary: false
import_tables:
- cangjie6 #單字碼表由cangjie6.dict.yaml導入
columns: #此字典爲純詞典,無單字編碼,僅有字和詞頻
- text #字/詞
- weight #字/詞頻
encoder:
exclude_patterns:
- '^z.*$'
rules:
- length_equal: 2 #對於二字詞
formula: "AaAzBaBbBz" #取第一字首尾碼、第二字首次尾碼
- length_equal: 3 #對於三字詞
formula: "AaAzBaYzZz" #取第一字首尾碼、第二字首尾碼、第三字尾碼
- length_in_range: [4, 5] #對於四至五字詞
formula: "AaBzCaYzZz" #取第一字首碼,第二字尾碼、第三字首碼、倒數第二字尾碼、最後一字尾碼
tail_anchor: "'"
</code></pre></ul>
<h2>碼表</h2>
<ul><li>以<code>Tab</code>分隔各列,各列依<code>columns:</code>定義排列。</li></ul>
<ul><h4><strong>示例</strong></h4>
<p><small>cangjie6.dict.yaml</small></p>
<pre><code>columns:
- text #第一列字/詞
- code #第二列碼
- weight #第三列字/詞頻
- stem #第四列造詞碼
</code></pre>
<p><small>cangjie6.dict.yaml</small></p>
<pre><code>個 owjr 246268 ow'jr
看 hqbu 245668
中 l 243881
呢 rsp 242970
來 doo 235101
嗎 rsqf 221092
爲 bhnf 211340
會 owfa 209844
她 vpd 204725
與 xyc 203975
給 vfor 193007
等 hgdi 183340
這 yymr 181787
用 bq 168934 b'q
</code></pre>
</ul>
<hr>
<p align="right">雪齋<br>
09-Nov-2013</p>
</body>
</html>
| {
"pile_set_name": "Github"
} |
"""
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
"""Utility functions for PGGAN."""
import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as layers
import util_misc
from libs import ops
# Flags are defined in pggan.py.
FLAGS = tf.flags.FLAGS
#############
# Constants #
#############
DEFAULT_KERNEL_SIZE = 3
DEFAULT_ACTIVATION_FN = util_misc.fp16_friendly_leaky_relu
# Norm types
BATCH_NORM_TYPE = 'batch_norm'
INSTANCE_NORM_TYPE = 'instance_norm'
BATCH_RENORM_TYPE = 'batch_renorm'
BATCH_RENORM_NATIVE_TYPE = 'batch_renorm_native'
LAYER_NORM_NATIVE_TYPE = 'layer_norm_native'
NO_NORM_TYPE = 'none'
# Note for pggan the global step restarts from 0 for every stage.
BATCH_RENORM_BOUNDARIES = [10000, 20000, 30000]
BATCH_RENORM_RMAX_VALUES = [1.1, 1.5, 2.0, 4.0]
BATCH_RENORM_RMIN_VALUES = [0.9, 0.66, 0.5, 0.25]
BATCH_RENORM_DMAX_VALUES = [0.1, 0.3, 0.5, 1.0]
##############
# Arg scopes #
##############
def pggan_arg_scope(norm_type=None, conditional_layer=None,
norm_var_scope_postfix='',
weights_init_stddev=0.02,
weight_decay=0.0,
is_training=False,
reuse=None):
"""
:param norm_type: A string specifying the normalization type. See norm type constants for allowed values.
:param conditional_layer: A tensor that the norm parameters are conditioned on.
:param norm_var_scope_postfix: A string. Optional postfix to the normalizer variable scopes. For example if postfix
is 'pf', then norm variable 'alpha' will become 'alpha_pf'.
:param weights_init_stddev: A float. Standard deviation of the weight initializer.
:param weight_decay: A float. Optional decay to apply to weights.
:param is_training: A boolean. Used by the normalizers such as batch norm.
:param reuse: A boolean. If set, reuse variables.
:return:
"""
normalizer_fn, norm_params = get_normalizer_fn_and_params(
norm_type,
conditional_layer=conditional_layer,
var_scope_postfix=norm_var_scope_postfix,
is_training=is_training,
reuse=reuse)
weights_regularizer = None
if weight_decay and weight_decay > 0.0:
weights_regularizer = layers.l2_regularizer(weight_decay)
if FLAGS.equalized_learning_rate:
# In equalized learning rate, weights are initialized using N(0,1), then explicitly scaled at runtime.
weights_init_stddev = 1.0
with tf.contrib.framework.arg_scope(
[layers.conv2d, layers.conv2d_transpose, ops.convolution],
# Note: the activation is added after the normalizer_fn.
activation_fn=DEFAULT_ACTIVATION_FN,
# Note: In the PGGAN paper pixel norm is used for generator and no normalization is used for the discriminator.
normalizer_fn=normalizer_fn,
normalizer_params=norm_params,
weights_initializer=tf.random_normal_initializer(0, weights_init_stddev),
weights_regularizer=weights_regularizer,
stride=1,
kernel_size=DEFAULT_KERNEL_SIZE,
padding='SAME',
reuse=reuse) as sc:
return sc
def pggan_generator_arg_scope(norm_type=None,
conditional_layer=None,
conditional_layer_var_scope_postfix='',
weights_init_stddev=0.02,
weight_decay=0.0,
is_training=False,
reuse=None):
"""Wrapper around `pggan_arg_scope` for the generator/encoder. The difference is in the `norm_type`."""
return pggan_arg_scope(norm_type=norm_type, conditional_layer=conditional_layer,
norm_var_scope_postfix=conditional_layer_var_scope_postfix,
weights_init_stddev=weights_init_stddev, weight_decay=weight_decay,
is_training=is_training, reuse=reuse)
def pggan_discriminator_arg_scope(norm_type=NO_NORM_TYPE,
conditional_layer=None,
conditional_layer_var_scope_postfix='',
weights_init_stddev=0.02,
weight_decay=0.0,
is_training=False,
reuse=None):
"""Wrapper around `pggan_arg_scope` for the discriminator. The difference is in the `norm_type`."""
return pggan_arg_scope(norm_type=norm_type, conditional_layer=conditional_layer,
norm_var_scope_postfix=conditional_layer_var_scope_postfix,
weights_init_stddev=weights_init_stddev, weight_decay=weight_decay,
is_training=is_training, reuse=reuse)
###############
# Norm Params #
###############
def get_normalizer_fn_and_params(norm_type=None,
conditional_layer=None,
var_scope_postfix='',
is_training=False,
reuse=None):
"""Helper function to return the normalization function specified by `norm_type`."""
if norm_type is None:
norm_type = FLAGS.generator_norm_type
if norm_type == BATCH_NORM_TYPE:
normalizer_fn = ops.conditional_batch_norm
norm_params = {
'center': True,
'scale': True,
'is_training': is_training,
'reuse': reuse,
'var_scope_postfix': var_scope_postfix,
'conditional_layer': conditional_layer,
}
elif norm_type == INSTANCE_NORM_TYPE:
normalizer_fn = ops.instance_norm
norm_params = {
'center': True,
'scale': True,
'reuse': reuse,
'var_scope_postfix': var_scope_postfix,
'conditional_layer': conditional_layer,
}
elif norm_type == BATCH_RENORM_TYPE:
normalizer_fn = ops.conditional_batch_norm
norm_params = {
'decay': 0.99, # Set to be the same as renorm decay.
'center': True,
'scale': True,
'is_training': is_training,
'reuse': reuse,
'renorm': True,
'renorm_clipping': get_renorm_clipping_params(),
'var_scope_postfix': var_scope_postfix,
'conditional_layer': conditional_layer,
}
elif norm_type == BATCH_RENORM_NATIVE_TYPE:
tf.logging.log_every_n(tf.logging.INFO, 'Using tensorflow native implementation of batch renorm.', 100)
assert conditional_layer is None, ('Tensorflow implementation does not support `conditional_layer`.')
normalizer_fn = layers.batch_norm
norm_params = {
'decay': 0.99, # Set to be the same as renorm decay because inference quality is too poor.
'center': True,
'scale': True,
'is_training': is_training,
'reuse': reuse,
'renorm': True,
'renorm_clipping': get_renorm_clipping_params(),
'scope': var_scope_postfix
}
elif norm_type == LAYER_NORM_NATIVE_TYPE:
tf.logging.log_every_n(tf.logging.INFO, 'Using tensorflow native implementation of layer norm.', 100)
assert conditional_layer is None, ('Tensorflow implementation does not support `conditional_layer`.')
normalizer_fn = layers.layer_norm
norm_params = {
'center': True,
'scale': True,
'reuse': reuse,
'scope': var_scope_postfix
}
elif not norm_type or norm_type == NO_NORM_TYPE:
normalizer_fn = None
norm_params = None
else:
raise NotImplementedError('unsupported norm type: %s' % norm_type)
return normalizer_fn, norm_params
def get_renorm_clipping_params():
"""Returns a dictionary containing batch renorm parameters, which are dependent on the global step."""
global_step = tf.train.get_global_step()
if global_step is not None:
# Start with 1.0/0.0 and slowly relax them.
rmax = tf.train.piecewise_constant(global_step, boundaries=BATCH_RENORM_BOUNDARIES, values=BATCH_RENORM_RMAX_VALUES,
name='rmax')
rmin = tf.train.piecewise_constant(global_step, boundaries=BATCH_RENORM_BOUNDARIES, values=BATCH_RENORM_RMIN_VALUES,
name='rmin')
dmax = tf.train.piecewise_constant(global_step, boundaries=BATCH_RENORM_BOUNDARIES, values=BATCH_RENORM_DMAX_VALUES,
name='dmax')
else:
tf.logging.warning('Cannot find global step. Falling back to default renorm clipping parameter values.')
rmax = BATCH_RENORM_RMAX_VALUES[-1]
rmin = BATCH_RENORM_RMIN_VALUES[-1]
dmax = BATCH_RENORM_DMAX_VALUES[-1]
return {'rmax': rmax, 'rmin': rmin, 'dmax': dmax}
#################################################################
# Helper functions for convolutional and fully connected layers #
#################################################################
# Functions used by pggan.py.
def maybe_pixel_norm(layer, do_pixel_norm):
"""Applies pixel norm if `do_pixel_norm` is set. Otherwise acts as identity function."""
return _pixel_norm(layer) if do_pixel_norm else layer
def maybe_equalized_conv2d(inputs, num_outputs, kernel_size=DEFAULT_KERNEL_SIZE, is_discriminator=False, **kwargs):
"""If `equalized_learning_rate` flag is set, applies equalized lr before conv2d."""
if FLAGS.equalized_learning_rate:
in_ch = int(inputs.shape[-1])
# Parameters from variance_scaling_initializer, MSRA initialization aka. Kaiming Initialization.
# trunc_stddev = math.sqrt(1.3 * 2.0 / in_ch)
inv_c = np.sqrt(2.0 / (in_ch * kernel_size ** 2))
inputs = inv_c * inputs
return _maybe_spectral_normed_conv(inputs, num_outputs=num_outputs, kernel_size=kernel_size,
is_discriminator=is_discriminator, **kwargs)
def maybe_equalized_fc(inputs, num_outputs, is_discriminator=False, **kwargs):
"""If `equalized_learning_rate` flag is set, applies equalized lr before fc."""
if FLAGS.equalized_learning_rate:
in_ch = int(inputs.shape[-1])
inv_c = np.sqrt(2.0 / in_ch)
inputs = inv_c * inputs
return _maybe_spectral_normed_fully_connected(inputs, num_outputs, is_discriminator=is_discriminator, **kwargs)
def maybe_resblock(input_layer, out_channels, conv2d_out, is_discriminator=False):
"""If `use_res_block` flag is set, add a residule layer shortcut to conv2d_out."""
if FLAGS.use_res_block:
shortcut = _get_resblock_shortcut(input_layer, out_channels, is_discriminator=is_discriminator)
ret = shortcut + conv2d_out
else:
ret = conv2d_out
return ret
def maybe_concat_conditional_layer(layer, conditional_layer):
"""If `conditional_layer` is not None, reshape and concatenate it to `layer`."""
if conditional_layer is not None:
# Resize conditional layer to the same height and width as layer.
assert len(conditional_layer.shape) == 4
resized_conditional_layer = conditional_layer
# Bilinear is differentiable.
resized_conditional_layer = tf.image.resize_bilinear(resized_conditional_layer, layer.shape[1:3])
resized_conditional_layer = tf.cast(resized_conditional_layer, conditional_layer.dtype)
return tf.concat((layer, resized_conditional_layer), axis=-1)
else:
return layer
def maybe_concat_unet_layer(layer, unet_end_points):
"""If `unet_end_points` is not None, finds the corresponding unet layer and concatenate it to `layer`."""
if unet_end_points is None:
return layer
# Assume h = w.
hw = int(layer.shape[1])
# If `pggan_unet_max_concat_hw` flag is specified, do not concatenate if hw is larger than that.
if FLAGS.pggan_unet_max_concat_hw and hw > FLAGS.pggan_unet_max_concat_hw:
return layer
max_stage = int(np.log2(hw)) - 2
num_channels = get_num_channels(max_stage - 1)
unet_layer_name = 'encoder_block_interpolated_%dx%dx%d' % (hw, hw, num_channels)
if unet_layer_name not in unet_end_points:
unet_layer_name = 'encoder_block_%dx%dx%d' % (hw, hw, num_channels)
if unet_layer_name not in unet_end_points:
raise ValueError('%s not in unet_end_points' % (unet_layer_name))
return tf.concat((layer, unet_end_points[unet_layer_name]), axis=-1)
def maybe_add_self_attention(do_self_attention, self_attention_hw, hw, channels, net, end_points):
"""If hw==self_attention_hw, adds a self attention module. See SAGAN for details."""
if do_self_attention and hw == self_attention_hw:
scope_name = 'self_attention_%dx%dx%d' % (hw, hw, channels)
with tf.variable_scope(scope_name):
net = ops.self_attention_layer(net)
end_points[scope_name] = net
return net
# Internal functions
# Although in the spectral norm paper, the spectral norm was applied to the discriminator, because it's main purpose was
# to make the discriminator 1-Lipschitz continuous. However some recent paper like SAGAN found that applying spectral
# norm to generator also helps. Thus the `is_discriminator` variable and the `spectral_norm_in_non_discriminator` flag.
def _maybe_spectral_normed_conv(inputs, num_outputs, kernel_size, is_discriminator=False, **kwargs):
if FLAGS.spectral_norm and (is_discriminator or FLAGS.spectral_norm_in_non_discriminator):
return ops.spectral_normed_conv(inputs, num_outputs=num_outputs, kernel_size=kernel_size, **kwargs)
else:
return layers.conv2d(inputs, num_outputs=num_outputs, kernel_size=kernel_size, **kwargs)
def _maybe_spectral_normed_fully_connected(inputs, num_outputs, is_discriminator=False, **kwargs):
if FLAGS.spectral_norm and (is_discriminator or FLAGS.spectral_norm_in_non_discriminator):
return ops.spectral_normed_fc(inputs, num_outputs=num_outputs, **kwargs)
else:
return layers.fully_connected(inputs, num_outputs=num_outputs, **kwargs)
def _pixel_norm(input, eps=1e-6):
return input / tf.sqrt(tf.reduce_mean(tf.square(input), axis=3, keep_dims=True) + tf.constant(eps, dtype=input.dtype))
def _get_resblock_shortcut(input_layer, out_channels, is_discriminator=False):
in_channels = int(input_layer.shape[-1]) # Must have a known channel size.
if out_channels == in_channels:
shortcut = input_layer
else:
shortcut = maybe_equalized_conv2d(
input_layer, out_channels, is_discriminator=is_discriminator, kernel_size=1, normalizer_fn=None,
activation_fn=None, scope='shortcut')
return shortcut
##########################
# Other helper functions #
##########################
def resize_twice_as_big(input_layer):
return tf.image.resize_nearest_neighbor(input_layer, (input_layer.shape[1] * 2, input_layer.shape[2] * 2))
def minibatch_state_concat(input, averaging='all'):
# Injects "the across-minibatch standard deviation as an additional feature map at
# 4 x 4 resolution toward the end of the discriminator as described in Section 3"
# (from PGGAN paper).
adjusted_std = lambda x, **kwargs: tf.sqrt(
tf.reduce_mean((x - tf.reduce_mean(x, **kwargs)) ** 2, **kwargs)
+ tf.constant(1e-8 if x.dtype == tf.float32 else 1e-6, dtype=x.dtype))
vals = adjusted_std(input, axis=0, keepdims=True)
if averaging == 'all':
vals = tf.reduce_mean(vals, keep_dims=True)
else:
raise NotImplementedError('averaging method not supported.')
vals = tf.tile(vals, multiples=[input.shape[0], 4, 4, 1])
return tf.concat([input, vals], axis=3)
def get_num_channels(stage, max_num_channels=None):
if max_num_channels is None:
max_num_channels = FLAGS.pggan_max_num_channels
return min(1024 / (2 ** stage), max_num_channels)
def get_discriminator_max_num_channels():
if FLAGS.pggan_max_num_channels_dis:
max_num_channels = FLAGS.pggan_max_num_channels_dis
else:
max_num_channels = FLAGS.pggan_max_num_channels
return max_num_channels
| {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/* global Windows */
var _supported = null; // set to null so we can check first time
function isSupported() {
// if not checked before, run check
if (_supported === null) {
var viewMan = Windows.UI.ViewManagement;
_supported = (viewMan.StatusBar && viewMan.StatusBar.getForCurrentView);
}
return _supported;
}
function getViewStatusBar() {
if (!isSupported()) {
throw new Error("Status bar is not supported");
}
return Windows.UI.ViewManagement.StatusBar.getForCurrentView();
}
function hexToRgb(hex) {
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
hex = hex.replace(shorthandRegex, function (m, r, g, b) {
return r + r + g + g + b + b;
});
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
module.exports = {
_ready: function(win, fail) {
if(isSupported()) {
var statusBar = getViewStatusBar();
win(statusBar.occludedRect.height !== 0);
}
},
overlaysWebView: function () {
// not supported
},
styleDefault: function () {
// dark text ( to be used on a light background )
if (isSupported()) {
getViewStatusBar().foregroundColor = { a: 0, r: 0, g: 0, b: 0 };
}
},
styleLightContent: function () {
// light text ( to be used on a dark background )
if (isSupported()) {
getViewStatusBar().foregroundColor = { a: 0, r: 255, g: 255, b: 255 };
}
},
styleBlackTranslucent: function () {
// #88000000 ? Apple says to use lightContent instead
return module.exports.styleLightContent();
},
styleBlackOpaque: function () {
// #FF000000 ? Apple says to use lightContent instead
return module.exports.styleLightContent();
},
backgroundColorByHexString: function (win, fail, args) {
var rgb = hexToRgb(args[0]);
if(isSupported()) {
var statusBar = getViewStatusBar();
statusBar.backgroundColor = { a: 0, r: rgb.r, g: rgb.g, b: rgb.b };
statusBar.backgroundOpacity = 1;
}
},
show: function (win, fail) {
// added support check so no error thrown, when calling this method
if (isSupported()) {
getViewStatusBar().showAsync().done(win, fail);
}
},
hide: function (win, fail) {
// added support check so no error thrown, when calling this method
if (isSupported()) {
getViewStatusBar().hideAsync().done(win, fail);
}
}
};
require("cordova/exec/proxy").add("StatusBar", module.exports); | {
"pile_set_name": "Github"
} |
// Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD
//
// 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 <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "freertos/semphr.h"
#include "freertos/event_groups.h"
#include "freertos/portmacro.h"
#ifdef RIOT_VERSION
#include "xtensa/xtensa_api.h"
#else
#include "freertos/xtensa_api.h"
#endif
#include "esp_types.h"
#include "esp_system.h"
#include "esp_task.h"
#include "esp_intr.h"
#include "esp_attr.h"
#include "esp_log.h"
#include "esp_heap_caps.h"
#include "esp_wifi_os_adapter.h"
#include "esp_wifi_internal.h"
#include "esp_phy_init.h"
#include "crypto/md5.h"
#include "crypto/sha1.h"
#include "crypto/crypto.h"
#ifndef RIOT_VERSION
#include "crypto/aes.h"
#endif
#include "crypto/dh_group5.h"
#include "driver/periph_ctrl.h"
#include "nvs.h"
#include "os.h"
#include "esp_smartconfig.h"
#include "smartconfig_ack.h"
extern void esp_dport_access_stall_other_cpu_start_wrap(void);
extern void esp_dport_access_stall_other_cpu_end_wrap(void);
/*
If CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
If failed, try to allocate it in internal memory then.
*/
IRAM_ATTR void *wifi_malloc( size_t size )
{
#if CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
#else
return malloc(size);
#endif
}
/*
If CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
If failed, try to allocate it in internal memory then.
*/
IRAM_ATTR void *wifi_realloc( void *ptr, size_t size )
{
#if CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
return heap_caps_realloc_prefer(ptr, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
#else
return realloc(ptr, size);
#endif
}
/*
If CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
If failed, try to allocate it in internal memory then.
*/
IRAM_ATTR void *wifi_calloc( size_t n, size_t size )
{
#if CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST
return heap_caps_calloc_prefer(n, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
#else
return calloc(n, size);
#endif
}
static void * IRAM_ATTR wifi_zalloc_wrapper(size_t size)
{
void *ptr = wifi_calloc(1, size);
if (ptr) {
memset(ptr, 0, size);
}
return ptr;
}
wifi_static_queue_t* wifi_create_queue( int queue_len, int item_size)
{
wifi_static_queue_t *queue = NULL;
queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
if (!queue) {
return NULL;
}
#if 0 /* TODO: CONFIG_SPIRAM_USE_MALLOC */
queue->storage = heap_caps_calloc(1, sizeof(StaticQueue_t) + (queue_len*item_size), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
if (!queue->storage) {
goto _error;
}
queue->handle = xQueueCreateStatic( queue_len, item_size, ((uint8_t*)(queue->storage)) + sizeof(StaticQueue_t), (StaticQueue_t*)(queue->storage));
if (!queue->handle) {
goto _error;
}
return queue;
_error:
if (queue) {
if (queue->storage) {
free(queue->storage);
}
free(queue);
}
return NULL;
#else
queue->handle = xQueueCreate( queue_len, item_size);
return queue;
#endif
}
void wifi_delete_queue(wifi_static_queue_t *queue)
{
if (queue) {
vQueueDelete(queue->handle);
#if 0 /* TODO: CONFIG_SPIRAM_USE_MALLOC */
if (queue->storage) {
free(queue->storage);
}
#endif
free(queue);
}
}
static void * IRAM_ATTR wifi_create_queue_wrapper(int queue_len, int item_size)
{
return wifi_create_queue(queue_len, item_size);
}
static void IRAM_ATTR wifi_delete_queue_wrapper(void *queue)
{
wifi_delete_queue(queue);
}
static void IRAM_ATTR set_isr_wrapper(int32_t n, void *f, void *arg)
{
xt_set_interrupt_handler(n, (xt_handler)f, arg);
}
static void * IRAM_ATTR spin_lock_create_wrapper(void)
{
portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED;
void *mux = malloc(sizeof(portMUX_TYPE));
if (mux) {
memcpy(mux,&tmp,sizeof(portMUX_TYPE));
return mux;
}
return NULL;
}
static uint32_t IRAM_ATTR wifi_int_disable_wrapper(void *wifi_int_mux)
{
if (xPortInIsrContext()) {
portENTER_CRITICAL_ISR(wifi_int_mux);
} else {
portENTER_CRITICAL(wifi_int_mux);
}
return 0;
}
static void IRAM_ATTR wifi_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp)
{
if (xPortInIsrContext()) {
portEXIT_CRITICAL_ISR(wifi_int_mux);
} else {
portEXIT_CRITICAL(wifi_int_mux);
}
}
static void IRAM_ATTR task_yield_from_isr_wrapper(void)
{
portYIELD_FROM_ISR();
}
static void *IRAM_ATTR semphr_create_wrapper(uint32_t max, uint32_t init)
{
return (void *)xSemaphoreCreateCounting(max, init);
}
static void IRAM_ATTR semphr_delete_wrapper(void *semphr)
{
vSemaphoreDelete(semphr);
}
static int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw)
{
return (int32_t)xSemaphoreTakeFromISR(semphr, hptw);
}
static int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw)
{
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
}
static int32_t IRAM_ATTR semphr_take_wrapper(void *semphr, uint32_t block_time_tick)
{
if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) {
return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY);
} else {
return (int32_t)xSemaphoreTake(semphr, block_time_tick);
}
}
static int32_t IRAM_ATTR semphr_give_wrapper(void *semphr)
{
return (int32_t)xSemaphoreGive(semphr);
}
static void *IRAM_ATTR recursive_mutex_create_wrapper(void)
{
return (void *)xSemaphoreCreateRecursiveMutex();
}
static void *IRAM_ATTR mutex_create_wrapper(void)
{
return (void *)xSemaphoreCreateMutex();
}
static void IRAM_ATTR mutex_delete_wrapper(void *mutex)
{
vSemaphoreDelete(mutex);
}
static int32_t IRAM_ATTR mutex_lock_wrapper(void *mutex)
{
return (int32_t)xSemaphoreTakeRecursive(mutex, portMAX_DELAY);
}
static int32_t IRAM_ATTR mutex_unlock_wrapper(void *mutex)
{
return (int32_t)xSemaphoreGiveRecursive(mutex);
}
static void *IRAM_ATTR queue_create_wrapper(uint32_t queue_len, uint32_t item_size)
{
return (void *)xQueueCreate(queue_len, item_size);
}
static int32_t IRAM_ATTR queue_send_wrapper(void *queue, void *item, uint32_t block_time_tick)
{
if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) {
return (int32_t)xQueueSend(queue, item, portMAX_DELAY);
} else {
return (int32_t)xQueueSend(queue, item, block_time_tick);
}
}
static int32_t IRAM_ATTR queue_send_from_isr_wrapper(void *queue, void *item, void *hptw)
{
return (int32_t)xQueueSendFromISR(queue, item, hptw);
}
static int32_t IRAM_ATTR queue_send_to_back_wrapper(void *queue, void *item, uint32_t block_time_tick)
{
return (int32_t)xQueueGenericSend(queue, item, block_time_tick, queueSEND_TO_BACK);
}
static int32_t IRAM_ATTR queue_send_to_front_wrapper(void *queue, void *item, uint32_t block_time_tick)
{
return (int32_t)xQueueGenericSend(queue, item, block_time_tick, queueSEND_TO_FRONT);
}
static int32_t IRAM_ATTR queue_recv_wrapper(void *queue, void *item, uint32_t block_time_tick)
{
if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) {
return (int32_t)xQueueReceive(queue, item, portMAX_DELAY);
} else {
return (int32_t)xQueueReceive(queue, item, block_time_tick);
}
}
static uint32_t IRAM_ATTR event_group_wait_bits_wrapper(void *event, uint32_t bits_to_wait_for, int clear_on_exit, int wait_for_all_bits, uint32_t block_time_tick)
{
if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) {
return (uint32_t)xEventGroupWaitBits(event, bits_to_wait_for, clear_on_exit, wait_for_all_bits, portMAX_DELAY);
} else {
return (uint32_t)xEventGroupWaitBits(event, bits_to_wait_for, clear_on_exit, wait_for_all_bits, block_time_tick);
}
}
static int32_t IRAM_ATTR task_create_pinned_to_core_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id)
{
return (uint32_t)xTaskCreatePinnedToCore(task_func, name, stack_depth, param, prio, task_handle, (core_id < portNUM_PROCESSORS ? core_id : tskNO_AFFINITY));
}
static int32_t IRAM_ATTR task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle)
{
return (uint32_t)xTaskCreate(task_func, name, stack_depth, param, prio, task_handle);
}
static int32_t IRAM_ATTR task_ms_to_tick_wrapper(uint32_t ms)
{
return (int32_t)(ms / portTICK_PERIOD_MS);
}
static int32_t IRAM_ATTR task_get_max_priority_wrapper(void)
{
return (int32_t)(configMAX_PRIORITIES);
}
static int32_t IRAM_ATTR phy_rf_init_wrapper(const void* init_data, uint32_t mode, void* calibration_data, uint32_t module)
{
return esp_phy_rf_init( init_data, mode, calibration_data, module);
}
static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat)
{
ets_timer_arm(timer, tmout, repeat);
}
static void IRAM_ATTR timer_disarm_wrapper(void *timer)
{
ets_timer_disarm(timer);
}
static void IRAM_ATTR timer_done_wrapper(void *ptimer)
{
ets_timer_done(ptimer);
}
static void IRAM_ATTR timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg)
{
ets_timer_setfn(ptimer, pfunction, parg);
}
static void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat)
{
ets_timer_arm_us(ptimer, us, repeat);
}
static int IRAM_ATTR get_time_wrapper(void *t)
{
return os_get_time(t);
}
static void * IRAM_ATTR malloc_internal_wrapper(size_t size)
{
return heap_caps_malloc(size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size)
{
return heap_caps_realloc(ptr, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR calloc_internal_wrapper(size_t n, size_t size)
{
return heap_caps_calloc(n, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
}
static void * IRAM_ATTR zalloc_internal_wrapper(size_t size)
{
void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
if (ptr) {
memset(ptr, 0, size);
}
return ptr;
}
static void IRAM_ATTR sc_ack_send_wrapper(void *param)
{
return sc_ack_send((sc_ack_t *)param);
}
#ifdef RIOT_VERSION
extern void vPortYield(void);
extern int64_t esp_timer_get_time(void);
#endif
wifi_osi_funcs_t g_wifi_osi_funcs = {
._version = ESP_WIFI_OS_ADAPTER_VERSION,
._set_isr = set_isr_wrapper,
#ifdef RIOT_VERSION
._ints_on = (void (*)(unsigned int))xt_ints_on,
._ints_off = (void (*)(unsigned int))xt_ints_off,
#else
._ints_on = xt_ints_on,
._ints_off = xt_ints_off,
#endif
._spin_lock_create = spin_lock_create_wrapper,
._spin_lock_delete = free,
._wifi_int_disable = wifi_int_disable_wrapper,
._wifi_int_restore = wifi_int_restore_wrapper,
._task_yield = vPortYield,
._task_yield_from_isr = task_yield_from_isr_wrapper,
._semphr_create = semphr_create_wrapper,
._semphr_delete = semphr_delete_wrapper,
._semphr_take_from_isr = semphr_take_from_isr_wrapper,
._semphr_give_from_isr = semphr_give_from_isr_wrapper,
._semphr_take = semphr_take_wrapper,
._semphr_give = semphr_give_wrapper,
._mutex_create = mutex_create_wrapper,
._recursive_mutex_create = recursive_mutex_create_wrapper,
._mutex_delete = mutex_delete_wrapper,
._mutex_lock = mutex_lock_wrapper,
._mutex_unlock = mutex_unlock_wrapper,
._queue_create = queue_create_wrapper,
._queue_delete = vQueueDelete,
._queue_send = queue_send_wrapper,
._queue_send_from_isr = queue_send_from_isr_wrapper,
._queue_send_to_back = queue_send_to_back_wrapper,
._queue_send_to_front = queue_send_to_front_wrapper,
._queue_recv = queue_recv_wrapper,
._queue_recv_from_isr = xQueueReceiveFromISR,
._queue_msg_waiting = uxQueueMessagesWaiting,
._event_group_create = xEventGroupCreate,
._event_group_delete = vEventGroupDelete,
._event_group_set_bits = xEventGroupSetBits,
._event_group_clear_bits = xEventGroupClearBits,
._event_group_wait_bits = event_group_wait_bits_wrapper,
._task_create_pinned_to_core = task_create_pinned_to_core_wrapper,
._task_create = task_create_wrapper,
._task_delete = vTaskDelete,
._task_delay = vTaskDelay,
._task_ms_to_tick = task_ms_to_tick_wrapper,
._task_get_current_task = xTaskGetCurrentTaskHandle,
._task_get_max_priority = task_get_max_priority_wrapper,
._is_in_isr = xPortInIsrContext,
._malloc = malloc,
._free = free,
._get_free_heap_size = esp_get_free_heap_size,
._rand = esp_random,
._dport_access_stall_other_cpu_start_wrap = esp_dport_access_stall_other_cpu_start_wrap,
._dport_access_stall_other_cpu_end_wrap = esp_dport_access_stall_other_cpu_end_wrap,
._phy_rf_init = phy_rf_init_wrapper,
._phy_rf_deinit = esp_phy_rf_deinit,
._phy_load_cal_and_init = esp_phy_load_cal_and_init,
._read_mac = esp_read_mac,
._timer_init = ets_timer_init,
._timer_deinit = ets_timer_deinit,
._timer_arm = timer_arm_wrapper,
._timer_disarm = timer_disarm_wrapper,
._timer_done = timer_done_wrapper,
._timer_setfn = timer_setfn_wrapper,
._timer_arm_us = timer_arm_us_wrapper,
._periph_module_enable = periph_module_enable,
._periph_module_disable = periph_module_disable,
._esp_timer_get_time = esp_timer_get_time,
#if MODULE_ESP_IDF_NVS_FLASH
._nvs_set_i8 = nvs_set_i8,
._nvs_get_i8 = nvs_get_i8,
._nvs_set_u8 = nvs_set_u8,
._nvs_get_u8 = nvs_get_u8,
._nvs_set_u16 = nvs_set_u16,
._nvs_get_u16 = nvs_get_u16,
._nvs_open = nvs_open,
._nvs_close = nvs_close,
._nvs_commit = nvs_commit,
._nvs_set_blob = nvs_set_blob,
._nvs_get_blob = nvs_get_blob,
._nvs_erase_key = nvs_erase_key,
#else
._nvs_set_i8 = NULL,
._nvs_get_i8 = NULL,
._nvs_set_u8 = NULL,
._nvs_get_u8 = NULL,
._nvs_set_u16 = NULL,
._nvs_get_u16 = NULL,
._nvs_open = NULL,
._nvs_close = NULL,
._nvs_commit = NULL,
._nvs_set_blob = NULL,
._nvs_get_blob = NULL,
._nvs_erase_key = NULL,
#endif
._get_random = os_get_random,
._get_time = get_time_wrapper,
._random = os_random,
._log_write = esp_log_write,
._log_timestamp = esp_log_timestamp,
._malloc_internal = malloc_internal_wrapper,
._realloc_internal = realloc_internal_wrapper,
._calloc_internal = calloc_internal_wrapper,
._zalloc_internal = zalloc_internal_wrapper,
._wifi_malloc = wifi_malloc,
._wifi_realloc = wifi_realloc,
._wifi_calloc = wifi_calloc,
._wifi_zalloc = wifi_zalloc_wrapper,
._wifi_create_queue = wifi_create_queue_wrapper,
._wifi_delete_queue = wifi_delete_queue_wrapper,
._modem_sleep_enter = esp_modem_sleep_enter,
._modem_sleep_exit = esp_modem_sleep_exit,
._modem_sleep_register = esp_modem_sleep_register,
._modem_sleep_deregister = esp_modem_sleep_deregister,
._sc_ack_send = sc_ack_send_wrapper,
._sc_ack_send_stop = sc_ack_send_stop,
._magic = ESP_WIFI_OS_ADAPTER_MAGIC,
};
| {
"pile_set_name": "Github"
} |
m68k-bdm-elf-gdb -n -x bdm/gdbinit.reset
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" default-locale="en-US">
<!-- Elsevier, generated from "elsevier" metadata at https://github.com/citation-style-language/journals -->
<info>
<title>Journal of Orthopaedics</title>
<id>http://www.zotero.org/styles/journal-of-orthopaedics</id>
<link href="http://www.zotero.org/styles/journal-of-orthopaedics" rel="self"/>
<link href="http://www.zotero.org/styles/american-medical-association" rel="independent-parent"/>
<category citation-format="numeric"/>
<issn>0972-978X</issn>
<updated>2018-02-16T12:00:00+00:00</updated>
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
</style>
| {
"pile_set_name": "Github"
} |
English • Re: Browser preferred language in Yacy search
=======================================================
Date: 2014-05-31 09:21:00
> <div>
>
> sto hat geschrieben:\
> Hello all forum users,\
> I am quite new in the field of Yacy but I am definitely supporting it.
> I have been running a senior node 24/7 for a few weeks now
> (dome\_cirrus) and I could crawl a few million pages of French +
> English wikipedia and various newspapers.\
> \
> The most frustrating thing for me is the language management in the
> search. When I look for, let\'s say, Obama, I will have the wikipedia
> results in many languages, which is absurd. I want the results in the
> languages I can read (namely French, English and a bit of German).\
> The solution would be to add /language/XX at the end of the search
> request. But I don\'t want to do it. It is not user friendly at all.\
> \
> [[Easy]{style="font-style: italic"} solution suggested to
> developers:]{style="font-weight: bold"} get the browser preferred
> language, as DuckDuckGo does, to present the results in that language
> (user\'s language, let\'s say German), then in English (universal
> language), then in French/Russian/Spanish/\... (other languages than
> browser\'s preferred that the general user will generally not
> understand)\
> \
> Is it feasible?\
> \
> This idea leads to a concept of language sub-networks. When someone
> makes a search in French, it would be good to ask French peers first
> if they have results for the query. It may not apply with English, of
> course, as everybody indexes some English pages.\
> I have no idea if such a tuning of the DHT system is feasible.\
> \
> Thank you for reading. Please reply if you have better solutions. I
> would be glad to have some feedback on these points.\
> \
> PS: I copy-pasted my original message from
> <http://www.yacy-forum.org/> as there does not seem to be much
> activity there.\
>
> </div>
\
\
Personally I wouldn\'t want the HTTP header to determine what results I
get. I think it would be reasonable for YaCy to support a set of
configurable \"default languages\" so that if I choose French and
English as my default languages, YaCy should automatically include those
constraints on searches unless I choose otherwise for that specific
search. It would also be fine with me if YaCy detected my HTTP header
languages the first time I used it, and asked me if I wanted to use
those as the default languages for future searches.
Statistik: Verfasst von
[biolizard89](http://forum.yacy-websuche.de/memberlist.php?mode=viewprofile&u=8861)
--- Sa Mai 31, 2014 8:21 am
------------------------------------------------------------------------
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "pc/data_channel.h"
#include <string.h>
#include <memory>
#include <vector>
#include "pc/sctp_utils.h"
#include "pc/test/fake_data_channel_provider.h"
#include "rtc_base/gunit.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "test/gtest.h"
using webrtc::DataChannel;
using webrtc::SctpSidAllocator;
static constexpr int kDefaultTimeout = 10000;
class FakeDataChannelObserver : public webrtc::DataChannelObserver {
public:
FakeDataChannelObserver()
: messages_received_(0),
on_state_change_count_(0),
on_buffered_amount_change_count_(0) {}
void OnStateChange() { ++on_state_change_count_; }
void OnBufferedAmountChange(uint64_t previous_amount) {
++on_buffered_amount_change_count_;
}
void OnMessage(const webrtc::DataBuffer& buffer) { ++messages_received_; }
size_t messages_received() const { return messages_received_; }
void ResetOnStateChangeCount() { on_state_change_count_ = 0; }
void ResetOnBufferedAmountChangeCount() {
on_buffered_amount_change_count_ = 0;
}
size_t on_state_change_count() const { return on_state_change_count_; }
size_t on_buffered_amount_change_count() const {
return on_buffered_amount_change_count_;
}
private:
size_t messages_received_;
size_t on_state_change_count_;
size_t on_buffered_amount_change_count_;
};
// TODO(deadbeef): The fact that these tests use a fake provider makes them not
// too valuable. Should rewrite using the
// peerconnection_datachannel_unittest.cc infrastructure.
class SctpDataChannelTest : public ::testing::Test {
protected:
SctpDataChannelTest()
: provider_(new FakeDataChannelProvider()),
webrtc_data_channel_(DataChannel::Create(provider_.get(),
cricket::DCT_SCTP,
"test",
init_)) {}
void SetChannelReady() {
provider_->set_transport_available(true);
webrtc_data_channel_->OnTransportChannelCreated();
if (webrtc_data_channel_->id() < 0) {
webrtc_data_channel_->SetSctpSid(0);
}
provider_->set_ready_to_send(true);
}
void AddObserver() {
observer_.reset(new FakeDataChannelObserver());
webrtc_data_channel_->RegisterObserver(observer_.get());
}
webrtc::InternalDataChannelInit init_;
std::unique_ptr<FakeDataChannelProvider> provider_;
std::unique_ptr<FakeDataChannelObserver> observer_;
rtc::scoped_refptr<DataChannel> webrtc_data_channel_;
};
class StateSignalsListener : public sigslot::has_slots<> {
public:
int opened_count() const { return opened_count_; }
int closed_count() const { return closed_count_; }
void OnSignalOpened(DataChannel* data_channel) { ++opened_count_; }
void OnSignalClosed(DataChannel* data_channel) { ++closed_count_; }
private:
int opened_count_ = 0;
int closed_count_ = 0;
};
// Verifies that the data channel is connected to the transport after creation.
TEST_F(SctpDataChannelTest, ConnectedToTransportOnCreated) {
provider_->set_transport_available(true);
rtc::scoped_refptr<DataChannel> dc =
DataChannel::Create(provider_.get(), cricket::DCT_SCTP, "test1", init_);
EXPECT_TRUE(provider_->IsConnected(dc.get()));
// The sid is not set yet, so it should not have added the streams.
EXPECT_FALSE(provider_->IsSendStreamAdded(dc->id()));
EXPECT_FALSE(provider_->IsRecvStreamAdded(dc->id()));
dc->SetSctpSid(0);
EXPECT_TRUE(provider_->IsSendStreamAdded(dc->id()));
EXPECT_TRUE(provider_->IsRecvStreamAdded(dc->id()));
}
// Verifies that the data channel is connected to the transport if the transport
// is not available initially and becomes available later.
TEST_F(SctpDataChannelTest, ConnectedAfterTransportBecomesAvailable) {
EXPECT_FALSE(provider_->IsConnected(webrtc_data_channel_.get()));
provider_->set_transport_available(true);
webrtc_data_channel_->OnTransportChannelCreated();
EXPECT_TRUE(provider_->IsConnected(webrtc_data_channel_.get()));
}
// Tests the state of the data channel.
TEST_F(SctpDataChannelTest, StateTransition) {
StateSignalsListener state_signals_listener;
webrtc_data_channel_->SignalOpened.connect(
&state_signals_listener, &StateSignalsListener::OnSignalOpened);
webrtc_data_channel_->SignalClosed.connect(
&state_signals_listener, &StateSignalsListener::OnSignalClosed);
EXPECT_EQ(webrtc::DataChannelInterface::kConnecting,
webrtc_data_channel_->state());
EXPECT_EQ(state_signals_listener.opened_count(), 0);
EXPECT_EQ(state_signals_listener.closed_count(), 0);
SetChannelReady();
EXPECT_EQ(webrtc::DataChannelInterface::kOpen, webrtc_data_channel_->state());
EXPECT_EQ(state_signals_listener.opened_count(), 1);
EXPECT_EQ(state_signals_listener.closed_count(), 0);
webrtc_data_channel_->Close();
EXPECT_EQ(webrtc::DataChannelInterface::kClosed,
webrtc_data_channel_->state());
EXPECT_TRUE(webrtc_data_channel_->error().ok());
EXPECT_EQ(state_signals_listener.opened_count(), 1);
EXPECT_EQ(state_signals_listener.closed_count(), 1);
// Verifies that it's disconnected from the transport.
EXPECT_FALSE(provider_->IsConnected(webrtc_data_channel_.get()));
}
// Tests that DataChannel::buffered_amount() is correct after the channel is
// blocked.
TEST_F(SctpDataChannelTest, BufferedAmountWhenBlocked) {
AddObserver();
SetChannelReady();
webrtc::DataBuffer buffer("abcd");
EXPECT_TRUE(webrtc_data_channel_->Send(buffer));
size_t successful_send_count = 1;
EXPECT_EQ(0U, webrtc_data_channel_->buffered_amount());
EXPECT_EQ(successful_send_count,
observer_->on_buffered_amount_change_count());
provider_->set_send_blocked(true);
const int number_of_packets = 3;
for (int i = 0; i < number_of_packets; ++i) {
EXPECT_TRUE(webrtc_data_channel_->Send(buffer));
}
EXPECT_EQ(buffer.data.size() * number_of_packets,
webrtc_data_channel_->buffered_amount());
EXPECT_EQ(successful_send_count,
observer_->on_buffered_amount_change_count());
provider_->set_send_blocked(false);
successful_send_count += number_of_packets;
EXPECT_EQ(0U, webrtc_data_channel_->buffered_amount());
EXPECT_EQ(successful_send_count,
observer_->on_buffered_amount_change_count());
}
// Tests that the queued data are sent when the channel transitions from blocked
// to unblocked.
TEST_F(SctpDataChannelTest, QueuedDataSentWhenUnblocked) {
AddObserver();
SetChannelReady();
webrtc::DataBuffer buffer("abcd");
provider_->set_send_blocked(true);
EXPECT_TRUE(webrtc_data_channel_->Send(buffer));
EXPECT_EQ(0U, observer_->on_buffered_amount_change_count());
provider_->set_send_blocked(false);
SetChannelReady();
EXPECT_EQ(0U, webrtc_data_channel_->buffered_amount());
EXPECT_EQ(1U, observer_->on_buffered_amount_change_count());
}
// Tests that no crash when the channel is blocked right away while trying to
// send queued data.
TEST_F(SctpDataChannelTest, BlockedWhenSendQueuedDataNoCrash) {
AddObserver();
SetChannelReady();
webrtc::DataBuffer buffer("abcd");
provider_->set_send_blocked(true);
EXPECT_TRUE(webrtc_data_channel_->Send(buffer));
EXPECT_EQ(0U, observer_->on_buffered_amount_change_count());
// Set channel ready while it is still blocked.
SetChannelReady();
EXPECT_EQ(buffer.size(), webrtc_data_channel_->buffered_amount());
EXPECT_EQ(0U, observer_->on_buffered_amount_change_count());
// Unblock the channel to send queued data again, there should be no crash.
provider_->set_send_blocked(false);
SetChannelReady();
EXPECT_EQ(0U, webrtc_data_channel_->buffered_amount());
EXPECT_EQ(1U, observer_->on_buffered_amount_change_count());
}
// Tests that DataChannel::messages_sent() and DataChannel::bytes_sent() are
// correct, sending data both while unblocked and while blocked.
TEST_F(SctpDataChannelTest, VerifyMessagesAndBytesSent) {
AddObserver();
SetChannelReady();
std::vector<webrtc::DataBuffer> buffers({
webrtc::DataBuffer("message 1"),
webrtc::DataBuffer("msg 2"),
webrtc::DataBuffer("message three"),
webrtc::DataBuffer("quadra message"),
webrtc::DataBuffer("fifthmsg"),
webrtc::DataBuffer("message of the beast"),
});
// Default values.
EXPECT_EQ(0U, webrtc_data_channel_->messages_sent());
EXPECT_EQ(0U, webrtc_data_channel_->bytes_sent());
// Send three buffers while not blocked.
provider_->set_send_blocked(false);
EXPECT_TRUE(webrtc_data_channel_->Send(buffers[0]));
EXPECT_TRUE(webrtc_data_channel_->Send(buffers[1]));
EXPECT_TRUE(webrtc_data_channel_->Send(buffers[2]));
size_t bytes_sent = buffers[0].size() + buffers[1].size() + buffers[2].size();
EXPECT_EQ_WAIT(0U, webrtc_data_channel_->buffered_amount(), kDefaultTimeout);
EXPECT_EQ(3U, webrtc_data_channel_->messages_sent());
EXPECT_EQ(bytes_sent, webrtc_data_channel_->bytes_sent());
// Send three buffers while blocked, queuing the buffers.
provider_->set_send_blocked(true);
EXPECT_TRUE(webrtc_data_channel_->Send(buffers[3]));
EXPECT_TRUE(webrtc_data_channel_->Send(buffers[4]));
EXPECT_TRUE(webrtc_data_channel_->Send(buffers[5]));
size_t bytes_queued =
buffers[3].size() + buffers[4].size() + buffers[5].size();
EXPECT_EQ(bytes_queued, webrtc_data_channel_->buffered_amount());
EXPECT_EQ(3U, webrtc_data_channel_->messages_sent());
EXPECT_EQ(bytes_sent, webrtc_data_channel_->bytes_sent());
// Unblock and make sure everything was sent.
provider_->set_send_blocked(false);
EXPECT_EQ_WAIT(0U, webrtc_data_channel_->buffered_amount(), kDefaultTimeout);
bytes_sent += bytes_queued;
EXPECT_EQ(6U, webrtc_data_channel_->messages_sent());
EXPECT_EQ(bytes_sent, webrtc_data_channel_->bytes_sent());
}
// Tests that the queued control message is sent when channel is ready.
TEST_F(SctpDataChannelTest, OpenMessageSent) {
// Initially the id is unassigned.
EXPECT_EQ(-1, webrtc_data_channel_->id());
SetChannelReady();
EXPECT_GE(webrtc_data_channel_->id(), 0);
EXPECT_EQ(cricket::DMT_CONTROL, provider_->last_send_data_params().type);
EXPECT_EQ(provider_->last_send_data_params().ssrc,
static_cast<uint32_t>(webrtc_data_channel_->id()));
}
TEST_F(SctpDataChannelTest, QueuedOpenMessageSent) {
provider_->set_send_blocked(true);
SetChannelReady();
provider_->set_send_blocked(false);
EXPECT_EQ(cricket::DMT_CONTROL, provider_->last_send_data_params().type);
EXPECT_EQ(provider_->last_send_data_params().ssrc,
static_cast<uint32_t>(webrtc_data_channel_->id()));
}
// Tests that the DataChannel created after transport gets ready can enter OPEN
// state.
TEST_F(SctpDataChannelTest, LateCreatedChannelTransitionToOpen) {
SetChannelReady();
webrtc::InternalDataChannelInit init;
init.id = 1;
rtc::scoped_refptr<DataChannel> dc =
DataChannel::Create(provider_.get(), cricket::DCT_SCTP, "test1", init);
EXPECT_EQ(webrtc::DataChannelInterface::kConnecting, dc->state());
EXPECT_TRUE_WAIT(webrtc::DataChannelInterface::kOpen == dc->state(), 1000);
}
// Tests that an unordered DataChannel sends data as ordered until the OPEN_ACK
// message is received.
TEST_F(SctpDataChannelTest, SendUnorderedAfterReceivesOpenAck) {
SetChannelReady();
webrtc::InternalDataChannelInit init;
init.id = 1;
init.ordered = false;
rtc::scoped_refptr<DataChannel> dc =
DataChannel::Create(provider_.get(), cricket::DCT_SCTP, "test1", init);
EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kOpen, dc->state(), 1000);
// Sends a message and verifies it's ordered.
webrtc::DataBuffer buffer("some data");
ASSERT_TRUE(dc->Send(buffer));
EXPECT_TRUE(provider_->last_send_data_params().ordered);
// Emulates receiving an OPEN_ACK message.
cricket::ReceiveDataParams params;
params.ssrc = init.id;
params.type = cricket::DMT_CONTROL;
rtc::CopyOnWriteBuffer payload;
webrtc::WriteDataChannelOpenAckMessage(&payload);
dc->OnDataReceived(params, payload);
// Sends another message and verifies it's unordered.
ASSERT_TRUE(dc->Send(buffer));
EXPECT_FALSE(provider_->last_send_data_params().ordered);
}
// Tests that an unordered DataChannel sends unordered data after any DATA
// message is received.
TEST_F(SctpDataChannelTest, SendUnorderedAfterReceiveData) {
SetChannelReady();
webrtc::InternalDataChannelInit init;
init.id = 1;
init.ordered = false;
rtc::scoped_refptr<DataChannel> dc =
DataChannel::Create(provider_.get(), cricket::DCT_SCTP, "test1", init);
EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kOpen, dc->state(), 1000);
// Emulates receiving a DATA message.
cricket::ReceiveDataParams params;
params.ssrc = init.id;
params.type = cricket::DMT_TEXT;
webrtc::DataBuffer buffer("data");
dc->OnDataReceived(params, buffer.data);
// Sends a message and verifies it's unordered.
ASSERT_TRUE(dc->Send(buffer));
EXPECT_FALSE(provider_->last_send_data_params().ordered);
}
// Tests that the channel can't open until it's successfully sent the OPEN
// message.
TEST_F(SctpDataChannelTest, OpenWaitsForOpenMesssage) {
webrtc::DataBuffer buffer("foo");
provider_->set_send_blocked(true);
SetChannelReady();
EXPECT_EQ(webrtc::DataChannelInterface::kConnecting,
webrtc_data_channel_->state());
provider_->set_send_blocked(false);
EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kOpen,
webrtc_data_channel_->state(), 1000);
EXPECT_EQ(cricket::DMT_CONTROL, provider_->last_send_data_params().type);
}
// Tests that close first makes sure all queued data gets sent.
TEST_F(SctpDataChannelTest, QueuedCloseFlushes) {
webrtc::DataBuffer buffer("foo");
provider_->set_send_blocked(true);
SetChannelReady();
EXPECT_EQ(webrtc::DataChannelInterface::kConnecting,
webrtc_data_channel_->state());
provider_->set_send_blocked(false);
EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kOpen,
webrtc_data_channel_->state(), 1000);
provider_->set_send_blocked(true);
webrtc_data_channel_->Send(buffer);
webrtc_data_channel_->Close();
provider_->set_send_blocked(false);
EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kClosed,
webrtc_data_channel_->state(), 1000);
EXPECT_TRUE(webrtc_data_channel_->error().ok());
EXPECT_EQ(cricket::DMT_TEXT, provider_->last_send_data_params().type);
}
// Tests that messages are sent with the right ssrc.
TEST_F(SctpDataChannelTest, SendDataSsrc) {
webrtc_data_channel_->SetSctpSid(1);
SetChannelReady();
webrtc::DataBuffer buffer("data");
EXPECT_TRUE(webrtc_data_channel_->Send(buffer));
EXPECT_EQ(1U, provider_->last_send_data_params().ssrc);
}
// Tests that the incoming messages with wrong ssrcs are rejected.
TEST_F(SctpDataChannelTest, ReceiveDataWithInvalidSsrc) {
webrtc_data_channel_->SetSctpSid(1);
SetChannelReady();
AddObserver();
cricket::ReceiveDataParams params;
params.ssrc = 0;
webrtc::DataBuffer buffer("abcd");
webrtc_data_channel_->OnDataReceived(params, buffer.data);
EXPECT_EQ(0U, observer_->messages_received());
}
// Tests that the incoming messages with right ssrcs are acceted.
TEST_F(SctpDataChannelTest, ReceiveDataWithValidSsrc) {
webrtc_data_channel_->SetSctpSid(1);
SetChannelReady();
AddObserver();
cricket::ReceiveDataParams params;
params.ssrc = 1;
webrtc::DataBuffer buffer("abcd");
webrtc_data_channel_->OnDataReceived(params, buffer.data);
EXPECT_EQ(1U, observer_->messages_received());
}
// Tests that no CONTROL message is sent if the datachannel is negotiated and
// not created from an OPEN message.
TEST_F(SctpDataChannelTest, NoMsgSentIfNegotiatedAndNotFromOpenMsg) {
webrtc::InternalDataChannelInit config;
config.id = 1;
config.negotiated = true;
config.open_handshake_role = webrtc::InternalDataChannelInit::kNone;
SetChannelReady();
rtc::scoped_refptr<DataChannel> dc =
DataChannel::Create(provider_.get(), cricket::DCT_SCTP, "test1", config);
EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kOpen, dc->state(), 1000);
EXPECT_EQ(0U, provider_->last_send_data_params().ssrc);
}
// Tests that DataChannel::messages_received() and DataChannel::bytes_received()
// are correct, receiving data both while not open and while open.
TEST_F(SctpDataChannelTest, VerifyMessagesAndBytesReceived) {
AddObserver();
std::vector<webrtc::DataBuffer> buffers({
webrtc::DataBuffer("message 1"),
webrtc::DataBuffer("msg 2"),
webrtc::DataBuffer("message three"),
webrtc::DataBuffer("quadra message"),
webrtc::DataBuffer("fifthmsg"),
webrtc::DataBuffer("message of the beast"),
});
webrtc_data_channel_->SetSctpSid(1);
cricket::ReceiveDataParams params;
params.ssrc = 1;
// Default values.
EXPECT_EQ(0U, webrtc_data_channel_->messages_received());
EXPECT_EQ(0U, webrtc_data_channel_->bytes_received());
// Receive three buffers while data channel isn't open.
webrtc_data_channel_->OnDataReceived(params, buffers[0].data);
webrtc_data_channel_->OnDataReceived(params, buffers[1].data);
webrtc_data_channel_->OnDataReceived(params, buffers[2].data);
EXPECT_EQ(0U, observer_->messages_received());
EXPECT_EQ(0U, webrtc_data_channel_->messages_received());
EXPECT_EQ(0U, webrtc_data_channel_->bytes_received());
// Open channel and make sure everything was received.
SetChannelReady();
size_t bytes_received =
buffers[0].size() + buffers[1].size() + buffers[2].size();
EXPECT_EQ(3U, observer_->messages_received());
EXPECT_EQ(3U, webrtc_data_channel_->messages_received());
EXPECT_EQ(bytes_received, webrtc_data_channel_->bytes_received());
// Receive three buffers while open.
webrtc_data_channel_->OnDataReceived(params, buffers[3].data);
webrtc_data_channel_->OnDataReceived(params, buffers[4].data);
webrtc_data_channel_->OnDataReceived(params, buffers[5].data);
bytes_received += buffers[3].size() + buffers[4].size() + buffers[5].size();
EXPECT_EQ(6U, observer_->messages_received());
EXPECT_EQ(6U, webrtc_data_channel_->messages_received());
EXPECT_EQ(bytes_received, webrtc_data_channel_->bytes_received());
}
// Tests that OPEN_ACK message is sent if the datachannel is created from an
// OPEN message.
TEST_F(SctpDataChannelTest, OpenAckSentIfCreatedFromOpenMessage) {
webrtc::InternalDataChannelInit config;
config.id = 1;
config.negotiated = true;
config.open_handshake_role = webrtc::InternalDataChannelInit::kAcker;
SetChannelReady();
rtc::scoped_refptr<DataChannel> dc =
DataChannel::Create(provider_.get(), cricket::DCT_SCTP, "test1", config);
EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kOpen, dc->state(), 1000);
EXPECT_EQ(static_cast<unsigned int>(config.id),
provider_->last_send_data_params().ssrc);
EXPECT_EQ(cricket::DMT_CONTROL, provider_->last_send_data_params().type);
}
// Tests the OPEN_ACK role assigned by InternalDataChannelInit.
TEST_F(SctpDataChannelTest, OpenAckRoleInitialization) {
webrtc::InternalDataChannelInit init;
EXPECT_EQ(webrtc::InternalDataChannelInit::kOpener, init.open_handshake_role);
EXPECT_FALSE(init.negotiated);
webrtc::DataChannelInit base;
base.negotiated = true;
webrtc::InternalDataChannelInit init2(base);
EXPECT_EQ(webrtc::InternalDataChannelInit::kNone, init2.open_handshake_role);
}
// Tests that the DataChannel is closed if the sending buffer is full.
TEST_F(SctpDataChannelTest, ClosedWhenSendBufferFull) {
SetChannelReady();
rtc::CopyOnWriteBuffer buffer(1024);
memset(buffer.data(), 0, buffer.size());
webrtc::DataBuffer packet(buffer, true);
provider_->set_send_blocked(true);
for (size_t i = 0; i < 16 * 1024 + 1; ++i) {
EXPECT_TRUE(webrtc_data_channel_->Send(packet));
}
EXPECT_TRUE(
webrtc::DataChannelInterface::kClosed == webrtc_data_channel_->state() ||
webrtc::DataChannelInterface::kClosing == webrtc_data_channel_->state());
}
// Tests that the DataChannel is closed on transport errors.
TEST_F(SctpDataChannelTest, ClosedOnTransportError) {
SetChannelReady();
webrtc::DataBuffer buffer("abcd");
provider_->set_transport_error();
EXPECT_TRUE(webrtc_data_channel_->Send(buffer));
EXPECT_EQ(webrtc::DataChannelInterface::kClosed,
webrtc_data_channel_->state());
EXPECT_FALSE(webrtc_data_channel_->error().ok());
EXPECT_EQ(webrtc::RTCErrorType::NETWORK_ERROR,
webrtc_data_channel_->error().type());
EXPECT_EQ(webrtc::RTCErrorDetailType::NONE,
webrtc_data_channel_->error().error_detail());
}
// Tests that the DataChannel is closed if the received buffer is full.
TEST_F(SctpDataChannelTest, ClosedWhenReceivedBufferFull) {
SetChannelReady();
rtc::CopyOnWriteBuffer buffer(1024);
memset(buffer.data(), 0, buffer.size());
cricket::ReceiveDataParams params;
params.ssrc = 0;
// Receiving data without having an observer will overflow the buffer.
for (size_t i = 0; i < 16 * 1024 + 1; ++i) {
webrtc_data_channel_->OnDataReceived(params, buffer);
}
EXPECT_EQ(webrtc::DataChannelInterface::kClosed,
webrtc_data_channel_->state());
EXPECT_FALSE(webrtc_data_channel_->error().ok());
EXPECT_EQ(webrtc::RTCErrorType::RESOURCE_EXHAUSTED,
webrtc_data_channel_->error().type());
EXPECT_EQ(webrtc::RTCErrorDetailType::NONE,
webrtc_data_channel_->error().error_detail());
}
// Tests that sending empty data returns no error and keeps the channel open.
TEST_F(SctpDataChannelTest, SendEmptyData) {
webrtc_data_channel_->SetSctpSid(1);
SetChannelReady();
EXPECT_EQ(webrtc::DataChannelInterface::kOpen, webrtc_data_channel_->state());
webrtc::DataBuffer buffer("");
EXPECT_TRUE(webrtc_data_channel_->Send(buffer));
EXPECT_EQ(webrtc::DataChannelInterface::kOpen, webrtc_data_channel_->state());
}
// Tests that a channel can be closed without being opened or assigned an sid.
TEST_F(SctpDataChannelTest, NeverOpened) {
provider_->set_transport_available(true);
webrtc_data_channel_->OnTransportChannelCreated();
webrtc_data_channel_->Close();
}
// Test that the data channel goes to the "closed" state (and doesn't crash)
// when its transport goes away, even while data is buffered.
TEST_F(SctpDataChannelTest, TransportDestroyedWhileDataBuffered) {
SetChannelReady();
rtc::CopyOnWriteBuffer buffer(1024);
memset(buffer.data(), 0, buffer.size());
webrtc::DataBuffer packet(buffer, true);
// Send a packet while sending is blocked so it ends up buffered.
provider_->set_send_blocked(true);
EXPECT_TRUE(webrtc_data_channel_->Send(packet));
// Tell the data channel that its transport is being destroyed.
// It should then stop using the transport (allowing us to delete it) and
// transition to the "closed" state.
webrtc_data_channel_->OnTransportChannelClosed();
provider_.reset(nullptr);
EXPECT_EQ_WAIT(webrtc::DataChannelInterface::kClosed,
webrtc_data_channel_->state(), kDefaultTimeout);
EXPECT_FALSE(webrtc_data_channel_->error().ok());
EXPECT_EQ(webrtc::RTCErrorType::NETWORK_ERROR,
webrtc_data_channel_->error().type());
EXPECT_EQ(webrtc::RTCErrorDetailType::NONE,
webrtc_data_channel_->error().error_detail());
}
class SctpSidAllocatorTest : public ::testing::Test {
protected:
SctpSidAllocator allocator_;
};
// Verifies that an even SCTP id is allocated for SSL_CLIENT and an odd id for
// SSL_SERVER.
TEST_F(SctpSidAllocatorTest, SctpIdAllocationBasedOnRole) {
int id;
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_SERVER, &id));
EXPECT_EQ(1, id);
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_CLIENT, &id));
EXPECT_EQ(0, id);
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_SERVER, &id));
EXPECT_EQ(3, id);
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_CLIENT, &id));
EXPECT_EQ(2, id);
}
// Verifies that SCTP ids of existing DataChannels are not reused.
TEST_F(SctpSidAllocatorTest, SctpIdAllocationNoReuse) {
int old_id = 1;
EXPECT_TRUE(allocator_.ReserveSid(old_id));
int new_id;
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_SERVER, &new_id));
EXPECT_NE(old_id, new_id);
old_id = 0;
EXPECT_TRUE(allocator_.ReserveSid(old_id));
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_CLIENT, &new_id));
EXPECT_NE(old_id, new_id);
}
// Verifies that SCTP ids of removed DataChannels can be reused.
TEST_F(SctpSidAllocatorTest, SctpIdReusedForRemovedDataChannel) {
int odd_id = 1;
int even_id = 0;
EXPECT_TRUE(allocator_.ReserveSid(odd_id));
EXPECT_TRUE(allocator_.ReserveSid(even_id));
int allocated_id = -1;
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_SERVER, &allocated_id));
EXPECT_EQ(odd_id + 2, allocated_id);
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_CLIENT, &allocated_id));
EXPECT_EQ(even_id + 2, allocated_id);
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_SERVER, &allocated_id));
EXPECT_EQ(odd_id + 4, allocated_id);
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_CLIENT, &allocated_id));
EXPECT_EQ(even_id + 4, allocated_id);
allocator_.ReleaseSid(odd_id);
allocator_.ReleaseSid(even_id);
// Verifies that removed ids are reused.
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_SERVER, &allocated_id));
EXPECT_EQ(odd_id, allocated_id);
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_CLIENT, &allocated_id));
EXPECT_EQ(even_id, allocated_id);
// Verifies that used higher ids are not reused.
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_SERVER, &allocated_id));
EXPECT_EQ(odd_id + 6, allocated_id);
EXPECT_TRUE(allocator_.AllocateSid(rtc::SSL_CLIENT, &allocated_id));
EXPECT_EQ(even_id + 6, allocated_id);
}
| {
"pile_set_name": "Github"
} |
{
"registrations": [],
"version": 1
} | {
"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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>android.view.ext</groupId>
<artifactId>satellite-menu-sample</artifactId>
<name>satellite-menu-sample</name>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<url></url>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>android.view.ext</groupId>
<artifactId>satellite-menu</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>apklib</type>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3</version>
<configuration>
<compilerVersion>1.6</compilerVersion>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.0.0</version>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>7</platform>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
</project>
| {
"pile_set_name": "Github"
} |
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef THIRD_PARTY_TENSORFLOW_CORE_UTIL_COMMAND_LINE_FLAGS_H
#define THIRD_PARTY_TENSORFLOW_CORE_UTIL_COMMAND_LINE_FLAGS_H
#include <string>
#include <vector>
#include "tensorflow/core/platform/types.h"
namespace tensorflow {
// N.B. This library is for INTERNAL use only.
//
// This is a simple command-line argument parsing module to help us handle
// parameters for C++ binaries. The recommended way of using it is with local
// variables and an initializer list of Flag objects, for example:
//
// int some_int = 10;
// bool some_switch = false;
// string some_name = "something";
// std::vector<tensorFlow::Flag> flag_list = {
// Flag("some_int", &some_int, "an integer that affects X"),
// Flag("some_switch", &some_switch, "a bool that affects Y"),
// Flag("some_name", &some_name, "a string that affects Z")
// };
// // Get usage message before ParseFlags() to capture default values.
// string usage = Flag::Usage(argv[0], flag_list);
// bool parsed_values_ok = Flags::Parse(&argc, argv, flag_list);
//
// tensorflow::port::InitMain(usage.c_str(), &argc, &argv);
// if (argc != 1 || !parsed_values_ok) {
// ...output usage and error message...
// }
//
// The argc and argv values are adjusted by the Parse function so all that
// remains is the program name (at argv[0]) and any unknown arguments fill the
// rest of the array. This means you can check for flags that weren't understood
// by seeing if argv is greater than 1.
// The result indicates if there were any errors parsing the values that were
// passed to the command-line switches. For example, --some_int=foo would return
// false because the argument is expected to be an integer.
//
// NOTE: Unlike gflags-style libraries, this library is intended to be
// used in the `main()` function of your binary. It does not handle
// flag definitions that are scattered around the source code.
// A description of a single command line flag, holding its name, type, usage
// text, and a pointer to the corresponding variable.
class Flag {
public:
Flag(const char* name, int32* dst1, const string& usage_text);
Flag(const char* name, int64* dst1, const string& usage_text);
Flag(const char* name, bool* dst, const string& usage_text);
Flag(const char* name, string* dst, const string& usage_text);
private:
friend class Flags;
bool Parse(string arg, bool* value_parsing_ok) const;
string name_;
enum { TYPE_INT, TYPE_INT64, TYPE_BOOL, TYPE_STRING } type_;
int* int_value_;
int64* int64_value_;
bool* bool_value_;
string* string_value_;
string usage_text_;
};
class Flags {
public:
// Parse the command line represented by argv[0, ..., (*argc)-1] to find flag
// instances matching flags in flaglist[]. Update the variables associated
// with matching flags, and remove the matching arguments from (*argc, argv).
// Return true iff all recognized flag values were parsed correctly, and the
// first remaining argument is not "--help".
static bool Parse(int* argc, char** argv, const std::vector<Flag>& flag_list);
// Return a usage message with command line cmdline, and the
// usage_text strings in flag_list[].
static string Usage(const string& cmdline,
const std::vector<Flag>& flag_list);
};
} // namespace tensorflow
#endif // THIRD_PARTY_TENSORFLOW_CORE_UTIL_COMMAND_LINE_FLAGS_H
| {
"pile_set_name": "Github"
} |
define(["require", "exports", 'Services/Service'], function (require, exports, services) {
var SiteService = (function () {
function SiteService() {
this.searchProducts = function (searchText, pageIndex) {
if (pageIndex === void 0) { pageIndex = 0; }
var data = { searchText: searchText, pageIndex: pageIndex };
return services.callMethod(services.config.siteServiceUrl, 'Home/SearchProduct', data);
};
this.hotKeywords = function () {
return services.callMethod(services.config.siteServiceUrl, 'Home/GetSearchKeywords');
};
this.historyKeyword = function () {
return services.callMethod(services.config.siteServiceUrl, 'Home/GetHistoryKeywords');
};
}
return SiteService;
})();
var siteService = window['services']['station'] = window['services']['station'] || new SiteService();
return siteService;
});
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "ar9344.dtsi"
/ {
compatible = "compex,wpj344-16m", "qca,ar9344";
model = "Compex WPJ344 (16MB flash)";
aliases {
label-mac-device = ð0;
led-boot = &led_status;
led-failsafe = &led_status;
led-running = &led_status;
led-upgrade = &led_status;
};
leds {
compatible = "gpio-leds";
led_status: status {
label = "wpj344:green:status";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
};
sig1 {
label = "wpj344:red:sig1";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
sig2 {
label = "wpj344:yellow:sig2";
gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
};
sig3 {
label = "wpj344:green:sig3";
gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
};
sig4 {
label = "wpj344:green:sig4";
gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
};
};
keys {
compatible = "gpio-keys";
reset {
linux,code = <KEY_RESTART>;
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
};
};
&ref {
clock-frequency = <40000000>;
};
&uart {
status = "okay";
};
&spi {
status = "okay";
num-cs = <1>;
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <25000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
uboot: partition@0 {
label = "u-boot";
reg = <0x000000 0x030000>;
read-only;
};
partition@30000 {
label = "firmware";
reg = <0x030000 0xfc0000>;
compatible = "denx,uimage";
};
art: partition@ff0000 {
label = "art";
reg = <0xff0000 0x010000>;
read-only;
};
};
};
};
&usb {
status = "okay";
};
&usb_phy {
status = "okay";
};
&pcie {
status = "okay";
};
&wmac {
status = "okay";
mtd-cal-data = <&art 0x1000>;
};
&mdio0 {
status = "okay";
phy-mask = <0>;
phy0: ethernet-phy@0 {
reg = <0>;
phy-mode = "rgmii";
qca,ar8327-initvals = <
0x04 0x07600000 /* PORT0 PAD MODE CTRL */
0x10 0x80000080 /* POWER_ON_STRAP */
0x50 0x00000000 /* LED_CTRL0 */
0x54 0xc737c737 /* LED_CTRL1 */
0x58 0x00000000 /* LED_CTRL2 */
0x5c 0x00c30c00 /* LED_CTRL3 */
0x7c 0x0000007e /* PORT0_STATUS */
>;
};
};
ð0 {
status = "okay";
pll-data = <0x06000000 0x00000101 0x00001616>;
mtd-mac-address = <&uboot 0x2e010>;
phy-mode = "rgmii";
phy-handle = <&phy0>;
};
| {
"pile_set_name": "Github"
} |
# clb-lutinit Fuzzer
## NLUT.INIT
Sites: CLBL[LM]_[LR].SLICE[LM]_X[01] (all CLB)
Sets the LUT6 INIT property
| {
"pile_set_name": "Github"
} |
/*
* \brief Client-side file-system session interface
* \author Norman Feske
* \date 2012-04-05
*/
/*
* Copyright (C) 2012-2018 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _INCLUDE__FILE_SYSTEM_SESSION__CLIENT_H_
#define _INCLUDE__FILE_SYSTEM_SESSION__CLIENT_H_
#include <base/rpc_client.h>
#include <file_system_session/capability.h>
#include <packet_stream_tx/client.h>
namespace File_system { class Session_client; }
class File_system::Session_client : public Genode::Rpc_client<Session>
{
private:
Packet_stream_tx::Client<Tx> _tx;
public:
/**
* Constructor
*
* \param session session capability
* \param tx_buffer_alloc allocator used for managing the
* transmission buffer
*/
Session_client(Session_capability session,
Genode::Range_allocator &tx_buffer_alloc,
Genode::Region_map &rm)
:
Rpc_client<Session>(session),
_tx(call<Rpc_tx_cap>(), rm, tx_buffer_alloc)
{ }
/***********************************
** File-system session interface **
***********************************/
Tx::Source *tx() override { return _tx.source(); }
void sigh_ready_to_submit(Genode::Signal_context_capability sigh)
{
_tx.sigh_ready_to_submit(sigh);
}
void sigh_ack_avail(Genode::Signal_context_capability sigh)
{
_tx.sigh_ack_avail(sigh);
}
File_handle file(Dir_handle dir, Name const &name, Mode mode, bool create) override
{
return call<Rpc_file>(dir, name, mode, create);
}
Symlink_handle symlink(Dir_handle dir, Name const &name, bool create) override
{
return call<Rpc_symlink>(dir, name, create);
}
Dir_handle dir(Path const &path, bool create) override
{
return call<Rpc_dir>(path, create);
}
Node_handle node(Path const &path) override
{
return call<Rpc_node>(path);
}
Watch_handle watch(Path const &path) override
{
return call<Rpc_watch>(path);
}
void close(Node_handle node) override
{
call<Rpc_close>(node);
}
Status status(Node_handle node) override
{
return call<Rpc_status>(node);
}
void control(Node_handle node, Control control) override
{
call<Rpc_control>(node, control);
}
void unlink(Dir_handle dir, Name const &name) override
{
call<Rpc_unlink>(dir, name);
}
void truncate(File_handle file, file_size_t size) override
{
call<Rpc_truncate>(file, size);
}
void move(Dir_handle from_dir, Name const &from_name,
Dir_handle to_dir, Name const &to_name) override
{
call<Rpc_move>(from_dir, from_name, to_dir, to_name);
}
};
#endif /* _INCLUDE__FILE_SYSTEM_SESSION__CLIENT_H_ */
| {
"pile_set_name": "Github"
} |
"""
Scale
by Denis Grutze.
Paramenters for the scale() function are values specified
as decimal percentages. For example, the method call scale(2.0)
will increase the dimension of the shape by 200 percent.
"""
a = 0.0
def setup():
size(640, 360)
noStroke()
rectMode(CENTER)
frameRate(30)
def draw():
global a
background(102)
a = a + 0.04
s = cos(a) * 2
translate(width / 2, height / 2)
scale(s)
fill(51)
rect(0, 0, 50, 50)
translate(75, 0)
fill(255)
scale(s)
rect(0, 0, 50, 50)
| {
"pile_set_name": "Github"
} |
package cc.blynk.server.core.model.widgets.others.rtc;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
/**
* The Blynk Project.
* Created by Dmitriy Dumanskiy.
* Created on 04.09.16.
*/
public class ZoneIdToString extends JsonSerializer<Object> {
@Override
public void serialize(Object value, JsonGenerator jsonGenerator,
SerializerProvider serializers) throws IOException {
String result = value.toString();
jsonGenerator.writeObject(result);
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.nio.file;
import java.nio.file.attribute.BasicFileAttributes;
import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Iterator;
import sun.nio.fs.BasicFileAttributesHolder;
/**
* Walks a file tree, generating a sequence of events corresponding to the files
* in the tree.
*
* <pre>{@code
* Path top = ...
* Set<FileVisitOption> options = ...
* int maxDepth = ...
*
* try (FileTreeWalker walker = new FileTreeWalker(options, maxDepth)) {
* FileTreeWalker.Event ev = walker.walk(top);
* do {
* process(ev);
* ev = walker.next();
* } while (ev != null);
* }
* }</pre>
*
* @see Files#walkFileTree
*/
class FileTreeWalker implements Closeable {
private final boolean followLinks;
private final LinkOption[] linkOptions;
private final int maxDepth;
private final ArrayDeque<DirectoryNode> stack = new ArrayDeque<>();
private boolean closed;
/**
* The element on the walking stack corresponding to a directory node.
*/
private static class DirectoryNode {
private final Path dir;
private final Object key;
private final DirectoryStream<Path> stream;
private final Iterator<Path> iterator;
private boolean skipped;
DirectoryNode(Path dir, Object key, DirectoryStream<Path> stream) {
this.dir = dir;
this.key = key;
this.stream = stream;
this.iterator = stream.iterator();
}
Path directory() {
return dir;
}
Object key() {
return key;
}
DirectoryStream<Path> stream() {
return stream;
}
Iterator<Path> iterator() {
return iterator;
}
void skip() {
skipped = true;
}
boolean skipped() {
return skipped;
}
}
/**
* The event types.
*/
static enum EventType {
/**
* Start of a directory
*/
START_DIRECTORY,
/**
* End of a directory
*/
END_DIRECTORY,
/**
* An entry in a directory
*/
ENTRY;
}
/**
* Events returned by the {@link #walk} and {@link #next} methods.
*/
static class Event {
private final EventType type;
private final Path file;
private final BasicFileAttributes attrs;
private final IOException ioe;
private Event(EventType type, Path file, BasicFileAttributes attrs, IOException ioe) {
this.type = type;
this.file = file;
this.attrs = attrs;
this.ioe = ioe;
}
Event(EventType type, Path file, BasicFileAttributes attrs) {
this(type, file, attrs, null);
}
Event(EventType type, Path file, IOException ioe) {
this(type, file, null, ioe);
}
EventType type() {
return type;
}
Path file() {
return file;
}
BasicFileAttributes attributes() {
return attrs;
}
IOException ioeException() {
return ioe;
}
}
/**
* Creates a {@code FileTreeWalker}.
*
* @throws IllegalArgumentException
* if {@code maxDepth} is negative
* @throws ClassCastException
* if (@code options} contains an element that is not a
* {@code FileVisitOption}
* @throws NullPointerException
* if {@code options} is {@ocde null} or the options
* array contains a {@code null} element
*/
FileTreeWalker(Collection<FileVisitOption> options, int maxDepth) {
boolean fl = false;
for (FileVisitOption option: options) {
// will throw NPE if options contains null
switch (option) {
case FOLLOW_LINKS : fl = true; break;
default:
throw new AssertionError("Should not get here");
}
}
if (maxDepth < 0)
throw new IllegalArgumentException("'maxDepth' is negative");
this.followLinks = fl;
this.linkOptions = (fl) ? new LinkOption[0] :
new LinkOption[] { LinkOption.NOFOLLOW_LINKS };
this.maxDepth = maxDepth;
}
/**
* Returns the attributes of the given file, taking into account whether
* the walk is following sym links is not. The {@code canUseCached}
* argument determines whether this method can use cached attributes.
*/
private BasicFileAttributes getAttributes(Path file, boolean canUseCached)
throws IOException
{
// if attributes are cached then use them if possible
if (canUseCached &&
(file instanceof BasicFileAttributesHolder) &&
(System.getSecurityManager() == null))
{
BasicFileAttributes cached = ((BasicFileAttributesHolder)file).get();
if (cached != null && (!followLinks || !cached.isSymbolicLink())) {
return cached;
}
}
// attempt to get attributes of file. If fails and we are following
// links then a link target might not exist so get attributes of link
BasicFileAttributes attrs;
try {
attrs = Files.readAttributes(file, BasicFileAttributes.class, linkOptions);
} catch (IOException ioe) {
if (!followLinks)
throw ioe;
// attempt to get attrmptes without following links
attrs = Files.readAttributes(file,
BasicFileAttributes.class,
LinkOption.NOFOLLOW_LINKS);
}
return attrs;
}
/**
* Returns true if walking into the given directory would result in a
* file system loop/cycle.
*/
private boolean wouldLoop(Path dir, Object key) {
// if this directory and ancestor has a file key then we compare
// them; otherwise we use less efficient isSameFile test.
for (DirectoryNode ancestor: stack) {
Object ancestorKey = ancestor.key();
if (key != null && ancestorKey != null) {
if (key.equals(ancestorKey)) {
// cycle detected
return true;
}
} else {
try {
if (Files.isSameFile(dir, ancestor.directory())) {
// cycle detected
return true;
}
} catch (IOException | SecurityException x) {
// ignore
}
}
}
return false;
}
/**
* Visits the given file, returning the {@code Event} corresponding to that
* visit.
*
* The {@code ignoreSecurityException} parameter determines whether
* any SecurityException should be ignored or not. If a SecurityException
* is thrown, and is ignored, then this method returns {@code null} to
* mean that there is no event corresponding to a visit to the file.
*
* The {@code canUseCached} parameter determines whether cached attributes
* for the file can be used or not.
*/
private Event visit(Path entry, boolean ignoreSecurityException, boolean canUseCached) {
// need the file attributes
BasicFileAttributes attrs;
try {
attrs = getAttributes(entry, canUseCached);
} catch (IOException ioe) {
return new Event(EventType.ENTRY, entry, ioe);
} catch (SecurityException se) {
if (ignoreSecurityException)
return null;
throw se;
}
// at maximum depth or file is not a directory
int depth = stack.size();
if (depth >= maxDepth || !attrs.isDirectory()) {
return new Event(EventType.ENTRY, entry, attrs);
}
// check for cycles when following links
if (followLinks && wouldLoop(entry, attrs.fileKey())) {
return new Event(EventType.ENTRY, entry,
new FileSystemLoopException(entry.toString()));
}
// file is a directory, attempt to open it
DirectoryStream<Path> stream = null;
try {
stream = Files.newDirectoryStream(entry);
} catch (IOException ioe) {
return new Event(EventType.ENTRY, entry, ioe);
} catch (SecurityException se) {
if (ignoreSecurityException)
return null;
throw se;
}
// push a directory node to the stack and return an event
stack.push(new DirectoryNode(entry, attrs.fileKey(), stream));
return new Event(EventType.START_DIRECTORY, entry, attrs);
}
/**
* Start walking from the given file.
*/
Event walk(Path file) {
if (closed)
throw new IllegalStateException("Closed");
Event ev = visit(file,
false, // ignoreSecurityException
false); // canUseCached
assert ev != null;
return ev;
}
/**
* Returns the next Event or {@code null} if there are no more events or
* the walker is closed.
*/
Event next() {
DirectoryNode top = stack.peek();
if (top == null)
return null; // stack is empty, we are done
// continue iteration of the directory at the top of the stack
Event ev;
do {
Path entry = null;
IOException ioe = null;
// get next entry in the directory
if (!top.skipped()) {
Iterator<Path> iterator = top.iterator();
try {
if (iterator.hasNext()) {
entry = iterator.next();
}
} catch (DirectoryIteratorException x) {
ioe = x.getCause();
}
}
// no next entry so close and pop directory, creating corresponding event
if (entry == null) {
try {
top.stream().close();
} catch (IOException e) {
if (ioe != null) {
ioe = e;
} else {
ioe.addSuppressed(e);
}
}
stack.pop();
return new Event(EventType.END_DIRECTORY, top.directory(), ioe);
}
// visit the entry
ev = visit(entry,
true, // ignoreSecurityException
true); // canUseCached
} while (ev == null);
return ev;
}
/**
* Pops the directory node that is the current top of the stack so that
* there are no more events for the directory (including no END_DIRECTORY)
* event. This method is a no-op if the stack is empty or the walker is
* closed.
*/
void pop() {
if (!stack.isEmpty()) {
DirectoryNode node = stack.pop();
try {
node.stream().close();
} catch (IOException ignore) { }
}
}
/**
* Skips the remaining entries in the directory at the top of the stack.
* This method is a no-op if the stack is empty or the walker is closed.
*/
void skipRemainingSiblings() {
if (!stack.isEmpty()) {
stack.peek().skip();
}
}
/**
* Returns {@code true} if the walker is open.
*/
boolean isOpen() {
return !closed;
}
/**
* Closes/pops all directories on the stack.
*/
@Override
public void close() {
if (!closed) {
while (!stack.isEmpty()) {
pop();
}
closed = true;
}
}
}
| {
"pile_set_name": "Github"
} |
/*******************************************************************************
* Copyright (c) 2019 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.ws.microprofile.reactive.messaging.kafka.adapter;
import java.util.Map;
/**
*
*/
@FunctionalInterface
public interface OffsetCommitCallback {
void onComplete(Map<TopicPartition, OffsetAndMetadata> offsets, Exception exception);
}
| {
"pile_set_name": "Github"
} |
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
varying unsigned int16 a_max = 65535, a_min = 0; // max and min unsigned int16
if (programIndex % 2 == 0) {
#pragma ignore warning(perf)
RET[programIndex] = saturating_add(a_max, b);
}
else {
#pragma ignore warning(perf)
RET[programIndex] = saturating_add(a_min, b);
}
}
export void result(uniform float RET[]) {
if (programIndex % 2 == 0) {
RET[programIndex] = (varying unsigned int16) 65535;
}
else {
RET[programIndex] = (varying unsigned int16) 5;
}
}
| {
"pile_set_name": "Github"
} |
---
http_interactions:
- request:
method: get
uri: http://ps.pndsn.com/v2/auth/grant/sub-key/sub-a-mock-key?channel=demo&pnsdk=PubNub-Ruby/4.1.0&r=0&signature=fEGvHpuwCOB0VVy3BbRG68J_gKyrNUCR6GkIpAy-Zeo=×tamp=1464192881&ttl=300&uuid=ruby-test-uuid-client-one&w=1
body:
encoding: UTF-8
string: ''
headers:
User-Agent:
- HTTPClient/1.0 (2.8.0, ruby 2.3.0 (2015-12-25))
Accept:
- "*/*"
Date:
- Wed, 25 May 2016 16:14:41 GMT
response:
status:
code: 200
message: OK
headers:
Date:
- Wed, 25 May 2016 16:14:41 GMT
Content-Type:
- text/javascript; charset=UTF-8
Content-Length:
- '202'
Connection:
- keep-alive
Access-Control-Allow-Origin:
- "*"
Access-Control-Allow-Methods:
- GET
Access-Control-Allow-Headers:
- Origin, X-Requested-With, Content-Type, Accept
Cache-Control:
- no-cache, no-store, must-revalidate
body:
encoding: UTF-8
string: '{"message":"Success","payload":{"level":"channel","subscribe_key":"sub-a-mock-key","ttl":300,"channels":{"demo":{"r":0,"w":1,"m":0}}},"service":"Access
Manager","status":200}'
http_version:
recorded_at: Wed, 25 May 2016 16:14:41 GMT
recorded_with: VCR 3.0.1
| {
"pile_set_name": "Github"
} |
package cc.mrbird.batch;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnableBatchProcessing
public class SpringBatchLauncherApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBatchLauncherApplication.class, args);
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/profile"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/profile"/>
<ImageView
android:id="@+id/uranus"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignStart="@+id/profile"
android:layout_below="@+id/profile"
android:src="@drawable/uranus"/>
</RelativeLayout> | {
"pile_set_name": "Github"
} |
# -*- coding: utf-8 -*-
# 版权所有 2019 深圳米筐科技有限公司(下称“米筐科技”)
#
# 除非遵守当前许可,否则不得使用本软件。
#
# * 非商业用途(非商业用途指个人出于非商业目的使用本软件,或者高校、研究所等非营利机构出于教育、科研等目的使用本软件):
# 遵守 Apache License 2.0(下称“Apache 2.0 许可”),您可以在以下位置获得 Apache 2.0 许可的副本:http://www.apache.org/licenses/LICENSE-2.0。
# 除非法律有要求或以书面形式达成协议,否则本软件分发时需保持当前许可“原样”不变,且不得附加任何条件。
#
# * 商业用途(商业用途指个人出于任何商业目的使用本软件,或者法人或其他组织出于任何目的使用本软件):
# 未经米筐科技授权,任何个人不得出于任何商业目的使用本软件(包括但不限于向第三方提供、销售、出租、出借、转让本软件、本软件的衍生产品、引用或借鉴了本软件功能或源代码的产品或服务),任何法人或其他组织不得出于任何目的使用本软件,否则米筐科技有权追究相应的知识产权侵权责任。
# 在此前提下,对本软件的使用同样需要遵守 Apache 2.0 许可,Apache 2.0 许可与本许可冲突之处,以本许可为准。
# 详细的授权流程,请联系 [email protected] 获取。
from rqalpha.utils.testing import DataProxyFixture, RQAlphaTestCase
class InstrumentMixinTestCase(DataProxyFixture, RQAlphaTestCase):
def init_fixture(self):
super(InstrumentMixinTestCase, self).init_fixture()
def test_get_trading_period(self):
from datetime import time
from rqalpha.utils import TimeRange
rb_time_range = self.data_proxy.get_trading_period(["RB1912"])
self.assertSetEqual(set(rb_time_range), {
TimeRange(start=time(21, 1), end=time(23, 0)), TimeRange(start=time(9, 1), end=time(10, 15)),
TimeRange(start=time(10, 31), end=time(11, 30)), TimeRange(start=time(13, 31), end=time(15, 0))
})
merged_time_range = self.data_proxy.get_trading_period(["AG1912", "TF1912"], [
TimeRange(start=time(9, 31), end=time(11, 30)),
TimeRange(start=time(13, 1), end=time(15, 0)),
])
self.assertSetEqual(set(merged_time_range), {
TimeRange(start=time(21, 1), end=time(23, 59)),
TimeRange(start=time(0, 0), end=time(2, 30)),
TimeRange(start=time(9, 1), end=time(11, 30)),
TimeRange(start=time(13, 1), end=time(15, 15)),
})
def test_is_night_trading(self):
assert not self.data_proxy.is_night_trading(["TF1912"])
assert self.data_proxy.is_night_trading(["AG1912", "000001.XSHE"])
| {
"pile_set_name": "Github"
} |
package main
import (
"github.com/docker/docker/daemon/config"
"github.com/spf13/pflag"
)
func attachExperimentalFlags(conf *config.Config, cmd *pflag.FlagSet) {
}
| {
"pile_set_name": "Github"
} |
/**
* @license Highcharts JS v8.2.0 (2020-08-20)
* @module highcharts/modules/boost-canvas
* @requires highcharts
*
* Boost module
*
* (c) 2010-2019 Highsoft AS
* Author: Torstein Honsi
*
* License: www.highcharts.com/license
*/
'use strict';
import '../../Extensions/BoostCanvas.js';
| {
"pile_set_name": "Github"
} |
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
#include "NoViableAltException.h"
#include "misc/IntervalSet.h"
#include "atn/ParserATNSimulator.h"
#include "InputMismatchException.h"
#include "FailedPredicateException.h"
#include "ParserRuleContext.h"
#include "atn/RuleTransition.h"
#include "atn/ATN.h"
#include "atn/ATNState.h"
#include "Parser.h"
#include "CommonToken.h"
#include "Vocabulary.h"
#include "support/StringUtils.h"
#include "DefaultErrorStrategy.h"
using namespace antlr4;
using namespace antlr4::atn;
using namespace antlrcpp;
DefaultErrorStrategy::DefaultErrorStrategy() {
InitializeInstanceFields();
}
DefaultErrorStrategy::~DefaultErrorStrategy() {
}
void DefaultErrorStrategy::reset(Parser *recognizer) {
_errorSymbols.clear();
endErrorCondition(recognizer);
}
void DefaultErrorStrategy::beginErrorCondition(Parser * /*recognizer*/) {
errorRecoveryMode = true;
}
bool DefaultErrorStrategy::inErrorRecoveryMode(Parser * /*recognizer*/) {
return errorRecoveryMode;
}
void DefaultErrorStrategy::endErrorCondition(Parser * /*recognizer*/) {
errorRecoveryMode = false;
lastErrorIndex = -1;
}
void DefaultErrorStrategy::reportMatch(Parser *recognizer) {
endErrorCondition(recognizer);
}
void DefaultErrorStrategy::reportError(Parser *recognizer, const RecognitionException &e) {
// If we've already reported an error and have not matched a token
// yet successfully, don't report any errors.
if (inErrorRecoveryMode(recognizer)) {
return; // don't report spurious errors
}
beginErrorCondition(recognizer);
if (is<const NoViableAltException *>(&e)) {
reportNoViableAlternative(recognizer, static_cast<const NoViableAltException &>(e));
} else if (is<const InputMismatchException *>(&e)) {
reportInputMismatch(recognizer, static_cast<const InputMismatchException &>(e));
} else if (is<const FailedPredicateException *>(&e)) {
reportFailedPredicate(recognizer, static_cast<const FailedPredicateException &>(e));
} else if (is<const RecognitionException *>(&e)) {
recognizer->notifyErrorListeners(e.getOffendingToken(), e.what(), std::current_exception());
}
}
void DefaultErrorStrategy::recover(Parser *recognizer, std::exception_ptr /*e*/) {
if (lastErrorIndex == static_cast<int>(recognizer->getInputStream()->index()) &&
lastErrorStates.contains(recognizer->getState())) {
// uh oh, another error at same token index and previously-visited
// state in ATN; must be a case where LT(1) is in the recovery
// token set so nothing got consumed. Consume a single token
// at least to prevent an infinite loop; this is a failsafe.
recognizer->consume();
}
lastErrorIndex = static_cast<int>(recognizer->getInputStream()->index());
lastErrorStates.add(recognizer->getState());
misc::IntervalSet followSet = getErrorRecoverySet(recognizer);
consumeUntil(recognizer, followSet);
}
void DefaultErrorStrategy::sync(Parser *recognizer) {
atn::ATNState *s = recognizer->getInterpreter<atn::ATNSimulator>()->atn.states[recognizer->getState()];
// If already recovering, don't try to sync
if (inErrorRecoveryMode(recognizer)) {
return;
}
TokenStream *tokens = recognizer->getTokenStream();
size_t la = tokens->LA(1);
// try cheaper subset first; might get lucky. seems to shave a wee bit off
auto nextTokens = recognizer->getATN().nextTokens(s);
if (nextTokens.contains(Token::EPSILON) || nextTokens.contains(la)) {
return;
}
switch (s->getStateType()) {
case atn::ATNState::BLOCK_START:
case atn::ATNState::STAR_BLOCK_START:
case atn::ATNState::PLUS_BLOCK_START:
case atn::ATNState::STAR_LOOP_ENTRY:
// report error and recover if possible
if (singleTokenDeletion(recognizer) != nullptr) {
return;
}
throw InputMismatchException(recognizer);
case atn::ATNState::PLUS_LOOP_BACK:
case atn::ATNState::STAR_LOOP_BACK: {
reportUnwantedToken(recognizer);
misc::IntervalSet expecting = recognizer->getExpectedTokens();
misc::IntervalSet whatFollowsLoopIterationOrRule = expecting.Or(getErrorRecoverySet(recognizer));
consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
}
break;
default:
// do nothing if we can't identify the exact kind of ATN state
break;
}
}
void DefaultErrorStrategy::reportNoViableAlternative(Parser *recognizer, const NoViableAltException &e) {
TokenStream *tokens = recognizer->getTokenStream();
std::string input;
if (tokens != nullptr) {
if (e.getStartToken()->getType() == Token::EOF) {
input = "<EOF>";
} else {
input = tokens->getText(e.getStartToken(), e.getOffendingToken());
}
} else {
input = "<unknown input>";
}
std::string msg = "no viable alternative at input " + escapeWSAndQuote(input);
recognizer->notifyErrorListeners(e.getOffendingToken(), msg, std::make_exception_ptr(e));
}
void DefaultErrorStrategy::reportInputMismatch(Parser *recognizer, const InputMismatchException &e) {
std::string msg = "mismatched input " + getTokenErrorDisplay(e.getOffendingToken()) +
" expecting " + e.getExpectedTokens().toString(recognizer->getVocabulary());
recognizer->notifyErrorListeners(e.getOffendingToken(), msg, std::make_exception_ptr(e));
}
void DefaultErrorStrategy::reportFailedPredicate(Parser *recognizer, const FailedPredicateException &e) {
const std::string& ruleName = recognizer->getRuleNames()[recognizer->getContext()->getRuleIndex()];
std::string msg = "rule " + ruleName + " " + e.what();
recognizer->notifyErrorListeners(e.getOffendingToken(), msg, std::make_exception_ptr(e));
}
void DefaultErrorStrategy::reportUnwantedToken(Parser *recognizer) {
if (inErrorRecoveryMode(recognizer)) {
return;
}
beginErrorCondition(recognizer);
Token *t = recognizer->getCurrentToken();
std::string tokenName = getTokenErrorDisplay(t);
misc::IntervalSet expecting = getExpectedTokens(recognizer);
std::string msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer->getVocabulary());
recognizer->notifyErrorListeners(t, msg, nullptr);
}
void DefaultErrorStrategy::reportMissingToken(Parser *recognizer) {
if (inErrorRecoveryMode(recognizer)) {
return;
}
beginErrorCondition(recognizer);
Token *t = recognizer->getCurrentToken();
misc::IntervalSet expecting = getExpectedTokens(recognizer);
std::string expectedText = expecting.toString(recognizer->getVocabulary());
std::string msg = "missing " + expectedText + " at " + getTokenErrorDisplay(t);
recognizer->notifyErrorListeners(t, msg, nullptr);
}
Token* DefaultErrorStrategy::recoverInline(Parser *recognizer) {
// Single token deletion.
Token *matchedSymbol = singleTokenDeletion(recognizer);
if (matchedSymbol) {
// We have deleted the extra token.
// Now, move past ttype token as if all were ok.
recognizer->consume();
return matchedSymbol;
}
// Single token insertion.
if (singleTokenInsertion(recognizer)) {
return getMissingSymbol(recognizer);
}
// Even that didn't work; must throw the exception.
throw InputMismatchException(recognizer);
}
bool DefaultErrorStrategy::singleTokenInsertion(Parser *recognizer) {
ssize_t currentSymbolType = recognizer->getInputStream()->LA(1);
// if current token is consistent with what could come after current
// ATN state, then we know we're missing a token; error recovery
// is free to conjure up and insert the missing token
atn::ATNState *currentState = recognizer->getInterpreter<atn::ATNSimulator>()->atn.states[recognizer->getState()];
atn::ATNState *next = currentState->transitions[0]->target;
const atn::ATN &atn = recognizer->getInterpreter<atn::ATNSimulator>()->atn;
misc::IntervalSet expectingAtLL2 = atn.nextTokens(next, recognizer->getContext());
if (expectingAtLL2.contains(currentSymbolType)) {
reportMissingToken(recognizer);
return true;
}
return false;
}
Token* DefaultErrorStrategy::singleTokenDeletion(Parser *recognizer) {
size_t nextTokenType = recognizer->getInputStream()->LA(2);
misc::IntervalSet expecting = getExpectedTokens(recognizer);
if (expecting.contains(nextTokenType)) {
reportUnwantedToken(recognizer);
recognizer->consume(); // simply delete extra token
// we want to return the token we're actually matching
Token *matchedSymbol = recognizer->getCurrentToken();
reportMatch(recognizer); // we know current token is correct
return matchedSymbol;
}
return nullptr;
}
Token* DefaultErrorStrategy::getMissingSymbol(Parser *recognizer) {
Token *currentSymbol = recognizer->getCurrentToken();
misc::IntervalSet expecting = getExpectedTokens(recognizer);
size_t expectedTokenType = expecting.getMinElement(); // get any element
std::string tokenText;
if (expectedTokenType == Token::EOF) {
tokenText = "<missing EOF>";
} else {
tokenText = "<missing " + recognizer->getVocabulary().getDisplayName(expectedTokenType) + ">";
}
Token *current = currentSymbol;
Token *lookback = recognizer->getTokenStream()->LT(-1);
if (current->getType() == Token::EOF && lookback != nullptr) {
current = lookback;
}
_errorSymbols.push_back(recognizer->getTokenFactory()->create(
{ current->getTokenSource(), current->getTokenSource()->getInputStream() },
expectedTokenType, tokenText, Token::DEFAULT_CHANNEL, INVALID_INDEX, INVALID_INDEX,
current->getLine(), current->getCharPositionInLine()));
return _errorSymbols.back().get();
}
misc::IntervalSet DefaultErrorStrategy::getExpectedTokens(Parser *recognizer) {
return recognizer->getExpectedTokens();
}
std::string DefaultErrorStrategy::getTokenErrorDisplay(Token *t) {
if (t == nullptr) {
return "<no Token>";
}
std::string s = getSymbolText(t);
if (s == "") {
if (getSymbolType(t) == Token::EOF) {
s = "<EOF>";
} else {
s = "<" + std::to_string(getSymbolType(t)) + ">";
}
}
return escapeWSAndQuote(s);
}
std::string DefaultErrorStrategy::getSymbolText(Token *symbol) {
return symbol->getText();
}
size_t DefaultErrorStrategy::getSymbolType(Token *symbol) {
return symbol->getType();
}
std::string DefaultErrorStrategy::escapeWSAndQuote(const std::string &s) const {
std::string result = s;
antlrcpp::replaceAll(result, "\n", "\\n");
antlrcpp::replaceAll(result, "\r","\\r");
antlrcpp::replaceAll(result, "\t","\\t");
return "'" + result + "'";
}
misc::IntervalSet DefaultErrorStrategy::getErrorRecoverySet(Parser *recognizer) {
const atn::ATN &atn = recognizer->getInterpreter<atn::ATNSimulator>()->atn;
RuleContext *ctx = recognizer->getContext();
misc::IntervalSet recoverSet;
while (ctx->invokingState != ATNState::INVALID_STATE_NUMBER) {
// compute what follows who invoked us
atn::ATNState *invokingState = atn.states[ctx->invokingState];
atn::RuleTransition *rt = dynamic_cast<atn::RuleTransition*>(invokingState->transitions[0]);
misc::IntervalSet follow = atn.nextTokens(rt->followState);
recoverSet.addAll(follow);
if (ctx->parent == nullptr)
break;
ctx = static_cast<RuleContext *>(ctx->parent);
}
recoverSet.remove(Token::EPSILON);
return recoverSet;
}
void DefaultErrorStrategy::consumeUntil(Parser *recognizer, const misc::IntervalSet &set) {
size_t ttype = recognizer->getInputStream()->LA(1);
while (ttype != Token::EOF && !set.contains(ttype)) {
recognizer->consume();
ttype = recognizer->getInputStream()->LA(1);
}
}
void DefaultErrorStrategy::InitializeInstanceFields() {
errorRecoveryMode = false;
lastErrorIndex = -1;
}
| {
"pile_set_name": "Github"
} |
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import addFileToProject from '../addFileToProject';
import removeProjectFromProject from '../removeProjectFromProject';
const xcode = require('xcode');
const pbxFile = require('xcode/lib/pbxFile');
const path = require('path');
const project = xcode.project(
path.join(__dirname, '../__fixtures__/project.pbxproj'),
);
const filePath = '../__fixtures__/linearGradient.pbxproj';
describe('ios::addFileToProject', () => {
beforeEach(() => {
project.parseSync();
addFileToProject(project, filePath);
});
it('should return removed file', () => {
expect(
removeProjectFromProject(project, filePath) instanceof pbxFile,
).toBeTruthy();
});
it('should remove file from a project', () => {
const file = removeProjectFromProject(project, filePath);
expect(project.pbxFileReferenceSection()[file.fileRef]).not.toBeDefined();
});
// todo(mike): add in .xcodeproj after Xcode modifications so we can test extra
// removals later.
it.todo('should remove file from PBXContainerProxy');
});
| {
"pile_set_name": "Github"
} |
import actions from './types'
function toggleContextSideBar() {
return {
type: actions.TOGGLE_CONTEXT_SIDEBAR,
}
}
function changePath(path) {
return (dispatch) => {
dispatch({
type: actions.CHANGE_PATH,
path,
})
if (path.app && path.app.name) {
dispatch({
type: actions.CLICK_APP_MENU,
index: path.app.id,
})
} else {
// remove current project, and back to dashboard
dispatch({
type: actions.CHANGE_PROJECT,
id: null,
})
}
}
}
export default {
toggleContextSideBar,
changePath,
}
| {
"pile_set_name": "Github"
} |
<!--
~ Copyright 2019 Uriah Shaul Mandel
~
~ 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.
-->
<resources>
<string name="about">O programie</string>
<string name="about_subtext">Cześć !\nMam na imie Uriah Shaul Mandel, jestem developerem tej platformy.\n
Spędziłem większość swojego \"dorosłego\" życia tworząc tą platformę, i wypuściłem ją za darmo, dla każdego do użytku.
\nMożesz spokojnie do mnie napisać na ten adres email: \[email protected]
</string>
<string name="accessibility_level">Poziom dostępności</string>
<string name="accessibility_settings">Dostępność</string>
<string name="accidental_touches">Zapobiegaj przypadkowym dotknięciom</string>
<string name="accidental_touches_settings_subtext">Ta funkcja blokuje enran dotykowy kiedy telefon jest przykryty,
\njeśli to sprawi problemy możesz to wyłączyć
</string>
<string name="accidental_touches_subtext">Wykryto przypadkowe dostnięcie\nnaciśnij OK aby odblokować dotyk\njeśli
ta wiadomość się powtarza możesz wyłączyc tą funkcję w ustawieniach dostępności
</string>
<string name="acknowledgments">Podziękowania</string>
<string name="adaptive">Adaptywny</string>
<string name="add_alarm">Dodaj alarm</string>
<string name="add_alarm_quickly">Dodaj timer</string>
<string name="add_contact">Dodaj kontakt</string>
<string name="add_emergency_contact">Dodaj</string>
<string name="add_pill">Dodaj tabletkę</string>
<string name="add_shortcut">Dodaj skrót</string>
<string name="add_to_favorite">Dodaj do ulubionych</string>
<string name="add_to_home">Dodaj do ekranu domowego</string>
<string name="add_to_sos">Dodaj do SOS</string>
<string name="address">Addres</string>
<string name="advanced_options">Ustawienia zaawansowane</string>
<string name="afternoon">Popołudnie</string>
<string name="airplane_mode">Tryb samolotowy</string>
<string name="alarm_name">Nazwa alarmu</string>
<string name="alarm_volume">Głośność alarmu</string>
<string name="alarm_volume_subtext">Wybierz głośność dla alarmu.\nIm dalej w prawo tym głośniej.</string>
<string name="alarms">Alarmy</string>
<string name="alarms_repeats_every">Alarm powtarza się co:</string>
<string name="all_alarms">Wszystkie alarmy</string>
<string name="allow">Zezwól</string>
<string name="already_setted">Już ustawiony!\nKliknij tutaj any się przełączyć</string>
<string name="an_error_has_occurred">Wystąpił błąd</string>
<string name="and_welcome_to_baldphone">witamy w BaldPhone</string>
<string name="apps">Aplikacje</string>
<string name="are_you_sure_you_want_to_delete___">Czy napewno chcesz usunąć %s?</string>
<string name="assistant">Asystent</string>
<string name="at_least_one_day_must_be_selected">Przynajmniej jeden dzień musi być wybrany</string>
<string name="auto_brightness">Jasność\nAutomatyczna</string>
<string name="backspace">Backspace</string>
<string name="baldphone_bla_allow_permission">Proszę o następujące dozwolenia:</string>
<string name="blocked">Zablokowane</string>
<string name="bluetooth">Bluetooth</string>
<string name="brightness">Jasność</string>
<string name="brightness_subtext">Zmień jasność</string>
<string name="cache_cleared_successfully">Pomyślnie wyczyszczono pamięc cachce!</string>
<string name="call">Dzwoń</string>
<string name="calling">Dzwonienie...</string>
<string name="call_log">Rejestr połączeń:</string>
<string name="call_subtext">To dozwolenie jest wymagane aby dzwonić do kontaktów.</string>
<string name="camera">Aparat</string>
<string name="camera_subtext">TTo dozwolenie jest wymagane aby aby włączyć latarkę.</string>
<string name="cancel">Anuluj</string>
<string name="change_pills_time">Zmień porę tabletek</string>
<string name="change_system_settings_subtext">Zezwól BaldPhone na zmiane ustawień, takich jak rozmiar czcionki i jasność ekranu.</string>
<string name="choose_friday">Pią</string>
<string name="choose_monday">Pon</string>
<string name="choose_saturday">Sob</string>
<string name="choose_sunday">Nie</string>
<string name="choose_thursday">Czw</string>
<string name="choose_tuesday">Wt</string>
<string name="choose_wednesday">Śr</string>
<string name="clear">Wyczyść</string>
<string name="clear_cache">Wyczyść pamięć cache</string>
<string name="clear_data">Wyczyść dane</string>
<string name="clear_data_subtext">Napewno chcesz wyczyścić dane?</string>
<string name="clear_data_subtext2">100%?</string>
<string name="clear_data_subtext3">napewno?\npotwierdzenie wyczyści wszystkie dane!</string>
<string name="clock">Zegar</string>
<string name="coming_soon">Wkrótce!</string>
<string name="connection_settings">Połączenie</string>
<string name="contact_must_has_name">Kontakt musi mieć nazwę</string>
<string name="contact_not_created">Kontakt nie został stworzony</string>
<string name="contacts">Kontakty</string>
<string name="contacts_read_subtext">To dozwolenie jest wymagane aby odczytać kontakty.</string>
<string name="contacts_subtext">To dozwolenie jest wymagane aby dodać nowe kontakty.</string>
<string name="crash">Ups!\nBaldPhone zapotkał problem i się zrestartuje.</string>
<string name="current_time">Obecny czas</string>
<string name="custom">Niestandardowe</string>
<string name="dark">Cienmy</string>
<string name="delete">Usuń</string>
<string name="delete___">Usunąć %s?</string>
<string name="delete_all_alarms">Usuń wszystkie alarmy</string>
<string name="dialer">Dialer</string>
<string name="display_settings">Wyświetlacz</string>
<string name="done">Zrobione</string>
<string name="down">W dół</string>
<string name="edit">Edycja</string>
<string name="email">Email:</string>
<string name="enable_notification_access">Włącz dozwolenie powiadomień</string>
<string name="enable_notification_access_subtext">Proszę o zezwolenie BaldPhone na używanie powiadomień.</string>
<string name="enter">Enter</string>
<string name="enter_contact_or_phone_number">Wpisz nazwę kontaktu:</string>
<string name="evening">Wieczór</string>
<string name="example_of_different_text_sizes">Przykład różnych rozmiarów czcionki\nTen tekst powinien być czytelny i nie zawijać się</string>
<string name="external_storage_subtext">To dozwolenie jest wymagane aby zapisywać zdięcia.</string>
<string name="feedback">Wyślij opinię</string>
<string name="feedback_cannot_be_empty">Opinia nie może być pusta</string>
<string name="feedback_sent_successfully">Opinia pomyślnie wysłana</string>
<string name="first_please_select_how_you_want_to_interact_with_buttons">Proszę wybrac poziom dostępności</string>
<string name="font_size">Czcionka</string>
<string name="friday">Piątek</string>
<string name="have_hard_time_using_the_phone_s_keyboard_use_baldphone_s_big_keyboard_instead">Trudności w używaniu klawiatury telefonu ? przełącz na DUŻĄ klawiaturę BaldPhone</string>
<string name="hello">Witaj</string>
<string name="help">Tutorial wideo</string>
<string name="hide">Ukryj</string>
<string name="high_level">Wysoki poziom</string>
<string name="home_phone_number">Domowy numer telefonu</string>
<string name="hour">Godzina</string>
<string name="huge">Ogromny</string>
<string name="internet">Internet</string>
<string name="invoked_in">Wywołany w:</string>
<string name="it_s_highly_recommended_to_use_baldphone_s_home_screen_as_the_default_home_launcher">Ostatnia rzecz, jest wysoce zalecane używanie launchera BaldPhone jako domyślnego</string>
<string name="language">Język</string>
<string name="language_settings">Ustawienia języka</string>
<string name="large">Duży</string>
<string name="left_handed">Leworęczny</string>
<string name="light">Jasny</string>
<string name="location">Lokalizacja</string>
<string name="emergency_services">Służby ratownicze</string>
<string name="mail">E-Mail</string>
<string name="maps">Mapy</string>
<string name="medium">Średni</string>
<string name="medium_level">Średni poziom</string>
<string name="message">Wiadomość</string>
<string name="messages">Wiadomości</string>
<string name="minute">Minuta</string>
<string name="minutes">Minuty</string>
<string name="missed">Nieodebrane</string>
<string name="mobile_phone_number">Numer komórkowy</string>
<string name="monday">Poniedziałek</string>
<string name="more">więcej</string>
<string name="morning">Ranek</string>
<string name="name">Imię</string>
<string name="named__">nazwany</string>
<string name="new_alarm___was_created">nowy alarm %s został zapisany</string>
<string name="nfc">NFC</string>
<string name="no">Nie</string>
<string name="notes">Notatki</string>
<string name="notes_settings">Ustawienia notatek</string>
<string name="notes_settings_subtext">Czy chcesz mieć stronę notatek na ekranie głównym ?</string>
<string name="notifications">Powiadomienia</string>
<string name="of">z</string>
<string name="off">Wyłączone</string>
<string name="ok">OK</string>
<string name="on">Włączone</string>
<string name="only_once">Tylko raz</string>
<string name="open">Otwórz</string>
<string name="outgoing">Towarzyski</string>
<string name="page">Strona</string>
<string name="permissions_part">Zezwolenia</string>
<string name="personalization_settings">Personalizacja</string>
<string name="phone">Telfon</string>
<string name="photo">Zdięcie</string>
<string name="photos">Zdięcia</string>
<string name="pill_added">PTabletka dodana</string>
<string name="pill_name">Nazwa tabletki</string>
<string name="pills">Tabletki</string>
<string name="press_longer">Przytrzymaj dłużej</string>
<string name="timer">Tajmer</string>
<string name="read_call_log">Wyświetl rejestr połączeń</string>
<string name="read_call_log_subtext">To dozwolenie jest wymagane aby wyświetlić rejestr połączeń.</string>
<string name="read_contacts">Wyświetl kontakty</string>
<string name="received">Odebrane</string>
<string name="recent">Ostatnie</string>
<string name="regular_level">Zwykły poziom</string>
<string name="remove_from_favorite">Usuń z ulubionych</string>
<string name="remove_from_home">Usuń z ekranu domowego</string>
<string name="remove_from_sos">Usuń z SOS</string>
<string name="remove_shortcut">Usuń skrót</string>
<string name="removed_all_alarms">Wszystkie alarmy usunięte!</string>
<string name="repeats_every_day">Codziennie</string>
<string name="right_handed">Praworęczny</string>
<string name="saturday">Sobota</string>
<string name="save">Zapisz</string>
<string name="send">Wyślij</string>
<string name="set_default_dialer">Ustaw domyślną aplikację dzwonienia</string>
<string name="set_default_dialer_subtext">BaldPhone musi być domyślną aplikacją dzwonienia</string>
<string name="set_home_screen">Ustaw ekran domowy</string>
<string name="set_home_screen_subtext">Aby używać BaldPhone neleży ustawić go jako ekran domowy, jest to ustawienie które można później zmienić w ustawieniach</string>
<string name="set_keyboard">Ustaw klawiaturę</string>
<string name="setting_does_not_exist">Ustawienie nie istnieje</string>
<string name="settings">Ustawienia</string>
<string name="settings_permission">Ustawienia dozwoleń</string>
<string name="share">Udostępnij</string>
<string name="share_actual_text">Cześć, używam aplikacji "BaldPhone" która sprawia że interfejs telefonu jest duży, prosty i przyjazny. \nZaintesowany/a?\nTa aplikacja jest darmowa!\nkliknij link
poniżej aby zobaczyć więcej informacji:\n\nhttps://sites.google.com/view/BaldPhone
</string>
<string name="share_bald_phone_subtext">Znasz kogoś kto też chciałby używać BaldPhone ? Udostępnij !</string>
<string name="share_baldphone">Udostępnij BaldPhone</string>
<string name="share_contact">Udostępnij kontakt</string>
<string name="share_differently">Udostępnij przez inną aplikację</string>
<string name="share_via_whatsapp">Udostępnij przez Whatsapp</string>
<string name="shift">shift</string>
<string name="show">Pokaż</string>
<string name="small">Mały</string>
<string name="snooze">Wycisz</string>
<string name="sos">SOS</string>
<string name="sos_is_full">SOS jest pełen!</string>
<string name="sos_is_full_subtext">SOS jest pełen! usuń kontakt aby dodać inny</string>
<string name="speak">Mowa</string>
<string name="speech_to_text">Mowa na tekst</string>
<string name="strong_hand">Lewo/Prawo ręczność</string>
<string name="strong_hand_subtext">Wybierz którą ręką głównie chcesz kontrolować BaldPhone.</string>
<string name="submit">OK</string>
<string name="sunday">Niedziela</string>
<string name="technical_information">Informacje techniczne</string>
<string name="theme_settings">Motyw</string>
<string name="theme_settings_subtext">Wybierz motyw</string>
<string name="thursday">Czwartek</string>
<string name="time_changer">Zmiana czasu na tebletki</string>
<string name="tiny">Mały</string>
<string name="to___days_and___hours_from_now">na %d dni i %d godzin od teraz</string>
<string name="to___hours_and___minutes_from_now">na %d godzin i %d minut od teraz</string>
<string name="to___minuets_from_now">na %d minut od teraz</string>
<string name="today">Dziś</string>
<string name="took">Wzięta</string>
<string name="tuesday">Wtorek</string>
<string name="uninstall">Odinstaluj</string>
<string name="uninstall_subtext">Napewno chcesz odinstalować %s?\n%s\?</string>
<string name="up">w górę</string>
<string name="video">Wideo</string>
<string name="video_tutorials">Wideo Poradniki</string>
<string name="videos">Filmy</string>
<string name="voice_mail">Poczta głosowa</string>
<string name="wednesday">Środa</string>
<string name="whatsapp">Whatsapp</string>
<string name="wifi">Wi-fi</string>
<string name="will_repeat_only_once">będzie powtórzony tylko raz!</string>
<string name="write">Pisz</string>
<string name="write_contacts">Zapisz kontakty</string>
<string name="write_external_storage">Zapisz pamięć zawnętrzną</string>
<string name="yes">Tak</string>
<string name="yesterday">Wczoraj</string>
<string name="nothing">Nic</string>
<string name="no_contacts_found">Nie znaleziono kontaktów</string>
<string name="no_alarms">Brak alarmów\nUtwórz nowy przez kliknięcie\n\"Dodaj Alarm\"\nlub\n\"Dodaj Timer\"</string>
<string name="no_pills">Brak tabletek\nDoda nową klikając\n\"Dodaj tabletkę\"</string>
<string name="clear_all_notifications">Wyczyść wszystkie powiadomienia</string>
<string name="clear_cache_subtext">Napewno chcesz uzunąć cały cachce ?\nSkróty aplikacji zostaną usunięte w wyniku tej operacji
</string>
<string name="permissions_calm">Witaj, BaldPhone musi mieć następujące dozwolenia aby funkcjonować. Kilka z nich może wydawać się niepotrzebnych, ale tylko tak BaldPhone może zastąpić interfejs telefonu.
Nie są wysyłane żadne dane. Wciśnij OK aby przyznać dozwolenia lub Anuluj aby wyjść
</string>
<string name="pending_update">Oczekująca aktualizacja</string>
<string name="download">Pobierz</string>
<string name="install_updates">Zainstaluj aktualizacje</string>
<string name="install_updates_subtext">To dozwolenie jest wymagane aby zaktualizować BaldPhone</string>
<string name="a_new_update_is_available">Dostępna jest nowa wersja BaldPhone\nAktualizacje są ważne ze wzgledów bezpieczeństwa i płynności działania\nNaciśnij OK aby pobrać aktualizacje.
</string>
<string name="current_version">Obecna wersja:\n</string>
<string name="new_version">Nowa wersja:\n</string>
<string name="new_updates_are_ready_to_be_downloaded">Nowe aktualizacje są gotowe do pobrania.</string>
<string name="install">Zainstaluj</string>
<string name="data_warning">Ostrzeżenie o danych</string>
<string name="data_warning_subtext">Brak połączenia z WI-FI.\nRozmiar aktualizacji to około 3MB,
jeśli jesteś za granicą kraju może cię to kosztować.\nCzy chcesz kontynuować pobieranie?
</string>
<string name="update_message_is_corrupted">Wiadomość aktualizacji jest uszkodzona.</string>
<string name="check_for_updates">Sprawdź aktualizaje</string>
<string name="could_not_connect_to_server">Brak połączenia z serwerem!</string>
<string name="could_not_connect_to_internet">Brak połączenia z internetem!</string>
<string name="could_not_start_the_download">Wystąpił błąd podczas pobierania!</string>
<string name="downloaded_update_file_could_not_be_deleted">Plik aktualizacji nie mógł zostać usunięty!</string>
<string name="downloading">Pobieranie…</string>
<string name="baldphone_is_up_to_date">BaldPhone jest w aktualnej wersji.</string>
<string name="what_s_new">Co nowego</string>
<string name="download_finished">Pobieranie zakończone!</string>
<string name="downloading_updates">Pobieranie aktualizacji…</string>
<string name="installing_doesn_t_work">Instalacja nie działa?</string>
<string name="try_now">Spróbój teraz</string>
<string name="download_progress">Postęp pobierania</string>
<string name="what_do_you_want_to_do_with___">Co chcesz zrobić z %s?</string>
<string name="crash_reports">Raporty błedów</string>
<string name="crash_reports_subtext">W raportach błedów nie ma Twoich danych, są one bardzo użyteczne do diagnozy problemów z BaldPhone i ich naprawie.
</string>
<string name="custom_app">Inna aplikacja</string>
<string name="custom_app_subtext">Wybierz aplikację do dodania na ekran domowy.</string>
<string name="no_app_was_found">Nie znaleziono aplikacji!</string>
<string name="alarm">Alarm</string>
<string name="no_new_notifications">Brak nowych powiadomień</string>
<string name="sound">Dzwięk</string>
<string name="mute">Wycisz</string>
<string name="vibrate">Wibracje</string>
<string name="your_phone_doesnt_have_assistant_installed">Nie ma zainstalowanego asystenta na tym telefonie.</string>
<string name="status_bar_settings">Belka statusu</string>
<string name="status_bar_settings_subtext">Gdzie chcesz aby była pokazywana belka statusu?</string>
<string name="only_home_screen">Tylko na ekranie domowym</string>
<string name="nowhere">Nigdzie</string>
<string name="everywhere">Wszędzie</string>
<string name="share_photo">Udostępnij obraz</string>
<string name="choose_language_for_keyboard">Wybbierz język</string>
<string name="hebrew">Hebrajski</string>
<string name="english">Angielski</string>
<string name="search">Szukaj</string>
<string name="next">Następny</string>
<string name="go">Zatwierdź</string>
<string name="dialer_sounds">Dzwięki dialeras</string>
<string name="dialer_sounds_subtext">Wybierz czy chcesz włączyć dzwięki dialera.</string>
<string name="low_battery_alert">Ostrzeżenie o niskim poziomie baterii</string>
<string name="low_battery_alert_subtext">Czy chcesz aby belka statusu była czerwona kiedy bateria jest poniżej 20%\nPamiętaj że to ustawienie jest zależne od od tego czy masz włączoną belkę statusu.</string>
<string name="also_available_at">Dostępny także pod adresem\[email protected]\nWiadomość musi być po Anglelsku lub Hebraksju!</string>
<string name="grant_all_permissions">Przyznaj wszystkie dozwolenia</string>
<!--For Tests:-->
<string name="medication_1">Eltroxin 100</string>
<string name="medication_2">Eltroxin 150</string>
<string name="donate">Donate</string>
<string name="emergency_button">Emergency Button</string>
<string name="emergency_settings_subtext">Choose if you want to have an Emergency Button on the home screen.</string>
<string name="private_number">Private Number</string>
<string name="swipe_left_or_right">Swipe left or right</string>
<string name="press_next_or_back_buton">Press next or back arrow</string>
<string name="click_delay">Click Delay</string>
<string name="no_delay">No Delay</string>
<string name="scrolling">Scrolling</string>
<string name="arrows">Arrows</string>
<string name="swipe">Touch</string>
<string name="_long">Long</string>
<string name="_short">Short</string>
<string name="do_you_want_to_save_your_changes">Do you want to save your changes?</string>
<string name="discard">Discard</string>
<string name="no_recent_calls">No Recent Calls</string>
<string name="apps_sort_method">Apps Sort Method</string>
<string name="apps_sort_method_subtext">Choose whether you want to sort the apps in one grid or to have them divided into different groups via letters</string>
<string name="groups">Groups</string>
<string name="one_grid">One Grid</string>
<string name="colorful">Colorful</string>
<string name="colorful_subtext">Do you want to make BaldPhone more colorful?</string>
<string name="edit_home_screen">Edit Home Screen</string>
<string-array name="names_for_screenshots">
<item>The Godfather</item>
<item>Abraham Lincoln</item>
<item>Paul McCartney</item>
<item>Tyrion Lannister</item>
<item>The Rock</item>
<item>Robert Downey Jr.</item>
</string-array>
<bool name="is_right_to_left">false</bool>
</resources>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="matdump"
ProjectGUID="{F85AD892-CF1E-47B7-BC7D-ED00BCA859C0}"
RootNamespace="matdump"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""$(SolutionDir)";"$(SolutionDir)/../getopt";"$(SolutionDir)/../src""
PreprocessorDefinitions="REPLACE_GETOPT"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libmatio.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="$(SolutionDir)$(ConfigurationName)"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""$(HDF5_DIR)/include";"$(SolutionDir)";"$(SolutionDir)/../getopt";"$(SolutionDir)/../src""
PreprocessorDefinitions="REPLACE_GETOPT;MAT73=1;HAVE_HDF5=1;HAVE_ZLIB=1;_HDF5USEDLL_"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libmatio.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories=""$(SolutionDir)";"$(SolutionDir)/../getopt";"$(SolutionDir)/../src""
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;REPLACE_GETOPT"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libmatio.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="$(SolutionDir)$(ConfigurationName)"
EnableUAC="false"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;REPLACE_GETOPT"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libmatio.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\getopt\getopt_long.c"
>
</File>
<File
RelativePath="..\..\tools\matdump.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\getopt\getopt.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
| {
"pile_set_name": "Github"
} |
[
{
"date": "2019-01-01 00:00:00",
"start": "2019-01-01T00:00:00.000Z",
"end": "2019-01-02T00:00:00.000Z",
"name": "Nýársdagur",
"type": "public",
"rule": "01-01",
"_weekday": "Tue"
},
{
"date": "2019-01-06 00:00:00",
"start": "2019-01-06T00:00:00.000Z",
"end": "2019-01-07T00:00:00.000Z",
"name": "Þrettándinn",
"type": "observance",
"rule": "01-06",
"_weekday": "Sun"
},
{
"date": "2019-01-18 00:00:00",
"start": "2019-01-18T00:00:00.000Z",
"end": "2019-01-19T00:00:00.000Z",
"name": "Bóndadagur",
"type": "observance",
"rule": "friday after 01-18",
"_weekday": "Fri"
},
{
"date": "2019-02-18 00:00:00",
"start": "2019-02-18T00:00:00.000Z",
"end": "2019-02-19T00:00:00.000Z",
"name": "Konudagur",
"type": "observance",
"rule": "02-18",
"_weekday": "Mon"
},
{
"date": "2019-03-04 00:00:00",
"start": "2019-03-04T00:00:00.000Z",
"end": "2019-03-05T00:00:00.000Z",
"name": "Bolludagur",
"type": "observance",
"rule": "easter -48",
"_weekday": "Mon"
},
{
"date": "2019-03-05 00:00:00",
"start": "2019-03-05T00:00:00.000Z",
"end": "2019-03-06T00:00:00.000Z",
"name": "Sprengidagur",
"type": "observance",
"rule": "easter -47",
"_weekday": "Tue"
},
{
"date": "2019-03-06 00:00:00",
"start": "2019-03-06T00:00:00.000Z",
"end": "2019-03-07T00:00:00.000Z",
"name": "Öskudagur",
"type": "observance",
"rule": "easter -46",
"_weekday": "Wed"
},
{
"date": "2019-04-14 00:00:00",
"start": "2019-04-14T00:00:00.000Z",
"end": "2019-04-15T00:00:00.000Z",
"name": "Pálmasunnudagur",
"type": "observance",
"rule": "easter -7",
"_weekday": "Sun"
},
{
"date": "2019-04-18 00:00:00",
"start": "2019-04-18T00:00:00.000Z",
"end": "2019-04-19T00:00:00.000Z",
"name": "Skírdagur",
"type": "public",
"rule": "easter -3",
"_weekday": "Thu"
},
{
"date": "2019-04-18 00:00:00",
"start": "2019-04-18T00:00:00.000Z",
"end": "2019-04-19T00:00:00.000Z",
"name": "Sumardagurinn fyrsti",
"type": "public",
"rule": "thursday after 04-18",
"_weekday": "Thu"
},
{
"date": "2019-04-19 00:00:00",
"start": "2019-04-19T00:00:00.000Z",
"end": "2019-04-20T00:00:00.000Z",
"name": "Föstudagurinn langi",
"type": "public",
"rule": "easter -2",
"_weekday": "Fri"
},
{
"date": "2019-04-21 00:00:00",
"start": "2019-04-21T00:00:00.000Z",
"end": "2019-04-22T00:00:00.000Z",
"name": "Páskadagur",
"type": "public",
"rule": "easter",
"_weekday": "Sun"
},
{
"date": "2019-04-22 00:00:00",
"start": "2019-04-22T00:00:00.000Z",
"end": "2019-04-23T00:00:00.000Z",
"name": "Annar í páskum",
"type": "public",
"rule": "easter 1",
"_weekday": "Mon"
},
{
"date": "2019-05-01 00:00:00",
"start": "2019-05-01T00:00:00.000Z",
"end": "2019-05-02T00:00:00.000Z",
"name": "Hátíðisdagur Verkamanna",
"type": "public",
"rule": "05-01",
"_weekday": "Wed"
},
{
"date": "2019-05-12 00:00:00",
"start": "2019-05-12T00:00:00.000Z",
"end": "2019-05-13T00:00:00.000Z",
"name": "Mæðradagurinn",
"type": "observance",
"rule": "2nd sunday in May",
"_weekday": "Sun"
},
{
"date": "2019-05-30 00:00:00",
"start": "2019-05-30T00:00:00.000Z",
"end": "2019-05-31T00:00:00.000Z",
"name": "Uppstigningardagur",
"type": "public",
"rule": "easter 39",
"_weekday": "Thu"
},
{
"date": "2019-06-02 00:00:00",
"start": "2019-06-02T00:00:00.000Z",
"end": "2019-06-03T00:00:00.000Z",
"name": "Sjómannadagurinn",
"type": "observance",
"rule": "1st sunday in June",
"_weekday": "Sun"
},
{
"date": "2019-06-09 00:00:00",
"start": "2019-06-09T00:00:00.000Z",
"end": "2019-06-10T00:00:00.000Z",
"name": "Hvítasunnudagur",
"type": "public",
"rule": "easter 49",
"_weekday": "Sun"
},
{
"date": "2019-06-10 00:00:00",
"start": "2019-06-10T00:00:00.000Z",
"end": "2019-06-11T00:00:00.000Z",
"name": "Annar í hvítasunnu",
"type": "public",
"rule": "easter 50",
"_weekday": "Mon"
},
{
"date": "2019-06-17 00:00:00",
"start": "2019-06-17T00:00:00.000Z",
"end": "2019-06-18T00:00:00.000Z",
"name": "Íslenski þjóðhátíðardagurinn",
"type": "public",
"rule": "06-17",
"_weekday": "Mon"
},
{
"date": "2019-08-05 00:00:00",
"start": "2019-08-05T00:00:00.000Z",
"end": "2019-08-06T00:00:00.000Z",
"name": "Frídagur verslunarmanna",
"type": "public",
"rule": "monday in August",
"_weekday": "Mon"
},
{
"date": "2019-10-26 00:00:00",
"start": "2019-10-26T00:00:00.000Z",
"end": "2019-10-27T00:00:00.000Z",
"name": "Fyrsti vetrardagur",
"type": "observance",
"rule": "saturday after 10-21",
"_weekday": "Sat"
},
{
"date": "2019-11-16 00:00:00",
"start": "2019-11-16T00:00:00.000Z",
"end": "2019-11-17T00:00:00.000Z",
"name": "Dagur íslenskrar tungu",
"type": "observance",
"rule": "11-16",
"_weekday": "Sat"
},
{
"date": "2019-12-23 00:00:00",
"start": "2019-12-23T00:00:00.000Z",
"end": "2019-12-24T00:00:00.000Z",
"name": "Þorláksmessa",
"type": "observance",
"rule": "12-23",
"_weekday": "Mon"
},
{
"date": "2019-12-24 13:00:00",
"start": "2019-12-24T13:00:00.000Z",
"end": "2019-12-25T00:00:00.000Z",
"name": "Aðfangadagur",
"type": "public",
"rule": "12-24 13:00 if sunday then 00:00",
"_weekday": "Tue"
},
{
"date": "2019-12-25 00:00:00",
"start": "2019-12-25T00:00:00.000Z",
"end": "2019-12-26T00:00:00.000Z",
"name": "Jóladagur",
"type": "public",
"rule": "12-25",
"_weekday": "Wed"
},
{
"date": "2019-12-26 00:00:00",
"start": "2019-12-26T00:00:00.000Z",
"end": "2019-12-27T00:00:00.000Z",
"name": "Annar í jólum",
"type": "public",
"rule": "12-26",
"_weekday": "Thu"
},
{
"date": "2019-12-31 13:00:00",
"start": "2019-12-31T13:00:00.000Z",
"end": "2020-01-01T00:00:00.000Z",
"name": "Gamlársdagur",
"type": "public",
"rule": "12-31 13:00 if sunday then 00:00",
"_weekday": "Tue"
}
] | {
"pile_set_name": "Github"
} |
ssd_mobilenet_v1_egohands: (training time: 2h 3m)
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.680
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.968
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.813
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.118
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.329
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.713
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.253
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.739
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.744
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.250
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.471
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.773
ssd_mobilenet_v2_egohands: (training time: 2h 4m 16s)
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.675
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.970
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.813
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.303
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.337
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.706
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.253
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.735
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.738
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.300
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.452
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.769
ssdlite_mobilenet_v2_egohands (training time: 2h 13m 51s)
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.573
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.959
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.661
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.252
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.302
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.597
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.220
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.632
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.637
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.250
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.427
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.660
ssd_inception_v2_egohands (training time: 2h 15m 6s)
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.669
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.965
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.811
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.101
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.305
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.704
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.252
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.726
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.731
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.200
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.443
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.762
rfcn_resnet101_egohands (training time: 3h 4m 54s)
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.751
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.971
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.905
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.025
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.452
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.780
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.271
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.791
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.794
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.100
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.550
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.821
faster_rcnn_resnet50_egohands (training time: 2h 6m 5s)
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.751
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.977
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.906
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.252
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.476
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.776
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.270
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.789
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.793
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.250
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.576
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.817
faster_rcnn_resnet101_egohands (training time: 3h 33m 5s)
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.762
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.980
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.909
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.126
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.479
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.787
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.274
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.797
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.800
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.150
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.577
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.824
faster_rcnn_inception_v2_egohands (training time: 1h 21m 5s)
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.739
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.978
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.889
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.050
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.443
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.766
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.268
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.779
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.784
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.150
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.552
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.809
faster_rcnn_inception_resnet_v2_atrous_egohands (training time: 18h 29m 57s)
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.772
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.979
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.911
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.126
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.504
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.796
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.277
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.805
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.809
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.250
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.590
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.832
* All training time was measured on GTX-1080Ti
| {
"pile_set_name": "Github"
} |
// DATA_TEMPLATE: empty_table
oTest.fnStart( "sAjaxSource" );
/* Sanitfy check really - all the other tests blast this */
$(document).ready( function () {
/* Check the default */
var oTable = $('#example').dataTable( {
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt"
} );
var oSettings = oTable.fnSettings();
oTest.fnWaitTest(
"Server side is off by default",
null,
function () {
return oSettings.sAjaxSource == "../../../examples/ajax/sources/arrays.txt";
}
);
oTest.fnComplete();
} ); | {
"pile_set_name": "Github"
} |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <wangle/bootstrap/AcceptRoutingHandler.h>
#include <wangle/bootstrap/ServerBootstrap.h>
#include <wangle/channel/broadcast/BroadcastPool.h>
#include <wangle/channel/broadcast/Subscriber.h>
namespace wangle {
/**
* A Handler-Observer adaptor that can be used for subscribing to broadcasts.
* Maintains a thread-local BroadcastPool from which a BroadcastHandler is
* obtained and subscribed to based on the given routing data.
*/
template <typename T, typename R, typename P = DefaultPipeline>
class ObservingHandler : public HandlerAdapter<folly::IOBufQueue&, T>,
public Subscriber<T, R> {
public:
typedef typename HandlerAdapter<folly::IOBufQueue&, T>::Context Context;
ObservingHandler(const R& routingData, BroadcastPool<T, R, P>* broadcastPool);
~ObservingHandler() override;
// Non-copyable
ObservingHandler(const ObservingHandler&) = delete;
ObservingHandler& operator=(const ObservingHandler&) = delete;
// Movable
ObservingHandler(ObservingHandler&&) = default;
ObservingHandler& operator=(ObservingHandler&&) = default;
// HandlerAdapter implementation
void transportActive(Context* ctx) override;
void readEOF(Context* ctx) override;
void readException(Context* ctx, folly::exception_wrapper ex) override;
// Subscriber implementation
void onNext(const T& buf) override;
void onError(folly::exception_wrapper ex) override;
void onCompleted() override;
R& routingData() override;
private:
R routingData_;
BroadcastPool<T, R, P>* broadcastPool_{nullptr};
BroadcastHandler<T, R>* broadcastHandler_{nullptr};
uint64_t subscriptionId_{0};
bool paused_{false};
// True iff the handler has been deleted
std::shared_ptr<bool> deleted_{new bool(false)};
};
template <typename T>
using ObservingPipeline = Pipeline<folly::IOBufQueue&, T>;
template <typename T, typename R, typename P = DefaultPipeline>
class ObservingPipelineFactory
: public RoutingDataPipelineFactory<ObservingPipeline<T>, R> {
public:
ObservingPipelineFactory(
std::shared_ptr<ServerPool<R, P>> serverPool,
std::shared_ptr<BroadcastPipelineFactory<T, R>> broadcastPipelineFactory)
: serverPool_(serverPool),
broadcastPipelineFactory_(broadcastPipelineFactory) {}
typename ObservingPipeline<T>::Ptr newPipeline(
std::shared_ptr<folly::AsyncTransport> socket,
const R& routingData,
RoutingDataHandler<R>*,
std::shared_ptr<TransportInfo> transportInfo) override {
auto pipeline = ObservingPipeline<T>::create();
pipeline->addBack(AsyncSocketHandler(socket));
auto handler = std::make_shared<ObservingHandler<T, R, P>>(
routingData, broadcastPool());
pipeline->addBack(handler);
pipeline->finalize();
pipeline->setTransportInfo(transportInfo);
return pipeline;
}
virtual BroadcastPool<T, R, P>* broadcastPool(
std::shared_ptr<BaseClientBootstrapFactory<>> clientFactory = nullptr) {
if (!broadcastPool_) {
if (clientFactory) {
broadcastPool_.reset(new BroadcastPool<T, R, P>(
serverPool_, broadcastPipelineFactory_, clientFactory));
} else {
broadcastPool_.reset(
new BroadcastPool<T, R, P>(serverPool_, broadcastPipelineFactory_));
}
}
return broadcastPool_.get();
}
protected:
std::shared_ptr<ServerPool<R, P>> serverPool_;
std::shared_ptr<BroadcastPipelineFactory<T, R>> broadcastPipelineFactory_;
folly::ThreadLocalPtr<BroadcastPool<T, R, P>> broadcastPool_;
};
} // namespace wangle
#include <wangle/channel/broadcast/ObservingHandler-inl.h>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:getAvailableGroupsResponse
xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
<DirectionalDNSAvailableGroups
xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">
<item>EU-foo.jclouds.org.</item>
<item>non-foo.jclouds.org.</item>
</DirectionalDNSAvailableGroups>
</ns1:getAvailableGroupsResponse>
</soap:Body>
</soap:Envelope> | {
"pile_set_name": "Github"
} |
# SPDX-License-Identifier: GPL-2.0
#
# Hisilicon Clock specific Makefile
#
obj-y += clk.o clkgate-separated.o clkdivider-hi6220.o clk-hisi-phase.o
obj-$(CONFIG_ARCH_HI3xxx) += clk-hi3620.o
obj-$(CONFIG_ARCH_HIP04) += clk-hip04.o
obj-$(CONFIG_ARCH_HIX5HD2) += clk-hix5hd2.o
obj-$(CONFIG_COMMON_CLK_HI3516CV300) += crg-hi3516cv300.o
obj-$(CONFIG_COMMON_CLK_HI3519) += clk-hi3519.o
obj-$(CONFIG_COMMON_CLK_HI3660) += clk-hi3660.o
obj-$(CONFIG_COMMON_CLK_HI3670) += clk-hi3670.o
obj-$(CONFIG_COMMON_CLK_HI3798CV200) += crg-hi3798cv200.o
obj-$(CONFIG_COMMON_CLK_HI6220) += clk-hi6220.o
obj-$(CONFIG_RESET_HISI) += reset.o
obj-$(CONFIG_STUB_CLK_HI6220) += clk-hi6220-stub.o
obj-$(CONFIG_STUB_CLK_HI3660) += clk-hi3660-stub.o
| {
"pile_set_name": "Github"
} |
package main
import "fmt"
func fib(N int) int {
// 0 ms, 1.9 MB
// 递推法求斐波那契
if N == 0 {
return 0
}
n1, n2 := 0, 1 // n1为n-1,n2为n-2
for i := 1; i < N; i++ {
n1, n2 = n1+n2, n1
}
return n1 + n2
}
func main() {
for i := 0; i < 10; i++ {
fmt.Printf("%d ", fib(i))
}
}
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 0af41ebc1f8e7485d93cb4b9070e9d1a
timeCreated: 1482363481
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
"""
Decorators for views based on HTTP headers.
"""
import logging
from calendar import timegm
from functools import wraps
from django.utils.decorators import decorator_from_middleware, available_attrs
from django.utils.http import http_date, parse_http_date_safe, parse_etags, quote_etag
from django.middleware.http import ConditionalGetMiddleware
from django.http import HttpResponseNotAllowed, HttpResponseNotModified, HttpResponse
conditional_page = decorator_from_middleware(ConditionalGetMiddleware)
logger = logging.getLogger('django.request')
def require_http_methods(request_method_list):
"""
Decorator to make a view only accept particular request methods. Usage::
@require_http_methods(["GET", "POST"])
def my_view(request):
# I can assume now that only GET or POST requests make it this far
# ...
Note that request methods should be in uppercase.
"""
def decorator(func):
@wraps(func, assigned=available_attrs(func))
def inner(request, *args, **kwargs):
if request.method not in request_method_list:
logger.warning('Method Not Allowed (%s): %s', request.method, request.path,
extra={
'status_code': 405,
'request': request
}
)
return HttpResponseNotAllowed(request_method_list)
return func(request, *args, **kwargs)
return inner
return decorator
require_GET = require_http_methods(["GET"])
require_GET.__doc__ = "Decorator to require that a view only accept the GET method."
require_POST = require_http_methods(["POST"])
require_POST.__doc__ = "Decorator to require that a view only accept the POST method."
require_safe = require_http_methods(["GET", "HEAD"])
require_safe.__doc__ = "Decorator to require that a view only accept safe methods: GET and HEAD."
def condition(etag_func=None, last_modified_func=None):
"""
Decorator to support conditional retrieval (or change) for a view
function.
The parameters are callables to compute the ETag and last modified time for
the requested resource, respectively. The callables are passed the same
parameters as the view itself. The Etag function should return a string (or
None if the resource doesn't exist), whilst the last_modified function
should return a datetime object (or None if the resource doesn't exist).
If both parameters are provided, all the preconditions must be met before
the view is processed.
This decorator will either pass control to the wrapped view function or
return an HTTP 304 response (unmodified) or 412 response (preconditions
failed), depending upon the request method.
Any behavior marked as "undefined" in the HTTP spec (e.g. If-none-match
plus If-modified-since headers) will result in the view function being
called.
"""
def decorator(func):
@wraps(func, assigned=available_attrs(func))
def inner(request, *args, **kwargs):
# Get HTTP request headers
if_modified_since = request.META.get("HTTP_IF_MODIFIED_SINCE")
if if_modified_since:
if_modified_since = parse_http_date_safe(if_modified_since)
if_none_match = request.META.get("HTTP_IF_NONE_MATCH")
if_match = request.META.get("HTTP_IF_MATCH")
if if_none_match or if_match:
# There can be more than one ETag in the request, so we
# consider the list of values.
try:
etags = parse_etags(if_none_match or if_match)
except ValueError:
# In case of invalid etag ignore all ETag headers.
# Apparently Opera sends invalidly quoted headers at times
# (we should be returning a 400 response, but that's a
# little extreme) -- this is Django bug #10681.
if_none_match = None
if_match = None
# Compute values (if any) for the requested resource.
if etag_func:
res_etag = etag_func(request, *args, **kwargs)
else:
res_etag = None
if last_modified_func:
dt = last_modified_func(request, *args, **kwargs)
if dt:
res_last_modified = timegm(dt.utctimetuple())
else:
res_last_modified = None
else:
res_last_modified = None
response = None
if not ((if_match and (if_modified_since or if_none_match)) or
(if_match and if_none_match)):
# We only get here if no undefined combinations of headers are
# specified.
if ((if_none_match and (res_etag in etags or
"*" in etags and res_etag)) and
(not if_modified_since or
(res_last_modified and if_modified_since and
res_last_modified <= if_modified_since))):
if request.method in ("GET", "HEAD"):
response = HttpResponseNotModified()
else:
logger.warning('Precondition Failed: %s', request.path,
extra={
'status_code': 412,
'request': request
}
)
response = HttpResponse(status=412)
elif if_match and ((not res_etag and "*" in etags) or
(res_etag and res_etag not in etags)):
logger.warning('Precondition Failed: %s', request.path,
extra={
'status_code': 412,
'request': request
}
)
response = HttpResponse(status=412)
elif (not if_none_match and request.method == "GET" and
res_last_modified and if_modified_since and
res_last_modified <= if_modified_since):
response = HttpResponseNotModified()
if response is None:
response = func(request, *args, **kwargs)
# Set relevant headers on the response if they don't already exist.
if res_last_modified and not response.has_header('Last-Modified'):
response['Last-Modified'] = http_date(res_last_modified)
if res_etag and not response.has_header('ETag'):
response['ETag'] = quote_etag(res_etag)
return response
return inner
return decorator
# Shortcut decorators for common cases based on ETag or Last-Modified only
def etag(etag_func):
return condition(etag_func=etag_func)
def last_modified(last_modified_func):
return condition(last_modified_func=last_modified_func)
| {
"pile_set_name": "Github"
} |
package bll
import "github.com/google/wire"
// BllSet bll注入
var BllSet = wire.NewSet(
DemoSet,
LoginSet,
MenuSet,
RoleSet,
UserSet,
)
| {
"pile_set_name": "Github"
} |
/*
* This file is part of lanterna (https://github.com/mabe02/lanterna).
*
* lanterna 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) 2010-2020 Martin Berglund
*/
package com.googlecode.lanterna.screen;
import com.googlecode.lanterna.TerminalPosition;
import com.googlecode.lanterna.TestTerminalFactory;
import com.googlecode.lanterna.TextColor;
import com.googlecode.lanterna.graphics.TextGraphics;
import com.googlecode.lanterna.input.KeyStroke;
import com.googlecode.lanterna.input.KeyType;
import java.io.IOException;
/**
* Test for VirtualScreen class
* @author Martin
*/
public class VirtualScreenTest {
public static void main(String[] args) throws InterruptedException, IOException {
new VirtualScreenTest(args);
}
public VirtualScreenTest(String[] args) throws InterruptedException, IOException {
Screen screen = new TestTerminalFactory(args).createScreen();
screen = new VirtualScreen(screen);
screen.startScreen();
TextGraphics textGraphics = screen.newTextGraphics();
textGraphics.setBackgroundColor(TextColor.ANSI.GREEN);
textGraphics.fillTriangle(new TerminalPosition(40, 0), new TerminalPosition(25,19), new TerminalPosition(65, 19), ' ');
textGraphics.setBackgroundColor(TextColor.ANSI.RED);
textGraphics.drawRectangle(TerminalPosition.TOP_LEFT_CORNER, screen.getTerminalSize(), ' ');
screen.refresh();
while(true) {
KeyStroke keyStroke = screen.pollInput();
if(keyStroke != null) {
if(keyStroke.getKeyType() == KeyType.Escape) {
break;
}
}
else if(screen.doResizeIfNecessary() != null) {
screen.refresh();
}
else {
Thread.sleep(1);
}
}
screen.stopScreen();
}
}
| {
"pile_set_name": "Github"
} |
//
// StockSeries.h
// BBChart
//
// Created by ChenXiaoyu on 15/1/8.
// Copyright (c) 2015年 ChenXiaoyu. All rights reserved.
//
#import "Series.h"
@interface StockSeriesPoint : NSObject
@property (nonatomic) CGFloat open, close, low, high;
@end
@interface StockSeries : Series
-(void) addPointOpen:(CGFloat)o close:(CGFloat)c low:(CGFloat)l high:(CGFloat)h;
@end
| {
"pile_set_name": "Github"
} |
module.exports = app => {
return {
schedule: {
// interval: '30s',
cron: '0 0 */1 * *', // 每天零点
type: 'all',
},
disable: true,
cronOptions: {
tz: 'Asia/Shanghai'
},
async task(ctx) {
console.info('page_count_log', app.getPV())
}
}
}
| {
"pile_set_name": "Github"
} |
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package coverage
import (
"io"
)
// This is an implementation of testing.testDeps. It doesn't need to do anything, because
// no tests are actually run. It does need a concrete implementation of at least ImportPath,
// which is called unconditionally when running tests.
//lint:ignore U1000 see comment above, we know it's unused normally.
type fakeTestDeps struct{}
func (fakeTestDeps) ImportPath() string {
return ""
}
func (fakeTestDeps) MatchString(pat, str string) (bool, error) {
return false, nil
}
func (fakeTestDeps) StartCPUProfile(io.Writer) error {
return nil
}
func (fakeTestDeps) StopCPUProfile() {}
func (fakeTestDeps) StartTestLog(io.Writer) {}
func (fakeTestDeps) StopTestLog() error {
return nil
}
func (fakeTestDeps) WriteHeapProfile(io.Writer) error {
return nil
}
func (fakeTestDeps) WriteProfileTo(string, io.Writer, int) error {
return nil
}
| {
"pile_set_name": "Github"
} |
/*
* FreeRTOS Kernel V10.0.1
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* http://www.FreeRTOS.org
* http://aws.amazon.com/freertos
*
* 1 tab == 4 spaces!
*/
/******************************************************************************
* This project provides two demo applications. A low power project that
* demonstrates the FreeRTOS tickless mode, and a more comprehensive test and
* demo application. The configCREATE_LOW_POWER_DEMO setting (defined at the
* top of FreeRTOSConfig.h) is used to select between the two. The low power
* demo is implemented and described in main_low_power.c. The more
* comprehensive test and demo application is implemented and described in
* main_full.c.
*
* This file implements the code that is not demo specific, including the
* hardware setup and FreeRTOS hook functions.
*/
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
/* Platform includes. */
#include "lcd.h"
/*-----------------------------------------------------------*/
/*
* main_low_power() is used when configCREATE_LOW_POWER_DEMO is set to 1.
* main_full() is used when configCREATE_LOW_POWER_DEMO is set to 0.
*/
extern void main_low_power( void );
extern void main_full( void );
/* Prototypes for the standard FreeRTOS callback/hook functions implemented
within this file. */
void vApplicationMallocFailedHook( void );
void vApplicationIdleHook( void );
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
void vApplicationTickHook( void );
/*-----------------------------------------------------------*/
/* See the documentation page for this demo on the FreeRTOS.org web site for
full information - including hardware setup requirements. */
void main( void )
{
lcd_initialize();
lcd_display( LCD_LINE1, "FreeRTOS" );
/* The configCREATE_LOW_POWER_DEMO setting is described in FreeRTOSConfig.h. */
#if configCREATE_LOW_POWER_DEMO == 1
{
lcd_display( LCD_LINE2, "LP Demo" );
main_low_power();
}
#else
{
lcd_display( LCD_LINE2, "Ful Demo" );
main_full();
}
#endif
}
/*-----------------------------------------------------------*/
void vApplicationMallocFailedHook( void )
{
/* vApplicationMallocFailedHook() will only be called if
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
function that will get called if a call to pvPortMalloc() fails.
pvPortMalloc() is called internally by the kernel whenever a task, queue,
timer or semaphore is created. It is also called by various parts of the
demo application. If heap_1.c, heap_2.c or heap_4.c are used, then the size
of the heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE
in FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
to query the size of free heap space that remains (although it does not
provide information on how the remaining heap might be fragmented). */
taskDISABLE_INTERRUPTS();
for( ;; );
}
/*-----------------------------------------------------------*/
void vApplicationIdleHook( void )
{
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
task. It is essential that code added to this hook function never attempts
to block in any way (for example, call xQueueReceive() with a block time
specified, or call vTaskDelay()). If the application makes use of the
vTaskDelete() API function (as this demo application does) then it is also
important that vApplicationIdleHook() is permitted to return to its calling
function, because it is the responsibility of the idle task to clean up
memory allocated by the kernel to any task that has since been deleted. */
}
/*-----------------------------------------------------------*/
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
{
( void ) pcTaskName;
( void ) pxTask;
/* Run time stack overflow checking is performed if
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is
called if a stack overflow is detected. */
taskDISABLE_INTERRUPTS();
for( ;; );
}
/*-----------------------------------------------------------*/
void vApplicationTickHook( void )
{
/* This function will be called by each tick interrupt if
configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be
added here, but the tick hook is called from an interrupt context, so
code must not attempt to block, and only the interrupt safe FreeRTOS API
functions can be used (those that end in FromISR()). */
}
/*-----------------------------------------------------------*/
void vAssertCalled( void )
{
volatile unsigned long ul = 0;
taskENTER_CRITICAL();
{
/* Set ul to a non-zero value using the debugger to step out of this
function. */
while( ul == 0 )
{
__asm volatile( "NOP" );
}
}
taskEXIT_CRITICAL();
}
| {
"pile_set_name": "Github"
} |
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#ifndef _INC_INTERNAL
#define _INC_INTERNAL
#include <crtdefs.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <limits.h>
#include <windows.h>
#pragma pack(push,_CRT_PACKING)
#define __IOINFO_TM_ANSI 0
#define __IOINFO_TM_UTF8 1
#define __IOINFO_TM_UTF16LE 2
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4214)
#pragma warning(disable:4820)
#endif
typedef struct {
intptr_t osfhnd;
char osfile;
char pipech;
int lockinitflag;
CRITICAL_SECTION lock;
char textmode : 7;
char unicode : 1;
char pipech2[2];
} ioinfo;
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#define IOINFO_ARRAY_ELTS (1 << 5)
#define _pioinfo(i) (__pioinfo[(i) >> 5] + ((i) & (IOINFO_ARRAY_ELTS - 1)))
#define _osfile(i) (_pioinfo(i)->osfile)
#define _pipech2(i) (_pioinfo(i)->pipech2)
#define _textmode(i) (_pioinfo(i)->textmode)
#define _tm_unicode(i) (_pioinfo(i)->unicode)
#define _pioinfo_safe(i) ((((i) != -1) && ((i) != -2)) ? _pioinfo(i) : &__badioinfo)
#define _osfhnd_safe(i) (_pioinfo_safe(i)->osfhnd)
#define _osfile_safe(i) (_pioinfo_safe(i)->osfile)
#define _pipech_safe(i) (_pioinfo_safe(i)->pipech)
#define _pipech2_safe(i) (_pioinfo_safe(i)->pipech2)
#define _textmode_safe(i) (_pioinfo_safe(i)->textmode)
#define _tm_unicode_safe(i) (_pioinfo_safe(i)->unicode)
#ifndef __badioinfo
extern ioinfo ** __MINGW_IMP_SYMBOL(__badioinfo)[];
#define __badioinfo (* __MINGW_IMP_SYMBOL(__badioinfo))
#endif
#ifndef __pioinfo
extern ioinfo ** __MINGW_IMP_SYMBOL(__pioinfo)[];
#define __pioinfo (* __MINGW_IMP_SYMBOL(__pioinfo))
#endif
#define _NO_CONSOLE_FILENO (intptr_t)-2
#ifndef _FILE_DEFINED
#define _FILE_DEFINED
struct _iobuf {
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char *_tmpfname;
};
typedef struct _iobuf FILE;
#endif
#if !defined (_FILEX_DEFINED) && defined (_WINDOWS_)
#define _FILEX_DEFINED
typedef struct {
FILE f;
CRITICAL_SECTION lock;
} _FILEX;
#endif
extern int _dowildcard;
extern int _newmode;
#ifndef __winitenv
extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv);
#define __winitenv (* __MINGW_IMP_SYMBOL(__winitenv))
#endif
#if !defined(__initenv) && !defined(__arm__)
extern char *** __MINGW_IMP_SYMBOL(__initenv);
#define __initenv (* __MINGW_IMP_SYMBOL(__initenv))
#endif
_CRTIMP void __cdecl _amsg_exit(int);
int __CRTDECL _setargv(void);
int __CRTDECL __setargv(void);
int __CRTDECL _wsetargv(void);
int __CRTDECL __wsetargv(void);
int __CRTDECL main(int _Argc, char **_Argv, char **_Env);
int __CRTDECL wmain(int _Argc, wchar_t **_Argv, wchar_t **_Env);
#ifndef _STARTUP_INFO_DEFINED
#define _STARTUP_INFO_DEFINED
typedef struct {
int newmode;
} _startupinfo;
#endif
_CRTIMP int __cdecl __getmainargs(int * _Argc, char *** _Argv, char ***_Env, int _DoWildCard, _startupinfo *_StartInfo);
_CRTIMP int __cdecl __wgetmainargs(int * _Argc, wchar_t ***_Argv, wchar_t ***_Env, int _DoWildCard, _startupinfo *_StartInfo);
#define _CONSOLE_APP 1
#define _GUI_APP 2
typedef enum __enative_startup_state {
__uninitialized = 0, __initializing, __initialized
} __enative_startup_state;
extern volatile __enative_startup_state __native_startup_state;
extern volatile void *__native_startup_lock;
extern volatile unsigned int __native_dllmain_reason;
extern volatile unsigned int __native_vcclrit_reason;
_CRTIMP void __cdecl __set_app_type (int);
typedef LONG NTSTATUS;
#include <crtdbg.h>
#include <errno.h>
BOOL __cdecl _ValidateImageBase (PBYTE pImageBase);
PIMAGE_SECTION_HEADER __cdecl _FindPESection (PBYTE pImageBase, DWORD_PTR rva);
BOOL __cdecl _IsNonwritableInCurrentImage (PBYTE pTarget);
#ifdef __cplusplus
}
#endif
#pragma pack(pop)
#endif
| {
"pile_set_name": "Github"
} |
{
"name": "HiliteCore",
"version": "0.1.17-alpha",
"summary": "HiliteSDK Core module",
"description": "HiliteSDK Core module providing core functionality and data structures",
"homepage": "http://developers.hilite.media/",
"license": "Apache License, Version 2.0",
"authors": {
"Preston Pope": "[email protected]"
},
"platforms": {
"ios": "10.0"
},
"source": {
"git": "https://github.com/betacamp/HiliteCore.git",
"tag": "0.1.17-alpha"
},
"source_files": [
"Classes",
"HiliteCore/**/*.{swift}"
],
"exclude_files": "Classes/Exclude",
"dependencies": {
"SwiftyJSON": [
]
}
}
| {
"pile_set_name": "Github"
} |
import { Atom } from "@thi.ng/atom";
import { repeat } from "@thi.ng/transducers";
import { makeBins, updateAudio } from "./audio";
import { NUM_BINS, PRESETS } from "./config";
export const DB = new Atom({
auto: <any>null,
gain: 0.5,
decay: 0.999,
attenuate: 0.004,
interval: 70,
feedback: 0.66,
bins: [...repeat(0, NUM_BINS)],
wave: new Float64Array(NUM_BINS * 2),
size: [window.innerWidth, window.innerHeight],
});
export const setGain = (gain: number) => {
DB.resetIn(["gain"], gain);
updateAudio();
};
export const clearSpectrum = () => {
DB.resetIn(["bins"], makeBins());
updateAudio();
};
export const setSpectrumPreset = (id: number) => {
DB.swapIn(["bins"], PRESETS[id]);
updateAudio();
};
export const updateSpectrumBin = (bin: number, amp: number) => {
DB.resetIn(["bins", bin], amp);
updateAudio();
};
| {
"pile_set_name": "Github"
} |
/*
* File: af_phonet.c
*
* Phonet protocols family
*
* Copyright (C) 2008 Nokia Corporation.
*
* Contact: Remi Denis-Courmont <[email protected]>
* Original author: Sakari Ailus <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <asm/unaligned.h>
#include <net/sock.h>
#include <linux/if_phonet.h>
#include <linux/phonet.h>
#include <net/phonet/phonet.h>
#include <net/phonet/pn_dev.h>
/* Transport protocol registration */
static struct phonet_protocol *proto_tab[PHONET_NPROTO] __read_mostly;
static struct phonet_protocol *phonet_proto_get(unsigned int protocol)
{
struct phonet_protocol *pp;
if (protocol >= PHONET_NPROTO)
return NULL;
rcu_read_lock();
pp = rcu_dereference(proto_tab[protocol]);
if (pp && !try_module_get(pp->prot->owner))
pp = NULL;
rcu_read_unlock();
return pp;
}
static inline void phonet_proto_put(struct phonet_protocol *pp)
{
module_put(pp->prot->owner);
}
/* protocol family functions */
static int pn_socket_create(struct net *net, struct socket *sock, int protocol,
int kern)
{
struct sock *sk;
struct pn_sock *pn;
struct phonet_protocol *pnp;
int err;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
if (protocol == 0) {
/* Default protocol selection */
switch (sock->type) {
case SOCK_DGRAM:
protocol = PN_PROTO_PHONET;
break;
case SOCK_SEQPACKET:
protocol = PN_PROTO_PIPE;
break;
default:
return -EPROTONOSUPPORT;
}
}
pnp = phonet_proto_get(protocol);
if (pnp == NULL &&
request_module("net-pf-%d-proto-%d", PF_PHONET, protocol) == 0)
pnp = phonet_proto_get(protocol);
if (pnp == NULL)
return -EPROTONOSUPPORT;
if (sock->type != pnp->sock_type) {
err = -EPROTONOSUPPORT;
goto out;
}
sk = sk_alloc(net, PF_PHONET, GFP_KERNEL, pnp->prot);
if (sk == NULL) {
err = -ENOMEM;
goto out;
}
sock_init_data(sock, sk);
sock->state = SS_UNCONNECTED;
sock->ops = pnp->ops;
sk->sk_backlog_rcv = sk->sk_prot->backlog_rcv;
sk->sk_protocol = protocol;
pn = pn_sk(sk);
pn->sobject = 0;
pn->dobject = 0;
pn->resource = 0;
sk->sk_prot->init(sk);
err = 0;
out:
phonet_proto_put(pnp);
return err;
}
static const struct net_proto_family phonet_proto_family = {
.family = PF_PHONET,
.create = pn_socket_create,
.owner = THIS_MODULE,
};
/* Phonet device header operations */
static int pn_header_create(struct sk_buff *skb, struct net_device *dev,
unsigned short type, const void *daddr,
const void *saddr, unsigned len)
{
u8 *media = skb_push(skb, 1);
if (type != ETH_P_PHONET)
return -1;
if (!saddr)
saddr = dev->dev_addr;
*media = *(const u8 *)saddr;
return 1;
}
static int pn_header_parse(const struct sk_buff *skb, unsigned char *haddr)
{
const u8 *media = skb_mac_header(skb);
*haddr = *media;
return 1;
}
struct header_ops phonet_header_ops = {
.create = pn_header_create,
.parse = pn_header_parse,
};
EXPORT_SYMBOL(phonet_header_ops);
/*
* Prepends an ISI header and sends a datagram.
*/
static int pn_send(struct sk_buff *skb, struct net_device *dev,
u16 dst, u16 src, u8 res, u8 irq)
{
struct phonethdr *ph;
int err;
if (skb->len + 2 > 0xffff /* Phonet length field limit */ ||
skb->len + sizeof(struct phonethdr) > dev->mtu) {
err = -EMSGSIZE;
goto drop;
}
/* Broadcast sending is not implemented */
if (pn_addr(dst) == PNADDR_BROADCAST) {
err = -EOPNOTSUPP;
goto drop;
}
skb_reset_transport_header(skb);
WARN_ON(skb_headroom(skb) & 1); /* HW assumes word alignment */
skb_push(skb, sizeof(struct phonethdr));
skb_reset_network_header(skb);
ph = pn_hdr(skb);
ph->pn_rdev = pn_dev(dst);
ph->pn_sdev = pn_dev(src);
ph->pn_res = res;
ph->pn_length = __cpu_to_be16(skb->len + 2 - sizeof(*ph));
ph->pn_robj = pn_obj(dst);
ph->pn_sobj = pn_obj(src);
skb->protocol = htons(ETH_P_PHONET);
skb->priority = 0;
skb->dev = dev;
if (skb->pkt_type == PACKET_LOOPBACK) {
skb_reset_mac_header(skb);
skb_orphan(skb);
err = (irq ? netif_rx(skb) : netif_rx_ni(skb)) ? -ENOBUFS : 0;
} else {
err = dev_hard_header(skb, dev, ntohs(skb->protocol),
NULL, NULL, skb->len);
if (err < 0) {
err = -EHOSTUNREACH;
goto drop;
}
err = dev_queue_xmit(skb);
if (unlikely(err > 0))
err = net_xmit_errno(err);
}
return err;
drop:
kfree_skb(skb);
return err;
}
static int pn_raw_send(const void *data, int len, struct net_device *dev,
u16 dst, u16 src, u8 res)
{
struct sk_buff *skb = alloc_skb(MAX_PHONET_HEADER + len, GFP_ATOMIC);
if (skb == NULL)
return -ENOMEM;
if (phonet_address_lookup(dev_net(dev), pn_addr(dst)) == 0)
skb->pkt_type = PACKET_LOOPBACK;
skb_reserve(skb, MAX_PHONET_HEADER);
__skb_put(skb, len);
skb_copy_to_linear_data(skb, data, len);
return pn_send(skb, dev, dst, src, res, 1);
}
/*
* Create a Phonet header for the skb and send it out. Returns
* non-zero error code if failed. The skb is freed then.
*/
int pn_skb_send(struct sock *sk, struct sk_buff *skb,
const struct sockaddr_pn *target)
{
struct net *net = sock_net(sk);
struct net_device *dev;
struct pn_sock *pn = pn_sk(sk);
int err;
u16 src, dst;
u8 daddr, saddr, res;
src = pn->sobject;
if (target != NULL) {
dst = pn_sockaddr_get_object(target);
res = pn_sockaddr_get_resource(target);
} else {
dst = pn->dobject;
res = pn->resource;
}
daddr = pn_addr(dst);
err = -EHOSTUNREACH;
if (sk->sk_bound_dev_if)
dev = dev_get_by_index(net, sk->sk_bound_dev_if);
else if (phonet_address_lookup(net, daddr) == 0) {
dev = phonet_device_get(net);
skb->pkt_type = PACKET_LOOPBACK;
} else if (dst == 0) {
/* Resource routing (small race until phonet_rcv()) */
struct sock *sk = pn_find_sock_by_res(net, res);
if (sk) {
sock_put(sk);
dev = phonet_device_get(net);
skb->pkt_type = PACKET_LOOPBACK;
} else
dev = phonet_route_output(net, daddr);
} else
dev = phonet_route_output(net, daddr);
if (!dev || !(dev->flags & IFF_UP))
goto drop;
saddr = phonet_address_get(dev, daddr);
if (saddr == PN_NO_ADDR)
goto drop;
if (!pn_addr(src))
src = pn_object(saddr, pn_obj(src));
err = pn_send(skb, dev, dst, src, res, 0);
dev_put(dev);
return err;
drop:
kfree_skb(skb);
if (dev)
dev_put(dev);
return err;
}
EXPORT_SYMBOL(pn_skb_send);
/* Do not send an error message in response to an error message */
static inline int can_respond(struct sk_buff *skb)
{
const struct phonethdr *ph;
const struct phonetmsg *pm;
u8 submsg_id;
if (!pskb_may_pull(skb, 3))
return 0;
ph = pn_hdr(skb);
if (ph->pn_res == PN_PREFIX && !pskb_may_pull(skb, 5))
return 0;
if (ph->pn_res == PN_COMMGR) /* indications */
return 0;
ph = pn_hdr(skb); /* re-acquires the pointer */
pm = pn_msg(skb);
if (pm->pn_msg_id != PN_COMMON_MESSAGE)
return 1;
submsg_id = (ph->pn_res == PN_PREFIX)
? pm->pn_e_submsg_id : pm->pn_submsg_id;
if (submsg_id != PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP &&
pm->pn_e_submsg_id != PN_COMM_SERVICE_NOT_IDENTIFIED_RESP)
return 1;
return 0;
}
static int send_obj_unreachable(struct sk_buff *rskb)
{
const struct phonethdr *oph = pn_hdr(rskb);
const struct phonetmsg *opm = pn_msg(rskb);
struct phonetmsg resp;
memset(&resp, 0, sizeof(resp));
resp.pn_trans_id = opm->pn_trans_id;
resp.pn_msg_id = PN_COMMON_MESSAGE;
if (oph->pn_res == PN_PREFIX) {
resp.pn_e_res_id = opm->pn_e_res_id;
resp.pn_e_submsg_id = PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP;
resp.pn_e_orig_msg_id = opm->pn_msg_id;
resp.pn_e_status = 0;
} else {
resp.pn_submsg_id = PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP;
resp.pn_orig_msg_id = opm->pn_msg_id;
resp.pn_status = 0;
}
return pn_raw_send(&resp, sizeof(resp), rskb->dev,
pn_object(oph->pn_sdev, oph->pn_sobj),
pn_object(oph->pn_rdev, oph->pn_robj),
oph->pn_res);
}
static int send_reset_indications(struct sk_buff *rskb)
{
struct phonethdr *oph = pn_hdr(rskb);
static const u8 data[4] = {
0x00 /* trans ID */, 0x10 /* subscribe msg */,
0x00 /* subscription count */, 0x00 /* dummy */
};
return pn_raw_send(data, sizeof(data), rskb->dev,
pn_object(oph->pn_sdev, 0x00),
pn_object(oph->pn_rdev, oph->pn_robj),
PN_COMMGR);
}
/* packet type functions */
/*
* Stuff received packets to associated sockets.
* On error, returns non-zero and releases the skb.
*/
static int phonet_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pkttype,
struct net_device *orig_dev)
{
struct net *net = dev_net(dev);
struct phonethdr *ph;
struct sockaddr_pn sa;
u16 len;
/* check we have at least a full Phonet header */
if (!pskb_pull(skb, sizeof(struct phonethdr)))
goto out;
/* check that the advertised length is correct */
ph = pn_hdr(skb);
len = get_unaligned_be16(&ph->pn_length);
if (len < 2)
goto out;
len -= 2;
if ((len > skb->len) || pskb_trim(skb, len))
goto out;
skb_reset_transport_header(skb);
pn_skb_get_dst_sockaddr(skb, &sa);
/* check if this is broadcasted */
if (pn_sockaddr_get_addr(&sa) == PNADDR_BROADCAST) {
pn_deliver_sock_broadcast(net, skb);
goto out;
}
/* resource routing */
if (pn_sockaddr_get_object(&sa) == 0) {
struct sock *sk = pn_find_sock_by_res(net, sa.spn_resource);
if (sk)
return sk_receive_skb(sk, skb, 0);
}
/* check if we are the destination */
if (phonet_address_lookup(net, pn_sockaddr_get_addr(&sa)) == 0) {
/* Phonet packet input */
struct sock *sk = pn_find_sock_by_sa(net, &sa);
if (sk)
return sk_receive_skb(sk, skb, 0);
if (can_respond(skb)) {
send_obj_unreachable(skb);
send_reset_indications(skb);
}
} else if (unlikely(skb->pkt_type == PACKET_LOOPBACK))
goto out; /* Race between address deletion and loopback */
else {
/* Phonet packet routing */
struct net_device *out_dev;
out_dev = phonet_route_output(net, pn_sockaddr_get_addr(&sa));
if (!out_dev) {
LIMIT_NETDEBUG(KERN_WARNING"No Phonet route to %02X\n",
pn_sockaddr_get_addr(&sa));
goto out;
}
__skb_push(skb, sizeof(struct phonethdr));
skb->dev = out_dev;
if (out_dev == dev) {
LIMIT_NETDEBUG(KERN_ERR"Phonet loop to %02X on %s\n",
pn_sockaddr_get_addr(&sa), dev->name);
goto out_dev;
}
/* Some drivers (e.g. TUN) do not allocate HW header space */
if (skb_cow_head(skb, out_dev->hard_header_len))
goto out_dev;
if (dev_hard_header(skb, out_dev, ETH_P_PHONET, NULL, NULL,
skb->len) < 0)
goto out_dev;
dev_queue_xmit(skb);
dev_put(out_dev);
return NET_RX_SUCCESS;
out_dev:
dev_put(out_dev);
}
out:
kfree_skb(skb);
return NET_RX_DROP;
}
static struct packet_type phonet_packet_type __read_mostly = {
.type = cpu_to_be16(ETH_P_PHONET),
.func = phonet_rcv,
};
static DEFINE_MUTEX(proto_tab_lock);
int __init_or_module phonet_proto_register(unsigned int protocol,
struct phonet_protocol *pp)
{
int err = 0;
if (protocol >= PHONET_NPROTO)
return -EINVAL;
err = proto_register(pp->prot, 1);
if (err)
return err;
mutex_lock(&proto_tab_lock);
if (proto_tab[protocol])
err = -EBUSY;
else
rcu_assign_pointer(proto_tab[protocol], pp);
mutex_unlock(&proto_tab_lock);
return err;
}
EXPORT_SYMBOL(phonet_proto_register);
void phonet_proto_unregister(unsigned int protocol, struct phonet_protocol *pp)
{
mutex_lock(&proto_tab_lock);
BUG_ON(proto_tab[protocol] != pp);
rcu_assign_pointer(proto_tab[protocol], NULL);
mutex_unlock(&proto_tab_lock);
synchronize_rcu();
proto_unregister(pp->prot);
}
EXPORT_SYMBOL(phonet_proto_unregister);
/* Module registration */
static int __init phonet_init(void)
{
int err;
err = phonet_device_init();
if (err)
return err;
pn_sock_init();
err = sock_register(&phonet_proto_family);
if (err) {
printk(KERN_ALERT
"phonet protocol family initialization failed\n");
goto err_sock;
}
dev_add_pack(&phonet_packet_type);
phonet_sysctl_init();
err = isi_register();
if (err)
goto err;
return 0;
err:
phonet_sysctl_exit();
sock_unregister(PF_PHONET);
dev_remove_pack(&phonet_packet_type);
err_sock:
phonet_device_exit();
return err;
}
static void __exit phonet_exit(void)
{
isi_unregister();
phonet_sysctl_exit();
sock_unregister(PF_PHONET);
dev_remove_pack(&phonet_packet_type);
phonet_device_exit();
}
module_init(phonet_init);
module_exit(phonet_exit);
MODULE_DESCRIPTION("Phonet protocol stack for Linux");
MODULE_LICENSE("GPL");
MODULE_ALIAS_NETPROTO(PF_PHONET);
| {
"pile_set_name": "Github"
} |
{
"ver": "1.2.7",
"uuid": "9380232b-e50f-4f4d-8f32-7353a1df49e5",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
} | {
"pile_set_name": "Github"
} |
56101bf01aea6f0c082b85382be34acada51d70036252581cd76ac4b2bdbc144633b97c63a94bfdba434ffb80884e11299a38853e2d805dc7ce6cf9d452c81c8
| {
"pile_set_name": "Github"
} |
p {
margin: 10px;
}
#presenter-slides {
display: block;
margin-top: -10px;
margin-left: -17px;
position: fixed;
border: 0;
width : 146%;
height: 750px;
transform: scale(0.7, 0.7);
transform-origin: top left;
-moz-transform: scale(0.7);
-moz-transform-origin: top left;
-o-transform: scale(0.7);
-o-transform-origin: top left;
-webkit-transform: scale(0.7);
-webkit-transform-origin: top left;
}
#presenter-notes {
margin-top: -180px;
font-family: 'Open Sans', Arial, sans-serif;
height: 30%;
width: 100%;
overflow: scroll;
position: fixed;
top: 706px;
}
| {
"pile_set_name": "Github"
} |
! fokker_uv.scl
!
Table of Unison Vectors, Microsons and Minisons, from article KNAW, 1969
70
!
4375/4374
2401/2400
420175/419904
2460375/2458624
32805/32768
65625/65536
2100875/2097152
102760448/102515625
6144/6125
3136/3125
10976/10935
225/224
15625/15552
321489/320000
1029/1024
2109375/2097152
2097152/2083725
1728/1715
4000/3969
126/125
245/243
413343/409600
33075/32768
65536/64827
110592/109375
2048/2025
2430/2401
81/80
875/864
531441/524288
1063125/1048576
34034175/33554432
4194304/4134375
2097152/2066715
31104/30625
64/63
686/675
3125/3072
300125/294912
131072/128625
327680/321489
100352/98415
50/49
49/48
234375/229376
535815/524288
1071875/1048576
12288/12005
128/125
2240/2187
5625/5488
525/512
16807/16384
786432/765625
131072/127575
36/35
12005/11664
540225/524288
16128/15625
6272/6075
405/392
1323/1280
42875/41472
648/625
28/27
25/24
21/20
135/128
3584/3375
625/588
| {
"pile_set_name": "Github"
} |
# Magenta NIPS Demo 2016
# Requirements:
# - MaxMSP 7 (MIDI Control)
# - Mira iPad App (iPad UI)
# - Magenta (MIDI Generation)
# - Ableton Live 9 Suite (Sound Generation)
open NIPS_2016_Demo.als
open magenta_mira.maxpat
magenta_midi \
--input_ports="IAC Driver IAC Bus 1" \
--output_ports="IAC Driver IAC Bus 2" \
--passthrough=false \
--qpm=120 \
--allow_overlap=true \
--enable_metronome=false \
--log=DEBUG \
--clock_control_number=1 \
--end_call_control_number=2 \
--min_listen_ticks_control_number=3 \
--max_listen_ticks_control_number=4 \
--response_ticks_control_number=5 \
--temperature_control_number=6 \
--tempo_control_number=7 \
--generator_select_control_number=8 \
--state_control_number=9 \
--loop_control_number=10 \
--panic_control_number=11 \
--mutate_control_number=12 \
--bundle_files=./basic_rnn.mag,./lookback_rnn.mag,./attention_rnn.mag,./rl_rnn.mag,./polyphony_rnn.mag,./pianoroll_rnn_nade.mag \
--playback_offset=-0.035 \
--playback_channel=1&
MAGENTA_PIANO=$!
magenta_midi \
--input_ports="IAC Driver IAC Bus 3" \
--output_ports="IAC Driver IAC Bus 4" \
--passthrough=false \
--qpm=120 \
--allow_overlap=true \
--enable_metronome=false \
--clock_control_number=1 \
--end_call_control_number=2 \
--min_listen_ticks_control_number=3 \
--max_listen_ticks_control_number=4 \
--response_ticks_control_number=5 \
--temperature_control_number=6 \
--tempo_control_number=7 \
--generator_select_control_number=8 \
--state_control_number=9 \
--loop_control_number=10 \
--panic_control_number=11 \
--mutate_control_number=12 \
--bundle_files=./drum_kit_rnn.mag \
--playback_offset=-0.035 \
--playback_channel=2 \
--log=INFO&
MAGENTA_DRUMS=$!
trap "kill ${MAGENTA_PIANO} ${MAGENTA_DRUMS}; exit 1" INT
wait
| {
"pile_set_name": "Github"
} |
import java.util.HashMap;
// 454. 4Sum II
// https://leetcode.com/problems/4sum-ii/description/
// 时间复杂度: O(n^2)
// 空间复杂度: O(n^2)
public class Solution2 {
public int fourSumCount(int[] A, int[] B, int[] C, int[] D) {
if(A == null || B == null || C == null || D == null)
throw new IllegalArgumentException("Illegal argument");
HashMap<Integer, Integer> mapAB = new HashMap<Integer, Integer>();
for(int i = 0 ; i < A.length ; i ++)
for(int j = 0 ; j < B.length ; j ++){
int sum = A[i] + B[j];
if(mapAB.containsKey(sum))
mapAB.put(sum, mapAB.get(sum) + 1);
else
mapAB.put(sum, 1);
}
HashMap<Integer, Integer> mapCD = new HashMap<Integer, Integer>();
for(int i = 0 ; i < C.length ; i ++)
for(int j = 0 ; j < D.length ; j ++){
int sum = C[i] + D[j];
if(mapCD.containsKey(sum))
mapCD.put(sum, mapCD.get(sum) + 1);
else
mapCD.put(sum, 1);
}
int res = 0;
for(Integer sumab: mapAB.keySet()){
if(mapCD.containsKey(-sumab))
res += mapAB.get(sumab) * mapCD.get(-sumab);
}
return res;
}
public static void main(String[] args) {
int[] a = {1, 2};
int[] b = {-2, -1};
int[] c = {-1, 2};
int[] d = {0, 2};
System.out.println((new Solution2()).fourSumCount(a, b, c, d));
}
}
| {
"pile_set_name": "Github"
} |
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxSwift
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/RxSwift
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
| {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jena.sparql.algebra.op;
import org.apache.jena.sparql.algebra.Op ;
import org.apache.jena.sparql.algebra.OpVisitor ;
import org.apache.jena.sparql.algebra.Transform ;
import org.apache.jena.sparql.core.BasicPattern ;
import org.apache.jena.sparql.core.Quad ;
import org.apache.jena.sparql.core.QuadPattern ;
import org.apache.jena.sparql.sse.Tags ;
import org.apache.jena.sparql.util.Iso ;
import org.apache.jena.sparql.util.NodeIsomorphismMap ;
/** Algebra operation for a single quad.
* @see OpTriple
*/
public class OpQuad extends Op0
{
private final Quad quad ;
private OpQuadPattern opQuadPattern = null ;
public OpQuad(Quad quad)
{
this.quad = quad ;
}
public final Quad getQuad() { return quad ; }
public OpQuadPattern asQuadPattern()
{
if ( opQuadPattern == null )
{
BasicPattern bp = new BasicPattern() ;
bp.add(getQuad().asTriple()) ;
opQuadPattern = new OpQuadPattern(quad.getGraph(),bp) ;
}
return opQuadPattern ;
}
@Override
public Op apply(Transform transform)
{ return transform.transform(this) ; }
@Override
public Op0 copy()
{
return new OpQuad(quad) ;
}
@Override
public boolean equalTo(Op other, NodeIsomorphismMap labelMap)
{
if ( ! (other instanceof OpQuad) )
return false ;
OpQuad opQuad = (OpQuad)other ;
return Iso.quadIso(getQuad(), opQuad.getQuad(), labelMap) ;
}
@Override
public int hashCode()
{
return OpBase.HashTriple ^ quad.hashCode() ;
}
@Override
public void visit(OpVisitor opVisitor)
{ opVisitor.visit(this) ; }
@Override
public String getName()
{
return Tags.tagTriple ;
}
public boolean equivalent(OpQuadPattern opQuads)
{
QuadPattern quads = opQuads.getPattern() ;
if ( quads.size() != 1 ) return false ;
Quad q = quads.get(0) ;
return quad.equals(q) ;
}
}
| {
"pile_set_name": "Github"
} |
/* -*- mode: javascript; c-basic-offset: 4; indent-tabs-mode: nil -*- */
//
// Dalliance Genome Explorer
// (c) Thomas Down 2006-2014
//
// export-image.js
//
"use strict";
if (typeof(require) !== 'undefined') {
var browser = require('./cbrowser');
var Browser = browser.Browser;
var g = require('./glyphs');
var OverlayLabelCanvas = g.OverlayLabelCanvas;
var nf = require('./numformats');
var formatQuantLabel = nf.formatQuantLabel;
var formatLongInt = nf.formatLongInt;
var makeElement = require('./utils').makeElement;
var VERSION = require('./version');
var drawSeqTierGC = require('./sequence-draw').drawSeqTierGC;
}
function fillTextRightJustified(g, text, x, y) {
g.fillText(text, x - g.measureText(text).width, y);
}
Browser.prototype.exportImage = function(opts) {
opts = opts || {};
var fpw = opts.width || this.featurePanelWidth;
var padding = 3;
var ypos = 0;
if (opts.banner || opts.region) {
ypos = 40;
}
var backupFPW = this.featurePanelWidth;
var backupScale = this.scale;
this.featurePanelWidth = fpw;
this.scale = this.featurePanelWidth / (this.viewEnd - this.viewStart);
var totHeight = ypos;
for (var ti = 0; ti < this.tiers.length; ++ti) {
if (ti > 0)
totHeight += padding;
var tier = this.tiers[ti];
tier.backupSubtiers = tier.subtiers;
tier.backupOriginHaxx = tier.originHaxx;
tier.backupLayoutHeight = tier.layoutHeight;
if (tier.subtiers) {
const renderer = this.getTierRenderer(tier);
if (renderer && renderer.prepareSubtiers) {
renderer.prepareSubtiers(tier, tier.viewport.getContext('2d'));
}
if (tier.subtiers) {
var lh = tier.padding;
for (var s = 0; s < tier.subtiers.length; ++s) {
lh = lh + tier.subtiers[s].height + tier.padding;
}
lh += 6
tier.layoutHeight = Math.max(lh, this.minTierHeight);
}
}
if (tier.layoutHeight !== undefined)
totHeight += tier.layoutHeight;
}
var mult = opts.resolutionMultiplier || 1.0;
var font = '10px sans-serif';
var margin = 200;
{
var tmpCanvas = makeElement('canvas', null, 1, 1);
var tmpG = tmpCanvas.getContext('2d');
tmpG.font = font;
for (var ti = 0; ti < this.tiers.length; ++ti) {
var tier = this.tiers[ti];
var labelName;
if (typeof tier.config.name === 'string')
labelName = tier.config.name;
else
labelName = tier.dasSource.name;
var labelWidth = tmpG.measureText(labelName).width;
labelWidth += 32;
if (labelWidth > margin)
margin = labelWidth;
}
}
var cw = ((fpw + margin) * mult)|0;
var ch = (totHeight * mult)|0;
var c = makeElement('canvas', null, {width: cw, height: ch});
var g = c.getContext('2d');
g.fillStyle = 'white';
g.fillRect(0, 0, cw, ch);
g.scale(mult, mult);
if (opts.region) {
g.save();
g.fillStyle = 'black';
g.font = '12pt sans-serif';
g.fillText(
this.chr + ':' + formatLongInt(this.viewStart) + '..' + formatLongInt(this.viewEnd),
margin + 100,
28
);
g.restore();
}
if (opts.banner) {
g.save();
g.fillStyle = 'black';
g.font = '12pt sans-serif';
fillTextRightJustified(g, 'Graphics from Biodalliance ' + VERSION, margin + fpw - 100, 28);
g.restore();
}
g.font = font;
for (var ti = 0; ti < this.tiers.length; ++ti) {
var tier = this.tiers[ti];
var offset = ((tier.glyphCacheOrigin - this.viewStart)*this.scale);
var oc = new OverlayLabelCanvas();
g.save(); // 1
g.translate(0, ypos);
g.save(); // 2
g.beginPath();
g.moveTo(margin, 0);
g.lineTo(margin + fpw, 0);
g.lineTo(margin + fpw, tier.layoutHeight);
g.lineTo(margin, tier.layoutHeight);
g.closePath();
g.clip();
g.translate(margin, 0);
g.save(); // 3
g.translate(offset, 0);
if (tier.subtiers) {
tier.paintToContext(g, oc, offset + 1000);
} else {
drawSeqTierGC(tier, tier.currentSequence, g);
}
g.restore(); // 2
g.save() // 3
g.translate(offset, 0);
oc.draw(g, -offset, fpw - offset);
g.restore(); // 2
g.restore(); // 1
var hasQuant = false;
var pos = 0;
var subtiers = tier.subtiers || [];
for (var sti = 0; sti < subtiers.length; ++sti) {
var subtier = subtiers[sti];
if (subtier.quant) {
hasQuant = true;
var q = subtier.quant;
var h = subtier.height;
var numTics = 2;
if (h > 40) {
numTics = 1 + ((h/20) | 0);
}
var ticSpacing = h / (numTics - 1);
var ticInterval = (q.max - q.min) / (numTics - 1);
g.beginPath();
g.moveTo(margin + 5, pos);
g.lineTo(margin, pos);
g.lineTo(margin, pos + subtier.height);
g.lineTo(margin + 5, pos + subtier.height);
for (var t = 1; t < numTics-1; ++t) {
var ty = t*ticSpacing;
g.moveTo(margin, pos + ty);
g.lineTo(margin+3, pos + ty);
}
g.strokeStyle = 'black';
g.strokeWidth = 2;
g.stroke();
g.fillStyle = 'black';
fillTextRightJustified(g, formatQuantLabel(q.max), margin - 3, pos + 7);
fillTextRightJustified(g, formatQuantLabel(q.min), margin - 3, pos + subtier.height);
for (var t = 1; t < numTics-1; ++t) {
var ty = t*ticSpacing;
fillTextRightJustified(g, formatQuantLabel((1.0*q.max) - (t*ticInterval)), margin - 3, pos + ty + 3);
}
}
pos += subtier.height + padding;
}
var labelName;
if (typeof tier.config.name === 'string')
labelName = tier.config.name;
else
labelName = tier.dasSource.name;
var labelWidth = g.measureText(labelName).width;
g.fillStyle = 'black';
g.fillText(labelName, margin - (hasQuant ? 28 : 12) - labelWidth, (tier.layoutHeight + 3) / 2);
g.restore(); // 0
ypos += tier.layoutHeight + padding;
tier.subtiers = tier.backupSubtiers;
tier.originHaxx = tier.backupOriginHaxx;
tier.layoutHeight = tier.backupLayoutHeight;
}
if (opts.highlights) {
g.save();
g.beginPath();
g.moveTo(margin, 0);
g.lineTo(margin + fpw, 0);
g.lineTo(margin + fpw, ypos);
g.lineTo(margin, ypos);
g.closePath();
g.clip();
g.translate(margin + offset, 0);
var origin = this.viewStart;
var visStart = this.viewStart;
var visEnd = this.viewEnd;
for (var hi = 0; hi < this.highlights.length; ++hi) {
var h = this.highlights[hi];
if (((h.chr === this.chr) || (h.chr === ('chr' + this.chr))) && h.min < visEnd && h.max > visStart) {
g.globalAlpha = this.defaultHighlightAlpha;
g.fillStyle = this.defaultHighlightFill;
g.fillRect((h.min - origin) * this.scale,
0,
(h.max - h.min) * this.scale,
ypos);
}
}
g.restore();
}
var rulerPos = -1;
if (opts.ruler == 'center') {
rulerPos = margin + ((this.viewEnd - this.viewStart + 1)*this.scale) / 2;
} else if (opts.ruler == 'left') {
rulerPos = margin;
} else if (opts.ruler == 'right') {
rulerPos = margin + ((this.viewEnd - this.viewStart + 1)*this.scale);
}
if (rulerPos >= 0) {
g.strokeStyle = 'blue';
g.beginPath();
g.moveTo(rulerPos, 0);
g.lineTo(rulerPos, ypos);
g.stroke();
}
this.featurePanelWidth = backupFPW;
this.scale = backupScale;
if (opts.blobCallback) {
return c.toBlob(opts.blobCallback, 'image/png');
} else {
return c.toDataURL('image/png');
}
}
| {
"pile_set_name": "Github"
} |
{
"tables": [
{
"name": "PrimaryResult",
"columns": [
{
"name": "TimeGenerated",
"type": "datetime"
},
{
"name": "ObjectName",
"type": "string"
},
{
"name": "avg_CounterValue",
"type": "real"
}
],
"rows": [
[
"2020-04-20T21:40:00Z",
"Processor",
0.75
],
[
"2020-04-20T21:40:00Z",
"Logical Disk",
16090.551851851851
],
[
"2020-04-20T21:40:00Z",
"Memory",
702.0666666666667
],
[
"2020-04-20T21:45:00Z",
"Memory",
700.5888888888888
],
[
"2020-04-20T21:45:00Z",
"Processor",
1.0055555555555555
],
[
"2020-04-20T21:45:00Z",
"Logical Disk",
16090.537037037036
],
[
"2020-04-20T21:50:00Z",
"Logical Disk",
16090.586419753086
],
[
"2020-04-20T21:50:00Z",
"Processor",
0.7407407407407407
],
[
"2020-04-20T21:50:00Z",
"Memory",
703.1111111111111
]
]
}
]
}
| {
"pile_set_name": "Github"
} |
#!/bin/bash
#
# Perform quick BAT test on VC tools
readonly OUTPUT_MACRO=(
"Board Power" "12V Backplane Current" "12V Backplane Voltage"
"1.2V Voltage" "1.8V Voltage" "3.3V Voltage" "FPGA Core Voltage"
"FPGA Core Current" "FPGA Die Temperature" "Board Temperature"
"QSFP0 Supply Voltage" "QSFP0 Temperature" "12V AUX Current"
"12V AUX Voltage" "QSFP1 Supply Voltage" "QSFP1 Temperature"
"PKVL0 Core Temperature" "PKVL0 SerDes Temperature"
"PKVL1 Core Temperature" "PKVL1 SerDes Temperature"
)
################################################
# Check fpgainfo argment to parse/compare output
# Globals:
# parse_ec
# Arguments:
# fpgainfo cmd
# fpgainfo cmd output
# Returns:
# None
################################################
# TODO(jelonanx): Refactor output parsing
parse_fpgainfo_output() {
case $1 in
*"bmc"*)
if [[ $2 =~ ${OUTPUT_MACRO[0]} && $2 =~ ${OUTPUT_MACRO[1]} &&
$2 =~ ${OUTPUT_MACRO[2]} && $2 =~ ${OUTPUT_MACRO[3]} &&
$2 =~ ${OUTPUT_MACRO[4]} && $2 =~ ${OUTPUT_MACRO[5]} &&
$2 =~ ${OUTPUT_MACRO[6]} && $2 =~ ${OUTPUT_MACRO[7]} &&
$2 =~ ${OUTPUT_MACRO[8]} && $2 =~ ${OUTPUT_MACRO[9]} &&
$2 =~ ${OUTPUT_MACRO[10]} && $2 =~ ${OUTPUT_MACRO[11]} &&
$2 =~ ${OUTPUT_MACRO[12]} && $2 =~ ${OUTPUT_MACRO[13]} &&
$2 =~ ${OUTPUT_MACRO[14]} && $2 =~ ${OUTPUT_MACRO[15]} &&
$2 =~ ${OUTPUT_MACRO[16]} && $2 =~ ${OUTPUT_MACRO[17]} &&
$2 =~ ${OUTPUT_MACRO[18]} && $2 =~ ${OUTPUT_MACRO[19]} ]]; then
parse_ec=0
else
parse_ec=1
fi
;;
*"temp"*)
if [[ $2 =~ ${OUTPUT_MACRO[8]} && $2 =~ ${OUTPUT_MACRO[9]} &&
$2 =~ ${OUTPUT_MACRO[11]} && $2 =~ ${OUTPUT_MACRO[15]} &&
$2 =~ ${OUTPUT_MACRO[16]} && $2 =~ ${OUTPUT_MACRO[17]} &&
$2 =~ ${OUTPUT_MACRO[18]} && $2 =~ ${OUTPUT_MACRO[19]} ]]; then
parse_ec=0
else
parse_ec=1
fi
;;
*"power"*)
if [[ $2 =~ ${OUTPUT_MACRO[0]} && $2 =~ ${OUTPUT_MACRO[1]} &&
$2 =~ ${OUTPUT_MACRO[2]} && $2 =~ ${OUTPUT_MACRO[3]} &&
$2 =~ ${OUTPUT_MACRO[4]} && $2 =~ ${OUTPUT_MACRO[5]} &&
$2 =~ ${OUTPUT_MACRO[6]} && $2 =~ ${OUTPUT_MACRO[7]} &&
$2 =~ ${OUTPUT_MACRO[10]} && $2 =~ ${OUTPUT_MACRO[12]} &&
$2 =~ ${OUTPUT_MACRO[13]} && $2 =~ ${OUTPUT_MACRO[14]} ]]; then
parse_ec=0
else
parse_ec=1
fi
;;
*"phy"*)
if [[ $2 =~ "PHY GROUP 0" && $2 =~ "PHY GROUP 1" &&
$2 =~ "Intel C827 Retimer" &&
$2 =~ "Port0" && $2 =~ "Port1" ]]; then
parse_ec=0
else
parse_ec=1
fi
;;
*"errors"*)
if [[ $2 =~ "Errors" && $2 =~ "Next Error" && $2 =~ "First Error" &&
$2 =~ "PCIe0 Errors" && $2 =~ "Inject Error" &&
$2 =~ "Catfatal Errors" && $2 =~ "Nonfatal Errors" &&
$2 =~ "PCIe1 Errors" ]]; then
parse_ec=0
else
parse_ec=1
fi
;;
*"mac"*)
if [[ $2 =~ "Number of MACs" && $2 =~ "MAC address 0" &&
$2 =~ "MAC address 1" && $2 =~ "MAC address 2" &&
$2 =~ "MAC address 3" && $2 =~ "MAC address 4" &&
$2 =~ "MAC address 5" && $2 =~ "MAC address 6" &&
$2 =~ "MAC address 7" ]]; then
parse_ec=0
else
parse_ec=1
fi
;;
*"fme"*|*"port"*)
parse_ec=0
;;
*)
echo "Invalid fpgainfo argument."
parse_ec=1
;;
esac
}
found=$(ls /dev/intel-* | wc -l)
if [[ $found -lt 1 ]]; then
echo "Failed to locate drivers."
exit 1
fi
found=$(lspci | grep 0b30)
if [ "$1" != "" ]; then
bus_num=$1
if [[ $found != *"$bus_num"* ]]; then
echo "Invalid bus number param: "$bus_num
exit 1
fi
else
bus_num=${found:0:2}
if [[ $((16#$bus_num)) -lt 0 ]]; then
echo "Invalid bus number: "$bus_num
exit 1
fi
fi
tool_tests=(
"fpgainfo errors all -B 0x$bus_num"
"fpgainfo fme -B 0x$bus_num"
"fpgainfo port -B 0x$bus_num"
"fpgainfo mac -B 0x$bus_num"
"fpgainfo phy -B 0x$bus_num"
"fpgainfo temp -B 0x$bus_num"
"fpgainfo bmc -B 0x$bus_num"
"fpgainfo power -B 0x$bus_num"
"fpgalpbk -G 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --side=line --direction=local --enable"
"fpgalpbk -G 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --side=line --direction=local --disable"
"fpgalpbk -G 9AEFFE5F-8457-0612-C000-C9660D824272 -I 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --side=line --direction=local --enable"
"fpgalpbk -G 9AEFFE5F-8457-0612-C000-C9660D824272 -I 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --side=line --direction=local --disable"
"fpgalpbk -G 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --side=host --direction=remote --enable"
"fpgalpbk -G 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --side=host --direction=remote --disable"
"fpga_dma_vc_test 0 -B 0x$bus_num -G 9AEFFE5F-8457-0612-C000-C9660D824272 -D 0 -S 0x100000000"
"fpga_dma_vc_test 0 -B 0x$bus_num -G 9AEFFE5F-8457-0612-C000-C9660D824272 -D 1 -S 0x100000000"
"fpga_dma_vc_test 0 -B 0x$bus_num -G 9AEFFE5F-8457-0612-C000-C9660D824272 -D 2 -S 0x40000000"
"fpga_dma_vc_test 0 -B 0x$bus_num -G 9AEFFE5F-8457-0612-C000-C9660D824272 -D 3 -S 0x1000000"
"nlb0 --guid 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --multi-cl=4 --begin=1024 --end=1024 --timeout-sec=1 --cont"
"nlb0 --guid 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num"
"nlb0 --guid 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --cont"
"nlb0 --guid 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --begin 10 --end 1000"
"nlb0 --guid 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --begin 10 --end 100 --suppress-hdr -V"
"nlb0 --guid 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --begin 10 --end 100 --suppress-stats -V"
"nlb0 --guid 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --multi-cl 2 --begin 10 --end 1000"
"nlb0 --guid 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --begin 2050 --cont --timeout-sec 5"
"nlb0 -V --guid 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --begin=57535 --end=65535 --cache-hint=rdline-I --cache-policy=wrpush-I --write-vc=vl0 --read-vc=vh1 --wrfence-vc=random"
"nlb0 -V --guid 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num --begin=57532 --end=65532 --multi-cl 4 --cache-hint=rdline-I --cache-policy=wrline-I --write-vc=vh0 --read-vc=vl0 --wrfence-vc=auto"
"fpgastats --guid 9AEFFE5F-8457-0612-C000-C9660D824272 -B 0x$bus_num"
"mactest -B 0x$bus_num"
"mactest -B 0x$bus_num --offset=0x100"
)
num_tests_passed=0
num_tests_failed=0
declare -a failed_tests=()
for tool_test in "${tool_tests[@]}"; do
echo "Executing Test: \"${tool_test}\""
eval output=\`$tool_test\`
ec=$?
echo "$output"
echo "Exit Code: $ec"
parse_ec=0
if [[ ${tool_test} == "fpgainfo"* && ${output} == *"0x0B3"* ]]; then
parse_fpgainfo_output "$tool_test" "${output}"
fi
if [[ $ec == 0 && $parse_ec == 0 ]]; then
num_tests_passed=$((num_tests_passed + 1))
else
num_tests_failed=$((num_tests_failed + 1))
failed_tests+=("$tool_test")
fi
done
echo -e "\nTest Summary"
echo "Tests Passed: $num_tests_passed"
echo "Tests Failed: $num_tests_failed"
if [ -n "$failed_tests" ]; then
echo "The following test(s) Failed:"
for tests in "${failed_tests[@]}"; do
echo "$tests"
done
fi
exit $num_tests_failed
| {
"pile_set_name": "Github"
} |
// MESSAGE PARAM_REQUEST_READ PACKING
#define MAVLINK_MSG_ID_PARAM_REQUEST_READ 20
typedef struct __mavlink_param_request_read_t
{
int16_t param_index; ///< Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
uint8_t target_system; ///< System ID
uint8_t target_component; ///< Component ID
char param_id[16]; ///< Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
} mavlink_param_request_read_t;
#define MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN 20
#define MAVLINK_MSG_ID_20_LEN 20
#define MAVLINK_MSG_PARAM_REQUEST_READ_FIELD_PARAM_ID_LEN 16
#define MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ { \
"PARAM_REQUEST_READ", \
4, \
{ { "param_index", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_param_request_read_t, param_index) }, \
{ "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_param_request_read_t, target_system) }, \
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_param_request_read_t, target_component) }, \
{ "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 4, offsetof(mavlink_param_request_read_t, param_id) }, \
} \
}
/**
* @brief Pack a param_request_read message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param target_system System ID
* @param target_component Component ID
* @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
* @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_param_request_read_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[20];
_mav_put_int16_t(buf, 0, param_index);
_mav_put_uint8_t(buf, 2, target_system);
_mav_put_uint8_t(buf, 3, target_component);
_mav_put_char_array(buf, 4, param_id, 16);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 20);
#else
mavlink_param_request_read_t packet;
packet.param_index = param_index;
packet.target_system = target_system;
packet.target_component = target_component;
mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 20);
#endif
msg->msgid = MAVLINK_MSG_ID_PARAM_REQUEST_READ;
return mavlink_finalize_message(msg, system_id, component_id, 20, 214);
}
/**
* @brief Pack a param_request_read message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message was sent over
* @param msg The MAVLink message to compress the data into
* @param target_system System ID
* @param target_component Component ID
* @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
* @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_param_request_read_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t target_system,uint8_t target_component,const char *param_id,int16_t param_index)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[20];
_mav_put_int16_t(buf, 0, param_index);
_mav_put_uint8_t(buf, 2, target_system);
_mav_put_uint8_t(buf, 3, target_component);
_mav_put_char_array(buf, 4, param_id, 16);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 20);
#else
mavlink_param_request_read_t packet;
packet.param_index = param_index;
packet.target_system = target_system;
packet.target_component = target_component;
mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 20);
#endif
msg->msgid = MAVLINK_MSG_ID_PARAM_REQUEST_READ;
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 20, 214);
}
/**
* @brief Encode a param_request_read struct into a message
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param param_request_read C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_param_request_read_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_param_request_read_t* param_request_read)
{
return mavlink_msg_param_request_read_pack(system_id, component_id, msg, param_request_read->target_system, param_request_read->target_component, param_request_read->param_id, param_request_read->param_index);
}
/**
* @brief Send a param_request_read message
* @param chan MAVLink channel to send the message
*
* @param target_system System ID
* @param target_component Component ID
* @param param_id Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
* @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_param_request_read_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[20];
_mav_put_int16_t(buf, 0, param_index);
_mav_put_uint8_t(buf, 2, target_system);
_mav_put_uint8_t(buf, 3, target_component);
_mav_put_char_array(buf, 4, param_id, 16);
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, buf, 20, 214);
#else
mavlink_param_request_read_t packet;
packet.param_index = param_index;
packet.target_system = target_system;
packet.target_component = target_component;
mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, (const char *)&packet, 20, 214);
#endif
}
#endif
// MESSAGE PARAM_REQUEST_READ UNPACKING
/**
* @brief Get field target_system from param_request_read message
*
* @return System ID
*/
static inline uint8_t mavlink_msg_param_request_read_get_target_system(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 2);
}
/**
* @brief Get field target_component from param_request_read message
*
* @return Component ID
*/
static inline uint8_t mavlink_msg_param_request_read_get_target_component(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 3);
}
/**
* @brief Get field param_id from param_request_read message
*
* @return Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string
*/
static inline uint16_t mavlink_msg_param_request_read_get_param_id(const mavlink_message_t* msg, char *param_id)
{
return _MAV_RETURN_char_array(msg, param_id, 16, 4);
}
/**
* @brief Get field param_index from param_request_read message
*
* @return Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
*/
static inline int16_t mavlink_msg_param_request_read_get_param_index(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 0);
}
/**
* @brief Decode a param_request_read message into a struct
*
* @param msg The message to decode
* @param param_request_read C-struct to decode the message contents into
*/
static inline void mavlink_msg_param_request_read_decode(const mavlink_message_t* msg, mavlink_param_request_read_t* param_request_read)
{
#if MAVLINK_NEED_BYTE_SWAP
param_request_read->param_index = mavlink_msg_param_request_read_get_param_index(msg);
param_request_read->target_system = mavlink_msg_param_request_read_get_target_system(msg);
param_request_read->target_component = mavlink_msg_param_request_read_get_target_component(msg);
mavlink_msg_param_request_read_get_param_id(msg, param_request_read->param_id);
#else
memcpy(param_request_read, _MAV_PAYLOAD(msg), 20);
#endif
}
| {
"pile_set_name": "Github"
} |
/*
* Created by SharpDevelop.
* User: Alexander Petrovskiy
* Date: 12.12.2011
* Time: 12:34
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
namespace UIAutomationTestForms
{
using System;
using System.Windows.Forms;
using System.Collections;
/// <summary>
/// Description of WinFormsForm.
/// </summary>
public partial class WinFormsForm : Form
{
// public WinFormsForm()
// {
// // // The InitializeComponent() call is required for Windows Forms designer support.
// // InitializeComponent();
//
// // // TODO: Add constructor code after the InitializeComponent() call.
// //
// }
protected WinFormsForm(
string formName,
string formTitle,
System.Windows.Automation.ControlType controlType,
int controlDelay)
{
ControlType = controlType;
ControlDelay = controlDelay;
FormName = formName;
FormTitle = formTitle;
if (FormName == "WinFormsNoTaskBar") {
FormBorderStyle = FormBorderStyle.FixedToolWindow;
this.Visible = false;
AllowTransparency = true;
ControlBox = false;
ShowIcon = false;
ShowInTaskbar = false;
}
//this.ChildForm = this;
// // The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
// // TODO: Add constructor code after the InitializeComponent() call.
//
}
protected WinFormsForm(
string formName,
string formTitle,
System.Windows.Automation.ControlType controlType,
string controlName,
string controlAutomationId,
int controlDelay)
{
ControlType = controlType;
ControlDelay = controlDelay;
ControlName = controlName;
ControlAutomationId = controlAutomationId;
FormName = formName;
FormTitle = formTitle;
if (FormName == "WinFormsNoTaskBar") {
FormBorderStyle = FormBorderStyle.FixedToolWindow;
this.Visible = false;
AllowTransparency = true;
ControlBox = false;
ShowIcon = false;
ShowInTaskbar = false;
}
//this.ChildForm = this;
// // The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
// // TODO: Add constructor code after the InitializeComponent() call.
//
}
protected WinFormsForm(
string formName,
string formTitle,
ControlToForm[] controlToForm)
{
// this.ControlType = controlType;
// this.ControlDelay = controlDelay;
// this.ControlName = controlName;
// this.ControlAutomationId = controlAutomationId;
controlsArray = controlToForm;
FormName = formName;
FormTitle = formTitle;
if (FormName == "WinFormsNoTaskBar") {
FormBorderStyle = FormBorderStyle.FixedToolWindow;
this.Visible = false;
AllowTransparency = true;
ControlBox = false;
ShowIcon = false;
ShowInTaskbar = false;
}
//this.ChildForm = this;
// // The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
// // TODO: Add constructor code after the InitializeComponent() call.
//
}
private ControlToForm[] controlsArray { get; set; }
protected System.Windows.Automation.ControlType ControlType;
protected int ControlDelay;
protected Form ChildForm;
protected string ControlName;
protected string ControlAutomationId;
string FormName;
string FormTitle;
void WinFormsFormShown(object sender, EventArgs e)
{
if ((null == ControlType) &&
(null == controlsArray ||
controlsArray.Length == 0)) {
return;
}
ControlToForm[] arr;
if (null == controlsArray &&
null != ControlType) {
var ctf = new ControlToForm();
ctf.ControlType = ControlType;
ctf.ControlName = ControlName;
ctf.ControlAutomationId = ControlAutomationId;
ctf.ControlDelayEn = ControlDelay;
var arrList = new ArrayList();
arrList.Add(ctf);
arr = (ControlToForm[])arrList.ToArray(typeof(ControlToForm));
} else {
arr = controlsArray;
}
for (int i = 0; i < arr.Length; i++) {
string _controlType = arr[i].ControlType.ProgrammaticName.Substring(
arr[i].ControlType.ProgrammaticName.IndexOf(".") + 1);
arr[i].ControlTypeAsString = _controlType;
switch (_controlType) {
case "Button":
var b = new Button();
loadControl(b, arr[i]);
break;
case "MonthCalendar":
case "Calendar":
var mc = new MonthCalendar();
loadControl(mc, arr[i]);
break;
case "CheckBox":
var chk = new CheckBox();
loadControl(chk, arr[i]);
break;
case "ComboBox":
var cmb = new ComboBox();
loadControl(cmb, arr[i]);
break;
case "GroupBox":
case "Group":
var gb = new GroupBox();
loadControl(gb, arr[i]);
break;
case "Label":
case "Text":
var l = new Label();
loadControl(l, arr[i]);
break;
case "ListBox":
case "List":
var lb = new ListBox();
loadControl(lb, arr[i]);
break;
case "ListView":
//case "Table":
var lv = new ListView();
loadControl(lv, arr[i]);
break;
case "MenuBar":
var ms = new MenuStrip();
loadControl(ms, arr[i]);
break;
case "ProgressBar":
var pb = new ProgressBar();
loadControl(pb, arr[i]);
break;
case "RadioButton":
var rb = new RadioButton();
loadControl(rb, arr[i]);
break;
case "RichTextBox":
case "Document":
var rtb = new RichTextBox();
loadControl(rtb, arr[i]);
break;
case "StatusBar":
var sb = new StatusBar();
loadControl(sb, arr[i]);
break;
case "Table":
var pg = new PropertyGrid();
loadControl(pg, arr[i]);
break;
case "TextBox":
case "Edit":
var tb = new TextBox();
loadControl(tb, arr[i]);
break;
case "TreeView":
case "Tree":
var tv = new TreeView();
loadControl(tv, arr[i]);
break;
default:
//System.Windows.Forms.DataGridTextBox
//System.Windows.Forms.DataGridView
//System.Windows.Forms.GridItem
//System.Windows.Forms.DomainUpDown
//System.Windows.Forms.RichTextBox
//System.Windows.Automation.ControlType.Document
break;
} // switch (_controlType)
Application.DoEvents();
} // for (int i = 0; i < arr.Length; i++)
//Application.DoEvents();
}
private void loadControl<T>(T control, string _controlType)
{
try {
(control as Control).GetType()
.GetProperty("Text")
.SetValue(control, ControlName != string.Empty ? ControlName : _controlType, null);
/*
if (this.ControlName != string.Empty){
(control as System.Windows.Forms.Control).GetType().GetProperty("Text").SetValue(control, this.ControlName, null);
} else {
(control as System.Windows.Forms.Control).GetType().GetProperty("Text").SetValue(control, _controlType, null);
}
*/
(control as Control).GetType()
.GetProperty("Name")
.SetValue(control,
ControlAutomationId != string.Empty ? ControlAutomationId : _controlType, null);
/*
if (this.ControlAutomationId != string.Empty){
(control as System.Windows.Forms.Control).GetType().GetProperty("Name").SetValue(control, this.ControlAutomationId, null);
} else {
(control as System.Windows.Forms.Control).GetType().GetProperty("Name").SetValue(control, _controlType, null);
}
*/
(control as Control).Visible = false;
var r = new Random();
(control as Control).Left =
r.Next(0, this.Width - 20);
(control as Control).Top =
r.Next(0, this.Height - 20);
ChildForm.Controls.Add(control as Control);
var showControlDelegate = new ShowControl(runTimeout);
showControlDelegate(ControlDelay, control as Control);
} catch {
}
}
private void loadControl<T>(T control, ControlToForm controlToForm)
{
try {
// if (this.ControlName != string.Empty){
// (control as System.Windows.Forms.Control).GetType().GetProperty("Text").SetValue(control, this.ControlName, null);
// } else {
// (control as System.Windows.Forms.Control).GetType().GetProperty("Text").SetValue(control, _controlType, null);
// }
(control as Control).GetType()
.GetProperty("Text")
.SetValue(control,
controlToForm.ControlName != string.Empty
? controlToForm.ControlName
: controlToForm.ControlTypeAsString, null);
/*
if (controlToForm.ControlName != string.Empty){
(control as System.Windows.Forms.Control).GetType().GetProperty("Text").SetValue(control, controlToForm.ControlName, null);
} else {
(control as System.Windows.Forms.Control).GetType().GetProperty("Text").SetValue(control, controlToForm.ControlTypeAsString, null);
}
*/
// if (this.ControlAutomationId != string.Empty){
// (control as System.Windows.Forms.Control).GetType().GetProperty("Name").SetValue(control, this.ControlAutomationId, null);
// } else {
// (control as System.Windows.Forms.Control).GetType().GetProperty("Name").SetValue(control, _controlType, null);
// }
(control as Control).GetType()
.GetProperty("Name")
.SetValue(control,
controlToForm.ControlAutomationId != string.Empty
? controlToForm.ControlAutomationId
: controlToForm.ControlTypeAsString, null);
/*
if (controlToForm.ControlAutomationId != string.Empty) {
(control as System.Windows.Forms.Control).GetType().GetProperty("Name").SetValue(control, controlToForm.ControlAutomationId, null);
} else {
(control as System.Windows.Forms.Control).GetType().GetProperty("Name").SetValue(control, controlToForm.ControlTypeAsString, null);
}
*/
(control as Control).Visible = false;
var r = new Random();
(control as Control).Left =
// 20130110
//r.Next(0, this.Width - 20);
r.Next(0, this.Width - 50);
(control as Control).Top =
// 20130110
//r.Next(0, this.Height - 20);
r.Next(0, this.Height - 50);
// this.Controls.Add(b);
ChildForm.Controls.Add(control as Control);
var showControlDelegate = new ShowControl(runTimeout);
// WriteVerbose(this, "runScriptBlocks 5 fired");
//showControlDelegate(this.ControlDelay, control as System.Windows.Forms.Control);
showControlDelegate(controlToForm.ControlDelayEn, control as Control);
} catch {
}
}
private void runTimeout(int timeout, Control control)
{
System.Threading.Thread.Sleep(timeout);
control.Visible = true;
}
}
delegate void ShowControl(int timeout, Control control);
}
| {
"pile_set_name": "Github"
} |
// Copyright © 2008-2020 Pioneer Developers. See AUTHORS.txt for details
// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
#include "CargoBody.h"
#include "LuaObject.h"
#include "LuaUtils.h"
/*
* Class: CargoBody
*
* Class representing an item of cargo floating in space. Inherits from
* <ModelBody>.
*/
/*
* Attribute: type
*
* The type of cargo contained within this cargo body, as a
* <Constants.CommodityType> constant.
*
* Availability:
*
* alpha 10
*
* Status:
*
* experimental
*/
template <>
const char *LuaObject<CargoBody>::s_type = "CargoBody";
template <>
void LuaObject<CargoBody>::RegisterClass()
{
const char *l_parent = "ModelBody";
LuaObjectBase::CreateClass(s_type, l_parent, 0, 0, 0);
LuaObjectBase::RegisterPromotion(l_parent, s_type, LuaObject<CargoBody>::DynamicCastPromotionTest);
}
| {
"pile_set_name": "Github"
} |
import React from 'react';
import PropTypes from 'prop-types';
import { withTranslation } from 'react-i18next';
import { withUnstatedContainers } from '../UnstatedUtils';
import PageContainer from '../../services/PageContainer';
function RenderTagLabels(props) {
const { t, tags, pageContainer } = props;
const { pageId } = pageContainer;
function openEditorHandler() {
if (props.openEditorModal == null) {
return;
}
props.openEditorModal();
}
// activate suspense
if (tags == null) {
throw new Promise(() => {});
}
const isTagsEmpty = tags.length === 0;
const tagElements = tags.map((tag) => {
return (
<a key={`${pageId}_${tag}`} href={`/_search?q=tag:${tag}`} className="grw-tag-label badge badge-secondary mr-2">
{tag}
</a>
);
});
return (
<>
{tagElements}
<a className={`btn btn-link btn-edit-tags p-0 text-muted ${isTagsEmpty ? 'no-tags' : ''}`} onClick={openEditorHandler}>
{ isTagsEmpty
? (
<>{ t('Add tags for this page') }<i className="ml-1 icon-plus"></i></>
)
: (
<i className="icon-plus"></i>
)
}
</a>
</>
);
}
/**
* Wrapper component for using unstated
*/
const RenderTagLabelsWrapper = withUnstatedContainers(RenderTagLabels, [PageContainer]);
RenderTagLabels.propTypes = {
t: PropTypes.func.isRequired, // i18next
tags: PropTypes.array,
openEditorModal: PropTypes.func,
pageContainer: PropTypes.instanceOf(PageContainer).isRequired,
};
export default withTranslation()(RenderTagLabelsWrapper);
| {
"pile_set_name": "Github"
} |
/**
* selectize.bootstrap2.css (v0.12.1) - Bootstrap 2 Theme
* Copyright (c) 2013–2015 Brian Reavis & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
* @author Brian Reavis <[email protected]>
*/
.selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder {
visibility: visible !important;
background: #f2f2f2 !important;
background: rgba(0, 0, 0, 0.06) !important;
border: 0 none !important;
-webkit-box-shadow: inset 0 0 12px 4px #ffffff;
box-shadow: inset 0 0 12px 4px #ffffff;
}
.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after {
content: '!';
visibility: hidden;
}
.selectize-control.plugin-drag_drop .ui-sortable-helper {
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.selectize-dropdown-header {
position: relative;
padding: 3px 10px;
border-bottom: 1px solid #d0d0d0;
background: #f8f8f8;
-webkit-border-radius: 4px 4px 0 0;
-moz-border-radius: 4px 4px 0 0;
border-radius: 4px 4px 0 0;
}
.selectize-dropdown-header-close {
position: absolute;
right: 10px;
top: 50%;
color: #333333;
opacity: 0.4;
margin-top: -12px;
line-height: 20px;
font-size: 20px !important;
}
.selectize-dropdown-header-close:hover {
color: #000000;
}
.selectize-dropdown.plugin-optgroup_columns .optgroup {
border-right: 1px solid #f2f2f2;
border-top: 0 none;
float: left;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child {
border-right: 0 none;
}
.selectize-dropdown.plugin-optgroup_columns .optgroup:before {
display: none;
}
.selectize-dropdown.plugin-optgroup_columns .optgroup-header {
border-top: 0 none;
}
.selectize-control.plugin-remove_button [data-value] {
position: relative;
padding-right: 24px !important;
}
.selectize-control.plugin-remove_button [data-value] .remove {
z-index: 1;
/* fixes ie bug (see #392) */
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 17px;
text-align: center;
font-weight: bold;
font-size: 12px;
color: inherit;
text-decoration: none;
vertical-align: middle;
display: inline-block;
padding: 1px 0 0 0;
border-left: 1px solid #cccccc;
-webkit-border-radius: 0 2px 2px 0;
-moz-border-radius: 0 2px 2px 0;
border-radius: 0 2px 2px 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.selectize-control.plugin-remove_button [data-value] .remove:hover {
background: rgba(0, 0, 0, 0.05);
}
.selectize-control.plugin-remove_button [data-value].active .remove {
border-left-color: #0077b3;
}
.selectize-control.plugin-remove_button .disabled [data-value] .remove:hover {
background: none;
}
.selectize-control.plugin-remove_button .disabled [data-value] .remove {
border-left-color: #e0e0e0;
}
.selectize-control {
position: relative;
}
.selectize-dropdown,
.selectize-input,
.selectize-input input {
color: #333333;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 20px;
-webkit-font-smoothing: inherit;
}
.selectize-input,
.selectize-control.single .selectize-input.input-active {
background: #ffffff;
cursor: text;
display: inline-block;
}
.selectize-input {
border: 1px solid #d0d0d0;
padding: 7px 10px;
display: inline-block;
width: 100%;
overflow: hidden;
position: relative;
z-index: 1;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-box-shadow: none;
box-shadow: none;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.selectize-control.multi .selectize-input.has-items {
padding: 5px 10px 2px;
}
.selectize-input.full {
background-color: #ffffff;
}
.selectize-input.disabled,
.selectize-input.disabled * {
cursor: default !important;
}
.selectize-input.focus {
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}
.selectize-input.dropdown-active {
-webkit-border-radius: 4px 4px 0 0;
-moz-border-radius: 4px 4px 0 0;
border-radius: 4px 4px 0 0;
}
.selectize-input > * {
vertical-align: baseline;
display: -moz-inline-stack;
display: inline-block;
zoom: 1;
*display: inline;
}
.selectize-control.multi .selectize-input > div {
cursor: pointer;
margin: 0 3px 3px 0;
padding: 1px 3px;
background: #e6e6e6;
color: #333333;
border: 1px solid #cccccc;
}
.selectize-control.multi .selectize-input > div.active {
background: #0088cc;
color: #ffffff;
border: 1px solid #0077b3;
}
.selectize-control.multi .selectize-input.disabled > div,
.selectize-control.multi .selectize-input.disabled > div.active {
color: #474747;
background: #fafafa;
border: 1px solid #e0e0e0;
}
.selectize-input > input {
display: inline-block !important;
padding: 0 !important;
min-height: 0 !important;
max-height: none !important;
max-width: 100% !important;
margin: 0 !important;
text-indent: 0 !important;
border: 0 none !important;
background: none !important;
line-height: inherit !important;
-webkit-user-select: auto !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
}
.selectize-input > input::-ms-clear {
display: none;
}
.selectize-input > input:focus {
outline: none !important;
}
.selectize-input::after {
content: ' ';
display: block;
clear: left;
}
.selectize-input.dropdown-active::before {
content: ' ';
display: block;
position: absolute;
background: #e5e5e5;
height: 1px;
bottom: 0;
left: 0;
right: 0;
}
.selectize-dropdown {
position: absolute;
z-index: 10;
border: 1px solid #cccccc;
background: #ffffff;
margin: -1px 0 0 0;
border-top: 0 none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
-webkit-border-radius: 0 0 4px 4px;
-moz-border-radius: 0 0 4px 4px;
border-radius: 0 0 4px 4px;
}
.selectize-dropdown [data-selectable] {
cursor: pointer;
overflow: hidden;
}
.selectize-dropdown [data-selectable] .highlight {
background: rgba(255, 237, 40, 0.4);
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
}
.selectize-dropdown [data-selectable],
.selectize-dropdown .optgroup-header {
padding: 3px 10px;
}
.selectize-dropdown .optgroup:first-child .optgroup-header {
border-top: 0 none;
}
.selectize-dropdown .optgroup-header {
color: #999999;
background: #ffffff;
cursor: default;
}
.selectize-dropdown .active {
background-color: #0088cc;
color: #ffffff;
}
.selectize-dropdown .active.create {
color: #ffffff;
}
.selectize-dropdown .create {
color: rgba(51, 51, 51, 0.5);
}
.selectize-dropdown-content {
overflow-y: auto;
overflow-x: hidden;
max-height: 200px;
}
.selectize-control.single .selectize-input,
.selectize-control.single .selectize-input input {
cursor: pointer;
}
.selectize-control.single .selectize-input.input-active,
.selectize-control.single .selectize-input.input-active input {
cursor: text;
}
.selectize-control.single .selectize-input:after {
content: ' ';
display: block;
position: absolute;
top: 50%;
right: 15px;
margin-top: -3px;
width: 0;
height: 0;
border-style: solid;
border-width: 5px 5px 0 5px;
border-color: #000000 transparent transparent transparent;
}
.selectize-control.single .selectize-input.dropdown-active:after {
margin-top: -4px;
border-width: 0 5px 5px 5px;
border-color: transparent transparent #000000 transparent;
}
.selectize-control.rtl.single .selectize-input:after {
left: 15px;
right: auto;
}
.selectize-control.rtl .selectize-input > input {
margin: 0 4px 0 -2px !important;
}
.selectize-control .selectize-input.disabled {
opacity: 0.5;
background-color: #ffffff;
}
.selectize-dropdown {
margin: 2px 0 0 0;
z-index: 1000;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 4px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}
.selectize-dropdown .optgroup-header {
font-size: 11px;
font-weight: bold;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
text-transform: uppercase;
}
.selectize-dropdown .optgroup:first-child:before {
display: none;
}
.selectize-dropdown .optgroup:before {
content: ' ';
display: block;
*width: 100%;
height: 1px;
margin: 9px 1px;
*margin: -5px 0 5px;
overflow: hidden;
background-color: #e5e5e5;
border-bottom: 1px solid #ffffff;
margin-left: -10px;
margin-right: -10px;
}
.selectize-dropdown [data-selectable].active {
background-color: #0081c2;
background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
background-image: -o-linear-gradient(top, #0088cc, #0077b3);
background-image: linear-gradient(to bottom, #0088cc, #0077b3);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);
}
.selectize-dropdown-content {
padding: 5px 0;
}
.selectize-dropdown-header {
padding: 6px 10px;
}
.selectize-input {
-webkit-transition: border linear .2s, box-shadow linear .2s;
-moz-transition: border linear .2s, box-shadow linear .2s;
-o-transition: border linear .2s, box-shadow linear .2s;
transition: border linear .2s, box-shadow linear .2s;
}
.selectize-input.dropdown-active {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.selectize-input.dropdown-active::before {
display: none;
}
.selectize-input.input-active,
.selectize-input.input-active:hover,
.selectize-control.multi .selectize-input.focus {
background: #ffffff !important;
border-color: rgba(82, 168, 236, 0.8) !important;
outline: 0 !important;
outline: thin dotted \9 !important;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6) !important;
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6) !important;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6) !important;
}
.selectize-control.single .selectize-input {
color: #333333;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
background-color: #f5f5f5;
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
*background-color: #e6e6e6;
/* Darken IE7 buttons by default so they stand out more given they won't have borders */
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
-moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
}
.selectize-control.single .selectize-input:hover,
.selectize-control.single .selectize-input:focus,
.selectize-control.single .selectize-input:active,
.selectize-control.single .selectize-input.active,
.selectize-control.single .selectize-input.disabled,
.selectize-control.single .selectize-input[disabled] {
color: #333333;
background-color: #e6e6e6;
*background-color: #d9d9d9;
}
.selectize-control.single .selectize-input:active,
.selectize-control.single .selectize-input.active {
background-color: #cccccc \9;
}
.selectize-control.single .selectize-input:hover {
color: #333333;
text-decoration: none;
background-position: 0 -15px;
-webkit-transition: background-position 0.1s linear;
-moz-transition: background-position 0.1s linear;
-o-transition: background-position 0.1s linear;
transition: background-position 0.1s linear;
}
.selectize-control.single .selectize-input.disabled {
background: #e6e6e6 !important;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.selectize-control.multi .selectize-input {
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.selectize-control.multi .selectize-input.has-items {
padding-left: 7px;
padding-right: 7px;
}
.selectize-control.multi .selectize-input > div {
color: #333333;
text-shadow: none;
background-color: #f5f5f5;
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
*background-color: #e6e6e6;
border: 1px solid #cccccc;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
-moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
}
.selectize-control.multi .selectize-input > div.active {
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
box-shadow: 0 1px 2px rgba(0,0,0,.05);
color: #ffffff;
text-shadow: none;
background-color: #0081c2;
background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
background-image: -o-linear-gradient(top, #0088cc, #0077b3);
background-image: linear-gradient(to bottom, #0088cc, #0077b3);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);
border-color: #0077b3 #0077b3 #004466;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
*background-color: #0088cc;
border: 1px solid #0088cc;
}
| {
"pile_set_name": "Github"
} |
(ns riffle.core-test
(:require
[clojure.test :refer :all]
[riffle.read :as r]
[riffle.write :as w]
[byte-streams :as bs]
[criterium.core :as c]
[clojure.java.io :as io]
[clojure.set :as set]
[clojure.test.check
[generators :as gen]
[properties :as prop]
[clojure-test :as ct :refer (defspec)]]))
(def words
(->> (io/file "test/words")
io/reader
line-seq))
(defn build-dictionary []
(when-not false #_(.exists (io/file "/tmp/dictionary_riffle"))
(w/write-riffle (zipmap words words) "/tmp/dictionary_riffle")))
(defn dictionary []
(r/riffle "/tmp/dictionary_riffle"))
(deftest test-dictionary
(build-dictionary)
(let [d (dictionary)]
(doseq [w words]
(is (= w (bs/to-string (r/get d w)))))
(let [entries (r/entries d)
ks (->> entries (map first) (map bs/to-string))
vs (->> entries (map second) (map bs/to-string))]
(is (= (set words) (set ks) (set vs))))))
;;;
(defn equivalent? [r m]
(and
(if (vector? r)
true
(every?
(fn [[k v]]
(= v (bs/to-string (r/get r k))))
m))
(= (set m)
(->> (if (vector? r)
(apply r/entries r)
(r/entries r))
(map (fn [[k v]]
[(bs/to-string k)
(bs/to-string v)]))
set))))
(def roundtrip-merge-prop
(prop/for-all
[a (gen/map gen/string-ascii gen/string-ascii)
b (gen/map gen/string-ascii gen/string-ascii)]
(w/write-riffle a "/tmp/check-riffle-a")
(w/write-riffle b "/tmp/check-riffle-b")
(let [m (merge a b)]
(and
(equivalent?
[(-> (r/riffle-set)
(r/conj-riffle (r/riffle "/tmp/check-riffle-a"))
(r/conj-riffle (r/riffle "/tmp/check-riffle-b")))
(-> (r/riffle-set)
(r/conj-riffle (r/mapped-riffle "/tmp/check-riffle-a"))
(r/conj-riffle (r/mapped-riffle "/tmp/check-riffle-b")))]
m)
(equivalent?
[(r/riffle "/tmp/check-riffle-a")
(r/riffle "/tmp/check-riffle-b")
(r/mapped-riffle "/tmp/check-riffle-a")
(r/mapped-riffle "/tmp/check-riffle-b")]
m)))))
(let [merge-fn (fn [a b]
(str
(+
(read-string (bs/to-string a))
(read-string (bs/to-string b)))))]
(def roundtrip-merge-with-prop
(prop/for-all
[a (gen/map gen/string-ascii (gen/fmap str gen/int))
b (gen/map gen/string-ascii (gen/fmap str gen/int))]
(w/write-riffle a "/tmp/check-riffle-a")
(w/write-riffle b "/tmp/check-riffle-b")
(w/merge-riffles merge-fn ["/tmp/check-riffle-a" "/tmp/check-riffle-b"] "/tmp/check-riffle-c")
(let [m (merge-with merge-fn a b)]
(equivalent?
[(r/riffle "/tmp/check-riffle-c")
(r/mapped-riffle "/tmp/check-riffle-c")]
m)))))
(def roundtrip-prop
(prop/for-all
[m (gen/map gen/string-ascii gen/string-ascii)]
(w/write-riffle m "/tmp/check-riffle")
(equivalent?
[(r/riffle "/tmp/check-riffle")
(r/mapped-riffle "/tmp/check-riffle")]
m)))
(defspec check-roundtrip 1e2
roundtrip-prop)
(defspec check-roundtrip-merge 1e2
roundtrip-merge-prop)
(defspec check-roundtrip-merge-with 1e2
roundtrip-merge-with-prop)
(defspec ^:stress stress-roundtrip 1e5
roundtrip-prop)
(defspec ^:stress stress-roundtrip-merge 1e4
roundtrip-merge-prop)
(defspec ^:stress stress-roundtrip-merge-with 1e4
roundtrip-merge-with-prop)
;;;
(defn run-lookup-benchmark [keys & files]
(let [rs (mapv r/riffle files)]
(time
(doseq [k keys]
(r/get (rand-nth rs) k)))))
(deftest ^:benchmark benchmark-lookup
(build-dictionary)
(let [words (->> words shuffle (take 1e3))]
(let [l (dictionary)]
(c/quick-bench
(doseq [w words]
(r/get l w))))))
| {
"pile_set_name": "Github"
} |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @name: S15.5.5.1_A2;
* @section: 15.5.5.1;
* @assertion: length property has the attributes {DontEnum};
* @description: Checking if enumerating the length property of String fails;
*/
var __str__instance = new String("globglob");
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (!(__str__instance.hasOwnProperty("length"))) {
$ERROR('#1: var __str__instance = new String("globglob"); __str__instance.hasOwnProperty("length") return true. Actual: '+__str__instance.hasOwnProperty("length"));
}
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//CHECK#2
for(prop in __str__instance){
if (prop === "length") {
$ERROR('#2: length property has the attributes {DontEnum}');
}
}
//
//////////////////////////////////////////////////////////////////////////////
| {
"pile_set_name": "Github"
} |
// Copyright 2019 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package procfs
import (
"reflect"
"testing"
)
func TestMountInfo(t *testing.T) {
tests := []struct {
name string
s string
mount *MountInfo
invalid bool
}{
{
name: "Regular sysfs mounted at /sys",
s: "16 21 0:16 / /sys rw,nosuid,nodev,noexec,relatime shared:7 - sysfs sysfs rw",
invalid: false,
mount: &MountInfo{
MountId: 16,
ParentId: 21,
MajorMinorVer: "0:16",
Root: "/",
MountPoint: "/sys",
Options: map[string]string{"rw": "", "nosuid": "", "nodev": "", "noexec": "", "relatime": ""},
OptionalFields: map[string]string{"shared": "7"},
FSType: "sysfs",
Source: "sysfs",
SuperOptions: map[string]string{"rw": ""},
},
},
{
name: "Not enough information",
s: "hello",
invalid: true,
},
{
name: "Tmpfs mounted at /run",
s: "225 20 0:39 / /run/user/112 rw,nosuid,nodev,relatime shared:177 - tmpfs tmpfs rw,size=405096k,mode=700,uid=112,gid=116",
mount: &MountInfo{
MountId: 225,
ParentId: 20,
MajorMinorVer: "0:39",
Root: "/",
MountPoint: "/run/user/112",
Options: map[string]string{"rw": "", "nosuid": "", "nodev": "", "relatime": ""},
OptionalFields: map[string]string{"shared": "177"},
FSType: "tmpfs",
Source: "tmpfs",
SuperOptions: map[string]string{"rw": "", "size": "405096k", "mode": "700", "uid": "112", "gid": "116"},
},
invalid: false,
},
{
name: "Tmpfs mounted at /run, but no optional values",
s: "225 20 0:39 / /run/user/112 rw,nosuid,nodev,relatime - tmpfs tmpfs rw,size=405096k,mode=700,uid=112,gid=116",
mount: &MountInfo{
MountId: 225,
ParentId: 20,
MajorMinorVer: "0:39",
Root: "/",
MountPoint: "/run/user/112",
Options: map[string]string{"rw": "", "nosuid": "", "nodev": "", "relatime": ""},
OptionalFields: nil,
FSType: "tmpfs",
Source: "tmpfs",
SuperOptions: map[string]string{"rw": "", "size": "405096k", "mode": "700", "uid": "112", "gid": "116"},
},
invalid: false,
},
{
name: "Tmpfs mounted at /run, with multiple optional values",
s: "225 20 0:39 / /run/user/112 rw,nosuid,nodev,relatime shared:177 master:8 - tmpfs tmpfs rw,size=405096k,mode=700,uid=112,gid=116",
mount: &MountInfo{
MountId: 225,
ParentId: 20,
MajorMinorVer: "0:39",
Root: "/",
MountPoint: "/run/user/112",
Options: map[string]string{"rw": "", "nosuid": "", "nodev": "", "relatime": ""},
OptionalFields: map[string]string{"shared": "177", "master": "8"},
FSType: "tmpfs",
Source: "tmpfs",
SuperOptions: map[string]string{"rw": "", "size": "405096k", "mode": "700", "uid": "112", "gid": "116"},
},
invalid: false,
},
{
name: "Tmpfs mounted at /run, with a mixture of valid and invalid optional values",
s: "225 20 0:39 / /run/user/112 rw,nosuid,nodev,relatime shared:177 master:8 foo:bar - tmpfs tmpfs rw,size=405096k,mode=700,uid=112,gid=116",
mount: &MountInfo{
MountId: 225,
ParentId: 20,
MajorMinorVer: "0:39",
Root: "/",
MountPoint: "/run/user/112",
Options: map[string]string{"rw": "", "nosuid": "", "nodev": "", "relatime": ""},
OptionalFields: map[string]string{"shared": "177", "master": "8"},
FSType: "tmpfs",
Source: "tmpfs",
SuperOptions: map[string]string{"rw": "", "size": "405096k", "mode": "700", "uid": "112", "gid": "116"},
},
invalid: false,
},
}
for i, test := range tests {
t.Logf("[%02d] test %q", i, test.name)
mount, err := parseMountInfoString(test.s)
if test.invalid && err == nil {
t.Error("expected an error, but none occurred")
}
if !test.invalid && err != nil {
t.Errorf("unexpected error: %v", err)
}
if want, have := test.mount, mount; !reflect.DeepEqual(want, have) {
t.Errorf("mounts:\nwant:\n%+v\nhave:\n%+v", want, have)
}
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnOK.Text" xml:space="preserve">
<value>확인</value>
</data>
<data name="btnCancel.Text" xml:space="preserve">
<value>취소</value>
</data>
<data name="btnRevert.Text" xml:space="preserve">
<value>되돌림</value>
</data>
<data name="checkboxApplyToSelected.Text" xml:space="preserve">
<value>선택된 {0} 개의 이미지에 적용</value>
</data>
</root> | {
"pile_set_name": "Github"
} |
define("ace/snippets/verilog",["require","exports","module"], function(require, exports, module) {
"use strict";
exports.snippetText =undefined;
exports.scope = "verilog";
}); (function() {
window.require(["ace/snippets/verilog"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
| {
"pile_set_name": "Github"
} |
/* ex: set ff=dos ts=2 et: */
/* $Id$ */
/*
* Copyright 2008 Ryan Flynn
*/
#ifndef UTIL_H
#define UTIL_H
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#ifdef WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef WIN32_LEAN_AND_MEAN
#else
# include <sys/time.h>
#endif
#include "types.h"
#define MIN(a, b) ((a) < (b) ? a : b)
#define MAX(a, b) ((a) > (b) ? a : b)
/* little endian to host endianness short */
#define ltohs(x) x
/* little endian to host endianness short */
#define ltohl(x) x
/**
* our own assertion macro that uses LOGF() and doesn't abort() in Release
*/
#ifdef DEBUG
# define ASSERT(x) \
if (!(x)) { \
LOGF(__FILE__, __LINE__, NULL, "ASSERTION FAILED: %s\n", #x); \
abort(); \
}
#else /* Release, don't abort() on failure */
# define ASSERT(x) \
if (!(x)) { \
LOGF(__FILE__, __LINE__, NULL, "ASSERTION FAILED: %s\n", #x); \
}
#endif
void DEBUGF(const char *, unsigned, const char *, ...);
void LOGF(const char *file, unsigned line, const char *fmt, ...);
#if !defined(_FORTIFY_SOURCE)
size_t strlcpy(char *dst, const char *src, size_t size);
size_t strlcat(char *dst, const char *src, size_t size);
#endif
size_t dump_bytes(const char *buf, size_t len, FILE *);
size_t dump_bytes_buf(char *dst, size_t dstlen, const char *buf, size_t len);
size_t dump_chars(const char *buf, size_t len, FILE *);
size_t dump_chars_buf(char *dst, size_t dstlen, const char *buf, size_t len);
size_t dump_chars_buf2(char *dst, size_t dstlen, const char *buf, size_t len);
size_t dump_hash_buf(char *dst, size_t dstlen, const u8 *buf, size_t len);
char * strrtrim(char *s);
char * strltrim(char *s);
char * strtrim(char *s);
size_t memltrim(char *, size_t);
ptrdiff_t memmatch(const char *, size_t, int (*)(int));
int str_endswith(const char *str, const char *match);
const char * mempbrk(const char *hay, const char *need, size_t haylen, size_t needlen);
const char * memstr(const char *hay, const char *needle, size_t haylen);
const char * memrstr(const char *hay, const char *need, size_t haylen);
size_t memspn(const char *mem, size_t memlen, const char *accept, size_t acceptlen);
size_t memcspn(const char *mem, size_t memlen, const char *reject, size_t rejectlen);
size_t strlen_bound(const char *mem, size_t memlen);
char hexint (const u8);
char hexint2(const u8 *);
unsigned hexint3(const u8 *);
unsigned hexint4(const u8 *);
unsigned long hexint8(const u8 *);
#define BASE64_ENCBUF(inbytes) (((inbytes) * 2) + 3) /* calculate the bytes necessary to hold base64 output */
/* NOTE: this is quick and easy but is actually larger than it needs to be */
size_t base64enc(const char *src, size_t srclen, char *dst, size_t dstlen);
void strupper(char *s, size_t len);
void strlower(char *s, size_t len);
size_t decode_hex_dump(char *dst, size_t dstlen, const char *src, size_t srclen);
int allzeroes(const char *c, size_t len);
int allones (const char *c, size_t len);
#endif
| {
"pile_set_name": "Github"
} |
# -*- encoding : utf-8 -*-
namespace :submodules do
desc "Check the status of the project's submodules"
task :check => :environment do
commit_info = `git submodule status commonlib`
case commit_info[0,1]
when '+'
$stderr.puts "Error: Currently checked out submodule commit for commonlib"
$stderr.puts "does not match the commit expected by this version of Alaveteli."
$stderr.puts "You can update it with 'git submodule update'."
exit(1)
when '-'
$stderr.puts "Error: Submodule commonlib needs to be initialized."
$stderr.puts "You can do this by running 'git submodule update --init'."
exit(1)
when 'U'
$stderr.puts "Error: Submodule commonlib has merge conflicts."
$stderr.puts "You'll need to resolve these to run Alaveteli."
exit(1)
when ' '
exit(0)
else
raise "Unexpected status character in response to 'git submodule status commonlib': #{commit_info[0,1]}"
end
end
end
| {
"pile_set_name": "Github"
} |
# SQL Server 2019 RTM CU5 - 15.0.4043.16 - x64 (KB4552255)
``` powershell
# SQL Server 2019 RTM CU5 - 15.0.4043.16 - x64 (KB4552255)
$outputFolder = 'c:\sqlsyms\15.0.4043.16\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/26dc3c5c64d84fbe9858e9751952614b2/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.4043.16 ((SQLServer2019-CU5).200611-0058)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/b7ecc728f4d145db8216e57082798f7f2/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.4043.16 ((SQLServer2019-CU5).200611-0058)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/e0e08efa82cf49839524d699fcbfcdd32/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.4043.16 ((SQLServer2019-CU5).200611-0058)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/fb3bc1d1ea3b445e8b2d8f82af2c83082/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.4043.16 ((SQLServer2019-CU5).200611-0058)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/2250bc823b6d45d78bbb1526118d5bcd1/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.4043.16 ((SQLServer2019-CU5).200611-0058)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/f15f1bb425e345fbbbf9052dfff3009f2/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.4043.16 ((SQLServer2019-CU5).200611-0058)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/7119961e9948486980ac4126d67f28671/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.4043.16 ((SQLServer2019-CU5).200611-0058)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/a5e2854d1d5e4c1b9c354018f78c6ca91/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.4043.16 ((SQLServer2019-CU5).200611-0058)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/822326dc5739477b9d02545c442b49911/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.4043.16 ((SQLServer2019-CU5).200611-0058)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/5303b7b87c2c4e2789a75900f67989fe1/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.4043.16 ((SQLServer2019-CU5).200611-0058)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/17641aefa414415686ca0f4ad81a06a12/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.4043.16 ((SQLServer2019-CU5).200611-0058)
```
# SQL Server 2019 RTM CU4 - 15.0.4033.1 - x64 (KB4548597)
``` powershell
# SQL Server 2019 RTM CU4 - 15.0.4033.1 - x64 (KB4548597)
$outputFolder = 'c:\sqlsyms\15.0.4033.1\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/a17ffc040bf74b9da5f1c2f8bee3b0ae2/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.4033.01 ((SQLServer2019-CU4).200314-2237)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/007d639428594ba6b418a4031001af3c2/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.4033.01 ((SQLServer2019-CU4).200314-2237)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/a0e96c634bcf469ba8d5739a3763b31c2/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.4033.01 ((SQLServer2019-CU4).200314-2237)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/72be5cf0b1754f7990ac550066c59cf22/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.4033.01 ((SQLServer2019-CU4).200314-2237)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/8cf1b3945a3342828669727df4b89a561/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.4033.01 ((SQLServer2019-CU4).200314-2237)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/996fcbd6df90470fbf483f5bbc076f022/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.4033.01 ((SQLServer2019-CU4).200314-2237)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/5e53ca24d90540b48d0c183348897c011/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.4033.01 ((SQLServer2019-CU4).200314-2237)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/caaa30913c3f443fa2971996571662721/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.4033.01 ((SQLServer2019-CU4).200314-2237)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/0727c20ffb694b7b966a311ba8a839ed1/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.4033.01 ((SQLServer2019-CU4).200314-2237)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/46e02f96623c4a3b980d6b915c81586c1/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.4033.01 ((SQLServer2019-CU4).200314-2237)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/f326b1ebadce4ed7b63721256723d9d12/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.4033.01 ((SQLServer2019-CU4).200314-2237)
```
# SQL Server 2019 RTM CU3 - 15.0.4023.6 - x64 (KB4538853)
``` powershell
# SQL Server 2019 RTM CU3 - 15.0.4023.6 - x64 (KB4538853)
$outputFolder = 'c:\sqlsyms\15.0.4023.6\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/1f99f28740354638ab808a14641af26a2/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.4023.06 ((SQLServer2019-CU3).200304-0805)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/7ec066594c274590ad0e4284ecbb7e7b2/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.4023.06 ((SQLServer2019-CU3).200304-0805)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/6f5ca7b595704b1a83302a33ae4bc0232/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.4023.06 ((SQLServer2019-CU3).200304-0805)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/c5447784964c488cb3ec1370a45ce8a32/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.4023.06 ((SQLServer2019-CU3).200304-0805)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/ac8c33e259e74a37be1fba98de2d5dea1/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.4023.06 ((SQLServer2019-CU3).200304-0805)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/b82843359f73486ebb55be54a8258a512/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.4023.06 ((SQLServer2019-CU3).200304-0805)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/eabcb2cbd8734147826fc8e5fed91d051/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.4023.06 ((SQLServer2019-CU3).200304-0805)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/67e76e9883cc408ab61bef65da8566ca1/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.4023.06 ((SQLServer2019-CU3).200304-0805)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/4aa18ea029164914a8ebca601fb086f31/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.4023.06 ((SQLServer2019-CU3).200304-0805)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/24f1b7e3408e46df88b53a0417eff0ec1/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.4023.06 ((SQLServer2019-CU3).200304-0805)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/e46cc8dbdfc540dda33b7bd994f636782/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.4023.06 ((SQLServer2019-CU3).200304-0805)
```
# SQL Server 2019 RTM CU2 - 15.0.4013.40 - x64 (KB4536075)
``` powershell
# SQL Server 2019 RTM CU2 - 15.0.4013.40 - x64 (KB4536075)
$outputFolder = 'c:\sqlsyms\15.0.4013.40\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/db2c3b3cd98041eebe71f258bb783cf52/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.4013.40 ((SQLServer2019-CU2).200204-0018)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/79cc12f37c694a4cb246d9ff1006f48a2/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.4013.40 ((SQLServer2019-CU2).200204-0018)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/135a7055bda8408a958cfd365c4a04342/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.4013.40 ((SQLServer2019-CU2).200204-0018)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/8d85294d07c14151baa2c1fdcedb3d702/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.4013.40 ((SQLServer2019-CU2).200204-0018)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/dc09a9a5bc5d41798cfd16759101bc0f1/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.4013.40 ((SQLServer2019-CU2).200204-0018)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/f6fa22f7a94744a3836e2e336677209a2/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.4013.40 ((SQLServer2019-CU2).200204-0018)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/05c36542b2c44ac2b7e2b6718e4ee9dd1/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.4013.40 ((SQLServer2019-CU2).200204-0018)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/b2a184d9e3704c63a988ad8a142af4e81/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.4013.40 ((SQLServer2019-CU2).200204-0018)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/2d4753074ba64ba193ab702286a752b71/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.4013.40 ((SQLServer2019-CU2).200204-0018)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/19e519afd6a34b2ba91458cbf5378e801/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.4013.40 ((SQLServer2019-CU2).200204-0018)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/70258a046ea44af38bf97bb73a90df412/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.4013.40 ((SQLServer2019-CU2).200204-0018)
```
# SQL Server 2019 RTM CU1 - 15.0.4003.23 - x64 (KB4527376)
``` powershell
# SQL Server 2019 RTM CU1 - 15.0.4003.23 - x64 (KB4527376)
$outputFolder = 'c:\sqlsyms\15.0.4003.23\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/1c28d53f4ce34500a0824edf754bb3182/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.4003.23 ((SQL19_RTM_QFE-OD).191206-2237)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/725357d7267b4fcb8bed1520f7638ae52/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.4003.23 ((SQL19_RTM_QFE-OD).191206-2237)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/872bec978b414b4894b0007d495aff9c2/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.4003.23 ((SQL19_RTM_QFE-OD).191206-2237)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/c2f014bfeb4148e79fa69e3bdf81fc232/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.4003.23 ((SQL19_RTM_QFE-OD).191206-2237)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/9186d8f25f3344849c0afbd8086431c71/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.4003.23 ((SQL19_RTM_QFE-OD).191206-2237)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/86c0928cbca241508082e6ae13a7b2ad2/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.4003.23 ((SQL19_RTM_QFE-OD).191206-2237)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/ddc9bae1e79e4be38aba05b28f20ba481/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.4003.23 ((SQL19_RTM_QFE-OD).191206-2237)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/9c7a349dca4a4f8bb2a405e2a36d7b091/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.4003.23 ((SQL19_RTM_QFE-OD).191206-2237)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/f19350dff8c54443aee52644b816d1371/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.4003.23 ((SQL19_RTM_QFE-OD).191206-2237)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/6c2376ab69404cf89eea336bc33242371/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.4003.23 ((SQL19_RTM_QFE-OD).191206-2237)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/db06d320fc1a4f1492e857d7804288672/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.4003.23 ((SQL19_RTM_QFE-OD).191206-2237)
```
# SQL Server 2019 RTM Servicing Update (GDR1) - 15.0.2070.41 - x64 (KB4517790)
``` powershell
# SQL Server 2019 RTM Servicing Update (GDR1) - 15.0.2070.41 - x64 (KB4517790)
$outputFolder = 'c:\sqlsyms\15.0.2070.41\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/35fa14a3b9874a72a017fadba93e24b12/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.2070.41 ((SQLServer).191029-0237)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/1535e7976f0a431baf2704de5f2e5fdc2/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.2070.41 ((SQLServer).191029-0237)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/9cb9edfe939f4b03b50222c9b39f196c2/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.2070.41 ((SQLServer).191029-0237)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/bdd5d0345b64423394986dc1a4a37e3d2/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.2070.41 ((SQLServer).191029-0237)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/01955e0a0c344aa9ba96522fb1ce96671/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.2070.41 ((SQLServer).191029-0237)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/34e92930c4454a74acadc5f504d350f92/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.2070.41 ((SQLServer).191029-0237)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/39717e154f0746668714cce86cebc6ba1/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.2070.41 ((SQLServer).191029-0237)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/e1295a820f7d4cb08ca66421bc0e872c1/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.2070.41 ((SQLServer).191029-0237)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/30c5297c5e244754a8e799717f9dd69b1/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.2070.41 ((SQLServer).191029-0237)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/69bd28349a494ebca2c0c0be7230183c1/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.2070.41 ((SQLServer).191029-0237)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/c0ead5152bae41f69d8dbcb210237a062/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.2070.41 ((SQLServer).191029-0237)
```
# SQL Server 2019 RTM RTM - 15.0.2000.5 - x64 (Nov 2019)
``` powershell
# SQL Server 2019 RTM RTM - 15.0.2000.5 - x64 (Nov 2019)
$outputFolder = 'c:\sqlsyms\15.0.2000.5\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/a32ecbddb336439994cc1bf8ca5612052/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.2000.05 ((SQLServer).190924-2033)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/c451d01cb0d142afb1e497def47bd4b32/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.2000.05 ((SQLServer).190924-2033)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/b69375ae56964976a91c384bda088abc2/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.2000.05 ((SQLServer).190924-2033)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/c111d07e3fe9461cb21655d20b2f13e82/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.2000.05 ((SQLServer).190924-2033)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/d3cc4bb1711f45e5bdcbfdc6ce90400e1/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.2000.05 ((SQLServer).190924-2033)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/ee3b2b5f10024545bc623c768f8e98c82/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.2000.05 ((SQLServer).190924-2033)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/b996f74062ef41f88e762d7cde413ca81/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.2000.05 ((SQLServer).190924-2033)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/a5b534efcad44ea4b8951a28847907031/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.2000.05 ((SQLServer).190924-2033)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/139725cae1124fd19c7065ca5dd091c01/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.2000.05 ((SQLServer).190924-2033)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/6e3e07ad09d6475aae40a87c8483f31e1/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.2000.05 ((SQLServer).190924-2033)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/55586008647b45f49f51934563c320cb2/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.2000.05 ((SQLServer).190924-2033)
```
# SQL Server 2019 RC RC1 - 15.0.1900.25 - x64 (Aug 2019)
``` powershell
# SQL Server 2019 RC RC1 - 15.0.1900.25 - x64 (Aug 2019)
$outputFolder = 'c:\sqlsyms\15.0.1900.25\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/807730dc54d8486cbb301034d5c8e8d42/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.1900.25 ((SQLServer).190816-2101)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/df94c4b01e8b47a7aab9cc2c24b425bb2/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.1900.25 ((SQLServer).190816-2101)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/176f91f058de40ca94e15eda8da9cc382/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.1900.25 ((SQLServer).190816-2101)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/a3397ad3fbbd424eb40829ec9875fc832/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.1900.25 ((SQLServer).190816-2101)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/7c43dc13a0244c34a87633c0b3bdf9851/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.1900.25 ((SQLServer).190816-2101)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/e2f9e096f96e4860b8ba44cf4cc5a0a72/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.1900.25 ((SQLServer).190816-2101)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/ca9b35071e0143df9136f86359a5ac471/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.1900.25 ((SQLServer).190816-2101)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/a11cc82202ff404a9241a178f6c5c5eb1/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.1900.25 ((SQLServer).190816-2101)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/bdfab5fc03914efc839596e3476487e51/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.1900.25 ((SQLServer).190816-2101)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/ebd4a16987eb4c8198107eca6471f4af1/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.1900.25 ((SQLServer).190816-2101)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/8f08dd3bcf934ea8933e21473ded4a042/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.1900.25 ((SQLServer).190816-2101)
```
# SQL Server 2019 CTP CTP 3.2 - 15.0.1800.32 - x64 (Jul 2019)
``` powershell
# SQL Server 2019 CTP CTP 3.2 - 15.0.1800.32 - x64 (Jul 2019)
$outputFolder = 'c:\sqlsyms\15.0.1800.32\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/9c623f4336c24e489fd8dd3998f34cc02/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.1800.32 ((SQLServer).190718-0401)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/e705bad3292c47e4b4d6963b8e559a1d2/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.1800.32 ((SQLServer).190718-0401)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/7a2bc2e75f4f4bc4ae68bbb4952c30642/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.1800.32 ((SQLServer).190718-0401)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/9f16df7c1680418d83a375eb42883a312/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.1800.32 ((SQLServer).190718-0401)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/85d769fd63df4a07b0bd03e683b3ac8e1/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.1800.32 ((SQLServer).190718-0401)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/fa2ccd5225de4ff3a33d2f28ddb69ec22/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.1800.32 ((SQLServer).190718-0401)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/1c3a00d0fa0a41d89e8f0b5ba2713f5d1/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.1800.32 ((SQLServer).190718-0401)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/886259b54c1246ff9884f355af67f1201/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.1800.32 ((SQLServer).190718-0401)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/87b8448051c848149b5beb098d4880841/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.1800.32 ((SQLServer).190718-0401)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/434635bff10945e8bb07c9f25339e75e1/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.1800.32 ((SQLServer).190718-0401)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/22541fc9a9034693b17da8546301e3bb2/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.1800.32 ((SQLServer).190718-0401)
```
# SQL Server 2019 CTP CTP3.1 - 15.0.1700.37 - x64 (Jun 2019)
``` powershell
# SQL Server 2019 CTP CTP3.1 - 15.0.1700.37 - x64 (Jun 2019)
$outputFolder = 'c:\sqlsyms\15.0.1700.37\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/9e557f85f9224d708abf2f557c7456e62/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.1700.37 ((SQLServer).190619-1757)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/9af9b26e3fea49f1bd5b5367174bd9242/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.1700.37 ((SQLServer).190619-1757)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/a6090023473742aa8f5c2fe198274cfe2/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.1700.37 ((SQLServer).190619-1757)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/e7708ef60f1d406f8bf6b05117dd8d962/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.1700.37 ((SQLServer).190619-1757)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/12aa7d212fb14305bb582a9d0156079c1/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.1700.37 ((SQLServer).190619-1757)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/60706aa038aa4e84901a0eb75c660d452/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.1700.37 ((SQLServer).190619-1757)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/6b687fb2adab4f49b13169f0f6a6b1261/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.1700.37 ((SQLServer).190619-1757)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/b96e03193f454e32a634e57ec66cb2dc1/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.1700.37 ((SQLServer).190619-1757)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/6b65fc282cf944fa9f3facf18303fa2e1/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.1700.37 ((SQLServer).190619-1757)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/0eed3325fb7f4ee085f479e484f5bfa81/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.1700.37 ((SQLServer).190619-1757)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/51dbb121d73f4dbaa4640507a7558ecc2/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.1700.37 ((SQLServer).190619-1757)
```
# SQL Server 2019 CTP CTP3.0 - 15.0.1600.8 - x64 (May 2019)
``` powershell
# SQL Server 2019 CTP CTP3.0 - 15.0.1600.8 - x64 (May 2019)
$outputFolder = 'c:\sqlsyms\15.0.1600.8\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/8be214152c184afcaa324365f9c1a3b52/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.1600.08 ((SQLServer).190517-0718)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/6bf39a278a27415e9aabfdb240d9ca612/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.1600.08 ((SQLServer).190517-0718)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/c3e953f7f5704ce69b8ca62fbc62656b2/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.1600.08 ((SQLServer).190517-0718)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/8e72849826824e919215135180d284d92/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.1600.08 ((SQLServer).190517-0718)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/d0e0e82ed4be4852962c4ac90303107c1/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.1600.08 ((SQLServer).190517-0718)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/3986538b627e42b982a5c663fa9751862/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.1600.08 ((SQLServer).190517-0718)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/866191ebab104dd38be0a902d87762581/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.1600.08 ((SQLServer).190517-0718)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/38304f5776fc4982a96cf4628dcc51941/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.1600.08 ((SQLServer).190517-0718)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/3bfcef2ebbba4702af4be06c10c06f861/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.1600.08 ((SQLServer).190517-0718)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/25b7cfed794846d8acfed97c702ba2cd1/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.1600.08 ((SQLServer).190517-0718)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/a0d82d62e01542b9962d6093d402ebf62/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.1600.08 ((SQLServer).190517-0718)
```
# SQL Server 2019 CTP CTP2.5 - 15.0.1500.28 - x64 (April 2019)
``` powershell
# SQL Server 2019 CTP CTP2.5 - 15.0.1500.28 - x64 (April 2019)
$outputFolder = 'c:\sqlsyms\15.0.1500.28\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/de490193e66048d4b8f93980b36f5cec2/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.1500.28 ((SQLServer).190415-2131)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/222c7b12b2d34c709a092e59249e541a2/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.1500.28 ((SQLServer).190415-2131)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/ae39c1a85f294c068a7510b8c93814432/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.1500.28 ((SQLServer).190415-2131)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/6916c4073925451ba18162d2b39980dc2/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.1500.28 ((SQLServer).190415-2131)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/1c80ecdf24d44affa414ab37a3a78f6f1/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.1500.28 ((SQLServer).190415-2131)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/af19898435d34f4e9f1dcda16e34b98a2/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.1500.28 ((SQLServer).190415-2131)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/f0f4f38d477a491db3fa7360b91551531/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.1500.28 ((SQLServer).190415-2131)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/3f3eafd827f14c60ba3709af3fa2af791/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.1500.28 ((SQLServer).190415-2131)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/09127f33dee145fcb2b1828163d986a11/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.1500.28 ((SQLServer).190415-2131)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/dc460c45ed50496f9eff9c3fc107f46f1/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.1500.28 ((SQLServer).190415-2131)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/2fe2f4d6593444dca6294d8694cc01442/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.1500.28 ((SQLServer).190415-2131)
```
# SQL Server 2019 CTP CTP2.4 - 15.0.1400.75 - x64 (March 2019)
``` powershell
# SQL Server 2019 CTP CTP2.4 - 15.0.1400.75 - x64 (March 2019)
$outputFolder = 'c:\sqlsyms\15.0.1400.75\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/19d870c6afaa43c9b925ace5a6c841d92/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.1400.75 ((SQLServer).190316-1802)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/a3a47799b1b64d928b721a14d2caa7252/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.1400.75 ((SQLServer).190316-1802)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/14270b62941a4b98bd6c0f4e640ce7182/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.1400.75 ((SQLServer).190316-1802)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/7348cf1b0b4a4fe6bd0a8091df4b602a2/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.1400.75 ((SQLServer).190316-1802)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/ad38a740f1a54a93b5ad507dcdd9d4d01/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.1400.75 ((SQLServer).190316-1802)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/32664240697e4a6a99c56bbaa4b286a32/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.1400.75 ((SQLServer).190316-1802)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/a6fad09bf4054c9697c38eb84eae5a801/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.1400.75 ((SQLServer).190316-1802)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/70da4b6f6a574d47bba5cc811ec1046a1/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.1400.75 ((SQLServer).190316-1802)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/dbd7a18fab2946f8a58c35c6bcdfa13d1/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.1400.75 ((SQLServer).190316-1802)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/1b74c0360a0e4338a7d92cd8c00cd9d31/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.1400.75 ((SQLServer).190316-1802)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/dde99a1492e84ef0926504cfe6afebec2/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.1400.75 ((SQLServer).190316-1802)
```
# SQL Server 2019 CTP CTP2.3 - 15.0.1300.359 - x64 (Feb 2019)
``` powershell
# SQL Server 2019 CTP CTP2.3 - 15.0.1300.359 - x64 (Feb 2019)
$outputFolder = 'c:\sqlsyms\15.0.1300.359\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/8d76a19c14344ec387a897611b8b8b882/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2019.0150.1300.359 ((SQLServer).190216-0730)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/a3f62ef419b64a8c973a24150ba095b22/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2019.0150.1300.359 ((SQLServer).190216-0730)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/66abfc4397dd480f8873349e5edbfd142/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2019.0150.1300.359 ((SQLServer).190216-0730)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/c7ce4847496848b2ae3f24a282f479b12/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2019.0150.1300.359 ((SQLServer).190216-0730)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/a0f649ac82df495ba6a2a8fd818fb1dd1/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2019.0150.1300.359 ((SQLServer).190216-0730)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/33dbea5fbe0143d58286fe47f21605702/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2019.0150.1300.359 ((SQLServer).190216-0730)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/b1b0c9de60a14ec5a04f8f1cd80a75301/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2019.0150.1300.359 ((SQLServer).190216-0730)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/4293b10217714217a630622cb51ca0861/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2019.0150.1300.359 ((SQLServer).190216-0730)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/68bda83b7e99449987e9bdaa25a3abd31/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2019.0150.1300.359 ((SQLServer).190216-0730)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/aff6d1fc049e46028094cb26ee5fb9101/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2019.0150.1300.359 ((SQLServer).190216-0730)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/377253089c3e42168bbd7d13bedb1da52/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2019.0150.1300.359 ((SQLServer).190216-0730)
```
# SQL Server 2019 CTP CTP2.2 - 15.0.1200.24 - x64 (Dec 2018)
``` powershell
# SQL Server 2019 CTP CTP2.2 - 15.0.1200.24 - x64 (Dec 2018)
$outputFolder = 'c:\sqlsyms\15.0.1200.24\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/2c606b4367a4429c992d5ca42512c7282/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2018.0150.1200.24 ((SQLServer).181205-2233)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/a67be7179bab4e30bc9e9b2bf0a0259a2/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2018.0150.1200.24 ((SQLServer).181205-2233)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/9a0e2aabffc94c52a0c130ba253fe9712/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2018.0150.1200.24 ((SQLServer).181205-2233)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/d58e802ce7984e098a7cec464a001bee2/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2018.0150.1200.24 ((SQLServer).181205-2233)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/15d57320c04b444bb34709c58a93d1691/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2018.0150.1200.24 ((SQLServer).181205-2233)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/8eb24ab8cb084224b18cdb3aaa075be02/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2018.0150.1200.24 ((SQLServer).181205-2233)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/40669c7f8e7f4d33949b7c590b78ae581/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2018.0150.1200.24 ((SQLServer).181205-2233)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/48d913073c2c404cac8f449c33020ba31/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2018.0150.1200.24 ((SQLServer).181205-2233)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/71c0383ff3d64837baa474cb8fd46d341/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2018.0150.1200.24 ((SQLServer).181205-2233)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/25ac40a4dfb04d8d9e943259156c6eff1/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2018.0150.1200.24 ((SQLServer).181205-2233)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/eef4684b29ec49ada134bf2e5d266c7b2/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2018.0150.1200.24 ((SQLServer).181205-2233)
```
# SQL Server 2019 CTP CTP2.1 - 15.0.1100.94 - x64 (Nov 2018)
``` powershell
# SQL Server 2019 CTP CTP2.1 - 15.0.1100.94 - x64 (Nov 2018)
$outputFolder = 'c:\sqlsyms\15.0.1100.94\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/2396a09ad02847069a2932edada5013f2/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2018.0150.1100.94 ((SQLServer).181101-2034)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/2a859b14f55a49b18757dae8a9d431b02/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2018.0150.1100.94 ((SQLServer).181101-2034)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/84f83087a0914973a9378f1bd7391f0a2/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2018.0150.1100.94 ((SQLServer).181101-2034)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/4a0764a16a9f4862a294c68fa70d9e362/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2018.0150.1100.94 ((SQLServer).181101-2034)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/15a322a3311b4663b97cd77c55312efc3/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2018.0150.1100.94 ((SQLServer).181101-2034)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/2c7c552e20814e7cafd031b4a5f55ff82/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2018.0150.1100.94 ((SQLServer).181101-2034)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/1861f31229a24d098ba62005e71ec1ed1/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2018.0150.1100.94 ((SQLServer).181101-2034)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/0eefeca4685943f0b57d87091fda67e41/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2018.0150.1100.94 ((SQLServer).181101-2034)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/c9379eab5bab492cbbff0cec75549d6f1/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2018.0150.1100.94 ((SQLServer).181101-2034)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/c8e790ff4bdf41bc976393b733fae5521/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2018.0150.1100.94 ((SQLServer).181101-2034)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/28856cd400a64ae8bdd78eee5d1969a12/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2018.0150.1100.94 ((SQLServer).181101-2034)
```
# SQL Server 2019 CTP CTP2.0 - 15.0.1000.34 - x64 (Oct 2018)
``` powershell
# SQL Server 2019 CTP CTP2.0 - 15.0.1000.34 - x64 (Oct 2018)
$outputFolder = 'c:\sqlsyms\15.0.1000.34\x64' # <<change this output folder if needed>>'
mkdir -f $outputFolder
if (-not (Test-Path "$outputFolder\SqlDK.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlDK.pdb/1fb52db46791403f80a736a3a2892d872/SqlDK.pdb' -OutFile "$outputFolder\SqlDK.pdb" } # File version 2018.0150.1000.34 ((SQLServer).180918-0824)
if (-not (Test-Path "$outputFolder\sqlmin.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlmin.pdb/dbb1be06cf8f47fab0354ab426dc85b82/sqlmin.pdb' -OutFile "$outputFolder\sqlmin.pdb" } # File version 2018.0150.1000.34 ((SQLServer).180918-0824)
if (-not (Test-Path "$outputFolder\sqllang.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqllang.pdb/e0c87c8653a14fce8988a727a0c113742/sqllang.pdb' -OutFile "$outputFolder\sqllang.pdb" } # File version 2018.0150.1000.34 ((SQLServer).180918-0824)
if (-not (Test-Path "$outputFolder\SqlTsEs.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SqlTsEs.pdb/95328c1d4b7e4c0991b1e3b23d7599132/SqlTsEs.pdb' -OutFile "$outputFolder\SqlTsEs.pdb" } # File version 2018.0150.1000.34 ((SQLServer).180918-0824)
if (-not (Test-Path "$outputFolder\sqlaccess.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlaccess.pdb/d51850bf713a4cd0bd080a52bdbda48d3/sqlaccess.pdb' -OutFile "$outputFolder\sqlaccess.pdb" } # File version 2018.0150.1000.34 ((SQLServer).180918-0824)
if (-not (Test-Path "$outputFolder\qds.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/qds.pdb/b7b40f4370474643b66a0b4f458bfa1e2/qds.pdb' -OutFile "$outputFolder\qds.pdb" } # File version 2018.0150.1000.34 ((SQLServer).180918-0824)
if (-not (Test-Path "$outputFolder\hkruntime.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkruntime.pdb/6b48ecaa4c254d3fb8415b7b48b1addf1/hkruntime.pdb' -OutFile "$outputFolder\hkruntime.pdb" } # File version 2018.0150.1000.34 ((SQLServer).180918-0824)
if (-not (Test-Path "$outputFolder\hkengine.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkengine.pdb/98e6ce276a384a459c3902090bb411e01/hkengine.pdb' -OutFile "$outputFolder\hkengine.pdb" } # File version 2018.0150.1000.34 ((SQLServer).180918-0824)
if (-not (Test-Path "$outputFolder\hkcompile.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/hkcompile.pdb/b3123f07e8a24ff99677f0c0a39ab3461/hkcompile.pdb' -OutFile "$outputFolder\hkcompile.pdb" } # File version 2018.0150.1000.34 ((SQLServer).180918-0824)
if (-not (Test-Path "$outputFolder\SQLOS.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/SQLOS.pdb/1c74d1e91078452f9facb3317fdf7b851/SQLOS.pdb' -OutFile "$outputFolder\SQLOS.pdb" } # File version 2018.0150.1000.34 ((SQLServer).180918-0824)
if (-not (Test-Path "$outputFolder\sqlservr.pdb")) { Invoke-WebRequest -uri 'https://msdl.microsoft.com/download/symbols/sqlservr.pdb/b3c1eb7ab1d2455aac81b7eb7fb43a162/sqlservr.pdb' -OutFile "$outputFolder\sqlservr.pdb" } # File version 2018.0150.1000.34 ((SQLServer).180918-0824)
```
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.utilities.memo;
/** A memoized char. Override {@link #computeValue} in subclasses;
call {@link #getValue} in using code. */
public abstract class MemoizedChar {
private boolean computed;
private char value;
/** Should compute the value of this memoized object. This will only
be called once, upon the first call to {@link #getValue}. */
protected abstract char computeValue();
/** Public accessor for the memoized value. */
public char getValue() {
if (!computed) {
value = computeValue();
computed = true;
}
return value;
}
}
| {
"pile_set_name": "Github"
} |
using ACE.Common.Extensions;
namespace ACE.Server.Network.GameAction.Actions
{
public static class GameActionAddAllegianceBan
{
[GameAction(GameActionType.AddAllegianceBan)]
public static void Handle(ClientMessage message, Session session)
{
var playerName = message.Payload.ReadString16L();
session.Player.HandleActionAddAllegianceBan(playerName);
}
}
}
| {
"pile_set_name": "Github"
} |
package org.bouncycastle.math.ec.endo;
import java.math.BigInteger;
public class ScalarSplitParameters
{
private static void checkVector(BigInteger[] v, String name)
{
if (v == null || v.length != 2 || v[0] == null || v[1] == null)
{
throw new IllegalArgumentException("'" + name + "' must consist of exactly 2 (non-null) values");
}
}
protected final BigInteger v1A, v1B, v2A, v2B;
protected final BigInteger g1, g2;
protected final int bits;
public ScalarSplitParameters(BigInteger[] v1, BigInteger[] v2, BigInteger g1,
BigInteger g2, int bits)
{
checkVector(v1, "v1");
checkVector(v2, "v2");
this.v1A = v1[0];
this.v1B = v1[1];
this.v2A = v2[0];
this.v2B = v2[1];
this.g1 = g1;
this.g2 = g2;
this.bits = bits;
}
public BigInteger getV1A()
{
return v1A;
}
public BigInteger getV1B()
{
return v1B;
}
public BigInteger getV2A()
{
return v2A;
}
public BigInteger getV2B()
{
return v2B;
}
public BigInteger getG1()
{
return g1;
}
public BigInteger getG2()
{
return g2;
}
public int getBits()
{
return bits;
}
}
| {
"pile_set_name": "Github"
} |
#ifndef CONTROL_H
#define CONTROL_H
#include <stdbool.h>
void control_init(const char *control_host, const char *control_port,
bool server);
void control_cleanup(void);
void control_writeln(const char *str);
char *control_readln(void);
void control_expectln(const char *str);
#endif /* CONTROL_H */
| {
"pile_set_name": "Github"
} |
// Generated by LiveScript 1.4.0
(function(){
var ref$, any, all, isItNaN, types, defaultType, customTypes, toString$ = {}.toString;
ref$ = require('prelude-ls'), any = ref$.any, all = ref$.all, isItNaN = ref$.isItNaN;
types = {
Number: {
typeOf: 'Number',
validate: function(it){
return !isItNaN(it);
}
},
NaN: {
typeOf: 'Number',
validate: isItNaN
},
Int: {
typeOf: 'Number',
validate: function(it){
return !isItNaN(it) && it % 1 === 0;
}
},
Float: {
typeOf: 'Number',
validate: function(it){
return !isItNaN(it);
}
},
Date: {
typeOf: 'Date',
validate: function(it){
return !isItNaN(it.getTime());
}
}
};
defaultType = {
array: 'Array',
tuple: 'Array'
};
function checkArray(input, type){
return all(function(it){
return checkMultiple(it, type.of);
}, input);
}
function checkTuple(input, type){
var i, i$, ref$, len$, types;
i = 0;
for (i$ = 0, len$ = (ref$ = type.of).length; i$ < len$; ++i$) {
types = ref$[i$];
if (!checkMultiple(input[i], types)) {
return false;
}
i++;
}
return input.length <= i;
}
function checkFields(input, type){
var inputKeys, numInputKeys, k, numOfKeys, key, ref$, types;
inputKeys = {};
numInputKeys = 0;
for (k in input) {
inputKeys[k] = true;
numInputKeys++;
}
numOfKeys = 0;
for (key in ref$ = type.of) {
types = ref$[key];
if (!checkMultiple(input[key], types)) {
return false;
}
if (inputKeys[key]) {
numOfKeys++;
}
}
return type.subset || numInputKeys === numOfKeys;
}
function checkStructure(input, type){
if (!(input instanceof Object)) {
return false;
}
switch (type.structure) {
case 'fields':
return checkFields(input, type);
case 'array':
return checkArray(input, type);
case 'tuple':
return checkTuple(input, type);
}
}
function check(input, typeObj){
var type, structure, setting, that;
type = typeObj.type, structure = typeObj.structure;
if (type) {
if (type === '*') {
return true;
}
setting = customTypes[type] || types[type];
if (setting) {
return setting.typeOf === toString$.call(input).slice(8, -1) && setting.validate(input);
} else {
return type === toString$.call(input).slice(8, -1) && (!structure || checkStructure(input, typeObj));
}
} else if (structure) {
if (that = defaultType[structure]) {
if (that !== toString$.call(input).slice(8, -1)) {
return false;
}
}
return checkStructure(input, typeObj);
} else {
throw new Error("No type defined. Input: " + input + ".");
}
}
function checkMultiple(input, types){
if (toString$.call(types).slice(8, -1) !== 'Array') {
throw new Error("Types must be in an array. Input: " + input + ".");
}
return any(function(it){
return check(input, it);
}, types);
}
module.exports = function(parsedType, input, options){
options == null && (options = {});
customTypes = options.customTypes || {};
return checkMultiple(input, parsedType);
};
}).call(this);
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2013 Realtek Semiconductor Corp.
* All Rights Reserved.
*
* Unless you and Realtek execute a separate written software license
* agreement governing use of this software, this software is licensed
* to you under the terms of the GNU General Public License version 2,
* available at https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*
* $Revision: 76306 $
* $Date: 2017-03-08 15:13:58 +0800 (¶g¤T, 08 ¤T¤ë 2017) $
*
* Purpose : RTL8367C switch high-level API for RTL8367C
* Feature : Ingress bandwidth control related functions
*
*/
#ifndef _RTL8367C_ASICDRV_INBWCTRL_H_
#define _RTL8367C_ASICDRV_INBWCTRL_H_
#include <rtl8367c_asicdrv.h>
extern ret_t rtl8367c_setAsicPortIngressBandwidth(rtk_uint32 port, rtk_uint32 bandwidth, rtk_uint32 preifg, rtk_uint32 enableFC);
extern ret_t rtl8367c_getAsicPortIngressBandwidth(rtk_uint32 port, rtk_uint32* pBandwidth, rtk_uint32* pPreifg, rtk_uint32* pEnableFC );
extern ret_t rtl8367c_setAsicPortIngressBandwidthBypass(rtk_uint32 enabled);
extern ret_t rtl8367c_getAsicPortIngressBandwidthBypass(rtk_uint32* pEnabled);
#endif /*_RTL8367C_ASICDRV_INBWCTRL_H_*/
| {
"pile_set_name": "Github"
} |
/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app and you should
* disable HTTP caching for this file too.
* See https://goo.gl/nhQhGp
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
* See https://goo.gl/2aRDsh
*/
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts(
"/precache-manifest.a423ceb74b2617d27ce265da195ba4a2.js"
);
self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});
workbox.core.clientsClaim();
/**
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/index.html"), {
blacklist: [/^\/_/,/\/[^\/?]+\.[^\/]+$/],
});
| {
"pile_set_name": "Github"
} |
<?php
namespace W3TC;
class Extension_NewRelic_Plugin_Admin {
private $_config;
/**
*
*
* @param unknown $extensions
* @param Config $config
* @return mixed
*/
static public function w3tc_extensions( $extensions, $config ) {
$extensions['newrelic'] = array (
'name' => 'New Relic',
'author' => 'W3 EDGE',
'description' => __( 'New Relic is software analytics platform offering app performance management and mobile monitoring solutions.', 'w3-total-cache' ),
'author_uri' => 'https://www.w3-edge.com/',
'extension_uri' => 'https://www.w3-edge.com/',
'extension_id' => 'newrelic',
'settings_exists' => true,
'version' => '1.0',
'enabled' => true,
'requirements' => '',
'active_frontend_own_control' => true,
'path' => 'w3-total-cache/Extension_NewRelic_Plugin.php'
);
return $extensions;
}
function __construct() {
$this->_config = Dispatcher::config();
}
function run() {
add_filter( 'w3tc_compatibility_test', array(
$this, 'verify_compatibility' ) );
add_action( 'w3tc_config_save', array( $this, 'w3tc_config_save' ), 10, 1 );
add_filter( 'w3tc_admin_actions', array( $this, 'w3tc_admin_actions' ) );
add_filter( 'w3tc_admin_menu', array( $this, 'w3tc_admin_menu' ) );
add_filter( 'w3tc_extension_plugin_links_newrelic',
array( $this, 'w3tc_extension_plugin_links' ) );
add_action( 'w3tc_settings_page-w3tc_monitoring',
array( $this, 'w3tc_settings_page_w3tc_monitoring' ) );
add_action( 'admin_init_w3tc_general', array(
'\W3TC\Extension_NewRelic_GeneralPage',
'admin_init_w3tc_general'
) );
add_action( 'w3tc_ajax', array(
'\W3TC\Extension_NewRelic_Popup',
'w3tc_ajax'
) );
if ( Util_Admin::is_w3tc_admin_page() ) {
add_action( 'admin_notices', array(
$this,
'admin_notices'
) );
add_action( 'network_admin_notices', array(
$this,
'admin_notices'
) );
}
add_action( 'admin_init_w3tc_dashboard', array(
'\W3TC\Extension_NewRelic_Widget',
'admin_init_w3tc_dashboard' ) );
add_action( 'w3tc_ajax', array(
'\W3TC\Extension_NewRelic_Widget',
'w3tc_ajax' ) );
add_filter( 'w3tc_notes', array( $this, 'w3tc_notes' ) );
}
public function w3tc_admin_menu( $menu ) {
$c = Dispatcher::config();
$monitoring_type = $c->get_string( array( 'newrelic', 'monitoring_type' ) );
if ( $monitoring_type == 'apm' ) {
$menu['w3tc_monitoring'] = array(
'page_title' => __( 'Monitoring', 'w3-total-cache' ),
'menu_text' => __( 'Monitoring', 'w3-total-cache' ),
'visible_always' => false,
'order' => 1200
);
}
return $menu;
}
public function w3tc_admin_actions( $handlers ) {
$handlers['new_relic'] = 'Extension_NewRelic_AdminActions';
return $handlers;
}
public function w3tc_extension_plugin_links( $links ) {
$links = array();
$links[] = '<a class="edit" href="' .
esc_attr( Util_Ui::admin_url( 'admin.php?page=w3tc_general#monitoring' ) ) .
'">'. __( 'Settings' ).'</a>';
return $links;
}
public function w3tc_settings_page_w3tc_monitoring() {
$v = new Extension_NewRelic_Page();
$v->render_content();
}
function admin_notices() {
$api_key = $this->_config->get_string( array( 'newrelic', 'api_key' ) );
if ( empty( $api_key ) )
return;
$nerser = Dispatcher::component( 'Extension_NewRelic_Service' );
$verify_running_result = $nerser->verify_running();
$not_running = is_array( $verify_running_result );
if ( $not_running ) {
$message = '<p>' .
__( 'New Relic is not running correctly. ', 'w3-total-cache' ) .
'<a href="#" class="w3tc_link_more {for_class: \'w3tc_nr_admin_notice\'}">' .
'more</a> ' .
'<div class="w3tc_none w3tc_nr_admin_notice">' .
__( 'The plugin has detected the following issues:. ', 'w3-total-cache' );
$message .= "<ul class=\"w3-bullet-list\">\n";
foreach ( $verify_running_result as $cause ) {
$message .= "<li>$cause</li>";
}
$message .= "</ul>\n";
$message .= '<p>' . sprintf(
__( 'Please review the <a href="%s">settings</a>.', 'w3-total-cache' ),
network_admin_url( 'admin.php?page=w3tc_general#monitoring' ) ) . "</p>";
$message .= "</div></p>\n";
Util_Ui::error_box( $message );
}
}
function w3tc_notes( $notes ) {
$newrelic_notes = Dispatcher::component( 'Extension_NewRelic_AdminNotes' );
$notes = array_merge( $notes,
$newrelic_notes->notifications( $this->_config ) );
return $notes;
}
/**
* Returns a list of the verification status of the the new relic
* requirements. To be used on the compatibility page
*
* @param unknown $verified_list
* @return array
*/
function verify_compatibility( $verified_list ) {
$nerser = Dispatcher::component( 'Extension_NewRelic_Service' );
$nr_verified = $nerser->verify_compatibility();
$verified_list[] = '<strong>New Relic</strong>';
foreach ( $nr_verified as $criteria => $result )
$verified_list[] = sprintf( "$criteria: %s", $result );
return $verified_list;
}
public function w3tc_config_save( $config ) {
// frontend activity
$api_key = $config->get_string( array( 'newrelic', 'api_key' ) );
$is_filled = !empty( $api_key );
if ( $is_filled ) {
$monitoring_type = $config->get_string( array(
'newrelic', 'monitoring_type' ) );
if ( $monitoring_type == 'browser' ) {
$v = $config->get_string( array( 'newrelic',
'browser.application_id' ) );
$is_filled = !empty( $v );
} else {
$v = $config->get_string( array( 'newrelic',
'apm.application_name' ) );
$is_filled = !empty( $v );
}
}
$config->set_extension_active_frontend( 'newrelic', $is_filled );
}
}
| {
"pile_set_name": "Github"
} |
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
| {
"pile_set_name": "Github"
} |
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: gd\n"
"Project-Id-Version: openfoodfacts\n"
"PO-Revision-Date: 2020-09-10 12:10\n"
"Language-Team: Scottish Gaelic\n"
"Last-Translator: \n"
"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n>2 && n<20) ? 2 : 3;\n"
"X-Crowdin-Project: openfoodfacts\n"
"X-Crowdin-Project-ID: 243092\n"
"X-Crowdin-Language: gd\n"
"X-Crowdin-File: /master/po/openproductsfacts/openproductsfacts.pot\n"
"X-Crowdin-File-ID: 1384\n"
#. do not translate
msgctxt "android_apk_app_link"
msgid "https://world.openproductsfacts.org/images/apps/off.apk"
msgstr ""
#. change hl=en by hl=fr or hl=de and make sure the url works
msgctxt "android_app_link"
msgid "https://play.google.com/store/apps/details?id=org.openproductsfacts.scanner&hl=en"
msgstr ""
#. change https://apps.apple.com/app/ to https://apps.apple.com/fr/app/ (for instance) and make sure the url works
msgctxt "ios_app_link"
msgid "https://apps.apple.com/app/open-beauty-facts/id1122926380"
msgstr ""
#. make sure the image exists with your country code. Otherwise, ask @teolemon how to create a translated logo
msgctxt "logo"
msgid "openproductsfacts-logo-en-178x150.png"
msgstr ""
#. make sure the image exists with your country code. Otherwise, ask @teolemon how to create a translated logo
msgctxt "logo2x"
msgid "openproductsfacts-logo-en-356x300.png"
msgstr ""
msgctxt "site_name"
msgid "Open Products Facts"
msgstr ""
#. change https://www.microsoft.com/en-us/p/ to https://www.microsoft.com/fr-fr/p/ (for instance) and make sure the url works
msgctxt "windows_phone_app_link"
msgid "https://www.microsoft.com/en-us/p/openfoodfacts/9nblggh0dkqr"
msgstr ""
msgctxt "tagline"
msgid "Open Products Facts gathers information and data on products from around the world."
msgstr ""
#. make sure the Twitter account exists for your country. Otherwise, ask @stephane to create it
msgctxt "twitter_account"
msgid "OpenFoodFacts"
msgstr ""
msgctxt "warning_not_complete"
msgid "This product page is not complete. You can help to complete it by editing it and adding more data from the photos we have, or by taking more photos using the app for <a href=\"https://play.google.com/store/apps/details?id=org.openproductsfacts.scanner\">Android</a> or <a href=\"https://apps.apple.com/us/app/open-beauty-facts/id1122926380\">iPhone/iPad</a>. Thank you!"
msgstr ""
msgctxt "bottom_content"
msgid "<a href=\"https://world.openfoodfacts.org/donate-to-open-food-facts\"><img src=\"https://static.openfoodfacts.org/images/svg/donate-icon.svg\" alt=\"Donate to Open Products Facts\" /></a><p><<site_name>> is made by a non-profit association, independent from the industry. It is made for all, by all, and it is funded by all. You can support our work by <a href=\"https://world.openfoodfacts.org/donate-to-open-food-facts\">donating to Open Products Facts</a> and also by <a href=\"https://www.lilo.org/fr/open-food-facts/?utm_source=open-food-facts\">using the Lilo search engine</a>.<br/><b>Thank you!</b></p>"
msgstr ""
msgctxt "donate"
msgid "Donate to Open Products Facts"
msgstr ""
msgctxt "facebook_page"
msgid "https://www.facebook.com/OpenFoodFacts"
msgstr ""
msgctxt "footer"
msgid "<a href=\"https://world.openproductsfacts.org/legal\">Legal</a> -\n"
"<a href=\"https://world.openproductsfacts.org/terms-of-use\">Terms of Use</a> -\n"
"<a href=\"https://world.openproductsfacts.org/who-we-are\">Who we are</a> -\n"
"<a href=\"https://world.openproductsfacts.org/faq\">Frequently Asked Questions</a> -\n"
"<a href=\"https://openfoodfacts.uservoice.com/\">Ideas Forum</a> -\n"
"<a href=\"https://en.blog.openfoodfacts.org\">Blog</a> -\n"
"<a href=\"https://world.openproductsfacts.org/press-and-blogs\">Press and Blogs</a>\n"
msgstr ""
msgctxt "brands_example"
msgid "Nike, Apple"
msgstr ""
msgctxt "categories_example"
msgid "Mobile phone, Washing machine powder"
msgstr ""
msgctxt "emb_codes_example"
msgid "EMB 53062"
msgstr ""
msgctxt "site_description"
msgid "A collaborative, free and open database of information on products from around the world"
msgstr ""
msgctxt "footer_and_the_facebook_group"
msgid "and the <a href=\"https://www.facebook.com/groups/OpenFoodFacts/\">Facebook group for contributors</a>"
msgstr ""
msgctxt "footer_tagline"
msgid "A collaborative, free and open database of products from around the world."
msgstr ""
msgctxt "footer_wiki_link"
msgid "https://wiki.openfoodfacts.org"
msgstr ""
msgctxt "generic_name_example"
msgid "Android smartphone"
msgstr ""
msgctxt "product_name_example"
msgid "iPod Touch (1st generation)"
msgstr ""
msgctxt "og_image_url"
msgid "https://static.openproductsfacts.org/images/misc/openproductsfacts-logo-en-178x150.png"
msgstr ""
msgctxt "openfoodhunt_points"
msgid "It's <a href=\"/open-product-hunt\">Open Product Hunt</a> on <<site_name>> from Saturday February 21st to Sunday March 1st! Contributors are awarded\n"
"Explorer points for products they add and Ambassador points for new contributors they recruit. Points are updated every 30 minutes."
msgstr ""
msgctxt "product_js_upload_image_note"
msgid "→ With Chrome, Firefox and Safari, you can select multiple pictures (product, ingredients etc.) by clicking them while holding the Ctrl key pressed to add them all in one shot."
msgstr ""
msgctxt "search_description_opensearch"
msgid "Open Products Facts product search"
msgstr ""
msgctxt "ingredients_text_example"
msgid "AQUA/WATER, SODIUM LAURETH SULFATE, DISODIUM COCOAMPHODIACETATE, GLYCOL DISTEARATE, COCAMIDE MEA"
msgstr ""
#. make sure the text file exists for your language, otherwise ask @teolemon
msgctxt "get_the_app_link"
msgid "/open-products-facts-mobile-app"
msgstr ""
| {
"pile_set_name": "Github"
} |
// Copyright 2016 CNI authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package types020_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestTypes010(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "0.1.0/0.2.0 Types Suite")
}
| {
"pile_set_name": "Github"
} |
- Please follow the code style guidelines in doc/CodingStyle
- Please sign your commits and generate patch against the git version,
i.e., use
$ git format-patch -M origin
- Send patches to [email protected] or raise a pull request on Pluto's GitHub.
| {
"pile_set_name": "Github"
} |
// Copyright 2011 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 norm
import (
"bytes"
"flag"
"fmt"
"io"
"log"
"strings"
"testing"
"unicode/utf8"
"golang.org/x/text/internal/testtext"
"golang.org/x/text/transform"
)
var (
testn = flag.Int("testn", -1, "specific test number to run or -1 for all")
)
// pc replaces any rune r that is repeated n times, for n > 1, with r{n}.
func pc(s string) []byte {
b := bytes.NewBuffer(make([]byte, 0, len(s)))
for i := 0; i < len(s); {
r, sz := utf8.DecodeRuneInString(s[i:])
n := 0
if sz == 1 {
// Special-case one-byte case to handle repetition for invalid UTF-8.
for c := s[i]; i+n < len(s) && s[i+n] == c; n++ {
}
} else {
for _, r2 := range s[i:] {
if r2 != r {
break
}
n++
}
}
b.WriteString(s[i : i+sz])
if n > 1 {
fmt.Fprintf(b, "{%d}", n)
}
i += sz * n
}
return b.Bytes()
}
// pidx finds the index from which two strings start to differ, plus context.
// It returns the index and ellipsis if the index is greater than 0.
func pidx(a, b string) (i int, prefix string) {
for ; i < len(a) && i < len(b) && a[i] == b[i]; i++ {
}
if i < 8 {
return 0, ""
}
i -= 3 // ensure taking at least one full rune before the difference.
for k := i - 7; i > k && !utf8.RuneStart(a[i]); i-- {
}
return i, "..."
}
type PositionTest struct {
input string
pos int
buffer string // expected contents of reorderBuffer, if applicable
}
type positionFunc func(rb *reorderBuffer, s string) (int, []byte)
func runPosTests(t *testing.T, name string, f Form, fn positionFunc, tests []PositionTest) {
rb := reorderBuffer{}
rb.init(f, nil)
for i, test := range tests {
rb.reset()
rb.src = inputString(test.input)
rb.nsrc = len(test.input)
pos, out := fn(&rb, test.input)
if pos != test.pos {
t.Errorf("%s:%d: position is %d; want %d", name, i, pos, test.pos)
}
if outs := string(out); outs != test.buffer {
k, pfx := pidx(outs, test.buffer)
t.Errorf("%s:%d: buffer \nwas %s%+q; \nwant %s%+q", name, i, pfx, pc(outs[k:]), pfx, pc(test.buffer[k:]))
}
}
}
func grave(n int) string {
return rep(0x0300, n)
}
func rep(r rune, n int) string {
return strings.Repeat(string(r), n)
}
const segSize = maxByteBufferSize
var cgj = GraphemeJoiner
var decomposeSegmentTests = []PositionTest{
// illegal runes
{"\xC2", 0, ""},
{"\xC0", 1, "\xC0"},
{"\u00E0\x80", 2, "\u0061\u0300"},
// starter
{"a", 1, "a"},
{"ab", 1, "a"},
// starter + composing
{"a\u0300", 3, "a\u0300"},
{"a\u0300b", 3, "a\u0300"},
// with decomposition
{"\u00C0", 2, "A\u0300"},
{"\u00C0b", 2, "A\u0300"},
// long
{grave(31), 60, grave(30) + cgj},
{"a" + grave(31), 61, "a" + grave(30) + cgj},
// Stability tests: see http://www.unicode.org/review/pr-29.html.
// U+0300 COMBINING GRAVE ACCENT;Mn;230;NSM;;;;;N;NON-SPACING GRAVE;;;;
// U+0B47 ORIYA VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
// U+0B3E ORIYA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
// U+1100 HANGUL CHOSEONG KIYEOK;Lo;0;L;;;;;N;;;;;
// U+1161 HANGUL JUNGSEONG A;Lo;0;L;;;;;N;;;;;
{"\u0B47\u0300\u0B3E", 8, "\u0B47\u0300\u0B3E"},
{"\u1100\u0300\u1161", 8, "\u1100\u0300\u1161"},
{"\u0B47\u0B3E", 6, "\u0B47\u0B3E"},
{"\u1100\u1161", 6, "\u1100\u1161"},
// U+04DA MALAYALAM VOWEL SIGN O;Mc;0;L;0D46 0D3E;;;;N;;;;;
// Sequence of decomposing characters that are starters and modifiers.
{"\u0d4a" + strings.Repeat("\u0d3e", 31), 90, "\u0d46" + strings.Repeat("\u0d3e", 30) + cgj},
{grave(30), 60, grave(30)},
// U+FF9E is a starter, but decomposes to U+3099, which is not.
{grave(30) + "\uff9e", 60, grave(30) + cgj},
// ends with incomplete UTF-8 encoding
{"\xCC", 0, ""},
{"\u0300\xCC", 2, "\u0300"},
}
func decomposeSegmentF(rb *reorderBuffer, s string) (int, []byte) {
rb.initString(NFD, s)
rb.setFlusher(nil, appendFlush)
p := decomposeSegment(rb, 0, true)
return p, rb.out
}
func TestDecomposeSegment(t *testing.T) {
runPosTests(t, "TestDecomposeSegment", NFC, decomposeSegmentF, decomposeSegmentTests)
}
var firstBoundaryTests = []PositionTest{
// no boundary
{"", -1, ""},
{"\u0300", -1, ""},
{"\x80\x80", -1, ""},
// illegal runes
{"\xff", 0, ""},
{"\u0300\xff", 2, ""},
{"\u0300\xc0\x80\x80", 2, ""},
// boundaries
{"a", 0, ""},
{"\u0300a", 2, ""},
// Hangul
{"\u1103\u1161", 0, ""},
{"\u110B\u1173\u11B7", 0, ""},
{"\u1161\u110B\u1173\u11B7", 3, ""},
{"\u1173\u11B7\u1103\u1161", 6, ""},
// too many combining characters.
{grave(maxNonStarters - 1), -1, ""},
{grave(maxNonStarters), 60, ""},
{grave(maxNonStarters + 1), 60, ""},
}
func firstBoundaryF(rb *reorderBuffer, s string) (int, []byte) {
return rb.f.form.FirstBoundary([]byte(s)), nil
}
func firstBoundaryStringF(rb *reorderBuffer, s string) (int, []byte) {
return rb.f.form.FirstBoundaryInString(s), nil
}
func TestFirstBoundary(t *testing.T) {
runPosTests(t, "TestFirstBoundary", NFC, firstBoundaryF, firstBoundaryTests)
runPosTests(t, "TestFirstBoundaryInString", NFC, firstBoundaryStringF, firstBoundaryTests)
}
func TestNextBoundary(t *testing.T) {
testCases := []struct {
input string
atEOF bool
want int
}{
// no boundary
{"", true, 0},
{"", false, -1},
{"\u0300", true, 2},
{"\u0300", false, -1},
{"\x80\x80", true, 1},
{"\x80\x80", false, 1},
// illegal runes
{"\xff", false, 1},
{"\u0300\xff", false, 2},
{"\u0300\xc0\x80\x80", false, 2},
{"\xc2\x80\x80", false, 2},
{"\xc2", false, -1},
{"\xc2", true, 1},
{"a\u0300\xc2", false, -1},
{"a\u0300\xc2", true, 3},
// boundaries
{"a", true, 1},
{"a", false, -1},
{"aa", false, 1},
{"\u0300", true, 2},
{"\u0300", false, -1},
{"\u0300a", false, 2},
// Hangul
{"\u1103\u1161", true, 6},
{"\u1103\u1161", false, -1},
{"\u110B\u1173\u11B7", false, -1},
{"\u110B\u1173\u11B7\u110B\u1173\u11B7", false, 9},
{"\u1161\u110B\u1173\u11B7", false, 3},
{"\u1173\u11B7\u1103\u1161", false, 6},
// too many combining characters.
{grave(maxNonStarters - 1), false, -1},
{grave(maxNonStarters), false, 60},
{grave(maxNonStarters + 1), false, 60},
}
for _, tc := range testCases {
if got := NFC.NextBoundary([]byte(tc.input), tc.atEOF); got != tc.want {
t.Errorf("NextBoundary(%+q, %v) = %d; want %d", tc.input, tc.atEOF, got, tc.want)
}
if got := NFC.NextBoundaryInString(tc.input, tc.atEOF); got != tc.want {
t.Errorf("NextBoundaryInString(%+q, %v) = %d; want %d", tc.input, tc.atEOF, got, tc.want)
}
}
}
var decomposeToLastTests = []PositionTest{
// ends with inert character
{"Hello!", 6, ""},
{"\u0632", 2, ""},
{"a\u0301\u0635", 5, ""},
// ends with non-inert starter
{"a", 0, "a"},
{"a\u0301a", 3, "a"},
{"a\u0301\u03B9", 3, "\u03B9"},
{"a\u0327", 0, "a\u0327"},
// illegal runes
{"\xFF", 1, ""},
{"aa\xFF", 3, ""},
{"\xC0\x80\x80", 3, ""},
{"\xCC\x80\x80", 3, ""},
// ends with incomplete UTF-8 encoding
{"a\xCC", 2, ""},
// ends with combining characters
{"\u0300\u0301", 0, "\u0300\u0301"},
{"a\u0300\u0301", 0, "a\u0300\u0301"},
{"a\u0301\u0308", 0, "a\u0301\u0308"},
{"a\u0308\u0301", 0, "a\u0308\u0301"},
{"aaaa\u0300\u0301", 3, "a\u0300\u0301"},
{"\u0300a\u0300\u0301", 2, "a\u0300\u0301"},
{"\u00C0", 0, "A\u0300"},
{"a\u00C0", 1, "A\u0300"},
// decomposing
{"a\u0300\u00E0", 3, "a\u0300"},
// multisegment decompositions (flushes leading segments)
{"a\u0300\uFDC0", 7, "\u064A"},
{"\uFDC0" + grave(29), 4, "\u064A" + grave(29)},
{"\uFDC0" + grave(30), 4, "\u064A" + grave(30)},
{"\uFDC0" + grave(31), 5, grave(30)},
{"\uFDFA" + grave(14), 31, "\u0645" + grave(14)},
// Overflow
{"\u00E0" + grave(29), 0, "a" + grave(30)},
{"\u00E0" + grave(30), 2, grave(30)},
// Hangul
{"a\u1103", 1, "\u1103"},
{"a\u110B", 1, "\u110B"},
{"a\u110B\u1173", 1, "\u110B\u1173"},
// See comment in composition.go:compBoundaryAfter.
{"a\u110B\u1173\u11B7", 1, "\u110B\u1173\u11B7"},
{"a\uC73C", 1, "\u110B\u1173"},
{"다음", 3, "\u110B\u1173\u11B7"},
{"다", 0, "\u1103\u1161"},
{"\u1103\u1161\u110B\u1173\u11B7", 6, "\u110B\u1173\u11B7"},
{"\u110B\u1173\u11B7\u1103\u1161", 9, "\u1103\u1161"},
{"다음음", 6, "\u110B\u1173\u11B7"},
{"음다다", 6, "\u1103\u1161"},
// maximized buffer
{"a" + grave(30), 0, "a" + grave(30)},
// Buffer overflow
{"a" + grave(31), 3, grave(30)},
// weird UTF-8
{"a\u0300\u11B7", 0, "a\u0300\u11B7"},
}
func decomposeToLast(rb *reorderBuffer, s string) (int, []byte) {
rb.setFlusher([]byte(s), appendFlush)
decomposeToLastBoundary(rb)
buf := rb.flush(nil)
return len(rb.out), buf
}
func TestDecomposeToLastBoundary(t *testing.T) {
runPosTests(t, "TestDecomposeToLastBoundary", NFKC, decomposeToLast, decomposeToLastTests)
}
var lastBoundaryTests = []PositionTest{
// ends with inert character
{"Hello!", 6, ""},
{"\u0632", 2, ""},
// ends with non-inert starter
{"a", 0, ""},
// illegal runes
{"\xff", 1, ""},
{"aa\xff", 3, ""},
{"a\xff\u0300", 1, ""}, // TODO: should probably be 2.
{"\xc0\x80\x80", 3, ""},
{"\xc0\x80\x80\u0300", 3, ""},
// ends with incomplete UTF-8 encoding
{"\xCC", -1, ""},
{"\xE0\x80", -1, ""},
{"\xF0\x80\x80", -1, ""},
{"a\xCC", 0, ""},
{"\x80\xCC", 1, ""},
{"\xCC\xCC", 1, ""},
// ends with combining characters
{"a\u0300\u0301", 0, ""},
{"aaaa\u0300\u0301", 3, ""},
{"\u0300a\u0300\u0301", 2, ""},
{"\u00C2", 0, ""},
{"a\u00C2", 1, ""},
// decomposition may recombine
{"\u0226", 0, ""},
// no boundary
{"", -1, ""},
{"\u0300\u0301", -1, ""},
{"\u0300", -1, ""},
{"\x80\x80", -1, ""},
{"\x80\x80\u0301", -1, ""},
// Hangul
{"다음", 3, ""},
{"다", 0, ""},
{"\u1103\u1161\u110B\u1173\u11B7", 6, ""},
{"\u110B\u1173\u11B7\u1103\u1161", 9, ""},
// too many combining characters.
{grave(maxNonStarters - 1), -1, ""},
// May still be preceded with a non-starter.
{grave(maxNonStarters), -1, ""},
// May still need to insert a cgj after the last combiner.
{grave(maxNonStarters + 1), 2, ""},
{grave(maxNonStarters + 2), 4, ""},
{"a" + grave(maxNonStarters-1), 0, ""},
{"a" + grave(maxNonStarters), 0, ""},
// May still need to insert a cgj after the last combiner.
{"a" + grave(maxNonStarters+1), 3, ""},
{"a" + grave(maxNonStarters+2), 5, ""},
}
func lastBoundaryF(rb *reorderBuffer, s string) (int, []byte) {
return rb.f.form.LastBoundary([]byte(s)), nil
}
func TestLastBoundary(t *testing.T) {
runPosTests(t, "TestLastBoundary", NFC, lastBoundaryF, lastBoundaryTests)
}
type spanTest struct {
input string
atEOF bool
n int
err error
}
var quickSpanTests = []spanTest{
{"", true, 0, nil},
// starters
{"a", true, 1, nil},
{"abc", true, 3, nil},
{"\u043Eb", true, 3, nil},
// incomplete last rune.
{"\xCC", true, 1, nil},
{"\xCC", false, 0, transform.ErrShortSrc},
{"a\xCC", true, 2, nil},
{"a\xCC", false, 0, transform.ErrShortSrc}, // TODO: could be 1 for NFD
// incorrectly ordered combining characters
{"\u0300\u0316", true, 0, transform.ErrEndOfSpan},
{"\u0300\u0316", false, 0, transform.ErrEndOfSpan},
{"\u0300\u0316cd", true, 0, transform.ErrEndOfSpan},
{"\u0300\u0316cd", false, 0, transform.ErrEndOfSpan},
// have a maximum number of combining characters.
{rep(0x035D, 30) + "\u035B", true, 0, transform.ErrEndOfSpan},
{"a" + rep(0x035D, 30) + "\u035B", true, 0, transform.ErrEndOfSpan},
{"Ɵ" + rep(0x035D, 30) + "\u035B", true, 0, transform.ErrEndOfSpan},
{"aa" + rep(0x035D, 30) + "\u035B", true, 1, transform.ErrEndOfSpan},
{rep(0x035D, 30) + cgj + "\u035B", true, 64, nil},
{"a" + rep(0x035D, 30) + cgj + "\u035B", true, 65, nil},
{"Ɵ" + rep(0x035D, 30) + cgj + "\u035B", true, 66, nil},
{"aa" + rep(0x035D, 30) + cgj + "\u035B", true, 66, nil},
{"a" + rep(0x035D, 30) + cgj + "\u035B", false, 61, transform.ErrShortSrc},
{"Ɵ" + rep(0x035D, 30) + cgj + "\u035B", false, 62, transform.ErrShortSrc},
{"aa" + rep(0x035D, 30) + cgj + "\u035B", false, 62, transform.ErrShortSrc},
}
var quickSpanNFDTests = []spanTest{
// needs decomposing
{"\u00C0", true, 0, transform.ErrEndOfSpan},
{"abc\u00C0", true, 3, transform.ErrEndOfSpan},
// correctly ordered combining characters
{"\u0300", true, 2, nil},
{"ab\u0300", true, 4, nil},
{"ab\u0300cd", true, 6, nil},
{"\u0300cd", true, 4, nil},
{"\u0316\u0300", true, 4, nil},
{"ab\u0316\u0300", true, 6, nil},
{"ab\u0316\u0300cd", true, 8, nil},
{"ab\u0316\u0300\u00C0", true, 6, transform.ErrEndOfSpan},
{"\u0316\u0300cd", true, 6, nil},
{"\u043E\u0308b", true, 5, nil},
// incorrectly ordered combining characters
{"ab\u0300\u0316", true, 1, transform.ErrEndOfSpan}, // TODO: we could skip 'b' as well.
{"ab\u0300\u0316cd", true, 1, transform.ErrEndOfSpan},
// Hangul
{"같은", true, 0, transform.ErrEndOfSpan},
}
var quickSpanNFCTests = []spanTest{
// okay composed
{"\u00C0", true, 2, nil},
{"abc\u00C0", true, 5, nil},
// correctly ordered combining characters
// TODO: b may combine with modifiers, which is why this fails. We could
// make a more precise test that that actually checks whether last
// characters combines. Probably not worth it.
{"ab\u0300", true, 1, transform.ErrEndOfSpan},
{"ab\u0300cd", true, 1, transform.ErrEndOfSpan},
{"ab\u0316\u0300", true, 1, transform.ErrEndOfSpan},
{"ab\u0316\u0300cd", true, 1, transform.ErrEndOfSpan},
{"\u00C0\u035D", true, 4, nil},
// we do not special case leading combining characters
{"\u0300cd", true, 0, transform.ErrEndOfSpan},
{"\u0300", true, 0, transform.ErrEndOfSpan},
{"\u0316\u0300", true, 0, transform.ErrEndOfSpan},
{"\u0316\u0300cd", true, 0, transform.ErrEndOfSpan},
// incorrectly ordered combining characters
{"ab\u0300\u0316", true, 1, transform.ErrEndOfSpan},
{"ab\u0300\u0316cd", true, 1, transform.ErrEndOfSpan},
// Hangul
{"같은", true, 6, nil},
{"같은", false, 3, transform.ErrShortSrc},
// We return the start of the violating segment in case of overflow.
{grave(30) + "\uff9e", true, 0, transform.ErrEndOfSpan},
{grave(30), true, 0, transform.ErrEndOfSpan},
}
func runSpanTests(t *testing.T, name string, f Form, testCases []spanTest) {
for i, tc := range testCases {
s := fmt.Sprintf("Bytes/%s/%d=%+q/atEOF=%v", name, i, pc(tc.input), tc.atEOF)
ok := testtext.Run(t, s, func(t *testing.T) {
n, err := f.Span([]byte(tc.input), tc.atEOF)
if n != tc.n || err != tc.err {
t.Errorf("\n got %d, %v;\nwant %d, %v", n, err, tc.n, tc.err)
}
})
if !ok {
continue // Don't do the String variant if the Bytes variant failed.
}
s = fmt.Sprintf("String/%s/%d=%+q/atEOF=%v", name, i, pc(tc.input), tc.atEOF)
testtext.Run(t, s, func(t *testing.T) {
n, err := f.SpanString(tc.input, tc.atEOF)
if n != tc.n || err != tc.err {
t.Errorf("\n got %d, %v;\nwant %d, %v", n, err, tc.n, tc.err)
}
})
}
}
func TestSpan(t *testing.T) {
runSpanTests(t, "NFD", NFD, quickSpanTests)
runSpanTests(t, "NFD", NFD, quickSpanNFDTests)
runSpanTests(t, "NFC", NFC, quickSpanTests)
runSpanTests(t, "NFC", NFC, quickSpanNFCTests)
}
var isNormalTests = []PositionTest{
{"", 1, ""},
// illegal runes
{"\xff", 1, ""},
// starters
{"a", 1, ""},
{"abc", 1, ""},
{"\u043Eb", 1, ""},
// incorrectly ordered combining characters
{"\u0300\u0316", 0, ""},
{"ab\u0300\u0316", 0, ""},
{"ab\u0300\u0316cd", 0, ""},
{"\u0300\u0316cd", 0, ""},
}
var isNormalNFDTests = []PositionTest{
// needs decomposing
{"\u00C0", 0, ""},
{"abc\u00C0", 0, ""},
// correctly ordered combining characters
{"\u0300", 1, ""},
{"ab\u0300", 1, ""},
{"ab\u0300cd", 1, ""},
{"\u0300cd", 1, ""},
{"\u0316\u0300", 1, ""},
{"ab\u0316\u0300", 1, ""},
{"ab\u0316\u0300cd", 1, ""},
{"\u0316\u0300cd", 1, ""},
{"\u043E\u0308b", 1, ""},
// Hangul
{"같은", 0, ""},
}
var isNormalNFCTests = []PositionTest{
// okay composed
{"\u00C0", 1, ""},
{"abc\u00C0", 1, ""},
// need reordering
{"a\u0300", 0, ""},
{"a\u0300cd", 0, ""},
{"a\u0316\u0300", 0, ""},
{"a\u0316\u0300cd", 0, ""},
// correctly ordered combining characters
{"ab\u0300", 1, ""},
{"ab\u0300cd", 1, ""},
{"ab\u0316\u0300", 1, ""},
{"ab\u0316\u0300cd", 1, ""},
{"\u00C0\u035D", 1, ""},
{"\u0300", 1, ""},
{"\u0316\u0300cd", 1, ""},
// Hangul
{"같은", 1, ""},
}
var isNormalNFKXTests = []PositionTest{
// Special case.
{"\u00BC", 0, ""},
}
func isNormalF(rb *reorderBuffer, s string) (int, []byte) {
if rb.f.form.IsNormal([]byte(s)) {
return 1, nil
}
return 0, nil
}
func isNormalStringF(rb *reorderBuffer, s string) (int, []byte) {
if rb.f.form.IsNormalString(s) {
return 1, nil
}
return 0, nil
}
func TestIsNormal(t *testing.T) {
runPosTests(t, "TestIsNormalNFD1", NFD, isNormalF, isNormalTests)
runPosTests(t, "TestIsNormalNFD2", NFD, isNormalF, isNormalNFDTests)
runPosTests(t, "TestIsNormalNFC1", NFC, isNormalF, isNormalTests)
runPosTests(t, "TestIsNormalNFC2", NFC, isNormalF, isNormalNFCTests)
runPosTests(t, "TestIsNormalNFKD1", NFKD, isNormalF, isNormalTests)
runPosTests(t, "TestIsNormalNFKD2", NFKD, isNormalF, isNormalNFDTests)
runPosTests(t, "TestIsNormalNFKD3", NFKD, isNormalF, isNormalNFKXTests)
runPosTests(t, "TestIsNormalNFKC1", NFKC, isNormalF, isNormalTests)
runPosTests(t, "TestIsNormalNFKC2", NFKC, isNormalF, isNormalNFCTests)
runPosTests(t, "TestIsNormalNFKC3", NFKC, isNormalF, isNormalNFKXTests)
}
func TestIsNormalString(t *testing.T) {
runPosTests(t, "TestIsNormalNFD1", NFD, isNormalStringF, isNormalTests)
runPosTests(t, "TestIsNormalNFD2", NFD, isNormalStringF, isNormalNFDTests)
runPosTests(t, "TestIsNormalNFC1", NFC, isNormalStringF, isNormalTests)
runPosTests(t, "TestIsNormalNFC2", NFC, isNormalStringF, isNormalNFCTests)
}
type AppendTest struct {
left string
right string
out string
}
type appendFunc func(f Form, out []byte, s string) []byte
var fstr = []string{"NFC", "NFD", "NFKC", "NFKD"}
func runNormTests(t *testing.T, name string, fn appendFunc) {
for f := NFC; f <= NFKD; f++ {
runAppendTests(t, name, f, fn, normTests[f])
}
}
func runAppendTests(t *testing.T, name string, f Form, fn appendFunc, tests []AppendTest) {
for i, test := range tests {
t.Run(fmt.Sprintf("%s/%d", fstr[f], i), func(t *testing.T) {
id := pc(test.left + test.right)
if *testn >= 0 && i != *testn {
return
}
t.Run("fn", func(t *testing.T) {
out := []byte(test.left)
have := string(fn(f, out, test.right))
if len(have) != len(test.out) {
t.Errorf("%+q: length is %d; want %d (%+q vs %+q)", id, len(have), len(test.out), pc(have), pc(test.out))
}
if have != test.out {
k, pf := pidx(have, test.out)
t.Errorf("%+q:\nwas %s%+q; \nwant %s%+q", id, pf, pc(have[k:]), pf, pc(test.out[k:]))
}
})
// Bootstrap by normalizing input. Ensures that the various variants
// behave the same.
for g := NFC; g <= NFKD; g++ {
if f == g {
continue
}
t.Run(fstr[g], func(t *testing.T) {
want := g.String(test.left + test.right)
have := string(fn(g, g.AppendString(nil, test.left), test.right))
if len(have) != len(want) {
t.Errorf("%+q: length is %d; want %d (%+q vs %+q)", id, len(have), len(want), pc(have), pc(want))
}
if have != want {
k, pf := pidx(have, want)
t.Errorf("%+q:\nwas %s%+q; \nwant %s%+q", id, pf, pc(have[k:]), pf, pc(want[k:]))
}
})
}
})
}
}
var normTests = [][]AppendTest{
appendTestsNFC,
appendTestsNFD,
appendTestsNFKC,
appendTestsNFKD,
}
var appendTestsNFC = []AppendTest{
{"", ascii, ascii},
{"", txt_all, txt_all},
{"\uff9e", grave(30), "\uff9e" + grave(29) + cgj + grave(1)},
{grave(30), "\uff9e", grave(30) + cgj + "\uff9e"},
// Tests designed for Iter.
{ // ordering of non-composing combining characters
"",
"\u0305\u0316",
"\u0316\u0305",
},
{ // segment overflow
"",
"a" + rep(0x0305, maxNonStarters+4) + "\u0316",
"a" + rep(0x0305, maxNonStarters) + cgj + "\u0316" + rep(0x305, 4),
},
{ // Combine across non-blocking non-starters.
// U+0327 COMBINING CEDILLA;Mn;202;NSM;;;;;N;NON-SPACING CEDILLA;;;;
// U+0325 COMBINING RING BELOW;Mn;220;NSM;;;;;N;NON-SPACING RING BELOW;;;;
"", "a\u0327\u0325", "\u1e01\u0327",
},
{ // Jamo V+T does not combine.
"",
"\u1161\u11a8",
"\u1161\u11a8",
},
// Stability tests: see http://www.unicode.org/review/pr-29.html.
{"", "\u0b47\u0300\u0b3e", "\u0b47\u0300\u0b3e"},
{"", "\u1100\u0300\u1161", "\u1100\u0300\u1161"},
{"", "\u0b47\u0b3e", "\u0b4b"},
{"", "\u1100\u1161", "\uac00"},
// U+04DA MALAYALAM VOWEL SIGN O;Mc;0;L;0D46 0D3E;;;;N;;;;;
{ // 0d4a starts a new segment.
"",
"\u0d4a" + strings.Repeat("\u0d3e", 15) + "\u0d4a" + strings.Repeat("\u0d3e", 15),
"\u0d4a" + strings.Repeat("\u0d3e", 15) + "\u0d4a" + strings.Repeat("\u0d3e", 15),
},
{ // Split combining characters.
// TODO: don't insert CGJ before starters.
"",
"\u0d46" + strings.Repeat("\u0d3e", 31),
"\u0d4a" + strings.Repeat("\u0d3e", 29) + cgj + "\u0d3e",
},
{ // Split combining characters.
"",
"\u0d4a" + strings.Repeat("\u0d3e", 30),
"\u0d4a" + strings.Repeat("\u0d3e", 29) + cgj + "\u0d3e",
},
{ // https://golang.org/issues/20079
"",
"\xeb\u0344",
"\xeb\u0308\u0301",
},
{ // https://golang.org/issues/20079
"",
"\uac00" + strings.Repeat("\u0300", 30),
"\uac00" + strings.Repeat("\u0300", 29) + "\u034f\u0300",
},
{ // https://golang.org/issues/20079
"",
"\xeb" + strings.Repeat("\u0300", 31),
"\xeb" + strings.Repeat("\u0300", 30) + "\u034f\u0300",
},
}
var appendTestsNFD = []AppendTest{
// TODO: Move some of the tests here.
}
var appendTestsNFKC = []AppendTest{
// empty buffers
{"", "", ""},
{"a", "", "a"},
{"", "a", "a"},
{"", "\u0041\u0307\u0304", "\u01E0"},
// segment split across buffers
{"", "a\u0300b", "\u00E0b"},
{"a", "\u0300b", "\u00E0b"},
{"a", "\u0300\u0316", "\u00E0\u0316"},
{"a", "\u0316\u0300", "\u00E0\u0316"},
{"a", "\u0300a\u0300", "\u00E0\u00E0"},
{"a", "\u0300a\u0300a\u0300", "\u00E0\u00E0\u00E0"},
{"a", "\u0300aaa\u0300aaa\u0300", "\u00E0aa\u00E0aa\u00E0"},
{"a\u0300", "\u0327", "\u00E0\u0327"},
{"a\u0327", "\u0300", "\u00E0\u0327"},
{"a\u0316", "\u0300", "\u00E0\u0316"},
{"\u0041\u0307", "\u0304", "\u01E0"},
// Hangul
{"", "\u110B\u1173", "\uC73C"},
{"", "\u1103\u1161", "\uB2E4"},
{"", "\u110B\u1173\u11B7", "\uC74C"},
{"", "\u320E", "\x28\uAC00\x29"},
{"", "\x28\u1100\u1161\x29", "\x28\uAC00\x29"},
{"\u1103", "\u1161", "\uB2E4"},
{"\u110B", "\u1173\u11B7", "\uC74C"},
{"\u110B\u1173", "\u11B7", "\uC74C"},
{"\uC73C", "\u11B7", "\uC74C"},
// UTF-8 encoding split across buffers
{"a\xCC", "\x80", "\u00E0"},
{"a\xCC", "\x80b", "\u00E0b"},
{"a\xCC", "\x80a\u0300", "\u00E0\u00E0"},
{"a\xCC", "\x80\x80", "\u00E0\x80"},
{"a\xCC", "\x80\xCC", "\u00E0\xCC"},
{"a\u0316\xCC", "\x80a\u0316\u0300", "\u00E0\u0316\u00E0\u0316"},
// ending in incomplete UTF-8 encoding
{"", "\xCC", "\xCC"},
{"a", "\xCC", "a\xCC"},
{"a", "b\xCC", "ab\xCC"},
{"\u0226", "\xCC", "\u0226\xCC"},
// illegal runes
{"", "\x80", "\x80"},
{"", "\x80\x80\x80", "\x80\x80\x80"},
{"", "\xCC\x80\x80\x80", "\xCC\x80\x80\x80"},
{"", "a\x80", "a\x80"},
{"", "a\x80\x80\x80", "a\x80\x80\x80"},
{"", "a\x80\x80\x80\x80\x80\x80", "a\x80\x80\x80\x80\x80\x80"},
{"a", "\x80\x80\x80", "a\x80\x80\x80"},
// overflow
{"", strings.Repeat("\x80", 33), strings.Repeat("\x80", 33)},
{strings.Repeat("\x80", 33), "", strings.Repeat("\x80", 33)},
{strings.Repeat("\x80", 33), strings.Repeat("\x80", 33), strings.Repeat("\x80", 66)},
// overflow of combining characters
{"", grave(34), grave(30) + cgj + grave(4)},
{"", grave(36), grave(30) + cgj + grave(6)},
{grave(29), grave(5), grave(30) + cgj + grave(4)},
{grave(30), grave(4), grave(30) + cgj + grave(4)},
{grave(30), grave(3), grave(30) + cgj + grave(3)},
{grave(30) + "\xCC", "\x80", grave(30) + cgj + grave(1)},
{"", "\uFDFA" + grave(14), "\u0635\u0644\u0649 \u0627\u0644\u0644\u0647 \u0639\u0644\u064a\u0647 \u0648\u0633\u0644\u0645" + grave(14)},
{"", "\uFDFA" + grave(28) + "\u0316", "\u0635\u0644\u0649 \u0627\u0644\u0644\u0647 \u0639\u0644\u064a\u0647 \u0648\u0633\u0644\u0645\u0316" + grave(28)},
// - First rune has a trailing non-starter.
{"\u00d5", grave(30), "\u00d5" + grave(29) + cgj + grave(1)},
// - U+FF9E decomposes into a non-starter in compatibility mode. A CGJ must be
// inserted even when FF9E starts a new segment.
{"\uff9e", grave(30), "\u3099" + grave(29) + cgj + grave(1)},
{grave(30), "\uff9e", grave(30) + cgj + "\u3099"},
// - Many non-starter decompositions in a row causing overflow.
{"", rep(0x340, 31), rep(0x300, 30) + cgj + "\u0300"},
{"", rep(0xFF9E, 31), rep(0x3099, 30) + cgj + "\u3099"},
{"", "\u0644\u0625" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + "\u0300\u0300"},
{"", "\ufef9" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + rep(0x0300, 2)},
{"", "\ufef9" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + rep(0x0300, 2)},
// U+0F81 TIBETAN VOWEL SIGN REVERSED II splits into two modifiers.
{"", "\u0f7f" + rep(0xf71, 29) + "\u0f81", "\u0f7f" + rep(0xf71, 29) + cgj + "\u0f71\u0f80"},
{"", "\u0f7f" + rep(0xf71, 28) + "\u0f81", "\u0f7f" + rep(0xf71, 29) + "\u0f80"},
{"", "\u0f7f" + rep(0xf81, 16), "\u0f7f" + rep(0xf71, 15) + rep(0xf80, 15) + cgj + "\u0f71\u0f80"},
// weird UTF-8
{"\u00E0\xE1", "\x86", "\u00E0\xE1\x86"},
{"a\u0300\u11B7", "\u0300", "\u00E0\u11B7\u0300"},
{"a\u0300\u11B7\u0300", "\u0300", "\u00E0\u11B7\u0300\u0300"},
{"\u0300", "\xF8\x80\x80\x80\x80\u0300", "\u0300\xF8\x80\x80\x80\x80\u0300"},
{"\u0300", "\xFC\x80\x80\x80\x80\x80\u0300", "\u0300\xFC\x80\x80\x80\x80\x80\u0300"},
{"\xF8\x80\x80\x80\x80\u0300", "\u0300", "\xF8\x80\x80\x80\x80\u0300\u0300"},
{"\xFC\x80\x80\x80\x80\x80\u0300", "\u0300", "\xFC\x80\x80\x80\x80\x80\u0300\u0300"},
{"\xF8\x80\x80\x80", "\x80\u0300\u0300", "\xF8\x80\x80\x80\x80\u0300\u0300"},
{"", strings.Repeat("a\u0316\u0300", 6), strings.Repeat("\u00E0\u0316", 6)},
// large input.
{"", strings.Repeat("a\u0300\u0316", 31), strings.Repeat("\u00E0\u0316", 31)},
{"", strings.Repeat("a\u0300\u0316", 4000), strings.Repeat("\u00E0\u0316", 4000)},
{"", strings.Repeat("\x80\x80", 4000), strings.Repeat("\x80\x80", 4000)},
{"", "\u0041\u0307\u0304", "\u01E0"},
}
var appendTestsNFKD = []AppendTest{
{"", "a" + grave(64), "a" + grave(30) + cgj + grave(30) + cgj + grave(4)},
{ // segment overflow on unchanged character
"",
"a" + grave(64) + "\u0316",
"a" + grave(30) + cgj + grave(30) + cgj + "\u0316" + grave(4),
},
{ // segment overflow on unchanged character + start value
"",
"a" + grave(98) + "\u0316",
"a" + grave(30) + cgj + grave(30) + cgj + grave(30) + cgj + "\u0316" + grave(8),
},
{ // segment overflow on decomposition. (U+0340 decomposes to U+0300.)
"",
"a" + grave(59) + "\u0340",
"a" + grave(30) + cgj + grave(30),
},
{ // segment overflow on non-starter decomposition
"",
"a" + grave(33) + "\u0340" + grave(30) + "\u0320",
"a" + grave(30) + cgj + grave(30) + cgj + "\u0320" + grave(4),
},
{ // start value after ASCII overflow
"",
rep('a', segSize) + grave(32) + "\u0320",
rep('a', segSize) + grave(30) + cgj + "\u0320" + grave(2),
},
{ // Jamo overflow
"",
"\u1100\u1161" + grave(30) + "\u0320" + grave(2),
"\u1100\u1161" + grave(29) + cgj + "\u0320" + grave(3),
},
{ // Hangul
"",
"\uac00",
"\u1100\u1161",
},
{ // Hangul overflow
"",
"\uac00" + grave(32) + "\u0320",
"\u1100\u1161" + grave(29) + cgj + "\u0320" + grave(3),
},
{ // Hangul overflow in Hangul mode.
"",
"\uac00\uac00" + grave(32) + "\u0320",
"\u1100\u1161\u1100\u1161" + grave(29) + cgj + "\u0320" + grave(3),
},
{ // Hangul overflow in Hangul mode.
"",
strings.Repeat("\uac00", 3) + grave(32) + "\u0320",
strings.Repeat("\u1100\u1161", 3) + grave(29) + cgj + "\u0320" + grave(3),
},
{ // start value after cc=0
"",
"您您" + grave(34) + "\u0320",
"您您" + grave(30) + cgj + "\u0320" + grave(4),
},
{ // start value after normalization
"",
"\u0300\u0320a" + grave(34) + "\u0320",
"\u0320\u0300a" + grave(30) + cgj + "\u0320" + grave(4),
},
{
// U+0F81 TIBETAN VOWEL SIGN REVERSED II splits into two modifiers.
"",
"a\u0f7f" + rep(0xf71, 29) + "\u0f81",
"a\u0f7f" + rep(0xf71, 29) + cgj + "\u0f71\u0f80",
},
}
func TestAppend(t *testing.T) {
runNormTests(t, "Append", func(f Form, out []byte, s string) []byte {
return f.Append(out, []byte(s)...)
})
}
func TestAppendString(t *testing.T) {
runNormTests(t, "AppendString", func(f Form, out []byte, s string) []byte {
return f.AppendString(out, s)
})
}
func TestBytes(t *testing.T) {
runNormTests(t, "Bytes", func(f Form, out []byte, s string) []byte {
buf := []byte{}
buf = append(buf, out...)
buf = append(buf, s...)
return f.Bytes(buf)
})
}
func TestString(t *testing.T) {
runNormTests(t, "String", func(f Form, out []byte, s string) []byte {
outs := string(out) + s
return []byte(f.String(outs))
})
}
func TestLinking(t *testing.T) {
const prog = `
package main
import "fmt"
import "golang.org/x/text/unicode/norm"
func main() { fmt.Println(norm.%s) }
`
baseline, errB := testtext.CodeSize(fmt.Sprintf(prog, "MaxSegmentSize"))
withTables, errT := testtext.CodeSize(fmt.Sprintf(prog, `NFC.String("")`))
if errB != nil || errT != nil {
t.Skipf("code size failed: %v and %v", errB, errT)
}
// Tables are at least 50K
if d := withTables - baseline; d < 50*1024 {
t.Errorf("tables appear not to be dropped: %d - %d = %d",
withTables, baseline, d)
}
}
func appendBench(f Form, in []byte) func() {
buf := make([]byte, 0, 4*len(in))
return func() {
f.Append(buf, in...)
}
}
func bytesBench(f Form, in []byte) func() {
return func() {
f.Bytes(in)
}
}
func iterBench(f Form, in []byte) func() {
iter := Iter{}
return func() {
iter.Init(f, in)
for !iter.Done() {
iter.Next()
}
}
}
func transformBench(f Form, in []byte) func() {
buf := make([]byte, 4*len(in))
return func() {
if _, n, err := f.Transform(buf, in, true); err != nil || len(in) != n {
log.Panic(n, len(in), err)
}
}
}
func readerBench(f Form, in []byte) func() {
buf := make([]byte, 4*len(in))
return func() {
r := f.Reader(bytes.NewReader(in))
var err error
for err == nil {
_, err = r.Read(buf)
}
if err != io.EOF {
panic("")
}
}
}
func writerBench(f Form, in []byte) func() {
buf := make([]byte, 0, 4*len(in))
return func() {
r := f.Writer(bytes.NewBuffer(buf))
if _, err := r.Write(in); err != nil {
panic("")
}
}
}
func appendBenchmarks(bm []func(), f Form, in []byte) []func() {
bm = append(bm, appendBench(f, in))
bm = append(bm, iterBench(f, in))
bm = append(bm, transformBench(f, in))
bm = append(bm, readerBench(f, in))
bm = append(bm, writerBench(f, in))
return bm
}
func doFormBenchmark(b *testing.B, inf, f Form, s string) {
b.StopTimer()
in := inf.Bytes([]byte(s))
bm := appendBenchmarks(nil, f, in)
b.SetBytes(int64(len(in) * len(bm)))
b.StartTimer()
for i := 0; i < b.N; i++ {
for _, fn := range bm {
fn()
}
}
}
func doSingle(b *testing.B, f func(Form, []byte) func(), s []byte) {
b.StopTimer()
fn := f(NFC, s)
b.SetBytes(int64(len(s)))
b.StartTimer()
for i := 0; i < b.N; i++ {
fn()
}
}
var (
smallNoChange = []byte("nörmalization")
smallChange = []byte("No\u0308rmalization")
ascii = strings.Repeat("There is nothing to change here! ", 500)
)
func lowerBench(f Form, in []byte) func() {
// Use package strings instead of bytes as it doesn't allocate memory
// if there aren't any changes.
s := string(in)
return func() {
strings.ToLower(s)
}
}
func BenchmarkLowerCaseNoChange(b *testing.B) {
doSingle(b, lowerBench, smallNoChange)
}
func BenchmarkLowerCaseChange(b *testing.B) {
doSingle(b, lowerBench, smallChange)
}
func quickSpanBench(f Form, in []byte) func() {
return func() {
f.QuickSpan(in)
}
}
func BenchmarkQuickSpanChangeNFC(b *testing.B) {
doSingle(b, quickSpanBench, smallNoChange)
}
func BenchmarkBytesNoChangeNFC(b *testing.B) {
doSingle(b, bytesBench, smallNoChange)
}
func BenchmarkBytesChangeNFC(b *testing.B) {
doSingle(b, bytesBench, smallChange)
}
func BenchmarkAppendNoChangeNFC(b *testing.B) {
doSingle(b, appendBench, smallNoChange)
}
func BenchmarkAppendChangeNFC(b *testing.B) {
doSingle(b, appendBench, smallChange)
}
func BenchmarkAppendLargeNFC(b *testing.B) {
doSingle(b, appendBench, txt_all_bytes)
}
func BenchmarkIterNoChangeNFC(b *testing.B) {
doSingle(b, iterBench, smallNoChange)
}
func BenchmarkIterChangeNFC(b *testing.B) {
doSingle(b, iterBench, smallChange)
}
func BenchmarkIterLargeNFC(b *testing.B) {
doSingle(b, iterBench, txt_all_bytes)
}
func BenchmarkTransformNoChangeNFC(b *testing.B) {
doSingle(b, transformBench, smallNoChange)
}
func BenchmarkTransformChangeNFC(b *testing.B) {
doSingle(b, transformBench, smallChange)
}
func BenchmarkTransformLargeNFC(b *testing.B) {
doSingle(b, transformBench, txt_all_bytes)
}
func BenchmarkNormalizeAsciiNFC(b *testing.B) {
doFormBenchmark(b, NFC, NFC, ascii)
}
func BenchmarkNormalizeAsciiNFD(b *testing.B) {
doFormBenchmark(b, NFC, NFD, ascii)
}
func BenchmarkNormalizeAsciiNFKC(b *testing.B) {
doFormBenchmark(b, NFC, NFKC, ascii)
}
func BenchmarkNormalizeAsciiNFKD(b *testing.B) {
doFormBenchmark(b, NFC, NFKD, ascii)
}
func BenchmarkNormalizeNFC2NFC(b *testing.B) {
doFormBenchmark(b, NFC, NFC, txt_all)
}
func BenchmarkNormalizeNFC2NFD(b *testing.B) {
doFormBenchmark(b, NFC, NFD, txt_all)
}
func BenchmarkNormalizeNFD2NFC(b *testing.B) {
doFormBenchmark(b, NFD, NFC, txt_all)
}
func BenchmarkNormalizeNFD2NFD(b *testing.B) {
doFormBenchmark(b, NFD, NFD, txt_all)
}
// Hangul is often special-cased, so we test it separately.
func BenchmarkNormalizeHangulNFC2NFC(b *testing.B) {
doFormBenchmark(b, NFC, NFC, txt_kr)
}
func BenchmarkNormalizeHangulNFC2NFD(b *testing.B) {
doFormBenchmark(b, NFC, NFD, txt_kr)
}
func BenchmarkNormalizeHangulNFD2NFC(b *testing.B) {
doFormBenchmark(b, NFD, NFC, txt_kr)
}
func BenchmarkNormalizeHangulNFD2NFD(b *testing.B) {
doFormBenchmark(b, NFD, NFD, txt_kr)
}
var forms = []Form{NFC, NFD, NFKC, NFKD}
func doTextBenchmark(b *testing.B, s string) {
b.StopTimer()
in := []byte(s)
bm := []func(){}
for _, f := range forms {
bm = appendBenchmarks(bm, f, in)
}
b.SetBytes(int64(len(s) * len(bm)))
b.StartTimer()
for i := 0; i < b.N; i++ {
for _, f := range bm {
f()
}
}
}
func BenchmarkCanonicalOrdering(b *testing.B) {
doTextBenchmark(b, txt_canon)
}
func BenchmarkExtendedLatin(b *testing.B) {
doTextBenchmark(b, txt_vn)
}
func BenchmarkMiscTwoByteUtf8(b *testing.B) {
doTextBenchmark(b, twoByteUtf8)
}
func BenchmarkMiscThreeByteUtf8(b *testing.B) {
doTextBenchmark(b, threeByteUtf8)
}
func BenchmarkHangul(b *testing.B) {
doTextBenchmark(b, txt_kr)
}
func BenchmarkJapanese(b *testing.B) {
doTextBenchmark(b, txt_jp)
}
func BenchmarkChinese(b *testing.B) {
doTextBenchmark(b, txt_cn)
}
func BenchmarkOverflow(b *testing.B) {
doTextBenchmark(b, overflow)
}
var overflow = string(bytes.Repeat([]byte("\u035D"), 4096)) + "\u035B"
// Tests sampled from the Canonical ordering tests (Part 2) of
// http://unicode.org/Public/UNIDATA/NormalizationTest.txt
const txt_canon = `\u0061\u0315\u0300\u05AE\u0300\u0062 \u0061\u0300\u0315\u0300\u05AE\u0062
\u0061\u0302\u0315\u0300\u05AE\u0062 \u0061\u0307\u0315\u0300\u05AE\u0062
\u0061\u0315\u0300\u05AE\u030A\u0062 \u0061\u059A\u0316\u302A\u031C\u0062
\u0061\u032E\u059A\u0316\u302A\u0062 \u0061\u0338\u093C\u0334\u0062
\u0061\u059A\u0316\u302A\u0339 \u0061\u0341\u0315\u0300\u05AE\u0062
\u0061\u0348\u059A\u0316\u302A\u0062 \u0061\u0361\u0345\u035D\u035C\u0062
\u0061\u0366\u0315\u0300\u05AE\u0062 \u0061\u0315\u0300\u05AE\u0486\u0062
\u0061\u05A4\u059A\u0316\u302A\u0062 \u0061\u0315\u0300\u05AE\u0613\u0062
\u0061\u0315\u0300\u05AE\u0615\u0062 \u0061\u0617\u0315\u0300\u05AE\u0062
\u0061\u0619\u0618\u064D\u064E\u0062 \u0061\u0315\u0300\u05AE\u0654\u0062
\u0061\u0315\u0300\u05AE\u06DC\u0062 \u0061\u0733\u0315\u0300\u05AE\u0062
\u0061\u0744\u059A\u0316\u302A\u0062 \u0061\u0315\u0300\u05AE\u0745\u0062
\u0061\u09CD\u05B0\u094D\u3099\u0062 \u0061\u0E38\u0E48\u0E38\u0C56\u0062
\u0061\u0EB8\u0E48\u0E38\u0E49\u0062 \u0061\u0F72\u0F71\u0EC8\u0F71\u0062
\u0061\u1039\u05B0\u094D\u3099\u0062 \u0061\u05B0\u094D\u3099\u1A60\u0062
\u0061\u3099\u093C\u0334\u1BE6\u0062 \u0061\u3099\u093C\u0334\u1C37\u0062
\u0061\u1CD9\u059A\u0316\u302A\u0062 \u0061\u2DED\u0315\u0300\u05AE\u0062
\u0061\u2DEF\u0315\u0300\u05AE\u0062 \u0061\u302D\u302E\u059A\u0316\u0062`
// Taken from http://creativecommons.org/licenses/by-sa/3.0/vn/
const txt_vn = `Với các điều kiện sau: Ghi nhận công của tác giả.
Nếu bạn sử dụng, chuyển đổi, hoặc xây dựng dự án từ
nội dung được chia sẻ này, bạn phải áp dụng giấy phép này hoặc
một giấy phép khác có các điều khoản tương tự như giấy phép này
cho dự án của bạn. Hiểu rằng: Miễn — Bất kỳ các điều kiện nào
trên đây cũng có thể được miễn bỏ nếu bạn được sự cho phép của
người sở hữu bản quyền. Phạm vi công chúng — Khi tác phẩm hoặc
bất kỳ chương nào của tác phẩm đã trong vùng dành cho công
chúng theo quy định của pháp luật thì tình trạng của nó không
bị ảnh hưởng bởi giấy phép trong bất kỳ trường hợp nào.`
// Taken from http://creativecommons.org/licenses/by-sa/1.0/deed.ru
const txt_ru = `При обязательном соблюдении следующих условий:
Attribution — Вы должны атрибутировать произведение (указывать
автора и источник) в порядке, предусмотренном автором или
лицензиаром (но только так, чтобы никоим образом не подразумевалось,
что они поддерживают вас или использование вами данного произведения).
Υπό τις ακόλουθες προϋποθέσεις:`
// Taken from http://creativecommons.org/licenses/by-sa/3.0/gr/
const txt_gr = `Αναφορά Δημιουργού — Θα πρέπει να κάνετε την αναφορά στο έργο με τον
τρόπο που έχει οριστεί από το δημιουργό ή το χορηγούντο την άδεια
(χωρίς όμως να εννοείται με οποιονδήποτε τρόπο ότι εγκρίνουν εσάς ή
τη χρήση του έργου από εσάς). Παρόμοια Διανομή — Εάν αλλοιώσετε,
τροποποιήσετε ή δημιουργήσετε περαιτέρω βασισμένοι στο έργο θα
μπορείτε να διανέμετε το έργο που θα προκύψει μόνο με την ίδια ή
παρόμοια άδεια.`
// Taken from http://creativecommons.org/licenses/by-sa/3.0/deed.ar
const txt_ar = `بموجب الشروط التالية نسب المصنف — يجب عليك أن
تنسب العمل بالطريقة التي تحددها المؤلف أو المرخص (ولكن ليس بأي حال من
الأحوال أن توحي وتقترح بتحول أو استخدامك للعمل).
المشاركة على قدم المساواة — إذا كنت يعدل ، والتغيير ، أو الاستفادة
من هذا العمل ، قد ينتج عن توزيع العمل إلا في ظل تشابه او تطابق فى واحد
لهذا الترخيص.`
// Taken from http://creativecommons.org/licenses/by-sa/1.0/il/
const txt_il = `בכפוף לתנאים הבאים: ייחוס — עליך לייחס את היצירה (לתת קרדיט) באופן
המצויין על-ידי היוצר או מעניק הרישיון (אך לא בשום אופן המרמז על כך
שהם תומכים בך או בשימוש שלך ביצירה). שיתוף זהה — אם תחליט/י לשנות,
לעבד או ליצור יצירה נגזרת בהסתמך על יצירה זו, תוכל/י להפיץ את יצירתך
החדשה רק תחת אותו הרישיון או רישיון דומה לרישיון זה.`
const twoByteUtf8 = txt_ru + txt_gr + txt_ar + txt_il
// Taken from http://creativecommons.org/licenses/by-sa/2.0/kr/
const txt_kr = `다음과 같은 조건을 따라야 합니다: 저작자표시
(Attribution) — 저작자나 이용허락자가 정한 방법으로 저작물의
원저작자를 표시하여야 합니다(그러나 원저작자가 이용자나 이용자의
이용을 보증하거나 추천한다는 의미로 표시해서는 안됩니다).
동일조건변경허락 — 이 저작물을 이용하여 만든 이차적 저작물에는 본
라이선스와 동일한 라이선스를 적용해야 합니다.`
// Taken from http://creativecommons.org/licenses/by-sa/3.0/th/
const txt_th = `ภายใต้เงื่อนไข ดังต่อไปนี้ : แสดงที่มา — คุณต้องแสดงที่
มาของงานดังกล่าว ตามรูปแบบที่ผู้สร้างสรรค์หรือผู้อนุญาตกำหนด (แต่
ไม่ใช่ในลักษณะที่ว่า พวกเขาสนับสนุนคุณหรือสนับสนุนการที่
คุณนำงานไปใช้) อนุญาตแบบเดียวกัน — หากคุณดัดแปลง เปลี่ยนรูป หรื
อต่อเติมงานนี้ คุณต้องใช้สัญญาอนุญาตแบบเดียวกันหรือแบบที่เหมื
อนกับสัญญาอนุญาตที่ใช้กับงานนี้เท่านั้น`
const threeByteUtf8 = txt_th
// Taken from http://creativecommons.org/licenses/by-sa/2.0/jp/
const txt_jp = `あなたの従うべき条件は以下の通りです。
表示 — あなたは原著作者のクレジットを表示しなければなりません。
継承 — もしあなたがこの作品を改変、変形または加工した場合、
あなたはその結果生じた作品をこの作品と同一の許諾条件の下でのみ
頒布することができます。`
// http://creativecommons.org/licenses/by-sa/2.5/cn/
const txt_cn = `您可以自由: 复制、发行、展览、表演、放映、
广播或通过信息网络传播本作品 创作演绎作品
对本作品进行商业性使用 惟须遵守下列条件:
署名 — 您必须按照作者或者许可人指定的方式对作品进行署名。
相同方式共享 — 如果您改变、转换本作品或者以本作品为基础进行创作,
您只能采用与本协议相同的许可协议发布基于本作品的演绎作品。`
const txt_cjk = txt_cn + txt_jp + txt_kr
const txt_all = txt_vn + twoByteUtf8 + threeByteUtf8 + txt_cjk
var txt_all_bytes = []byte(txt_all)
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.