text
stringlengths 2
100k
| meta
dict |
---|---|
#ifndef __E820MAP_H
#define __E820MAP_H
#include "types.h" // u64
#define E820_RAM 1
#define E820_RESERVED 2
#define E820_ACPI 3
#define E820_NVS 4
#define E820_UNUSABLE 5
#define E820_HOLE ((u32)-1) // Useful for removing entries
struct e820entry {
u64 start;
u64 size;
u32 type;
};
void add_e820(u64 start, u64 size, u32 type);
void memmap_finalize(void);
// A typical OS page size
#define PAGE_SIZE 4096
// e820 map storage (defined in system.c)
extern struct e820entry e820_list[];
extern int e820_count;
// Space for exported bios tables (defined in misc.c)
extern char BiosTableSpace[];
#endif // e820map.h
| {
"pile_set_name": "Github"
} |
* Header with checkboxes
- [ ] Box A
- [ ] Box B
- [X] Box C
* Another header [1/3]
- [X] Box D
- [-] Box E [50%]
- [ ] Box G
- [ ] Box H
- [X] Box I
- [-] Box J
- [ ] Box K
- [-] Box L
- [ ] Box M
- [X] Box N
- [ ] Box O
- Not a checkbox
| {
"pile_set_name": "Github"
} |
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2020 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
describe('Text Inline Popup plugin', function () {
describe('Image', function () {
describe('Click on the image', function () {
it('Should Open inline popup', function () {
const editor = getJodit();
editor.value = '<img alt="" src="../artio.jpg"/>';
editor.s.focus();
simulateEvent('click', editor.editor.querySelector('img'));
const popup = getOpenedPopup(editor);
expect(popup && popup.parentNode.parentNode !== null).equals(
true
);
});
describe('and click in opened popup on pencil button', function () {
it('Should Open edit image dialog', function () {
const editor = getJodit();
editor.value = '<img alt="" src="../artio.jpg"/>';
editor.s.focus();
simulateEvent(
'click',
0,
editor.editor.querySelector('img')
);
const popup = getOpenedPopup(editor);
expect(popup && popup.parentNode.parentNode !== null).is
.true;
clickButton('pencil', popup);
const dialog = editor.ownerDocument.querySelector(
'.jodit.jodit-dialog__box[data-editor_id=' +
editor.id +
']'
);
expect(dialog).is.not.null;
});
});
});
});
describe('Link', function () {
describe('Click on the link', function () {
it('Should Open inline popup', function () {
const editor = getJodit();
editor.value = '<a href="../artio.jpg"/>test</a>';
simulateEvent('click', editor.editor.querySelector('a'));
const popup = getOpenedPopup(editor);
expect(popup && popup.parentNode.parentNode !== null).equals(
true
);
});
describe('and click in opened popup on pencil button', function () {
it('Should Open edit link dialog', function () {
const editor = getJodit();
editor.value = '<a href="../artio.jpg"/>test</a>';
simulateEvent('click', editor.editor.querySelector('a'));
const popup = getOpenedPopup(editor);
expect(popup && popup.parentNode.parentNode !== null).is
.true;
clickButton('link', popup);
const linkEditor = getOpenedPopup(editor);
expect(linkEditor).is.not.null;
expect(
linkEditor.querySelector('[data-ref="url_input"]').value
).equals('../artio.jpg');
});
describe('on different links', function () {
it('Should Open edit link dialog with different values', function () {
const editor = getJodit();
editor.value =
'<a href="#test1"/>test</a><br>' +
'<a href="#test2"/>test</a>';
simulateEvent(
'click',
editor.editor.querySelector('a')
);
const popup = getOpenedPopup(editor);
clickButton('link', popup);
const linkEditor = getOpenedPopup(editor);
expect(
linkEditor.querySelector('[data-ref="url_input"]').value
).equals('#test1');
simulateEvent(
['mousedown', 'mouseup', 'click'],
editor.editor.querySelectorAll('a')[1]
);
const popup2 = getOpenedPopup(editor);
clickButton('link', popup2);
const linkEditor2 = getOpenedPopup(editor);
expect(
linkEditor2.querySelector('[data-ref="url_input"]').value
).equals('#test2');
});
});
});
});
});
describe('Table', function () {
describe('Table button', function () {
describe('Select table cell', function () {
it('Should Select table cell', function () {
const editor = getJodit();
editor.value =
'<table>' + '<tr><td>2</td></tr>' + '</table>';
const td = editor.editor.querySelector('td'),
pos = Jodit.modules.Helpers.position(td);
simulateEvent(
['mousedown', 'mouseup', 'click'],
0,
td,
e => {
Object.assign(e, {
clientX: pos.left,
clientY: pos.top
});
}
);
expect([td]).deep.equals(
editor.getInstance('Table').getAllSelectedCells()
);
});
describe('and press brush button', function () {
it('Should Select table cell and fill it in yellow', function () {
const editor = getJodit();
editor.value =
'<table>' + '<tr><td>3</td></tr>' + '</table>';
const td = editor.editor.querySelector('td'),
pos = Jodit.modules.Helpers.position(td);
simulateEvent(
['mousedown', 'mouseup', 'click'],
0,
td,
e => {
Object.assign(e, {
clientX: pos.left,
clientY: pos.top
});
}
);
const popup = getOpenedPopup(editor);
expect(popup && popup.parentNode.parentNode !== null).is
.true;
clickTrigger('brush', popup);
const popupColor = getOpenedPopup(editor);
expect(
popupColor &&
window.getComputedStyle(popupColor).display
).equals('block');
simulateEvent(
'mousedown',
0,
popupColor.querySelector('a')
);
expect(
Jodit.modules.Helpers.normalizeColor(
td.style.backgroundColor
)
).equals('#000000');
});
});
});
});
it('Open inline popup after click inside the cell', function () {
const editor = getJodit();
editor.value = '<table>' + '<tr><td>1</td></tr>' + '</table>';
const td = editor.editor.querySelector('td'),
pos = Jodit.modules.Helpers.position(td);
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
Object.assign(e, {
clientX: pos.left,
clientY: pos.top
});
});
const popup = getOpenedPopup(editor);
expect(popup).is.not.null;
});
it('Select table cell and change it vertical align', function () {
const editor = getJodit();
editor.value =
'<table>' +
'<tr><td style="vertical-align: middle">3</td></tr>' +
'</table>';
const td = editor.editor.querySelector('td'),
pos = Jodit.modules.Helpers.position(td);
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
Object.assign(e, {
clientX: pos.left,
clientY: pos.top
});
});
const popup = getOpenedPopup(editor);
expect(popup && popup.parentNode.parentNode !== null).is.true;
clickTrigger('valign', popup);
const popupColor = getOpenedPopup(editor);
expect(popupColor).is.not.null;
clickButton('Bottom', popupColor);
expect(td.style.verticalAlign).equals('bottom');
});
it('Select table cell and split it by vertical', function () {
const editor = getJodit();
editor.value =
'<table style="width: 300px;">' +
'<tr><td>3</td></tr>' +
'</table>';
const td = editor.editor.querySelector('td'),
pos = Jodit.modules.Helpers.position(td);
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
Object.assign(e, {
clientX: pos.left,
clientY: pos.top
});
});
const popup = getOpenedPopup(editor);
clickTrigger('splitv', popup);
const list = getOpenedPopup(editor);
expect(list).is.not.null;
clickButton('tablesplitv', list);
expect(sortAttributes(editor.value)).equals(
'<table style="width:300px"><tbody><tr><td style="width:49.83%">3</td><td style="width:49.83%"><br></td></tr></tbody></table>'
);
});
it('Select table cell and split it by horizontal', function () {
const editor = getJodit();
editor.value =
'<table style="width: 300px;">' +
'<tr><td>5</td></tr>' +
'</table>';
const td = editor.editor.querySelector('td'),
pos = Jodit.modules.Helpers.position(td);
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
Object.assign(e, {
clientX: pos.left,
clientY: pos.top
});
});
const popup = getOpenedPopup(editor);
clickTrigger('splitv', popup);
const list = getOpenedPopup(editor);
expect(list).is.not.null;
clickButton('tablesplitg', list);
expect(sortAttributes(editor.value)).equals(
'<table style="width:300px"><tbody><tr><td>5</td></tr><tr><td><br></td></tr></tbody></table>'
);
});
it('Select two table cells and merge then in one', function () {
const editor = getJodit();
editor.value =
'<table style="width: 300px;">' +
'<tr><td>5</td><td>6</td></tr>' +
'</table>';
const td = editor.editor.querySelector('td'),
next = editor.editor.querySelectorAll('td')[1];
simulateEvent('mousedown', td);
simulateEvent(['mousemove', 'mouseup'], next);
const popup = getOpenedPopup(editor);
clickButton('merge', popup);
expect(sortAttributes(editor.value)).equals(
'<table style="width:300px"><tbody><tr><td>5<br>6</td></tr></tbody></table>'
);
});
it('Select table cell add column before this', function () {
const editor = getJodit();
editor.value = '<table>' + '<tr><td>3</td></tr>' + '</table>';
const td = editor.editor.querySelector('td'),
pos = Jodit.modules.Helpers.position(td);
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
Object.assign(e, {
clientX: pos.left,
clientY: pos.top
});
});
const popup = getOpenedPopup(editor);
expect(popup && popup.parentNode.parentNode !== null).is.true;
clickTrigger('addcolumn', popup);
const popupColor = getOpenedPopup(editor);
expect(
popupColor && window.getComputedStyle(popupColor).display
).equals('block');
simulateEvent('click', 0, popupColor.querySelector('button'));
expect(sortAttributes(editor.value)).equals(
'<table><tbody><tr><td></td><td>3</td></tr></tbody></table>'
);
});
it('Select table cell and add row above this', function () {
const editor = getJodit();
editor.value = '<table>' + '<tr><td>3</td></tr>' + '</table>';
const td = editor.editor.querySelector('td'),
pos = Jodit.modules.Helpers.position(td);
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
Object.assign(e, {
clientX: pos.left,
clientY: pos.top
});
});
const popup = getOpenedPopup(editor);
expect(popup && popup.parentNode.parentNode !== null).is.true;
clickTrigger('addrow', popup);
const popupColor = getOpenedPopup(editor);
expect(
popupColor && window.getComputedStyle(popupColor).display
).equals('block');
simulateEvent('click', 0, popupColor.querySelector('button'));
expect(sortAttributes(editor.value)).equals(
'<table><tbody><tr><td></td></tr><tr><td>3</td></tr></tbody></table>'
);
});
it('Select table cell and remove it row', function () {
const editor = getJodit();
editor.value =
'<table>' +
'<tr><td>1</td></tr>' +
'<tr><td>2</td></tr>' +
'<tr><td>3</td></tr>' +
'</table>';
const td = editor.editor.querySelectorAll('td')[1],
pos = Jodit.modules.Helpers.position(td);
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
Object.assign(e, {
clientX: pos.left,
clientY: pos.top
});
});
const popup = getOpenedPopup(editor);
expect(popup && popup.parentNode.parentNode !== null).is.true;
clickTrigger('delete', popup);
const popupColor = getOpenedPopup(editor);
expect(
popupColor && window.getComputedStyle(popupColor).display
).equals('block');
simulateEvent('click', 0, popupColor.querySelectorAll('button')[1]);
expect(editor.value).equals(
'<table><tbody><tr><td>1</td></tr><tr><td>3</td></tr></tbody></table>'
);
});
it('Select table cell and remove whole table should hide inline popup', function () {
const editor = getJodit();
editor.value =
'<table>' +
'<tr><td>1</td></tr>' +
'<tr><td>2</td></tr>' +
'<tr><td>3</td></tr>' +
'</table>';
const td = editor.editor.querySelectorAll('td')[1];
const pos = Jodit.modules.Helpers.position(td);
simulateEvent(['mousedown', 'mouseup', 'click'], 0, td, e => {
Object.assign(e, {
clientX: pos.left,
clientY: pos.top
});
});
const popup = getOpenedPopup(editor);
expect(popup && popup.parentNode.parentNode !== null).is.true;
clickTrigger('delete', popup);
const popupColor = getOpenedPopup(editor);
expect(
popupColor && window.getComputedStyle(popupColor).display
).equals('block');
simulateEvent('click', 0, popupColor.querySelector('button'));
expect(editor.value).equals('');
expect(popup && popup.parentNode).is.null;
});
});
describe('when a string is passed to the popup config', function () {
it('Should show the content of the string in the popup', function () {
it('Should Open inline popup', function () {
const editor = getJodit({
popup: {
a: '<div class="custom-popup-test">foo</div>'
}
});
editor.value = '<a href="../artio.jpg"/>test</a>';
simulateEvent('click', editor.editor.querySelector('a'));
const popup = getOpenedPopup(editor);
expect(
popup.getElementsByClassName('.custom-popup-test').length
).equals(1);
});
});
});
});
| {
"pile_set_name": "Github"
} |
/*******************************************************************\
Module: Traces of GOTO Programs
Author: Daniel Kroening
Date: July 2005
\*******************************************************************/
/// \file
/// Traces of GOTO Programs
#include "goto_trace.h"
#include <ostream>
#include <util/arith_tools.h>
#include <util/byte_operators.h>
#include <util/format_expr.h>
#include <util/range.h>
#include <util/string_utils.h>
#include <util/symbol.h>
#include <langapi/language_util.h>
#include "printf_formatter.h"
static optionalt<symbol_exprt> get_object_rec(const exprt &src)
{
if(src.id()==ID_symbol)
return to_symbol_expr(src);
else if(src.id()==ID_member)
return get_object_rec(to_member_expr(src).struct_op());
else if(src.id()==ID_index)
return get_object_rec(to_index_expr(src).array());
else if(src.id()==ID_typecast)
return get_object_rec(to_typecast_expr(src).op());
else if(
src.id() == ID_byte_extract_little_endian ||
src.id() == ID_byte_extract_big_endian)
{
return get_object_rec(to_byte_extract_expr(src).op());
}
else
return {}; // give up
}
optionalt<symbol_exprt> goto_trace_stept::get_lhs_object() const
{
return get_object_rec(full_lhs);
}
void goto_tracet::output(
const class namespacet &ns,
std::ostream &out) const
{
for(const auto &step : steps)
step.output(ns, out);
}
void goto_trace_stept::output(
const namespacet &,
std::ostream &out) const
{
out << "*** ";
// clang-format off
switch(type)
{
case goto_trace_stept::typet::ASSERT: out << "ASSERT"; break;
case goto_trace_stept::typet::ASSUME: out << "ASSUME"; break;
case goto_trace_stept::typet::LOCATION: out << "LOCATION"; break;
case goto_trace_stept::typet::ASSIGNMENT: out << "ASSIGNMENT"; break;
case goto_trace_stept::typet::GOTO: out << "GOTO"; break;
case goto_trace_stept::typet::DECL: out << "DECL"; break;
case goto_trace_stept::typet::DEAD: out << "DEAD"; break;
case goto_trace_stept::typet::OUTPUT: out << "OUTPUT"; break;
case goto_trace_stept::typet::INPUT: out << "INPUT"; break;
case goto_trace_stept::typet::ATOMIC_BEGIN:
out << "ATOMIC_BEGIN";
break;
case goto_trace_stept::typet::ATOMIC_END: out << "ATOMIC_END"; break;
case goto_trace_stept::typet::SHARED_READ: out << "SHARED_READ"; break;
case goto_trace_stept::typet::SHARED_WRITE: out << "SHARED WRITE"; break;
case goto_trace_stept::typet::FUNCTION_CALL: out << "FUNCTION CALL"; break;
case goto_trace_stept::typet::FUNCTION_RETURN:
out << "FUNCTION RETURN"; break;
case goto_trace_stept::typet::MEMORY_BARRIER: out << "MEMORY_BARRIER"; break;
case goto_trace_stept::typet::SPAWN: out << "SPAWN"; break;
case goto_trace_stept::typet::CONSTRAINT: out << "CONSTRAINT"; break;
case goto_trace_stept::typet::NONE: out << "NONE"; break;
}
// clang-format on
if(is_assert() || is_assume() || is_goto())
out << " (" << cond_value << ')';
else if(is_function_call())
out << ' ' << called_function;
if(hidden)
out << " hidden";
out << '\n';
if(is_assignment())
{
out << " " << format(full_lhs)
<< " = " << format(full_lhs_value)
<< '\n';
}
if(!pc->source_location.is_nil())
out << pc->source_location << '\n';
out << pc->type << '\n';
if(pc->is_assert())
{
if(!cond_value)
{
out << "Violated property:" << '\n';
if(pc->source_location.is_nil())
out << " " << pc->source_location << '\n';
if(!comment.empty())
out << " " << comment << '\n';
out << " " << format(pc->get_condition()) << '\n';
out << '\n';
}
}
out << '\n';
}
/// Returns the numeric representation of an expression, based on
/// options. The default is binary without a base-prefix. Setting
/// options.hex_representation to be true outputs hex format. Setting
/// options.base_prefix to be true appends either 0b or 0x to the number
/// to indicate the base
/// \param expr: expression to get numeric representation from
/// \param ns: namespace for symbol type lookups
/// \param options: configuration options
/// \return a string with the numeric representation
static std::string numeric_representation(
const constant_exprt &expr,
const namespacet &ns,
const trace_optionst &options)
{
std::string result;
std::string prefix;
const typet &expr_type = expr.type();
const typet &underlying_type =
expr_type.id() == ID_c_enum_tag
? ns.follow_tag(to_c_enum_tag_type(expr_type)).subtype()
: expr_type;
const irep_idt &value = expr.get_value();
const auto width = to_bitvector_type(underlying_type).get_width();
const mp_integer value_int = bvrep2integer(id2string(value), width, false);
if(options.hex_representation)
{
result = integer2string(value_int, 16);
prefix = "0x";
}
else
{
result = integer2binary(value_int, width);
prefix = "0b";
}
std::ostringstream oss;
std::string::size_type i = 0;
for(const auto c : result)
{
oss << c;
if(++i % 8 == 0 && result.size() != i)
oss << ' ';
}
if(options.base_prefix)
return prefix + oss.str();
else
return oss.str();
}
std::string trace_numeric_value(
const exprt &expr,
const namespacet &ns,
const trace_optionst &options)
{
const typet &type = expr.type();
if(expr.id()==ID_constant)
{
if(type.id()==ID_unsignedbv ||
type.id()==ID_signedbv ||
type.id()==ID_bv ||
type.id()==ID_fixedbv ||
type.id()==ID_floatbv ||
type.id()==ID_pointer ||
type.id()==ID_c_bit_field ||
type.id()==ID_c_bool ||
type.id()==ID_c_enum ||
type.id()==ID_c_enum_tag)
{
return numeric_representation(to_constant_expr(expr), ns, options);
}
else if(type.id()==ID_bool)
{
return expr.is_true()?"1":"0";
}
else if(type.id()==ID_integer)
{
const auto i = numeric_cast<mp_integer>(expr);
if(i.has_value() && *i >= 0)
{
if(options.hex_representation)
return "0x" + integer2string(*i, 16);
else
return "0b" + integer2string(*i, 2);
}
}
}
else if(expr.id()==ID_array)
{
std::string result;
forall_operands(it, expr)
{
if(result.empty())
result="{ ";
else
result+=", ";
result+=trace_numeric_value(*it, ns, options);
}
return result+" }";
}
else if(expr.id()==ID_struct)
{
std::string result="{ ";
forall_operands(it, expr)
{
if(it!=expr.operands().begin())
result+=", ";
result+=trace_numeric_value(*it, ns, options);
}
return result+" }";
}
else if(expr.id()==ID_union)
{
return trace_numeric_value(to_union_expr(expr).op(), ns, options);
}
return "?";
}
static void trace_value(
messaget::mstreamt &out,
const namespacet &ns,
const optionalt<symbol_exprt> &lhs_object,
const exprt &full_lhs,
const exprt &value,
const trace_optionst &options)
{
irep_idt identifier;
if(lhs_object.has_value())
identifier=lhs_object->get_identifier();
out << from_expr(ns, identifier, full_lhs) << '=';
if(value.is_nil())
out << "(assignment removed)";
else
{
out << from_expr(ns, identifier, value);
// the binary representation
out << ' ' << messaget::faint << '('
<< trace_numeric_value(value, ns, options) << ')' << messaget::reset;
}
out << '\n';
}
static std::string
state_location(const goto_trace_stept &state, const namespacet &ns)
{
std::string result;
const auto &source_location = state.pc->source_location;
if(!source_location.get_file().empty())
result += "file " + id2string(source_location.get_file());
if(!state.function_id.empty())
{
const symbolt &symbol = ns.lookup(state.function_id);
if(!result.empty())
result += ' ';
result += "function " + id2string(symbol.display_name());
}
if(!source_location.get_line().empty())
{
if(!result.empty())
result += ' ';
result += "line " + id2string(source_location.get_line());
}
if(!result.empty())
result += ' ';
result += "thread " + std::to_string(state.thread_nr);
return result;
}
void show_state_header(
messaget::mstreamt &out,
const namespacet &ns,
const goto_trace_stept &state,
unsigned step_nr,
const trace_optionst &options)
{
out << '\n';
if(step_nr == 0)
out << "Initial State";
else
out << "State " << step_nr;
out << ' ' << state_location(state, ns) << '\n';
out << "----------------------------------------------------" << '\n';
if(options.show_code)
{
out << as_string(ns, state.function_id, *state.pc) << '\n';
out << "----------------------------------------------------" << '\n';
}
}
bool is_index_member_symbol(const exprt &src)
{
if(src.id()==ID_index)
return is_index_member_symbol(to_index_expr(src).array());
else if(src.id()==ID_member)
return is_index_member_symbol(to_member_expr(src).compound());
else if(src.id()==ID_symbol)
return true;
else
return false;
}
/// \brief show a compact variant of the goto trace on the console
/// \param out: the output stream
/// \param ns: the namespace
/// \param goto_trace: the trace to be shown
/// \param options: any options, e.g., numerical representation
void show_compact_goto_trace(
messaget::mstreamt &out,
const namespacet &ns,
const goto_tracet &goto_trace,
const trace_optionst &options)
{
std::size_t function_depth = 0;
for(const auto &step : goto_trace.steps)
{
if(step.is_function_call())
function_depth++;
else if(step.is_function_return())
function_depth--;
// hide the hidden ones
if(step.hidden)
continue;
switch(step.type)
{
case goto_trace_stept::typet::ASSERT:
if(!step.cond_value)
{
out << '\n';
out << messaget::red << "Violated property:" << messaget::reset << '\n';
if(!step.pc->source_location.is_nil())
out << " " << state_location(step, ns) << '\n';
out << " " << messaget::red << step.comment << messaget::reset << '\n';
if(step.pc->is_assert())
{
out << " "
<< from_expr(ns, step.function_id, step.pc->get_condition())
<< '\n';
}
out << '\n';
}
break;
case goto_trace_stept::typet::ASSIGNMENT:
if(
step.assignment_type ==
goto_trace_stept::assignment_typet::ACTUAL_PARAMETER)
{
break;
}
out << " ";
if(!step.pc->source_location.get_line().empty())
{
out << messaget::faint << step.pc->source_location.get_line() << ':'
<< messaget::reset << ' ';
}
trace_value(
out,
ns,
step.get_lhs_object(),
step.full_lhs,
step.full_lhs_value,
options);
break;
case goto_trace_stept::typet::FUNCTION_CALL:
// downwards arrow
out << '\n' << messaget::faint << u8"\u21b3" << messaget::reset << ' ';
if(!step.pc->source_location.get_file().empty())
{
out << messaget::faint << step.pc->source_location.get_file();
if(!step.pc->source_location.get_line().empty())
{
out << messaget::faint << ':' << step.pc->source_location.get_line();
}
out << messaget::reset << ' ';
}
{
// show the display name
const auto &f_symbol = ns.lookup(step.called_function);
out << f_symbol.display_name();
}
{
auto arg_strings = make_range(step.function_arguments)
.map([&ns, &step](const exprt &arg) {
return from_expr(ns, step.function_id, arg);
});
out << '(';
join_strings(out, arg_strings.begin(), arg_strings.end(), ", ");
out << ")\n";
}
break;
case goto_trace_stept::typet::FUNCTION_RETURN:
// upwards arrow
out << messaget::faint << u8"\u21b5" << messaget::reset << '\n';
break;
case goto_trace_stept::typet::ASSUME:
case goto_trace_stept::typet::LOCATION:
case goto_trace_stept::typet::GOTO:
case goto_trace_stept::typet::DECL:
case goto_trace_stept::typet::OUTPUT:
case goto_trace_stept::typet::INPUT:
case goto_trace_stept::typet::SPAWN:
case goto_trace_stept::typet::MEMORY_BARRIER:
case goto_trace_stept::typet::ATOMIC_BEGIN:
case goto_trace_stept::typet::ATOMIC_END:
case goto_trace_stept::typet::DEAD:
case goto_trace_stept::typet::CONSTRAINT:
case goto_trace_stept::typet::SHARED_READ:
case goto_trace_stept::typet::SHARED_WRITE:
break;
case goto_trace_stept::typet::NONE:
UNREACHABLE;
}
}
}
void show_full_goto_trace(
messaget::mstreamt &out,
const namespacet &ns,
const goto_tracet &goto_trace,
const trace_optionst &options)
{
unsigned prev_step_nr=0;
bool first_step=true;
std::size_t function_depth=0;
for(const auto &step : goto_trace.steps)
{
// hide the hidden ones
if(step.hidden)
continue;
switch(step.type)
{
case goto_trace_stept::typet::ASSERT:
if(!step.cond_value)
{
out << '\n';
out << messaget::red << "Violated property:" << messaget::reset << '\n';
if(!step.pc->source_location.is_nil())
{
out << " " << state_location(step, ns) << '\n';
}
out << " " << messaget::red << step.comment << messaget::reset << '\n';
if(step.pc->is_assert())
{
out << " "
<< from_expr(ns, step.function_id, step.pc->get_condition())
<< '\n';
}
out << '\n';
}
break;
case goto_trace_stept::typet::ASSUME:
if(step.cond_value && step.pc->is_assume())
{
out << "\n";
out << "Assumption:\n";
if(!step.pc->source_location.is_nil())
out << " " << step.pc->source_location << '\n';
out << " " << from_expr(ns, step.function_id, step.pc->get_condition())
<< '\n';
}
break;
case goto_trace_stept::typet::LOCATION:
break;
case goto_trace_stept::typet::GOTO:
break;
case goto_trace_stept::typet::ASSIGNMENT:
if(step.pc->is_assign() ||
step.pc->is_return() || // returns have a lhs!
step.pc->is_function_call() ||
(step.pc->is_other() && step.full_lhs.is_not_nil()))
{
if(prev_step_nr!=step.step_nr || first_step)
{
first_step=false;
prev_step_nr=step.step_nr;
show_state_header(out, ns, step, step.step_nr, options);
}
out << " ";
trace_value(
out,
ns,
step.get_lhs_object(),
step.full_lhs,
step.full_lhs_value,
options);
}
break;
case goto_trace_stept::typet::DECL:
if(prev_step_nr!=step.step_nr || first_step)
{
first_step=false;
prev_step_nr=step.step_nr;
show_state_header(out, ns, step, step.step_nr, options);
}
out << " ";
trace_value(
out, ns, step.get_lhs_object(), step.full_lhs, step.full_lhs_value, options);
break;
case goto_trace_stept::typet::OUTPUT:
if(step.formatted)
{
printf_formattert printf_formatter(ns);
printf_formatter(id2string(step.format_string), step.io_args);
printf_formatter.print(out);
out << '\n';
}
else
{
show_state_header(out, ns, step, step.step_nr, options);
out << " OUTPUT " << step.io_id << ':';
for(std::list<exprt>::const_iterator
l_it=step.io_args.begin();
l_it!=step.io_args.end();
l_it++)
{
if(l_it!=step.io_args.begin())
out << ';';
out << ' ' << from_expr(ns, step.function_id, *l_it);
// the binary representation
out << " (" << trace_numeric_value(*l_it, ns, options) << ')';
}
out << '\n';
}
break;
case goto_trace_stept::typet::INPUT:
show_state_header(out, ns, step, step.step_nr, options);
out << " INPUT " << step.io_id << ':';
for(std::list<exprt>::const_iterator
l_it=step.io_args.begin();
l_it!=step.io_args.end();
l_it++)
{
if(l_it!=step.io_args.begin())
out << ';';
out << ' ' << from_expr(ns, step.function_id, *l_it);
// the binary representation
out << " (" << trace_numeric_value(*l_it, ns, options) << ')';
}
out << '\n';
break;
case goto_trace_stept::typet::FUNCTION_CALL:
function_depth++;
if(options.show_function_calls)
{
out << "\n#### Function call: " << step.called_function;
out << '(';
bool first = true;
for(auto &arg : step.function_arguments)
{
if(first)
first = false;
else
out << ", ";
out << from_expr(ns, step.function_id, arg);
}
out << ") (depth " << function_depth << ") ####\n";
}
break;
case goto_trace_stept::typet::FUNCTION_RETURN:
function_depth--;
if(options.show_function_calls)
{
out << "\n#### Function return from " << step.function_id << " (depth "
<< function_depth << ") ####\n";
}
break;
case goto_trace_stept::typet::SPAWN:
case goto_trace_stept::typet::MEMORY_BARRIER:
case goto_trace_stept::typet::ATOMIC_BEGIN:
case goto_trace_stept::typet::ATOMIC_END:
case goto_trace_stept::typet::DEAD:
break;
case goto_trace_stept::typet::CONSTRAINT:
case goto_trace_stept::typet::SHARED_READ:
case goto_trace_stept::typet::SHARED_WRITE:
case goto_trace_stept::typet::NONE:
UNREACHABLE;
}
}
}
static void show_goto_stack_trace(
messaget::mstreamt &out,
const namespacet &ns,
const goto_tracet &goto_trace)
{
// map from thread number to a call stack
std::map<unsigned, std::vector<goto_tracet::stepst::const_iterator>>
call_stacks;
// by default, we show thread 0
unsigned thread_to_show = 0;
for(auto s_it = goto_trace.steps.begin(); s_it != goto_trace.steps.end();
s_it++)
{
const auto &step = *s_it;
auto &stack = call_stacks[step.thread_nr];
if(step.is_assert())
{
if(!step.cond_value)
{
stack.push_back(s_it);
thread_to_show = step.thread_nr;
}
}
else if(step.is_function_call())
{
stack.push_back(s_it);
}
else if(step.is_function_return())
{
stack.pop_back();
}
}
const auto &stack = call_stacks[thread_to_show];
// print in reverse order
for(auto s_it = stack.rbegin(); s_it != stack.rend(); s_it++)
{
const auto &step = **s_it;
if(step.is_assert())
{
out << " assertion failure";
if(!step.pc->source_location.is_nil())
out << ' ' << step.pc->source_location;
out << '\n';
}
else if(step.is_function_call())
{
out << " " << step.called_function;
out << '(';
bool first = true;
for(auto &arg : step.function_arguments)
{
if(first)
first = false;
else
out << ", ";
out << from_expr(ns, step.function_id, arg);
}
out << ')';
if(!step.pc->source_location.is_nil())
out << ' ' << step.pc->source_location;
out << '\n';
}
}
}
void show_goto_trace(
messaget::mstreamt &out,
const namespacet &ns,
const goto_tracet &goto_trace,
const trace_optionst &options)
{
if(options.stack_trace)
show_goto_stack_trace(out, ns, goto_trace);
else if(options.compact_trace)
show_compact_goto_trace(out, ns, goto_trace, options);
else
show_full_goto_trace(out, ns, goto_trace, options);
}
const trace_optionst trace_optionst::default_options = trace_optionst();
std::set<irep_idt> goto_tracet::get_failed_property_ids() const
{
std::set<irep_idt> property_ids;
for(const auto &step : steps)
{
if(step.is_assert() && !step.cond_value)
property_ids.insert(step.property_id);
}
return property_ids;
}
| {
"pile_set_name": "Github"
} |
<a class="twitter-timeline" href="https://twitter.com/BWAPI_bot" data-widget-id="620402875924135936"
data-chrome="nofooter transparent noborders"
data-tweet-limit="3">Tweets by @BWAPI_bot</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
| {
"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 groovy.operator
import groovy.test.GroovyTestCase
import static java.awt.Color.*
class MyColorOperatorOverloadingTest extends GroovyTestCase {
void testAll() {
if (HeadlessTestSupport.headless) return
def c = new MyColor(128, 128, 128)
assert c.delegate == GRAY
def c2 = -c
assert c2.delegate == DARK_GRAY
assert (+c).delegate == WHITE
use(MyColorCategory) {
assert (~c2).delegate == LIGHT_GRAY
}
}
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2014 - 2016 George Kimionis
// See the accompanying file LICENSE for the Software License Aggrement
namespace BitcoinLib.Responses.Bridges
{
// Note: This serves as a common interface for the cases that a strongly-typed response is required while it is not yet clear whether the transaction in question is in-wallet or not
// A practical example is the bridging of GetTransaction(), DecodeRawTransaction() and GetRawTransaction()
public interface ITransactionResponse
{
string TxId { get; set; }
}
} | {
"pile_set_name": "Github"
} |
id: slimes_level7
auto_spawn: true
min_gen_actors: 3
max_gen_actors: 4
entries:
- id: slime_blue
weight: 1
limit: 1
- id: slime_red
weight: 1
limit: 1
- id: slime_orange
weight: 1
limit: 1
- id: slime
weight: 4 | {
"pile_set_name": "Github"
} |
/*
Categories.strings
Sileo
Created by OfficialHoSay on 2019-04-28.
Copyright © 2018 CoolStar. All rights reserved.
SPANISH LOCALISATIONS
*/
"No_Category" = "(Sin Categoría)";
"Tweaks" = "Tweaks";
"Themes" = "Temas";
"Utilities" = "Utilidades";
"Applications" = "Aplicaciones";
"Addons" = "Addons";
"Games" = "Juegos";
"Developer" = "Desarrollador";
"Data_Storage" = "Almacenamiento de Datos";
"Terminal_Support" = "Soporte para Terminal";
"Text_Editors" = "Editores de Texto";
| {
"pile_set_name": "Github"
} |
奥村みどり最新番号
【JUSD-041】五十路熟女18人4時間
【JUKD-394】生尺濃厚派遣妻3
【JUKD-366】五十路の性 2</a>2006-02-25マドンナ$$$Madonna87分钟 | {
"pile_set_name": "Github"
} |
// K-3D
// Copyright (c) 1995-2006, Timothy M. Shead
//
// Contact: [email protected]
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// This code leans heavily on boost::filesystem::path, most changes are to support ustring UTF-8 storage
#include <k3dsdk/path.h>
#include <k3d-platform-config.h>
#include <k3dsdk/result.h>
#include <k3dsdk/system.h>
#include <cstdio>
#include <glibmm/convert.h>
#ifdef K3D_API_WIN32
#include <k3dsdk/win32.h>
#else // K3D_API_WIN32
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
#endif // !K3D_API_WIN32
#include <boost/scoped_array.hpp>
namespace k3d
{
namespace filesystem
{
namespace detail
{
// Define some platform-specific odds-and-ends
#ifdef K3D_API_WIN32
const char NATIVE_SEARCHPATH_SEPARATOR = ';';
const char NATIVE_PATH_SEPARATOR = '\\';
#else // K3D_API_WIN32
const char NATIVE_SEARCHPATH_SEPARATOR = ':';
const char NATIVE_PATH_SEPARATOR = '/';
#endif // !K3D_API_WIN32
const char GENERIC_PATH_SEPARATOR = '/';
// end_pos is past-the-end position
// return 0 if str itself is leaf (or empty)
ustring::size_type leaf_pos( const ustring& str, ustring::size_type end_pos )
{
if ( end_pos && str[end_pos-1] == '/' ) return end_pos-1;
ustring::size_type pos( str.find_last_of( '/', end_pos-1 ) );
if ( pos == ustring::npos ) pos = str.find_last_of( ':', end_pos-2 );
return ( pos == ustring::npos // path itself must be a leaf (or empty)
|| (pos == 1 && str[0] == '/') // or share
) ? 0 // so leaf is entire string
: pos + 1; // or starts after delimiter
}
bool_t is_absolute_root(const ustring& s, ustring::size_type len)
{
return
len && s[len-1] == '/'
&&
(
len == 1 // "/"
|| ( len > 1
&& ( s[len-2] == ':' // drive or device
|| ( s[0] == '/' // share
&& s[1] == '/'
&& s.find( '/', 2 ) == len-1
)
)
)
);
}
} // namespace detail
//////////////////////////////////////////////////////////////////////////////////
// path::iterator::implementation
class path::iterator::implementation
{
public:
implementation() :
storage(0),
index(0)
{
}
implementation(const ustring& Storage) :
storage(&Storage),
index(0)
{
if(Storage.size() > 2 && Storage[0] == '/' && Storage[1] == '/') // "//foo"
{
begin.push_back(0);
end.push_back(std::min(Storage.size(), Storage.find('/', 2)));
if(end.back() < Storage.size()) // "//foo/"
{
begin.push_back(end.back());
end.push_back(end.back() + 1);
if(end.back() < Storage.size()) // "//foo/bar"
{
begin.push_back(end.back());
end.push_back(std::min(Storage.size(), Storage.find('/', end.back())));
}
}
}
else if(Storage.size() > 1 && Storage[1] == ':') // "c:"
{
begin.push_back(0);
end.push_back(2);
if(Storage.size() > 2)
{
if(Storage[2] == '/') // "c:/foo/bar"
{
begin.push_back(2);
end.push_back(3);
if(Storage.size() > 3)
{
begin.push_back(3);
end.push_back(std::min(Storage.size(), Storage.find('/', 3)));
}
}
else // "c:foo"
{
begin.push_back(2);
end.push_back(std::min(Storage.size(), Storage.find('/', 2)));
}
}
}
else if(Storage.size() && Storage[0] == '/') // "/foo/bar"
{
begin.push_back(0);
end.push_back(1);
if(Storage.size() > 1)
{
begin.push_back(1);
end.push_back(std::min(Storage.size(), Storage.find('/', 1)));
}
}
else // "foo/bar"
{
begin.push_back(0);
end.push_back(std::min(Storage.size(), Storage.find('/')));
}
while(end.size() && end.back() < Storage.size())
{
begin.push_back(end.back() + 1);
end.push_back(std::min(Storage.size(), Storage.find('/', end.back() + 1)));
}
}
ustring dereference() const
{
return storage->substr(begin[index], end[index] - begin[index]);
}
bool_t equal(const implementation& rhs) const
{
return storage == rhs.storage && index == rhs.index;
}
void increment()
{
++index;
if(index >= begin.size())
{
storage = 0;
begin.clear();
end.clear();
index = 0;
}
}
const ustring* storage;
std::vector<ustring::size_type> begin;
std::vector<ustring::size_type> end;
size_t index;
};
//////////////////////////////////////////////////////////////////////////////////
// path::iterator
path::iterator::iterator() :
m_implementation(new implementation())
{
}
path::iterator::iterator(const ustring& Storage) :
m_implementation(new implementation(Storage))
{
}
path::iterator::~iterator()
{
delete m_implementation;
}
ustring path::iterator::operator*()
{
return m_implementation->dereference();
}
bool_t path::iterator::operator==(const iterator& rhs)
{
return m_implementation->equal(*rhs.m_implementation);
}
bool_t path::iterator::operator!=(const iterator& rhs)
{
return !m_implementation->equal(*rhs.m_implementation);
}
path::iterator& path::iterator::operator++()
{
m_implementation->increment();
return *this;
}
/////////////////////////////////////////////////////////////////////////////////////////////
// path
path::path()
{
}
path::path(const ustring& GenericPath) :
storage(GenericPath)
{
}
path generic_path(const ustring& GenericPath)
{
return path(GenericPath);
}
path generic_path(const string_t& GenericPath)
{
return path(ustring::from_utf8(GenericPath));
}
path native_path(const ustring& NativePath)
{
ustring generic_path(NativePath);
for(ustring::size_type i = generic_path.find('\\'); i != ustring::npos; i = generic_path.find('\\'))
generic_path.replace(i, 1, 1, detail::GENERIC_PATH_SEPARATOR);
return path(generic_path);
}
path& path::operator/=(const path& rhs)
{
if(storage.empty())
{
storage = rhs.storage;
}
else
{
if((storage[storage.size()-1] == '/') || (rhs.storage.size() && rhs.storage[0] == '/'))
{
storage += rhs.storage;
}
else
{
storage += detail::GENERIC_PATH_SEPARATOR;
storage += rhs.storage;
}
}
return *this;
}
path path::operator/(const path& rhs) const
{
path result(*this);
result /= rhs;
return result;
}
path path::operator+(const ustring& rhs) const
{
return path(storage + rhs);
}
path path::operator+(const string_t& rhs) const
{
return path(storage + ustring::from_utf8(rhs));
}
ustring path::generic_utf8_string() const
{
return storage;
}
ustring path::native_utf8_string() const
{
ustring native_string(storage);
for(ustring::size_type i = native_string.find(detail::GENERIC_PATH_SEPARATOR); i != ustring::npos; i = native_string.find(detail::GENERIC_PATH_SEPARATOR, i+1))
native_string.replace(i, 1, 1, detail::NATIVE_PATH_SEPARATOR);
return native_string;
}
string_t path::native_console_string() const
{
return native_utf8_string().raw();
}
string_t path::native_filesystem_string() const
{
#ifdef K3D_API_WIN32
return Glib::locale_from_utf8(native_utf8_string().raw());
#else // K3D_API_WIN32
return Glib::filename_from_utf8(native_utf8_string().raw());
#endif // !K3D_API_WIN32
}
path path::root_path() const
{
return generic_path(root_name()) / generic_path(root_directory());
}
ustring path::root_name() const
{
// Win32 cases ...
ustring::size_type pos = storage.find(':');
if(pos != ustring::npos)
return storage.substr(0, pos + 1);
if(storage.size() > 2 && storage[0] == '/' && storage[1] == '/')
{
pos = storage.find('/', 2);
return storage.substr(0, pos);
}
// Posix case ...
return ustring();
}
ustring path::root_directory() const
{
if(storage.size() > 2 && storage[1] == ':' && storage[2] == '/')
return ustring::from_utf8("/");
if(storage.size() > 2 && storage[0] == '/' && storage[1] == '/')
return ustring::from_utf8(storage.find('/', 2) != ustring::npos ? "/" : "");
if(storage.size() && storage[0] == '/')
return ustring::from_utf8("/");
return ustring::from_utf8("");
}
ustring path::leaf() const
{
return storage.substr(detail::leaf_pos(storage, storage.size()));
}
path path::branch_path() const
{
ustring::size_type end_pos = detail::leaf_pos(storage, storage.size());
// skip a '/' unless it is a root directory
if(end_pos && storage[end_pos - 1] == '/' && !detail::is_absolute_root(storage, end_pos))
--end_pos;
return path(storage.substr(0, end_pos));
}
bool_t path::empty() const
{
return storage.empty();
}
bool_t path::is_complete() const
{
// Win32 cases ...
if(storage.size() > 2 && storage[1] == ':' && storage[2] == '/') // "c:/"
return true;
if(storage.size() > 2 && storage[0] == '/' && storage[1] == '/') // "//share"
return true;
if(storage.size() > 2 && storage[storage.size()-1] == ':') // "prn:"
return true;
// Posix cases ...
if(storage.size() && storage[0] == '/') // "/foo"
return true;
return false;
}
path::iterator path::begin() const
{
return iterator(storage);
}
path::iterator path::end() const
{
return iterator();
}
bool_t path::operator==(const path& that) const
{
return !(*this < that) && !(that < *this);
}
bool_t path::operator!=(const path& that) const
{
return !(*this == that);
}
bool_t path::operator<(const path& that) const
{
return storage < that.storage;
}
bool_t path::operator<=(const path& that) const
{
return !(that < *this);
}
bool_t path::operator>(const path& that) const
{
return that < *this;
}
bool_t path::operator>=(const path& that) const
{
return !(*this < that);
}
//////////////////////////////////////////////////////////////////////////////////
// exists
bool_t exists(const path& Path)
{
#ifdef K3D_API_WIN32
return ::GetFileAttributesA(Path.native_filesystem_string().c_str()) != 0xFFFFFFFF;
#else // K3D_API_WIN32
struct stat path_stat;
return ::stat(Path.native_filesystem_string().c_str(), &path_stat) == 0;
#endif // !K3D_API_WIN32
}
const ustring extension(const path& Path);
bool_t create_directory(const path& Path);
bool_t create_directories(const path& Path);
/////////////////////////////////////////////////////////////////////////////////////////////
// make_relative_path
const filesystem::path make_relative_path(const filesystem::path& AbsolutePath, const filesystem::path& ReferencePath)
{
// The AbsolutePath must actually *be* an absolute path!
return_val_if_fail(AbsolutePath.is_complete(), filesystem::path());
// As a special-case, if the AbsolutePath and ReferencePath don't share the same root name, return the AbsolutePath (which is the best we can do)
if(AbsolutePath.root_name() != ReferencePath.root_name())
return AbsolutePath;
filesystem::path relative_path;
const filesystem::path root_path = ReferencePath;
const filesystem::path absolute_path(AbsolutePath);
filesystem::path::iterator a = root_path.begin();
filesystem::path::iterator b = absolute_path.begin();
while(a != root_path.end() && b != absolute_path.end() && *a == *b)
{
++a;
++b;
}
for(; a != root_path.end(); ++a)
relative_path /= filesystem::generic_path("..");
for(; b != absolute_path.end(); ++b)
relative_path /= filesystem::generic_path(*b);
return relative_path;
}
//////////////////////////////////////////////////////////////////////////////////
// extension
const ustring extension(const path& Path)
{
ustring leaf = Path.leaf();
ustring::size_type n = leaf.rfind('.');
if (n != ustring::npos)
return leaf.substr(n);
else
return ustring();
}
//////////////////////////////////////////////////////////////////////////////////
// replace_extension
const path replace_extension(const path& Path, const string_t& NewExtension)
{
ustring temp = Path.generic_utf8_string();
return generic_path(temp.substr(0, temp.rfind('.')) + ustring::from_utf8(NewExtension));
}
//////////////////////////////////////////////////////////////////////////////////
// create_directory
bool_t create_directory(const path& Path)
{
return_val_if_fail(!Path.empty(), false);
if(exists(Path))
{
if(is_directory(Path))
return true;
k3d::log() << error << "Path [" << Path.native_console_string() << "] exists and is not a directory" << std::endl;
return false;
}
#ifdef K3D_API_WIN32
if ( ::CreateDirectoryA( Path.native_filesystem_string().c_str(), 0 ) )
return true;
#else // K3D_API_WIN32
if ( ::mkdir( Path.native_filesystem_string().c_str(), S_IRWXU|S_IRWXG|S_IRWXO ) == 0 )
return true;
#endif // !K3D_API_WIN32
k3d::log() << error << "Error creating directory [" << Path.native_console_string() << "]" << std::endl;
return false;
}
//////////////////////////////////////////////////////////////////////////////////
// create_directories
bool_t create_directories(const path& Path)
{
return_val_if_fail(!Path.empty(), false);
if(exists(Path))
{
if(is_directory(Path))
return true;
k3d::log() << error << "Path [" << Path.native_console_string() << "] exists and is not a directory" << std::endl;
return false;
}
// First create branch, by calling ourself recursively
if(!create_directories(Path.branch_path()))
return false;
// Now that parent's path exists, create the directory
return create_directory(Path);
}
//////////////////////////////////////////////////////////////////////////////////
// is_directory
bool_t is_directory(const path& Path)
{
#ifdef K3D_API_WIN32
const DWORD attributes = ::GetFileAttributesA(Path.native_filesystem_string().c_str());
return attributes & FILE_ATTRIBUTE_DIRECTORY;
#else // K3D_API_WIN32
struct stat path_stat;
if(::stat(Path.native_filesystem_string().c_str(), &path_stat) != 0)
return false;
return S_ISDIR(path_stat.st_mode);
#endif // !K3D_API_WIN32
}
//////////////////////////////////////////////////////////////////////////////////
// remove
bool_t remove(const path& Path)
{
#ifdef K3D_API_WIN32
if(is_directory(Path))
return ::RemoveDirectory(Path.native_filesystem_string().c_str());
return ::DeleteFile(Path.native_filesystem_string().c_str());
#else // K3D_API_WIN32
if(is_directory(Path))
return 0 == ::rmdir(Path.native_filesystem_string().c_str());
return 0 == ::unlink(Path.native_filesystem_string().c_str());
#endif // !K3D_API_WIN32
}
//////////////////////////////////////////////////////////////////////////////////
// rename
bool_t rename(const path& Source, const path& Target)
{
#ifdef K3D_API_WIN32
return ::MoveFile(Source.native_filesystem_string().c_str(), Target.native_filesystem_string().c_str());
#else // K3D_API_WIN32
return 0 == ::rename(Source.native_filesystem_string().c_str(), Target.native_filesystem_string().c_str());
#endif // !K3D_API_WIN32
}
//////////////////////////////////////////////////////////////////////////////////
// copy_file
bool_t copy_file(const path& Source, const path& Target)
{
#ifdef K3D_API_WIN32
return ::CopyFile(Source.native_filesystem_string().c_str(), Target.native_filesystem_string().c_str(), false);
#else // K3D_API_WIN32
struct stat source_stat;
if(0 != ::stat(Source.native_filesystem_string().c_str(), &source_stat))
return false;
const int source_file = ::open(Source.native_filesystem_string().c_str(), O_RDONLY);
if(source_file < 1)
return false;
const int target_file = ::open(Target.native_filesystem_string().c_str(), O_WRONLY | O_CREAT | O_EXCL, source_stat.st_mode);
if(target_file < 1)
{
::close(source_file);
return false;
}
bool_t result = true;
const std::size_t buffer_size = 32768;
boost::scoped_array<char> buffer(new char[buffer_size]);
for(ssize_t bytes_read = ::read(source_file, buffer.get(), buffer_size); bytes_read > 0; bytes_read = ::read(source_file, buffer.get(), buffer_size))
{
if(::write(target_file, buffer.get(), bytes_read) < 0)
{
result = false;
break;
}
}
if(::close(source_file) < 0 )
result = false;
if(::close(target_file) < 0 )
result = false;
return result;
#endif // !K3D_API_WIN32
}
//////////////////////////////////////////////////////////////////////////////////
// up_to_date
bool_t up_to_date(const path& Source, const path& Target)
{
// Get the last modification time of the source ...
time_t source_modified = 0;
return_val_if_fail(system::file_modification_time(Source, source_modified), false);
// Get the last modification time of the target (if it exists) ...
time_t target_modified = 0;
system::file_modification_time(Target, target_modified);
return source_modified <= target_modified;
}
//////////////////////////////////////////////////////////////////////////////////
// split_native_paths
const path_list split_native_paths(const ustring& Paths)
{
path_list results;
ustring::size_type begin = 0;
const ustring::size_type end = Paths.size();
for(ustring::size_type separator = Paths.find(detail::NATIVE_SEARCHPATH_SEPARATOR, begin); separator != ustring::npos; separator = Paths.find(detail::NATIVE_SEARCHPATH_SEPARATOR, begin))
{
results.push_back(native_path(Paths.substr(begin, separator - begin)));
begin = separator + 1;
}
if(begin < end)
results.push_back(native_path(Paths.substr(begin, end - begin)));
return results;
}
//////////////////////////////////////////////////////////////////////////////////
// directory_iterator::implementation
#ifdef K3D_API_WIN32
class directory_iterator::implementation
{
public:
implementation(const path& Path) :
handle(INVALID_HANDLE_VALUE),
branch_path(Path)
{
path temp = Path + "\\*";
handle = ::FindFirstFile(temp.native_filesystem_string().c_str(), &data);
skip_dots();
if(handle != INVALID_HANDLE_VALUE)
full_path = branch_path / generic_path(ustring::from_utf8(data.cFileName));
}
implementation() :
handle(INVALID_HANDLE_VALUE)
{
}
~implementation()
{
if(handle != INVALID_HANDLE_VALUE)
::FindClose(handle);
}
directory_iterator::reference dereference() const
{
return full_path;
}
void increment()
{
internal_increment();
skip_dots();
if(handle != INVALID_HANDLE_VALUE)
full_path = branch_path / generic_path(ustring::from_utf8(data.cFileName));
}
bool_t equal(const implementation& rhs) const
{
return handle == rhs.handle;
}
private:
void internal_increment()
{
if(0 == ::FindNextFile(handle, &data))
{
::FindClose(handle);
handle = INVALID_HANDLE_VALUE;
}
}
void skip_dots()
{
while(handle != INVALID_HANDLE_VALUE && data.cFileName[0]=='.' && (data.cFileName[1]=='\0' || (data.cFileName[1]=='.' && data.cFileName[2]=='\0')))
internal_increment();
}
HANDLE handle;
WIN32_FIND_DATA data;
const path branch_path;
path full_path;
};
#else // K3D_API_WIN32
class directory_iterator::implementation
{
public:
implementation(const path& Path) :
handle(0),
current(0),
branch_path(Path)
{
handle = ::opendir(Path.native_filesystem_string().c_str());
internal_increment();
skip_dots();
if(current)
full_path = branch_path / generic_path(current->d_name);
}
implementation() :
handle(0),
current(0)
{
}
~implementation()
{
if(handle)
::closedir(handle);
}
directory_iterator::reference dereference() const
{
return full_path;
}
void increment()
{
internal_increment();
skip_dots();
if(current)
full_path = branch_path / generic_path(current->d_name);
}
bool_t equal(const implementation& rhs)
{
return current == rhs.current;
}
private:
void internal_increment()
{
if(handle)
{
current = ::readdir(handle);
if(!current)
{
::closedir(handle);
handle = 0;
}
}
}
void skip_dots()
{
while(current && current->d_name[0]=='.' && (current->d_name[1]=='\0' || (current->d_name[1]=='.' && current->d_name[2]=='\0')))
internal_increment();
}
DIR* handle;
dirent* current;
const path branch_path;
path full_path;
};
#endif // !K3D_API_WIN32
//////////////////////////////////////////////////////////////////////////////////
// directory_iterator
directory_iterator::directory_iterator(const path& Path) :
m_implementation(new implementation(Path))
{
}
directory_iterator::directory_iterator() :
m_implementation(new implementation())
{
}
directory_iterator::~directory_iterator()
{
delete m_implementation;
}
directory_iterator::reference directory_iterator::dereference() const
{
return m_implementation->dereference();
}
void directory_iterator::increment()
{
m_implementation->increment();
}
bool_t directory_iterator::equal(const directory_iterator& rhs) const
{
return m_implementation->equal(*rhs.m_implementation);
}
} // namespace filesystem
} // namespace k3d
| {
"pile_set_name": "Github"
} |
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
| {
"pile_set_name": "Github"
} |
package aws
import (
"io"
"sync"
"github.com/aws/aws-sdk-go/internal/sdkio"
)
// ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Should
// only be used with an io.Reader that is also an io.Seeker. Doing so may
// cause request signature errors, or request body's not sent for GET, HEAD
// and DELETE HTTP methods.
//
// Deprecated: Should only be used with io.ReadSeeker. If using for
// S3 PutObject to stream content use s3manager.Uploader instead.
func ReadSeekCloser(r io.Reader) ReaderSeekerCloser {
return ReaderSeekerCloser{r}
}
// ReaderSeekerCloser represents a reader that can also delegate io.Seeker and
// io.Closer interfaces to the underlying object if they are available.
type ReaderSeekerCloser struct {
r io.Reader
}
// IsReaderSeekable returns if the underlying reader type can be seeked. A
// io.Reader might not actually be seekable if it is the ReaderSeekerCloser
// type.
func IsReaderSeekable(r io.Reader) bool {
switch v := r.(type) {
case ReaderSeekerCloser:
return v.IsSeeker()
case *ReaderSeekerCloser:
return v.IsSeeker()
case io.ReadSeeker:
return true
default:
return false
}
}
// Read reads from the reader up to size of p. The number of bytes read, and
// error if it occurred will be returned.
//
// If the reader is not an io.Reader zero bytes read, and nil error will be returned.
//
// Performs the same functionality as io.Reader Read
func (r ReaderSeekerCloser) Read(p []byte) (int, error) {
switch t := r.r.(type) {
case io.Reader:
return t.Read(p)
}
return 0, nil
}
// Seek sets the offset for the next Read to offset, interpreted according to
// whence: 0 means relative to the origin of the file, 1 means relative to the
// current offset, and 2 means relative to the end. Seek returns the new offset
// and an error, if any.
//
// If the ReaderSeekerCloser is not an io.Seeker nothing will be done.
func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error) {
switch t := r.r.(type) {
case io.Seeker:
return t.Seek(offset, whence)
}
return int64(0), nil
}
// IsSeeker returns if the underlying reader is also a seeker.
func (r ReaderSeekerCloser) IsSeeker() bool {
_, ok := r.r.(io.Seeker)
return ok
}
// HasLen returns the length of the underlying reader if the value implements
// the Len() int method.
func (r ReaderSeekerCloser) HasLen() (int, bool) {
type lenner interface {
Len() int
}
if lr, ok := r.r.(lenner); ok {
return lr.Len(), true
}
return 0, false
}
// GetLen returns the length of the bytes remaining in the underlying reader.
// Checks first for Len(), then io.Seeker to determine the size of the
// underlying reader.
//
// Will return -1 if the length cannot be determined.
func (r ReaderSeekerCloser) GetLen() (int64, error) {
if l, ok := r.HasLen(); ok {
return int64(l), nil
}
if s, ok := r.r.(io.Seeker); ok {
return seekerLen(s)
}
return -1, nil
}
// SeekerLen attempts to get the number of bytes remaining at the seeker's
// current position. Returns the number of bytes remaining or error.
func SeekerLen(s io.Seeker) (int64, error) {
// Determine if the seeker is actually seekable. ReaderSeekerCloser
// hides the fact that a io.Readers might not actually be seekable.
switch v := s.(type) {
case ReaderSeekerCloser:
return v.GetLen()
case *ReaderSeekerCloser:
return v.GetLen()
}
return seekerLen(s)
}
func seekerLen(s io.Seeker) (int64, error) {
curOffset, err := s.Seek(0, sdkio.SeekCurrent)
if err != nil {
return 0, err
}
endOffset, err := s.Seek(0, sdkio.SeekEnd)
if err != nil {
return 0, err
}
_, err = s.Seek(curOffset, sdkio.SeekStart)
if err != nil {
return 0, err
}
return endOffset - curOffset, nil
}
// Close closes the ReaderSeekerCloser.
//
// If the ReaderSeekerCloser is not an io.Closer nothing will be done.
func (r ReaderSeekerCloser) Close() error {
switch t := r.r.(type) {
case io.Closer:
return t.Close()
}
return nil
}
// A WriteAtBuffer provides a in memory buffer supporting the io.WriterAt interface
// Can be used with the s3manager.Downloader to download content to a buffer
// in memory. Safe to use concurrently.
type WriteAtBuffer struct {
buf []byte
m sync.Mutex
// GrowthCoeff defines the growth rate of the internal buffer. By
// default, the growth rate is 1, where expanding the internal
// buffer will allocate only enough capacity to fit the new expected
// length.
GrowthCoeff float64
}
// NewWriteAtBuffer creates a WriteAtBuffer with an internal buffer
// provided by buf.
func NewWriteAtBuffer(buf []byte) *WriteAtBuffer {
return &WriteAtBuffer{buf: buf}
}
// WriteAt writes a slice of bytes to a buffer starting at the position provided
// The number of bytes written will be returned, or error. Can overwrite previous
// written slices if the write ats overlap.
func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error) {
pLen := len(p)
expLen := pos + int64(pLen)
b.m.Lock()
defer b.m.Unlock()
if int64(len(b.buf)) < expLen {
if int64(cap(b.buf)) < expLen {
if b.GrowthCoeff < 1 {
b.GrowthCoeff = 1
}
newBuf := make([]byte, expLen, int64(b.GrowthCoeff*float64(expLen)))
copy(newBuf, b.buf)
b.buf = newBuf
}
b.buf = b.buf[:expLen]
}
copy(b.buf[pos:], p)
return pLen, nil
}
// Bytes returns a slice of bytes written to the buffer.
func (b *WriteAtBuffer) Bytes() []byte {
b.m.Lock()
defer b.m.Unlock()
return b.buf
}
| {
"pile_set_name": "Github"
} |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Learning 2 Learn training."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from six.moves import xrange
import tensorflow as tf
from tensorflow.contrib.learn.python.learn import monitored_session as ms
import meta
import util
flags = tf.flags
logging = tf.logging
FLAGS = flags.FLAGS
flags.DEFINE_string("save_path", None, "Path for saved meta-optimizer.")
flags.DEFINE_integer("num_epochs", 10000, "Number of training epochs.")
flags.DEFINE_integer("log_period", 100, "Log period.")
flags.DEFINE_integer("evaluation_period", 1000, "Evaluation period.")
flags.DEFINE_integer("evaluation_epochs", 20, "Number of evaluation epochs.")
flags.DEFINE_string("problem", "simple", "Type of problem.")
flags.DEFINE_integer("num_steps", 100,
"Number of optimization steps per epoch.")
flags.DEFINE_integer("unroll_length", 20, "Meta-optimizer unroll length.")
flags.DEFINE_float("learning_rate", 0.001, "Learning rate.")
flags.DEFINE_boolean("second_derivatives", False, "Use second derivatives.")
def main(_):
# Configuration.
num_unrolls = FLAGS.num_steps // FLAGS.unroll_length
if FLAGS.save_path is not None:
if os.path.exists(FLAGS.save_path):
raise ValueError("Folder {} already exists".format(FLAGS.save_path))
else:
os.mkdir(FLAGS.save_path)
# Problem.
problem, net_config, net_assignments = util.get_config(FLAGS.problem)
# Optimizer setup.
optimizer = meta.MetaOptimizer(**net_config)
minimize = optimizer.meta_minimize(
problem, FLAGS.unroll_length,
learning_rate=FLAGS.learning_rate,
net_assignments=net_assignments,
second_derivatives=FLAGS.second_derivatives)
step, update, reset, cost_op, _ = minimize
with ms.MonitoredSession() as sess:
# Prevent accidental changes to the graph.
tf.get_default_graph().finalize()
best_evaluation = float("inf")
total_time = 0
total_cost = 0
for e in xrange(FLAGS.num_epochs):
# Training.
time, cost = util.run_epoch(sess, cost_op, [update, step], reset,
num_unrolls)
total_time += time
total_cost += cost
# Logging.
if (e + 1) % FLAGS.log_period == 0:
util.print_stats("Epoch {}".format(e + 1), total_cost, total_time,
FLAGS.log_period)
total_time = 0
total_cost = 0
# Evaluation.
if (e + 1) % FLAGS.evaluation_period == 0:
eval_cost = 0
eval_time = 0
for _ in xrange(FLAGS.evaluation_epochs):
time, cost = util.run_epoch(sess, cost_op, [update], reset,
num_unrolls)
eval_time += time
eval_cost += cost
util.print_stats("EVALUATION", eval_cost, eval_time,
FLAGS.evaluation_epochs)
if FLAGS.save_path is not None and eval_cost < best_evaluation:
print("Removing previously saved meta-optimizer")
for f in os.listdir(FLAGS.save_path):
os.remove(os.path.join(FLAGS.save_path, f))
print("Saving meta-optimizer to {}".format(FLAGS.save_path))
optimizer.save(sess, FLAGS.save_path)
best_evaluation = eval_cost
if __name__ == "__main__":
tf.app.run()
| {
"pile_set_name": "Github"
} |
define("ace/mode/ini_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var escapeRe = "\\\\(?:[\\\\0abtrn;#=:]|x[a-fA-F\\d]{4})";
var IniHighlightRules = function() {
this.$rules = {
start: [{
token: 'punctuation.definition.comment.ini',
regex: '#.*',
push_: [{
token: 'comment.line.number-sign.ini',
regex: '$|^',
next: 'pop'
}, {
defaultToken: 'comment.line.number-sign.ini'
}]
}, {
token: 'punctuation.definition.comment.ini',
regex: ';.*',
push_: [{
token: 'comment.line.semicolon.ini',
regex: '$|^',
next: 'pop'
}, {
defaultToken: 'comment.line.semicolon.ini'
}]
}, {
token: ['keyword.other.definition.ini', 'text', 'punctuation.separator.key-value.ini'],
regex: '\\b([a-zA-Z0-9_.-]+)\\b(\\s*)(=)'
}, {
token: ['punctuation.definition.entity.ini', 'constant.section.group-title.ini', 'punctuation.definition.entity.ini'],
regex: '^(\\[)(.*?)(\\])'
}, {
token: 'punctuation.definition.string.begin.ini',
regex: "'",
push: [{
token: 'punctuation.definition.string.end.ini',
regex: "'",
next: 'pop'
}, {
token: "constant.language.escape",
regex: escapeRe
}, {
defaultToken: 'string.quoted.single.ini'
}]
}, {
token: 'punctuation.definition.string.begin.ini',
regex: '"',
push: [{
token: "constant.language.escape",
regex: escapeRe
}, {
token: 'punctuation.definition.string.end.ini',
regex: '"',
next: 'pop'
}, {
defaultToken: 'string.quoted.double.ini'
}]
}]
};
this.normalizeRules();
};
IniHighlightRules.metaData = {
fileTypes: ['ini', 'conf'],
keyEquivalent: '^~I',
name: 'Ini',
scopeName: 'source.ini'
};
oop.inherits(IniHighlightRules, TextHighlightRules);
exports.IniHighlightRules = IniHighlightRules;
});
define("ace/mode/folding/ini",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Range = require("../../range").Range;
var BaseFoldMode = require("./fold_mode").FoldMode;
var FoldMode = exports.FoldMode = function() {
};
oop.inherits(FoldMode, BaseFoldMode);
(function() {
this.foldingStartMarker = /^\s*\[([^\])]*)]\s*(?:$|[;#])/;
this.getFoldWidgetRange = function(session, foldStyle, row) {
var re = this.foldingStartMarker;
var line = session.getLine(row);
var m = line.match(re);
if (!m) return;
var startName = m[1] + ".";
var startColumn = line.length;
var maxRow = session.getLength();
var startRow = row;
var endRow = row;
while (++row < maxRow) {
line = session.getLine(row);
if (/^\s*$/.test(line))
continue;
m = line.match(re);
if (m && m[1].lastIndexOf(startName, 0) !== 0)
break;
endRow = row;
}
if (endRow > startRow) {
var endColumn = session.getLine(endRow).length;
return new Range(startRow, startColumn, endRow, endColumn);
}
};
}).call(FoldMode.prototype);
});
define("ace/mode/ini",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ini_highlight_rules","ace/mode/folding/ini"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var IniHighlightRules = require("./ini_highlight_rules").IniHighlightRules;
var FoldMode = require("./folding/ini").FoldMode;
var Mode = function() {
this.HighlightRules = IniHighlightRules;
this.foldingRules = new FoldMode();
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = ";";
this.blockComment = {start: "/*", end: "*/"};
this.$id = "ace/mode/ini";
}).call(Mode.prototype);
exports.Mode = Mode;
});
| {
"pile_set_name": "Github"
} |
/*
* This file is part of Hootenanny.
*
* Hootenanny is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --------------------------------------------------------------------
*
* The following copyright notices are generated automatically. If you
* have a new notice to add, please use the format:
* " * @copyright Copyright ..."
* This will properly maintain the copyright information. DigitalGlobe
* copyrights will be updated automatically.
*
* @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
*/
#ifndef LONGESTTAGVISITOR_H
#define LONGESTTAGVISITOR_H
// hoot
#include <hoot/core/elements/ConstElementVisitor.h>
#include <hoot/core/info/SingleStatistic.h>
namespace hoot
{
class LongestTagVisitor : public ConstElementVisitor, public SingleStatistic
{
public:
static std::string className() { return "hoot::LongestTagVisitor"; }
LongestTagVisitor() : _longestTag(0) { }
virtual ~LongestTagVisitor() = default;
double getStat() const { return _longestTag; }
QString getLongestTag() const { return _tag; }
virtual void visit(const ConstElementPtr& e);
virtual QString getDescription() const { return "Identifies the tag with the largest text size"; }
virtual std::string getClassName() const { return className(); }
private:
int _longestTag;
QString _tag;
};
}
#endif // LONGESTTAGVISITOR_H
| {
"pile_set_name": "Github"
} |
import { ContractKit, newKitFromWeb3 } from '@celo/contractkit'
import { newReleaseGold } from '@celo/contractkit/lib/generated/ReleaseGold'
import { ReleaseGoldWrapper } from '@celo/contractkit/lib/wrappers/ReleaseGold'
import { getContractFromEvent, testWithGanache, timeTravel } from '@celo/dev-utils/lib/ganache-test'
import Web3 from 'web3'
import CreateAccount from './create-account'
import SetLiquidityProvision from './set-liquidity-provision'
import RGTransferDollars from './transfer-dollars'
import Withdraw from './withdraw'
process.env.NO_SYNCCHECK = 'true'
testWithGanache('releasegold:withdraw cmd', (web3: Web3) => {
let contractAddress: string
let kit: ContractKit
beforeEach(async () => {
const contractCanValidate = true
contractAddress = await getContractFromEvent(
'ReleaseGoldInstanceCreated(address,address)',
web3,
contractCanValidate
)
kit = newKitFromWeb3(web3)
await CreateAccount.run(['--contract', contractAddress])
})
test('can withdraw released gold to beneficiary', async () => {
await SetLiquidityProvision.run(['--contract', contractAddress, '--yesreally'])
// ReleasePeriod of default contract
await timeTravel(100000000, web3)
const releaseGoldWrapper = new ReleaseGoldWrapper(kit, newReleaseGold(web3, contractAddress))
const beneficiary = await releaseGoldWrapper.getBeneficiary()
const balanceBefore = await kit.getTotalBalance(beneficiary)
await Withdraw.run(['--contract', contractAddress, '--value', '10000000000000000000000'])
const balanceAfter = await kit.getTotalBalance(beneficiary)
await expect(balanceBefore.CELO.toNumber()).toBeLessThan(balanceAfter.CELO.toNumber())
})
test("can't withdraw the whole balance if there is a cUSD balance", async () => {
await SetLiquidityProvision.run(['--contract', contractAddress, '--yesreally'])
// ReleasePeriod of default contract
await timeTravel(100000000, web3)
const releaseGoldWrapper = new ReleaseGoldWrapper(kit, newReleaseGold(web3, contractAddress))
const beneficiary = await releaseGoldWrapper.getBeneficiary()
const balanceBefore = await kit.getTotalBalance(beneficiary)
const remainingBalance = await releaseGoldWrapper.getRemainingUnlockedBalance()
const stableToken = await kit.contracts.getStableToken()
await stableToken.transfer(contractAddress, 100).sendAndWaitForReceipt({ from: beneficiary })
// Can't withdraw since there is cUSD balance still
await expect(
Withdraw.run(['--contract', contractAddress, '--value', remainingBalance.toString()])
).rejects.toThrow()
// Move out the cUSD balance
await await RGTransferDollars.run([
'--contract',
contractAddress,
'--to',
beneficiary,
'--value',
'100',
])
await Withdraw.run(['--contract', contractAddress, '--value', remainingBalance.toString()])
const balanceAfter = await kit.getTotalBalance(beneficiary)
await expect(balanceBefore.CELO.toNumber()).toBeLessThan(balanceAfter.CELO.toNumber())
// Contract should self-destruct now
await expect(releaseGoldWrapper.getRemainingUnlockedBalance()).rejects.toThrow()
})
})
| {
"pile_set_name": "Github"
} |
// Scintilla source code edit control
/** @file PerLine.h
** Manages data associated with each line of the document
**/
// Copyright 1998-2009 by Neil Hodgson <[email protected]>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef PERLINE_H
#define PERLINE_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
* This holds the marker identifier and the marker type to display.
* MarkerHandleNumbers are members of lists.
*/
struct MarkerHandleNumber {
int handle;
int number;
MarkerHandleNumber *next;
};
/**
* A marker handle set contains any number of MarkerHandleNumbers.
*/
class MarkerHandleSet {
MarkerHandleNumber *root;
public:
MarkerHandleSet();
~MarkerHandleSet();
int Length() const;
int MarkValue() const; ///< Bit set of marker numbers.
bool Contains(int handle) const;
bool InsertHandle(int handle, int markerNum);
void RemoveHandle(int handle);
bool RemoveNumber(int markerNum, bool all);
void CombineWith(MarkerHandleSet *other);
};
class LineMarkers : public PerLine {
SplitVector<MarkerHandleSet *> markers;
/// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
int handleCurrent;
public:
LineMarkers() : handleCurrent(0) {
}
virtual ~LineMarkers();
virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
int MarkValue(int line);
int MarkerNext(int lineStart, int mask) const;
int AddMark(int line, int marker, int lines);
void MergeMarkers(int pos);
bool DeleteMark(int line, int markerNum, bool all);
void DeleteMarkFromHandle(int markerHandle);
int LineFromHandle(int markerHandle);
};
class LineLevels : public PerLine {
SplitVector<int> levels;
public:
virtual ~LineLevels();
virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
void ExpandLevels(int sizeNew=-1);
void ClearLevels();
int SetLevel(int line, int level, int lines);
int GetLevel(int line) const;
};
class LineState : public PerLine {
SplitVector<int> lineStates;
public:
LineState() {
}
virtual ~LineState();
virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
int SetLineState(int line, int state);
int GetLineState(int line);
int GetMaxLineState() const;
};
class LineAnnotation : public PerLine {
SplitVector<char *> annotations;
public:
LineAnnotation() {
}
virtual ~LineAnnotation();
virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
bool MultipleStyles(int line) const;
int Style(int line) const;
const char *Text(int line) const;
const unsigned char *Styles(int line) const;
void SetText(int line, const char *text);
void ClearAll();
void SetStyle(int line, int style);
void SetStyles(int line, const unsigned char *styles);
int Length(int line) const;
int Lines(int line) const;
};
#ifdef SCI_NAMESPACE
}
#endif
#endif
| {
"pile_set_name": "Github"
} |
/*
* stripdsrheader.{cc,hh} -- element removes DSR header (saving it for later)
* Florian Sesser, Technical University of Munich, 2010
*
* Based on work by Eddie Kohler, Shweta Bhandare, Sagar Sanghani,
* Sheetalkumar Doshi, Timothy X Brown Daniel Aguayo
*
* Copyright (c) 2003 Massachusetts Institute of Technology
* Copyright (c) 2003 University of Colorado at Boulder
*
* 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, subject to the conditions
* listed in the Click LICENSE file. These conditions include: you must
* preserve this copyright notice, and you cannot mention the copyright
* holders in advertising related to the Software without their permission.
* The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
* notice is a summary of the Click LICENSE file; the license in that file is
* legally binding.
*/
#include <click/config.h>
#include "stripdsrheader.hh"
#include <click/packet_anno.hh>
#include <clicknet/ip.h>
#include "dsr.hh"
CLICK_DECLS
StripDSRHeader::StripDSRHeader()
{
}
StripDSRHeader::~StripDSRHeader()
{
}
Packet *
StripDSRHeader::simple_action(Packet *p)
{
const click_dsr_option *dsr_option = (const click_dsr_option *)
(p->data() + sizeof(click_ip)
+ sizeof(click_dsr));
if (dsr_option->dsr_type != DSR_TYPE_SOURCE_ROUTE) {
// this is not a DSR DATA packet -- do "nothing"
// (but mark the packet to not unstrip it later)
SET_VLAN_TCI_ANNO(p, 1);
// click_chatter("StripDSR: Marked non-payload");
return p;
}
return swap_headers(p);
}
// from dsrroutetable.cc, was called strip_headers()
// removes all DSR headers, leaving an ordinary IP packet
// changes: saves DSR header to later be able to undo the stripping
Packet *
StripDSRHeader::swap_headers(Packet *p_in)
{
WritablePacket *p = p_in->uniqueify();
click_ip *ip = reinterpret_cast<click_ip *>(p->data());
click_dsr *dsr = (click_dsr *)(p->data() + sizeof(click_ip));
assert(ip->ip_p == IP_PROTO_DSR);
// get the length of the DSR headers from the fixed header
unsigned dsr_len = sizeof(click_dsr) + ntohs(dsr->dsr_len);
// save the IP header
click_ip new_ip;
memcpy(&new_ip, ip, sizeof(click_ip));
new_ip.ip_p = dsr->dsr_next_header;
// save the to-be-overwritten DSR part to the orig. ip header (swap them)
memcpy(ip, dsr, dsr_len);
// save the offset to the VLAN_ANNO tag
SET_VLAN_TCI_ANNO(p, htons(dsr_len));
// remove the headers
p->pull(dsr_len);
memcpy(p->data(), &new_ip, sizeof(click_ip));
ip=reinterpret_cast<click_ip *>(p->data());
ip->ip_len=htons(p->length());
ip->ip_sum=0;
ip->ip_sum=click_in_cksum((unsigned char *)ip,sizeof(click_ip));
p->set_ip_header((click_ip*)p->data(),sizeof(click_ip));
// click_chatter("StripDSR: Removed %d bytes\n", dsr_len);
return p;
}
CLICK_ENDDECLS
EXPORT_ELEMENT(StripDSRHeader)
ELEMENT_MT_SAFE(StripDSRHeader)
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Diagnostics;
using Kitware.VTK;
namespace ActiViz.Examples {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void renderWindowControl1_Load(object sender, EventArgs e) {
try {
MatrixMathFilter();
}
catch(Exception ex) {
MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK);
}
}
private void MatrixMathFilter() {
// Path to vtk data must be set as an environment variable
// VTK_DATA_ROOT = "C:\VTK\vtkdata-5.8.0"
vtkTesting test = vtkTesting.New();
string root = test.GetDataRoot();
string filePath = System.IO.Path.Combine(root, @"Data\tensors.vtk");
vtkUnstructuredGridReader reader = vtkUnstructuredGridReader.New();
reader.SetFileName(filePath);
reader.Update();
vtkDataSetSurfaceFilter surfaceFilter = vtkDataSetSurfaceFilter.New();
surfaceFilter.SetInputConnection(reader.GetOutputPort());
surfaceFilter.Update();
vtkMatrixMathFilter matrixMathFilter = vtkMatrixMathFilter.New();
//matrixMathFilter.SetOperationToDeterminant();
matrixMathFilter.SetOperationToEigenvalue();
matrixMathFilter.SetInputConnection(surfaceFilter.GetOutputPort());
matrixMathFilter.Update();
matrixMathFilter.GetOutput().GetPointData().SetActiveScalars("Eigenvalue");
vtkXMLPolyDataWriter writer = vtkXMLPolyDataWriter.New();
writer.SetInputConnection(matrixMathFilter.GetOutputPort());
writer.SetFileName(System.IO.Path.Combine(root, @"Data\output.vtp"));
writer.Write();
vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
mapper.SetInputConnection(matrixMathFilter.GetOutputPort());
// actor
vtkActor actor = vtkActor.New();
actor.SetMapper(mapper);
// get a reference to the renderwindow of our renderWindowControl1
vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
// renderer
vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();
// set background color
renderer.SetBackground(0.2, 0.3, 0.4);
// add our actor to the renderer
renderer.AddActor(actor);
}
}
}
| {
"pile_set_name": "Github"
} |
#ifndef PQCLEAN_SNTRUP761_AVX2_CRYPTO_DECODE_761XINT16_H
#define PQCLEAN_SNTRUP761_AVX2_CRYPTO_DECODE_761XINT16_H
#include <stdint.h>
#define PQCLEAN_SNTRUP761_AVX2_crypto_decode_761xint16_STRBYTES 1522
#define PQCLEAN_SNTRUP761_AVX2_crypto_decode_761xint16_ITEMBYTES 2
#define PQCLEAN_SNTRUP761_AVX2_crypto_decode_761xint16_ITEMS 761
void PQCLEAN_SNTRUP761_AVX2_crypto_decode_761xint16(void *v, const unsigned char *s);
#endif
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:spdx="http://spdx.org/rdf/terms#">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="sites/all/themes/cpstandard/favicon.ico" type="image/vnd.microsoft.icon" />
<title>Apache License 2.0 | Software Package Data Exchange (SPDX)</title>
<link rel="shortcut icon" href="sites/all/themes/cpstandard/favicon.ico" type="image/vnd.microsoft.icon" />
<link type="text/css" rel="stylesheet" media="all" href="sites/all/themes/cpstandard/css/style.css" />
<link type="text/css" rel="stylesheet" media="all" href="sites/all/themes/cpstandard/css/colors.css" />
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet" />
<!-- GOOGLE FONTS -->
<link href='//fonts.googleapis.com/css?family=Roboto:400,400italic,300,300italic,100italic,100,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css' />
<style type="text/css">
.page {
color: #58595b;
}
#header {
border-bottom: 3px solid #4597cb;
padding-bottom: 50px;
}
.breadcrumb {
margin-top: 25px;
}
#content-header h1 {
color: #58595b;
}
.page h2, h3, h4, h5 {
color: #4597cb;
}
.page h1 {
font-size: 2em;
}
.page h2 {
font-size: 1.5em;
}
a, a:visited, a:hover {
color: #4597cb;
}
#footer-copyright {
margin-top: 25px;
}
.replacable-license-text {
color: #CC0000;
}
.replacable-license-text p var {
color: #CC0000;
}
.optional-license-text {
color: #0000cc;
}
.optional-license-text p var {
color: #0000cc;
}
ul, ol, li {
margin: 10px 0 10px 0;
}
</style>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-3676394-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body typeof="spdx:License">
<div id="lf-header" class="collaborative-projects">
<div class="gray-diagonal">
<div class="container">
<a id="collaborative-projects-logo" href="http://collabprojects.linuxfoundation.org">Linux Foundation Collaborative Projects</a>
</div>
</div>
</div>
<div id="header">
<div id="header-inner">
<a href="/" title="Home" rel="home" id="logo">
<img src="https://spdx.org/sites/cpstandard/files/logo_spdx_250.png" alt="Home" />
</a>
<div id="name-and-slogan">
<div id="site-name">
<h1><a href="/" title="Home" rel="home">Software Package Data Exchange (SPDX)</a></h1>
</div>
</div>
</div>
</div> <!-- /header -->
<div id="highlighted">
<div class="region region-highlighted">
</div>
</div>
<div id="page" class="page">
<div class="breadcrumb"><a href="/">Home</a> » <a href="/licenses">Licenses</a></div>
<h1 property="dc:title">Apache License 2.0</h1>
<div style="display:none;"><code property="spdx:deprecated">false</code></div>
<h2>Full name</h2>
<p style="margin-left: 20px;"><code property="spdx:name">Apache License 2.0</code></p>
<h2>Short identifier</h2>
<p style="margin-left: 20px;"><code property="spdx:licenseId">Apache-2.0</code></p>
<h2>Other web pages for this license</h2>
<div style="margin-left: 20px;">
<ul>
<li><a href="http://www.apache.org/licenses/LICENSE-2.0" rel="rdfs:seeAlso">http://www.apache.org/licenses/LICENSE-2.0</a></li>
<li><a href="https://opensource.org/licenses/Apache-2.0" rel="rdfs:seeAlso">https://opensource.org/licenses/Apache-2.0</a></li>
</ul>
</div>
<div property="spdx:isOsiApproved" style="display: none;">true</div>
<h2 id="notes">Notes</h2>
<p style="margin-left: 20px;">This license was released January 2004</p>
<h2 id="licenseText">Text</h2>
<div property="spdx:licenseText" class="license-text">
<div class="optional-license-text">
<p>Apache License
<br />
Version 2.0, January 2004
<br />
http://www.apache.org/licenses/
</p>
</div>
<div class="optional-license-text">
<p>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</p>
</div>
<ul style="list-style:none">
<li>
<var class="replacable-license-text">1.</var>
Definitions.
<ul style="list-style:none">
<li>
<p>"License" shall mean the terms and conditions for use, reproduction, and distribution
as defined by Sections 1 through 9 of this document.</p>
</li>
<li>
<p>"Licensor" shall mean the copyright owner or entity authorized by the copyright owner
that is granting the License.</p>
</li>
<li>
<p>"Legal Entity" shall mean the union of the acting entity and all other entities that
control, are controlled by, or are under common control with that entity. For the purposes of
this definition, "control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or otherwise, or (ii) ownership of
fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such
entity.</p>
</li>
<li>
<p>"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.</p>
</li>
<li>
<p>"Source" form shall mean the preferred form for making modifications, including but not
limited to software source code, documentation source, and configuration files.</p>
</li>
<li>
<p>"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code, generated
documentation, and conversions to other media types.</p>
</li>
<li>
<p>"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included in or
attached to the work (an example is provided in the Appendix below).</p>
</li>
<li>
<p>"Derivative Works" shall mean any work, whether in Source or Object form, that is based
on (or derived from) the Work and for which the editorial revisions, annotations,
elaborations, or other modifications represent, as a whole, an original work of authorship.
For the purposes of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative
Works thereof.</p>
</li>
<li>
<p>"Contribution" shall mean any work of authorship, including the original version of the
Work and any modifications or additions to that Work or Derivative Works thereof, that is
intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an
individual or Legal Entity authorized to submit on behalf of the copyright owner. For the
purposes of this definition, "submitted" means any form of electronic, verbal, or
written communication sent to the Licensor or its representatives, including but not limited
to communication on electronic mailing lists, source code control systems, and issue tracking
systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and
improving the Work, but excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."</p>
</li>
<li>
<p>"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom
a Contribution has been received by Licensor and subsequently incorporated within the
Work.</p>
</li>
</ul>
</li>
<li>
<var class="replacable-license-text">2.</var>
Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display,
publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or
Object form.
</li>
<li>
<var class="replacable-license-text">3.</var>
Grant of Patent License. Subject to the terms and conditions of this License, each Contributor
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have made, use, offer
to sell, sell, import, and otherwise transfer the Work, where such license applies only to
those patent claims licensable by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s) with the Work to which such
Contribution(s) was submitted. If You institute patent litigation against any entity
(including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory patent
infringement, then any patent licenses granted to You under this License for that Work shall
terminate as of the date such litigation is filed.
</li>
<li>
<var class="replacable-license-text">4.</var>
Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form, provided that You
meet the following conditions:
<ul style="list-style:none">
<li>
<var class="replacable-license-text">(a)</var>
You must give any other recipients of the Work or Derivative Works a copy of this License; and
</li>
<li>
<var class="replacable-license-text">(b)</var>
You must cause any modified files to carry prominent notices stating that You changed the files; and
</li>
<li>
<var class="replacable-license-text">(c)</var>
You must retain, in the Source form of any Derivative Works that You distribute, all
copyright, patent, trademark, and attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of the Derivative Works; and
</li>
<li>
<var class="replacable-license-text">(d)</var>
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the attribution
notices contained within such NOTICE file, excluding those notices that do not pertain to
any part of the Derivative Works, in at least one of the following places: within a NOTICE
text file distributed as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or, within a display generated
by the Derivative Works, if and wherever such third-party notices normally appear. The
contents of the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that You
distribute, alongside or as an addendum to the NOTICE text from the Work, provided that
such additional attribution notices cannot be construed as modifying the License.
<p>You may add Your own copyright statement to Your modifications and may provide additional or
different license terms and conditions for use, reproduction, or distribution of Your
modifications, or for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with the conditions stated
in this License.</p>
</li>
</ul>
</li>
<li>
<var class="replacable-license-text">5.</var>
Submission of Contributions. Unless You explicitly state otherwise, any Contribution
intentionally submitted for inclusion in the Work by You to the Licensor shall be under the
terms and conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate
license agreement you may have executed with Licensor regarding such Contributions.
</li>
<li>
<var class="replacable-license-text">6.</var>
Trademarks. This License does not grant permission to use the trade names, trademarks, service
marks, or product names of the Licensor, except as required for reasonable and customary use
in describing the origin of the Work and reproducing the content of the NOTICE file.
</li>
<li>
<var class="replacable-license-text">7.</var>
Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor
provides the Work (and each Contributor provides its Contributions) on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including,
without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY,
or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any risks associated with Your
exercise of permissions under this License.
</li>
<li>
<var class="replacable-license-text">8.</var>
Limitation of Liability. In no event and under no legal theory, whether in tort (including
negligence), contract, or otherwise, unless required by applicable law (such as deliberate and
grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for
damages, including any direct, indirect, special, incidental, or consequential damages of any
character arising as a result of this License or out of the use or inability to use the Work
(including but not limited to damages for loss of goodwill, work stoppage, computer failure or
malfunction, or any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
</li>
<li>
<var class="replacable-license-text">9.</var>
Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works
thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty,
indemnity, or other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your sole
responsibility, not on behalf of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability incurred by, or claims asserted
against, such Contributor by reason of your accepting any such warranty or additional
liability.
</li>
</ul>
<div class="optional-license-text">
<p>END OF TERMS AND CONDITIONS</p>
<p>APPENDIX: How to apply the Apache License to your work.</p>
<p>To apply the Apache License to your work, attach the following boilerplate notice, with the fields
enclosed by brackets "[]" replaced with your own identifying information. (Don't
include the brackets!) The text should be enclosed in the appropriate comment syntax for the file
format. We also recommend that a file or class name and description of purpose be included on the same
"printed page" as the copyright notice for easier identification within third-party
archives.</p>
<p>Copyright
<var class="replacable-license-text">[yyyy] [name of copyright owner]</var></p>
<p>Licensed under the Apache License, Version 2.0 (the "License");
<br />
you may not use this file except in compliance with the License.
<br />
You may obtain a copy of the License at
</p>
<p>http://www.apache.org/licenses/LICENSE-2.0</p>
<p>Unless required by applicable law or agreed to in writing, software
<br />
distributed under the License is distributed on an "AS IS" BASIS,
<br />
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<br />
See the License for the specific language governing permissions and
<br />
limitations under the License.
</p>
</div>
</div>
<h2 id="licenseHeader">Standard License Header</h2>
<div property="spdx:standardLicenseHeader" class="license-text">
<p>Copyright
<var class="replacable-license-text">[yyyy] [name of copyright owner]</var></p>
<p>Licensed under the Apache License, Version 2.0 (the "License");
<br />
you may not use this file except in compliance with the License.
<br />
You may obtain a copy of the License at
</p>
<p>http://www.apache.org/licenses/LICENSE-2.0</p>
<p>Unless required by applicable law or agreed to in writing, software
<br />
distributed under the License is distributed on an "AS IS" BASIS,
<br />
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<br />
See the License for the specific language governing permissions and
<br />
limitations under the License.
</p>
</div>
<div property="spdx:standardLicenseTemplate" style="display: none;">
<<beginOptional>> Apache License Version 2.0, January 2004 http://www.apache.org/licenses/<<endOptional>><<beginOptional>> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION<<endOptional>> <<var;name="bullet";original="1.";match=".{0,20}">> Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. <<var;name="bullet";original="2.";match=".{0,20}">> Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. <<var;name="bullet";original="3.";match=".{0,20}">> Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. <<var;name="bullet";original="4.";match=".{0,20}">> Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: <<var;name="bullet";original="(a)";match=".{0,20}">> You must give any other recipients of the Work or Derivative Works a copy of this License; and <<var;name="bullet";original="(b)";match=".{0,20}">> You must cause any modified files to carry prominent notices stating that You changed the files; and <<var;name="bullet";original="(c)";match=".{0,20}">> You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and <<var;name="bullet";original="(d)";match=".{0,20}">> If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. <<var;name="bullet";original="5.";match=".{0,20}">> Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. <<var;name="bullet";original="6.";match=".{0,20}">> Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. <<var;name="bullet";original="7.";match=".{0,20}">> Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. <<var;name="bullet";original="8.";match=".{0,20}">> Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. <<var;name="bullet";original="9.";match=".{0,20}">> Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.<<beginOptional>> END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright <<var;name="copyright";original="[yyyy] [name of copyright owner]";match=".+">> 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.<<endOptional>>
</div>
</div> <!-- /page -->
<div class="collaborative-projects">
<div class="gray-diagonal">
<div class="container">
<div id="footer-copyright">
<p>© 2018 SPDX Workgroup a Linux Foundation Project. All Rights Reserved. </p>
<p>Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered <a href="http://www.linuxfoundation.org/programs/legal/trademark" title="Linux Mark Institute">trademark</a> of Linus Torvalds.</p>
<p>Please see our <a href="http://www.linuxfoundation.org/privacy">privacy policy</a> and <a href="http://www.linuxfoundation.org/terms">terms of use</a>.</p>
</div>
</div>
</div>
</div>
<div id="top-page-link">
<a href="#"><i class="fa fa-arrow-circle-up"></i><span>top of page</span></a>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
//
// Prefix header for all source files of the 'Scintilla' target in the 'Scintilla' project.
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
| {
"pile_set_name": "Github"
} |
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: prometheus-k8s
rules:
- apiGroups:
- ""
resources:
- nodes/metrics
verbs:
- get
- nonResourceURLs:
- /metrics
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: prometheus-k8s
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prometheus-k8s
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: monitoring
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: prometheus-k8s
namespace: monitoring
rules:
- apiGroups:
- ""
resources:
- nodes
- services
- endpoints
- pods
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: prometheus-k8s
namespace: monitoring
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: prometheus-k8s
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: monitoring
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: prometheus-k8s
namespace: kube-system
rules:
- apiGroups:
- ""
resources:
- nodes
- services
- endpoints
- pods
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: prometheus-k8s
namespace: kube-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: prometheus-k8s
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: monitoring
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: prometheus-k8s
namespace: default
rules:
- apiGroups:
- ""
resources:
- nodes
- services
- endpoints
- pods
verbs:
- get
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: prometheus-k8s
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: prometheus-k8s
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: monitoring
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: prometheus-k8s-config
namespace: monitoring
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: prometheus-k8s-config
namespace: monitoring
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: prometheus-k8s-config
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: monitoring
| {
"pile_set_name": "Github"
} |
2.17.1 / 2018-08-07
==================
* Fix bug in command emit (#844)
2.17.0 / 2018-08-03
==================
* fixed newline output after help information (#833)
* Fix to emit the action even without command (#778)
* npm update (#823)
2.16.0 / 2018-06-29
==================
* Remove Makefile and `test/run` (#821)
* Make 'npm test' run on Windows (#820)
* Add badge to display install size (#807)
* chore: cache node_modules (#814)
* chore: remove Node.js 4 (EOL), add Node.js 10 (#813)
* fixed typo in readme (#812)
* Fix types (#804)
* Update eslint to resolve vulnerabilities in lodash (#799)
* updated readme with custom event listeners. (#791)
* fix tests (#794)
2.15.0 / 2018-03-07
==================
* Update downloads badge to point to graph of downloads over time instead of duplicating link to npm
* Arguments description
2.14.1 / 2018-02-07
==================
* Fix typing of help function
2.14.0 / 2018-02-05
==================
* only register the option:version event once
* Fixes issue #727: Passing empty string for option on command is set to undefined
* enable eqeqeq rule
* resolves #754 add linter configuration to project
* resolves #560 respect custom name for version option
* document how to override the version flag
* document using options per command
2.13.0 / 2018-01-09
==================
* Do not print default for --no-
* remove trailing spaces in command help
* Update CI's Node.js to LTS and latest version
* typedefs: Command and Option types added to commander namespace
2.12.2 / 2017-11-28
==================
* fix: typings are not shipped
2.12.1 / 2017-11-23
==================
* Move @types/node to dev dependency
2.12.0 / 2017-11-22
==================
* add attributeName() method to Option objects
* Documentation updated for options with --no prefix
* typings: `outputHelp` takes a string as the first parameter
* typings: use overloads
* feat(typings): update to match js api
* Print default value in option help
* Fix translation error
* Fail when using same command and alias (#491)
* feat(typings): add help callback
* fix bug when description is add after command with options (#662)
* Format js code
* Rename History.md to CHANGELOG.md (#668)
* feat(typings): add typings to support TypeScript (#646)
* use current node
2.11.0 / 2017-07-03
==================
* Fix help section order and padding (#652)
* feature: support for signals to subcommands (#632)
* Fixed #37, --help should not display first (#447)
* Fix translation errors. (#570)
* Add package-lock.json
* Remove engines
* Upgrade package version
* Prefix events to prevent conflicts between commands and options (#494)
* Removing dependency on graceful-readlink
* Support setting name in #name function and make it chainable
* Add .vscode directory to .gitignore (Visual Studio Code metadata)
* Updated link to ruby commander in readme files
2.10.0 / 2017-06-19
==================
* Update .travis.yml. drop support for older node.js versions.
* Fix require arguments in README.md
* On SemVer you do not start from 0.0.1
* Add missing semi colon in readme
* Add save param to npm install
* node v6 travis test
* Update Readme_zh-CN.md
* Allow literal '--' to be passed-through as an argument
* Test subcommand alias help
* link build badge to master branch
* Support the alias of Git style sub-command
* added keyword commander for better search result on npm
* Fix Sub-Subcommands
* test node.js stable
* Fixes TypeError when a command has an option called `--description`
* Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets.
* Add chinese Readme file
2.9.0 / 2015-10-13
==================
* Add option `isDefault` to set default subcommand #415 @Qix-
* Add callback to allow filtering or post-processing of help text #434 @djulien
* Fix `undefined` text in help information close #414 #416 @zhiyelee
2.8.1 / 2015-04-22
==================
* Back out `support multiline description` Close #396 #397
2.8.0 / 2015-04-07
==================
* Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee
* Fix bug in Git-style sub-commands #372 @zhiyelee
* Allow commands to be hidden from help #383 @tonylukasavage
* When git-style sub-commands are in use, yet none are called, display help #382 @claylo
* Add ability to specify arguments syntax for top-level command #258 @rrthomas
* Support multiline descriptions #208 @zxqfox
2.7.1 / 2015-03-11
==================
* Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367.
2.7.0 / 2015-03-09
==================
* Fix git-style bug when installed globally. Close #335 #349 @zhiyelee
* Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage
* Add support for camelCase on `opts()`. Close #353 @nkzawa
* Add node.js 0.12 and io.js to travis.yml
* Allow RegEx options. #337 @palanik
* Fixes exit code when sub-command failing. Close #260 #332 @pirelenito
* git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee
2.6.0 / 2014-12-30
==================
* added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee
* Add application description to the help msg. Close #112 @dalssoft
2.5.1 / 2014-12-15
==================
* fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee
2.5.0 / 2014-10-24
==================
* add support for variadic arguments. Closes #277 @whitlockjc
2.4.0 / 2014-10-17
==================
* fixed a bug on executing the coercion function of subcommands option. Closes #270
* added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage
* added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage
* fixed a bug on subcommand name. Closes #248 @jonathandelgado
* fixed function normalize doesn’t honor option terminator. Closes #216 @abbr
2.3.0 / 2014-07-16
==================
* add command alias'. Closes PR #210
* fix: Typos. Closes #99
* fix: Unused fs module. Closes #217
2.2.0 / 2014-03-29
==================
* add passing of previous option value
* fix: support subcommands on windows. Closes #142
* Now the defaultValue passed as the second argument of the coercion function.
2.1.0 / 2013-11-21
==================
* add: allow cflag style option params, unit test, fixes #174
2.0.0 / 2013-07-18
==================
* remove input methods (.prompt, .confirm, etc)
1.3.2 / 2013-07-18
==================
* add support for sub-commands to co-exist with the original command
1.3.1 / 2013-07-18
==================
* add quick .runningCommand hack so you can opt-out of other logic when running a sub command
1.3.0 / 2013-07-09
==================
* add EACCES error handling
* fix sub-command --help
1.2.0 / 2013-06-13
==================
* allow "-" hyphen as an option argument
* support for RegExp coercion
1.1.1 / 2012-11-20
==================
* add more sub-command padding
* fix .usage() when args are present. Closes #106
1.1.0 / 2012-11-16
==================
* add git-style executable subcommand support. Closes #94
1.0.5 / 2012-10-09
==================
* fix `--name` clobbering. Closes #92
* fix examples/help. Closes #89
1.0.4 / 2012-09-03
==================
* add `outputHelp()` method.
1.0.3 / 2012-08-30
==================
* remove invalid .version() defaulting
1.0.2 / 2012-08-24
==================
* add `--foo=bar` support [arv]
* fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
1.0.1 / 2012-08-03
==================
* fix issue #56
* fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
1.0.0 / 2012-07-05
==================
* add support for optional option descriptions
* add defaulting of `.version()` to package.json's version
0.6.1 / 2012-06-01
==================
* Added: append (yes or no) on confirmation
* Added: allow node.js v0.7.x
0.6.0 / 2012-04-10
==================
* Added `.prompt(obj, callback)` support. Closes #49
* Added default support to .choose(). Closes #41
* Fixed the choice example
0.5.1 / 2011-12-20
==================
* Fixed `password()` for recent nodes. Closes #36
0.5.0 / 2011-12-04
==================
* Added sub-command option support [itay]
0.4.3 / 2011-12-04
==================
* Fixed custom help ordering. Closes #32
0.4.2 / 2011-11-24
==================
* Added travis support
* Fixed: line-buffered input automatically trimmed. Closes #31
0.4.1 / 2011-11-18
==================
* Removed listening for "close" on --help
0.4.0 / 2011-11-15
==================
* Added support for `--`. Closes #24
0.3.3 / 2011-11-14
==================
* Fixed: wait for close event when writing help info [Jerry Hamlet]
0.3.2 / 2011-11-01
==================
* Fixed long flag definitions with values [felixge]
0.3.1 / 2011-10-31
==================
* Changed `--version` short flag to `-V` from `-v`
* Changed `.version()` so it's configurable [felixge]
0.3.0 / 2011-10-31
==================
* Added support for long flags only. Closes #18
0.2.1 / 2011-10-24
==================
* "node": ">= 0.4.x < 0.7.0". Closes #20
0.2.0 / 2011-09-26
==================
* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
0.1.0 / 2011-08-24
==================
* Added support for custom `--help` output
0.0.5 / 2011-08-18
==================
* Changed: when the user enters nothing prompt for password again
* Fixed issue with passwords beginning with numbers [NuckChorris]
0.0.4 / 2011-08-15
==================
* Fixed `Commander#args`
0.0.3 / 2011-08-15
==================
* Added default option value support
0.0.2 / 2011-08-15
==================
* Added mask support to `Command#password(str[, mask], fn)`
* Added `Command#password(str, fn)`
0.0.1 / 2010-01-03
==================
* Initial release
| {
"pile_set_name": "Github"
} |
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build s390x,linux
package unix
import (
"unsafe"
)
//sys Dup2(oldfd int, newfd int) (err error)
//sysnb EpollCreate(size int) (fd int, err error)
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstat(fd int, stat *Stat_t) (err error)
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
//sys Ftruncate(fd int, length int64) (err error)
//sysnb Getegid() (egid int)
//sysnb Geteuid() (euid int)
//sysnb Getgid() (gid int)
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
//sysnb Getuid() (uid int)
//sysnb InotifyInit() (fd int, err error)
//sys Lchown(path string, uid int, gid int) (err error)
//sys Lstat(path string, stat *Stat_t) (err error)
//sys Pause() (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
//sys Setfsgid(gid int) (err error)
//sys Setfsuid(uid int) (err error)
//sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
//sys Stat(path string, stat *Stat_t) (err error)
//sys Statfs(path string, buf *Statfs_t) (err error)
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
//sys Truncate(path string, length int64) (err error)
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
//sysnb setgroups(n int, list *_Gid_t) (err error)
//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
//sysnb Gettimeofday(tv *Timeval) (err error)
func Time(t *Time_t) (tt Time_t, err error) {
var tv Timeval
err = Gettimeofday(&tv)
if err != nil {
return 0, err
}
if t != nil {
*t = Time_t(tv.Sec)
}
return Time_t(tv.Sec), nil
}
//sys Utime(path string, buf *Utimbuf) (err error)
//sys utimes(path string, times *[2]Timeval) (err error)
func setTimespec(sec, nsec int64) Timespec {
return Timespec{Sec: sec, Nsec: nsec}
}
func setTimeval(sec, usec int64) Timeval {
return Timeval{Sec: sec, Usec: usec}
}
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe(p []int) (err error) {
if len(p) != 2 {
return EINVAL
}
var pp [2]_C_int
err = pipe2(&pp, 0) // pipe2 is the same as pipe when flags are set to 0.
p[0] = int(pp[0])
p[1] = int(pp[1])
return
}
func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
return EINVAL
}
var pp [2]_C_int
err = pipe2(&pp, flags)
p[0] = int(pp[0])
p[1] = int(pp[1])
return
}
func Ioperm(from int, num int, on int) (err error) {
return ENOSYS
}
func Iopl(level int) (err error) {
return ENOSYS
}
func (r *PtraceRegs) PC() uint64 { return r.Psw.Addr }
func (r *PtraceRegs) SetPC(pc uint64) { r.Psw.Addr = pc }
func (iov *Iovec) SetLen(length int) {
iov.Len = uint64(length)
}
func (msghdr *Msghdr) SetControllen(length int) {
msghdr.Controllen = uint64(length)
}
func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint64(length)
}
// Linux on s390x uses the old mmap interface, which requires arguments to be passed in a struct.
// mmap2 also requires arguments to be passed in a struct; it is currently not exposed in <asm/unistd.h>.
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
mmap_args := [6]uintptr{addr, length, uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)}
r0, _, e1 := Syscall(SYS_MMAP, uintptr(unsafe.Pointer(&mmap_args[0])), 0, 0)
xaddr = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// On s390x Linux, all the socket calls go through an extra indirection.
// The arguments to the underlying system call (SYS_SOCKETCALL) are the
// number below and a pointer to an array of uintptr.
const (
// see linux/net.h
netSocket = 1
netBind = 2
netConnect = 3
netListen = 4
netAccept = 5
netGetSockName = 6
netGetPeerName = 7
netSocketPair = 8
netSend = 9
netRecv = 10
netSendTo = 11
netRecvFrom = 12
netShutdown = 13
netSetSockOpt = 14
netGetSockOpt = 15
netSendMsg = 16
netRecvMsg = 17
netAccept4 = 18
netRecvMMsg = 19
netSendMMsg = 20
)
func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (int, error) {
args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))}
fd, _, err := Syscall(SYS_SOCKETCALL, netAccept, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return 0, err
}
return int(fd), nil
}
func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (int, error) {
args := [4]uintptr{uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags)}
fd, _, err := Syscall(SYS_SOCKETCALL, netAccept4, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return 0, err
}
return int(fd), nil
}
func getsockname(s int, rsa *RawSockaddrAny, addrlen *_Socklen) error {
args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))}
_, _, err := RawSyscall(SYS_SOCKETCALL, netGetSockName, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return err
}
return nil
}
func getpeername(s int, rsa *RawSockaddrAny, addrlen *_Socklen) error {
args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))}
_, _, err := RawSyscall(SYS_SOCKETCALL, netGetPeerName, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return err
}
return nil
}
func socketpair(domain int, typ int, flags int, fd *[2]int32) error {
args := [4]uintptr{uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd))}
_, _, err := RawSyscall(SYS_SOCKETCALL, netSocketPair, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return err
}
return nil
}
func bind(s int, addr unsafe.Pointer, addrlen _Socklen) error {
args := [3]uintptr{uintptr(s), uintptr(addr), uintptr(addrlen)}
_, _, err := Syscall(SYS_SOCKETCALL, netBind, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return err
}
return nil
}
func connect(s int, addr unsafe.Pointer, addrlen _Socklen) error {
args := [3]uintptr{uintptr(s), uintptr(addr), uintptr(addrlen)}
_, _, err := Syscall(SYS_SOCKETCALL, netConnect, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return err
}
return nil
}
func socket(domain int, typ int, proto int) (int, error) {
args := [3]uintptr{uintptr(domain), uintptr(typ), uintptr(proto)}
fd, _, err := RawSyscall(SYS_SOCKETCALL, netSocket, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return 0, err
}
return int(fd), nil
}
func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) error {
args := [5]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen))}
_, _, err := Syscall(SYS_SOCKETCALL, netGetSockOpt, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return err
}
return nil
}
func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) error {
args := [4]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val)}
_, _, err := Syscall(SYS_SOCKETCALL, netSetSockOpt, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return err
}
return nil
}
func recvfrom(s int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (int, error) {
var base uintptr
if len(p) > 0 {
base = uintptr(unsafe.Pointer(&p[0]))
}
args := [6]uintptr{uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))}
n, _, err := Syscall(SYS_SOCKETCALL, netRecvFrom, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return 0, err
}
return int(n), nil
}
func sendto(s int, p []byte, flags int, to unsafe.Pointer, addrlen _Socklen) error {
var base uintptr
if len(p) > 0 {
base = uintptr(unsafe.Pointer(&p[0]))
}
args := [6]uintptr{uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen)}
_, _, err := Syscall(SYS_SOCKETCALL, netSendTo, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return err
}
return nil
}
func recvmsg(s int, msg *Msghdr, flags int) (int, error) {
args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)}
n, _, err := Syscall(SYS_SOCKETCALL, netRecvMsg, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return 0, err
}
return int(n), nil
}
func sendmsg(s int, msg *Msghdr, flags int) (int, error) {
args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)}
n, _, err := Syscall(SYS_SOCKETCALL, netSendMsg, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return 0, err
}
return int(n), nil
}
func Listen(s int, n int) error {
args := [2]uintptr{uintptr(s), uintptr(n)}
_, _, err := Syscall(SYS_SOCKETCALL, netListen, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return err
}
return nil
}
func Shutdown(s, how int) error {
args := [2]uintptr{uintptr(s), uintptr(how)}
_, _, err := Syscall(SYS_SOCKETCALL, netShutdown, uintptr(unsafe.Pointer(&args)), 0)
if err != 0 {
return err
}
return nil
}
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
func Poll(fds []PollFd, timeout int) (n int, err error) {
if len(fds) == 0 {
return poll(nil, 0, timeout)
}
return poll(&fds[0], len(fds), timeout)
}
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
cmdlineLen := len(cmdline)
if cmdlineLen > 0 {
// Account for the additional NULL byte added by
// BytePtrFromString in kexecFileLoad. The kexec_file_load
// syscall expects a NULL-terminated string.
cmdlineLen++
}
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
}
| {
"pile_set_name": "Github"
} |
// Copyright 2012 Gary Burd
//
// 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 redis
import (
"errors"
"time"
)
// Error represents an error returned in a command reply.
type Error string
func (err Error) Error() string { return string(err) }
// Conn represents a connection to a Redis server.
type Conn interface {
// Close closes the connection.
Close() error
// Err returns a non-nil value when the connection is not usable.
Err() error
// Do sends a command to the server and returns the received reply.
Do(commandName string, args ...interface{}) (reply interface{}, err error)
// Send writes the command to the client's output buffer.
Send(commandName string, args ...interface{}) error
// Flush flushes the output buffer to the Redis server.
Flush() error
// Receive receives a single reply from the Redis server
Receive() (reply interface{}, err error)
}
// Argument is the interface implemented by an object which wants to control how
// the object is converted to Redis bulk strings.
type Argument interface {
// RedisArg returns a value to be encoded as a bulk string per the
// conversions listed in the section 'Executing Commands'.
// Implementations should typically return a []byte or string.
RedisArg() interface{}
}
// Scanner is implemented by an object which wants to control its value is
// interpreted when read from Redis.
type Scanner interface {
// RedisScan assigns a value from a Redis value. The argument src is one of
// the reply types listed in the section `Executing Commands`.
//
// An error should be returned if the value cannot be stored without
// loss of information.
RedisScan(src interface{}) error
}
// ConnWithTimeout is an optional interface that allows the caller to override
// a connection's default read timeout. This interface is useful for executing
// the BLPOP, BRPOP, BRPOPLPUSH, XREAD and other commands that block at the
// server.
//
// A connection's default read timeout is set with the DialReadTimeout dial
// option. Applications should rely on the default timeout for commands that do
// not block at the server.
//
// All of the Conn implementations in this package satisfy the ConnWithTimeout
// interface.
//
// Use the DoWithTimeout and ReceiveWithTimeout helper functions to simplify
// use of this interface.
type ConnWithTimeout interface {
Conn
// Do sends a command to the server and returns the received reply.
// The timeout overrides the read timeout set when dialing the
// connection.
DoWithTimeout(timeout time.Duration, commandName string, args ...interface{}) (reply interface{}, err error)
// Receive receives a single reply from the Redis server. The timeout
// overrides the read timeout set when dialing the connection.
ReceiveWithTimeout(timeout time.Duration) (reply interface{}, err error)
}
var errTimeoutNotSupported = errors.New("redis: connection does not support ConnWithTimeout")
// DoWithTimeout executes a Redis command with the specified read timeout. If
// the connection does not satisfy the ConnWithTimeout interface, then an error
// is returned.
func DoWithTimeout(c Conn, timeout time.Duration, cmd string, args ...interface{}) (interface{}, error) {
cwt, ok := c.(ConnWithTimeout)
if !ok {
return nil, errTimeoutNotSupported
}
return cwt.DoWithTimeout(timeout, cmd, args...)
}
// ReceiveWithTimeout receives a reply with the specified read timeout. If the
// connection does not satisfy the ConnWithTimeout interface, then an error is
// returned.
func ReceiveWithTimeout(c Conn, timeout time.Duration) (interface{}, error) {
cwt, ok := c.(ConnWithTimeout)
if !ok {
return nil, errTimeoutNotSupported
}
return cwt.ReceiveWithTimeout(timeout)
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2008, 2015, 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 com.sun.hotspot.igv.data;
/**
* Class representing a generic changed event.
* @author Thomas Wuerthinger
* @param <T>
*/
public class ChangedEvent<T> extends Event<ChangedListener<T>> {
private T object;
/**
* Creates a new event with the specific object as the one for which the event gets fired.
*/
public ChangedEvent(T object) {
this.object = object;
}
@Override
protected void fire(ChangedListener<T> l) {
l.changed(object);
}
}
| {
"pile_set_name": "Github"
} |
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* This class will save one edited xml file
*
* This class will save the in-session xml structure to its
* corresponding xml file, optionally reloading it if editing
* is going to continue (unload=false). Else (default) the
* file is unloaded once saved.
*
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class save_xml_file extends XMLDBAction {
/**
* Init method, every subclass will have its own
*/
function init() {
parent::init();
// Set own custom attributes
// Get needed strings
$this->loadStrings(array(
'filenotwriteable' => 'tool_xmldb'
));
}
/**
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
*/
function invoke() {
parent::invoke();
$result = true;
// Set own core attributes
$this->does_generate = ACTION_NONE;
// These are always here
global $CFG, $XMLDB;
// Do the job, setting result as needed
// Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . $dirpath;
$unload = optional_param('unload', true, PARAM_BOOL);
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$editeddir = $XMLDB->editeddirs[$dirpath];
}
}
// Copy the edited dir over the original one
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$XMLDB->dbdirs[$dirpath] = unserialize(serialize($editeddir));
$dbdir = $XMLDB->dbdirs[$dirpath];
}
}
// Check for perms
if (!is_writeable($dirpath . '/install.xml')) {
$this->errormsg = $this->str['filenotwriteable'] . '(' . $dirpath . '/install.xml)';
return false;
}
// Save the original dir
$result = $dbdir->xml_file->saveXMLFile();
if ($result) {
// Delete the edited dir
unset ($XMLDB->editeddirs[$dirpath]);
// Unload de originaldir
unset($XMLDB->dbdirs[$dirpath]->xml_file);
unset($XMLDB->dbdirs[$dirpath]->xml_loaded);
unset($XMLDB->dbdirs[$dirpath]->xml_changed);
unset($XMLDB->dbdirs[$dirpath]->xml_exists);
unset($XMLDB->dbdirs[$dirpath]->xml_writeable);
} else {
$this->errormsg = 'Error saving XML file (' . $dirpath . ')';
return false;
}
// If unload has been disabled, simulate it by reloading the file now
if (!$unload) {
return $this->launch('load_xml_file');
}
// Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
// Return ok if arrived here
return $result;
}
}
| {
"pile_set_name": "Github"
} |
//
// ResponsiveLabelTests.m
// ResponsiveLabelTests
//
// Created by hsusmita on 13/03/15.
// Copyright (c) 2015 hsusmita.com. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
@interface ResponsiveLabelTests : XCTestCase
@end
@implementation ResponsiveLabelTests
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample {
// This is an example of a functional test case.
XCTAssert(YES, @"Pass");
}
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
@end
| {
"pile_set_name": "Github"
} |
/*
* Copyright © 2018 Cask Data, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import BtnWithLoading from 'components/BtnWithLoading';
import T from 'i18n-react';
const PREFIX = 'features.PipelineConfigurations.ActionButtons';
const mapStateToProps = (state, ownProps) => {
return {
saveLoading: ownProps.saveLoading,
saveConfig: ownProps.saveConfig,
};
};
const ConfigModelessSaveBtn = ({ saveLoading, saveConfig }) => {
return (
<BtnWithLoading
loading={saveLoading}
className="btn btn-primary"
onClick={saveConfig}
label={T.translate(`${PREFIX}.save`)}
disabled={saveLoading}
/>
);
};
ConfigModelessSaveBtn.propTypes = {
saveLoading: PropTypes.bool,
saveConfig: PropTypes.func,
};
const ConnectedConfigModelessSaveBtn = connect(mapStateToProps)(ConfigModelessSaveBtn);
export default ConnectedConfigModelessSaveBtn;
| {
"pile_set_name": "Github"
} |
/**
* @file
*
* IPv6 fragmentation and reassembly.
*/
/*
* Copyright (c) 2010 Inico Technologies Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Ivan Delamer <[email protected]>
*
*
* Please coordinate changes and requests with Ivan Delamer
* <[email protected]>
*/
#ifndef __LWIP_IP6_FRAG_H__
#define __LWIP_IP6_FRAG_H__
#include "lwip/opt.h"
#include "lwip/pbuf.h"
#include "lwip/ip6_addr.h"
#include "lwip/netif.h"
#ifdef __cplusplus
extern "C" {
#endif
#if LWIP_IPV6 && LWIP_IPV6_REASS /* don't build if not configured for use in lwipopts.h */
/* The IPv6 reassembly timer interval in milliseconds. */
#define IP6_REASS_TMR_INTERVAL 1000
/* IPv6 reassembly helper struct.
* This is exported because memp needs to know the size.
*/
struct ip6_reassdata {
struct ip6_reassdata *next;
struct pbuf *p;
struct ip6_hdr * iphdr;
u32_t identification;
u16_t datagram_len;
u8_t nexth;
u8_t timer;
};
#define ip6_reass_init() /* Compatibility define */
void ip6_reass_tmr(void);
struct pbuf * ip6_reass(struct pbuf *p);
#endif /* LWIP_IPV6 && LWIP_IPV6_REASS */
#if LWIP_IPV6 && LWIP_IPV6_FRAG /* don't build if not configured for use in lwipopts.h */
/** A custom pbuf that holds a reference to another pbuf, which is freed
* when this custom pbuf is freed. This is used to create a custom PBUF_REF
* that points into the original pbuf. */
#ifndef __LWIP_PBUF_CUSTOM_REF__
#define __LWIP_PBUF_CUSTOM_REF__
struct pbuf_custom_ref {
/** 'base class' */
struct pbuf_custom pc;
/** pointer to the original pbuf that is referenced */
struct pbuf *original;
};
#endif /* __LWIP_PBUF_CUSTOM_REF__ */
err_t ip6_frag(struct pbuf *p, struct netif *netif, ip6_addr_t *dest);
#endif /* LWIP_IPV6 && LWIP_IPV6_FRAG */
#ifdef __cplusplus
}
#endif
#endif /* __LWIP_IP6_FRAG_H__ */
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "PBCodable.h"
#import "NSCopying.h"
@class NSMutableArray;
@interface GEOSearchAttributionManifest : PBCodable <NSCopying>
{
NSMutableArray *_searchAttributionSources;
}
@property(retain, nonatomic) NSMutableArray *searchAttributionSources; // @synthesize searchAttributionSources=_searchAttributionSources;
- (unsigned long long)hash;
- (BOOL)isEqual:(id)arg1;
- (id)copyWithZone:(struct _NSZone *)arg1;
- (void)copyTo:(id)arg1;
- (void)writeTo:(id)arg1;
- (BOOL)readFrom:(id)arg1;
- (id)dictionaryRepresentation;
- (id)description;
- (id)searchAttributionSourcesAtIndex:(unsigned long long)arg1;
- (unsigned long long)searchAttributionSourcesCount;
- (void)addSearchAttributionSources:(id)arg1;
- (void)clearSearchAttributionSources;
- (void)dealloc;
@end
| {
"pile_set_name": "Github"
} |
<Type Name="CodeAttributeDeclarationCollection" FullName="System.CodeDom.CodeAttributeDeclarationCollection">
<TypeSignature Language="C#" Value="public class CodeAttributeDeclarationCollection : System.Collections.CollectionBase" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CodeAttributeDeclarationCollection extends System.Collections.CollectionBase" FrameworkAlternate="dotnet-plat-ext-2.1;dotnet-plat-ext-2.2;dotnet-plat-ext-3.0;dotnet-plat-ext-3.1;dotnet-plat-ext-5.0;net-5.0;netcore-3.0;netcore-3.1" />
<TypeSignature Language="DocId" Value="T:System.CodeDom.CodeAttributeDeclarationCollection" />
<TypeSignature Language="VB.NET" Value="Public Class CodeAttributeDeclarationCollection
Inherits CollectionBase" />
<TypeSignature Language="C++ CLI" Value="public ref class CodeAttributeDeclarationCollection : System::Collections::CollectionBase" />
<TypeSignature Language="F#" Value="type CodeAttributeDeclarationCollection = class
 inherit CollectionBase" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit CodeAttributeDeclarationCollection extends System.Collections.CollectionBase" FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinmac-3.0" />
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Collections.CollectionBase</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinmac-3.0">
<AttributeName Language="C#">[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinmac-3.0">
<AttributeName Language="C#">[System.Runtime.InteropServices.ComVisible(true)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.InteropServices.ComVisible(true)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinmac-3.0">
<AttributeName Language="C#">[System.Serializable]</AttributeName>
<AttributeName Language="F#">[<System.Serializable>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Represents a collection of <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> objects.</summary>
<remarks>
<format type="text/markdown"><]
[!code-csharp[CodeAttributeDeclarationCollectionExample#1](~/samples/snippets/csharp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CS/class1.cs#1)]
[!code-vb[CodeAttributeDeclarationCollectionExample#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/VB/class1.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.CodeDom.CodeAttributeDeclaration" />
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.CodeDom.CodeAttributeDeclarationCollection" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CodeAttributeDeclarationCollection ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.CodeDom.CodeAttributeDeclarationCollection.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 CodeAttributeDeclarationCollection();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.CodeDom.CodeAttributeDeclarationCollection" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CodeAttributeDeclarationCollection (System.CodeDom.CodeAttributeDeclaration[] value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.CodeDom.CodeAttributeDeclaration[] value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.CodeDom.CodeAttributeDeclarationCollection.#ctor(System.CodeDom.CodeAttributeDeclaration[])" />
<MemberSignature Language="VB.NET" Value="Public Sub New (value As CodeAttributeDeclaration())" />
<MemberSignature Language="C++ CLI" Value="public:
 CodeAttributeDeclarationCollection(cli::array <System::CodeDom::CodeAttributeDeclaration ^> ^ value);" />
<MemberSignature Language="F#" Value="new System.CodeDom.CodeAttributeDeclarationCollection : System.CodeDom.CodeAttributeDeclaration[] -> System.CodeDom.CodeAttributeDeclarationCollection" Usage="new System.CodeDom.CodeAttributeDeclarationCollection value" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="value" Type="System.CodeDom.CodeAttributeDeclaration[]" />
</Parameters>
<Docs>
<param name="value">An array of <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> objects with which to initialize the collection.</param>
<summary>Initializes a new instance of the <see cref="T:System.CodeDom.CodeAttributeDeclarationCollection" /> class containing the specified array of <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> objects.</summary>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">One or more objects in the array are <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public CodeAttributeDeclarationCollection (System.CodeDom.CodeAttributeDeclarationCollection value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.CodeDom.CodeAttributeDeclarationCollection value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.CodeDom.CodeAttributeDeclarationCollection.#ctor(System.CodeDom.CodeAttributeDeclarationCollection)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (value As CodeAttributeDeclarationCollection)" />
<MemberSignature Language="C++ CLI" Value="public:
 CodeAttributeDeclarationCollection(System::CodeDom::CodeAttributeDeclarationCollection ^ value);" />
<MemberSignature Language="F#" Value="new System.CodeDom.CodeAttributeDeclarationCollection : System.CodeDom.CodeAttributeDeclarationCollection -> System.CodeDom.CodeAttributeDeclarationCollection" Usage="new System.CodeDom.CodeAttributeDeclarationCollection value" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="value" Type="System.CodeDom.CodeAttributeDeclarationCollection" />
</Parameters>
<Docs>
<param name="value">A <see cref="T:System.CodeDom.CodeAttributeDeclarationCollection" /> with which to initialize the collection.</param>
<summary>Initializes a new instance of the <see cref="T:System.CodeDom.CodeAttributeDeclarationCollection" /> class containing the elements of the specified source collection.</summary>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="value" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="Add">
<MemberSignature Language="C#" Value="public int Add (System.CodeDom.CodeAttributeDeclaration value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance int32 Add(class System.CodeDom.CodeAttributeDeclaration value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.CodeDom.CodeAttributeDeclarationCollection.Add(System.CodeDom.CodeAttributeDeclaration)" />
<MemberSignature Language="VB.NET" Value="Public Function Add (value As CodeAttributeDeclaration) As Integer" />
<MemberSignature Language="C++ CLI" Value="public:
 int Add(System::CodeDom::CodeAttributeDeclaration ^ value);" />
<MemberSignature Language="F#" Value="member this.Add : System.CodeDom.CodeAttributeDeclaration -> int" Usage="codeAttributeDeclarationCollection.Add value" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.CodeDom.CodeAttributeDeclaration" />
</Parameters>
<Docs>
<param name="value">The <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> object to add.</param>
<summary>Adds a <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> object with the specified value to the collection.</summary>
<returns>The index at which the new element was inserted.</returns>
<remarks>
<format type="text/markdown"><]
[!code-csharp[CodeAttributeDeclarationCollectionExample#3](~/samples/snippets/csharp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CS/class1.cs#3)]
[!code-vb[CodeAttributeDeclarationCollectionExample#3](~/samples/snippets/visualbasic/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/VB/class1.vb#3)]
]]></format>
</remarks>
<altmember cref="M:System.CodeDom.CodeAttributeDeclarationCollection.AddRange(System.CodeDom.CodeAttributeDeclaration[])" />
</Docs>
</Member>
<MemberGroup MemberName="AddRange">
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Copies the elements of the specified <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> array to the end of the collection.</summary>
</Docs>
</MemberGroup>
<Member MemberName="AddRange">
<MemberSignature Language="C#" Value="public void AddRange (System.CodeDom.CodeAttributeDeclaration[] value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddRange(class System.CodeDom.CodeAttributeDeclaration[] value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.CodeDom.CodeAttributeDeclarationCollection.AddRange(System.CodeDom.CodeAttributeDeclaration[])" />
<MemberSignature Language="VB.NET" Value="Public Sub AddRange (value As CodeAttributeDeclaration())" />
<MemberSignature Language="C++ CLI" Value="public:
 void AddRange(cli::array <System::CodeDom::CodeAttributeDeclaration ^> ^ value);" />
<MemberSignature Language="F#" Value="member this.AddRange : System.CodeDom.CodeAttributeDeclaration[] -> unit" Usage="codeAttributeDeclarationCollection.AddRange value" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.CodeDom.CodeAttributeDeclaration[]" />
</Parameters>
<Docs>
<param name="value">An array of type <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> that contains the objects to add to the collection.</param>
<summary>Copies the elements of the specified <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> array to the end of the collection.</summary>
<remarks>
<format type="text/markdown"><]
[!code-csharp[CodeAttributeDeclarationCollectionExample#4](~/samples/snippets/csharp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CS/class1.cs#4)]
[!code-vb[CodeAttributeDeclarationCollectionExample#4](~/samples/snippets/visualbasic/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/VB/class1.vb#4)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="value" /> is <see langword="null" />.</exception>
<altmember cref="M:System.CodeDom.CodeAttributeDeclarationCollection.Add(System.CodeDom.CodeAttributeDeclaration)" />
</Docs>
</Member>
<Member MemberName="AddRange">
<MemberSignature Language="C#" Value="public void AddRange (System.CodeDom.CodeAttributeDeclarationCollection value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddRange(class System.CodeDom.CodeAttributeDeclarationCollection value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.CodeDom.CodeAttributeDeclarationCollection.AddRange(System.CodeDom.CodeAttributeDeclarationCollection)" />
<MemberSignature Language="VB.NET" Value="Public Sub AddRange (value As CodeAttributeDeclarationCollection)" />
<MemberSignature Language="C++ CLI" Value="public:
 void AddRange(System::CodeDom::CodeAttributeDeclarationCollection ^ value);" />
<MemberSignature Language="F#" Value="member this.AddRange : System.CodeDom.CodeAttributeDeclarationCollection -> unit" Usage="codeAttributeDeclarationCollection.AddRange value" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.CodeDom.CodeAttributeDeclarationCollection" />
</Parameters>
<Docs>
<param name="value">A <see cref="T:System.CodeDom.CodeAttributeDeclarationCollection" /> that contains the objects to add to the collection.</param>
<summary>Copies the contents of another <see cref="T:System.CodeDom.CodeAttributeDeclarationCollection" /> object to the end of the collection.</summary>
<remarks>
<format type="text/markdown"><]
[!code-csharp[CodeAttributeDeclarationCollectionExample#4](~/samples/snippets/csharp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CS/class1.cs#4)]
[!code-vb[CodeAttributeDeclarationCollectionExample#4](~/samples/snippets/visualbasic/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/VB/class1.vb#4)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="value" /> is <see langword="null" />.</exception>
<altmember cref="M:System.CodeDom.CodeAttributeDeclarationCollection.Add(System.CodeDom.CodeAttributeDeclaration)" />
</Docs>
</Member>
<Member MemberName="Contains">
<MemberSignature Language="C#" Value="public bool Contains (System.CodeDom.CodeAttributeDeclaration value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool Contains(class System.CodeDom.CodeAttributeDeclaration value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.CodeDom.CodeAttributeDeclarationCollection.Contains(System.CodeDom.CodeAttributeDeclaration)" />
<MemberSignature Language="VB.NET" Value="Public Function Contains (value As CodeAttributeDeclaration) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:
 bool Contains(System::CodeDom::CodeAttributeDeclaration ^ value);" />
<MemberSignature Language="F#" Value="member this.Contains : System.CodeDom.CodeAttributeDeclaration -> bool" Usage="codeAttributeDeclarationCollection.Contains value" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.CodeDom.CodeAttributeDeclaration" />
</Parameters>
<Docs>
<param name="value">The <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> object to locate.</param>
<summary>Gets or sets a value that indicates whether the collection contains the specified <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> object.</summary>
<returns>
<see langword="true" /> if the collection contains the specified object; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><]
[!code-csharp[CodeAttributeDeclarationCollectionExample#5](~/samples/snippets/csharp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CS/class1.cs#5)]
[!code-vb[CodeAttributeDeclarationCollectionExample#5](~/samples/snippets/visualbasic/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/VB/class1.vb#5)]
]]></format>
</remarks>
<altmember cref="M:System.CodeDom.CodeAttributeDeclarationCollection.IndexOf(System.CodeDom.CodeAttributeDeclaration)" />
</Docs>
</Member>
<Member MemberName="CopyTo">
<MemberSignature Language="C#" Value="public void CopyTo (System.CodeDom.CodeAttributeDeclaration[] array, int index);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void CopyTo(class System.CodeDom.CodeAttributeDeclaration[] array, int32 index) cil managed" />
<MemberSignature Language="DocId" Value="M:System.CodeDom.CodeAttributeDeclarationCollection.CopyTo(System.CodeDom.CodeAttributeDeclaration[],System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Sub CopyTo (array As CodeAttributeDeclaration(), index As Integer)" />
<MemberSignature Language="C++ CLI" Value="public:
 void CopyTo(cli::array <System::CodeDom::CodeAttributeDeclaration ^> ^ array, int index);" />
<MemberSignature Language="F#" Value="member this.CopyTo : System.CodeDom.CodeAttributeDeclaration[] * int -> unit" Usage="codeAttributeDeclarationCollection.CopyTo (array, index)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="array" Type="System.CodeDom.CodeAttributeDeclaration[]" />
<Parameter Name="index" Type="System.Int32" />
</Parameters>
<Docs>
<param name="array">The one-dimensional <see cref="T:System.Array" /> that is the destination of the values copied from the collection.</param>
<param name="index">The index of the array at which to begin inserting.</param>
<summary>Copies the collection objects to a one-dimensional <see cref="T:System.Array" /> instance beginning at the specified index.</summary>
<remarks>
<format type="text/markdown"><]
[!code-csharp[CodeAttributeDeclarationCollectionExample#6](~/samples/snippets/csharp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CS/class1.cs#6)]
[!code-vb[CodeAttributeDeclarationCollectionExample#6](~/samples/snippets/visualbasic/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/VB/class1.vb#6)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The destination array is multidimensional.
-or-
The number of elements in the <see cref="T:System.CodeDom.CodeAttributeDeclarationCollection" /> is greater than the available space between the index of the target array specified by the <paramref name="index" /> parameter and the end of the target array.</exception>
<exception cref="T:System.ArgumentNullException">The <paramref name="array" /> parameter is <see langword="null" />.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="index" /> parameter is less than the target array's minimum index.</exception>
<altmember cref="T:System.Array" />
</Docs>
</Member>
<Member MemberName="IndexOf">
<MemberSignature Language="C#" Value="public int IndexOf (System.CodeDom.CodeAttributeDeclaration value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance int32 IndexOf(class System.CodeDom.CodeAttributeDeclaration value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.CodeDom.CodeAttributeDeclarationCollection.IndexOf(System.CodeDom.CodeAttributeDeclaration)" />
<MemberSignature Language="VB.NET" Value="Public Function IndexOf (value As CodeAttributeDeclaration) As Integer" />
<MemberSignature Language="C++ CLI" Value="public:
 int IndexOf(System::CodeDom::CodeAttributeDeclaration ^ value);" />
<MemberSignature Language="F#" Value="member this.IndexOf : System.CodeDom.CodeAttributeDeclaration -> int" Usage="codeAttributeDeclarationCollection.IndexOf value" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.CodeDom.CodeAttributeDeclaration" />
</Parameters>
<Docs>
<param name="value">The <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> object to locate in the collection.</param>
<summary>Gets the index of the specified <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> object in the collection, if it exists in the collection.</summary>
<returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
<remarks>
<format type="text/markdown"><]
[!code-csharp[CodeAttributeDeclarationCollectionExample#5](~/samples/snippets/csharp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CS/class1.cs#5)]
[!code-vb[CodeAttributeDeclarationCollectionExample#5](~/samples/snippets/visualbasic/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/VB/class1.vb#5)]
]]></format>
</remarks>
<altmember cref="M:System.CodeDom.CodeAttributeDeclarationCollection.Contains(System.CodeDom.CodeAttributeDeclaration)" />
</Docs>
</Member>
<Member MemberName="Insert">
<MemberSignature Language="C#" Value="public void Insert (int index, System.CodeDom.CodeAttributeDeclaration value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Insert(int32 index, class System.CodeDom.CodeAttributeDeclaration value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.CodeDom.CodeAttributeDeclarationCollection.Insert(System.Int32,System.CodeDom.CodeAttributeDeclaration)" />
<MemberSignature Language="VB.NET" Value="Public Sub Insert (index As Integer, value As CodeAttributeDeclaration)" />
<MemberSignature Language="C++ CLI" Value="public:
 void Insert(int index, System::CodeDom::CodeAttributeDeclaration ^ value);" />
<MemberSignature Language="F#" Value="member this.Insert : int * System.CodeDom.CodeAttributeDeclaration -> unit" Usage="codeAttributeDeclarationCollection.Insert (index, value)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="value" Type="System.CodeDom.CodeAttributeDeclaration" />
</Parameters>
<Docs>
<param name="index">The zero-based index where the specified object should be inserted.</param>
<param name="value">The <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> object to insert.</param>
<summary>Inserts the specified <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> object into the collection at the specified index.</summary>
<remarks>
<format type="text/markdown"><]
[!code-csharp[CodeAttributeDeclarationCollectionExample#8](~/samples/snippets/csharp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CS/class1.cs#8)]
[!code-vb[CodeAttributeDeclarationCollectionExample#8](~/samples/snippets/visualbasic/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/VB/class1.vb#8)]
]]></format>
</remarks>
<altmember cref="M:System.CodeDom.CodeAttributeDeclarationCollection.Add(System.CodeDom.CodeAttributeDeclaration)" />
</Docs>
</Member>
<Member MemberName="Item">
<MemberSignature Language="C#" Value="public System.CodeDom.CodeAttributeDeclaration this[int index] { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.CodeDom.CodeAttributeDeclaration Item(int32)" />
<MemberSignature Language="DocId" Value="P:System.CodeDom.CodeAttributeDeclarationCollection.Item(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Default Public Property Item(index As Integer) As CodeAttributeDeclaration" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::CodeDom::CodeAttributeDeclaration ^ default[int] { System::CodeDom::CodeAttributeDeclaration ^ get(int index); void set(int index, System::CodeDom::CodeAttributeDeclaration ^ value); };" />
<MemberSignature Language="F#" Value="member this.Item(int) : System.CodeDom.CodeAttributeDeclaration with get, set" Usage="System.CodeDom.CodeAttributeDeclarationCollection.Item" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.CodeDom.CodeAttributeDeclaration</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
</Parameters>
<Docs>
<param name="index">The index of the collection to access.</param>
<summary>Gets or sets the <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> object at the specified index.</summary>
<value>A <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> at each valid index.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property is an indexer that can be used to access the collection.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="index" /> parameter is outside the valid range of indexes for the collection.</exception>
<altmember cref="T:System.CodeDom.CodeAttributeDeclaration" />
</Docs>
</Member>
<Member MemberName="Remove">
<MemberSignature Language="C#" Value="public void Remove (System.CodeDom.CodeAttributeDeclaration value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Remove(class System.CodeDom.CodeAttributeDeclaration value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.CodeDom.CodeAttributeDeclarationCollection.Remove(System.CodeDom.CodeAttributeDeclaration)" />
<MemberSignature Language="VB.NET" Value="Public Sub Remove (value As CodeAttributeDeclaration)" />
<MemberSignature Language="C++ CLI" Value="public:
 void Remove(System::CodeDom::CodeAttributeDeclaration ^ value);" />
<MemberSignature Language="F#" Value="member this.Remove : System.CodeDom.CodeAttributeDeclaration -> unit" Usage="codeAttributeDeclarationCollection.Remove value" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.CodeDom</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.0.2.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.CodeDom.CodeAttributeDeclaration" />
</Parameters>
<Docs>
<param name="value">The <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> object to remove from the collection.</param>
<summary>Removes the specified <see cref="T:System.CodeDom.CodeAttributeDeclaration" /> object from the collection.</summary>
<remarks>
<format type="text/markdown"><]
[!code-csharp[CodeAttributeDeclarationCollectionExample#9](~/samples/snippets/csharp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CS/class1.cs#9)]
[!code-vb[CodeAttributeDeclarationCollectionExample#9](~/samples/snippets/visualbasic/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/VB/class1.vb#9)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The specified object is not found in the collection.</exception>
</Docs>
</Member>
</Members>
</Type>
| {
"pile_set_name": "Github"
} |
#include <catch2/catch.hpp>
#include <rapidcheck/catch.h>
#include <algorithm>
#include "rapidcheck/detail/TestListenerAdapter.h"
#include "detail/Testing.h"
#include "util/Generators.h"
#include "util/GenUtils.h"
#include "util/ShrinkableUtils.h"
#include "util/MockTestListener.h"
using namespace rc;
using namespace rc::test;
using namespace rc::detail;
namespace {
TestListenerAdapter dummyListener;
} // namespace
template <typename Testable>
SearchResult searchTestable(Testable &&testable,
const TestParams ¶ms,
TestListener &listener = dummyListener) {
return searchProperty(
toProperty(std::forward<Testable>(testable)), params, listener);
}
template <typename Testable>
TestResult testTestable(Testable &&testable,
const TestParams ¶ms,
TestListener &listener = dummyListener) {
return testProperty(toProperty(std::forward<Testable>(testable)),
TestMetadata(),
params,
dummyListener);
}
TEST_CASE("searchProperty") {
prop("reports correct number of successes and discards",
[](const TestParams ¶ms, int limit) {
int successes = 0;
int discards = 0;
const auto result = searchTestable([&] {
const auto x = *gen::arbitrary<int>();
if ((x % 3) == 0) {
discards++;
RC_DISCARD("");
}
RC_ASSERT(x < limit);
successes++;
}, params);
RC_ASSERT(result.numSuccess == successes);
RC_ASSERT(result.numDiscarded == discards);
});
prop("runs all test cases if no cases fail",
[](const TestParams ¶ms) {
auto numCases = 0;
const auto result = searchTestable([&] { numCases++; }, params);
RC_ASSERT(numCases == params.maxSuccess);
RC_ASSERT(result.type == SearchResult::Type::Success);
RC_ASSERT(result.numSuccess == params.maxSuccess);
RC_ASSERT(!result.failure);
});
prop("returns correct information about failing case",
[](const TestParams ¶ms, const std::string &description) {
RC_PRE(params.maxSuccess > 0);
int size = 0;
int caseIndex = 0;
const auto targetSuccess = *gen::inRange<int>(0, params.maxSuccess);
const auto result = searchTestable([&] {
size = *genSize();
if (caseIndex >= targetSuccess) {
return CaseResult(CaseResult::Type::Failure, description);
}
caseIndex++;
return CaseResult(CaseResult::Type::Success);
}, params);
RC_ASSERT(result.type == SearchResult::Type::Failure);
RC_ASSERT(result.failure);
RC_ASSERT(result.failure->size == size);
RC_ASSERT(result.failure->shrinkable.value().result.description ==
description);
});
prop("gives up if too many test cases are discarded",
[](const TestParams ¶ms, const std::string &description) {
RC_PRE(params.maxSuccess > 0);
const auto targetSuccess = *gen::inRange<int>(0, params.maxSuccess);
int size = 0;
int numTests = 0;
const auto result = searchTestable([&] {
numTests++;
size = *genSize();
if (numTests > targetSuccess) {
return CaseResult(CaseResult::Type::Discard, description);
}
return CaseResult(CaseResult::Type::Success);
}, params);
RC_ASSERT(result.type == SearchResult::Type::GaveUp);
RC_ASSERT(result.failure);
RC_ASSERT(result.failure->size == size);
RC_ASSERT(result.failure->shrinkable.value().result.description ==
description);
});
prop("does not give up if not enough tests are discarded",
[](const TestParams ¶ms) {
const auto maxDiscards = params.maxSuccess * params.maxDiscardRatio;
const auto targetDiscard = *gen::inRange<int>(0, maxDiscards + 1);
int numTests = 0;
const auto result = searchTestable([&] {
numTests++;
RC_PRE(numTests > targetDiscard);
}, params);
RC_ASSERT(result.type == SearchResult::Type::Success);
RC_ASSERT(result.numSuccess == params.maxSuccess);
});
prop("if maxSuccess > 1, the max size used is maxSize",
[](const TestParams ¶ms) {
RC_PRE(params.maxSuccess > 1);
int usedMax = 0;
const auto property = [&] { usedMax = std::max(*genSize(), usedMax); };
searchTestable(property, params);
RC_ASSERT(usedMax == params.maxSize);
});
prop("if maxSuccess > maxSize, all sizes will be used",
[] {
TestParams params;
params.maxSize = *gen::inRange(0, 100);
params.maxSuccess = *gen::inRange(params.maxSuccess + 1, 200);
std::vector<int> frequencies(params.maxSize + 1, 0);
const auto property = [&] { frequencies[*genSize()]++; };
searchTestable(property, params);
RC_ASSERT(std::count(begin(frequencies), end(frequencies), 0) == 0);
});
prop("should increase size eventually if enough tests are discarded",
[](TestParams params) {
params.maxDiscardRatio = 100;
const auto result =
searchTestable([] { RC_PRE(*genSize() != 0); }, params);
RC_ASSERT(result.type == SearchResult::Type::Success);
});
prop("does not include empty tags in tags",
[](const TestParams ¶ms) {
const auto result = searchTestable([] {}, params);
RC_ASSERT(result.tags.empty());
});
prop("does not include tags for discarded tests in tags",
[](const TestParams ¶ms) {
const auto result = searchTestable([] {
RC_TAG(0);
RC_DISCARD("");
}, params);
RC_ASSERT(result.tags.empty());
});
prop("does not include tags for failed tests in tags",
[](const TestParams ¶ms) {
const auto result = searchTestable([] {
RC_TAG(0);
RC_FAIL("");
}, params);
RC_ASSERT(result.tags.empty());
});
prop("does not include empty tags in tags",
[](const TestParams ¶ms) {
const auto expected = *gen::container<std::vector<Tags>>(
params.maxSuccess, gen::nonEmpty<Tags>());
std::size_t i = 0;
const auto result = searchTestable([&] {
for (const auto &tag : expected[i++]) {
ImplicitParam<param::CurrentPropertyContext>::value()->addTag(tag);
}
}, params);
RC_ASSERT(result.tags == expected);
});
prop("does not include tags applied from generators",
[](const TestParams ¶ms) {
const auto result = searchTestable([&] {
*Gen<int>([](const Random &, int) {
ImplicitParam<param::CurrentPropertyContext>::value()->addTag(
"foobar");
return shrinkable::just(1337);
});
}, params);
RC_ASSERT(result.tags.empty());
});
prop("calls onTestCaseFinished for each successful test",
[](const TestParams ¶ms, int limit) {
std::vector<CaseDescription> descriptions;
MockTestListener listener;
listener.onTestCaseFinishedCallback =
[&](const CaseDescription &desc) { descriptions.push_back(desc); };
std::vector<CaseDescription> expected;
const auto result = searchTestable([&] {
CaseDescription desc;
const auto x = *gen::arbitrary<int>();
if ((x % 3) == 0) {
desc.result.type = CaseResult::Type::Discard;
} else if (x < limit) {
desc.result.type = CaseResult::Type::Failure;
} else {
desc.result.type = CaseResult::Type::Success;
}
const auto strx = std::to_string(x);
desc.result.description = strx;
desc.tags.push_back(strx);
desc.example = [=] { return Example{{"int", strx}}; };
ImplicitParam<param::CurrentPropertyContext>::value()->addTag(strx);
expected.push_back(desc);
return desc.result;
}, params, listener);
RC_ASSERT(descriptions == expected);
});
prop("the failure information reproduces identical shrinkables",
[](TestParams params) {
const auto max = *gen::inRange<int>(0, 2000);
const auto property = toProperty([=](int a, int b) {
if ((a > max) || (b > max)) {
throw std::to_string(a) + " " + std::to_string(b);
}
});
params.maxSuccess = 2000;
params.maxSize = kNominalSize;
const auto result = searchProperty(property, params, dummyListener);
RC_ASSERT(result.failure);
const auto shrinkable =
property(result.failure->random, result.failure->size);
RC_ASSERT(result.failure->shrinkable.value() == shrinkable.value());
});
}
namespace {
Shrinkable<CaseDescription> countdownEven(int start) {
return shrinkable::map(countdownShrinkable(start),
[=](int x) {
CaseDescription desc;
desc.result.type = ((x % 2) == 0)
? CaseResult::Type::Failure
: CaseResult::Type::Success;
desc.result.description = std::to_string(x);
return desc;
});
}
}
TEST_CASE("shrinkTestCase") {
prop("returns the minimum shrinkable",
[] {
const auto target = *gen::positive<int>();
const auto shrinkable =
shrinkable::map(shrinkable::shrinkRecur(
std::numeric_limits<int>::max(),
[](int x) { return shrink::towards(x, 0); }),
[=](int x) {
CaseDescription desc;
desc.result.type = (x >= target)
? CaseResult::Type::Failure
: CaseResult::Type::Success;
desc.result.description = std::to_string(x);
return desc;
});
const auto result = shrinkTestCase(shrinkable, dummyListener);
RC_ASSERT(result.first.value().result.type ==
CaseResult::Type::Failure);
RC_ASSERT(result.first.value().result.description ==
std::to_string(target));
});
prop("the path length is the number of successful shrinks",
[] {
const auto start = *gen::suchThat(gen::inRange<int>(0, 100),
[](int x) { return (x % 2) == 0; });
const auto shrinkable = countdownEven(start);
const auto result = shrinkTestCase(shrinkable, dummyListener);
RC_ASSERT(result.second.size() == std::size_t(start / 2));
});
prop("walking the path gives the same result",
[] {
const auto start = *gen::suchThat(gen::inRange<int>(0, 100),
[](int x) { return (x % 2) == 0; });
const auto shrinkable = countdownEven(start);
const auto shrinkResult = shrinkTestCase(shrinkable, dummyListener);
const auto walkResult =
shrinkable::walkPath(shrinkable, shrinkResult.second);
RC_ASSERT(walkResult);
RC_ASSERT(shrinkResult.first.value() == walkResult->value());
});
prop("calls onShrinkTried for each shrink tried",
[] {
const auto start = *gen::suchThat(gen::inRange<int>(0, 100),
[](int x) { return (x % 2) == 0; });
const auto shrinkable = countdownEven(start);
MockTestListener listener;
int acceptedBalance = 0;
listener.onShrinkTriedCallback =
[&](const CaseDescription &desc, bool accepted) {
const auto x = std::stoi(desc.result.description);
RC_ASSERT(((x % 2) == 0) == accepted);
acceptedBalance += accepted ? 1 : -1;
};
const auto result = shrinkTestCase(shrinkable, listener);
});
}
TEST_CASE("testProperty") {
prop("returns the correct shrink path on a failing case",
[](TestParams params) {
RC_PRE(params.maxSuccess > 0);
params.disableShrinking = false;
const auto evenInteger =
gen::scale(0.25,
gen::suchThat(gen::positive<int>(),
[](int x) { return (x % 2) == 0; }));
const auto values = *gen::pair(evenInteger, evenInteger);
const auto results = testTestable([&] {
const auto v1 = *genFixedCountdown(values.first);
const auto v2 = *genFixedCountdown(values.second);
return ((v1 % 2) != 0) || ((v2 % 2) != 0);
}, params, dummyListener);
FailureResult failure;
RC_ASSERT(results.match(failure));
const auto numShrinks = (values.first / 2) + (values.second / 2);
// Every shrink should be the second shrink, thus fill with 1
const auto expected = std::vector<std::size_t>(numShrinks, 1);
RC_ASSERT(failure.reproduce.shrinkPath == expected);
});
prop("returns a correct counter-example",
[](const TestParams ¶ms, std::vector<int> values) {
RC_PRE(params.maxSuccess > 0);
const auto results =
testTestable([&](FixedCountdown<0>, FixedCountdown<0>) {
for (auto value : values) {
*gen::just(value);
}
return false;
}, params, dummyListener);
Example expected;
expected.reserve(values.size() + 1);
std::tuple<FixedCountdown<0>, FixedCountdown<0>> expectedArgs(
FixedCountdown<0>{}, FixedCountdown<0>{});
expected.push_back(std::make_pair(
typeToString<decltype(expectedArgs)>(), toString(expectedArgs)));
std::transform(begin(values),
end(values),
std::back_inserter(expected),
[](int x) {
return std::make_pair(typeToString<int>(),
toString(x));
});
FailureResult failure;
RC_ASSERT(results.match(failure));
RC_ASSERT(failure.counterExample == expected);
});
prop("counter-example is not affected by nested tests",
[](const TestParams ¶ms1, const TestParams ¶ms2) {
RC_PRE(params1.maxSuccess > 0);
const auto results = testTestable([&] {
*gen::just<std::string>("foo");
auto innerResults = testTestable([&] {
*gen::just<std::string>("bar");
*gen::just<std::string>("baz");
}, params2, dummyListener);
return false;
}, params1, dummyListener);
FailureResult failure;
RC_ASSERT(results.match(failure));
Example expected{
{typeToString<std::string>(), toString(std::string("foo"))}};
RC_ASSERT(failure.counterExample == expected);
});
prop("on failure, description contains message",
[](const TestParams ¶ms, const std::string &description) {
RC_PRE(params.maxSuccess > 0);
const auto results = testTestable(
[&] { RC_FAIL(description); }, params, dummyListener);
FailureResult failure;
RC_ASSERT(results.match(failure));
RC_ASSERT(failure.description.find(description) != std::string::npos);
});
prop("on giving up, description contains message",
[](const TestParams ¶ms, const std::string &description) {
RC_PRE(params.maxSuccess > 0);
const auto results = testTestable(
[&] { RC_DISCARD(description); }, params, dummyListener);
GaveUpResult gaveUp;
RC_ASSERT(results.match(gaveUp));
RC_ASSERT(gaveUp.description.find(description) != std::string::npos);
});
prop("running the same test with the same TestParams yields identical runs",
[](const TestParams ¶ms) {
std::vector<std::vector<int>> values;
const auto property = [&] {
const auto x = *gen::arbitrary<std::vector<int>>();
values.push_back(x);
auto result = std::find(begin(x), end(x), 50);
return result == end(x);
};
const auto results1 = testTestable(property, params, dummyListener);
auto values1 = std::move(values);
values = std::vector<std::vector<int>>();
const auto results2 = testTestable(property, params, dummyListener);
auto values2 = std::move(values);
RC_ASSERT(results1 == results2);
RC_ASSERT(values1 == values2);
});
prop("correctly reports test case distribution",
[] {
auto allTags =
*gen::container<std::vector<std::vector<std::string>>>(
gen::scale(0.1, gen::arbitrary<std::vector<std::string>>()));
TestParams params;
params.maxSize = *gen::inRange(0, 200);
params.maxSuccess = static_cast<int>(allTags.size());
auto i = 0;
const auto property = [&] {
const auto &tags = allTags[i++];
for (const auto &tag : tags) {
ImplicitParam<param::CurrentPropertyContext>::value()->addTag(tag);
}
};
const auto result = testTestable(property, params, dummyListener);
Distribution expected;
for (auto &tags : allTags) {
if (!tags.empty()) {
expected[tags]++;
}
}
SuccessResult success;
RC_ASSERT(result.match(success));
RC_ASSERT(success.distribution == expected);
});
prop("does not include untagged cases in distribution",
[](const TestParams ¶ms) {
const auto result = testTestable([] {}, params, dummyListener);
SuccessResult success;
RC_ASSERT(result.match(success));
RC_ASSERT(success.distribution.empty());
});
prop("does not shrink result if disableShrinking is set",
[](TestParams params) {
RC_PRE(params.maxSuccess > 0);
params.disableShrinking = true;
const auto result = testTestable([] {
*Gen<int>([](const Random &, int) {
return shrinkable::just(1337, seq::just(shrinkable::just(0)));
});
RC_FAIL("oh noes");
}, params, dummyListener);
FailureResult failure;
RC_ASSERT(result.match(failure));
RC_ASSERT(failure.counterExample.front().second == "1337");
});
}
TEST_CASE("reproduceProperty") {
prop("reproduces result from testProperty",
[](const TestMetadata &metadata, TestParams params) {
const auto max = *gen::inRange<int>(0, 2000);
const auto property = toProperty([=](int a, int b) {
if ((a > max) || (b > max)) {
throw std::to_string(a) + " " + std::to_string(b);
}
});
params.maxSuccess = 2000;
params.maxSize = kNominalSize;
const auto result =
testProperty(property, metadata, params, dummyListener);
FailureResult failure;
RC_ASSERT(result.match(failure));
const auto reproduced = reproduceProperty(property, failure.reproduce);
FailureResult reproducedFailure;
RC_ASSERT(reproduced.match(reproducedFailure));
RC_ASSERT(failure.description == reproducedFailure.description);
RC_ASSERT(failure.reproduce == reproducedFailure.reproduce);
RC_ASSERT(failure.counterExample == reproducedFailure.counterExample);
RC_ASSERT(reproducedFailure.numSuccess == 0);
});
SECTION("returns error if reproduced result is not a failure") {
const auto property = toProperty([] {});
Reproduce repro;
repro.size = 0;
const auto result = reproduceProperty(property, repro);
Error error;
REQUIRE(result.match(error));
}
SECTION("returns error if shrink path is not valid") {
const auto property = toProperty([] { return false; });
Reproduce repro;
repro.size = 0;
repro.shrinkPath.push_back(100);
const auto result = reproduceProperty(property, repro);
Error error;
REQUIRE(result.match(error));
}
}
| {
"pile_set_name": "Github"
} |
import module namespace jsd = "http://jsound.io/modules/jsound";
let $jsd :=
{
"$namespace" : "http://www.example.com/my-schema",
"$types" : [
{
"$kind" : "atomic",
"$name" : "foo",
"$baseType" : "integer",
"$maxInclusive" : 5
}
]
}
let $instance := 5
return jsd:validate( $jsd, "foo", $instance )
(: vim:set syntax=xquery et sw=2 ts=2: :)
| {
"pile_set_name": "Github"
} |
// Copyright Peter Dimov 2001
// Copyright Aleksey Gurtovoy 2001-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/aux_/basic_bind.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
namespace aux {
template< bool >
struct resolve_arg_impl
{
template<
typename T, typename U1, typename U2, typename U3
, typename U4, typename U5
>
struct result_
{
typedef T type;
};
};
template<>
struct resolve_arg_impl<true>
{
template<
typename T, typename U1, typename U2, typename U3
, typename U4, typename U5
>
struct result_
{
typedef typename apply_wrap5<
T
, U1, U2, U3, U4, U5
>::type type;
};
};
template< typename T > struct is_bind_template;
template<
typename T, typename U1, typename U2, typename U3, typename U4
, typename U5
>
struct resolve_bind_arg
: resolve_arg_impl< is_bind_template<T>::value >
::template result_< T,U1,U2,U3,U4,U5 >
{
};
template< int arity_ > struct bind_chooser;
aux::no_tag is_bind_helper(...);
template< typename T > aux::no_tag is_bind_helper(protect<T>*);
template< int N >
aux::yes_tag is_bind_helper(arg<N>*);
template< bool is_ref_ = true >
struct is_bind_template_impl
{
template< typename T > struct result_
{
BOOST_STATIC_CONSTANT(bool, value = false);
};
};
template<>
struct is_bind_template_impl<false>
{
template< typename T > struct result_
{
BOOST_STATIC_CONSTANT(bool, value =
sizeof(aux::is_bind_helper(static_cast<T*>(0)))
== sizeof(aux::yes_tag)
);
};
};
template< typename T > struct is_bind_template
: is_bind_template_impl< ::boost::detail::is_reference_impl<T>::value >
::template result_<T>
{
};
} // namespace aux
template<
typename F
>
struct bind0
{
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
private:
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
public:
typedef typename apply_wrap0<
f_
>::type type;
};
};
namespace aux {
template<
typename F
>
aux::yes_tag
is_bind_helper(bind0<F>*);
} // namespace aux
BOOST_MPL_AUX_ARITY_SPEC(1, bind0)
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(1, bind0)
template<
typename F, typename T1
>
struct bind1
{
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
private:
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
public:
typedef typename apply_wrap1<
f_
, typename t1::type
>::type type;
};
};
namespace aux {
template<
typename F, typename T1
>
aux::yes_tag
is_bind_helper(bind1< F,T1 >*);
} // namespace aux
BOOST_MPL_AUX_ARITY_SPEC(2, bind1)
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(2, bind1)
template<
typename F, typename T1, typename T2
>
struct bind2
{
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
private:
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
public:
typedef typename apply_wrap2<
f_
, typename t1::type, typename t2::type
>::type type;
};
};
namespace aux {
template<
typename F, typename T1, typename T2
>
aux::yes_tag
is_bind_helper(bind2< F,T1,T2 >*);
} // namespace aux
BOOST_MPL_AUX_ARITY_SPEC(3, bind2)
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(3, bind2)
template<
typename F, typename T1, typename T2, typename T3
>
struct bind3
{
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
private:
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
public:
typedef typename apply_wrap3<
f_
, typename t1::type, typename t2::type, typename t3::type
>::type type;
};
};
namespace aux {
template<
typename F, typename T1, typename T2, typename T3
>
aux::yes_tag
is_bind_helper(bind3< F,T1,T2,T3 >*);
} // namespace aux
BOOST_MPL_AUX_ARITY_SPEC(4, bind3)
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(4, bind3)
template<
typename F, typename T1, typename T2, typename T3, typename T4
>
struct bind4
{
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
private:
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4;
public:
typedef typename apply_wrap4<
f_
, typename t1::type, typename t2::type, typename t3::type
, typename t4::type
>::type type;
};
};
namespace aux {
template<
typename F, typename T1, typename T2, typename T3, typename T4
>
aux::yes_tag
is_bind_helper(bind4< F,T1,T2,T3,T4 >*);
} // namespace aux
BOOST_MPL_AUX_ARITY_SPEC(5, bind4)
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(5, bind4)
template<
typename F, typename T1, typename T2, typename T3, typename T4
, typename T5
>
struct bind5
{
template<
typename U1 = na, typename U2 = na, typename U3 = na
, typename U4 = na, typename U5 = na
>
struct apply
{
private:
typedef typename aux::resolve_bind_arg< F,U1,U2,U3,U4,U5 >::type f_;
typedef aux::resolve_bind_arg< T1,U1,U2,U3,U4,U5 > t1;
typedef aux::resolve_bind_arg< T2,U1,U2,U3,U4,U5 > t2;
typedef aux::resolve_bind_arg< T3,U1,U2,U3,U4,U5 > t3;
typedef aux::resolve_bind_arg< T4,U1,U2,U3,U4,U5 > t4;
typedef aux::resolve_bind_arg< T5,U1,U2,U3,U4,U5 > t5;
public:
typedef typename apply_wrap5<
f_
, typename t1::type, typename t2::type, typename t3::type
, typename t4::type, typename t5::type
>::type type;
};
};
namespace aux {
template<
typename F, typename T1, typename T2, typename T3, typename T4
, typename T5
>
aux::yes_tag
is_bind_helper(bind5< F,T1,T2,T3,T4,T5 >*);
} // namespace aux
BOOST_MPL_AUX_ARITY_SPEC(6, bind5)
BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(6, bind5)
}}
| {
"pile_set_name": "Github"
} |
define( [
"../core",
"../var/document",
"../data/var/dataPriv",
"../data/var/acceptData",
"../var/hasOwn",
"../event"
], function( jQuery, document, dataPriv, acceptData, hasOwn ) {
"use strict";
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
jQuery.extend( jQuery.event, {
trigger: function( event, data, elem, onlyHandlers ) {
var i, cur, tmp, bubbleType, ontype, handle, special,
eventPath = [ elem || document ],
type = hasOwn.call( event, "type" ) ? event.type : event,
namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf( "." ) > -1 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split( "." );
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf( ":" ) < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[ jQuery.expando ] ?
event :
new jQuery.Event( type, typeof event === "object" && event );
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join( "." );
event.rnamespace = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
null;
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data == null ?
[ event ] :
jQuery.makeArray( data, [ event ] );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode;
}
for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur );
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === ( elem.ownerDocument || document ) ) {
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
dataPriv.get( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && handle.apply && acceptData( cur ) ) {
event.result = handle.apply( cur, data );
if ( event.result === false ) {
event.preventDefault();
}
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( ( !special._default ||
special._default.apply( eventPath.pop(), data ) === false ) &&
acceptData( elem ) ) {
// Call a native DOM method on the target with the same name as the event.
// Don't do default actions on window, that's where global variables be (#6170)
if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[ type ]();
jQuery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
// Piggyback on a donor event to simulate a different one
// Used only for `focus(in | out)` events
simulate: function( type, elem, event ) {
var e = jQuery.extend(
new jQuery.Event(),
event,
{
type: type,
isSimulated: true
}
);
jQuery.event.trigger( e, null, elem );
}
} );
jQuery.fn.extend( {
trigger: function( type, data ) {
return this.each( function() {
jQuery.event.trigger( type, data, this );
} );
},
triggerHandler: function( type, data ) {
var elem = this[ 0 ];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
}
} );
return jQuery;
} );
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 8ecb03fef57c331449d5a7ac904bb842
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
[<Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute("")>]
do() | {
"pile_set_name": "Github"
} |
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v1.0.6-b27-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.06.11 at 10:33:54 AM PDT
//
package com.sun.identity.liberty.ws.common.jaxb.ac;
/**
* Provides a mechanism for linking to external (likely human readable) documents in which additional business agreements,(e.g. liability constraints, obligations, etc) can be placed.
*
* Java content class for GoverningAgreements element declaration.
* <p>The following schema fragment specifies the expected content contained within this java content object. (defined at file:/Users/allan/A-SVN/trunk/opensso/products/federation/library/xsd/liberty/lib-arch-authentication-context.xsd line 464)
* <p>
* <pre>
* <element name="GoverningAgreements" type="{urn:liberty:ac:2003-08}GoverningAgreementsType"/>
* </pre>
*
*/
public interface GoverningAgreementsElement
extends javax.xml.bind.Element, com.sun.identity.liberty.ws.common.jaxb.ac.GoverningAgreementsType
{
}
| {
"pile_set_name": "Github"
} |
const isHoloJs = typeof navigator.holojs !== 'undefined';
const canvas = document.createElement(isHoloJs ? 'canvasvr' : 'canvas');
if (isHoloJs === false) {
// If running in browser, add the canvas to the DOM
document.body.appendChild(canvas);
}
var container;
var camera, scene, renderer;
var controller1, controller2;
var room;
var count = 0;
var radius = 0.08;
var normal = new THREE.Vector3();
var relativeVelocity = new THREE.Vector3();
var clock = new THREE.Clock();
init();
initControllers();
function init() {
scene = new THREE.Scene();
scene.background = new THREE.Color(0x505050);
camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 10);
room = new THREE.LineSegments(
new THREE.BoxLineGeometry(6, 6, 6, 10, 10, 10),
new THREE.LineBasicMaterial({ color: 0x808080 })
);
room.geometry.translate(0, 3, 0);
scene.add(room);
var light = new THREE.HemisphereLight(0xffffff, 0x444444);
light.position.set(1, 1, 1);
scene.add(light);
var geometry = new THREE.IcosahedronBufferGeometry(radius, 2);
for (var i = 0; i < 200; i++) {
var object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff }));
object.position.x = Math.random() * 4 - 2;
object.position.y = Math.random() * 4;
object.position.z = Math.random() * 4 - 2;
object.userData.velocity = new THREE.Vector3();
object.userData.velocity.x = Math.random() * 0.01 - 0.005;
object.userData.velocity.y = Math.random() * 0.01 - 0.005;
object.userData.velocity.z = Math.random() * 0.01 - 0.005;
room.add(object);
}
//
renderer = new THREE.WebGLRenderer({ canvas, antialias: true });
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.vr.enabled = true;
window.addEventListener('resize', onWindowResize, false);
renderer.setAnimationLoop(render);
if (isHoloJs === false) {
// When running in a browser, add a button to ask for permission to enter VR mode
document.body.appendChild(WEBVR.createButton(renderer));
} else {
// In HoloJs the script can enter VR mode without user input
navigator.getVRDisplays().then(
function (value) {
if (value.length > 0) {
renderer.vr.enabled = true;
renderer.vr.setDevice(value[0]);
value[0].requestPresent([{ source: renderer.domElement }]);
}
});
}
}
function onSelectStart() {
this.userData.isSelecting = true;
}
function onSelectEnd() {
this.userData.isSelecting = false;
}
function initControllers() {
controller1 = renderer.vr.getController(0);
controller1.addEventListener('selectstart', onSelectStart);
controller1.addEventListener('selectend', onSelectEnd);
scene.add(controller1);
controller2 = renderer.vr.getController(1);
controller2.addEventListener('selectstart', onSelectStart);
controller2.addEventListener('selectend', onSelectEnd);
scene.add(controller2);
let geometry = new THREE.BufferGeometry();
geometry.addAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0, 0, 0, - 1], 3));
geometry.addAttribute('color', new THREE.Float32BufferAttribute([0.5, 0.5, 0.5, 0, 0, 0], 3));
let material = new THREE.LineBasicMaterial({ vertexColors: true, blending: THREE.AdditiveBlending });
controller1.add(new THREE.Line(geometry, material));
controller2.add(new THREE.Line(geometry, material));
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
}
function handleController(controller) {
if (controller.userData.isSelecting) {
var object = room.children[count++];
object.position.copy(controller.position);
object.userData.velocity.x = (Math.random() - 0.5) * 3;
object.userData.velocity.y = (Math.random() - 0.5) * 3;
object.userData.velocity.z = (Math.random() - 9);
object.userData.velocity.applyQuaternion(controller.quaternion);
if (count === room.children.length) count = 0;
}
}
function render() {
if (controller1) {
handleController(controller1);
}
if (controller2) {
handleController(controller2);
}
var delta = clock.getDelta() * 0.8; // slow down simulation
var range = 3 - radius;
for (var i = 0; i < room.children.length; i++) {
var object = room.children[i];
object.position.x += object.userData.velocity.x * delta;
object.position.y += object.userData.velocity.y * delta;
object.position.z += object.userData.velocity.z * delta;
// keep objects inside room
if (object.position.x < - range || object.position.x > range) {
object.position.x = THREE.Math.clamp(object.position.x, - range, range);
object.userData.velocity.x = - object.userData.velocity.x;
}
if (object.position.y < radius || object.position.y > 6) {
object.position.y = Math.max(object.position.y, radius);
object.userData.velocity.x *= 0.98;
object.userData.velocity.y = - object.userData.velocity.y * 0.8;
object.userData.velocity.z *= 0.98;
}
if (object.position.z < - range || object.position.z > range) {
object.position.z = THREE.Math.clamp(object.position.z, - range, range);
object.userData.velocity.z = - object.userData.velocity.z;
}
for (var j = i + 1; j < room.children.length; j++) {
var object2 = room.children[j];
normal.copy(object.position).sub(object2.position);
var distance = normal.length();
if (distance < 2 * radius) {
normal.multiplyScalar(0.5 * distance - radius);
object.position.sub(normal);
object2.position.add(normal);
normal.normalize();
relativeVelocity.copy(object.userData.velocity).sub(object2.userData.velocity);
normal = normal.multiplyScalar(relativeVelocity.dot(normal));
object.userData.velocity.sub(normal);
object2.userData.velocity.add(normal);
}
}
object.userData.velocity.y -= 9.8 * delta;
}
renderer.render(scene, camera);
} | {
"pile_set_name": "Github"
} |
import {defaults} from 'lodash'
import {checkIfInsideAStrictModeTree} from '../utils'
import getUpdateInfo from '../getUpdateInfo'
export default function patchClassComponent(ClassComponent, displayName, React, options, ownerDataMap){
class WDYRPatchedClassComponent extends ClassComponent{
constructor(props, context){
super(props, context)
this._WDYR = {
renderNumber: 0
}
const origRender = super.render || this.render
// this probably means render is an arrow function or this.render.bind(this) was called on the original class
const renderIsABindedFunction = origRender !== ClassComponent.prototype.render
if(renderIsABindedFunction){
this.render = () => {
WDYRPatchedClassComponent.prototype.render.apply(this)
return origRender()
}
}
}
render(){
this._WDYR.renderNumber++
if(!('isStrictMode' in this._WDYR)){
this._WDYR.isStrictMode = checkIfInsideAStrictModeTree(this)
}
// in strict mode- ignore every other render
if(!(this._WDYR.isStrictMode && this._WDYR.renderNumber % 2 === 1)){
if(this._WDYR.prevProps){
const updateInfo = getUpdateInfo({
Component: ClassComponent,
displayName,
prevProps: this._WDYR.prevProps,
prevState: this._WDYR.prevState,
nextProps: this.props,
nextState: this.state,
options,
ownerDataMap
})
options.notifier(updateInfo)
}
this._WDYR.prevProps = this.props
this._WDYR.prevState = this.state
}
return super.render ? super.render() : null
}
}
try{
WDYRPatchedClassComponent.displayName = displayName
}catch(e){
// not crucial if displayName couldn't be set
}
defaults(WDYRPatchedClassComponent, ClassComponent)
return WDYRPatchedClassComponent
}
| {
"pile_set_name": "Github"
} |
// Boost.Range library
//
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_DETAIL_SFINAE_HPP
#define BOOST_RANGE_DETAIL_SFINAE_HPP
#include <boost/range/config.hpp>
#include <boost/type_traits/is_array.hpp>
#include <boost/type_traits/detail/yes_no_type.hpp>
#include <utility>
namespace boost
{
namespace range_detail
{
using type_traits::yes_type;
using type_traits::no_type;
//////////////////////////////////////////////////////////////////////
// string
//////////////////////////////////////////////////////////////////////
yes_type is_string_impl( const char* const );
yes_type is_string_impl( const wchar_t* const );
no_type is_string_impl( ... );
template< std::size_t sz >
yes_type is_char_array_impl( char BOOST_RANGE_ARRAY_REF()[sz] );
template< std::size_t sz >
yes_type is_char_array_impl( const char BOOST_RANGE_ARRAY_REF()[sz] );
no_type is_char_array_impl( ... );
template< std::size_t sz >
yes_type is_wchar_t_array_impl( wchar_t BOOST_RANGE_ARRAY_REF()[sz] );
template< std::size_t sz >
yes_type is_wchar_t_array_impl( const wchar_t BOOST_RANGE_ARRAY_REF()[sz] );
no_type is_wchar_t_array_impl( ... );
yes_type is_char_ptr_impl( char* const );
no_type is_char_ptr_impl( ... );
yes_type is_const_char_ptr_impl( const char* const );
no_type is_const_char_ptr_impl( ... );
yes_type is_wchar_t_ptr_impl( wchar_t* const );
no_type is_wchar_t_ptr_impl( ... );
yes_type is_const_wchar_t_ptr_impl( const wchar_t* const );
no_type is_const_wchar_t_ptr_impl( ... );
//////////////////////////////////////////////////////////////////////
// pair
//////////////////////////////////////////////////////////////////////
template< typename Iterator >
yes_type is_pair_impl( const std::pair<Iterator,Iterator>* );
no_type is_pair_impl( ... );
//////////////////////////////////////////////////////////////////////
// tags
//////////////////////////////////////////////////////////////////////
struct char_or_wchar_t_array_tag {};
} // namespace 'range_detail'
} // namespace 'boost'
#endif
| {
"pile_set_name": "Github"
} |
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
LastClass=CNamedPipeCltView
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "NamedPipeClt.h"
LastPage=0
ClassCount=5
Class1=CNamedPipeCltApp
Class2=CNamedPipeCltDoc
Class3=CNamedPipeCltView
Class4=CMainFrame
ResourceCount=2
Resource1=IDR_MAINFRAME
Class5=CAboutDlg
Resource2=IDD_ABOUTBOX
[CLS:CNamedPipeCltApp]
Type=0
HeaderFile=NamedPipeClt.h
ImplementationFile=NamedPipeClt.cpp
Filter=N
[CLS:CNamedPipeCltDoc]
Type=0
HeaderFile=NamedPipeCltDoc.h
ImplementationFile=NamedPipeCltDoc.cpp
Filter=N
[CLS:CNamedPipeCltView]
Type=0
HeaderFile=NamedPipeCltView.h
ImplementationFile=NamedPipeCltView.cpp
Filter=C
BaseClass=CView
VirtualFilter=VWC
LastObject=IDM_PIPE_WRITE
[CLS:CMainFrame]
Type=0
HeaderFile=MainFrm.h
ImplementationFile=MainFrm.cpp
Filter=T
LastObject=IDM_PIPE_READ
[CLS:CAboutDlg]
Type=0
HeaderFile=NamedPipeClt.cpp
ImplementationFile=NamedPipeClt.cpp
Filter=D
[DLG:IDD_ABOUTBOX]
Type=1
Class=CAboutDlg
ControlCount=4
Control1=IDC_STATIC,static,1342177283
Control2=IDC_STATIC,static,1342308480
Control3=IDC_STATIC,static,1342308352
Control4=IDOK,button,1342373889
[MNU:IDR_MAINFRAME]
Type=1
Class=CMainFrame
Command1=ID_FILE_NEW
Command2=ID_FILE_OPEN
Command3=ID_FILE_SAVE
Command4=ID_FILE_SAVE_AS
Command5=ID_FILE_PRINT
Command6=ID_FILE_PRINT_PREVIEW
Command7=ID_FILE_PRINT_SETUP
Command8=ID_FILE_MRU_FILE1
Command9=ID_APP_EXIT
Command10=ID_EDIT_UNDO
Command11=ID_EDIT_CUT
Command12=ID_EDIT_COPY
Command13=ID_EDIT_PASTE
Command14=ID_VIEW_TOOLBAR
Command15=ID_VIEW_STATUS_BAR
Command16=ID_APP_ABOUT
Command17=IDM_PIPE_CONNECT
Command18=IDM_PIPE_READ
Command19=IDM_PIPE_WRITE
CommandCount=19
[ACL:IDR_MAINFRAME]
Type=1
Class=CMainFrame
Command1=ID_FILE_NEW
Command2=ID_FILE_OPEN
Command3=ID_FILE_SAVE
Command4=ID_FILE_PRINT
Command5=ID_EDIT_UNDO
Command6=ID_EDIT_CUT
Command7=ID_EDIT_COPY
Command8=ID_EDIT_PASTE
Command9=ID_EDIT_UNDO
Command10=ID_EDIT_CUT
Command11=ID_EDIT_COPY
Command12=ID_EDIT_PASTE
Command13=ID_NEXT_PANE
Command14=ID_PREV_PANE
CommandCount=14
[TB:IDR_MAINFRAME]
Type=1
Class=?
Command1=ID_FILE_NEW
Command2=ID_FILE_OPEN
Command3=ID_FILE_SAVE
Command4=ID_EDIT_CUT
Command5=ID_EDIT_COPY
Command6=ID_EDIT_PASTE
Command7=ID_FILE_PRINT
Command8=ID_APP_ABOUT
CommandCount=8
| {
"pile_set_name": "Github"
} |
//===- llvm/Testing/Support/Error.cpp -------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "llvm/Testing/Support/Error.h"
#include "llvm/ADT/StringRef.h"
using namespace llvm;
llvm::detail::ErrorHolder llvm::detail::TakeError(llvm::Error Err) {
std::vector<std::shared_ptr<ErrorInfoBase>> Infos;
handleAllErrors(std::move(Err),
[&Infos](std::unique_ptr<ErrorInfoBase> Info) {
Infos.emplace_back(std::move(Info));
});
return {std::move(Infos)};
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2017 Advanced Micro Devices, Inc.
*
* 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 COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _thm_9_0_DEFAULT_HEADER
#define _thm_9_0_DEFAULT_HEADER
// addressBlock: thm_thm_SmuThmDec
#define mmTHM_TCON_CUR_TMP_DEFAULT 0x00000000
#define mmTHM_TCON_HTC_DEFAULT 0x00004000
#define mmTHM_TCON_THERM_TRIP_DEFAULT 0x00000001
#define mmTHM_GPIO_PROCHOT_CTRL_DEFAULT 0x000000f9
#define mmTHM_GPIO_THERMTRIP_CTRL_DEFAULT 0x001000f9
#define mmTHM_GPIO_PWM_CTRL_DEFAULT 0x000000f9
#define mmTHM_GPIO_TACHIN_CTRL_DEFAULT 0x000000f9
#define mmTHM_GPIO_PUMPOUT_CTRL_DEFAULT 0x000000f9
#define mmTHM_GPIO_PUMPIN_CTRL_DEFAULT 0x000000f9
#define mmTHM_THERMAL_INT_ENA_DEFAULT 0x00000000
#define mmTHM_THERMAL_INT_CTRL_DEFAULT 0x0fff0078
#define mmTHM_THERMAL_INT_STATUS_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL0_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL1_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL2_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL3_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL4_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL5_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL6_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL7_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL8_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL9_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL10_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL11_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL12_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL13_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL14_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIL15_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR0_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR1_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR2_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR3_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR4_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR5_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR6_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR7_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR8_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR9_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR10_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR11_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR12_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR13_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR14_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_RDIR15_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_INT_DATA_DEFAULT 0x00000000
#define mmTHM_TMON0_DEBUG_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL0_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL1_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL2_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL3_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL4_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL5_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL6_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL7_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL8_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL9_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL10_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL11_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL12_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL13_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL14_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIL15_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR0_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR1_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR2_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR3_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR4_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR5_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR6_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR7_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR8_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR9_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR10_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR11_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR12_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR13_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR14_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_RDIR15_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_INT_DATA_DEFAULT 0x00000000
#define mmTHM_TMON1_DEBUG_DEFAULT 0x00000000
#define mmTHM_DIE1_TEMP_DEFAULT 0x00000000
#define mmTHM_DIE2_TEMP_DEFAULT 0x00000000
#define mmTHM_DIE3_TEMP_DEFAULT 0x00000000
#define mmCG_MULT_THERMAL_CTRL_DEFAULT 0x08400001
#define mmCG_MULT_THERMAL_STATUS_DEFAULT 0x00000000
#define mmTHM_TMON0_COEFF_DEFAULT 0x00024068
#define mmTHM_TMON1_COEFF_DEFAULT 0x00024068
#define mmCG_FDO_CTRL0_DEFAULT 0x0000642c
#define mmCG_FDO_CTRL1_DEFAULT 0x001e1f7d
#define mmCG_FDO_CTRL2_DEFAULT 0x02bf0228
#define mmCG_TACH_CTRL_DEFAULT 0x00008002
#define mmCG_TACH_STATUS_DEFAULT 0x00000000
#define mmCG_THERMAL_STATUS_DEFAULT 0x00000000
#define mmCG_PUMP_CTRL0_DEFAULT 0x0000642c
#define mmCG_PUMP_CTRL1_DEFAULT 0x001e1f7d
#define mmCG_PUMP_CTRL2_DEFAULT 0x02bf0228
#define mmCG_PUMP_TACH_CTRL_DEFAULT 0x00008002
#define mmCG_PUMP_TACH_STATUS_DEFAULT 0x00000000
#define mmCG_PUMP_STATUS_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL0_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL1_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL2_DEFAULT 0x00000060
#define mmTHM_TCON_LOCAL3_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL4_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL5_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL6_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL7_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL8_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL9_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL10_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL11_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL12_DEFAULT 0x00000000
#define mmTHM_TCON_LOCAL13_DEFAULT 0x00000000
#define mmTHM_BACO_CNTL_DEFAULT 0x00000004
#define mmTHM_BACO_TIMING0_DEFAULT 0x80a06050
#define mmTHM_BACO_TIMING1_DEFAULT 0x1020f070
#define mmXTAL_CNTL_DEFAULT 0x00006010
#define mmSBTSI_REMOTE_TEMP_DEFAULT 0x00000000
#define mmSBRMI_CONTROL_DEFAULT 0x00000000
#define mmSBRMI_COMMAND_DEFAULT 0x00000000
#define mmSBRMI_WRITE_DATA0_DEFAULT 0x00000000
#define mmSBRMI_WRITE_DATA1_DEFAULT 0x00000000
#define mmSBRMI_WRITE_DATA2_DEFAULT 0x00000000
#define mmSBRMI_READ_DATA0_DEFAULT 0x00000000
#define mmSBRMI_READ_DATA1_DEFAULT 0x00000000
#define mmSBRMI_CORE_EN_NUMBER_DEFAULT 0x00000010
#define mmSBRMI_CORE_EN_STATUS0_DEFAULT 0x00000000
#define mmSBRMI_CORE_EN_STATUS1_DEFAULT 0x00000000
#define mmSBRMI_APIC_STATUS0_DEFAULT 0x00000000
#define mmSBRMI_APIC_STATUS1_DEFAULT 0x00000000
#define mmSBRMI_MCE_STATUS0_DEFAULT 0x00000000
#define mmSBRMI_MCE_STATUS1_DEFAULT 0x00000000
#define mmSMBUS_CNTL0_DEFAULT 0x00030082
#define mmSMBUS_CNTL1_DEFAULT 0x0000063f
#define mmSMBUS_BLKWR_CMD_CTRL0_DEFAULT 0x12110201
#define mmSMBUS_BLKWR_CMD_CTRL1_DEFAULT 0x0003005a
#define mmSMBUS_BLKRD_CMD_CTRL0_DEFAULT 0x00001303
#define mmSMBUS_BLKRD_CMD_CTRL1_DEFAULT 0x00000000
#define mmSMBUS_TIMING_CNTL0_DEFAULT 0x028a4f5c
#define mmSMBUS_TIMING_CNTL1_DEFAULT 0x08036927
#define mmSMBUS_TIMING_CNTL2_DEFAULT 0x0021e548
#define mmSMBUS_TRIGGER_CNTL_DEFAULT 0x00000000
#define mmSMBUS_UDID_CNTL0_DEFAULT 0x7fffffff
#define mmSMBUS_UDID_CNTL1_DEFAULT 0x00000000
#define mmSMBUS_UDID_CNTL2_DEFAULT 0x00000043
#define mmSMBUS_BACO_DUMMY_DEFAULT 0x00000000
#define mmSMBUS_BACO_ADDR_RANGE0_LOW_DEFAULT 0x00000000
#define mmSMBUS_BACO_ADDR_RANGE0_HIGH_DEFAULT 0x00000000
#define mmSMBUS_BACO_ADDR_RANGE1_LOW_DEFAULT 0x00000000
#define mmSMBUS_BACO_ADDR_RANGE1_HIGH_DEFAULT 0x00000000
#define mmSMBUS_BACO_ADDR_RANGE2_LOW_DEFAULT 0x00000000
#define mmSMBUS_BACO_ADDR_RANGE2_HIGH_DEFAULT 0x00000000
#define mmSMBUS_BACO_ADDR_RANGE3_LOW_DEFAULT 0x00000000
#define mmSMBUS_BACO_ADDR_RANGE3_HIGH_DEFAULT 0x00000000
#define mmSMBUS_BACO_ADDR_RANGE4_LOW_DEFAULT 0x00000000
#define mmSMBUS_BACO_ADDR_RANGE4_HIGH_DEFAULT 0x00000000
#define mmTHM_GPIO_MACO_EN_CTRL_DEFAULT 0x000000f9
#define mmTHM_BACO_TIMING2_DEFAULT 0x00903040
#define mmTHM_BACO_TIMING_DEFAULT 0x00000a8c
#define mmTHM_TMON0_REMOTE_START_DEFAULT 0x00000000
#define mmTHM_TMON0_REMOTE_END_DEFAULT 0x00000000
#define mmTHM_TMON1_REMOTE_START_DEFAULT 0x00000000
#define mmTHM_TMON1_REMOTE_END_DEFAULT 0x00000000
#define mmTHM_TMON2_REMOTE_START_DEFAULT 0x00000000
#define mmTHM_TMON2_REMOTE_END_DEFAULT 0x00000000
#define mmTHM_TMON3_REMOTE_START_DEFAULT 0x00000000
#define mmTHM_TMON3_REMOTE_END_DEFAULT 0x00000000
#endif
| {
"pile_set_name": "Github"
} |
#!/bin/rc
# S9 startup script
# based on a script in this article:
# http://ninetimes.cat-v.org/tips/2009/07/19/0/
s9dir=$home/lib/s9fes
mkdir -p $home/lib/s9fes
for (i in . $objtype lib ext contrib)
bind -a $s9dir/$i $home/lib/s9fes
S9FES_LIBRARY_PATH=$home/lib/s9fes
/$objtype/bin/s9fes $*
unmount $home/lib/s9fes
| {
"pile_set_name": "Github"
} |
#include <mchck.h>
/* Pin change interrupt handling */
enum pin_change_polarity {
PIN_CHANGE_ZERO = 0x8,
PIN_CHANGE_ONE = 0xC,
PIN_CHANGE_FALLING = 0xA,
PIN_CHANGE_RISING = 0x9,
PIN_CHANGE_EITHER = 0xB
};
typedef void (*pin_change_cb)(void *);
struct pin_change_handler {
enum pin_id pin_id;
enum pin_change_polarity polarity;
pin_change_cb cb;
void *cbdata;
};
/*
* Register a pin change callback.
*
* Note that _pin should be a PIN_* constant, not GPIO_*. Things will
* unfortunately fail silently if this is violated
*
*/
#define PIN_DEFINE_CALLBACK(_pin, _polarity, _cb, _cbdata) \
const struct pin_change_handler _CONCAT(_CONCAT(_CONCAT(pin_handler_, _pin), _), _polarity) \
__attribute__((__section__(".pin_hooks." _STR(_pin)), __used__)) = { \
.pin_id = _pin, \
.polarity = _polarity, \
.cb = _cb, \
.cbdata = _cbdata \
};
void pin_change_init(void);
| {
"pile_set_name": "Github"
} |
// *****************************************************************************
//
// © Component Factory Pty Ltd 2017. All rights reserved.
// The software and associated documentation supplied hereunder are the
// proprietary information of Component Factory Pty Ltd, 13 Swallows Close,
// Mornington, Vic 3931, Australia and are supplied subject to licence terms.
//
// Version 4.6.0.0 www.ComponentFactory.com
// *****************************************************************************
using System;
using System.Text;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections.Generic;
using System.Diagnostics;
namespace ComponentFactory.Krypton.Toolkit
{
/// <summary>
/// Storage for element color values.
/// </summary>
public class PaletteElementColorRedirect : PaletteElementColor
{
#region Instance Fields
private PaletteElementColorInheritRedirect _redirect;
#endregion
#region Identity
/// <summary>
/// Initialize a new instance of the PaletteElementColorRedirect class.
/// </summary>
/// <param name="redirect">Source for inheriting values.</param>
/// <param name="element">Element value.</param>
/// <param name="needPaint">Delegate for notifying changes in value.</param>
public PaletteElementColorRedirect(PaletteRedirect redirect,
PaletteElement element,
NeedPaintHandler needPaint)
: base(null, needPaint)
{
// Setup inheritence to recover values from the redirect instance
_redirect = new PaletteElementColorInheritRedirect(redirect, element);
SetInherit(_redirect);
}
#endregion
#region SetRedirector
/// <summary>
/// Update the redirector with new reference.
/// </summary>
/// <param name="redirect">Target redirector.</param>
public virtual void SetRedirector(PaletteRedirect redirect)
{
_redirect.SetRedirector(redirect);
}
#endregion
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright (c) 2016, 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.
*/
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="car_guest" msgid="3738772168718508650">"Госць"</string>
<string name="start_guest_session" msgid="7055742120180595689">"Госць"</string>
<string name="car_add_user" msgid="5245196248349230898">"Дадаць карыстальніка"</string>
<string name="car_new_user" msgid="8142927244990323906">"Новы карыстальнік"</string>
<string name="user_add_user_message_setup" msgid="1791011504259527329">"Калі вы дадаяце новага карыстальніка, яму трэба наладзіць свой профіль."</string>
<string name="user_add_user_message_update" msgid="3383320289232716179">"Кожны карыстальнік прылады можа абнаўляць праграмы для іншых уліковых запісаў."</string>
</resources>
| {
"pile_set_name": "Github"
} |
{
"jsonSchemaSemanticVersion": "1.0.0",
"imports": [
{
"corpusPath": "cdm:/foundations.cdm.json"
},
{
"corpusPath": "/core/operationsCommon/Common.cdm.json",
"moniker": "base_Common"
},
{
"corpusPath": "/core/operationsCommon/DataEntityView.cdm.json",
"moniker": "base_DataEntityView"
},
{
"corpusPath": "/core/operationsCommon/Tables/SupplyChain/SalesAndMarketing/Group/DlvTerm.cdm.json"
},
{
"corpusPath": "/core/operationsCommon/Tables/SupplyChain/Transportation/Main/TMSRoute.cdm.json"
},
{
"corpusPath": "/core/operationsCommon/Tables/SupplyChain/Transportation/WorksheetLine/TMSRouteSegment.cdm.json"
},
{
"corpusPath": "/core/operationsCommon/Tables/SupplyChain/Inventory/WorksheetHeader/WHSShipmentTable.cdm.json"
},
{
"corpusPath": "/core/operationsCommon/Tables/Finance/Ledger/Main/CompanyInfo.cdm.json"
}
],
"definitions": [
{
"entityName": "TMSRouteSegmentShipment",
"extendsEntity": "base_Common/Common",
"exhibitsTraits": [
{
"traitReference": "is.CDM.entityVersion",
"arguments": [
{
"name": "versionNumber",
"value": "1.1"
}
]
}
],
"hasAttributes": [
{
"name": "ActualWeight",
"dataType": "TMSActualWeight",
"isNullable": true,
"description": ""
},
{
"name": "BillOfLadingId",
"dataType": "WHSBillOfLadingId",
"isNullable": true,
"description": ""
},
{
"name": "DestinationPostalCode",
"dataType": "TMSPostalCode",
"isNullable": true,
"description": ""
},
{
"name": "DlvTermId",
"dataType": "DlvTermId",
"isNullable": true,
"description": ""
},
{
"name": "Id",
"dataType": "WHSShipmentId",
"description": ""
},
{
"name": "OriginPostalCode",
"dataType": "TMSPostalCode",
"isNullable": true,
"description": ""
},
{
"name": "ProNum",
"dataType": "WHSProNum",
"isNullable": true,
"description": ""
},
{
"name": "RouteCode",
"dataType": "TMSRouteCode",
"description": ""
},
{
"name": "Sequence",
"dataType": "TMSSequence",
"description": ""
},
{
"name": "StopNum",
"dataType": "TMSStopNum",
"isNullable": true,
"description": ""
},
{
"name": "WayBill",
"dataType": "TMSWayBill",
"isNullable": true,
"description": ""
},
{
"name": "DataAreaId",
"dataType": "string",
"isReadOnly": true
},
{
"entity": {
"entityReference": "DlvTerm"
},
"name": "Relationship_DlvTermRelationship",
"resolutionGuidance": {
"entityByReference": {
"allowReference": true
}
}
},
{
"entity": {
"entityReference": "TMSRoute"
},
"name": "Relationship_TMSRouteRelationship",
"resolutionGuidance": {
"entityByReference": {
"allowReference": true
}
}
},
{
"entity": {
"entityReference": "TMSRouteSegment"
},
"name": "Relationship_TMSRouteSegmentRelationship",
"resolutionGuidance": {
"entityByReference": {
"allowReference": true
}
}
},
{
"entity": {
"entityReference": "WHSShipmentTable"
},
"name": "Relationship_WHSShipmentTableRelationship",
"resolutionGuidance": {
"entityByReference": {
"allowReference": true
}
}
},
{
"entity": {
"entityReference": "CompanyInfo"
},
"name": "Relationship_CompanyRelationship",
"resolutionGuidance": {
"entityByReference": {
"allowReference": true
}
}
}
],
"displayName": "Route Segment Shipment"
},
{
"dataTypeName": "TMSActualWeight",
"extendsDataType": "decimal"
},
{
"dataTypeName": "WHSBillOfLadingId",
"extendsDataType": "string"
},
{
"dataTypeName": "TMSPostalCode",
"extendsDataType": "string"
},
{
"dataTypeName": "DlvTermId",
"extendsDataType": "string"
},
{
"dataTypeName": "WHSShipmentId",
"extendsDataType": "string"
},
{
"dataTypeName": "WHSProNum",
"extendsDataType": "string"
},
{
"dataTypeName": "TMSRouteCode",
"extendsDataType": "string"
},
{
"dataTypeName": "TMSSequence",
"extendsDataType": "integer"
},
{
"dataTypeName": "TMSStopNum",
"extendsDataType": "integer"
},
{
"dataTypeName": "TMSWayBill",
"extendsDataType": "string"
}
]
} | {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" />
<!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Introduction - Controllers - Ember Guides</title>
<meta name="description" content="What is a Controller?
A Controller is routable object which receives a single property from the Route – model – which is the return value of the Route's model() method.
The model is passed from the Route to the Controller by default using the...">
<meta name="referrer" content="unsafe-url">
<!---->
<!---->
<!---->
<!---->
<meta property="og:title" content="Introduction - Controllers - Ember Guides">
<!---->
<meta property="og:description" content="What is a Controller?
A Controller is routable object which receives a single property from the Route – model – which is the return value of the Route's model() method.
The model is passed from the Route to the Controller by default using the...">
<meta property="og:type" content="website">
<!---->
<meta name="twitter:card" content="summary">
<!---->
<!---->
<meta name="twitter:title" content="Introduction - Controllers - Ember Guides">
<!---->
<meta name="twitter:description" content="What is a Controller?
A Controller is routable object which receives a single property from the Route – model – which is the return value of the Route's model() method.
The model is passed from the Route to the Controller by default using the...">
<!---->
<!---->
<!----><meta name="ember-cli-head-end" content>
<link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css">
<link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css">
<link rel="shortcut icon" href="/images/favicon.png" />
</head>
<body class="application version show version-show">
<script type="x/boundary" id="fastboot-body-start"></script><!---->
<header id="ember327028" class="es-header ember-view" role="banner"><div id="ember327029" class="ember-view"><div class="container">
<nav id="ember327030" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com">
<svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg>
</a>
<button id="ember327031" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span>
</button>
<div id="ember327032" class="navbar-collapse collapse ember-view"><ul id="ember327033" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember327034" class="dropdown nav-item ember-view"> <a href="#" id="ember327035" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a>
<!---->
</li>
<!----><li id="ember327037" class="dropdown nav-item ember-view"> <a href="#" id="ember327038" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a>
<!---->
</li>
<li id="ember327040" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a>
</li><!---->
<!----><li id="ember327041" class="dropdown nav-item ember-view"> <a href="#" id="ember327042" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a>
<!---->
</li>
<!----><li id="ember327044" class="dropdown nav-item ember-view"> <a href="#" id="ember327045" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a>
<!---->
</li>
</ul><ul id="ember327047" class="nav navbar-nav ember-view"> <form>
<div id="ember327048" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search">
<div id="ember327049" class="ds-dropdown-results ember-tether ember-view"><!----></div></div>
</form>
</ul>
</div>
</nav></div>
</div>
</header>
<!---->
<div class="info-banner-wrapper">
<div class="info-banner-container">
<div id="ember327050" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p>
</div>
</div>
</div>
<main class="container">
<aside class="sidebar">
<label for="version-select" class="visually-hidden">Guides version</label>
<div id="ember327051" class="ember-basic-dropdown ember-view">
<div aria-label="v3.1.0" aria-owns="ember-basic-dropdown-content-ember327051" tabindex="0" data-ebd-id="ember327051-trigger" role="button" id="ember327052" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 3.1 <!---->
</span>
<!----><span class="ember-power-select-status-icon"></span>
</div>
<div id="ember-basic-dropdown-content-ember327051" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div>
</div>
<input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox">
<label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label>
<nav class="toc-container versions" aria-label="table of contents">
<ol id="ember327056" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0">
<div id="ember327059" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/getting-started" id="ember327060" class="cp-Panel-toggle ember-view"> Getting Started
</a>
<div id="ember327061" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327063" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/tutorial" id="ember327064" class="cp-Panel-toggle ember-view"> Tutorial
</a>
<div id="ember327065" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327067" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/object-model" id="ember327068" class="cp-Panel-toggle ember-view"> The Object Model
</a>
<div id="ember327069" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327071" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/routing" id="ember327072" class="cp-Panel-toggle ember-view"> Routing
</a>
<div id="ember327073" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327075" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/templates" id="ember327076" class="cp-Panel-toggle ember-view"> Templates
</a>
<div id="ember327077" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327079" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/components" id="ember327080" class="cp-Panel-toggle ember-view"> Components
</a>
<div id="ember327081" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327083" class="cp-Panel cp-is-open ember-view"><a href="/v3.1.0/controllers" id="ember327084" class="cp-Panel-toggle selected ember-view"> Controllers
</a>
<div id="ember327085" class="cp-Panel-body cp-is-open ember-view">
<div class="cp-Panel-body-inner">
<ol id="ember327086" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 selected">
<a href="/v3.1.0/controllers/index" id="ember327088" class="ember-view"> Introduction
</a> </li>
</ol>
</div>
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327090" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/models" id="ember327091" class="cp-Panel-toggle ember-view"> Models
</a>
<div id="ember327092" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327094" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/applications" id="ember327095" class="cp-Panel-toggle ember-view"> Application Concerns
</a>
<div id="ember327096" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327098" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/testing" id="ember327099" class="cp-Panel-toggle ember-view"> Testing
</a>
<div id="ember327100" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327102" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/ember-inspector" id="ember327103" class="cp-Panel-toggle ember-view"> Ember Inspector
</a>
<div id="ember327104" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327106" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/addons-and-dependencies" id="ember327107" class="cp-Panel-toggle ember-view"> Addons and Dependencies
</a>
<div id="ember327108" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327110" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/configuring-ember" id="ember327111" class="cp-Panel-toggle ember-view"> Configuring Ember.js
</a>
<div id="ember327112" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327114" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/contributing" id="ember327115" class="cp-Panel-toggle ember-view"> Contributing to Ember.js
</a>
<div id="ember327116" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
<li class="toc-group toc-level-0">
<div id="ember327118" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/glossary" id="ember327119" class="cp-Panel-toggle ember-view"> Glossary
</a>
<div id="ember327120" class="cp-Panel-body ember-view">
<!---->
</div>
</div> </li>
</ol>
</nav>
</aside>
<article id="ember327121" class="chapter ember-view"> <div class="old-version-warning">
<i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v3.1.0.
<a href="/release/controllers" id="ember327122" class="btn ember-view"> VIEW v3.15.0 </a>
</div>
<a href="https://github.com/ember-learn/guides-source/edit/master/guides/v3.1.0/controllers/index.md" target="_blank" class="edit-page icon-pencil" rel="noopener">
Edit Page
</a>
<h1>
Introduction
</h1>
<hr>
<div id="ember327123" class="ember-view"><h3 id="toc_what-is-a-controller">What is a Controller?</h3>
<section aria-labelledby="toc_what-is-a-controller">
<p>A <a href="https://api.emberjs.com/ember/3.1/classes/Controller">Controller</a> is routable object which receives a single property from the Route – <code>model</code> – which is the return value of the Route's <a href="https://api.emberjs.com/ember/3.1/classes/Route/methods?anchor=model"><code>model()</code></a> method.</p>
<p>The model is passed from the Route to the Controller by default using the <a href="https://api.emberjs.com/ember/3.1/classes/Route/methods/setupController?anchor=setupController"><code>setupController()</code></a> function. The Controller is then often used to decorate the model with display properties such as retrieving the full name from a name model.</p>
<p>A Controller is usually paired with an individual Route of the same name.</p>
</section>
<h3 id="toc_defining-a-controller">Defining a Controller</h3>
<section aria-labelledby="toc_defining-a-controller">
<p>We only need to generate a Controller file if we want to customize the properties or provide any actions to the Route. If we have no customizations, Ember will provide a default Controller instance for us at run time.</p>
<p>To generate a controller, run</p>
<pre><code class="bash language-bash">ember generate controller my-controller-name
</code></pre>
<p>This creates a controller file at <code>app/controllers/my-controller-name.js</code>, and a unit test file at <code>tests/unit/controllers/my-controller-name-test.js</code>.</p>
<p>The controller name <code>my-controller-name</code> must match the name of the Route that renders it. So if the Route is named <code>blog-post</code>, it should have a matching Controller named <code>blog-post</code>. The matching file names of the Controller and the Route signals to Ember that this Controller must be used when landing on the <code>blog-post</code> Route.</p>
</section>
<h3 id="toc_where-and-when-to-use-controllers">Where and When to use Controllers?</h3>
<section aria-labelledby="toc_where-and-when-to-use-controllers">
<p>Controllers are used as an extension of the model loaded from the Route. Any attributes or actions that we want to share with components used on that Route could be defined on the Controller and passed down through the Route’s template.</p>
<p>Controllers are singletons so we should avoid keeping state that does not derive from either the Model or Query Parameters since these would persist in between activations such as when a user leaves the Route and then re-enters it.</p>
<p>Controllers can also contain actions that enable the Route's components to update the Model or Query Parameters through it using Computed Properties.</p>
</section>
<h3 id="toc_basic-controller-example">Basic Controller Example</h3>
<section aria-labelledby="toc_basic-controller-example">
<p>Let's explore these concepts using an example of a route displaying a blog post. Assume that the route returns a <code>BlogPost</code> model that is presented in the template.</p>
<p>The <code>BlogPost</code> model would have properties like:</p>
<ul>
<li><code>title</code></li>
<li><code>intro</code></li>
<li><code>body</code></li>
<li><code>author</code></li>
</ul>
<p>In the example below, we can see how the template is using the model properties to display some data.</p>
<pre><code class="handlebars language-handlebars"data-filename=app/templates/blog-post.hbs><h1>{{model.title}}</h1>
<h2>by {{model.author}}</h2>
<div class="intro">
{{model.intro}}
</div>
<hr>
<div class="body">
{{model.body}}
</div>
</code></pre>
<p>Consider the example where we want to have a controller for a <code>blog-post</code> route. In this controller, we are looking to keep track if the user has expanded the body or not.</p>
<pre><code class="javascript language-javascript"data-filename=app/controllers/blog-post.js>import Controller from '@ember/controller';
export default Controller.extend({
isExpanded: false,
actions: {
toggleBody() {
this.toggleProperty('isExpanded');
}
}
});
</code></pre>
<p>The property <code>isExpanded</code> keeps track if the user has expanded the body or not. The action <code>toggleBody()</code> provides a way for the user to provide their setting. Both of the them are used in the updated template below.</p>
<pre><code class="handlebars language-handlebars"data-filename=app/templates/blog-post.hbs><h1>{{model.title}}</h1>
<h2>by {{model.author}}</h2>
<div class='intro'>
{{model.intro}}
</div>
<hr>
{{#if isExpanded}}
<button {{action "toggleBody"}}>Hide Body</button>
<div class="body">
{{model.body}}
</div>
{{else}}
<button {{action "toggleBody"}}>Show Body</button>
{{/if}}
</code></pre>
<p>We can see that if the property <code>isExpanded</code> is toggled to true, we will show the body property of the model to the user. This <code>isExpanded</code> is stored in the controller.</p>
</section>
<h3 id="toc_common-questions">Common questions</h3>
<section aria-labelledby="toc_common-questions">
</section>
<h6 id="toc_should-we-use-controllers-in-my-application-ive-heard-theyre-going-away">Should we use controllers in my application? I've heard they're going away!</h6>
<section aria-labelledby="toc_should-we-use-controllers-in-my-application-ive-heard-theyre-going-away">
<p>Yes! Controllers are still an integral part of an Ember application architecture, and generated by the framework even if you don't declare a Controller module explicitly.</p>
</section>
<h6 id="toc_when-should-we-create-a-controller">When should we create a Controller?</h6>
<section aria-labelledby="toc_when-should-we-create-a-controller">
<ul>
<li>We want to pass down actions or variables to share with a Route’s child components</li>
<li>We have a computed property that depends on the results of the model hook</li>
<li>We need to support query parameters</li>
</ul>
</section>
</div>
<footer id="ember327124" class="ember-view"> <a href="/v3.1.0/components/triggering-changes-with-actions" id="ember327125" class="previous-guide ember-view">Triggering Changes with Actions</a>
<a href="/v3.1.0/models/index" id="ember327126" class="next-guide ember-view"> We've finished covering Controllers. Next up: Models - Introduction
</a></footer>
</article>
</main>
<footer id="ember327127" class="es-footer ember-view" role="contentinfo"><div class="footer responsive">
<div class="container">
<div id="ember327128" class="footer-info ember-view">
Copyright 2020
<a href="http://tilde.io">Tilde Inc.</a>
<br>
<a href="https://emberjs.com/team">Team</a>
|
<a href="https://emberjs.com/sponsors">Sponsors</a>
<br>
<a href="https://emberjs.com/security">Security</a>
|
<a href="https://emberjs.com/legal">Legal</a>
|
<a href="https://emberjs.com/brand">Brand</a>
<br>
<a href="https://emberjs.com/guidelines">Community Guidelines</a>
<!----></div>
<div id="ember327129" class="footer-statement ember-view">
<p class="footer-tagline">Ember.js is free, open source and always will be.</p>
<div class="footer-social">
<a href="http://twitter.com/emberjs" title="Twitter">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg>
</a>
<a href="https://github.com/emberjs/ember.js" title="GitHub">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg>
</a>
<a href="https://discordapp.com/invite/zT3asNS" title="Discord">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg>
</a>
</div>
</div>
<div id="ember327130" class="footer-contributions ember-view">
<div class="contributor">
<p>Hosted by:</p>
<a href="https://www.heroku.com/emberjs">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg>
</a>
</div>
<div class="contributor">
<p>CDN provided by:</p>
<a href="https://www.fastly.com">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg>
</a>
</div>
<div class="contributor">
<p>Tested with:</p>
<a href="https://percy.io">
<svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg>
</a>
</div>
<div class="contributor">
<p>Resolved with:</p>
<a href="https://dnsimple.com/resolving/emberjs">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg>
</a>
</div>
</div>
</div>
</div>
</footer>
<script type="x/boundary" id="fastboot-body-end"></script>
<script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script>
<script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
using LmpClient.Localization;
using LmpClient.Network;
using LmpClient.Systems.SettingsSys;
using LmpClient.Windows.Options;
using LmpClient.Windows.ServerList;
using LmpCommon.Enums;
using UnityEngine;
namespace LmpClient.Windows.Connection
{
public partial class ConnectionWindow
{
protected override void DrawWindowContent(int windowId)
{
GUI.DragWindow(MoveRect);
GUILayout.BeginVertical();
DrawPlayerNameSection();
DrawTopButtons();
DrawCustomServers();
GUILayout.Label(MainSystem.Singleton.Status, StatusStyle);
GUILayout.EndVertical();
}
private void DrawCustomServers()
{
GUILayout.Label(LocalizationContainer.ConnectionWindowText.CustomServers);
GUILayout.BeginVertical();
ScrollPos = GUILayout.BeginScrollView(ScrollPos, GUILayout.Width(WindowWidth - 5),
GUILayout.Height(WindowHeight - 100));
if (GUILayout.Button(PlusIcon))
{
SettingsSystem.CurrentSettings.Servers.Insert(0, new ServerEntry());
SettingsSystem.SaveSettings();
}
for (var serverPos = 0; serverPos < SettingsSystem.CurrentSettings.Servers.Count; serverPos++)
{
GUILayout.BeginHorizontal();
var selected = GUILayout.Toggle(SelectedIndex == serverPos,
SettingsSystem.CurrentSettings.Servers[serverPos].Name, ToggleButtonStyle);
if (GUILayout.Button(DeleteIcon, GUILayout.Width(35)))
{
SettingsSystem.CurrentSettings.Servers.RemoveAt(SelectedIndex);
SettingsSystem.SaveSettings();
}
else
{
GUILayout.EndHorizontal();
if (selected)
{
DrawServerEntry(serverPos);
}
}
}
GUILayout.EndScrollView();
GUILayout.EndVertical();
}
private void DrawServerEntry(int serverPos)
{
SelectedIndex = serverPos;
GUILayout.BeginVertical();
GUILayout.BeginHorizontal();
GUILayout.Label(LocalizationContainer.ConnectionWindowText.Name, LabelOptions);
var newServerName = GUILayout.TextArea(SettingsSystem.CurrentSettings.Servers[serverPos].Name);
if (newServerName != SettingsSystem.CurrentSettings.Servers[serverPos].Name)
{
SettingsSystem.CurrentSettings.Servers[serverPos].Name = newServerName;
SettingsSystem.SaveSettings();
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label(LocalizationContainer.ConnectionWindowText.Address, LabelOptions);
var newAddress = GUILayout.TextArea(SettingsSystem.CurrentSettings.Servers[serverPos].Address);
if (newAddress != SettingsSystem.CurrentSettings.Servers[serverPos].Address)
{
SettingsSystem.CurrentSettings.Servers[serverPos].Address = newAddress;
SettingsSystem.SaveSettings();
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label(LocalizationContainer.ConnectionWindowText.Port, LabelOptions);
var port = GUILayout.TextArea(SettingsSystem.CurrentSettings.Servers[serverPos].Port.ToString());
if (int.TryParse(port, out var parsedPort))
{
if (parsedPort != SettingsSystem.CurrentSettings.Servers[serverPos].Port)
{
SettingsSystem.CurrentSettings.Servers[serverPos].Port = parsedPort;
SettingsSystem.SaveSettings();
}
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label(LocalizationContainer.ConnectionWindowText.Password, LabelOptions);
var newPassword = GUILayout.PasswordField(SettingsSystem.CurrentSettings.Servers[serverPos].Password, '*', 30);
if (newPassword != SettingsSystem.CurrentSettings.Servers[serverPos].Password)
{
SettingsSystem.CurrentSettings.Servers[serverPos].Password = newPassword;
SettingsSystem.SaveSettings();
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
}
private static void DrawTopButtons()
{
GUILayout.BeginHorizontal();
if (MainSystem.NetworkState <= ClientState.Disconnected)
{
GUI.enabled = SettingsSystem.CurrentSettings.Servers.Count > SelectedIndex && SelectedIndex >= 0;
if (GUILayout.Button(ConnectBigIcon))
{
NetworkConnection.ConnectToServer(
SettingsSystem.CurrentSettings.Servers[SelectedIndex].Address,
SettingsSystem.CurrentSettings.Servers[SelectedIndex].Port,
SettingsSystem.CurrentSettings.Servers[SelectedIndex].Password);
}
}
else
{
if (GUILayout.Button(DisconnectBigIcon))
{
NetworkConnection.Disconnect("Cancelled connection to server");
}
}
GUI.enabled = true;
OptionsWindow.Singleton.Display = GUILayout.Toggle(OptionsWindow.Singleton.Display, SettingsBigIcon, ToggleButtonStyle);
ServerListWindow.Singleton.Display = GUILayout.Toggle(ServerListWindow.Singleton.Display, ServerBigIcon, ToggleButtonStyle);
GUILayout.EndHorizontal();
}
private void DrawPlayerNameSection()
{
GUILayout.BeginHorizontal();
GUILayout.Label(LocalizationContainer.ConnectionWindowText.PlayerName, LabelOptions);
GUI.enabled = MainSystem.NetworkState <= ClientState.Disconnected;
var newPlayerName = GUILayout.TextArea(SettingsSystem.CurrentSettings.PlayerName, 32); // Max 32 characters
if (newPlayerName != SettingsSystem.CurrentSettings.PlayerName)
{
SettingsSystem.CurrentSettings.PlayerName = newPlayerName.Trim().Replace("\n", "");
SettingsSystem.SaveSettings();
}
GUI.enabled = true;
GUILayout.EndHorizontal();
}
}
}
| {
"pile_set_name": "Github"
} |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by \generate-code.bat.
//
// Changes to this file will be lost when the code is regenerated.
// The build server regenerates the code before each build and a pre-build
// step will regenerate the code on each local build.
//
// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
//
// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities.
// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities.
//
// </auto-generated>
//------------------------------------------------------------------------------
// Licensed under MIT No Attribution, see LICENSE file at the root.
// Copyright 2013 Andreas Gullberg Larsen ([email protected]). Maintained at https://github.com/angularsen/UnitsNet.
// ReSharper disable once CheckNamespace
namespace UnitsNet.Units
{
// Disable missing XML comment warnings for the generated unit enums.
#pragma warning disable 1591
public enum ForcePerLengthUnit
{
Undefined = 0,
CentinewtonPerCentimeter,
CentinewtonPerMeter,
CentinewtonPerMillimeter,
DecanewtonPerCentimeter,
DecanewtonPerMeter,
DecanewtonPerMillimeter,
DecinewtonPerCentimeter,
DecinewtonPerMeter,
DecinewtonPerMillimeter,
KilogramForcePerCentimeter,
KilogramForcePerMeter,
KilogramForcePerMillimeter,
KilonewtonPerCentimeter,
KilonewtonPerMeter,
KilonewtonPerMillimeter,
KilopoundForcePerFoot,
KilopoundForcePerInch,
MeganewtonPerCentimeter,
MeganewtonPerMeter,
MeganewtonPerMillimeter,
MicronewtonPerCentimeter,
MicronewtonPerMeter,
MicronewtonPerMillimeter,
MillinewtonPerCentimeter,
MillinewtonPerMeter,
MillinewtonPerMillimeter,
NanonewtonPerCentimeter,
NanonewtonPerMeter,
NanonewtonPerMillimeter,
NewtonPerCentimeter,
NewtonPerMeter,
NewtonPerMillimeter,
PoundForcePerFoot,
PoundForcePerInch,
PoundForcePerYard,
TonneForcePerCentimeter,
TonneForcePerMeter,
TonneForcePerMillimeter,
}
#pragma warning restore 1591
}
| {
"pile_set_name": "Github"
} |
package me.gosimple.nbvcxz.matching;
import me.gosimple.nbvcxz.matching.match.Match;
import me.gosimple.nbvcxz.matching.match.RepeatMatch;
import me.gosimple.nbvcxz.resources.Configuration;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Look for every part of the password that is a repeat of the previous character.
*
* @author Adam Brusselback
*/
public final class RepeatMatcher implements PasswordMatcher
{
public List<Match> match(final Configuration configuration, final String password)
{
List<Match> matches = new ArrayList<>();
Pattern greedy = Pattern.compile("(.+)\\1+");
Pattern lazy = Pattern.compile("(.+?)\\1+");
Pattern lazyAnchored = Pattern.compile("^(.+?)\\1+$");
int lastIndex = 0;
Matcher greedyMatch = greedy.matcher(password);
Matcher lazyMatch = lazy.matcher(password);
while (lastIndex < password.length())
{
if (!greedyMatch.find())
{
break;
}
Matcher match;
String baseToken;
String repeatCharacters;
if (greedyMatch.group(0).length() > (lazyMatch.find() ? lazyMatch.group(0).length() : 0))
{
match = greedyMatch;
Matcher matcher = lazyAnchored.matcher(match.group(0));
baseToken = matcher.find() ? matcher.group(0) : match.group(0);
repeatCharacters = matcher.find() ? matcher.group(1) : match.group(1);
}
else
{
match = lazyMatch;
baseToken = match.group(0);
repeatCharacters = match.group(1);
}
int startIndex = match.start(0);
int endIndex = match.end(0) - 1;
Set<Character> character_set = new HashSet<>();
for (char character : repeatCharacters.toCharArray())
{
character_set.add(character);
}
if (character_set.size() <= 4)
{
matches.add(new RepeatMatch(baseToken, configuration, repeatCharacters, startIndex, endIndex));
}
lastIndex = endIndex + 1;
}
return matches;
}
}
| {
"pile_set_name": "Github"
} |
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
"time"
v1beta1 "k8s.io/api/admissionregistration/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
scheme "k8s.io/client-go/kubernetes/scheme"
rest "k8s.io/client-go/rest"
)
// ValidatingWebhookConfigurationsGetter has a method to return a ValidatingWebhookConfigurationInterface.
// A group's client should implement this interface.
type ValidatingWebhookConfigurationsGetter interface {
ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInterface
}
// ValidatingWebhookConfigurationInterface has methods to work with ValidatingWebhookConfiguration resources.
type ValidatingWebhookConfigurationInterface interface {
Create(*v1beta1.ValidatingWebhookConfiguration) (*v1beta1.ValidatingWebhookConfiguration, error)
Update(*v1beta1.ValidatingWebhookConfiguration) (*v1beta1.ValidatingWebhookConfiguration, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1beta1.ValidatingWebhookConfiguration, error)
List(opts v1.ListOptions) (*v1beta1.ValidatingWebhookConfigurationList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ValidatingWebhookConfiguration, err error)
ValidatingWebhookConfigurationExpansion
}
// validatingWebhookConfigurations implements ValidatingWebhookConfigurationInterface
type validatingWebhookConfigurations struct {
client rest.Interface
}
// newValidatingWebhookConfigurations returns a ValidatingWebhookConfigurations
func newValidatingWebhookConfigurations(c *AdmissionregistrationV1beta1Client) *validatingWebhookConfigurations {
return &validatingWebhookConfigurations{
client: c.RESTClient(),
}
}
// Get takes name of the validatingWebhookConfiguration, and returns the corresponding validatingWebhookConfiguration object, and an error if there is any.
func (c *validatingWebhookConfigurations) Get(name string, options v1.GetOptions) (result *v1beta1.ValidatingWebhookConfiguration, err error) {
result = &v1beta1.ValidatingWebhookConfiguration{}
err = c.client.Get().
Resource("validatingwebhookconfigurations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of ValidatingWebhookConfigurations that match those selectors.
func (c *validatingWebhookConfigurations) List(opts v1.ListOptions) (result *v1beta1.ValidatingWebhookConfigurationList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.ValidatingWebhookConfigurationList{}
err = c.client.Get().
Resource("validatingwebhookconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested validatingWebhookConfigurations.
func (c *validatingWebhookConfigurations) Watch(opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Resource("validatingwebhookconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
// Create takes the representation of a validatingWebhookConfiguration and creates it. Returns the server's representation of the validatingWebhookConfiguration, and an error, if there is any.
func (c *validatingWebhookConfigurations) Create(validatingWebhookConfiguration *v1beta1.ValidatingWebhookConfiguration) (result *v1beta1.ValidatingWebhookConfiguration, err error) {
result = &v1beta1.ValidatingWebhookConfiguration{}
err = c.client.Post().
Resource("validatingwebhookconfigurations").
Body(validatingWebhookConfiguration).
Do().
Into(result)
return
}
// Update takes the representation of a validatingWebhookConfiguration and updates it. Returns the server's representation of the validatingWebhookConfiguration, and an error, if there is any.
func (c *validatingWebhookConfigurations) Update(validatingWebhookConfiguration *v1beta1.ValidatingWebhookConfiguration) (result *v1beta1.ValidatingWebhookConfiguration, err error) {
result = &v1beta1.ValidatingWebhookConfiguration{}
err = c.client.Put().
Resource("validatingwebhookconfigurations").
Name(validatingWebhookConfiguration.Name).
Body(validatingWebhookConfiguration).
Do().
Into(result)
return
}
// Delete takes name of the validatingWebhookConfiguration and deletes it. Returns an error if one occurs.
func (c *validatingWebhookConfigurations) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Resource("validatingwebhookconfigurations").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *validatingWebhookConfigurations) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Resource("validatingwebhookconfigurations").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched validatingWebhookConfiguration.
func (c *validatingWebhookConfigurations) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.ValidatingWebhookConfiguration, err error) {
result = &v1beta1.ValidatingWebhookConfiguration{}
err = c.client.Patch(pt).
Resource("validatingwebhookconfigurations").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}
| {
"pile_set_name": "Github"
} |
#!/bin/sh
exec ./pngimage --exhaustive --list-combos --log "${srcdir}/contrib/pngsuite/"*.png
| {
"pile_set_name": "Github"
} |
/*
* SubParsing.h
* Created by Alexander Strange on 7/25/07.
*
* This file is part of Perian.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#import <Cocoa/Cocoa.h>
#import "SubContext.h"
__BEGIN_DECLS
@class SubSerializer, SubRenderer;
@interface SubRenderDiv : NSObject {
@public;
NSString *text;
SubStyle *styleLine;
NSArray *spans;
float posX, posY;
int marginL, marginR, marginV, layer;
UInt8 alignH, alignV, wrapStyle, render_complexity;
BOOL positioned, shouldResetPens;
}
@end
@interface SubRenderSpan : NSObject <NSCopying> {
id extra;
@public;
UniCharArrayOffset offset;
}
@property (retain) id extra;
@end
SubRGBAColor SubParseSSAColor(unsigned rgb);
SubRGBAColor SubParseSSAColorString(NSString *c);
UInt8 SubASSFromSSAAlignment(UInt8 a);
void SubParseASSAlignment(UInt8 a, UInt8 *alignH, UInt8 *alignV);
BOOL SubParseFontVerticality(NSString **fontname);
void SubParseSSAFile(NSString *ssa, NSDictionary **headers, NSArray **styles, NSArray **subs);
NSArray *SubParsePacket(NSString *packet, SubContext *context, SubRenderer *delegate);
__END_DECLS | {
"pile_set_name": "Github"
} |
x +y
| {
"pile_set_name": "Github"
} |
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var ResolverFactory = require("./ResolverFactory");
var assign = require("object-assign");
var NodeJsInputFileSystem = require("./NodeJsInputFileSystem");
var SyncNodeJsInputFileSystem = require("./SyncNodeJsInputFileSystem");
var CachedInputFileSystem = require("./CachedInputFileSystem");
var asyncFileSystem = new CachedInputFileSystem(new NodeJsInputFileSystem(), 4000);
var syncFileSystem = new CachedInputFileSystem(new SyncNodeJsInputFileSystem(), 4000);
var nodeContext = {
environments: [
"node+es3+es5+process+native"
]
};
var asyncResolver = ResolverFactory.createResolver({
extensions: [".js", ".json", ".node"],
fileSystem: asyncFileSystem
});
module.exports = function resolve(context, path, request, callback) {
if(typeof context === "string") {
callback = request;
request = path;
path = context;
context = nodeContext;
}
asyncResolver.resolve(context, path, request, callback);
};
var syncResolver = ResolverFactory.createResolver({
extensions: [".js", ".json", ".node"],
fileSystem: syncFileSystem
});
module.exports.sync = function resolveSync(context, path, request) {
if(typeof context === "string") {
request = path;
path = context;
context = nodeContext;
}
return syncResolver.resolveSync(context, path, request);
};
var asyncContextResolver = ResolverFactory.createResolver({
extensions: [".js", ".json", ".node"],
resolveToContext: true,
fileSystem: asyncFileSystem
});
module.exports.context = function resolveContext(context, path, request, callback) {
if(typeof context === "string") {
callback = request;
request = path;
path = context;
context = nodeContext;
}
asyncContextResolver.resolve(context, path, request, callback);
};
var syncContextResolver = ResolverFactory.createResolver({
extensions: [".js", ".json", ".node"],
resolveToContext: true,
fileSystem: syncFileSystem
});
module.exports.context.sync = function resolveContextSync(context, path, request) {
if(typeof context === "string") {
request = path;
path = context;
context = nodeContext;
}
return syncContextResolver.resolveSync(context, path, request);
};
var asyncLoaderResolver = ResolverFactory.createResolver({
extensions: [".js", ".json", ".node"],
moduleExtensions: ["-loader"],
mainFields: ["loader", "main"],
fileSystem: asyncFileSystem
});
module.exports.loader = function resolveLoader(context, path, request, callback) {
if(typeof context === "string") {
callback = request;
request = path;
path = context;
context = nodeContext;
}
asyncLoaderResolver.resolve(context, path, request, callback);
};
var syncLoaderResolver = ResolverFactory.createResolver({
extensions: [".js", ".json", ".node"],
moduleExtensions: ["-loader"],
mainFields: ["loader", "main"],
fileSystem: syncFileSystem
});
module.exports.loader.sync = function resolveLoaderSync(context, path, request) {
if(typeof context === "string") {
request = path;
path = context;
context = nodeContext;
}
return syncLoaderResolver.resolveSync(context, path, request);
};
module.exports.create = function create(options) {
options = assign({
fileSystem: asyncFileSystem
}, options);
var resolver = ResolverFactory.createResolver(options);
return function(context, path, request, callback) {
if(typeof context === "string") {
callback = request;
request = path;
path = context;
context = nodeContext;
}
resolver.resolve(context, path, request, callback);
};
};
module.exports.create.sync = function createSync(options) {
options = assign({
fileSystem: syncFileSystem
}, options);
var resolver = ResolverFactory.createResolver(options);
return function(context, path, request) {
if(typeof context === "string") {
request = path;
path = context;
context = nodeContext;
}
return resolver.resolveSync(context, path, request);
};
};
// Export Resolver, FileSystems and Plugins
module.exports.ResolverFactory = ResolverFactory;
module.exports.NodeJsInputFileSystem = NodeJsInputFileSystem;
module.exports.SyncNodeJsInputFileSystem = SyncNodeJsInputFileSystem;
module.exports.CachedInputFileSystem = CachedInputFileSystem;
| {
"pile_set_name": "Github"
} |
int y;
| {
"pile_set_name": "Github"
} |
{
"display": {
"icon": {
"item": "tfc:ore/garnierite"
},
"frame": "goal",
"title": {
"translate": "advancements.tfc.world.find_nickel.title"
},
"description": {
"translate": "advancements.tfc.world.find_nickel.description"
}
},
"parent": "tfc:world/make_propick",
"criteria": {
"find_ore": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "tfc:ore/garnierite"
}
]
}
}
},
"rewards": {
"experience": 25
}
} | {
"pile_set_name": "Github"
} |
/* Copyright (c) 2001 Matej Pfajfar.
* Copyright (c) 2001-2004, Roger Dingledine.
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
* Copyright (c) 2007-2019, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#ifndef OR_CONNECTION_ST_H
#define OR_CONNECTION_ST_H
#include "core/or/connection_st.h"
#include "lib/evloop/token_bucket.h"
struct tor_tls_t;
/** Subtype of connection_t for an "OR connection" -- that is, one that speaks
* cells over TLS. */
struct or_connection_t {
connection_t base_;
/** Hash of the public RSA key for the other side's identity key, or zeroes
* if the other side hasn't shown us a valid identity key. */
char identity_digest[DIGEST_LEN];
/** Extended ORPort connection identifier. */
char *ext_or_conn_id;
/** This is the ClientHash value we expect to receive from the
* client during the Extended ORPort authentication protocol. We
* compute it upon receiving the ClientNoce from the client, and we
* compare it with the acual ClientHash value sent by the
* client. */
char *ext_or_auth_correct_client_hash;
/** String carrying the name of the pluggable transport
* (e.g. "obfs2") that is obfuscating this connection. If no
* pluggable transports are used, it's NULL. */
char *ext_or_transport;
char *nickname; /**< Nickname of OR on other side (if any). */
struct tor_tls_t *tls; /**< TLS connection state. */
int tls_error; /**< Last tor_tls error code. */
/** When we last used this conn for any client traffic. If not
* recent, we can rate limit it further. */
/* Channel using this connection */
channel_tls_t *chan;
tor_addr_t real_addr; /**< The actual address that this connection came from
* or went to. The <b>addr</b> field is prone to
* getting overridden by the address from the router
* descriptor matching <b>identity_digest</b>. */
/** Should this connection be used for extending circuits to the server
* matching the <b>identity_digest</b> field? Set to true if we're pretty
* sure we aren't getting MITMed, either because we're connected to an
* address listed in a server descriptor, or because an authenticated
* NETINFO cell listed the address we're connected to as recognized. */
unsigned int is_canonical:1;
/** True iff this is an outgoing connection. */
unsigned int is_outgoing:1;
unsigned int proxy_type:2; /**< One of PROXY_NONE...PROXY_SOCKS5 */
unsigned int wide_circ_ids:1;
/** True iff this connection has had its bootstrap failure logged with
* control_event_bootstrap_problem. */
unsigned int have_noted_bootstrap_problem:1;
/** True iff this is a client connection and its address has been put in the
* geoip cache and handled by the DoS mitigation subsystem. We use this to
* insure we have a coherent count of concurrent connection. */
unsigned int tracked_for_dos_mitigation : 1;
uint16_t link_proto; /**< What protocol version are we using? 0 for
* "none negotiated yet." */
uint16_t idle_timeout; /**< How long can this connection sit with no
* circuits on it before we close it? Based on
* IDLE_CIRCUIT_TIMEOUT_{NON,}CANONICAL and
* on is_canonical, randomized. */
or_handshake_state_t *handshake_state; /**< If we are setting this connection
* up, state information to do so. */
time_t timestamp_lastempty; /**< When was the outbuf last completely empty?*/
token_bucket_rw_t bucket; /**< Used for rate limiting when the connection is
* in state CONN_OPEN. */
/*
* Count the number of bytes flushed out on this orconn, and the number of
* bytes TLS actually sent - used for overhead estimation for scheduling.
*/
uint64_t bytes_xmitted, bytes_xmitted_by_tls;
};
#endif
| {
"pile_set_name": "Github"
} |
/*
Copyright (C) 2013-2019 Draios Inc dba Sysdig.
This file is part of sysdig.
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 "container_engine/libvirt_lxc.h"
#include "sinsp.h"
using namespace libsinsp::container_engine;
bool libvirt_lxc::match(sinsp_threadinfo* tinfo, sinsp_container_info &container_info)
{
for(const auto& it : tinfo->m_cgroups)
{
//
// Non-systemd libvirt-lxc
//
const auto& cgroup = it.second;
size_t pos = cgroup.find(".libvirt-lxc");
if(pos != std::string::npos &&
pos == cgroup.length() - sizeof(".libvirt-lxc") + 1)
{
size_t pos2 = cgroup.find_last_of("/");
if(pos2 != std::string::npos)
{
container_info.m_type = CT_LIBVIRT_LXC;
container_info.m_id = cgroup.substr(pos2 + 1, pos - pos2 - 1);
return true;
}
}
//
// systemd libvirt-lxc
//
pos = cgroup.find("-lxc\\x2");
if(pos != std::string::npos)
{
size_t pos2 = cgroup.find(".scope");
if(pos2 != std::string::npos &&
pos2 == cgroup.length() - sizeof(".scope") + 1)
{
container_info.m_type = CT_LIBVIRT_LXC;
container_info.m_id = cgroup.substr(pos + sizeof("-lxc\\x2"), pos2 - pos - sizeof("-lxc\\x2"));
return true;
}
}
//
// Legacy libvirt-lxc
//
pos = cgroup.find("/libvirt/lxc/");
if(pos != std::string::npos)
{
container_info.m_type = CT_LIBVIRT_LXC;
container_info.m_id = cgroup.substr(pos + sizeof("/libvirt/lxc/") - 1);
return true;
}
}
return false;
}
bool libvirt_lxc::resolve(sinsp_threadinfo *tinfo, bool query_os_for_missing_info)
{
auto container = std::make_shared<sinsp_container_info>();
if (!match(tinfo, *container))
{
return false;
}
tinfo->m_container_id = container->m_id;
if(container_cache().should_lookup(container->m_id, CT_LIBVIRT_LXC))
{
container->m_name = container->m_id;
container_cache().add_container(container, tinfo);
container_cache().notify_new_container(*container);
}
return true;
}
| {
"pile_set_name": "Github"
} |
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// test sized operator delete[] replacement.
// Note that sized delete operator definitions below are simply ignored
// when sized deallocation is not supported, e.g., prior to C++14.
// UNSUPPORTED: c++14, c++17, c++2a
// UNSUPPORTED: sanitizer-new-delete
#include <new>
#include <cstddef>
#include <cstdlib>
#include <cassert>
#include "test_macros.h"
int unsized_delete_called = 0;
int unsized_delete_nothrow_called = 0;
int sized_delete_called = 0;
void operator delete[](void* p) TEST_NOEXCEPT
{
++unsized_delete_called;
std::free(p);
}
void operator delete[](void* p, const std::nothrow_t&) TEST_NOEXCEPT
{
++unsized_delete_nothrow_called;
std::free(p);
}
void operator delete[](void* p, std::size_t) TEST_NOEXCEPT
{
++sized_delete_called;
std::free(p);
}
// NOTE: Use a class with a non-trivial destructor as the test type in order
// to ensure the correct overload is called.
// C++14 5.3.5 [expr.delete]p10
// - If the type is complete and if, for the second alternative (delete array)
// only, the operand is a pointer to a class type with a non-trivial
// destructor or a (possibly multi-dimensional) array thereof, the function
// with two parameters is selected.
// - Otherwise, it is unspecified which of the two deallocation functions is
// selected.
struct A { ~A() {} };
int main(int, char**)
{
A* x = new A[3];
assert(0 == unsized_delete_called);
assert(0 == unsized_delete_nothrow_called);
assert(0 == sized_delete_called);
delete [] x;
assert(1 == unsized_delete_called);
assert(0 == sized_delete_called);
assert(0 == unsized_delete_nothrow_called);
return 0;
}
| {
"pile_set_name": "Github"
} |
Shalom!
In this three-part series we will
study things you can do in GCC –
to add parallelism to your programs.
Now there are different definitions,
but when I say parallelism,
I mean your program does more
than one thing at once.
And I don’t mean that it appears
to do many things at once,
I mean it literally does
many things simultaneously.
The plot device for this study
is a Mandelbrot fractal renderer.
This function is the core of the
fractal calculation.
Just to make it a bit more efficient
than your first tutorial program,
I added three simple optimizations.
Namely, periodicity checking,
which checks whether the value –
has been already seen earlier
at one of predefined moments.
And some reformulations to
minimize the number of branches
the processor must execute,
which will be very important later.
And finally this crazy formula
which checks whether z belongs
inside the main cardioid or
the largest sphere attached to it.
You can learn more about the fractal
in Wikipedia if you are interested.
For this video I just needed
a calculation-heavy task,
and the fractal was the only reasonable
thing that came to my mind
despite a year or so of deliberation.
For reasons that will become evident later,
this fractal renderer uses a homebrew
logarithm function.
If you have ever wondered
how the computer –
actually computes
these scientific functions,
well here you can see an example.
The algorithm comes from
the Cephes math library,
just simplified a bit so it doesn’t
deal with tricky corner cases.
The bulk of the work is done by
reading the exponent field directly –
from inside the float value, using
bitmasks and bitshifts,
and then the rest is approximated
with a taylor series.
You can learn more about
this, too, in Wikipedia.
Just look up Taylor series.
Now, in the upper right corner
you can see –
how the output of this program
will look.
You can either follow along
as I write the rest of the main program,
or you can marvel the beautiful fractal,
or you can just skip forward
to until about 2 minutes and 52 seconds,
when interesting things start happening.
In the main loop we go through
the pixels of the image,
converting X and Y coordinates
into complex coordinates.
Each complex coordinate will
be run through the iteration loop,
and the result will be converted into a color.
This color will be rendered as a pixel.
The complex coordinates are changed each frame.
As yet another optimization,
the periodicity checking
is dynamically enabled or disabled.
A template parameter controls whether
the checks are compiled in.
Periodicity checking is enabled
if at least one pixel in thousand
were inside the set,
and disabled otherwise.
And now.
This graph shows the performance
of this “vanilla” program.
Some parts of the process were
faster, and some were slower.
It begins rendering at 1 s/frame,
and ends at 40 s/frame.
We have already done several improvements
to the rendering algorithm.
Perhaps in reality there is still more
that could be done,
but for the sake of getting
finally into actual topic,
let’s imagine we’ve done already
every possible algorithm improvement,
turning all the N²‘s
into N log N‘s and so on.
How can we still make the program faster?
Let’s understand how modern computers work.
Suppose you have two arrays of integers
that you add together.
The integers are 32-bit.
You have a modern PC. What do you do?
The trivial answer is shown on the screen.
Some programmers might be
inclined to use a loop,
but unrolling the code works
better for this lesson.
You do not need to know any assembler
to understand this.
We have sixteen integers in one array,
and sixteen integers in another array.
These arrays are added together.
So, we have sixteen load operations,
and sixteen add operations.
As an optimization, the add operation
also stores the result.
A total of 32 instructions
are executed on the CPU.
But the PC can do much better.
Since 1997, there have been
instructions that can do
two 32-bit add-operations at once.
My computer can do it. Your computer can do it.
Everyone’s computer can do it.
This is called SIMD.
Single instruction, multiple data.
With these MMX SIMD instructions
you only need 24 instructions
to add these two arrays.
But the PC can do even better.
Pentium 4 introduced the SSE2
instruction set over 15 years ago.
With these instructions it is possible
to perform four 32-bit additions
with a single operation.
But the PC can do better.
Advanced Vector Extensions.
My computer has it,
and with this architecture,
you only need six instructions,
total, to load sixteen integers,
add them with another
sixteen integers,
and store the results
into sixteen integers.
But… it still doesn’t end here.
A CPU that has AVX-512 can do
the whole thing with just three
instructions.
A ten-fold speedup –
compared to the traditional way
faintly seen on the background!
So, how do we tap this immense power
from within a C++ compiler?
Oh yes, we can.
The answer is: Arrays.
Make everything an array!
Vector. They are called vectors,
even though they are really arrays.
When we speak to the compiler,
we say “array”,
and when we speak to a scientist,
we say “vector”.
To process things in parallel,
we must have things to process in parallel.
Let’s begin with a humble improvement.
Attempt to process eight pixels
simultaneously with vectors.
The basic idea is this:
For every single calculation,
do it to all values in an array
instead of to just one value.
Compilers today are smart enough –
that they automatically convert
these array operations into –
those extremely efficient
vector instructions –
that we saw earlier.
You just need to give them a chance.
Well, reputable compilers.
I would not trust Microsoft
Visual Studio to do it,
but at least GCC and Clang
are pretty good at it,
and they are getting
better and better –
at every release.
Intel’s compiler studio
is also very powerful,
but over the past years, they have
transformed it into encumberware,
making it extremely difficult to
acquire and install a free copy,
so I cannot test it.
Now SIMD has some limitations.
Because it literally means applying
the same instruction to multiple data,
You cannot vectorize different functions,
or code that is full of if-elses.
You can only vectorize operations
that are identical across all data.
All data items must be subject
to exactly same processing.
It is possible to do conditional
processing within SIMD,
but it requires some tricks.
For instance, Mandelbrot fractal
calculation involves loops –
that run a different number of
iterations depending on situation.
For each pixel, a different and
unpredictable number of loops is run.
In this simplified example,
76 loops are needed to render 32 columns.
You can vectorize these
different columns, of course.
For example, four columns
could be calculated simultaneously.
Does this mean a four-fold speedup?
No, unfortunately it does not.
Remember, all data within the same
vector must be subject to the same treatment.
This also means the same number of loops!
In reality, it would look like this.
Three loops are performed on
each column in the first vector,
five loops for each column
in the second vector, and so on.
Now, even though the number of loops
must be the same for all items in the vector,
it is possible to write code so that –
only particular elements
in the vector are affected.
As a result, we get something
like a 2.5 fold speedup –
compared to processing
each column separately.
The bottom line is:
performance does not necessarily increase
at the same rate as the vector size does.
It may not even increase at all.
It really depends on the data.
Let’s have a look at the actual benchmark now.
Ah, yes. It is clearly faster now.
Whoa! What was that??
Suddenly it became as slow
as the non-vectorized version.
And now it’s back–
Whoa! Again!
What just happened?
In the end, it is twice as fast
as the previous version,
but these sudden jumps were strange.
Let’s take a look at the code.
This is the iterate function.
Ah yes, see, here!
These are the SIMD instructions.
Beauty.
It is delightful to look at code
that accomplishes stuff.
But wait, what is this?
These are not vectorized,
even though they should.
The compiler failed
to optimize them properly.
Is there a way we can force
the compiler to generate SIMD code
even when it thinks it
might not be a good idea?
Glad you asked!
In fact, there is a very simple way.
OpenMP is a cross-vendor extension
that defines ‘pragmas’ –
that control how the compiler
generates code.
We can pepper the code with a few
strategically placed #pragma omp simd –
which essentially say to the compiler:
“Try harder”.
The performance of the program is virtually
identical to the previous version,
except the weird underperformance
hickups of the implicit-simd version –
no longer exist.
The program is almost perfectly
twice as fast as the initial version.
Intel CilkPlus is another
extension supported by GCC,
that also provides pragmas that
tell the compiler to try harder.
We will look into CilkPlus
in more detail in the next episode,
but to utilize CilkPlus
SIMD directives,
this was all that you need to know.
The performance is exactly same
as with OpenMP, which makes sense:
it is still the same compiler,
just commanded in a different language.
Now there is still one
avenue I haven’t tested.
Using Intel intrinsics.
Intel intrinsics are…
a bit different.
You are confused.
Let me explain why.
See this code on the screen?
This is how the code becomes
with Intel intrinsics.
I am not kidding.
Here is how the whole program
looks with intrinsics.
This code combines the worst
sides of C and assembler.
It must be written with a specific
processor architecture in mind,
and it will neither compile nor run –
on anything other than that architecture.
And here’s how it runs on my computer.
Across the board it is about
3× faster than anything else so far.
Curiously, the parts where periodicity
checking is disabled,
i.e. the parts that were exceptionally
slow in the implicit-simd version –
are exceptionally fast in this version.
Conclusion:
Modern microprocessors
are very powerful,
and modern compilers
are really smart.
But the common wisdom,
that you should not try
to outsmart your compiler,
because allegedly chances
are that it knows –
a whole lot more about
optimization than you do,
well, I think I just proved
that to be hogwash.
We made the program
three times faster –
without adding threads and
without changing the algorithm,
simply by doing
the compiler’s job, but better.
I am Bisqwit.
The next time we will see what happens –
when we bring threads into the mix.
And, how to do threads in GCC.
There are surprisingly many ways!
Have a very nice day,
see you soon again.
| {
"pile_set_name": "Github"
} |
style "default" {
xthickness = 1
ythickness = 1
# Style Properties
GtkWidget::focus-line-width = 1
GtkMenuBar::window-dragging = 1
GtkToolbar::window-dragging = 1
GtkToolbar::internal-padding = 4
GtkToolButton::icon-spacing = 4
GtkWidget::tooltip-radius = 2
GtkWidget::tooltip-alpha = 235
GtkWidget::new-tooltip-style = 1 #for compatibility
GtkSeparatorMenuItem::horizontal-padding = 3
GtkSeparatorMenuItem::wide-separators = 1
GtkSeparatorMenuItem::separator-height = 1
GtkButton::child-displacement-y = 0
GtkButton::default-border = { 0, 0, 0, 0 }
GtkButton::default-outside_border = { 0, 0, 0, 0 }
GtkEntry::state-hint = 1
GtkScrollbar::trough-border = 0
GtkRange::trough-border = 0
GtkRange::slider-width = 13
GtkRange::stepper-size = 0
GtkScrollbar::activate-slider = 1
GtkScrollbar::has-backward-stepper = 0
GtkScrollbar::has-forward-stepper = 0
GtkScrollbar::min-slider-length = 32
GtkScrolledWindow::scrollbar-spacing = 0
GtkScrolledWindow::scrollbars-within-bevel = 1
GtkScale::slider_length = 15
GtkScale::slider_width = 15
GtkScale::trough-side-details = 1
GtkProgressBar::min-horizontal-bar-height = 8
GtkProgressBar::min-vertical-bar-width = 8
GtkStatusbar::shadow_type = GTK_SHADOW_NONE
GtkSpinButton::shadow_type = GTK_SHADOW_NONE
GtkMenuBar::shadow-type = GTK_SHADOW_NONE
GtkToolbar::shadow-type = GTK_SHADOW_NONE
GtkMenuBar::internal-padding = 0 #( every window is misaligned for the sake of menus ):
GtkMenu::horizontal-padding = 0
GtkMenu::vertical-padding = 0
GtkCheckButton::indicator_spacing = 3
GtkOptionMenu::indicator_spacing = { 8, 2, 0, 0 }
GtkTreeView::row_ending_details = 0
GtkTreeView::expander-size = 11
GtkTreeView::vertical-separator = 4
GtkTreeView::horizontal-separator = 4
GtkTreeView::allow-rules = 1
GtkTreeView::odd_row_color = shade(0.98, @base_color)
GtkExpander::expander-size = 11
GnomeHRef::link_color = @link_color
GtkHTML::link-color = @link_color
GtkIMHtmlr::hyperlink-color = @link_color
GtkIMHtml::hyperlink-color = @link_color
GtkWidget::link-color = @link_color
GtkWidget::visited-link-color = @text_color
# Colors
bg[NORMAL] = @bg_color
bg[PRELIGHT] = shade (1.02, @bg_color)
bg[SELECTED] = @selected_bg_color
bg[INSENSITIVE] = @insensitive_bg_color
bg[ACTIVE] = shade (0.9, @bg_color)
fg[NORMAL] = @text_color
fg[PRELIGHT] = @fg_color
fg[SELECTED] = @selected_fg_color
fg[INSENSITIVE] = @insensitive_fg_color
fg[ACTIVE] = @fg_color
text[NORMAL] = @text_color
text[PRELIGHT] = @text_color
text[SELECTED] = @selected_fg_color
text[INSENSITIVE] = @insensitive_fg_color
text[ACTIVE] = @selected_fg_color
base[NORMAL] = @base_color
base[PRELIGHT] = shade (0.95, @bg_color)
base[SELECTED] = @selected_bg_color
base[INSENSITIVE] = @bg_color
base[ACTIVE] = shade (0.9, @selected_bg_color)
# For succinctness, all reasonable pixmap options remain here
engine "pixmap" {
# Check Buttons
image {
function = CHECK
recolorable = TRUE
state = NORMAL
shadow = OUT
overlay_file = "assets/checkbox-unchecked.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = PRELIGHT
shadow = OUT
overlay_file = "assets/checkbox-unchecked.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = ACTIVE
shadow = OUT
overlay_file = "assets/checkbox-unchecked.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = SELECTED
shadow = OUT
overlay_file = "assets/checkbox-unchecked.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = INSENSITIVE
shadow = OUT
overlay_file = "assets/checkbox-unchecked-insensitive.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = NORMAL
shadow = IN
overlay_file = "assets/checkbox-checked.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = PRELIGHT
shadow = IN
overlay_file = "assets/checkbox-checked.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = ACTIVE
shadow = IN
overlay_file = "assets/checkbox-checked.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = SELECTED
shadow = IN
overlay_file = "assets/checkbox-checked.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = INSENSITIVE
shadow = IN
overlay_file = "assets/checkbox-checked-insensitive.png"
overlay_stretch = FALSE
}
# Radio Buttons
image {
function = OPTION
state = NORMAL
shadow = OUT
overlay_file = "assets/radio-unchecked.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = PRELIGHT
shadow = OUT
overlay_file = "assets/radio-unchecked.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = ACTIVE
shadow = OUT
overlay_file = "assets/radio-unchecked.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = SELECTED
shadow = OUT
overlay_file = "assets/radio-unchecked.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = INSENSITIVE
shadow = OUT
overlay_file = "assets/radio-unchecked-insensitive.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = NORMAL
shadow = IN
overlay_file = "assets/radio-checked.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = PRELIGHT
shadow = IN
overlay_file = "assets/radio-checked.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = ACTIVE
shadow = IN
overlay_file = "assets/radio-checked.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = SELECTED
shadow = IN
overlay_file = "assets/radio-checked.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = INSENSITIVE
shadow = IN
overlay_file = "assets/radio-checked-insensitive.png"
overlay_stretch = FALSE
}
# Arrows
image {
function = ARROW
overlay_file = "assets/arrow-up.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = UP
}
image {
function = ARROW
state = PRELIGHT
overlay_file = "assets/arrow-up-prelight.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = UP
}
image {
function = ARROW
state = ACTIVE
overlay_file = "assets/arrow-up-prelight.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = UP
}
image {
function = ARROW
state = INSENSITIVE
overlay_file = "assets/arrow-up-insens.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = UP
}
image {
function = ARROW
state = NORMAL
overlay_file = "assets/arrow-down.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = DOWN
}
image {
function = ARROW
state = PRELIGHT
overlay_file = "assets/arrow-down-prelight.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = DOWN
}
image {
function = ARROW
state = ACTIVE
overlay_file = "assets/arrow-down-prelight.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = DOWN
}
image {
function = ARROW
state = INSENSITIVE
overlay_file = "assets/arrow-down-insens.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = DOWN
}
image {
function = ARROW
overlay_file = "assets/arrow-left.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = LEFT
}
image {
function = ARROW
state= PRELIGHT
overlay_file = "assets/arrow-left-prelight.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = LEFT
}
image {
function = ARROW
state = ACTIVE
overlay_file = "assets/arrow-left-prelight.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = LEFT
}
image {
function = ARROW
state = INSENSITIVE
overlay_file = "assets/arrow-left-insens.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = LEFT
}
image {
function = ARROW
overlay_file = "assets/arrow-right.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = RIGHT
}
image {
function = ARROW
state = PRELIGHT
overlay_file = "assets/arrow-right-prelight.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = RIGHT
}
image {
function = ARROW
state = ACTIVE
overlay_file = "assets/arrow-right-prelight.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = RIGHT
}
image {
function = ARROW
state = INSENSITIVE
overlay_file = "assets/arrow-right-insens.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = RIGHT
}
# Option Menu Arrows
image {
function = TAB
state = INSENSITIVE
overlay_file = "assets/arrow-down-insens.png"
overlay_stretch = FALSE
}
image {
function = TAB
state = NORMAL
overlay_file = "assets/arrow-down.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
}
image {
function = TAB
state = PRELIGHT
overlay_file = "assets/arrow-down-prelight.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
}
# Lines
image {
function = VLINE
file = "assets/line-v.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
}
image {
function = HLINE
file = "assets/line-h.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
}
# Focuslines
image {
function = FOCUS
file = "assets/focus-line.png"
border = { 1, 1, 1, 1 }
stretch = TRUE
}
# Handles
image {
function = HANDLE
overlay_file = "assets/handle-h.png"
overlay_stretch = FALSE
orientation = HORIZONTAL
}
image {
function = HANDLE
overlay_file = "assets/handle-v.png"
overlay_stretch = FALSE
orientation = VERTICAL
}
# Expanders
image {
function = EXPANDER
expander_style = COLLAPSED
file = "assets/plus.png"
}
image {
function = EXPANDER
expander_style = EXPANDED
file = "assets/minus.png"
}
image {
function = EXPANDER
expander_style = SEMI_EXPANDED
file = "assets/minus.png"
}
image {
function = EXPANDER
expander_style = SEMI_COLLAPSED
file = "assets/plus.png"
}
image {
function = RESIZE_GRIP
state = NORMAL
detail = "statusbar"
overlay_file = "assets/null.png"
overlay_border = { 0,0,0,0 }
overlay_stretch = FALSE
}
# Shadows ( this area needs help :P )
image {
function = SHADOW_GAP
file = "assets/null.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
}
}
}
style "toplevel_hack" {
engine "adwaita" {
}
}
style "ooo_stepper_hack" {
GtkScrollbar::stepper-size = 0
GtkScrollbar::has-backward-stepper = 0
GtkScrollbar::has-forward-stepper = 0
}
style "scrollbar" {
engine "pixmap" {
image {
function = BOX
detail = "trough"
file = "assets/trough-scrollbar-horiz.png"
border = { 2, 2, 3, 3 }
stretch = TRUE
orientation = HORIZONTAL
}
image {
function = BOX
detail = "trough"
file = "assets/trough-scrollbar-vert.png"
border = { 3, 3, 2, 2 }
stretch = TRUE
orientation = VERTICAL
}
image {
function = ARROW
overlay_file = "assets/null.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = UP
}
image {
function = ARROW
overlay_file = "assets/null.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = DOWN
}
image {
function = ARROW
overlay_file = "assets/null.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = LEFT
}
image {
function = ARROW
overlay_file = "assets/null.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = RIGHT
}
# Sliders
image {
function = SLIDER
state = NORMAL
file = "assets/slider-horiz.png"
border = { 5, 5, 3, 3 }
stretch = TRUE
orientation = HORIZONTAL
}
image {
function = SLIDER
state = ACTIVE
file = "assets/slider-horiz-active.png"
border = { 5, 5, 3, 3 }
stretch = TRUE
orientation = HORIZONTAL
}
image {
function = SLIDER
state = PRELIGHT
file = "assets/slider-horiz-prelight.png"
border = { 5, 5, 3, 3 }
stretch = TRUE
orientation = HORIZONTAL
}
image {
function = SLIDER
state = INSENSITIVE
file = "assets/slider-horiz-insens.png"
border = { 5, 5, 3, 3 }
stretch = TRUE
orientation = HORIZONTAL
}
# X Verticals
image {
function = SLIDER
state = NORMAL
file = "assets/slider-vert.png"
border = { 3, 3, 5, 5 }
stretch = TRUE
orientation = VERTICAL
}
image {
function = SLIDER
state = ACTIVE
file = "assets/slider-vert-active.png"
border = { 3, 3, 5, 5 }
stretch = TRUE
orientation = VERTICAL
}
image {
function = SLIDER
state = PRELIGHT
file = "assets/slider-vert-prelight.png"
border = { 3, 3, 5, 5 }
stretch = TRUE
orientation = VERTICAL
}
image {
function = SLIDER
state = INSENSITIVE
file = "assets/slider-vert-insens.png"
border = { 3, 3, 5, 5 }
stretch = TRUE
orientation = VERTICAL
}
}
}
style "menu" {
xthickness = 0
ythickness = 0
GtkMenuItem::arrow-scaling = 0.4
bg[NORMAL] = @menu_bg
bg[INSENSITIVE] = @menu_bg
bg[PRELIGHT] = @menu_bg
engine "pixmap" { # For menus that use horizontal lines rather than gtkseparator
image {
function = HLINE
file = "assets/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
}
}
}
style "menu_framed_box" {
engine "adwaita" {
}
}
style "menu_item"
{
xthickness = 2
ythickness = 5
# HACK: Gtk doesn't actually read this value
# while rendering the menu items, but Libreoffice
# does; setting this value equal to the one in
# fg[PRELIGHT] ensures a code path in the LO theming code
# that falls back to a dark text color for menu item text
# highlight. The price to pay is black text on menus as well,
# but at least it's readable.
# See https://bugs.freedesktop.org/show_bug.cgi?id=38038
bg[SELECTED] = @selected_fg_color
fg[NORMAL] = @fg_color
fg[SELECTED] = @selected_fg_color
fg[PRELIGHT] = @selected_fg_color
text[PRELIGHT] = @selected_fg_color
engine "pixmap" {
image {
function = BOX
state = PRELIGHT
file = "assets/menuitem.png"
border = { 1, 0, 1, 0 }
stretch = TRUE
}
# Fix invisible scale trough on selected menuitems
image {
function = BOX
detail = "trough-lower"
file = "assets/trough-horizontal.png"
border = { 8, 8, 0, 0 }
stretch = TRUE
orientation = HORIZONTAL
}
image {
function = SLIDER
state = PRELIGHT
file = "assets/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "assets/slider.png"
overlay_stretch = FALSE
orientation = HORIZONTAL
}
# Check Buttons
image {
function = CHECK
recolorable = TRUE
state = NORMAL
shadow = OUT
overlay_file = "assets/menu-checkbox-unchecked.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = PRELIGHT
shadow = OUT
overlay_file = "assets/menu-checkbox-unchecked-selected.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = ACTIVE
shadow = OUT
overlay_file = "assets/menu-checkbox-unchecked.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = INSENSITIVE
shadow = OUT
overlay_file = "assets/menu-checkbox-unchecked-insensitive.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = NORMAL
shadow = IN
overlay_file = "assets/menu-checkbox-checked.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = PRELIGHT
shadow = IN
overlay_file = "assets/menu-checkbox-checked-selected.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = ACTIVE
shadow = IN
overlay_file = "assets/menu-checkbox-checked.png"
overlay_stretch = FALSE
}
image {
function = CHECK
recolorable = TRUE
state = INSENSITIVE
shadow = IN
overlay_file = "assets/menu-checkbox-checked-insensitive.png"
overlay_stretch = FALSE
}
# Radio Buttons
image {
function = OPTION
state = NORMAL
shadow = OUT
overlay_file = "assets/menu-radio-unchecked.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = PRELIGHT
shadow = OUT
overlay_file = "assets/menu-radio-unchecked-selected.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = ACTIVE
shadow = OUT
overlay_file = "assets/menu-radio-unchecked.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = INSENSITIVE
shadow = OUT
overlay_file = "assets/menu-radio-unchecked-insensitive.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = NORMAL
shadow = IN
overlay_file = "assets/menu-radio-checked.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = PRELIGHT
shadow = IN
overlay_file = "assets/menu-radio-checked-selected.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = ACTIVE
shadow = IN
overlay_file = "assets/menu-radio-checked.png"
overlay_stretch = FALSE
}
image {
function = OPTION
state = INSENSITIVE
shadow = IN
overlay_file = "assets/menu-radio-checked-insensitive.png"
overlay_stretch = FALSE
}
image {
function = SHADOW # This fixes boxy Qt menu items
file = "assets/null.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
}
# Arrow Buttons
image {
function = ARROW
state = NORMAL
overlay_file = "assets/menu-arrow.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = RIGHT
}
image {
function = ARROW
state = PRELIGHT
overlay_file = "assets/menu-arrow-prelight.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = RIGHT
}
}
}
style "button" {
xthickness = 4
ythickness = 4
engine "pixmap" {
image {
function = BOX
state = NORMAL
file = "assets/button.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
}
image {
function = BOX
state = PRELIGHT
file = "assets/button-hover.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
}
image {
function = BOX
state = ACTIVE
file = "assets/button-active.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
}
image {
function = BOX
state = INSENSITIVE
file = "assets/button-insensitive.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
}
}
}
style "checkbutton" {
fg[PRELIGHT] = @text_color
fg[ACTIVE] = @text_color
}
style "entry" {
xthickness = 6
ythickness = 4
engine "pixmap" {
image {
function = SHADOW
state = NORMAL
detail = "entry"
file = "assets/entry-bg.png"
border = {6, 6, 6, 6}
stretch = TRUE
}
image {
function = SHADOW
state = ACTIVE
detail = "entry"
file = "assets/entry-active-bg.png"
border = {6, 6, 6, 6}
stretch = TRUE
}
image {
function = SHADOW
state = INSENSITIVE
detail = "entry"
file = "assets/entry-disabled-bg.png"
border = {6, 6, 6, 6}
stretch = TRUE
}
image {
function = FLAT_BOX
state = ACTIVE
detail = "entry_bg"
file = "assets/entry-background.png"
}
image {
function = FLAT_BOX
state = INSENSITIVE
detail = "entry_bg"
file = "assets/entry-background-disabled.png"
}
image {
function = FLAT_BOX
detail = "entry_bg"
file = "assets/entry-background.png"
}
}
}
style "notebook_entry" {
engine "pixmap" {
image {
function = SHADOW
state = NORMAL
detail = "entry"
file = "assets/entry-notebook.png"
border = {6, 6, 6, 6}
stretch = TRUE
}
image {
function = SHADOW
state = ACTIVE
detail = "entry"
file = "assets/entry-active-notebook.png"
border = {6, 6, 6, 6}
stretch = TRUE
}
image {
function = SHADOW
state = INSENSITIVE
detail = "entry"
file = "assets/entry-disabled-notebook.png"
border = {6, 6, 6, 6}
stretch = TRUE
}
}
}
style "notebook_tab_label" {
fg[ACTIVE] = @text_color
}
style "combobox_entry"
{
xthickness = 3
ythickness = 4
engine "pixmap" {
# LTR version
image {
function = SHADOW
detail = "entry"
state = NORMAL
shadow = IN
file = "assets/combo-entry.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = LTR
}
image {
function = SHADOW
detail = "entry"
state = INSENSITIVE
shadow = IN
file = "assets/combo-entry-insensitive.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = LTR
}
image {
function = SHADOW
detail = "entry"
state = ACTIVE
file = "assets/combo-entry-focus.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = LTR
}
# RTL version
image {
function = SHADOW
detail = "entry"
state = NORMAL
shadow = IN
file = "assets/combo-entry-rtl.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = RTL
}
image {
function = SHADOW
detail = "entry"
state = INSENSITIVE
shadow = IN
file = "assets/combo-entry-insensitive-rtl.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = RTL
}
image {
function = SHADOW
detail = "entry"
state = ACTIVE
file = "assets/combo-entry-focus-rtl.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = RTL
}
}
}
style "notebook_combobox_entry" {
engine "pixmap" {
# LTR version
image {
function = SHADOW
detail = "entry"
state = NORMAL
shadow = IN
file = "assets/combo-entry-notebook.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = LTR
}
image {
function = SHADOW
detail = "entry"
state = INSENSITIVE
shadow = IN
file = "assets/combo-entry-insensitive-notebook.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = LTR
}
image {
function = SHADOW
detail = "entry"
state = ACTIVE
file = "assets/combo-entry-focus-notebook.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = LTR
}
# RTL version
image {
function = SHADOW
detail = "entry"
state = NORMAL
shadow = IN
file = "assets/combo-entry-notebook-rtl.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = RTL
}
image {
function = SHADOW
detail = "entry"
state = INSENSITIVE
shadow = IN
file = "assets/combo-entry-insensitive-notebook-rtl.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = RTL
}
image {
function = SHADOW
detail = "entry"
state = ACTIVE
file = "assets/combo-entry-focus-notebook-rtl.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = RTL
}
}
}
style "combobox_entry_button"
{
xthickness = 6
fg[ACTIVE] = @text_color
engine "pixmap" {
# LTR version
image {
function = BOX
state = NORMAL
file = "assets/combo-entry-button.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = LTR
}
image {
function = BOX
state = PRELIGHT
file = "assets/combo-entry-button.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = LTR
}
image {
function = BOX
state = INSENSITIVE
file = "assets/combo-entry-button-insensitive.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = LTR
}
image {
function = BOX
state = ACTIVE
file = "assets/combo-entry-button-active.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = LTR
}
# RTL version
image {
function = BOX
state = NORMAL
file = "assets/combo-entry-button-rtl.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = RTL
}
image {
function = BOX
state = PRELIGHT
file = "assets/combo-entry-button-rtl.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = RTL
}
image {
function = BOX
state = INSENSITIVE
file = "assets/combo-entry-button-insensitive-rtl.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = RTL
}
image {
function = BOX
state = ACTIVE
file = "assets/combo-entry-button-active-rtl.png"
border = { 4, 4, 5, 4 }
stretch = TRUE
direction = RTL
}
}
}
style "spinbutton" {
bg[NORMAL] = @bg_color
xthickness = 6
ythickness = 4
engine "pixmap" {
image {
function = ARROW
}
# Spin-Up LTR
image {
function = BOX
state = NORMAL
detail = "spinbutton_up"
file = "assets/up-background.png"
border = { 1, 4, 5, 0 }
stretch = TRUE
overlay_file = "assets/arrow-up-small.png"
overlay_stretch = FALSE
direction = LTR
}
image {
function = BOX
state = PRELIGHT
detail = "spinbutton_up"
file = "assets/up-background.png"
border = { 1, 4, 5, 0 }
stretch = TRUE
overlay_file = "assets/arrow-up-small-prelight.png"
overlay_stretch = FALSE
direction = LTR
}
image {
function = BOX
state = INSENSITIVE
detail = "spinbutton_up"
file = "assets/up-background-disable.png"
border = { 1, 4, 5, 0 }
stretch = TRUE
overlay_file = "assets/arrow-up-small-insens.png"
overlay_stretch = FALSE
direction = LTR
}
image {
function = BOX
state = ACTIVE
detail = "spinbutton_up"
file = "assets/up-background.png"
border = { 1, 4, 5, 0 }
stretch = TRUE
overlay_file = "assets/arrow-up-small-prelight.png"
overlay_stretch = FALSE
direction = LTR
}
# Spin-Up RTL
image {
function = BOX
state = NORMAL
detail = "spinbutton_up"
file = "assets/up-background-rtl.png"
border = { 4, 1, 5, 0 }
stretch = TRUE
overlay_file = "assets/arrow-up-small.png"
overlay_stretch = FALSE
direction = RTL
}
image {
function = BOX
state = PRELIGHT
detail = "spinbutton_up"
file = "assets/up-background-rtl.png"
border = { 4, 1, 5, 0 }
stretch = TRUE
overlay_file = "assets/arrow-up-small-prelight.png"
overlay_stretch = FALSE
direction = RTL
}
image {
function = BOX
state = INSENSITIVE
detail = "spinbutton_up"
file = "assets/up-background-disable-rtl.png"
border = { 4, 1, 5, 0 }
stretch = TRUE
overlay_file = "assets/arrow-up-small-insens.png"
overlay_stretch = FALSE
direction = RTL
}
image {
function = BOX
state = ACTIVE
detail = "spinbutton_up"
file = "assets/up-background-rtl.png"
border = { 4, 1, 5, 0 }
stretch = TRUE
overlay_file = "assets/arrow-up-small-prelight.png"
overlay_stretch = FALSE
direction = RTL
}
# Spin-Down LTR
image {
function = BOX
state = NORMAL
detail = "spinbutton_down"
file = "assets/down-background.png"
border = { 1, 4, 1, 4 }
stretch = TRUE
overlay_file = "assets/arrow-down-small.png"
overlay_stretch = FALSE
direction = LTR
}
image {
function = BOX
state = PRELIGHT
detail = "spinbutton_down"
file = "assets/down-background.png"
border = { 1, 4, 1, 4 }
stretch = TRUE
overlay_file = "assets/arrow-down-small-prelight.png"
overlay_stretch = FALSE
direction = LTR
}
image {
function = BOX
state = INSENSITIVE
detail = "spinbutton_down"
file = "assets/down-background-disable.png"
border = { 1, 4, 1, 4 }
stretch = TRUE
overlay_file = "assets/arrow-down-small-insens.png"
overlay_stretch = FALSE
direction = LTR
}
image {
function = BOX
state = ACTIVE
detail = "spinbutton_down"
file = "assets/down-background.png"
border = { 1, 4, 1, 4 }
stretch = TRUE
overlay_file = "assets/arrow-down-small-prelight.png"
overlay_stretch = FALSE
direction = LTR
}
# Spin-Down RTL
image {
function = BOX
state = NORMAL
detail = "spinbutton_down"
file = "assets/down-background-rtl.png"
border = { 4, 1, 1, 4 }
stretch = TRUE
overlay_file = "assets/arrow-down-small.png"
overlay_stretch = FALSE
direction = RTL
}
image {
function = BOX
state = PRELIGHT
detail = "spinbutton_down"
file = "assets/down-background-rtl.png"
border = { 4, 1, 1, 4 }
stretch = TRUE
overlay_file = "assets/arrow-down-small-prelight.png"
overlay_stretch = FALSE
direction = RTL
}
image {
function = BOX
state = INSENSITIVE
detail = "spinbutton_down"
file = "assets/down-background-disable-rtl.png"
border = { 4, 1, 1, 4 }
stretch = TRUE
overlay_file = "assets/arrow-down-small-insens.png"
overlay_stretch = FALSE
direction = RTL
}
image {
function = BOX
state = ACTIVE
detail = "spinbutton_down"
file = "assets/down-background-rtl.png"
border = { 4, 1, 1, 4 }
stretch = TRUE
overlay_file = "assets/arrow-down-small-prelight.png"
overlay_stretch = FALSE
direction = RTL
}
}
}
style "gimp_spin_scale" {
bg[NORMAL] = @base_color
engine "pixmap" {
image {
function = FLAT_BOX
detail = "entry_bg"
state = NORMAL
}
image {
function = FLAT_BOX
detail = "entry_bg"
state = ACTIVE
}
image {
function = BOX
state = NORMAL
detail = "spinbutton_up"
overlay_file = "assets/arrow-up-small.png"
overlay_stretch = FALSE
}
image {
function = BOX
state = PRELIGHT
detail = "spinbutton_up"
overlay_file = "assets/arrow-up-small-prelight.png"
overlay_stretch = FALSE
}
image {
function = BOX
state = ACTIVE
detail = "spinbutton_up"
overlay_file = "assets/arrow-up-small-prelight.png"
overlay_stretch = FALSE
}
image {
function = BOX
state = INSENSITIVE
detail = "spinbutton_up"
overlay_file = "assets/arrow-up-small-insens.png"
overlay_stretch = FALSE
}
image {
function = BOX
state = NORMAL
detail = "spinbutton_down"
overlay_file = "assets/arrow-down-small.png"
overlay_stretch = FALSE
}
image {
function = BOX
state = PRELIGHT
detail = "spinbutton_down"
overlay_file = "assets/arrow-down-small-prelight.png"
overlay_stretch = FALSE
}
image {
function = BOX
state = ACTIVE
detail = "spinbutton_down"
overlay_file = "assets/arrow-down-small-prelight.png"
overlay_stretch = FALSE
}
image {
function = BOX
state = INSENSITIVE
detail = "spinbutton_down"
overlay_file = "assets/arrow-down-small-insens.png"
overlay_stretch = FALSE
}
}
}
style "notebook" {
xthickness = 5
ythickness = 2
engine "pixmap" {
image {
function = EXTENSION
state = ACTIVE
file = "assets/null.png"
border = { 0,0,0,0 }
stretch = TRUE
gap_side = TOP
}
image {
function = EXTENSION
state = ACTIVE
file = "assets/null.png"
border = { 0,0,0,0 }
stretch = TRUE
gap_side = BOTTOM
}
image {
function = EXTENSION
state = ACTIVE
file = "assets/null.png"
border = { 0,0,0,0 }
stretch = TRUE
gap_side = RIGHT
}
image {
function = EXTENSION
state = ACTIVE
file = "assets/null.png"
border = { 0,0,0,0 }
stretch = TRUE
gap_side = LEFT
}
image {
function = EXTENSION
file = "assets/tab-top-active.png"
border = { 3,3,3,3 }
stretch = TRUE
gap_side = BOTTOM
}
image {
function = EXTENSION
file = "assets/tab-bottom-active.png"
border = { 3,3,3,3 }
stretch = TRUE
gap_side = TOP
}
image {
function = EXTENSION
file = "assets/tab-left-active.png"
border = { 3,3,3,3 }
stretch = TRUE
gap_side = RIGHT
}
image {
function = EXTENSION
file = "assets/tab-right-active.png"
border = { 3,3,3,3 }
stretch = TRUE
gap_side = LEFT
}
# How to draw boxes with a gap on one side (ie the page of a notebook)
image {
function = BOX_GAP
file = "assets/notebook.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
gap_file = "assets/notebook-gap-horiz.png"
gap_border = { 1, 1, 0, 0 }
gap_side = TOP
}
image {
function = BOX_GAP
file = "assets/notebook.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
gap_file = "assets/notebook-gap-horiz.png"
gap_border = { 1, 1, 0, 0 }
gap_side = BOTTOM
}
image {
function = BOX_GAP
file = "assets/notebook.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
gap_file = "assets/notebook-gap-vert.png"
gap_border = { 0, 0, 1, 1 }
gap_side = LEFT
}
image {
function = BOX_GAP
file = "assets/notebook.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
gap_file = "assets/notebook-gap-vert.png"
gap_border = { 0, 0, 1, 1 }
gap_side = RIGHT
}
# How to draw the box of a notebook when it isnt attached to a tab
image {
function = BOX
file = "assets/notebook.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
}
}
}
style "handlebox" {
engine "pixmap" {
image {
function = BOX
file = "assets/null.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
detail = "handlebox_bin"
shadow = IN
}
image {
function = BOX
file = "assets/null.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
detail = "handlebox_bin"
shadow = OUT
}
}
}
style "combobox_separator" {
xthickness = 0
ythickness = 0
GtkWidget::wide-separators = 1
}
style "combobox" {
xthickness = 0
ythickness = 0
}
style "combobox_button" {
xthickness = 3
ythickness = 3
}
style "range" {
engine "pixmap" {
image {
function = BOX
detail = "trough-upper"
file = "assets/trough-horizontal.png"
border = { 8, 8, 0, 0 }
stretch = TRUE
orientation = HORIZONTAL
}
image {
function = BOX
detail = "trough-lower"
file = "assets/trough-horizontal-active.png"
border = { 8, 8, 0, 0 }
stretch = TRUE
orientation = HORIZONTAL
}
image {
function = BOX
detail = "trough-upper"
file = "assets/trough-vertical.png"
border = { 0, 0, 8, 8 }
stretch = TRUE
orientation = VERTICAL
}
image {
function = BOX
detail = "trough-lower"
file = "assets/trough-vertical-active.png"
border = { 0, 0, 8, 8 }
stretch = TRUE
orientation = VERTICAL
}
# Horizontal
image {
function = SLIDER
state = NORMAL
file = "assets/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "assets/slider.png"
overlay_stretch = FALSE
orientation = HORIZONTAL
}
image {
function = SLIDER
state = PRELIGHT
file = "assets/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "assets/slider-prelight.png"
overlay_stretch = FALSE
orientation = HORIZONTAL
}
image {
function = SLIDER
state = INSENSITIVE
file = "assets/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "assets/slider-insensitive.png"
overlay_stretch = FALSE
orientation = HORIZONTAL
}
# Vertical
image {
function = SLIDER
state = NORMAL
file = "assets/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "assets/slider.png"
overlay_stretch = FALSE
orientation = VERTICAL
}
image {
function = SLIDER
state = PRELIGHT
file = "assets/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "assets/slider-prelight.png"
overlay_stretch = FALSE
orientation = VERTICAL
}
image {
function = SLIDER
state = INSENSITIVE
file = "assets/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "assets/slider-insensitive.png"
overlay_stretch = FALSE
orientation = VERTICAL
}
# Function below removes ugly boxes
image {
function = BOX
file = "assets/null.png"
border = { 3, 3, 3, 3 }
stretch = TRUE
}
}
}
style "progressbar" {
xthickness = 1
ythickness = 1
fg[NORMAL] = @fg_color
fg[PRELIGHT] = @selected_fg_color
engine "pixmap" {
image {
function = BOX
detail = "trough"
file = "assets/trough-progressbar.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
orientation = HORIZONTAL
}
image {
function = BOX
detail = "bar"
file = "assets/progressbar.png"
stretch = TRUE
border = { 3, 3, 3, 3 }
orientation = HORIZONTAL
}
image {
function = BOX
detail = "trough"
file = "assets/trough-progressbar_v.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
orientation = VERTICAL
}
image {
function = BOX
detail = "bar"
file = "assets/progressbar_v.png"
stretch = TRUE
border = { 3, 3, 3, 3 }
orientation = VERTICAL
}
}
}
style "separator_menu_item" {
engine "pixmap" {
image {
function = BOX
file = "assets/null.png"
border = { 0, 0, 1, 0 }
stretch = TRUE
}
}
}
style "treeview_header" {
ythickness = 1
fg[PRELIGHT] = mix(0.70, @text_color, @base_color)
font_name = "Bold"
engine "pixmap" {
image {
function = BOX
file = "assets/tree_header.png"
border = { 1, 1, 1, 1 }
stretch = TRUE
}
}
}
# Treeview Rows
style "treeview" {
xthickness = 2
ythickness = 0
}
style "scrolled_window" {
xthickness = 1
ythickness = 1
engine "pixmap" {
image {
function = SHADOW
file = "assets/frame.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
}
}
}
style "frame" {
xthickness = 1
ythickness = 1
engine "pixmap" {
image {
function = SHADOW
file = "assets/frame.png"
border = { 1, 1, 1, 1 }
stretch = TRUE
shadow = IN
}
image {
function = SHADOW_GAP
file = "assets/frame.png"
border = { 1, 1, 1, 1 }
stretch = TRUE
gap_start_file = "assets/frame-gap-start.png"
gap_start_border = { 1, 0, 0, 0 }
gap_end_file = "assets/frame-gap-end.png"
gap_end_border = { 0, 1, 0, 0 }
shadow = IN
}
image {
function = SHADOW
file = "assets/frame.png"
border = { 1, 1, 1, 1 }
stretch = TRUE
shadow = OUT
}
image {
function = SHADOW_GAP
file = "assets/frame.png"
border = { 1, 1, 1, 1 }
stretch = TRUE
gap_start_file = "assets/frame-gap-start.png"
gap_start_border = { 1, 0, 0, 0 }
gap_end_file = "assets/frame-gap-end.png"
gap_end_border = { 0, 1, 0, 0 }
shadow = OUT
}
image {
function = SHADOW
file = "assets/frame.png"
border = { 1, 1, 1, 1 }
stretch = TRUE
shadow = ETCHED_IN
}
image {
function = SHADOW_GAP
file = "assets/frame.png"
border = { 1, 1, 1, 1 }
stretch = TRUE
gap_start_file = "assets/frame-gap-start.png"
gap_start_border = { 1, 0, 0, 0 }
gap_end_file = "assets/frame-gap-end.png"
gap_end_border = { 0, 1, 0, 0 }
shadow = ETCHED_IN
}
image {
function = SHADOW
file = "assets/frame.png"
border = { 1, 1, 1, 1 }
stretch = TRUE
shadow = ETCHED_OUT
}
image {
function = SHADOW_GAP
file = "assets/frame.png"
border = { 1, 1, 1, 1 }
stretch = TRUE
gap_start_file = "assets/frame-gap-start.png"
gap_start_border = { 1, 0, 0, 0 }
gap_end_file = "assets/frame-gap-end.png"
gap_end_border = { 0, 1, 0, 0 }
shadow = ETCHED_OUT
}
}
}
style "gimp_toolbox_frame" {
engine "pixmap" {
image {
function = SHADOW
}
}
}
style "toolbar" {
engine "pixmap" {
image {
function = BOX
file = "assets/toolbar.png"
stretch = TRUE
border = { 1, 1, 1, 1 }
}
image {
function = HANDLE
overlay_file = "assets/handle-h.png"
overlay_stretch = FALSE
orientation = HORIZONTAL
}
image {
function = HANDLE
overlay_file = "assets/handle-v.png"
overlay_stretch = FALSE
orientation = VERTICAL
}
image {
function = VLINE
recolorable = TRUE
file = "assets/null.png"
}
image {
function = HLINE
recolorable = TRUE
file = "assets/null.png"
}
}
}
style "inline_toolbar" {
GtkToolbar::button-relief = GTK_RELIEF_NORMAL
engine "pixmap" {
image {
function = BOX
file = "assets/inline-toolbar.png"
stretch = TRUE
border = { 1, 1, 1, 1 }
}
}
}
style "notebook_viewport" {
bg[NORMAL] = @notebook_bg
}
style "notebook_eventbox" {
bg[NORMAL] = @notebook_bg
bg[ACTIVE] = @bg_color
}
style "tooltips" {
xthickness = 8
ythickness = 4
bg[NORMAL] = @tooltip_bg_color
fg[NORMAL] = @tooltip_fg_color
bg[SELECTED] = @tooltip_bg_color
}
style "eclipse-tooltips" {
xthickness = 8
ythickness = 4
bg[NORMAL] = shade(1.05, @bg_color)
fg[NORMAL] = @text_color
bg[SELECTED] = shade(1.05, @bg_color)
}
style "xfdesktop-icon-view" {
XfdesktopIconView::label-alpha = 0
XfdesktopIconView::selected-label-alpha = 100
XfdesktopIconView::shadow-x-offset = 0
XfdesktopIconView::shadow-y-offset = 1
XfdesktopIconView::selected-shadow-x-offset = 0
XfdesktopIconView::selected-shadow-y-offset = 1
XfdesktopIconView::shadow-color = "#000000"
XfdesktopIconView::selected-shadow-color = "#000000"
XfdesktopIconView::shadow-blur-radius = 2
XfdesktopIconView::cell-spacing = 2
XfdesktopIconView::cell-padding = 6
XfdesktopIconView::cell-text-width-proportion = 1.9
fg[NORMAL] = @selected_fg_color
fg[ACTIVE] = @selected_fg_color
}
style "xfwm-tabwin" {
Xfwm4TabwinWidget::border-width = 1
Xfwm4TabwinWidget::border-alpha = 1.0
Xfwm4TabwinWidget::icon-size = 64
Xfwm4TabwinWidget::alpha = 1.0
Xfwm4TabwinWidget::border-radius = 2
bg[NORMAL] = @bg_color
bg[SELECTED] = @bg_color
fg[NORMAL] = @fg_color
engine "murrine" {
contrast = 0.7
glazestyle = 0
glowstyle = 0
highlight_shade = 1.0
gradient_shades = {1.0,1.0,1.0,1.0}
border_shades = { 0.8, 0.8 }
}
}
style "xfwm-tabwin-button" {
font_name = "bold"
bg[SELECTED] = @selected_bg_color
}
# Chromium
style "chrome_menu_item" {
bg[SELECTED] = @selected_bg_color
}
# Text Style
style "text" = "default" {
engine "murrine" { textstyle = 0 }
}
style "menu_text" = "menu_item" {
engine "murrine" { textstyle = 0 }
}
style "null" {
engine "pixmap" {
image {
function = BOX
file = "assets/null.png"
stretch = TRUE
}
}
}
class "GtkWidget" style "default"
class "GtkScrollbar" style "scrollbar"
class "GtkButton" style "button"
class "GtkEntry" style "entry"
class "GtkOldEditable" style "entry"
class "GtkSpinButton" style "spinbutton"
class "GtkNotebook" style "notebook"
class "GtkRange" style "range"
class "GtkProgressBar" style "progressbar"
class "GtkSeparatorMenuItem" style "separator_menu_item"
class "GtkScrolledWindow" style "scrolled_window"
class "GtkFrame" style "frame"
class "GtkTreeView" style "treeview"
class "GtkToolbar" style "toolbar"
class "*HandleBox" style "toolbar"
widget_class "*<GtkMenu>*" style "menu"
widget_class "*<GtkMenu>*" style "menu_framed_box"
widget_class "*<GtkMenuItem>*" style "menu_item"
widget_class "*<GtkCheckButton>*" style "checkbutton"
widget_class "*<GtkComboBox>" style "combobox"
widget_class "*<GtkComboBox>*<GtkButton>" style "combobox_button"
widget_class "*<GtkComboBox>*<GtkSeparator>" style "combobox_separator"
widget_class "*<GtkTreeView>*<GtkButton>*" style "treeview_header"
widget_class "*<GtkFileChooserDefault>*<GtkToolbar>" style "inline_toolbar"
widget_class "*<GtkComboBoxEntry>*<GtkEntry>" style "combobox_entry"
widget_class "*<GtkComboBoxEntry>*<GtkButton>" style "combobox_entry_button"
widget_class "*<GtkNotebook>*<GtkScrolledWindow>*<GtkViewport>" style "notebook_viewport"
widget_class "*HandleBox" style "toolbar"
# Entries in notebooks draw with notebook's base color, but not if there's
# something else in the middle that draws gray again
widget_class "*<GtkNotebook>*<GtkEntry>" style "notebook_entry"
widget_class "*<GtkNotebook>*<GtkEventBox>*<GtkEntry>" style "entry"
widget_class "*<GtkNotebook>*<GtkComboBoxEntry>*<GtkEntry>" style "notebook_combobox_entry"
widget_class "*<GtkNotebook>*<GtkEventBox>*<GtkComboBoxEntry>*<GtkEntry>" style "combobox_entry"
# We also need to avoid changing fg color for the inactive notebook tab labels
widget_class "*<GtkNotebook>.<GtkLabel>" style "notebook_tab_label"
# GTK tooltips
widget "gtk-tooltip*" style "tooltips"
#Fix GVim tabs
widget_class "*<GtkNotebook>*<GtkEventBox>" style "notebook_eventbox"
# Xchat special cases
widget "*xchat-inputbox" style "entry"
# GIMP
# Disable gradients completely for GimpSpinScale
#class "GimpSpinScale" style "gimp_spin_scale"
# Remove borders from "Wilbert frame" in Gimp
widget_class "*<GimpToolbox>*<GtkFrame>" style "gimp_toolbox_frame"
# Chrome/Chromium
widget_class "*Chrom*Button*" style "button"
widget_class "*<GtkCustomMenu>*<GtkCustomMenuItem>*" style "chrome_menu_item"
# Eclipse/SWT
widget "gtk-tooltips*" style "eclipse-tooltips"
widget "*swt-toolbar-flat" style "null"
# Openoffice, Libreoffice
class "GtkWindow" style "toplevel_hack"
widget "*openoffice-toplevel*" style "ooo_stepper_hack"
# Xfce
widget_class "*XfdesktopIconView*" style "xfdesktop-icon-view"
widget "xfwm4-tabwin*" style "xfwm-tabwin"
widget "xfwm4-tabwin*GtkButton*" style "xfwm-tabwin-button"
# Fixes ugly text shadows for insensitive text
widget_class "*<GtkLabel>" style "text"
widget_class "*<GtkMenu>*<GtkLabel>" style "menu_text"
widget_class "*<GtkComboBox>*<GtkCellLayout>" style "text"
widget_class "*<GtkNotebook>*<GtkLabel>" style "text"
widget_class "*<GtkNotebook>*<GtkCellLayout>" style "text"
| {
"pile_set_name": "Github"
} |
/* * * * *
* AzTools.cpp
* Copyright (C) 2011-2014 Rie Johnson
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* * * * */
#include "AzTools.hpp"
#include "AzPrint.hpp"
/*--------------------------------------------------------*/
int AzTools::writeList(const char *fn,
const AzStrArray *sp_list)
{
int max_len = 0;
AzFile file(fn);
file.open("wb");
int num = sp_list->size();
int ix;
for (ix = 0; ix < num; ++ix) {
AzBytArr s;
sp_list->get(ix, &s);
s.concat("\n");
max_len = MAX(max_len, s.getLen());
s.writeText(&file);
}
file.close(true);
return max_len;
}
/*--------------------------------------------------------*/
void AzTools::readList(const char *fn,
AzStrPool *sp_list, /* output */
const AzByte *dlm)
{
AzFile file(fn);
file.open("rb");
int sz = file.size_under2G("AzTools::readList, list file");
AzByte *buff = NULL;
int buff_len = sz+1;
AzBaseArray<AzByte> _a(buff_len, &buff);
for ( ; ; ) {
int len = file.gets(buff, buff_len);
if (len <= 0) {
break;
}
int str_len;
const AzByte *str = strip(buff, buff+len, &str_len);
if (dlm != NULL) {
int ix;
for (ix = 0; ix < str_len; ++ix) if (*(str+ix) == *dlm) break;
str_len = ix;
}
sp_list->put(str, str_len);
}
}
/*--------------------------------------------------------*/
void AzTools::flatten(const AzIFarr *ifa_dx_val,
/*--- output ---*/
AzIntArr *ia_index,
AzDvect *v_value)
{
/*--- make it flat for faster access later on ---*/
int num = ifa_dx_val->size();
ia_index->reset(num, AzNone);
if (num > 0) {
v_value->reform(num);
double *value = v_value->point_u();
int *index = ia_index->point_u();
int ix;
for (ix = 0; ix < num; ++ix) {
value[ix] = ifa_dx_val->get(ix, &index[ix]);
}
}
}
/*--------------------------------------------------------*/
char *AzTools::chomp(AzByte *inp, int inp_len)
{
AzByte *wp1, *wp2;
for (wp1 = inp; wp1 < inp + inp_len; ++wp1) {
if (*wp1 > 0x20)
break;
}
for (wp2 = inp + inp_len - 1; wp2 >= inp; --wp2) {
if (*wp2 > 0x20)
break;
}
if (wp2 + 1 - wp1 <= 0) {
*inp = '\0';
return (char *)inp;
}
*(wp2+1) = '\0';
return (char *)wp1;
}
/*--------------------------------------------------------*/
/* (NOTE) This doesn't skip preceding white characters. */
/*--------------------------------------------------------*/
const AzByte *AzTools::getString(const AzByte **wpp, const AzByte *data_end,
AzByte dlm, int *token_len)
{
const AzByte *token = *wpp;
const AzByte *wp = *wpp;
for ( ; wp < data_end; ++wp) {
if (*wp == dlm) break;
}
*token_len = Az64::ptr_diff(wp-token, "AzTools::getString");
/*----- point the next to the delimiter -----*/
if (wp < data_end) {
++wp;
}
*wpp = wp;
return token;
}
/*--------------------------------------------------------*/
void AzTools::getStrings(const AzByte *data, int data_len,
AzByte dlm,
AzStrPool *sp_out) /* output */
{
const AzByte *data_end = data + data_len;
const AzByte *wp = data;
for ( ; wp < data_end; ) {
int len;
const AzByte *token = getString(&wp, data_end, dlm, &len);
sp_out->put(token, len);
}
}
/*--------------------------------------------------------*/
void AzTools::getStrings(const AzByte *data, const AzByte *data_end,
AzByte dlm,
AzDataArray<AzBytArr> *aStr_out) /* output */
{
/*--- count ---*/
const AzByte *wp = data;
int count = 0;
for ( ; wp < data_end; ++count) {
int len;
getString(&wp, data_end, dlm, &len);
}
aStr_out->reset(count);
int no = 0;
for (wp = data; wp < data_end; ++no) {
int len;
const AzByte *token = getString(&wp, data_end, dlm, &len);
aStr_out->point_u(no)->concat(token, len);
}
}
/*--------------------------------------------------------*/
int AzTools::getNumber(const AzByte **wpp, const AzByte *data_end,
AzByte dlm)
{
const AzByte *wp = *wpp;
if (wp < data_end && *wp == dlm) {
*wpp = wp + 1;
return AzNone; /* this is no good */
}
int value = 0;
int sign = 1;
if (*wp == '-') {
sign = -1;
++wp;
}
else if (*wp == '+') {
++wp;
}
for ( ; wp < data_end; ++wp) {
if (*wp == dlm) break;
if (*wp >= '0' && *wp <= '9') {
value *= 10;
value += (*wp - '0');
}
}
/*----- point next to the delimiter -----*/
if (wp < data_end) {
++wp;
}
*wpp = wp;
return value * sign;
}
/*--------------------------------------------------------*/
/* (NOTE) This skips preceding white characters. */
/*--------------------------------------------------------*/
const AzByte *AzTools::getString(const AzByte **wpp, const AzByte *data_end,
int *byte_len)
{
const AzByte *wp = *wpp;
for ( ; wp < data_end; ++wp) {
if (*wp > ' ') break;
}
const AzByte *token = wp;
for ( ; wp < data_end; ++wp) {
if (*wp <= ' ') break;
}
const AzByte *token_end = wp;
*byte_len = Az64::ptr_diff(token_end-token, "AzTools::getString2");
*wpp = token_end;
return token;
}
/*--------------------------------------------------------*/
void AzTools::getStrings(const AzByte *data, int data_len,
AzStrPool *sp_tokens)
{
if (data_len <= 0) return;
const AzByte *wp = data;
const AzByte *data_end = data + data_len;
for ( ; ; ) {
int len;
const AzByte *str = getString(&wp, data_end, &len);
if (len <= 0) break;
sp_tokens->put(str, len);
}
}
/*--------------------------------------------------------*/
const AzByte *AzTools::strip(const AzByte *data, const AzByte *data_end,
int *byte_len)
{
const AzByte *bp;
for (bp = data; bp < data_end; ++bp) {
if (*bp > ' ') break;
}
const AzByte *ep;
for (ep = data_end - 1; ep >= data; --ep) {
if (*ep > ' ') break;
}
++ep;
*byte_len = Az64::ptr_diff(ep-bp, "AzTools::strip");
if (*byte_len < 0) { /* blank line */
bp = data;
*byte_len = 0;
}
return bp;
}
/*--------------------------------------------------------*/
void AzTools::shuffle(int rand_seed,
AzIntArr *iq,
bool withReplacement)
{
if (rand_seed > 0) {
srand(rand_seed);
}
int num = iq->size();
AzIntArr ia_temp;
int unit = 0;
ia_temp.reset(num, AzNone);
int ix;
for (ix = 0; ix < num; ++ix) {
for ( ; ; ) {
int rand_no = rand_large();
rand_no = rand_no % num;
if (withReplacement) {
ia_temp.update(ix, iq->get(rand_no));
break;
}
if (ia_temp.get(rand_no) == AzNone) {
ia_temp.update(rand_no, iq->get(ix));
break;
}
}
if (unit > 0 && !log_out.isNull()) {
if ((ix+1) % unit == 0) {
AzPrint::write(log_out, ".");
log_out.flush();
}
}
}
if (unit > 0 && !log_out.isNull()) {
AzPrint::writeln(log_out, "");
log_out.flush();
}
iq->reset();
iq->concat(&ia_temp);
}
/*--------------------------------------------------------*/
void AzTools::shuffleFile(const char *fn,
int buff_size,
int random_seed,
const char *out_fn)
{
AzByte *buff = NULL;
AzBaseArray<AzByte> _a(buff_size, &buff);
AzFile out_file(out_fn);
out_file.open("wb");
AzIIarr iia_offs_len;
AzFile file(fn);
file.open("X");
int offs = 0;
int lx = 0;
for ( ; ; ++lx) {
int len = file.gets(buff, buff_size);
if (len <= 0) break;
iia_offs_len.put(offs, len);
offs += len;
}
int line_num = iia_offs_len.size();
AzIntArr ia_lx;
ia_lx.range(0, line_num);
shuffle(random_seed, &ia_lx);
const int *my_lx = ia_lx.point();
int ix;
for (ix = 0; ix < line_num; ++ix) {
lx = my_lx[ix];
int offs, len;
iia_offs_len.get(lx, &offs, &len);
file.seekReadBytes(offs, len, buff);
out_file.writeBytes(buff, len);
}
file.close();
out_file.close(true);
}
/*------------------------------------------------------------------*/
void AzTools::formatRvector(const AzSvect *v,
const char *dlm,
AzBytArr *s, /* appended */
int exclude)
{
int row_num = v->rowNum();
AzCursor cursor;
int curr = 0;
for ( ; ; ) {
double val;
int ex = v->next(cursor, val);
if (ex < 0) break;
for ( ; curr < ex; ++curr) {
if (curr != exclude) {
s->c("0"); s->c(dlm);
}
}
int width = 8;
if (ex != exclude) {
s->concatFloat(val, width); s->c(dlm);
}
curr = ex + 1;
}
for ( ; curr < row_num; ++curr) {
if (curr != exclude) {
s->c("0"); s->c(dlm);
}
}
}
/*------------------------------------------------------------------*/
void AzTools::formatRvector(const AzDvect *v,
const char *dlm,
AzBytArr *s) /* appended */
{
int row_num = v->rowNum();
const double *val = v->point();
int row;
for (row = 0; row < row_num; ++row) {
s->concatFloat(val[row], 8); s->c(dlm);
}
}
/*------------------------------------------------*/
void AzTools::filter_exclude(const AzIntArr *ia_fxs,
AzSmat *m_x)
{
if (ia_fxs->size()==0) return;
AzSmat m_x_tran;
m_x->transpose(&m_x_tran);
int ix;
for (ix = 0; ix < ia_fxs->size(); ++ix) {
int fx = ia_fxs->get(ix);
m_x_tran.col_u(fx)->clear();
}
m_x_tran.transpose(m_x);
}
/*------------------------------------------------*/
void AzTools::filter_include(const AzIntArr *ia_fxs,
AzSmat *m_x)
{
if (ia_fxs->size()==0) return;
AzSmat m_x_tran;
m_x->transpose(&m_x_tran);
AzIntArr ia_onOff;
ia_fxs->toOnOff(&ia_onOff);
int fx;
for (fx = 0; fx < m_x_tran.colNum(); ++fx) {
if (fx>=ia_onOff.size() || ia_onOff.get(fx)==0) {
m_x_tran.col_u(fx)->clear();
}
}
m_x_tran.transpose(m_x);
}
/*------------------------------------------------*/
void AzTools::filter_include(const AzIntArr *ia_fxs,
const AzSmat *m_x,
AzSmat *m_out)
{
if (ia_fxs->size()==0) return;
AzSmat m_x_tran;
m_x->transpose(&m_x_tran);
AzSmat m_out_tran(m_x_tran.rowNum(), ia_fxs->size());
int ix;
for (ix = 0; ix < ia_fxs->size(); ++ix) {
int fx = ia_fxs->get(ix);
m_out_tran.col_u(ix)->set(m_x_tran.col(fx));
}
m_out_tran.transpose(m_out);
}
/*------------------------------------------------*/
void AzTools::pickData(AzSmat *m_inout,
const AzIntArr *ia_cols)
{
AzSmat m(m_inout);
m_inout->reform(m.rowNum(), ia_cols->size());
int ix;
for (ix = 0; ix < ia_cols->size(); ++ix) {
int col = ia_cols->get(ix);
m_inout->col_u(ix)->set(m.col(col));
}
}
/*------------------------------------------------*/
void AzTools::pickData(AzDvect *v_inout,
const AzIntArr *ia_cols)
{
AzDvect v(v_inout);
v_inout->reform(ia_cols->size());
int ix;
for (ix = 0; ix < ia_cols->size(); ++ix) {
int col = ia_cols->get(ix);
v_inout->set(ix, v.get(col));
}
}
/*------------------------------------------------*/
void AzTools::sample(int nn, int kk, AzIntArr *ia)
{
if (kk >= nn) {
ia->range(0, nn);
return;
}
ia->reset();
ia->prepare(kk);
AzIntArr ia_is_used; ia_is_used.reset(nn, false);
int *is_used = ia_is_used.point_u();
for ( ; ; ) {
int val = rand_large() % nn;
if (!is_used[val]) {
ia->put(val);
is_used[val] = true;
if (ia->size() >= kk) break;
}
}
}
/*------------------------------------------------*/
void AzTools::colSum(const AzSmat &m, AzDvect *v_sum)
{
v_sum->reform(m.colNum());
double *sum = v_sum->point_u();
int col;
for (col = 0; col < m.colNum(); ++col) {
sum[col] = m.sum(col);
}
}
/*------------------------------------------------*/
void AzTools::rowSum(const AzSmat &m, AzDvect *v_sum)
{
v_sum->reform(m.rowNum());
int col;
for (col = 0; col < m.colNum(); ++col) {
v_sum->add(m.col(col));
}
}
| {
"pile_set_name": "Github"
} |
///////////////////////////////////////////////////////////////
// Copyright 2012 John Maddock. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
#ifndef BOOST_MP_CPP_INT_CORE_HPP
#define BOOST_MP_CPP_INT_CORE_HPP
#include <boost/integer.hpp>
#include <boost/integer_traits.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/int.hpp>
#include <boost/static_assert.hpp>
#include <boost/assert.hpp>
namespace boost{ namespace multiprecision{
namespace detail{
//
// These traits calculate the largest type in the list
// [unsigned] boost::long_long_type, long, int, which has the specified number
// of bits. Note that intN_t and boost::int_t<N> find the first
// member of the above list, not the last. We want the last in the
// list to ensure that mixed arithmetic operations are as efficient
// as possible.
//
template <unsigned N>
struct largest_signed_type
{
typedef typename mpl::if_c<
1 + std::numeric_limits<boost::long_long_type>::digits == N,
boost::long_long_type,
typename mpl::if_c<
1 + std::numeric_limits<long>::digits == N,
long,
typename mpl::if_c<
1 + std::numeric_limits<int>::digits == N,
int,
typename boost::int_t<N>::exact
>::type
>::type
>::type type;
};
template <unsigned N>
struct largest_unsigned_type
{
typedef typename mpl::if_c<
std::numeric_limits<boost::ulong_long_type>::digits == N,
boost::ulong_long_type,
typename mpl::if_c<
std::numeric_limits<unsigned long>::digits == N,
unsigned long,
typename mpl::if_c<
std::numeric_limits<unsigned int>::digits == N,
unsigned int,
typename boost::uint_t<N>::exact
>::type
>::type
>::type type;
};
} // namespace detail
#if defined(BOOST_HAS_INT128)
typedef detail::largest_unsigned_type<64>::type limb_type;
typedef detail::largest_signed_type<64>::type signed_limb_type;
typedef boost::uint128_type double_limb_type;
typedef boost::int128_type signed_double_limb_type;
static const limb_type max_block_10 = 1000000000000000000uLL;
static const limb_type digits_per_block_10 = 18;
inline limb_type block_multiplier(unsigned count)
{
static const limb_type values[digits_per_block_10]
= { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000, 100000000000, 1000000000000, 10000000000000, 100000000000000, 1000000000000000, 10000000000000000, 100000000000000000, 1000000000000000000 };
BOOST_ASSERT(count < digits_per_block_10);
return values[count];
}
// Can't do formatted IO on an __int128
#define BOOST_MP_NO_DOUBLE_LIMB_TYPE_IO
// Need to specialise integer_traits for __int128 as it's not a normal native type:
} // namespace multiprecision
template<>
class integer_traits<multiprecision::double_limb_type>
: public std::numeric_limits<multiprecision::double_limb_type>,
public detail::integer_traits_base<multiprecision::double_limb_type, 0, ~static_cast<multiprecision::double_limb_type>(0)>
{ };
template<>
class integer_traits<multiprecision::signed_double_limb_type>
: public std::numeric_limits<multiprecision::signed_double_limb_type>,
public detail::integer_traits_base<multiprecision::signed_double_limb_type, static_cast<multiprecision::signed_double_limb_type>((static_cast<multiprecision::double_limb_type>(1) << 127)), static_cast<multiprecision::signed_double_limb_type>(((~static_cast<multiprecision::double_limb_type>(0)) >> 1))>
{ };
namespace multiprecision{
#else
typedef detail::largest_unsigned_type<32>::type limb_type;
typedef detail::largest_signed_type<32>::type signed_limb_type;
typedef detail::largest_unsigned_type<64>::type double_limb_type;
typedef detail::largest_signed_type<64>::type signed_double_limb_type;
static const limb_type max_block_10 = 1000000000;
static const limb_type digits_per_block_10 = 9;
inline limb_type block_multiplier(unsigned count)
{
static const limb_type values[digits_per_block_10]
= { 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 };
BOOST_ASSERT(count < digits_per_block_10);
return values[count];
}
#endif
static const unsigned bits_per_limb = sizeof(limb_type) * CHAR_BIT;
template <class T>
inline void minmax(const T& a, const T& b, T& aa, T& bb)
{
if(a < b)
{
aa = a;
bb = b;
}
else
{
aa = b;
bb = a;
}
}
enum cpp_integer_type
{
signed_magnitude = 1,
unsigned_magnitude = 0,
signed_packed = 3,
unsigned_packed = 2
};
enum cpp_int_check_type
{
checked = 1,
unchecked = 0
};
}}
//
// Figure out whether to support user-defined-literals or not:
//
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_USER_DEFINED_LITERALS) \
&& !defined(BOOST_NO_CXX11_CONSTEXPR)
# define BOOST_MP_USER_DEFINED_LITERALS
#endif
#endif // BOOST_MP_CPP_INT_CORE_HPP
| {
"pile_set_name": "Github"
} |
---
ms.topic: include
---
::: moniker range=">= tfs-2018"
#### Supported in: Markdown widget | Pull Requests | README files | Wikis
::: moniker-end
::: moniker range="tfs-2017"
#### Supported in: Markdown widget | Pull Requests | README files
::: moniker-end
::: moniker range="tfs-2015"
#### Supported in: Markdown widget | README files
::: moniker-end
| {
"pile_set_name": "Github"
} |
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Unsupported.cs
// Author(s) : Natalia Portillo <[email protected]>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains features unsupported by RS-IDE disk images.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2020 Natalia Portillo
// ****************************************************************************/
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Exceptions;
namespace Aaru.DiscImages
{
public sealed partial class RsIde
{
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public byte[] ReadSectorLong(ulong sectorAddress) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public byte[] ReadSectorsLong(ulong sectorAddress, uint length) =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
} | {
"pile_set_name": "Github"
} |
package slb
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)
// SetAutoRenewStatus invokes the slb.SetAutoRenewStatus API synchronously
// api document: https://help.aliyun.com/api/slb/setautorenewstatus.html
func (client *Client) SetAutoRenewStatus(request *SetAutoRenewStatusRequest) (response *SetAutoRenewStatusResponse, err error) {
response = CreateSetAutoRenewStatusResponse()
err = client.DoAction(request, response)
return
}
// SetAutoRenewStatusWithChan invokes the slb.SetAutoRenewStatus API asynchronously
// api document: https://help.aliyun.com/api/slb/setautorenewstatus.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) SetAutoRenewStatusWithChan(request *SetAutoRenewStatusRequest) (<-chan *SetAutoRenewStatusResponse, <-chan error) {
responseChan := make(chan *SetAutoRenewStatusResponse, 1)
errChan := make(chan error, 1)
err := client.AddAsyncTask(func() {
defer close(responseChan)
defer close(errChan)
response, err := client.SetAutoRenewStatus(request)
if err != nil {
errChan <- err
} else {
responseChan <- response
}
})
if err != nil {
errChan <- err
close(responseChan)
close(errChan)
}
return responseChan, errChan
}
// SetAutoRenewStatusWithCallback invokes the slb.SetAutoRenewStatus API asynchronously
// api document: https://help.aliyun.com/api/slb/setautorenewstatus.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) SetAutoRenewStatusWithCallback(request *SetAutoRenewStatusRequest, callback func(response *SetAutoRenewStatusResponse, err error)) <-chan int {
result := make(chan int, 1)
err := client.AddAsyncTask(func() {
var response *SetAutoRenewStatusResponse
var err error
defer close(result)
response, err = client.SetAutoRenewStatus(request)
callback(response, err)
result <- 1
})
if err != nil {
defer close(result)
callback(nil, err)
result <- 0
}
return result
}
// SetAutoRenewStatusRequest is the request struct for api SetAutoRenewStatus
type SetAutoRenewStatusRequest struct {
*requests.RpcRequest
AccessKeyId string `position:"Query" name:"access_key_id"`
ResourceOwnerId requests.Integer `position:"Query" name:"ResourceOwnerId"`
RenewalDuration requests.Integer `position:"Query" name:"RenewalDuration"`
LoadBalancerId string `position:"Query" name:"LoadBalancerId"`
ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
OwnerAccount string `position:"Query" name:"OwnerAccount"`
RenewalStatus string `position:"Query" name:"RenewalStatus"`
RenewalCycUnit string `position:"Query" name:"RenewalCycUnit"`
OwnerId requests.Integer `position:"Query" name:"OwnerId"`
Tags string `position:"Query" name:"Tags"`
}
// SetAutoRenewStatusResponse is the response struct for api SetAutoRenewStatus
type SetAutoRenewStatusResponse struct {
*responses.BaseResponse
RequestId string `json:"RequestId" xml:"RequestId"`
}
// CreateSetAutoRenewStatusRequest creates a request to invoke SetAutoRenewStatus API
func CreateSetAutoRenewStatusRequest() (request *SetAutoRenewStatusRequest) {
request = &SetAutoRenewStatusRequest{
RpcRequest: &requests.RpcRequest{},
}
request.InitWithApiInfo("Slb", "2014-05-15", "SetAutoRenewStatus", "slb", "openAPI")
return
}
// CreateSetAutoRenewStatusResponse creates a response to parse from SetAutoRenewStatus response
func CreateSetAutoRenewStatusResponse() (response *SetAutoRenewStatusResponse) {
response = &SetAutoRenewStatusResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en" xmlns:ng="http://angularjs.org/" >
<head>
<title>Zza-Node-Mongo with AngularJs</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"/>
<link rel="shortcut icon" type="image/png" href="images/logo.png">
<link href="./css/ie10mobile.css" rel="stylesheet" />
<link href="./css/bootstrap.css" rel="stylesheet" />
<link href="./css/bootstrap-responsive.css" rel="stylesheet" />
<link href="lib/toastr/toastr.css" rel="stylesheet" />
<link href="./css/styles.css" rel="stylesheet" />
</head>
<body class="ng-cloak" data-ng-app="app">
<!-- *** Shell of the SPA *** -->
<div data-ui-view="header"></div>
<div id="shell-content" data-ui-view="content"></div>
<div data-ui-view="footer"></div>
<!-- *** Vendor scripts *** -->
<script src="lib/angular/angular.js"></script>
<script src="lib/angular-sanitize/angular-sanitize.js"></script>
<script src="lib/angular-ui-router/angular-ui-router.js"></script>
<script src="lib/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="lib/breeze/breeze.debug.js"></script>
<script src="lib/breeze/breeze.angular.js"></script>
<script src="lib/breeze/breeze.dataservice.mongo.js"></script>
<script src="lib/breeze/breeze.metadata-helper.js"></script>
<!-- toastr requires jQuery, not breeze or this app -->
<script src="lib/jquery/jquery.min.js"></script>
<script src="lib/toastr/toastr.js"></script>
<!-- *** Application scripts *** -->
<script src="app/app.js"></script> <!-- must load first -->
<script src="app/appStart.js"></script>
<!-- Feature Areas: controllers -->
<script src="app/menu/menu.js"></script>
<script src="app/customer/customer.js"></script>
<script src="app/order/cart.js"></script>
<script src="app/order/orderItem.js"></script>
<script src="app/order/orderItemOptionVm.js"></script>
<script src="app/order/orderItemOptionTypeVm.js"></script>
<script src="app/order/orderSidebar.js"></script>
<script src="app/shell/header.js"></script>
<!-- Directives & Routing -->
<script src="app/directives/productImgSrcDirective.js"></script>
<script src="app/routeStates.js"></script>
<!-- Services -->
<script src="app/services/config.js"></script>
<script src="app/services/databaseReset.js"></script>
<script src="app/services/dataservice.js"></script>
<script src="app/services/entityManagerFactory.js"></script>
<script src="app/services/logger.js"></script>
<script src="app/services/lookups.js"></script>
<script src="app/services/metadata.js"></script>
<script src="app/services/model.js"></script>
<script src="app/services/pricing.js"></script>
<script src="app/services/util.js"></script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
//
// Simple example to demonstrate how to use the MAVSDK.
//
// Author: Julian Oes <[email protected]>
#include <chrono>
#include <cstdint>
#include <mavsdk/mavsdk.h>
#include <mavsdk/plugins/action/action.h>
#include <mavsdk/plugins/telemetry/telemetry.h>
#include <iostream>
#include <thread>
using namespace mavsdk;
using namespace std::this_thread;
using namespace std::chrono;
#define ERROR_CONSOLE_TEXT "\033[31m" // Turn text on console red
#define TELEMETRY_CONSOLE_TEXT "\033[34m" // Turn text on console blue
#define NORMAL_CONSOLE_TEXT "\033[0m" // Restore normal console colour
void usage(std::string bin_name)
{
std::cout << NORMAL_CONSOLE_TEXT << "Usage : " << bin_name << " <connection_url>" << std::endl
<< "Connection URL format should be :" << std::endl
<< " For TCP : tcp://[server_host][:server_port]" << std::endl
<< " For UDP : udp://[bind_host][:bind_port]" << std::endl
<< " For Serial : serial:///path/to/serial/dev[:baudrate]" << std::endl
<< "For example, to connect to the simulator use URL: udp://:14540" << std::endl;
}
void component_discovered(ComponentType component_type)
{
std::cout << NORMAL_CONSOLE_TEXT << "Discovered a component with type "
<< unsigned(component_type) << std::endl;
}
int main(int argc, char** argv)
{
Mavsdk dc;
std::string connection_url;
ConnectionResult connection_result;
bool discovered_system = false;
if (argc == 2) {
connection_url = argv[1];
connection_result = dc.add_any_connection(connection_url);
} else {
usage(argv[0]);
return 1;
}
if (connection_result != ConnectionResult::Success) {
std::cout << ERROR_CONSOLE_TEXT << "Connection failed: " << connection_result
<< NORMAL_CONSOLE_TEXT << std::endl;
return 1;
}
// We don't need to specify the UUID if it's only one system anyway.
// If there were multiple, we could specify it with:
// dc.system(uint64_t uuid);
System& system = dc.system();
std::cout << "Waiting to discover system..." << std::endl;
dc.register_on_discover([&discovered_system](uint64_t uuid) {
std::cout << "Discovered system with UUID: " << uuid << std::endl;
discovered_system = true;
});
// We usually receive heartbeats at 1Hz, therefore we should find a system after around 2
// seconds.
sleep_for(seconds(2));
if (!discovered_system) {
std::cout << ERROR_CONSOLE_TEXT << "No system found, exiting." << NORMAL_CONSOLE_TEXT
<< std::endl;
return 1;
}
// Register a callback so we get told when components (camera, gimbal) etc
// are found.
system.register_component_discovered_callback(component_discovered);
auto telemetry = std::make_shared<Telemetry>(system);
auto action = std::make_shared<Action>(system);
// We want to listen to the altitude of the drone at 1 Hz.
const Telemetry::Result set_rate_result = telemetry->set_rate_position(1.0);
if (set_rate_result != Telemetry::Result::Success) {
std::cout << ERROR_CONSOLE_TEXT << "Setting rate failed:" << set_rate_result
<< NORMAL_CONSOLE_TEXT << std::endl;
return 1;
}
// Set up callback to monitor altitude while the vehicle is in flight
telemetry->subscribe_position([](Telemetry::Position position) {
std::cout << TELEMETRY_CONSOLE_TEXT // set to blue
<< "Altitude: " << position.relative_altitude_m << " m"
<< NORMAL_CONSOLE_TEXT // set to default color again
<< std::endl;
});
// Check if vehicle is ready to arm
while (telemetry->health_all_ok() != true) {
std::cout << "Vehicle is getting ready to arm" << std::endl;
sleep_for(seconds(1));
}
// Arm vehicle
std::cout << "Arming..." << std::endl;
const Action::Result arm_result = action->arm();
if (arm_result != Action::Result::Success) {
std::cout << ERROR_CONSOLE_TEXT << "Arming failed:" << arm_result << NORMAL_CONSOLE_TEXT
<< std::endl;
return 1;
}
// Take off
std::cout << "Taking off..." << std::endl;
const Action::Result takeoff_result = action->takeoff();
if (takeoff_result != Action::Result::Success) {
std::cout << ERROR_CONSOLE_TEXT << "Takeoff failed:" << takeoff_result
<< NORMAL_CONSOLE_TEXT << std::endl;
return 1;
}
// Let it hover for a bit before landing again.
sleep_for(seconds(10));
std::cout << "Landing..." << std::endl;
const Action::Result land_result = action->land();
if (land_result != Action::Result::Success) {
std::cout << ERROR_CONSOLE_TEXT << "Land failed:" << land_result << NORMAL_CONSOLE_TEXT
<< std::endl;
return 1;
}
// Check if vehicle is still in air
while (telemetry->in_air()) {
std::cout << "Vehicle is landing..." << std::endl;
sleep_for(seconds(1));
}
std::cout << "Landed!" << std::endl;
// We are relying on auto-disarming but let's keep watching the telemetry for a bit longer.
sleep_for(seconds(3));
std::cout << "Finished..." << std::endl;
return 0;
}
| {
"pile_set_name": "Github"
} |
/* crypto/mdc2/mdc2.h */
/* Copyright (C) 1995-1998 Eric Young ([email protected])
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young ([email protected]).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson ([email protected]).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young ([email protected])"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson ([email protected])"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#ifndef HEADER_MDC2_H
#define HEADER_MDC2_H
#include <openssl/des.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef OPENSSL_NO_MDC2
#error MDC2 is disabled.
#endif
#define MDC2_BLOCK 8
#define MDC2_DIGEST_LENGTH 16
typedef struct mdc2_ctx_st
{
int num;
unsigned char data[MDC2_BLOCK];
DES_cblock h,hh;
int pad_type; /* either 1 or 2, default 1 */
} MDC2_CTX;
int MDC2_Init(MDC2_CTX *c);
int MDC2_Update(MDC2_CTX *c, const unsigned char *data, unsigned long len);
int MDC2_Final(unsigned char *md, MDC2_CTX *c);
unsigned char *MDC2(const unsigned char *d, unsigned long n,
unsigned char *md);
#ifdef __cplusplus
}
#endif
#endif
| {
"pile_set_name": "Github"
} |
## Description
Transform data type from Columns to Csv.
## Parameters
| Name | Description | Type | Required? | Default Value |
| --- | --- | --- | --- | --- |
| handleInvalid | Strategy to handle unseen token | String | | "ERROR" |
| reservedCols | Names of the columns to be retained in the output table | String[] | | null |
| csvCol | Name of the CSV column | String | ✓ | |
| schemaStr | Formatted schema | String | ✓ | |
| csvFieldDelimiter | Field delimiter | String | | "," |
| quoteChar | quote char | Character | | "\"" |
| selectedCols | Names of the columns used for processing | String[] | | null |
## Script Example
### Code
```python
import numpy as np
import pandas as pd
data = np.array([['1', '{"f0":"1.0","f1":"2.0"}', '$3$0:1.0 1:2.0', 'f0:1.0,f1:2.0', '1.0,2.0', 1.0, 2.0],
['2', '{"f0":"4.0","f1":"8.0"}', '$3$0:4.0 1:8.0', 'f0:4.0,f1:8.0', '4.0,8.0', 4.0, 8.0]])
df = pd.DataFrame({"row":data[:,0], "json":data[:,1], "vec":data[:,2], "kv":data[:,3], "csv":data[:,4], "f0":data[:,5], "f1":data[:,6]})
data = dataframeToOperator(df, schemaStr="row string, json string, vec string, kv string, csv string, f0 double, f1 double",op_type="batch")
op = ColumnsToCsvBatchOp()\
.setSelectedCols(["f0", "f1"])\
.setReservedCols(["row"]).setCsvCol("csv").setSchemaStr("f0 double, f1 double")\
.linkFrom(data)
op.print()
```
### Results
|row|csv|
|-|-------|
|1|1.0,2.0|
|2|4.0,8.0|
| {
"pile_set_name": "Github"
} |
#include "operators.h"
// for testing the case of virtual operator==
v_opeq_base::v_opeq_base(int val) : m_val(val) {}
v_opeq_base::~v_opeq_base() {}
bool v_opeq_base::operator==(const v_opeq_base& other) {
return m_val == other.m_val;
}
v_opeq_derived::v_opeq_derived(int val) : v_opeq_base(val) {}
v_opeq_derived::~v_opeq_derived() {}
bool v_opeq_derived::operator==(const v_opeq_derived& other) {
return m_val != other.m_val;
}
| {
"pile_set_name": "Github"
} |
// Go support for leveled logs, analogous to https://code.google.com/p/google-glog/
//
// Copyright 2013 Google Inc. 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.
// File I/O for logs.
package glog
import (
"errors"
"flag"
"fmt"
"os"
"os/user"
"path/filepath"
"strings"
"sync"
"time"
)
// MaxSize is the maximum size of a log file in bytes.
var MaxSize uint64 = 1024 * 1024 * 1800
// logDirs lists the candidate directories for new log files.
var logDirs []string
// If non-empty, overrides the choice of directory in which to write logs.
// See createLogDirs for the full list of possible destinations.
var logDir = flag.String("log_dir", "", "If non-empty, write log files in this directory")
func createLogDirs() {
if *logDir != "" {
logDirs = append(logDirs, *logDir)
}
logDirs = append(logDirs, os.TempDir())
}
var (
pid = os.Getpid()
program = filepath.Base(os.Args[0])
host = "unknownhost"
userName = "unknownuser"
)
func init() {
h, err := os.Hostname()
if err == nil {
host = shortHostname(h)
}
current, err := user.Current()
if err == nil {
userName = current.Username
}
// Sanitize userName since it may contain filepath separators on Windows.
userName = strings.Replace(userName, `\`, "_", -1)
}
// shortHostname returns its argument, truncating at the first period.
// For instance, given "www.google.com" it returns "www".
func shortHostname(hostname string) string {
if i := strings.Index(hostname, "."); i >= 0 {
return hostname[:i]
}
return hostname
}
// logName returns a new log file name containing tag, with start time t, and
// the name for the symlink for tag.
func logName(tag string, t time.Time) (name, link string) {
name = fmt.Sprintf("%s.%s.%s.log.%s.%04d%02d%02d-%02d%02d%02d.%d",
program,
host,
userName,
tag,
t.Year(),
t.Month(),
t.Day(),
t.Hour(),
t.Minute(),
t.Second(),
pid)
return name, program + "." + tag
}
var onceLogDirs sync.Once
// create creates a new log file and returns the file and its filename, which
// contains tag ("INFO", "FATAL", etc.) and t. If the file is created
// successfully, create also attempts to update the symlink for that tag, ignoring
// errors.
func create(tag string, t time.Time) (f *os.File, filename string, err error) {
onceLogDirs.Do(createLogDirs)
if len(logDirs) == 0 {
return nil, "", errors.New("log: no log dirs")
}
name, link := logName(tag, t)
var lastErr error
for _, dir := range logDirs {
fname := filepath.Join(dir, name)
f, err := os.Create(fname)
if err == nil {
symlink := filepath.Join(dir, link)
os.Remove(symlink) // ignore err
os.Symlink(name, symlink) // ignore err
return f, fname, nil
}
lastErr = err
}
return nil, "", fmt.Errorf("log: cannot create log: %v", lastErr)
}
| {
"pile_set_name": "Github"
} |
/*
Copyright (c) 2020 David Allison <[email protected]>
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.ichi2.ui;
import android.content.Context;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
/** Adapts a RecyclerView.OnItemTouchListener to provide a click listener */
public class RecyclerSingleTouchAdapter implements RecyclerView.OnItemTouchListener {
private final OnItemClickListener mListener;
private final GestureDetector mGestureDetector;
public interface OnItemClickListener {
void onItemClick(@NonNull View view, int position);
}
public RecyclerSingleTouchAdapter(@NonNull Context context, @NonNull OnItemClickListener listener) {
mListener = listener;
mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapUp(MotionEvent e) {
//onDown was too fast
return true;
}
});
}
@Override
public boolean onInterceptTouchEvent(@NonNull RecyclerView view, @NonNull MotionEvent e) {
View childView = view.findChildViewUnder(e.getX(), e.getY());
if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) {
mListener.onItemClick(childView, view.getChildAdapterPosition(childView));
return true;
}
return false;
}
@Override public void onTouchEvent(@NonNull RecyclerView view, @NonNull MotionEvent motionEvent) {
//intentionally empty
}
@Override
public void onRequestDisallowInterceptTouchEvent (boolean disallowIntercept) {
//intentionally empty
}
}
| {
"pile_set_name": "Github"
} |
//
// NUITextInputTraitsRenderer.m
// NUIDemo
//
// Created by Alexey Trenikhin on 3/13/16.
// Copyright © 2016 Tom Benner. All rights reserved.
//
#import "NUITextInputTraitsRenderer.h"
#import "UIKit/UITextInputTraits.h"
#import "NUISettings.h"
@implementation NUITextInputTraitsRenderer
+ (void)renderKeyboard:(id<UITextInputTraits>) traits withClass:(NSString*)className
{
NSString *property;
property = @"keyboard-appearance";
if ([NUISettings hasProperty:property withClass:className] && [traits respondsToSelector: @selector(setKeyboardAppearance:)]) {
traits.keyboardAppearance = [NUISettings getKeyboardAppearance:property withClass:className];
}
}
@end
| {
"pile_set_name": "Github"
} |
ALTER TABLE `mail`
CHANGE COLUMN `itemPageId` `itemTextId` int(11) unsigned NOT NULL default '0';
| {
"pile_set_name": "Github"
} |
{
"name": "mockery/mockery",
"description": "Mockery is a simple yet flexible PHP mock object framework",
"scripts": {
"docs": "phpdoc -d library -t docs/api"
},
"keywords": [
"bdd",
"library",
"mock",
"mock objects",
"mockery",
"stub",
"tdd",
"test",
"test double",
"testing"
],
"homepage": "https://github.com/mockery/mockery",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Pádraic Brady",
"email": "[email protected]",
"homepage": "http://blog.astrumfutura.com"
},
{
"name": "Dave Marshall",
"email": "[email protected]",
"homepage": "http://davedevelopment.co.uk"
}
],
"require": {
"php": ">=5.6.0",
"lib-pcre": ">=7.0",
"hamcrest/hamcrest-php": "~2.0"
},
"require-dev": {
"phpunit/phpunit": "~5.7.10|~6.5|~7.0"
},
"autoload": {
"psr-0": {
"Mockery": "library/"
}
},
"autoload-dev": {
"psr-4": {
"test\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}
| {
"pile_set_name": "Github"
} |
recursive-include distributed *.py
recursive-include distributed *.js
recursive-include distributed *.coffee
recursive-include distributed *.html
recursive-include distributed *.css
recursive-include distributed *.svg
recursive-include distributed *.ico
recursive-include distributed *.yaml
recursive-include docs *.rst
include setup.py
include README.rst
include LICENSE.txt
include MANIFEST.in
include requirements.txt
include distributed/tests/testegg-1.0.0-py3.4.egg
include distributed/tests/mytest.pyz
include distributed/tests/*.pem
prune docs/_build
include versioneer.py
include distributed/_version.py
| {
"pile_set_name": "Github"
} |
## SUPPORT
This project is contributed by Palo Alto Networks and is not formally supported.
Support for the this project is provided on a best-effort basis the Palo Alto Networks user community.
If you encounter any issues you may:
- Open a [GitHub issue](https://github.com/PaloAltoNetworks/iron-skillet/issues).
- Post a message on the Best Practices discussion forum
More information on Palo Alto Networks support policies may be found at:
http://www.paloaltonetworks.com/support
| {
"pile_set_name": "Github"
} |
# ________ ____ __ __ ______
# \___ // __ \| | \/ ___/
# / /\ ___/| | /\___ \
# /_____ \\___ >____//____ >
# \/ \/ \/
# Build System
# v0.8.1
#
# default interpreter used for Zeusfile code is bash
# that means all commands without the language field are treated as shell scripts
# to change the default script language, use the language field
# to change the language of an individual command, use the language field directly on the command
language: bash
# globals are visible for all commands
# they can contain variables
# for language specific code create a globals.[scriptExtension] file in the zeus directory
globals:
binaryName: zeus
buildDir: bin
version: 0.8
# all commands
# available fields:
# Field # Type # Info
# ------------------------- # -------------- # --------------------------------------------------------------
# description # string # a short description text that will be display on startup
# help # string # a multi line manual entry for detailed explanations
# dependencies # []string # a list of dependency commands with their arguments
# outputs # []string # a list of ouputs files / directories
# buildNumber # bool # increment buildNumber each execution
# arguments # []string # list of typed arguments, allows optionals and default values
# async # bool # detach comamnd async in a screen session, attach on demand
# path # string # custom path for script file
# exec # string # supply the script directly without a file
commands:
# multi language examples
#
python:
description: a python script
language: python
arguments:
- src:String
- dst:String
exec: |
python_greet()
print("src=" + src)
print("dst=" + dst)
ruby:
description: a ruby script
language: ruby
arguments:
- src:String
- dst:String
exec: |
puts "hello from ruby!"
puts "source=" + $src
puts "destination=" + $dst
lua:
description: a lua script
language: lua
arguments:
- src:String
- dst:String
exec: |
print("Hello World! from lua!")
print("source=", src)
print("destination=", dst)
javascript:
description: a javascript program
language: javascript
arguments:
- src:String
- dst:String
exec: |
console.log("[ZEUS v" + version + "] Hello World!");
console.log("source=" + src);
console.log("destination=" + dst);
# examples
#
cycle1:
description: produce a cycle
dependencies:
- cycle2
outputs:
exec: echo "cycle1 called!"
cycle2:
description: produce a cycle
dependencies:
- cycle1
exec: echo "cycle2 called!"
arguments:
description: test optional command arguments
help: |
this is an example for the optional commands argument
imagine a remote login scenario
arguments:
- user:String? = bob
- password:String
- ipAddr:String
- port:Int? = 80
dependencies:
outputs:
exec: |
print("test-optionals:")
print("user=" + user)
print("password=" + password)
print("ipAddr=" + ipAddr)
print("port=" + port)
buildNumber:
description: increase build number each execution
buildNumber: true
exec: echo "increasing buildNumber"
chain:
description: test chained commands
dependencies:
- dependency2
- async
- arguments password=test ipAddr=192.168.1.5
exec: echo "testing chained commands"
async:
description: test asyncronous command execution
help: |
this is an example for the asyncronous command execution
outputs:
async: true
exec: |
sleep 3 && echo "ping" && sleep 3 && echo "ping"
sleep 3 && echo "ping" && sleep 3 && echo "ping"
sleep 3 && echo "ping" && sleep 3 && echo "ping"
sleep 3 && echo "ping" && sleep 3 && echo "ping"
dependency1:
description: test dependencies
help: |
this is an example for the dependencies
outputs:
- tests/bin/dependency1
buildNumber: true
exec: |
touch tests/bin/dependency1
dependency2:
description: test dependencies
help: |
this is an example for the dependencies
dependencies:
- dependency1
buildNumber: true
exec: |
touch tests/bin/dependency2
all:
description: description for command all
help: help text for command all
arguments:
dependencies:
- clean
- configure
outputs:
clean:
description: description for command clean
help: help text for command clean
arguments:
dependencies:
outputs:
build:
description: description for command build
help: help text for command build
arguments:
dependencies:
outputs:
configure:
description: description for command configure
help: help text for command configure
arguments:
dependencies:
outputs:
| {
"pile_set_name": "Github"
} |
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Jojatekok.PoloniexAPI.WalletTools
{
public class DepositWithdrawalList : IDepositWithdrawalList
{
[JsonProperty("deposits")]
public IList<Deposit> Deposits { get; private set; }
[JsonProperty("withdrawals")]
public IList<Withdrawal> Withdrawals { get; private set; }
}
}
| {
"pile_set_name": "Github"
} |
using System;
using PlatoCore.Abstractions;
using PlatoCore.Models.Users;
namespace Plato.Ideas.Categories.Models
{
public class CategoryDetails : Serializable
{
public int TotalEntities { get; set; }
public int TotalReplies { get; set; }
public LatestPost LatestEntity { get; set; } = new LatestPost();
public LatestPost LatestReply { get; set; } = new LatestPost();
public bool Closed { get; set; }
}
public class LatestPost
{
public int Id { get; set; }
public string Alias { get; set; }
public ISimpleUser CreatedBy { get; set; } = new SimpleUser();
public DateTimeOffset? CreatedDate { get; set; }
}
}
| {
"pile_set_name": "Github"
} |
.sponsor-button {
text-align: right;
margin: 4px;
.bmc-button {
display: inline-block;
padding: 0px 7px;
width: 133px;
height: 33px;
text-decoration: none;
background-color: #bb5794;
color: #ffffff;
border: 1px solid transparent;
border-radius: 6px;
letter-spacing: -0.08px;
box-sizing: border-box;
font-size: 12px;
line-height: 30px;
text-align: left;
&:hover,
&:active {
background-color: #a0457d;
}
img {
width: 20px;
margin-bottom: 1px;
box-shadow: none;
border: none;
vertical-align: middle;
}
span {
margin-left: 6px;
}
}
}
| {
"pile_set_name": "Github"
} |
# How to release third party images
## Release a new third party image version
1. Edit third_party/$LIBRARY/Dockerfile
1. Change the line `from IMAGE_NAME:TAG_NAME` to `from IMAGE_NAME:NEW_TAG_NAME`
1. Edit third_party/$LIBRARY/release.sh
1. Change TAG to NEW_TAG_NAME.
1. Commit and ask someone for review
1. Run the following (you need to have storage access to ml-pipeline project)
```
cd $KFP_SRC
./third_party/$LIBRARY/release.sh
```
1. Make a PR that
* changes all image references in .release.cloudbuild.yaml
* changes all image references in manifests
## How to build
```
cd $KFP_SRC
gcloud builds submit --config third_party/argo/cloudbuild.yaml . --substitutions=TAG_NAME="RELEASE_TAG_NAME_HERE"
gcloud builds submit --config third_party/minio/cloudbuild.yaml . --substitutions=TAG_NAME="RELEASE_TAG_NAME_HERE"
```
or you can build locally using docker too like the following
```
cd $KFP_SRC
docker build -t $IMAGE_NAME:$TAG -f third_party/minio/Dockerfile .
```
## Verify your built images are good
Run the following command to start an interactive shell in a new container of the image (the image must have shell installed to be able to run it)
```
docker run -it --entrypoint sh $IMAGE_NAME
```
Or if the image doesn't have a complete OS (like argoproj/workflow-controller)
```
docker save nginx > nginx.tar
tar -xvf nginx.tar
```
This saves layers of the image to a tarball that you can extract and see.
Credits to: https://stackoverflow.com/questions/44769315/how-to-see-docker-image-contents
## Release to gcr.io/ml-pipeline
(This has been automated by third_party/release.sh)
1. First build images in your own project
1. Use [this gcloud command](https://cloud.google.com/container-registry/docs/managing#tagging_images) to retag your images to gcr.io/ml-pipeline
1. When choosing the new tag, use the same text as the original release tag of the third party image
| {
"pile_set_name": "Github"
} |
// favicon.ici file in raw data format for PROGMEM
//
const uint8_t favicon_ico[] PROGMEM = {
0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x20, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x02,
0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00,
0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0xc0, 0xc0,
0xc0, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00,
0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x64, 0xe2,
0x64, 0xe6, 0x4e, 0xe6, 0xe2, 0x66, 0xee, 0x6e, 0x24, 0xe2, 0x66, 0xee, 0xe2, 0x66, 0x64, 0xe2,
0x66, 0xe0, 0xee, 0x06, 0xe2, 0x4e, 0x20, 0xee, 0x24, 0xe2, 0x4e, 0x26, 0x6e, 0x66, 0x64, 0xe2,
0x4e, 0x20, 0x6e, 0x06, 0xe2, 0x6e, 0x00, 0x6e, 0x24, 0xe2, 0x6e, 0x66, 0x4e, 0x26, 0x64, 0xee,
0xee, 0x20, 0x04, 0xee, 0xe2, 0x6e, 0x00, 0x6e, 0x24, 0xe2, 0x6e, 0x66, 0x4e, 0x26, 0x64, 0xe2,
0x06, 0xe2, 0x66, 0x06, 0xe6, 0x6e, 0x20, 0xee, 0x24, 0xe2, 0x4e, 0x26, 0x6e, 0x26, 0x64, 0xe2,
0x04, 0xe2, 0x6e, 0xee, 0x66, 0x66, 0xee, 0x6e, 0x24, 0xe2, 0x66, 0xee, 0xe2, 0x66, 0x64, 0xe2,
0x06, 0xe2, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6e, 0x26, 0x66, 0x66, 0x66, 0x66, 0x66, 0x64, 0xee,
0xee, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6e, 0x24, 0xe2, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x64,
0xee, 0xee, 0xee, 0x26, 0x66, 0xee, 0xee, 0x66, 0x4e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x64,
0xe6, 0x66, 0x66, 0x66, 0x6e, 0x66, 0x6e, 0xe6, 0x4e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x64,
0xe6, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xe2, 0x4e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x64,
0xe6, 0x66, 0x66, 0x66, 0x66, 0x66, 0x0e, 0xe6, 0x4e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x64,
0xe6, 0x66, 0x66, 0x66, 0x66, 0x0e, 0xee, 0x66, 0x4e, 0xee, 0xee, 0xe6, 0x66, 0x66, 0x66, 0x64,
0xee, 0xee, 0xe6, 0x66, 0x66, 0xee, 0x66, 0x66, 0x4e, 0x66, 0x64, 0xee, 0x66, 0x66, 0x66, 0x64,
0xe6, 0x66, 0x66, 0x66, 0x4e, 0xe6, 0x66, 0x66, 0x4e, 0x66, 0x66, 0x6e, 0x26, 0x66, 0x66, 0x64,
0xe6, 0x66, 0x66, 0x66, 0x4e, 0x66, 0x66, 0x66, 0x4e, 0x66, 0x66, 0x6e, 0x26, 0x66, 0x66, 0x64,
0xe6, 0x66, 0x66, 0x66, 0x0e, 0xe6, 0x4e, 0x66, 0x4e, 0x66, 0x64, 0xee, 0x66, 0x66, 0x66, 0x64,
0xee, 0xee, 0xee, 0x66, 0x64, 0xee, 0xee, 0x66, 0x4e, 0xee, 0xee, 0xe6, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x84, 0x09, 0x04, 0x11, 0x24,
0xc9, 0x20, 0x13, 0x24, 0xc9, 0x02, 0x03, 0x84, 0xc9, 0x02, 0x19, 0x60, 0xc9, 0x22, 0x19, 0x08,
0x09, 0x04, 0x19, 0x00, 0x08, 0x00, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x08, 0x00, 0x10, 0x02,
0x08, 0x00, 0x10, 0x00, 0x18, 0x00, 0x10, 0x00, 0x08, 0x00, 0x10, 0x00, 0x28, 0x00, 0x10, 0x00,
0x08, 0x40, 0x10, 0x00, 0x08, 0x08, 0x10, 0x02, 0x08, 0x08, 0x10, 0x02, 0x88, 0x40, 0x10, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
} ;
| {
"pile_set_name": "Github"
} |
/*
* Created by Angel Leon (@gubatron), Alden Torres (aldenml)
* Copyright (c) 2011-2017, FrostWire(R). All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.frostwire.gui.library;
import com.frostwire.bittorrent.BTInfoAdditionalMetadataHolder;
import com.frostwire.bittorrent.PaymentOptions;
import com.frostwire.gui.player.MediaPlayer;
import com.limegroup.gnutella.gui.GUIMediator;
import com.limegroup.gnutella.gui.I18n;
import com.limegroup.gnutella.gui.IconManager;
import com.limegroup.gnutella.gui.tables.LimeTableColumn;
import com.limegroup.gnutella.gui.tables.NameHolder;
import com.limegroup.gnutella.gui.tables.SizeHolder;
import com.limegroup.gnutella.gui.util.BackgroundExecutorService;
import org.apache.commons.io.FilenameUtils;
import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.util.Date;
/**
* This class acts as a single line containing all
* the necessary Library info.
*
* @author gubatron
* @author aldenml
*/
public final class LibraryFilesTableDataLine extends AbstractLibraryTableDataLine<File> {
static final int ACTIONS_IDX = 0;
/**
* Constant for the column indicating the mod time of a file.
*/
static final int MODIFICATION_TIME_IDX = 6;
static final int PAYMENT_OPTIONS_IDX = 7;
/**
* Constant for the column with the icon of the file.
*/
private static final int ICON_IDX = 1;
/**
* Constant for the column with the name of the file.
*/
private static final int NAME_IDX = 2;
/**
* Constant for the column storing the size of the file.
*/
private static final int SIZE_IDX = 3;
/**
* Constant for the column storing the file type (extension or more
* more general type) of the file.
*/
private static final int TYPE_IDX = 4;
/**
* Constant for the column storing the file's path
*/
private static final int PATH_IDX = 5;
private static final int LICENSE_IDX = 8;
private static final SizeHolder ZERO_SIZED_HOLDER = new SizeHolder(0);
/**
* Add the columns to static array _in the proper order_.
* The *_IDX variables above need to match the corresponding
* column's position in this array.
*/
private static LimeTableColumn[] ltColumns;
/**
* The model this is being displayed on
*/
private final LibraryFilesTableModel _model;
/**
* Variable for the type
*/
private String _type;
/**
* Cached SizeHolder
*/
private SizeHolder _sizeHolder;
/**
* Variable for the path
*/
private String _path;
/**
* Whether or not the icon has been loaded.
*/
private boolean _iconLoaded = false;
/**
* Whether or not the icon has been scheduled to load.
*/
private boolean _iconScheduledForLoad = false;
private Date lastModified;
private String license;
private PaymentOptions paymentOptions;
private LibraryActionsHolder actionsHolder;
private NameHolder nameCell;
LibraryFilesTableDataLine(LibraryFilesTableModel ltm) {
super();
_model = ltm;
}
public int getColumnCount() {
return getLimeTableColumns().length;
}
/**
* Initialize the object.
* It will fail if not given a FileDesc or a File
* (File is retained for compatibility with the Incomplete folder)
*/
public void initialize(File file) {
super.initialize(file);
String fullPath = file.getPath();
try {
fullPath = file.getCanonicalPath();
} catch (IOException ignored) {
}
String _name = initializer.getName();
_type = "";
if (!file.isDirectory()) {
//_isDirectory = false;
int index = _name.lastIndexOf(".");
int index2 = fullPath.lastIndexOf(File.separator);
_path = fullPath.substring(0, index2);
if (index != -1 && index != 0) {
_type = _name.substring(index + 1);
_name = _name.substring(0, index);
}
} else {
_path = fullPath;
//_isDirectory = true;
}
// only load file sizes, do nothing for directories
// directories implicitly set SizeHolder to null and display nothing
if (initializer.isFile()) {
long _size = initializer.length();
_sizeHolder = new SizeHolder(_size);
} else {
_sizeHolder = ZERO_SIZED_HOLDER;
}
this.lastModified = new Date(initializer.lastModified());
this.actionsHolder = new LibraryActionsHolder(this, false);
this.nameCell = new NameHolder(_name);
if (initializer != null &&
initializer.isFile() &&
FilenameUtils.getExtension(initializer.getName()) != null &&
FilenameUtils.getExtension(initializer.getName()).toLowerCase().endsWith("torrent")) {
BTInfoAdditionalMetadataHolder additionalMetadataHolder = null;
try {
additionalMetadataHolder = new BTInfoAdditionalMetadataHolder(initializer, initializer.getName());
} catch (Throwable t) {
System.err.println("[InvalidTorrent] Can't create BTInfoAdditionalMetadataholder out of " + initializer.getAbsolutePath());
t.printStackTrace();
}
boolean hasLicense = additionalMetadataHolder != null && additionalMetadataHolder.getLicenseBroker() != null;
boolean hasPaymentOptions = additionalMetadataHolder != null && additionalMetadataHolder.getPaymentOptions() != null;
if (hasLicense) {
license = additionalMetadataHolder.getLicenseBroker().getLicenseName();
}
if (license == null) {
license = "";
}
if (hasPaymentOptions) {
paymentOptions = additionalMetadataHolder.getPaymentOptions();
} else {
paymentOptions = new PaymentOptions(null, null);
}
paymentOptions.setItemName(_name);
}
}
/**
* Returns the file of this data line.
*/
public File getFile() {
return initializer;
}
/**
* Returns the object stored in the specified cell in the table.
*
* @param idx The column of the cell to access
* @return The <code>Object</code> stored at the specified "cell" in
* the list
*/
public Object getValueAt(int idx) {
try {
boolean isPlaying = isPlaying();
switch (idx) {
case ACTIONS_IDX:
actionsHolder.setPlaying(isPlaying);
return actionsHolder;
case ICON_IDX:
return new PlayableIconCell(getIcon());
case NAME_IDX:
return nameCell;
case SIZE_IDX:
return new PlayableCell(this, _sizeHolder, _sizeHolder.toString(), isPlaying, idx);
case TYPE_IDX:
return new PlayableCell(this, _type, isPlaying, idx);
case PATH_IDX:
return new PlayableCell(this, _path, isPlaying, idx);
case MODIFICATION_TIME_IDX:
return new PlayableCell(this, lastModified, lastModified.toString(), isPlaying, idx);
case PAYMENT_OPTIONS_IDX:
return paymentOptions;
case LICENSE_IDX:
return license;
}
} catch (Throwable t) {
t.printStackTrace();
}
return null;
}
private boolean isPlaying() {
return initializer != null && MediaPlayer.instance().isThisBeingPlayed(initializer);
}
public LimeTableColumn getColumn(int idx) {
return getLimeTableColumns()[idx];
}
public boolean isClippable(int idx) {
return idx != ICON_IDX;
}
public int getTypeAheadColumn() {
return NAME_IDX;
}
public boolean isDynamic(int idx) {
return false;
}
public String[] getToolTipArray(int col) {
return new String[]{getInitializeObject().getAbsolutePath()};
}
private LimeTableColumn[] getLimeTableColumns() {
if (ltColumns == null) {
ltColumns = new LimeTableColumn[]{new LimeTableColumn(ACTIONS_IDX, "LIBRARY_TABLE_ACTIONS", I18n.tr("Actions"), 18, true, LibraryActionsHolder.class),
//new LimeTableColumn(SHARE_IDX, "LIBRARY_TABLE_SHARE", I18n.tr("Wi-Fi Shared"), 18, true, FileShareCell.class),
new LimeTableColumn(ICON_IDX, "LIBRARY_TABLE_ICON", I18n.tr("Icon"), GUIMediator.getThemeImage("question_mark"), 18, true, PlayableIconCell.class),
new LimeTableColumn(NAME_IDX, "LIBRARY_TABLE_NAME", I18n.tr("Name"), 239, true, NameHolder.class),
new LimeTableColumn(SIZE_IDX, "LIBRARY_TABLE_SIZE", I18n.tr("Size"), 62, true, PlayableCell.class),
new LimeTableColumn(TYPE_IDX, "LIBRARY_TABLE_TYPE", I18n.tr("Type"), 48, true, PlayableCell.class),
new LimeTableColumn(PATH_IDX, "LIBRARY_TABLE_PATH", I18n.tr("Path"), 108, true, PlayableCell.class),
new LimeTableColumn(MODIFICATION_TIME_IDX, "LIBRARY_TABLE_MODIFICATION_TIME", I18n.tr("Last Modified"), 20, true, PlayableCell.class),
new LimeTableColumn(PAYMENT_OPTIONS_IDX, "LIBRARY_TABLE_PAYMENT_OPTIONS", I18n.tr("Tips/Donations"), 20, false, PaymentOptions.class),
new LimeTableColumn(LICENSE_IDX, "LIBRARY_TABLE_LICENSE", I18n.tr("License"), 100, true, String.class),
};
}
return ltColumns;
}
private Icon getIcon() {
boolean iconAvailable = IconManager.instance().isIconForFileAvailable(initializer);
if (!iconAvailable && !_iconScheduledForLoad) {
_iconScheduledForLoad = true;
BackgroundExecutorService.schedule(() -> GUIMediator.safeInvokeAndWait(() -> {
IconManager.instance().getIconForFile(initializer);
_iconLoaded = true;
_model.refresh();
}));
return null;
} else if (_iconLoaded || iconAvailable) {
return IconManager.instance().getIconForFile(initializer);
} else {
return null;
}
}
}
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import <NLP/NSObject-Protocol.h>
@class NSString;
@protocol NLParsecNamedEntity <NSObject>
@property(readonly, nonatomic) float score;
@property(readonly, nonatomic) unsigned char category;
@property(readonly, nonatomic) NSString *name;
@end
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2017 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 "modules/desktop_capture/window_finder_win.h"
#include <windows.h>
#include <memory>
namespace webrtc {
WindowFinderWin::WindowFinderWin() = default;
WindowFinderWin::~WindowFinderWin() = default;
WindowId WindowFinderWin::GetWindowUnderPoint(DesktopVector point) {
HWND window = WindowFromPoint(POINT{point.x(), point.y()});
if (!window) {
return kNullWindowId;
}
// The difference between GA_ROOTOWNER and GA_ROOT can be found at
// https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/Hirr_DkuZdw.
// In short, we should use GA_ROOT, since we only care about the root window
// but not the owner.
window = GetAncestor(window, GA_ROOT);
if (!window) {
return kNullWindowId;
}
return reinterpret_cast<WindowId>(window);
}
// static
std::unique_ptr<WindowFinder> WindowFinder::Create(
const WindowFinder::Options& options) {
return std::make_unique<WindowFinderWin>();
}
} // namespace webrtc
| {
"pile_set_name": "Github"
} |
# Lyapunov Exponents
Lyapunov exponents measure exponential rates of separation of nearby trajectories in the flow
of a dynamical system. The [Wikipedia](https://en.wikipedia.org/wiki/Lyapunov_exponent) and the [Scholarpedia](http://www.scholarpedia.org/article/Lyapunov_exponent) entries have a lot of valuable information about the history and usage of these quantities.
This page treats systems where the equations of motion are known. If instead
you have numerical data, see [`numericallyapunov`](@ref).
!!! info "Performance depends on the solver"
Notice that the performance of functions that use `ContinuousDynamicalSystem`s depend crucially on the chosen solver. Please see the documentation page on [Choosing a solver](@ref) for an in-depth discussion.
## Concept of the Lyapunov exponent
Before providing the documentation of the offered functionality, it is good to demonstrate exactly *what* are the Lyapunov exponents.
For chaotic systems, nearby trajectories separate in time exponentially fast (while for stable systems they come close exponentially fast). This happens at least for small separations, and is demonstrated in the following sketch:
.
In this sketch ``\lambda`` is the maximum Lyapunov exponent (and in general a system has as many exponents as its dimensionality).
Let's demonstrate these concepts using a real system, the Henon map:
```math
\begin{aligned}
x_{n+1} &= 1 - ax_n^2 + y_n \\
y_{n+1} &= bx_n
\end{aligned}
```
Let's get a trajectory
```@example lyap
using DynamicalSystems, PyPlot
henon = Systems.henon()
tr1 = trajectory(henon, 100)
summary(tr1)
```
and create one more trajectory that starts very close to the first one
```@example lyap
u2 = get_state(henon) + (1e-9 * ones(dimension(henon)))
tr2 = trajectory(henon, 100, u2)
summary(tr2)
```
We now want to demonstrate how the distance between these two trajectories increases with time:
```@example lyap
using LinearAlgebra: norm
figure(figsize=(8,5))
# Plot the x-coordinate of the two trajectories:
ax1 = subplot(2,1,1)
plot(tr1[:, 1], alpha = 0.5)
plot(tr2[:, 1], alpha = 0.5)
ylabel("x")
# Plot their distance in a semilog plot:
ax2 = subplot(2,1,2, sharex = ax1)
d = [norm(tr1[i] - tr2[i]) for i in 1:length(tr2)]
ylabel("d"); xlabel("n"); semilogy(d);
tight_layout() # hide
savefig("demonstration.png"); nothing # hide
```

The *initial* slope of the `d` vs `n` plot (before the curve saturates) is approximately the maximum Lyapunov exponent!
## Lyapunov Spectrum
The function `lyapunovs` calculates the entire spectrum of the Lyapunov
exponents of a system:
```@docs
lyapunovs
```
---
As you can see, the documentation string is detailed and self-contained. For example,
the Lyapunov spectrum of the [folded towel map](http://www.scholarpedia.org/article/Hyperchaos)
is calculated as:
```@example lyap
using DynamicalSystems
ds = Systems.towel()
λλ = lyapunovs(ds, 10000)
```
Similarly, for a continuous system, e.g. the Lorenz system, you would do:
```@example lyap
lor = Systems.lorenz(ρ = 32.0) #this is not the original parameter!
λλ = lyapunovs(lor, 10000, dt = 0.1)
```
`lyapunovs` is also very fast:
```julia
using BenchmarkTools
ds = Systems.towel()
@btime lyapunovs($ds, 2000);
```
```
237.226 μs (45 allocations: 4.27 KiB)
```
Here is an example of plotting the exponents of the Henon map for various parameters:
```@example lyap
using DynamicalSystems, PyPlot
he = Systems.henon()
as = 0.8:0.005:1.225; λs = zeros(length(as), 2)
for (i, a) in enumerate(as)
set_parameter!(he, 1, a)
λs[i, :] .= lyapunovs(he, 10000; Ttr = 500)
end
figure()
plot(as, λs); xlabel("\$a\$"); ylabel("\$\\lambda\$")
tight_layout() # hide
savefig("heλ.png"); nothing # hide
```

## Maximum Lyapunov Exponent
It is possible to get only the maximum Lyapunov exponent simply by giving
`1` as the third argument of [`lyapunovs`](@ref). However, there is a second algorithm that allows you to do the same thing, which is offered by the function `lyapunov`:
```@docs
lyapunov
```
---
For example:
```@example lyap
using DynamicalSystems, PyPlot
henon = Systems.henon()
λ = lyapunov(henon, 10000, d0 = 1e-7, upper_threshold = 1e-4, Ttr = 100)
```
The same is done for continuous systems:
```@example lyap
lor = Systems.lorenz(ρ = 32)
λ = lyapunov(lor, 10000.0, dt = 10.0, Ttr = 100.0)
```
| {
"pile_set_name": "Github"
} |
package io.fabric8.funktion.connector;
public class ConnectorMarker{}
| {
"pile_set_name": "Github"
} |
//---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <[email protected]>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_TYPES_PAIR_HPP
#define BOOST_COMPUTE_TYPES_PAIR_HPP
#include <string>
#include <utility>
#include <boost/compute/functional/get.hpp>
#include <boost/compute/type_traits/type_definition.hpp>
#include <boost/compute/type_traits/type_name.hpp>
#include <boost/compute/detail/meta_kernel.hpp>
namespace boost {
namespace compute {
namespace detail {
// meta_kernel operator for std::pair literals
template<class T1, class T2>
inline meta_kernel&
operator<<(meta_kernel &kernel, const std::pair<T1, T2> &x)
{
kernel << "(" << type_name<std::pair<T1, T2> >() << ")"
<< "{" << kernel.make_lit(x.first) << ", "
<< kernel.make_lit(x.second) << "}";
return kernel;
}
// inject_type() specialization for std::pair
template<class T1, class T2>
struct inject_type_impl<std::pair<T1, T2> >
{
void operator()(meta_kernel &kernel)
{
typedef std::pair<T1, T2> pair_type;
kernel.inject_type<T1>();
kernel.inject_type<T2>();
kernel.add_type_declaration<pair_type>(type_definition<pair_type>());
}
};
// get<N>() result type specialization for std::pair<>
template<class T1, class T2>
struct get_result_type<0, std::pair<T1, T2> >
{
typedef T1 type;
};
template<class T1, class T2>
struct get_result_type<1, std::pair<T1, T2> >
{
typedef T2 type;
};
// get<N>() specialization for std::pair<>
template<size_t N, class Arg, class T1, class T2>
inline meta_kernel& operator<<(meta_kernel &kernel,
const invoked_get<N, Arg, std::pair<T1, T2> > &expr)
{
kernel.inject_type<std::pair<T1, T2> >();
return kernel << expr.m_arg << (N == 0 ? ".first" : ".second");
}
} // end detail namespace
namespace detail {
// type_name() specialization for std::pair
template<class T1, class T2>
struct type_name_trait<std::pair<T1, T2> >
{
static const char* value()
{
static std::string name =
std::string("_pair_") +
type_name<T1>() + "_" + type_name<T2>() +
"_t";
return name.c_str();
}
};
// type_definition() specialization for std::pair
template<class T1, class T2>
struct type_definition_trait<std::pair<T1, T2> >
{
static std::string value()
{
typedef std::pair<T1, T2> pair_type;
std::stringstream declaration;
declaration << "typedef struct {\n"
<< " " << type_name<T1>() << " first;\n"
<< " " << type_name<T2>() << " second;\n"
<< "} " << type_name<pair_type>() << ";\n";
return declaration.str();
}
};
} // end detail namespace
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_TYPES_PAIR_HPP
| {
"pile_set_name": "Github"
} |
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.joanzapata.pdfview</groupId>
<artifactId>android-pdfview-parent</artifactId>
<name>Android PDFView parent</name>
<description>An easy-to-use Android PDFView component with swipe and zoom</description>
<packaging>pom</packaging>
<version>1.0.5-SNAPSHOT</version>
<url>http://joanzapata.com/android-pdfview/</url>
<inceptionYear>2013</inceptionYear>
<licenses>
<license>
<name>Apache 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<scm>
<url>http://github.com/JoanZapata/android-pdfview/</url>
<connection>scm:git:git://github.com/JoanZapata/android-pdfview.git</connection>
<developerConnection>scm:git:ssh://[email protected]/JoanZapata/android-pdfview.git</developerConnection>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<name>Joan Zapata</name>
<email>[email protected]</email>
<url>http://joanzapata.com</url>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven-compiler-plugin.version>3.0</maven-compiler-plugin.version>
<java.version>1.6</java.version>
<android-maven-plugin.version>3.8.2</android-maven-plugin.version>
<android.version>4.1.1.4</android.version>
<api.platform>16</api.platform>
<androidannotations.version>2.7</androidannotations.version>
<actionBarSherlock.version>4.2.0</actionBarSherlock.version>
<maven-jarsigner.version>1.2</maven-jarsigner.version>
<maven-license.version>1.10.b1</maven-license.version>
<password />
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android-maven-plugin.version}</version>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>${project.basedir}/libs</nativeLibrariesDirectory>
<sdk>
<platform>${api.platform}</platform>
</sdk>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<version>${maven-license.version}</version>
<configuration>
<header>HEADER.txt</header>
<excludes>
<exclude>**/.idea/**</exclude>
<exclude>**/vudroid/**</exclude>
<exclude>**/libs/**</exclude>
<exclude>**/*.iml</exclude>
<exclude>LICENSE.txt</exclude>
<exclude>HEADER.txt</exclude>
<exclude>RELEASE.md</exclude>
<exclude>**/.gitignore</exclude>
<exclude>README.md</exclude>
<exclude>**/keystore</exclude>
</excludes>
<strictCheck>true</strictCheck>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<inherited>false</inherited>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>gradlew</executable>
<arguments>
<argument>clean</argument>
<argument>assemble</argument>
<argument>-Pversion=${project.version}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<modules>
<module>android-pdfview</module>
<module>android-pdfview-sample</module>
</modules>
</project>
| {
"pile_set_name": "Github"
} |
package fun.sherman.observer1.event;
/**
* Created on 2020/5/11
*
* @author sherman tang
*/
public abstract class WeatherEvent {
/**
* 获取天气状况
*/
public abstract void getWeather();
}
| {
"pile_set_name": "Github"
} |
/*
* This file is part of Hootenanny.
*
* Hootenanny is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --------------------------------------------------------------------
*
* The following copyright notices are generated automatically. If you
* have a new notice to add, please use the format:
* " * @copyright Copyright ..."
* This will properly maintain the copyright information. DigitalGlobe
* copyrights will be updated automatically.
*
* @copyright Copyright (C) 2015, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
*/
#ifndef __TGS__RTREE_NODE_H__
#define __TGS__RTREE_NODE_H__
// Tgs
#include <tgs/RStarTree/Box.h>
#include <tgs/RStarTree/Page.h>
#include <tgs/RStarTree/PageStore.h>
// Standard
#include <iostream>
#include <memory>
namespace Tgs
{
class RTreeNode;
class RTreeNodeStore;
class RTreeNodeTest;
class TGS_EXPORT BoxInternalData
{
public:
/**
* Calculates the distance from the centroid of this box to the centroid of Box b.
*/
double calculateCentroidDistance(const Box& b) const;
/**
* Calculate the amount this box would have to expand in order to include the box specified.
*/
double calculateExpansion(const Box& b) const;
/**
* Calculates the overlap between this box and b.
*/
double calculateOverlap(const Box& b) const;
double calculateVolume() const;
int getDimensions() const;
double getLowerBound(int d) const;
double getUpperBound(int d) const;
double getLowerBoundRaw(int d) const;
double getUpperBoundRaw(int d) const;
bool isContained(const Box& b) const;
void setBounds(int d, double lower, double upper);
/**
* Returns the number of bytes this structure will take up with the given number of
* dimensions.
*/
static int size(int dimensions);
Box toBox() const;
private:
friend class RTreeNode;
BoxInternalData(int dimensions, const char* data);
BoxInternalData(int dimensions, const char* data, const Box& b);
const char* _data;
int _dimensions;
};
inline double BoxInternalData::getLowerBoundRaw(int d) const
{
const double* v = (const double*)_data;
return v[d * 2];
}
inline double BoxInternalData::getUpperBoundRaw(int d) const
{
const double* v = (const double*)_data;
return v[d * 2 + 1];
}
/**
* This class is filled with yucky pointer math. If you aren't "old school" you probably want
* to turn tail and run.
*
* The const methods are defined as const for a reason. If this is causing you problems you will
* want to think long and hard before changing them.
*/
class TGS_EXPORT RTreeNode
{
public:
virtual ~RTreeNode();
/**
* This is only intended for RStarTree class
*/
void addChild(const Box& envelope, int id);
/**
* Append this child onto the known list of children. Calling this method is only valid if
* the node is empty or a non-leaf.
*/
void addNodeChild(RTreeNode* node);
/**
* Append this child onto the known list of user defined children. Calling this method is
* only valid if the node is empty or a non-leaf.
*/
void addUserChild(const Box& envelope, int id);
/**
* Calculate the envelope of all the boxes and return it.
*/
Box calculateEnvelope() const;
/**
* Remove all children and reset to the default state. This should be called if this is a new
* RTreeNode w/ uninitialized data.
*/
void clear();
/**
* Returns the index of a child for the given id. If there are more than one children with
* the given id the first index is returned. If the id isn't found a -1 is returned.
*/
int convertChildIdToIndex(int id) const;
/**
* Returns the number of children that have been assigned.
*/
int getChildCount() const;
/**
* Returns the envelope for a specific child index
* @param childIndex >= 0 && < getChildCount()
*/
const BoxInternalData getChildEnvelope(int childIndex) const;
/**
* This method should rarely be used, and probably only be internal structure, not iterators
* You probably want to use either getChildUserId. This is not const for that reason.
*/
int getChildId(int childIndex);
/**
* Returns the node ID for a specific child index. Calling this method is not valid if this
* node is a leaf node.
* @param childIndex >= 0 && < getChildCount()
*/
int getChildNodeId(int childIndex) const;
/**
* Returns the user ID for a specific child index. Calling this method is not valid if this
* node is not a leaf node.
* @param childIndex >= 0 && < getChildCount()
*/
int getChildUserId(int childIndex) const;
/**
* Returns the number of dimensions for this node
*/
int getDimensions() const { return _dimensions; }
/**
* Returns this node's ID
*/
int getId() const { return _id; }
int getMaxChildCount() const { return _maxChildCount; }
int getParentId() const;
/**
* Returns true if this is a leaf node.
*/
bool isLeafNode() const;
/**
* Removes the specified child from the list. All children to the right will be shifted one
* space left.
*/
void removeChild(int childIndex);
/**
* Removes a series of children by index. The vector _will_ be modified.
*/
void removeChildren(std::vector<int>& childIndexes);
/**
* Marks this node as dirty so it will be saved.
*/
void setDirty() { _page->setDirty(); }
/**
* Sets the parent id.
*/
void setParentId(int id);
/**
* Updates the bounding box that this child has.
*/
void updateChildEnvelope(int childIndex, const Box& b);
void updateChild(int childIndex, int id, const Box& b);
private:
friend class RTreeNodeStore;
friend class RTreeNodeTest;
struct Header
{
int childCount;
int parentId;
};
struct ChildData
{
int id;
const char* getBox() const { return ((const char*)&id) + 4; }
char* getBox() { return ((char*)&id) + 4; }
};
RTreeNode(int dimensions, const std::shared_ptr<Page>& page);
/**
* Return the start of the child's data. This includes the box (BoxInternalData) and the
* index.
*/
ChildData* _getChildPtr(int index);
/**
* Similar to above.
*/
const ChildData* _getChildPtr(int index) const;
/**
* Return the number of bytes that a child takes up.
*/
int _getChildSize() const;
Header* _getHeader();
const Header* _getHeader() const;
static int _getHeaderSize() { return sizeof(Header); }
int _maxChildCount;
int _dimensions;
mutable std::shared_ptr<Page> _pageSp;
/// pointer to the same thing as above, only faster. Zoom zoom!
mutable Page* _page;
int _id;
};
inline std::ostream& operator<<(std::ostream & o, RTreeNode& n)
{
int size = n.getChildCount();
o << "id: " << n.getId() << " parent: " << n.getParentId() << " children: {";
for (int i = 0; i < size; ++i)
{
o << n.getChildId(i);
if (i != size - 1)
{
o << ", ";
}
}
o << "}";
return o;
}
}
#endif
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.