text
stringlengths 2
99.9k
| meta
dict |
---|---|
/*
* Copyright 2005-2020 Sixth and Red River Software, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sixrr.stockmetrics.packageCalculators;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiRecursiveElementVisitor;
import com.sixrr.metrics.Metric;
import com.sixrr.stockmetrics.utils.TodoUtil;
public class TodoCommentCountRecursivePackageCalculator extends ElementCountPackageCalculator {
public TodoCommentCountRecursivePackageCalculator(Metric metric) {
super(metric);
}
@Override
protected PsiElementVisitor createVisitor() {
return new Visitor();
}
private class Visitor extends PsiRecursiveElementVisitor {
@Override
public void visitFile(PsiFile file) {
incrementCountRecursive(file, TodoUtil.getTodoItemsCount(file));
}
}
}
| {
"pile_set_name": "Github"
} |
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/source/source_range.dart';
import 'package:analyzer_plugin/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/utilities/assist/assist.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
import 'package:over_react_analyzer_plugin/src/assist/contributor_base.dart';
import 'package:over_react_analyzer_plugin/src/component_usage.dart';
import 'package:over_react_analyzer_plugin/src/util/fix.dart';
import 'package:over_react_analyzer_plugin/src/util/linked_edits.dart';
import 'package:over_react_analyzer_plugin/src/util/node.dart';
typedef BoilerplateLinkedEditFn = void Function(
DartEditBuilder builder, {
String groupName,
String componentFactoryName,
String Function({int indent}) getComponentRenderReturnValueSrc,
});
abstract class _ExtractComponentAssistContributorBase extends AssistContributorBase {
AssistKind get _assistKind;
String get linkedEditGroupName;
BoilerplateLinkedEditFn get addBoilerplateLinkedEditFn;
@override
Future<void> computeAssists(DartAssistRequest request, AssistCollector collector) async {
// Only compute when there's a selection
//
// TODO: Its pretty annoying that if your selection includes the semi-colon at the end of a return statement, the length is zero.
if (request.length == 0) return;
await super.computeAssists(request, collector);
if (!setupCompute()) return;
await _extractComponent();
}
Future<void> _extractComponent() async {
final usage = identifyUsage(node);
if (usage == null) return;
final sourceChange = await buildFileEdit(request.result, (builder) {
// TODO: It would be nice to ensure that an OverReact generated part directive is added, but it doesn't seem possible without screwing up the offsets for all the edits that follow.
final content = request.result.content;
builder.addInsertion(content.length, (builder) {
builder.write('\n');
addBoilerplateLinkedEditFn(
builder,
groupName: linkedEditGroupName,
getComponentRenderReturnValueSrc: ({indent}) {
return getNodeSource(
usage.node,
content,
request.result.lineInfo,
indent: indent,
firstLineIndent: 0,
);
},
);
});
builder.addReplacement(SourceRange(usage.node.offset, usage.node.length), (builder) {
builder.addSimpleLinkedEdit(linkedEditGroupName, 'Foo');
builder.write('()()');
});
});
sourceChange
..message = _assistKind.message
..id = _assistKind.id;
collector.addAssist(PrioritizedSourceChange(_assistKind.priority, sourceChange));
}
}
const _extractComponentDesc = r'Extract selection as a new UiComponent';
// <editor-fold desc="Documentation Details">
const _extractComponentDetails = r'''
When a VDom element is selected by the user, the assist extracts the selection into the return value of
`render` within a new OverReact component declaration:
**EXAMPLE:**
```
ReactElement renderTheFoo() {
return Dom.div()(
'oh hai',
Dom.span()('again'),
Dom.em()(' wow this is a lot we should extract it into a component!'),
);
}
```
**BECOMES:**
```
ReactElement renderTheFoo() {
return Foo()();
}
UiFactory<FooProps> Foo = _$Foo; // ignore: undefined_identifier
mixin FooProps on UiProps {}
class FooComponent extends UiComponent2<FooProps> {
@override
get defaultProps => (newProps());
@override
render() {
return Dom.div()(
'oh hai',
Dom.span()('again'),
Dom.em()(' wow this is a lot we should extract it into a component!'),
);
}
}
```
''';
// </editor-fold>
/// An assist that extracts an [InvocationExpression] which returns a React VDom `ReactElement`
/// into a new standalone OverReact `UiComponent2` component.
///
/// Caveats:
///
/// 1. The user's selection must include the builder and the invocation of that builder for the assist to appear
/// 2. The user's selection cannot include any trailing semi-colons
///
/// > Related: [ExtractStatefulComponentAssistContributor]
///
/// {@category Assists}
class ExtractComponentAssistContributor extends _ExtractComponentAssistContributorBase {
@DocsMeta(_extractComponentDesc, details: _extractComponentDetails)
static const extractComponent = AssistKind('extractComponent', 32, _extractComponentDesc);
@override
get _assistKind => extractComponent;
@override
String get linkedEditGroupName => 'orStless';
@override
BoilerplateLinkedEditFn addBoilerplateLinkedEditFn = addUiComponentBoilerplateLinkedEdit;
}
const _extractStatefulComponentDesc = r'Extract selection as a new UiStatefulComponent';
// <editor-fold desc="Stateful Documentation Details">
const _extractStatefulComponentDetails = r'''
When a VDom element is selected by the user, the assist extracts the selection into the return value of
`render` within a new OverReact stateful component declaration:
**EXAMPLE:**
```
ReactElement renderTheFoo() {
return Dom.div()(
'oh hai',
Dom.span()('again'),
Dom.em()(' wow this is a lot we should extract it into a component!'),
);
}
```
**BECOMES:**
```
ReactElement renderTheFoo() {
return Foo()();
}
UiFactory<FooProps> Foo = _$Foo; // ignore: undefined_identifier
mixin FooProps on UiProps {}
mixin FooState on UiState {}
class FooComponent extends UiStatefulComponent2<FooProps, FooState> {
@override
get defaultProps => (newProps());
@override
get initialState => (newState());
@override
render() {
return Dom.div()(
'oh hai',
Dom.span()('again'),
Dom.em()(' wow this is a lot we should extract it into a component!'),
);
}
}
```
''';
// </editor-fold>
/// An assist that extracts an [InvocationExpression] which returns a React VDom `ReactElement`
/// into a new standalone OverReact `UiStatefulComponent2` component.
///
/// Caveats:
///
/// 1. The user's selection must include the builder and the invocation of that builder for the assist to appear
/// 2. The user's selection cannot include any trailing semi-colons
///
/// > Related: [ExtractComponentAssistContributor]
///
/// {@category Assists}
class ExtractStatefulComponentAssistContributor extends _ExtractComponentAssistContributorBase {
@DocsMeta(_extractStatefulComponentDesc, details: _extractStatefulComponentDetails)
static const extractComponent = AssistKind('extractStatefulComponent', 32, _extractStatefulComponentDesc);
@override
get _assistKind => extractComponent;
@override
String get linkedEditGroupName => 'orStful';
@override
BoilerplateLinkedEditFn addBoilerplateLinkedEditFn = addUiStatefulComponentBoilerplateLinkedEdit;
}
| {
"pile_set_name": "Github"
} |
<?php
// +----------------------------------------------------------------------
// | WeiPHP [ 公众号和小程序运营管理系统 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://www.weiphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 凡星 <[email protected]> <QQ:203163051>
// +----------------------------------------------------------------------
namespace app\common\controller;
/**
* 插件类
*
* @author yangweijie <[email protected]>
*/
abstract class InfoBase
{
/**
* 视图实例对象
*
* @var view
* @access protected
*/
protected $view = null;
/**
* $info = array(
* 'name'=>'Editor',
* 'title'=>'编辑器',
* 'description'=>'用于增强整站长文本的输入和显示',
* 'status'=>1,
* 'author'=>'weiphp',
* 'version'=>'0.1'
* )
*/
public $info = [];
public $addon_path = '';
public $config_file = '';
public $custom_config = '';
public $admin_list = [];
public $custom_adminlist = '';
public $access_url = [];
// 自定义权限规则
public $auth_rule = [];
// 自定义积分规则
public $credit_config = [];
// 自定义入口地址,默认是lists或者config
public $init_url = [];
public function __construct()
{
$this->view = new \think\facade\View();
$this->addon_path = env('app_path') . $this->getName() . '/';
$TMPL_PARSE_STRING = config('TMPL_PARSE_STRING');
$TMPL_PARSE_STRING['__ADDONROOT__'] = __ROOT__ . '/' . $this->getName();
config('TMPL_PARSE_STRING', $TMPL_PARSE_STRING);
if (is_file($this->addon_path . 'config.php')) {
$this->config_file = $this->addon_path . 'config.php';
}
}
/**
* 模板主题设置
*
* @access protected
* @param string $theme
* 模版主题
* @return Action
*/
final protected function theme($theme)
{
$this->view->theme($theme);
return $this;
}
// 显示方法
final protected function display($template = '')
{
if ($template == '')
$template = CONTROLLER_NAME;
echo ($this->fetch($template));
}
/**
* 模板变量赋值
*
* @access protected
* @param mixed $name
* 要显示的模板变量
* @param mixed $value
* 变量的值
* @return Action
*/
final protected function assign($name, $value = '')
{
$this->view->assign($name, $value);
return $this;
}
// 用于显示模板的方法
final protected function fetch($templateFile = CONTROLLER_NAME)
{
if (! is_file($templateFile)) {
$templateFile = $this->addon_path . $templateFile . config('TMPL_TEMPLATE_SUFFIX');
if (! is_file($templateFile)) {
throw new \Exception("模板不存在:$templateFile");
}
}
return $this->view->fetch($templateFile);
}
final public function getName()
{
$class = get_class($this);
$rpos =strrpos($class, '\\');
$ipos =stripos($class, '\\');
return substr($class, $ipos + 1, $rpos-$ipos-1);
}
final public function checkInfo()
{
$info_check_keys = array(
'name',
'title',
'description',
'status',
'author',
'version'
);
foreach ($info_check_keys as $value) {
if (! array_key_exists($value, $this->info))
return FALSE;
}
return TRUE;
}
/**
* 获取插件的配置数组
*/
final public function getConfig($name = '')
{
if (empty($name)) {
$name = $this->getName();
}
return getAddonConfig($name);
}
// 必须实现安装
abstract public function install();
// 必须卸载插件方法
abstract public function uninstall();
}
| {
"pile_set_name": "Github"
} |
var stream = require('readable-stream')
var eos = require('end-of-stream')
var util = require('util')
var SIGNAL_FLUSH = new Buffer([0])
var onuncork = function(self, fn) {
if (self._corked) self.once('uncork', fn)
else fn()
}
var destroyer = function(self, end) {
return function(err) {
if (err) self.destroy(err.message === 'premature close' ? null : err)
else if (end && !self._ended) self.end()
}
}
var end = function(ws, fn) {
if (!ws) return fn()
if (ws._writableState && ws._writableState.finished) return fn()
if (ws._writableState) return ws.end(fn)
ws.end()
fn()
}
var toStreams2 = function(rs) {
return new (stream.Readable)({objectMode:true, highWaterMark:16}).wrap(rs)
}
var Duplexify = function(writable, readable, opts) {
if (!(this instanceof Duplexify)) return new Duplexify(writable, readable, opts)
stream.Duplex.call(this, opts)
this._writable = null
this._readable = null
this._readable2 = null
this._forwardDestroy = !opts || opts.destroy !== false
this._forwardEnd = !opts || opts.end !== false
this._corked = 1 // start corked
this._ondrain = null
this._drained = false
this._forwarding = false
this._unwrite = null
this._unread = null
this._ended = false
this.destroyed = false
if (writable) this.setWritable(writable)
if (readable) this.setReadable(readable)
}
util.inherits(Duplexify, stream.Duplex)
Duplexify.obj = function(writable, readable, opts) {
if (!opts) opts = {}
opts.objectMode = true
opts.highWaterMark = 16
return new Duplexify(writable, readable, opts)
}
Duplexify.prototype.cork = function() {
if (++this._corked === 1) this.emit('cork')
}
Duplexify.prototype.uncork = function() {
if (this._corked && --this._corked === 0) this.emit('uncork')
}
Duplexify.prototype.setWritable = function(writable) {
if (this._unwrite) this._unwrite()
if (this.destroyed) {
if (writable && writable.destroy) writable.destroy()
return
}
if (writable === null || writable === false) {
this.end()
return
}
var self = this
var unend = eos(writable, {writable:true, readable:false}, destroyer(this, this._forwardEnd))
var ondrain = function() {
var ondrain = self._ondrain
self._ondrain = null
if (ondrain) ondrain()
}
var clear = function() {
self._writable.removeListener('drain', ondrain)
unend()
}
if (this._unwrite) process.nextTick(ondrain) // force a drain on stream reset to avoid livelocks
this._writable = writable
this._writable.on('drain', ondrain)
this._unwrite = clear
this.uncork() // always uncork setWritable
}
Duplexify.prototype.setReadable = function(readable) {
if (this._unread) this._unread()
if (this.destroyed) {
if (readable && readable.destroy) readable.destroy()
return
}
if (readable === null || readable === false) {
this.push(null)
this.resume()
return
}
var self = this
var unend = eos(readable, {writable:false, readable:true}, destroyer(this))
var onreadable = function() {
self._forward()
}
var onend = function() {
self.push(null)
}
var clear = function() {
self._readable2.removeListener('readable', onreadable)
self._readable2.removeListener('end', onend)
unend()
}
this._drained = true
this._readable = readable
this._readable2 = readable._readableState ? readable : toStreams2(readable)
this._readable2.on('readable', onreadable)
this._readable2.on('end', onend)
this._unread = clear
this._forward()
}
Duplexify.prototype._read = function() {
this._drained = true
this._forward()
}
Duplexify.prototype._forward = function() {
if (this._forwarding || !this._readable2 || !this._drained) return
this._forwarding = true
var data
var state = this._readable2._readableState
while ((data = this._readable2.read(state.buffer.length ? state.buffer[0].length : state.length)) !== null) {
this._drained = this.push(data)
}
this._forwarding = false
}
Duplexify.prototype.destroy = function(err) {
if (this.destroyed) return
this.destroyed = true
var self = this
process.nextTick(function() {
self._destroy(err)
})
}
Duplexify.prototype._destroy = function(err) {
if (err) {
var ondrain = this._ondrain
this._ondrain = null
if (ondrain) ondrain(err)
else this.emit('error', err)
}
if (this._forwardDestroy) {
if (this._readable && this._readable.destroy) this._readable.destroy()
if (this._writable && this._writable.destroy) this._writable.destroy()
}
this.emit('close')
}
Duplexify.prototype._write = function(data, enc, cb) {
if (this.destroyed) return cb()
if (this._corked) return onuncork(this, this._write.bind(this, data, enc, cb))
if (data === SIGNAL_FLUSH) return this._finish(cb)
if (!this._writable) return cb()
if (this._writable.write(data) === false) this._ondrain = cb
else cb()
}
Duplexify.prototype._finish = function(cb) {
var self = this
this.emit('preend')
onuncork(this, function() {
end(self._forwardEnd && self._writable, function() {
// haxx to not emit prefinish twice
if (self._writableState.prefinished === false) self._writableState.prefinished = true
self.emit('prefinish')
onuncork(self, cb)
})
})
}
Duplexify.prototype.end = function(data, enc, cb) {
if (typeof data === 'function') return this.end(null, null, data)
if (typeof enc === 'function') return this.end(data, null, enc)
this._ended = true
if (data) this.write(data)
if (!this._writableState.ending) this.write(SIGNAL_FLUSH)
return stream.Writable.prototype.end.call(this, cb)
}
module.exports = Duplexify | {
"pile_set_name": "Github"
} |
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_FILTERS_IN_MEMORY_URL_PROTOCOL_H_
#define MEDIA_FILTERS_IN_MEMORY_URL_PROTOCOL_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "media/filters/ffmpeg_glue.h"
namespace media {
// Simple FFmpegURLProtocol that reads from a buffer.
// NOTE: This object does not copy the buffer so the
// buffer pointer passed into the constructor
// needs to remain valid for the entire lifetime of
// this object.
class MEDIA_EXPORT InMemoryUrlProtocol : public FFmpegURLProtocol {
public:
InMemoryUrlProtocol(const uint8* buf, int64 size, bool streaming);
virtual ~InMemoryUrlProtocol();
// FFmpegURLProtocol methods.
virtual int Read(int size, uint8* data) OVERRIDE;
virtual bool GetPosition(int64* position_out) OVERRIDE;
virtual bool SetPosition(int64 position) OVERRIDE;
virtual bool GetSize(int64* size_out) OVERRIDE;
virtual bool IsStreaming() OVERRIDE;
private:
const uint8* data_;
int64 size_;
int64 position_;
bool streaming_;
DISALLOW_IMPLICIT_CONSTRUCTORS(InMemoryUrlProtocol);
};
} // namespace media
#endif // MEDIA_FILTERS_IN_MEMORY_URL_PROTOCOL_H_
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2002-2016 the original author or 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.context.junit.jupiter;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Demo <em>composed annotation</em> for {@link EnabledIf @EnabledIf} that
* enables a test class or test method if the current operating system is
* Mac OS.
*
* @author Sam Brannen
* @since 5.0
*/
@Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@EnabledIf(expression = "#{systemProperties['os.name'].toLowerCase().contains('mac')}", reason = "Enabled on Mac OS")
public @interface EnabledOnMac {
}
| {
"pile_set_name": "Github"
} |
using System;
using Newtonsoft.Json;
namespace Alipay.AopSdk.Core.Domain
{
/// <summary>
/// KoubeiMarketingCampaignUserAssetQueryModel Data Structure.
/// </summary>
[Serializable]
public class KoubeiMarketingCampaignUserAssetQueryModel : AopObject
{
/// <summary>
/// 页码
/// </summary>
[JsonProperty("page_num")]
public long PageNum { get; set; }
/// <summary>
/// 每页显示数目(最大查询50)
/// </summary>
[JsonProperty("page_size")]
public long PageSize { get; set; }
/// <summary>
/// 查询范围:用户所有资产(USER_ALL_ASSET),用户指定商户可用资产(USER_MERCHANT_ASSET),用户指定门店可用资产(USER_SHOP_ASSET);指定USER_SHOP_ASSET必须传递shopid
/// </summary>
[JsonProperty("scope")]
public string Scope { get; set; }
/// <summary>
/// 门店id,如果查询范围是门店,门店id不能为空
/// </summary>
[JsonProperty("shop_id")]
public string ShopId { get; set; }
}
} | {
"pile_set_name": "Github"
} |
class AddUniqueConstraintToRevisionMwRevIdAndWiki < ActiveRecord::Migration[5.1]
def change
add_index :revisions, [:wiki_id, :mw_rev_id], unique: true
end
end
| {
"pile_set_name": "Github"
} |
#include <bits/stdc++.h>
using namespace std;
string s;
set<char> v;
int main()
{
while (cin >> s)
{
for (int i = 0; i < s.size(); i++)
{
v.insert(s[i]);
}
int cnt = v.size();
if (cnt > 2)
{
cout << 0 << endl;
}
else if (cnt == 2)
{
cout << 2 << endl;
}
else
{
cout << 1 << endl;
}
}
return 0;
}
| {
"pile_set_name": "Github"
} |
{
"Brand": "Tuotemerkki",
"The elementary brand is unique: technically it belongs to elementary, Inc., the company that guides and supports development of elementary products. However, we have a great community and don’t want to be too overbearing with legal requirements and technicalities. As such, we have written up some guidelines to make it easier to understand when and how the elementary brand should be used.": "",
"Company and Product Names": "",
"The word <strong>elementary</strong> is a trademark of elementary, Inc. to refer to the company itself. It is always lower-case, even when beginning sentences. It may also be used along with product names (i.e. “elementary OS”) to refer to a specific product of elementary, Inc.": "",
"The primary product of elementary, Inc. is <strong>elementary OS</strong>. For clarity, elementary OS should never be shortened to “elementary” or any abbreviation.": "",
"Brand Marks": "Tuotemerkit",
"elementary, Inc. claims two marks: the <strong>“elementary” logotype</strong> and the <strong>“e” logomark</strong>. Both are considered trademarks and represent elementary, Inc.": "",
"Both should be used with the following in mind:": "Kumpaakin tulee käyttää seuraavat asiat huomioiden:",
"Do not stretch, skew, rotate, flip, or otherwise alter the marks.": "Älä venytä, aseta viistoon, käännä, peilaa tai muuten muuta merkkejä.",
"Do not use the marks on an overly-busy background; solid colors work best.": "Älä käytä merkkejä sekavalla taustalla. Yksiväriset taustat soveltuvat parhaiten käyttöön.",
"The marks should always be monochromatic; typically white if on a dark background, or black if on a light background.": "Merkkien tulee olla aina yksivärisiä; tyypillisesti valkoisia tummalla taustalla, tummia vaalealla taustalla.",
"Logotype": "Logotyyppi",
"elementary Logotype": "elementary-logotyyppi",
"The logotype is to be used when space allows to refer to elementary, Inc., or it can be used before a product name to refer to a specific product of elementary, Inc.": "",
"The logotype should always be used under the following guidelines:": "Logotyyppiä tulisi aina käyttää seuraavien ohjenuorien mukaisesti:",
"Do not attempt to recreate the logotype. It is a meticulously-designed brand mark, not simply “elementary” written in a specific font.": "",
"Do not use the logotype at small sizes; if it is not clear, use the logomark instead.": "Älä käytä logotyyppiä pienikokoisena; jos lopputulos näyttää epäselvältä, käytä sen sijaan logomerkkiä.",
"Logomark": "Logomerkki",
"elementary Logomark": "elementary-logomerkki",
"The “e” logomark is to be used to refer to elementary, Inc. when space is constrained or a square ratio is required.": "",
"Color": "Väri",
"We employ the use of color combined with our name and marks to establish our brand. We use the following palette:": "",
"Strawberry": "Mansikka",
"Strawberry 100": "Mansikka 100",
"Strawberry 300": "Mansikka 300",
"Strawberry 500": "Mansikka 500",
"Strawberry 700": "Mansikka 700",
"Strawberry 900": "Mansikka 900",
"Orange": "Appelsiini",
"Orange 100": "Appelsiini 100",
"Orange 300": "Appelsiini 300",
"Orange 500": "Appelsiini 500",
"Orange 700": "Appelsiini 700",
"Orange 900": "Appelsiini 900",
"Banana": "Banaani",
"Banana 100": "Banaani 100",
"Banana 300": "Banaani 300",
"Banana 500": "Banaani 500",
"Banana 700": "Banaani 700",
"Banana 900": "Banaani 900",
"Lime": "Lime",
"Lime 100": "Lime 100",
"Lime 300": "Lime 300",
"Lime 500": "Lime 500",
"Lime 700": "Lime 700",
"Lime 900": "Lime 900",
"Mint": "",
"Mint 100": "",
"Mint 300": "",
"Mint 500": "",
"Mint 700": "",
"Mint 900": "",
"Blueberry": "Mustikka",
"Blueberry 100": "Mustikka 100",
"Blueberry 300": "Mustikka 300",
"Blueberry 500": "Mustikka 500",
"Blueberry 700": "Mustikka 700",
"Blueberry 900": "Mustikka 900",
"Grape": "Viinirypäle",
"Grape 100": "Viinirypäle 100",
"Grape 300": "Viinirypäle 300",
"Grape 500": "Viinirypäle 500",
"Grape 700": "Viinirypäle 700",
"Grape 900": "Viinirypäle 900",
"Bubblegum": "",
"Bubblegum 100": "",
"Bubblegum 300": "",
"Bubblegum 500": "",
"Bubblegum 700": "",
"Bubblegum 900": "",
"Cocoa": "Kaakao",
"Cocoa 100": "Kaakao 100",
"Cocoa 300": "Kaakao 300",
"Cocoa 500": "Kaakao 500",
"Cocoa 700": "Kaakao 700",
"Cocoa 900": "Kaakao 900",
"Silver": "Hopea",
"Silver 100": "Hopea 100",
"Silver 300": "Hopea 300",
"Silver 500": "Hopea 500",
"Silver 700": "Hopea 700",
"Silver 900": "Hopea 900",
"Slate": "Liuskekivi",
"Slate 100": "Liuskekivi 100",
"Slate 300": "Liuskekivi 300",
"Slate 500": "Liuskekivi 500",
"Slate 700": "Liuskekivi 700",
"Slate 900": "Liuskekivi 900",
"Black": "Musta",
"Black 100": "Musta 100",
"Black 300": "Musta 300",
"Black 500": "Musta 500",
"Black 700": "Musta 700",
"Black 900": "Musta 900",
"Fonts": "Fontit",
"For web and print, we use Inter for headings and body copy. For code blocks, we use Roboto Mono.": "",
"Third Parties & Community": "Kolmannet osapuolet & Yhteisö",
"We invite third-party developers creating products for elementary OS to adopt certain elements of the elementary brand for consistency:": "",
"Voice/tone": "Ääni/sävy",
"However, to avoid user confusion, we do restrict the usage of the elementary name and marks:": "Kuitenkin, välttääksemme käyttäjien sekaannusta me rajoitamme elementary nimen ja merkkien käyttöä:",
"You are encouraged to say that your app or service is “designed for elementary OS,” but do not use the elementary name or marks as part of the name of your company, application, product, or service—or in any logo you create.": "",
"Only use the elementary name or marks to refer to elementary, Inc. or its products (i.e. elementary OS).": "",
"Community": "Yhteisö",
"Community products (sites, fan clubs, etc.) are encouraged to use the elementary Community logo:": "Suosittelemme yhteisötuotteita (sivut, faniklubit, jne.) käyttämään elementary Yhteisö logoa:",
"elementary Community Logo with color": "elementary Yhteisö -logo väreillä",
"elementary Community Logo in black": "elementary Yhteisö -logo mustana",
"This helps establish the product as part of the overall community while reducing confusion that can arise from using the elementary, Inc. logomark.": "",
"Hardware Distributors": "Laitteistojakelijat",
"As long as our software carries the elementary branding, the experience must be consistent—whether the OS was downloaded from our website or pre-installed on a hardware product.": "",
"The software components of elementary OS may be modified and redistributed according to the open source terms of the software’s licensing; however, the above branding and trademarks may only be redistributed under one or more of the following conditions:": "",
"The software remains substantially unchanged; including default apps, stylesheet and iconography, etc., or": "",
"Software modifications are approved by elementary, Inc.": "",
"Drivers and hardware enablement are of course acceptable. We understand that distributor branding (i.e. default wallpapers) can be important for distributors, so these modifications will typically be approved. If in doubt, email <a href=\"mailto:[email protected]\">[email protected]</a> for clarification or direction.": "",
"If you’re unable or unwilling to follow the elementary, Inc. trademark redistribution terms, removing our trademarks from the OS is simple and straightforward:": "",
"Modify the <code>DISTRIB_DESCRIPTION</code> line in the file <code>/etc/lsb-release</code> to exclude our trademarks.": "Muokkaa <code>DISTRIB_DESCRIPTION</code> kohtaa tiedostosta <code>/etc/lsb-release</code> tavaramerkin poistamiseksi.",
"Replace the iconography such that the icon <code>distributor-logo</code> present in <code>/usr/share/icons/elementary/places/</code> in each of the provided sizes does not appear in the OS.": "Korvaa ikonografia, kuten <code>distributor-logo</code> ikoni kohteessa <code>/usr/share/icons/elementary/places/</code> jokaiselta resoluutiolta.",
"Remove or replace the packages <code>plymouth-theme-elementary</code> and <code>plymouth-theme-elementary-text</code>.": "",
"For more information about OEMs and hardware distributors, see our <a href=\"oem\">information for OEMs</a>.": "",
"Merchandise": "Myytävät tavarat",
"We do not authorize our branding (including our name or brand marks) to be used on third-party merchandise without explicit written approval.": "",
"Assets & More Info": "Tiedostot & lisätietoa",
"Download on GitHub": "Lataa GitHubista",
"For further information regarding the use of the elementary name, branding, and trademarks, please email <a href=\"mailto:[email protected]\">[email protected]</a>.": "Saadaksesi lisätietoa elementary-nimen käyttöön liittyen, brändäyksestä ja tavaramerkistä, ota yhteys sähköpostiin <a href=\"mailto:[email protected]\">[email protected]</a>.",
"Brand ⋅ elementary": "Brändi ⋅ elementary"
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mainDrawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/mainScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
android:background="#000">
<LinearLayout
android:id="@+id/tileContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="500dp" />
</ScrollView>
<android.support.v7.widget.Toolbar
android:id="@+id/landingPageAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<FrameLayout android:id="@+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
<android.support.design.widget.NavigationView android:id="@+id/fragmentDrawer"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="start"
app:itemIconTint="#212121"
app:itemTextColor="#212121"
app:menu="@menu/navigation_drawer_menu"/>
</android.support.v4.widget.DrawerLayout> | {
"pile_set_name": "Github"
} |
# Rock Player
A cross-platform video player based on `electron` and `ffmpeg`.
## Feature
- Cross platform(Mac, Windows).
- Plays most video files(mp4, webm, ogg, mkv, rmvb...).
## Snapshot

## To Use
To clone and run this repository you'll need [Git](https://git-scm.com) and [Node.js](https://nodejs.org/en/download/) (which comes with [npm](http://npmjs.com)) installed on your computer. From your command line:
```bash
# Clone this repository
git clone https://github.com/relaxrock/rockplayer
# Go into the repository
cd rockplayer
# Install dependencies
npm install
# Run the app
npm start
```
package mac app:
```bash
npm run package:mac:app
```
package mac dmg:
```bash
npm run package:mac:dmg
```
package windows app:
```bash
npm run package:win32
```
| {
"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.
//
// Some portions Copyright 2013 The Chromium Authors. All rights reserved.
#include "kudu/gutil/strings/util.h"
#include <gtest/gtest.h>
namespace kudu {
TEST(StringUtilTest, MatchPatternTest) {
EXPECT_TRUE(MatchPattern("www.google.com", "*.com"));
EXPECT_TRUE(MatchPattern("www.google.com", "*"));
EXPECT_FALSE(MatchPattern("www.google.com", "www*.g*.org"));
EXPECT_TRUE(MatchPattern("Hello", "H?l?o"));
EXPECT_FALSE(MatchPattern("www.google.com", "http://*)"));
EXPECT_FALSE(MatchPattern("www.msn.com", "*.COM"));
EXPECT_TRUE(MatchPattern("Hello*1234", "He??o\\*1*"));
EXPECT_FALSE(MatchPattern("", "*.*"));
EXPECT_TRUE(MatchPattern("", "*"));
EXPECT_TRUE(MatchPattern("", "?"));
EXPECT_TRUE(MatchPattern("", ""));
EXPECT_FALSE(MatchPattern("Hello", ""));
EXPECT_TRUE(MatchPattern("Hello*", "Hello*"));
// Stop after a certain recursion depth.
EXPECT_FALSE(MatchPattern("123456789012345678", "?????????????????*"));
// Test UTF8 matching.
EXPECT_TRUE(MatchPattern("heart: \xe2\x99\xa0", "*\xe2\x99\xa0"));
EXPECT_TRUE(MatchPattern("heart: \xe2\x99\xa0.", "heart: ?."));
EXPECT_TRUE(MatchPattern("hearts: \xe2\x99\xa0\xe2\x99\xa0", "*"));
// Invalid sequences should be handled as a single invalid character.
EXPECT_TRUE(MatchPattern("invalid: \xef\xbf\xbe", "invalid: ?"));
// If the pattern has invalid characters, it shouldn't match anything.
EXPECT_FALSE(MatchPattern("\xf4\x90\x80\x80", "\xf4\x90\x80\x80"));
// This test verifies that consecutive wild cards are collapsed into 1
// wildcard (when this doesn't occur, MatchPattern reaches it's maximum
// recursion depth).
EXPECT_TRUE(MatchPattern("Hello" ,
"He********************************o")) ;
}
} // namespace kudu
| {
"pile_set_name": "Github"
} |
# json5
> A command-line tool for converting JSON5 files to JSON.
> More information: <https://json5.org>.
- Convert JSON5 stdin to JSON `stdout`:
`echo {{input}} | json5`
- Convert a JSON5 file to JSON and output to `stdout`:
`json5 {{path/to/input_file.json5}}`
- Convert a JSON5 file to the specified JSON file:
`json5 {{path/to/input_file.json5}} --out-file {{path/to/output_file.json}}`
- Validate a JSON5 file:
`json5 {{path/to/input_file.json5}} --validate`
- Specify the number of spaces to indent by (or "t" for tabs):
`json5 --space {{indent_amount}}`
- View available options:
`json5 --help`
| {
"pile_set_name": "Github"
} |
@import "../common/actionsheet.less";
@import "base.less";
// ActionSheet
.km-blackberry .km-shim.km-actionsheet-root > .k-animation-container
{
top: 0;
right: 0;
left: auto !important;
height: 100% !important;
width: 80% !important;
}
.km-blackberry.km-pane div.km-actionsheet-wrapper
{
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.km-blackberry .km-actionsheet
{
position: relative;
display: inline-block;
width: 100%;
border: 0;
vertical-align: middle;
padding: 0;
border-radius: 0;
.box-sizing(border-box);
}
.km-blackberry.km-pane .km-actionsheet-title
{
text-align: center;
}
.km-blackberry .km-actionsheet-title,
.km-blackberry .km-actionsheet-cancel
{
display: none;
}
.km-blackberry .km-actionsheet-wrapper:before
{
content: "\a0";
display: inline-block;
vertical-align: middle;
height: 100%;
width: 0;
}
.km-blackberry .km-actionsheet > li > a
{
font-size: 1em;
font-weight: normal;
display: block;
line-height: 3rem;
padding: 0 1em;
border-radius: 0;
border-style: solid;
border-width: 0 0 @blackberry-border-width;
text-decoration: none;
white-space: nowrap;
}
.km-blackberry .km-actionsheet > li:nth-child(2) > a
{
border-top-width: @blackberry-border-width;
border-style: solid;
}
| {
"pile_set_name": "Github"
} |
{
"data": [
{
"account_id": "260608571309741",
"id": "act_260608571309741"
}
],
"paging": {
"cursors": {
"before": "MjM4NDI5OTEyNDQ4MjA0NzYZD",
"after": "MjM4NDI5OTEyNDQ4MjA0NzYZD"
}
}
} | {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2014-2015 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.spotify.folsom.client.ascii;
import com.spotify.folsom.client.AbstractRequest;
import com.spotify.folsom.guava.HostAndPort;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
public abstract class AsciiRequest<T> extends AbstractRequest<T> {
protected static final byte[] NEWLINE_BYTES = "\r\n".getBytes(StandardCharsets.US_ASCII);
protected static final byte SPACE_BYTES = ' ';
protected AsciiRequest(byte[] key) {
super(key);
}
@Override
public void handle(final Object response, final HostAndPort server) throws IOException {
handle((AsciiResponse) response, server);
}
protected abstract void handle(AsciiResponse response, HostAndPort server) throws IOException;
}
| {
"pile_set_name": "Github"
} |
using System;
using Newtonsoft.Json;
namespace Alipay.AopSdk.Core.Domain
{
/// <summary>
/// AlipayEcoMycarParkingEnterinfoSyncModel Data Structure.
/// </summary>
[Serializable]
public class AlipayEcoMycarParkingEnterinfoSyncModel : AopObject
{
/// <summary>
/// 车牌号
/// </summary>
[JsonProperty("car_number")]
public string CarNumber { get; set; }
/// <summary>
/// 车辆入场的时间,格式"YYYY-MM-DD HH:mm:ss",24小时制
/// </summary>
[JsonProperty("in_time")]
public string InTime { get; set; }
/// <summary>
/// 支付宝停车场ID ,系统唯一
/// </summary>
[JsonProperty("parking_id")]
public string ParkingId { get; set; }
}
} | {
"pile_set_name": "Github"
} |
from .system import SystemCompleter
__all__ = ["SystemCompleter"]
| {
"pile_set_name": "Github"
} |
const mockGetPolicy = jest.fn();
jest.mock("@aws-sdk/client-iam/commands/GetPolicyCommand", () => ({
IAM: function IAM() {
this.GetPolicyCommand = mockGetPolicy;
},
}));
const { params, run } = require("../../iam/iam_getpolicy.js");
//test function
test("has to mock iam#getpolicy", async (done) => {
await run();
expect(mockGetPolicy).toHaveBeenCalled;
done();
});
| {
"pile_set_name": "Github"
} |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MissingOverlay=Failed to load overlay from %1$S.
PINotInProlog=<?%1$S?> processing instruction does not have any effect outside the prolog anymore (see bug 360119).
NeededToWrapXUL=XUL box for %1$S element contained an inline %2$S child, forcing all its children to be wrapped in a block.
NeededToWrapXULInlineBox=XUL box for %1$S element contained an inline %2$S child, forcing all its children to be wrapped in a block. This can often be fixed by replacing “display: -moz-inline-box” with “display: -moz-inline-box; display: inline-block”.
| {
"pile_set_name": "Github"
} |
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************
Intel 8214/3214 Priority Interrupt Control Unit
**********************************************************************
_____ _____
_B0 1 |* \_/ | 24 Vcc
_B1 2 | | 23 _ECS
_B2 3 | | 22 _R7
_SGS 4 | | 21 _R6
_INT 5 | | 20 _R5
_CLK 6 | 8214 | 19 _R4
INTE 7 | 3214 | 18 _R3
_A0 8 | | 17 _R2
_A1 9 | | 16 _R1
_A2 10 | | 15 _R0
_ELR 11 | | 14 ENLG
GND 12 |_____________| 13 ETLG
**********************************************************************/
#ifndef MAME_MACHINE_I8214_H
#define MAME_MACHINE_I8214_H
#pragma once
class i8214_device : public device_t
{
public:
// construction/destruction
i8214_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
auto int_wr_callback() { return m_write_int.bind(); }
auto enlg_wr_callback() { return m_write_enlg.bind(); }
void sgs_w(int state);
void etlg_w(int state);
void inte_w(int state);
uint8_t a_r();
uint8_t vector_r();
void b_w(uint8_t data);
void b_sgs_w(uint8_t data);
void r_w(int line, int state);
void r_all_w(uint8_t data);
protected:
// device-level overrides
virtual void device_start() override;
private:
void trigger_interrupt(int level);
void check_interrupt();
void update_interrupt_line();
devcb_write_line m_write_int;
devcb_write_line m_write_enlg;
int m_inte; // interrupt enable
int m_int_dis; // interrupt (latch) disable flip-flop
int m_a; // request level
int m_current_status;
uint8_t m_r; // interrupt request latch
int m_sgs; // status group select
int m_etlg; // enable this level group
};
// device type definition
DECLARE_DEVICE_TYPE(I8214, i8214_device)
#endif // MAME_MACHINE_I8214_H
| {
"pile_set_name": "Github"
} |
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs defs_darwin.go
package socket
type iovec struct {
Base *byte
Len uint32
}
type msghdr struct {
Name *byte
Namelen uint32
Iov *iovec
Iovlen int32
Control *byte
Controllen uint32
Flags int32
}
type cmsghdr struct {
Len uint32
Level int32
Type int32
}
type sockaddrInet struct {
Len uint8
Family uint8
Port uint16
Addr [4]byte /* in_addr */
Zero [8]int8
}
type sockaddrInet6 struct {
Len uint8
Family uint8
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
const (
sizeofIovec = 0x8
sizeofMsghdr = 0x1c
sizeofCmsghdr = 0xc
sizeofSockaddrInet = 0x10
sizeofSockaddrInet6 = 0x1c
)
| {
"pile_set_name": "Github"
} |
{
"word": "Omnipotence",
"definitions": [
"The quality of having unlimited or very great power."
],
"parts-of-speech": "Noun"
} | {
"pile_set_name": "Github"
} |
/***********************************************************************
* fpoint.cpp - Point with an x and y coordinate *
* *
* This file is part of the FINAL CUT widget toolkit *
* *
* Copyright 2014-2020 Markus Gans *
* *
* FINAL CUT is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation; either version 3 of *
* the License, or (at your option) any later version. *
* *
* FINAL CUT is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this program. If not, see *
* <http://www.gnu.org/licenses/>. *
***********************************************************************/
#include <utility>
#include "final/fpoint.h"
namespace finalcut
{
//----------------------------------------------------------------------
// class FPoint
//----------------------------------------------------------------------
FPoint::~FPoint() // destructor
{ }
// public methods of FPoint
//----------------------------------------------------------------------
FPoint& FPoint::operator = (const FPoint& p)
{
xpos = p.xpos;
ypos = p.ypos;
return *this;
}
//----------------------------------------------------------------------
FPoint& FPoint::operator = (FPoint&& p) noexcept
{
xpos = std::move(p.xpos);
ypos = std::move(p.ypos);
return *this;
}
//----------------------------------------------------------------------
FPoint& FPoint::operator += (const FPoint& p)
{
xpos += p.xpos;
ypos += p.ypos;
return *this;
}
//----------------------------------------------------------------------
FPoint& FPoint::operator -= (const FPoint& p)
{
xpos -= p.xpos;
ypos -= p.ypos;
return *this;
}
//----------------------------------------------------------------------
void FPoint::setX (int x)
{
xpos = x;
}
//----------------------------------------------------------------------
void FPoint::setY (int y)
{
ypos = y;
}
//----------------------------------------------------------------------
void FPoint::setPoint (int x, int y)
{
xpos = x;
ypos = y;
}
//----------------------------------------------------------------------
bool FPoint::isOrigin() const
{
return xpos == 0 && ypos == 0;
}
//----------------------------------------------------------------------
void FPoint::move (int dx, int dy)
{
xpos += dx;
ypos += dy;
}
//----------------------------------------------------------------------
void FPoint::move (const FPoint& d)
{
xpos += d.getX();
ypos += d.getY();
}
//----------------------------------------------------------------------
std::ostream& operator << (std::ostream& outstr, const FPoint& p)
{
outstr << p.xpos << " " << p.ypos;
return outstr;
}
//----------------------------------------------------------------------
std::istream& operator >> (std::istream& instr, FPoint& p)
{
int x{};
int y{};
instr >> x;
instr >> y;
p.setPoint (x, y);
return instr;
}
} // namespace finalcut
| {
"pile_set_name": "Github"
} |
/* $NetBSD: queue.h,v 1.8 2014/12/10 04:38:00 christos Exp $ */
/*
* Copyright (C) 2011-2013 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* Id */
/*
* This is a generic implementation of a two-lock concurrent queue.
* There are built-in mutex locks for the head and tail of the queue,
* allowing elements to be safely added and removed at the same time.
*
* NULL is "end of list"
* -1 is "not linked"
*/
#ifndef ISC_QUEUE_H
#define ISC_QUEUE_H 1
#include <isc/assertions.h>
#include <isc/boolean.h>
#include <isc/mutex.h>
#ifdef ISC_QUEUE_CHECKINIT
#define ISC_QLINK_INSIST(x) ISC_INSIST(x)
#else
#define ISC_QLINK_INSIST(x) (void)0
#endif
#define ISC_QLINK(type) struct { type *prev, *next; }
#define ISC_QLINK_INIT(elt, link) \
do { \
(elt)->link.next = (elt)->link.prev = (void *)(-1); \
} while(/*CONSTCOND*/0)
#define ISC_QLINK_LINKED(elt, link) ((void*)(elt)->link.next != (void*)(-1))
#define ISC_QUEUE(type) struct { \
type *head, *tail; \
isc_mutex_t headlock, taillock; \
}
#define ISC_QUEUE_INIT(queue, link) \
do { \
(void) isc_mutex_init(&(queue).taillock); \
(void) isc_mutex_init(&(queue).headlock); \
(queue).tail = (queue).head = NULL; \
} while (/*CONSTCOND*/0)
#define ISC_QUEUE_EMPTY(queue) ISC_TF((queue).head == NULL)
#define ISC_QUEUE_DESTROY(queue) \
do { \
ISC_QLINK_INSIST(ISC_QUEUE_EMPTY(queue)); \
(void) isc_mutex_destroy(&(queue).taillock); \
(void) isc_mutex_destroy(&(queue).headlock); \
} while (/*CONSTCOND*/0)
/*
* queues are meant to separate the locks at either end. For best effect, that
* means keeping the ends separate - i.e. non-empty queues work best.
*
* a push to an empty queue has to take the pop lock to update
* the pop side of the queue.
* Popping the last entry has to take the push lock to update
* the push side of the queue.
*
* The order is (pop, push), because a pop is presumably in the
* latency path and a push is when we're done.
*
* We do an MT hot test in push to see if we need both locks, so we can
* acquire them in order. Hopefully that makes the case where we get
* the push lock and find we need the pop lock (and have to release it) rare.
*
* > 1 entry - no collision, push works on one end, pop on the other
* 0 entry - headlock race
* pop wins - return(NULL), push adds new as both head/tail
* push wins - updates head/tail, becomes 1 entry case.
* 1 entry - taillock race
* pop wins - return(pop) sets head/tail NULL, becomes 0 entry case
* push wins - updates {head,tail}->link.next, pop updates head
* with new ->link.next and doesn't update tail
*
*/
#define ISC_QUEUE_PUSH(queue, elt, link) \
do { \
isc_boolean_t headlocked = ISC_FALSE; \
ISC_QLINK_INSIST(!ISC_QLINK_LINKED(elt, link)); \
if ((queue).head == NULL) { \
LOCK(&(queue).headlock); \
headlocked = ISC_TRUE; \
} \
LOCK(&(queue).taillock); \
if ((queue).tail == NULL && !headlocked) { \
UNLOCK(&(queue).taillock); \
LOCK(&(queue).headlock); \
LOCK(&(queue).taillock); \
headlocked = ISC_TRUE; \
} \
(elt)->link.prev = (queue).tail; \
(elt)->link.next = NULL; \
if ((queue).tail != NULL) \
(queue).tail->link.next = (elt); \
(queue).tail = (elt); \
UNLOCK(&(queue).taillock); \
if (headlocked) { \
if ((queue).head == NULL) \
(queue).head = (elt); \
UNLOCK(&(queue).headlock); \
} \
} while (/*CONSTCOND*/0)
#define ISC_QUEUE_POP(queue, link, ret) \
do { \
LOCK(&(queue).headlock); \
ret = (queue).head; \
while (ret != NULL) { \
if (ret->link.next == NULL) { \
LOCK(&(queue).taillock); \
if (ret->link.next == NULL) { \
(queue).head = (queue).tail = NULL; \
UNLOCK(&(queue).taillock); \
break; \
}\
UNLOCK(&(queue).taillock); \
} \
(queue).head = ret->link.next; \
(queue).head->link.prev = NULL; \
break; \
} \
UNLOCK(&(queue).headlock); \
if (ret != NULL) \
(ret)->link.next = (ret)->link.prev = (void *)(-1); \
} while(/*CONSTCOND*/0)
#define ISC_QUEUE_UNLINK(queue, elt, link) \
do { \
ISC_QLINK_INSIST(ISC_QLINK_LINKED(elt, link)); \
LOCK(&(queue).headlock); \
LOCK(&(queue).taillock); \
if ((elt)->link.prev == NULL) \
(queue).head = (elt)->link.next; \
else \
(elt)->link.prev->link.next = (elt)->link.next; \
if ((elt)->link.next == NULL) \
(queue).tail = (elt)->link.prev; \
else \
(elt)->link.next->link.prev = (elt)->link.prev; \
UNLOCK(&(queue).taillock); \
UNLOCK(&(queue).headlock); \
(elt)->link.next = (elt)->link.prev = (void *)(-1); \
} while(/*CONSTCOND*/0)
#endif /* ISC_QUEUE_H */
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env lua
-- This benchmark script measures wall clock time and should be
-- run on an unloaded system.
--
-- Your Mileage May Vary.
--
-- Mark Pulford <[email protected]>
local json_module = os.getenv("JSON_MODULE") or "cjson"
require "socket"
local json = require(json_module)
local util = require "cjson.util"
local function find_func(mod, funcnames)
for _, v in ipairs(funcnames) do
if mod[v] then
return mod[v]
end
end
return nil
end
local json_encode = find_func(json, { "encode", "Encode", "to_string", "stringify", "json" })
local json_decode = find_func(json, { "decode", "Decode", "to_value", "parse" })
local function average(t)
local total = 0
for _, v in ipairs(t) do
total = total + v
end
return total / #t
end
function benchmark(tests, seconds, rep)
local function bench(func, iter)
-- Use socket.gettime() to measure microsecond resolution
-- wall clock time.
local t = socket.gettime()
for i = 1, iter do
func(i)
end
t = socket.gettime() - t
-- Don't trust any results when the run lasted for less than a
-- millisecond - return nil.
if t < 0.001 then
return nil
end
return (iter / t)
end
-- Roughly calculate the number of interations required
-- to obtain a particular time period.
local function calc_iter(func, seconds)
local iter = 1
local rate
-- Warm up the bench function first.
func()
while not rate do
rate = bench(func, iter)
iter = iter * 10
end
return math.ceil(seconds * rate)
end
local test_results = {}
for name, func in pairs(tests) do
-- k(number), v(string)
-- k(string), v(function)
-- k(number), v(function)
if type(func) == "string" then
name = func
func = _G[name]
end
local iter = calc_iter(func, seconds)
local result = {}
for i = 1, rep do
result[i] = bench(func, iter)
end
-- Remove the slowest half (round down) of the result set
table.sort(result)
for i = 1, math.floor(#result / 2) do
table.remove(result, 1)
end
test_results[name] = average(result)
end
return test_results
end
function bench_file(filename)
local data_json = util.file_load(filename)
local data_obj = json_decode(data_json)
local function test_encode()
json_encode(data_obj)
end
local function test_decode()
json_decode(data_json)
end
local tests = {}
if json_encode then tests.encode = test_encode end
if json_decode then tests.decode = test_decode end
return benchmark(tests, 0.1, 5)
end
-- Optionally load any custom configuration required for this module
local success, data = pcall(util.file_load, ("bench-%s.lua"):format(json_module))
if success then
util.run_script(data, _G)
configure(json)
end
for i = 1, #arg do
local results = bench_file(arg[i])
for k, v in pairs(results) do
print(("%s\t%s\t%d"):format(arg[i], k, v))
end
end
-- vi:ai et sw=4 ts=4:
| {
"pile_set_name": "Github"
} |
// Copyright 2011-2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.security.zynamics.reil.translators.x86;
import com.google.security.zynamics.reil.OperandSize;
import com.google.security.zynamics.reil.ReilHelpers;
import com.google.security.zynamics.reil.ReilInstruction;
import com.google.security.zynamics.reil.translators.IInstructionTranslator;
import com.google.security.zynamics.reil.translators.ITranslationEnvironment;
import com.google.security.zynamics.reil.translators.InternalTranslationException;
import com.google.security.zynamics.reil.translators.TranslationHelpers;
import com.google.security.zynamics.reil.translators.TranslationResult;
import com.google.security.zynamics.zylib.disassembly.IInstruction;
import com.google.security.zynamics.zylib.disassembly.IOperandTree;
import java.util.ArrayList;
import java.util.List;
/**
* Translates SHR instructions to REIL code.
*/
public class ShrTranslator implements IInstructionTranslator {
// TODO(timkornau): Check this code again
/**
* Translates a SHR instruction to REIL code.
*
* @param environment A valid translation environment.
* @param instruction The SHR instruction to translate.
* @param instructions The generated REIL code will be added to this list
*
* @throws InternalTranslationException if any of the arguments are null the passed instruction is
* not an SHR instruction
*/
@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction,
final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "shr");
if (instruction.getOperands().size() != 2) {
throw new InternalTranslationException(
"Error: Argument instruction is not a shr instruction (invalid number of operands)");
}
final long reilOffsetBase = instruction.getAddress().toLong() * 0x100;
long offset = reilOffsetBase;
final List<? extends IOperandTree> operands = instruction.getOperands();
// Load source operand.
final TranslationResult firstResult =
Helpers.translateOperand(environment, offset, operands.get(0), true);
instructions.addAll(firstResult.getInstructions());
// Adjust the offset of the next REIL instruction.
offset = reilOffsetBase + instructions.size();
// Load destination operand.
final TranslationResult secondResult =
Helpers.translateOperand(environment, offset, operands.get(1), true);
instructions.addAll(secondResult.getInstructions());
// Adjust the offset of the next REIL instruction.
offset = reilOffsetBase + instructions.size();
final OperandSize size1 = firstResult.getSize();
final OperandSize size2 = secondResult.getSize();
final OperandSize resultSize = TranslationHelpers.getNextSize(size1);
final String operand1 = firstResult.getRegister();
final String operand2 = secondResult.getRegister();
final String truncateMask = String.valueOf(TranslationHelpers.getAllBitsMask(size1));
final String modValue = String.valueOf(size1.getBitSize());
final String shiftMask = environment.getNextVariableString();
final String shiftMaskZero = environment.getNextVariableString();
final String shiftMaskLessOne = environment.getNextVariableString();
final String shiftMaskOne = environment.getNextVariableString();
final String shiftMaskNeg = environment.getNextVariableString();
final String result = environment.getNextVariableString();
final String truncatedResult = environment.getNextVariableString();
final String incShiftMaskNeg = environment.getNextVariableString();
final String decResult = environment.getNextVariableString();
final int before = instructions.size();
final List<ReilInstruction> writebackInstructions = new ArrayList<ReilInstruction>();
// Write the result of the SHR operation back into the target register
Helpers.writeBack(environment, offset + 17, operands.get(0), truncatedResult, size1,
firstResult.getAddress(), firstResult.getType(), writebackInstructions);
// Make sure to shift less than the size1 of the register
instructions.add(ReilHelpers.createMod(offset, size2, operand2, size2, modValue, size2,
shiftMask));
// Find out if the shift mask is 0 and negate the result
instructions.add(ReilHelpers.createBisz(offset + 1, size2, shiftMask, OperandSize.BYTE,
shiftMaskZero));
// Find out if the shift mask is 1
instructions.add(ReilHelpers.createSub(offset + 2, size2, "1", size2, shiftMask, size2,
shiftMaskLessOne));
instructions.add(ReilHelpers.createBisz(offset + 3, size2, shiftMaskLessOne, OperandSize.BYTE,
shiftMaskOne));
// Negate the shift-mask => BSH to the right
instructions.add(ReilHelpers.createSub(offset + 4, size2, "0", size2, shiftMask, size2,
shiftMaskNeg));
// Perform the shift
instructions.add(ReilHelpers.createBsh(offset + 5, size1, operand1, size2, shiftMaskNeg,
resultSize, result));
// Truncate the result to the correct size1
instructions.add(ReilHelpers.createAnd(offset + 6, resultSize, result, size1, truncateMask,
size1, truncatedResult));
// Don't change the flags if the shift value was zero (jump to writeBack).
final String jmpGoalWriteBack =
String.format("%d.%d", instruction.getAddress().toLong(), before + 17);
instructions.add(ReilHelpers.createJcc(offset + 7, OperandSize.BYTE, shiftMaskZero,
OperandSize.ADDRESS, jmpGoalWriteBack));
// The SF is always 0
instructions.add(ReilHelpers.createStr(offset + 8, OperandSize.BYTE, "0", OperandSize.BYTE,
Helpers.SIGN_FLAG));
// Set the CF to the last MSB shifted out of the register
// Perform another shift, this time by one position less and take the LSB
// This is only safe if the mask is not 0
instructions.add(ReilHelpers.createAdd(offset + 9, size2, shiftMaskNeg, size2, "1", size2,
incShiftMaskNeg));
instructions.add(ReilHelpers.createBsh(offset + 10, size1, operand1, size2, incShiftMaskNeg,
size1, decResult));
instructions.add(ReilHelpers.createAnd(offset + 11, size1, decResult, OperandSize.BYTE, "1",
OperandSize.BYTE, Helpers.CARRY_FLAG));
// Set the ZF
instructions.add(ReilHelpers.createBisz(offset + 12, size1, truncatedResult, OperandSize.BYTE,
Helpers.ZERO_FLAG));
// The OF needs to be set to a different value if the shift-mask was 1
final String jmpGoal2 = String.format("%d.%d", instruction.getAddress().toLong(), before + 16);
instructions.add(ReilHelpers.createJcc(offset + 13, OperandSize.BYTE, shiftMaskOne,
OperandSize.ADDRESS, jmpGoal2));
// Set the OF to undefined if the shift-mask was positive but not 1
instructions.add(ReilHelpers.createUndef(offset + 14, OperandSize.BYTE, Helpers.OVERFLOW_FLAG));
// Jump to writeBack.
instructions.add(ReilHelpers.createJcc(offset + 15, OperandSize.BYTE, "1",
OperandSize.ADDRESS, jmpGoalWriteBack));
// Set the OF if the shift-mask was 1
instructions.add(ReilHelpers.createXor(offset + 16, OperandSize.BYTE, Helpers.SIGN_FLAG,
OperandSize.BYTE, Helpers.CARRY_FLAG, OperandSize.BYTE, Helpers.OVERFLOW_FLAG));
// Write back to the target register.
instructions.addAll(writebackInstructions);
}
}
| {
"pile_set_name": "Github"
} |
# Título do Projeto
## Índice
+ [Sobre](#sobre)
+ [Primeiros Passos](#primeiros_passos)
+ [Uso](#uso)
+ [Contribuiçōes](../CONTRIBUTING.md)
## Sobre <a name = "sobre"></a>
Escreva entre 1-2 parágrafos uma descriçāo com o propósito do seu projeto.
## Começando <a name = "comecando"></a>
Estas intruçōes te darão uma cópia funcional do projeto na sua máquina local para desenvolvimento e testes. Veja [deployment](#deployment) para uma descrição de como realizar o deployment deste projeto online.
### Pré-requisitos
Descreva o que é necessário para instalar este software e como instalá-lo.
```
Dê exemplos
```
### Instalação
Passo-a-passo com exemplos que reproduzam um estágio de desenvolvimento funcional.
Descreva o passo a ser tomado
```
Dê um exemplo
```
Repita
```
Até terminar
```
## Uso <a name="uso"></a>
Descreva como utilizar seu app ou sistema.
| {
"pile_set_name": "Github"
} |
package de.plushnikov.intellij.plugin.processor;
import de.plushnikov.intellij.plugin.AbstractLombokParsingTestCase;
/**
* Unit tests for IntelliJPlugin for Lombok, based on lombok test classes
*/
public class AccessorsTest extends AbstractLombokParsingTestCase {
public void testAccessors$Accessors() {
doTest(true);
}
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2016 Uber Technologies, 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
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
package zapcore_test
import (
"fmt"
"sync"
"testing"
"time"
"go.uber.org/atomic"
"go.uber.org/zap/internal/ztest"
. "go.uber.org/zap/zapcore"
"go.uber.org/zap/zaptest/observer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func fakeSampler(lvl LevelEnabler, tick time.Duration, first, thereafter int) (Core, *observer.ObservedLogs) {
core, logs := observer.New(lvl)
core = NewSampler(core, tick, first, thereafter)
return core, logs
}
func assertSequence(t testing.TB, logs []observer.LoggedEntry, lvl Level, seq ...int64) {
seen := make([]int64, len(logs))
for i, entry := range logs {
require.Equal(t, "", entry.Message, "Message wasn't created by writeSequence.")
require.Equal(t, 1, len(entry.Context), "Unexpected number of fields.")
require.Equal(t, lvl, entry.Level, "Unexpected level.")
f := entry.Context[0]
require.Equal(t, "iter", f.Key, "Unexpected field key.")
require.Equal(t, Int64Type, f.Type, "Unexpected field type")
seen[i] = f.Integer
}
assert.Equal(t, seq, seen, "Unexpected sequence logged at level %v.", lvl)
}
func writeSequence(core Core, n int, lvl Level) {
// All tests using writeSequence verify that counters are shared between
// parent and child cores.
core = core.With([]Field{makeInt64Field("iter", n)})
if ce := core.Check(Entry{Level: lvl, Time: time.Now()}, nil); ce != nil {
ce.Write()
}
}
func TestSampler(t *testing.T) {
for _, lvl := range []Level{DebugLevel, InfoLevel, WarnLevel, ErrorLevel, DPanicLevel, PanicLevel, FatalLevel} {
sampler, logs := fakeSampler(DebugLevel, time.Minute, 2, 3)
// Ensure that counts aren't shared between levels.
probeLevel := DebugLevel
if lvl == DebugLevel {
probeLevel = InfoLevel
}
for i := 0; i < 10; i++ {
writeSequence(sampler, 1, probeLevel)
}
// Clear any output.
logs.TakeAll()
for i := 1; i < 10; i++ {
writeSequence(sampler, i, lvl)
}
assertSequence(t, logs.TakeAll(), lvl, 1, 2, 5, 8)
}
}
func TestSamplerDisabledLevels(t *testing.T) {
sampler, logs := fakeSampler(InfoLevel, time.Minute, 1, 100)
// Shouldn't be counted, because debug logging isn't enabled.
writeSequence(sampler, 1, DebugLevel)
writeSequence(sampler, 2, InfoLevel)
assertSequence(t, logs.TakeAll(), InfoLevel, 2)
}
func TestSamplerTicking(t *testing.T) {
// Ensure that we're resetting the sampler's counter every tick.
sampler, logs := fakeSampler(DebugLevel, 10*time.Millisecond, 5, 10)
// If we log five or fewer messages every tick, none of them should be
// dropped.
for tick := 0; tick < 2; tick++ {
for i := 1; i <= 5; i++ {
writeSequence(sampler, i, InfoLevel)
}
ztest.Sleep(15 * time.Millisecond)
}
assertSequence(
t,
logs.TakeAll(),
InfoLevel,
1, 2, 3, 4, 5, // first tick
1, 2, 3, 4, 5, // second tick
)
// If we log quickly, we should drop some logs. The first five statements
// each tick should be logged, then every tenth.
for tick := 0; tick < 3; tick++ {
for i := 1; i < 18; i++ {
writeSequence(sampler, i, InfoLevel)
}
ztest.Sleep(10 * time.Millisecond)
}
assertSequence(
t,
logs.TakeAll(),
InfoLevel,
1, 2, 3, 4, 5, 15, // first tick
1, 2, 3, 4, 5, 15, // second tick
1, 2, 3, 4, 5, 15, // third tick
)
}
type countingCore struct {
logs atomic.Uint32
}
func (c *countingCore) Check(ent Entry, ce *CheckedEntry) *CheckedEntry {
return ce.AddCore(ent, c)
}
func (c *countingCore) Write(Entry, []Field) error {
c.logs.Inc()
return nil
}
func (c *countingCore) With([]Field) Core { return c }
func (*countingCore) Enabled(Level) bool { return true }
func (*countingCore) Sync() error { return nil }
func TestSamplerConcurrent(t *testing.T) {
const (
logsPerTick = 10
numMessages = 5
numTicks = 25
numGoroutines = 10
expectedCount = numMessages * logsPerTick * numTicks
)
tick := ztest.Timeout(10 * time.Millisecond)
cc := &countingCore{}
sampler := NewSampler(cc, tick, logsPerTick, 100000)
var (
done atomic.Bool
wg sync.WaitGroup
)
for i := 0; i < numGoroutines; i++ {
wg.Add(1)
go func(i int) {
defer wg.Done()
for {
if done.Load() {
return
}
msg := fmt.Sprintf("msg%v", i%numMessages)
ent := Entry{Level: DebugLevel, Message: msg, Time: time.Now()}
if ce := sampler.Check(ent, nil); ce != nil {
ce.Write()
}
// Give a chance for other goroutines to run.
time.Sleep(time.Microsecond)
}
}(i)
}
time.AfterFunc(numTicks*tick, func() {
done.Store(true)
})
wg.Wait()
assert.InDelta(
t,
expectedCount,
cc.logs.Load(),
expectedCount/10,
"Unexpected number of logs",
)
}
func TestSamplerRaces(t *testing.T) {
sampler, _ := fakeSampler(DebugLevel, time.Minute, 1, 1000)
var wg sync.WaitGroup
start := make(chan struct{})
for i := 0; i < 100; i++ {
wg.Add(1)
go func() {
<-start
for j := 0; j < 100; j++ {
writeSequence(sampler, j, InfoLevel)
}
wg.Done()
}()
}
close(start)
wg.Wait()
}
| {
"pile_set_name": "Github"
} |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/workspaces/model/DescribeWorkspaceImagePermissionsRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::WorkSpaces::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
DescribeWorkspaceImagePermissionsRequest::DescribeWorkspaceImagePermissionsRequest() :
m_imageIdHasBeenSet(false),
m_nextTokenHasBeenSet(false),
m_maxResults(0),
m_maxResultsHasBeenSet(false)
{
}
Aws::String DescribeWorkspaceImagePermissionsRequest::SerializePayload() const
{
JsonValue payload;
if(m_imageIdHasBeenSet)
{
payload.WithString("ImageId", m_imageId);
}
if(m_nextTokenHasBeenSet)
{
payload.WithString("NextToken", m_nextToken);
}
if(m_maxResultsHasBeenSet)
{
payload.WithInteger("MaxResults", m_maxResults);
}
return payload.View().WriteReadable();
}
Aws::Http::HeaderValueCollection DescribeWorkspaceImagePermissionsRequest::GetRequestSpecificHeaders() const
{
Aws::Http::HeaderValueCollection headers;
headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "WorkspacesService.DescribeWorkspaceImagePermissions"));
return headers;
}
| {
"pile_set_name": "Github"
} |
<robot name="blob398">
<link name="random_obj_398">
<contact>
<lateral_friction value="1.0"/>
<rolling_friction value="0.0"/>
<inertia_scaling value="3.0"/>
<contact_cfm value="0.0"/>
<contact_erp value="1.0"/>
</contact>
<inertial>
<origin rpy="0 0 0" xyz="0 0 0"/>
<mass value="0.1"/>
<inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="0"/>
</inertial>
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="398.obj" scale="0.015 0.015 0.015"/>
</geometry>
<material name="blockmat">
<color rgba="0.45 0.94 0.02 1"/>
</material>
</visual>
<collision>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="398.obj" scale="0.015 0.015 0.015"/>
</geometry>
</collision>
</link>
</robot>
| {
"pile_set_name": "Github"
} |
// ---------------------------------------------------------------------
//
// Copyright (C) 2017 - 2020 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE.md at
// the top level directory of deal.II.
//
// ---------------------------------------------------------------------
// construct a simplex quadrature, and check that we can get an affine
// transformation out of it.
#ifndef tests_base_simplex_h
#define tests_base_simplex_h
#include <deal.II/base/quadrature_lib.h>
#include <numeric>
#include "../tests.h"
#include "simplex.h"
// Helper functions
template <int dim>
std::array<Point<dim>, dim + 1>
get_simplex();
template <>
std::array<Point<1>, 2>
get_simplex()
{
return {{Point<1>(3), Point<1>(5)}};
}
template <>
std::array<Point<2>, 3>
get_simplex()
{
return {{Point<2>(4, 2), Point<2>(3, 3), Point<2>(2, 2.5)}};
}
template <>
std::array<Point<3>, 4>
get_simplex()
{
return {{Point<3>(4, 2, 0),
Point<3>(3, 3, 0),
Point<3>(2, 2.5, 0),
Point<3>(4.5, 3, 2)}};
}
// Exact integral of 1/R times a polynomial computed using Maple.
double
exact_integral_one_over_r(const unsigned int vertex_index,
const unsigned int i,
const unsigned int j)
{
Assert(vertex_index < 4, ExcInternalError());
Assert(i < 6, ExcNotImplemented());
Assert(j < 6, ExcNotImplemented());
// The integrals are computed using the following maple snippet of
// code:
//
// sing_int := proc(index, N, M)
// if index = 0 then
// return int(int(x^N *y^M/sqrt(x^2+y^2), x=0.0..1.0), y=0.0..1.0);
// elif index = 1 then
// return int(int(x^N *y^M/sqrt((x-1)^2+y^2), x=0.0..1.0), y=0.0..1.0);
// elif index = 2 then
// return int(int(x^N *y^M/sqrt(x^2+(y-1)^2), x=0.0..1.0), y=0.0..1.0);
// elif index = 3 then
// return int(int((1-x)^N *(1-y)^M/sqrt(x^2+y^2), x=0.0..1.0),
// y=0.0..1.0);
// end if;
// end proc;
// Digits := 20;
// for i from 3 to 3 do
// for n from 0 to 5 do
// for m from 0 to 5 do
// C( v[i+1][n+1][m+1] = sing_int(i, n, m), resultname="a");
// end do;
// end do;
// end do;
static double v[4][6][6] = {{{0}}};
if (v[0][0][0] == 0)
{
v[0][0][0] = 0.17627471740390860505e1;
v[0][0][1] = 0.64779357469631903702e0;
v[0][0][2] = 0.38259785823210634567e0;
v[0][0][3] = 0.26915893322379450224e0;
v[0][0][4] = 0.20702239737104695572e0;
v[0][0][5] = 0.16800109713227567467e0;
v[0][1][0] = 0.64779357469631903702e0;
v[0][1][1] = 0.27614237491539669920e0;
v[0][1][2] = 0.17015838751246776515e0;
v[0][1][3] = 0.12189514164974600651e0;
v[0][1][4] = 0.94658660368131133694e-1;
v[0][1][5] = 0.77263794021029438797e-1;
v[0][2][0] = 0.38259785823210634567e0;
v[0][2][1] = 0.17015838751246776515e0;
v[0][2][2] = 0.10656799507071040471e0;
v[0][2][3] = 0.76947022258735165920e-1;
v[0][2][4] = 0.60022626787495395021e-1;
v[0][2][5] = 0.49131622931360879320e-1;
v[0][3][0] = 0.26915893322379450224e0;
v[0][3][1] = 0.12189514164974600651e0;
v[0][3][2] = 0.76947022258735165919e-1;
v[0][3][3] = 0.55789184535895709637e-1;
v[0][3][4] = 0.43625068213915842136e-1;
v[0][3][5] = 0.35766126849971778500e-1;
v[0][4][0] = 0.20702239737104695572e0;
v[0][4][1] = 0.94658660368131133694e-1;
v[0][4][2] = 0.60022626787495395021e-1;
v[0][4][3] = 0.43625068213915842137e-1;
v[0][4][4] = 0.34164088852375945192e-1;
v[0][4][5] = 0.28037139560980277614e-1;
v[0][5][0] = 0.16800109713227567467e0;
v[0][5][1] = 0.77263794021029438797e-1;
v[0][5][2] = 0.49131622931360879320e-1;
v[0][5][3] = 0.35766126849971778501e-1;
v[0][5][4] = 0.28037139560980277614e-1;
v[0][5][5] = 0.23024181049838367777e-1;
v[1][0][0] = 0.17627471740390860505e1;
v[1][0][1] = 0.64779357469631903702e0;
v[1][0][2] = 0.38259785823210634567e0;
v[1][0][3] = 0.26915893322379450224e0;
v[1][0][4] = 0.20702239737104695572e0;
v[1][0][5] = 0.16800109713227567467e0;
v[1][1][0] = 0.11149535993427670134e1;
v[1][1][1] = 0.37165119978092233782e0;
v[1][1][2] = 0.21243947071963858053e0;
v[1][1][3] = 0.14726379157404849573e0;
v[1][1][4] = 0.11236373700291582202e0;
v[1][1][5] = 0.90737303111246235871e-1;
v[1][2][0] = 0.84975788287855432210e0;
v[1][2][1] = 0.26566721237799340376e0;
v[1][2][2] = 0.14884907827788122009e0;
v[1][2][3] = 0.10231567218303765515e0;
v[1][2][4] = 0.77727703422280083352e-1;
v[1][2][5] = 0.62605132021577676395e-1;
v[1][3][0] = 0.69800109142265347423e0;
v[1][3][1] = 0.20794647083778622837e0;
v[1][3][2] = 0.11487965864809909847e0;
v[1][3][3] = 0.78525390514866270852e-1;
v[1][3][4] = 0.59489228415223897572e-1;
v[1][3][5] = 0.47838457013298217744e-1;
v[1][4][0] = 0.59754668912231692323e0;
v[1][4][1] = 0.17125249387868593878e0;
v[1][4][2] = 0.93606816359052444729e-1;
v[1][4][3] = 0.63728830247554475330e-1;
v[1][4][4] = 0.48187332620207367724e-1;
v[1][4][5] = 0.38708290797416359020e-1;
v[1][5][0] = 0.52527944036356840363e0;
v[1][5][1] = 0.14574366656617935708e0;
v[1][5][2] = 0.78997159795636003667e-1;
v[1][5][3] = 0.53620816423066464705e-1;
v[1][5][4] = 0.40487985967086264433e-1;
v[1][5][5] = 0.32498604596082509165e-1;
v[2][0][0] = 0.17627471740390860505e1;
v[2][0][1] = 0.11149535993427670134e1;
v[2][0][2] = 0.84975788287855432210e0;
v[2][0][3] = 0.69800109142265347419e0;
v[2][0][4] = 0.59754668912231692318e0;
v[2][0][5] = 0.52527944036356840362e0;
v[2][1][0] = 0.64779357469631903702e0;
v[2][1][1] = 0.37165119978092233782e0;
v[2][1][2] = 0.26566721237799340376e0;
v[2][1][3] = 0.20794647083778622835e0;
v[2][1][4] = 0.17125249387868593876e0;
v[2][1][5] = 0.14574366656617935708e0;
v[2][2][0] = 0.38259785823210634567e0;
v[2][2][1] = 0.21243947071963858053e0;
v[2][2][2] = 0.14884907827788122009e0;
v[2][2][3] = 0.11487965864809909845e0;
v[2][2][4] = 0.93606816359052444712e-1;
v[2][2][5] = 0.78997159795636003667e-1;
v[2][3][0] = 0.26915893322379450223e0;
v[2][3][1] = 0.14726379157404849572e0;
v[2][3][2] = 0.10231567218303765514e0;
v[2][3][3] = 0.78525390514866270835e-1;
v[2][3][4] = 0.63728830247554475311e-1;
v[2][3][5] = 0.53620816423066464702e-1;
v[2][4][0] = 0.20702239737104695572e0;
v[2][4][1] = 0.11236373700291582202e0;
v[2][4][2] = 0.77727703422280083352e-1;
v[2][4][3] = 0.59489228415223897563e-1;
v[2][4][4] = 0.48187332620207367713e-1;
v[2][4][5] = 0.40487985967086264434e-1;
v[2][5][0] = 0.16800109713227567468e0;
v[2][5][1] = 0.90737303111246235879e-1;
v[2][5][2] = 0.62605132021577676399e-1;
v[2][5][3] = 0.47838457013298217740e-1;
v[2][5][4] = 0.38708290797416359014e-1;
v[2][5][5] = 0.32498604596082509169e-1;
v[3][0][0] = 0.17627471740390860505e1;
v[3][0][1] = 0.11149535993427670134e1;
v[3][0][2] = 0.84975788287855432210e0;
v[3][0][3] = 0.69800109142265347419e0;
v[3][0][4] = 0.59754668912231692318e0;
v[3][0][5] = 0.52527944036356840362e0;
v[3][1][0] = 0.11149535993427670134e1;
v[3][1][1] = 0.74330239956184467563e0;
v[3][1][2] = 0.58409067050056091834e0;
v[3][1][3] = 0.49005462058486724584e0;
v[3][1][4] = 0.42629419524363098443e0;
v[3][1][5] = 0.37953577379738904654e0;
v[3][2][0] = 0.84975788287855432210e0;
v[3][2][1] = 0.58409067050056091834e0;
v[3][2][2] = 0.46727253640044873467e0;
v[3][2][3] = 0.39698780839518011595e0;
v[3][2][4] = 0.34864851772399749038e0;
v[3][2][5] = 0.31278926702684569312e0;
v[3][3][0] = 0.69800109142265347423e0;
v[3][3][1] = 0.49005462058486724586e0;
v[3][3][2] = 0.39698780839518011599e0;
v[3][3][3] = 0.34027526433872581371e0;
v[3][3][4] = 0.30088082631586196583e0;
v[3][3][5] = 0.27141910362887187844e0;
v[3][4][0] = 0.59754668912231692323e0;
v[3][4][1] = 0.42629419524363098445e0;
v[3][4][2] = 0.34864851772399749044e0;
v[3][4][3] = 0.30088082631586196576e0;
v[3][4][4] = 0.26744962339187730308e0;
v[3][4][5] = 0.24229245314748740295e0;
v[3][5][0] = 0.52527944036356840363e0;
v[3][5][1] = 0.37953577379738904655e0;
v[3][5][2] = 0.31278926702684569301e0;
v[3][5][3] = 0.27141910362887187862e0;
v[3][5][4] = 0.24229245314748740263e0;
v[3][5][5] = 0.22026586649771582089e0;
}
return v[vertex_index][i][j];
}
double
exact_integral_one_over_r_middle(const unsigned int i, const unsigned int j)
{
Assert(i < 6, ExcNotImplemented());
Assert(j < 6, ExcNotImplemented());
// The integrals are computed using the following Mathematica snippet of
// code:
//
// x0 = 0.5
// y0 = 0.5
// Do[Do[Print["v[", n, "][", m, "]=",
// NumberForm[
// NIntegrate[
// x^n*y^m/Sqrt[(x - x0)^2 + (y - y0)^2], {x, 0, 1}, {y, 0, 1},
// MaxRecursion -> 10000, PrecisionGoal -> 9], 9], ";"], {n, 0,
// 4}], {m, 0, 4}]
static double v[6][6] = {{0}};
if (v[0][0] == 0)
{
v[0][0] = 3.52549435;
;
v[1][0] = 1.76274717;
v[2][0] = 1.07267252;
v[3][0] = 0.727635187;
v[4][0] = 0.53316959;
v[0][1] = 1.76274717;
v[1][1] = 0.881373587;
v[2][1] = 0.536336258;
v[3][1] = 0.363817594;
v[4][1] = 0.266584795;
v[0][2] = 1.07267252;
v[1][2] = 0.536336258;
v[2][2] = 0.329313861;
v[3][2] = 0.225802662;
v[4][2] = 0.167105787;
v[0][3] = 0.727635187;
v[1][3] = 0.363817594;
v[2][3] = 0.225802662;
v[3][3] = 0.156795196;
v[4][3] = 0.117366283;
v[0][4] = 0.53316959;
v[1][4] = 0.266584795;
v[2][4] = 0.167105787;
v[3][4] = 0.117366283;
v[4][4] = 0.0887410133;
}
return v[i][j];
}
#endif
| {
"pile_set_name": "Github"
} |
# Copyright (c) Chris Choy ([email protected]).
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Please cite "4D Spatio-Temporal ConvNets: Minkowski Convolutional Neural
# Networks", CVPR'19 (https://arxiv.org/abs/1904.08755) if you use any part
# of the code.
import torch
import unittest
from MinkowskiEngine import SparseTensor, MinkowskiConvolution, \
MinkowskiSumPooling, \
MinkowskiAvgPoolingFunction, MinkowskiAvgPooling, \
MinkowskiPoolingTransposeFunction, MinkowskiPoolingTranspose, \
MinkowskiGlobalPoolingFunction, MinkowskiGlobalPooling, \
MinkowskiGlobalMaxPoolingFunction, MinkowskiGlobalMaxPooling, \
MinkowskiMaxPoolingFunction, MinkowskiMaxPooling, \
GlobalPoolingMode
from utils.gradcheck import gradcheck
from tests.common import data_loader
class TestPooling(unittest.TestCase):
def test_maxpooling(self):
in_channels, D = 2, 2
coords, feats, labels = data_loader(in_channels, batch_size=2)
feats.requires_grad_()
feats = feats.double()
input = SparseTensor(feats, coords=coords)
pool = MinkowskiMaxPooling(kernel_size=2, stride=2, dimension=D)
print(pool)
output = pool(input)
print(input)
print(output)
C = output.coords_man
print(C.get_coords(2))
region_type, _, _ = pool.kernel_generator.cache[(1, 1)]
print(
C.get_kernel_map(
1,
2,
stride=2,
kernel_size=2,
region_type=region_type,
is_pool=True))
# Check backward
fn = MinkowskiMaxPoolingFunction()
# Even numbered kernel_size error!
self.assertTrue(
gradcheck(
fn,
(input.F, input.tensor_stride, pool.stride, pool.kernel_size,
pool.dilation, pool.region_type_, pool.region_offset_,
input.coords_key, None, input.coords_man)))
if not torch.cuda.is_available():
return
device = torch.device('cuda')
input = input.to(device)
output = pool(input)
print(output)
# Check backward
self.assertTrue(
gradcheck(
fn,
(input.F, input.tensor_stride, pool.stride, pool.kernel_size,
pool.dilation, pool.region_type_, pool.region_offset_,
input.coords_key, None, input.coords_man)))
def test_sumpooling(self):
in_channels, D = 2, 2
coords, feats, labels = data_loader(in_channels)
feats = feats.double()
feats.requires_grad_()
input = SparseTensor(feats, coords=coords)
pool = MinkowskiSumPooling(kernel_size=3, stride=2, dimension=D)
output = pool(input)
print(output)
# Check backward
fn = MinkowskiAvgPoolingFunction()
self.assertTrue(
gradcheck(
fn,
(input.F, input.tensor_stride, pool.stride, pool.kernel_size,
pool.dilation, pool.region_type_, pool.region_offset_, False,
input.coords_key, None, input.coords_man)))
device = torch.device('cuda')
with torch.cuda.device(0):
input = input.to(device)
pool = pool.to(device)
output = pool(input)
print(output)
def test_avgpooling_gpu(self):
if not torch.cuda.is_available():
return
in_channels, D = 2, 2
coords, feats, labels = data_loader(in_channels)
feats = feats.double()
feats.requires_grad_()
input = SparseTensor(feats, coords=coords)
pool = MinkowskiAvgPooling(kernel_size=3, stride=2, dimension=D)
output = pool(input)
print(output)
device = torch.device('cuda')
with torch.cuda.device(0):
input = input.to(device)
pool = pool.to(device)
output = pool(input)
print(output)
# Check backward
fn = MinkowskiAvgPoolingFunction()
self.assertTrue(
gradcheck(
fn,
(input.F, input.tensor_stride, pool.stride, pool.kernel_size,
pool.dilation, pool.region_type_, pool.region_offset_, True,
input.coords_key, None, input.coords_man)))
def test_avgpooling(self):
in_channels, D = 2, 2
coords, feats, labels = data_loader(in_channels)
feats = feats.double()
feats.requires_grad_()
input = SparseTensor(feats, coords=coords)
pool = MinkowskiAvgPooling(kernel_size=3, stride=2, dimension=D)
output = pool(input)
print(output)
# Check backward
fn = MinkowskiAvgPoolingFunction()
self.assertTrue(
gradcheck(
fn,
(input.F, input.tensor_stride, pool.stride, pool.kernel_size,
pool.dilation, pool.region_type_, pool.region_offset_, True,
input.coords_key, None, input.coords_man)))
def test_global_avgpool(self):
in_channels = 2
coords, feats, labels = data_loader(in_channels, batch_size=2)
feats = feats.double()
feats.requires_grad_()
input = SparseTensor(feats, coords=coords)
pool = MinkowskiGlobalPooling()
output = pool(input)
print(output)
# Check backward
fn = MinkowskiGlobalPoolingFunction()
self.assertTrue(
gradcheck(fn, (input.F, True, GlobalPoolingMode.INDEX_SELECT,
input.coords_key, None, input.coords_man)))
self.assertTrue(
gradcheck(fn, (input.F, True, GlobalPoolingMode.SPARSE,
input.coords_key, None, input.coords_man)))
coords, feats, labels = data_loader(in_channels, batch_size=1)
feats = feats.double()
feats.requires_grad_()
input = SparseTensor(feats, coords=coords)
pool = MinkowskiGlobalPooling()
output = pool(input)
print(output)
# Check backward
fn = MinkowskiGlobalPoolingFunction()
self.assertTrue(
gradcheck(fn, (input.F, True, GlobalPoolingMode.AUTO,
input.coords_key, None, input.coords_man)))
def test_global_maxpool(self):
in_channels = 2
coords, feats, labels = data_loader(in_channels)
feats = feats.double()
feats.requires_grad_()
input = SparseTensor(feats, coords=coords)
pool = MinkowskiGlobalMaxPooling()
output = pool(input)
print(output)
# Check backward
fn = MinkowskiGlobalMaxPoolingFunction()
self.assertTrue(
gradcheck(fn, (input.F, input.coords_key, None, input.coords_man)))
if torch.cuda.is_available():
input_cuda = input.to(torch.device(0))
output_cuda = pool(input)
self.assertTrue(torch.allclose(output_cuda.F.cpu(), output.F))
def test_unpool(self):
in_channels, out_channels, D = 2, 3, 2
coords, feats, labels = data_loader(in_channels)
feats = feats.double()
input = SparseTensor(feats, coords=coords)
conv = MinkowskiConvolution(
in_channels, out_channels, kernel_size=3, stride=2, dimension=D)
conv = conv.double()
unpool = MinkowskiPoolingTranspose(kernel_size=3, stride=2, dimension=D)
input = conv(input)
output = unpool(input)
print(output)
# Check backward
fn = MinkowskiPoolingTransposeFunction()
self.assertTrue(
gradcheck(fn, (input.F, input.tensor_stride, unpool.stride,
unpool.kernel_size, unpool.dilation,
unpool.region_type_, unpool.region_offset_, False,
input.coords_key, None, input.coords_man)))
def test_unpooling_gpu(self):
if not torch.cuda.is_available():
return
in_channels, out_channels, D = 2, 3, 2
coords, feats, labels = data_loader(in_channels)
feats = feats.double()
input = SparseTensor(feats, coords=coords)
conv = MinkowskiConvolution(
in_channels, out_channels, kernel_size=3, stride=2, dimension=D)
conv = conv.double()
unpool = MinkowskiPoolingTranspose(kernel_size=3, stride=2, dimension=D)
input = conv(input)
output = unpool(input)
print(output)
# Check backward
fn = MinkowskiPoolingTransposeFunction()
self.assertTrue(
gradcheck(fn, (input.F, input.tensor_stride, unpool.stride,
unpool.kernel_size, unpool.dilation,
unpool.region_type_, unpool.region_offset_, False,
input.coords_key, None, input.coords_man)))
device = torch.device('cuda')
with torch.cuda.device(0):
input = input.to(device)
output = unpool(input)
print(output)
# Check backward
self.assertTrue(
gradcheck(fn, (input.F, input.tensor_stride, unpool.stride,
unpool.kernel_size, unpool.dilation,
unpool.region_type_, unpool.region_offset_, True,
input.coords_key, None, input.coords_man)))
if __name__ == '__main__':
unittest.main()
| {
"pile_set_name": "Github"
} |
// UpdateCallback.h
#include "StdAfx.h"
#include "Common/StringConvert.h"
#include "UpdateCallback100.h"
// #include "Windows/ProcessMessages.h"
// #include "Resource/PasswordDialog/PasswordDialog.h"
#include "MessagesDialog.h"
#include "Common/Defs.h"
using namespace NWindows;
CUpdateCallback100Imp::~CUpdateCallback100Imp()
{
if (ShowMessages && !Messages.IsEmpty())
{
CMessagesDialog messagesDialog;
messagesDialog.Messages = &Messages;
messagesDialog.Create(_parentWindow);
}
}
void CUpdateCallback100Imp::AddErrorMessage(LPCWSTR message)
{
Messages.Add(message);
}
STDMETHODIMP CUpdateCallback100Imp::SetNumFiles(UInt64 numFiles)
{
ProgressDialog.ProgressSynch.SetNumFilesTotal(numFiles);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::SetTotal(UInt64 size)
{
ProgressDialog.ProgressSynch.SetProgress(size, 0);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UInt64 *completeValue)
{
RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
if (completeValue != NULL)
ProgressDialog.ProgressSynch.SetPos(*completeValue);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
{
ProgressDialog.ProgressSynch.SetRatioInfo(inSize, outSize);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::CompressOperation(const wchar_t *name)
{
ProgressDialog.ProgressSynch.SetCurrentFileName(name);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::DeleteOperation(const wchar_t *name)
{
ProgressDialog.ProgressSynch.SetCurrentFileName(name);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::OperationResult(Int32 /* operationResult */)
{
NumFiles++;
ProgressDialog.ProgressSynch.SetNumFilesCur(NumFiles);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::UpdateErrorMessage(const wchar_t *message)
{
AddErrorMessage(message);
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{
*passwordIsDefined = BoolToInt(_passwordIsDefined);
if (!_passwordIsDefined)
{
return S_OK;
/*
CPasswordDialog dialog;
if (dialog.Create(_parentWindow) == IDCANCEL)
return E_ABORT;
_password = dialog._password;
_passwordIsDefined = true;
*/
}
*passwordIsDefined = BoolToInt(_passwordIsDefined);
return StringToBstr(_password, password);
}
STDMETHODIMP CUpdateCallback100Imp::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
{
return S_OK;
}
STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UInt64 * /* files */, const UInt64 * /* bytes */)
{
return ProgressDialog.ProgressSynch.ProcessStopAndPause();
}
STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword(BSTR *password)
{
if (!_passwordIsDefined)
return S_FALSE;
return StringToBstr(_password, password);
}
| {
"pile_set_name": "Github"
} |
Contributing
============
You would like to contribute? Great! PRs are highly appreciated. If you have any idea, how to make this library and the tools
connected to it better, just reach out to me. Either open an issue or contact me directly. Everyone is welcome!
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C946E3601AC5A60F00551F93"
BuildableName = "MOAspectsDemo.app"
BlueprintName = "MOAspectsDemo"
ReferencedContainer = "container:MOAspectsDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C946E3791AC5A60F00551F93"
BuildableName = "MOAspectsDemoTests.xctest"
BlueprintName = "MOAspectsDemoTests"
ReferencedContainer = "container:MOAspectsDemo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C946E3791AC5A60F00551F93"
BuildableName = "MOAspectsDemoTests.xctest"
BlueprintName = "MOAspectsDemoTests"
ReferencedContainer = "container:MOAspectsDemo.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C946E3601AC5A60F00551F93"
BuildableName = "MOAspectsDemo.app"
BlueprintName = "MOAspectsDemo"
ReferencedContainer = "container:MOAspectsDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C946E3601AC5A60F00551F93"
BuildableName = "MOAspectsDemo.app"
BlueprintName = "MOAspectsDemo"
ReferencedContainer = "container:MOAspectsDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C946E3601AC5A60F00551F93"
BuildableName = "MOAspectsDemo.app"
BlueprintName = "MOAspectsDemo"
ReferencedContainer = "container:MOAspectsDemo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
| {
"pile_set_name": "Github"
} |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <limits.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include "secrng.h"
#include "secerr.h"
#include "prerror.h"
#include "prthread.h"
#include "prprf.h"
#include "prenv.h"
size_t RNG_FileUpdate(const char *fileName, size_t limit);
/*
* When copying data to the buffer we want the least signicant bytes
* from the input since those bits are changing the fastest. The address
* of least significant byte depends upon whether we are running on
* a big-endian or little-endian machine.
*
* Does this mean the least signicant bytes are the most significant
* to us? :-)
*/
static size_t
CopyLowBits(void *dst, size_t dstlen, void *src, size_t srclen)
{
union endianness {
PRInt32 i;
char c[4];
} u;
if (srclen <= dstlen) {
memcpy(dst, src, srclen);
return srclen;
}
u.i = 0x01020304;
if (u.c[0] == 0x01) {
/* big-endian case */
memcpy(dst, (char *)src + (srclen - dstlen), dstlen);
} else {
/* little-endian case */
memcpy(dst, src, dstlen);
}
return dstlen;
}
#ifdef SOLARIS
#include <kstat.h>
static const PRUint32 entropy_buf_len = 4096; /* buffer up to 4 KB */
/* Buffer entropy data, and feed it to the RNG, entropy_buf_len bytes at a time.
* Returns error if RNG_RandomUpdate fails. Also increments *total_fed
* by the number of bytes successfully buffered.
*/
static SECStatus
BufferEntropy(char *inbuf, PRUint32 inlen,
char *entropy_buf, PRUint32 *entropy_buffered,
PRUint32 *total_fed)
{
PRUint32 tocopy = 0;
PRUint32 avail = 0;
SECStatus rv = SECSuccess;
while (inlen) {
avail = entropy_buf_len - *entropy_buffered;
if (!avail) {
/* Buffer is full, time to feed it to the RNG. */
rv = RNG_RandomUpdate(entropy_buf, entropy_buf_len);
if (SECSuccess != rv) {
break;
}
*entropy_buffered = 0;
avail = entropy_buf_len;
}
tocopy = PR_MIN(avail, inlen);
memcpy(entropy_buf + *entropy_buffered, inbuf, tocopy);
*entropy_buffered += tocopy;
inlen -= tocopy;
inbuf += tocopy;
*total_fed += tocopy;
}
return rv;
}
/* Feed kernel statistics structures and ks_data field to the RNG.
* Returns status as well as the number of bytes successfully fed to the RNG.
*/
static SECStatus
RNG_kstat(PRUint32 *fed)
{
kstat_ctl_t *kc = NULL;
kstat_t *ksp = NULL;
PRUint32 entropy_buffered = 0;
char *entropy_buf = NULL;
SECStatus rv = SECSuccess;
PORT_Assert(fed);
if (!fed) {
return SECFailure;
}
*fed = 0;
kc = kstat_open();
PORT_Assert(kc);
if (!kc) {
return SECFailure;
}
entropy_buf = (char *)PORT_Alloc(entropy_buf_len);
PORT_Assert(entropy_buf);
if (entropy_buf) {
for (ksp = kc->kc_chain; ksp != NULL; ksp = ksp->ks_next) {
if (-1 == kstat_read(kc, ksp, NULL)) {
/* missing data from a single kstat shouldn't be fatal */
continue;
}
rv = BufferEntropy((char *)ksp, sizeof(kstat_t),
entropy_buf, &entropy_buffered,
fed);
if (SECSuccess != rv) {
break;
}
if (ksp->ks_data && ksp->ks_data_size > 0 && ksp->ks_ndata > 0) {
rv = BufferEntropy((char *)ksp->ks_data, ksp->ks_data_size,
entropy_buf, &entropy_buffered,
fed);
if (SECSuccess != rv) {
break;
}
}
}
if (SECSuccess == rv && entropy_buffered) {
/* Buffer is not empty, time to feed it to the RNG */
rv = RNG_RandomUpdate(entropy_buf, entropy_buffered);
}
PORT_Free(entropy_buf);
} else {
rv = SECFailure;
}
if (kstat_close(kc)) {
PORT_Assert(0);
rv = SECFailure;
}
return rv;
}
#endif
#if defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(FREEBSD) || defined(NETBSD) || defined(DARWIN) || defined(OPENBSD) || defined(NTO) || defined(__riscos__) || defined(__GNU__) || defined(__FreeBSD_kernel__) || defined(__NetBSD_kernel__)
#include <sys/times.h>
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
int ticks;
struct tms buffer;
ticks = times(&buffer);
return CopyLowBits(buf, maxbytes, &ticks, sizeof(ticks));
}
static void
GiveSystemInfo(void)
{
long si;
/*
* Is this really necessary? Why not use rand48 or something?
*/
si = sysconf(_SC_CHILD_MAX);
RNG_RandomUpdate(&si, sizeof(si));
si = sysconf(_SC_STREAM_MAX);
RNG_RandomUpdate(&si, sizeof(si));
si = sysconf(_SC_OPEN_MAX);
RNG_RandomUpdate(&si, sizeof(si));
}
#endif
#if defined(__sun)
#if defined(__svr4) || defined(SVR4)
#include <sys/systeminfo.h>
static void
GiveSystemInfo(void)
{
int rv;
char buf[2000];
rv = sysinfo(SI_MACHINE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_RELEASE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_HW_SERIAL, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
}
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
hrtime_t t;
t = gethrtime();
if (t) {
return CopyLowBits(buf, maxbytes, &t, sizeof(t));
}
return 0;
}
#else /* SunOS (Sun, but not SVR4) */
extern long sysconf(int name);
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
return 0;
}
static void
GiveSystemInfo(void)
{
long si;
/* This is not very good */
si = sysconf(_SC_CHILD_MAX);
RNG_RandomUpdate(&si, sizeof(si));
}
#endif
#endif /* Sun */
#if defined(__hpux)
#include <sys/unistd.h>
#if defined(__ia64)
#include <ia64/sys/inline.h>
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
PRUint64 t;
t = _Asm_mov_from_ar(_AREG44);
return CopyLowBits(buf, maxbytes, &t, sizeof(t));
}
#else
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
extern int ret_cr16();
int cr16val;
cr16val = ret_cr16();
return CopyLowBits(buf, maxbytes, &cr16val, sizeof(cr16val));
}
#endif
static void
GiveSystemInfo(void)
{
long si;
/* This is not very good */
si = sysconf(_AES_OS_VERSION);
RNG_RandomUpdate(&si, sizeof(si));
si = sysconf(_SC_CPU_VERSION);
RNG_RandomUpdate(&si, sizeof(si));
}
#endif /* HPUX */
#if defined(OSF1)
#include <sys/types.h>
#include <sys/sysinfo.h>
#include <sys/systeminfo.h>
#include <c_asm.h>
static void
GiveSystemInfo(void)
{
char buf[BUFSIZ];
int rv;
int off = 0;
rv = sysinfo(SI_MACHINE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_RELEASE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_HW_SERIAL, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
}
/*
* Use the "get the cycle counter" instruction on the alpha.
* The low 32 bits completely turn over in less than a minute.
* The high 32 bits are some non-counter gunk that changes sometimes.
*/
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
unsigned long t;
t = asm("rpcc %v0");
return CopyLowBits(buf, maxbytes, &t, sizeof(t));
}
#endif /* Alpha */
#if defined(_IBMR2)
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
return 0;
}
static void
GiveSystemInfo(void)
{
/* XXX haven't found any yet! */
}
#endif /* IBM R2 */
#if defined(LINUX)
#include <sys/sysinfo.h>
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
return 0;
}
static void
GiveSystemInfo(void)
{
#ifndef NO_SYSINFO
struct sysinfo si;
if (sysinfo(&si) == 0) {
RNG_RandomUpdate(&si, sizeof(si));
}
#endif
}
#endif /* LINUX */
#if defined(NCR)
#include <sys/utsname.h>
#include <sys/systeminfo.h>
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
return 0;
}
static void
GiveSystemInfo(void)
{
int rv;
char buf[2000];
rv = sysinfo(SI_MACHINE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_RELEASE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_HW_SERIAL, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
}
#endif /* NCR */
#if defined(sgi)
#include <fcntl.h>
#undef PRIVATE
#include <sys/mman.h>
#include <sys/syssgi.h>
#include <sys/immu.h>
#include <sys/systeminfo.h>
#include <sys/utsname.h>
#include <wait.h>
static void
GiveSystemInfo(void)
{
int rv;
char buf[4096];
rv = syssgi(SGI_SYSID, &buf[0]);
if (rv > 0) {
RNG_RandomUpdate(buf, MAXSYSIDSIZE);
}
#ifdef SGI_RDUBLK
rv = syssgi(SGI_RDUBLK, getpid(), &buf[0], sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, sizeof(buf));
}
#endif /* SGI_RDUBLK */
rv = syssgi(SGI_INVENT, SGI_INV_READ, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, sizeof(buf));
}
rv = sysinfo(SI_MACHINE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_RELEASE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_HW_SERIAL, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
}
static size_t
GetHighResClock(void *buf, size_t maxbuf)
{
unsigned phys_addr, raddr, cycleval;
static volatile unsigned *iotimer_addr = NULL;
static int tries = 0;
static int cntr_size;
int mfd;
long s0[2];
struct timeval tv;
#ifndef SGI_CYCLECNTR_SIZE
#define SGI_CYCLECNTR_SIZE 165 /* Size user needs to use to read CC */
#endif
if (iotimer_addr == NULL) {
if (tries++ > 1) {
/* Don't keep trying if it didn't work */
return 0;
}
/*
** For SGI machines we can use the cycle counter, if it has one,
** to generate some truly random numbers
*/
phys_addr = syssgi(SGI_QUERY_CYCLECNTR, &cycleval);
if (phys_addr) {
int pgsz = getpagesize();
int pgoffmask = pgsz - 1;
raddr = phys_addr & ~pgoffmask;
mfd = open("/dev/mmem", O_RDONLY);
if (mfd < 0) {
return 0;
}
iotimer_addr = (unsigned *)
mmap(0, pgoffmask, PROT_READ, MAP_PRIVATE, mfd, (int)raddr);
if (iotimer_addr == (void *)-1) {
close(mfd);
iotimer_addr = NULL;
return 0;
}
iotimer_addr = (unsigned *)((__psint_t)iotimer_addr | (phys_addr & pgoffmask));
/*
* The file 'mfd' is purposefully not closed.
*/
cntr_size = syssgi(SGI_CYCLECNTR_SIZE);
if (cntr_size < 0) {
struct utsname utsinfo;
/*
* We must be executing on a 6.0 or earlier system, since the
* SGI_CYCLECNTR_SIZE call is not supported.
*
* The only pre-6.1 platforms with 64-bit counters are
* IP19 and IP21 (Challenge, PowerChallenge, Onyx).
*/
uname(&utsinfo);
if (!strncmp(utsinfo.machine, "IP19", 4) ||
!strncmp(utsinfo.machine, "IP21", 4))
cntr_size = 64;
else
cntr_size = 32;
}
cntr_size /= 8; /* Convert from bits to bytes */
}
}
s0[0] = *iotimer_addr;
if (cntr_size > 4)
s0[1] = *(iotimer_addr + 1);
memcpy(buf, (char *)&s0[0], cntr_size);
return CopyLowBits(buf, maxbuf, &s0, cntr_size);
}
#endif
#if defined(sony)
#include <sys/systeminfo.h>
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
return 0;
}
static void
GiveSystemInfo(void)
{
int rv;
char buf[2000];
rv = sysinfo(SI_MACHINE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_RELEASE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_HW_SERIAL, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
}
#endif /* sony */
#if defined(sinix)
#include <sys/systeminfo.h>
#include <sys/times.h>
int gettimeofday(struct timeval *, struct timezone *);
int gethostname(char *, int);
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
int ticks;
struct tms buffer;
ticks = times(&buffer);
return CopyLowBits(buf, maxbytes, &ticks, sizeof(ticks));
}
static void
GiveSystemInfo(void)
{
int rv;
char buf[2000];
rv = sysinfo(SI_MACHINE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_RELEASE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_HW_SERIAL, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
}
#endif /* sinix */
#ifdef BEOS
#include <be/kernel/OS.h>
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
bigtime_t bigtime; /* Actually a int64 */
bigtime = real_time_clock_usecs();
return CopyLowBits(buf, maxbytes, &bigtime, sizeof(bigtime));
}
static void
GiveSystemInfo(void)
{
system_info *info = NULL;
PRInt32 val;
get_system_info(info);
if (info) {
val = info->boot_time;
RNG_RandomUpdate(&val, sizeof(val));
val = info->used_pages;
RNG_RandomUpdate(&val, sizeof(val));
val = info->used_ports;
RNG_RandomUpdate(&val, sizeof(val));
val = info->used_threads;
RNG_RandomUpdate(&val, sizeof(val));
val = info->used_teams;
RNG_RandomUpdate(&val, sizeof(val));
}
}
#endif /* BEOS */
#if defined(nec_ews)
#include <sys/systeminfo.h>
static size_t
GetHighResClock(void *buf, size_t maxbytes)
{
return 0;
}
static void
GiveSystemInfo(void)
{
int rv;
char buf[2000];
rv = sysinfo(SI_MACHINE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_RELEASE, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
rv = sysinfo(SI_HW_SERIAL, buf, sizeof(buf));
if (rv > 0) {
RNG_RandomUpdate(buf, rv);
}
}
#endif /* nec_ews */
size_t
RNG_GetNoise(void *buf, size_t maxbytes)
{
struct timeval tv;
int n = 0;
int c;
n = GetHighResClock(buf, maxbytes);
maxbytes -= n;
(void)gettimeofday(&tv, 0);
c = CopyLowBits((char *)buf + n, maxbytes, &tv.tv_usec, sizeof(tv.tv_usec));
n += c;
maxbytes -= c;
c = CopyLowBits((char *)buf + n, maxbytes, &tv.tv_sec, sizeof(tv.tv_sec));
n += c;
return n;
}
#ifdef DARWIN
#include <TargetConditionals.h>
#if !TARGET_OS_IPHONE
#include <crt_externs.h>
#endif
#endif
void
RNG_SystemInfoForRNG(void)
{
char buf[BUFSIZ];
size_t bytes;
const char *const *cp;
char *randfile;
#ifdef DARWIN
#if TARGET_OS_IPHONE
/* iOS does not expose a way to access environ. */
char **environ = NULL;
#else
char **environ = *_NSGetEnviron();
#endif
#else
extern char **environ;
#endif
#ifdef BEOS
static const char *const files[] = {
"/boot/var/swap",
"/boot/var/log/syslog",
"/boot/var/tmp",
"/boot/home/config/settings",
"/boot/home",
0
};
#else
static const char *const files[] = {
"/etc/passwd",
"/etc/utmp",
"/tmp",
"/var/tmp",
"/usr/tmp",
0
};
#endif
GiveSystemInfo();
bytes = RNG_GetNoise(buf, sizeof(buf));
RNG_RandomUpdate(buf, bytes);
/*
* Pass the C environment and the addresses of the pointers to the
* hash function. This makes the random number function depend on the
* execution environment of the user and on the platform the program
* is running on.
*/
if (environ != NULL) {
cp = (const char *const *)environ;
while (*cp) {
RNG_RandomUpdate(*cp, strlen(*cp));
cp++;
}
RNG_RandomUpdate(environ, (char *)cp - (char *)environ);
}
/* Give in system information */
if (gethostname(buf, sizeof(buf)) == 0) {
RNG_RandomUpdate(buf, strlen(buf));
}
/* grab some data from system's PRNG before any other files. */
bytes = RNG_FileUpdate("/dev/urandom", SYSTEM_RNG_SEED_COUNT);
if (!bytes) {
PORT_SetError(SEC_ERROR_NEED_RANDOM);
}
/* If the user points us to a random file, pass it through the rng */
randfile = PR_GetEnvSecure("NSRANDFILE");
if ((randfile != NULL) && (randfile[0] != '\0')) {
char *randCountString = PR_GetEnvSecure("NSRANDCOUNT");
int randCount = randCountString ? atoi(randCountString) : 0;
if (randCount != 0) {
RNG_FileUpdate(randfile, randCount);
} else {
RNG_FileForRNG(randfile);
}
}
/* pass other files through */
for (cp = files; *cp; cp++)
RNG_FileForRNG(*cp);
#if defined(BSDI) || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(DARWIN) || defined(LINUX) || defined(HPUX)
if (bytes)
return;
#endif
#ifdef SOLARIS
if (!bytes) {
/* On Solaris 8, /dev/urandom isn't available, so we use libkstat. */
PRUint32 kstat_bytes = 0;
if (SECSuccess != RNG_kstat(&kstat_bytes)) {
PORT_Assert(0);
}
bytes += kstat_bytes;
PORT_Assert(bytes);
}
#endif
}
#define TOTAL_FILE_LIMIT 1000000 /* one million */
size_t
RNG_FileUpdate(const char *fileName, size_t limit)
{
FILE *file;
int fd;
int bytes;
size_t fileBytes = 0;
struct stat stat_buf;
unsigned char buffer[BUFSIZ];
static size_t totalFileBytes = 0;
/* suppress valgrind warnings due to holes in struct stat */
memset(&stat_buf, 0, sizeof(stat_buf));
if (stat((char *)fileName, &stat_buf) < 0)
return fileBytes;
RNG_RandomUpdate(&stat_buf, sizeof(stat_buf));
file = fopen(fileName, "r");
if (file != NULL) {
/* Read from the underlying file descriptor directly to bypass stdio
* buffering and avoid reading more bytes than we need from
* /dev/urandom. NOTE: we can't use fread with unbuffered I/O because
* fread may return EOF in unbuffered I/O mode on Android.
*
* Moreover, we read into a buffer of size BUFSIZ, so buffered I/O
* has no performance advantage. */
fd = fileno(file);
/* 'file' was just opened, so this should not fail. */
PORT_Assert(fd != -1);
while (limit > fileBytes && fd != -1) {
bytes = PR_MIN(sizeof buffer, limit - fileBytes);
bytes = read(fd, buffer, bytes);
if (bytes <= 0)
break;
RNG_RandomUpdate(buffer, bytes);
fileBytes += bytes;
totalFileBytes += bytes;
/* after TOTAL_FILE_LIMIT has been reached, only read in first
** buffer of data from each subsequent file.
*/
if (totalFileBytes > TOTAL_FILE_LIMIT)
break;
}
fclose(file);
}
/*
* Pass yet another snapshot of our highest resolution clock into
* the hash function.
*/
bytes = RNG_GetNoise(buffer, sizeof(buffer));
RNG_RandomUpdate(buffer, bytes);
return fileBytes;
}
void
RNG_FileForRNG(const char *fileName)
{
RNG_FileUpdate(fileName, TOTAL_FILE_LIMIT);
}
#define _POSIX_PTHREAD_SEMANTICS
#include <dirent.h>
PRBool
ReadFileOK(char *dir, char *file)
{
struct stat stat_buf;
char filename[PATH_MAX];
int count = snprintf(filename, sizeof filename, "%s/%s", dir, file);
if (count <= 0) {
return PR_FALSE; /* name too long, can't read it anyway */
}
if (stat(filename, &stat_buf) < 0)
return PR_FALSE; /* can't stat, probably can't read it then as well */
return S_ISREG(stat_buf.st_mode) ? PR_TRUE : PR_FALSE;
}
size_t
RNG_SystemRNG(void *dest, size_t maxLen)
{
FILE *file;
int fd;
int bytes;
size_t fileBytes = 0;
unsigned char *buffer = dest;
file = fopen("/dev/urandom", "r");
if (file == NULL) {
PORT_SetError(SEC_ERROR_NEED_RANDOM);
return 0;
}
/* Read from the underlying file descriptor directly to bypass stdio
* buffering and avoid reading more bytes than we need from /dev/urandom.
* NOTE: we can't use fread with unbuffered I/O because fread may return
* EOF in unbuffered I/O mode on Android.
*/
fd = fileno(file);
/* 'file' was just opened, so this should not fail. */
PORT_Assert(fd != -1);
while (maxLen > fileBytes && fd != -1) {
bytes = maxLen - fileBytes;
bytes = read(fd, buffer, bytes);
if (bytes <= 0)
break;
fileBytes += bytes;
buffer += bytes;
}
fclose(file);
if (fileBytes != maxLen) {
PORT_SetError(SEC_ERROR_NEED_RANDOM); /* system RNG failed */
fileBytes = 0;
}
return fileBytes;
}
| {
"pile_set_name": "Github"
} |
package org.tigris.subversion.subclipse.ui.wizards;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
import org.tigris.subversion.subclipse.ui.SVNUIPlugin;
public class WizardDialogWithPersistedLocation extends ClosableWizardDialog {
private String id;
private IDialogSettings settings;
public WizardDialogWithPersistedLocation(Shell parentShell, IWizard newWizard, String id) {
super(parentShell, newWizard);
this.id = id;
settings = SVNUIPlugin.getPlugin().getDialogSettings();
}
protected void cancelPressed() {
saveLocation();
super.cancelPressed();
}
protected void okPressed() {
saveLocation();
super.okPressed();
}
protected Point getInitialLocation(Point initialSize) {
try {
int x = settings.getInt(id + ".location.x"); // $NON-NLS-1$
int y = settings.getInt(id + ".location.y"); // $NON-NLS-1$
return new Point(x, y);
} catch (NumberFormatException e) {
}
return super.getInitialLocation(initialSize);
}
protected Point getInitialSize() {
try {
int x = settings.getInt(id + ".size.x"); // $NON-NLS-1$
int y = settings.getInt(id + ".size.y"); // $NON-NLS-1$
return new Point(x, y);
} catch (NumberFormatException e) {
}
return super.getInitialSize();
}
protected void saveLocation() {
int x = getShell().getLocation().x;
int y = getShell().getLocation().y;
settings.put(id + ".location.x", x); // $NON-NLS-1$
settings.put(id + ".location.y", y); // $NON-NLS-1$
x = getShell().getSize().x;
y = getShell().getSize().y;
settings.put(id + ".size.x", x); // $NON-NLS-1$
settings.put(id + ".size.y", y); // $NON-NLS-1$
}
}
| {
"pile_set_name": "Github"
} |
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>LocalRVL: RVL::QuaternaryLocalFunctionObjectConstEval< DataType > Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">LocalRVL <span id="projectnumber">1.0</span></div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li id="searchli">
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="elRef" doxygen="RVL.tag:../../../rvl/doc/html//" href="../../../rvl/doc/html/namespaceRVL.html">RVL</a> </li>
<li class="navelem"><a class="el" href="classRVL_1_1QuaternaryLocalFunctionObjectConstEval.html">QuaternaryLocalFunctionObjectConstEval</a> </li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> </div>
<div class="headertitle">
<h1>RVL::QuaternaryLocalFunctionObjectConstEval< DataType > Class Template Reference</h1> </div>
</div>
<div class="contents">
<!-- doxytag: class="RVL::QuaternaryLocalFunctionObjectConstEval" --><!-- doxytag: inherits="RVL::FunctionObjectConstEval,RVL::QuaternaryLocalConstEval" -->
<p><code>#include <<a class="el" href="localreduction_8hh_source.html">localreduction.hh</a>></code></p>
<div class="dynheader">
Inheritance diagram for RVL::QuaternaryLocalFunctionObjectConstEval< DataType >:</div>
<div class="dyncontent">
<div class="center">
<img src="classRVL_1_1QuaternaryLocalFunctionObjectConstEval.png" usemap="#RVL::QuaternaryLocalFunctionObjectConstEval< DataType >_map" alt=""/>
<map id="RVL::QuaternaryLocalFunctionObjectConstEval< DataType >_map" name="RVL::QuaternaryLocalFunctionObjectConstEval< DataType >_map">
<area doxygen="RVL.tag:../../../rvl/doc/html//" href="../../../rvl/doc/html/classRVL_1_1FunctionObjectConstEval.html" alt="RVL::FunctionObjectConstEval" shape="rect" coords="0,56,359,80"/>
<area href="classRVL_1_1QuaternaryLocalConstEval.html" alt="RVL::QuaternaryLocalConstEval< DataType >" shape="rect" coords="369,56,728,80"/>
<area doxygen="RVL.tag:../../../rvl/doc/html//" href="../../../rvl/doc/html/classRVL_1_1Writeable.html" alt="RVL::Writeable" shape="rect" coords="0,0,359,24"/>
<area href="classRVL_1_1LocalConstEval.html" alt="RVL::LocalConstEval< DataType >" shape="rect" coords="369,0,728,24"/>
</map>
</div></div>
<p><a href="classRVL_1_1QuaternaryLocalFunctionObjectConstEval-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classRVL_1_1QuaternaryLocalFunctionObjectConstEval.html#a10e94488778198378b3f4f095c1318a2">~QuaternaryLocalFunctionObjectConstEval</a> ()</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<div class="textblock"><h3>template<typename DataType><br/>
class RVL::QuaternaryLocalFunctionObjectConstEval< DataType ></h3>
<p>Definition at line <a class="el" href="localreduction_8hh_source.html#l00195">195</a> of file <a class="el" href="localreduction_8hh_source.html">localreduction.hh</a>.</p>
</div><hr/><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" id="a10e94488778198378b3f4f095c1318a2"></a><!-- doxytag: member="RVL::QuaternaryLocalFunctionObjectConstEval::~QuaternaryLocalFunctionObjectConstEval" ref="a10e94488778198378b3f4f095c1318a2" args="()" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<typename DataType > </div>
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="classRVL_1_1QuaternaryLocalFunctionObjectConstEval.html">RVL::QuaternaryLocalFunctionObjectConstEval</a>< DataType >::~<a class="el" href="classRVL_1_1QuaternaryLocalFunctionObjectConstEval.html">QuaternaryLocalFunctionObjectConstEval</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="localreduction_8hh_source.html#l00198">198</a> of file <a class="el" href="localreduction_8hh_source.html">localreduction.hh</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="localreduction_8hh_source.html">localreduction.hh</a></li>
</ul>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Friends</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Thu Jan 29 2015 14:32:57 for LocalRVL by 
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>
| {
"pile_set_name": "Github"
} |
using P2PSocket.Core.Models;
using P2PSocket.Core.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace P2PSocket.Server.Models
{
public class FileManager : IFileManager
{
public const string MacAdress = "MacAdress";
AppCenter appCenter;
public FileManager()
{
appCenter = EasyInject.Get<AppCenter>();
}
private string GetFilePath(string fileType)
{
string path = "";
switch (fileType)
{
case Config:
{
path = appCenter.ConfigFile;
break;
}
case Log:
{
path = Path.Combine(appCenter.RuntimePath, "P2PSocket", "Logs", $"Server_{DateTime.Now:yyyy-MM-dd}.log");
break;
}
case MacAdress:
{
path = appCenter.MacMapFile;
break;
}
}
return path;
}
private StreamReader GetReader(string fileType)
{
string filePath = GetFilePath(fileType);
StreamReader reader = new StreamReader(filePath);
return reader;
}
private StreamWriter GetWriter(string fileType, bool isAppend)
{
string filePath = GetFilePath(fileType);
StreamWriter writer = new StreamWriter(filePath, isAppend);
return writer;
}
public override bool IsExist(string fileType)
{
return File.Exists(GetFilePath(fileType));
}
public override bool Create(string fileType)
{
FileInfo fileInfo = new FileInfo(GetFilePath(fileType));
if (!fileInfo.Directory.Exists)
{
fileInfo.Directory.Create();
}
fileInfo.CreateText().Close();
return true;
}
public override string ReadAll(string fileType)
{
StreamReader reader = GetReader(fileType);
string ret = reader.ReadToEnd();
reader.Close();
return ret;
}
public override void ReadLine(string fileType, Action<string> func)
{
StreamReader reader = GetReader(fileType);
while (!reader.EndOfStream)
{
func(reader.ReadLine());
}
reader.Close();
}
public override void WriteAll(string fileType, string text, bool isAppend = true)
{
StreamWriter writer = GetWriter(fileType, isAppend);
writer.Write(text);
writer.Close();
}
public override void ForeachWrite(string fileType, Action<Action<string>> func, bool isAppend = true)
{
StreamWriter writer = GetWriter(fileType, isAppend);
func(lineStr => {
writer.WriteLine(lineStr);
});
writer.Close();
}
}
}
| {
"pile_set_name": "Github"
} |
###########################################################################
# LibreCNC
###########################################################################
- name: librecnc_core_ar71xx_generic_packages
type: repository
desc: libreCNC current/core/ar71xx/generic/packages
family: librecnc # XXX
minpackages: 1 # XXX
sources:
- name: Packages
fetcher: FileFetcher
parser: DebianSourcesParser
url: 'https://librecmc.org/librecmc/downloads/snapshots/current/core/ar71xx/generic/packages/Packages.gz'
compression: gz
tags: [ all, librecnc ] # disabled
- name: librecnc_core_ar71xx_nand_packages
type: repository
desc: libreCNC current/core/ar71xx/nand/packages
family: librecnc # XXX
minpackages: 1 # XXX
sources:
- name: Packages
fetcher: FileFetcher
parser: DebianSourcesParser
url: 'https://librecmc.org/librecmc/downloads/snapshots/current/core/ar71xx/nand/packages/Packages.gz'
compression: gz
tags: [ all, librecnc ] # disabled
- name: librecnc_core_packages_mips_24kc_base
type: repository
desc: libreCNC current/core/packages/mips_24kc/base
family: librecnc # XXX
minpackages: 1 # XXX
sources:
- name: Packages
fetcher: FileFetcher
parser: DebianSourcesParser
url: 'https://librecmc.org/librecmc/downloads/snapshots/current/core/packages/mips_24kc/base/Packages.gz'
compression: gz
tags: [ all, librecnc ] # disabled
- name: librecnc_core_packages_mips_24kc_packages
type: repository
desc: libreCNC current/core/packages/mips_24kc/packages
family: librecnc # XXX
minpackages: 1 # XXX
sources:
- name: Packages
fetcher: FileFetcher
parser: DebianSourcesParser
url: 'https://librecmc.org/librecmc/downloads/snapshots/current/core/packages/mips_24kc/packages/Packages.gz'
compression: gz
tags: [ all, librecnc ] # disabled
- name: librecnc_legacy_ar71xx_generic_packages
type: repository
desc: libreCNC current/legacy/ar71xx/generic/packages
family: librecnc # XXX
minpackages: 1 # XXX
sources:
- name: Packages
fetcher: FileFetcher
parser: DebianSourcesParser
url: 'https://librecmc.org/librecmc/downloads/snapshots/current/legacy/ar71xx/generic/packages/Packages.gz'
compression: gz
tags: [ all, librecnc ] # disabled
- name: librecnc_main_ar71xx_generic_packages
type: repository
desc: libreCNC current/main/ar71xx/generic/packages
family: librecnc # XXX
minpackages: 1 # XXX
sources:
- name: Packages
fetcher: FileFetcher
parser: DebianSourcesParser
url: 'https://librecmc.org/librecmc/downloads/snapshots/current/main/ar71xx/generic/packages/Packages.gz'
compression: gz
tags: [ all, librecnc ] # disabled
- name: librecnc_main_ar71xx_nand_packages
type: repository
desc: libreCNC current/main/ar71xx/nand/packages
family: librecnc # XXX
minpackages: 1 # XXX
sources:
- name: Packages
fetcher: FileFetcher
parser: DebianSourcesParser
url: 'https://librecmc.org/librecmc/downloads/snapshots/current/main/ar71xx/nand/packages/Packages.gz'
compression: gz
tags: [ all, librecnc ] # disabled
- name: librecnc_main_packages_mips_24kc_base
type: repository
desc: libreCNC current/main/packages/mips_24kc/base
family: librecnc # XXX
minpackages: 1 # XXX
sources:
- name: Packages
fetcher: FileFetcher
parser: DebianSourcesParser
url: 'https://librecmc.org/librecmc/downloads/snapshots/current/main/packages/mips_24kc/base/Packages.gz'
compression: gz
tags: [ all, librecnc ] # disabled
- name: librecnc_main_packages_mips_24kc_packages
type: repository
desc: libreCNC current/main/packages/mips_24kc/packages
family: librecnc # XXX
minpackages: 1 # XXX
sources:
- name: Packages
fetcher: FileFetcher
parser: DebianSourcesParser
url: 'https://librecmc.org/librecmc/downloads/snapshots/current/main/packages/mips_24kc/packages/Packages.gz'
compression: gz
tags: [ all, librecnc ] # disabled
| {
"pile_set_name": "Github"
} |
[platformio]
lib_dir = ../../../
[common]
platform = atmelavr
build_flags = -DLIGHT_WS2812_AVR
lib_deps = light_ws2812
upload_port = /dev/cuaU0
[env:attiny85]
board = attiny85
platform = ${common.platform}
lib_deps = ${common.lib_deps}
build_flags = ${common.build_flags}
# with ArduinoISP programmer
upload_port = ${common.upload_port}
upload_speed = 9600
upload_protocol = stk500v1
upload_flags =
-P$UPLOAD_PORT
[env:nanoatmega328]
board = nanoatmega328
platform = ${common.platform}
lib_deps = ${common.lib_deps}
build_flags = ${common.build_flags}
upload_port = ${common.upload_port}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2020 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef ARM_COMPUTE_WRAPPER_QMOVUN_H
#define ARM_COMPUTE_WRAPPER_QMOVUN_H
#include <arm_neon.h>
namespace arm_compute
{
namespace wrapper
{
#define VQMOVUN_IMPL(dtype, vtype, prefix, postfix) \
inline dtype vqmovun(const vtype &a) \
{ \
return prefix##_##postfix(a); \
}
VQMOVUN_IMPL(uint32x2_t, int64x2_t, vqmovun, s64)
VQMOVUN_IMPL(uint16x4_t, int32x4_t, vqmovun, s32)
VQMOVUN_IMPL(uint8x8_t, int16x8_t, vqmovun, s16)
#undef VQMOVUN_IMPL
} // namespace wrapper
} // namespace arm_compute
#endif /* ARM_COMPUTE_WRAPPER_QMOVUN_H */
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8" />
<title>Phaser Editor - Circular</title>
<script src="lib/phaser.js"></script>
<script src='ex-easing-08.js'></script>
</head>
<body>
<p>
<p>Click or tap to toggle between In, Out, and InOut versions of the easing function.</p><p>Easing functions are used to interpolate one value to another value over a period of time. Typically they are used to change the value of a property of a sprite such as its position or size. Game engines usually provide easing functions that apply the named function at the beginning of the ease (In), at the end (Out), or both (InOut). In all of these examples, the ball is moved at a constant speed from the left side of the screen to the right while its vertical position is controlled by the named easing function.</p>
</p>
<div id="game"></div>
<p>
Game Mechanic Explorer Assets
</p>
<p>
Copyright © 2014 John Watson<br>
Licensed under the terms of the Creative Commons Attribution license (CC BY 3.0)<br>
<a href="http://creativecommons.org/licenses/by/3.0/us/">http://creativecommons.org/licenses/by/3.0/us/</a><br>
</p>
Provide credit like this
<br>
"Game Mechanic Explorer Assets" by John Watson is licensed under CC BY 3.0
<br>
with a link to
<br><br>
<a href="http://gamemechanicexplorer.com">http://gamemechanicexplorer.com</a>
<br><br>
Thank you!
</body>
</html> | {
"pile_set_name": "Github"
} |
{
"AFN_currencyISO" : "AFN",
"AFN_currencySymbol" : "Af",
"ALK_currencyISO" : "AFN",
"ALK_currencySymbol" : "Af",
"ALL_currencyISO" : "AFN",
"ALL_currencySymbol" : "Af",
"AMD_currencyISO" : "AFN",
"AMD_currencySymbol" : "Af",
"ANG_currencyISO" : "ANG",
"ANG_currencySymbol" : "NAf.",
"AOA_currencyISO" : "AOA",
"AOA_currencySymbol" : "Kz",
"AOK_currencyISO" : "AOA",
"AOK_currencySymbol" : "Kz",
"AON_currencyISO" : "AOA",
"AON_currencySymbol" : "Kz",
"AOR_currencyISO" : "AOA",
"AOR_currencySymbol" : "Kz",
"ARA_currencyISO" : "ARA",
"ARA_currencySymbol" : "₳",
"ARL_currencyISO" : "ARL",
"ARL_currencySymbol" : "$L",
"ARM_currencyISO" : "ARM",
"ARM_currencySymbol" : "m$n",
"ARP_currencyISO" : "ARM",
"ARP_currencySymbol" : "m$n",
"ARS_currencyISO" : "ARS",
"ARS_currencySymbol" : "AR$",
"ATS_currencyISO" : "ARS",
"ATS_currencySymbol" : "AR$",
"AUD_currencyISO" : "AUD",
"AUD_currencySymbol" : "AU$",
"AWG_currencyISO" : "AWG",
"AWG_currencySymbol" : "Afl.",
"AZM_currencyISO" : "AWG",
"AZM_currencySymbol" : "Afl.",
"AZN_currencyISO" : "AZN",
"AZN_currencySymbol" : "man.",
"BAD_currencyISO" : "AZN",
"BAD_currencySymbol" : "man.",
"BAM_currencyISO" : "BAM",
"BAM_currencySymbol" : "KM",
"BAN_currencyISO" : "BAM",
"BAN_currencySymbol" : "KM",
"BBD_currencyISO" : "BBD",
"BBD_currencySymbol" : "Bds$",
"BDT_currencyISO" : "BDT",
"BDT_currencySymbol" : "Tk",
"BEC_currencyISO" : "BDT",
"BEC_currencySymbol" : "Tk",
"BEF_currencyISO" : "BEF",
"BEF_currencySymbol" : "BF",
"BEL_currencyISO" : "BEF",
"BEL_currencySymbol" : "BF",
"BGL_currencyISO" : "BEF",
"BGL_currencySymbol" : "BF",
"BGM_currencyISO" : "BEF",
"BGM_currencySymbol" : "BF",
"BGN_currencyISO" : "BEF",
"BGN_currencySymbol" : "BF",
"BGO_currencyISO" : "BEF",
"BGO_currencySymbol" : "BF",
"BHD_currencyISO" : "BHD",
"BHD_currencySymbol" : "BD",
"BIF_currencyISO" : "BIF",
"BIF_currencySymbol" : "FBu",
"BMD_currencyISO" : "BMD",
"BMD_currencySymbol" : "BD$",
"BND_currencyISO" : "BND",
"BND_currencySymbol" : "BN$",
"BOB_currencyISO" : "BOB",
"BOB_currencySymbol" : "Bs",
"BOL_currencyISO" : "BOB",
"BOL_currencySymbol" : "Bs",
"BOP_currencyISO" : "BOP",
"BOP_currencySymbol" : "$b.",
"BOV_currencyISO" : "BOP",
"BOV_currencySymbol" : "$b.",
"BRB_currencyISO" : "BOP",
"BRB_currencySymbol" : "$b.",
"BRC_currencyISO" : "BOP",
"BRC_currencySymbol" : "$b.",
"BRE_currencyISO" : "BOP",
"BRE_currencySymbol" : "$b.",
"BRL_currencyISO" : "BRL",
"BRL_currencySymbol" : "R$",
"BRN_currencyISO" : "BRL",
"BRN_currencySymbol" : "R$",
"BRR_currencyISO" : "BRL",
"BRR_currencySymbol" : "R$",
"BRZ_currencyISO" : "BRL",
"BRZ_currencySymbol" : "R$",
"BSD_currencyISO" : "BSD",
"BSD_currencySymbol" : "BS$",
"BTN_currencyISO" : "BTN",
"BTN_currencySymbol" : "Nu.",
"BUK_currencyISO" : "BTN",
"BUK_currencySymbol" : "Nu.",
"BWP_currencyISO" : "BWP",
"BWP_currencySymbol" : "BWP",
"BYB_currencyISO" : "BWP",
"BYB_currencySymbol" : "BWP",
"BYR_currencyISO" : "BWP",
"BYR_currencySymbol" : "BWP",
"BZD_currencyISO" : "BZD",
"BZD_currencySymbol" : "BZ$",
"CAD_currencyISO" : "CAD",
"CAD_currencySymbol" : "CA$",
"CDF_currencyISO" : "CDF",
"CDF_currencySymbol" : "CDF",
"CHE_currencyISO" : "CDF",
"CHE_currencySymbol" : "CDF",
"CHF_currencyISO" : "CDF",
"CHF_currencySymbol" : "CDF",
"CHW_currencyISO" : "CDF",
"CHW_currencySymbol" : "CDF",
"CLE_currencyISO" : "CLE",
"CLE_currencySymbol" : "Eº",
"CLF_currencyISO" : "CLE",
"CLF_currencySymbol" : "Eº",
"CLP_currencyISO" : "CLP",
"CLP_currencySymbol" : "CL$",
"CNX_currencyISO" : "CLP",
"CNX_currencySymbol" : "CL$",
"CNY_currencyISO" : "CNY",
"CNY_currencySymbol" : "CN¥",
"COP_currencyISO" : "COP",
"COP_currencySymbol" : "CO$",
"COU_currencyISO" : "COP",
"COU_currencySymbol" : "CO$",
"CRC_currencyISO" : "CRC",
"CRC_currencySymbol" : "₡",
"CSD_currencyISO" : "CRC",
"CSD_currencySymbol" : "₡",
"CSK_currencyISO" : "CRC",
"CSK_currencySymbol" : "₡",
"CUC_currencyISO" : "CUC",
"CUC_currencySymbol" : "CUC$",
"CUP_currencyISO" : "CUP",
"CUP_currencySymbol" : "CU$",
"CVE_currencyISO" : "CVE",
"CVE_currencySymbol" : "CV$",
"CYP_currencyISO" : "CYP",
"CYP_currencySymbol" : "CY£",
"CZK_currencyISO" : "CZK",
"CZK_currencySymbol" : "Kč",
"DDM_currencyISO" : "CZK",
"DDM_currencySymbol" : "Kč",
"DEM_currencyISO" : "DEM",
"DEM_currencySymbol" : "DM",
"DJF_currencyISO" : "DJF",
"DJF_currencySymbol" : "Fdj",
"DKK_currencyISO" : "DKK",
"DKK_currencySymbol" : "Dkr",
"DOP_currencyISO" : "DOP",
"DOP_currencySymbol" : "RD$",
"DZD_currencyISO" : "DZD",
"DZD_currencySymbol" : "DA",
"ECS_currencyISO" : "DZD",
"ECS_currencySymbol" : "DA",
"ECV_currencyISO" : "DZD",
"ECV_currencySymbol" : "DA",
"EEK_currencyISO" : "EEK",
"EEK_currencySymbol" : "Ekr",
"EGP_currencyISO" : "EGP",
"EGP_currencySymbol" : "EG£",
"ERN_currencyISO" : "ERN",
"ERN_currencySymbol" : "Nfk",
"ESA_currencyISO" : "ERN",
"ESA_currencySymbol" : "Nfk",
"ESB_currencyISO" : "ERN",
"ESB_currencySymbol" : "Nfk",
"ESP_currencyISO" : "ESP",
"ESP_currencySymbol" : "Pts",
"ETB_currencyISO" : "ETB",
"ETB_currencySymbol" : "Br",
"EUR_currencyISO" : "EUR",
"EUR_currencySymbol" : "€",
"FIM_currencyISO" : "FIM",
"FIM_currencySymbol" : "mk",
"FJD_currencyISO" : "FJD",
"FJD_currencySymbol" : "FJ$",
"FKP_currencyISO" : "FKP",
"FKP_currencySymbol" : "FK£",
"FRF_currencyISO" : "FRF",
"FRF_currencySymbol" : "₣",
"GBP_currencyISO" : "GBP",
"GBP_currencySymbol" : "£",
"GEK_currencyISO" : "GBP",
"GEK_currencySymbol" : "£",
"GEL_currencyISO" : "GBP",
"GEL_currencySymbol" : "£",
"GHC_currencyISO" : "GHC",
"GHC_currencySymbol" : "₵",
"GHS_currencyISO" : "GHS",
"GHS_currencySymbol" : "GH₵",
"GIP_currencyISO" : "GIP",
"GIP_currencySymbol" : "GI£",
"GMD_currencyISO" : "GMD",
"GMD_currencySymbol" : "GMD",
"GNF_currencyISO" : "GNF",
"GNF_currencySymbol" : "FG",
"GNS_currencyISO" : "GNF",
"GNS_currencySymbol" : "FG",
"GQE_currencyISO" : "GNF",
"GQE_currencySymbol" : "FG",
"GRD_currencyISO" : "GRD",
"GRD_currencySymbol" : "₯",
"GTQ_currencyISO" : "GTQ",
"GTQ_currencySymbol" : "GTQ",
"GWE_currencyISO" : "GTQ",
"GWE_currencySymbol" : "GTQ",
"GWP_currencyISO" : "GTQ",
"GWP_currencySymbol" : "GTQ",
"GYD_currencyISO" : "GYD",
"GYD_currencySymbol" : "GY$",
"HKD_currencyISO" : "HKD",
"HKD_currencySymbol" : "HK$",
"HNL_currencyISO" : "HNL",
"HNL_currencySymbol" : "HNL",
"HRD_currencyISO" : "HNL",
"HRD_currencySymbol" : "HNL",
"HRK_currencyISO" : "HRK",
"HRK_currencySymbol" : "kn",
"HTG_currencyISO" : "HTG",
"HTG_currencySymbol" : "HTG",
"HUF_currencyISO" : "HUF",
"HUF_currencySymbol" : "Ft",
"IDR_currencyISO" : "IDR",
"IDR_currencySymbol" : "Rp",
"IEP_currencyISO" : "IEP",
"IEP_currencySymbol" : "IR£",
"ILP_currencyISO" : "ILP",
"ILP_currencySymbol" : "I£",
"ILR_currencyISO" : "ILP",
"ILR_currencySymbol" : "I£",
"ILS_currencyISO" : "ILS",
"ILS_currencySymbol" : "₪",
"INR_currencyISO" : "INR",
"INR_currencySymbol" : "Rs",
"IQD_currencyISO" : "INR",
"IQD_currencySymbol" : "Rs",
"IRR_currencyISO" : "INR",
"IRR_currencySymbol" : "Rs",
"ISJ_currencyISO" : "INR",
"ISJ_currencySymbol" : "Rs",
"ISK_currencyISO" : "ISK",
"ISK_currencySymbol" : "Ikr",
"ITL_currencyISO" : "ITL",
"ITL_currencySymbol" : "IT₤",
"JMD_currencyISO" : "JMD",
"JMD_currencySymbol" : "J$",
"JOD_currencyISO" : "JOD",
"JOD_currencySymbol" : "JD",
"JPY_currencyISO" : "JPY",
"JPY_currencySymbol" : "JP¥",
"KES_currencyISO" : "KES",
"KES_currencySymbol" : "Ksh",
"KGS_currencyISO" : "KES",
"KGS_currencySymbol" : "Ksh",
"KHR_currencyISO" : "KES",
"KHR_currencySymbol" : "Ksh",
"KMF_currencyISO" : "KMF",
"KMF_currencySymbol" : "CF",
"KPW_currencyISO" : "KMF",
"KPW_currencySymbol" : "CF",
"KRH_currencyISO" : "KMF",
"KRH_currencySymbol" : "CF",
"KRO_currencyISO" : "KMF",
"KRO_currencySymbol" : "CF",
"KRW_currencyISO" : "KRW",
"KRW_currencySymbol" : "₩",
"KWD_currencyISO" : "KWD",
"KWD_currencySymbol" : "KD",
"KYD_currencyISO" : "KYD",
"KYD_currencySymbol" : "KY$",
"KZT_currencyISO" : "KYD",
"KZT_currencySymbol" : "KY$",
"LAK_currencyISO" : "LAK",
"LAK_currencySymbol" : "₭",
"LBP_currencyISO" : "LBP",
"LBP_currencySymbol" : "LB£",
"LKR_currencyISO" : "LKR",
"LKR_currencySymbol" : "SLRs",
"LRD_currencyISO" : "LRD",
"LRD_currencySymbol" : "L$",
"LSL_currencyISO" : "LSL",
"LSL_currencySymbol" : "LSL",
"LTL_currencyISO" : "LTL",
"LTL_currencySymbol" : "Lt",
"LTT_currencyISO" : "LTL",
"LTT_currencySymbol" : "Lt",
"LUC_currencyISO" : "LTL",
"LUC_currencySymbol" : "Lt",
"LUF_currencyISO" : "LTL",
"LUF_currencySymbol" : "Lt",
"LUL_currencyISO" : "LTL",
"LUL_currencySymbol" : "Lt",
"LVL_currencyISO" : "LVL",
"LVL_currencySymbol" : "Ls",
"LVR_currencyISO" : "LVL",
"LVR_currencySymbol" : "Ls",
"LYD_currencyISO" : "LYD",
"LYD_currencySymbol" : "LD",
"MAD_currencyISO" : "LYD",
"MAD_currencySymbol" : "LD",
"MAF_currencyISO" : "LYD",
"MAF_currencySymbol" : "LD",
"MCF_currencyISO" : "LYD",
"MCF_currencySymbol" : "LD",
"MDC_currencyISO" : "LYD",
"MDC_currencySymbol" : "LD",
"MDL_currencyISO" : "LYD",
"MDL_currencySymbol" : "LD",
"MGA_currencyISO" : "LYD",
"MGA_currencySymbol" : "LD",
"MGF_currencyISO" : "LYD",
"MGF_currencySymbol" : "LD",
"MKD_currencyISO" : "LYD",
"MKD_currencySymbol" : "LD",
"MKN_currencyISO" : "LYD",
"MKN_currencySymbol" : "LD",
"MLF_currencyISO" : "LYD",
"MLF_currencySymbol" : "LD",
"MMK_currencyISO" : "MMK",
"MMK_currencySymbol" : "MMK",
"MNT_currencyISO" : "MNT",
"MNT_currencySymbol" : "₮",
"MOP_currencyISO" : "MOP",
"MOP_currencySymbol" : "MOP$",
"MRO_currencyISO" : "MRO",
"MRO_currencySymbol" : "UM",
"MTL_currencyISO" : "MTL",
"MTL_currencySymbol" : "Lm",
"MTP_currencyISO" : "MTP",
"MTP_currencySymbol" : "MT£",
"MUR_currencyISO" : "MUR",
"MUR_currencySymbol" : "MURs",
"MVP_currencyISO" : "MUR",
"MVP_currencySymbol" : "MURs",
"MVR_currencyISO" : "MUR",
"MVR_currencySymbol" : "MURs",
"MWK_currencyISO" : "MUR",
"MWK_currencySymbol" : "MURs",
"MXN_currencyISO" : "MXN",
"MXN_currencySymbol" : "MX$",
"MXP_currencyISO" : "MXN",
"MXP_currencySymbol" : "MX$",
"MXV_currencyISO" : "MXN",
"MXV_currencySymbol" : "MX$",
"MYR_currencyISO" : "MYR",
"MYR_currencySymbol" : "RM",
"MZE_currencyISO" : "MYR",
"MZE_currencySymbol" : "RM",
"MZM_currencyISO" : "MZM",
"MZM_currencySymbol" : "Mt",
"MZN_currencyISO" : "MZN",
"MZN_currencySymbol" : "MTn",
"NAD_currencyISO" : "NAD",
"NAD_currencySymbol" : "N$",
"NGN_currencyISO" : "NGN",
"NGN_currencySymbol" : "₦",
"NIC_currencyISO" : "NGN",
"NIC_currencySymbol" : "₦",
"NIO_currencyISO" : "NIO",
"NIO_currencySymbol" : "C$",
"NLG_currencyISO" : "NLG",
"NLG_currencySymbol" : "fl",
"NOK_currencyISO" : "NOK",
"NOK_currencySymbol" : "Nkr",
"NPR_currencyISO" : "NPR",
"NPR_currencySymbol" : "NPRs",
"NZD_currencyISO" : "NZD",
"NZD_currencySymbol" : "NZ$",
"OMR_currencyISO" : "NZD",
"OMR_currencySymbol" : "NZ$",
"PAB_currencyISO" : "PAB",
"PAB_currencySymbol" : "B/.",
"PEI_currencyISO" : "PEI",
"PEI_currencySymbol" : "I/.",
"PEN_currencyISO" : "PEN",
"PEN_currencySymbol" : "S/.",
"PES_currencyISO" : "PEN",
"PES_currencySymbol" : "S/.",
"PGK_currencyISO" : "PGK",
"PGK_currencySymbol" : "PGK",
"PHP_currencyISO" : "PHP",
"PHP_currencySymbol" : "₱",
"PKR_currencyISO" : "PKR",
"PKR_currencySymbol" : "PKRs",
"PLN_currencyISO" : "PLN",
"PLN_currencySymbol" : "zł",
"PLZ_currencyISO" : "PLN",
"PLZ_currencySymbol" : "zł",
"PTE_currencyISO" : "PTE",
"PTE_currencySymbol" : "Esc",
"PYG_currencyISO" : "PYG",
"PYG_currencySymbol" : "₲",
"QAR_currencyISO" : "QAR",
"QAR_currencySymbol" : "QR",
"RHD_currencyISO" : "RHD",
"RHD_currencySymbol" : "RH$",
"ROL_currencyISO" : "RHD",
"ROL_currencySymbol" : "RH$",
"RON_currencyISO" : "RON",
"RON_currencySymbol" : "RON",
"RSD_currencyISO" : "RSD",
"RSD_currencySymbol" : "din.",
"RUB_currencyISO" : "RSD",
"RUB_currencySymbol" : "din.",
"RUR_currencyISO" : "RSD",
"RUR_currencySymbol" : "din.",
"RWF_currencyISO" : "RSD",
"RWF_currencySymbol" : "din.",
"SAR_currencyISO" : "SAR",
"SAR_currencySymbol" : "SR",
"SBD_currencyISO" : "SBD",
"SBD_currencySymbol" : "SI$",
"SCR_currencyISO" : "SCR",
"SCR_currencySymbol" : "SRe",
"SDD_currencyISO" : "SDD",
"SDD_currencySymbol" : "LSd",
"SDG_currencyISO" : "SDD",
"SDG_currencySymbol" : "LSd",
"SDP_currencyISO" : "SDD",
"SDP_currencySymbol" : "LSd",
"SEK_currencyISO" : "SEK",
"SEK_currencySymbol" : "Skr",
"SGD_currencyISO" : "SGD",
"SGD_currencySymbol" : "S$",
"SHP_currencyISO" : "SHP",
"SHP_currencySymbol" : "SH£",
"SIT_currencyISO" : "SHP",
"SIT_currencySymbol" : "SH£",
"SKK_currencyISO" : "SKK",
"SKK_currencySymbol" : "Sk",
"SLL_currencyISO" : "SLL",
"SLL_currencySymbol" : "Le",
"SOS_currencyISO" : "SOS",
"SOS_currencySymbol" : "Ssh",
"SRD_currencyISO" : "SRD",
"SRD_currencySymbol" : "SR$",
"SRG_currencyISO" : "SRG",
"SRG_currencySymbol" : "Sf",
"SSP_currencyISO" : "SRG",
"SSP_currencySymbol" : "Sf",
"STD_currencyISO" : "STD",
"STD_currencySymbol" : "Db",
"SUR_currencyISO" : "STD",
"SUR_currencySymbol" : "Db",
"SVC_currencyISO" : "SVC",
"SVC_currencySymbol" : "SV₡",
"SYP_currencyISO" : "SYP",
"SYP_currencySymbol" : "SY£",
"SZL_currencyISO" : "SZL",
"SZL_currencySymbol" : "SZL",
"THB_currencyISO" : "THB",
"THB_currencySymbol" : "฿",
"TJR_currencyISO" : "THB",
"TJR_currencySymbol" : "฿",
"TJS_currencyISO" : "THB",
"TJS_currencySymbol" : "฿",
"TMM_currencyISO" : "TMM",
"TMM_currencySymbol" : "TMM",
"TMT_currencyISO" : "TMM",
"TMT_currencySymbol" : "TMM",
"TND_currencyISO" : "TND",
"TND_currencySymbol" : "DT",
"TOP_currencyISO" : "TOP",
"TOP_currencySymbol" : "T$",
"TPE_currencyISO" : "TOP",
"TPE_currencySymbol" : "T$",
"TRL_currencyISO" : "TRL",
"TRL_currencySymbol" : "TRL",
"TRY_currencyISO" : "TRY",
"TRY_currencySymbol" : "TL",
"TTD_currencyISO" : "TTD",
"TTD_currencySymbol" : "TT$",
"TWD_currencyISO" : "TWD",
"TWD_currencySymbol" : "NT$",
"TZS_currencyISO" : "TZS",
"TZS_currencySymbol" : "TSh",
"UAH_currencyISO" : "UAH",
"UAH_currencySymbol" : "₴",
"UAK_currencyISO" : "UAH",
"UAK_currencySymbol" : "₴",
"UGS_currencyISO" : "UAH",
"UGS_currencySymbol" : "₴",
"UGX_currencyISO" : "UGX",
"UGX_currencySymbol" : "USh",
"USD_currencyISO" : "USD",
"USD_currencySymbol" : "US$",
"USN_currencyISO" : "USD",
"USN_currencySymbol" : "US$",
"USS_currencyISO" : "USD",
"USS_currencySymbol" : "US$",
"UYI_currencyISO" : "USD",
"UYI_currencySymbol" : "US$",
"UYP_currencyISO" : "USD",
"UYP_currencySymbol" : "US$",
"UYU_currencyISO" : "UYU",
"UYU_currencySymbol" : "$U",
"UZS_currencyISO" : "UYU",
"UZS_currencySymbol" : "$U",
"VEB_currencyISO" : "UYU",
"VEB_currencySymbol" : "$U",
"VEF_currencyISO" : "VEF",
"VEF_currencySymbol" : "Bs.F.",
"VND_currencyISO" : "VND",
"VND_currencySymbol" : "₫",
"VNN_currencyISO" : "VND",
"VNN_currencySymbol" : "₫",
"VUV_currencyISO" : "VUV",
"VUV_currencySymbol" : "VT",
"WST_currencyISO" : "WST",
"WST_currencySymbol" : "WS$",
"XAF_currencyISO" : "XAF",
"XAF_currencySymbol" : "FCFA",
"XAG_currencyISO" : "XAF",
"XAG_currencySymbol" : "FCFA",
"XAU_currencyISO" : "XAF",
"XAU_currencySymbol" : "FCFA",
"XBA_currencyISO" : "XAF",
"XBA_currencySymbol" : "FCFA",
"XBB_currencyISO" : "XAF",
"XBB_currencySymbol" : "FCFA",
"XBC_currencyISO" : "XAF",
"XBC_currencySymbol" : "FCFA",
"XBD_currencyISO" : "XAF",
"XBD_currencySymbol" : "FCFA",
"XCD_currencyISO" : "XCD",
"XCD_currencySymbol" : "EC$",
"XDR_currencyISO" : "XCD",
"XDR_currencySymbol" : "EC$",
"XEU_currencyISO" : "XCD",
"XEU_currencySymbol" : "EC$",
"XFO_currencyISO" : "XCD",
"XFO_currencySymbol" : "EC$",
"XFU_currencyISO" : "XCD",
"XFU_currencySymbol" : "EC$",
"XOF_currencyISO" : "XOF",
"XOF_currencySymbol" : "CFA",
"XPD_currencyISO" : "XOF",
"XPD_currencySymbol" : "CFA",
"XPF_currencyISO" : "XPF",
"XPF_currencySymbol" : "CFPF",
"XPT_currencyISO" : "XPF",
"XPT_currencySymbol" : "CFPF",
"XRE_currencyISO" : "XPF",
"XRE_currencySymbol" : "CFPF",
"XSU_currencyISO" : "XPF",
"XSU_currencySymbol" : "CFPF",
"XTS_currencyISO" : "XPF",
"XTS_currencySymbol" : "CFPF",
"XUA_currencyISO" : "XPF",
"XUA_currencySymbol" : "CFPF",
"XXX_currencyISO" : "XPF",
"XXX_currencySymbol" : "CFPF",
"YDD_currencyISO" : "XPF",
"YDD_currencySymbol" : "CFPF",
"YER_currencyISO" : "YER",
"YER_currencySymbol" : "YR",
"YUD_currencyISO" : "YER",
"YUD_currencySymbol" : "YR",
"YUM_currencyISO" : "YER",
"YUM_currencySymbol" : "YR",
"YUN_currencyISO" : "YER",
"YUN_currencySymbol" : "YR",
"YUR_currencyISO" : "YER",
"YUR_currencySymbol" : "YR",
"ZAL_currencyISO" : "YER",
"ZAL_currencySymbol" : "YR",
"ZAR_currencyISO" : "ZAR",
"ZAR_currencySymbol" : "R",
"ZMK_currencyISO" : "ZMK",
"ZMK_currencySymbol" : "ZK",
"ZRN_currencyISO" : "ZRN",
"ZRN_currencySymbol" : "NZ",
"ZRZ_currencyISO" : "ZRZ",
"ZRZ_currencySymbol" : "ZRZ",
"ZWD_currencyISO" : "ZWD",
"ZWD_currencySymbol" : "Z$",
"ZWL_currencyISO" : "ZWD",
"ZWL_currencySymbol" : "Z$",
"ZWR_currencyISO" : "ZWD",
"ZWR_currencySymbol" : "Z$",
"currencyFormat" : "¤ #,##,##0.00",
"currencyPatternPlural" : "e u",
"currencyPatternSingular" : "{0} {1}",
"decimalFormat" : "#,##,##0.###",
"decimalSeparator" : ".",
"exponentialSymbol" : "E",
"groupingSeparator" : ",",
"infinitySign" : "∞",
"minusSign" : "-",
"nanSymbol" : "NaN",
"numberZero" : "೦",
"perMilleSign" : "‰",
"percentFormat" : "#,##,##0%",
"percentSign" : "%",
"plusSign" : "+",
"scientificFormat" : "#E0"
}
| {
"pile_set_name": "Github"
} |
/* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/SAObjects.framework/SAObjects
*/
@interface SAAppsGetRestrictedAppsResponse : SABaseCommand <SAServerBoundCommand>
@property (nonatomic, copy) NSString *aceId;
@property (nonatomic, copy) NSDictionary *appToItsRestrictionsMap;
@property (readonly, copy) NSString *debugDescription;
@property (readonly, copy) NSString *description;
@property (readonly) unsigned long long hash;
@property (nonatomic, copy) NSString *refId;
@property (nonatomic, copy) NSArray *restrictedApps;
@property (readonly) Class superclass;
+ (id)getRestrictedAppsResponse;
+ (id)getRestrictedAppsResponseWithDictionary:(id)arg1 context:(id)arg2;
- (id)appToItsRestrictionsMap;
- (id)encodedClassName;
- (id)groupIdentifier;
- (bool)requiresResponse;
- (id)restrictedApps;
- (void)setAppToItsRestrictionsMap:(id)arg1;
- (void)setRestrictedApps:(id)arg1;
@end
| {
"pile_set_name": "Github"
} |
class A{
isA T3;
}
trait T3{
isA T;
isA T1;
isA T2;
}
trait T{
sm{
s0{
entry /{T_entry();}
do {T_do();}
exit /{T_exit();}
}
s1{
}
}
}
trait T1{
sm{
s0{
entry /{T1_entry();}
do {T1_do();}
exit /{T1_exit();}
}
s1{
}
s2{
}
}
}
trait T2{
sm{
s0{
entry /{T2_entry();}
do {T2_do();}
exit /{T2_exit();}
}
}
}
| {
"pile_set_name": "Github"
} |
<template>
<exception-page type="500" />
</template>
<script>
import { ExceptionPage } from '../../components'
export default {
components: {
ExceptionPage
}
}
</script>
<style scoped>
</style>
| {
"pile_set_name": "Github"
} |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("rxjs-compat/add/operator/takeWhile");
//# sourceMappingURL=takeWhile.js.map | {
"pile_set_name": "Github"
} |
// RUN: clspv %s -o %t.spv
// RUN: spirv-dis -o %t2.spvasm %t.spv
// RUN: FileCheck %s < %t2.spvasm
// RUN: spirv-val --target-env vulkan1.0 %t.spv
// CHECK: %[[EXT_INST:[a-zA-Z0-9_]*]] = OpExtInstImport "GLSL.std.450"
// CHECK-DAG: %[[FLOAT_TYPE_ID:[a-zA-Z0-9_]*]] = OpTypeFloat 32
// CHECK-DAG: %[[FLOAT_VECTOR_TYPE_ID:[a-zA-Z0-9_]*]] = OpTypeVector %[[FLOAT_TYPE_ID]] 2
// CHECK: %[[LOADB_ID:[a-zA-Z0-9_]*]] = OpLoad %[[FLOAT_VECTOR_TYPE_ID]]
// CHECK: %[[OP_ID:[a-zA-Z0-9_]*]] = OpExtInst %[[FLOAT_VECTOR_TYPE_ID]] %[[EXT_INST]] Acos %[[LOADB_ID]]
// CHECK: OpStore {{.*}} %[[OP_ID]]
void kernel __attribute__((reqd_work_group_size(1, 1, 1))) foo(global float2* a, global float2* b)
{
*a = acos(*b);
}
| {
"pile_set_name": "Github"
} |
%# BEGIN BPS TAGGED BLOCK {{{
%#
%# COPYRIGHT:
%#
%# This software is Copyright (c) 1996-2020 Best Practical Solutions, LLC
%# <[email protected]>
%#
%# (Except where explicitly superseded by other copyright notices)
%#
%#
%# LICENSE:
%#
%# This work is made available to you under the terms of Version 2 of
%# the GNU General Public License. A copy of that license should have
%# been provided with this software, but in any event can be snarfed
%# from www.gnu.org.
%#
%# This work is distributed in the hope that it will be useful, but
%# WITHOUT ANY WARRANTY; without even the implied warranty of
%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%# General Public License for more details.
%#
%# You should have received a copy of the GNU General Public License
%# along with this program; if not, write to the Free Software
%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
%# 02110-1301 or visit their web page on the internet at
%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
%#
%#
%# CONTRIBUTION SUBMISSION POLICY:
%#
%# (The following paragraph is not intended to limit the rights granted
%# to you to modify and distribute this software under the terms of
%# the GNU General Public License and is only of importance to you if
%# you choose to contribute your changes and enhancements to the
%# community by submitting them to Best Practical Solutions, LLC.)
%#
%# By intentionally submitting any modifications, corrections or
%# derivatives to this work, or any other work intended for use with
%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
%# you are the copyright holder for those contributions and you grant
%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
%# royalty-free, perpetual, license to use, copy, create derivative
%# works based on those contributions, and sublicense and distribute
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
<hr class="clear" />
</div>
</div>
</div>
% #Manually flush the content buffer after each titlebox is displayed
% $m->flush_buffer();
<%ARGS>
$title => undef
$content => undef
</%ARGS>
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2015-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. 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.
*/
#pragma once
#if ENABLE(B3_JIT)
#include "B3OpaqueByproducts.h"
#include "B3Origin.h"
#include "B3PCToOriginMap.h"
#include "B3SparseCollection.h"
#include "B3Type.h"
#include "B3ValueKey.h"
#include "CCallHelpers.h"
#include "PureNaN.h"
#include "RegisterAtOffsetList.h"
#include <wtf/Bag.h>
#include <wtf/FastMalloc.h>
#include <wtf/HashSet.h>
#include <wtf/IndexedContainerIterator.h>
#include <wtf/Noncopyable.h>
#include <wtf/PrintStream.h>
#include <wtf/SharedTask.h>
#include <wtf/TriState.h>
#include <wtf/Vector.h>
namespace JSC { namespace B3 {
class BackwardsCFG;
class BackwardsDominators;
class BasicBlock;
class BlockInsertionSet;
class CFG;
class Dominators;
class NaturalLoops;
class StackSlot;
class Value;
class Variable;
namespace Air { class Code; }
typedef void WasmBoundsCheckGeneratorFunction(CCallHelpers&, GPRReg);
typedef SharedTask<WasmBoundsCheckGeneratorFunction> WasmBoundsCheckGenerator;
// This represents B3's view of a piece of code. Note that this object must exist in a 1:1
// relationship with Air::Code. B3::Procedure and Air::Code are just different facades of the B3
// compiler's knowledge about a piece of code. Some kinds of state aren't perfect fits for either
// Procedure or Code, and are placed in one or the other based on convenience. Procedure always
// allocates a Code, and a Code cannot be allocated without an owning Procedure and they always
// have references to each other.
class Procedure {
WTF_MAKE_NONCOPYABLE(Procedure);
WTF_MAKE_FAST_ALLOCATED;
public:
JS_EXPORT_PRIVATE Procedure();
JS_EXPORT_PRIVATE ~Procedure();
template<typename Callback>
void setOriginPrinter(Callback&& callback)
{
m_originPrinter = createSharedTask<void(PrintStream&, Origin)>(
std::forward<Callback>(callback));
}
// Usually you use this via OriginDump, though it's cool to use it directly.
void printOrigin(PrintStream& out, Origin origin) const;
// This is a debugging hack. Sometimes while debugging B3 you need to break the abstraction
// and get at the DFG Graph, or whatever data structure the frontend used to describe the
// program. The FTL passes the DFG Graph.
void setFrontendData(const void* value) { m_frontendData = value; }
const void* frontendData() const { return m_frontendData; }
JS_EXPORT_PRIVATE BasicBlock* addBlock(double frequency = 1);
// Changes the order of basic blocks to be as in the supplied vector. The vector does not
// need to mention every block in the procedure. Blocks not mentioned will be placed after
// these blocks in the same order as they were in originally.
template<typename BlockIterable>
void setBlockOrder(const BlockIterable& iterable)
{
Vector<BasicBlock*> blocks;
for (BasicBlock* block : iterable)
blocks.append(block);
setBlockOrderImpl(blocks);
}
JS_EXPORT_PRIVATE StackSlot* addStackSlot(unsigned byteSize);
JS_EXPORT_PRIVATE Variable* addVariable(Type);
template<typename ValueType, typename... Arguments>
ValueType* add(Arguments...);
Value* clone(Value*);
Value* addIntConstant(Origin, Type, int64_t value);
Value* addIntConstant(Value*, int64_t value);
// bits is a bitwise_cast of the constant you want.
Value* addConstant(Origin, Type, uint64_t bits);
// You're guaranteed that bottom is zero.
Value* addBottom(Origin, Type);
Value* addBottom(Value*);
// Returns null for MixedTriState.
Value* addBoolConstant(Origin, TriState);
void resetValueOwners();
JS_EXPORT_PRIVATE void resetReachability();
// This destroys CFG analyses. If we ask for them again, we will recompute them. Usually you
// should call this anytime you call resetReachability().
void invalidateCFG();
JS_EXPORT_PRIVATE void dump(PrintStream&) const;
unsigned size() const { return m_blocks.size(); }
BasicBlock* at(unsigned index) const { return m_blocks[index].get(); }
BasicBlock* operator[](unsigned index) const { return at(index); }
typedef WTF::IndexedContainerIterator<Procedure> iterator;
iterator begin() const { return iterator(*this, 0); }
iterator end() const { return iterator(*this, size()); }
Vector<BasicBlock*> blocksInPreOrder();
Vector<BasicBlock*> blocksInPostOrder();
SparseCollection<StackSlot>& stackSlots() { return m_stackSlots; }
const SparseCollection<StackSlot>& stackSlots() const { return m_stackSlots; }
// Short for stackSlots().remove(). It's better to call this method since it's out of line.
void deleteStackSlot(StackSlot*);
SparseCollection<Variable>& variables() { return m_variables; }
const SparseCollection<Variable>& variables() const { return m_variables; }
// Short for variables().remove(). It's better to call this method since it's out of line.
void deleteVariable(Variable*);
SparseCollection<Value>& values() { return m_values; }
const SparseCollection<Value>& values() const { return m_values; }
// Short for values().remove(). It's better to call this method since it's out of line.
void deleteValue(Value*);
// A valid procedure cannot contain any orphan values. An orphan is a value that is not in
// any basic block. It is possible to create an orphan value during code generation or during
// transformation. If you know that you may have created some, you can call this method to
// delete them, making the procedure valid again.
void deleteOrphans();
CFG& cfg() const { return *m_cfg; }
Dominators& dominators();
NaturalLoops& naturalLoops();
BackwardsCFG& backwardsCFG();
BackwardsDominators& backwardsDominators();
void addFastConstant(const ValueKey&);
bool isFastConstant(const ValueKey&);
unsigned numEntrypoints() const { return m_numEntrypoints; }
JS_EXPORT_PRIVATE void setNumEntrypoints(unsigned);
// Only call this after code generation is complete. Note that the label for the 0th entrypoint
// should point to exactly where the code generation cursor was before you started generating
// code.
JS_EXPORT_PRIVATE CCallHelpers::Label entrypointLabel(unsigned entrypointIndex) const;
// The name has to be a string literal, since we don't do any memory management for the string.
void setLastPhaseName(const char* name)
{
m_lastPhaseName = name;
}
const char* lastPhaseName() const { return m_lastPhaseName; }
// Allocates a slab of memory that will be kept alive by anyone who keeps the resulting code
// alive. Great for compiler-generated data sections, like switch jump tables and constant pools.
// This returns memory that has been zero-initialized.
JS_EXPORT_PRIVATE void* addDataSection(size_t);
// Some operations are specified in B3 IR to behave one way but on this given CPU they behave a
// different way. When true, those B3 IR ops switch to behaving the CPU way, and the optimizer may
// start taking advantage of it.
//
// One way to think of it is like this. Imagine that you find that the cleanest way of lowering
// something in lowerMacros is to unconditionally replace one opcode with another. This is a shortcut
// where you instead keep the same opcode, but rely on the opcode's meaning changes once lowerMacros
// sets hasQuirks.
bool hasQuirks() const { return m_hasQuirks; }
void setHasQuirks(bool value) { m_hasQuirks = value; }
OpaqueByproducts& byproducts() { return *m_byproducts; }
// Below are methods that make sense to call after you have generated code for the procedure.
// You have to call this method after calling generate(). The code generated by B3::generate()
// will require you to keep this object alive for as long as that code is runnable. Usually, this
// just keeps alive things like the double constant pool and switch lookup tables. If this sounds
// confusing, you should probably be using the B3::Compilation API to compile code. If you use
// that API, then you don't have to worry about this.
std::unique_ptr<OpaqueByproducts> releaseByproducts() { return WTFMove(m_byproducts); }
// This gives you direct access to Code. However, the idea is that clients of B3 shouldn't have to
// call this. So, Procedure has some methods (below) that expose some Air::Code functionality.
const Air::Code& code() const { return *m_code; }
Air::Code& code() { return *m_code; }
unsigned callArgAreaSizeInBytes() const;
void requestCallArgAreaSizeInBytes(unsigned size);
// This tells the register allocators to stay away from this register.
JS_EXPORT_PRIVATE void pinRegister(Reg);
JS_EXPORT_PRIVATE void setOptLevel(unsigned value);
unsigned optLevel() const { return m_optLevel; }
// You can turn off used registers calculation. This may speed up compilation a bit. But if
// you turn it off then you cannot use StackmapGenerationParams::usedRegisters() or
// StackmapGenerationParams::unavailableRegisters().
void setNeedsUsedRegisters(bool value) { m_needsUsedRegisters = value; }
bool needsUsedRegisters() const { return m_needsUsedRegisters; }
JS_EXPORT_PRIVATE unsigned frameSize() const;
JS_EXPORT_PRIVATE RegisterAtOffsetList calleeSaveRegisterAtOffsetList() const;
PCToOriginMap& pcToOriginMap() { return m_pcToOriginMap; }
PCToOriginMap releasePCToOriginMap() { return WTFMove(m_pcToOriginMap); }
JS_EXPORT_PRIVATE void setWasmBoundsCheckGenerator(RefPtr<WasmBoundsCheckGenerator>);
template<typename Functor>
void setWasmBoundsCheckGenerator(const Functor& functor)
{
setWasmBoundsCheckGenerator(RefPtr<WasmBoundsCheckGenerator>(createSharedTask<WasmBoundsCheckGeneratorFunction>(functor)));
}
JS_EXPORT_PRIVATE RegisterSet mutableGPRs();
JS_EXPORT_PRIVATE RegisterSet mutableFPRs();
private:
friend class BlockInsertionSet;
JS_EXPORT_PRIVATE Value* addValueImpl(Value*);
void setBlockOrderImpl(Vector<BasicBlock*>&);
SparseCollection<StackSlot> m_stackSlots;
SparseCollection<Variable> m_variables;
Vector<std::unique_ptr<BasicBlock>> m_blocks;
SparseCollection<Value> m_values;
std::unique_ptr<CFG> m_cfg;
std::unique_ptr<Dominators> m_dominators;
std::unique_ptr<NaturalLoops> m_naturalLoops;
std::unique_ptr<BackwardsCFG> m_backwardsCFG;
std::unique_ptr<BackwardsDominators> m_backwardsDominators;
HashSet<ValueKey> m_fastConstants;
unsigned m_numEntrypoints { 1 };
const char* m_lastPhaseName;
std::unique_ptr<OpaqueByproducts> m_byproducts;
std::unique_ptr<Air::Code> m_code;
RefPtr<SharedTask<void(PrintStream&, Origin)>> m_originPrinter;
const void* m_frontendData;
PCToOriginMap m_pcToOriginMap;
unsigned m_optLevel { defaultOptLevel() };
bool m_needsUsedRegisters { true };
bool m_hasQuirks { false };
};
} } // namespace JSC::B3
#endif // ENABLE(B3_JIT)
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2011 The Chromium Authors, All Rights Reserved.
* Copyright 2008 Jon Loeliger, Freescale Semiconductor, Inc.
*
* util_is_printable_string contributed by
* Pantelis Antoniou <pantelis.antoniou AT gmail.com>
*
* 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
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include "libfdt.h"
#include "util.h"
#include "version_gen.h"
char *xstrdup(const char *s)
{
int len = strlen(s) + 1;
char *d = xmalloc(len);
memcpy(d, s, len);
return d;
}
/* based in part from (3) vsnprintf */
int xasprintf(char **strp, const char *fmt, ...)
{
int n, size = 128; /* start with 128 bytes */
char *p;
va_list ap;
/* initial pointer is NULL making the fist realloc to be malloc */
p = NULL;
while (1) {
p = xrealloc(p, size);
/* Try to print in the allocated space. */
va_start(ap, fmt);
n = vsnprintf(p, size, fmt, ap);
va_end(ap);
/* If that worked, return the string. */
if (n > -1 && n < size)
break;
/* Else try again with more space. */
if (n > -1) /* glibc 2.1 */
size = n + 1; /* precisely what is needed */
else /* glibc 2.0 */
size *= 2; /* twice the old size */
}
*strp = p;
return strlen(p);
}
char *join_path(const char *path, const char *name)
{
int lenp = strlen(path);
int lenn = strlen(name);
int len;
int needslash = 1;
char *str;
len = lenp + lenn + 2;
if ((lenp > 0) && (path[lenp-1] == '/')) {
needslash = 0;
len--;
}
str = xmalloc(len);
memcpy(str, path, lenp);
if (needslash) {
str[lenp] = '/';
lenp++;
}
memcpy(str+lenp, name, lenn+1);
return str;
}
bool util_is_printable_string(const void *data, int len)
{
const char *s = data;
const char *ss, *se;
/* zero length is not */
if (len == 0)
return 0;
/* must terminate with zero */
if (s[len - 1] != '\0')
return 0;
se = s + len;
while (s < se) {
ss = s;
while (s < se && *s && isprint((unsigned char)*s))
s++;
/* not zero, or not done yet */
if (*s != '\0' || s == ss)
return 0;
s++;
}
return 1;
}
/*
* Parse a octal encoded character starting at index i in string s. The
* resulting character will be returned and the index i will be updated to
* point at the character directly after the end of the encoding, this may be
* the '\0' terminator of the string.
*/
static char get_oct_char(const char *s, int *i)
{
char x[4];
char *endx;
long val;
x[3] = '\0';
strncpy(x, s + *i, 3);
val = strtol(x, &endx, 8);
assert(endx > x);
(*i) += endx - x;
return val;
}
/*
* Parse a hexadecimal encoded character starting at index i in string s. The
* resulting character will be returned and the index i will be updated to
* point at the character directly after the end of the encoding, this may be
* the '\0' terminator of the string.
*/
static char get_hex_char(const char *s, int *i)
{
char x[3];
char *endx;
long val;
x[2] = '\0';
strncpy(x, s + *i, 2);
val = strtol(x, &endx, 16);
if (!(endx > x))
die("\\x used with no following hex digits\n");
(*i) += endx - x;
return val;
}
char get_escape_char(const char *s, int *i)
{
char c = s[*i];
int j = *i + 1;
char val;
switch (c) {
case 'a':
val = '\a';
break;
case 'b':
val = '\b';
break;
case 't':
val = '\t';
break;
case 'n':
val = '\n';
break;
case 'v':
val = '\v';
break;
case 'f':
val = '\f';
break;
case 'r':
val = '\r';
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
j--; /* need to re-read the first digit as
* part of the octal value */
val = get_oct_char(s, &j);
break;
case 'x':
val = get_hex_char(s, &j);
break;
default:
val = c;
}
(*i) = j;
return val;
}
int utilfdt_read_err_len(const char *filename, char **buffp, off_t *len)
{
int fd = 0; /* assume stdin */
char *buf = NULL;
off_t bufsize = 1024, offset = 0;
int ret = 0;
*buffp = NULL;
if (strcmp(filename, "-") != 0) {
fd = open(filename, O_RDONLY);
if (fd < 0)
return errno;
}
/* Loop until we have read everything */
buf = xmalloc(bufsize);
do {
/* Expand the buffer to hold the next chunk */
if (offset == bufsize) {
bufsize *= 2;
buf = xrealloc(buf, bufsize);
}
ret = read(fd, &buf[offset], bufsize - offset);
if (ret < 0) {
ret = errno;
break;
}
offset += ret;
} while (ret != 0);
/* Clean up, including closing stdin; return errno on error */
close(fd);
if (ret)
free(buf);
else
*buffp = buf;
*len = bufsize;
return ret;
}
int utilfdt_read_err(const char *filename, char **buffp)
{
off_t len;
return utilfdt_read_err_len(filename, buffp, &len);
}
char *utilfdt_read_len(const char *filename, off_t *len)
{
char *buff;
int ret = utilfdt_read_err_len(filename, &buff, len);
if (ret) {
fprintf(stderr, "Couldn't open blob from '%s': %s\n", filename,
strerror(ret));
return NULL;
}
/* Successful read */
return buff;
}
char *utilfdt_read(const char *filename)
{
off_t len;
return utilfdt_read_len(filename, &len);
}
int utilfdt_write_err(const char *filename, const void *blob)
{
int fd = 1; /* assume stdout */
int totalsize;
int offset;
int ret = 0;
const char *ptr = blob;
if (strcmp(filename, "-") != 0) {
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd < 0)
return errno;
}
totalsize = fdt_totalsize(blob);
offset = 0;
while (offset < totalsize) {
ret = write(fd, ptr + offset, totalsize - offset);
if (ret < 0) {
ret = -errno;
break;
}
offset += ret;
}
/* Close the file/stdin; return errno on error */
if (fd != 1)
close(fd);
return ret < 0 ? -ret : 0;
}
int utilfdt_write(const char *filename, const void *blob)
{
int ret = utilfdt_write_err(filename, blob);
if (ret) {
fprintf(stderr, "Couldn't write blob to '%s': %s\n", filename,
strerror(ret));
}
return ret ? -1 : 0;
}
int utilfdt_decode_type(const char *fmt, int *type, int *size)
{
int qualifier = 0;
if (!*fmt)
return -1;
/* get the conversion qualifier */
*size = -1;
if (strchr("hlLb", *fmt)) {
qualifier = *fmt++;
if (qualifier == *fmt) {
switch (*fmt++) {
/* TODO: case 'l': qualifier = 'L'; break;*/
case 'h':
qualifier = 'b';
break;
}
}
}
/* we should now have a type */
if ((*fmt == '\0') || !strchr("iuxs", *fmt))
return -1;
/* convert qualifier (bhL) to byte size */
if (*fmt != 's')
*size = qualifier == 'b' ? 1 :
qualifier == 'h' ? 2 :
qualifier == 'l' ? 4 : -1;
*type = *fmt++;
/* that should be it! */
if (*fmt)
return -1;
return 0;
}
void utilfdt_print_data(const char *data, int len)
{
int i;
const char *s;
/* no data, don't print */
if (len == 0)
return;
if (util_is_printable_string(data, len)) {
printf(" = ");
s = data;
do {
printf("\"%s\"", s);
s += strlen(s) + 1;
if (s < data + len)
printf(", ");
} while (s < data + len);
} else if ((len % 4) == 0) {
const fdt32_t *cell = (const fdt32_t *)data;
printf(" = <");
for (i = 0, len /= 4; i < len; i++)
printf("0x%08x%s", fdt32_to_cpu(cell[i]),
i < (len - 1) ? " " : "");
printf(">");
} else {
const unsigned char *p = (const unsigned char *)data;
printf(" = [");
for (i = 0; i < len; i++)
printf("%02x%s", *p++, i < len - 1 ? " " : "");
printf("]");
}
}
void NORETURN util_version(void)
{
printf("Version: %s\n", DTC_VERSION);
exit(0);
}
void NORETURN util_usage(const char *errmsg, const char *synopsis,
const char *short_opts,
struct option const long_opts[],
const char * const opts_help[])
{
FILE *fp = errmsg ? stderr : stdout;
const char a_arg[] = "<arg>";
size_t a_arg_len = strlen(a_arg) + 1;
size_t i;
int optlen;
fprintf(fp,
"Usage: %s\n"
"\n"
"Options: -[%s]\n", synopsis, short_opts);
/* prescan the --long opt length to auto-align */
optlen = 0;
for (i = 0; long_opts[i].name; ++i) {
/* +1 is for space between --opt and help text */
int l = strlen(long_opts[i].name) + 1;
if (long_opts[i].has_arg == a_argument)
l += a_arg_len;
if (optlen < l)
optlen = l;
}
for (i = 0; long_opts[i].name; ++i) {
/* helps when adding new applets or options */
assert(opts_help[i] != NULL);
/* first output the short flag if it has one */
if (long_opts[i].val > '~')
fprintf(fp, " ");
else
fprintf(fp, " -%c, ", long_opts[i].val);
/* then the long flag */
if (long_opts[i].has_arg == no_argument)
fprintf(fp, "--%-*s", optlen, long_opts[i].name);
else
fprintf(fp, "--%s %s%*s", long_opts[i].name, a_arg,
(int)(optlen - strlen(long_opts[i].name) - a_arg_len), "");
/* finally the help text */
fprintf(fp, "%s\n", opts_help[i]);
}
if (errmsg) {
fprintf(fp, "\nError: %s\n", errmsg);
exit(EXIT_FAILURE);
} else
exit(EXIT_SUCCESS);
}
| {
"pile_set_name": "Github"
} |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package urlesc implements query escaping as per RFC 3986.
// It contains some parts of the net/url package, modified so as to allow
// some reserved characters incorrectly escaped by net/url.
// See https://github.com/golang/go/issues/5684
package urlesc
import (
"bytes"
"net/url"
"strings"
)
type encoding int
const (
encodePath encoding = 1 + iota
encodeUserPassword
encodeQueryComponent
encodeFragment
)
// Return true if the specified character should be escaped when
// appearing in a URL string, according to RFC 3986.
func shouldEscape(c byte, mode encoding) bool {
// §2.3 Unreserved characters (alphanum)
if 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' {
return false
}
switch c {
case '-', '.', '_', '~': // §2.3 Unreserved characters (mark)
return false
// §2.2 Reserved characters (reserved)
case ':', '/', '?', '#', '[', ']', '@', // gen-delims
'!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=': // sub-delims
// Different sections of the URL allow a few of
// the reserved characters to appear unescaped.
switch mode {
case encodePath: // §3.3
// The RFC allows sub-delims and : @.
// '/', '[' and ']' can be used to assign meaning to individual path
// segments. This package only manipulates the path as a whole,
// so we allow those as well. That leaves only ? and # to escape.
return c == '?' || c == '#'
case encodeUserPassword: // §3.2.1
// The RFC allows : and sub-delims in
// userinfo. The parsing of userinfo treats ':' as special so we must escape
// all the gen-delims.
return c == ':' || c == '/' || c == '?' || c == '#' || c == '[' || c == ']' || c == '@'
case encodeQueryComponent: // §3.4
// The RFC allows / and ?.
return c != '/' && c != '?'
case encodeFragment: // §4.1
// The RFC text is silent but the grammar allows
// everything, so escape nothing but #
return c == '#'
}
}
// Everything else must be escaped.
return true
}
// QueryEscape escapes the string so it can be safely placed
// inside a URL query.
func QueryEscape(s string) string {
return escape(s, encodeQueryComponent)
}
func escape(s string, mode encoding) string {
spaceCount, hexCount := 0, 0
for i := 0; i < len(s); i++ {
c := s[i]
if shouldEscape(c, mode) {
if c == ' ' && mode == encodeQueryComponent {
spaceCount++
} else {
hexCount++
}
}
}
if spaceCount == 0 && hexCount == 0 {
return s
}
t := make([]byte, len(s)+2*hexCount)
j := 0
for i := 0; i < len(s); i++ {
switch c := s[i]; {
case c == ' ' && mode == encodeQueryComponent:
t[j] = '+'
j++
case shouldEscape(c, mode):
t[j] = '%'
t[j+1] = "0123456789ABCDEF"[c>>4]
t[j+2] = "0123456789ABCDEF"[c&15]
j += 3
default:
t[j] = s[i]
j++
}
}
return string(t)
}
var uiReplacer = strings.NewReplacer(
"%21", "!",
"%27", "'",
"%28", "(",
"%29", ")",
"%2A", "*",
)
// unescapeUserinfo unescapes some characters that need not to be escaped as per RFC3986.
func unescapeUserinfo(s string) string {
return uiReplacer.Replace(s)
}
// Escape reassembles the URL into a valid URL string.
// The general form of the result is one of:
//
// scheme:opaque
// scheme://userinfo@host/path?query#fragment
//
// If u.Opaque is non-empty, String uses the first form;
// otherwise it uses the second form.
//
// In the second form, the following rules apply:
// - if u.Scheme is empty, scheme: is omitted.
// - if u.User is nil, userinfo@ is omitted.
// - if u.Host is empty, host/ is omitted.
// - if u.Scheme and u.Host are empty and u.User is nil,
// the entire scheme://userinfo@host/ is omitted.
// - if u.Host is non-empty and u.Path begins with a /,
// the form host/path does not add its own /.
// - if u.RawQuery is empty, ?query is omitted.
// - if u.Fragment is empty, #fragment is omitted.
func Escape(u *url.URL) string {
var buf bytes.Buffer
if u.Scheme != "" {
buf.WriteString(u.Scheme)
buf.WriteByte(':')
}
if u.Opaque != "" {
buf.WriteString(u.Opaque)
} else {
if u.Scheme != "" || u.Host != "" || u.User != nil {
buf.WriteString("//")
if ui := u.User; ui != nil {
buf.WriteString(unescapeUserinfo(ui.String()))
buf.WriteByte('@')
}
if h := u.Host; h != "" {
buf.WriteString(h)
}
}
if u.Path != "" && u.Path[0] != '/' && u.Host != "" {
buf.WriteByte('/')
}
buf.WriteString(escape(u.Path, encodePath))
}
if u.RawQuery != "" {
buf.WriteByte('?')
buf.WriteString(u.RawQuery)
}
if u.Fragment != "" {
buf.WriteByte('#')
buf.WriteString(escape(u.Fragment, encodeFragment))
}
return buf.String()
}
| {
"pile_set_name": "Github"
} |
use strict;
use warnings;
package OpenXPKI::Service::SCEP::Command;
use base qw(OpenXPKI::Service::LibSCEP::Command);
sub START {
my ($self, $ident, $arg_ref) = @_;
##! 1: "START"
##! 2: ref $self
# only in Command.pm base class: get implementation
if (ref $self eq 'OpenXPKI::Service::SCEP::Command') {
##! 4: Dumper $arg_ref
$self->attach_impl($arg_ref);
}
}
1;
__END__;
| {
"pile_set_name": "Github"
} |
new Array();
new Array(1);
new Array(1, 2, 3);
| {
"pile_set_name": "Github"
} |
#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* 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, 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 XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "guilib/GUIDialog.h"
#include "music/Song.h"
#include "music/Artist.h"
#include "music/Album.h"
#include "FileItem.h"
class CFileItem;
class CFileItemList;
class CGUIDialogMusicInfo :
public CGUIDialog
{
public:
CGUIDialogMusicInfo(void);
virtual ~CGUIDialogMusicInfo(void);
bool OnMessage(CGUIMessage& message) override;
bool OnAction(const CAction &action) override;
void SetAlbum(const CAlbum& album, const std::string &path);
void SetArtist(const CArtist& artist, const std::string &path);
bool NeedRefresh() const { return m_bRefresh; };
bool NeedsUpdate() const { return m_needsUpdate; };
bool HasUpdatedThumb() const { return m_hasUpdatedThumb; };
bool HasListItems() const override { return true; };
CFileItemPtr GetCurrentListItem(int offset = 0) override;
const CFileItemList& CurrentDirectory() const { return *m_albumSongs; };
static void AddItemPathToFileBrowserSources(VECSOURCES &sources, const CFileItem &item);
static void ShowFor(CFileItem item);
protected:
void OnInitWindow() override;
void Update();
void SetLabel(int iControl, const std::string& strLabel);
void OnGetThumb();
void OnGetFanart();
void SetSongs(const VECSONGS &songs) const;
void SetDiscography() const;
void OnSearch(const CFileItem* pItem);
void OnSetUserrating() const;
void SetUserrating(int userrating) const;
CAlbum m_album;
CArtist m_artist;
int m_startUserrating;
bool m_bViewReview;
bool m_bRefresh;
bool m_needsUpdate;
bool m_hasUpdatedThumb;
bool m_bArtistInfo;
CFileItemPtr m_albumItem;
CFileItemList* m_albumSongs;
};
| {
"pile_set_name": "Github"
} |
Car -1 -1 -10 523 178 561 208 1.54 1.71 4.45 -3.70 1.89 40.10 1.57 1.00
Car -1 -1 -10 208 176 384 280 1.78 1.69 4.24 -6.15 1.87 14.62 1.58 1.00
Car -1 -1 -10 341 179 437 246 1.71 1.71 4.40 -6.39 1.93 21.29 1.51 1.00
Car -1 -1 -10 492 181 528 205 1.45 1.64 3.89 -6.40 2.02 46.73 1.62 1.00
Car -1 -1 -10 852 186 1601 627 1.53 1.58 3.69 2.81 1.65 4.49 -1.54 0.98
Car -1 -1 -10 434 183 482 218 1.44 1.54 3.77 -6.70 1.92 31.96 1.51 0.98
Car -1 -1 -10 632 173 657 194 1.52 1.65 3.92 2.53 1.57 53.69 -1.56 0.95
Car -1 -1 -10 695 166 773 191 1.59 1.74 4.89 8.00 1.20 46.79 -2.99 0.93
Car -1 -1 -10 -403 212 170 458 1.46 1.62 3.74 -6.14 1.94 6.77 1.58 0.74
Car -1 -1 -10 545 176 572 197 1.51 1.58 3.86 -3.87 1.80 53.69 1.38 0.29
Car -1 -1 -10 1034 161 1231 260 1.50 1.52 3.68 9.04 1.33 12.90 1.79 0.07
Car -1 -1 -10 1023 162 1232 266 1.45 1.49 3.68 8.26 1.31 11.97 1.79 0.05
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2015 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.
*/
package com.example.android.xyztouristattractions.common;
public class Constants {
private Constants() {};
// Set to false to have the geofence trigger use the enhanced notifications instead
public static final boolean USE_MICRO_APP = true;
public static final int GOOGLE_API_CLIENT_TIMEOUT_S = 10; // 10 seconds
public static final String GOOGLE_API_CLIENT_ERROR_MSG =
"Failed to connect to GoogleApiClient (error code = %d)";
// Used to size the images in the mobile app so they can animate cleanly from list to detail
public static final int IMAGE_ANIM_MULTIPLIER = 2;
// Resize images sent to Wear to 400x400px
public static final int WEAR_IMAGE_SIZE = 400;
// Except images that can be set as a background with parallax, set width 640x instead
public static final int WEAR_IMAGE_SIZE_PARALLAX_WIDTH = 640;
// The minimum bottom inset percent to use on a round screen device
public static final float WEAR_ROUND_MIN_INSET_PERCENT = 0.08f;
// Max # of attractions to show at once
public static final int MAX_ATTRACTIONS = 4;
// Notification IDs
public static final int MOBILE_NOTIFICATION_ID = 100;
public static final int WEAR_NOTIFICATION_ID = 200;
// Intent and bundle extras
public static final String EXTRA_ATTRACTIONS = "extra_attractions";
public static final String EXTRA_ATTRACTIONS_URI = "extra_attractions_uri";
public static final String EXTRA_TITLE = "extra_title";
public static final String EXTRA_DESCRIPTION = "extra_description";
public static final String EXTRA_LOCATION_LAT = "extra_location_lat";
public static final String EXTRA_LOCATION_LNG = "extra_location_lng";
public static final String EXTRA_DISTANCE = "extra_distance";
public static final String EXTRA_CITY = "extra_city";
public static final String EXTRA_IMAGE = "extra_image";
public static final String EXTRA_IMAGE_SECONDARY = "extra_image_secondary";
public static final String EXTRA_TIMESTAMP = "extra_timestamp";
// Wear Data API paths
public static final String ATTRACTION_PATH = "/attraction";
public static final String START_PATH = "/start";
public static final String START_ATTRACTION_PATH = START_PATH + "/attraction";
public static final String START_NAVIGATION_PATH = START_PATH + "/navigation";
public static final String CLEAR_NOTIFICATIONS_PATH = "/clear";
// Maps values
public static final String MAPS_INTENT_URI = "geo:0,0?q=";
public static final String MAPS_NAVIGATION_INTENT_URI = "google.navigation:mode=w&q=";
}
| {
"pile_set_name": "Github"
} |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Schema processing for discovery based APIs
Schemas holds an APIs discovery schemas. It can return those schema as
deserialized JSON objects, or pretty print them as prototype objects that
conform to the schema.
For example, given the schema:
schema = \"\"\"{
"Foo": {
"type": "object",
"properties": {
"etag": {
"type": "string",
"description": "ETag of the collection."
},
"kind": {
"type": "string",
"description": "Type of the collection ('calendar#acl').",
"default": "calendar#acl"
},
"nextPageToken": {
"type": "string",
"description": "Token used to access the next
page of this result. Omitted if no further results are available."
}
}
}
}\"\"\"
s = Schemas(schema)
print s.prettyPrintByName('Foo')
Produces the following output:
{
"nextPageToken": "A String", # Token used to access the
# next page of this result. Omitted if no further results are available.
"kind": "A String", # Type of the collection ('calendar#acl').
"etag": "A String", # ETag of the collection.
},
The constructor takes a discovery document in which to look up named schema.
"""
# TODO(jcgregorio) support format, enum, minimum, maximum
__author__ = '[email protected] (Joe Gregorio)'
import copy
from oauth2client import util
from oauth2client.anyjson import simplejson
class Schemas(object):
"""Schemas for an API."""
def __init__(self, discovery):
"""Constructor.
Args:
discovery: object, Deserialized discovery document from which we pull
out the named schema.
"""
self.schemas = discovery.get('schemas', {})
# Cache of pretty printed schemas.
self.pretty = {}
@util.positional(2)
def _prettyPrintByName(self, name, seen=None, dent=0):
"""Get pretty printed object prototype from the schema name.
Args:
name: string, Name of schema in the discovery document.
seen: list of string, Names of schema already seen. Used to handle
recursive definitions.
Returns:
string, A string that contains a prototype object with
comments that conforms to the given schema.
"""
if seen is None:
seen = []
if name in seen:
# Do not fall into an infinite loop over recursive definitions.
return '# Object with schema name: %s' % name
seen.append(name)
if name not in self.pretty:
self.pretty[name] = _SchemaToStruct(self.schemas[name],
seen, dent=dent).to_str(self._prettyPrintByName)
seen.pop()
return self.pretty[name]
def prettyPrintByName(self, name):
"""Get pretty printed object prototype from the schema name.
Args:
name: string, Name of schema in the discovery document.
Returns:
string, A string that contains a prototype object with
comments that conforms to the given schema.
"""
# Return with trailing comma and newline removed.
return self._prettyPrintByName(name, seen=[], dent=1)[:-2]
@util.positional(2)
def _prettyPrintSchema(self, schema, seen=None, dent=0):
"""Get pretty printed object prototype of schema.
Args:
schema: object, Parsed JSON schema.
seen: list of string, Names of schema already seen. Used to handle
recursive definitions.
Returns:
string, A string that contains a prototype object with
comments that conforms to the given schema.
"""
if seen is None:
seen = []
return _SchemaToStruct(schema, seen, dent=dent).to_str(self._prettyPrintByName)
def prettyPrintSchema(self, schema):
"""Get pretty printed object prototype of schema.
Args:
schema: object, Parsed JSON schema.
Returns:
string, A string that contains a prototype object with
comments that conforms to the given schema.
"""
# Return with trailing comma and newline removed.
return self._prettyPrintSchema(schema, dent=1)[:-2]
def get(self, name):
"""Get deserialized JSON schema from the schema name.
Args:
name: string, Schema name.
"""
return self.schemas[name]
class _SchemaToStruct(object):
"""Convert schema to a prototype object."""
@util.positional(3)
def __init__(self, schema, seen, dent=0):
"""Constructor.
Args:
schema: object, Parsed JSON schema.
seen: list, List of names of schema already seen while parsing. Used to
handle recursive definitions.
dent: int, Initial indentation depth.
"""
# The result of this parsing kept as list of strings.
self.value = []
# The final value of the parsing.
self.string = None
# The parsed JSON schema.
self.schema = schema
# Indentation level.
self.dent = dent
# Method that when called returns a prototype object for the schema with
# the given name.
self.from_cache = None
# List of names of schema already seen while parsing.
self.seen = seen
def emit(self, text):
"""Add text as a line to the output.
Args:
text: string, Text to output.
"""
self.value.extend([" " * self.dent, text, '\n'])
def emitBegin(self, text):
"""Add text to the output, but with no line terminator.
Args:
text: string, Text to output.
"""
self.value.extend([" " * self.dent, text])
def emitEnd(self, text, comment):
"""Add text and comment to the output with line terminator.
Args:
text: string, Text to output.
comment: string, Python comment.
"""
if comment:
divider = '\n' + ' ' * (self.dent + 2) + '# '
lines = comment.splitlines()
lines = [x.rstrip() for x in lines]
comment = divider.join(lines)
self.value.extend([text, ' # ', comment, '\n'])
else:
self.value.extend([text, '\n'])
def indent(self):
"""Increase indentation level."""
self.dent += 1
def undent(self):
"""Decrease indentation level."""
self.dent -= 1
def _to_str_impl(self, schema):
"""Prototype object based on the schema, in Python code with comments.
Args:
schema: object, Parsed JSON schema file.
Returns:
Prototype object based on the schema, in Python code with comments.
"""
stype = schema.get('type')
if stype == 'object':
self.emitEnd('{', schema.get('description', ''))
self.indent()
if 'properties' in schema:
for pname, pschema in schema.get('properties', {}).iteritems():
self.emitBegin('"%s": ' % pname)
self._to_str_impl(pschema)
elif 'additionalProperties' in schema:
self.emitBegin('"a_key": ')
self._to_str_impl(schema['additionalProperties'])
self.undent()
self.emit('},')
elif '$ref' in schema:
schemaName = schema['$ref']
description = schema.get('description', '')
s = self.from_cache(schemaName, seen=self.seen)
parts = s.splitlines()
self.emitEnd(parts[0], description)
for line in parts[1:]:
self.emit(line.rstrip())
elif stype == 'boolean':
value = schema.get('default', 'True or False')
self.emitEnd('%s,' % str(value), schema.get('description', ''))
elif stype == 'string':
value = schema.get('default', 'A String')
self.emitEnd('"%s",' % str(value), schema.get('description', ''))
elif stype == 'integer':
value = schema.get('default', '42')
self.emitEnd('%s,' % str(value), schema.get('description', ''))
elif stype == 'number':
value = schema.get('default', '3.14')
self.emitEnd('%s,' % str(value), schema.get('description', ''))
elif stype == 'null':
self.emitEnd('None,', schema.get('description', ''))
elif stype == 'any':
self.emitEnd('"",', schema.get('description', ''))
elif stype == 'array':
self.emitEnd('[', schema.get('description'))
self.indent()
self.emitBegin('')
self._to_str_impl(schema['items'])
self.undent()
self.emit('],')
else:
self.emit('Unknown type! %s' % stype)
self.emitEnd('', '')
self.string = ''.join(self.value)
return self.string
def to_str(self, from_cache):
"""Prototype object based on the schema, in Python code with comments.
Args:
from_cache: callable(name, seen), Callable that retrieves an object
prototype for a schema with the given name. Seen is a list of schema
names already seen as we recursively descend the schema definition.
Returns:
Prototype object based on the schema, in Python code with comments.
The lines of the code will all be properly indented.
"""
self.from_cache = from_cache
return self._to_str_impl(self.schema)
| {
"pile_set_name": "Github"
} |
<?php
$dll = new SplDoublyLinkedList();
var_dump($dll->push());
?>
| {
"pile_set_name": "Github"
} |
# Copyright (c) 2019 The STE||AR-Group
#
# SPDX-License-Identifier: BSL-1.0
# 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)
include(HPX_Message)
include(HPX_Option)
if(NOT HPX_WITH_TESTS AND HPX_TOP_LEVEL)
hpx_set_option(
HPX_COROUTINES_WITH_TESTS
VALUE OFF
FORCE
)
return()
endif()
if(HPX_COROUTINES_WITH_TESTS)
if(HPX_WITH_TESTS_UNIT)
add_hpx_pseudo_target(tests.unit.modules.coroutines)
add_hpx_pseudo_dependencies(
tests.unit.modules tests.unit.modules.coroutines
)
add_subdirectory(unit)
endif()
if(HPX_WITH_TESTS_REGRESSIONS)
add_hpx_pseudo_target(tests.regressions.modules.coroutines)
add_hpx_pseudo_dependencies(
tests.regressions.modules tests.regressions.modules.coroutines
)
add_subdirectory(regressions)
endif()
if(HPX_WITH_TESTS_BENCHMARKS)
add_hpx_pseudo_target(tests.performance.modules.coroutines)
add_hpx_pseudo_dependencies(
tests.performance.modules tests.performance.modules.coroutines
)
add_subdirectory(performance)
endif()
if(HPX_WITH_TESTS_HEADERS)
add_hpx_header_tests(
modules.coroutines
HEADERS ${coroutines_headers}
HEADER_ROOT ${PROJECT_SOURCE_DIR}/include
NOLIBS
DEPENDENCIES hpx_coroutines
)
endif()
endif()
| {
"pile_set_name": "Github"
} |
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
Name: Eigen3
Description: A C++ template library for linear algebra: vectors, matrices, and related algorithms
Requires:
Version: @EIGEN_VERSION_NUMBER@
Libs:
Cflags: -I${prefix}/@INCLUDE_INSTALL_DIR@
| {
"pile_set_name": "Github"
} |
* {
border-color: #800080 !important;
}
a {
color: #5f87af !important;
}
a:visited {
color: #87af87 !important;
}
body {
background-color: #262626 !important;
color: #bcbcbc !important;
}
html {
background-color: #262626 !important;
}
input,
textarea {
background-color: #272727 !important;
color: #bcbcbc !important;
}
blockquote,
pre {
background-color: #272727 !important;
color: #bcbcbc !important;
}
.sfbgg {
background-color: #272727 !important;
}
.sbib_a {
background: linear-gradient(to bottom, #272727, #262626) !important;
}
input#lst-ib,
#sb_ifc0.sbib_b,
#gs_taif0 {
background: transparent !important;
}
#lst-ib,
.sbsb_a {
background-color: #262626 !important;
}
.kpbb {
background-image: linear-gradient(to bottom, #4040ff, #00f) !important;
}
#hdtbSum {
background-color: #262626 !important;
}
#hdtbMenus.hdtb-td-o {
background-color: #262626 !important;
}
#hdtb-tls.hdtb-tl {
background-image: linear-gradient(to bottom, #262626, #272727) !important;
}
#hdtb-tls.hdtb-tl.hdtb-tl-sel {
background-image: linear-gradient(to bottom, #272727, #262626) !important;
}
#abar_button_opt.ab_button {
background: linear-gradient(to bottom, #262626, #272727) !important;
}
#appbar {
background-color: #262626 !important;
}
cite {
color: #008000 !important;
}
.ab_dropdown {
background-color: #262626 !important;
}
div.crp {
background-color: #262626 !important;
}
#fbar {
background-color: #272727 !important;
}
| {
"pile_set_name": "Github"
} |
# Message Passing Neural Networks
MPNNs aim to generalize molecular machine learning models that operate on graph-valued inputs. Graph-Convolutions [https://arxiv.org/abs/1509.09292] and Weaves \
[https://arxiv.org/abs/1603.00856] (among others) can be recast into this framework [https://arxiv.org/abs/1704.01212]
The premise is that the featurization of arbitrary chemical multigraphs can be broken down into a message function, vertex-update function, and a readout functi\
on that is invariant to graph isomorphisms. All functions must be subdifferentiable to preserve gradient-flow and ideally are learnable as well
Models of this style introduce an additional parameter **T**, which is the number of iterations for the message-passing stage. Values greater than 4 don't seem \
to improve performance.
##MPNN-S Variant
MPNNs do provide a nice mathematical framework that can capture modern molecular machine learning algorithms we work with today. One criticism of this algorithm class is that training is slow, due to the sheer number of training iterations required for convergence - at batch size 20 on QM9, the MPNN authors trained for 540 epochs.
This can be improved significantly by using batch normalization, or more interestingly, the new SELU activation [https://arxiv.org/pdf/1706.02515.pdf]. In order to use SELUs straight through the system, we dropped the GRU unit [https://arxiv.org/pdf/1412.3555.pdf] the authors used in favor of a SELU activated fully-connected neural network for each time step **T**. This modified approach now achieves peak performance in as little as 60 epochs on most molecular machine learning datasets.
MPNN-S sets new records on the Delaney & PPB datasets:
| Dataset | Num Examples | MP-DNN Val R2 [Scaffold Split] | GraphConv Val R2 [Scaffold Split] |
| ------ | ------ | ------ | ------ |
| Delaney | 1102 | **.820** | .606 |
| PPB | 1600 | **.427** | .381 |
| Clearance | 838 | **.32** | .28 |
## Run Code
```sh
$ python mpnn.py
```
License
----
MIT
| {
"pile_set_name": "Github"
} |
[package]
name = "bip_dht"
version = "0.6.0"
description = "Implementation of the bittorrent mainline DHT"
authors = ["Andrew <[email protected]>"]
homepage = "https://github.com/GGist/bip-rs"
repository = "https://github.com/GGist/bip-rs/tree/master/bip_dht"
documentation = "https://docs.rs/bip_dht/"
keywords = ["dht", "distributed", "hash", "mainline", "bittorrent"]
license = "MIT/Apache-2.0"
[dependencies]
bip_bencode = { version = "0.2.0" }
bip_handshake = { version = "0.4.0" }
bip_util = { version = "0.5.0" }
crc = "1.2.0"
log = "0.3.0"
mio = "0.5.0"
rand = "0.3.0"
chrono = "0.2.0"
error-chain = "0.7.0"
[features]
unstable = [] | {
"pile_set_name": "Github"
} |
<html>
<body>
<div class="pdf-header">
<span>_TITLE_</span>
</div>
</body>
</html> | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="IdentityResourceExistsKey" xml:space="preserve">
<value>Ресур идентификации {0} уже существует</value>
</data>
<data name="IdentityResourceExistsValue" xml:space="preserve">
<value>Ресур идентификации {0} уже существует</value>
</data>
<data name="IdentityResourcePropertyDoesNotExist" xml:space="preserve">
<value>Свойство ресурса идентификации с id {0} не существует</value>
</data>
<data name="IdentityResourcePropertyExistsKey" xml:space="preserve">
<value>Свойство ресурса идентификации уже существует </value>
</data>
<data name="IdentityResourcePropertyExistsValue" xml:space="preserve">
<value>Свойство ресурса идентификации с ключом ({0}) уже существует</value>
</data>
</root> | {
"pile_set_name": "Github"
} |
<?php
namespace Kunstmaan\NodeBundle\Tests\Event;
use Kunstmaan\NodeBundle\Entity\HasNodeInterface;
use Kunstmaan\NodeBundle\Entity\Node;
use Kunstmaan\NodeBundle\Entity\NodeTranslation;
use Kunstmaan\NodeBundle\Entity\NodeVersion;
use Kunstmaan\NodeBundle\Event\CopyPageTranslationNodeEvent;
use PHPUnit\Framework\TestCase;
/**
* Class ConfigureActionMenuEventTest
*/
class CopyPageTranslationNodeEventTest extends TestCase
{
public function testGetSet()
{
/** @var Node $node */
$node = $this->createMock(Node::class);
/** @var NodeTranslation $nodeTranslation */
$nodeTranslation = $this->createMock(NodeTranslation::class);
/** @var NodeVersion $nodeVersion */
$nodeVersion = $this->createMock(NodeVersion::class);
$page = $this->createMock(HasNodeInterface::class);
$event = new CopyPageTranslationNodeEvent($node, $nodeTranslation, $nodeVersion, $page, $nodeTranslation, $nodeVersion, $page, 'nl');
$this->assertEquals('nl', $event->getOriginalLanguage());
$this->assertInstanceOf(NodeTranslation::class, $event->getOriginalNodeTranslation());
$this->assertInstanceOf(\get_class($page), $event->getOriginalPage());
$this->assertInstanceOf(NodeVersion::class, $event->getOriginalNodeVersion());
$event->setOriginalLanguage('nl');
$event->setOriginalNodeTranslation($nodeTranslation);
$event->setOriginalNodeVersion($nodeVersion);
$event->setOriginalPage($page);
$this->assertEquals('nl', $event->getOriginalLanguage());
$this->assertInstanceOf(NodeTranslation::class, $event->getOriginalNodeTranslation());
$this->assertInstanceOf(\get_class($page), $event->getOriginalPage());
$this->assertInstanceOf(NodeVersion::class, $event->getOriginalNodeVersion());
}
}
| {
"pile_set_name": "Github"
} |
(function() {
"use strict";
window.GOVUK = window.GOVUK || {};
function DocumentGroupOrdering(params) {
this.postURL = params.post_url + '.json';
this.selector = params.selector;
this.groupButtons = $(params.group_buttons);
this.groupContainer = $(params.group_container_selector);
this.updateDocumentGroups();
this.initializeGroupOrdering();
}
DocumentGroupOrdering.prototype.documentGroups = [];
DocumentGroupOrdering.prototype.SPINNER_TEMPLATE = '<div class="loading-spinner"></div>';
DocumentGroupOrdering.prototype.initializeGroupOrdering = function initializeGroupOrdering() {
var reorderButton = this.groupButtons.find('.js-reorder'),
finishReorderButton = this.groupButtons.find('.js-finish-reorder');
reorderButton.click($.proxy(function(e) {
e.preventDefault();
$(e.target).hide();
finishReorderButton.show();
this.groupContainer.sortable({
opacity: 0.5,
distance: 5,
axis: 'y',
stop: $.proxy(this.onGroupDrop, this)
});
}, this)).show();
finishReorderButton.hide().click($.proxy(function(e) {
e.preventDefault();
$(e.target).hide();
reorderButton.show();
this.groupContainer.sortable('destroy');
}, this));
};
DocumentGroupOrdering.prototype.updateDocumentGroups = function updateDocumentGroups() {
this.documentGroups = $(this.selector).map($.proxy(function(i, docList) {
return new this.DocumentGroup(this, docList);
}, this));
};
DocumentGroupOrdering.prototype.getPostData = function getPostData() {
var postData = { groups: [] };
for(var i=0; i<this.documentGroups.length; i++) {
postData.groups.push({
id: this.documentGroups[i].groupID(),
membership_ids: this.documentGroups[i].membershipIDs(),
order: i
});
}
return postData;
};
DocumentGroupOrdering.prototype.doPost = function doPost() {
$.post(this.postURL, this.getPostData(), $.proxy(onPostComplete, this), "json");
function onPostComplete() {
this.loadingSpinner.remove();
}
};
DocumentGroupOrdering.prototype.onDrop = function onDrop(e, ui) {
this.loadingSpinner = $(this.SPINNER_TEMPLATE);
ui.item.append(this.loadingSpinner);
this.doPost();
};
DocumentGroupOrdering.prototype.onGroupDrop = function onGroupDrop(e, ui) {
this.loadingSpinner = $(this.SPINNER_TEMPLATE);
ui.item.append(this.loadingSpinner);
this.updateDocumentGroups();
this.doPost();
};
DocumentGroupOrdering.prototype.DocumentGroup = function DocumentGroup(document_group_ordering, documentList) {
documentList = $(documentList);
this.groupID = function groupID() {
return documentList.data('group-id');
};
this.membershipIDs = function membershipIDs() {
return documentList.find("input[name='memberships[]']").map(function(i, input) {
return input.value;
}).toArray();
};
documentList.sortable({
opacity: 0.5,
distance: 5,
axis: 'y',
connectWith: '.document-list',
stop: $.proxy(document_group_ordering.onDrop, document_group_ordering)
});
};
window.GOVUK.DocumentGroupOrdering = DocumentGroupOrdering;
}());
| {
"pile_set_name": "Github"
} |
<?php
namespace oasis\names\specification\ubl\schema\xsd\CommonBasicComponents_2;
use un\unece\uncefact\data\specification\UnqualifiedDataTypesSchemaModule\_2;
/**
* @xmlNamespace urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2
* @xmlType IdentifierType
* @xmlName LicensePlateIDType
* @var oasis\names\specification\ubl\schema\xsd\CommonBasicComponents_2\LicensePlateIDType
*/
class LicensePlateIDType extends _2\IdentifierType
{
} // end class LicensePlateIDType
| {
"pile_set_name": "Github"
} |
/*
*
* Copyright 2017 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
// Package passthrough implements a pass-through resolver. It sends the target
// name without scheme back to gRPC as resolved address.
package passthrough
import "google.golang.org/grpc/resolver"
const scheme = "passthrough"
type passthroughBuilder struct{}
func (*passthroughBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {
r := &passthroughResolver{
target: target,
cc: cc,
}
r.start()
return r, nil
}
func (*passthroughBuilder) Scheme() string {
return scheme
}
type passthroughResolver struct {
target resolver.Target
cc resolver.ClientConn
}
func (r *passthroughResolver) start() {
r.cc.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: r.target.Endpoint}}})
}
func (*passthroughResolver) ResolveNow(o resolver.ResolveNowOptions) {}
func (*passthroughResolver) Close() {}
func init() {
resolver.Register(&passthroughBuilder{})
}
| {
"pile_set_name": "Github"
} |
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ascender</key>
<integer>1500</integer>
<key>capHeight</key>
<integer>1500</integer>
<key>descender</key>
<integer>-460</integer>
<key>familyName</key>
<string>Amstelvar</string>
<key>guidelines</key>
<array/>
<key>openTypeOS2WeightClass</key>
<integer>400</integer>
<key>openTypeOS2WidthClass</key>
<integer>5</integer>
<key>postscriptBlueValues</key>
<array/>
<key>postscriptFamilyBlues</key>
<array/>
<key>postscriptFamilyOtherBlues</key>
<array/>
<key>postscriptOtherBlues</key>
<array/>
<key>postscriptStemSnapH</key>
<array/>
<key>postscriptStemSnapV</key>
<array/>
<key>postscriptWeightName</key>
<string>Normal</string>
<key>styleName</key>
<string>Roman-opsz144-wght900-wdth100</string>
<key>unitsPerEm</key>
<real>2000.0</real>
<key>versionMajor</key>
<integer>0</integer>
<key>versionMinor</key>
<integer>1</integer>
<key>xHeight</key>
<integer>970</integer>
</dict>
</plist>
| {
"pile_set_name": "Github"
} |
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cxf.systest.jaxrs.security;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "Book")
public class Book {
private String name = "CXF";
private long id = 123L;
public Book() {
}
public Book(String name, long id) {
this.name = name;
this.id = id;
}
public void setName(String n) {
name = n;
}
public String getName() {
return name;
}
public void setId(long i) {
id = i;
}
public long getId() {
return id;
}
}
| {
"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.
*
*/
if (!document.querySelector('meta[http-equiv=Content-Security-Policy]')) {
var msg = 'No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.';
console.error(msg);
setInterval(function() {
console.warn(msg);
}, 10000);
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env bash
set -xe
# Free space on disk
sudo rm -rf ~/p4tools
sudo rm -rf ~/quagga
sudo rm -rf ~/mininet
sudo rm -rf ~/.mininet_history
sudo rm -rf ~/.viminfo
sudo rm -rf ~/.ssh
sudo rm -rf ~/.cache/pip
sudo apt-get clean
sudo apt-get -y autoremove
sudo rm -rf /tmp/*
# Zerofill virtual hd to save space when exporting
time sudo dd if=/dev/zero of=/tmp/zero bs=1M || true
sync ; sleep 1 ; sync ; sudo rm -f /tmp/zero
history -c
rm -f ~/.bash_history
# Delete vagrant user
sudo userdel -r -f vagrant
| {
"pile_set_name": "Github"
} |
地震防災対策特別措置法施行令第二条第二項の額の算定に関する内閣府令
(平成十七年四月一日内閣府令第五十一号)
地震防災対策特別措置法施行令
(平成七年政令第二百九十五号)第二条第二項
の規定に基づき、地震防災対策特別措置法施行令第二条第二項の額の算定に関する内閣府令を次のように定める。
地震防災対策特別措置法施行令第二条第二項
の規定により加算する額は、地震防災対策特別措置法
(平成七年法律第百十一号。以下この項において「法」という。)第四条第三項
の事業に要する経費に対する通常の国の交付金の額に、当該事業につき法別表第一に掲げる割合を当該事業に要する経費に対する通常の国の負担若しくは補助の割合又はこれに相当するもので除して得た数から一を控除して得た数を乗じて算定するものとする。
附 則
この府令は、公布の日から施行する。
| {
"pile_set_name": "Github"
} |
all : c.exe cplay.exe city.exe srvec.exe u2a.exe u2e.exe
#all : u2e.exe
# objects
objs=main.obj
main.c : readvue.c readinf.c readmat.c readasc.c util.c opt.c save.c osort.c
# option flags
asm_f = /ML /m9 /s /JJUMPS
cdeb_f = /AL /c /W2 /Zi
c_f = /AL /Oxaz /W2 /c
# general compile orders
.asm.obj :
tasm $(asm_f) $<
.c.obj :
cl /qc $(c_f) $<
c.exe : $(objs) ..\visu.lib
link /CO /E /ST:8192 $(objs),c.exe,nul,..\visu.lib;
cplay.obj : cplay.c
cl $(c_f) cplay.c
cplay.exe : cplay.obj ..\visu.lib
link /CO /E /ST:2048 cplay.obj,cplay.exe,nul,..\visu.lib;
city.exe : city.obj ..\visu.lib
link /CO /E /ST:2048 city.obj,city.exe,nul,..\visu.lib;
srvec.exe : srvec.obj ..\visu.lib
link /CO /E /ST:2048 srvec.obj,srvec.exe,nul,..\visu.lib;
u2a.exe : u2a.obj ..\visu.lib
link /E /ST:2048 u2a.obj+_bg.obk+..\..\dis\disc.obj,u2a.exe,nul,..\visu.lib;
copy u2a.exe ..\..\main\data
u2e.exe : u2e.obj ..\visu.lib
link /E /ST:2048 u2e.obj ..\..\dis\disc.obj,u2e.exe,nul,..\visu.lib;
copy u2e.exe ..\..\main\data
| {
"pile_set_name": "Github"
} |
using System;
namespace NHibernate.Test.NHSpecificTest.GH2454
{
public class Project
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
}
public class Component
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual Project Project { get; set; }
}
public class Tag
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual Component Component1 { get; set; }
public virtual Component Component2 { get; set; }
}
}
| {
"pile_set_name": "Github"
} |
category:诈骗
title:充值卡消费风险大 商家圈钱玩“失踪”
content:近日,位于小十字的美食美客美食文化广场突然关门,众多手持充值卡的消费者无处消费。遭遇这样消费困扰的市民其实不少。
近日,位于小十字的美食美客美食文化广场突然关门,众多手持充值卡的消费者无处消费。遭遇这样消费困扰的市民其实不少。
近年来,充值消费流行,只需打开时尚一族的钱包,你会发现,除了商场和超市的积分卡及护肤品和服饰品牌的会员卡外,还有各类充值消费卡,而面对这些充值消费卡,买与不买开始困扰许多市民,因为一旦商家中途“失踪”,充值卡中的余额就无法消费。
买卡消费成时尚
“王小姐,您经常来我们美容店做保养,不如购买一张充值消费卡来得划算,不但可以打折优惠,而且还可以享受买就送的优惠措施,何乐而不为呢?”近日,在美容师的极力推介下,市民何小姐在一家美容院内以6000元购买了一张面值为8000元的会员卡。
何小姐只是众多买卡消费者队伍中的一个典型。近年来,随着市民消费观念不断开放以及商家“圈钱”力度的不断加大,买卡充值消费已经成为一种时尚。与此同时,为了刺激消费者买卡充值消费,商家一般都会根据其充值金额给予不同级别的折扣优惠,有时还会赠送一定数量的消费额度。
据了解,除了美容行业外,一些商厦、面包店、洗浴店、专卖店或是小摊位式的洗车行等也都争相加入到这个行列中来。近期,记者在走访调查中发现,除了充值消费队伍不断扩大外,市民充值消费的金额也开始水涨船高,以前,一次性充值500元、1000元的人士被商家当作大客户来看待,如今,千元以下的充值金额已“不上台面”,一次性买卡5000元、1万元的大有人在,他们才是商家眼中的贵宾。
商家圈钱玩“失踪”
就在充值消费日渐红火之际,一些商家却在圈到大量现金后,玩起了“失踪”游戏。
“我在市区一洗车行购买了400元的洗车卡,但卡里余额才用了一半,车行就突然关门了,直到现在仍联系不到车行负责人。”市民肖伟说起充值消费一事,就开始向记者大倒苦水。据介绍,家住小河的肖伟经常在小区旁边某车行洗车,今年2月,在洗车行老板的再三劝说下,他购买了一张面值为400元的充值卡,凭卡平时洗车可以8.8折优惠。但让人意想不到的是,6月中旬,该洗车行在没有任何关门歇业征兆的前提下,突然人去楼空,而肖伟的洗车卡内还剩下100多元余额无处消费。
据记者了解,与肖伟有相同遭遇的市民不在少数。为了免于陷入消费陷阱,许多市民开始与充值消费道别。“钞票一旦给了商家,就没主动权了!”一些消费者这样告诉记者,虽然商家在推介充值消费卡时,都是信誓旦旦,但在充值消费商家队伍不断扩大的同时,玩“失踪”的商家也在不断增加。
充值消费风险大
要换积分就得先往卡里充值,还有的就是先充值后消费才可换取更多积分。其实,这都等于先把钱支付给商家,回头再慢慢消费。商家会告诉你,反正都要消费的,何乐而不为。这在道理上当然没错,但这样的话消费者也就掉进了一个无形的商业陷阱。先充值后消费的问题不仅在于这更容易让人乱花钱,还在于这种模式缺乏必要的消费保障。一旦商家因经营不善倒闭,导致无法继续提供服务,那么消费者预先支付的那部分钱就很可能打水漂。
更有一些不法商家,其开店的目的就是“圈钱”,待钱一到手,立即开溜。据了解,目前不乏一些连锁企业,因为门店多、每月卖卡收入高,他们将不少钱放在资本市场运作,风险更大,一旦出了问题,很可能是“人间蒸发”。
“在决定购买一些充值消费卡时,消费者需关注一下该商家是否有实力、美誉度如何等等。此外,也尽可能不要往卡里充太多的钱。”据工商部门表示,近年来,商家越来越多地推行充值消费,对于绝大多数商家来说,应该说信任度还是可以的,但也有一些不法商家在圈到现金后关门歇业,所以特别提醒广大市民,在购买充值消费卡时一定要多长个心眼。
| {
"pile_set_name": "Github"
} |
require('../modules/core.function.part');
module.exports = require('../modules/_core').Function;
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
namespace GMap.NET.Internals
{
/// <summary>
/// tile load task
/// </summary>
internal struct LoadTask : IEquatable<LoadTask>
{
public GPoint Pos;
public int Zoom;
internal Core Core;
public LoadTask(GPoint pos, int zoom, Core core = null)
{
Pos = pos;
Zoom = zoom;
Core = core;
}
public override string ToString()
{
return Zoom + " - " + Pos.ToString();
}
#region IEquatable<LoadTask> Members
public bool Equals(LoadTask other)
{
return (Zoom == other.Zoom && Pos == other.Pos);
}
#endregion
}
internal class LoadTaskComparer : IEqualityComparer<LoadTask>
{
public bool Equals(LoadTask x, LoadTask y)
{
return x.Zoom == y.Zoom && x.Pos == y.Pos;
}
public int GetHashCode(LoadTask obj)
{
return obj.Zoom ^ obj.Pos.GetHashCode();
}
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ilm.sandwich"
android:installLocation="auto"
android:versionCode="51"
android:versionName="2.4.11">
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
<uses-library android:name="com.google.android.maps" />
<service
android:name=".tools.ForegroundService"
android:enabled="true"
android:exported="true" />
<activity
android:name=".Splashscreen"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".GoogleMap"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name=".Info"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Base.Theme.AppCompat.Light.DarkActionBar" />
<activity
android:name=".BackgroundService"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Base.Theme.AppCompat.Light.DarkActionBar" />
<activity
android:name=".Settings"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Base.Theme.AppCompat.Light.DarkActionBar" />
<activity
android:name=".Webview"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Base.Theme.AppCompat.Light.DarkActionBar" />
<meta-data
android:name="google_analytics_adid_collection_enabled"
android:value="false" />
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="" />
</application>
</manifest> | {
"pile_set_name": "Github"
} |
{
"version": "1.0.0-*",
"dependencies": {
},
"frameworks" : {
}
}
| {
"pile_set_name": "Github"
} |
'use strict';
const build = require('@microsoft/node-library-build');
// This project doesn't have unit tests and GCB's Mocha doesn't play nice with Node 14, so disable Mocha
build.mocha.enabled = false;
build.instrument.enabled = false;
build.initialize(require('gulp'));
| {
"pile_set_name": "Github"
} |
"""
@file
@brief This file get the current version of openshot from the openshot.org website
@author Jonathan Thomas <[email protected]>
@section LICENSE
Copyright (c) 2008-2018 OpenShot Studios, LLC
(http://www.openshotstudios.com). This file is part of
OpenShot Video Editor (http://www.openshot.org), an open-source project
dedicated to delivering high quality video editing and animation solutions
to the world.
OpenShot Video Editor 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.
OpenShot Video Editor 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 OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
"""
import requests
import threading
from classes.app import get_app
from classes import info
from classes.logger import log
import json
def get_current_Version():
"""Get the current version """
t = threading.Thread(target=get_version_from_http)
t.daemon = True
t.start()
def get_version_from_http():
"""Get the current version # from openshot.org"""
url = "http://www.openshot.org/version/json/"
# Send metric HTTP data
try:
r = requests.get(url, headers={"user-agent": "openshot-qt-%s" % info.VERSION}, verify=False)
log.info("Found current version: %s" % r.text)
# Parse version
openshot_version = r.json()["openshot_version"]
# Emit signal for the UI
get_app().window.FoundVersionSignal.emit(openshot_version)
except Exception as Ex:
log.error("Failed to get version from: %s" % url)
| {
"pile_set_name": "Github"
} |
%%%%
scimitar of Flaming Death
Smokin'!
%%%%
scythe "Finisher"
Uzun ve keskin tırpan. Savaşlar için özel olarak modifiye edilmiş
%%%%
sling "Punk"
Garip mavi deriden yapılmış sapan.
%%%%
crossbow "Hellfire"
Cehennem ateşinde dövülmüş ateşten bir arbelat; adı gibi güçlü ateşten oklar
fırlatır
%%%%
robe of Augmentation
En iyi ipekten yapılmış cübbe
%%%%
cloak of Flash
Titreyen bir pelerin
%%%%
skin of Zhor
Garip bir hayvanın kokan derisi
%%%%
salamander hide armour
Salamander derisinden yapılma zırh
%%%%
shield of Resistance
Bronz bir kalkan
%%%%
Maxwell's patent armour
Garip görünüşlü zırh
%%%%
ring of Robustness
Sade çelik bir yüzük
%%%%
| {
"pile_set_name": "Github"
} |
#include "FWCore/Framework/interface/MakerMacros.h"
#include "JetTracksAssociatorAtVertex.h"
#include "JetTracksAssociatorExplicit.h"
#include "JetTracksAssociatorAtCaloFace.h"
#include "JetExtender.h"
#include "JetSignalVertexCompatibility.h"
DEFINE_FWK_MODULE(JetTracksAssociatorAtVertex);
DEFINE_FWK_MODULE(JetTracksAssociatorExplicit);
DEFINE_FWK_MODULE(JetTracksAssociatorAtCaloFace);
DEFINE_FWK_MODULE(JetExtender);
DEFINE_FWK_MODULE(JetSignalVertexCompatibility);
| {
"pile_set_name": "Github"
} |
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height:1;
font-size:0.32rem;
font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif;
}
ol, ul {
list-style: none;
}
a {
text-decoration: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
.clearfix:after, .clearfix:before {
display: table;
content: ''
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
.fl {
float: left;
}
.fr {
float: right;
}
| {
"pile_set_name": "Github"
} |
#ifndef __gl2_h_
#define __gl2_h_
/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */
/*#include <GLES2/gl2platform.h>*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
/*-------------------------------------------------------------------------
* Data type definitions
*-----------------------------------------------------------------------*/
typedef void GLvoid;
typedef char GLchar;
typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
typedef khronos_int8_t GLbyte;
typedef short GLshort;
typedef int GLint;
typedef int GLsizei;
typedef khronos_uint8_t GLubyte;
typedef unsigned short GLushort;
typedef unsigned int GLuint;
typedef khronos_float_t GLfloat;
typedef khronos_float_t GLclampf;
typedef khronos_int32_t GLfixed;
/* GL types for handling large vertex buffer objects */
typedef khronos_intptr_t GLintptr;
typedef khronos_ssize_t GLsizeiptr;
/* OpenGL ES core versions */
#define GL_ES_VERSION_2_0 1
/* ClearBufferMask */
#define GL_DEPTH_BUFFER_BIT 0x00000100
#define GL_STENCIL_BUFFER_BIT 0x00000400
#define GL_COLOR_BUFFER_BIT 0x00004000
/* Boolean */
#define GL_FALSE 0
#define GL_TRUE 1
/* BeginMode */
#define GL_POINTS 0x0000
#define GL_LINES 0x0001
#define GL_LINE_LOOP 0x0002
#define GL_LINE_STRIP 0x0003
#define GL_TRIANGLES 0x0004
#define GL_TRIANGLE_STRIP 0x0005
#define GL_TRIANGLE_FAN 0x0006
/* AlphaFunction (not supported in ES20) */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* BlendingFactorDest */
#define GL_ZERO 0
#define GL_ONE 1
#define GL_SRC_COLOR 0x0300
#define GL_ONE_MINUS_SRC_COLOR 0x0301
#define GL_SRC_ALPHA 0x0302
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
#define GL_DST_ALPHA 0x0304
#define GL_ONE_MINUS_DST_ALPHA 0x0305
/* BlendingFactorSrc */
/* GL_ZERO */
/* GL_ONE */
#define GL_DST_COLOR 0x0306
#define GL_ONE_MINUS_DST_COLOR 0x0307
#define GL_SRC_ALPHA_SATURATE 0x0308
/* GL_SRC_ALPHA */
/* GL_ONE_MINUS_SRC_ALPHA */
/* GL_DST_ALPHA */
/* GL_ONE_MINUS_DST_ALPHA */
/* BlendEquationSeparate */
#define GL_FUNC_ADD 0x8006
#define GL_BLEND_EQUATION 0x8009
#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
#define GL_BLEND_EQUATION_ALPHA 0x883D
/* BlendSubtract */
#define GL_FUNC_SUBTRACT 0x800A
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
/* Separate Blend Functions */
#define GL_BLEND_DST_RGB 0x80C8
#define GL_BLEND_SRC_RGB 0x80C9
#define GL_BLEND_DST_ALPHA 0x80CA
#define GL_BLEND_SRC_ALPHA 0x80CB
#define GL_CONSTANT_COLOR 0x8001
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
#define GL_CONSTANT_ALPHA 0x8003
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
#define GL_BLEND_COLOR 0x8005
/* Buffer Objects */
#define GL_ARRAY_BUFFER 0x8892
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
#define GL_ARRAY_BUFFER_BINDING 0x8894
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
#define GL_STREAM_DRAW 0x88E0
#define GL_STATIC_DRAW 0x88E4
#define GL_DYNAMIC_DRAW 0x88E8
#define GL_BUFFER_SIZE 0x8764
#define GL_BUFFER_USAGE 0x8765
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
/* CullFaceMode */
#define GL_FRONT 0x0404
#define GL_BACK 0x0405
#define GL_FRONT_AND_BACK 0x0408
/* DepthFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* EnableCap */
#define GL_TEXTURE_2D 0x0DE1
#define GL_CULL_FACE 0x0B44
#define GL_BLEND 0x0BE2
#define GL_DITHER 0x0BD0
#define GL_STENCIL_TEST 0x0B90
#define GL_DEPTH_TEST 0x0B71
#define GL_SCISSOR_TEST 0x0C11
#define GL_POLYGON_OFFSET_FILL 0x8037
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
#define GL_SAMPLE_COVERAGE 0x80A0
/* ErrorCode */
#define GL_NO_ERROR 0
#define GL_INVALID_ENUM 0x0500
#define GL_INVALID_VALUE 0x0501
#define GL_INVALID_OPERATION 0x0502
#define GL_OUT_OF_MEMORY 0x0505
/* FrontFaceDirection */
#define GL_CW 0x0900
#define GL_CCW 0x0901
/* GetPName */
#define GL_LINE_WIDTH 0x0B21
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
#define GL_CULL_FACE_MODE 0x0B45
#define GL_FRONT_FACE 0x0B46
#define GL_DEPTH_RANGE 0x0B70
#define GL_DEPTH_WRITEMASK 0x0B72
#define GL_DEPTH_CLEAR_VALUE 0x0B73
#define GL_DEPTH_FUNC 0x0B74
#define GL_STENCIL_CLEAR_VALUE 0x0B91
#define GL_STENCIL_FUNC 0x0B92
#define GL_STENCIL_FAIL 0x0B94
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
#define GL_STENCIL_REF 0x0B97
#define GL_STENCIL_VALUE_MASK 0x0B93
#define GL_STENCIL_WRITEMASK 0x0B98
#define GL_STENCIL_BACK_FUNC 0x8800
#define GL_STENCIL_BACK_FAIL 0x8801
#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
#define GL_STENCIL_BACK_REF 0x8CA3
#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
#define GL_VIEWPORT 0x0BA2
#define GL_SCISSOR_BOX 0x0C10
/* GL_SCISSOR_TEST */
#define GL_COLOR_CLEAR_VALUE 0x0C22
#define GL_COLOR_WRITEMASK 0x0C23
#define GL_UNPACK_ALIGNMENT 0x0CF5
#define GL_PACK_ALIGNMENT 0x0D05
#define GL_MAX_TEXTURE_SIZE 0x0D33
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
#define GL_SUBPIXEL_BITS 0x0D50
#define GL_RED_BITS 0x0D52
#define GL_GREEN_BITS 0x0D53
#define GL_BLUE_BITS 0x0D54
#define GL_ALPHA_BITS 0x0D55
#define GL_DEPTH_BITS 0x0D56
#define GL_STENCIL_BITS 0x0D57
#define GL_POLYGON_OFFSET_UNITS 0x2A00
/* GL_POLYGON_OFFSET_FILL */
#define GL_POLYGON_OFFSET_FACTOR 0x8038
#define GL_TEXTURE_BINDING_2D 0x8069
#define GL_SAMPLE_BUFFERS 0x80A8
#define GL_SAMPLES 0x80A9
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
/* GetTextureParameter */
/* GL_TEXTURE_MAG_FILTER */
/* GL_TEXTURE_MIN_FILTER */
/* GL_TEXTURE_WRAP_S */
/* GL_TEXTURE_WRAP_T */
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
/* HintMode */
#define GL_DONT_CARE 0x1100
#define GL_FASTEST 0x1101
#define GL_NICEST 0x1102
/* HintTarget */
#define GL_GENERATE_MIPMAP_HINT 0x8192
/* DataType */
#define GL_BYTE 0x1400
#define GL_UNSIGNED_BYTE 0x1401
#define GL_SHORT 0x1402
#define GL_UNSIGNED_SHORT 0x1403
#define GL_INT 0x1404
#define GL_UNSIGNED_INT 0x1405
#define GL_FLOAT 0x1406
#define GL_FIXED 0x140C
/* PixelFormat */
#define GL_DEPTH_COMPONENT 0x1902
#define GL_ALPHA 0x1906
#define GL_RGB 0x1907
#define GL_RGBA 0x1908
#define GL_LUMINANCE 0x1909
#define GL_LUMINANCE_ALPHA 0x190A
/* PixelType */
/* GL_UNSIGNED_BYTE */
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
/* Shaders */
#define GL_FRAGMENT_SHADER 0x8B30
#define GL_VERTEX_SHADER 0x8B31
#define GL_MAX_VERTEX_ATTRIBS 0x8869
#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
#define GL_MAX_VARYING_VECTORS 0x8DFC
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
#define GL_SHADER_TYPE 0x8B4F
#define GL_DELETE_STATUS 0x8B80
#define GL_LINK_STATUS 0x8B82
#define GL_VALIDATE_STATUS 0x8B83
#define GL_ATTACHED_SHADERS 0x8B85
#define GL_ACTIVE_UNIFORMS 0x8B86
#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
#define GL_ACTIVE_ATTRIBUTES 0x8B89
#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
#define GL_CURRENT_PROGRAM 0x8B8D
/* StencilFunction */
#define GL_NEVER 0x0200
#define GL_LESS 0x0201
#define GL_EQUAL 0x0202
#define GL_LEQUAL 0x0203
#define GL_GREATER 0x0204
#define GL_NOTEQUAL 0x0205
#define GL_GEQUAL 0x0206
#define GL_ALWAYS 0x0207
/* StencilOp */
/* GL_ZERO */
#define GL_KEEP 0x1E00
#define GL_REPLACE 0x1E01
#define GL_INCR 0x1E02
#define GL_DECR 0x1E03
#define GL_INVERT 0x150A
#define GL_INCR_WRAP 0x8507
#define GL_DECR_WRAP 0x8508
/* StringName */
#define GL_VENDOR 0x1F00
#define GL_RENDERER 0x1F01
#define GL_VERSION 0x1F02
#define GL_EXTENSIONS 0x1F03
/* TextureMagFilter */
#define GL_NEAREST 0x2600
#define GL_LINEAR 0x2601
/* TextureMinFilter */
/* GL_NEAREST */
/* GL_LINEAR */
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
/* TextureParameterName */
#define GL_TEXTURE_MAG_FILTER 0x2800
#define GL_TEXTURE_MIN_FILTER 0x2801
#define GL_TEXTURE_WRAP_S 0x2802
#define GL_TEXTURE_WRAP_T 0x2803
/* TextureTarget */
/* GL_TEXTURE_2D */
#define GL_TEXTURE 0x1702
#define GL_TEXTURE_CUBE_MAP 0x8513
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
/* TextureUnit */
#define GL_TEXTURE0 0x84C0
#define GL_TEXTURE1 0x84C1
#define GL_TEXTURE2 0x84C2
#define GL_TEXTURE3 0x84C3
#define GL_TEXTURE4 0x84C4
#define GL_TEXTURE5 0x84C5
#define GL_TEXTURE6 0x84C6
#define GL_TEXTURE7 0x84C7
#define GL_TEXTURE8 0x84C8
#define GL_TEXTURE9 0x84C9
#define GL_TEXTURE10 0x84CA
#define GL_TEXTURE11 0x84CB
#define GL_TEXTURE12 0x84CC
#define GL_TEXTURE13 0x84CD
#define GL_TEXTURE14 0x84CE
#define GL_TEXTURE15 0x84CF
#define GL_TEXTURE16 0x84D0
#define GL_TEXTURE17 0x84D1
#define GL_TEXTURE18 0x84D2
#define GL_TEXTURE19 0x84D3
#define GL_TEXTURE20 0x84D4
#define GL_TEXTURE21 0x84D5
#define GL_TEXTURE22 0x84D6
#define GL_TEXTURE23 0x84D7
#define GL_TEXTURE24 0x84D8
#define GL_TEXTURE25 0x84D9
#define GL_TEXTURE26 0x84DA
#define GL_TEXTURE27 0x84DB
#define GL_TEXTURE28 0x84DC
#define GL_TEXTURE29 0x84DD
#define GL_TEXTURE30 0x84DE
#define GL_TEXTURE31 0x84DF
#define GL_ACTIVE_TEXTURE 0x84E0
/* TextureWrapMode */
#define GL_REPEAT 0x2901
#define GL_CLAMP_TO_EDGE 0x812F
#define GL_MIRRORED_REPEAT 0x8370
/* Uniform Types */
#define GL_FLOAT_VEC2 0x8B50
#define GL_FLOAT_VEC3 0x8B51
#define GL_FLOAT_VEC4 0x8B52
#define GL_INT_VEC2 0x8B53
#define GL_INT_VEC3 0x8B54
#define GL_INT_VEC4 0x8B55
#define GL_BOOL 0x8B56
#define GL_BOOL_VEC2 0x8B57
#define GL_BOOL_VEC3 0x8B58
#define GL_BOOL_VEC4 0x8B59
#define GL_FLOAT_MAT2 0x8B5A
#define GL_FLOAT_MAT3 0x8B5B
#define GL_FLOAT_MAT4 0x8B5C
#define GL_SAMPLER_2D 0x8B5E
#define GL_SAMPLER_CUBE 0x8B60
/* Vertex Arrays */
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
/* Read Format */
#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
/* Shader Source */
#define GL_COMPILE_STATUS 0x8B81
#define GL_INFO_LOG_LENGTH 0x8B84
#define GL_SHADER_SOURCE_LENGTH 0x8B88
#define GL_SHADER_COMPILER 0x8DFA
/* Shader Binary */
#define GL_SHADER_BINARY_FORMATS 0x8DF8
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
/* Shader Precision-Specified Types */
#define GL_LOW_FLOAT 0x8DF0
#define GL_MEDIUM_FLOAT 0x8DF1
#define GL_HIGH_FLOAT 0x8DF2
#define GL_LOW_INT 0x8DF3
#define GL_MEDIUM_INT 0x8DF4
#define GL_HIGH_INT 0x8DF5
/* Framebuffer Object. */
#define GL_FRAMEBUFFER 0x8D40
#define GL_RENDERBUFFER 0x8D41
#define GL_RGBA4 0x8056
#define GL_RGB5_A1 0x8057
#define GL_RGB565 0x8D62
#define GL_DEPTH_COMPONENT16 0x81A5
#define GL_STENCIL_INDEX8 0x8D48
#define GL_RENDERBUFFER_WIDTH 0x8D42
#define GL_RENDERBUFFER_HEIGHT 0x8D43
#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
#define GL_RENDERBUFFER_RED_SIZE 0x8D50
#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
#define GL_COLOR_ATTACHMENT0 0x8CE0
#define GL_DEPTH_ATTACHMENT 0x8D00
#define GL_STENCIL_ATTACHMENT 0x8D20
#define GL_NONE 0
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
#define GL_FRAMEBUFFER_BINDING 0x8CA6
#define GL_RENDERBUFFER_BINDING 0x8CA7
#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
/*-------------------------------------------------------------------------
* GL core functions.
*-----------------------------------------------------------------------*/
GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode );
GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
GL_APICALL void GL_APIENTRY glFinish (void);
GL_APICALL void GL_APIENTRY glFlush (void);
GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL GLenum GL_APIENTRY glGetError (void);
GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
#ifdef __cplusplus
}
#endif
#endif /* __gl2_h_ */
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
function Animal(name, age, brothers, sisters, sad) {
this.name = name;
this.age = age;
this.brothers = brothers;
this.sisters = sisters;
this.sad = sad;
}
Animal.prototype.isSad = function() {
if (this.sad) {
return 'Ohh :(';
}
else {
return 'Yay!';
}
};
function Cow(bell) {
this.bell = bell;
}
var cow = new Animal("Martha", 10, ["John"], null, true);
var frog = new Animal("Martha", 10, ["John"], null, true);
cow.hasMilk = function() {
return 'Yes!'
};
</script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
// Distributed under the terms of the MIT license
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
// Test case found by fuzzing
[ {
return ( ) {
struct d {
{
}
init {
let a {
protocol A {
class
case ,
| {
"pile_set_name": "Github"
} |
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
namespace Microsoft.Intune.PowerShellGraphSDK.PowerShellCmdlets
{
using System.Management.Automation;
/// <summary>
/// <para type="synopsis">Creates a new object which represents a "microsoft.graph.mailFolder" (or one of its derived types).</para>
/// <para type="description">Creates a new object which represents a "microsoft.graph.mailFolder" (or one of its derived types).</para>
/// </summary>
[Cmdlet("New", "MailFolderObject", DefaultParameterSetName = @"microsoft.graph.mailFolder")]
[ODataType("microsoft.graph.mailFolder")]
public class New_MailFolderObject : ObjectFactoryCmdletBase
{
/// <summary>
/// <para type="description">A switch parameter for selecting the parameter set which corresponds to the "microsoft.graph.mailFolder" type.</para>
/// </summary>
[Selectable]
[Expandable]
[ParameterSetSelector(@"microsoft.graph.mailFolder")]
[Parameter(ParameterSetName = @"microsoft.graph.mailFolder", Mandatory = true, HelpMessage = @"A switch parameter for selecting the parameter set which corresponds to the "microsoft.graph.mailFolder" type.")]
public System.Management.Automation.SwitchParameter mailFolder { get; set; }
/// <summary>
/// <para type="description">The "displayName" property, of type "Edm.String".</para>
/// <para type="description">This property is on the "microsoft.graph.mailFolder" type.</para>
/// </summary>
[ODataType("Edm.String")]
[Selectable]
[Parameter(ParameterSetName = @"microsoft.graph.mailFolder", HelpMessage = @"The "displayName" property, of type "Edm.String".")]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "displayName" property, of type "Edm.String".")]
public System.String displayName { get; set; }
/// <summary>
/// <para type="description">The "parentFolderId" property, of type "Edm.String".</para>
/// <para type="description">This property is on the "microsoft.graph.mailFolder" type.</para>
/// </summary>
[ODataType("Edm.String")]
[Selectable]
[Parameter(ParameterSetName = @"microsoft.graph.mailFolder", HelpMessage = @"The "parentFolderId" property, of type "Edm.String".")]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "parentFolderId" property, of type "Edm.String".")]
public System.String parentFolderId { get; set; }
/// <summary>
/// <para type="description">The "childFolderCount" property, of type "Edm.Int32".</para>
/// <para type="description">This property is on the "microsoft.graph.mailFolder" type.</para>
/// </summary>
[ODataType("Edm.Int32")]
[Selectable]
[Parameter(ParameterSetName = @"microsoft.graph.mailFolder", HelpMessage = @"The "childFolderCount" property, of type "Edm.Int32".")]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "childFolderCount" property, of type "Edm.Int32".")]
public System.Int32 childFolderCount { get; set; }
/// <summary>
/// <para type="description">The "unreadItemCount" property, of type "Edm.Int32".</para>
/// <para type="description">This property is on the "microsoft.graph.mailFolder" type.</para>
/// </summary>
[ODataType("Edm.Int32")]
[Selectable]
[Parameter(ParameterSetName = @"microsoft.graph.mailFolder", HelpMessage = @"The "unreadItemCount" property, of type "Edm.Int32".")]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "unreadItemCount" property, of type "Edm.Int32".")]
public System.Int32 unreadItemCount { get; set; }
/// <summary>
/// <para type="description">The "totalItemCount" property, of type "Edm.Int32".</para>
/// <para type="description">This property is on the "microsoft.graph.mailFolder" type.</para>
/// </summary>
[ODataType("Edm.Int32")]
[Selectable]
[Parameter(ParameterSetName = @"microsoft.graph.mailFolder", HelpMessage = @"The "totalItemCount" property, of type "Edm.Int32".")]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "totalItemCount" property, of type "Edm.Int32".")]
public System.Int32 totalItemCount { get; set; }
/// <summary>
/// <para type="description">The "messages" property, of type "microsoft.graph.message".</para>
/// <para type="description">This property is on the "microsoft.graph.mailFolder" type.</para>
/// </summary>
[ODataType("microsoft.graph.message", "microsoft.graph.eventMessage")]
[Selectable]
[Expandable]
[AllowEmptyCollection]
[Parameter(ParameterSetName = @"microsoft.graph.mailFolder", HelpMessage = @"The "messages" property, of type "microsoft.graph.message".")]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "messages" property, of type "microsoft.graph.message".")]
public System.Object[] messages { get; set; }
/// <summary>
/// <para type="description">The "messageRules" property, of type "microsoft.graph.messageRule".</para>
/// <para type="description">This property is on the "microsoft.graph.mailFolder" type.</para>
/// </summary>
[ODataType("microsoft.graph.messageRule")]
[Selectable]
[Expandable]
[AllowEmptyCollection]
[Parameter(ParameterSetName = @"microsoft.graph.mailFolder", HelpMessage = @"The "messageRules" property, of type "microsoft.graph.messageRule".")]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "messageRules" property, of type "microsoft.graph.messageRule".")]
public System.Object[] messageRules { get; set; }
/// <summary>
/// <para type="description">The "childFolders" property, of type "microsoft.graph.mailFolder".</para>
/// <para type="description">This property is on the "microsoft.graph.mailFolder" type.</para>
/// </summary>
[ODataType("microsoft.graph.mailFolder", "microsoft.graph.mailSearchFolder")]
[Selectable]
[Expandable]
[AllowEmptyCollection]
[Parameter(ParameterSetName = @"microsoft.graph.mailFolder", HelpMessage = @"The "childFolders" property, of type "microsoft.graph.mailFolder".")]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "childFolders" property, of type "microsoft.graph.mailFolder".")]
public System.Object[] childFolders { get; set; }
/// <summary>
/// <para type="description">The "singleValueExtendedProperties" property, of type "microsoft.graph.singleValueLegacyExtendedProperty".</para>
/// <para type="description">This property is on the "microsoft.graph.mailFolder" type.</para>
/// </summary>
[ODataType("microsoft.graph.singleValueLegacyExtendedProperty")]
[Selectable]
[Expandable]
[AllowEmptyCollection]
[Parameter(ParameterSetName = @"microsoft.graph.mailFolder", HelpMessage = @"The "singleValueExtendedProperties" property, of type "microsoft.graph.singleValueLegacyExtendedProperty".")]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "singleValueExtendedProperties" property, of type "microsoft.graph.singleValueLegacyExtendedProperty".")]
public System.Object[] singleValueExtendedProperties { get; set; }
/// <summary>
/// <para type="description">The "multiValueExtendedProperties" property, of type "microsoft.graph.multiValueLegacyExtendedProperty".</para>
/// <para type="description">This property is on the "microsoft.graph.mailFolder" type.</para>
/// </summary>
[ODataType("microsoft.graph.multiValueLegacyExtendedProperty")]
[Selectable]
[Expandable]
[AllowEmptyCollection]
[Parameter(ParameterSetName = @"microsoft.graph.mailFolder", HelpMessage = @"The "multiValueExtendedProperties" property, of type "microsoft.graph.multiValueLegacyExtendedProperty".")]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "multiValueExtendedProperties" property, of type "microsoft.graph.multiValueLegacyExtendedProperty".")]
public System.Object[] multiValueExtendedProperties { get; set; }
/// <summary>
/// <para type="description">A switch parameter for selecting the parameter set which corresponds to the "microsoft.graph.mailSearchFolder" type.</para>
/// </summary>
[Selectable]
[Expandable]
[ParameterSetSelector(@"microsoft.graph.mailSearchFolder")]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", Mandatory = true, HelpMessage = @"A switch parameter for selecting the parameter set which corresponds to the "microsoft.graph.mailSearchFolder" type.")]
public System.Management.Automation.SwitchParameter mailSearchFolder { get; set; }
/// <summary>
/// <para type="description">The "isSupported" property, of type "Edm.Boolean".</para>
/// <para type="description">This property is on the "microsoft.graph.mailSearchFolder" type.</para>
/// </summary>
[ODataType("Edm.Boolean")]
[Selectable]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "isSupported" property, of type "Edm.Boolean".")]
public System.Boolean isSupported { get; set; }
/// <summary>
/// <para type="description">The "includeNestedFolders" property, of type "Edm.Boolean".</para>
/// <para type="description">This property is on the "microsoft.graph.mailSearchFolder" type.</para>
/// </summary>
[ODataType("Edm.Boolean")]
[Selectable]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "includeNestedFolders" property, of type "Edm.Boolean".")]
public System.Boolean includeNestedFolders { get; set; }
/// <summary>
/// <para type="description">The "sourceFolderIds" property, of type "Edm.String".</para>
/// <para type="description">This property is on the "microsoft.graph.mailSearchFolder" type.</para>
/// </summary>
[ODataType("Edm.String")]
[Selectable]
[AllowEmptyCollection]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "sourceFolderIds" property, of type "Edm.String".")]
public System.String[] sourceFolderIds { get; set; }
/// <summary>
/// <para type="description">The "filterQuery" property, of type "Edm.String".</para>
/// <para type="description">This property is on the "microsoft.graph.mailSearchFolder" type.</para>
/// </summary>
[ODataType("Edm.String")]
[Selectable]
[Parameter(ParameterSetName = @"microsoft.graph.mailSearchFolder", HelpMessage = @"The "filterQuery" property, of type "Edm.String".")]
public System.String filterQuery { get; set; }
}
} | {
"pile_set_name": "Github"
} |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_precision) {
var v = opt_precision;
if (undefined === v) {
v = Math.min(getDecimals(n), 3);
}
var base = Math.pow(10, v);
var f = ((n * base) | 0) % base;
return {v: v, f: f};
}
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"AM",
"PM"
],
"DAY": [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
"ERANAMES": [
"Before Christ",
"Anno Domini"
],
"ERAS": [
"BC",
"AD"
],
"FIRSTDAYOFWEEK": 0,
"MONTH": [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
"SHORTDAY": [
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat"
],
"SHORTMONTH": [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
],
"STANDALONEMONTH": [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
"WEEKENDRANGE": [
5,
6
],
"fullDate": "EEEE, d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y h:mm:ss a",
"mediumDate": "d MMM y",
"mediumTime": "h:mm:ss a",
"short": "dd/MM/y h:mm a",
"shortDate": "dd/MM/y",
"shortTime": "h:mm a"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "ZMW",
"DECIMAL_SEP": ".",
"GROUP_SEP": ",",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-\u00a4",
"negSuf": "",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "en-zm",
"localeID": "en_ZM",
"pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]);
| {
"pile_set_name": "Github"
} |
/*
--------------------------------------------------------------------------------
This source file is part of Hydrax.
Visit http://www.ogre3d.org/tikiwiki/Hydrax
Copyright (C) 2011 Jose Luis Cercós Pita <[email protected]>
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/copyleft/lesser.txt.
--------------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------------
// Include the main header
// ----------------------------------------------------------------------------
#include <Real.h>
// ----------------------------------------------------------------------------
// Include Hydrax
// ----------------------------------------------------------------------------
#include <Hydrax.h>
#define _def_PackedNoise true
namespace Hydrax{ namespace Noise{
Real::Real()
: Noise("Real", true)
, mTime(0)
, mPerlinNoise(0)
, mGPUNormalMapManager(0)
{
mPerlinNoise = new Perlin(/*Generic one*/);
}
Real::~Real()
{
remove();
delete mPerlinNoise;
HydraxLOG(getName() + " destroyed.");
}
void Real::create()
{
if (isCreated())
{
return;
}
Noise::create();
mPerlinNoise->create();
}
void Real::remove()
{
if (areGPUNormalMapResourcesCreated())
{
Noise::removeGPUNormalMapResources(mGPUNormalMapManager);
}
if (!isCreated())
{
return;
}
mTime = 0;
mPerlinNoise->remove();
mWaves.clear();
mPressurePoints.clear();
Noise::remove();
}
int Real::addWave(Ogre::Vector2 dir, float A, float T, float p)
{
mWaves.push_back(Wave(dir,A,T,p));
return static_cast<int>(mWaves.size());
}
int Real::addPressurePoint(Ogre::Vector2 Orig, float p, float T, float L)
{
mPressurePoints.push_back(PressurePoint(Orig,p,T,L));
return static_cast<int>(mPressurePoints.size());
}
Wave Real::getWave(int id) const
{
return mWaves.at(id);
}
bool Real::eraseWave(int id)
{
if( (id < 0) || (id >= (int)mWaves.size()) ){
HydraxLOG("Error (Real::eraseWave):\tCan't delete the wave.");
HydraxLOG("\tIdentifier exceed the waves vector dimensions.");
return false;
}
size_t Size = mWaves.size();
mWaves.erase(mWaves.begin() + id);
if(mWaves.size() == Size){
HydraxLOG("Error (Real::eraseWave):\tCan't delete the wave.");
HydraxLOG("\tThe size before deletion matchs with the size after the operation.");
return false;
}
return true;
}
bool Real::modifyWave(int id,Ogre::Vector2 dir, float A, float T, float p)
{
if( (id < 0) || (id >= (int)mWaves.size()) ){
HydraxLOG("Error (Real::eraseWave):\tCan't delete the wave.");
HydraxLOG("\tIdentifier exceed the waves vector dimensions.");
return false;
}
mWaves.at(id) = Wave(dir,A,T,p);
return true;
}
bool Real::createGPUNormalMapResources(GPUNormalMapManager *g)
{
/// @todo Create gpuNormal creator.
return false;
}
void Real::saveCfg(Ogre::String &Data)
{
mPerlinNoise->saveCfg(Data);
}
bool Real::loadCfg(Ogre::ConfigFile &CfgFile)
{
if (!Noise::loadCfg(CfgFile))
{
return false;
}
HydraxLOG("\tReading options...");
mPerlinNoise->setOptions(
Perlin::Options(CfgFileManager::_getIntValue(CfgFile,"Perlin_Octaves"),
CfgFileManager::_getFloatValue(CfgFile,"Perlin_Scale"),
CfgFileManager::_getFloatValue(CfgFile,"Perlin_Falloff"),
CfgFileManager::_getFloatValue(CfgFile,"Perlin_Animspeed"),
CfgFileManager::_getFloatValue(CfgFile,"Perlin_Timemulti"),
CfgFileManager::_getFloatValue(CfgFile,"Perlin_GPU_Strength"),
CfgFileManager::_getVector3Value(CfgFile,"Perlin_GPU_LODParameters")));
HydraxLOG("\tOptions readed.");
return true;
}
void Real::update(const Ogre::Real &timeSinceLastFrame)
{
int i;
mTime += timeSinceLastFrame;
mPerlinNoise->update(timeSinceLastFrame);
for(i=(int)mWaves.size()-1;i>=0;i--) {
mWaves.at(i).update(timeSinceLastFrame);
}
for(i=(int)mPressurePoints.size()-1;i>=0;i--) {
if(!mPressurePoints.at(i).update(timeSinceLastFrame)) {
mPressurePoints.erase(mPressurePoints.begin() + i);
}
}
}
float Real::getValue(const float &x, const float &y)
{
int i;
/// 1st.- Perlin height
float H = mPerlinNoise->getValue(x,y);
/// 2nd.- Waves height
for(i=0;i<(int)mWaves.size();i++) {
H += mWaves.at(i).getValue(x,y);
}
/// 3rd.- Pressure points height
for(i=0;i<(int)mPressurePoints.size();i++) {
H += mPressurePoints.at(i).getValue(x,y);
}
return H;
}
}} // namespace Hydrax::Noise
| {
"pile_set_name": "Github"
} |
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Preferences.h"
#include "mozilla/dom/TimeRanges.h"
#include "MediaResource.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "AndroidMediaPluginHost.h"
#include "nsXPCOMStrings.h"
#include "nsISeekableStream.h"
#include "AndroidMediaReader.h"
#include "nsIGfxInfo.h"
#include "gfxCrashReporterUtils.h"
#include "prmem.h"
#include "prlink.h"
#include "AndroidMediaResourceServer.h"
#include "nsServiceManagerUtils.h"
#include "MPAPI.h"
#include "nsIPropertyBag2.h"
#if defined(ANDROID) || defined(MOZ_WIDGET_GONK)
#include "android/log.h"
#define ALOG(args...) __android_log_print(ANDROID_LOG_INFO, "AndroidMediaPluginHost" , ## args)
#else
#define ALOG(args...) /* do nothing */
#endif
using namespace MPAPI;
Decoder::Decoder() :
mResource(nullptr), mPrivate(nullptr)
{
}
namespace mozilla {
static char* GetResource(Decoder *aDecoder)
{
return static_cast<char*>(aDecoder->mResource);
}
class GetIntPrefEvent : public nsRunnable {
public:
GetIntPrefEvent(const char* aPref, int32_t* aResult)
: mPref(aPref), mResult(aResult) {}
NS_IMETHOD Run() {
return Preferences::GetInt(mPref, mResult);
}
private:
const char* mPref;
int32_t* mResult;
};
static bool GetIntPref(const char* aPref, int32_t* aResult)
{
// GetIntPref() is called on the decoder thread, but the Preferences API
// can only be called on the main thread. Post a runnable and wait.
NS_ENSURE_TRUE(aPref, false);
NS_ENSURE_TRUE(aResult, false);
nsCOMPtr<nsIRunnable> event = new GetIntPrefEvent(aPref, aResult);
return NS_SUCCEEDED(NS_DispatchToMainThread(event, NS_DISPATCH_SYNC));
}
static bool
GetSystemInfoString(const char *aKey, char *aResult, size_t aResultLength)
{
NS_ENSURE_TRUE(aKey, false);
NS_ENSURE_TRUE(aResult, false);
nsCOMPtr<nsIPropertyBag2> infoService = do_GetService("@mozilla.org/system-info;1");
NS_ASSERTION(infoService, "Could not find a system info service");
nsAutoCString key(aKey);
nsAutoCString info;
nsresult rv = infoService->GetPropertyAsACString(NS_ConvertUTF8toUTF16(key),
info);
NS_ENSURE_SUCCESS(rv, false);
strncpy(aResult, info.get(), aResultLength);
return true;
}
static PluginHost sPluginHost = {
nullptr,
nullptr,
nullptr,
nullptr,
GetIntPref,
GetSystemInfoString
};
// Return true if Omx decoding is supported on the device. This checks the
// built in whitelist/blacklist and preferences to see if that is overridden.
static bool IsOmxSupported()
{
bool forceEnabled =
Preferences::GetBool("stagefright.force-enabled", false);
bool disabled =
Preferences::GetBool("stagefright.disabled", false);
if (disabled) {
NS_WARNING("XXX stagefright disabled\n");
return false;
}
ScopedGfxFeatureReporter reporter("Stagefright", forceEnabled);
if (!forceEnabled) {
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
if (gfxInfo) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_STAGEFRIGHT, &status))) {
if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
NS_WARNING("XXX stagefright blacklisted\n");
return false;
}
}
}
}
reporter.SetSuccessful();
return true;
}
// Return the name of the shared library that implements Omx based decoding. This varies
// depending on libstagefright version installed on the device and whether it is B2G vs Android.
// nullptr is returned if Omx decoding is not supported on the device,
static const char* GetOmxLibraryName()
{
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
nsCOMPtr<nsIPropertyBag2> infoService = do_GetService("@mozilla.org/system-info;1");
NS_ASSERTION(infoService, "Could not find a system info service");
int32_t version;
nsresult rv = infoService->GetPropertyAsInt32(NS_LITERAL_STRING("version"), &version);
if (NS_SUCCEEDED(rv)) {
ALOG("Android Version is: %d", version);
}
nsAutoString release_version;
rv = infoService->GetPropertyAsAString(NS_LITERAL_STRING("release_version"), release_version);
if (NS_SUCCEEDED(rv)) {
ALOG("Android Release Version is: %s", NS_LossyConvertUTF16toASCII(release_version).get());
}
nsAutoString device;
rv = infoService->GetPropertyAsAString(NS_LITERAL_STRING("device"), device);
if (NS_SUCCEEDED(rv)) {
ALOG("Android Device is: %s", NS_LossyConvertUTF16toASCII(device).get());
}
nsAutoString manufacturer;
rv = infoService->GetPropertyAsAString(NS_LITERAL_STRING("manufacturer"), manufacturer);
if (NS_SUCCEEDED(rv)) {
ALOG("Android Manufacturer is: %s", NS_LossyConvertUTF16toASCII(manufacturer).get());
}
nsAutoString hardware;
rv = infoService->GetPropertyAsAString(NS_LITERAL_STRING("hardware"), hardware);
if (NS_SUCCEEDED(rv)) {
ALOG("Android Hardware is: %s", NS_LossyConvertUTF16toASCII(hardware).get());
}
#endif
if (!IsOmxSupported())
return nullptr;
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
if (version >= 17) {
return "libomxpluginkk.so";
}
else if (version == 13 || version == 12 || version == 11) {
return "libomxpluginhc.so";
}
else if (version == 10 && release_version >= NS_LITERAL_STRING("2.3.6")) {
// Gingerbread versions from 2.3.6 and above have a different DataSource
// layout to those on 2.3.5 and below.
return "libomxplugingb.so";
}
else if (version == 10 && release_version >= NS_LITERAL_STRING("2.3.4") &&
device.Find("HTC") == 0) {
// HTC devices running Gingerbread 2.3.4+ (HTC Desire HD, HTC Evo Design, etc) seem to
// use a newer version of Gingerbread libstagefright than other 2.3.4 devices.
return "libomxplugingb.so";
}
else if (version == 9 || (version == 10 && release_version <= NS_LITERAL_STRING("2.3.5"))) {
// Gingerbread versions from 2.3.5 and below have a different DataSource
// than 2.3.6 and above.
return "libomxplugingb235.so";
}
else if (version == 8) {
// Froyo
return "libomxpluginfroyo.so";
}
else if (version < 8) {
// Below Froyo not supported
return nullptr;
}
// Ice Cream Sandwich and Jellybean
return "libomxplugin.so";
#elif defined(ANDROID) && defined(MOZ_WIDGET_GONK)
return "libomxplugin.so";
#else
return nullptr;
#endif
}
AndroidMediaPluginHost::AndroidMediaPluginHost() {
MOZ_COUNT_CTOR(AndroidMediaPluginHost);
mResourceServer = AndroidMediaResourceServer::Start();
const char* name = GetOmxLibraryName();
ALOG("Loading OMX Plugin: %s", name ? name : "nullptr");
if (name) {
char *path = PR_GetLibraryFilePathname("libxul.so", (PRFuncPtr) GetOmxLibraryName);
PRLibrary *lib = nullptr;
if (path) {
nsAutoCString libpath(path);
PR_Free(path);
int32_t slash = libpath.RFindChar('/');
if (slash != kNotFound) {
libpath.Truncate(slash + 1);
libpath.Append(name);
lib = PR_LoadLibrary(libpath.get());
}
}
if (!lib)
lib = PR_LoadLibrary(name);
if (lib) {
Manifest *manifest = static_cast<Manifest *>(PR_FindSymbol(lib, "MPAPI_MANIFEST"));
if (manifest) {
mPlugins.AppendElement(manifest);
ALOG("OMX plugin successfully loaded");
}
}
}
}
AndroidMediaPluginHost::~AndroidMediaPluginHost() {
mResourceServer->Stop();
MOZ_COUNT_DTOR(AndroidMediaPluginHost);
}
bool AndroidMediaPluginHost::FindDecoder(const nsACString& aMimeType, const char* const** aCodecs)
{
const char *chars;
size_t len = NS_CStringGetData(aMimeType, &chars, nullptr);
for (size_t n = 0; n < mPlugins.Length(); ++n) {
Manifest *plugin = mPlugins[n];
const char* const *codecs;
if (plugin->CanDecode(chars, len, &codecs)) {
if (aCodecs)
*aCodecs = codecs;
return true;
}
}
return false;
}
MPAPI::Decoder *AndroidMediaPluginHost::CreateDecoder(MediaResource *aResource, const nsACString& aMimeType)
{
NS_ENSURE_TRUE(aResource, nullptr);
nsAutoPtr<Decoder> decoder(new Decoder());
if (!decoder) {
return nullptr;
}
const char *chars;
size_t len = NS_CStringGetData(aMimeType, &chars, nullptr);
for (size_t n = 0; n < mPlugins.Length(); ++n) {
Manifest *plugin = mPlugins[n];
const char* const *codecs;
if (!plugin->CanDecode(chars, len, &codecs)) {
continue;
}
nsCString url;
nsresult rv = mResourceServer->AddResource(aResource, url);
if (NS_FAILED (rv)) continue;
decoder->mResource = strdup(url.get());
if (plugin->CreateDecoder(&sPluginHost, decoder, chars, len)) {
aResource->AddRef();
return decoder.forget();
}
}
return nullptr;
}
void AndroidMediaPluginHost::DestroyDecoder(Decoder *aDecoder)
{
aDecoder->DestroyDecoder(aDecoder);
char* resource = GetResource(aDecoder);
if (resource) {
// resource *shouldn't* be null, but check anyway just in case the plugin
// decoder does something stupid.
mResourceServer->RemoveResource(nsCString(resource));
free(resource);
}
delete aDecoder;
}
AndroidMediaPluginHost *sAndroidMediaPluginHost = nullptr;
AndroidMediaPluginHost *GetAndroidMediaPluginHost()
{
if (!sAndroidMediaPluginHost) {
sAndroidMediaPluginHost = new AndroidMediaPluginHost();
}
return sAndroidMediaPluginHost;
}
void AndroidMediaPluginHost::Shutdown()
{
delete sAndroidMediaPluginHost;
sAndroidMediaPluginHost = nullptr;
}
} // namespace mozilla
| {
"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.
*/
/*
* $Id: RangeFactory.cpp 471747 2006-11-06 14:31:56Z amassari $
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <xercesc/util/regx/RangeFactory.hpp>
XERCES_CPP_NAMESPACE_BEGIN
// ---------------------------------------------------------------------------
// RangeFactory: Constructors and Destructor
// ---------------------------------------------------------------------------
RangeFactory::RangeFactory() :
fRangesCreated(false)
, fKeywordsInitialized(false)
{
}
RangeFactory::~RangeFactory() {
}
XERCES_CPP_NAMESPACE_END
/**
* End of file RangeFactory.cpp
*/
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.